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

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: compilefix 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 | « LayoutTests/svg/as-image/svgview-identity-transform-expected.html ('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..89ebeea9724a88b6bbcf0dc3060022dca6ff607f 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
@@ -727,6 +729,10 @@ void SVGSVGElement::setupInitialView(const String& fragmentIdentifier, Element*
// or MyDrawing.svg#xpointer(id('MyView'))) then the closest ancestor 'svg' element is displayed in the viewport.
// Any view specification attributes included on the given 'view' element override the corresponding view specification
// attributes on the closest ancestor 'svg' element.
+ // TODO(ed): The spec text above is a bit unclear.
+ // Should the transform from outermost svg to nested svg be applied to "display"
+ // the inner svg in the viewport, then let the view element override the inner
+ // svg's view specification attributes. Should it fill/override the outer viewport?
if (isSVGViewElement(anchorNode)) {
SVGViewElement& viewElement = toSVGViewElement(*anchorNode);
@@ -753,24 +759,8 @@ 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());
+ view->inheritViewAttributesFromElement(this);
+ view->inheritViewAttributesFromElement(viewElement);
}
void SVGSVGElement::finishParsingChildren()
« no previous file with comments | « LayoutTests/svg/as-image/svgview-identity-transform-expected.html ('k') | Source/core/svg/SVGViewSpec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698