source: trunk/filemanager/tp/dompdf/include/inline_frame_decorator.cls.php @ 2000

Revision 2000, 3.5 KB checked in by amuller, 14 years ago (diff)

Ticket #597 - Implementação do módulo gerenciador de arquivos

Line 
1<?php
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 <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 * @contributor Helmut Tischer <htischer@weihenstephan.org>
37 * @package dompdf
38 * @version 0.5.1
39 *
40 * Changes
41 * @contributor Helmut Tischer <htischer@weihenstephan.org>
42 * @version 20090610
43 * - don't repeat non repeatable background images after a line break
44 */
45
46/* $Id: inline_frame_decorator.cls.php 186 2009-10-19 22:42:06Z eclecticgeek@gmail.com $ */
47
48/**
49 * Decorates frames for inline layout
50 *
51 * @access private
52 * @package dompdf
53 */
54class Inline_Frame_Decorator extends Frame_Decorator {
55 
56  function __construct(Frame $frame, DOMPDF $dompdf) { parent::__construct($frame, $dompdf); }
57
58  function split($frame = null) {
59
60    if ( is_null($frame) ) {
61      $this->get_parent()->split($this);
62      return;
63    }
64   
65    if ( $frame->get_parent() !== $this )
66      throw new DOMPDF_Exception("Unable to split: frame is not a child of this one.");
67       
68    $split = $this->copy( $this->_frame->get_node()->cloneNode() );
69    $this->get_parent()->insert_child_after($split, $this);
70
71    // Unset the current node's right style properties
72    $style = $this->_frame->get_style();
73    $style->margin_right = "0";
74    $style->padding_right = "0";
75    $style->border_right_width = "0";
76
77    // Unset the split node's left style properties since we don't want them
78    // to propagate
79    $style = $split->get_style();
80    $style->margin_left = "0";
81    $style->padding_left = "0";
82    $style->border_left_width = "0";
83
84    //On continuation of inline element on next line,
85    //don't repeat non-vertically repeatble background images
86    //See e.g. in testcase image_variants, long desriptions
87    if ( ($url = $style->background_image) && $url !== "none"
88         && ($repeat = $style->background_repeat) && $repeat != "repeat" &&  $repeat != "repeat-y"
89       ) {
90      $style->background_image = "none";
91    }           
92
93    // Add $frame and all following siblings to the new split node
94    $iter = $frame;
95    while ($iter) {
96      $frame = $iter;     
97      $iter = $iter->get_next_sibling();
98      $frame->reset();
99      $split->append_child($frame);
100    }
101  }
102 
103}
104?>
Note: See TracBrowser for help on using the repository browser.