Bug 121068

Summary: On ImageDocument, checking for FrameView is needed before ShrinkToFit
Product: WebKit Reporter: KyungTae Kim <ktf.kim>
Component: ImagesAssignee: KyungTae Kim <ktf.kim>
Status: NEW ---    
Severity: Normal CC: commit-queue, esprehn+autocc
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
PNG image
none
Patch beidson: review-

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-