Bug 105097 - SVG images are sized incorrectly on first load
Summary: SVG images are sized incorrectly on first load
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: 420+
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-15 11:39 PST by Philip Rogers
Modified: 2012-12-17 21:03 PST (History)
12 users (show)

See Also:


Attachments
First pass - Queue container size requests while images are loading. (8.48 KB, patch)
2012-12-15 11:42 PST, Philip Rogers
dino: review+
eric: commit-queue-
Details | Formatted Diff | Diff
Patch for landing (8.88 KB, patch)
2012-12-17 20:16 PST, Philip Rogers
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philip Rogers 2012-12-15 11:39:34 PST
On first load, SVG images that depend on the image size will be sized incorrectly. Additionally, the SVG image cache is not used much of the time because it depends on a call to CachedImage::setContainerSizeForRenderer(...) that it never receives.

Patch forthcoming!
Comment 1 Philip Rogers 2012-12-15 11:42:42 PST
Created attachment 179602 [details]
First pass - Queue container size requests while images are loading.
Comment 2 Dean Jackson 2012-12-17 12:19:58 PST
Comment on attachment 179602 [details]
First pass - Queue container size requests while images are loading.

View in context: https://bugs.webkit.org/attachment.cgi?id=179602&action=review

> Source/WebCore/ChangeLog:33
> +        (CachedImage):

Nit: remove this line
Comment 3 Eric Seidel (no email) 2012-12-17 12:25:35 PST
Comment on attachment 179602 [details]
First pass - Queue container size requests while images are loading.

View in context: https://bugs.webkit.org/attachment.cgi?id=179602&action=review

> Source/WebCore/loader/cache/CachedImage.cpp:335
> +        for (ContainerSizeRequests::iterator it = m_pendingContainerSizeRequests.begin(); it != m_pendingContainerSizeRequests.end(); ++it)
> +            setContainerSizeForRenderer(it->key, it->value.first, it->value.second);

We should clear pending requests after we send them.

> Source/WebCore/loader/cache/CachedImage.h:64
> -    void setContainerSizeForRenderer(const RenderObject*, const IntSize&, float);
> +    void setContainerSizeForRenderer(const CachedImageClient*, const IntSize&, float);

We should just remove "renderer" from this.  It's somewhat of a layering violation IMO for the loader to know anything about the rendering tree.  This can be in a follow-up patch if you'd rather.
Comment 4 Eric Seidel (no email) 2012-12-17 12:25:51 PST
Thanks dino. :)
Comment 5 Philip Rogers 2012-12-17 20:16:47 PST
Created attachment 179868 [details]
Patch for landing
Comment 6 Philip Rogers 2012-12-17 20:19:48 PST
Thanks for the reviews Dino and Eric!

(In reply to comment #3)
> (From update of attachment 179602 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=179602&action=review
> 
> > Source/WebCore/loader/cache/CachedImage.cpp:335
> > +        for (ContainerSizeRequests::iterator it = m_pendingContainerSizeRequests.begin(); it != m_pendingContainerSizeRequests.end(); ++it)
> > +            setContainerSizeForRenderer(it->key, it->value.first, it->value.second);
> 
> We should clear pending requests after we send them.
Done.

> 
> > Source/WebCore/loader/cache/CachedImage.h:64
> > -    void setContainerSizeForRenderer(const RenderObject*, const IntSize&, float);
> > +    void setContainerSizeForRenderer(const CachedImageClient*, const IntSize&, float);
> 
> We should just remove "renderer" from this.  It's somewhat of a layering violation IMO for the loader to know anything about the rendering tree.  This can be in a follow-up patch if you'd rather.

I agree; lets do it as a followup though. I filed WK105244 to track this.
Comment 7 WebKit Review Bot 2012-12-17 21:02:55 PST
Comment on attachment 179868 [details]
Patch for landing

Clearing flags on attachment: 179868

Committed r137981: <http://trac.webkit.org/changeset/137981>
Comment 8 WebKit Review Bot 2012-12-17 21:03:00 PST
All reviewed patches have been landed.  Closing bug.