| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <cmath> | 5 #include <cmath> |
| 6 | 6 |
| 7 #import "chrome/browser/ui/cocoa/location_bar/bubble_decoration.h" | 7 #import "chrome/browser/ui/cocoa/location_bar/bubble_decoration.h" |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 if (image_) { | 76 if (image_) { |
| 77 // Center the image vertically. | 77 // Center the image vertically. |
| 78 const NSSize image_size = [image_ size]; | 78 const NSSize image_size = [image_ size]; |
| 79 | 79 |
| 80 image_rect.origin.y += | 80 image_rect.origin.y += |
| 81 std::floor((NSHeight(image_rect) - image_size.height) / 2.0); | 81 std::floor((NSHeight(image_rect) - image_size.height) / 2.0); |
| 82 image_rect.origin.x += kLeftSidePadding; | 82 image_rect.origin.x += kLeftSidePadding; |
| 83 image_rect.size = image_size; | 83 image_rect.size = image_size; |
| 84 if (cocoa_l10n_util::ShouldDoExperimentalRTLLayout()) { | 84 if (cocoa_l10n_util::ShouldDoExperimentalRTLLayout()) { |
| 85 image_rect.origin.x = | 85 image_rect.origin.x = |
| 86 NSMaxX(frame) - NSWidth(image_rect) - NSMinX(image_rect); | 86 NSMaxX(frame) - NSWidth(image_rect) - kLeftSidePadding; |
| 87 } | 87 } |
| 88 } | 88 } |
| 89 return image_rect; | 89 return image_rect; |
| 90 } | 90 } |
| 91 | 91 |
| 92 NSColor* BubbleDecoration::GetDarkModeTextColor() { | 92 NSColor* BubbleDecoration::GetDarkModeTextColor() { |
| 93 return skia::SkColorToSRGBNSColor(kMaterialDarkModeTextColor); | 93 return skia::SkColorToSRGBNSColor(kMaterialDarkModeTextColor); |
| 94 } | 94 } |
| 95 | 95 |
| 96 CGFloat BubbleDecoration::GetWidthForSpace(CGFloat width) { | 96 CGFloat BubbleDecoration::GetWidthForSpace(CGFloat width) { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 [attributes_ setObject:text_color forKey:NSForegroundColorAttributeName]; | 196 [attributes_ setObject:text_color forKey:NSForegroundColorAttributeName]; |
| 197 } | 197 } |
| 198 | 198 |
| 199 void BubbleDecoration::SetFont(NSFont* font) { | 199 void BubbleDecoration::SetFont(NSFont* font) { |
| 200 [attributes_ setObject:font forKey:NSFontAttributeName]; | 200 [attributes_ setObject:font forKey:NSFontAttributeName]; |
| 201 } | 201 } |
| 202 | 202 |
| 203 void BubbleDecoration::SetRetinaBaselineOffset(CGFloat offset) { | 203 void BubbleDecoration::SetRetinaBaselineOffset(CGFloat offset) { |
| 204 retina_baseline_offset_ = offset; | 204 retina_baseline_offset_ = offset; |
| 205 } | 205 } |
| OLD | NEW |