Title: [250252] branches/safari-608-branch/Source

Diff

Modified: branches/safari-608-branch/Source/WebCore/dom/DocumentMarkerController.h (250251 => 250252)


--- branches/safari-608-branch/Source/WebCore/dom/DocumentMarkerController.h	2019-09-23 20:50:59 UTC (rev 250251)
+++ branches/safari-608-branch/Source/WebCore/dom/DocumentMarkerController.h	2019-09-23 20:56:24 UTC (rev 250252)
@@ -70,7 +70,7 @@
         ASSERT(m_markers.isEmpty() == !m_possiblyExistingMarkerTypes.containsAny(DocumentMarker::allMarkers()));
         return !m_markers.isEmpty();
     }
-    bool hasMarkers(Range&, OptionSet<DocumentMarker::MarkerType> = DocumentMarker::allMarkers());
+    WEBCORE_EXPORT bool hasMarkers(Range&, OptionSet<DocumentMarker::MarkerType> = DocumentMarker::allMarkers());
 
     // When a marker partially overlaps with range, if removePartiallyOverlappingMarkers is true, we completely
     // remove the marker. If the argument is false, we will adjust the span of the marker so that it retains

Modified: branches/safari-608-branch/Source/WebKit/Shared/ios/GestureTypes.h (250251 => 250252)


--- branches/safari-608-branch/Source/WebKit/Shared/ios/GestureTypes.h	2019-09-23 20:50:59 UTC (rev 250251)
+++ branches/safari-608-branch/Source/WebKit/Shared/ios/GestureTypes.h	2019-09-23 20:56:24 UTC (rev 250252)
@@ -73,6 +73,7 @@
     None = 0,
     WordIsNearTap = 1 << 0,
     PhraseBoundaryChanged = 1 << 1,
+    WordNearTapIsMisspelled = 1 << 2,
 };
 
 enum class SelectionHandlePosition {

Modified: branches/safari-608-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (250251 => 250252)


--- branches/safari-608-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2019-09-23 20:50:59 UTC (rev 250251)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2019-09-23 20:56:24 UTC (rev 250252)
@@ -356,6 +356,7 @@
     BOOL _hasSetUpInteractions;
     NSUInteger _ignoreSelectionCommandFadeCount;
     NSInteger _suppressNonEditableSingleTapTextInteractionCount;
+    NSInteger _processingChangeSelectionWithGestureCount;
     CompletionHandler<void(WebCore::DOMPasteAccessResponse)> _domPasteRequestHandler;
     BlockPtr<void(UIWKAutocorrectionContext *)> _pendingAutocorrectionContextHandler;
 

Modified: branches/safari-608-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (250251 => 250252)


--- branches/safari-608-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-09-23 20:50:59 UTC (rev 250251)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-09-23 20:56:24 UTC (rev 250252)
@@ -179,6 +179,8 @@
 }
 @end
 
+#define UIWKWordNearTapIsMisspelled ((UIWKSelectionFlags)8)
+
 namespace WebKit {
 using namespace WebCore;
 using namespace WebKit;
@@ -3595,6 +3597,8 @@
         uiFlags |= UIWKWordIsNearTap;
     if (flags & WebKit::PhraseBoundaryChanged)
         uiFlags |= UIWKPhraseBoundaryChanged;
+    if (flags & WebKit::WordNearTapIsMisspelled)
+        uiFlags |= UIWKWordNearTapIsMisspelled;
 
     return static_cast<UIWKSelectionFlags>(uiFlags);
 }
@@ -3664,10 +3668,12 @@
 - (void)changeSelectionWithGestureAt:(CGPoint)point withGesture:(UIWKGestureType)gestureType withState:(UIGestureRecognizerState)state withFlags:(UIWKSelectionFlags)flags
 {
     _usingGestureForSelection = YES;
+    _processingChangeSelectionWithGestureCount++;
     _page->selectWithGesture(WebCore::IntPoint(point), WebCore::CharacterGranularity, static_cast<uint32_t>(toGestureType(gestureType)), static_cast<uint32_t>(toGestureRecognizerState(state)), [self _isInteractingWithFocusedElement], [self, state, flags](const WebCore::IntPoint& point, uint32_t gestureType, uint32_t gestureState, uint32_t innerFlags, WebKit::CallbackBase::Error error) {
         selectionChangedWithGesture(self, point, gestureType, gestureState, flags | innerFlags, error);
         if (state == UIGestureRecognizerStateEnded || state == UIGestureRecognizerStateCancelled)
             _usingGestureForSelection = NO;
+        _processingChangeSelectionWithGestureCount--;
     });
 }
 
