From ef523dd36aea991084b8b934df846014a5c09c6f Mon Sep 17 00:00:00 2001 From: dsinclair Date: Mon, 15 Aug 2016 13:10:03 -0700 Subject: Only create widgets if really needed. Currently the GetWidget call will create a backing widget for a control behind the scenes if it doesn't exist. This can cause more work to be done then needed as we may need to create the page and any supporting structures. This created structure will then be torn down as we don't need it anymore once we're done with the widget. For the instances where setting the value on the widget will have no effect (as we'll destroy it anyway) we can tell GetWidget() to not create the widget and return without doing any work. BUG=pdfium:632709 Review-Url: https://codereview.chromium.org/2251453002 --- fpdfsdk/include/fsdk_baseform.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'fpdfsdk/include') diff --git a/fpdfsdk/include/fsdk_baseform.h b/fpdfsdk/include/fsdk_baseform.h index c5f45e75ae..8eee56c03e 100644 --- a/fpdfsdk/include/fsdk_baseform.h +++ b/fpdfsdk/include/fsdk_baseform.h @@ -263,7 +263,8 @@ class CPDFSDK_InterForm : public IPDF_FormNotify { FX_BOOL HighlightWidgets(); CPDFSDK_Widget* GetSibling(CPDFSDK_Widget* pWidget, FX_BOOL bNext) const; - CPDFSDK_Widget* GetWidget(CPDF_FormControl* pControl) const; + CPDFSDK_Widget* GetWidget(CPDF_FormControl* pControl, + bool createIfNeeded) const; void GetWidgets(const CFX_WideString& sFieldName, std::vector* widgets) const; void GetWidgets(CPDF_FormField* pField, -- cgit v1.2.3