Bug 217060

Summary: Fullscreen mode on mlb.com shows white letterboxing when video aspect ratio does not match screen
Product: WebKit Reporter: Jer Noble <jer.noble>
Component: New BugsAssignee: Jer Noble <jer.noble>
Status: RESOLVED FIXED    
Severity: Normal CC: darin, eric.carlson, peng.liu6, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=248323
Bug Depends on:    
Bug Blocks: 248323    
Attachments:
Description Flags
Patch
darin: review+
Patch for landing
jer.noble: commit-queue-
Patch for landing
none
Patch for landing none

Jer Noble
Reported 2020-09-28 11:36:16 PDT
Fullscreen mode on mlb.com shows white letterboxing when video aspect ratio does not match screen
Attachments
Patch (3.37 KB, patch)
2020-09-28 11:48 PDT, Jer Noble
darin: review+
Patch for landing (18.25 KB, patch)
2020-09-28 13:49 PDT, Jer Noble
jer.noble: commit-queue-
Patch for landing (19.63 KB, patch)
2020-09-29 11:05 PDT, Jer Noble
no flags
Patch for landing (3.58 KB, patch)
2020-09-29 14:10 PDT, Jer Noble
no flags
Jer Noble
Comment 1 2020-09-28 11:36:44 PDT
Jer Noble
Comment 2 2020-09-28 11:48:20 PDT
Darin Adler
Comment 3 2020-09-28 11:53:18 PDT
Comment on attachment 409908 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=409908&action=review > Source/WebCore/page/Quirks.cpp:1074 > +bool Quirks::needsBlackFullscreenBackgroundQuirk() const Frustrating that unlike per-app quirks that at least have "linked on or after" rules, per-website quirks don’t come with an expiration date or any plan to eventually remove them. Do we need a comment explaining something about the context of why the quirk is added to help future people know when to remove a quirk? > Source/WebCore/page/Quirks.cpp:1081 > + m_needsBlackFullscreenBackgroundQuirk = equalLettersIgnoringASCIICase(host, "mlb.com") || host.endsWithIgnoringASCIICase(".mlb.com"); I wonder if this "equals or ends with (preceded by dot)" idiom should finally get its own helper function.
Jer Noble
Comment 4 2020-09-28 11:59:50 PDT
(In reply to Darin Adler from comment #3) > Comment on attachment 409908 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=409908&action=review > > > Source/WebCore/page/Quirks.cpp:1074 > > +bool Quirks::needsBlackFullscreenBackgroundQuirk() const > > Frustrating that unlike per-app quirks that at least have "linked on or > after" rules, per-website quirks don’t come with an expiration date or any > plan to eventually remove them. Do we need a comment explaining something > about the context of why the quirk is added to help future people know when > to remove a quirk? That's a good point; it looks like this specific problem would be mitigated if we supported the :background pseudo-element; I'll add a comment to that effect. > > Source/WebCore/page/Quirks.cpp:1081 > > + m_needsBlackFullscreenBackgroundQuirk = equalLettersIgnoringASCIICase(host, "mlb.com") || host.endsWithIgnoringASCIICase(".mlb.com"); > > I wonder if this "equals or ends with (preceded by dot)" idiom should > finally get its own helper function. It totally should.
Jer Noble
Comment 5 2020-09-28 12:11:09 PDT
s/:background/:backdrop/g
Jer Noble
Comment 6 2020-09-28 13:49:17 PDT
Created attachment 409916 [details] Patch for landing
Darin Adler
Comment 7 2020-09-28 14:36:06 PDT
Comment on attachment 409916 [details] Patch for landing View in context: https://bugs.webkit.org/attachment.cgi?id=409916&action=review > Source/WebCore/page/Quirks.cpp:77 > +static inline bool hostMatchesDomainOrSubdomains(const StringView& host, const StringView& domain) Should just be StringView, not const StringView&. > Source/WebCore/page/Quirks.cpp:739 > + m_needsPreloadAutoQuirk = hostMatchesDomainOrSubdomains(m_document->url().host(), "vimeo.com"); Missing "." here. Don’t land this!
Darin Adler
Comment 8 2020-09-28 14:46:38 PDT
Comment on attachment 409916 [details] Patch for landing View in context: https://bugs.webkit.org/attachment.cgi?id=409916&action=review > Source/WebCore/page/Quirks.cpp:77 > +static inline bool hostMatchesDomainOrSubdomains(const StringView& host, const StringView& domain) Should just be StringView, not const StringView&. No need to say inline here.
Peng Liu
Comment 9 2020-09-28 14:52:24 PDT
Comment on attachment 409916 [details] Patch for landing View in context: https://bugs.webkit.org/attachment.cgi?id=409916&action=review > Source/WebCore/page/Quirks.cpp:192 > + return hostMatchesDomainOrSubdomains(m_document->topDocument().url().host(), "youtube.com"); Missing "." as well? :-)
Jer Noble
Comment 10 2020-09-28 15:17:30 PDT
(In reply to Darin Adler from comment #7) > Comment on attachment 409916 [details] > Patch for landing > > View in context: > https://bugs.webkit.org/attachment.cgi?id=409916&action=review > > > Source/WebCore/page/Quirks.cpp:77 > > +static inline bool hostMatchesDomainOrSubdomains(const StringView& host, const StringView& domain) > > Should just be StringView, not const StringView&. > > > Source/WebCore/page/Quirks.cpp:739 > > + m_needsPreloadAutoQuirk = hostMatchesDomainOrSubdomains(m_document->url().host(), "vimeo.com"); > > Missing "." here. Don’t land this! Ack! I'll re-author this to make this a static assert. This should be something that can be caught at compilation time.
Jer Noble
Comment 11 2020-09-29 11:05:06 PDT
Created attachment 410020 [details] Patch for landing
Jer Noble
Comment 12 2020-09-29 11:08:08 PDT
I banged my head against C++17's support for constexpr string literals, static_assert's requirements, (lack of) support for strings as template arguments, and could not come up with a reasonable solution for doing compile-time checking of string contents. This should get better in C++20, maybe. Until then, I rewrote the hostMatchesDomainOrSubdomains() function to not require a domain parameter starting with a period, which in addition to not imposing a weird requirement on the domain parameter, should also make the comparison faster by only doing a string equality check once.
Darin Adler
Comment 13 2020-09-29 11:11:43 PDT
Comment on attachment 410020 [details] Patch for landing View in context: https://bugs.webkit.org/attachment.cgi?id=410020&action=review > Source/WebCore/page/Quirks.cpp:361 > - auto host = url.host().convertToASCIILowercase(); > + auto host = url.host(); Please do not land. This breaks a bunch of the code below, including the "trailers.apple.com" check and the ".naver.com" check.
Darin Adler
Comment 14 2020-09-29 11:12:03 PDT
Can we separate this one new quirk from the refactoring, please?
Jer Noble
Comment 15 2020-09-29 13:14:40 PDT
(In reply to Darin Adler from comment #14) > Can we separate this one new quirk from the refactoring, please? Sure, we can just land the original reviewed patch.
Jer Noble
Comment 16 2020-09-29 14:10:56 PDT
Created attachment 410049 [details] Patch for landing
EWS
Comment 17 2020-09-29 17:13:19 PDT
Committed r267773: <https://trac.webkit.org/changeset/267773> All reviewed patches have been landed. Closing bug and clearing flags on attachment 410049 [details].
Note You need to log in before you can comment on or make changes to this bug.