void SVGSVGElement::svgAttributeChanged(const QualifiedName& attrName) { SVGStyledElement::svgAttributeChanged(attrName); // FIXME: Ugly, ugly hack to around that parseMappedAttribute is not called // when svg.width.baseValue = 100 is evaluated. // Thus the CSS length value for width is not updated, and width() calcWidth() // calculations on RenderSVGRoot will be wrong. // https://bugs.webkit.org/show_bug.cgi?id=25387 if (attrName == SVGNames::widthAttr) updateCSSForAttribute(this, attrName, CSSPropertyWidth, widthBaseValue()); else if (attrName == SVGNames::heightAttr) updateCSSForAttribute(this, attrName, CSSPropertyHeight, heightBaseValue()); if (!renderer()) return; if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || SVGTests::isKnownAttribute(attrName) || SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName) || SVGFitToViewBox::isKnownAttribute(attrName) || SVGZoomAndPan::isKnownAttribute(attrName) || SVGStyledLocatableElement::isKnownAttribute(attrName)) renderer()->setNeedsLayout(true); }
void SVGSVGElement::svgAttributeChanged(const QualifiedName& attrName) { // FIXME: Ugly, ugly hack to around that parseMappedAttribute is not called // when svg.width.baseValue = 100 is evaluated. // Thus the CSS length value for width is not updated, and width() computeLogicalWidth() // calculations on RenderSVGRoot will be wrong. // https://bugs.webkit.org/show_bug.cgi?id=25387 bool updateRelativeLengths = false; if (attrName == SVGNames::widthAttr) { updateCSSForAttribute(this, attrName, CSSPropertyWidth, widthBaseValue()); updateRelativeLengths = true; } else if (attrName == SVGNames::heightAttr) { updateCSSForAttribute(this, attrName, CSSPropertyHeight, heightBaseValue()); updateRelativeLengths = true; } if (updateRelativeLengths || attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || SVGFitToViewBox::isKnownAttribute(attrName)) { updateRelativeLengths = true; updateRelativeLengthsInformation(); } SVGElementInstance::InvalidationGuard invalidationGuard(this); if (SVGTests::handleAttributeChange(this, attrName)) return; if (updateRelativeLengths || SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName) || SVGZoomAndPan::isKnownAttribute(attrName)) { if (renderer()) RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer()); return; } SVGStyledElement::svgAttributeChanged(attrName); }