mirror of
https://github.com/servo/servo.git
synced 2025-07-23 23:33:43 +01:00
layout: Implement node geometry queries against BoxTree
's Fragment
(#36663)
This is a followup to #36629, continuing to implement script-based layout queries using the `Fragment`s attached to the `BoxTree`. In this change, geometry queris (apart from parent offset) are calculated using `Fragment`s hanging of the `BoxTree`. In order to make this work, all `Fragment`s for inlines split by blocks, need to be accessible in the `BoxTree`. This required some changes to the way that box tree items were stored in DOM `BoxSlot`s. Now every inline level item can have more than a single `BoxTree` item. These are carefully collected by the `InlineFormattingContextBuilder` -- currently a bit fragile, but with more documentation. Testing: There are tests for these changes. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
cc91395397
commit
b63a1818c4
13 changed files with 197 additions and 170 deletions
|
@ -81,8 +81,8 @@ use webrender_api::{ExternalScrollId, HitTestFlags};
|
|||
use crate::context::LayoutContext;
|
||||
use crate::display_list::{DisplayList, WebRenderImageInfo};
|
||||
use crate::query::{
|
||||
get_the_text_steps, process_content_box_request, process_content_boxes_request,
|
||||
process_node_geometry_request, process_node_scroll_area_request, process_offset_parent_query,
|
||||
get_the_text_steps, process_client_rect_request, process_content_box_request,
|
||||
process_content_boxes_request, process_node_scroll_area_request, process_offset_parent_query,
|
||||
process_resolved_font_style_query, process_resolved_style_request, process_text_index_request,
|
||||
};
|
||||
use crate::traversal::RecalcStyle;
|
||||
|
@ -235,24 +235,27 @@ impl Layout for LayoutThread {
|
|||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
|
||||
)]
|
||||
fn query_content_box(&self, node: OpaqueNode) -> Option<UntypedRect<Au>> {
|
||||
process_content_box_request(node, self.fragment_tree.borrow().clone())
|
||||
fn query_content_box(&self, node: TrustedNodeAddress) -> Option<UntypedRect<Au>> {
|
||||
let node = unsafe { ServoLayoutNode::new(&node) };
|
||||
process_content_box_request(node)
|
||||
}
|
||||
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
|
||||
)]
|
||||
fn query_content_boxes(&self, node: OpaqueNode) -> Vec<UntypedRect<Au>> {
|
||||
process_content_boxes_request(node, self.fragment_tree.borrow().clone())
|
||||
fn query_content_boxes(&self, node: TrustedNodeAddress) -> Vec<UntypedRect<Au>> {
|
||||
let node = unsafe { ServoLayoutNode::new(&node) };
|
||||
process_content_boxes_request(node)
|
||||
}
|
||||
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
|
||||
)]
|
||||
fn query_client_rect(&self, node: OpaqueNode) -> UntypedRect<i32> {
|
||||
process_node_geometry_request(node, self.fragment_tree.borrow().clone())
|
||||
fn query_client_rect(&self, node: TrustedNodeAddress) -> UntypedRect<i32> {
|
||||
let node = unsafe { ServoLayoutNode::new(&node) };
|
||||
process_client_rect_request(node)
|
||||
}
|
||||
|
||||
#[cfg_attr(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue