Bug 99489

Summary: Incorrect embedded SVG image sizing on first load
Product: WebKit Reporter: Florin Malita <fmalita>
Component: SVGAssignee: Florin Malita <fmalita>
Status: RESOLVED FIXED    
Severity: Normal CC: eric, krit, pdr, rwlbuis, schenney, webkit.review.bot, zimmermann
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 99481    
Attachments:
Description Flags
No red should be visible, only a large green rect.
none
Patch none

Florin Malita
Reported 2012-10-16 12:30:28 PDT
Created attachment 168997 [details] No red should be visible, only a large green rect. This seems to be timing sensitive, so it may take a few tries: when the attached test is first opened in a new tab/window, the embedded SVG image (data:image/svg+xml) is not scaled according to its container transform.
Attachments
No red should be visible, only a large green rect. (472 bytes, text/html)
2012-10-16 12:30 PDT, Florin Malita
no flags
Patch (3.96 KB, patch)
2012-10-17 12:52 PDT, Florin Malita
no flags
Florin Malita
Comment 1 2012-10-17 10:59:37 PDT
Looks like a race between layout and the image loader: * SVGImageCache::lookupOrCreateBitmapImageForRenderer() needs a m_sizeAndScalesMap entry for the renderer * the only time this is set is from RenderSVGImage::layout() (via updateImageViewport() >> m_imageResource->setContainerSizeForRenderer() >> m_cachedImage->setContainerSizeForRenderer() >> m_svgImageCache->setRequestedSizeAndScales()) The problem is that for this to work, the cached image needs to be present/loaded when RenderSVGImage::layout() is called. If loading finishes after layout, setRequestedSizeAndScales() never gets called. Extending RenderSVGImage::imageChanged() to either force a relayout or just call setRequestedSizeAndScales() should cover this case.
Florin Malita
Comment 2 2012-10-17 12:52:25 PDT
Nikolas Zimmermann
Comment 3 2012-10-21 07:52:52 PDT
Comment on attachment 169237 [details] Patch Good catch!
WebKit Review Bot
Comment 4 2012-10-22 07:10:28 PDT
Comment on attachment 169237 [details] Patch Clearing flags on attachment: 169237 Committed r132069: <http://trac.webkit.org/changeset/132069>
WebKit Review Bot
Comment 5 2012-10-22 07:10:31 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.