Commit 0b56f83f authored by Peter Boström's avatar Peter Boström Committed by Commit Bot

Remove InstallableInkDrop::GetHighlightPathForView

This is replaced with views::GetHighlightPath() which is used by the
other InkDrop and FocusRing.

Bug: chromium:931964, chromium:1007546
Change-Id: Id34c89f3a81edffc72d4ff7460882ebbda346368
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1836372
Auto-Submit: Peter Boström <pbos@chromium.org>
Commit-Queue: Collin Baker <collinbaker@chromium.org>
Reviewed-by: default avatarCollin Baker <collinbaker@chromium.org>
Cr-Commit-Position: refs/heads/master@{#702228}
parent 4da4858b
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "ui/gfx/skia_util.h" #include "ui/gfx/skia_util.h"
#include "ui/views/animation/compositor_animation_runner.h" #include "ui/views/animation/compositor_animation_runner.h"
#include "ui/views/animation/ink_drop_host_view.h" #include "ui/views/animation/ink_drop_host_view.h"
#include "ui/views/controls/focus_ring.h"
#include "ui/views/view.h" #include "ui/views/view.h"
#include "ui/views/view_class_properties.h" #include "ui/views/view_class_properties.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
...@@ -182,7 +183,7 @@ void InstallableInkDrop::OnPaintLayer(const ui::PaintContext& context) { ...@@ -182,7 +183,7 @@ void InstallableInkDrop::OnPaintLayer(const ui::PaintContext& context) {
ui::PaintRecorder paint_recorder(context, layer_->size()); ui::PaintRecorder paint_recorder(context, layer_->size());
gfx::Canvas* canvas = paint_recorder.canvas(); gfx::Canvas* canvas = paint_recorder.canvas();
canvas->ClipPath(GetHighlightPathForView(view_), true); canvas->ClipPath(GetHighlightPath(view_), true);
painter_.Paint(canvas, view_->size()); painter_.Paint(canvas, view_->size());
} }
...@@ -191,24 +192,6 @@ void InstallableInkDrop::OnDeviceScaleFactorChanged( ...@@ -191,24 +192,6 @@ void InstallableInkDrop::OnDeviceScaleFactorChanged(
float old_device_scale_factor, float old_device_scale_factor,
float new_device_scale_factor) {} float new_device_scale_factor) {}
// static
SkPath InstallableInkDrop::GetHighlightPathForView(const View* view) {
// Use the provided highlight path if there is one.
const SkPath* const path_property = view->GetProperty(kHighlightPathKey);
if (path_property)
return *path_property;
// Otherwise, construct a default path. This will be pill shaped, or circular
// when |view| is square.
SkPath path;
const float radius =
std::min(view->size().width(), view->size().height()) / 2.0f;
path.addRoundRect(gfx::RectToSkRect(view->GetLocalBounds()), radius, radius);
return path;
}
void InstallableInkDrop::SchedulePaint() { void InstallableInkDrop::SchedulePaint() {
layer_->SchedulePaint(gfx::Rect(layer_->size())); layer_->SchedulePaint(gfx::Rect(layer_->size()));
} }
......
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
#include "ui/views/view_observer.h" #include "ui/views/view_observer.h"
#include "ui/views/views_export.h" #include "ui/views/views_export.h"
class SkPath;
namespace gfx { namespace gfx {
class AnimationContainer; class AnimationContainer;
class Size; class Size;
...@@ -94,10 +92,6 @@ class VIEWS_EXPORT InstallableInkDrop : public InkDrop, ...@@ -94,10 +92,6 @@ class VIEWS_EXPORT InstallableInkDrop : public InkDrop,
void OnDeviceScaleFactorChanged(float old_device_scale_factor, void OnDeviceScaleFactorChanged(float old_device_scale_factor,
float new_device_scale_factor) override; float new_device_scale_factor) override;
// Gets the path that the ink drop fills in for the highlight. This uses
// |kHighlightPathKey| if provided but falls back to a pill-shaped path.
static SkPath GetHighlightPathForView(const View* view);
private: private:
void SchedulePaint(); void SchedulePaint();
void UpdateAnimatorHighlight(); void UpdateAnimatorHighlight();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment