Graphics::Color HTMLFrameSetElement::get_borderColorRGBValue() { String str = getAttribute(WSTR("bordercolor")); if (str) { const WCHAR* p; Graphics::Color clr; ASSERT(0); #if 0 if (ParseRGBColor(str->c_str(), &p, &clr) >= 0) { if (*p == 0) { return clr; } } #endif } return Graphics::Color(); }
ErrorCode ParseRGBAColor(/*[in]*/ const WCHAR* p, /*[out]*/ const WCHAR** pp, /*[out,retval]*/ Graphics::Color* pVal) { if ((p[0] == 'r') && (p[1] == 'g') && (p[2] == 'b') && (p[3] == 'a')) { p += 4; while (*p && *p == L' ') p++; // Skip spaces if (*p++ != L'(') return -1; // Error while (*p && *p == L' ') p++; // Skip spaces double red = getfnumber(&p); if (p == NULL) return -1; if (*p == L'%') { p++; red = red * 255 / 100; } while (*p && *p == L' ') p++; // Skip spaces if (*p++ != L',') return -1; while (*p && *p == L' ') p++; // Skip spaces double green = getfnumber(&p); if (p == NULL) return -1; if (*p == L'%') { p++; green = green * 255 / 100; } while (*p && *p == L' ') p++; // Skip spaces if (*p++ != L',') return -1; while (*p && *p == L' ') p++; // Skip spaces double blue = getfnumber(&p); if (p == NULL) return -1; if (*p == L'%') { p++; blue = blue * 255 / 100; } while (*p && *p == L' ') p++; // Skip spaces if (*p++ != L',') return -1; while (*p && *p == L' ') p++; // Skip spaces double alpha = getfnumber(&p); if (p == NULL) return -1; alpha *= 255; while (*p && *p == L' ') p++; // Skip spaces if (*p++ != L')') return -1; // Error *pp = p; if (red < 0) red = 0; else if (red > 255) red = 255; if (green < 0) green = 0; else if (green > 255) green = 255; if (blue < 0) blue = 0; else if (blue > 255) blue = 255; if (alpha < 0) alpha = 0; else if (alpha > 255) alpha = 255; *pVal = Graphics::Color((uint8)alpha, (uint8)red, (uint8)green, (uint8)blue); return 0; } else { return ParseRGBColor(p, pp, pVal); } }