John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 1 | // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
Tom Sepez | 7b5bc26 | 2015-03-05 16:44:22 -0800 | [diff] [blame] | 4 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | |
dsinclair | 114e46a | 2016-09-29 17:18:21 -0700 | [diff] [blame] | 7 | #include "fpdfsdk/fsdk_actionhandler.h" |
Dan Sinclair | 3ebd121 | 2016-03-09 09:59:23 -0500 | [diff] [blame] | 8 | |
| 9 | #include <set> |
Tom Sepez | d7188f7 | 2017-05-02 15:10:58 -0700 | [diff] [blame] | 10 | #include <vector> |
Dan Sinclair | 3ebd121 | 2016-03-09 09:59:23 -0500 | [diff] [blame] | 11 | |
dsinclair | 488b7ad | 2016-10-04 11:55:50 -0700 | [diff] [blame] | 12 | #include "core/fpdfapi/parser/cpdf_array.h" |
dsinclair | 1727aee | 2016-09-29 13:12:56 -0700 | [diff] [blame] | 13 | #include "core/fpdfdoc/cpdf_formfield.h" |
| 14 | #include "core/fpdfdoc/cpdf_interform.h" |
dsinclair | 735606d | 2016-10-05 15:47:02 -0700 | [diff] [blame] | 15 | #include "fpdfsdk/cpdfsdk_formfillenvironment.h" |
dsinclair | 114e46a | 2016-09-29 17:18:21 -0700 | [diff] [blame] | 16 | #include "fpdfsdk/cpdfsdk_interform.h" |
| 17 | #include "fpdfsdk/fsdk_define.h" |
Tom Sepez | d6ae2af | 2017-02-16 11:49:55 -0800 | [diff] [blame] | 18 | #include "fpdfsdk/javascript/ijs_event_context.h" |
dsinclair | 64376be | 2016-03-31 20:03:24 -0700 | [diff] [blame] | 19 | #include "fpdfsdk/javascript/ijs_runtime.h" |
Lei Zhang | b45324b | 2017-05-22 17:05:40 -0700 | [diff] [blame] | 20 | #include "third_party/base/logging.h" |
Tom Sepez | 6c7508b | 2016-01-20 14:59:25 -0800 | [diff] [blame] | 21 | #include "third_party/base/stl_util.h" |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 22 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 23 | bool CPDFSDK_ActionHandler::DoAction_DocOpen( |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 24 | const CPDF_Action& action, |
| 25 | CPDFSDK_FormFillEnvironment* pFormFillEnv) { |
Tom Sepez | 6c7508b | 2016-01-20 14:59:25 -0800 | [diff] [blame] | 26 | std::set<CPDF_Dictionary*> visited; |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 27 | return ExecuteDocumentOpenAction(action, pFormFillEnv, &visited); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 28 | } |
| 29 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 30 | bool CPDFSDK_ActionHandler::DoAction_JavaScript( |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 31 | const CPDF_Action& JsAction, |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 32 | WideString csJSName, |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 33 | CPDFSDK_FormFillEnvironment* pFormFillEnv) { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 34 | if (JsAction.GetType() == CPDF_Action::JavaScript) { |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 35 | WideString swJS = JsAction.GetJavaScript(); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 36 | if (!swJS.IsEmpty()) { |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 37 | RunDocumentOpenJavaScript(pFormFillEnv, csJSName, swJS); |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 38 | return true; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 39 | } |
| 40 | } |
| 41 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 42 | return false; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 43 | } |
| 44 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 45 | bool CPDFSDK_ActionHandler::DoAction_FieldJavaScript( |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 46 | const CPDF_Action& JsAction, |
| 47 | CPDF_AAction::AActionType type, |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 48 | CPDFSDK_FormFillEnvironment* pFormFillEnv, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 49 | CPDF_FormField* pFormField, |
| 50 | PDFSDK_FieldAction& data) { |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 51 | ASSERT(pFormFillEnv); |
| 52 | if (pFormFillEnv->IsJSInitiated() && |
| 53 | JsAction.GetType() == CPDF_Action::JavaScript) { |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 54 | WideString swJS = JsAction.GetJavaScript(); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 55 | if (!swJS.IsEmpty()) { |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 56 | RunFieldJavaScript(pFormFillEnv, pFormField, type, data, swJS); |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 57 | return true; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 58 | } |
| 59 | } |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 60 | return false; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 61 | } |
| 62 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 63 | bool CPDFSDK_ActionHandler::DoAction_Page( |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 64 | const CPDF_Action& action, |
| 65 | enum CPDF_AAction::AActionType eType, |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 66 | CPDFSDK_FormFillEnvironment* pFormFillEnv) { |
Tom Sepez | 6c7508b | 2016-01-20 14:59:25 -0800 | [diff] [blame] | 67 | std::set<CPDF_Dictionary*> visited; |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 68 | return ExecuteDocumentPageAction(action, eType, pFormFillEnv, &visited); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 69 | } |
| 70 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 71 | bool CPDFSDK_ActionHandler::DoAction_Document( |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 72 | const CPDF_Action& action, |
| 73 | enum CPDF_AAction::AActionType eType, |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 74 | CPDFSDK_FormFillEnvironment* pFormFillEnv) { |
Tom Sepez | 6c7508b | 2016-01-20 14:59:25 -0800 | [diff] [blame] | 75 | std::set<CPDF_Dictionary*> visited; |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 76 | return ExecuteDocumentPageAction(action, eType, pFormFillEnv, &visited); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 77 | } |
| 78 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 79 | bool CPDFSDK_ActionHandler::DoAction_BookMark( |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 80 | CPDF_Bookmark* pBookMark, |
| 81 | const CPDF_Action& action, |
| 82 | CPDF_AAction::AActionType type, |
| 83 | CPDFSDK_FormFillEnvironment* pFormFillEnv) { |
Tom Sepez | 6c7508b | 2016-01-20 14:59:25 -0800 | [diff] [blame] | 84 | std::set<CPDF_Dictionary*> visited; |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 85 | return ExecuteBookMark(action, pFormFillEnv, pBookMark, &visited); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 86 | } |
| 87 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 88 | bool CPDFSDK_ActionHandler::DoAction_Screen( |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 89 | const CPDF_Action& action, |
| 90 | CPDF_AAction::AActionType type, |
| 91 | CPDFSDK_FormFillEnvironment* pFormFillEnv, |
| 92 | CPDFSDK_Annot* pScreen) { |
Tom Sepez | 6c7508b | 2016-01-20 14:59:25 -0800 | [diff] [blame] | 93 | std::set<CPDF_Dictionary*> visited; |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 94 | return ExecuteScreenAction(action, type, pFormFillEnv, pScreen, &visited); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 95 | } |
| 96 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 97 | bool CPDFSDK_ActionHandler::DoAction_Link( |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 98 | const CPDF_Action& action, |
| 99 | CPDFSDK_FormFillEnvironment* pFormFillEnv) { |
Tom Sepez | 6c7508b | 2016-01-20 14:59:25 -0800 | [diff] [blame] | 100 | std::set<CPDF_Dictionary*> visited; |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 101 | return ExecuteLinkAction(action, pFormFillEnv, &visited); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 102 | } |
| 103 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 104 | bool CPDFSDK_ActionHandler::DoAction_Field( |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 105 | const CPDF_Action& action, |
| 106 | CPDF_AAction::AActionType type, |
| 107 | CPDFSDK_FormFillEnvironment* pFormFillEnv, |
| 108 | CPDF_FormField* pFormField, |
| 109 | PDFSDK_FieldAction& data) { |
Tom Sepez | 6c7508b | 2016-01-20 14:59:25 -0800 | [diff] [blame] | 110 | std::set<CPDF_Dictionary*> visited; |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 111 | return ExecuteFieldAction(action, type, pFormFillEnv, pFormField, data, |
Tom Sepez | 6c7508b | 2016-01-20 14:59:25 -0800 | [diff] [blame] | 112 | &visited); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 113 | } |
| 114 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 115 | bool CPDFSDK_ActionHandler::ExecuteDocumentOpenAction( |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 116 | const CPDF_Action& action, |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 117 | CPDFSDK_FormFillEnvironment* pFormFillEnv, |
Tom Sepez | 6c7508b | 2016-01-20 14:59:25 -0800 | [diff] [blame] | 118 | std::set<CPDF_Dictionary*>* visited) { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 119 | CPDF_Dictionary* pDict = action.GetDict(); |
Tom Sepez | 6c7508b | 2016-01-20 14:59:25 -0800 | [diff] [blame] | 120 | if (pdfium::ContainsKey(*visited, pDict)) |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 121 | return false; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 122 | |
Tom Sepez | 6c7508b | 2016-01-20 14:59:25 -0800 | [diff] [blame] | 123 | visited->insert(pDict); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 124 | |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 125 | ASSERT(pFormFillEnv); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 126 | if (action.GetType() == CPDF_Action::JavaScript) { |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 127 | if (pFormFillEnv->IsJSInitiated()) { |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 128 | WideString swJS = action.GetJavaScript(); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 129 | if (!swJS.IsEmpty()) { |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 130 | RunDocumentOpenJavaScript(pFormFillEnv, L"", swJS); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 131 | } |
| 132 | } |
| 133 | } else { |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 134 | DoAction_NoJs(action, pFormFillEnv); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 135 | } |
| 136 | |
| 137 | for (int32_t i = 0, sz = action.GetSubActionsCount(); i < sz; i++) { |
| 138 | CPDF_Action subaction = action.GetSubAction(i); |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 139 | if (!ExecuteDocumentOpenAction(subaction, pFormFillEnv, visited)) |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 140 | return false; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 141 | } |
| 142 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 143 | return true; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 144 | } |
| 145 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 146 | bool CPDFSDK_ActionHandler::ExecuteLinkAction( |
Tom Sepez | 6c7508b | 2016-01-20 14:59:25 -0800 | [diff] [blame] | 147 | const CPDF_Action& action, |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 148 | CPDFSDK_FormFillEnvironment* pFormFillEnv, |
Tom Sepez | 6c7508b | 2016-01-20 14:59:25 -0800 | [diff] [blame] | 149 | std::set<CPDF_Dictionary*>* visited) { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 150 | CPDF_Dictionary* pDict = action.GetDict(); |
Tom Sepez | 6c7508b | 2016-01-20 14:59:25 -0800 | [diff] [blame] | 151 | if (pdfium::ContainsKey(*visited, pDict)) |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 152 | return false; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 153 | |
Tom Sepez | 6c7508b | 2016-01-20 14:59:25 -0800 | [diff] [blame] | 154 | visited->insert(pDict); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 155 | |
dsinclair | 4526faf | 2016-10-11 10:54:49 -0700 | [diff] [blame] | 156 | ASSERT(pFormFillEnv); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 157 | if (action.GetType() == CPDF_Action::JavaScript) { |
dsinclair | 4526faf | 2016-10-11 10:54:49 -0700 | [diff] [blame] | 158 | if (pFormFillEnv->IsJSInitiated()) { |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 159 | WideString swJS = action.GetJavaScript(); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 160 | if (!swJS.IsEmpty()) { |
dsinclair | 4526faf | 2016-10-11 10:54:49 -0700 | [diff] [blame] | 161 | IJS_Runtime* pRuntime = pFormFillEnv->GetJSRuntime(); |
Tom Sepez | d6ae2af | 2017-02-16 11:49:55 -0800 | [diff] [blame] | 162 | IJS_EventContext* pContext = pRuntime->NewEventContext(); |
dsinclair | 4526faf | 2016-10-11 10:54:49 -0700 | [diff] [blame] | 163 | pContext->OnLink_MouseUp(pFormFillEnv); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 164 | |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 165 | WideString csInfo; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 166 | bool bRet = pContext->RunScript(swJS, &csInfo); |
Tom Sepez | d6ae2af | 2017-02-16 11:49:55 -0800 | [diff] [blame] | 167 | pRuntime->ReleaseEventContext(pContext); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 168 | if (!bRet) { |
| 169 | // FIXME: return error. |
| 170 | } |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 171 | } |
| 172 | } |
| 173 | } else { |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 174 | DoAction_NoJs(action, pFormFillEnv); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 175 | } |
| 176 | |
| 177 | for (int32_t i = 0, sz = action.GetSubActionsCount(); i < sz; i++) { |
| 178 | CPDF_Action subaction = action.GetSubAction(i); |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 179 | if (!ExecuteLinkAction(subaction, pFormFillEnv, visited)) |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 180 | return false; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 181 | } |
| 182 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 183 | return true; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 184 | } |
| 185 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 186 | bool CPDFSDK_ActionHandler::ExecuteDocumentPageAction( |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 187 | const CPDF_Action& action, |
| 188 | CPDF_AAction::AActionType type, |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 189 | CPDFSDK_FormFillEnvironment* pFormFillEnv, |
Tom Sepez | 6c7508b | 2016-01-20 14:59:25 -0800 | [diff] [blame] | 190 | std::set<CPDF_Dictionary*>* visited) { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 191 | CPDF_Dictionary* pDict = action.GetDict(); |
Tom Sepez | 6c7508b | 2016-01-20 14:59:25 -0800 | [diff] [blame] | 192 | if (pdfium::ContainsKey(*visited, pDict)) |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 193 | return false; |
Tom Sepez | 7b5bc26 | 2015-03-05 16:44:22 -0800 | [diff] [blame] | 194 | |
Tom Sepez | 6c7508b | 2016-01-20 14:59:25 -0800 | [diff] [blame] | 195 | visited->insert(pDict); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 196 | |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 197 | ASSERT(pFormFillEnv); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 198 | if (action.GetType() == CPDF_Action::JavaScript) { |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 199 | if (pFormFillEnv->IsJSInitiated()) { |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 200 | WideString swJS = action.GetJavaScript(); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 201 | if (!swJS.IsEmpty()) { |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 202 | RunDocumentPageJavaScript(pFormFillEnv, type, swJS); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 203 | } |
| 204 | } |
| 205 | } else { |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 206 | DoAction_NoJs(action, pFormFillEnv); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 207 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 208 | |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 209 | if (!IsValidDocView(pFormFillEnv)) |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 210 | return false; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 211 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 212 | for (int32_t i = 0, sz = action.GetSubActionsCount(); i < sz; i++) { |
| 213 | CPDF_Action subaction = action.GetSubAction(i); |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 214 | if (!ExecuteDocumentPageAction(subaction, type, pFormFillEnv, visited)) |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 215 | return false; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 216 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 217 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 218 | return true; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 219 | } |
| 220 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 221 | bool CPDFSDK_ActionHandler::IsValidField( |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 222 | CPDFSDK_FormFillEnvironment* pFormFillEnv, |
| 223 | CPDF_Dictionary* pFieldDict) { |
Lei Zhang | 96660d6 | 2015-12-14 18:27:25 -0800 | [diff] [blame] | 224 | ASSERT(pFieldDict); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 225 | |
dsinclair | 7cbe68e | 2016-10-12 11:56:23 -0700 | [diff] [blame] | 226 | CPDFSDK_InterForm* pInterForm = pFormFillEnv->GetInterForm(); |
Chris Palmer | 9047b8b | 2014-08-06 14:17:45 -0700 | [diff] [blame] | 227 | CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm(); |
thestig | 1cd352e | 2016-06-07 17:53:06 -0700 | [diff] [blame] | 228 | return !!pPDFInterForm->GetFieldByDict(pFieldDict); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 229 | } |
| 230 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 231 | bool CPDFSDK_ActionHandler::ExecuteFieldAction( |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 232 | const CPDF_Action& action, |
| 233 | CPDF_AAction::AActionType type, |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 234 | CPDFSDK_FormFillEnvironment* pFormFillEnv, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 235 | CPDF_FormField* pFormField, |
| 236 | PDFSDK_FieldAction& data, |
Tom Sepez | 6c7508b | 2016-01-20 14:59:25 -0800 | [diff] [blame] | 237 | std::set<CPDF_Dictionary*>* visited) { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 238 | CPDF_Dictionary* pDict = action.GetDict(); |
Tom Sepez | 6c7508b | 2016-01-20 14:59:25 -0800 | [diff] [blame] | 239 | if (pdfium::ContainsKey(*visited, pDict)) |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 240 | return false; |
Tom Sepez | 7b5bc26 | 2015-03-05 16:44:22 -0800 | [diff] [blame] | 241 | |
Tom Sepez | 6c7508b | 2016-01-20 14:59:25 -0800 | [diff] [blame] | 242 | visited->insert(pDict); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 243 | |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 244 | ASSERT(pFormFillEnv); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 245 | if (action.GetType() == CPDF_Action::JavaScript) { |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 246 | if (pFormFillEnv->IsJSInitiated()) { |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 247 | WideString swJS = action.GetJavaScript(); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 248 | if (!swJS.IsEmpty()) { |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 249 | RunFieldJavaScript(pFormFillEnv, pFormField, type, data, swJS); |
| 250 | if (!IsValidField(pFormFillEnv, pFormField->GetFieldDict())) |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 251 | return false; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 252 | } |
| 253 | } |
| 254 | } else { |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 255 | DoAction_NoJs(action, pFormFillEnv); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 256 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 257 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 258 | for (int32_t i = 0, sz = action.GetSubActionsCount(); i < sz; i++) { |
| 259 | CPDF_Action subaction = action.GetSubAction(i); |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 260 | if (!ExecuteFieldAction(subaction, type, pFormFillEnv, pFormField, data, |
Tom Sepez | 6c7508b | 2016-01-20 14:59:25 -0800 | [diff] [blame] | 261 | visited)) |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 262 | return false; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 263 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 264 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 265 | return true; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 266 | } |
| 267 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 268 | bool CPDFSDK_ActionHandler::ExecuteScreenAction( |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 269 | const CPDF_Action& action, |
| 270 | CPDF_AAction::AActionType type, |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 271 | CPDFSDK_FormFillEnvironment* pFormFillEnv, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 272 | CPDFSDK_Annot* pScreen, |
Tom Sepez | 6c7508b | 2016-01-20 14:59:25 -0800 | [diff] [blame] | 273 | std::set<CPDF_Dictionary*>* visited) { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 274 | CPDF_Dictionary* pDict = action.GetDict(); |
Tom Sepez | 6c7508b | 2016-01-20 14:59:25 -0800 | [diff] [blame] | 275 | if (pdfium::ContainsKey(*visited, pDict)) |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 276 | return false; |
Tom Sepez | 7b5bc26 | 2015-03-05 16:44:22 -0800 | [diff] [blame] | 277 | |
Tom Sepez | 6c7508b | 2016-01-20 14:59:25 -0800 | [diff] [blame] | 278 | visited->insert(pDict); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 279 | |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 280 | ASSERT(pFormFillEnv); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 281 | if (action.GetType() == CPDF_Action::JavaScript) { |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 282 | if (pFormFillEnv->IsJSInitiated()) { |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 283 | WideString swJS = action.GetJavaScript(); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 284 | if (!swJS.IsEmpty()) { |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 285 | IJS_Runtime* pRuntime = pFormFillEnv->GetJSRuntime(); |
Tom Sepez | d6ae2af | 2017-02-16 11:49:55 -0800 | [diff] [blame] | 286 | IJS_EventContext* pContext = pRuntime->NewEventContext(); |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 287 | WideString csInfo; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 288 | bool bRet = pContext->RunScript(swJS, &csInfo); |
Tom Sepez | d6ae2af | 2017-02-16 11:49:55 -0800 | [diff] [blame] | 289 | pRuntime->ReleaseEventContext(pContext); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 290 | if (!bRet) { |
Tom Sepez | 3342090 | 2015-10-13 15:00:10 -0700 | [diff] [blame] | 291 | // FIXME: return error. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 292 | } |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 293 | } |
| 294 | } |
| 295 | } else { |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 296 | DoAction_NoJs(action, pFormFillEnv); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 297 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 298 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 299 | for (int32_t i = 0, sz = action.GetSubActionsCount(); i < sz; i++) { |
| 300 | CPDF_Action subaction = action.GetSubAction(i); |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 301 | if (!ExecuteScreenAction(subaction, type, pFormFillEnv, pScreen, visited)) |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 302 | return false; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 303 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 304 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 305 | return true; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 306 | } |
| 307 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 308 | bool CPDFSDK_ActionHandler::ExecuteBookMark( |
Tom Sepez | 6c7508b | 2016-01-20 14:59:25 -0800 | [diff] [blame] | 309 | const CPDF_Action& action, |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 310 | CPDFSDK_FormFillEnvironment* pFormFillEnv, |
Tom Sepez | 6c7508b | 2016-01-20 14:59:25 -0800 | [diff] [blame] | 311 | CPDF_Bookmark* pBookmark, |
| 312 | std::set<CPDF_Dictionary*>* visited) { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 313 | CPDF_Dictionary* pDict = action.GetDict(); |
Tom Sepez | 6c7508b | 2016-01-20 14:59:25 -0800 | [diff] [blame] | 314 | if (pdfium::ContainsKey(*visited, pDict)) |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 315 | return false; |
Tom Sepez | 7b5bc26 | 2015-03-05 16:44:22 -0800 | [diff] [blame] | 316 | |
Tom Sepez | 6c7508b | 2016-01-20 14:59:25 -0800 | [diff] [blame] | 317 | visited->insert(pDict); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 318 | |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 319 | ASSERT(pFormFillEnv); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 320 | if (action.GetType() == CPDF_Action::JavaScript) { |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 321 | if (pFormFillEnv->IsJSInitiated()) { |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 322 | WideString swJS = action.GetJavaScript(); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 323 | if (!swJS.IsEmpty()) { |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 324 | IJS_Runtime* pRuntime = pFormFillEnv->GetJSRuntime(); |
Tom Sepez | d6ae2af | 2017-02-16 11:49:55 -0800 | [diff] [blame] | 325 | IJS_EventContext* pContext = pRuntime->NewEventContext(); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 326 | pContext->OnBookmark_MouseUp(pBookmark); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 327 | |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 328 | WideString csInfo; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 329 | bool bRet = pContext->RunScript(swJS, &csInfo); |
Tom Sepez | d6ae2af | 2017-02-16 11:49:55 -0800 | [diff] [blame] | 330 | pRuntime->ReleaseEventContext(pContext); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 331 | if (!bRet) { |
Tom Sepez | 3342090 | 2015-10-13 15:00:10 -0700 | [diff] [blame] | 332 | // FIXME: return error. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 333 | } |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 334 | } |
| 335 | } |
| 336 | } else { |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 337 | DoAction_NoJs(action, pFormFillEnv); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 338 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 339 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 340 | for (int32_t i = 0, sz = action.GetSubActionsCount(); i < sz; i++) { |
| 341 | CPDF_Action subaction = action.GetSubAction(i); |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 342 | if (!ExecuteBookMark(subaction, pFormFillEnv, pBookmark, visited)) |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 343 | return false; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 344 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 345 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 346 | return true; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 347 | } |
| 348 | |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 349 | void CPDFSDK_ActionHandler::DoAction_NoJs( |
| 350 | const CPDF_Action& action, |
| 351 | CPDFSDK_FormFillEnvironment* pFormFillEnv) { |
| 352 | ASSERT(pFormFillEnv); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 353 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 354 | switch (action.GetType()) { |
| 355 | case CPDF_Action::GoTo: |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 356 | DoAction_GoTo(pFormFillEnv, action); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 357 | break; |
| 358 | case CPDF_Action::GoToR: |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 359 | DoAction_GoToR(pFormFillEnv, action); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 360 | break; |
| 361 | case CPDF_Action::GoToE: |
| 362 | break; |
| 363 | case CPDF_Action::Launch: |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 364 | DoAction_Launch(pFormFillEnv, action); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 365 | break; |
| 366 | case CPDF_Action::Thread: |
| 367 | break; |
| 368 | case CPDF_Action::URI: |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 369 | DoAction_URI(pFormFillEnv, action); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 370 | break; |
| 371 | case CPDF_Action::Sound: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 372 | break; |
| 373 | case CPDF_Action::Movie: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 374 | break; |
| 375 | case CPDF_Action::Hide: |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 376 | DoAction_Hide(action, pFormFillEnv); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 377 | break; |
| 378 | case CPDF_Action::Named: |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 379 | DoAction_Named(pFormFillEnv, action); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 380 | break; |
| 381 | case CPDF_Action::SubmitForm: |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 382 | DoAction_SubmitForm(action, pFormFillEnv); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 383 | break; |
| 384 | case CPDF_Action::ResetForm: |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 385 | DoAction_ResetForm(action, pFormFillEnv); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 386 | break; |
| 387 | case CPDF_Action::ImportData: |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 388 | DoAction_ImportData(action, pFormFillEnv); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 389 | break; |
| 390 | case CPDF_Action::JavaScript: |
Lei Zhang | b45324b | 2017-05-22 17:05:40 -0700 | [diff] [blame] | 391 | NOTREACHED(); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 392 | break; |
| 393 | case CPDF_Action::SetOCGState: |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 394 | DoAction_SetOCGState(pFormFillEnv, action); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 395 | break; |
| 396 | case CPDF_Action::Rendition: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 397 | break; |
| 398 | case CPDF_Action::Trans: |
| 399 | break; |
| 400 | case CPDF_Action::GoTo3DView: |
| 401 | break; |
| 402 | default: |
| 403 | break; |
| 404 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 405 | } |
| 406 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 407 | bool CPDFSDK_ActionHandler::IsValidDocView( |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 408 | CPDFSDK_FormFillEnvironment* pFormFillEnv) { |
| 409 | ASSERT(pFormFillEnv); |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 410 | return true; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 411 | } |
| 412 | |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 413 | void CPDFSDK_ActionHandler::DoAction_GoTo( |
| 414 | CPDFSDK_FormFillEnvironment* pFormFillEnv, |
| 415 | const CPDF_Action& action) { |
Wei Li | 0fc6b25 | 2016-03-01 16:29:41 -0800 | [diff] [blame] | 416 | ASSERT(action.GetDict()); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 417 | |
dsinclair | 7cbe68e | 2016-10-12 11:56:23 -0700 | [diff] [blame] | 418 | CPDF_Document* pPDFDocument = pFormFillEnv->GetPDFDocument(); |
Dan Sinclair | 2b11dc1 | 2015-10-22 15:02:06 -0400 | [diff] [blame] | 419 | ASSERT(pPDFDocument); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 420 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 421 | CPDF_Dest MyDest = action.GetDest(pPDFDocument); |
| 422 | int nPageIndex = MyDest.GetPageIndex(pPDFDocument); |
| 423 | int nFitType = MyDest.GetZoomMode(); |
Dan Sinclair | 2b11dc1 | 2015-10-22 15:02:06 -0400 | [diff] [blame] | 424 | const CPDF_Array* pMyArray = ToArray(MyDest.GetObject()); |
Tom Sepez | d7188f7 | 2017-05-02 15:10:58 -0700 | [diff] [blame] | 425 | std::vector<float> posArray; |
Dan Sinclair | 2b11dc1 | 2015-10-22 15:02:06 -0400 | [diff] [blame] | 426 | if (pMyArray) { |
Tom Sepez | d7188f7 | 2017-05-02 15:10:58 -0700 | [diff] [blame] | 427 | for (size_t i = 2; i < pMyArray->GetCount(); i++) |
| 428 | posArray.push_back(pMyArray->GetFloatAt(i)); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 429 | } |
Tom Sepez | d7188f7 | 2017-05-02 15:10:58 -0700 | [diff] [blame] | 430 | pFormFillEnv->DoGoToAction(nPageIndex, nFitType, posArray.data(), |
| 431 | posArray.size()); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 432 | } |
| 433 | |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 434 | void CPDFSDK_ActionHandler::DoAction_GoToR( |
| 435 | CPDFSDK_FormFillEnvironment* pFormFillEnv, |
| 436 | const CPDF_Action& action) {} |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 437 | |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 438 | void CPDFSDK_ActionHandler::DoAction_Launch( |
| 439 | CPDFSDK_FormFillEnvironment* pFormFillEnv, |
| 440 | const CPDF_Action& action) {} |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 441 | |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 442 | void CPDFSDK_ActionHandler::DoAction_URI( |
| 443 | CPDFSDK_FormFillEnvironment* pFormFillEnv, |
| 444 | const CPDF_Action& action) { |
Wei Li | 0fc6b25 | 2016-03-01 16:29:41 -0800 | [diff] [blame] | 445 | ASSERT(action.GetDict()); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 446 | |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 447 | ByteString sURI = action.GetURI(pFormFillEnv->GetPDFDocument()); |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 448 | pFormFillEnv->DoURIAction(sURI.c_str()); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 449 | } |
| 450 | |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 451 | void CPDFSDK_ActionHandler::DoAction_Named( |
| 452 | CPDFSDK_FormFillEnvironment* pFormFillEnv, |
| 453 | const CPDF_Action& action) { |
Wei Li | 0fc6b25 | 2016-03-01 16:29:41 -0800 | [diff] [blame] | 454 | ASSERT(action.GetDict()); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 455 | |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 456 | ByteString csName = action.GetNamedAction(); |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 457 | pFormFillEnv->ExecuteNamedAction(csName.c_str()); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 458 | } |
| 459 | |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 460 | void CPDFSDK_ActionHandler::DoAction_SetOCGState( |
| 461 | CPDFSDK_FormFillEnvironment* pFormFillEnv, |
| 462 | const CPDF_Action& action) {} |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 463 | |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 464 | void CPDFSDK_ActionHandler::RunFieldJavaScript( |
| 465 | CPDFSDK_FormFillEnvironment* pFormFillEnv, |
| 466 | CPDF_FormField* pFormField, |
| 467 | CPDF_AAction::AActionType type, |
| 468 | PDFSDK_FieldAction& data, |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 469 | const WideString& script) { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 470 | ASSERT(type != CPDF_AAction::Calculate); |
| 471 | ASSERT(type != CPDF_AAction::Format); |
Tom Sepez | d7e5cc7 | 2015-06-10 14:33:37 -0700 | [diff] [blame] | 472 | |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 473 | IJS_Runtime* pRuntime = pFormFillEnv->GetJSRuntime(); |
Tom Sepez | d6ae2af | 2017-02-16 11:49:55 -0800 | [diff] [blame] | 474 | IJS_EventContext* pContext = pRuntime->NewEventContext(); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 475 | switch (type) { |
| 476 | case CPDF_AAction::CursorEnter: |
| 477 | pContext->OnField_MouseEnter(data.bModifier, data.bShift, pFormField); |
| 478 | break; |
| 479 | case CPDF_AAction::CursorExit: |
| 480 | pContext->OnField_MouseExit(data.bModifier, data.bShift, pFormField); |
| 481 | break; |
| 482 | case CPDF_AAction::ButtonDown: |
| 483 | pContext->OnField_MouseDown(data.bModifier, data.bShift, pFormField); |
| 484 | break; |
| 485 | case CPDF_AAction::ButtonUp: |
| 486 | pContext->OnField_MouseUp(data.bModifier, data.bShift, pFormField); |
| 487 | break; |
| 488 | case CPDF_AAction::GetFocus: |
| 489 | pContext->OnField_Focus(data.bModifier, data.bShift, pFormField, |
| 490 | data.sValue); |
| 491 | break; |
| 492 | case CPDF_AAction::LoseFocus: |
| 493 | pContext->OnField_Blur(data.bModifier, data.bShift, pFormField, |
| 494 | data.sValue); |
| 495 | break; |
| 496 | case CPDF_AAction::KeyStroke: |
| 497 | pContext->OnField_Keystroke(data.sChange, data.sChangeEx, data.bKeyDown, |
| 498 | data.bModifier, data.nSelEnd, data.nSelStart, |
| 499 | data.bShift, pFormField, data.sValue, |
| 500 | data.bWillCommit, data.bFieldFull, data.bRC); |
| 501 | break; |
| 502 | case CPDF_AAction::Validate: |
| 503 | pContext->OnField_Validate(data.sChange, data.sChangeEx, data.bKeyDown, |
| 504 | data.bModifier, data.bShift, pFormField, |
| 505 | data.sValue, data.bRC); |
| 506 | break; |
| 507 | default: |
Lei Zhang | b45324b | 2017-05-22 17:05:40 -0700 | [diff] [blame] | 508 | NOTREACHED(); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 509 | break; |
| 510 | } |
| 511 | |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 512 | WideString csInfo; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 513 | bool bRet = pContext->RunScript(script, &csInfo); |
Tom Sepez | d6ae2af | 2017-02-16 11:49:55 -0800 | [diff] [blame] | 514 | pRuntime->ReleaseEventContext(pContext); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 515 | if (!bRet) { |
Tom Sepez | 3342090 | 2015-10-13 15:00:10 -0700 | [diff] [blame] | 516 | // FIXME: return error. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 517 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 518 | } |
| 519 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 520 | void CPDFSDK_ActionHandler::RunDocumentOpenJavaScript( |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 521 | CPDFSDK_FormFillEnvironment* pFormFillEnv, |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 522 | const WideString& sScriptName, |
| 523 | const WideString& script) { |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 524 | IJS_Runtime* pRuntime = pFormFillEnv->GetJSRuntime(); |
Tom Sepez | d6ae2af | 2017-02-16 11:49:55 -0800 | [diff] [blame] | 525 | IJS_EventContext* pContext = pRuntime->NewEventContext(); |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 526 | pContext->OnDoc_Open(pFormFillEnv, sScriptName); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 527 | |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 528 | WideString csInfo; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 529 | bool bRet = pContext->RunScript(script, &csInfo); |
Tom Sepez | d6ae2af | 2017-02-16 11:49:55 -0800 | [diff] [blame] | 530 | pRuntime->ReleaseEventContext(pContext); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 531 | if (!bRet) { |
Tom Sepez | 3342090 | 2015-10-13 15:00:10 -0700 | [diff] [blame] | 532 | // FIXME: return error. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 533 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 534 | } |
| 535 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 536 | void CPDFSDK_ActionHandler::RunDocumentPageJavaScript( |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 537 | CPDFSDK_FormFillEnvironment* pFormFillEnv, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 538 | CPDF_AAction::AActionType type, |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 539 | const WideString& script) { |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 540 | IJS_Runtime* pRuntime = pFormFillEnv->GetJSRuntime(); |
Tom Sepez | d6ae2af | 2017-02-16 11:49:55 -0800 | [diff] [blame] | 541 | IJS_EventContext* pContext = pRuntime->NewEventContext(); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 542 | switch (type) { |
| 543 | case CPDF_AAction::OpenPage: |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 544 | pContext->OnPage_Open(pFormFillEnv); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 545 | break; |
| 546 | case CPDF_AAction::ClosePage: |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 547 | pContext->OnPage_Close(pFormFillEnv); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 548 | break; |
| 549 | case CPDF_AAction::CloseDocument: |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 550 | pContext->OnDoc_WillClose(pFormFillEnv); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 551 | break; |
| 552 | case CPDF_AAction::SaveDocument: |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 553 | pContext->OnDoc_WillSave(pFormFillEnv); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 554 | break; |
| 555 | case CPDF_AAction::DocumentSaved: |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 556 | pContext->OnDoc_DidSave(pFormFillEnv); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 557 | break; |
| 558 | case CPDF_AAction::PrintDocument: |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 559 | pContext->OnDoc_WillPrint(pFormFillEnv); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 560 | break; |
| 561 | case CPDF_AAction::DocumentPrinted: |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 562 | pContext->OnDoc_DidPrint(pFormFillEnv); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 563 | break; |
| 564 | case CPDF_AAction::PageVisible: |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 565 | pContext->OnPage_InView(pFormFillEnv); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 566 | break; |
| 567 | case CPDF_AAction::PageInvisible: |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 568 | pContext->OnPage_OutView(pFormFillEnv); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 569 | break; |
| 570 | default: |
Lei Zhang | b45324b | 2017-05-22 17:05:40 -0700 | [diff] [blame] | 571 | NOTREACHED(); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 572 | break; |
| 573 | } |
| 574 | |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 575 | WideString csInfo; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 576 | bool bRet = pContext->RunScript(script, &csInfo); |
Tom Sepez | d6ae2af | 2017-02-16 11:49:55 -0800 | [diff] [blame] | 577 | pRuntime->ReleaseEventContext(pContext); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 578 | if (!bRet) { |
Tom Sepez | 3342090 | 2015-10-13 15:00:10 -0700 | [diff] [blame] | 579 | // FIXME: return error. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 580 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 581 | } |
| 582 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 583 | bool CPDFSDK_ActionHandler::DoAction_Hide( |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 584 | const CPDF_Action& action, |
| 585 | CPDFSDK_FormFillEnvironment* pFormFillEnv) { |
dsinclair | 7cbe68e | 2016-10-12 11:56:23 -0700 | [diff] [blame] | 586 | CPDFSDK_InterForm* pInterForm = pFormFillEnv->GetInterForm(); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 587 | if (pInterForm->DoAction_Hide(action)) { |
dsinclair | 7cbe68e | 2016-10-12 11:56:23 -0700 | [diff] [blame] | 588 | pFormFillEnv->SetChangeMark(); |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 589 | return true; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 590 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 591 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 592 | return false; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 593 | } |
| 594 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 595 | bool CPDFSDK_ActionHandler::DoAction_SubmitForm( |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 596 | const CPDF_Action& action, |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 597 | CPDFSDK_FormFillEnvironment* pFormFillEnv) { |
dsinclair | 7cbe68e | 2016-10-12 11:56:23 -0700 | [diff] [blame] | 598 | CPDFSDK_InterForm* pInterForm = pFormFillEnv->GetInterForm(); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 599 | return pInterForm->DoAction_SubmitForm(action); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 600 | } |
| 601 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 602 | bool CPDFSDK_ActionHandler::DoAction_ResetForm( |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 603 | const CPDF_Action& action, |
| 604 | CPDFSDK_FormFillEnvironment* pFormFillEnv) { |
dsinclair | 7cbe68e | 2016-10-12 11:56:23 -0700 | [diff] [blame] | 605 | CPDFSDK_InterForm* pInterForm = pFormFillEnv->GetInterForm(); |
Lei Zhang | 96660d6 | 2015-12-14 18:27:25 -0800 | [diff] [blame] | 606 | return pInterForm->DoAction_ResetForm(action); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 607 | } |
| 608 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 609 | bool CPDFSDK_ActionHandler::DoAction_ImportData( |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 610 | const CPDF_Action& action, |
dsinclair | 19c198b | 2016-10-11 12:51:37 -0700 | [diff] [blame] | 611 | CPDFSDK_FormFillEnvironment* pFormFillEnv) { |
dsinclair | 7cbe68e | 2016-10-12 11:56:23 -0700 | [diff] [blame] | 612 | CPDFSDK_InterForm* pInterForm = pFormFillEnv->GetInterForm(); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 613 | if (pInterForm->DoAction_ImportData(action)) { |
dsinclair | 7cbe68e | 2016-10-12 11:56:23 -0700 | [diff] [blame] | 614 | pFormFillEnv->SetChangeMark(); |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 615 | return true; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 616 | } |
Tom Sepez | 7b5bc26 | 2015-03-05 16:44:22 -0800 | [diff] [blame] | 617 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 618 | return false; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 619 | } |