wry icon indicating copy to clipboard operation
wry copied to clipboard

Rendering issue when resizing window with devtools open

Open probablykasper opened this issue 4 years ago • 12 comments
trafficstars

This ain't right

https://user-images.githubusercontent.com/11315492/121954761-69782200-cd5f-11eb-95a6-9537265c7b3b.mp4

Reproduction repo: https://github.com/probablykasper/tauri-devtools-resize-bug

Platform and Versions (please complete the following information):

OS: macOS 10.15.7 x64 Node: 14.16.0 npm: 6.14.11 rustc: 1.52.1

probablykasper avatar Jun 14 '21 20:06 probablykasper

I can confirm this is happening too. It also throws a weird stacktrace in the rust console:

2021-06-15 11:43:06.195 stronghold[82511:23309934] NSWindow warning: adding an unknown subview: <WKInspectorWKWebView: 0x7f86c3dbaa30>. Break on NSLog to debug.
2021-06-15 11:43:06.217 stronghold[82511:23309934] Call stack:
(
        0   AppKit                              0x00007fff22ba6d95 -[NSThemeFrame addSubview:] + 112
        1   AppKit                              0x00007fff22ba6ad3 -[NSView addSubview:positioned:relativeTo:] + 203
        2   AppKit                              0x00007fff22ba698d -[NSThemeFrame addSubview:positioned:relativeTo:] + 46
        3   WebKit                              0x00007fff3c84bcdd _ZN6WebKit17WebInspectorProxy14platformAttachEv + 393
        4   WebKit                              0x00007fff3cc73a98 _ZN6WebKit17WebInspectorProxy4openEv + 84
        5   WebKit                              0x00007fff3cdfd2cf _ZN6WebKit17WebInspectorProxy17didReceiveMessageERN3IPC10ConnectionERNS1_7DecoderE + 259
        6   WebKit                              0x00007fff3c8991e5 _ZN3IPC18MessageReceiverMap15dispatchMessageERNS_10ConnectionERNS_7DecoderE + 125
        7   WebKit                              0x00007fff3cbe4c88 _ZN6WebKit15WebProcessProxy17didReceiveMessageERN3IPC10ConnectionERNS1_7DecoderE + 28
        8   WebKit                              0x00007fff3c879c40 _ZN3IPC10Connection15dispatchMessageENSt3__110unique_ptrINS_7DecoderENS1_14default_deleteIS3_EEEE + 696
        9   WebKit                              0x00007fff3c8794ad _ZN3IPC10Connection24dispatchIncomingMessagesEv + 477
        10  JavaScriptCore                      0x00007fff376a088d _ZN3WTF7RunLoop11performWorkEv + 573
        11  JavaScriptCore                      0x00007fff376a133a _ZN3WTF7RunLoop11performWorkEPv + 26
        12  CoreFoundation                      0x00007fff2042a31d __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
        13  CoreFoundation                      0x00007fff2042a285 __CFRunLoopDoSource0 + 180
        14  CoreFoundation                      0x00007fff2042a005 __CFRunLoopDoSources0 + 248
        15  CoreFoundation                      0x00007fff20428a4d __CFRunLoopRun + 894
        16  CoreFoundation                      0x00007fff20427fe2 CFRunLoopRunSpecific + 567
        17  HIToolbox                           0x00007fff288f6630 RunCurrentEventLoopInMode + 292
        18  HIToolbox                           0x00007fff288f642c ReceiveNextEventCommon + 709
        19  HIToolbox                           0x00007fff288f614f _BlockUntilNextEventMatchingListInModeWithFilter + 64
        20  AppKit                              0x00007fff22b7d9b1 _DPSNextEvent + 883
        21  AppKit                              0x00007fff22b7c177 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1366
        22  AppKit                              0x00007fff22b6e68a -[NSApplication run] + 586
        23  stronghold                          0x0000000102333676 _ZN60_$LT$$LP$$RP$$u20$as$u20$objc..message..MessageArguments$GT$6invoke17h15df06694b8134bbE + 70
        24  stronghold                          0x00000001023365e2 _ZN4objc7message8platform15send_unverified17h5be9de5b2fce30f0E + 98
        25  stronghold                          0x0000000100f731ea _ZN3tao13platform_impl8platform10event_loop18EventLoop$LT$T$GT$10run_return17h1c385e938dce9162E + 1082
        26  stronghold                          0x0000000100f735d4 _ZN3tao13platform_impl8platform10event_loop18EventLoop$LT$T$GT$3run17h5bbffbac3c9903daE + 68
        27  stronghold                          0x0000000101091d3b _ZN3tao10event_loop18EventLoop$LT$T$GT$3run17h5e2880f9342c1e71E + 107
        28  stronghold                          0x00000001010b7219 _ZN65_$LT$tauri_runtime_wry..Wry$u20$as$u20$tauri_runtime..Runtime$GT$3run17h1afe8a212cafe554E + 345
        29  stronghold                          0x00000001010ab482 _ZN5tauri3app40Builder$LT$E$C$L$C$MID$C$TID$C$A$C$R$GT$3run17h66255987c861cd91E + 354
        30  stronghold                          0x00000001010c6033 _ZN10stronghold4main17h31ca7db4878ae5b8E + 7731
        31  stronghold                          0x0000000100e1b49e _ZN4core3ops8function6FnOnce9call_once17h4da314f9f5ba44b3E + 14
        32  stronghold                          0x00000001010ca0a1 _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h512dc74151202374E + 17
        33  stronghold                          0x0000000100d84544 _ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17hb658e2dc8014574aE + 20
        34  stronghold                          0x0000000102871bb4 _ZN3std2rt19lang_start_internal17h0c37a46739a0311dE + 644
        35  stronghold                          0x0000000100d8451e _ZN3std2rt10lang_start17ha81f12979bdf5c73E + 46
        36  stronghold                          0x00000001010c87c6 main + 22
        37  libdyld.dylib                       0x00007fff2034d621 start + 1
        38  ???                                 0x0000000000000001 0x0 + 1
)

