Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fullscreen mode on mlb.com shows white letterboxing when video aspect…
… ratio does not match screen

https://bugs.webkit.org/show_bug.cgi?id=217060
<rdar://problem/68936043>

Reviewed by Darin Adler.

Add a Quirk which sets the background color of fullscreen elements on mlb.com to black.

* page/Quirks.cpp:
(WebCore::Quirks::needsBlackFullscreenBackgroundQuirk const):
* page/Quirks.h:
* style/UserAgentStyle.cpp:
(WebCore::Style::UserAgentStyle::ensureDefaultStyleSheetsForElement):


Canonical link: https://commits.webkit.org/229894@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267773 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
jernoble committed Sep 30, 2020
1 parent 7f83b6c commit 09f2777
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,19 @@
2020-09-29 Jer Noble <jer.noble@apple.com>

Fullscreen mode on mlb.com shows white letterboxing when video aspect ratio does not match screen
https://bugs.webkit.org/show_bug.cgi?id=217060
<rdar://problem/68936043>

Reviewed by Darin Adler.

Add a Quirk which sets the background color of fullscreen elements on mlb.com to black.

* page/Quirks.cpp:
(WebCore::Quirks::needsBlackFullscreenBackgroundQuirk const):
* page/Quirks.h:
* style/UserAgentStyle.cpp:
(WebCore::Style::UserAgentStyle::ensureDefaultStyleSheetsForElement):

2020-09-29 Peng Liu <peng.liu6@apple.com>

[Media in GPU Process] Use VideoLayerManager to manage layers of MediaPlayerPrivateRemote
Expand Down
15 changes: 15 additions & 0 deletions Source/WebCore/page/Quirks.cpp
Expand Up @@ -1071,4 +1071,19 @@ bool Quirks::needsAkamaiMediaPlayerQuirk(const HTMLVideoElement& element) const
#endif
}

bool Quirks::needsBlackFullscreenBackgroundQuirk() const
{
// MLB.com sets a black background-color on the :backdrop pseudo element, which WebKit does not yet support. This
// quirk can be removed once support for :backdrop psedue element is added.
if (!needsQuirks())
return false;

if (!m_needsBlackFullscreenBackgroundQuirk) {
auto host = m_document->topDocument().url().host();
m_needsBlackFullscreenBackgroundQuirk = equalLettersIgnoringASCIICase(host, "mlb.com") || host.endsWithIgnoringASCIICase(".mlb.com");
}

return *m_needsBlackFullscreenBackgroundQuirk;
}

}
3 changes: 3 additions & 0 deletions Source/WebCore/page/Quirks.h
Expand Up @@ -119,6 +119,8 @@ class Quirks {

bool needsAkamaiMediaPlayerQuirk(const HTMLVideoElement&) const;

bool needsBlackFullscreenBackgroundQuirk() const;

private:
bool needsQuirks() const;

Expand Down Expand Up @@ -149,6 +151,7 @@ class Quirks {
mutable Optional<bool> m_shouldBypassAsyncScriptDeferring;
mutable Optional<bool> m_needsVP9FullRangeFlagQuirk;
mutable Optional<bool> m_needsHDRPixelDepthQuirk;
mutable Optional<bool> m_needsBlackFullscreenBackgroundQuirk;
};

}
2 changes: 2 additions & 0 deletions Source/WebCore/style/UserAgentStyle.cpp
Expand Up @@ -289,6 +289,8 @@ void UserAgentStyle::ensureDefaultStyleSheetsForElement(const Element& element)
StringBuilder fullscreenRules;
fullscreenRules.appendCharacters(fullscreenUserAgentStyleSheet, sizeof(fullscreenUserAgentStyleSheet));
fullscreenRules.append(RenderTheme::singleton().extraFullScreenStyleSheet());
if (element.document().quirks().needsBlackFullscreenBackgroundQuirk())
fullscreenRules.append(":-webkit-full-screen { background-color: black; }"_s);
fullscreenStyleSheet = parseUASheet(fullscreenRules.toString());
addToDefaultStyle(*fullscreenStyleSheet);
}
Expand Down

0 comments on commit 09f2777

Please sign in to comment.