Modified: trunk/Source/WebCore/ChangeLog (281970 => 281971)
--- trunk/Source/WebCore/ChangeLog 2021-09-03 01:17:19 UTC (rev 281970)
+++ trunk/Source/WebCore/ChangeLog 2021-09-03 01:38:18 UTC (rev 281971)
@@ -1,3 +1,20 @@
+2021-09-02 Alan Bujtas <[email protected]>
+
+ Relative -webkit-scrollbar width value may lead to unstable layout
+ https://bugs.webkit.org/show_bug.cgi?id=229833.
+ <rdar://80336247>
+
+ Reviewed by Simon Fraser.
+
+ The way we resolve the relative property value for the webkit-scrollbar width (using the owning renderer’s width) can lead to unstable layout with
+ circular dependency. While -webkit-scrollbar itself is non-standard, Chrome supports it but not with relative width/height values. They are resolved to 0px.
+ Here we use the default platform value instead.
+
+ * rendering/RenderScrollbarPart.cpp:
+ (WebCore::calcScrollbarThicknessUsing): Do not try to resolve the relative length value.
+ (WebCore::RenderScrollbarPart::computeScrollbarWidth):
+ (WebCore::RenderScrollbarPart::computeScrollbarHeight):
+
2021-09-02 Simon Fraser <[email protected]>
Changes to clip-path and filter SVG elements referenced by CSS don't trigger repaints
Modified: trunk/Source/WebCore/rendering/RenderScrollbarPart.cpp (281970 => 281971)
--- trunk/Source/WebCore/rendering/RenderScrollbarPart.cpp 2021-09-03 01:17:19 UTC (rev 281970)
+++ trunk/Source/WebCore/rendering/RenderScrollbarPart.cpp 2021-09-03 01:38:18 UTC (rev 281971)
@@ -80,10 +80,10 @@
}
}
-static int calcScrollbarThicknessUsing(SizeType sizeType, const Length& length, int containingLength)
+static int calcScrollbarThicknessUsing(SizeType sizeType, const Length& length)
{
- if (!length.isIntrinsicOrAuto() || (sizeType == MinSize && length.isAuto()))
- return minimumValueForLength(length, containingLength);
+ if ((!length.isPercentOrCalculated() && !length.isIntrinsicOrAuto()) || (sizeType == MinSize && length.isAuto()))
+ return minimumValueForLength(length, { });
return ScrollbarTheme::theme().scrollbarThickness();
}
@@ -91,17 +91,14 @@
{
if (!m_scrollbar->owningRenderer())
return;
- // FIXME: We are querying layout information but nothing guarantees that it's up-to-date, especially since we are called at style change.
- // FIXME: Querying the style's border information doesn't work on table cells with collapsing borders.
- int visibleSize = m_scrollbar->owningRenderer()->width() - m_scrollbar->owningRenderer()->style().borderLeftWidth() - m_scrollbar->owningRenderer()->style().borderRightWidth();
- int w = calcScrollbarThicknessUsing(MainOrPreferredSize, style().width(), visibleSize);
- int minWidth = calcScrollbarThicknessUsing(MinSize, style().minWidth(), visibleSize);
- int maxWidth = style().maxWidth().isUndefined() ? w : calcScrollbarThicknessUsing(MaxSize, style().maxWidth(), visibleSize);
- setWidth(std::max(minWidth, std::min(maxWidth, w)));
+ int width = calcScrollbarThicknessUsing(MainOrPreferredSize, style().width());
+ int minWidth = calcScrollbarThicknessUsing(MinSize, style().minWidth());
+ int maxWidth = style().maxWidth().isUndefined() ? width : calcScrollbarThicknessUsing(MaxSize, style().maxWidth());
+ setWidth(std::max(minWidth, std::min(maxWidth, width)));
// Buttons and track pieces can all have margins along the axis of the scrollbar.
- m_marginBox.setLeft(minimumValueForLength(style().marginLeft(), visibleSize));
- m_marginBox.setRight(minimumValueForLength(style().marginRight(), visibleSize));
+ m_marginBox.setLeft(minimumValueForLength(style().marginLeft(), { }));
+ m_marginBox.setRight(minimumValueForLength(style().marginRight(), { }));
}
void RenderScrollbarPart::computeScrollbarHeight()
@@ -108,17 +105,14 @@
{
if (!m_scrollbar->owningRenderer())
return;
- // FIXME: We are querying layout information but nothing guarantees that it's up-to-date, especially since we are called at style change.
- // FIXME: Querying the style's border information doesn't work on table cells with collapsing borders.
- int visibleSize = m_scrollbar->owningRenderer()->height() - m_scrollbar->owningRenderer()->style().borderTopWidth() - m_scrollbar->owningRenderer()->style().borderBottomWidth();
- int h = calcScrollbarThicknessUsing(MainOrPreferredSize, style().height(), visibleSize);
- int minHeight = calcScrollbarThicknessUsing(MinSize, style().minHeight(), visibleSize);
- int maxHeight = style().maxHeight().isUndefined() ? h : calcScrollbarThicknessUsing(MaxSize, style().maxHeight(), visibleSize);
- setHeight(std::max(minHeight, std::min(maxHeight, h)));
+ int height = calcScrollbarThicknessUsing(MainOrPreferredSize, style().height());
+ int minHeight = calcScrollbarThicknessUsing(MinSize, style().minHeight());
+ int maxHeight = style().maxHeight().isUndefined() ? height : calcScrollbarThicknessUsing(MaxSize, style().maxHeight());
+ setHeight(std::max(minHeight, std::min(maxHeight, height)));
// Buttons and track pieces can all have margins along the axis of the scrollbar.
- m_marginBox.setTop(minimumValueForLength(style().marginTop(), visibleSize));
- m_marginBox.setBottom(minimumValueForLength(style().marginBottom(), visibleSize));
+ m_marginBox.setTop(minimumValueForLength(style().marginTop(), { }));
+ m_marginBox.setBottom(minimumValueForLength(style().marginBottom(), { }));
}
void RenderScrollbarPart::computePreferredLogicalWidths()