Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 30eb04f14b597dea982fdc352f4d4c70fca5d22e
      
https://github.com/WebKit/WebKit/commit/30eb04f14b597dea982fdc352f4d4c70fca5d22e
  Author: Chris Dumez <cdu...@apple.com>
  Date:   2025-03-06 (Thu, 06 Mar 2025)

  Changed paths:
    M Source/WTF/wtf/VectorTraits.h
    M Source/WebCore/css/CSSKeyframesRule.cpp

  Log Message:
  -----------
  Make `Vector::operator==` work correctly with padded structs
https://bugs.webkit.org/show_bug.cgi?id=287554
rdar://144700872

Reviewed by Geoffrey Garen.

VectorTraits::canCompareWithMemcmp is used to determine whether or not Vector 
can be used
to compare 2 vectors. It was initialized using:
- `std::is_standard_layout_v<T> && std::is_trivial_v<T>`

However, this led to incorrect results on some platforms when using padded 
structures.
To detect padded structures, we are now adding 
`std::has_unique_object_representations_v<T>`
to this check.

This is what is used already for the assertion inside equalSpans(), before 
calling
`memcmp()`. Per the documentation [1], has_unique_object_representations_v would
return false for padded structs.

[1] https://en.cppreference.com/w/cpp/types/has_unique_object_representations

* Source/WTF/wtf/VectorTraits.h:
* Source/WebCore/css/CSSKeyframesRule.cpp:
(WebCore::StyleRuleKeyframes::findKeyframeIndex const):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to