4 * @link http://dompdf.github.com/
5 * @author Benj Carson <benjcarson@digitaljunkies.ca>
6 * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
9 namespace Dompdf\Positioner
;
11 use Dompdf\FrameDecorator\AbstractFrameDecorator
;
12 use Dompdf\FrameDecorator\Inline
as InlineFrameDecorator
;
16 * Positions inline frames
20 class Inline
extends AbstractPositioner
24 * @param AbstractFrameDecorator $frame
27 function position(AbstractFrameDecorator
$frame)
30 * Find our nearest block level parent and access its lines property.
31 * @var BlockFrameDecorator
33 $p = $frame->find_block_parent();
37 // Helpers::pre_r("\nPositioning:");
38 // Helpers::pre_r("Me: " . $frame->get_node()->nodeName . " (" . spl_object_hash($frame->get_node()) . ")");
39 // Helpers::pre_r("Parent: " . $p->get_node()->nodeName . " (" . spl_object_hash($p->get_node()) . ")");
44 throw new Exception("No block-level parent found. Not good.");
49 $cb = $f->get_containing_block();
50 $line = $p->get_current_line_box();
52 // Skip the page break if in a fixed position element
54 while ($f = $f->get_parent()) {
55 if ($f->get_style()->position
=== "fixed") {
63 if (!$is_fixed && $f->get_parent() &&
64 $f->get_parent() instanceof InlineFrameDecorator
&&
67 $min_max = $f->get_reflower()->get_min_max_width();
69 // If the frame doesn't fit in the current line, a line break occurs
70 if ($min_max["min"] > ($cb["w"] - $line->left
- $line->w
- $line->right
)) {
75 $f->set_position($cb["x"] +
$line->w
, $line->y
);