KHTML
SVGFontFaceSrcElement.cpp
Go to the documentation of this file.
00001 /* 00002 Copyright (C) 2007 Eric Seidel <eric@webkit.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #include "config.h" 00021 00022 #if ENABLE(SVG_FONTS) 00023 #include "SVGFontFaceSrcElement.h" 00024 00025 #include "CSSValueList.h" 00026 #include "CSSFontFaceSrcValue.h" 00027 #include "SVGFontFaceElement.h" 00028 #include "SVGFontFaceNameElement.h" 00029 #include "SVGFontFaceUriElement.h" 00030 #include "SVGNames.h" 00031 00032 namespace WebCore { 00033 00034 using namespace SVGNames; 00035 00036 SVGFontFaceSrcElement::SVGFontFaceSrcElement(const QualifiedName& tagName, Document* doc) 00037 : SVGElement(tagName, doc) 00038 { 00039 } 00040 00041 PassRefPtr<CSSValueList> SVGFontFaceSrcElement::srcValue() const 00042 { 00043 RefPtr<CSSValueList> list = new CSSValueList; // ### CSSValueListImpl(CSSValueListImpl::Comma) 00044 for (Node* child = firstChild(); child; child = child->nextSibling()) { 00045 if (child->hasTagName(font_face_uriTag)) 00046 list->append(static_cast<SVGFontFaceUriElement*>(child)->srcValue()); 00047 else if (child->hasTagName(font_face_nameTag)) 00048 list->append(static_cast<SVGFontFaceNameElement*>(child)->srcValue()); 00049 } 00050 return list; 00051 } 00052 00053 void SVGFontFaceSrcElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) 00054 { 00055 SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); 00056 if (parentNode() && parentNode()->hasTagName(font_faceTag)) 00057 static_cast<SVGFontFaceElement*>(parentNode())->rebuildFontFace(); 00058 } 00059 00060 } 00061 00062 #endif // ENABLE(SVG_FONTS)
KDE 4.6 API Reference