std::bitset<>::test() does unnecessary bounds checks on CSSPropertyID bitsets
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 28 Apr 2014 08:16:15 +0000 (08:16 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 28 Apr 2014 08:16:15 +0000 (08:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=131685

Patch by Zan Dobersek <zdobersek@igalia.com> on 2014-04-28
Reviewed by Darin Adler.

Use std::bitset<>::operator[]() instead of std::bitset<>::test() to avoid
bounds checks which are not necessary as long as a CSSPropertyID value is used.

* css/CSSParser.cpp:
(WebCore::filterProperties):
* css/StyleProperties.cpp:
(WebCore::StyleProperties::asText):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::CascadedProperties::hasProperty):
(WebCore::StyleResolver::CascadedProperties::set):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@167878 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/bindings/gobject/WebKitDOMCustom.cpp

index 58efc35..7e8e12c 100644 (file)
 
         Reviewed by Martin Robinson.
 
+        Improve coding style according to review comments, that I forgot
+        to do before landing previous commit.
+
+        * bindings/gobject/WebKitDOMCustom.cpp:
+        (webkit_dom_text_track_get_kind):
+        (webkit_dom_text_track_get_mode):
+        (webkit_dom_text_track_set_mode):
+
+2014-04-28  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [GTK] TextTrack kind and mode attributes are enums since r166180
+        https://bugs.webkit.org/show_bug.cgi?id=132228
+
+        Reviewed by Martin Robinson.
+
         We don't support enum values yet in GObject DOM bindings, but they
         are internally strings anyway, so we can keep the old
         implementations using strings as custom functions until we
index d787380..72625c6 100644 (file)
@@ -70,8 +70,7 @@ gchar* webkit_dom_text_track_get_kind(WebKitDOMTextTrack* self)
     WebCore::JSMainThreadNullState state;
     g_return_val_if_fail(WEBKIT_DOM_IS_TEXT_TRACK(self), 0);
     WebCore::TextTrack* item = WebKit::core(self);
-    gchar* result = convertToUTF8String(item->kind());
-    return result;
+    return convertToUTF8String(item->kind());
 #else
     WEBKIT_WARN_FEATURE_NOT_PRESENT("Video Track")
     return 0;
@@ -84,8 +83,7 @@ gchar* webkit_dom_text_track_get_mode(WebKitDOMTextTrack* self)
     WebCore::JSMainThreadNullState state;
     g_return_val_if_fail(WEBKIT_DOM_IS_TEXT_TRACK(self), 0);
     WebCore::TextTrack* item = WebKit::core(self);
-    gchar* result = convertToUTF8String(item->mode());
-    return result;
+    return convertToUTF8String(item->mode());
 #else
     WEBKIT_WARN_FEATURE_NOT_PRESENT("Video Track")
     return 0;
@@ -98,9 +96,7 @@ void webkit_dom_text_track_set_mode(WebKitDOMTextTrack* self, const gchar* value
     WebCore::JSMainThreadNullState state;
     g_return_if_fail(WEBKIT_DOM_IS_TEXT_TRACK(self));
     g_return_if_fail(value);
-    WebCore::TextTrack* item = WebKit::core(self);
-    WTF::String convertedValue = WTF::String::fromUTF8(value);
-    item->setMode(convertedValue);
+    WebKit::core(self)->setMode(WTF::String::fromUTF8(value));
 #else
     WEBKIT_WARN_FEATURE_NOT_PRESENT("Video Track")
 #endif /* ENABLE(VIDEO_TRACK) */