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

Unified Diff: chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm

Issue 1952893002: [Mac][Material Design] Fix BookmarkBubbleControllerTest.TestBubbleWindow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove test code, update comments. Created 4 years, 7 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 | « chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller_unittest.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm
diff --git a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm
index c27a489d8b2340f85c2e16bd8ed95371e06feb2d..2a0e7da4f0a41475947a6de4839279db5a3de3cb 100644
--- a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm
+++ b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm
@@ -36,7 +36,13 @@ const CGFloat kRightDecorationXOffset = 5.0;
// The amount of padding on either side reserved for drawing
// decorations. [Views has |kItemPadding| == 3.]
-const CGFloat kDecorationHorizontalPad = 3.0;
+CGFloat DecorationsHorizontalPad() {
+ const CGFloat kDecorationHorizontalPad = 3.0;
+ const CGFloat kMaterialDecorationHorizontalPad = 4.0;
+ return ui::MaterialDesignController::IsModeMaterial()
+ ? kMaterialDecorationHorizontalPad
+ : kDecorationHorizontalPad;
+}
const ui::NinePartImageIds kPopupBorderImageIds =
IMAGE_GRID(IDR_OMNIBOX_POPUP_BORDER_AND_SHADOW);
@@ -71,6 +77,7 @@ void CalculatePositionsHelper(
// The initial padding depends on whether the first visible decoration is
// a button or not.
bool is_first_visible_decoration = true;
+ const CGFloat kDecorationHorizontalPad = DecorationsHorizontalPad();
for (size_t i = 0; i < all_decorations.size(); ++i) {
if (all_decorations[i]->IsVisible()) {
@@ -272,6 +279,7 @@ size_t CalculatePositionsInFrame(
// Determine the left-most extent for the i-beam cursor.
CGFloat minX = NSMinX(textFrame);
+ const CGFloat kDecorationHorizontalPad = DecorationsHorizontalPad();
for (size_t index = left_count; index--; ) {
if (decorations[index]->AcceptsMousePress())
break;
@@ -430,6 +438,7 @@ size_t CalculatePositionsInFrame(
&decorations, &decorationFrames, &workingFrame);
// Draw the decorations.
+ const CGFloat kDecorationHorizontalPad = DecorationsHorizontalPad();
for (size_t i = 0; i < decorations.size(); ++i) {
if (decorations[i]) {
NSRect background_frame = NSInsetRect(
« no previous file with comments | « chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller_unittest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698