Bug 216192 - REGRESSION (r260571): Scrolling on weather.com in Safari causes the gradient background to flicker (fixed backgrounds)
Summary: REGRESSION (r260571): Scrolling on weather.com in Safari causes the gradient ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Scrolling (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Simon Fraser (smfr)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-09-04 14:36 PDT by Simon Fraser (smfr)
Modified: 2020-09-05 10:56 PDT (History)
10 users (show)

See Also:


Attachments
Patch (4.14 KB, patch)
2020-09-04 14:39 PDT, Simon Fraser (smfr)
thorton: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Fraser (smfr) 2020-09-04 14:36:52 PDT
REGRESSION (r260571): Scrolling on weather.com in Safari causes the gradient background to flicker (fixed backgrounds)
Comment 1 Simon Fraser (smfr) 2020-09-04 14:39:35 PDT
Created attachment 408025 [details]
Patch
Comment 2 Simon Fraser (smfr) 2020-09-04 14:39:37 PDT
<rdar://problem/68192010>
Comment 3 Darin Adler 2020-09-04 17:01:50 PDT
Comment on attachment 408025 [details]
Patch

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

> Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp:124
> +    if (auto* rootNode = this->rootNode())
> +        return !rootNode->hasSynchronousScrollingReasons();
> +
> +    return true;

Here’s how I would write this:

    auto rootNode = this->rootNode();
    return !rootNode || !rootNode->hasSynchronousScrollingReasons();

I actually find this easier to reason about than the return-based one. Not sure others agree. Another option would be:

    auto rootNode = this->rootNode();
    return rootNode && rootNode->hasSynchronousScrollingReasons();

A plus for using auto rather than auto* is that we can switch to returning RefPtr from rootNode if we want to for object lifetime safety without modifying this call site.
Comment 4 Simon Fraser (smfr) 2020-09-04 18:49:11 PDT
(In reply to Darin Adler from comment #3)
> Comment on attachment 408025 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=408025&action=review
> 
> > Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp:124
> > +    if (auto* rootNode = this->rootNode())
> > +        return !rootNode->hasSynchronousScrollingReasons();
> > +
> > +    return true;
> 
> Here’s how I would write this:
> 
>     auto rootNode = this->rootNode();
>     return !rootNode || !rootNode->hasSynchronousScrollingReasons();
> 
> I actually find this easier to reason about than the return-based one. Not
> sure others agree. Another option would be:
> 
>     auto rootNode = this->rootNode();
>     return rootNode && rootNode->hasSynchronousScrollingReasons();

I think you mean !(rootNode && rootNode->hasSynchronousScrollingReasons());

I tried both previous versions as I was writing the patch.
 
> A plus for using auto rather than auto* is that we can switch to returning
> RefPtr from rootNode if we want to for object lifetime safety without
> modifying this call site.

I'm not a fan of 'auto' hiding the fact that it's a pointer.
Comment 5 Simon Fraser (smfr) 2020-09-05 10:56:24 PDT
https://trac.webkit.org/changeset/266664/webkit