Bug 217060 - Fullscreen mode on mlb.com shows white letterboxing when video aspect ratio does not match screen
Summary: Fullscreen mode on mlb.com shows white letterboxing when video aspect ratio d...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jer Noble
URL:
Keywords: InRadar
Depends on:
Blocks: 248323
  Show dependency treegraph
 
Reported: 2020-09-28 11:36 PDT by Jer Noble
Modified: 2022-11-24 17:03 PST (History)
4 users (show)

See Also:


Attachments
Patch (3.37 KB, patch)
2020-09-28 11:48 PDT, Jer Noble
darin: review+
Details | Formatted Diff | Diff
Patch for landing (18.25 KB, patch)
2020-09-28 13:49 PDT, Jer Noble
jer.noble: commit-queue-
Details | Formatted Diff | Diff
Patch for landing (19.63 KB, patch)
2020-09-29 11:05 PDT, Jer Noble
no flags Details | Formatted Diff | Diff
Patch for landing (3.58 KB, patch)
2020-09-29 14:10 PDT, Jer Noble
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jer Noble 2020-09-28 11:36:16 PDT
Fullscreen mode on mlb.com shows white letterboxing when video aspect ratio does not match screen
Comment 1 Jer Noble 2020-09-28 11:36:44 PDT
<rdar://problem/68936043>
Comment 2 Jer Noble 2020-09-28 11:48:20 PDT
Created attachment 409908 [details]
Patch
Comment 3 Darin Adler 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.
Comment 4 Jer Noble 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.
Comment 5 Jer Noble 2020-09-28 12:11:09 PDT
s/:background/:backdrop/g
Comment 6 Jer Noble 2020-09-28 13:49:17 PDT
Created attachment 409916 [details]
Patch for landing
Comment 7 Darin Adler 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!
Comment 8 Darin Adler 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.
Comment 9 Peng Liu 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? :-)
Comment 10 Jer Noble 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.
Comment 11 Jer Noble 2020-09-29 11:05:06 PDT
Created attachment 410020 [details]
Patch for landing
Comment 12 Jer Noble 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.
Comment 13 Darin Adler 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.
Comment 14 Darin Adler 2020-09-29 11:12:03 PDT
Can we separate this one new quirk from the refactoring, please?
Comment 15 Jer Noble 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.
Comment 16 Jer Noble 2020-09-29 14:10:56 PDT
Created attachment 410049 [details]
Patch for landing
Comment 17 EWS 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].