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

[Squad] Allow CustomStyleForLayoutObject() in reattach recalc.

We did not allow recalculating style for reattachment as part of
RecalcStyle when we had custom style hooks because some elements had
CustomStyleForLayoutObject() methods which depended on parent layout
objects. This is no longer true, so we can now always recalc style for
re-attachment. That means we'll also need to call custom style hooks
WillRecalcStyle/DidRecalcStyle for re-attacment styles as well.

Bug: 813057
Change-Id: I403c30e0f9f6934bd96d3da84488a6b3c489a50e
Reviewed-on: https://chromium-review.googlesource.com/925702Reviewed-by: default avatarMorten Stenshorne <mstensho@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#551011}
parent a9741a3c
......@@ -2281,6 +2281,9 @@ StyleRecalcChange Element::RecalcOwnStyle(StyleRecalcChange change) {
}
void Element::RecalcStyleForReattach() {
if (HasCustomStyleCallbacks())
WillRecalcStyle(kReattach);
bool recalc_descendants = false;
if (ParentComputedStyle()) {
scoped_refptr<ComputedStyle> non_attached_style = StyleForLayoutObject();
......@@ -2298,13 +2301,14 @@ void Element::RecalcStyleForReattach() {
}
if (recalc_descendants)
RecalcShadowIncludingDescendantStylesForReattach();
if (HasCustomStyleCallbacks())
DidRecalcStyle(kReattach);
}
void Element::RecalcShadowIncludingDescendantStylesForReattach() {
if (!ChildrenCanHaveStyle())
return;
if (HasCustomStyleCallbacks())
return;
SelectorFilterParentScope filterScope(*this);
RecalcShadowRootStylesForReattach();
RecalcDescendantStylesForReattach();
......
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