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

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

Issue 218403009: Map width/height to style for foreignObject (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added SVG DOM change to test Created 6 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/SVGForeignObjectElement.h ('k') | no next file » | 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 bec8dffa6e725da594135066e6d035387972de73..3fb5c834201dbc31b58af4ba2db299f2684ae97f 100644
--- a/Source/core/svg/SVGForeignObjectElement.cpp
+++ b/Source/core/svg/SVGForeignObjectElement.cpp
@@ -82,6 +82,25 @@ void SVGForeignObjectElement::parseAttribute(const QualifiedName& name, const At
reportAttributeParsingError(parseError, name, value);
}
+bool SVGForeignObjectElement::isPresentationAttribute(const QualifiedName& name) const
+{
+ if (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) {
fs 2014/04/02 11:00:41 It seems unnecessary to check these twice (for no
davve 2014/04/02 11:17:48 Thanks. Was remains from earlier versions.
+ if (name == SVGNames::widthAttr)
+ addPropertyToPresentationAttributeStyle(style, CSSPropertyWidth, m_width->currentValue()->valueAsString());
fs 2014/04/02 11:00:41 Why not just pass |value| as the value? (IIUC, if
davve 2014/04/02 11:17:48 I specifically added a test that fails when using
fs 2014/04/02 11:55:00 Ok. I figured that's what the change in svgAttribu
davve 2014/04/02 12:43:56 It is. But it only triggers the recomputation, doe
+ else if (name == SVGNames::heightAttr)
+ addPropertyToPresentationAttributeStyle(style, CSSPropertyHeight, m_height->currentValue()->valueAsString());
+ } else {
+ SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, style);
+ }
+}
+
void SVGForeignObjectElement::svgAttributeChanged(const QualifiedName& attrName)
{
if (!isSupportedAttribute(attrName)) {
@@ -89,6 +108,11 @@ void SVGForeignObjectElement::svgAttributeChanged(const QualifiedName& attrName)
return;
}
+ if (attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) {
+ invalidateSVGPresentationAttributeStyle();
+ setNeedsStyleRecalc(LocalStyleChange);
+ }
+
SVGElementInstance::InvalidationGuard invalidationGuard(this);
bool isLengthAttribute = attrName == SVGNames::xAttr
« no previous file with comments | « Source/core/svg/SVGForeignObjectElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698