mirror of
https://github.com/servo/servo.git
synced 2025-08-30 09:38:19 +01:00
Auto merge of #17686 - paulrouget:rm_Title, r=jdm
remove the ability to request for the title If we offer the ability to request info like these, we need to expose a lot of other getters, like url, loading state, favicon, … It's up to the embedder to keep track of the state of a browser. So let's keep that consistent. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17686) <!-- Reviewable:end -->
This commit is contained in:
commit
ee47fe1925
7 changed files with 5 additions and 59 deletions
|
@ -41,14 +41,6 @@ impl ServoBrowser {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn request_title_for_main_frame(&self) {
|
||||
match *self {
|
||||
ServoBrowser::OnScreen(ref browser) => browser.request_title_for_main_frame(),
|
||||
ServoBrowser::OffScreen(ref browser) => browser.request_title_for_main_frame(),
|
||||
ServoBrowser::Invalid => {}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn pinch_zoom_level(&self) -> f32 {
|
||||
match *self {
|
||||
ServoBrowser::OnScreen(ref browser) => browser.pinch_zoom_level(),
|
||||
|
@ -163,7 +155,6 @@ impl ServoCefBrowser {
|
|||
pub trait ServoCefBrowserExtensions {
|
||||
fn init(&self, window_info: &cef_window_info_t);
|
||||
fn send_window_event(&self, event: WindowEvent);
|
||||
fn request_title_for_main_frame(&self);
|
||||
fn pinch_zoom_level(&self) -> f32;
|
||||
}
|
||||
|
||||
|
@ -200,10 +191,6 @@ impl ServoCefBrowserExtensions for CefBrowser {
|
|||
}
|
||||
}
|
||||
|
||||
fn request_title_for_main_frame(&self) {
|
||||
self.downcast().servo_browser.borrow().request_title_for_main_frame()
|
||||
}
|
||||
|
||||
fn pinch_zoom_level(&self) -> f32 {
|
||||
self.downcast().servo_browser.borrow().pinch_zoom_level()
|
||||
}
|
||||
|
|
|
@ -11,8 +11,8 @@ use compositing::windowing::WindowEvent;
|
|||
use std::cell::RefCell;
|
||||
|
||||
pub struct ServoCefFrame {
|
||||
pub title_visitor: RefCell<Option<CefStringVisitor>>,
|
||||
pub url: RefCell<String>,
|
||||
pub title: RefCell<Vec<u16>>,
|
||||
|
||||
/// A reference to the browser.
|
||||
pub browser: RefCell<Option<CefBrowser>>,
|
||||
|
@ -21,8 +21,8 @@ pub struct ServoCefFrame {
|
|||
impl ServoCefFrame {
|
||||
pub fn new() -> ServoCefFrame {
|
||||
ServoCefFrame {
|
||||
title_visitor: RefCell::new(None),
|
||||
url: RefCell::new(String::new()),
|
||||
title: RefCell::new(vec![]),
|
||||
browser: RefCell::new(None),
|
||||
}
|
||||
}
|
||||
|
@ -44,15 +44,14 @@ full_cef_class_impl! {
|
|||
}}
|
||||
fn get_text(&this, visitor: *mut cef_string_visitor_t [CefStringVisitor],) -> () {{
|
||||
let this = this.downcast();
|
||||
*this.title_visitor.borrow_mut() = Some(visitor);
|
||||
this.browser.borrow().as_ref().unwrap().request_title_for_main_frame();
|
||||
let str = &*this.title.borrow();
|
||||
visitor.visit(str)
|
||||
}}
|
||||
}
|
||||
}
|
||||
|
||||
pub trait ServoCefFrameExtensions {
|
||||
fn set_browser(&self, browser: CefBrowser);
|
||||
fn set_url(&self, url: &[u16]);
|
||||
fn load(&self);
|
||||
}
|
||||
|
||||
|
@ -60,10 +59,6 @@ impl ServoCefFrameExtensions for CefFrame {
|
|||
fn set_browser(&self, browser: CefBrowser) {
|
||||
*self.downcast().browser.borrow_mut() = Some(browser)
|
||||
}
|
||||
fn set_url(&self, url: &[u16]) {
|
||||
let frame = self.downcast();
|
||||
*frame.url.borrow_mut() = String::from_utf16(url).unwrap();
|
||||
}
|
||||
fn load(&self) {
|
||||
let event = WindowEvent::LoadUrl(self.downcast().url.borrow().clone());
|
||||
self.downcast().browser.borrow_mut().as_mut().unwrap().send_window_event(event);
|
||||
|
|
|
@ -433,7 +433,6 @@ impl WindowMethods for Window {
|
|||
};
|
||||
let frame = browser.get_main_frame();
|
||||
let frame = frame.downcast();
|
||||
let mut title_visitor = frame.title_visitor.borrow_mut();
|
||||
let str = match string {
|
||||
Some(s) => s.encode_utf16().collect(),
|
||||
None => vec![]
|
||||
|
@ -444,9 +443,7 @@ impl WindowMethods for Window {
|
|||
browser.get_host().get_client().get_display_handler().on_title_change((*browser).clone(), str.as_slice());
|
||||
}
|
||||
|
||||
if let Some(ref mut visitor) = *title_visitor {
|
||||
visitor.visit(&str);
|
||||
}
|
||||
*frame.title.borrow_mut() = str;
|
||||
}
|
||||
|
||||
fn history_changed(&self, history: Vec<LoadData>, current: usize) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue