Bug 121068 - On ImageDocument, checking for FrameView is needed before ShrinkToFit
Summary: On ImageDocument, checking for FrameView is needed before ShrinkToFit
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Images (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: KyungTae Kim
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-09 19:17 PDT by KyungTae Kim
Modified: 2016-05-24 22:02 PDT (History)
2 users (show)

See Also:


Attachments
PNG image (215.63 KB, image/png)
2013-09-09 19:17 PDT, KyungTae Kim
no flags Details
Patch (1.70 KB, patch)
2013-09-09 19:25 PDT, KyungTae Kim
beidson: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description KyungTae Kim 2013-09-09 19:17:25 PDT
Created attachment 211136 [details]
PNG image

When you load a image like  file:///PNG.png, the ImageDocument is generated, 
then if it should shrink to fit, the scale for the image to fit is calculated, and the image's size is inserted.

However, if ImageDocument::imageUpdated is called before the FrameView's size is not yet updated,
the scale is calculated as 0 on ImageDocument::scale, and the image's size is set to 0 on ImageDocument::resizeImageToFit.
Then the size is not changed after that because ImageDocument::m_imageSizeIsKnown is set.

So, in this case, check the FrameView's size and  not to set ImageDocument::m_imageSizeIsKnown is needed.
Comment 1 KyungTae Kim 2013-09-09 19:25:14 PDT
Created attachment 211138 [details]
Patch
Comment 2 Darin Adler 2013-09-09 20:09:32 PDT
Comment on attachment 211138 [details]
Patch

Can we make a regression test, demonstrating the problem this fixes?
Comment 3 KyungTae Kim 2013-09-09 20:26:40 PDT
(In reply to comment #2)
> (From update of attachment 211138 [details])
> Can we make a regression test, demonstrating the problem this fixes?
I wanted to make a layout test but I don't know how to make it, because it needs direct load of a image.
Is there any exist test case to use a image file itself as a test case?
Comment 4 KyungTae Kim 2013-09-09 20:38:40 PDT
(In reply to comment #3)
> (In reply to comment #2)
> > (From update of attachment 211138 [details] [details])
> > Can we make a regression test, demonstrating the problem this fixes?
> I wanted to make a layout test but I don't know how to make it, because it needs direct load of a image.
> Is there any exist test case to use a image file itself as a test case?
I tried to use a iframe like below, but in that case, the image was not shrink to fit.
<iframe width=100% height=100% src="resources/PNG.png" id="frame"></iframe>
Comment 5 Brady Eidson 2016-05-24 22:02:41 PDT
Comment on attachment 211138 [details]
Patch

Assuming that patches for review since 2013 are stale, r-