[webkit-changes] [WebKit/WebKit] 29d2da: Fix scrolling of RenderListBox in vertical writing...

Aditya Keerthi noreply at github.com
Wed Oct 4 21:27:50 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 29d2da526a2ed445aaea7715dacd131b46335f01
      https://github.com/WebKit/WebKit/commit/29d2da526a2ed445aaea7715dacd131b46335f01
  Author: Aditya Keerthi <akeerthi at apple.com>
  Date:   2023-10-04 (Wed, 04 Oct 2023)

  Changed paths:
    M LayoutTests/TestExpectations
    A LayoutTests/fast/forms/vertical-writing-mode/listbox-drag-horizontal-scrollbar-expected.txt
    A LayoutTests/fast/forms/vertical-writing-mode/listbox-drag-horizontal-scrollbar.html
    A LayoutTests/fast/forms/vertical-writing-mode/listbox-horizontal-scrollbar-expected.html
    A LayoutTests/fast/forms/vertical-writing-mode/listbox-horizontal-scrollbar.html
    M LayoutTests/platform/ios/TestExpectations
    M Source/WebCore/rendering/RenderBox.h
    M Source/WebCore/rendering/RenderListBox.cpp
    M Source/WebCore/rendering/RenderListBox.h

  Log Message:
  -----------
  Fix scrolling of RenderListBox in vertical writing mode
https://bugs.webkit.org/show_bug.cgi?id=261803
rdar://115766417

Reviewed by Simon Fraser.

The following changes are made to `RenderListBox`:
- Display a horizontal scrollbar when in vertical writing mode
- Support scrolling in the block direction
- Adjust the scroll origin for flipped blocks writing modes

Covered by the following web platform tests:
- css/css-writing-modes/forms/select-multiple-scrolling.optional.html
- css/css-writing-modes/forms/select-size-scrolling-and-sizing.optional.html

The tests will be rebaselined once `<select>` is enabled under the vertical
form controls preference.

* LayoutTests/TestExpectations:

Mark the newly added tests as failures for now, since `<select>` is still forced
to `writing-mode: horizontal-tb`. Once `RenderListBox` fully supports vertical
writing mode, these tests can be marked as passing.

* LayoutTests/fast/forms/vertical-writing-mode/listbox-drag-horizontal-scrollbar-expected.txt: Added.
* LayoutTests/fast/forms/vertical-writing-mode/listbox-drag-horizontal-scrollbar.html: Added.
* LayoutTests/fast/forms/vertical-writing-mode/listbox-horizontal-scrollbar-expected.html: Added.
* LayoutTests/fast/forms/vertical-writing-mode/listbox-horizontal-scrollbar.html: Added.
* LayoutTests/platform/ios/TestExpectations:

`RenderListBox` is not used on iOS.

* Source/WebCore/rendering/RenderBox.h:

Make `horizontalScrollbarHeight` a virtual method so that `RenderListBox` can
report a horizontal scrollbar height.

* Source/WebCore/rendering/RenderListBox.cpp:
(WebCore::RenderListBox::willBeDestroyed):
(WebCore::RenderListBox::updateFromElement):
(WebCore::RenderListBox::layout):

Adjust the scroll origin to support `vertical-rl`.

(WebCore::RenderListBox::styleDidChange):
(WebCore::RenderListBox::computeIntrinsicLogicalWidths const):
(WebCore::RenderListBox::itemBoundingBoxRect const):
(WebCore::RenderListBox::paintObject):
(WebCore::RenderListBox::paintScrollbar):
(WebCore::RenderListBox::isPointInOverflowControl):
(WebCore::RenderListBox::listIndexAtOffset const):
(WebCore::RenderListBox::panScroll):

`panScroll` is only supported on Windows. Given an inability to easily test,
the implementation is left as-is, and does not currently support vertical
writing modes.

(WebCore::RenderListBox::scrollToward):

Update logic to support scrolling as dragging occurs in the block direction.

(WebCore::RenderListBox::scrollToRevealElementAtListIndex):
(WebCore::RenderListBox::indexOffset const):
(WebCore::RenderListBox::maximumScrollPosition const):
(WebCore::RenderListBox::verticalScrollbarWidth const):
(WebCore::RenderListBox::horizontalScrollbarHeight const):
(WebCore::RenderListBox::verticalScrollbar const):
(WebCore::RenderListBox::horizontalScrollbar const):
(WebCore::RenderListBox::scrollbarOrientationForWritingMode const):
(WebCore::RenderListBox::scrollWidth const):
(WebCore::RenderListBox::scrollHeight const):
(WebCore::RenderListBox::scrollLeft const):
(WebCore::RenderListBox::setScrollLeft):
(WebCore::RenderListBox::scrollTop const):
(WebCore::RenderListBox::setScrollTop):
(WebCore::RenderListBox::logicalScrollTop const):
(WebCore::RenderListBox::setLogicalScrollTop):
(WebCore::RenderListBox::rectForScrollbar const):

Introduce a helper method to get the rect of the scrollbar relative to the renderer.

(WebCore::RenderListBox::invalidateScrollbarRect):
(WebCore::RenderListBox::convertFromScrollbarToContainingView const):
(WebCore::RenderListBox::convertFromContainingViewToScrollbar const):
(WebCore::RenderListBox::isScrollableOrRubberbandable):
(WebCore::RenderListBox::createScrollbar):

Introduce a common method to create a vertical/horizontal scrollbar depending
on the writing mode.

(WebCore::RenderListBox::destroyScrollbar):
(WebCore::RenderListBox::setHasScrollbar):
(WebCore::RenderListBox::setHasVerticalScrollbar): Deleted.
* Source/WebCore/rendering/RenderListBox.h:

Introduce a single scrollbar that represents a vertical or horizontal
scrollbar depending on the writing mode.

Canonical link: https://commits.webkit.org/268894@main




More information about the webkit-changes mailing list