Bug 1449807: Don't flush in nsXBLResourceLoader::NotifyBoundElements. r?bz
Before
bug 1357142, we used to legitimately need to check for redundant
frame tree insertions and such, since we went into frame construction
synchronously.
But after that, all this dance of flushing, querying the primary frame and the
uncomputed maps is just needless. We can just post as many reframes as we want,
they'll be processed properly on the next flush.
This removes one of the queries to the undisplayed map which I'm trying to
remove in
bug 1303605. I could have just poked at the style stored in the
element, but this one is easy to just get rid of.
MozReview-Commit-ID: 4ng4bU6C4Bs
--- a/dom/xbl/nsXBLResourceLoader.cpp
+++ b/dom/xbl/nsXBLResourceLoader.cpp
@@ -230,57 +230,33 @@ nsXBLResourceLoader::NotifyBoundElements
for (uint32_t j = 0; j < eltCount; j++) {
nsCOMPtr<nsIContent> content = mBoundElements.ObjectAt(j);
MOZ_ASSERT(content->IsElement());
content->OwnerDoc()->UnblockOnload(/* aFireSync = */ false);
bool ready = false;
xblService->BindingReady(content, bindingURI, &ready);
- if (ready) {
- // We need the document to flush out frame construction and
- // such, so we want to use the current document.
- nsIDocument* doc = content->GetUncomposedDoc();
-
- if (doc) {
- // Flush first to make sure we can get the frame for content
- doc->FlushPendingNotifications(FlushType::Frames);
+ if (!ready) {
+ continue;
+ }
- // If |content| is (in addition to having binding |mBinding|)
- // also a descendant of another element with binding |mBinding|,
- // then we might have just constructed it due to the
- // notification of its parent. (We can know about both if the
- // binding loads were triggered from the DOM rather than frame
- // construction.) So we have to check both whether the element
- // has a primary frame and whether it's in the undisplayed map
- // before sending a ContentInserted notification, or bad things
- // will happen.
- nsIPresShell *shell = doc->GetShell();
- if (shell) {
- nsIFrame* childFrame = content->GetPrimaryFrame();
- if (!childFrame) {
- // Check if it's in the display:none or display:contents maps.
- ComputedStyle* sc =
- shell->FrameConstructor()->GetDisplayNoneStyleFor(content);
+ // We need the document to flush out frame construction and
+ // such, so we want to use the current document.
+ nsIDocument* doc = content->GetUncomposedDoc();
+ if (!doc) {
+ continue;
+ }
- if (!sc) {
- sc = shell->FrameConstructor()->GetDisplayContentsStyleFor(content);
- }
+ nsIPresShell* shell = doc->GetShell();
+ if (!shell) {
+ continue;
+ }
- if (!sc) {
- shell->PostRecreateFramesFor(content->AsElement());
- }
- }
- }
-
- // Flush again
- // XXXbz why is this needed?
- doc->FlushPendingNotifications(FlushType::ContentAndNotify);
- }
- }
+ shell->PostRecreateFramesFor(content->AsElement());
}
// Clear out the whole array.
mBoundElements.Clear();
// Delete ourselves.
mResources->ClearLoader();
}