Changeset 246090 in webkit
- Timestamp:
- Jun 4, 2019, 5:23:59 PM (7 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 7 edited
-
ChangeLog (modified) (1 diff)
-
Platform/spi/ios/UIKitSPI.h (modified) (2 diffs)
-
Shared/ios/GestureTypes.h (modified) (1 diff)
-
UIProcess/ios/WKContentViewInteraction.mm (modified) (2 diffs)
-
UIProcess/ios/WKPDFView.mm (modified) (1 diff)
-
WebProcess/WebPage/WebPage.h (modified) (2 diffs)
-
WebProcess/WebPage/ios/WebPageIOS.mm (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r246088 r246090 1 2019-06-04 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, rolling out r246086. 4 https://bugs.webkit.org/show_bug.cgi?id=198549 5 6 Causing Internal build failures (Requested by ShawnRoberts on 7 #webkit). 8 9 Reverted changeset: 10 11 "Remove some unused selection code" 12 https://bugs.webkit.org/show_bug.cgi?id=198451 13 https://trac.webkit.org/changeset/246086 14 1 15 2019-06-04 Tim Horton <timothy_horton@apple.com> 2 16 -
trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h
r246086 r246090 531 531 @end 532 532 533 @interface UIWebSelectionView : UIView 534 @end 535 536 @interface UIWebSelectionAssistant : NSObject <UIGestureRecognizerDelegate> 537 @end 538 533 539 @protocol UISelectionInteractionAssistant 534 540 - (void)showSelectionCommands; 541 @end 542 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 #endif 557 @property (nonatomic, readonly) CGRect selectionFrame; 535 558 @end 536 559 … … 564 587 UIWKGestureTwoFingerRangedSelectGesture = 11, 565 588 UIWKGestureTapOnLinkWithGesture = 12, 589 UIWKGestureMakeWebSelection = 13, 566 590 UIWKGesturePhraseBoundary = 14, 567 591 }; 568 592 569 @interface UIWebSelectionAssistant : NSObject570 @end571 572 593 @interface UIWKSelectionAssistant : UIWebSelectionAssistant 573 594 @end 574 595 575 596 @interface UIWKSelectionAssistant () 576 - (id)initWithView:(UIView *)view; 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; 577 601 - (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; 578 605 @end 579 606 -
trunk/Source/WebKit/Shared/ios/GestureTypes.h
r246086 r246090 43 43 TwoFingerRangedSelectGesture, 44 44 TapOnLinkWithGesture, 45 MakeWebSelection, 45 46 PhraseBoundary 46 47 }; -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r246086 r246090 3279 3279 case UIWKGestureTapOnLinkWithGesture: 3280 3280 return WebKit::GestureType::TapOnLinkWithGesture; 3281 case UIWKGestureMakeWebSelection: 3282 return WebKit::GestureType::MakeWebSelection; 3281 3283 case UIWKGesturePhraseBoundary: 3282 3284 return WebKit::GestureType::PhraseBoundary; … … 3315 3317 case WebKit::GestureType::TapOnLinkWithGesture: 3316 3318 return UIWKGestureTapOnLinkWithGesture; 3319 case WebKit::GestureType::MakeWebSelection: 3320 return UIWKGestureMakeWebSelection; 3317 3321 case WebKit::GestureType::PhraseBoundary: 3318 3322 return UIWKGesturePhraseBoundary; -
trunk/Source/WebKit/UIProcess/ios/WKPDFView.mm
r246086 r246090 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.526 525 auto selectionAssistant = adoptNS([[UIWKSelectionAssistant alloc] initWithView:[_hostViewController view]]); 527 526 [selectionAssistant showShareSheetFor:WTF::userVisibleString(url) fromRect:boundingRect]; -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.h
r246086 r246090 1239 1239 1240 1240 static void convertSelectionRectsToRootView(WebCore::FrameView*, Vector<WebCore::SelectionRect>&); 1241 RefPtr<WebCore::Range> rangeForWebSelectionAtPosition(const WebCore::IntPoint&, const WebCore::VisiblePosition&, SelectionFlags&); 1241 1242 void getFocusedElementInformation(FocusedElementInformation&); 1242 1243 void platformInitializeAccessibility(); … … 1850 1851 RefPtr<WebCore::Range> m_initialSelection; 1851 1852 WebCore::VisibleSelection m_storedSelectionForAccessibility { WebCore::VisibleSelection() }; 1853 WebCore::IntSize m_blockSelectionDesiredSize; 1852 1854 WebCore::FloatSize m_maximumUnobscuredSize; 1853 1855 int32_t m_deviceOrientation { 0 }; -
trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
r246088 r246090 134 134 using namespace WebCore; 135 135 136 const int blockSelectionStartWidth = 100; 137 const int blockSelectionStartHeight = 100; 138 136 139 void WebPage::platformInitialize() 137 140 { … … 1231 1234 } 1232 1235 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 height 1313 // 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; 1233 1323 } 1234 1324 … … 1376 1466 break; 1377 1467 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 1378 1476 default: 1379 1477 break; … … 1959 2057 RefPtr<Range> range = rangeForGranularityAtPoint(frame, point, granularity, isInteractingWithFocusedElement); 1960 2058 if (!isInteractingWithFocusedElement) { 2059 m_blockSelectionDesiredSize.setWidth(blockSelectionStartWidth); 2060 m_blockSelectionDesiredSize.setHeight(blockSelectionStartHeight); 1961 2061 auto* renderer = range ? range->startContainer().renderer() : nullptr; 1962 2062 if (renderer && renderer->style().preserveNewline())
Note:
See TracChangeset
for help on using the changeset viewer.