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

Unified Diff: ui/accessibility/ax_relative_bounds.h

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_node_data.cc ('k') | ui/accessibility/ax_relative_bounds.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/accessibility/ax_relative_bounds.h
diff --git a/ui/accessibility/ax_relative_bounds.h b/ui/accessibility/ax_relative_bounds.h
new file mode 100644
index 0000000000000000000000000000000000000000..478275a9ebbca114d515c53b134d2f83293409a4
--- /dev/null
+++ b/ui/accessibility/ax_relative_bounds.h
@@ -0,0 +1,61 @@
+// 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.
+
+#ifndef UI_ACCESSIBILITY_AX_RELATIVE_BOUNDS_H_
+#define UI_ACCESSIBILITY_AX_RELATIVE_BOUNDS_H_
+
+#include <memory>
+
+#include "ui/accessibility/ax_export.h"
+#include "ui/gfx/geometry/rect_f.h"
+
+namespace gfx {
+class Transform;
+};
+
+namespace ui {
+
+// The relative bounding box of an AXNode.
+//
+// This is an efficient, compact, serializable representation of a node's
+// bounding box that requires minimal changes to the tree when layers are
+// moved or scrolled. Computing the absolute bounding box of a node requires
+// walking up the tree and applying node offsets and transforms until reaching
+// the top.
+//
+// If the offset container id is valid, the bounds are relative
+// to the node with that offset container id.
+//
+// Otherwise, for a node other than the root, the bounds are relative to
+// the root of the tree, and for the root of a tree, the bounds are relative
+// to its immediate containing node.
+struct AX_EXPORT AXRelativeBounds {
+ AXRelativeBounds();
+ virtual ~AXRelativeBounds();
+
+ AXRelativeBounds(const AXRelativeBounds& other);
+ AXRelativeBounds& operator=(AXRelativeBounds other);
+ bool operator!=(const AXRelativeBounds& other);
+ bool operator==(const AXRelativeBounds& other);
+
+ std::string ToString() const;
+
+ // The id of an ancestor node in the same AXTree that this object's
+ // bounding box is relative to, or -1 if there's no offset container.
+ int offset_container_id;
+
+ // The relative bounding box of this node.
+ gfx::RectF bounds;
+
+ // An additional transform to apply to position this object and its subtree.
+ // NOTE: this member is a std::unique_ptr because it's rare and gfx::Transform
+ // takes up a fair amount of space. The assignment operator and copy
+ // constructor both make a duplicate of the owned pointer, so it acts more
+ // like a member than a pointer.
+ std::unique_ptr<gfx::Transform> transform;
+};
+
+} // namespace ui
+
+#endif // UI_ACCESSIBILITY_AX_NODE_DATA_H_
« no previous file with comments | « ui/accessibility/ax_node_data.cc ('k') | ui/accessibility/ax_relative_bounds.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698