|
|
DescriptionOOP PDF - Update zoom factor to fall within range
Currently setZoom() doesn't check whether zoom factor provided
falls within range or not. It is possible to pass big zoom level
through 'zoom' open pdf parameter which can make browser unresponsive.
This patch updates the zoom factor provided in setZoom() to fall
within range.
BUG=303491
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=291387
Patch Set 1 #
Total comments: 3
Patch Set 2 : Review feedback (use Viewport.ZOOM_FACTORS to set range) #
Total comments: 2
Patch Set 3 : Review feedback (fix indentation) #Patch Set 4 : Rebase #Messages
Total messages: 26 (0 generated)
PTAL. Thanks!
https://codereview.chromium.org/475933004/diff/1/chrome/browser/resources/pdf... File chrome/browser/resources/pdf/viewport.js (right): https://codereview.chromium.org/475933004/diff/1/chrome/browser/resources/pdf... chrome/browser/resources/pdf/viewport.js:82: Viewport.ZOOM_FACTOR_RANGE = {min: 0.1, max: 10.0}; could we set min to Viewport.ZOOM_FACTORS[0] and max to Viewport.ZOOM_FACTORS[Viewport.ZOOM_FACTORS.length - 1] ?
https://codereview.chromium.org/475933004/diff/1/chrome/browser/resources/pdf... File chrome/browser/resources/pdf/viewport.js (right): https://codereview.chromium.org/475933004/diff/1/chrome/browser/resources/pdf... chrome/browser/resources/pdf/viewport.js:82: Viewport.ZOOM_FACTOR_RANGE = {min: 0.1, max: 10.0}; On 2014/08/22 01:02:23, raymes wrote: > could we set min to Viewport.ZOOM_FACTORS[0] and max to > Viewport.ZOOM_FACTORS[Viewport.ZOOM_FACTORS.length - 1] ? Hmm, I've set min to 0.1 and max to 10.0 based on values which current in-process plugin uses. If you think we should set min to 0.25 and max to 5 then please let me know and I'll update it to use Viewport.ZOOM_FACTORS[0] and Viewport.ZOOM_FACTORS[Viewport.ZOOM_FACTORS.length - 1].
> Hmm, I've set min to 0.1 and max to 10.0 based on values which current > in-process plugin uses. > > If you think we should set min to 0.25 and max to 5 then please let me know and > I'll update it to use Viewport.ZOOM_FACTORS[0] and > Viewport.ZOOM_FACTORS[Viewport.ZOOM_FACTORS.length - 1]. I see. I think we should just use Viewport.ZOOM_FACTORS[0] and > Viewport.ZOOM_FACTORS[Viewport.ZOOM_FACTORS.length - 1]. I don't think it makes sense to allow something to zoom outside of that if that is the restriction we are placing on the user.
> Hmm, I've set min to 0.1 and max to 10.0 based on values which current > in-process plugin uses. > > If you think we should set min to 0.25 and max to 5 then please let me know and > I'll update it to use Viewport.ZOOM_FACTORS[0] and > Viewport.ZOOM_FACTORS[Viewport.ZOOM_FACTORS.length - 1]. I see. I think we should just use Viewport.ZOOM_FACTORS[0] and > Viewport.ZOOM_FACTORS[Viewport.ZOOM_FACTORS.length - 1]. I don't think it makes sense to allow something to zoom outside of that if that is the restriction we are placing on the user.
Updated to use ZOOM_FACTORS to set the range. PTAL. Thanks! https://codereview.chromium.org/475933004/diff/1/chrome/browser/resources/pdf... File chrome/browser/resources/pdf/viewport.js (right): https://codereview.chromium.org/475933004/diff/1/chrome/browser/resources/pdf... chrome/browser/resources/pdf/viewport.js:82: Viewport.ZOOM_FACTOR_RANGE = {min: 0.1, max: 10.0}; On 2014/08/22 01:02:23, raymes wrote: > could we set min to Viewport.ZOOM_FACTORS[0] and max to > Viewport.ZOOM_FACTORS[Viewport.ZOOM_FACTORS.length - 1] ? Done.
https://codereview.chromium.org/475933004/diff/20001/chrome/browser/resources... File chrome/browser/resources/pdf/viewport.js (right): https://codereview.chromium.org/475933004/diff/20001/chrome/browser/resources... chrome/browser/resources/pdf/viewport.js:84: Viewport.ZOOM_FACTORS.length - 1]}; Perhaps indent this like: Viewport.ZOOM_FACTOR_RANGE = { min: Viewport.ZOOM_FACTORS[0], max: Viewport.ZOOM_FACTORS[Viewport.ZOOM_FACTORS.length - 1] };
Looks so much better now. Thanks :) Missing "git cl format" already. https://codereview.chromium.org/475933004/diff/20001/chrome/browser/resources... File chrome/browser/resources/pdf/viewport.js (right): https://codereview.chromium.org/475933004/diff/20001/chrome/browser/resources... chrome/browser/resources/pdf/viewport.js:84: Viewport.ZOOM_FACTORS.length - 1]}; On 2014/08/22 05:14:32, raymes wrote: > Perhaps indent this like: > > Viewport.ZOOM_FACTOR_RANGE = { > min: Viewport.ZOOM_FACTORS[0], > max: Viewport.ZOOM_FACTORS[Viewport.ZOOM_FACTORS.length - 1] > }; Done.
lgtm
thestig@ - OWNERS review please. On 2014/08/22 06:54:45, raymes wrote: > lgtm Thanks for reviewing :)
lgtm
Thanks raymes@ and thestig@ for quick reviews! Going to submit this now.
The CQ bit was checked by n.bansal@samsung.com
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/n.bansal@samsung.com/475933004/40001
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: android_chromium_gn_compile_rel on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/android_chromiu...)
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: android_chromium_gn_compile_rel on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/android_chromiu...)
The CQ bit was checked by n.bansal@samsung.com
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/n.bansal@samsung.com/475933004/40001
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: android_chromium_gn_compile_rel on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/android_chromiu...)
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: android_chromium_gn_compile_rel on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/android_chromiu...)
Rebase
The CQ bit was checked by n.bansal@samsung.com
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/n.bansal@samsung.com/475933004/60001
Message was sent while issue was closed.
Committed patchset #4 (60001) as 291387 |