This is the master bug for adding support for specifying exclusion shapes with an image and a threshold.
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.
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.
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.
The main functionality is landed. Closing bug.