Title: [236356] trunk/Source/WebCore
- Revision
- 236356
- Author
- [email protected]
- Date
- 2018-09-21 13:29:18 -0700 (Fri, 21 Sep 2018)
Log Message
Simplify the logic around has*ScrollbarWithAutoBehavior
https://bugs.webkit.org/show_bug.cgi?id=189813
Reviewed by Zalan Bujtas.
The boolean logic in scrollsOverflowX() and hasHorizontalScrollbarWithAutoBehavior() (and the vertical
equivalents) reduces simply to hasOverflowClip() && (style().overflowX() == Overflow::Scroll || style().overflowX() == Overflow::Auto);
Similarly, RenderBox::intrinsicScrollbarLogicalWidth() just needs the part of the logic
that asks whether the theme uses overlay scrollbars which are not customized (and thus
turned into non-overlay scrollbars).
* rendering/RenderBox.cpp:
(WebCore::RenderBox::intrinsicScrollbarLogicalWidth const):
(WebCore::RenderBox::canUseOverlayScrollbars const):
(WebCore::RenderBox::hasVerticalScrollbarWithAutoBehavior const):
(WebCore::RenderBox::hasHorizontalScrollbarWithAutoBehavior const):
* rendering/RenderBox.h:
(WebCore::RenderBox::scrollsOverflowX const):
(WebCore::RenderBox::scrollsOverflowY const):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updateScrollbarsAfterLayout):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (236355 => 236356)
--- trunk/Source/WebCore/ChangeLog 2018-09-21 20:15:29 UTC (rev 236355)
+++ trunk/Source/WebCore/ChangeLog 2018-09-21 20:29:18 UTC (rev 236356)
@@ -1,3 +1,28 @@
+2018-09-20 Simon Fraser <[email protected]>
+
+ Simplify the logic around has*ScrollbarWithAutoBehavior
+ https://bugs.webkit.org/show_bug.cgi?id=189813
+
+ Reviewed by Zalan Bujtas.
+
+ The boolean logic in scrollsOverflowX() and hasHorizontalScrollbarWithAutoBehavior() (and the vertical
+ equivalents) reduces simply to hasOverflowClip() && (style().overflowX() == Overflow::Scroll || style().overflowX() == Overflow::Auto);
+
+ Similarly, RenderBox::intrinsicScrollbarLogicalWidth() just needs the part of the logic
+ that asks whether the theme uses overlay scrollbars which are not customized (and thus
+ turned into non-overlay scrollbars).
+
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::intrinsicScrollbarLogicalWidth const):
+ (WebCore::RenderBox::canUseOverlayScrollbars const):
+ (WebCore::RenderBox::hasVerticalScrollbarWithAutoBehavior const):
+ (WebCore::RenderBox::hasHorizontalScrollbarWithAutoBehavior const):
+ * rendering/RenderBox.h:
+ (WebCore::RenderBox::scrollsOverflowX const):
+ (WebCore::RenderBox::scrollsOverflowY const):
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::updateScrollbarsAfterLayout):
+
2018-09-21 Michael Catanzaro <[email protected]>
Unreviewed, rolling out r236255.
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (236355 => 236356)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2018-09-21 20:15:29 UTC (rev 236355)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2018-09-21 20:29:18 UTC (rev 236356)
@@ -772,12 +772,12 @@
if (!hasOverflowClip())
return 0;
- if (isHorizontalWritingMode() && (style().overflowY() == Overflow::Scroll && !hasVerticalScrollbarWithAutoBehavior())) {
+ if (isHorizontalWritingMode() && (style().overflowY() == Overflow::Scroll && !canUseOverlayScrollbars())) {
ASSERT(layer() && layer()->hasVerticalScrollbar());
return verticalScrollbarWidth();
}
- if (!isHorizontalWritingMode() && (style().overflowX() == Overflow::Scroll && !hasHorizontalScrollbarWithAutoBehavior())) {
+ if (!isHorizontalWritingMode() && (style().overflowX() == Overflow::Scroll && !canUseOverlayScrollbars())) {
ASSERT(layer() && layer()->hasHorizontalScrollbar());
return horizontalScrollbarHeight();
}
@@ -934,16 +934,19 @@
layer()->panScrollFromPoint(source);
}
+bool RenderBox::canUseOverlayScrollbars() const
+{
+ return !style().hasPseudoStyle(PseudoId::Scrollbar) && ScrollbarTheme::theme().usesOverlayScrollbars();
+}
+
bool RenderBox::hasVerticalScrollbarWithAutoBehavior() const
{
- bool overflowScrollActsLikeAuto = style().overflowY() == Overflow::Scroll && !style().hasPseudoStyle(PseudoId::Scrollbar) && ScrollbarTheme::theme().usesOverlayScrollbars();
- return hasOverflowClip() && (style().overflowY() == Overflow::Auto || overflowScrollActsLikeAuto);
+ return hasOverflowClip() && (style().overflowY() == Overflow::Auto || (style().overflowY() == Overflow::Scroll && canUseOverlayScrollbars()));
}
bool RenderBox::hasHorizontalScrollbarWithAutoBehavior() const
{
- bool overflowScrollActsLikeAuto = style().overflowX() == Overflow::Scroll && !style().hasPseudoStyle(PseudoId::Scrollbar) && ScrollbarTheme::theme().usesOverlayScrollbars();
- return hasOverflowClip() && (style().overflowX() == Overflow::Auto || overflowScrollActsLikeAuto);
+ return hasOverflowClip() && (style().overflowX() == Overflow::Auto || (style().overflowX() == Overflow::Scroll && canUseOverlayScrollbars()));
}
bool RenderBox::needsPreferredWidthsRecalculation() const
Modified: trunk/Source/WebCore/rendering/RenderBox.h (236355 => 236356)
--- trunk/Source/WebCore/rendering/RenderBox.h 2018-09-21 20:15:29 UTC (rev 236355)
+++ trunk/Source/WebCore/rendering/RenderBox.h 2018-09-21 20:29:18 UTC (rev 236356)
@@ -459,10 +459,12 @@
bool hasVerticalScrollbarWithAutoBehavior() const;
bool hasHorizontalScrollbarWithAutoBehavior() const;
+
+ bool canUseOverlayScrollbars() const;
bool scrollsOverflow() const { return scrollsOverflowX() || scrollsOverflowY(); }
- bool scrollsOverflowX() const { return hasOverflowClip() && (style().overflowX() == Overflow::Scroll || hasHorizontalScrollbarWithAutoBehavior()); }
- bool scrollsOverflowY() const { return hasOverflowClip() && (style().overflowY() == Overflow::Scroll || hasVerticalScrollbarWithAutoBehavior()); }
+ bool scrollsOverflowX() const { return hasOverflowClip() && (style().overflowX() == Overflow::Scroll || style().overflowX() == Overflow::Auto); }
+ bool scrollsOverflowY() const { return hasOverflowClip() && (style().overflowY() == Overflow::Scroll || style().overflowY() == Overflow::Auto); }
bool hasHorizontalOverflow() const { return scrollWidth() != roundToInt(clientWidth()); }
bool hasVerticalOverflow() const { return scrollHeight() != roundToInt(clientHeight()); }
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (236355 => 236356)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2018-09-21 20:15:29 UTC (rev 236355)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2018-09-21 20:29:18 UTC (rev 236356)
@@ -3515,7 +3515,6 @@
if (renderer().style().overflowX() == Overflow::Auto || renderer().style().overflowY() == Overflow::Auto) {
if (!m_inOverflowRelayout) {
- // Our proprietary overflow: overlay value doesn't trigger a layout.
m_inOverflowRelayout = true;
renderer().setNeedsLayout(MarkOnlyThis);
if (is<RenderBlock>(renderer())) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes