This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 29776 - Wrong mathematics at element center calculations.
Summary: Wrong mathematics at element center calculations.
Status: NEW
Alias: None
Product: Browser Test/Tools WG
Classification: Unclassified
Component: WebDriver (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: Browser Testing and Tools WG
QA Contact: Browser Testing and Tools WG
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 20860
  Show dependency treegraph
 
Reported: 2016-08-17 12:42 UTC by Aleksey
Modified: 2016-08-17 12:42 UTC (History)
2 users (show)

See Also:


Attachments

Description Aleksey 2016-08-17 12:42:45 UTC
https://www.w3.org/TR/webdriver/#element-click:

"Let visible width be rect’s bounding rectangle’s (max(x coordinate, x coordinate + width dimension)).

Let visible height be element’s bounding rectangle’s (max(y coordinate, y coordinate + height dimension)).

Let vertical centre offset be (visible width / 2.0).

Let horizontal centre offset be (visible height / 2.0).

Let centre point be a pair of rect’s (rectangle x coordinate + horizontal centre offset) and (rectangle y coordinate + vertical centre offset)"

(Let's omit the typo with visible height instead of visible width for horizontal center offset).

I don't understand such a math:

Say, x = 100, width = 5.

x center will be 100 + (100 + 5) / 2 = 152.5.
And it is out of the right rectancle boundary.


I think the x center should be calculated as:

0.5 * (max(0, min(x, x + width)) + min(innerWidth, max(x, x + width)))