move msg to embedder_traits, use in script, handle send error in embedder

This commit is contained in:
Gregory Terzian 2018-04-28 22:48:14 +08:00
parent a297e8f288
commit d438240772
31 changed files with 362 additions and 337 deletions

View file

@ -12,13 +12,12 @@ use dom::bindings::str::DOMString;
use dom::document::Document;
use dom::element::{AttributeMutation, Element, RawLayoutElementHelpers};
use dom::eventtarget::EventTarget;
use dom::globalscope::GlobalScope;
use dom::htmlelement::HTMLElement;
use dom::node::{Node, document_from_node, window_from_node};
use dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use embedder_traits::EmbedderMsg;
use html5ever::{LocalName, Prefix};
use script_traits::ScriptMsg;
use servo_url::ServoUrl;
use style::attr::AttrValue;
use time;
@ -151,8 +150,11 @@ impl VirtualMethods for HTMLBodyElement {
let window = window_from_node(self);
let document = window.Document();
document.set_reflow_timeout(time::precise_time_ns() + INITIAL_REFLOW_DELAY);
let event = ScriptMsg::HeadParsed;
window.upcast::<GlobalScope>().script_to_constellation_chan().send(event).unwrap();
if window.is_top_level() {
let top_level_browsing_context_id = window.top_level_browsing_context_id();
let msg = EmbedderMsg::HeadParsed(top_level_browsing_context_id);
window.send_to_embedder(msg);
}
}
fn parse_plain_attribute(&self, name: &LocalName, value: DOMString) -> AttrValue {