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

Unified Diff: ui/display/display_layout.cc

Issue 2661663002: Add DisplayPlacement/Layout mojoms + StructTraits. (Closed)
Patch Set: Fixes. 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
Index: ui/display/display_layout.cc
diff --git a/ui/display/display_layout.cc b/ui/display/display_layout.cc
index 9b5ee1763f6263991c161e9c4ab592b8a468c41f..d6d843f99a95103cf9b5926ea468d817e924d267 100644
--- a/ui/display/display_layout.cc
+++ b/ui/display/display_layout.cc
@@ -353,6 +353,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 && //
Daniel Erat 2017/02/01 23:06:37 what are all these empty trailing comments for?
kylechar 2017/02/02 14:40:48 Just to keep the statements one per line after run
Daniel Erat 2017/02/02 16:55:13 ah, i didn't know that one could do this (or that
kylechar 2017/02/02 21:17:18 On second though, for consistency with existing co
+ 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:
@@ -540,19 +552,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 {

Powered by Google App Engine
This is Rietveld 408576698