+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
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)