Remove a bunch of frame-level scrolling machinery. This just removing dead/noop code. No change in behavior. R=abarth@chromium.org, esprehn@chromium.org Review URL: https://codereview.chromium.org/681023002
diff --git a/sky/engine/core/dom/Touch.cpp b/sky/engine/core/dom/Touch.cpp index fcf2448..fe05912 100644 --- a/sky/engine/core/dom/Touch.cpp +++ b/sky/engine/core/dom/Touch.cpp
@@ -33,21 +33,10 @@ namespace blink { -static FloatPoint contentsOffset(LocalFrame* frame) -{ - if (!frame) - return FloatPoint(); - FrameView* frameView = frame->view(); - if (!frameView) - return FloatPoint(); - float scale = 1.0f / frame->pageZoomFactor(); - return FloatPoint(frameView->scrollPosition()).scaledBy(scale); -} - Touch::Touch(LocalFrame* frame, EventTarget* target, unsigned identifier, const FloatPoint& screenPos, const FloatPoint& pagePos, const FloatSize& radius, float rotationAngle, float force) : m_target(target) , m_identifier(identifier) - , m_clientPos(pagePos - contentsOffset(frame)) + , m_clientPos(pagePos) , m_screenPos(screenPos) , m_pagePos(pagePos) , m_radius(radius)
diff --git a/sky/engine/core/events/MouseRelatedEvent.cpp b/sky/engine/core/events/MouseRelatedEvent.cpp index 5a4fae3..972b789 100644 --- a/sky/engine/core/events/MouseRelatedEvent.cpp +++ b/sky/engine/core/events/MouseRelatedEvent.cpp
@@ -48,22 +48,19 @@ , m_isSimulated(isSimulated) { LayoutPoint adjustedPageLocation; - LayoutPoint scrollPosition; LocalFrame* frame = view() ? view()->frame() : 0; if (frame && !isSimulated) { if (FrameView* frameView = frame->view()) { - scrollPosition = frameView->scrollPosition(); adjustedPageLocation = frameView->windowToContents(windowLocation); float scaleFactor = 1 / frame->pageZoomFactor(); if (scaleFactor != 1.0f) { adjustedPageLocation.scale(scaleFactor, scaleFactor); - scrollPosition.scale(scaleFactor, scaleFactor); } } } - m_clientLocation = adjustedPageLocation - toLayoutSize(scrollPosition); + m_clientLocation = adjustedPageLocation; m_pageLocation = adjustedPageLocation; initCoordinates();
diff --git a/sky/engine/core/frame/FrameView.cpp b/sky/engine/core/frame/FrameView.cpp index 009149e..3de631c2 100644 --- a/sky/engine/core/frame/FrameView.cpp +++ b/sky/engine/core/frame/FrameView.cpp
@@ -228,8 +228,6 @@ IntPoint clampedOffset = offset; clampedOffset = clampedOffset.shrunkTo( IntPoint(size()) - expandedIntSize(scaledSize)); - clampedOffset = clampedOffset.expandedTo(-scrollOrigin()); - return clampedOffset; } @@ -745,24 +743,11 @@ } } -LayoutRect FrameView::viewportConstrainedVisibleContentRect() const -{ - LayoutRect viewportRect = visibleContentRect(); - // Ignore overhang. No-op when not using rubber banding. - viewportRect.setLocation(clampScrollPosition(scrollPosition())); - return viewportRect; -} - void FrameView::viewportConstrainedVisibleContentSizeChanged(bool widthChanged, bool heightChanged) { // FIXME(sky): Remove } -IntSize FrameView::scrollOffsetForFixedPosition() const -{ - return toIntSize(clampScrollPosition(scrollPosition())); -} - IntPoint FrameView::lastKnownMousePosition() const { return m_frame->eventHandler().lastKnownMousePosition(); @@ -1304,14 +1289,6 @@ return pageScale * m_inputEventsScaleFactorForEmulation; } -bool FrameView::scrollbarsCanBeActive() const -{ - if (m_frame->view() != this) - return false; - - return !!m_frame->document(); -} - IntRect FrameView::scrollableAreaBoundingBox() const { return frameRect(); @@ -1323,25 +1300,6 @@ return false; } -void FrameView::notifyPageThatContentAreaWillPaint() const -{ - Page* page = m_frame->page(); - if (!page) - return; - - if (!m_scrollableAreas) - return; - - for (HashSet<ScrollableArea*>::const_iterator it = m_scrollableAreas->begin(), end = m_scrollableAreas->end(); it != end; ++it) { - ScrollableArea* scrollableArea = *it; - - if (!scrollableArea->scrollbarsCanBeActive()) - continue; - - scrollableArea->contentAreaWillPaint(); - } -} - bool FrameView::scrollAnimatorEnabled() const { return m_frame->settings() && m_frame->settings()->scrollAnimatorEnabled(); @@ -1475,12 +1433,6 @@ m_nodeToDraw = node; } -void FrameView::paintOverhangAreas(GraphicsContext* context, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect) -{ - if (m_frame->page()->chrome().client().paintCustomOverhangArea(context, horizontalOverhangArea, verticalOverhangArea, dirtyRect)) - return; -} - void FrameView::updateWidgetPositionsIfNeeded() { if (!m_needsUpdateWidgetPositions)
diff --git a/sky/engine/core/frame/FrameView.h b/sky/engine/core/frame/FrameView.h index 29f5903..2da880c 100644 --- a/sky/engine/core/frame/FrameView.h +++ b/sky/engine/core/frame/FrameView.h
@@ -139,7 +139,6 @@ // This is different than visibleContentRect() in that it ignores negative (or overly positive) // offsets from rubber-banding, and it takes zooming into account. - LayoutRect viewportConstrainedVisibleContentRect() const; void viewportConstrainedVisibleContentSizeChanged(bool widthChanged, bool heightChanged); AtomicString mediaType() const; @@ -174,9 +173,6 @@ bool hasEverPainted() const { return m_lastPaintTime; } void setNodeToDraw(Node*); - // FIXME(sky): Remove - void paintOverhangAreas(GraphicsContext*, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect); - Color documentBackgroundColor() const; static double currentFrameTimeStamp() { return s_currentFrameTimeStamp; } @@ -207,9 +203,6 @@ void setCursor(const Cursor&); - // FIXME(sky): Remove - bool scrollbarsCanBeActive() const; - // FIXME: Remove this method once plugin loading is decoupled from layout. void flushAnyPendingPostLayoutTasks(); @@ -248,9 +241,6 @@ bool isActive() const; - // DEPRECATED: Use viewportConstrainedVisibleContentRect() instead. - IntSize scrollOffsetForFixedPosition() const; - // FIXME: This should probably be renamed as the 'inSubtreeLayout' parameter // passed around the FrameView layout methods can be true while this returns // false. @@ -290,8 +280,6 @@ bool scheduleAnimation(); IntRect visibleContentRect(IncludeScrollbarsInRect = ExcludeScrollbars) const { return IntRect(IntPoint(), expandedIntSize(frameRect().size())); } IntSize unscaledVisibleContentSize(IncludeScrollbarsInRect = ExcludeScrollbars) const { return frameRect().size(); } - IntPoint clampScrollPosition(const IntPoint& scrollPosition) const { return scrollPosition; } - const IntPoint scrollOrigin() const { return IntPoint(); } // FIXME(sky): Not clear what values these should return. This is just what they happen to be // returning today. bool paintsEntireContents() const { return false; } @@ -350,9 +338,6 @@ bool wasViewportResized(); void sendResizeEventIfNeeded(); - // FIXME(sky): Remove now that we're not a ScrollView? - void notifyPageThatContentAreaWillPaint() const; - void scrollPositionChanged(); void didScrollTimerFired(Timer<FrameView>*);
diff --git a/sky/engine/core/loader/EmptyClients.h b/sky/engine/core/loader/EmptyClients.h index cca8bbf..74309c9 100644 --- a/sky/engine/core/loader/EmptyClients.h +++ b/sky/engine/core/loader/EmptyClients.h
@@ -102,7 +102,6 @@ virtual void needTouchEvents(bool) override { } virtual void setTouchAction(TouchAction touchAction) override { }; - virtual bool paintCustomOverhangArea(GraphicsContext*, const IntRect&, const IntRect&, const IntRect&) override { return false; } virtual String acceptLanguages() override; };
diff --git a/sky/engine/core/page/ChromeClient.h b/sky/engine/core/page/ChromeClient.h index b9fec1c..14d1fd0 100644 --- a/sky/engine/core/page/ChromeClient.h +++ b/sky/engine/core/page/ChromeClient.h
@@ -99,8 +99,6 @@ virtual void setToolTip(const String&, TextDirection) = 0; - virtual bool paintCustomOverhangArea(GraphicsContext*, const IntRect&, const IntRect&, const IntRect&) = 0; - // Allows ports to customize the type of graphics layers created by this page. virtual GraphicsLayerFactory* graphicsLayerFactory() const { return 0; }
diff --git a/sky/engine/core/rendering/RenderBox.cpp b/sky/engine/core/rendering/RenderBox.cpp index 447196b..f809797 100644 --- a/sky/engine/core/rendering/RenderBox.cpp +++ b/sky/engine/core/rendering/RenderBox.cpp
@@ -1794,7 +1794,7 @@ } if (o->isRenderView()) - toRenderView(o)->mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, position == FixedPosition ? RenderView::IsFixedPosition : RenderView::IsNotFixedPosition, paintInvalidationState); + toRenderView(o)->mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, paintInvalidationState); else o->mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, paintInvalidationState); } @@ -2459,7 +2459,7 @@ if (style()->position() == FixedPosition && containingBlock->isRenderView()) { const RenderView* view = toRenderView(containingBlock); if (FrameView* frameView = view->frameView()) { - LayoutRect viewportRect = frameView->viewportConstrainedVisibleContentRect(); + LayoutRect viewportRect = frameView->visibleContentRect(); return containingBlock->isHorizontalWritingMode() ? viewportRect.width() : viewportRect.height(); } } @@ -2499,7 +2499,7 @@ if (style()->position() == FixedPosition && containingBlock->isRenderView()) { const RenderView* view = toRenderView(containingBlock); if (FrameView* frameView = view->frameView()) { - LayoutRect viewportRect = frameView->viewportConstrainedVisibleContentRect(); + LayoutRect viewportRect = frameView->visibleContentRect(); return containingBlock->isHorizontalWritingMode() ? viewportRect.height() : viewportRect.width(); } }
diff --git a/sky/engine/core/rendering/RenderBoxModelObject.cpp b/sky/engine/core/rendering/RenderBoxModelObject.cpp index a936732..52450b0 100644 --- a/sky/engine/core/rendering/RenderBoxModelObject.cpp +++ b/sky/engine/core/rendering/RenderBoxModelObject.cpp
@@ -883,8 +883,6 @@ IntRect viewportRect = pixelSnappedIntRect(viewRect()); if (fixedBackgroundPaintsInLocalCoordinates()) viewportRect.setLocation(IntPoint()); - else if (FrameView* frameView = view()->frameView()) - viewportRect.setLocation(IntPoint(frameView->scrollOffsetForFixedPosition())); if (paintContainer) { IntPoint absoluteContainerOffset = roundedIntPoint(paintContainer->localToAbsolute(FloatPoint()));
diff --git a/sky/engine/core/rendering/RenderLayerClipper.cpp b/sky/engine/core/rendering/RenderLayerClipper.cpp index 1c00bb9..9f699a3 100644 --- a/sky/engine/core/rendering/RenderLayerClipper.cpp +++ b/sky/engine/core/rendering/RenderLayerClipper.cpp
@@ -69,11 +69,6 @@ { ASSERT(renderer.hasOverflowClip() || renderer.hasClip()); - RenderView* view = renderer.view(); - ASSERT(view); - if (clipRects.fixed() && context.rootLayer->renderer() == view) - offset -= view->frameView()->scrollOffsetForFixedPosition(); - if (renderer.hasOverflowClip()) { ClipRect newOverflowClip = toRenderBox(renderer).overflowClipRect(offset, context.scrollbarRelevancy); newOverflowClip.setHasRadius(renderer.style()->hasBorderRadius()); @@ -329,13 +324,7 @@ else m_renderer.layer()->parent()->clipper().getOrCalculateClipRects(context, parentClipRects); - ClipRect result = backgroundClipRectForPosition(parentClipRects, m_renderer.style()->position()); - - // Note: infinite clipRects should not be scrolled here, otherwise they will accidentally no longer be considered infinite. - if (parentClipRects.fixed() && context.rootLayer->renderer() == m_renderer.view() && result != PaintInfo::infiniteRect()) - result.move(m_renderer.view()->frameView()->scrollOffsetForFixedPosition()); - - return result; + return backgroundClipRectForPosition(parentClipRects, m_renderer.style()->position()); } void RenderLayerClipper::getOrCalculateClipRects(const ClipRectsContext& context, ClipRects& clipRects) const
diff --git a/sky/engine/core/rendering/RenderLayerScrollableArea.cpp b/sky/engine/core/rendering/RenderLayerScrollableArea.cpp index 00ec725..e8d0ca6 100644 --- a/sky/engine/core/rendering/RenderLayerScrollableArea.cpp +++ b/sky/engine/core/rendering/RenderLayerScrollableArea.cpp
@@ -442,14 +442,6 @@ return box().frame() ? box().frame()->eventHandler().lastKnownMousePosition() : IntPoint(); } -bool RenderLayerScrollableArea::scrollbarsCanBeActive() const -{ - RenderView* view = box().view(); - if (!view) - return false; - return view->frameView()->scrollbarsCanBeActive(); -} - IntRect RenderLayerScrollableArea::scrollableAreaBoundingBox() const { return box().absoluteBoundingBoxRect();
diff --git a/sky/engine/core/rendering/RenderLayerScrollableArea.h b/sky/engine/core/rendering/RenderLayerScrollableArea.h index 5b4acfc..f4a67d6 100644 --- a/sky/engine/core/rendering/RenderLayerScrollableArea.h +++ b/sky/engine/core/rendering/RenderLayerScrollableArea.h
@@ -97,7 +97,6 @@ virtual IntSize contentsSize() const override; virtual IntSize overhangAmount() const override; virtual IntPoint lastKnownMousePosition() const override; - virtual bool scrollbarsCanBeActive() const override; virtual IntRect scrollableAreaBoundingBox() const override; virtual bool userInputScrollable(ScrollbarOrientation) const override; virtual bool shouldPlaceVerticalScrollbarOnLeft() const override;
diff --git a/sky/engine/core/rendering/RenderView.cpp b/sky/engine/core/rendering/RenderView.cpp index 8f5a7dd..945d22a 100644 --- a/sky/engine/core/rendering/RenderView.cpp +++ b/sky/engine/core/rendering/RenderView.cpp
@@ -200,23 +200,15 @@ getTransformFromContainer(0, LayoutSize(), t); transformState.applyTransform(t); } - - if (mode & IsFixed && m_frameView) - transformState.move(m_frameView->scrollOffsetForFixedPosition()); - - if (paintInvalidationContainer == this) - return; } const RenderObject* RenderView::pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const { + // FIXME(sky): Can we remove offsetForFixedPosition? LayoutSize offsetForFixedPosition; LayoutSize offset; RenderObject* container = 0; - if (m_frameView) - offsetForFixedPosition = m_frameView->scrollOffsetForFixedPosition(); - // If a container was specified, and was not 0 or the RenderView, then we // should have found it by now unless we're traversing to a parent document. ASSERT_ARG(ancestorToStopAt, !ancestorToStopAt || ancestorToStopAt == this || container); @@ -234,9 +226,6 @@ void RenderView::mapAbsoluteToLocalPoint(MapCoordinatesFlags mode, TransformState& transformState) const { - if (mode & IsFixed && m_frameView) - transformState.move(m_frameView->scrollOffsetForFixedPosition()); - if (mode & UseTransforms && shouldUseTransformFromContainer(0)) { TransformationMatrix t; getTransformFromContainer(0, LayoutSize(), t); @@ -360,12 +349,7 @@ compositor()->fullyInvalidatePaint(); } -void RenderView::mapRectToPaintInvalidationBacking(const RenderLayerModelObject* paintInvalidationContainer, LayoutRect& rect, const PaintInvalidationState* invalidationState) const -{ - mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, IsNotFixedPosition, invalidationState); -} - -void RenderView::mapRectToPaintInvalidationBacking(const RenderLayerModelObject* paintInvalidationContainer, LayoutRect& rect, ViewportConstrainedPosition viewportConstraint, const PaintInvalidationState* state) const +void RenderView::mapRectToPaintInvalidationBacking(const RenderLayerModelObject* paintInvalidationContainer, LayoutRect& rect, const PaintInvalidationState* state) const { if (style()->isFlippedBlocksWritingMode()) { // We have to flip by hand since the view's logical height has not been determined. We @@ -376,10 +360,6 @@ rect.setX(viewWidth() - rect.maxX()); } - if (viewportConstraint == IsFixedPosition && m_frameView) { - rect.move(m_frameView->scrollOffsetForFixedPosition()); - } - // Apply our transform if we have one (because of full page zooming). if (!paintInvalidationContainer && layer() && layer()->transform()) rect = layer()->transform()->mapRect(rect);
diff --git a/sky/engine/core/rendering/RenderView.h b/sky/engine/core/rendering/RenderView.h index 36cc69e..96223e3 100644 --- a/sky/engine/core/rendering/RenderView.h +++ b/sky/engine/core/rendering/RenderView.h
@@ -78,11 +78,6 @@ FrameView* frameView() const { return m_frameView; } - enum ViewportConstrainedPosition { - IsNotFixedPosition, - IsFixedPosition, - }; - void mapRectToPaintInvalidationBacking(const RenderLayerModelObject* paintInvalidationContainer, LayoutRect&, ViewportConstrainedPosition, const PaintInvalidationState*) const; virtual void mapRectToPaintInvalidationBacking(const RenderLayerModelObject* paintInvalidationContainer, LayoutRect&, const PaintInvalidationState*) const override; void invalidatePaintForRectangle(const LayoutRect&) const;
diff --git a/sky/engine/platform/scroll/ScrollAnimator.h b/sky/engine/platform/scroll/ScrollAnimator.h index 93e382f..54c4e3b 100644 --- a/sky/engine/platform/scroll/ScrollAnimator.h +++ b/sky/engine/platform/scroll/ScrollAnimator.h
@@ -76,7 +76,6 @@ virtual void cancelAnimations() { } virtual void serviceScrollAnimations() { } - virtual void contentAreaWillPaint() const { } virtual void mouseEnteredContentArea() const { } virtual void mouseExitedContentArea() const { } virtual void mouseMovedInContentArea() const { }
diff --git a/sky/engine/platform/scroll/ScrollableArea.cpp b/sky/engine/platform/scroll/ScrollableArea.cpp index 39f8aa8..747546e 100644 --- a/sky/engine/platform/scroll/ScrollableArea.cpp +++ b/sky/engine/platform/scroll/ScrollableArea.cpp
@@ -274,12 +274,6 @@ scrollAnimator->willEndLiveResize(); } -void ScrollableArea::contentAreaWillPaint() const -{ - if (ScrollAnimator* scrollAnimator = existingScrollAnimator()) - scrollAnimator->contentAreaWillPaint(); -} - void ScrollableArea::mouseEnteredContentArea() const { if (ScrollAnimator* scrollAnimator = existingScrollAnimator())
diff --git a/sky/engine/platform/scroll/ScrollableArea.h b/sky/engine/platform/scroll/ScrollableArea.h index 8816828..c2cedd8 100644 --- a/sky/engine/platform/scroll/ScrollableArea.h +++ b/sky/engine/platform/scroll/ScrollableArea.h
@@ -91,7 +91,6 @@ void willStartLiveResize(); void willEndLiveResize(); - void contentAreaWillPaint() const; void mouseEnteredContentArea() const; void mouseExitedContentArea() const; void mouseMovedInContentArea() const; @@ -173,8 +172,6 @@ virtual bool shouldSuspendScrollAnimations() const { return true; } - virtual bool scrollbarsCanBeActive() const = 0; - // Returns the bounding box of this scrollable area, in the coordinate system of the enclosing scroll view. virtual IntRect scrollableAreaBoundingBox() const = 0;
diff --git a/sky/engine/web/ChromeClientImpl.cpp b/sky/engine/web/ChromeClientImpl.cpp index 913f408..e05b306 100644 --- a/sky/engine/web/ChromeClientImpl.cpp +++ b/sky/engine/web/ChromeClientImpl.cpp
@@ -343,11 +343,6 @@ return m_webView->client()->acceptLanguages(); } -bool ChromeClientImpl::paintCustomOverhangArea(GraphicsContext* context, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect) -{ - return false; -} - GraphicsLayerFactory* ChromeClientImpl::graphicsLayerFactory() const { return m_webView->graphicsLayerFactory();
diff --git a/sky/engine/web/ChromeClientImpl.h b/sky/engine/web/ChromeClientImpl.h index efc650c..84055d5 100644 --- a/sky/engine/web/ChromeClientImpl.h +++ b/sky/engine/web/ChromeClientImpl.h
@@ -85,7 +85,6 @@ virtual void mouseDidMoveOverElement( const HitTestResult&, unsigned modifierFlags) override; virtual void setToolTip(const WTF::String& tooltipText, TextDirection) override; - virtual bool paintCustomOverhangArea(GraphicsContext*, const IntRect&, const IntRect&, const IntRect&) override; virtual void setCursor(const Cursor&) override; virtual void needTouchEvents(bool needTouchEvents) override; virtual void setTouchAction(TouchAction) override;
diff --git a/sky/engine/web/ScrollbarGroup.cpp b/sky/engine/web/ScrollbarGroup.cpp index f986aa4..529e3aa 100644 --- a/sky/engine/web/ScrollbarGroup.cpp +++ b/sky/engine/web/ScrollbarGroup.cpp
@@ -143,11 +143,6 @@ return m_lastMousePosition; } -bool ScrollbarGroup::scrollbarsCanBeActive() const -{ - return true; -} - bool ScrollbarGroup::userInputScrollable(ScrollbarOrientation orientation) const { return false;
diff --git a/sky/engine/web/ScrollbarGroup.h b/sky/engine/web/ScrollbarGroup.h index f259f3f..8f24577 100644 --- a/sky/engine/web/ScrollbarGroup.h +++ b/sky/engine/web/ScrollbarGroup.h
@@ -62,7 +62,6 @@ virtual IntSize contentsSize() const override; virtual IntSize overhangAmount() const override; virtual IntPoint lastKnownMousePosition() const override; - virtual bool scrollbarsCanBeActive() const override; virtual IntRect scrollableAreaBoundingBox() const override; virtual bool userInputScrollable(ScrollbarOrientation) const override; virtual bool shouldPlaceVerticalScrollbarOnLeft() const override;