| 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 <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 if (CPDFDoc_Environment* pEnv = m_pDocument->GetEnv()) { | 456 if (CPDFDoc_Environment* pEnv = m_pDocument->GetEnv()) { |
| 457 pEnv->JS_docprint(bUI, nStart, nEnd, bSilent, bShrinkToFit, bPrintAsImage, | 457 pEnv->JS_docprint(bUI, nStart, nEnd, bSilent, bShrinkToFit, bPrintAsImage, |
| 458 bReverse, bAnnotations); | 458 bReverse, bAnnotations); |
| 459 return TRUE; | 459 return TRUE; |
| 460 } | 460 } |
| 461 return FALSE; | 461 return FALSE; |
| 462 } | 462 } |
| 463 | 463 |
| 464 // removes the specified field from the document. | 464 // removes the specified field from the document. |
| 465 // comment: | 465 // comment: |
| 466 // note: if the filed name is not retional, adobe is dumb for it. | 466 // note: if the filed name is not rational, adobe is dumb for it. |
| 467 | 467 |
| 468 FX_BOOL Document::removeField(IJS_Context* cc, | 468 FX_BOOL Document::removeField(IJS_Context* cc, |
| 469 const std::vector<CJS_Value>& params, | 469 const std::vector<CJS_Value>& params, |
| 470 CJS_Value& vRet, | 470 CJS_Value& vRet, |
| 471 CFX_WideString& sError) { | 471 CFX_WideString& sError) { |
| 472 if (!(m_pDocument->GetPermissions(FPDFPERM_MODIFY) || | 472 if (!(m_pDocument->GetPermissions(FPDFPERM_MODIFY) || |
| 473 m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM))) | 473 m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM))) |
| 474 return FALSE; | 474 return FALSE; |
| 475 | 475 |
| 476 CJS_Context* pContext = static_cast<CJS_Context*>(cc); | 476 CJS_Context* pContext = static_cast<CJS_Context*>(cc); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 493 CFX_FloatRect rcAnnot = pWidget->GetRect(); | 493 CFX_FloatRect rcAnnot = pWidget->GetRect(); |
| 494 --rcAnnot.left; | 494 --rcAnnot.left; |
| 495 --rcAnnot.bottom; | 495 --rcAnnot.bottom; |
| 496 ++rcAnnot.right; | 496 ++rcAnnot.right; |
| 497 ++rcAnnot.top; | 497 ++rcAnnot.top; |
| 498 | 498 |
| 499 std::vector<CFX_FloatRect> aRefresh(1, rcAnnot); | 499 std::vector<CFX_FloatRect> aRefresh(1, rcAnnot); |
| 500 UnderlyingPageType* pPage = pWidget->GetUnderlyingPage(); | 500 UnderlyingPageType* pPage = pWidget->GetUnderlyingPage(); |
| 501 ASSERT(pPage); | 501 ASSERT(pPage); |
| 502 | 502 |
| 503 CPDFSDK_PageView* pPageView = m_pDocument->GetPageView(pPage, true); | 503 // If there is currently no pageview associated with the page being used |
| 504 pPageView->DeleteAnnot(pWidget); | 504 // do not create one. We may be in the process of tearing down the document |
| 505 pPageView->UpdateRects(aRefresh); | 505 // and creating a new pageview at this point will cause bad things. |
| 506 CPDFSDK_PageView* pPageView = m_pDocument->GetPageView(pPage, false); |
| 507 if (pPageView) { |
| 508 pPageView->DeleteAnnot(pWidget); |
| 509 pPageView->UpdateRects(aRefresh); |
| 510 } |
| 506 } | 511 } |
| 507 m_pDocument->SetChangeMark(); | 512 m_pDocument->SetChangeMark(); |
| 508 | 513 |
| 509 return TRUE; | 514 return TRUE; |
| 510 } | 515 } |
| 511 | 516 |
| 512 // reset filed values within a document. | 517 // reset filed values within a document. |
| 513 // comment: | 518 // comment: |
| 514 // note: if the fields names r not rational, aodbe is dumb for it. | 519 // note: if the fields names r not rational, aodbe is dumb for it. |
| 515 | 520 |
| (...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1649 } | 1654 } |
| 1650 } | 1655 } |
| 1651 | 1656 |
| 1652 for (const auto& pData : DelayDataForFieldAndControlIndex) | 1657 for (const auto& pData : DelayDataForFieldAndControlIndex) |
| 1653 Field::DoDelay(m_pDocument, pData.get()); | 1658 Field::DoDelay(m_pDocument, pData.get()); |
| 1654 } | 1659 } |
| 1655 | 1660 |
| 1656 CJS_Document* Document::GetCJSDoc() const { | 1661 CJS_Document* Document::GetCJSDoc() const { |
| 1657 return static_cast<CJS_Document*>(m_pJSObject); | 1662 return static_cast<CJS_Document*>(m_pJSObject); |
| 1658 } | 1663 } |
| OLD | NEW |