OLD | NEW |
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 FilterListPropertyFunctions_h | 5 #ifndef FilterListPropertyFunctions_h |
6 #define FilterListPropertyFunctions_h | 6 #define FilterListPropertyFunctions_h |
7 | 7 |
8 #include "core/CSSPropertyNames.h" | 8 #include "core/CSSPropertyNames.h" |
9 #include "core/style/ComputedStyle.h" | 9 #include "core/style/ComputedStyle.h" |
10 #include "wtf/Allocator.h" | 10 #include "wtf/Allocator.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 class FilterListPropertyFunctions { | 14 class FilterListPropertyFunctions { |
15 STATIC_ONLY(FilterListPropertyFunctions); | 15 STATIC_ONLY(FilterListPropertyFunctions); |
16 public: | 16 public: |
17 static const FilterOperations& getInitialFilterList(CSSPropertyID property) | 17 static const FilterOperations& getInitialFilterList(CSSPropertyID property) |
18 { | 18 { |
19 return getFilterList(property, ComputedStyle::initialStyle()); | 19 return getFilterList(property, ComputedStyle::initialStyle()); |
20 } | 20 } |
21 | 21 |
22 static const FilterOperations& getFilterList(CSSPropertyID property, const C
omputedStyle& style) | 22 static const FilterOperations& getFilterList(CSSPropertyID property, const C
omputedStyle& style) |
23 { | 23 { |
24 switch (property) { | 24 switch (property) { |
25 default: | 25 default: |
26 ASSERT_NOT_REACHED(); | 26 ASSERT_NOT_REACHED(); |
27 // Fall through. | 27 // Fall through. |
28 case CSSPropertyBackdropFilter: | 28 case CSSPropertyBackdropFilter: |
29 return style.backdropFilter(); | 29 return style.backdropFilter(); |
30 case CSSPropertyWebkitFilter: | 30 case CSSPropertyFilter: |
31 return style.filter(); | 31 return style.filter(); |
32 } | 32 } |
33 } | 33 } |
34 | 34 |
35 static void setFilterList(CSSPropertyID property, ComputedStyle& style, cons
t FilterOperations& filterOperations) | 35 static void setFilterList(CSSPropertyID property, ComputedStyle& style, cons
t FilterOperations& filterOperations) |
36 { | 36 { |
37 switch (property) { | 37 switch (property) { |
38 case CSSPropertyBackdropFilter: | 38 case CSSPropertyBackdropFilter: |
39 style.setBackdropFilter(filterOperations); | 39 style.setBackdropFilter(filterOperations); |
40 break; | 40 break; |
41 case CSSPropertyWebkitFilter: | 41 case CSSPropertyFilter: |
42 style.setFilter(filterOperations); | 42 style.setFilter(filterOperations); |
43 break; | 43 break; |
44 default: | 44 default: |
45 ASSERT_NOT_REACHED(); | 45 ASSERT_NOT_REACHED(); |
46 break; | 46 break; |
47 } | 47 } |
48 } | 48 } |
49 }; | 49 }; |
50 | 50 |
51 } // namespace blink | 51 } // namespace blink |
52 | 52 |
53 #endif // FilterListPropertyFunctions_h | 53 #endif // FilterListPropertyFunctions_h |
OLD | NEW |