Can be implemented I believe with these steps:
1. Add new stacking context rules to ComputedStyle::UpdateIsStackingContext.
2. Update PaintLayer::UpdateLayerPositionsAfterLayout to position <foreignObject>
PaintLayers relative to their containing SVGRoot parent.
Note that this change will mean all LayoutSVGRoot and LayoutSVGForeignObject
objects have PaintLayers.
Updates:
Usage data of stacked/positioned objects under SVG foreignObject (also in https://docs.google.com/document/d/1LR5ZlcjVA_jTO00lGvZcrXZVD7Y2EZpaL-6SHzhJyow/edit#):
% of pages containing:
foreignObject: 0.03%
Under foreignObject:
Stacked: 0.003%
Stacking context: 0.003%
Positioned: 0.002%
Fixed-position: 0%
Absolute-position: 0%
% of objects:
foreignObject: 0.001%
Under foreignObject:
Stacked: 0.00001%
Stacking context: 0.00001%
Positioned: 0.000001%
Fixed-position: 0%
Absolute-position: 0%
Re #c3: Currently we are inconsistent in layout and paint about foreignObject as containing block of all descendants:
- In Layout and PrePaint we treat foreignObject as containing block of all descendants;
- In Paint we don't treat foreignObject as containing block of self-painting descendants because foreignObject itself doesn't have self-painting layer.
See also bug 640272 , bug 771852 and bug 801384 .
Comment 1 by chrishtr@chromium.org
, May 16 2017