PassRefPtr<ShadowList> StyleBuilderConverter::convertShadow(StyleResolverState& state, CSSValue* value) { if (value->isPrimitiveValue()) { ASSERT(toCSSPrimitiveValue(value)->getValueID() == CSSValueNone); return PassRefPtr<ShadowList>(); } const CSSValueList* valueList = toCSSValueList(value); size_t shadowCount = valueList->length(); ShadowDataVector shadows; for (size_t i = 0; i < shadowCount; ++i) { const CSSShadowValue* item = toCSSShadowValue(valueList->item(i)); float x = item->x->computeLength<float>(state.cssToLengthConversionData()); float y = item->y->computeLength<float>(state.cssToLengthConversionData()); float blur = item->blur ? item->blur->computeLength<float>(state.cssToLengthConversionData()) : 0; float spread = item->spread ? item->spread->computeLength<float>(state.cssToLengthConversionData()) : 0; ShadowStyle shadowStyle = item->style && item->style->getValueID() == CSSValueInset ? Inset : Normal; Color color; if (item->color) color = convertColor(state, item->color.get()); else color = state.style()->color(); shadows.append(ShadowData(FloatPoint(x, y), blur, spread, shadowStyle, color)); } return ShadowList::adopt(shadows); }
ShadowData ShadowData::blend(const ShadowData& from, double progress, const Color& currentColor) const { ASSERT(style() == from.style()); return ShadowData(blink::blend(from.location(), location(), progress), clampTo(blink::blend(from.blur(), blur(), progress), 0.0f), blink::blend(from.spread(), spread(), progress), style(), blink::blend(from.color().resolve(currentColor), color().resolve(currentColor), progress)); }
ShadowData ShadowData::blend(const ShadowData& from, double progress) const { if (style() != from.style()) return *this; return ShadowData(WebCore::blend(from.location(), location(), progress), clampTo<int>(WebCore::blend(from.blur(), blur(), progress), 0), WebCore::blend(from.spread(), spread(), progress), style(), WebCore::blend(from.color(), color(), progress)); }