Commit a0ae9ed7 authored by Nick Burris's avatar Nick Burris Committed by Commit Bot

Consider scroll-padding when determining scroll anchor node

Scroll anchoring should not anchor to a node that is behind scroll
padding.

Bug: 1010002
Change-Id: Icbd89fb85ea2c97a6de635930a9896f6a87b8f07
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1887745Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Commit-Queue: Nick Burris <nburris@chromium.org>
Cr-Commit-Position: refs/heads/master@{#711020}
parent c53f1f08
...@@ -292,6 +292,15 @@ ScrollAnchor::ExamineResult ScrollAnchor::Examine( ...@@ -292,6 +292,15 @@ ScrollAnchor::ExamineResult ScrollAnchor::Examine(
LayoutRect visible_rect = LayoutRect visible_rect =
ScrollerLayoutBox(scroller_)->OverflowClipRect(LayoutPoint()); ScrollerLayoutBox(scroller_)->OverflowClipRect(LayoutPoint());
const ComputedStyle* style = ScrollerLayoutBox(scroller_)->Style();
LayoutRectOutsets scroll_padding(
MinimumValueForLength(style->ScrollPaddingTop(), visible_rect.Height()),
MinimumValueForLength(style->ScrollPaddingRight(), visible_rect.Width()),
MinimumValueForLength(style->ScrollPaddingBottom(),
visible_rect.Height()),
MinimumValueForLength(style->ScrollPaddingLeft(), visible_rect.Width()));
visible_rect.Contract(scroll_padding);
bool occupies_space = bool occupies_space =
candidate_rect.Width() > 0 && candidate_rect.Height() > 0; candidate_rect.Width() > 0 && candidate_rect.Height() > 0;
if (occupies_space && visible_rect.Intersects(candidate_rect)) { if (occupies_space && visible_rect.Intersects(candidate_rect)) {
......
This is a testharness.js-based test.
FAIL scroll anchoring accounts for scroll-padding assert_equals: Shouldn't anchor to #changer, since it's covered by scroll-padding expected 150 but got 50
Harness: the test ran to completion.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment