Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 0339b91d5f538645e0801d34a2bc0365a4cfb746
https://github.com/WebKit/WebKit/commit/0339b91d5f538645e0801d34a2bc0365a4cfb746
Author: Kiet Ho <[email protected]>
Date: 2026-04-09 (Thu, 09 Apr 2026)
Changed paths:
M Source/WebCore/animation/AcceleratedEffectStackUpdater.h
M Source/WebCore/style/Styleable.h
Log Message:
-----------
Constructing a hash table deleted value of WeakStyleable involves assigning a
deleted value of AtomString
rdar://174260083
https://bugs.webkit.org/show_bug.cgi?id=311669
Reviewed by Ryosuke Niwa.
constructDeletedValue() turns a WeakStyleable into a hash table deleted value:
constructDeletedValue(WeakStyleable& slot) { slot = { AtomString {
WTF::HashTableDeletedValue } }; }
It calls into this constructor:
WeakStyleable(AtomString name)
{
[...]
m_pseudoElementIdentifier->nameOrPart = name;
}
The hash table deleted value of AtomString gets copied around, but as noted in
the source, the deleted value is not meant to be copied, and will crash if so:
// Hash table deleted values, which are only constructed and never copied
or destroyed.
AtomString(WTF::HashTableDeletedValueType) :
m_string(WTF::HashTableDeletedValue) { }
This patch fixes this by utilizing WeakPtr m_element to mark a WeakStyleable as
deleted/empty instead. WeakPtr already supports deleted/empty constructions, so
we simply add new WeakStyleable constructions that constructs the WeakPtr as
deleted/empty.
Additionally this patch simplifies the hash traits/default hash implementation
of WeakStyleable:
* Defines add(Hasher&, WeakStyleable&) to get DefaultHash<WeakStyleable> for
free
from HasherBasedHash
* Derives the hash trait from SimpleClassHashTraits to get constructDeleteValue
and
isDeletedValue for free
* Make the hash trait struct an initialization of WTF::HashTrait<>, so
WeakStyleable
can be used with HashSet/HashMap without explicitly specifying the hash trait
struct
* Source/WebCore/animation/AcceleratedEffectStackUpdater.h:
* Source/WebCore/style/Styleable.h:
(WebCore::WeakStyleable::WeakStyleable):
(WebCore::WeakStyleable::isHashTableDeletedValue const):
(WebCore::WeakStyleable::isHashTableEmptyValue const):
(WebCore::add):
(WTF::HashTraits<WebCore::WeakStyleable>::emptyValue):
(WTF::HashTraits<WebCore::WeakStyleable>::isEmptyValue):
(WTF::HashTraits<WebCore::WeakStyleable>::isWeakNullValue):
(WebCore::WeakStyleableHashTraits::isWeakNullValue): Deleted.
(WebCore::WeakStyleableHashTraits::constructDeletedValue): Deleted.
(WebCore::WeakStyleableHashTraits::isDeletedValue): Deleted.
(WebCore::WeakStyleableHash::hash): Deleted.
(WebCore::WeakStyleableHash::equal): Deleted.
Canonical link: https://commits.webkit.org/310898@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications