Bug 116348

Summary: [CSS Shapes] Add support for shapes defined by an image and a threshold
Product: WebKit Reporter: Hans Muller <giles_joplin>
Component: CSSAssignee: Hans Muller <giles_joplin>
Severity: Normal CC: zoltan
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 116349, 116643, 119809, 119849, 121619, 122216, 122340, 122613, 123114, 123295, 123743, 123769, 123934    
Bug Blocks: 98664    

Description Hans Muller 2013-05-17 13:47:36 PDT
This is the master bug for adding support for specifying exclusion shapes with an image and a threshold.
Comment 1 Hans Muller 2013-06-12 09:02:44 PDT
Additional TODO items per - https://bugs.webkit.org/show_bug.cgi?id=116643

- Add additional shape-inside tests: all alpha pixels below threshold, mutliple discontiguous boundaries, multiple discontiguous boundaries that are smaller than the minimum interval size.

- Complete shape-outside support.

- Implement the CSS shape-image-threshold property (currently the threshold is always 0)

- The internal representation of RasterShape could be created and processed more efficiently.

- The Shape::shapeMargin() and Shape::shapePadding() >= 0 invariants should be ASSERTED by the createShape() methods, not by the const methods that use these values.

- Add support for GIFs. Per the Shapes spec, only frame0 of a GIF should be used to define a shape.

- Complete the implementation of RasterShape::firstIncludedIntervalLogicalTop(). Currently the first layout position isn't computed, it's assumed that layout can begin at the top of the shape.

- Complete the implementation for shape-margin.

- The implementation of RasterShapeIntervals::getIntervals() could be improved:
If lineRegion.isRect() then a simple check would suffice to determine if all/none of the lineRegion defines the return value.
We could avoid copying Vector<IntRect>s if Region::rects() had a return value reference parameter.
Processing lineRects could be done efficiently, by just compting the return value intervals directly.
If it's necessary to reuse a Region variable, a clear() method might reduce the cost a little.

- The implementation of Shape::createShape(const StyleImage* ...) needs to be completed:
The image shape should be clipped to the logicalBoxSize parameter.
The shape's logical coordinates should reflect the writingMode parameter.

- The image extraction support, notably the ImageExctractor class and the packImageData() function, should be hoisted out of the GraphicsContext3D class.
Comment 2 Hans Muller 2013-08-14 11:55:57 PDT
Images must currently be same-origin, see https://bugs.webkit.org/show_bug.cgi?id=117610

CORS-enabled fetch should be supported, see http://dev.w3.org/csswg/css-shapes/#shapes-from-image.
Comment 3 Hans Muller 2013-10-01 15:18:16 PDT
 RasterShapeIntervals::computeShapeMarginIntervals() finds the extreme left and right limits of the margin-extended intervals on each row. This is sufficient for computing the shape-outside boundary for a left/right float and is substantially more efficient than needlessly computing the margin intervals for every interval on every row. When the code is extended to support Level 2 of the Shapes, specification we'll need to add support for computing the comprehensive shape margin boundary.
Comment 4 Zoltan Horvath 2014-02-07 13:46:38 PST
The main functionality is landed. Closing bug.