New issue
Advanced search Search tips

Issue 665042 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Nov 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug



Sign in to add a comment

ui_test_utils::SendMouseMoveSync with Ozone never holds down mouse buttons

Project Member Reported by lukasza@chromium.org, Nov 14 2016

Issue description

REPRO STEPS:

Use ui_test_utils to simulate start of a drag and drop:

1. // Simulate mouse move to the middle of an image / frame:
   ui_test_utils::SendMouseMoveSync(kMiddleOfLeftFrame);

2. // Simulate mouse down:
   ui_test_utils::SendMouseEventsSync(ui_controls::LEFT,
                                      ui_controls::DOWN);
3. // Simulate dragging the mouse:
   ui_test_utils::SendMouseMoveSync(kMiddleOfLeftFrame +
                                    gfx::Vector2d(10, 10)))

EXPECTED BEHAVIOR:

- Step #3 triggers sending to renderer a WebInputEvent with
  button field set to WebPointerProperties::Button::Left

- Drag starts.

The expected and desired behavior above is what happens with Aura, but without Ozone:
    $ cat out/cros/args.gn 
    dcheck_always_on = true
    is_component_build = true
    is_debug = false
    use_goma = true
    enable_nacl = false
    target_os = "chromeos"


ACTUAL BEHAVIOR:

- Step #3 triggers sending to renderer a WebInputEvent with
  button field set to WebPointerProperties::Button::NoButton

- Drag doesn't start, because WebInputEventResult MouseEventManager::handleMouseDraggedEvent explicitly checks whether a mouse button was held down:

    WebInputEventResult MouseEventManager::handleMouseDraggedEvent(
        const MouseEventWithHitTestResults& event) {
    ...
      if (event.event().pointerProperties().button !=
          WebPointerProperties::Button::Left)
        m_mousePressed = false;
    
      if (!m_mousePressed)
        return WebInputEventResult::NotHandled;

The unexpected behavior above is what happens with Ozone:
    $ cat out/ozone/args.gn 
    dcheck_always_on = true
    is_component_build = true
    is_debug = false
    use_goma = true
    enable_nacl = false
    target_os = "chromeos"
    use_ozone = true
 
I see in ui/aura/test/ui_controls_factory_ozone.cc that UIControlsOzone::SendMouseMoveNotifyWhenDone always calls PostMouseEvent with flags argument set to 0 (i.e. no mouse buttons held).

In contrast, I see in ui/aura/test/ui_controls_factory_aurax11.cc that it remembers which buttons where pressed down (i.e. from step #2 in repro steps) in |button_down_mask| global variable and uses this value when posting subsequent move events from UIControlsX11::SendMouseMoveNotifyWhenDone.
Cc: -lukasza@chromium.org
Owner: lukasza@chromium.org
Status: Started (was: Untriaged)
I think that the fix might be just passing button_down_mask_:

diff --git a/ui/aura/test/ui_controls_factory_ozone.cc b/ui/aura/test/ui_controls_factory_ozone.cc
index fb83983..30f6bae 100644
--- a/ui/aura/test/ui_controls_factory_ozone.cc
+++ b/ui/aura/test/ui_controls_factory_ozone.cc
@@ -116,7 +116,7 @@ class UIControlsOzone : public ui_controls::UIControlsAura {
     else
       event_type = ui::ET_MOUSE_MOVED;
 
-    PostMouseEvent(event_type, host_location, 0, 0);
+    PostMouseEvent(event_type, host_location, button_down_mask_, 0);
 

Project Member

Comment 3 by bugdroid1@chromium.org, Nov 16 2016

Status: Fixed (was: Started)

Sign in to add a comment