[Cherry-pick] Positioned children of an overflow:visible container should ignore...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 Jan 2013 22:44:02 +0000 (22:44 +0000)
committerGerrit Code Review <gerrit2@kim11>
Fri, 5 Apr 2013 05:37:10 +0000 (14:37 +0900)
[Title] [Cherry-pick] Positioned children of an overflow:visible container should ignore scroll offset when updating layer position
[Issue] N_SE-31159
[Problem] display Delicious/Join page clipped.
[Cause] renderLayer which has relative property is placed in wrong position.
[Solution] Cherry-pick the opensource patch.

[Cherry-pick] Positioned children of an overflow:visible container should ignore scroll offset when updating layer position
https://bugs.webkit.org/show_bug.cgi?id=106814

Source/WebCore:

Patch by Tien-Ren Chen <trchen@chromium.org> on 2013-01-14
Reviewed by Simon Fraser.

This patch fixes a bug in RenderLayer::updateLayerPosition that
scrollLeft / scrollTop of a block should only be effective when the
block has overflow clipping. The bug results in rendering artifacts
and triggers a RenderGeometryMap assertion falure.

Fixes http://crbug.com/167985

Test: fast/overflow/overflow-visible-should-ignore-scroll.html

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updateLayerPosition):

LayoutTests:

This patch fixes a bug in RenderLayer::updateLayerPosition that
scrollLeft / scrollTop of a block should only be effective when the
block has overflow clipping. The bug results in rendering artifacts
and triggers a RenderGeometryMap assertion falure.

Fixes http://crbug.com/167985

Patch by Tien-Ren Chen <trchen@chromium.org> on 2013-01-14
Reviewed by Simon Fraser.

* fast/overflow/overflow-visible-should-ignore-scroll-expected.html: Added.
* fast/overflow/overflow-visible-should-ignore-scroll.html: Added.

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

LayoutTests/fast/overflow/overflow-visible-should-ignore-scroll-expected.html [new file with mode: 0644]
LayoutTests/fast/overflow/overflow-visible-should-ignore-scroll.html [new file with mode: 0644]
Source/WebCore/rendering/RenderLayer.cpp

diff --git a/LayoutTests/fast/overflow/overflow-visible-should-ignore-scroll-expected.html b/LayoutTests/fast/overflow/overflow-visible-should-ignore-scroll-expected.html
new file mode 100644 (file)
index 0000000..31056ef
--- /dev/null
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+<body>
+<span style="position:absolute;">Absolute</span><span style="position:relative;left:100px;">Relative</span><br/>
+This test is successful if both words in the above line are displayed properly.
+</body>
+</html>
diff --git a/LayoutTests/fast/overflow/overflow-visible-should-ignore-scroll.html b/LayoutTests/fast/overflow/overflow-visible-should-ignore-scroll.html
new file mode 100644 (file)
index 0000000..7c49342
--- /dev/null
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style type="text/css">
+#outerbox {
+    height:0;
+    position:absolute;
+    overflow:hidden;
+}
+</style>
+<script type="text/javascript">
+function test () {
+    document.getElementById('outerbox').scrollTop=1000;
+    document.getElementById('outerbox').style.overflow='visible';    
+}
+</script>
+</head>
+<body onload="test();">
+<div id="outerbox">
+<span style="position:absolute;">Absolute</span><span style="position:relative;left:100px;">Relative</span><br/>
+This test is successful if both words in the above line are displayed properly.
+</div>
+</body>
+</html>
index b21d8d3..e949980 100755 (executable)
@@ -845,8 +845,10 @@ void RenderLayer::updateLayerPosition()
         RenderLayer* positionedParent = enclosingPositionedAncestor();
 
         // For positioned layers, we subtract out the enclosing positioned layer's scroll offset.
-        LayoutSize offset = positionedParent->scrolledContentOffset();
-        localPoint -= offset;
+        if (positionedParent->renderer()->hasOverflowClip()) {
+            LayoutSize offset = positionedParent->scrolledContentOffset();
+            localPoint -= offset;
+        }
         
         if (renderer()->isOutOfFlowPositioned() && positionedParent->renderer()->isRelPositioned() && positionedParent->renderer()->isRenderInline()) {
             LayoutSize offset = toRenderInline(positionedParent->renderer())->relativePositionedInlineOffset(toRenderBox(renderer()));
@@ -865,8 +867,10 @@ void RenderLayer::updateLayerPosition()
             localPoint += columnOffset;
         }
 
-        IntSize scrollOffset = parent()->scrolledContentOffset();
-        localPoint -= scrollOffset;
+        if (parent()->renderer()->hasOverflowClip()) {
+            IntSize scrollOffset = parent()->scrolledContentOffset();
+            localPoint -= scrollOffset;
+        }
     }
         
     if (renderer()->isRelPositioned()) {