Bug 163238 - [Modern Media Controls] Buttons container
Summary: [Modern Media Controls] Buttons container
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-10 14:02 PDT by Antoine Quint
Modified: 2016-10-11 05:55 PDT (History)
3 users (show)

See Also:


Attachments
Patch (22.62 KB, patch)
2016-10-10 14:11 PDT, Antoine Quint
no flags Details | Formatted Diff | Diff
Patch for landing (22.01 KB, patch)
2016-10-11 05:21 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-10 14:02:46 PDT
Media controls need a way to lay a group of buttons out together.
Comment 1 Antoine Quint 2016-10-10 14:11:58 PDT
Created attachment 291160 [details]
Patch
Comment 2 Radar WebKit Bug Importer 2016-10-10 14:30:02 PDT
<rdar://problem/28701864>
Comment 3 Dean Jackson 2016-10-11 04:31:07 PDT
Comment on attachment 291160 [details]
Patch

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

> Source/WebCore/ChangeLog:30
> +        * Modules/modern-media-controls/controls/buttons-container.css: Copied from Source/WebCore/Modules/modern-media-controls/controls/airplay-button.js.
> +        (.buttons-container):
> +        * Modules/modern-media-controls/controls/buttons-container.js: Copied from Source/WebCore/Modules/modern-media-controls/controls/airplay-button.js.

Remove this Copied from junk.

> Source/WebCore/Modules/modern-media-controls/controls/buttons-container.js:64
> +            button.x = x;
> +            x += button.width + this.margin;

I don't think you should do work like this inside a call to filter, even though it is possible. I think you should treat the parameter as read only. A better way would be to call this.children.forEach after the filter.
Comment 4 Antoine Quint 2016-10-11 05:18:06 PDT
(In reply to comment #3)
> Comment on attachment 291160 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=291160&action=review
> 
> > Source/WebCore/Modules/modern-media-controls/controls/buttons-container.js:64
> > +            button.x = x;
> > +            x += button.width + this.margin;
> 
> I don't think you should do work like this inside a call to filter, even
> though it is possible. I think you should treat the parameter as read only.
> A better way would be to call this.children.forEach after the filter.

Cool, I'll have a children array that I'll populate during a forEach and then assign to the node's children property, so there's a single iteration.
Comment 5 Antoine Quint 2016-10-11 05:21:40 PDT
Created attachment 291248 [details]
Patch for landing
Comment 6 WebKit Commit Bot 2016-10-11 05:55:04 PDT
Comment on attachment 291248 [details]
Patch for landing

Clearing flags on attachment: 291248

Committed r207111: <http://trac.webkit.org/changeset/207111>
Comment 7 WebKit Commit Bot 2016-10-11 05:55:07 PDT
All reviewed patches have been landed.  Closing bug.