function parse($value, &$pipeline) { if ($value === 'inherit') { return CSS_PROPERTY_INHERIT; } $background = new Background(CSSBackgroundColor::parse($value), CSSBackgroundImage::parse($value, $pipeline), CSSBackgroundRepeat::parse($value), CSSBackgroundPosition::parse($value), CSSBackgroundAttachment::parse($value)); return $background; }
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(); }
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(); }
function parse($value, &$pipeline) { $background = new Background(CSSBackgroundColor::parse($value), CSSBackgroundImage::parse($value, $pipeline), CSSBackgroundRepeat::parse($value), CSSBackgroundPosition::parse($value)); return $background; }
/** * 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(); }