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

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: rebase 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
« no previous file with comments | « Source/core/svg/SVGMaskElement.h ('k') | Source/core/svg/SVGPatternElement.h » ('j') | 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) 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 bool SVGMaskElement::isPresentationAttributeWithSVGDOM(const QualifiedName& attr Name) const
96 {
97 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr)
98 return true;
99 return SVGElement::isPresentationAttributeWithSVGDOM(attrName);
100 }
101
102 void SVGMaskElement::collectStyleForPresentationAttribute(const QualifiedName& n ame, const AtomicString& value, MutableStylePropertySet* style)
103 {
104 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> property = propertyFromAttribute (name);
105 if (property == m_x)
106 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyX, *m _x->currentValue());
107 else if (property == m_y)
108 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyY, *m _y->currentValue());
109 else
110 SVGElement::collectStyleForPresentationAttribute(name, value, style);
111 }
112
88 void SVGMaskElement::parseAttribute(const QualifiedName& name, const AtomicStrin g& value) 113 void SVGMaskElement::parseAttribute(const QualifiedName& name, const AtomicStrin g& value)
89 { 114 {
90 parseAttributeNew(name, value); 115 parseAttributeNew(name, value);
91 } 116 }
92 117
93 void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName) 118 void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName)
94 { 119 {
95 if (!isSupportedAttribute(attrName)) { 120 if (!isSupportedAttribute(attrName)) {
96 SVGElement::svgAttributeChanged(attrName); 121 SVGElement::svgAttributeChanged(attrName);
97 return; 122 return;
98 } 123 }
99 124
100 SVGElement::InvalidationGuard invalidationGuard(this); 125 SVGElement::InvalidationGuard invalidationGuard(this);
101 126
102 if (attrName == SVGNames::xAttr 127 if (attrName == SVGNames::xAttr
128 || attrName == SVGNames::yAttr) {
129 invalidateSVGPresentationAttributeStyle();
130 setNeedsStyleRecalc(LocalStyleChange,
131 StyleChangeReasonForTracing::fromAttribute(attrName));
132 }
133
134 if (attrName == SVGNames::xAttr
103 || attrName == SVGNames::yAttr 135 || attrName == SVGNames::yAttr
104 || attrName == SVGNames::widthAttr 136 || attrName == SVGNames::widthAttr
105 || attrName == SVGNames::heightAttr) 137 || attrName == SVGNames::heightAttr)
106 updateRelativeLengthsInformation(); 138 updateRelativeLengthsInformation();
107 139
108 LayoutSVGResourceContainer* renderer = toLayoutSVGResourceContainer(this->re nderer()); 140 LayoutSVGResourceContainer* renderer = toLayoutSVGResourceContainer(this->re nderer());
109 if (renderer) 141 if (renderer)
110 renderer->invalidateCacheAndMarkForLayout(); 142 renderer->invalidateCacheAndMarkForLayout();
111 } 143 }
112 144
(...skipping 15 matching lines...) Expand all
128 160
129 bool SVGMaskElement::selfHasRelativeLengths() const 161 bool SVGMaskElement::selfHasRelativeLengths() const
130 { 162 {
131 return m_x->currentValue()->isRelative() 163 return m_x->currentValue()->isRelative()
132 || m_y->currentValue()->isRelative() 164 || m_y->currentValue()->isRelative()
133 || m_width->currentValue()->isRelative() 165 || m_width->currentValue()->isRelative()
134 || m_height->currentValue()->isRelative(); 166 || m_height->currentValue()->isRelative();
135 } 167 }
136 168
137 } // namespace blink 169 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/svg/SVGMaskElement.h ('k') | Source/core/svg/SVGPatternElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698