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

Unified Diff: fpdfsdk/javascript/Field.cpp

Issue 2311343003: Make Observers into a templated class (Closed)
Patch Set: Make Annot is-a CPDFSDK_Annot::Observer Created 4 years, 3 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/javascript/Annot.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/javascript/Field.cpp
diff --git a/fpdfsdk/javascript/Field.cpp b/fpdfsdk/javascript/Field.cpp
index 3f5e5e1b0f57ae9aabb2675b4a0705d8e1bee752..24b84f917b25e57448dcb1a9cf27f3596aefe38f 100644
--- a/fpdfsdk/javascript/Field.cpp
+++ b/fpdfsdk/javascript/Field.cpp
@@ -269,12 +269,12 @@ void Field::UpdateFormField(CPDFSDK_Document* pDocument,
if (nFieldType == FIELDTYPE_COMBOBOX || nFieldType == FIELDTYPE_TEXTFIELD) {
for (CPDFSDK_Annot* pAnnot : widgets) {
FX_BOOL bFormatted = FALSE;
- CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot);
- CPDFSDK_Widget::Observer observer(&pAnnot);
- CFX_WideString sValue = pWidget->OnFormat(bFormatted);
+ CPDFSDK_Annot::Observer observer(&pAnnot);
+ CFX_WideString sValue =
+ static_cast<CPDFSDK_Widget*>(pAnnot)->OnFormat(bFormatted);
if (pAnnot) {
Lei Zhang 2016/09/07 21:01:29 Isn't this always true?
Tom Sepez 2016/09/07 21:10:28 No, that's the whole point of the observer. If we
- pWidget->ResetAppearance(bFormatted ? sValue.c_str() : nullptr,
- FALSE);
+ static_cast<CPDFSDK_Widget*>(pAnnot)->ResetAppearance(
+ bFormatted ? sValue.c_str() : nullptr, FALSE);
}
}
} else {
« no previous file with comments | « fpdfsdk/javascript/Annot.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698