Title: [279988] trunk/Source
Revision
279988
Author
megan_gard...@apple.com
Date
2021-07-16 10:17:17 -0700 (Fri, 16 Jul 2021)

Log Message

Pipe App Highlight scrolling through UI Process in preparation for Note Overlay avoidance.
https://bugs.webkit.org/show_bug.cgi?id=227914

Reviewed by Tim Horton.

Source/WebCore:

In order to correctly avoid the note overlay that can potentially obscure the web view,
we need to pipe the scrolling through the UI process. This patch does that work
and will be followed up shortly by one that does the actual work of overlay avoidance.
For iOS, this just uses the main frame UI Scrolling that we already use, but for
mac, we need to do the last scroll in the web process after adjusting it with the overlay
information.

* Modules/highlight/AppHighlightStorage.cpp:
(WebCore::AppHighlightStorage::attemptToRestoreHighlightAndScroll):
* dom/Element.cpp:
(WebCore::Element::scrollIntoView):
* editing/Editor.cpp:
(WebCore::TemporarySelectionChange::setSelection):
* editing/Editor.h:
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::moveWithoutValidationTo):
(WebCore::FrameSelection::setSelection):
(WebCore::FrameSelection::updateAndRevealSelection):
(WebCore::FrameSelection::revealSelection):
* editing/FrameSelection.h:
* loader/EmptyClients.h:
* page/Chrome.cpp:
(WebCore::Chrome::scrollMainFrameToRevealRect const):
(WebCore::Chrome::scrollRectIntoView const): Deleted.
* page/Chrome.h:
* page/ChromeClient.h:
(WebCore::ChromeClient::scrollMainFrameToRevealRect const):
(WebCore::ChromeClient::scrollRectIntoView const): Deleted.
* page/ScrollBehavior.cpp:
(WebCore::useSmoothScrolling):
* page/ScrollBehavior.h:
* platform/ScrollTypes.h:
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::scrollRectToVisible):
* rendering/RenderLayer.h:

Source/WebKit:

In order to correctly avoid the note overlay that can potentially obscure the web view,
we need to pipe the scrolling through the UI process. This patch does that work
and will be followed up shortly by one that does the actual work of overlay avoidance.
For iOS, this just uses the main frame UI Scrolling that we already use, but for
mac, we need to do the last scroll in the web process after adjusting it with the overlay
information.

* UIProcess/API/gtk/PageClientImpl.cpp:
(WebKit::PageClientImpl::requestScrollToRect):
* UIProcess/API/gtk/PageClientImpl.h:
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::requestScrollToRect):
(WebKit::WebPageProxy::scrollToRect):
* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::scrollToRect):
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::requestScrollToRect):
* UIProcess/mac/PageClientImplMac.h:
* UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::requestScrollToRect):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::scrollMainFrameToRevealRect const):
(WebKit::WebChromeClient::scrollRectIntoView const): Deleted.
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::scrollToRect):

Source/WebKitLegacy/mac:

* WebCoreSupport/WebChromeClient.h:
* WebCoreSupport/WebChromeClient.mm:
(WebChromeClient::scrollMainFrameToRevealRect const):

Source/WebKitLegacy/win:

* WebCoreSupport/WebChromeClient.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (279987 => 279988)


--- trunk/Source/WebCore/ChangeLog	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebCore/ChangeLog	2021-07-16 17:17:17 UTC (rev 279988)
@@ -1,3 +1,46 @@
+2021-07-16  Megan Gardner  <megan_gard...@apple.com>
+
+        Pipe App Highlight scrolling through UI Process in preparation for Note Overlay avoidance.
+        https://bugs.webkit.org/show_bug.cgi?id=227914
+
+        Reviewed by Tim Horton.
+
+        In order to correctly avoid the note overlay that can potentially obscure the web view,
+        we need to pipe the scrolling through the UI process. This patch does that work
+        and will be followed up shortly by one that does the actual work of overlay avoidance.
+        For iOS, this just uses the main frame UI Scrolling that we already use, but for 
+        mac, we need to do the last scroll in the web process after adjusting it with the overlay 
+        information.
+
+        * Modules/highlight/AppHighlightStorage.cpp:
+        (WebCore::AppHighlightStorage::attemptToRestoreHighlightAndScroll):
+        * dom/Element.cpp:
+        (WebCore::Element::scrollIntoView):
+        * editing/Editor.cpp:
+        (WebCore::TemporarySelectionChange::setSelection):
+        * editing/Editor.h:
+        * editing/FrameSelection.cpp:
+        (WebCore::FrameSelection::moveWithoutValidationTo):
+        (WebCore::FrameSelection::setSelection):
+        (WebCore::FrameSelection::updateAndRevealSelection):
+        (WebCore::FrameSelection::revealSelection):
+        * editing/FrameSelection.h:
+        * loader/EmptyClients.h:
+        * page/Chrome.cpp:
+        (WebCore::Chrome::scrollMainFrameToRevealRect const):
+        (WebCore::Chrome::scrollRectIntoView const): Deleted.
+        * page/Chrome.h:
+        * page/ChromeClient.h:
+        (WebCore::ChromeClient::scrollMainFrameToRevealRect const):
+        (WebCore::ChromeClient::scrollRectIntoView const): Deleted.
+        * page/ScrollBehavior.cpp:
+        (WebCore::useSmoothScrolling):
+        * page/ScrollBehavior.h:
+        * platform/ScrollTypes.h:
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::scrollRectToVisible):
+        * rendering/RenderLayer.h:
+
 2021-07-16  Alexander Mikhaylenko  <al...@gnome.org>
 
         [GTK][WPE] Support color-schemes CSS property

