From 4f88617ad2a4d352af87b95c2f7293d12e7bd2c8 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 3 Jan 2018 16:21:33 -0500 Subject: Fold CXFA_LineData into CXFA_Line This CL merges the CXFA_LineData wrapper into CXFA_Line. Change-Id: If5299797a615d2c0abb661e72a9e036e69f96385 Reviewed-on: https://pdfium-review.googlesource.com/22112 Reviewed-by: Ryan Harrison Commit-Queue: dsinclair --- BUILD.gn | 2 -- xfa/fxfa/cxfa_ffline.cpp | 9 +++++---- xfa/fxfa/parser/cxfa_line.cpp | 14 ++++++++++++++ xfa/fxfa/parser/cxfa_line.h | 6 ++++++ xfa/fxfa/parser/cxfa_linedata.cpp | 23 ----------------------- xfa/fxfa/parser/cxfa_linedata.h | 25 ------------------------- xfa/fxfa/parser/cxfa_value.cpp | 5 +++-- xfa/fxfa/parser/cxfa_value.h | 4 ++-- 8 files changed, 30 insertions(+), 58 deletions(-) delete mode 100644 xfa/fxfa/parser/cxfa_linedata.cpp delete mode 100644 xfa/fxfa/parser/cxfa_linedata.h diff --git a/BUILD.gn b/BUILD.gn index 56f1b46498..ca65a46abb 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -2400,8 +2400,6 @@ if (pdf_enable_xfa) { "xfa/fxfa/parser/cxfa_linear.h", "xfa/fxfa/parser/cxfa_linearized.cpp", "xfa/fxfa/parser/cxfa_linearized.h", - "xfa/fxfa/parser/cxfa_linedata.cpp", - "xfa/fxfa/parser/cxfa_linedata.h", "xfa/fxfa/parser/cxfa_list.cpp", "xfa/fxfa/parser/cxfa_list.h", "xfa/fxfa/parser/cxfa_locale.cpp", diff --git a/xfa/fxfa/cxfa_ffline.cpp b/xfa/fxfa/cxfa_ffline.cpp index c1bcc26b27..7d3ce6a619 100644 --- a/xfa/fxfa/cxfa_ffline.cpp +++ b/xfa/fxfa/cxfa_ffline.cpp @@ -7,6 +7,7 @@ #include "xfa/fxfa/cxfa_ffline.h" #include "xfa/fxfa/parser/cxfa_edge.h" +#include "xfa/fxfa/parser/cxfa_line.h" #include "xfa/fxfa/parser/cxfa_value.h" #include "xfa/fxgraphics/cxfa_gecolor.h" #include "xfa/fxgraphics/cxfa_gepath.h" @@ -90,12 +91,12 @@ void CXFA_FFLine::RenderWidget(CXFA_Graphics* pGS, if (!value) return; - CXFA_LineData lineData = value->GetLineData(); + CXFA_Line* line = value->GetLine(); FX_ARGB lineColor = 0xFF000000; float fLineWidth = 1.0f; XFA_AttributeEnum iStrokeType = XFA_AttributeEnum::Unknown; XFA_AttributeEnum iCap = XFA_AttributeEnum::Unknown; - CXFA_Edge* edge = lineData.GetEdge(); + CXFA_Edge* edge = line->GetEdge(); if (edge) { if (!edge->IsVisible()) return; @@ -114,9 +115,9 @@ void CXFA_FFLine::RenderWidget(CXFA_Graphics* pGS, if (margin) XFA_RectWidthoutMargin(rtLine, margin); - GetRectFromHand(rtLine, lineData.GetHand(), fLineWidth); + GetRectFromHand(rtLine, line->GetHand(), fLineWidth); CXFA_GEPath linePath; - if (lineData.GetSlope() && rtLine.right() > 0.0f && rtLine.bottom() > 0.0f) + if (line->GetSlope() && rtLine.right() > 0.0f && rtLine.bottom() > 0.0f) linePath.AddLine(rtLine.TopRight(), rtLine.BottomLeft()); else linePath.AddLine(rtLine.TopLeft(), rtLine.BottomRight()); diff --git a/xfa/fxfa/parser/cxfa_line.cpp b/xfa/fxfa/parser/cxfa_line.cpp index cc7b6ee071..d4159c3f72 100644 --- a/xfa/fxfa/parser/cxfa_line.cpp +++ b/xfa/fxfa/parser/cxfa_line.cpp @@ -8,6 +8,8 @@ #include "fxjs/xfa/cjx_line.h" #include "third_party/base/ptr_util.h" +#include "xfa/fxfa/parser/cxfa_edge.h" +#include "xfa/fxfa/parser/cxfa_node.h" namespace { @@ -39,3 +41,15 @@ CXFA_Line::CXFA_Line(CXFA_Document* doc, XFA_PacketType packet) pdfium::MakeUnique(this)) {} CXFA_Line::~CXFA_Line() {} + +XFA_AttributeEnum CXFA_Line::GetHand() { + return JSObject()->GetEnum(XFA_Attribute::Hand); +} + +bool CXFA_Line::GetSlope() { + return JSObject()->GetEnum(XFA_Attribute::Slope) == XFA_AttributeEnum::Slash; +} + +CXFA_Edge* CXFA_Line::GetEdge() { + return GetChild(0, XFA_Element::Edge, false); +} diff --git a/xfa/fxfa/parser/cxfa_line.h b/xfa/fxfa/parser/cxfa_line.h index 9126db0161..1b950e4641 100644 --- a/xfa/fxfa/parser/cxfa_line.h +++ b/xfa/fxfa/parser/cxfa_line.h @@ -9,10 +9,16 @@ #include "xfa/fxfa/parser/cxfa_node.h" +class CXFA_Edge; + class CXFA_Line : public CXFA_Node { public: CXFA_Line(CXFA_Document* doc, XFA_PacketType packet); ~CXFA_Line() override; + + XFA_AttributeEnum GetHand(); + bool GetSlope(); + CXFA_Edge* GetEdge(); }; #endif // XFA_FXFA_PARSER_CXFA_LINE_H_ diff --git a/xfa/fxfa/parser/cxfa_linedata.cpp b/xfa/fxfa/parser/cxfa_linedata.cpp deleted file mode 100644 index 2c191e041c..0000000000 --- a/xfa/fxfa/parser/cxfa_linedata.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2016 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/fxfa/parser/cxfa_linedata.h" - -#include "xfa/fxfa/parser/cxfa_edge.h" -#include "xfa/fxfa/parser/cxfa_node.h" - -XFA_AttributeEnum CXFA_LineData::GetHand() const { - return m_pNode->JSObject()->GetEnum(XFA_Attribute::Hand); -} - -bool CXFA_LineData::GetSlope() const { - return m_pNode->JSObject()->GetEnum(XFA_Attribute::Slope) == - XFA_AttributeEnum::Slash; -} - -CXFA_Edge* CXFA_LineData::GetEdge() const { - return m_pNode->GetChild(0, XFA_Element::Edge, false); -} diff --git a/xfa/fxfa/parser/cxfa_linedata.h b/xfa/fxfa/parser/cxfa_linedata.h deleted file mode 100644 index b97210a953..0000000000 --- a/xfa/fxfa/parser/cxfa_linedata.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2016 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_FXFA_PARSER_CXFA_LINEDATA_H_ -#define XFA_FXFA_PARSER_CXFA_LINEDATA_H_ - -#include "core/fxcrt/fx_system.h" -#include "xfa/fxfa/parser/cxfa_datadata.h" - -class CXFA_Edge; -class CXFA_Node; - -class CXFA_LineData : public CXFA_DataData { - public: - explicit CXFA_LineData(CXFA_Node* pNode) : CXFA_DataData(pNode) {} - - XFA_AttributeEnum GetHand() const; - bool GetSlope() const; - CXFA_Edge* GetEdge() const; -}; - -#endif // XFA_FXFA_PARSER_CXFA_LINEDATA_H_ diff --git a/xfa/fxfa/parser/cxfa_value.cpp b/xfa/fxfa/parser/cxfa_value.cpp index d2c92067af..bc5f9faeff 100644 --- a/xfa/fxfa/parser/cxfa_value.cpp +++ b/xfa/fxfa/parser/cxfa_value.cpp @@ -9,6 +9,7 @@ #include "fxjs/xfa/cjx_value.h" #include "third_party/base/ptr_util.h" #include "xfa/fxfa/parser/cxfa_arc.h" +#include "xfa/fxfa/parser/cxfa_line.h" #include "xfa/fxfa/parser/cxfa_rectangle.h" namespace { @@ -69,8 +70,8 @@ CXFA_Arc* CXFA_Value::GetArc() const { return static_cast(GetNodeItem(XFA_NODEITEM_FirstChild)); } -CXFA_LineData CXFA_Value::GetLineData() const { - return CXFA_LineData(GetNodeItem(XFA_NODEITEM_FirstChild)); +CXFA_Line* CXFA_Value::GetLine() const { + return static_cast(GetNodeItem(XFA_NODEITEM_FirstChild)); } CXFA_Rectangle* CXFA_Value::GetRectangle() const { diff --git a/xfa/fxfa/parser/cxfa_value.h b/xfa/fxfa/parser/cxfa_value.h index 5a9e10d086..b5de965557 100644 --- a/xfa/fxfa/parser/cxfa_value.h +++ b/xfa/fxfa/parser/cxfa_value.h @@ -11,11 +11,11 @@ #include "xfa/fxfa/parser/cxfa_datadata.h" #include "xfa/fxfa/parser/cxfa_exdatadata.h" #include "xfa/fxfa/parser/cxfa_imagedata.h" -#include "xfa/fxfa/parser/cxfa_linedata.h" #include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/cxfa_text.h" class CXFA_Arc; +class CXFA_Line; class CXFA_Rectangle; class CXFA_Value : public CXFA_Node { @@ -26,7 +26,7 @@ class CXFA_Value : public CXFA_Node { XFA_Element GetChildValueClassID() const; WideString GetChildValueContent() const; CXFA_Arc* GetArc() const; - CXFA_LineData GetLineData() const; + CXFA_Line* GetLine() const; CXFA_Rectangle* GetRectangle() const; CXFA_Text* GetText() const; CXFA_ExDataData GetExData() const; -- cgit v1.2.3