24 #include "dom/dom_exception.h"
25 #include "dom/css_rule.h"
26 #include "dom/dom_doc.h"
28 #include "xml/dom_docimpl.h"
30 #include "html/html_headimpl.h"
32 #include "css/css_stylesheetimpl.h"
33 #include "misc/htmlhashes.h"
39 StyleSheet::StyleSheet()
44 StyleSheet::StyleSheet(
const StyleSheet &other)
50 StyleSheet::StyleSheet(StyleSheetImpl *i)
58 if ( impl != other.impl ) {
59 if(impl) impl->deref();
66 StyleSheet::~StyleSheet()
68 if(impl) impl->deref();
74 return ((StyleSheetImpl *)impl)->type();
80 return ((StyleSheetImpl *)impl)->disabled();
86 ((StyleSheetImpl *)impl)->setDisabled( _disabled );
91 if(!impl)
return Node();
92 return ((StyleSheetImpl *)impl)->ownerNode();
104 return ((StyleSheetImpl *)impl)->href();
110 return ((StyleSheetImpl *)impl)->title();
116 return ((StyleSheetImpl *)impl)->media();
119 bool StyleSheet::isCSSStyleSheet()
const
121 if(!impl)
return false;
122 return ((StyleSheetImpl *)impl)->isCSSStyleSheet();
133 CSSStyleSheet::CSSStyleSheet(
const StyleSheet &other)
135 if (!other.isCSSStyleSheet())
141 CSSStyleSheet::CSSStyleSheet(CSSStyleSheetImpl *impl) :
StyleSheet(impl)
147 StyleSheet::operator = (other);
153 if(!other.handle()->isCSSStyleSheet())
155 if(impl) impl->deref();
158 StyleSheet::operator = (other);
163 CSSStyleSheet::~CSSStyleSheet()
170 return ((CSSStyleSheetImpl *)impl)->ownerRule();
175 if(!impl)
return (CSSRuleListImpl*)0;
176 return ((CSSStyleSheetImpl *)impl)->cssRules();
181 int exceptioncode = 0;
183 unsigned long retval = ((CSSStyleSheetImpl *)impl)->insertRule( rule, index, exceptioncode );
184 if ( exceptioncode >= CSSException::_EXCEPTION_OFFSET )
185 throw CSSException( exceptioncode - CSSException::_EXCEPTION_OFFSET );
193 int exceptioncode = 0;
195 ((CSSStyleSheetImpl *)impl)->deleteRule( index, exceptioncode );
196 if ( exceptioncode >= CSSException::_EXCEPTION_OFFSET )
197 throw CSSException( exceptioncode - CSSException::_EXCEPTION_OFFSET );
204 StyleSheetList::StyleSheetList()
212 if(impl) impl->ref();
215 StyleSheetList::StyleSheetList(StyleSheetListImpl *i)
218 if(impl) impl->ref();
223 if ( impl != other.impl ) {
224 if(impl) impl->deref();
226 if(impl) impl->ref();
231 StyleSheetList::~StyleSheetList()
233 if(impl) impl->deref();
239 return ((StyleSheetListImpl *)impl)->length();
245 return ((StyleSheetListImpl *)impl)->item( index );
248 StyleSheetListImpl *StyleSheetList::handle()
const
253 bool StyleSheetList::isNull()
const
260 MediaList::MediaList()
265 MediaList::MediaList(
const MediaList &other)
268 if(impl) impl->ref();
271 MediaList::MediaList(MediaListImpl *i)
274 if(impl) impl->ref();
279 if ( impl != other.impl ) {
280 if(impl) impl->deref();
282 if(impl) impl->ref();
287 MediaList::~MediaList()
289 if(impl) impl->deref();
295 return static_cast<MediaListImpl *
>(impl)->
mediaText();
301 static_cast<MediaListImpl *
>(impl)->
setMediaText( value );
307 return ((MediaListImpl *)impl)->length();
313 return ((MediaListImpl *)impl)->item( index );
319 ((MediaListImpl *)impl)->deleteMedium( oldMedium );
325 ((MediaListImpl *)impl)->appendMedium( newMedium );
328 MediaListImpl *MediaList::handle()
const
333 bool MediaList::isNull()
const
340 LinkStyle::LinkStyle()
345 LinkStyle::LinkStyle(
const LinkStyle &other)
348 if(node) node->ref();
351 LinkStyle & LinkStyle::operator = (
const LinkStyle &other)
353 if ( node != other.node ) {
354 if(node) node->deref();
356 if(node) node->ref();
361 LinkStyle & LinkStyle::operator = (
const Node &other)
363 if(node) node->deref();
366 NodeImpl *n = other.handle();
369 if( n && n->isElementNode() &&
370 (n->id() == ID_STYLE || n->id() == ID_LINK) ) {
372 if(node) node->ref();
377 LinkStyle::~LinkStyle()
379 if(node) node->deref();
384 int id = node ? node->id() : 0;
388 static_cast<HTMLStyleElementImpl *
>(node)->sheet()
389 : ( (
id == ID_LINK) ?
390 static_cast<HTMLLinkElementImpl *>(node)->sheet()
394 bool LinkStyle::isNull()
const
402 DocumentStyle::DocumentStyle()
407 DocumentStyle::DocumentStyle(
const DocumentStyle &other)
413 DocumentStyle & DocumentStyle::operator = (
const DocumentStyle &other)
415 if ( doc != other.doc ) {
416 if(doc) doc->deref();
423 DocumentStyle & DocumentStyle::operator = (
const Document &other)
425 DocumentImpl *odoc =
static_cast<DocumentImpl *
>(other.handle());
427 if(doc) doc->deref();
434 DocumentStyle::~DocumentStyle()
436 if(doc) doc->deref();
441 return doc->styleSheets();
444 DOMString DocumentStyle::preferredStylesheetSet()
const
446 return doc->preferredStylesheetSet();
449 void DocumentStyle::setSelectedStylesheetSet(
const DOMString& aStr)
451 return doc->setSelectedStylesheetSet(aStr);
454 DOMString DocumentStyle::selectedStylesheetSet()
const
456 return doc->selectedStylesheetSet();