
    Bhf                        S r SSKrSSKJr   " S S5      r " S S\5      r " S	 S
\5      r " S S\5      r " S S\\5      r " S S\5      r	 " S S\5      r
 " S S\
\5      r " S S\
5      r " S S\
5      r " S S\\5      r " S S\5      r " S S\\5      r " S S \\5      r " S! S"\\5      r " S# S$\5      r " S% S&\5      r " S' S(\5      r " S) S*\5      r " S+ S,\5      r " S- S.\5      r " S/ S0\5      r " S1 S2\5      r " S3 S4\5      r " S5 S6\5      r " S7 S8\5      r " S9 S:\\5      r " S; S<\\
5      r " S= S>\5      r  " S? S@\ \5      r! " SA SB\ \
5      r"g)Cu  Classes for all types of boxes in the CSS formatting structure / box model.

See https://www.w3.org/TR/CSS21/visuren.html

Names are the same as in CSS 2.1 with the exception of ``TextBox``. In
WeasyPrint, any text is in a ``TextBox``. What CSS calls anonymous inline boxes
are text boxes but not all text boxes are anonymous inline boxes.

See https://www.w3.org/TR/CSS21/visuren.html#anonymous

Abstract classes, should not be instantiated:

* Box
* BlockLevelBox
* InlineLevelBox
* BlockContainerBox
* ReplacedBox
* ParentBox
* AtomicInlineLevelBox

Concrete classes:

* PageBox
* BlockBox
* InlineBox
* InlineBlockBox
* BlockReplacedBox
* InlineReplacedBox
* TextBox
* LineBox
* Various table-related Box subclasses

All concrete box classes whose name contains "Inline" or "Block" have one of
the following "outside" behavior:

* Block-level (inherits from :class:`BlockLevelBox`)
* Inline-level (inherits from :class:`InlineLevelBox`)

and one of the following "inside" behavior:

* Block container (inherits from :class:`BlockContainerBox`)
* Inline content (InlineBox and :class:`TextBox`)
* Replaced content (inherits from :class:`ReplacedBox`)

… with various combinasions of both.

See respective docstrings for details.

    N   )computed_from_cascadedc                   L   \ rS rSrSrSrSrSrSrSr	Sr
SrSrSrSrSrSrSrSrSrSrSrS rS+S jrS rS r\S	 5       rS
 rS rS,S jrS rS r S r!S r"S r#S r$S r%S r&S r'S r(S r)S r*S r+S r,S r-S r.S r/S r0S r1S  r2S! r3S" r4S# r5S$ r6S% r7S& r8S' r9S( r:S) r;S*r<g)-Box8   z"Abstract base class for all boxes.FNc                     U R                   $ N)childrenselfs    W/var/www/html/env/lib/python3.13/site-packages/weasyprint/formatting_structure/boxes.pyall_childrenBox.all_childrenU   s    }}    c              #      #    U v   U R                    H>  nU(       d  [        U[        5      (       a  UR                  U5       Sh  vN   M:  Uv   M@     g N7f)z9A flat generator for a box, its children and descendants.N)r
   
isinstancer   descendants)r   placeholderschilds      r   r   Box.descendantsX   sC     
]]Ez%55 ,,\:::	 #:s   AAAAc                 T    Xl         X0l        X l        [        5       U l        / U l        g r	   )element_tagelementstylesetremove_decoration_sidesr
   )r   r   r   r   s       r   __init__Box.__init__a   s#    &
'*u$r   c                 N    S[        U 5      R                   SU R                   S3$ N< >)type__name__r   r   s    r   __repr__Box.__repr__h   s)    4:&&'q)9)9(:!<<r   c                 n    [        0 UR                  SS9nU " UR                  XAR                  /UQ70 UD6$ )z6Return an anonymous box that inherits from ``parent``.N)cascadedparent_styler   )r   r   r   r   )clsparentargskwargsr   s        r   anonymous_fromBox.anonymous_fromk   s;     'fllDB6%%unnNtNvNNr   c                     [        U 5      nUR                  U5      nUR                  R                  U R                  5        U$ )zReturn shallow copy of the box.)r$   __new____dict__update)r   r+   new_boxs      r   copyBox.copyr   s8    4j ++c".r   c                 "    U R                  5       $ )z?Return a copy of the box with recursive copies of its children.)r6   r   s    r   deepcopyBox.deepcopy|   s    yy{r   c                    Xs=:X  a  S:X  a   g  U =R                   U-  sl         U =R                  U-  sl        U R                  5        H3  nU(       a  UR                  5       (       a  M!  UR	                  XU5        M5     g)uS   Change the box’s position.

Also update the children’s positions accordingly.

r   N)
position_x
position_yr   
is_floated	translate)r   dxdyignore_floatsr   s        r   r?   Box.translate   sc     =q= 22&&(E!e&6&6&8&86 )r   c                 N    U R                   U R                  -   U R                  -   $ )zWidth of the padding box.)widthpadding_leftpadding_rightr   s    r   padding_widthBox.padding_width   s"    zzD---0B0BBBr   c                 N    U R                   U R                  -   U R                  -   $ )zHeight of the padding box.)heightpadding_toppadding_bottomr   s    r   padding_heightBox.padding_height   s"    {{T---0C0CCCr   c                 V    U R                  5       U R                  -   U R                  -   $ )zWidth of the border box.)rH   border_left_widthborder_right_widthr   s    r   border_widthBox.border_width   s,    !!#d&<&<<##$ 	$r   c                 V    U R                  5       U R                  -   U R                  -   $ )zHeight of the border box.)rN   border_top_widthborder_bottom_widthr   s    r   border_heightBox.border_height   s,    ""$t'<'<<$$% 	%r   c                 V    U R                  5       U R                  -   U R                  -   $ )z)Width of the margin box (aka. outer box).)rS   margin_leftmargin_rightr   s    r   margin_widthBox.margin_width   s'      "T%5%558I8IIIr   c                 V    U R                  5       U R                  -   U R                  -   $ )z*Height of the margin box (aka. outer box).)rX   
margin_topmargin_bottomr   s    r   margin_heightBox.margin_height   s%    !!#doo58J8JJJr   c                 h    U R                   U R                  -   U R                  -   U R                  -   $ )z0Absolute horizontal position of the content box.)r<   r[   rF   rQ   r   s    r   content_box_xBox.content_box_x   s2    !1!11D4E4EE""# 	#r   c                 h    U R                   U R                  -   U R                  -   U R                  -   $ )z.Absolute vertical position of the content box.)r=   r`   rL   rV   r   s    r   content_box_yBox.content_box_y   s0    043C3CC!!" 	"r   c                 N    U R                   U R                  -   U R                  -   $ )z0Absolute horizontal position of the padding box.)r<   r[   rQ   r   s    r   padding_box_xBox.padding_box_x   s"    !1!11D4J4JJJr   c                 N    U R                   U R                  -   U R                  -   $ )z.Absolute vertical position of the padding box.)r=   r`   rV   r   s    r   padding_box_yBox.padding_box_y   s     043H3HHHr   c                 4    U R                   U R                  -   $ )z/Absolute horizontal position of the border box.)r<   r[   r   s    r   border_box_xBox.border_box_x   s    !1!111r   c                 4    U R                   U R                  -   $ )z-Absolute vertical position of the border box.)r=   r`   r   s    r   border_box_yBox.border_box_y   s    00r   c                 ~    U R                  5       U R                  5       U R                  5       U R                  5       4$ z=Return the (x, y, w, h) rectangle where the box is clickable.)rq   rt   rS   rX   r   s    r   hit_areaBox.hit_area   s<    
 !!#T%6%6%8!!#T%7%7%9; 	;r   c           
         U R                   u  pVU R                  u  pxU R                  u  pU R                  u  p[	        SXT-
  5      n[	        SXa-
  5      n[	        SXr-
  5      n[	        SX-
  5      n[	        SX-
  5      n	[	        SX-
  5      n
[	        SX-
  5      n[	        SX-
  5      nU R                  5       U-   nU R                  5       U-   nU R                  5       U-
  U-
  nU R                  5       U-
  U-
  n[        S/XU-   4XU	-   4UXl-   4UX-   44 VVs/ s H  u  nnUS:  d  M  UU-  PM     snn-   5      nXUUUU-  UU-  4UU-  UU-  4U	U-  U
U-  4UU-  UU-  44$ s  snnf )zPosition, size and radii of a box inside the outer border box.

bt, br, bb, and bl are distances from the outer border box,
defining a rectangle to be rounded.

r      )
border_top_left_radiusborder_top_right_radiusborder_bottom_right_radiusborder_bottom_left_radiusmaxrq   rt   rS   rX   min)r   btbrbbbltlrxtlrytrrxtrrybrrxbrryblrxblryxyrE   rK   extent	sum_radiiratios                       r   rounded_boxBox.rounded_box   s    00
11
44
33
1di 1di 1di 1di 1di 1di 1di 1di "$"$!!#b(2-##%*R/ QC t$t$%%	&	
&!	 1} FY&	
 	
 	 %E\4%<(E\4%<(E\4%<(E\4%<(* 	*	
s   E(,	E(c                     U R                  U R                  U-  U R                  U-  U R                  U-  U R                  U-  5      $ r	   r   rV   rR   rW   rQ   )r   r   s     r   rounded_box_ratioBox.rounded_box_ratio   sM    !!E)##e+$$u,""U*	, 	,r   c                 z    U R                  U R                  U R                  U R                  U R                  5      $ )z?Return the position, size and radii of the rounded padding box.r   r   s    r   rounded_padding_boxBox.rounded_padding_box  s9    !!##$$""	$ 	$r   c                 *    U R                  SSSS5      $ )z>Return the position, size and radii of the rounded border box.r   )r   r   s    r   rounded_border_boxBox.rounded_border_box  s    1a++r   c                     U R                  U R                  U R                  -   U R                  U R                  -   U R
                  U R                  -   U R                  U R                  -   5      $ )z?Return the position, size and radii of the rounded content box.)	r   rV   rL   rR   rG   rW   rM   rQ   rF   r   s    r   rounded_content_boxBox.rounded_content_box  se    !!D$4$44##d&8&88$$t':'::""T%6%66	8 	8r   c                 &    U R                   S   S;   $ )z#Return whether this box is floated.float)leftrightr   r   s    r   r>   Box.is_floated  s    zz'"&777r   c                 &    U R                   S   S:H  $ )z&Return whether this box is a footnote.r   footnoter   r   s    r   is_footnoteBox.is_footnote  s    zz'"j00r   c                 &    U R                   S   S;   $ )z>Return whether this box is in the absolute positioning scheme.position)absolutefixedr   r   s    r   is_absolutely_positionedBox.is_absolutely_positioned!  s    zz*%)>>>r   c                 ,    U R                   S   S   S:H  $ )z-Return whether this box is a running element.r   r   z	running()r   r   s    r   
is_runningBox.is_running%  s    zz*%a(K77r   c                     U R                  5       =(       d>    U R                  5       =(       d'    U R                  5       =(       d    U R                  5       (       + $ )z*Return whether this box is in normal flow.)r>   r   r   r   r   s    r   is_in_normal_flowBox.is_in_normal_flow)  sH     OO 4!>!>!@ 4OO4!%!1!1!35 	5r   c                     [        U [        5      =(       d[    [        U [        5      =(       dD    U R                  S   S;   =(       d+    U R                  S   S:H  =(       a    U R                  S   S:g  $ )z&Return whether this box is monolithic.overflow)autoscrollhiddenrK   r   )r   AtomicInlineLevelBoxReplacedBoxr   r   s    r   is_monolithicBox.is_monolithic/  sh     t12 -t[)-JJz"&88- ZZ
#x/ ,ZZ!V+	.r   c                 n   U R                  5       =(       d    U R                  5       =(       d    U R                  =(       du    [        U [        5      =(       a    [        U [
        5      (       + =(       dB    [        U [
        5      =(       a    U R                  S   S:g  =(       d    SU R                  S   ;   $ )z?Return whether this box establishes a block formatting context.r   visiblez	flow-rootdisplay)r>   r   	is_columnr   BlockContainerBoxBlockBoxr   r   s    r   establishes_formatting_context"Box.establishes_formatting_context9  s     OO 1))+1NN1 /0SD(9S5S1 h'ODJJz,Bi,O	1
 4::i00	2r   c                 >    U R                   S   U R                   S   4$ )z!Return start and end page values.pager   r   s    r   page_valuesBox.page_valuesF  s    

6"DJJv$677r   c                     SSK Jn  U R                  b-  U R                  R                  S:X  a  U" U R                  S5      $ g)z>Return whether this link should be stored as a PDF attachment.r   )element_has_link_typea
attachmentF)htmlr   r   tag)r   r   s     r   is_attachmentBox.is_attachmentL  s4    0<<#(8(8C(?(|DDr   c                     U R                   S   S:X  aB  U R                  b5  U R                  R                  S;   a  [        U [        [
        45      (       + $ g)z(Return whether this box is a form input.
appearancer   )buttoninputselecttextareaF)r   r   r   r   LineBoxTextBoxr   s    r   is_inputBox.is_inputV  sI     ::l#v-$,,2J||#LL%dWg,>???r   c                 P    U R                   c  gU R                   R                  S:H  $ )z*Return whether this box is a form element.Fform)r   r   r   s    r   is_formBox.is_form^  s$    <<||6))r   )r
   r   r   r   r   )Fr   r   F)=r%   
__module____qualname____firstlineno____doc__proper_table_childinternal_table_or_captiontabular_containerleading_collapsible_spacetrailing_collapsible_spaceis_table_wrapperis_flex_itemis_grid_itemis_for_root_elementr   	is_leadertransformation_matrixbookmark_label
string_setr   cached_counter_valuesmissing_linkr   r   r   r&   classmethodr/   r6   r9   r?   rH   rN   rS   rX   r]   rb   re   rh   rk   rn   rq   rt   rx   r   r   r   r   r   r>   r   r   r   r   r   r   r   r   r   r   __static_attributes__ r   r   r   r   8   s<   ,  % !&!& LLII !NJH L= O O7"CD$
%
JK#
"
KI21;+*Z,$,881?85.	28*r   r   c                   V   ^  \ rS rSrSrU 4S jrS rS rS rS r	S r
U 4S	 jrS
rU =r$ )	ParentBoxie  zA box that has children.c                 F   > [         TU ]  XU5        [        U5      U l        g r	   )superr   tupler
   )r   r   r   r   r
   	__class__s        r   r   ParentBox.__init__g  s    W5hr   c                     U R                   R                  U5        [        U SU 3S5        [        U SU 3S5        [        U SU S3S5        g)z4Set to 0 the margin, padding and border of ``side``.margin_r   padding_border__widthN)r   addsetattrr   sides     r   _reset_spacingParentBox._reset_spacingk  sQ    $$((.v&*'+vV,a0r   c                     U R                   S   S:X  a  g U(       a  U R                  S5        U(       a  U R                  S5        g g )Nbox_decoration_breakclonetopbottomr   r
  )r   startends      r   remove_decorationParentBox.remove_decorationr  s>    ::,-8&) r   c                 P    U R                  5       nXl        [        5       U l        U$ )z8Create a new equivalent box with given ``new_children``.)r6   r
   r   r   )r   new_childrenr5   s      r   copy_with_childrenParentBox.copy_with_childrenz  s$    ))+' (+u$r   c                 h    U R                  5       n[        S U R                   5       5      Ul        U$ )Nc              3   @   #    U  H  oR                  5       v   M     g 7fr	   )r9   ).0r   s     r   	<genexpr>%ParentBox.deepcopy.<locals>.<genexpr>  s     K]E~~//]s   )r6   listr
   )r   results     r   r9   ParentBox.deepcopy  s(    KT]]KKr   c                     U R                   (       d   eU R                   H  n[        U[        5      (       d  M  Us  $    [	        S5      e)z!Get the table wrapped by the box.zTable wrapper without a table)r   r
   r   TableBox
ValueError)r   r   s     r   get_wrapped_tableParentBox.get_wrapped_table  s?    $$$$]]E%** # <==r   c                   > [         TU ]  5       u  pU R                   Vs/ s H  o3R                  5       (       d  M  UPM     nnU(       a  [	        U5      S:X  a2  US   R                  5       nUS   =(       d    UnUS   =(       d    UnX4$ US   US   pvUR                  5       S   =(       d    UnUR                  5       S   =(       d    UnX4$ s  snf )Nr{   r   )r   r   r
   r   len)	r   start_value	end_valuer   r
   r   	start_boxend_boxr   s	           r   r   ParentBox.page_values  s    !&!4!6
  $}}K,e0G0G0IE} 	 K8}!&qk557)!n;'N7i	
 %% &.a[(2,7'335a8GK#//1!4A		%%Ks
   CC)r
   r   )r%   r   r   r   r   r   r
  r  r  r9   r%  r   r   __classcell__r   s   @r   r   r   e  s.    "(1*	
>& &r   r   c                       \ rS rSrSrSrSrg)BlockLevelBoxi  zA box that participates in an block formatting context.

An element with a ``display`` value of ``block``, ``list-item`` or
``table`` generates a block-level box.

Nr   )r%   r   r   r   r   	clearancer   r   r   r   r2  r2    s     Ir   r2  c                       \ rS rSrSrSrg)r   i  aR  A box that contains only block-level boxes or only line boxes.

A box that either contains only block-level boxes or establishes an inline
formatting context and thus contains only line boxes.

A non-replaced element with a ``display`` value of ``block``,
``list-item``, ``inline-block`` or 'table-cell' generates a block container
box.

r   Nr%   r   r   r   r   r   r   r   r   r   r     s    	r   r   c                       \ rS rSrSrSrg)r   i  zA block-level box that is also a block container.

A non-replaced element with a ``display`` value of ``block``, ``list-item``
generates a block box.

r   Nr5  r   r   r   r   r         r   r   c                   >   ^  \ rS rSrSrSrSr\U 4S j5       rSr	U =r
$ )r   i  a7  A box that represents a line in an inline formatting context.

Can only contain inline-level boxes.

In early stages of building the box tree a single line box contains many
consecutive inline boxes. Later, during layout phase, each line boxes will
be split into multiple line boxes, one for each actual line.

