Bug 1290276 Part 7 - Restyle element and its descendant after loading XBL bindings.
MozReview-Commit-ID: 1WiioW3xxMX
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -5814,24 +5814,37 @@ nsCSSFrameConstructor::AddFrameConstruct
return;
if (newPendingBinding->mBinding) {
pendingBinding = newPendingBinding;
// aState takes over owning newPendingBinding
aState.AddPendingBinding(newPendingBinding.forget());
}
- if (aContent->IsStyledByServo()) {
- NS_WARNING("stylo: Skipping Unsupported binding re-resolve. This needs fixing.");
- resolveStyle = false;
- }
-
if (resolveStyle) {
- styleContext =
- ResolveStyleContext(styleContext->GetParent(), aContent, &aState);
+ if (aContent->IsStyledByServo()) {
+ Element* element = aContent->AsElement();
+ ServoStyleSet* styleSet = mPresShell->StyleSet()->AsServo();
+
+ // XXX: We should have a better way to restyle ourselves.
+ ServoRestyleManager::ClearServoDataFromSubtree(element);
+ styleSet->StyleNewSubtree(element);
+
+ // Servo's should_traverse_children() in traversal.rs skips
+ // styling descendants of elements with a -moz-binding the
+ // first time. Thus call StyleNewChildren() again.
+ styleSet->StyleNewChildren(element);
+
+ styleContext =
+ styleSet->ResolveStyleFor(element, nullptr, LazyComputeBehavior::Allow);
+ } else {
+ styleContext =
+ ResolveStyleContext(styleContext->GetParent(), aContent, &aState);
+ }
+
display = styleContext->StyleDisplay();
aStyleContext = styleContext;
}
aTag = mDocument->BindingManager()->ResolveTag(aContent, &aNameSpaceID);
} else if (display->mBinding.ForceGet()) {
if (aContent->IsStyledByServo()) {
// Servo's should_traverse_children skips styling descendants of