提交 995c857c 编写于 作者: O Ojan Vafai

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
上级 5d98345d
......@@ -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)
......
......@@ -48,22 +48,19 @@ MouseRelatedEvent::MouseRelatedEvent(const AtomicString& eventType, bool canBubb
, 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();
......
......@@ -228,8 +228,6 @@ IntPoint FrameView::clampOffsetAtScale(const IntPoint& offset, float scale) cons
IntPoint clampedOffset = offset;
clampedOffset = clampedOffset.shrunkTo(
IntPoint(size()) - expandedIntSize(scaledSize));
clampedOffset = clampedOffset.expandedTo(-scrollOrigin());
return clampedOffset;
}
......@@ -745,24 +743,11 @@ void FrameView::removeViewportConstrainedObject(RenderObject* object)
}
}
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 @@ float FrameView::inputEventsScaleFactor() const
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 @@ bool FrameView::isScrollable()
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 @@ void FrameView::setNodeToDraw(Node* node)
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)
......
......@@ -139,7 +139,6 @@ public:
// 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 @@ public:
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 @@ public:
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 @@ public:
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 @@ public:
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 @@ private:
bool wasViewportResized();
void sendResizeEventIfNeeded();
// FIXME(sky): Remove now that we're not a ScrollView?
void notifyPageThatContentAreaWillPaint() const;
void scrollPositionChanged();
void didScrollTimerFired(Timer<FrameView>*);
......
......@@ -102,7 +102,6 @@ public:
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;
};
......
......@@ -99,8 +99,6 @@ public:
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; }
......
......@@ -1794,7 +1794,7 @@ void RenderBox::mapRectToPaintInvalidationBacking(const RenderLayerModelObject*
}
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 @@ LayoutUnit RenderBox::containingBlockLogicalWidthForPositioned(const RenderBoxMo
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 @@ LayoutUnit RenderBox::containingBlockLogicalHeightForPositioned(const RenderBoxM
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();
}
}
......
......@@ -883,8 +883,6 @@ void RenderBoxModelObject::calculateBackgroundImageGeometry(const RenderLayerMod
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()));
......
......@@ -69,11 +69,6 @@ static void applyClipRects(const ClipRectsContext& context, RenderObject& render
{
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 @@ ClipRect RenderLayerClipper::backgroundClipRect(const ClipRectsContext& context)
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
......
......@@ -442,14 +442,6 @@ IntPoint RenderLayerScrollableArea::lastKnownMousePosition() const
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();
......
......@@ -97,7 +97,6 @@ public:
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;
......
......@@ -200,23 +200,15 @@ void RenderView::mapLocalToContainer(const RenderLayerModelObject* paintInvalida
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 @@ const RenderObject* RenderView::pushMappingToContainer(const RenderLayerModelObj
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 @@ void RenderView::invalidatePaintForViewAndCompositedLayers()
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 @@ void RenderView::mapRectToPaintInvalidationBacking(const RenderLayerModelObject*
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);
......
......@@ -78,11 +78,6 @@ public:
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;
......
......@@ -76,7 +76,6 @@ public:
virtual void cancelAnimations() { }
virtual void serviceScrollAnimations() { }
virtual void contentAreaWillPaint() const { }
virtual void mouseEnteredContentArea() const { }
virtual void mouseExitedContentArea() const { }
virtual void mouseMovedInContentArea() const { }
......
......@@ -274,12 +274,6 @@ void ScrollableArea::willEndLiveResize()
scrollAnimator->willEndLiveResize();
}
void ScrollableArea::contentAreaWillPaint() const
{
if (ScrollAnimator* scrollAnimator = existingScrollAnimator())
scrollAnimator->contentAreaWillPaint();
}
void ScrollableArea::mouseEnteredContentArea() const
{
if (ScrollAnimator* scrollAnimator = existingScrollAnimator())
......
......@@ -91,7 +91,6 @@ public:
void willStartLiveResize();
void willEndLiveResize();
void contentAreaWillPaint() const;
void mouseEnteredContentArea() const;
void mouseExitedContentArea() const;
void mouseMovedInContentArea() const;
......@@ -173,8 +172,6 @@ public:
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;
......
......@@ -343,11 +343,6 @@ String ChromeClientImpl::acceptLanguages()
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();
......
......@@ -85,7 +85,6 @@ public:
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;
......
......@@ -143,11 +143,6 @@ IntPoint ScrollbarGroup::lastKnownMousePosition() const
return m_lastMousePosition;
}
bool ScrollbarGroup::scrollbarsCanBeActive() const
{
return true;
}
bool ScrollbarGroup::userInputScrollable(ScrollbarOrientation orientation) const
{
return false;
......
......@@ -62,7 +62,6 @@ public:
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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册