I can also confirm, that closing the devtools, and then resizing returns everything to where it should be.

nothingismagick avatar Jun 15 '21 09:06 nothingismagick

This is caused by we setting webview with content view controller now. We just used addSubView method before, and that caused focusing bug.

Here's how chrome encountered this bug and fixed it. I can look into it further. But with a glance, it looks like they are using private API.

wusyong avatar Jun 15 '21 10:06 wusyong

@lucasfernog Is that stack trace from opening the devtools, or when you start resizing the window and he bug revealsitself?

Would also like to point out, it seems like the page is moved up the same height as the devtools panel's height

probablykasper avatar Jul 05 '21 17:07 probablykasper

Same issue here, content is gone when resizing

https://user-images.githubusercontent.com/4022128/132515161-27d60d38-a005-4ff3-8ea7-f861a51b7eae.mov

Janaka-Steph avatar Sep 08 '21 13:09 Janaka-Steph

I have the same issue as well. It happens when I try to open devtools. Minimal reproducer is https://github.com/ya55en/tauri-events-minimal with following local updates.

❯ git  diff
diff --git a/package.json b/package.json
index 811d7a3..90f7ea6 100644
--- a/package.json
+++ b/package.json
@@ -8,8 +8,8 @@
   "license": "Apache-2.0",
   "private": false,
   "devDependencies": {
-    "@tauri-apps/api": "^1.0.0-beta.5",
-    "@tauri-apps/cli": "^1.0.0-beta.6"
+    "@tauri-apps/api": "^1.0.0-beta.8",
+    "@tauri-apps/cli": "^1.0.0-beta.10"
   },
   "dependencies": {
     "http-server": "^0.12.3"
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
index 1a75ef4..89f7cfe 100644
--- a/src-tauri/Cargo.toml
+++ b/src-tauri/Cargo.toml
@@ -17,7 +17,7 @@ tauri-build = { version = "1.0.0-beta.3" }
 [dependencies]
 serde_json = "1.0"
 serde = { version = "1.0", features = ["derive"] }
-tauri = { version = "1.0.0-beta.5", features = ["api-all"] }
+tauri = { version = "1.0.0-beta.8", features = ["api-all"] }

 [features]
 default = [ "custom-protocol" ]
diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json
index 2b88ba9..36fec0f 100644
--- a/src-tauri/tauri.conf.json
+++ b/src-tauri/tauri.conf.json
@@ -6,7 +6,7 @@
   "build": {
     "distDir": "../www",
     "devPath": "http://localhost:8000",
-    "beforeDevCommand": "yarn http-server -p 8000 -c-1 www/",
+    "beforeDevCommand": "yarn http-server -a localhost -p 8000 -c-1 www/",
     "beforeBuildCommand": "",
     "withGlobalTauri": true
   },
2021-09-13 05:24:37.597 app[72623:7118729] Call stack:
(
	0   AppKit                              0x00007fff22c867b5 -[NSThemeFrame addSubview:] + 112
	1   AppKit                              0x00007fff22c864f4 -[NSView addSubview:positioned:relativeTo:] + 203
	2   AppKit                              0x00007fff22c863ae -[NSThemeFrame addSubview:positioned:relativeTo:] + 46
	3   WebKit                              0x00007fff3bf9c071 _ZN6WebKit17WebInspectorProxy14platformAttachEv + 391
	4   WebKit                              0x00007fff3c3d71ea _ZN6WebKit17WebInspectorProxy4openEv + 84
	5   WebKit                              0x00007fff3c59ac33 _ZN6WebKit17WebInspectorProxy17didReceiveMessageERN3IPC10ConnectionERNS1_7DecoderE + 259
	6   WebKit                              0x00007fff3bfe794f _ZN3IPC18MessageReceiverMap15dispatchMessageERNS_10ConnectionERNS_7DecoderE + 125
	7   WebKit                              0x00007fff3c374228 _ZN6WebKit15WebProcessProxy17didReceiveMessageERN3IPC10ConnectionERNS1_7DecoderE + 28
	8   WebKit                              0x00007fff3bfc93b6 _ZN3IPC10Connection15dispatchMessageENSt3__110unique_ptrINS_7DecoderENS1_14default_deleteIS3_EEEE + 700
	9   WebKit                              0x00007fff3bfc8bf4 _ZN3IPC10Connection24dispatchIncomingMessagesEv + 488
	10  JavaScriptCore                      0x00007fff373e45dd _ZN3WTF7RunLoop11performWorkEv + 573
	11  JavaScriptCore                      0x00007fff373e534a _ZN3WTF7RunLoop11performWorkEPv + 26
	12  CoreFoundation                      0x00007fff2045794c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
	13  CoreFoundation                      0x00007fff204578b4 __CFRunLoopDoSource0 + 180
	14  CoreFoundation                      0x00007fff20457634 __CFRunLoopDoSources0 + 242
	15  CoreFoundation                      0x00007fff2045605c __CFRunLoopRun + 893
	16  CoreFoundation                      0x00007fff2045561c CFRunLoopRunSpecific + 563
	17  HIToolbox                           0x00007fff2869ba83 RunCurrentEventLoopInMode + 292
	18  HIToolbox                           0x00007fff2869b7e5 ReceiveNextEventCommon + 587
	19  HIToolbox                           0x00007fff2869b583 _BlockUntilNextEventMatchingListInModeWithFilter + 70
	20  AppKit                              0x00007fff22c5d172 _DPSNextEvent + 864
	21  AppKit                              0x00007fff22c5b945 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1364
	22  AppKit                              0x00007fff22c4dc69 -[NSApplication run] + 586
	23  app                                 0x000000010235ab16 _ZN60_$LT$$LP$$RP$$u20$as$u20$objc..message..MessageArguments$GT$6invoke17h81c89a6fd82cbc85E + 70
	24  app                                 0x00000001023584d2 _ZN4objc7message8platform15send_unverified17h31442fbd96f1f6e3E + 98
	25  app                                 0x0000000101f4b5b1 _ZN3tao13platform_impl8platform10event_loop18EventLoop$LT$T$GT$10run_return17hd13e307007b0b478E + 1089
	26  app                                 0x0000000101f4ba1d _ZN3tao13platform_impl8platform10event_loop18EventLoop$LT$T$GT$3run17heae7e9b4fa5356feE + 61
	27  app                                 0x000000010215e72c _ZN3tao10event_loop18EventLoop$LT$T$GT$3run17h11c383b9e83c9ccdE + 108
	28  app                                 0x0000000101efe432 _ZN65_$LT$tauri_runtime_wry..Wry$u20$as$u20$tauri_runtime..Runtime$GT$3run17hcc614996f70335c4E + 914
	29  app                                 0x0000000102098765 _ZN5tauri3app12App$LT$R$GT$3run17h1f4ec837cd06b600E + 261
	30  app                                 0x0000000102098e06 _ZN5tauri3app16Builder$LT$R$GT$3run17h2d62f47f2a3daf55E + 198
	31  app                                 0x000000010215a65d _ZN3app4main17he9dddcd4d848df24E + 3373
	32  app                                 0x000000010202574e _ZN4core3ops8function6FnOnce9call_once17h24426d403bb8a3efE + 14
	33  app                                 0x0000000101f2f151 _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h1cd8f501d6793af7E + 17
	34  app                                 0x0000000101f2f774 _ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17hfbf08f9490cff8e8E + 20
	35  app                                 0x000000010280f121 _ZN3std2rt19lang_start_internal17h37583e1fa93097c4E + 641
	36  app                                 0x0000000101f2f74e _ZN3std2rt10lang_start17h7819f6be945aa75aE + 46
	37  app                                 0x000000010215af26 main + 22
	38  libdyld.dylib                       0x00007fff20379f3d start + 1
	39  ???                                 0x0000000000000001 0x0 + 1	

iilyak avatar Sep 13 '21 12:09 iilyak

@iilyak - ~~please update your tauri dependencies~~ [edit] nevermind. it helps to be able to read a diff lol

nothingismagick avatar Sep 13 '21 13:09 nothingismagick

Not sure if it is relevant. If I ignore the crash and then press "Send Event" button in the app I see the following in the terminal (looks like an int vs float):

2021-09-13 07:33:07.310 app[77332:7182036] Warning: Expected min height of view: (<NSPopoverTouchBarItemButton: 0x7fedc7d6f660>) to be less than or equal to 30 but got a height of 32.000000. This error will be logged once per view in violation.

iilyak avatar Sep 13 '21 14:09 iilyak

I found out we can avoid this issue by using NSFullSizeContentViewWindowMask when I read the chrome's issue. https://github.com/tauri-apps/wry/compare/dev...keiya01:fix/workaround-for-%23297?expand=1

keiya01 avatar Apr 02 '22 07:04 keiya01

@probablykasper Could youconfirm above fix work for you?

wusyong avatar Apr 02 '22 08:04 wusyong

It does! Great work @keiya01

probablykasper avatar Apr 03 '22 18:04 probablykasper

We still have rendering issues on resize if the window doesn't have decorations FYI (even with with_fullsize_content_view(true).

lucasfernog avatar Apr 18 '22 22:04 lucasfernog

Is setting with_fullsize_content_view(true) as default not affected existing user? Would content view is affected only when users are using titlebarAppearsTransparent ?

keiya01 avatar Apr 21 '22 12:04 keiya01