Remove more frame-level scrolling machinery.

This is all dead code. No change in behavior.

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/678193005
This commit is contained in:
Ojan Vafai 2014-10-28 19:27:52 -07:00
parent 82245c19f8
commit ce9aa787cb
14 changed files with 6 additions and 182 deletions

View File

@ -68,8 +68,6 @@ namespace blink {
double FrameView::s_currentFrameTimeStamp = 0.0;
bool FrameView::s_inPaintContents = false;
static const double resourcePriorityUpdateDelayAfterScroll = 0.250;
FrameView::FrameView(LocalFrame* frame)
: m_frame(frame)
, m_hasPendingLayout(false)
@ -88,7 +86,6 @@ FrameView::FrameView(LocalFrame* frame)
, m_visibleContentScaleFactor(1)
, m_inputEventsScaleFactorForEmulation(1)
, m_layoutSizeFixedToFrameSize(true)
, m_didScrollTimer(this, &FrameView::didScrollTimerFired)
{
ASSERT(m_frame);
init();
@ -113,12 +110,8 @@ FrameView::~FrameView()
if (m_postLayoutTasksTimer.isActive())
m_postLayoutTasksTimer.stop();
if (m_didScrollTimer.isActive())
m_didScrollTimer.stop();
ASSERT(m_frame);
ASSERT(m_frame->view() != this || !m_frame->contentRenderer());
// FIXME: Do we need to do something here for OOPI?
}
void FrameView::reset()
@ -560,32 +553,6 @@ void FrameView::setLayoutSize(const IntSize& size)
setLayoutSizeInternal(size);
}
void FrameView::scrollPositionChanged()
{
setWasScrolledByUser(true);
Document* document = m_frame->document();
document->enqueueScrollEventForNode(document);
m_frame->eventHandler().dispatchFakeMouseMoveEventSoon();
if (RenderView* renderView = document->renderView()) {
if (renderView->usesCompositing())
renderView->compositor()->frameViewDidScroll();
}
if (m_didScrollTimer.isActive())
m_didScrollTimer.stop();
m_didScrollTimer.startOneShot(resourcePriorityUpdateDelayAfterScroll, FROM_HERE);
}
void FrameView::didScrollTimerFired(Timer<FrameView>*)
{
if (m_frame->document() && m_frame->document()->renderView()) {
ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->updateAllImageResourcePriorities();
}
}
void FrameView::updateCompositedSelectionBoundsIfNeeded()
{
if (!RuntimeEnabledFeatures::compositedSelectionUpdatesEnabled())
@ -616,9 +583,7 @@ void FrameView::contentRectangleForPaintInvalidation(const IntRect& r)
ASSERT(paintInvalidationIsAllowed());
if (m_isTrackingPaintInvalidations) {
IntRect paintInvalidationRect = r;
paintInvalidationRect.move(-scrollOffset());
m_trackedPaintInvalidationRects.append(paintInvalidationRect);
m_trackedPaintInvalidationRects.append(r);
// FIXME: http://crbug.com/368518. Eventually, invalidateContentRectangleForPaint
// is going away entirely once all layout tests are FCM. In the short
// term, no code should be tracking non-composited FrameView paint invalidations.
@ -1098,21 +1063,12 @@ void FrameView::forceLayout(bool allowSubtree)
IntRect FrameView::convertFromRenderer(const RenderObject& renderer, const IntRect& rendererRect) const
{
IntRect rect = pixelSnappedIntRect(enclosingLayoutRect(renderer.localToAbsoluteQuad(FloatRect(rendererRect)).boundingBox()));
// Convert from page ("absolute") to FrameView coordinates.
rect.moveBy(-scrollPosition());
return rect;
return pixelSnappedIntRect(enclosingLayoutRect(renderer.localToAbsoluteQuad(FloatRect(rendererRect)).boundingBox()));
}
IntRect FrameView::convertToRenderer(const RenderObject& renderer, const IntRect& viewRect) const
{
IntRect rect = viewRect;
// Convert from FrameView coords into page ("absolute") coordinates.
rect.moveBy(scrollPosition());
// FIXME: we don't have a way to map an absolute rect down to a local quad, so just
// move the rect for now.
rect.setLocation(roundedIntPoint(renderer.absoluteToLocal(rect.location(), UseTransforms)));
@ -1121,11 +1077,7 @@ IntRect FrameView::convertToRenderer(const RenderObject& renderer, const IntRect
IntPoint FrameView::convertFromRenderer(const RenderObject& renderer, const IntPoint& rendererPoint) const
{
IntPoint point = roundedIntPoint(renderer.localToAbsolute(rendererPoint, UseTransforms));
// Convert from page ("absolute") to FrameView coordinates.
point.moveBy(-scrollPosition());
return point;
return roundedIntPoint(renderer.localToAbsolute(rendererPoint, UseTransforms));
}
IntPoint FrameView::convertToRenderer(const RenderObject& renderer, const IntPoint& viewPoint) const

View File

@ -219,10 +219,6 @@ public:
IntPoint contentsToWindow(const IntPoint& contentsPoint) const { return contentsToWindow(contentsPoint); }
IntRect windowToContents(const IntRect& windowRect) const { return convertFromContainingWindow(windowRect); }
IntRect contentsToWindow(const IntRect& contentsRect) const { return contentsToWindow(contentsRect); }
IntSize scrollOffset() const { return IntSize(); }
IntPoint minimumScrollPosition() const { return IntPoint(); }
IntPoint maximumScrollPosition() const { return IntPoint(); }
IntPoint scrollPosition() const { return IntPoint(); }
bool scheduleAnimation();
IntRect visibleContentRect(IncludeScrollbarsInRect = ExcludeScrollbars) const { return IntRect(IntPoint(), expandedIntSize(frameRect().size())); }
IntSize unscaledVisibleContentSize(IncludeScrollbarsInRect = ExcludeScrollbars) const { return frameRect().size(); }
@ -271,9 +267,6 @@ private:
bool wasViewportResized();
void sendResizeEventIfNeeded();
void scrollPositionChanged();
void didScrollTimerFired(Timer<FrameView>*);
void updateCompositedSelectionBoundsIfNeeded();
void setLayoutSizeInternal(const IntSize&);
@ -341,8 +334,6 @@ private:
IntSize m_layoutSize;
bool m_layoutSizeFixedToFrameSize;
Timer<FrameView> m_didScrollTimer;
Vector<IntRect> m_tickmarks;
};

View File

@ -2070,11 +2070,6 @@ bool RenderBlockFlow::hitTestFloats(const HitTestRequest& request, HitTestResult
if (!m_floatingObjects)
return false;
LayoutPoint adjustedLocation = accumulatedOffset;
if (isRenderView()) {
adjustedLocation += toLayoutSize(toRenderView(this)->frameView()->scrollPosition());
}
const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
FloatingObjectSetIterator begin = floatingObjectSet.begin();
for (FloatingObjectSetIterator it = floatingObjectSet.end(); it != begin;) {
@ -2083,7 +2078,7 @@ bool RenderBlockFlow::hitTestFloats(const HitTestRequest& request, HitTestResult
if (floatingObject->shouldPaint() && !floatingObject->renderer()->hasSelfPaintingLayer()) {
LayoutUnit xOffset = xPositionForFloatIncludingMargin(floatingObject) - floatingObject->renderer()->x();
LayoutUnit yOffset = yPositionForFloatIncludingMargin(floatingObject) - floatingObject->renderer()->y();
LayoutPoint childPoint = flipFloatForWritingModeForChild(floatingObject, adjustedLocation + LayoutSize(xOffset, yOffset));
LayoutPoint childPoint = flipFloatForWritingModeForChild(floatingObject, accumulatedOffset + LayoutSize(xOffset, yOffset));
if (floatingObject->renderer()->hitTest(request, result, locationInContainer, childPoint)) {
updateHitTestResult(result, locationInContainer.point() - toLayoutSize(childPoint));
return true;

View File

@ -604,7 +604,6 @@ IntSize RenderBox::calculateAutoscrollDirection(const IntPoint& windowPoint) con
return IntSize();
IntRect box(absoluteBoundingBoxRect());
box.move(view()->frameView()->scrollOffset());
IntRect windowBox = view()->frameView()->contentsToWindow(box);
IntPoint windowAutoscrollPoint = windowPoint;

View File

@ -366,38 +366,10 @@ void RenderLayerCompositor::frameViewDidChangeSize()
if (m_containerLayer) {
FrameView* frameView = m_renderView.frameView();
m_containerLayer->setSize(frameView->unscaledVisibleContentSize());
frameViewDidScroll();
updateOverflowControlsLayers();
}
}
enum AcceleratedFixedRootBackgroundHistogramBuckets {
ScrolledMainFrameBucket = 0,
ScrolledMainFrameWithAcceleratedFixedRootBackground = 1,
ScrolledMainFrameWithUnacceleratedFixedRootBackground = 2,
AcceleratedFixedRootBackgroundHistogramMax = 3
};
void RenderLayerCompositor::frameViewDidScroll()
{
FrameView* frameView = m_renderView.frameView();
IntPoint scrollPosition = frameView->scrollPosition();
if (!m_scrollLayer)
return;
// Scroll position = scroll minimum + scroll offset. Adjust the layer's
// position to handle whatever the scroll coordinator isn't handling.
// The minimum scroll position is non-zero for RTL pages with overflow.
m_scrollLayer->setPosition(-scrollPosition);
Platform::current()->histogramEnumeration("Renderer.AcceleratedFixedRootBackground",
ScrolledMainFrameBucket,
AcceleratedFixedRootBackgroundHistogramMax);
}
void RenderLayerCompositor::rootFixedBackgroundsChanged()
{
if (!supportsFixedRootBackgroundCompositing())

View File

@ -135,7 +135,6 @@ public:
// Update the geometry of the layers used for clipping and scrolling in frames.
void frameViewDidChangeLocation(const IntPoint& contentsOffset);
void frameViewDidChangeSize();
void frameViewDidScroll();
void rootFixedBackgroundsChanged();
bool scrollingLayerDidChange(RenderLayer*);

View File

@ -89,12 +89,6 @@ public:
BLINK_EXPORT WebDOMEvent createEvent(const WebString& eventType);
BLINK_EXPORT WebReferrerPolicy referrerPolicy() const;
BLINK_EXPORT WebElement createElement(const WebString& tagName);
// Shorthand of frame()->scrollOffset().
BLINK_EXPORT WebSize scrollOffset() const;
// Shorthand of frame()->minimumScrollOffset().
BLINK_EXPORT WebSize minimumScrollOffset() const;
// Shorthand of frame()->maximumScrollOffset().
BLINK_EXPORT WebSize maximumScrollOffset() const;
BLINK_EXPORT v8::Handle<v8::Value> registerEmbedderCustomElement(const WebString& name, v8::Handle<v8::Value> options, WebExceptionCode&);

View File

@ -104,13 +104,6 @@ public:
// NOTE: These routines do not force page layout so their results may
// not be accurate if the page layout is out-of-date.
// The scroll offset from the top-left corner of the frame in pixels.
virtual WebSize scrollOffset() const = 0;
// The minimum and maxium scroll positions in pixels.
virtual WebSize minimumScrollOffset() const = 0;
virtual WebSize maximumScrollOffset() const = 0;
// The size of the contents area.
virtual WebSize contentsSize() const = 0;

View File

@ -136,12 +136,6 @@ public:
// Check whether the given point hits any registered touch event handlers.
virtual bool hasTouchEventHandlersAt(const WebPoint&) { return true; }
// Applies a scroll delta to the root layer, which is bundled with a page
// scale factor that may apply a CSS transform on the whole document (used
// for mobile-device pinch zooming). This is triggered by events sent to the
// compositor thread.
virtual void applyScrollAndScale(const WebSize& scrollDelta, float scaleFactor) { }
// Called to inform the WebWidget that mouse capture was lost.
virtual void mouseCaptureLost() { }

View File

@ -136,27 +136,6 @@ WebElement WebDocument::createElement(const WebString& tagName)
return element;
}
WebSize WebDocument::scrollOffset() const
{
if (FrameView* view = constUnwrap<Document>()->view())
return view->scrollOffset();
return WebSize();
}
WebSize WebDocument::minimumScrollOffset() const
{
if (FrameView* view = constUnwrap<Document>()->view())
return toIntSize(view->minimumScrollPosition());
return WebSize();
}
WebSize WebDocument::maximumScrollOffset() const
{
if (FrameView* view = constUnwrap<Document>()->view())
return toIntSize(view->maximumScrollPosition());
return WebSize();
}
v8::Handle<v8::Value> WebDocument::registerEmbedderCustomElement(const WebString& name, v8::Handle<v8::Value> options, WebExceptionCode& ec)
{
v8::Isolate* isolate = v8::Isolate::GetCurrent();

View File

@ -227,30 +227,6 @@ void WebLocalFrameImpl::close()
deref(); // Balances ref() acquired in WebFrame::create
}
WebSize WebLocalFrameImpl::scrollOffset() const
{
FrameView* view = frameView();
if (!view)
return WebSize();
return view->scrollOffset();
}
WebSize WebLocalFrameImpl::minimumScrollOffset() const
{
FrameView* view = frameView();
if (!view)
return WebSize();
return toIntSize(view->minimumScrollPosition());
}
WebSize WebLocalFrameImpl::maximumScrollOffset() const
{
FrameView* view = frameView();
if (!view)
return WebSize();
return toIntSize(view->maximumScrollPosition());
}
WebSize WebLocalFrameImpl::contentsSize() const
{
return frame()->view()->size();

View File

@ -63,9 +63,6 @@ public:
virtual bool isWebLocalFrame() const override;
virtual WebLocalFrame* toWebLocalFrame() override;
virtual void close() override;
virtual WebSize scrollOffset() const override;
virtual WebSize minimumScrollOffset() const override;
virtual WebSize maximumScrollOffset() const override;
virtual WebSize contentsSize() const override;
virtual bool hasVisibleContent() const override;
virtual WebRect visibleContentRect() const override;

View File

@ -619,13 +619,10 @@ WebRect WebViewImpl::widenRectWithinPageBounds(const WebRect& source, int target
WebSize maxSize;
if (mainFrame())
maxSize = mainFrame()->contentsSize();
IntSize scrollOffset;
if (mainFrame())
scrollOffset = mainFrame()->scrollOffset();
int leftMargin = targetMargin;
int rightMargin = targetMargin;
const int absoluteSourceX = source.x + scrollOffset.width();
const int absoluteSourceX = source.x;
if (leftMargin > absoluteSourceX) {
leftMargin = absoluteSourceX;
rightMargin = std::max(leftMargin, minimumMargin);
@ -641,7 +638,7 @@ WebRect WebViewImpl::widenRectWithinPageBounds(const WebRect& source, int target
const int newX = source.x - leftMargin;
ASSERT(newWidth >= 0);
ASSERT(scrollOffset.width() + newX + newWidth <= maxSize.width);
ASSERT(newX + newWidth <= maxSize.width);
return WebRect(newX, source.y, newWidth, source.height);
}
@ -2333,19 +2330,6 @@ void WebViewImpl::updateMainFrameScrollPosition(const IntPoint& scrollPosition,
// FIXME(sky): Remove
}
void WebViewImpl::applyScrollAndScale(const WebSize& scrollDelta, float pageScaleDelta)
{
if (!mainFrameImpl() || !mainFrameImpl()->frameView())
return;
// TODO(bokan): Old pinch path only - virtual viewport pinch scrolls are automatically updated via GraphicsLayer::DidScroll.
// this should be removed once old pinch is removed.
TRACE_EVENT_INSTANT2("blink", "WebViewImpl::applyScrollAndScale::scrollBy", "x", scrollDelta.width, "y", scrollDelta.height);
WebSize webScrollOffset = mainFrame()->scrollOffset();
IntPoint scrollOffset(webScrollOffset.width + scrollDelta.width, webScrollOffset.height + scrollDelta.height);
updateMainFrameScrollPosition(scrollOffset, false);
}
void WebViewImpl::updateLayerTreeBackgroundColor()
{
if (!m_layerTreeView)

View File

@ -91,7 +91,6 @@ public:
virtual bool handleInputEvent(const WebInputEvent&) override;
virtual void setCursorVisibilityState(bool isVisible) override;
virtual bool hasTouchEventHandlersAt(const WebPoint&) override;
virtual void applyScrollAndScale(const WebSize&, float) override;
virtual void mouseCaptureLost() override;
virtual void setFocus(bool enable) override;
virtual bool setComposition(