mirror of
https://github.com/servo/servo.git
synced 2025-07-06 06:53:38 +01:00
[WebDriver] Reuse "Find Elements" handler in "Find element" (#37737)
All "Find Element ..." in [spec](https://w3c.github.io/webdriver/#find-element-from-element) has exactly same step has "Find Elements ...", except they extract the first element if there is any. We now reuse the handler instead of running numerous repetitive steps, same as what we did for ["Find Element from Shadow Root"](https://w3c.github.io/webdriver/#find-element-from-shadow-root) in #37578. This reduces binary size by 98KB for Release profile in Windows and improves maintainability. Testing: `./mach test-wpt -r .\tests\wpt\tests\webdriver\tests\classic\find_element* --product servodriver` --------- Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
This commit is contained in:
parent
8e2ef5c248
commit
0329f33520
4 changed files with 23 additions and 325 deletions
|
@ -2247,33 +2247,6 @@ impl ScriptThread {
|
|||
WebDriverScriptCommand::DeleteCookie(name, reply) => {
|
||||
webdriver_handlers::handle_delete_cookie(&documents, pipeline_id, name, reply)
|
||||
},
|
||||
WebDriverScriptCommand::FindElementCSSSelector(selector, reply) => {
|
||||
webdriver_handlers::handle_find_element_css_selector(
|
||||
&documents,
|
||||
pipeline_id,
|
||||
selector,
|
||||
reply,
|
||||
)
|
||||
},
|
||||
WebDriverScriptCommand::FindElementLinkText(selector, partial, reply) => {
|
||||
webdriver_handlers::handle_find_element_link_text(
|
||||
&documents,
|
||||
pipeline_id,
|
||||
selector,
|
||||
partial,
|
||||
reply,
|
||||
can_gc,
|
||||
)
|
||||
},
|
||||
WebDriverScriptCommand::FindElementTagName(selector, reply) => {
|
||||
webdriver_handlers::handle_find_element_tag_name(
|
||||
&documents,
|
||||
pipeline_id,
|
||||
selector,
|
||||
reply,
|
||||
can_gc,
|
||||
)
|
||||
},
|
||||
WebDriverScriptCommand::FindElementsCSSSelector(selector, reply) => {
|
||||
webdriver_handlers::handle_find_elements_css_selector(
|
||||
&documents,
|
||||
|
@ -2301,39 +2274,6 @@ impl ScriptThread {
|
|||
can_gc,
|
||||
)
|
||||
},
|
||||
WebDriverScriptCommand::FindElementElementCSSSelector(selector, element_id, reply) => {
|
||||
webdriver_handlers::handle_find_element_element_css_selector(
|
||||
&documents,
|
||||
pipeline_id,
|
||||
element_id,
|
||||
selector,
|
||||
reply,
|
||||
)
|
||||
},
|
||||
WebDriverScriptCommand::FindElementElementLinkText(
|
||||
selector,
|
||||
element_id,
|
||||
partial,
|
||||
reply,
|
||||
) => webdriver_handlers::handle_find_element_element_link_text(
|
||||
&documents,
|
||||
pipeline_id,
|
||||
element_id,
|
||||
selector,
|
||||
partial,
|
||||
reply,
|
||||
can_gc,
|
||||
),
|
||||
WebDriverScriptCommand::FindElementElementTagName(selector, element_id, reply) => {
|
||||
webdriver_handlers::handle_find_element_element_tag_name(
|
||||
&documents,
|
||||
pipeline_id,
|
||||
element_id,
|
||||
selector,
|
||||
reply,
|
||||
can_gc,
|
||||
)
|
||||
},
|
||||
WebDriverScriptCommand::FindElementElementsCSSSelector(selector, element_id, reply) => {
|
||||
webdriver_handlers::handle_find_element_elements_css_selector(
|
||||
&documents,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue