summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fde/cfde_rendercontext.cpp86
-rw-r--r--xfa/fde/cfde_rendercontext.h19
-rw-r--r--xfa/fde/cfde_txtedtpage.cpp28
-rw-r--r--xfa/fde/cfde_txtedtpage.h35
-rw-r--r--xfa/fde/cfde_txtedttextset.cpp19
-rw-r--r--xfa/fde/cfde_txtedttextset.h27
-rw-r--r--xfa/fde/cfde_visualsetiterator.cpp86
-rw-r--r--xfa/fde/cfde_visualsetiterator.h40
-rw-r--r--xfa/fde/ifde_visualset.h47
-rw-r--r--xfa/fwl/cfwl_edit.cpp9
10 files changed, 88 insertions, 308 deletions
diff --git a/xfa/fde/cfde_rendercontext.cpp b/xfa/fde/cfde_rendercontext.cpp
index 284de5daa2..0b44cb4a27 100644
--- a/xfa/fde/cfde_rendercontext.cpp
+++ b/xfa/fde/cfde_rendercontext.cpp
@@ -6,80 +6,56 @@
#include "xfa/fde/cfde_rendercontext.h"
+#include <vector>
+
#include "third_party/base/logging.h"
#include "third_party/base/ptr_util.h"
#include "xfa/fde/cfde_renderdevice.h"
+#include "xfa/fde/cfde_txtedtpage.h"
#include "xfa/fde/cfde_txtedttextset.h"
-CFDE_RenderContext::CFDE_RenderContext()
- : m_pRenderDevice(nullptr), m_Transform() {
- m_Transform.SetIdentity();
-}
+CFDE_RenderContext::CFDE_RenderContext(CFDE_RenderDevice* pRenderDevice)
+ : m_pRenderDevice(pRenderDevice) {}
CFDE_RenderContext::~CFDE_RenderContext() {}
-void CFDE_RenderContext::StartRender(CFDE_RenderDevice* pRenderDevice,
- CFDE_TxtEdtPage* pCanvasSet,
- const CFX_Matrix& tmDoc2Device) {
- if (m_pRenderDevice || !pRenderDevice || !pCanvasSet)
+void CFDE_RenderContext::Render(CFDE_TxtEdtPage* pCanvasSet,
+ const CFX_Matrix& tmDoc2Device) {
+ if (!m_pRenderDevice || !pCanvasSet)
return;
- m_pRenderDevice = pRenderDevice;
- m_Transform = tmDoc2Device;
- if (!m_pIterator)
- m_pIterator = pdfium::MakeUnique<CFDE_VisualSetIterator>();
- if (m_pIterator->AttachCanvas(pCanvasSet))
- m_pIterator->FilterObjects();
-}
+ CFDE_TxtEdtTextSet* pVisualSet = pCanvasSet->GetTextSet();
+ if (!pVisualSet)
+ return;
-void CFDE_RenderContext::DoRender() {
- if (!m_pRenderDevice || !m_pIterator)
+ CFX_RetainPtr<CFGAS_GEFont> pFont = pVisualSet->GetFont();
+ if (!pFont)
return;
CFX_RectF rtDocClip = m_pRenderDevice->GetClipRect();
if (rtDocClip.IsEmpty()) {
rtDocClip.left = rtDocClip.top = 0;
- rtDocClip.width = (float)m_pRenderDevice->GetWidth();
- rtDocClip.height = (float)m_pRenderDevice->GetHeight();
+ rtDocClip.width = static_cast<float>(m_pRenderDevice->GetWidth());
+ rtDocClip.height = static_cast<float>(m_pRenderDevice->GetHeight());
}
- m_Transform.GetInverse().TransformRect(rtDocClip);
- IFDE_VisualSet* pVisualSet;
- FDE_TEXTEDITPIECE* pPiece;
- int32_t iCount = 0;
- while (true) {
- pPiece = m_pIterator->GetNext(pVisualSet);
- if (!pPiece || !pVisualSet)
- return;
- if (!rtDocClip.IntersectWith(pVisualSet->GetRect(*pPiece)))
- continue;
+ tmDoc2Device.GetInverse().TransformRect(rtDocClip);
- switch (pVisualSet->GetType()) {
- case FDE_VISUALOBJ_Text:
- RenderText(static_cast<CFDE_TxtEdtTextSet*>(pVisualSet), pPiece);
- iCount += 5;
- break;
- default:
- break;
- }
- }
-}
+ std::vector<FXTEXT_CHARPOS> char_pos;
-void CFDE_RenderContext::RenderText(CFDE_TxtEdtTextSet* pTextSet,
- FDE_TEXTEDITPIECE* pText) {
- ASSERT(m_pRenderDevice);
- ASSERT(pTextSet && pText);
-
- CFX_RetainPtr<CFGAS_GEFont> pFont = pTextSet->GetFont();
- if (!pFont)
- return;
+ for (size_t i = 0; i < pCanvasSet->GetTextPieceCount(); ++i) {
+ const FDE_TEXTEDITPIECE& pText = pCanvasSet->GetTextPiece(i);
+ if (!rtDocClip.IntersectWith(pVisualSet->GetRect(pText)))
+ continue;
- int32_t iCount = pTextSet->GetDisplayPos(*pText, nullptr, false);
- if (iCount < 1)
- return;
- if (m_CharPos.size() < static_cast<size_t>(iCount))
- m_CharPos.resize(iCount, FXTEXT_CHARPOS());
+ int32_t iCount = pVisualSet->GetDisplayPos(pText, nullptr, false);
+ if (iCount < 1)
+ continue;
+ if (char_pos.size() < static_cast<size_t>(iCount))
+ char_pos.resize(iCount, FXTEXT_CHARPOS());
- iCount = pTextSet->GetDisplayPos(*pText, m_CharPos.data(), false);
- m_pRenderDevice->DrawString(pTextSet->GetFontColor(), pFont, m_CharPos.data(),
- iCount, pTextSet->GetFontSize(), &m_Transform);
+ iCount = pVisualSet->GetDisplayPos(pText, char_pos.data(), false);
+ m_pRenderDevice->DrawString(pVisualSet->GetFontColor(), pFont,
+ char_pos.data(), iCount,
+ pVisualSet->GetFontSize(), &tmDoc2Device);
+ }
}
diff --git a/xfa/fde/cfde_rendercontext.h b/xfa/fde/cfde_rendercontext.h
index 3823255e95..6be77c6453 100644
--- a/xfa/fde/cfde_rendercontext.h
+++ b/xfa/fde/cfde_rendercontext.h
@@ -7,34 +7,21 @@
#ifndef XFA_FDE_CFDE_RENDERCONTEXT_H_
#define XFA_FDE_CFDE_RENDERCONTEXT_H_
-#include <memory>
-#include <vector>
-
#include "core/fxcrt/fx_coordinates.h"
-#include "xfa/fde/cfde_renderdevice.h"
-#include "xfa/fde/cfde_visualsetiterator.h"
-#include "xfa/fde/ifde_visualset.h"
class CFDE_RenderDevice;
+class CFDE_TxtEdtPage;
class CFDE_TxtEdtTextSet;
class CFDE_RenderContext {
public:
- CFDE_RenderContext();
+ explicit CFDE_RenderContext(CFDE_RenderDevice* pRenderDevice);
~CFDE_RenderContext();
- void StartRender(CFDE_RenderDevice* pRenderDevice,
- CFDE_TxtEdtPage* pCanvasSet,
- const CFX_Matrix& tmDoc2Device);
- void DoRender();
+ void Render(CFDE_TxtEdtPage* pCanvasSet, const CFX_Matrix& tmDoc2Device);
private:
- void RenderText(CFDE_TxtEdtTextSet* pTextSet, FDE_TEXTEDITPIECE* pText);
-
CFDE_RenderDevice* m_pRenderDevice;
- CFX_Matrix m_Transform;
- std::vector<FXTEXT_CHARPOS> m_CharPos;
- std::unique_ptr<CFDE_VisualSetIterator> m_pIterator;
};
#endif // XFA_FDE_CFDE_RENDERCONTEXT_H_
diff --git a/xfa/fde/cfde_txtedtpage.cpp b/xfa/fde/cfde_txtedtpage.cpp
index 5008ca15ce..bfe30baa19 100644
--- a/xfa/fde/cfde_txtedtpage.cpp
+++ b/xfa/fde/cfde_txtedtpage.cpp
@@ -40,10 +40,6 @@ CFDE_TxtEdtEngine* CFDE_TxtEdtPage::GetEngine() const {
return m_pEditEngine.Get();
}
-FDE_VISUALOBJTYPE CFDE_TxtEdtPage::GetType() {
- return FDE_VISUALOBJ_Text;
-}
-
CFX_RectF CFDE_TxtEdtPage::GetRect(const FDE_TEXTEDITPIECE& hVisualObj) {
return CFX_RectF();
}
@@ -411,27 +407,13 @@ const CFX_RectF& CFDE_TxtEdtPage::GetContentsBox() {
return m_rtPageContents;
}
-size_t CFDE_TxtEdtPage::GetFirstPosition() {
- return m_Pieces.empty() ? 0 : 1;
+size_t CFDE_TxtEdtPage::GetTextPieceCount() const {
+ return m_pTextSet ? m_Pieces.size() : 0;
}
-FDE_TEXTEDITPIECE* CFDE_TxtEdtPage::GetNext(size_t* pos,
- IFDE_VisualSet*& pVisualSet) {
- ASSERT(pos);
-
- if (!m_pTextSet) {
- *pos = 0;
- return nullptr;
- }
-
- size_t nPos = *pos;
- pVisualSet = m_pTextSet.get();
- if (nPos + 1 > m_Pieces.size())
- *pos = 0;
- else
- *pos = nPos + 1;
-
- return &m_Pieces[nPos - 1];
+const FDE_TEXTEDITPIECE& CFDE_TxtEdtPage::GetTextPiece(size_t pos) const {
+ ASSERT(pos < m_Pieces.size());
+ return m_Pieces[pos];
}
wchar_t CFDE_TxtEdtPage::GetChar(const FDE_TEXTEDITPIECE* pIdentity,
diff --git a/xfa/fde/cfde_txtedtpage.h b/xfa/fde/cfde_txtedtpage.h
index aa88801ba7..c118fe2fee 100644
--- a/xfa/fde/cfde_txtedtpage.h
+++ b/xfa/fde/cfde_txtedtpage.h
@@ -11,22 +11,37 @@
#include <memory>
#include <vector>
+#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/ifx_chariter.h"
-#include "xfa/fde/ifde_visualset.h"
+#include "core/fxge/cfx_renderdevice.h"
class CFDE_TxtEdtEngine;
class CFDE_TxtEdtParag;
class CFDE_TxtEdtTextSet;
-class CFDE_TxtEdtPage : public IFDE_VisualSet {
+struct FDE_TEXTEDITPIECE {
+ FDE_TEXTEDITPIECE();
+ FDE_TEXTEDITPIECE(const FDE_TEXTEDITPIECE& that);
+ ~FDE_TEXTEDITPIECE();
+
+ int32_t nStart;
+ int32_t nCount;
+ int32_t nBidiLevel;
+ CFX_RectF rtPiece;
+ uint32_t dwCharStyles;
+};
+
+inline FDE_TEXTEDITPIECE::FDE_TEXTEDITPIECE() = default;
+inline FDE_TEXTEDITPIECE::FDE_TEXTEDITPIECE(const FDE_TEXTEDITPIECE& that) =
+ default;
+inline FDE_TEXTEDITPIECE::~FDE_TEXTEDITPIECE() = default;
+
+class CFDE_TxtEdtPage {
public:
CFDE_TxtEdtPage(CFDE_TxtEdtEngine* pEngine, int32_t nLineIndex);
- ~CFDE_TxtEdtPage() override;
-
- // IFDE_VisualSet:
- FDE_VISUALOBJTYPE GetType() override;
- CFX_RectF GetRect(const FDE_TEXTEDITPIECE& pPiece) override;
+ ~CFDE_TxtEdtPage();
+ CFX_RectF GetRect(const FDE_TEXTEDITPIECE& pPiece);
CFDE_TxtEdtEngine* GetEngine() const;
int32_t GetCharRect(int32_t nIndex,
CFX_RectF& rect,
@@ -46,12 +61,14 @@ class CFDE_TxtEdtPage : public IFDE_VisualSet {
void UnloadPage(const CFX_RectF* pClipBox);
const CFX_RectF& GetContentsBox();
- size_t GetFirstPosition();
- FDE_TEXTEDITPIECE* GetNext(size_t* pos, IFDE_VisualSet*& pVisualSet);
+ size_t GetTextPieceCount() const;
+ const FDE_TEXTEDITPIECE& GetTextPiece(size_t pos) const;
wchar_t GetChar(const FDE_TEXTEDITPIECE* pIdentity, int32_t index) const;
int32_t GetWidth(const FDE_TEXTEDITPIECE* pIdentity, int32_t index) const;
+ CFDE_TxtEdtTextSet* GetTextSet() const { return m_pTextSet.get(); }
+
private:
void NormalizePt2Rect(CFX_PointF& ptF,
const CFX_RectF& rtF,
diff --git a/xfa/fde/cfde_txtedttextset.cpp b/xfa/fde/cfde_txtedttextset.cpp
index 0785754e1f..54fedda6a2 100644
--- a/xfa/fde/cfde_txtedttextset.cpp
+++ b/xfa/fde/cfde_txtedttextset.cpp
@@ -7,7 +7,6 @@
#include "xfa/fde/cfde_txtedttextset.h"
#include "xfa/fde/cfde_txtedtengine.h"
-#include "xfa/fde/cfde_txtedtpage.h"
#include "xfa/fgas/font/cfgas_gefont.h"
#include "xfa/fgas/layout/cfx_txtbreak.h"
@@ -16,16 +15,12 @@ CFDE_TxtEdtTextSet::CFDE_TxtEdtTextSet(CFDE_TxtEdtPage* pPage)
CFDE_TxtEdtTextSet::~CFDE_TxtEdtTextSet() {}
-FDE_VISUALOBJTYPE CFDE_TxtEdtTextSet::GetType() {
- return FDE_VISUALOBJ_Text;
-}
-
-CFX_RectF CFDE_TxtEdtTextSet::GetRect(const FDE_TEXTEDITPIECE& pPiece) {
+CFX_RectF CFDE_TxtEdtTextSet::GetRect(const FDE_TEXTEDITPIECE& pPiece) const {
return pPiece.rtPiece;
}
int32_t CFDE_TxtEdtTextSet::GetString(FDE_TEXTEDITPIECE* pPiece,
- CFX_WideString& wsText) {
+ 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);
@@ -34,22 +29,22 @@ int32_t CFDE_TxtEdtTextSet::GetString(FDE_TEXTEDITPIECE* pPiece,
return pPiece->nCount;
}
-CFX_RetainPtr<CFGAS_GEFont> CFDE_TxtEdtTextSet::GetFont() {
+CFX_RetainPtr<CFGAS_GEFont> CFDE_TxtEdtTextSet::GetFont() const {
return m_pPage->GetEngine()->GetEditParams()->pFont;
}
-float CFDE_TxtEdtTextSet::GetFontSize() {
+float CFDE_TxtEdtTextSet::GetFontSize() const {
return m_pPage->GetEngine()->GetEditParams()->fFontSize;
}
-FX_ARGB CFDE_TxtEdtTextSet::GetFontColor() {
+FX_ARGB CFDE_TxtEdtTextSet::GetFontColor() const {
return m_pPage->GetEngine()->GetEditParams()->dwFontColor;
}
int32_t CFDE_TxtEdtTextSet::GetDisplayPos(const FDE_TEXTEDITPIECE& piece,
FXTEXT_CHARPOS* pCharPos,
bool bCharCode,
- CFX_WideString* pWSForms) {
+ CFX_WideString* pWSForms) const {
int32_t nLength = piece.nCount;
if (nLength < 1)
return 0;
@@ -74,7 +69,7 @@ int32_t CFDE_TxtEdtTextSet::GetDisplayPos(const FDE_TEXTEDITPIECE& piece,
std::vector<CFX_RectF> CFDE_TxtEdtTextSet::GetCharRects(
const FDE_TEXTEDITPIECE* pPiece,
- bool bBBox) {
+ bool bBBox) const {
if (!pPiece || pPiece->nCount < 1)
return std::vector<CFX_RectF>();
diff --git a/xfa/fde/cfde_txtedttextset.h b/xfa/fde/cfde_txtedttextset.h
index 29303373da..71e1169dfb 100644
--- a/xfa/fde/cfde_txtedttextset.h
+++ b/xfa/fde/cfde_txtedttextset.h
@@ -9,29 +9,26 @@
#include <vector>
-#include "xfa/fde/ifde_visualset.h"
+#include "core/fxcrt/fx_coordinates.h"
+#include "xfa/fde/cfde_txtedtpage.h"
+#include "xfa/fgas/font/cfgas_gefont.h"
-class CFDE_TxtEdtPage;
-
-class CFDE_TxtEdtTextSet : public IFDE_VisualSet {
+class CFDE_TxtEdtTextSet {
public:
explicit CFDE_TxtEdtTextSet(CFDE_TxtEdtPage* pPage);
- ~CFDE_TxtEdtTextSet() override;
-
- // IFDE_VisualSet
- FDE_VISUALOBJTYPE GetType() override;
- CFX_RectF GetRect(const FDE_TEXTEDITPIECE& hVisualObj) override;
+ ~CFDE_TxtEdtTextSet();
- int32_t GetString(FDE_TEXTEDITPIECE* pPiece, CFX_WideString& wsText);
- CFX_RetainPtr<CFGAS_GEFont> GetFont();
- float GetFontSize();
- FX_ARGB GetFontColor();
+ CFX_RectF GetRect(const FDE_TEXTEDITPIECE& hVisualObj) const;
+ 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,
bool bCharCode = false,
- CFX_WideString* pWSForms = nullptr);
+ CFX_WideString* pWSForms = nullptr) const;
std::vector<CFX_RectF> GetCharRects(const FDE_TEXTEDITPIECE* pPiece,
- bool bBBox);
+ bool bBBox) const;
private:
CFX_UnownedPtr<CFDE_TxtEdtPage> const m_pPage;
diff --git a/xfa/fde/cfde_visualsetiterator.cpp b/xfa/fde/cfde_visualsetiterator.cpp
deleted file mode 100644
index d5b6b1bfe7..0000000000
--- a/xfa/fde/cfde_visualsetiterator.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "xfa/fde/cfde_visualsetiterator.h"
-
-#include "xfa/fde/cfde_txtedtpage.h"
-
-CFDE_VisualSetIterator::CFDE_VisualSetIterator() : m_dwFilter(0) {}
-
-CFDE_VisualSetIterator::~CFDE_VisualSetIterator() {}
-
-bool CFDE_VisualSetIterator::AttachCanvas(CFDE_TxtEdtPage* pCanvas) {
- ASSERT(pCanvas);
- m_CanvasStack = std::stack<FDE_CANVASITEM>();
-
- FDE_CANVASITEM canvas;
- canvas.hCanvas = nullptr;
- canvas.pCanvas = pCanvas;
- canvas.pos = pCanvas->GetFirstPosition();
- if (canvas.pos == 0)
- return false;
-
- m_CanvasStack.push(canvas);
- return true;
-}
-
-bool CFDE_VisualSetIterator::FilterObjects(uint32_t dwObjects) {
- if (m_CanvasStack.empty())
- return false;
-
- while (m_CanvasStack.size() > 1)
- m_CanvasStack.pop();
-
- m_dwFilter = dwObjects;
-
- FDE_CANVASITEM* pCanvas = &m_CanvasStack.top();
- ASSERT(pCanvas && pCanvas->pCanvas);
-
- pCanvas->pos = pCanvas->pCanvas->GetFirstPosition();
- return pCanvas->pos != 0;
-}
-
-void CFDE_VisualSetIterator::Reset() {
- FilterObjects(m_dwFilter);
-}
-
-FDE_TEXTEDITPIECE* CFDE_VisualSetIterator::GetNext(
- IFDE_VisualSet*& pVisualSet,
- FDE_TEXTEDITPIECE** phCanvasObj,
- CFDE_TxtEdtPage** ppCanvasSet) {
- while (!m_CanvasStack.empty()) {
- FDE_CANVASITEM* pCanvas = &m_CanvasStack.top();
- if (pCanvas->pos == 0) {
- if (m_CanvasStack.size() == 1)
- break;
-
- m_CanvasStack.pop();
- continue;
- }
- do {
- FDE_TEXTEDITPIECE* pObj =
- pCanvas->pCanvas->GetNext(&pCanvas->pos, pVisualSet);
- ASSERT(pObj);
-
- FDE_VISUALOBJTYPE eType = pVisualSet->GetType();
- uint32_t dwObj = (uint32_t)eType;
- if ((m_dwFilter & dwObj) != 0) {
- if (ppCanvasSet)
- *ppCanvasSet = pCanvas->pCanvas;
- if (phCanvasObj)
- *phCanvasObj = pCanvas->hCanvas;
- return pObj;
- }
- } while (pCanvas->pos != 0);
- }
- if (ppCanvasSet)
- *ppCanvasSet = nullptr;
- if (phCanvasObj)
- *phCanvasObj = nullptr;
-
- pVisualSet = nullptr;
- return nullptr;
-}
diff --git a/xfa/fde/cfde_visualsetiterator.h b/xfa/fde/cfde_visualsetiterator.h
deleted file mode 100644
index a8e311aafb..0000000000
--- a/xfa/fde/cfde_visualsetiterator.h
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FDE_CFDE_VISUALSETITERATOR_H_
-#define XFA_FDE_CFDE_VISUALSETITERATOR_H_
-
-#include <stack>
-
-#include "xfa/fde/ifde_visualset.h"
-
-class CFDE_TxtEdtPage;
-
-struct FDE_CANVASITEM {
- CFDE_TxtEdtPage* pCanvas;
- FDE_TEXTEDITPIECE* hCanvas;
- size_t pos;
-};
-
-class CFDE_VisualSetIterator {
- public:
- CFDE_VisualSetIterator();
- ~CFDE_VisualSetIterator();
-
- bool AttachCanvas(CFDE_TxtEdtPage* pCanvas);
- bool FilterObjects(uint32_t dwObjects = 0xFFFFFFFF);
-
- void Reset();
- FDE_TEXTEDITPIECE* GetNext(IFDE_VisualSet*& pVisualSet,
- FDE_TEXTEDITPIECE** phCanvasObj = nullptr,
- CFDE_TxtEdtPage** ppCanvasSet = nullptr);
-
- protected:
- uint32_t m_dwFilter;
- std::stack<FDE_CANVASITEM> m_CanvasStack;
-};
-
-#endif // XFA_FDE_CFDE_VISUALSETITERATOR_H_
diff --git a/xfa/fde/ifde_visualset.h b/xfa/fde/ifde_visualset.h
deleted file mode 100644
index 4f9e932657..0000000000
--- a/xfa/fde/ifde_visualset.h
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FDE_IFDE_VISUALSET_H_
-#define XFA_FDE_IFDE_VISUALSET_H_
-
-#include <vector>
-
-#include "core/fxcrt/cfx_retain_ptr.h"
-#include "core/fxcrt/fx_coordinates.h"
-#include "core/fxcrt/fx_system.h"
-#include "core/fxge/fx_dib.h"
-#include "xfa/fgas/font/cfgas_fontmgr.h"
-
-class FXTEXT_CHARPOS;
-
-enum FDE_VISUALOBJTYPE {
- FDE_VISUALOBJ_Text = 0x01
-};
-
-struct FDE_TEXTEDITPIECE {
- FDE_TEXTEDITPIECE();
- FDE_TEXTEDITPIECE(const FDE_TEXTEDITPIECE& that);
- ~FDE_TEXTEDITPIECE();
-
- int32_t nStart;
- int32_t nCount;
- int32_t nBidiLevel;
- CFX_RectF rtPiece;
- uint32_t dwCharStyles;
-};
-inline FDE_TEXTEDITPIECE::FDE_TEXTEDITPIECE() = default;
-inline FDE_TEXTEDITPIECE::FDE_TEXTEDITPIECE(const FDE_TEXTEDITPIECE& that) =
- default;
-inline FDE_TEXTEDITPIECE::~FDE_TEXTEDITPIECE() = default;
-
-class IFDE_VisualSet {
- public:
- virtual ~IFDE_VisualSet() {}
- virtual FDE_VISUALOBJTYPE GetType() = 0;
- virtual CFX_RectF GetRect(const FDE_TEXTEDITPIECE& hVisualObj) = 0;
-};
-
-#endif // XFA_FDE_IFDE_VISUALSET_H_
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp
index a261041534..fe4b9dad0c 100644
--- a/xfa/fwl/cfwl_edit.cpp
+++ b/xfa/fwl/cfwl_edit.cpp
@@ -567,12 +567,11 @@ void CFWL_Edit::DrawContent(CXFA_Graphics* pGraphics,
if (!pRenderDev)
return;
- auto pRenderDevice = pdfium::MakeUnique<CFDE_RenderDevice>(pRenderDev);
- pRenderDevice->SetClipRect(rtClip);
+ CFDE_RenderDevice renderDevice(pRenderDev);
+ renderDevice.SetClipRect(rtClip);
- auto pRenderContext = pdfium::MakeUnique<CFDE_RenderContext>();
- pRenderContext->StartRender(pRenderDevice.get(), pPage, mt);
- pRenderContext->DoRender();
+ CFDE_RenderContext renderContext(&renderDevice);
+ renderContext.Render(pPage, mt);
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_CombText) {
pGraphics->RestoreGraphState();