Bug 1371955: Diff against the correct style, not the table wrapper style. draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Sun, 11 Jun 2017 13:44:24 +0200
changeset 593388 d1f58c715b36d9485d7c2d71f82eb42d1589570c
parent 593387 795850fe680752e50d22ab8ce64fe1f1545a4467
child 593389 d008c0c0c3e514986f4d2bc9347ffd5521bea13f
push id63675
push userbmo:emilio+bugs@crisal.io
push dateTue, 13 Jun 2017 13:49:44 +0000
bugs1371955
milestone56.0a1
Bug 1371955: Diff against the correct style, not the table wrapper style. MozReview-Commit-ID: 9fwt2D7vOpW
layout/base/ServoRestyleManager.cpp
layout/base/ServoRestyleManager.h
--- a/layout/base/ServoRestyleManager.cpp
+++ b/layout/base/ServoRestyleManager.cpp
@@ -527,30 +527,31 @@ ServoRestyleManager::SnapshotFor(Element
 
   nsIPresShell* presShell = mPresContext->PresShell();
   presShell->EnsureStyleFlush();
 
   return *snapshot;
 }
 
 /* static */ nsIFrame*
-ServoRestyleManager::FrameForPseudoElement(const nsIContent* aContent,
+ServoRestyleManager::FrameForPseudoElement(const Element* aElement,
                                            nsIAtom* aPseudoTagOrNull)
 {
-  MOZ_ASSERT(!aPseudoTagOrNull || aContent->IsElement());
   if (!aPseudoTagOrNull) {
-    return aContent->GetPrimaryFrame();
+    return nsLayoutUtils::GetStyleFrame(aElement);
   }
 
   if (aPseudoTagOrNull == nsCSSPseudoElements::before) {
-    return nsLayoutUtils::GetBeforeFrame(aContent);
+    Element* pseudoElement = nsLayoutUtils::GetBeforePseudo(aElement);
+    return pseudoElement ? nsLayoutUtils::GetStyleFrame(pseudoElement) : nullptr;
   }
 
   if (aPseudoTagOrNull == nsCSSPseudoElements::after) {
-    return nsLayoutUtils::GetAfterFrame(aContent);
+    Element* pseudoElement = nsLayoutUtils::GetAfterPseudo(aElement);
+    return pseudoElement ? nsLayoutUtils::GetStyleFrame(pseudoElement) : nullptr;
   }
 
   if (aPseudoTagOrNull == nsCSSPseudoElements::firstLine ||
       aPseudoTagOrNull == nsCSSPseudoElements::firstLetter) {
     // TODO(emilio, bz): Figure out the best way to diff these styles.
     return nullptr;
   }
 
--- a/layout/base/ServoRestyleManager.h
+++ b/layout/base/ServoRestyleManager.h
@@ -77,17 +77,17 @@ public:
   nsresult ReparentStyleContext(nsIFrame* aFrame);
 
   /**
    * Gets the appropriate frame given a content and a pseudo-element tag.
    *
    * Right now only supports a null tag, before or after. If the pseudo-element
    * is not null, the content needs to be an element.
    */
-  static nsIFrame* FrameForPseudoElement(const nsIContent* aContent,
+  static nsIFrame* FrameForPseudoElement(const Element* aElement,
                                          nsIAtom* aPseudoTagOrNull);
 
   /**
    * Clears the ServoElementData and HasDirtyDescendants from all elements
    * in the subtree rooted at aElement.
    */
   static void ClearServoDataFromSubtree(Element* aElement);