summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchrishtr <chrishtr@chromium.org>2015-11-06 16:16:39 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-07 00:17:32 +0000
commit201cd54baaf4f94a76e7d254d70034c946168986 (patch)
tree7fbc16921725639201c5a0540a14a8ef18821919
parent4ef36d607ae6b500b173aa32767d0877222063e8 (diff)
downloadchromium_src-201cd54baaf4f94a76e7d254d70034c946168986.zip
chromium_src-201cd54baaf4f94a76e7d254d70034c946168986.tar.gz
chromium_src-201cd54baaf4f94a76e7d254d70034c946168986.tar.bz2
Paint scrollbars at device scale resolution.
BUG=531257 Review URL: https://codereview.chromium.org/1430503007 Cr-Commit-Position: refs/heads/master@{#358464}
-rw-r--r--third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp6
-rw-r--r--third_party/WebKit/Source/platform/exported/WebScrollbarThemePainter.cpp14
-rw-r--r--third_party/WebKit/public/platform/WebScrollbarThemePainter.h6
3 files changed, 20 insertions, 6 deletions
diff --git a/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp b/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp
index f3b10cc..21d9172 100644
--- a/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp
+++ b/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp
@@ -276,10 +276,10 @@ void ScrollingCoordinator::removeWebScrollbarLayer(ScrollableArea* scrollableAre
GraphicsLayer::unregisterContentsLayer(scrollbarLayer->layer());
}
-static PassOwnPtr<WebScrollbarLayer> createScrollbarLayer(Scrollbar* scrollbar)
+static PassOwnPtr<WebScrollbarLayer> createScrollbarLayer(Scrollbar* scrollbar, float deviceScaleFactor)
{
ScrollbarTheme* theme = scrollbar->theme();
- WebScrollbarThemePainter painter(theme, scrollbar);
+ WebScrollbarThemePainter painter(theme, scrollbar, deviceScaleFactor);
OwnPtr<WebScrollbarThemeGeometry> geometry(WebScrollbarThemeGeometryNative::create(theme));
OwnPtr<WebScrollbarLayer> scrollbarLayer = adoptPtr(Platform::current()->compositorSupport()->createScrollbarLayer(WebScrollbarImpl::create(scrollbar), painter, geometry.leakPtr()));
@@ -367,7 +367,7 @@ void ScrollingCoordinator::scrollableAreaScrollbarLayerDidChange(ScrollableArea*
ASSERT(RuntimeEnabledFeatures::overlayScrollbarsEnabled());
webScrollbarLayer = createSolidColorScrollbarLayer(orientation, scrollbar->theme()->thumbThickness(scrollbar), scrollbar->theme()->trackPosition(scrollbar), scrollableArea->shouldPlaceVerticalScrollbarOnLeft());
} else {
- webScrollbarLayer = createScrollbarLayer(scrollbar);
+ webScrollbarLayer = createScrollbarLayer(scrollbar, m_page->deviceScaleFactor());
}
scrollbarLayer = addWebScrollbarLayer(scrollableArea, orientation, webScrollbarLayer.release());
}
diff --git a/third_party/WebKit/Source/platform/exported/WebScrollbarThemePainter.cpp b/third_party/WebKit/Source/platform/exported/WebScrollbarThemePainter.cpp
index deb9b6d..8b63bbf 100644
--- a/third_party/WebKit/Source/platform/exported/WebScrollbarThemePainter.cpp
+++ b/third_party/WebKit/Source/platform/exported/WebScrollbarThemePainter.cpp
@@ -41,6 +41,7 @@ void WebScrollbarThemePainter::assign(const WebScrollbarThemePainter& painter)
// This is a pointer to a static object, so no ownership transferral.
m_theme = painter.m_theme;
m_scrollbar = painter.m_scrollbar;
+ m_deviceScaleFactor = painter.m_deviceScaleFactor;
}
void WebScrollbarThemePainter::reset()
@@ -55,6 +56,7 @@ void WebScrollbarThemePainter::paintScrollbarBackground(WebCanvas* canvas, const
IntRect intRect(rect);
SkPictureBuilder pictureBuilder(intRect);
+ pictureBuilder.context().setDeviceScaleFactor(m_deviceScaleFactor);
m_theme->paintScrollbarBackground(&pictureBuilder.context(), m_scrollbar.get());
pictureBuilder.endRecording()->playback(canvas);
}
@@ -63,6 +65,7 @@ void WebScrollbarThemePainter::paintTrackBackground(WebCanvas* canvas, const Web
{
IntRect intRect(rect);
SkPictureBuilder pictureBuilder(intRect);
+ pictureBuilder.context().setDeviceScaleFactor(m_deviceScaleFactor);
m_theme->paintTrackBackground(&pictureBuilder.context(), m_scrollbar.get(), intRect);
pictureBuilder.endRecording()->playback(canvas);
}
@@ -71,6 +74,7 @@ void WebScrollbarThemePainter::paintBackTrackPart(WebCanvas* canvas, const WebRe
{
IntRect intRect(rect);
SkPictureBuilder pictureBuilder(intRect);
+ pictureBuilder.context().setDeviceScaleFactor(m_deviceScaleFactor);
m_theme->paintTrackPiece(&pictureBuilder.context(), m_scrollbar.get(), intRect, BackTrackPart);
pictureBuilder.endRecording()->playback(canvas);
}
@@ -79,6 +83,7 @@ void WebScrollbarThemePainter::paintForwardTrackPart(WebCanvas* canvas, const We
{
IntRect intRect(rect);
SkPictureBuilder pictureBuilder(intRect);
+ pictureBuilder.context().setDeviceScaleFactor(m_deviceScaleFactor);
m_theme->paintTrackPiece(&pictureBuilder.context(), m_scrollbar.get(), intRect, ForwardTrackPart);
pictureBuilder.endRecording()->playback(canvas);
}
@@ -87,6 +92,7 @@ void WebScrollbarThemePainter::paintBackButtonStart(WebCanvas* canvas, const Web
{
IntRect intRect(rect);
SkPictureBuilder pictureBuilder(intRect);
+ pictureBuilder.context().setDeviceScaleFactor(m_deviceScaleFactor);
m_theme->paintButton(&pictureBuilder.context(), m_scrollbar.get(), intRect, BackButtonStartPart);
pictureBuilder.endRecording()->playback(canvas);
}
@@ -95,6 +101,7 @@ void WebScrollbarThemePainter::paintBackButtonEnd(WebCanvas* canvas, const WebRe
{
IntRect intRect(rect);
SkPictureBuilder pictureBuilder(intRect);
+ pictureBuilder.context().setDeviceScaleFactor(m_deviceScaleFactor);
m_theme->paintButton(&pictureBuilder.context(), m_scrollbar.get(), intRect, BackButtonEndPart);
pictureBuilder.endRecording()->playback(canvas);
}
@@ -103,6 +110,7 @@ void WebScrollbarThemePainter::paintForwardButtonStart(WebCanvas* canvas, const
{
IntRect intRect(rect);
SkPictureBuilder pictureBuilder(intRect);
+ pictureBuilder.context().setDeviceScaleFactor(m_deviceScaleFactor);
m_theme->paintButton(&pictureBuilder.context(), m_scrollbar.get(), intRect, ForwardButtonStartPart);
pictureBuilder.endRecording()->playback(canvas);
}
@@ -111,6 +119,7 @@ void WebScrollbarThemePainter::paintForwardButtonEnd(WebCanvas* canvas, const We
{
IntRect intRect(rect);
SkPictureBuilder pictureBuilder(intRect);
+ pictureBuilder.context().setDeviceScaleFactor(m_deviceScaleFactor);
m_theme->paintButton(&pictureBuilder.context(), m_scrollbar.get(), intRect, ForwardButtonEndPart);
pictureBuilder.endRecording()->playback(canvas);
}
@@ -119,6 +128,7 @@ void WebScrollbarThemePainter::paintTickmarks(WebCanvas* canvas, const WebRect&
{
IntRect intRect(rect);
SkPictureBuilder pictureBuilder(intRect);
+ pictureBuilder.context().setDeviceScaleFactor(m_deviceScaleFactor);
m_theme->paintTickmarks(&pictureBuilder.context(), m_scrollbar.get(), intRect);
pictureBuilder.endRecording()->playback(canvas);
}
@@ -127,13 +137,15 @@ void WebScrollbarThemePainter::paintThumb(WebCanvas* canvas, const WebRect& rect
{
IntRect intRect(rect);
SkPictureBuilder pictureBuilder(intRect);
+ pictureBuilder.context().setDeviceScaleFactor(m_deviceScaleFactor);
m_theme->paintThumb(&pictureBuilder.context(), m_scrollbar.get(), intRect);
pictureBuilder.endRecording()->playback(canvas);
}
-WebScrollbarThemePainter::WebScrollbarThemePainter(ScrollbarTheme* theme, Scrollbar* scrollbar)
+WebScrollbarThemePainter::WebScrollbarThemePainter(ScrollbarTheme* theme, Scrollbar* scrollbar, float deviceScaleFactor)
: m_theme(theme)
, m_scrollbar(scrollbar)
+ , m_deviceScaleFactor(deviceScaleFactor)
{
}
diff --git a/third_party/WebKit/public/platform/WebScrollbarThemePainter.h b/third_party/WebKit/public/platform/WebScrollbarThemePainter.h
index 268d94b..6563a6e 100644
--- a/third_party/WebKit/public/platform/WebScrollbarThemePainter.h
+++ b/third_party/WebKit/public/platform/WebScrollbarThemePainter.h
@@ -38,7 +38,7 @@ struct WebRect;
class WebScrollbarThemePainter {
public:
- WebScrollbarThemePainter() : m_theme(0) { }
+ WebScrollbarThemePainter() : m_theme(0), m_deviceScaleFactor(1.0) { }
WebScrollbarThemePainter(const WebScrollbarThemePainter& painter) { assign(painter); }
virtual ~WebScrollbarThemePainter()
{
@@ -65,7 +65,7 @@ public:
BLINK_PLATFORM_EXPORT void paintThumb(WebCanvas*, const WebRect&);
#if INSIDE_BLINK
- BLINK_PLATFORM_EXPORT WebScrollbarThemePainter(ScrollbarTheme*, Scrollbar*);
+ BLINK_PLATFORM_EXPORT WebScrollbarThemePainter(ScrollbarTheme*, Scrollbar*, float deviceScaleFactor);
#endif
private:
@@ -80,6 +80,8 @@ private:
// scrollbar (and not a WebScrollbar wrapper) due to static_casts for
// LayoutScrollbar and pointer-based HashMap lookups for Lion scrollbars.
WebPrivatePtr<Scrollbar> m_scrollbar;
+
+ float m_deviceScaleFactor;
};
} // namespace blink