Bug 1428164: Restyle owned anon boxes after processing children. r?bz
Otherwise the text post-traversal may clobber the first-letter style, and that
causes the ::first-letter style to get lost.
MozReview-Commit-ID: IlrGwQFPxYg
--- a/layout/base/ServoRestyleManager.cpp
+++ b/layout/base/ServoRestyleManager.cpp
@@ -826,17 +826,16 @@ ServoRestyleManager::ProcessPostTraversa
if (MOZ_UNLIKELY(displayContentsStyle)) {
MOZ_ASSERT(!styleFrame);
PresContext()->FrameConstructor()->
ChangeRegisteredDisplayContentsStyleFor(aElement, upToDateContext);
}
if (styleFrame) {
UpdateAdditionalStyleContexts(styleFrame, aRestyleState);
- styleFrame->UpdateStyleOfOwnedAnonBoxes(childrenRestyleState);
}
if (!aElement->GetParent()) {
// This is the root. Update styles on the viewport as needed.
ViewportFrame* viewport =
do_QueryFrame(mPresContext->PresShell()->GetRootFrame());
if (viewport) {
// NB: The root restyle state, not the one for our children!
@@ -886,20 +885,21 @@ ServoRestyleManager::ProcessPostTraversa
}
}
// We want to update frame pseudo-element styles after we've traversed our
// kids, because some of those updates (::first-line/::first-letter) need to
// modify the styles of the kids, and the child traversal above would just
// clobber those modifications.
if (styleFrame) {
- // Process anon box wrapper frames before ::first-line bits.
+ // Process anon boxes and other pseudos before ::first-line bits.
childrenRestyleState.ProcessWrapperRestyles(styleFrame);
if (wasRestyled) {
+ styleFrame->UpdateStyleOfOwnedAnonBoxes(childrenRestyleState);
styleFrame->UpdatePseudoElementStylesIfNeeded(childrenRestyleState);
} else if (traverseElementChildren &&
styleFrame->IsFrameOfType(nsIFrame::eBlockFrame)) {
// Even if we were not restyled, if we're a block with a first-line and
// one of our descendant elements which is on the first line was restyled,
// we need to update the styles of things on the first line, because
// they're wrong now.
//