OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2007, 2008 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2007, 2008 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> | 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> |
5 * Copyright (C) 2009 Google, Inc. All rights reserved. | 5 * Copyright (C) 2009 Google, Inc. All rights reserved. |
6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "core/layout/svg/SVGResources.h" | 29 #include "core/layout/svg/SVGResources.h" |
30 #include "core/layout/svg/SVGResourcesCache.h" | 30 #include "core/layout/svg/SVGResourcesCache.h" |
31 #include "core/paint/SVGContainerPainter.h" | 31 #include "core/paint/SVGContainerPainter.h" |
32 | 32 |
33 namespace blink { | 33 namespace blink { |
34 | 34 |
35 LayoutSVGContainer::LayoutSVGContainer(SVGElement* node) | 35 LayoutSVGContainer::LayoutSVGContainer(SVGElement* node) |
36 : LayoutSVGModelObject(node) | 36 : LayoutSVGModelObject(node) |
37 , m_objectBoundingBoxValid(false) | 37 , m_objectBoundingBoxValid(false) |
38 , m_needsBoundariesUpdate(true) | 38 , m_needsBoundariesUpdate(true) |
| 39 , m_didTransformToRootUpdate(false) |
39 , m_hasNonIsolatedBlendingDescendants(false) | 40 , m_hasNonIsolatedBlendingDescendants(false) |
40 , m_hasNonIsolatedBlendingDescendantsDirty(false) | 41 , m_hasNonIsolatedBlendingDescendantsDirty(false) |
41 { | 42 { |
42 } | 43 } |
43 | 44 |
44 LayoutSVGContainer::~LayoutSVGContainer() | 45 LayoutSVGContainer::~LayoutSVGContainer() |
45 { | 46 { |
46 } | 47 } |
47 | 48 |
48 void LayoutSVGContainer::layout() | 49 void LayoutSVGContainer::layout() |
49 { | 50 { |
50 ASSERT(needsLayout()); | 51 ASSERT(needsLayout()); |
51 LayoutAnalyzer::Scope analyzer(*this); | 52 LayoutAnalyzer::Scope analyzer(*this); |
52 | 53 |
53 // Allow LayoutSVGViewportContainer to update its viewport. | 54 // Allow LayoutSVGViewportContainer to update its viewport. |
54 calcViewport(); | 55 calcViewport(); |
55 | 56 |
56 // Allow LayoutSVGTransformableContainer to update its transform. | 57 // Allow LayoutSVGTransformableContainer to update its transform. |
57 bool updatedTransform = calculateLocalTransform(); | 58 bool updatedTransform = calculateLocalTransform(); |
| 59 m_didTransformToRootUpdate = updatedTransform || SVGLayoutSupport::transform
ToRootChanged(parent()); |
58 | 60 |
59 // LayoutSVGViewportContainer needs to set the 'layout size changed' flag. | 61 // LayoutSVGViewportContainer needs to set the 'layout size changed' flag. |
60 determineIfLayoutSizeChanged(); | 62 determineIfLayoutSizeChanged(); |
61 | 63 |
62 bool transformChanged = SVGLayoutSupport::transformToRootChanged(this); | |
63 | |
64 // When hasRelativeLengths() is false, no descendants have relative lengths | 64 // When hasRelativeLengths() is false, no descendants have relative lengths |
65 // (hence no one is interested in viewport size changes). | 65 // (hence no one is interested in viewport size changes). |
66 bool layoutSizeChanged = element()->hasRelativeLengths() | 66 bool layoutSizeChanged = element()->hasRelativeLengths() |
67 && SVGLayoutSupport::layoutSizeOfNearestViewportChanged(this); | 67 && SVGLayoutSupport::layoutSizeOfNearestViewportChanged(this); |
68 | 68 |
69 // If any of this container's children need to be laid out, and a filter is | 69 // If any of this container's children need to be laid out, and a filter is |
70 // applied to the container, we need to issue paint invalidations for all | 70 // applied to the container, we need to issue paint invalidations for all |
71 // the descendants. | 71 // the descendants. |
72 bool forceLayoutOfChildren = selfNeedsLayout() | 72 bool forceLayoutOfChildren = selfNeedsLayout() |
73 || (normalChildNeedsLayout() && SVGLayoutSupport::hasFilterResource(*thi
s)); | 73 || (normalChildNeedsLayout() && SVGLayoutSupport::hasFilterResource(*thi
s)); |
74 SVGLayoutSupport::layoutChildren(firstChild(), forceLayoutOfChildren, transf
ormChanged, layoutSizeChanged); | 74 SVGLayoutSupport::layoutChildren(firstChild(), forceLayoutOfChildren, m_didT
ransformToRootUpdate, layoutSizeChanged); |
75 | 75 |
76 // Invalidate all resources of this client if our layout changed. | 76 // Invalidate all resources of this client if our layout changed. |
77 if (everHadLayout() && needsLayout()) | 77 if (everHadLayout() && needsLayout()) |
78 SVGResourcesCache::clientLayoutChanged(this); | 78 SVGResourcesCache::clientLayoutChanged(this); |
79 | 79 |
80 if (m_needsBoundariesUpdate || updatedTransform) { | 80 if (m_needsBoundariesUpdate || updatedTransform) { |
81 updateCachedBoundaries(); | 81 updateCachedBoundaries(); |
82 m_needsBoundariesUpdate = false; | 82 m_needsBoundariesUpdate = false; |
83 | 83 |
84 // If our bounds changed, notify the parents. | 84 // If our bounds changed, notify the parents. |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 updateHitTestResult(result, localLayoutPoint); | 198 updateHitTestResult(result, localLayoutPoint); |
199 if (result.addNodeToListBasedTestResult(element(), localLayoutPoint)
== StopHitTesting) | 199 if (result.addNodeToListBasedTestResult(element(), localLayoutPoint)
== StopHitTesting) |
200 return true; | 200 return true; |
201 } | 201 } |
202 } | 202 } |
203 // 16.4: "If there are no graphics elements whose relevant graphics content
is under the pointer (i.e., there is no target element), the event is not dispat
ched." | 203 // 16.4: "If there are no graphics elements whose relevant graphics content
is under the pointer (i.e., there is no target element), the event is not dispat
ched." |
204 return false; | 204 return false; |
205 } | 205 } |
206 | 206 |
207 } // namespace blink | 207 } // namespace blink |
OLD | NEW |