Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Unified Diff: third_party/WebKit/LayoutTests/fast/css/sticky/sticky-position-valid-after-layout.html

Issue 2647533002: Force compositing inputs to be clean for getBoundingClientRect (Closed)
Patch Set: Partial response to reviewer comments, uploading for feedback Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/css/sticky/sticky-position-valid-after-layout.html
diff --git a/third_party/WebKit/LayoutTests/fast/css/sticky/sticky-position-valid-after-layout.html b/third_party/WebKit/LayoutTests/fast/css/sticky/sticky-position-valid-after-layout.html
new file mode 100644
index 0000000000000000000000000000000000000000..bac326d0c744ea38636f789013ba93338e7dd9df
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/css/sticky/sticky-position-valid-after-layout.html
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<style>
+body {
+ margin: 0;
+}
+
+#scroller {
+ height: 100px;
+ width: 200px;
+ overflow: scroll;
+}
+
+.padding {
+ width: 400px;
+ height: 500px;
+}
+
+#sticky {
+ width: 25px;
+ height: 25px;
+ position: sticky;
+ top: 20px;
+ left: 50px;
+}
+</style>
+
+<div id="scroller">
+ <div id="sticky"></div>
+ <div class="padding"></div>
+</div>
+
+<script>
+if (window.internals) {
+ internals.settings.setCSSStickyPositionEnabled(true);
+}
+
+test(function() {
+ var scroller = document.getElementById('scroller');
+ var sticky = document.getElementById('sticky');
+ scroller.scrollTop = 100;
+ scroller.scrollLeft = 50;
+ scroller.append(document.createElement('div'));
+ assert_equals(sticky.getBoundingClientRect().top, 20);
+ assert_equals(sticky.getBoundingClientRect().left, 50);
+}, "getBoundingClientRect should be correct for sticky after script-caused layout");
+
+test(function() {
+ var scroller = document.getElementById('scroller');
+ var sticky = document.getElementById('sticky');
+ scroller.scrollTop = 100;
+ scroller.scrollLeft = 50;
+ scroller.append(document.createElement('div'));
+ assert_equals(sticky.offsetTop, 120);
+ assert_equals(sticky.offsetLeft, 100);
+}, "offsetTop/offsetLeft should be correct for sticky after script-caused layout");
+</script>

Powered by Google App Engine
This is Rietveld 408576698