[Bug 29776] New: Wrong mathematics at element center calculations.

https://www.w3.org/Bugs/Public/show_bug.cgi?id=29776

            Bug ID: 29776
           Summary: Wrong mathematics at element center calculations.
           Product: Browser Test/Tools WG
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: WebDriver
          Assignee: public-browser-tools-testing@w3.org
          Reporter: alexchem@yandex.ru
        QA Contact: public-browser-tools-testing@w3.org
                CC: mike@w3.org
            Blocks: 20860
  Target Milestone: ---

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)))


Referenced Bugs:

https://www.w3.org/Bugs/Public/show_bug.cgi?id=20860
[Bug 20860] WebDriver Level 1
-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Wednesday, 17 August 2016 12:42:54 UTC