WPF - store width/height in local variable upon size change

Do this so it's easier to implement a workaround for #2779
This commit is contained in:
amaitland
2019-07-26 17:51:13 +10:00
parent 6f32aa1a0a
commit 023dec2309
+10 -5
View File
@@ -39,6 +39,11 @@ namespace CefSharp.Wpf
public const string PartImageName = "PART_image";
public const string PartPopupImageName = "PART_popupImage";
/// <summary>
/// View Rectangle used by <see cref="GetViewRect"/>
/// </summary>
private Rect viewRect;
/// <summary>
/// The source
/// </summary>
@@ -754,11 +759,6 @@ namespace CefSharp.Wpf
/// <returns>View Rectangle</returns>
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();