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

Unified Diff: chrome/browser/resources/shared/js/util.js

Issue 10796115: Enabled Selection (ctrl-A) on login password (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Links + Oobe Created 8 years, 5 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/shared/js/util.js
diff --git a/chrome/browser/resources/shared/js/util.js b/chrome/browser/resources/shared/js/util.js
index c77fc3434d9707811ceb8520443361bfc1e7c5a9..a1d9bac3fb347d0de7cd3b80697bbb3d01ae4278 100644
--- a/chrome/browser/resources/shared/js/util.js
+++ b/chrome/browser/resources/shared/js/util.js
@@ -107,17 +107,26 @@ function swapDomNodes(a, b) {
}
/**
- * Disables text selection and dragging.
+ * Disables text selection and dragging, with optional whitelist callbacks.
Dan Beam 2012/07/24 21:56:27 nit: no extra \n here in jsdoc
Harry McCleave 2012/07/24 22:54:06 Done.
+ *
+ * @param {function(Event) : boolean} allowSelectStart if this function is
Dan Beam 2012/07/24 21:56:27 * @param {function(Event):boolean=} opt_allowSelec
Harry McCleave 2012/07/24 22:54:06 Done.
+ * defined and returns true, will allow the SelectStart event to be processed
+ * @param {function(Event) : boolean} allowDragStart if this funcion is defined
Dan Beam 2012/07/24 21:56:27 * @param {function(Event):boolean=} opt_allowDragS
Harry McCleave 2012/07/24 22:54:06 Done.
+ * and returns true, will allow the DragStart event to be processed
*/
-function disableTextSelectAndDrag() {
+function disableTextSelectAndDrag(allowSelectStart, allowDragStart) {
// Disable text selection.
document.onselectstart = function(e) {
- e.preventDefault();
+ if (!(allowSelectStart && allowSelectStart(e))) {
Dan Beam 2012/07/24 21:56:27 nit: no curlies, should probably actually modify t
Harry McCleave 2012/07/24 22:54:06 Done.
+ e.preventDefault();
+ }
}
Dan Beam 2012/07/24 21:56:27 };
Harry McCleave 2012/07/24 22:54:06 Done.
// Disable dragging.
document.ondragstart = function(e) {
- e.preventDefault();
+ if (!(allowDragStart && allowDragStart(e))) {
Dan Beam 2012/07/24 21:56:27 nit: no curlies, should probably actually modify t
Harry McCleave 2012/07/24 22:54:06 Done.
+ e.preventDefault();
+ }
}
Dan Beam 2012/07/24 21:56:27 };
Harry McCleave 2012/07/24 22:54:06 Done.
}

Powered by Google App Engine
This is Rietveld 408576698