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

Unified Diff: Source/core/svg/SVGSVGElement.cpp

Issue 1015743003: [svg] Make svgView override existing data selectively (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: codereview fixes Created 5 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/SVGSVGElement.h ('k') | Source/core/svg/SVGViewSpec.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « Source/core/svg/SVGSVGElement.h ('k') | Source/core/svg/SVGViewSpec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698