Title: [164324] trunk
- Revision
- 164324
- Author
- commit-qu...@webkit.org
- Date
- 2014-02-18 14:57:40 -0800 (Tue, 18 Feb 2014)
Log Message
Bottom/right sticky positioning don't correctly handle scroll containers with padding
https://bugs.webkit.org/show_bug.cgi?id=119280
Patch by Viatcheslav Ostapenko <sl.ostape...@samsung.com> on 2014-02-18
Reviewed by Simon Fraser.
Source/WebCore:
Take padding into account during calculation of overflow constraining rect for sticky
positioning.
Test: fast/css/sticky/sticky-bottom-overflow-padding.html
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::stickyPositionOffset):
LayoutTests:
Check that sticky elements positioned correcly in overflow with padding.
* fast/css/sticky/sticky-bottom-overflow-padding-expected.html: Added.
* fast/css/sticky/sticky-bottom-overflow-padding.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (164323 => 164324)
--- trunk/LayoutTests/ChangeLog 2014-02-18 22:55:39 UTC (rev 164323)
+++ trunk/LayoutTests/ChangeLog 2014-02-18 22:57:40 UTC (rev 164324)
@@ -1,3 +1,15 @@
+2014-02-18 Viatcheslav Ostapenko <sl.ostape...@samsung.com>
+
+ Bottom/right sticky positioning don't correctly handle scroll containers with padding
+ https://bugs.webkit.org/show_bug.cgi?id=119280
+
+ Reviewed by Simon Fraser.
+
+ Check that sticky elements positioned correcly in overflow with padding.
+
+ * fast/css/sticky/sticky-bottom-overflow-padding-expected.html: Added.
+ * fast/css/sticky/sticky-bottom-overflow-padding.html: Added.
+
2014-02-17 Jon Honeycutt <jhoneyc...@apple.com>
Crash when merging ruby bases that contain floats
Added: trunk/LayoutTests/fast/css/sticky/sticky-bottom-overflow-padding-expected.html (0 => 164324)
--- trunk/LayoutTests/fast/css/sticky/sticky-bottom-overflow-padding-expected.html (rev 0)
+++ trunk/LayoutTests/fast/css/sticky/sticky-bottom-overflow-padding-expected.html 2014-02-18 22:57:40 UTC (rev 164324)
@@ -0,0 +1,86 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<style>
+ .group {
+ display: inline-block;
+ position: relative;
+ width: 150px;
+ height: 500px;
+ }
+
+ #overflow {
+ width: 600px;
+ height: 400px;
+ overflow: hidden; /* Still scrollable with JS */
+ padding: 20px;
+ border: 1px solid black;
+ }
+
+ .spacer {
+ float: left;
+ width: 10px;
+ height: 1200px;
+ }
+ .container {
+ width: 100px;
+ height: 300px;
+ outline: 2px solid black;
+ }
+
+ .box {
+ width: 100px;
+ height: 150px;
+ }
+
+ .sticky {
+ position: relative;
+ bottom: 0px;
+ background-color: green;
+ }
+
+ .indicator {
+ position: absolute;
+ top: 0;
+ left: 0;
+ background-color: red;
+ }
+</style>
+<script>
+ function doTest()
+ {
+ document.getElementById('overflow').scrollTop = 100;
+ }
+ window.addEventListener('load', doTest, false);
+</script>
+</head>
+<body>
+ <div id="overflow">
+ <div class="spacer"></div>
+ <div class="group" style="top: 350px">
+ <div class="indicator box" style="top: 0px;"></div>
+ <div class="container">
+ <div class="box"></div>
+ <div class="sticky box" style="bottom: 150px;"></div>
+ </div>
+ </div>
+
+ <div class="group" style="top: 250px">
+ <div class="indicator box" style="top: 100px;"></div>
+ <div class="container">
+ <div class="box"></div>
+ <div class="sticky box" style="bottom: 50px;"></div>
+ </div>
+ </div>
+
+ <div class="group" style="top: 200px">
+ <div class="indicator box" style="top: 150px;"></div>
+ <div class="container">
+ <div class="box"></div>
+ <div class="sticky box"></div>
+ </div>
+ </div>
+ </div>
+</body>
+</html>
Added: trunk/LayoutTests/fast/css/sticky/sticky-bottom-overflow-padding.html (0 => 164324)
--- trunk/LayoutTests/fast/css/sticky/sticky-bottom-overflow-padding.html (rev 0)
+++ trunk/LayoutTests/fast/css/sticky/sticky-bottom-overflow-padding.html 2014-02-18 22:57:40 UTC (rev 164324)
@@ -0,0 +1,86 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<style>
+ .group {
+ display: inline-block;
+ position: relative;
+ width: 150px;
+ height: 500px;
+ }
+
+ #overflow {
+ width: 600px;
+ height: 400px;
+ overflow: hidden; /* Still scrollable with JS */
+ padding: 20px;
+ border: 1px solid black;
+ }
+
+ .spacer {
+ float: left;
+ width: 10px;
+ height: 1200px;
+ }
+ .container {
+ width: 100px;
+ height: 300px;
+ outline: 2px solid black;
+ }
+
+ .box {
+ width: 100px;
+ height: 150px;
+ }
+
+ .sticky {
+ position: -webkit-sticky;
+ bottom: 0px;
+ background-color: green;
+ }
+
+ .indicator {
+ position: absolute;
+ top: 0;
+ left: 0;
+ background-color: red;
+ }
+</style>
+<script>
+ function doTest()
+ {
+ document.getElementById('overflow').scrollTop = 100;
+ }
+ window.addEventListener('load', doTest, false);
+</script>
+</head>
+<body>
+ <div id="overflow">
+ <div class="spacer"></div>
+ <div class="group" style="top: 350px">
+ <div class="indicator box" style="top: 0px;"></div>
+ <div class="container">
+ <div class="box"></div>
+ <div class="sticky box"></div>
+ </div>
+ </div>
+
+ <div class="group" style="top: 250px">
+ <div class="indicator box" style="top: 100px;"></div>
+ <div class="container">
+ <div class="box"></div>
+ <div class="sticky box"></div>
+ </div>
+ </div>
+
+ <div class="group" style="top: 200px">
+ <div class="indicator box" style="top: 150px;"></div>
+ <div class="container">
+ <div class="box"></div>
+ <div class="sticky box"></div>
+ </div>
+ </div>
+ </div>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (164323 => 164324)
--- trunk/Source/WebCore/ChangeLog 2014-02-18 22:55:39 UTC (rev 164323)
+++ trunk/Source/WebCore/ChangeLog 2014-02-18 22:57:40 UTC (rev 164324)
@@ -1,3 +1,18 @@
+2014-02-18 Viatcheslav Ostapenko <sl.ostape...@samsung.com>
+
+ Bottom/right sticky positioning don't correctly handle scroll containers with padding
+ https://bugs.webkit.org/show_bug.cgi?id=119280
+
+ Reviewed by Simon Fraser.
+
+ Take padding into account during calculation of overflow constraining rect for sticky
+ positioning.
+
+ Test: fast/css/sticky/sticky-bottom-overflow-padding.html
+
+ * rendering/RenderBoxModelObject.cpp:
+ (WebCore::RenderBoxModelObject::stickyPositionOffset):
+
2014-02-17 Jon Honeycutt <jhoneyc...@apple.com>
Crash when merging ruby bases that contain floats
Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (164323 => 164324)
--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2014-02-18 22:55:39 UTC (rev 164323)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2014-02-18 22:57:40 UTC (rev 164324)
@@ -423,6 +423,8 @@
if (enclosingClippingLayer) {
RenderBox& enclosingClippingBox = toRenderBox(enclosingClippingLayer->renderer());
LayoutRect clipRect = enclosingClippingBox.overflowClipRect(LayoutPoint(), 0); // FIXME: make this work in regions.
+ clipRect.contract(LayoutSize(enclosingClippingBox.paddingLeft() + enclosingClippingBox.paddingRight(),
+ enclosingClippingBox.paddingTop() + enclosingClippingBox.paddingBottom()));
constrainingRect = enclosingClippingBox.localToContainerQuad(FloatRect(clipRect), &view()).boundingBox();
FloatPoint scrollOffset = FloatPoint() + enclosingClippingLayer->scrollOffset();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes