Skip to content

Commit

Permalink
Apply overflow to replaced boxes
Browse files Browse the repository at this point in the history
  • Loading branch information
liZe committed Mar 16, 2024
1 parent 018ff6b commit 13e204c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
1 change: 1 addition & 0 deletions weasyprint/css/html5_ua.css
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ style { display: none; }
sub { font-size: smaller; line-height: normal; vertical-align: sub; }
summary { display: block; /* unicode-bidi: isolate; */ }
sup { font-size: smaller; line-height: normal; vertical-align: super; }
img, svg { overflow: hidden; }

table { border-collapse: separate; border-color: gray; border-spacing: 2px; display: table; text-indent: 0; /* unicode-bidi: isolate; */ }

Expand Down
2 changes: 2 additions & 0 deletions weasyprint/css/tests_ua.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ h4 { bookmark-level: 4; bookmark-label: content(text) }
h5 { bookmark-level: 5; bookmark-label: content(text) }
h6 { bookmark-level: 6; bookmark-label: content(text) }

img, svg { overflow: hidden; }

::marker { unicode-bidi: isolate; font-variant-numeric: tabular-nums }

::footnote-call { content: counter(footnote) }
Expand Down
13 changes: 4 additions & 9 deletions weasyprint/draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def draw_stacking_context(stream, stacking_context):
# Point 2
if isinstance(box, (boxes.BlockBox, boxes.MarginBox,
boxes.InlineBlockBox, boxes.TableCellBox,
boxes.FlexContainerBox)):
boxes.FlexContainerBox, boxes.ReplacedBox)):
# The canvas background was removed by layout_backgrounds
draw_background(stream, box.background)
draw_border(stream, box)
Expand Down Expand Up @@ -148,14 +148,12 @@ def draw_stacking_context(stream, stacking_context):
# Point 6
if isinstance(box, boxes.InlineBox):
draw_inline_level(stream, stacking_context.page, box)
elif isinstance(box, boxes.ReplacedBox):
draw_replacedbox(stream, box)

# Point 7
for block in [box] + stacking_context.blocks_and_cells:
if isinstance(block, boxes.ReplacedBox):
draw_background(stream, block.background)
draw_border(stream, block)
draw_replacedbox(stream, block)
elif block.children:
if block.children:
if block != box:
stream.begin_marked_content(block, mcid=True)
if isinstance(block.children[-1], boxes.LineBox):
Expand Down Expand Up @@ -983,9 +981,6 @@ def draw_replacedbox(stream, box):
return

with stacked(stream):
rounded_box_path(stream, box.rounded_content_box())
stream.clip()
stream.end()
stream.transform(e=draw_x, f=draw_y)
with stacked(stream):
# TODO: Use the real intrinsic size here, not affected by
Expand Down

0 comments on commit 13e204c

Please sign in to comment.