mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
stylo: Use font metrics provider as a cache for font size results
This commit is contained in:
parent
e402c72d0e
commit
2febe7ccde
8 changed files with 60 additions and 24 deletions
|
@ -186,10 +186,11 @@ impl fmt::Display for WeakAtom {
|
|||
|
||||
impl Atom {
|
||||
/// Execute a callback with the atom represented by `ptr`.
|
||||
pub unsafe fn with<F>(ptr: *mut nsIAtom, callback: &mut F) where F: FnMut(&Atom) {
|
||||
pub unsafe fn with<F, R: 'static>(ptr: *mut nsIAtom, callback: &mut F) -> R where F: FnMut(&Atom) -> R {
|
||||
let atom = Atom(WeakAtom::new(ptr));
|
||||
callback(&atom);
|
||||
let ret = callback(&atom);
|
||||
mem::forget(atom);
|
||||
ret
|
||||
}
|
||||
|
||||
/// Creates an atom from an static atom pointer without checking in release
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue