Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 183405b4b633edb81bd6a4e82805bb828ed4a582
      
https://github.com/WebKit/WebKit/commit/183405b4b633edb81bd6a4e82805bb828ed4a582
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-10-13 (Tue, 13 Oct 2026)

  Changed paths:
    M Source/WTF/wtf/StdLibExtras.h
    M Tools/TestWebKitAPI/Tests/WTF/StdLibExtrasTests.cpp

  Log Message:
  -----------
  Style tuple-like blending helpers copy every field on each blend/equality 
check
https://bugs.webkit.org/show_bug.cgi?id=325388
rdar://188497454

Reviewed by Sam Weinig.

The *OnTupleLike helpers in StyleValueTypes.h (equalsForBlending, canBlend,
requiresInterpolationForAccumulativeIteration, and blend) feed their operands
through WTF::tuple_zip() and fold over the result. tuple_zip built its
transposed tuple out of std::tuple_element_t, which for the common tuple-like
aggregates (SpaceSeparatedTuple, pairs, points, sizes, arrays) is a value type.
As a result every field of both operands was copied into that intermediate
tuple on each call, even for the equality/canBlend paths that build no output.
These run per-frame on animation hot paths.

Make tuple_zip zip references instead. zip_tuple_at_index now uses
std::forward_as_tuple(get<I>(...)...), which preserves the reference and
const-ness of each source element, so the returned tuple binds references
rather than copying the fields. The outer tuple is spelled out explicitly (not
via CTAD), so single-field tuple-likes still produce a one-element outer tuple.
get<I> stays unqualified so user-defined tuple-likes are found via ADL. The
StyleValueTypes.h helpers are unchanged and keep using tuple_zip + WTF::apply. 
Behavior is
unchanged; the sources already outlive the zipped result at every call site.

Add API tests covering the subtle parts: transposition, reference binding and
aliasing, const preservation, single-element and single-operand inputs, mixed
std::pair/std::array operands, user-defined tuple-likes, and use with
WTF::apply.

* Source/WTF/wtf/StdLibExtras.h:
(WTF::detail::zip_tuple_at_index):
(WTF::detail::tuple_zip_impl):
* Tools/TestWebKitAPI/Tests/WTF/StdLibExtrasTests.cpp:
(TestWebKitAPI::TEST(WTF_StdLibExtras, TupleZipTransposes)):
(TestWebKitAPI::TEST(WTF_StdLibExtras, TupleZipBindsReferencesToLvalues)):
(TestWebKitAPI::TEST(WTF_StdLibExtras, TupleZipPreservesConst)):
(TestWebKitAPI::TEST(WTF_StdLibExtras, TupleZipSingleElement)):
(TestWebKitAPI::TEST(WTF_StdLibExtras, TupleZipSingleOperand)):
(TestWebKitAPI::TEST(WTF_StdLibExtras, TupleZipMixedTupleLikes)):
(TestWebKitAPI::TEST(WTF_StdLibExtras, TupleZipUserDefinedTupleLike)):
(TestWebKitAPI::TEST(WTF_StdLibExtras, TupleZipWithApply)):

Canonical link: https://commits.webkit.org/323690@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to