Commit 15578360 authored by Rune Lillesveen's avatar Rune Lillesveen Committed by Chromium LUCI CQ

Missing nullptr check for pseudo style

ComputedStyle from PseudoStyleForElement may be null if there are no
matching rules. It shouldn't really happen here, but the code for
updating paint layers on style recalc is computing style for children,
which is potentially problematic and should be avoided. Updated FIXME to
reflect that.

Bug: 1150472
Change-Id: Iba6af725d50093113a1a5a18ac9ac95cb249fe59
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2594909
Commit-Queue: Koji Ishii <kojii@chromium.org>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#837634}
parent d26f615b
......@@ -5135,7 +5135,8 @@ scoped_refptr<ComputedStyle> Element::StyleForPseudoElement(
result = GetDocument().GetStyleResolver().StyleForElement(
this, parent_style, parent_style);
}
result->SetStyleType(kPseudoIdFirstLineInherited);
if (result)
result->SetStyleType(kPseudoIdFirstLineInherited);
return result;
}
......
......@@ -1432,7 +1432,10 @@ void PaintLayer::RemoveOnlyThisLayerAfterStyleChange(
RemoveChild(current);
parent_->AddChild(current, next_sib);
// FIXME: We should call a specialized version of this function.
// TODO(crbug.com/1150472): UpdateLayerPositionsAfterLayout() is computing
// uncached pseudo styles (for ::first-line) for descendants, which is
// problematic since we are called from style recalc. We should call a
// specialized version of this function.
current->UpdateLayerPositionsAfterLayout();
current = next;
}
......
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