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

Issue 136823005: Fix distorted image issue when open some images in a new browser window. (Closed)

Created:
6 years, 10 months ago by yi
Modified:
6 years, 10 months ago
CC:
blink-reviews, dglazkov+blink, Nate Chapin, gavinp+loader_chromium.org, adamk+blink_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/blink@master
Visibility:
Public.

Description

Fix distorted image issue when open some images in a new browser window This patch tries to fix a distorted image issue when opening certain images in a new browser window. The root cause is because the image size is needed before the image element's renderer (which contains the information that determines whether the image's orientation will affect the width and height) gets created. Fix the issue by calling Document::updateStyleIfNeeded() to create the image element's renderer before retrieving the image size. BUG=320244 R=abarth@chromium.org TEST=fast/images/exif-orientation-height-image-document.html Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=167708

Patch Set 1 #

Patch Set 2 : add layout test #

Patch Set 3 : not plumb knowledge to ImageResource #

Total comments: 2

Patch Set 4 : create renderer to get correct size #

Total comments: 5

Patch Set 5 : update test #

Patch Set 6 : update layout test #

Patch Set 7 : use Noel's test #

Total comments: 2

Patch Set 8 : updated based Noel's comments #

Total comments: 1

Patch Set 9 : expand the comment #

Unified diffs Side-by-side diffs Delta from patch set Stats (+5 lines, -2 lines) Patch
M LayoutTests/TestExpectations View 1 2 3 4 5 6 7 1 chunk +2 lines, -2 lines 0 comments Download
M Source/core/html/ImageDocument.cpp View 1 2 3 4 5 6 7 8 1 chunk +3 lines, -0 lines 0 comments Download

Messages

Total messages: 48 (0 generated)
yi
For an image document, its image element's render object may not be created before doing ...
6 years, 10 months ago (2014-01-31 19:32:19 UTC) #1
leviw_travelin_and_unemployed
On 2014/01/31 19:32:19, yi wrote: > For an image document, its image element's render object ...
6 years, 10 months ago (2014-02-07 06:04:28 UTC) #2
yi
On 2014/02/07 06:04:28, Levi wrote: > On 2014/01/31 19:32:19, yi wrote: > > For an ...
6 years, 10 months ago (2014-02-07 17:44:18 UTC) #3
Noel Gordon
On 2014/02/07 17:44:18, yi wrote: > > > ... is no render object. This patch ...
6 years, 10 months ago (2014-02-10 09:56:38 UTC) #4
yi
On 2014/02/10 09:56:38, Noel Gordon (Google) wrote: > On 2014/02/07 17:44:18, yi wrote: > > ...
6 years, 10 months ago (2014-02-13 02:28:43 UTC) #5
yi
6 years, 10 months ago (2014-02-13 02:30:13 UTC) #6
esprehn
Why can't you just force creation of the renderer instead? Adding this doesn't feel right.
6 years, 10 months ago (2014-02-13 02:35:50 UTC) #7
esprehn
abarth@ might know more about what's going in in ImageDocuments too, but plumbing knowledge of ...
6 years, 10 months ago (2014-02-13 02:36:40 UTC) #8
abarth-chromium
I agree with esprehn that this doesn't seem like the right approach. ImageResource shouldn't have ...
6 years, 10 months ago (2014-02-13 03:22:36 UTC) #9
yi
On 2014/02/13 03:22:36, abarth wrote: > I agree with esprehn that this doesn't seem like ...
6 years, 10 months ago (2014-02-13 17:44:27 UTC) #10
yi
After digging into the code again, I think it is unlikely for us to force ...
6 years, 10 months ago (2014-02-14 00:56:19 UTC) #11
abarth-chromium
I'm sorry, but I can't really understand the problem you're trying to solve or why ...
6 years, 10 months ago (2014-02-14 03:11:43 UTC) #12
yi
On 2014/02/14 03:11:43, abarth wrote: > I'm sorry, but I can't really understand the problem ...
6 years, 10 months ago (2014-02-14 23:52:05 UTC) #13
abarth-chromium
https://codereview.chromium.org/136823005/diff/200001/Source/core/fetch/ImageResource.cpp File Source/core/fetch/ImageResource.cpp (right): https://codereview.chromium.org/136823005/diff/200001/Source/core/fetch/ImageResource.cpp#newcode263 Source/core/fetch/ImageResource.cpp:263: return IntSize(); So, this won't work for SVG images? ...
6 years, 10 months ago (2014-02-15 18:58:32 UTC) #14
abarth-chromium
It seems like this approach is broken for non-bitmap images. Instead of trying to do ...
6 years, 10 months ago (2014-02-15 18:59:19 UTC) #15
abarth-chromium
On 2014/02/14 00:56:19, yi wrote: > After digging into the code again, I think it ...
6 years, 10 months ago (2014-02-15 19:01:27 UTC) #16
yi
Thanks for the comments, abarth. I have updated the patch and please take a look ...
6 years, 10 months ago (2014-02-19 02:09:52 UTC) #17
esprehn
This is looking pretty good, some nits about the test which would be nice to ...
6 years, 10 months ago (2014-02-19 02:13:02 UTC) #18
Noel Gordon
https://codereview.chromium.org/136823005/diff/300001/Source/core/html/ImageDocument.cpp File Source/core/html/ImageDocument.cpp (right): https://codereview.chromium.org/136823005/diff/300001/Source/core/html/ImageDocument.cpp#newcode147 Source/core/html/ImageDocument.cpp:147: IntSize size = flooredIntSize(cachedImage->imageSizeForRenderer(document()->imageElement()->renderer(), 1.0f)); The renderer() is non-null ...
6 years, 10 months ago (2014-02-19 04:15:56 UTC) #19
yi
On 2014/02/19 02:13:02, esprehn wrote: > This is looking pretty good, some nits about the ...
6 years, 10 months ago (2014-02-19 17:51:07 UTC) #20
yi
On 2014/02/19 04:15:56, Noel Gordon (Google) wrote: > https://codereview.chromium.org/136823005/diff/300001/Source/core/html/ImageDocument.cpp > File Source/core/html/ImageDocument.cpp (right): > > ...
6 years, 10 months ago (2014-02-19 17:51:48 UTC) #21
yi
updated the patch according to esprehn & noel's comments
6 years, 10 months ago (2014-02-19 20:23:43 UTC) #22
Noel Gordon
On 2014/02/19 17:51:48, yi wrote: > > The renderer() is non-null here with this CL. ...
6 years, 10 months ago (2014-02-20 02:05:58 UTC) #23
Noel Gordon
Also, I have another test on https://codereview.chromium.org/168583003 for this bug that I like to land. ...
6 years, 10 months ago (2014-02-20 06:38:52 UTC) #24
yi
On 2014/02/20 02:05:58, Noel Gordon (Google) wrote: > On 2014/02/19 17:51:48, yi wrote: > > ...
6 years, 10 months ago (2014-02-20 22:21:41 UTC) #25
yi
On 2014/02/20 06:38:52, Noel Gordon (Google) wrote: > Also, I have another test on https://codereview.chromium.org/168583003 ...
6 years, 10 months ago (2014-02-20 22:22:26 UTC) #26
Noel Gordon
On 2014/02/20 22:22:26, yi wrote: > If you don't mind, I will just use your ...
6 years, 10 months ago (2014-02-20 22:50:47 UTC) #27
Noel Gordon
On 2014/02/20 22:21:41, yi wrote: > > Take your test image for example, what should ...
6 years, 10 months ago (2014-02-20 23:09:10 UTC) #28
yi
On 2014/02/20 23:09:10, Noel Gordon (Google) wrote: > On 2014/02/20 22:21:41, yi wrote: > > ...
6 years, 10 months ago (2014-02-20 23:45:13 UTC) #29
yi
On 2014/02/20 23:09:10, Noel Gordon (Google) wrote: > On 2014/02/20 22:21:41, yi wrote: > > ...
6 years, 10 months ago (2014-02-20 23:47:24 UTC) #30
Noel Gordon
On 2014/02/20 23:45:13, yi wrote: > On 2014/02/20 23:09:10, Noel Gordon (Google) wrote: > > ...
6 years, 10 months ago (2014-02-21 00:58:00 UTC) #31
yi
On 2014/02/21 00:58:00, Noel Gordon (Google) wrote: > On 2014/02/20 23:45:13, yi wrote: > > ...
6 years, 10 months ago (2014-02-21 01:05:03 UTC) #32
Noel Gordon
On 2014/02/20 23:47:24, yi wrote: > BTW, my latest firefox on Mac shows title 82 ...
6 years, 10 months ago (2014-02-21 01:05:14 UTC) #33
yi
On 2014/02/21 01:05:14, Noel Gordon (Google) wrote: > On 2014/02/20 23:47:24, yi wrote: > > ...
6 years, 10 months ago (2014-02-21 01:14:32 UTC) #34
Noel Gordon
BTW, I'm not too worried about the title. I was just pointing out that your ...
6 years, 10 months ago (2014-02-21 01:17:24 UTC) #35
Noel Gordon
> I would like to address this issue on a separated patch. How do you ...
6 years, 10 months ago (2014-02-21 01:18:58 UTC) #36
yi
On 2014/02/21 01:18:58, Noel Gordon (Google) wrote: > > I would like to address this ...
6 years, 10 months ago (2014-02-21 02:01:16 UTC) #37
Noel Gordon
Thank you, let me look again (ignoring the title) ...
6 years, 10 months ago (2014-02-21 02:06:17 UTC) #38
Noel Gordon
Looking pretty good, a few minor things. https://codereview.chromium.org/136823005/diff/600001/LayoutTests/TestExpectations File LayoutTests/TestExpectations (left): https://codereview.chromium.org/136823005/diff/600001/LayoutTests/TestExpectations#oldcode662 LayoutTests/TestExpectations:662: Instead of ...
6 years, 10 months ago (2014-02-21 02:21:55 UTC) #39
Noel Gordon
On 2014/02/21 01:14:32, yi wrote: > Is there a spec to define the 'natural image ...
6 years, 10 months ago (2014-02-21 03:28:25 UTC) #40
Noel Gordon
[1] http://dev.w3.org/html5/spec-preview/the-img-element.html#dom-img-naturalwidth
6 years, 10 months ago (2014-02-21 03:29:05 UTC) #41
yi
Thanks, Noel. I have updated my patch according to your comments.
6 years, 10 months ago (2014-02-21 19:13:06 UTC) #42
Noel Gordon
And thank you, that's looking good. The other reviewers might still have comments, but your ...
6 years, 10 months ago (2014-02-22 01:43:58 UTC) #43
esprehn
lgtm, might be nice to expand the comment a bit in case that bug vanishes. ...
6 years, 10 months ago (2014-02-22 02:48:28 UTC) #44
yi
The CQ bit was checked by yi.shen@samsung.com
6 years, 10 months ago (2014-02-24 18:28:10 UTC) #45
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/yi.shen@samsung.com/136823005/830001
6 years, 10 months ago (2014-02-24 18:28:33 UTC) #46
yi
On 2014/02/22 02:48:28, esprehn wrote: > lgtm, might be nice to expand the comment a ...
6 years, 10 months ago (2014-02-24 18:28:43 UTC) #47
commit-bot: I haz the power
6 years, 10 months ago (2014-02-24 22:27:55 UTC) #48
Message was sent while issue was closed.
Change committed as 167708

Powered by Google App Engine
This is Rietveld 408576698