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

Unified Diff: fpdfsdk/src/fsdk_mgr.cpp

Issue 1540263003: Add ContainsKey() and ContainsValue() and use them where appropriate. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/src/fxge/ge/fx_ge_fontmap.cpp ('k') | fpdfsdk/src/javascript/JS_Runtime.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/fsdk_mgr.cpp
diff --git a/fpdfsdk/src/fsdk_mgr.cpp b/fpdfsdk/src/fsdk_mgr.cpp
index e01fe89610946142fccdb31bdd1497383d3fff49..03edd838911004f3a04e9a7165ce889109699f15 100644
--- a/fpdfsdk/src/fsdk_mgr.cpp
+++ b/fpdfsdk/src/fsdk_mgr.cpp
@@ -13,6 +13,7 @@
#include "fpdfsdk/include/javascript/IJavaScript.h"
#include "public/fpdf_ext.h"
#include "third_party/base/nonstd_unique_ptr.h"
+#include "third_party/base/stl_util.h"
#if _FX_OS_ == _FX_ANDROID_
#include "time.h"
@@ -689,9 +690,7 @@ CPDFSDK_Annot* CPDFSDK_PageView::GetFXWidgetAtPoint(FX_FLOAT pageX,
void CPDFSDK_PageView::KillFocusAnnotIfNeeded() {
// if there is a focused annot on the page, we should kill the focus first.
if (CPDFSDK_Annot* focusedAnnot = m_pSDKDoc->GetFocusAnnot()) {
- auto it =
- std::find(m_fxAnnotArray.begin(), m_fxAnnotArray.end(), focusedAnnot);
- if (it != m_fxAnnotArray.end())
+ if (pdfium::ContainsValue(m_fxAnnotArray, focusedAnnot))
KillFocusAnnot();
}
}
@@ -911,7 +910,7 @@ bool CPDFSDK_PageView::IsValidAnnot(const CPDF_Annot* p) const {
return false;
const auto& annots = m_pAnnotList->All();
- return std::find(annots.begin(), annots.end(), p) != annots.end();
+ return pdfium::ContainsValue(annots, p);
}
CPDFSDK_Annot* CPDFSDK_PageView::GetFocusAnnot() {
« no previous file with comments | « core/src/fxge/ge/fx_ge_fontmap.cpp ('k') | fpdfsdk/src/javascript/JS_Runtime.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698