Bug 1481192 Part 1: Change computed style to use correct pseudo element selection. r=emilio
authorBrad Werth <bwerth@mozilla.com>
Fri, 28 Sep 2018 20:20:28 +0000
changeset 494462 2eec9b638d548eb2c59e6d02c98382a15d3574e3
parent 494461 7a531716e0734650ce0d5603afd76275724b1116
child 494463 895b156fc23c95cf895d804511905a4f7b8e0014
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1481192
milestone64.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 1481192 Part 1: Change computed style to use correct pseudo element selection. r=emilio In order to handle nsTableWrapperFrames correctly, this code is changed to use the code in nsLayoutUtils::GetBeforePseudo and ::GetAfterPseudo, and then finding the styling frames from those elements. Differential Revision: https://phabricator.services.mozilla.com/D6730
layout/style/nsComputedDOMStyle.cpp
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -571,31 +571,34 @@ nsComputedDOMStyle::DoGetComputedStyleNo
   }
 
   // XXX the !aElement->IsHTMLElement(nsGkAtoms::area)
   // check is needed due to bug 135040 (to avoid using
   // mPrimaryFrame). Remove it once that's fixed.
   if (inDocWithShell &&
       aStyleType == eAll &&
       !aElement->IsHTMLElement(nsGkAtoms::area)) {
-    nsIFrame* frame = nullptr;
+    Element* element = nullptr;
     if (aPseudo == nsCSSPseudoElements::before()) {
-      frame = nsLayoutUtils::GetBeforeFrame(aElement);
+      element = nsLayoutUtils::GetBeforePseudo(aElement);
     } else if (aPseudo == nsCSSPseudoElements::after()) {
-      frame = nsLayoutUtils::GetAfterFrame(aElement);
+      element = nsLayoutUtils::GetAfterPseudo(aElement);
     } else if (!aPseudo) {
-      frame = nsLayoutUtils::GetStyleFrame(aElement);
+      element = aElement;
     }
-    if (frame) {
-      ComputedStyle* result = frame->Style();
-      // Don't use the style if it was influenced by pseudo-elements, since then
-      // it's not the primary style for this element / pseudo.
-      if (!MustReresolveStyle(result)) {
-        RefPtr<ComputedStyle> ret = result;
-        return ret.forget();
+
+    if (element) {
+      if (nsIFrame* styleFrame = nsLayoutUtils::GetStyleFrame(element)) {
+        ComputedStyle* result = styleFrame->Style();
+        // Don't use the style if it was influenced by pseudo-elements,
+        // since then it's not the primary style for this element / pseudo.
+        if (!MustReresolveStyle(result)) {
+          RefPtr<ComputedStyle> ret = result;
+          return ret.forget();
+        }
       }
     }
   }
 
   // No frame has been created, or we have a pseudo, or we're looking
   // for the default style, so resolve the style ourselves.
   ServoStyleSet* styleSet = presShell->StyleSet();