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

Unified Diff: ui/display/display_layout.cc

Issue 2661663002: Add DisplayPlacement/Layout mojoms + StructTraits. (Closed)
Patch Set: Remove empty comments. Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/display/display_layout.h ('k') | ui/display/mojo/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/display/display_layout.cc
diff --git a/ui/display/display_layout.cc b/ui/display/display_layout.cc
index 443ac8389ff4d98373771108adafd4c3f0b77f9d..fe514e134c47a099eda4c3105ec282234a689b7c 100644
--- a/ui/display/display_layout.cc
+++ b/ui/display/display_layout.cc
@@ -382,6 +382,18 @@ DisplayPlacement::DisplayPlacement(const DisplayPlacement& placement)
offset(placement.offset),
offset_reference(placement.offset_reference) {}
+bool DisplayPlacement::operator==(const DisplayPlacement& other) const {
+ return display_id == other.display_id &&
+ parent_display_id == other.parent_display_id &&
+ position == other.position &&
+ offset == other.offset &&
+ offset_reference == other.offset_reference;
+}
+
+bool DisplayPlacement::operator!=(const DisplayPlacement& other) const {
+ return !operator==(other);
+}
+
DisplayPlacement& DisplayPlacement::Swap() {
switch (position) {
case TOP:
@@ -569,19 +581,7 @@ std::unique_ptr<DisplayLayout> DisplayLayout::Copy() const {
}
bool DisplayLayout::HasSamePlacementList(const DisplayLayout& layout) const {
- if (placement_list.size() != layout.placement_list.size())
- return false;
- for (size_t index = 0; index < placement_list.size(); index++) {
- const DisplayPlacement& placement1 = placement_list[index];
- const DisplayPlacement& placement2 = layout.placement_list[index];
- if (placement1.position != placement2.position ||
- placement1.offset != placement2.offset ||
- placement1.display_id != placement2.display_id ||
- placement1.parent_display_id != placement2.parent_display_id) {
- return false;
- }
- }
- return true;
+ return placement_list == layout.placement_list;
}
std::string DisplayLayout::ToString() const {
« no previous file with comments | « ui/display/display_layout.h ('k') | ui/display/mojo/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698