Changeset 173230 in webkit
- Timestamp:
- Sep 3, 2014 2:32:25 PM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 31 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r173229 r173230 1 2014-09-02 Maciej Stachowiak <mjs@apple.com> 2 3 Clean up naming for and slightly refactor legacy video fullscreen support 4 https://bugs.webkit.org/show_bug.cgi?id=136446 5 6 Reviewed by Jer Noble. 7 8 Key changes: 9 supportsFullscreenForNode(Node*) --> supportsVideoFullscreen() 10 enterFullscreenForNode(Node*) --> enterVideoFullscreenForVideoElement(HTMLVideoElement*) 11 exitFullscreenForNode(Node*) --> exitVideoFullscreen() 12 13 The old versions had unnecessary parameters, did not clearly distinguish their purpose 14 from enterFullscreenForElement and friends, and wrongly claimed generality to all Nodes. 15 Also changed many other places to use HTMLVideoElement* instead of Node* or 16 HTMLMediaElement* when they were in fact only used for video elements and would only 17 work for such. 18 19 The implications of this include a bunch of renaming in some iOS fullscreen code. 20 21 * html/HTMLMediaElement.cpp: 22 (WebCore::HTMLMediaElement::HTMLMediaElement): Rename m_isFullscreen flag to 23 m_isInVideoFullscreen, since it only covers the case of legacy video fullscreen, 24 not element fullscreen. 25 (WebCore::HTMLMediaElement::stop): ditto 26 (WebCore::HTMLMediaElement::requiresTextTrackRepresentation): ditto 27 (WebCore::HTMLMediaElement::isFullscreen): ditto 28 (WebCore::HTMLMediaElement::enterFullscreen): Rename m_isFullscreen flag to 29 m_isInVideoFullscreen. Hoist video element check here from all supportsFullscrenForNode 30 clients. Adjust for relevant ChromeClient refactorings. 31 (WebCore::HTMLMediaElement::enterFullscreen): ditto above 32 * html/HTMLMediaElement.h: 33 * html/HTMLVideoElement.cpp: 34 (WebCore::HTMLVideoElement::supportsFullscreen): Adjust for relevant ChromeClient 35 refactorings. 36 * page/ChromeClient.h: 37 (WebCore::ChromeClient::supportsVideoFullscreen): Renamed from 38 supportsFullscreenForNode, and removed Node* parameter. 39 (WebCore::ChromeClient::enterVideoFullscreenForVideoElement): Renamed from 40 enterFulscreenForNode and changed Node* parameter to HTMLVideoElement*. 41 (WebCore::ChromeClient::exitVideoFullscreen): Renamed from 42 exitFullscreenForNode, and removed Node* parameter. 43 * platform/ios/WebVideoFullscreenControllerAVKit.h: 44 * platform/ios/WebVideoFullscreenControllerAVKit.mm: 45 (-[WebVideoFullscreenController videoElement]): Renamed from mediaElement; 46 return a video element and not just a media element. 47 (-[WebVideoFullscreenController dealloc]): Renamed _mediaElement data member 48 to _videoElement and changed type accordingly. 49 (-[WebVideoFullscreenController setVideoElement:]): Renamed from setMediaElement: 50 and adjust parameter type accordingly. 51 (-[WebVideoFullscreenController enterFullscreen:]): Video elements, not media 52 elements. 53 (-[WebVideoFullscreenController exitFullscreen]): ditto 54 (-[WebVideoFullscreenController didCleanupFullscreen]): ditto 55 * platform/ios/WebVideoFullscreenInterface.h: 56 * platform/ios/WebVideoFullscreenInterfaceAVKit.h: Remove gratuitous HTMLMEdiaElement.h include 57 and fix declarations accordingly. 58 * platform/ios/WebVideoFullscreenInterfaceAVKit.mm: Include WTFString.h 59 * platform/ios/WebVideoFullscreenModelVideoElement.h: Renamed from Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.h. 60 * platform/ios/WebVideoFullscreenModelVideoElement.mm: Renamed from Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.mm. 61 (WebVideoFullscreenModelVideoElement) Renamed from WebVideoFullscreenModelMediaElement 62 (WebVideoFullscreenModelVideoElement::setVideoElement): Renamed from setMediaElement and 63 change param type accordingly. Also no need to check for actual videoness of the element. 64 (WebVideoFullscreenModelVideoElement::updateForEventName): Rename data member from m_mediaElement 65 to m_videoElement and change type accordingly. 66 (WebVideoFullscreenModelVideoElement::setVideoFullscreenLayer): ditto 67 (WebVideoFullscreenModelVideoElement::play): ditto 68 (WebVideoFullscreenModelVideoElement::pause): ditto 69 (WebVideoFullscreenModelVideoElement::togglePlayState): ditto 70 (WebVideoFullscreenModelVideoElement::beginScrubbing): ditto 71 (WebVideoFullscreenModelVideoElement::endScrubbing): ditto 72 (WebVideoFullscreenModelVideoElement::seekToTime): ditto 73 (WebVideoFullscreenModelVideoElement::fastSeek): ditto 74 (WebVideoFullscreenModelVideoElement::beginScanningForward): ditto 75 (WebVideoFullscreenModelVideoElement::beginScanningBackward): ditto 76 (WebVideoFullscreenModelVideoElement::endScanning): ditto 77 (WebVideoFullscreenModelVideoElement::requestExitFullscreen): ditto 78 (WebVideoFullscreenModelVideoElement::setVideoLayerFrame): ditto 79 (WebVideoFullscreenModelVideoElement::setVideoLayerGravity): ditto 80 (WebVideoFullscreenModelVideoElement::updateLegibleOptions): ditto 81 * platform/mac/WebVideoFullscreenController.h: 82 * platform/mac/WebVideoFullscreenController.mm: 83 (-[WebVideoFullscreenController videoElement]): Renamed from mediaElement 84 and update return type accordingly. 85 (-[WebVideoFullscreenController setVideoElement:]): Renamed from 86 setMediaElement and update return type accordingly. 87 (-[WebVideoFullscreenController videoElementRect]): Renamed 88 from mediaElementRect. 89 (-[WebVideoFullscreenController enterFullscreen:]): Update for 90 rename. 91 (-[WebVideoFullscreenController exitFullscreen]): ditto 92 (-[WebVideoFullscreenController updatePowerAssertions]): Rename 93 member from _mediaElement to _videoElement 94 (-[WebVideoFullscreenController _requestExit]): ditto 95 * WebCore.exp.in: Adjust for function and class renames. 96 * WebCore.xcodeproj/project.pbxproj: Adjust for file renames. 97 1 98 2014-09-03 Benjamin Poulain <benjamin@webkit.org> 2 99 -
trunk/Source/WebCore/WebCore.exp.in
r173192 r173230 1070 1070 __ZN7WebCore37WidgetHierarchyUpdatesSuspensionScope11moveWidgetsEv 1071 1071 __ZN7WebCore37WidgetHierarchyUpdatesSuspensionScope35s_widgetHierarchyUpdateSuspendCountE 1072 #if !USE(CFNETWORK)1073 __ZN7WebCore37synthesizeRedirectResponseIfNecessaryEP15NSURLConnectionP12NSURLRequestP13NSURLResponse1074 #endif1075 1072 __ZN7WebCore3URL10invalidateEv 1076 1073 __ZN7WebCore3URL11setProtocolERKN3WTF6StringE … … 2976 2973 #if !USE(CFNETWORK) 2977 2974 __ZN7WebCore14ResourceHandle25continueWillCacheResponseEP19NSCachedURLResponse 2975 __ZN7WebCore37synthesizeRedirectResponseIfNecessaryEP15NSURLConnectionP12NSURLRequestP13NSURLResponse 2978 2976 #endif 2979 2977 … … 3433 3431 3434 3432 #if ENABLE(VIDEO) && PLATFORM(IOS) 3435 __ZN7WebCore35WebVideoFullscreenModel MediaElement10seekToTimeEd3436 __ZN7WebCore35WebVideoFullscreenModel MediaElement11endScanningEv3437 __ZN7WebCore35WebVideoFullscreenModel MediaElement11handleEventEPNS_22ScriptExecutionContextEPNS_5EventE3438 __ZN7WebCore35WebVideoFullscreenModel MediaElement12endScrubbingEv3439 __ZN7WebCore35WebVideoFullscreenModel MediaElement14beginScrubbingEv3440 __ZN7WebCore35WebVideoFullscreenModel MediaElement15setMediaElementEPNS_16HTMLMediaElementE3441 __ZN7WebCore35WebVideoFullscreenModel MediaElement15togglePlayStateEv3442 __ZN7WebCore35WebVideoFullscreenModel MediaElement18setVideoLayerFrameENS_9FloatRectE3443 __ZN7WebCore35WebVideoFullscreenModel MediaElement20beginScanningForwardEv3444 __ZN7WebCore35WebVideoFullscreenModel MediaElement20setVideoLayerGravityENS_23WebVideoFullscreenModel12VideoGravityE3445 __ZN7WebCore35WebVideoFullscreenModel MediaElement21beginScanningBackwardEv3446 __ZN7WebCore35WebVideoFullscreenModel MediaElement21requestExitFullscreenEv3447 __ZN7WebCore35WebVideoFullscreenModel MediaElement22selectAudioMediaOptionEy3448 __ZN7WebCore35WebVideoFullscreenModel MediaElement23setVideoFullscreenLayerEP7CALayer3449 __ZN7WebCore35WebVideoFullscreenModel MediaElement24selectLegibleMediaOptionEy3450 __ZN7WebCore35WebVideoFullscreenModel MediaElement4playEv3451 __ZN7WebCore35WebVideoFullscreenModel MediaElement5pauseEv3452 __ZN7WebCore35WebVideoFullscreenModel MediaElement8fastSeekEd3453 __ZN7WebCore35WebVideoFullscreenModel MediaElementC2Ev3454 __ZN7WebCore35WebVideoFullscreenModel MediaElementD2Ev3433 __ZN7WebCore35WebVideoFullscreenModelVideoElement10seekToTimeEd 3434 __ZN7WebCore35WebVideoFullscreenModelVideoElement11endScanningEv 3435 __ZN7WebCore35WebVideoFullscreenModelVideoElement11handleEventEPNS_22ScriptExecutionContextEPNS_5EventE 3436 __ZN7WebCore35WebVideoFullscreenModelVideoElement12endScrubbingEv 3437 __ZN7WebCore35WebVideoFullscreenModelVideoElement14beginScrubbingEv 3438 __ZN7WebCore35WebVideoFullscreenModelVideoElement15setVideoElementEPNS_16HTMLVideoElementE 3439 __ZN7WebCore35WebVideoFullscreenModelVideoElement15togglePlayStateEv 3440 __ZN7WebCore35WebVideoFullscreenModelVideoElement18setVideoLayerFrameENS_9FloatRectE 3441 __ZN7WebCore35WebVideoFullscreenModelVideoElement20beginScanningForwardEv 3442 __ZN7WebCore35WebVideoFullscreenModelVideoElement20setVideoLayerGravityENS_23WebVideoFullscreenModel12VideoGravityE 3443 __ZN7WebCore35WebVideoFullscreenModelVideoElement21beginScanningBackwardEv 3444 __ZN7WebCore35WebVideoFullscreenModelVideoElement21requestExitFullscreenEv 3445 __ZN7WebCore35WebVideoFullscreenModelVideoElement22selectAudioMediaOptionEy 3446 __ZN7WebCore35WebVideoFullscreenModelVideoElement23setVideoFullscreenLayerEP7CALayer 3447 __ZN7WebCore35WebVideoFullscreenModelVideoElement24selectLegibleMediaOptionEy 3448 __ZN7WebCore35WebVideoFullscreenModelVideoElement4playEv 3449 __ZN7WebCore35WebVideoFullscreenModelVideoElement5pauseEv 3450 __ZN7WebCore35WebVideoFullscreenModelVideoElement8fastSeekEd 3451 __ZN7WebCore35WebVideoFullscreenModelVideoElementC2Ev 3452 __ZN7WebCore35WebVideoFullscreenModelVideoElementD2Ev 3455 3453 __ZNK7WebCore16HTMLVideoElement10videoWidthEv 3456 3454 __ZNK7WebCore16HTMLVideoElement11videoHeightEv 3457 __ZTVN7WebCore35WebVideoFullscreenModelMediaElementE 3458 __ZThn?_N7WebCore35WebVideoFullscreenModelMediaElement11handleEventEPNS_22ScriptExecutionContextEPNS_5EventE 3455 __ZThn4_N7WebCore35WebVideoFullscreenModelVideoElement11handleEventEPNS_22ScriptExecutionContextEPNS_5EventE 3459 3456 #endif 3460 3457 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r173220 r173230 1358 1358 3FBC4AEA189880EF0046EE38 /* WebVideoFullscreenModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 3FBC4AE9189880EF0046EE38 /* WebVideoFullscreenModel.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1359 1359 3FBC4AEC1898810E0046EE38 /* WebVideoFullscreenInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 3FBC4AEB1898810E0046EE38 /* WebVideoFullscreenInterface.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1360 3FBC4AEF189881380046EE38 /* WebVideoFullscreenModelMediaElement.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3FBC4AED189881380046EE38 /* WebVideoFullscreenModelMediaElement.mm */; };1361 3FBC4AF0189881380046EE38 /* WebVideoFullscreenModelMediaElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 3FBC4AEE189881380046EE38 /* WebVideoFullscreenModelMediaElement.h */; settings = {ATTRIBUTES = (Private, ); }; };1362 1360 3FBC4AF3189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3FBC4AF1189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.mm */; }; 1363 1361 3FBC4AF4189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 3FBC4AF2189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 2204 2202 65DF326109D1E199000BE325 /* UserAgentStyleSheetsData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 656581AF09D14EE6000E61D7 /* UserAgentStyleSheetsData.cpp */; }; 2205 2203 65E0E9441133C89F00B4CB10 /* JSDOMWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 65E0E9431133C89F00B4CB10 /* JSDOMWrapper.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2204 65FD466519B596F0001E2B4D /* WebVideoFullscreenModelVideoElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 6586FE3C19B548BD005C3C82 /* WebVideoFullscreenModelVideoElement.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2205 65FD466619B596F6001E2B4D /* WebVideoFullscreenModelVideoElement.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6586FE3D19B548BD005C3C82 /* WebVideoFullscreenModelVideoElement.mm */; }; 2206 2206 65FEA86909833ADE00BED4AB /* Page.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65FEA86809833ADE00BED4AB /* Page.cpp */; }; 2207 2207 6B3480940EEF50D400AC1B41 /* NativeImagePtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B3480920EEF50D400AC1B41 /* NativeImagePtr.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 8357 8357 3FBC4AE9189880EF0046EE38 /* WebVideoFullscreenModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebVideoFullscreenModel.h; path = ios/WebVideoFullscreenModel.h; sourceTree = "<group>"; }; 8358 8358 3FBC4AEB1898810E0046EE38 /* WebVideoFullscreenInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebVideoFullscreenInterface.h; path = ios/WebVideoFullscreenInterface.h; sourceTree = "<group>"; }; 8359 3FBC4AED189881380046EE38 /* WebVideoFullscreenModelMediaElement.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebVideoFullscreenModelMediaElement.mm; path = ios/WebVideoFullscreenModelMediaElement.mm; sourceTree = "<group>"; };8360 3FBC4AEE189881380046EE38 /* WebVideoFullscreenModelMediaElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebVideoFullscreenModelMediaElement.h; path = ios/WebVideoFullscreenModelMediaElement.h; sourceTree = "<group>"; };8361 8359 3FBC4AF1189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebVideoFullscreenInterfaceAVKit.mm; path = ios/WebVideoFullscreenInterfaceAVKit.mm; sourceTree = "<group>"; }; 8362 8360 3FBC4AF2189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebVideoFullscreenInterfaceAVKit.h; path = ios/WebVideoFullscreenInterfaceAVKit.h; sourceTree = "<group>"; }; … … 9267 9265 657EDA071385CB97004E0645 /* MemoryPressureHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryPressureHandler.h; sourceTree = "<group>"; }; 9268 9266 658436850AE01B7400E53753 /* FrameLoadRequest.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FrameLoadRequest.h; sourceTree = "<group>"; }; 9267 6586FE3C19B548BD005C3C82 /* WebVideoFullscreenModelVideoElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebVideoFullscreenModelVideoElement.h; path = ios/WebVideoFullscreenModelVideoElement.h; sourceTree = "<group>"; }; 9268 6586FE3D19B548BD005C3C82 /* WebVideoFullscreenModelVideoElement.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebVideoFullscreenModelVideoElement.mm; path = ios/WebVideoFullscreenModelVideoElement.mm; sourceTree = "<group>"; }; 9269 9269 6593923509AE4346002C531F /* URL.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = URL.cpp; sourceTree = "<group>"; }; 9270 9270 6593923609AE4346002C531F /* URL.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = URL.h; sourceTree = "<group>"; }; … … 18461 18461 3FBC4AF1189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.mm */, 18462 18462 3FBC4AE9189880EF0046EE38 /* WebVideoFullscreenModel.h */, 18463 3FBC4AEE189881380046EE38 /* WebVideoFullscreenModelMediaElement.h */,18464 3FBC4AED189881380046EE38 /* WebVideoFullscreenModelMediaElement.mm */,18463 6586FE3C19B548BD005C3C82 /* WebVideoFullscreenModelVideoElement.h */, 18464 6586FE3D19B548BD005C3C82 /* WebVideoFullscreenModelVideoElement.mm */, 18465 18465 E453903C0EAFD637003695C8 /* WidgetIOS.mm */, 18466 18466 ); … … 25600 25600 D70AD65813E1342B005B50B4 /* RenderRegion.h in Headers */, 25601 25601 BCE93F451517C567008CCF74 /* RenderRegionSet.h in Headers */, 25602 65FD466519B596F0001E2B4D /* WebVideoFullscreenModelVideoElement.h in Headers */, 25602 25603 A871DFE30A15376B00B12A68 /* RenderReplaced.h in Headers */, 25603 25604 BCA846D70DC67A350026C309 /* RenderReplica.h in Headers */, … … 26531 26532 3FBC4AF4189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.h in Headers */, 26532 26533 3FBC4AEA189880EF0046EE38 /* WebVideoFullscreenModel.h in Headers */, 26533 3FBC4AF0189881380046EE38 /* WebVideoFullscreenModelMediaElement.h in Headers */,26534 26534 F12171F616A8CF0B000053CA /* WebVTTElement.h in Headers */, 26535 26535 5D21A80313ECE5DF00BB7064 /* WebVTTParser.h in Headers */, … … 27561 27561 A7CA595E0B27BD9E00FA021D /* DragController.cpp in Sources */, 27562 27562 A71878900B2D04AC00A16ECE /* DragControllerMac.mm in Sources */, 27563 65FD466619B596F6001E2B4D /* WebVideoFullscreenModelVideoElement.mm in Sources */, 27563 27564 A79546430B5C4CB4007B438F /* DragData.cpp in Sources */, 27564 27565 A795463E0B5C4C80007B438F /* DragDataMac.mm in Sources */, … … 29807 29808 7C73FB0C191EF5A8007DE061 /* JSUserMessageHandlersNamespace.cpp in Sources */, 29808 29809 3FBC4AF3189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.mm in Sources */, 29809 3FBC4AEF189881380046EE38 /* WebVideoFullscreenModelMediaElement.mm in Sources */,29810 29810 F12171F516A8CED2000053CA /* WebVTTElement.cpp in Sources */, 29811 29811 5D21A80213ECE5DF00BB7064 /* WebVTTParser.cpp in Sources */, -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r172868 r173230 306 306 , m_pausedInternal(false) 307 307 , m_sendProgressEvents(true) 308 , m_is Fullscreen(false)308 , m_isInVideoFullscreen(false) 309 309 , m_closedCaptionsVisible(false) 310 310 , m_webkitLegacyClosedCaptionOverride(false) … … 683 683 if (m_networkState > NETWORK_EMPTY) 684 684 pause(); 685 if (m_is Fullscreen)685 if (m_isInVideoFullscreen) 686 686 exitFullscreen(); 687 687 … … 4648 4648 { 4649 4649 LOG(Media, "HTMLMediaElement::stop"); 4650 if (m_is Fullscreen)4650 if (m_isInVideoFullscreen) 4651 4651 exitFullscreen(); 4652 4652 … … 4742 4742 bool HTMLMediaElement::requiresTextTrackRepresentation() const 4743 4743 { 4744 return m_is Fullscreen && m_player ? m_player->requiresTextTrackRepresentation() : false;4744 return m_isInVideoFullscreen && m_player ? m_player->requiresTextTrackRepresentation() : false; 4745 4745 } 4746 4746 … … 4834 4834 bool HTMLMediaElement::isFullscreen() const 4835 4835 { 4836 if (m_is Fullscreen)4836 if (m_isInVideoFullscreen) 4837 4837 return true; 4838 4838 … … 4858 4858 { 4859 4859 LOG(Media, "HTMLMediaElement::enterFullscreen"); 4860 if (m_is Fullscreen)4860 if (m_isInVideoFullscreen) 4861 4861 return; 4862 4862 … … 4868 4868 #endif 4869 4869 4870 m_is Fullscreen = true;4870 m_isInVideoFullscreen = true; 4871 4871 if (hasMediaControls()) 4872 4872 mediaControls()->enteredFullscreen(); 4873 if (document().page()) { 4874 if (document().page()->chrome().client().supportsFullscreenForNode(this)) { 4875 document().page()->chrome().client().enterFullscreenForNode(this); 4873 if (document().page() && isHTMLVideoElement(this)) { 4874 HTMLVideoElement* asVideo = toHTMLVideoElement(this); 4875 if (document().page()->chrome().client().supportsVideoFullscreen()) { 4876 document().page()->chrome().client().enterVideoFullscreenForVideoElement(asVideo); 4876 4877 scheduleEvent(eventNames().webkitbeginfullscreenEvent); 4877 4878 } … … 4890 4891 } 4891 4892 #endif 4892 ASSERT(m_is Fullscreen);4893 m_is Fullscreen = false;4893 ASSERT(m_isInVideoFullscreen); 4894 m_isInVideoFullscreen = false; 4894 4895 if (hasMediaControls()) 4895 4896 mediaControls()->exitedFullscreen(); 4896 if (document().page() ) {4897 if (document().page() && isHTMLVideoElement(this)) { 4897 4898 if (m_mediaSession->requiresFullscreenForVideoPlayback(*this)) 4898 4899 pauseInternal(); 4899 4900 4900 if (document().page()->chrome().client().supports FullscreenForNode(this)) {4901 document().page()->chrome().client().exit FullscreenForNode(this);4901 if (document().page()->chrome().client().supportsVideoFullscreen()) { 4902 document().page()->chrome().client().exitVideoFullscreen(); 4902 4903 scheduleEvent(eventNames().webkitendfullscreenEvent); 4903 4904 } -
trunk/Source/WebCore/html/HTMLMediaElement.h
r172868 r173230 817 817 bool m_sendProgressEvents : 1; 818 818 819 bool m_is Fullscreen : 1;819 bool m_isInVideoFullscreen : 1; 820 820 bool m_closedCaptionsVisible : 1; 821 821 bool m_webkitLegacyClosedCaptionOverride : 1; -
trunk/Source/WebCore/html/HTMLVideoElement.cpp
r170774 r173230 158 158 return false; 159 159 160 return page->chrome().client().supports FullscreenForNode(this);160 return page->chrome().client().supportsVideoFullscreen(); 161 161 #endif // PLATFORM(IOS) 162 162 } -
trunk/Source/WebCore/page/ChromeClient.h
r172729 r173230 340 340 #endif 341 341 342 virtual bool supports FullscreenForNode(const Node*) { return false; }343 virtual void enter FullscreenForNode(Node*) { }344 virtual void exit FullscreenForNode(Node*) { }342 virtual bool supportsVideoFullscreen() { return false; } 343 virtual void enterVideoFullscreenForVideoElement(HTMLVideoElement*) { } 344 virtual void exitVideoFullscreen() { } 345 345 virtual bool requiresFullscreenForVideoPlayback() { return false; } 346 346 -
trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.h
r173176 r173230 29 29 #if PLATFORM(IOS) 30 30 31 #import <WebCore/HTML MediaElement.h>31 #import <WebCore/HTMLVideoElement.h> 32 32 33 33 OBJC_CLASS UIView; 34 34 35 35 WEBCORE_EXPORT @interface WebVideoFullscreenController : NSObject 36 - (void)set MediaElement:(WebCore::HTMLMediaElement*)mediaElement;37 - (WebCore::HTML MediaElement*)mediaElement;36 - (void)setVideoElement:(WebCore::HTMLVideoElement*)videoElement; 37 - (WebCore::HTMLVideoElement*)videoElement; 38 38 - (void)enterFullscreen:(UIView *)view; 39 39 - (void)exitFullscreen; -
trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm
r171973 r173230 32 32 #import "Logging.h" 33 33 #import "WebVideoFullscreenInterfaceAVKit.h" 34 #import "WebVideoFullscreenModel MediaElement.h"34 #import "WebVideoFullscreenModelVideoElement.h" 35 35 #import <QuartzCore/CoreAnimation.h> 36 36 #import <WebCore/WebCoreThreadRun.h> … … 41 41 42 42 @implementation WebVideoFullscreenController 43 - (void)set MediaElement:(WebCore::HTMLMediaElement*)mediaElement43 - (void)setVideoElement:(WebCore::HTMLVideoElement*)videoElement 44 44 { 45 UNUSED_PARAM( mediaElement);45 UNUSED_PARAM(videoElement); 46 46 } 47 47 48 - (WebCore::HTML MediaElement*)mediaElement48 - (WebCore::HTMLVideoElement*)videoElement 49 49 { 50 50 return nullptr; … … 82 82 @implementation WebVideoFullscreenController 83 83 { 84 RefPtr<HTML MediaElement> _mediaElement;84 RefPtr<HTMLVideoElement> _videoElement; 85 85 RefPtr<WebVideoFullscreenInterfaceAVKit> _interface; 86 RefPtr<WebVideoFullscreenModel MediaElement> _model;86 RefPtr<WebVideoFullscreenModelVideoElement> _model; 87 87 WebVideoFullscreenControllerChangeObserver _changeObserver; 88 88 RetainPtr<PlatformLayer> _videoFullscreenLayer; … … 101 101 - (void)dealloc 102 102 { 103 _ mediaElement = nullptr;103 _videoElement = nullptr; 104 104 [super dealloc]; 105 105 } 106 106 107 - (void)set MediaElement:(HTMLMediaElement*)mediaElement107 - (void)setVideoElement:(HTMLVideoElement*)videoElement 108 108 { 109 _ mediaElement = mediaElement;109 _videoElement = videoElement; 110 110 } 111 111 112 - (HTML MediaElement*)mediaElement112 - (HTMLVideoElement*)videoElement 113 113 { 114 return _ mediaElement.get();114 return _videoElement.get(); 115 115 } 116 116 … … 121 121 _interface = adoptRef(new WebVideoFullscreenInterfaceAVKit); 122 122 _interface->setWebVideoFullscreenChangeObserver(&_changeObserver); 123 _model = adoptRef(new WebVideoFullscreenModel MediaElement);123 _model = adoptRef(new WebVideoFullscreenModelVideoElement); 124 124 _model->setWebVideoFullscreenInterface(_interface.get()); 125 125 _interface->setWebVideoFullscreenModel(_model.get()); 126 _model->set MediaElement(_mediaElement.get());126 _model->setVideoElement(_videoElement.get()); 127 127 _videoFullscreenLayer = [CALayer layer]; 128 _interface->setupFullscreen(*_videoFullscreenLayer.get(), _ mediaElement->clientRect(), view);128 _interface->setupFullscreen(*_videoFullscreenLayer.get(), _videoElement->clientRect(), view); 129 129 } 130 130 131 131 - (void)exitFullscreen 132 132 { 133 _interface->exitFullscreen(_ mediaElement->screenRect());133 _interface->exitFullscreen(_videoElement->screenRect()); 134 134 } 135 135 … … 164 164 _interface->setWebVideoFullscreenModel(nullptr); 165 165 _model->setWebVideoFullscreenInterface(nullptr); 166 _model->set MediaElement(nullptr);166 _model->setVideoElement(nullptr); 167 167 _interface->setWebVideoFullscreenChangeObserver(nullptr); 168 168 _model = nullptr; -
trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterface.h
r171288 r173230 51 51 virtual void setSeekableRanges(const TimeRanges&) = 0; 52 52 virtual void setCanPlayFastReverse(bool) = 0; 53 virtual void setAudioMediaSelectionOptions(const Vector< String>& options, uint64_t selectedIndex) = 0;54 virtual void setLegibleMediaSelectionOptions(const Vector< String>& options, uint64_t selectedIndex) = 0;55 virtual void setExternalPlayback(bool enabled, ExternalPlaybackTargetType, String localizedDeviceName) = 0;53 virtual void setAudioMediaSelectionOptions(const Vector<WTF::String>& options, uint64_t selectedIndex) = 0; 54 virtual void setLegibleMediaSelectionOptions(const Vector<WTF::String>& options, uint64_t selectedIndex) = 0; 55 virtual void setExternalPlayback(bool enabled, ExternalPlaybackTargetType, WTF::String localizedDeviceName) = 0; 56 56 }; 57 57 -
trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h
r172849 r173230 31 31 32 32 #include <WebCore/EventListener.h> 33 #include <WebCore/HTMLMediaElement.h>34 33 #include <WebCore/PlatformLayer.h> 35 34 #include <WebCore/WebVideoFullscreenInterface.h> … … 45 44 OBJC_CLASS WebAVVideoLayer; 46 45 46 namespace WTF { 47 class String; 48 } 49 47 50 namespace WebCore { 51 class IntRect; 48 52 class WebVideoFullscreenModel; 49 53 … … 56 60 virtual void didCleanupFullscreen() = 0; 57 61 }; 58 62 59 63 class WebVideoFullscreenInterfaceAVKit 60 64 : public WebVideoFullscreenInterface … … 89 93 WEBCORE_EXPORT virtual void setSeekableRanges(const TimeRanges&) override; 90 94 WEBCORE_EXPORT virtual void setCanPlayFastReverse(bool) override; 91 WEBCORE_EXPORT virtual void setAudioMediaSelectionOptions(const Vector< String>& options, uint64_t selectedIndex) override;92 WEBCORE_EXPORT virtual void setLegibleMediaSelectionOptions(const Vector< String>& options, uint64_t selectedIndex) override;93 WEBCORE_EXPORT virtual void setExternalPlayback(bool enabled, ExternalPlaybackTargetType, String localizedDeviceName) override;95 WEBCORE_EXPORT virtual void setAudioMediaSelectionOptions(const Vector<WTF::String>& options, uint64_t selectedIndex) override; 96 WEBCORE_EXPORT virtual void setLegibleMediaSelectionOptions(const Vector<WTF::String>& options, uint64_t selectedIndex) override; 97 WEBCORE_EXPORT virtual void setExternalPlayback(bool enabled, ExternalPlaybackTargetType, WTF::String localizedDeviceName) override; 94 98 95 WEBCORE_EXPORT virtual void setupFullscreen(PlatformLayer&, WebCore::IntRect initialRect, UIView *);99 WEBCORE_EXPORT virtual void setupFullscreen(PlatformLayer&, IntRect initialRect, UIView *); 96 100 WEBCORE_EXPORT virtual void enterFullscreen(); 97 WEBCORE_EXPORT virtual void exitFullscreen( WebCore::IntRect finalRect);101 WEBCORE_EXPORT virtual void exitFullscreen(IntRect finalRect); 98 102 WEBCORE_EXPORT virtual void cleanupFullscreen(); 99 103 WEBCORE_EXPORT virtual void invalidate(); -
trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm
r171973 r173230 49 49 #import <wtf/RetainPtr.h> 50 50 #import <wtf/text/CString.h> 51 #import <wtf/text/WTFString.h> 51 52 52 53 using namespace WebCore; -
trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelVideoElement.h
r173161 r173230 25 25 26 26 27 #ifndef WebVideoFullscreenModel MediaElement_h28 #define WebVideoFullscreenModel MediaElement_h27 #ifndef WebVideoFullscreenModelVideoElement_h 28 #define WebVideoFullscreenModelVideoElement_h 29 29 30 30 #if PLATFORM(IOS) … … 39 39 40 40 namespace WebCore { 41 class HTML MediaElement;41 class HTMLVideoElement; 42 42 class TextTrack; 43 43 class WebVideoFullscreenInterface; 44 44 45 class WebVideoFullscreenModel MediaElement : public WebVideoFullscreenModel, public EventListener {45 class WebVideoFullscreenModelVideoElement : public WebVideoFullscreenModel, public EventListener { 46 46 public: 47 WEBCORE_EXPORT WebVideoFullscreenModel MediaElement();48 WEBCORE_EXPORT virtual ~WebVideoFullscreenModel MediaElement();47 WEBCORE_EXPORT WebVideoFullscreenModelVideoElement(); 48 WEBCORE_EXPORT virtual ~WebVideoFullscreenModelVideoElement(); 49 49 void setWebVideoFullscreenInterface(WebVideoFullscreenInterface* interface) {m_videoFullscreenInterface = interface;} 50 WEBCORE_EXPORT void set MediaElement(HTMLMediaElement*);50 WEBCORE_EXPORT void setVideoElement(HTMLVideoElement*); 51 51 WEBCORE_EXPORT void setVideoFullscreenLayer(PlatformLayer*); 52 52 … … 76 76 const WTF::AtomicString& eventNameAll(); 77 77 78 RefPtr<HTML MediaElement> m_mediaElement;78 RefPtr<HTMLVideoElement> m_videoElement; 79 79 RetainPtr<PlatformLayer> m_videoFullscreenLayer; 80 80 bool m_isListening; -
trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelVideoElement.mm
r173161 r173230 27 27 28 28 #if PLATFORM(IOS) 29 30 #import "WebVideoFullscreenModelMediaElement.h" 29 #import "WebVideoFullscreenModelVideoElement.h" 31 30 32 31 #import "DOMEventInternal.h" … … 34 33 #import "MediaControlsHost.h" 35 34 #import "WebVideoFullscreenInterface.h" 35 #import <QuartzCore/CoreAnimation.h> 36 36 #import <WebCore/DOMEventListener.h> 37 37 #import <WebCore/Event.h> … … 39 39 #import <WebCore/EventNames.h> 40 40 #import <WebCore/HTMLElement.h> 41 #import <WebCore/HTMLMediaElement.h>42 41 #import <WebCore/HTMLVideoElement.h> 43 42 #import <WebCore/Page.h> … … 47 46 #import <WebCore/TimeRanges.h> 48 47 #import <WebCore/WebCoreThreadRun.h> 49 #import <QuartzCore/CoreAnimation.h>50 48 #import <wtf/NeverDestroyed.h> 51 49 #import <wtf/RetainPtr.h> … … 54 52 using namespace WebCore; 55 53 56 WebVideoFullscreenModel MediaElement::WebVideoFullscreenModelMediaElement()54 WebVideoFullscreenModelVideoElement::WebVideoFullscreenModelVideoElement() 57 55 : EventListener(EventListener::CPPEventListenerType) 58 , m_isListening {false}59 { 60 } 61 62 WebVideoFullscreenModel MediaElement::~WebVideoFullscreenModelMediaElement()63 { 64 } 65 66 void WebVideoFullscreenModel MediaElement::setMediaElement(HTMLMediaElement* mediaElement)67 { 68 if (m_ mediaElement == mediaElement)69 return; 70 71 if (m_ mediaElement && m_isListening) {56 , m_isListening(false) 57 { 58 } 59 60 WebVideoFullscreenModelVideoElement::~WebVideoFullscreenModelVideoElement() 61 { 62 } 63 64 void WebVideoFullscreenModelVideoElement::setVideoElement(HTMLVideoElement* videoElement) 65 { 66 if (m_videoElement == videoElement) 67 return; 68 69 if (m_videoElement && m_isListening) { 72 70 for (auto eventName : observedEventNames()) 73 m_ mediaElement->removeEventListener(eventName, this, false);71 m_videoElement->removeEventListener(eventName, this, false); 74 72 } 75 73 m_isListening = false; 76 74 77 m_ mediaElement = mediaElement;78 79 if (!m_ mediaElement)75 m_videoElement = videoElement; 76 77 if (!m_videoElement) 80 78 return; 81 79 82 80 for (auto eventName : observedEventNames()) 83 m_ mediaElement->addEventListener(eventName, this, false);81 m_videoElement->addEventListener(eventName, this, false); 84 82 m_isListening = true; 85 83 86 84 updateForEventName(eventNameAll()); 87 85 88 if (isHTMLVideoElement(m_mediaElement.get())) { 89 HTMLVideoElement *videoElement = toHTMLVideoElement(m_mediaElement.get()); 90 m_videoFullscreenInterface->setVideoDimensions(true, videoElement->videoWidth(), videoElement->videoHeight()); 91 } else 92 m_videoFullscreenInterface->setVideoDimensions(false, 0, 0); 93 } 94 95 void WebVideoFullscreenModelMediaElement::handleEvent(WebCore::ScriptExecutionContext*, WebCore::Event* event) 86 m_videoFullscreenInterface->setVideoDimensions(true, videoElement->videoWidth(), videoElement->videoHeight()); 87 } 88 89 void WebVideoFullscreenModelVideoElement::handleEvent(WebCore::ScriptExecutionContext*, WebCore::Event* event) 96 90 { 97 91 LOG(Media, "handleEvent %s", event->type().characters8()); … … 99 93 } 100 94 101 void WebVideoFullscreenModel MediaElement::updateForEventName(const WTF::AtomicString& eventName)102 { 103 if (!m_ mediaElement || !m_videoFullscreenInterface)95 void WebVideoFullscreenModelVideoElement::updateForEventName(const WTF::AtomicString& eventName) 96 { 97 if (!m_videoElement || !m_videoFullscreenInterface) 104 98 return; 105 99 … … 108 102 if (all 109 103 || eventName == eventNames().durationchangeEvent) { 110 m_videoFullscreenInterface->setDuration(m_ mediaElement->duration());104 m_videoFullscreenInterface->setDuration(m_videoElement->duration()); 111 105 // These is no standard event for minFastReverseRateChange; duration change is a reasonable proxy for it. 112 106 // It happens every time a new item becomes ready to play. 113 m_videoFullscreenInterface->setCanPlayFastReverse(m_ mediaElement->minFastReverseRate() < 0.0);107 m_videoFullscreenInterface->setCanPlayFastReverse(m_videoElement->minFastReverseRate() < 0.0); 114 108 } 115 109 … … 118 112 || eventName == eventNames().playEvent 119 113 || eventName == eventNames().ratechangeEvent) 120 m_videoFullscreenInterface->setRate(!m_ mediaElement->paused(), m_mediaElement->playbackRate());114 m_videoFullscreenInterface->setRate(!m_videoElement->paused(), m_videoElement->playbackRate()); 121 115 122 116 if (all 123 117 || eventName == eventNames().timeupdateEvent) { 124 m_videoFullscreenInterface->setCurrentTime(m_ mediaElement->currentTime(), [[NSProcessInfo processInfo] systemUptime]);118 m_videoFullscreenInterface->setCurrentTime(m_videoElement->currentTime(), [[NSProcessInfo processInfo] systemUptime]); 125 119 // FIXME: 130788 - find a better event to update seekable ranges from. 126 m_videoFullscreenInterface->setSeekableRanges(*m_ mediaElement->seekable());120 m_videoFullscreenInterface->setSeekableRanges(*m_videoElement->seekable()); 127 121 } 128 122 … … 134 128 if (all 135 129 || eventName == eventNames().webkitcurrentplaybacktargetiswirelesschangedEvent) { 136 bool enabled = m_ mediaElement->mediaSession().currentPlaybackTargetIsWireless(*m_mediaElement);130 bool enabled = m_videoElement->mediaSession().currentPlaybackTargetIsWireless(*m_videoElement); 137 131 WebVideoFullscreenInterface::ExternalPlaybackTargetType targetType = WebVideoFullscreenInterface::TargetTypeNone; 138 132 String localizedDeviceName; 139 133 140 if (m_ mediaElement->mediaControlsHost()) {134 if (m_videoElement->mediaControlsHost()) { 141 135 DEPRECATED_DEFINE_STATIC_LOCAL(String, airplay, (ASCIILiteral("airplay"))); 142 136 DEPRECATED_DEFINE_STATIC_LOCAL(String, tvout, (ASCIILiteral("tvout"))); 143 137 144 String type = m_ mediaElement->mediaControlsHost()->externalDeviceType();138 String type = m_videoElement->mediaControlsHost()->externalDeviceType(); 145 139 if (type == airplay) 146 140 targetType = WebVideoFullscreenInterface::TargetTypeAirPlay; 147 141 else if (type == tvout) 148 142 targetType = WebVideoFullscreenInterface::TargetTypeTVOut; 149 localizedDeviceName = m_ mediaElement->mediaControlsHost()->externalDeviceDisplayName();143 localizedDeviceName = m_videoElement->mediaControlsHost()->externalDeviceDisplayName(); 150 144 } 151 145 m_videoFullscreenInterface->setExternalPlayback(enabled, targetType, localizedDeviceName); … … 153 147 } 154 148 155 void WebVideoFullscreenModel MediaElement::setVideoFullscreenLayer(PlatformLayer* videoLayer)149 void WebVideoFullscreenModelVideoElement::setVideoFullscreenLayer(PlatformLayer* videoLayer) 156 150 { 157 151 if (m_videoFullscreenLayer == videoLayer) … … 161 155 [m_videoFullscreenLayer setFrame:m_videoFrame]; 162 156 163 __block RefPtr<WebVideoFullscreenModelMediaElement> protect(this); 164 WebThreadRun(^{ 165 if (m_mediaElement) 166 m_mediaElement->setVideoFullscreenLayer(m_videoFullscreenLayer.get()); 167 protect.clear(); 168 }); 169 } 170 171 void WebVideoFullscreenModelMediaElement::play() { 172 __block RefPtr<WebVideoFullscreenModelMediaElement> protect(this); 173 WebThreadRun(^{ 174 if (m_mediaElement) 175 m_mediaElement->play(); 176 protect.clear(); 177 }); 178 } 179 180 void WebVideoFullscreenModelMediaElement::pause() 181 { 182 __block RefPtr<WebVideoFullscreenModelMediaElement> protect(this); 183 WebThreadRun(^{ 184 if (m_mediaElement) 185 m_mediaElement->pause(); 186 protect.clear(); 187 }); 188 } 189 190 void WebVideoFullscreenModelMediaElement::togglePlayState() 191 { 192 __block RefPtr<WebVideoFullscreenModelMediaElement> protect(this); 193 WebThreadRun(^{ 194 if (m_mediaElement) 195 m_mediaElement->togglePlayState(); 196 protect.clear(); 197 }); 198 } 199 200 void WebVideoFullscreenModelMediaElement::beginScrubbing() 201 { 202 __block RefPtr<WebVideoFullscreenModelMediaElement> protect(this); 203 WebThreadRun(^{ 204 if (m_mediaElement) 205 m_mediaElement->beginScrubbing(); 206 protect.clear(); 207 }); 208 } 209 210 void WebVideoFullscreenModelMediaElement::endScrubbing() 211 { 212 __block RefPtr<WebVideoFullscreenModelMediaElement> protect(this); 213 WebThreadRun(^{ 214 if (m_mediaElement) 215 m_mediaElement->endScrubbing(); 216 protect.clear(); 217 }); 218 } 219 220 void WebVideoFullscreenModelMediaElement::seekToTime(double time) 221 { 222 __block RefPtr<WebVideoFullscreenModelMediaElement> protect(this); 223 WebThreadRun(^{ 224 if (m_mediaElement) 225 m_mediaElement->setCurrentTime(time); 226 protect.clear(); 227 }); 228 } 229 230 void WebVideoFullscreenModelMediaElement::fastSeek(double time) 231 { 232 __block RefPtr<WebVideoFullscreenModelMediaElement> protect(this); 233 WebThreadRun(^{ 234 if (m_mediaElement) 235 m_mediaElement->fastSeek(time); 236 protect.clear(); 237 }); 238 } 239 240 void WebVideoFullscreenModelMediaElement::beginScanningForward() 241 { 242 __block RefPtr<WebVideoFullscreenModelMediaElement> protect(this); 243 WebThreadRun(^{ 244 if (m_mediaElement) 245 m_mediaElement->beginScanning(MediaControllerInterface::Forward); 246 protect.clear(); 247 }); 248 } 249 250 void WebVideoFullscreenModelMediaElement::beginScanningBackward() 251 { 252 __block RefPtr<WebVideoFullscreenModelMediaElement> protect(this); 253 WebThreadRun(^{ 254 if (m_mediaElement) 255 m_mediaElement->beginScanning(MediaControllerInterface::Backward); 256 protect.clear(); 257 }); 258 } 259 260 void WebVideoFullscreenModelMediaElement::endScanning() 261 { 262 __block RefPtr<WebVideoFullscreenModelMediaElement> protect(this); 263 WebThreadRun(^{ 264 if (m_mediaElement) 265 m_mediaElement->endScanning(); 266 protect.clear(); 267 }); 268 } 269 270 void WebVideoFullscreenModelMediaElement::requestExitFullscreen() 271 { 272 if (!m_mediaElement) 273 return; 274 275 __block RefPtr<WebVideoFullscreenModelMediaElement> protect(this); 276 WebThreadRun(^{ 277 if (m_mediaElement && m_mediaElement->isFullscreen()) 278 m_mediaElement->exitFullscreen(); 279 protect.clear(); 280 }); 281 } 282 283 void WebVideoFullscreenModelMediaElement::setVideoLayerFrame(FloatRect rect) 157 __block RefPtr<WebVideoFullscreenModelVideoElement> protect(this); 158 WebThreadRun(^{ 159 if (m_videoElement) 160 m_videoElement->setVideoFullscreenLayer(m_videoFullscreenLayer.get()); 161 protect.clear(); 162 }); 163 } 164 165 void WebVideoFullscreenModelVideoElement::play() 166 { 167 __block RefPtr<WebVideoFullscreenModelVideoElement> protect(this); 168 WebThreadRun(^{ 169 if (m_videoElement) 170 m_videoElement->play(); 171 protect.clear(); 172 }); 173 } 174 175 void WebVideoFullscreenModelVideoElement::pause() 176 { 177 __block RefPtr<WebVideoFullscreenModelVideoElement> protect(this); 178 WebThreadRun(^{ 179 if (m_videoElement) 180 m_videoElement->pause(); 181 protect.clear(); 182 }); 183 } 184 185 void WebVideoFullscreenModelVideoElement::togglePlayState() 186 { 187 __block RefPtr<WebVideoFullscreenModelVideoElement> protect(this); 188 WebThreadRun(^{ 189 if (m_videoElement) 190 m_videoElement->togglePlayState(); 191 protect.clear(); 192 }); 193 } 194 195 void WebVideoFullscreenModelVideoElement::beginScrubbing() 196 { 197 __block RefPtr<WebVideoFullscreenModelVideoElement> protect(this); 198 WebThreadRun(^{ 199 if (m_videoElement) 200 m_videoElement->beginScrubbing(); 201 protect.clear(); 202 }); 203 } 204 205 void WebVideoFullscreenModelVideoElement::endScrubbing() 206 { 207 __block RefPtr<WebVideoFullscreenModelVideoElement> protect(this); 208 WebThreadRun(^{ 209 if (m_videoElement) 210 m_videoElement->endScrubbing(); 211 protect.clear(); 212 }); 213 } 214 215 void WebVideoFullscreenModelVideoElement::seekToTime(double time) 216 { 217 __block RefPtr<WebVideoFullscreenModelVideoElement> protect(this); 218 WebThreadRun(^{ 219 if (m_videoElement) 220 m_videoElement->setCurrentTime(time); 221 protect.clear(); 222 }); 223 } 224 225 void WebVideoFullscreenModelVideoElement::fastSeek(double time) 226 { 227 __block RefPtr<WebVideoFullscreenModelVideoElement> protect(this); 228 WebThreadRun(^{ 229 if (m_videoElement) 230 m_videoElement->fastSeek(time); 231 protect.clear(); 232 }); 233 } 234 235 void WebVideoFullscreenModelVideoElement::beginScanningForward() 236 { 237 __block RefPtr<WebVideoFullscreenModelVideoElement> protect(this); 238 WebThreadRun(^{ 239 if (m_videoElement) 240 m_videoElement->beginScanning(MediaControllerInterface::Forward); 241 protect.clear(); 242 }); 243 } 244 245 void WebVideoFullscreenModelVideoElement::beginScanningBackward() 246 { 247 __block RefPtr<WebVideoFullscreenModelVideoElement> protect(this); 248 WebThreadRun(^{ 249 if (m_videoElement) 250 m_videoElement->beginScanning(MediaControllerInterface::Backward); 251 protect.clear(); 252 }); 253 } 254 255 void WebVideoFullscreenModelVideoElement::endScanning() 256 { 257 __block RefPtr<WebVideoFullscreenModelVideoElement> protect(this); 258 WebThreadRun(^{ 259 if (m_videoElement) 260 m_videoElement->endScanning(); 261 protect.clear(); 262 }); 263 } 264 265 void WebVideoFullscreenModelVideoElement::requestExitFullscreen() 266 { 267 if (!m_videoElement) 268 return; 269 270 __block RefPtr<WebVideoFullscreenModelVideoElement> protect(this); 271 WebThreadRun(^{ 272 if (m_videoElement && m_videoElement->isFullscreen()) 273 m_videoElement->exitFullscreen(); 274 protect.clear(); 275 }); 276 } 277 278 void WebVideoFullscreenModelVideoElement::setVideoLayerFrame(FloatRect rect) 284 279 { 285 280 m_videoFrame = rect; 286 281 [m_videoFullscreenLayer setFrame:CGRect(rect)]; 287 m_ mediaElement->setVideoFullscreenFrame(rect);288 } 289 290 void WebVideoFullscreenModel MediaElement::setVideoLayerGravity(WebVideoFullscreenModel::VideoGravity gravity)282 m_videoElement->setVideoFullscreenFrame(rect); 283 } 284 285 void WebVideoFullscreenModelVideoElement::setVideoLayerGravity(WebVideoFullscreenModel::VideoGravity gravity) 291 286 { 292 287 MediaPlayer::VideoGravity videoGravity = MediaPlayer::VideoGravityResizeAspect; … … 300 295 ASSERT_NOT_REACHED(); 301 296 302 m_ mediaElement->setVideoFullscreenGravity(videoGravity);303 } 304 305 void WebVideoFullscreenModel MediaElement::selectAudioMediaOption(uint64_t)297 m_videoElement->setVideoFullscreenGravity(videoGravity); 298 } 299 300 void WebVideoFullscreenModelVideoElement::selectAudioMediaOption(uint64_t) 306 301 { 307 302 // FIXME: 131236 Implement audio track selection. 308 303 } 309 304 310 void WebVideoFullscreenModel MediaElement::selectLegibleMediaOption(uint64_t index)305 void WebVideoFullscreenModelVideoElement::selectLegibleMediaOption(uint64_t index) 311 306 { 312 307 TextTrack* textTrack = nullptr; … … 315 310 textTrack = m_legibleTracksForMenu[static_cast<size_t>(index)].get(); 316 311 317 m_ mediaElement->setSelectedTextTrack(textTrack);318 } 319 320 void WebVideoFullscreenModel MediaElement::updateLegibleOptions()321 { 322 TextTrackList* trackList = m_ mediaElement->textTracks();323 if (!trackList || !m_ mediaElement->document().page() || !m_mediaElement->mediaControlsHost())324 return; 325 326 WTF::AtomicString displayMode = m_ mediaElement->mediaControlsHost()->captionDisplayMode();327 TextTrack* offItem = m_ mediaElement->mediaControlsHost()->captionMenuOffItem();328 TextTrack* automaticItem = m_ mediaElement->mediaControlsHost()->captionMenuAutomaticItem();329 CaptionUserPreferences& captionPreferences = *m_ mediaElement->document().page()->group().captionPreferences();312 m_videoElement->setSelectedTextTrack(textTrack); 313 } 314 315 void WebVideoFullscreenModelVideoElement::updateLegibleOptions() 316 { 317 TextTrackList* trackList = m_videoElement->textTracks(); 318 if (!trackList || !m_videoElement->document().page() || !m_videoElement->mediaControlsHost()) 319 return; 320 321 WTF::AtomicString displayMode = m_videoElement->mediaControlsHost()->captionDisplayMode(); 322 TextTrack* offItem = m_videoElement->mediaControlsHost()->captionMenuOffItem(); 323 TextTrack* automaticItem = m_videoElement->mediaControlsHost()->captionMenuAutomaticItem(); 324 CaptionUserPreferences& captionPreferences = *m_videoElement->document().page()->group().captionPreferences(); 330 325 m_legibleTracksForMenu = captionPreferences.sortedTrackListForMenu(trackList); 331 326 Vector<String> trackDisplayNames; … … 360 355 } 361 356 362 const Vector<AtomicString>& WebVideoFullscreenModel MediaElement::observedEventNames()357 const Vector<AtomicString>& WebVideoFullscreenModelVideoElement::observedEventNames() 363 358 { 364 359 static NeverDestroyed<Vector<AtomicString>> sEventNames; … … 377 372 } 378 373 379 const AtomicString& WebVideoFullscreenModel MediaElement::eventNameAll()374 const AtomicString& WebVideoFullscreenModelVideoElement::eventNameAll() 380 375 { 381 376 static NeverDestroyed<AtomicString> sEventNameAll = "allEvents"; -
trunk/Source/WebCore/platform/mac/WebVideoFullscreenController.h
r173176 r173230 33 33 namespace WebCore { 34 34 class DisplaySleepDisabler; 35 class HTML MediaElement;35 class HTMLVideoElement; 36 36 } 37 37 … … 43 43 WEBCORE_EXPORT @interface WebVideoFullscreenController : NSWindowController { 44 44 @private 45 RefPtr<WebCore::HTML MediaElement> _mediaElement; // (retain)45 RefPtr<WebCore::HTMLVideoElement> _videoElement; // (retain) 46 46 id <WebVideoFullscreenControllerDelegate> _delegate; // (assign) 47 47 … … 61 61 62 62 - (void)setupVideoOverlay:(CALayer*)layer; 63 - (void)set MediaElement:(WebCore::HTMLMediaElement*)mediaElement;64 - (WebCore::HTML MediaElement*)mediaElement;63 - (void)setVideoElement:(WebCore::HTMLVideoElement*)videoElement; 64 - (WebCore::HTMLVideoElement*)videoElement; 65 65 66 66 - (void)enterFullscreen:(NSScreen *)screen; -
trunk/Source/WebCore/platform/mac/WebVideoFullscreenController.mm
r167003 r173230 36 36 #import <QTKit/QTKit.h> 37 37 #import <WebCore/DisplaySleepDisabler.h> 38 #import <WebCore/HTML MediaElement.h>38 #import <WebCore/HTMLVideoElement.h> 39 39 #import <WebCore/SoftLinking.h> 40 40 #import <objc/runtime.h> … … 115 115 } 116 116 117 - (HTML MediaElement*)mediaElement118 { 119 return _ mediaElement.get();120 } 121 122 - (void)set MediaElement:(HTMLMediaElement*)mediaElement123 { 124 _ mediaElement = mediaElement;125 126 if (!_ mediaElement)117 - (HTMLVideoElement*)videoElement 118 { 119 return _videoElement.get(); 120 } 121 122 - (void)setVideoElement:(HTMLVideoElement*)videoElement 123 { 124 _videoElement = videoElement; 125 126 if (!_videoElement) 127 127 return; 128 128 129 129 if ([self isWindowLoaded]) { 130 if (_ mediaElement->platformMedia().type == PlatformMedia::QTMovieType) {131 QTMovie *movie = _ mediaElement->platformMedia().media.qtMovie;130 if (_videoElement->platformMedia().type == PlatformMedia::QTMovieType) { 131 QTMovie *movie = _videoElement->platformMedia().media.qtMovie; 132 132 QTMovieLayer *layer = [[getQTMovieLayerClass() alloc] init]; 133 133 [layer setMovie:movie]; … … 139 139 object:movie]; 140 140 141 } else if (_ mediaElement->platformMedia().type == PlatformMedia::AVFoundationMediaPlayerType) {142 AVPlayer *player = _ mediaElement->platformMedia().media.avfMediaPlayer;141 } else if (_videoElement->platformMedia().type == PlatformMedia::AVFoundationMediaPlayerType) { 142 AVPlayer *player = _videoElement->platformMedia().media.avfMediaPlayer; 143 143 AVPlayerLayer *layer = [[getAVPlayerLayerClass() alloc] init]; 144 144 [self setupVideoOverlay:layer]; … … 208 208 } 209 209 210 - (NSRect) mediaElementRect211 { 212 return _ mediaElement->screenRect();210 - (NSRect)videoElementRect 211 { 212 return _videoElement->screenRect(); 213 213 } 214 214 … … 277 277 screen = [NSScreen mainScreen]; 278 278 279 NSRect frame = [self mediaElementRect];279 NSRect frame = [self videoElementRect]; 280 280 NSRect endFrame = [screen frame]; 281 281 constrainFrameToRatioOfFrame(&endFrame, &frame); … … 304 304 [_hudController closeWindow]; 305 305 306 NSRect endFrame = [self mediaElementRect];306 NSRect endFrame = [self videoElementRect]; 307 307 308 308 [self setupFadeAnimationIfNeededAndFadeIn:NO]; … … 359 359 { 360 360 float rate = 0; 361 if (_ mediaElement && _mediaElement->platformMedia().type == PlatformMedia::QTMovieType)362 rate = [_ mediaElement->platformMedia().media.qtMovie rate];361 if (_videoElement && _videoElement->platformMedia().type == PlatformMedia::QTMovieType) 362 rate = [_videoElement->platformMedia().media.qtMovie rate]; 363 363 364 364 if (rate && !_isEndingFullscreen) { … … 374 374 - (void)_requestExit 375 375 { 376 if (_ mediaElement)377 _ mediaElement->exitFullscreen();376 if (_videoElement) 377 _videoElement->exitFullscreen(); 378 378 _forceDisableAnimation = NO; 379 379 } -
trunk/Source/WebKit/mac/ChangeLog
r173215 r173230 1 2014-09-02 Maciej Stachowiak <mjs@apple.com> 2 3 Clean up naming for and slightly refactor legacy video fullscreen support 4 https://bugs.webkit.org/show_bug.cgi?id=136446 5 6 Reviewed by Jer Noble. 7 8 Key changes: 9 supportsFullscreenForNode(Node*) --> supportsVideoFullscreen() 10 enterFullscreenForNode(Node*) --> enterVideoFullscreenForVideoElement(HTMLVideoElement*) 11 exitFullscreenForNode(Node*) --> exitVideoFullscreen() 12 13 The old versions had unnecessary parameters, did not clearly distinguish their purpose 14 from enterFullscreenForElement and friends, and wrongly claimed generality to all Nodes. 15 Also changed many other places to use HTMLVideoElement* instead of Node* or 16 HTMLMediaElement* when they were in fact only used for video elements and would only 17 work for such. 18 19 * WebCoreSupport/WebChromeClient.h: 20 * WebCoreSupport/WebChromeClient.mm: 21 (WebChromeClient::supportsVideoFullscreen): Adjust for main refactoring. 22 Also no more need to check for video elementness. 23 (WebChromeClient::enterVideoFullscreenForVideoElement): Adjust for main refactoring. 24 (WebChromeClient::exitVideoFullscreen): ditto 25 * WebView/WebView.mm: 26 (-[WebView _enterVideoFullscreenForVideoElement:]): Adjust for main 27 refactoring. 28 (-[WebView _exitVideoFullscreen]): ditto 29 (-[WebView _close]): ditto 30 * WebView/WebViewInternal.h: 31 1 32 2014-09-03 Dan Bernstein <mitz@apple.com> 2 33 -
trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h
r171321 r173230 181 181 182 182 #if ENABLE(VIDEO) 183 virtual bool supports FullscreenForNode(const WebCore::Node*) override;184 virtual void enter FullscreenForNode(WebCore::Node*) override;185 virtual void exit FullscreenForNode(WebCore::Node*) override;183 virtual bool supportsVideoFullscreen() override; 184 virtual void enterVideoFullscreenForVideoElement(WebCore::HTMLVideoElement*) override; 185 virtual void exitVideoFullscreen() override; 186 186 #endif 187 187 -
trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm
r171321 r173230 941 941 #if ENABLE(VIDEO) 942 942 943 bool WebChromeClient::supports FullscreenForNode(const Node* node)943 bool WebChromeClient::supportsVideoFullscreen() 944 944 { 945 945 #if PLATFORM(IOS) … … 947 947 return false; 948 948 #endif 949 return isHTMLVideoElement(node);950 } 951 952 void WebChromeClient::enter FullscreenForNode(Node* node)953 { 954 BEGIN_BLOCK_OBJC_EXCEPTIONS; 955 [m_webView _enter FullscreenForNode:node];956 END_BLOCK_OBJC_EXCEPTIONS; 957 } 958 959 void WebChromeClient::exit FullscreenForNode(Node*)960 { 961 BEGIN_BLOCK_OBJC_EXCEPTIONS; 962 [m_webView _exit Fullscreen];949 return true; 950 } 951 952 void WebChromeClient::enterVideoFullscreenForVideoElement(HTMLVideoElement* videoElement) 953 { 954 BEGIN_BLOCK_OBJC_EXCEPTIONS; 955 [m_webView _enterVideoFullscreenForVideoElement:videoElement]; 956 END_BLOCK_OBJC_EXCEPTIONS; 957 } 958 959 void WebChromeClient::exitVideoFullscreen() 960 { 961 BEGIN_BLOCK_OBJC_EXCEPTIONS; 962 [m_webView _exitVideoFullscreen]; 963 963 END_BLOCK_OBJC_EXCEPTIONS; 964 964 } -
trunk/Source/WebKit/mac/WebView/WebView.mm
r173047 r173230 135 135 #import <WebCore/GeolocationController.h> 136 136 #import <WebCore/GeolocationError.h> 137 #import <WebCore/HTMLMediaElement.h>138 137 #import <WebCore/HTMLNames.h> 138 #import <WebCore/HTMLVideoElement.h> 139 139 #import <WebCore/HistoryController.h> 140 140 #import <WebCore/HistoryItem.h> … … 1700 1700 1701 1701 #if ENABLE(VIDEO) && !PLATFORM(IOS) 1702 [self _exit Fullscreen];1702 [self _exitVideoFullscreen]; 1703 1703 #endif 1704 1704 … … 8389 8389 8390 8390 #if ENABLE(VIDEO) 8391 - (void)_enterFullscreenForNode:(WebCore::Node*)node 8392 { 8393 ASSERT(isHTMLVideoElement(node)); 8394 HTMLMediaElement* videoElement = toHTMLMediaElement(node); 8395 8391 - (void)_enterVideoFullscreenForVideoElement:(WebCore::HTMLVideoElement*)videoElement 8392 { 8396 8393 if (_private->fullscreenController) { 8397 if ([_private->fullscreenController mediaElement] == videoElement) {8394 if ([_private->fullscreenController videoElement] == videoElement) { 8398 8395 // The backend may just warn us that the underlaying plaftormMovie() 8399 8396 // has changed. Just force an update. 8400 [_private->fullscreenController set MediaElement:videoElement];8397 [_private->fullscreenController setVideoElement:videoElement]; 8401 8398 return; // No more to do. 8402 8399 } 8403 8400 8404 // First exit Fullscreen for the old mediaElement.8405 [_private->fullscreenController mediaElement]->exitFullscreen();8401 // First exit Fullscreen for the old videoElement. 8402 [_private->fullscreenController videoElement]->exitFullscreen(); 8406 8403 // This previous call has to trigger _exitFullscreen, 8407 8404 // which has to clear _private->fullscreenController. … … 8410 8407 if (!_private->fullscreenController) { 8411 8408 _private->fullscreenController = [[WebVideoFullscreenController alloc] init]; 8412 [_private->fullscreenController set MediaElement:videoElement];8409 [_private->fullscreenController setVideoElement:videoElement]; 8413 8410 #if PLATFORM(IOS) 8414 8411 [_private->fullscreenController enterFullscreen:(UIView *)[[[self window] hostLayer] delegate]]; … … 8418 8415 } 8419 8416 else 8420 [_private->fullscreenController set MediaElement:videoElement];8421 } 8422 8423 - (void)_exit Fullscreen8417 [_private->fullscreenController setVideoElement:videoElement]; 8418 } 8419 8420 - (void)_exitVideoFullscreen 8424 8421 { 8425 8422 if (!_private->fullscreenController) -
trunk/Source/WebKit/mac/WebView/WebViewInternal.h
r168434 r173230 54 54 class Page; 55 55 class RenderBox; 56 class Node;56 class HTMLVideoElement; 57 57 struct DictationAlternative; 58 58 } … … 234 234 235 235 #if ENABLE(VIDEO) && defined(__cplusplus) 236 - (void)_enter FullscreenForNode:(WebCore::Node*)node;237 - (void)_exit Fullscreen;236 - (void)_enterVideoFullscreenForVideoElement:(WebCore::HTMLVideoElement*)videoElement; 237 - (void)_exitVideoFullscreen; 238 238 #endif 239 239 -
trunk/Source/WebKit/win/ChangeLog
r173207 r173230 1 2014-09-02 Maciej Stachowiak <mjs@apple.com> 2 3 Clean up naming for and slightly refactor legacy video fullscreen support 4 https://bugs.webkit.org/show_bug.cgi?id=136446 5 6 Reviewed by Jer Noble. 7 8 Key changes: 9 supportsFullscreenForNode(Node*) --> supportsVideoFullscreen() 10 enterFullscreenForNode(Node*) --> enterVideoFullscreenForVideoElement(HTMLVideoElement*) 11 exitFullscreenForNode(Node*) --> exitVideoFullscreen() 12 13 The old versions had unnecessary parameters, did not clearly distinguish their purpose 14 from enterFullscreenForElement and friends, and wrongly claimed generality to all Nodes. 15 Also changed many other places to use HTMLVideoElement* instead of Node* or 16 HTMLMediaElement* when they were in fact only used for video elements and would only 17 work for such. 18 19 * WebCoreSupport/WebChromeClient.cpp: 20 (WebChromeClient::supportsVideoFullscreen): Adjust for the 21 main refactoring. 22 (WebChromeClient::enterVideoFullscreenForVideoElement): ditto 23 (WebChromeClient::exitVideoFullscreen): ditto 24 * WebCoreSupport/WebChromeClient.h: 25 * WebView.cpp: 26 (WebView::enterVideoFullscreenForVideoElement): Adjust for the 27 main refactoring. 28 (WebView::exitVideoFullscreen): ditto. 29 * WebView.h: 30 * FullscreenVideoController.cpp: Use video elements, not media elements throughout 31 (FullscreenVideoController::LayerClient::platformCALayerLayoutSublayersOfLayer): 32 (FullscreenVideoController::setVideoElement): 33 (FullscreenVideoController::enterFullscreen): 34 (FullscreenVideoController::exitFullscreen): 35 (FullscreenVideoController::canPlay): 36 (FullscreenVideoController::play): 37 (FullscreenVideoController::pause): 38 (FullscreenVideoController::volume): 39 (FullscreenVideoController::setVolume): 40 (FullscreenVideoController::currentTime): 41 (FullscreenVideoController::setCurrentTime): 42 (FullscreenVideoController::duration): 43 (FullscreenVideoController::beginScrubbing): 44 (FullscreenVideoController::endScrubbing): 45 (FullscreenVideoController::onChar): 46 (FullscreenVideoController::onKeyDown): 47 (FullscreenVideoController::onMouseUp): 48 * FullscreenVideoController.h: 49 (FullscreenVideoController::videoElement): 50 1 51 2014-09-03 Brent Fulgham <bfulgham@apple.com> 2 52 -
trunk/Source/WebKit/win/FullscreenVideoController.cpp
r167670 r173230 206 206 ASSERT_ARG(layer, layer == m_parent->m_rootChild); 207 207 208 HTML MediaElement* mediaElement = m_parent->m_mediaElement.get();209 if (! mediaElement)208 HTMLVideoElement* videoElement = m_parent->m_videoElement.get(); 209 if (!videoElement) 210 210 return; 211 211 212 212 213 PlatformCALayer* videoLayer = PlatformCALayer::platformCALayer( mediaElement->platformLayer());213 PlatformCALayer* videoLayer = PlatformCALayer::platformCALayer(videoElement->platformLayer()); 214 214 if (!videoLayer || videoLayer->superlayer() != layer) 215 215 return; … … 217 217 FloatRect layerBounds = layer->bounds(); 218 218 219 FloatSize videoSize = mediaElement->player()->naturalSize();219 FloatSize videoSize = videoElement->player()->naturalSize(); 220 220 float scaleFactor; 221 221 if (videoSize.aspectRatio() > layerBounds.size().aspectRatio()) … … 258 258 } 259 259 260 void FullscreenVideoController::set MediaElement(HTMLMediaElement* mediaElement)261 { 262 if ( mediaElement == m_mediaElement)260 void FullscreenVideoController::setVideoElement(HTMLVideoElement* videoElement) 261 { 262 if (videoElement == m_videoElement) 263 263 return; 264 264 265 m_ mediaElement = mediaElement;266 if (!m_ mediaElement) {265 m_videoElement = videoElement; 266 if (!m_videoElement) { 267 267 // Can't do full-screen, just get out 268 268 exitFullscreen(); … … 272 272 void FullscreenVideoController::enterFullscreen() 273 273 { 274 if (!m_ mediaElement)274 if (!m_videoElement) 275 275 return; 276 276 277 WebView* webView = kit(m_ mediaElement->document().page());277 WebView* webView = kit(m_videoElement->document().page()); 278 278 HWND parentHwnd = webView ? webView->viewWindow() : 0; 279 279 … … 282 282 m_fullscreenWindow->setRootChildLayer(m_rootChild); 283 283 284 PlatformCALayer* videoLayer = PlatformCALayer::platformCALayer(m_ mediaElement->platformLayer());284 PlatformCALayer* videoLayer = PlatformCALayer::platformCALayer(m_videoElement->platformLayer()); 285 285 m_rootChild->appendSublayer(videoLayer); 286 286 m_rootChild->setNeedsLayout(); … … 305 305 m_hudWindow = 0; 306 306 307 // We previously ripped the mediaElement's platform layer out307 // We previously ripped the videoElement's platform layer out 308 308 // of its orginial layer tree to display it in our fullscreen 309 309 // window. Now, we need to get the layer back in its original … … 313 313 // the player's layer will be recreated, and will be picked up 314 314 // the next time the layer tree is synched. 315 m_ mediaElement->player()->setVisible(0);316 m_ mediaElement->player()->setVisible(1);315 m_videoElement->player()->setVisible(0); 316 m_videoElement->player()->setVisible(1); 317 317 } 318 318 319 319 bool FullscreenVideoController::canPlay() const 320 320 { 321 return m_ mediaElement && m_mediaElement->canPlay();321 return m_videoElement && m_videoElement->canPlay(); 322 322 } 323 323 324 324 void FullscreenVideoController::play() 325 325 { 326 if (m_ mediaElement)327 m_ mediaElement->play();326 if (m_videoElement) 327 m_videoElement->play(); 328 328 } 329 329 330 330 void FullscreenVideoController::pause() 331 331 { 332 if (m_ mediaElement)333 m_ mediaElement->pause();332 if (m_videoElement) 333 m_videoElement->pause(); 334 334 } 335 335 336 336 float FullscreenVideoController::volume() const 337 337 { 338 return m_ mediaElement ? m_mediaElement->volume() : 0;338 return m_videoElement ? m_videoElement->volume() : 0; 339 339 } 340 340 341 341 void FullscreenVideoController::setVolume(float volume) 342 342 { 343 if (m_ mediaElement) {343 if (m_videoElement) { 344 344 ExceptionCode ec; 345 m_ mediaElement->setVolume(volume, ec);345 m_videoElement->setVolume(volume, ec); 346 346 } 347 347 } … … 349 349 float FullscreenVideoController::currentTime() const 350 350 { 351 return m_ mediaElement ? m_mediaElement->currentTime() : 0;351 return m_videoElement ? m_videoElement->currentTime() : 0; 352 352 } 353 353 354 354 void FullscreenVideoController::setCurrentTime(float value) 355 355 { 356 if (m_ mediaElement)357 m_ mediaElement->setCurrentTime(value);356 if (m_videoElement) 357 m_videoElement->setCurrentTime(value); 358 358 } 359 359 360 360 float FullscreenVideoController::duration() const 361 361 { 362 return m_ mediaElement ? m_mediaElement->duration() : 0;362 return m_videoElement ? m_videoElement->duration() : 0; 363 363 } 364 364 365 365 void FullscreenVideoController::beginScrubbing() 366 366 { 367 if (m_ mediaElement)368 m_ mediaElement->beginScrubbing();367 if (m_videoElement) 368 m_videoElement->beginScrubbing(); 369 369 } 370 370 371 371 void FullscreenVideoController::endScrubbing() 372 372 { 373 if (m_ mediaElement)374 m_ mediaElement->endScrubbing();373 if (m_videoElement) 374 m_videoElement->endScrubbing(); 375 375 } 376 376 … … 581 581 { 582 582 if (c == VK_ESCAPE) { 583 if (m_ mediaElement)584 m_ mediaElement->exitFullscreen();583 if (m_videoElement) 584 m_videoElement->exitFullscreen(); 585 585 } else if (c == VK_SPACE) 586 586 togglePlay(); … … 590 590 { 591 591 if (virtualKey == VK_ESCAPE) { 592 if (m_ mediaElement)593 m_ mediaElement->exitFullscreen();592 if (m_videoElement) 593 m_videoElement->exitFullscreen(); 594 594 } 595 595 } … … 674 674 else if (m_hitWidget == &m_exitFullscreenButton && m_exitFullscreenButton.hitTest(convertedPoint)) { 675 675 m_hitWidget = 0; 676 if (m_ mediaElement)677 m_ mediaElement->exitFullscreen();676 if (m_videoElement) 677 m_videoElement->exitFullscreen(); 678 678 return; 679 679 } -
trunk/Source/WebKit/win/FullscreenVideoController.h
r165676 r173230 31 31 #include "MediaPlayerPrivateFullscreenWindow.h" 32 32 33 #include <WebCore/HTML MediaElement.h>33 #include <WebCore/HTMLVideoElement.h> 34 34 #include <WebCore/Image.h> 35 35 #include <WebCore/IntPoint.h> … … 108 108 virtual ~FullscreenVideoController(); 109 109 110 void set MediaElement(WebCore::HTMLMediaElement*);111 WebCore::HTML MediaElement* mediaElement() const { return m_mediaElement.get(); }110 void setVideoElement(WebCore::HTMLVideoElement*); 111 WebCore::HTMLVideoElement* videoElement() const { return m_videoElement.get(); } 112 112 113 113 void enterFullscreen(); … … 150 150 void onKeyDown(int virtualKey); 151 151 152 RefPtr<WebCore::HTML MediaElement> m_mediaElement;152 RefPtr<WebCore::HTMLVideoElement> m_videoElement; 153 153 154 154 HWND m_hudWindow; -
trunk/Source/WebKit/win/WebCoreSupport/WebChromeClient.cpp
r172977 r173230 774 774 #if ENABLE(VIDEO) 775 775 776 bool WebChromeClient::supports FullscreenForNode(const Node* node)777 { 778 return isHTMLVideoElement(node);779 } 780 781 void WebChromeClient::enter FullscreenForNode(Node* node)782 { 783 m_webView->enter FullscreenForNode(node);784 } 785 786 void WebChromeClient::exit FullscreenForNode(Node*)787 { 788 m_webView->exit Fullscreen();776 bool WebChromeClient::supportsVideoFullscreen() 777 { 778 return true; 779 } 780 781 void WebChromeClient::enterVideoFullscreenForVideoElement(HTMLVideoElement* videoElement) 782 { 783 m_webView->enterVideoFullscreenForVideoElement(videoElement); 784 } 785 786 void WebChromeClient::exitVideoFullscreen() 787 { 788 m_webView->exitVideoFullscreen(); 789 789 } 790 790 -
trunk/Source/WebKit/win/WebCoreSupport/WebChromeClient.h
r165676 r173230 149 149 150 150 #if ENABLE(VIDEO) 151 virtual bool supports FullscreenForNode(const WebCore::Node*);152 virtual void enter FullscreenForNode(WebCore::Node*);153 virtual void exit FullscreenForNode(WebCore::Node*);151 virtual bool supportsVideoFullscreen(); 152 virtual void enterVideoFullscreenForVideoElement(WebCore::HTMLVideoElement*); 153 virtual void exitVideoFullscreen(); 154 154 #endif 155 155 -
trunk/Source/WebKit/win/WebView.cpp
r173207 r173230 102 102 #include <WebCore/GeolocationError.h> 103 103 #include <WebCore/GraphicsContext.h> 104 #include <WebCore/HTMLMediaElement.h>105 104 #include <WebCore/HTMLNames.h> 105 #include <WebCore/HTMLVideoElement.h> 106 106 #include <WebCore/HWndDC.h> 107 107 #include <WebCore/HistoryController.h> … … 6282 6282 } 6283 6283 6284 void WebView::enter FullscreenForNode(Node* node)6284 void WebView::enterVideoFullscreenForVideoElement(HTMLVideoElement* videoElement) 6285 6285 { 6286 6286 #if ENABLE(VIDEO) && !USE(GSTREAMER) && !USE(MEDIA_FOUNDATION) 6287 if (!isHTMLVideoElement(node) || !node->isElementNode())6288 return;6289 6290 if (!toElement(node)->isMediaElement())6291 return;6292 HTMLMediaElement* videoElement = toHTMLMediaElement(node);6293 6294 6287 if (m_fullScreenVideoController) { 6295 if (m_fullScreenVideoController-> mediaElement() == videoElement) {6288 if (m_fullScreenVideoController->videoElement() == videoElement) { 6296 6289 // The backend may just warn us that the underlaying plaftormMovie() 6297 6290 // has changed. Just force an update. 6298 m_fullScreenVideoController->set MediaElement(videoElement);6291 m_fullScreenVideoController->setVideoElement(videoElement); 6299 6292 return; // No more to do. 6300 6293 } 6301 6294 6302 // First exit Fullscreen for the old mediaElement.6303 m_fullScreenVideoController-> mediaElement()->exitFullscreen();6295 // First exit Fullscreen for the old videoElement. 6296 m_fullScreenVideoController->videoElement()->exitFullscreen(); 6304 6297 // This previous call has to trigger exitFullscreen, 6305 6298 // which has to clear m_fullScreenVideoController. … … 6308 6301 6309 6302 m_fullScreenVideoController = std::make_unique<FullscreenVideoController>(); 6310 m_fullScreenVideoController->set MediaElement(videoElement);6303 m_fullScreenVideoController->setVideoElement(videoElement); 6311 6304 m_fullScreenVideoController->enterFullscreen(); 6312 6305 #endif 6313 6306 } 6314 6307 6315 void WebView::exit Fullscreen()6308 void WebView::exitVideoFullscreen() 6316 6309 { 6317 6310 #if ENABLE(VIDEO) && !USE(GSTREAMER) && !USE(MEDIA_FOUNDATION) -
trunk/Source/WebKit/win/WebView.h
r172977 r173230 56 56 struct GraphicsDeviceAdapter; 57 57 #endif 58 class HTMLVideoElement; 58 59 } 59 60 … … 941 942 #endif 942 943 943 void enter FullscreenForNode(WebCore::Node*);944 void exit Fullscreen();944 void enterVideoFullscreenForVideoElement(WebCore::HTMLVideoElement*); 945 void exitVideoFullscreen(); 945 946 946 947 void setLastCursor(HCURSOR cursor) { m_lastSetCursor = cursor; } -
trunk/Source/WebKit2/ChangeLog
r173215 r173230 1 2014-09-02 Maciej Stachowiak <mjs@apple.com> 2 3 Clean up naming for and slightly refactor legacy video fullscreen support 4 https://bugs.webkit.org/show_bug.cgi?id=136446 5 6 Reviewed by Jer Noble. 7 8 Key changes: 9 supportsFullscreenForNode(Node*) --> supportsVideoFullscreen() 10 enterFullscreenForNode(Node*) --> enterVideoFullscreenForVideoElement(HTMLVideoElement*) 11 exitFullscreenForNode(Node*) --> exitVideoFullscreen() 12 13 The old versions had unnecessary parameters, did not clearly distinguish their purpose 14 from enterFullscreenForElement and friends, and wrongly claimed generality to all Nodes. 15 Also changed many other places to use HTMLVideoElement* instead of Node* or 16 HTMLMediaElement* when they were in fact only used for video elements and would only 17 work for such. 18 19 Legacy video fullscreen in WebKit2 is only supported on iOS (for other ports that support 20 it, it's WK1 only). 21 22 * WebProcess/WebCoreSupport/WebChromeClient.cpp: 23 (WebKit::WebChromeClient::supportsVideoFullscreen): Adjust for renames as 24 mentioned. 25 (WebKit::WebChromeClient::enterVideoFullscreenForVideoElement): ditto 26 (WebKit::WebChromeClient::exitVideoFullscreen): ditto 27 * WebProcess/WebCoreSupport/WebChromeClient.h: 28 * WebProcess/ios/WebVideoFullscreenManager.h: 29 * WebProcess/ios/WebVideoFullscreenManager.mm: 30 (WebKit::clientRectForElement): No need to be generic to node. 31 (WebKit::WebVideoFullscreenManager::supportsVideoFullscreen): Adjust for the 32 main refactoring. Also change m_node to m_videoElement with appropriate type change. 33 (WebKit::WebVideoFullscreenManager::enterVideoFullscreenForVideoElement): ditto 34 (WebKit::WebVideoFullscreenManager::exitVideoFullscreen): ditto 35 (WebKit::WebVideoFullscreenManager::didEnterFullscreen): ditto 36 (WebKit::WebVideoFullscreenManager::didExitFullscreen): ditto 37 (WebKit::WebVideoFullscreenManager::didCleanupFullscreen): ditto 38 1 39 2014-09-03 Dan Bernstein <mitz@apple.com> 2 40 -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
r172729 r173230 903 903 904 904 #if PLATFORM(IOS) 905 bool WebChromeClient::supports FullscreenForNode(const WebCore::Node* node)906 { 907 return m_page->videoFullscreenManager()->supports Fullscreen(node);908 } 909 910 void WebChromeClient::enter FullscreenForNode(WebCore::Node* node)911 { 912 m_page->videoFullscreenManager()->enter FullscreenForNode(node);913 } 914 915 void WebChromeClient::exit FullscreenForNode(WebCore::Node* node)916 { 917 m_page->videoFullscreenManager()->exit FullscreenForNode(node);905 bool WebChromeClient::supportsVideoFullscreen() 906 { 907 return m_page->videoFullscreenManager()->supportsVideoFullscreen(); 908 } 909 910 void WebChromeClient::enterVideoFullscreenForVideoElement(WebCore::HTMLVideoElement* videoElement) 911 { 912 m_page->videoFullscreenManager()->enterVideoFullscreenForVideoElement(videoElement); 913 } 914 915 void WebChromeClient::exitVideoFullscreen() 916 { 917 m_page->videoFullscreenManager()->exitVideoFullscreen(); 918 918 } 919 919 #endif -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h
r172729 r173230 254 254 255 255 #if PLATFORM(IOS) 256 virtual bool supports FullscreenForNode(const WebCore::Node*);257 virtual void enter FullscreenForNode(WebCore::Node*);258 virtual void exit FullscreenForNode(WebCore::Node*);256 virtual bool supportsVideoFullscreen(); 257 virtual void enterVideoFullscreenForVideoElement(WebCore::HTMLVideoElement*); 258 virtual void exitVideoFullscreen(); 259 259 #endif 260 260 -
trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.h
r171288 r173230 32 32 #include <WebCore/PlatformCALayer.h> 33 33 #include <WebCore/WebVideoFullscreenInterface.h> 34 #include <WebCore/WebVideoFullscreenModel MediaElement.h>34 #include <WebCore/WebVideoFullscreenModelVideoElement.h> 35 35 #include <wtf/RefCounted.h> 36 36 #include <wtf/RefPtr.h> … … 51 51 class WebPage; 52 52 53 class WebVideoFullscreenManager : public WebCore::WebVideoFullscreenModel MediaElement, public WebCore::WebVideoFullscreenInterface, private IPC::MessageReceiver {53 class WebVideoFullscreenManager : public WebCore::WebVideoFullscreenModelVideoElement, public WebCore::WebVideoFullscreenInterface, private IPC::MessageReceiver { 54 54 public: 55 55 static PassRefPtr<WebVideoFullscreenManager> create(PassRefPtr<WebPage>); … … 58 58 void didReceiveMessage(IPC::Connection*, IPC::MessageDecoder&); 59 59 60 bool supports Fullscreen(const WebCore::Node*) const;61 void enter FullscreenForNode(WebCore::Node*);62 void exit FullscreenForNode(WebCore::Node*);60 bool supportsVideoFullscreen() const; 61 void enterVideoFullscreenForVideoElement(WebCore::HTMLVideoElement*); 62 void exitVideoFullscreen(); 63 63 64 64 protected: … … 86 86 87 87 WebPage* m_page; 88 RefPtr<WebCore:: Node> m_node;88 RefPtr<WebCore::HTMLVideoElement> m_videoElement; 89 89 std::unique_ptr<LayerHostingContext> m_layerHostingContext; 90 90 -
trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm
r171973 r173230 51 51 namespace WebKit { 52 52 53 static IntRect clientRectFor Node(Node* node)54 { 55 if (! node || !node->isElementNode())53 static IntRect clientRectForElement(HTMLElement* element) 54 { 55 if (!element) 56 56 return IntRect(); 57 57 58 return toElement(node)->clientRect();58 return element->clientRect(); 59 59 } 60 60 … … 79 79 } 80 80 81 bool WebVideoFullscreenManager::supports Fullscreen(const Node* node) const82 { 83 return Settings::avKitEnabled() && isHTMLVideoElement(node);84 } 85 86 void WebVideoFullscreenManager::enter FullscreenForNode(Node* node)87 { 88 ASSERT(node);89 m_node = node; 81 bool WebVideoFullscreenManager::supportsVideoFullscreen() const 82 { 83 return Settings::avKitEnabled(); 84 } 85 86 void WebVideoFullscreenManager::enterVideoFullscreenForVideoElement(HTMLVideoElement* videoElement) 87 { 88 m_videoElement = videoElement; 89 90 90 m_targetIsFullscreen = true; 91 91 … … 94 94 95 95 m_isAnimating = true; 96 set MediaElement(toHTMLMediaElement(node));96 setVideoElement(videoElement); 97 97 98 98 m_layerHostingContext = LayerHostingContext::createForExternalHostingProcess(); 99 99 100 m_page->send(Messages::WebVideoFullscreenManagerProxy::SetupFullscreenWithID(m_layerHostingContext->contextID(), clientRectFor Node(node)), m_page->pageID());101 } 102 103 void WebVideoFullscreenManager::exit FullscreenForNode(Node* node)104 { 105 m_node.clear();100 m_page->send(Messages::WebVideoFullscreenManagerProxy::SetupFullscreenWithID(m_layerHostingContext->contextID(), clientRectForElement(videoElement)), m_page->pageID()); 101 } 102 103 void WebVideoFullscreenManager::exitVideoFullscreen() 104 { 105 RefPtr<HTMLVideoElement> videoElement = m_videoElement.release(); 106 106 m_targetIsFullscreen = false; 107 107 … … 110 110 111 111 m_isAnimating = true; 112 m_page->send(Messages::WebVideoFullscreenManagerProxy::ExitFullscreen(clientRectFor Node(node)), m_page->pageID());112 m_page->send(Messages::WebVideoFullscreenManagerProxy::ExitFullscreen(clientRectForElement(videoElement.get())), m_page->pageID()); 113 113 } 114 114 … … 192 192 193 193 // exit fullscreen now if it was previously requested during an animation. 194 __block RefPtr<WebVideoFullscreenModel MediaElement> protect(this);194 __block RefPtr<WebVideoFullscreenModelVideoElement> protect(this); 195 195 WebThreadRun(^ { 196 exit FullscreenForNode(m_node.get());196 exitVideoFullscreen(); 197 197 protect.clear(); 198 198 }); … … 202 202 { 203 203 setVideoFullscreenLayer(nil); 204 __block RefPtr<WebVideoFullscreenModel MediaElement> protect(this);204 __block RefPtr<WebVideoFullscreenModelVideoElement> protect(this); 205 205 206 206 dispatch_async(dispatch_get_main_queue(), ^{ … … 217 217 m_isFullscreen = false; 218 218 219 set MediaElement(nullptr);219 setVideoElement(nullptr); 220 220 221 221 if (!m_targetIsFullscreen) … … 223 223 224 224 // enter fullscreen now if it was previously requested during an animation. 225 __block RefPtr<WebVideoFullscreenModel MediaElement> protect(this);225 __block RefPtr<WebVideoFullscreenModelVideoElement> protect(this); 226 226 WebThreadRun(^ { 227 enter FullscreenForNode(m_node.get());227 enterVideoFullscreenForVideoElement(m_videoElement.get()); 228 228 protect.clear(); 229 229 });
Note: See TracChangeset
for help on using the changeset viewer.