Add a quirk to make youtube navigation bar scrollable without mouse hover on iOS
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 May 2019 18:18:12 +0000 (18:18 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 May 2019 18:18:12 +0000 (18:18 +0000)
https://bugs.webkit.org/show_bug.cgi?id=197555
<rdar://problem/49582231>

Reviewed by Brent Fulgham.

* css/StyleResolver.cpp:
(WebCore::StyleResolver::adjustRenderStyleForSiteSpecificQuirks):

Turn 'overflow:hidden' into 'overflow:auto' on element with id="guide-inner-content".

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

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

Source/WebCore/ChangeLog
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/page/Quirks.cpp
Source/WebCore/page/Quirks.h

index 23acb3e..9a74e09 100644 (file)
@@ -1,3 +1,20 @@
+2019-05-03  Antti Koivisto  <antti@apple.com>
+
+        Add a quirk to make youtube navigation bar scrollable without mouse hover on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=197555
+        <rdar://problem/49582231>
+
+        Reviewed by Brent Fulgham.
+
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::adjustRenderStyleForSiteSpecificQuirks):
+
+        Turn 'overflow:hidden' into 'overflow:auto' on element with id="guide-inner-content".
+
+        * page/Quirks.cpp:
+        (WebCore::Quirks::needsYouTubeOverflowScrollQuirk const):
+        * page/Quirks.h:
+
 2019-05-03  Devin Rousso  <drousso@apple.com>
 
         Web Inspector: Record actions performed on WebGL2RenderingContext
index 19411aa..2da5ec1 100644 (file)
@@ -1131,7 +1131,14 @@ void StyleResolver::adjustRenderStyleForSiteSpecificQuirks(RenderStyle& style, c
 {
     if (document().quirks().needsGMailOverflowScrollQuirk()) {
         // This turns sidebar scrollable without mouse move event.
-        if (style.overflowY() == Overflow::Hidden && element.attributeWithoutSynchronization(roleAttr) == "navigation")
+        static NeverDestroyed<AtomicString> roleValue("navigation", AtomicString::ConstructFromLiteral);
+        if (style.overflowY() == Overflow::Hidden && element.attributeWithoutSynchronization(roleAttr) == roleValue)
+            style.setOverflowY(Overflow::Auto);
+    }
+    if (document().quirks().needsYouTubeOverflowScrollQuirk()) {
+        // This turns sidebar scrollable without hover.
+        static NeverDestroyed<AtomicString> idValue("guide-inner-content", AtomicString::ConstructFromLiteral);
+        if (style.overflowY() == Overflow::Hidden && element.idForStyleResolution() == idValue)
             style.setOverflowY(Overflow::Auto);
     }
 }
index 6b2b920..5e731d7 100644 (file)
@@ -287,6 +287,7 @@ bool Quirks::needsInputModeNoneImplicitly(const HTMLElement& element) const
 #endif
 }
 
+// FIXME: Remove after the site is fixed, <rdar://problem/50374200>
 bool Quirks::needsGMailOverflowScrollQuirk() const
 {
 #if PLATFORM(IOS_FAMILY)
@@ -302,5 +303,21 @@ bool Quirks::needsGMailOverflowScrollQuirk() const
 #endif
 }
 
+// FIXME: Remove after the site is fixed, <rdar://problem/50374311>
+bool Quirks::needsYouTubeOverflowScrollQuirk() const
+{
+#if PLATFORM(IOS_FAMILY)
+    if (!needsQuirks())
+        return false;
+
+    if (!m_needsYouTubeOverflowScrollQuirk)
+        m_needsYouTubeOverflowScrollQuirk = equalLettersIgnoringASCIICase(m_document->url().host(), "www.youtube.com");
+
+    return *m_needsYouTubeOverflowScrollQuirk;
+#else
+    return false;
+#endif
+}
+
 
 }
index 0b6e79d..7988bbd 100644 (file)
@@ -55,6 +55,7 @@ public:
     WEBCORE_EXPORT bool isNeverRichlyEditableForTouchBar() const;
 
     bool needsGMailOverflowScrollQuirk() const;
+    bool needsYouTubeOverflowScrollQuirk() const;
 
 private:
     bool needsQuirks() const;
@@ -65,6 +66,7 @@ private:
     mutable Optional<bool> m_hasWebSQLSupportQuirk;
 #if PLATFORM(IOS_FAMILY)
     mutable Optional<bool> m_needsGMailOverflowScrollQuirk;
+    mutable Optional<bool> m_needsYouTubeOverflowScrollQuirk;
 #endif
 };