Modified: trunk/Source/WebCore/Modules/highlight/AppHighlightStorage.cpp (279987 => 279988)


--- trunk/Source/WebCore/Modules/highlight/AppHighlightStorage.cpp	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebCore/Modules/highlight/AppHighlightStorage.cpp	2021-07-16 17:17:17 UTC (rev 279988)
@@ -271,7 +271,7 @@
         if (textIndicator)
             m_document->page()->chrome().client().setTextIndicator(textIndicator->data());
         
-        TemporarySelectionChange selectionChange(*strongDocument, { range.value() }, { TemporarySelectionOption::RevealSelection, TemporarySelectionOption::SmoothScroll, TemporarySelectionOption::OverrideSmoothScrollFeatureEnablment });
+        TemporarySelectionChange selectionChange(*strongDocument, { range.value() }, { TemporarySelectionOption::DelegateMainFrameScroll, TemporarySelectionOption::SmoothScroll });
     }
 
     return true;

Modified: trunk/Source/WebCore/dom/Element.cpp (279987 => 279988)


--- trunk/Source/WebCore/dom/Element.cpp	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebCore/dom/Element.cpp	2021-07-16 17:17:17 UTC (rev 279988)
@@ -937,8 +937,7 @@
         isHorizontal ? alignX : alignY,
         isHorizontal ? alignY : alignX,
         ShouldAllowCrossOriginScrolling::No,
-        options.behavior.value_or(ScrollBehavior::Auto),
-        SmoothScrollFeatureEnablement::Default
+        options.behavior.value_or(ScrollBehavior::Auto)
     };
     renderer()->scrollRectToVisible(absoluteBounds, insideFixed, visibleOptions);
 }

Modified: trunk/Source/WebCore/editing/Editor.cpp (279987 => 279988)


--- trunk/Source/WebCore/editing/Editor.cpp	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebCore/editing/Editor.cpp	2021-07-16 17:17:17 UTC (rev 279988)
@@ -265,10 +265,10 @@
         options.add(FrameSelection::DoNotSetFocus);
     if (m_options & TemporarySelectionOption::RevealSelection)
         options.add(FrameSelection::RevealSelection);
+    if (m_options & TemporarySelectionOption::DelegateMainFrameScroll)
+        options.add(FrameSelection::DelegateMainFrameScroll);
     if (m_options & TemporarySelectionOption::SmoothScroll)
         options.add(FrameSelection::SmoothScroll);
-    if (m_options & TemporarySelectionOption::OverrideSmoothScrollFeatureEnablment)
-        options.add(FrameSelection::OverrideSmoothScrollFeatureEnablement);
     m_document->selection().setSelection(selection, options);
 }
 

Modified: trunk/Source/WebCore/editing/Editor.h (279987 => 279988)


--- trunk/Source/WebCore/editing/Editor.h	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebCore/editing/Editor.h	2021-07-16 17:17:17 UTC (rev 279988)
@@ -121,7 +121,7 @@
     
     SmoothScroll = 1 << 4,
     
-    OverrideSmoothScrollFeatureEnablment = 1 << 5,
+    DelegateMainFrameScroll = 1 << 5,
 };
 
 class TemporarySelectionChange {

Modified: trunk/Source/WebCore/editing/FrameSelection.cpp (279987 => 279988)


--- trunk/Source/WebCore/editing/FrameSelection.cpp	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebCore/editing/FrameSelection.cpp	2021-07-16 17:17:17 UTC (rev 279988)
@@ -232,6 +232,9 @@
     case SelectionRevealMode::RevealUpToMainFrame:
         options.add(RevealSelectionUpToMainFrame);
         break;
+    case SelectionRevealMode::DelegateMainFrameScroll:
+        options.add(DelegateMainFrameScroll);
+        break;
     }
     setSelection(newSelection, options, newIntent);
 }
@@ -432,6 +435,8 @@
         m_selectionRevealMode = SelectionRevealMode::RevealUpToMainFrame;
     else if (options & RevealSelection)
         m_selectionRevealMode = SelectionRevealMode::Reveal;
+    else if (options & DelegateMainFrameScroll)
+        m_selectionRevealMode = SelectionRevealMode::DelegateMainFrameScroll;
     else
         m_selectionRevealMode = SelectionRevealMode::DoNotReveal;
     m_alwaysAlignCursorOnScrollWhenRevealingSelection = align == AlignCursorOnScrollAlways;
