KHtml

html_misc.cpp
1 
22 // --------------------------------------------------------------------------
23 
24 #include "dom/html_misc.h"
25 #include "html/html_miscimpl.h"
26 
27 using namespace DOM;
28 
29 HTMLBaseFontElement::HTMLBaseFontElement() : HTMLElement()
30 {
31 }
32 
33 HTMLBaseFontElement::HTMLBaseFontElement(const HTMLBaseFontElement &other) : HTMLElement(other)
34 {
35 }
36 
37 HTMLBaseFontElement::HTMLBaseFontElement(HTMLBaseFontElementImpl *impl) : HTMLElement(impl)
38 {
39 }
40 
41 HTMLBaseFontElement &HTMLBaseFontElement::operator = (const Node &other)
42 {
43  assignOther(other, ID_BASEFONT);
44  return *this;
45 }
46 
47 HTMLBaseFontElement &HTMLBaseFontElement::operator = (const HTMLBaseFontElement &other)
48 {
49  HTMLElement::operator = (other);
50  return *this;
51 }
52 
53 HTMLBaseFontElement::~HTMLBaseFontElement()
54 {
55 }
56 
58 {
59  if (!impl) {
60  return DOMString();
61  }
62  return ((ElementImpl *)impl)->getAttribute(ATTR_COLOR);
63 }
64 
66 {
67  if (impl) {
68  ((ElementImpl *)impl)->setAttribute(ATTR_COLOR, value);
69  }
70 }
71 
73 {
74  if (!impl) {
75  return DOMString();
76  }
77  return ((ElementImpl *)impl)->getAttribute(ATTR_FACE);
78 }
79 
81 {
82  if (impl) {
83  ((ElementImpl *)impl)->setAttribute(ATTR_FACE, value);
84  }
85 }
86 
87 #ifndef KHTML_NO_DEPRECATED
89 {
90  if (!impl) {
91  return DOMString();
92  }
93  return ((ElementImpl *)impl)->getAttribute(ATTR_SIZE);
94 }
95 #endif
96 
97 #ifndef KHTML_NO_DEPRECATED
99 {
100  if (impl) {
101  ((ElementImpl *)impl)->setAttribute(ATTR_SIZE, value);
102  }
103 }
104 #endif
105 
107 {
108  if (!impl) {
109  return 0;
110  }
111  return ((ElementImpl *)impl)->getAttribute(ATTR_SIZE).toInt();
112 }
113 
115 {
116  if (impl) {
117  DOMString value(QString::number(_value));
118  ((ElementImpl *)impl)->setAttribute(ATTR_SIZE, value);
119  }
120 }
121 
122 // --------------------------------------------------------------------------
123 
124 HTMLCollection::HTMLCollection()
125  : impl(nullptr)
126 {
127 }
128 
129 HTMLCollection::HTMLCollection(HTMLCollectionImpl *_impl): impl(_impl)
130 {
131  if (impl) {
132  impl->ref();
133  }
134 }
135 
136 HTMLCollection::HTMLCollection(const HTMLCollection &other)
137 {
138  impl = other.impl;
139  if (impl) {
140  impl->ref();
141  }
142 }
143 
144 HTMLCollection::HTMLCollection(NodeImpl *base, int type)
145 {
146  impl = new HTMLCollectionImpl(base, type);
147  impl->ref();
148 }
149 
150 HTMLCollection &HTMLCollection::operator = (const HTMLCollection &other)
151 {
152  if (impl != other.impl) {
153  if (impl) {
154  impl->deref();
155  }
156  impl = other.impl;
157  if (impl) {
158  impl->ref();
159  }
160  }
161  return *this;
162 }
163 
164 HTMLCollection::~HTMLCollection()
165 {
166  if (impl) {
167  impl->deref();
168  }
169 }
170 
171 unsigned long HTMLCollection::length() const
172 {
173  if (!impl) {
174  return 0;
175  }
176  return ((HTMLCollectionImpl *)impl)->length();
177 }
178 
179 Node HTMLCollection::item(unsigned long index) const
180 {
181  if (!impl) {
182  return nullptr;
183  }
184  return ((HTMLCollectionImpl *)impl)->item(index);
185 }
186 
188 {
189  if (!impl) {
190  return nullptr;
191  }
192  return ((HTMLCollectionImpl *)impl)->namedItem(name);
193 }
194 
196 {
197  if (!impl) {
198  return nullptr;
199  }
200 
201  return static_cast<HTMLCollectionImpl *>(impl)->m_refNode;
202 }
203 
204 Node HTMLCollection::firstItem() const
205 {
206  if (!impl) {
207  return nullptr;
208  }
209  return static_cast<HTMLCollectionImpl *>(impl)->firstItem();
210 }
211 
212 Node HTMLCollection::nextItem() const
213 {
214  if (!impl) {
215  return nullptr;
216  }
217  return static_cast<HTMLCollectionImpl *>(impl)->nextItem();
218 }
219 
220 Node HTMLCollection::nextNamedItem(const DOMString &name) const
221 {
222  if (!impl) {
223  return nullptr;
224  }
225  return static_cast<HTMLCollectionImpl *>(impl)->nextNamedItem(name);
226 }
227 
228 HTMLCollectionImpl *HTMLCollection::handle() const
229 {
230  return impl;
231 }
232 
233 bool HTMLCollection::isNull() const
234 {
235  return (impl == nullptr);
236 }
237 
238 // -----------------------------------------------------------------------------
239 
240 HTMLFormCollection::HTMLFormCollection(NodeImpl *base)
241  : HTMLCollection()
242 {
243  impl = new HTMLFormCollectionImpl(base);
244  impl->ref();
245 }
246 
void setFace(const DOMString &)
see face
Definition: html_misc.cpp:80
The Node interface is the primary datatype for the entire Document Object Model.
Definition: dom_node.h:278
long getSize() const
Computed Font size.
Definition: html_misc.cpp:106
void setColor(const DOMString &)
see color
Definition: html_misc.cpp:65
unsigned long index() const
Definition: dom_node.cpp:517
DOMString type() const
Bullet style.
Definition: html_list.cpp:365
void setSize(long)
see size
Definition: html_misc.cpp:114
QString number(int n, int base)
An HTMLCollection is a list of nodes.
Definition: html_misc.h:133
This class implements the basic string we use in the DOM.
Definition: dom_string.h:44
This library provides a full-featured HTML parser and widget.
DOMString face() const
Font face identifier.
Definition: html_misc.cpp:72
unsigned long length() const
This attribute specifies the length or size of the list.
Definition: html_misc.cpp:171
Node base() const
Definition: html_misc.cpp:195
KHTML_DEPRECATED DOMString size() const
Definition: html_misc.cpp:88
DOMString color() const
Font color.
Definition: html_misc.cpp:57
Node item(unsigned long index) const
This method retrieves a node specified by ordinal index.
Definition: html_misc.cpp:179
Node namedItem(const DOMString &name) const
This method retrieves a Node using a name.
Definition: html_misc.cpp:187
All HTML element interfaces derive from this class.
Definition: html_element.h:70
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Tue Aug 11 2020 22:47:50 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.