mirror of
https://github.com/servo/servo.git
synced 2025-07-22 14:53:49 +01:00
chore: Clean up use of gfx
and constellation
types (#31981)
This change contains three semi-related clean ups: 1. the `to_webrender()` and `from_webrender()` functions on Pipeline are turned into more-idiomatic `From` and `Into` implementations. 2. `combine_id_with_fragment_type` now returns a `u64` as that is what is expected for all callers and not a `usize`. 3. The `query_scroll_id` query is removed entirely. The `ExternalScrollId` that this queries is easily generated directly from the node's opaque id. Querying into layout isn't necessary at all.
This commit is contained in:
parent
b79e2a0b65
commit
dd9f62adcc
15 changed files with 62 additions and 119 deletions
|
@ -8,7 +8,6 @@ use std::env;
|
|||
use std::fs::{create_dir_all, File};
|
||||
use std::io::Write;
|
||||
use std::iter::once;
|
||||
use std::num::NonZeroU32;
|
||||
use std::rc::Rc;
|
||||
use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH};
|
||||
|
||||
|
@ -27,9 +26,7 @@ use image::{DynamicImage, ImageFormat};
|
|||
use ipc_channel::ipc;
|
||||
use libc::c_void;
|
||||
use log::{debug, error, info, trace, warn};
|
||||
use msg::constellation_msg::{
|
||||
PipelineId, PipelineIndex, PipelineNamespaceId, TopLevelBrowsingContextId, WebViewId,
|
||||
};
|
||||
use msg::constellation_msg::{PipelineId, TopLevelBrowsingContextId, WebViewId};
|
||||
use net_traits::image::base::Image;
|
||||
use net_traits::image_cache::CorsStatus;
|
||||
use pixels::PixelFormat;
|
||||
|
@ -79,20 +76,6 @@ enum NotReadyToPaint {
|
|||
const MAX_ZOOM: f32 = 8.0;
|
||||
const MIN_ZOOM: f32 = 0.1;
|
||||
|
||||
trait ConvertPipelineIdFromWebRender {
|
||||
#[allow(clippy::wrong_self_convention)]
|
||||
fn from_webrender(&self) -> PipelineId;
|
||||
}
|
||||
|
||||
impl ConvertPipelineIdFromWebRender for WebRenderPipelineId {
|
||||
fn from_webrender(&self) -> PipelineId {
|
||||
PipelineId {
|
||||
namespace_id: PipelineNamespaceId(self.0),
|
||||
index: PipelineIndex(NonZeroU32::new(self.1).expect("Webrender pipeline zero?")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Holds the state when running reftests that determines when it is
|
||||
/// safe to save the output image.
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
|
@ -725,7 +708,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
|
|||
external_scroll_id,
|
||||
),
|
||||
) => {
|
||||
let pipeline_id = PipelineId::from_webrender(pipeline_id);
|
||||
let pipeline_id = pipeline_id.into();
|
||||
let pipeline_details = match self.pipeline_details.get_mut(&pipeline_id) {
|
||||
Some(details) => details,
|
||||
None => return,
|
||||
|
@ -798,7 +781,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
|
|||
);
|
||||
|
||||
let pipeline_id = display_list_info.pipeline_id;
|
||||
let details = self.pipeline_details(PipelineId::from_webrender(pipeline_id));
|
||||
let details = self.pipeline_details(pipeline_id.into());
|
||||
details.most_recent_display_list_epoch = Some(display_list_info.epoch);
|
||||
details.hit_test_items = display_list_info.hit_test_info;
|
||||
details.install_new_scroll_tree(display_list_info.scroll_tree);
|
||||
|
@ -1114,7 +1097,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
|
|||
spatial_id: zoom_reference_frame,
|
||||
clip_chain_id,
|
||||
},
|
||||
pipeline_id.to_webrender(),
|
||||
pipeline_id.into(),
|
||||
true,
|
||||
);
|
||||
}
|
||||
|
@ -1480,7 +1463,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
|
|||
.items
|
||||
.iter()
|
||||
.filter_map(|item| {
|
||||
let pipeline_id = PipelineId::from_webrender(item.pipeline);
|
||||
let pipeline_id = item.pipeline.into();
|
||||
let details = match self.pipeline_details.get(&pipeline_id) {
|
||||
Some(details) => details,
|
||||
None => return None,
|
||||
|
@ -1949,10 +1932,9 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
|
|||
// frame tree.
|
||||
let mut pipeline_epochs = HashMap::new();
|
||||
for id in self.pipeline_details.keys() {
|
||||
let webrender_pipeline_id = id.to_webrender();
|
||||
if let Some(WebRenderEpoch(epoch)) = self
|
||||
.webrender
|
||||
.current_epoch(self.webrender_document, webrender_pipeline_id)
|
||||
.current_epoch(self.webrender_document, id.into())
|
||||
{
|
||||
let epoch = Epoch(epoch);
|
||||
pipeline_epochs.insert(*id, epoch);
|
||||
|
@ -2104,7 +2086,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
|
|||
// we get the last painted frame id from webrender
|
||||
if let Some(WebRenderEpoch(epoch)) = self
|
||||
.webrender
|
||||
.current_epoch(self.webrender_document, id.to_webrender())
|
||||
.current_epoch(self.webrender_document, id.into())
|
||||
{
|
||||
// and check if it is the one layout is expecting,
|
||||
let epoch = Epoch(epoch);
|
||||
|
|
|
@ -2270,7 +2270,7 @@ impl Fragment {
|
|||
fn unique_id(&self) -> u64 {
|
||||
let fragment_type = self.fragment_type();
|
||||
let id = self.node.id();
|
||||
combine_id_with_fragment_type(id, fragment_type) as u64
|
||||
combine_id_with_fragment_type(id, fragment_type)
|
||||
}
|
||||
|
||||
fn fragment_type(&self) -> FragmentType {
|
||||
|
@ -2737,8 +2737,7 @@ impl BlockFlow {
|
|||
let content_size = self.base.overflow.scroll.origin + self.base.overflow.scroll.size;
|
||||
let content_size = Size2D::new(content_size.x, content_size.y);
|
||||
|
||||
let external_id =
|
||||
ExternalScrollId(self.fragment.unique_id(), state.pipeline_id.to_webrender());
|
||||
let external_id = ExternalScrollId(self.fragment.unique_id(), state.pipeline_id.into());
|
||||
let new_clip_scroll_index = state.add_clip_scroll_node(ClipScrollNode {
|
||||
parent_index: self.clipping_and_scrolling().scrolling,
|
||||
clip,
|
||||
|
|
|
@ -133,7 +133,7 @@ impl DisplayList {
|
|||
viewport_size: LayoutSize,
|
||||
epoch: Epoch,
|
||||
) -> (DisplayListBuilder, CompositorDisplayListInfo, IsContentful) {
|
||||
let webrender_pipeline = pipeline_id.to_webrender();
|
||||
let webrender_pipeline = pipeline_id.into();
|
||||
let mut builder = DisplayListBuilder::new(webrender_pipeline);
|
||||
builder.begin();
|
||||
|
||||
|
@ -314,7 +314,7 @@ impl DisplayItem {
|
|||
spatial_id: common.spatial_id,
|
||||
clip_chain_id: common.clip_chain_id,
|
||||
},
|
||||
item.iframe.to_webrender(),
|
||||
item.iframe.into(),
|
||||
true,
|
||||
);
|
||||
IsContentful(false)
|
||||
|
|
|
@ -9,7 +9,6 @@ use std::ops::Deref;
|
|||
|
||||
use app_units::Au;
|
||||
use euclid::default::{Box2D, Point2D, Rect, Size2D, Vector2D};
|
||||
use msg::constellation_msg::PipelineId;
|
||||
use script_layout_interface::wrapper_traits::{
|
||||
LayoutNode, ThreadSafeLayoutElement, ThreadSafeLayoutNode,
|
||||
};
|
||||
|
@ -31,7 +30,6 @@ use style::selector_parser::PseudoElement;
|
|||
use style::shared_lock::SharedRwLock;
|
||||
use style::stylesheets::{CssRuleType, Origin, UrlExtraData};
|
||||
use style_traits::{ParsingMode, ToCss};
|
||||
use webrender_api::ExternalScrollId;
|
||||
|
||||
use crate::construct::ConstructionResult;
|
||||
use crate::display_list::items::OpaqueNode;
|
||||
|
@ -571,14 +569,6 @@ pub fn process_client_rect_query(
|
|||
iterator.client_rect
|
||||
}
|
||||
|
||||
pub fn process_node_scroll_id_request<'dom>(
|
||||
id: PipelineId,
|
||||
requested_node: impl LayoutNode<'dom>,
|
||||
) -> ExternalScrollId {
|
||||
let layout_node = requested_node.to_threadsafe();
|
||||
layout_node.generate_scroll_id(id)
|
||||
}
|
||||
|
||||
/// <https://drafts.csswg.org/cssom-view/#scrolling-area>
|
||||
pub fn process_scrolling_area_request(
|
||||
requested_node: Option<OpaqueNode>,
|
||||
|
|
|
@ -291,7 +291,7 @@ impl Fragment {
|
|||
spatial_id: common.spatial_id,
|
||||
clip_chain_id: common.clip_chain_id,
|
||||
},
|
||||
iframe.pipeline_id.to_webrender(),
|
||||
iframe.pipeline_id.into(),
|
||||
true,
|
||||
);
|
||||
},
|
||||
|
|
|
@ -126,6 +126,6 @@ impl Tag {
|
|||
Some(PseudoElement::After) => FragmentType::AfterPseudoContent,
|
||||
_ => FragmentType::FragmentBody,
|
||||
};
|
||||
combine_id_with_fragment_type(self.node.id(), fragment_type) as u64
|
||||
combine_id_with_fragment_type(self.node.id(), fragment_type)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ use app_units::Au;
|
|||
use euclid::default::{Point2D, Rect};
|
||||
use euclid::{SideOffsets2D, Size2D, Vector2D};
|
||||
use log::warn;
|
||||
use msg::constellation_msg::PipelineId;
|
||||
use script_layout_interface::wrapper_traits::{
|
||||
LayoutNode, ThreadSafeLayoutElement, ThreadSafeLayoutNode,
|
||||
};
|
||||
|
@ -31,7 +30,6 @@ use style::stylist::RuleInclusion;
|
|||
use style::traversal::resolve_style;
|
||||
use style::values::generics::font::LineHeight;
|
||||
use style_traits::{ParsingMode, ToCss};
|
||||
use webrender_api::ExternalScrollId;
|
||||
|
||||
use crate::fragment_tree::{Fragment, FragmentFlags, FragmentTree, Tag};
|
||||
|
||||
|
@ -71,14 +69,6 @@ pub fn process_node_geometry_request(
|
|||
}
|
||||
}
|
||||
|
||||
pub fn process_node_scroll_id_request<'dom>(
|
||||
id: PipelineId,
|
||||
requested_node: impl LayoutNode<'dom>,
|
||||
) -> ExternalScrollId {
|
||||
let layout_node = requested_node.to_threadsafe();
|
||||
layout_node.generate_scroll_id(id)
|
||||
}
|
||||
|
||||
/// <https://drafts.csswg.org/cssom-view/#scrolling-area>
|
||||
pub fn process_node_scroll_area_request(
|
||||
requested_node: Option<OpaqueNode>,
|
||||
|
|
|
@ -39,7 +39,7 @@ use layout::flow_ref::FlowRef;
|
|||
use layout::incremental::{RelayoutMode, SpecialRestyleDamage};
|
||||
use layout::query::{
|
||||
process_client_rect_query, process_content_box_request, process_content_boxes_request,
|
||||
process_element_inner_text_query, process_node_scroll_id_request, process_offset_parent_query,
|
||||
process_element_inner_text_query, process_offset_parent_query,
|
||||
process_resolved_font_style_request, process_resolved_style_request,
|
||||
process_scrolling_area_request,
|
||||
};
|
||||
|
@ -365,9 +365,9 @@ impl Layout for LayoutThread {
|
|||
flags.insert(HitTestFlags::POINT_RELATIVE_TO_PIPELINE_VIEWPORT);
|
||||
|
||||
let client_point = units::DevicePoint::from_untyped(point);
|
||||
let results =
|
||||
self.webrender_api
|
||||
.hit_test(Some(self.id.to_webrender()), client_point, flags);
|
||||
let results = self
|
||||
.webrender_api
|
||||
.hit_test(Some(self.id.into()), client_point, flags);
|
||||
|
||||
results.iter().map(|result| result.node).collect()
|
||||
}
|
||||
|
@ -451,14 +451,6 @@ impl Layout for LayoutThread {
|
|||
)
|
||||
}
|
||||
|
||||
fn query_scroll_id(
|
||||
&self,
|
||||
node: script_layout_interface::TrustedNodeAddress,
|
||||
) -> webrender_api::ExternalScrollId {
|
||||
let node = unsafe { ServoLayoutNode::new(&node) };
|
||||
process_node_scroll_id_request(self.id, node)
|
||||
}
|
||||
|
||||
fn query_scrolling_area(&self, node: Option<OpaqueNode>) -> UntypedRect<i32> {
|
||||
let Some(mut root_flow) = self.root_flow_for_query() else {
|
||||
return UntypedRect::zero();
|
||||
|
@ -504,7 +496,7 @@ impl LayoutThread {
|
|||
window_size: WindowSizeData,
|
||||
) -> LayoutThread {
|
||||
// Let webrender know about this pipeline by sending an empty display list.
|
||||
webrender_api.send_initial_transaction(id.to_webrender());
|
||||
webrender_api.send_initial_transaction(id.into());
|
||||
|
||||
let device = Device::new(
|
||||
MediaType::screen(),
|
||||
|
@ -1238,7 +1230,7 @@ impl LayoutThread {
|
|||
|
||||
let point = Point2D::new(-state.scroll_offset.x, -state.scroll_offset.y);
|
||||
self.webrender_api.send_scroll_node(
|
||||
self.id.to_webrender(),
|
||||
self.id.into(),
|
||||
units::LayoutPoint::from_untyped(point),
|
||||
state.scroll_id,
|
||||
);
|
||||
|
|
|
@ -30,9 +30,8 @@ use layout::context::LayoutContext;
|
|||
use layout::display_list::{DisplayList, WebRenderImageInfo};
|
||||
use layout::query::{
|
||||
process_content_box_request, process_content_boxes_request, process_element_inner_text_query,
|
||||
process_node_geometry_request, process_node_scroll_area_request,
|
||||
process_node_scroll_id_request, process_offset_parent_query, process_resolved_font_style_query,
|
||||
process_resolved_style_request, process_text_index_request,
|
||||
process_node_geometry_request, process_node_scroll_area_request, process_offset_parent_query,
|
||||
process_resolved_font_style_query, process_resolved_style_request, process_text_index_request,
|
||||
};
|
||||
use layout::traversal::RecalcStyle;
|
||||
use layout::{layout_debug, BoxTree, FragmentTree};
|
||||
|
@ -328,9 +327,9 @@ impl Layout for LayoutThread {
|
|||
flags.insert(HitTestFlags::POINT_RELATIVE_TO_PIPELINE_VIEWPORT);
|
||||
|
||||
let client_point = units::DevicePoint::from_untyped(point);
|
||||
let results =
|
||||
self.webrender_api
|
||||
.hit_test(Some(self.id.to_webrender()), client_point, flags);
|
||||
let results = self
|
||||
.webrender_api
|
||||
.hit_test(Some(self.id.into()), client_point, flags);
|
||||
|
||||
results.iter().map(|result| result.node).collect()
|
||||
}
|
||||
|
@ -406,14 +405,6 @@ impl Layout for LayoutThread {
|
|||
)
|
||||
}
|
||||
|
||||
fn query_scroll_id(
|
||||
&self,
|
||||
node: script_layout_interface::TrustedNodeAddress,
|
||||
) -> ExternalScrollId {
|
||||
let node = unsafe { ServoLayoutNode::new(&node) };
|
||||
process_node_scroll_id_request(self.id, node)
|
||||
}
|
||||
|
||||
fn query_scrolling_area(&self, node: Option<OpaqueNode>) -> UntypedRect<i32> {
|
||||
process_node_scroll_area_request(node, self.fragment_tree.borrow().clone())
|
||||
}
|
||||
|
@ -452,7 +443,7 @@ impl LayoutThread {
|
|||
window_size: WindowSizeData,
|
||||
) -> LayoutThread {
|
||||
// Let webrender know about this pipeline by sending an empty display list.
|
||||
webrender_api_sender.send_initial_transaction(id.to_webrender());
|
||||
webrender_api_sender.send_initial_transaction(id.into());
|
||||
|
||||
// The device pixel ratio is incorrect (it does not have the hidpi value),
|
||||
// but it will be set correctly when the initial reflow takes place.
|
||||
|
@ -878,7 +869,7 @@ impl LayoutThread {
|
|||
.insert(state.scroll_id, state.scroll_offset);
|
||||
let point = Point2D::new(-state.scroll_offset.x, -state.scroll_offset.y);
|
||||
self.webrender_api.send_scroll_node(
|
||||
self.id.to_webrender(),
|
||||
self.id.into(),
|
||||
units::LayoutPoint::from_untyped(point),
|
||||
state.scroll_id,
|
||||
);
|
||||
|
@ -950,7 +941,7 @@ impl LayoutThread {
|
|||
let mut display_list = DisplayList::new(
|
||||
viewport_size,
|
||||
fragment_tree.scrollable_overflow(),
|
||||
self.id.to_webrender(),
|
||||
self.id.into(),
|
||||
epoch.into(),
|
||||
fragment_tree.root_scroll_sensitivity,
|
||||
);
|
||||
|
|
|
@ -26,6 +26,7 @@ use dom_struct::dom_struct;
|
|||
use embedder_traits::{EmbedderMsg, PromptDefinition, PromptOrigin, PromptResult};
|
||||
use euclid::default::{Point2D as UntypedPoint2D, Rect as UntypedRect};
|
||||
use euclid::{Point2D, Rect, Scale, Size2D, Vector2D};
|
||||
use gfx_traits::combine_id_with_fragment_type;
|
||||
use ipc_channel::ipc::{self, IpcSender};
|
||||
use ipc_channel::router::ROUTER;
|
||||
use js::conversions::ToJSValConvertible;
|
||||
|
@ -2101,20 +2102,19 @@ impl Window {
|
|||
|
||||
// https://drafts.csswg.org/cssom-view/#element-scrolling-members
|
||||
pub fn scroll_node(&self, node: &Node, x_: f64, y_: f64, behavior: ScrollBehavior) {
|
||||
if !self.layout_reflow(QueryMsg::NodeScrollIdQuery) {
|
||||
return;
|
||||
}
|
||||
|
||||
// The scroll offsets are immediatly updated since later calls
|
||||
// to topScroll and others may access the properties before
|
||||
// webrender has a chance to update the offsets.
|
||||
self.scroll_offsets
|
||||
.borrow_mut()
|
||||
.insert(node.to_opaque(), Vector2D::new(x_ as f32, y_ as f32));
|
||||
|
||||
let scroll_id = self
|
||||
.with_layout(|layout| layout.query_scroll_id(node.to_trusted_node_address()))
|
||||
.unwrap();
|
||||
let scroll_id = ExternalScrollId(
|
||||
combine_id_with_fragment_type(
|
||||
node.to_opaque().id(),
|
||||
gfx_traits::FragmentType::FragmentBody,
|
||||
),
|
||||
self.pipeline_id().into(),
|
||||
);
|
||||
|
||||
// Step 12
|
||||
self.perform_a_scroll(
|
||||
|
@ -2720,7 +2720,6 @@ fn debug_reflow_events(id: PipelineId, reflow_goal: &ReflowGoal, reason: &Reflow
|
|||
QueryMsg::NodesFromPointQuery => "\tNodesFromPointQuery",
|
||||
QueryMsg::ClientRectQuery => "\tClientRectQuery",
|
||||
QueryMsg::ScrollingAreaQuery => "\tNodeScrollGeometryQuery",
|
||||
QueryMsg::NodeScrollIdQuery => "\tNodeScrollIdQuery",
|
||||
QueryMsg::ResolvedStyleQuery => "\tResolvedStyleQuery",
|
||||
QueryMsg::ResolvedFontStyleQuery => "\nResolvedFontStyleQuery",
|
||||
QueryMsg::OffsetParentQuery => "\tOffsetParentQuery",
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
pub mod print_tree;
|
||||
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::sync::atomic::{AtomicU64, Ordering};
|
||||
|
||||
use malloc_size_of_derive::MallocSizeOf;
|
||||
use range::{int_range_index, RangeIndex};
|
||||
|
@ -90,30 +90,30 @@ pub enum FragmentType {
|
|||
/// The next ID that will be used for a special scroll root id.
|
||||
///
|
||||
/// A special scroll root is a scroll root that is created for generated content.
|
||||
static NEXT_SPECIAL_SCROLL_ROOT_ID: AtomicUsize = AtomicUsize::new(0);
|
||||
static NEXT_SPECIAL_SCROLL_ROOT_ID: AtomicU64 = AtomicU64::new(0);
|
||||
|
||||
/// If none of the bits outside this mask are set, the scroll root is a special scroll root.
|
||||
/// Note that we assume that the top 16 bits of the address space are unused on the platform.
|
||||
const SPECIAL_SCROLL_ROOT_ID_MASK: usize = 0xffff;
|
||||
const SPECIAL_SCROLL_ROOT_ID_MASK: u64 = 0xffff;
|
||||
|
||||
/// Returns a new scroll root ID for a scroll root.
|
||||
fn next_special_id() -> usize {
|
||||
fn next_special_id() -> u64 {
|
||||
// We shift this left by 2 to make room for the fragment type ID.
|
||||
((NEXT_SPECIAL_SCROLL_ROOT_ID.fetch_add(1, Ordering::SeqCst) + 1) << 2) &
|
||||
SPECIAL_SCROLL_ROOT_ID_MASK
|
||||
}
|
||||
|
||||
pub fn combine_id_with_fragment_type(id: usize, fragment_type: FragmentType) -> usize {
|
||||
pub fn combine_id_with_fragment_type(id: usize, fragment_type: FragmentType) -> u64 {
|
||||
debug_assert_eq!(id & (fragment_type as usize), 0);
|
||||
if fragment_type == FragmentType::FragmentBody {
|
||||
id
|
||||
id as u64
|
||||
} else {
|
||||
next_special_id() | (fragment_type as usize)
|
||||
next_special_id() | (fragment_type as u64)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn node_id_from_scroll_id(id: usize) -> Option<usize> {
|
||||
if (id & !SPECIAL_SCROLL_ROOT_ID_MASK) != 0 {
|
||||
if (id as u64 & !SPECIAL_SCROLL_ROOT_ID_MASK) != 0 {
|
||||
return Some(id & !3);
|
||||
}
|
||||
None
|
||||
|
|
|
@ -223,14 +223,14 @@ impl PipelineId {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn to_webrender(&self) -> WebRenderPipelineId {
|
||||
let PipelineNamespaceId(namespace_id) = self.namespace_id;
|
||||
let PipelineIndex(index) = self.index;
|
||||
WebRenderPipelineId(namespace_id, index.get())
|
||||
pub fn root_scroll_id(&self) -> webrender_api::ExternalScrollId {
|
||||
ExternalScrollId(0, self.into())
|
||||
}
|
||||
}
|
||||
|
||||
impl From<WebRenderPipelineId> for PipelineId {
|
||||
#[allow(unsafe_code)]
|
||||
pub fn from_webrender(pipeline: WebRenderPipelineId) -> PipelineId {
|
||||
fn from(pipeline: WebRenderPipelineId) -> Self {
|
||||
let WebRenderPipelineId(namespace_id, index) = pipeline;
|
||||
unsafe {
|
||||
PipelineId {
|
||||
|
@ -239,9 +239,19 @@ impl PipelineId {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn root_scroll_id(&self) -> webrender_api::ExternalScrollId {
|
||||
ExternalScrollId(0, self.to_webrender())
|
||||
impl From<PipelineId> for WebRenderPipelineId {
|
||||
fn from(value: PipelineId) -> Self {
|
||||
let PipelineNamespaceId(namespace_id) = value.namespace_id;
|
||||
let PipelineIndex(index) = value.index;
|
||||
WebRenderPipelineId(namespace_id, index.get())
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&PipelineId> for WebRenderPipelineId {
|
||||
fn from(value: &PipelineId) -> Self {
|
||||
(*value).into()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ use style::properties::PropertyId;
|
|||
use style::selector_parser::PseudoElement;
|
||||
use style::stylesheets::Stylesheet;
|
||||
use style_traits::CSSPixel;
|
||||
use webrender_api::{ExternalScrollId, ImageKey};
|
||||
use webrender_api::ImageKey;
|
||||
|
||||
pub type GenericLayoutData = dyn Any + Send + Sync;
|
||||
|
||||
|
@ -235,7 +235,6 @@ pub trait Layout {
|
|||
animations: DocumentAnimationSet,
|
||||
animation_timeline_value: f64,
|
||||
) -> Option<ServoArc<Font>>;
|
||||
fn query_scroll_id(&self, node: TrustedNodeAddress) -> ExternalScrollId;
|
||||
fn query_scrolling_area(&self, node: Option<OpaqueNode>) -> Rect<i32>;
|
||||
fn query_text_indext(&self, node: OpaqueNode, point: Point2D<f32>) -> Option<usize>;
|
||||
}
|
||||
|
|
|
@ -55,7 +55,6 @@ pub enum QueryMsg {
|
|||
OffsetParentQuery,
|
||||
TextIndexQuery,
|
||||
NodesFromPointQuery,
|
||||
NodeScrollIdQuery,
|
||||
ResolvedStyleQuery,
|
||||
StyleQuery,
|
||||
ElementInnerTextQuery,
|
||||
|
@ -90,7 +89,6 @@ impl ReflowGoal {
|
|||
QueryMsg::ClientRectQuery |
|
||||
QueryMsg::ContentBox |
|
||||
QueryMsg::ContentBoxes |
|
||||
QueryMsg::NodeScrollIdQuery |
|
||||
QueryMsg::OffsetParentQuery |
|
||||
QueryMsg::ResolvedFontStyleQuery |
|
||||
QueryMsg::ScrollingAreaQuery |
|
||||
|
@ -112,7 +110,6 @@ impl ReflowGoal {
|
|||
QueryMsg::ContentBoxes |
|
||||
QueryMsg::ClientRectQuery |
|
||||
QueryMsg::ScrollingAreaQuery |
|
||||
QueryMsg::NodeScrollIdQuery |
|
||||
QueryMsg::ResolvedStyleQuery |
|
||||
QueryMsg::ResolvedFontStyleQuery |
|
||||
QueryMsg::OffsetParentQuery |
|
||||
|
|
|
@ -9,7 +9,7 @@ use std::fmt::Debug;
|
|||
use std::sync::Arc as StdArc;
|
||||
|
||||
use atomic_refcell::AtomicRef;
|
||||
use gfx_traits::{combine_id_with_fragment_type, ByteIndex, FragmentType};
|
||||
use gfx_traits::{ByteIndex, FragmentType};
|
||||
use html5ever::{local_name, namespace_url, ns, LocalName, Namespace};
|
||||
use msg::constellation_msg::{BrowsingContextId, PipelineId};
|
||||
use net_traits::image::base::{Image, ImageMetadata};
|
||||
|
@ -23,7 +23,6 @@ use style::dom::{LayoutIterator, NodeInfo, OpaqueNode, TElement, TNode};
|
|||
use style::properties::ComputedValues;
|
||||
use style::selector_parser::{PseudoElement, PseudoElementCascadeType, SelectorImpl};
|
||||
use style::stylist::RuleInclusion;
|
||||
use webrender_api::ExternalScrollId;
|
||||
|
||||
use crate::{
|
||||
GenericLayoutData, HTMLCanvasData, HTMLMediaData, LayoutNodeType, SVGSVGData, StyleData,
|
||||
|
@ -315,11 +314,6 @@ pub trait ThreadSafeLayoutNode<'dom>: Clone + Copy + Debug + NodeInfo + PartialE
|
|||
fn fragment_type(&self) -> FragmentType {
|
||||
self.get_pseudo_element_type().fragment_type()
|
||||
}
|
||||
|
||||
fn generate_scroll_id(&self, pipeline_id: PipelineId) -> ExternalScrollId {
|
||||
let id = combine_id_with_fragment_type(self.opaque().id(), self.fragment_type());
|
||||
ExternalScrollId(id as u64, pipeline_id.to_webrender())
|
||||
}
|
||||
}
|
||||
|
||||
pub trait ThreadSafeLayoutElement<'dom>:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue