Changeset 207436 in webkit


Ignore:
Timestamp:
Oct 17, 2016 3:03:16 PM (8 years ago)
Author:
commit-queue@webkit.org
Message:

[Modern Media Controls] Basic MediaController
https://bugs.webkit.org/show_bug.cgi?id=163539
<rdar://problem/28797542>

Patch by Antoine Quint <Antoine Quint> on 2016-10-17
Reviewed by Darin Adler.

Source/WebCore:

We add a new main.js file which acts as the entry point by implementing the createControls()
function that HTMLMediaElement::ensureMediaControlsInjectedScript() once the shadow root has
been created. That functions creates an instance of the new MediaController class, which is
the controller object that will handle communication between the media controls and the media
element. At first, this MediaController class is very limited and assumes macOS inline
layout traits and forces a start button to be shown over the media, which can be played
to start the media and show the full controls. More functionality will be added by future patches.

Tests: media/modern-media-controls/media-controller/media-controller-click-to-start.html

media/modern-media-controls/media-controller/media-controller-constructor.html
media/modern-media-controls/media-controller/media-controller-resize.html

  • Modules/modern-media-controls/main.js: Added.

(createControls):

  • Modules/modern-media-controls/media/media-controller.js: Added.

(MediaController):
(MediaController.prototype.set pageScaleFactor):
(MediaController.prototype.set usesLTRUserInterfaceLayoutDirection):
(MediaController.prototype.handleEvent):
(MediaController.prototype.buttonWasClicked):
(MediaController.prototype._updateControlsSize):

  • WebCore.xcodeproj/project.pbxproj:
  • rendering/RenderThemeMac.mm:

(WebCore::RenderThemeMac::mediaControlsStyleSheet):
(WebCore::RenderThemeMac::mediaControlsScript):

LayoutTests:

Testing the properties of the new MediaController class and the availability and behavior of the
createControls() global function.

  • media/modern-media-controls/media-controller/media-controller-click-to-start-expected.txt: Added.
  • media/modern-media-controls/media-controller/media-controller-click-to-start.html: Added.
  • media/modern-media-controls/media-controller/media-controller-constructor-expected.txt: Added.
  • media/modern-media-controls/media-controller/media-controller-constructor.html: Added.
  • media/modern-media-controls/media-controller/media-controller-resize-expected.txt: Added.
  • media/modern-media-controls/media-controller/media-controller-resize.html: Added.
