aboutsummaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_occur.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxfa/parser/cxfa_occur.cpp')
-rw-r--r--xfa/fxfa/parser/cxfa_occur.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/xfa/fxfa/parser/cxfa_occur.cpp b/xfa/fxfa/parser/cxfa_occur.cpp
index ee689813d..515ffdda3 100644
--- a/xfa/fxfa/parser/cxfa_occur.cpp
+++ b/xfa/fxfa/parser/cxfa_occur.cpp
@@ -1,4 +1,4 @@
-// Copyright 2017 PDFium Authors. All rights reserved.
+// Copyright 2017 The PDFium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,12 +7,12 @@
#include "xfa/fxfa/parser/cxfa_occur.h"
#include "fxjs/xfa/cjx_occur.h"
-#include "third_party/base/ptr_util.h"
+#include "xfa/fxfa/parser/cxfa_document.h"
namespace {
const CXFA_Node::PropertyData kOccurPropertyData[] = {
- {XFA_Element::Extras, 1, 0},
+ {XFA_Element::Extras, 1, {}},
};
const CXFA_Node::AttributeData kOccurAttributeData[] = {
@@ -29,32 +29,37 @@ const CXFA_Node::AttributeData kOccurAttributeData[] = {
CXFA_Occur::CXFA_Occur(CXFA_Document* doc, XFA_PacketType packet)
: CXFA_Node(doc,
packet,
- (XFA_XDPPACKET_Template | XFA_XDPPACKET_Form),
+ {XFA_XDPPACKET::kTemplate, XFA_XDPPACKET::kForm},
XFA_ObjectType::Node,
XFA_Element::Occur,
kOccurPropertyData,
kOccurAttributeData,
- pdfium::MakeUnique<CJX_Occur>(this)) {}
+ cppgc::MakeGarbageCollected<CJX_Occur>(
+ doc->GetHeap()->GetAllocationHandle(),
+ this)) {}
CXFA_Occur::~CXFA_Occur() = default;
int32_t CXFA_Occur::GetMax() {
- Optional<int32_t> max = JSObject()->TryInteger(XFA_Attribute::Max, true);
- return max ? *max : GetMin();
+ absl::optional<int32_t> max =
+ JSObject()->TryInteger(XFA_Attribute::Max, true);
+ return max.has_value() ? max.value() : GetMin();
}
int32_t CXFA_Occur::GetMin() {
- Optional<int32_t> min = JSObject()->TryInteger(XFA_Attribute::Min, true);
- return min && *min >= 0 ? *min : 1;
+ absl::optional<int32_t> min =
+ JSObject()->TryInteger(XFA_Attribute::Min, true);
+ return min.has_value() && min.value() >= 0 ? min.value() : 1;
}
std::tuple<int32_t, int32_t, int32_t> CXFA_Occur::GetOccurInfo() {
int32_t iMin = GetMin();
int32_t iMax = GetMax();
- Optional<int32_t> init =
+ absl::optional<int32_t> init =
JSObject()->TryInteger(XFA_Attribute::Initial, false);
- return {iMin, iMax, init && *init >= iMin ? *init : iMin};
+ return {iMin, iMax,
+ init.has_value() && init.value() >= iMin ? init.value() : iMin};
}
void CXFA_Occur::SetMax(int32_t iMax) {