New issue
Advanced search Search tips

Issue 711675 link

Starred by 3 users

Issue metadata

Status: Available
Owner: ----
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug
M-X



Sign in to add a comment

MacViews: EventGenerator can't move mouse using screen coordinates for non (0,0)-originated Widgets

Reported by mbl...@yandex-team.ru, Apr 14 2017

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.137 YaBrowser/17.4.1.353 (beta) Yowser/2.5 Safari/537.36

Steps to reproduce the problem:
https://codereview.chromium.org/2808223002/diff/80001/chrome/browser/ui/views/content_setting_bubble_contents_unittest.cc

This test can't click the checkbox on MacViews.

What is the expected behavior?

What went wrong?
This unit_test creates a bubble widget that's not positioned at (0,0) and tries to send a mouse click using  EventGenerator::MoveMouseTo which expects a point in screen coordinates.

The click misses because EventGeneratorDelegateMac treats passed coordinate as widget-local.

There's a ConvertPointToTarget() function to correct for that, but after that a lot of current tests start to fail. I investigated WidgetTest.MouseEventTypesViaGenerator: the actual gfx::ScreenRectFromNSRect([window_.get() frame]) of the NSWindow is

{
  origin_ = (x_ = 0, y_ = 23)
  size_ = (width_ = 100, height_ = 80)
}

Did this work before? No 

Chrome version: 57.0.2987.137  Channel: n/a
OS Version: OS X 10.12.4
Flash Version: 

Proposed ConvertPointToTarget implementation (fails a lot of current tests)

  void ConvertPointToTarget(const ui::EventTarget* target,
                            gfx::Point* point) const override {}
                            gfx::Point* point) const override {
    DCHECK_EQ(this, target);
    DCHECK_EQ(NO, [[window_ contentView] isFlipped]);
    const NSPoint windowPoint = ui::ConvertPointFromScreenToWindow(
        window_.get(), gfx::ScreenPointToNSPoint(*point));
    const NSRect contentRect =
        [window_ contentRectForFrameRect:[window_ frame]];
    *point = gfx::Point(windowPoint.x, NSHeight(contentRect) - windowPoint.y);
  }
 
Labels: Needs-Triage-M57
Owner: ellyjo...@chromium.org
Status: Assigned (was: Unconfirmed)
Over to ellyjones for further triage.
Components: Internals>Views
Labels: -Via-Wizard-Other -Needs-Triage-M57 MacViews-Cleanup
Owner: ----
Status: Available (was: Assigned)
This is a deficiency in MacViews unit test support, so tagging MacViews-Cleanup and leaving Available for now.

Comment 4 by gov...@chromium.org, Apr 13 2018

Labels: Proj-MacViews
Labels: M-X
Explicit M-X tag.
Labels: Group-Focus_Input_Selection_Activation_KeyState
Labels: Hotlist-DesktopUIChecked Hotlist-DesktopUIToolingRequired
*** UI Mass Triage***

Sign in to add a comment