Chromium Code Reviews| Index: third_party/WebKit/Source/core/dom/CompositorProxy.cpp |
| diff --git a/third_party/WebKit/Source/core/dom/CompositorProxy.cpp b/third_party/WebKit/Source/core/dom/CompositorProxy.cpp |
| index c50fe8c6611bfd1203e576cec51eaeb3f79c77d5..f45d7ccd873781ab03c0e2647bde0a0d21b72021 100644 |
| --- a/third_party/WebKit/Source/core/dom/CompositorProxy.cpp |
| +++ b/third_party/WebKit/Source/core/dom/CompositorProxy.cpp |
| @@ -17,39 +17,23 @@ |
| namespace blink { |
| -struct MutablePropertyMapping { |
| +static const struct { |
| const char* name; |
| - unsigned length; |
| WebCompositorMutableProperty property; |
| +} allowedProperties[] = { |
| + { "opacity", WebCompositorMutablePropertyOpacity }, |
| + { "scrollleft", WebCompositorMutablePropertyScrollLeft }, |
| + { "scrolltop", WebCompositorMutablePropertyScrollTop }, |
| + { "transform", WebCompositorMutablePropertyTransform }, |
| }; |
| -// Warning: In order for std::lower_bound to work, the following must be in |
| -// alphabetical order. |
| -static MutablePropertyMapping allowedProperties[] = { |
| - { "opacity", 7, WebCompositorMutablePropertyOpacity }, |
| - { "scrollleft", 10, WebCompositorMutablePropertyScrollLeft }, |
| - { "scrolltop", 9, WebCompositorMutablePropertyScrollTop }, |
| - { "transform", 9, WebCompositorMutablePropertyTransform }, |
| -}; |
| - |
| -static bool comparePropertyName(const MutablePropertyMapping& mapping, StringImpl* propertyLower) |
| -{ |
| - ASSERT(propertyLower->is8Bit()); |
| - return memcmp(mapping.name, propertyLower->characters8(), std::min(mapping.length, propertyLower->length())) < 0; |
| -} |
| - |
| static WebCompositorMutableProperty compositorMutablePropertyForName(const String& attributeName) |
| { |
| - WebCompositorMutableProperty property = WebCompositorMutablePropertyNone; |
| - const String attributeLower = attributeName.lower(); |
|
esprehn
2015/12/30 18:31:30
The only bug here is that this doesn't do .utf8().
|
| - const MutablePropertyMapping* start = allowedProperties; |
| - const MutablePropertyMapping* end = allowedProperties + WTF_ARRAY_LENGTH(allowedProperties); |
| - if (attributeLower.impl()->is8Bit()) { |
| - const MutablePropertyMapping* match = std::lower_bound(start, end, attributeLower.impl(), comparePropertyName); |
| - if (match != end && equal(match->name, attributeLower.impl())) |
| - property = match->property; |
| + for (const auto& mapping : allowedProperties) { |
| + if (equalIgnoringCase(mapping.name, attributeName)) |
| + return mapping.property; |
| } |
| - return property; |
| + return WebCompositorMutablePropertyNone; |
| } |
| static bool isControlThread() |