| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_tree_data.h" | 5 #include "ui/accessibility/ax_tree_data.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| 11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 | 13 |
| 14 using base::DoubleToString; | 14 using base::DoubleToString; |
| 15 using base::IntToString; | 15 using base::IntToString; |
| 16 | 16 |
| 17 namespace ui { | 17 namespace ui { |
| 18 | 18 |
| 19 AXTreeData::AXTreeData() | 19 AXTreeData::AXTreeData() |
| 20 : tree_id(-1), | 20 : tree_id(-1), |
| 21 parent_tree_id(-1), | 21 parent_tree_id(-1), |
| 22 loaded(false), | 22 loaded(false), |
| 23 loading_progress(0.0), | 23 loading_progress(0.0), |
| 24 focus_id(-1), |
| 24 sel_anchor_object_id(-1), | 25 sel_anchor_object_id(-1), |
| 25 sel_anchor_offset(-1), | 26 sel_anchor_offset(-1), |
| 26 sel_focus_object_id(-1), | 27 sel_focus_object_id(-1), |
| 27 sel_focus_offset(-1) { | 28 sel_focus_offset(-1) { |
| 28 } | 29 } |
| 29 | 30 |
| 30 AXTreeData::~AXTreeData() { | 31 AXTreeData::~AXTreeData() { |
| 31 } | 32 } |
| 32 | 33 |
| 33 // Note that this includes an initial space character if nonempty, but | 34 // Note that this includes an initial space character if nonempty, but |
| (...skipping 13 matching lines...) Expand all Loading... |
| 47 if (!mimetype.empty()) | 48 if (!mimetype.empty()) |
| 48 result += " mimetype=" + mimetype; | 49 result += " mimetype=" + mimetype; |
| 49 if (!doctype.empty()) | 50 if (!doctype.empty()) |
| 50 result += " doctype=" + doctype; | 51 result += " doctype=" + doctype; |
| 51 | 52 |
| 52 if (loaded) | 53 if (loaded) |
| 53 result += " loaded=true"; | 54 result += " loaded=true"; |
| 54 if (loading_progress != 0.0) | 55 if (loading_progress != 0.0) |
| 55 result += " loading_progress=" + DoubleToString(loading_progress); | 56 result += " loading_progress=" + DoubleToString(loading_progress); |
| 56 | 57 |
| 58 if (focus_id != -1) |
| 59 result += " focus_id=" + IntToString(focus_id); |
| 60 |
| 57 if (sel_anchor_object_id != -1) { | 61 if (sel_anchor_object_id != -1) { |
| 58 result += " sel_anchor_object_id=" + IntToString(sel_anchor_object_id); | 62 result += " sel_anchor_object_id=" + IntToString(sel_anchor_object_id); |
| 59 result += " sel_anchor_offset=" + IntToString(sel_anchor_offset); | 63 result += " sel_anchor_offset=" + IntToString(sel_anchor_offset); |
| 60 } | 64 } |
| 61 if (sel_focus_object_id != -1) { | 65 if (sel_focus_object_id != -1) { |
| 62 result += " sel_focus_object_id=" + IntToString(sel_focus_object_id); | 66 result += " sel_focus_object_id=" + IntToString(sel_focus_object_id); |
| 63 result += " sel_focus_offset=" + IntToString(sel_focus_offset); | 67 result += " sel_focus_offset=" + IntToString(sel_focus_offset); |
| 64 } | 68 } |
| 65 | 69 |
| 66 return result; | 70 return result; |
| 67 } | 71 } |
| 68 | 72 |
| 69 bool operator==(const AXTreeData& lhs, const AXTreeData& rhs) { | 73 bool operator==(const AXTreeData& lhs, const AXTreeData& rhs) { |
| 70 return (lhs.tree_id == rhs.tree_id && | 74 return (lhs.tree_id == rhs.tree_id && |
| 71 lhs.parent_tree_id == rhs.parent_tree_id && | 75 lhs.parent_tree_id == rhs.parent_tree_id && |
| 72 lhs.url == rhs.url && | 76 lhs.url == rhs.url && |
| 73 lhs.title == rhs.title && | 77 lhs.title == rhs.title && |
| 74 lhs.mimetype == rhs.mimetype && | 78 lhs.mimetype == rhs.mimetype && |
| 75 lhs.doctype == rhs.doctype && | 79 lhs.doctype == rhs.doctype && |
| 76 lhs.loaded == rhs.loaded && | 80 lhs.loaded == rhs.loaded && |
| 77 lhs.loading_progress == rhs.loading_progress && | 81 lhs.loading_progress == rhs.loading_progress && |
| 82 lhs.focus_id == rhs.focus_id && |
| 78 lhs.sel_anchor_object_id == rhs.sel_anchor_object_id && | 83 lhs.sel_anchor_object_id == rhs.sel_anchor_object_id && |
| 79 lhs.sel_anchor_offset == rhs.sel_anchor_offset && | 84 lhs.sel_anchor_offset == rhs.sel_anchor_offset && |
| 80 lhs.sel_focus_object_id == rhs.sel_focus_object_id && | 85 lhs.sel_focus_object_id == rhs.sel_focus_object_id && |
| 81 lhs.sel_focus_offset == rhs.sel_focus_offset); | 86 lhs.sel_focus_offset == rhs.sel_focus_offset); |
| 82 } | 87 } |
| 83 | 88 |
| 84 bool operator!=(const AXTreeData& lhs, const AXTreeData& rhs) { | 89 bool operator!=(const AXTreeData& lhs, const AXTreeData& rhs) { |
| 85 return !(lhs == rhs); | 90 return !(lhs == rhs); |
| 86 } | 91 } |
| 87 | 92 |
| 88 } // namespace ui | 93 } // namespace ui |
| OLD | NEW |