[MediaControls][iOS] Enable JavaScript Media Controls on iOS.
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Jan 2014 20:50:49 +0000 (20:50 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Jan 2014 20:50:49 +0000 (20:50 +0000)
https://bugs.webkit.org/show_bug.cgi?id=126440

Reviewed by Eric Carlson.

Drive-by misspelling fix, and add a convenience function to check if the
controls are currently hidden:
* Modules/mediacontrols/mediaControlsApple.js:
(Controller.prototype.handleWrapperMouseMove):
(Controller.prototype.handleWrapperMouseOut):
(Controller.prototype.updatePlaying):
(Controller.prototype.controlsAreHidden): Added.

Add a new subclass of Controller for iOS and a matching CSS:
* Modules/mediacontrols/mediaControlsiOS.css: Added.
* Modules/mediacontrols/mediaControlsiOS.js: Added.
(createControls): Override the createControls() in mediaControlsApple.js.
(ControllerIOS): Define a new class.
(ControllerIOS.prototype.inheritFrom): Convenience method to mixin parent
    prototype methods.
(ControllerIOS.prototype.createBase): Override, listen for touches instead of mouse events.
(ControllerIOS.prototype.createControls): Ditto.
(ControllerIOS.prototype.configureInlineControls): Override, only add play, timeline, and full
    screen butttons.
(ControllerIOS.prototype.configureFullScreenControls): Override, and add no buttons.
(ControllerIOS.prototype.handlePlayButtonTouchStart): Activate.
(ControllerIOS.prototype.handlePlayButtonTouchEnd): De-activate and do action.
(ControllerIOS.prototype.handlePlayButtonTouchCancel): De-activate and cancel.
(ControllerIOS.prototype.handleWrapperTouchStart): Show controls.
(ControllerIOS.prototype.handlePanelTouchStart): Disable video selection.
(ControllerIOS.prototype.handlePanelTouchEnd): Re-enable video selection.
(ControllerIOS.prototype.handlePanelTouchCancel): Ditto.

Drive-by fix to enable the JavaScript controls when the plugin is disabled:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::parseAttribute):

Add the iOS JavaScript by appending it to the generic (Apple) JavaScript:
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::mediaControlsScript):

Add new files to project:
* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@161280 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/Modules/mediacontrols/mediaControlsApple.js
Source/WebCore/Modules/mediacontrols/mediaControlsiOS.css [new file with mode: 0644]
Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js [new file with mode: 0644]
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/rendering/RenderThemeIOS.mm

index 58dd894..9a418af 100644 (file)
@@ -1,3 +1,50 @@
+2014-01-03  Jer Noble  <jer.noble@apple.com>
+
+        [MediaControls][iOS] Enable JavaScript Media Controls on iOS.
+        https://bugs.webkit.org/show_bug.cgi?id=126440
+
+        Reviewed by Eric Carlson.
+
+        Drive-by misspelling fix, and add a convenience function to check if the
+        controls are currently hidden:
+        * Modules/mediacontrols/mediaControlsApple.js:
+        (Controller.prototype.handleWrapperMouseMove):
+        (Controller.prototype.handleWrapperMouseOut):
+        (Controller.prototype.updatePlaying):
+        (Controller.prototype.controlsAreHidden): Added.
+
+        Add a new subclass of Controller for iOS and a matching CSS:
+        * Modules/mediacontrols/mediaControlsiOS.css: Added.
+        * Modules/mediacontrols/mediaControlsiOS.js: Added.
+        (createControls): Override the createControls() in mediaControlsApple.js.
+        (ControllerIOS): Define a new class.
+        (ControllerIOS.prototype.inheritFrom): Convenience method to mixin parent
+            prototype methods.
+        (ControllerIOS.prototype.createBase): Override, listen for touches instead of mouse events.
+        (ControllerIOS.prototype.createControls): Ditto.
+        (ControllerIOS.prototype.configureInlineControls): Override, only add play, timeline, and full
+            screen butttons.
+        (ControllerIOS.prototype.configureFullScreenControls): Override, and add no buttons.
+        (ControllerIOS.prototype.handlePlayButtonTouchStart): Activate.
+        (ControllerIOS.prototype.handlePlayButtonTouchEnd): De-activate and do action.
+        (ControllerIOS.prototype.handlePlayButtonTouchCancel): De-activate and cancel.
+        (ControllerIOS.prototype.handleWrapperTouchStart): Show controls.
+        (ControllerIOS.prototype.handlePanelTouchStart): Disable video selection.
+        (ControllerIOS.prototype.handlePanelTouchEnd): Re-enable video selection.
+        (ControllerIOS.prototype.handlePanelTouchCancel): Ditto.
+
+        Drive-by fix to enable the JavaScript controls when the plugin is disabled:
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::parseAttribute):
+
+        Add the iOS JavaScript by appending it to the generic (Apple) JavaScript:
+        * rendering/RenderThemeIOS.mm:
+        (WebCore::RenderThemeIOS::mediaControlsScript):
+
+        Add new files to project:
+        * DerivedSources.make:
+        * WebCore.xcodeproj/project.pbxproj:
+
 2014-01-03  Simon Fraser  <simon.fraser@apple.com>
 
         Allow the ChromeClient to provide a custom ScrollingCoordinator
index 61e2cfc..aa5f5d0 100644 (file)
@@ -848,6 +848,9 @@ endif
 
 ifeq ($(findstring ENABLE_MEDIA_CONTROLS_SCRIPT,$(FEATURE_DEFINES)), ENABLE_MEDIA_CONTROLS_SCRIPT)
        USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/Modules/mediacontrols/mediaControlsApple.css
+ifeq ($(WTF_PLATFORM_IOS), 1)
+    USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/Modules/mediacontrols/mediaControlsiOS.css
+endif
 endif
 
 ifeq ($(OS),MACOS)
@@ -865,6 +868,9 @@ USER_AGENT_SCRIPTS =
 
 ifeq ($(findstring ENABLE_MEDIA_CONTROLS_SCRIPT,$(FEATURE_DEFINES)), ENABLE_MEDIA_CONTROLS_SCRIPT)
        USER_AGENT_SCRIPTS := $(USER_AGENT_SCRIPTS) $(WebCore)/Modules/mediacontrols/mediaControlsApple.js
+ifeq ($(WTF_PLATFORM_IOS), 1)
+       USER_AGENT_SCRIPTS := $(USER_AGENT_SCRIPTS) $(WebCore)/Modules/mediacontrols/mediaControlsiOS.js
+endif
 endif
 
 ifeq ($(OS),MACOS)
index bab12f7..f9eec68 100644 (file)
@@ -57,7 +57,7 @@ Controller.prototype = {
         volumechange: 'handleVolumeChange',
         webkitfullscreenchange: 'handleFullscreenChange',
     },
-    HideContrtolsDelay: 4 * 1000,
+    HideControlsDelay: 4 * 1000,
     RewindAmount: 30,
     MaximumSeekRate: 8,
     SeekDelay: 1500,
