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

Unified Diff: fpdfsdk/src/fsdk_annothandler.cpp

Issue 1473503002: Introduce "underlying types" to abstract XFA differences. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: rebase past Jun's CL. Created 5 years, 1 month 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
Index: fpdfsdk/src/fsdk_annothandler.cpp
diff --git a/fpdfsdk/src/fsdk_annothandler.cpp b/fpdfsdk/src/fsdk_annothandler.cpp
index bf0993bd4b3622af57c176503051b03df4a5d50f..2965d3290f2d95b638f49a046c2a003fb42ddc15 100644
--- a/fpdfsdk/src/fsdk_annothandler.cpp
+++ b/fpdfsdk/src/fsdk_annothandler.cpp
@@ -646,42 +646,32 @@ void CPDFSDK_BFAnnotHandler::OnCreate(CPDFSDK_Annot* pAnnot) {
}
void CPDFSDK_BFAnnotHandler::OnLoad(CPDFSDK_Annot* pAnnot) {
- ASSERT(pAnnot != NULL);
-
- CPDFSDK_PageView* pPageView = pAnnot->GetPageView();
- ASSERT(pPageView != NULL);
-
- CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument();
- ASSERT(pSDKDoc != NULL);
-
- CPDFXFA_Document* pDoc = pSDKDoc->GetDocument();
- ASSERT(pDoc != NULL);
-
- CFX_ByteString sSubType = pAnnot->GetSubType();
-
- if (sSubType == BFFT_SIGNATURE) {
- } else {
- CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
- if (!pWidget->IsAppearanceValid())
- pWidget->ResetAppearance(NULL, FALSE);
-
- int nFieldType = pWidget->GetFieldType();
- if (nFieldType == FIELDTYPE_TEXTFIELD || nFieldType == FIELDTYPE_COMBOBOX) {
- FX_BOOL bFormated = FALSE;
- CFX_WideString sValue = pWidget->OnFormat(bFormated);
- if (bFormated && nFieldType == FIELDTYPE_COMBOBOX) {
- pWidget->ResetAppearance(sValue.c_str(), FALSE);
- }
- }
+ if (pAnnot->GetSubType() == BFFT_SIGNATURE)
+ return;
- if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) {
- if (!pWidget->IsAppearanceValid() && !pWidget->GetValue().IsEmpty())
- pWidget->ResetAppearance(FALSE);
+ CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
+ if (!pWidget->IsAppearanceValid())
+ pWidget->ResetAppearance(NULL, FALSE);
+
+ int nFieldType = pWidget->GetFieldType();
+ if (nFieldType == FIELDTYPE_TEXTFIELD || nFieldType == FIELDTYPE_COMBOBOX) {
+ FX_BOOL bFormated = FALSE;
+ CFX_WideString sValue = pWidget->OnFormat(bFormated);
+ if (bFormated && nFieldType == FIELDTYPE_COMBOBOX) {
+ pWidget->ResetAppearance(sValue.c_str(), FALSE);
}
+ }
- if (m_pFormFiller)
- m_pFormFiller->OnLoad(pAnnot);
+ CPDFSDK_PageView* pPageView = pAnnot->GetPageView();
+ CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument();
+ CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument();
+ if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) {
+ if (!pWidget->IsAppearanceValid() && !pWidget->GetValue().IsEmpty())
+ pWidget->ResetAppearance(FALSE);
}
+
+ if (m_pFormFiller)
+ m_pFormFiller->OnLoad(pAnnot);
}
FX_BOOL CPDFSDK_BFAnnotHandler::OnSetFocus(CPDFSDK_Annot* pAnnot,
@@ -842,7 +832,7 @@ FX_BOOL CPDFSDK_XFAAnnotHandler::HitTest(CPDFSDK_PageView* pPageView,
if (!pSDKDoc)
return FALSE;
- CPDFXFA_Document* pDoc = pSDKDoc->GetDocument();
+ CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument();
if (!pDoc)
return FALSE;
@@ -1116,7 +1106,7 @@ IXFA_WidgetHandler* CPDFSDK_XFAAnnotHandler::GetXFAWidgetHandler(
if (!pSDKDoc)
return NULL;
- CPDFXFA_Document* pDoc = pSDKDoc->GetDocument();
+ CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument();
if (!pDoc)
return NULL;

Powered by Google App Engine
This is Rietveld 408576698