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

Unified Diff: pdf/instance.cc

Issue 811083004: Fix for PDF menu should not come when mouse pointer is on the scrollbar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes as per review comments. Created 5 years, 11 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/instance.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pdf/instance.cc
diff --git a/pdf/instance.cc b/pdf/instance.cc
index 90370af88f9baef5535247471b6b78e07f93cbb1..9b4d52ac684e11a722f01efbde712b88a93068d2 100644
--- a/pdf/instance.cc
+++ b/pdf/instance.cc
@@ -434,7 +434,8 @@ bool Instance::HandleInputEvent(const pp::InputEvent& event) {
return true;
#endif
- if (toolbar_->HandleEvent(event_device_res))
+ if (!IsMouseOnScrollbar(event_device_res) &&
+ toolbar_->HandleEvent(event_device_res))
return true;
#ifdef ENABLE_THUMBNAILS
@@ -496,14 +497,8 @@ bool Instance::HandleInputEvent(const pp::InputEvent& event) {
if (!IsOverlayScrollbar() &&
!available_area_.Contains(mouse_event.GetPosition())) {
try_engine_first = false;
- } else if (IsOverlayScrollbar()) {
- pp::Rect temp;
- if ((v_scrollbar_.get() && v_scrollbar_->GetLocation(&temp) &&
- temp.Contains(mouse_event_dip.GetPosition())) ||
- (h_scrollbar_.get() && h_scrollbar_->GetLocation(&temp) &&
- temp.Contains(mouse_event_dip.GetPosition()))) {
+ } else if (IsOverlayScrollbar() && IsMouseOnScrollbar(event)) {
try_engine_first = false;
- }
}
}
break;
@@ -1604,6 +1599,22 @@ void Instance::RotateCounterclockwise() {
engine_->RotateCounterclockwise();
}
+bool Instance::IsMouseOnScrollbar(const pp::InputEvent& event) {
+ pp::MouseInputEvent mouse_event(event);
+ if (mouse_event.is_null())
+ return false;
+
+ pp::Point pt = mouse_event.GetPosition();
+ pp::Rect temp;
+ if ((v_scrollbar_.get() && v_scrollbar_->GetLocation(&temp) &&
+ temp.Contains(pt)) ||
+ (h_scrollbar_.get() && h_scrollbar_->GetLocation(&temp) &&
+ temp.Contains(pt))) {
+ return true;
+ }
+ return false;
+}
+
void Instance::PreviewDocumentLoadComplete() {
if (preview_document_load_state_ != LOAD_STATE_LOADING ||
preview_pages_info_.empty()) {
« no previous file with comments | « pdf/instance.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698