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

Unified Diff: pdf/pdfium/pdfium_engine.cc

Issue 2955743002: Only call PDFiumEngine::OnSelectionChanged() when there are changes. (Closed)
Patch Set: Created 3 years, 6 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 b8536c7fb785f1197e5d592b4870c29b6b39f3f0..eb7f4cb08fb315aac8cb6540a857b39c3212fd21 100644
--- a/pdf/pdfium/pdfium_engine.cc
+++ b/pdf/pdfium/pdfium_engine.cc
@@ -3290,15 +3290,21 @@ PDFiumEngine::SelectionChangeInvalidator::~SelectionChangeInvalidator() {
}
}
+ bool selection_changed = false;
for (const auto& old_selection : old_selections_) {
- if (!old_selection.IsEmpty())
+ if (!old_selection.IsEmpty()) {
engine_->client_->Invalidate(old_selection);
+ selection_changed = true;
+ }
}
for (const auto& new_selection : new_selections) {
- if (!new_selection.IsEmpty())
+ if (!new_selection.IsEmpty()) {
engine_->client_->Invalidate(new_selection);
+ selection_changed = true;
+ }
}
- engine_->OnSelectionChanged();
+ if (selection_changed)
+ engine_->OnSelectionChanged();
}
void PDFiumEngine::SelectionChangeInvalidator::GetVisibleSelectionsScreenRects(
« 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