Title: [264783] trunk/Source
- Revision
- 264783
- Author
- [email protected]
- Date
- 2020-07-23 12:46:11 -0700 (Thu, 23 Jul 2020)
Log Message
[macOS] Datalist dropdown scrollbar position does not match visible region
https://bugs.webkit.org/show_bug.cgi?id=214656
Reviewed by Wenson Hsieh.
Source/WebKit:
Currently, the content insets for the dropdown are set on an NSScrollView's contentView,
rather than the NSScrollView itself. On the latest macOS, this results in accurate state
within the NSScrollView, leading to an inaccurate scrollbar position. To fix, set the
content insets directly on the NSScrollView.
However, on older macOS, setting content insets on the NSScrollView causes the view to start
out slightly scrolled (by a value equal to the top inset). This issue is solved by preserving
the existing behavior (setting insets on the contentView) on older macOS.
Also, set the style of the embedded NSTableView to NSTableViewStyleFullWidth, to ensure the
view respects the insets we specify.
No new tests, as the change is purely visual and affects native UI.
* UIProcess/mac/WebDataListSuggestionsDropdownMac.mm:
(-[WKDataListSuggestionTableView initWithElementRect:]):
(-[WKDataListSuggestionsController initWithInformation:inView:]):
Source/WTF:
* wtf/PlatformHave.h: Define HAVE_NSTABLEVIEWSTYLE.
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (264782 => 264783)
--- trunk/Source/WTF/ChangeLog 2020-07-23 19:22:39 UTC (rev 264782)
+++ trunk/Source/WTF/ChangeLog 2020-07-23 19:46:11 UTC (rev 264783)
@@ -1,3 +1,12 @@
+2020-07-23 Aditya Keerthi <[email protected]>
+
+ [macOS] Datalist dropdown scrollbar position does not match visible region
+ https://bugs.webkit.org/show_bug.cgi?id=214656
+
+ Reviewed by Wenson Hsieh.
+
+ * wtf/PlatformHave.h: Define HAVE_NSTABLEVIEWSTYLE.
+
2020-07-23 Brady Eidson <[email protected]>
Add Gamepad tests that exercise the native frameworks
Modified: trunk/Source/WTF/wtf/PlatformHave.h (264782 => 264783)
--- trunk/Source/WTF/wtf/PlatformHave.h 2020-07-23 19:22:39 UTC (rev 264782)
+++ trunk/Source/WTF/wtf/PlatformHave.h 2020-07-23 19:46:11 UTC (rev 264783)
@@ -703,3 +703,7 @@
#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101600)
#define HAVE_AVROUTEPICKERVIEW 1
#endif
+
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 110000)
+#define HAVE_NSTABLEVIEWSTYLE 1
+#endif
Modified: trunk/Source/WebKit/ChangeLog (264782 => 264783)
--- trunk/Source/WebKit/ChangeLog 2020-07-23 19:22:39 UTC (rev 264782)
+++ trunk/Source/WebKit/ChangeLog 2020-07-23 19:46:11 UTC (rev 264783)
@@ -1,3 +1,28 @@
+2020-07-23 Aditya Keerthi <[email protected]>
+
+ [macOS] Datalist dropdown scrollbar position does not match visible region
+ https://bugs.webkit.org/show_bug.cgi?id=214656
+
+ Reviewed by Wenson Hsieh.
+
+ Currently, the content insets for the dropdown are set on an NSScrollView's contentView,
+ rather than the NSScrollView itself. On the latest macOS, this results in accurate state
+ within the NSScrollView, leading to an inaccurate scrollbar position. To fix, set the
+ content insets directly on the NSScrollView.
+
+ However, on older macOS, setting content insets on the NSScrollView causes the view to start
+ out slightly scrolled (by a value equal to the top inset). This issue is solved by preserving
+ the existing behavior (setting insets on the contentView) on older macOS.
+
+ Also, set the style of the embedded NSTableView to NSTableViewStyleFullWidth, to ensure the
+ view respects the insets we specify.
+
+ No new tests, as the change is purely visual and affects native UI.
+
+ * UIProcess/mac/WebDataListSuggestionsDropdownMac.mm:
+ (-[WKDataListSuggestionTableView initWithElementRect:]):
+ (-[WKDataListSuggestionsController initWithInformation:inView:]):
+
2020-07-23 David Kilzer <[email protected]>
[IPC hardening] WebKit::ArgumentCoder<BlobPart>::decode() and encode() should use enum BlobPart::Type
Modified: trunk/Source/WebKit/UIProcess/mac/WebDataListSuggestionsDropdownMac.mm (264782 => 264783)
--- trunk/Source/WebKit/UIProcess/mac/WebDataListSuggestionsDropdownMac.mm 2020-07-23 19:22:39 UTC (rev 264782)
+++ trunk/Source/WebKit/UIProcess/mac/WebDataListSuggestionsDropdownMac.mm 2020-07-23 19:46:11 UTC (rev 264783)
@@ -282,6 +282,9 @@
[self setHeaderView:nil];
[self setBackgroundColor:[NSColor clearColor]];
[self setIntercellSpacing:NSMakeSize(0, self.intercellSpacing.height)];
+#if HAVE(NSTABLEVIEWSTYLE)
+ [self setStyle:NSTableViewStyleFullWidth];
+#endif
auto column = adoptNS([[NSTableColumn alloc] init]);
[column setWidth:rect.width()];
@@ -345,10 +348,16 @@
[_scrollView setHorizontalScrollElasticity:NSScrollElasticityNone];
[_scrollView setDocumentView:_table.get()];
[_scrollView setDrawsBackground:NO];
- [[_scrollView contentView] setAutomaticallyAdjustsContentInsets:NO];
- [[_scrollView contentView] setContentInsets:NSEdgeInsetsMake(dropdownVerticalPadding, 0, dropdownVerticalPadding, 0)];
- [[_scrollView contentView] scrollToPoint:NSMakePoint(0, -dropdownVerticalPadding)];
+ auto insetView =
+#if HAVE(NSTABLEVIEWSTYLE)
+ _scrollView;
+#else
+ [_scrollView contentView];
+#endif
+ [insetView setAutomaticallyAdjustsContentInsets:NO];
+ [insetView setContentInsets:NSEdgeInsetsMake(dropdownVerticalPadding, 0, dropdownVerticalPadding, 0)];
+
[_table setDelegate:self];
[_table setDataSource:self];
[_table setAction:@selector(selectedRow:)];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes