2 Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
3 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
4 Copyright (C) 2006 Apple Computer, Inc.
6 This file is part of the KDE project
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either
11 version 2 of the License, or (at your option) any later version.
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Library General Public License for more details.
18 You should have received a copy of the GNU Library General Public License
19 along with this library; see the file COPYING.LIB. If not, write to
20 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA.
25 #include "wtf/Platform.h"
27 #include "SVGStyleElement.h"
29 //#include "CSSStyleSheet.h"
31 #include "ExceptionCode.h"
32 //#include "HTMLNames.h"
33 //#include "XMLNames.h"
37 //using namespace HTMLNames;
39 SVGStyleElement::SVGStyleElement(const QualifiedName
& tagName
, Document
* doc
)
40 : SVGElement(tagName
, doc
)
41 , m_createdByParser(false)
45 const AtomicString
& SVGStyleElement::xmlspace() const
47 return "";//return getAttribute(XMLNames::spaceAttr);
50 void SVGStyleElement::setXmlspace(const AtomicString
&, ExceptionCode
& ec
)
52 ec
= DOMException::NO_MODIFICATION_ALLOWED_ERR
;
55 const AtomicString
& SVGStyleElement::type() const
57 static const AtomicString
defaultValue("text/css");
58 const AtomicString
& n
= getAttribute(ATTR_TYPE
/*typeAttr*/);
59 return n
.isNull() ? defaultValue
: n
;
62 void SVGStyleElement::setType(const AtomicString
&, ExceptionCode
& ec
)
64 ec
= DOMException::NO_MODIFICATION_ALLOWED_ERR
;
67 const AtomicString
& SVGStyleElement::media() const
69 static const AtomicString
defaultValue("all");
70 const AtomicString
& n
= getAttribute(ATTR_MEDIA
/*mediaAttr*/);
71 return n
.isNull() ? defaultValue
: n
;
74 void SVGStyleElement::setMedia(const AtomicString
&, ExceptionCode
& ec
)
76 ec
= DOMException::NO_MODIFICATION_ALLOWED_ERR
;
79 String
SVGStyleElement::title() const
81 return getAttribute(ATTR_TITLE
/*titleAttr*/);
84 void SVGStyleElement::setTitle(const AtomicString
&, ExceptionCode
& ec
)
86 ec
= DOMException::NO_MODIFICATION_ALLOWED_ERR
;
89 void SVGStyleElement::parseMappedAttribute(MappedAttribute
* attr
)
91 kDebug() << "parse: " << attr
->id() << attr
->localName() << attr
->value() << endl
;
92 if (/*attr->name() == titleAttr*/attr
->id() == ATTR_TITLE
&& m_sheet
)
93 ;//FIXME m_sheet->setTitle(attr->value());
95 SVGElement::parseMappedAttribute(attr
);
98 void SVGStyleElement::finishParsingChildren()
100 //StyleElement::sheet(this);
101 m_createdByParser
= false;
102 SVGElement::finishParsingChildren();
105 void SVGStyleElement::insertedIntoDocument()
107 SVGElement::insertedIntoDocument();
109 /*if (!m_createdByParser)
110 StyleElement::insertedIntoDocument(document(), this);*/
111 // Copy implementation from HTMLStyleElementImpl for KHTML
112 kDebug() << "not implemented" << endl
;
115 void SVGStyleElement::removedFromDocument()
117 SVGElement::removedFromDocument();
118 /*StyleElement::removedFromDocument(document());*/
119 // Copy implementation from HTMLStyleElementImpl for KHTML
120 kDebug() << "not implemented" << endl
;
123 void SVGStyleElement::childrenChanged(bool changedByParser
, Node
* beforeChange
, Node
* afterChange
, int childCountDelta
)
125 //SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
126 SVGElement::childrenChanged();
127 /*StyleElement::process(this);*/
128 // Copy implementation from HTMLStyleElementImpl for KHTML
129 kDebug() << "not implemented" << endl
;
132 StyleSheet
* SVGStyleElement::sheet()
134 //return StyleElement::sheet(this);
138 bool SVGStyleElement::sheetLoaded()
140 //document()->removePendingSheet();
141 document()->styleSheetLoaded();
145 // khtml compatibility methods:
146 quint32
SVGStyleElement::id() const
148 return SVGNames::styleTag
.id();
151 String
SVGStyleElement::tagName() const
153 return SVGNames::styleTag
.tagName();
159 #endif // ENABLE(SVG)