Esempio n. 1
0
Color TextLinkColors::colorFromPrimitiveValue(const CSSPrimitiveValue* value, Color currentColor, bool forVisitedLink) const
{
    if (value->isRGBColor())
        return Color(value->getRGBA32Value());

    CSSValueID valueID = value->getValueID();
    switch (valueID) {
    case 0:
        return Color();
    case CSSValueWebkitText:
        return textColor();
    case CSSValueWebkitLink:
        return forVisitedLink ? visitedLinkColor() : linkColor();
    case CSSValueWebkitActivelink:
        return activeLinkColor();
    case CSSValueWebkitFocusRingColor:
        return RenderTheme::focusRingColor();
    case CSSValueCurrentcolor:
        return currentColor;
    default:
        return colorForCSSValue(valueID);
    }
}
Color TextLinkColors::colorFromCSSValue(const CSSValue& value, Color currentColor, bool forVisitedLink) const
{
    if (value.isColorValue())
        return toCSSColorValue(value).value();

    CSSValueID valueID = toCSSPrimitiveValue(value).getValueID();
    switch (valueID) {
    case 0:
        return Color();
    case CSSValueWebkitText:
        return textColor();
    case CSSValueWebkitLink:
        return forVisitedLink ? visitedLinkColor() : linkColor();
    case CSSValueWebkitActivelink:
        return activeLinkColor();
    case CSSValueWebkitFocusRingColor:
        return LayoutTheme::theme().focusRingColor();
    case CSSValueInvert: // We don't support outline-color: invert
    case CSSValueCurrentcolor:
        return currentColor;
    default:
        return StyleColor::colorFromKeyword(valueID);
    }
}