| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/paint/ScrollableAreaPainter.h" | 5 #include "core/paint/ScrollableAreaPainter.h" |
| 6 | 6 |
| 7 #include "core/layout/LayoutView.h" | 7 #include "core/layout/LayoutView.h" |
| 8 #include "core/page/Page.h" | 8 #include "core/page/Page.h" |
| 9 #include "core/paint/LayoutObjectDrawingRecorder.h" | 9 #include "core/paint/LayoutObjectDrawingRecorder.h" |
| 10 #include "core/paint/ObjectPaintProperties.h" | 10 #include "core/paint/ObjectPaintProperties.h" |
| 11 #include "core/paint/PaintInfo.h" | 11 #include "core/paint/PaintInfo.h" |
| 12 #include "core/paint/PaintLayer.h" | 12 #include "core/paint/PaintLayer.h" |
| 13 #include "core/paint/PaintLayerScrollableArea.h" | 13 #include "core/paint/PaintLayerScrollableArea.h" |
| 14 #include "core/paint/ScrollbarPainter.h" | 14 #include "core/paint/ScrollbarPainter.h" |
| 15 #include "core/paint/TransformRecorder.h" | 15 #include "core/paint/TransformRecorder.h" |
| 16 #include "platform/HostWindow.h" | 16 #include "platform/PlatformChromeClient.h" |
| 17 #include "platform/graphics/GraphicsContext.h" | 17 #include "platform/graphics/GraphicsContext.h" |
| 18 #include "platform/graphics/GraphicsContextStateSaver.h" | 18 #include "platform/graphics/GraphicsContextStateSaver.h" |
| 19 #include "platform/graphics/paint/ClipRecorder.h" | 19 #include "platform/graphics/paint/ClipRecorder.h" |
| 20 #include "platform/graphics/paint/ScopedPaintChunkProperties.h" | 20 #include "platform/graphics/paint/ScopedPaintChunkProperties.h" |
| 21 | 21 |
| 22 namespace blink { | 22 namespace blink { |
| 23 | 23 |
| 24 void ScrollableAreaPainter::PaintResizer(GraphicsContext& context, | 24 void ScrollableAreaPainter::PaintResizer(GraphicsContext& context, |
| 25 const IntPoint& paint_offset, | 25 const IntPoint& paint_offset, |
| 26 const CullRect& cull_rect) { | 26 const CullRect& cull_rect) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 void ScrollableAreaPainter::DrawPlatformResizerImage( | 70 void ScrollableAreaPainter::DrawPlatformResizerImage( |
| 71 GraphicsContext& context, | 71 GraphicsContext& context, |
| 72 IntRect resizer_corner_rect) { | 72 IntRect resizer_corner_rect) { |
| 73 float old_device_scale_factor = | 73 float old_device_scale_factor = |
| 74 blink::DeviceScaleFactorDeprecated(GetScrollableArea().Box().GetFrame()); | 74 blink::DeviceScaleFactorDeprecated(GetScrollableArea().Box().GetFrame()); |
| 75 // |blink::deviceScaleFactor| returns different values between MAC (2 or 1) | 75 // |blink::deviceScaleFactor| returns different values between MAC (2 or 1) |
| 76 // and other platforms (always 1). For this reason we cannot hardcode the | 76 // and other platforms (always 1). For this reason we cannot hardcode the |
| 77 // value of 1 in the call for |windowToViewportScalar|. Since zoom-for-dsf is | 77 // value of 1 in the call for |windowToViewportScalar|. Since zoom-for-dsf is |
| 78 // disabled on MAC, |windowToViewportScalar| will be a no-op on it. | 78 // disabled on MAC, |windowToViewportScalar| will be a no-op on it. |
| 79 float device_scale_factor = | 79 float device_scale_factor = |
| 80 GetScrollableArea().GetHostWindow()->WindowToViewportScalar( | 80 GetScrollableArea().GetChromeClient()->WindowToViewportScalar( |
| 81 old_device_scale_factor); | 81 old_device_scale_factor); |
| 82 | 82 |
| 83 RefPtr<Image> resize_corner_image; | 83 RefPtr<Image> resize_corner_image; |
| 84 IntSize corner_resizer_size; | 84 IntSize corner_resizer_size; |
| 85 if (device_scale_factor >= 2) { | 85 if (device_scale_factor >= 2) { |
| 86 DEFINE_STATIC_REF(Image, resize_corner_image_hi_res, | 86 DEFINE_STATIC_REF(Image, resize_corner_image_hi_res, |
| 87 (Image::LoadPlatformResource("textAreaResizeCorner@2x"))); | 87 (Image::LoadPlatformResource("textAreaResizeCorner@2x"))); |
| 88 resize_corner_image = resize_corner_image_hi_res; | 88 resize_corner_image = resize_corner_image_hi_res; |
| 89 corner_resizer_size = resize_corner_image->Size(); | 89 corner_resizer_size = resize_corner_image->Size(); |
| 90 if (old_device_scale_factor >= 2) | 90 if (old_device_scale_factor >= 2) |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 LayoutObjectDrawingRecorder recorder(context, GetScrollableArea().Box(), | 269 LayoutObjectDrawingRecorder recorder(context, GetScrollableArea().Box(), |
| 270 DisplayItem::kScrollbarCorner, abs_rect); | 270 DisplayItem::kScrollbarCorner, abs_rect); |
| 271 context.FillRect(abs_rect, Color::kWhite); | 271 context.FillRect(abs_rect, Color::kWhite); |
| 272 } | 272 } |
| 273 | 273 |
| 274 PaintLayerScrollableArea& ScrollableAreaPainter::GetScrollableArea() const { | 274 PaintLayerScrollableArea& ScrollableAreaPainter::GetScrollableArea() const { |
| 275 return *scrollable_area_; | 275 return *scrollable_area_; |
| 276 } | 276 } |
| 277 | 277 |
| 278 } // namespace blink | 278 } // namespace blink |
| OLD | NEW |