diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-07-30 22:07:22 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-07-30 22:07:22 +0000 |
commit | b53ef1e52d40f586c401a7e3948259f8ebbfd3cc (patch) | |
tree | 23a55140c7bee634f40ff30f8370c0aaa32002de /xfa/fxfa/parser | |
parent | 87c1fdcc9a5669e29c4440e2b220587de7134e7a (diff) | |
download | pdfium-b53ef1e52d40f586c401a7e3948259f8ebbfd3cc.tar.xz |
Replace m_bIsContentLayoutItem with proper enum for type.
Because bools are bogus.
Change-Id: I54a2627443784cec40912288230e657c63a35408
Reviewed-on: https://pdfium-review.googlesource.com/39190
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r-- | xfa/fxfa/parser/cxfa_containerlayoutitem.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_contentlayoutitem.cpp | 5 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_contentlayoutitem.h | 6 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_layoutitem.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_layoutitem.h | 10 |
5 files changed, 12 insertions, 15 deletions
diff --git a/xfa/fxfa/parser/cxfa_containerlayoutitem.cpp b/xfa/fxfa/parser/cxfa_containerlayoutitem.cpp index 47da2b1798..f5af3a3a25 100644 --- a/xfa/fxfa/parser/cxfa_containerlayoutitem.cpp +++ b/xfa/fxfa/parser/cxfa_containerlayoutitem.cpp @@ -14,7 +14,7 @@ #include "xfa/fxfa/parser/cxfa_node.h" CXFA_ContainerLayoutItem::CXFA_ContainerLayoutItem(CXFA_Node* pNode) - : CXFA_LayoutItem(pNode, false) {} + : CXFA_LayoutItem(pNode, kContainerItem) {} CXFA_ContainerLayoutItem::~CXFA_ContainerLayoutItem() = default; diff --git a/xfa/fxfa/parser/cxfa_contentlayoutitem.cpp b/xfa/fxfa/parser/cxfa_contentlayoutitem.cpp index e763e2d5da..b3ceb9e4f0 100644 --- a/xfa/fxfa/parser/cxfa_contentlayoutitem.cpp +++ b/xfa/fxfa/parser/cxfa_contentlayoutitem.cpp @@ -11,10 +11,7 @@ #include "xfa/fxfa/parser/cxfa_node.h" CXFA_ContentLayoutItem::CXFA_ContentLayoutItem(CXFA_Node* pNode) - : CXFA_LayoutItem(pNode, true), - m_pPrev(nullptr), - m_pNext(nullptr), - m_dwStatus(0) {} + : CXFA_LayoutItem(pNode, kContentItem) {} CXFA_ContentLayoutItem::~CXFA_ContentLayoutItem() { if (m_pFormNode->JSObject()->GetLayoutItem() == this) diff --git a/xfa/fxfa/parser/cxfa_contentlayoutitem.h b/xfa/fxfa/parser/cxfa_contentlayoutitem.h index c7c440f9c2..fc91f3bcca 100644 --- a/xfa/fxfa/parser/cxfa_contentlayoutitem.h +++ b/xfa/fxfa/parser/cxfa_contentlayoutitem.h @@ -23,11 +23,11 @@ class CXFA_ContentLayoutItem : public CXFA_LayoutItem { int32_t GetIndex() const; int32_t GetCount() const; - CXFA_ContentLayoutItem* m_pPrev; - CXFA_ContentLayoutItem* m_pNext; + CXFA_ContentLayoutItem* m_pPrev = nullptr; + CXFA_ContentLayoutItem* m_pNext = nullptr; CFX_PointF m_sPos; CFX_SizeF m_sSize; - mutable uint32_t m_dwStatus; + mutable uint32_t m_dwStatus = 0; }; inline CXFA_ContentLayoutItem* ToContentLayoutItem(CXFA_LayoutItem* pItem) { diff --git a/xfa/fxfa/parser/cxfa_layoutitem.cpp b/xfa/fxfa/parser/cxfa_layoutitem.cpp index 8b1c30e8cf..5dd03674c9 100644 --- a/xfa/fxfa/parser/cxfa_layoutitem.cpp +++ b/xfa/fxfa/parser/cxfa_layoutitem.cpp @@ -34,8 +34,8 @@ void XFA_ReleaseLayoutItem(CXFA_LayoutItem* pLayoutItem) { delete pLayoutItem; } -CXFA_LayoutItem::CXFA_LayoutItem(CXFA_Node* pNode, bool bIsContentLayoutItem) - : m_bIsContentLayoutItem(bIsContentLayoutItem), m_pFormNode(pNode) {} +CXFA_LayoutItem::CXFA_LayoutItem(CXFA_Node* pNode, ItemType type) + : m_ItemType(type), m_pFormNode(pNode) {} CXFA_LayoutItem::~CXFA_LayoutItem() = default; diff --git a/xfa/fxfa/parser/cxfa_layoutitem.h b/xfa/fxfa/parser/cxfa_layoutitem.h index f5568df575..c9b285935e 100644 --- a/xfa/fxfa/parser/cxfa_layoutitem.h +++ b/xfa/fxfa/parser/cxfa_layoutitem.h @@ -18,8 +18,8 @@ class CXFA_LayoutItem { public: virtual ~CXFA_LayoutItem(); - bool IsContainerLayoutItem() const { return !m_bIsContentLayoutItem; } - bool IsContentLayoutItem() const { return m_bIsContentLayoutItem; } + bool IsContainerLayoutItem() const { return m_ItemType == kContainerItem; } + bool IsContentLayoutItem() const { return m_ItemType == kContentItem; } CXFA_ContainerLayoutItem* AsContainerLayoutItem(); CXFA_ContentLayoutItem* AsContentLayoutItem(); @@ -28,7 +28,6 @@ class CXFA_LayoutItem { CXFA_Node* GetFormNode() const { return m_pFormNode.Get(); } void SetFormNode(CXFA_Node* pNode) { m_pFormNode = pNode; } - void AddChild(CXFA_LayoutItem* pChildItem); void AddHeadChild(CXFA_LayoutItem* pChildItem); void RemoveChild(CXFA_LayoutItem* pChildItem); @@ -39,9 +38,10 @@ class CXFA_LayoutItem { CXFA_LayoutItem* m_pFirstChild = nullptr; // Raw, intra-tree pointer. protected: - CXFA_LayoutItem(CXFA_Node* pNode, bool bIsContentLayoutItem); + enum ItemType { kContainerItem, kContentItem }; + CXFA_LayoutItem(CXFA_Node* pNode, ItemType type); - bool m_bIsContentLayoutItem; + const ItemType m_ItemType; UnownedPtr<CXFA_Node> m_pFormNode; }; |