Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Unified Diff: ui/accessibility/ax_relative_bounds.cc

Issue 2217363002: Use relative bounding boxes throughout Chrome accessibility (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback from aboxhall Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/accessibility/ax_relative_bounds.h ('k') | ui/accessibility/ax_tree_combiner.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/accessibility/ax_relative_bounds.cc
diff --git a/ui/accessibility/ax_relative_bounds.cc b/ui/accessibility/ax_relative_bounds.cc
new file mode 100644
index 0000000000000000000000000000000000000000..322a0680fc3e3d64eca1c77725be61fdf56e508a
--- /dev/null
+++ b/ui/accessibility/ax_relative_bounds.cc
@@ -0,0 +1,69 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/accessibility/ax_relative_bounds.h"
+
+#include "base/strings/string_number_conversions.h"
+#include "ui/gfx/transform.h"
+
+using base::IntToString;
+
+namespace ui {
+
+AXRelativeBounds::AXRelativeBounds()
+ : offset_container_id(-1) {
+}
+
+AXRelativeBounds::~AXRelativeBounds() {
+}
+
+AXRelativeBounds::AXRelativeBounds(const AXRelativeBounds& other) {
+ offset_container_id = other.offset_container_id;
+ bounds = other.bounds;
+ if (other.transform)
+ transform.reset(new gfx::Transform(*other.transform));
+}
+
+AXRelativeBounds& AXRelativeBounds::operator=(AXRelativeBounds other) {
+ offset_container_id = other.offset_container_id;
+ bounds = other.bounds;
+ if (other.transform)
+ transform.reset(new gfx::Transform(*other.transform));
+ return *this;
+}
+
+bool AXRelativeBounds::operator==(const AXRelativeBounds& other) {
+ if (offset_container_id != other.offset_container_id)
+ return false;
+ if (bounds != other.bounds)
+ return false;
+ if (!transform && !other.transform)
+ return true;
+ if ((transform && !other.transform) || (!transform && other.transform))
+ return false;
+ return *transform == *other.transform;
+}
+
+bool AXRelativeBounds::operator!=(const AXRelativeBounds& other) {
+ return !operator==(other);
+}
+
+std::string AXRelativeBounds::ToString() const {
+ std::string result;
+
+ if (offset_container_id != -1)
+ result += "offset_container_id=" + IntToString(offset_container_id) + " ";
+
+ result += "(" + IntToString(bounds.x()) + ", " +
+ IntToString(bounds.y()) + ")-(" +
+ IntToString(bounds.width()) + ", " +
+ IntToString(bounds.height()) + ")";
+
+ if (transform && !transform->IsIdentity())
+ result += " transform=" + transform->ToString();
+
+ return result;
+}
+
+} // namespace ui
« no previous file with comments | « ui/accessibility/ax_relative_bounds.h ('k') | ui/accessibility/ax_tree_combiner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698