Title: [251827] trunk/Source/WebCore
Revision
251827
Author
[email protected]
Date
2019-10-30 18:41:11 -0700 (Wed, 30 Oct 2019)

Log Message

Add fullscreen style quirk for reddit.com
https://bugs.webkit.org/show_bug.cgi?id=203635
<rdar://problem/55813774>

Reviewed by Eric Carlson.

Reddit.com expects the UA stylesheet to give the fullscreen element
a "width:100%; height:100%;" style.

* css/CSSDefaultStyleSheets.cpp:
(WebCore::CSSDefaultStyleSheets::ensureDefaultStyleSheetsForElement):
* page/Quirks.cpp:
(WebCore::Quirks::needsFullWidthHeightFullscreenStyleQuirk const):
* page/Quirks.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (251826 => 251827)


--- trunk/Source/WebCore/ChangeLog	2019-10-31 00:37:03 UTC (rev 251826)
+++ trunk/Source/WebCore/ChangeLog	2019-10-31 01:41:11 UTC (rev 251827)
@@ -1,3 +1,20 @@
+2019-10-30  Jer Noble  <[email protected]>
+
+        Add fullscreen style quirk for reddit.com
+        https://bugs.webkit.org/show_bug.cgi?id=203635
+        <rdar://problem/55813774>
+
+        Reviewed by Eric Carlson.
+
+        Reddit.com expects the UA stylesheet to give the fullscreen element
+        a "width:100%; height:100%;" style.
+
+        * css/CSSDefaultStyleSheets.cpp:
+        (WebCore::CSSDefaultStyleSheets::ensureDefaultStyleSheetsForElement):
+        * page/Quirks.cpp:
+        (WebCore::Quirks::needsFullWidthHeightFullscreenStyleQuirk const):
+        * page/Quirks.h:
+
 2019-10-30  Yusuke Suzuki  <[email protected]>
 
         [JSC] Date functions should have intrinsic

Modified: trunk/Source/WebCore/css/CSSDefaultStyleSheets.cpp (251826 => 251827)


--- trunk/Source/WebCore/css/CSSDefaultStyleSheets.cpp	2019-10-31 00:37:03 UTC (rev 251826)
+++ trunk/Source/WebCore/css/CSSDefaultStyleSheets.cpp	2019-10-31 01:41:11 UTC (rev 251827)
@@ -47,6 +47,7 @@
 #include "MathMLElement.h"
 #include "MediaQueryEvaluator.h"
 #include "Page.h"
+#include "Quirks.h"
 #include "RenderTheme.h"
 #include "RuleSet.h"
 #include "SVGElement.h"
@@ -277,8 +278,12 @@
 
 #if ENABLE(FULLSCREEN_API)
     if (!fullscreenStyleSheet && element.document().fullscreenManager().isFullscreen()) {
-        String fullscreenRules = String(fullscreenUserAgentStyleSheet, sizeof(fullscreenUserAgentStyleSheet)) + RenderTheme::singleton().extraFullScreenStyleSheet();
-        fullscreenStyleSheet = parseUASheet(fullscreenRules);
+        StringBuilder fullscreenRules;
+        fullscreenRules.appendCharacters(fullscreenUserAgentStyleSheet, sizeof(fullscreenUserAgentStyleSheet));
+        fullscreenRules.append(RenderTheme::singleton().extraFullScreenStyleSheet());
+        if (element.document().quirks().needsFullWidthHeightFullscreenStyleQuirk())
+            fullscreenRules.append(":-webkit-full-screen { width:100%; height:100%; }");
+        fullscreenStyleSheet = parseUASheet(fullscreenRules.toString());
         addToDefaultStyle(*fullscreenStyleSheet);
     }
 #endif // ENABLE(FULLSCREEN_API)

Modified: trunk/Source/WebCore/page/Quirks.cpp (251826 => 251827)


--- trunk/Source/WebCore/page/Quirks.cpp	2019-10-31 00:37:03 UTC (rev 251826)
+++ trunk/Source/WebCore/page/Quirks.cpp	2019-10-31 01:41:11 UTC (rev 251827)
@@ -594,4 +594,19 @@
 #endif
 }
 
+bool Quirks::needsFullWidthHeightFullscreenStyleQuirk() const
+{
+    if (!needsQuirks())
+        return false;
+
+    if (m_needsFullWidthHeightFullscreenStyleQuirk)
+        return m_needsFullWidthHeightFullscreenStyleQuirk.value();
+
+    auto domain = m_document->securityOrigin().domain().convertToASCIILowercase();
+
+    m_needsFullWidthHeightFullscreenStyleQuirk = domain == "reddit.com" || domain.endsWith(".reddit.com");
+
+    return m_needsFullWidthHeightFullscreenStyleQuirk.value();
 }
+
+}

Modified: trunk/Source/WebCore/page/Quirks.h (251826 => 251827)


--- trunk/Source/WebCore/page/Quirks.h	2019-10-31 00:37:03 UTC (rev 251826)
+++ trunk/Source/WebCore/page/Quirks.h	2019-10-31 01:41:11 UTC (rev 251827)
@@ -80,6 +80,7 @@
     bool shouldOpenAsAboutBlank(const String&) const;
 
     bool needsPreloadAutoQuirk() const;
+    bool needsFullWidthHeightFullscreenStyleQuirk() const;
 
 private:
     bool needsQuirks() const;
@@ -92,6 +93,7 @@
     WeakPtr<Document> m_document;
 
     mutable Optional<bool> m_hasBrokenEncryptedMediaAPISupportQuirk;
+    mutable Optional<bool> m_needsFullWidthHeightFullscreenStyleQuirk;
 #if PLATFORM(IOS_FAMILY)
     mutable Optional<bool> m_needsGMailOverflowScrollQuirk;
     mutable Optional<bool> m_needsYouTubeOverflowScrollQuirk;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to