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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | Source/core/svg/SVGViewElement.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Rob Buis <buis@kde.org>
4 * Copyright (C) 2007 Apple Inc. All rights reserved. 4 * Copyright (C) 2007 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 if (renderer && (hadUseCurrentView || m_useCurrentView)) 709 if (renderer && (hadUseCurrentView || m_useCurrentView))
710 RenderSVGResource::markForLayoutAndParentResourceInvalidation(render er); 710 RenderSVGResource::markForLayoutAndParentResourceInvalidation(render er);
711 return; 711 return;
712 } 712 }
713 713
714 // Spec: If the SVG fragment identifier addresses a ‘view’ element within an SVG document (e.g., MyDrawing.svg#MyView 714 // Spec: If the SVG fragment identifier addresses a ‘view’ element within an SVG document (e.g., MyDrawing.svg#MyView
715 // or MyDrawing.svg#xpointer(id('MyView'))) then the closest ancestor ‘svg’ element is displayed in the viewport. 715 // or MyDrawing.svg#xpointer(id('MyView'))) then the closest ancestor ‘svg’ element is displayed in the viewport.
716 // Any view specification attributes included on the given ‘view’ element ov erride the corresponding view specification 716 // Any view specification attributes included on the given ‘view’ element ov erride the corresponding view specification
717 // attributes on the closest ancestor ‘svg’ element. 717 // attributes on the closest ancestor ‘svg’ element.
718 if (anchorNode && anchorNode->hasTagName(SVGNames::viewTag)) { 718 if (anchorNode && anchorNode->hasTagName(SVGNames::viewTag)) {
719 if (SVGViewElement* viewElement = anchorNode->hasTagName(SVGNames::viewT ag) ? static_cast<SVGViewElement*>(anchorNode) : 0) { 719 SVGViewElement* viewElement = toSVGViewElement(anchorNode);
720 SVGElement* element = SVGLocatable::nearestViewportElement(viewEleme nt); 720 if (!viewElement)
721 if (element->hasTagName(SVGNames::svgTag)) { 721 return;
722 SVGSVGElement* svg = toSVGSVGElement(element);
723 svg->inheritViewAttributes(viewElement);
724 722
725 if (RenderObject* renderer = svg->renderer()) 723 SVGElement* element = SVGLocatable::nearestViewportElement(viewElement);
726 RenderSVGResource::markForLayoutAndParentResourceInvalidatio n(renderer); 724 if (element->hasTagName(SVGNames::svgTag)) {
727 } 725 SVGSVGElement* svg = toSVGSVGElement(element);
726 svg->inheritViewAttributes(viewElement);
727
728 if (RenderObject* renderer = svg->renderer())
729 RenderSVGResource::markForLayoutAndParentResourceInvalidation(re nderer);
728 } 730 }
729 return;
730 } 731 }
731 732
732 // FIXME: We need to decide which <svg> to focus on, and zoom to it. 733 // FIXME: We need to decide which <svg> to focus on, and zoom to it.
733 // FIXME: We need to actually "highlight" the viewTarget(s). 734 // FIXME: We need to actually "highlight" the viewTarget(s).
734 } 735 }
735 736
736 void SVGSVGElement::inheritViewAttributes(SVGViewElement* viewElement) 737 void SVGSVGElement::inheritViewAttributes(SVGViewElement* viewElement)
737 { 738 {
738 SVGViewSpec* view = currentView(); 739 SVGViewSpec* view = currentView();
739 m_useCurrentView = true; 740 m_useCurrentView = true;
(...skipping 29 matching lines...) Expand all
769 continue; 770 continue;
770 771
771 Element* element = toElement(node); 772 Element* element = toElement(node);
772 if (element->getIdAttribute() == id) 773 if (element->getIdAttribute() == id)
773 return element; 774 return element;
774 } 775 }
775 return 0; 776 return 0;
776 } 777 }
777 778
778 } 779 }
OLDNEW
« 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