Index: ui/views/window/dialog_client_view.cc |
diff --git a/ui/views/window/dialog_client_view.cc b/ui/views/window/dialog_client_view.cc |
index 5d543a7572efe2b85b8772f293c766cbdb19430f..62dad8b4dfa1cc14c356c7ad3e5b23369bb5f828 100644 |
--- a/ui/views/window/dialog_client_view.cc |
+++ b/ui/views/window/dialog_client_view.cc |
@@ -41,12 +41,22 @@ bool ShouldShow(View* view) { |
return view && view->visible(); |
} |
+// Snaps the width of |size| up to the next multiple of |unit|. |
+gfx::Size SnapWidthToMultipleOf(gfx::Size size, int unit) { |
+ size.Enlarge(unit - 1, 0); |
tapted
2017/03/15 22:26:11
I find it a bit weird to manipulate the size in al
Peter Kasting
2017/03/21 19:17:03
FWIW, always manipulating reads OK to me, but in m
|
+ size.set_width(size.width() - (size.width() % unit)); |
+ return size; |
+} |
+ |
// Returns the bounding box required to contain |size1| and |size2|, placed one |
// atop the other. |
Peter Kasting
2017/03/21 19:17:03
I wonder if this function is the wrong place to im
|
gfx::Size GetBoundingSizeForVerticalStack(const gfx::Size& size1, |
tapted
2017/03/15 22:26:11
rename -> GetSnappedBoundingSize?
|
const gfx::Size& size2) { |
- return gfx::Size(std::max(size1.width(), size2.width()), |
- size1.height() + size2.height()); |
+ return SnapWidthToMultipleOf( |
+ gfx::Size(std::max(size1.width(), size2.width()), |
+ size1.height() + size2.height()), |
+ ViewsDelegate::GetInstance()->GetDistanceMetric( |
+ views::DistanceMetric::DIALOG_WIDTH_SNAPPING_UNIT)); |
tapted
2017/03/15 22:26:11
This is the ClientView - I think we need to take i
|
} |
} // namespace |