Location:
trunk
Files:
10 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r207435 r207436  
     12016-10-17  Antoine Quint  <graouts@apple.com>
     2
     3        [Modern Media Controls] Basic MediaController
     4        https://bugs.webkit.org/show_bug.cgi?id=163539
     5        <rdar://problem/28797542>
     6
     7        Reviewed by Darin Adler.
     8
     9        Testing the properties of the new MediaController class and the availability and behavior of the
     10        createControls() global function.
     11
     12        * media/modern-media-controls/media-controller/media-controller-click-to-start-expected.txt: Added.
     13        * media/modern-media-controls/media-controller/media-controller-click-to-start.html: Added.
     14        * media/modern-media-controls/media-controller/media-controller-constructor-expected.txt: Added.
     15        * media/modern-media-controls/media-controller/media-controller-constructor.html: Added.
     16        * media/modern-media-controls/media-controller/media-controller-resize-expected.txt: Added.
     17        * media/modern-media-controls/media-controller/media-controller-resize.html: Added.
     18
    1192016-10-17  Michael Catanzaro  <mcatanzaro@igalia.com>
    220
  • trunk/Source/WebCore/ChangeLog

    r207431 r207436  
     12016-10-17  Antoine Quint  <graouts@apple.com>
     2
     3        [Modern Media Controls] Basic MediaController
     4        https://bugs.webkit.org/show_bug.cgi?id=163539
     5        <rdar://problem/28797542>
     6
     7        Reviewed by Darin Adler.
     8
     9        We add a new main.js file which acts as the entry point by implementing the createControls()
     10        function that HTMLMediaElement::ensureMediaControlsInjectedScript() once the shadow root has
     11        been created. That functions creates an instance of the new MediaController class, which is
     12        the controller object that will handle communication between the media controls and the media
     13        element. At first, this MediaController class is very limited and assumes macOS inline
     14        layout traits and forces a start button to be shown over the media, which can be played
     15        to start the media and show the full controls. More functionality will be added by future patches.
     16
     17        Tests: media/modern-media-controls/media-controller/media-controller-click-to-start.html
     18               media/modern-media-controls/media-controller/media-controller-constructor.html
     19               media/modern-media-controls/media-controller/media-controller-resize.html
     20
     21        * Modules/modern-media-controls/main.js: Added.
     22        (createControls):
     23        * Modules/modern-media-controls/media/media-controller.js: Added.
     24        (MediaController):
     25        (MediaController.prototype.set pageScaleFactor):
     26        (MediaController.prototype.set usesLTRUserInterfaceLayoutDirection):
     27        (MediaController.prototype.handleEvent):
     28        (MediaController.prototype.buttonWasClicked):
     29        (MediaController.prototype._updateControlsSize):
     30        * WebCore.xcodeproj/project.pbxproj:
     31        * rendering/RenderThemeMac.mm:
     32        (WebCore::RenderThemeMac::mediaControlsStyleSheet):
     33        (WebCore::RenderThemeMac::mediaControlsScript):
     34
    1352016-10-17  Anders Carlsson  <andersca@apple.com>
    236
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r207420 r207436  
    73167316                0F4966A11DB4090100A274BB /* DOMPointInit.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = DOMPointInit.idl; sourceTree = "<group>"; };
    73177317                0F4966A21DB4091000A274BB /* DOMPointInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMPointInit.h; sourceTree = "<group>"; };
    7318                 0F4966A41DB40C4300A274BB /* JSDOMPoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSDOMPoint.cpp; path = JSDOMPoint.cpp; sourceTree = "<group>"; };
    7319                 0F4966A51DB40C4300A274BB /* JSDOMPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSDOMPoint.h; path = JSDOMPoint.h; sourceTree = "<group>"; };
    7320                 0F4966A61DB40C4300A274BB /* JSDOMPointInit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSDOMPointInit.cpp; path = JSDOMPointInit.cpp; sourceTree = "<group>"; };
    7321                 0F4966A71DB40C4300A274BB /* JSDOMPointInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSDOMPointInit.h; path = JSDOMPointInit.h; sourceTree = "<group>"; };
    7322                 0F4966A81DB40C4300A274BB /* JSDOMPointReadOnly.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSDOMPointReadOnly.cpp; path = JSDOMPointReadOnly.cpp; sourceTree = "<group>"; };
    7323                 0F4966A91DB40C4300A274BB /* JSDOMPointReadOnly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSDOMPointReadOnly.h; path = JSDOMPointReadOnly.h; sourceTree = "<group>"; };
     7318                0F4966A41DB40C4300A274BB /* JSDOMPoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMPoint.cpp; sourceTree = "<group>"; };
     7319                0F4966A51DB40C4300A274BB /* JSDOMPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMPoint.h; sourceTree = "<group>"; };
     7320                0F4966A61DB40C4300A274BB /* JSDOMPointInit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMPointInit.cpp; sourceTree = "<group>"; };
     7321                0F4966A71DB40C4300A274BB /* JSDOMPointInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMPointInit.h; sourceTree = "<group>"; };
     7322                0F4966A81DB40C4300A274BB /* JSDOMPointReadOnly.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMPointReadOnly.cpp; sourceTree = "<group>"; };
     7323                0F4966A91DB40C4300A274BB /* JSDOMPointReadOnly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMPointReadOnly.h; sourceTree = "<group>"; };
    73247324                0F4E57161313276200CF85AF /* RenderSVGAllInOne.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGAllInOne.cpp; sourceTree = "<group>"; };
    73257325                0F54DCCC1880C6AB003EEDBB /* ios-encodings.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = "ios-encodings.txt"; sourceTree = "<group>"; };
     
    97899789                71C916071D1483A300ACA47D /* UserInterfaceLayoutDirection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserInterfaceLayoutDirection.h; sourceTree = "<group>"; };
    97909790                71CC7A1F152A0BFE009EEAF9 /* SVGAnimatedEnumeration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedEnumeration.cpp; sourceTree = "<group>"; };
     9791                71D02D901DB55C4E00DD5CF5 /* main.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = main.js; sourceTree = "<group>"; };
     9792                71D02D921DB55C4E00DD5CF5 /* media-controller.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = "media-controller.js"; sourceTree = "<group>"; };
    97919793                71D6AA711DA4EAF700B23969 /* airplay-placard@1x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "airplay-placard@1x.png"; sourceTree = "<group>"; };
    97929794                71D6AA721DA4EAF700B23969 /* airplay-placard@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "airplay-placard@2x.png"; sourceTree = "<group>"; };
     
    1766917671                        sourceTree = SOURCE_ROOT;
    1767017672                };
     17673                71D02D911DB55C4E00DD5CF5 /* media */ = {
     17674                        isa = PBXGroup;
     17675                        children = (
     17676                                71D02D921DB55C4E00DD5CF5 /* media-controller.js */,
     17677                        );
     17678                        path = media;
     17679                        sourceTree = "<group>";
     17680                };
    1767117681                71D6AA391DA4EAF700B23969 /* modern-media-controls */ = {
    1767217682                        isa = PBXGroup;
    1767317683                        children = (
     17684                                71D02D901DB55C4E00DD5CF5 /* main.js */,
    1767417685                                716FA0D71DB26591007323CC /* controls */,
    1767517686                                71D6AA6F1DA4EAF700B23969 /* images */,
     17687                                71D02D911DB55C4E00DD5CF5 /* media */,
    1767617688                        );
    1767717689                        path = "modern-media-controls";
  • trunk/Source/WebCore/rendering/RenderThemeMac.mm

    r207423 r207436  
    238238        StringBuilder styleSheetBuilder;
    239239        if (RuntimeEnabledFeatures::sharedFeatures().modernMediaControlsEnabled()) {
    240             NSArray* paths = @[@"airplay-button", @"button", @"buttons-container", @"icon-button", @"macos-inline-media-controls", @"media-controls", @"placard", @"scrubber", @"slider", @"start-button", @"time-label", @"volume-slider"];
    241             for (NSString* path in paths)
     240            NSArray *paths = @[@"airplay-button", @"button", @"buttons-container", @"icon-button", @"macos-inline-media-controls", @"media-controls", @"placard", @"scrubber", @"slider", @"start-button", @"time-label", @"volume-slider"];
     241            for (NSString *path in paths)
    242242                styleSheetBuilder.append([NSString stringWithContentsOfFile:[[NSBundle bundleForClass:[WebCoreRenderThemeBundle class]] pathForResource:path ofType:@"css" inDirectory:@"modern-media-controls/controls"] encoding:NSUTF8StringEncoding error:nil]);
    243243        } else
     
    256256    if (m_mediaControlsScript.isEmpty()) {
    257257        StringBuilder scriptBuilder;
    258         NSBundle* bundle = [NSBundle bundleForClass:[WebCoreRenderThemeBundle class]];
     258        NSBundle *bundle = [NSBundle bundleForClass:[WebCoreRenderThemeBundle class]];
    259259        if (RuntimeEnabledFeatures::sharedFeatures().modernMediaControlsEnabled()) {
    260             NSArray* controlsPaths = @[@"scheduler", @"layout-node", @"layout-item", @"icon-service", @"time-control", @"time-label", @"slider", @"volume-slider", @"scrubber", @"button", @"start-button", @"icon-button", @"play-pause-button", @"skip-back-button", @"mute-button", @"airplay-button", @"pip-button", @"tracks-button", @"fullscreen-button", @"aspect-ratio-button", @"rewind-button", @"forward-button", @"media-controls", @"macos-media-controls", @"macos-inline-media-controls", @"buttons-container", @"placard", @"airplay-placard", @"pip-placard"];
    261             for (NSString* path in controlsPaths)
     260            NSArray *controlsPaths = @[@"scheduler", @"layout-node", @"layout-item", @"icon-service", @"time-control", @"time-label", @"slider", @"volume-slider", @"scrubber", @"button", @"start-button", @"icon-button", @"play-pause-button", @"skip-back-button", @"mute-button", @"airplay-button", @"pip-button", @"tracks-button", @"fullscreen-button", @"aspect-ratio-button", @"rewind-button", @"forward-button", @"media-controls", @"macos-media-controls", @"macos-inline-media-controls", @"buttons-container", @"placard", @"airplay-placard", @"pip-placard"];
     261            for (NSString *path in controlsPaths)
    262262                scriptBuilder.append([NSString stringWithContentsOfFile:[bundle pathForResource:path ofType:@"js" inDirectory:@"modern-media-controls/controls"] encoding:NSUTF8StringEncoding error:nil]);
     263            scriptBuilder.append([NSString stringWithContentsOfFile:[bundle pathForResource:@"media-controller" ofType:@"js" inDirectory:@"modern-media-controls/media"] encoding:NSUTF8StringEncoding error:nil]);
     264            scriptBuilder.append([NSString stringWithContentsOfFile:[bundle pathForResource:@"main" ofType:@"js" inDirectory:@"modern-media-controls"] encoding:NSUTF8StringEncoding error:nil]);
    263265        } else {
    264266            scriptBuilder.append([NSString stringWithContentsOfFile:[bundle pathForResource:@"mediaControlsLocalizedStrings" ofType:@"js"] encoding:NSUTF8StringEncoding error:nil]);
Note: See TracChangeset for help on using the changeset viewer.