Commit 0eea23cd authored by Rune Lillesveen's avatar Rune Lillesveen Committed by Commit Bot

Make sure style is up-to-date for scrollbar pseudo style.

EnsureStyleResolver used to do this partially, which made us not crash
before [1] landed.

[1] https://crrev.com/0e37e8a49d3cfb0f81fa8a9e8ec147c50914e926

Bug: 1109639, 1104634
Change-Id: Ia4d8246b954251d0d3e566cf29081dd8157a5fcf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2336081Reviewed-by: default avatarXiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#794693}
parent 260706dc
...@@ -130,11 +130,18 @@ void CustomScrollbar::SetPressedPart(ScrollbarPart part, ...@@ -130,11 +130,18 @@ void CustomScrollbar::SetPressedPart(ScrollbarPart part,
scoped_refptr<const ComputedStyle> scoped_refptr<const ComputedStyle>
CustomScrollbar::GetScrollbarPseudoElementStyle(ScrollbarPart part_type, CustomScrollbar::GetScrollbarPseudoElementStyle(ScrollbarPart part_type,
PseudoId pseudo_id) { PseudoId pseudo_id) {
if (!StyleSource()->GetLayoutObject()) Element* element = StyleSource();
DCHECK(element);
Document& document = element->GetDocument();
// This method may be called as part of style recalc. Don't re-enter into
// updating style for those cases.
if (!document.InStyleRecalc())
document.UpdateStyleAndLayoutTreeForNode(element);
if (!element->GetLayoutObject())
return nullptr; return nullptr;
const ComputedStyle* source_style = StyleSource()->GetLayoutObject()->Style(); const ComputedStyle* source_style = element->GetLayoutObject()->Style();
scoped_refptr<const ComputedStyle> part_style = scoped_refptr<const ComputedStyle> part_style =
StyleSource()->StyleForPseudoElement( element->StyleForPseudoElement(
PseudoElementStyleRequest(pseudo_id, this, part_type), source_style); PseudoElementStyleRequest(pseudo_id, this, part_type), source_style);
if (!part_style) if (!part_style)
return nullptr; return nullptr;
......
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