Diff
Modified: trunk/Source/WebKit/ChangeLog (246085 => 246086)
--- trunk/Source/WebKit/ChangeLog 2019-06-04 22:56:37 UTC (rev 246085)
+++ trunk/Source/WebKit/ChangeLog 2019-06-04 23:27:30 UTC (rev 246086)
@@ -1,3 +1,25 @@
+2019-06-04 Tim Horton <[email protected]>
+
+ Remove some unused selection code
+ https://bugs.webkit.org/show_bug.cgi?id=198451
+
+ Reviewed by Wenson Hsieh.
+
+ * Platform/spi/ios/UIKitSPI.h:
+ * Shared/ios/GestureTypes.h:
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (toGestureType):
+ (toUIWKGestureType):
+ * UIProcess/ios/WKPDFView.mm:
+ (-[WKPDFView actionSheetAssistant:shareElementWithURL:rect:]):
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::WebPage::selectWithGesture):
+ (WebKit::WebPage::selectTextWithGranularityAtPoint):
+ (WebKit::canShrinkToTextSelection): Deleted.
+ (WebKit::hasCustomLineHeight): Deleted.
+ (WebKit::WebPage::rangeForWebSelectionAtPosition): Deleted.
+
2019-06-04 Sihui Liu <[email protected]>
WKWebsiteDataStore API fails to fetch web storage data for non-persistent data store
Modified: trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h (246085 => 246086)
--- trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h 2019-06-04 22:56:37 UTC (rev 246085)
+++ trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h 2019-06-04 23:27:30 UTC (rev 246086)
@@ -530,33 +530,10 @@
- (UIColor *)_inheritedInteractionTintColor;
@end
-@interface UIWebSelectionView : UIView
-@end
-
-@interface UIWebSelectionAssistant : NSObject <UIGestureRecognizerDelegate>
-@end
-
@protocol UISelectionInteractionAssistant
- (void)showSelectionCommands;
@end
-@interface UIWebSelectionAssistant ()
-- (BOOL)isSelectionGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer;
-- (id)initWithView:(UIView *)view;
-- (void)clearSelection;
-- (void)didEndScrollingOrZoomingPage;
-- (void)didEndScrollingOverflow;
-- (void)resignedFirstResponder;
-- (void)selectionChanged;
-- (void)setGestureRecognizers;
-- (void)willStartScrollingOrZoomingPage;
-- (void)willStartScrollingOverflow;
-#if !PLATFORM(IOSMAC)
-@property (nonatomic, retain) UIWebSelectionView *selectionView;
-#endif
-@property (nonatomic, readonly) CGRect selectionFrame;
-@end
-
typedef NS_ENUM(NSInteger, UIWKSelectionTouch) {
UIWKSelectionTouchStarted = 0,
UIWKSelectionTouchMoved = 1,
@@ -586,22 +563,18 @@
UIWKGestureTwoFingerSingleTap = 10,
UIWKGestureTwoFingerRangedSelectGesture = 11,
UIWKGestureTapOnLinkWithGesture = 12,
- UIWKGestureMakeWebSelection = 13,
UIWKGesturePhraseBoundary = 14,
};
+@interface UIWebSelectionAssistant : NSObject
+@end
+
@interface UIWKSelectionAssistant : UIWebSelectionAssistant
@end
@interface UIWKSelectionAssistant ()
-- (BOOL)shouldHandleSingleTapAtPoint:(CGPoint)point;
-- (void)selectionChangedWithGestureAt:(CGPoint)point withGesture:(UIWKGestureType)gestureType withState:(UIGestureRecognizerState)gestureState withFlags:(UIWKSelectionFlags)flags;
-- (void)selectionChangedWithTouchAt:(CGPoint)point withSelectionTouch:(UIWKSelectionTouch)touch withFlags:(UIWKSelectionFlags)flags;
-- (void)showDictionaryFor:(NSString *)selectedTerm fromRect:(CGRect)presentationRect;
+- (id)initWithView:(UIView *)view;
- (void)showShareSheetFor:(NSString *)selectedTerm fromRect:(CGRect)presentationRect;
-- (void)showTextServiceFor:(NSString *)selectedTerm fromRect:(CGRect)presentationRect;
-- (void)lookup:(NSString *)textWithContext withRange:(NSRange)range fromRect:(CGRect)presentationRect;
-@property (nonatomic, readonly) UILongPressGestureRecognizer *selectionLongPressRecognizer;
@end
@interface UIWKAutocorrectionRects : NSObject
Modified: trunk/Source/WebKit/Shared/ios/GestureTypes.h (246085 => 246086)
--- trunk/Source/WebKit/Shared/ios/GestureTypes.h 2019-06-04 22:56:37 UTC (rev 246085)
+++ trunk/Source/WebKit/Shared/ios/GestureTypes.h 2019-06-04 23:27:30 UTC (rev 246086)
@@ -42,7 +42,6 @@
TwoFingerSingleTap,
TwoFingerRangedSelectGesture,
TapOnLinkWithGesture,
- MakeWebSelection,
PhraseBoundary
};
Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (246085 => 246086)
--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2019-06-04 22:56:37 UTC (rev 246085)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2019-06-04 23:27:30 UTC (rev 246086)
@@ -3278,8 +3278,6 @@
return WebKit::GestureType::TwoFingerRangedSelectGesture;
case UIWKGestureTapOnLinkWithGesture:
return WebKit::GestureType::TapOnLinkWithGesture;
- case UIWKGestureMakeWebSelection:
- return WebKit::GestureType::MakeWebSelection;
case UIWKGesturePhraseBoundary:
return WebKit::GestureType::PhraseBoundary;
}
@@ -3316,8 +3314,6 @@
return UIWKGestureTwoFingerRangedSelectGesture;
case WebKit::GestureType::TapOnLinkWithGesture:
return UIWKGestureTapOnLinkWithGesture;
- case WebKit::GestureType::MakeWebSelection:
- return UIWKGestureMakeWebSelection;
case WebKit::GestureType::PhraseBoundary:
return UIWKGesturePhraseBoundary;
}
Modified: trunk/Source/WebKit/UIProcess/ios/WKPDFView.mm (246085 => 246086)
--- trunk/Source/WebKit/UIProcess/ios/WKPDFView.mm 2019-06-04 22:56:37 UTC (rev 246085)
+++ trunk/Source/WebKit/UIProcess/ios/WKPDFView.mm 2019-06-04 23:27:30 UTC (rev 246086)
@@ -522,6 +522,7 @@
- (void)actionSheetAssistant:(WKActionSheetAssistant *)assistant shareElementWithURL:(NSURL *)url rect:(CGRect)boundingRect
{
+ // FIXME: We should use WKShareSheet instead of UIWKSelectionAssistant for this.
auto selectionAssistant = adoptNS([[UIWKSelectionAssistant alloc] initWithView:[_hostViewController view]]);
[selectionAssistant showShareSheetFor:WTF::userVisibleString(url) fromRect:boundingRect];
}
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (246085 => 246086)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2019-06-04 22:56:37 UTC (rev 246085)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2019-06-04 23:27:30 UTC (rev 246086)
@@ -1238,7 +1238,6 @@
void updateViewportSizeForCSSViewportUnits();
static void convertSelectionRectsToRootView(WebCore::FrameView*, Vector<WebCore::SelectionRect>&);
- RefPtr<WebCore::Range> rangeForWebSelectionAtPosition(const WebCore::IntPoint&, const WebCore::VisiblePosition&, SelectionFlags&);
void getFocusedElementInformation(FocusedElementInformation&);
void platformInitializeAccessibility();
void generateSyntheticEditingCommand(SyntheticEditingCommandType);
@@ -1850,7 +1849,6 @@
RefPtr<WebCore::Range> m_initialSelection;
WebCore::VisibleSelection m_storedSelectionForAccessibility { WebCore::VisibleSelection() };
- WebCore::IntSize m_blockSelectionDesiredSize;
WebCore::FloatSize m_maximumUnobscuredSize;
int32_t m_deviceOrientation { 0 };
bool m_keyboardIsAttached { false };
Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (246085 => 246086)
--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2019-06-04 22:56:37 UTC (rev 246085)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2019-06-04 23:27:30 UTC (rev 246086)
@@ -133,9 +133,6 @@
namespace WebKit {
using namespace WebCore;
-const int blockSelectionStartWidth = 100;
-const int blockSelectionStartHeight = 100;
-
void WebPage::platformInitialize()
{
platformInitializeAccessibility();
@@ -1235,93 +1232,6 @@
return boundingRect;
}
-static bool canShrinkToTextSelection(Node* node)
-{
- if (node && !is<Element>(*node))
- node = node->parentElement();
-
- auto* renderer = (node) ? node->renderer() : nullptr;
- return renderer && renderer->childrenInline() && (is<RenderBlock>(*renderer) && !downcast<RenderBlock>(*renderer).inlineContinuation()) && !renderer->isTable();
-}
-
-static bool hasCustomLineHeight(Node& node)
-{
- auto* renderer = node.renderer();
- return renderer && renderer->style().lineHeight().isSpecified();
-}
-
-RefPtr<Range> WebPage::rangeForWebSelectionAtPosition(const IntPoint& point, const VisiblePosition& position, SelectionFlags& flags)
-{
- HitTestResult result = m_page->mainFrame().eventHandler().hitTestResultAtPoint((point), HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::DisallowUserAgentShadowContent | HitTestRequest::AllowChildFrameContent);
-
- Node* currentNode = result.innerNode();
- if (!currentNode)
- return nullptr;
- RefPtr<Range> range;
- FloatRect boundingRectInScrollViewCoordinates;
-
- if (!currentNode->isTextNode() && !canShrinkToTextSelection(currentNode) && hasCustomLineHeight(*currentNode)) {
- auto* renderer = currentNode->renderer();
- if (is<RenderBlockFlow>(renderer)) {
- auto* renderText = downcast<RenderBlockFlow>(*renderer).findClosestTextAtAbsolutePoint(point);
- if (renderText && renderText->textNode())
- currentNode = renderText->textNode();
- }
- }
-
- if (currentNode->isTextNode()) {
- range = enclosingTextUnitOfGranularity(position, ParagraphGranularity, DirectionForward);
- if (!range || range->collapsed())
- range = Range::create(currentNode->document(), position, position);
- else {
- m_blockRectForTextSelection = selectionBoxForRange(range.get());
- range = wordRangeFromPosition(position);
- }
-
- return range;
- }
-
- if (!currentNode->isElementNode())
- currentNode = currentNode->parentElement();
-
- Node* bestChoice = currentNode;
- while (currentNode) {
- if (currentNode->renderer()) {
- boundingRectInScrollViewCoordinates = currentNode->renderer()->absoluteBoundingBoxRect(true);
- boundingRectInScrollViewCoordinates.scale(m_page->pageScaleFactor());
- if (boundingRectInScrollViewCoordinates.width() > m_blockSelectionDesiredSize.width() && boundingRectInScrollViewCoordinates.height() > m_blockSelectionDesiredSize.height())
- break;
- bestChoice = currentNode;
- }
- currentNode = currentNode->parentElement();
- }
-
- if (!bestChoice)
- return nullptr;
-
- RenderObject* renderer = bestChoice->renderer();
- if (!renderer || renderer->style().userSelect() == UserSelect::None)
- return nullptr;
-
- if (renderer->childrenInline() && (is<RenderBlock>(*renderer) && !downcast<RenderBlock>(*renderer).inlineContinuation()) && !renderer->isTable()) {
- range = enclosingTextUnitOfGranularity(position, WordGranularity, DirectionBackward);
- if (range && !range->collapsed())
- return range;
- }
-
- // If all we could find is a block whose height is very close to the height
- // of the visible area, don't use it.
- const float adjustmentFactor = .97;
- boundingRectInScrollViewCoordinates = renderer->absoluteBoundingBoxRect(true);
-
- if (boundingRectInScrollViewCoordinates.height() > m_page->mainFrame().view()->exposedContentRect().height() * adjustmentFactor)
- return nullptr;
-
- range = Range::create(bestChoice->document());
- range->selectNodeContents(*bestChoice);
- return range->collapsed() ? nullptr : range;
-}
-
void WebPage::selectWithGesture(const IntPoint& point, uint32_t granularity, uint32_t gestureType, uint32_t gestureState, bool isInteractingWithFocusedElement, CallbackID callbackID)
{
auto& frame = m_page->focusController().focusedOrMainFrame();
@@ -1465,14 +1375,6 @@
range = enclosingTextUnitOfGranularity(position, ParagraphGranularity, DirectionForward);
break;
- case GestureType::MakeWebSelection:
- if (wkGestureState == GestureRecognizerState::Began) {
- m_blockSelectionDesiredSize.setWidth(blockSelectionStartWidth);
- m_blockSelectionDesiredSize.setHeight(blockSelectionStartHeight);
- }
- range = rangeForWebSelectionAtPosition(point, position, flags);
- break;
-
default:
break;
}
@@ -2056,8 +1958,6 @@
auto& frame = m_page->focusController().focusedOrMainFrame();
RefPtr<Range> range = rangeForGranularityAtPoint(frame, point, granularity, isInteractingWithFocusedElement);
if (!isInteractingWithFocusedElement) {
- m_blockSelectionDesiredSize.setWidth(blockSelectionStartWidth);
- m_blockSelectionDesiredSize.setHeight(blockSelectionStartHeight);
auto* renderer = range ? range->startContainer().renderer() : nullptr;
if (renderer && renderer->style().preserveNewline())
m_blockRectForTextSelection = renderer->absoluteBoundingBoxRect(true);