using namespace std;
-namespace WebCore {
+namespace blink {
ScrollView::ScrollView()
: m_horizontalScrollbarMode(ScrollbarAuto)
setScrollbarModes(newHorizontalMode, newVerticalMode);
}
-bool ScrollView::shouldAttemptToScrollUsingFastPath() const
-{
- return true;
-}
-
void ScrollView::setPaintsEntireContents(bool paintsEntireContents)
{
m_paintsEntireContents = paintsEntireContents;
return newScrollPosition;
}
+void ScrollView::adjustScrollbarOpacity()
+{
+ if (m_horizontalScrollbar && layerForHorizontalScrollbar()) {
+ bool isOpaqueScrollbar = !m_horizontalScrollbar->isOverlayScrollbar();
+ layerForHorizontalScrollbar()->setContentsOpaque(isOpaqueScrollbar);
+ }
+ if (m_verticalScrollbar && layerForVerticalScrollbar()) {
+ bool isOpaqueScrollbar = !m_verticalScrollbar->isOverlayScrollbar();
+ layerForVerticalScrollbar()->setContentsOpaque(isOpaqueScrollbar);
+ }
+}
+
int ScrollView::scrollSize(ScrollbarOrientation orientation) const
{
Scrollbar* scrollbar = ((orientation == HorizontalScrollbar) ? m_horizontalScrollbar : m_verticalScrollbar).get();
scrollContents(scrollDelta);
}
-void ScrollView::setScrollPosition(const IntPoint& scrollPoint)
+void ScrollView::setScrollPosition(const IntPoint& scrollPoint, ScrollBehavior scrollBehavior)
{
IntPoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint);
if (newScrollPosition == scrollPosition())
return;
- updateScrollbars(IntSize(newScrollPosition.x(), newScrollPosition.y()));
+ if (scrollBehavior == ScrollBehaviorInstant)
+ updateScrollbars(IntSize(newScrollPosition.x(), newScrollPosition.y()));
+ else
+ programmaticallyScrollSmoothlyToOffset(newScrollPosition);
}
bool ScrollView::scroll(ScrollDirection direction, ScrollGranularity granularity)
return ScrollbarTheme::theme()->usesOverlayScrollbars();
}
-void ScrollView::computeScrollbarExistence(bool& newHasHorizontalScrollbar, bool& newHasVerticalScrollbar, ComputeScrollbarExistenceOption option) const
+void ScrollView::computeScrollbarExistence(bool& newHasHorizontalScrollbar, bool& newHasVerticalScrollbar, const IntSize& docSize, ComputeScrollbarExistenceOption option) const
{
bool hasHorizontalScrollbar = m_horizontalScrollbar;
bool hasVerticalScrollbar = m_verticalScrollbar;
if (m_scrollbarsSuppressed || (hScroll != ScrollbarAuto && vScroll != ScrollbarAuto))
return;
- IntSize docSize = contentsSize();
-
if (hScroll == ScrollbarAuto)
newHasHorizontalScrollbar = docSize.width() > visibleWidth();
if (vScroll == ScrollbarAuto)
bool newHasHorizontalScrollbar = false;
bool newHasVerticalScrollbar = false;
- computeScrollbarExistence(newHasHorizontalScrollbar, newHasVerticalScrollbar, option);
+ computeScrollbarExistence(newHasHorizontalScrollbar, newHasVerticalScrollbar, contentsSize(), option);
bool scrollbarExistenceChanged = hasHorizontalScrollbar != newHasHorizontalScrollbar || hasVerticalScrollbar != newHasVerticalScrollbar;
if (!scrollbarExistenceChanged)
window->invalidateContentsAndRootView(panScrollIconDirtyRect);
}
- if (!shouldAttemptToScrollUsingFastPath() || !scrollContentsFastPath(-scrollDelta, scrollViewRect, clipRect))
+ if (!scrollContentsFastPath(-scrollDelta, scrollViewRect))
scrollContentsSlowPath(updateRect);
// Invalidate the overhang areas if they are visible.
frameRectsChanged();
}
-bool ScrollView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect)
+bool ScrollView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll)
{
- hostWindow()->scroll(scrollDelta, rectToScroll, clipRect);
+ hostWindow()->scroll();
return true;
}
void ScrollView::scrollbarStyleChanged()
{
+ adjustScrollbarOpacity();
contentsResized();
updateScrollbars(scrollOffset());
positionScrollbarLayers();
void ScrollView::paint(GraphicsContext* context, const IntRect& rect)
{
- if (context->paintingDisabled() && !context->updatingControlTints())
- return;
-
notifyPageThatContentAreaWillPaint();
IntRect documentDirtyRect = rect;
updateScrollbars(scrollOffset());
}
-} // namespace WebCore
+} // namespace blink