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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef UI_ACCESSIBILITY_AX_RELATIVE_BOUNDS_H_
6 #define UI_ACCESSIBILITY_AX_RELATIVE_BOUNDS_H_
7
8 #include <memory>
9
10 #include "ui/accessibility/ax_export.h"
11 #include "ui/gfx/geometry/rect_f.h"
12
13 namespace gfx {
14 class Transform;
15 };
16
17 namespace ui {
18
19 // The relative bounding box of an AXNode.
20 //
21 // This is an efficient, compact, serializable representation of a node's
22 // bounding box that requires minimal changes to the tree when layers are
23 // moved or scrolled. Computing the absolute bounding box of a node requires
24 // walking up the tree and applying node offsets and transforms until reaching
25 // the top.
26 //
27 // If the offset container id is valid, the bounds are relative
28 // to the node with that offset container id.
29 //
30 // Otherwise, for a node other than the root, the bounds are relative to
31 // the root of the tree, and for the root of a tree, the bounds are relative
32 // to its immediate containing node.
33 struct AX_EXPORT AXRelativeBounds {
34 AXRelativeBounds();
35 virtual ~AXRelativeBounds();
36
37 AXRelativeBounds(const AXRelativeBounds& other);
38 AXRelativeBounds& operator=(AXRelativeBounds other);
39 bool operator!=(const AXRelativeBounds& other);
40 bool operator==(const AXRelativeBounds& other);
41
42 std::string ToString() const;
43
44 // The id of an ancestor node in the same AXTree that this object's
45 // bounding box is relative to, or -1 if there's no offset container.
46 int offset_container_id;
47
48 // The relative bounding box of this node.
49 gfx::RectF bounds;
50
51 // An additional transform to apply to position this object and its subtree.
52 // NOTE: this member is a std::unique_ptr because it's rare and gfx::Transform
53 // takes up a fair amount of space. The assignment operator and copy
54 // constructor both make a duplicate of the owned pointer, so it acts more
55 // like a member than a pointer.
56 std::unique_ptr<gfx::Transform> transform;
57 };
58
59 } // namespace ui
60
61 #endif // UI_ACCESSIBILITY_AX_NODE_DATA_H_
OLDNEW
« 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