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

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

Issue 1603253003: Add dedicated windowToViewport method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 48942f4e4305682e757159c6d0d40677c4fdd819..f5e14e45c66cee83c8d06e636c59e1ed03dc317a 100644
--- a/third_party/WebKit/Source/platform/scroll/Scrollbar.cpp
+++ b/third_party/WebKit/Source/platform/scroll/Scrollbar.cpp
@@ -29,6 +29,7 @@
#include "platform/HostWindow.h"
#include "platform/PlatformGestureEvent.h"
#include "platform/PlatformMouseEvent.h"
+#include "platform/geometry/FloatRect.h"
#include "platform/graphics/paint/CullRect.h"
// See windowActiveChangedForSnowLeopardOnly() below.
// TODO(ellyjones): remove this when Snow Leopard support is gone.
@@ -81,7 +82,7 @@ Scrollbar::Scrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orient
// alone when sizing).
int thickness = m_theme.scrollbarThickness(controlSize);
if (m_hostWindow)
- thickness = m_hostWindow->screenToViewport(thickness);
+ thickness = m_hostWindow->windowToViewport(FloatRect(0, 0, thickness, 0)).width();
Widget::setFrameRect(IntRect(0, 0, thickness, thickness));
m_currentPos = scrollableAreaCurrentPos();
@@ -482,7 +483,7 @@ int Scrollbar::scrollbarThickness() const
int thickness = orientation() == HorizontalScrollbar ? height() : width();
if (!thickness || !m_hostWindow)
return thickness;
- return m_hostWindow->screenToViewport(m_theme.scrollbarThickness(controlSize()));
+ return m_hostWindow->windowToViewport(FloatRect(0, 0, m_theme.scrollbarThickness(controlSize()), 0)).width();
}

Powered by Google App Engine
This is Rietveld 408576698