Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Resize handles now render correctly when scrollbar-width none
https://bugs.webkit.org/show_bug.cgi?id=253310

Reviewed by Simon Fraser.

Resize handle sizing and painting now accounts for when scrollbar-width is none.

RenderTextControl now correctly uses the scrollbar width style when getting scrollbar thickness.

* LayoutTests/TestExpectations:
* Source/WebCore/rendering/RenderLayerScrollableArea.cpp:
(WebCore::RenderLayerScrollableArea::overflowControlsRects const):
(WebCore::RenderLayerScrollableArea::paintResizer):
* Source/WebCore/rendering/RenderTextControl.cpp:
(WebCore::RenderTextControl::scrollbarThickness const):

Canonical link: https://commits.webkit.org/264630@main
  • Loading branch information
lukewarlow authored and Ahmad Saleem committed May 27, 2023
1 parent 74481ec commit aa4860a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 0 additions & 3 deletions LayoutTests/TestExpectations
Expand Up @@ -6422,9 +6422,6 @@ imported/w3c/web-platform-tests/css/css-scrollbars/scrollbar-width-paint-001.htm
imported/w3c/web-platform-tests/css/css-scrollbars/scrollbar-width-paint-002.html [ Skip ]
imported/w3c/web-platform-tests/css/css-scrollbars/scrollbar-width-paint-003.html [ Skip ]

# This test relies on textarea resize handle showing without a scrollbar which isn't implemented yet. webkit.org/b/253310
imported/w3c/web-platform-tests/css/css-scrollbars/textarea-scrollbar-width-none.html [ Skip ]

# Imported WPT css-tables which are crashing or fails.
imported/w3c/web-platform-tests/css/css-tables/auto-layout-calc-width-001.html [ Crash ]
imported/w3c/web-platform-tests/css/css-tables/fixed-layout-calc-width-001.html [ Crash ]
Expand Down
4 changes: 2 additions & 2 deletions Source/WebCore/rendering/RenderLayerScrollableArea.cpp
Expand Up @@ -699,7 +699,7 @@ RenderLayer::OverflowControlRects RenderLayerScrollableArea::overflowControlsRec
bool haveNonOverlayVerticalScrollbar = isNonOverlayScrollbar(m_vBar.get());
bool placeVerticalScrollbarOnTheLeft = shouldPlaceVerticalScrollbarOnLeft();
bool haveResizer = renderer.style().resize() != Resize::None;
bool scrollbarsAvoidCorner = (haveNonOverlayHorizontalScrollbar && haveNonOverlayVerticalScrollbar) || (haveResizer && (haveNonOverlayHorizontalScrollbar || haveNonOverlayVerticalScrollbar));
bool scrollbarsAvoidCorner = ((haveNonOverlayHorizontalScrollbar && haveNonOverlayVerticalScrollbar) || (haveResizer && (haveNonOverlayHorizontalScrollbar || haveNonOverlayVerticalScrollbar))) && renderer.style().scrollbarWidth() != ScrollbarWidth::None;

IntSize cornerSize;
if (scrollbarsAvoidCorner) {
Expand Down Expand Up @@ -1523,7 +1523,7 @@ void RenderLayerScrollableArea::paintResizer(GraphicsContext& context, const Lay

// Draw a frame around the resizer (1px grey line) if there are any scrollbars present.
// Clipping will exclude the right and bottom edges of this frame.
if (!hasOverlayScrollbars() && (m_vBar || m_hBar)) {
if (!hasOverlayScrollbars() && (m_vBar || m_hBar) && renderer.style().scrollbarWidth() != ScrollbarWidth::None) {
GraphicsContextStateSaver stateSaver(context);
context.clip(resizerAbsRect);
LayoutRect largerCorner = resizerAbsRect;
Expand Down
6 changes: 5 additions & 1 deletion Source/WebCore/rendering/RenderTextControl.cpp
Expand Up @@ -104,7 +104,11 @@ int RenderTextControl::textBlockLogicalWidth() const
int RenderTextControl::scrollbarThickness() const
{
// FIXME: We should get the size of the scrollbar from the RenderTheme instead.
return ScrollbarTheme::theme().scrollbarThickness();
auto scrollbarSize = this->style().scrollbarWidth() == ScrollbarWidth::Thin
? ScrollbarControlSize::Small
: ScrollbarControlSize::Regular;

return ScrollbarTheme::theme().scrollbarThickness(scrollbarSize, this->style().scrollbarWidth());
}

RenderBox::LogicalExtentComputedValues RenderTextControl::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop) const
Expand Down

0 comments on commit aa4860a

Please sign in to comment.