}
StyleObjectModel model = null;
Reader reader = new StringReader(cssString);
CSSOMParser parser2 = new CSSOMParser();
CSSStyleDeclaration n;
try {
n = parser2.parseStyleDeclaration(new InputSource(reader));
model = new StyleObjectModel();
model.setBorder(new StyleBorderModel());
boolean isItalic = false;
boolean isBold = false;
for (int i = 0; i < n.getLength(); i++) {
String name = n.item(i);
if (n.getPropertyCSSValue(name) instanceof CSSPrimitiveValue) {
CSSPrimitiveValue value = (CSSPrimitiveValue) n.getPropertyCSSValue(name);
if (name.equalsIgnoreCase("color")) {
model.setColor(getColor(value));
}
if (name.equalsIgnoreCase("border-color")) {
model.getBorder().setColor(getColor(value));
}
if (name.equalsIgnoreCase("border-width")) {
model.getBorder().setWidth(getSize(value));
}
if (name.equalsIgnoreCase("width")) {
model.setWidth(getSize(value));
}
if (name.equalsIgnoreCase("height")) {
model.setHeight(getSize(value));
}
if (name.equalsIgnoreCase("border")) {
CSSValueList list = (CSSValueList) n.getPropertyCSSValue(name);
model.setBorder(getBorder(list));
}
if (name.equalsIgnoreCase("margin")) {
CSSValueList list = (CSSValueList) n.getPropertyCSSValue(name);
model.setMargings(getMargins(list));
}
if (name.equalsIgnoreCase("border-style")) {
model.getBorder().setStyle(value.getStringValue());
}
if (name.equalsIgnoreCase("background")) {
model.setBackground(getColor(value));
}
if (name.equalsIgnoreCase("background-color")) {
model.setBackground(getColor(value));
}
if (name.equalsIgnoreCase("font")) {
if (model.getFont() == null) model.setFont(new StyleFontModel());
CSSValueList list = (CSSValueList) n.getPropertyCSSValue(name);
model.setFont(getFont(model, list));
}
if (name.equalsIgnoreCase("font-family")) {
if (model.getFont() == null) model.setFont(new StyleFontModel());