Bug 132228

Summary: [GTK] TextTrack kind and mode attributes are enums since r166180
Product: WebKit Reporter: Carlos Garcia Campos <cgarcia>
Component: BindingsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: gustavo, pnormand
Priority: P2 Keywords: Gtk
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 131672    
Attachments:
Description Flags
Patch mrobinson: review+

Description Carlos Garcia Campos 2014-04-27 01:53:11 PDT
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.
Comment 1 Carlos Garcia Campos 2014-04-27 01:54:56 PDT
Created attachment 230257 [details]
Patch
Comment 2 Martin Robinson 2014-04-27 04:07:43 PDT
Comment on attachment 230257 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=230257&action=review

Looks good with a few minor suggestions.

> Source/WebCore/bindings/gobject/WebKitDOMCustom.cpp:74
> +    gchar* result = convertToUTF8String(item->kind());
> +    return result;

Can you just return convertToUTF8String(item->kind()); ?

> Source/WebCore/bindings/gobject/WebKitDOMCustom.cpp:103
> +    WebCore::TextTrack* item = WebKit::core(self);
> +    WTF::String convertedValue = WTF::String::fromUTF8(value);
> +    item->setMode(convertedValue);

Can't this just be WebKit::core(self)->setMode(WTF::String::fromUTF8(value)); ?
Comment 3 Carlos Garcia Campos 2014-04-28 00:11:27 PDT
(In reply to comment #2)
> (From update of attachment 230257 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=230257&action=review
> 
> Looks good with a few minor suggestions.

Thanks

> > Source/WebCore/bindings/gobject/WebKitDOMCustom.cpp:74
> > +    gchar* result = convertToUTF8String(item->kind());
> > +    return result;
> 
> Can you just return convertToUTF8String(item->kind()); ?

Sure, this is actually generated code, but added manually. I think this happens in the generated code because if the method raises exceptions there's code to deal with them, between the two lines. 

> > Source/WebCore/bindings/gobject/WebKitDOMCustom.cpp:103
> > +    WebCore::TextTrack* item = WebKit::core(self);
> > +    WTF::String convertedValue = WTF::String::fromUTF8(value);
> > +    item->setMode(convertedValue);
> 
> Can't this just be WebKit::core(self)->setMode(WTF::String::fromUTF8(value)); ?

Ditto.
Comment 4 Carlos Garcia Campos 2014-04-28 01:07:29 PDT
Committed r167876: <http://trac.webkit.org/changeset/167876>