Revision ec35b03ca5e8eec6eb1767a77f0aea13855515a3 authored by Rune Lillesveen on 29 June 2018, 22:17:37 UTC, committed by Blink WPT Bot on 29 June 2018, 22:26:52 UTC
We used to create these pseudo elements and their computed styles in Element::AttachLayoutTree when building the layout tree. Now we create or dispose these elements from style recalc, that is, UpdatePseudoElement. To make pseudo elements live through a style recalc with a layout tree re-attach we no longer clear the pseudo elements during DetachLayoutTree for performing_reattach=true. We do however need to clear the pseudo elements which do not get a layout object for the re-attach. That is done in AttachLayoutTree for the originating element when the originating element does not generate a layout box. We stop using the pseudo style cache on ComputedStyle for PseudoElements and instead return the ComputedStyle when creating the pseudo element and store it as non-attached style which can later be retrieved when attaching the layout object. An effect of this change is that we can detect transitions on pseudo elements when ancestors display types changes and causes re-attachment. That is issue 836140. ::first-letter may still be generated during layout tree building, and the ::first-letter layout structure may still be updated during style recalc. Bug: 836126, 836140 Change-Id: Iafad705b7a7b988d4c1598e8a126ce0d79c5873d Reviewed-on: https://chromium-review.googlesource.com/1112244 Commit-Queue: Rune Lillesveen <futhark@chromium.org> Reviewed-by: Chris Harrelson <chrishtr@chromium.org> Cr-Commit-Position: refs/heads/master@{#571665}
1 parent c360ca0
position-sticky-nested-right.html
<!DOCTYPE html>
<title>Nested right-constrained position:sticky elements should render correctly</title>
<link rel="help" href="https://www.w3.org/TR/css-position-3/#sticky-pos" />
<meta name="assert" content="This test checks that nested position:sticky elements with a right constraint render correctly" />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/sticky-util.js"></script>
<body></body>
<script>
test(() => {
const elements = setupNestedStickyTest('right', 25, 35);
elements.scroller.scrollLeft = 200;
const nonStickyLeftX = elements.container.offsetLeft +
elements.filler.clientWidth;
assert_equals(elements.sticky.offsetLeft, nonStickyLeftX);
// The inner sticky should not be offset from the outer.
const nonStickyInnerLeftX = elements.sticky.clientWidth -
elements.innerSticky.clientWidth;
assert_equals(elements.innerSticky.offsetLeft, nonStickyInnerLeftX);
}, 'before reaching the sticking point, neither sticky box should be offset');
test(() => {
const elements = setupNestedStickyTest('right', 25, 50);
elements.scroller.scrollLeft = 150;
const nonStickyLeftX = elements.container.offsetLeft +
elements.filler.clientWidth;
assert_equals(elements.sticky.offsetLeft, nonStickyLeftX);
assert_equals(elements.innerSticky.offsetLeft, 35);
}, 'the inner sticky can stick before the outer one if necessary');
test(() => {
const elements = setupNestedStickyTest('right', 25, 35);
elements.scroller.scrollLeft = 100;
const nonStickyLeftX = elements.container.offsetLeft +
elements.filler.clientWidth;
const nonStickyBottomX = nonStickyLeftX + elements.sticky.clientWidth;
const targetBottomX = elements.scroller.clientWidth +
elements.scroller.scrollLeft - 25;
const stickyOffset = nonStickyBottomX - targetBottomX;
assert_equals(elements.sticky.offsetLeft, nonStickyLeftX - stickyOffset);
// The inner sticky has similar math, but its offsetLeft is relative to the
// sticky element and in this test is (height - the difference between the
// top values).
assert_equals(elements.innerSticky.offsetLeft, 40);
}, 'both sticky boxes can be stuck at the same time');
test(() => {
const elements = setupNestedStickyTest('right', 25, 35);
elements.scroller.scrollLeft = 0;
assert_equals(elements.sticky.offsetLeft, elements.container.offsetLeft);
assert_equals(elements.innerSticky.offsetLeft, 0);
}, 'neither sticky can escape their containing block');
test(() => {
const elements = setupNestedStickyTest('right', 25, 500);
elements.scroller.scrollLeft = 200;
// It doesn't matter how big the inner sticky offset is, it cannot escape its
// containing block (the outer sticky).
assert_equals(elements.innerSticky.offsetLeft, 0);
}, 'the inner sticky cannot be pushed outside the outer sticky');
</script>
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...