GenericBox();
}
function apply_clear($y, &$context) {
return LayoutVertical::apply_clear($this, $y, $context);
}
function out_of_flow() {
return true;
}
function readCSS(&$state) {
parent::readCSS($state);
/**
* We treat BR as a block box; as default value of 'display' property is not 'block', we should
* set it up manually.
*/
$this->setCSSProperty(CSS_DISPLAY, 'block');
$this->_readCSS($state,
array(CSS_CLEAR));
$this->_readCSSLengths($state,
array(CSS_MARGIN,
CSS_LINE_HEIGHT));
}
/**
* Create new BR element
*
* @return BRBox new BR element object
*/
function &create(&$pipeline) {
$box =& new BRBox();
$box->readCSS($pipeline->get_current_css_state());
return $box;
}
/**
* BR tags do not take any horizontal space, so if minimal width is zero.
*
* @param FlowContext $context The object containing auxiliary flow data; not used here/
*
* @return int should always return constant zero.
*/
function get_min_width(&$context) {
return 0;
}
/**
* BR tags do not take any horizontal space, so if maximal width is zero.
*
* @param FlowContext $context The object containing auxiliary flow data; not used here.
*
* @return int should always return constant zero.
*/
function get_max_width(&$context) {
return 0;
}
/**
* Layout current BR element. The reflow routine is somewhat similar to the block box reflow routine.
* As most CSS properties do not apply to BR elements, and BR element always have parent element,
* the routine is much simpler.
*
* @param GenericContainerBox $parent The document element which should be treated as the parent of current element
* @param FlowContext $context The flow context containing the additional layout data
*
* @see FlowContext
* @see GenericContainerBox
*/
function reflow(&$parent, &$context) {
parent::reflow($parent, $context);
/**
* Apply 'clear' property; the current Y coordinate can be modified as a result of 'clear'.
*/
$y = $this->apply_clear($parent->_current_y, $context);
/**
* Move current "box" to parent current coordinates. It is REQUIRED, in spite of the generated
* box itself have no dimensions and will never be drawn, as several other routines uses box coordinates.
*/
$this->put_left($parent->_current_x);
$this->put_top($y);
/**
* If we met a sequence of BR tags (like
), we'll have an only one item in the parent's
* line box - whitespace; in this case we'll need to additionally offset current y coordinate by the font size,
* as whitespace alone does not affect the Y-coordinate.
*/
if ($parent->line_box_empty()) {
/**
* There's no elements in the parent line box at all (e.g in the following situation:
*