private OMSVGPaint parse(String cssText, String uri) {
if (uri == null) {
// begins with a funciri
FUNCIRI.setLastIndex(0);
MatchResult result = FUNCIRI.exec(cssText);
if (result != null && result.getGroupCount() == 2) {
// GWT.log("matched funciri: '" + cssText.substring(FUNCIRI.getLastIndex()) + "' '" + result.getGroup(1) + "'");
String str = FUNCIRI.getLastIndex() == cssText.length() ? null : cssText.substring(FUNCIRI.getLastIndex());
return parse(str, result.getGroup(1));
}
}
String rgbColor = null;
String iccColor = null;
if (cssText != null) {
if (SVGConstants.CSS_NONE_VALUE.equals(cssText)) {
// none
if (uri == null) {
return NONE;
}
OMSVGPaint paint = new OMSVGPaint(OMSVGPaint.SVG_PAINTTYPE_URI_NONE);
paint.setPaint(OMSVGPaint.SVG_PAINTTYPE_URI_NONE, uri, null, null);
return paint;
} else if (SVGConstants.CSS_INHERIT_VALUE.equals(cssText)) {
// none
return INHERIT;
} else if (SVGConstants.CSS_CURRENTCOLOR_VALUE.equals(cssText)) {
// currentColor
if (uri == null) {
return CURRENT_COLOR;
}
OMSVGPaint paint = new OMSVGPaint(OMSVGPaint.SVG_PAINTTYPE_URI_CURRENTCOLOR);
paint.setPaint(OMSVGPaint.SVG_PAINTTYPE_URI_CURRENTCOLOR, uri, null, null);
return paint;
}
COLORNAME.setLastIndex(0);
MatchResult result = COLORNAME.exec(cssText);
if (result != null && result.getGroupCount() == 2) {
// color name
rgbColor = getNamedColor(result.getGroup(1));
if (rgbColor == null) {
throw new JavaScriptException("Unknown color keyword: " + cssText);
}
iccColor = COLORNAME.getLastIndex() == cssText.length() ? null : cssText.substring(COLORNAME.getLastIndex());
}
if (rgbColor == null) {
RGB255.setLastIndex(0);
result = RGB255.exec(cssText);
if (result != null && result.getGroupCount() == 4) {
rgbColor = result.getGroup(0);
iccColor = RGB255.getLastIndex() == cssText.length() ? null : cssText.substring(RGB255.getLastIndex());
}
}
if (rgbColor == null) {
RGBPCT.setLastIndex(0);
result = RGBPCT.exec(cssText);
if (result != null && result.getGroupCount() == 4) {
rgbColor = result.getGroup(0);
iccColor = RGBPCT.getLastIndex() == cssText.length() ? null : cssText.substring(RGBPCT.getLastIndex());
}
}
if (rgbColor == null) {
RGBHEX.setLastIndex(0);
result = RGBHEX.exec(cssText);
if (result != null && result.getGroupCount() == 2) {
rgbColor = result.getGroup(0);
iccColor = RGBHEX.getLastIndex() == cssText.length() ? null : cssText.substring(RGBHEX.getLastIndex());
}
}
}