mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset bcd726a4a258 (bug 725268)
This commit is contained in:
parent
e6e882d134
commit
481de717cf
@ -77,8 +77,11 @@ let gBrowserThumbnails = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_capture: function Thumbnails_capture(aBrowser) {
|
_capture: function Thumbnails_capture(aBrowser) {
|
||||||
if (this._shouldCapture(aBrowser))
|
if (this._shouldCapture(aBrowser)) {
|
||||||
this._pageThumbs.captureAndStore(aBrowser);
|
this._pageThumbs.capture(aBrowser.contentWindow, function (aInputStream) {
|
||||||
|
this._pageThumbs.store(aBrowser.currentURI.spec, aInputStream);
|
||||||
|
}.bind(this));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_delayedCapture: function Thumbnails_delayedCapture(aBrowser) {
|
_delayedCapture: function Thumbnails_delayedCapture(aBrowser) {
|
||||||
|
@ -135,24 +135,16 @@ let gTransformation = {
|
|||||||
* callback - the callback to call when finished
|
* callback - the callback to call when finished
|
||||||
*/
|
*/
|
||||||
rearrangeSites: function Transformation_rearrangeSites(aSites, aOptions) {
|
rearrangeSites: function Transformation_rearrangeSites(aSites, aOptions) {
|
||||||
|
let batch;
|
||||||
let cells = gGrid.cells;
|
let cells = gGrid.cells;
|
||||||
let callback = aOptions && aOptions.callback;
|
let callback = aOptions && aOptions.callback;
|
||||||
let unfreeze = aOptions && aOptions.unfreeze;
|
let unfreeze = aOptions && aOptions.unfreeze;
|
||||||
|
|
||||||
let batch = new Batch(function () {
|
|
||||||
if (aOptions && "callback" in aOptions)
|
|
||||||
aOptions.callback();
|
|
||||||
|
|
||||||
gGrid.unlock();
|
|
||||||
});
|
|
||||||
|
|
||||||
if (callback) {
|
if (callback) {
|
||||||
batch = new Batch(callback);
|
batch = new Batch(callback);
|
||||||
callback = function () batch.pop();
|
callback = function () batch.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
gGrid.lock();
|
|
||||||
|
|
||||||
aSites.forEach(function (aSite, aIndex) {
|
aSites.forEach(function (aSite, aIndex) {
|
||||||
// Do not re-arrange empty cells or the dragged site.
|
// Do not re-arrange empty cells or the dragged site.
|
||||||
if (!aSite || aSite == gDrag.draggedSite)
|
if (!aSite || aSite == gDrag.draggedSite)
|
||||||
|
@ -20,34 +20,29 @@ let gUpdater = {
|
|||||||
// Find all sites that remain in the grid.
|
// Find all sites that remain in the grid.
|
||||||
let sites = this._findRemainingSites(links);
|
let sites = this._findRemainingSites(links);
|
||||||
|
|
||||||
Grid.lock();
|
let self = this;
|
||||||
|
|
||||||
// Remove sites that are no longer in the grid.
|
// Remove sites that are no longer in the grid.
|
||||||
this._removeLegacySites(sites, function () {
|
this._removeLegacySites(sites, function () {
|
||||||
// Freeze all site positions so that we can move their DOM nodes around
|
// Freeze all site positions so that we can move their DOM nodes around
|
||||||
// without any visual impact.
|
// without any visual impact.
|
||||||
this._freezeSitePositions(sites);
|
self._freezeSitePositions(sites);
|
||||||
|
|
||||||
// Move the sites' DOM nodes to their new position in the DOM. This will
|
// Move the sites' DOM nodes to their new position in the DOM. This will
|
||||||
// have no visual effect as all the sites have been frozen and will
|
// have no visual effect as all the sites have been frozen and will
|
||||||
// remain in their current position.
|
// remain in their current position.
|
||||||
this._moveSiteNodes(sites);
|
self._moveSiteNodes(sites);
|
||||||
|
|
||||||
// Now it's time to animate the sites actually moving to their new
|
// Now it's time to animate the sites actually moving to their new
|
||||||
// positions.
|
// positions.
|
||||||
this._rearrangeSites(sites, function () {
|
self._rearrangeSites(sites, function () {
|
||||||
// Try to fill empty cells and finish.
|
// Try to fill empty cells and finish.
|
||||||
this._fillEmptyCells(links, function () {
|
self._fillEmptyCells(links, aCallback);
|
||||||
gGrid.unlock();
|
|
||||||
|
|
||||||
if (aCallback)
|
|
||||||
aCallback();
|
|
||||||
});
|
|
||||||
|
|
||||||
// Update other pages that might be open to keep them synced.
|
// Update other pages that might be open to keep them synced.
|
||||||
gAllPages.update(gPage);
|
gAllPages.update(gPage);
|
||||||
}.bind(this));
|
});
|
||||||
}.bind(this));
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -104,12 +104,14 @@ let PageThumbs = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Captures a thumbnail for the given browser and stores it to the cache.
|
* Stores the image data contained in the given canvas to the underlying
|
||||||
* @param aBrowser The browser to capture a thumbnail for.
|
* storage.
|
||||||
* @param aCallback The function to be called when finished (optional).
|
* @param aKey The key to use for the storage.
|
||||||
|
* @param aInputStream The input stream containing the image data.
|
||||||
|
* @param aCallback The function to be called when the canvas data has been
|
||||||
|
* stored (optional).
|
||||||
*/
|
*/
|
||||||
captureAndStore: function PageThumbs_captureAndStore(aBrowser, aCallback) {
|
store: function PageThumbs_store(aKey, aInputStream, aCallback) {
|
||||||
this.capture(aBrowser.contentWindow, function (aInputStream) {
|
|
||||||
let telemetryStoreTime = new Date();
|
let telemetryStoreTime = new Date();
|
||||||
|
|
||||||
function finish(aSuccessful) {
|
function finish(aSuccessful) {
|
||||||
@ -123,7 +125,7 @@ let PageThumbs = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get a writeable cache entry.
|
// Get a writeable cache entry.
|
||||||
PageThumbsCache.getWriteEntry(aBrowser.currentURI.spec, function (aEntry) {
|
PageThumbsCache.getWriteEntry(aKey, function (aEntry) {
|
||||||
if (!aEntry) {
|
if (!aEntry) {
|
||||||
finish(false);
|
finish(false);
|
||||||
return;
|
return;
|
||||||
@ -141,7 +143,6 @@ let PageThumbs = {
|
|||||||
finish(success);
|
finish(success);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -94,12 +94,16 @@ function whenLoaded(aElement, aCallback) {
|
|||||||
* @param aMessage The info message to print when comparing the pixel color.
|
* @param aMessage The info message to print when comparing the pixel color.
|
||||||
*/
|
*/
|
||||||
function captureAndCheckColor(aRed, aGreen, aBlue, aMessage) {
|
function captureAndCheckColor(aRed, aGreen, aBlue, aMessage) {
|
||||||
let browser = gBrowser.selectedBrowser;
|
let window = gBrowser.selectedTab.linkedBrowser.contentWindow;
|
||||||
|
|
||||||
// Capture the screenshot.
|
// Capture the screenshot.
|
||||||
PageThumbs.captureAndStore(browser, function () {
|
PageThumbs.capture(window, function (aData) {
|
||||||
|
let key = Date.now();
|
||||||
|
|
||||||
|
// Store the thumbnail in the cache.
|
||||||
|
PageThumbs.store(key, aData, function () {
|
||||||
let width = 100, height = 100;
|
let width = 100, height = 100;
|
||||||
let thumb = PageThumbs.getThumbnailURL(browser.currentURI.spec, width, height);
|
let thumb = PageThumbs.getThumbnailURL(key, width, height);
|
||||||
|
|
||||||
getXULDocument(function (aDocument) {
|
getXULDocument(function (aDocument) {
|
||||||
let htmlns = "http://www.w3.org/1999/xhtml";
|
let htmlns = "http://www.w3.org/1999/xhtml";
|
||||||
@ -120,6 +124,7 @@ function captureAndCheckColor(aRed, aGreen, aBlue, aMessage) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user