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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 ScriptWrappable::init(this); | 55 ScriptWrappable::init(this); |
56 RefPtr<MutableStylePropertySet> styleDeclaration = MutableStylePropertySet::
create(HTMLStandardMode); | 56 RefPtr<MutableStylePropertySet> styleDeclaration = MutableStylePropertySet::
create(HTMLStandardMode); |
57 m_fontFaceRule->setProperties(styleDeclaration.release()); | 57 m_fontFaceRule->setProperties(styleDeclaration.release()); |
58 } | 58 } |
59 | 59 |
60 PassRefPtr<SVGFontFaceElement> SVGFontFaceElement::create(const QualifiedName& t
agName, Document& document) | 60 PassRefPtr<SVGFontFaceElement> SVGFontFaceElement::create(const QualifiedName& t
agName, Document& document) |
61 { | 61 { |
62 return adoptRef(new SVGFontFaceElement(tagName, document)); | 62 return adoptRef(new SVGFontFaceElement(tagName, document)); |
63 } | 63 } |
64 | 64 |
65 static CSSPropertyID cssPropertyIdForSVGAttributeName(const QualifiedName& attrN
ame) | |
66 { | |
67 if (!attrName.namespaceURI().isNull()) | |
68 return CSSPropertyInvalid; | |
69 | |
70 static HashMap<StringImpl*, CSSPropertyID>* propertyNameToIdMap = 0; | |
71 if (!propertyNameToIdMap) { | |
72 propertyNameToIdMap = new HashMap<StringImpl*, CSSPropertyID>; | |
73 // This is a list of all @font-face CSS properties which are exposed as
SVG XML attributes | |
74 // Those commented out are not yet supported by WebCore's style system | |
75 // mapAttributeToCSSProperty(propertyNameToIdMap, accent_heightAttr); | |
76 // mapAttributeToCSSProperty(propertyNameToIdMap, alphabeticAttr); | |
77 // mapAttributeToCSSProperty(propertyNameToIdMap, ascentAttr); | |
78 // mapAttributeToCSSProperty(propertyNameToIdMap, bboxAttr); | |
79 // mapAttributeToCSSProperty(propertyNameToIdMap, cap_heightAttr); | |
80 // mapAttributeToCSSProperty(propertyNameToIdMap, descentAttr); | |
81 mapAttributeToCSSProperty(propertyNameToIdMap, font_familyAttr); | |
82 mapAttributeToCSSProperty(propertyNameToIdMap, font_sizeAttr); | |
83 mapAttributeToCSSProperty(propertyNameToIdMap, font_stretchAttr); | |
84 mapAttributeToCSSProperty(propertyNameToIdMap, font_styleAttr); | |
85 mapAttributeToCSSProperty(propertyNameToIdMap, font_variantAttr); | |
86 mapAttributeToCSSProperty(propertyNameToIdMap, font_weightAttr); | |
87 // mapAttributeToCSSProperty(propertyNameToIdMap, hangingAttr); | |
88 // mapAttributeToCSSProperty(propertyNameToIdMap, ideographicAttr); | |
89 // mapAttributeToCSSProperty(propertyNameToIdMap, mathematicalAttr); | |
90 // mapAttributeToCSSProperty(propertyNameToIdMap, overline_positionAttr)
; | |
91 // mapAttributeToCSSProperty(propertyNameToIdMap, overline_thicknessAttr
); | |
92 // mapAttributeToCSSProperty(propertyNameToIdMap, panose_1Attr); | |
93 // mapAttributeToCSSProperty(propertyNameToIdMap, slopeAttr); | |
94 // mapAttributeToCSSProperty(propertyNameToIdMap, stemhAttr); | |
95 // mapAttributeToCSSProperty(propertyNameToIdMap, stemvAttr); | |
96 // mapAttributeToCSSProperty(propertyNameToIdMap, strikethrough_position
Attr); | |
97 // mapAttributeToCSSProperty(propertyNameToIdMap, strikethrough_thicknes
sAttr); | |
98 // mapAttributeToCSSProperty(propertyNameToIdMap, underline_positionAttr
); | |
99 // mapAttributeToCSSProperty(propertyNameToIdMap, underline_thicknessAtt
r); | |
100 // mapAttributeToCSSProperty(propertyNameToIdMap, unicode_rangeAttr); | |
101 // mapAttributeToCSSProperty(propertyNameToIdMap, units_per_emAttr); | |
102 // mapAttributeToCSSProperty(propertyNameToIdMap, v_alphabeticAttr); | |
103 // mapAttributeToCSSProperty(propertyNameToIdMap, v_hangingAttr); | |
104 // mapAttributeToCSSProperty(propertyNameToIdMap, v_ideographicAttr); | |
105 // mapAttributeToCSSProperty(propertyNameToIdMap, v_mathematicalAttr); | |
106 // mapAttributeToCSSProperty(propertyNameToIdMap, widthsAttr); | |
107 // mapAttributeToCSSProperty(propertyNameToIdMap, x_heightAttr); | |
108 } | |
109 | |
110 return propertyNameToIdMap->get(attrName.localName().impl()); | |
111 } | |
112 | |
113 void SVGFontFaceElement::parseAttribute(const QualifiedName& name, const AtomicS
tring& value) | 65 void SVGFontFaceElement::parseAttribute(const QualifiedName& name, const AtomicS
tring& value) |
114 { | 66 { |
115 CSSPropertyID propId = cssPropertyIdForSVGAttributeName(name); | 67 CSSPropertyID propId = cssPropertyIdForSVGAttributeName(name); |
116 if (propId > 0) { | 68 if (propId > 0) { |
117 m_fontFaceRule->mutableProperties()->setProperty(propId, value, false); | 69 m_fontFaceRule->mutableProperties()->setProperty(propId, value, false); |
118 rebuildFontFace(); | 70 rebuildFontFace(); |
119 return; | 71 return; |
120 } | 72 } |
121 | 73 |
122 SVGElement::parseAttribute(name, value); | 74 SVGElement::parseAttribute(name, value); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 | 300 |
349 void SVGFontFaceElement::childrenChanged(bool changedByParser, Node* beforeChang
e, Node* afterChange, int childCountDelta) | 301 void SVGFontFaceElement::childrenChanged(bool changedByParser, Node* beforeChang
e, Node* afterChange, int childCountDelta) |
350 { | 302 { |
351 SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, chil
dCountDelta); | 303 SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, chil
dCountDelta); |
352 rebuildFontFace(); | 304 rebuildFontFace(); |
353 } | 305 } |
354 | 306 |
355 } // namespace WebCore | 307 } // namespace WebCore |
356 | 308 |
357 #endif // ENABLE(SVG_FONTS) | 309 #endif // ENABLE(SVG_FONTS) |
OLD | NEW |