Bug 128187

Summary: [CSS Shapes] Dynamically created element with image valued shape-outside doesn't update automatically
Product: WebKit Reporter: Hans Muller <giles_joplin>
Component: CSSAssignee: Hans Muller <giles_joplin>
Status: RESOLVED FIXED    
Severity: Normal CC: bdakin, commit-queue, dino, esprehn+autocc, glenn, hyatt, kling, kondapallykalyan, simon.fraser, zalan
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Test case.
none
Patch none

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.