Chromium Code Reviews| 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.
|
| } |
| } |
| } |