1<?php
2// $Header: /cvsroot/html2ps/css.max-height.inc.php,v 1.3 2006/11/11 13:43:52 Konstantin Exp $
3
4require_once(HTML2PS_DIR.'value.max-height.php');
5
6class CSSMaxHeight extends CSSPropertyHandler {
7  var $_defaultValue;
8
9  function CSSMaxHeight() {
10    $this->CSSPropertyHandler(true, false);
11    $this->_defaultValue = ValueMaxHeight::fromString("auto");
12  }
13
14  /**
15   * 'height' CSS property should be inherited by table cells from table rows
16   * (as, obviously, )
17   */
18  function inherit($old_state, &$new_state) {
19    $parent_display = $old_state[CSS_DISPLAY];
20    if ($parent_display === "table-row") {
21      $new_state[CSS_MAX_HEIGHT] = $old_state[CSS_MAX_HEIGHT];
22      return;
23    }
24
25    $new_state[CSS_MAX_HEIGHT] =
26      is_inline_element($parent_display) ?
27      $this->get($old_state) :
28      $this->default_value();
29  }
30
31  function _getAutoValue() {
32    return $this->default_value();
33  }
34
35  function default_value() {
36    return $this->_defaultValue->copy();
37  }
38
39  function parse($value) {
40    if ($value == 'none') {
41      return ValueMaxHeight::fromString('auto');
42    };
43    return ValueMaxHeight::fromString($value);
44  }
45
46  function get_property_code() {
47    return CSS_MAX_HEIGHT;
48  }
49
50  function get_property_name() {
51    return 'max-height';
52  }
53}
54
55CSS::register_css_property(new CSSMaxHeight);
56
57?>