Commit 86f6eefc authored by Rune Lillesveen's avatar Rune Lillesveen Committed by Commit Bot

[Squad] Make StyleForPseudoElement not rely on layout tree.

Traverse flat tree instead of layout tree for ancestor style. Required
to update pseudo elements as part of style recalc.

Bug: 836126
Change-Id: I509b89ad6907f7856022fb3b28151829b6317f49
Reviewed-on: https://chromium-review.googlesource.com/1109828
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Reviewed-by: default avatarAnders Ruud <andruud@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569316}
parent 55e24d64
...@@ -3963,15 +3963,14 @@ scoped_refptr<ComputedStyle> Element::StyleForPseudoElement( ...@@ -3963,15 +3963,14 @@ scoped_refptr<ComputedStyle> Element::StyleForPseudoElement(
DCHECK(!parent_style || !is_before_or_after); DCHECK(!parent_style || !is_before_or_after);
if (is_before_or_after) { if (is_before_or_after) {
LayoutObject* parent_layout_object = GetLayoutObject(); const ComputedStyle* layout_parent_style = style;
if (!parent_layout_object && HasDisplayContentsStyle()) { if (style->Display() == EDisplay::kContents) {
parent_layout_object = Node* layout_parent = LayoutTreeBuilderTraversal::LayoutParent(*this);
LayoutTreeBuilderTraversal::ParentLayoutObject(*this); DCHECK(layout_parent);
layout_parent_style = layout_parent->GetComputedStyle();
} }
if (!parent_layout_object)
return nullptr;
return GetDocument().EnsureStyleResolver().PseudoStyleForElement( return GetDocument().EnsureStyleResolver().PseudoStyleForElement(
this, request, style, parent_layout_object->Style()); this, request, style, layout_parent_style);
} }
if (!GetLayoutObject()) if (!GetLayoutObject())
......
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