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"
39StyleSheet::StyleSheet()
50StyleSheet::StyleSheet(StyleSheetImpl *i)
58 if ( impl != other.impl ) {
59 if(impl) impl->deref();
66StyleSheet::~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();
119bool StyleSheet::isCSSStyleSheet()
const
121 if(!impl)
return false;
122 return ((StyleSheetImpl *)impl)->isCSSStyleSheet();
133CSSStyleSheet::CSSStyleSheet(
const StyleSheet &other)
135 if (!other.isCSSStyleSheet())
141CSSStyleSheet::CSSStyleSheet(CSSStyleSheetImpl *impl) :
StyleSheet(impl)
147 StyleSheet::operator = (other);
153 if(!other.handle()->isCSSStyleSheet())
155 if(impl) impl->deref();
158 StyleSheet::operator = (other);
163CSSStyleSheet::~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 );
204StyleSheetList::StyleSheetList()
212 if(impl) impl->ref();
215StyleSheetList::StyleSheetList(StyleSheetListImpl *i)
218 if(impl) impl->ref();
223 if ( impl != other.impl ) {
224 if(impl) impl->deref();
226 if(impl) impl->ref();
231StyleSheetList::~StyleSheetList()
233 if(impl) impl->deref();
239 return ((StyleSheetListImpl *)impl)->length();
245 return ((StyleSheetListImpl *)impl)->item( index );
248StyleSheetListImpl *StyleSheetList::handle()
const
253bool StyleSheetList::isNull()
const
260MediaList::MediaList()
265MediaList::MediaList(
const MediaList &other)
268 if(impl) impl->ref();
271MediaList::MediaList(MediaListImpl *i)
274 if(impl) impl->ref();
279 if ( impl != other.impl ) {
280 if(impl) impl->deref();
282 if(impl) impl->ref();
287MediaList::~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 );
328MediaListImpl *MediaList::handle()
const
333bool MediaList::isNull()
const
340LinkStyle::LinkStyle()
345LinkStyle::LinkStyle(
const LinkStyle &other)
348 if(node) node->ref();
351LinkStyle & LinkStyle::operator = (
const LinkStyle &other)
353 if ( node != other.node ) {
354 if(node) node->deref();
356 if(node) node->ref();
361LinkStyle & 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();
377LinkStyle::~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()
394bool LinkStyle::isNull()
const
402DocumentStyle::DocumentStyle()
407DocumentStyle::DocumentStyle(
const DocumentStyle &other)
413DocumentStyle & DocumentStyle::operator = (
const DocumentStyle &other)
415 if ( doc != other.doc ) {
416 if(doc) doc->deref();
423DocumentStyle & DocumentStyle::operator = (
const Document &other)
425 DocumentImpl *odoc =
static_cast<DocumentImpl *
>(other.handle());
427 if(doc) doc->deref();
434DocumentStyle::~DocumentStyle()
436 if(doc) doc->deref();
441 return doc->styleSheets();
444DOMString DocumentStyle::preferredStylesheetSet()
const
446 return doc->preferredStylesheetSet();
449void DocumentStyle::setSelectedStylesheetSet(
const DOMString& aStr)
451 return doc->setSelectedStylesheetSet(aStr);
454DOMString DocumentStyle::selectedStylesheetSet()
const
456 return doc->selectedStylesheetSet();
This exception is raised when a specific CSS operation is impossible to perform.
The CSSRuleList interface provides the abstraction of an ordered collection of CSS rules.
The CSSRule interface is the abstract base interface for any type of CSS statement .
The CSSStyleSheet interface is a concrete interface used to represent a CSS style sheet i....
CSSRule ownerRule() const
If this style sheet comes from an @import rule, the ownerRule attribute will contain the CSSImportRul...
void deleteRule(unsigned long index)
Used to delete a rule from the style sheet.
CSSRuleList cssRules() const
The list of all CSS rules contained within the style sheet.
unsigned long insertRule(const DOM::DOMString &rule, unsigned long index)
Used to insert a new rule into the style sheet.
DOM operations only raise exceptions in "exceptional" circumstances, i.e., when an operation is impos...
This class implements the basic string we use in the DOM.
The Document interface represents the entire HTML or XML document.
The Node interface is the primary datatype for the entire Document Object Model.
The StyleSheetList interface provides the abstraction of an ordered collection of style sheets.
unsigned long length() const
The number of StyleSheet in the list.
StyleSheet item(unsigned long index)
Used to retrieve a style sheet by ordinal index.
The StyleSheet interface is the abstract base interface for any type of style sheet.
DOM::DOMString href() const
If the style sheet is a linked style sheet, the value of its attribute is its location.
MediaList media() const
The intended destination media for style information.
StyleSheet parentStyleSheet() const
For style sheet languages that support the concept of style sheet inclusion, this attribute represent...
bool disabled() const
false if the style sheet is applied to the document.
void setDisabled(bool)
see disabled
DOM::DOMString title() const
The advisory title.
DOM::DOMString type() const
This specifies the style sheet language for this style sheet.
DOM::Node ownerNode() const
The node that associates this style sheet with the document.
The Document Object Model (DOM) is divided into two parts, the COREDOM core DOM, specifying some core...