File indexing completed on 2024-04-28 11:39:14
0001 /* 0002 Copyright (C) 2007 Eric Seidel <eric@webkit.org> 0003 0004 This library is free software; you can redistribute it and/or 0005 modify it under the terms of the GNU Library General Public 0006 License as published by the Free Software Foundation; either 0007 version 2 of the License, or (at your option) any later version. 0008 0009 This library is distributed in the hope that it will be useful, 0010 but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 Library General Public License for more details. 0013 0014 You should have received a copy of the GNU Library General Public License 0015 along with this library; see the file COPYING.LIB. If not, write to 0016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0017 Boston, MA 02110-1301, USA. 0018 */ 0019 0020 #if ENABLE(SVG_FONTS) 0021 #include "SVGFontFaceSrcElement.h" 0022 0023 #include "CSSValueList.h" 0024 #include "CSSFontFaceSrcValue.h" 0025 #include "SVGFontFaceElement.h" 0026 #include "SVGFontFaceNameElement.h" 0027 #include "SVGFontFaceUriElement.h" 0028 #include "SVGNames.h" 0029 0030 namespace WebCore 0031 { 0032 0033 using namespace SVGNames; 0034 0035 SVGFontFaceSrcElement::SVGFontFaceSrcElement(const QualifiedName &tagName, Document *doc) 0036 : SVGElement(tagName, doc) 0037 { 0038 } 0039 0040 PassRefPtr<CSSValueList> SVGFontFaceSrcElement::srcValue() const 0041 { 0042 RefPtr<CSSValueList> list = new CSSValueList; // ### CSSValueListImpl(CSSValueListImpl::Comma) 0043 for (Node *child = firstChild(); child; child = child->nextSibling()) { 0044 if (child->hasTagName(font_face_uriTag)) { 0045 list->append(static_cast<SVGFontFaceUriElement *>(child)->srcValue()); 0046 } else if (child->hasTagName(font_face_nameTag)) { 0047 list->append(static_cast<SVGFontFaceNameElement *>(child)->srcValue()); 0048 } 0049 } 0050 return list; 0051 } 0052 0053 void SVGFontFaceSrcElement::childrenChanged(bool changedByParser, Node *beforeChange, Node *afterChange, int childCountDelta) 0054 { 0055 SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); 0056 if (parentNode() && parentNode()->hasTagName(font_faceTag)) { 0057 static_cast<SVGFontFaceElement *>(parentNode())->rebuildFontFace(); 0058 } 0059 } 0060 0061 } 0062 0063 #endif // ENABLE(SVG_FONTS)