@@ -446,7 +451,7 @@
     if (frameView && frameView->layoutContext().isLayoutPending())
         return;
 
-    updateAndRevealSelection(intent, options.contains(SmoothScroll) ? ScrollBehavior::Smooth : ScrollBehavior::Instant, options.contains(OverrideSmoothScrollFeatureEnablement) ? SmoothScrollFeatureEnablement::Override : SmoothScrollFeatureEnablement::Default);
+    updateAndRevealSelection(intent, options.contains(SmoothScroll) ? ScrollBehavior::Smooth : ScrollBehavior::Instant);
 
     if (options & IsUserTriggered) {
         if (auto* client = protectedDocument->editor().client())
@@ -473,7 +478,7 @@
         view->selection().clear();
 }
 
-void FrameSelection::updateAndRevealSelection(const AXTextStateChangeIntent& intent, ScrollBehavior scrollBehavior, SmoothScrollFeatureEnablement overideFeatureEnablement)
+void FrameSelection::updateAndRevealSelection(const AXTextStateChangeIntent& intent, ScrollBehavior scrollBehavior)
 {
     if (!m_pendingSelectionUpdate)
         return;
@@ -490,7 +495,7 @@
         else
             alignment = m_alwaysAlignCursorOnScrollWhenRevealingSelection ? ScrollAlignment::alignTopAlways : ScrollAlignment::alignToEdgeIfNeeded;
 
-        revealSelection(m_selectionRevealMode, alignment, RevealExtent, scrollBehavior, overideFeatureEnablement);
+        revealSelection(m_selectionRevealMode, alignment, RevealExtent, scrollBehavior);
     }
 
     notifyAccessibilityForSelectionChange(intent);
@@ -2390,7 +2395,7 @@
     return scanForForm(start);
 }
 
-void FrameSelection::revealSelection(SelectionRevealMode revealMode, const ScrollAlignment& alignment, RevealExtentOption revealExtentOption, ScrollBehavior scrollBehavior, SmoothScrollFeatureEnablement overrideFeatureEnablement)
+void FrameSelection::revealSelection(SelectionRevealMode revealMode, const ScrollAlignment& alignment, RevealExtentOption revealExtentOption, ScrollBehavior scrollBehavior)
 {
     if (revealMode == SelectionRevealMode::DoNotReveal)
         return;
@@ -2413,7 +2418,7 @@
             if (!m_scrollingSuppressCount) {
                 auto* scrollableArea = layer->ensureLayerScrollableArea();
                 scrollableArea->setAdjustForIOSCaretWhenScrolling(true);
-                layer->scrollRectToVisible(rect, insideFixed, { revealMode, alignment, alignment, ShouldAllowCrossOriginScrolling::Yes, scrollBehavior, overrideFeatureEnablement});
+                layer->scrollRectToVisible(rect, insideFixed, { revealMode, alignment, alignment, ShouldAllowCrossOriginScrolling::Yes, scrollBehavior});
                 scrollableArea->setAdjustForIOSCaretWhenScrolling(false);
                 updateAppearance();
                 if (m_document->page())
@@ -2424,7 +2429,7 @@
         // FIXME: This code only handles scrolling the startContainer's layer, but
         // the selection rect could intersect more than just that.
         // See <rdar://problem/4799899>.
-        if (start.deprecatedNode()->renderer()->scrollRectToVisible(rect, insideFixed, { revealMode, alignment, alignment, ShouldAllowCrossOriginScrolling::Yes, scrollBehavior, overrideFeatureEnablement}))
+        if (start.deprecatedNode()->renderer()->scrollRectToVisible(rect, insideFixed, { revealMode, alignment, alignment, ShouldAllowCrossOriginScrolling::Yes, scrollBehavior}))
             updateAppearance();
 #endif
     }

Modified: trunk/Source/WebCore/editing/FrameSelection.h (279987 => 279988)


--- trunk/Source/WebCore/editing/FrameSelection.h	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebCore/editing/FrameSelection.h	2021-07-16 17:17:17 UTC (rev 279988)
@@ -124,7 +124,7 @@
         RevealSelection = 1 << 7,
         RevealSelectionUpToMainFrame = 1 << 8,
         SmoothScroll = 1 << 9,
-        OverrideSmoothScrollFeatureEnablement = 1 << 10
+        DelegateMainFrameScroll = 1 << 10
     };
     static constexpr OptionSet<SetSelectionOption> defaultSetSelectionOptions(EUserTriggered = NotUserTriggered);
 
@@ -248,7 +248,7 @@
 
     WEBCORE_EXPORT HTMLFormElement* currentForm() const;
 
-    WEBCORE_EXPORT void revealSelection(SelectionRevealMode = SelectionRevealMode::Reveal, const ScrollAlignment& = ScrollAlignment::alignCenterIfNeeded, RevealExtentOption = DoNotRevealExtent, ScrollBehavior = ScrollBehavior::Instant, SmoothScrollFeatureEnablement = SmoothScrollFeatureEnablement::Default);
+    WEBCORE_EXPORT void revealSelection(SelectionRevealMode = SelectionRevealMode::Reveal, const ScrollAlignment& = ScrollAlignment::alignCenterIfNeeded, RevealExtentOption = DoNotRevealExtent, ScrollBehavior = ScrollBehavior::Instant);
     WEBCORE_EXPORT void setSelectionFromNone();
 
     bool shouldShowBlockCursor() const { return m_shouldShowBlockCursor; }
