Changeset 173230 in webkit


Ignore:
Timestamp:
Sep 3, 2014 2:32:25 PM (10 years ago)
Author:
mjs@apple.com
Message:

Clean up naming for and slightly refactor legacy video fullscreen support
https://bugs.webkit.org/show_bug.cgi?id=136446

Reviewed by Jer Noble.

Key changes:
supportsFullscreenForNode(Node*) --> supportsVideoFullscreen()
enterFullscreenForNode(Node*) --> enterVideoFullscreenForVideoElement(HTMLVideoElement*)
exitFullscreenForNode(Node*) --> exitVideoFullscreen()

The old versions had unnecessary parameters, did not clearly distinguish their purpose
from enterFullscreenForElement and friends, and wrongly claimed generality to all Nodes.
Also changed many other places to use HTMLVideoElement* instead of Node* or
HTMLMediaElement* when they were in fact only used for video elements and would only
work for such.

Source/WebCore:

The implications of this include a bunch of renaming in some iOS fullscreen code.

  • html/HTMLMediaElement.cpp:

(WebCore::HTMLMediaElement::HTMLMediaElement): Rename m_isFullscreen flag to
m_isInVideoFullscreen, since it only covers the case of legacy video fullscreen,
not element fullscreen.
(WebCore::HTMLMediaElement::stop): ditto
(WebCore::HTMLMediaElement::requiresTextTrackRepresentation): ditto
(WebCore::HTMLMediaElement::isFullscreen): ditto
(WebCore::HTMLMediaElement::enterFullscreen): Rename m_isFullscreen flag to
m_isInVideoFullscreen. Hoist video element check here from all supportsFullscrenForNode
clients. Adjust for relevant ChromeClient refactorings.
(WebCore::HTMLMediaElement::enterFullscreen): ditto above

  • html/HTMLMediaElement.h:
  • html/HTMLVideoElement.cpp:

(WebCore::HTMLVideoElement::supportsFullscreen): Adjust for relevant ChromeClient
refactorings.

  • page/ChromeClient.h:

(WebCore::ChromeClient::supportsVideoFullscreen): Renamed from
supportsFullscreenForNode, and removed Node* parameter.
(WebCore::ChromeClient::enterVideoFullscreenForVideoElement): Renamed from
enterFulscreenForNode and changed Node* parameter to HTMLVideoElement*.
(WebCore::ChromeClient::exitVideoFullscreen): Renamed from
exitFullscreenForNode, and removed Node* parameter.

  • platform/ios/WebVideoFullscreenControllerAVKit.h:
  • platform/ios/WebVideoFullscreenControllerAVKit.mm:

(-[WebVideoFullscreenController videoElement]): Renamed from mediaElement;
return a video element and not just a media element.
(-[WebVideoFullscreenController dealloc]): Renamed _mediaElement data member
to _videoElement and changed type accordingly.
(-[WebVideoFullscreenController setVideoElement:]): Renamed from setMediaElement:
and adjust parameter type accordingly.
(-[WebVideoFullscreenController enterFullscreen:]): Video elements, not media
elements.
(-[WebVideoFullscreenController exitFullscreen]): ditto
(-[WebVideoFullscreenController didCleanupFullscreen]): ditto

  • platform/ios/WebVideoFullscreenInterface.h:
  • platform/ios/WebVideoFullscreenInterfaceAVKit.h: Remove gratuitous HTMLMEdiaElement.h include

and fix declarations accordingly.

  • platform/ios/WebVideoFullscreenInterfaceAVKit.mm: Include WTFString.h
  • platform/ios/WebVideoFullscreenModelVideoElement.h: Renamed from Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.h.
  • platform/ios/WebVideoFullscreenModelVideoElement.mm: Renamed from Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.mm.

(WebVideoFullscreenModelVideoElement) Renamed from WebVideoFullscreenModelMediaElement
(WebVideoFullscreenModelVideoElement::setVideoElement): Renamed from setMediaElement and
change param type accordingly. Also no need to check for actual videoness of the element.
(WebVideoFullscreenModelVideoElement::updateForEventName): Rename data member from m_mediaElement
to m_videoElement and change type accordingly.
(WebVideoFullscreenModelVideoElement::setVideoFullscreenLayer): ditto
(WebVideoFullscreenModelVideoElement::play): ditto
(WebVideoFullscreenModelVideoElement::pause): ditto
(WebVideoFullscreenModelVideoElement::togglePlayState): ditto
(WebVideoFullscreenModelVideoElement::beginScrubbing): ditto
(WebVideoFullscreenModelVideoElement::endScrubbing): ditto
(WebVideoFullscreenModelVideoElement::seekToTime): ditto
(WebVideoFullscreenModelVideoElement::fastSeek): ditto
(WebVideoFullscreenModelVideoElement::beginScanningForward): ditto
(WebVideoFullscreenModelVideoElement::beginScanningBackward): ditto
(WebVideoFullscreenModelVideoElement::endScanning): ditto
(WebVideoFullscreenModelVideoElement::requestExitFullscreen): ditto
(WebVideoFullscreenModelVideoElement::setVideoLayerFrame): ditto
(WebVideoFullscreenModelVideoElement::setVideoLayerGravity): ditto
(WebVideoFullscreenModelVideoElement::updateLegibleOptions): ditto

  • platform/mac/WebVideoFullscreenController.h:
  • platform/mac/WebVideoFullscreenController.mm:

(-[WebVideoFullscreenController videoElement]): Renamed from mediaElement
and update return type accordingly.
(-[WebVideoFullscreenController setVideoElement:]): Renamed from
setMediaElement and update return type accordingly.
(-[WebVideoFullscreenController videoElementRect]): Renamed
from mediaElementRect.
(-[WebVideoFullscreenController enterFullscreen:]): Update for
rename.
(-[WebVideoFullscreenController exitFullscreen]): ditto
(-[WebVideoFullscreenController updatePowerAssertions]): Rename
member from _mediaElement to _videoElement
(-[WebVideoFullscreenController _requestExit]): ditto

  • WebCore.exp.in: Adjust for function and class renames.
  • WebCore.xcodeproj/project.pbxproj: Adjust for file renames.

Source/WebKit/mac:

  • WebCoreSupport/WebChromeClient.h:
  • WebCoreSupport/WebChromeClient.mm:

(WebChromeClient::supportsVideoFullscreen): Adjust for main refactoring.
Also no more need to check for video elementness.
(WebChromeClient::enterVideoFullscreenForVideoElement): Adjust for main refactoring.
(WebChromeClient::exitVideoFullscreen): ditto

  • WebView/WebView.mm:

(-[WebView _enterVideoFullscreenForVideoElement:]): Adjust for main
refactoring.
(-[WebView _exitVideoFullscreen]): ditto
(-[WebView _close]): ditto

  • WebView/WebViewInternal.h:

Source/WebKit/win:

  • WebCoreSupport/WebChromeClient.cpp:

(WebChromeClient::supportsVideoFullscreen): Adjust for the
main refactoring.
(WebChromeClient::enterVideoFullscreenForVideoElement): ditto
(WebChromeClient::exitVideoFullscreen): ditto

  • WebCoreSupport/WebChromeClient.h:
  • WebView.cpp:

(WebView::enterVideoFullscreenForVideoElement): Adjust for the
main refactoring.
(WebView::exitVideoFullscreen): ditto.

  • WebView.h:
  • FullscreenVideoController.cpp: Use video elements, not media elements throughout

(FullscreenVideoController::LayerClient::platformCALayerLayoutSublayersOfLayer):
(FullscreenVideoController::setVideoElement):
(FullscreenVideoController::enterFullscreen):
(FullscreenVideoController::exitFullscreen):
(FullscreenVideoController::canPlay):
(FullscreenVideoController::play):
(FullscreenVideoController::pause):
(FullscreenVideoController::volume):
(FullscreenVideoController::setVolume):
(FullscreenVideoController::currentTime):
(FullscreenVideoController::setCurrentTime):
(FullscreenVideoController::duration):
(FullscreenVideoController::beginScrubbing):
(FullscreenVideoController::endScrubbing):
(FullscreenVideoController::onChar):
(FullscreenVideoController::onKeyDown):
(FullscreenVideoController::onMouseUp):

  • FullscreenVideoController.h:

(FullscreenVideoController::videoElement):

Source/WebKit2:

Legacy video fullscreen in WebKit2 is only supported on iOS (for other ports that support
it, it's WK1 only).

  • WebProcess/WebCoreSupport/WebChromeClient.cpp:

(WebKit::WebChromeClient::supportsVideoFullscreen): Adjust for renames as
mentioned.
(WebKit::WebChromeClient::enterVideoFullscreenForVideoElement): ditto
(WebKit::WebChromeClient::exitVideoFullscreen): ditto

  • WebProcess/WebCoreSupport/WebChromeClient.h:
  • WebProcess/ios/WebVideoFullscreenManager.h:
  • WebProcess/ios/WebVideoFullscreenManager.mm:

(WebKit::clientRectForElement): No need to be generic to node.
(WebKit::WebVideoFullscreenManager::supportsVideoFullscreen): Adjust for the
main refactoring. Also change m_node to m_videoElement with appropriate type change.
(WebKit::WebVideoFullscreenManager::enterVideoFullscreenForVideoElement): ditto
(WebKit::WebVideoFullscreenManager::exitVideoFullscreen): ditto
(WebKit::WebVideoFullscreenManager::didEnterFullscreen): ditto
(WebKit::WebVideoFullscreenManager::didExitFullscreen): ditto
(WebKit::WebVideoFullscreenManager::didCleanupFullscreen): ditto

Location:
trunk/Source
Files:
31 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r173229 r173230  
     12014-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
    1982014-09-03  Benjamin Poulain  <benjamin@webkit.org>
    299
  • trunk/Source/WebCore/WebCore.exp.in

    r173192 r173230  
    10701070__ZN7WebCore37WidgetHierarchyUpdatesSuspensionScope11moveWidgetsEv
    10711071__ZN7WebCore37WidgetHierarchyUpdatesSuspensionScope35s_widgetHierarchyUpdateSuspendCountE
    1072 #if !USE(CFNETWORK)
    1073 __ZN7WebCore37synthesizeRedirectResponseIfNecessaryEP15NSURLConnectionP12NSURLRequestP13NSURLResponse
    1074 #endif
    10751072__ZN7WebCore3URL10invalidateEv
    10761073__ZN7WebCore3URL11setProtocolERKN3WTF6StringE
     
    29762973#if !USE(CFNETWORK)
    29772974__ZN7WebCore14ResourceHandle25continueWillCacheResponseEP19NSCachedURLResponse
     2975__ZN7WebCore37synthesizeRedirectResponseIfNecessaryEP15NSURLConnectionP12NSURLRequestP13NSURLResponse
    29782976#endif
    29792977
     
    34333431
    34343432#if ENABLE(VIDEO) && PLATFORM(IOS)
    3435 __ZN7WebCore35WebVideoFullscreenModelMediaElement10seekToTimeEd
    3436 __ZN7WebCore35WebVideoFullscreenModelMediaElement11endScanningEv
    3437 __ZN7WebCore35WebVideoFullscreenModelMediaElement11handleEventEPNS_22ScriptExecutionContextEPNS_5EventE
    3438 __ZN7WebCore35WebVideoFullscreenModelMediaElement12endScrubbingEv
    3439 __ZN7WebCore35WebVideoFullscreenModelMediaElement14beginScrubbingEv
    3440 __ZN7WebCore35WebVideoFullscreenModelMediaElement15setMediaElementEPNS_16HTMLMediaElementE
    3441 __ZN7WebCore35WebVideoFullscreenModelMediaElement15togglePlayStateEv
    3442 __ZN7WebCore35WebVideoFullscreenModelMediaElement18setVideoLayerFrameENS_9FloatRectE
    3443 __ZN7WebCore35WebVideoFullscreenModelMediaElement20beginScanningForwardEv
    3444 __ZN7WebCore35WebVideoFullscreenModelMediaElement20setVideoLayerGravityENS_23WebVideoFullscreenModel12VideoGravityE
    3445 __ZN7WebCore35WebVideoFullscreenModelMediaElement21beginScanningBackwardEv
    3446 __ZN7WebCore35WebVideoFullscreenModelMediaElement21requestExitFullscreenEv
    3447 __ZN7WebCore35WebVideoFullscreenModelMediaElement22selectAudioMediaOptionEy
    3448 __ZN7WebCore35WebVideoFullscreenModelMediaElement23setVideoFullscreenLayerEP7CALayer
    3449 __ZN7WebCore35WebVideoFullscreenModelMediaElement24selectLegibleMediaOptionEy
    3450 __ZN7WebCore35WebVideoFullscreenModelMediaElement4playEv
    3451 __ZN7WebCore35WebVideoFullscreenModelMediaElement5pauseEv
    3452 __ZN7WebCore35WebVideoFullscreenModelMediaElement8fastSeekEd
    3453 __ZN7WebCore35WebVideoFullscreenModelMediaElementC2Ev
    3454 __ZN7WebCore35WebVideoFullscreenModelMediaElementD2Ev
     3433__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
    34553453__ZNK7WebCore16HTMLVideoElement10videoWidthEv
    34563454__ZNK7WebCore16HTMLVideoElement11videoHeightEv
    3457 __ZTVN7WebCore35WebVideoFullscreenModelMediaElementE
    3458 __ZThn?_N7WebCore35WebVideoFullscreenModelMediaElement11handleEventEPNS_22ScriptExecutionContextEPNS_5EventE
     3455__ZThn4_N7WebCore35WebVideoFullscreenModelVideoElement11handleEventEPNS_22ScriptExecutionContextEPNS_5EventE
    34593456#endif
    34603457
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r173220 r173230  
    13581358                3FBC4AEA189880EF0046EE38 /* WebVideoFullscreenModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 3FBC4AE9189880EF0046EE38 /* WebVideoFullscreenModel.h */; settings = {ATTRIBUTES = (Private, ); }; };
    13591359                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, ); }; };
    13621360                3FBC4AF3189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3FBC4AF1189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.mm */; };
    13631361                3FBC4AF4189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 3FBC4AF2189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    22042202                65DF326109D1E199000BE325 /* UserAgentStyleSheetsData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 656581AF09D14EE6000E61D7 /* UserAgentStyleSheetsData.cpp */; };
    22052203                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 */; };
    22062206                65FEA86909833ADE00BED4AB /* Page.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65FEA86809833ADE00BED4AB /* Page.cpp */; };
    22072207                6B3480940EEF50D400AC1B41 /* NativeImagePtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B3480920EEF50D400AC1B41 /* NativeImagePtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    83578357                3FBC4AE9189880EF0046EE38 /* WebVideoFullscreenModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebVideoFullscreenModel.h; path = ios/WebVideoFullscreenModel.h; sourceTree = "<group>"; };
    83588358                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>"; };
    83618359                3FBC4AF1189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebVideoFullscreenInterfaceAVKit.mm; path = ios/WebVideoFullscreenInterfaceAVKit.mm; sourceTree = "<group>"; };
    83628360                3FBC4AF2189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebVideoFullscreenInterfaceAVKit.h; path = ios/WebVideoFullscreenInterfaceAVKit.h; sourceTree = "<group>"; };
     
    92679265                657EDA071385CB97004E0645 /* MemoryPressureHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryPressureHandler.h; sourceTree = "<group>"; };
    92689266                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>"; };
    92699269                6593923509AE4346002C531F /* URL.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = URL.cpp; sourceTree = "<group>"; };
    92709270                6593923609AE4346002C531F /* URL.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = URL.h; sourceTree = "<group>"; };
     
    1846118461                                3FBC4AF1189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.mm */,
    1846218462                                3FBC4AE9189880EF0046EE38 /* WebVideoFullscreenModel.h */,
    18463                                 3FBC4AEE189881380046EE38 /* WebVideoFullscreenModelMediaElement.h */,
    18464                                 3FBC4AED189881380046EE38 /* WebVideoFullscreenModelMediaElement.mm */,
     18463                                6586FE3C19B548BD005C3C82 /* WebVideoFullscreenModelVideoElement.h */,
     18464                                6586FE3D19B548BD005C3C82 /* WebVideoFullscreenModelVideoElement.mm */,
    1846518465                                E453903C0EAFD637003695C8 /* WidgetIOS.mm */,
    1846618466                        );
     
    2560025600                                D70AD65813E1342B005B50B4 /* RenderRegion.h in Headers */,
    2560125601                                BCE93F451517C567008CCF74 /* RenderRegionSet.h in Headers */,
     25602                                65FD466519B596F0001E2B4D /* WebVideoFullscreenModelVideoElement.h in Headers */,
    2560225603                                A871DFE30A15376B00B12A68 /* RenderReplaced.h in Headers */,
    2560325604                                BCA846D70DC67A350026C309 /* RenderReplica.h in Headers */,
     
    2653126532                                3FBC4AF4189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.h in Headers */,
    2653226533                                3FBC4AEA189880EF0046EE38 /* WebVideoFullscreenModel.h in Headers */,
    26533                                 3FBC4AF0189881380046EE38 /* WebVideoFullscreenModelMediaElement.h in Headers */,
    2653426534                                F12171F616A8CF0B000053CA /* WebVTTElement.h in Headers */,
    2653526535                                5D21A80313ECE5DF00BB7064 /* WebVTTParser.h in Headers */,
     
    2756127561                                A7CA595E0B27BD9E00FA021D /* DragController.cpp in Sources */,
    2756227562                                A71878900B2D04AC00A16ECE /* DragControllerMac.mm in Sources */,
     27563                                65FD466619B596F6001E2B4D /* WebVideoFullscreenModelVideoElement.mm in Sources */,
    2756327564                                A79546430B5C4CB4007B438F /* DragData.cpp in Sources */,
    2756427565                                A795463E0B5C4C80007B438F /* DragDataMac.mm in Sources */,
     
    2980729808                                7C73FB0C191EF5A8007DE061 /* JSUserMessageHandlersNamespace.cpp in Sources */,
    2980829809                                3FBC4AF3189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.mm in Sources */,
    29809                                 3FBC4AEF189881380046EE38 /* WebVideoFullscreenModelMediaElement.mm in Sources */,
    2981029810                                F12171F516A8CED2000053CA /* WebVTTElement.cpp in Sources */,
    2981129811                                5D21A80213ECE5DF00BB7064 /* WebVTTParser.cpp in Sources */,
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r172868 r173230  
    306306    , m_pausedInternal(false)
    307307    , m_sendProgressEvents(true)
    308     , m_isFullscreen(false)
     308    , m_isInVideoFullscreen(false)
    309309    , m_closedCaptionsVisible(false)
    310310    , m_webkitLegacyClosedCaptionOverride(false)
     
    683683        if (m_networkState > NETWORK_EMPTY)
    684684            pause();
    685         if (m_isFullscreen)
     685        if (m_isInVideoFullscreen)
    686686            exitFullscreen();
    687687
     
    46484648{
    46494649    LOG(Media, "HTMLMediaElement::stop");
    4650     if (m_isFullscreen)
     4650    if (m_isInVideoFullscreen)
    46514651        exitFullscreen();
    46524652   
     
    47424742bool HTMLMediaElement::requiresTextTrackRepresentation() const
    47434743{
    4744     return m_isFullscreen && m_player ? m_player->requiresTextTrackRepresentation() : false;
     4744    return m_isInVideoFullscreen && m_player ? m_player->requiresTextTrackRepresentation() : false;
    47454745}
    47464746
     
    48344834bool HTMLMediaElement::isFullscreen() const
    48354835{
    4836     if (m_isFullscreen)
     4836    if (m_isInVideoFullscreen)
    48374837        return true;
    48384838   
     
    48584858{
    48594859    LOG(Media, "HTMLMediaElement::enterFullscreen");
    4860     if (m_isFullscreen)
     4860    if (m_isInVideoFullscreen)
    48614861        return;
    48624862
     
    48684868#endif
    48694869
    4870     m_isFullscreen = true;
     4870    m_isInVideoFullscreen = true;
    48714871    if (hasMediaControls())
    48724872        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);
    48764877            scheduleEvent(eventNames().webkitbeginfullscreenEvent);
    48774878        }
     
    48904891    }
    48914892#endif
    4892     ASSERT(m_isFullscreen);
    4893     m_isFullscreen = false;
     4893    ASSERT(m_isInVideoFullscreen);
     4894    m_isInVideoFullscreen = false;
    48944895    if (hasMediaControls())
    48954896        mediaControls()->exitedFullscreen();
    4896     if (document().page()) {
     4897    if (document().page() && isHTMLVideoElement(this)) {
    48974898        if (m_mediaSession->requiresFullscreenForVideoPlayback(*this))
    48984899            pauseInternal();
    48994900
    4900         if (document().page()->chrome().client().supportsFullscreenForNode(this)) {
    4901             document().page()->chrome().client().exitFullscreenForNode(this);
     4901        if (document().page()->chrome().client().supportsVideoFullscreen()) {
     4902            document().page()->chrome().client().exitVideoFullscreen();
    49024903            scheduleEvent(eventNames().webkitendfullscreenEvent);
    49034904        }
  • trunk/Source/WebCore/html/HTMLMediaElement.h

    r172868 r173230  
    817817    bool m_sendProgressEvents : 1;
    818818
    819     bool m_isFullscreen : 1;
     819    bool m_isInVideoFullscreen : 1;
    820820    bool m_closedCaptionsVisible : 1;
    821821    bool m_webkitLegacyClosedCaptionOverride : 1;
  • trunk/Source/WebCore/html/HTMLVideoElement.cpp

    r170774 r173230  
    158158        return false;
    159159
    160     return page->chrome().client().supportsFullscreenForNode(this);
     160    return page->chrome().client().supportsVideoFullscreen();
    161161#endif // PLATFORM(IOS)
    162162}
  • trunk/Source/WebCore/page/ChromeClient.h

    r172729 r173230  
    340340#endif
    341341
    342     virtual bool supportsFullscreenForNode(const Node*) { return false; }
    343     virtual void enterFullscreenForNode(Node*) { }
    344     virtual void exitFullscreenForNode(Node*) { }
     342    virtual bool supportsVideoFullscreen() { return false; }
     343    virtual void enterVideoFullscreenForVideoElement(HTMLVideoElement*) { }
     344    virtual void exitVideoFullscreen() { }
    345345    virtual bool requiresFullscreenForVideoPlayback() { return false; }
    346346
  • trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.h

    r173176 r173230  
    2929#if PLATFORM(IOS)
    3030
    31 #import <WebCore/HTMLMediaElement.h>
     31#import <WebCore/HTMLVideoElement.h>
    3232
    3333OBJC_CLASS UIView;
    3434
    3535WEBCORE_EXPORT @interface WebVideoFullscreenController : NSObject
    36 - (void)setMediaElement:(WebCore::HTMLMediaElement*)mediaElement;
    37 - (WebCore::HTMLMediaElement*)mediaElement;
     36- (void)setVideoElement:(WebCore::HTMLVideoElement*)videoElement;
     37- (WebCore::HTMLVideoElement*)videoElement;
    3838- (void)enterFullscreen:(UIView *)view;
    3939- (void)exitFullscreen;
  • trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm

    r171973 r173230  
    3232#import "Logging.h"
    3333#import "WebVideoFullscreenInterfaceAVKit.h"
    34 #import "WebVideoFullscreenModelMediaElement.h"
     34#import "WebVideoFullscreenModelVideoElement.h"
    3535#import <QuartzCore/CoreAnimation.h>
    3636#import <WebCore/WebCoreThreadRun.h>
     
    4141
    4242@implementation WebVideoFullscreenController
    43 - (void)setMediaElement:(WebCore::HTMLMediaElement*)mediaElement
     43- (void)setVideoElement:(WebCore::HTMLVideoElement*)videoElement
    4444{
    45     UNUSED_PARAM(mediaElement);
     45    UNUSED_PARAM(videoElement);
    4646}
    4747
    48 - (WebCore::HTMLMediaElement*)mediaElement
     48- (WebCore::HTMLVideoElement*)videoElement
    4949{
    5050    return nullptr;
     
    8282@implementation WebVideoFullscreenController
    8383{
    84     RefPtr<HTMLMediaElement> _mediaElement;
     84    RefPtr<HTMLVideoElement> _videoElement;
    8585    RefPtr<WebVideoFullscreenInterfaceAVKit> _interface;
    86     RefPtr<WebVideoFullscreenModelMediaElement> _model;
     86    RefPtr<WebVideoFullscreenModelVideoElement> _model;
    8787    WebVideoFullscreenControllerChangeObserver _changeObserver;
    8888    RetainPtr<PlatformLayer> _videoFullscreenLayer;
     
    101101- (void)dealloc
    102102{
    103     _mediaElement = nullptr;
     103    _videoElement = nullptr;
    104104    [super dealloc];
    105105}
    106106
    107 - (void)setMediaElement:(HTMLMediaElement*)mediaElement
     107- (void)setVideoElement:(HTMLVideoElement*)videoElement
    108108{
    109     _mediaElement = mediaElement;
     109    _videoElement = videoElement;
    110110}
    111111
    112 - (HTMLMediaElement*)mediaElement
     112- (HTMLVideoElement*)videoElement
    113113{
    114     return _mediaElement.get();
     114    return _videoElement.get();
    115115}
    116116
     
    121121    _interface = adoptRef(new WebVideoFullscreenInterfaceAVKit);
    122122    _interface->setWebVideoFullscreenChangeObserver(&_changeObserver);
    123     _model = adoptRef(new WebVideoFullscreenModelMediaElement);
     123    _model = adoptRef(new WebVideoFullscreenModelVideoElement);
    124124    _model->setWebVideoFullscreenInterface(_interface.get());
    125125    _interface->setWebVideoFullscreenModel(_model.get());
    126     _model->setMediaElement(_mediaElement.get());
     126    _model->setVideoElement(_videoElement.get());
    127127    _videoFullscreenLayer = [CALayer layer];
    128     _interface->setupFullscreen(*_videoFullscreenLayer.get(), _mediaElement->clientRect(), view);
     128    _interface->setupFullscreen(*_videoFullscreenLayer.get(), _videoElement->clientRect(), view);
    129129}
    130130
    131131- (void)exitFullscreen
    132132{
    133     _interface->exitFullscreen(_mediaElement->screenRect());
     133    _interface->exitFullscreen(_videoElement->screenRect());
    134134}
    135135
     
    164164        _interface->setWebVideoFullscreenModel(nullptr);
    165165        _model->setWebVideoFullscreenInterface(nullptr);
    166         _model->setMediaElement(nullptr);
     166        _model->setVideoElement(nullptr);
    167167        _interface->setWebVideoFullscreenChangeObserver(nullptr);
    168168        _model = nullptr;
  • trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterface.h

    r171288 r173230  
    5151    virtual void setSeekableRanges(const TimeRanges&) = 0;
    5252    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;
    5656};
    5757
  • trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h

    r172849 r173230  
    3131
    3232#include <WebCore/EventListener.h>
    33 #include <WebCore/HTMLMediaElement.h>
    3433#include <WebCore/PlatformLayer.h>
    3534#include <WebCore/WebVideoFullscreenInterface.h>
     
    4544OBJC_CLASS WebAVVideoLayer;
    4645
     46namespace WTF {
     47class String;
     48}
     49
    4750namespace WebCore {
     51class IntRect;
    4852class WebVideoFullscreenModel;
    4953   
     
    5660    virtual void didCleanupFullscreen() = 0;
    5761};
    58    
     62
    5963class WebVideoFullscreenInterfaceAVKit
    6064    : public WebVideoFullscreenInterface
     
    8993    WEBCORE_EXPORT virtual void setSeekableRanges(const TimeRanges&) override;
    9094    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;
    9498
    95     WEBCORE_EXPORT virtual void setupFullscreen(PlatformLayer&, WebCore::IntRect initialRect, UIView *);
     99    WEBCORE_EXPORT virtual void setupFullscreen(PlatformLayer&, IntRect initialRect, UIView *);
    96100    WEBCORE_EXPORT virtual void enterFullscreen();
    97     WEBCORE_EXPORT virtual void exitFullscreen(WebCore::IntRect finalRect);
     101    WEBCORE_EXPORT virtual void exitFullscreen(IntRect finalRect);
    98102    WEBCORE_EXPORT virtual void cleanupFullscreen();
    99103    WEBCORE_EXPORT virtual void invalidate();
  • trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm

    r171973 r173230  
    4949#import <wtf/RetainPtr.h>
    5050#import <wtf/text/CString.h>
     51#import <wtf/text/WTFString.h>
    5152
    5253using namespace WebCore;
  • trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelVideoElement.h

    r173161 r173230  
    2525
    2626
    27 #ifndef WebVideoFullscreenModelMediaElement_h
    28 #define WebVideoFullscreenModelMediaElement_h
     27#ifndef WebVideoFullscreenModelVideoElement_h
     28#define WebVideoFullscreenModelVideoElement_h
    2929
    3030#if PLATFORM(IOS)
     
    3939
    4040namespace WebCore {
    41 class HTMLMediaElement;
     41class HTMLVideoElement;
    4242class TextTrack;
    4343class WebVideoFullscreenInterface;
    4444
    45 class WebVideoFullscreenModelMediaElement : public WebVideoFullscreenModel, public EventListener {
     45class WebVideoFullscreenModelVideoElement : public WebVideoFullscreenModel, public EventListener {
    4646public:
    47     WEBCORE_EXPORT WebVideoFullscreenModelMediaElement();
    48     WEBCORE_EXPORT virtual ~WebVideoFullscreenModelMediaElement();
     47    WEBCORE_EXPORT WebVideoFullscreenModelVideoElement();
     48    WEBCORE_EXPORT virtual ~WebVideoFullscreenModelVideoElement();
    4949    void setWebVideoFullscreenInterface(WebVideoFullscreenInterface* interface) {m_videoFullscreenInterface = interface;}
    50     WEBCORE_EXPORT void setMediaElement(HTMLMediaElement*);
     50    WEBCORE_EXPORT void setVideoElement(HTMLVideoElement*);
    5151    WEBCORE_EXPORT void setVideoFullscreenLayer(PlatformLayer*);
    5252   
     
    7676    const WTF::AtomicString& eventNameAll();
    7777   
    78     RefPtr<HTMLMediaElement> m_mediaElement;
     78    RefPtr<HTMLVideoElement> m_videoElement;
    7979    RetainPtr<PlatformLayer> m_videoFullscreenLayer;
    8080    bool m_isListening;
  • trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelVideoElement.mm

    r173161 r173230  
    2727
    2828#if PLATFORM(IOS)
    29 
    30 #import "WebVideoFullscreenModelMediaElement.h"
     29#import "WebVideoFullscreenModelVideoElement.h"
    3130
    3231#import "DOMEventInternal.h"
     
    3433#import "MediaControlsHost.h"
    3534#import "WebVideoFullscreenInterface.h"
     35#import <QuartzCore/CoreAnimation.h>
    3636#import <WebCore/DOMEventListener.h>
    3737#import <WebCore/Event.h>
     
    3939#import <WebCore/EventNames.h>
    4040#import <WebCore/HTMLElement.h>
    41 #import <WebCore/HTMLMediaElement.h>
    4241#import <WebCore/HTMLVideoElement.h>
    4342#import <WebCore/Page.h>
     
    4746#import <WebCore/TimeRanges.h>
    4847#import <WebCore/WebCoreThreadRun.h>
    49 #import <QuartzCore/CoreAnimation.h>
    5048#import <wtf/NeverDestroyed.h>
    5149#import <wtf/RetainPtr.h>
     
    5452using namespace WebCore;
    5553
    56 WebVideoFullscreenModelMediaElement::WebVideoFullscreenModelMediaElement()
     54WebVideoFullscreenModelVideoElement::WebVideoFullscreenModelVideoElement()
    5755    : EventListener(EventListener::CPPEventListenerType)
    58     , m_isListening{false}
    59 {
    60 }
    61 
    62 WebVideoFullscreenModelMediaElement::~WebVideoFullscreenModelMediaElement()
    63 {
    64 }
    65 
    66 void WebVideoFullscreenModelMediaElement::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
     60WebVideoFullscreenModelVideoElement::~WebVideoFullscreenModelVideoElement()
     61{
     62}
     63
     64void WebVideoFullscreenModelVideoElement::setVideoElement(HTMLVideoElement* videoElement)
     65{
     66    if (m_videoElement == videoElement)
     67        return;
     68
     69    if (m_videoElement && m_isListening) {
    7270        for (auto eventName : observedEventNames())
    73             m_mediaElement->removeEventListener(eventName, this, false);
     71            m_videoElement->removeEventListener(eventName, this, false);
    7472    }
    7573    m_isListening = false;
    7674
    77     m_mediaElement = mediaElement;
    78 
    79     if (!m_mediaElement)
     75    m_videoElement = videoElement;
     76
     77    if (!m_videoElement)
    8078        return;
    8179
    8280    for (auto eventName : observedEventNames())
    83         m_mediaElement->addEventListener(eventName, this, false);
     81        m_videoElement->addEventListener(eventName, this, false);
    8482    m_isListening = true;
    8583
    8684    updateForEventName(eventNameAll());
    8785
    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
     89void WebVideoFullscreenModelVideoElement::handleEvent(WebCore::ScriptExecutionContext*, WebCore::Event* event)
    9690{
    9791    LOG(Media, "handleEvent %s", event->type().characters8());
     
    9993}
    10094
    101 void WebVideoFullscreenModelMediaElement::updateForEventName(const WTF::AtomicString& eventName)
    102 {
    103     if (!m_mediaElement || !m_videoFullscreenInterface)
     95void WebVideoFullscreenModelVideoElement::updateForEventName(const WTF::AtomicString& eventName)
     96{
     97    if (!m_videoElement || !m_videoFullscreenInterface)
    10498        return;
    10599   
     
    108102    if (all
    109103        || eventName == eventNames().durationchangeEvent) {
    110         m_videoFullscreenInterface->setDuration(m_mediaElement->duration());
     104        m_videoFullscreenInterface->setDuration(m_videoElement->duration());
    111105        // These is no standard event for minFastReverseRateChange; duration change is a reasonable proxy for it.
    112106        // 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);
    114108    }
    115109
     
    118112        || eventName == eventNames().playEvent
    119113        || eventName == eventNames().ratechangeEvent)
    120         m_videoFullscreenInterface->setRate(!m_mediaElement->paused(), m_mediaElement->playbackRate());
     114        m_videoFullscreenInterface->setRate(!m_videoElement->paused(), m_videoElement->playbackRate());
    121115
    122116    if (all
    123117        || eventName == eventNames().timeupdateEvent) {
    124         m_videoFullscreenInterface->setCurrentTime(m_mediaElement->currentTime(), [[NSProcessInfo processInfo] systemUptime]);
     118        m_videoFullscreenInterface->setCurrentTime(m_videoElement->currentTime(), [[NSProcessInfo processInfo] systemUptime]);
    125119        // 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());
    127121    }
    128122
     
    134128    if (all
    135129        || eventName == eventNames().webkitcurrentplaybacktargetiswirelesschangedEvent) {
    136         bool enabled = m_mediaElement->mediaSession().currentPlaybackTargetIsWireless(*m_mediaElement);
     130        bool enabled = m_videoElement->mediaSession().currentPlaybackTargetIsWireless(*m_videoElement);
    137131        WebVideoFullscreenInterface::ExternalPlaybackTargetType targetType = WebVideoFullscreenInterface::TargetTypeNone;
    138132        String localizedDeviceName;
    139133
    140         if (m_mediaElement->mediaControlsHost()) {
     134        if (m_videoElement->mediaControlsHost()) {
    141135            DEPRECATED_DEFINE_STATIC_LOCAL(String, airplay, (ASCIILiteral("airplay")));
    142136            DEPRECATED_DEFINE_STATIC_LOCAL(String, tvout, (ASCIILiteral("tvout")));
    143137           
    144             String type = m_mediaElement->mediaControlsHost()->externalDeviceType();
     138            String type = m_videoElement->mediaControlsHost()->externalDeviceType();
    145139            if (type == airplay)
    146140                targetType = WebVideoFullscreenInterface::TargetTypeAirPlay;
    147141            else if (type == tvout)
    148142                targetType = WebVideoFullscreenInterface::TargetTypeTVOut;
    149             localizedDeviceName = m_mediaElement->mediaControlsHost()->externalDeviceDisplayName();
     143            localizedDeviceName = m_videoElement->mediaControlsHost()->externalDeviceDisplayName();
    150144        }
    151145        m_videoFullscreenInterface->setExternalPlayback(enabled, targetType, localizedDeviceName);
     
    153147}
    154148
    155 void WebVideoFullscreenModelMediaElement::setVideoFullscreenLayer(PlatformLayer* videoLayer)
     149void WebVideoFullscreenModelVideoElement::setVideoFullscreenLayer(PlatformLayer* videoLayer)
    156150{
    157151    if (m_videoFullscreenLayer == videoLayer)
     
    161155    [m_videoFullscreenLayer setFrame:m_videoFrame];
    162156   
    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
     165void 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
     175void 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
     185void 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
     195void 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
     205void 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
     215void 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
     225void 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
     235void 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
     245void 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
     255void 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
     265void 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
     278void WebVideoFullscreenModelVideoElement::setVideoLayerFrame(FloatRect rect)
    284279{
    285280    m_videoFrame = rect;
    286281    [m_videoFullscreenLayer setFrame:CGRect(rect)];
    287     m_mediaElement->setVideoFullscreenFrame(rect);
    288 }
    289 
    290 void WebVideoFullscreenModelMediaElement::setVideoLayerGravity(WebVideoFullscreenModel::VideoGravity gravity)
     282    m_videoElement->setVideoFullscreenFrame(rect);
     283}
     284
     285void WebVideoFullscreenModelVideoElement::setVideoLayerGravity(WebVideoFullscreenModel::VideoGravity gravity)
    291286{
    292287    MediaPlayer::VideoGravity videoGravity = MediaPlayer::VideoGravityResizeAspect;
     
    300295        ASSERT_NOT_REACHED();
    301296   
    302     m_mediaElement->setVideoFullscreenGravity(videoGravity);
    303 }
    304 
    305 void WebVideoFullscreenModelMediaElement::selectAudioMediaOption(uint64_t)
     297    m_videoElement->setVideoFullscreenGravity(videoGravity);
     298}
     299
     300void WebVideoFullscreenModelVideoElement::selectAudioMediaOption(uint64_t)
    306301{
    307302    // FIXME: 131236 Implement audio track selection.
    308303}
    309304
    310 void WebVideoFullscreenModelMediaElement::selectLegibleMediaOption(uint64_t index)
     305void WebVideoFullscreenModelVideoElement::selectLegibleMediaOption(uint64_t index)
    311306{
    312307    TextTrack* textTrack = nullptr;
     
    315310        textTrack = m_legibleTracksForMenu[static_cast<size_t>(index)].get();
    316311   
    317     m_mediaElement->setSelectedTextTrack(textTrack);
    318 }
    319 
    320 void WebVideoFullscreenModelMediaElement::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
     315void 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();
    330325    m_legibleTracksForMenu = captionPreferences.sortedTrackListForMenu(trackList);
    331326    Vector<String> trackDisplayNames;
     
    360355}
    361356
    362 const Vector<AtomicString>& WebVideoFullscreenModelMediaElement::observedEventNames()
     357const Vector<AtomicString>& WebVideoFullscreenModelVideoElement::observedEventNames()
    363358{
    364359    static NeverDestroyed<Vector<AtomicString>> sEventNames;
     
    377372}
    378373
    379 const AtomicString& WebVideoFullscreenModelMediaElement::eventNameAll()
     374const AtomicString& WebVideoFullscreenModelVideoElement::eventNameAll()
    380375{
    381376    static NeverDestroyed<AtomicString> sEventNameAll = "allEvents";
  • trunk/Source/WebCore/platform/mac/WebVideoFullscreenController.h

    r173176 r173230  
    3333namespace WebCore {
    3434    class DisplaySleepDisabler;
    35     class HTMLMediaElement;
     35    class HTMLVideoElement;
    3636}
    3737
     
    4343WEBCORE_EXPORT @interface WebVideoFullscreenController : NSWindowController {
    4444@private
    45     RefPtr<WebCore::HTMLMediaElement> _mediaElement; // (retain)
     45    RefPtr<WebCore::HTMLVideoElement> _videoElement; // (retain)
    4646    id <WebVideoFullscreenControllerDelegate> _delegate; // (assign)
    4747
     
    6161
    6262- (void)setupVideoOverlay:(CALayer*)layer;
    63 - (void)setMediaElement:(WebCore::HTMLMediaElement*)mediaElement;
    64 - (WebCore::HTMLMediaElement*)mediaElement;
     63- (void)setVideoElement:(WebCore::HTMLVideoElement*)videoElement;
     64- (WebCore::HTMLVideoElement*)videoElement;
    6565
    6666- (void)enterFullscreen:(NSScreen *)screen;
  • trunk/Source/WebCore/platform/mac/WebVideoFullscreenController.mm

    r167003 r173230  
    3636#import <QTKit/QTKit.h>
    3737#import <WebCore/DisplaySleepDisabler.h>
    38 #import <WebCore/HTMLMediaElement.h>
     38#import <WebCore/HTMLVideoElement.h>
    3939#import <WebCore/SoftLinking.h>
    4040#import <objc/runtime.h>
     
    115115}
    116116
    117 - (HTMLMediaElement*)mediaElement
    118 {
    119     return _mediaElement.get();
    120 }
    121 
    122 - (void)setMediaElement:(HTMLMediaElement*)mediaElement
    123 {
    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)
    127127        return;
    128128
    129129    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;
    132132            QTMovieLayer *layer = [[getQTMovieLayerClass() alloc] init];
    133133            [layer setMovie:movie];
     
    139139                                                       object:movie];
    140140
    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;
    143143            AVPlayerLayer *layer = [[getAVPlayerLayerClass() alloc] init];
    144144            [self setupVideoOverlay:layer];
     
    208208}
    209209
    210 - (NSRect)mediaElementRect
    211 {
    212     return _mediaElement->screenRect();
     210- (NSRect)videoElementRect
     211{
     212    return _videoElement->screenRect();
    213213}
    214214
     
    277277        screen = [NSScreen mainScreen];
    278278
    279     NSRect frame = [self mediaElementRect];
     279    NSRect frame = [self videoElementRect];
    280280    NSRect endFrame = [screen frame];
    281281    constrainFrameToRatioOfFrame(&endFrame, &frame);
     
    304304    [_hudController closeWindow];
    305305
    306     NSRect endFrame = [self mediaElementRect];
     306    NSRect endFrame = [self videoElementRect];
    307307
    308308    [self setupFadeAnimationIfNeededAndFadeIn:NO];
     
    359359{
    360360    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];
    363363   
    364364    if (rate && !_isEndingFullscreen) {
     
    374374- (void)_requestExit
    375375{
    376     if (_mediaElement)
    377         _mediaElement->exitFullscreen();
     376    if (_videoElement)
     377        _videoElement->exitFullscreen();
    378378    _forceDisableAnimation = NO;
    379379}
  • trunk/Source/WebKit/mac/ChangeLog

    r173215 r173230  
     12014-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
    1322014-09-03  Dan Bernstein  <mitz@apple.com>
    233
  • trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h

    r171321 r173230  
    181181
    182182#if ENABLE(VIDEO)
    183     virtual bool supportsFullscreenForNode(const WebCore::Node*) override;
    184     virtual void enterFullscreenForNode(WebCore::Node*) override;
    185     virtual void exitFullscreenForNode(WebCore::Node*) override;
     183    virtual bool supportsVideoFullscreen() override;
     184    virtual void enterVideoFullscreenForVideoElement(WebCore::HTMLVideoElement*) override;
     185    virtual void exitVideoFullscreen() override;
    186186#endif
    187187   
  • trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm

    r171321 r173230  
    941941#if ENABLE(VIDEO)
    942942
    943 bool WebChromeClient::supportsFullscreenForNode(const Node* node)
     943bool WebChromeClient::supportsVideoFullscreen()
    944944{
    945945#if PLATFORM(IOS)
     
    947947        return false;
    948948#endif
    949     return isHTMLVideoElement(node);
    950 }
    951 
    952 void WebChromeClient::enterFullscreenForNode(Node* node)
    953 {
    954     BEGIN_BLOCK_OBJC_EXCEPTIONS;
    955     [m_webView _enterFullscreenForNode:node];
    956     END_BLOCK_OBJC_EXCEPTIONS;
    957 }
    958 
    959 void WebChromeClient::exitFullscreenForNode(Node*)
    960 {
    961     BEGIN_BLOCK_OBJC_EXCEPTIONS;
    962     [m_webView _exitFullscreen];
     949    return true;
     950}
     951
     952void WebChromeClient::enterVideoFullscreenForVideoElement(HTMLVideoElement* videoElement)
     953{
     954    BEGIN_BLOCK_OBJC_EXCEPTIONS;
     955    [m_webView _enterVideoFullscreenForVideoElement:videoElement];
     956    END_BLOCK_OBJC_EXCEPTIONS;
     957}
     958
     959void WebChromeClient::exitVideoFullscreen()
     960{
     961    BEGIN_BLOCK_OBJC_EXCEPTIONS;
     962    [m_webView _exitVideoFullscreen];
    963963    END_BLOCK_OBJC_EXCEPTIONS;   
    964964}
  • trunk/Source/WebKit/mac/WebView/WebView.mm

    r173047 r173230  
    135135#import <WebCore/GeolocationController.h>
    136136#import <WebCore/GeolocationError.h>
    137 #import <WebCore/HTMLMediaElement.h>
    138137#import <WebCore/HTMLNames.h>
     138#import <WebCore/HTMLVideoElement.h>
    139139#import <WebCore/HistoryController.h>
    140140#import <WebCore/HistoryItem.h>
     
    17001700
    17011701#if ENABLE(VIDEO) && !PLATFORM(IOS)
    1702     [self _exitFullscreen];
     1702    [self _exitVideoFullscreen];
    17031703#endif
    17041704
     
    83898389
    83908390#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{
    83968393    if (_private->fullscreenController) {
    8397         if ([_private->fullscreenController mediaElement] == videoElement) {
     8394        if ([_private->fullscreenController videoElement] == videoElement) {
    83988395            // The backend may just warn us that the underlaying plaftormMovie()
    83998396            // has changed. Just force an update.
    8400             [_private->fullscreenController setMediaElement:videoElement];
     8397            [_private->fullscreenController setVideoElement:videoElement];
    84018398            return; // No more to do.
    84028399        }
    84038400
    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();
    84068403        // This previous call has to trigger _exitFullscreen,
    84078404        // which has to clear _private->fullscreenController.
     
    84108407    if (!_private->fullscreenController) {
    84118408        _private->fullscreenController = [[WebVideoFullscreenController alloc] init];
    8412         [_private->fullscreenController setMediaElement:videoElement];
     8409        [_private->fullscreenController setVideoElement:videoElement];
    84138410#if PLATFORM(IOS)
    84148411        [_private->fullscreenController enterFullscreen:(UIView *)[[[self window] hostLayer] delegate]];
     
    84188415    }
    84198416    else
    8420         [_private->fullscreenController setMediaElement:videoElement];
    8421 }
    8422 
    8423 - (void)_exitFullscreen
     8417        [_private->fullscreenController setVideoElement:videoElement];
     8418}
     8419
     8420- (void)_exitVideoFullscreen
    84248421{
    84258422    if (!_private->fullscreenController)
  • trunk/Source/WebKit/mac/WebView/WebViewInternal.h

    r168434 r173230  
    5454class Page;
    5555class RenderBox;
    56 class Node;
     56class HTMLVideoElement;
    5757struct DictationAlternative;
    5858}
     
    234234
    235235#if ENABLE(VIDEO) && defined(__cplusplus)
    236 - (void)_enterFullscreenForNode:(WebCore::Node*)node;
    237 - (void)_exitFullscreen;
     236- (void)_enterVideoFullscreenForVideoElement:(WebCore::HTMLVideoElement*)videoElement;
     237- (void)_exitVideoFullscreen;
    238238#endif
    239239
  • trunk/Source/WebKit/win/ChangeLog

    r173207 r173230  
     12014-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
    1512014-09-03  Brent Fulgham  <bfulgham@apple.com>
    252
  • trunk/Source/WebKit/win/FullscreenVideoController.cpp

    r167670 r173230  
    206206    ASSERT_ARG(layer, layer == m_parent->m_rootChild);
    207207
    208     HTMLMediaElement* mediaElement = m_parent->m_mediaElement.get();
    209     if (!mediaElement)
     208    HTMLVideoElement* videoElement = m_parent->m_videoElement.get();
     209    if (!videoElement)
    210210        return;
    211211
    212212
    213     PlatformCALayer* videoLayer = PlatformCALayer::platformCALayer(mediaElement->platformLayer());
     213    PlatformCALayer* videoLayer = PlatformCALayer::platformCALayer(videoElement->platformLayer());
    214214    if (!videoLayer || videoLayer->superlayer() != layer)
    215215        return;
     
    217217    FloatRect layerBounds = layer->bounds();
    218218
    219     FloatSize videoSize = mediaElement->player()->naturalSize();
     219    FloatSize videoSize = videoElement->player()->naturalSize();
    220220    float scaleFactor;
    221221    if (videoSize.aspectRatio() > layerBounds.size().aspectRatio())
     
    258258}
    259259
    260 void FullscreenVideoController::setMediaElement(HTMLMediaElement* mediaElement)
    261 {
    262     if (mediaElement == m_mediaElement)
     260void FullscreenVideoController::setVideoElement(HTMLVideoElement* videoElement)
     261{
     262    if (videoElement == m_videoElement)
    263263        return;
    264264
    265     m_mediaElement = mediaElement;
    266     if (!m_mediaElement) {
     265    m_videoElement = videoElement;
     266    if (!m_videoElement) {
    267267        // Can't do full-screen, just get out
    268268        exitFullscreen();
     
    272272void FullscreenVideoController::enterFullscreen()
    273273{
    274     if (!m_mediaElement)
     274    if (!m_videoElement)
    275275        return;
    276276
    277     WebView* webView = kit(m_mediaElement->document().page());
     277    WebView* webView = kit(m_videoElement->document().page());
    278278    HWND parentHwnd = webView ? webView->viewWindow() : 0;
    279279
     
    282282    m_fullscreenWindow->setRootChildLayer(m_rootChild);
    283283
    284     PlatformCALayer* videoLayer = PlatformCALayer::platformCALayer(m_mediaElement->platformLayer());
     284    PlatformCALayer* videoLayer = PlatformCALayer::platformCALayer(m_videoElement->platformLayer());
    285285    m_rootChild->appendSublayer(videoLayer);
    286286    m_rootChild->setNeedsLayout();
     
    305305    m_hudWindow = 0;
    306306
    307     // We previously ripped the mediaElement's platform layer out
     307    // We previously ripped the videoElement's platform layer out
    308308    // of its orginial layer tree to display it in our fullscreen
    309309    // window.  Now, we need to get the layer back in its original
     
    313313    // the player's layer will be recreated, and will be picked up
    314314    // 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);
    317317}
    318318
    319319bool FullscreenVideoController::canPlay() const
    320320{
    321     return m_mediaElement && m_mediaElement->canPlay();
     321    return m_videoElement && m_videoElement->canPlay();
    322322}
    323323
    324324void FullscreenVideoController::play()
    325325{
    326     if (m_mediaElement)
    327         m_mediaElement->play();
     326    if (m_videoElement)
     327        m_videoElement->play();
    328328}
    329329
    330330void FullscreenVideoController::pause()
    331331{
    332     if (m_mediaElement)
    333         m_mediaElement->pause();
     332    if (m_videoElement)
     333        m_videoElement->pause();
    334334}
    335335
    336336float FullscreenVideoController::volume() const
    337337{
    338     return m_mediaElement ? m_mediaElement->volume() : 0;
     338    return m_videoElement ? m_videoElement->volume() : 0;
    339339}
    340340
    341341void FullscreenVideoController::setVolume(float volume)
    342342{
    343     if (m_mediaElement) {
     343    if (m_videoElement) {
    344344        ExceptionCode ec;
    345         m_mediaElement->setVolume(volume, ec);
     345        m_videoElement->setVolume(volume, ec);
    346346    }
    347347}
     
    349349float FullscreenVideoController::currentTime() const
    350350{
    351     return m_mediaElement ? m_mediaElement->currentTime() : 0;
     351    return m_videoElement ? m_videoElement->currentTime() : 0;
    352352}
    353353
    354354void FullscreenVideoController::setCurrentTime(float value)
    355355{
    356     if (m_mediaElement)
    357         m_mediaElement->setCurrentTime(value);
     356    if (m_videoElement)
     357        m_videoElement->setCurrentTime(value);
    358358}
    359359
    360360float FullscreenVideoController::duration() const
    361361{
    362     return m_mediaElement ? m_mediaElement->duration() : 0;
     362    return m_videoElement ? m_videoElement->duration() : 0;
    363363}
    364364
    365365void FullscreenVideoController::beginScrubbing()
    366366{
    367     if (m_mediaElement)
    368         m_mediaElement->beginScrubbing();
     367    if (m_videoElement)
     368        m_videoElement->beginScrubbing();
    369369}
    370370
    371371void FullscreenVideoController::endScrubbing()
    372372{
    373     if (m_mediaElement)
    374         m_mediaElement->endScrubbing();
     373    if (m_videoElement)
     374        m_videoElement->endScrubbing();
    375375}
    376376
     
    581581{
    582582    if (c == VK_ESCAPE) {
    583         if (m_mediaElement)
    584             m_mediaElement->exitFullscreen();
     583        if (m_videoElement)
     584            m_videoElement->exitFullscreen();
    585585    } else if (c == VK_SPACE)
    586586        togglePlay();
     
    590590{
    591591    if (virtualKey == VK_ESCAPE) {
    592         if (m_mediaElement)
    593             m_mediaElement->exitFullscreen();
     592        if (m_videoElement)
     593            m_videoElement->exitFullscreen();
    594594    }
    595595}
     
    674674        else if (m_hitWidget == &m_exitFullscreenButton && m_exitFullscreenButton.hitTest(convertedPoint)) {
    675675            m_hitWidget = 0;
    676             if (m_mediaElement)
    677                 m_mediaElement->exitFullscreen();
     676            if (m_videoElement)
     677                m_videoElement->exitFullscreen();
    678678            return;
    679679        }
  • trunk/Source/WebKit/win/FullscreenVideoController.h

    r165676 r173230  
    3131#include "MediaPlayerPrivateFullscreenWindow.h"
    3232
    33 #include <WebCore/HTMLMediaElement.h>
     33#include <WebCore/HTMLVideoElement.h>
    3434#include <WebCore/Image.h>
    3535#include <WebCore/IntPoint.h>
     
    108108    virtual ~FullscreenVideoController();
    109109
    110     void setMediaElement(WebCore::HTMLMediaElement*);
    111     WebCore::HTMLMediaElement* mediaElement() const { return m_mediaElement.get(); }
     110    void setVideoElement(WebCore::HTMLVideoElement*);
     111    WebCore::HTMLVideoElement* videoElement() const { return m_videoElement.get(); }
    112112
    113113    void enterFullscreen();
     
    150150    void onKeyDown(int virtualKey);
    151151
    152     RefPtr<WebCore::HTMLMediaElement> m_mediaElement;
     152    RefPtr<WebCore::HTMLVideoElement> m_videoElement;
    153153
    154154    HWND m_hudWindow;
  • trunk/Source/WebKit/win/WebCoreSupport/WebChromeClient.cpp

    r172977 r173230  
    774774#if ENABLE(VIDEO)
    775775
    776 bool WebChromeClient::supportsFullscreenForNode(const Node* node)
    777 {
    778     return isHTMLVideoElement(node);
    779 }
    780 
    781 void WebChromeClient::enterFullscreenForNode(Node* node)
    782 {
    783     m_webView->enterFullscreenForNode(node);
    784 }
    785 
    786 void WebChromeClient::exitFullscreenForNode(Node*)
    787 {
    788     m_webView->exitFullscreen();
     776bool WebChromeClient::supportsVideoFullscreen()
     777{
     778    return true;
     779}
     780
     781void WebChromeClient::enterVideoFullscreenForVideoElement(HTMLVideoElement* videoElement)
     782{
     783    m_webView->enterVideoFullscreenForVideoElement(videoElement);
     784}
     785
     786void WebChromeClient::exitVideoFullscreen()
     787{
     788    m_webView->exitVideoFullscreen();
    789789}
    790790
  • trunk/Source/WebKit/win/WebCoreSupport/WebChromeClient.h

    r165676 r173230  
    149149
    150150#if ENABLE(VIDEO)
    151     virtual bool supportsFullscreenForNode(const WebCore::Node*);
    152     virtual void enterFullscreenForNode(WebCore::Node*);
    153     virtual void exitFullscreenForNode(WebCore::Node*);
     151    virtual bool supportsVideoFullscreen();
     152    virtual void enterVideoFullscreenForVideoElement(WebCore::HTMLVideoElement*);
     153    virtual void exitVideoFullscreen();
    154154#endif
    155155
  • trunk/Source/WebKit/win/WebView.cpp

    r173207 r173230  
    102102#include <WebCore/GeolocationError.h>
    103103#include <WebCore/GraphicsContext.h>
    104 #include <WebCore/HTMLMediaElement.h>
    105104#include <WebCore/HTMLNames.h>
     105#include <WebCore/HTMLVideoElement.h>
    106106#include <WebCore/HWndDC.h>
    107107#include <WebCore/HistoryController.h>
     
    62826282}
    62836283
    6284 void WebView::enterFullscreenForNode(Node* node)
     6284void WebView::enterVideoFullscreenForVideoElement(HTMLVideoElement* videoElement)
    62856285{
    62866286#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 
    62946287    if (m_fullScreenVideoController) {
    6295         if (m_fullScreenVideoController->mediaElement() == videoElement) {
     6288        if (m_fullScreenVideoController->videoElement() == videoElement) {
    62966289            // The backend may just warn us that the underlaying plaftormMovie()
    62976290            // has changed. Just force an update.
    6298             m_fullScreenVideoController->setMediaElement(videoElement);
     6291            m_fullScreenVideoController->setVideoElement(videoElement);
    62996292            return; // No more to do.
    63006293        }
    63016294
    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();
    63046297        // This previous call has to trigger exitFullscreen,
    63056298        // which has to clear m_fullScreenVideoController.
     
    63086301
    63096302    m_fullScreenVideoController = std::make_unique<FullscreenVideoController>();
    6310     m_fullScreenVideoController->setMediaElement(videoElement);
     6303    m_fullScreenVideoController->setVideoElement(videoElement);
    63116304    m_fullScreenVideoController->enterFullscreen();
    63126305#endif
    63136306}
    63146307
    6315 void WebView::exitFullscreen()
     6308void WebView::exitVideoFullscreen()
    63166309{
    63176310#if ENABLE(VIDEO) && !USE(GSTREAMER) && !USE(MEDIA_FOUNDATION)
  • trunk/Source/WebKit/win/WebView.h

    r172977 r173230  
    5656    struct GraphicsDeviceAdapter;
    5757#endif
     58    class HTMLVideoElement;
    5859}
    5960
     
    941942#endif
    942943
    943     void enterFullscreenForNode(WebCore::Node*);
    944     void exitFullscreen();
     944    void enterVideoFullscreenForVideoElement(WebCore::HTMLVideoElement*);
     945    void exitVideoFullscreen();
    945946
    946947    void setLastCursor(HCURSOR cursor) { m_lastSetCursor = cursor; }
  • trunk/Source/WebKit2/ChangeLog

    r173215 r173230  
     12014-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
    1392014-09-03  Dan Bernstein  <mitz@apple.com>
    240
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp

    r172729 r173230  
    903903
    904904#if PLATFORM(IOS)
    905 bool WebChromeClient::supportsFullscreenForNode(const WebCore::Node* node)
    906 {
    907     return m_page->videoFullscreenManager()->supportsFullscreen(node);
    908 }
    909 
    910 void WebChromeClient::enterFullscreenForNode(WebCore::Node* node)
    911 {
    912     m_page->videoFullscreenManager()->enterFullscreenForNode(node);
    913 }
    914 
    915 void WebChromeClient::exitFullscreenForNode(WebCore::Node* node)
    916 {
    917     m_page->videoFullscreenManager()->exitFullscreenForNode(node);
     905bool WebChromeClient::supportsVideoFullscreen()
     906{
     907    return m_page->videoFullscreenManager()->supportsVideoFullscreen();
     908}
     909
     910void WebChromeClient::enterVideoFullscreenForVideoElement(WebCore::HTMLVideoElement* videoElement)
     911{
     912    m_page->videoFullscreenManager()->enterVideoFullscreenForVideoElement(videoElement);
     913}
     914
     915void WebChromeClient::exitVideoFullscreen()
     916{
     917    m_page->videoFullscreenManager()->exitVideoFullscreen();
    918918}
    919919#endif
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h

    r172729 r173230  
    254254
    255255#if PLATFORM(IOS)
    256     virtual bool supportsFullscreenForNode(const WebCore::Node*);
    257     virtual void enterFullscreenForNode(WebCore::Node*);
    258     virtual void exitFullscreenForNode(WebCore::Node*);
     256    virtual bool supportsVideoFullscreen();
     257    virtual void enterVideoFullscreenForVideoElement(WebCore::HTMLVideoElement*);
     258    virtual void exitVideoFullscreen();
    259259#endif
    260260
  • trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.h

    r171288 r173230  
    3232#include <WebCore/PlatformCALayer.h>
    3333#include <WebCore/WebVideoFullscreenInterface.h>
    34 #include <WebCore/WebVideoFullscreenModelMediaElement.h>
     34#include <WebCore/WebVideoFullscreenModelVideoElement.h>
    3535#include <wtf/RefCounted.h>
    3636#include <wtf/RefPtr.h>
     
    5151class WebPage;
    5252
    53 class WebVideoFullscreenManager : public WebCore::WebVideoFullscreenModelMediaElement, public WebCore::WebVideoFullscreenInterface, private IPC::MessageReceiver {
     53class WebVideoFullscreenManager : public WebCore::WebVideoFullscreenModelVideoElement, public WebCore::WebVideoFullscreenInterface, private IPC::MessageReceiver {
    5454public:
    5555    static PassRefPtr<WebVideoFullscreenManager> create(PassRefPtr<WebPage>);
     
    5858    void didReceiveMessage(IPC::Connection*, IPC::MessageDecoder&);
    5959   
    60     bool supportsFullscreen(const WebCore::Node*) const;
    61     void enterFullscreenForNode(WebCore::Node*);
    62     void exitFullscreenForNode(WebCore::Node*);
     60    bool supportsVideoFullscreen() const;
     61    void enterVideoFullscreenForVideoElement(WebCore::HTMLVideoElement*);
     62    void exitVideoFullscreen();
    6363   
    6464protected:
     
    8686   
    8787    WebPage* m_page;
    88     RefPtr<WebCore::Node> m_node;
     88    RefPtr<WebCore::HTMLVideoElement> m_videoElement;
    8989    std::unique_ptr<LayerHostingContext> m_layerHostingContext;
    9090   
  • trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm

    r171973 r173230  
    5151namespace WebKit {
    5252
    53 static IntRect clientRectForNode(Node* node)
    54 {
    55     if (!node || !node->isElementNode())
     53static IntRect clientRectForElement(HTMLElement* element)
     54{
     55    if (!element)
    5656        return IntRect();
    5757
    58     return toElement(node)->clientRect();
     58    return element->clientRect();
    5959}
    6060
     
    7979}
    8080
    81 bool WebVideoFullscreenManager::supportsFullscreen(const Node* node) const
    82 {
    83     return Settings::avKitEnabled() && isHTMLVideoElement(node);
    84 }
    85 
    86 void WebVideoFullscreenManager::enterFullscreenForNode(Node* node)
    87 {
    88     ASSERT(node);
    89     m_node = node;
     81bool WebVideoFullscreenManager::supportsVideoFullscreen() const
     82{
     83    return Settings::avKitEnabled();
     84}
     85
     86void WebVideoFullscreenManager::enterVideoFullscreenForVideoElement(HTMLVideoElement* videoElement)
     87{
     88    m_videoElement = videoElement;
     89
    9090    m_targetIsFullscreen = true;
    9191
     
    9494
    9595    m_isAnimating = true;
    96     setMediaElement(toHTMLMediaElement(node));
     96    setVideoElement(videoElement);
    9797
    9898    m_layerHostingContext = LayerHostingContext::createForExternalHostingProcess();
    9999   
    100     m_page->send(Messages::WebVideoFullscreenManagerProxy::SetupFullscreenWithID(m_layerHostingContext->contextID(), clientRectForNode(node)), m_page->pageID());
    101 }
    102 
    103 void WebVideoFullscreenManager::exitFullscreenForNode(Node* node)
    104 {
    105     m_node.clear();
     100    m_page->send(Messages::WebVideoFullscreenManagerProxy::SetupFullscreenWithID(m_layerHostingContext->contextID(), clientRectForElement(videoElement)), m_page->pageID());
     101}
     102
     103void WebVideoFullscreenManager::exitVideoFullscreen()
     104{
     105    RefPtr<HTMLVideoElement> videoElement = m_videoElement.release();
    106106    m_targetIsFullscreen = false;
    107107
     
    110110
    111111    m_isAnimating = true;
    112     m_page->send(Messages::WebVideoFullscreenManagerProxy::ExitFullscreen(clientRectForNode(node)), m_page->pageID());
     112    m_page->send(Messages::WebVideoFullscreenManagerProxy::ExitFullscreen(clientRectForElement(videoElement.get())), m_page->pageID());
    113113}
    114114
     
    192192
    193193    // exit fullscreen now if it was previously requested during an animation.
    194     __block RefPtr<WebVideoFullscreenModelMediaElement> protect(this);
     194    __block RefPtr<WebVideoFullscreenModelVideoElement> protect(this);
    195195    WebThreadRun(^ {
    196         exitFullscreenForNode(m_node.get());
     196        exitVideoFullscreen();
    197197        protect.clear();
    198198    });
     
    202202{
    203203    setVideoFullscreenLayer(nil);
    204     __block RefPtr<WebVideoFullscreenModelMediaElement> protect(this);
     204    __block RefPtr<WebVideoFullscreenModelVideoElement> protect(this);
    205205
    206206    dispatch_async(dispatch_get_main_queue(), ^{
     
    217217    m_isFullscreen = false;
    218218   
    219     setMediaElement(nullptr);
     219    setVideoElement(nullptr);
    220220
    221221    if (!m_targetIsFullscreen)
     
    223223
    224224    // enter fullscreen now if it was previously requested during an animation.
    225     __block RefPtr<WebVideoFullscreenModelMediaElement> protect(this);
     225    __block RefPtr<WebVideoFullscreenModelVideoElement> protect(this);
    226226    WebThreadRun(^ {
    227         enterFullscreenForNode(m_node.get());
     227        enterVideoFullscreenForVideoElement(m_videoElement.get());
    228228        protect.clear();
    229229    });
Note: See TracChangeset for help on using the changeset viewer.