summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-07 21:34:00 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-07 21:34:00 +0000
commit31ed75b714b80b8497b35825bb926c5abb035299 (patch)
tree01b2ed5bee1665b665f77a0d8f6f676906bfbb82 /xfa/fxfa/parser
parent71335de2577ae27d00f03aeb007bf6b9c90d9391 (diff)
downloadpdfium-31ed75b714b80b8497b35825bb926c5abb035299.tar.xz
Rename CXFA_Stroke to CXFA_StrokeData
This CL renames CXFA_Stroke to CXFA_StrokeData to show it is part of the data hierarchy. Change-Id: If0041c410630c61129ed1ff0879c68244ad01aa5 Reviewed-on: https://pdfium-review.googlesource.com/18013 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r--xfa/fxfa/parser/cxfa_boxdata.cpp56
-rw-r--r--xfa/fxfa/parser/cxfa_boxdata.h2
-rw-r--r--xfa/fxfa/parser/cxfa_cornerdata.h6
-rw-r--r--xfa/fxfa/parser/cxfa_edgedata.h6
-rw-r--r--xfa/fxfa/parser/cxfa_strokedata.cpp (renamed from xfa/fxfa/parser/cxfa_stroke.cpp)27
-rw-r--r--xfa/fxfa/parser/cxfa_strokedata.h (renamed from xfa/fxfa/parser/cxfa_stroke.h)14
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.cpp12
-rw-r--r--xfa/fxfa/parser/xfa_document_datamerger_imp.cpp4
8 files changed, 62 insertions, 65 deletions
diff --git a/xfa/fxfa/parser/cxfa_boxdata.cpp b/xfa/fxfa/parser/cxfa_boxdata.cpp
index b7c9561bd0..07eae64ace 100644
--- a/xfa/fxfa/parser/cxfa_boxdata.cpp
+++ b/xfa/fxfa/parser/cxfa_boxdata.cpp
@@ -12,59 +12,58 @@
namespace {
-void GetStrokesInternal(CXFA_Node* pNode,
- std::vector<CXFA_Stroke>* strokes,
- bool bNull) {
- strokes->clear();
+std::vector<CXFA_StrokeData> GetStrokesInternal(CXFA_Node* pNode, bool bNull) {
if (!pNode)
- return;
+ return {};
- strokes->resize(8);
+ std::vector<CXFA_StrokeData> strokes;
+ strokes.resize(8);
int32_t i, j;
for (i = 0, j = 0; i < 4; i++) {
CXFA_CornerData cornerData = CXFA_CornerData(
pNode->JSNode()->GetProperty(i, XFA_Element::Corner, i == 0));
if (cornerData || i == 0) {
- (*strokes)[j] = cornerData;
+ strokes[j] = cornerData;
} else if (!bNull) {
if (i == 1 || i == 2)
- (*strokes)[j] = (*strokes)[0];
+ strokes[j] = strokes[0];
else
- (*strokes)[j] = (*strokes)[2];
+ strokes[j] = strokes[2];
}
j++;
CXFA_EdgeData edgeData = CXFA_EdgeData(
pNode->JSNode()->GetProperty(i, XFA_Element::Edge, i == 0));
if (edgeData || i == 0) {
- (*strokes)[j] = edgeData;
+ strokes[j] = edgeData;
} else if (!bNull) {
if (i == 1 || i == 2)
- (*strokes)[j] = (*strokes)[1];
+ strokes[j] = strokes[1];
else
- (*strokes)[j] = (*strokes)[3];
+ strokes[j] = strokes[3];
}
j++;
}
+ return strokes;
}
-static int32_t Style3D(const std::vector<CXFA_Stroke>& strokes,
- CXFA_Stroke& stroke) {
+static int32_t Style3D(const std::vector<CXFA_StrokeData>& strokes,
+ CXFA_StrokeData& strokeData) {
if (strokes.empty())
return 0;
- stroke = strokes[0];
+ strokeData = strokes[0];
for (size_t i = 1; i < strokes.size(); i++) {
- CXFA_Stroke find = strokes[i];
+ CXFA_StrokeData find = strokes[i];
if (!find)
continue;
- if (!stroke)
- stroke = find;
- else if (stroke.GetStrokeType() != find.GetStrokeType())
- stroke = find;
+ if (!strokeData)
+ strokeData = find;
+ else if (strokeData.GetStrokeType() != find.GetStrokeType())
+ strokeData = find;
break;
}
- int32_t iType = stroke.GetStrokeType();
+ int32_t iType = strokeData.GetStrokeType();
if (iType == XFA_ATTRIBUTEENUM_Lowered || iType == XFA_ATTRIBUTEENUM_Raised ||
iType == XFA_ATTRIBUTEENUM_Etched ||
iType == XFA_ATTRIBUTEENUM_Embossed) {
@@ -99,8 +98,8 @@ CXFA_EdgeData CXFA_BoxData::GetEdgeData(int32_t nIndex) const {
: nullptr);
}
-void CXFA_BoxData::GetStrokes(std::vector<CXFA_Stroke>* strokes) const {
- GetStrokesInternal(m_pNode, strokes, false);
+std::vector<CXFA_StrokeData> CXFA_BoxData::GetStrokes() const {
+ return GetStrokesInternal(m_pNode, false);
}
bool CXFA_BoxData::IsCircular() const {
@@ -155,13 +154,12 @@ int32_t CXFA_BoxData::Get3DStyle(bool& bVisible, float& fThickness) const {
if (IsArc())
return 0;
- std::vector<CXFA_Stroke> strokes;
- GetStrokesInternal(m_pNode, &strokes, true);
- CXFA_Stroke stroke(nullptr);
- int32_t iType = Style3D(strokes, stroke);
+ std::vector<CXFA_StrokeData> strokes = GetStrokesInternal(m_pNode, true);
+ CXFA_StrokeData strokeData(nullptr);
+ int32_t iType = Style3D(strokes, strokeData);
if (iType) {
- bVisible = stroke.IsVisible();
- fThickness = stroke.GetThickness();
+ bVisible = strokeData.IsVisible();
+ fThickness = strokeData.GetThickness();
}
return iType;
}
diff --git a/xfa/fxfa/parser/cxfa_boxdata.h b/xfa/fxfa/parser/cxfa_boxdata.h
index af8b26bfed..b4c348311c 100644
--- a/xfa/fxfa/parser/cxfa_boxdata.h
+++ b/xfa/fxfa/parser/cxfa_boxdata.h
@@ -30,7 +30,7 @@ class CXFA_BoxData : public CXFA_Data {
int32_t GetPresence() const;
int32_t CountEdges() const;
CXFA_EdgeData GetEdgeData(int32_t nIndex = 0) const;
- void GetStrokes(std::vector<CXFA_Stroke>* strokes) const;
+ std::vector<CXFA_StrokeData> GetStrokes() const;
bool IsCircular() const;
bool GetStartAngle(float& fStartAngle) const;
float GetStartAngle() const {
diff --git a/xfa/fxfa/parser/cxfa_cornerdata.h b/xfa/fxfa/parser/cxfa_cornerdata.h
index be0b602d78..fd17bd5c89 100644
--- a/xfa/fxfa/parser/cxfa_cornerdata.h
+++ b/xfa/fxfa/parser/cxfa_cornerdata.h
@@ -7,13 +7,13 @@
#ifndef XFA_FXFA_PARSER_CXFA_CORNERDATA_H_
#define XFA_FXFA_PARSER_CXFA_CORNERDATA_H_
-#include "xfa/fxfa/parser/cxfa_stroke.h"
+#include "xfa/fxfa/parser/cxfa_strokedata.h"
class CXFA_Node;
-class CXFA_CornerData : public CXFA_Stroke {
+class CXFA_CornerData : public CXFA_StrokeData {
public:
- explicit CXFA_CornerData(CXFA_Node* pNode) : CXFA_Stroke(pNode) {}
+ explicit CXFA_CornerData(CXFA_Node* pNode) : CXFA_StrokeData(pNode) {}
};
#endif // XFA_FXFA_PARSER_CXFA_CORNERDATA_H_
diff --git a/xfa/fxfa/parser/cxfa_edgedata.h b/xfa/fxfa/parser/cxfa_edgedata.h
index 5e9ebf3db5..2a55814a31 100644
--- a/xfa/fxfa/parser/cxfa_edgedata.h
+++ b/xfa/fxfa/parser/cxfa_edgedata.h
@@ -7,13 +7,13 @@
#ifndef XFA_FXFA_PARSER_CXFA_EDGEDATA_H_
#define XFA_FXFA_PARSER_CXFA_EDGEDATA_H_
-#include "xfa/fxfa/parser/cxfa_stroke.h"
+#include "xfa/fxfa/parser/cxfa_strokedata.h"
class CXFA_Node;
-class CXFA_EdgeData : public CXFA_Stroke {
+class CXFA_EdgeData : public CXFA_StrokeData {
public:
- explicit CXFA_EdgeData(CXFA_Node* pNode) : CXFA_Stroke(pNode) {}
+ explicit CXFA_EdgeData(CXFA_Node* pNode) : CXFA_StrokeData(pNode) {}
};
#endif // XFA_FXFA_PARSER_CXFA_EDGEDATA_H_
diff --git a/xfa/fxfa/parser/cxfa_stroke.cpp b/xfa/fxfa/parser/cxfa_strokedata.cpp
index 17b269fda3..1f8a56ea12 100644
--- a/xfa/fxfa/parser/cxfa_stroke.cpp
+++ b/xfa/fxfa/parser/cxfa_strokedata.cpp
@@ -4,47 +4,47 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/parser/cxfa_stroke.h"
+#include "xfa/fxfa/parser/cxfa_strokedata.h"
#include "xfa/fxfa/parser/cxfa_measurement.h"
#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/xfa_utils.h"
-int32_t CXFA_Stroke::GetPresence() const {
+int32_t CXFA_StrokeData::GetPresence() const {
return m_pNode ? m_pNode->JSNode()->GetEnum(XFA_ATTRIBUTE_Presence)
: XFA_ATTRIBUTEENUM_Invisible;
}
-int32_t CXFA_Stroke::GetCapType() const {
+int32_t CXFA_StrokeData::GetCapType() const {
if (!m_pNode)
return XFA_ATTRIBUTEENUM_Square;
return m_pNode->JSNode()->GetEnum(XFA_ATTRIBUTE_Cap);
}
-int32_t CXFA_Stroke::GetStrokeType() const {
+int32_t CXFA_StrokeData::GetStrokeType() const {
return m_pNode ? m_pNode->JSNode()->GetEnum(XFA_ATTRIBUTE_Stroke)
: XFA_ATTRIBUTEENUM_Solid;
}
-float CXFA_Stroke::GetThickness() const {
+float CXFA_StrokeData::GetThickness() const {
return GetMSThickness().ToUnit(XFA_UNIT_Pt);
}
-CXFA_Measurement CXFA_Stroke::GetMSThickness() const {
+CXFA_Measurement CXFA_StrokeData::GetMSThickness() const {
return m_pNode ? m_pNode->JSNode()->GetMeasure(XFA_ATTRIBUTE_Thickness)
: XFA_GetAttributeDefaultValue_Measure(XFA_Element::Edge,
XFA_ATTRIBUTE_Thickness,
XFA_XDPPACKET_Form);
}
-void CXFA_Stroke::SetMSThickness(CXFA_Measurement msThinkness) {
+void CXFA_StrokeData::SetMSThickness(CXFA_Measurement msThinkness) {
if (!m_pNode)
return;
m_pNode->JSNode()->SetMeasure(XFA_ATTRIBUTE_Thickness, msThinkness, false);
}
-FX_ARGB CXFA_Stroke::GetColor() const {
+FX_ARGB CXFA_StrokeData::GetColor() const {
if (!m_pNode)
return 0xFF000000;
@@ -57,7 +57,7 @@ FX_ARGB CXFA_Stroke::GetColor() const {
return CXFA_Data::ToColor(wsColor);
}
-void CXFA_Stroke::SetColor(FX_ARGB argb) {
+void CXFA_StrokeData::SetColor(FX_ARGB argb) {
if (!m_pNode)
return;
@@ -73,24 +73,25 @@ void CXFA_Stroke::SetColor(FX_ARGB argb) {
pNode->JSNode()->SetCData(XFA_ATTRIBUTE_Value, wsColor, false, false);
}
-int32_t CXFA_Stroke::GetJoinType() const {
+int32_t CXFA_StrokeData::GetJoinType() const {
return m_pNode ? m_pNode->JSNode()->GetEnum(XFA_ATTRIBUTE_Join)
: XFA_ATTRIBUTEENUM_Square;
}
-bool CXFA_Stroke::IsInverted() const {
+bool CXFA_StrokeData::IsInverted() const {
return m_pNode ? m_pNode->JSNode()->GetBoolean(XFA_ATTRIBUTE_Inverted)
: false;
}
-float CXFA_Stroke::GetRadius() const {
+float CXFA_StrokeData::GetRadius() const {
return m_pNode ? m_pNode->JSNode()
->GetMeasure(XFA_ATTRIBUTE_Radius)
.ToUnit(XFA_UNIT_Pt)
: 0;
}
-bool CXFA_Stroke::SameStyles(CXFA_Stroke stroke, uint32_t dwFlags) const {
+bool CXFA_StrokeData::SameStyles(CXFA_StrokeData stroke,
+ uint32_t dwFlags) const {
if (m_pNode == stroke.GetNode())
return true;
if (fabs(GetThickness() - stroke.GetThickness()) >= 0.01f)
diff --git a/xfa/fxfa/parser/cxfa_stroke.h b/xfa/fxfa/parser/cxfa_strokedata.h
index 63709b9160..050b76671a 100644
--- a/xfa/fxfa/parser/cxfa_stroke.h
+++ b/xfa/fxfa/parser/cxfa_strokedata.h
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FXFA_PARSER_CXFA_STROKE_H_
-#define XFA_FXFA_PARSER_CXFA_STROKE_H_
+#ifndef XFA_FXFA_PARSER_CXFA_STROKEDATA_H_
+#define XFA_FXFA_PARSER_CXFA_STROKEDATA_H_
#include "core/fxcrt/fx_system.h"
#include "core/fxge/fx_dib.h"
@@ -19,10 +19,10 @@ enum StrokeSameStyle {
class CXFA_Node;
-class CXFA_Stroke : public CXFA_Data {
+class CXFA_StrokeData : public CXFA_Data {
public:
- CXFA_Stroke() : CXFA_Stroke(nullptr) {}
- explicit CXFA_Stroke(CXFA_Node* pNode) : CXFA_Data(pNode) {}
+ CXFA_StrokeData() : CXFA_StrokeData(nullptr) {}
+ explicit CXFA_StrokeData(CXFA_Node* pNode) : CXFA_Data(pNode) {}
bool IsCorner() const { return GetElementType() == XFA_Element::Corner; }
bool IsEdge() const { return GetElementType() == XFA_Element::Edge; }
@@ -38,7 +38,7 @@ class CXFA_Stroke : public CXFA_Data {
int32_t GetJoinType() const;
bool IsInverted() const;
float GetRadius() const;
- bool SameStyles(CXFA_Stroke stroke, uint32_t dwFlags = 0) const;
+ bool SameStyles(CXFA_StrokeData stroke, uint32_t dwFlags = 0) const;
};
-#endif // XFA_FXFA_PARSER_CXFA_STROKE_H_
+#endif // XFA_FXFA_PARSER_CXFA_STROKEDATA_H_
diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp
index 841fbd065a..b9a54bd447 100644
--- a/xfa/fxfa/parser/cxfa_widgetdata.cpp
+++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp
@@ -20,7 +20,7 @@
namespace {
-float GetEdgeThickness(const std::vector<CXFA_Stroke>& strokes,
+float GetEdgeThickness(const std::vector<CXFA_StrokeData>& strokes,
bool b3DStyle,
int32_t nIndex) {
float fThickness = 0;
@@ -397,11 +397,10 @@ CXFA_BorderData CXFA_WidgetData::GetUIBorderData() {
CFX_RectF CXFA_WidgetData::GetUIMargin() {
CXFA_Node* pUIChild = GetUIChild();
- if (!pUIChild)
- return CFX_RectF();
-
CXFA_MarginData mgUI = CXFA_MarginData(
- pUIChild->JSNode()->GetProperty(0, XFA_Element::Margin, false));
+ pUIChild ? pUIChild->JSNode()->GetProperty(0, XFA_Element::Margin, false)
+ : nullptr);
+
if (!mgUI)
return CFX_RectF();
@@ -419,8 +418,7 @@ CFX_RectF CXFA_WidgetData::GetUIMargin() {
float fThickness = 0;
borderData.Get3DStyle(bVisible, fThickness);
if (!bLeft || !bTop || !bRight || !bBottom) {
- std::vector<CXFA_Stroke> strokes;
- borderData.GetStrokes(&strokes);
+ std::vector<CXFA_StrokeData> strokes = borderData.GetStrokes();
if (!bTop)
fTopInset = GetEdgeThickness(strokes, bVisible, 0);
if (!bRight)
diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
index f7df149ceb..64d38bf0da 100644
--- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
@@ -49,8 +49,8 @@ bool GetOccurInfo(CXFA_Node* pOccurNode,
int32_t& iMin,
int32_t& iMax,
int32_t& iInit) {
- return pOccurNode &&
- CXFA_OccurData(pOccurNode).GetOccurInfo(iMin, iMax, iInit);
+ return pOccurNode ? CXFA_OccurData(pOccurNode).GetOccurInfo(iMin, iMax, iInit)
+ : false;
}
CXFA_Node* FormValueNode_CreateChild(CXFA_Node* pValueNode, XFA_Element iType) {