clipnonec                 ~   > [         TU ]  " U/UQ70 UD6nUR                  S   S:w  a  UR                  S   Ul        U$ )Nr   r   text_overflow)r   r/   r   r<  )r+   r,   r-   r.   boxr   s        r   r/   LineBox.anonymous_from  sC    g$V=d=f=<<
#y0 &_ =C
r   r   )r%   r   r   r   r   r<  block_ellipsisr   r/   r   r/  r0  s   @r   r   r     s&     MN r   r   c                       \ rS rSrSrS rSrg)InlineLevelBoxi  a=  A box that participates in an inline formatting context.

An inline-level box that is not an inline box is said to be "atomic". Such
boxes are inline blocks, replaced elements and inline tables.

An element with a ``display`` value of ``inline``, ``inline-table``, or
``inline-block`` generates an inline-level box.

c                     U R                   S   S:X  a  g U R                   S   S:H  nU(       a  U R                  U(       a  SOS5        U(       a  U R                  U(       a  SOS5        g g )Nr  r  	directionltrr   r   r  )r   r  r  rD  s       r   r   InlineLevelBox.remove_decoration  sY    ::,-8jj%.#7;3F; r   r   N)r%   r   r   r   r   r  r   r   r   r   rA  rA    s    <r   rA  c                   "    \ rS rSrSrSrS rSrg)	InlineBoxi  zAn inline box with inline children.

A box that participates in an inline formatting context and whose content
also participates in that inline formatting context.

A non-replaced element with a ``display`` value of ``inline`` generates an
inline box.

Nc                 v    U R                  5       U R                  U R                  5       U R                  5       4$ rw   )rq   r=   rS   rb   r   s    r   rx   InlineBox.hit_area  s7     !!#T__!!#T%7%7%9; 	;r   r   )r%   r   r   r   r   link_annotationrx   r   r   r   r   rG  rG    s     O;r   rG  c                   6   ^  \ rS rSrSrSrU 4S jrS rSrU =r	$ )r   i  zA box that contains only text and has no box children.

Any text in the document ends up in a text box. What CSS calls "anonymous
inline boxes" are also text boxes.

r   c                 D   > U(       d   e[         TU ]  XU5        X@l        g r	   )r   r   text)r   r   r   r   rM  r   s        r   r   TextBox.__init__  s    tW5	r   c                 D    U(       d   eU R                  5       nXl        U$ )z?Return a new TextBox identical to this one except for the text.)r6   rM  )r   rM  r5   s      r   copy_with_textTextBox.copy_with_text  s    t))+r   )rM  )
r%   r   r   r   r   justification_spacingr   rP  r   r/  r0  s   @r   r   r     s     
 r   r   c                       \ rS rSrSrSrg)r   i  zhAn atomic box in an inline formatting context.

