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

Side by Side Diff: chrome/browser/ui/search/search_ui.cc

Issue 10832216: Clicks broken in NTP section of Search overlay (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/ui/search/search_ui.h" 5 #include "chrome/browser/ui/search/search_ui.h"
6 6
7 #include "ui/gfx/font.h" 7 #include "ui/gfx/font.h"
8 #include "ui/gfx/rect.h" 8 #include "ui/gfx/rect.h"
9 #include "ui/gfx/size.h" 9 #include "ui/gfx/size.h"
10 10
11 namespace chrome { 11 namespace chrome {
12 namespace search { 12 namespace search {
13 13
14 const SkColor kNTPBackgroundColor = SkColorSetRGB(0xF5, 0xF5, 0xF5); 14 const SkColor kNTPBackgroundColor = SkColorSetRGB(0xF5, 0xF5, 0xF5);
15 const SkColor kNTPPlaceholderTextColor = SkColorSetRGB(0xBB, 0xBB, 0xBB); 15 const SkColor kNTPPlaceholderTextColor = SkColorSetRGB(0xBB, 0xBB, 0xBB);
16 const SkColor kOmniboxBackgroundColor = 16 const SkColor kOmniboxBackgroundColor =
17 SkColorSetARGB(128, 255, 255, 255); 17 SkColorSetARGB(128, 255, 255, 255);
18 const SkColor kResultsSeparatorColor = SkColorSetRGB(226, 226, 226); 18 const SkColor kResultsSeparatorColor = SkColorSetRGB(226, 226, 226);
19 const SkColor kSearchBackgroundColor = SK_ColorWHITE; 19 const SkColor kSearchBackgroundColor = SK_ColorWHITE;
20 const SkColor kSuggestBackgroundColor = SkColorSetRGB(0xEF, 0xEF, 0xEF); 20 const SkColor kSuggestBackgroundColor = SkColorSetRGB(0xEF, 0xEF, 0xEF);
21 21
22 const int kNTPOmniboxFontSize = 18; 22 const int kNTPOmniboxFontSize = 18;
23 const int kNTPOmniboxHeight = 40; 23 const int kNTPOmniboxHeight = 40;
24 // See the comments in browser_defaults on kAutocompleteEditFontPixelSize. 24 // See the comments in browser_defaults on kAutocompleteEditFontPixelSize.
25 const int kOmniboxFontSize = 16; 25 const int kOmniboxFontSize = 16;
26 // Relative to top of ContentsContainer.
26 const int kOmniboxYPosition = 310; 27 const int kOmniboxYPosition = 310;
28 // Relative to top of WebView in search overlay.
29 const int kOmniboxYOffset = -50;
27 const int kSearchResultsHeight = 122; 30 const int kSearchResultsHeight = 122;
28 31
29 gfx::Rect GetNTPOmniboxBounds(const gfx::Size& web_contents_size) { 32 gfx::Rect GetNTPOmniboxBounds(const gfx::Size& web_contents_size) {
30 const double kNTPPageWidthRatio = 0.73f; 33 const double kNTPPageWidthRatio = 0.73f;
31 if (web_contents_size.IsEmpty()) 34 if (web_contents_size.IsEmpty())
32 return gfx::Rect(); 35 return gfx::Rect();
33 int width = static_cast<int>(kNTPPageWidthRatio * 36 int width = static_cast<int>(kNTPPageWidthRatio *
34 static_cast<double>(web_contents_size.width())); 37 static_cast<double>(web_contents_size.width()));
35 int x = (web_contents_size.width() - width) / 2; 38 int x = (web_contents_size.width() - width) / 2;
36 return gfx::Rect(x, kOmniboxYPosition, width, 0); 39 return gfx::Rect(x, kOmniboxYOffset, width, 0);
37 } 40 }
38 41
39 gfx::Font GetNTPOmniboxFont(const gfx::Font& font) { 42 gfx::Font GetNTPOmniboxFont(const gfx::Font& font) {
40 return font.DeriveFont(kNTPOmniboxFontSize - font.GetFontSize()); 43 return font.DeriveFont(kNTPOmniboxFontSize - font.GetFontSize());
41 } 44 }
42 45
43 int GetNTPOmniboxHeight(const gfx::Font& font) { 46 int GetNTPOmniboxHeight(const gfx::Font& font) {
44 return std::max(GetNTPOmniboxFont(font).GetHeight(), kNTPOmniboxHeight); 47 return std::max(GetNTPOmniboxFont(font).GetHeight(), kNTPOmniboxHeight);
45 } 48 }
46 49
47 } // namespace search 50 } // namespace search
48 } // namespace chrome 51 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698