Commit 043ef674 authored by enrica@apple.com's avatar enrica@apple.com

Support WebSelections in WK2 on iOS.

https://bugs.webkit.org/show_bug.cgi?id=127015
<rdar://problem/15211964>

Reviewed by Benjamin Poulain.

This change adds support for text only (non block mode)
selections in non editable content.
The main changes consist in hooking up the new gesture type
and touches to handle selection creation and interaction.
It also includes changes to the way first responder is handled
which includes the implementation of the isEditable method
to allow iOS to know when to show the keyboard.

* Shared/ios/WKGestureTypes.h:
* UIProcess/API/ios/WKInteractionView.mm:
(-[WKInteractionView isEditable]):
(-[WKInteractionView canBecomeFirstResponder]):
(-[WKInteractionView webSelectionRects]):
(-[WKInteractionView _highlightLongPressRecognized:]):
(-[WKInteractionView _singleTapRecognized:]):
(-[WKInteractionView inputAccessoryView]):
(-[WKInteractionView canPerformAction:withSender:]):
(-[WKInteractionView _showDictionary:]):
(toWKGestureType):
(toUIWKGestureType):
(selectionChangedWithGesture):
(selectionChangedWithTouch):
(-[WKInteractionView selectedTextRange]):
(-[WKInteractionView webSelectionAssistant]):
(-[WKInteractionView _startAssistingNode]):
(-[WKInteractionView _stopAssistingNode]):
(-[WKInteractionView _selectionChanged]):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::selectWithGesture):
(WebKit::WebPage::updateSelectionWithTouches):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162582 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent fa1673a5
2014-01-22 Enrica Casucci <enrica@apple.com>
Support WebSelections in WK2 on iOS.
https://bugs.webkit.org/show_bug.cgi?id=127015
<rdar://problem/15211964>
Reviewed by Benjamin Poulain.
This change adds support for text only (non block mode)
selections in non editable content.
The main changes consist in hooking up the new gesture type
and touches to handle selection creation and interaction.
It also includes changes to the way first responder is handled
which includes the implementation of the isEditable method
to allow iOS to know when to show the keyboard.
* Shared/ios/WKGestureTypes.h:
* UIProcess/API/ios/WKInteractionView.mm:
(-[WKInteractionView isEditable]):
(-[WKInteractionView canBecomeFirstResponder]):
(-[WKInteractionView webSelectionRects]):
(-[WKInteractionView _highlightLongPressRecognized:]):
(-[WKInteractionView _singleTapRecognized:]):
(-[WKInteractionView inputAccessoryView]):
(-[WKInteractionView canPerformAction:withSender:]):
(-[WKInteractionView _showDictionary:]):
(toWKGestureType):
(toUIWKGestureType):
(selectionChangedWithGesture):
(selectionChangedWithTouch):
(-[WKInteractionView selectedTextRange]):
(-[WKInteractionView webSelectionAssistant]):
(-[WKInteractionView _startAssistingNode]):
(-[WKInteractionView _stopAssistingNode]):
(-[WKInteractionView _selectionChanged]):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::selectWithGesture):
(WebKit::WebPage::updateSelectionWithTouches):
2014-01-22 Anders Carlsson <andersca@apple.com>
WKBrowsingContextController should not be an API wrapper around WebPageProxy
......
......@@ -41,7 +41,8 @@ typedef enum {
WKGestureOneFingerTripleTap,
WKGestureTwoFingerSingleTap,
WKGestureTwoFingerRangedSelectGesture,
WKGestureTapOnLinkWithGesture
WKGestureTapOnLinkWithGesture,
WKGestureMakeWebSelection
} WKGestureType;
typedef enum {
......
......@@ -383,7 +383,7 @@ void WebPage::selectWithGesture(const IntPoint& point, uint32_t granularity, uin
Frame& frame = m_page->focusController().focusedOrMainFrame();
FloatPoint adjustedPoint(point);
IntPoint constrainedPoint = constrainPoint(point, &frame, m_assistedNode.get());
IntPoint constrainedPoint = m_assistedNode ? constrainPoint(point, &frame, m_assistedNode.get()) : point;
VisiblePosition position = frame.visiblePositionForPoint(constrainedPoint);
if (position.isNull()) {
send(Messages::WebPageProxy::GestureCallback(point, gestureType, gestureState, 0, callbackID));
......@@ -478,7 +478,12 @@ void WebPage::selectWithGesture(const IntPoint& point, uint32_t granularity, uin
} else
range = enclosingTextUnitOfGranularity(position, ParagraphGranularity, DirectionForward);
break;
case WKGestureMakeWebSelection:
// FIXME: Here we should implement the logic for block selections.
range = wordRangeFromPosition(position);
break;
default:
break;
}
......@@ -585,9 +590,12 @@ void WebPage::updateSelectionWithTouches(const IntPoint& point, uint32_t touches
break;
case WKSelectionTouchEnded:
result = closestWordBoundaryForPosition(position);
if (result.isNotNull())
range = Range::create(*frame.document(), result, result);
if (frame.selection().isContentEditable()) {
result = closestWordBoundaryForPosition(position);
if (result.isNotNull())
range = Range::create(*frame.document(), result, result);
} else
range = rangeForPosition(&frame, position, baseIsStart);
break;
case WKSelectionTouchEndedMovingForward:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment