magnifier_->UpdateLocation(magnifier_point);
magnifier_->Move(magnifier_point);
magnifier_->Show();
+
+ if (handle == input_handle_) {
+ ShowHandleAndContextMenuIfRequired();
+ return;
+ }
+
+ // When moving the handle we want to move only the extent point.
+ // Before doing so, we must make sure that the base point is set correctly.
+ float device_scale_factor =
+ gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().device_scale_factor();
+ gfx::Point base, extent;
+ if (handle == start_handle_) {
+ base.set_x(end_handle_->GetBasePosition().x() / device_scale_factor);
+ base.set_y(end_handle_->GetBasePosition().y() / device_scale_factor);
+ extent.set_x(start_handle_->GetBasePosition().x() / device_scale_factor);
+ extent.set_y(start_handle_->GetBasePosition().y() / device_scale_factor);
+ } else {
+ base.set_x(start_handle_->GetBasePosition().x() / device_scale_factor);
+ base.set_y(start_handle_->GetBasePosition().y() / device_scale_factor);
+ extent.set_x(end_handle_->GetBasePosition().x() / device_scale_factor);
+ extent.set_y(end_handle_->GetBasePosition().y() / device_scale_factor);
+ }
+ WebContentsImpl* wci = static_cast<WebContentsImpl*>(&web_contents_);
+ wci->SelectRange(base, extent);
+
ShowHandleAndContextMenuIfRequired();
}
}
case SelectionHandleEfl::HANDLE_TYPE_LEFT:
case SelectionHandleEfl::HANDLE_TYPE_RIGHT: {
- gfx::Point start_point, end_point;
float device_scale_factor =
gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().device_scale_factor();
- start_point.set_x(start_handle_->GetBasePosition().x() / device_scale_factor);
- start_point.set_y(start_handle_->GetBasePosition().y() / device_scale_factor);
- end_point.set_x(end_handle_->GetBasePosition().x() / device_scale_factor);
- end_point.set_y(end_handle_->GetBasePosition().y() / device_scale_factor);
+ gfx::Point extent;
+ extent.set_x(handle->GetBasePosition().x() / device_scale_factor);
+ extent.set_y(handle->GetBasePosition().y() / device_scale_factor);
WebContentsImpl* wci = static_cast<WebContentsImpl*>(&web_contents_);
- wci->SelectRange(start_point, end_point);
+ wci->MoveRangeSelectionExtent(extent);
return;
}
}