Clipping along compositing borders in svg-edit
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Dec 2015 06:27:08 +0000 (06:27 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Dec 2015 06:27:08 +0000 (06:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=151791

Reviewed by Zalan Bujtas.

Source/WebCore:

RenderSVGRoot::layout() failed to clear overflow before recomputing
visual overflow, which could cause it to get stuck with stale overflow.
This would cause underpainting if its size went from small to large.

Test: svg/overflow/visual-overflow-change.html

* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::layout):

LayoutTests:

Ref test that triggers recomputation of overflow.

* svg/overflow/visual-overflow-change-expected.html: Added.
* svg/overflow/visual-overflow-change.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@193613 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/svg/overflow/visual-overflow-change-expected.html [new file with mode: 0644]
LayoutTests/svg/overflow/visual-overflow-change.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/svg/RenderSVGRoot.cpp

index 24c31aa..c015035 100644 (file)
@@ -1,3 +1,15 @@
+2015-12-06  Simon Fraser  <simon.fraser@apple.com>
+
+        Clipping along compositing borders in svg-edit
+        https://bugs.webkit.org/show_bug.cgi?id=151791
+
+        Reviewed by Zalan Bujtas.
+        
+        Ref test that triggers recomputation of overflow.
+
+        * svg/overflow/visual-overflow-change-expected.html: Added.
+        * svg/overflow/visual-overflow-change.html: Added.
+
 2015-12-06  Andy VanWagoner  <thetalecrafter@gmail.com>
 
         [INTL] Implement String.prototype.toLocaleLowerCase in ECMA-402
diff --git a/LayoutTests/svg/overflow/visual-overflow-change-expected.html b/LayoutTests/svg/overflow/visual-overflow-change-expected.html
new file mode 100644 (file)
index 0000000..37f3942
--- /dev/null
@@ -0,0 +1,53 @@
+<!DOCTYPE HTML>
+<head>
+    <style>
+        body {
+            overflow: hidden;
+            margin: 0;
+        }
+
+        .svgcanvas {
+            position: relative;
+            width: 3800px;
+            height: 600px;
+            display: inline-block;
+            overflow: hidden;
+        }
+        
+        .indicator {
+            position: absolute;
+            top: 0;
+            left: 0;
+            width: 3800px; /* Trigger composited tiling */
+            height: 600px;
+            display: inline-block;
+            background-color: red;
+        }
+        
+        .composited {
+            -webkit-transform: translateZ(0);
+        }
+        
+        #svgroot {
+            position: absolute;
+            top: 0;
+            left: 0;
+            background-color: gray;
+        }
+        
+        svg {
+            border: 4px solid black;
+            box-sizing: border-box;
+        }
+    </style>
+</head>
+    <!-- You should see no red -->
+    <div class="indicator"></div>
+    <div class="composited svgcanvas">
+        <svg id="svgroot" width="1920" height="1400" overflow="visible">
+          <svg id="canvasBackground" x="540" y="480" width="640" height="480" overflow="none">
+            <rect width="100%" height="100%" fill="green"/>
+          </svg>
+        </svg>
+    </div>
+</div>
diff --git a/LayoutTests/svg/overflow/visual-overflow-change.html b/LayoutTests/svg/overflow/visual-overflow-change.html
new file mode 100644 (file)
index 0000000..9a12064
--- /dev/null
@@ -0,0 +1,75 @@
+<!DOCTYPE HTML>
+<head>
+    <style>
+        body {
+            overflow: hidden;
+            margin: 0;
+        }
+
+        .svgcanvas {
+            position: relative;
+            width: 3800px;
+            height: 600px;
+            display: inline-block;
+            overflow: hidden;
+        }
+        
+        .indicator {
+            position: absolute;
+            top: 0;
+            left: 0;
+            width: 3800px; /* Trigger composited tiling */
+            height: 600px;
+            display: inline-block;
+            background-color: red;
+        }
+        
+        .composited {
+            -webkit-transform: translateZ(0);
+        }
+        
+        #svgroot {
+            position: absolute;
+            top: 0;
+            left: 0;
+            background-color: gray;
+        }
+        
+        svg {
+            border: 4px solid black;
+            box-sizing: border-box;
+        }
+    </style>
+    <script>
+        if (window.testRunner)
+            testRunner.waitUntilDone();
+
+        function doTest()
+        {
+            window.setTimeout(function() {
+                var svg = document.getElementById('svgroot');
+                svg.setAttribute('x', 640);
+                svg.setAttribute('y', 480);
+                svg.setAttribute('width', 1920);
+                svg.setAttribute('height', 1400);
+                var background = document.getElementById('canvasBackground');
+                background.setAttribute('x', 540);
+                background.setAttribute('y', 480);
+
+                if (window.testRunner)
+                    testRunner.notifyDone();
+            }, 0);
+        }
+        window.addEventListener('load', doTest, false);
+    </script>
+</head>
+    <!-- You should see no red -->
+    <div class="indicator"></div>
+    <div class="composited svgcanvas">
+        <svg id="svgroot" width="640" height="480" overflow="visible">
+          <svg id="canvasBackground" width="640" height="480" overflow="none">
+            <rect width="100%" height="100%" fill="green"/>
+          </svg>
+        </svg>
+    </div>
+</div>
index f900bcf..69881b8 100644 (file)
@@ -1,5 +1,21 @@
 2015-12-06  Simon Fraser  <simon.fraser@apple.com>
 
+        Clipping along compositing borders in svg-edit
+        https://bugs.webkit.org/show_bug.cgi?id=151791
+
+        Reviewed by Zalan Bujtas.
+        
+        RenderSVGRoot::layout() failed to clear overflow before recomputing
+        visual overflow, which could cause it to get stuck with stale overflow.
+        This would cause underpainting if its size went from small to large.
+
+        Test: svg/overflow/visual-overflow-change.html
+
+        * rendering/svg/RenderSVGRoot.cpp:
+        (WebCore::RenderSVGRoot::layout):
+
+2015-12-06  Simon Fraser  <simon.fraser@apple.com>
+
         REGRESSION (r187121): Can't get to the main content of the page at https://theintercept.com/drone-papers/
         https://bugs.webkit.org/show_bug.cgi?id=151849
         rdar://problem/23132828
index e40d634..d5c3899 100644 (file)
@@ -196,6 +196,7 @@ void RenderSVGRoot::layout()
         m_needsBoundariesOrTransformUpdate = false;
     }
 
+    clearOverflow();
     if (!shouldApplyViewportClip()) {
         FloatRect contentRepaintRect = repaintRectInLocalCoordinates();
         contentRepaintRect = m_localToBorderBoxTransform.mapRect(contentRepaintRect);