| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #ifndef XFA_FXFA_APP_XFA_TEXTLAYOUT_H_ | 7 #ifndef XFA_FXFA_APP_XFA_TEXTLAYOUT_H_ |
| 8 #define XFA_FXFA_APP_XFA_TEXTLAYOUT_H_ | 8 #define XFA_FXFA_APP_XFA_TEXTLAYOUT_H_ |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 int32_t m_iLines; | 164 int32_t m_iLines; |
| 165 int32_t m_iTotalLines; | 165 int32_t m_iTotalLines; |
| 166 CFDE_XMLNode* m_pXMLNode; | 166 CFDE_XMLNode* m_pXMLNode; |
| 167 CXFA_Node* m_pNode; | 167 CXFA_Node* m_pNode; |
| 168 IFDE_CSSComputedStyle* m_pParentStyle; | 168 IFDE_CSSComputedStyle* m_pParentStyle; |
| 169 CFX_ArrayTemplate<FX_FLOAT> m_lineHeights; | 169 CFX_ArrayTemplate<FX_FLOAT> m_lineHeights; |
| 170 uint32_t m_dwFlags; | 170 uint32_t m_dwFlags; |
| 171 CFX_FloatArray m_BlocksHeight; | 171 CFX_FloatArray m_BlocksHeight; |
| 172 }; | 172 }; |
| 173 | 173 |
| 174 class CXFA_LinkUserData : public IFX_Unknown, public CFX_Target { | 174 class CXFA_LinkUserData : public IFX_Retainable, public CFX_Target { |
| 175 public: | 175 public: |
| 176 CXFA_LinkUserData(IFX_MemoryAllocator* pAllocator, FX_WCHAR* pszText) | 176 CXFA_LinkUserData(IFX_MemoryAllocator* pAllocator, FX_WCHAR* pszText) |
| 177 : m_pAllocator(pAllocator), m_dwRefCount(1), m_wsURLContent(pszText) {} | 177 : m_pAllocator(pAllocator), m_dwRefCount(1), m_wsURLContent(pszText) {} |
| 178 | 178 |
| 179 ~CXFA_LinkUserData() override {} | 179 ~CXFA_LinkUserData() override {} |
| 180 | 180 |
| 181 uint32_t AddRef() override { return ++m_dwRefCount; } | 181 // IFX_Retainable: |
| 182 uint32_t Retain() override { return ++m_dwRefCount; } |
| 182 uint32_t Release() override { | 183 uint32_t Release() override { |
| 183 uint32_t dwRefCount = --m_dwRefCount; | 184 uint32_t dwRefCount = --m_dwRefCount; |
| 184 if (dwRefCount <= 0) | 185 if (dwRefCount <= 0) |
| 185 FXTARGET_DeleteWith(CXFA_LinkUserData, m_pAllocator, this); | 186 FXTARGET_DeleteWith(CXFA_LinkUserData, m_pAllocator, this); |
| 186 return dwRefCount; | 187 return dwRefCount; |
| 187 } | 188 } |
| 188 | 189 |
| 189 const FX_WCHAR* GetLinkURL() { return m_wsURLContent.c_str(); } | 190 const FX_WCHAR* GetLinkURL() { return m_wsURLContent.c_str(); } |
| 190 | 191 |
| 191 protected: | 192 protected: |
| 192 IFX_MemoryAllocator* m_pAllocator; | 193 IFX_MemoryAllocator* m_pAllocator; |
| 193 uint32_t m_dwRefCount; | 194 uint32_t m_dwRefCount; |
| 194 CFX_WideString m_wsURLContent; | 195 CFX_WideString m_wsURLContent; |
| 195 }; | 196 }; |
| 196 | 197 |
| 197 class CXFA_TextUserData : public IFX_Unknown, public CFX_Target { | 198 class CXFA_TextUserData : public IFX_Retainable, public CFX_Target { |
| 198 public: | 199 public: |
| 199 CXFA_TextUserData(IFX_MemoryAllocator* pAllocator, | 200 CXFA_TextUserData(IFX_MemoryAllocator* pAllocator, |
| 200 IFDE_CSSComputedStyle* pStyle) | 201 IFDE_CSSComputedStyle* pStyle) |
| 201 : m_pStyle(pStyle), | 202 : m_pStyle(pStyle), |
| 202 m_pLinkData(nullptr), | 203 m_pLinkData(nullptr), |
| 203 m_pAllocator(pAllocator), | 204 m_pAllocator(pAllocator), |
| 204 m_dwRefCount(0) { | 205 m_dwRefCount(0) { |
| 205 ASSERT(m_pAllocator); | 206 ASSERT(m_pAllocator); |
| 206 if (m_pStyle) | 207 if (m_pStyle) |
| 207 m_pStyle->AddRef(); | 208 m_pStyle->Retain(); |
| 208 } | 209 } |
| 209 CXFA_TextUserData(IFX_MemoryAllocator* pAllocator, | 210 CXFA_TextUserData(IFX_MemoryAllocator* pAllocator, |
| 210 IFDE_CSSComputedStyle* pStyle, | 211 IFDE_CSSComputedStyle* pStyle, |
| 211 CXFA_LinkUserData* pLinkData) | 212 CXFA_LinkUserData* pLinkData) |
| 212 : m_pStyle(pStyle), | 213 : m_pStyle(pStyle), |
| 213 m_pLinkData(pLinkData), | 214 m_pLinkData(pLinkData), |
| 214 m_pAllocator(pAllocator), | 215 m_pAllocator(pAllocator), |
| 215 m_dwRefCount(0) { | 216 m_dwRefCount(0) { |
| 216 ASSERT(m_pAllocator); | 217 ASSERT(m_pAllocator); |
| 217 if (m_pStyle) | 218 if (m_pStyle) |
| 218 m_pStyle->AddRef(); | 219 m_pStyle->Retain(); |
| 219 } | 220 } |
| 220 ~CXFA_TextUserData() override { | 221 ~CXFA_TextUserData() override { |
| 221 if (m_pStyle) | 222 if (m_pStyle) |
| 222 m_pStyle->Release(); | 223 m_pStyle->Release(); |
| 223 if (m_pLinkData) | 224 if (m_pLinkData) |
| 224 m_pLinkData->Release(); | 225 m_pLinkData->Release(); |
| 225 } | 226 } |
| 226 | 227 |
| 227 uint32_t AddRef() override { return ++m_dwRefCount; } | 228 // IFX_Retainable: |
| 229 uint32_t Retain() override { return ++m_dwRefCount; } |
| 228 uint32_t Release() override { | 230 uint32_t Release() override { |
| 229 uint32_t dwRefCount = --m_dwRefCount; | 231 uint32_t dwRefCount = --m_dwRefCount; |
| 230 if (dwRefCount == 0) | 232 if (dwRefCount == 0) |
| 231 FXTARGET_DeleteWith(CXFA_TextUserData, m_pAllocator, this); | 233 FXTARGET_DeleteWith(CXFA_TextUserData, m_pAllocator, this); |
| 232 return dwRefCount; | 234 return dwRefCount; |
| 233 } | 235 } |
| 234 | 236 |
| 235 IFDE_CSSComputedStyle* m_pStyle; | 237 IFDE_CSSComputedStyle* m_pStyle; |
| 236 CXFA_LinkUserData* m_pLinkData; | 238 CXFA_LinkUserData* m_pLinkData; |
| 237 | 239 |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 std::unique_ptr<CXFA_LoaderContext> m_pLoader; | 416 std::unique_ptr<CXFA_LoaderContext> m_pLoader; |
| 415 int32_t m_iLines; | 417 int32_t m_iLines; |
| 416 FX_FLOAT m_fMaxWidth; | 418 FX_FLOAT m_fMaxWidth; |
| 417 CXFA_TextParser m_textParser; | 419 CXFA_TextParser m_textParser; |
| 418 CXFA_PieceLineArray m_pieceLines; | 420 CXFA_PieceLineArray m_pieceLines; |
| 419 std::unique_ptr<CXFA_TextTabstopsContext> m_pTabstopContext; | 421 std::unique_ptr<CXFA_TextTabstopsContext> m_pTabstopContext; |
| 420 FX_BOOL m_bBlockContinue; | 422 FX_BOOL m_bBlockContinue; |
| 421 }; | 423 }; |
| 422 | 424 |
| 423 #endif // XFA_FXFA_APP_XFA_TEXTLAYOUT_H_ | 425 #endif // XFA_FXFA_APP_XFA_TEXTLAYOUT_H_ |
| OLD | NEW |