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

Unified Diff: chrome/renderer/render_view.cc

Issue 115468: Only send SelectionChanged events when the selection has actually changed.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 7 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 | « chrome/renderer/render_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/render_view.cc
===================================================================
--- chrome/renderer/render_view.cc (revision 16275)
+++ chrome/renderer/render_view.cc (working copy)
@@ -2487,9 +2487,20 @@
void RenderView::DidChangeSelection(bool is_empty_selection) {
#if defined(OS_LINUX)
+ // TODO(estade): investigate incremental updates to the selection so that we
+ // don't send the entire selection over IPC every time.
if (!is_empty_selection) {
+ // Sometimes we get repeated DidChangeSelection calls from webkit when
+ // the selection hasn't actually changed. We don't want to report these
+ // because it will cause us to continually claim the X clipboard.
+ std::string this_selection =
darin (slow to review) 2009/05/18 17:09:28 minor nit: "const std::string& this_selection ="
Evan Stade 2009/05/18 17:14:23 I had that at first, but GetSelection() returns a
+ webview()->GetFocusedFrame()->GetSelection(false);
+ if (this_selection == last_selection_)
+ return;
+
Send(new ViewHostMsg_SelectionChanged(routing_id_,
- webview()->GetFocusedFrame()->GetSelection(false)));
+ this_selection));
+ last_selection_ = this_selection;
}
#endif
}
« no previous file with comments | « chrome/renderer/render_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698