Merge lp:~osomon/oxide/ignore-invalid-SelectionChanged into lp:~oxide-developers/oxide/oxide.trunk

Proposed by Olivier Tilloy
Status: Merged
Merged at revision: 799
Proposed branch: lp:~osomon/oxide/ignore-invalid-SelectionChanged
Merge into: lp:~oxide-developers/oxide/oxide.trunk
Diff against target: 21 lines (+11/-0)
1 file modified
shared/browser/oxide_render_widget_host_view.cc (+11/-0)
To merge this branch: bzr merge lp:~osomon/oxide/ignore-invalid-SelectionChanged
Reviewer Review Type Date Requested Status
Chris Coulson Approve
Review via email: mp+237830@code.launchpad.net

Commit message

Ignore SelectionChanged() notification when the selection is invalid.

To post a comment you must log in.
789. By Olivier Tilloy

Add a reference to an upstream bug report.

Revision history for this message
Chris Coulson (chrisccoulson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'shared/browser/oxide_render_widget_host_view.cc'
2--- shared/browser/oxide_render_widget_host_view.cc 2014-10-10 20:29:46 +0000
3+++ shared/browser/oxide_render_widget_host_view.cc 2014-10-13 11:05:27 +0000
4@@ -55,6 +55,17 @@
5 void RenderWidgetHostView::SelectionChanged(const base::string16& text,
6 size_t offset,
7 const gfx::Range& range) {
8+ if ((range.GetMin() - offset) > text.length()) {
9+ // Got an invalid selection (see https://launchpad.net/bugs/1375900).
10+ // The issue lies in content::RenderFrameImpl::SyncSelectionIfRequired(…)
11+ // where the selection text and the corresponding range are computed
12+ // separately. If the word that just got committed is at the beginning of a
13+ // new line, the selection range includes the trailing newline character(s)
14+ // whereas the selection text truncates them.
15+ // This looks very similar to https://crbug.com/101435.
16+ return;
17+ }
18+
19 content::RenderWidgetHostViewBase::SelectionChanged(text, offset, range);
20
21 if (delegate_) {

Subscribers

People subscribed via source and target branches