Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Unified Diff: chrome/browser/resources/ntp4/tile_page.js

Issue 7889002: Normalizing .dropEffect across platforms (specifically Windows). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/ntp4/tile_page.js
diff --git a/chrome/browser/resources/ntp4/tile_page.js b/chrome/browser/resources/ntp4/tile_page.js
index cf3a3bbdd3fd2c0714002e45b9ebaffb8136800f..b2b922288b4dfb650d869d8f7f8d550f5f7b5e60 100644
--- a/chrome/browser/resources/ntp4/tile_page.js
+++ b/chrome/browser/resources/ntp4/tile_page.js
@@ -158,7 +158,10 @@ cr.define('ntp4', function() {
if (this.landedOnTrash) {
this.dragClone.classList.add('deleting');
} else if (this.tilePage) {
- if (this.tilePage.selected && e.dataTransfer.dropEffect != 'copy') {
+ // HACK(dbeam): Until we fix dropEffect to the correct behavior it will
csilv 2011/09/13 18:57:24 Change this to a TODO comment instead.
Dan Beam 2011/09/13 22:19:13 Done.
+ // differ on windows - crbug.com/39399. That's why we use the custom
+ // .tilePage.lastDropEffect_ instead of e.dataTransfer.dropEffect.
+ if (this.tilePage.selected && this.tilePage.lastDropEffect_ != 'copy') {
// The drag clone can still be hidden from the last drag move event.
this.dragClone.hidden = false;
// The tile's contents may have moved following the respositioning;
@@ -927,9 +930,19 @@ cr.define('ntp4', function() {
if (newDragIndex < 0 || newDragIndex >= this.tileElements_.length)
newDragIndex = this.dragItemIndex_;
this.updateDropIndicator_(newDragIndex);
+
+ this.lastDropEffect_ = e.dataTransfer.dropEffect;
},
/**
+ * Normalizing dropEffect until all platform's implementations agree. Right
+ * now Windows resets the dropEffect on a 'drop' back to 'copy' (and
+ * disregards the previous state), so we're making a temporary shim to keep
+ * our own state for now based on each dragover.
+ */
+ lastDropEffect_: null,
csilv 2011/09/13 18:57:24 Is it necessary to do this? (ie, wont the default
Dan Beam 2011/09/13 22:19:13 Done.
+
+ /**
* Performs all actions necessary when the user completes a drop.
* @param {Event} e A mouseover event for the drag drop.
*/

Powered by Google App Engine
This is Rietveld 408576698