@@ -13,12 +13,14 @@ use crate::servo_resources::{
1313} ;
1414use dpi:: PhysicalSize ;
1515use libservo:: {
16- Code , CompositionEvent , CompositionState , DeviceIntPoint , DeviceIntRect , DeviceIntSize ,
17- DevicePoint , EventLoopWaker , ImeEvent , InputEvent , Key , KeyState , KeyboardEvent , LoadStatus ,
18- Location , Modifiers , MouseButton , MouseButtonAction , MouseButtonEvent , MouseLeftViewportEvent ,
19- MouseMoveEvent , NamedKey , Opts , RenderingContext , Servo , ServoBuilder , ServoDelegate ,
20- SoftwareRenderingContext , WebView , WebViewBuilder , WebViewDelegate , WebViewPoint , WheelDelta ,
16+ CompositionState , Key , KeyState , Location , Modifiers , NamedKey , Opts , Servo , ServoBuilder ,
17+ ServoDelegate , WebView , WebViewBuilder , WebViewDelegate , prefs,
18+ Code , CompositionEvent , DeviceIntPoint , DeviceIntRect , DeviceIntSize ,
19+ DevicePoint , EventLoopWaker , ImeEvent , InputEvent , KeyboardEvent , LoadStatus ,
20+ MouseButton , MouseButtonAction , MouseButtonEvent , MouseLeftViewportEvent ,
21+ MouseMoveEvent , WebViewPoint , WheelDelta ,
2122 WheelEvent , WheelMode , WebResourceLoad , WebResourceResponse ,
23+ RenderingContext , SoftwareRenderingContext ,
2224} ;
2325use libservo:: clipboard_delegate:: { ClipboardDelegate , StringRequest } ;
2426use tracing_log:: LogTracer ;
@@ -377,20 +379,16 @@ impl ServoUpstreamRuntime {
377379 if let Some ( cache_dir) = & config. cache_path {
378380 std:: fs:: create_dir_all ( cache_dir) . ok ( ) ;
379381 }
380- let opts = Opts {
381- ignore_certificate_errors : config. ignore_certificate_errors ,
382- certificate_path : resolved_certificate_path
383- . as_ref ( )
384- . map ( |path| path. display ( ) . to_string ( ) ) ,
385- config_dir : config
386- . storage_path
387- . as_ref ( )
388- . and_then ( |p| p. parent ( ) . map ( |p| p. to_path_buf ( ) ) ) ,
389- user_agent : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 Brazen/0.1.0" . to_string ( ) ,
390- cache_dir : config. cache_path . clone ( ) ,
391- cookie_file : config. cookies_path . clone ( ) ,
392- ..Opts :: default ( )
393- } ;
382+ let mut opts = libservo:: Opts :: default ( ) ;
383+ opts. ignore_certificate_errors = config. ignore_certificate_errors ;
384+ opts. certificate_path = resolved_certificate_path. as_ref ( ) . map ( |p| p. display ( ) . to_string ( ) ) ;
385+ opts. config_dir = config. storage_path . as_ref ( ) . and_then ( |p| p. parent ( ) . map ( |p| p. to_path_buf ( ) ) ) ;
386+
387+ // Set preferences
388+ let mut preferences = prefs:: get ( ) . clone ( ) ;
389+ preferences. user_agent = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36" . to_string ( ) ;
390+ prefs:: set ( preferences) ;
391+
394392 let frame_ready = Arc :: new ( AtomicBool :: new ( true ) ) ;
395393 let rendering_context = Rc :: new (
396394 SoftwareRenderingContext :: new ( PhysicalSize :: new ( width, height) )
@@ -663,6 +661,15 @@ impl ServoUpstreamRuntime {
663661 }
664662
665663 pub fn handle_keyboard ( & self , key : & str , pressed : bool , modifiers : KeyModifiers , repeat : bool ) {
664+ tracing:: trace!(
665+ target: "brazen::servo::input" ,
666+ key = %key,
667+ pressed = pressed,
668+ modifiers = ?modifiers,
669+ repeat = repeat,
670+ "keyboard event received in upstream runtime"
671+ ) ;
672+
666673 let state = if pressed {
667674 KeyState :: Down
668675 } else {
0 commit comments