Commit 1f735b2c authored by Dave Tapuska's avatar Dave Tapuska Committed by Commit Bot

Change Accessibility from using WebFloatRect to gfx::RectF.

Accessiblity can use gfx::RectF directly instead of using the
deprecated WebFloatRect.

Change-Id: I9ae67e219900bb4df7857a6d935280cc41966a0a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2431794
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811427}
parent ec950672
...@@ -3,13 +3,12 @@ ...@@ -3,13 +3,12 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "content/renderer/accessibility/blink_ax_action_target.h" #include "content/renderer/accessibility/blink_ax_action_target.h"
#include "third_party/blink/public/platform/web_float_rect.h"
#include "third_party/blink/public/platform/web_rect.h" #include "third_party/blink/public/platform/web_rect.h"
#include "third_party/blink/public/platform/web_string.h" #include "third_party/blink/public/platform/web_string.h"
#include "third_party/skia/include/core/SkMatrix44.h" #include "third_party/skia/include/core/SkMatrix44.h"
#include "ui/gfx/geometry/rect_conversions.h"
using blink::WebAXObject; using blink::WebAXObject;
using blink::WebFloatRect;
using blink::WebRect; using blink::WebRect;
namespace content { namespace content {
...@@ -61,11 +60,11 @@ bool BlinkAXActionTarget::Focus() const { ...@@ -61,11 +60,11 @@ bool BlinkAXActionTarget::Focus() const {
gfx::Rect BlinkAXActionTarget::GetRelativeBounds() const { gfx::Rect BlinkAXActionTarget::GetRelativeBounds() const {
blink::WebAXObject offset_container; blink::WebAXObject offset_container;
WebFloatRect bounds; gfx::RectF bounds;
SkMatrix44 container_transform; SkMatrix44 container_transform;
web_ax_object_.GetRelativeBounds(offset_container, bounds, web_ax_object_.GetRelativeBounds(offset_container, bounds,
container_transform); container_transform);
return gfx::Rect(bounds.x, bounds.y, bounds.width, bounds.height); return gfx::ToEnclosedRect(bounds);
} }
gfx::Point BlinkAXActionTarget::GetScrollOffset() const { gfx::Point BlinkAXActionTarget::GetScrollOffset() const {
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include "content/renderer/render_frame_impl.h" #include "content/renderer/render_frame_impl.h"
#include "content/renderer/render_frame_proxy.h" #include "content/renderer/render_frame_proxy.h"
#include "content/renderer/render_view_impl.h" #include "content/renderer/render_view_impl.h"
#include "third_party/blink/public/platform/web_float_rect.h"
#include "third_party/blink/public/platform/web_rect.h" #include "third_party/blink/public/platform/web_rect.h"
#include "third_party/blink/public/platform/web_size.h" #include "third_party/blink/public/platform/web_size.h"
#include "third_party/blink/public/platform/web_string.h" #include "third_party/blink/public/platform/web_string.h"
...@@ -56,7 +55,6 @@ using blink::WebAXObjectAttribute; ...@@ -56,7 +55,6 @@ using blink::WebAXObjectAttribute;
using blink::WebAXObjectVectorAttribute; using blink::WebAXObjectVectorAttribute;
using blink::WebDocument; using blink::WebDocument;
using blink::WebElement; using blink::WebElement;
using blink::WebFloatRect;
using blink::WebFrame; using blink::WebFrame;
using blink::WebLocalFrame; using blink::WebLocalFrame;
using blink::WebNode; using blink::WebNode;
...@@ -418,7 +416,7 @@ void BlinkAXTreeSource::PopulateAXRelativeBounds(WebAXObject obj, ...@@ -418,7 +416,7 @@ void BlinkAXTreeSource::PopulateAXRelativeBounds(WebAXObject obj,
ui::AXRelativeBounds* bounds, ui::AXRelativeBounds* bounds,
bool* clips_children) const { bool* clips_children) const {
WebAXObject offset_container; WebAXObject offset_container;
WebFloatRect bounds_in_container; gfx::RectF bounds_in_container;
SkMatrix44 web_container_transform; SkMatrix44 web_container_transform;
obj.GetRelativeBounds(offset_container, bounds_in_container, obj.GetRelativeBounds(offset_container, bounds_in_container,
web_container_transform, clips_children); web_container_transform, clips_children);
...@@ -1366,13 +1364,13 @@ void BlinkAXTreeSource::AddImageAnnotations(blink::WebAXObject& src, ...@@ -1366,13 +1364,13 @@ void BlinkAXTreeSource::AddImageAnnotations(blink::WebAXObject& src,
// Skip images that are too small to label. This also catches // Skip images that are too small to label. This also catches
// unloaded images where the size is unknown. // unloaded images where the size is unknown.
WebAXObject offset_container; WebAXObject offset_container;
WebFloatRect bounds; gfx::RectF bounds;
SkMatrix44 container_transform; SkMatrix44 container_transform;
bool clips_children = false; bool clips_children = false;
src.GetRelativeBounds(offset_container, bounds, container_transform, src.GetRelativeBounds(offset_container, bounds, container_transform,
&clips_children); &clips_children);
if (bounds.width < kMinImageAnnotationWidth || if (bounds.width() < kMinImageAnnotationWidth ||
bounds.height < kMinImageAnnotationHeight) { bounds.height() < kMinImageAnnotationHeight) {
dst->SetImageAnnotationStatus( dst->SetImageAnnotationStatus(
ax::mojom::ImageAnnotationStatus::kIneligibleForAnnotation); ax::mojom::ImageAnnotationStatus::kIneligibleForAnnotation);
return; return;
......
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
#include "services/metrics/public/cpp/mojo_ukm_recorder.h" #include "services/metrics/public/cpp/mojo_ukm_recorder.h"
#include "services/metrics/public/cpp/ukm_builders.h" #include "services/metrics/public/cpp/ukm_builders.h"
#include "third_party/blink/public/platform/task_type.h" #include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/public/platform/web_float_rect.h"
#include "third_party/blink/public/web/web_disallow_transition_scope.h" #include "third_party/blink/public/web/web_disallow_transition_scope.h"
#include "third_party/blink/public/web/web_document.h" #include "third_party/blink/public/web/web_document.h"
#include "third_party/blink/public/web/web_input_element.h" #include "third_party/blink/public/web/web_input_element.h"
...@@ -53,7 +52,6 @@ using blink::WebAXContext; ...@@ -53,7 +52,6 @@ using blink::WebAXContext;
using blink::WebAXObject; using blink::WebAXObject;
using blink::WebDocument; using blink::WebDocument;
using blink::WebElement; using blink::WebElement;
using blink::WebFloatRect;
using blink::WebLocalFrame; using blink::WebLocalFrame;
using blink::WebNode; using blink::WebNode;
using blink::WebRect; using blink::WebRect;
......
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h" #include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#include "third_party/blink/public/platform/web_float_rect.h"
#include "third_party/blink/public/platform/web_runtime_features.h" #include "third_party/blink/public/platform/web_runtime_features.h"
#include "third_party/blink/public/platform/web_size.h" #include "third_party/blink/public/platform/web_size.h"
#include "third_party/blink/public/web/web_ax_object.h" #include "third_party/blink/public/web/web_ax_object.h"
...@@ -1018,16 +1017,16 @@ TEST_F(BlinkAXActionTargetTest, TestMethods) { ...@@ -1018,16 +1017,16 @@ TEST_F(BlinkAXActionTargetTest, TestMethods) {
EXPECT_TRUE(input_range_action_target->Focus()); EXPECT_TRUE(input_range_action_target->Focus());
EXPECT_TRUE(input_range.IsFocused()); EXPECT_TRUE(input_range.IsFocused());
blink::WebFloatRect expected_bounds; gfx::RectF expected_bounds;
blink::WebAXObject offset_container; blink::WebAXObject offset_container;
SkMatrix44 container_transform; SkMatrix44 container_transform;
input_checkbox.GetRelativeBounds(offset_container, expected_bounds, input_checkbox.GetRelativeBounds(offset_container, expected_bounds,
container_transform); container_transform);
gfx::Rect actual_bounds = input_checkbox_action_target->GetRelativeBounds(); gfx::Rect actual_bounds = input_checkbox_action_target->GetRelativeBounds();
EXPECT_EQ(static_cast<int>(expected_bounds.x), actual_bounds.x()); EXPECT_EQ(static_cast<int>(expected_bounds.x()), actual_bounds.x());
EXPECT_EQ(static_cast<int>(expected_bounds.y), actual_bounds.y()); EXPECT_EQ(static_cast<int>(expected_bounds.y()), actual_bounds.y());
EXPECT_EQ(static_cast<int>(expected_bounds.width), actual_bounds.width()); EXPECT_EQ(static_cast<int>(expected_bounds.width()), actual_bounds.width());
EXPECT_EQ(static_cast<int>(expected_bounds.height), actual_bounds.height()); EXPECT_EQ(static_cast<int>(expected_bounds.height()), actual_bounds.height());
gfx::Point offset_to_set(500, 500); gfx::Point offset_to_set(500, 500);
scroller_action_target->SetScrollOffset(gfx::Point(500, 500)); scroller_action_target->SetScrollOffset(gfx::Point(500, 500));
......
...@@ -44,6 +44,7 @@ class SkMatrix44; ...@@ -44,6 +44,7 @@ class SkMatrix44;
namespace gfx { namespace gfx {
class Point; class Point;
class RectF;
} }
namespace ui { namespace ui {
...@@ -58,7 +59,6 @@ class WebNode; ...@@ -58,7 +59,6 @@ class WebNode;
class WebDocument; class WebDocument;
class WebString; class WebString;
class WebURL; class WebURL;
struct WebFloatRect;
struct WebRect; struct WebRect;
struct WebSize; struct WebSize;
...@@ -397,7 +397,7 @@ class WebAXObject { ...@@ -397,7 +397,7 @@ class WebAXObject {
// If the container clips its children, for example with overflow:hidden // If the container clips its children, for example with overflow:hidden
// or similar, set |clips_children| to true. // or similar, set |clips_children| to true.
BLINK_EXPORT void GetRelativeBounds(WebAXObject& offset_container, BLINK_EXPORT void GetRelativeBounds(WebAXObject& offset_container,
WebFloatRect& bounds_in_container, gfx::RectF& bounds_in_container,
SkMatrix44& container_transform, SkMatrix44& container_transform,
bool* clips_children = nullptr) const; bool* clips_children = nullptr) const;
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include "third_party/blink/public/web/web_ax_object.h" #include "third_party/blink/public/web/web_ax_object.h"
#include "third_party/blink/public/platform/web_float_rect.h"
#include "third_party/blink/public/platform/web_rect.h" #include "third_party/blink/public/platform/web_rect.h"
#include "third_party/blink/public/platform/web_string.h" #include "third_party/blink/public/platform/web_string.h"
#include "third_party/blink/public/platform/web_url.h" #include "third_party/blink/public/platform/web_url.h"
...@@ -1504,7 +1503,7 @@ void WebAXObject::Dropeffects( ...@@ -1504,7 +1503,7 @@ void WebAXObject::Dropeffects(
} }
void WebAXObject::GetRelativeBounds(WebAXObject& offset_container, void WebAXObject::GetRelativeBounds(WebAXObject& offset_container,
WebFloatRect& bounds_in_container, gfx::RectF& bounds_in_container,
SkMatrix44& container_transform, SkMatrix44& container_transform,
bool* clips_children) const { bool* clips_children) const {
if (IsDetached()) if (IsDetached())
...@@ -1519,7 +1518,7 @@ void WebAXObject::GetRelativeBounds(WebAXObject& offset_container, ...@@ -1519,7 +1518,7 @@ void WebAXObject::GetRelativeBounds(WebAXObject& offset_container,
private_->GetRelativeBounds(&container, bounds, container_transform, private_->GetRelativeBounds(&container, bounds, container_transform,
clips_children); clips_children);
offset_container = WebAXObject(container); offset_container = WebAXObject(container);
bounds_in_container = WebFloatRect(bounds); bounds_in_container = gfx::RectF(bounds);
} }
void WebAXObject::GetAllObjectsWithChangedBounds( void WebAXObject::GetAllObjectsWithChangedBounds(
......
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