diff options
author | Tom Sepez <tsepez@chromium.org> | 2017-02-23 13:07:36 -0800 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-02-23 22:29:03 +0000 |
commit | 40e0a819100b6b2cf63070c1a91393cf42820c69 (patch) | |
tree | 6d5bfd7359378fcacacc51f28ee1d0f8bd6d6804 | |
parent | 90b7326a13555795d7292268e83ae4933fd038f5 (diff) | |
download | pdfium-40e0a819100b6b2cf63070c1a91393cf42820c69.tar.xz |
Remove unused Icon::m_pIconStreamchromium/3022
It is set, and passed around, but never operated upon. This
removes another unowned ptr from JS back to C++ objects.
Change-Id: I2a7eede050c6d844924e3c74395e7672ebb0213e
Reviewed-on: https://pdfium-review.googlesource.com/2829
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
-rw-r--r-- | fpdfsdk/javascript/Document.cpp | 3 | ||||
-rw-r--r-- | fpdfsdk/javascript/Field.cpp | 22 | ||||
-rw-r--r-- | fpdfsdk/javascript/Icon.cpp | 19 | ||||
-rw-r--r-- | fpdfsdk/javascript/Icon.h | 7 |
4 files changed, 8 insertions, 43 deletions
diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp index fbcd53f35a..536d654463 100644 --- a/fpdfsdk/javascript/Document.cpp +++ b/fpdfsdk/javascript/Document.cpp @@ -1265,7 +1265,6 @@ bool Document::icons(CJS_Runtime* pRuntime, if (!pIcon) return false; - pIcon->SetStream(pIconElement->IconStream->GetStream()); pIcon->SetIconName(pIconElement->IconName); Icons.SetElement(pRuntime, i++, CJS_Value(pRuntime, pJS_Icon)); } @@ -1306,8 +1305,6 @@ bool Document::getIcon(CJS_Runtime* pRuntime, return false; pIcon->SetIconName(swIconName); - pIcon->SetStream(pIconElement->IconStream->GetStream()); - vRet = CJS_Value(pRuntime, pJS_Icon); return true; } diff --git a/fpdfsdk/javascript/Field.cpp b/fpdfsdk/javascript/Field.cpp index 477b472e3c..92b473b231 100644 --- a/fpdfsdk/javascript/Field.cpp +++ b/fpdfsdk/javascript/Field.cpp @@ -2815,10 +2815,11 @@ bool Field::buttonGetIcon(CJS_Runtime* pRuntime, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - int nface = 0; - int iSize = params.size(); - if (iSize >= 1) - nface = params[0].ToInt(pRuntime); + if (params.size() >= 1) { + int nFace = params[0].ToInt(pRuntime); + if (nFace < 0 || nFace > 2) + return false; + } std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) @@ -2837,19 +2838,6 @@ bool Field::buttonGetIcon(CJS_Runtime* pRuntime, ASSERT(pObj.IsEmpty() == false); CJS_Icon* pJS_Icon = static_cast<CJS_Icon*>(pRuntime->GetObjectPrivate(pObj)); - Icon* pIcon = (Icon*)pJS_Icon->GetEmbedObject(); - - CPDF_Stream* pIconStream = nullptr; - if (nface == 0) - pIconStream = pFormControl->GetNormalIcon(); - else if (nface == 1) - pIconStream = pFormControl->GetDownIcon(); - else if (nface == 2) - pIconStream = pFormControl->GetRolloverIcon(); - else - return false; - - pIcon->SetStream(pIconStream); vRet = CJS_Value(pRuntime, pJS_Icon); return true; } diff --git a/fpdfsdk/javascript/Icon.cpp b/fpdfsdk/javascript/Icon.cpp index 72d91faa76..fa2f92f3c9 100644 --- a/fpdfsdk/javascript/Icon.cpp +++ b/fpdfsdk/javascript/Icon.cpp @@ -21,27 +21,10 @@ JSMethodSpec CJS_Icon::MethodSpecs[] = {{0, 0}}; IMPLEMENT_JS_CLASS(CJS_Icon, Icon) Icon::Icon(CJS_Object* pJSObject) - : CJS_EmbedObj(pJSObject), m_pIconStream(nullptr), m_swIconName(L"") {} + : CJS_EmbedObj(pJSObject), m_swIconName(L"") {} Icon::~Icon() {} -void Icon::SetStream(CPDF_Stream* pIconStream) { - if (pIconStream) - m_pIconStream = pIconStream; -} - -CPDF_Stream* Icon::GetStream() { - return m_pIconStream; -} - -void Icon::SetIconName(CFX_WideString name) { - m_swIconName = name; -} - -CFX_WideString Icon::GetIconName() { - return m_swIconName; -} - bool Icon::name(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError) { diff --git a/fpdfsdk/javascript/Icon.h b/fpdfsdk/javascript/Icon.h index 5a51f20410..5580678fd5 100644 --- a/fpdfsdk/javascript/Icon.h +++ b/fpdfsdk/javascript/Icon.h @@ -17,13 +17,10 @@ class Icon : public CJS_EmbedObj { ~Icon() override; bool name(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - void SetStream(CPDF_Stream* pIconStream); - CPDF_Stream* GetStream(); - void SetIconName(CFX_WideString name); - CFX_WideString GetIconName(); + CFX_WideString GetIconName() const { return m_swIconName; } + void SetIconName(CFX_WideString name) { m_swIconName = name; } private: - CPDF_Stream* m_pIconStream; CFX_WideString m_swIconName; }; |