Chromium Code Reviews| 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 c3f190231f8d328e44d5b30fcabc94565bab9a0c..763881606e899fe7d63893b4cb8e979799c3c679 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 |
| @@ -33,28 +33,17 @@ |
| // bounds. |
| const CGFloat kRightDecorationXOffset = 5.0; |
| CGFloat LeftDecorationXOffset() { |
| - const CGFloat kLeftDecorationXOffset = 5.0; |
| - const CGFloat kLeftMaterialDecorationXOffset = 6.0; |
| - return ui::MaterialDesignController::IsModeMaterial() |
| - ? kLeftMaterialDecorationXOffset |
| - : kLeftDecorationXOffset; |
| + const CGFloat kLeftDecorationXOffset = 6.0; |
| + return kLeftDecorationXOffset; |
| } |
|
Avi (use Gerrit)
2016/09/28 16:01:57
Put this back to being a "const CGFloat" like line
Elly Fong-Jones
2016/09/28 19:02:27
Done.
|
| // The amount of padding on either side reserved for drawing |
| // decorations. [Views has |kItemPadding| == 3.] |
| CGFloat DecorationsHorizontalPad() { |
| - const CGFloat kDecorationHorizontalPad = 3.0; |
| - const CGFloat kMaterialDecorationHorizontalPad = 4.0; |
| - return ui::MaterialDesignController::IsModeMaterial() |
| - ? kMaterialDecorationHorizontalPad |
| - : kDecorationHorizontalPad; |
| + const CGFloat kDecorationHorizontalPad = 4.0; |
| + return kDecorationHorizontalPad; |
|
Avi (use Gerrit)
2016/09/28 16:01:58
ditto
Elly Fong-Jones
2016/09/28 19:02:27
Done.
|
| } |
| -const ui::NinePartImageIds kPopupBorderImageIds = |
| - IMAGE_GRID(IDR_OMNIBOX_POPUP_BORDER_AND_SHADOW); |
| - |
| -const ui::NinePartImageIds kNormalBorderImageIds = IMAGE_GRID(IDR_TEXTFIELD); |
| - |
| // How long to wait for mouse-up on the location icon before assuming |
| // that the user wants to drag. |
| const NSTimeInterval kLocationIconDragTimeout = 0.25; |
| @@ -263,11 +252,9 @@ - (NSRect)textFrameForFrame:(NSRect)cellFrame { |
| // after computing decoration positions because the decorations are already |
| // correctly positioned. The spec also calls for positioning the text 1pt to |
| // the right of its default position. |
| - if (ui::MaterialDesignController::IsModeMaterial()) { |
| - textFrame.origin.x += 1; |
| - textFrame.size.width -= 1; |
| - textFrame.origin.y -= singlePixelLineWidth_; |
| - } |
| + textFrame.origin.x += 1; |
| + textFrame.size.width -= 1; |
| + textFrame.origin.y -= singlePixelLineWidth_; |
| // NOTE: This function must closely match the logic in |
| // |-drawInteriorWithFrame:inView:|. |
| @@ -317,16 +304,13 @@ - (NSRect)textCursorFrameForFrame:(NSRect)cellFrame { |
| } |
| - (void)drawWithFrame:(NSRect)frame inView:(NSView*)controlView { |
| - BOOL isModeMaterial = ui::MaterialDesignController::IsModeMaterial(); |
| BOOL inDarkMode = [[controlView window] inIncognitoModeWithSystemTheme]; |
| BOOL showingFirstResponder = [self showsFirstResponder]; |
| // Adjust the inset by 1/2 the line width to get a crisp line (screen pixels |
| // lay between cooridnate space lines). |
| CGFloat insetSize = 1 - singlePixelLineWidth_ / 2.; |
| - if (isModeMaterial && showingFirstResponder && !inDarkMode) { |
| + if (showingFirstResponder && !inDarkMode) { |
| insetSize++; |
| - } else if (!isModeMaterial) { |
| - insetSize = singlePixelLineWidth_ == 0.5 ? 1.5 : 2.0; |
| } |
| // Compute the border's bezier path. |
| @@ -335,10 +319,8 @@ - (void)drawWithFrame:(NSRect)frame inView:(NSView*)controlView { |
| [NSBezierPath bezierPathWithRoundedRect:pathRect |
| xRadius:kCornerRadius |
| yRadius:kCornerRadius]; |
| - if (isModeMaterial) { |
| - [path setLineWidth:showingFirstResponder ? singlePixelLineWidth_ * 2 |
| - : singlePixelLineWidth_]; |
| - } |
| + [path setLineWidth:showingFirstResponder ? singlePixelLineWidth_ * 2 |
| + : singlePixelLineWidth_]; |
| // Fill the background. |
| [[self backgroundColor] set]; |
| @@ -349,23 +331,14 @@ - (void)drawWithFrame:(NSRect)frame inView:(NSView*)controlView { |
| } |
| // Draw the border. |
| - if (isModeMaterial) { |
| - if (!inDarkMode) { |
| - const CGFloat kNormalStrokeGray = 168 / 255.; |
| - [[NSColor colorWithCalibratedWhite:kNormalStrokeGray alpha:1] set]; |
| - } else { |
| - const CGFloat k30PercentAlpha = 0.3; |
| - [[NSColor colorWithCalibratedWhite:0 alpha:k30PercentAlpha] set]; |
| - } |
| - [path stroke]; |
| + if (!inDarkMode) { |
| + const CGFloat kNormalStrokeGray = 168 / 255.; |
| + [[NSColor colorWithCalibratedWhite:kNormalStrokeGray alpha:1] set]; |
| } else { |
| - ui::DrawNinePartImage(frame, |
| - isPopupMode_ ? kPopupBorderImageIds |
| - : kNormalBorderImageIds, |
| - NSCompositeSourceOver, |
| - 1.0, |
| - true); |
| + const CGFloat k30PercentAlpha = 0.3; |
| + [[NSColor colorWithCalibratedWhite:0 alpha:k30PercentAlpha] set]; |
| } |
| + [path stroke]; |
| // Draw the interior contents. We do this after drawing the border as some |
| // of the interior controls draw over it. |
| @@ -373,17 +346,8 @@ - (void)drawWithFrame:(NSRect)frame inView:(NSView*)controlView { |
| // Draw the focus ring. |
| if (showingFirstResponder) { |
| - if (!isModeMaterial) { |
| - NSRect focusRingRect = |
| - NSInsetRect(frame, singlePixelLineWidth_, singlePixelLineWidth_); |
| - path = [NSBezierPath bezierPathWithRoundedRect:focusRingRect |
| - xRadius:kCornerRadius |
| - yRadius:kCornerRadius]; |
| - [path setLineWidth:singlePixelLineWidth_ * 2.0]; |
| - } |
| - |
| CGFloat alphaComponent = 0.5 / singlePixelLineWidth_; |
| - if (isModeMaterial && inDarkMode) { |
| + if (inDarkMode) { |
| // Special focus color for Material Incognito. |
| [[NSColor colorWithSRGBRed:123 / 255. |
| green:170 / 255. |