This inline-level box cannot be split for line breaks.

r   Nr5  r   r   r   r   r         r   r   c                       \ rS rSrSrSrg)InlineBlockBoxi   zA box that is both inline-level and a block container.

It behaves as inline on the outside and as a block on the inside.

A non-replaced element with a 'display' value of 'inline-block' generates
an inline-block box.

r   Nr5  r   r   r   rV  rV     s    r   rV  c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )r   i+  u   A box whose content is replaced.

For example, ``<img>`` are replaced: their content is rendered externally
and is opaque from CSS’s point of view.

c                 2   > [         TU ]  XU5        X@l        g r	   )r   r   replacement)r   r   r   r   rY  r   s        r   r   ReplacedBox.__init__2  s    W5&r   )rY  )r%   r   r   r   r   r   r   r/  r0  s   @r   r   r   +  s    ' 'r   r   c                       \ rS rSrSrSrg)BlockReplacedBoxi7  zA box that is both replaced and block-level.

A replaced element with a ``display`` value of ``block``, ``liste-item`` or
``table`` generates a block-level replaced box.

r   Nr5  r   r   r   r\  r\  7  r7  r   r\  c                       \ rS rSrSrSrg)InlineReplacedBoxi@  zA box that is both replaced and inline-level.

A replaced element with a ``display`` value of ``inline``,
``inline-table``, or ``inline-block`` generates an inline-level replaced
box.

r   Nr5  r   r   r   r^  r^  @  s    r   r^  c                   @   ^  \ rS rSrSrSrS rSU 4S jjrS rSr	U =r
$ )	r#  iJ  z(Box for elements with ``display: table``Tc                 X    [         R                  " U R                  U R                  5      $ r	   )	itertoolschainr
   column_groupsr   s    r   r   TableBox.all_childrenP  s    t}}d.@.@AAr   c                 v   > U R                    Vs/ s H  oDU-   PM	     snU l         [        TU ]	  XU5      $ s  snf r	   )column_positionsr   r?   )r   r@   rA   rB   r   r   s        r   r?   TableBox.translateS  sB    *.*?*?!A*?hrM*?!Aw 77!As   6c                 >    U R                   S   U R                   S   4$ )Nr   r   r   s    r   r   TableBox.page_valuesX  s    

6"DJJv$677r   )rf  r   )r%   r   r   r   r   r   r   r?   r   r   r/  r0  s   @r   r#  r#  J  s#    2 B8
8 8r   r#  c                       \ rS rSrSrSrg)InlineTableBoxi\  z/Box for elements with ``display: inline-table``r   Nr5  r   r   r   rk  rk  \  s    9r   rk  c                   4    \ rS rSrSrSrSrSr\\	4r
SrSrSrg)TableRowGroupBoxi`  z2Box for elements with ``display: table-row-group``TFr   N)r%   r   r   r   r   r   r   r   r#  rk  proper_parents	is_header	is_footerr   r   r   r   rm  rm  `  s-    < $/N IIr   rm  c                   .    \ rS rSrSrSrSrSr\\	\
4rSrg)TableRowBoxil  z,Box for elements with ``display: table-row``Tr   N)r%   r   r   r   r   r   r   r   r#  rk  rm  rn  r   r   r   r   rr  rr  l  s$    6 $0@ANr   rr  c                   ^    \ rS rSrSrSrSr\\4r	Sr
SrSrSrSrSrSrSrS r\S 5       rSrg)	TableColumnGroupBoxit  z5Box for elements with ``display: table-column-group``Tr   c                 x    U R                    VVs/ s H  oR                  5         H  o"PM     M     snn$ s  snnf )z3Return cells that originate in the group's columns.)r
   	get_cells)r   columncells      r   rv  TableColumnGroupBox.get_cells  s=      $}}M,V9I9I9KD9KD}M 	M Ms   "6c                     U R                   (       a  [        U R                   5      $  [        [        U R                  R                  SS5      R                  5       5      S5      $ ! [         a     gf = fNspan r{   )r
   r)  r   intr   getstripr$  r   s    r   r|  TableColumnGroupBox.span  s[    ==t}}%%3t||//;AACDaHH s   <A% %
