diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-01-11 16:35:12 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-01-11 16:35:12 +0000 |
commit | ce7df754b0608887a923d5083f0bbb999a735fce (patch) | |
tree | 03c73474e98e7832eb6601e5933707f3ec087653 /xfa/fxfa/parser/cxfa_box.cpp | |
parent | b800d149de09ac7d73aa3d1ff8558e33a4c56009 (diff) | |
download | pdfium-ce7df754b0608887a923d5083f0bbb999a735fce.tar.xz |
Rename CXFA_Box methods to make return clearer
This CL renames the methods in CXFA_Box to make it clearer they can
return nullptr.
Change-Id: I521c0e06af306f69e390a4057cabb7777a0d72f5
Reviewed-on: https://pdfium-review.googlesource.com/22740
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_box.cpp')
-rw-r--r-- | xfa/fxfa/parser/cxfa_box.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/xfa/fxfa/parser/cxfa_box.cpp b/xfa/fxfa/parser/cxfa_box.cpp index 443362f449..5f8bed9aa1 100644 --- a/xfa/fxfa/parser/cxfa_box.cpp +++ b/xfa/fxfa/parser/cxfa_box.cpp @@ -81,7 +81,7 @@ int32_t CXFA_Box::CountEdges() { return CountChildren(XFA_Element::Edge, false); } -CXFA_Edge* CXFA_Box::GetEdge(int32_t nIndex) { +CXFA_Edge* CXFA_Box::GetEdgeIfExists(int32_t nIndex) { if (nIndex == 0) return JSObject()->GetOrCreateProperty<CXFA_Edge>(nIndex, XFA_Element::Edge); @@ -104,15 +104,15 @@ Optional<int32_t> CXFA_Box::GetSweepAngle() { return JSObject()->TryInteger(XFA_Attribute::SweepAngle, false); } -CXFA_Fill* CXFA_Box::GetFill() const { +CXFA_Fill* CXFA_Box::GetFillIfExists() const { return JSObject()->GetProperty<CXFA_Fill>(0, XFA_Element::Fill); } -CXFA_Fill* CXFA_Box::GetOrCreateFill() { +CXFA_Fill* CXFA_Box::GetOrCreateFillIfPossible() { return JSObject()->GetOrCreateProperty<CXFA_Fill>(0, XFA_Element::Fill); } -CXFA_Margin* CXFA_Box::GetMargin() { +CXFA_Margin* CXFA_Box::GetMarginIfExists() { return GetChild<CXFA_Margin>(0, XFA_Element::Margin, false); } @@ -144,6 +144,8 @@ std::vector<CXFA_Stroke*> CXFA_Box::GetStrokesInternal(bool bNull) { corner = JSObject()->GetProperty<CXFA_Corner>(i, XFA_Element::Corner); } + // TODO(dsinclair): If i == 0 and GetOrCreateProperty failed, we can end up + // with a null corner in the first position. if (corner || i == 0) { strokes[j] = corner; } else if (!bNull) { @@ -160,6 +162,8 @@ std::vector<CXFA_Stroke*> CXFA_Box::GetStrokesInternal(bool bNull) { else edge = JSObject()->GetProperty<CXFA_Edge>(i, XFA_Element::Edge); + // TODO(dsinclair): If i == 0 and GetOrCreateProperty failed, we can end up + // with a null edge in the first position. if (edge || i == 0) { strokes[j] = edge; } else if (!bNull) { |