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

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

Issue 896773002: [svg2] Make 'x' and 'y' presentation attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: cleanup Created 5 years, 10 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 supportedAttributes.add(SVGNames::maskUnitsAttr); 78 supportedAttributes.add(SVGNames::maskUnitsAttr);
79 supportedAttributes.add(SVGNames::maskContentUnitsAttr); 79 supportedAttributes.add(SVGNames::maskContentUnitsAttr);
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
89 {
90 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr)
91 return true;
92 return SVGElement::isPresentationAttribute(attrName);
93 }
94
95 void SVGMaskElement::collectStyleForPresentationAttribute(const QualifiedName& n ame, const AtomicString& value, MutableStylePropertySet* style)
96 {
97 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> property = propertyFromAttribute (name);
98 if (property == m_x)
99 addPropertyToPresentationAttributeStyle(style, CSSPropertyX, m_x->curren tValue()->valueInSpecifiedUnits(), m_x->currentValue()->cssUnitTypeQuirk());
100 else if (property == m_y)
101 addPropertyToPresentationAttributeStyle(style, CSSPropertyY, m_y->curren tValue()->valueInSpecifiedUnits(), m_y->currentValue()->cssUnitTypeQuirk());
102 else
103 SVGElement::collectStyleForPresentationAttribute(name, value, style);
104 }
105
88 void SVGMaskElement::parseAttribute(const QualifiedName& name, const AtomicStrin g& value) 106 void SVGMaskElement::parseAttribute(const QualifiedName& name, const AtomicStrin g& value)
89 { 107 {
90 parseAttributeNew(name, value); 108 parseAttributeNew(name, value);
91 } 109 }
92 110
93 void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName) 111 void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName)
94 { 112 {
95 if (!isSupportedAttribute(attrName)) { 113 if (!isSupportedAttribute(attrName)) {
96 SVGElement::svgAttributeChanged(attrName); 114 SVGElement::svgAttributeChanged(attrName);
97 return; 115 return;
98 } 116 }
99 117
100 SVGElement::InvalidationGuard invalidationGuard(this); 118 SVGElement::InvalidationGuard invalidationGuard(this);
101 119
102 if (attrName == SVGNames::xAttr 120 if (attrName == SVGNames::xAttr
121 || attrName == SVGNames::yAttr) {
122 invalidateSVGPresentationAttributeStyle();
123 setNeedsStyleRecalc(LocalStyleChange,
124 StyleChangeReasonForTracing::fromAttribute(attrName));
125 }
126
127 if (attrName == SVGNames::xAttr
103 || attrName == SVGNames::yAttr 128 || attrName == SVGNames::yAttr
104 || attrName == SVGNames::widthAttr 129 || attrName == SVGNames::widthAttr
105 || attrName == SVGNames::heightAttr) 130 || attrName == SVGNames::heightAttr)
106 updateRelativeLengthsInformation(); 131 updateRelativeLengthsInformation();
107 132
108 RenderSVGResourceContainer* renderer = toRenderSVGResourceContainer(this->re nderer()); 133 RenderSVGResourceContainer* renderer = toRenderSVGResourceContainer(this->re nderer());
109 if (renderer) 134 if (renderer)
110 renderer->invalidateCacheAndMarkForLayout(); 135 renderer->invalidateCacheAndMarkForLayout();
111 } 136 }
112 137
(...skipping 15 matching lines...) Expand all
128 153
129 bool SVGMaskElement::selfHasRelativeLengths() const 154 bool SVGMaskElement::selfHasRelativeLengths() const
130 { 155 {
131 return m_x->currentValue()->isRelative() 156 return m_x->currentValue()->isRelative()
132 || m_y->currentValue()->isRelative() 157 || m_y->currentValue()->isRelative()
133 || m_width->currentValue()->isRelative() 158 || m_width->currentValue()->isRelative()
134 || m_height->currentValue()->isRelative(); 159 || m_height->currentValue()->isRelative();
135 } 160 }
136 161
137 } // namespace blink 162 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698