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

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: Use |value| sent to collectStyleForPresentationAttribute as suggested in review 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..25db9006ea3f5c83e05329a68b92268618f28278 100644
--- a/Source/core/svg/SVGForeignObjectElement.cpp
+++ b/Source/core/svg/SVGForeignObjectElement.cpp
@@ -82,6 +82,31 @@ 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() == LengthTypeNumber)
fs 2014/04/02 14:38:31 Won't the mode == SVGAttributeMode on the MutableS
davve 2014/04/02 18:23:27 True, it would still work without it. But we would
fs 2014/04/03 07:50:41 Ok. Maybe just add a comment to that effect then?
davve 2014/04/03 08:43:57 Leaning towards removing now. Enabling the present
+ length->setUnitType(LengthTypePX);
+ 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)) {
@@ -89,6 +114,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