[GTK] TextTrack kind and mode attributes are enums since r166180
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 28 Apr 2014 08:06:54 +0000 (08:06 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 28 Apr 2014 08:06:54 +0000 (08:06 +0000)
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
properly support enums.

* bindings/gobject/WebKitDOMCustom.cpp:
(webkit_dom_text_track_get_kind):
(webkit_dom_text_track_get_mode):
(webkit_dom_text_track_set_mode):
* bindings/gobject/WebKitDOMCustom.h:
* bindings/gobject/WebKitDOMCustom.symbols:

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

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

index 58efae9..2d2dd8f 100644 (file)
@@ -1,5 +1,24 @@
 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
+        properly support enums.
+
+        * bindings/gobject/WebKitDOMCustom.cpp:
+        (webkit_dom_text_track_get_kind):
+        (webkit_dom_text_track_get_mode):
+        (webkit_dom_text_track_set_mode):
+        * bindings/gobject/WebKitDOMCustom.h:
+        * bindings/gobject/WebKitDOMCustom.symbols:
+
+2014-04-28  Carlos Garcia Campos  <cgarcia@igalia.com>
+
         [GTK] TextTrack::addCue can raise an exception since r163974
         https://bugs.webkit.org/show_bug.cgi?id=132227
 
index 0c40d77..d787380 100644 (file)
 #include "WebKitDOMPrivate.h"
 #include "gobject/ConvertToUTF8String.h"
 
+#if ENABLE(VIDEO)
+#include "TextTrack.h"
+#include "WebKitDOMTextTrackPrivate.h"
+#endif
+
 using namespace WebKit;
 
 gboolean webkit_dom_html_text_area_element_is_edited(WebKitDOMHTMLTextAreaElement* area)
@@ -56,4 +61,47 @@ void webkit_dom_html_media_element_set_current_time(WebKitDOMHTMLMediaElement* s
 #endif /* ENABLE(VIDEO) */
 }
 
+// WebKitDOMTextTrack:kind and WebKitDOMTextTrack:mode were converted into enums in r166180.
+// Since we don't support enums in our bindings yet, keep these implementation here as custom until
+// we add proper support for enums.
+gchar* webkit_dom_text_track_get_kind(WebKitDOMTextTrack* self)
+{
+#if ENABLE(VIDEO_TRACK)
+    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;
+#else
+    WEBKIT_WARN_FEATURE_NOT_PRESENT("Video Track")
+    return 0;
+#endif /* ENABLE(VIDEO_TRACK) */
+}
 
+gchar* webkit_dom_text_track_get_mode(WebKitDOMTextTrack* self)
+{
+#if ENABLE(VIDEO_TRACK)
+    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;
+#else
+    WEBKIT_WARN_FEATURE_NOT_PRESENT("Video Track")
+    return 0;
+#endif /* ENABLE(VIDEO_TRACK) */
+}
+
+void webkit_dom_text_track_set_mode(WebKitDOMTextTrack* self, const gchar* value)
+{
+#if ENABLE(VIDEO_TRACK)
+    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);
+#else
+    WEBKIT_WARN_FEATURE_NOT_PRESENT("Video Track")
+#endif /* ENABLE(VIDEO_TRACK) */
+}
index aed5129..1d050b4 100644 (file)
@@ -50,6 +50,33 @@ WEBKIT_API void webkit_dom_html_media_element_set_current_time(WebKitDOMHTMLMedi
  */
 WEBKIT_API gboolean webkit_dom_html_input_element_is_edited(WebKitDOMHTMLInputElement* input);
 
+/**
+ * webkit_dom_text_track_get_kind:
+ * @self: A #WebKitDOMTextTrack
+ *
+ * Returns: A #gchar
+ */
+WEBKIT_API gchar*
+webkit_dom_text_track_get_kind(WebKitDOMTextTrack* self);
+
+/**
+ * webkit_dom_text_track_get_mode:
+ * @self: A #WebKitDOMTextTrack
+ *
+ * Returns: A #gchar
+ */
+WEBKIT_API gchar*
+webkit_dom_text_track_get_mode(WebKitDOMTextTrack* self);
+
+/**
+ * webkit_dom_text_track_set_mode:
+ * @self: A #WebKitDOMTextTrack
+ * @value: A #gchar
+ *
+ */
+WEBKIT_API void
+webkit_dom_text_track_set_mode(WebKitDOMTextTrack* self, const gchar* value);
+
 G_END_DECLS
 
 #endif
index 92029b4..43a565b 100644 (file)
@@ -1,3 +1,6 @@
 gboolean webkit_dom_html_text_area_element_is_edited(WebKitDOMHTMLTextAreaElement*)
 gboolean webkit_dom_html_input_element_is_edited(WebKitDOMHTMLInputElement*)
 void webkit_dom_html_media_element_set_current_time(WebKitDOMHTMLMediaElement*, gdouble, GError**)
+void webkit_dom_text_track_set_mode(WebKitDOMTextTrack*, const gchar*)
+gchar* webkit_dom_text_track_get_mode(WebKitDOMTextTrack*)
+gchar* webkit_dom_text_track_get_kind(WebKitDOMTextTrack*)