Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(367)

Side by Side Diff: Source/core/svg/SVGFontFaceElement.cpp

Issue 53143002: Avoid calling SVGFontFaceElement::rebuildFontFace() for non font-face specific attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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) 65 static CSSPropertyID cssPropertyIdForFontFaceAttributeName(const QualifiedName& attrName)
66 { 66 {
67 if (!attrName.namespaceURI().isNull()) 67 if (!attrName.namespaceURI().isNull())
68 return CSSPropertyInvalid; 68 return CSSPropertyInvalid;
69 69
70 static HashMap<StringImpl*, CSSPropertyID>* propertyNameToIdMap = 0; 70 static HashMap<StringImpl*, CSSPropertyID>* propertyNameToIdMap = 0;
71 if (!propertyNameToIdMap) { 71 if (!propertyNameToIdMap) {
72 propertyNameToIdMap = new HashMap<StringImpl*, CSSPropertyID>; 72 propertyNameToIdMap = new HashMap<StringImpl*, CSSPropertyID>;
73 // This is a list of all @font-face CSS properties which are exposed as SVG XML attributes 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 74 // Those commented out are not yet supported by WebCore's style system
75 // mapAttributeToCSSProperty(propertyNameToIdMap, accent_heightAttr); 75 // mapAttributeToCSSProperty(propertyNameToIdMap, accent_heightAttr);
(...skipping 29 matching lines...) Expand all
105 // mapAttributeToCSSProperty(propertyNameToIdMap, v_mathematicalAttr); 105 // mapAttributeToCSSProperty(propertyNameToIdMap, v_mathematicalAttr);
106 // mapAttributeToCSSProperty(propertyNameToIdMap, widthsAttr); 106 // mapAttributeToCSSProperty(propertyNameToIdMap, widthsAttr);
107 // mapAttributeToCSSProperty(propertyNameToIdMap, x_heightAttr); 107 // mapAttributeToCSSProperty(propertyNameToIdMap, x_heightAttr);
108 } 108 }
109 109
110 return propertyNameToIdMap->get(attrName.localName().impl()); 110 return propertyNameToIdMap->get(attrName.localName().impl());
111 } 111 }
112 112
113 void SVGFontFaceElement::parseAttribute(const QualifiedName& name, const AtomicS tring& value) 113 void SVGFontFaceElement::parseAttribute(const QualifiedName& name, const AtomicS tring& value)
114 { 114 {
115 CSSPropertyID propId = cssPropertyIdForSVGAttributeName(name); 115 CSSPropertyID propId = cssPropertyIdForFontFaceAttributeName(name);
116 if (propId > 0) { 116 if (propId > 0) {
117 m_fontFaceRule->mutableProperties()->setProperty(propId, value, false); 117 m_fontFaceRule->mutableProperties()->setProperty(propId, value, false);
118 rebuildFontFace(); 118 rebuildFontFace();
119 return; 119 return;
120 } 120 }
121 121
122 SVGElement::parseAttribute(name, value); 122 SVGElement::parseAttribute(name, value);
123 } 123 }
124 124
125 unsigned SVGFontFaceElement::unitsPerEm() const 125 unsigned SVGFontFaceElement::unitsPerEm() const
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
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)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698