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

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

Issue 23636006: Introduce toSVGViewElement(), and refactor setupInitialView() using it (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 3 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 | « no previous file | Source/core/svg/SVGViewElement.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 884364941490118680321efb942cbd04525c52f5..b4a4d876c4ddf20090b54158826d0a2c55f8a34f 100644
--- a/Source/core/svg/SVGSVGElement.cpp
+++ b/Source/core/svg/SVGSVGElement.cpp
@@ -716,17 +716,18 @@ void SVGSVGElement::setupInitialView(const String& fragmentIdentifier, Element*
// Any view specification attributes included on the given ‘view’ element override the corresponding view specification
// attributes on the closest ancestor ‘svg’ element.
if (anchorNode && anchorNode->hasTagName(SVGNames::viewTag)) {
- if (SVGViewElement* viewElement = anchorNode->hasTagName(SVGNames::viewTag) ? static_cast<SVGViewElement*>(anchorNode) : 0) {
- SVGElement* element = SVGLocatable::nearestViewportElement(viewElement);
- if (element->hasTagName(SVGNames::svgTag)) {
- SVGSVGElement* svg = toSVGSVGElement(element);
- svg->inheritViewAttributes(viewElement);
-
- if (RenderObject* renderer = svg->renderer())
- RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
- }
+ SVGViewElement* viewElement = toSVGViewElement(anchorNode);
+ if (!viewElement)
+ return;
+
+ SVGElement* element = SVGLocatable::nearestViewportElement(viewElement);
+ if (element->hasTagName(SVGNames::svgTag)) {
+ SVGSVGElement* svg = toSVGSVGElement(element);
+ svg->inheritViewAttributes(viewElement);
+
+ if (RenderObject* renderer = svg->renderer())
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
}
- return;
}
// FIXME: We need to decide which <svg> to focus on, and zoom to it.
« no previous file with comments | « no previous file | Source/core/svg/SVGViewElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698