https://bugs.webkit.org/show_bug.cgi?id=135180
<rdar://problem/
16721055>
Reviewed by Simon Fraser.
Source/WebCore:
AsyncScrollingCoordinator will force a selection update on iOS
when scrolling terminates in an overflow scroll.
* loader/EmptyClients.h:
* page/EditorClient.h:
* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
* page/scrolling/ScrollingTree.h:
(WebCore::ScrollingTree::scrollingTreeNodeWillStartScroll):
(WebCore::ScrollingTree::scrollingTreeNodeDidEndScroll):
Source/WebKit/mac:
* WebCoreSupport/WebEditorClient.h:
Source/WebKit2:
Adds notifications to the WKContentView to know when scrolling starts and ends
in an overflow scroll. When scrolling starts, we hide the selection and we restore
it when scrolling ends, though not before the selection information in the editor
state has been updated.
It also adds a new method to the EditorClient class to force the
selection update when scrolling is completed.
* UIProcess/PageClient.h:
* UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h:
* UIProcess/Scrolling/RemoteScrollingTree.cpp:
(WebKit::RemoteScrollingTree::scrollingTreeNodeWillStartScroll):
(WebKit::RemoteScrollingTree::scrollingTreeNodeDidEndScroll):
* UIProcess/Scrolling/RemoteScrollingTree.h:
* UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
* UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
(-[WKOverflowScrollViewDelegate scrollViewWillBeginDragging:]):
(-[WKOverflowScrollViewDelegate scrollViewDidEndDragging:willDecelerate:]):
(-[WKOverflowScrollViewDelegate scrollViewDidEndDecelerating:]):
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::overflowScrollWillStart):
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::overflowScrollDidEnd):
* UIProcess/WebPageProxy.h:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::overflowScrollWillStartScroll):
(WebKit::PageClientImpl::overflowScrollDidEndScroll):
* UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm:
(WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeWillStartScroll):
(WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidEndScroll):
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _overflowScrollingWillBegin]):
(-[WKContentView _overflowScrollingDidEnd]):
(-[WKContentView _updateChangedSelection]):
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::overflowScrollWillStartScroll):
(WebKit::WebPageProxy::overflowScrollDidEndScroll):
* WebProcess/WebCoreSupport/WebEditorClient.h:
* WebProcess/WebCoreSupport/WebEditorClient.cpp:
* WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
(WebKit::WebEditorClient::updateSelection):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@171370
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2014-07-22 Enrica Casucci <enrica@apple.com>
+
+ REGRESSION (WebKit2): Selection inside accelerated overflow:scroll doesn't track scrolling.
+ https://bugs.webkit.org/show_bug.cgi?id=135180
+ <rdar://problem/16721055>
+
+ Reviewed by Simon Fraser.
+
+ AsyncScrollingCoordinator will force a selection update on iOS
+ when scrolling terminates in an overflow scroll.
+
+ * loader/EmptyClients.h:
+ * page/EditorClient.h:
+ * page/scrolling/AsyncScrollingCoordinator.cpp:
+ (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
+ * page/scrolling/ScrollingTree.h:
+ (WebCore::ScrollingTree::scrollingTreeNodeWillStartScroll):
+ (WebCore::ScrollingTree::scrollingTreeNodeDidEndScroll):
+
2014-07-22 Myles C. Maxfield <mmaxfield@apple.com>
[Mac] Cocoa throws exception when the return type of NSAccessibilityLinkedUIElementsAttribute is not an array
virtual bool doTextFieldCommandFromEvent(Element*, KeyboardEvent*) override { return false; }
virtual void textWillBeDeletedInTextField(Element*) override { }
virtual void textDidChangeInTextArea(Element*) override { }
+ virtual void overflowScrollPositionChanged() override { }
#if PLATFORM(IOS)
virtual void startDelayingAndCoalescingContentChangeNotifications() override { }
virtual bool doTextFieldCommandFromEvent(Element*, KeyboardEvent*) = 0;
virtual void textWillBeDeletedInTextField(Element*) = 0;
virtual void textDidChangeInTextArea(Element*) = 0;
+ virtual void overflowScrollPositionChanged() = 0;
#if PLATFORM(IOS)
virtual void startDelayingAndCoalescingContentChangeNotifications() = 0;
#if ENABLE(ASYNC_SCROLLING)
#include "AsyncScrollingCoordinator.h"
+#include "EditorClient.h"
#include "Frame.h"
#include "FrameView.h"
#include "GraphicsLayer.h"
scrollableArea->setIsUserScroll(scrollingLayerPositionAction == SyncScrollingLayerPosition);
scrollableArea->scrollToOffsetWithoutAnimation(scrollPosition);
scrollableArea->setIsUserScroll(false);
+ if (scrollingLayerPositionAction == SetScrollingLayerPosition)
+ m_page->editorClient()->overflowScrollPositionChanged();
}
}
#if PLATFORM(IOS)
virtual FloatRect fixedPositionRect() = 0;
virtual void scrollingTreeNodeWillStartPanGesture() { }
+ virtual void scrollingTreeNodeWillStartScroll() { }
+ virtual void scrollingTreeNodeDidEndScroll() { }
#endif
bool isPointInNonFastScrollableRegion(IntPoint);
+2014-07-22 Enrica Casucci <enrica@apple.com>
+
+ REGRESSION (WebKit2): Selection inside accelerated overflow:scroll doesn't track scrolling.
+ https://bugs.webkit.org/show_bug.cgi?id=135180
+ <rdar://problem/16721055>
+
+ Reviewed by Simon Fraser.
+
+ * WebCoreSupport/WebEditorClient.h:
+
2014-07-22 Jeremy Jones <jeremyj@apple.com>
Don't create new UIWindow for video fullscreen.
virtual bool doTextFieldCommandFromEvent(WebCore::Element*, WebCore::KeyboardEvent*) override;
virtual void textWillBeDeletedInTextField(WebCore::Element*) override;
virtual void textDidChangeInTextArea(WebCore::Element*) override;
+ virtual void overflowScrollPositionChanged() override { };
#if PLATFORM(IOS)
virtual void startDelayingAndCoalescingContentChangeNotifications() override;
+2014-07-22 Enrica Casucci <enrica@apple.com>
+
+ REGRESSION (WebKit2): Selection inside accelerated overflow:scroll doesn't track scrolling.
+ https://bugs.webkit.org/show_bug.cgi?id=135180
+ <rdar://problem/16721055>
+
+ Reviewed by Simon Fraser.
+
+ Adds notifications to the WKContentView to know when scrolling starts and ends
+ in an overflow scroll. When scrolling starts, we hide the selection and we restore
+ it when scrolling ends, though not before the selection information in the editor
+ state has been updated.
+ It also adds a new method to the EditorClient class to force the
+ selection update when scrolling is completed.
+
+ * UIProcess/PageClient.h:
+ * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h:
+ * UIProcess/Scrolling/RemoteScrollingTree.cpp:
+ (WebKit::RemoteScrollingTree::scrollingTreeNodeWillStartScroll):
+ (WebKit::RemoteScrollingTree::scrollingTreeNodeDidEndScroll):
+ * UIProcess/Scrolling/RemoteScrollingTree.h:
+ * UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
+ * UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
+ (-[WKOverflowScrollViewDelegate scrollViewWillBeginDragging:]):
+ (-[WKOverflowScrollViewDelegate scrollViewDidEndDragging:willDecelerate:]):
+ (-[WKOverflowScrollViewDelegate scrollViewDidEndDecelerating:]):
+ (WebKit::ScrollingTreeOverflowScrollingNodeIOS::overflowScrollWillStart):
+ (WebKit::ScrollingTreeOverflowScrollingNodeIOS::overflowScrollDidEnd):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/ios/PageClientImplIOS.h:
+ * UIProcess/ios/PageClientImplIOS.mm:
+ (WebKit::PageClientImpl::overflowScrollWillStartScroll):
+ (WebKit::PageClientImpl::overflowScrollDidEndScroll):
+ * UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm:
+ (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeWillStartScroll):
+ (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidEndScroll):
+ * UIProcess/ios/WKContentViewInteraction.h:
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView _overflowScrollingWillBegin]):
+ (-[WKContentView _overflowScrollingDidEnd]):
+ (-[WKContentView _updateChangedSelection]):
+ * UIProcess/ios/WebPageProxyIOS.mm:
+ (WebKit::WebPageProxy::overflowScrollWillStartScroll):
+ (WebKit::WebPageProxy::overflowScrollDidEndScroll):
+ * WebProcess/WebCoreSupport/WebEditorClient.h:
+ * WebProcess/WebCoreSupport/WebEditorClient.cpp:
+ * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
+ (WebKit::WebEditorClient::updateSelection):
+
2014-07-22 Benjamin Poulain <bpoulain@apple.com>
[iOS][WK2] WebPageProxy should not do anything when responding to an animated resize is the page is not in a valid state
virtual WebCore::FloatSize contentsSize() const = 0;
virtual void overflowScrollViewWillStartPanGesture() = 0;
virtual void overflowScrollViewDidScroll() = 0;
+ virtual void overflowScrollWillStartScroll() = 0;
+ virtual void overflowScrollDidEndScroll() = 0;
virtual void didFinishDrawingPagesToPDF(const IPC::DataReference&) = 0;
virtual Vector<String> mimeTypesWithCustomContentProviders() = 0;
#if PLATFORM(IOS)
WebCore::FloatRect customFixedPositionRect() const;
void scrollingTreeNodeWillStartPanGesture();
+ void scrollingTreeNodeWillStartScroll();
+ void scrollingTreeNodeDidEndScroll();
#endif
private:
{
m_scrollingCoordinatorProxy.scrollingTreeNodeWillStartPanGesture();
}
+
+void RemoteScrollingTree::scrollingTreeNodeWillStartScroll()
+{
+ m_scrollingCoordinatorProxy.scrollingTreeNodeWillStartScroll();
+}
+
+void RemoteScrollingTree::scrollingTreeNodeDidEndScroll()
+{
+ m_scrollingCoordinatorProxy.scrollingTreeNodeDidEndScroll();
+}
+
#endif
void RemoteScrollingTree::scrollingTreeNodeDidScroll(ScrollingNodeID nodeID, const FloatPoint& scrollPosition, SetOrSyncScrollingLayerPosition scrollingLayerPositionAction)
#if PLATFORM(IOS)
virtual WebCore::FloatRect fixedPositionRect() override;
virtual void scrollingTreeNodeWillStartPanGesture() override;
+ virtual void scrollingTreeNodeWillStartScroll() override;
+ virtual void scrollingTreeNodeDidEndScroll() override;
#endif
virtual PassRefPtr<WebCore::ScrollingTreeNode> createScrollingTreeNode(WebCore::ScrollingNodeType, WebCore::ScrollingNodeID) override;
static PassRefPtr<ScrollingTreeOverflowScrollingNodeIOS> create(WebCore::ScrollingTree&, WebCore::ScrollingNodeID);
virtual ~ScrollingTreeOverflowScrollingNodeIOS();
+ void overflowScrollWillStart();
+ void overflowScrollDidEnd();
void overflowScrollViewWillStartPanGesture();
void scrollViewDidScroll(const WebCore::FloatPoint&, bool inUserInteration);
if (scrollView.panGestureRecognizer.state == UIGestureRecognizerStateBegan)
_scrollingTreeNode->overflowScrollViewWillStartPanGesture();
+ _scrollingTreeNode->overflowScrollWillStart();
}
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)willDecelerate
if (_inUserInteraction && !willDecelerate) {
_inUserInteraction = NO;
_scrollingTreeNode->scrollViewDidScroll(scrollView.contentOffset, _inUserInteraction);
+ _scrollingTreeNode->overflowScrollDidEnd();
}
}
if (_inUserInteraction) {
_inUserInteraction = NO;
_scrollingTreeNode->scrollViewDidScroll(scrollView.contentOffset, _inUserInteraction);
+ _scrollingTreeNode->overflowScrollDidEnd();
}
}
child->updateLayersAfterAncestorChange(*this, fixedPositionRect, scrollDelta);
}
+void ScrollingTreeOverflowScrollingNodeIOS::overflowScrollWillStart()
+{
+ scrollingTree().scrollingTreeNodeWillStartScroll();
+}
+
+void ScrollingTreeOverflowScrollingNodeIOS::overflowScrollDidEnd()
+{
+ scrollingTree().scrollingTreeNodeDidEndScroll();
+}
+
void ScrollingTreeOverflowScrollingNodeIOS::overflowScrollViewWillStartPanGesture()
{
scrollingTree().scrollingTreeNodeWillStartPanGesture();
WebCore::FloatRect computeCustomFixedPositionRect(const WebCore::FloatRect& unobscuredContentRect, double displayedContentScale, UnobscuredRectConstraint = UnobscuredRectConstraint::Unconstrained) const;
void overflowScrollViewWillStartPanGesture();
void overflowScrollViewDidScroll();
+ void overflowScrollWillStartScroll();
+ void overflowScrollDidEndScroll();
void dynamicViewportSizeUpdate(const WebCore::FloatSize& minimumLayoutSize, const WebCore::FloatSize& minimumLayoutSizeForMinimalUI, const WebCore::FloatSize& maximumUnobscuredSize, const WebCore::FloatRect& targetExposedContentRect, const WebCore::FloatRect& targetUnobscuredRect, const WebCore::FloatRect& targetUnobscuredRectInScrollViewCoordinates, double targetScale, int32_t deviceOrientation);
void synchronizeDynamicViewportUpdate();
virtual void zoomToRect(WebCore::FloatRect, double minimumScale, double maximumScale) override;
virtual void overflowScrollViewWillStartPanGesture() override;
virtual void overflowScrollViewDidScroll() override;
+ virtual void overflowScrollWillStartScroll() override;
+ virtual void overflowScrollDidEndScroll() override;
+
virtual void didFinishDrawingPagesToPDF(const IPC::DataReference&) override;
// Auxiliary Client Creation
[m_contentView _didScroll];
}
+void PageClientImpl::overflowScrollWillStartScroll()
+{
+ [m_contentView _overflowScrollingWillBegin];
+}
+
+void PageClientImpl::overflowScrollDidEndScroll()
+{
+ [m_contentView _overflowScrollingDidEnd];
+}
+
void PageClientImpl::didFinishDrawingPagesToPDF(const IPC::DataReference& pdfData)
{
RetainPtr<CFDataRef> data = adoptCF(CFDataCreate(kCFAllocatorDefault, pdfData.data(), pdfData.size()));
m_webPageProxy.overflowScrollViewWillStartPanGesture();
}
+void RemoteScrollingCoordinatorProxy::scrollingTreeNodeWillStartScroll()
+{
+ m_webPageProxy.overflowScrollWillStartScroll();
+}
+
+void RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidEndScroll()
+{
+ m_webPageProxy.overflowScrollDidEndScroll();
+}
+
} // namespace WebKit
BOOL _potentialTapInProgress;
BOOL _hasTapHighlightForPotentialTap;
BOOL _selectionNeedsUpdate;
+ BOOL _shouldRestoreSelection;
BOOL _usingGestureForSelection;
BOOL _inspectorNodeSearchEnabled;
BOOL _didAccessoryTabInitiateFocus;
- (void)_willStartScrollingOrZooming;
- (void)_didScroll;
- (void)_didEndScrollingOrZooming;
+- (void)_overflowScrollingWillBegin;
+- (void)_overflowScrollingDidEnd;
- (void)_didUpdateBlockSelectionWithTouch:(WebKit::SelectionTouch)touch withFlags:(WebKit::SelectionFlags)flags growThreshold:(CGFloat)growThreshold shrinkThreshold:(CGFloat)shrinkThreshold;
- (void)_showPlaybackTargetPicker:(BOOL)hasVideo fromRect:(const WebCore::IntRect&)elementRect;
- (void)_showRunOpenPanel:(WebKit::WebOpenPanelParameters*)parameters resultListener:(WebKit::WebOpenPanelResultListenerProxy*)listener;
[self _cancelInteraction];
}
+- (void)_overflowScrollingWillBegin
+{
+ [_webSelectionAssistant willStartScrollingOverflow];
+ [_textSelectionAssistant willStartScrollingOverflow];
+}
+
+- (void)_overflowScrollingDidEnd
+{
+ // If scrolling ends before we've received a selection update,
+ // we postpone showing the selection until the update is received.
+ if (!_selectionNeedsUpdate) {
+ _shouldRestoreSelection = YES;
+ return;
+ }
+ [self _updateChangedSelection];
+ [_webSelectionAssistant didEndScrollingOverflow];
+ [_textSelectionAssistant didEndScrollingOverflow];
+}
+
- (BOOL)_requiresKeyboardWhenFirstResponder
{
// FIXME: We should add the logic to handle keyboard visibility during focus redirects.
} else if (!_page->editorState().isContentEditable)
[_webSelectionAssistant selectionChanged];
_selectionNeedsUpdate = NO;
+ if (_shouldRestoreSelection) {
+ [_webSelectionAssistant didEndScrollingOverflow];
+ [_textSelectionAssistant didEndScrollingOverflow];
+ _shouldRestoreSelection = NO;
+ }
}
- (void)_showPlaybackTargetPicker:(BOOL)hasVideo fromRect:(const IntRect&)elementRect
m_pageClient.overflowScrollViewDidScroll();
}
+void WebPageProxy::overflowScrollWillStartScroll()
+{
+ m_pageClient.overflowScrollWillStartScroll();
+}
+
+void WebPageProxy::overflowScrollDidEndScroll()
+{
+ m_pageClient.overflowScrollDidEndScroll();
+}
+
void WebPageProxy::dynamicViewportSizeUpdate(const FloatSize& minimumLayoutSize, const WebCore::FloatSize& minimumLayoutSizeForMinimalUI, const WebCore::FloatSize& maximumUnobscuredSize, const FloatRect& targetExposedContentRect, const FloatRect& targetUnobscuredRect, const FloatRect& targetUnobscuredRectInScrollViewCoordinates, double targetScale, int32_t deviceOrientation)
{
if (!isValid())
m_page->injectedBundleFormClient().textDidChangeInTextArea(m_page, toHTMLTextAreaElement(element), webFrame);
}
+#if !PLATFORM(IOS)
+void WebEditorClient::overflowScrollPositionChanged()
+{
+ notImplemented();
+}
+#endif
+
static bool getActionTypeForKeyEvent(KeyboardEvent* event, WKInputFieldActionType& type)
{
String key = event->keyIdentifier();
virtual bool doTextFieldCommandFromEvent(WebCore::Element*, WebCore::KeyboardEvent*) override;
virtual void textWillBeDeletedInTextField(WebCore::Element*) override;
virtual void textDidChangeInTextArea(WebCore::Element*) override;
+ virtual void overflowScrollPositionChanged() override;
#if PLATFORM(COCOA)
virtual NSString *userVisibleString(NSURL *) override;
return 0;
}
+void WebEditorClient::overflowScrollPositionChanged()
+{
+ m_page->didChangeSelection();
+}
+
} // namespace WebKit
#endif // PLATFORM(IOS)