Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Issue 2319863006: Change image document zooming logic. (Closed)

Created:
4 years, 3 months ago by Bret
Modified:
4 years, 3 months ago
CC:
chromium-reviews, blink-reviews, dglazkov+blink, blink-reviews-html_chromium.org, oshima, Ilya Kulshin, brucedawson, stanisc
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Change image document zooming logic. The current zoom logic in image documents interacts badly with use-zoom-for-dsf, in addition to having some weird behavior already. This patch changes three things: 1. When loading a large image when page zoom was not 100% the image would start at a strange scaling factor until it was clicked. This is fixed. 2. When page zoom is at 100% a large image will always scale to fit the window regardless of the device scale factor. Previously with use-zoom-for-dsf on it would scale too large for the window. 3. When an image that fits in the window is zoomed in until it doesn't it is no longer clickable. Previously it would start acting like a large image, which was strange. Also added a test suite for ImageDocument. BUG=324086, 644059 Committed: https://crrev.com/f5ff44ae79899d114b4bbf5abdd6e960f856c0d9 Cr-Commit-Position: refs/heads/master@{#419867}

Patch Set 1 #

Patch Set 2 : rewrite fix #

Patch Set 3 : formatting #

Patch Set 4 : add tests #

Total comments: 6

Patch Set 5 : bruce comment #

Patch Set 6 : enforce Desktop mode #

Total comments: 7

Patch Set 7 : remove raw pointer for compile #

Patch Set 8 : use parser in test #

Patch Set 9 : use implicitOpen #

Patch Set 10 : rebaseline #

Total comments: 5

Patch Set 11 : minor edits #

Unified diffs Side-by-side diffs Delta from patch set Stats (+231 lines, -41 lines) Patch
M third_party/WebKit/LayoutTests/TestExpectations View 1 2 3 4 5 6 7 8 9 1 chunk +3 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/BUILD.gn View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/core/html/ImageDocument.h View 1 2 3 4 5 6 7 8 2 chunks +5 lines, -8 lines 0 comments Download
M third_party/WebKit/Source/core/html/ImageDocument.cpp View 1 2 3 4 5 7 chunks +26 lines, -32 lines 0 comments Download
A third_party/WebKit/Source/core/html/ImageDocumentTest.cpp View 1 2 3 4 5 6 7 8 9 10 1 chunk +195 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/testing/DummyPageHolder.cpp View 1 2 3 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 38 (20 generated)
Bret
4 years, 3 months ago (2016-09-15 22:50:31 UTC) #4
brucedawson
I am not an owner but lgtm https://codereview.chromium.org/2319863006/diff/60001/third_party/WebKit/Source/core/html/ImageDocument.cpp File third_party/WebKit/Source/core/html/ImageDocument.cpp (right): https://codereview.chromium.org/2319863006/diff/60001/third_party/WebKit/Source/core/html/ImageDocument.cpp#newcode256 third_party/WebKit/Source/core/html/ImageDocument.cpp:256: return 1; ...
4 years, 3 months ago (2016-09-15 23:21:21 UTC) #6
Bret
https://codereview.chromium.org/2319863006/diff/60001/third_party/WebKit/Source/core/html/ImageDocument.cpp File third_party/WebKit/Source/core/html/ImageDocument.cpp (right): https://codereview.chromium.org/2319863006/diff/60001/third_party/WebKit/Source/core/html/ImageDocument.cpp#newcode256 third_party/WebKit/Source/core/html/ImageDocument.cpp:256: return 1; On 2016/09/15 23:21:21, brucedawson wrote: > Would ...
4 years, 3 months ago (2016-09-16 00:21:41 UTC) #7
brucedawson
https://codereview.chromium.org/2319863006/diff/60001/third_party/WebKit/Source/core/html/ImageDocument.h File third_party/WebKit/Source/core/html/ImageDocument.h (right): https://codereview.chromium.org/2319863006/diff/60001/third_party/WebKit/Source/core/html/ImageDocument.h#newcode59 third_party/WebKit/Source/core/html/ImageDocument.h:59: // These methods are for m_shrinkToFitMode == Desktop. On ...
4 years, 3 months ago (2016-09-16 00:23:01 UTC) #8
Bret
https://codereview.chromium.org/2319863006/diff/60001/third_party/WebKit/Source/core/html/ImageDocument.h File third_party/WebKit/Source/core/html/ImageDocument.h (right): https://codereview.chromium.org/2319863006/diff/60001/third_party/WebKit/Source/core/html/ImageDocument.h#newcode59 third_party/WebKit/Source/core/html/ImageDocument.h:59: // These methods are for m_shrinkToFitMode == Desktop. On ...
4 years, 3 months ago (2016-09-16 00:37:03 UTC) #9
Nate Chapin
This l-g-t-m % nits but I don't speak scaling well enough to be super confident. ...
4 years, 3 months ago (2016-09-16 21:48:24 UTC) #14
Nate Chapin
Also, compile failure looks legit.
4 years, 3 months ago (2016-09-16 21:49:19 UTC) #15
Bret
Adding bokan@ to reviewers. Also included a fix for the compile failure. https://codereview.chromium.org/2319863006/diff/100001/third_party/WebKit/Source/core/html/ImageDocument.h File third_party/WebKit/Source/core/html/ImageDocument.h ...
4 years, 3 months ago (2016-09-16 22:24:25 UTC) #17
Nate Chapin
https://codereview.chromium.org/2319863006/diff/100001/third_party/WebKit/Source/core/html/ImageDocument.h File third_party/WebKit/Source/core/html/ImageDocument.h (right): https://codereview.chromium.org/2319863006/diff/100001/third_party/WebKit/Source/core/html/ImageDocument.h#newcode85 third_party/WebKit/Source/core/html/ImageDocument.h:85: friend class ImageDocumentTest; On 2016/09/16 22:24:24, Bret Sepulveda wrote: ...
4 years, 3 months ago (2016-09-16 22:28:12 UTC) #20
Bret
https://codereview.chromium.org/2319863006/diff/100001/third_party/WebKit/Source/core/html/ImageDocument.h File third_party/WebKit/Source/core/html/ImageDocument.h (right): https://codereview.chromium.org/2319863006/diff/100001/third_party/WebKit/Source/core/html/ImageDocument.h#newcode85 third_party/WebKit/Source/core/html/ImageDocument.h:85: friend class ImageDocumentTest; On 2016/09/16 22:28:12, Nate Chapin wrote: ...
4 years, 3 months ago (2016-09-16 23:00:01 UTC) #21
Nate Chapin
On 2016/09/16 23:00:01, Bret Sepulveda wrote: > https://codereview.chromium.org/2319863006/diff/100001/third_party/WebKit/Source/core/html/ImageDocument.h > File third_party/WebKit/Source/core/html/ImageDocument.h (right): > > https://codereview.chromium.org/2319863006/diff/100001/third_party/WebKit/Source/core/html/ImageDocument.h#newcode85 ...
4 years, 3 months ago (2016-09-16 23:06:53 UTC) #22
Bret
https://codereview.chromium.org/2319863006/diff/100001/third_party/WebKit/Source/core/html/ImageDocument.h File third_party/WebKit/Source/core/html/ImageDocument.h (right): https://codereview.chromium.org/2319863006/diff/100001/third_party/WebKit/Source/core/html/ImageDocument.h#newcode85 third_party/WebKit/Source/core/html/ImageDocument.h:85: friend class ImageDocumentTest; On 2016/09/16 23:00:01, Bret Sepulveda wrote: ...
4 years, 3 months ago (2016-09-16 23:29:23 UTC) #23
bokan
I'm not familiar with this code but I'm a good double check for scaling/coordinate issues. ...
4 years, 3 months ago (2016-09-19 15:31:06 UTC) #28
Bret
https://codereview.chromium.org/2319863006/diff/180001/third_party/WebKit/Source/core/html/ImageDocumentTest.cpp File third_party/WebKit/Source/core/html/ImageDocumentTest.cpp (right): https://codereview.chromium.org/2319863006/diff/180001/third_party/WebKit/Source/core/html/ImageDocumentTest.cpp#newcode60 third_party/WebKit/Source/core/html/ImageDocumentTest.cpp:60: float windowToViewportScalar(const float s) const override { return m_scaleFactor; ...
4 years, 3 months ago (2016-09-20 20:20:54 UTC) #29
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2319863006/200001
4 years, 3 months ago (2016-09-20 20:24:04 UTC) #33
commit-bot: I haz the power
Committed patchset #11 (id:200001)
4 years, 3 months ago (2016-09-20 22:05:14 UTC) #35
commit-bot: I haz the power
Patchset 11 (id:??) landed as https://crrev.com/f5ff44ae79899d114b4bbf5abdd6e960f856c0d9 Cr-Commit-Position: refs/heads/master@{#419867}
4 years, 3 months ago (2016-09-20 22:09:14 UTC) #37
bokan
4 years, 3 months ago (2016-09-20 22:28:35 UTC) #38
Message was sent while issue was closed.
https://codereview.chromium.org/2319863006/diff/180001/third_party/WebKit/Sou...
File third_party/WebKit/Source/core/html/ImageDocumentTest.cpp (right):

https://codereview.chromium.org/2319863006/diff/180001/third_party/WebKit/Sou...
third_party/WebKit/Source/core/html/ImageDocumentTest.cpp:166: EXPECT_EQ(10,
imageWidth());
On 2016/09/20 20:20:54, Bret Sepulveda wrote:
> On 2016/09/19 15:31:06, bokan wrote:
> > Just to confirm my understanding, in this case the image will load larger
than
> > the viewport, right? Since the viewport height is 10 physical pixels, the
> image
> > height is 10 CSS pixels and the zoom factor is 2 so the image will be 20
> > physical pixels. Is that right? Is that expected?
> 
> Yes, that's correct. If you zoom in on an image it should get bigger even if
> it's being fit to the screen. This is just applying that principle on an
initial
> load too. I suppose it could be a little strange if someone has a permanent
zoom
> set (or just forgets they zoomed in that image previously on load) but I'm not
> sure what else we would do. Plus it's definitely better that the current
> behavior.
> 
> Changed the name of the test to be more specific.

Sgtm, thanks for explaining.

Powered by Google App Engine
This is Rietveld 408576698