Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(469)

Side by Side Diff: third_party/WebKit/Source/core/css/CSSPropertyIDTemplates.h

Issue 2701353002: Make explicit constant for num of CSSPropertyIDs (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef CSSPropertyIDTemplates_h 5 #ifndef CSSPropertyIDTemplates_h
6 #define CSSPropertyIDTemplates_h 6 #define CSSPropertyIDTemplates_h
7 7
8 #include "core/CSSPropertyNames.h" 8 #include "core/CSSPropertyNames.h"
9 #include "wtf/HashFunctions.h" 9 #include "wtf/HashFunctions.h"
10 #include "wtf/HashTraits.h" 10 #include "wtf/HashTraits.h"
11 11
12 namespace WTF { 12 namespace WTF {
13 template <> 13 template <>
14 struct DefaultHash<blink::CSSPropertyID> { 14 struct DefaultHash<blink::CSSPropertyID> {
15 typedef IntHash<unsigned> Hash; 15 typedef IntHash<unsigned> Hash;
16 }; 16 };
17 template <> 17 template <>
18 struct HashTraits<blink::CSSPropertyID> 18 struct HashTraits<blink::CSSPropertyID>
19 : GenericHashTraits<blink::CSSPropertyID> { 19 : GenericHashTraits<blink::CSSPropertyID> {
20 static const bool emptyValueIsZero = true; 20 static const bool emptyValueIsZero = true;
21 static void constructDeletedValue(blink::CSSPropertyID& slot, bool) { 21 static void constructDeletedValue(blink::CSSPropertyID& slot, bool) {
22 slot = 22 slot = static_cast<blink::CSSPropertyID>(blink::numCSSPropertyIDs);
23 static_cast<blink::CSSPropertyID>(blink::lastUnresolvedCSSProperty + 1);
24 } 23 }
25 static bool isDeletedValue(blink::CSSPropertyID value) { 24 static bool isDeletedValue(blink::CSSPropertyID value) {
26 return value == (blink::lastUnresolvedCSSProperty + 1); 25 return value == blink::numCSSPropertyIDs;
27 } 26 }
28 }; 27 };
29 } // namespace WTF 28 } // namespace WTF
30 29
31 #endif // CSSPropertyIDTemplates_h 30 #endif // CSSPropertyIDTemplates_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698