Changeset 246086 in webkit
- Timestamp:
- Jun 4, 2019 4:27:30 PM (5 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r246079 r246086 1 2019-06-04 Tim Horton <timothy_horton@apple.com> 2 3 Remove some unused selection code 4 https://bugs.webkit.org/show_bug.cgi?id=198451 5 6 Reviewed by Wenson Hsieh. 7 8 * Platform/spi/ios/UIKitSPI.h: 9 * Shared/ios/GestureTypes.h: 10 * UIProcess/ios/WKContentViewInteraction.mm: 11 (toGestureType): 12 (toUIWKGestureType): 13 * UIProcess/ios/WKPDFView.mm: 14 (-[WKPDFView actionSheetAssistant:shareElementWithURL:rect:]): 15 * WebProcess/WebPage/WebPage.h: 16 * WebProcess/WebPage/ios/WebPageIOS.mm: 17 (WebKit::WebPage::selectWithGesture): 18 (WebKit::WebPage::selectTextWithGranularityAtPoint): 19 (WebKit::canShrinkToTextSelection): Deleted. 20 (WebKit::hasCustomLineHeight): Deleted. 21 (WebKit::WebPage::rangeForWebSelectionAtPosition): Deleted. 22 1 23 2019-06-04 Sihui Liu <sihui_liu@apple.com> 2 24 -
trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h
r245832 r246086 531 531 @end 532 532 533 @interface UIWebSelectionView : UIView534 @end535 536 @interface UIWebSelectionAssistant : NSObject <UIGestureRecognizerDelegate>537 @end538 539 533 @protocol UISelectionInteractionAssistant 540 534 - (void)showSelectionCommands; 541 @end542 543 @interface UIWebSelectionAssistant ()544 - (BOOL)isSelectionGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer;545 - (id)initWithView:(UIView *)view;546 - (void)clearSelection;547 - (void)didEndScrollingOrZoomingPage;548 - (void)didEndScrollingOverflow;549 - (void)resignedFirstResponder;550 - (void)selectionChanged;551 - (void)setGestureRecognizers;552 - (void)willStartScrollingOrZoomingPage;553 - (void)willStartScrollingOverflow;554 #if !PLATFORM(IOSMAC)555 @property (nonatomic, retain) UIWebSelectionView *selectionView;556 #endif557 @property (nonatomic, readonly) CGRect selectionFrame;558 535 @end 559 536 … … 587 564 UIWKGestureTwoFingerRangedSelectGesture = 11, 588 565 UIWKGestureTapOnLinkWithGesture = 12, 589 UIWKGestureMakeWebSelection = 13,590 566 UIWKGesturePhraseBoundary = 14, 591 567 }; 592 568 569 @interface UIWebSelectionAssistant : NSObject 570 @end 571 593 572 @interface UIWKSelectionAssistant : UIWebSelectionAssistant 594 573 @end 595 574 596 575 @interface UIWKSelectionAssistant () 597 - (BOOL)shouldHandleSingleTapAtPoint:(CGPoint)point; 598 - (void)selectionChangedWithGestureAt:(CGPoint)point withGesture:(UIWKGestureType)gestureType withState:(UIGestureRecognizerState)gestureState withFlags:(UIWKSelectionFlags)flags; 599 - (void)selectionChangedWithTouchAt:(CGPoint)point withSelectionTouch:(UIWKSelectionTouch)touch withFlags:(UIWKSelectionFlags)flags; 600 - (void)showDictionaryFor:(NSString *)selectedTerm fromRect:(CGRect)presentationRect; 576 - (id)initWithView:(UIView *)view; 601 577 - (void)showShareSheetFor:(NSString *)selectedTerm fromRect:(CGRect)presentationRect; 602 - (void)showTextServiceFor:(NSString *)selectedTerm fromRect:(CGRect)presentationRect;603 - (void)lookup:(NSString *)textWithContext withRange:(NSRange)range fromRect:(CGRect)presentationRect;604 @property (nonatomic, readonly) UILongPressGestureRecognizer *selectionLongPressRecognizer;605 578 @end 606 579 -
trunk/Source/WebKit/Shared/ios/GestureTypes.h
r221443 r246086 43 43 TwoFingerRangedSelectGesture, 44 44 TapOnLinkWithGesture, 45 MakeWebSelection,46 45 PhraseBoundary 47 46 }; -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r246013 r246086 3279 3279 case UIWKGestureTapOnLinkWithGesture: 3280 3280 return WebKit::GestureType::TapOnLinkWithGesture; 3281 case UIWKGestureMakeWebSelection:3282 return WebKit::GestureType::MakeWebSelection;3283 3281 case UIWKGesturePhraseBoundary: 3284 3282 return WebKit::GestureType::PhraseBoundary; … … 3317 3315 case WebKit::GestureType::TapOnLinkWithGesture: 3318 3316 return UIWKGestureTapOnLinkWithGesture; 3319 case WebKit::GestureType::MakeWebSelection:3320 return UIWKGestureMakeWebSelection;3321 3317 case WebKit::GestureType::PhraseBoundary: 3322 3318 return UIWKGesturePhraseBoundary; -
trunk/Source/WebKit/UIProcess/ios/WKPDFView.mm
r244955 r246086 523 523 - (void)actionSheetAssistant:(WKActionSheetAssistant *)assistant shareElementWithURL:(NSURL *)url rect:(CGRect)boundingRect 524 524 { 525 // FIXME: We should use WKShareSheet instead of UIWKSelectionAssistant for this. 525 526 auto selectionAssistant = adoptNS([[UIWKSelectionAssistant alloc] initWithView:[_hostViewController view]]); 526 527 [selectionAssistant showShareSheetFor:WTF::userVisibleString(url) fromRect:boundingRect]; -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.h
r245998 r246086 1239 1239 1240 1240 static void convertSelectionRectsToRootView(WebCore::FrameView*, Vector<WebCore::SelectionRect>&); 1241 RefPtr<WebCore::Range> rangeForWebSelectionAtPosition(const WebCore::IntPoint&, const WebCore::VisiblePosition&, SelectionFlags&);1242 1241 void getFocusedElementInformation(FocusedElementInformation&); 1243 1242 void platformInitializeAccessibility(); … … 1851 1850 RefPtr<WebCore::Range> m_initialSelection; 1852 1851 WebCore::VisibleSelection m_storedSelectionForAccessibility { WebCore::VisibleSelection() }; 1853 WebCore::IntSize m_blockSelectionDesiredSize;1854 1852 WebCore::FloatSize m_maximumUnobscuredSize; 1855 1853 int32_t m_deviceOrientation { 0 }; -
trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
r246048 r246086 134 134 using namespace WebCore; 135 135 136 const int blockSelectionStartWidth = 100;137 const int blockSelectionStartHeight = 100;138 139 136 void WebPage::platformInitialize() 140 137 { … … 1234 1231 } 1235 1232 return boundingRect; 1236 }1237 1238 static bool canShrinkToTextSelection(Node* node)1239 {1240 if (node && !is<Element>(*node))1241 node = node->parentElement();1242 1243 auto* renderer = (node) ? node->renderer() : nullptr;1244 return renderer && renderer->childrenInline() && (is<RenderBlock>(*renderer) && !downcast<RenderBlock>(*renderer).inlineContinuation()) && !renderer->isTable();1245 }1246 1247 static bool hasCustomLineHeight(Node& node)1248 {1249 auto* renderer = node.renderer();1250 return renderer && renderer->style().lineHeight().isSpecified();1251 }1252 1253 RefPtr<Range> WebPage::rangeForWebSelectionAtPosition(const IntPoint& point, const VisiblePosition& position, SelectionFlags& flags)1254 {1255 HitTestResult result = m_page->mainFrame().eventHandler().hitTestResultAtPoint((point), HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::DisallowUserAgentShadowContent | HitTestRequest::AllowChildFrameContent);1256 1257 Node* currentNode = result.innerNode();1258 if (!currentNode)1259 return nullptr;1260 RefPtr<Range> range;1261 FloatRect boundingRectInScrollViewCoordinates;1262 1263 if (!currentNode->isTextNode() && !canShrinkToTextSelection(currentNode) && hasCustomLineHeight(*currentNode)) {1264 auto* renderer = currentNode->renderer();1265 if (is<RenderBlockFlow>(renderer)) {1266 auto* renderText = downcast<RenderBlockFlow>(*renderer).findClosestTextAtAbsolutePoint(point);1267 if (renderText && renderText->textNode())1268 currentNode = renderText->textNode();1269 }1270 }1271 1272 if (currentNode->isTextNode()) {1273 range = enclosingTextUnitOfGranularity(position, ParagraphGranularity, DirectionForward);1274 if (!range || range->collapsed())1275 range = Range::create(currentNode->document(), position, position);1276 else {1277 m_blockRectForTextSelection = selectionBoxForRange(range.get());1278 range = wordRangeFromPosition(position);1279 }1280 1281 return range;1282 }1283 1284 if (!currentNode->isElementNode())1285 currentNode = currentNode->parentElement();1286 1287 Node* bestChoice = currentNode;1288 while (currentNode) {1289 if (currentNode->renderer()) {1290 boundingRectInScrollViewCoordinates = currentNode->renderer()->absoluteBoundingBoxRect(true);1291 boundingRectInScrollViewCoordinates.scale(m_page->pageScaleFactor());1292 if (boundingRectInScrollViewCoordinates.width() > m_blockSelectionDesiredSize.width() && boundingRectInScrollViewCoordinates.height() > m_blockSelectionDesiredSize.height())1293 break;1294 bestChoice = currentNode;1295 }1296 currentNode = currentNode->parentElement();1297 }1298 1299 if (!bestChoice)1300 return nullptr;1301 1302 RenderObject* renderer = bestChoice->renderer();1303 if (!renderer || renderer->style().userSelect() == UserSelect::None)1304 return nullptr;1305 1306 if (renderer->childrenInline() && (is<RenderBlock>(*renderer) && !downcast<RenderBlock>(*renderer).inlineContinuation()) && !renderer->isTable()) {1307 range = enclosingTextUnitOfGranularity(position, WordGranularity, DirectionBackward);1308 if (range && !range->collapsed())1309 return range;1310 }1311 1312 // If all we could find is a block whose height is very close to the height1313 // of the visible area, don't use it.1314 const float adjustmentFactor = .97;1315 boundingRectInScrollViewCoordinates = renderer->absoluteBoundingBoxRect(true);1316 1317 if (boundingRectInScrollViewCoordinates.height() > m_page->mainFrame().view()->exposedContentRect().height() * adjustmentFactor)1318 return nullptr;1319 1320 range = Range::create(bestChoice->document());1321 range->selectNodeContents(*bestChoice);1322 return range->collapsed() ? nullptr : range;1323 1233 } 1324 1234 … … 1466 1376 break; 1467 1377 1468 case GestureType::MakeWebSelection:1469 if (wkGestureState == GestureRecognizerState::Began) {1470 m_blockSelectionDesiredSize.setWidth(blockSelectionStartWidth);1471 m_blockSelectionDesiredSize.setHeight(blockSelectionStartHeight);1472 }1473 range = rangeForWebSelectionAtPosition(point, position, flags);1474 break;1475 1476 1378 default: 1477 1379 break; … … 2057 1959 RefPtr<Range> range = rangeForGranularityAtPoint(frame, point, granularity, isInteractingWithFocusedElement); 2058 1960 if (!isInteractingWithFocusedElement) { 2059 m_blockSelectionDesiredSize.setWidth(blockSelectionStartWidth);2060 m_blockSelectionDesiredSize.setHeight(blockSelectionStartHeight);2061 1961 auto* renderer = range ? range->startContainer().renderer() : nullptr; 2062 1962 if (renderer && renderer->style().preserveNewline())
Note: See TracChangeset
for help on using the changeset viewer.