当前位置: 首页>>代码示例>>PHP>>正文


PHP Block_Frame_Decorator::get_parent方法代码示例

本文整理汇总了PHP中Block_Frame_Decorator::get_parent方法的典型用法代码示例。如果您正苦于以下问题:PHP Block_Frame_Decorator::get_parent方法的具体用法?PHP Block_Frame_Decorator::get_parent怎么用?PHP Block_Frame_Decorator::get_parent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Block_Frame_Decorator的用法示例。


在下文中一共展示了Block_Frame_Decorator::get_parent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _calculate_width

 /**
  *  Calculate the ideal used value for the width property as per:
  *  http://www.w3.org/TR/CSS21/visudet.html#Computing_widths_and_margins
  *  
  *  @param float $width
  *  @return array
  */
 protected function _calculate_width($width)
 {
     $style = $this->_frame->get_style();
     $w = $this->_frame->get_containing_block("w");
     if ($style->position === "fixed") {
         $w = $this->_frame->get_parent()->get_containing_block("w");
     }
     $rm = $style->length_in_pt($style->margin_right, $w);
     $lm = $style->length_in_pt($style->margin_left, $w);
     $left = $style->length_in_pt($style->left, $w);
     $right = $style->length_in_pt($style->right, $w);
     // Handle 'auto' values
     $dims = array($style->border_left_width, $style->border_right_width, $style->padding_left, $style->padding_right, $width !== "auto" ? $width : 0, $rm !== "auto" ? $rm : 0, $lm !== "auto" ? $lm : 0);
     // absolutely positioned boxes take the 'left' and 'right' properties into account
     if ($style->position === "absolute" || $style->position === "fixed") {
         $absolute = true;
         $dims[] = $left !== "auto" ? $left : 0;
         $dims[] = $right !== "auto" ? $right : 0;
     } else {
         $absolute = false;
     }
     $sum = $style->length_in_pt($dims, $w);
     // Compare to the containing block
     $diff = $w - $sum;
     if ($diff > 0) {
         if ($absolute) {
             // resolve auto properties: see
             // http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width
             if ($width === "auto" && $left === "auto" && $right === "auto") {
                 if ($lm === "auto") {
                     $lm = 0;
                 }
                 if ($rm === "auto") {
                     $rm = 0;
                 }
                 // Technically, the width should be "shrink-to-fit" i.e. based on the
                 // preferred width of the content...  a little too costly here as a
                 // special case.  Just get the width to take up the slack:
                 $left = 0;
                 $right = 0;
                 $width = $diff;
             } else {
                 if ($width === "auto") {
                     if ($lm === "auto") {
                         $lm = 0;
                     }
                     if ($rm === "auto") {
                         $rm = 0;
                     }
                     if ($left === "auto") {
                         $left = 0;
                     }
                     if ($right === "auto") {
                         $right = 0;
                     }
                     $width = $diff;
                 } else {
                     if ($left === "auto") {
                         if ($lm === "auto") {
                             $lm = 0;
                         }
                         if ($rm === "auto") {
                             $rm = 0;
                         }
                         if ($right === "auto") {
                             $right = 0;
                         }
                         $left = $diff;
                     } else {
                         if ($right === "auto") {
                             if ($lm === "auto") {
                                 $lm = 0;
                             }
                             if ($rm === "auto") {
                                 $rm = 0;
                             }
                             $right = $diff;
                         }
                     }
                 }
             }
         } else {
             // Find auto properties and get them to take up the slack
             if ($width === "auto") {
                 $width = $diff;
             } else {
                 if ($lm === "auto" && $rm === "auto") {
                     $lm = $rm = round($diff / 2);
                 } else {
                     if ($lm === "auto") {
                         $lm = $diff;
                     } else {
                         if ($rm === "auto") {
//.........这里部分代码省略.........
开发者ID:snehakumavat,项目名称:thar,代码行数:101,代码来源:block_frame_reflower.cls.php


注:本文中的Block_Frame_Decorator::get_parent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。