Fix for PDF menu should not come when mouse pointer is on the scroll bar.
PDF menu comes when mouse came in the PDF menu rect. Changes done to stop call to handle event by toolbar when mouse pointer is on any of the scroll bar. BUG=80214 Review URL: https://codereview.chromium.org/811083004 Cr-Commit-Position: refs/heads/master@{#310444}
This commit is contained in:
@ -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()) {
|
||||
|
@ -200,6 +200,10 @@ class Instance : public pp::InstancePrivate,
|
||||
void RotateClockwise();
|
||||
void RotateCounterclockwise();
|
||||
|
||||
// Helper function to inform when mouse pointer is on scrollbar, returns true
|
||||
// when mouse is on vertical or horizaontal scrollbar else returns false.
|
||||
bool IsMouseOnScrollbar(const pp::InputEvent& event);
|
||||
|
||||
private:
|
||||
// Called whenever the plugin geometry changes to update the location of the
|
||||
// scrollbars, background parts, and notifies the pdf engine.
|
||||
|
Reference in New Issue
Block a user