Bug 1417661 - Use the correct parent style for inheriting from first-letter if the container is an anonymous box. r=bz, a=gchang
authorEmilio Cobos Álvarez <emilio@crisal.io>
Tue, 28 Nov 2017 19:27:49 +0100
changeset 445054 e4d5dee669102f6f271a6eebf749d0f9973fde0b
parent 445053 aeba274613769f5855b0981a9def0efa68b89067
child 445055 122e73935baa8d5dc0fcd0f473ff28deb22a5fd6
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz, gchang
bugs1417661
milestone58.0
Bug 1417661 - Use the correct parent style for inheriting from first-letter if the container is an anonymous box. r=bz, a=gchang MozReview-Commit-ID: 1B7DrAVa274
layout/base/nsCSSFrameConstructor.cpp
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -11661,23 +11661,25 @@ nsCSSFrameConstructor::CreateLetterFrame
   nsIContent* blockContent = aBlockFrame->GetContent();
 
   // Create first-letter style rule
   RefPtr<nsStyleContext> sc =
     GetFirstLetterStyle(blockContent, parentStyleContext);
 
   if (sc) {
     if (sc->IsServo() && parentFrame->IsLineFrame()) {
-      ServoStyleContext* parentStyleIgnoringFirstLine =
-        aBlockFrame->StyleContext()->AsServo();
+      nsIFrame* parentIgnoringFirstLine =
+        nsFrame::CorrectStyleParentFrame(aBlockFrame,
+                                         nsCSSPseudoElements::firstLetter);
+
       sc =
         mPresShell->StyleSet()->AsServo()->ReparentStyleContext(
           sc->AsServo(),
           parentStyleContext->AsServo(),
-          parentStyleIgnoringFirstLine,
+          parentIgnoringFirstLine->StyleContext()->AsServo(),
           parentStyleContext->AsServo(),
           blockContent->AsElement());
     }
 
     RefPtr<nsStyleContext> textSC = mPresShell->StyleSet()->
       ResolveStyleForText(aTextContent, sc);
 
     // Create a new text frame (the original one will be discarded)