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 1677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1688 if (arrayObject) { | 1688 if (arrayObject) { |
1689 scrollPositionArray.reset(new float[arrayObject->GetCount()]); | 1689 scrollPositionArray.reset(new float[arrayObject->GetCount()]); |
1690 int j = 0; | 1690 int j = 0; |
1691 for (size_t i = 2; i < arrayObject->GetCount(); i++) | 1691 for (size_t i = 2; i < arrayObject->GetCount(); i++) |
1692 scrollPositionArray[j++] = arrayObject->GetFloatAt(i); | 1692 scrollPositionArray[j++] = arrayObject->GetFloatAt(i); |
1693 scrollPositionArraySize = j; | 1693 scrollPositionArraySize = j; |
1694 } | 1694 } |
1695 | 1695 |
1696 pRuntime->BeginBlock(); | 1696 pRuntime->BeginBlock(); |
1697 CPDFSDK_Environment* pApp = m_pDocument->GetEnv(); | 1697 CPDFSDK_Environment* pApp = m_pDocument->GetEnv(); |
1698 pApp->FFI_DoGoToAction(dest.GetPageIndex(pDocument), dest.GetZoomMode(), | 1698 pApp->DoGoToAction(dest.GetPageIndex(pDocument), dest.GetZoomMode(), |
1699 scrollPositionArray.get(), scrollPositionArraySize); | 1699 scrollPositionArray.get(), scrollPositionArraySize); |
1700 pRuntime->EndBlock(); | 1700 pRuntime->EndBlock(); |
1701 | 1701 |
1702 return TRUE; | 1702 return TRUE; |
1703 } | 1703 } |
1704 | 1704 |
1705 void Document::AddDelayData(CJS_DelayData* pData) { | 1705 void Document::AddDelayData(CJS_DelayData* pData) { |
1706 m_DelayData.push_back(std::unique_ptr<CJS_DelayData>(pData)); | 1706 m_DelayData.push_back(std::unique_ptr<CJS_DelayData>(pData)); |
1707 } | 1707 } |
1708 | 1708 |
1709 void Document::DoFieldDelay(const CFX_WideString& sFieldName, | 1709 void Document::DoFieldDelay(const CFX_WideString& sFieldName, |
1710 int nControlIndex) { | 1710 int nControlIndex) { |
1711 std::vector<std::unique_ptr<CJS_DelayData>> DelayDataForFieldAndControlIndex; | 1711 std::vector<std::unique_ptr<CJS_DelayData>> DelayDataForFieldAndControlIndex; |
1712 auto iter = m_DelayData.begin(); | 1712 auto iter = m_DelayData.begin(); |
1713 while (iter != m_DelayData.end()) { | 1713 while (iter != m_DelayData.end()) { |
1714 auto old = iter++; | 1714 auto old = iter++; |
1715 if ((*old)->sFieldName == sFieldName && | 1715 if ((*old)->sFieldName == sFieldName && |
1716 (*old)->nControlIndex == nControlIndex) { | 1716 (*old)->nControlIndex == nControlIndex) { |
1717 DelayDataForFieldAndControlIndex.push_back(std::move(*old)); | 1717 DelayDataForFieldAndControlIndex.push_back(std::move(*old)); |
1718 m_DelayData.erase(old); | 1718 m_DelayData.erase(old); |
1719 } | 1719 } |
1720 } | 1720 } |
1721 | 1721 |
1722 for (const auto& pData : DelayDataForFieldAndControlIndex) | 1722 for (const auto& pData : DelayDataForFieldAndControlIndex) |
1723 Field::DoDelay(m_pDocument.Get(), pData.get()); | 1723 Field::DoDelay(m_pDocument.Get(), pData.get()); |
1724 } | 1724 } |
1725 | 1725 |
1726 CJS_Document* Document::GetCJSDoc() const { | 1726 CJS_Document* Document::GetCJSDoc() const { |
1727 return static_cast<CJS_Document*>(m_pJSObject); | 1727 return static_cast<CJS_Document*>(m_pJSObject); |
1728 } | 1728 } |
OLD | NEW |