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

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

Issue 898873002: CL for perf tryjob (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/svg/SVGElement.h ('k') | Source/core/svg/SVGImageElement.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGForeignObjectElement.cpp
diff --git a/Source/core/svg/SVGForeignObjectElement.cpp b/Source/core/svg/SVGForeignObjectElement.cpp
index 04d74d6ab08f7816dd0e8d8365bf61c6d1d29288..43218aed980b83d60cdf0bb0baa7ff59ca711229 100644
--- a/Source/core/svg/SVGForeignObjectElement.cpp
+++ b/Source/core/svg/SVGForeignObjectElement.cpp
@@ -74,23 +74,29 @@ void SVGForeignObjectElement::parseAttribute(const QualifiedName& name, const At
bool SVGForeignObjectElement::isPresentationAttribute(const QualifiedName& name) const
{
- if (name == SVGNames::widthAttr || name == SVGNames::heightAttr)
+ if (name == SVGNames::xAttr || name == SVGNames::yAttr
+ || name == SVGNames::widthAttr || name == SVGNames::heightAttr)
return true;
return SVGGraphicsElement::isPresentationAttribute(name);
}
void SVGForeignObjectElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStylePropertySet* style)
{
- if (name == SVGNames::widthAttr || name == SVGNames::heightAttr) {
+ RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> property = propertyFromAttribute(name);
+ if (property == m_width || property == m_height) {
RefPtrWillBeRawPtr<SVGLength> length = SVGLength::create(LengthModeOther);
TrackExceptionState exceptionState;
length->setValueAsString(value, exceptionState);
if (!exceptionState.hadException()) {
- if (name == SVGNames::widthAttr)
+ if (property == m_width)
addPropertyToPresentationAttributeStyle(style, CSSPropertyWidth, value);
- else if (name == SVGNames::heightAttr)
+ else if (property == m_height)
addPropertyToPresentationAttributeStyle(style, CSSPropertyHeight, value);
}
+ } else if (property == m_x) {
+ addPropertyToPresentationAttributeStyle(style, CSSPropertyX, m_x->currentValue()->valueInSpecifiedUnits(), m_x->currentValue()->cssUnitTypeQuirk());
+ } else if (property == m_y) {
+ addPropertyToPresentationAttributeStyle(style, CSSPropertyY, m_y->currentValue()->valueInSpecifiedUnits(), m_y->currentValue()->cssUnitTypeQuirk());
} else {
SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, style);
}
@@ -103,17 +109,20 @@ void SVGForeignObjectElement::svgAttributeChanged(const QualifiedName& attrName)
return;
}
- if (attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) {
+ SVGElement::InvalidationGuard invalidationGuard(this);
+
+ bool widthOrHeight = attrName == SVGNames::widthAttr
+ || attrName == SVGNames::heightAttr;
+
+ if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || widthOrHeight) {
invalidateSVGPresentationAttributeStyle();
- setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::SVGContainerSizeChange));
+ setNeedsStyleRecalc(LocalStyleChange,
+ widthOrHeight ? StyleChangeReasonForTracing::create(StyleChangeReason::SVGContainerSizeChange) : StyleChangeReasonForTracing::fromAttribute(attrName));
}
- SVGElement::InvalidationGuard invalidationGuard(this);
-
bool isLengthAttribute = attrName == SVGNames::xAttr
- || attrName == SVGNames::yAttr
- || attrName == SVGNames::widthAttr
- || attrName == SVGNames::heightAttr;
+ || attrName == SVGNames::yAttr
+ || widthOrHeight;
if (isLengthAttribute) {
updateRelativeLengthsInformation();
« no previous file with comments | « Source/core/svg/SVGElement.h ('k') | Source/core/svg/SVGImageElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698