Bug 12095

Summary: Image (and thus SVGImage and PDFDocumentImage) need size-negotiation
Product: WebKit Reporter: Eric Seidel (no email) <eric>
Component: SVGAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: ddkilzer, hyatt, jeffschiller, rindahl, zimmermann
Priority: P2 Keywords: SVGHitList
Version: 420+   
Hardware: Macintosh   
OS: OS X 10.4   
Bug Depends on: 15638, 15849    
Bug Blocks: 15373, 21910    

Description Eric Seidel (no email) 2007-01-03 07:59:17 PST
Image (and thus SVGImage and PDFDocumentImage) need size-negotiation

Image needs new methods:
virtual FloatSize Image::intrinsicSize()
virtual FloatSize Image::sizeForViewport(const FloatSize& destSize)

(or some equivalent API)
to allow for scalable images to draw filling the viewport.  These would replace the current size() call.  SVGImage would override sizeForViewport() to return the maximum scaled size for that viewport.  Code already exists in SVGImage::size() for doing this kind of sizing, it's just not wired up (as no destSize is passed in).

SVGImage::draw will now likely require a call to FrameView::setSize, or perhaps that size call has moved to the Page now or one of the clients.  The layout machinery should automatically take care of re-laying out the SVG at the new size.
Comment 1 Eric Seidel (no email) 2007-11-05 18:35:16 PST
Ok, so we need to support percentage based intrinsic widths as part of CSS 2.1:
http://www.w3.org/TR/CSS21/visudet.html#inline-replaced-width

That will allow us to have <img> and <object> do proper size negotiation.  I'll file a separate bug on that.
Comment 2 Eric Seidel (no email) 2007-11-28 16:52:02 PST
the CSS support bug is filed as bug 15849.
Comment 4 David Kilzer (:ddkilzer) 2011-04-28 10:19:25 PDT
See also Bug 5793.
Comment 5 Nikolas Zimmermann 2011-06-09 13:15:23 PDT
(In reply to comment #1)
> Ok, so we need to support percentage based intrinsic widths as part of CSS 2.1:
> http://www.w3.org/TR/CSS21/visudet.html#inline-replaced-width
> 
> That will allow us to have <img> and <object> do proper size negotiation.  I'll file a separate bug on that.


Fixed in trunk already for <object>/<iframe>/<embed>. Soon <img>/background-image will switch to the new size negotiation logic as well, see bug 15849.
Comment 6 Nikolas Zimmermann 2012-02-22 07:01:05 PST
Closing this master bug, it has been fixed for SVGImage. Its yet unclear if PDFDocumentImage wants this.