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() ...@@ -601,6 +601,9 @@ void RenderLayerScrollableArea::updateAfterLayout()
if (m_box->hasAutoVerticalScrollbar()) if (m_box->hasAutoVerticalScrollbar())
setHasVerticalScrollbar(hasVerticalOverflow); setHasVerticalScrollbar(hasVerticalOverflow);
if (hasVerticalOverflow || hasHorizontalOverflow)
updateScrollCornerStyle();
layer()->updateSelfPaintingLayer(); layer()->updateSelfPaintingLayer();
// Force an update since we know the scrollbars have changed things. // Force an update since we know the scrollbars have changed things.
...@@ -958,6 +961,11 @@ bool RenderLayerScrollableArea::scrollsOverflow() const ...@@ -958,6 +961,11 @@ bool RenderLayerScrollableArea::scrollsOverflow() const
void RenderLayerScrollableArea::updateScrollCornerStyle() void RenderLayerScrollableArea::updateScrollCornerStyle()
{ {
if (!m_scrollCorner && !hasScrollbar())
return;
if (!m_scrollCorner && hasOverlayScrollbars())
return;
RenderObject* actualRenderer = rendererForScrollbar(m_box); RenderObject* actualRenderer = rendererForScrollbar(m_box);
RefPtr<RenderStyle> corner = m_box->hasOverflowClip() ? actualRenderer->getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), actualRenderer->style()) : PassRefPtr<RenderStyle>(nullptr); RefPtr<RenderStyle> corner = m_box->hasOverflowClip() ? actualRenderer->getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), actualRenderer->style()) : PassRefPtr<RenderStyle>(nullptr);
if (corner) { if (corner) {
......
...@@ -319,22 +319,25 @@ void ScrollableArea::contentsResized() ...@@ -319,22 +319,25 @@ void ScrollableArea::contentsResized()
bool ScrollableArea::hasOverlayScrollbars() const bool ScrollableArea::hasOverlayScrollbars() const
{ {
return (verticalScrollbar() && verticalScrollbar()->isOverlayScrollbar()) Scrollbar* vScrollbar = verticalScrollbar();
|| (horizontalScrollbar() && horizontalScrollbar()->isOverlayScrollbar()); if (vScrollbar && vScrollbar->isOverlayScrollbar())
return true;
Scrollbar* hScrollbar = horizontalScrollbar();
return hScrollbar && hScrollbar->isOverlayScrollbar();
} }
void ScrollableArea::setScrollbarOverlayStyle(ScrollbarOverlayStyle overlayStyle) void ScrollableArea::setScrollbarOverlayStyle(ScrollbarOverlayStyle overlayStyle)
{ {
m_scrollbarOverlayStyle = overlayStyle; m_scrollbarOverlayStyle = overlayStyle;
if (horizontalScrollbar()) { if (Scrollbar* scrollbar = horizontalScrollbar()) {
ScrollbarTheme::theme()->updateScrollbarOverlayStyle(horizontalScrollbar()); ScrollbarTheme::theme()->updateScrollbarOverlayStyle(scrollbar);
horizontalScrollbar()->invalidate(); scrollbar->invalidate();
} }
if (verticalScrollbar()) { if (Scrollbar* scrollbar = verticalScrollbar()) {
ScrollbarTheme::theme()->updateScrollbarOverlayStyle(verticalScrollbar()); ScrollbarTheme::theme()->updateScrollbarOverlayStyle(scrollbar);
verticalScrollbar()->invalidate(); 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