Commit e8632057 authored by abarth@chromium.org's avatar abarth@chromium.org

RenderLayerScrollableArea::updateScrollCornerStyle shouldn't do work if we're...

RenderLayerScrollableArea::updateScrollCornerStyle shouldn't do work if we're using overlay scrollbars

This function showed up on a profile of updateStyle in Silk's toggle_drawer
test case, but there no reason to update the scroll corner style if we're using
overlay scrollbars. If the author has created a custom scrollbar, we'll realize
that we don't have overlay scrollbars.

R=esprehn@chromium.org
BUG=335703

Review URL: https://codereview.chromium.org/178903004

git-svn-id: svn://svn.chromium.org/blink/trunk@168601 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 735d1b3d
......@@ -601,6 +601,9 @@ void RenderLayerScrollableArea::updateAfterLayout()
if (m_box->hasAutoVerticalScrollbar())
setHasVerticalScrollbar(hasVerticalOverflow);
if (hasVerticalOverflow || hasHorizontalOverflow)
updateScrollCornerStyle();
layer()->updateSelfPaintingLayer();
// Force an update since we know the scrollbars have changed things.
......@@ -958,6 +961,11 @@ bool RenderLayerScrollableArea::scrollsOverflow() const
void RenderLayerScrollableArea::updateScrollCornerStyle()
{
if (!m_scrollCorner && !hasScrollbar())
return;
if (!m_scrollCorner && hasOverlayScrollbars())
return;
RenderObject* actualRenderer = rendererForScrollbar(m_box);
RefPtr<RenderStyle> corner = m_box->hasOverflowClip() ? actualRenderer->getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), actualRenderer->style()) : PassRefPtr<RenderStyle>(nullptr);
if (corner) {
......
......@@ -319,22 +319,25 @@ void ScrollableArea::contentsResized()
bool ScrollableArea::hasOverlayScrollbars() const
{
return (verticalScrollbar() && verticalScrollbar()->isOverlayScrollbar())
|| (horizontalScrollbar() && horizontalScrollbar()->isOverlayScrollbar());
Scrollbar* vScrollbar = verticalScrollbar();
if (vScrollbar && vScrollbar->isOverlayScrollbar())
return true;
Scrollbar* hScrollbar = horizontalScrollbar();
return hScrollbar && hScrollbar->isOverlayScrollbar();
}
void ScrollableArea::setScrollbarOverlayStyle(ScrollbarOverlayStyle overlayStyle)
{
m_scrollbarOverlayStyle = overlayStyle;
if (horizontalScrollbar()) {
ScrollbarTheme::theme()->updateScrollbarOverlayStyle(horizontalScrollbar());
horizontalScrollbar()->invalidate();
if (Scrollbar* scrollbar = horizontalScrollbar()) {
ScrollbarTheme::theme()->updateScrollbarOverlayStyle(scrollbar);
scrollbar->invalidate();
}
if (verticalScrollbar()) {
ScrollbarTheme::theme()->updateScrollbarOverlayStyle(verticalScrollbar());
verticalScrollbar()->invalidate();
if (Scrollbar* scrollbar = verticalScrollbar()) {
ScrollbarTheme::theme()->updateScrollbarOverlayStyle(scrollbar);
scrollbar->invalidate();
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment