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

Unified Diff: third_party/WebKit/Source/core/paint/ScrollableAreaPainter.cpp

Issue 2698543002: Resizes corner rect to match device scale factor (Closed)
Patch Set: Resizes corner rect to match device scale factor Created 3 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/paint/ScrollableAreaPainter.cpp
diff --git a/third_party/WebKit/Source/core/paint/ScrollableAreaPainter.cpp b/third_party/WebKit/Source/core/paint/ScrollableAreaPainter.cpp
index 94dea2f946012bb7ed79767469cd526dadcfb809..88c4cc77619b172da9d51092dd3bd3046041f3db 100644
--- a/third_party/WebKit/Source/core/paint/ScrollableAreaPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/ScrollableAreaPainter.cpp
@@ -13,6 +13,7 @@
#include "core/paint/PaintLayerScrollableArea.h"
#include "core/paint/ScrollbarPainter.h"
#include "core/paint/TransformRecorder.h"
+#include "platform/HostWindow.h"
#include "platform/graphics/GraphicsContext.h"
#include "platform/graphics/GraphicsContextStateSaver.h"
#include "platform/graphics/paint/ClipRecorder.h"
@@ -68,8 +69,15 @@ void ScrollableAreaPainter::paintResizer(GraphicsContext& context,
void ScrollableAreaPainter::drawPlatformResizerImage(
GraphicsContext& context,
IntRect resizerCornerRect) {
- float deviceScaleFactor =
+ float oldDeviceScaleFactor =
blink::deviceScaleFactor(getScrollableArea().box().frame());
+ // |blink::deviceScaleFactor| returns different values between MAC (2 or 1)
+ // and other platforms (always 1). For this reason we cannot hardcode the
+ // value of 1 in the call for |windowToViewportScalar|. Since zoom-for-dsf is
+ // disabled on MAC, |windowToViewportScalar| will be a no-op on it.
+ float deviceScaleFactor =
+ getScrollableArea().getHostWindow()->windowToViewportScalar(
+ oldDeviceScaleFactor);
RefPtr<Image> resizeCornerImage;
IntSize cornerResizerSize;
@@ -78,7 +86,8 @@ void ScrollableAreaPainter::drawPlatformResizerImage(
(Image::loadPlatformResource("textAreaResizeCorner@2x")));
resizeCornerImage = resizeCornerImageHiRes;
cornerResizerSize = resizeCornerImage->size();
- cornerResizerSize.scale(0.5f);
+ if (oldDeviceScaleFactor >= 2)
+ cornerResizerSize.scale(0.5f);
} else {
DEFINE_STATIC_REF(Image, resizeCornerImageLoRes,
(Image::loadPlatformResource("textAreaResizeCorner")));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698