Source for file BackgroundPosition.php
Documentation is available at BackgroundPosition.php
[ // adjective and number must be in correct order, even if
// you could switch them without introducing ambiguity.
// some browsers support that syntax
<percentage> | <length> | left | center | right
<percentage> | <length> | top | center | bottom
[ // this signifies that the vertical and horizontal adjectives
// can be arbitrarily ordered, however, there can only be two,
// one of each, or none at all
keyword + length/percentage must be ordered correctly, as per W3C
Internet Explorer and Opera, however, support arbitrary ordering. We
Minor issue though, not strictly necessary.
// control freaks may appreciate the ability to convert these to
// percentages or something, but it's not necessary
* Validates the value of background-position.
public function validate($string, $config, $context) {
$keywords['h'] =
false; // left, right
$keywords['v'] =
false; // top, bottom
$keywords['c'] =
false; // center
foreach ($bits as $bit) {
if ($bit ===
'') continue;
if (isset
($lookup[$lbit])) {
$status =
$lookup[$lbit];
$keywords[$status] =
$lbit;
$r =
$this->length->validate($bit, $config, $context);
$r =
$this->percentage->validate($bit, $config, $context);
if (!$i) return false; // no valid values were caught
if ($keywords['h']) $ret[] =
$keywords['h'];
elseif ($keywords['c']) {
$keywords['c'] =
false; // prevent re-use: center = center center
if ($keywords['v']) $ret[] =
$keywords['v'];
elseif ($keywords['c']) $ret[] =
$keywords['c'];
if (empty($ret)) return false;
Documentation generated on Thu, 19 Jun 2008 18:48:52 -0400 by phpDocumentor 1.4.2