Hello nigeltao,
I'd like you to do a code review. Please execute
g4 diff -c 12157488
or point your web browser to
http://mondrian/12157488
(this changelist has been uploaded to Mondrian)
to review the following code:
Change 12157488 by n...@noel-gears on 2009/07/31 18:51:17 *pending*
Fix file drag drop for Firefox 3.5, which now uses 1) the HTML5-
defined event names "dragleave" and "drop", and 2) NS_DRAG_EVENT
in the NSEvent type for drag events.
Additional Tests:
FireFox 2.0.0.12 XP/Vista
FireFox 2.0.0.20 XP/Vista
FireFox 3.0 XP/Vista
FireFox 3.0.12 XP/Vista
FireFox 3.5.1 XP/Vista
OCL=12157488
TEST=pulse 632
PRESUBMIT=passed
R=nigeltao
[email protected]
DELTA=21 (21 added, 0 deleted, 0 changed)
OCL=12157488
Affected files ...
...
//depot/googleclient/gears/opensource/gears/desktop/drag_and_drop_utils_ff.cc#23
edit
21 delta lines: 21 added, 0 deleted, 0 changed
Also consider running:
g4 lint -c 12157488
which verifies that the changelist doesn't introduce new style violations.
If you can't do the review, please let me know as soon as possible. During
your review, please ensure that all new code has corresponding unit tests and
that existing unit tests are updated appropriately. Visit
http://www/eng/code_review.html for more information.
This is a semiautomated message from "g4 mail". Complaints or suggestions?
Mail [email protected].
Change 12157488 by n...@noel-gears on 2009/07/31 18:51:17 *pending*
Fix file drag drop for Firefox 3.5, which now uses 1) the HTML5-
defined event names "dragleave" and "drop", and 2) NS_DRAG_EVENT
in the NSEvent type for drag events.
Additional Tests:
FireFox 2.0.0.12 XP/Vista
FireFox 2.0.0.20 XP/Vista
FireFox 3.0 XP/Vista
FireFox 3.0.12 XP/Vista
FireFox 3.5.1 XP/Vista
OCL=12157488
TEST=pulse 632
OCL=12157488
Affected files ...
...
//depot/googleclient/gears/opensource/gears/desktop/drag_and_drop_utils_ff.cc#23
edit
====
//depot/googleclient/gears/opensource/gears/desktop/drag_and_drop_utils_ff.cc#23
-
c:\Users\noel.GOOGLE\src-gears/googleclient/gears/opensource/gears/desktop/drag_and_drop_utils_ff.cc
====
# action=edit type=text
--- googleclient/gears/opensource/gears/desktop/drag_and_drop_utils_ff.cc
2009-07-31 16:40:54.000000000 +1000
+++ googleclient/gears/opensource/gears/desktop/drag_and_drop_utils_ff.cc
2009-08-03 11:32:51.000000000 +1000
@@ -122,6 +122,11 @@
static const nsString kDragExitAsString(STRING16(L"dragexit"));
static const nsString kDragDropAsString(STRING16(L"dragdrop"));
+#if BROWSER_FF31
+// Firefox 3.5 (and above) use the HTML5 event names: "dragleave", "drop".
+static const nsString kDragLeaveAsString(STRING16(L"dragleave"));
+static const nsString kDropAsString(STRING16(L"drop"));
+#endif
// Given a DOMEvent (as a JsObject), return what type of event we are in,
// also checking that we are in event dispatch (and not, for example, a
@@ -153,9 +158,16 @@
if (NS_FAILED(nr)) { return DRAG_AND_DROP_EVENT_INVALID; }
#endif
+#if BROWSER_FF31
+ if (ns_event->eventStructType != NS_DRAG_EVENT) {
+ return DRAG_AND_DROP_EVENT_INVALID;
+ }
+#else
if (ns_event->eventStructType != NS_MOUSE_EVENT) {
return DRAG_AND_DROP_EVENT_INVALID;
}
+#endif
+
nsMouseEvent *ns_mouse_event = static_cast<nsMouseEvent*>(ns_event);
if (!ns_mouse_event->widget) { return DRAG_AND_DROP_EVENT_INVALID; }
@@ -261,11 +273,20 @@
}
#endif
return DRAG_AND_DROP_EVENT_DRAGENTER;
+#if BROWSER_FF31
+ } else if (event_type.Equals(kDragLeaveAsString)) {
+ return DRAG_AND_DROP_EVENT_DRAGLEAVE;
+ } else if (event_type.Equals(kDropAsString)) {
+ return DRAG_AND_DROP_EVENT_DROP;
+ }
+#else
} else if (event_type.Equals(kDragExitAsString)) {
return DRAG_AND_DROP_EVENT_DRAGLEAVE;
} else if (event_type.Equals(kDragDropAsString)) {
return DRAG_AND_DROP_EVENT_DROP;
}
+#endif
+
return DRAG_AND_DROP_EVENT_INVALID;
}