Commit 915b46b7 authored by Randy Rossi's avatar Randy Rossi Committed by Commit Bot

Clip focus ring points to screen

The screen reader's focus rings have outsets around the bounding box
from the semantics tree info.  However, when the bounding box is for
a full screen item (like the background image, for example) the
focus ring becomes invisible because it renders outside the screen
area.  This CL clips the points to the screen's dimensions.

Bug: 1052121
Test: Local build display assistant with screen reader enabled
Change-Id: Icf4ad68f59c23e503bc3baf9ec7763e175095853
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2055668Reviewed-by: default avatarDaniel Nicoara <dnicoara@chromium.org>
Commit-Queue: Randy Rossi <rmrossi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#743110}
parent aec30aaa
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
#include "chromecast/graphics/accessibility/accessibility_focus_ring_layer.h" #include "chromecast/graphics/accessibility/accessibility_focus_ring_layer.h"
#include <algorithm>
#include "base/bind.h" #include "base/bind.h"
#include "third_party/skia/include/core/SkPaint.h" #include "third_party/skia/include/core/SkPaint.h"
#include "third_party/skia/include/core/SkPath.h" #include "third_party/skia/include/core/SkPath.h"
...@@ -111,6 +113,21 @@ void AccessibilityFocusRingLayer::Set(const AccessibilityFocusRing& ring) { ...@@ -111,6 +113,21 @@ void AccessibilityFocusRingLayer::Set(const AccessibilityFocusRing& ring) {
display::Screen::GetScreen()->GetDisplayMatching(bounds); display::Screen::GetScreen()->GetDisplayMatching(bounds);
::wm::ConvertRectFromScreen(root_window(), &bounds); ::wm::ConvertRectFromScreen(root_window(), &bounds);
CreateOrUpdateLayer(root_window(), "AccessibilityFocusRing", bounds); CreateOrUpdateLayer(root_window(), "AccessibilityFocusRing", bounds);
gfx::Rect wbounds = root_window()->bounds();
wbounds.Inset(inset / 2, inset / 2, inset / 2, inset / 2);
int top = wbounds.x();
int left = wbounds.y();
int bottom = top + wbounds.height();
int right = left + wbounds.width();
for (int i = 0; i < 36; i++) {
gfx::Point& p = ring_.points[i];
p.set_x(std::max(p.x(), left));
p.set_x(std::min(p.x(), right));
p.set_y(std::max(p.y(), top));
p.set_y(std::min(p.y(), bottom));
}
} }
void AccessibilityFocusRingLayer::OnPaintLayer( void AccessibilityFocusRingLayer::OnPaintLayer(
......
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