Commit 2e328cf3 authored by Alex Danilo's avatar Alex Danilo Committed by Commit Bot

Remove input field selection regression in Gallery

Change https://chromium-review.googlesource.com/c/chromium/src/+/1217747/
introduced a side-effect that causes the entire input field to be
selected on a focus event. In the gallery app this caused the Width
input field to be fully selected when doing an image resize. This
change explicitly sets the selection to the end of the field as it
used to work before the regression.

This CL is the second attempt as the original CL 1453696 was
reverted in
https://chromium-review.googlesource.com/c/chromium/src/+/1519947
due to https://bugs.chromium.org/p/chromium/issues/detail?id=931157.

Bug: 914741
Tests: Ran all browser and unit tests, manually checked as well.
Change-Id: I95bd7cc31ccbd0631201414142cfe9b4cf44073f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1525253Reviewed-by: default avatarTrent Apted <tapted@chromium.org>
Commit-Queue: Alex Danilo <adanilo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#642304}
parent daee9026
......@@ -355,6 +355,12 @@ ImageEditorToolbar.prototype.show = function(on) {
'button:not(.crop-aspect-ratio), paper-button, input, cr-slider, cr-input');
if (input) {
input.focus();
// Fix for crbug/914741 set selection to the end (> 32-bit int)
// Note the input element lives in Shadow DOM.
if (input.select && input.tagName) {
assert(input.tagName === 'CR-INPUT');
input.select(12, 12);
}
}
}
};
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