Bug 162868 - [Modern Media Controls] LayoutItem and Button classes
Summary: [Modern Media Controls] LayoutItem and Button classes
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: Safari 10
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Antoine Quint
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-10-03 09:58 PDT by Antoine Quint
Modified: 2016-10-03 13:33 PDT (History)
3 users (show)

See Also:


Attachments
Patch (15.19 KB, patch)
2016-10-03 10:02 PDT, Antoine Quint
no flags Details | Formatted Diff | Diff
Patch for landing (15.17 KB, patch)
2016-10-03 11:00 PDT, Antoine Quint
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antoine Quint 2016-10-03 09:58:34 PDT
Now that we have the basic building blocks to render content asynchronously with LayoutNode, we need to add a class to create buttons, which is the bread and butter of the UI part of media controls.
Comment 1 Radar WebKit Bug Importer 2016-10-03 09:59:06 PDT
<rdar://problem/28590166>
Comment 2 Antoine Quint 2016-10-03 10:02:20 PDT
Created attachment 290490 [details]
Patch
Comment 3 Dean Jackson 2016-10-03 10:10:44 PDT
Comment on attachment 290490 [details]
Patch

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

> Source/WebCore/ChangeLog:10
> +        We introduce the new Button class and its parent class LayoutItem. A Button is a class
> +        that we will subclass a lot in coming patches, it provides a way to create a button

We will subclass Button a lot in coming patches, as it...

> Source/WebCore/Modules/modern-media-controls/controls/button.js:32
> +            element: `<button>`,

Why not use just a "" string here?

> Source/WebCore/Modules/modern-media-controls/controls/button.js:36
> +        this._enabled = true;

Would you ever want to call the delegate at this point?

> Source/WebCore/Modules/modern-media-controls/controls/layout-item.js:36
> +    constructor({ element = null, layoutDelegate = null } = {})

Nice. I'd forgotten about this syntax.

> LayoutTests/media/modern-media-controls/button/button.html:30
> +button.uiDelegate = {
> +
> +    buttonWasClicked(aButton)
> +    {
> +        clickedButton = aButton;
> +        shouldBeTrue("clickedButton === button");
> +    }
> +
> +}

This syntax is nuts. I really wanted to see buttonWasClicked: function (aButton)...

> LayoutTests/media/modern-media-controls/layout-item/layout-item.html:12
> +    
> +    get layoutTraits()

Nit: blank line isn't really needed
Comment 4 Antoine Quint 2016-10-03 10:58:15 PDT
(In reply to comment #3)
> Comment on attachment 290490 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=290490&action=review
> 
> > Source/WebCore/ChangeLog:10
> > +        We introduce the new Button class and its parent class LayoutItem. A Button is a class
> > +        that we will subclass a lot in coming patches, it provides a way to create a button
> 
> We will subclass Button a lot in coming patches, as it...
> 
> > Source/WebCore/Modules/modern-media-controls/controls/button.js:32
> > +            element: `<button>`,
> 
> Why not use just a "" string here?

Sure.

> > Source/WebCore/Modules/modern-media-controls/controls/button.js:36
> > +        this._enabled = true;
> 
> Would you ever want to call the delegate at this point?

The need for that hasn't arisen yet.

> > Source/WebCore/Modules/modern-media-controls/controls/layout-item.js:36
> > +    constructor({ element = null, layoutDelegate = null } = {})
> 
> Nice. I'd forgotten about this syntax.

Yes, default parameter values and object deconstruction is a fine pair.

> > LayoutTests/media/modern-media-controls/button/button.html:30
> > +button.uiDelegate = {
> > +
> > +    buttonWasClicked(aButton)
> > +    {
> > +        clickedButton = aButton;
> > +        shouldBeTrue("clickedButton === button");
> > +    }
> > +
> > +}
> 
> This syntax is nuts. I really wanted to see buttonWasClicked: function
> (aButton)...

Sure, we can write it this way.

> > LayoutTests/media/modern-media-controls/layout-item/layout-item.html:12
> > +    
> > +    get layoutTraits()
> 
> Nit: blank line isn't really needed

Will remove.
Comment 5 Antoine Quint 2016-10-03 11:00:58 PDT
Created attachment 290492 [details]
Patch for landing
Comment 6 WebKit Commit Bot 2016-10-03 13:33:33 PDT
Comment on attachment 290492 [details]
Patch for landing

Clearing flags on attachment: 290492

Committed r206745: <http://trac.webkit.org/changeset/206745>
Comment 7 WebKit Commit Bot 2016-10-03 13:33:38 PDT
All reviewed patches have been landed.  Closing bug.