InterpolationValue CSSColorInterpolationType::convertStyleColorPair(const StyleColor& unvisitedColor, const StyleColor& visitedColor) const { std::unique_ptr<InterpolableList> colorPair = InterpolableList::create(InterpolableColorPairIndexCount); colorPair->set(Unvisited, createInterpolableColor(unvisitedColor)); colorPair->set(Visited, createInterpolableColor(visitedColor)); return InterpolationValue(std::move(colorPair)); }
PassOwnPtr<InterpolationValue> CSSColorInterpolationType::convertStyleColorPair(const StyleColor& unvisitedColor, const StyleColor& visitedColor) const { OwnPtr<InterpolableList> colorPair = InterpolableList::create(InterpolableColorPairIndexCount); colorPair->set(Unvisited, createInterpolableColor(unvisitedColor)); colorPair->set(Visited, createInterpolableColor(visitedColor)); return InterpolationValue::create(*this, colorPair.release()); }
std::unique_ptr<InterpolableValue> CSSColorInterpolationType::maybeCreateInterpolableColor(const CSSValue& value) { if (value.isColorValue()) return createInterpolableColor(toCSSColorValue(value).value()); if (!value.isPrimitiveValue()) return nullptr; const CSSPrimitiveValue& primitive = toCSSPrimitiveValue(value); if (!primitive.isValueID()) return nullptr; if (!StyleColor::isColorKeyword(primitive.getValueID())) return nullptr; return createInterpolableColor(primitive.getValueID()); }
std::unique_ptr<InterpolableValue> CSSColorInterpolationType::createInterpolableColor(CSSValueID keyword) { switch (keyword) { case CSSValueCurrentcolor: return createInterpolableColorForIndex(Currentcolor); case CSSValueWebkitActivelink: return createInterpolableColorForIndex(WebkitActivelink); case CSSValueWebkitLink: return createInterpolableColorForIndex(WebkitLink); case CSSValueInternalQuirkInherit: return createInterpolableColorForIndex(QuirkInherit); case CSSValueWebkitFocusRingColor: return createInterpolableColor(LayoutTheme::theme().focusRingColor()); default: DCHECK(StyleColor::isColorKeyword(keyword)); return createInterpolableColor(StyleColor::colorFromKeyword(keyword)); } }
PassOwnPtr<InterpolableValue> CSSColorInterpolationType::createInterpolableColor(CSSValueID keyword) { switch (keyword) { case CSSValueCurrentcolor: return createInterpolableColorForIndex(Currentcolor); case CSSValueWebkitActivelink: return createInterpolableColorForIndex(WebkitActivelink); case CSSValueWebkitLink: return createInterpolableColorForIndex(WebkitLink); case CSSValueWebkitText: return createInterpolableColorForIndex(WebkitText); case CSSValueWebkitFocusRingColor: return createInterpolableColor(LayoutTheme::theme().focusRingColor()); default: ASSERT(CSSPropertyParser::isColorKeyword(keyword)); return createInterpolableColor(StyleColor::colorFromKeyword(keyword)); } }
std::unique_ptr<InterpolableValue> CSSColorInterpolationType::createInterpolableColor(const StyleColor& color) { if (color.isCurrentColor()) return createInterpolableColorForIndex(Currentcolor); return createInterpolableColor(color.getColor()); }