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

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: Updated TextExpectations to include height variants too Created 6 years, 8 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 abf120afb2cede70aaf1200b708f11475464cdf5..a588a67984e325a1d144c468e5b4c0d1da6350c1 100644
--- a/Source/core/svg/SVGForeignObjectElement.cpp
+++ b/Source/core/svg/SVGForeignObjectElement.cpp
@@ -85,6 +85,29 @@ 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) {
+ RefPtr<SVGLength> length = SVGLength::create(LengthModeOther);
+ length->setValueAsString(value, IGNORE_EXCEPTION);
+ if (length->unitType() != LengthTypeUnknown) {
+ if (name == SVGNames::widthAttr)
+ addPropertyToPresentationAttributeStyle(style, CSSPropertyWidth, length->valueAsString());
+ else if (name == SVGNames::heightAttr)
+ addPropertyToPresentationAttributeStyle(style, CSSPropertyHeight, length->valueAsString());
+ }
+ } else {
+ SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, style);
+ }
+}
+
void SVGForeignObjectElement::svgAttributeChanged(const QualifiedName& attrName)
{
if (!isSupportedAttribute(attrName)) {
@@ -92,6 +115,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