| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "fpdfsdk/javascript/Document.h" | 7 #include "fpdfsdk/javascript/Document.h" |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 } | 499 } |
| 500 if (!(m_pFormFillEnv->GetPermissions(FPDFPERM_MODIFY) || | 500 if (!(m_pFormFillEnv->GetPermissions(FPDFPERM_MODIFY) || |
| 501 m_pFormFillEnv->GetPermissions(FPDFPERM_ANNOT_FORM))) { | 501 m_pFormFillEnv->GetPermissions(FPDFPERM_ANNOT_FORM))) { |
| 502 sError = JSGetStringFromID(IDS_STRING_JSNOPERMISSION); | 502 sError = JSGetStringFromID(IDS_STRING_JSNOPERMISSION); |
| 503 return false; | 503 return false; |
| 504 } | 504 } |
| 505 CJS_Context* pContext = static_cast<CJS_Context*>(cc); | 505 CJS_Context* pContext = static_cast<CJS_Context*>(cc); |
| 506 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | 506 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
| 507 CFX_WideString sFieldName = params[0].ToCFXWideString(pRuntime); | 507 CFX_WideString sFieldName = params[0].ToCFXWideString(pRuntime); |
| 508 CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm(); | 508 CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm(); |
| 509 std::vector<CPDFSDK_Widget*> widgets; | 509 std::vector<CPDFSDK_Annot::ObservedPtr> widgets; |
| 510 pInterForm->GetWidgets(sFieldName, &widgets); | 510 pInterForm->GetWidgets(sFieldName, &widgets); |
| 511 if (widgets.empty()) | 511 if (widgets.empty()) |
| 512 return true; | 512 return true; |
| 513 | 513 |
| 514 for (CPDFSDK_Widget* pWidget : widgets) { | 514 for (const auto& pAnnot : widgets) { |
| 515 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot.Get()); |
| 516 if (!pWidget) |
| 517 continue; |
| 518 |
| 515 CFX_FloatRect rcAnnot = pWidget->GetRect(); | 519 CFX_FloatRect rcAnnot = pWidget->GetRect(); |
| 516 --rcAnnot.left; | 520 --rcAnnot.left; |
| 517 --rcAnnot.bottom; | 521 --rcAnnot.bottom; |
| 518 ++rcAnnot.right; | 522 ++rcAnnot.right; |
| 519 ++rcAnnot.top; | 523 ++rcAnnot.top; |
| 520 | 524 |
| 521 std::vector<CFX_FloatRect> aRefresh(1, rcAnnot); | 525 std::vector<CFX_FloatRect> aRefresh(1, rcAnnot); |
| 522 UnderlyingPageType* pPage = pWidget->GetUnderlyingPage(); | 526 UnderlyingPageType* pPage = pWidget->GetUnderlyingPage(); |
| 523 ASSERT(pPage); | 527 ASSERT(pPage); |
| 524 | 528 |
| (...skipping 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1716 } | 1720 } |
| 1717 } | 1721 } |
| 1718 | 1722 |
| 1719 for (const auto& pData : DelayDataForFieldAndControlIndex) | 1723 for (const auto& pData : DelayDataForFieldAndControlIndex) |
| 1720 Field::DoDelay(m_pFormFillEnv.Get(), pData.get()); | 1724 Field::DoDelay(m_pFormFillEnv.Get(), pData.get()); |
| 1721 } | 1725 } |
| 1722 | 1726 |
| 1723 CJS_Document* Document::GetCJSDoc() const { | 1727 CJS_Document* Document::GetCJSDoc() const { |
| 1724 return static_cast<CJS_Document*>(m_pJSObject); | 1728 return static_cast<CJS_Document*>(m_pJSObject); |
| 1725 } | 1729 } |
| OLD | NEW |