コード例 #1
0
 function parse($value)
 {
     $terms = preg_split("/(?![,(\\s])\\s+/ ", $value);
     // Note that color declaration always will contain only one word;
     // thus, we can split out value into words and try to parse each one as color
     // if parse_color_declaration returns transparent value, it is possible not
     // a color part of background declaration
     foreach ($terms as $term) {
         $color = parse_color_declaration($term, array(-1, -1, -1));
         if (!is_transparent($color)) {
             return new Color($color, false);
         }
     }
     return CSSBackgroundColor::default_value();
 }
コード例 #2
0
 function parse($value)
 {
     // We should not split terms at whitespaces immediately preceeded by ( or , symbols, as
     // it would break "rgb( xxx, yyy, zzz)" notation
     //
     // As whitespace could be preceeded by another whitespace, we should prevent breaking
     // value in the middle of long whitespace too
     $terms = preg_split("/(?<![,(\\s])\\s+/ ", $value);
     // Note that color declaration always will contain only one word;
     // thus, we can split out value into words and try to parse each one as color
     // if parse_color_declaration returns transparent value, it is possible not
     // a color part of background declaration
     foreach ($terms as $term) {
         if ($term === 'inherit') {
             return CSS_PROPERTY_INHERIT;
         }
         $color =& parse_color_declaration($term);
         if (!$color->isTransparent()) {
             return $color;
         }
     }
     return CSSBackgroundColor::default_value();
 }
コード例 #3
0
 function CSSBackground()
 {
     $this->default_value = new Background(CSSBackgroundColor::default_value(), CSSBackgroundImage::default_value(), CSSBackgroundRepeat::default_value(), CSSBackgroundPosition::default_value());
     $this->CSSProperty(false, false);
 }
コード例 #4
0
 /**
  * Tests if the 'background' CSS property value is the default property value; e.g.
  * all subproperty values are set to defaults.
  * 
  * @return bool Flag indicating if current object have default value
  *
  * @see CSSBackgroundColor::default_value
  * @see BackgroundImage::is_default
  * @see CSSBackgroundRepeat::default_value
  * @see BackgroundPosition::is_default
  */
 function is_default()
 {
     return $this->_color->equals(CSSBackgroundColor::default_value()) && $this->_image->is_default() && $this->_repeat == CSSBackgroundRepeat::default_value() && $this->_position->is_default() && $this->_attachment->is_default();
 }
コード例 #5
0
 function CSSBackground()
 {
     $this->default_value = new Background(CSSBackgroundColor::default_value(), CSSBackgroundImage::default_value(), CSSBackgroundRepeat::default_value(), CSSBackgroundPosition::default_value(), CSSBackgroundAttachment::default_value());
     $this->CSSPropertyHandler(true, false);
 }