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 14 matching lines...) Expand all Loading... |
25 #include "core/svg/SVGFontFaceElement.h" | 25 #include "core/svg/SVGFontFaceElement.h" |
26 | 26 |
27 #include "core/CSSPropertyNames.h" | 27 #include "core/CSSPropertyNames.h" |
28 #include "core/CSSValueKeywords.h" | 28 #include "core/CSSValueKeywords.h" |
29 #include "core/css/CSSFontFaceSrcValue.h" | 29 #include "core/css/CSSFontFaceSrcValue.h" |
30 #include "core/css/CSSFontSelector.h" | 30 #include "core/css/CSSFontSelector.h" |
31 #include "core/css/CSSStyleSheet.h" | 31 #include "core/css/CSSStyleSheet.h" |
32 #include "core/css/CSSValueList.h" | 32 #include "core/css/CSSValueList.h" |
33 #include "core/css/StylePropertySet.h" | 33 #include "core/css/StylePropertySet.h" |
34 #include "core/css/StyleRule.h" | 34 #include "core/css/StyleRule.h" |
| 35 #include "core/css/parser/CSSParser.h" |
35 #include "core/dom/Attribute.h" | 36 #include "core/dom/Attribute.h" |
36 #include "core/dom/Document.h" | 37 #include "core/dom/Document.h" |
37 #include "core/dom/StyleEngine.h" | 38 #include "core/dom/StyleEngine.h" |
38 #include "core/svg/SVGDocumentExtensions.h" | 39 #include "core/svg/SVGDocumentExtensions.h" |
39 #include "core/svg/SVGFontElement.h" | 40 #include "core/svg/SVGFontElement.h" |
40 #include "core/svg/SVGFontFaceSrcElement.h" | 41 #include "core/svg/SVGFontFaceSrcElement.h" |
41 #include "core/svg/SVGGlyphElement.h" | 42 #include "core/svg/SVGGlyphElement.h" |
42 #include "platform/fonts/Font.h" | 43 #include "platform/fonts/Font.h" |
43 #include <math.h> | 44 #include <math.h> |
44 | 45 |
(...skipping 16 matching lines...) Expand all Loading... |
61 static CSSPropertyID cssPropertyIdForFontFaceAttributeName(const QualifiedName&
attrName) | 62 static CSSPropertyID cssPropertyIdForFontFaceAttributeName(const QualifiedName&
attrName) |
62 { | 63 { |
63 if (!attrName.namespaceURI().isNull()) | 64 if (!attrName.namespaceURI().isNull()) |
64 return CSSPropertyInvalid; | 65 return CSSPropertyInvalid; |
65 | 66 |
66 static HashMap<StringImpl*, CSSPropertyID>* propertyNameToIdMap = 0; | 67 static HashMap<StringImpl*, CSSPropertyID>* propertyNameToIdMap = 0; |
67 if (!propertyNameToIdMap) { | 68 if (!propertyNameToIdMap) { |
68 propertyNameToIdMap = new HashMap<StringImpl*, CSSPropertyID>; | 69 propertyNameToIdMap = new HashMap<StringImpl*, CSSPropertyID>; |
69 // This is a list of all @font-face CSS properties which are exposed as
SVG XML attributes | 70 // This is a list of all @font-face CSS properties which are exposed as
SVG XML attributes |
70 // Those commented out are not yet supported by WebCore's style system | 71 // Those commented out are not yet supported by WebCore's style system |
71 // mapAttributeToCSSProperty(propertyNameToIdMap, accent_heightAttr); | 72 const QualifiedName* const attrNames[] = { |
72 // mapAttributeToCSSProperty(propertyNameToIdMap, alphabeticAttr); | 73 // &accent_heightAttr, |
73 // mapAttributeToCSSProperty(propertyNameToIdMap, ascentAttr); | 74 // &alphabeticAttr, |
74 // mapAttributeToCSSProperty(propertyNameToIdMap, bboxAttr); | 75 // &ascentAttr, |
75 // mapAttributeToCSSProperty(propertyNameToIdMap, cap_heightAttr); | 76 // &bboxAttr, |
76 // mapAttributeToCSSProperty(propertyNameToIdMap, descentAttr); | 77 // &cap_heightAttr, |
77 mapAttributeToCSSProperty(propertyNameToIdMap, font_familyAttr); | 78 // &descentAttr, |
78 mapAttributeToCSSProperty(propertyNameToIdMap, font_sizeAttr); | 79 &font_familyAttr, |
79 mapAttributeToCSSProperty(propertyNameToIdMap, font_stretchAttr); | 80 &font_sizeAttr, |
80 mapAttributeToCSSProperty(propertyNameToIdMap, font_styleAttr); | 81 &font_stretchAttr, |
81 mapAttributeToCSSProperty(propertyNameToIdMap, font_variantAttr); | 82 &font_styleAttr, |
82 mapAttributeToCSSProperty(propertyNameToIdMap, font_weightAttr); | 83 &font_variantAttr, |
83 // mapAttributeToCSSProperty(propertyNameToIdMap, hangingAttr); | 84 &font_weightAttr, |
84 // mapAttributeToCSSProperty(propertyNameToIdMap, ideographicAttr); | 85 // &hangingAttr, |
85 // mapAttributeToCSSProperty(propertyNameToIdMap, mathematicalAttr); | 86 // &ideographicAttr, |
86 // mapAttributeToCSSProperty(propertyNameToIdMap, overline_positionAttr)
; | 87 // &mathematicalAttr, |
87 // mapAttributeToCSSProperty(propertyNameToIdMap, overline_thicknessAttr
); | 88 // &overline_positionAttr, |
88 // mapAttributeToCSSProperty(propertyNameToIdMap, panose_1Attr); | 89 // &overline_thicknessAttr, |
89 // mapAttributeToCSSProperty(propertyNameToIdMap, slopeAttr); | 90 // &panose_1Attr, |
90 // mapAttributeToCSSProperty(propertyNameToIdMap, stemhAttr); | 91 // &slopeAttr, |
91 // mapAttributeToCSSProperty(propertyNameToIdMap, stemvAttr); | 92 // &stemhAttr, |
92 // mapAttributeToCSSProperty(propertyNameToIdMap, strikethrough_position
Attr); | 93 // &stemvAttr, |
93 // mapAttributeToCSSProperty(propertyNameToIdMap, strikethrough_thicknes
sAttr); | 94 // &strikethrough_positionAttr, |
94 // mapAttributeToCSSProperty(propertyNameToIdMap, underline_positionAttr
); | 95 // &strikethrough_thicknessAttr, |
95 // mapAttributeToCSSProperty(propertyNameToIdMap, underline_thicknessAtt
r); | 96 // &underline_positionAttr, |
96 // mapAttributeToCSSProperty(propertyNameToIdMap, unicode_rangeAttr); | 97 // &underline_thicknessAttr, |
97 // mapAttributeToCSSProperty(propertyNameToIdMap, units_per_emAttr); | 98 // &unicode_rangeAttr, |
98 // mapAttributeToCSSProperty(propertyNameToIdMap, v_alphabeticAttr); | 99 // &units_per_emAttr, |
99 // mapAttributeToCSSProperty(propertyNameToIdMap, v_hangingAttr); | 100 // &v_alphabeticAttr, |
100 // mapAttributeToCSSProperty(propertyNameToIdMap, v_ideographicAttr); | 101 // &v_hangingAttr, |
101 // mapAttributeToCSSProperty(propertyNameToIdMap, v_mathematicalAttr); | 102 // &v_ideographicAttr, |
102 // mapAttributeToCSSProperty(propertyNameToIdMap, widthsAttr); | 103 // &v_mathematicalAttr, |
103 // mapAttributeToCSSProperty(propertyNameToIdMap, x_heightAttr); | 104 // &widthsAttr, |
| 105 // &x_heightAttr, |
| 106 }; |
| 107 for (size_t i = 0; i < WTF_ARRAY_LENGTH(attrNames); i++) { |
| 108 CSSPropertyID propertyId = cssPropertyID(attrNames[i]->localName()); |
| 109 ASSERT(propertyId > 0); |
| 110 propertyNameToIdMap->set(attrNames[i]->localName().impl(), propertyI
d); |
| 111 } |
104 } | 112 } |
105 | 113 |
106 return propertyNameToIdMap->get(attrName.localName().impl()); | 114 return propertyNameToIdMap->get(attrName.localName().impl()); |
107 } | 115 } |
108 | 116 |
109 void SVGFontFaceElement::parseAttribute(const QualifiedName& name, const AtomicS
tring& value) | 117 void SVGFontFaceElement::parseAttribute(const QualifiedName& name, const AtomicS
tring& value) |
110 { | 118 { |
111 CSSPropertyID propId = cssPropertyIdForFontFaceAttributeName(name); | 119 CSSPropertyID propId = cssPropertyIdForFontFaceAttributeName(name); |
112 if (propId > 0) { | 120 if (propId > 0) { |
113 m_fontFaceRule->mutableProperties().setProperty(propId, value, false); | 121 m_fontFaceRule->mutableProperties().setProperty(propId, value, false); |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 void SVGFontFaceElement::trace(Visitor* visitor) | 359 void SVGFontFaceElement::trace(Visitor* visitor) |
352 { | 360 { |
353 visitor->trace(m_fontFaceRule); | 361 visitor->trace(m_fontFaceRule); |
354 visitor->trace(m_fontElement); | 362 visitor->trace(m_fontElement); |
355 SVGElement::trace(visitor); | 363 SVGElement::trace(visitor); |
356 } | 364 } |
357 | 365 |
358 } // namespace blink | 366 } // namespace blink |
359 | 367 |
360 #endif // ENABLE(SVG_FONTS) | 368 #endif // ENABLE(SVG_FONTS) |
OLD | NEW |