Skip to content

Fix origin relative coordinate for wheel scroll and refactoring - #36985

Merged
jdm merged 1 commit into
servo:mainfrom
PotatoCP:wheel-element-origin
May 13, 2025
Merged

jdm merged 1 commit into
servo:mainfrom
PotatoCP:wheel-element-origin

Conversation

@PotatoCP

@PotatoCP PotatoCP commented May 13, 2025 •

Copy link
Copy Markdown
Contributor
  • Wheel scroll action can get coordinates relative to an element origin (previously only implemented for viewport).
  • Extract the element coordinate into a function

Testing: Partially tests/wpt/tests/infrastructure/testdriver/actions/wheelScroll.html, but we still have synchronization problem. You can try to add sleep in the test to see OK result.

cc: @xiaochengh @longvatrong111 @yezhizhen

@PotatoCP
PotatoCP force-pushed the wheel-element-origin branch from 4984b0b to 85b23da Compare May 13, 2025 02:46
Comment thread components/webdriver_server/actions.rs Resolved
Comment thread components/webdriver_server/actions.rs Resolved
Comment on lines +666 to +671
match response? {
Some(point) => Ok(point),
None => Err(ErrorStatus::UnknownError),
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nice change! Previously, we would always return Err(ErrorStatus::UnknownError) even if response has other ErrorStatus here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Actually I am the one who caused the issue in #36928 🤦, initially it was fine.

@PotatoCP
PotatoCP force-pushed the wheel-element-origin branch from 85b23da to 790d492 Compare May 13, 2025 05:17
@jdm
jdm added this pull request to the merge queue May 13, 2025

@xiaochengh xiaochengh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, nice!

Comment on lines +520 to +523
PointerOrigin::Pointer => return Err(ErrorStatus::InvalidArgument),
PointerOrigin::Element(ref web_element) => {
self.get_element_origin_relative_coordinates(web_element)?
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
PointerOrigin::Pointer => return Err(ErrorStatus::InvalidArgument),
PointerOrigin::Element(ref web_element) => {
self.get_element_origin_relative_coordinates(web_element)?
},
PointerOrigin::Element(ref web_element) => {
self.get_element_origin_relative_coordinates(web_element)?
},
PointerOrigin::Pointer => return Err(ErrorStatus::InvalidArgument),

nit: let's don't put error handling in the middle of a match statement

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, the PR is merged. Should we open new PR or just wait until someone refactor?

@yezhizhen yezhizhen May 14, 2025 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Xiaocheng means it is a good practice that we can pay attention to in the future :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see. Okay" :D

Merged via the queue into servo:main with commit 91c4c7b May 13, 2025
@PotatoCP
PotatoCP deleted the wheel-element-origin branch May 17, 2025 02:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants