Commit 5f9b6826 authored by aelias@chromium.org's avatar aelias@chromium.org

Set track_start on solid color layers to the margin.

The scrollbar margin on the overlay scrollbar theme is used to distance
the thumb from the edge of the screen on all sides, not just the
widthwise side.  This was already computed properly in the theme's
TrackRect, but it wasn't communicated to the WebScrollbarLayer.

Also, shrink the margin to 3 DIPs on Android, which on closer inspection
better matches the system theme.

Chromium-side change at https://codereview.chromium.org/234603002/
NOTRY=true
BUG=361923

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

git-svn-id: svn://svn.chromium.org/blink/trunk@171404 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent e953d055
......@@ -202,7 +202,7 @@ void PinchViewport::setupScrollbar(WebScrollbar::Orientation orientation)
ScrollingCoordinator* coordinator = m_frameHost.page().scrollingCoordinator();
ASSERT(coordinator);
ScrollbarOrientation webcoreOrientation = isHorizontal ? HorizontalScrollbar : VerticalScrollbar;
webScrollbarLayer = coordinator->createSolidColorScrollbarLayer(webcoreOrientation, overlayScrollbarThickness, false);
webScrollbarLayer = coordinator->createSolidColorScrollbarLayer(webcoreOrientation, overlayScrollbarThickness, 0, false);
webScrollbarLayer->setClipLayer(m_innerViewportContainerLayer->platformLayer());
scrollbarGraphicsLayer->setContentsToPlatformLayer(webScrollbarLayer->layer());
......
......@@ -241,10 +241,10 @@ static PassOwnPtr<WebScrollbarLayer> createScrollbarLayer(Scrollbar* scrollbar)
return scrollbarLayer.release();
}
PassOwnPtr<WebScrollbarLayer> ScrollingCoordinator::createSolidColorScrollbarLayer(ScrollbarOrientation orientation, int thumbThickness, bool isLeftSideVerticalScrollbar)
PassOwnPtr<WebScrollbarLayer> ScrollingCoordinator::createSolidColorScrollbarLayer(ScrollbarOrientation orientation, int thumbThickness, int trackStart, bool isLeftSideVerticalScrollbar)
{
blink::WebScrollbar::Orientation webOrientation = (orientation == HorizontalScrollbar) ? blink::WebScrollbar::Horizontal : blink::WebScrollbar::Vertical;
OwnPtr<WebScrollbarLayer> scrollbarLayer = adoptPtr(blink::Platform::current()->compositorSupport()->createSolidColorScrollbarLayer(webOrientation, thumbThickness, isLeftSideVerticalScrollbar));
OwnPtr<WebScrollbarLayer> scrollbarLayer = adoptPtr(blink::Platform::current()->compositorSupport()->createSolidColorScrollbarLayer(webOrientation, thumbThickness, trackStart, isLeftSideVerticalScrollbar));
GraphicsLayer::registerContentsLayer(scrollbarLayer->layer());
return scrollbarLayer.release();
}
......@@ -322,7 +322,7 @@ void ScrollingCoordinator::scrollableAreaScrollbarLayerDidChange(ScrollableArea*
OwnPtr<WebScrollbarLayer> webScrollbarLayer;
if (settings->useSolidColorScrollbars()) {
ASSERT(RuntimeEnabledFeatures::overlayScrollbarsEnabled());
webScrollbarLayer = createSolidColorScrollbarLayer(orientation, scrollbar->theme()->thumbThickness(scrollbar), scrollableArea->shouldPlaceVerticalScrollbarOnLeft());
webScrollbarLayer = createSolidColorScrollbarLayer(orientation, scrollbar->theme()->thumbThickness(scrollbar), scrollbar->theme()->trackPosition(scrollbar), scrollableArea->shouldPlaceVerticalScrollbarOnLeft());
} else {
webScrollbarLayer = createScrollbarLayer(scrollbar);
}
......
......@@ -96,7 +96,7 @@ public:
MainThreadScrollingReasons mainThreadScrollingReasons() const;
bool shouldUpdateScrollLayerPositionOnMainThread() const { return mainThreadScrollingReasons() != 0; }
PassOwnPtr<blink::WebScrollbarLayer> createSolidColorScrollbarLayer(ScrollbarOrientation, int thumbThickness, bool isLeftSideVerticalScrollbar);
PassOwnPtr<blink::WebScrollbarLayer> createSolidColorScrollbarLayer(ScrollbarOrientation, int thumbThickness, int trackStart, bool isLeftSideVerticalScrollbar);
void willDestroyScrollableArea(ScrollableArea*);
// Returns true if the coordinator handled this change.
......
......@@ -32,7 +32,7 @@ namespace WebCore {
ScrollbarTheme* ScrollbarTheme::nativeTheme()
{
DEFINE_STATIC_LOCAL(ScrollbarThemeOverlay, theme, (3, 4, ScrollbarThemeOverlay::DisallowHitTest, Color(128, 128, 128, 128)));
DEFINE_STATIC_LOCAL(ScrollbarThemeOverlay, theme, (3, 3, ScrollbarThemeOverlay::DisallowHitTest, Color(128, 128, 128, 128)));
return &theme;
}
......
......@@ -80,7 +80,7 @@ public:
// The ownership of the WebScrollbarThemeGeometry pointer is passed to Chromium.
virtual WebScrollbarLayer* createScrollbarLayer(WebScrollbar*, WebScrollbarThemePainter, WebScrollbarThemeGeometry*) { return 0; }
virtual WebScrollbarLayer* createSolidColorScrollbarLayer(WebScrollbar::Orientation, int thumbThickness, bool isLeftSideVerticalScrollbar) { return 0; }
virtual WebScrollbarLayer* createSolidColorScrollbarLayer(WebScrollbar::Orientation, int thumbThickness, int trackStart, bool isLeftSideVerticalScrollbar) { return 0; }
// Animation ----------------------------------------------------
......
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