@@ -263,7 +263,7 @@
     void updateFromAssociatedLiveRange();
 
 private:
-    void updateAndRevealSelection(const AXTextStateChangeIntent&, ScrollBehavior = ScrollBehavior::Instant, SmoothScrollFeatureEnablement = SmoothScrollFeatureEnablement::Override);
+    void updateAndRevealSelection(const AXTextStateChangeIntent&, ScrollBehavior = ScrollBehavior::Instant);
     void updateDataDetectorsForSelection();
 
     bool setSelectionWithoutUpdatingAppearance(const VisibleSelection&, OptionSet<SetSelectionOption>, CursorAlignOnScroll, TextGranularity);

Modified: trunk/Source/WebCore/loader/EmptyClients.h (279987 => 279988)


--- trunk/Source/WebCore/loader/EmptyClients.h	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebCore/loader/EmptyClients.h	2021-07-16 17:17:17 UTC (rev 279988)
@@ -164,6 +164,7 @@
     void setCursorHiddenUntilMouseMoves(bool) final { }
 
     void scrollContainingScrollViewsToRevealRect(const IntRect&) const final { }
+    void scrollMainFrameToRevealRect(const IntRect&) const final { }
 
     void attachRootGraphicsLayer(Frame&, GraphicsLayer*) final { }
     void attachViewOverlayGraphicsLayer(GraphicsLayer*) final { }

Modified: trunk/Source/WebCore/page/Chrome.cpp (279987 => 279988)


--- trunk/Source/WebCore/page/Chrome.cpp	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebCore/page/Chrome.cpp	2021-07-16 17:17:17 UTC (rev 279988)
@@ -139,6 +139,11 @@
     m_client.scrollContainingScrollViewsToRevealRect(rect);
 }
 