@@ -547,7 +547,7 @@ Controller.prototype = {
         this.showControls();
         if (this.hideTimer)
             clearTimeout(this.hideTimer);
-        this.hideTimer = setTimeout(this.hideControls.bind(this), this.HideContrtolsDelay);
+        this.hideTimer = setTimeout(this.hideControls.bind(this), this.HideControlsDelay);
 
         if (!this.isDragging)
             return;
@@ -559,7 +559,7 @@ Controller.prototype = {
 
     handleWrapperMouseOut: function(event)
     {
-        this.controls.panel.classList.remove(this.ClassNames.show);
+        this.hideControls();
         if (this.hideTimer)
             clearTimeout(this.hideTimer);
     },
@@ -836,10 +836,10 @@ Controller.prototype = {
             this.controls.playButton.classList.remove(this.ClassNames.paused);
             this.controls.playButton.setAttribute('aria-label', this.UIString('Pause'));
 
-            this.controls.panel.classList.remove(this.ClassNames.show);
+            this.hideControls();
             if (this.hideTimer)
                 clearTimeout(this.hideTimer);
-            this.hideTimer = setTimeout(this.hideControls.bind(this), this.HideContrtolsDelay);
+            this.hideTimer = setTimeout(this.hideControls.bind(this), this.HideControlsDelay);
         }
     },
 
@@ -854,6 +854,11 @@ Controller.prototype = {
         this.controls.panel.classList.remove(this.ClassNames.show);
     },
 
+    controlsAreHidden: function()
+    {
+        return !this.controls.panel.classList.contains(this.ClassNames.show) || this.controls.panel.classList.contains(this.ClassNames.hidden);
+    },
+
     removeControls: function()
     {
         if (this.controls.panel.parentNode)
diff --git a/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.css b/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.css
new file mode 100644 (file)
index 0000000..3c02d1e
--- /dev/null
@@ -0,0 +1,279 @@
+/*
+ * Copyright (C) 2012, 2013 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+audio {
+    width: 200px;
+    height: 44px;
+}
+
+body:-webkit-full-page-media {
+    background-color: rgb(38, 38, 38);
+}
+
+video:-webkit-full-page-media {
+    margin: auto;
+    position: absolute;
+    top: 0;
+    right: 0;
+    bottom: 0;
+    left: 0;
+}
+
+video:-webkit-full-page-media::-webkit-media-controls-panel {
+    bottom: 0px;
+}
+
+::-webkit-media-controls {
+    width: inherit;
+    height: inherit;
+    position: relative;
+    display: -webkit-flex;
+    -webkit-align-items: stretch;
+    -webkit-justify-content: flex-end;
+    -webkit-flex-direction: column;
+}
+
+video::-webkit-media-text-track-container,
+audio::-webkit-media-text-track-container {
+    position: relative;
+    -webkit-flex: 1 1 auto;
+}
+
+video::-webkit-media-controls-panel,
+audio::-webkit-media-controls-panel {
+    box-sizing: border-box;
+    position: relative;
+    bottom: 0;
+    width: 100%;
+    padding-top: 1px;
+    height: 44px;
+    line-height: 44px;
+    -webkit-user-select: none;
+    background-color: rgba(255, 255, 255, .5);
+
+    display: -webkit-flex;
+    -webkit-flex-direction: row;
+    -webkit-align-items: center;
+    -webkit-user-select: none;
+
+    transition: opacity 0.25s linear;
+}
+
+video::-webkit-media-controls-panel {
+    opacity: 0;
+}
+
+video::-webkit-media-controls-panel.show,
+video::-webkit-media-controls-panel.paused,
+video::-webkit-media-controls-panel:hover {
+    opacity: 1;
+}
+
+
+video::-webkit-media-controls-rewind-button,
+audio::-webkit-media-controls-rewind-button,
+video::-webkit-media-controls-panel .mute-box,
+audio::-webkit-media-controls-panel .mute-box,
+video::-webkit-media-controls-mute-button,
+audio::-webkit-media-controls-mute-button,
+video::-webkit-media-controls-volume-max-button,
+video::-webkit-media-controls-panel .volume-box,
+audio::-webkit-media-controls-panel .volume-box,
+audio::-webkit-media-controls-volume-slider,
+video::-webkit-media-controls-volume-slider {
+    display: none !important;
+}
+
+video::-webkit-media-controls-play-button,
+audio::-webkit-media-controls-play-button,
+video::-webkit-media-controls-fullscreen-button,
+audio::-webkit-media-controls-fullscreen-button {
+    -webkit-appearance: none;
+    display: block;
+    padding: 0;
+    border: 0;
+    background-color: black;
+    -webkit-mask-origin: content-box;
+    -webkit-mask-repeat: no-repeat;
+    -webkit-mask-size: contain;
+    -webkit-user-select: none;
+}
+
+video::-webkit-media-controls-play-button:active,
+audio::-webkit-media-controls-play-button:active,
+video::-webkit-media-controls-fullscreen-button:active,
+audio::-webkit-media-controls-fullscreen-button:active, {
+    background-color: white;
+}
+
+video::-webkit-media-controls-play-button,
+audio::-webkit-media-controls-play-button {
+    margin-left: 34px;
+    margin-right: 13px;
+    width: 18px;
+    height: 16px;
+    -webkit-mask-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 16"><rect x="1" y="0" width="5" height="16" fill="white"/><rect x="12" y="0" width="5" height="16" fill="white"/></svg>');
+}
+
+video::-webkit-media-controls-play-button.paused,
+audio::-webkit-media-controls-play-button.paused {
+    -webkit-mask-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 16"><path d="M 0,0 18,8 0,16 z" fill="white"/></svg>');
+}
+
+video::-webkit-media-controls-fullscreen-button,
+audio::-webkit-media-controls-fullscreen-button {
+    margin-right: 34px;
+    margin-left: 13px;
+    width: 16px;
+    height: 16px;
+    -webkit-mask-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16px" height="16px"><g stroke="white" fill="transparent"><path d="M .5,5 v -4.5 h 4.5M .5,.5 l 5.5,5.5" /> <path d="M 15.5,11 v 4.5 h -4.5 M 15.5,15.5 l -5.5,-5.5" /></g></svg>')
+}
+
+/* Retina images */
+@media only screen and (-webkit-min-device-pixel-ratio: 2) {
+    video::-webkit-media-controls-fullscreen-button,
+    audio::-webkit-media-controls-fullscreen-button {
+        -webkit-mask-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30"><g stroke="white" stroke-width="2" fill="transparent"><path d="M 1,9 v -8 h 8 M 1,1 l 11,11" /> <path d="M 29,21 v 8 h -8 M 29,29 l -11,-11" /></g></svg>');
+    }
+}
+
+video::-webkit-media-controls-timeline,
+audio::-webkit-media-controls-timeline {
+    -webkit-appearance: none;
+    -webkit-flex: 1 1 0;
+    height: 3px;
+    margin: 0;
+
+    border-radius: 1.5px;
+    background-color: black;
+}
+
+video::-webkit-media-controls-timeline::-webkit-slider-thumb,
+audio::-webkit-media-controls-timeline::-webkit-slider-thumb {
+    -webkit-appearance: none;
+    width: 15px;
+    height: 15px;
+    border: 0;
+    border-radius: 7.5px;
+    background-color: white !important;
+    color: white;
+    box-shadow: 0 0 1px rgba(0, 0, 0, .5);
+
+    /* rotateZ() forces the layer into compositing mode. Slider 
+       thumbs are small, so forcing a compositing layer is inexpensive,
+       and it keeps the slider from having to repaint while sliding. */
+    -webkit-transform: rotateZ(0deg);
+}
+
+video::-webkit-media-controls-current-time-display,
+video::-webkit-media-controls-time-remaining-display,
+audio::-webkit-media-controls-current-time-display,
+audio::-webkit-media-controls-time-remaining-display {
+    -webkit-user-select: none;
+    -webkit-flex: 0 0 0;
+    display: -webkit-flex;
+    -webkit-justify-content: center;
+    -webkit-align-items: center;
+    cursor: default;
+    font: -webkit-small-control;
+    font-size: 10px;
+    overflow-y: hidden;
+    overflow-x: hidden;
+    width: 45px;
+    min-width: 45px;
+    color: black;
+    letter-spacing: normal;
+    word-spacing: normal;
+    line-height: normal;
+    text-transform: none;
+    text-indent: 0px;
+    text-decoration: none;
+}
+
+video::-webkit-media-controls-timeline-container,
+audio::-webkit-media-controls-timeline-container {
+    display: -webkit-flex;
+    -webkit-flex-direction: row;
+    -webkit-align-items: center;
+    -webkit-user-select: none;
+    -webkit-flex: 1 1 0;
+    position: relative;
+    padding: 0;
+}
+
+video::-webkit-media-controls-panel .hidden,
+audio::-webkit-media-controls-panel .hidden {
+    display: none;
+}
+
+video::-webkit-media-text-track-container {
+    position: relative;
+    width: 100%;
+    overflow: hidden;
+    padding-bottom: 5px;
+
+    text-align: center;
+    color: rgba(255, 255, 255, 1);
+
+    letter-spacing: normal;
+    word-spacing: normal;
+    text-transform: none;
+    text-indent: 0;
+    text-decoration: none;
+    pointer-events: none;
+    -webkit-user-select: none;
+    word-break: break-word;
+
+    -webkit-flex: 1 1;
+
+    -webkit-line-box-contain: block inline-box replaced;
+}
+
+video::cue {
+    background-color: rgba(0, 0, 0, 0.8);
+}
+
+video::-webkit-media-text-track-display {
+    position: absolute;
+    overflow: hidden;
+    white-space: pre-wrap;
+    -webkit-box-sizing: border-box;
+    font: 22px sans-serif;
+}
+
+video::cue(:future) {
+    color: gray;
+}
+
+video::-webkit-media-text-track-container b {
+    font-weight: bold;
+}
+
+video::-webkit-media-text-track-container u {
+    text-decoration: underline;
+}
+
+video::-webkit-media-text-track-container i {
+    font-style: italic;
+}
diff --git a/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js b/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js
new file mode 100644 (file)
index 0000000..21b25c7
--- /dev/null
@@ -0,0 +1,102 @@
+function createControls(root, video, host)
+{
+    return new ControllerIOS(root, video, host);
+};
+
+function ControllerIOS(root, video, host)
+{
+    Controller.call(this, root, video, host);
+};
+
+ControllerIOS.prototype = {
+    inheritFrom: function(parent) {
+        for (var property in parent) {
+            if (!this.hasOwnProperty(property))
+                this[property] = parent[property];
+        }
+    },
+
+    createBase: function() {
+        Controller.prototype.createBase.call(this);
+
+        this.listenFor(this.base, 'touchstart', this.handleWrapperTouchStart);
+        this.stopListeningFor(this.base, 'mousemove', this.handleWrapperMouseMove);
+        this.stopListeningFor(this.base, 'mouseout', this.handleWrapperMouseOut);
+
+    },
+
+    createControls: function() {
+        Controller.prototype.createControls.call(this);
+
+        this.listenFor(this.controls.panel, 'touchstart', this.handlePanelTouchStart);
+        this.listenFor(this.controls.panel, 'touchend', this.handlePanelTouchEnd);
+        this.listenFor(this.controls.panel, 'touchcancel', this.handlePanelTouchCancel);
+        this.listenFor(this.controls.playButton, 'touchstart', this.handlePlayButtonTouchStart);
+        this.listenFor(this.controls.playButton, 'touchend', this.handlePlayButtonTouchEnd);
+        this.listenFor(this.controls.playButton, 'touchcancel', this.handlePlayButtonTouchCancel);
+        this.stopListeningFor(this.controls.playButton, 'click', this.handlePlayButtonClicked);
+    },
+
+    configureInlineControls: function() {
+        this.controls.panel.appendChild(this.controls.playButton);
+        this.controls.panel.appendChild(this.controls.statusDisplay);
+        this.controls.panel.appendChild(this.controls.timelineBox);
+        this.controls.timelineBox.appendChild(this.controls.currentTime);
+        this.controls.timelineBox.appendChild(this.controls.timeline);
+        this.controls.timelineBox.appendChild(this.controls.remainingTime);
+        if (!this.isAudio())
+            this.controls.panel.appendChild(this.controls.fullscreenButton);
+    },
+
+    configureFullScreenControls: function() {
+        // Do nothing
+    },
+
+    handlePlayButtonTouchStart: function() {
+        this.controls.playButton.classList.add('active');
+    },
+
+    handlePlayButtonTouchEnd: function(event) {
+        this.controls.playButton.classList.remove('active');
+
+        if (this.canPlay())
+            this.video.play();
+        else
+            this.video.pause();
+
+        event.stopPropagation();
+    },
+
+    handlePlayButtonTouchCancel: function(event) {
+        this.controls.playButton.classList.remove('active');
+        event.stopPropagation();
+    },
+
+    handleWrapperTouchStart: function(event) {
+        if (event.target != this.base)
+            return;
+
+        if (this.controlsAreHidden()) {
+            this.showControls();
+            if (this.hideTimer)
+                clearTimeout(this.hideTimer);
+            this.hideTimer = setTimeout(this.hideControls.bind(this), this.HideControlsDelay);
+        } else if (!this.canPlay())
+            this.hideControls();
+    },
+
+    handlePanelTouchStart: function(event) {
+        this.video.style.webkitUserSelect = 'none';
+    },
+
+    handlePanelTouchEnd: function(event) {
+        this.video.style.removeProperty('-webkit-user-select');
+    },
+
+    handlePanelTouchCancel: function(event) {
+        this.video.style.removeProperty('-webkit-user-select');
+    },
+};
+
+ControllerIOS.prototype.inheritFrom(Object.create(Controller.prototype));
+Object.defineProperty(ControllerIOS.prototype, 'constructor', { enumerable:false, value:ControllerIOS });
index 8ed10c9..8ba2509 100644 (file)
                CD27F6E3145767580078207D /* JSMediaController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMediaController.h; sourceTree = "<group>"; };
                CD27F6E4145767870078207D /* MediaController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaController.h; sourceTree = "<group>"; };
                CD27F6E6145770D30078207D /* MediaController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaController.cpp; sourceTree = "<group>"; };
+               CD32A189184EB46A0029B1BB /* mediaControlsiOS.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = mediaControlsiOS.js; sourceTree = "<group>"; };
                CD336F5F17F9F64700DDDCD0 /* AVTrackPrivateAVFObjCImpl.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AVTrackPrivateAVFObjCImpl.mm; sourceTree = "<group>"; };
                CD336F6017F9F64700DDDCD0 /* AVTrackPrivateAVFObjCImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AVTrackPrivateAVFObjCImpl.h; sourceTree = "<group>"; };
                CD336F6317FA0A4D00DDDCD0 /* VideoTrackPrivateAVF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoTrackPrivateAVF.h; sourceTree = "<group>"; };
                CDA98E0C1603CF3C00FEA3B1 /* CDMPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDMPrivate.h; sourceTree = "<group>"; };
                CDAA8D0714D385600061EA60 /* PlatformClockCM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformClockCM.h; sourceTree = "<group>"; };
                CDAA8D0814D385600061EA60 /* PlatformClockCM.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformClockCM.mm; sourceTree = "<group>"; };
+               CDAAF45D1869094E003C1717 /* mediaControlsiOS.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = mediaControlsiOS.css; sourceTree = "<group>"; };
                CDAB6D2517C7DE5700C60B34 /* MediaControlsHost.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = MediaControlsHost.idl; sourceTree = "<group>"; };
                CDAB6D2617C7DE6C00C60B34 /* MediaControlsHost.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaControlsHost.cpp; sourceTree = "<group>"; };
                CDAB6D2717C7DE6C00C60B34 /* MediaControlsHost.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaControlsHost.h; sourceTree = "<group>"; };
                        children = (
                                CDC1DD4117CC2C48008CB55D /* mediaControlsApple.css */,
                                CDE6560E17CA6E7600526BA7 /* mediaControlsApple.js */,
-                               CDAB6D2517C7DE5700C60B34 /* MediaControlsHost.idl */,
                                CDAB6D2617C7DE6C00C60B34 /* MediaControlsHost.cpp */,
                                CDAB6D2717C7DE6C00C60B34 /* MediaControlsHost.h */,
+                               CDAB6D2517C7DE5700C60B34 /* MediaControlsHost.idl */,
+                               CDAAF45D1869094E003C1717 /* mediaControlsiOS.css */,
+                               CD32A189184EB46A0029B1BB /* mediaControlsiOS.js */,
                        );
                        path = mediacontrols;
                        sourceTree = "<group>";
index a0c9dde..9bbba40 100644 (file)
@@ -5652,9 +5652,9 @@ void HTMLMediaElement::didAddUserAgentShadowRoot(ShadowRoot* root)
 {
 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
     // JavaScript controls are not enabled with the video plugin proxy.
-    UNUSED_PARAM(root);
-    return;
-#else
+    if (shouldUseVideoPluginProxy())
+        return;
+#endif
     Page* page = document().page();
     if (!page)
         return;
@@ -5691,7 +5691,6 @@ void HTMLMediaElement::didAddUserAgentShadowRoot(ShadowRoot* root)
     JSC::call(exec, overlay, callType, callData, globalObject, argList);
     if (exec->hadException())
         exec->clearException();
-#endif
 }
 #endif // ENABLE(MEDIA_CONTROLS_SCRIPT)
 
index 705b770..2e6e59e 100644 (file)
@@ -1205,7 +1205,10 @@ String RenderThemeIOS::mediaControlsStyleSheet()
 String RenderThemeIOS::mediaControlsScript()
 {
 #if ENABLE(MEDIA_CONTROLS_SCRIPT)
-    return String(mediaControlsAppleJavaScript, sizeof(mediaControlsAppleJavaScript));
+    StringBuilder scriptBuilder;
+    scriptBuilder.append(mediaControlsAppleJavaScript, sizeof(mediaControlsAppleJavaScript));
+    scriptBuilder.append(mediaControlsIOSJavaScript, sizeof(mediaControlsIOSJavaScript));
+    return scriptBuilder.toString();
 #else
     return emptyString();
 #endif