Loading browser/base/content/test/performance/browser_windowopen.js +22 −5 Original line number Diff line number Diff line Loading @@ -18,6 +18,17 @@ const EXPECTED_REFLOWS = [ */ ]; // We'll assume the changes we are seeing are due to this focus change if // there are at least 5 areas that changed near the top of the screen, or if // the toolbar background is involved on OSX, but will only ignore this once. function isLikelyFocusChange(rects) { if (rects.length > 5 && rects.every(r => r.y2 < 100)) return true; if (Services.appinfo.OS == "Darwin" && rects.length == 2 && rects.every(r => r.y1 == 0 && r.h == 33)) return true; return false; } /* * This test ensures that there are no unexpected * uninterruptible reflows or flickering areas when opening new windows. Loading @@ -41,11 +52,7 @@ add_task(async function() { filter(rects, frame, previousFrame) { // The first screenshot we get in OSX / Windows shows an unfocused browser // window for some reason. See bug 1445161. // // We'll assume the changes we are seeing are due to this focus change if // there are at least 5 areas that changed near the top of the screen, but // will only ignore this once (hence the alreadyFocused variable). if (!alreadyFocused && rects.length > 5 && rects.every(r => r.y2 < 100)) { if (!alreadyFocused && isLikelyFocusChange(rects)) { alreadyFocused = true; todo(false, "bug 1445161 - the window should be focused at first paint, " + Loading @@ -65,6 +72,16 @@ add_task(async function() { AppConstants.MOZ_DEV_EDITION ? inRange(r.x1, 100, 120) : inRange(r.x1, 65, 100), }, {name: "bug 1555842 - the urlbar shouldn't flicker", condition: r => { let inputFieldRect = win.gURLBar.inputField.getBoundingClientRect(); return (!AppConstants.DEBUG || AppConstants.platform == "linux" && AppConstants.ASAN) && r.x1 >= inputFieldRect.left && r.x2 <= inputFieldRect.right && r.y1 >= inputFieldRect.top && r.y2 <= inputFieldRect.bottom; }, }, ], }, }; Loading browser/components/urlbar/tests/browser/browser_UrlbarInput_unit.js +4 −0 Original line number Diff line number Diff line Loading @@ -93,6 +93,10 @@ async function withNewWindow(callback) { let input = new UrlbarInput(inputOptions); // Flush pending styles explicitely to make sure the added textbox and // popupset are styled before proceeding test. See bug 1488871 comment 26. doc.documentElement.getBoundingClientRect(); await callback(input); await BrowserTestUtils.closeWindow(win); Loading dom/base/BindContext.h +39 −9 Original line number Diff line number Diff line Loading @@ -24,6 +24,22 @@ struct MOZ_STACK_CLASS BindContext final { // OwnerDoc(). Document& OwnerDoc() const { return mDoc; } // Whether we're getting connected. // // https://dom.spec.whatwg.org/#connected bool InComposedDoc() const { return mInComposedDoc; } // Whether we're getting bound to the document tree. // // https://dom.spec.whatwg.org/#in-a-document-tree bool InUncomposedDoc() const { return mInUncomposedDoc; } Document* GetComposedDoc() const { return mInComposedDoc ? &mDoc : nullptr; } Document* GetUncomposedDoc() const { return mInUncomposedDoc ? &mDoc : nullptr; } // Whether our subtree root is changing as a result of this operation. bool SubtreeRootChanges() const { return mSubtreeRootChanges; } Loading @@ -35,10 +51,12 @@ struct MOZ_STACK_CLASS BindContext final { // This constructor should be used for regular appends to content. explicit BindContext(nsINode& aParentNode) : mDoc(*aParentNode.OwnerDoc()), mSubtreeRootChanges(true), mBindingParent(aParentNode.IsContent() ? aParentNode.AsContent()->GetBindingParent() : nullptr) {} : nullptr), mInComposedDoc(aParentNode.IsInComposedDoc()), mInUncomposedDoc(aParentNode.IsInUncomposedDoc()), mSubtreeRootChanges(true) {} // When re-binding a shadow host into a tree, we re-bind all the shadow tree // from the root. In that case, the shadow tree contents remain within the Loading @@ -48,30 +66,42 @@ struct MOZ_STACK_CLASS BindContext final { // This constructor is only meant to be used in that situation. explicit BindContext(ShadowRoot& aShadowRoot) : mDoc(*aShadowRoot.OwnerDoc()), mSubtreeRootChanges(false), mBindingParent(aShadowRoot.Host()) {} mBindingParent(aShadowRoot.Host()), mInComposedDoc(aShadowRoot.IsInComposedDoc()), mInUncomposedDoc(false), mSubtreeRootChanges(false) {} // This constructor is meant to be used when inserting native-anonymous // children into a subtree. enum ForNativeAnonymous { ForNativeAnonymous }; BindContext(Element& aParentElement, enum ForNativeAnonymous) : mDoc(*aParentElement.OwnerDoc()), mSubtreeRootChanges(true), mBindingParent(&aParentElement) {} mBindingParent(&aParentElement), mInComposedDoc(aParentElement.IsInComposedDoc()), mInUncomposedDoc(aParentElement.IsInUncomposedDoc()), mSubtreeRootChanges(true) { MOZ_ASSERT(mInComposedDoc, "Binding NAC in a disconnected subtree?"); } // This is meant to be used to bind XBL anonymous content. BindContext(nsXBLBinding& aBinding, Element& aParentElement) : mDoc(*aParentElement.OwnerDoc()), mSubtreeRootChanges(true), mBindingParent(aBinding.GetBoundElement()) {} mBindingParent(aBinding.GetBoundElement()), mInComposedDoc(aParentElement.IsInComposedDoc()), mInUncomposedDoc(aParentElement.IsInUncomposedDoc()), mSubtreeRootChanges(true) {} private: Document& mDoc; Element* const mBindingParent; const bool mInComposedDoc; const bool mInUncomposedDoc; // Whether the bind operation will change the subtree root of the content // we're binding. const bool mSubtreeRootChanges; Element* const mBindingParent; }; } // namespace dom Loading dom/base/CharacterData.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -481,6 +481,8 @@ nsresult CharacterData::BindToTree(BindContext& aContext, nsINode& aParent) { UpdateEditableState(false); MOZ_ASSERT(OwnerDoc() == aParent.OwnerDoc(), "Bound to wrong document"); MOZ_ASSERT(IsInComposedDoc() == aContext.InComposedDoc()); MOZ_ASSERT(IsInUncomposedDoc() == aContext.InUncomposedDoc()); MOZ_ASSERT(&aParent == GetParentNode(), "Bound to wrong parent node"); MOZ_ASSERT(aContext.GetBindingParent() == GetBindingParent(), "Bound to wrong binding parent"); Loading dom/base/Element.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -1758,6 +1758,8 @@ nsresult Element::BindToTree(BindContext& aContext, nsINode& aParent) { // postcondition asserts.... But we do want that, since things will // generally be quite broken when that happens. MOZ_ASSERT(OwnerDoc() == aParent.OwnerDoc(), "Bound to wrong document"); MOZ_ASSERT(IsInComposedDoc() == aContext.InComposedDoc()); MOZ_ASSERT(IsInUncomposedDoc() == aContext.InUncomposedDoc()); MOZ_ASSERT(&aParent == GetParentNode(), "Bound to wrong parent node"); MOZ_ASSERT(aContext.GetBindingParent() == GetBindingParent(), "Bound to wrong binding parent"); Loading Loading
browser/base/content/test/performance/browser_windowopen.js +22 −5 Original line number Diff line number Diff line Loading @@ -18,6 +18,17 @@ const EXPECTED_REFLOWS = [ */ ]; // We'll assume the changes we are seeing are due to this focus change if // there are at least 5 areas that changed near the top of the screen, or if // the toolbar background is involved on OSX, but will only ignore this once. function isLikelyFocusChange(rects) { if (rects.length > 5 && rects.every(r => r.y2 < 100)) return true; if (Services.appinfo.OS == "Darwin" && rects.length == 2 && rects.every(r => r.y1 == 0 && r.h == 33)) return true; return false; } /* * This test ensures that there are no unexpected * uninterruptible reflows or flickering areas when opening new windows. Loading @@ -41,11 +52,7 @@ add_task(async function() { filter(rects, frame, previousFrame) { // The first screenshot we get in OSX / Windows shows an unfocused browser // window for some reason. See bug 1445161. // // We'll assume the changes we are seeing are due to this focus change if // there are at least 5 areas that changed near the top of the screen, but // will only ignore this once (hence the alreadyFocused variable). if (!alreadyFocused && rects.length > 5 && rects.every(r => r.y2 < 100)) { if (!alreadyFocused && isLikelyFocusChange(rects)) { alreadyFocused = true; todo(false, "bug 1445161 - the window should be focused at first paint, " + Loading @@ -65,6 +72,16 @@ add_task(async function() { AppConstants.MOZ_DEV_EDITION ? inRange(r.x1, 100, 120) : inRange(r.x1, 65, 100), }, {name: "bug 1555842 - the urlbar shouldn't flicker", condition: r => { let inputFieldRect = win.gURLBar.inputField.getBoundingClientRect(); return (!AppConstants.DEBUG || AppConstants.platform == "linux" && AppConstants.ASAN) && r.x1 >= inputFieldRect.left && r.x2 <= inputFieldRect.right && r.y1 >= inputFieldRect.top && r.y2 <= inputFieldRect.bottom; }, }, ], }, }; Loading
browser/components/urlbar/tests/browser/browser_UrlbarInput_unit.js +4 −0 Original line number Diff line number Diff line Loading @@ -93,6 +93,10 @@ async function withNewWindow(callback) { let input = new UrlbarInput(inputOptions); // Flush pending styles explicitely to make sure the added textbox and // popupset are styled before proceeding test. See bug 1488871 comment 26. doc.documentElement.getBoundingClientRect(); await callback(input); await BrowserTestUtils.closeWindow(win); Loading
dom/base/BindContext.h +39 −9 Original line number Diff line number Diff line Loading @@ -24,6 +24,22 @@ struct MOZ_STACK_CLASS BindContext final { // OwnerDoc(). Document& OwnerDoc() const { return mDoc; } // Whether we're getting connected. // // https://dom.spec.whatwg.org/#connected bool InComposedDoc() const { return mInComposedDoc; } // Whether we're getting bound to the document tree. // // https://dom.spec.whatwg.org/#in-a-document-tree bool InUncomposedDoc() const { return mInUncomposedDoc; } Document* GetComposedDoc() const { return mInComposedDoc ? &mDoc : nullptr; } Document* GetUncomposedDoc() const { return mInUncomposedDoc ? &mDoc : nullptr; } // Whether our subtree root is changing as a result of this operation. bool SubtreeRootChanges() const { return mSubtreeRootChanges; } Loading @@ -35,10 +51,12 @@ struct MOZ_STACK_CLASS BindContext final { // This constructor should be used for regular appends to content. explicit BindContext(nsINode& aParentNode) : mDoc(*aParentNode.OwnerDoc()), mSubtreeRootChanges(true), mBindingParent(aParentNode.IsContent() ? aParentNode.AsContent()->GetBindingParent() : nullptr) {} : nullptr), mInComposedDoc(aParentNode.IsInComposedDoc()), mInUncomposedDoc(aParentNode.IsInUncomposedDoc()), mSubtreeRootChanges(true) {} // When re-binding a shadow host into a tree, we re-bind all the shadow tree // from the root. In that case, the shadow tree contents remain within the Loading @@ -48,30 +66,42 @@ struct MOZ_STACK_CLASS BindContext final { // This constructor is only meant to be used in that situation. explicit BindContext(ShadowRoot& aShadowRoot) : mDoc(*aShadowRoot.OwnerDoc()), mSubtreeRootChanges(false), mBindingParent(aShadowRoot.Host()) {} mBindingParent(aShadowRoot.Host()), mInComposedDoc(aShadowRoot.IsInComposedDoc()), mInUncomposedDoc(false), mSubtreeRootChanges(false) {} // This constructor is meant to be used when inserting native-anonymous // children into a subtree. enum ForNativeAnonymous { ForNativeAnonymous }; BindContext(Element& aParentElement, enum ForNativeAnonymous) : mDoc(*aParentElement.OwnerDoc()), mSubtreeRootChanges(true), mBindingParent(&aParentElement) {} mBindingParent(&aParentElement), mInComposedDoc(aParentElement.IsInComposedDoc()), mInUncomposedDoc(aParentElement.IsInUncomposedDoc()), mSubtreeRootChanges(true) { MOZ_ASSERT(mInComposedDoc, "Binding NAC in a disconnected subtree?"); } // This is meant to be used to bind XBL anonymous content. BindContext(nsXBLBinding& aBinding, Element& aParentElement) : mDoc(*aParentElement.OwnerDoc()), mSubtreeRootChanges(true), mBindingParent(aBinding.GetBoundElement()) {} mBindingParent(aBinding.GetBoundElement()), mInComposedDoc(aParentElement.IsInComposedDoc()), mInUncomposedDoc(aParentElement.IsInUncomposedDoc()), mSubtreeRootChanges(true) {} private: Document& mDoc; Element* const mBindingParent; const bool mInComposedDoc; const bool mInUncomposedDoc; // Whether the bind operation will change the subtree root of the content // we're binding. const bool mSubtreeRootChanges; Element* const mBindingParent; }; } // namespace dom Loading
dom/base/CharacterData.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -481,6 +481,8 @@ nsresult CharacterData::BindToTree(BindContext& aContext, nsINode& aParent) { UpdateEditableState(false); MOZ_ASSERT(OwnerDoc() == aParent.OwnerDoc(), "Bound to wrong document"); MOZ_ASSERT(IsInComposedDoc() == aContext.InComposedDoc()); MOZ_ASSERT(IsInUncomposedDoc() == aContext.InUncomposedDoc()); MOZ_ASSERT(&aParent == GetParentNode(), "Bound to wrong parent node"); MOZ_ASSERT(aContext.GetBindingParent() == GetBindingParent(), "Bound to wrong binding parent"); Loading
dom/base/Element.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -1758,6 +1758,8 @@ nsresult Element::BindToTree(BindContext& aContext, nsINode& aParent) { // postcondition asserts.... But we do want that, since things will // generally be quite broken when that happens. MOZ_ASSERT(OwnerDoc() == aParent.OwnerDoc(), "Bound to wrong document"); MOZ_ASSERT(IsInComposedDoc() == aContext.InComposedDoc()); MOZ_ASSERT(IsInUncomposedDoc() == aContext.InUncomposedDoc()); MOZ_ASSERT(&aParent == GetParentNode(), "Bound to wrong parent node"); MOZ_ASSERT(aContext.GetBindingParent() == GetBindingParent(), "Bound to wrong binding parent"); Loading