aboutsummaryrefslogtreecommitdiffstats
path: root/components/script
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2025-04-18 16:19:24 +0200
committerMartin Robinson <mrobinson@igalia.com>2025-04-22 16:37:03 +0200
commit57428bc5da0b73f6fc81510a1aa7816e720baf14 (patch)
treeb1587a3e79a2984bea0e3a9f80ebc87830472c51 /components/script
parent73703e75ba17ca2b4f7999c62c1585360bda5ed6 (diff)
downloadservo-57428bc5da0b73f6fc81510a1aa7816e720baf14.tar.gz
servo-57428bc5da0b73f6fc81510a1aa7816e720baf14.zip
layout: Implement node geometry queries against `BoxTree`'s `Fragment`
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. Co-authored-by: Oriol Brufau <obrufau@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Diffstat (limited to 'components/script')
-rw-r--r--components/script/dom/window.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index 77d001d8151..c076407e9f7 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -2254,7 +2254,9 @@ impl Window {
// Query content box without considering any reflow
pub(crate) fn content_box_query_unchecked(&self, node: &Node) -> Option<UntypedRect<Au>> {
- self.layout.borrow().query_content_box(node.to_opaque())
+ self.layout
+ .borrow()
+ .query_content_box(node.to_trusted_node_address())
}
pub(crate) fn content_box_query(&self, node: &Node, can_gc: CanGc) -> Option<UntypedRect<Au>> {
@@ -2268,14 +2270,18 @@ impl Window {
if !self.layout_reflow(QueryMsg::ContentBoxes, can_gc) {
return vec![];
}
- self.layout.borrow().query_content_boxes(node.to_opaque())
+ self.layout
+ .borrow()
+ .query_content_boxes(node.to_trusted_node_address())
}
pub(crate) fn client_rect_query(&self, node: &Node, can_gc: CanGc) -> UntypedRect<i32> {
if !self.layout_reflow(QueryMsg::ClientRectQuery, can_gc) {
return Rect::zero();
}
- self.layout.borrow().query_client_rect(node.to_opaque())
+ self.layout
+ .borrow()
+ .query_client_rect(node.to_trusted_node_address())
}
/// Find the scroll area of the given node, if it is not None. If the node