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

Unified Diff: Source/core/svg/SVGRectElement.cpp

Issue 963733002: [svg2] Make 'width' and 'height' presentation attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebaseline some EX tests [Mac Win] 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/svg/SVGMaskElement.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGRectElement.cpp
diff --git a/Source/core/svg/SVGRectElement.cpp b/Source/core/svg/SVGRectElement.cpp
index 940a2f4977a45b529aaf1f178e98aaf1109e23b3..2491d8ebb2642d676e9fd94034f4a0be1ae93060 100644
--- a/Source/core/svg/SVGRectElement.cpp
+++ b/Source/core/svg/SVGRectElement.cpp
@@ -78,6 +78,7 @@ void SVGRectElement::parseAttribute(const QualifiedName& name, const AtomicStrin
bool SVGRectElement::isPresentationAttribute(const QualifiedName& attrName) const
{
if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr
+ || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr
|| attrName == SVGNames::rxAttr || attrName == SVGNames::ryAttr)
return true;
return SVGGeometryElement::isPresentationAttribute(attrName);
@@ -86,6 +87,7 @@ bool SVGRectElement::isPresentationAttribute(const QualifiedName& attrName) cons
bool SVGRectElement::isPresentationAttributeWithSVGDOM(const QualifiedName& attrName) const
{
if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr
+ || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr
|| attrName == SVGNames::rxAttr || attrName == SVGNames::ryAttr)
return true;
return SVGGeometryElement::isPresentationAttributeWithSVGDOM(attrName);
@@ -98,6 +100,10 @@ void SVGRectElement::collectStyleForPresentationAttribute(const QualifiedName& n
addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyX, *m_x->currentValue());
else if (property == m_y)
addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyY, *m_y->currentValue());
+ else if (property == m_width)
+ addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyWidth, *m_width->currentValue());
+ else if (property == m_height)
+ addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyHeight, *m_height->currentValue());
else if (property == m_rx)
addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyRx, *m_rx->currentValue());
else if (property == m_ry)
@@ -115,35 +121,17 @@ void SVGRectElement::svgAttributeChanged(const QualifiedName& attrName)
SVGElement::InvalidationGuard invalidationGuard(this);
- bool isPresentationLengthAttribute =
- attrName == SVGNames::xAttr
- || attrName == SVGNames::yAttr
- || attrName == SVGNames::rxAttr
- || attrName == SVGNames::ryAttr;
- if (isPresentationLengthAttribute) {
- invalidateSVGPresentationAttributeStyle();
- setNeedsStyleRecalc(LocalStyleChange,
- StyleChangeReasonForTracing::fromAttribute(attrName));
- }
-
- bool isLengthAttribute = isPresentationLengthAttribute
- || attrName == SVGNames::widthAttr
- || attrName == SVGNames::heightAttr;
-
- if (isLengthAttribute)
- updateRelativeLengthsInformation();
+ invalidateSVGPresentationAttributeStyle();
+ setNeedsStyleRecalc(LocalStyleChange,
+ StyleChangeReasonForTracing::fromAttribute(attrName));
+ updateRelativeLengthsInformation();
LayoutSVGShape* renderer = toLayoutSVGShape(this->layoutObject());
if (!renderer)
return;
- if (isLengthAttribute) {
- renderer->setNeedsShapeUpdate();
- markForLayoutAndParentResourceInvalidation(renderer);
- return;
- }
-
- ASSERT_NOT_REACHED();
+ renderer->setNeedsShapeUpdate();
+ markForLayoutAndParentResourceInvalidation(renderer);
}
bool SVGRectElement::selfHasRelativeLengths() const
« no previous file with comments | « Source/core/svg/SVGMaskElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698