Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(431)

Unified Diff: third_party/WebKit/Source/platform/scroll/Scrollbar.cpp

Issue 1560403002: Scale scrollbar in use-zoom-for-dsf mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove unintentional change Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/scroll/Scrollbar.cpp
diff --git a/third_party/WebKit/Source/platform/scroll/Scrollbar.cpp b/third_party/WebKit/Source/platform/scroll/Scrollbar.cpp
index f79cdd89d63dae424a9ad66b06d9d03829f2887c..a0cf00d408c4abffd97e7ebf5ae735fdc54c4c80 100644
--- a/third_party/WebKit/Source/platform/scroll/Scrollbar.cpp
+++ b/third_party/WebKit/Source/platform/scroll/Scrollbar.cpp
@@ -26,6 +26,7 @@
#include "platform/scroll/Scrollbar.h"
#include <algorithm>
+#include "platform/HostWindow.h"
#include "platform/PlatformGestureEvent.h"
#include "platform/PlatformMouseEvent.h"
#include "platform/graphics/paint/CullRect.h"
@@ -40,21 +41,22 @@
namespace blink {
-PassRefPtrWillBeRawPtr<Scrollbar> Scrollbar::create(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize size)
+PassRefPtrWillBeRawPtr<Scrollbar> Scrollbar::create(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize size, HostWindow* hostWindow)
{
- return adoptRefWillBeNoop(new Scrollbar(scrollableArea, orientation, size));
+ return adoptRefWillBeNoop(new Scrollbar(scrollableArea, orientation, size, hostWindow));
}
PassRefPtrWillBeRawPtr<Scrollbar> Scrollbar::createForTesting(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize size, ScrollbarTheme* theme)
{
- return adoptRefWillBeNoop(new Scrollbar(scrollableArea, orientation, size, theme));
+ return adoptRefWillBeNoop(new Scrollbar(scrollableArea, orientation, size, nullptr, theme));
}
-Scrollbar::Scrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize controlSize, ScrollbarTheme* theme)
+Scrollbar::Scrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize controlSize, HostWindow* hostWindow, ScrollbarTheme* theme)
: m_scrollableArea(scrollableArea)
, m_orientation(orientation)
, m_controlSize(controlSize)
, m_theme(theme ? *theme : ScrollbarTheme::theme())
+ , m_hostWindow(hostWindow)
, m_visibleSize(0)
, m_totalSize(0)
, m_currentPos(0)
@@ -78,6 +80,8 @@ Scrollbar::Scrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orient
// scrollbar thickness and use it when sizing scrollbars (rather than leaving one dimension of the scrollbar
// alone when sizing).
int thickness = m_theme.scrollbarThickness(controlSize);
+ if (m_hostWindow)
+ thickness = m_hostWindow->screenToViewport(thickness);
Widget::setFrameRect(IntRect(0, 0, thickness, thickness));
m_currentPos = scrollableAreaCurrentPos();
@@ -471,6 +475,15 @@ void Scrollbar::setEnabled(bool e)
setNeedsPaintInvalidation();
}
+int Scrollbar::scrollbarThickness() const
+{
+ int thickness = orientation() == HorizontalScrollbar ? height() : width();
+ if (!thickness || !m_hostWindow)
+ return thickness;
+ return m_hostWindow->screenToViewport(m_theme.scrollbarThickness(controlSize()));
+}
+
+
bool Scrollbar::isOverlayScrollbar() const
{
return m_theme.usesOverlayScrollbars();

Powered by Google App Engine
This is Rietveld 408576698