summaryrefslogtreecommitdiffstats
path: root/pdf
diff options
context:
space:
mode:
authordeepak.m1 <deepak.m1@samsung.com>2015-02-13 03:56:23 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-13 11:56:55 +0000
commit423f09c6d2be8c916637cdda28ed0ee4e12490e0 (patch)
tree3e7792c64daff60ebe8100962e73755c0ba17963 /pdf
parentaa934d4d264715ab4c52b1cbefcd9447e3230987 (diff)
downloadchromium_src-423f09c6d2be8c916637cdda28ed0ee4e12490e0.zip
chromium_src-423f09c6d2be8c916637cdda28ed0ee4e12490e0.tar.gz
chromium_src-423f09c6d2be8c916637cdda28ed0ee4e12490e0.tar.bz2
Fix for Multipage selection by dragging mouse in OOP case in PDF.
Code was not present for handling drag by mouse. Now we are passing message when their is selection happening and based on mousemove event handler we are scrolling page when mouse points are outside the viewport. When we move mouse outside the viewport and does not move then mousemove events will not come then we are scrolling based on timer. BUG=446831 Review URL: https://codereview.chromium.org/814573004 Cr-Commit-Position: refs/heads/master@{#316204}
Diffstat (limited to 'pdf')
-rw-r--r--pdf/out_of_process_instance.cc11
-rw-r--r--pdf/out_of_process_instance.h1
-rw-r--r--pdf/pdf_engine.h3
-rw-r--r--pdf/pdfium/pdfium_engine.cc11
-rw-r--r--pdf/pdfium/pdfium_engine.h3
5 files changed, 27 insertions, 2 deletions
diff --git a/pdf/out_of_process_instance.cc b/pdf/out_of_process_instance.cc
index 169a440..74544d9 100644
--- a/pdf/out_of_process_instance.cc
+++ b/pdf/out_of_process_instance.cc
@@ -144,6 +144,10 @@ const char kJSSelectedText[] = "selectedText";
const char kJSSetNamedDestinationsType[] = "setNamedDestinations";
const char kJSNamedDestinations[] = "namedDestinations";
+// Selecting text in document (Plugin -> Page)
+const char kJSSetIsSelectingType[] = "setIsSelecting";
+const char kJSIsSelecting[] = "isSelecting";
+
const int kFindResultCooldownMs = 100;
const double kMinZoom = 0.01;
@@ -1351,6 +1355,13 @@ uint32 OutOfProcessInstance::GetBackgroundColor() {
return background_color_;
}
+void OutOfProcessInstance::IsSelectingChanged(bool is_selecting) {
+ pp::VarDictionary message;
+ message.Set(kType, kJSSetIsSelectingType);
+ message.Set(kJSIsSelecting, pp::Var(is_selecting));
+ PostMessage(message);
+}
+
void OutOfProcessInstance::ProcessPreviewPageInfo(const std::string& url,
int dst_page_index) {
if (!IsPrintPreview())
diff --git a/pdf/out_of_process_instance.h b/pdf/out_of_process_instance.h
index 58e9b29..62d21c1 100644
--- a/pdf/out_of_process_instance.h
+++ b/pdf/out_of_process_instance.h
@@ -137,6 +137,7 @@ class OutOfProcessInstance : public pp::Instance,
void FormTextFieldFocusChange(bool in_focus) override;
bool IsPrintPreview() override;
uint32 GetBackgroundColor() override;
+ void IsSelectingChanged(bool is_selecting) override;
// PreviewModeClient::Client implementation.
void PreviewDocumentLoadComplete() override;
diff --git a/pdf/pdf_engine.h b/pdf/pdf_engine.h
index befb1b8..0ef9da0 100644
--- a/pdf/pdf_engine.h
+++ b/pdf/pdf_engine.h
@@ -176,6 +176,9 @@ class PDFEngine {
// Get the background color of the PDF.
virtual uint32 GetBackgroundColor() = 0;
+
+ // Sets selection status.
+ virtual void IsSelectingChanged(bool is_selecting){};
};
// Factory method to create an instance of the PDF Engine.
diff --git a/pdf/pdfium/pdfium_engine.cc b/pdf/pdfium/pdfium_engine.cc
index 294ab2f..51e5676 100644
--- a/pdf/pdfium/pdfium_engine.cc
+++ b/pdf/pdfium/pdfium_engine.cc
@@ -1731,7 +1731,7 @@ bool PDFiumEngine::OnMouseDown(const pp::MouseInputEvent& event) {
}
void PDFiumEngine::OnSingleClick(int page_index, int char_index) {
- selecting_ = true;
+ SetSelecting(true);
selection_.push_back(PDFiumRange(pages_[page_index], char_index, 0));
}
@@ -1794,7 +1794,7 @@ bool PDFiumEngine::OnMouseUp(const pp::MouseInputEvent& event) {
if (!selecting_)
return false;
- selecting_ = false;
+ SetSelecting(false);
return true;
}
@@ -3471,6 +3471,13 @@ void PDFiumEngine::RotateInternal() {
}
}
+void PDFiumEngine::SetSelecting(bool selecting) {
+ bool was_selecting = selecting_;
+ selecting_ = selecting;
+ if (selecting_ != was_selecting)
+ client_->IsSelectingChanged(selecting);
+}
+
void PDFiumEngine::Form_Invalidate(FPDF_FORMFILLINFO* param,
FPDF_PAGE page,
double left,
diff --git a/pdf/pdfium/pdfium_engine.h b/pdf/pdfium/pdfium_engine.h
index d7b4835..be52763 100644
--- a/pdf/pdfium/pdfium_engine.h
+++ b/pdf/pdfium/pdfium_engine.h
@@ -423,6 +423,9 @@ class PDFiumEngine : public PDFEngine,
// Common code shared by RotateClockwise() and RotateCounterclockwise().
void RotateInternal();
+ // Setting selection status of document.
+ void SetSelecting(bool selecting);
+
// FPDF_FORMFILLINFO callbacks.
static void Form_Invalidate(FPDF_FORMFILLINFO* param,
FPDF_PAGE page,