mirror of
https://github.com/servo/servo.git
synced 2025-08-08 06:55:31 +01:00
webdriver: Simplify get_element_pointer_interactable_paint_tree
(#38469)
Add step 1 and simplify step 2 - 5 to remove duplicate `GetClientRects` call. There is some issue with spec to be updated later. Testing: No behaviour change. --------- Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
This commit is contained in:
parent
4b7d659cf6
commit
62b181dc85
40 changed files with 168 additions and 45 deletions
|
@ -1922,24 +1922,23 @@ fn get_element_pointer_interactable_paint_tree(
|
|||
document: &Document,
|
||||
can_gc: CanGc,
|
||||
) -> Vec<DomRoot<Element>> {
|
||||
// Step 2. Let rectangles be the DOMRect sequence returned by calling getClientRects()
|
||||
let rect = element.GetClientRects(can_gc);
|
||||
|
||||
if rect.first().is_some() {
|
||||
// Step 4. Let center point be the in-view center point of
|
||||
// the first indexed element in rectangles.
|
||||
match get_element_in_view_center_point(element, can_gc) {
|
||||
// Step 5. Return the elements from point given the coordinates center point
|
||||
Some(center_point) => document.ElementsFromPoint(
|
||||
Finite::wrap(center_point.x as f64),
|
||||
Finite::wrap(center_point.y as f64),
|
||||
),
|
||||
None => Vec::new(),
|
||||
}
|
||||
} else {
|
||||
// Step 3. If rectangles has the length of 0, return an empty sequence
|
||||
Vec::new()
|
||||
// Step 1. If element is not in the same tree as session's
|
||||
// current browsing context's active document, return an empty sequence.
|
||||
if !element.is_connected() {
|
||||
return Vec::new();
|
||||
}
|
||||
|
||||
// Step 2 - 5: Return "elements from point" w.r.t. in-view center point of element.
|
||||
// Spec has bugs in description and can be simplified.
|
||||
// The original step 4 "compute in-view center point" takes an element as argument
|
||||
// which internally computes first DOMRect of getClientRects
|
||||
|
||||
get_element_in_view_center_point(element, can_gc).map_or(Vec::new(), |center_point| {
|
||||
document.ElementsFromPoint(
|
||||
Finite::wrap(center_point.x as f64),
|
||||
Finite::wrap(center_point.y as f64),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn handle_is_enabled(
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[add.py]
|
||||
[test_no_browsing_context]
|
||||
expected: FAIL
|
||||
expected: ERROR
|
||||
|
||||
[test_cookie_unsupported_scheme[about\]]
|
||||
expected: FAIL
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
[delete.py]
|
||||
[test_no_browsing_context]
|
||||
expected: FAIL
|
||||
expected: ERROR
|
||||
|
|
|
@ -10,3 +10,9 @@
|
|||
|
||||
[test_dismiss_in_popup_window]
|
||||
expected: FAIL
|
||||
|
||||
[test_no_browsing_context]
|
||||
expected: ERROR
|
||||
|
||||
[test_dismiss_alert]
|
||||
expected: FAIL
|
||||
|
|
54
tests/wpt/meta/webdriver/tests/classic/element_clear/user_prompts.py.ini
vendored
Normal file
54
tests/wpt/meta/webdriver/tests/classic/element_clear/user_prompts.py.ini
vendored
Normal file
|
@ -0,0 +1,54 @@
|
|||
[user_prompts.py]
|
||||
[test_accept[alert-None\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_accept[confirm-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_accept[prompt-\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_accept_and_notify[alert-None\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_accept_and_notify[confirm-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_accept_and_notify[prompt-\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_dismiss[alert-None\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_dismiss[confirm-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_dismiss[prompt-None\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_dismiss_and_notify[alert-None\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_dismiss_and_notify[confirm-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_dismiss_and_notify[prompt-None\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_ignore[alert\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_ignore[confirm\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_ignore[prompt\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_default[alert-None\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_default[confirm-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_default[prompt-None\]]
|
||||
expected: FAIL
|
|
@ -1,3 +1,3 @@
|
|||
[click.py]
|
||||
[test_no_browsing_context]
|
||||
expected: FAIL
|
||||
expected: ERROR
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
[navigate.py]
|
||||
expected: TIMEOUT
|
||||
[test_link_hash]
|
||||
expected: FAIL
|
||||
|
||||
|
|
21
tests/wpt/meta/webdriver/tests/classic/element_send_keys/form_controls.py.ini
vendored
Normal file
21
tests/wpt/meta/webdriver/tests/classic/element_send_keys/form_controls.py.ini
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
[form_controls.py]
|
||||
[test_input]
|
||||
expected: FAIL
|
||||
|
||||
[test_textarea]
|
||||
expected: FAIL
|
||||
|
||||
[test_input_append]
|
||||
expected: FAIL
|
||||
|
||||
[test_textarea_append]
|
||||
expected: FAIL
|
||||
|
||||
[test_input_insert_when_focused]
|
||||
expected: FAIL
|
||||
|
||||
[test_textarea_insert_when_focused]
|
||||
expected: FAIL
|
||||
|
||||
[test_date]
|
||||
expected: FAIL
|
|
@ -2,9 +2,6 @@
|
|||
[test_document_element_is_interactable]
|
||||
expected: FAIL
|
||||
|
||||
[test_readonly_element]
|
||||
expected: FAIL
|
||||
|
||||
[test_display_none]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -13,3 +10,9 @@
|
|||
|
||||
[test_hidden]
|
||||
expected: FAIL
|
||||
|
||||
[test_iframe_is_interactable]
|
||||
expected: FAIL
|
||||
|
||||
[test_transparent_element]
|
||||
expected: FAIL
|
||||
|
|
9
tests/wpt/meta/webdriver/tests/classic/element_send_keys/user_prompts.py.ini
vendored
Normal file
9
tests/wpt/meta/webdriver/tests/classic/element_send_keys/user_prompts.py.ini
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
[user_prompts.py]
|
||||
[test_accept[confirm-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_accept[prompt-\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_dismiss[prompt-None\]]
|
||||
expected: FAIL
|
|
@ -1,3 +1,3 @@
|
|||
[find.py]
|
||||
[test_no_browsing_context]
|
||||
expected: FAIL
|
||||
expected: ERROR
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[find.py]
|
||||
[test_no_browsing_context]
|
||||
expected: FAIL
|
||||
expected: ERROR
|
||||
|
||||
[test_parent_htmldocument]
|
||||
expected: FAIL
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
[get.py]
|
||||
[test_get_confirm_text]
|
||||
expected: FAIL
|
||||
|
||||
[test_get_prompt_text]
|
||||
expected: FAIL
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[get.py]
|
||||
[test_no_browsing_context]
|
||||
expected: FAIL
|
||||
expected: ERROR
|
||||
|
||||
[test_computed_roles[<article>foo</article>-article-article\]]
|
||||
expected: FAIL
|
||||
|
|
3
tests/wpt/meta/webdriver/tests/classic/get_current_url/get.py.ini
vendored
Normal file
3
tests/wpt/meta/webdriver/tests/classic/get_current_url/get.py.ini
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
[get.py]
|
||||
[test_no_browsing_context]
|
||||
expected: ERROR
|
|
@ -1,3 +1,3 @@
|
|||
[get.py]
|
||||
[test_no_browsing_context]
|
||||
expected: FAIL
|
||||
expected: ERROR
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[get.py]
|
||||
[test_no_browsing_context]
|
||||
expected: FAIL
|
||||
expected: ERROR
|
||||
|
||||
[test_web_reference[shadowRoot-ShadowRoot\]]
|
||||
expected: FAIL
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
[get.py]
|
||||
[test_no_browsing_context]
|
||||
expected: FAIL
|
||||
expected: ERROR
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
[get.py]
|
||||
[test_no_browsing_context]
|
||||
expected: FAIL
|
||||
expected: ERROR
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[get.py]
|
||||
[test_no_browsing_context]
|
||||
expected: FAIL
|
||||
expected: ERROR
|
||||
|
||||
[test_get_element_tag_name]
|
||||
expected: FAIL
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[get.py]
|
||||
[test_no_browsing_context]
|
||||
expected: FAIL
|
||||
expected: ERROR
|
||||
|
||||
[test_shadow_root_slot[custom outside\]]
|
||||
expected: FAIL
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[get.py]
|
||||
[test_no_browsing_context]
|
||||
expected: FAIL
|
||||
expected: ERROR
|
||||
|
||||
[test_get_named_session_cookie]
|
||||
expected: FAIL
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
[source.py]
|
||||
[test_no_browsing_context]
|
||||
expected: FAIL
|
||||
expected: ERROR
|
||||
|
|
3
tests/wpt/meta/webdriver/tests/classic/get_window_handle/get.py.ini
vendored
Normal file
3
tests/wpt/meta/webdriver/tests/classic/get_window_handle/get.py.ini
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
[get.py]
|
||||
[test_no_browsing_context]
|
||||
expected: ERROR
|
3
tests/wpt/meta/webdriver/tests/classic/get_window_handles/get.py.ini
vendored
Normal file
3
tests/wpt/meta/webdriver/tests/classic/get_window_handles/get.py.ini
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
[get.py]
|
||||
[test_no_browsing_context]
|
||||
expected: ERROR
|
3
tests/wpt/meta/webdriver/tests/classic/get_window_rect/get.py.ini
vendored
Normal file
3
tests/wpt/meta/webdriver/tests/classic/get_window_rect/get.py.ini
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
[get.py]
|
||||
[test_no_browsing_context]
|
||||
expected: ERROR
|
|
@ -1,6 +1,6 @@
|
|||
[enabled.py]
|
||||
[test_no_browsing_context]
|
||||
expected: FAIL
|
||||
expected: ERROR
|
||||
|
||||
[test_option_with_select[disabled\]]
|
||||
expected: FAIL
|
||||
|
|
|
@ -10,3 +10,6 @@
|
|||
|
||||
[test_maximize_twice_is_idempotent]
|
||||
expected: FAIL
|
||||
|
||||
[test_no_browsing_context]
|
||||
expected: ERROR
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
expected: FAIL
|
||||
|
||||
[test_no_browsing_context]
|
||||
expected: FAIL
|
||||
expected: ERROR
|
||||
|
||||
[test_response_payload]
|
||||
expected: FAIL
|
||||
|
|
3
tests/wpt/meta/webdriver/tests/classic/new_window/new.py.ini
vendored
Normal file
3
tests/wpt/meta/webdriver/tests/classic/new_window/new.py.ini
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
[new.py]
|
||||
[test_no_browsing_context]
|
||||
expected: ERROR
|
|
@ -1,6 +1,6 @@
|
|||
[key.py]
|
||||
[test_no_browsing_context]
|
||||
expected: FAIL
|
||||
expected: ERROR
|
||||
|
||||
[test_key_down_closes_browsing_context]
|
||||
expected: FAIL
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[pointer_mouse.py]
|
||||
[test_no_browsing_context]
|
||||
expected: FAIL
|
||||
expected: ERROR
|
||||
|
||||
[test_pointer_down_closes_browsing_context]
|
||||
expected: FAIL
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[pointer_touch.py]
|
||||
[test_no_browsing_context]
|
||||
expected: FAIL
|
||||
expected: ERROR
|
||||
|
||||
[test_pointer_down_closes_browsing_context]
|
||||
expected: FAIL
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
expected: FAIL
|
||||
|
||||
[test_no_browsing_context]
|
||||
expected: FAIL
|
||||
expected: ERROR
|
||||
|
||||
[test_html_document]
|
||||
expected: FAIL
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
[release.py]
|
||||
[test_no_browsing_context]
|
||||
expected: FAIL
|
||||
expected: ERROR
|
||||
|
|
|
@ -16,3 +16,6 @@
|
|||
|
||||
[test_send_alert_text[Fed\\terer\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_unexpected_alert]
|
||||
expected: FAIL
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
[switch.py]
|
||||
[test_no_browsing_context[0\]]
|
||||
expected: FAIL
|
||||
expected: ERROR
|
||||
|
||||
[test_no_browsing_context[id2\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_find_element_while_frame_is_still_loading]
|
||||
expected: FAIL
|
||||
|
||||
[test_no_browsing_context[None\]]
|
||||
expected: ERROR
|
||||
|
|
3
tests/wpt/meta/webdriver/tests/classic/switch_to_window/switch.py.ini
vendored
Normal file
3
tests/wpt/meta/webdriver/tests/classic/switch_to_window/switch.py.ini
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
[switch.py]
|
||||
[test_no_browsing_context]
|
||||
expected: FAIL
|
3
tests/wpt/meta/webdriver/tests/classic/take_element_screenshot/screenshot.py.ini
vendored
Normal file
3
tests/wpt/meta/webdriver/tests/classic/take_element_screenshot/screenshot.py.ini
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
[screenshot.py]
|
||||
[test_no_browsing_context]
|
||||
expected: ERROR
|
3
tests/wpt/meta/webdriver/tests/classic/take_screenshot/screenshot.py.ini
vendored
Normal file
3
tests/wpt/meta/webdriver/tests/classic/take_screenshot/screenshot.py.ini
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
[screenshot.py]
|
||||
[test_no_browsing_context]
|
||||
expected: ERROR
|
Loading…
Add table
Add a link
Reference in a new issue