Backed out changeset f7c391670061 (bug 1440537) for mochitest failures at test_swapFrameLoaders.xul.

This commit is contained in:
Brindusan Cristian 2019-04-27 15:23:16 +03:00
Родитель 30fc959628
Коммит 1cd3709f4c
4 изменённых файлов: 18 добавлений и 36 удалений

Просмотреть файл

@ -3149,8 +3149,8 @@ void Document::SetPrincipals(nsIPrincipal* aNewPrincipal,
#endif
}
mozilla::dom::DocGroup* Document::GetDocGroup() const {
#ifdef DEBUG
void Document::AssertDocGroupMatchesKey() const {
// Sanity check that we have an up-to-date and accurate docgroup
if (mDocGroup) {
nsAutoCString docGroupKey;
@ -3162,9 +3162,11 @@ void Document::AssertDocGroupMatchesKey() const {
}
// XXX: Check that the TabGroup is correct as well!
}
}
#endif
return mDocGroup;
}
nsresult Document::Dispatch(TaskCategory aCategory,
already_AddRefed<nsIRunnable>&& aRunnable) {
// Note that this method may be called off the main thread.
@ -7332,8 +7334,7 @@ void Document::FlushPendingNotifications(mozilla::ChangesToFlush aFlush) {
// affect style, we need to promote a style flush on ourself to a
// layout flush on our parent, since we need our container to be the
// correct size to determine the correct style.
if (StyleOrLayoutObservablyDependsOnParentDocumentLayout() &&
IsSafeToFlush()) {
if (mParentDocument && IsSafeToFlush()) {
mozilla::ChangesToFlush parentFlush = aFlush;
if (flushType >= FlushType::Style) {
parentFlush.mFlushType = std::max(FlushType::Layout, flushType);

Просмотреть файл

@ -2406,6 +2406,7 @@ class Document : public nsINode,
nsAtom* aAttrName,
const nsAString& aAttrValue) const;
/**
* To batch DOMSubtreeModified, document needs to be informed when
* a mutation event might be dispatched, even if the event isn't actually
@ -3496,30 +3497,7 @@ class Document : public nsINode,
void ReportHasScrollLinkedEffect();
bool HasScrollLinkedEffect() const { return mHasScrollLinkedEffect; }
#ifdef DEBUG
void AssertDocGroupMatchesKey() const;
#endif
DocGroup* GetDocGroup() const {
#ifdef DEBUG
AssertDocGroupMatchesKey();
#endif
return mDocGroup;
}
/**
* If we're a sub-document, the parent document's layout can affect our style
* and layout (due to the viewport size, viewport units, media queries...).
*
* This function returns true if our parent document and our child document
* can observe each other. If they cannot, then we don't need to synchronously
* update the parent document layout every time the child document may need
* up-to-date layout information.
*/
bool StyleOrLayoutObservablyDependsOnParentDocumentLayout() const {
return GetParentDocument() &&
GetDocGroup() == GetParentDocument()->GetDocGroup();
}
DocGroup* GetDocGroup() const;
void AddIntersectionObserver(DOMIntersectionObserver* aObserver) {
MOZ_ASSERT(!mIntersectionObservers.Contains(aObserver),

Просмотреть файл

@ -7366,12 +7366,16 @@ void nsGlobalWindowOuter::FlushPendingNotifications(FlushType aType) {
}
void nsGlobalWindowOuter::EnsureSizeAndPositionUpToDate() {
// If we're a subframe, make sure our size is up to date. Make sure to go
// through the document chain rather than the window chain to not flush on
// detached iframes, see bug 1545516.
if (mDoc && mDoc->StyleOrLayoutObservablyDependsOnParentDocumentLayout()) {
RefPtr<Document> parent = mDoc->GetParentDocument();
parent->FlushPendingNotifications(FlushType::Layout);
// If we're a subframe, make sure our size is up to date. It's OK that this
// crosses the content/chrome boundary, since chrome can have pending reflows
// too.
//
// Make sure to go through the document chain rather than the window chain to
// not flush on detached iframes, see bug 1545516.
if (mDoc) {
if (RefPtr<Document> parent = mDoc->GetParentDocument()) {
parent->FlushPendingNotifications(FlushType::Layout);
}
}
}

Просмотреть файл

@ -785,8 +785,7 @@ bool nsComputedDOMStyle::NeedsToFlush() const {
Document* doc = mElement->OwnerDoc();
// If parent document is there, also needs to check if there is some change
// that needs to flush this document (e.g. size change for iframe).
while (doc->StyleOrLayoutObservablyDependsOnParentDocumentLayout()) {
Document* parentDocument = doc->GetParentDocument();
while (Document* parentDocument = doc->GetParentDocument()) {
Element* element = parentDocument->FindContentForSubDocument(doc);
if (ElementNeedsRestyle(element, nullptr)) {
return true;