Commit d214b84e authored by Anastasia Helfinstein's avatar Anastasia Helfinstein Committed by Chromium LUCI CQ

[Switch Access] Update preview focus ring style

Per the bug filed by our UX designer, update the preview focus ring to
have a solid inner ring, and a dashed outer ring with 4dip dashes and
2dip gaps.

Since Switch Access is the only application of the DASHED focus ring
style currently, I modified that style directly, rather than creating
another new style.

Bug: 1152610
Change-Id: If61810ed594e7f388a8cbf71aaa41a44c2ed3cb6
AX-Relnotes: Dashed focus ring in Switch Access now has a different style.
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2622757Reviewed-by: default avatarDavid Tseng <dtseng@chromium.org>
Commit-Queue: Anastasia Helfinstein <anastasi@google.com>
Cr-Commit-Position: refs/heads/master@{#842610}
parent bb0aa8c8
......@@ -23,8 +23,8 @@ namespace {
// transparent.
constexpr int kGradientWidth = 6;
constexpr int kDefaultStrokeWidth = 2;
constexpr float kDashLengthDip = 3.f;
constexpr float kGapLengthDip = 5.f;
constexpr float kDashLengthDip = 4.f;
constexpr float kGapLengthDip = 2.f;
int sign(int x) {
return ((x > 0) ? 1 : (x == 0) ? 0 : -1);
......@@ -182,23 +182,20 @@ void AccessibilityFocusRingLayer::DrawDashedFocusRing(
SkPath path;
gfx::Vector2d offset = layer()->bounds().OffsetFromOrigin();
flags.setColor(custom_color());
flags.setStrokeWidth(kDefaultStrokeWidth);
path = MakePath(ring_, 0, offset);
recorder.canvas()->DrawPath(path, flags);
SkScalar intervals[] = {kDashLengthDip, kGapLengthDip};
int intervals_length = 2;
flags.setPathEffect(SkDashPathEffect::Make(intervals, intervals_length, 0));
// To keep the dashes properly lined up, we will draw the outside line first,
// and cover it with the inner line.
flags.setColor(secondary_color_);
flags.setStrokeWidth(3 * kDefaultStrokeWidth);
path = MakePath(ring_, 0, offset);
path = MakePath(ring_, kDefaultStrokeWidth, offset);
recorder.canvas()->DrawPath(path, flags);
flags.setColor(custom_color());
flags.setStrokeWidth(kDefaultStrokeWidth);
path = MakePath(ring_, 0, offset);
recorder.canvas()->DrawPath(path, flags);
}
void AccessibilityFocusRingLayer::DrawGlowFocusRing(ui::PaintRecorder& recorder,
......
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