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

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: Comment update 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
« no previous file with comments | « chrome/browser/resources/chromeos/login/oobe.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..729d7d5da017e2b485139ad7f008d93a4e6e1fc7 100644
--- a/chrome/browser/resources/shared/js/util.js
+++ b/chrome/browser/resources/shared/js/util.js
@@ -107,18 +107,25 @@ function swapDomNodes(a, b) {
}
/**
- * Disables text selection and dragging.
+ * Disables text selection and dragging, with optional whitelist callbacks.
+ * @param {function(Event):boolean=} opt_allowSelectStart Unless this function
+ * is defined and returns true, the onselectionstart event will be
+ * surpressed.
+ * @param {function(Event):boolean=} opt_allowDragStart Unless this function
+ * is defined and returns true, the ondragstart event will be surpressed.
*/
-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();
+ };
}
/**
« no previous file with comments | « chrome/browser/resources/chromeos/login/oobe.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698