Permalink
Browse files

Fix outside list marker position on absolute list-items.

  • Loading branch information...
1 parent ea18e88 commit bf9575155867db22c3b70702534d83c38d277c5b @SimonSapin committed May 11, 2012
Showing with 20 additions and 9 deletions.
  1. +15 −4 weasyprint/layout/absolute.py
  2. +3 −3 weasyprint/layout/blocks.py
  3. +2 −2 weasyprint/layout/markers.py
@@ -12,6 +12,7 @@
from .percentages import resolve_percentages, resolve_position_percentages
from .preferred import shrink_to_fit
+from .markers import list_marker_layout
from ..formatting_structure import boxes
@@ -164,6 +165,8 @@ def absolute_layout(document, box, containing_block):
absolute_boxes=absolute_boxes, adjoining_margins=None)
box.__dict__ = new_box.__dict__
+ list_marker_layout(document, box)
+
for absolute_box in absolute_boxes:
absolute_layout(document, absolute_box, new_box)
@@ -182,7 +185,15 @@ def translate_except_absolute(box, dx=0, dy=0):
"""
box.position_x += dx
box.position_y += dy
- if isinstance(box, boxes.ParentBox) and \
- box.style.position in ('static', 'relative'):
- for child in box.children:
- translate_except_absolute(child, dx, dy)
+
+ marker = getattr(box, 'outside_list_marker', None)
+ if marker:
+ translate_except_absolute(marker, dx, dy)
+
+ if box.style.position in ('static', 'relative'):
+ if isinstance(box, boxes.ParentBox):
+ for child in box.children:
+ translate_except_absolute(child, dx, dy)
+ if isinstance(box, boxes.TableBox):
+ for child in box.column_groups:
+ translate_except_absolute(child, dx, dy)
@@ -37,8 +37,6 @@ def block_level_layout(document, box, max_position_y, skip_stack,
document, box, max_position_y, skip_stack, containing_block,
device_size, page_is_empty, absolute_boxes)
elif isinstance(box, boxes.BlockBox):
- if box.is_table_wrapper:
- table_wrapper_width(box, containing_block, absolute_boxes)
return block_box_layout(document, box, max_position_y, skip_stack,
containing_block, device_size, page_is_empty,
absolute_boxes, adjoining_margins)
@@ -58,12 +56,14 @@ def block_box_layout(document, box, max_position_y, skip_stack,
absolute_boxes, adjoining_margins):
"""Lay out the block ``box``."""
resolve_percentages(box, containing_block)
+ if box.is_table_wrapper:
+ table_wrapper_width(box, containing_block, absolute_boxes)
block_level_width(box, containing_block)
new_box, resume_at, next_page, adjoining_margins, collapsing_through = \
block_container_layout(
document, box, max_position_y, skip_stack,
device_size, page_is_empty, absolute_boxes, adjoining_margins)
- list_marker_layout(document, new_box, containing_block)
+ list_marker_layout(document, new_box)
return new_box, resume_at, next_page, adjoining_margins, collapsing_through
@@ -19,7 +19,7 @@
from ..formatting_structure import boxes
-def list_marker_layout(document, box, containing_block):
+def list_marker_layout(document, box):
"""Lay out the list markers of ``box``."""
# List markers can be either 'inside' or 'outside'.
# Inside markers are layed out just like normal inline content, but
@@ -28,7 +28,7 @@ def list_marker_layout(document, box, containing_block):
# see CSS3 lists.
marker = getattr(box, 'outside_list_marker', None)
if marker:
- resolve_percentages(marker, containing_block)
+ resolve_percentages(marker, containing_block=box)
if isinstance(marker, boxes.TextBox):
text_fragment = TextFragment(marker.text, marker.style,
context=cairo.Context(document.surface))

0 comments on commit bf95751

Please sign in to comment.