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, 2009 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2007, 2008, 2009 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. | 5 * Copyright (C) 2009 Google, Inc. |
6 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 updateLogicalHeight(); | 146 updateLogicalHeight(); |
147 | 147 |
148 buildLocalToBorderBoxTransform(); | 148 buildLocalToBorderBoxTransform(); |
149 // TODO(fs): Temporarily, needing a layout implies that the local transform | 149 // TODO(fs): Temporarily, needing a layout implies that the local transform |
150 // has changed. This should be updated to be more precise and factor in the | 150 // has changed. This should be updated to be more precise and factor in the |
151 // actual (relevant) changes to the computed user-space transform. | 151 // actual (relevant) changes to the computed user-space transform. |
152 m_didScreenScaleFactorChange = selfNeedsLayout(); | 152 m_didScreenScaleFactorChange = selfNeedsLayout(); |
153 | 153 |
154 SVGLayoutSupport::layoutResourcesIfNeeded(this); | 154 SVGLayoutSupport::layoutResourcesIfNeeded(this); |
155 | 155 |
| 156 // selfNeedsLayout() will cover changes to one (or more) of viewBox, |
| 157 // current{Scale,Translate} and decorations. |
| 158 const bool viewportMayHaveChanged = selfNeedsLayout() || oldSize != size(); |
| 159 |
| 160 // The scale of one or more of the SVG elements may have changed, or new |
| 161 // content may have been exposed, so mark the entire subtree as needing paint |
| 162 // invalidation checking. (It is only somewhat by coincidence that this |
| 163 // condition happens to be the same as the one for viewport changes.) |
| 164 if (viewportMayHaveChanged) |
| 165 setMayNeedPaintInvalidationSubtree(); |
| 166 |
156 SVGSVGElement* svg = toSVGSVGElement(node()); | 167 SVGSVGElement* svg = toSVGSVGElement(node()); |
157 ASSERT(svg); | 168 ASSERT(svg); |
158 // When hasRelativeLengths() is false, no descendants have relative lengths | 169 // When hasRelativeLengths() is false, no descendants have relative lengths |
159 // (hence no one is interested in viewport size changes). | 170 // (hence no one is interested in viewport size changes). |
160 m_isLayoutSizeChanged = | 171 m_isLayoutSizeChanged = viewportMayHaveChanged && svg->hasRelativeLengths(); |
161 svg->hasRelativeLengths() && (selfNeedsLayout() || oldSize != size()); | |
162 | |
163 // The scale of one or more of the SVG elements may have changed, so mark | |
164 // the entire subtree as needing paint invalidation checking. | |
165 if (m_isLayoutSizeChanged) | |
166 setMayNeedPaintInvalidationSubtree(); | |
167 | 172 |
168 SVGLayoutSupport::layoutChildren( | 173 SVGLayoutSupport::layoutChildren( |
169 firstChild(), false, m_didScreenScaleFactorChange, m_isLayoutSizeChanged); | 174 firstChild(), false, m_didScreenScaleFactorChange, m_isLayoutSizeChanged); |
170 | 175 |
171 if (m_needsBoundariesOrTransformUpdate) { | 176 if (m_needsBoundariesOrTransformUpdate) { |
172 updateCachedBoundaries(); | 177 updateCachedBoundaries(); |
173 m_needsBoundariesOrTransformUpdate = false; | 178 m_needsBoundariesOrTransformUpdate = false; |
174 } | 179 } |
175 | 180 |
176 m_overflow.reset(); | 181 m_overflow.reset(); |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 if (result.addNodeToListBasedTestResult(node(), locationInContainer, | 472 if (result.addNodeToListBasedTestResult(node(), locationInContainer, |
468 boundsRect) == StopHitTesting) | 473 boundsRect) == StopHitTesting) |
469 return true; | 474 return true; |
470 } | 475 } |
471 } | 476 } |
472 | 477 |
473 return false; | 478 return false; |
474 } | 479 } |
475 | 480 |
476 } // namespace blink | 481 } // namespace blink |
OLD | NEW |