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

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

Issue 2077743005: [Mac][Material Design] Adjust (i) and lock Omnibox icons. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes for non-Retina. Created 4 years, 6 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: chrome/browser/ui/cocoa/location_bar/bubble_decoration.mm
diff --git a/chrome/browser/ui/cocoa/location_bar/bubble_decoration.mm b/chrome/browser/ui/cocoa/location_bar/bubble_decoration.mm
index e7fe5ee08139e2a5677b96b09af5c2a037611f10..b993bf9690af31dc74c096b688f0a909a15d9b84 100644
--- a/chrome/browser/ui/cocoa/location_bar/bubble_decoration.mm
+++ b/chrome/browser/ui/cocoa/location_bar/bubble_decoration.mm
@@ -12,6 +12,7 @@
#include "skia/ext/skia_utils_mac.h"
#import "ui/base/cocoa/nsview_additions.h"
#include "ui/base/material_design/material_design_controller.h"
+#include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h"
namespace {
@@ -132,8 +133,15 @@ void BubbleDecoration::DrawInFrame(NSRect frame, NSView* control_view) {
if (label_) {
NSRect textRect = frame;
textRect.origin.x = textOffset;
- textRect.origin.y += baseline_offset_;
textRect.size.width = NSMaxX(decoration_frame) - NSMinX(textRect);
+ // Transform the coordinate system to adjust the baseline. This is the only
+ // way to get fractional adjustments.
+ gfx::ScopedNSGraphicsContextSaveGState saveGraphicsState;
+ if (baseline_offset_) {
tapted 2016/06/22 05:40:38 Nothing currently calls SetBaselineOffset -- you c
shrike 2016/06/22 21:44:50 Acknowledged.
+ NSAffineTransform* transform = [NSAffineTransform transform];
+ [transform translateXBy:0 yBy:baseline_offset_];
+ [transform concat];
+ }
DrawLabel(label_, attributes_, textRect);
}
}

Powered by Google App Engine
This is Rietveld 408576698