static void parseShorthandBackground(CSS css,
String value,
MutableAttributeSet attr) {
String[] strings = parseStrings(value);
int count = strings.length;
int index = 0;
// bitmask: 0 for image, 1 repeat, 2 attachment, 3 position,
// 4 color
short found = 0;
while (index < count) {
String string = strings[index++];
if ((found & 1) == 0 && isImage(string)) {
css.addInternalCSSValue(attr, CSS.Attribute.
BACKGROUND_IMAGE, string);
found |= 1;
}
else if ((found & 2) == 0 && isRepeat(string)) {
css.addInternalCSSValue(attr, CSS.Attribute.
BACKGROUND_REPEAT, string);
found |= 2;
}
else if ((found & 4) == 0 && isAttachment(string)) {
css.addInternalCSSValue(attr, CSS.Attribute.
BACKGROUND_ATTACHMENT, string);
found |= 4;
}
else if ((found & 8) == 0 && isPosition(string)) {
if (index < count && isPosition(strings[index])) {
css.addInternalCSSValue(attr, CSS.Attribute.
BACKGROUND_POSITION,
string + " " +
strings[index++]);
}
else {
css.addInternalCSSValue(attr, CSS.Attribute.
BACKGROUND_POSITION, string);
}
found |= 8;
}
else if ((found & 16) == 0 && isColor(string)) {
css.addInternalCSSValue(attr, CSS.Attribute.
BACKGROUND_COLOR, string);
found |= 16;
}
}
if ((found & 1) == 0) {
css.addInternalCSSValue(attr, CSS.Attribute.BACKGROUND_IMAGE,
null);
}
if ((found & 2) == 0) {
css.addInternalCSSValue(attr, CSS.Attribute.BACKGROUND_REPEAT,
"repeat");
}
if ((found & 4) == 0) {
css.addInternalCSSValue(attr, CSS.Attribute.
BACKGROUND_ATTACHMENT, "scroll");
}
if ((found & 8) == 0) {
css.addInternalCSSValue(attr, CSS.Attribute.
BACKGROUND_POSITION, null);
}
// Currently, there is no good way to express this.
/*
if ((found & 16) == 0) {
css.addInternalCSSValue(attr, CSS.Attribute.BACKGROUND_COLOR,
null);
}
*/
}
Parses the shorthand font string value, placing the
result in attr. |