This commit is contained in:
Benjamin Stover 2010-09-01 16:25:15 -07:00
Родитель 2c4499cfd2
Коммит d979e55395
3 изменённых файлов: 32 добавлений и 8 удалений

Просмотреть файл

@ -36,6 +36,11 @@
#filter substitution
// for browser.xml binding
pref("toolkit.browser.cachePixelX", 500);
pref("toolkit.browser.cachePixelY", 2000);
pref("toolkit.browser.recacheRatio", 50);
pref("toolkit.defaultChromeURI", "chrome://browser/content/browser.xul");
pref("general.useragent.compatMode.firefox", true);
pref("browser.chromeURL", "chrome://browser/content/");

Просмотреть файл

@ -771,7 +771,7 @@ MouseModule.prototype = {
traversing until we find something more well-behaved, as we
prefer default behaviour to whiny scrollers. */ }
}
return [scrollbox, qinterface, elem.customDragger || this._defaultDragger];
return [scrollbox, qinterface, (elem ? (elem.customDragger || this._defaultDragger) : null)];
},
/**

Просмотреть файл

@ -429,18 +429,28 @@
threshold when scrolling -->
<field name="_pendingPixelsX">0</field>
<field name="_pendingPixelsY">0</field>
<field name="_pendingThresholdX">0</field>
<field name="_pendingThresholdY">0</field>
<!-- This determines what percentage of cached pixels are not yet visible before the cache
is refreshed. For instance, if we recached at 50% and there are originally a total of
400px offscreen, we'd refresh once 200 of those pixels have been scrolled into
view. -->
<field name="_recacheRatio">0</field>
<!-- The cache viewport is what parts of content is cached in the parent process for
fast scrolling. This syncs that up with the current projection viewport. -->
<method name="_updateCacheViewport">
<body>
<![CDATA[
let offscreenX = this._pendingThresholdX / this._recacheRatio;
let offscreenY = this._pendingThresholdY / this._recacheRatio;
let frameLoader = this._frameLoader;
this.messageManager.sendAsyncMessage("Content:SetCacheViewport", {
x: (frameLoader.viewportScrollX - 200) / this._zoomLevel,
y: (frameLoader.viewportScrollY - 1250) / this._zoomLevel,
w: (this._viewportWidthInCSSPx + 400) / this._zoomLevel,
h: (this._viewportHeightInCSSPx + 2500) / this._zoomLevel
x: (frameLoader.viewportScrollX - offscreenX) / this._zoomLevel,
y: (frameLoader.viewportScrollY - offscreenY) / this._zoomLevel,
w: (this._viewportWidthInCSSPx + offscreenX * 2) / this._zoomLevel,
h: (this._viewportHeightInCSSPx + offscreenY * 2) / this._zoomLevel
});
this._pendingPixelsX = 0;
@ -528,6 +538,14 @@
<![CDATA[
this._frameLoader = this.QueryInterface(Components.interfaces.nsIFrameLoaderOwner).frameLoader;
let prefService = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService)
.QueryInterface(Components.interfaces.nsIPrefBranch2);
this._pendingThresholdX = Math.max(0, prefService.getIntPref("toolkit.browser.cachePixelX"));
this._pendingThresholdY = Math.max(0, prefService.getIntPref("toolkit.browser.cachePixelY"));
this._recacheRatio = Math.max(.01, Math.min(1, prefService.getIntPref("toolkit.browser.recacheRatio") / 100));
this.messageManager.loadFrameScript("chrome://browser/content/bindings/browser.js", true);
this.messageManager.addMessageListener("DOMTitleChanged", this);
this.messageManager.addMessageListener("DOMLinkAdded", this);
@ -829,13 +847,14 @@
frameLoader.scrollViewportBy(x, y);
// XXX comment this behavior
// Add this to the amount of pixels we have "used" from our cache. When this hits the
// threshold, we will refresh.
this._pendingPixelsX += x;
this._pendingPixelsY += y;
if ((Math.abs(this._pendingPixelsX) >= 150 || Math.abs(this._pendingPixelsY) >= 1000)) {
if (Math.abs(this._pendingPixelsX) >= this._pendingThresholdX ||
Math.abs(this._pendingPixelsY) >= this._pendingThresholdY)
this._updateCacheViewport();
}
]]>
</body>
</method>