From 7fec79ffcf534494f5be699f3302f3a8a0fef009 Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Thu, 14 Nov 2019 06:00:05 +0000 Subject: [PATCH] style: Factor dynamic toolbar max height into layout metrics. Now * nsPresContext::mVisibleArea is excluding the toolbar max height so that ICB is now static regardless of the dynamic toolbar transition * nsPresContext::mSizeForViewportUnits is introduced to resolve viewport units which is including the toolbar max height That means that with the dynamic toolbar max height; mVisibleArea < mSizeForViewportUnits See https://github.com/bokand/URLBarSizing for more detail backgrounds of this change. Depends on D50417 Differential Revision: https://phabricator.services.mozilla.com/D50418 --- components/style/gecko/media_queries.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/components/style/gecko/media_queries.rs b/components/style/gecko/media_queries.rs index bb126e16948..2e68a889df1 100644 --- a/components/style/gecko/media_queries.rs +++ b/components/style/gecko/media_queries.rs @@ -237,7 +237,13 @@ impl Device { /// used for viewport unit resolution. pub fn au_viewport_size_for_viewport_unit_resolution(&self) -> Size2D { self.used_viewport_size.store(true, Ordering::Relaxed); - self.au_viewport_size() + + let pc = match self.pres_context() { + Some(pc) => pc, + None => return Size2D::new(Au(0), Au(0)), + }; + let size = &pc.mSizeForViewportUnits; + Size2D::new(Au(size.width), Au(size.height)) } /// Returns whether we ever looked up the viewport size of the Device.