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

Reviewed by Simon Fraser.

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

Turn 'overflow:hidden' to 'overflow:auto' on element with role="navigation".
This should be both reasonably targeted and robust.

* css/StyleResolver.h:
* page/Quirks.cpp:
(WebCore::Quirks::needsGMailOverflowScrollQuirk const):
* page/Quirks.h:

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

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

index b8cdbe7..45a3063 100644 (file)
@@ -1,3 +1,23 @@
+2019-05-02  Antti Koivisto  <antti@apple.com>
+
+        Add a quirk to make gmail navigation bar scrollable without mouse hover on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=197529
+        <rdar://problem/49403416>
+
+        Reviewed by Simon Fraser.
+
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::adjustRenderStyle):
+        (WebCore::StyleResolver::adjustRenderStyleForSiteSpecificQuirks):
+
+        Turn 'overflow:hidden' to 'overflow:auto' on element with role="navigation".
+        This should be both reasonably targeted and robust.
+
+        * css/StyleResolver.h:
+        * page/Quirks.cpp:
+        (WebCore::Quirks::needsGMailOverflowScrollQuirk const):
+        * page/Quirks.h:
+
 2019-05-02  Simon Fraser  <simon.fraser@apple.com>
 
         Add logging for RenderLayer clip rects
index d0e9ced..19411aa 100644 (file)
@@ -76,6 +76,7 @@
 #include "PageRuleCollector.h"
 #include "PaintWorkletGlobalScope.h"
 #include "Pair.h"
+#include "Quirks.h"
 #include "RenderScrollbar.h"
 #include "RenderStyleConstants.h"
 #include "RenderTheme.h"
@@ -1121,6 +1122,18 @@ void StyleResolver::adjustRenderStyle(RenderStyle& style, const RenderStyle& par
 #if ENABLE(POINTER_EVENTS)
     style.setEffectiveTouchActions(computeEffectiveTouchActions(style, parentStyle.effectiveTouchActions()));
 #endif
+
+    if (element)
+        adjustRenderStyleForSiteSpecificQuirks(style, *element);
+}
+
+void StyleResolver::adjustRenderStyleForSiteSpecificQuirks(RenderStyle& style, const Element& element)
+{
+    if (document().quirks().needsGMailOverflowScrollQuirk()) {
+        // This turns sidebar scrollable without mouse move event.
+        if (style.overflowY() == Overflow::Hidden && element.attributeWithoutSynchronization(roleAttr) == "navigation")
+            style.setOverflowY(Overflow::Auto);
+    }
 }
 
 static void checkForOrientationChange(RenderStyle* style)
index 438e5c8..e25603c 100644 (file)
@@ -319,6 +319,8 @@ private:
 #endif
 
     void adjustRenderStyle(RenderStyle&, const RenderStyle& parentStyle, const RenderStyle* parentBoxStyle, const Element*);
+    void adjustRenderStyleForSiteSpecificQuirks(RenderStyle&, const Element&);
+
     std::unique_ptr<GridPosition> adjustNamedGridItemPosition(const NamedGridAreaMap&, const NamedGridLinesMap&, const GridPosition&, GridPositionSide) const;
     
     void adjustStyleForInterCharacterRuby();
index 8d13291..6b2b920 100644 (file)
@@ -287,4 +287,20 @@ bool Quirks::needsInputModeNoneImplicitly(const HTMLElement& element) const
 #endif
 }
 
+bool Quirks::needsGMailOverflowScrollQuirk() const
+{
+#if PLATFORM(IOS_FAMILY)
+    if (!needsQuirks())
+        return false;
+
+    if (!m_needsGMailOverflowScrollQuirk)
+        m_needsGMailOverflowScrollQuirk = equalLettersIgnoringASCIICase(m_document->url().host(), "mail.google.com");
+
+    return *m_needsGMailOverflowScrollQuirk;
+#else
+    return false;
+#endif
+}
+
+
 }
index a9771f9..0b6e79d 100644 (file)
@@ -54,6 +54,8 @@ public:
     WEBCORE_EXPORT bool isTouchBarUpdateSupressedForHiddenContentEditable() const;
     WEBCORE_EXPORT bool isNeverRichlyEditableForTouchBar() const;
 
+    bool needsGMailOverflowScrollQuirk() const;
+
 private:
     bool needsQuirks() const;
 
@@ -61,6 +63,9 @@ private:
 
     mutable Optional<bool> m_hasBrokenEncryptedMediaAPISupportQuirk;
     mutable Optional<bool> m_hasWebSQLSupportQuirk;
+#if PLATFORM(IOS_FAMILY)
+    mutable Optional<bool> m_needsGMailOverflowScrollQuirk;
+#endif
 };
 
 }