mirror of
https://github.com/servo/servo.git
synced 2025-08-12 17:05:33 +01:00
webdriver: Check if container is obscured for "Element Click" (#38497)
Implement step 7 of [Element
Click](https://w3c.github.io/webdriver/#element-click): check whether
container is obscured.
Testing: `/webdriver/tests/classic/element_click/interactability.py` can
now fully pass. Other changes are combined effect with
17a269a8ad
due to script execution, and
exposes new problem:
https://github.com/servo/servo/pull/38497#discussion_r2257866612
---------
Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
This commit is contained in:
parent
b23cf9c6cd
commit
616b86fb6d
8 changed files with 42 additions and 23 deletions
|
@ -1846,8 +1846,18 @@ pub(crate) fn handle_element_click(
|
|||
return Err(ErrorStatus::ElementNotInteractable);
|
||||
}
|
||||
|
||||
// Step 7
|
||||
// TODO: return error if obscured
|
||||
// Step 7. If element's container is obscured by another element,
|
||||
// return error with error code element click intercepted.
|
||||
// https://w3c.github.io/webdriver/#dfn-obscuring
|
||||
// An element is obscured if the pointer-interactable paint tree is empty,
|
||||
// or the first element in this tree is not an inclusive descendant of itself.
|
||||
// `paint_tree` is guaranteed not empty as element is "in view".
|
||||
if !container
|
||||
.upcast::<Node>()
|
||||
.Contains(Some(paint_tree[0].upcast::<Node>()))
|
||||
{
|
||||
return Err(ErrorStatus::ElementClickIntercepted);
|
||||
}
|
||||
|
||||
// Step 8 for <option> element.
|
||||
match element.downcast::<HTMLOptionElement>() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue