Migrate usage of the Hash trait for cache invalidation to the dedicated CacheHash trait (#4051)

* WIP start migrating usages of hash for cache invalidadion to dedicated trait

* Finish migrating usages

* Code review

* Add comments clearifying the reasoning for using random ids in the VectorModification cach hash impl

* Fix some remaining hash violations

* Finish migration and fix compilation

* Fix import ordering

* Cleanup

* Fix code review stuff

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
Dennis Kobert
2026-04-27 07:18:47 +02:00
committed by GitHub
parent 7bb01c9651
commit 3d84e63ef9
64 changed files with 828 additions and 448 deletions

View File

@@ -1,3 +1,4 @@
use core_types::graphene_hash::CacheHash;
use dyn_any::DynAny;
use parley::fontique::Blob;
use std::collections::HashMap;
@@ -23,6 +24,14 @@ impl std::hash::Hash for Font {
}
}
impl CacheHash for Font {
fn cache_hash<H: core::hash::Hasher>(&self, state: &mut H) {
self.font_family.cache_hash(state);
self.font_style.cache_hash(state);
// Don't consider `font_style_to_restore` in the HashMaps
}
}
impl PartialEq for Font {
fn eq(&self, other: &Self) -> bool {
// Don't consider `font_style_to_restore` in the HashMaps