Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: fpdfsdk/src/javascript/JS_EventHandler.cpp

Issue 1512763013: Get rid of most instance of 'foo != NULL' (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: nits Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/src/javascript/JS_Context.cpp ('k') | fpdfsdk/src/javascript/JS_GlobalData.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "JS_EventHandler.h" 7 #include "JS_EventHandler.h"
8 8
9 #include "Document.h" 9 #include "Document.h"
10 #include "Field.h" 10 #include "Field.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 } 108 }
109 109
110 void CJS_EventHandler::OnField_MouseEnter(FX_BOOL bModifier, 110 void CJS_EventHandler::OnField_MouseEnter(FX_BOOL bModifier,
111 FX_BOOL bShift, 111 FX_BOOL bShift,
112 CPDF_FormField* pTarget) { 112 CPDF_FormField* pTarget) {
113 Initial(JET_FIELD_MOUSEENTER); 113 Initial(JET_FIELD_MOUSEENTER);
114 114
115 m_bModifier = bModifier; 115 m_bModifier = bModifier;
116 m_bShift = bShift; 116 m_bShift = bShift;
117 117
118 ASSERT(pTarget != NULL);
119 m_strTargetName = pTarget->GetFullName(); 118 m_strTargetName = pTarget->GetFullName();
120 } 119 }
121 120
122 void CJS_EventHandler::OnField_MouseExit(FX_BOOL bModifier, 121 void CJS_EventHandler::OnField_MouseExit(FX_BOOL bModifier,
123 FX_BOOL bShift, 122 FX_BOOL bShift,
124 CPDF_FormField* pTarget) { 123 CPDF_FormField* pTarget) {
125 Initial(JET_FIELD_MOUSEEXIT); 124 Initial(JET_FIELD_MOUSEEXIT);
126 125
127 m_bModifier = bModifier; 126 m_bModifier = bModifier;
128 m_bShift = bShift; 127 m_bShift = bShift;
129 ASSERT(pTarget != NULL);
130 m_strTargetName = pTarget->GetFullName(); 128 m_strTargetName = pTarget->GetFullName();
131 } 129 }
132 130
133 void CJS_EventHandler::OnField_MouseDown(FX_BOOL bModifier, 131 void CJS_EventHandler::OnField_MouseDown(FX_BOOL bModifier,
134 FX_BOOL bShift, 132 FX_BOOL bShift,
135 CPDF_FormField* pTarget) { 133 CPDF_FormField* pTarget) {
136 Initial(JET_FIELD_MOUSEDOWN); 134 Initial(JET_FIELD_MOUSEDOWN);
137 m_eEventType = JET_FIELD_MOUSEDOWN; 135 m_eEventType = JET_FIELD_MOUSEDOWN;
138 136
139 m_bModifier = bModifier; 137 m_bModifier = bModifier;
140 m_bShift = bShift; 138 m_bShift = bShift;
141 ASSERT(pTarget != NULL);
142 m_strTargetName = pTarget->GetFullName(); 139 m_strTargetName = pTarget->GetFullName();
143 } 140 }
144 141
145 void CJS_EventHandler::OnField_MouseUp(FX_BOOL bModifier, 142 void CJS_EventHandler::OnField_MouseUp(FX_BOOL bModifier,
146 FX_BOOL bShift, 143 FX_BOOL bShift,
147 CPDF_FormField* pTarget) { 144 CPDF_FormField* pTarget) {
148 Initial(JET_FIELD_MOUSEUP); 145 Initial(JET_FIELD_MOUSEUP);
149 146
150 m_bModifier = bModifier; 147 m_bModifier = bModifier;
151 m_bShift = bShift; 148 m_bShift = bShift;
152 ASSERT(pTarget != NULL);
153 m_strTargetName = pTarget->GetFullName(); 149 m_strTargetName = pTarget->GetFullName();
154 } 150 }
155 151
156 void CJS_EventHandler::OnField_Focus(FX_BOOL bModifier, 152 void CJS_EventHandler::OnField_Focus(FX_BOOL bModifier,
157 FX_BOOL bShift, 153 FX_BOOL bShift,
158 CPDF_FormField* pTarget, 154 CPDF_FormField* pTarget,
159 const CFX_WideString& Value) { 155 const CFX_WideString& Value) {
160 Initial(JET_FIELD_FOCUS); 156 Initial(JET_FIELD_FOCUS);
161 157
162 m_bModifier = bModifier; 158 m_bModifier = bModifier;
163 m_bShift = bShift; 159 m_bShift = bShift;
164 ASSERT(pTarget != NULL);
165 m_strTargetName = pTarget->GetFullName(); 160 m_strTargetName = pTarget->GetFullName();
166 m_pValue = (CFX_WideString*)&Value; 161 m_pValue = (CFX_WideString*)&Value;
167 } 162 }
168 163
169 void CJS_EventHandler::OnField_Blur(FX_BOOL bModifier, 164 void CJS_EventHandler::OnField_Blur(FX_BOOL bModifier,
170 FX_BOOL bShift, 165 FX_BOOL bShift,
171 CPDF_FormField* pTarget, 166 CPDF_FormField* pTarget,
172 const CFX_WideString& Value) { 167 const CFX_WideString& Value) {
173 Initial(JET_FIELD_BLUR); 168 Initial(JET_FIELD_BLUR);
174 169
175 m_bModifier = bModifier; 170 m_bModifier = bModifier;
176 m_bShift = bShift; 171 m_bShift = bShift;
177 ASSERT(pTarget != NULL);
178 m_strTargetName = pTarget->GetFullName(); 172 m_strTargetName = pTarget->GetFullName();
179 m_pValue = (CFX_WideString*)&Value; 173 m_pValue = (CFX_WideString*)&Value;
180 } 174 }
181 175
182 void CJS_EventHandler::OnField_Keystroke(CFX_WideString& strChange, 176 void CJS_EventHandler::OnField_Keystroke(CFX_WideString& strChange,
183 const CFX_WideString& strChangeEx, 177 const CFX_WideString& strChangeEx,
184 FX_BOOL KeyDown, 178 FX_BOOL KeyDown,
185 FX_BOOL bModifier, 179 FX_BOOL bModifier,
186 int& nSelEnd, 180 int& nSelEnd,
187 int& nSelStart, 181 int& nSelStart,
188 FX_BOOL bShift, 182 FX_BOOL bShift,
189 CPDF_FormField* pTarget, 183 CPDF_FormField* pTarget,
190 CFX_WideString& Value, 184 CFX_WideString& Value,
191 FX_BOOL bWillCommit, 185 FX_BOOL bWillCommit,
192 FX_BOOL bFieldFull, 186 FX_BOOL bFieldFull,
193 FX_BOOL& bRc) { 187 FX_BOOL& bRc) {
194 Initial(JET_FIELD_KEYSTROKE); 188 Initial(JET_FIELD_KEYSTROKE);
195 189
196 m_nCommitKey = 0; 190 m_nCommitKey = 0;
197 m_pWideStrChange = &strChange; 191 m_pWideStrChange = &strChange;
198 m_WideStrChangeEx = strChangeEx; 192 m_WideStrChangeEx = strChangeEx;
199 m_bKeyDown = KeyDown; 193 m_bKeyDown = KeyDown;
200 m_bModifier = bModifier; 194 m_bModifier = bModifier;
201 m_pISelEnd = &nSelEnd; 195 m_pISelEnd = &nSelEnd;
202 m_pISelStart = &nSelStart; 196 m_pISelStart = &nSelStart;
203 m_bShift = bShift; 197 m_bShift = bShift;
204 ASSERT(pTarget != NULL);
205 m_strTargetName = pTarget->GetFullName(); 198 m_strTargetName = pTarget->GetFullName();
206 m_pValue = &Value; 199 m_pValue = &Value;
207 m_bWillCommit = bWillCommit; 200 m_bWillCommit = bWillCommit;
208 m_pbRc = &bRc; 201 m_pbRc = &bRc;
209 m_bFieldFull = bFieldFull; 202 m_bFieldFull = bFieldFull;
210 } 203 }
211 204
212 void CJS_EventHandler::OnField_Validate(CFX_WideString& strChange, 205 void CJS_EventHandler::OnField_Validate(CFX_WideString& strChange,
213 const CFX_WideString& strChangeEx, 206 const CFX_WideString& strChangeEx,
214 FX_BOOL bKeyDown, 207 FX_BOOL bKeyDown,
215 FX_BOOL bModifier, 208 FX_BOOL bModifier,
216 FX_BOOL bShift, 209 FX_BOOL bShift,
217 CPDF_FormField* pTarget, 210 CPDF_FormField* pTarget,
218 CFX_WideString& Value, 211 CFX_WideString& Value,
219 FX_BOOL& bRc) { 212 FX_BOOL& bRc) {
220 Initial(JET_FIELD_VALIDATE); 213 Initial(JET_FIELD_VALIDATE);
221 214
222 m_pWideStrChange = &strChange; 215 m_pWideStrChange = &strChange;
223 m_WideStrChangeEx = strChangeEx; 216 m_WideStrChangeEx = strChangeEx;
224 m_bKeyDown = bKeyDown; 217 m_bKeyDown = bKeyDown;
225 m_bModifier = bModifier; 218 m_bModifier = bModifier;
226 m_bShift = bShift; 219 m_bShift = bShift;
227 ASSERT(pTarget != NULL);
228 m_strTargetName = pTarget->GetFullName(); 220 m_strTargetName = pTarget->GetFullName();
229 m_pValue = &Value; 221 m_pValue = &Value;
230 m_pbRc = &bRc; 222 m_pbRc = &bRc;
231 } 223 }
232 224
233 void CJS_EventHandler::OnField_Calculate(CPDF_FormField* pSource, 225 void CJS_EventHandler::OnField_Calculate(CPDF_FormField* pSource,
234 CPDF_FormField* pTarget, 226 CPDF_FormField* pTarget,
235 CFX_WideString& Value, 227 CFX_WideString& Value,
236 FX_BOOL& bRc) { 228 FX_BOOL& bRc) {
237 Initial(JET_FIELD_CALCULATE); 229 Initial(JET_FIELD_CALCULATE);
238 230
239 if (pSource) 231 if (pSource)
240 m_strSourceName = pSource->GetFullName(); 232 m_strSourceName = pSource->GetFullName();
241 ASSERT(pTarget != NULL);
242 m_strTargetName = pTarget->GetFullName(); 233 m_strTargetName = pTarget->GetFullName();
243 m_pValue = &Value; 234 m_pValue = &Value;
244 m_pbRc = &bRc; 235 m_pbRc = &bRc;
245 } 236 }
246 237
247 void CJS_EventHandler::OnField_Format(CPDF_FormField* pTarget, 238 void CJS_EventHandler::OnField_Format(CPDF_FormField* pTarget,
248 CFX_WideString& Value, 239 CFX_WideString& Value,
249 FX_BOOL bWillCommit) { 240 FX_BOOL bWillCommit) {
250 Initial(JET_FIELD_FORMAT); 241 Initial(JET_FIELD_FORMAT);
251 242
252 m_nCommitKey = 0; 243 m_nCommitKey = 0;
253 ASSERT(pTarget != NULL);
254 m_strTargetName = pTarget->GetFullName(); 244 m_strTargetName = pTarget->GetFullName();
255 m_pValue = &Value; 245 m_pValue = &Value;
256 m_bWillCommit = bWillCommit; 246 m_bWillCommit = bWillCommit;
257 } 247 }
258 248
259 void CJS_EventHandler::OnScreen_Focus(FX_BOOL bModifier, 249 void CJS_EventHandler::OnScreen_Focus(FX_BOOL bModifier,
260 FX_BOOL bShift, 250 FX_BOOL bShift,
261 CPDFSDK_Annot* pScreen) { 251 CPDFSDK_Annot* pScreen) {
262 Initial(JET_SCREEN_FOCUS); 252 Initial(JET_SCREEN_FOCUS);
263 253
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 return *m_pValue; 650 return *m_pValue;
661 } 651 }
662 652
663 FX_BOOL CJS_EventHandler::WillCommit() { 653 FX_BOOL CJS_EventHandler::WillCommit() {
664 return m_bWillCommit; 654 return m_bWillCommit;
665 } 655 }
666 656
667 CFX_WideString CJS_EventHandler::TargetName() { 657 CFX_WideString CJS_EventHandler::TargetName() {
668 return m_strTargetName; 658 return m_strTargetName;
669 } 659 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/javascript/JS_Context.cpp ('k') | fpdfsdk/src/javascript/JS_GlobalData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698