Changeset 236356 in webkit
- Timestamp:
- Sep 21, 2018, 1:29:18 PM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r236352 r236356 1 2018-09-20 Simon Fraser <simon.fraser@apple.com> 2 3 Simplify the logic around has*ScrollbarWithAutoBehavior 4 https://bugs.webkit.org/show_bug.cgi?id=189813 5 6 Reviewed by Zalan Bujtas. 7 8 The boolean logic in scrollsOverflowX() and hasHorizontalScrollbarWithAutoBehavior() (and the vertical 9 equivalents) reduces simply to hasOverflowClip() && (style().overflowX() == Overflow::Scroll || style().overflowX() == Overflow::Auto); 10 11 Similarly, RenderBox::intrinsicScrollbarLogicalWidth() just needs the part of the logic 12 that asks whether the theme uses overlay scrollbars which are not customized (and thus 13 turned into non-overlay scrollbars). 14 15 * rendering/RenderBox.cpp: 16 (WebCore::RenderBox::intrinsicScrollbarLogicalWidth const): 17 (WebCore::RenderBox::canUseOverlayScrollbars const): 18 (WebCore::RenderBox::hasVerticalScrollbarWithAutoBehavior const): 19 (WebCore::RenderBox::hasHorizontalScrollbarWithAutoBehavior const): 20 * rendering/RenderBox.h: 21 (WebCore::RenderBox::scrollsOverflowX const): 22 (WebCore::RenderBox::scrollsOverflowY const): 23 * rendering/RenderLayer.cpp: 24 (WebCore::RenderLayer::updateScrollbarsAfterLayout): 25 1 26 2018-09-21 Michael Catanzaro <mcatanzaro@igalia.com> 2 27 -
trunk/Source/WebCore/rendering/RenderBox.cpp
r236341 r236356 773 773 return 0; 774 774 775 if (isHorizontalWritingMode() && (style().overflowY() == Overflow::Scroll && ! hasVerticalScrollbarWithAutoBehavior())) {775 if (isHorizontalWritingMode() && (style().overflowY() == Overflow::Scroll && !canUseOverlayScrollbars())) { 776 776 ASSERT(layer() && layer()->hasVerticalScrollbar()); 777 777 return verticalScrollbarWidth(); 778 778 } 779 779 780 if (!isHorizontalWritingMode() && (style().overflowX() == Overflow::Scroll && ! hasHorizontalScrollbarWithAutoBehavior())) {780 if (!isHorizontalWritingMode() && (style().overflowX() == Overflow::Scroll && !canUseOverlayScrollbars())) { 781 781 ASSERT(layer() && layer()->hasHorizontalScrollbar()); 782 782 return horizontalScrollbarHeight(); … … 935 935 } 936 936 937 bool RenderBox::canUseOverlayScrollbars() const 938 { 939 return !style().hasPseudoStyle(PseudoId::Scrollbar) && ScrollbarTheme::theme().usesOverlayScrollbars(); 940 } 941 937 942 bool RenderBox::hasVerticalScrollbarWithAutoBehavior() const 938 943 { 939 bool overflowScrollActsLikeAuto = style().overflowY() == Overflow::Scroll && !style().hasPseudoStyle(PseudoId::Scrollbar) && ScrollbarTheme::theme().usesOverlayScrollbars(); 940 return hasOverflowClip() && (style().overflowY() == Overflow::Auto || overflowScrollActsLikeAuto); 944 return hasOverflowClip() && (style().overflowY() == Overflow::Auto || (style().overflowY() == Overflow::Scroll && canUseOverlayScrollbars())); 941 945 } 942 946 943 947 bool RenderBox::hasHorizontalScrollbarWithAutoBehavior() const 944 948 { 945 bool overflowScrollActsLikeAuto = style().overflowX() == Overflow::Scroll && !style().hasPseudoStyle(PseudoId::Scrollbar) && ScrollbarTheme::theme().usesOverlayScrollbars(); 946 return hasOverflowClip() && (style().overflowX() == Overflow::Auto || overflowScrollActsLikeAuto); 949 return hasOverflowClip() && (style().overflowX() == Overflow::Auto || (style().overflowX() == Overflow::Scroll && canUseOverlayScrollbars())); 947 950 } 948 951 -
trunk/Source/WebCore/rendering/RenderBox.h
r234619 r236356 460 460 bool hasVerticalScrollbarWithAutoBehavior() const; 461 461 bool hasHorizontalScrollbarWithAutoBehavior() const; 462 463 bool canUseOverlayScrollbars() const; 462 464 463 465 bool scrollsOverflow() const { return scrollsOverflowX() || scrollsOverflowY(); } 464 bool scrollsOverflowX() const { return hasOverflowClip() && (style().overflowX() == Overflow::Scroll || hasHorizontalScrollbarWithAutoBehavior()); }465 bool scrollsOverflowY() const { return hasOverflowClip() && (style().overflowY() == Overflow::Scroll || hasVerticalScrollbarWithAutoBehavior()); }466 bool scrollsOverflowX() const { return hasOverflowClip() && (style().overflowX() == Overflow::Scroll || style().overflowX() == Overflow::Auto); } 467 bool scrollsOverflowY() const { return hasOverflowClip() && (style().overflowY() == Overflow::Scroll || style().overflowY() == Overflow::Auto); } 466 468 467 469 bool hasHorizontalOverflow() const { return scrollWidth() != roundToInt(clientWidth()); } -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r236341 r236356 3516 3516 if (renderer().style().overflowX() == Overflow::Auto || renderer().style().overflowY() == Overflow::Auto) { 3517 3517 if (!m_inOverflowRelayout) { 3518 // Our proprietary overflow: overlay value doesn't trigger a layout.3519 3518 m_inOverflowRelayout = true; 3520 3519 renderer().setNeedsLayout(MarkOnlyThis);
Note:
See TracChangeset
for help on using the changeset viewer.