1 // Copyright 2017 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #ifndef XFA_FXFA_CXFA_LOADERCONTEXT_H_
8 #define XFA_FXFA_CXFA_LOADERCONTEXT_H_
9 
10 #include <vector>
11 
12 #include "core/fxcrt/fx_system.h"
13 #include "core/fxcrt/retain_ptr.h"
14 #include "core/fxcrt/unowned_ptr.h"
15 
16 class CFX_CSSComputedStyle;
17 class CFX_XMLNode;
18 class CXFA_Node;
19 
20 struct CXFA_BlockHeight {
21   size_t szBlockIndex;
22   float fHeight;
23 };
24 
25 struct CXFA_LoaderContext {
26   CXFA_LoaderContext();
27   ~CXFA_LoaderContext();
28 
29   bool bSaveLineHeight = false;
30   bool bFilterSpace = false;
31   float fWidth = 0;
32   float fHeight = 0;
33   float fLastPos = 0;
34   float fStartLineOffset = 0;
35   int32_t iChar = 0;
36   // TODO(thestig): Make this size_t?
37   int32_t iTotalLines = -1;
38   UnownedPtr<const CFX_XMLNode> pXMLNode;
39   UnownedPtr<CXFA_Node> pNode;
40   RetainPtr<CFX_CSSComputedStyle> pParentStyle;
41   std::vector<float> lineHeights;
42   std::vector<CXFA_BlockHeight> blockHeights;
43 };
44 
45 #endif  // XFA_FXFA_CXFA_LOADERCONTEXT_H_
46