Bug 207058 - [iPad] Videos on nhl.com can't be scrubbed when loaded with desktop UA.
Summary: [iPad] Videos on nhl.com can't be scrubbed when loaded with desktop UA.
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:
 
Reported: 2020-01-31 10:53 PST by Jer Noble
Modified: 2020-02-03 15:39 PST (History)
6 users (show)

See Also:


Attachments
Patch (7.54 KB, patch)
2020-01-31 11:46 PST, Jer Noble
no flags Details | Formatted Diff | Diff
Patch (7.49 KB, patch)
2020-01-31 13:00 PST, Jer Noble
no flags Details | Formatted Diff | Diff
Patch (7.56 KB, patch)
2020-01-31 13:07 PST, Jer Noble
no flags Details | Formatted Diff | Diff
Patch (7.56 KB, patch)
2020-01-31 13:20 PST, Jer Noble
no flags Details | Formatted Diff | Diff
Patch (7.56 KB, patch)
2020-01-31 13:23 PST, Jer Noble
no flags Details | Formatted Diff | Diff
Patch (7.34 KB, patch)
2020-02-03 08:40 PST, Jer Noble
no flags Details | Formatted Diff | Diff
Patch for landing (7.27 KB, patch)
2020-02-03 13:42 PST, 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-01-31 10:53:38 PST
[iPad] Videos on nhl.com can't be scrubbed when loaded with desktop UA.
Comment 1 Jer Noble 2020-01-31 11:46:26 PST
Created attachment 389387 [details]
Patch
Comment 2 Jer Noble 2020-01-31 13:00:16 PST
Created attachment 389395 [details]
Patch
Comment 3 Jer Noble 2020-01-31 13:07:48 PST
Created attachment 389396 [details]
Patch
Comment 4 Jer Noble 2020-01-31 13:20:16 PST
Created attachment 389401 [details]
Patch
Comment 5 Jer Noble 2020-01-31 13:21:04 PST
<rdar://problem/58778950>
Comment 6 Jer Noble 2020-01-31 13:23:52 PST
Created attachment 389402 [details]
Patch
Comment 7 Darin Adler 2020-02-01 16:07:32 PST
Comment on attachment 389402 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=389402&action=review

> Source/WebCore/ChangeLog:1
> +        [iPad] Videos on nhl.com can't be scrubbed when loaded with desktop UA.

Isn’t this missing the name and date?

> Source/WebCore/ChangeLog:12
> +        Drive-by fix: There's no need to re-parse the entire URL and walk through all the cases
> +        every time shouldDispatchSimulatedMouseEvents() is called. Save the results of the initial
> +        pass so that subsequent checks are just a simple bool check.

This is best done by factoring into a function that returns a bool and a separate function that memoizes the result rather than changing every return statement.
Comment 8 Jer Noble 2020-02-03 08:27:20 PST
Comment on attachment 389402 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=389402&action=review

>> Source/WebCore/ChangeLog:1
>> +        [iPad] Videos on nhl.com can't be scrubbed when loaded with desktop UA.
> 
> Isn’t this missing the name and date?

Huh, that's weird. It does explain why webkit-patch threw an exception every time I tried to upload this patch.

>> Source/WebCore/ChangeLog:12
>> +        pass so that subsequent checks are just a simple bool check.
> 
> This is best done by factoring into a function that returns a bool and a separate function that memoizes the result rather than changing every return statement.

Will do.
Comment 9 Jer Noble 2020-02-03 08:40:36 PST
Created attachment 389518 [details]
Patch
Comment 10 Darin Adler 2020-02-03 12:43:24 PST
Comment on attachment 389518 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=389518&action=review

> Source/WebCore/page/Quirks.cpp:295
> +    if (m_shouldDispatchSimulatedMouseEventsQuirk)
> +        return m_shouldDispatchSimulatedMouseEventsQuirk.value();

I suggest merging this with the code below.

> Source/WebCore/page/Quirks.cpp:353
> +    m_shouldDispatchSimulatedMouseEventsQuirk = doShouldDispatchChecks();
> +    return m_shouldDispatchSimulatedMouseEventsQuirk.value();

I suggest writing it like this:

    if (!m_shouldDispatchSimulatedMouseEventsQuirk)
        m_shouldDispatchSimulatedMouseEventsQuirk = doShouldDispatchChecks();
    return *m_shouldDispatchSimulatedMouseEventsQuirk;

I don’t think we need the second return statement above.
Comment 11 Jer Noble 2020-02-03 13:40:12 PST
(In reply to Darin Adler from comment #10)
> Comment on attachment 389518 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=389518&action=review
> 
> > Source/WebCore/page/Quirks.cpp:295
> > +    if (m_shouldDispatchSimulatedMouseEventsQuirk)
> > +        return m_shouldDispatchSimulatedMouseEventsQuirk.value();
> 
> I suggest merging this with the code below.
> 
> > Source/WebCore/page/Quirks.cpp:353
> > +    m_shouldDispatchSimulatedMouseEventsQuirk = doShouldDispatchChecks();
> > +    return m_shouldDispatchSimulatedMouseEventsQuirk.value();
> 
> I suggest writing it like this:
> 
>     if (!m_shouldDispatchSimulatedMouseEventsQuirk)
>         m_shouldDispatchSimulatedMouseEventsQuirk = doShouldDispatchChecks();
>     return *m_shouldDispatchSimulatedMouseEventsQuirk;
> 
> I don’t think we need the second return statement above.

Will do. (Didn't realize that Optional had an `operator *()`.)
Comment 12 Jer Noble 2020-02-03 13:42:00 PST
Created attachment 389559 [details]
Patch for landing
Comment 13 WebKit Commit Bot 2020-02-03 14:15:24 PST
Comment on attachment 389559 [details]
Patch for landing

Clearing flags on attachment: 389559

Committed r255592: <https://trac.webkit.org/changeset/255592>
Comment 14 WebKit Commit Bot 2020-02-03 14:15:26 PST
All reviewed patches have been landed.  Closing bug.
Comment 15 Darin Adler 2020-02-03 15:13:56 PST
(In reply to Jer Noble from comment #11)
> Didn't realize that Optional had an `operator *()`.

For a long time I strongly supported using has_value() and value() on optionals, but I now think that we should almost always use "!" and "*". Stylistic choice, so maybe needs to be debated.
Comment 16 Jer Noble 2020-02-03 15:39:38 PST
Committed follow-up fix in r255609 <https://trac.webkit.org/changeset/255609>.