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

Side by Side Diff: ui/accessibility/ax_relative_bounds.cc

Issue 2956053005: Keep track of fixed positioning in accessibility tree.
Patch Set: GetSimpleRelativeBounds, add failing test for fixed with transform Created 3 years, 5 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.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/accessibility/ax_relative_bounds.h" 5 #include "ui/accessibility/ax_relative_bounds.h"
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "ui/gfx/transform.h" 8 #include "ui/gfx/transform.h"
9 9
10 using base::IntToString; 10 using base::IntToString;
11 11
12 namespace ui { 12 namespace ui {
13 13
14 AXRelativeBounds::AXRelativeBounds() 14 AXRelativeBounds::AXRelativeBounds()
15 : offset_container_id(-1) { 15 : offset_container_id(-1), is_fixed_positioned(false) {}
16 }
17 16
18 AXRelativeBounds::~AXRelativeBounds() { 17 AXRelativeBounds::~AXRelativeBounds() {
19 } 18 }
20 19
21 AXRelativeBounds::AXRelativeBounds(const AXRelativeBounds& other) { 20 AXRelativeBounds::AXRelativeBounds(const AXRelativeBounds& other) {
22 offset_container_id = other.offset_container_id; 21 offset_container_id = other.offset_container_id;
23 bounds = other.bounds; 22 bounds = other.bounds;
24 if (other.transform) 23 if (other.transform)
25 transform.reset(new gfx::Transform(*other.transform)); 24 transform.reset(new gfx::Transform(*other.transform));
25 is_fixed_positioned = other.is_fixed_positioned;
26 } 26 }
27 27
28 AXRelativeBounds& AXRelativeBounds::operator=(AXRelativeBounds other) { 28 AXRelativeBounds& AXRelativeBounds::operator=(AXRelativeBounds other) {
29 offset_container_id = other.offset_container_id; 29 offset_container_id = other.offset_container_id;
30 bounds = other.bounds; 30 bounds = other.bounds;
31 if (other.transform) 31 if (other.transform)
32 transform.reset(new gfx::Transform(*other.transform)); 32 transform.reset(new gfx::Transform(*other.transform));
33 is_fixed_positioned = other.is_fixed_positioned;
33 return *this; 34 return *this;
34 } 35 }
35 36
36 bool AXRelativeBounds::operator==(const AXRelativeBounds& other) { 37 bool AXRelativeBounds::operator==(const AXRelativeBounds& other) {
37 if (offset_container_id != other.offset_container_id) 38 if (offset_container_id != other.offset_container_id)
38 return false; 39 return false;
39 if (bounds != other.bounds) 40 if (bounds != other.bounds)
40 return false; 41 return false;
42 if (is_fixed_positioned != other.is_fixed_positioned)
43 return false;
41 if (!transform && !other.transform) 44 if (!transform && !other.transform)
42 return true; 45 return true;
43 if ((transform && !other.transform) || (!transform && other.transform)) 46 if ((transform && !other.transform) || (!transform && other.transform))
44 return false; 47 return false;
45 return *transform == *other.transform; 48 return *transform == *other.transform;
46 } 49 }
47 50
48 bool AXRelativeBounds::operator!=(const AXRelativeBounds& other) { 51 bool AXRelativeBounds::operator!=(const AXRelativeBounds& other) {
49 return !operator==(other); 52 return !operator==(other);
50 } 53 }
51 54
52 std::string AXRelativeBounds::ToString() const { 55 std::string AXRelativeBounds::ToString() const {
53 std::string result; 56 std::string result;
54 57
55 if (offset_container_id != -1) 58 if (offset_container_id != -1)
56 result += "offset_container_id=" + IntToString(offset_container_id) + " "; 59 result += "offset_container_id=" + IntToString(offset_container_id) + " ";
57 60
58 result += "(" + IntToString(bounds.x()) + ", " + 61 result += "(" + IntToString(bounds.x()) + ", " +
59 IntToString(bounds.y()) + ")-(" + 62 IntToString(bounds.y()) + ")-(" +
60 IntToString(bounds.width()) + ", " + 63 IntToString(bounds.width()) + ", " +
61 IntToString(bounds.height()) + ")"; 64 IntToString(bounds.height()) + ")";
62 65
63 if (transform && !transform->IsIdentity()) 66 if (transform && !transform->IsIdentity())
64 result += " transform=" + transform->ToString(); 67 result += " transform=" + transform->ToString();
65 68
69 if (is_fixed_positioned)
70 result += " is_fixed_positioned";
71
66 return result; 72 return result;
67 } 73 }
68 74
69 } // namespace ui 75 } // namespace ui
OLDNEW
« no previous file with comments | « ui/accessibility/ax_relative_bounds.h ('k') | ui/accessibility/ax_tree.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698