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