Title: [243735] trunk/Source/WebCore
Revision
243735
Author
[email protected]
Date
2019-04-01 20:16:48 -0700 (Mon, 01 Apr 2019)

Log Message

Remove some unused iOS scrolling-related code in Frame
https://bugs.webkit.org/show_bug.cgi?id=196473

Reviewed by Zalan Bujtas.

This code has no callers.

* page/Frame.cpp:
(WebCore::Frame::Frame):
(WebCore::Frame::scrollOverflowLayer): Deleted.
(WebCore::Frame::overflowAutoScrollTimerFired): Deleted.
(WebCore::Frame::startOverflowAutoScroll): Deleted.
(WebCore::Frame::checkOverflowScroll): Deleted.
* page/Frame.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (243734 => 243735)


--- trunk/Source/WebCore/ChangeLog	2019-04-02 03:14:50 UTC (rev 243734)
+++ trunk/Source/WebCore/ChangeLog	2019-04-02 03:16:48 UTC (rev 243735)
@@ -1,3 +1,20 @@
+2019-04-01  Simon Fraser  <[email protected]>
+
+        Remove some unused iOS scrolling-related code in Frame
+        https://bugs.webkit.org/show_bug.cgi?id=196473
+
+        Reviewed by Zalan Bujtas.
+
+        This code has no callers.
+
+        * page/Frame.cpp:
+        (WebCore::Frame::Frame):
+        (WebCore::Frame::scrollOverflowLayer): Deleted.
+        (WebCore::Frame::overflowAutoScrollTimerFired): Deleted.
+        (WebCore::Frame::startOverflowAutoScroll): Deleted.
+        (WebCore::Frame::checkOverflowScroll): Deleted.
+        * page/Frame.h:
+
 2019-04-01  Chris Dumez  <[email protected]>
 
         Attr nodes are not cloned properly

Modified: trunk/Source/WebCore/page/Frame.cpp (243734 => 243735)


--- trunk/Source/WebCore/page/Frame.cpp	2019-04-02 03:14:50 UTC (rev 243734)
+++ trunk/Source/WebCore/page/Frame.cpp	2019-04-02 03:16:48 UTC (rev 243735)
@@ -152,13 +152,8 @@
     , m_editor(makeUniqueRef<Editor>(*this))
     , m_selection(makeUniqueRef<FrameSelection>(this))
     , m_animationController(makeUniqueRef<CSSAnimationController>(*this))
-#if PLATFORM(IOS_FAMILY)
-    , m_overflowAutoScrollTimer(*this, &Frame::overflowAutoScrollTimerFired)
-    , m_selectionChangeCallbacksDisabled(false)
-#endif
     , m_pageZoomFactor(parentPageZoomFactor(this))
     , m_textZoomFactor(parentTextZoomFactor(this))
-    , m_activeDOMObjectsAndAnimationsSuspendedCount(0)
     , m_eventHandler(makeUniqueRef<EventHandler>(*this))
 {
     ProcessWarming::initializeNames();
@@ -500,150 +495,7 @@
 }
 
 #if PLATFORM(IOS_FAMILY)
-void Frame::scrollOverflowLayer(RenderLayer* layer, const IntRect& visibleRect, const IntRect& exposeRect)
-{
-    if (!layer)
-        return;
 
-    RenderBox* box = layer->renderBox();
-    if (!box)
-        return;
-
-    if (visibleRect.intersects(exposeRect))
-        return;
-
-    // FIXME: Why isn't this just calling RenderLayer::scrollRectToVisible()?
-    ScrollOffset scrollOffset = layer->scrollOffset();
-    int exposeLeft = exposeRect.x();
-    int exposeRight = exposeLeft + exposeRect.width();
-    int clientWidth = roundToInt(box->clientWidth());
-    if (exposeLeft <= 0)
-        scrollOffset.setX(std::max(0, scrollOffset.x() + exposeLeft - clientWidth / 2));
-    else if (exposeRight >= clientWidth)
-        scrollOffset.setX(std::min(box->scrollWidth() - clientWidth, scrollOffset.x() + clientWidth / 2));
-
-    int exposeTop = exposeRect.y();
-    int exposeBottom = exposeTop + exposeRect.height();
-    int clientHeight = roundToInt(box->clientHeight());
-    if (exposeTop <= 0)
-        scrollOffset.setY(std::max(0, scrollOffset.y() + exposeTop - clientHeight / 2));
-    else if (exposeBottom >= clientHeight)
-        scrollOffset.setY(std::min(box->scrollHeight() - clientHeight, scrollOffset.y() + clientHeight / 2));
-
-    layer->scrollToOffset(scrollOffset, ScrollClamping::Unclamped);
-    selection().setCaretRectNeedsUpdate();
-    selection().updateAppearance();
-}
-
-void Frame::overflowAutoScrollTimerFired()
-{
-    if (!eventHandler().mousePressed() || checkOverflowScroll(PerformOverflowScroll) == OverflowScrollNone) {
-        if (m_overflowAutoScrollTimer.isActive())
-            m_overflowAutoScrollTimer.stop();
-    }
-}
-
-void Frame::startOverflowAutoScroll(const IntPoint& mousePosition)
-{
-    m_overflowAutoScrollPos = mousePosition;
-
-    if (m_overflowAutoScrollTimer.isActive())
-        return;
-
-    if (checkOverflowScroll(DoNotPerformOverflowScroll) == OverflowScrollNone)
-        return;
-
-    m_overflowAutoScrollTimer.startRepeating(scrollFrequency);
-    m_overflowAutoScrollDelta = 3;
-}
-
-int Frame::checkOverflowScroll(OverflowScrollAction action)
-{
-    Position extent = selection().selection().extent();
-    if (extent.isNull())
-        return OverflowScrollNone;
-
-    RenderObject* renderer = extent.deprecatedNode()->renderer();
-    if (!renderer)
-        return OverflowScrollNone;
-
-    FrameView* view = this->view();
-    if (!view)
-        return OverflowScrollNone;
-
-    RenderBlock* containingBlock = renderer->containingBlock();
-    if (!containingBlock || !containingBlock->hasOverflowClip())
-        return OverflowScrollNone;
-    RenderLayer* layer = containingBlock->layer();
-    ASSERT(layer);
-
-    IntRect visibleRect = IntRect(view->scrollX(), view->scrollY(), view->visibleWidth(), view->visibleHeight());
-    IntPoint position = m_overflowAutoScrollPos;
-    if (visibleRect.contains(position.x(), position.y()))
-        return OverflowScrollNone;
-
-    int scrollType = 0;
-    int deltaX = 0;
-    int deltaY = 0;
-    IntPoint selectionPosition;
-
-    // This constant will make the selection draw a little bit beyond the edge of the visible area.
-    // This prevents a visual glitch, in that you can fail to select a portion of a character that
-    // is being rendered right at the edge of the visible rectangle.
-    // FIXME: This probably needs improvement, and may need to take the font size into account.
-    static const int scrollBoundsAdjustment = 3;
-
-    // FIXME: Make a small buffer at the end of a visible rectangle so that autoscrolling works 
-    // even if the visible extends to the limits of the screen.
-    if (position.x() < visibleRect.x()) {
-        scrollType |= OverflowScrollLeft;
-        if (action == PerformOverflowScroll) {
-            deltaX -= static_cast<int>(m_overflowAutoScrollDelta);
-            selectionPosition.setX(view->scrollX() - scrollBoundsAdjustment);
-        }
-    } else if (position.x() > visibleRect.maxX()) {
-        scrollType |= OverflowScrollRight;
-        if (action == PerformOverflowScroll) {
-            deltaX += static_cast<int>(m_overflowAutoScrollDelta);
-            selectionPosition.setX(view->scrollX() + view->visibleWidth() + scrollBoundsAdjustment);
-        }
-    }
-
-    if (position.y() < visibleRect.y()) {
-        scrollType |= OverflowScrollUp;
-        if (action == PerformOverflowScroll) {
-            deltaY -= static_cast<int>(m_overflowAutoScrollDelta);
-            selectionPosition.setY(view->scrollY() - scrollBoundsAdjustment);
-        }
-    } else if (position.y() > visibleRect.maxY()) {
-        scrollType |= OverflowScrollDown;
-        if (action == PerformOverflowScroll) {
-            deltaY += static_cast<int>(m_overflowAutoScrollDelta);
-            selectionPosition.setY(view->scrollY() + view->visibleHeight() + scrollBoundsAdjustment);
-        }
-    }
-
-    Ref<Frame> protectedThis(*this);
-
-    if (action == PerformOverflowScroll && (deltaX || deltaY)) {
-        layer->scrollToOffset(layer->scrollOffset() + IntSize(deltaX, deltaY), ScrollClamping::Unclamped);
-
-        // Handle making selection.
-        VisiblePosition visiblePosition(renderer->positionForPoint(selectionPosition, nullptr));
-        if (visiblePosition.isNotNull()) {
-            VisibleSelection visibleSelection = selection().selection();
-            visibleSelection.setExtent(visiblePosition);
-            if (selection().granularity() != CharacterGranularity)
-                visibleSelection.expandUsingGranularity(selection().granularity());
-            if (selection().shouldChangeSelection(visibleSelection))
-                selection().setSelection(visibleSelection);
-        }
-
-        m_overflowAutoScrollDelta *= 1.02f; // Accelerate the scroll
-    }
-    return scrollType;
-}
-
 void Frame::setSelectionChangeCallbacksDisabled(bool selectionChangeCallbacksDisabled)
 {
     m_selectionChangeCallbacksDisabled = selectionChangeCallbacksDisabled;

Modified: trunk/Source/WebCore/page/Frame.h (243734 => 243735)


--- trunk/Source/WebCore/page/Frame.h	2019-04-02 03:14:50 UTC (rev 243734)
+++ trunk/Source/WebCore/page/Frame.h	2019-04-02 03:16:48 UTC (rev 243735)
@@ -258,9 +258,6 @@
     String matchLabelsAgainstElement(const Vector<String>& labels, Element*);
 
 #if PLATFORM(IOS_FAMILY)
-    // Scroll the selection in an overflow layer.
-    void scrollOverflowLayer(RenderLayer*, const IntRect& visibleRect, const IntRect& exposeRect);
-
     WEBCORE_EXPORT int preferredHeight() const;
     WEBCORE_EXPORT void updateLayout() const;
     WEBCORE_EXPORT NSRect caretRect();
@@ -333,17 +330,10 @@
     bool hitTestResultAtViewportLocation(const FloatPoint& viewportLocation, HitTestResult&, IntPoint& center);
     Node* qualifyingNodeAtViewportLocation(const FloatPoint& viewportLocation, FloatPoint& adjustedViewportLocation, const NodeQualifier&, bool shouldApproximate);
 
-    void overflowAutoScrollTimerFired();
-    void startOverflowAutoScroll(const IntPoint&);
-    int checkOverflowScroll(OverflowScrollAction);
-
     void setTimersPausedInternal(bool);
 
-    Timer m_overflowAutoScrollTimer;
-    float m_overflowAutoScrollDelta;
-    IntPoint m_overflowAutoScrollPos;
     ViewportArguments m_viewportArguments;
-    bool m_selectionChangeCallbacksDisabled;
+    bool m_selectionChangeCallbacksDisabled { false };
     VisibleSelection m_rangedSelectionBase;
     VisibleSelection m_rangedSelectionInitialExtent;
 #endif
@@ -351,7 +341,7 @@
     float m_pageZoomFactor;
     float m_textZoomFactor;
 
-    int m_activeDOMObjectsAndAnimationsSuspendedCount;
+    int m_activeDOMObjectsAndAnimationsSuspendedCount { 0 };
     bool m_documentIsBeingReplaced { false };
     unsigned m_navigationDisableCount { 0 };
     unsigned m_selfOnlyRefCount { 0 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to