mirror of
https://github.com/servo/servo.git
synced 2025-09-27 23:30:08 +01:00
layout: Parameterize content box query (#38935)
Parameterize and rename both `Layout::content_box_query` and `Layout::content_boxes_query` to support the query of rendered padding area and content area that accounts for transform and scroll. Both of these query have been misleading for a time since they are using border box, instead of content box of a Node. This PR adds a new type `layout_api::BoxAreaType` to be passed from `ScriptThread` to `LayoutThread` to query the respective area. It is then used for the query within `IntersectionObserver` to pass several WPTs. Testing: Existing WPT Coverage. --------- Signed-off-by: Jo Steven Novaryo <jo.steven.novaryo@huawei.com>
This commit is contained in:
parent
32aba08be7
commit
10ca3b6fde
21 changed files with 125 additions and 125 deletions
|
@ -291,8 +291,8 @@ pub trait Layout {
|
|||
/// Returns true if this layout needs to produce a new display list for rendering updates.
|
||||
fn needs_new_display_list(&self) -> bool;
|
||||
|
||||
fn query_content_box(&self, node: TrustedNodeAddress) -> Option<Rect<Au>>;
|
||||
fn query_content_boxes(&self, node: TrustedNodeAddress) -> Vec<Rect<Au>>;
|
||||
fn query_box_area(&self, node: TrustedNodeAddress, area: BoxAreaType) -> Option<Rect<Au>>;
|
||||
fn query_box_areas(&self, node: TrustedNodeAddress, area: BoxAreaType) -> Vec<Rect<Au>>;
|
||||
fn query_client_rect(&self, node: TrustedNodeAddress) -> Rect<i32>;
|
||||
fn query_element_inner_outer_text(&self, node: TrustedNodeAddress) -> String;
|
||||
fn query_offset_parent(&self, node: TrustedNodeAddress) -> OffsetParentResponse;
|
||||
|
@ -336,6 +336,16 @@ pub trait ScriptThreadFactory {
|
|||
load_data: LoadData,
|
||||
) -> JoinHandle<()>;
|
||||
}
|
||||
|
||||
/// Type of the area of CSS box for query.
|
||||
/// See <https://www.w3.org/TR/css-box-3/#box-model>.
|
||||
#[derive(Copy, Clone)]
|
||||
pub enum BoxAreaType {
|
||||
Content,
|
||||
Padding,
|
||||
Border,
|
||||
}
|
||||
|
||||
#[derive(Clone, Default)]
|
||||
pub struct OffsetParentResponse {
|
||||
pub node_address: Option<UntrustedNodeAddress>,
|
||||
|
@ -344,9 +354,9 @@ pub struct OffsetParentResponse {
|
|||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum QueryMsg {
|
||||
BoxArea,
|
||||
BoxAreas,
|
||||
ClientRectQuery,
|
||||
ContentBox,
|
||||
ContentBoxes,
|
||||
ElementInnerOuterTextQuery,
|
||||
ElementsFromPoint,
|
||||
InnerWindowDimensionsQuery,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue