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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 return m_fontElement; | 268 return m_fontElement; |
269 } | 269 } |
270 | 270 |
271 void SVGFontFaceElement::rebuildFontFace() | 271 void SVGFontFaceElement::rebuildFontFace() |
272 { | 272 { |
273 if (!inDocument()) { | 273 if (!inDocument()) { |
274 ASSERT(!m_fontElement); | 274 ASSERT(!m_fontElement); |
275 return; | 275 return; |
276 } | 276 } |
277 | 277 |
278 bool describesParentFont = parentNode()->hasTagName(SVGNames::fontTag); | 278 bool describesParentFont = isSVGFontElement(*parentNode()); |
279 RefPtrWillBeRawPtr<CSSValueList> list; | 279 RefPtrWillBeRawPtr<CSSValueList> list; |
280 | 280 |
281 if (describesParentFont) { | 281 if (describesParentFont) { |
282 m_fontElement = toSVGFontElement(parentNode()); | 282 m_fontElement = toSVGFontElement(parentNode()); |
283 | 283 |
284 list = CSSValueList::createCommaSeparated(); | 284 list = CSSValueList::createCommaSeparated(); |
285 list->append(CSSFontFaceSrcValue::createLocal(fontFamily())); | 285 list->append(CSSFontFaceSrcValue::createLocal(fontFamily())); |
286 } else { | 286 } else { |
287 m_fontElement = 0; | 287 m_fontElement = 0; |
288 // we currently ignore all but the last src element, alternatively we co
uld concat them | 288 // we currently ignore all but the last src element, alternatively we co
uld concat them |
289 for (Node* child = lastChild(); child && !list; child = child->previousS
ibling()) { | 289 if (SVGFontFaceSrcElement* element = Traversal<SVGFontFaceSrcElement>::l
astChild(*this)) |
290 if (child->hasTagName(font_face_srcTag)) { | 290 list = element->srcValue(); |
291 list = toSVGFontFaceSrcElement(child)->srcValue(); | |
292 break; | |
293 } | |
294 } | |
295 } | 291 } |
296 | 292 |
297 if (!list || !list->length()) | 293 if (!list || !list->length()) |
298 return; | 294 return; |
299 | 295 |
300 // Parse in-memory CSS rules | 296 // Parse in-memory CSS rules |
301 m_fontFaceRule->mutableProperties().addParsedProperty(CSSProperty(CSSPropert
ySrc, list)); | 297 m_fontFaceRule->mutableProperties().addParsedProperty(CSSProperty(CSSPropert
ySrc, list)); |
302 | 298 |
303 if (describesParentFont) { | 299 if (describesParentFont) { |
304 // Traverse parsed CSS values and associate CSSFontFaceSrcValue elements
with ourselves. | 300 // Traverse parsed CSS values and associate CSSFontFaceSrcValue elements
with ourselves. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 | 345 |
350 void SVGFontFaceElement::childrenChanged(bool changedByParser, Node* beforeChang
e, Node* afterChange, int childCountDelta) | 346 void SVGFontFaceElement::childrenChanged(bool changedByParser, Node* beforeChang
e, Node* afterChange, int childCountDelta) |
351 { | 347 { |
352 SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, chil
dCountDelta); | 348 SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, chil
dCountDelta); |
353 rebuildFontFace(); | 349 rebuildFontFace(); |
354 } | 350 } |
355 | 351 |
356 } // namespace WebCore | 352 } // namespace WebCore |
357 | 353 |
358 #endif // ENABLE(SVG_FONTS) | 354 #endif // ENABLE(SVG_FONTS) |
OLD | NEW |