Bug 179777 - Clean up KeyframeEffect
Summary: Clean up KeyframeEffect
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: Antoine Quint
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-11-16 09:29 PST by Antoine Quint
Modified: 2017-11-16 12:39 PST (History)
8 users (show)

See Also:


Attachments
Patch (4.45 KB, patch)
2017-11-16 09:31 PST, Antoine Quint
no flags Details | Formatted Diff | Diff
Patch for landing (4.44 KB, patch)
2017-11-16 09:57 PST, Antoine Quint
no flags Details | Formatted Diff | Diff
Patch for landing (4.43 KB, patch)
2017-11-16 10:04 PST, Antoine Quint
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antoine Quint 2017-11-16 09:29:16 PST
Clean up KeyframeEffect
Comment 1 Antoine Quint 2017-11-16 09:31:49 PST
Created attachment 327069 [details]
Patch
Comment 2 Daniel Bates 2017-11-16 09:46:03 PST
Comment on attachment 327069 [details]
Patch

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

> Source/WebCore/animation/KeyframeEffect.cpp:111
> +        Vector<CSSPropertyID> properties(numberOfCSSProperties);
>          for (unsigned k = 0; k < numberOfCSSProperties; ++k) {
> -            properties.append(styleProperties->propertyAt(k).id());
> +            properties.uncheckedAppend(styleProperties->propertyAt(k).id());

This is not correct. This will allocate numberOfCSSProperties CSSPropertyID default constructed objects; => we are both allocating capacity and changing the size of the Vector. Then we are using unchecked append to append new elements outside the bounds of the Vector. If we allocate up-front then we should be modifying the existing elements in the Vector. That is, we should not using uncheckedAppend. Alternatively, we should use Vector::reserveInitialCapacity() and Vector::uncheckedAppend() to allocate the underlying buffer without object construction and then safely construct new objects in the first free position in the buffer (increasing the size of the Vector).
Comment 3 Antoine Quint 2017-11-16 09:57:49 PST
Created attachment 327072 [details]
Patch for landing
Comment 4 Daniel Bates 2017-11-16 10:02:26 PST
Comment on attachment 327072 [details]
Patch for landing

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

> Source/WebCore/animation/KeyframeEffect.cpp:111
> +            properties[k] = WTFMove(styleProperties->propertyAt(k).id());

This is bad programming practice. We should not be moving this value as we are using it below. In practice, this code will work because CSSPropertyID is a POD type and is always copied.
Comment 5 Antoine Quint 2017-11-16 10:04:57 PST
Created attachment 327074 [details]
Patch for landing
Comment 6 WebKit Commit Bot 2017-11-16 12:38:28 PST
Comment on attachment 327074 [details]
Patch for landing

Clearing flags on attachment: 327074

Committed r224934: <https://trac.webkit.org/changeset/224934>
Comment 7 WebKit Commit Bot 2017-11-16 12:38:30 PST
All reviewed patches have been landed.  Closing bug.
Comment 8 Radar WebKit Bug Importer 2017-11-16 12:39:47 PST
<rdar://problem/35595728>