167 lines
4.4 KiB
PostScript
167 lines
4.4 KiB
PostScript
% $Header: /cvsroot/html2ps/postscript/box.table.cell.ps,v 1.1 2005/12/18 07:21:37 Konstantin Exp $
|
|
|
|
/box-table-cell-apply-vertical-align { % => Baseline Height Cell
|
|
dup /vertical-align
|
|
get-css-value % => Baseline Height Cell Valign
|
|
{ % => Baseline Height Cell Valign
|
|
dup /baseline eq {
|
|
pop % => Baseline Height Cell
|
|
|
|
2 index
|
|
1 index box-table-cell-get-baseline
|
|
sub % => Baseline Height Cell Delta
|
|
|
|
1 index get-top % => Baseline Height Cell Delta OldTop
|
|
1 index neg
|
|
0
|
|
4 index /offset call-method % => Baseline Height Cell Delta OldTop
|
|
2 index put-top % => Baseline Height Cell Delta
|
|
|
|
pop
|
|
|
|
exit
|
|
} if
|
|
dup /bottom eq {
|
|
pop % => Baseline Height Cell
|
|
|
|
1 index
|
|
1 index box-container-get-real-full-height
|
|
sub % => Baseline Height Cell Delta
|
|
|
|
1 index get-top % => Baseline Height Cell Delta OldTop
|
|
|
|
1 index neg 0
|
|
4 index
|
|
/offset call-method % => Baseline Height Cell Delta OldTop
|
|
|
|
2 index put-top % => Baseline Height Cell Delta
|
|
pop
|
|
exit
|
|
} if
|
|
dup /middle eq {
|
|
pop % => Baseline Height Cell
|
|
|
|
1 index
|
|
1 index box-container-get-real-full-height
|
|
sub 2 div
|
|
0 max % => Baseline Height Cell Delta
|
|
|
|
1 index get-top % => Baseline Height Cell Delta OldTop
|
|
|
|
1 index neg 0
|
|
4 index
|
|
/offset call-method % => Baseline Height Cell Delta OldTop
|
|
|
|
2 index put-top % => Baseline Height Cell Delta
|
|
pop
|
|
exit
|
|
} if
|
|
dup /super eq { pop exit } if
|
|
dup /sub eq { pop exit } if
|
|
dup /text-top eq { pop exit } if
|
|
dup /text-bottom eq {
|
|
pop % => Baseline Height Cell
|
|
|
|
2 index
|
|
1 index box-table-cell-get-baseline
|
|
sub % => Baseline Height Cell Delta
|
|
|
|
1 index get-top % => Baseline Height Cell Delta OldTop
|
|
1 index neg
|
|
0
|
|
4 index /offset call-method % => Baseline Height Cell Delta OldTop
|
|
2 index put-top % => Baseline Height Cell Delta
|
|
|
|
pop
|
|
|
|
exit
|
|
} if
|
|
dup /top eq { pop exit } if
|
|
pop exit
|
|
} loop
|
|
|
|
pop pop pop
|
|
} def
|
|
|
|
/box-table-cell-create {
|
|
box-container-create
|
|
dup box-table-cell-setup-methods
|
|
dup /box-table-cell add-type
|
|
|
|
dup /Colspan 1 put
|
|
dup /Rowspan 1 put
|
|
dup /column 0 put
|
|
dup /row 0 put
|
|
} def
|
|
|
|
/box-table-cell-get-baseline { % => Cell
|
|
dup box-container-get-first-data % => Cell First
|
|
dup /null eq {
|
|
pop pop 0
|
|
} {
|
|
get-baseline exch pop
|
|
} ifelse
|
|
} def
|
|
|
|
/box-table-cell-get-colspan {
|
|
/Colspan get
|
|
} def
|
|
|
|
/box-table-cell-get-rowspan {
|
|
/Rowspan get
|
|
} def
|
|
|
|
/box-table-cell-put-colspan {
|
|
exch /Colspan exch put
|
|
} def
|
|
|
|
/box-table-cell-put-rowspan {
|
|
exch /Rowspan exch put
|
|
} def
|
|
|
|
/box-table-cell-reflow { % => Context Parent Cell
|
|
% Determine upper-left _content_ corner position of current box
|
|
1 index get-current-x
|
|
1 index get-extra-left add
|
|
1 index put-left % => Content Parent Cell
|
|
|
|
% NOTE: Table cell margin is used as a cell-spacing value
|
|
1 index get-current-y
|
|
1 index get-border-top-width sub
|
|
1 index get-padding-top sub
|
|
1 index put-top % => Content Parent Cell
|
|
|
|
% CSS 2.1:
|
|
% Floats, absolutely positioned elements, inline-blocks, table-cells, and elements with 'overflow' other than
|
|
% 'visible' establish new block formatting contexts.
|
|
2 index context-push
|
|
dup get-uid
|
|
3 index context-push-container-uid
|
|
|
|
% Reflow cell content
|
|
2 index 1 index
|
|
box-container-reflow-content % => Content Parent Cell
|
|
|
|
% Extend the table cell height to fit all contained floats
|
|
% Determine the bottom edge corrdinate of the bottommost float
|
|
2 index context-float-bottom % => Content Parent Cell FloatBottom
|
|
dup /null ne {
|
|
1 index box-generic-extend-height
|
|
} {
|
|
pop
|
|
} ifelse % => Content Parent Cell
|
|
|
|
% Restore old context
|
|
2 index context-pop-container-uid
|
|
2 index context-pop
|
|
|
|
pop pop pop
|
|
} def
|
|
|
|
/box-table-cell-setup-methods {
|
|
dup /Methods get
|
|
dup /reflow {box-table-cell-reflow} put
|
|
pop pop
|
|
} def
|
|
|