Skip to content

Commit

Permalink
Moving double-click detection logic inside InputManager for IE
Browse files Browse the repository at this point in the history
This also will prevent unnecessary expensive sleeps in the click command
handler. Partially fixes issue #5024.
  • Loading branch information
jimevans committed Feb 14, 2018
1 parent f45822a commit 42911ce
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
5 changes: 0 additions & 5 deletions cpp/iedriver/CommandHandlers/ClickElementCommandHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ void ClickElementCommandHandler::ExecuteInternal(const IECommandExecutor& execut
action_array.append(down_action);
action_array.append(up_action);

// Check to make sure we're not within the double-click time for this element
// since the last click.
int double_click_time = ::GetDoubleClickTime();

Json::Value parameters_value;
parameters_value["pointerType"] = "mouse";

Expand All @@ -105,7 +101,6 @@ void ClickElementCommandHandler::ExecuteInternal(const IECommandExecutor& execut
IECommandExecutor& mutable_executor = const_cast<IECommandExecutor&>(executor);
status_code = mutable_executor.input_manager()->PerformInputSequence(browser_wrapper, actions);
browser_wrapper->set_wait_required(true);
::Sleep(double_click_time + 10);
if (status_code != WD_SUCCESS) {
if (status_code == EELEMENTCLICKPOINTNOTSCROLLED) {
// We hard-code the error code here to be "Element not visible"
Expand Down
4 changes: 1 addition & 3 deletions cpp/iedriver/InputManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ int InputManager::PerformInputSequence(BrowserHandle browser_wrapper,
}

this->inputs_.clear();
this->current_input_state_.last_click_time = 0;
InputState current_input_state = this->CloneCurrentInputState();
for (size_t i = 0; i < ticks.size(); ++i) {
Json::UInt tick_index = static_cast<Json::UInt>(i);
Expand Down Expand Up @@ -709,7 +710,6 @@ int InputManager::PointerMoveTo(BrowserHandle browser_wrapper,
}
}
this->AddMouseInput(browser_window_handle, MOUSEEVENTF_MOVE, end_x, end_y);
this->AddPauseInput(browser_window_handle, 50);
}
input_state->mouse_x = end_x;
input_state->mouse_y = end_y;
Expand Down Expand Up @@ -766,7 +766,6 @@ int InputManager::PointerDown(BrowserHandle browser_wrapper,
button_event_value,
input_state->mouse_x,
input_state->mouse_y);
this->AddPauseInput(browser_window_handle, 50);
if (button == WD_CLIENT_RIGHT_MOUSE_BUTTON) {
input_state->is_right_button_pressed = true;
} else {
Expand Down Expand Up @@ -810,7 +809,6 @@ int InputManager::PointerUp(BrowserHandle browser_wrapper,
button_event_value,
input_state->mouse_x,
input_state->mouse_y);
this->AddPauseInput(browser_window_handle, 50);
if (button == WD_CLIENT_RIGHT_MOUSE_BUTTON) {
input_state->is_right_button_pressed = false;
} else {
Expand Down

0 comments on commit 42911ce

Please sign in to comment.