Skip to content

Commit 10073e5

Browse files
committed
chore(ViewerView): Remove the workaround for broken resizing
Upstream CefSharp now has its own workaround for this issue, no longer need our own.
1 parent b0c3763 commit 10073e5

1 file changed

Lines changed: 0 additions & 38 deletions

File tree

src/SyncTrayzor/Pages/ViewerViewModel.cs

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ public class ViewerViewModel : Screen, IResourceRequestHandlerFactory, ILifeSpan
3333
private CultureInfo? culture;
3434
private double zoomLevel;
3535

36-
private CancellationTokenSource? _resizeCancellation;
37-
private readonly object _resizeTokenLock = new();
38-
3936
public string? Location
4037
{
4138
get => WebBrowser?.Address;
@@ -239,8 +236,6 @@ private void InitializeBrowser(ChromiumWebBrowser webBrowser)
239236

240237
e.Handled = true;
241238
};
242-
243-
webBrowser.SizeChanged += OnSizeChanged;
244239
}
245240

246241
public void RefreshBrowserNukeCache()
@@ -386,39 +381,6 @@ private CefReturnValue OnBeforeResourceLoad(IWebBrowser browserControl, IBrowser
386381
return CefReturnValue.Continue;
387382
}
388383

389-
[SuppressPropertyChangedWarnings]
390-
private void OnSizeChanged(object? sender, SizeChangedEventArgs e)
391-
{
392-
if (syncthingState != SyncthingState.Running) return;
393-
lock (_resizeTokenLock)
394-
{
395-
// Cancel previous scheduled task if it exists
396-
_resizeCancellation?.Cancel();
397-
_resizeCancellation?.Dispose();
398-
399-
// Create a new CTS for the new task
400-
_resizeCancellation = new CancellationTokenSource();
401-
var token = _resizeCancellation.Token;
402-
403-
// Schedule the task
404-
_ = Task.Run(async () =>
405-
{
406-
try
407-
{
408-
await Task.Delay(10, token);
409-
410-
// Workaround for https://github.com/cefsharp/CefSharp/issues/4953
411-
WebBrowser?.GetBrowserHost()?.Invalidate(PaintElementType.View);
412-
WebBrowser?.InvalidateVisual();
413-
}
414-
catch (TaskCanceledException)
415-
{
416-
// Swallow cancellation
417-
}
418-
}, token);
419-
}
420-
}
421-
422384
void ILifeSpanHandler.OnBeforeClose(IWebBrowser browserControl, IBrowser browser)
423385
{
424386
}

0 commit comments

Comments
 (0)