Fix some misleading function and variable names in WKContentViewInteraction.mm
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 10 Mar 2019 23:49:10 +0000 (23:49 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 10 Mar 2019 23:49:10 +0000 (23:49 +0000)
https://bugs.webkit.org/show_bug.cgi?id=195536

Reviewed by Tim Horton.

* UIProcess/ios/WKContentViewInteraction.mm:
(shouldDeferZoomingToSelectionWhenRevealingFocusedElement):

Rename shouldZoomToRevealSelectionRect to shouldDeferZoomingToSelectionWhenRevealingFocusedElement; this
function is used to determine whether we should zoom to the selection rect when revealing the focused element,
and therefore affects whether we need to defer zooming until we get selection information.

(rectToRevealWhenZoomingToFocusedElement):
(-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):

Rename shouldShowKeyboard to shouldShowInputView; this boolean indicates whether we should show not only the
keyboard, but other UI for user input such as date and select pickers.

(-[WKContentView _didReceiveEditorStateUpdateAfterFocus]):
(shouldZoomToRevealSelectionRect): Deleted.

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

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

index 63fb319..7b56a6a 100644 (file)
@@ -1,3 +1,26 @@
+2019-03-10  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        Fix some misleading function and variable names in WKContentViewInteraction.mm
+        https://bugs.webkit.org/show_bug.cgi?id=195536
+
+        Reviewed by Tim Horton.
+
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (shouldDeferZoomingToSelectionWhenRevealingFocusedElement):
+
+        Rename shouldZoomToRevealSelectionRect to shouldDeferZoomingToSelectionWhenRevealingFocusedElement; this
+        function is used to determine whether we should zoom to the selection rect when revealing the focused element,
+        and therefore affects whether we need to defer zooming until we get selection information.
+
+        (rectToRevealWhenZoomingToFocusedElement):
+        (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
+
+        Rename shouldShowKeyboard to shouldShowInputView; this boolean indicates whether we should show not only the
+        keyboard, but other UI for user input such as date and select pickers.
+
+        (-[WKContentView _didReceiveEditorStateUpdateAfterFocus]):
+        (shouldZoomToRevealSelectionRect): Deleted.
+
 2019-03-10  Simon Fraser  <simon.fraser@apple.com>
 
         ScrollingTree should have the final say on where layers go
index 4ef6f50..867cc8a 100644 (file)
@@ -4723,7 +4723,7 @@ static NSString *contentTypeFromFieldName(WebCore::AutofillFieldName fieldName)
     return _formAccessoryView.get();
 }
 
-static bool shouldZoomToRevealSelectionRect(WebKit::InputType type)
+static bool shouldDeferZoomingToSelectionWhenRevealingFocusedElement(WebKit::InputType type)
 {
     switch (type) {
     case WebKit::InputType::ContentEditable:
@@ -4748,7 +4748,7 @@ static WebCore::FloatRect rectToRevealWhenZoomingToFocusedElement(const WebKit::
     if (elementInfo.elementRect.contains(elementInfo.lastInteractionLocation))
         elementInteractionRect = { elementInfo.lastInteractionLocation, { 1, 1 } };
 
-    if (!shouldZoomToRevealSelectionRect(elementInfo.elementType))
+    if (!shouldDeferZoomingToSelectionWhenRevealingFocusedElement(elementInfo.elementType))
         return elementInteractionRect;
 
     if (editorState.isMissingPostLayoutData) {
@@ -4840,7 +4840,7 @@ static const double minimumFocusedElementAreaForSuppressingSelectionAssistant =
     else
         [self _stopSuppressingSelectionAssistantForReason:WebKit::FocusedElementIsTooSmall];
 
-    BOOL shouldShowKeyboard = [&] {
+    BOOL shouldShowInputView = [&] {
         switch (startInputSessionPolicy) {
         case _WKFocusStartsInputSessionPolicyAuto:
             // The default behavior is to allow node assistance if the user is interacting.
@@ -4887,7 +4887,7 @@ static const double minimumFocusedElementAreaForSuppressingSelectionAssistant =
         [_drawingCoordinator installInkPickerForDrawing:information.embeddedViewID];
 #endif
 
-    if (!shouldShowKeyboard)
+    if (!shouldShowInputView)
         return;
 
     if (!isAssistableInputType(information.elementType))
@@ -4951,7 +4951,7 @@ static const double minimumFocusedElementAreaForSuppressingSelectionAssistant =
     if (editableChanged)
         [_webView _scheduleVisibleContentRectUpdate];
     
-    if (!shouldZoomToRevealSelectionRect(_focusedElementInformation.elementType))
+    if (!shouldDeferZoomingToSelectionWhenRevealingFocusedElement(_focusedElementInformation.elementType))
         [self _zoomToRevealFocusedElement];
 
     [self _ensureFormAccessoryView];
@@ -5106,7 +5106,7 @@ static BOOL allPasteboardItemOriginsMatchOrigin(UIPasteboard *pasteboard, const
 
     // FIXME: If the initial writing direction just changed, we should wait until we get the next post-layout editor state
     // before zooming to reveal the selection rect.
-    if (shouldZoomToRevealSelectionRect(_focusedElementInformation.elementType))
+    if (shouldDeferZoomingToSelectionWhenRevealingFocusedElement(_focusedElementInformation.elementType))
         [self _zoomToRevealFocusedElement];
 }