@@ -2829,10 +2829,10 @@ fn handle_user_message<T: UserEvent>(
28292829 bounds. height = size. height ;
28302830
28312831 if let Some ( b) = & webview. bounds {
2832- let window_size = window. inner_size ( ) ;
2832+ let window_size = window. inner_size ( ) . to_logical :: < f32 > ( window . scale_factor ( ) ) ;
28332833 let mut bounds = b. lock ( ) . unwrap ( ) ;
2834- bounds. width_rate = size. width as f32 / window_size. width as f32 ;
2835- bounds. height_rate = size. height as f32 / window_size. height as f32 ;
2834+ bounds. width_rate = size. width as f32 / window_size. width ;
2835+ bounds. height_rate = size. height as f32 / window_size. height ;
28362836 }
28372837
28382838 webview. set_bounds ( bounds) ;
@@ -2844,10 +2844,11 @@ fn handle_user_message<T: UserEvent>(
28442844 bounds. y = position. y ;
28452845
28462846 if let Some ( b) = & webview. bounds {
2847- let window_size = window. inner_size ( ) ;
2847+ let window_size = window. inner_size ( ) . to_logical :: < f32 > ( window . scale_factor ( ) ) ;
28482848 let mut bounds = b. lock ( ) . unwrap ( ) ;
2849- bounds. width_rate = position. x as f32 / window_size. width as f32 ;
2850- bounds. height_rate = position. y as f32 / window_size. height as f32 ;
2849+
2850+ bounds. x_rate = position. x as f32 / window_size. width ;
2851+ bounds. y_rate = position. y as f32 / window_size. height ;
28512852 }
28522853
28532854 webview. set_bounds ( bounds) ;
@@ -2913,7 +2914,6 @@ fn handle_user_message<T: UserEvent>(
29132914 f ( webview. handle ( ) )
29142915 }
29152916 }
2916-
29172917 #[ cfg( any( debug_assertions, feature = "devtools" ) ) ]
29182918 WebviewMessage :: OpenDevTools => {
29192919 webview. open_devtools ( ) ;
@@ -2940,6 +2940,7 @@ fn handle_user_message<T: UserEvent>(
29402940 Ok ( webview) => {
29412941 windows. 0 . borrow_mut ( ) . get_mut ( & window_id) . map ( |w| {
29422942 w. webviews . push ( webview) ;
2943+ w. has_children . store ( true , Ordering :: Relaxed ) ;
29432944 w
29442945 } ) ;
29452946 }
@@ -3181,20 +3182,21 @@ fn handle_event_loop<T: UserEvent>(
31813182 }
31823183 }
31833184 TaoWindowEvent :: Resized ( size) => {
3184- if let Some ( webviews) = windows
3185+ if let Some ( ( Some ( window ) , webviews) ) = windows
31853186 . 0
31863187 . borrow ( )
31873188 . get ( & window_id)
3188- . map ( |w| w . webviews . clone ( ) )
3189+ . map ( |w| ( w . inner . clone ( ) , w . webviews . clone ( ) ) )
31893190 {
3191+ let size = size. to_logical :: < f32 > ( window. scale_factor ( ) ) ;
31903192 for webview in webviews {
31913193 if let Some ( bounds) = & webview. bounds {
31923194 let b = bounds. lock ( ) . unwrap ( ) ;
31933195 webview. set_bounds ( wry:: Rect {
3194- x : ( size. width as f32 * b. x_rate ) as i32 ,
3195- y : ( size. height as f32 * b. y_rate ) as i32 ,
3196- width : ( size. width as f32 * b. width_rate ) as u32 ,
3197- height : ( size. height as f32 * b. height_rate ) as u32 ,
3196+ x : ( size. width * b. x_rate ) as i32 ,
3197+ y : ( size. height * b. y_rate ) as i32 ,
3198+ width : ( size. width * b. width_rate ) as u32 ,
3199+ height : ( size. height * b. height_rate ) as u32 ,
31983200 } ) ;
31993201 }
32003202 }
@@ -3594,7 +3596,8 @@ fn create_webview<T: UserEvent>(
35943596
35953597 if let Some ( navigation_handler) = pending. navigation_handler {
35963598 webview_builder = webview_builder. with_navigation_handler ( move |url| {
3597- Url :: parse ( & url)
3599+ url
3600+ . parse ( )
35983601 . map ( |url| navigation_handler ( & url) )
35993602 . unwrap_or ( true )
36003603 } ) ;
@@ -3610,14 +3613,14 @@ fn create_webview<T: UserEvent>(
36103613 height : size. height ,
36113614 } ) ;
36123615
3613- let window_size = window. inner_size ( ) ;
3616+ let window_size = window. inner_size ( ) . to_logical :: < f32 > ( window . scale_factor ( ) ) ;
36143617
36153618 if webview_attributes. auto_resize {
36163619 Some ( WebviewBounds {
3617- x_rate : ( position. x as f32 ) / window_size. width as f32 ,
3618- y_rate : ( position. y as f32 ) / window_size. height as f32 ,
3619- width_rate : ( size. width as f32 ) / window_size. width as f32 ,
3620- height_rate : ( size. height as f32 ) / window_size. height as f32 ,
3620+ x_rate : ( position. x as f32 ) / window_size. width ,
3621+ y_rate : ( position. y as f32 ) / window_size. height ,
3622+ width_rate : ( size. width as f32 ) / window_size. width ,
3623+ height_rate : ( size. height as f32 ) / window_size. height ,
36213624 } )
36223625 } else {
36233626 None
@@ -3647,7 +3650,7 @@ fn create_webview<T: UserEvent>(
36473650
36483651 if let Some ( page_load_handler) = pending. on_page_load_handler {
36493652 webview_builder = webview_builder. with_on_page_load_handler ( move |event, url| {
3650- let _ = Url :: parse ( & url ) . map ( |url| {
3653+ let _ = url . parse ( ) . map ( |url| {
36513654 page_load_handler (
36523655 url,
36533656 match event {
0 commit comments