From 023dec23099fac6f2fb901bf5492ef96e3bfcf7d Mon Sep 17 00:00:00 2001 From: amaitland Date: Fri, 26 Jul 2019 17:51:13 +1000 Subject: [PATCH] WPF - store width/height in local variable upon size change Do this so it's easier to implement a workaround for #2779 --- CefSharp.Wpf/ChromiumWebBrowser.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/CefSharp.Wpf/ChromiumWebBrowser.cs b/CefSharp.Wpf/ChromiumWebBrowser.cs index 5ebed2973..4e42faf65 100644 --- a/CefSharp.Wpf/ChromiumWebBrowser.cs +++ b/CefSharp.Wpf/ChromiumWebBrowser.cs @@ -39,6 +39,11 @@ namespace CefSharp.Wpf public const string PartImageName = "PART_image"; public const string PartPopupImageName = "PART_popupImage"; + /// + /// View Rectangle used by + /// + private Rect viewRect; + /// /// The source /// @@ -754,11 +759,6 @@ namespace CefSharp.Wpf /// View Rectangle protected virtual Rect GetViewRect() { - //NOTE: Previous we used Math.Ceiling to round the sizing up, we - //now set UseLayoutRounding = true; on the control so the sizes are - //already rounded to a whole number for us. - var viewRect = new Rect(0, 0, (int)ActualWidth, (int)ActualHeight); - return viewRect; } @@ -1856,6 +1856,11 @@ namespace CefSharp.Wpf // Initialize RenderClientAdapter when WPF has calculated the actual size of current content. CreateOffscreenBrowser(e.NewSize); + //NOTE: Previous we used Math.Ceiling to round the sizing up, we + //now set UseLayoutRounding = true; on the control so the sizes are + //already rounded to a whole number for us. + viewRect = new Rect(0, 0, (int)e.NewSize.Width, (int)e.NewSize.Height); + if (browser != null) { browser.GetHost().WasResized();