KHTML
SVGStyleElement.cpp
Go to the documentation of this file.
00001 /* 00002 Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org> 00003 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 00004 Copyright (C) 2006 Apple Computer, Inc. 00005 00006 This file is part of the KDE project 00007 00008 This library is free software; you can redistribute it and/or 00009 modify it under the terms of the GNU Library General Public 00010 License as published by the Free Software Foundation; either 00011 version 2 of the License, or (at your option) any later version. 00012 00013 This library is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 Library General Public License for more details. 00017 00018 You should have received a copy of the GNU Library General Public License 00019 along with this library; see the file COPYING.LIB. If not, write to 00020 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00021 Boston, MA 02110-1301, USA. 00022 */ 00023 00024 #include "config.h" 00025 #include "wtf/Platform.h" 00026 #if ENABLE(SVG) 00027 #include "SVGStyleElement.h" 00028 00029 //#include "CSSStyleSheet.h" 00030 #include "Document.h" 00031 #include "ExceptionCode.h" 00032 //#include "HTMLNames.h" 00033 //#include "XMLNames.h" 00034 00035 namespace WebCore { 00036 00037 //using namespace HTMLNames; 00038 00039 SVGStyleElement::SVGStyleElement(const QualifiedName& tagName, Document* doc) 00040 : SVGElement(tagName, doc) 00041 , m_createdByParser(false) 00042 { 00043 } 00044 00045 DOMString SVGStyleElement::xmlspace() const 00046 { 00047 // ### shouldn't this provide default? 00048 return getAttribute(ATTR_XML_SPACE); 00049 } 00050 00051 void SVGStyleElement::setXmlspace(const DOMString&, ExceptionCode& ec) 00052 { 00053 ec = DOMException::NO_MODIFICATION_ALLOWED_ERR; 00054 } 00055 00056 const DOMString SVGStyleElement::type() const 00057 { 00058 static const DOMString defaultValue("text/css"); 00059 DOMString n = getAttribute(ATTR_TYPE); 00060 return n.isNull() ? defaultValue : n; 00061 } 00062 00063 void SVGStyleElement::setType(const DOMString&, ExceptionCode& ec) 00064 { 00065 ec = DOMException::NO_MODIFICATION_ALLOWED_ERR; 00066 } 00067 00068 const DOMString SVGStyleElement::media() const 00069 { 00070 static const DOMString defaultValue("all"); 00071 DOMString n = getAttribute(ATTR_MEDIA); 00072 return n.isNull() ? defaultValue : n; 00073 } 00074 00075 void SVGStyleElement::setMedia(const DOMString&, ExceptionCode& ec) 00076 { 00077 ec = DOMException::NO_MODIFICATION_ALLOWED_ERR; 00078 } 00079 00080 String SVGStyleElement::title() const 00081 { 00082 return getAttribute(ATTR_TITLE); 00083 } 00084 00085 void SVGStyleElement::setTitle(const DOMString&, ExceptionCode& ec) 00086 { 00087 ec = DOMException::NO_MODIFICATION_ALLOWED_ERR; 00088 } 00089 00090 void SVGStyleElement::parseMappedAttribute(MappedAttribute* attr) 00091 { 00092 kDebug() << "parse: " << attr->id() << attr->localName() << attr->value() << endl; 00093 if (/*attr->name() == titleAttr*/attr->id() == ATTR_TITLE && m_sheet) 00094 ;//FIXME m_sheet->setTitle(attr->value()); 00095 else 00096 SVGElement::parseMappedAttribute(attr); 00097 } 00098 00099 void SVGStyleElement::finishParsingChildren() 00100 { 00101 //StyleElement::sheet(this); 00102 m_createdByParser = false; 00103 SVGElement::finishParsingChildren(); 00104 } 00105 00106 void SVGStyleElement::insertedIntoDocument() 00107 { 00108 SVGElement::insertedIntoDocument(); 00109 00110 /*if (!m_createdByParser) 00111 StyleElement::insertedIntoDocument(document(), this);*/ 00112 // Copy implementation from HTMLStyleElementImpl for KHTML 00113 kDebug() << "not implemented" << endl; 00114 } 00115 00116 void SVGStyleElement::removedFromDocument() 00117 { 00118 SVGElement::removedFromDocument(); 00119 /*StyleElement::removedFromDocument(document());*/ 00120 // Copy implementation from HTMLStyleElementImpl for KHTML 00121 kDebug() << "not implemented" << endl; 00122 } 00123 00124 void SVGStyleElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) 00125 { 00126 Q_UNUSED(changedByParser); 00127 Q_UNUSED(beforeChange); 00128 Q_UNUSED(afterChange); 00129 Q_UNUSED(childCountDelta); 00130 //SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); 00131 SVGElement::childrenChanged(); 00132 /*StyleElement::process(this);*/ 00133 // Copy implementation from HTMLStyleElementImpl for KHTML 00134 kDebug() << "not implemented" << endl; 00135 } 00136 00137 StyleSheet* SVGStyleElement::sheet() 00138 { 00139 //return StyleElement::sheet(this); 00140 return m_sheet; 00141 } 00142 00143 bool SVGStyleElement::sheetLoaded() 00144 { 00145 //document()->removePendingSheet(); 00146 document()->styleSheetLoaded(); 00147 return true; 00148 } 00149 00150 // khtml compatibility methods: 00151 quint32 SVGStyleElement::id() const 00152 { 00153 return SVGNames::styleTag.id(); 00154 } 00155 00156 } 00157 00158 // vim:ts=4 00159 #endif // ENABLE(SVG)
KDE 4.6 API Reference