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 ef25cdf18f0f3b14ab1501373ec8c87a19ce42cb..4c1109d1e303ec2db6526a24090e1b44fccbf970 100644 |
--- a/third_party/WebKit/Source/core/paint/ScrollableAreaPainter.cpp |
+++ b/third_party/WebKit/Source/core/paint/ScrollableAreaPainter.cpp |
@@ -70,48 +70,53 @@ void ScrollableAreaPainter::PaintResizer(GraphicsContext& context, |
void ScrollableAreaPainter::DrawPlatformResizerImage( |
GraphicsContext& context, |
IntRect resizer_corner_rect) { |
- float old_device_scale_factor = |
- blink::DeviceScaleFactorDeprecated(GetScrollableArea().Box().GetFrame()); |
- // |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 device_scale_factor = |
- GetScrollableArea().GetChromeClient()->WindowToViewportScalar( |
- old_device_scale_factor); |
- |
- RefPtr<Image> resize_corner_image; |
- IntSize corner_resizer_size; |
- if (device_scale_factor >= 2) { |
- DEFINE_STATIC_REF(Image, resize_corner_image_hi_res, |
- (Image::LoadPlatformResource("textAreaResizeCorner@2x"))); |
- resize_corner_image = resize_corner_image_hi_res; |
- corner_resizer_size = resize_corner_image->Size(); |
- if (old_device_scale_factor >= 2) |
- corner_resizer_size.Scale(0.5f); |
- } else { |
- DEFINE_STATIC_REF(Image, resize_corner_image_lo_res, |
- (Image::LoadPlatformResource("textAreaResizeCorner"))); |
- resize_corner_image = resize_corner_image_lo_res; |
- corner_resizer_size = resize_corner_image->Size(); |
- } |
+ PaintFlags paint_flags; |
+ paint_flags.setStyle(PaintFlags::kStroke_Style); |
+ paint_flags.setStrokeWidth(1); |
+ SkPath line_path; |
+ |
+ auto paint_resizer_line = [&context, &paint_flags, &line_path]( |
+ IntPoint& start, IntPoint& end, bool on_left) { |
+ line_path.rewind(); |
+ line_path.moveTo(start.X(), start.Y()); |
+ line_path.lineTo(end.X(), end.Y()); |
+ paint_flags.setARGB(153, 0, 0, 0); |
+ context.DrawPath(line_path, paint_flags); |
f(malita)
2017/04/26 17:56:33
Can we use DrawLine instead?
(DrawPoints would be
|
+ line_path.rewind(); |
+ line_path.moveTo(start.X(), start.Y() + 1); |
+ line_path.lineTo(end.X() + (on_left ? -1 : 1), end.Y()); |
+ paint_flags.setARGB(153, 255, 255, 255); |
+ context.DrawPath(line_path, paint_flags); |
+ }; |
if (GetScrollableArea() |
.Box() |
.ShouldPlaceBlockDirectionScrollbarOnLogicalLeft()) { |
- context.Save(); |
- context.Translate(resizer_corner_rect.X() + corner_resizer_size.Width(), |
- resizer_corner_rect.Y() + resizer_corner_rect.Height() - |
- corner_resizer_size.Height()); |
- context.Scale(-1.0, 1.0); |
- context.DrawImage(resize_corner_image.Get(), |
- IntRect(IntPoint(), corner_resizer_size)); |
- context.Restore(); |
+ IntPoint start_pt( |
+ resizer_corner_rect.X() + 1, |
+ resizer_corner_rect.Y() + resizer_corner_rect.Height() / 2); |
+ IntPoint end_pt(resizer_corner_rect.X() + resizer_corner_rect.Width() - |
+ resizer_corner_rect.Width() / 2, |
Stephen Chennney
2017/04/25 20:55:28
While this seems like a roundabout way to do it, i
|
+ resizer_corner_rect.Y() + resizer_corner_rect.Height() - 1); |
+ paint_resizer_line(start_pt, end_pt, true); |
+ |
+ start_pt.SetY(resizer_corner_rect.Y() + |
+ resizer_corner_rect.Height() * 3 / 4); |
+ end_pt.SetX(resizer_corner_rect.X() + resizer_corner_rect.Width() - |
+ resizer_corner_rect.Width() * 3 / 4); |
Stephen Chennney
2017/04/25 20:55:28
Ditto.
|
+ paint_resizer_line(start_pt, end_pt, true); |
return; |
} |
f(malita)
2017/04/26 17:56:34
I'm thinking we can merge part of these branches,
|
- IntRect image_rect(resizer_corner_rect.MaxXMaxYCorner() - corner_resizer_size, |
- corner_resizer_size); |
- context.DrawImage(resize_corner_image.Get(), image_rect); |
+ |
+ IntPoint start_pt(resizer_corner_rect.X() + resizer_corner_rect.Width() - 1, |
+ resizer_corner_rect.Y() + resizer_corner_rect.Height() / 2); |
+ IntPoint end_pt(resizer_corner_rect.X() + resizer_corner_rect.Width() / 2, |
+ resizer_corner_rect.Y() + resizer_corner_rect.Height() - 1); |
+ paint_resizer_line(start_pt, end_pt, false); |
+ |
+ start_pt.SetY(resizer_corner_rect.Y() + resizer_corner_rect.Height() * 3 / 4); |
+ end_pt.SetX(resizer_corner_rect.X() + resizer_corner_rect.Width() * 3 / 4); |
+ paint_resizer_line(start_pt, end_pt, false); |
} |
void ScrollableAreaPainter::PaintOverflowControls( |