Fix broken viewport percentage length units after a viewport resize.

When a viewport is resized, the computed values for a style containing viewport percentage length units become stale. However, there's no way for those styles to be invalidated after a resize. As a solution, this commit invalidates the computed values cache after a resize has occurred, which is probably over-kill.

A better solution would probably be to track under what conditions computed values remain valid, and invalidate them as indicated.
This commit is contained in:
James Gilbertson 2015-03-07 23:16:30 -07:00
parent 09c36de8f1
commit fafc357308
3 changed files with 19 additions and 5 deletions

View file

@ -41,6 +41,10 @@ fn create_or_get_local_context(shared_layout_context: &SharedLayoutContext) -> *
style_sharing_candidate_cache: StyleSharingCandidateCache::new(),
};
r.set(unsafe { boxed::into_raw(context) });
} else if shared_layout_context.screen_size_changed {
unsafe {
(*r.get()).applicable_declarations_cache.evict_all();
}
}
r.get()
@ -54,6 +58,9 @@ pub struct SharedLayoutContext {
/// The current screen size.
pub screen_size: Size2D<Au>,
/// Screen sized changed?
pub screen_size_changed: bool,
/// A channel up to the constellation.
pub constellation_chan: ConstellationChan,