String InspectorAnimationAgent::createCSSId(blink::Animation& animation) { String type = m_idToAnimationType.get(String::number(animation.sequenceNumber())); ASSERT(type != AnimationType::WebAnimation); KeyframeEffect* effect = toKeyframeEffect(animation.effect()); Vector<CSSPropertyID> cssProperties; if (type == AnimationType::CSSAnimation) { for (CSSPropertyID property : animationProperties) cssProperties.append(property); } else { for (CSSPropertyID property : transitionProperties) cssProperties.append(property); cssProperties.append(cssPropertyID(animation.id())); } Element* element = effect->target(); HeapVector<Member<CSSStyleDeclaration>> styles = m_cssAgent->matchingStyles(element); std::unique_ptr<WebCryptoDigestor> digestor = createDigestor(HashAlgorithmSha1); addStringToDigestor(digestor.get(), type); addStringToDigestor(digestor.get(), animation.id()); for (CSSPropertyID property : cssProperties) { CSSStyleDeclaration* style = m_cssAgent->findEffectiveDeclaration(property, styles); // Ignore inline styles. if (!style || !style->parentStyleSheet() || !style->parentRule() || style->parentRule()->type() != CSSRule::kStyleRule) continue; addStringToDigestor(digestor.get(), getPropertyNameString(property)); addStringToDigestor(digestor.get(), m_cssAgent->styleSheetId(style->parentStyleSheet())); addStringToDigestor(digestor.get(), toCSSStyleRule(style->parentRule())->selectorText()); } DigestValue digestResult; finishDigestor(digestor.get(), digestResult); return base64Encode(reinterpret_cast<const char*>(digestResult.data()), 10); }