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

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

Issue 963733002: [svg2] Make 'width' and 'height' presentation attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: test fixes Created 5 years, 9 months 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
4 * Copyright (C) 2005 Alexander Kellett <lypanov@kde.org> 4 * Copyright (C) 2005 Alexander Kellett <lypanov@kde.org>
5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
6 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 supportedAttributes.add(SVGNames::xAttr); 80 supportedAttributes.add(SVGNames::xAttr);
81 supportedAttributes.add(SVGNames::yAttr); 81 supportedAttributes.add(SVGNames::yAttr);
82 supportedAttributes.add(SVGNames::widthAttr); 82 supportedAttributes.add(SVGNames::widthAttr);
83 supportedAttributes.add(SVGNames::heightAttr); 83 supportedAttributes.add(SVGNames::heightAttr);
84 } 84 }
85 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); 85 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
86 } 86 }
87 87
88 bool SVGMaskElement::isPresentationAttribute(const QualifiedName& attrName) cons t 88 bool SVGMaskElement::isPresentationAttribute(const QualifiedName& attrName) cons t
89 { 89 {
90 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr) 90 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr
91 || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr)
91 return true; 92 return true;
92 return SVGElement::isPresentationAttribute(attrName); 93 return SVGElement::isPresentationAttribute(attrName);
93 } 94 }
94 95
95 bool SVGMaskElement::isPresentationAttributeWithSVGDOM(const QualifiedName& attr Name) const 96 bool SVGMaskElement::isPresentationAttributeWithSVGDOM(const QualifiedName& attr Name) const
96 { 97 {
97 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr) 98 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr
99 || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr)
98 return true; 100 return true;
99 return SVGElement::isPresentationAttributeWithSVGDOM(attrName); 101 return SVGElement::isPresentationAttributeWithSVGDOM(attrName);
100 } 102 }
101 103
102 void SVGMaskElement::collectStyleForPresentationAttribute(const QualifiedName& n ame, const AtomicString& value, MutableStylePropertySet* style) 104 void SVGMaskElement::collectStyleForPresentationAttribute(const QualifiedName& n ame, const AtomicString& value, MutableStylePropertySet* style)
103 { 105 {
104 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> property = propertyFromAttribute (name); 106 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> property = propertyFromAttribute (name);
105 if (property == m_x) 107 if (property == m_x)
106 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyX, *m _x->currentValue()); 108 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyX, *m _x->currentValue());
107 else if (property == m_y) 109 else if (property == m_y)
108 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyY, *m _y->currentValue()); 110 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyY, *m _y->currentValue());
111 else if (property == m_width)
112 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyWidth , *m_width->currentValue());
113 else if (property == m_height)
114 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyHeigh t, *m_height->currentValue());
109 else 115 else
110 SVGElement::collectStyleForPresentationAttribute(name, value, style); 116 SVGElement::collectStyleForPresentationAttribute(name, value, style);
111 } 117 }
112 118
113 void SVGMaskElement::parseAttribute(const QualifiedName& name, const AtomicStrin g& value) 119 void SVGMaskElement::parseAttribute(const QualifiedName& name, const AtomicStrin g& value)
114 { 120 {
115 parseAttributeNew(name, value); 121 parseAttributeNew(name, value);
116 } 122 }
117 123
118 void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName) 124 void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName)
119 { 125 {
120 if (!isSupportedAttribute(attrName)) { 126 if (!isSupportedAttribute(attrName)) {
121 SVGElement::svgAttributeChanged(attrName); 127 SVGElement::svgAttributeChanged(attrName);
122 return; 128 return;
123 } 129 }
124 130
125 SVGElement::InvalidationGuard invalidationGuard(this); 131 SVGElement::InvalidationGuard invalidationGuard(this);
126 132
127 if (attrName == SVGNames::xAttr 133 if (attrName == SVGNames::xAttr
128 || attrName == SVGNames::yAttr) {
129 invalidateSVGPresentationAttributeStyle();
130 setNeedsStyleRecalc(LocalStyleChange,
131 StyleChangeReasonForTracing::fromAttribute(attrName));
132 }
133
134 if (attrName == SVGNames::xAttr
135 || attrName == SVGNames::yAttr 134 || attrName == SVGNames::yAttr
136 || attrName == SVGNames::widthAttr 135 || attrName == SVGNames::widthAttr
137 || attrName == SVGNames::heightAttr) 136 || attrName == SVGNames::heightAttr) {
137 invalidateSVGPresentationAttributeStyle();
138 setNeedsStyleRecalc(LocalStyleChange,
139 StyleChangeReasonForTracing::fromAttribute(attrName));
138 updateRelativeLengthsInformation(); 140 updateRelativeLengthsInformation();
141 }
139 142
140 LayoutSVGResourceContainer* renderer = toLayoutSVGResourceContainer(this->la youtObject()); 143 LayoutSVGResourceContainer* renderer = toLayoutSVGResourceContainer(this->la youtObject());
141 if (renderer) 144 if (renderer)
142 renderer->invalidateCacheAndMarkForLayout(); 145 renderer->invalidateCacheAndMarkForLayout();
143 } 146 }
144 147
145 void SVGMaskElement::childrenChanged(const ChildrenChange& change) 148 void SVGMaskElement::childrenChanged(const ChildrenChange& change)
146 { 149 {
147 SVGElement::childrenChanged(change); 150 SVGElement::childrenChanged(change);
148 151
(...skipping 11 matching lines...) Expand all
160 163
161 bool SVGMaskElement::selfHasRelativeLengths() const 164 bool SVGMaskElement::selfHasRelativeLengths() const
162 { 165 {
163 return m_x->currentValue()->isRelative() 166 return m_x->currentValue()->isRelative()
164 || m_y->currentValue()->isRelative() 167 || m_y->currentValue()->isRelative()
165 || m_width->currentValue()->isRelative() 168 || m_width->currentValue()->isRelative()
166 || m_height->currentValue()->isRelative(); 169 || m_height->currentValue()->isRelative();
167 } 170 }
168 171
169 } // namespace blink 172 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698