mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Unify ServoHTMLParser and ServoXMLParser in ServoParser
This commit is contained in:
parent
609299e1e4
commit
1405be6917
12 changed files with 300 additions and 646 deletions
|
@ -44,6 +44,7 @@ use dom::htmlanchorelement::HTMLAnchorElement;
|
|||
use dom::node::{Node, NodeDamage, window_from_node};
|
||||
use dom::serviceworker::TrustedServiceWorkerAddress;
|
||||
use dom::serviceworkerregistration::ServiceWorkerRegistration;
|
||||
use dom::servoparser::ServoParser;
|
||||
use dom::uievent::UIEvent;
|
||||
use dom::window::{ReflowReason, Window};
|
||||
use dom::worker::TrustedWorkerAddress;
|
||||
|
@ -70,7 +71,7 @@ use net_traits::{IpcSend, LoadData as NetLoadData};
|
|||
use net_traits::bluetooth_thread::BluetoothMethodMsg;
|
||||
use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheResult, ImageCacheThread};
|
||||
use network_listener::NetworkListener;
|
||||
use parse::{ParserContext, ParserRoot};
|
||||
use parse::ParserContext;
|
||||
use parse::html::{ParseContext, parse_html};
|
||||
use parse::xml::{self, parse_xml};
|
||||
use profile_traits::mem::{self, OpaqueSender, Report, ReportKind, ReportsChan};
|
||||
|
@ -489,7 +490,7 @@ impl ScriptThreadFactory for ScriptThread {
|
|||
|
||||
impl ScriptThread {
|
||||
pub fn page_headers_available(id: &PipelineId, metadata: Option<Metadata>)
|
||||
-> Option<ParserRoot> {
|
||||
-> Option<Root<ServoParser>> {
|
||||
SCRIPT_THREAD_ROOT.with(|root| {
|
||||
let script_thread = unsafe { &*root.get().unwrap() };
|
||||
script_thread.handle_page_headers_available(id, metadata)
|
||||
|
@ -1413,7 +1414,7 @@ impl ScriptThread {
|
|||
/// We have received notification that the response associated with a load has completed.
|
||||
/// Kick off the document and frame tree creation process using the result.
|
||||
fn handle_page_headers_available(&self, id: &PipelineId,
|
||||
metadata: Option<Metadata>) -> Option<ParserRoot> {
|
||||
metadata: Option<Metadata>) -> Option<Root<ServoParser>> {
|
||||
let idx = self.incomplete_loads.borrow().iter().position(|load| { load.pipeline_id == *id });
|
||||
// The matching in progress load structure may not exist if
|
||||
// the pipeline exited before the page load completed.
|
||||
|
@ -1543,7 +1544,7 @@ impl ScriptThread {
|
|||
|
||||
/// The entry point to document loading. Defines bindings, sets up the window and document
|
||||
/// objects, parses HTML and CSS, and kicks off initial layout.
|
||||
fn load(&self, metadata: Metadata, incomplete: InProgressLoad) -> ParserRoot {
|
||||
fn load(&self, metadata: Metadata, incomplete: InProgressLoad) -> Root<ServoParser> {
|
||||
let final_url = metadata.final_url.clone();
|
||||
{
|
||||
// send the final url to the layout thread.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue