Hello playmobil,
I'd like you to do a code review. Please execute
g4 diff -c 9258672
or point your web browser to
http://mondrian/9258672
to review the following code:
Change 9258672 by [EMAIL PROTECTED] on 2008/12/04 12:01:30 *pending*
Implement desktop.acceptDrag on Safari.
This is the SF analogue of IE's 9224996 and Firefox's 9207912.
Note that "event.preventDefault()" was replaced by
"event.returnValue = false", since they seem to have the same
effect, and the latter is simpler.
PRESUBMIT=passed
R=playmobil
[EMAIL PROTECTED]
DELTA=17 (3 added, 10 deleted, 4 changed)
OCL=9258672
Affected files ...
... //depot/googleclient/gears/opensource/gears/desktop/desktop.cc#65 edit
...
//depot/googleclient/gears/opensource/gears/desktop/drag_and_drop_utils_sf.h#4
edit
...
//depot/googleclient/gears/opensource/gears/desktop/drag_and_drop_utils_sf.mm#5
edit
...
//depot/googleclient/gears/opensource/gears/test/manual/drag_and_drop_fake_event_attack.html#6
edit
17 delta lines: 3 added, 10 deleted, 4 changed
Also consider running:
g4 lint -c 9258672
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 9258672 by [EMAIL PROTECTED] on 2008/12/04 12:01:30 *pending*
Implement desktop.acceptDrag on Safari.
This is the SF analogue of IE's 9224996 and Firefox's 9207912.
Note that "event.preventDefault()" was replaced by
"event.returnValue = false", since they seem to have the same
effect, and the latter is simpler.
Affected files ...
... //depot/googleclient/gears/opensource/gears/desktop/desktop.cc#65 edit
...
//depot/googleclient/gears/opensource/gears/desktop/drag_and_drop_utils_sf.h#4
edit
...
//depot/googleclient/gears/opensource/gears/desktop/drag_and_drop_utils_sf.mm#5
edit
...
//depot/googleclient/gears/opensource/gears/test/manual/drag_and_drop_fake_event_attack.html#6
edit
==== //depot/googleclient/gears/opensource/gears/desktop/desktop.cc#65 -
/Users/nigeltao/devel/srcmacgears2/googleclient/gears/opensource/gears/desktop/desktop.cc
====
# action=edit type=text
--- googleclient/gears/opensource/gears/desktop/desktop.cc 2008-12-04
11:50:31.000000000 +1100
+++ googleclient/gears/opensource/gears/desktop/desktop.cc 2008-12-02
22:28:02.000000000 +1100
@@ -1051,14 +1051,10 @@
if (context->is_exception_set()) return;
std::string16 error;
-#if BROWSER_FF || (BROWSER_IE && !defined(OS_WINCE))
+#if BROWSER_FF || (BROWSER_IE && !defined(OS_WINCE)) || BROWSER_WEBKIT
::AcceptDrag(module_environment_.get(),
event_as_js_object.get(),
acceptance,
- &error);
-#elif BROWSER_WEBKIT
- ::AcceptDrag(module_environment_.get(),
- event_as_js_object.get(),
&error);
#else
// TODO(nigeltao): implement on Chromium.
====
//depot/googleclient/gears/opensource/gears/desktop/drag_and_drop_utils_sf.h#4
-
/Users/nigeltao/devel/srcmacgears2/googleclient/gears/opensource/gears/desktop/drag_and_drop_utils_sf.h
====
# action=edit type=text
--- googleclient/gears/opensource/gears/desktop/drag_and_drop_utils_sf.h
2008-12-01 13:36:46.000000000 +1100
+++ googleclient/gears/opensource/gears/desktop/drag_and_drop_utils_sf.h
2008-12-02 22:28:12.000000000 +1100
@@ -60,6 +60,7 @@
void AcceptDrag(ModuleEnvironment *module_environment,
JsObject *event,
+ bool acceptance,
std::string16 *error_out);
void GetDragData(ModuleEnvironment *module_environment,
====
//depot/googleclient/gears/opensource/gears/desktop/drag_and_drop_utils_sf.mm#5
-
/Users/nigeltao/devel/srcmacgears2/googleclient/gears/opensource/gears/desktop/drag_and_drop_utils_sf.mm
====
# action=edit type=text
--- googleclient/gears/opensource/gears/desktop/drag_and_drop_utils_sf.mm
2008-12-02 16:28:48.000000000 +1100
+++ googleclient/gears/opensource/gears/desktop/drag_and_drop_utils_sf.mm
2008-12-04 11:53:27.000000000 +1100
@@ -203,9 +203,11 @@
void AcceptDrag(ModuleEnvironment *module_environment,
JsObject *event,
+ bool acceptance,
std::string16 *error_out) {
- // TODO(nigeltao): port the following JavaScript to Objective-C / NPAPI.
- // evt.preventDefault();
+ event->SetPropertyBool(STRING16(L"returnValue"), false);
+ // TODO(nigeltao): Set the cursor to copy or none, depending on the value
+ // of acceptance.
}
void GetDragData(ModuleEnvironment *module_environment,
====
//depot/googleclient/gears/opensource/gears/test/manual/drag_and_drop_fake_event_attack.html#6
-
/Users/nigeltao/devel/srcmacgears2/googleclient/gears/opensource/gears/test/manual/drag_and_drop_fake_event_attack.html
====
# action=edit type=text
---
googleclient/gears/opensource/gears/test/manual/drag_and_drop_fake_event_attack.html
2008-12-04 11:50:31.000000000 +1100
+++
googleclient/gears/opensource/gears/test/manual/drag_and_drop_fake_event_attack.html
2008-12-02 22:29:54.000000000 +1100
@@ -76,13 +76,7 @@
}
document.getElementById('dropOutput').innerHTML = s;
}
- // TODO(nigeltao): replace all of these browser-specific quirks with
- // desktop.acceptDrag(evt, true);
- if (isFirefox || isIE) {
- desktop.acceptDrag(evt, true);
- } else if (isSafari) {
- evt.preventDefault();
- }
+ desktop.acceptDrag(evt, true);
};
}