Chromium Code Reviews| Index: Source/core/svg/SVGSVGElement.cpp |
| diff --git a/Source/core/svg/SVGSVGElement.cpp b/Source/core/svg/SVGSVGElement.cpp |
| index 6aa65f51ad2ad5a57ae7f41362c59762cbe49483..d8b8f13b69e195c5f6c41b0e1b94bdd016a8341a 100644 |
| --- a/Source/core/svg/SVGSVGElement.cpp |
| +++ b/Source/core/svg/SVGSVGElement.cpp |
| @@ -713,6 +713,8 @@ void SVGSVGElement::setupInitialView(const String& fragmentIdentifier, Element* |
| if (!view) |
| view = currentView(); // Create the SVGViewSpec. |
| + view->inheritViewAttributesFromElement(this); |
| + |
| if (view->parseViewSpec(fragmentIdentifier)) |
| m_useCurrentView = true; |
| else |
| @@ -731,7 +733,12 @@ void SVGSVGElement::setupInitialView(const String& fragmentIdentifier, Element* |
| SVGViewElement& viewElement = toSVGViewElement(*anchorNode); |
| if (SVGSVGElement* svg = viewElement.ownerSVGElement()) { |
| - svg->inheritViewAttributes(&viewElement); |
| + if (!view) |
| + view = currentView(); |
| + m_useCurrentView = true; |
|
fs
2015/03/19 10:16:30
Maybe we should tread more carefully here, since v
|
| + |
| + view->inheritViewAttributesFromElement(svg); |
| + view->inheritViewAttributesFromElement(&viewElement); |
| if (LayoutObject* renderer = svg->layoutObject()) |
| markForLayoutAndParentResourceInvalidation(renderer); |
| @@ -749,30 +756,6 @@ void SVGSVGElement::setupInitialView(const String& fragmentIdentifier, Element* |
| // FIXME: We need to actually "highlight" the viewTarget(s). |
| } |
| -void SVGSVGElement::inheritViewAttributes(SVGViewElement* viewElement) |
| -{ |
| - SVGViewSpec* view = currentView(); |
| - m_useCurrentView = true; |
| - |
| - if (viewElement->hasAttribute(SVGNames::viewBoxAttr)) |
| - view->viewBox()->baseValue()->setValue(viewElement->viewBox()->currentValue()->value()); |
| - else |
| - view->viewBox()->baseValue()->setValue(viewBox()->currentValue()->value()); |
| - |
| - if (viewElement->hasAttribute(SVGNames::preserveAspectRatioAttr)) { |
| - view->preserveAspectRatio()->baseValue()->setAlign(viewElement->preserveAspectRatio()->currentValue()->align()); |
| - view->preserveAspectRatio()->baseValue()->setMeetOrSlice(viewElement->preserveAspectRatio()->currentValue()->meetOrSlice()); |
| - } else { |
| - view->preserveAspectRatio()->baseValue()->setAlign(preserveAspectRatio()->currentValue()->align()); |
| - view->preserveAspectRatio()->baseValue()->setMeetOrSlice(preserveAspectRatio()->currentValue()->meetOrSlice()); |
| - } |
| - |
| - if (viewElement->hasAttribute(SVGNames::zoomAndPanAttr)) |
| - view->setZoomAndPan(viewElement->zoomAndPan()); |
| - else |
| - view->setZoomAndPan(zoomAndPan()); |
| -} |
| - |
| void SVGSVGElement::finishParsingChildren() |
| { |
| SVGGraphicsElement::finishParsingChildren(); |