[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
--- /dev/null
+<!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>
--- /dev/null
+<!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>
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()));
localPoint += columnOffset;
}
- IntSize scrollOffset = parent()->scrolledContentOffset();
- localPoint -= scrollOffset;
+ if (parent()->renderer()->hasOverflowClip()) {
+ IntSize scrollOffset = parent()->scrolledContentOffset();
+ localPoint -= scrollOffset;
+ }
}
if (renderer()->isRelPositioned()) {