Bug 1328652: Ensure we do actual restyling work after calling RebuildAllStyleData. r=bz
The Gecko restyle manager does this synchronously, along with a content flush.
In my testing there's no need to do so, and Boris couldn't think off-hand of
why, except the fact that we have this mRebuildAllStyleData thing that takes
care of rebuilding the rule tree, which is quite sensitive.
Also, Boris made a good point about non-inheriting anon boxes, that could
technically change style. I've left a note about it too.
MozReview-Commit-ID: 2lvzhxugKB0
--- a/layout/base/ServoRestyleManager.cpp
+++ b/layout/base/ServoRestyleManager.cpp
@@ -75,19 +75,29 @@ ServoRestyleManager::PostRestyleEventFor
{
Servo_NoteExplicitHints(aElement, aRestyleHint, nsChangeHint(0));
}
void
ServoRestyleManager::RebuildAllStyleData(nsChangeHint aExtraHint,
nsRestyleHint aRestyleHint)
{
- // TODO(emilio, bz): We probably need to do some actual restyling here too.
- NS_WARNING("stylo: ServoRestyleManager::RebuildAllStyleData is incomplete");
StyleSet()->RebuildData();
+
+ // NOTE(emilio): GeckoRestlyeManager does a sync style flush, which seems
+ // not to be needed in my testing.
+ //
+ // If it is, we can just do a content flush and call ProcessPendingRestyles.
+ if (Element* root = mPresContext->Document()->GetRootElement()) {
+ PostRestyleEvent(root, aRestyleHint, aExtraHint);
+ }
+
+ // TODO(emilio, bz): Extensions can add/remove stylesheets that can affect
+ // non-inheriting anon boxes. It's not clear if we want to support that, but
+ // if we do, we need to re-selector-match them here.
}
void
ServoRestyleManager::PostRebuildAllStyleDataEvent(nsChangeHint aExtraHint,
nsRestyleHint aRestyleHint)
{
NS_WARNING("stylo: ServoRestyleManager::PostRebuildAllStyleDataEvent not implemented");
}