diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-08-16 16:37:16 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-08-17 15:39:14 +0000 |
commit | b3e7bfa6ed35651a22df314352883ccb44a7203d (patch) | |
tree | 7d5c4734bb8203f358890d09d2bafc49bc7fa67a /xfa | |
parent | 1748c4f6e42cda6ffa6bf32731d2fd525c060cf1 (diff) | |
download | pdfium-b3e7bfa6ed35651a22df314352883ccb44a7203d.tar.xz |
Cleanup visibilty and unused methods in xfa/fde
This CL fixes the visibility of some methods in xfa/fde along with
removing unused methods. Unused params are also removed.
Change-Id: Ic6e6d2ac8d07dc4bdabb3e0121831e4bf3fbb8ec
Reviewed-on: https://pdfium-review.googlesource.com/11271
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa')
-rw-r--r-- | xfa/fde/cfde_txtedtbuf.cpp | 15 | ||||
-rw-r--r-- | xfa/fde/cfde_txtedtbuf.h | 11 | ||||
-rw-r--r-- | xfa/fde/cfde_txtedtbuf_unittest.cpp | 2 | ||||
-rw-r--r-- | xfa/fde/cfde_txtedtengine.cpp | 102 | ||||
-rw-r--r-- | xfa/fde/cfde_txtedtengine.h | 20 | ||||
-rw-r--r-- | xfa/fde/cfde_txtedtpage.cpp | 27 | ||||
-rw-r--r-- | xfa/fde/cfde_txtedtpage.h | 15 | ||||
-rw-r--r-- | xfa/fde/cfde_txtedtparag.h | 4 | ||||
-rw-r--r-- | xfa/fde/cfde_txtedttextset.cpp | 22 | ||||
-rw-r--r-- | xfa/fde/cfde_txtedttextset.h | 4 | ||||
-rw-r--r-- | xfa/fwl/cfwl_edit.cpp | 22 |
11 files changed, 60 insertions, 184 deletions
diff --git a/xfa/fde/cfde_txtedtbuf.cpp b/xfa/fde/cfde_txtedtbuf.cpp index 1691cdaceb..6e712f2b04 100644 --- a/xfa/fde/cfde_txtedtbuf.cpp +++ b/xfa/fde/cfde_txtedtbuf.cpp @@ -14,7 +14,7 @@ namespace { -const int kDefaultChunkSize = 1024; +const int32_t kDefaultChunkSize = 1024; } // namespace @@ -29,8 +29,7 @@ void CFDE_TxtEdtBuf::SetText(const CFX_WideString& wsText) { Clear(false); int32_t nTextLength = wsText.GetLength(); - int32_t nNeedCount = - ((nTextLength - 1) / GetChunkSize() + 1) - m_chunks.size(); + int32_t nNeedCount = ((nTextLength - 1) / m_chunkSize + 1) - m_chunks.size(); int32_t i = 0; for (i = 0; i < nNeedCount; i++) m_chunks.push_back(NewChunk()); @@ -38,7 +37,7 @@ void CFDE_TxtEdtBuf::SetText(const CFX_WideString& wsText) { int32_t nTotalCount = m_chunks.size(); const wchar_t* lpSrcBuf = wsText.c_str(); int32_t nLeave = nTextLength; - int32_t nCopyedLength = GetChunkSize(); + int32_t nCopyedLength = m_chunkSize; for (i = 0; i < nTotalCount && nLeave > 0; i++) { if (nLeave < nCopyedLength) { nCopyedLength = nLeave; @@ -140,9 +139,9 @@ void CFDE_TxtEdtBuf::Insert(int32_t nPos, if (chunkIndex != 0) { ChunkHeader* chunk = m_chunks[chunkIndex - 1].get(); - if (chunk->nUsed != GetChunkSize()) { + if (chunk->nUsed != m_chunkSize) { chunkIndex--; - int32_t nFree = GetChunkSize() - chunk->nUsed; + int32_t nFree = m_chunkSize - chunk->nUsed; int32_t nCopy = std::min(nLengthTemp, nFree); memcpy(chunk->wChars.get() + chunk->nUsed, lpText, nCopy * sizeof(wchar_t)); @@ -156,7 +155,7 @@ void CFDE_TxtEdtBuf::Insert(int32_t nPos, while (nLengthTemp > 0) { auto chunk = NewChunk(); - int32_t nCopy = std::min(nLengthTemp, GetChunkSize()); + int32_t nCopy = std::min(nLengthTemp, m_chunkSize); memcpy(chunk->wChars.get(), lpText, nCopy * sizeof(wchar_t)); lpText += nCopy; nLengthTemp -= nCopy; @@ -241,7 +240,7 @@ std::tuple<int32_t, int32_t> CFDE_TxtEdtBuf::Index2CP(int32_t nIndex) const { std::unique_ptr<CFDE_TxtEdtBuf::ChunkHeader> CFDE_TxtEdtBuf::NewChunk() { auto chunk = pdfium::MakeUnique<ChunkHeader>(); - chunk->wChars.reset(FX_Alloc(wchar_t, GetChunkSize())); + chunk->wChars.reset(FX_Alloc(wchar_t, m_chunkSize)); chunk->nUsed = 0; return chunk; } diff --git a/xfa/fde/cfde_txtedtbuf.h b/xfa/fde/cfde_txtedtbuf.h index 3f1ad28c4f..f6d9ffc8c9 100644 --- a/xfa/fde/cfde_txtedtbuf.h +++ b/xfa/fde/cfde_txtedtbuf.h @@ -42,9 +42,7 @@ class CFDE_TxtEdtBuf { CFDE_TxtEdtBuf(); ~CFDE_TxtEdtBuf(); - int32_t GetChunkSize() const { return m_chunkSize; } int32_t GetTextLength() const { return m_nTotal; } - void SetText(const CFX_WideString& wsText); CFX_WideString GetText() const { return GetRange(0, m_nTotal); } @@ -55,10 +53,10 @@ class CFDE_TxtEdtBuf { void Delete(int32_t nIndex, int32_t nLength); void Clear(bool bRelease); - private: - friend class Iterator; - friend class CFDE_TxtEdtBufTest; + void SetChunkSizeForTesting(size_t size); + size_t GetChunkCountForTesting() const { return m_chunks.size(); } + private: class ChunkHeader { public: ChunkHeader(); @@ -68,11 +66,10 @@ class CFDE_TxtEdtBuf { std::unique_ptr<wchar_t, FxFreeDeleter> wChars; }; - void SetChunkSizeForTesting(size_t size); std::tuple<int32_t, int32_t> Index2CP(int32_t nIndex) const; std::unique_ptr<ChunkHeader> NewChunk(); - size_t m_chunkSize; + int32_t m_chunkSize; int32_t m_nTotal; std::vector<std::unique_ptr<ChunkHeader>> m_chunks; }; diff --git a/xfa/fde/cfde_txtedtbuf_unittest.cpp b/xfa/fde/cfde_txtedtbuf_unittest.cpp index 539ce24e31..020175aa57 100644 --- a/xfa/fde/cfde_txtedtbuf_unittest.cpp +++ b/xfa/fde/cfde_txtedtbuf_unittest.cpp @@ -15,7 +15,7 @@ class CFDE_TxtEdtBufTest : public testing::Test { buf_->SetChunkSizeForTesting(5); } - size_t ChunkCount() const { return buf_->m_chunks.size(); } + size_t ChunkCount() const { return buf_->GetChunkCountForTesting(); } std::unique_ptr<CFDE_TxtEdtBuf> buf_; }; diff --git a/xfa/fde/cfde_txtedtengine.cpp b/xfa/fde/cfde_txtedtengine.cpp index e2cfaf653d..c02676fdf3 100644 --- a/xfa/fde/cfde_txtedtengine.cpp +++ b/xfa/fde/cfde_txtedtengine.cpp @@ -197,36 +197,6 @@ CFDE_TxtEdtPage* CFDE_TxtEdtEngine::GetPage(int32_t nIndex) { return m_PagePtrArray[nIndex].get(); } -void CFDE_TxtEdtEngine::SetTextByStream( - const CFX_RetainPtr<CFX_SeekableStreamProxy>& pStream) { - ResetEngine(); - int32_t nIndex = 0; - if (pStream && pStream->GetLength()) { - int32_t nStreamLength = pStream->GetLength(); - bool bValid = true; - if (m_nLimit > 0 && nStreamLength > m_nLimit) { - bValid = false; - } - bool bPreIsCR = false; - if (bValid) { - int32_t nPos = pStream->GetBOMLength(); - pStream->Seek(CFX_SeekableStreamProxy::Pos::Begin, nPos); - int32_t nPlateSize = std::min(nStreamLength, m_pTxtBuf->GetChunkSize()); - wchar_t* lpwstr = FX_Alloc(wchar_t, nPlateSize); - bool bEos = false; - while (!bEos) { - int32_t nRead = pStream->ReadString(lpwstr, nPlateSize, &bEos); - bPreIsCR = ReplaceParagEnd(lpwstr, nRead, bPreIsCR); - m_pTxtBuf->Insert(nIndex, lpwstr, nRead); - nIndex += nRead; - } - FX_Free(lpwstr); - } - } - m_pTxtBuf->Insert(nIndex, &m_wLineEnd, 1); - RebuildParagraphs(); -} - void CFDE_TxtEdtEngine::SetText(const CFX_WideString& wsText) { ResetEngine(); int32_t nLength = wsText.GetLength(); @@ -258,7 +228,21 @@ CFX_WideString CFDE_TxtEdtEngine::GetText(int32_t nStart, } void CFDE_TxtEdtEngine::ClearText() { - DeleteRange(0, GetTextBufLength()); + if (IsLocked()) + return; + + int32_t len = GetTextBufLength(); + if (len == 0) + return; + if (m_Param.dwMode & FDE_TEXTEDITMODE_Validate) { + CFX_WideString wsText = GetPreDeleteText(0, len); + if (!m_Param.pEventSink->OnValidate(wsText)) + return; + } + + DeleteRange_DoRecord(0, len, false); + m_Param.pEventSink->OnTextChanged(m_ChangeInfo); + SetCaretPos(0, true); } int32_t CFDE_TxtEdtEngine::SetCaretPos(int32_t nIndex, bool bBefore) { @@ -488,62 +472,6 @@ int32_t CFDE_TxtEdtEngine::Delete(int32_t nStart, bool bBackspace) { return FDE_TXTEDT_MODIFY_RET_S_Normal; } -int32_t CFDE_TxtEdtEngine::DeleteRange(int32_t nStart, size_t nCount) { - if (IsLocked()) - return FDE_TXTEDT_MODIFY_RET_F_Locked; - if (nCount == 0) - return FDE_TXTEDT_MODIFY_RET_S_Normal; - if (m_Param.dwMode & FDE_TEXTEDITMODE_Validate) { - CFX_WideString wsText = GetPreDeleteText(nStart, nCount); - if (!m_Param.pEventSink->OnValidate(wsText)) - return FDE_TXTEDT_MODIFY_RET_F_Invalidate; - } - DeleteRange_DoRecord(nStart, nCount, false); - m_Param.pEventSink->OnTextChanged(m_ChangeInfo); - SetCaretPos(nStart, true); - return FDE_TXTEDT_MODIFY_RET_S_Normal; -} - -int32_t CFDE_TxtEdtEngine::Replace(int32_t nStart, - int32_t nLength, - const CFX_WideString& wsReplace) { - if (IsLocked()) - return FDE_TXTEDT_MODIFY_RET_F_Locked; - if (nStart < 0 || (nStart + nLength > GetTextBufLength())) - return FDE_TXTEDT_MODIFY_RET_F_Boundary; - if (m_Param.dwMode & FDE_TEXTEDITMODE_Validate) { - CFX_WideString wsText = GetPreReplaceText( - nStart, nLength, wsReplace.c_str(), wsReplace.GetLength()); - if (!m_Param.pEventSink->OnValidate(wsText)) - return FDE_TXTEDT_MODIFY_RET_F_Invalidate; - } - if (IsSelect()) - ClearSelection(); - - UpdateChangeInfoDelete(FDE_TXTEDT_TEXTCHANGE_TYPE_Replace, - GetText(nStart, nLength)); - if (nLength > 0) - Inner_DeleteRange(nStart, nLength); - - int32_t nTextLength = wsReplace.GetLength(); - if (nTextLength > 0) - Inner_Insert(nStart, wsReplace.c_str(), nTextLength); - - m_ChangeInfo.wsInsert = CFX_WideString(wsReplace.c_str(), nTextLength); - nStart += nTextLength; - wchar_t wChar = m_pTxtBuf->GetCharByIndex(nStart - 1); - bool bBefore = true; - if (wChar != L'\n' && wChar != L'\r') { - nStart--; - bBefore = false; - } - SetCaretPos(nStart, bBefore); - m_Param.pEventSink->OnPageUnload(m_nCaretPage); - m_Param.pEventSink->OnPageLoad(m_nCaretPage); - m_Param.pEventSink->OnTextChanged(m_ChangeInfo); - return FDE_TXTEDT_MODIFY_RET_S_Normal; -} - void CFDE_TxtEdtEngine::RemoveSelRange(int32_t nStart, int32_t nCount) { int32_t nRangeCount = pdfium::CollectionSize<int32_t>(m_SelRangePtrArr); for (int32_t i = 0; i < nRangeCount; i++) { diff --git a/xfa/fde/cfde_txtedtengine.h b/xfa/fde/cfde_txtedtengine.h index 56cf2edb4a..c68227b243 100644 --- a/xfa/fde/cfde_txtedtengine.h +++ b/xfa/fde/cfde_txtedtengine.h @@ -11,7 +11,6 @@ #include <vector> #include "core/fxcrt/cfx_retain_ptr.h" -#include "core/fxcrt/cfx_seekablestreamproxy.h" #include "core/fxcrt/fx_coordinates.h" #include "core/fxge/fx_dib.h" #include "xfa/fde/cfde_txtedtbuf.h" @@ -98,12 +97,8 @@ class CFDE_TxtEdtEngine { void SetEditParams(const FDE_TXTEDTPARAMS& params); FDE_TXTEDTPARAMS* GetEditParams() { return &m_Param; } - int32_t CountPages() const { - return m_nLineCount == 0 ? 0 : ((m_nLineCount - 1) / m_nPageLineCount) + 1; - } CFDE_TxtEdtPage* GetPage(int32_t nIndex); - void SetTextByStream(const CFX_RetainPtr<CFX_SeekableStreamProxy>& pStream); void SetText(const CFX_WideString& wsText); int32_t GetTextLength() const { return GetTextBufLength(); } CFX_WideString GetText(int32_t nStart, int32_t nCount) const; @@ -115,14 +110,9 @@ class CFDE_TxtEdtEngine { } int32_t SetCaretPos(int32_t nIndex, bool bBefore); int32_t MoveCaretPos(FDE_TXTEDTMOVECARET eMoveCaret, bool bShift, bool bCtrl); - bool IsLocked() const { return m_bLock; } int32_t Insert(int32_t nStart, const wchar_t* lpText, int32_t nLength); int32_t Delete(int32_t nStart, bool bBackspace); - int32_t DeleteRange(int32_t nStart, size_t nCount); - int32_t Replace(int32_t nStart, - int32_t nLength, - const CFX_WideString& wsReplace); void SetLimit(int32_t nLimit) { m_nLimit = nLimit; } int32_t GetLimit() const { return m_nLimit; } @@ -142,14 +132,12 @@ class CFDE_TxtEdtEngine { void Layout(); - int32_t CountParags() const { - return pdfium::CollectionSize<int32_t>(m_ParagPtrArray); - } CFDE_TxtEdtParag* GetParag(int32_t nParagIndex) const { return m_ParagPtrArray[nParagIndex].get(); } CFDE_TxtEdtBuf* GetTextBuf() const { return m_pTxtBuf.get(); } int32_t GetTextBufLength() const { return m_pTxtBuf->GetTextLength() - 1; } + CFX_TxtBreak* GetTextBreak() const { return m_pTextBreak.get(); } int32_t GetLineCount() const { return m_nLineCount; } int32_t GetPageLineCount() const { return m_nPageLineCount; } @@ -187,6 +175,12 @@ class CFDE_TxtEdtEngine { int32_t nCharIndex; }; + int32_t CountPages() const { + return m_nLineCount == 0 ? 0 : ((m_nLineCount - 1) / m_nPageLineCount) + 1; + } + + bool IsLocked() const { return m_bLock; } + CFX_WideString GetPreDeleteText(int32_t nIndex, int32_t nLength); CFX_WideString GetPreInsertText(int32_t nIndex, const wchar_t* lpText, diff --git a/xfa/fde/cfde_txtedtpage.cpp b/xfa/fde/cfde_txtedtpage.cpp index 0eb2acb727..e00d2daa79 100644 --- a/xfa/fde/cfde_txtedtpage.cpp +++ b/xfa/fde/cfde_txtedtpage.cpp @@ -121,29 +121,6 @@ int32_t CFDE_TxtEdtPage::GetCharIndex(const CFX_PointF& fPoint, bool& bBefore) { return nCaret; } -int32_t CFDE_TxtEdtPage::GetDisplayPos(const CFX_RectF& rtClip, - FXTEXT_CHARPOS*& pCharPos, - CFX_RectF* pBBox) const { - pCharPos = FX_Alloc(FXTEXT_CHARPOS, m_nCharCount); - int32_t nCharPosCount = 0; - FXTEXT_CHARPOS* pos = pCharPos; - for (const auto& piece : m_Pieces) { - if (!rtClip.IntersectWith(m_pTextSet->GetRect(piece))) - continue; - - int32_t nCount = m_pTextSet->GetDisplayPos(piece, pos); - nCharPosCount += nCount; - pos += nCount; - } - if ((nCharPosCount * 5) < (m_nCharCount << 2)) { - FXTEXT_CHARPOS* pTemp = FX_Alloc(FXTEXT_CHARPOS, nCharPosCount); - memcpy(pTemp, pCharPos, sizeof(FXTEXT_CHARPOS) * nCharPosCount); - FX_Free(pCharPos); - pCharPos = pTemp; - } - return nCharPosCount; -} - void CFDE_TxtEdtPage::CalcRangeRectArray( int32_t nStart, int32_t nCount, @@ -201,7 +178,7 @@ int32_t CFDE_TxtEdtPage::SelectWord(const CFX_PointF& fPoint, int32_t& nCount) { return pIter->GetWordPos(); } -int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox) { +int32_t CFDE_TxtEdtPage::LoadPage() { if (m_nRefCount > 0) { m_nRefCount++; return m_nRefCount; @@ -363,7 +340,7 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox) { return 0; } -void CFDE_TxtEdtPage::UnloadPage(const CFX_RectF* pClipBox) { +void CFDE_TxtEdtPage::UnloadPage() { ASSERT(m_nRefCount > 0); m_nRefCount--; if (m_nRefCount != 0) diff --git a/xfa/fde/cfde_txtedtpage.h b/xfa/fde/cfde_txtedtpage.h index 78814fb612..cdf6c55080 100644 --- a/xfa/fde/cfde_txtedtpage.h +++ b/xfa/fde/cfde_txtedtpage.h @@ -41,22 +41,23 @@ class CFDE_TxtEdtPage { CFDE_TxtEdtPage(CFDE_TxtEdtEngine* pEngine, int32_t nLineIndex); ~CFDE_TxtEdtPage(); - CFX_RectF GetRect(const FDE_TEXTEDITPIECE& pPiece) { return CFX_RectF(); } CFDE_TxtEdtEngine* GetEngine() const { return m_pEditEngine.Get(); } + int32_t GetCharRect(int32_t nIndex, CFX_RectF& rect, bool bBBox) const; int32_t GetCharIndex(const CFX_PointF& fPoint, bool& bBefore); + void CalcRangeRectArray(int32_t nStart, int32_t nCount, std::vector<CFX_RectF>* RectFArr) const; + int32_t SelectWord(const CFX_PointF& fPoint, int32_t& nCount); + int32_t GetCharStart() const { return m_nPageStart; } int32_t GetCharCount() const { return m_nCharCount; } - int32_t GetDisplayPos(const CFX_RectF& rtClip, - FXTEXT_CHARPOS*& pCharPos, - CFX_RectF* pBBox) const; - bool IsLoaded(const CFX_RectF* pClipBox) { return m_bLoaded; } - int32_t LoadPage(const CFX_RectF* pClipBox); - void UnloadPage(const CFX_RectF* pClipBox); + + int32_t LoadPage(); + void UnloadPage(); + const CFX_RectF& GetContentsBox() { return m_rtPageContents; } size_t GetTextPieceCount() const { return m_pTextSet ? m_Pieces.size() : 0; } diff --git a/xfa/fde/cfde_txtedtparag.h b/xfa/fde/cfde_txtedtparag.h index 4521f3be0c..becfb61070 100644 --- a/xfa/fde/cfde_txtedtparag.h +++ b/xfa/fde/cfde_txtedtparag.h @@ -9,6 +9,8 @@ #include <stdint.h> +#include "core/fxcrt/cfx_unowned_ptr.h" + class CFDE_TxtEdtEngine; class CFDE_TxtEdtParag { @@ -37,7 +39,7 @@ class CFDE_TxtEdtParag { int32_t m_nCharCount; int32_t m_nLineCount; int32_t* m_lpData; - CFDE_TxtEdtEngine* m_pEngine; + CFX_UnownedPtr<CFDE_TxtEdtEngine> m_pEngine; }; #endif // XFA_FDE_CFDE_TXTEDTPARAG_H_ diff --git a/xfa/fde/cfde_txtedttextset.cpp b/xfa/fde/cfde_txtedttextset.cpp index 79d6dd99c8..fce52d3278 100644 --- a/xfa/fde/cfde_txtedttextset.cpp +++ b/xfa/fde/cfde_txtedttextset.cpp @@ -15,28 +15,6 @@ CFDE_TxtEdtTextSet::CFDE_TxtEdtTextSet(CFDE_TxtEdtPage* pPage) CFDE_TxtEdtTextSet::~CFDE_TxtEdtTextSet() {} -int32_t CFDE_TxtEdtTextSet::GetString(FDE_TEXTEDITPIECE* pPiece, - CFX_WideString& wsText) const { - wchar_t* pBuffer = wsText.GetBuffer(pPiece->nCount); - for (int32_t i = 0; i < pPiece->nCount; i++) - pBuffer[i] = m_pPage->GetChar(pPiece, i); - - wsText.ReleaseBuffer(pPiece->nCount); - return pPiece->nCount; -} - -CFX_RetainPtr<CFGAS_GEFont> CFDE_TxtEdtTextSet::GetFont() const { - return m_pPage->GetEngine()->GetEditParams()->pFont; -} - -float CFDE_TxtEdtTextSet::GetFontSize() const { - return m_pPage->GetEngine()->GetEditParams()->fFontSize; -} - -FX_ARGB CFDE_TxtEdtTextSet::GetFontColor() const { - return m_pPage->GetEngine()->GetEditParams()->dwFontColor; -} - int32_t CFDE_TxtEdtTextSet::GetDisplayPos(const FDE_TEXTEDITPIECE& piece, FXTEXT_CHARPOS* pCharPos) const { int32_t nLength = piece.nCount; diff --git a/xfa/fde/cfde_txtedttextset.h b/xfa/fde/cfde_txtedttextset.h index afaf22a719..4fbf2ac649 100644 --- a/xfa/fde/cfde_txtedttextset.h +++ b/xfa/fde/cfde_txtedttextset.h @@ -21,10 +21,6 @@ class CFDE_TxtEdtTextSet { CFX_RectF GetRect(const FDE_TEXTEDITPIECE& pPiece) const { return pPiece.rtPiece; } - int32_t GetString(FDE_TEXTEDITPIECE* pPiece, CFX_WideString& wsText) const; - CFX_RetainPtr<CFGAS_GEFont> GetFont() const; - float GetFontSize() const; - FX_ARGB GetFontColor() const; int32_t GetDisplayPos(const FDE_TEXTEDITPIECE& pPiece, FXTEXT_CHARPOS* pCharPos) const; std::vector<CFX_RectF> GetCharRects(const FDE_TEXTEDITPIECE* pPiece, diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp index 18fbd33b39..7dd8baded8 100644 --- a/xfa/fwl/cfwl_edit.cpp +++ b/xfa/fwl/cfwl_edit.cpp @@ -433,7 +433,7 @@ bool CFWL_Edit::OnPageLoad(int32_t nPageIndex) { if (!pPage) return false; - pPage->LoadPage(nullptr); + pPage->LoadPage(); return true; } @@ -442,7 +442,7 @@ bool CFWL_Edit::OnPageUnload(int32_t nPageIndex) { if (!pPage) return false; - pPage->UnloadPage(nullptr); + pPage->UnloadPage(); return true; } @@ -595,7 +595,12 @@ void CFWL_Edit::RenderText(CFX_RenderDevice* pRenderDev, if (!pTextSet) return; - CFX_RetainPtr<CFGAS_GEFont> pFont = pTextSet->GetFont(); + CFDE_TxtEdtEngine* engine = pPage.GetEngine(); + ASSERT(engine); + const FDE_TXTEDTPARAMS* params = engine->GetEditParams(); + ASSERT(params); + + CFX_RetainPtr<CFGAS_GEFont> pFont = params->pFont; if (!pFont) return; @@ -623,9 +628,8 @@ void CFWL_Edit::RenderText(CFX_RenderDevice* pRenderDev, char_pos.resize(iCount, FXTEXT_CHARPOS()); iCount = pTextSet->GetDisplayPos(pText, char_pos.data()); - CFDE_TextOut::DrawString(pRenderDev, pTextSet->GetFontColor(), pFont, - char_pos.data(), iCount, pTextSet->GetFontSize(), - &mt); + CFDE_TextOut::DrawString(pRenderDev, params->dwFontColor, pFont, + char_pos.data(), iCount, params->fFontSize, &mt); } } @@ -719,17 +723,17 @@ void CFWL_Edit::UpdateEditParams() { void CFWL_Edit::UpdateEditLayout() { if (m_EdtEngine.GetTextLength() <= 0) - m_EdtEngine.SetTextByStream(nullptr); + m_EdtEngine.SetText(L""); CFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0); if (pPage) - pPage->UnloadPage(nullptr); + pPage->UnloadPage(); m_EdtEngine.Layout(); pPage = m_EdtEngine.GetPage(0); if (pPage) - pPage->LoadPage(nullptr); + pPage->LoadPage(); } bool CFWL_Edit::UpdateOffset() { |