本文整理汇总了PHP中Frame::is_in_flow方法的典型用法代码示例。如果您正苦于以下问题:PHP Frame::is_in_flow方法的具体用法?PHP Frame::is_in_flow怎么用?PHP Frame::is_in_flow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Frame
的用法示例。
在下文中一共展示了Frame::is_in_flow方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: count
function add_frame_to_line(Frame $frame)
{
if (!$frame->is_in_flow()) {
return;
}
$style = $frame->get_style();
$frame->set_containing_line($this->_line_boxes[$this->_cl]);
if ($frame instanceof Inline_Frame_Decorator) {
if ($frame->get_node()->nodeName === "br") {
$this->maximize_line_height($style->length_in_pt($style->line_height), $frame);
$this->add_line(true);
}
return;
}
if ($this->get_current_line_box()->w == 0 && $frame->is_text_node() && !$frame->is_pre()) {
$frame->set_text(ltrim($frame->get_text()));
$frame->recalculate_width();
}
$w = $frame->get_margin_width();
if ($w == 0) {
return;
}
$line = $this->_line_boxes[$this->_cl];
if ($line->left + $line->w + $line->right + $w > $this->get_containing_block("w")) {
$this->add_line();
}
$frame->position();
$current_line = $this->_line_boxes[$this->_cl];
$current_line->add_frame($frame);
if ($frame->is_text_node()) {
$current_line->wc += count(preg_split("/\\s+/", trim($frame->get_text())));
}
$this->increase_line_width($w);
$this->maximize_line_height($frame->get_margin_height(), $frame);
}
开发者ID:EfncoPlugins,项目名称:web-portal-lite-client-portal-secure-file-sharing-private-messaging,代码行数:35,代码来源:block_frame_decorator.cls.php
示例2: switch
/**
* Decorate a Frame
*
* @param Frame $frame The frame to decorate
* @param DOMPDF $dompdf The dompdf instance
* @param Frame $root The frame to decorate
*
* @throws DOMPDF_Exception
* @return Frame_Decorator
* FIXME: this is admittedly a little smelly...
*/
static function decorate_frame(Frame $frame, DOMPDF $dompdf, Frame $root = null)
{
if (is_null($dompdf)) {
throw new DOMPDF_Exception("The DOMPDF argument is required");
}
$style = $frame->get_style();
// Floating (and more generally out-of-flow) elements are blocks
// http://coding.smashingmagazine.com/2007/05/01/css-float-theory-things-you-should-know/
if (!$frame->is_in_flow() && in_array($style->display, Style::$INLINE_TYPES)) {
$style->display = "block";
}
$display = $style->display;
switch ($display) {
case "block":
$positioner = "Block";
$decorator = "Block";
$reflower = "Block";
break;
case "inline-block":
$positioner = "Inline";
$decorator = "Block";
$reflower = "Block";
break;
case "inline":
$positioner = "Inline";
if ($frame->is_text_node()) {
$decorator = "Text";
$reflower = "Text";
} else {
$enable_css_float = $dompdf->get_option("enable_css_float");
if ($enable_css_float && $style->float !== "none") {
$decorator = "Block";
$reflower = "Block";
} else {
$decorator = "Inline";
$reflower = "Inline";
}
}
break;
case "table":
$positioner = "Block";
$decorator = "Table";
$reflower = "Table";
break;
case "inline-table":
$positioner = "Inline";
$decorator = "Table";
$reflower = "Table";
break;
case "table-row-group":
case "table-header-group":
case "table-footer-group":
$positioner = "Null";
$decorator = "Table_Row_Group";
$reflower = "Table_Row_Group";
break;
case "table-row":
$positioner = "Null";
$decorator = "Table_Row";
$reflower = "Table_Row";
break;
case "table-cell":
$positioner = "Table_Cell";
$decorator = "Table_Cell";
$reflower = "Table_Cell";
break;
case "list-item":
$positioner = "Block";
$decorator = "Block";
$reflower = "Block";
break;
case "-dompdf-list-bullet":
if ($style->list_style_position === "inside") {
$positioner = "Inline";
} else {
$positioner = "List_Bullet";
}
if ($style->list_style_image !== "none") {
$decorator = "List_Bullet_Image";
} else {
$decorator = "List_Bullet";
}
$reflower = "List_Bullet";
break;
case "-dompdf-image":
$positioner = "Inline";
$decorator = "Image";
$reflower = "Image";
break;
//.........这里部分代码省略.........
示例3: trim
function add_frame_to_line(Frame $frame)
{
if (!$frame->is_in_flow()) {
return;
}
$style = $frame->get_style();
$frame->set_containing_line($this->_line_boxes[$this->_cl]);
/*
// Adds a new line after a block, only if certain conditions are met
if ((($frame instanceof Inline_Frame_Decorator && $frame->get_node()->nodeName !== "br") ||
$frame instanceof Text_Frame_Decorator && trim($frame->get_text())) &&
($frame->get_prev_sibling() && $frame->get_prev_sibling()->get_style()->display === "block" &&
$this->_line_boxes[$this->_cl]->w > 0 )) {
$this->maximize_line_height( $style->length_in_pt($style->line_height), $frame );
$this->add_line();
// Add each child of the inline frame to the line individually
foreach ($frame->get_children() as $child)
$this->add_frame_to_line( $child );
}
else*/
// 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($style->length_in_pt($style->line_height), $frame);
$this->add_line(true);
}
return;
}
// Trim leading text if this is an empty line. Kinda a hack to put it here,
// but what can you do...
if ($this->get_current_line_box()->w == 0 && $frame->is_text_node() && !$frame->is_pre()) {
$frame->set_text(ltrim($frame->get_text()));
$frame->recalculate_width();
}
$w = $frame->get_margin_width();
if ($w == 0) {
return;
}
// Debugging code:
/*
pre_r("\n<h3>Adding frame to line:</h3>");
// pre_r("Me: " . $this->get_node()->nodeName . " (" . spl_object_hash($this->get_node()) . ")");
// pre_r("Node: " . $frame->get_node()->nodeName . " (" . spl_object_hash($frame->get_node()) . ")");
if ( $frame->is_text_node() )
pre_r('"'.$frame->get_node()->nodeValue.'"');
pre_r("Line width: " . $this->_line_boxes[$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
$line = $this->_line_boxes[$this->_cl];
if ($line->left + $line->w + $line->right + $w > $this->get_containing_block("w")) {
$this->add_line();
}
$frame->position();
$current_line = $this->_line_boxes[$this->_cl];
$current_line->add_frame($frame);
if ($frame->is_text_node()) {
$current_line->wc += count(preg_split("/\\s+/", trim($frame->get_text())));
}
$this->increase_line_width($w);
$this->maximize_line_height($frame->get_margin_height(), $frame);
}