, m_verticalScrollbarMode(ScrollbarAuto)
, m_horizontalScrollbarLock(false)
, m_verticalScrollbarLock(false)
- , m_canBlitOnScroll(true)
, m_scrollbarsAvoidingResizer(0)
, m_scrollbarsSuppressed(false)
, m_inUpdateScrollbars(false)
} else if (!hasBar && m_horizontalScrollbar) {
willRemoveScrollbar(m_horizontalScrollbar.get(), HorizontalScrollbar);
removeChild(m_horizontalScrollbar.get());
- m_horizontalScrollbar = 0;
+ m_horizontalScrollbar = nullptr;
}
}
} else if (!hasBar && m_verticalScrollbar) {
willRemoveScrollbar(m_verticalScrollbar.get(), VerticalScrollbar);
removeChild(m_verticalScrollbar.get());
- m_verticalScrollbar = 0;
+ m_verticalScrollbar = nullptr;
}
}
setScrollbarModes(newHorizontalMode, newVerticalMode);
}
-void ScrollView::setCanBlitOnScroll(bool b)
+bool ScrollView::shouldAttemptToScrollUsingFastPath() const
{
- m_canBlitOnScroll = b;
-}
-
-bool ScrollView::canBlitOnScroll() const
-{
- return m_canBlitOnScroll;
+ return true;
}
void ScrollView::setPaintsEntireContents(bool paintsEntireContents)
if (scrollbarsSuppressed())
return;
- repaintFixedElementsAfterScrolling();
- scrollContents(scrollDelta);
- updateFixedElementsAfterScrolling();
+ if (isFrameView())
+ m_pendingScrollDelta += scrollDelta;
+ else
+ scrollContents(scrollDelta);
}
void ScrollView::setScrollPosition(const IntPoint& scrollPoint)
return scrollViewRect;
}
+void ScrollView::scrollContentsIfNeeded()
+{
+ if (m_pendingScrollDelta.isZero())
+ return;
+ IntSize scrollDelta = m_pendingScrollDelta;
+ m_pendingScrollDelta = IntSize();
+ scrollContents(scrollDelta);
+}
+
void ScrollView::scrollContents(const IntSize& scrollDelta)
{
HostWindow* window = hostWindow();
window->invalidateContentsAndRootView(panScrollIconDirtyRect);
}
- if (canBlitOnScroll()) { // The main frame can just blit the WebView window
- // FIXME: Find a way to scroll subframes with this faster path
- if (!scrollContentsFastPath(-scrollDelta, scrollViewRect, clipRect))
- scrollContentsSlowPath(updateRect);
- } else {
- // We need to go ahead and repaint the entire backing store. Do it now before moving the
- // windowed plugins.
- scrollContentsSlowPath(updateRect);
- }
+ if (!shouldAttemptToScrollUsingFastPath() || !scrollContentsFastPath(-scrollDelta, scrollViewRect, clipRect))
+ scrollContentsSlowPath(updateRect);
// Invalidate the overhang areas if they are visible.
updateOverhangAreas();
return window->rootViewToScreen(contentsToRootView(rect));
}
-IntPoint ScrollView::screenToContents(const IntPoint& point) const
-{
- HostWindow* window = hostWindow();
- if (!window)
- return IntPoint();
- return rootViewToContents(window->screenToRootView(point));
-}
-
bool ScrollView::containsScrollbarsAvoidingResizer() const
{
return !m_scrollbarsAvoidingResizer;
(*current)->frameRectsChanged();
}
-void ScrollView::clipRectChanged()
-{
- HashSet<RefPtr<Widget> >::const_iterator end = m_children.end();
- for (HashSet<RefPtr<Widget> >::const_iterator current = m_children.begin(); current != end; ++current)
- (*current)->clipRectChanged();
-}
-
static void positionScrollbarLayer(GraphicsLayer* graphicsLayer, Scrollbar* scrollbar)
{
if (!graphicsLayer || !scrollbar)
return !scrollCornerRect().isEmpty();
}
-void ScrollView::scrollbarStyleChanged(int, bool forceUpdate)
+void ScrollView::scrollbarStyleChanged()
{
- if (!forceUpdate)
- return;
-
contentsResized();
updateScrollbars(scrollOffset());
positionScrollbarLayers();
scrollViewDirtyRect.intersect(visibleAreaWithScrollbars);
context->translate(x(), y());
scrollViewDirtyRect.moveBy(-location());
+ context->clip(IntRect(IntPoint(), visibleAreaWithScrollbars.size()));
paintScrollbars(context, scrollViewDirtyRect);
}
updateScrollbars(scrollOffset());
}
-int ScrollView::pageStep(ScrollbarOrientation orientation) const
-{
- int length = (orientation == HorizontalScrollbar) ? visibleWidth() : visibleHeight();
- int minPageStep = static_cast<float>(length) * minFractionToStepWhenPaging();
- int pageStep = std::max(minPageStep, length - maxOverlapBetweenPages());
-
- return std::max(pageStep, 1);
-}
-
} // namespace WebCore