return;
}
}
}
LexicalUnit fontStyle = null;
LexicalUnit fontVariant = null;
LexicalUnit fontWeight = null;
LexicalUnit fontSize = null;
LexicalUnit lineHeight = null;
LexicalUnit fontFamily = null;
ValueManager[]vMgrs = eng.getValueManagers();
int fst, fv, fw, fsz, lh, ff;
fst = eng.getPropertyIndex(CSSConstants.CSS_FONT_STYLE_PROPERTY);
fv = eng.getPropertyIndex(CSSConstants.CSS_FONT_VARIANT_PROPERTY);
fw = eng.getPropertyIndex(CSSConstants.CSS_FONT_WEIGHT_PROPERTY);
fsz = eng.getPropertyIndex(CSSConstants.CSS_FONT_SIZE_PROPERTY);
lh = eng.getPropertyIndex(CSSConstants.CSS_LINE_HEIGHT_PROPERTY);
ff = eng.getPropertyIndex(CSSConstants.CSS_FONT_FAMILY_PROPERTY);
IdentifierManager fstVM = (IdentifierManager)vMgrs[fst];
IdentifierManager fvVM = (IdentifierManager)vMgrs[fv];
IdentifierManager fwVM = (IdentifierManager)vMgrs[fw];
FontSizeManager fszVM = (FontSizeManager)vMgrs[fsz];
ValueManager ffVM = vMgrs[ff];
StringMap fstSM = fstVM.getIdentifiers();
StringMap fvSM = fvVM.getIdentifiers();
StringMap fwSM = fwVM.getIdentifiers();
StringMap fszSM = fszVM.getIdentifiers();
// Check for font-style, font-varient, & font-weight
// These are all optional.
boolean svwDone= false;
LexicalUnit intLU = null;;
while (!svwDone && (lu != null)) {
switch (lu.getLexicalUnitType()) {
case LexicalUnit.SAC_IDENT: {
String s= lu.getStringValue().toLowerCase().intern();
if ((fontStyle == null) && (fstSM.get(s) != null)) {
fontStyle = lu;
if (intLU != null) {
if (fontWeight == null) {
fontWeight = intLU;
intLU = null;
} else
throw createInvalidLexicalUnitDOMException
(intLU.getLexicalUnitType());
}
break;
}
if ((fontVariant == null) && (fvSM.get(s) != null)) {
fontVariant = lu;
if (intLU != null) {
if (fontWeight == null) {
fontWeight = intLU;
intLU = null;
} else
throw createInvalidLexicalUnitDOMException
(intLU.getLexicalUnitType());
}
break;
}
if ((intLU == null) && (fontWeight == null) &&
(fwSM.get(s) != null)) {
fontWeight = lu;
break;
}
svwDone = true;
break;
}
case LexicalUnit.SAC_INTEGER:
if ((intLU == null) && (fontWeight == null)) {
intLU = lu;
break;
}
svwDone = true;
break;
default: // All other must be size,'/line-height', family
svwDone = true;
break;
}
if (!svwDone) lu = lu.getNextLexicalUnit();
}
// Must have font-size.
if (lu == null)
throw createMalformedLexicalUnitDOMException();
// Now we need to get font-size
switch (lu.getLexicalUnitType()) {
case LexicalUnit.SAC_IDENT: {
String s= lu.getStringValue().toLowerCase().intern();
if (fszSM.get(s) != null) {
fontSize = lu; // This is a font-size ident.
lu = lu.getNextLexicalUnit();
}
}
break;
case LexicalUnit.SAC_EM:
case LexicalUnit.SAC_EX:
case LexicalUnit.SAC_PIXEL:
case LexicalUnit.SAC_CENTIMETER:
case LexicalUnit.SAC_MILLIMETER:
case LexicalUnit.SAC_INCH:
case LexicalUnit.SAC_POINT:
case LexicalUnit.SAC_PICA:
case LexicalUnit.SAC_INTEGER:
case LexicalUnit.SAC_REAL:
case LexicalUnit.SAC_PERCENTAGE:
fontSize = lu;
lu = lu.getNextLexicalUnit();
break;
}
if (fontSize == null) {
// We must have a font-size so see if we can use intLU...
if (intLU != null) {
fontSize = intLU; // Yup!
intLU = null;
} else {
throw createInvalidLexicalUnitDOMException
(lu.getLexicalUnitType());
}
}
if (intLU != null) {
// We have a intLU left see if we can use it as font-weight
if (fontWeight == null) {
fontWeight = intLU; // use intLU as font-weight.
} else {
// we have an 'extra' integer in property.
throw createInvalidLexicalUnitDOMException
(intLU.getLexicalUnitType());
}
}
// Must have Font-Family, so if it's null now we are done!
if (lu == null)