1<?php
2
3define('BACKGROUND_ATTACHMENT_SCROLL', 1);
4define('BACKGROUND_ATTACHMENT_FIXED', 2);
5
6class CSSBackgroundAttachment extends CSSSubFieldProperty {
7  function get_property_code() {
8    return CSS_BACKGROUND_ATTACHMENT;
9  }
10
11  function get_property_name() {
12    return 'background-attachment';
13  }
14
15  function default_value() {
16    return BACKGROUND_ATTACHMENT_SCROLL;
17  }
18
19  function &parse($value_string) {
20    if ($value_string === 'inherit') {
21      return CSS_PROPERTY_INHERIT;
22    };
23
24    if (preg_match('/\bscroll\b/', $value_string)) {
25      $value = BACKGROUND_ATTACHMENT_SCROLL;
26    } elseif (preg_match('/\bfixed\b/', $value_string)) {
27      $value = BACKGROUND_ATTACHMENT_FIXED;
28    } else {
29      $value = BACKGROUND_ATTACHMENT_SCROLL;
30    };
31
32    return $value;
33  }
34}
35?>