[BlackBerry] expandSelectionToGranularity should only use VisibleSelection and not...
authormifenton@rim.com <mifenton@rim.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 May 2012 19:58:35 +0000 (19:58 +0000)
committermifenton@rim.com <mifenton@rim.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 May 2012 19:58:35 +0000 (19:58 +0000)
https://bugs.webkit.org/show_bug.cgi?id=86759

Reviewed by Antonio Gomes.

expandSelectionToGranularity unnecesarily converted the
selection to range and back. Using the selection
directly is preferred.

* WebKitSupport/SelectionHandler.cpp:
(BlackBerry::WebKit::expandSelectionToGranularity):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@117483 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/blackberry/ChangeLog
Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp

index 39820c5..9aada56 100644 (file)
@@ -1,3 +1,17 @@
+2012-05-17  Mike Fenton  <mifenton@rim.com>
+
+        [BlackBerry] expandSelectionToGranularity should only use VisibleSelection and not range.
+        https://bugs.webkit.org/show_bug.cgi?id=86759
+
+        Reviewed by Antonio Gomes.
+
+        expandSelectionToGranularity unnecesarily converted the
+        selection to range and back. Using the selection
+        directly is preferred.
+
+        * WebKitSupport/SelectionHandler.cpp:
+        (BlackBerry::WebKit::expandSelectionToGranularity):
+
 2012-05-17  Hironori Bono  <hbono@chromium.org>
 
         [Refactoring] Move platform-specific code in Editor::respondToChangedSelection to the WebKit layer
index 3ebcf3f..e937cc3 100644 (file)
@@ -598,14 +598,13 @@ static bool expandSelectionToGranularity(Frame* frame, VisibleSelection selectio
         selection = DOMSupport::visibleSelectionForClosestActualWordStart(selection);
 
     selection.expandUsingGranularity(granularity);
-    RefPtr<Range> newRange = selection.toNormalizedRange();
-    RefPtr<Range> oldRange = frame->selection()->selection().toNormalizedRange();
-    EAffinity affinity = frame->selection()->affinity();
+    selection.setAffinity(frame->selection()->affinity());
 
-    if (isInputMode && !frame->editor()->client()->shouldChangeSelectedRange(oldRange.get(), newRange.get(), affinity, false))
+    if (isInputMode && !frame->selection()->shouldChangeSelection(selection))
         return false;
 
-    return frame->selection()->setSelectedRange(newRange.get(), affinity, true);
+    frame->selection()->setSelection(selection);
+    return true;
 }
 
 void SelectionHandler::selectObject(const WebCore::IntPoint& location, TextGranularity granularity)