mirror of
https://github.com/Kozea/WeasyPrint.git
synced 2024-10-05 16:37:47 +03:00
Make grid items with z-index create stacking contexts
This commit is contained in:
parent
3e11840a8d
commit
4a1efefcc1
@ -1211,8 +1211,8 @@ def draw_inline_level(stream, page, box, offset_x=0, text_overflow='clip',
|
||||
block_ellipsis='none'):
|
||||
if isinstance(box, StackingContext):
|
||||
stacking_context = box
|
||||
assert isinstance(
|
||||
stacking_context.box, (boxes.InlineBlockBox, boxes.InlineFlexBox))
|
||||
assert isinstance(stacking_context.box, (
|
||||
boxes.InlineBlockBox, boxes.InlineFlexBox, boxes.InlineGridBox))
|
||||
draw_stacking_context(stream, stacking_context)
|
||||
else:
|
||||
draw_background(stream, box.background)
|
||||
|
@ -74,6 +74,7 @@ def _dispatch(box, page, child_contexts, blocks, floats, blocks_and_cells):
|
||||
# Remove boxes defining a new stacking context from the children list.
|
||||
defines_stacking_context = (
|
||||
(style['position'] != 'static' and style['z_index'] != 'auto') or
|
||||
(box.is_grid_item and style['z_index'] != 'auto') or
|
||||
style['opacity'] < 1 or
|
||||
style['transform'] or # 'transform: none' gives a "falsy" empty list
|
||||
style['overflow'] != 'visible')
|
||||
@ -90,7 +91,8 @@ def _dispatch(box, page, child_contexts, blocks, floats, blocks_and_cells):
|
||||
child_contexts.insert(index, stacking_context)
|
||||
elif box.is_floated():
|
||||
floats.append(StackingContext.from_box(box, page, child_contexts))
|
||||
elif isinstance(box, (boxes.InlineBlockBox, boxes.InlineFlexBox)):
|
||||
elif isinstance(box, (
|
||||
boxes.InlineBlockBox, boxes.InlineFlexBox, boxes.InlineGridBox)):
|
||||
# Have this fake stacking context be part of the "normal" box tree,
|
||||
# because we need its position in the middle of a tree of inline boxes.
|
||||
return StackingContext.from_box(box, page, child_contexts)
|
||||
|
Loading…
Reference in New Issue
Block a user