Title: [283050] trunk/Source/WebCore
Revision
283050
Author
grao...@webkit.org
Date
2021-09-24 11:44:03 -0700 (Fri, 24 Sep 2021)

Log Message

[Media Controls] Allow for a close button
https://bugs.webkit.org/show_bug.cgi?id=230761

Reviewed by Dean Jackson.

Add a new close button with an "X" icon which simple exits fullscreen.

* DerivedSources-input.xcfilelist:
* DerivedSources.make:
* Modules/modern-media-controls/controls/close-button.js: Added.
(CloseButton):
* Modules/modern-media-controls/controls/icon-service.js:
* Modules/modern-media-controls/images/iOS/X.svg: Added.
* Modules/modern-media-controls/images/macOS/X.svg: Added.
* Modules/modern-media-controls/media/close-support.js: Added.
(CloseSupport.prototype.get control):
(CloseSupport.prototype.buttonWasPressed):
(CloseSupport):
* Modules/modern-media-controls/media/media-controller.js:
(MediaController.prototype._supportingObjectClasses):
* WebCore.xcodeproj/project.pbxproj:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (283049 => 283050)


--- trunk/Source/WebCore/ChangeLog	2021-09-24 18:04:35 UTC (rev 283049)
+++ trunk/Source/WebCore/ChangeLog	2021-09-24 18:44:03 UTC (rev 283050)
@@ -1,3 +1,27 @@
+2021-09-24  Antoine Quint  <grao...@webkit.org>
+
+        [Media Controls] Allow for a close button
+        https://bugs.webkit.org/show_bug.cgi?id=230761
+
+        Reviewed by Dean Jackson.
+
+        Add a new close button with an "X" icon which simple exits fullscreen.
+
+        * DerivedSources-input.xcfilelist:
+        * DerivedSources.make:
+        * Modules/modern-media-controls/controls/close-button.js: Added.
+        (CloseButton):
+        * Modules/modern-media-controls/controls/icon-service.js:
+        * Modules/modern-media-controls/images/iOS/X.svg: Added.
+        * Modules/modern-media-controls/images/macOS/X.svg: Added.
+        * Modules/modern-media-controls/media/close-support.js: Added.
+        (CloseSupport.prototype.get control):
+        (CloseSupport.prototype.buttonWasPressed):
+        (CloseSupport):
+        * Modules/modern-media-controls/media/media-controller.js:
+        (MediaController.prototype._supportingObjectClasses):
+        * WebCore.xcodeproj/project.pbxproj:
+
 2021-09-24  Devin Rousso  <drou...@apple.com>
 
         Add typechecking `is` overloads for `std::unique_ptr`, `WTF::UniqueRef`, and `WTF::WeakPtr`

Modified: trunk/Source/WebCore/DerivedSources-input.xcfilelist (283049 => 283050)


--- trunk/Source/WebCore/DerivedSources-input.xcfilelist	2021-09-24 18:04:35 UTC (rev 283049)
+++ trunk/Source/WebCore/DerivedSources-input.xcfilelist	2021-09-24 18:44:03 UTC (rev 283050)
@@ -301,6 +301,7 @@
 $(PROJECT_DIR)/Modules/modern-media-controls/controls/button.js
 $(PROJECT_DIR)/Modules/modern-media-controls/controls/buttons-container.css
 $(PROJECT_DIR)/Modules/modern-media-controls/controls/buttons-container.js
+$(PROJECT_DIR)/Modules/modern-media-controls/controls/close-button.js
 $(PROJECT_DIR)/Modules/modern-media-controls/controls/controls-bar.css
 $(PROJECT_DIR)/Modules/modern-media-controls/controls/controls-bar.js
 $(PROJECT_DIR)/Modules/modern-media-controls/controls/forward-button.js
@@ -358,6 +359,7 @@
 $(PROJECT_DIR)/Modules/modern-media-controls/media/airplay-support.js
 $(PROJECT_DIR)/Modules/modern-media-controls/media/audio-support.js
 $(PROJECT_DIR)/Modules/modern-media-controls/media/brightness-support.js
+$(PROJECT_DIR)/Modules/modern-media-controls/media/close-support.js
 $(PROJECT_DIR)/Modules/modern-media-controls/media/controls-visibility-support.js
 $(PROJECT_DIR)/Modules/modern-media-controls/media/fullscreen-support.js
 $(PROJECT_DIR)/Modules/modern-media-controls/media/media-controller-support.js

Modified: trunk/Source/WebCore/DerivedSources.make (283049 => 283050)


--- trunk/Source/WebCore/DerivedSources.make	2021-09-24 18:04:35 UTC (rev 283049)
+++ trunk/Source/WebCore/DerivedSources.make	2021-09-24 18:44:03 UTC (rev 283050)
@@ -1628,6 +1628,7 @@
     $(WebCore)/Modules/modern-media-controls/controls/range-button.js \
     $(WebCore)/Modules/modern-media-controls/controls/volume-button.js \
     $(WebCore)/Modules/modern-media-controls/controls/brightness-button.js \
+    $(WebCore)/Modules/modern-media-controls/controls/close-button.js \
     $(WebCore)/Modules/modern-media-controls/controls/buttons-container.js \
     $(WebCore)/Modules/modern-media-controls/controls/status-label.js \
     $(WebCore)/Modules/modern-media-controls/controls/controls-bar.js \
@@ -1651,6 +1652,7 @@
     $(WebCore)/Modules/modern-media-controls/media/airplay-support.js \
     $(WebCore)/Modules/modern-media-controls/media/audio-support.js \
     $(WebCore)/Modules/modern-media-controls/media/brightness-support.js \
+    $(WebCore)/Modules/modern-media-controls/media/close-support.js \
     $(WebCore)/Modules/modern-media-controls/media/controls-visibility-support.js \
     $(WebCore)/Modules/modern-media-controls/media/fullscreen-support.js \
     $(WebCore)/Modules/modern-media-controls/media/mute-support.js \

Added: trunk/Source/WebCore/Modules/modern-media-controls/controls/close-button.js (0 => 283050)


--- trunk/Source/WebCore/Modules/modern-media-controls/controls/close-button.js	                        (rev 0)
+++ trunk/Source/WebCore/Modules/modern-media-controls/controls/close-button.js	2021-09-24 18:44:03 UTC (rev 283050)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2021 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 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 INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * 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.
+ */
+
+class CloseButton extends Button
+{
+
+    constructor(layoutDelegate)
+    {
+        super({
+            cssClassName: "close",
+            iconName: Icons.Close,
+            layoutDelegate
+        });
+    }
+
+}

Modified: trunk/Source/WebCore/Modules/modern-media-controls/controls/icon-service.js (283049 => 283050)


--- trunk/Source/WebCore/Modules/modern-media-controls/controls/icon-service.js	2021-09-24 18:04:35 UTC (rev 283049)
+++ trunk/Source/WebCore/Modules/modern-media-controls/controls/icon-service.js	2021-09-24 18:44:03 UTC (rev 283050)
@@ -27,6 +27,7 @@
     Airplay         : { name: "Airplay", type: "svg", label: UIString("AirPlay") },
     AirplayPlacard  : { name: "airplay-placard", type: "png", label: UIString("AirPlay") },
     Brightness      : { name: "Brightness", type: "svg", label: UIString("Adjust Brightness") },
+    Close           : { name: "X", type: "svg", label: UIString("Close") },
     EnterFullscreen : { name: "EnterFullscreen", type: "svg", label: UIString("Enter Full Screen") },
     EnterPiP        : { name: "PipIn", type: "svg", label: UIString("Enter Picture in Picture") },
     ExitFullscreen  : { name: "ExitFullscreen", type: "svg", label: UIString("Exit Full Screen") },

Added: trunk/Source/WebCore/Modules/modern-media-controls/images/iOS/X.svg (0 => 283050)


--- trunk/Source/WebCore/Modules/modern-media-controls/images/iOS/X.svg	                        (rev 0)
+++ trunk/Source/WebCore/Modules/modern-media-controls/images/iOS/X.svg	2021-09-24 18:44:03 UTC (rev 283050)
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 78 78">
+   <path transform="matrix(1 0 0 1 -12 74)" d="M13.7207 2.24609Q14.5996 3.07617 15.7227 3.36914Q16.8457 3.66211 17.9688 3.36914Q19.0918 3.07617 19.9219 2.24609L51.1719-29.0039L82.4219 2.24609Q83.252 3.07617 84.375 3.36914Q85.498 3.66211 86.6455 3.39355Q87.793 3.125 88.623 2.24609Q89.4531 1.41602 89.7217 0.292969Q89.9902-0.830078 89.7217-1.95312Q89.4531-3.07617 88.623-3.90625L57.373-35.2051L88.623-66.4551Q89.4531-67.2852 89.7461-68.4082Q90.0391-69.5312 89.7461-70.6543Q89.4531-71.7773 88.623-72.6074Q87.7441-73.4863 86.6211-73.7549Q85.498-74.0234 84.375-73.7549Q83.252-73.4863 82.4219-72.6074L51.1719-41.3574L19.9219-72.6074Q19.0918-73.4863 17.9443-73.7549Q16.7969-74.0234 15.6738-73.7549Q14.5508-73.4863 13.7207-72.6074Q12.8906-71.7773 12.6221-70.6543Q12.3535-69.5312 12.6221-68.4082Q12.8906-67.2852 13.7207-66.4551L44.9707-35.2051L13.7207-3.90625Q12.8906-3.07617 12.5977-1.95312Q12.3047-0.830078 12.5732 0.292969Q12.8418 1.41602 13.7207 2.24609Z"/>
+</svg>

Added: trunk/Source/WebCore/Modules/modern-media-controls/images/macOS/X.svg (0 => 283050)


--- trunk/Source/WebCore/Modules/modern-media-controls/images/macOS/X.svg	                        (rev 0)
+++ trunk/Source/WebCore/Modules/modern-media-controls/images/macOS/X.svg	2021-09-24 18:44:03 UTC (rev 283050)
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 78 78">
+   <path transform="matrix(1 0 0 1 -12 74)" d="M13.7207 2.24609Q14.5996 3.07617 15.7227 3.36914Q16.8457 3.66211 17.9688 3.36914Q19.0918 3.07617 19.9219 2.24609L51.1719-29.0039L82.4219 2.24609Q83.252 3.07617 84.375 3.36914Q85.498 3.66211 86.6455 3.39355Q87.793 3.125 88.623 2.24609Q89.4531 1.41602 89.7217 0.292969Q89.9902-0.830078 89.7217-1.95312Q89.4531-3.07617 88.623-3.90625L57.373-35.2051L88.623-66.4551Q89.4531-67.2852 89.7461-68.4082Q90.0391-69.5312 89.7461-70.6543Q89.4531-71.7773 88.623-72.6074Q87.7441-73.4863 86.6211-73.7549Q85.498-74.0234 84.375-73.7549Q83.252-73.4863 82.4219-72.6074L51.1719-41.3574L19.9219-72.6074Q19.0918-73.4863 17.9443-73.7549Q16.7969-74.0234 15.6738-73.7549Q14.5508-73.4863 13.7207-72.6074Q12.8906-71.7773 12.6221-70.6543Q12.3535-69.5312 12.6221-68.4082Q12.8906-67.2852 13.7207-66.4551L44.9707-35.2051L13.7207-3.90625Q12.8906-3.07617 12.5977-1.95312Q12.3047-0.830078 12.5732 0.292969Q12.8418 1.41602 13.7207 2.24609Z"/>
+</svg>

Added: trunk/Source/WebCore/Modules/modern-media-controls/media/close-support.js (0 => 283050)


--- trunk/Source/WebCore/Modules/modern-media-controls/media/close-support.js	                        (rev 0)
+++ trunk/Source/WebCore/Modules/modern-media-controls/media/close-support.js	2021-09-24 18:44:03 UTC (rev 283050)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2021 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 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 INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * 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.
+ */
+
+class CloseSupport extends MediaControllerSupport
+{
+
+    // Protected
+
+    get control()
+    {
+        return this.mediaController.controls.closeButton;
+    }
+
+    buttonWasPressed(control)
+    {
+        this.mediaController.media.webkitExitFullscreen();
+    }
+
+}

Modified: trunk/Source/WebCore/Modules/modern-media-controls/media/media-controller.js (283049 => 283050)


--- trunk/Source/WebCore/Modules/modern-media-controls/media/media-controller.js	2021-09-24 18:04:35 UTC (rev 283049)
+++ trunk/Source/WebCore/Modules/modern-media-controls/media/media-controller.js	2021-09-24 18:44:03 UTC (rev 283050)
@@ -213,7 +213,7 @@
         if (overridenSupportingObjectClasses)
             return overridenSupportingObjectClasses;
 
