Bug 1480970 - Remove DOMWindowUtils fields from urlbarBindings.xml. r?dao
MozReview-Commit-ID: 2hq8HSUJ3nv
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -166,20 +166,16 @@ file, You can obtain one at http://mozil
// Null out the one-offs' popup and textbox so that it cleans up its
// internal state for both. Most importantly, it removes the event
// listeners that it added to both.
this.popup.oneOffSearchButtons.popup = null;
this.popup.oneOffSearchButtons.textbox = null;
]]></destructor>
- <field name="DOMWindowUtils">
- window.windowUtils;
- </field>
-
<field name="scheme" readonly="true">
document.getAnonymousElementByAttribute(this, "anonid", "scheme");
</field>
<field name="goButton">
document.getAnonymousElementByAttribute(this, "anonid", "urlbar-go-button");
</field>
@@ -588,17 +584,17 @@ file, You can obtain one at http://mozil
// the first strong directional character, we set the overflow
// appropriately.
this.selectionStart = this.selectionEnd = 0;
window.requestAnimationFrame(() => {
// Check for re-entrance. On focus change this formatting code is
// invoked regardless, thus this should be enough.
if (this._formattingInstance != instance)
return;
- let isDomainRTL = this.DOMWindowUtils.getDirectionFromText(domain);
+ let isDomainRTL = window.windowUtils.getDirectionFromText(domain);
// In the future, for example in bug 525831, we may add a forceRTL
// char just after the domain, and in such a case we should not
// scroll to the left.
if (isDomainRTL && value[preDomain.length + domain.length] != "\u200E") {
this.inputField.scrollLeft = this.inputField.scrollLeftMax;
}
});
@@ -1886,20 +1882,16 @@ file, You can obtain one at http://mozil
<implementation>
<!--
For performance reasons we want to limit the size of the text runs we
build and show to the user.
-->
<field name="textRunsMaxLen">255</field>
- <field name="DOMWindowUtils">
- window.windowUtils;
- </field>
-
<field name="_maxResults">0</field>
<field name="_bundle" readonly="true">
Cc["@mozilla.org/intl/stringbundle;1"].
getService(Ci.nsIStringBundleService).
createBundle("chrome://browser/locale/places/places.properties");
</field>
@@ -2092,58 +2084,58 @@ file, You can obtain one at http://mozil
if (!this.style.direction) {
this.style.direction =
aElement.ownerGlobal.getComputedStyle(aElement).direction;
}
let popupDirection = this.style.direction;
// Make the popup span the width of the window. First, set its width.
let documentRect =
- this.DOMWindowUtils
+ window.windowUtils
.getBoundsWithoutFlushing(window.document.documentElement);
let width = documentRect.right - documentRect.left;
this.setAttribute("width", width);
// Now make its starting margin negative so that its leading edge
// aligns with the window border.
let elementRect =
- this.DOMWindowUtils.getBoundsWithoutFlushing(aElement);
+ window.windowUtils.getBoundsWithoutFlushing(aElement);
if (popupDirection == "rtl") {
let offset = elementRect.right - documentRect.right;
this.style.marginRight = offset + "px";
} else {
let offset = documentRect.left - elementRect.left;
this.style.marginLeft = offset + "px";
}
// Keep the popup items' site icons aligned with the urlbar's identity
// icon if it's not too far from the edge of the window. We define
// "too far" as "more than 30% of the window's width AND more than
// 250px". Do this *before* adding any items because when the new
// value of the margins are different from the previous value, over-
// and underflow must be handled for each item already in the popup.
let needsHandleOverUnderflow = false;
let boundToCheck = popupDirection == "rtl" ? "right" : "left";
- let inputRect = this.DOMWindowUtils.getBoundsWithoutFlushing(aInput);
+ let inputRect = window.windowUtils.getBoundsWithoutFlushing(aInput);
let startOffset = Math.abs(inputRect[boundToCheck] - documentRect[boundToCheck]);
let alignSiteIcons = startOffset / width <= 0.3 || startOffset <= 250;
if (alignSiteIcons) {
// Calculate the end margin if we have a start margin.
let boundToCheckEnd = popupDirection == "rtl" ? "left" : "right";
let endOffset = Math.abs(inputRect[boundToCheckEnd] -
documentRect[boundToCheckEnd]);
if (endOffset > startOffset * 2) {
// Provide more space when aligning would result in an unbalanced
// margin. This allows the location bar to be moved to the start
// of the navigation toolbar to reclaim space for results.
endOffset = startOffset;
}
let identityIcon = document.getElementById("identity-icon");
let identityRect =
- this.DOMWindowUtils.getBoundsWithoutFlushing(identityIcon);
+ window.windowUtils.getBoundsWithoutFlushing(identityIcon);
let start = popupDirection == "rtl" ?
documentRect.right - identityRect.right :
identityRect.left;
if (!this.margins || start != this.margins.start ||
endOffset != this.margins.end ||
width != this.margins.width) {
this.margins = { start, end: endOffset, width };
needsHandleOverUnderflow = true;
@@ -2181,18 +2173,18 @@ file, You can obtain one at http://mozil
// Not critical for the urlbar functionality, just report the error.
Cu.reportError(ex);
}
// Position the popup below the navbar. To get the y-coordinate,
// which is an offset from the bottom of the input, subtract the
// bottom of the navbar from the buttom of the input.
let yOffset = Math.round(
- this.DOMWindowUtils.getBoundsWithoutFlushing(document.getElementById("nav-bar")).bottom -
- this.DOMWindowUtils.getBoundsWithoutFlushing(aInput).bottom);
+ window.windowUtils.getBoundsWithoutFlushing(document.getElementById("nav-bar")).bottom -
+ window.windowUtils.getBoundsWithoutFlushing(aInput).bottom);
this.openPopup(aElement, "after_start", 0, yOffset, false, false);
// Do this immediately after we've requested the popup to open. This
// will cause sync reflows but prevents flickering.
if (needsHandleOverUnderflow) {
for (let item of this.richlistbox.childNodes) {
item.handleOverUnderflow();