WebKit Bugzilla
Attachment 371356 Details for
Bug 198549
: REGRESSION(r246086): Causing Internal build failures (Requested by ShawnRoberts on #webkit).
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
ROLLOUT of r246086
bug-198549-20190604172110.patch (text/plain), 12.97 KB, created by
WebKit Commit Bot
on 2019-06-04 17:21:10 PDT
(
hide
)
Description:
ROLLOUT of r246086
Filename:
MIME Type:
Creator:
WebKit Commit Bot
Created:
2019-06-04 17:21:10 PDT
Size:
12.97 KB
patch
obsolete
>Subversion Revision: 246089 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index a35e1b02b7deb23bc8994e555e49d5ad4ac3ad00..fa13df3ba47d1073a43d0c96af9021b3590efcaa 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,17 @@ >+2019-06-04 Commit Queue <commit-queue@webkit.org> >+ >+ Unreviewed, rolling out r246086. >+ https://bugs.webkit.org/show_bug.cgi?id=198549 >+ >+ Causing Internal build failures (Requested by ShawnRoberts on >+ #webkit). >+ >+ Reverted changeset: >+ >+ "Remove some unused selection code" >+ https://bugs.webkit.org/show_bug.cgi?id=198451 >+ https://trac.webkit.org/changeset/246086 >+ > 2019-06-04 Tim Horton <timothy_horton@apple.com> > > Turn on background color estimation for all link indicators >diff --git a/Source/WebKit/Platform/spi/ios/UIKitSPI.h b/Source/WebKit/Platform/spi/ios/UIKitSPI.h >index 5552e052a448061842659bbee0350975b842f8a9..c4c8105c83784d431553f27b72586d8825be79d5 100644 >--- a/Source/WebKit/Platform/spi/ios/UIKitSPI.h >+++ b/Source/WebKit/Platform/spi/ios/UIKitSPI.h >@@ -530,10 +530,33 @@ typedef NS_ENUM (NSInteger, _UIBackdropMaskViewFlags) { > - (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, >@@ -563,18 +586,22 @@ typedef NS_ENUM(NSInteger, UIWKGestureType) { > UIWKGestureTwoFingerSingleTap = 10, > UIWKGestureTwoFingerRangedSelectGesture = 11, > UIWKGestureTapOnLinkWithGesture = 12, >+ UIWKGestureMakeWebSelection = 13, > UIWKGesturePhraseBoundary = 14, > }; > >-@interface UIWebSelectionAssistant : NSObject >-@end >- > @interface UIWKSelectionAssistant : UIWebSelectionAssistant > @end > > @interface UIWKSelectionAssistant () >-- (id)initWithView:(UIView *)view; >+- (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; > - (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 >diff --git a/Source/WebKit/Shared/ios/GestureTypes.h b/Source/WebKit/Shared/ios/GestureTypes.h >index 686f0d8bc075734c642fd903f111c515eb41f6cc..68450d0d602406ddfaa2d1c80f9b647d9b22cbdc 100644 >--- a/Source/WebKit/Shared/ios/GestureTypes.h >+++ b/Source/WebKit/Shared/ios/GestureTypes.h >@@ -42,6 +42,7 @@ enum class GestureType { > TwoFingerSingleTap, > TwoFingerRangedSelectGesture, > TapOnLinkWithGesture, >+ MakeWebSelection, > PhraseBoundary > }; > >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >index 582c05a7cee75cc51ca95886959c4e622a933a6a..2fbba75fec7eb010dc962f443bd0c1fbb24595ef 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >@@ -3278,6 +3278,8 @@ static inline WebKit::GestureType toGestureType(UIWKGestureType gestureType) > return WebKit::GestureType::TwoFingerRangedSelectGesture; > case UIWKGestureTapOnLinkWithGesture: > return WebKit::GestureType::TapOnLinkWithGesture; >+ case UIWKGestureMakeWebSelection: >+ return WebKit::GestureType::MakeWebSelection; > case UIWKGesturePhraseBoundary: > return WebKit::GestureType::PhraseBoundary; > } >@@ -3314,6 +3316,8 @@ static inline UIWKGestureType toUIWKGestureType(WebKit::GestureType gestureType) > return UIWKGestureTwoFingerRangedSelectGesture; > case WebKit::GestureType::TapOnLinkWithGesture: > return UIWKGestureTapOnLinkWithGesture; >+ case WebKit::GestureType::MakeWebSelection: >+ return UIWKGestureMakeWebSelection; > case WebKit::GestureType::PhraseBoundary: > return UIWKGesturePhraseBoundary; > } >diff --git a/Source/WebKit/UIProcess/ios/WKPDFView.mm b/Source/WebKit/UIProcess/ios/WKPDFView.mm >index 6c500fdad47d532103021f91b0df31b63cbade74..d2f4ff3b8c5f085b092e70bc3a6378c73677a019 100644 >--- a/Source/WebKit/UIProcess/ios/WKPDFView.mm >+++ b/Source/WebKit/UIProcess/ios/WKPDFView.mm >@@ -522,7 +522,6 @@ static NSStringCompareOptions stringCompareOptions(_WKFindOptions findOptions) > > - (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]; > } >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.h b/Source/WebKit/WebProcess/WebPage/WebPage.h >index 28b02a7f53e079f8738a8c79121fd5efd2c696e9..f2b24c2833437d8970db8c2b42d843ab296eb75f 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.h >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.h >@@ -1238,6 +1238,7 @@ private: > 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); >@@ -1849,6 +1850,7 @@ private: > > 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 }; >diff --git a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >index f4212b003d9ca00102220bcb67cbcd9c4dd6f1f9..e72da8d90e2821d1a1a09923385e88bca75af8c1 100644 >--- a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >+++ b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >@@ -133,6 +133,9 @@ > namespace WebKit { > using namespace WebCore; > >+const int blockSelectionStartWidth = 100; >+const int blockSelectionStartHeight = 100; >+ > void WebPage::platformInitialize() > { > platformInitializeAccessibility(); >@@ -1232,6 +1235,93 @@ static IntRect selectionBoxForRange(WebCore::Range* range) > 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(); >@@ -1375,6 +1465,14 @@ void WebPage::selectWithGesture(const IntPoint& point, uint32_t granularity, uin > 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; > } >@@ -1958,6 +2056,8 @@ void WebPage::selectTextWithGranularityAtPoint(const WebCore::IntPoint& point, u > 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);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 198549
: 371356