From cef7aa58ec3dc6b5e2ee729cc4b2c8a9c85fe681 Mon Sep 17 00:00:00 2001 From: Kenzie Raditya Tirtarahardja Date: Wed, 16 Apr 2025 11:54:33 +0800 Subject: [PATCH] Refactor retrieving element container in webdriver into function (#36467) Refactor getting an element's container. Previously this is inlined and only done for `HTMLOptionElement`. [Try](https://github.com/PotatoCP/servo/actions/runs/14399482275) Fixes: #24106 Signed-off-by: Kenzie Raditya Tirtarahardja Co-authored-by: Kenzie Raditya Tirtarahardja --- components/script/webdriver_handlers.rs | 58 ++++++++++++++++--------- 1 file changed, 37 insertions(+), 21 deletions(-) diff --git a/components/script/webdriver_handlers.rs b/components/script/webdriver_handlers.rs index 5e7c2b6c057..ed9f9d5e0c1 100644 --- a/components/script/webdriver_handlers.rs +++ b/components/script/webdriver_handlers.rs @@ -60,6 +60,7 @@ use crate::dom::htmldatalistelement::HTMLDataListElement; use crate::dom::htmlelement::HTMLElement; use crate::dom::htmliframeelement::HTMLIFrameElement; use crate::dom::htmlinputelement::{HTMLInputElement, InputType}; +use crate::dom::htmloptgroupelement::HTMLOptGroupElement; use crate::dom::htmloptionelement::HTMLOptionElement; use crate::dom::htmlselectelement::HTMLSelectElement; use crate::dom::node::{Node, NodeTraits, ShadowIncluding}; @@ -1191,6 +1192,35 @@ pub(crate) fn handle_get_url( .unwrap(); } +fn get_option_parent(node: &Node) -> Option> { + // Get parent for `