mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
DevTools: Inspect node styles (#33025)
* feat: retrieve applied styles Signed-off-by: eri <eri@inventati.org> * feat: preliminary style showing Signed-off-by: eri <eri@inventati.org> * chore: some style tests Signed-off-by: eri <eri@inventati.org> * feat: edit style rules Signed-off-by: eri <eri@inventati.org> * feat: css database Signed-off-by: eri <eri@inventati.org> * feat: computed styles Signed-off-by: eri <eri@inventati.org> * feat: inherited styles Signed-off-by: eri <eri@inventati.org> * feat: get stylesheet styles Signed-off-by: eri <eri@inventati.org> * feat: all styles in inspector Signed-off-by: eri <eri@inventati.org> * feat: multiple stylesheets Signed-off-by: eri <eri@inventati.org> * refactor: clean up Signed-off-by: eri <eri@inventati.org> * Some minor cleanup Signed-off-by: Martin Robinson <mrobinson@igalia.com> --------- Signed-off-by: eri <eri@inventati.org> Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
67e2bb0ee6
commit
6357998ede
12 changed files with 810 additions and 200 deletions
|
@ -5,6 +5,7 @@
|
|||
//! This actor represents one DOM node. It is created by the Walker actor when it is traversing the
|
||||
//! document tree.
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::collections::HashMap;
|
||||
use std::net::TcpStream;
|
||||
|
||||
|
@ -76,9 +77,10 @@ pub struct NodeActorMsg {
|
|||
|
||||
pub struct NodeActor {
|
||||
name: String,
|
||||
script_chan: IpcSender<DevtoolScriptControlMsg>,
|
||||
pipeline: PipelineId,
|
||||
pub script_chan: IpcSender<DevtoolScriptControlMsg>,
|
||||
pub pipeline: PipelineId,
|
||||
pub walker: String,
|
||||
pub style_rules: RefCell<HashMap<(String, usize), String>>,
|
||||
}
|
||||
|
||||
impl Actor for NodeActor {
|
||||
|
@ -102,7 +104,6 @@ impl Actor for NodeActor {
|
|||
) -> Result<ActorMessageStatus, ()> {
|
||||
Ok(match msg_type {
|
||||
"modifyAttributes" => {
|
||||
let target = msg.get("to").ok_or(())?.as_str().ok_or(())?;
|
||||
let mods = msg.get("modifications").ok_or(())?.as_array().ok_or(())?;
|
||||
let modifications: Vec<_> = mods
|
||||
.iter()
|
||||
|
@ -117,7 +118,7 @@ impl Actor for NodeActor {
|
|||
self.script_chan
|
||||
.send(ModifyAttribute(
|
||||
self.pipeline,
|
||||
registry.actor_to_script(target.to_owned()),
|
||||
registry.actor_to_script(self.name()),
|
||||
modifications,
|
||||
))
|
||||
.map_err(|_| ())?;
|
||||
|
@ -176,13 +177,15 @@ impl NodeInfoToProtocol for NodeInfo {
|
|||
) -> NodeActorMsg {
|
||||
let actor = if !actors.script_actor_registered(self.unique_id.clone()) {
|
||||
let name = actors.new_name("node");
|
||||
actors.register_script_actor(self.unique_id, name.clone());
|
||||
|
||||
let node_actor = NodeActor {
|
||||
name: name.clone(),
|
||||
script_chan: script_chan.clone(),
|
||||
pipeline,
|
||||
walker: walker.clone(),
|
||||
style_rules: RefCell::new(HashMap::new()),
|
||||
};
|
||||
actors.register_script_actor(self.unique_id, name.clone());
|
||||
actors.register_later(Box::new(node_actor));
|
||||
name
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue