зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1821985 - Use top chrome window to create select dropdown. r=Gijs
Some chrome pages can be zoomed and the select code expects coordinates in unzoomed CSS pixels. The easiest fix is to just use the top-level chrome window which isn't ever zoomed to contain the select popup. This also makes it able to use native styles on GTK / macOS / Win7. Differential Revision: https://phabricator.services.mozilla.com/D173436
This commit is contained in:
Родитель
eff5bd5860
Коммит
226a917fb1
|
@ -285,8 +285,6 @@ export var SelectParentHelper = {
|
|||
this._selectRect = rect;
|
||||
this._registerListeners(menulist.menupopup);
|
||||
|
||||
let win = browser.ownerGlobal;
|
||||
|
||||
// Set the maximum height to show exactly MAX_ROWS items.
|
||||
let menupopup = menulist.menupopup;
|
||||
let firstItem = menupopup.firstElementChild;
|
||||
|
@ -294,6 +292,7 @@ export var SelectParentHelper = {
|
|||
firstItem = firstItem.nextElementSibling;
|
||||
}
|
||||
|
||||
let win = menulist.ownerGlobal;
|
||||
if (firstItem) {
|
||||
let itemHeight = firstItem.getBoundingClientRect().height;
|
||||
|
||||
|
@ -718,12 +717,11 @@ export var SelectParentHelper = {
|
|||
|
||||
export class SelectParent extends JSWindowActorParent {
|
||||
get relevantBrowser() {
|
||||
let bc = this.manager.browsingContext;
|
||||
return bc.isContent ? bc.topFrameElement : bc.embedderElement;
|
||||
return this.browsingContext.top.embedderElement;
|
||||
}
|
||||
|
||||
get _document() {
|
||||
return this.relevantBrowser.ownerDocument;
|
||||
return this.browsingContext.topChromeWindow.document;
|
||||
}
|
||||
|
||||
get _menulist() {
|
||||
|
@ -772,7 +770,7 @@ export class SelectParent extends JSWindowActorParent {
|
|||
data.selectedIndex,
|
||||
// We only want to apply the full zoom. The text zoom is already
|
||||
// applied in the font-size.
|
||||
this.manager.browsingContext.fullZoom,
|
||||
this.browsingContext.fullZoom,
|
||||
data.custom && lazy.CUSTOM_STYLING_ENABLED,
|
||||
data.isDarkBackground,
|
||||
data.defaultStyle,
|
||||
|
|
Загрузка…
Ссылка в новой задаче