| OLD | NEW |
| (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_ |
| OLD | NEW |