-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHtmlNode.cpp
More file actions
84 lines (73 loc) · 1.6 KB
/
HtmlNode.cpp
File metadata and controls
84 lines (73 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//
// HtmlNode.cpp
// Musee
//
// Created by Denis Stadniczuk on 24/06/14.
// Copyright (c) 2014 Denis Stadniczuk. All rights reserved.
//
#include "HtmlNode.h"
#include "HtmlElement.h"
#include "StringUtil.h"
HtmlNode::HtmlNode(NodeType t)
:type(t)
{
doc = NULL;
parent = NULL;
calculatedX = 0;
calculatedY = 0;
calculatedZ = 0;
offsetW = 0;
offsetH = 0;
scrollW = 0;
scrollH = 0;
}
NodeType HtmlNode::getNodeType()
{
return type;
}
std::string HtmlNode::getTagName()
{
return toUpper(tagName);
}
void HtmlNode::setDocument(HtmlDocument *document)
{
doc = document;
if (getNodeType() == ELEMENT) {
HtmlElement *el = (HtmlElement*) this;
for (int i = 0; i < el->childNodes().size(); i++) {
el->childNodes()[i]->setDocument(document);
}
}
}
HtmlDocument* HtmlNode::document()
{
return doc;
}
void HtmlNode::setParent(HtmlElement *_parent)
{
parent = _parent;
}
HtmlElement* HtmlNode::parentNode()
{
return parent;
}
void HtmlNode::setCalculatedBounds(float x, float y, float z, float offsetWidth, float offsetHeight, float scrollWidth, float scrollHeight)
{
calculatedX = x;
calculatedY = y;
calculatedZ = z;
offsetW = offsetWidth;
offsetH = offsetHeight;
scrollW = scrollWidth;
scrollH = scrollHeight;
}
void HtmlNode::getCalculatedBounds(float &x, float &y, float &z, float &offsetWidth, float &offsetHeight, float &scrollWidth, float &scrollHeight)
{
x = calculatedX;
y = calculatedY;
z = calculatedZ;
offsetWidth = offsetW;
offsetHeight = offsetH;
scrollWidth = scrollW;
scrollHeight = scrollH;
}