Bug 128983 - [CSS Shapes] SVG Image valued shape fails if root element's size is relative
Summary: [CSS Shapes] SVG Image valued shape fails if root element's size is relative
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-18 11:13 PST by Hans Muller
Modified: 2014-03-10 11:35 PDT (History)
7 users (show)

See Also:


Attachments
Test case. (3.87 KB, text/html)
2014-02-18 11:14 PST, Hans Muller
no flags Details
Patch (10.99 KB, patch)
2014-03-07 15:29 PST, Hans Muller
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from webkit-ews-16 for mac-mountainlion-wk2 (887.85 KB, application/zip)
2014-03-07 16:44 PST, Build Bot
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hans Muller 2014-02-18 11:13:37 PST
If the value of a shape is an SVG image whose root element has a relative size, the image isn't sized correctly.

The source of the problem, as best I understand it, is that we're not setting the SVGImage's "containerSize", which SVGImage::draw() depends on. What happens instead is that SVGImage::containerSize() returns 300x150, which is the "CSS default intrinsic size". 

I think what needs to be done is the following. Once the shape's SVG image has been loaded and just before it's draw it into a temporary ImageBuffer so that it can be converted it into a RasterShape:

  shapeImageResource.setContainerSizeForRenderer(shapeImageResourceClient, referenceBoxRelativeSize);  
  imageToDraw = shapeImageResource.imageForRenderer(shapeImageResourceClient);

In this case shapeImageResourceClient is the existing ShapeInfo object, which will have to become an ImageResourceClient.

This can't work at the moment because the ImageResource::imageForRenderer() method currently uses a RenderObject* as the SVGImageCache key. It looks like that could be safely changed to ImageResourceClient.
Comment 1 Hans Muller 2014-02-18 11:14:29 PST
Created attachment 224525 [details]
Test case.
Comment 2 Hans Muller 2014-03-07 15:29:12 PST
Created attachment 226174 [details]
Patch

When creating a shape based on an Image, compute its dimensions using RenderBoxModelObject::calculateImageIntrinsicDimensions(), then set the ImageResource's containerSize, and then use imageForRenderer() to get the image to be drawn. The first step resolves SVG Image relative sizes, the second step creates and caches an SVGImageForContainer with the correct containerSize, and the last step retrieves the SVGImageForContainer.
Comment 3 Build Bot 2014-03-07 16:44:50 PST
Comment on attachment 226174 [details]
Patch

Attachment 226174 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.appspot.com/results/4806239699599360

New failing tests:
editing/unsupported-content/list-delete-001.html
editing/unsupported-content/table-type-after.html
editing/unsupported-content/list-type-after.html
editing/unsupported-content/list-type-before.html
editing/unsupported-content/table-type-before.html
Comment 4 Build Bot 2014-03-07 16:44:52 PST
Created attachment 226185 [details]
Archive of layout-test-results from webkit-ews-16 for mac-mountainlion-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: webkit-ews-16  Port: mac-mountainlion-wk2  Platform: Mac OS X 10.8.5
Comment 5 WebKit Commit Bot 2014-03-10 11:35:43 PDT
Comment on attachment 226174 [details]
Patch

Clearing flags on attachment: 226174

Committed r165387: <http://trac.webkit.org/changeset/165387>
Comment 6 WebKit Commit Bot 2014-03-10 11:35:46 PDT
All reviewed patches have been landed.  Closing bug.