mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Replaced DOMString by String in devtools.
This commit is contained in:
parent
9cbc4393eb
commit
5101506089
6 changed files with 27 additions and 28 deletions
|
@ -206,16 +206,16 @@ impl NodeInfoToProtocol for NodeInfo {
|
||||||
|
|
||||||
NodeActorMsg {
|
NodeActorMsg {
|
||||||
actor: actor_name,
|
actor: actor_name,
|
||||||
baseURI: self.baseURI.0,
|
baseURI: self.baseURI,
|
||||||
parent: actors.script_to_actor(self.parent.clone()),
|
parent: actors.script_to_actor(self.parent.clone()),
|
||||||
nodeType: self.nodeType,
|
nodeType: self.nodeType,
|
||||||
namespaceURI: self.namespaceURI.0,
|
namespaceURI: self.namespaceURI,
|
||||||
nodeName: self.nodeName.0,
|
nodeName: self.nodeName,
|
||||||
numChildren: self.numChildren,
|
numChildren: self.numChildren,
|
||||||
|
|
||||||
name: self.name.0,
|
name: self.name,
|
||||||
publicId: self.publicId.0,
|
publicId: self.publicId,
|
||||||
systemId: self.systemId.0,
|
systemId: self.systemId,
|
||||||
|
|
||||||
attrs: self.attrs.into_iter().map(|attr| {
|
attrs: self.attrs.into_iter().map(|attr| {
|
||||||
AttrMsg {
|
AttrMsg {
|
||||||
|
@ -233,7 +233,7 @@ impl NodeInfoToProtocol for NodeInfo {
|
||||||
|
|
||||||
isDocumentElement: self.isDocumentElement,
|
isDocumentElement: self.isDocumentElement,
|
||||||
|
|
||||||
shortValue: self.shortValue.0,
|
shortValue: self.shortValue,
|
||||||
incompleteValue: self.incompleteValue,
|
incompleteValue: self.incompleteValue,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,7 +225,7 @@ fn run_server(sender: Sender<DevtoolsControlMsg>,
|
||||||
let DevtoolsPageInfo { title, url } = page_info;
|
let DevtoolsPageInfo { title, url } = page_info;
|
||||||
let tab = TabActor {
|
let tab = TabActor {
|
||||||
name: actors.new_name("tab"),
|
name: actors.new_name("tab"),
|
||||||
title: title.0,
|
title: String::from(title),
|
||||||
url: url.serialize(),
|
url: url.serialize(),
|
||||||
console: console.name(),
|
console: console.name(),
|
||||||
inspector: inspector.name(),
|
inspector: inspector.name(),
|
||||||
|
|
|
@ -35,13 +35,12 @@ use rustc_serialize::{Decodable, Decoder};
|
||||||
use std::net::TcpStream;
|
use std::net::TcpStream;
|
||||||
use time::Duration;
|
use time::Duration;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
use util::str::DOMString;
|
|
||||||
|
|
||||||
// Information would be attached to NewGlobal to be received and show in devtools.
|
// Information would be attached to NewGlobal to be received and show in devtools.
|
||||||
// Extend these fields if we need more information.
|
// Extend these fields if we need more information.
|
||||||
#[derive(Deserialize, Serialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
pub struct DevtoolsPageInfo {
|
pub struct DevtoolsPageInfo {
|
||||||
pub title: DOMString,
|
pub title: String,
|
||||||
pub url: Url
|
pub url: Url
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,22 +101,22 @@ pub struct AttrInfo {
|
||||||
#[derive(Deserialize, Serialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
pub struct NodeInfo {
|
pub struct NodeInfo {
|
||||||
pub uniqueId: String,
|
pub uniqueId: String,
|
||||||
pub baseURI: DOMString,
|
pub baseURI: String,
|
||||||
pub parent: String,
|
pub parent: String,
|
||||||
pub nodeType: u16,
|
pub nodeType: u16,
|
||||||
pub namespaceURI: DOMString,
|
pub namespaceURI: String,
|
||||||
pub nodeName: DOMString,
|
pub nodeName: String,
|
||||||
pub numChildren: usize,
|
pub numChildren: usize,
|
||||||
|
|
||||||
pub name: DOMString,
|
pub name: String,
|
||||||
pub publicId: DOMString,
|
pub publicId: String,
|
||||||
pub systemId: DOMString,
|
pub systemId: String,
|
||||||
|
|
||||||
pub attrs: Vec<AttrInfo>,
|
pub attrs: Vec<AttrInfo>,
|
||||||
|
|
||||||
pub isDocumentElement: bool,
|
pub isDocumentElement: bool,
|
||||||
|
|
||||||
pub shortValue: DOMString,
|
pub shortValue: String,
|
||||||
pub incompleteValue: bool,
|
pub incompleteValue: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -806,17 +806,17 @@ impl Node {
|
||||||
pub fn summarize(&self) -> NodeInfo {
|
pub fn summarize(&self) -> NodeInfo {
|
||||||
NodeInfo {
|
NodeInfo {
|
||||||
uniqueId: self.get_unique_id(),
|
uniqueId: self.get_unique_id(),
|
||||||
baseURI: self.BaseURI(),
|
baseURI: String::from(self.BaseURI()),
|
||||||
parent: self.GetParentNode().map(|node| node.get_unique_id()).unwrap_or("".to_owned()),
|
parent: self.GetParentNode().map(|node| node.get_unique_id()).unwrap_or("".to_owned()),
|
||||||
nodeType: self.NodeType(),
|
nodeType: self.NodeType(),
|
||||||
namespaceURI: DOMString::new(), //FIXME
|
namespaceURI: String::new(), //FIXME
|
||||||
nodeName: self.NodeName(),
|
nodeName: String::from(self.NodeName()),
|
||||||
numChildren: self.ChildNodes().Length() as usize,
|
numChildren: self.ChildNodes().Length() as usize,
|
||||||
|
|
||||||
//FIXME doctype nodes only
|
//FIXME doctype nodes only
|
||||||
name: DOMString::new(),
|
name: String::new(),
|
||||||
publicId: DOMString::new(),
|
publicId: String::new(),
|
||||||
systemId: DOMString::new(),
|
systemId: String::new(),
|
||||||
attrs: self.downcast().map(Element::summarize).unwrap_or(vec![]),
|
attrs: self.downcast().map(Element::summarize).unwrap_or(vec![]),
|
||||||
|
|
||||||
isDocumentElement:
|
isDocumentElement:
|
||||||
|
@ -825,7 +825,7 @@ impl Node {
|
||||||
.map(|elem| elem.upcast::<Node>() == self)
|
.map(|elem| elem.upcast::<Node>() == self)
|
||||||
.unwrap_or(false),
|
.unwrap_or(false),
|
||||||
|
|
||||||
shortValue: self.GetNodeValue().unwrap_or_default(), //FIXME: truncate
|
shortValue: self.GetNodeValue().map(String::from).unwrap_or_default(), //FIXME: truncate
|
||||||
incompleteValue: false, //FIXME: reflect truncation
|
incompleteValue: false, //FIXME: reflect truncation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ impl Worker {
|
||||||
let pipeline_id = global.pipeline();
|
let pipeline_id = global.pipeline();
|
||||||
let title = format!("Worker for {}", worker_url);
|
let title = format!("Worker for {}", worker_url);
|
||||||
let page_info = DevtoolsPageInfo {
|
let page_info = DevtoolsPageInfo {
|
||||||
title: DOMString(title),
|
title: title,
|
||||||
url: worker_url.clone(),
|
url: worker_url.clone(),
|
||||||
};
|
};
|
||||||
chan.send(ScriptToDevtoolsControlMsg::NewGlobal((pipeline_id, Some(worker_id)),
|
chan.send(ScriptToDevtoolsControlMsg::NewGlobal((pipeline_id, Some(worker_id)),
|
||||||
|
|
|
@ -1632,7 +1632,7 @@ impl ScriptTask {
|
||||||
|
|
||||||
let content_type = match metadata.content_type {
|
let content_type = match metadata.content_type {
|
||||||
Some(ContentType(Mime(TopLevel::Text, SubLevel::Plain, _))) => {
|
Some(ContentType(Mime(TopLevel::Text, SubLevel::Plain, _))) => {
|
||||||
Some(DOMString("text/plain".to_owned()))
|
Some(DOMString::from("text/plain"))
|
||||||
}
|
}
|
||||||
_ => None
|
_ => None
|
||||||
};
|
};
|
||||||
|
@ -1705,7 +1705,7 @@ impl ScriptTask {
|
||||||
fn notify_devtools(&self, title: DOMString, url: Url, ids: (PipelineId, Option<WorkerId>)) {
|
fn notify_devtools(&self, title: DOMString, url: Url, ids: (PipelineId, Option<WorkerId>)) {
|
||||||
if let Some(ref chan) = self.devtools_chan {
|
if let Some(ref chan) = self.devtools_chan {
|
||||||
let page_info = DevtoolsPageInfo {
|
let page_info = DevtoolsPageInfo {
|
||||||
title: title,
|
title: String::from(title),
|
||||||
url: url,
|
url: url,
|
||||||
};
|
};
|
||||||
chan.send(ScriptToDevtoolsControlMsg::NewGlobal(
|
chan.send(ScriptToDevtoolsControlMsg::NewGlobal(
|
||||||
|
@ -1924,7 +1924,7 @@ impl ScriptTask {
|
||||||
// http://dev.w3.org/csswg/cssom-view/#resizing-viewports
|
// http://dev.w3.org/csswg/cssom-view/#resizing-viewports
|
||||||
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#event-type-resize
|
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#event-type-resize
|
||||||
let uievent = UIEvent::new(window.r(),
|
let uievent = UIEvent::new(window.r(),
|
||||||
DOMString("resize".to_owned()), EventBubbles::DoesNotBubble,
|
DOMString::from("resize"), EventBubbles::DoesNotBubble,
|
||||||
EventCancelable::NotCancelable, Some(window.r()),
|
EventCancelable::NotCancelable, Some(window.r()),
|
||||||
0i32);
|
0i32);
|
||||||
uievent.upcast::<Event>().fire(window.upcast());
|
uievent.upcast::<Event>().fire(window.upcast());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue