From dbd1666b17b22130bcce75e6255f376e6fbe256c Mon Sep 17 00:00:00 2001 From: Ben Date: Tue, 24 Sep 2024 11:45:33 +0200 Subject: Layout: Implement innerText/outerText (#33312) * Implement outerText on HtmlElement Signed-off-by: Shane Handley * Fixed some innerText/outerText bugs Signed-off-by: Benjamin Vincent Schulenburg * Unified innerText/outerText handling outside of Layout Before these 2 were treated separately and only within Layout would they end up calling the same method, now they are already unified within HTMLElement Signed-off-by: Benjamin Vincent Schulenburg * Address a few nits Signed-off-by: Martin Robinson * Added innerText support for `inline-flex` Signed-off-by: Benjamin Vincent Schulenburg --------- Signed-off-by: Shane Handley Signed-off-by: Benjamin Vincent Schulenburg Signed-off-by: Martin Robinson Co-authored-by: Shane Handley Co-authored-by: Martin Robinson --- components/shared/script_layout/lib.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'components/shared/script_layout/lib.rs') diff --git a/components/shared/script_layout/lib.rs b/components/shared/script_layout/lib.rs index 67f95327453..1faff34b767 100644 --- a/components/shared/script_layout/lib.rs +++ b/components/shared/script_layout/lib.rs @@ -104,7 +104,11 @@ pub enum LayoutElementType { HTMLInputElement, HTMLMediaElement, HTMLObjectElement, + HTMLOptGroupElement, + HTMLOptionElement, HTMLParagraphElement, + HTMLPreElement, + HTMLSelectElement, HTMLTableCellElement, HTMLTableColElement, HTMLTableElement, @@ -239,7 +243,7 @@ pub trait Layout { fn query_content_box(&self, node: OpaqueNode) -> Option>; fn query_content_boxes(&self, node: OpaqueNode) -> Vec>; fn query_client_rect(&self, node: OpaqueNode) -> Rect; - fn query_element_inner_text(&self, node: TrustedNodeAddress) -> String; + fn query_element_inner_outer_text(&self, node: TrustedNodeAddress) -> String; fn query_inner_window_dimension( &self, context: BrowsingContextId, @@ -305,7 +309,7 @@ pub enum QueryMsg { NodesFromPointQuery, ResolvedStyleQuery, StyleQuery, - ElementInnerTextQuery, + ElementInnerOuterTextQuery, ResolvedFontStyleQuery, InnerWindowDimensionsQuery, } @@ -329,7 +333,7 @@ impl ReflowGoal { match *self { ReflowGoal::Full | ReflowGoal::TickAnimations | ReflowGoal::UpdateScrollNode(_) => true, ReflowGoal::LayoutQuery(ref querymsg) => match *querymsg { - QueryMsg::ElementInnerTextQuery | + QueryMsg::ElementInnerOuterTextQuery | QueryMsg::InnerWindowDimensionsQuery | QueryMsg::NodesFromPointQuery | QueryMsg::ResolvedStyleQuery | @@ -353,7 +357,7 @@ impl ReflowGoal { ReflowGoal::LayoutQuery(ref querymsg) => match *querymsg { QueryMsg::NodesFromPointQuery | QueryMsg::TextIndexQuery | - QueryMsg::ElementInnerTextQuery => true, + QueryMsg::ElementInnerOuterTextQuery => true, QueryMsg::ContentBox | QueryMsg::ContentBoxes | QueryMsg::ClientRectQuery | -- cgit v1.2.3