Commit a714568f authored by Rune Lillesveen's avatar Rune Lillesveen Committed by Commit Bot

Make sure stacking context is always updated for ::first-letter.

::first-letter sadly has at least three code paths for computing its
computed style. Two of them were lacking stacking context update. There
is work in progress for Squad to mend this, but let's fix the current
code paths for now.

Bug: 856806
Change-Id: Ifeea799643bfa266e58c948f476bc23481fcdd5e
Reviewed-on: https://chromium-review.googlesource.com/1120249
Commit-Queue: Chris Harrelson <chrishtr@chromium.org>
Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#571512}
parent 57e064e0
<!DOCTYPE html>
<title>CSS Test: floating ::first-letter with opacity</title>
<link rel="author" title="Rune Lillesveen" href="mailto:futhark@chromium.org">
<link rel="match" href="first-letter-opacity-float-001-ref.html">
<link rel="help" href="https://drafts.csswg.org/css-pseudo-4/#first-letter-styling">
<meta name="assert" content="Test checks that a floated ::first-letter with opacity is rendered correctly with dynamic changes.">
<style>
#one::first-letter { float: left; opacity: 0.5 }
#two { opacity: 0.5 }
</style>
<div id="one">PASS</div>
<div id="two"></div>
<script>
requestAnimationFrame(() =>
requestAnimationFrame(() => {
// This used to crash the compositing code in Blink.
one.appendChild(two);
}));
</script>
......@@ -838,6 +838,10 @@ PseudoElement* StyleResolver::CreatePseudoElementIfNeeded(Element& parent,
return nullptr;
scoped_refptr<ComputedStyle> style = state.TakeStyle();
DCHECK(style);
style->UpdateIsStackingContext(
false /* is_document_element */,
pseudo_id == kPseudoIdBackdrop /* is_in_top_layer */,
false /* is_svg_stacking */);
parent_style->AddCachedPseudoStyle(style);
if (!PseudoElementLayoutObjectIsNeeded(style.get()))
......
......@@ -277,7 +277,9 @@ ComputedStyle* FirstLetterPseudoElement::StyleForFirstLetter(
ComputedStyle* pseudo_style = style_container->GetCachedPseudoStyle(
kPseudoIdFirstLetter, layout_object_container->FirstLineStyle());
DCHECK(pseudo_style);
pseudo_style->UpdateIsStackingContext(false /* is_document_element */,
false /* is_in_top_layer */,
false /* is_svg_stacking */);
return pseudo_style;
}
......
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