Commit 15c11046 authored by Rune Lillesveen's avatar Rune Lillesveen Committed by Commit Bot

Propagate custom scrollbar style to viewport.

When custom scrollbar pseudo element style changed on the viewport
defining element (root or body), we did not propagate those styles
unless something else changed.

Bug: 999348, 972752
Change-Id: I52ed46a191d87034bee95bff4d823d92a28031a9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1774935
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Reviewed-by: default avatarMorten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#691965}
parent 298993ca
...@@ -2439,6 +2439,7 @@ void Document::PropagateStyleToViewport() { ...@@ -2439,6 +2439,7 @@ void Document::PropagateStyleToViewport() {
scoped_refptr<ComputedStyle> new_viewport_style = scoped_refptr<ComputedStyle> new_viewport_style =
ComputedStyle::Clone(viewport_style); ComputedStyle::Clone(viewport_style);
bool changed = false; bool changed = false;
bool update_scrollbar_style = false;
// Writing mode and direction // Writing mode and direction
{ {
...@@ -2581,6 +2582,9 @@ void Document::PropagateStyleToViewport() { ...@@ -2581,6 +2582,9 @@ void Document::PropagateStyleToViewport() {
static_cast<OverscrollBehaviorType>( static_cast<OverscrollBehaviorType>(
overflow_style->OverscrollBehaviorY()))); overflow_style->OverscrollBehaviorY())));
} }
if (overflow_style->HasPseudoStyle(kPseudoIdScrollbar))
update_scrollbar_style = true;
} }
PROPAGATE_VALUE(overflow_x, OverflowX, SetOverflowX) PROPAGATE_VALUE(overflow_x, OverflowX, SetOverflowX)
...@@ -2605,7 +2609,9 @@ void Document::PropagateStyleToViewport() { ...@@ -2605,7 +2609,9 @@ void Document::PropagateStyleToViewport() {
new_viewport_style->UpdateFontOrientation(); new_viewport_style->UpdateFontOrientation();
GetLayoutView()->SetStyle(new_viewport_style); GetLayoutView()->SetStyle(new_viewport_style);
SetupFontBuilder(*new_viewport_style); SetupFontBuilder(*new_viewport_style);
}
if (changed || update_scrollbar_style) {
if (PaintLayerScrollableArea* scrollable_area = if (PaintLayerScrollableArea* scrollable_area =
GetLayoutView()->GetScrollableArea()) { GetLayoutView()->GetScrollableArea()) {
if (scrollable_area->HorizontalScrollbar() && if (scrollable_area->HorizontalScrollbar() &&
......
<!doctype html>
<title>Changing width of scrollbar propagated from body to viewport</title>
<style>
body { overflow: scroll }
body::-webkit-scrollbar {
background: red;
width: 200px;
height: 200px;
}
.narrow::-webkit-scrollbar {
width: 0px;
height: 0px;
}
</style>
<body>
<script>
document.body.offsetTop;
document.body.className = "narrow";
</script>
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