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

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

@ -2406,6 +2406,7 @@ class Document : public nsINode,
nsAtom* aAttrName, nsAtom* aAttrName,
const nsAString& aAttrValue) const; const nsAString& aAttrValue) const;
/** /**
* To batch DOMSubtreeModified, document needs to be informed when * To batch DOMSubtreeModified, document needs to be informed when
* a mutation event might be dispatched, even if the event isn't actually * a mutation event might be dispatched, even if the event isn't actually
@ -3496,30 +3497,7 @@ class Document : public nsINode,
void ReportHasScrollLinkedEffect(); void ReportHasScrollLinkedEffect();
bool HasScrollLinkedEffect() const { return mHasScrollLinkedEffect; } bool HasScrollLinkedEffect() const { return mHasScrollLinkedEffect; }
#ifdef DEBUG DocGroup* GetDocGroup() const;
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();
}
void AddIntersectionObserver(DOMIntersectionObserver* aObserver) { void AddIntersectionObserver(DOMIntersectionObserver* aObserver) {
MOZ_ASSERT(!mIntersectionObservers.Contains(aObserver), MOZ_ASSERT(!mIntersectionObservers.Contains(aObserver),

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

@ -7366,12 +7366,16 @@ void nsGlobalWindowOuter::FlushPendingNotifications(FlushType aType) {
} }
void nsGlobalWindowOuter::EnsureSizeAndPositionUpToDate() { void nsGlobalWindowOuter::EnsureSizeAndPositionUpToDate() {
// If we're a subframe, make sure our size is up to date. Make sure to go // If we're a subframe, make sure our size is up to date. It's OK that this
// through the document chain rather than the window chain to not flush on // crosses the content/chrome boundary, since chrome can have pending reflows
// detached iframes, see bug 1545516. // too.
if (mDoc && mDoc->StyleOrLayoutObservablyDependsOnParentDocumentLayout()) { //
RefPtr<Document> parent = mDoc->GetParentDocument(); // Make sure to go through the document chain rather than the window chain to
parent->FlushPendingNotifications(FlushType::Layout); // 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(); Document* doc = mElement->OwnerDoc();
// If parent document is there, also needs to check if there is some change // 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). // that needs to flush this document (e.g. size change for iframe).
while (doc->StyleOrLayoutObservablyDependsOnParentDocumentLayout()) { while (Document* parentDocument = doc->GetParentDocument()) {
Document* parentDocument = doc->GetParentDocument();
Element* element = parentDocument->FindContentForSubDocument(doc); Element* element = parentDocument->FindContentForSubDocument(doc);
if (ElementNeedsRestyle(element, nullptr)) { if (ElementNeedsRestyle(element, nullptr)) {
return true; return true;