@@ -6010,7 +6016,7 @@
     _selectionNeedsUpdate = YES;
     // If we are changing the selection with a gesture there is no need
     // to wait to paint the selection.
-    if (_usingGestureForSelection)
+    if (_usingGestureForSelection || _processingChangeSelectionWithGestureCount > 0)
         [self _updateChangedSelection];
 
 #if USE(UIKIT_KEYBOARD_ADDITIONS)

Modified: branches/safari-608-branch/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (250251 => 250252)


--- branches/safari-608-branch/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2019-09-23 20:50:59 UTC (rev 250251)
+++ branches/safari-608-branch/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2019-09-23 20:56:24 UTC (rev 250252)
@@ -68,6 +68,7 @@
 #import <WebCore/DiagnosticLoggingClient.h>
 #import <WebCore/DiagnosticLoggingKeys.h>
 #import <WebCore/DocumentLoader.h>
+#import <WebCore/DocumentMarkerController.h>
 #import <WebCore/DragController.h>
 #import <WebCore/Editing.h>
 #import <WebCore/Editor.h>
@@ -1317,7 +1318,7 @@
         return;
     }
     RefPtr<Range> range;
-    SelectionFlags flags = None;
+    OptionSet<SelectionFlags> flags;
     GestureRecognizerState wkGestureState = static_cast<GestureRecognizerState>(gestureState);
     switch (static_cast<GestureType>(gestureType)) {
     case GestureType::PhraseBoundary:
@@ -1329,10 +1330,11 @@
             position = markedRange->startPosition();
         if (position > markedRange->endPosition())
             position = markedRange->endPosition();
-        if (wkGestureState != GestureRecognizerState::Began)
-            flags = distanceBetweenPositions(markedRange->startPosition(), frame.selection().selection().start()) != distanceBetweenPositions(markedRange->startPosition(), position) ? PhraseBoundaryChanged : None;
-        else
-            flags = PhraseBoundaryChanged;
+        if (wkGestureState != GestureRecognizerState::Began) {
+            if (distanceBetweenPositions(markedRange->startPosition(), frame.selection().selection().start()) != distanceBetweenPositions(markedRange->startPosition(), position))
+                flags.add(PhraseBoundaryChanged);
+        } else
+            flags.add(PhraseBoundaryChanged);
         range = Range::create(*frame.document(), position, position);
     }
         break;
@@ -1351,8 +1353,11 @@
                 result = wordRange->startPosition();
                 if (distanceBetweenPositions(position, result) > 1)
                     result = wordRange->endPosition();
+
+                if (wordRange->ownerDocument().markers().hasMarkers(*wordRange, { DocumentMarker::Spelling }))
+                    flags.add(WordNearTapIsMisspelled);
             }
-            flags = WordIsNearTap;
+            flags.add(WordIsNearTap);
         } else if (atBoundaryOfGranularity(position, WordGranularity, DirectionBackward)) {
             // The position is at the end of a word.
             result = position;
@@ -1457,7 +1462,7 @@
     if (range)
         frame.selection().setSelectedRange(range.get(), position.affinity(), WebCore::FrameSelection::ShouldCloseTyping::Yes, UserTriggered);
 
-    send(Messages::WebPageProxy::GestureCallback(point, gestureType, gestureState, static_cast<uint32_t>(flags), callbackID));
+    send(Messages::WebPageProxy::GestureCallback(point, gestureType, gestureState, flags.toRaw(), callbackID));
 }
 
 static RefPtr<Range> rangeForPointInRootViewCoordinates(Frame& frame, const IntPoint& pointInRootViewCoordinates, bool baseIsStart)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to