A21A2r   N)r%   r   r   r   r   r   r   r#  rk  rn  r`   ra   r[   r\   rL   rM   rF   rG   rv  propertyr|  r   r   r   r   rt  rt  t  s_    ? $/N JMKLKNLMM
  r   rt  c                   `    \ rS rSrSrSrSr\\\	4r
SrSrSrSrSrSrSrSrS r\S 5       rSrg)	TableColumnBoxi  z/Box for elements with ``display: table-column``Tr   c                     [         e)zBReturn cells that originate in the column.

Is set on instances.

)NotImplementedErrorr   s    r   rv  TableColumnBox.get_cells  s
     "!r   c                      [        [        U R                  R                  SS5      R	                  5       5      S5      $ ! [
         a     gf = fr{  )r   r~  r   r  r  r$  r   s    r   r|  TableColumnBox.span  sE    	s4<<++FB7==?@!DD 		s   <? 
AAr   N)r%   r   r   r   r   r   r   r#  rk  rt  rn  r`   ra   r[   r\   rL   rM   rF   rG   rv  r  r|  r   r   r   r   r  r    sa    9 $0CDN JMKLKNLM"  r   r  c                   0   ^  \ rS rSrSrSrU 4S jrSrU =r$ )TableCellBoxi  z-Box for elements with ``display: table-cell``Tc                   > [         TU ]  " U0 UD6   [        [        U R                  R                  SS5      R                  5       5      S5      U l         [        [        U R                  R                  SS5      R                  5       5      S5      U l
        g ! [        [        4 a
    SU l         N]f = f! [        [        4 a
    SU l
         g f = f)Ncolspanr}  r{   rowspanr   )r   r   r   r~  r   r  r  r  AttributeErrorr$  r  )r   r-   r.   r   s      r   r   TableCellBox.__init__  s    $)&)	s4<<#3#3Ir#B#H#H#JKQODL	s4<<#3#3Ir#B#H#H#JKQODL 
+ 	DL	 
+ 	DL	s%   AB AB6 B32B36CC)r  r  )	r%   r   r   r   r   r   r   r   r/  r0  s   @r   r  r    s    7 $ r   r  c                   (    \ rS rSrSrSrSr\\4r	Sr
g)TableCaptionBoxi  z0Box for elements with ``display: table-caption``Tr   N)r%   r   r   r   r   r   r   r#  rk  rn  r   r   r   r   r  r    s    : $/Nr   r  c                   R   ^  \ rS rSrSrU 4S jrS r\S 5       r\S 5       r	Sr
U =r$ )PageBoxi  zBox for a page.

Initially the whole document will be in the box for the root element.
During layout a new page box is created after every page break.

