Commit 33093f1d authored by Xiaocheng Hu's avatar Xiaocheng Hu Committed by Commit Bot

Use AtomicString for @keyframes rule names

StyleRuleKeyframes internally stores its name with an AtomicString but
returns it as a String, while there are some other code using StringImpl
for a keyframes name, which causes some confusion.

So this patch unifies all such code to use AtomicString.

Change-Id: Ic7eeff262bcb2ff1c055c9a36ce43ff03ccee1cd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2500954
Auto-Submit: Xiaocheng Hu <xiaochengh@chromium.org>
Reviewed-by: default avatarAnders Hartvoll Ruud <andruud@chromium.org>
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821325}
parent 35642255
......@@ -52,7 +52,7 @@ class StyleRuleKeyframes final : public StyleRuleBase {
void WrapperAppendKeyframe(StyleRuleKeyframe*);
void WrapperRemoveKeyframe(unsigned);
String GetName() const { return name_; }
AtomicString GetName() const { return name_; }
void SetName(const String& name) { name_ = AtomicString(name); }
bool IsVendorPrefixed() const { return is_prefixed_; }
......
......@@ -143,7 +143,7 @@ void ScopedStyleResolver::ResetAuthorStyle() {
}
StyleRuleKeyframes* ScopedStyleResolver::KeyframeStylesForAnimation(
const StringImpl* animation_name) {
const AtomicString& animation_name) {
if (keyframes_rule_map_.IsEmpty())
return nullptr;
......@@ -155,16 +155,16 @@ StyleRuleKeyframes* ScopedStyleResolver::KeyframeStylesForAnimation(
}
void ScopedStyleResolver::AddKeyframeStyle(StyleRuleKeyframes* rule) {
AtomicString s(rule->GetName());
AtomicString name = rule->GetName();
if (rule->IsVendorPrefixed()) {
KeyframesRuleMap::iterator it = keyframes_rule_map_.find(s.Impl());
KeyframesRuleMap::iterator it = keyframes_rule_map_.find(name);
if (it == keyframes_rule_map_.end())
keyframes_rule_map_.Set(s.Impl(), rule);
keyframes_rule_map_.Set(name, rule);
else if (it->value->IsVendorPrefixed())
keyframes_rule_map_.Set(s.Impl(), rule);
keyframes_rule_map_.Set(name, rule);
} else {
keyframes_rule_map_.Set(s.Impl(), rule);
keyframes_rule_map_.Set(name, rule);
}
}
......
......@@ -57,7 +57,7 @@ class CORE_EXPORT ScopedStyleResolver final
ScopedStyleResolver* Parent() const;
StyleRuleKeyframes* KeyframeStylesForAnimation(
const StringImpl* animation_name);
const AtomicString& animation_name);
void AppendActiveStyleSheets(unsigned index, const ActiveStyleSheetVector&);
void CollectMatchingAuthorRules(ElementRuleCollector&,
......@@ -107,7 +107,7 @@ class CORE_EXPORT ScopedStyleResolver final
MediaQueryResultList device_dependent_media_query_results_;
using KeyframesRuleMap =
HeapHashMap<const StringImpl*, Member<StyleRuleKeyframes>>;
HeapHashMap<AtomicString, Member<StyleRuleKeyframes>>;
KeyframesRuleMap keyframes_rule_map_;
class RuleSubSet final : public GarbageCollected<RuleSubSet> {
......
......@@ -1459,7 +1459,7 @@ StyleRuleKeyframes* StyleResolver::FindKeyframesRule(
for (auto& resolver : resolvers) {
if (StyleRuleKeyframes* keyframes_rule =
resolver->KeyframeStylesForAnimation(animation_name.Impl()))
resolver->KeyframeStylesForAnimation(animation_name))
return keyframes_rule;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment