Index: chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchSelectionController.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchSelectionController.java b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchSelectionController.java |
index 4304435e777a360eabb4d214c071fc7926aa80cd..606d9d217bfc671b3586c424992dab308d1dcc74 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchSelectionController.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchSelectionController.java |
@@ -46,6 +46,7 @@ public class ContextualSearchSelectionController { |
private boolean mIsSelectionBeingModified; |
private boolean mWasLastTapValid; |
private boolean mIsWaitingForInvalidTapDetection; |
+ private boolean mDidAdjustSelection; |
pedro (no code reviews)
2015/06/25 01:30:28
Nit: mDidAdjustSelection --> mDidExpandSelection
aurimas (slooooooooow)
2015/07/01 00:45:38
Done
|
private float mX; |
private float mY; |
@@ -129,6 +130,11 @@ public class ContextualSearchSelectionController { |
* @param selection The selection portion of the context. |
*/ |
void handleSelectionChanged(String selection) { |
+ if (mDidAdjustSelection) { |
+ mDidAdjustSelection = false; |
+ return; |
+ } |
+ |
if (selection == null || selection.isEmpty()) { |
scheduleInvalidTapNotification(); |
// When the user taps on the page it will place the caret in that position, which |
@@ -249,6 +255,19 @@ public class ContextualSearchSelectionController { |
} |
/** |
+ * Adjusts the current selection by the given amounts. |
+ */ |
+ void adjustSelection(int selectionStartAdjust, int selectionEndAdjust) { |
David Trainor- moved to gerrit
2015/06/25 00:34:55
Eh might as well flesh out this javadoc with the s
|
+ // TODO(donnd): add code to verify that the selection is still valid before changing it! |
+ ContentViewCore basePageContentView = getBaseContentView(); |
+ if (basePageContentView != null) { |
pedro (no code reviews)
2015/06/25 01:30:28
Probably it's worth checking that basePageContentV
aurimas (slooooooooow)
2015/07/01 00:45:38
Done
|
+ mDidAdjustSelection = true; |
+ basePageContentView.getWebContents().moveSelectionByCharacterOffset( |
+ selectionStartAdjust, selectionEndAdjust); |
+ } |
+ } |
+ |
+ /** |
* @return whether a tap at the given coordinates should be handled or not. |
*/ |
private boolean shouldHandleTap(int x, int y) { |