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

Unified Diff: chrome/browser/ui/views/find_bar_view.cc

Issue 2968713003: Harmonize the find in page dialog. (Closed)
Patch Set: Set margins on the controls in the find bar. Experimental Created 3 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/find_bar_view.cc
diff --git a/chrome/browser/ui/views/find_bar_view.cc b/chrome/browser/ui/views/find_bar_view.cc
index 49627d798f76cf6dbe42eead2924251379554333..3f9deebb919d892397a37cf5998f64ae6d026c19 100644
--- a/chrome/browser/ui/views/find_bar_view.cc
+++ b/chrome/browser/ui/views/find_bar_view.cc
@@ -21,6 +21,7 @@
#include "chrome/browser/ui/view_ids.h"
#include "chrome/browser/ui/views/find_bar_host.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
+#include "chrome/browser/ui/views/harmony/chrome_layout_provider.h"
#include "chrome/grit/generated_resources.h"
#include "components/strings/grit/components_strings.h"
#include "ui/base/ime/input_method.h"
@@ -42,20 +43,12 @@
#include "ui/views/controls/separator.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/painter.h"
+#include "ui/views/view_properties.h"
#include "ui/views/view_targeter.h"
#include "ui/views/widget/widget.h"
namespace {
-// These layout constants are all in dp.
-// The horizontal and vertical insets for the bar.
-const int kInteriorPadding = 8;
-// Default spacing between child views.
-const int kInterChildSpacing = 4;
-// Additional spacing around the separator.
-const int kSeparatorLeftSpacing = 12 - kInterChildSpacing;
-const int kSeparatorRightSpacing = 8 - kInterChildSpacing;
-
// The default number of average characters that the text box will be.
const int kDefaultCharWidth = 30;
@@ -161,15 +154,24 @@ FindBarView::FindBarView(FindBarHost* host)
base::MakeUnique<views::ViewTargeter>(this));
AddChildViewAt(match_count_text_, 1);
- separator_->SetBorder(views::CreateEmptyBorder(0, kSeparatorLeftSpacing, 0,
- kSeparatorRightSpacing));
AddChildViewAt(separator_, 2);
+ find_text_->SetProperty(views::kMarginsKey, new gfx::Insets(12, 0));
Peter Kasting 2017/07/10 20:13:08 I think you want 8 here since this is a textfield
ananta 2017/07/12 19:19:48 The mocks are a touch confusing. They show the ins
Peter Kasting 2017/07/12 20:33:01 I'm not sure what's confusing. Use 12 pt margins
ananta 2017/07/13 04:04:34 It looks like 12 pt is not a harmony unit?. Some a
Peter Kasting 2017/07/13 04:11:24 Not everything in Harmony is 16s.
+ match_count_text_->SetProperty(views::kMarginsKey,
Peter Kasting 2017/07/10 20:13:08 Whereas this is a label, so you'd want 12.
ananta 2017/07/12 19:19:48 Not needed anymore.
+ new gfx::Insets(8, 0));
+ separator_->SetProperty(views::kMarginsKey, new gfx::Insets(8, 16, 8, 16));
Peter Kasting 2017/07/10 20:13:08 Don't add horizontal margins here.
ananta 2017/07/12 19:19:48 We need the horizontal margins for the separator t
Peter Kasting 2017/07/12 20:33:01 Your separator has 2x too much space with these (a
ananta 2017/07/13 04:04:34 If we don't specify the margin on both sides of th
Peter Kasting 2017/07/13 04:11:24 As long as non-Harmony isn't completely broken, we
ananta 2017/07/13 04:44:43 ok. thanks. I updated the patchset with distance m
+ find_previous_button_->SetProperty(views::kMarginsKey, new gfx::Insets(8, 0));
+ find_next_button_->SetProperty(views::kMarginsKey, new gfx::Insets(8, 0));
+ close_button_->SetProperty(views::kMarginsKey, new gfx::Insets(8, 0));
+
find_text_->SetBorder(views::NullBorder());
views::BoxLayout* manager =
new views::BoxLayout(views::BoxLayout::kHorizontal,
- gfx::Insets(kInteriorPadding), kInterChildSpacing);
+ gfx::Insets(0, 16),
+ ChromeLayoutProvider::Get()->GetDistanceMetric(
+ views::DISTANCE_RELATED_CONTROL_HORIZONTAL));
+
SetLayoutManager(manager);
manager->SetFlexForView(find_text_, 1);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698