+void Chrome::scrollMainFrameToRevealRect(const IntRect& rect) const
+{
+    m_client.scrollMainFrameToRevealRect(rect);
+}
+
 void Chrome::setWindowRect(const FloatRect& rect) const
 {
     m_client.setWindowRect(rect);

Modified: trunk/Source/WebCore/page/Chrome.h (279987 => 279988)


--- trunk/Source/WebCore/page/Chrome.h	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebCore/page/Chrome.h	2021-07-16 17:17:17 UTC (rev 279988)
@@ -99,6 +99,7 @@
     FloatSize overrideScreenSize() const override;
 
     void scrollContainingScrollViewsToRevealRect(const IntRect&) const;
+    void scrollMainFrameToRevealRect(const IntRect&) const;
 
     void contentsSizeChanged(Frame&, const IntSize&) const;
 

Modified: trunk/Source/WebCore/page/ChromeClient.h (279987 => 279988)


--- trunk/Source/WebCore/page/ChromeClient.h	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebCore/page/ChromeClient.h	2021-07-16 17:17:17 UTC (rev 279988)
@@ -228,7 +228,9 @@
 
     virtual void contentsSizeChanged(Frame&, const IntSize&) const = 0;
     virtual void intrinsicContentsSizeChanged(const IntSize&) const = 0;
+
     virtual void scrollContainingScrollViewsToRevealRect(const IntRect&) const { }; // Currently only Mac has a non empty implementation.
+    virtual void scrollMainFrameToRevealRect(const IntRect&) const { };
 
     virtual bool shouldUnavailablePluginMessageBeButton(RenderEmbeddedObject::PluginUnavailabilityReason) const { return false; }
     virtual void unavailablePluginButtonClicked(Element&, RenderEmbeddedObject::PluginUnavailabilityReason) const { }

Modified: trunk/Source/WebCore/page/ScrollBehavior.cpp (279987 => 279988)


--- trunk/Source/WebCore/page/ScrollBehavior.cpp	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebCore/page/ScrollBehavior.cpp	2021-07-16 17:17:17 UTC (rev 279988)
@@ -33,7 +33,7 @@
 
 namespace WebCore {
 
-bool useSmoothScrolling(ScrollBehavior behavior, Element* associatedElement, SmoothScrollFeatureEnablement overrideFeatureEnablement)
+bool useSmoothScrolling(ScrollBehavior behavior, Element* associatedElement)
 {
     if (!associatedElement)
         return false;
@@ -43,7 +43,7 @@
     if (associatedElement == associatedElement->document().scrollingElement())
         associatedElement = associatedElement->document().documentElement();
 
-    if (!associatedElement->renderer() || (overrideFeatureEnablement == SmoothScrollFeatureEnablement::Default && !associatedElement->document().settings().CSSOMViewSmoothScrollingEnabled()))
+    if (!associatedElement->renderer() || !associatedElement->document().settings().CSSOMViewSmoothScrollingEnabled())
         return false;
 
     // https://drafts.csswg.org/cssom-view/#scrolling

Modified: trunk/Source/WebCore/page/ScrollBehavior.h (279987 => 279988)


--- trunk/Source/WebCore/page/ScrollBehavior.h	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebCore/page/ScrollBehavior.h	2021-07-16 17:17:17 UTC (rev 279988)
@@ -35,8 +35,6 @@
     Smooth
 };
 
-enum class SmoothScrollFeatureEnablement : bool { Default, Override };
+bool useSmoothScrolling(ScrollBehavior, Element* associatedElement);
 
-bool useSmoothScrolling(ScrollBehavior, Element* associatedElement, SmoothScrollFeatureEnablement = SmoothScrollFeatureEnablement::Default);
-
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/ScrollTypes.h (279987 => 279988)


--- trunk/Source/WebCore/platform/ScrollTypes.h	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebCore/platform/ScrollTypes.h	2021-07-16 17:17:17 UTC (rev 279988)
@@ -241,6 +241,7 @@
 enum class SelectionRevealMode : uint8_t  {
     Reveal,
     RevealUpToMainFrame, // Scroll overflow and iframes, but not the main frame.
+    DelegateMainFrameScroll, // Similar to RevealUpToMainFrame, but make sure to manually call the main frame scroll.
     DoNotReveal
 };
 

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (279987 => 279988)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2021-07-16 17:17:17 UTC (rev 279988)
@@ -2405,7 +2405,7 @@
     auto scrollPositionChangeOptionsForElement = [this, options](Element* element)
     {
         auto scrollPositionOptions = ScrollPositionChangeOptions::createProgrammatic();
-        if (!renderer().frame().eventHandler().autoscrollInProgress() && element && useSmoothScrolling(options.behavior, element, options.overrideFeatureEnablement))
+        if (!renderer().frame().eventHandler().autoscrollInProgress() && element && useSmoothScrolling(options.behavior, element))
             scrollPositionOptions.animated = AnimatedScroll::Yes;
         return scrollPositionOptions;
     };
@@ -2477,6 +2477,11 @@
             if (options.revealMode == SelectionRevealMode::RevealUpToMainFrame && frameView.frame().isMainFrame())
                 return;
 
+            if (options.revealMode == SelectionRevealMode::DelegateMainFrameScroll && frameView.frame().isMainFrame()) {
+                page().chrome().scrollMainFrameToRevealRect(snappedIntRect(absoluteRect));
+                return;
+            }
+
             auto minScrollPosition = frameView.minimumScrollPosition();
             auto maxScrollPosition = frameView.maximumScrollPosition();
 
@@ -2512,7 +2517,7 @@
             }
 
             // This is the outermost view of a web page, so after scrolling this view we
-            // scroll its container by calling Page::scrollRectIntoView.
+            // scroll its container by calling Page::scrollMainFrameToRevealRect.
             // This only has an effect on the Mac platform in applications
             // that put web views into scrolling containers, such as Mac OS X Mail.
             // The canAutoscroll function in EventHandler also knows about this.

Modified: trunk/Source/WebCore/rendering/RenderLayer.h (279987 => 279988)


--- trunk/Source/WebCore/rendering/RenderLayer.h	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebCore/rendering/RenderLayer.h	2021-07-16 17:17:17 UTC (rev 279988)
@@ -141,7 +141,6 @@
     const ScrollAlignment& alignY { ScrollAlignment::alignCenterIfNeeded };
     ShouldAllowCrossOriginScrolling shouldAllowCrossOriginScrolling { ShouldAllowCrossOriginScrolling::No };
     ScrollBehavior behavior { ScrollBehavior::Auto };
-    SmoothScrollFeatureEnablement overrideFeatureEnablement { SmoothScrollFeatureEnablement::Default };
 };
 
 using ScrollingScope = uint64_t;

Modified: trunk/Source/WebKit/ChangeLog (279987 => 279988)


--- trunk/Source/WebKit/ChangeLog	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebKit/ChangeLog	2021-07-16 17:17:17 UTC (rev 279988)
@@ -1,3 +1,44 @@
+2021-07-16  Megan Gardner  <megan_gard...@apple.com>
+
+        Pipe App Highlight scrolling through UI Process in preparation for Note Overlay avoidance.
+        https://bugs.webkit.org/show_bug.cgi?id=227914
+
+        Reviewed by Tim Horton.
+
+        In order to correctly avoid the note overlay that can potentially obscure the web view,
+        we need to pipe the scrolling through the UI process. This patch does that work
+        and will be followed up shortly by one that does the actual work of overlay avoidance.
+        For iOS, this just uses the main frame UI Scrolling that we already use, but for 
+        mac, we need to do the last scroll in the web process after adjusting it with the overlay 
+        information. 
+
+        * UIProcess/API/gtk/PageClientImpl.cpp:
+        (WebKit::PageClientImpl::requestScrollToRect):
+        * UIProcess/API/gtk/PageClientImpl.h:
+        * UIProcess/Cocoa/WebPageProxyCocoa.mm:
+        (WebKit::WebPageProxy::requestScrollToRect):
+        (WebKit::WebPageProxy::scrollToRect):
+        * UIProcess/Cocoa/WebViewImpl.h:
+        * UIProcess/Cocoa/WebViewImpl.mm:
+        (WebKit::WebViewImpl::scrollToRect):
+        * UIProcess/PageClient.h:
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * UIProcess/ios/PageClientImplIOS.h:
+        * UIProcess/ios/PageClientImplIOS.mm:
+        (WebKit::PageClientImpl::requestScrollToRect):
+        * UIProcess/mac/PageClientImplMac.h:
+        * UIProcess/mac/PageClientImplMac.mm:
+        (WebKit::PageClientImpl::requestScrollToRect):
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::scrollMainFrameToRevealRect const):
+        (WebKit::WebChromeClient::scrollRectIntoView const): Deleted.
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+        * WebProcess/WebProcess.h:
+        * WebProcess/WebProcess.messages.in:
+        * WebProcess/cocoa/WebProcessCocoa.mm:
+        (WebKit::WebProcess::scrollToRect):
+
 2021-07-16  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [GTK][WPE] PSON: accessibility doesn't work after a cross site navigation

Modified: trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp (279987 => 279988)


--- trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp	2021-07-16 17:17:17 UTC (rev 279988)
@@ -97,6 +97,11 @@
     notImplemented();
 }
 
+void PageClientImpl::requestScrollToRect(const WebCore::FloatRect&, const WebCore::FloatPoint&)
+{
+    notImplemented();
+}
+
 WebCore::FloatPoint PageClientImpl::viewScrollPosition()
 {
     return { };

Modified: trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h (279987 => 279988)


--- trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h	2021-07-16 17:17:17 UTC (rev 279988)
@@ -63,6 +63,7 @@
     std::unique_ptr<DrawingAreaProxy> createDrawingAreaProxy(WebProcessProxy&) override;
     void setViewNeedsDisplay(const WebCore::Region&) override;
     void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin) override;
+    void requestScrollToRect(const WebCore::FloatRect& targetRect, const WebCore::FloatPoint& origin) override;
     WebCore::FloatPoint viewScrollPosition() override;
     WebCore::IntSize viewSize() override;
     bool isViewWindowActive() override;

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h (279987 => 279988)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h	2021-07-16 17:17:17 UTC (rev 279988)
@@ -546,6 +546,8 @@
     void gestureEventWasNotHandledByWebCoreFromViewOnly(NSEvent *);
 
     void didRestoreScrollPosition();
+    
+    void scrollToRect(const WebCore::FloatRect&, const WebCore::FloatPoint&);
 
     void setTotalHeightOfBanners(CGFloat totalHeightOfBanners) { m_totalHeightOfBanners = totalHeightOfBanners; }
     CGFloat totalHeightOfBanners() const { return m_totalHeightOfBanners; }

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (279987 => 279988)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2021-07-16 17:17:17 UTC (rev 279988)
@@ -2570,6 +2570,11 @@
 
 #endif // HAVE(NSSCROLLVIEW_SEPARATOR_TRACKING_ADAPTER)
 
+void WebViewImpl::scrollToRect(const WebCore::FloatRect& targetRect, const WebCore::FloatPoint& origin)
+{
+    m_page->scrollToRect(targetRect, origin);
+}
+
 NSView *WebViewImpl::hitTest(CGPoint point)
 {
     NSView *hitView = [m_view _web_superHitTest:NSPointFromCGPoint(point)];

Modified: trunk/Source/WebKit/UIProcess/PageClient.h (279987 => 279988)


--- trunk/Source/WebKit/UIProcess/PageClient.h	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebKit/UIProcess/PageClient.h	2021-07-16 17:17:17 UTC (rev 279988)
@@ -612,6 +612,7 @@
 #if ENABLE(APP_HIGHLIGHTS)
     virtual void storeAppHighlight(const WebCore::AppHighlight&) = 0;
 #endif
+    virtual void requestScrollToRect(const WebCore::FloatRect& targetRect, const WebCore::FloatPoint& origin) { }
 
 #if PLATFORM(COCOA)
     virtual void cancelPointersForGestureRecognizer(UIGestureRecognizer*) { }

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (279987 => 279988)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2021-07-16 17:17:17 UTC (rev 279988)
@@ -10753,6 +10753,16 @@
 }
 #endif
 
+void WebPageProxy::requestScrollToRect(const FloatRect& targetRect, const FloatPoint& origin)
+{
+    pageClient().requestScrollToRect(targetRect, origin);
+}
+
+void WebPageProxy::scrollToRect(const FloatRect& targetRect, const FloatPoint& origin)
+{
+    send(Messages::WebPage::ScrollToRect(targetRect, origin));
+}
+
 #if PLATFORM(COCOA)
 void WebPageProxy::appPrivacyReportTestingData(CompletionHandler<void(const AppPrivacyReportTestingData&)>&& completionHandler)
 {

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (279987 => 279988)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2021-07-16 17:17:17 UTC (rev 279988)
@@ -903,11 +903,14 @@
 
     void setInputMethodState(std::optional<InputMethodState>&&);
 #endif
+        
+    void requestScrollToRect(const WebCore::FloatRect& targetRect, const WebCore::FloatPoint& origin);
+    void scrollToRect(const WebCore::FloatRect& targetRect, const WebCore::FloatPoint& origin);
 
 #if PLATFORM(COCOA)
     void windowAndViewFramesChanged(const WebCore::FloatRect& viewFrameInWindowCoordinates, const WebCore::FloatPoint& accessibilityViewCoordinates);
     void setMainFrameIsScrollable(bool);
-
+        
     void sendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, const String& textInput);
     bool shouldDelayWindowOrderingForEvent(const WebMouseEvent&);
     bool acceptsFirstMouse(int eventNumber, const WebMouseEvent&);

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in (279987 => 279988)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in	2021-07-16 17:17:17 UTC (rev 279988)
@@ -510,6 +510,8 @@
 #endif
 
     DidRestoreScrollPosition()
+    
+    RequestScrollToRect(WebCore::FloatRect targetRect, WebCore::FloatPoint origin)
 
     GetLoadDecisionForIcon(struct WebCore::LinkIcon icon, WebKit::CallbackID callbackID)
 

Modified: trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h (279987 => 279988)


--- trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h	2021-07-16 17:17:17 UTC (rev 279988)
@@ -214,7 +214,9 @@
     void scrollingNodeScrollViewDidScroll() override;
     void scrollingNodeScrollWillStartScroll() override;
     void scrollingNodeScrollDidEndScroll() override;
-
+        
+    void requestScrollToRect(const WebCore::FloatRect& targetRect, const WebCore::FloatPoint& origin) override;
+        
     // Auxiliary Client Creation
 #if ENABLE(FULLSCREEN_API)
     WebFullScreenManagerProxyClient& fullScreenManagerProxyClient() override;

Modified: trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm (279987 => 279988)


--- trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm	2021-07-16 17:17:17 UTC (rev 279988)
@@ -1023,6 +1023,11 @@
     return [m_contentView backgroundColor].CGColor;
 }
 
+void PageClientImpl::requestScrollToRect(const FloatRect& targetRect, const FloatPoint& origin)
+{
+    [m_contentView _scrollToRect:targetRect withOrigin:origin minimumScrollDistance:0];
+}
+
 } // namespace WebKit
 
 #endif // PLATFORM(IOS_FAMILY)

Modified: trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.h (279987 => 279988)


--- trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.h	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.h	2021-07-16 17:17:17 UTC (rev 279988)
@@ -290,6 +290,8 @@
 #if ENABLE(DATA_DETECTION)
     void handleClickForDataDetectionResult(const WebCore::DataDetectorElementInfo&, const WebCore::IntPoint&) final;
 #endif
+        
+    void requestScrollToRect(const WebCore::FloatRect& targetRect, const WebCore::FloatPoint& origin) override;
 
     NSView *m_view;
     WeakPtr<WebViewImpl> m_impl;

Modified: trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm (279987 => 279988)


--- trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm	2021-07-16 17:17:17 UTC (rev 279988)
@@ -972,6 +972,12 @@
     m_impl->didRestoreScrollPosition();
 }
 
+void PageClientImpl::requestScrollToRect(const WebCore::FloatRect& targetRect, const WebCore::FloatPoint& origin)
+{
+    // FIXME: Add additional logic to avoid Note Pip.
+    m_impl->scrollToRect(targetRect, origin);
+}
+
 bool PageClientImpl::windowIsFrontWindowUnderMouse(const NativeWebMouseEvent& event)
 {
     return m_impl->windowIsFrontWindowUnderMouse(event.nativeEvent());

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp (279987 => 279988)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp	2021-07-16 17:17:17 UTC (rev 279988)
@@ -655,6 +655,11 @@
     }
 }
 
+void WebChromeClient::scrollMainFrameToRevealRect(const IntRect& rect) const
+{
+    m_page.send(Messages::WebPageProxy::RequestScrollToRect(rect, rect.center()));
+}
+
 void WebChromeClient::scrollContainingScrollViewsToRevealRect(const IntRect&) const
 {
     notImplemented();

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h (279987 => 279988)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h	2021-07-16 17:17:17 UTC (rev 279988)
@@ -133,7 +133,9 @@
     PlatformPageClient platformPageClient() const final;
     void contentsSizeChanged(WebCore::Frame&, const WebCore::IntSize&) const final;
     void intrinsicContentsSizeChanged(const WebCore::IntSize&) const final;
+
     void scrollContainingScrollViewsToRevealRect(const WebCore::IntRect&) const final; // Currently only Mac has a non empty implementation.
+    void scrollMainFrameToRevealRect(const WebCore::IntRect&) const final;
 
     bool shouldUnavailablePluginMessageBeButton(WebCore::RenderEmbeddedObject::PluginUnavailabilityReason) const final;
     void unavailablePluginButtonClicked(WebCore::Element&, WebCore::RenderEmbeddedObject::PluginUnavailabilityReason) const final;

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (279987 => 279988)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2021-07-16 17:17:17 UTC (rev 279988)
@@ -7679,6 +7679,11 @@
 }
 #endif
 
+void WebPage::scrollToRect(const WebCore::FloatRect& targetRect, const WebCore::FloatPoint& origin)
+{
+    mainFrameView()->setScrollPosition(IntPoint(targetRect.minXMinYCorner()));
+}
+
 } // namespace WebKit
 
 #undef WEBPAGE_RELEASE_LOG

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (279987 => 279988)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2021-07-16 17:17:17 UTC (rev 279988)
@@ -1133,6 +1133,8 @@
 
     bool alwaysShowsHorizontalScroller() const { return m_alwaysShowsHorizontalScroller; };
     bool alwaysShowsVerticalScroller() const { return m_alwaysShowsVerticalScroller; };
+    
+    void scrollToRect(const WebCore::FloatRect& targetRect, const WebCore::FloatPoint& origin);
 
     void setMinimumSizeForAutoLayout(const WebCore::IntSize&);
     WebCore::IntSize minimumSizeForAutoLayout() const { return m_minimumSizeForAutoLayout; }

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (279987 => 279988)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in	2021-07-16 17:17:17 UTC (rev 279988)
@@ -644,6 +644,8 @@
     UpdateWithTextRecognitionResult(struct WebCore::TextRecognitionResult result, struct WebCore::ElementContext element, WebCore::FloatPoint location) -> (enum:uint8_t WebKit::TextRecognitionUpdateResult result) Async
 #endif
 
+    ScrollToRect(WebCore::FloatRect targetRect, WebCore::FloatPoint origin)
+
 #if HAVE(ARKIT_INLINE_PREVIEW_MAC)
     ModelElementPreviewDidObtainContextId(struct WebCore::ElementContext elementContext, String uuid, uint32_t contextId)
 #endif

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (279987 => 279988)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2021-07-16 17:17:17 UTC (rev 279988)
@@ -1,3 +1,14 @@
+2021-07-16  Megan Gardner  <megan_gard...@apple.com>
+
+        Pipe App Highlight scrolling through UI Process in preparation for Note Overlay avoidance.
+        https://bugs.webkit.org/show_bug.cgi?id=227914
+
+        Reviewed by Tim Horton.
+
+        * WebCoreSupport/WebChromeClient.h:
+        * WebCoreSupport/WebChromeClient.mm:
+        (WebChromeClient::scrollMainFrameToRevealRect const):
+
 2021-07-15  Jean-Yves Avenard  <j...@apple.com>
 
         [Wk1] media/media-source/media-webm-opus-partial.html is a consistent failure (Enable VP8/VP9/Vorbis/Opus in WebKitLegacy)

Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h (279987 => 279988)


--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h	2021-07-16 17:17:17 UTC (rev 279988)
@@ -112,8 +112,8 @@
     PlatformPageClient platformPageClient() const final;
     void contentsSizeChanged(WebCore::Frame&, const WebCore::IntSize&) const final;
     void intrinsicContentsSizeChanged(const WebCore::IntSize&) const final { }
+
     void scrollContainingScrollViewsToRevealRect(const WebCore::IntRect&) const final;
-
     void setStatusbarText(const String&) override;
 
     bool shouldUnavailablePluginMessageBeButton(WebCore::RenderEmbeddedObject::PluginUnavailabilityReason) const final;

Modified: trunk/Source/WebKitLegacy/win/ChangeLog (279987 => 279988)


--- trunk/Source/WebKitLegacy/win/ChangeLog	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebKitLegacy/win/ChangeLog	2021-07-16 17:17:17 UTC (rev 279988)
@@ -1,3 +1,12 @@
+2021-07-16  Megan Gardner  <megan_gard...@apple.com>
+
+        Pipe App Highlight scrolling through UI Process in preparation for Note Overlay avoidance.
+        https://bugs.webkit.org/show_bug.cgi?id=227914
+
+        Reviewed by Tim Horton.
+
+        * WebCoreSupport/WebChromeClient.h:
+
 2021-07-15  Chris Dumez  <cdu...@apple.com>
 
         Add initial support for BroadcastChannel behind a runtime flag

Modified: trunk/Source/WebKitLegacy/win/WebCoreSupport/WebChromeClient.h (279987 => 279988)


--- trunk/Source/WebKitLegacy/win/WebCoreSupport/WebChromeClient.h	2021-07-16 16:39:15 UTC (rev 279987)
+++ trunk/Source/WebKitLegacy/win/WebCoreSupport/WebChromeClient.h	2021-07-16 17:17:17 UTC (rev 279988)
@@ -145,6 +145,7 @@
 #endif
 
     void scrollContainingScrollViewsToRevealRect(const WebCore::IntRect&) const final { }
+    void scrollMainFrameToRevealRect(const WebCore::IntRect&) const final { }
 
 #if ENABLE(VIDEO)
     bool supportsVideoFullscreen(WebCore::HTMLMediaElementEnums::VideoFullscreenMode) final;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to