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

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm

Issue 2610033003: [Mac] Prevent omnibox text bg from drawing over decoration, focus ring.
Patch Set: Created 3 years, 11 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
« no previous file with comments | « chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h" 5 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h"
6 6
7 #include "base/mac/sdk_forward_declarations.h" 7 #include "base/mac/sdk_forward_declarations.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "chrome/app/chrome_command_ids.h" // IDC_* 10 #include "chrome/app/chrome_command_ids.h" // IDC_*
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 return; 587 return;
588 NSAttributedString* selection = 588 NSAttributedString* selection =
589 [self attributedSubstringForProposedRange:selectedRange 589 [self attributedSubstringForProposedRange:selectedRange
590 actualRange:NULL]; 590 actualRange:NULL];
591 if (!selection) 591 if (!selection)
592 return; 592 return;
593 593
594 [[FindPasteboard sharedInstance] setFindText:[selection string]]; 594 [[FindPasteboard sharedInstance] setFindText:[selection string]];
595 } 595 }
596 596
597 - (BOOL)isOpaque {
598 // Even if you call -setDrawsBackground:NO, the background still gets drawn
599 // when editing. This is a problem because the left edge of the background
600 // overlaps the security decoration's hover rect. Return that the textview
601 // is transparent, and follow up below by disabling any background drawing.
602 // This will cause background drawing to fall through to the cell. See
603 // https://crbug.com/669870 .
604 return NO;
605 }
606
607 - (void)drawViewBackgroundInRect:(NSRect)aRect {
608 // See the comment in -isOpaque.
609 }
610
597 - (void)drawRect:(NSRect)rect { 611 - (void)drawRect:(NSRect)rect {
598 AutocompleteTextFieldObserver* observer = [self observer]; 612 AutocompleteTextFieldObserver* observer = [self observer];
599 if (observer) 613 if (observer)
600 observer->OnBeforeDrawRect(); 614 observer->OnBeforeDrawRect();
601 [super drawRect:rect]; 615 [super drawRect:rect];
602 autocomplete_text_field::DrawGrayTextAutocompletion( 616 autocomplete_text_field::DrawGrayTextAutocompletion(
603 [self textStorage], 617 [self textStorage],
604 [[self delegate] suggestText], 618 [[self delegate] suggestText],
605 [[self delegate] suggestColor], 619 [[self delegate] suggestColor],
606 self, 620 self,
607 [self bounds]); 621 [self bounds]);
608 if (observer) 622 if (observer)
609 observer->OnDidDrawRect(); 623 observer->OnDidDrawRect();
610 } 624 }
611 625
612 // ThemedWindowDrawing implementation. 626 // ThemedWindowDrawing implementation.
613 627
614 - (void)windowDidChangeTheme { 628 - (void)windowDidChangeTheme {
615 [self updateColorsToMatchTheme]; 629 [self updateColorsToMatchTheme];
616 } 630 }
617 631
618 - (void)windowDidChangeActive { 632 - (void)windowDidChangeActive {
619 } 633 }
620 634
621 @end 635 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698