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..d987793f29a0ef9e40701b2ff8fa517db3bc0083 100644 |
--- a/chrome/browser/resources/shared/js/util.js |
+++ b/chrome/browser/resources/shared/js/util.js |
@@ -107,18 +107,24 @@ function swapDomNodes(a, b) { |
} |
/** |
- * Disables text selection and dragging. |
+ * Disables text selection and dragging, with optional whitelist callbacks. |
+ * @param {function(Event):boolean=} opt_allowSelectStart if this function is |
Dan Beam
2012/07/24 23:07:49
Capitalize the first word after each parameter nam
Harry McCleave
2012/07/24 23:21:15
Done.
|
+ * defined and returns true, will allow the SelectStart event to be processed |
+ * @param {function(Event):boolean=} opt_allowDragStart if this funcion is |
+ * defined and returns true, will allow the DragStart event to be processed |
*/ |
-function disableTextSelectAndDrag() { |
+function disableTextSelectAndDrag(opt_allowSelectStart, opt_allowDragStart) { |
// Disable text selection. |
document.onselectstart = function(e) { |
- e.preventDefault(); |
- } |
+ if (!(opt_allowSelectStart && opt_allowSelectStart.call(this, e))) |
+ e.preventDefault(); |
+ }; |
// Disable dragging. |
document.ondragstart = function(e) { |
- e.preventDefault(); |
- } |
+ if (!(opt_allowDragStart && opt_allowDragStart.call(this, e))) |
+ e.preventDefault(); |
+ }; |
} |
/** |