| 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" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 // Note that this includes an initial space character if nonempty, but | 36 // Note that this includes an initial space character if nonempty, but |
| 37 // that works fine because this is normally printed by AXTree::ToString. | 37 // that works fine because this is normally printed by AXTree::ToString. |
| 38 std::string AXTreeData::ToString() const { | 38 std::string AXTreeData::ToString() const { |
| 39 std::string result; | 39 std::string result; |
| 40 | 40 |
| 41 if (tree_id != -1) | 41 if (tree_id != -1) |
| 42 result += " tree_id=" + IntToString(tree_id); | 42 result += " tree_id=" + IntToString(tree_id); |
| 43 if (parent_tree_id != -1) | 43 if (parent_tree_id != -1) |
| 44 result += " parent_tree_id=" + IntToString(parent_tree_id); | 44 result += " parent_tree_id=" + IntToString(parent_tree_id); |
| 45 | 45 |
| 46 if (!doctype.empty()) |
| 47 result += " doctype=" + doctype; |
| 48 if (loaded) |
| 49 result += " loaded=true"; |
| 50 if (loading_progress != 0.0) |
| 51 result += " loading_progress=" + DoubleToString(loading_progress); |
| 52 if (!mimetype.empty()) |
| 53 result += " mimetype=" + mimetype; |
| 46 if (!url.empty()) | 54 if (!url.empty()) |
| 47 result += " url=" + url; | 55 result += " url=" + url; |
| 48 if (!title.empty()) | 56 if (!title.empty()) |
| 49 result += " title=" + title; | 57 result += " title=" + title; |
| 50 if (!mimetype.empty()) | |
| 51 result += " mimetype=" + mimetype; | |
| 52 if (!doctype.empty()) | |
| 53 result += " doctype=" + doctype; | |
| 54 | |
| 55 if (loaded) | |
| 56 result += " loaded=true"; | |
| 57 if (loading_progress != 0.0) | |
| 58 result += " loading_progress=" + DoubleToString(loading_progress); | |
| 59 | 58 |
| 60 if (focus_id != -1) | 59 if (focus_id != -1) |
| 61 result += " focus_id=" + IntToString(focus_id); | 60 result += " focus_id=" + IntToString(focus_id); |
| 62 | 61 |
| 63 if (sel_anchor_object_id != -1) { | 62 if (sel_anchor_object_id != -1) { |
| 64 result += " sel_anchor_object_id=" + IntToString(sel_anchor_object_id); | 63 result += " sel_anchor_object_id=" + IntToString(sel_anchor_object_id); |
| 65 result += " sel_anchor_offset=" + IntToString(sel_anchor_offset); | 64 result += " sel_anchor_offset=" + IntToString(sel_anchor_offset); |
| 66 } | 65 } |
| 67 if (sel_focus_object_id != -1) { | 66 if (sel_focus_object_id != -1) { |
| 68 result += " sel_focus_object_id=" + IntToString(sel_focus_object_id); | 67 result += " sel_focus_object_id=" + IntToString(sel_focus_object_id); |
| 69 result += " sel_focus_offset=" + IntToString(sel_focus_offset); | 68 result += " sel_focus_offset=" + IntToString(sel_focus_offset); |
| 70 } | 69 } |
| 71 | 70 |
| 72 return result; | 71 return result; |
| 73 } | 72 } |
| 74 | 73 |
| 75 bool operator==(const AXTreeData& lhs, const AXTreeData& rhs) { | 74 bool operator==(const AXTreeData& lhs, const AXTreeData& rhs) { |
| 76 return (lhs.tree_id == rhs.tree_id && | 75 return (lhs.tree_id == rhs.tree_id && |
| 77 lhs.parent_tree_id == rhs.parent_tree_id && | 76 lhs.parent_tree_id == rhs.parent_tree_id && |
| 78 lhs.url == rhs.url && | 77 lhs.doctype == rhs.doctype && lhs.loaded == rhs.loaded && |
| 79 lhs.title == rhs.title && | |
| 80 lhs.mimetype == rhs.mimetype && | |
| 81 lhs.doctype == rhs.doctype && | |
| 82 lhs.loaded == rhs.loaded && | |
| 83 lhs.loading_progress == rhs.loading_progress && | 78 lhs.loading_progress == rhs.loading_progress && |
| 84 lhs.focus_id == rhs.focus_id && | 79 lhs.mimetype == rhs.mimetype && lhs.title == rhs.title && |
| 80 lhs.url == rhs.url && lhs.focus_id == rhs.focus_id && |
| 85 lhs.sel_anchor_object_id == rhs.sel_anchor_object_id && | 81 lhs.sel_anchor_object_id == rhs.sel_anchor_object_id && |
| 86 lhs.sel_anchor_offset == rhs.sel_anchor_offset && | 82 lhs.sel_anchor_offset == rhs.sel_anchor_offset && |
| 87 lhs.sel_focus_object_id == rhs.sel_focus_object_id && | 83 lhs.sel_focus_object_id == rhs.sel_focus_object_id && |
| 88 lhs.sel_focus_offset == rhs.sel_focus_offset); | 84 lhs.sel_focus_offset == rhs.sel_focus_offset); |
| 89 } | 85 } |
| 90 | 86 |
| 91 bool operator!=(const AXTreeData& lhs, const AXTreeData& rhs) { | 87 bool operator!=(const AXTreeData& lhs, const AXTreeData& rhs) { |
| 92 return !(lhs == rhs); | 88 return !(lhs == rhs); |
| 93 } | 89 } |
| 94 | 90 |
| 95 } // namespace ui | 91 } // namespace ui |
| OLD | NEW |