Commit c350837b authored by Cameron McCormack's avatar Cameron McCormack
Browse files

Bug 922669 - Part 4: Pass in anonymous content nodes when restyling any...

Bug 922669 - Part 4: Pass in anonymous content nodes when restyling any pseudo-elements that can match user action pseudo-classes. r=bz
parent f8487d13
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -2355,20 +2355,20 @@ ElementRestyler::RestyleSelf(nsIFrame* aSelf, nsRestyleHint aRestyleHint)
          // We're reframing anyway; just keep the same context
          newContext = oldContext;
        }
      } else if (nsCSSPseudoElements::PseudoElementSupportsStyleAttribute(pseudoTag)) {
        newContext = styleSet->ResolvePseudoElementStyle(element,
                                                         pseudoType,
                                                         parentContext,
                                                         aSelf->GetContent()->AsElement());
      } else {
        // Don't expect XUL tree stuff here, since it needs a comparator and
        // all.
        NS_ASSERTION(pseudoType <
                       nsCSSPseudoElements::ePseudo_PseudoElementCount,
                     "Unexpected pseudo type");
        Element* pseudoElement =
          nsCSSPseudoElements::PseudoElementSupportsStyleAttribute(pseudoTag) ||
          nsCSSPseudoElements::PseudoElementSupportsUserActionState(pseudoTag) ?
            aSelf->GetContent()->AsElement() : nullptr;
        newContext = styleSet->ResolvePseudoElementStyle(element,
                                                         pseudoType,
                                                         parentContext);
                                                         parentContext,
                                                         pseudoElement);
      }
    }
    else {
@@ -2446,7 +2446,8 @@ ElementRestyler::RestyleSelf(nsIFrame* aSelf, nsRestyleHint aRestyleHint)
                   "Unexpected type");
      newExtraContext = styleSet->ResolvePseudoElementStyle(mContent->AsElement(),
                                                            extraPseudoType,
                                                            newContext);
                                                            newContext,
                                                            nullptr);
    }

    MOZ_ASSERT(newExtraContext);
+4 −2
Original line number Diff line number Diff line
@@ -8653,7 +8653,8 @@ nsCSSFrameConstructor::GetFirstLetterStyle(nsIContent* aContent,
    return mPresShell->StyleSet()->
      ResolvePseudoElementStyle(aContent->AsElement(),
                                nsCSSPseudoElements::ePseudo_firstLetter,
                                aStyleContext);
                                aStyleContext,
                                nullptr);
  }
  return nullptr;
}
@@ -8666,7 +8667,8 @@ nsCSSFrameConstructor::GetFirstLineStyle(nsIContent* aContent,
    return mPresShell->StyleSet()->
      ResolvePseudoElementStyle(aContent->AsElement(),
                                nsCSSPseudoElements::ePseudo_firstLine,
                                aStyleContext);
                                aStyleContext,
                                nullptr);
  }
  return nullptr;
}
+1 −1
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ nsMeterFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
  nsCSSPseudoElements::Type pseudoType = nsCSSPseudoElements::ePseudo_mozMeterBar;
  nsRefPtr<nsStyleContext> newStyleContext = PresContext()->StyleSet()->
    ResolvePseudoElementStyle(mContent->AsElement(), pseudoType,
                              StyleContext());
                              StyleContext(), mBarDiv->AsElement());

  if (!aElements.AppendElement(ContentInfo(mBarDiv, newStyleContext))) {
    return NS_ERROR_OUT_OF_MEMORY;
+4 −2
Original line number Diff line number Diff line
@@ -198,12 +198,14 @@ nsNumberControlFrame::MakeAnonymousElement(nsIContent** aResult,
  NS_ASSERTION(aPseudoType != nsCSSPseudoElements::ePseudo_NotPseudoElement,
               "Expecting anonymous children to all be pseudo-elements");
  // Associate the pseudo-element with the anonymous child
  Element* resultElement = (*aResult)->AsElement();
  nsRefPtr<nsStyleContext> newStyleContext =
    PresContext()->StyleSet()->ResolvePseudoElementStyle(mContent->AsElement(),
                                                         aPseudoType,
                                                         aParentContext);
                                                         aParentContext,
                                                         resultElement);

  if (!aElements.AppendElement(ContentInfo(*aResult, newStyleContext))) {
  if (!aElements.AppendElement(ContentInfo(resultElement, newStyleContext))) {
    return NS_ERROR_OUT_OF_MEMORY;
  }
  return NS_OK;
+1 −1
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ nsProgressFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
  nsCSSPseudoElements::Type pseudoType = nsCSSPseudoElements::ePseudo_mozProgressBar;
  nsRefPtr<nsStyleContext> newStyleContext = PresContext()->StyleSet()->
    ResolvePseudoElementStyle(mContent->AsElement(), pseudoType,
                              StyleContext());
                              StyleContext(), mBarDiv->AsElement());

  if (!aElements.AppendElement(ContentInfo(mBarDiv, newStyleContext))) {
    return NS_ERROR_OUT_OF_MEMORY;
Loading