Bug 895359 - Pass draggedSite to updateGrid() to avoid intermittent Windows failures r=jaws

This commit is contained in:
Tim Taubert 2014-02-14 11:15:51 +01:00
parent a682dda2c2
commit ede1c3e8e1
3 changed files with 8 additions and 14 deletions

View File

@ -57,7 +57,7 @@ let gDrop = {
this._cancelDelayedArrange();
// Update the grid and move all sites to their new places.
gUpdater.updateGrid();
gUpdater.updateGrid(gDrag.draggedSite);
},
/**
@ -145,6 +145,6 @@ let gDrop = {
if (aCell)
sites = gDropPreview.rearrange(aCell);
gTransformation.rearrangeSites(sites, {unfreeze: !aCell});
gTransformation.rearrangeSites(sites, gDrag.draggedSite, {unfreeze: !aCell});
}
};

View File

@ -137,10 +137,11 @@ let gTransformation = {
* Rearranges a given array of sites and moves them to their new positions or
* fades in/out new/removed sites.
* @param aSites An array of sites to rearrange.
* @param aDraggedSite The currently dragged site, may be null.
* @param aOptions Set of options (see below).
* unfreeze - unfreeze the site after rearranging
*/
rearrangeSites: function (aSites, aOptions) {
rearrangeSites: function (aSites, aDraggedSite, aOptions) {
let self = this;
let cells = gGrid.cells;
let unfreeze = aOptions && aOptions.unfreeze;
@ -149,7 +150,7 @@ let gTransformation = {
let index = 0;
for (let site of aSites) {
if (site && site !== gDrag.draggedSite) {
if (site && site !== aDraggedSite) {
if (!cells[index]) {
// The site disappeared from the grid, hide it.
yield self.hideSite(site);

View File

@ -13,7 +13,7 @@ let gUpdater = {
* Updates the current grid according to its pinned and blocked sites.
* This removes old, moves existing and creates new sites to fill gaps.
*/
updateGrid: function Updater_updateGrid() {
updateGrid: function Updater_updateGrid(draggedSite = null) {
let links = gLinks.getLinks().slice(0, gGrid.cells.length);
// Find all sites that remain in the grid.
@ -32,7 +32,8 @@ let gUpdater = {
// Now it's time to animate the sites actually moving to their new
// positions.
this._rearrangeSites(sites).then(() => {
let opts = {unfreeze: true};
gTransformation.rearrangeSites(sites, draggedSite, opts).then(() => {
// Try to fill empty cells and finish.
this._fillEmptyCells(links);
@ -106,14 +107,6 @@ let gUpdater = {
}, this);
},
/**
* Rearranges the given sites and slides them to their new positions.
* @param aSites The array of sites to re-arrange.
*/
_rearrangeSites: function (aSites) {
return gTransformation.rearrangeSites(aSites, {unfreeze: true});
},
/**
* Removes all sites from the grid that are not in the given links array or
* exceed the grid.