Context menu items related to fullscreen should be specific to standard fullscreen
authoradachan@apple.com <adachan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Apr 2016 17:58:57 +0000 (17:58 +0000)
committeradachan@apple.com <adachan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Apr 2016 17:58:57 +0000 (17:58 +0000)
https://bugs.webkit.org/show_bug.cgi?id=156723
<rdar://problem/25452632>

Reviewed by Darin Adler.

Introduce HTMLMediaElement::isStandardFullscreen() that the HitTestResult code can use
when handling the validation and selection of fullscreen-related context menu items.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::isStandardFullscreen):
(WebCore::HTMLMediaElement::toggleStandardFullscreenState):
Renamed to make it clear that it's for toggling standard fullscreen. Call the new
HTMLMediaElement::isStandardFullscreen().
* html/HTMLMediaElement.h:
* rendering/HitTestResult.cpp:
(WebCore::HitTestResult::mediaIsInFullscreen):
Use HTMLMediaElement::isStandardFullscreen().
(WebCore::HitTestResult::toggleMediaFullscreenState):
Call the renamed HTMLMediaElement::toggleStandardFullscreenState().

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

Source/WebCore/ChangeLog
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLMediaElement.h
Source/WebCore/rendering/HitTestResult.cpp

index bd68826..f1fda78 100644 (file)
@@ -1,3 +1,26 @@
+2016-04-18  Ada Chan  <adachan@apple.com>
+
+        Context menu items related to fullscreen should be specific to standard fullscreen
+        https://bugs.webkit.org/show_bug.cgi?id=156723
+        <rdar://problem/25452632>
+
+        Reviewed by Darin Adler.
+
+        Introduce HTMLMediaElement::isStandardFullscreen() that the HitTestResult code can use
+        when handling the validation and selection of fullscreen-related context menu items.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::isStandardFullscreen):
+        (WebCore::HTMLMediaElement::toggleStandardFullscreenState):
+        Renamed to make it clear that it's for toggling standard fullscreen. Call the new
+        HTMLMediaElement::isStandardFullscreen().
+        * html/HTMLMediaElement.h:
+        * rendering/HitTestResult.cpp:
+        (WebCore::HitTestResult::mediaIsInFullscreen):
+        Use HTMLMediaElement::isStandardFullscreen().
+        (WebCore::HitTestResult::toggleMediaFullscreenState):
+        Call the renamed HTMLMediaElement::toggleStandardFullscreenState().
+
 2016-04-19  Brady Eidson  <beidson@apple.com>
 
         Modern IDB: ObjectStore Blob Support.
index 63b31de..15f1cd8 100644 (file)
@@ -5312,11 +5312,21 @@ bool HTMLMediaElement::isFullscreen() const
     return false;
 }
 
-void HTMLMediaElement::toggleFullscreenState()
+bool HTMLMediaElement::isStandardFullscreen() const
 {
-    LOG(Media, "HTMLMediaElement::toggleFullscreenState(%p) - isFullscreen() is %s", this, boolString(isFullscreen()));
+#if ENABLE(FULLSCREEN_API)
+    if (document().webkitIsFullScreen() && document().webkitCurrentFullScreenElement() == this)
+        return true;
+#endif
+
+    return m_videoFullscreenMode == VideoFullscreenModeStandard;
+}
+
+void HTMLMediaElement::toggleStandardFullscreenState()
+{
+    LOG(Media, "HTMLMediaElement::toggleStandardFullscreenState(%p) - isStandardFullscreen() is %s", this, boolString(isStandardFullscreen()));
     
-    if (isFullscreen())
+    if (isStandardFullscreen())
         exitFullscreen();
     else
         enterFullscreen();
index d1201f6..ff89fde 100644 (file)
@@ -358,7 +358,8 @@ public:
     bool hasSingleSecurityOrigin() const { return !m_player || m_player->hasSingleSecurityOrigin(); }
     
     WEBCORE_EXPORT bool isFullscreen() const override;
-    void toggleFullscreenState();
+    bool isStandardFullscreen() const;
+    void toggleStandardFullscreenState();
 
     using MediaPlayerEnums::VideoFullscreenMode;
     VideoFullscreenMode fullscreenMode() const { return m_videoFullscreenMode; }
index 97498e8..640d138 100644 (file)
@@ -447,7 +447,7 @@ bool HitTestResult::mediaIsInFullscreen() const
 {
 #if ENABLE(VIDEO)
     if (HTMLMediaElement* mediaElement = this->mediaElement())
-        return mediaElement->isVideo() && mediaElement->isFullscreen();
+        return mediaElement->isVideo() && mediaElement->isStandardFullscreen();
 #endif
     return false;
 }
@@ -458,7 +458,7 @@ void HitTestResult::toggleMediaFullscreenState() const
     if (HTMLMediaElement* mediaElement = this->mediaElement()) {
         if (mediaElement->isVideo() && mediaElement->supportsFullscreen(HTMLMediaElementEnums::VideoFullscreenModeStandard)) {
             UserGestureIndicator indicator(DefinitelyProcessingUserGesture, &mediaElement->document());
-            mediaElement->toggleFullscreenState();
+            mediaElement->toggleStandardFullscreenState();
         }
     }
 #endif