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

Unified Diff: pdf/pdfium/pdfium_engine.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/pdfium/pdfium_engine.h ('k') | pdf/preview_mode_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pdf/pdfium/pdfium_engine.cc
diff --git a/pdf/pdfium/pdfium_engine.cc b/pdf/pdfium/pdfium_engine.cc
index 0500226fc0aebf4838dddefd9875d38b88a491c6..8ab5a1bb67b2f5d879aeaf7561377195c36ad1c2 100644
--- a/pdf/pdfium/pdfium_engine.cc
+++ b/pdf/pdfium/pdfium_engine.cc
@@ -88,8 +88,6 @@
const int32_t kMaxPasswordTries = 3;
-const int32_t kTouchLongPressTimeoutMs = 300;
-
// See Table 3.20 in
// http://www.adobe.com/devnet/acrobat/pdfs/pdf_reference_1-7.pdf
const uint32_t kPDFPermissionPrintLowQualityMask = 1 << 2;
@@ -683,8 +681,7 @@
permissions_(0),
permissions_handler_revision_(-1),
fpdf_availability_(nullptr),
- next_formfill_timer_id_(0),
- next_touch_timer_id_(0),
+ next_timer_id_(0),
last_page_mouse_down_(-1),
most_visible_page_(-1),
called_do_document_action_(false),
@@ -1338,21 +1335,6 @@
case PP_INPUTEVENT_TYPE_CHAR:
rv = OnChar(pp::KeyboardInputEvent(event));
break;
- case PP_INPUTEVENT_TYPE_TOUCHSTART: {
- KillTouchTimer(next_touch_timer_id_);
-
- pp::TouchInputEvent touch_event(event);
- if (touch_event.GetTouchCount(PP_TOUCHLIST_TYPE_TARGETTOUCHES) == 1)
- ScheduleTouchTimer(touch_event);
- break;
- }
- case PP_INPUTEVENT_TYPE_TOUCHEND:
- KillTouchTimer(next_touch_timer_id_);
- break;
- case PP_INPUTEVENT_TYPE_TOUCHMOVE:
- // TODO(dsinclair): This should allow a little bit of movement (up to the
- // touch radii) to account for finger jiggle.
- KillTouchTimer(next_touch_timer_id_);
default:
break;
}
@@ -2482,36 +2464,12 @@
}
void PDFiumEngine::OnCallback(int id) {
- if (!formfill_timers_.count(id))
+ if (!timers_.count(id))
return;
- formfill_timers_[id].second(id);
- if (formfill_timers_.count(id)) // The callback might delete the timer.
- client_->ScheduleCallback(id, formfill_timers_[id].first);
-}
-
-void PDFiumEngine::OnTouchTimerCallback(int id) {
- if (!touch_timers_.count(id))
- return;
-
- HandleLongPress(touch_timers_[id]);
- KillTouchTimer(id);
-}
-
-void PDFiumEngine::HandleLongPress(const pp::TouchInputEvent& event) {
- pp::FloatPoint fp =
- event.GetTouchByIndex(PP_TOUCHLIST_TYPE_TARGETTOUCHES, 0).position();
- pp::Point point;
- point.set_x(fp.x());
- point.set_y(fp.y());
-
- // Send a fake mouse down to trigger the multi-click selection code.
- pp::MouseInputEvent mouse_event(
- client_->GetPluginInstance(), PP_INPUTEVENT_TYPE_MOUSEDOWN,
- event.GetTimeStamp(), event.GetModifiers(),
- PP_INPUTEVENT_MOUSEBUTTON_LEFT, point, 2, point);
-
- OnMouseDown(mouse_event);
+ timers_[id].second(id);
+ if (timers_.count(id)) // The callback might delete the timer.
+ client_->ScheduleCallback(id, timers_[id].first);
}
int PDFiumEngine::GetCharCount(int page_index) {
@@ -3580,16 +3538,6 @@
client_->IsSelectingChanged(selecting);
}
-void PDFiumEngine::ScheduleTouchTimer(const pp::TouchInputEvent& evt) {
- touch_timers_[++next_touch_timer_id_] = evt;
- client_->ScheduleTouchTimerCallback(next_touch_timer_id_,
- kTouchLongPressTimeoutMs);
-}
-
-void PDFiumEngine::KillTouchTimer(int timer_id) {
- touch_timers_.erase(timer_id);
-}
-
bool PDFiumEngine::PageIndexInBounds(int index) const {
return index >= 0 && index < static_cast<int>(pages_.size());
}
@@ -3641,15 +3589,15 @@
int elapse,
TimerCallback timer_func) {
PDFiumEngine* engine = static_cast<PDFiumEngine*>(param);
- engine->formfill_timers_[++engine->next_formfill_timer_id_] =
+ engine->timers_[++engine->next_timer_id_] =
std::pair<int, TimerCallback>(elapse, timer_func);
- engine->client_->ScheduleCallback(engine->next_formfill_timer_id_, elapse);
- return engine->next_formfill_timer_id_;
+ engine->client_->ScheduleCallback(engine->next_timer_id_, elapse);
+ return engine->next_timer_id_;
}
void PDFiumEngine::Form_KillTimer(FPDF_FORMFILLINFO* param, int timer_id) {
PDFiumEngine* engine = static_cast<PDFiumEngine*>(param);
- engine->formfill_timers_.erase(timer_id);
+ engine->timers_.erase(timer_id);
}
FPDF_SYSTEMTIME PDFiumEngine::Form_GetLocalTime(FPDF_FORMFILLINFO* param) {
« no previous file with comments | « pdf/pdfium/pdfium_engine.h ('k') | pdf/preview_mode_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698