-        let classes = [AirplaySupport, AudioSupport, BrightnessSupport, ControlsVisibilitySupport, FullscreenSupport, OverflowSupport, PiPSupport, PlacardSupport, PlaybackSupport, ScrubbingSupport, SeekBackwardSupport, SeekForwardSupport, SkipBackSupport, SkipForwardSupport, StartSupport, StatusSupport, TimeControlSupport, TracksSupport]
+        let classes = [AirplaySupport, AudioSupport, BrightnessSupport, CloseSupport, ControlsVisibilitySupport, FullscreenSupport, OverflowSupport, PiPSupport, PlacardSupport, PlaybackSupport, ScrubbingSupport, SeekBackwardSupport, SeekForwardSupport, SkipBackSupport, SkipForwardSupport, StartSupport, StatusSupport, TimeControlSupport, TracksSupport]
 
         if (this.controls.usesSingleMuteAndVolumeButton)
             classes.push(MuteAndVolumeSupport);

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (283049 => 283050)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-09-24 18:04:35 UTC (rev 283049)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-09-24 18:44:03 UTC (rev 283050)
@@ -10377,6 +10377,10 @@
 		718C7F571DD385C500B733C8 /* status-label.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = "status-label.js"; sourceTree = "<group>"; };
 		7199B94A2551F0E100494A57 /* StyleContentAlignmentData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleContentAlignmentData.cpp; sourceTree = "<group>"; };
 		7199B94F2552103E00494A57 /* StyleSelfAlignmentData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleSelfAlignmentData.cpp; sourceTree = "<group>"; };
+		7199F81E26FE15C000C627C2 /* close-button.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode._javascript_; path = "close-button.js"; sourceTree = "<group>"; };
+		7199F82026FE15C200C627C2 /* brightness-button.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode._javascript_; path = "brightness-button.js"; sourceTree = "<group>"; };
+		7199F82126FE161F00C627C2 /* brightness-support.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode._javascript_; path = "brightness-support.js"; sourceTree = "<group>"; };
+		7199F82226FE161F00C627C2 /* close-support.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode._javascript_; path = "close-support.js"; sourceTree = "<group>"; };
 		71A1B6071DEE5A820073BCFB /* en */ = {isa = PBXFileReference; lastKnownFileType = sourcecode._javascript_; name = en; path = "en.lproj/modern-media-controls-localized-strings.js"; sourceTree = SOURCE_ROOT; };
 		71A3D17D2562B8240064E2A6 /* HTMLModelElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLModelElement.h; sourceTree = "<group>"; };
 		71A3D17F2562B8240064E2A6 /* HTMLModelElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLModelElement.idl; sourceTree = "<group>"; };
@@ -22778,10 +22782,12 @@
 				9551959825FA9EB800F58CF0 /* background-click-delegate-notifier.js */,
 				9551959725FA9EB800F58CF0 /* background-tint.css */,
 				9551959925FA9EB900F58CF0 /* background-tint.js */,
+				7199F82026FE15C200C627C2 /* brightness-button.js */,
 				716FA0DC1DB26591007323CC /* button.css */,
 				716FA0DD1DB26591007323CC /* button.js */,
 				716FA0DE1DB26591007323CC /* buttons-container.css */,
 				716FA0DF1DB26591007323CC /* buttons-container.js */,
+				7199F81E26FE15C000C627C2 /* close-button.js */,
 				717F618B1E43D61A00F37024 /* controls-bar.css */,
 				710FA74B1DEE576D004C715E /* controls-bar.js */,
 				716FA0E01DB26591007323CC /* forward-button.js */,
@@ -22842,6 +22848,8 @@
 			children = (
 				717F90581DC4BB600006F520 /* airplay-support.js */,
 				9551959125FA9E4300F58CF0 /* audio-support.js */,
+				7199F82126FE161F00C627C2 /* brightness-support.js */,
+				7199F82226FE161F00C627C2 /* close-support.js */,
 				710FA74C1DEE577E004C715E /* controls-visibility-support.js */,
 				714131471DC9D6AF00336107 /* fullscreen-support.js */,
 				7177E2461DB80D2F00919A0B /* media-controller-support.js */,
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to