| OLD | NEW |
| 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 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 return; | 591 return; |
| 592 NSAttributedString* selection = | 592 NSAttributedString* selection = |
| 593 [self attributedSubstringForProposedRange:selectedRange | 593 [self attributedSubstringForProposedRange:selectedRange |
| 594 actualRange:NULL]; | 594 actualRange:NULL]; |
| 595 if (!selection) | 595 if (!selection) |
| 596 return; | 596 return; |
| 597 | 597 |
| 598 [[FindPasteboard sharedInstance] setFindText:[selection string]]; | 598 [[FindPasteboard sharedInstance] setFindText:[selection string]]; |
| 599 } | 599 } |
| 600 | 600 |
| 601 - (BOOL)isOpaque { |
| 602 // Even if you call -setDrawsBackground:NO, the background still gets drawn |
| 603 // when editing. This is a problem because the left edge of the background |
| 604 // overlaps the security decoration's hover rect. Return that the textview |
| 605 // is transparent, and follow up below by disabling any background drawing. |
| 606 // This will cause background drawing to fall through to the cell. See |
| 607 // https://crbug.com/669870 . |
| 608 return NO; |
| 609 } |
| 610 |
| 611 - (void)drawViewBackgroundInRect:(NSRect)aRect { |
| 612 // See the comment in -isOpaque. |
| 613 } |
| 614 |
| 601 - (void)drawRect:(NSRect)rect { | 615 - (void)drawRect:(NSRect)rect { |
| 602 AutocompleteTextFieldObserver* observer = [self observer]; | 616 AutocompleteTextFieldObserver* observer = [self observer]; |
| 603 if (observer) | 617 if (observer) |
| 604 observer->OnBeforeDrawRect(); | 618 observer->OnBeforeDrawRect(); |
| 605 [super drawRect:rect]; | 619 [super drawRect:rect]; |
| 606 if (observer) | 620 if (observer) |
| 607 observer->OnDidDrawRect(); | 621 observer->OnDidDrawRect(); |
| 608 } | 622 } |
| 609 | 623 |
| 610 // ThemedWindowDrawing implementation. | 624 // ThemedWindowDrawing implementation. |
| 611 | 625 |
| 612 - (void)windowDidChangeTheme { | 626 - (void)windowDidChangeTheme { |
| 613 [self updateColorsToMatchTheme]; | 627 [self updateColorsToMatchTheme]; |
| 614 } | 628 } |
| 615 | 629 |
| 616 - (void)windowDidChangeActive { | 630 - (void)windowDidChangeActive { |
| 617 } | 631 } |
| 618 | 632 |
| 619 @end | 633 @end |
| OLD | NEW |