mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 851130 - Repush misc. code cleanup and added support for bcast_preciseInput and bcast_windowState in start tabs. (First push was empty.) r=me
This commit is contained in:
parent
5c66e4fd09
commit
1ff21471de
@ -32,6 +32,12 @@
|
|||||||
|
|
||||||
<script type="application/javascript" src="chrome://browser/content/startui-scripts.js"/>
|
<script type="application/javascript" src="chrome://browser/content/startui-scripts.js"/>
|
||||||
|
|
||||||
|
<!-- mimic broadcasts in browser.xul. note browser.xul broadcasters do not propagate down here! -->
|
||||||
|
<broadcasterset id="broadcasterset">
|
||||||
|
<broadcaster id="bcast_preciseInput" input="precise"/>
|
||||||
|
<broadcaster id="bcast_windowState" viewstate=""/>
|
||||||
|
</broadcasterset>
|
||||||
|
|
||||||
<hbox id="start-container" flex="1" observes="bcast_windowState" class="meta content-height content-width">
|
<hbox id="start-container" flex="1" observes="bcast_windowState" class="meta content-height content-width">
|
||||||
<scrollbox id="start-scrollbox" observes="bcast_preciseInput" flex="1">
|
<scrollbox id="start-scrollbox" observes="bcast_preciseInput" flex="1">
|
||||||
<vbox id="start-topsites" class="meta-section" expanded="true">
|
<vbox id="start-topsites" class="meta-section" expanded="true">
|
||||||
|
@ -9,10 +9,15 @@ Cu.import("resource://gre/modules/Services.jsm");
|
|||||||
var StartUI = {
|
var StartUI = {
|
||||||
get startUI() { return document.getElementById("start-container"); },
|
get startUI() { return document.getElementById("start-container"); },
|
||||||
|
|
||||||
get maxResultsPerSection() {
|
get maxResultsPerSection() {
|
||||||
return Services.prefs.getIntPref("browser.display.startUI.maxresults");
|
return Services.prefs.getIntPref("browser.display.startUI.maxresults");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
get chromeWin() {
|
||||||
|
// XXX Not e10s friendly. We use this in a few places.
|
||||||
|
return Services.wm.getMostRecentWindow('navigator:browser');
|
||||||
|
},
|
||||||
|
|
||||||
init: function init() {
|
init: function init() {
|
||||||
this.startUI.addEventListener("contextmenu", this, false);
|
this.startUI.addEventListener("contextmenu", this, false);
|
||||||
this.startUI.addEventListener("click", this, false);
|
this.startUI.addEventListener("click", this, false);
|
||||||
@ -27,6 +32,10 @@ var StartUI = {
|
|||||||
BookmarksStartView.show();
|
BookmarksStartView.show();
|
||||||
HistoryStartView.show();
|
HistoryStartView.show();
|
||||||
RemoteTabsStartView.show();
|
RemoteTabsStartView.show();
|
||||||
|
|
||||||
|
this.chromeWin.addEventListener("MozPrecisePointer", this, true);
|
||||||
|
this.chromeWin.addEventListener("MozImprecisePointer", this, true);
|
||||||
|
Services.obs.addObserver(this, "metro_viewstate_changed", false);
|
||||||
},
|
},
|
||||||
|
|
||||||
uninit: function() {
|
uninit: function() {
|
||||||
@ -38,11 +47,12 @@ var StartUI = {
|
|||||||
HistoryStartView.uninit();
|
HistoryStartView.uninit();
|
||||||
if (RemoteTabsStartView)
|
if (RemoteTabsStartView)
|
||||||
RemoteTabsStartView.uninit();
|
RemoteTabsStartView.uninit();
|
||||||
},
|
|
||||||
|
|
||||||
get chromeWin() {
|
if (this.chromeWin) {
|
||||||
// XXX Not e10s friendly, we use this in a few places.
|
this.chromeWin.removeEventListener("MozPrecisePointer", this, true);
|
||||||
return Services.wm.getMostRecentWindow('navigator:browser');
|
this.chromeWin.removeEventListener("MozImprecisePointer", this, true);
|
||||||
|
}
|
||||||
|
Services.obs.removeObserver(this, "metro_viewstate_changed");
|
||||||
},
|
},
|
||||||
|
|
||||||
goToURI: function (aURI) {
|
goToURI: function (aURI) {
|
||||||
@ -84,16 +94,20 @@ var StartUI = {
|
|||||||
|
|
||||||
handleEvent: function handleEvent(aEvent) {
|
handleEvent: function handleEvent(aEvent) {
|
||||||
switch (aEvent.type) {
|
switch (aEvent.type) {
|
||||||
|
case "MozPrecisePointer":
|
||||||
|
document.getElementById("bcast_preciseInput").setAttribute("input", "precise");
|
||||||
|
break;
|
||||||
|
case "MozImprecisePointer":
|
||||||
|
document.getElementById("bcast_preciseInput").setAttribute("input", "imprecise");
|
||||||
|
break;
|
||||||
case "contextmenu":
|
case "contextmenu":
|
||||||
let event = document.createEvent("Events");
|
let event = document.createEvent("Events");
|
||||||
event.initEvent("MozEdgeUICompleted", true, false);
|
event.initEvent("MozEdgeUICompleted", true, false);
|
||||||
window.dispatchEvent(event);
|
window.dispatchEvent(event);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "click":
|
case "click":
|
||||||
this.onClick(aEvent);
|
this.onClick(aEvent);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "MozMousePixelScroll":
|
case "MozMousePixelScroll":
|
||||||
let scroller = this.getScrollBoxObject();
|
let scroller = this.getScrollBoxObject();
|
||||||
if (this.startUI.getAttribute("viewstate") == "snapped") {
|
if (this.startUI.getAttribute("viewstate") == "snapped") {
|
||||||
@ -106,5 +120,34 @@ var StartUI = {
|
|||||||
aEvent.stopPropagation();
|
aEvent.stopPropagation();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_adjustDOMforViewState: function() {
|
||||||
|
if (this.chromeWin.MetroUtils.immersive) {
|
||||||
|
let currViewState = "";
|
||||||
|
switch (this.chromeWin.MetroUtils.snappedState) {
|
||||||
|
case Ci.nsIWinMetroUtils.fullScreenLandscape:
|
||||||
|
currViewState = "landscape";
|
||||||
|
break;
|
||||||
|
case Ci.nsIWinMetroUtils.fullScreenPortrait:
|
||||||
|
currViewState = "portrait";
|
||||||
|
break;
|
||||||
|
case Ci.nsIWinMetroUtils.filled:
|
||||||
|
currViewState = "filled";
|
||||||
|
break;
|
||||||
|
case Ci.nsIWinMetroUtils.snapped:
|
||||||
|
currViewState = "snapped";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
document.getElementById("bcast_windowState").setAttribute("viewstate", currViewState);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
observe: function (aSubject, aTopic, aData) {
|
||||||
|
switch (aTopic) {
|
||||||
|
case "metro_viewstate_changed":
|
||||||
|
this._adjustDOMforViewState();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user