@@ -1,41 +1,40 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * DOMPDF - PHP5 HTML to PDF renderer |
|
4 | - * |
|
5 | - * File: $RCSfile: frame_tree.cls.php,v $ |
|
6 | - * Created on: 2004-06-02 |
|
7 | - * |
|
8 | - * Copyright (c) 2004 - Benj Carson <[email protected]> |
|
9 | - * |
|
10 | - * This library is free software; you can redistribute it and/or |
|
11 | - * modify it under the terms of the GNU Lesser General Public |
|
12 | - * License as published by the Free Software Foundation; either |
|
13 | - * version 2.1 of the License, or (at your option) any later version. |
|
14 | - * |
|
15 | - * This library is distributed in the hope that it will be useful, |
|
16 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
18 | - * Lesser General Public License for more details. |
|
19 | - * |
|
20 | - * You should have received a copy of the GNU Lesser General Public License |
|
21 | - * along with this library in the file LICENSE.LGPL; if not, write to the |
|
22 | - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
|
23 | - * 02111-1307 USA |
|
24 | - * |
|
25 | - * Alternatively, you may distribute this software under the terms of the |
|
26 | - * PHP License, version 3.0 or later. A copy of this license should have |
|
27 | - * been distributed with this file in the file LICENSE.PHP . If this is not |
|
28 | - * the case, you can obtain a copy at http://www.php.net/license/3_0.txt. |
|
29 | - * |
|
30 | - * The latest version of DOMPDF might be available at: |
|
31 | - * http://www.dompdf.com/ |
|
32 | - * |
|
33 | - * @link http://www.dompdf.com/ |
|
34 | - * @copyright 2004 Benj Carson |
|
35 | - * @author Benj Carson <[email protected]> |
|
36 | - * @package dompdf |
|
37 | - |
|
38 | - */ |
|
3 | + * DOMPDF - PHP5 HTML to PDF renderer |
|
4 | + * |
|
5 | + * File: $RCSfile: frame_tree.cls.php,v $ |
|
6 | + * Created on: 2004-06-02 |
|
7 | + * |
|
8 | + * Copyright (c) 2004 - Benj Carson <[email protected]> |
|
9 | + * |
|
10 | + * This library is free software; you can redistribute it and/or |
|
11 | + * modify it under the terms of the GNU Lesser General Public |
|
12 | + * License as published by the Free Software Foundation; either |
|
13 | + * version 2.1 of the License, or (at your option) any later version. |
|
14 | + * |
|
15 | + * This library is distributed in the hope that it will be useful, |
|
16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
18 | + * Lesser General Public License for more details. |
|
19 | + * |
|
20 | + * You should have received a copy of the GNU Lesser General Public License |
|
21 | + * along with this library in the file LICENSE.LGPL; if not, write to the |
|
22 | + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
|
23 | + * 02111-1307 USA |
|
24 | + * |
|
25 | + * Alternatively, you may distribute this software under the terms of the |
|
26 | + * PHP License, version 3.0 or later. A copy of this license should have |
|
27 | + * been distributed with this file in the file LICENSE.PHP . If this is not |
|
28 | + * the case, you can obtain a copy at http://www.php.net/license/3_0.txt. |
|
29 | + * |
|
30 | + * The latest version of DOMPDF might be available at: |
|
31 | + * http://www.dompdf.com/ |
|
32 | + * |
|
33 | + * @link http://www.dompdf.com/ |
|
34 | + * @copyright 2004 Benj Carson |
|
35 | + * @author Benj Carson <[email protected]> |
|
36 | + * @package dompdf |
|
37 | + */ |
|
39 | 38 | |
40 | 39 | /* $Id: frame_tree.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */ |
41 | 40 | |
@@ -52,118 +51,118 @@ discard block |
||
52 | 51 | */ |
53 | 52 | class Frame_Tree { |
54 | 53 | |
55 | - /** |
|
56 | - * Tags to ignore while parsing the tree |
|
57 | - * |
|
58 | - * @var array |
|
59 | - */ |
|
60 | - static protected $_HIDDEN_TAGS = array("area", "base", "basefont", "head", "style", |
|
61 | - "meta", "title", "colgroup", |
|
62 | - "noembed", "noscript", "param", "#comment"); |
|
63 | - /** |
|
64 | - * The main DomDocument |
|
65 | - * |
|
66 | - * @see http://ca2.php.net/manual/en/ref.dom.php |
|
67 | - * @var DomDocument |
|
68 | - */ |
|
69 | - protected $_dom; |
|
70 | - |
|
71 | - /** |
|
72 | - * The root node of the FrameTree. |
|
73 | - * |
|
74 | - * @var Frame |
|
75 | - */ |
|
76 | - protected $_root; |
|
77 | - |
|
78 | - /** |
|
79 | - * Subtrees of absolutely positioned elements |
|
80 | - * |
|
81 | - * @var array of Frames |
|
82 | - */ |
|
83 | - protected $_absolute_frames; |
|
84 | - |
|
85 | - /** |
|
86 | - * A mapping of {@link Frame} objects to DomNode objects |
|
87 | - * |
|
88 | - * @var array |
|
89 | - */ |
|
90 | - protected $_registry; |
|
54 | + /** |
|
55 | + * Tags to ignore while parsing the tree |
|
56 | + * |
|
57 | + * @var array |
|
58 | + */ |
|
59 | + static protected $_HIDDEN_TAGS = array("area", "base", "basefont", "head", "style", |
|
60 | + "meta", "title", "colgroup", |
|
61 | + "noembed", "noscript", "param", "#comment"); |
|
62 | + /** |
|
63 | + * The main DomDocument |
|
64 | + * |
|
65 | + * @see http://ca2.php.net/manual/en/ref.dom.php |
|
66 | + * @var DomDocument |
|
67 | + */ |
|
68 | + protected $_dom; |
|
69 | + |
|
70 | + /** |
|
71 | + * The root node of the FrameTree. |
|
72 | + * |
|
73 | + * @var Frame |
|
74 | + */ |
|
75 | + protected $_root; |
|
76 | + |
|
77 | + /** |
|
78 | + * Subtrees of absolutely positioned elements |
|
79 | + * |
|
80 | + * @var array of Frames |
|
81 | + */ |
|
82 | + protected $_absolute_frames; |
|
83 | + |
|
84 | + /** |
|
85 | + * A mapping of {@link Frame} objects to DomNode objects |
|
86 | + * |
|
87 | + * @var array |
|
88 | + */ |
|
89 | + protected $_registry; |
|
91 | 90 | |
92 | 91 | |
93 | - /** |
|
94 | - * Class constructor |
|
95 | - * |
|
96 | - * @param DomDocument $dom the main DomDocument object representing the current html document |
|
97 | - */ |
|
98 | - function __construct(DomDocument $dom) { |
|
92 | + /** |
|
93 | + * Class constructor |
|
94 | + * |
|
95 | + * @param DomDocument $dom the main DomDocument object representing the current html document |
|
96 | + */ |
|
97 | + function __construct(DomDocument $dom) { |
|
99 | 98 | $this->_dom = $dom; |
100 | 99 | $this->_root = null; |
101 | 100 | $this->_registry = array(); |
102 | - } |
|
103 | - |
|
104 | - /** |
|
105 | - * Returns the DomDocument object representing the curent html document |
|
106 | - * |
|
107 | - * @return DomDocument |
|
108 | - */ |
|
109 | - function get_dom() { return $this->_dom; } |
|
110 | - |
|
111 | - /** |
|
112 | - * Returns the root frame of the tree |
|
113 | - * |
|
114 | - * @return Frame |
|
115 | - */ |
|
116 | - function get_root() { return $this->_root; } |
|
117 | - |
|
118 | - /** |
|
119 | - * Returns a specific frame given its id |
|
120 | - * |
|
121 | - * @param string $id |
|
122 | - * @return Frame |
|
123 | - */ |
|
124 | - function get_frame($id) { return isset($this->_registry[$id]) ? $this->_registry[$id] : null; } |
|
125 | - |
|
126 | - /** |
|
127 | - * Returns a post-order iterator for all frames in the tree |
|
128 | - * |
|
129 | - * @return FrameTreeList |
|
130 | - */ |
|
131 | - function get_frames() { return new FrameTreeList($this->_root); } |
|
101 | + } |
|
102 | + |
|
103 | + /** |
|
104 | + * Returns the DomDocument object representing the curent html document |
|
105 | + * |
|
106 | + * @return DomDocument |
|
107 | + */ |
|
108 | + function get_dom() { return $this->_dom; } |
|
109 | + |
|
110 | + /** |
|
111 | + * Returns the root frame of the tree |
|
112 | + * |
|
113 | + * @return Frame |
|
114 | + */ |
|
115 | + function get_root() { return $this->_root; } |
|
116 | + |
|
117 | + /** |
|
118 | + * Returns a specific frame given its id |
|
119 | + * |
|
120 | + * @param string $id |
|
121 | + * @return Frame |
|
122 | + */ |
|
123 | + function get_frame($id) { return isset($this->_registry[$id]) ? $this->_registry[$id] : null; } |
|
124 | + |
|
125 | + /** |
|
126 | + * Returns a post-order iterator for all frames in the tree |
|
127 | + * |
|
128 | + * @return FrameTreeList |
|
129 | + */ |
|
130 | + function get_frames() { return new FrameTreeList($this->_root); } |
|
132 | 131 | |
133 | - /** |
|
134 | - * Builds the tree |
|
135 | - */ |
|
136 | - function build_tree() { |
|
132 | + /** |
|
133 | + * Builds the tree |
|
134 | + */ |
|
135 | + function build_tree() { |
|
137 | 136 | $html = $this->_dom->getElementsByTagName("html")->item(0); |
138 | 137 | if ( is_null($html) ) |
139 | - $html = $this->_dom->firstChild; |
|
138 | + $html = $this->_dom->firstChild; |
|
140 | 139 | |
141 | 140 | if ( is_null($html) ) |
142 | - throw new DOMPDF_Exception("Requested HTML document contains no data."); |
|
141 | + throw new DOMPDF_Exception("Requested HTML document contains no data."); |
|
143 | 142 | |
144 | 143 | $this->_root = $this->_build_tree_r($html); |
145 | 144 | |
146 | - } |
|
147 | - |
|
148 | - /** |
|
149 | - * Recursively adds {@link Frame} objects to the tree |
|
150 | - * |
|
151 | - * Recursively build a tree of Frame objects based on a dom tree. |
|
152 | - * No layout information is calculated at this time, although the |
|
153 | - * tree may be adjusted (i.e. nodes and frames for generated content |
|
154 | - * and images may be created). |
|
155 | - * |
|
156 | - * @param DomNode $node the current DomNode being considered |
|
157 | - * @return Frame |
|
158 | - */ |
|
159 | - protected function _build_tree_r(DomNode $node) { |
|
145 | + } |
|
146 | + |
|
147 | + /** |
|
148 | + * Recursively adds {@link Frame} objects to the tree |
|
149 | + * |
|
150 | + * Recursively build a tree of Frame objects based on a dom tree. |
|
151 | + * No layout information is calculated at this time, although the |
|
152 | + * tree may be adjusted (i.e. nodes and frames for generated content |
|
153 | + * and images may be created). |
|
154 | + * |
|
155 | + * @param DomNode $node the current DomNode being considered |
|
156 | + * @return Frame |
|
157 | + */ |
|
158 | + protected function _build_tree_r(DomNode $node) { |
|
160 | 159 | |
161 | 160 | $frame = new Frame($node); |
162 | 161 | $id = $frame->get_id(); |
163 | 162 | $this->_registry[ $id ] = $frame; |
164 | 163 | |
165 | 164 | if ( !$node->hasChildNodes() ) |
166 | - return $frame; |
|
165 | + return $frame; |
|
167 | 166 | |
168 | 167 | // Fixes 'cannot access undefined property for object with |
169 | 168 | // overloaded access', fix by Stefan radulian |
@@ -173,55 +172,55 @@ discard block |
||
173 | 172 | // Store the children in an array so that the tree can be modified |
174 | 173 | $children = array(); |
175 | 174 | for ($i = 0; $i < $node->childNodes->length; $i++) |
176 | - $children[] = $node->childNodes->item($i); |
|
175 | + $children[] = $node->childNodes->item($i); |
|
177 | 176 | |
178 | 177 | foreach ($children as $child) { |
179 | - // Skip non-displaying nodes |
|
180 | - if ( in_array( mb_strtolower($child->nodeName), self::$_HIDDEN_TAGS) ) { |
|
178 | + // Skip non-displaying nodes |
|
179 | + if ( in_array( mb_strtolower($child->nodeName), self::$_HIDDEN_TAGS) ) { |
|
181 | 180 | if ( mb_strtolower($child->nodeName) !== "head" && |
182 | 181 | mb_strtolower($child->nodeName) !== "style" ) |
183 | - $child->parentNode->removeChild($child); |
|
182 | + $child->parentNode->removeChild($child); |
|
184 | 183 | continue; |
185 | - } |
|
184 | + } |
|
186 | 185 | |
187 | - // Skip empty text nodes |
|
188 | - if ( $child->nodeName === "#text" && $child->nodeValue == "" ) { |
|
186 | + // Skip empty text nodes |
|
187 | + if ( $child->nodeName === "#text" && $child->nodeValue == "" ) { |
|
189 | 188 | $child->parentNode->removeChild($child); |
190 | 189 | continue; |
191 | - } |
|
190 | + } |
|
192 | 191 | |
193 | - // Skip empty image nodes |
|
194 | - if ( $child->nodeName === "img" && $child->getAttribute("src") == "" ) { |
|
192 | + // Skip empty image nodes |
|
193 | + if ( $child->nodeName === "img" && $child->getAttribute("src") == "" ) { |
|
195 | 194 | $child->parentNode->removeChild($child); |
196 | 195 | continue; |
197 | - } |
|
196 | + } |
|
198 | 197 | |
199 | - // Add a container frame for images |
|
200 | - if ( $child->nodeName === "img" ) { |
|
198 | + // Add a container frame for images |
|
199 | + if ( $child->nodeName === "img" ) { |
|
201 | 200 | $img_node = $child->ownerDocument->createElement("img_inner"); |
202 | 201 | |
203 | 202 | // Move attributes to inner node |
204 | 203 | foreach ( $child->attributes as $attr => $attr_node ) { |
205 | - // Skip style, but move all other attributes |
|
206 | - if ( $attr === "style" ) |
|
204 | + // Skip style, but move all other attributes |
|
205 | + if ( $attr === "style" ) |
|
207 | 206 | continue; |
208 | 207 | |
209 | - $img_node->setAttribute($attr, $attr_node->value); |
|
208 | + $img_node->setAttribute($attr, $attr_node->value); |
|
210 | 209 | } |
211 | 210 | |
212 | 211 | foreach ( $child->attributes as $attr => $node ) { |
213 | - if ( $attr === "style" ) |
|
212 | + if ( $attr === "style" ) |
|
214 | 213 | continue; |
215 | - $child->removeAttribute($attr); |
|
214 | + $child->removeAttribute($attr); |
|
216 | 215 | } |
217 | 216 | |
218 | 217 | $child->appendChild($img_node); |
219 | - } |
|
218 | + } |
|
220 | 219 | |
221 | - $frame->append_child($this->_build_tree_r($child), false); |
|
220 | + $frame->append_child($this->_build_tree_r($child), false); |
|
222 | 221 | |
223 | 222 | } |
224 | 223 | |
225 | 224 | return $frame; |
226 | - } |
|
225 | + } |
|
227 | 226 | } |
@@ -1,40 +1,40 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * DOMPDF - PHP5 HTML to PDF renderer |
|
4 | - * |
|
5 | - * File: $RCSfile: table_row_group_frame_decorator.cls.php,v $ |
|
6 | - * Created on: 2004-06-02 |
|
7 | - * |
|
8 | - * Copyright (c) 2004 - Benj Carson <[email protected]> |
|
9 | - * |
|
10 | - * This library is free software; you can redistribute it and/or |
|
11 | - * modify it under the terms of the GNU Lesser General Public |
|
12 | - * License as published by the Free Software Foundation; either |
|
13 | - * version 2.1 of the License, or (at your option) any later version. |
|
14 | - * |
|
15 | - * This library is distributed in the hope that it will be useful, |
|
16 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
18 | - * Lesser General Public License for more details. |
|
19 | - * |
|
20 | - * You should have received a copy of the GNU Lesser General Public License |
|
21 | - * along with this library in the file LICENSE.LGPL; if not, write to the |
|
22 | - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
|
23 | - * 02111-1307 USA |
|
24 | - * |
|
25 | - * Alternatively, you may distribute this software under the terms of the |
|
26 | - * PHP License, version 3.0 or later. A copy of this license should have |
|
27 | - * been distributed with this file in the file LICENSE.PHP . If this is not |
|
28 | - * the case, you can obtain a copy at http://www.php.net/license/3_0.txt. |
|
29 | - * |
|
30 | - * The latest version of DOMPDF might be available at: |
|
31 | - * http://www.dompdf.com/ |
|
32 | - * |
|
33 | - * @link http://www.dompdf.com/ |
|
34 | - * @copyright 2004-6 Benj Carson |
|
35 | - * @author Benj Carson <[email protected]> |
|
36 | - * @package dompdf |
|
37 | - */ |
|
3 | + * DOMPDF - PHP5 HTML to PDF renderer |
|
4 | + * |
|
5 | + * File: $RCSfile: table_row_group_frame_decorator.cls.php,v $ |
|
6 | + * Created on: 2004-06-02 |
|
7 | + * |
|
8 | + * Copyright (c) 2004 - Benj Carson <[email protected]> |
|
9 | + * |
|
10 | + * This library is free software; you can redistribute it and/or |
|
11 | + * modify it under the terms of the GNU Lesser General Public |
|
12 | + * License as published by the Free Software Foundation; either |
|
13 | + * version 2.1 of the License, or (at your option) any later version. |
|
14 | + * |
|
15 | + * This library is distributed in the hope that it will be useful, |
|
16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
18 | + * Lesser General Public License for more details. |
|
19 | + * |
|
20 | + * You should have received a copy of the GNU Lesser General Public License |
|
21 | + * along with this library in the file LICENSE.LGPL; if not, write to the |
|
22 | + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
|
23 | + * 02111-1307 USA |
|
24 | + * |
|
25 | + * Alternatively, you may distribute this software under the terms of the |
|
26 | + * PHP License, version 3.0 or later. A copy of this license should have |
|
27 | + * been distributed with this file in the file LICENSE.PHP . If this is not |
|
28 | + * the case, you can obtain a copy at http://www.php.net/license/3_0.txt. |
|
29 | + * |
|
30 | + * The latest version of DOMPDF might be available at: |
|
31 | + * http://www.dompdf.com/ |
|
32 | + * |
|
33 | + * @link http://www.dompdf.com/ |
|
34 | + * @copyright 2004-6 Benj Carson |
|
35 | + * @author Benj Carson <[email protected]> |
|
36 | + * @package dompdf |
|
37 | + */ |
|
38 | 38 | |
39 | 39 | /* $Id: table_row_group_frame_decorator.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */ |
40 | 40 | |
@@ -48,26 +48,26 @@ discard block |
||
48 | 48 | */ |
49 | 49 | class Table_Row_Group_Frame_Decorator extends Frame_Decorator { |
50 | 50 | |
51 | - /** |
|
52 | - * Class constructor |
|
53 | - * |
|
54 | - * @param Frame $frame Frame to decorate |
|
55 | - * @param DOMPDF $dompdf Current dompdf instance |
|
56 | - */ |
|
57 | - function __construct(Frame $frame, DOMPDF $dompdf) { |
|
51 | + /** |
|
52 | + * Class constructor |
|
53 | + * |
|
54 | + * @param Frame $frame Frame to decorate |
|
55 | + * @param DOMPDF $dompdf Current dompdf instance |
|
56 | + */ |
|
57 | + function __construct(Frame $frame, DOMPDF $dompdf) { |
|
58 | 58 | parent::__construct($frame, $dompdf); |
59 | - } |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * Override split() to remove all child rows and this element from the cellmap |
|
63 | - * |
|
64 | - * @param Frame $child |
|
65 | - */ |
|
66 | - function split($child = null) { |
|
61 | + /** |
|
62 | + * Override split() to remove all child rows and this element from the cellmap |
|
63 | + * |
|
64 | + * @param Frame $child |
|
65 | + */ |
|
66 | + function split($child = null) { |
|
67 | 67 | |
68 | 68 | if ( is_null($child) ) { |
69 | - parent::split(); |
|
70 | - return; |
|
69 | + parent::split(); |
|
70 | + return; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | |
@@ -76,21 +76,21 @@ discard block |
||
76 | 76 | $iter = $child; |
77 | 77 | |
78 | 78 | while ( $iter ) { |
79 | - $cellmap->remove_row($iter); |
|
80 | - $iter = $iter->get_next_sibling(); |
|
79 | + $cellmap->remove_row($iter); |
|
80 | + $iter = $iter->get_next_sibling(); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | // If we are splitting at the first child remove the |
84 | 84 | // table-row-group from the cellmap as well |
85 | 85 | if ( $child === $this->get_first_child() ) { |
86 | - $cellmap->remove_row_group($this); |
|
87 | - parent::split(); |
|
88 | - return; |
|
86 | + $cellmap->remove_row_group($this); |
|
87 | + parent::split(); |
|
88 | + return; |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | $cellmap->update_row_group($this, $child->get_prev_sibling()); |
92 | 92 | parent::split($child); |
93 | 93 | |
94 | - } |
|
94 | + } |
|
95 | 95 | } |
96 | 96 |
@@ -34,7 +34,6 @@ discard block |
||
34 | 34 | * @copyright 2004 Benj Carson |
35 | 35 | * @author Benj Carson <[email protected]> |
36 | 36 | * @package dompdf |
37 | - |
|
38 | 37 | */ |
39 | 38 | |
40 | 39 | /* $Id: table_frame_decorator.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */ |
@@ -46,73 +45,73 @@ discard block |
||
46 | 45 | * @package dompdf |
47 | 46 | */ |
48 | 47 | class Table_Frame_Decorator extends Frame_Decorator { |
49 | - static $VALID_CHILDREN = array("table-row-group", |
|
50 | - "table-row", |
|
51 | - "table-header-group", |
|
52 | - "table-footer-group", |
|
53 | - "table-column", |
|
54 | - "table-column-group", |
|
55 | - "table-caption", |
|
56 | - "table-cell"); |
|
57 | - |
|
58 | - static $ROW_GROUPS = array('table-row-group', |
|
59 | - 'table-header-group', |
|
60 | - 'table-footer-group'); |
|
61 | - |
|
62 | - /** |
|
63 | - * The Cellmap object for this table. The cellmap maps table cells |
|
64 | - * to rows and columns, and aids in calculating column widths. |
|
65 | - * |
|
66 | - * @var Cellmap |
|
67 | - */ |
|
68 | - protected $_cellmap; |
|
69 | - |
|
70 | - /** |
|
71 | - * The minimum width of the table, in pt |
|
72 | - * |
|
73 | - * @var float |
|
74 | - */ |
|
75 | - protected $_min_width; |
|
76 | - |
|
77 | - /** |
|
78 | - * The maximum width of the table, in pt |
|
79 | - * |
|
80 | - * @var float |
|
81 | - */ |
|
82 | - protected $_max_width; |
|
83 | - |
|
84 | - /** |
|
85 | - * Table header rows. Each table header is duplicated when a table |
|
86 | - * spans pages. |
|
87 | - * |
|
88 | - * @var array |
|
89 | - */ |
|
90 | - protected $_headers; |
|
91 | - |
|
92 | - /** |
|
93 | - * Table footer rows. Each table footer is duplicated when a table |
|
94 | - * spans pages. |
|
95 | - * |
|
96 | - * @var array |
|
97 | - */ |
|
98 | - protected $_footers; |
|
99 | - |
|
100 | - /** |
|
101 | - * Class constructor |
|
102 | - * |
|
103 | - * @param Frame $frame the frame to decorate |
|
104 | - */ |
|
105 | - function __construct(Frame $frame, DOMPDF $dompdf) { |
|
48 | + static $VALID_CHILDREN = array("table-row-group", |
|
49 | + "table-row", |
|
50 | + "table-header-group", |
|
51 | + "table-footer-group", |
|
52 | + "table-column", |
|
53 | + "table-column-group", |
|
54 | + "table-caption", |
|
55 | + "table-cell"); |
|
56 | + |
|
57 | + static $ROW_GROUPS = array('table-row-group', |
|
58 | + 'table-header-group', |
|
59 | + 'table-footer-group'); |
|
60 | + |
|
61 | + /** |
|
62 | + * The Cellmap object for this table. The cellmap maps table cells |
|
63 | + * to rows and columns, and aids in calculating column widths. |
|
64 | + * |
|
65 | + * @var Cellmap |
|
66 | + */ |
|
67 | + protected $_cellmap; |
|
68 | + |
|
69 | + /** |
|
70 | + * The minimum width of the table, in pt |
|
71 | + * |
|
72 | + * @var float |
|
73 | + */ |
|
74 | + protected $_min_width; |
|
75 | + |
|
76 | + /** |
|
77 | + * The maximum width of the table, in pt |
|
78 | + * |
|
79 | + * @var float |
|
80 | + */ |
|
81 | + protected $_max_width; |
|
82 | + |
|
83 | + /** |
|
84 | + * Table header rows. Each table header is duplicated when a table |
|
85 | + * spans pages. |
|
86 | + * |
|
87 | + * @var array |
|
88 | + */ |
|
89 | + protected $_headers; |
|
90 | + |
|
91 | + /** |
|
92 | + * Table footer rows. Each table footer is duplicated when a table |
|
93 | + * spans pages. |
|
94 | + * |
|
95 | + * @var array |
|
96 | + */ |
|
97 | + protected $_footers; |
|
98 | + |
|
99 | + /** |
|
100 | + * Class constructor |
|
101 | + * |
|
102 | + * @param Frame $frame the frame to decorate |
|
103 | + */ |
|
104 | + function __construct(Frame $frame, DOMPDF $dompdf) { |
|
106 | 105 | parent::__construct($frame, $dompdf); |
107 | 106 | $this->_cellmap = new Cellmap($this); |
108 | 107 | $this->_min_width = null; |
109 | 108 | $this->_max_width = null; |
110 | 109 | $this->_headers = array(); |
111 | 110 | $this->_footers = array(); |
112 | - } |
|
111 | + } |
|
113 | 112 | |
114 | 113 | |
115 | - function reset() { |
|
114 | + function reset() { |
|
116 | 115 | parent::reset(); |
117 | 116 | $this->_cellmap->reset(); |
118 | 117 | $this->_min_width = null; |
@@ -120,22 +119,22 @@ discard block |
||
120 | 119 | $this->_headers = array(); |
121 | 120 | $this->_footers = array(); |
122 | 121 | $this->_reflower->reset(); |
123 | - } |
|
122 | + } |
|
124 | 123 | |
125 | - //........................................................................ |
|
124 | + //........................................................................ |
|
126 | 125 | |
127 | - /** |
|
128 | - * split the table at $row. $row and all subsequent rows will be |
|
129 | - * added to the clone. This method is overidden in order to remove |
|
130 | - * frames from the cellmap properly. |
|
131 | - * |
|
132 | - * @param Frame $row |
|
133 | - */ |
|
134 | - function split($child = null) { |
|
126 | + /** |
|
127 | + * split the table at $row. $row and all subsequent rows will be |
|
128 | + * added to the clone. This method is overidden in order to remove |
|
129 | + * frames from the cellmap properly. |
|
130 | + * |
|
131 | + * @param Frame $row |
|
132 | + */ |
|
133 | + function split($child = null) { |
|
135 | 134 | |
136 | 135 | if ( is_null($child) ) { |
137 | - parent::split(); |
|
138 | - return; |
|
136 | + parent::split(); |
|
137 | + return; |
|
139 | 138 | } |
140 | 139 | |
141 | 140 | // If $child is a header or if it is the first non-header row, do |
@@ -143,200 +142,200 @@ discard block |
||
143 | 142 | if ( count($this->_headers) && !in_array($child, $this->_headers, true) && |
144 | 143 | !in_array($child->get_prev_sibling(), $this->_headers, true) ) { |
145 | 144 | |
146 | - $first_header = null; |
|
145 | + $first_header = null; |
|
147 | 146 | |
148 | - // Insert copies of the table headers before $child |
|
149 | - foreach ($this->_headers as $header) { |
|
147 | + // Insert copies of the table headers before $child |
|
148 | + foreach ($this->_headers as $header) { |
|
150 | 149 | |
151 | 150 | $new_header = $header->deep_copy(); |
152 | 151 | |
153 | 152 | if ( is_null($first_header) ) |
154 | - $first_header = $new_header; |
|
153 | + $first_header = $new_header; |
|
155 | 154 | |
156 | 155 | $this->insert_child_before($new_header, $child); |
157 | - } |
|
156 | + } |
|
158 | 157 | |
159 | - parent::split($first_header); |
|
158 | + parent::split($first_header); |
|
160 | 159 | |
161 | 160 | } else if ( in_array($child->get_style()->display, self::$ROW_GROUPS) ) { |
162 | 161 | |
163 | - // Individual rows should have already been handled |
|
164 | - parent::split($child); |
|
162 | + // Individual rows should have already been handled |
|
163 | + parent::split($child); |
|
165 | 164 | |
166 | 165 | } else { |
167 | 166 | |
168 | - $iter = $child; |
|
167 | + $iter = $child; |
|
169 | 168 | |
170 | - while ($iter) { |
|
169 | + while ($iter) { |
|
171 | 170 | $this->_cellmap->remove_row($iter); |
172 | 171 | $iter = $iter->get_next_sibling(); |
173 | - } |
|
172 | + } |
|
174 | 173 | |
175 | - parent::split($child); |
|
174 | + parent::split($child); |
|
175 | + } |
|
176 | 176 | } |
177 | - } |
|
178 | 177 | |
179 | - /** |
|
180 | - * Static function to locate the parent table of a frame |
|
181 | - * |
|
182 | - * @param Frame $frame |
|
183 | - * @return Frame the table that is an ancestor of $frame |
|
184 | - */ |
|
185 | - static function find_parent_table(Frame $frame) { |
|
178 | + /** |
|
179 | + * Static function to locate the parent table of a frame |
|
180 | + * |
|
181 | + * @param Frame $frame |
|
182 | + * @return Frame the table that is an ancestor of $frame |
|
183 | + */ |
|
184 | + static function find_parent_table(Frame $frame) { |
|
186 | 185 | |
187 | 186 | while ( $frame = $frame->get_parent() ) |
188 | - if ( in_array($frame->get_style()->display, Style::$TABLE_TYPES) ) |
|
187 | + if ( in_array($frame->get_style()->display, Style::$TABLE_TYPES) ) |
|
189 | 188 | break; |
190 | 189 | |
191 | 190 | return $frame; |
192 | - } |
|
193 | - |
|
194 | - /** |
|
195 | - * Return this table's Cellmap |
|
196 | - * |
|
197 | - * @return Cellmap |
|
198 | - */ |
|
199 | - function get_cellmap() { return $this->_cellmap; } |
|
200 | - |
|
201 | - /** |
|
202 | - * Return the minimum width of this table |
|
203 | - * |
|
204 | - * @return float |
|
205 | - */ |
|
206 | - function get_min_width() { return $this->_min_width; } |
|
207 | - |
|
208 | - /** |
|
209 | - * Return the maximum width of this table |
|
210 | - * |
|
211 | - * @return float |
|
212 | - */ |
|
213 | - function get_max_width() { return $this->_max_width; } |
|
214 | - |
|
215 | - /** |
|
216 | - * Set the minimum width of the table |
|
217 | - * |
|
218 | - * @param float $width the new minimum width |
|
219 | - */ |
|
220 | - function set_min_width($width) { $this->_min_width = $width; } |
|
221 | - |
|
222 | - /** |
|
223 | - * Set the maximum width of the table |
|
224 | - * |
|
225 | - * @param float $width the new maximum width |
|
226 | - */ |
|
227 | - function set_max_width($width) { $this->_max_width = $width; } |
|
228 | - |
|
229 | - /** |
|
230 | - * Restructure tree so that the table has the correct structure. |
|
231 | - * Invalid children (i.e. all non-table-rows) are moved below the |
|
232 | - * table. |
|
233 | - */ |
|
234 | - function normalise() { |
|
191 | + } |
|
192 | + |
|
193 | + /** |
|
194 | + * Return this table's Cellmap |
|
195 | + * |
|
196 | + * @return Cellmap |
|
197 | + */ |
|
198 | + function get_cellmap() { return $this->_cellmap; } |
|
199 | + |
|
200 | + /** |
|
201 | + * Return the minimum width of this table |
|
202 | + * |
|
203 | + * @return float |
|
204 | + */ |
|
205 | + function get_min_width() { return $this->_min_width; } |
|
206 | + |
|
207 | + /** |
|
208 | + * Return the maximum width of this table |
|
209 | + * |
|
210 | + * @return float |
|
211 | + */ |
|
212 | + function get_max_width() { return $this->_max_width; } |
|
213 | + |
|
214 | + /** |
|
215 | + * Set the minimum width of the table |
|
216 | + * |
|
217 | + * @param float $width the new minimum width |
|
218 | + */ |
|
219 | + function set_min_width($width) { $this->_min_width = $width; } |
|
220 | + |
|
221 | + /** |
|
222 | + * Set the maximum width of the table |
|
223 | + * |
|
224 | + * @param float $width the new maximum width |
|
225 | + */ |
|
226 | + function set_max_width($width) { $this->_max_width = $width; } |
|
227 | + |
|
228 | + /** |
|
229 | + * Restructure tree so that the table has the correct structure. |
|
230 | + * Invalid children (i.e. all non-table-rows) are moved below the |
|
231 | + * table. |
|
232 | + */ |
|
233 | + function normalise() { |
|
235 | 234 | |
236 | 235 | // Store frames generated by invalid tags and move them outside the table |
237 | 236 | $erroneous_frames = array(); |
238 | 237 | $anon_row = false; |
239 | 238 | $iter = $this->get_first_child(); |
240 | 239 | while ( $iter ) { |
241 | - $child = $iter; |
|
242 | - $iter = $iter->get_next_sibling(); |
|
240 | + $child = $iter; |
|
241 | + $iter = $iter->get_next_sibling(); |
|
243 | 242 | |
244 | - $display = $child->get_style()->display; |
|
243 | + $display = $child->get_style()->display; |
|
245 | 244 | |
246 | - if ( $anon_row ) { |
|
245 | + if ( $anon_row ) { |
|
247 | 246 | |
248 | 247 | if ( $display === "table-row" ) { |
249 | - // Add the previous anonymous row |
|
250 | - $this->insert_child_before($table_row, $child); |
|
248 | + // Add the previous anonymous row |
|
249 | + $this->insert_child_before($table_row, $child); |
|
251 | 250 | |
252 | - $table_row->normalise(); |
|
253 | - $child->normalise(); |
|
254 | - $anon_row = false; |
|
255 | - continue; |
|
251 | + $table_row->normalise(); |
|
252 | + $child->normalise(); |
|
253 | + $anon_row = false; |
|
254 | + continue; |
|
256 | 255 | } |
257 | 256 | |
258 | 257 | // add the child to the anonymous row |
259 | 258 | $table_row->append_child($child); |
260 | 259 | continue; |
261 | 260 | |
262 | - } else { |
|
261 | + } else { |
|
263 | 262 | |
264 | 263 | if ( $display === "table-row" ) { |
265 | - $child->normalise(); |
|
266 | - continue; |
|
264 | + $child->normalise(); |
|
265 | + continue; |
|
267 | 266 | } |
268 | 267 | |
269 | 268 | if ( $display === "table-cell") { |
270 | - // Create an anonymous table row |
|
271 | - $tr = $this->get_node()->ownerDocument->createElement("tr"); |
|
269 | + // Create an anonymous table row |
|
270 | + $tr = $this->get_node()->ownerDocument->createElement("tr"); |
|
272 | 271 | |
273 | - $frame = new Frame($tr); |
|
272 | + $frame = new Frame($tr); |
|
274 | 273 | |
275 | - $css = $this->get_style()->get_stylesheet(); |
|
276 | - $style = $css->create_style(); |
|
277 | - $style->inherit($this->get_style()); |
|
274 | + $css = $this->get_style()->get_stylesheet(); |
|
275 | + $style = $css->create_style(); |
|
276 | + $style->inherit($this->get_style()); |
|
278 | 277 | |
279 | - // Lookup styles for tr tags. If the user wants styles to work |
|
280 | - // better, they should make the tr explicit... I'm not going to |
|
281 | - // try to guess what they intended. |
|
282 | - if ( $tr_style = $css->lookup("tr") ) |
|
278 | + // Lookup styles for tr tags. If the user wants styles to work |
|
279 | + // better, they should make the tr explicit... I'm not going to |
|
280 | + // try to guess what they intended. |
|
281 | + if ( $tr_style = $css->lookup("tr") ) |
|
283 | 282 | $style->merge($tr_style); |
284 | 283 | |
285 | - // Okay, I have absolutely no idea why I need this clone here, but |
|
286 | - // if it's omitted, php (as of 2004-07-28) segfaults. |
|
287 | - $frame->set_style(clone $style); |
|
288 | - $table_row = Frame_Factory::decorate_frame($frame, $this->_dompdf); |
|
289 | - $table_row->set_root($this->_root); |
|
284 | + // Okay, I have absolutely no idea why I need this clone here, but |
|
285 | + // if it's omitted, php (as of 2004-07-28) segfaults. |
|
286 | + $frame->set_style(clone $style); |
|
287 | + $table_row = Frame_Factory::decorate_frame($frame, $this->_dompdf); |
|
288 | + $table_row->set_root($this->_root); |
|
290 | 289 | |
291 | - // Add the cell to the row |
|
292 | - $table_row->append_child($child); |
|
290 | + // Add the cell to the row |
|
291 | + $table_row->append_child($child); |
|
293 | 292 | |
294 | - $anon_row = true; |
|
295 | - continue; |
|
293 | + $anon_row = true; |
|
294 | + continue; |
|
296 | 295 | } |
297 | 296 | |
298 | 297 | if ( !in_array($display, self::$VALID_CHILDREN) ) { |
299 | - $erroneous_frames[] = $child; |
|
300 | - continue; |
|
298 | + $erroneous_frames[] = $child; |
|
299 | + continue; |
|
301 | 300 | } |
302 | 301 | |
303 | 302 | // Normalise other table parts (i.e. row groups) |
304 | 303 | foreach ($child->get_children() as $grandchild) { |
305 | - if ( $grandchild->get_style()->display === "table-row" ) |
|
304 | + if ( $grandchild->get_style()->display === "table-row" ) |
|
306 | 305 | $grandchild->normalise(); |
307 | 306 | } |
308 | 307 | |
309 | 308 | // Add headers and footers |
310 | 309 | if ( $display === "table-header-group" ) |
311 | - $this->_headers[] = $child; |
|
310 | + $this->_headers[] = $child; |
|
312 | 311 | |
313 | 312 | else if ( $display === "table-footer-group" ) |
314 | - $this->_footers[] = $child; |
|
315 | - } |
|
313 | + $this->_footers[] = $child; |
|
314 | + } |
|
316 | 315 | } |
317 | 316 | |
318 | 317 | if ( $anon_row ) { |
319 | - // Add the row to the table |
|
320 | - $this->_frame->append_child($table_row); |
|
321 | - $table_row->normalise(); |
|
322 | - $this->_cellmap->add_row(); |
|
318 | + // Add the row to the table |
|
319 | + $this->_frame->append_child($table_row); |
|
320 | + $table_row->normalise(); |
|
321 | + $this->_cellmap->add_row(); |
|
323 | 322 | } |
324 | 323 | |
325 | 324 | foreach ($erroneous_frames as $frame) |
326 | - $this->move_after($frame); |
|
325 | + $this->move_after($frame); |
|
327 | 326 | |
328 | - } |
|
327 | + } |
|
329 | 328 | |
330 | - //........................................................................ |
|
329 | + //........................................................................ |
|
331 | 330 | |
332 | - /** |
|
333 | - * Moves the specified frame and it's corresponding node outside of |
|
334 | - * the table. |
|
335 | - * |
|
336 | - * @param Frame $frame the frame to move |
|
337 | - */ |
|
338 | - function move_after(Frame $frame) { |
|
331 | + /** |
|
332 | + * Moves the specified frame and it's corresponding node outside of |
|
333 | + * the table. |
|
334 | + * |
|
335 | + * @param Frame $frame the frame to move |
|
336 | + */ |
|
337 | + function move_after(Frame $frame) { |
|
339 | 338 | $this->get_parent()->insert_child_after($frame, $this); |
340 | - } |
|
339 | + } |
|
341 | 340 | |
342 | 341 | } |
@@ -34,7 +34,6 @@ discard block |
||
34 | 34 | * @copyright 2004 Benj Carson |
35 | 35 | * @author Benj Carson <[email protected]> |
36 | 36 | * @package dompdf |
37 | - |
|
38 | 37 | */ |
39 | 38 | |
40 | 39 | /* $Id: null_frame_decorator.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */ |
@@ -47,13 +46,13 @@ discard block |
||
47 | 46 | */ |
48 | 47 | class Null_Frame_Decorator extends Frame_Decorator { |
49 | 48 | |
50 | - function __construct(Frame $frame, DOMPDF $dompdf) { |
|
49 | + function __construct(Frame $frame, DOMPDF $dompdf) { |
|
51 | 50 | parent::__construct($frame, $dompdf); |
52 | 51 | $style = $this->_frame->get_style(); |
53 | 52 | $style->width = 0; |
54 | 53 | $style->height = 0; |
55 | 54 | $style->margin = 0; |
56 | 55 | $style->padding = 0; |
57 | - } |
|
56 | + } |
|
58 | 57 | |
59 | 58 | } |
@@ -1,41 +1,40 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * DOMPDF - PHP5 HTML to PDF renderer |
|
4 | - * |
|
5 | - * File: $RCSfile: page_frame_reflower.cls.php,v $ |
|
6 | - * Created on: 2004-06-16 |
|
7 | - * |
|
8 | - * Copyright (c) 2004 - Benj Carson <[email protected]> |
|
9 | - * |
|
10 | - * This library is free software; you can redistribute it and/or |
|
11 | - * modify it under the terms of the GNU Lesser General Public |
|
12 | - * License as published by the Free Software Foundation; either |
|
13 | - * version 2.1 of the License, or (at your option) any later version. |
|
14 | - * |
|
15 | - * This library is distributed in the hope that it will be useful, |
|
16 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
18 | - * Lesser General Public License for more details. |
|
19 | - * |
|
20 | - * You should have received a copy of the GNU Lesser General Public License |
|
21 | - * along with this library in the file LICENSE.LGPL; if not, write to the |
|
22 | - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
|
23 | - * 02111-1307 USA |
|
24 | - * |
|
25 | - * Alternatively, you may distribute this software under the terms of the |
|
26 | - * PHP License, version 3.0 or later. A copy of this license should have |
|
27 | - * been distributed with this file in the file LICENSE.PHP . If this is not |
|
28 | - * the case, you can obtain a copy at http://www.php.net/license/3_0.txt. |
|
29 | - * |
|
30 | - * The latest version of DOMPDF might be available at: |
|
31 | - * http://www.dompdf.com/ |
|
32 | - * |
|
33 | - * @link http://www.dompdf.com/ |
|
34 | - * @copyright 2004 Benj Carson |
|
35 | - * @author Benj Carson <[email protected]> |
|
36 | - * @package dompdf |
|
37 | - |
|
38 | - */ |
|
3 | + * DOMPDF - PHP5 HTML to PDF renderer |
|
4 | + * |
|
5 | + * File: $RCSfile: page_frame_reflower.cls.php,v $ |
|
6 | + * Created on: 2004-06-16 |
|
7 | + * |
|
8 | + * Copyright (c) 2004 - Benj Carson <[email protected]> |
|
9 | + * |
|
10 | + * This library is free software; you can redistribute it and/or |
|
11 | + * modify it under the terms of the GNU Lesser General Public |
|
12 | + * License as published by the Free Software Foundation; either |
|
13 | + * version 2.1 of the License, or (at your option) any later version. |
|
14 | + * |
|
15 | + * This library is distributed in the hope that it will be useful, |
|
16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
18 | + * Lesser General Public License for more details. |
|
19 | + * |
|
20 | + * You should have received a copy of the GNU Lesser General Public License |
|
21 | + * along with this library in the file LICENSE.LGPL; if not, write to the |
|
22 | + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
|
23 | + * 02111-1307 USA |
|
24 | + * |
|
25 | + * Alternatively, you may distribute this software under the terms of the |
|
26 | + * PHP License, version 3.0 or later. A copy of this license should have |
|
27 | + * been distributed with this file in the file LICENSE.PHP . If this is not |
|
28 | + * the case, you can obtain a copy at http://www.php.net/license/3_0.txt. |
|
29 | + * |
|
30 | + * The latest version of DOMPDF might be available at: |
|
31 | + * http://www.dompdf.com/ |
|
32 | + * |
|
33 | + * @link http://www.dompdf.com/ |
|
34 | + * @copyright 2004 Benj Carson |
|
35 | + * @author Benj Carson <[email protected]> |
|
36 | + * @package dompdf |
|
37 | + */ |
|
39 | 38 | |
40 | 39 | /* $Id: page_frame_reflower.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */ |
41 | 40 | |
@@ -47,25 +46,25 @@ discard block |
||
47 | 46 | */ |
48 | 47 | class Page_Frame_Reflower extends Frame_Reflower { |
49 | 48 | |
50 | - /** |
|
51 | - * Cache of the callbacks array |
|
52 | - * |
|
53 | - * @var array |
|
54 | - */ |
|
55 | - private $_callbacks; |
|
49 | + /** |
|
50 | + * Cache of the callbacks array |
|
51 | + * |
|
52 | + * @var array |
|
53 | + */ |
|
54 | + private $_callbacks; |
|
56 | 55 | |
57 | - /** |
|
58 | - * Cache of the canvas |
|
59 | - * |
|
60 | - * @var Canvas |
|
61 | - */ |
|
62 | - private $_canvas; |
|
56 | + /** |
|
57 | + * Cache of the canvas |
|
58 | + * |
|
59 | + * @var Canvas |
|
60 | + */ |
|
61 | + private $_canvas; |
|
63 | 62 | |
64 | - function __construct(Page_Frame_Decorator $frame) { parent::__construct($frame); } |
|
63 | + function __construct(Page_Frame_Decorator $frame) { parent::__construct($frame); } |
|
65 | 64 | |
66 | - //........................................................................ |
|
65 | + //........................................................................ |
|
67 | 66 | |
68 | - function reflow() { |
|
67 | + function reflow() { |
|
69 | 68 | $style = $this->_frame->get_style(); |
70 | 69 | |
71 | 70 | // Paged layout: |
@@ -88,74 +87,74 @@ discard block |
||
88 | 87 | |
89 | 88 | while ($child) { |
90 | 89 | |
91 | - $child->set_containing_block($content_x, $content_y, $content_width, $content_height); |
|
90 | + $child->set_containing_block($content_x, $content_y, $content_width, $content_height); |
|
92 | 91 | |
93 | - // Check for begin reflow callback |
|
94 | - $this->_check_callbacks("begin_page_reflow", $child); |
|
92 | + // Check for begin reflow callback |
|
93 | + $this->_check_callbacks("begin_page_reflow", $child); |
|
95 | 94 | |
96 | - $child->reflow(); |
|
97 | - $next_child = $child->get_next_sibling(); |
|
95 | + $child->reflow(); |
|
96 | + $next_child = $child->get_next_sibling(); |
|
98 | 97 | |
99 | - // Check for begin render callback |
|
100 | - $this->_check_callbacks("begin_page_render", $child); |
|
98 | + // Check for begin render callback |
|
99 | + $this->_check_callbacks("begin_page_render", $child); |
|
101 | 100 | |
102 | - // Render the page |
|
103 | - $this->_frame->get_renderer()->render($child); |
|
101 | + // Render the page |
|
102 | + $this->_frame->get_renderer()->render($child); |
|
104 | 103 | |
105 | - // Check for end render callback |
|
106 | - $this->_check_callbacks("end_page_render", $child); |
|
104 | + // Check for end render callback |
|
105 | + $this->_check_callbacks("end_page_render", $child); |
|
107 | 106 | |
108 | - if ( $next_child ) |
|
109 | - { |
|
107 | + if ( $next_child ) |
|
108 | + { |
|
110 | 109 | $this->_frame->next_page(); |
111 | - } |
|
110 | + } |
|
112 | 111 | |
113 | - // Wait to dispose of all frames on the previous page |
|
114 | - // so callback will have access to them |
|
115 | - if ( $prev_child ) |
|
116 | - { |
|
112 | + // Wait to dispose of all frames on the previous page |
|
113 | + // so callback will have access to them |
|
114 | + if ( $prev_child ) |
|
115 | + { |
|
117 | 116 | $prev_child->dispose(true); |
118 | - } |
|
119 | - $prev_child = $child; |
|
120 | - $child = $next_child; |
|
117 | + } |
|
118 | + $prev_child = $child; |
|
119 | + $child = $next_child; |
|
121 | 120 | } |
122 | 121 | |
123 | 122 | // Dispose of previous page if it still exists |
124 | 123 | if ( $prev_child ) |
125 | 124 | { |
126 | - $prev_child->dispose(true); |
|
125 | + $prev_child->dispose(true); |
|
127 | 126 | } |
128 | - } |
|
127 | + } |
|
129 | 128 | |
130 | - //........................................................................ |
|
129 | + //........................................................................ |
|
131 | 130 | |
132 | - /** |
|
133 | - * Check for callbacks that need to be performed when a given event |
|
134 | - * gets triggered on a page |
|
135 | - * |
|
136 | - * @param string $event the type of event |
|
137 | - * @param Frame $frame the frame that event is triggered on |
|
138 | - */ |
|
139 | - protected function _check_callbacks($event, $frame) { |
|
131 | + /** |
|
132 | + * Check for callbacks that need to be performed when a given event |
|
133 | + * gets triggered on a page |
|
134 | + * |
|
135 | + * @param string $event the type of event |
|
136 | + * @param Frame $frame the frame that event is triggered on |
|
137 | + */ |
|
138 | + protected function _check_callbacks($event, $frame) { |
|
140 | 139 | if (!isset($this->_callbacks)) { |
141 | - $dompdf = $this->_frame->get_dompdf(); |
|
142 | - $this->_callbacks = $dompdf->get_callbacks(); |
|
143 | - $this->_canvas = $dompdf->get_canvas(); |
|
140 | + $dompdf = $this->_frame->get_dompdf(); |
|
141 | + $this->_callbacks = $dompdf->get_callbacks(); |
|
142 | + $this->_canvas = $dompdf->get_canvas(); |
|
144 | 143 | } |
145 | 144 | |
146 | 145 | if (is_array($this->_callbacks) && isset($this->_callbacks[$event])) { |
147 | - $info = array(0 => $this->_canvas, "canvas" => $this->_canvas, |
|
146 | + $info = array(0 => $this->_canvas, "canvas" => $this->_canvas, |
|
148 | 147 | 1 => $frame, "frame" => $frame); |
149 | - $fs = $this->_callbacks[$event]; |
|
150 | - foreach ($fs as $f) { |
|
148 | + $fs = $this->_callbacks[$event]; |
|
149 | + foreach ($fs as $f) { |
|
151 | 150 | if (is_callable($f)) { |
152 | - if (is_array($f)) { |
|
151 | + if (is_array($f)) { |
|
153 | 152 | $f[0]->$f[1]($info); |
154 | - } else { |
|
153 | + } else { |
|
155 | 154 | $f($info); |
156 | - } |
|
155 | + } |
|
156 | + } |
|
157 | 157 | } |
158 | - } |
|
159 | 158 | } |
160 | - } |
|
159 | + } |
|
161 | 160 | } |
@@ -34,7 +34,6 @@ discard block |
||
34 | 34 | * @copyright 2004 Benj Carson |
35 | 35 | * @author Benj Carson <[email protected]> |
36 | 36 | * @package dompdf |
37 | - |
|
38 | 37 | */ |
39 | 38 | |
40 | 39 | /* $Id: block_renderer.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */ |
@@ -47,26 +46,26 @@ discard block |
||
47 | 46 | */ |
48 | 47 | class Block_Renderer extends Abstract_Renderer { |
49 | 48 | |
50 | - //........................................................................ |
|
49 | + //........................................................................ |
|
51 | 50 | |
52 | - function render(Frame $frame) { |
|
51 | + function render(Frame $frame) { |
|
53 | 52 | $style = $frame->get_style(); |
54 | 53 | list($x, $y, $w, $h) = $frame->get_padding_box(); |
55 | 54 | |
56 | 55 | // Draw our background, border and content |
57 | 56 | if ( ($bg = $style->background_color) !== "transparent" ) { |
58 | - $this->_canvas->filled_rectangle( $x, $y, $w, $h, $style->background_color ); |
|
57 | + $this->_canvas->filled_rectangle( $x, $y, $w, $h, $style->background_color ); |
|
59 | 58 | } |
60 | 59 | |
61 | 60 | if ( ($url = $style->background_image) && $url !== "none" ) |
62 | - $this->_background_image($url, $x, $y, $w, $h, $style); |
|
61 | + $this->_background_image($url, $x, $y, $w, $h, $style); |
|
63 | 62 | |
64 | 63 | |
65 | 64 | $this->_render_border($frame); |
66 | 65 | |
67 | - } |
|
66 | + } |
|
68 | 67 | |
69 | - protected function _render_border(Frame_Decorator $frame, $corner_style = "bevel") { |
|
68 | + protected function _render_border(Frame_Decorator $frame, $corner_style = "bevel") { |
|
70 | 69 | $cb = $frame->get_containing_block(); |
71 | 70 | $style = $frame->get_style(); |
72 | 71 | |
@@ -79,36 +78,36 @@ discard block |
||
79 | 78 | $style->length_in_pt($bp["left"]["width"])); |
80 | 79 | |
81 | 80 | foreach ($bp as $side => $props) { |
82 | - list($x, $y, $w, $h) = $bbox; |
|
81 | + list($x, $y, $w, $h) = $bbox; |
|
83 | 82 | |
84 | - if ( !$props["style"] || $props["style"] === "none" || $props["width"] <= 0 ) |
|
83 | + if ( !$props["style"] || $props["style"] === "none" || $props["width"] <= 0 ) |
|
85 | 84 | continue; |
86 | 85 | |
87 | 86 | |
88 | - switch($side) { |
|
89 | - case "top": |
|
87 | + switch($side) { |
|
88 | + case "top": |
|
90 | 89 | $length = $w; |
91 | 90 | break; |
92 | 91 | |
93 | - case "bottom": |
|
92 | + case "bottom": |
|
94 | 93 | $length = $w; |
95 | 94 | $y += $h; |
96 | 95 | break; |
97 | 96 | |
98 | - case "left": |
|
97 | + case "left": |
|
99 | 98 | $length = $h; |
100 | 99 | break; |
101 | 100 | |
102 | - case "right": |
|
101 | + case "right": |
|
103 | 102 | $length = $h; |
104 | 103 | $x += $w; |
105 | 104 | break; |
106 | - default: |
|
105 | + default: |
|
107 | 106 | break; |
108 | - } |
|
109 | - $method = "_border_" . $props["style"]; |
|
107 | + } |
|
108 | + $method = "_border_" . $props["style"]; |
|
110 | 109 | |
111 | - $this->$method($x, $y, $length, $props["color"], $widths, $side, $corner_style); |
|
110 | + $this->$method($x, $y, $length, $props["color"], $widths, $side, $corner_style); |
|
111 | + } |
|
112 | 112 | } |
113 | - } |
|
114 | 113 | } |
@@ -1,47 +1,46 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * DOMPDF - PHP5 HTML to PDF renderer |
|
4 | - * |
|
5 | - * File: $RCSfile: inline_frame_decorator.cls.php,v $ |
|
6 | - * Created on: 2004-06-02 |
|
7 | - * |
|
8 | - * Copyright (c) 2004 - Benj Carson <[email protected]> |
|
9 | - * |
|
10 | - * This library is free software; you can redistribute it and/or |
|
11 | - * modify it under the terms of the GNU Lesser General Public |
|
12 | - * License as published by the Free Software Foundation; either |
|
13 | - * version 2.1 of the License, or (at your option) any later version. |
|
14 | - * |
|
15 | - * This library is distributed in the hope that it will be useful, |
|
16 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
18 | - * Lesser General Public License for more details. |
|
19 | - * |
|
20 | - * You should have received a copy of the GNU Lesser General Public License |
|
21 | - * along with this library in the file LICENSE.LGPL; if not, write to the |
|
22 | - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
|
23 | - * 02111-1307 USA |
|
24 | - * |
|
25 | - * Alternatively, you may distribute this software under the terms of the |
|
26 | - * PHP License, version 3.0 or later. A copy of this license should have |
|
27 | - * been distributed with this file in the file LICENSE.PHP . If this is not |
|
28 | - * the case, you can obtain a copy at http://www.php.net/license/3_0.txt. |
|
29 | - * |
|
30 | - * The latest version of DOMPDF might be available at: |
|
31 | - * http://www.dompdf.com/ |
|
32 | - * |
|
33 | - * @link http://www.dompdf.com/ |
|
34 | - * @copyright 2004 Benj Carson |
|
35 | - * @author Benj Carson <[email protected]> |
|
36 | - * @contributor Helmut Tischer <[email protected]> |
|
37 | - * @package dompdf |
|
38 | - |
|
39 | - * |
|
40 | - * Changes |
|
41 | - * @contributor Helmut Tischer <[email protected]> |
|
42 | - * @version 20090610 |
|
43 | - * - don't repeat non repeatable background images after a line break |
|
44 | - */ |
|
3 | + * DOMPDF - PHP5 HTML to PDF renderer |
|
4 | + * |
|
5 | + * File: $RCSfile: inline_frame_decorator.cls.php,v $ |
|
6 | + * Created on: 2004-06-02 |
|
7 | + * |
|
8 | + * Copyright (c) 2004 - Benj Carson <[email protected]> |
|
9 | + * |
|
10 | + * This library is free software; you can redistribute it and/or |
|
11 | + * modify it under the terms of the GNU Lesser General Public |
|
12 | + * License as published by the Free Software Foundation; either |
|
13 | + * version 2.1 of the License, or (at your option) any later version. |
|
14 | + * |
|
15 | + * This library is distributed in the hope that it will be useful, |
|
16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
18 | + * Lesser General Public License for more details. |
|
19 | + * |
|
20 | + * You should have received a copy of the GNU Lesser General Public License |
|
21 | + * along with this library in the file LICENSE.LGPL; if not, write to the |
|
22 | + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
|
23 | + * 02111-1307 USA |
|
24 | + * |
|
25 | + * Alternatively, you may distribute this software under the terms of the |
|
26 | + * PHP License, version 3.0 or later. A copy of this license should have |
|
27 | + * been distributed with this file in the file LICENSE.PHP . If this is not |
|
28 | + * the case, you can obtain a copy at http://www.php.net/license/3_0.txt. |
|
29 | + * |
|
30 | + * The latest version of DOMPDF might be available at: |
|
31 | + * http://www.dompdf.com/ |
|
32 | + * |
|
33 | + * @link http://www.dompdf.com/ |
|
34 | + * @copyright 2004 Benj Carson |
|
35 | + * @author Benj Carson <[email protected]> |
|
36 | + * @contributor Helmut Tischer <[email protected]> |
|
37 | + * @package dompdf |
|
38 | + * |
|
39 | + * Changes |
|
40 | + * @contributor Helmut Tischer <[email protected]> |
|
41 | + * @version 20090610 |
|
42 | + * - don't repeat non repeatable background images after a line break |
|
43 | + */ |
|
45 | 44 | |
46 | 45 | /* $Id: inline_frame_decorator.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */ |
47 | 46 | |
@@ -53,17 +52,17 @@ discard block |
||
53 | 52 | */ |
54 | 53 | class Inline_Frame_Decorator extends Frame_Decorator { |
55 | 54 | |
56 | - function __construct(Frame $frame, DOMPDF $dompdf) { parent::__construct($frame, $dompdf); } |
|
55 | + function __construct(Frame $frame, DOMPDF $dompdf) { parent::__construct($frame, $dompdf); } |
|
57 | 56 | |
58 | - function split($frame = null) { |
|
57 | + function split($frame = null) { |
|
59 | 58 | |
60 | 59 | if ( is_null($frame) ) { |
61 | - $this->get_parent()->split($this); |
|
62 | - return; |
|
60 | + $this->get_parent()->split($this); |
|
61 | + return; |
|
63 | 62 | } |
64 | 63 | |
65 | 64 | if ( $frame->get_parent() !== $this ) |
66 | - throw new DOMPDF_Exception("Unable to split: frame is not a child of this one."); |
|
65 | + throw new DOMPDF_Exception("Unable to split: frame is not a child of this one."); |
|
67 | 66 | |
68 | 67 | $split = $this->copy( $this->_frame->get_node()->cloneNode() ); |
69 | 68 | $this->get_parent()->insert_child_after($split, $this); |
@@ -86,18 +85,18 @@ discard block |
||
86 | 85 | //See e.g. in testcase image_variants, long desriptions |
87 | 86 | if ( ($url = $style->background_image) && $url !== "none" |
88 | 87 | && ($repeat = $style->background_repeat) && $repeat !== "repeat" && $repeat !== "repeat-y" |
89 | - ) { |
|
90 | - $style->background_image = "none"; |
|
88 | + ) { |
|
89 | + $style->background_image = "none"; |
|
91 | 90 | } |
92 | 91 | |
93 | 92 | // Add $frame and all following siblings to the new split node |
94 | 93 | $iter = $frame; |
95 | 94 | while ($iter) { |
96 | - $frame = $iter; |
|
97 | - $iter = $iter->get_next_sibling(); |
|
98 | - $frame->reset(); |
|
99 | - $split->append_child($frame); |
|
95 | + $frame = $iter; |
|
96 | + $iter = $iter->get_next_sibling(); |
|
97 | + $frame->reset(); |
|
98 | + $split->append_child($frame); |
|
99 | + } |
|
100 | 100 | } |
101 | - } |
|
102 | 101 | |
103 | 102 | } |
@@ -1,41 +1,40 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * DOMPDF - PHP5 HTML to PDF renderer |
|
4 | - * |
|
5 | - * File: $RCSfile: null_positioner.cls.php,v $ |
|
6 | - * Created on: 2004-07-12 |
|
7 | - * |
|
8 | - * Copyright (c) 2004 - Benj Carson <[email protected]> |
|
9 | - * |
|
10 | - * This library is free software; you can redistribute it and/or |
|
11 | - * modify it under the terms of the GNU Lesser General Public |
|
12 | - * License as published by the Free Software Foundation; either |
|
13 | - * version 2.1 of the License, or (at your option) any later version. |
|
14 | - * |
|
15 | - * This library is distributed in the hope that it will be useful, |
|
16 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
18 | - * Lesser General Public License for more details. |
|
19 | - * |
|
20 | - * You should have received a copy of the GNU Lesser General Public License |
|
21 | - * along with this library in the file LICENSE.LGPL; if not, write to the |
|
22 | - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
|
23 | - * 02111-1307 USA |
|
24 | - * |
|
25 | - * Alternatively, you may distribute this software under the terms of the |
|
26 | - * PHP License, version 3.0 or later. A copy of this license should have |
|
27 | - * been distributed with this file in the file LICENSE.PHP . If this is not |
|
28 | - * the case, you can obtain a copy at http://www.php.net/license/3_0.txt. |
|
29 | - * |
|
30 | - * The latest version of DOMPDF might be available at: |
|
31 | - * http://www.dompdf.com/ |
|
32 | - * |
|
33 | - * @link http://www.dompdf.com/ |
|
34 | - * @copyright 2004 Benj Carson |
|
35 | - * @author Benj Carson <[email protected]> |
|
36 | - * @package dompdf |
|
37 | - |
|
38 | - */ |
|
3 | + * DOMPDF - PHP5 HTML to PDF renderer |
|
4 | + * |
|
5 | + * File: $RCSfile: null_positioner.cls.php,v $ |
|
6 | + * Created on: 2004-07-12 |
|
7 | + * |
|
8 | + * Copyright (c) 2004 - Benj Carson <[email protected]> |
|
9 | + * |
|
10 | + * This library is free software; you can redistribute it and/or |
|
11 | + * modify it under the terms of the GNU Lesser General Public |
|
12 | + * License as published by the Free Software Foundation; either |
|
13 | + * version 2.1 of the License, or (at your option) any later version. |
|
14 | + * |
|
15 | + * This library is distributed in the hope that it will be useful, |
|
16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
18 | + * Lesser General Public License for more details. |
|
19 | + * |
|
20 | + * You should have received a copy of the GNU Lesser General Public License |
|
21 | + * along with this library in the file LICENSE.LGPL; if not, write to the |
|
22 | + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
|
23 | + * 02111-1307 USA |
|
24 | + * |
|
25 | + * Alternatively, you may distribute this software under the terms of the |
|
26 | + * PHP License, version 3.0 or later. A copy of this license should have |
|
27 | + * been distributed with this file in the file LICENSE.PHP . If this is not |
|
28 | + * the case, you can obtain a copy at http://www.php.net/license/3_0.txt. |
|
29 | + * |
|
30 | + * The latest version of DOMPDF might be available at: |
|
31 | + * http://www.dompdf.com/ |
|
32 | + * |
|
33 | + * @link http://www.dompdf.com/ |
|
34 | + * @copyright 2004 Benj Carson |
|
35 | + * @author Benj Carson <[email protected]> |
|
36 | + * @package dompdf |
|
37 | + */ |
|
39 | 38 | |
40 | 39 | /* $Id: null_positioner.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */ |
41 | 40 | |
@@ -47,10 +46,10 @@ discard block |
||
47 | 46 | */ |
48 | 47 | class Null_Positioner extends Positioner { |
49 | 48 | |
50 | - function __construct(Frame_Decorator $frame) { |
|
49 | + function __construct(Frame_Decorator $frame) { |
|
51 | 50 | parent::__construct($frame); |
52 | - } |
|
51 | + } |
|
53 | 52 | |
54 | - function position() { return; } |
|
53 | + function position() { return; } |
|
55 | 54 | |
56 | 55 | } |
@@ -34,7 +34,6 @@ discard block |
||
34 | 34 | * @copyright 2004 Benj Carson |
35 | 35 | * @author Benj Carson <[email protected]> |
36 | 36 | * @package dompdf |
37 | - |
|
38 | 37 | */ |
39 | 38 | |
40 | 39 | /* $Id: frame_factory.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */ |
@@ -52,119 +51,119 @@ discard block |
||
52 | 51 | */ |
53 | 52 | class Frame_Factory { |
54 | 53 | |
55 | - static function decorate_root(Frame $root, DOMPDF $dompdf) { |
|
54 | + static function decorate_root(Frame $root, DOMPDF $dompdf) { |
|
56 | 55 | $frame = new Page_Frame_Decorator($root, $dompdf); |
57 | 56 | $frame->set_reflower( new Page_Frame_Reflower($frame) ); |
58 | 57 | $root->set_decorator($frame); |
59 | 58 | return $frame; |
60 | - } |
|
59 | + } |
|
61 | 60 | |
62 | - // FIXME: this is admittedly a little smelly... |
|
63 | - static function decorate_frame(Frame $frame, $dompdf) { |
|
61 | + // FIXME: this is admittedly a little smelly... |
|
62 | + static function decorate_frame(Frame $frame, $dompdf) { |
|
64 | 63 | if ( is_null($dompdf) ) |
65 | - throw new Exception("foo"); |
|
64 | + throw new Exception("foo"); |
|
66 | 65 | switch ($frame->get_style()->display) { |
67 | 66 | |
68 | 67 | case "block": |
69 | 68 | $positioner = "Block"; |
70 | - $decorator = "Block"; |
|
71 | - $reflower = "Block"; |
|
72 | - break; |
|
69 | + $decorator = "Block"; |
|
70 | + $reflower = "Block"; |
|
71 | + break; |
|
73 | 72 | |
74 | 73 | case "inline-block": |
75 | 74 | $positioner = "Inline"; |
76 | - $decorator = "Block"; |
|
77 | - $reflower = "Block"; |
|
78 | - break; |
|
75 | + $decorator = "Block"; |
|
76 | + $reflower = "Block"; |
|
77 | + break; |
|
79 | 78 | |
80 | 79 | case "inline": |
81 | 80 | $positioner = "Inline"; |
82 | - if ( $frame->get_node()->nodeName === "#text" ) { |
|
81 | + if ( $frame->get_node()->nodeName === "#text" ) { |
|
83 | 82 | $decorator = "Text"; |
84 | 83 | $reflower = "Text"; |
85 | - } else { |
|
84 | + } else { |
|
86 | 85 | $decorator = "Inline"; |
87 | 86 | $reflower = "Inline"; |
88 | - } |
|
89 | - break; |
|
87 | + } |
|
88 | + break; |
|
90 | 89 | |
91 | 90 | case "table": |
92 | 91 | $positioner = "Block"; |
93 | - $decorator = "Table"; |
|
94 | - $reflower = "Table"; |
|
95 | - break; |
|
92 | + $decorator = "Table"; |
|
93 | + $reflower = "Table"; |
|
94 | + break; |
|
96 | 95 | |
97 | 96 | case "inline-table": |
98 | 97 | $positioner = "Inline"; |
99 | - $decorator = "Table"; |
|
100 | - $reflower = "Table"; |
|
101 | - break; |
|
98 | + $decorator = "Table"; |
|
99 | + $reflower = "Table"; |
|
100 | + break; |
|
102 | 101 | |
103 | 102 | case "table-row-group": |
104 | 103 | case "table-header-group": |
105 | 104 | case "table-footer-group": |
106 | 105 | $positioner = "Null"; |
107 | - $decorator = "Table_Row_Group"; |
|
108 | - $reflower = "Table_Row_Group"; |
|
109 | - break; |
|
106 | + $decorator = "Table_Row_Group"; |
|
107 | + $reflower = "Table_Row_Group"; |
|
108 | + break; |
|
110 | 109 | |
111 | 110 | case "table-row": |
112 | 111 | $positioner = "Null"; |
113 | - $decorator = "Table_Row"; |
|
114 | - $reflower = "Table_Row"; |
|
115 | - break; |
|
112 | + $decorator = "Table_Row"; |
|
113 | + $reflower = "Table_Row"; |
|
114 | + break; |
|
116 | 115 | |
117 | 116 | case "table-cell": |
118 | 117 | $positioner = "Table_Cell"; |
119 | - $decorator = "Table_Cell"; |
|
120 | - $reflower = "Table_Cell"; |
|
121 | - break; |
|
118 | + $decorator = "Table_Cell"; |
|
119 | + $reflower = "Table_Cell"; |
|
120 | + break; |
|
122 | 121 | |
123 | 122 | case "list-item": |
124 | 123 | $positioner = "Block"; |
125 | - $decorator = "Block"; |
|
126 | - $reflower = "Block"; |
|
127 | - break; |
|
124 | + $decorator = "Block"; |
|
125 | + $reflower = "Block"; |
|
126 | + break; |
|
128 | 127 | |
129 | 128 | case "-dompdf-list-bullet": |
130 | 129 | if ( $frame->get_style()->list_style_position === "inside" ) |
131 | 130 | $positioner = "Inline"; |
132 | - else |
|
131 | + else |
|
133 | 132 | $positioner = "List_Bullet"; |
134 | 133 | |
135 | - if ( $frame->get_style()->list_style_image !== "none" ) |
|
134 | + if ( $frame->get_style()->list_style_image !== "none" ) |
|
136 | 135 | $decorator = "List_Bullet_Image"; |
137 | - else |
|
136 | + else |
|
138 | 137 | $decorator = "List_Bullet"; |
139 | 138 | |
140 | - $reflower = "List_Bullet"; |
|
141 | - break; |
|
139 | + $reflower = "List_Bullet"; |
|
140 | + break; |
|
142 | 141 | |
143 | 142 | case "-dompdf-image": |
144 | 143 | $positioner = "Inline"; |
145 | - $decorator = "Image"; |
|
146 | - $reflower = "Image"; |
|
147 | - break; |
|
144 | + $decorator = "Image"; |
|
145 | + $reflower = "Image"; |
|
146 | + break; |
|
148 | 147 | |
149 | 148 | case "-dompdf-br": |
150 | 149 | $positioner = "Inline"; |
151 | - $decorator = "Inline"; |
|
152 | - $reflower = "Inline"; |
|
153 | - break; |
|
150 | + $decorator = "Inline"; |
|
151 | + $reflower = "Inline"; |
|
152 | + break; |
|
154 | 153 | |
155 | 154 | default: |
156 | 155 | // FIXME: should throw some sort of warning or something? |
157 | 156 | case "none": |
158 | 157 | $positioner = "Null"; |
159 | - $decorator = "Null"; |
|
160 | - $reflower = "Null"; |
|
161 | - break; |
|
158 | + $decorator = "Null"; |
|
159 | + $reflower = "Null"; |
|
160 | + break; |
|
162 | 161 | |
163 | 162 | } |
164 | 163 | |
165 | 164 | if ( $frame->get_style()->position === "absolute" || |
166 | 165 | $frame->get_style()->position === "fixed" ) |
167 | - $positioner = "Absolute"; |
|
166 | + $positioner = "Absolute"; |
|
168 | 167 | |
169 | 168 | $positioner .= "_Positioner"; |
170 | 169 | $decorator .= "_Frame_Decorator"; |
@@ -176,10 +175,10 @@ discard block |
||
176 | 175 | |
177 | 176 | // Generated content is a special case |
178 | 177 | if ( $frame->get_node()->nodeName === "_dompdf_generated" ) { |
179 | - // Decorate the reflower |
|
180 | - $gen = new Generated_Frame_Reflower( $deco ); |
|
181 | - $gen->set_reflower( $reflow ); |
|
182 | - $reflow = $gen; |
|
178 | + // Decorate the reflower |
|
179 | + $gen = new Generated_Frame_Reflower( $deco ); |
|
180 | + $gen->set_reflower( $reflow ); |
|
181 | + $reflow = $gen; |
|
183 | 182 | } |
184 | 183 | |
185 | 184 | $deco->set_reflower( $reflow ); |
@@ -204,6 +203,6 @@ discard block |
||
204 | 203 | // } |
205 | 204 | |
206 | 205 | return $deco; |
207 | - } |
|
206 | + } |
|
208 | 207 | |
209 | 208 | } |