Tidy CJS_Field -- avoid one spurious <string> pre-submit warning. -- move SetDelay() to section with other private delay methods. Change-Id: I395059fb4220ae3d8c57088fbf385d9b3046af2a Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/81131 Auto-Submit: Tom Sepez <tsepez@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/fxjs/cjs_field.cpp b/fxjs/cjs_field.cpp index 37411d4..096d2d4 100644 --- a/fxjs/cjs_field.cpp +++ b/fxjs/cjs_field.cpp
@@ -220,19 +220,19 @@ void SetBorderStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv, const WideString& swFieldName, int nControlIndex, - const ByteString& string) { + const ByteString& bsString) { DCHECK(pFormFillEnv); BorderStyle nBorderStyle = BorderStyle::kSolid; - if (string == "solid") + if (bsString == "solid") nBorderStyle = BorderStyle::kSolid; - else if (string == "beveled") + else if (bsString == "beveled") nBorderStyle = BorderStyle::kBeveled; - else if (string == "dashed") + else if (bsString == "dashed") nBorderStyle = BorderStyle::kDash; - else if (string == "inset") + else if (bsString == "inset") nBorderStyle = BorderStyle::kInset; - else if (string == "underline") + else if (bsString == "underline") nBorderStyle = BorderStyle::kUnderline; else return; @@ -1123,15 +1123,6 @@ return CJS_Result::Success(); } -void CJS_Field::SetDelay(bool bDelay) { - m_bDelay = bDelay; - - if (m_bDelay) - return; - if (m_pJSDoc) - m_pJSDoc->DoFieldDelay(m_FieldName, m_nFormControlIndex); -} - CJS_Result CJS_Field::get_delay(CJS_Runtime* pRuntime) { return CJS_Result::Success(pRuntime->NewBoolean(m_bDelay)); } @@ -2575,6 +2566,15 @@ return CJS_Result::Failure(JSMessage::kNotSupportedError); } +void CJS_Field::SetDelay(bool bDelay) { + m_bDelay = bDelay; + if (m_bDelay) + return; + + if (m_pJSDoc) + m_pJSDoc->DoFieldDelay(m_FieldName, m_nFormControlIndex); +} + void CJS_Field::AddDelay_Int(FIELD_PROP prop, int32_t n) { auto pNewData = std::make_unique<CJS_DelayData>(prop, m_nFormControlIndex, m_FieldName);
diff --git a/fxjs/cjs_field.h b/fxjs/cjs_field.h index dd06b5f..fffb952 100644 --- a/fxjs/cjs_field.h +++ b/fxjs/cjs_field.h
@@ -348,11 +348,11 @@ CJS_Result signatureValidate(CJS_Runtime* pRuntime, const std::vector<v8::Local<v8::Value>>& params); - void SetDelay(bool bDelay); std::vector<CPDF_FormField*> GetFormFields() const; CPDF_FormField* GetFirstFormField() const; CPDF_FormControl* GetSmartFieldControl(CPDF_FormField* pFormField); + void SetDelay(bool bDelay); void AddDelay_Int(FIELD_PROP prop, int32_t n); void AddDelay_Bool(FIELD_PROP prop, bool b); void AddDelay_String(FIELD_PROP prop, const ByteString& str); @@ -360,7 +360,6 @@ void AddDelay_WordArray(FIELD_PROP prop, const std::vector<uint32_t>& array); void AddDelay_WideStringArray(FIELD_PROP prop, const std::vector<WideString>& array); - void DoDelay(); ObservedPtr<CJS_Document> m_pJSDoc;