зеркало из https://github.com/mozilla/gecko-dev.git
Bug 570823 - [e10s] Add scrollTo / scrollBy message based API to browser binding [r=vingtetun]
This commit is contained in:
Родитель
37e46e1282
Коммит
839342cd9c
|
@ -551,7 +551,8 @@ BrowserView.prototype = {
|
|||
return;
|
||||
|
||||
// XXX shouldn't really make calls to Browser
|
||||
Browser.scrollContentToBrowser();
|
||||
let json = aMessage.json;
|
||||
Browser.scrollContentToBrowser(json.scrollX, json.scrollY);
|
||||
},
|
||||
|
||||
_ignorePageScroll: false,
|
||||
|
|
|
@ -302,3 +302,24 @@ let DOMEvents = {
|
|||
};
|
||||
|
||||
DOMEvents.init();
|
||||
|
||||
let ContentScroll = {
|
||||
init: function() {
|
||||
addMessageListener("Content:ScrollTo", this);
|
||||
addMessageListener("Content:ScrollBy", this);
|
||||
},
|
||||
|
||||
receiveMessage: function(aMessage) {
|
||||
let json = aMessage.json;
|
||||
switch (aMessage.name) {
|
||||
case "Content:ScrollTo":
|
||||
content.scrollTo(json.x, json.y);
|
||||
break;
|
||||
case "Content:ScrollBy":
|
||||
content.scrollBy(json.dx, json.dy);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ContentScroll.init();
|
||||
|
|
|
@ -102,7 +102,7 @@
|
|||
case "pageshow":
|
||||
this.onPageShow(aMessage);
|
||||
|
||||
if (this.mIconURL == "")
|
||||
if (this.mIconURL == "" && this._documentURI)
|
||||
this.mIconURL = this.documentURI.prePath + "/favicon.ico";
|
||||
break;
|
||||
|
||||
|
@ -326,19 +326,8 @@
|
|||
}
|
||||
// Delete the feeds cache if we're hiding the topmost page
|
||||
// (as opposed to one of its iframes).
|
||||
// XXX e10s contentDocument is not accessible, we need to use
|
||||
// outerWindowID
|
||||
if (this.feeds && aMessage.target == this.contentDocument)
|
||||
if (this.feeds && aMessage.target == this)
|
||||
this.feeds = null;
|
||||
if (!this.docShell || !this.fastFind)
|
||||
return;
|
||||
|
||||
var tabBrowser = this.getTabBrowser();
|
||||
if (!tabBrowser || tabBrowser.mCurrentBrowser == this)
|
||||
this.fastFind.setDocShell(this.docShell);
|
||||
|
||||
if (this._scrollable)
|
||||
this._autoScrollPopup.hidePopup();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
|
|
@ -688,18 +688,16 @@ var Browser = {
|
|||
let browser = this.selectedBrowser;
|
||||
if (browser) {
|
||||
let scroll = Browser.getScrollboxPosition(Browser.contentScrollboxScroller);
|
||||
let windowUtils = BrowserView.Util.getBrowserDOMWindowUtils(browser);
|
||||
browser.contentWindow.scrollTo(scroll.x, scroll.y);
|
||||
browser.messageManager.sendAsyncMessage("Content:ScrollTo", { x: scroll.x, y: scroll.y });
|
||||
}
|
||||
},
|
||||
|
||||
/** Update viewport to location of browser's scrollbars. */
|
||||
scrollContentToBrowser: function scrollContentToBrowser() {
|
||||
let pos = BrowserView.Util.getContentScrollOffset(this.selectedBrowser);
|
||||
if (pos.y != 0)
|
||||
scrollContentToBrowser: function scrollContentToBrowser(aScrollX, aScrollY) {
|
||||
if (aScrollY != 0)
|
||||
Browser.hideTitlebar();
|
||||
|
||||
Browser.contentScrollboxScroller.scrollTo(pos.x, pos.y);
|
||||
Browser.contentScrollboxScroller.scrollTo(aScrollX, aScrollY);
|
||||
this._browserView.onAfterVisibleMove();
|
||||
},
|
||||
|
||||
|
@ -2728,7 +2726,7 @@ ProgressController.prototype = {
|
|||
Util.executeSoon(function() {
|
||||
let scroll = Browser.getScrollboxPosition(Browser.contentScrollboxScroller);
|
||||
if (scroll.isZero())
|
||||
Browser.scrollContentToBrowser();
|
||||
Browser.scrollContentToBrowser(0, 0);
|
||||
});
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -254,7 +254,6 @@ Coalescer.prototype = {
|
|||
}
|
||||
case "MozApplicationManifest": {
|
||||
let doc = aEvent.originalTarget;
|
||||
|
||||
sendAsyncMessage("Browser:MozApplicationManifest", {
|
||||
location: doc.documentURIObject.spec,
|
||||
manifest: doc.documentElement.getAttribute("manifest"),
|
||||
|
@ -263,7 +262,8 @@ Coalescer.prototype = {
|
|||
break;
|
||||
}
|
||||
case "scroll":
|
||||
sendSyncMessage("Browser:PageScroll", {});
|
||||
let scroll = Util.getScrollOffset(content);
|
||||
sendSyncMessage("Browser:PageScroll", { scrollX: scroll.x, scrollY: scroll.y });
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
|
Загрузка…
Ссылка в новой задаче