OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/animation/PropertyHandle.h" | 5 #include "core/animation/PropertyHandle.h" |
6 | 6 |
| 7 #include "wtf/text/AtomicStringHash.h" |
| 8 |
7 namespace blink { | 9 namespace blink { |
8 | 10 |
9 bool PropertyHandle::operator==(const PropertyHandle& other) const { | 11 bool PropertyHandle::operator==(const PropertyHandle& other) const { |
10 if (m_handleType != other.m_handleType) | 12 if (m_handleType != other.m_handleType) |
11 return false; | 13 return false; |
12 | 14 |
13 switch (m_handleType) { | 15 switch (m_handleType) { |
14 case HandleCSSProperty: | 16 case HandleCSSProperty: |
15 case HandlePresentationAttribute: | 17 case HandlePresentationAttribute: |
16 return m_cssProperty == other.m_cssProperty; | 18 return m_cssProperty == other.m_cssProperty; |
17 case HandleCSSCustomProperty: | 19 case HandleCSSCustomProperty: |
18 return m_propertyName == other.m_propertyName; | 20 return m_propertyName == other.m_propertyName; |
19 case HandleSVGAttribute: | 21 case HandleSVGAttribute: |
20 return m_svgAttribute == other.m_svgAttribute; | 22 return m_svgAttribute == other.m_svgAttribute; |
21 default: | 23 default: |
22 return true; | 24 return true; |
23 } | 25 } |
24 } | 26 } |
25 | 27 |
26 unsigned PropertyHandle::hash() const { | 28 unsigned PropertyHandle::hash() const { |
27 switch (m_handleType) { | 29 switch (m_handleType) { |
28 case HandleCSSProperty: | 30 case HandleCSSProperty: |
29 return m_cssProperty; | 31 return m_cssProperty; |
30 case HandleCSSCustomProperty: | 32 case HandleCSSCustomProperty: |
31 return m_propertyName->existingHash(); | 33 return AtomicStringHash::hash(m_propertyName); |
32 case HandlePresentationAttribute: | 34 case HandlePresentationAttribute: |
33 return -m_cssProperty; | 35 return -m_cssProperty; |
34 case HandleSVGAttribute: | 36 case HandleSVGAttribute: |
35 return QualifiedNameHash::hash(*m_svgAttribute); | 37 return QualifiedNameHash::hash(*m_svgAttribute); |
36 default: | 38 default: |
37 NOTREACHED(); | 39 NOTREACHED(); |
38 return 0; | 40 return 0; |
39 } | 41 } |
40 } | 42 } |
41 | 43 |
42 } // namespace blink | 44 } // namespace blink |
OLD | NEW |