本文整理汇总了PHP中Frame::recalculate_width方法的典型用法代码示例。如果您正苦于以下问题:PHP Frame::recalculate_width方法的具体用法?PHP Frame::recalculate_width怎么用?PHP Frame::recalculate_width使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Frame
的用法示例。
在下文中一共展示了Frame::recalculate_width方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
function add_frame_to_line(Frame $frame)
{
// Handle inline frames (which are effectively wrappers)
if ($frame instanceof Inline_Frame_Decorator) {
// Handle line breaks
if ($frame->get_node()->nodeName == "br") {
$this->maximize_line_height($frame->get_style()->length_in_pt($frame->get_style()->line_height));
$this->add_line();
return;
}
// Add each child of the inline frame to the line individually
foreach ($frame->get_children() as $child) {
$this->add_frame_to_line($child);
}
return;
}
// Trim leading text if this is an empty line. Kinda a hack to put it here,
// but what can you do...
if ($this->_lines[$this->_cl]["w"] == 0 && $frame->get_node()->nodeName == "#text" && ($frame->get_style()->white_space != "pre" || $frame->get_style()->white_space != "pre-wrap")) {
$frame->set_text(ltrim($frame->get_text()));
$frame->recalculate_width();
}
$w = $frame->get_margin_width();
if ($w == 0) {
return;
}
// Debugging code:
/*
pre_r("\nAdding frame to line:");
// pre_r("Me: " . $this->get_node()->nodeName . " (" . (string)$this->get_node() . ")");
// pre_r("Node: " . $frame->get_node()->nodeName . " (" . (string)$frame->get_node() . ")");
if ( $frame->get_node()->nodeName == "#text" )
pre_r($frame->get_node()->nodeValue);
pre_r("Line width: " . $this->_lines[$this->_cl]["w"]);
pre_r("Frame: " . get_class($frame));
pre_r("Frame width: " . $w);
pre_r("Frame height: " . $frame->get_margin_height());
pre_r("Containing block width: " . $this->get_containing_block("w"));
*/
// End debugging
if ($this->_lines[$this->_cl]["w"] + $w > $this->get_containing_block("w")) {
$this->add_line();
}
$frame->position();
$this->_lines[$this->_cl]["frames"][] = $frame;
if ($frame->get_node()->nodeName == "#text") {
$this->_lines[$this->_cl]["wc"] += count(preg_split("/\\s+/", $frame->get_text()));
}
$this->_lines[$this->_cl]["w"] += $w;
$this->_lines[$this->_cl]["h"] = max($this->_lines[$this->_cl]["h"], $frame->get_margin_height());
}