| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> | 2 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> |
| 3 * Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 3 * Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
| 4 * Copyright (C) 2008 Apple Inc. All rights reserved. | 4 * Copyright (C) 2008 Apple Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 } | 258 } |
| 259 | 259 |
| 260 String SVGFontFaceElement::fontFamily() const | 260 String SVGFontFaceElement::fontFamily() const |
| 261 { | 261 { |
| 262 return m_fontFaceRule->properties()->getPropertyValue(CSSPropertyFontFamily)
; | 262 return m_fontFaceRule->properties()->getPropertyValue(CSSPropertyFontFamily)
; |
| 263 } | 263 } |
| 264 | 264 |
| 265 SVGFontElement* SVGFontFaceElement::associatedFontElement() const | 265 SVGFontElement* SVGFontFaceElement::associatedFontElement() const |
| 266 { | 266 { |
| 267 ASSERT(parentNode() == m_fontElement); | 267 ASSERT(parentNode() == m_fontElement); |
| 268 ASSERT(!parentNode() || parentNode()->hasTagName(SVGNames::fontTag)); | 268 ASSERT(!parentNode() || isSVGFontElement(parentNode())); |
| 269 return m_fontElement; | 269 return m_fontElement; |
| 270 } | 270 } |
| 271 | 271 |
| 272 void SVGFontFaceElement::rebuildFontFace() | 272 void SVGFontFaceElement::rebuildFontFace() |
| 273 { | 273 { |
| 274 if (!inDocument()) { | 274 if (!inDocument()) { |
| 275 ASSERT(!m_fontElement); | 275 ASSERT(!m_fontElement); |
| 276 return; | 276 return; |
| 277 } | 277 } |
| 278 | 278 |
| 279 // we currently ignore all but the first src element, alternatively we could
concat them | 279 // we currently ignore all but the first src element, alternatively we could
concat them |
| 280 SVGFontFaceSrcElement* srcElement = 0; | 280 SVGFontFaceSrcElement* srcElement = 0; |
| 281 | 281 |
| 282 for (Node* child = firstChild(); child && !srcElement; child = child->nextSi
bling()) { | 282 for (Node* child = firstChild(); child && !srcElement; child = child->nextSi
bling()) { |
| 283 if (child->hasTagName(font_face_srcTag)) | 283 if (child->hasTagName(font_face_srcTag)) |
| 284 srcElement = static_cast<SVGFontFaceSrcElement*>(child); | 284 srcElement = static_cast<SVGFontFaceSrcElement*>(child); |
| 285 } | 285 } |
| 286 | 286 |
| 287 bool describesParentFont = parentNode()->hasTagName(SVGNames::fontTag); | 287 bool describesParentFont = isSVGFontElement(parentNode()); |
| 288 RefPtr<CSSValueList> list; | 288 RefPtr<CSSValueList> list; |
| 289 | 289 |
| 290 if (describesParentFont) { | 290 if (describesParentFont) { |
| 291 m_fontElement = toSVGFontElement(parentNode()); | 291 m_fontElement = toSVGFontElement(parentNode()); |
| 292 | 292 |
| 293 list = CSSValueList::createCommaSeparated(); | 293 list = CSSValueList::createCommaSeparated(); |
| 294 list->append(CSSFontFaceSrcValue::createLocal(fontFamily())); | 294 list->append(CSSFontFaceSrcValue::createLocal(fontFamily())); |
| 295 } else { | 295 } else { |
| 296 m_fontElement = 0; | 296 m_fontElement = 0; |
| 297 if (srcElement) | 297 if (srcElement) |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 | 348 |
| 349 void SVGFontFaceElement::childrenChanged(bool changedByParser, Node* beforeChang
e, Node* afterChange, int childCountDelta) | 349 void SVGFontFaceElement::childrenChanged(bool changedByParser, Node* beforeChang
e, Node* afterChange, int childCountDelta) |
| 350 { | 350 { |
| 351 SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, chil
dCountDelta); | 351 SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, chil
dCountDelta); |
| 352 rebuildFontFace(); | 352 rebuildFontFace(); |
| 353 } | 353 } |
| 354 | 354 |
| 355 } // namespace WebCore | 355 } // namespace WebCore |
| 356 | 356 |
| 357 #endif // ENABLE(SVG_FONTS) | 357 #endif // ENABLE(SVG_FONTS) |
| OLD | NEW |