- Revision
- 137393
- Author
- [email protected]
- Date
- 2012-12-11 17:15:00 -0800 (Tue, 11 Dec 2012)
Log Message
-webkit-svg-shadow radius changes don't cause children's boundaries to be recomputed
https://bugs.webkit.org/show_bug.cgi?id=104722
<rdar://problem/12821080>
Reviewed by Simon Fraser.
Changes to -webkit-svg-shadow currently cause a relayout of the directly affected renderer
and its parents, but not its children. However, children have the shadow radius
baked into their cached boundaries, so these need to be invalidated.
Test: svg/repaint/repaint-webkit-svg-shadow-container.html
* rendering/RenderObject.h: Expose needsBoundariesUpdate().
* rendering/svg/RenderSVGContainer.h: Expose needsBoundariesUpdate().
* rendering/svg/RenderSVGImage.h: Expose needsBoundariesUpdate().
* rendering/svg/RenderSVGRoot.h: Expose needsBoundariesUpdate().
* rendering/svg/RenderSVGShape.h: Expose needsBoundariesUpdate().
* rendering/svg/SVGRenderSupport.cpp:
(WebCore::SVGRenderSupport::layoutChildren): If the renderer has a shadow and
is in need of a boundaries update, mark children as needing boundaries updates too.
Add a text repaint test that ensures that a child (a path, in this case)
recomputes its bounds after its parent's shadow is expanded.
* svg/repaint/repaint-webkit-svg-shadow-container-expected.txt: Added.
* svg/repaint/repaint-webkit-svg-shadow-container.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (137392 => 137393)
--- trunk/LayoutTests/ChangeLog 2012-12-12 01:08:32 UTC (rev 137392)
+++ trunk/LayoutTests/ChangeLog 2012-12-12 01:15:00 UTC (rev 137393)
@@ -1,3 +1,17 @@
+2012-12-11 Tim Horton <[email protected]>
+
+ -webkit-svg-shadow radius changes don't cause children's boundaries to be recomputed
+ https://bugs.webkit.org/show_bug.cgi?id=104722
+ <rdar://problem/12821080>
+
+ Reviewed by Simon Fraser.
+
+ Add a text repaint test that ensures that a child (a path, in this case)
+ recomputes its bounds after its parent's shadow is expanded.
+
+ * svg/repaint/repaint-webkit-svg-shadow-container-expected.txt: Added.
+ * svg/repaint/repaint-webkit-svg-shadow-container.html: Added.
+
2012-12-11 Anders Carlsson <[email protected]>
ASSERT running platform/mac/plugins/convert-point.html on the WK2 bots
Added: trunk/LayoutTests/svg/repaint/repaint-webkit-svg-shadow-container-expected.txt (0 => 137393)
--- trunk/LayoutTests/svg/repaint/repaint-webkit-svg-shadow-container-expected.txt (rev 0)
+++ trunk/LayoutTests/svg/repaint/repaint-webkit-svg-shadow-container-expected.txt 2012-12-12 01:15:00 UTC (rev 137393)
@@ -0,0 +1,6 @@
+ (repaint rects
+ (rect 8 8 300 300)
+ (rect 8 8 510 510)
+ (rect 8 8 600 600)
+)
+
Added: trunk/LayoutTests/svg/repaint/repaint-webkit-svg-shadow-container.html (0 => 137393)
--- trunk/LayoutTests/svg/repaint/repaint-webkit-svg-shadow-container.html (rev 0)
+++ trunk/LayoutTests/svg/repaint/repaint-webkit-svg-shadow-container.html 2012-12-12 01:15:00 UTC (rev 137393)
@@ -0,0 +1,18 @@
+<html>
+ <head>
+ <title>Test passes if shadow is not clipped after the shadow change.</title>
+ <script src=""
+ <script>
+ function repaintTest() {
+ document.getElementById("g").setAttribute("style", "-webkit-svg-shadow: 50px 50px 100px black;")
+ }
+ </script>
+ </head>
+ <body _onload_="runRepaintTest()">
+ <svg xmlns="http://www.w3.org/2000/svg">
+ <g id="g" style="-webkit-svg-shadow: 50px 50px 10px black;">
+ <rect width="100" height="100" x="50" y="50" fill="black" />
+ </g>
+ </svg>
+ </body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (137392 => 137393)
--- trunk/Source/WebCore/ChangeLog 2012-12-12 01:08:32 UTC (rev 137392)
+++ trunk/Source/WebCore/ChangeLog 2012-12-12 01:15:00 UTC (rev 137393)
@@ -1,3 +1,26 @@
+2012-12-11 Tim Horton <[email protected]>
+
+ -webkit-svg-shadow radius changes don't cause children's boundaries to be recomputed
+ https://bugs.webkit.org/show_bug.cgi?id=104722
+ <rdar://problem/12821080>
+
+ Reviewed by Simon Fraser.
+
+ Changes to -webkit-svg-shadow currently cause a relayout of the directly affected renderer
+ and its parents, but not its children. However, children have the shadow radius
+ baked into their cached boundaries, so these need to be invalidated.
+
+ Test: svg/repaint/repaint-webkit-svg-shadow-container.html
+
+ * rendering/RenderObject.h: Expose needsBoundariesUpdate().
+ * rendering/svg/RenderSVGContainer.h: Expose needsBoundariesUpdate().
+ * rendering/svg/RenderSVGImage.h: Expose needsBoundariesUpdate().
+ * rendering/svg/RenderSVGRoot.h: Expose needsBoundariesUpdate().
+ * rendering/svg/RenderSVGShape.h: Expose needsBoundariesUpdate().
+ * rendering/svg/SVGRenderSupport.cpp:
+ (WebCore::SVGRenderSupport::layoutChildren): If the renderer has a shadow and
+ is in needs of a boundaries update, mark children as needing boundaries updates too.
+
2012-12-11 Xianzhu Wang <[email protected]>
Add window.internals.mainThreadScrollReasonsAsText for testing slow scrolling
Modified: trunk/Source/WebCore/rendering/RenderObject.h (137392 => 137393)
--- trunk/Source/WebCore/rendering/RenderObject.h 2012-12-12 01:08:32 UTC (rev 137392)
+++ trunk/Source/WebCore/rendering/RenderObject.h 2012-12-12 01:15:00 UTC (rev 137393)
@@ -490,6 +490,7 @@
// to inherit from RenderSVGObject -> RenderObject (some need RenderBlock inheritance for instance)
virtual void setNeedsTransformUpdate() { }
virtual void setNeedsBoundariesUpdate();
+ virtual bool needsBoundariesUpdate() { return false; }
// Per SVG 1.1 objectBoundingBox ignores clipping, masking, filter effects, opacity and stroke-width.
// This is used for all computation of objectBoundingBox relative units and by SVGLocatable::getBBox().
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGContainer.h (137392 => 137393)
--- trunk/Source/WebCore/rendering/svg/RenderSVGContainer.h 2012-12-12 01:08:32 UTC (rev 137392)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGContainer.h 2012-12-12 01:15:00 UTC (rev 137393)
@@ -44,6 +44,7 @@
virtual void paint(PaintInfo&, const LayoutPoint&);
virtual void setNeedsBoundariesUpdate() { m_needsBoundariesUpdate = true; }
+ virtual bool needsBoundariesUpdate() OVERRIDE { return m_needsBoundariesUpdate; }
virtual bool didTransformToRootUpdate() { return false; }
bool isObjectBoundingBoxValid() const { return m_objectBoundingBoxValid; }
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGImage.h (137392 => 137393)
--- trunk/Source/WebCore/rendering/svg/RenderSVGImage.h 2012-12-12 01:08:32 UTC (rev 137392)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGImage.h 2012-12-12 01:15:00 UTC (rev 137393)
@@ -43,6 +43,7 @@
bool updateImageViewport();
virtual void setNeedsBoundariesUpdate() { m_needsBoundariesUpdate = true; }
+ virtual bool needsBoundariesUpdate() OVERRIDE { return m_needsBoundariesUpdate; }
virtual void setNeedsTransformUpdate() { m_needsTransformUpdate = true; }
RenderImageResource* imageResource() { return m_imageResource.get(); }
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGRoot.h (137392 => 137393)
--- trunk/Source/WebCore/rendering/svg/RenderSVGRoot.h 2012-12-12 01:08:32 UTC (rev 137392)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGRoot.h 2012-12-12 01:15:00 UTC (rev 137393)
@@ -52,6 +52,7 @@
bool isLayoutSizeChanged() const { return m_isLayoutSizeChanged; }
virtual void setNeedsBoundariesUpdate() { m_needsBoundariesOrTransformUpdate = true; }
+ virtual bool needsBoundariesUpdate() OVERRIDE { return m_needsBoundariesOrTransformUpdate; }
virtual void setNeedsTransformUpdate() { m_needsBoundariesOrTransformUpdate = true; }
IntSize containerSize() const { return m_containerSize; }
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGShape.h (137392 => 137393)
--- trunk/Source/WebCore/rendering/svg/RenderSVGShape.h 2012-12-12 01:08:32 UTC (rev 137392)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGShape.h 2012-12-12 01:15:00 UTC (rev 137393)
@@ -72,6 +72,7 @@
void setNeedsShapeUpdate() { m_needsShapeUpdate = true; }
virtual void setNeedsBoundariesUpdate() { m_needsBoundariesUpdate = true; }
+ virtual bool needsBoundariesUpdate() OVERRIDE { return m_needsBoundariesUpdate; }
virtual void setNeedsTransformUpdate() { m_needsTransformUpdate = true; }
virtual void fillShape(GraphicsContext*) const;
virtual void strokeShape(GraphicsContext*) const;
Modified: trunk/Source/WebCore/rendering/svg/SVGRenderSupport.cpp (137392 => 137393)
--- trunk/Source/WebCore/rendering/svg/SVGRenderSupport.cpp 2012-12-12 01:08:32 UTC (rev 137392)
+++ trunk/Source/WebCore/rendering/svg/SVGRenderSupport.cpp 2012-12-12 01:15:00 UTC (rev 137393)
@@ -231,12 +231,21 @@
{
bool layoutSizeChanged = layoutSizeOfNearestViewportChanged(start);
bool transformChanged = transformToRootChanged(start);
+ bool hasSVGShadow = rendererHasSVGShadow(start);
+ bool needsBoundariesUpdate = start->needsBoundariesUpdate();
HashSet<RenderObject*> notlayoutedObjects;
for (RenderObject* child = start->firstChild(); child; child = child->nextSibling()) {
bool needsLayout = selfNeedsLayout;
bool childEverHadLayout = child->everHadLayout();
+ if (needsBoundariesUpdate && hasSVGShadow) {
+ // If we have a shadow, our shadow is baked into our children's cached boundaries,
+ // so they need to update.
+ child->setNeedsBoundariesUpdate();
+ needsLayout = true;
+ }
+
if (transformChanged) {
// If the transform changed we need to update the text metrics (note: this also happens for layoutSizeChanged=true).
if (child->isSVGText())