Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Unified Diff: pdf/out_of_process_instance.cc

Issue 2864603006: Revert of Handle long press in PDF documents. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pdf/out_of_process_instance.h ('k') | pdf/pdf_engine.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pdf/out_of_process_instance.cc
diff --git a/pdf/out_of_process_instance.cc b/pdf/out_of_process_instance.cc
index 7bc387bf12da9a4babe27c9d2335c2923f4aae99..7d9c4830c09fcbc5a38c29b9fc28281fe8677808 100644
--- a/pdf/out_of_process_instance.cc
+++ b/pdf/out_of_process_instance.cc
@@ -239,11 +239,6 @@
return url.substr(0, strlen(kChromePrint)) == kChromePrint;
}
-void ScaleFloatPoint(float scale, pp::FloatPoint* point) {
- point->set_x(point->x() * scale);
- point->set_y(point->y() * scale);
-}
-
void ScalePoint(float scale, pp::Point* point) {
point->set_x(static_cast<int>(point->x() * scale));
point->set_y(static_cast<int>(point->y() * scale));
@@ -581,7 +576,8 @@
}
bool OutOfProcessInstance::HandleInputEvent(const pp::InputEvent& event) {
- // To simplify things, convert the event into device coordinates.
+ // To simplify things, convert the event into device coordinates if it is
+ // a mouse event.
pp::InputEvent event_device_res(event);
{
pp::MouseInputEvent mouse_event(event);
@@ -589,8 +585,6 @@
pp::Point point = mouse_event.GetPosition();
pp::Point movement = mouse_event.GetMovement();
ScalePoint(device_scale_, &point);
- point.set_x(point.x() - available_area_.x());
-
ScalePoint(device_scale_, &movement);
mouse_event =
pp::MouseInputEvent(this, event.GetType(), event.GetTimeStamp(),
@@ -599,39 +593,28 @@
event_device_res = mouse_event;
}
}
- {
- pp::TouchInputEvent touch_event(event);
- if (!touch_event.is_null()) {
- pp::TouchInputEvent new_touch_event = pp::TouchInputEvent(
- this, touch_event.GetType(), touch_event.GetTimeStamp(),
- touch_event.GetModifiers());
-
- for (uint32_t i = 0;
- i < touch_event.GetTouchCount(PP_TOUCHLIST_TYPE_TARGETTOUCHES);
- i++) {
- pp::TouchPoint touch_point =
- touch_event.GetTouchByIndex(PP_TOUCHLIST_TYPE_TARGETTOUCHES, i);
-
- pp::FloatPoint point = touch_point.position();
-
- // Account for the scroll position. Touch events are in DOM coordinates
- // where mouse events appear to be in screen coordinates.
- point.set_x(scroll_offset_.x() + point.x());
- point.set_y(scroll_offset_.y() + point.y());
- ScaleFloatPoint(device_scale_, &point);
-
- point.set_x(point.x() - available_area_.x());
-
- new_touch_event.AddTouchPoint(
- PP_TOUCHLIST_TYPE_TARGETTOUCHES,
- {touch_point.id(), point, touch_point.radii(),
- touch_point.rotation_angle(), touch_point.pressure()});
- }
- event_device_res = new_touch_event;
+
+ pp::InputEvent offset_event(event_device_res);
+ switch (offset_event.GetType()) {
+ case PP_INPUTEVENT_TYPE_MOUSEDOWN:
+ case PP_INPUTEVENT_TYPE_MOUSEUP:
+ case PP_INPUTEVENT_TYPE_MOUSEMOVE:
+ case PP_INPUTEVENT_TYPE_MOUSEENTER:
+ case PP_INPUTEVENT_TYPE_MOUSELEAVE: {
+ pp::MouseInputEvent mouse_event(event_device_res);
+ pp::MouseInputEvent mouse_event_dip(event);
+ pp::Point point = mouse_event.GetPosition();
+ point.set_x(point.x() - available_area_.x());
+ offset_event = pp::MouseInputEvent(
+ this, event.GetType(), event.GetTimeStamp(), event.GetModifiers(),
+ mouse_event.GetButton(), point, mouse_event.GetClickCount(),
+ mouse_event.GetMovement());
+ break;
}
- }
-
- if (engine_->HandleEvent(event_device_res))
+ default:
+ break;
+ }
+ if (engine_->HandleEvent(offset_event))
return true;
// Middle click is used for scrolling and is handled by the container page.
@@ -676,13 +659,13 @@
}
if (!stop_scrolling_) {
- scroll_offset_ = view.GetScrollOffset();
+ pp::Point scroll_offset(view.GetScrollOffset());
// Because view messages come from the DOM, the coordinates of the viewport
// are 0-based (i.e. they do not correspond to the viewport's coordinates in
// JS), so we need to subtract the toolbar height to convert them into
// viewport coordinates.
- pp::FloatPoint scroll_offset_float(
- scroll_offset_.x(), scroll_offset_.y() - top_toolbar_height_);
+ pp::FloatPoint scroll_offset_float(scroll_offset.x(),
+ scroll_offset.y() - top_toolbar_height_);
scroll_offset_float = BoundScrollOffsetToDocument(scroll_offset_float);
engine_->ScrolledToXPosition(scroll_offset_float.x() * device_scale_);
engine_->ScrolledToYPosition(scroll_offset_float.y() * device_scale_);
@@ -977,10 +960,6 @@
} else {
NOTREACHED();
}
-}
-
-void OutOfProcessInstance::OnClientTouchTimerFired(int32_t id) {
- engine_->OnTouchTimerCallback(id);
}
void OutOfProcessInstance::OnClientTimerFired(int32_t id) {
@@ -1271,12 +1250,6 @@
return CreateURLLoaderInternal();
}
-void OutOfProcessInstance::ScheduleTouchTimerCallback(int id, int delay_in_ms) {
- pp::CompletionCallback callback = callback_factory_.NewCallback(
- &OutOfProcessInstance::OnClientTouchTimerFired);
- pp::Module::Get()->core()->CallOnMainThread(delay_in_ms, callback, id);
-}
-
void OutOfProcessInstance::ScheduleCallback(int id, int delay_in_ms) {
pp::CompletionCallback callback =
callback_factory_.NewCallback(&OutOfProcessInstance::OnClientTimerFired);
« no previous file with comments | « pdf/out_of_process_instance.h ('k') | pdf/pdf_engine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698