| Index: components/test_runner/event_sender.cc
|
| diff --git a/components/test_runner/event_sender.cc b/components/test_runner/event_sender.cc
|
| index 17a45cf014bc16b29234cb9fd852d6f0aefa5c7a..f5566b1a928dbff16a16ab92fb49eb35896b4401 100644
|
| --- a/components/test_runner/event_sender.cc
|
| +++ b/components/test_runner/event_sender.cc
|
| @@ -49,6 +49,36 @@ namespace test_runner {
|
|
|
| namespace {
|
|
|
| +WebMouseEvent::Button GetButtonTypeFromButtonNumber(int button_code) {
|
| + switch (button_code) {
|
| + case -1:
|
| + return WebMouseEvent::ButtonNone;
|
| + case 0:
|
| + return WebMouseEvent::ButtonLeft;
|
| + case 1:
|
| + return WebMouseEvent::ButtonMiddle;
|
| + case 2:
|
| + return WebMouseEvent::ButtonRight;
|
| + }
|
| + NOTREACHED();
|
| + return WebMouseEvent::ButtonNone;
|
| +}
|
| +
|
| +int GetWebMouseEventModifierForButton(WebMouseEvent::Button button) {
|
| + switch (button) {
|
| + case WebMouseEvent::ButtonNone:
|
| + return 0;
|
| + case WebMouseEvent::ButtonLeft:
|
| + return WebMouseEvent::LeftButtonDown;
|
| + case WebMouseEvent::ButtonMiddle:
|
| + return WebMouseEvent::MiddleButtonDown;
|
| + case WebMouseEvent::ButtonRight:
|
| + return WebMouseEvent::RightButtonDown;
|
| + }
|
| + NOTREACHED();
|
| + return 0;
|
| +}
|
| +
|
| void InitMouseEvent(WebInputEvent::Type t,
|
| WebMouseEvent::Button b,
|
| const WebPoint& pos,
|
| @@ -58,7 +88,7 @@ void InitMouseEvent(WebInputEvent::Type t,
|
| WebMouseEvent* e) {
|
| e->type = t;
|
| e->button = b;
|
| - e->modifiers = modifiers;
|
| + e->modifiers = modifiers | GetWebMouseEventModifierForButton(b);
|
| e->x = pos.x;
|
| e->y = pos.y;
|
| e->globalX = pos.x;
|
| @@ -257,14 +287,6 @@ std::vector<std::string> MakeMenuItemStringsFor(
|
| // WebKit impl and layout test results.
|
| const float kScrollbarPixelsPerTick = 40.0f;
|
|
|
| -WebMouseEvent::Button GetButtonTypeFromButtonNumber(int button_code) {
|
| - if (!button_code)
|
| - return WebMouseEvent::ButtonLeft;
|
| - if (button_code == 2)
|
| - return WebMouseEvent::ButtonRight;
|
| - return WebMouseEvent::ButtonMiddle;
|
| -}
|
| -
|
| class MouseDownTask : public WebMethodTask<EventSender> {
|
| public:
|
| MouseDownTask(EventSender* obj, int button_number, int modifiers)
|
|
|