WebKit Bugzilla
Attachment 373205 Details for
Bug 199350
: macOS: <datalist> dropdown shadow is cropped, looks nothing like NSComboBox
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-199350-20190630202012.patch (text/plain), 22.23 KB, created by
Tim Horton
on 2019-06-30 20:20:12 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Tim Horton
Created:
2019-06-30 20:20:12 PDT
Size:
22.23 KB
patch
obsolete
>Subversion Revision: 246921 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 06d7120466d7e397cef3de8e1ec1994e952719a5..d68a08a8951b1dbb64aa6985a86bbeaeac0d1f77 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,79 @@ >+2019-06-30 Tim Horton <timothy_horton@apple.com> >+ >+ macOS: <datalist> dropdown shadow is cropped, looks nothing like NSComboBox >+ https://bugs.webkit.org/show_bug.cgi?id=199350 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Improve the appearance of the macOS <datalist> dropdown, adopting the >+ roundly-cornered and backdrop-ful appearance of the current NSComboBox style. >+ >+ Use the proper window shadow instead of our own inside the window, both >+ so that we match the system and so that it doesn't get clipped. >+ >+ Allow vertical rubber-banding, because NSComboBox does. >+ >+ Don't highlight on hover, because NSComboBox doesn't. Do use NSTableView's >+ selection mechanism instead of rolling our own for highlights driven by >+ keyboard-based navigation. >+ >+ Make use of NSTableCellView, since it has some smarts around pixel alignment >+ that we don't need to duplicate (and things are blurry on 1x displays without). >+ >+ Also rename some classes to make it a bit more clear what's going on: >+ WKDataListSuggestionCell -> WKDataListSuggestionView (it's a NSView, not an NSCell) >+ WKDataListSuggestionsView -> WKDataListSuggestionsController (it's not a view at all) >+ >+ * Platform/spi/mac/AppKitSPI.h: >+ * UIProcess/mac/WebDataListSuggestionsDropdownMac.mm: >+ (WebKit::WebDataListSuggestionsDropdownMac::show): >+ (-[WKDataListSuggestionWindow initWithContentRect:styleMask:backing:defer:]): >+ (-[WKDataListSuggestionWindow canBecomeKeyWindow]): >+ (-[WKDataListSuggestionWindow hasKeyAppearance]): >+ (-[WKDataListSuggestionWindow shadowOptions]): >+ (-[WKDataListSuggestionView initWithFrame:]): >+ (-[WKDataListSuggestionView setText:]): >+ (-[WKDataListSuggestionView setBackgroundStyle:]): >+ (-[WKDataListSuggestionTableRowView drawSelectionInRect:]): >+ (-[WKDataListSuggestionTableView initWithElementRect:]): >+ (-[WKDataListSuggestionTableView layout]): >+ (-[WKDataListSuggestionTableView reload]): >+ (-[WKDataListSuggestionsController initWithInformation:inView:]): >+ (-[WKDataListSuggestionsController currentSelectedString]): >+ (-[WKDataListSuggestionsController updateWithInformation:]): >+ (-[WKDataListSuggestionsController moveSelectionByDirection:]): >+ (-[WKDataListSuggestionsController invalidate]): >+ (-[WKDataListSuggestionsController dropdownRectForElementRect:]): >+ (-[WKDataListSuggestionsController showSuggestionsDropdown:]): >+ (-[WKDataListSuggestionsController tableView:rowViewForRow:]): >+ (-[WKDataListSuggestionsController tableView:viewForTableColumn:row:]): >+ (-[WKDataListSuggestionCell initWithFrame:]): Deleted. >+ (-[WKDataListSuggestionCell setText:]): Deleted. >+ (-[WKDataListSuggestionCell setActive:]): Deleted. >+ (-[WKDataListSuggestionCell drawRect:]): Deleted. >+ (-[WKDataListSuggestionCell mouseEntered:]): Deleted. >+ (-[WKDataListSuggestionCell mouseExited:]): Deleted. >+ (-[WKDataListSuggestionCell acceptsFirstResponder]): Deleted. >+ (-[WKDataListSuggestionTable initWithElementRect:]): Deleted. >+ (-[WKDataListSuggestionTable setVisibleRect:]): Deleted. >+ (-[WKDataListSuggestionTable currentActiveRow]): Deleted. >+ (-[WKDataListSuggestionTable setActiveRow:]): Deleted. >+ (-[WKDataListSuggestionTable reload]): Deleted. >+ (-[WKDataListSuggestionTable acceptsFirstResponder]): Deleted. >+ (-[WKDataListSuggestionTable enclosingScrollView]): Deleted. >+ (-[WKDataListSuggestionTable removeFromSuperviewWithoutNeedingDisplay]): Deleted. >+ (-[WKDataListSuggestionsView initWithInformation:inView:]): Deleted. >+ (-[WKDataListSuggestionsView currentSelectedString]): Deleted. >+ (-[WKDataListSuggestionsView updateWithInformation:]): Deleted. >+ (-[WKDataListSuggestionsView moveSelectionByDirection:]): Deleted. >+ (-[WKDataListSuggestionsView invalidate]): Deleted. >+ (-[WKDataListSuggestionsView dropdownRectForElementRect:]): Deleted. >+ (-[WKDataListSuggestionsView showSuggestionsDropdown:]): Deleted. >+ (-[WKDataListSuggestionsView selectedRow:]): Deleted. >+ (-[WKDataListSuggestionsView numberOfRowsInTableView:]): Deleted. >+ (-[WKDataListSuggestionsView tableView:heightOfRow:]): Deleted. >+ (-[WKDataListSuggestionsView tableView:viewForTableColumn:row:]): Deleted. >+ > 2019-06-27 Zan Dobersek <zdobersek@igalia.com> > > Unreviewed WPE build fix. >diff --git a/Source/WebKit/Platform/spi/mac/AppKitSPI.h b/Source/WebKit/Platform/spi/mac/AppKitSPI.h >index f305d51541200043a6d7de2592ef2041b94f0499..434b110f0c3c664fefd4c4c546836c4536823c8a 100644 >--- a/Source/WebKit/Platform/spi/mac/AppKitSPI.h >+++ b/Source/WebKit/Platform/spi/mac/AppKitSPI.h >@@ -42,17 +42,22 @@ > @protocol NSTextInputClient_Async > @end > >-@interface NSWindow (NSInspectorBarSupport) >+typedef NS_OPTIONS(NSUInteger, NSWindowShadowOptions) { >+ NSWindowShadowSecondaryWindow = 0x2, >+}; >+ >+@interface NSWindow () > - (NSInspectorBar *)inspectorBar; > - (void)setInspectorBar:(NSInspectorBar *)bar; >-@end >+ >+@property (readonly) NSWindowShadowOptions shadowOptions; > > #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 >-@interface NSWindow (FullScreenSupport) > @property CGFloat titlebarAlphaValue; >-@end > #endif > >+@end >+ > #endif > > @interface NSInspectorBar (IPI) >diff --git a/Source/WebKit/UIProcess/mac/WebDataListSuggestionsDropdownMac.mm b/Source/WebKit/UIProcess/mac/WebDataListSuggestionsDropdownMac.mm >index 1c273e3ce17cd6703c255ab7e2169894431b57b0..0cdfbaf4ca5632ca3601e72f5576be8e9423b042 100644 >--- a/Source/WebKit/UIProcess/mac/WebDataListSuggestionsDropdownMac.mm >+++ b/Source/WebKit/UIProcess/mac/WebDataListSuggestionsDropdownMac.mm >@@ -28,51 +28,30 @@ > > #if ENABLE(DATALIST_ELEMENT) && USE(APPKIT) > >+#import "AppKitSPI.h" > #import "WebPageProxy.h" > #import <WebCore/IntRect.h> > #import <pal/spi/cocoa/NSColorSPI.h> > >-static const CGFloat dropdownTopMargin = 2; >+static const CGFloat dropdownTopMargin = 3; >+static const CGFloat dropdownVerticalPadding = 4; > static const CGFloat dropdownRowHeight = 20; >-static const CGFloat dropdownShadowHeight = 5; >-static const CGFloat dropdownShadowBlurRadius = 3; > static const size_t dropdownMaxSuggestions = 6; >-static NSString * const suggestionCellReuseIdentifier = @"WKDataListSuggestionCell"; >+static NSString * const suggestionCellReuseIdentifier = @"WKDataListSuggestionView"; > > @interface WKDataListSuggestionWindow : NSWindow > @end > >-@interface WKDataListSuggestionCell : NSView { >- RetainPtr<NSTextField> _textField; >- BOOL _mouseIsOver; >- BOOL _active; >-} >- >-@property (nonatomic, assign) BOOL active; >- >-- (void)setText:(NSString *)text; >+@interface WKDataListSuggestionView : NSTableCellView > @end > >-@interface WKDataListSuggestionTable : NSTableView { >- RetainPtr<NSScrollView> _enclosingScrollView; >- Optional<size_t> _activeRow; >-} >+@interface WKDataListSuggestionTableRowView : NSTableRowView >+@end > >-- (id)initWithElementRect:(const WebCore::IntRect&)rect; >-- (void)setVisibleRect:(NSRect)rect; >-- (void)setActiveRow:(size_t)row; >-- (Optional<size_t>)currentActiveRow; >-- (void)reload; >+@interface WKDataListSuggestionTableView : NSTableView > @end > >-@interface WKDataListSuggestionsView : NSObject<NSTableViewDataSource, NSTableViewDelegate> { >-@private >- RetainPtr<WKDataListSuggestionTable> _table; >- WebKit::WebDataListSuggestionsDropdownMac* _dropdown; >- Vector<String> _suggestions; >- NSView *_view; >- RetainPtr<NSWindow> _enclosingWindow; >-} >+@interface WKDataListSuggestionsController : NSObject<NSTableViewDataSource, NSTableViewDelegate> > > - (id)initWithInformation:(WebCore::DataListSuggestionInformation&&)information inView:(NSView *)view; > - (void)showSuggestionsDropdown:(WebKit::WebDataListSuggestionsDropdownMac*)dropdown; >@@ -81,6 +60,7 @@ static NSString * const suggestionCellReuseIdentifier = @"WKDataListSuggestionCe > - (void)invalidate; > > - (String)currentSelectedString; >+ > @end > > namespace WebKit { >@@ -105,7 +85,7 @@ void WebDataListSuggestionsDropdownMac::show(WebCore::DataListSuggestionInformat > return; > } > >- m_dropdownUI = adoptNS([[WKDataListSuggestionsView alloc] initWithInformation:WTFMove(information) inView:m_view]); >+ m_dropdownUI = adoptNS([[WKDataListSuggestionsController alloc] initWithInformation:WTFMove(information) inView:m_view]); > [m_dropdownUI showSuggestionsDropdown:this]; > } > >@@ -147,78 +127,78 @@ void WebDataListSuggestionsDropdownMac::close() > > } // namespace WebKit > >-@implementation WKDataListSuggestionWindow >-@end >- >-@implementation WKDataListSuggestionCell >- >-@synthesize active=_active; >+@implementation WKDataListSuggestionWindow { >+ RetainPtr<NSVisualEffectView> _backdropView; >+} > >-- (id)initWithFrame:(NSRect)frameRect >+- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)styleMask backing:(NSBackingStoreType)backingStoreType defer:(BOOL)defer > { >- if (!(self = [super initWithFrame:frameRect])) >- return self; >+ self = [super initWithContentRect:contentRect styleMask:styleMask backing:backingStoreType defer:defer]; >+ if (!self) >+ return nil; > >- _textField = adoptNS([[NSTextField alloc] init]); >- [_textField setEditable:NO]; >- [_textField setBezeled:NO]; >- [_textField setBackgroundColor:[NSColor clearColor]]; >- [self addSubview:_textField.get()]; >+ self.hasShadow = YES; > >- [self setIdentifier:@"WKDataListSuggestionCell"]; >+ _backdropView = [[NSVisualEffectView alloc] initWithFrame:contentRect]; >+ [_backdropView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; >+ [_backdropView setMaterial:NSVisualEffectMaterialMenu]; >+ [_backdropView setState:NSVisualEffectStateActive]; >+ [_backdropView setBlendingMode:NSVisualEffectBlendingModeBehindWindow]; > >- [self addTrackingRect:self.bounds owner:self userData:nil assumeInside:NO]; >+ [self setContentView:_backdropView.get()]; > > return self; > } > >-- (void)setText:(NSString *)text >+- (BOOL)canBecomeKeyWindow > { >- [_textField setStringValue:text]; >- [_textField sizeToFit]; >- >- NSRect textFieldFrame = [_textField frame]; >- [_textField setFrame:NSMakeRect(0, (NSHeight(self.frame) - NSHeight(textFieldFrame)) / 2, NSWidth(textFieldFrame), NSHeight(textFieldFrame))]; >+ return NO; >+} > >- _mouseIsOver = NO; >- self.active = NO; >+- (BOOL)hasKeyAppearance >+{ >+ return YES; > } > >-- (void)setActive:(BOOL)shouldActivate >+- (NSWindowShadowOptions)shadowOptions > { >- _active = shouldActivate; >- [self setNeedsDisplay:YES]; >+ return NSWindowShadowSecondaryWindow; >+} >+ >+@end >+ >+@implementation WKDataListSuggestionView { >+ RetainPtr<NSTextField> _textField; > } > >-- (void)drawRect:(NSRect)dirtyRect >+- (id)initWithFrame:(NSRect)frameRect > { >- if (self.active) { >- [[NSColor alternateSelectedControlColor] setFill]; >- [_textField setTextColor:[NSColor alternateSelectedControlTextColor]]; >- } else if (_mouseIsOver) { >- [[NSColor quaternaryLabelColor] setFill]; >- [_textField setTextColor:[NSColor textColor]]; >- } else { >- [[NSColor controlBackgroundColor] setFill]; >- [_textField setTextColor:[NSColor textColor]]; >- } >+ if (!(self = [super initWithFrame:frameRect])) >+ return self; > >- NSRectFill(dirtyRect); >- [super drawRect:dirtyRect]; >+ _textField = adoptNS([[NSTextField alloc] initWithFrame:frameRect]); >+ self.textField = _textField.get(); >+ >+ [self addSubview:self.textField]; >+ >+ self.identifier = suggestionCellReuseIdentifier; >+ self.textField.editable = NO; >+ self.textField.bezeled = NO; >+ self.textField.font = [NSFont menuFontOfSize:0]; >+ self.textField.drawsBackground = NO; >+ >+ return self; > } > >-- (void)mouseEntered:(NSEvent *)event >+- (void)setText:(NSString *)text > { >- [super mouseEntered:event]; >- _mouseIsOver = YES; >- [self setNeedsDisplay:YES]; >+ self.textField.stringValue = text; > } > >-- (void)mouseExited:(NSEvent *)event >+- (void)setBackgroundStyle:(NSBackgroundStyle)backgroundStyle > { >- [super mouseExited:event]; >- _mouseIsOver = NO; >- [self setNeedsDisplay:YES]; >+ [super setBackgroundStyle:backgroundStyle]; >+ self.textField.textColor = backgroundStyle == NSBackgroundStyleLight ? [NSColor textColor] : [NSColor alternateSelectedControlTextColor]; > } > > - (BOOL)acceptsFirstResponder >@@ -228,16 +208,28 @@ void WebDataListSuggestionsDropdownMac::close() > > @end > >-@implementation WKDataListSuggestionTable >+@implementation WKDataListSuggestionTableRowView >+ >+- (void)drawSelectionInRect:(NSRect)dirtyRect >+{ >+ [self setEmphasized:YES]; >+ [super drawSelectionInRect:dirtyRect]; >+} >+ >+@end >+ >+@implementation WKDataListSuggestionTableView { >+ RetainPtr<NSScrollView> _enclosingScrollView; >+} > > - (id)initWithElementRect:(const WebCore::IntRect&)rect > { > if (!(self = [super initWithFrame:NSMakeRect(0, 0, rect.width(), 0)])) > return self; > >- [self setIntercellSpacing:NSZeroSize]; > [self setHeaderView:nil]; >- [self setSelectionHighlightStyle:NSTableViewSelectionHighlightStyleNone]; >+ [self setBackgroundColor:[NSColor clearColor]]; >+ [self setIntercellSpacing:NSMakeSize(0, self.intercellSpacing.height)]; > > auto column = adoptNS([[NSTableColumn alloc] init]); > [column setWidth:rect.width()]; >@@ -245,48 +237,24 @@ void WebDataListSuggestionsDropdownMac::close() > > _enclosingScrollView = adoptNS([[NSScrollView alloc] init]); > [_enclosingScrollView setHasVerticalScroller:YES]; >- [_enclosingScrollView setVerticalScrollElasticity:NSScrollElasticityNone]; >+ [_enclosingScrollView setVerticalScrollElasticity:NSScrollElasticityAllowed]; > [_enclosingScrollView setHorizontalScrollElasticity:NSScrollElasticityNone]; > [_enclosingScrollView setDocumentView:self]; >- >- auto dropShadow = adoptNS([[NSShadow alloc] init]); >- [dropShadow setShadowColor:[NSColor systemGrayColor]]; >- [dropShadow setShadowOffset:NSMakeSize(0, dropdownShadowHeight)]; >- [dropShadow setShadowBlurRadius:dropdownShadowBlurRadius]; >- [_enclosingScrollView setWantsLayer:YES]; >- [_enclosingScrollView setShadow:dropShadow.get()]; >+ [_enclosingScrollView setDrawsBackground:NO]; >+ [[_enclosingScrollView contentView] setAutomaticallyAdjustsContentInsets:NO]; >+ [[_enclosingScrollView contentView] setContentInsets:NSEdgeInsetsMake(dropdownVerticalPadding, 0, dropdownVerticalPadding, 0)]; >+ [[_enclosingScrollView contentView] scrollToPoint:NSMakePoint(0, -dropdownVerticalPadding)]; > > return self; > } > >-- (void)setVisibleRect:(NSRect)rect >-{ >- [self setFrame:NSMakeRect(0, 0, NSWidth(rect) - dropdownShadowHeight * 2, 0)]; >- [_enclosingScrollView setFrame:NSMakeRect(dropdownShadowHeight, dropdownShadowHeight, NSWidth(rect) - dropdownShadowHeight * 2, NSHeight(rect) - dropdownShadowHeight)]; >-} >- >-- (Optional<size_t>)currentActiveRow >-{ >- return _activeRow; >-} >- >-- (void)setActiveRow:(size_t)row >+- (void)layout > { >- if (_activeRow) { >- WKDataListSuggestionCell *oldCell = (WKDataListSuggestionCell *)[self viewAtColumn:0 row:_activeRow.value() makeIfNecessary:NO]; >- oldCell.active = NO; >- } >- >- [self scrollRowToVisible:row]; >- WKDataListSuggestionCell *newCell = (WKDataListSuggestionCell *)[self viewAtColumn:0 row:row makeIfNecessary:NO]; >- newCell.active = YES; >- >- _activeRow = row; >+ [_enclosingScrollView setFrame:[_enclosingScrollView superview].bounds]; > } > > - (void)reload > { >- _activeRow = WTF::nullopt; > [self reloadData]; > } > >@@ -308,24 +276,33 @@ void WebDataListSuggestionsDropdownMac::close() > > @end > >-@implementation WKDataListSuggestionsView >+@implementation WKDataListSuggestionsController { >+ WebKit::WebDataListSuggestionsDropdownMac* _dropdown; >+ Vector<String> _suggestions; >+ NSView *_presentingView; >+ >+ RetainPtr<WKDataListSuggestionWindow> _enclosingWindow; >+ RetainPtr<WKDataListSuggestionTableView> _table; >+} > >-- (id)initWithInformation:(WebCore::DataListSuggestionInformation&&)information inView:(NSView *)view >+- (id)initWithInformation:(WebCore::DataListSuggestionInformation&&)information inView:(NSView *)presentingView > { > if (!(self = [super init])) > return self; > >- _view = view; >+ _presentingView = presentingView; > _suggestions = WTFMove(information.suggestions); >- _table = adoptNS([[WKDataListSuggestionTable alloc] initWithElementRect:information.elementRect]); >+ _table = adoptNS([[WKDataListSuggestionTableView alloc] initWithElementRect:information.elementRect]); > >- _enclosingWindow = adoptNS([[WKDataListSuggestionWindow alloc] initWithContentRect:NSZeroRect styleMask:NSWindowStyleMaskBorderless backing:NSBackingStoreBuffered defer:NO]); >+ _enclosingWindow = adoptNS([[WKDataListSuggestionWindow alloc] initWithContentRect:NSZeroRect styleMask:(NSWindowStyleMaskTitled | NSWindowStyleMaskFullSizeContentView) backing:NSBackingStoreBuffered defer:NO]); > [_enclosingWindow setReleasedWhenClosed:NO]; > [_enclosingWindow setFrame:[self dropdownRectForElementRect:information.elementRect] display:YES]; >+ [_enclosingWindow setTitleVisibility:NSWindowTitleHidden]; >+ [_enclosingWindow setTitlebarAppearsTransparent:YES]; >+ [_enclosingWindow setMovable:NO]; > [_enclosingWindow setBackgroundColor:[NSColor clearColor]]; > [_enclosingWindow setOpaque:NO]; > >- [_table setVisibleRect:[_enclosingWindow frame]]; > [_table setDelegate:self]; > [_table setDataSource:self]; > [_table setAction:@selector(selectedRow:)]; >@@ -336,9 +313,10 @@ void WebDataListSuggestionsDropdownMac::close() > > - (String)currentSelectedString > { >- Optional<size_t> selectedRow = [_table currentActiveRow]; >- if (selectedRow && selectedRow.value() < _suggestions.size()) >- return _suggestions.at(selectedRow.value()); >+ NSInteger selectedRow = [_table selectedRow]; >+ >+ if (selectedRow >= 0 && static_cast<size_t>(selectedRow) < _suggestions.size()) >+ return _suggestions.at(selectedRow); > > return String(); > } >@@ -349,25 +327,23 @@ void WebDataListSuggestionsDropdownMac::close() > [_table reload]; > > [_enclosingWindow setFrame:[self dropdownRectForElementRect:information.elementRect] display:YES]; >- [_table setVisibleRect:[_enclosingWindow frame]]; > } > > - (void)moveSelectionByDirection:(const String&)direction > { > size_t size = _suggestions.size(); >- Optional<size_t> oldSelection = [_table currentActiveRow]; >+ NSInteger oldSelection = [_table selectedRow]; > > size_t newSelection; >- if (oldSelection) { >- size_t oldValue = oldSelection.value(); >+ if (oldSelection != -1) { > if (direction == "Up") >- newSelection = oldValue ? (oldValue - 1) : (size - 1); >+ newSelection = oldSelection ? (oldSelection - 1) : (size - 1); > else >- newSelection = (oldValue + 1) % size; >+ newSelection = (oldSelection + 1) % size; > } else > newSelection = (direction == "Up") ? (size - 1) : 0; > >- [_table setActiveRow:newSelection]; >+ [_table selectRowIndexes:[NSIndexSet indexSetWithIndex:newSelection] byExtendingSelection:NO]; > } > > - (void)invalidate >@@ -380,16 +356,17 @@ void WebDataListSuggestionsDropdownMac::close() > > _table = nil; > >- [[_view window] removeChildWindow:_enclosingWindow.get()]; >+ [[_presentingView window] removeChildWindow:_enclosingWindow.get()]; > [_enclosingWindow close]; > _enclosingWindow = nil; > } > > - (NSRect)dropdownRectForElementRect:(const WebCore::IntRect&)rect > { >- NSRect windowRect = [[_view window] convertRectToScreen:[_view convertRect:rect toView:nil]]; >- CGFloat height = std::min(_suggestions.size(), dropdownMaxSuggestions) * dropdownRowHeight; >- return NSMakeRect(NSMinX(windowRect) - dropdownShadowHeight, NSMinY(windowRect) - height - dropdownShadowHeight - dropdownTopMargin, rect.width() + dropdownShadowHeight * 2, height + dropdownShadowHeight); >+ NSRect windowRect = [[_presentingView window] convertRectToScreen:[_presentingView convertRect:rect toView:nil]]; >+ auto visibleSuggestionCount = std::min(_suggestions.size(), dropdownMaxSuggestions); >+ CGFloat height = visibleSuggestionCount * (dropdownRowHeight + [_table intercellSpacing].height) + (dropdownVerticalPadding * 2); >+ return NSMakeRect(NSMinX(windowRect), NSMinY(windowRect) - height - dropdownTopMargin, rect.width(), height); > } > > - (void)showSuggestionsDropdown:(WebKit::WebDataListSuggestionsDropdownMac*)dropdown >@@ -397,7 +374,7 @@ void WebDataListSuggestionsDropdownMac::close() > _dropdown = dropdown; > [[_enclosingWindow contentView] addSubview:[_table enclosingScrollView]]; > [_table reload]; >- [[_view window] addChildWindow:_enclosingWindow.get() ordered:NSWindowAbove]; >+ [[_presentingView window] addChildWindow:_enclosingWindow.get() ordered:NSWindowAbove]; > [[_table enclosingScrollView] flashScrollers]; > } > >@@ -416,20 +393,21 @@ void WebDataListSuggestionsDropdownMac::close() > return dropdownRowHeight; > } > >+- (NSTableRowView *)tableView:(NSTableView *)tableView rowViewForRow:(NSInteger)row >+{ >+ return [[[WKDataListSuggestionTableRowView alloc] init] autorelease]; >+} >+ > - (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row > { >- WKDataListSuggestionCell *result = [tableView makeViewWithIdentifier:suggestionCellReuseIdentifier owner:self]; >+ WKDataListSuggestionView *result = [tableView makeViewWithIdentifier:suggestionCellReuseIdentifier owner:self]; > > if (!result) { >- result = [[[WKDataListSuggestionCell alloc] initWithFrame:NSMakeRect(0, 0, tableView.frame.size.width, dropdownRowHeight)] autorelease]; >+ result = [[[WKDataListSuggestionView alloc] initWithFrame:NSMakeRect(0, 0, tableView.frame.size.width, dropdownRowHeight)] autorelease]; > [result setIdentifier:suggestionCellReuseIdentifier]; > } > >- [result setText:_suggestions.at(row)]; >- >- Optional<size_t> currentActiveRow = [_table currentActiveRow]; >- if (currentActiveRow && static_cast<size_t>(row) == currentActiveRow.value()) >- result.active = YES; >+ result.text = _suggestions.at(row); > > return result; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 199350
:
373204
|
373205
|
378344