From edd481bdfecae75042cb6daefa7bf2ff0a445677 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 20 Jul 2017 12:28:06 -0400 Subject: Remove CLST_Rect and replace with CFX_FloatRect. This CL removes the CLST_Rect and uses CFX_FloatRect directly. The constructor params for CLST_Rect were (left, top, right, bottom) and CFX_FloatRect (left, bottom, right, top) so the usages have been flipped. Change-Id: I78bb2927c4ff9d5ad6d28099dd08a5bdda7646b0 Reviewed-on: https://pdfium-review.googlesource.com/8432 Reviewed-by: Henrique Nakashima Commit-Queue: dsinclair --- fpdfsdk/fxedit/fxet_list.cpp | 7 ++++--- fpdfsdk/fxedit/fxet_list.h | 44 +++++++------------------------------------- 2 files changed, 11 insertions(+), 40 deletions(-) diff --git a/fpdfsdk/fxedit/fxet_list.cpp b/fpdfsdk/fxedit/fxet_list.cpp index 80f4fcc63e..6778122b7e 100644 --- a/fpdfsdk/fxedit/fxet_list.cpp +++ b/fpdfsdk/fxedit/fxet_list.cpp @@ -322,7 +322,7 @@ CFX_FloatRect CFX_ListCtrl::GetItemRectInternal(int32_t nIndex) const { CFX_FloatRect rcItem = m_ListItems[nIndex]->GetRect(); rcItem.left = 0.0f; rcItem.right = GetPlateRect().Width(); - return InnerToOuter(CLST_Rect(rcItem)); + return InnerToOuter(rcItem); } int32_t CFX_ListCtrl::GetCaret() const { @@ -519,11 +519,12 @@ void CFX_ListCtrl::ReArrange(int32_t nItemIndex) { for (const auto& pListItem : m_ListItems) { if (pListItem) { float fListItemHeight = pListItem->GetItemHeight(); - pListItem->SetRect(CLST_Rect(0.0f, fPosY, 0.0f, fPosY + fListItemHeight)); + pListItem->SetRect( + CFX_FloatRect(0.0f, fPosY + fListItemHeight, 0.0f, fPosY)); fPosY += fListItemHeight; } } - SetContentRect(CLST_Rect(0.0f, 0.0f, 0.0f, fPosY)); + SetContentRect(CFX_FloatRect(0.0f, fPosY, 0.0f, 0.0f)); SetScrollInfo(); } diff --git a/fpdfsdk/fxedit/fxet_list.h b/fpdfsdk/fxedit/fxet_list.h index b34cc54830..6884c69391 100644 --- a/fpdfsdk/fxedit/fxet_list.h +++ b/fpdfsdk/fxedit/fxet_list.h @@ -19,36 +19,6 @@ class CFX_Edit; class CFX_Edit_Iterator; class CPWL_List_Notify; -class CLST_Rect : public CFX_FloatRect { - public: - CLST_Rect() { left = top = right = bottom = 0.0f; } - - CLST_Rect(float other_left, - float other_top, - float other_right, - float other_bottom) { - left = other_left; - top = other_top; - right = other_right; - bottom = other_bottom; - } - - explicit CLST_Rect(const CFX_FloatRect& rect) { - left = rect.left; - top = rect.top; - right = rect.right; - bottom = rect.bottom; - } - - ~CLST_Rect() {} - - float Height() const { - if (top > bottom) - return top - bottom; - return bottom - top; - } -}; - class CFX_ListItem final { public: CFX_ListItem(); @@ -84,8 +54,8 @@ class CFX_ListContainer { virtual void SetPlateRect(const CFX_FloatRect& rect); CFX_FloatRect GetPlateRect() const { return m_rcPlate; } - void SetContentRect(const CLST_Rect& rect) { m_rcContent = rect; } - CLST_Rect GetContentRect() const { return m_rcContent; } + void SetContentRect(const CFX_FloatRect& rect) { m_rcContent = rect; } + CFX_FloatRect GetContentRect() const { return m_rcContent; } CFX_PointF GetBTPoint() const { return CFX_PointF(m_rcPlate.left, m_rcPlate.top); } @@ -100,24 +70,24 @@ class CFX_ListContainer { CFX_PointF OuterToInner(const CFX_PointF& point) const { return CFX_PointF(point.x - GetBTPoint().x, GetBTPoint().y - point.y); } - CFX_FloatRect InnerToOuter(const CLST_Rect& rect) const { + CFX_FloatRect InnerToOuter(const CFX_FloatRect& rect) const { CFX_PointF ptLeftTop = InnerToOuter(CFX_PointF(rect.left, rect.top)); CFX_PointF ptRightBottom = InnerToOuter(CFX_PointF(rect.right, rect.bottom)); return CFX_FloatRect(ptLeftTop.x, ptRightBottom.y, ptRightBottom.x, ptLeftTop.y); } - CLST_Rect OuterToInner(const CFX_FloatRect& rect) const { + CFX_FloatRect OuterToInner(const CFX_FloatRect& rect) const { CFX_PointF ptLeftTop = OuterToInner(CFX_PointF(rect.left, rect.top)); CFX_PointF ptRightBottom = OuterToInner(CFX_PointF(rect.right, rect.bottom)); - return CLST_Rect(ptLeftTop.x, ptLeftTop.y, ptRightBottom.x, - ptRightBottom.y); + return CFX_FloatRect(ptLeftTop.x, ptRightBottom.y, ptRightBottom.x, + ptLeftTop.y); } private: CFX_FloatRect m_rcPlate; - CLST_Rect m_rcContent; // positive forever! + CFX_FloatRect m_rcContent; }; class CPLST_Select { -- cgit v1.2.3