Commit 0812b714 authored by harrym@chromium.org's avatar harrym@chromium.org

Enabled Selection (ctrl-A) on login password


BUG=125863
TEST=Tested change on linux build /w chromeos=1


Review URL: https://chromiumcodereview.appspot.com/10796115

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148441 0039d316-1c4b-4281-b951-d872f2087c98
parent d6afd119
...@@ -179,6 +179,13 @@ cr.define('cr.ui', function() { ...@@ -179,6 +179,13 @@ cr.define('cr.ui', function() {
var Oobe = cr.ui.Oobe; var Oobe = cr.ui.Oobe;
disableTextSelectAndDrag(); // Allow selection events on components with editable text (password field)
// bug (http://code.google.com/p/chromium/issues/detail?id=125863)
disableTextSelectAndDrag(function(e) {
var src = e.target;
return src instanceof HTMLTextAreaElement ||
src instanceof HTMLInputElement &&
/text|password|search/.test(src.type);
});
document.addEventListener('DOMContentLoaded', cr.ui.Oobe.initialize); document.addEventListener('DOMContentLoaded', cr.ui.Oobe.initialize);
...@@ -334,6 +334,13 @@ cr.define('cr.ui', function() { ...@@ -334,6 +334,13 @@ cr.define('cr.ui', function() {
var Oobe = cr.ui.Oobe; var Oobe = cr.ui.Oobe;
disableTextSelectAndDrag(); // Allow selection events on components with editable text (password field)
// bug (http://code.google.com/p/chromium/issues/detail?id=125863)
disableTextSelectAndDrag(function(e) {
var src = e.target;
return src instanceof HTMLTextAreaElement ||
src instanceof HTMLInputElement &&
/text|password|search/.test(src.type);
});
document.addEventListener('DOMContentLoaded', cr.ui.Oobe.initialize); document.addEventListener('DOMContentLoaded', cr.ui.Oobe.initialize);
...@@ -107,18 +107,25 @@ function swapDomNodes(a, b) { ...@@ -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. // Disable text selection.
document.onselectstart = function(e) { document.onselectstart = function(e) {
e.preventDefault(); if (!(opt_allowSelectStart && opt_allowSelectStart.call(this, e)))
} e.preventDefault();
};
// Disable dragging. // Disable dragging.
document.ondragstart = function(e) { document.ondragstart = function(e) {
e.preventDefault(); if (!(opt_allowDragStart && opt_allowDragStart.call(this, e)))
} e.preventDefault();
};
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment