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

Unified Diff: pdf/pdfium/pdfium_engine.cc

Issue 603903002: For loop is running un-nacessrily after match. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pdf/pdfium/pdfium_engine.cc
diff --git a/pdf/pdfium/pdfium_engine.cc b/pdf/pdfium/pdfium_engine.cc
index 42f69e7bf2a9bb30154015f0bd2269ff6f0a908b..3d3ce4fbf994430f5a9a792c5cc34e7cffdb417c 100644
--- a/pdf/pdfium/pdfium_engine.cc
+++ b/pdf/pdfium/pdfium_engine.cc
@@ -2721,10 +2721,12 @@ PDFiumEngine::SelectionChangeInvalidator::~SelectionChangeInvalidator() {
GetVisibleSelectionsScreenRects(&new_selections);
for (size_t i = 0; i < new_selections.size(); ++i) {
for (size_t j = 0; j < old_selections_.size(); ++j) {
- if (new_selections[i] == old_selections_[j]) {
+ if (!old_selections_[j].IsEmpty() &&
+ new_selections[i] == old_selections_[j]) {
// Rectangle was selected before and after, so no need to invalidate it.
// Mark the rectangles by setting them to empty.
new_selections[i] = old_selections_[j] = pp::Rect();
+ break;
raymes 2014/09/29 01:09:51 I don't think we can early return from this loop (
Deepak 2014/09/29 02:41:28 @raymes, When below condition new_selections[i] =
raymes 2014/09/29 03:08:16 Oh I see! Is it ever possible for old_selections_
Deepak 2014/09/29 03:19:52 I think old selection does not contain duplicates.
}
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698