Commit ac293de6 authored by rbpotter's avatar rbpotter Committed by Commit Bot

Print Preview: Fix margins bug

- Call resetString() after setting the textbox value, so that future
  updates to the textbox will trigger an input-change event.
- Also make some conditions more clear in the margins code.

Bug: 1046683
Change-Id: I742f264a0dca2c1b5a41e769ada5f5d2966e5c92
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2032433
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Reviewed-by: default avatarDemetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#737207}
parent 1e209f8f
......@@ -117,7 +117,7 @@ Polymer({
setTextboxValue(valueInPts) {
const textbox = this.$.input;
const pts = textbox.value ? this.parseValueToPts_(textbox.value) : null;
if (!!pts && valueInPts === Math.round(pts)) {
if (pts !== null && valueInPts === Math.round(pts)) {
// If the textbox's value represents the same value in pts as the new one,
// don't reset. This allows the "undo" command to work as expected, see
// https://crbug.com/452844.
......@@ -125,6 +125,7 @@ Polymer({
}
textbox.value = this.serializeValueFromPts_(valueInPts);
this.resetString();
},
/** @return {number} The current position of the margin control. */
......@@ -233,11 +234,12 @@ Polymer({
},
/**
* @param {!CustomEvent<string>} e Contains the new value of the input.
* @param {!CustomEvent<string|undefined>} e Contains the new value of the
* input.
* @private
*/
onInputChange_(e) {
if (!e.detail) {
if (e.detail === '' || e.detail === undefined) {
return;
}
......
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