Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3 0øªjÏWã@sêdZddlZddlmZGdd„dƒZGdd„deƒZGd d „d eƒZGd d „d eƒZGd d„deeƒZGdd„deƒZ Gdd„deƒZ Gdd„de eƒZ Gdd„de ƒZ Gdd„de ƒZ Gdd„de eƒZGdd„deƒZGdd„deeƒZGdd „d ee ƒZGd!d"„d"eeƒZGd#d$„d$eƒZGd%d&„d&eƒZGd'd(„d(eƒZGd)d*„d*eƒZGd+d,„d,eƒZGd-d.„d.eƒZGd/d0„d0eƒZGd1d2„d2eƒZGd3d4„d4eƒZGd5d6„d6eƒZGd7d8„d8eƒZGd9d:„d:eeƒZGd;d<„d„Z1d?d@„Z2dAdB„Z3dS)DÚBoxz"Abstract base class for all boxes.FNcCsfS)N©)ÚselfrrúK/tmp/pip-build-_d5lkt3n/weasyprint/weasyprint/formatting_structure/boxes.pyÚ all_childrenYszBox.all_childrencCs||_||_||_tƒ|_dS)N)Ú element_tagÚelementÚstyleÚsetÚremove_decoration_sides)rr r r rrrÚ__init__\sz Box.__init__cCsdt|ƒj›d|j›d�S)Nú<ú ú>)ÚtypeÚ__name__r )rrrrÚ__repr__bsz Box.__repr__cOs(ti|jdd�}||j||jf|ž|ŽS)z6Return an anonymous box that inherits from ``parent``.N)ZcascadedZ parent_styler )rr r r )ÚclsÚparentÚargsÚkwargsr rrrÚanonymous_fromeszBox.anonymous_fromcCs$t|ƒ}|j|ƒ}|jj|jƒ|S)zReturn shallow copy of the box.)rÚ__new__Ú__dict__Úupdate)rrÚnew_boxrrrÚcopyls zBox.copycCs|jƒS)z?Return a copy of the box with recursive copies of its children.)r)rrrrÚdeepcopyvsz Box.deepcopyrcCs`|dkr|dkrdS|j|7_|j|7_x*|jƒD]}|oH|jƒs:|j|||ƒq:WdS)ucChange the box’s position. Also update the children’s positions accordingly. rN)Ú position_xÚ position_yrÚ is_floatedÚ translate)rÚdxÚdyÚ ignore_floatsÚchildrrrr#zs z Box.translatecCs|j|j|jS)zWidth of the padding box.)ÚwidthÚ padding_leftÚ padding_right)rrrrÚ padding_width‹szBox.padding_widthcCs|j|j|jS)zHeight of the padding box.)ÚheightÚ padding_topÚpadding_bottom)rrrrÚpadding_height�szBox.padding_heightcCs|jƒ|j|jS)zWidth of the border box.)r+Úborder_left_widthÚborder_right_width)rrrrÚ border_width“s zBox.border_widthcCs|jƒ|j|jS)zHeight of the border box.)r/Úborder_top_widthÚborder_bottom_width)rrrrÚ border_height˜s zBox.border_heightcCs|jƒ|j|jS)z)Width of the margin box (aka. outer box).)r2Ú margin_leftÚ margin_right)rrrrÚ margin_width�szBox.margin_widthcCs|jƒ|j|jS)z*Height of the margin box (aka. outer box).)r5Ú margin_topÚ margin_bottom)rrrrÚ margin_height¡szBox.margin_heightcCs|j|j|j|jS)z0Absolute horizontal position of the content box.)r r6r)r0)rrrrÚ content_box_x§szBox.content_box_xcCs|j|j|j|jS)z.Absolute vertical position of the content box.)r!r9r-r3)rrrrÚ content_box_y¬szBox.content_box_ycCs|j|j|jS)z0Absolute horizontal position of the padding box.)r r6r0)rrrrÚ padding_box_x±szBox.padding_box_xcCs|j|j|jS)z.Absolute vertical position of the padding box.)r!r9r3)rrrrÚ padding_box_yµszBox.padding_box_ycCs |j|jS)z/Absolute horizontal position of the border box.)r r6)rrrrÚ border_box_x¹szBox.border_box_xcCs |j|jS)z-Absolute vertical position of the border box.)r!r9)rrrrÚ border_box_y½szBox.border_box_ycCs|jƒ|jƒ|jƒ|jƒfS)z=Return the (x, y, w, h) rectangle where the box is clickable.)r@rAr2r5)rrrrÚhit_areaÁs z Box.hit_areac CsT|j\}}|j\}}|j\} } |j\} } td||ƒ}td||ƒ}td||ƒ}td||ƒ}td| |ƒ} td| |ƒ} td| |ƒ} td| |ƒ} |jƒ|} |jƒ|}|jƒ||}|jƒ||}t dgdd„|||f|| | f||| f||| fgDƒƒ}| |||||||f||||f| || |f| || |ffS)z¹Position, 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écSs g|]\}}|dkr||‘qS)rr)Ú.0ZextentZ sum_radiirrrú æsz#Box.rounded_box..) Zborder_top_left_radiusZborder_top_right_radiusZborder_bottom_right_radiusZborder_bottom_left_radiusÚmaxr@rAr2r5Úmin)rZbtÚbrZbbÚblZtlrxZtlryZtrrxZtrryZbrrxZbrryZblrxZblryÚxÚyr(r,ÚratiorrrÚ rounded_boxÉs6         zBox.rounded_boxcCs(|j|j||j||j||j|ƒS)N)rMr3r1r4r0)rrLrrrÚrounded_box_ratioös zBox.rounded_box_ratiocCs|j|j|j|j|jƒS)z?Return the position, size and radii of the rounded padding box.)rMr3r1r4r0)rrrrÚrounded_padding_boxýs zBox.rounded_padding_boxcCs|jddddƒS)z>Return the position, size and radii of the rounded border box.r)rM)rrrrÚrounded_border_boxszBox.rounded_border_boxcCs0|j|j|j|j|j|j|j|j|jƒS)z?Return the position, size and radii of the rounded content box.) rMr3r-r1r*r4r.r0r))rrrrÚrounded_content_box s    zBox.rounded_content_boxcCs|jddkS)z#Return whether this box is floated.ÚfloatÚleftÚright)rSrT)r )rrrrr"szBox.is_floatedcCs|jddkS)z&Return whether this box is a footnote.rRÚfootnote)r )rrrrÚ is_footnoteszBox.is_footnotecCs|jddkS)z>Return whether this box is in the absolute positioning scheme.ÚpositionÚabsoluteÚfixed)rXrY)r )rrrrÚis_absolutely_positionedszBox.is_absolutely_positionedcCs|jdddkS)z-Return whether this box is a running element.rWrz running())r )rrrrÚ is_runningszBox.is_runningcCs"|jƒp|jƒp|jƒp|jƒ S)z*Return whether this box is in normal flow.)r"rZr[rV)rrrrÚis_in_normal_flow#szBox.is_in_normal_flowcCs|jd|jdfS)z!Return start and end page values.Úpage)r )rrrrÚ page_values+szBox.page_values)rrF)4rÚ __module__Ú __qualname__Ú__doc__Úproper_table_childÚinternal_table_or_captionÚtabular_containerZleading_collapsible_spaceZtrailing_collapsible_spaceÚis_table_wrapperZ is_flex_itemZis_for_root_elementZ is_columnZ is_leaderÚ is_attachmentZtransformation_matrixZbookmark_labelZ string_setZ download_namerUrrrÚ classmethodrrrr#r+r/r2r5r8r;r<r=r>r?r@rArBrMrNrOrPrQr"rVrZr[r\r^rrrrr=s`   - rcsdeZdZdZ‡fdd„Zdd„Zdd„Zdd „Zd d „Zd d „Z dd„Z dd„Z ‡fdd„Z ‡Z S)Ú ParentBoxzA box that has children.cstƒj|||ƒt|ƒ|_dS)N)ÚsuperrÚtupleÚchildren)rr r r rk)Ú __class__rrr2szParentBox.__init__cCs|jS)N)rk)rrrrr6szParentBox.all_childrencCsH|jj|ƒt|d|›�dƒt|d|›�dƒt|d|›d�dƒdS)z4Set to 0 the margin, padding and border of ``side``.Zmargin_rZpadding_Zborder_Ú_widthN)r ÚaddÚsetattr)rZsiderrrÚ_reset_spacing9s zParentBox._reset_spacingcCs2|jddkrdS|r |jdƒ|r.|jdƒdS)NÚbox_decoration_breakÚcloneÚtopZbottom)r rp)rÚstartÚendrrrÚremove_decoration@s  zParentBox.remove_decorationcCs|jƒ}t|ƒ|_tƒ|_|S)z8Create a new equivalent box with given ``new_children``.)rÚlistrkr r )rZ new_childrenrrrrÚcopy_with_childrenHs zParentBox.copy_with_childrencCs"|jƒ}tdd„|jDƒƒ|_|S)Ncss|]}|jƒVqdS)N)r)rDr'rrrú Usz%ParentBox.deepcopy..)rrjrk)rÚresultrrrrSszParentBox.deepcopyccsD|Vx8|jD].}t|tƒr6x|jƒD] }|Vq&Wq|VqWdS)z9A flat generator for a box, its children and descendants.N)rkÚ isinstancerhÚ descendants)rr'Z grand_childrrrr|Xs    zParentBox.descendantscCs4|js t‚x$|jD]}t|tƒr|SqWtdƒ‚dS)z!Get the table wrapped by the box.zTable wrapper without a tableN)reÚAssertionErrorrkr{ÚTableBoxÚ ValueError)rr'rrrÚget_wrapped_tablebs    zParentBox.get_wrapped_tablecsˆtƒjƒ\}}|jr€t|jƒdkrJ|jdjƒ}|dp:|}|dpF|}n6|jd|jd}}|jƒdpn|}|jƒdp~|}||fS)NrCréÿÿÿÿ)rir^rkÚlen)rZ start_valueÚ end_valuer^Z start_boxZend_box)rlrrr^ks zParentBox.page_values)rr_r`rarrrprvrxrr|r€r^Ú __classcell__rr)rlrrh0s    rhc@seZdZdZdZdS)Ú BlockLevelBoxz°A 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. N)rr_r`raZ clearancerrrrr…ysr…c@seZdZdZdS)ÚBlockContainerBoxajA 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. N)rr_r`rarrrrr†ƒs r†c@seZdZdZdS)ÚBlockBoxz£A 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. N)rr_r`rarrrrr‡�sr‡cs,eZdZdZdZdZe‡fdd„ƒZ‡ZS)ÚLineBoxaKA 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. ZclipÚnonecs2tƒj|f|ž|Ž}|jddkr.|jd|_|S)NZoverflowZvisibleÚ text_overflow)rirr rŠ)rrrrZbox)rlrrr¦s zLineBox.anonymous_from) rr_r`rarŠZblock_ellipsisrgrr„rr)rlrrˆ™s rˆc@seZdZdZdd„ZdS)ÚInlineLevelBoxaQA 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. cCsP|jddkrdS|jddk}|r6|j|r0dndƒ|rL|j|rFdndƒdS)NrqrrÚ directionÚltrrSrT)r rp)rrtrur�rrrrv¸sz InlineLevelBox.remove_decorationN)rr_r`rarvrrrrr‹®s r‹c@seZdZdZdd„ZdS)Ú InlineBoxaAn 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. cCs|jƒ|j|jƒ|jƒfS)z=Return the (x, y, w, h) rectangle where the box is clickable.)r@r!r2r;)rrrrrBÌs zInlineBox.hit_areaN)rr_r`rarBrrrrrŽÂs rŽcs,eZdZdZdZ‡fdd„Zdd„Z‡ZS)ÚTextBoxz²A 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. rcs"|st‚tƒj|||ƒ||_dS)N)r}rirÚtext)rr r r r�)rlrrrÜszTextBox.__init__cCs|st‚|jƒ}||_|S)z?Return a new TextBox identical to this one except for the text.)r}rr�)rr�rrrrÚcopy_with_textászTextBox.copy_with_text)rr_r`raZjustification_spacingrr‘r„rr)rlrr�Ós r�c@seZdZdZdS)ÚAtomicInlineLevelBoxzpAn atomic box in an inline formatting context. This inline-level box cannot be split for line breaks. N)rr_r`rarrrrr’ésr’c@seZdZdZdS)ÚInlineBlockBoxzëA 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. N)rr_r`rarrrrr“ñsr“cs eZdZdZ‡fdd„Z‡ZS)Ú ReplacedBoxu£A box whose content is replaced. For example, ```` are replaced: their content is rendered externally and is opaque from CSS’s point of view. cstƒj|||ƒ||_dS)N)rirÚ replacement)rr r r r•)rlrrrszReplacedBox.__init__)rr_r`rarr„rr)rlrr”üsr”c@seZdZdZdS)ÚBlockReplacedBoxz·A 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. N)rr_r`rarrrrr–sr–c@seZdZdZdS)ÚInlineReplacedBoxzÉA 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. N)rr_r`rarrrrr—sr—cs6eZdZdZdZdd„Zd ‡fdd„ Zd d „Z‡ZS) r~z(Box for elements with ``display: table``TcCstj|j|jƒS)N)Ú itertoolsÚchainrkZ column_groups)rrrrr!szTableBox.all_childrenrFcs&‡fdd„|jDƒ|_tƒjˆ||ƒS)Ncsg|] }|ˆ‘qSrr)rDrW)r$rrrE&sz&TableBox.translate..)Zcolumn_positionsrir#)rr$r%r&)rl)r$rr#$szTableBox.translatecCs|jd|jdfS)Nr])r )rrrrr^)szTableBox.page_values)rrF) rr_r`rardrr#r^r„rr)rlrr~s r~c@seZdZdZdS)ÚInlineTableBoxz/Box for elements with ``display: inline-table``N)rr_r`rarrrrrš-sršc@s,eZdZdZdZdZdZeefZ dZ dZ dS)ÚTableRowGroupBoxz2Box for elements with ``display: table-row-group``TFN) rr_r`rarbrcrdr~ršÚproper_parentsZ is_headerZ is_footerrrrrr›1sr›c@s&eZdZdZdZdZdZeee fZ dS)Ú TableRowBoxz,Box for elements with ``display: table-row``TN) rr_r`rarbrcrdr~ršr›rœrrrrr�=s r�c@sLeZdZdZdZdZeefZdZ dZ dZ dZ dZ dZdZdZdZdd„ZdS)ÚTableColumnGroupBoxz5Box for elements with ``display: table-column-group``TrCrcCsdd„|jDƒS)z3Return cells that originate in the group's columns.cSsg|]}|jƒD]}|‘qqSr)Ú get_cells)rDÚcolumnÚcellrrrrE\sz1TableColumnGroupBox.get_cells..)rk)rrrrrŸYszTableColumnGroupBox.get_cellsN)rr_r`rarbrcr~ršrœÚspanr9r:r6r7r-r.r)r*rŸrrrrržEsržc@sNeZdZdZdZdZeeefZ dZ dZ dZ dZ dZdZdZdZdZdd„ZdS)ÚTableColumnBoxz/Box for elements with ``display: table-column``TrCrcCsdS)zRReturn cells that originate in the column. Is set on instances. Nr)rrrrrŸtszTableColumnBox.get_cellsN)rr_r`rarbrcr~ršržrœr¢r9r:r6r7r-r.r)r*rŸrrrrr£`s r£c@seZdZdZdZdZdZdS)Ú TableCellBoxz-Box for elements with ``display: table-cell``TrCN)rr_r`rarcZcolspanZrowspanrrrrr¤|sr¤c@s eZdZdZdZdZeefZdS)ÚTableCaptionBoxz0Box for elements with ``display: table-caption``TN) rr_r`rarbrcr~ršrœrrrrr¥…sr¥cs(eZdZdZ‡fdd„Zdd„Z‡ZS)ÚPageBoxz¤Box 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. cs||_tƒjd|dgd�dS)N)r r r rk)Ú page_typerir)rr§r )rlrrr“szPageBox.__init__cCsdt|ƒj›d|j›d�S)Nrrr)rrr§)rrrrr™szPageBox.__repr__)rr_r`rarrr„rr)rlrr¦Œs r¦cs(eZdZdZ‡fdd„Zdd„Z‡ZS)Ú MarginBoxz3Box in page margins, as defined in CSS3 Paged Mediacs||_tƒjd|dgd�dS)N)r r r rk)Ú at_keywordrir)rr©r )rlrrrŸszMarginBox.__init__cCsdt|ƒj›d|j›d�S)Nrrr)rrr©)rrrrr¥szMarginBox.__repr__)rr_r`rarrr„rr)rlrr¨�s r¨cs(eZdZdZ‡fdd„Zdd„Z‡ZS)ÚFootnoteAreaBoxz-Box displaying footnotes, as defined in GCPM.cs||_tƒjd|dgd�dS)N)r r r rk)r]rir)rr]r )rlrrr«szFootnoteAreaBox.__init__cCsdt|ƒj›d�S)Nrz @footnote>)rr)rrrrr±szFootnoteAreaBox.__repr__)rr_r`rarrr„rr)rlrrª©s rªc@seZdZdZdS)ÚFlexContainerBoxz$A box that contains only flex-items.N)rr_r`rarrrrr«µsr«c@seZdZdZdS)ÚFlexBoxz‰A 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. N)rr_r`rarrrrr¬¹sr¬c@seZdZdZdS)Ú InlineFlexBoxz‹A 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. N)rr_r`rarrrrr­Ásr­) rar˜Úcssrrrhr…r†r‡rˆr‹rŽr�r’r“r”r–r—r~ršr›r�ržr£r¤r¥r¦r¨rªr«r¬r­rrrrÚ6s> tI