Commit ad99db5d authored by Daniel Hosseinian's avatar Daniel Hosseinian Committed by Commit Bot

Print Preview: Fix scrollbar page number ordering.

The displayed current page number in the PDF viewer's page indicator is
incorrect when the custom pages setting input is out of order. Sort
the pages before storing them in the settings so the page numbers are
displayed in the correct order.

Bug: 1015145
Change-Id: I56c0108bf2ae8c6dba9d44d5c0d0046a8b7b6b9b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1867378
Commit-Queue: Daniel Hosseinian <dhoss@chromium.org>
Reviewed-by: default avatarRebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#707514}
parent 93ec2653
...@@ -247,6 +247,11 @@ Polymer({ ...@@ -247,6 +247,11 @@ Polymer({
} }
} }
} }
// Page numbers should be sorted to match the order of the pages in the
// rendered PDF.
pages.sort((left, right) => left - right);
this.errorState_ = PagesInputErrorState.NO_ERROR; this.errorState_ = PagesInputErrorState.NO_ERROR;
this.pagesToPrint_ = pages; this.pagesToPrint_ = pages;
}, },
......
...@@ -150,6 +150,17 @@ cr.define('pages_settings_test', function() { ...@@ -150,6 +150,17 @@ cr.define('pages_settings_test', function() {
await setCustomInput('1,2,3\u30011\u300156'); await setCustomInput('1,2,3\u30011\u300156');
validateState( validateState(
[1, 2, 3, 56], [{from: 1, to: 3}, {from: 56, to: 56}], '', false); [1, 2, 3, 56], [{from: 1, to: 3}, {from: 56, to: 56}], '', false);
// https://crbug.com/1015145
// Tests that the pages gets sorted for an unsorted input.
await setCustomInput('89-91, 3, 6, 46, 1, 4, 2-3');
validateState(
[1, 2, 3, 4, 6, 46, 89, 90, 91],
[
{from: 1, to: 4}, {from: 6, to: 6}, {from: 46, to: 46},
{from: 89, to: 91}
],
'', false);
}); });
// Tests that the correct error messages are shown for different user // Tests that the correct error messages are shown for different user
......
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