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 |