blob: d952f71d9ead62b2d00cda48051366251e227c02 [file] [log] [blame]
/*
* This file is part of the WebKit open source project.
* This file has been generated by generate-bindings.pl. DO NOT MODIFY!
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "config.h"
#include "WebKitDOMVTTCue.h"
#include <WebCore/CSSImportRule.h>
#include "DOMObjectCache.h"
#include <WebCore/Document.h>
#include <WebCore/ExceptionCode.h>
#include <WebCore/ExceptionCodeDescription.h>
#include "GObjectEventListener.h"
#include <WebCore/JSMainThreadExecState.h>
#include "WebKitDOMDocumentFragmentPrivate.h"
#include "WebKitDOMEventPrivate.h"
#include "WebKitDOMEventTarget.h"
#include "WebKitDOMPrivate.h"
#include "WebKitDOMTextTrackCuePrivate.h"
#include "WebKitDOMVTTCuePrivate.h"
#include "ConvertToUTF8String.h"
#include <wtf/GetPtr.h>
#include <wtf/RefPtr.h>
#if ENABLE(VIDEO_TRACK)
namespace WebKit {
WebKitDOMVTTCue* kit(WebCore::VTTCue* obj)
{
return WEBKIT_DOM_VTT_CUE(kit(static_cast<WebCore::TextTrackCue*>(obj)));
}
WebCore::VTTCue* core(WebKitDOMVTTCue* request)
{
return request ? static_cast<WebCore::VTTCue*>(WEBKIT_DOM_OBJECT(request)->coreObject) : 0;
}
WebKitDOMVTTCue* wrapVTTCue(WebCore::VTTCue* coreObject)
{
ASSERT(coreObject);
return WEBKIT_DOM_VTT_CUE(g_object_new(WEBKIT_DOM_TYPE_VTT_CUE, "core-object", coreObject, nullptr));
}
} // namespace WebKit
#endif // ENABLE(VIDEO_TRACK)
static gboolean webkit_dom_vtt_cue_dispatch_event(WebKitDOMEventTarget* target, WebKitDOMEvent* event, GError** error)
{
#if ENABLE(VIDEO_TRACK)
WebCore::Event* coreEvent = WebKit::core(event);
if (!coreEvent)
return false;
WebCore::VTTCue* coreTarget = static_cast<WebCore::VTTCue*>(WEBKIT_DOM_OBJECT(target)->coreObject);
WebCore::ExceptionCode ec = 0;
gboolean result = coreTarget->dispatchEventForBindings(*coreEvent, ec);
if (ec) {
WebCore::ExceptionCodeDescription description(ec);
g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), description.code, description.name);
}
return result;
#else
UNUSED_PARAM(target);
UNUSED_PARAM(event);
UNUSED_PARAM(error);
WEBKIT_WARN_FEATURE_NOT_PRESENT("Video Track")
return false;
#endif // ENABLE(VIDEO_TRACK)
}
static gboolean webkit_dom_vtt_cue_add_event_listener(WebKitDOMEventTarget* target, const char* eventName, GClosure* handler, gboolean useCapture)
{
#if ENABLE(VIDEO_TRACK)
WebCore::VTTCue* coreTarget = static_cast<WebCore::VTTCue*>(WEBKIT_DOM_OBJECT(target)->coreObject);
return WebKit::GObjectEventListener::addEventListener(G_OBJECT(target), coreTarget, eventName, handler, useCapture);
#else
UNUSED_PARAM(target);
UNUSED_PARAM(eventName);
UNUSED_PARAM(handler);
UNUSED_PARAM(useCapture);
WEBKIT_WARN_FEATURE_NOT_PRESENT("Video Track")
return false;
#endif // ENABLE(VIDEO_TRACK)
}
static gboolean webkit_dom_vtt_cue_remove_event_listener(WebKitDOMEventTarget* target, const char* eventName, GClosure* handler, gboolean useCapture)
{
#if ENABLE(VIDEO_TRACK)
WebCore::VTTCue* coreTarget = static_cast<WebCore::VTTCue*>(WEBKIT_DOM_OBJECT(target)->coreObject);
return WebKit::GObjectEventListener::removeEventListener(G_OBJECT(target), coreTarget, eventName, handler, useCapture);
#else
UNUSED_PARAM(target);
UNUSED_PARAM(eventName);
UNUSED_PARAM(handler);
UNUSED_PARAM(useCapture);
WEBKIT_WARN_FEATURE_NOT_PRESENT("Video Track")
return false;
#endif // ENABLE(VIDEO_TRACK)
}
static void webkit_dom_event_target_init(WebKitDOMEventTargetIface* iface)
{
iface->dispatch_event = webkit_dom_vtt_cue_dispatch_event;
iface->add_event_listener = webkit_dom_vtt_cue_add_event_listener;
iface->remove_event_listener = webkit_dom_vtt_cue_remove_event_listener;
}
G_DEFINE_TYPE_WITH_CODE(WebKitDOMVTTCue, webkit_dom_vtt_cue, WEBKIT_DOM_TYPE_TEXT_TRACK_CUE, G_IMPLEMENT_INTERFACE(WEBKIT_DOM_TYPE_EVENT_TARGET, webkit_dom_event_target_init))
enum {
PROP_0,
PROP_VERTICAL,
PROP_SNAP_TO_LINES,
PROP_LINE,
PROP_POSITION,
PROP_SIZE,
PROP_ALIGN,
PROP_TEXT,
PROP_REGION_ID,
};
static void webkit_dom_vtt_cue_set_property(GObject* object, guint propertyId, const GValue* value, GParamSpec* pspec)
{
WebKitDOMVTTCue* self = WEBKIT_DOM_VTT_CUE(object);
switch (propertyId) {
case PROP_VERTICAL:
webkit_dom_vtt_cue_set_vertical(self, g_value_get_string(value), nullptr);
break;
case PROP_SNAP_TO_LINES:
webkit_dom_vtt_cue_set_snap_to_lines(self, g_value_get_boolean(value));
break;
case PROP_LINE:
webkit_dom_vtt_cue_set_line(self, g_value_get_double(value), nullptr);
break;
case PROP_POSITION:
webkit_dom_vtt_cue_set_position(self, g_value_get_double(value), nullptr);
break;
case PROP_SIZE:
webkit_dom_vtt_cue_set_size(self, g_value_get_double(value), nullptr);
break;
case PROP_ALIGN:
webkit_dom_vtt_cue_set_align(self, g_value_get_string(value), nullptr);
break;
case PROP_TEXT:
webkit_dom_vtt_cue_set_text(self, g_value_get_string(value));
break;
case PROP_REGION_ID:
webkit_dom_vtt_cue_set_region_id(self, g_value_get_string(value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyId, pspec);
break;
}
}
static void webkit_dom_vtt_cue_get_property(GObject* object, guint propertyId, GValue* value, GParamSpec* pspec)
{
WebKitDOMVTTCue* self = WEBKIT_DOM_VTT_CUE(object);
switch (propertyId) {
case PROP_VERTICAL:
g_value_take_string(value, webkit_dom_vtt_cue_get_vertical(self));
break;
case PROP_SNAP_TO_LINES:
g_value_set_boolean(value, webkit_dom_vtt_cue_get_snap_to_lines(self));
break;
case PROP_LINE:
g_value_set_double(value, webkit_dom_vtt_cue_get_line(self));
break;
case PROP_POSITION:
g_value_set_double(value, webkit_dom_vtt_cue_get_position(self));
break;
case PROP_SIZE:
g_value_set_double(value, webkit_dom_vtt_cue_get_size(self));
break;
case PROP_ALIGN:
g_value_take_string(value, webkit_dom_vtt_cue_get_align(self));
break;
case PROP_TEXT:
g_value_take_string(value, webkit_dom_vtt_cue_get_text(self));
break;
case PROP_REGION_ID:
g_value_take_string(value, webkit_dom_vtt_cue_get_region_id(self));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyId, pspec);
break;
}
}
static void webkit_dom_vtt_cue_class_init(WebKitDOMVTTCueClass* requestClass)
{
GObjectClass* gobjectClass = G_OBJECT_CLASS(requestClass);
gobjectClass->set_property = webkit_dom_vtt_cue_set_property;
gobjectClass->get_property = webkit_dom_vtt_cue_get_property;
g_object_class_install_property(
gobjectClass,
PROP_VERTICAL,
g_param_spec_string(
"vertical",
"VTTCue:vertical",
"read-write gchar* VTTCue:vertical",
"",
WEBKIT_PARAM_READWRITE));
g_object_class_install_property(
gobjectClass,
PROP_SNAP_TO_LINES,
g_param_spec_boolean(
"snap-to-lines",
"VTTCue:snap-to-lines",
"read-write gboolean VTTCue:snap-to-lines",
FALSE,
WEBKIT_PARAM_READWRITE));
g_object_class_install_property(
gobjectClass,
PROP_LINE,
g_param_spec_double(
"line",
"VTTCue:line",
"read-write gdouble VTTCue:line",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
WEBKIT_PARAM_READWRITE));
g_object_class_install_property(
gobjectClass,
PROP_POSITION,
g_param_spec_double(
"position",
"VTTCue:position",
"read-write gdouble VTTCue:position",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
WEBKIT_PARAM_READWRITE));
g_object_class_install_property(
gobjectClass,
PROP_SIZE,
g_param_spec_double(
"size",
"VTTCue:size",
"read-write gdouble VTTCue:size",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
WEBKIT_PARAM_READWRITE));
g_object_class_install_property(
gobjectClass,
PROP_ALIGN,
g_param_spec_string(
"align",
"VTTCue:align",
"read-write gchar* VTTCue:align",
"",
WEBKIT_PARAM_READWRITE));
g_object_class_install_property(
gobjectClass,
PROP_TEXT,
g_param_spec_string(
"text",
"VTTCue:text",
"read-write gchar* VTTCue:text",
"",
WEBKIT_PARAM_READWRITE));
g_object_class_install_property(
gobjectClass,
PROP_REGION_ID,
g_param_spec_string(
"region-id",
"VTTCue:region-id",
"read-write gchar* VTTCue:region-id",
"",
WEBKIT_PARAM_READWRITE));
}
static void webkit_dom_vtt_cue_init(WebKitDOMVTTCue* request)
{
UNUSED_PARAM(request);
}
WebKitDOMDocumentFragment* webkit_dom_vtt_cue_get_cue_as_html(WebKitDOMVTTCue* self)
{
#if ENABLE(VIDEO_TRACK)
WebCore::JSMainThreadNullState state;
g_return_val_if_fail(WEBKIT_DOM_IS_VTT_CUE(self), 0);
WebCore::VTTCue* item = WebKit::core(self);
RefPtr<WebCore::DocumentFragment> gobjectResult = WTF::getPtr(item->getCueAsHTML());
return WebKit::kit(gobjectResult.get());
#else
UNUSED_PARAM(self);
WEBKIT_WARN_FEATURE_NOT_PRESENT("Video Track")
return 0;
#endif /* ENABLE(VIDEO_TRACK) */
}
gchar* webkit_dom_vtt_cue_get_vertical(WebKitDOMVTTCue* self)
{
#if ENABLE(VIDEO_TRACK)
WebCore::JSMainThreadNullState state;
g_return_val_if_fail(WEBKIT_DOM_IS_VTT_CUE(self), 0);
WebCore::VTTCue* item = WebKit::core(self);
gchar* result = convertToUTF8String(item->vertical());
return result;
#else
UNUSED_PARAM(self);
WEBKIT_WARN_FEATURE_NOT_PRESENT("Video Track")
return 0;
#endif /* ENABLE(VIDEO_TRACK) */
}
void webkit_dom_vtt_cue_set_vertical(WebKitDOMVTTCue* self, const gchar* value, GError** error)
{
#if ENABLE(VIDEO_TRACK)
WebCore::JSMainThreadNullState state;
g_return_if_fail(WEBKIT_DOM_IS_VTT_CUE(self));
g_return_if_fail(value);
g_return_if_fail(!error || !*error);
WebCore::VTTCue* item = WebKit::core(self);
WTF::String convertedValue = WTF::String::fromUTF8(value);
WebCore::ExceptionCode ec = 0;
item->setVertical(convertedValue, ec);
if (ec) {
WebCore::ExceptionCodeDescription ecdesc(ec);
g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name);
}
#else
UNUSED_PARAM(self);
UNUSED_PARAM(value);
UNUSED_PARAM(error);
WEBKIT_WARN_FEATURE_NOT_PRESENT("Video Track")
#endif /* ENABLE(VIDEO_TRACK) */
}
gboolean webkit_dom_vtt_cue_get_snap_to_lines(WebKitDOMVTTCue* self)
{
#if ENABLE(VIDEO_TRACK)
WebCore::JSMainThreadNullState state;
g_return_val_if_fail(WEBKIT_DOM_IS_VTT_CUE(self), FALSE);
WebCore::VTTCue* item = WebKit::core(self);
gboolean result = item->snapToLines();
return result;
#else
UNUSED_PARAM(self);
WEBKIT_WARN_FEATURE_NOT_PRESENT("Video Track")
return static_cast<gboolean>(0);
#endif /* ENABLE(VIDEO_TRACK) */
}
void webkit_dom_vtt_cue_set_snap_to_lines(WebKitDOMVTTCue* self, gboolean value)
{
#if ENABLE(VIDEO_TRACK)
WebCore::JSMainThreadNullState state;
g_return_if_fail(WEBKIT_DOM_IS_VTT_CUE(self));
WebCore::VTTCue* item = WebKit::core(self);
item->setSnapToLines(value);
#else
UNUSED_PARAM(self);
UNUSED_PARAM(value);
WEBKIT_WARN_FEATURE_NOT_PRESENT("Video Track")
#endif /* ENABLE(VIDEO_TRACK) */
}
gdouble webkit_dom_vtt_cue_get_line(WebKitDOMVTTCue* self)
{
#if ENABLE(VIDEO_TRACK)
WebCore::JSMainThreadNullState state;
g_return_val_if_fail(WEBKIT_DOM_IS_VTT_CUE(self), 0);
WebCore::VTTCue* item = WebKit::core(self);
gdouble result = item->line();
return result;
#else
UNUSED_PARAM(self);
WEBKIT_WARN_FEATURE_NOT_PRESENT("Video Track")
return static_cast<gdouble>(0);
#endif /* ENABLE(VIDEO_TRACK) */
}
void webkit_dom_vtt_cue_set_line(WebKitDOMVTTCue* self, gdouble value, GError** error)
{
#if ENABLE(VIDEO_TRACK)
WebCore::JSMainThreadNullState state;
g_return_if_fail(WEBKIT_DOM_IS_VTT_CUE(self));
g_return_if_fail(!error || !*error);
WebCore::VTTCue* item = WebKit::core(self);
WebCore::ExceptionCode ec = 0;
item->setLine(value, ec);
if (ec) {
WebCore::ExceptionCodeDescription ecdesc(ec);
g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name);
}
#else
UNUSED_PARAM(self);
UNUSED_PARAM(value);
UNUSED_PARAM(error);
WEBKIT_WARN_FEATURE_NOT_PRESENT("Video Track")
#endif /* ENABLE(VIDEO_TRACK) */
}
gdouble webkit_dom_vtt_cue_get_position(WebKitDOMVTTCue* self)
{
#if ENABLE(VIDEO_TRACK)
WebCore::JSMainThreadNullState state;
g_return_val_if_fail(WEBKIT_DOM_IS_VTT_CUE(self), 0);
WebCore::VTTCue* item = WebKit::core(self);
gdouble result = item->position();
return result;
#else
UNUSED_PARAM(self);
WEBKIT_WARN_FEATURE_NOT_PRESENT("Video Track")
return static_cast<gdouble>(0);
#endif /* ENABLE(VIDEO_TRACK) */
}
void webkit_dom_vtt_cue_set_position(WebKitDOMVTTCue* self, gdouble value, GError** error)
{
#if ENABLE(VIDEO_TRACK)
WebCore::JSMainThreadNullState state;
g_return_if_fail(WEBKIT_DOM_IS_VTT_CUE(self));
g_return_if_fail(!error || !*error);
WebCore::VTTCue* item = WebKit::core(self);
WebCore::ExceptionCode ec = 0;
item->setPosition(value, ec);
if (ec) {
WebCore::ExceptionCodeDescription ecdesc(ec);
g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name);
}
#else
UNUSED_PARAM(self);
UNUSED_PARAM(value);
UNUSED_PARAM(error);
WEBKIT_WARN_FEATURE_NOT_PRESENT("Video Track")
#endif /* ENABLE(VIDEO_TRACK) */
}
gdouble webkit_dom_vtt_cue_get_size(WebKitDOMVTTCue* self)
{
#if ENABLE(VIDEO_TRACK)
WebCore::JSMainThreadNullState state;
g_return_val_if_fail(WEBKIT_DOM_IS_VTT_CUE(self), 0);
WebCore::VTTCue* item = WebKit::core(self);
gdouble result = item->size();
return result;
#else
UNUSED_PARAM(self);
WEBKIT_WARN_FEATURE_NOT_PRESENT("Video Track")
return static_cast<gdouble>(0);
#endif /* ENABLE(VIDEO_TRACK) */
}
void webkit_dom_vtt_cue_set_size(WebKitDOMVTTCue* self, gdouble value, GError** error)
{
#if ENABLE(VIDEO_TRACK)
WebCore::JSMainThreadNullState state;
g_return_if_fail(WEBKIT_DOM_IS_VTT_CUE(self));
g_return_if_fail(!error || !*error);
WebCore::VTTCue* item = WebKit::core(self);
WebCore::ExceptionCode ec = 0;
item->setSize(value, ec);
if (ec) {
WebCore::ExceptionCodeDescription ecdesc(ec);
g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name);
}
#else
UNUSED_PARAM(self);
UNUSED_PARAM(value);
UNUSED_PARAM(error);
WEBKIT_WARN_FEATURE_NOT_PRESENT("Video Track")
#endif /* ENABLE(VIDEO_TRACK) */
}
gchar* webkit_dom_vtt_cue_get_align(WebKitDOMVTTCue* self)
{
#if ENABLE(VIDEO_TRACK)
WebCore::JSMainThreadNullState state;
g_return_val_if_fail(WEBKIT_DOM_IS_VTT_CUE(self), 0);
WebCore::VTTCue* item = WebKit::core(self);
gchar* result = convertToUTF8String(item->align());
return result;
#else
UNUSED_PARAM(self);
WEBKIT_WARN_FEATURE_NOT_PRESENT("Video Track")
return 0;
#endif /* ENABLE(VIDEO_TRACK) */
}
void webkit_dom_vtt_cue_set_align(WebKitDOMVTTCue* self, const gchar* value, GError** error)
{
#if ENABLE(VIDEO_TRACK)
WebCore::JSMainThreadNullState state;
g_return_if_fail(WEBKIT_DOM_IS_VTT_CUE(self));
g_return_if_fail(value);
g_return_if_fail(!error || !*error);
WebCore::VTTCue* item = WebKit::core(self);
WTF::String convertedValue = WTF::String::fromUTF8(value);
WebCore::ExceptionCode ec = 0;
item->setAlign(convertedValue, ec);
if (ec) {
WebCore::ExceptionCodeDescription ecdesc(ec);
g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name);
}
#else
UNUSED_PARAM(self);
UNUSED_PARAM(value);
UNUSED_PARAM(error);
WEBKIT_WARN_FEATURE_NOT_PRESENT("Video Track")
#endif /* ENABLE(VIDEO_TRACK) */
}
gchar* webkit_dom_vtt_cue_get_text(WebKitDOMVTTCue* self)
{
#if ENABLE(VIDEO_TRACK)
WebCore::JSMainThreadNullState state;
g_return_val_if_fail(WEBKIT_DOM_IS_VTT_CUE(self), 0);
WebCore::VTTCue* item = WebKit::core(self);
gchar* result = convertToUTF8String(item->text());
return result;
#else
UNUSED_PARAM(self);
WEBKIT_WARN_FEATURE_NOT_PRESENT("Video Track")
return 0;
#endif /* ENABLE(VIDEO_TRACK) */
}
void webkit_dom_vtt_cue_set_text(WebKitDOMVTTCue* self, const gchar* value)
{
#if ENABLE(VIDEO_TRACK)
WebCore::JSMainThreadNullState state;
g_return_if_fail(WEBKIT_DOM_IS_VTT_CUE(self));
g_return_if_fail(value);
WebCore::VTTCue* item = WebKit::core(self);
WTF::String convertedValue = WTF::String::fromUTF8(value);
item->setText(convertedValue);
#else
UNUSED_PARAM(self);
UNUSED_PARAM(value);
WEBKIT_WARN_FEATURE_NOT_PRESENT("Video Track")
#endif /* ENABLE(VIDEO_TRACK) */
}
gchar* webkit_dom_vtt_cue_get_region_id(WebKitDOMVTTCue* self)
{
#if ENABLE(VIDEO_TRACK)
WebCore::JSMainThreadNullState state;
g_return_val_if_fail(WEBKIT_DOM_IS_VTT_CUE(self), 0);
WebCore::VTTCue* item = WebKit::core(self);
gchar* result = convertToUTF8String(item->regionId());
return result;
#else
UNUSED_PARAM(self);
WEBKIT_WARN_FEATURE_NOT_PRESENT("Video Track")
return 0;
#endif /* ENABLE(VIDEO_TRACK) */
}
void webkit_dom_vtt_cue_set_region_id(WebKitDOMVTTCue* self, const gchar* value)
{
#if ENABLE(VIDEO_TRACK)
WebCore::JSMainThreadNullState state;
g_return_if_fail(WEBKIT_DOM_IS_VTT_CUE(self));
g_return_if_fail(value);
WebCore::VTTCue* item = WebKit::core(self);
WTF::String convertedValue = WTF::String::fromUTF8(value);
item->setRegionId(convertedValue);
#else
UNUSED_PARAM(self);
UNUSED_PARAM(value);
WEBKIT_WARN_FEATURE_NOT_PRESENT("Video Track")
#endif /* ENABLE(VIDEO_TRACK) */
}