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

Side by Side 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 unified diff | 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 »
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 #include "ui/accessibility/ax_relative_bounds.h"
6
7 #include "base/strings/string_number_conversions.h"
8 #include "ui/gfx/transform.h"
9
10 using base::IntToString;
11
12 namespace ui {
13
14 AXRelativeBounds::AXRelativeBounds()
15 : offset_container_id(-1) {
16 }
17
18 AXRelativeBounds::~AXRelativeBounds() {
19 }
20
21 AXRelativeBounds::AXRelativeBounds(const AXRelativeBounds& other) {
22 offset_container_id = other.offset_container_id;
23 bounds = other.bounds;
24 if (other.transform)
25 transform.reset(new gfx::Transform(*other.transform));
26 }
27
28 AXRelativeBounds& AXRelativeBounds::operator=(AXRelativeBounds other) {
29 offset_container_id = other.offset_container_id;
30 bounds = other.bounds;
31 if (other.transform)
32 transform.reset(new gfx::Transform(*other.transform));
33 return *this;
34 }
35
36 bool AXRelativeBounds::operator==(const AXRelativeBounds& other) {
37 if (offset_container_id != other.offset_container_id)
38 return false;
39 if (bounds != other.bounds)
40 return false;
41 if (!transform && !other.transform)
42 return true;
43 if ((transform && !other.transform) || (!transform && other.transform))
44 return false;
45 return *transform == *other.transform;
46 }
47
48 bool AXRelativeBounds::operator!=(const AXRelativeBounds& other) {
49 return !operator==(other);
50 }
51
52 std::string AXRelativeBounds::ToString() const {
53 std::string result;
54
55 if (offset_container_id != -1)
56 result += "offset_container_id=" + IntToString(offset_container_id) + " ";
57
58 result += "(" + IntToString(bounds.x()) + ", " +
59 IntToString(bounds.y()) + ")-(" +
60 IntToString(bounds.width()) + ", " +
61 IntToString(bounds.height()) + ")";
62
63 if (transform && !transform->IsIdentity())
64 result += " transform=" + transform->ToString();
65
66 return result;
67 }
68
69 } // namespace ui
OLDNEW
« 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