html_inline.cpp
00001 00023 // -------------------------------------------------------------------------- 00024 00025 #include "dom/dom_doc.h" 00026 #include "dom/html_inline.h" 00027 #include "html/html_inlineimpl.h" 00028 #include "html/html_baseimpl.h" 00029 #include "xml/dom_docimpl.h" 00030 #include "misc/htmlhashes.h" 00031 00032 using namespace DOM; 00033 00034 HTMLAnchorElement::HTMLAnchorElement() : HTMLElement() 00035 { 00036 } 00037 00038 HTMLAnchorElement::HTMLAnchorElement(const HTMLAnchorElement &other) : HTMLElement(other) 00039 { 00040 } 00041 00042 HTMLAnchorElement::HTMLAnchorElement(HTMLAnchorElementImpl *impl) : HTMLElement(impl) 00043 { 00044 } 00045 00046 HTMLAnchorElement &HTMLAnchorElement::operator = (const Node &other) 00047 { 00048 assignOther( other, ID_A ); 00049 return *this; 00050 } 00051 00052 HTMLAnchorElement &HTMLAnchorElement::operator = (const HTMLAnchorElement &other) 00053 { 00054 HTMLElement::operator = (other); 00055 return *this; 00056 } 00057 00058 HTMLAnchorElement::~HTMLAnchorElement() 00059 { 00060 } 00061 00062 DOMString HTMLAnchorElement::accessKey() const 00063 { 00064 if(!impl) return DOMString(); 00065 return ((ElementImpl *)impl)->getAttribute(ATTR_ACCESSKEY); 00066 } 00067 00068 void HTMLAnchorElement::setAccessKey( const DOMString &value ) 00069 { 00070 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ACCESSKEY, value); 00071 } 00072 00073 DOMString HTMLAnchorElement::charset() const 00074 { 00075 if(!impl) return DOMString(); 00076 return ((ElementImpl *)impl)->getAttribute(ATTR_CHARSET); 00077 } 00078 00079 void HTMLAnchorElement::setCharset( const DOMString &value ) 00080 { 00081 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_CHARSET, value); 00082 } 00083 00084 DOMString HTMLAnchorElement::coords() const 00085 { 00086 if(!impl) return DOMString(); 00087 return ((ElementImpl *)impl)->getAttribute(ATTR_COORDS); 00088 } 00089 00090 void HTMLAnchorElement::setCoords( const DOMString &value ) 00091 { 00092 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_COORDS, value); 00093 } 00094 00095 DOMString HTMLAnchorElement::href() const 00096 { 00097 if(!impl) return DOMString(); 00098 DOMString href = static_cast<ElementImpl*>(impl)->getAttribute(ATTR_HREF); 00099 return !href.isNull() ? impl->getDocument()->completeURL(href.string()) : href; 00100 } 00101 00102 void HTMLAnchorElement::setHref( const DOMString &value ) 00103 { 00104 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_HREF, value); 00105 } 00106 00107 DOMString HTMLAnchorElement::hreflang() const 00108 { 00109 if(!impl) return DOMString(); 00110 return ((ElementImpl *)impl)->getAttribute(ATTR_HREFLANG); 00111 } 00112 00113 void HTMLAnchorElement::setHreflang( const DOMString &value ) 00114 { 00115 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_HREFLANG, value); 00116 } 00117 00118 DOMString HTMLAnchorElement::name() const 00119 { 00120 if(!impl) return DOMString(); 00121 return ((ElementImpl *)impl)->getAttribute(ATTR_NAME); 00122 } 00123 00124 void HTMLAnchorElement::setName( const DOMString &value ) 00125 { 00126 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_NAME, value); 00127 } 00128 00129 DOMString HTMLAnchorElement::rel() const 00130 { 00131 if(!impl) return DOMString(); 00132 return ((ElementImpl *)impl)->getAttribute(ATTR_REL); 00133 } 00134 00135 void HTMLAnchorElement::setRel( const DOMString &value ) 00136 { 00137 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_REL, value); 00138 } 00139 00140 DOMString HTMLAnchorElement::rev() const 00141 { 00142 if(!impl) return DOMString(); 00143 return ((ElementImpl *)impl)->getAttribute(ATTR_REV); 00144 } 00145 00146 void HTMLAnchorElement::setRev( const DOMString &value ) 00147 { 00148 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_REV, value); 00149 } 00150 00151 DOMString HTMLAnchorElement::shape() const 00152 { 00153 if(!impl) return DOMString(); 00154 return ((ElementImpl *)impl)->getAttribute(ATTR_SHAPE); 00155 } 00156 00157 void HTMLAnchorElement::setShape( const DOMString &value ) 00158 { 00159 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_SHAPE, value); 00160 } 00161 00162 long HTMLAnchorElement::tabIndex() const 00163 { 00164 if(!impl) return 0; 00165 return ((ElementImpl *)impl)->getAttribute(ATTR_TABINDEX).toInt(); 00166 } 00167 00168 void HTMLAnchorElement::setTabIndex( long _tabIndex ) 00169 { 00170 if(impl) { 00171 DOMString value(QString::number(_tabIndex)); 00172 ((ElementImpl *)impl)->setAttribute(ATTR_TABINDEX,value); 00173 } 00174 } 00175 00176 DOMString HTMLAnchorElement::target() const 00177 { 00178 if(!impl) return DOMString(); 00179 return ((ElementImpl *)impl)->getAttribute(ATTR_TARGET); 00180 } 00181 00182 void HTMLAnchorElement::setTarget( const DOMString &value ) 00183 { 00184 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_TARGET, value); 00185 } 00186 00187 DOMString HTMLAnchorElement::type() const 00188 { 00189 if(!impl) return DOMString(); 00190 return ((ElementImpl *)impl)->getAttribute(ATTR_TYPE); 00191 } 00192 00193 void HTMLAnchorElement::setType( const DOMString &value ) 00194 { 00195 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_TYPE, value); 00196 } 00197 00198 void HTMLAnchorElement::blur( ) 00199 { 00200 if(impl && impl->getDocument()->focusNode()==impl) 00201 impl->getDocument()->setFocusNode(0); 00202 } 00203 00204 void HTMLAnchorElement::focus( ) 00205 { 00206 if(impl) 00207 impl->getDocument()->setFocusNode(static_cast<ElementImpl*>(impl)); 00208 } 00209 00210 void HTMLAnchorElement::click( ) 00211 { 00212 if(impl) ((HTMLAnchorElement *)impl)->click(); 00213 } 00214 00215 00216 // -------------------------------------------------------------------------- 00217 00218 HTMLBRElement::HTMLBRElement() : HTMLElement() 00219 { 00220 } 00221 00222 HTMLBRElement::HTMLBRElement(const HTMLBRElement &other) : HTMLElement(other) 00223 { 00224 } 00225 00226 HTMLBRElement::HTMLBRElement(HTMLBRElementImpl *impl) : HTMLElement(impl) 00227 { 00228 } 00229 00230 HTMLBRElement &HTMLBRElement::operator = (const Node &other) 00231 { 00232 assignOther( other, ID_BR ); 00233 return *this; 00234 } 00235 00236 HTMLBRElement &HTMLBRElement::operator = (const HTMLBRElement &other) 00237 { 00238 HTMLElement::operator = (other); 00239 return *this; 00240 } 00241 00242 HTMLBRElement::~HTMLBRElement() 00243 { 00244 } 00245 00246 DOMString HTMLBRElement::clear() const 00247 { 00248 if(!impl) return DOMString(); 00249 return ((ElementImpl *)impl)->getAttribute(ATTR_CLEAR); 00250 } 00251 00252 void HTMLBRElement::setClear( const DOMString &value ) 00253 { 00254 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_CLEAR, value); 00255 } 00256 00257 // -------------------------------------------------------------------------- 00258 00259 HTMLFontElement::HTMLFontElement() : HTMLElement() 00260 { 00261 } 00262 00263 HTMLFontElement::HTMLFontElement(const HTMLFontElement &other) : HTMLElement(other) 00264 { 00265 } 00266 00267 HTMLFontElement::HTMLFontElement(HTMLFontElementImpl *impl) : HTMLElement(impl) 00268 { 00269 } 00270 00271 HTMLFontElement &HTMLFontElement::operator = (const Node &other) 00272 { 00273 assignOther( other, ID_FONT ); 00274 return *this; 00275 } 00276 00277 HTMLFontElement &HTMLFontElement::operator = (const HTMLFontElement &other) 00278 { 00279 HTMLElement::operator = (other); 00280 return *this; 00281 } 00282 00283 HTMLFontElement::~HTMLFontElement() 00284 { 00285 } 00286 00287 DOMString HTMLFontElement::color() const 00288 { 00289 if(!impl) return DOMString(); 00290 return ((ElementImpl *)impl)->getAttribute(ATTR_COLOR); 00291 } 00292 00293 void HTMLFontElement::setColor( const DOMString &value ) 00294 { 00295 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_COLOR, value); 00296 } 00297 00298 DOMString HTMLFontElement::face() const 00299 { 00300 if(!impl) return DOMString(); 00301 return ((ElementImpl *)impl)->getAttribute(ATTR_FACE); 00302 } 00303 00304 void HTMLFontElement::setFace( const DOMString &value ) 00305 { 00306 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_FACE, value); 00307 } 00308 00309 DOMString HTMLFontElement::size() const 00310 { 00311 if(!impl) return DOMString(); 00312 return ((ElementImpl *)impl)->getAttribute(ATTR_SIZE); 00313 } 00314 00315 void HTMLFontElement::setSize( const DOMString &value ) 00316 { 00317 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_SIZE, value); 00318 } 00319 00320 00321 // -------------------------------------------------------------------------- 00322 00323 HTMLModElement::HTMLModElement() : HTMLElement() 00324 { 00325 } 00326 00327 HTMLModElement::HTMLModElement(const HTMLModElement &other) : HTMLElement(other) 00328 { 00329 } 00330 00331 HTMLModElement::HTMLModElement(HTMLElementImpl *_impl) 00332 : HTMLElement() 00333 { 00334 if (_impl && (_impl->id() == ID_INS || _impl->id() == ID_DEL)) 00335 impl = _impl; 00336 else 00337 impl = 0; 00338 if ( impl ) impl->ref(); 00339 } 00340 00341 HTMLModElement &HTMLModElement::operator = (const Node &other) 00342 { 00343 if (other.handle() != handle()) { 00344 if( other.elementId() != ID_INS && 00345 other.elementId() != ID_DEL ) 00346 { 00347 if ( impl ) impl->deref(); 00348 impl = 0; 00349 } else { 00350 Node::operator = (other); 00351 } 00352 } 00353 return *this; 00354 } 00355 00356 HTMLModElement &HTMLModElement::operator = (const HTMLModElement &other) 00357 { 00358 HTMLElement::operator = (other); 00359 return *this; 00360 } 00361 00362 HTMLModElement::~HTMLModElement() 00363 { 00364 } 00365 00366 DOMString HTMLModElement::cite() const 00367 { 00368 if(!impl) return DOMString(); 00369 return ((ElementImpl *)impl)->getAttribute(ATTR_CITE); 00370 } 00371 00372 void HTMLModElement::setCite( const DOMString &value ) 00373 { 00374 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_CITE, value); 00375 } 00376 00377 DOMString HTMLModElement::dateTime() const 00378 { 00379 if(!impl) return DOMString(); 00380 return ((ElementImpl *)impl)->getAttribute(ATTR_DATETIME); 00381 } 00382 00383 void HTMLModElement::setDateTime( const DOMString &value ) 00384 { 00385 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_DATETIME, value); 00386 } 00387 00388 // -------------------------------------------------------------------------- 00389 00390 HTMLQuoteElement::HTMLQuoteElement() : HTMLElement() 00391 { 00392 } 00393 00394 HTMLQuoteElement::HTMLQuoteElement(const HTMLQuoteElement &other) : HTMLElement(other) 00395 { 00396 } 00397 00398 HTMLQuoteElement::HTMLQuoteElement(HTMLGenericElementImpl *_impl) 00399 : HTMLElement() 00400 { 00401 if (_impl && _impl->id() == ID_Q) 00402 impl = _impl; 00403 else 00404 impl = 0; 00405 if ( impl ) impl->ref(); 00406 } 00407 00408 HTMLQuoteElement &HTMLQuoteElement::operator = (const Node &other) 00409 { 00410 assignOther( other, ID_Q ); 00411 return *this; 00412 } 00413 00414 HTMLQuoteElement &HTMLQuoteElement::operator = (const HTMLQuoteElement &other) 00415 { 00416 HTMLElement::operator = (other); 00417 return *this; 00418 } 00419 00420 HTMLQuoteElement::~HTMLQuoteElement() 00421 { 00422 } 00423 00424 DOMString HTMLQuoteElement::cite() const 00425 { 00426 if(!impl) return DOMString(); 00427 return ((ElementImpl *)impl)->getAttribute(ATTR_CITE); 00428 } 00429 00430 void HTMLQuoteElement::setCite( const DOMString &value ) 00431 { 00432 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_CITE, value); 00433 } 00434