Title: [126812] trunk
- Revision
- 126812
- Author
- [email protected]
- Date
- 2012-08-27 15:58:52 -0700 (Mon, 27 Aug 2012)
Log Message
If both left and right (or top and bottom) are specified for sticky, use left (or top)
https://bugs.webkit.org/show_bug.cgi?id=95146
Reviewed by Dan Bernstein.
Source/WebCore:
Remove the incorrect FIXME comment, and swap the left and right,
and top and bottom constraints so that left and top win out,
as they do for position:relative.
Test: fast/css/sticky/sticky-both-sides.html
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::stickyPositionOffset):
LayoutTests:
Ref tests for stickies with left and right, or top and bottom specified.
* fast/css/sticky/sticky-both-sides-expected.html: Added.
* fast/css/sticky/sticky-both-sides.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (126811 => 126812)
--- trunk/LayoutTests/ChangeLog 2012-08-27 22:45:38 UTC (rev 126811)
+++ trunk/LayoutTests/ChangeLog 2012-08-27 22:58:52 UTC (rev 126812)
@@ -1,3 +1,15 @@
+2012-08-27 Simon Fraser <[email protected]>
+
+ If both left and right (or top and bottom) are specified for sticky, use left (or top)
+ https://bugs.webkit.org/show_bug.cgi?id=95146
+
+ Reviewed by Dan Bernstein.
+
+ Ref tests for stickies with left and right, or top and bottom specified.
+
+ * fast/css/sticky/sticky-both-sides-expected.html: Added.
+ * fast/css/sticky/sticky-both-sides.html: Added.
+
2012-08-24 James Robinson <[email protected]>
WebGL should not flip textures on presentation if contents are unchanged
Added: trunk/LayoutTests/fast/css/sticky/sticky-both-sides-expected.html (0 => 126812)
--- trunk/LayoutTests/fast/css/sticky/sticky-both-sides-expected.html (rev 0)
+++ trunk/LayoutTests/fast/css/sticky/sticky-both-sides-expected.html 2012-08-27 22:58:52 UTC (rev 126812)
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<style>
+ body {
+ margin: 0;
+ overflow: hidden; /* hide scrollbars */
+ }
+
+ .container {
+ position: absolute;
+ width: 2000px;
+ height: 180px;
+ top: 50px;
+ outline: 2px solid black;
+ }
+
+ .vertical.container {
+ top: 0px;
+ left: 50px;
+ width: 180px;
+ height: 2000px;
+ }
+
+ .box {
+ width: 800px;
+ height: 180px;
+ }
+
+ .vertical .box {
+ width: 180px;
+ height: 500px;
+ }
+
+ .sticky {
+ position: relative;
+ left: 50px;
+ right: 50px;
+ background-color: green;
+ }
+
+ .vertical .sticky {
+ left: 0;
+ top: 50px;
+ bottom: 50px;
+ background-color: blue;
+ opacity: 0.75;
+ }
+</style>
+</head>
+<body>
+ <div class="container">
+ <div class="sticky box"></div>
+ </div>
+ <div class="vertical container">
+ <div class="sticky box"></div>
+ </div>
+
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/css/sticky/sticky-both-sides-expected.html
___________________________________________________________________
Added: svn:mime-type
Added: svn:keywords
Added: svn:eol-style
Added: trunk/LayoutTests/fast/css/sticky/sticky-both-sides.html (0 => 126812)
--- trunk/LayoutTests/fast/css/sticky/sticky-both-sides.html (rev 0)
+++ trunk/LayoutTests/fast/css/sticky/sticky-both-sides.html 2012-08-27 22:58:52 UTC (rev 126812)
@@ -0,0 +1,69 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<style>
+ body {
+ margin: 0;
+ width: 2000px;
+ overflow: hidden; /* hide scrollbars */
+ }
+
+ .container {
+ position: absolute;
+ width: 2000px;
+ height: 180px;
+ top: 350px;
+ outline: 2px solid black;
+ }
+
+ .vertical.container {
+ top: 0px;
+ left: 350px;
+ width: 180px;
+ height: 2000px;
+ }
+
+ .box {
+ width: 800px;
+ height: 180px;
+ }
+
+ .vertical .box {
+ width: 180px;
+ height: 500px;
+ }
+
+ .sticky {
+ position: -webkit-sticky;
+ left: 50px;
+ right: 50px;
+ background-color: green;
+ }
+
+ .vertical .sticky {
+ left: 0;
+ top: 50px;
+ bottom: 50px;
+ background-color: blue;
+ opacity: 0.75;
+ }
+</style>
+<script>
+ function doTest()
+ {
+ window.scrollTo(300, 300);
+ }
+ window.addEventListener('load', doTest, false);
+</script>
+</head>
+<body>
+ <div class="container">
+ <div class="sticky box"></div>
+ </div>
+ <div class="vertical container">
+ <div class="sticky box"></div>
+ </div>
+
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/css/sticky/sticky-both-sides.html
___________________________________________________________________
Added: svn:mime-type
Added: svn:keywords
Added: svn:eol-style
Modified: trunk/Source/WebCore/ChangeLog (126811 => 126812)
--- trunk/Source/WebCore/ChangeLog 2012-08-27 22:45:38 UTC (rev 126811)
+++ trunk/Source/WebCore/ChangeLog 2012-08-27 22:58:52 UTC (rev 126812)
@@ -1,3 +1,19 @@
+2012-08-27 Simon Fraser <[email protected]>
+
+ If both left and right (or top and bottom) are specified for sticky, use left (or top)
+ https://bugs.webkit.org/show_bug.cgi?id=95146
+
+ Reviewed by Dan Bernstein.
+
+ Remove the incorrect FIXME comment, and swap the left and right,
+ and top and bottom constraints so that left and top win out,
+ as they do for position:relative.
+
+ Test: fast/css/sticky/sticky-both-sides.html
+
+ * rendering/RenderBoxModelObject.cpp:
+ (WebCore::RenderBoxModelObject::stickyPositionOffset):
+
2012-08-27 Adam Barth <[email protected]>
[V8] Improve the names of some private functions of V8DOMWindowShell.cpp
Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (126811 => 126812)
--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2012-08-27 22:45:38 UTC (rev 126811)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2012-08-27 22:58:52 UTC (rev 126812)
@@ -583,16 +583,6 @@
FloatPoint originalLocation = absoluteStickyBoxRect.location();
// Horizontal position.
- // FIXME: if left and right are specified, allow right to override left.
- if (!style()->left().isAuto()) {
- LayoutUnit leftLimit = viewportRect.x() + valueForLength(style()->left(), viewportRect.width(), view());
- if (absoluteStickyBoxRect.x() < leftLimit)
- absoluteStickyBoxRect.setX(leftLimit);
-
- if (absoluteStickyBoxRect.maxX() > absContainerContentRect.maxX())
- absoluteStickyBoxRect.setX(absContainerContentRect.maxX() - absoluteStickyBoxRect.width());
- }
-
if (!style()->right().isAuto()) {
LayoutUnit rightLimit = viewportRect.maxX() - valueForLength(style()->right(), viewportRect.width(), view());
if (absoluteStickyBoxRect.maxX() > rightLimit)
@@ -602,17 +592,16 @@
absoluteStickyBoxRect.setX(absContainerContentRect.x());
}
- // Vertical position.
- // FIXME: if top and bottom are specified, allow bottom to override top.
- if (!style()->top().isAuto()) {
- LayoutUnit topLimit = viewportRect.y() + valueForLength(style()->top(), viewportRect.height(), view());
- if (absoluteStickyBoxRect.y() < topLimit)
- absoluteStickyBoxRect.setY(topLimit);
+ if (!style()->left().isAuto()) {
+ LayoutUnit leftLimit = viewportRect.x() + valueForLength(style()->left(), viewportRect.width(), view());
+ if (absoluteStickyBoxRect.x() < leftLimit)
+ absoluteStickyBoxRect.setX(leftLimit);
- if (absoluteStickyBoxRect.maxY() > absContainerContentRect.maxY())
- absoluteStickyBoxRect.setY(absContainerContentRect.maxY() - absoluteStickyBoxRect.height());
+ if (absoluteStickyBoxRect.maxX() > absContainerContentRect.maxX())
+ absoluteStickyBoxRect.setX(absContainerContentRect.maxX() - absoluteStickyBoxRect.width());
}
-
+
+ // Vertical position.
if (!style()->bottom().isAuto()) {
LayoutUnit bottomLimit = viewportRect.maxY() - valueForLength(style()->bottom(), viewportRect.height(), view());
if (absoluteStickyBoxRect.maxY() > bottomLimit)
@@ -622,6 +611,15 @@
absoluteStickyBoxRect.setY(absContainerContentRect.y());
}
+ if (!style()->top().isAuto()) {
+ LayoutUnit topLimit = viewportRect.y() + valueForLength(style()->top(), viewportRect.height(), view());
+ if (absoluteStickyBoxRect.y() < topLimit)
+ absoluteStickyBoxRect.setY(topLimit);
+
+ if (absoluteStickyBoxRect.maxY() > absContainerContentRect.maxY())
+ absoluteStickyBoxRect.setY(absContainerContentRect.maxY() - absoluteStickyBoxRect.height());
+ }
+
// The sticky offset is physical, so we can just return the delta computed in absolute coords (though it may be wrong with transforms).
return roundedLayoutSize(absoluteStickyBoxRect.location() - originalLocation);
}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes