Commit bd89a992 authored by Koji Ishii's avatar Koji Ishii Committed by Commit Bot

[LayoutNG] Fix scrollWidth/scrollLeft on RTL when box is narrow

When the scrollbar is on left and the box is narrower than
the scrollbar, the scrollbar overflows to left.
LayoutBox::AddLayoutOverflow() expects the overflow adjusted
by the amount the scrollbar overflows.

This affects a jQuery plugin that detects RTL scroll type[1].

[1] https://github.com/othree/jquery.rtl-scroll-type

Bug: 635619
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: I70e7b1ecc20857ff10687afd7d5e3b7d70afb2dc
Reviewed-on: https://chromium-review.googlesource.com/1215365Reviewed-by: default avatarEmil A Eklund <eae@chromium.org>
Reviewed-by: default avatarMorten Stenshorne <mstensho@chromium.org>
Reviewed-by: default avatarAleks Totic <atotic@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#590138}
parent 91a72415
......@@ -389,7 +389,6 @@ crbug.com/591099 fast/overflow/recompute-overflow-of-layout-root-container.html
crbug.com/591099 fast/reflections/opacity-reflection-transform.html [ Failure ]
crbug.com/591099 fast/replaced/table-replaced-element.html [ Failure ]
crbug.com/591099 fast/scrolling/content-box-smaller-than-scrollbar.html [ Failure ]
crbug.com/591099 fast/scrolling/jquery-rtl-scroll-type.html [ Failure ]
crbug.com/591099 fast/scrolling/scrollbar-tickmarks-hittest.html [ Failure Pass ]
crbug.com/591099 fast/sub-pixel/sub-pixel-border-2.html [ Failure ]
crbug.com/591099 fast/table/border-collapsing/004-vertical.html [ Failure ]
......
......@@ -139,6 +139,17 @@ void LayoutNGMixin<Base>::AddScrollingOverflowFromChildren() {
}
}
// If the scrollbar is on left, and the box is narrower than the scrollbar,
// the overflow is shifted to left by the amount the scrollbar overflows.
if (Base::ShouldPlaceVerticalScrollbarOnLeft()) {
LayoutUnit vertical_scrollbar_width =
LayoutUnit(Base::VerticalScrollbarWidth());
if (physical_fragment->Size().width < vertical_scrollbar_width) {
children_overflow.offset.left +=
physical_fragment->Size().width - vertical_scrollbar_width;
}
}
// LayoutOverflow takes flipped blocks coordinates, adjust as needed.
LayoutRect children_flipped_overflow = children_overflow.ToLayoutFlippedRect(
physical_fragment->Style(), physical_fragment->Size());
......
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