Bug 1110277 patch 1 - Consider the ib-split chain when checking for ::before and ::after in order to reframe when they're missing. r=bzbarsky
authorL. David Baron <dbaron@dbaron.org>
Sun, 11 Jan 2015 15:43:10 -0800
changeset 223171 86088b6c69e8414e6a9845fc7985de6dbbf6f16e
parent 223170 ca02a661d6dc7a4a844488e30961da354ae7227c
child 223172 fbbafc2a957318cc4fa2c2dbfd774124ccf597be
push id28082
push usercbook@mozilla.com
push dateMon, 12 Jan 2015 10:44:52 +0000
treeherdermozilla-central@643589c3ef94 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs1110277, 1115691
milestone37.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1110277 patch 1 - Consider the ib-split chain when checking for ::before and ::after in order to reframe when they're missing. r=bzbarsky This patch is not needed to fix the bug, but it seems like it's probably desirable. It's not needed for this bug because MaybeReframeForBeforePseudo and MaybeReframeForAfterPseudo are already called (by ElementRestyler::RestyleChildren) on only the first and last continuation or ib-split sibling with the same style. So this patch should only actually change anything for cases like a block-in-inline split whose initial inline part is inside of a ::first-line (where different parts of the block-in-inline split chain have different style). Since the symptom of this bug is (once patch 6 is in the tree) only causing extra reframes, it can only be tested using the new API (from bug 1115691) for observing reframes. I confirmed that the test for this bug fails without the patch and passes with the patch (as noted by the removal of its todo annotation).
layout/base/RestyleManager.cpp
layout/base/tests/test_frame_reconstruction_for_pseudo_elements.html
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -3671,18 +3671,19 @@ ElementRestyler::MaybeReframeForBeforePs
   // can't have generated content.
   nsContainerFrame* cif;
   if (!aStyleContext->GetPseudo() &&
       ((aGenConParentFrame->GetStateBits() & NS_FRAME_MAY_HAVE_GENERATED_CONTENT) ||
        // Our content insertion frame might have gotten flagged.
        ((cif = aGenConParentFrame->GetContentInsertionFrame()) &&
         (cif->GetStateBits() & NS_FRAME_MAY_HAVE_GENERATED_CONTENT)))) {
     // Check for a ::before pseudo style and the absence of a ::before content,
-    // but only if aFrame is null or is the first continuation.
-    if (!aFrame || !aFrame->GetPrevContinuation()) {
+    // but only if aFrame is null or is the first continuation/ib-split.
+    if (!aFrame ||
+        nsLayoutUtils::IsFirstContinuationOrIBSplitSibling(aFrame)) {
       // Checking for a ::before frame is cheaper than getting the
       // ::before style context.
       if (!nsLayoutUtils::GetBeforeFrameForContent(aGenConParentFrame, aContent) &&
           nsLayoutUtils::HasPseudoStyle(aContent, aStyleContext,
                                         nsCSSPseudoElements::ePseudo_before,
                                         mPresContext)) {
         // Have to create the new ::before frame.
         LOG_RESTYLE("MaybeReframeForBeforePseudo, appending "
@@ -3717,18 +3718,19 @@ ElementRestyler::MaybeReframeForAfterPse
   // can't have generated content.
   nsContainerFrame* cif;
   if (!aStyleContext->GetPseudo() &&
       ((aGenConParentFrame->GetStateBits() & NS_FRAME_MAY_HAVE_GENERATED_CONTENT) ||
        // Our content insertion frame might have gotten flagged.
        ((cif = aGenConParentFrame->GetContentInsertionFrame()) &&
         (cif->GetStateBits() & NS_FRAME_MAY_HAVE_GENERATED_CONTENT)))) {
     // Check for an ::after pseudo style and the absence of an ::after content,
-    // but only if aFrame is null or is the last continuation.
-    if (!aFrame || !aFrame->GetNextContinuation()) {
+    // but only if aFrame is null or is the last continuation/ib-split.
+    if (!aFrame ||
+        !nsLayoutUtils::GetNextContinuationOrIBSplitSibling(aFrame)) {
       // Checking for an ::after frame is cheaper than getting the
       // ::after style context.
       if (!nsLayoutUtils::GetAfterFrameForContent(aGenConParentFrame, aContent) &&
           nsLayoutUtils::HasPseudoStyle(aContent, aStyleContext,
                                         nsCSSPseudoElements::ePseudo_after,
                                         mPresContext)) {
         // Have to create the new ::after frame.
         LOG_RESTYLE("MaybeReframeForAfterPseudo, appending "
--- a/layout/base/tests/test_frame_reconstruction_for_pseudo_elements.html
+++ b/layout/base/tests/test_frame_reconstruction_for_pseudo_elements.html
@@ -30,17 +30,17 @@ https://bugzilla.mozilla.org/show_bug.cg
   </style>
   <script type="application/javascript">
 
   /** Test for Bug 1110277 **/
 
   SimpleTest.waitForExplicitFinish();
 
   function run() {
-    runtest("first line test", "#firstlinetest > .testspan", { todo: true });
+    runtest("first line test", "#firstlinetest > .testspan", {});
     runtest("after test", "#aftertest > .testspan", { todo: true });
     SimpleTest.finish();
   }
 
   function runtest(description, selector, flags) {
     var utils = SpecialPowers.getDOMWindowUtils(window);
     var span = document.querySelector(selector);
     var cs = getComputedStyle(span, "");