Title: [260524] trunk/Source/WebCore
Revision
260524
Author
[email protected]
Date
2020-04-22 11:38:36 -0700 (Wed, 22 Apr 2020)

Log Message

[iOS] Add a quirk to keep gizmodo videos visible when playing in fullscreen.
https://bugs.webkit.org/show_bug.cgi?id=210857
<rdar://problem/58875327>

Reviewed by Jer Noble.

* page/Quirks.cpp:
(WebCore::Quirks::needsFullscreenDisplayNoneQuirk const):
* page/Quirks.h:

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer): Drive-by fix: always
set the layer name to make debugging in release builds easier.

* platform/graphics/avfoundation/objc/VideoLayerManagerObjC.mm:
(WebCore::VideoLayerManagerObjC::setVideoLayer): Ditto.

* style/StyleAdjuster.cpp:
(WebCore::Style::Adjuster::adjustForSiteSpecificQuirks const): Change `display:none` into
`display:block` on div with class "instream-native-video--mobile" when child video
element with id "vjs_video_3_html5_api" is in fullscreen.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (260523 => 260524)


--- trunk/Source/WebCore/ChangeLog	2020-04-22 18:33:32 UTC (rev 260523)
+++ trunk/Source/WebCore/ChangeLog	2020-04-22 18:38:36 UTC (rev 260524)
@@ -1,3 +1,27 @@
+2020-04-22  Eric Carlson  <[email protected]>
+
+        [iOS] Add a quirk to keep gizmodo videos visible when playing in fullscreen.
+        https://bugs.webkit.org/show_bug.cgi?id=210857
+        <rdar://problem/58875327>
+
+        Reviewed by Jer Noble.
+
+        * page/Quirks.cpp:
+        (WebCore::Quirks::needsFullscreenDisplayNoneQuirk const):
+        * page/Quirks.h:
+
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer): Drive-by fix: always
+        set the layer name to make debugging in release builds easier.
+
+        * platform/graphics/avfoundation/objc/VideoLayerManagerObjC.mm:
+        (WebCore::VideoLayerManagerObjC::setVideoLayer): Ditto.
+
+        * style/StyleAdjuster.cpp:
+        (WebCore::Style::Adjuster::adjustForSiteSpecificQuirks const): Change `display:none` into
+        `display:block` on div with class "instream-native-video--mobile" when child video
+        element with id "vjs_video_3_html5_api" is in fullscreen.
+
 2020-04-22  Chris Dumez  <[email protected]>
 
         Unreviewed, commit updated xcfilelist files.

Modified: trunk/Source/WebCore/page/Quirks.cpp (260523 => 260524)


--- trunk/Source/WebCore/page/Quirks.cpp	2020-04-22 18:33:32 UTC (rev 260523)
+++ trunk/Source/WebCore/page/Quirks.cpp	2020-04-22 18:38:36 UTC (rev 260524)
@@ -573,6 +573,23 @@
 #endif
 }
 
+bool Quirks::needsFullscreenDisplayNoneQuirk() const
+{
+#if PLATFORM(IOS_FAMILY)
+    if (!needsQuirks())
+        return false;
+
+    if (!m_needsFullscreenDisplayNoneQuirk) {
+        auto host = m_document->topDocument().url().host();
+        m_needsFullscreenDisplayNoneQuirk = equalLettersIgnoringASCIICase(host, "gizmodo.com") || host.endsWithIgnoringASCIICase(".gizmodo.com");
+    }
+
+    return *m_needsFullscreenDisplayNoneQuirk;
+#else
+    return false;
+#endif
+}
+
 bool Quirks::shouldAvoidScrollingWhenFocusedContentIsVisible() const
 {
     if (!needsQuirks())

Modified: trunk/Source/WebCore/page/Quirks.h (260523 => 260524)


--- trunk/Source/WebCore/page/Quirks.h	2020-04-22 18:33:32 UTC (rev 260523)
+++ trunk/Source/WebCore/page/Quirks.h	2020-04-22 18:38:36 UTC (rev 260524)
@@ -82,6 +82,7 @@
 
     bool needsGMailOverflowScrollQuirk() const;
     bool needsYouTubeOverflowScrollQuirk() const;
+    bool needsFullscreenDisplayNoneQuirk() const;
 
     bool shouldOpenAsAboutBlank(const String&) const;
 
@@ -116,6 +117,7 @@
     mutable Optional<bool> m_needsGMailOverflowScrollQuirk;
     mutable Optional<bool> m_needsYouTubeOverflowScrollQuirk;
     mutable Optional<bool> m_needsPreloadAutoQuirk;
+    mutable Optional<bool> m_needsFullscreenDisplayNoneQuirk;
 #endif
     mutable Optional<bool> m_shouldDisableElementFullscreenQuirk;
 #if ENABLE(TOUCH_EVENTS)

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (260523 => 260524)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2020-04-22 18:33:32 UTC (rev 260523)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2020-04-22 18:38:36 UTC (rev 260524)
@@ -639,9 +639,7 @@
     m_videoLayer = adoptNS([PAL::allocAVPlayerLayerInstance() init]);
     [m_videoLayer setPlayer:m_avPlayer.get()];
 
-#ifndef NDEBUG
     [m_videoLayer setName:@"MediaPlayerPrivate AVPlayerLayer"];
-#endif
     [m_videoLayer addObserver:m_objcObserver.get() forKeyPath:@"readyForDisplay" options:NSKeyValueObservingOptionNew context:(void *)MediaPlayerAVFoundationObservationContextAVPlayerLayer];
     updateVideoLayerGravity();
     [m_videoLayer setContentsScale:player()->playerContentsScale()];

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoLayerManagerObjC.mm (260523 => 260524)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoLayerManagerObjC.mm	2020-04-22 18:33:32 UTC (rev 260523)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoLayerManagerObjC.mm	2020-04-22 18:38:36 UTC (rev 260524)
@@ -57,9 +57,7 @@
     [m_videoLayer web_disableAllActions];
 
     m_videoInlineLayer = adoptNS([[WebVideoContainerLayer alloc] init]);
-#ifndef NDEBUG
     [m_videoInlineLayer setName:@"WebVideoContainerLayer"];
-#endif
     m_videoInlineFrame = CGRectMake(0, 0, contentSize.width(), contentSize.height());
     [m_videoInlineLayer setFrame:m_videoInlineFrame];
     [m_videoInlineLayer setContentsGravity:kCAGravityResizeAspect];

Modified: trunk/Source/WebCore/style/StyleAdjuster.cpp (260523 => 260524)


--- trunk/Source/WebCore/style/StyleAdjuster.cpp	2020-04-22 18:33:32 UTC (rev 260523)
+++ trunk/Source/WebCore/style/StyleAdjuster.cpp	2020-04-22 18:38:36 UTC (rev 260524)
@@ -34,6 +34,7 @@
 #include "CSSFontSelector.h"
 #include "Element.h"
 #include "FrameView.h"
+#include "HTMLDivElement.h"
 #include "HTMLInputElement.h"
 #include "HTMLMarqueeElement.h"
 #include "HTMLNames.h"
@@ -40,6 +41,7 @@
 #include "HTMLSlotElement.h"
 #include "HTMLTableElement.h"
 #include "HTMLTextAreaElement.h"
+#include "HTMLVideoElement.h"
 #include "MathMLElement.h"
 #include "Page.h"
 #include "Quirks.h"
@@ -538,18 +540,34 @@
 
 void Adjuster::adjustForSiteSpecificQuirks(RenderStyle& style) const
 {
-    if (m_document.quirks().needsGMailOverflowScrollQuirk() && m_element) {
+    if (!m_element)
+        return;
+
+    if (m_document.quirks().needsGMailOverflowScrollQuirk()) {
         // This turns sidebar scrollable without mouse move event.
         static NeverDestroyed<AtomString> roleValue("navigation", AtomString::ConstructFromLiteral);
         if (style.overflowY() == Overflow::Hidden && m_element->attributeWithoutSynchronization(roleAttr) == roleValue)
             style.setOverflowY(Overflow::Auto);
     }
-    if (m_document.quirks().needsYouTubeOverflowScrollQuirk() && m_element) {
+    if (m_document.quirks().needsYouTubeOverflowScrollQuirk()) {
         // This turns sidebar scrollable without hover.
         static NeverDestroyed<AtomString> idValue("guide-inner-content", AtomString::ConstructFromLiteral);
         if (style.overflowY() == Overflow::Hidden && m_element->idForStyleResolution() == idValue)
             style.setOverflowY(Overflow::Auto);
     }
+    if (m_document.quirks().needsFullscreenDisplayNoneQuirk()) {
+        if (is<HTMLDivElement>(m_element) && style.display() == DisplayType::None) {
+            static NeverDestroyed<const AtomString> instreamNativeVideoDivClass("instream-native-video--mobile", AtomString::ConstructFromLiteral);
+            static NeverDestroyed<const AtomString> videoElementID("vjs_video_3_html5_api", AtomString::ConstructFromLiteral);
+
+            auto& div = downcast<HTMLDivElement>(*m_element);
+            if (div.hasClass() && div.classNames().contains(instreamNativeVideoDivClass)) {
+                auto* video = div.treeScope().getElementById(videoElementID);
+                if (is<HTMLVideoElement>(video) && downcast<HTMLVideoElement>(*video).isFullscreen())
+                    style.setDisplay(DisplayType::Block);
+            }
+        }
+    }
 }
 
 #if ENABLE(TEXT_AUTOSIZING)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to