@@ -14,36 +14,25 @@ namespace HtmlRenderer.IntegrationTest.Painting;
1414[ TestClass ]
1515public sealed class StackingContextTests
1616{
17- [ Ignore ( "z-index/stacking-context paint order is not implemented on this fork: FragmentPainter.cs's own " +
18- "class remarks explicitly document it as deferred (\" Stacking-context paint order and " +
19- "box-decoration-break slicing are follow-on work\" ), and CssBoxProperties has no ZIndex field at " +
20- "all - the CSS-OM parses z-index (CssEngine/StyleProperties/Flow/ZIndexProperty.cs) but " +
21- "CssUtils.SetPropertyValue never dispatches it onto a box, so it has zero effect on paint order. " +
22- "This box tree currently paints in plain document order (normal flow, then absolute/fixed, per " +
23- "FragmentPainter's child-iteration order) regardless of any z-index value - a position:relative " +
24- "z-index:2 box painting over a LATER position:fixed sibling (this test's whole premise) is exactly " +
25- "the case document order alone cannot produce, so this reliably fails rather than passing by " +
26- "accident. Implementing real stacking-context ordering (a ZIndex box property, plus grouping/" +
27- "sorting descendants by stacking context per CSS2.1 Appendix E) is a separate, larger feature port." ) ]
17+ [ Ignore ( "z-index and stacking-context paint order aren't implemented yet, boxes paint in document order" ) ]
2818 [ TestMethod ]
2919 public void PositionedZIndex_PaintsOverFixedPositionedContent ( )
3020 {
31- // A black position:fixed bar declared AFTER (later in the box tree than) a white
32- // position:relative;z-index:2 box must still be painted BEFORE it (i.e. underneath) .
21+ // The white z-index:2 box must paint on top of the black fixed bar, even though the painter
22+ // currently draws the fixed bar after the normal flow .
3323 var html = LayoutHarness . Wrap (
3424 "<div id='fixedbar' style='position:fixed; top:0; left:0; width:50px; height:50px; background:rgb(0,0,0);'></div>"
3525 + "<div id='intro' style='position:relative; z-index:2; width:50px; height:50px; background:rgb(255,255,255);'></div>" ) ;
3626
37- var ( root , container ) = PaintHarness . Layout ( html ) ;
27+ var ( _ , container ) = PaintHarness . Layout ( html ) ;
3828 var recorder = PaintHarness . PaintPage ( container ) ;
3929
40- var fixedBar = PaintHarness . FindById ( root , "fixedbar" ) ! ;
41- var intro = PaintHarness . FindById ( root , "intro" ) ! ;
42-
4330 var drawRectCalls = recorder . Log . OfType < RecordingGraphics . DrawRectCall > ( ) . ToList ( ) ;
44- var fixedBarPaintIndex = drawRectCalls . FindIndex ( c => c . X == fixedBar . Location . X && c . Y == fixedBar . Location . Y ) ;
45- var introPaintIndex = drawRectCalls . FindIndex ( c => c . X == intro . Location . X && c . Y == intro . Location . Y ) ;
31+ var fixedBarPaintIndex = drawRectCalls . FindIndex ( c => c . Color . R == 0 && c . Color . G == 0 && c . Color . B == 0 ) ;
32+ var introPaintIndex = drawRectCalls . FindIndex ( c => c . Color . R == 255 && c . Color . G == 255 && c . Color . B == 255 ) ;
4633
34+ Assert . IsGreaterThanOrEqualTo ( 0 , fixedBarPaintIndex ) ;
35+ Assert . IsGreaterThanOrEqualTo ( 0 , introPaintIndex ) ;
4736 Assert . IsTrue ( fixedBarPaintIndex < introPaintIndex ,
4837 "the z-index:2 box must paint after (on top of) the fixed bar, regardless of document order" ) ;
4938 }
0 commit comments