OLD | NEW |
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 * Copyright (C) 2014 Google, Inc. | 5 * Copyright (C) 2014 Google, Inc. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "core/dom/ElementTraversal.h" | 32 #include "core/dom/ElementTraversal.h" |
33 #include "core/dom/StaticNodeList.h" | 33 #include "core/dom/StaticNodeList.h" |
34 #include "core/editing/FrameSelection.h" | 34 #include "core/editing/FrameSelection.h" |
35 #include "core/events/EventListener.h" | 35 #include "core/events/EventListener.h" |
36 #include "core/frame/LocalFrame.h" | 36 #include "core/frame/LocalFrame.h" |
37 #include "core/page/FrameTree.h" | 37 #include "core/page/FrameTree.h" |
38 #include "core/frame/FrameView.h" | 38 #include "core/frame/FrameView.h" |
39 #include "core/frame/UseCounter.h" | 39 #include "core/frame/UseCounter.h" |
40 #include "core/rendering/RenderObject.h" | 40 #include "core/rendering/RenderObject.h" |
41 #include "core/rendering/svg/RenderSVGModelObject.h" | 41 #include "core/rendering/svg/RenderSVGModelObject.h" |
42 #include "core/rendering/svg/RenderSVGResource.h" | |
43 #include "core/rendering/svg/RenderSVGRoot.h" | 42 #include "core/rendering/svg/RenderSVGRoot.h" |
44 #include "core/rendering/svg/RenderSVGViewportContainer.h" | 43 #include "core/rendering/svg/RenderSVGViewportContainer.h" |
45 #include "core/svg/SVGAngleTearOff.h" | 44 #include "core/svg/SVGAngleTearOff.h" |
46 #include "core/svg/SVGNumberTearOff.h" | 45 #include "core/svg/SVGNumberTearOff.h" |
47 #include "core/svg/SVGPreserveAspectRatio.h" | 46 #include "core/svg/SVGPreserveAspectRatio.h" |
48 #include "core/svg/SVGRectTearOff.h" | 47 #include "core/svg/SVGRectTearOff.h" |
49 #include "core/svg/SVGTransform.h" | 48 #include "core/svg/SVGTransform.h" |
50 #include "core/svg/SVGTransformList.h" | 49 #include "core/svg/SVGTransformList.h" |
51 #include "core/svg/SVGTransformTearOff.h" | 50 #include "core/svg/SVGTransformTearOff.h" |
52 #include "core/svg/SVGViewElement.h" | 51 #include "core/svg/SVGViewElement.h" |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 updateRelativeLengthsOrViewBox = true; | 294 updateRelativeLengthsOrViewBox = true; |
296 if (RenderObject* object = renderer()) | 295 if (RenderObject* object = renderer()) |
297 object->setNeedsTransformUpdate(); | 296 object->setNeedsTransformUpdate(); |
298 } | 297 } |
299 | 298 |
300 SVGElement::InvalidationGuard invalidationGuard(this); | 299 SVGElement::InvalidationGuard invalidationGuard(this); |
301 | 300 |
302 if (updateRelativeLengthsOrViewBox | 301 if (updateRelativeLengthsOrViewBox |
303 || SVGZoomAndPan::isKnownAttribute(attrName)) { | 302 || SVGZoomAndPan::isKnownAttribute(attrName)) { |
304 if (renderer()) | 303 if (renderer()) |
305 RenderSVGResource::markForLayoutAndParentResourceInvalidation(render
er()); | 304 markForLayoutAndParentResourceInvalidation(renderer()); |
306 return; | 305 return; |
307 } | 306 } |
308 | 307 |
309 SVGGraphicsElement::svgAttributeChanged(attrName); | 308 SVGGraphicsElement::svgAttributeChanged(attrName); |
310 } | 309 } |
311 | 310 |
312 // FloatRect::intersects does not consider horizontal or vertical lines (because
of isEmpty()). | 311 // FloatRect::intersects does not consider horizontal or vertical lines (because
of isEmpty()). |
313 static bool intersectsAllowingEmpty(const FloatRect& r1, const FloatRect& r2) | 312 static bool intersectsAllowingEmpty(const FloatRect& r1, const FloatRect& r2) |
314 { | 313 { |
315 if (r1.width() < 0 || r1.height() < 0 || r2.width() < 0 || r2.height() < 0) | 314 if (r1.width() < 0 || r1.height() < 0 || r2.width() < 0 || r2.height() < 0) |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 SVGViewSpec* view = m_viewSpec.get(); | 675 SVGViewSpec* view = m_viewSpec.get(); |
677 if (view) | 676 if (view) |
678 view->reset(); | 677 view->reset(); |
679 | 678 |
680 bool hadUseCurrentView = m_useCurrentView; | 679 bool hadUseCurrentView = m_useCurrentView; |
681 m_useCurrentView = false; | 680 m_useCurrentView = false; |
682 | 681 |
683 if (fragmentIdentifier.startsWith("xpointer(")) { | 682 if (fragmentIdentifier.startsWith("xpointer(")) { |
684 // FIXME: XPointer references are ignored (https://bugs.webkit.org/show_
bug.cgi?id=17491) | 683 // FIXME: XPointer references are ignored (https://bugs.webkit.org/show_
bug.cgi?id=17491) |
685 if (renderer && hadUseCurrentView) | 684 if (renderer && hadUseCurrentView) |
686 RenderSVGResource::markForLayoutAndParentResourceInvalidation(render
er); | 685 markForLayoutAndParentResourceInvalidation(renderer); |
687 return; | 686 return; |
688 } | 687 } |
689 | 688 |
690 if (fragmentIdentifier.startsWith("svgView(")) { | 689 if (fragmentIdentifier.startsWith("svgView(")) { |
691 if (!view) | 690 if (!view) |
692 view = currentView(); // Create the SVGViewSpec. | 691 view = currentView(); // Create the SVGViewSpec. |
693 | 692 |
694 if (view->parseViewSpec(fragmentIdentifier)) | 693 if (view->parseViewSpec(fragmentIdentifier)) |
695 m_useCurrentView = true; | 694 m_useCurrentView = true; |
696 else | 695 else |
697 view->reset(); | 696 view->reset(); |
698 | 697 |
699 if (renderer && (hadUseCurrentView || m_useCurrentView)) | 698 if (renderer && (hadUseCurrentView || m_useCurrentView)) |
700 RenderSVGResource::markForLayoutAndParentResourceInvalidation(render
er); | 699 markForLayoutAndParentResourceInvalidation(renderer); |
701 return; | 700 return; |
702 } | 701 } |
703 | 702 |
704 // Spec: If the SVG fragment identifier addresses a ‘view’ element within an
SVG document (e.g., MyDrawing.svg#MyView | 703 // Spec: If the SVG fragment identifier addresses a ‘view’ element within an
SVG document (e.g., MyDrawing.svg#MyView |
705 // or MyDrawing.svg#xpointer(id('MyView'))) then the closest ancestor ‘svg’
element is displayed in the viewport. | 704 // or MyDrawing.svg#xpointer(id('MyView'))) then the closest ancestor ‘svg’
element is displayed in the viewport. |
706 // Any view specification attributes included on the given ‘view’ element ov
erride the corresponding view specification | 705 // Any view specification attributes included on the given ‘view’ element ov
erride the corresponding view specification |
707 // attributes on the closest ancestor ‘svg’ element. | 706 // attributes on the closest ancestor ‘svg’ element. |
708 if (isSVGViewElement(anchorNode)) { | 707 if (isSVGViewElement(anchorNode)) { |
709 SVGViewElement& viewElement = toSVGViewElement(*anchorNode); | 708 SVGViewElement& viewElement = toSVGViewElement(*anchorNode); |
710 | 709 |
711 if (SVGSVGElement* svg = viewElement.ownerSVGElement()) { | 710 if (SVGSVGElement* svg = viewElement.ownerSVGElement()) { |
712 svg->inheritViewAttributes(&viewElement); | 711 svg->inheritViewAttributes(&viewElement); |
713 | 712 |
714 if (RenderObject* renderer = svg->renderer()) | 713 if (RenderObject* renderer = svg->renderer()) |
715 RenderSVGResource::markForLayoutAndParentResourceInvalidation(re
nderer); | 714 markForLayoutAndParentResourceInvalidation(renderer); |
716 } | 715 } |
717 } | 716 } |
718 | 717 |
719 // FIXME: We need to decide which <svg> to focus on, and zoom to it. | 718 // FIXME: We need to decide which <svg> to focus on, and zoom to it. |
720 // FIXME: We need to actually "highlight" the viewTarget(s). | 719 // FIXME: We need to actually "highlight" the viewTarget(s). |
721 } | 720 } |
722 | 721 |
723 void SVGSVGElement::inheritViewAttributes(SVGViewElement* viewElement) | 722 void SVGSVGElement::inheritViewAttributes(SVGViewElement* viewElement) |
724 { | 723 { |
725 SVGViewSpec* view = currentView(); | 724 SVGViewSpec* view = currentView(); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 } | 757 } |
759 | 758 |
760 void SVGSVGElement::trace(Visitor* visitor) | 759 void SVGSVGElement::trace(Visitor* visitor) |
761 { | 760 { |
762 visitor->trace(m_timeContainer); | 761 visitor->trace(m_timeContainer); |
763 visitor->trace(m_viewSpec); | 762 visitor->trace(m_viewSpec); |
764 SVGGraphicsElement::trace(visitor); | 763 SVGGraphicsElement::trace(visitor); |
765 } | 764 } |
766 | 765 |
767 } // namespace blink | 766 } // namespace blink |
OLD | NEW |