Skip to content

Commit eb63920

Browse files
committed
Merge branch 'bookmark-manager-improvement' into 'main'
chore: Turn show_bookmark into Window specific See merge request verso-browser/verso!330
2 parents ec29110 + cc17b73 commit eb63920

File tree

4 files changed

+11
-15
lines changed

4 files changed

+11
-15
lines changed

src/compositor.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,6 @@ pub struct IOCompositor {
187187
/// will want to avoid blocking on UI events, and just
188188
/// run the event loop at the vsync interval.
189189
pub is_animating: bool,
190-
191-
/// Show the bookmark bar or not
192-
pub show_bookmark: bool,
193190
}
194191

195192
#[derive(Clone, Copy)]
@@ -373,7 +370,6 @@ impl IOCompositor {
373370
last_animation_tick: Instant::now(),
374371
is_animating: false,
375372
ready_to_present: false,
376-
show_bookmark: false,
377373
};
378374

379375
// Make sure the GL state is OK
@@ -1259,7 +1255,7 @@ impl IOCompositor {
12591255

12601256
let rect = DeviceRect::from_size(size);
12611257
let show_tab_bar = window.tab_manager.count() > 1;
1262-
let content_size = window.get_content_size(rect, show_tab_bar, self.show_bookmark);
1258+
let content_size = window.get_content_size(rect, show_tab_bar, window.show_bookmark);
12631259
if let Some(tab_id) = window.tab_manager.current_tab_id() {
12641260
let (tab_id, prompt_id) = window.tab_manager.set_size(tab_id, content_size);
12651261
if let Some(tab_id) = tab_id {

src/verso.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,6 @@ impl Verso {
321321
window.create_tab(
322322
&constellation_sender,
323323
initial_url.into(),
324-
compositor.show_bookmark,
325324
);
326325
}
327326

src/webview/webview.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ impl Window {
396396
text,
397397
multiline,
398398
position,
399-
compositor.show_bookmark,
399+
self.show_bookmark,
400400
);
401401
}
402402
EmbedderMsg::HideIME(_webview_id) => {
@@ -450,7 +450,6 @@ impl Window {
450450
self.create_tab(
451451
sender,
452452
self.panel.as_ref().unwrap().initial_url.clone(),
453-
compositor.show_bookmark,
454453
);
455454
} else {
456455
log::trace!("Verso Panel ignores NotifyLoadStatusChanged status: {status:?}");
@@ -509,7 +508,7 @@ impl Window {
509508
let size = self.size();
510509
let rect = DeviceRect::from_size(size);
511510
let content_size =
512-
self.get_content_size(rect, true, compositor.show_bookmark);
511+
self.get_content_size(rect, true, self.show_bookmark);
513512
let size = content_size.size().to_f32() / hidpi_scale_factor;
514513
let webview = WebView::new(
515514
webview_id,
@@ -603,11 +602,11 @@ impl Window {
603602
);
604603
}
605604

606-
compositor.show_bookmark =
605+
self.show_bookmark =
607606
!bookmark_manager.bookmarks().is_empty();
608607
// We need to refresh the window if the need for bookmark to be displayed
609608
// has changed.
610-
if bookmark_previously_shown != compositor.show_bookmark {
609+
if bookmark_previously_shown != self.show_bookmark {
611610
compositor.resize(self.size(), self);
612611
}
613612
}

src/window.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ pub struct Window {
102102
pub(crate) focused_webview_id: Option<WebViewId>,
103103
/// Window-wide menu. e.g. context menu(Wayland) and browsing history menu.
104104
pub(crate) webview_menu: Option<Box<dyn WebViewMenu>>,
105+
/// Show the bookmark bar or not
106+
pub show_bookmark: bool,
105107
}
106108

107109
impl Window {
@@ -153,6 +155,7 @@ impl Window {
153155
tab_manager: TabManager::new(),
154156
focused_webview_id: None,
155157
webview_menu: None,
158+
show_bookmark: false
156159
},
157160
rendering_context,
158161
)
@@ -198,6 +201,7 @@ impl Window {
198201
tab_manager: TabManager::new(),
199202
focused_webview_id: None,
200203
webview_menu: None,
204+
show_bookmark: false
201205
};
202206
compositor.swap_current_window(&mut window);
203207
window
@@ -261,14 +265,13 @@ impl Window {
261265
&mut self,
262266
constellation_sender: &Sender<EmbedderToConstellationMessage>,
263267
initial_url: ServoUrl,
264-
show_bookmark: bool,
265268
) {
266269
let webview_id = WebViewId::new();
267270
let size = self.size().to_f32();
268271
let rect = DeviceRect::from_size(size);
269272

270273
let show_tab = self.tab_manager.count() >= 1;
271-
let content_size = self.get_content_size(rect, show_tab, show_bookmark);
274+
let content_size = self.get_content_size(rect, show_tab, self.show_bookmark);
272275

273276
let hidpi_scale_factor = Scale::new(self.scale_factor() as f32);
274277
let size = content_size.size().to_f32() / hidpi_scale_factor;
@@ -337,7 +340,7 @@ impl Window {
337340
) {
338341
let size = self.size().to_f32();
339342
let rect = DeviceRect::from_size(size);
340-
let content_size = self.get_content_size(rect, show_tab, compositor.show_bookmark);
343+
let content_size = self.get_content_size(rect, show_tab, self.show_bookmark);
341344
let (tab_id, prompt_id) = self.tab_manager.set_size(tab_id, content_size);
342345

343346
if let Some(prompt_id) = prompt_id {
@@ -695,7 +698,6 @@ impl Window {
695698
(*self).create_tab(
696699
&compositor.constellation_chan,
697700
ServoUrl::parse("https://example.com").unwrap(),
698-
compositor.show_bookmark,
699701
);
700702
return true;
701703
}

0 commit comments

Comments
 (0)