mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
layout: Remove LayoutRPC and query layout via the Layout
trait (#31937)
Instead of the tricky `LayoutRPC` interface, query layout using the `Layout` trait. This means that now queries will requires calling layout and then running the query. During layout an enum is used to indicate what kind of layout is necessary. This change also removes the mutex-locked `rw_data` from both layout threads. It's no longer necessary since layout runs synchronously. The one downside here is that for resolved style queries, we now have to create two StyleContexts. One for layout and one for the query itself. The creation of this context should not be very expensive though. `LayoutRPC` used to be necessary because layout used to run asynchronously from script, but that no longer happens. With this change, it becomes possible to safely pass nodes to layout from script -- a cleanup that can happen in a followup change.
This commit is contained in:
parent
07391e346b
commit
b7d089930e
12 changed files with 667 additions and 1174 deletions
|
@ -26,7 +26,6 @@ use net_traits::blob_url_store::get_blob_origin;
|
|||
use net_traits::filemanager_thread::FileManagerThreadMsg;
|
||||
use net_traits::{CoreResourceMsg, IpcSend};
|
||||
use profile_traits::ipc;
|
||||
use script_layout_interface::rpc::TextIndexResponse;
|
||||
use script_traits::ScriptToConstellationChan;
|
||||
use servo_atoms::Atom;
|
||||
use style::attr::AttrValue;
|
||||
|
@ -2537,8 +2536,7 @@ impl VirtualMethods for HTMLInputElement {
|
|||
// now.
|
||||
if let Some(point_in_target) = mouse_event.point_in_target() {
|
||||
let window = window_from_node(self);
|
||||
let TextIndexResponse(index) =
|
||||
window.text_index_query(self.upcast::<Node>(), point_in_target);
|
||||
let index = window.text_index_query(self.upcast::<Node>(), point_in_target);
|
||||
if let Some(i) = index {
|
||||
self.textinput.borrow_mut().set_edit_point_index(i);
|
||||
// trigger redraw
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue