From 50dfc4a7068e8e08105f7b9a3945136e7246e677 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 1 Mar 2016 11:34:03 -0800 Subject: Replace FX_LPCRECT typedef with underlying types Helps with transparency. Also remove default args and use override consistently in the affected methods. R=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1751093002 . --- core/include/fxcrt/fx_coordinates.h | 4 -- xfa/src/fee/include/ifde_txtedtpage.h | 9 ++-- xfa/src/fee/src/fee/fde_txtedtpage.cpp | 9 ++-- xfa/src/fee/src/fee/fde_txtedtpage.h | 77 ++++++++++++++++-------------- xfa/src/fgas/include/fx_rbk.h | 2 +- xfa/src/fgas/include/fx_tbk.h | 2 +- xfa/src/fgas/src/font/fx_gefont.cpp | 6 +-- xfa/src/fwl/src/basewidget/fwl_editimp.cpp | 26 +++++----- 8 files changed, 67 insertions(+), 68 deletions(-) diff --git a/core/include/fxcrt/fx_coordinates.h b/core/include/fxcrt/fx_coordinates.h index 2f52f78b8f..53b4c1a12e 100644 --- a/core/include/fxcrt/fx_coordinates.h +++ b/core/include/fxcrt/fx_coordinates.h @@ -537,10 +537,6 @@ class CFX_RTemplate { }; typedef CFX_RTemplate CFX_Rect; typedef CFX_RTemplate CFX_RectF; -typedef CFX_RTemplate* FX_LPRECT; -typedef CFX_RTemplate* FX_LPRECTF; -typedef CFX_RTemplate const* FX_LPCRECT; -typedef CFX_RTemplate const* FX_LPCRECTF; typedef CFX_ArrayTemplate CFX_RectFArray; class CFX_Matrix { diff --git a/xfa/src/fee/include/ifde_txtedtpage.h b/xfa/src/fee/include/ifde_txtedtpage.h index c16e94febf..884b752d82 100644 --- a/xfa/src/fee/include/ifde_txtedtpage.h +++ b/xfa/src/fee/include/ifde_txtedtpage.h @@ -32,11 +32,10 @@ class IFDE_TxtEdtPage : public IFDE_CanvasSet, public IFX_TxtAccess { virtual int32_t GetDisplayPos(const CFX_RectF& rtClip, FXTEXT_CHARPOS*& pCharPos, - FX_LPRECTF pBBox = NULL) const = 0; - virtual FX_BOOL IsLoaded(FX_LPCRECTF pClipBox = NULL) = 0; - virtual int32_t LoadPage(FX_LPCRECTF pClipBox = NULL, - IFX_Pause* pPause = NULL) = 0; - virtual void UnloadPage(FX_LPCRECTF pClipBox = NULL) = 0; + CFX_RectF* pBBox) const = 0; + virtual FX_BOOL IsLoaded(const CFX_RectF* pClipBox) = 0; + virtual int32_t LoadPage(const CFX_RectF* pClipBox, IFX_Pause* pPause) = 0; + virtual void UnloadPage(const CFX_RectF* pClipBox) = 0; virtual const CFX_RectF& GetContentsBox() = 0; }; diff --git a/xfa/src/fee/src/fee/fde_txtedtpage.cpp b/xfa/src/fee/src/fee/fde_txtedtpage.cpp index 40d0155b45..14e7a94a8b 100644 --- a/xfa/src/fee/src/fee/fde_txtedtpage.cpp +++ b/xfa/src/fee/src/fee/fde_txtedtpage.cpp @@ -290,7 +290,7 @@ int32_t CFDE_TxtEdtPage::GetCharCount() const { } int32_t CFDE_TxtEdtPage::GetDisplayPos(const CFX_RectF& rtClip, FXTEXT_CHARPOS*& pCharPos, - FX_LPRECTF pBBox) const { + CFX_RectF* pBBox) const { pCharPos = FX_Alloc(FXTEXT_CHARPOS, m_nCharCount); int32_t nCharPosCount = 0; FDE_HVISUALOBJ hVisualObj = NULL; @@ -376,10 +376,11 @@ int32_t CFDE_TxtEdtPage::SelectWord(const CFX_PointF& fPoint, int32_t& nCount) { pIter->Release(); return nRet; } -FX_BOOL CFDE_TxtEdtPage::IsLoaded(FX_LPCRECTF pClipBox) { +FX_BOOL CFDE_TxtEdtPage::IsLoaded(const CFX_RectF* pClipBox) { return m_bLoaded; } -int32_t CFDE_TxtEdtPage::LoadPage(FX_LPCRECTF pClipBox, IFX_Pause* pPause) { +int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox, + IFX_Pause* pPause) { if (m_nRefCount > 0) { m_nRefCount++; return m_nRefCount; @@ -558,7 +559,7 @@ int32_t CFDE_TxtEdtPage::LoadPage(FX_LPCRECTF pClipBox, IFX_Pause* pPause) { m_bLoaded = TRUE; return 0; } -void CFDE_TxtEdtPage::UnloadPage(FX_LPCRECTF pClipBox) { +void CFDE_TxtEdtPage::UnloadPage(const CFX_RectF* pClipBox) { FXSYS_assert(m_nRefCount > 0); m_nRefCount--; if (m_nRefCount == 0) { diff --git a/xfa/src/fee/src/fee/fde_txtedtpage.h b/xfa/src/fee/src/fee/fde_txtedtpage.h index cc7ff244b7..9b67b6f486 100644 --- a/xfa/src/fee/src/fee/fde_txtedtpage.h +++ b/xfa/src/fee/src/fee/fde_txtedtpage.h @@ -99,42 +99,45 @@ class CFDE_TxtEdtPage : public IFDE_TxtEdtPage { public: CFDE_TxtEdtPage(IFDE_TxtEdtEngine* pEngine, int32_t nLineIndex); - virtual void Release(); - virtual IFDE_TxtEdtEngine* GetEngine() const; - - virtual FDE_VISUALOBJTYPE GetType(); - virtual FX_BOOL GetBBox(FDE_HVISUALOBJ hVisualObj, CFX_RectF& bbox); - virtual FX_BOOL GetMatrix(FDE_HVISUALOBJ hVisualObj, CFX_Matrix& matrix); - virtual FX_BOOL GetRect(FDE_HVISUALOBJ hVisualObj, CFX_RectF& rt); - virtual FX_BOOL GetClip(FDE_HVISUALOBJ hVisualObj, CFX_RectF& rt); - virtual int32_t GetCharRect(int32_t nIndex, - CFX_RectF& rect, - FX_BOOL bBBox = FALSE) const; - virtual int32_t GetCharIndex(const CFX_PointF& fPoint, FX_BOOL& bBefore); - virtual int32_t SelectWord(const CFX_PointF& fPoint, int32_t& nCount); - virtual int32_t GetCharStart() const; - virtual int32_t GetCharCount() const; - virtual void CalcRangeRectArray(int32_t nStart, - int32_t nCount, - CFX_RectFArray& RectFArr) const; - virtual int32_t GetDisplayPos(const CFX_RectF& rtClip, - FXTEXT_CHARPOS*& pCharPos, - FX_LPRECTF pBBox) const; - - virtual FX_BOOL IsLoaded(FX_LPCRECTF pClipBox = NULL); - virtual int32_t LoadPage(FX_LPCRECTF pClipBox = NULL, - IFX_Pause* pPause = NULL); - virtual void UnloadPage(FX_LPCRECTF pClipBox = NULL); - - virtual const CFX_RectF& GetContentsBox(); - virtual FX_POSITION GetFirstPosition(FDE_HVISUALOBJ hCanvas); - virtual FDE_HVISUALOBJ GetNext(FDE_HVISUALOBJ hCanvas, - FX_POSITION& pos, - IFDE_VisualSet*& pVisualSet); - virtual FDE_HVISUALOBJ GetParentCanvas(FDE_HVISUALOBJ hCanvas, - IFDE_VisualSet*& pVisualSet); - virtual FX_WCHAR GetChar(void* pIdentity, int32_t index) const; - virtual int32_t GetWidth(void* pIdentity, int32_t index) const; + // IFDE_TxtEditPage: + void Release() override; + IFDE_TxtEdtEngine* GetEngine() const override; + int32_t GetCharRect(int32_t nIndex, + CFX_RectF& rect, + FX_BOOL bBBox = FALSE) const override; + int32_t GetCharIndex(const CFX_PointF& fPoint, FX_BOOL& bBefore) override; + void CalcRangeRectArray(int32_t nStart, + int32_t nCount, + CFX_RectFArray& RectFArr) const override; + int32_t SelectWord(const CFX_PointF& fPoint, int32_t& nCount) override; + int32_t GetCharStart() const override; + int32_t GetCharCount() const override; + int32_t GetDisplayPos(const CFX_RectF& rtClip, + FXTEXT_CHARPOS*& pCharPos, + CFX_RectF* pBBox) const override; + FX_BOOL IsLoaded(const CFX_RectF* pClipBox) override; + int32_t LoadPage(const CFX_RectF* pClipBox, IFX_Pause* pPause) override; + void UnloadPage(const CFX_RectF* pClipBox) override; + const CFX_RectF& GetContentsBox() override; + + // IFDE_VisualSet: + FDE_VISUALOBJTYPE GetType() override; + FX_BOOL GetBBox(FDE_HVISUALOBJ hVisualObj, CFX_RectF& bbox) override; + FX_BOOL GetMatrix(FDE_HVISUALOBJ hVisualObj, CFX_Matrix& matrix) override; + FX_BOOL GetRect(FDE_HVISUALOBJ hVisualObj, CFX_RectF& rt) override; + FX_BOOL GetClip(FDE_HVISUALOBJ hVisualObj, CFX_RectF& rt) override; + + // IFDE_CanvasSet: + FX_POSITION GetFirstPosition(FDE_HVISUALOBJ hCanvas) override; + FDE_HVISUALOBJ GetNext(FDE_HVISUALOBJ hCanvas, + FX_POSITION& pos, + IFDE_VisualSet*& pVisualSet) override; + FDE_HVISUALOBJ GetParentCanvas(FDE_HVISUALOBJ hCanvas, + IFDE_VisualSet*& pVisualSet) override; + + // IFX_TxtAccess: + FX_WCHAR GetChar(void* pIdentity, int32_t index) const override; + int32_t GetWidth(void* pIdentity, int32_t index) const override; protected: virtual ~CFDE_TxtEdtPage(); @@ -143,13 +146,13 @@ class CFDE_TxtEdtPage : public IFDE_TxtEdtPage { void NormalizePt2Rect(CFX_PointF& ptF, const CFX_RectF& rtF, FX_FLOAT fTolerance) const; + IFX_CharIter* m_pIter; CFDE_TxtEdtTextSet* m_pTextSet; CFDE_TxtEdtEngine* m_pEditEngine; CFDE_TXTEDTPieceMassArray m_PieceMassArr; CFDE_TxtEdtParag* m_pBgnParag; CFDE_TxtEdtParag* m_pEndParag; - int32_t m_nRefCount; int32_t m_nPageStart; int32_t m_nCharCount; diff --git a/xfa/src/fgas/include/fx_rbk.h b/xfa/src/fgas/include/fx_rbk.h index 043361b0a3..ef76ab6243 100644 --- a/xfa/src/fgas/include/fx_rbk.h +++ b/xfa/src/fgas/include/fx_rbk.h @@ -89,7 +89,7 @@ struct FX_RTFTEXTOBJ { FX_DWORD dwLayoutStyles; int32_t iCharRotation; int32_t iBidiLevel; - FX_LPCRECTF pRect; + const CFX_RectF* pRect; FX_WCHAR wLineBreakChar; int32_t iHorizontalScale; int32_t iVerticalScale; diff --git a/xfa/src/fgas/include/fx_tbk.h b/xfa/src/fgas/include/fx_tbk.h index 073228883d..aa207a568f 100644 --- a/xfa/src/fgas/include/fx_tbk.h +++ b/xfa/src/fgas/include/fx_tbk.h @@ -109,7 +109,7 @@ struct FX_TXTRUN { int32_t iVerticalScale; int32_t iCharRotation; FX_DWORD dwCharStyles; - FX_LPCRECTF pRect; + const CFX_RectF* pRect; FX_WCHAR wLineBreakChar; FX_BOOL bSkipSpace; }; diff --git a/xfa/src/fgas/src/font/fx_gefont.cpp b/xfa/src/fgas/src/font/fx_gefont.cpp index 37066a2a49..468e28ea96 100644 --- a/xfa/src/fgas/src/font/fx_gefont.cpp +++ b/xfa/src/fgas/src/font/fx_gefont.cpp @@ -447,10 +447,10 @@ FX_BOOL CFX_GEFont::GetCharBBox(FX_WCHAR wUnicode, } } } - if (pRect == NULL) { + if (!pRect) return FALSE; - } - bbox = *(FX_LPCRECT)pRect; + + bbox = *static_cast(pRect); return TRUE; } FX_BOOL CFX_GEFont::GetBBox(CFX_Rect& bbox) { diff --git a/xfa/src/fwl/src/basewidget/fwl_editimp.cpp b/xfa/src/fwl/src/basewidget/fwl_editimp.cpp index 4cbf92ba7b..74c7ef21fe 100644 --- a/xfa/src/fwl/src/basewidget/fwl_editimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_editimp.cpp @@ -866,7 +866,7 @@ FX_BOOL CFWL_EditImp::On_PageLoad(IFDE_TxtEdtEngine* pEdit, IFDE_TxtEdtPage* pPage = pEdtEngine->GetPage(nPageIndex); if (!pPage) return FALSE; - pPage->LoadPage(); + pPage->LoadPage(nullptr, nullptr); return TRUE; } FX_BOOL CFWL_EditImp::On_PageUnload(IFDE_TxtEdtEngine* pEdit, @@ -876,7 +876,7 @@ FX_BOOL CFWL_EditImp::On_PageUnload(IFDE_TxtEdtEngine* pEdit, IFDE_TxtEdtPage* pPage = pEdtEngine->GetPage(nPageIndex); if (!pPage) return FALSE; - pPage->UnloadPage(); + pPage->UnloadPage(nullptr); return TRUE; } @@ -1186,23 +1186,23 @@ void CFWL_EditImp::UpdateEditParams() { params.pEventSink = this; m_pEdtEngine->SetEditParams(params); } + void CFWL_EditImp::UpdateEditLayout() { - if (m_pEdtEngine->GetTextLength() <= 0) { - m_pEdtEngine->SetTextByStream(NULL); - } + if (m_pEdtEngine->GetTextLength() <= 0) + m_pEdtEngine->SetTextByStream(nullptr); + IFDE_TxtEdtPage* pPage = m_pEdtEngine->GetPage(0); - if (pPage) { - pPage->UnloadPage(); - pPage = NULL; - } + if (pPage) + pPage->UnloadPage(nullptr); + m_pEdtEngine->StartLayout(); - m_pEdtEngine->DoLayout(NULL); + m_pEdtEngine->DoLayout(nullptr); m_pEdtEngine->EndLayout(); pPage = m_pEdtEngine->GetPage(0); - if (pPage) { - pPage->LoadPage(); - } + if (pPage) + pPage->LoadPage(nullptr, nullptr); } + FX_BOOL CFWL_EditImp::UpdateOffset() { CFX_RectF rtCaret; m_pEdtEngine->GetCaretRect(rtCaret); -- cgit v1.2.3