Bug 179982 - Style resolution spin due to calc() values in animations always comparing inequal (seen on arstechnica.com)
Summary: Style resolution spin due to calc() values in animations always comparing ine...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
: 180733 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-11-23 13:08 PST by Antti Koivisto
Modified: 2017-12-14 01:58 PST (History)
7 users (show)

See Also:


Attachments
reduction (249 bytes, text/html)
2017-11-23 13:09 PST, Antti Koivisto
no flags Details
reduction (363 bytes, text/html)
2017-11-23 13:27 PST, Antti Koivisto
no flags Details
patch (5.26 KB, patch)
2017-11-24 03:49 PST, Antti Koivisto
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antti Koivisto 2017-11-23 13:08:48 PST
Reduction attached.
Comment 1 Antti Koivisto 2017-11-23 13:09:36 PST
Created attachment 327513 [details]
reduction
Comment 2 Radar WebKit Bug Importer 2017-11-23 13:10:07 PST
<rdar://problem/35677991>
Comment 3 Antti Koivisto 2017-11-23 13:27:09 PST
Created attachment 327514 [details]
reduction
Comment 4 Antti Koivisto 2017-11-23 13:36:47 PST
Basically something like calc(100% - 10px) compares inequal to itself. This causes the implicit animation engine think that there is a new value after style recalc and restart the transition. Starting the transition triggers style recalc on zero duration timer which restarts the transition and so on.
Comment 5 Antti Koivisto 2017-11-24 03:49:21 PST
Created attachment 327538 [details]
patch
Comment 6 Darin Adler 2017-11-24 11:22:30 PST
Comment on attachment 327538 [details]
patch

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

> Source/WebCore/platform/CalculationValue.cpp:130
> +    // Maybe Vectors of unique_ptrs should always do deep compare?

VectorTypeOperations exists so that we can do that kind of thing. It looks like we never specialized VectorTypeOperations, though, so I’m not entirely sure why we have it!

> Source/WebCore/platform/CalculationValue.cpp:134
> +        if (!(*a.children()[i] == *b.children()[i]))

Could use a != b instead of !(a == b)
Comment 7 Antti Koivisto 2017-11-24 12:56:08 PST
> VectorTypeOperations exists so that we can do that kind of thing. It looks
> like we never specialized VectorTypeOperations, though, so I’m not entirely
> sure why we have it!

This more in the realm of VectorComparer. We could easily add a deep compare vector trait if we think that is a good idea. 

I can't really see any cases where pointer-comparing unique_ptr vectors would be correct. On the other hand it might be surprising that ptr vector and unique_ptr vector behave differently in default comparisons.

> Could use a != b instead of !(a == b)

Yes, after adding it. I'll keep this patch minimal for easy integration.
Comment 8 WebKit Commit Bot 2017-11-24 13:15:58 PST
Comment on attachment 327538 [details]
patch

Clearing flags on attachment: 327538

Committed r225141: <https://trac.webkit.org/changeset/225141>
Comment 9 WebKit Commit Bot 2017-11-24 13:15:59 PST
All reviewed patches have been landed.  Closing bug.
Comment 10 Antti Koivisto 2017-12-14 01:58:30 PST
*** Bug 180733 has been marked as a duplicate of this bug. ***