本文整理汇总了PHP中Table_Frame_Decorator::get_containing_block方法的典型用法代码示例。如果您正苦于以下问题:PHP Table_Frame_Decorator::get_containing_block方法的具体用法?PHP Table_Frame_Decorator::get_containing_block怎么用?PHP Table_Frame_Decorator::get_containing_block使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Table_Frame_Decorator
的用法示例。
在下文中一共展示了Table_Frame_Decorator::get_containing_block方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _calculate_height
protected function _calculate_height()
{
$style = $this->_frame->get_style();
$height = $style->height;
$cellmap = $this->_frame->get_cellmap();
$cellmap->assign_frame_heights();
$rows = $cellmap->get_rows();
// Determine our content height
$content_height = 0;
foreach ($rows as $r) {
$content_height += $r["height"];
}
$cb = $this->_frame->get_containing_block();
if (!($style->overflow === "visible" || $style->overflow === "hidden" && $height === "auto")) {
// Only handle min/max height if the height is independent of the frame's content
$min_height = $style->min_height;
$max_height = $style->max_height;
if (isset($cb["h"])) {
$min_height = $style->length_in_pt($min_height, $cb["h"]);
$max_height = $style->length_in_pt($max_height, $cb["h"]);
} else {
if (isset($cb["w"])) {
if (mb_strpos($min_height, "%") !== false) {
$min_height = 0;
} else {
$min_height = $style->length_in_pt($min_height, $cb["w"]);
}
if (mb_strpos($max_height, "%") !== false) {
$max_height = "none";
} else {
$max_height = $style->length_in_pt($max_height, $cb["w"]);
}
}
}
if ($max_height !== "none" && $min_height > $max_height) {
list($max_height, $min_height) = array($min_height, $max_height);
}
if ($max_height !== "none" && $height > $max_height) {
$height = $max_height;
}
if ($height < $min_height) {
$height = $min_height;
}
} else {
// Use the content height or the height value, whichever is greater
if ($height !== "auto") {
$height = $style->length_in_pt($height, $cb["h"]);
if ($height <= $content_height) {
$height = $content_height;
} else {
$cellmap->set_frame_heights($height, $content_height);
}
} else {
$height = $content_height;
}
}
return $height;
}
示例2: array
function get_min_max_width()
{
if (!is_null($this->_min_max_cache)) {
return $this->_min_max_cache;
}
$style = $this->_frame->get_style();
$this->_frame->normalise();
// Add the cells to the cellmap (this will calcluate column widths as
// frames are added)
$this->_frame->get_cellmap()->add_frame($this->_frame);
// Find the min/max width of the table and sort the columns into
// absolute/percent/auto arrays
$this->_state = array();
$this->_state["min_width"] = 0;
$this->_state["max_width"] = 0;
$this->_state["percent_used"] = 0;
$this->_state["absolute_used"] = 0;
$this->_state["auto_min"] = 0;
$this->_state["absolute"] = array();
$this->_state["percent"] = array();
$this->_state["auto"] = array();
$columns =& $this->_frame->get_cellmap()->get_columns();
foreach (array_keys($columns) as $i) {
$this->_state["min_width"] += $columns[$i]["min-width"];
$this->_state["max_width"] += $columns[$i]["max-width"];
if ($columns[$i]["absolute"] > 0) {
$this->_state["absolute"][] = $i;
$this->_state["absolute_used"] += $columns[$i]["absolute"];
} else {
if ($columns[$i]["percent"] > 0) {
$this->_state["percent"][] = $i;
$this->_state["percent_used"] += $columns[$i]["percent"];
} else {
$this->_state["auto"][] = $i;
$this->_state["auto_min"] += $columns[$i]["min-width"];
}
}
}
// Account for margins & padding
$dims = array($style->border_left_width, $style->border_right_width, $style->padding_left, $style->padding_right, $style->margin_left, $style->margin_right);
if ($style->border_collapse !== "collapse") {
list($dims[]) = $style->border_spacing;
}
$delta = $style->length_in_pt($dims, $this->_frame->get_containing_block("w"));
$this->_state["min_width"] += $delta;
$this->_state["max_width"] += $delta;
return $this->_min_max_cache = array($this->_state["min_width"], $this->_state["max_width"], "min" => $this->_state["min_width"], "max" => $this->_state["max_width"]);
}