c                 2   > Xl         [        TU ]	  S US / S9  g N)r   r   r   r
   )	page_typer   r   )r   r  r   r   s      r   r   PageBox.__init__  s$    "E4" 	 	Fr   c                 N    S[        U 5      R                   SU R                   S3$ r    )r$   r%   r  r   s    r   r&   PageBox.__repr__  s'    4:&&'q(8::r   c                 f    S Vs0 s H  nXR                   SU 3   R                  _M!     sn$ s  snf )N)r  r   r  r   bleed_)r   valuer  s     r   bleedPageBox.bleed  sA     ;<: **vdV_-333:< 	< <s   &.c                     U R                   S   * U R                   S   * U R                  5       U R                   S   -   U R                   S   -   U R                  5       U R                   S   -   U R                   S   -   4$ )Nr   r  r   r  )r  r]   rb   r   s    r   
bleed_areaPageBox.bleed_area  s}     ZZ$**U"3!3$**V"44tzz'7JJ 4::e#44tzz(7KKM 	Mr   )r  )r%   r   r   r   r   r   r&   r  r  r  r   r/  r0  s   @r   r  r    s=    F; < <
 M Mr   r  c                   2   ^  \ rS rSrSrU 4S jrS rSrU =r$ )	MarginBoxi  z3Box in page margins, as defined in CSS3 Paged Mediac                 2   > Xl         [        TU ]	  S US / S9  g r  )
at_keywordr   r   )r   r  r   r   s      r   r   MarginBox.__init__  s$    $E4" 	 	Fr   c                 N    S[        U 5      R                   SU R                   S3$ r    )r$   r%   r  r   s    r   r&   MarginBox.__repr__  s'    4:&&'q(9;;r   )r  	r%   r   r   r   r   r   r&   r   r/  r0  s   @r   r  r    s    =F< <r   r  c                   2   ^  \ rS rSrSrU 4S jrS rSrU =r$ )FootnoteAreaBoxi  z-Box displaying footnotes, as defined in GCPM.c                 2   > Xl         [        TU ]	  S US / S9  g r  )r   r   r   )r   r   r   r   s      r   r   FootnoteAreaBox.__init__   s$    	E4" 	 	Fr   c                 4    S[        U 5      R                   S3$ )Nr!   z @footnote>)r$   r%   r   s    r   r&   FootnoteAreaBox.__repr__  s    4:&&'{33r   )r   r  r0  s   @r   r  r    s    7F4 4r   r  c                       \ rS rSrSrSrg)FlexContainerBoxi
  z$A box that contains only flex-items.r   Nr5  r   r   r   r  r  
      .r   r  c                       \ rS rSrSrSrg)FlexBoxi  zA box that is both block-level and a flex container.

It behaves as block on the outside and as a flex container on the inside.

r   Nr5  r   r   r   r  r    rT  r   r  c                       \ rS rSrSrSrg)InlineFlexBoxi  zA box that is both inline-level and a flex container.

It behaves as inline on the outside and as a flex container on the inside.

r   Nr5  r   r   r   r  r    rT  r   r  c                       \ rS rSrSrSrg)GridContainerBoxi  z$A box that contains only grid-items.r   Nr5  r   r   r   r  r    r  r   r  c                       \ rS rSrSrSrg)GridBoxi"  zA box that is both block-level and a grid container.

It behaves as block on the outside and as a grid container on the inside.

r   Nr5  r   r   r   r  r  "  rT  r   r  c                       \ rS rSrSrSrg)InlineGridBoxi*  zA box that is both inline-level and a grid container.

It behaves as inline on the outside and as a grid container on the inside.

r   Nr5  r   r   r   r  r  *  rT  r   r  )#r   ra  cssr   r   r   r2  r   r   r   rA  rG  r   r   rV  r   r\  r^  r#  rk  rm  rr  rt  r  r  r  r  r  r  r  r  r  r  r  r  r   r   r   <module>r     s  0d  (j* j*Z	>& >&BC 
	 
 - i *<S <(;	 ;&n ,> )+< 	'# 	'{M %9 8}i 8$:X :	y 	B) B) DY B$ ,0h 0Mi M<	<! 	<	4h 	4/y / $n /y / $n r   