function parse($value) { if ($value === 'inherit') { return CSS_PROPERTY_INHERIT; } // Note that we cannot just compare $value with these strings for equality, // as 'parse' can be called with composite 'background' value as a parameter, // say, 'black url(picture.gif) repeat', instead of just using 'repeat' // Also, note that // 1) 'repeat-x' value will match 'repeat' term // 2) background-image 'url' values may contain these values as substrings // to avoid these problems, we'll add spaced to the beginning and to the end of value, // and will search for space-padded values, instead of raw substrings $value = " " . $value . " "; if (strpos($value, ' repeat-x ') !== false) { return BR_REPEAT_X; } if (strpos($value, ' repeat-y ') !== false) { return BR_REPEAT_Y; } if (strpos($value, ' no-repeat ') !== false) { return BR_NO_REPEAT; } if (strpos($value, ' repeat ') !== false) { return BR_REPEAT; } return CSSBackgroundRepeat::default_value(); }
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, &$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(); }