Sanitize mouse wheel code. Consistently pass the mouse wheel delta as a CFX_Vector through out the stack. Whereas currently sometimes only the delta-Y value gets passed, and it is sometimes passed as a double and sometimes as a short. Along the way, encapsulate the CFWL_MessageMouseWheel class and clean up some nits. Change-Id: I86a678f7ea841045883654f58f43375174e53f70 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/68471 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.cpp b/fpdfsdk/cpdfsdk_annothandlermgr.cpp index 891e950..d579298 100644 --- a/fpdfsdk/cpdfsdk_annothandlermgr.cpp +++ b/fpdfsdk/cpdfsdk_annothandlermgr.cpp
@@ -182,11 +182,11 @@ CPDFSDK_PageView* pPageView, ObservedPtr<CPDFSDK_Annot>* pAnnot, uint32_t nFlags, - short zDelta, - const CFX_PointF& point) { + const CFX_PointF& point, + const CFX_Vector& delta) { ASSERT(pAnnot->HasObservable()); - return GetAnnotHandler(pAnnot->Get()) - ->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, point); + auto* handler = GetAnnotHandler(pAnnot->Get()); + return handler->OnMouseWheel(pPageView, pAnnot, nFlags, point, delta); } bool CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonDown(
diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.h b/fpdfsdk/cpdfsdk_annothandlermgr.h index a103469..dd01348 100644 --- a/fpdfsdk/cpdfsdk_annothandlermgr.h +++ b/fpdfsdk/cpdfsdk_annothandlermgr.h
@@ -86,8 +86,8 @@ bool Annot_OnMouseWheel(CPDFSDK_PageView* pPageView, ObservedPtr<CPDFSDK_Annot>* pAnnot, uint32_t nFlags, - short zDelta, - const CFX_PointF& point); + const CFX_PointF& point, + const CFX_Vector& delta); bool Annot_OnRButtonDown(CPDFSDK_PageView* pPageView, ObservedPtr<CPDFSDK_Annot>* pAnnot, uint32_t nFlags,
diff --git a/fpdfsdk/cpdfsdk_baannothandler.cpp b/fpdfsdk/cpdfsdk_baannothandler.cpp index a3a65ac..ea50f58 100644 --- a/fpdfsdk/cpdfsdk_baannothandler.cpp +++ b/fpdfsdk/cpdfsdk_baannothandler.cpp
@@ -7,6 +7,7 @@ #include "fpdfsdk/cpdfsdk_baannothandler.h" #include <memory> +#include <vector> #include "core/fpdfapi/page/cpdf_page.h" #include "core/fpdfdoc/cpdf_interactiveform.h" @@ -136,8 +137,8 @@ bool CPDFSDK_BAAnnotHandler::OnMouseWheel(CPDFSDK_PageView* pPageView, ObservedPtr<CPDFSDK_Annot>* pAnnot, uint32_t nFlags, - short zDelta, - const CFX_PointF& point) { + const CFX_PointF& point, + const CFX_Vector& delta) { return false; }
diff --git a/fpdfsdk/cpdfsdk_baannothandler.h b/fpdfsdk/cpdfsdk_baannothandler.h index 03a6b9f..3eaf446 100644 --- a/fpdfsdk/cpdfsdk_baannothandler.h +++ b/fpdfsdk/cpdfsdk_baannothandler.h
@@ -76,8 +76,8 @@ bool OnMouseWheel(CPDFSDK_PageView* pPageView, ObservedPtr<CPDFSDK_Annot>* pAnnot, uint32_t nFlags, - short zDelta, - const CFX_PointF& point) override; + const CFX_PointF& point, + const CFX_Vector& delta) override; bool OnRButtonDown(CPDFSDK_PageView* pPageView, ObservedPtr<CPDFSDK_Annot>* pAnnot, uint32_t nFlags,
diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp index e63fca6..4350605 100644 --- a/fpdfsdk/cpdfsdk_pageview.cpp +++ b/fpdfsdk/cpdfsdk_pageview.cpp
@@ -419,8 +419,7 @@ m_pCaptureWidget.Reset(); } -bool CPDFSDK_PageView::OnMouseWheel(double deltaX, - double deltaY, +bool CPDFSDK_PageView::OnMouseWheel(const CFX_Vector& delta, const CFX_PointF& point, int nFlag) { ObservedPtr<CPDFSDK_Annot> pAnnot(GetFXWidgetAtPoint(point)); @@ -429,8 +428,8 @@ CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = m_pFormFillEnv->GetAnnotHandlerMgr(); - return pAnnotHandlerMgr->Annot_OnMouseWheel(this, &pAnnot, nFlag, - static_cast<int>(deltaY), point); + return pAnnotHandlerMgr->Annot_OnMouseWheel(this, &pAnnot, nFlag, point, + delta); } bool CPDFSDK_PageView::SetIndexSelected(int index, bool selected) {
diff --git a/fpdfsdk/cpdfsdk_pageview.h b/fpdfsdk/cpdfsdk_pageview.h index 89adc7d..c59b671 100644 --- a/fpdfsdk/cpdfsdk_pageview.h +++ b/fpdfsdk/cpdfsdk_pageview.h
@@ -73,8 +73,7 @@ bool OnKeyDown(int nKeyCode, int nFlag); bool OnKeyUp(int nKeyCode, int nFlag); bool OnMouseMove(const CFX_PointF& point, int nFlag); - bool OnMouseWheel(double deltaX, - double deltaY, + bool OnMouseWheel(const CFX_Vector& delta, const CFX_PointF& point, int nFlag);
diff --git a/fpdfsdk/cpdfsdk_widgethandler.cpp b/fpdfsdk/cpdfsdk_widgethandler.cpp index f62f125..5881fd4 100644 --- a/fpdfsdk/cpdfsdk_widgethandler.cpp +++ b/fpdfsdk/cpdfsdk_widgethandler.cpp
@@ -141,10 +141,10 @@ bool CPDFSDK_WidgetHandler::OnMouseWheel(CPDFSDK_PageView* pPageView, ObservedPtr<CPDFSDK_Annot>* pAnnot, uint32_t nFlags, - short zDelta, - const CFX_PointF& point) { + const CFX_PointF& point, + const CFX_Vector& delta) { return !(*pAnnot)->IsSignatureWidget() && - m_pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, point); + m_pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, point, delta); } bool CPDFSDK_WidgetHandler::OnRButtonDown(CPDFSDK_PageView* pPageView,
diff --git a/fpdfsdk/cpdfsdk_widgethandler.h b/fpdfsdk/cpdfsdk_widgethandler.h index a1fb781..ebb6f6f 100644 --- a/fpdfsdk/cpdfsdk_widgethandler.h +++ b/fpdfsdk/cpdfsdk_widgethandler.h
@@ -76,8 +76,8 @@ bool OnMouseWheel(CPDFSDK_PageView* pPageView, ObservedPtr<CPDFSDK_Annot>* pAnnot, uint32_t nFlags, - short zDelta, - const CFX_PointF& point) override; + const CFX_PointF& point, + const CFX_Vector& delta) override; bool OnRButtonDown(CPDFSDK_PageView* pPageView, ObservedPtr<CPDFSDK_Annot>* pAnnot, uint32_t nFlags,
diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp index 2d9ffda..d44b32a 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.cpp +++ b/fpdfsdk/formfiller/cffl_formfiller.cpp
@@ -137,13 +137,13 @@ bool CFFL_FormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView, uint32_t nFlags, - short zDelta, - const CFX_PointF& point) { + const CFX_PointF& point, + const CFX_Vector& delta) { if (!IsValid()) return false; CPWL_Wnd* pWnd = GetPWLWindow(pPageView, true); - return pWnd && pWnd->OnMouseWheel(zDelta, FFLtoPWL(point), nFlags); + return pWnd && pWnd->OnMouseWheel(delta, FFLtoPWL(point), nFlags); } bool CFFL_FormFiller::OnRButtonDown(CPDFSDK_PageView* pPageView,
diff --git a/fpdfsdk/formfiller/cffl_formfiller.h b/fpdfsdk/formfiller/cffl_formfiller.h index ce43bbd..ba0f753 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.h +++ b/fpdfsdk/formfiller/cffl_formfiller.h
@@ -57,8 +57,8 @@ const CFX_PointF& point); virtual bool OnMouseWheel(CPDFSDK_PageView* pPageView, uint32_t nFlags, - short zDelta, - const CFX_PointF& point); + const CFX_PointF& point, + const CFX_Vector& delta); virtual bool OnRButtonDown(CPDFSDK_PageView* pPageView, uint32_t nFlags, const CFX_PointF& point);
diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp index b6dc475..8681c30 100644 --- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp +++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
@@ -312,12 +312,12 @@ CPDFSDK_PageView* pPageView, ObservedPtr<CPDFSDK_Annot>* pAnnot, uint32_t nFlags, - short zDelta, - const CFX_PointF& point) { + const CFX_PointF& point, + const CFX_Vector& delta) { ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get()); return pFormFiller && - pFormFiller->OnMouseWheel(pPageView, nFlags, zDelta, point); + pFormFiller->OnMouseWheel(pPageView, nFlags, point, delta); } bool CFFL_InteractiveFormFiller::OnRButtonDown(
diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.h b/fpdfsdk/formfiller/cffl_interactiveformfiller.h index 3adfe4e..d614b24 100644 --- a/fpdfsdk/formfiller/cffl_interactiveformfiller.h +++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.h
@@ -65,8 +65,8 @@ bool OnMouseWheel(CPDFSDK_PageView* pPageView, ObservedPtr<CPDFSDK_Annot>* pAnnot, uint32_t nFlags, - short zDelta, - const CFX_PointF& point); + const CFX_PointF& point, + const CFX_Vector& delta); bool OnRButtonDown(CPDFSDK_PageView* pPageView, ObservedPtr<CPDFSDK_Annot>* pAnnot, uint32_t nFlags,
diff --git a/fpdfsdk/fpdf_formfill.cpp b/fpdfsdk/fpdf_formfill.cpp index ac09b2e..35d8a24 100644 --- a/fpdfsdk/fpdf_formfill.cpp +++ b/fpdfsdk/fpdf_formfill.cpp
@@ -389,7 +389,7 @@ CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); if (!pPageView || !page_coord) return false; - return pPageView->OnMouseWheel(delta_x, delta_y, + return pPageView->OnMouseWheel(CFX_Vector(delta_x, delta_y), CFXPointFFromFSPointF(*page_coord), modifier); }
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_widgethandler.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_widgethandler.cpp index 855c5c4..04fbcec 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_widgethandler.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_widgethandler.cpp
@@ -456,8 +456,8 @@ bool CPDFXFA_WidgetHandler::OnMouseWheel(CPDFSDK_PageView* pPageView, ObservedPtr<CPDFSDK_Annot>* pAnnot, uint32_t nFlags, - short zDelta, - const CFX_PointF& point) { + const CFX_PointF& point, + const CFX_Vector& delta) { if (!pPageView) return false; @@ -467,7 +467,7 @@ CXFA_FFWidgetHandler* pWidgetHandler = GetXFAFFWidgetHandler(pXFAWidget); return pWidgetHandler->OnMouseWheel(pXFAWidget->GetXFAFFWidget(), - GetFWLFlags(nFlags), zDelta, point); + GetFWLFlags(nFlags), point, delta); } bool CPDFXFA_WidgetHandler::OnRButtonDown(CPDFSDK_PageView* pPageView,
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_widgethandler.h b/fpdfsdk/fpdfxfa/cpdfxfa_widgethandler.h index 9f066c5..abef600 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_widgethandler.h +++ b/fpdfsdk/fpdfxfa/cpdfxfa_widgethandler.h
@@ -77,8 +77,8 @@ bool OnMouseWheel(CPDFSDK_PageView* pPageView, ObservedPtr<CPDFSDK_Annot>* pAnnot, uint32_t nFlags, - short zDelta, - const CFX_PointF& point) override; + const CFX_PointF& point, + const CFX_Vector& delta) override; bool OnRButtonDown(CPDFSDK_PageView* pPageView, ObservedPtr<CPDFSDK_Annot>* pAnnot, uint32_t nFlags,
diff --git a/fpdfsdk/ipdfsdk_annothandler.h b/fpdfsdk/ipdfsdk_annothandler.h index d650d25..234d0b5 100644 --- a/fpdfsdk/ipdfsdk_annothandler.h +++ b/fpdfsdk/ipdfsdk_annothandler.h
@@ -73,8 +73,8 @@ virtual bool OnMouseWheel(CPDFSDK_PageView* pPageView, ObservedPtr<CPDFSDK_Annot>* pAnnot, uint32_t nFlags, - short zDelta, - const CFX_PointF& point) = 0; + const CFX_PointF& point, + const CFX_Vector& delta) = 0; virtual bool OnRButtonDown(CPDFSDK_PageView* pPageView, ObservedPtr<CPDFSDK_Annot>* pAnnot, uint32_t nFlags,
diff --git a/fpdfsdk/pwl/cpwl_edit.cpp b/fpdfsdk/pwl/cpwl_edit.cpp index 77491da..d8a6b41 100644 --- a/fpdfsdk/pwl/cpwl_edit.cpp +++ b/fpdfsdk/pwl/cpwl_edit.cpp
@@ -538,14 +538,14 @@ return CPWL_EditCtrl::OnChar(nChar, nFlag); } -bool CPWL_Edit::OnMouseWheel(short zDelta, +bool CPWL_Edit::OnMouseWheel(const CFX_Vector& delta, const CFX_PointF& point, uint32_t nFlag) { if (!HasFlag(PES_MULTILINE)) return false; CFX_PointF ptScroll = GetScrollPos(); - if (zDelta > 0) + if (delta.y > 0) ptScroll.y += GetFontSize(); else ptScroll.y -= GetFontSize();
diff --git a/fpdfsdk/pwl/cpwl_edit.h b/fpdfsdk/pwl/cpwl_edit.h index 1de382e..1dbdfe4 100644 --- a/fpdfsdk/pwl/cpwl_edit.h +++ b/fpdfsdk/pwl/cpwl_edit.h
@@ -62,7 +62,7 @@ bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) override; bool OnLButtonDblClk(const CFX_PointF& point, uint32_t nFlag) override; bool OnRButtonUp(const CFX_PointF& point, uint32_t nFlag) override; - bool OnMouseWheel(short zDelta, + bool OnMouseWheel(const CFX_Vector& delta, const CFX_PointF& point, uint32_t nFlag) override; bool OnKeyDown(uint16_t nChar, uint32_t nFlag) override;
diff --git a/fpdfsdk/pwl/cpwl_list_box.cpp b/fpdfsdk/pwl/cpwl_list_box.cpp index a0e2039..73bc46f 100644 --- a/fpdfsdk/pwl/cpwl_list_box.cpp +++ b/fpdfsdk/pwl/cpwl_list_box.cpp
@@ -366,10 +366,10 @@ return GetWindowRect().GetDeflated(width, width); } -bool CPWL_ListBox::OnMouseWheel(short zDelta, +bool CPWL_ListBox::OnMouseWheel(const CFX_Vector& delta, const CFX_PointF& point, uint32_t nFlag) { - if (zDelta < 0) + if (delta.y < 0) m_pList->OnVK_DOWN(IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); else m_pList->OnVK_UP(IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag));
diff --git a/fpdfsdk/pwl/cpwl_list_box.h b/fpdfsdk/pwl/cpwl_list_box.h index ba3a653..ab94eee 100644 --- a/fpdfsdk/pwl/cpwl_list_box.h +++ b/fpdfsdk/pwl/cpwl_list_box.h
@@ -53,7 +53,7 @@ bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) override; bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; bool OnMouseMove(const CFX_PointF& point, uint32_t nFlag) override; - bool OnMouseWheel(short zDelta, + bool OnMouseWheel(const CFX_Vector& delta, const CFX_PointF& point, uint32_t nFlag) override; WideString GetText() override;
diff --git a/fpdfsdk/pwl/cpwl_wnd.cpp b/fpdfsdk/pwl/cpwl_wnd.cpp index 0ba0e56..7683188 100644 --- a/fpdfsdk/pwl/cpwl_wnd.cpp +++ b/fpdfsdk/pwl/cpwl_wnd.cpp
@@ -352,7 +352,7 @@ return false; } -bool CPWL_Wnd::OnMouseWheel(short zDelta, +bool CPWL_Wnd::OnMouseWheel(const CFX_Vector& delta, const CFX_PointF& point, uint32_t nFlag) { if (!IsValid() || !IsVisible() || !IsEnabled()) @@ -364,7 +364,7 @@ for (const auto& pChild : m_Children) { if (IsWndCaptureKeyboard(pChild.get())) - return pChild->OnMouseWheel(zDelta, pChild->ParentToChild(point), nFlag); + return pChild->OnMouseWheel(delta, pChild->ParentToChild(point), nFlag); } return false; }
diff --git a/fpdfsdk/pwl/cpwl_wnd.h b/fpdfsdk/pwl/cpwl_wnd.h index 6e8f073..208949c 100644 --- a/fpdfsdk/pwl/cpwl_wnd.h +++ b/fpdfsdk/pwl/cpwl_wnd.h
@@ -151,7 +151,7 @@ virtual bool OnRButtonDown(const CFX_PointF& point, uint32_t nFlag); virtual bool OnRButtonUp(const CFX_PointF& point, uint32_t nFlag); virtual bool OnMouseMove(const CFX_PointF& point, uint32_t nFlag); - virtual bool OnMouseWheel(short zDelta, + virtual bool OnMouseWheel(const CFX_Vector& delta, const CFX_PointF& point, uint32_t nFlag); virtual void SetScrollInfo(const PWL_SCROLL_INFO& info);
diff --git a/xfa/fwl/cfwl_messagemousewheel.cpp b/xfa/fwl/cfwl_messagemousewheel.cpp index 3331179..9da3b7c 100644 --- a/xfa/fwl/cfwl_messagemousewheel.cpp +++ b/xfa/fwl/cfwl_messagemousewheel.cpp
@@ -6,17 +6,11 @@ #include "xfa/fwl/cfwl_messagemousewheel.h" -#include <memory> - -#include "third_party/base/ptr_util.h" - -CFWL_MessageMouseWheel::CFWL_MessageMouseWheel(CFWL_Widget* pDstTarget, - uint32_t flags, - CFX_PointF pos, - CFX_PointF delta) - : CFWL_Message(CFWL_Message::Type::MouseWheel, nullptr, pDstTarget), - m_dwFlags(flags), - m_pos(pos), - m_delta(delta) {} +CFWL_MessageMouseWheel::CFWL_MessageMouseWheel(CFWL_Widget* destination, + const CFX_PointF& pos, + const CFX_Vector& delta) + : CFWL_Message(CFWL_Message::Type::MouseWheel, nullptr, destination), + pos_(pos), + delta_(delta) {} CFWL_MessageMouseWheel::~CFWL_MessageMouseWheel() = default;
diff --git a/xfa/fwl/cfwl_messagemousewheel.h b/xfa/fwl/cfwl_messagemousewheel.h index 9908951..235fcc3 100644 --- a/xfa/fwl/cfwl_messagemousewheel.h +++ b/xfa/fwl/cfwl_messagemousewheel.h
@@ -7,22 +7,24 @@ #ifndef XFA_FWL_CFWL_MESSAGEMOUSEWHEEL_H_ #define XFA_FWL_CFWL_MESSAGEMOUSEWHEEL_H_ -#include <memory> - #include "core/fxcrt/fx_coordinates.h" #include "xfa/fwl/cfwl_message.h" class CFWL_MessageMouseWheel final : public CFWL_Message { public: - CFWL_MessageMouseWheel(CFWL_Widget* pDstTarget, - uint32_t flags, - CFX_PointF pos, - CFX_PointF delta); + CFWL_MessageMouseWheel(CFWL_Widget* destination, + const CFX_PointF& pos, + const CFX_Vector& delta); ~CFWL_MessageMouseWheel() override; - const uint32_t m_dwFlags; - CFX_PointF m_pos; - CFX_PointF m_delta; + void set_pos(const CFX_PointF& pos) { pos_ = pos; } + const CFX_PointF& pos() const { return pos_; } + + const CFX_Vector& delta() const { return delta_; } + + private: + CFX_PointF pos_; + const CFX_Vector delta_; }; #endif // XFA_FWL_CFWL_MESSAGEMOUSEWHEEL_H_
diff --git a/xfa/fwl/cfwl_notedriver.cpp b/xfa/fwl/cfwl_notedriver.cpp index 821dd5c..204a17d 100644 --- a/xfa/fwl/cfwl_notedriver.cpp +++ b/xfa/fwl/cfwl_notedriver.cpp
@@ -224,11 +224,11 @@ CFWL_Widget* pMessageForm) { CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr(); CFWL_MessageMouseWheel* pMsg = static_cast<CFWL_MessageMouseWheel*>(pMessage); - CFWL_Widget* pDst = pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_pos); + CFWL_Widget* pDst = pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->pos()); if (!pDst) return false; - pMsg->m_pos = pMessageForm->TransformTo(pDst, pMsg->m_pos); + pMsg->set_pos(pMessageForm->TransformTo(pDst, pMsg->pos())); pMsg->SetDstTarget(pDst); return true; }
diff --git a/xfa/fwl/cfwl_scrollbar.cpp b/xfa/fwl/cfwl_scrollbar.cpp index acc144f..4269049 100644 --- a/xfa/fwl/cfwl_scrollbar.cpp +++ b/xfa/fwl/cfwl_scrollbar.cpp
@@ -324,9 +324,8 @@ break; } } else if (type == CFWL_Message::Type::MouseWheel) { - CFWL_MessageMouseWheel* pMsg = - static_cast<CFWL_MessageMouseWheel*>(pMessage); - OnMouseWheel(pMsg->m_delta); + auto* pMsg = static_cast<CFWL_MessageMouseWheel*>(pMessage); + OnMouseWheel(pMsg->delta()); } } @@ -389,8 +388,8 @@ DoMouseLeave(4, m_rtMaxTrack, m_iMaxTrackState); } -void CFWL_ScrollBar::OnMouseWheel(const CFX_PointF& delta) { - m_iMouseWheel = static_cast<int32_t>(delta.x); +void CFWL_ScrollBar::OnMouseWheel(const CFX_Vector& delta) { + m_iMouseWheel = delta.y; SendEvent(); m_iMouseWheel = 0; }
diff --git a/xfa/fwl/cfwl_scrollbar.h b/xfa/fwl/cfwl_scrollbar.h index c98479d..5657c90 100644 --- a/xfa/fwl/cfwl_scrollbar.h +++ b/xfa/fwl/cfwl_scrollbar.h
@@ -88,7 +88,7 @@ void OnLButtonUp(const CFX_PointF& point); void OnMouseMove(const CFX_PointF& point); void OnMouseLeave(); - void OnMouseWheel(const CFX_PointF& delta); + void OnMouseWheel(const CFX_Vector& delta); bool DoScroll(CFWL_EventScroll::Code dwCode, float fPos); void DoMouseDown(int32_t iItem, const CFX_RectF& rtItem,
diff --git a/xfa/fxfa/cxfa_fffield.cpp b/xfa/fxfa/cxfa_fffield.cpp index f1438d5..4f5bf56 100644 --- a/xfa/fxfa/cxfa_fffield.cpp +++ b/xfa/fxfa/cxfa_fffield.cpp
@@ -481,8 +481,8 @@ } bool CXFA_FFField::OnMouseWheel(uint32_t dwFlags, - int16_t zDelta, - const CFX_PointF& point) { + const CFX_PointF& point, + const CFX_Vector& delta) { if (!GetNormalWidget()) return false; @@ -490,7 +490,7 @@ RetainPtr<CXFA_ContentLayoutItem> retainer(m_pLayoutItem.Get()); SendMessageToFWLWidget(pdfium::MakeUnique<CFWL_MessageMouseWheel>( - GetNormalWidget(), dwFlags, FWLToClient(point), CFX_PointF(zDelta, 0))); + GetNormalWidget(), FWLToClient(point), delta)); return true; }
diff --git a/xfa/fxfa/cxfa_fffield.h b/xfa/fxfa/cxfa_fffield.h index cce525a..59614e8 100644 --- a/xfa/fxfa/cxfa_fffield.h +++ b/xfa/fxfa/cxfa_fffield.h
@@ -48,8 +48,8 @@ bool OnLButtonDblClk(uint32_t dwFlags, const CFX_PointF& point) override; bool OnMouseMove(uint32_t dwFlags, const CFX_PointF& point) override; bool OnMouseWheel(uint32_t dwFlags, - int16_t zDelta, - const CFX_PointF& point) override; + const CFX_PointF& point, + const CFX_Vector& delta) override; bool OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) override; bool OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) override; bool OnRButtonDblClk(uint32_t dwFlags, const CFX_PointF& point) override;
diff --git a/xfa/fxfa/cxfa_ffsignature.cpp b/xfa/fxfa/cxfa_ffsignature.cpp index a7dc173..058abc3 100644 --- a/xfa/fxfa/cxfa_ffsignature.cpp +++ b/xfa/fxfa/cxfa_ffsignature.cpp
@@ -74,8 +74,8 @@ } bool CXFA_FFSignature::OnMouseWheel(uint32_t dwFlags, - int16_t zDelta, - const CFX_PointF& point) { + const CFX_PointF& point, + const CFX_Vector& delta) { return false; }
diff --git a/xfa/fxfa/cxfa_ffsignature.h b/xfa/fxfa/cxfa_ffsignature.h index 43f8344..0f6303c 100644 --- a/xfa/fxfa/cxfa_ffsignature.h +++ b/xfa/fxfa/cxfa_ffsignature.h
@@ -29,8 +29,8 @@ bool OnLButtonDblClk(uint32_t dwFlags, const CFX_PointF& point) override; bool OnMouseMove(uint32_t dwFlags, const CFX_PointF& point) override; bool OnMouseWheel(uint32_t dwFlags, - int16_t zDelta, - const CFX_PointF& pointy) override; + const CFX_PointF& point, + const CFX_Vector& delta) override; bool OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) override; bool OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) override; bool OnRButtonDblClk(uint32_t dwFlags, const CFX_PointF& point) override;
diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp index 45045a8..2ee8962 100644 --- a/xfa/fxfa/cxfa_ffwidget.cpp +++ b/xfa/fxfa/cxfa_ffwidget.cpp
@@ -407,8 +407,8 @@ } bool CXFA_FFWidget::OnMouseWheel(uint32_t dwFlags, - int16_t zDelta, - const CFX_PointF& point) { + const CFX_PointF& point, + const CFX_Vector& delta) { return false; }
diff --git a/xfa/fxfa/cxfa_ffwidget.h b/xfa/fxfa/cxfa_ffwidget.h index 008adfa..9b27a91 100644 --- a/xfa/fxfa/cxfa_ffwidget.h +++ b/xfa/fxfa/cxfa_ffwidget.h
@@ -107,8 +107,8 @@ virtual bool OnMouseMove(uint32_t dwFlags, const CFX_PointF& point) WARN_UNUSED_RESULT; virtual bool OnMouseWheel(uint32_t dwFlags, - int16_t zDelta, - const CFX_PointF& point) WARN_UNUSED_RESULT; + const CFX_PointF& point, + const CFX_Vector& delta) WARN_UNUSED_RESULT; virtual bool OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) WARN_UNUSED_RESULT; virtual bool OnRButtonUp(uint32_t dwFlags,
diff --git a/xfa/fxfa/cxfa_ffwidgethandler.cpp b/xfa/fxfa/cxfa_ffwidgethandler.cpp index f7153d6..d122917 100644 --- a/xfa/fxfa/cxfa_ffwidgethandler.cpp +++ b/xfa/fxfa/cxfa_ffwidgethandler.cpp
@@ -86,9 +86,9 @@ bool CXFA_FFWidgetHandler::OnMouseWheel(CXFA_FFWidget* hWidget, uint32_t dwFlags, - int16_t zDelta, - const CFX_PointF& point) { - return hWidget->OnMouseWheel(dwFlags, zDelta, hWidget->Rotate2Normal(point)); + const CFX_PointF& point, + const CFX_Vector& delta) { + return hWidget->OnMouseWheel(dwFlags, hWidget->Rotate2Normal(point), delta); } bool CXFA_FFWidgetHandler::OnRButtonDown(CXFA_FFWidget* hWidget,
diff --git a/xfa/fxfa/cxfa_ffwidgethandler.h b/xfa/fxfa/cxfa_ffwidgethandler.h index 3c56460..e5de8b8 100644 --- a/xfa/fxfa/cxfa_ffwidgethandler.h +++ b/xfa/fxfa/cxfa_ffwidgethandler.h
@@ -37,8 +37,8 @@ const CFX_PointF& point); bool OnMouseWheel(CXFA_FFWidget* hWidget, uint32_t dwFlags, - int16_t zDelta, - const CFX_PointF& point); + const CFX_PointF& point, + const CFX_Vector& delta); bool OnRButtonDown(CXFA_FFWidget* hWidget, uint32_t dwFlags, const CFX_PointF& point);