mirror of
https://github.com/servo/servo.git
synced 2025-06-19 14:48:59 +01:00
Introduce a phantom type to prevent script from accessing the layout data directly.
Nodes are now parameterized over a "View" type. The particular View type determines which methods can be called. Layout data accessors and mutators are only accessible to nodes with a LayoutView. The only way to convert a `Node<ScriptView>` to a `Node<LayoutView>` is through a transmutation, which is done at the moment the layout task receives nodes. (This should be factored better to contain the unsafety.) We should also lock down DOM node mutation to the ScriptView to forbid data races, but this patch doesn't do that. This also reduces coupling between DOM and layout. Soon I would like to move the DOM into its own crate, and this is a step on the way of doing that.
This commit is contained in:
parent
c7bce98236
commit
4f3ca373d4
23 changed files with 262 additions and 189 deletions
|
@ -4149,6 +4149,7 @@ class CGBindingRoot(CGThing):
|
|||
'dom::eventtarget::*', #XXXjdm
|
||||
'scripting::script_task::task_from_context',
|
||||
'dom::bindings::utils::EnumEntry',
|
||||
'dom::node::ScriptView',
|
||||
],
|
||||
[],
|
||||
curr)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue