Bug 128187 - [CSS Shapes] Dynamically created element with image valued shape-outside doesn't update automatically
Summary: [CSS Shapes] Dynamically created element with image valued shape-outside does...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Hans Muller
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-04 09:05 PST by Hans Muller
Modified: 2014-02-05 10:34 PST (History)
10 users (show)

See Also:


Attachments
Test case. (2.98 KB, text/html)
2014-02-04 09:05 PST, Hans Muller
no flags Details
Patch (5.46 KB, patch)
2014-02-04 11:12 PST, Hans Muller
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hans Muller 2014-02-04 09:05:58 PST
Created attachment 223123 [details]
Test case.

When a float with an image valued shape-outside property is added dynamically, the layout it impacts isn't always updated automatically, after the image has loaded.  Manually refreshing the page does fix up the layout.

This bug was also reported here: https://code.google.com/p/chromium/issues/detail?id=339136
Comment 1 Hans Muller 2014-02-04 11:12:56 PST
Created attachment 223141 [details]
Patch

Corrected the way shape-outside handles the completion of an image load. Move the shape-outside imageChanged() logic from RenderBlock to RenderBox and call markShapeOutsideDependentsForLayout() instead of parent()->setNeedsLayoutAndPrefWidthsRecalc(). The latter did not deal with descendants of the shape element's siblings correctly and it failed when the shape element was inserted dynamically. The markShapeOutsideDependentsForLayout() method can't be called during layout, so the imageChanged() code checks for that. The only scenario where imageChanged() can be called during layout (that I've discovered so far anyway) is when an SVG Image is renderered  with drawImage(). The Shape::createRasterShape() does, and the corresponding imageChanged() notification can be safely ignored.
Comment 2 Andreas Kling 2014-02-05 09:43:37 PST
Moving this up to RenderBox seems okay to me. Could someone with better layout-fu have a look? (CC'd)
Comment 3 WebKit Commit Bot 2014-02-05 10:34:46 PST
Comment on attachment 223141 [details]
Patch

Clearing flags on attachment: 223141

Committed r163458: <http://trac.webkit.org/changeset/163458>
Comment 4 WebKit Commit Bot 2014-02-05 10:34:49 PST
All reviewed patches have been landed.  Closing bug.