1 | <?php
|
---|
2 | /**
|
---|
3 | * DOMPDF - PHP5 HTML to PDF renderer
|
---|
4 | *
|
---|
5 | * File: $RCSfile: inline_positioner.cls.php,v $
|
---|
6 | * Created on: 2004-06-08
|
---|
7 | *
|
---|
8 | * Copyright (c) 2004 - Benj Carson <benjcarson@digitaljunkies.ca>
|
---|
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.digitaljunkies.ca/dompdf
|
---|
32 | *
|
---|
33 | * @link http://www.digitaljunkies.ca/dompdf
|
---|
34 | * @copyright 2004 Benj Carson
|
---|
35 | * @author Benj Carson <benjcarson@digitaljunkies.ca>
|
---|
36 | * @package dompdf
|
---|
37 | * @version 0.5.1
|
---|
38 | */
|
---|
39 |
|
---|
40 | /* $Id: inline_positioner.cls.php 186 2009-10-19 22:42:06Z eclecticgeek@gmail.com $ */
|
---|
41 | /**
|
---|
42 | * Positions inline frames
|
---|
43 | *
|
---|
44 | * @access private
|
---|
45 | * @package dompdf
|
---|
46 | */
|
---|
47 | class Inline_Positioner extends Positioner {
|
---|
48 |
|
---|
49 | function __construct(Frame_Decorator $frame) { parent::__construct($frame); }
|
---|
50 |
|
---|
51 | //........................................................................
|
---|
52 |
|
---|
53 | function position() {
|
---|
54 | $cb = $this->_frame->get_containing_block();
|
---|
55 |
|
---|
56 | // Find our nearest block level parent and access its lines property.
|
---|
57 | $p = $this->_frame->find_block_parent();
|
---|
58 |
|
---|
59 | // Debugging code:
|
---|
60 |
|
---|
61 | // pre_r("\nPositioning:");
|
---|
62 | // pre_r("Me: " . $this->_frame->get_node()->nodeName . " (" . spl_object_hash($this->_frame->get_node()) . ")");
|
---|
63 | // pre_r("Parent: " . $p->get_node()->nodeName . " (" . spl_object_hash($p->get_node()) . ")");
|
---|
64 |
|
---|
65 | // End debugging
|
---|
66 |
|
---|
67 | if ( !$p )
|
---|
68 | throw new DOMPDF_Exception("No block-level parent found. Not good.");
|
---|
69 |
|
---|
70 | $line = $p->get_current_line();
|
---|
71 |
|
---|
72 | $this->_frame->set_position($cb["x"] + $line["w"], $line["y"]);
|
---|
73 |
|
---|
74 | }
|
---|
75 | }
|
---|
76 | ?> |
---|