mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Combine DOM-related concepts in Layout 2020 into dom.rs
This commit is contained in:
parent
ab4bd2a133
commit
72b5fcd0b6
24 changed files with 257 additions and 344 deletions
|
@ -5,7 +5,6 @@
|
|||
//! Data needed by the layout thread.
|
||||
|
||||
use crate::display_list::items::{OpaqueNode, WebRenderImageInfo};
|
||||
use crate::opaque_node::OpaqueNodeMethods;
|
||||
use fnv::FnvHasher;
|
||||
use gfx::font_cache_thread::FontCacheThread;
|
||||
use gfx::font_context::FontContext;
|
||||
|
@ -121,7 +120,7 @@ impl<'a> LayoutContext<'a> {
|
|||
ImageCacheResult::Pending(id) => {
|
||||
let image = PendingImage {
|
||||
state: PendingImageState::PendingResponse,
|
||||
node: node.to_untrusted_node_address(),
|
||||
node: node.into(),
|
||||
id,
|
||||
origin: self.origin.clone(),
|
||||
};
|
||||
|
@ -132,7 +131,7 @@ impl<'a> LayoutContext<'a> {
|
|||
ImageCacheResult::ReadyForRequest(id) => {
|
||||
let image = PendingImage {
|
||||
state: PendingImageState::Unrequested(url),
|
||||
node: node.to_untrusted_node_address(),
|
||||
node: node.into(),
|
||||
id,
|
||||
origin: self.origin.clone(),
|
||||
};
|
||||
|
|
|
@ -38,7 +38,6 @@ mod linked_list;
|
|||
mod list_item;
|
||||
mod model;
|
||||
mod multicol;
|
||||
pub mod opaque_node;
|
||||
pub mod parallel;
|
||||
mod persistent_list;
|
||||
pub mod query;
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use crate::display_list::items::OpaqueNode;
|
||||
use libc::c_void;
|
||||
use script_traits::UntrustedNodeAddress;
|
||||
|
||||
pub trait OpaqueNodeMethods {
|
||||
/// Converts this node to an `UntrustedNodeAddress`. An `UntrustedNodeAddress` is just the type
|
||||
/// of node that script expects to receive in a hit test.
|
||||
fn to_untrusted_node_address(&self) -> UntrustedNodeAddress;
|
||||
}
|
||||
|
||||
impl OpaqueNodeMethods for OpaqueNode {
|
||||
fn to_untrusted_node_address(&self) -> UntrustedNodeAddress {
|
||||
UntrustedNodeAddress(self.0 as *const c_void)
|
||||
}
|
||||
}
|
|
@ -11,7 +11,6 @@ use crate::display_list::IndexableText;
|
|||
use crate::flow::{Flow, GetBaseFlow};
|
||||
use crate::fragment::{Fragment, FragmentBorderBoxIterator, FragmentFlags, SpecificFragmentInfo};
|
||||
use crate::inline::InlineFragmentNodeFlags;
|
||||
use crate::opaque_node::OpaqueNodeMethods;
|
||||
use crate::sequential;
|
||||
use crate::wrapper::LayoutNodeLayoutData;
|
||||
use app_units::Au;
|
||||
|
@ -1099,7 +1098,7 @@ pub fn process_offset_parent_query(
|
|||
let origin = node_offset_box.offset - parent_info.origin.to_vector();
|
||||
let size = node_offset_box.rectangle.size;
|
||||
OffsetParentResponse {
|
||||
node_address: Some(parent_info.node_address.to_untrusted_node_address()),
|
||||
node_address: Some(parent_info.node_address.into()),
|
||||
rect: Rect::new(origin, size),
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue