Diff
Modified: trunk/Source/WebCore/ChangeLog (285315 => 285316)
--- trunk/Source/WebCore/ChangeLog 2021-11-04 21:43:02 UTC (rev 285315)
+++ trunk/Source/WebCore/ChangeLog 2021-11-04 21:58:31 UTC (rev 285316)
@@ -1,3 +1,94 @@
+2021-11-04 Nikolaos Mouchtaris <[email protected]>
+
+ Make scrollbar orientation an enum class
+ https://bugs.webkit.org/show_bug.cgi?id=232648
+
+ Reviewed by Simon Fraser.
+
+ * accessibility/AccessibilityScrollbar.cpp:
+ (WebCore::AccessibilityScrollbar::orientation const):
+ * css/SelectorChecker.h:
+ * css/SelectorCheckerTestFunctions.h:
+ (WebCore::scrollbarMatchesHorizontalPseudoClass):
+ (WebCore::scrollbarMatchesVerticalPseudoClass):
+ * page/FrameView.cpp:
+ (WebCore::FrameView::horizontalScrollbarHiddenByStyle const):
+ (WebCore::FrameView::verticalScrollbarHiddenByStyle const):
+ (WebCore::FrameView::performSizeToContentAutoSize):
+ (WebCore::FrameView::adjustScrollStepForFixedContent):
+ * page/scrolling/AsyncScrollingCoordinator.cpp:
+ (WebCore::AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange):
+ * platform/ScrollAnimator.cpp:
+ (WebCore::ScrollAnimator::scroll):
+ (WebCore::ScrollAnimator::deltaFromStep):
+ (WebCore::ScrollAnimator::handleWheelEvent):
+ * platform/ScrollTypes.h:
+ * platform/ScrollView.cpp:
+ (WebCore::ScrollView::setHasHorizontalScrollbar):
+ (WebCore::ScrollView::setHasVerticalScrollbar):
+ * platform/ScrollableArea.cpp:
+ (WebCore::ScrollableArea::scroll):
+ (WebCore::ScrollableArea::scrollToOffsetWithoutAnimation):
+ (WebCore::ScrollableArea::didAddScrollbar):
+ (WebCore::ScrollableArea::willRemoveScrollbar):
+ (WebCore::ScrollableArea::doPostThumbMoveSnapping):
+ * platform/ScrollableArea.h:
+ (WebCore::offsetForOrientation):
+ * platform/Scrollbar.cpp:
+ (WebCore::Scrollbar::pressedPartScrollDirection):
+ (WebCore::Scrollbar::moveThumb):
+ (WebCore::Scrollbar::mouseMoved):
+ (WebCore::Scrollbar::mouseDown):
+ * platform/ScrollbarThemeComposite.cpp:
+ (WebCore::ScrollbarThemeComposite::splitTrack):
+ (WebCore::ScrollbarThemeComposite::trackPosition):
+ (WebCore::ScrollbarThemeComposite::trackLength):
+ * platform/mac/ScrollbarThemeMac.mm:
+ (WebCore::ScrollbarThemeMac::registerScrollbar):
+ (WebCore::ScrollbarThemeMac::hasButtons):
+ (WebCore::ScrollbarThemeMac::hasThumb):
+ (WebCore::buttonRepaintRect):
+ (WebCore::ScrollbarThemeMac::backButtonRect):
+ (WebCore::ScrollbarThemeMac::forwardButtonRect):
+ (WebCore::ScrollbarThemeMac::trackRect):
+ * platform/mac/ScrollbarsControllerMac.mm:
+ (-[WebScrollerImpDelegate layer]):
+ (-[WebScrollerImpDelegate setUpAlphaAnimation:scrollerPainter:part:animateAlphaTo:duration:]):
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::hasAutoScrollbar const):
+ (WebCore::RenderBox::hasAlwaysPresentScrollbar const):
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::updateOverflowControlsLayers):
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
+ (WebCore::RenderLayerCompositor::destroyRootLayer):
+ * rendering/RenderLayerScrollableArea.cpp:
+ (WebCore::RenderLayerScrollableArea::clear):
+ (WebCore::RenderLayerScrollableArea::destroyScrollbar):
+ (WebCore::RenderLayerScrollableArea::setHasHorizontalScrollbar):
+ (WebCore::RenderLayerScrollableArea::setHasVerticalScrollbar):
+ (WebCore::RenderLayerScrollableArea::updateScrollbarPresenceAndState):
+ (WebCore::RenderLayerScrollableArea::updateScrollbarsAfterLayout):
+ * rendering/RenderListBox.cpp:
+ (WebCore::RenderListBox::layout):
+ (WebCore::RenderListBox::scrollToRevealElementAtListIndex):
+ (WebCore::RenderListBox::setScrollTop):
+ (WebCore::RenderListBox::createScrollbar):
+ (WebCore::RenderListBox::destroyScrollbar):
+ * rendering/RenderScrollbar.cpp:
+ (WebCore::RenderScrollbar::RenderScrollbar):
+ (WebCore::RenderScrollbar::updateScrollbarParts):
+ (WebCore::RenderScrollbar::buttonRect const):
+ (WebCore::RenderScrollbar::trackRect const):
+ (WebCore::RenderScrollbar::trackPieceRectWithMargins const):
+ (WebCore::RenderScrollbar::minimumThumbLength const):
+ * rendering/RenderScrollbarPart.cpp:
+ (WebCore::RenderScrollbarPart::layout):
+ * rendering/RenderScrollbarTheme.cpp:
+ (WebCore::RenderScrollbarTheme::buttonSizesAlongTrackAxis):
+ (WebCore::RenderScrollbarTheme::hasButtons):
+ (WebCore::RenderScrollbarTheme::constrainTrackRectToTrackPieces):
+
2021-11-04 Alex Christensen <[email protected]>
[ iOS ] TestWebKitAPI.WebKitLegacy.AudioSessionCategoryIOS is crashing
Modified: trunk/Source/WebCore/accessibility/AccessibilityScrollbar.cpp (285315 => 285316)
--- trunk/Source/WebCore/accessibility/AccessibilityScrollbar.cpp 2021-11-04 21:43:02 UTC (rev 285315)
+++ trunk/Source/WebCore/accessibility/AccessibilityScrollbar.cpp 2021-11-04 21:58:31 UTC (rev 285316)
@@ -69,9 +69,9 @@
if (!m_scrollbar)
return AccessibilityOrientation::Vertical;
- if (m_scrollbar->orientation() == HorizontalScrollbar)
+ if (m_scrollbar->orientation() == ScrollbarOrientation::Horizontal)
return AccessibilityOrientation::Horizontal;
- if (m_scrollbar->orientation() == VerticalScrollbar)
+ if (m_scrollbar->orientation() == ScrollbarOrientation::Vertical)
return AccessibilityOrientation::Vertical;
return AccessibilityOrientation::Vertical;
Modified: trunk/Source/WebCore/css/SelectorChecker.h (285315 => 285316)
--- trunk/Source/WebCore/css/SelectorChecker.h 2021-11-04 21:43:02 UTC (rev 285315)
+++ trunk/Source/WebCore/css/SelectorChecker.h 2021-11-04 21:58:31 UTC (rev 285316)
@@ -43,7 +43,7 @@
ScrollbarPart scrollbarPart { NoPart };
ScrollbarPart hoveredPart { NoPart };
ScrollbarPart pressedPart { NoPart };
- ScrollbarOrientation orientation { VerticalScrollbar };
+ ScrollbarOrientation orientation { ScrollbarOrientation::Vertical };
ScrollbarButtonsPlacement buttonsPlacement { ScrollbarButtonsNone };
bool enabled { false };
bool scrollCornerIsVisible { false };
Modified: trunk/Source/WebCore/css/SelectorCheckerTestFunctions.h (285315 => 285316)
--- trunk/Source/WebCore/css/SelectorCheckerTestFunctions.h 2021-11-04 21:43:02 UTC (rev 285315)
+++ trunk/Source/WebCore/css/SelectorCheckerTestFunctions.h 2021-11-04 21:58:31 UTC (rev 285316)
@@ -295,12 +295,12 @@
ALWAYS_INLINE bool scrollbarMatchesHorizontalPseudoClass(const SelectorChecker::CheckingContext& context)
{
- return context.scrollbarState && context.scrollbarState->orientation == HorizontalScrollbar;
+ return context.scrollbarState && context.scrollbarState->orientation == ScrollbarOrientation::Horizontal;
}
ALWAYS_INLINE bool scrollbarMatchesVerticalPseudoClass(const SelectorChecker::CheckingContext& context)
{
- return context.scrollbarState && context.scrollbarState->orientation == VerticalScrollbar;
+ return context.scrollbarState && context.scrollbarState->orientation == ScrollbarOrientation::Vertical;
}
ALWAYS_INLINE bool scrollbarMatchesDecrementPseudoClass(const SelectorChecker::CheckingContext& context)
Modified: trunk/Source/WebCore/page/FrameView.cpp (285315 => 285316)
--- trunk/Source/WebCore/page/FrameView.cpp 2021-11-04 21:43:02 UTC (rev 285315)
+++ trunk/Source/WebCore/page/FrameView.cpp 2021-11-04 21:58:31 UTC (rev 285316)
@@ -1494,7 +1494,7 @@
return scrollbar && scrollbar->isHiddenByStyle();
}
- return styleHidesScrollbarWithOrientation(HorizontalScrollbar);
+ return styleHidesScrollbarWithOrientation(ScrollbarOrientation::Horizontal);
}
bool FrameView::verticalScrollbarHiddenByStyle() const
@@ -1504,7 +1504,7 @@
return scrollbar && scrollbar->isHiddenByStyle();
}
- return styleHidesScrollbarWithOrientation(VerticalScrollbar);
+ return styleHidesScrollbarWithOrientation(ScrollbarOrientation::Vertical);
}
void FrameView::setCannotBlitToWindow()
@@ -3588,7 +3588,7 @@
if (newSize.width() > m_autoSizeConstraint.width()) {
RefPtr<Scrollbar> localHorizontalScrollbar = horizontalScrollbar();
if (!localHorizontalScrollbar)
- localHorizontalScrollbar = createScrollbar(HorizontalScrollbar);
+ localHorizontalScrollbar = createScrollbar(ScrollbarOrientation::Horizontal);
newSize.expand(0, localHorizontalScrollbar->occupiedHeight());
// Don't bother checking for a vertical scrollbar because the width is at
// already greater the maximum.
@@ -3595,7 +3595,7 @@
} else if (newSize.height() > m_autoSizeConstraint.height()) {
RefPtr<Scrollbar> localVerticalScrollbar = verticalScrollbar();
if (!localVerticalScrollbar)
- localVerticalScrollbar = createScrollbar(VerticalScrollbar);
+ localVerticalScrollbar = createScrollbar(ScrollbarOrientation::Vertical);
newSize.expand(localVerticalScrollbar->occupiedWidth(), 0);
// Don't bother checking for a horizontal scrollbar because the height is
// already greater the maximum.
@@ -3817,7 +3817,7 @@
float FrameView::adjustScrollStepForFixedContent(float step, ScrollbarOrientation orientation, ScrollGranularity granularity)
{
- if (granularity != ScrollByPage || orientation == HorizontalScrollbar)
+ if (granularity != ScrollByPage || orientation == ScrollbarOrientation::Horizontal)
return step;
TrackedRendererListHashSet* positionedObjects = nullptr;
Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (285315 => 285316)
--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp 2021-11-04 21:43:02 UTC (rev 285315)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp 2021-11-04 21:58:31 UTC (rev 285316)
@@ -613,13 +613,13 @@
auto* node = m_scrollingStateTree->stateNodeForID(scrollableArea.scrollingNodeID());
if (is<ScrollingStateScrollingNode>(node)) {
auto& scrollingNode = downcast<ScrollingStateScrollingNode>(*node);
- if (orientation == VerticalScrollbar)
+ if (orientation == ScrollbarOrientation::Vertical)
scrollingNode.setVerticalScrollbarLayer(scrollableArea.layerForVerticalScrollbar());
else
scrollingNode.setHorizontalScrollbarLayer(scrollableArea.layerForHorizontalScrollbar());
}
- if (orientation == VerticalScrollbar)
+ if (orientation == ScrollbarOrientation::Vertical)
scrollableArea.verticalScrollbarLayerDidChange();
else
scrollableArea.horizontalScrollbarLayerDidChange();
Modified: trunk/Source/WebCore/platform/ScrollAnimator.cpp (285315 => 285316)
--- trunk/Source/WebCore/platform/ScrollAnimator.cpp 2021-11-04 21:43:02 UTC (rev 285315)
+++ trunk/Source/WebCore/platform/ScrollAnimator.cpp 2021-11-04 21:58:31 UTC (rev 285316)
@@ -75,16 +75,16 @@
auto currentOffset = offsetFromPosition(currentPosition());
auto newOffset = currentOffset + delta;
- if (orientation == HorizontalScrollbar)
+ if (orientation == ScrollbarOrientation::Horizontal)
newOffset.setX(m_scrollController.adjustedScrollDestination(ScrollEventAxis::Horizontal, newOffset, multiplier, currentOffset.x()));
else
newOffset.setY(m_scrollController.adjustedScrollDestination(ScrollEventAxis::Vertical, newOffset, multiplier, currentOffset.y()));
auto newDelta = newOffset - currentOffset;
- if (orientation == HorizontalScrollbar)
- return scroll(HorizontalScrollbar, granularity, newDelta.width(), 1.0, behavior);
+ if (orientation == ScrollbarOrientation::Horizontal)
+ return scroll(ScrollbarOrientation::Horizontal, granularity, newDelta.width(), 1.0, behavior);
- return scroll(VerticalScrollbar, granularity, newDelta.height(), 1.0, behavior);
+ return scroll(ScrollbarOrientation::Vertical, granularity, newDelta.height(), 1.0, behavior);
}
if (m_scrollableArea.scrollAnimatorEnabled() && platformAllowsScrollAnimation() && !behavior.contains(ScrollBehavior::NeverAnimate)) {
@@ -144,7 +144,7 @@
FloatSize ScrollAnimator::deltaFromStep(ScrollbarOrientation orientation, float step, float multiplier)
{
FloatSize delta;
- if (orientation == HorizontalScrollbar)
+ if (orientation == ScrollbarOrientation::Horizontal)
delta.setWidth(step * multiplier);
else
delta.setHeight(step * multiplier);
@@ -217,7 +217,7 @@
if (negative)
deltaY = -deltaY;
}
- scroll(VerticalScrollbar, ScrollByPixel, verticalScrollbar->pixelStep(), -deltaY, behavior);
+ scroll(ScrollbarOrientation::Vertical, ScrollByPixel, verticalScrollbar->pixelStep(), -deltaY, behavior);
}
if (deltaX) {
@@ -227,7 +227,7 @@
if (negative)
deltaX = -deltaX;
}
- scroll(HorizontalScrollbar, ScrollByPixel, horizontalScrollbar->pixelStep(), -deltaX, behavior);
+ scroll(ScrollbarOrientation::Horizontal, ScrollByPixel, horizontalScrollbar->pixelStep(), -deltaX, behavior);
}
}
return handled;
Modified: trunk/Source/WebCore/platform/ScrollTypes.h (285315 => 285316)
--- trunk/Source/WebCore/platform/ScrollTypes.h 2021-11-04 21:43:02 UTC (rev 285315)
+++ trunk/Source/WebCore/platform/ScrollTypes.h 2021-11-04 21:58:31 UTC (rev 285316)
@@ -143,9 +143,9 @@
ScrollElasticityAllowed
};
-enum ScrollbarOrientation : uint8_t {
- HorizontalScrollbar,
- VerticalScrollbar
+enum class ScrollbarOrientation : uint8_t {
+ Horizontal,
+ Vertical
};
enum ScrollbarMode : uint8_t {
Modified: trunk/Source/WebCore/platform/ScrollView.cpp (285315 => 285316)
--- trunk/Source/WebCore/platform/ScrollView.cpp 2021-11-04 21:43:02 UTC (rev 285315)
+++ trunk/Source/WebCore/platform/ScrollView.cpp 2021-11-04 21:58:31 UTC (rev 285316)
@@ -67,12 +67,12 @@
bool ScrollView::setHasHorizontalScrollbar(bool hasBar, bool* contentSizeAffected)
{
- return setHasScrollbarInternal(m_horizontalScrollbar, HorizontalScrollbar, hasBar, contentSizeAffected);
+ return setHasScrollbarInternal(m_horizontalScrollbar, ScrollbarOrientation::Horizontal, hasBar, contentSizeAffected);
}
bool ScrollView::setHasVerticalScrollbar(bool hasBar, bool* contentSizeAffected)
{
- return setHasScrollbarInternal(m_verticalScrollbar, VerticalScrollbar, hasBar, contentSizeAffected);
+ return setHasScrollbarInternal(m_verticalScrollbar, ScrollbarOrientation::Vertical, hasBar, contentSizeAffected);
}
bool ScrollView::setHasScrollbarInternal(RefPtr<Scrollbar>& scrollbar, ScrollbarOrientation orientation, bool hasBar, bool* contentSizeAffected)
Modified: trunk/Source/WebCore/platform/ScrollableArea.cpp (285315 => 285316)
--- trunk/Source/WebCore/platform/ScrollableArea.cpp 2021-11-04 21:43:02 UTC (rev 285315)
+++ trunk/Source/WebCore/platform/ScrollableArea.cpp 2021-11-04 21:58:31 UTC (rev 285316)
@@ -101,10 +101,10 @@
ScrollbarOrientation orientation;
Scrollbar* scrollbar;
if (direction == ScrollUp || direction == ScrollDown) {
- orientation = VerticalScrollbar;
+ orientation = ScrollbarOrientation::Vertical;
scrollbar = verticalScrollbar();
} else {
- orientation = HorizontalScrollbar;
+ orientation = ScrollbarOrientation::Horizontal;
scrollbar = horizontalScrollbar();
}
@@ -163,7 +163,7 @@
void ScrollableArea::scrollToOffsetWithoutAnimation(ScrollbarOrientation orientation, float offset)
{
auto currentPosition = scrollAnimator().currentPosition();
- if (orientation == HorizontalScrollbar)
+ if (orientation == ScrollbarOrientation::Horizontal)
scrollAnimator().scrollToPositionWithoutAnimation(FloatPoint(offset, currentPosition.y()));
else
scrollAnimator().scrollToPositionWithoutAnimation(FloatPoint(currentPosition.x(), offset));
@@ -325,7 +325,7 @@
void ScrollableArea::didAddScrollbar(Scrollbar* scrollbar, ScrollbarOrientation orientation)
{
- if (orientation == VerticalScrollbar)
+ if (orientation == ScrollbarOrientation::Vertical)
scrollbarsController().didAddVerticalScrollbar(scrollbar);
else
scrollbarsController().didAddHorizontalScrollbar(scrollbar);
@@ -338,7 +338,7 @@
void ScrollableArea::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation orientation)
{
- if (orientation == VerticalScrollbar)
+ if (orientation == ScrollbarOrientation::Vertical)
scrollbarsController().willRemoveVerticalScrollbar(scrollbar);
else
scrollbarsController().willRemoveHorizontalScrollbar(scrollbar);
@@ -565,7 +565,7 @@
auto currentOffset = scrollOffset();
auto newOffset = currentOffset;
- if (orientation == HorizontalScrollbar)
+ if (orientation == ScrollbarOrientation::Horizontal)
newOffset.setX(scrollAnimator->scrollOffsetAdjustedForSnapping(ScrollEventAxis::Horizontal, currentOffset, ScrollSnapPointSelectionMethod::Closest));
else
newOffset.setY(scrollAnimator->scrollOffsetAdjustedForSnapping(ScrollEventAxis::Vertical, currentOffset, ScrollSnapPointSelectionMethod::Closest));
Modified: trunk/Source/WebCore/platform/ScrollableArea.h (285315 => 285316)
--- trunk/Source/WebCore/platform/ScrollableArea.h 2021-11-04 21:43:02 UTC (rev 285315)
+++ trunk/Source/WebCore/platform/ScrollableArea.h 2021-11-04 21:58:31 UTC (rev 285316)
@@ -54,8 +54,8 @@
inline int offsetForOrientation(ScrollOffset offset, ScrollbarOrientation orientation)
{
switch (orientation) {
- case HorizontalScrollbar: return offset.x();
- case VerticalScrollbar: return offset.y();
+ case ScrollbarOrientation::Horizontal: return offset.x();
+ case ScrollbarOrientation::Vertical: return offset.y();
}
ASSERT_NOT_REACHED();
return 0;
Modified: trunk/Source/WebCore/platform/Scrollbar.cpp (285315 => 285316)
--- trunk/Source/WebCore/platform/Scrollbar.cpp 2021-11-04 21:43:02 UTC (rev 285315)
+++ trunk/Source/WebCore/platform/Scrollbar.cpp 2021-11-04 21:58:31 UTC (rev 285316)
@@ -220,7 +220,7 @@
ScrollDirection Scrollbar::pressedPartScrollDirection()
{
- if (m_orientation == HorizontalScrollbar) {
+ if (m_orientation == ScrollbarOrientation::Horizontal) {
if (m_pressedPart == BackButtonStartPart || m_pressedPart == BackButtonEndPart || m_pressedPart == BackTrackPart)
return ScrollLeft;
return ScrollRight;
@@ -247,7 +247,7 @@
delta = pos - m_documentDragPos;
m_draggingDocument = true;
FloatPoint currentPosition = m_scrollableArea.scrollAnimator().currentPosition();
- int destinationPosition = (m_orientation == HorizontalScrollbar ? currentPosition.x() : currentPosition.y()) + delta;
+ int destinationPosition = (m_orientation == ScrollbarOrientation::Horizontal ? currentPosition.x() : currentPosition.y()) + delta;
if (delta > 0)
destinationPosition = std::min(destinationPosition + delta, maximum());
else if (delta < 0)
@@ -310,7 +310,7 @@
if (theme().shouldSnapBackToDragOrigin(*this, evt))
m_scrollableArea.scrollToOffsetWithoutAnimation(m_orientation, m_dragOrigin);
else {
- moveThumb(m_orientation == HorizontalScrollbar ?
+ moveThumb(m_orientation == ScrollbarOrientation::Horizontal ?
convertFromContainingWindow(evt.position()).x() :
convertFromContainingWindow(evt.position()).y(), theme().shouldDragDocumentInsteadOfThumb(*this, evt));
}
@@ -318,7 +318,7 @@
}
if (m_pressedPart != NoPart)
- m_pressedPos = (orientation() == HorizontalScrollbar ? convertFromContainingWindow(evt.position()).x() : convertFromContainingWindow(evt.position()).y());
+ m_pressedPos = (orientation() == ScrollbarOrientation::Horizontal ? convertFromContainingWindow(evt.position()).x() : convertFromContainingWindow(evt.position()).y());
ScrollbarPart part = theme().hitTest(*this, evt.position());
if (part != m_hoveredPart) {
@@ -387,7 +387,7 @@
m_scrollableArea.mouseIsDownInScrollbar(this, true);
setPressedPart(pressedPart);
- int pressedPosition = (orientation() == HorizontalScrollbar ? convertFromContainingWindow(evt.position()).x() : convertFromContainingWindow(evt.position()).y());
+ int pressedPosition = (orientation() == ScrollbarOrientation::Horizontal ? convertFromContainingWindow(evt.position()).x() : convertFromContainingWindow(evt.position()).y());
if (action == ScrollbarButtonPressAction::CenterOnThumb) {
setHoveredPart(ThumbPart);
setPressedPart(ThumbPart);
Modified: trunk/Source/WebCore/platform/ScrollbarThemeComposite.cpp (285315 => 285316)
--- trunk/Source/WebCore/platform/ScrollbarThemeComposite.cpp 2021-11-04 21:43:02 UTC (rev 285315)
+++ trunk/Source/WebCore/platform/ScrollbarThemeComposite.cpp 2021-11-04 21:58:31 UTC (rev 285316)
@@ -193,9 +193,9 @@
// This function won't even get called unless we're big enough to have some combination of these three rects where at least
// one of them is non-empty.
IntRect trackRect = constrainTrackRectToTrackPieces(scrollbar, unconstrainedTrackRect);
- int thickness = scrollbar.orientation() == HorizontalScrollbar ? scrollbar.height() : scrollbar.width();
+ int thickness = scrollbar.orientation() == ScrollbarOrientation::Horizontal ? scrollbar.height() : scrollbar.width();
int thumbPos = thumbPosition(scrollbar);
- if (scrollbar.orientation() == HorizontalScrollbar) {
+ if (scrollbar.orientation() == ScrollbarOrientation::Horizontal) {
thumbRect = IntRect(trackRect.x() + thumbPos, trackRect.y() + (trackRect.height() - thickness) / 2, thumbLength(scrollbar), thickness);
beforeThumbRect = IntRect(trackRect.x(), trackRect.y(), thumbPos + thumbRect.width() / 2, trackRect.height());
afterThumbRect = IntRect(trackRect.x() + beforeThumbRect.width(), trackRect.y(), trackRect.maxX() - beforeThumbRect.maxX(), trackRect.height());
@@ -251,13 +251,13 @@
int ScrollbarThemeComposite::trackPosition(Scrollbar& scrollbar)
{
IntRect constrainedTrackRect = constrainTrackRectToTrackPieces(scrollbar, trackRect(scrollbar));
- return (scrollbar.orientation() == HorizontalScrollbar) ? constrainedTrackRect.x() - scrollbar.x() : constrainedTrackRect.y() - scrollbar.y();
+ return (scrollbar.orientation() == ScrollbarOrientation::Horizontal) ? constrainedTrackRect.x() - scrollbar.x() : constrainedTrackRect.y() - scrollbar.y();
}
int ScrollbarThemeComposite::trackLength(Scrollbar& scrollbar)
{
IntRect constrainedTrackRect = constrainTrackRectToTrackPieces(scrollbar, trackRect(scrollbar));
- return (scrollbar.orientation() == HorizontalScrollbar) ? constrainedTrackRect.width() : constrainedTrackRect.height();
+ return (scrollbar.orientation() == ScrollbarOrientation::Horizontal) ? constrainedTrackRect.width() : constrainedTrackRect.height();
}
IntRect ScrollbarThemeComposite::thumbRect(Scrollbar& scrollbar)
Modified: trunk/Source/WebCore/platform/adwaita/ScrollbarThemeAdwaita.cpp (285315 => 285316)
--- trunk/Source/WebCore/platform/adwaita/ScrollbarThemeAdwaita.cpp 2021-11-04 21:43:02 UTC (rev 285315)
+++ trunk/Source/WebCore/platform/adwaita/ScrollbarThemeAdwaita.cpp 2021-11-04 21:58:31 UTC (rev 285316)
@@ -165,7 +165,7 @@
graphicsContext.fillRect(rect, scrollbarBackgroundColor);
IntRect frame = rect;
- if (scrollbar.orientation() == VerticalScrollbar) {
+ if (scrollbar.orientation() == ScrollbarOrientation::Vertical) {
if (scrollbar.scrollableArea().shouldPlaceVerticalScrollbarOnLeft())
frame.move(frame.width() - hoveredScrollbarBorderSize, 0);
frame.setWidth(hoveredScrollbarBorderSize);
@@ -182,7 +182,7 @@
int overlayThumbMargin = thumbMargin - thumbBorderSize;
thumbCornerSize = overlayThumbSize / 2;
- if (scrollbar.orientation() == VerticalScrollbar) {
+ if (scrollbar.orientation() == ScrollbarOrientation::Vertical) {
if (scrollbar.scrollableArea().shouldPlaceVerticalScrollbarOnLeft())
thumb.move(0, thumbPos + overlayThumbMargin);
else
@@ -198,7 +198,7 @@
int thumbSize = scrollbarSize - hoveredScrollbarBorderSize - thumbMargin * 2;
thumbCornerSize = thumbSize / 2;
- if (scrollbar.orientation() == VerticalScrollbar) {
+ if (scrollbar.orientation() == ScrollbarOrientation::Vertical) {
if (scrollbar.scrollableArea().shouldPlaceVerticalScrollbarOnLeft())
thumb.move(scrollbarSize - (scrollbarSize / 2 + thumbSize / 2) - hoveredScrollbarBorderSize, thumbPos + thumbMargin);
else
Modified: trunk/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp (285315 => 285316)
--- trunk/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp 2021-11-04 21:43:02 UTC (rev 285315)
+++ trunk/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp 2021-11-04 21:58:31 UTC (rev 285316)
@@ -141,7 +141,7 @@
static RenderThemeScrollbar::Type widgetTypeForScrollbar(Scrollbar& scrollbar, GtkStateFlags scrollbarState)
{
- if (scrollbar.orientation() == VerticalScrollbar) {
+ if (scrollbar.orientation() == ScrollbarOrientation::Vertical) {
if (scrollbar.scrollableArea().shouldPlaceVerticalScrollbarOnLeft())
return scrollbarState & GTK_STATE_FLAG_PRELIGHT ? RenderThemeScrollbar::Type::VerticalScrollbarLeft : RenderThemeScrollbar::Type::VerticalScrollIndicatorLeft;
return scrollbarState & GTK_STATE_FLAG_PRELIGHT ? RenderThemeScrollbar::Type::VerticalScrollbarRight : RenderThemeScrollbar::Type::VerticalScrollIndicatorRight;
@@ -177,7 +177,7 @@
if (auto* backwardStepper = scrollbarWidget.stepper(RenderThemeScrollbarGadget::Steppers::Backward)) {
backwardStepper->setState(scrollbarPartStateFlags(scrollbar, BackButtonStartPart));
IntSize stepperSize = backwardStepper->preferredSize();
- if (scrollbar.orientation() == VerticalScrollbar) {
+ if (scrollbar.orientation() == ScrollbarOrientation::Vertical) {
rect.move(0, stepperSize.height());
rect.contract(0, stepperSize.height());
} else {
@@ -188,7 +188,7 @@
if (auto* secondaryForwardStepper = scrollbarWidget.stepper(RenderThemeScrollbarGadget::Steppers::SecondaryForward)) {
secondaryForwardStepper->setState(scrollbarPartStateFlags(scrollbar, ForwardButtonStartPart));
IntSize stepperSize = secondaryForwardStepper->preferredSize();
- if (scrollbar.orientation() == VerticalScrollbar) {
+ if (scrollbar.orientation() == ScrollbarOrientation::Vertical) {
rect.move(0, stepperSize.height());
rect.contract(0, stepperSize.height());
} else {
@@ -198,7 +198,7 @@
}
if (auto* secondaryBackwardStepper = scrollbarWidget.stepper(RenderThemeScrollbarGadget::Steppers::SecondaryBackward)) {
secondaryBackwardStepper->setState(scrollbarPartStateFlags(scrollbar, BackButtonEndPart));
- if (scrollbar.orientation() == VerticalScrollbar)
+ if (scrollbar.orientation() == ScrollbarOrientation::Vertical)
rect.contract(0, secondaryBackwardStepper->preferredSize().height());
else
rect.contract(secondaryBackwardStepper->preferredSize().width(), 0);
@@ -205,13 +205,13 @@
}
if (auto* forwardStepper = scrollbarWidget.stepper(RenderThemeScrollbarGadget::Steppers::Forward)) {
forwardStepper->setState(scrollbarPartStateFlags(scrollbar, ForwardButtonEndPart));
- if (scrollbar.orientation() == VerticalScrollbar)
+ if (scrollbar.orientation() == ScrollbarOrientation::Vertical)
rect.contract(0, forwardStepper->preferredSize().height());
else
rect.contract(forwardStepper->preferredSize().width(), 0);
}
- if (scrollbar.orientation() == VerticalScrollbar)
+ if (scrollbar.orientation() == ScrollbarOrientation::Vertical)
return scrollbar.height() < rect.height() ? IntRect() : rect;
return scrollbar.width() < rect.width() ? IntRect() : rect;
@@ -241,7 +241,7 @@
if (auto* secondaryForwardStepper = scrollbarWidget.stepper(RenderThemeScrollbarGadget::Steppers::SecondaryForward)) {
secondaryForwardStepper->setState(scrollbarPartStateFlags(scrollbar, ForwardButtonStartPart));
IntSize preferredSize = secondaryForwardStepper->preferredSize();
- if (scrollbar.orientation() == VerticalScrollbar) {
+ if (scrollbar.orientation() == ScrollbarOrientation::Vertical) {
rect.move(0, preferredSize.height());
rect.contract(0, preferredSize.height());
} else {
@@ -252,7 +252,7 @@
if (auto* secondaryBackwardStepper = scrollbarWidget.stepper(RenderThemeScrollbarGadget::Steppers::SecondaryBackward)) {
secondaryBackwardStepper->setState(scrollbarPartStateFlags(scrollbar, BackButtonEndPart));
- if (scrollbar.orientation() == VerticalScrollbar)
+ if (scrollbar.orientation() == ScrollbarOrientation::Vertical)
rect.contract(0, secondaryBackwardStepper->preferredSize().height());
else
rect.contract(secondaryBackwardStepper->preferredSize().width(), 0);
@@ -262,7 +262,7 @@
ASSERT(forwardStepper);
forwardStepper->setState(scrollbarPartStateFlags(scrollbar, ForwardButtonEndPart));
IntSize preferredSize = forwardStepper->preferredSize();
- if (scrollbar.orientation() == VerticalScrollbar)
+ if (scrollbar.orientation() == ScrollbarOrientation::Vertical)
rect.move(0, rect.height() - preferredSize.height());
else
rect.move(rect.width() - preferredSize.width(), 0);
@@ -287,7 +287,7 @@
if (auto* backwardStepper = scrollbarWidget.stepper(RenderThemeScrollbarGadget::Steppers::Backward)) {
backwardStepper->setState(scrollbarPartStateFlags(scrollbar, BackButtonStartPart));
IntSize preferredSize = backwardStepper->preferredSize();
- if (scrollbar.orientation() == VerticalScrollbar) {
+ if (scrollbar.orientation() == ScrollbarOrientation::Vertical) {
rect.move(0, preferredSize.height());
rect.contract(0, preferredSize.height());
} else {
@@ -302,7 +302,7 @@
if (part == ForwardButtonStartPart)
return IntRect(rect.location(), preferredSize);
- if (scrollbar.orientation() == VerticalScrollbar) {
+ if (scrollbar.orientation() == ScrollbarOrientation::Vertical) {
rect.move(0, preferredSize.height());
rect.contract(0, preferredSize.height());
} else {
@@ -315,7 +315,7 @@
ASSERT(forwardStepper);
forwardStepper->setState(scrollbarPartStateFlags(scrollbar, ForwardButtonEndPart));
IntSize preferredSize = forwardStepper->preferredSize();
- if (scrollbar.orientation() == VerticalScrollbar)
+ if (scrollbar.orientation() == ScrollbarOrientation::Vertical)
rect.move(0, rect.height() - preferredSize.height());
else
rect.move(rect.width() - preferredSize.width(), 0);
@@ -378,7 +378,7 @@
FloatRect contentsRect(rect);
// When using overlay scrollbars we always claim the size of the scrollbar when hovered, so when
// drawing the indicator we need to adjust the rectangle to its actual size in indicator mode.
- if (scrollbar.orientation() == VerticalScrollbar) {
+ if (scrollbar.orientation() == ScrollbarOrientation::Vertical) {
if (rect.width() != preferredSize.width()) {
if (!scrollbar.scrollableArea().shouldPlaceVerticalScrollbarOnLeft())
contentsRect.move(std::abs(rect.width() - preferredSize.width()), 0);
@@ -402,13 +402,13 @@
if (backwardStepper) {
FloatRect buttonRect = contentsRect;
- if (scrollbar.orientation() == VerticalScrollbar)
+ if (scrollbar.orientation() == ScrollbarOrientation::Vertical)
buttonRect.setHeight(backwardStepper->preferredSize().height());
else
buttonRect.setWidth(backwardStepper->preferredSize().width());
static_cast<RenderThemeScrollbarGadget&>(scrollbarGadget).renderStepper(graphicsContext.platformContext()->cr(), buttonRect, backwardStepper,
- scrollbar.orientation() == VerticalScrollbar ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL, RenderThemeScrollbarGadget::Steppers::Backward);
- if (scrollbar.orientation() == VerticalScrollbar) {
+ scrollbar.orientation() == ScrollbarOrientation::Vertical ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL, RenderThemeScrollbarGadget::Steppers::Backward);
+ if (scrollbar.orientation() == ScrollbarOrientation::Vertical) {
contentsRect.move(0, buttonRect.height());
contentsRect.contract(0, buttonRect.height());
} else {
@@ -418,13 +418,13 @@
}
if (secondaryForwardStepper) {
FloatRect buttonRect = contentsRect;
- if (scrollbar.orientation() == VerticalScrollbar)
+ if (scrollbar.orientation() == ScrollbarOrientation::Vertical)
buttonRect.setHeight(secondaryForwardStepper->preferredSize().height());
else
buttonRect.setWidth(secondaryForwardStepper->preferredSize().width());
static_cast<RenderThemeScrollbarGadget&>(scrollbarGadget).renderStepper(graphicsContext.platformContext()->cr(), buttonRect, secondaryForwardStepper,
- scrollbar.orientation() == VerticalScrollbar ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL, RenderThemeScrollbarGadget::Steppers::SecondaryForward);
- if (scrollbar.orientation() == VerticalScrollbar) {
+ scrollbar.orientation() == ScrollbarOrientation::Vertical ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL, RenderThemeScrollbarGadget::Steppers::SecondaryForward);
+ if (scrollbar.orientation() == ScrollbarOrientation::Vertical) {
contentsRect.move(0, buttonRect.height());
contentsRect.contract(0, buttonRect.height());
} else {
@@ -434,7 +434,7 @@
}
if (secondaryBackwardStepper) {
FloatRect buttonRect = contentsRect;
- if (scrollbar.orientation() == VerticalScrollbar) {
+ if (scrollbar.orientation() == ScrollbarOrientation::Vertical) {
buttonRect.setHeight(secondaryBackwardStepper->preferredSize().height());
buttonRect.move(0, contentsRect.height() - buttonRect.height());
} else {
@@ -442,8 +442,8 @@
buttonRect.move(contentsRect.width() - buttonRect.width(), 0);
}
static_cast<RenderThemeScrollbarGadget&>(scrollbarGadget).renderStepper(graphicsContext.platformContext()->cr(), buttonRect, secondaryBackwardStepper,
- scrollbar.orientation() == VerticalScrollbar ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL, RenderThemeScrollbarGadget::Steppers::SecondaryBackward);
- if (scrollbar.orientation() == VerticalScrollbar)
+ scrollbar.orientation() == ScrollbarOrientation::Vertical ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL, RenderThemeScrollbarGadget::Steppers::SecondaryBackward);
+ if (scrollbar.orientation() == ScrollbarOrientation::Vertical)
contentsRect.contract(0, buttonRect.height());
else
contentsRect.contract(buttonRect.width(), 0);
@@ -450,7 +450,7 @@
}
if (forwardStepper) {
FloatRect buttonRect = contentsRect;
- if (scrollbar.orientation() == VerticalScrollbar) {
+ if (scrollbar.orientation() == ScrollbarOrientation::Vertical) {
buttonRect.setHeight(forwardStepper->preferredSize().height());
buttonRect.move(0, contentsRect.height() - buttonRect.height());
} else {
@@ -458,8 +458,8 @@
buttonRect.move(contentsRect.width() - buttonRect.width(), 0);
}
static_cast<RenderThemeScrollbarGadget&>(scrollbarGadget).renderStepper(graphicsContext.platformContext()->cr(), buttonRect, forwardStepper,
- scrollbar.orientation() == VerticalScrollbar ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL, RenderThemeScrollbarGadget::Steppers::Forward);
- if (scrollbar.orientation() == VerticalScrollbar)
+ scrollbar.orientation() == ScrollbarOrientation::Vertical ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL, RenderThemeScrollbarGadget::Steppers::Forward);
+ if (scrollbar.orientation() == ScrollbarOrientation::Vertical)
contentsRect.contract(0, buttonRect.height());
else
contentsRect.contract(buttonRect.width(), 0);
@@ -468,7 +468,7 @@
trough.render(graphicsContext.platformContext()->cr(), contentsRect, &contentsRect);
if (thumbSize) {
- if (scrollbar.orientation() == VerticalScrollbar) {
+ if (scrollbar.orientation() == ScrollbarOrientation::Vertical) {
contentsRect.move(0, thumbPosition(scrollbar));
contentsRect.setWidth(scrollbarWidget.slider().preferredSize().width());
contentsRect.setHeight(thumbSize);
@@ -541,7 +541,7 @@
auto& scrollbarWidget = static_cast<RenderThemeScrollbar&>(RenderThemeScrollbar::getOrCreate(RenderThemeScrollbar::Type::VerticalScrollbarRight));
scrollbarWidget.scrollbar().setState(GTK_STATE_FLAG_PRELIGHT);
IntSize minSize = scrollbarWidget.slider().minimumSize();
- return scrollbar.orientation() == VerticalScrollbar ? minSize.height() : minSize.width();
+ return scrollbar.orientation() == ScrollbarOrientation::Vertical ? minSize.height() : minSize.width();
}
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.mm (285315 => 285316)
--- trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.mm 2021-11-04 21:43:02 UTC (rev 285315)
+++ trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.mm 2021-11-04 21:58:31 UTC (rev 285316)
@@ -169,7 +169,7 @@
if (scrollbar.isCustomScrollbar())
return;
- bool isHorizontal = scrollbar.orientation() == HorizontalScrollbar;
+ bool isHorizontal = scrollbar.orientation() == ScrollbarOrientation::Horizontal;
auto scrollerImp = retainPtr([NSScrollerImp scrollerImpWithStyle:ScrollerStyle::recommendedScrollerStyle() controlSize:scrollbarControlSizeToNSControlSize(scrollbar.controlSize()) horizontal:isHorizontal replacingScrollerImp:nil]);
scrollbarMap().add(&scrollbar, WTFMove(scrollerImp));
didCreateScrollerImp(scrollbar);
@@ -295,7 +295,7 @@
bool ScrollbarThemeMac::hasButtons(Scrollbar& scrollbar)
{
- if (scrollbar.enabled() && buttonsPlacement() != ScrollbarButtonsNone && (scrollbar.orientation() == HorizontalScrollbar))
+ if (scrollbar.enabled() && buttonsPlacement() != ScrollbarButtonsNone && (scrollbar.orientation() == ScrollbarOrientation::Horizontal))
return scrollbar.width();
return scrollbar.height() >= 2 * (cRealButtonLength[scrollbarSizeToIndex(scrollbar.controlSize())] - cButtonHitInset[scrollbarSizeToIndex(scrollbar.controlSize())]);
}
@@ -308,7 +308,7 @@
minLengthForThumb = [painter knobMinLength] + [painter trackOverlapEndInset] + [painter knobOverlapEndInset]
+ 2 * ([painter trackEndInset] + [painter knobEndInset]);
- return scrollbar.enabled() && (scrollbar.orientation() == HorizontalScrollbar ?
+ return scrollbar.enabled() && (scrollbar.orientation() == ScrollbarOrientation::Horizontal ?
scrollbar.width() :
scrollbar.height()) >= minLengthForThumb;
}
@@ -318,7 +318,7 @@
ASSERT(gButtonPlacement != ScrollbarButtonsNone);
IntRect paintRect(buttonRect);
- if (orientation == HorizontalScrollbar) {
+ if (orientation == ScrollbarOrientation::Horizontal) {
paintRect.setWidth(cRealButtonLength[scrollbarSizeToIndex(controlSize)]);
if (!start)
paintRect.setX(buttonRect.x() - (cRealButtonLength[scrollbarSizeToIndex(controlSize)] - buttonRect.width()));
@@ -344,7 +344,7 @@
int thickness = scrollbarThickness(scrollbar.controlSize());
bool outerButton = part == BackButtonStartPart && (buttonsPlacement() == ScrollbarButtonsDoubleStart || buttonsPlacement() == ScrollbarButtonsDoubleBoth);
if (outerButton) {
- if (scrollbar.orientation() == HorizontalScrollbar)
+ if (scrollbar.orientation() == ScrollbarOrientation::Horizontal)
result = IntRect(scrollbar.x(), scrollbar.y(), cOuterButtonLength[scrollbarSizeToIndex(scrollbar.controlSize())] + (painting ? cOuterButtonOverlap : 0), thickness);
else
result = IntRect(scrollbar.x(), scrollbar.y(), thickness, cOuterButtonLength[scrollbarSizeToIndex(scrollbar.controlSize())] + (painting ? cOuterButtonOverlap : 0));
@@ -352,7 +352,7 @@
}
// Our repaint rect is slightly larger, since we are a button that is adjacent to the track.
- if (scrollbar.orientation() == HorizontalScrollbar) {
+ if (scrollbar.orientation() == ScrollbarOrientation::Horizontal) {
int start = part == BackButtonStartPart ? scrollbar.x() : scrollbar.x() + scrollbar.width() - cOuterButtonLength[scrollbarSizeToIndex(scrollbar.controlSize())] - cButtonLength[scrollbarSizeToIndex(scrollbar.controlSize())];
result = IntRect(start, scrollbar.y(), cButtonLength[scrollbarSizeToIndex(scrollbar.controlSize())], thickness);
} else {
@@ -381,7 +381,7 @@
bool outerButton = part == ForwardButtonEndPart && (buttonsPlacement() == ScrollbarButtonsDoubleEnd || buttonsPlacement() == ScrollbarButtonsDoubleBoth);
if (outerButton) {
- if (scrollbar.orientation() == HorizontalScrollbar) {
+ if (scrollbar.orientation() == ScrollbarOrientation::Horizontal) {
result = IntRect(scrollbar.x() + scrollbar.width() - outerButtonLength, scrollbar.y(), outerButtonLength, thickness);
if (painting)
result.inflateX(cOuterButtonOverlap);
@@ -393,7 +393,7 @@
return result;
}
- if (scrollbar.orientation() == HorizontalScrollbar) {
+ if (scrollbar.orientation() == ScrollbarOrientation::Horizontal) {
int start = part == ForwardButtonEndPart ? scrollbar.x() + scrollbar.width() - buttonLength : scrollbar.x() + outerButtonLength;
result = IntRect(start, scrollbar.y(), buttonLength, thickness);
} else {
@@ -437,7 +437,7 @@
}
int totalWidth = startWidth + endWidth;
- if (scrollbar.orientation() == HorizontalScrollbar)
+ if (scrollbar.orientation() == ScrollbarOrientation::Horizontal)
return IntRect(scrollbar.x() + startWidth, scrollbar.y(), scrollbar.width() - totalWidth, thickness);
return IntRect(scrollbar.x(), scrollbar.y() + startWidth, thickness, scrollbar.height() - totalWidth);
}
Modified: trunk/Source/WebCore/platform/mac/ScrollbarsControllerMac.mm (285315 => 285316)
--- trunk/Source/WebCore/platform/mac/ScrollbarsControllerMac.mm 2021-11-04 21:43:02 UTC (rev 285315)
+++ trunk/Source/WebCore/platform/mac/ScrollbarsControllerMac.mm 2021-11-04 21:58:31 UTC (rev 285316)
@@ -370,7 +370,7 @@
return nil;
WebCore::GraphicsLayer* layer;
- if (_scrollbar->orientation() == WebCore::VerticalScrollbar)
+ if (_scrollbar->orientation() == WebCore::ScrollbarOrientation::Vertical)
layer = _scrollbar->scrollableArea().layerForVerticalScrollbar();
else
layer = _scrollbar->scrollableArea().layerForHorizontalScrollbar();
@@ -455,7 +455,7 @@
if (auto* macTheme = WebCore::macScrollbarTheme())
macTheme->setPaintCharacteristicsForScrollbar(*_scrollbar);
- if (part == WebCore::ThumbPart && _scrollbar->orientation() == WebCore::VerticalScrollbar) {
+ if (part == WebCore::ThumbPart && _scrollbar->orientation() == WebCore::ScrollbarOrientation::Vertical) {
if (newAlpha == 1) {
auto thumbRect = WebCore::IntRect([scrollerPainter rectForPart:NSScrollerKnob]);
[self scrollbarsController]->setVisibleScrollerThumbRect(thumbRect);
Modified: trunk/Source/WebCore/platform/win/PopupMenuWin.cpp (285315 => 285316)
--- trunk/Source/WebCore/platform/win/PopupMenuWin.cpp 2021-11-04 21:43:02 UTC (rev 285315)
+++ trunk/Source/WebCore/platform/win/PopupMenuWin.cpp 2021-11-04 21:58:31 UTC (rev 285316)
@@ -142,7 +142,7 @@
if (!m_scrollbar && visibleItems() < client()->listSize()) {
// We need a scroll bar
- m_scrollbar = client()->createScrollbar(*this, VerticalScrollbar, ScrollbarControlSize::Small);
+ m_scrollbar = client()->createScrollbar(*this, ScrollbarOrientation::Vertical, ScrollbarControlSize::Small);
m_scrollbar->styleChanged();
}
@@ -555,12 +555,12 @@
int index = focusedIndex();
if (index < m_scrollOffset) {
- ScrollableArea::scrollToOffsetWithoutAnimation(VerticalScrollbar, index);
+ ScrollableArea::scrollToOffsetWithoutAnimation(ScrollbarOrientation::Vertical, index);
return true;
}
if (index >= m_scrollOffset + visibleItems()) {
- ScrollableArea::scrollToOffsetWithoutAnimation(VerticalScrollbar, index - visibleItems() + 1);
+ ScrollableArea::scrollToOffsetWithoutAnimation(ScrollbarOrientation::Vertical, index - visibleItems() + 1);
return true;
}
Modified: trunk/Source/WebCore/platform/win/ScrollbarThemeWin.cpp (285315 => 285316)
--- trunk/Source/WebCore/platform/win/ScrollbarThemeWin.cpp 2021-11-04 21:43:02 UTC (rev 285315)
+++ trunk/Source/WebCore/platform/win/ScrollbarThemeWin.cpp 2021-11-04 21:58:31 UTC (rev 285316)
@@ -149,7 +149,7 @@
// we have < 34 pixels left. This allows the scrollbar
// to scale down and function even at tiny sizes.
int thickness = scrollbarThickness();
- if (scrollbar.orientation() == HorizontalScrollbar)
+ if (scrollbar.orientation() == ScrollbarOrientation::Horizontal)
return IntRect(scrollbar.x(), scrollbar.y(),
scrollbar.width() < 2 * thickness ? scrollbar.width() / 2 : thickness, thickness);
return IntRect(scrollbar.x(), scrollbar.y(),
@@ -168,7 +168,7 @@
// we have < 34 pixels left. This allows the scrollbar
// to scale down and function even at tiny sizes.
int thickness = scrollbarThickness();
- if (scrollbar.orientation() == HorizontalScrollbar) {
+ if (scrollbar.orientation() == ScrollbarOrientation::Horizontal) {
int w = scrollbar.width() < 2 * thickness ? scrollbar.width() / 2 : thickness;
return IntRect(scrollbar.x() + scrollbar.width() - w, scrollbar.y(), w, thickness);
}
@@ -180,7 +180,7 @@
IntRect ScrollbarThemeWin::trackRect(Scrollbar& scrollbar, bool)
{
int thickness = scrollbarThickness();
- if (scrollbar.orientation() == HorizontalScrollbar) {
+ if (scrollbar.orientation() == ScrollbarOrientation::Horizontal) {
if (scrollbar.width() < 2 * thickness)
return IntRect();
return IntRect(scrollbar.x() + thickness, scrollbar.y(), scrollbar.width() - 2 * thickness, thickness);
@@ -215,7 +215,7 @@
// Find the rect within which we shouldn't snap, by expanding the track rect
// in both dimensions.
IntRect rect = trackRect(scrollbar);
- const bool horz = scrollbar.orientation() == HorizontalScrollbar;
+ const bool horz = scrollbar.orientation() == ScrollbarOrientation::Horizontal;
const int thickness = scrollbarThickness(scrollbar.controlSize());
rect.inflateX((horz ? kOffEndMultiplier : kOffSideMultiplier) * thickness);
rect.inflateY((horz ? kOffSideMultiplier : kOffEndMultiplier) * thickness);
@@ -241,7 +241,7 @@
bool start = partType == BackTrackPart;
int part;
- if (scrollbar.orientation() == HorizontalScrollbar)
+ if (scrollbar.orientation() == ScrollbarOrientation::Horizontal)
part = start ? SP_TRACKSTARTHOR : SP_TRACKENDHOR;
else
part = start ? SP_TRACKSTARTVERT : SP_TRACKENDVERT;
@@ -296,7 +296,7 @@
bool start = (part == BackButtonStartPart);
int xpState = 0;
int classicState = 0;
- if (scrollbar.orientation() == HorizontalScrollbar)
+ if (scrollbar.orientation() == ScrollbarOrientation::Horizontal)
xpState = start ? TS_LEFT_BUTTON : TS_RIGHT_BUTTON;
else
xpState = start ? TS_UP_BUTTON : TS_DOWN_BUTTON;
@@ -317,7 +317,7 @@
if (scrollbar.hoveredPart() == NoPart || !runningVista)
xpState += TS_NORMAL;
else {
- if (scrollbar.orientation() == HorizontalScrollbar)
+ if (scrollbar.orientation() == ScrollbarOrientation::Horizontal)
xpState = start ? TS_LEFT_BUTTON_HOVER : TS_RIGHT_BUTTON_HOVER;
else
xpState = start ? TS_UP_BUTTON_HOVER : TS_DOWN_BUTTON_HOVER;
@@ -375,7 +375,7 @@
state = TS_NORMAL;
RECT themeRect(rect);
- DrawThemeBackground(scrollbarTheme, hdc, scrollbar.orientation() == HorizontalScrollbar ? SP_GRIPPERHOR : SP_GRIPPERVERT, state, &themeRect, 0);
+ DrawThemeBackground(scrollbarTheme, hdc, scrollbar.orientation() == ScrollbarOrientation::Horizontal ? SP_GRIPPERHOR : SP_GRIPPERVERT, state, &themeRect, 0);
}
void ScrollbarThemeWin::paintThumb(GraphicsContext& context, Scrollbar& scrollbar, const IntRect& rect)
@@ -394,11 +394,11 @@
bool alphaBlend = false;
if (scrollbarTheme)
- alphaBlend = IsThemeBackgroundPartiallyTransparent(scrollbarTheme, scrollbar.orientation() == HorizontalScrollbar ? SP_THUMBHOR : SP_THUMBVERT, state);
+ alphaBlend = IsThemeBackgroundPartiallyTransparent(scrollbarTheme, scrollbar.orientation() == ScrollbarOrientation::Horizontal ? SP_THUMBHOR : SP_THUMBVERT, state);
LocalWindowsContext windowsContext(context, rect, alphaBlend);
RECT themeRect(rect);
if (scrollbarTheme) {
- DrawThemeBackground(scrollbarTheme, windowsContext.hdc(), scrollbar.orientation() == HorizontalScrollbar ? SP_THUMBHOR : SP_THUMBVERT, state, &themeRect, 0);
+ DrawThemeBackground(scrollbarTheme, windowsContext.hdc(), scrollbar.orientation() == ScrollbarOrientation::Horizontal ? SP_THUMBHOR : SP_THUMBVERT, state, &themeRect, 0);
paintGripper(scrollbar, windowsContext.hdc(), gripperRect(scrollbarThickness(), rect));
} else
::DrawEdge(windowsContext.hdc(), &themeRect, EDGE_RAISED, BF_RECT | BF_MIDDLE);
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (285315 => 285316)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2021-11-04 21:43:02 UTC (rev 285315)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2021-11-04 21:58:31 UTC (rev 285316)
@@ -1070,9 +1070,9 @@
};
switch (orientation) {
- case ScrollbarOrientation::HorizontalScrollbar:
+ case ScrollbarOrientation::Horizontal:
return isAutoOrScrollWithOverlayScrollbar(style().overflowX());
- case ScrollbarOrientation::VerticalScrollbar:
+ case ScrollbarOrientation::Vertical:
return isAutoOrScrollWithOverlayScrollbar(style().overflowY());
}
return false;
@@ -1088,9 +1088,9 @@
};
switch (orientation) {
- case ScrollbarOrientation::HorizontalScrollbar:
+ case ScrollbarOrientation::Horizontal:
return isAlwaysVisibleScrollbar(style().overflowX());
- case ScrollbarOrientation::VerticalScrollbar:
+ case ScrollbarOrientation::Vertical:
return isAlwaysVisibleScrollbar(style().overflowY());
}
return false;
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (285315 => 285316)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2021-11-04 21:43:02 UTC (rev 285315)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2021-11-04 21:58:31 UTC (rev 285316)
@@ -2138,9 +2138,9 @@
if (auto* scrollingCoordinator = m_owningLayer.page().scrollingCoordinator()) {
if (auto* scrollableArea = m_owningLayer.scrollableArea()) {
if (horizontalScrollbarLayerChanged)
- scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(*scrollableArea, HorizontalScrollbar);
+ scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(*scrollableArea, ScrollbarOrientation::Horizontal);
if (verticalScrollbarLayerChanged)
- scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(*scrollableArea, VerticalScrollbar);
+ scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(*scrollableArea, ScrollbarOrientation::Vertical);
}
}
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (285315 => 285316)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2021-11-04 21:43:02 UTC (rev 285315)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2021-11-04 21:58:31 UTC (rev 285316)
@@ -4027,13 +4027,13 @@
m_overflowControlsHostLayer->addChild(*m_layerForHorizontalScrollbar);
if (auto* scrollingCoordinator = this->scrollingCoordinator())
- scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_renderView.frameView(), HorizontalScrollbar);
+ scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_renderView.frameView(), ScrollbarOrientation::Horizontal);
}
} else if (m_layerForHorizontalScrollbar) {
GraphicsLayer::unparentAndClear(m_layerForHorizontalScrollbar);
if (auto* scrollingCoordinator = this->scrollingCoordinator())
- scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_renderView.frameView(), HorizontalScrollbar);
+ scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_renderView.frameView(), ScrollbarOrientation::Horizontal);
}
if (requiresVerticalScrollbarLayer()) {
@@ -4048,13 +4048,13 @@
m_overflowControlsHostLayer->addChild(*m_layerForVerticalScrollbar);
if (auto* scrollingCoordinator = this->scrollingCoordinator())
- scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_renderView.frameView(), VerticalScrollbar);
+ scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_renderView.frameView(), ScrollbarOrientation::Vertical);
}
} else if (m_layerForVerticalScrollbar) {
GraphicsLayer::unparentAndClear(m_layerForVerticalScrollbar);
if (auto* scrollingCoordinator = this->scrollingCoordinator())
- scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_renderView.frameView(), VerticalScrollbar);
+ scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_renderView.frameView(), ScrollbarOrientation::Vertical);
}
if (requiresScrollCornerLayer()) {
@@ -4175,7 +4175,7 @@
if (m_layerForHorizontalScrollbar) {
GraphicsLayer::unparentAndClear(m_layerForHorizontalScrollbar);
if (auto* scrollingCoordinator = this->scrollingCoordinator())
- scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_renderView.frameView(), HorizontalScrollbar);
+ scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_renderView.frameView(), ScrollbarOrientation::Horizontal);
if (auto* horizontalScrollbar = m_renderView.frameView().verticalScrollbar())
m_renderView.frameView().invalidateScrollbar(*horizontalScrollbar, IntRect(IntPoint(0, 0), horizontalScrollbar->frameRect().size()));
}
@@ -4183,7 +4183,7 @@
if (m_layerForVerticalScrollbar) {
GraphicsLayer::unparentAndClear(m_layerForVerticalScrollbar);
if (auto* scrollingCoordinator = this->scrollingCoordinator())
- scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_renderView.frameView(), VerticalScrollbar);
+ scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_renderView.frameView(), ScrollbarOrientation::Vertical);
if (auto* verticalScrollbar = m_renderView.frameView().verticalScrollbar())
m_renderView.frameView().invalidateScrollbar(*verticalScrollbar, IntRect(IntPoint(0, 0), verticalScrollbar->frameRect().size()));
}
Modified: trunk/Source/WebCore/rendering/RenderLayerScrollableArea.cpp (285315 => 285316)
--- trunk/Source/WebCore/rendering/RenderLayerScrollableArea.cpp 2021-11-04 21:43:02 UTC (rev 285315)
+++ trunk/Source/WebCore/rendering/RenderLayerScrollableArea.cpp 2021-11-04 21:58:31 UTC (rev 285316)
@@ -95,8 +95,8 @@
if (Element* element = renderer.element())
element->setSavedLayerScrollPosition(m_scrollPosition);
- destroyScrollbar(HorizontalScrollbar);
- destroyScrollbar(VerticalScrollbar);
+ destroyScrollbar(ScrollbarOrientation::Horizontal);
+ destroyScrollbar(ScrollbarOrientation::Vertical);
if (auto* scrollingCoordinator = renderer.page().scrollingCoordinator())
scrollingCoordinator->willDestroyScrollableArea(*this);
@@ -839,7 +839,7 @@
void RenderLayerScrollableArea::destroyScrollbar(ScrollbarOrientation orientation)
{
- RefPtr<Scrollbar>& scrollbar = orientation == HorizontalScrollbar ? m_hBar : m_vBar;
+ RefPtr<Scrollbar>& scrollbar = orientation == ScrollbarOrientation::Horizontal ? m_hBar : m_vBar;
if (!scrollbar)
return;
@@ -856,7 +856,7 @@
return;
if (hasScrollbar) {
- m_hBar = createScrollbar(HorizontalScrollbar);
+ m_hBar = createScrollbar(ScrollbarOrientation::Horizontal);
#if HAVE(RUBBER_BANDING)
auto& renderer = m_layer.renderer();
ScrollElasticity elasticity = scrollsOverflow() && renderer.settings().rubberBandingForSubScrollableRegionsEnabled() ? ScrollElasticityAutomatic : ScrollElasticityNone;
@@ -863,7 +863,7 @@
ScrollableArea::setHorizontalScrollElasticity(elasticity);
#endif
} else {
- destroyScrollbar(HorizontalScrollbar);
+ destroyScrollbar(ScrollbarOrientation::Horizontal);
#if HAVE(RUBBER_BANDING)
ScrollableArea::setHorizontalScrollElasticity(ScrollElasticityNone);
#endif
@@ -882,7 +882,7 @@
return;
if (hasScrollbar) {
- m_vBar = createScrollbar(VerticalScrollbar);
+ m_vBar = createScrollbar(ScrollbarOrientation::Vertical);
#if HAVE(RUBBER_BANDING)
auto& renderer = m_layer.renderer();
ScrollElasticity elasticity = scrollsOverflow() && renderer.settings().rubberBandingForSubScrollableRegionsEnabled() ? ScrollElasticityAutomatic : ScrollElasticityNone;
@@ -889,7 +889,7 @@
ScrollableArea::setVerticalScrollElasticity(elasticity);
#endif
} else {
- destroyScrollbar(VerticalScrollbar);
+ destroyScrollbar(ScrollbarOrientation::Vertical);
#if HAVE(RUBBER_BANDING)
ScrollableArea::setVerticalScrollElasticity(ScrollElasticityNone);
#endif
@@ -1080,7 +1080,7 @@
};
auto scrollbarForAxis = [&](ScrollbarOrientation orientation) -> RefPtr<Scrollbar>& {
- return orientation == ScrollbarOrientation::HorizontalScrollbar ? m_hBar : m_vBar;
+ return orientation == ScrollbarOrientation::Horizontal ? m_hBar : m_vBar;
};
auto stateForScrollbar = [&](ScrollbarOrientation orientation, std::optional<bool> hasOverflow, ScrollbarState nonScrollableState) {
@@ -1102,12 +1102,12 @@
return ScrollbarState::NoScrollbar;
};
- auto horizontalBarState = stateForScrollbarOnAxis(ScrollbarOrientation::HorizontalScrollbar, hasHorizontalOverflow);
+ auto horizontalBarState = stateForScrollbarOnAxis(ScrollbarOrientation::Horizontal, hasHorizontalOverflow);
setHasHorizontalScrollbar(horizontalBarState != ScrollbarState::NoScrollbar);
if (horizontalBarState != ScrollbarState::NoScrollbar)
m_hBar->setEnabled(horizontalBarState == ScrollbarState::Enabled);
- auto verticalBarState = stateForScrollbarOnAxis(ScrollbarOrientation::VerticalScrollbar, hasVerticalOverflow);
+ auto verticalBarState = stateForScrollbarOnAxis(ScrollbarOrientation::Vertical, hasVerticalOverflow);
setHasVerticalScrollbar(verticalBarState != ScrollbarState::NoScrollbar);
if (verticalBarState != ScrollbarState::NoScrollbar)
m_vBar->setEnabled(verticalBarState == ScrollbarState::Enabled);
@@ -1150,8 +1150,8 @@
updateScrollbarPresenceAndState(hasHorizontalOverflow(), hasVerticalOverflow());
// Scrollbars with auto behavior may need to lay out again if scrollbars got added or removed.
- bool autoHorizontalScrollBarChanged = box->hasAutoScrollbar(ScrollbarOrientation::HorizontalScrollbar) && (hadHorizontalScrollbar != hasHorizontalScrollbar());
- bool autoVerticalScrollBarChanged = box->hasAutoScrollbar(ScrollbarOrientation::VerticalScrollbar) && (hadVerticalScrollbar != hasVerticalScrollbar());
+ bool autoHorizontalScrollBarChanged = box->hasAutoScrollbar(ScrollbarOrientation::Horizontal) && (hadHorizontalScrollbar != hasHorizontalScrollbar());
+ bool autoVerticalScrollBarChanged = box->hasAutoScrollbar(ScrollbarOrientation::Vertical) && (hadVerticalScrollbar != hasVerticalScrollbar());
if (autoHorizontalScrollBarChanged || autoVerticalScrollBarChanged) {
if (autoVerticalScrollBarChanged && shouldPlaceVerticalScrollbarOnLeft())
Modified: trunk/Source/WebCore/rendering/RenderListBox.cpp (285315 => 285316)
--- trunk/Source/WebCore/rendering/RenderListBox.cpp 2021-11-04 21:43:02 UTC (rev 285315)
+++ trunk/Source/WebCore/rendering/RenderListBox.cpp 2021-11-04 21:58:31 UTC (rev 285316)
@@ -184,7 +184,7 @@
m_vBar->setSteps(1, std::max(1, numVisibleItems() - 1), itemHeight());
m_vBar->setProportion(numVisibleItems(), numItems());
if (!enabled) {
- scrollToOffsetWithoutAnimation(VerticalScrollbar, 0);
+ scrollToOffsetWithoutAnimation(ScrollbarOrientation::Vertical, 0);
m_indexOffset = 0;
}
}
@@ -600,7 +600,7 @@
else
newOffset = index - numVisibleItems() + 1;
- scrollToOffsetWithoutAnimation(VerticalScrollbar, newOffset);
+ scrollToOffsetWithoutAnimation(ScrollbarOrientation::Vertical, newOffset);
return true;
}
@@ -755,7 +755,7 @@
return;
setupWheelEventTestMonitor(*this);
- scrollToOffsetWithoutAnimation(VerticalScrollbar, index);
+ scrollToOffsetWithoutAnimation(ScrollbarOrientation::Vertical, index);
}
bool RenderListBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction)
@@ -918,10 +918,10 @@
RefPtr<Scrollbar> widget;
bool hasCustomScrollbarStyle = style().hasPseudoStyle(PseudoId::Scrollbar);
if (hasCustomScrollbarStyle)
- widget = RenderScrollbar::createCustomScrollbar(*this, VerticalScrollbar, &selectElement());
+ widget = RenderScrollbar::createCustomScrollbar(*this, ScrollbarOrientation::Vertical, &selectElement());
else {
- widget = Scrollbar::createNativeScrollbar(*this, VerticalScrollbar, theme().scrollbarControlSizeForPart(ListboxPart));
- didAddScrollbar(widget.get(), VerticalScrollbar);
+ widget = Scrollbar::createNativeScrollbar(*this, ScrollbarOrientation::Vertical, theme().scrollbarControlSizeForPart(ListboxPart));
+ didAddScrollbar(widget.get(), ScrollbarOrientation::Vertical);
if (page().isMonitoringWheelEvents())
scrollAnimator().setWheelEventTestMonitor(page().wheelEventTestMonitor());
}
@@ -935,7 +935,7 @@
return;
if (!m_vBar->isCustomScrollbar())
- ScrollableArea::willRemoveScrollbar(m_vBar.get(), VerticalScrollbar);
+ ScrollableArea::willRemoveScrollbar(m_vBar.get(), ScrollbarOrientation::Vertical);
m_vBar->removeFromParent();
m_vBar = nullptr;
}
Modified: trunk/Source/WebCore/rendering/RenderScrollbar.cpp (285315 => 285316)
--- trunk/Source/WebCore/rendering/RenderScrollbar.cpp 2021-11-04 21:43:02 UTC (rev 285315)
+++ trunk/Source/WebCore/rendering/RenderScrollbar.cpp 2021-11-04 21:58:31 UTC (rev 285316)
@@ -58,7 +58,7 @@
part->layout();
width = part->width();
height = part->height();
- } else if (this->orientation() == HorizontalScrollbar)
+ } else if (this->orientation() == ScrollbarOrientation::Horizontal)
width = this->width();
else
height = this->height();
@@ -174,7 +174,7 @@
updateScrollbarPart(TrackBGPart);
// See if the scrollbar's thickness changed. If so, we need to mark our owning object as needing a layout.
- bool isHorizontal = orientation() == HorizontalScrollbar;
+ bool isHorizontal = orientation() == ScrollbarOrientation::Horizontal;
int oldThickness = isHorizontal ? height() : width();
int newThickness = 0;
RenderScrollbarPart* part = m_parts.get(ScrollbarBGPart);
@@ -275,7 +275,7 @@
partRenderer->layout();
- bool isHorizontal = orientation() == HorizontalScrollbar;
+ bool isHorizontal = orientation() == ScrollbarOrientation::Horizontal;
IntSize pixelSnappedIntSize = snappedIntRect(partRenderer->frameRect()).size();
if (partType == BackButtonStartPart)
return IntRect(location(), IntSize(isHorizontal ? pixelSnappedIntSize.width() : width(), isHorizontal ? height() : pixelSnappedIntSize.height()));
@@ -305,7 +305,7 @@
if (part)
part->layout();
- if (orientation() == HorizontalScrollbar) {
+ if (orientation() == ScrollbarOrientation::Horizontal) {
int marginLeft = part ? static_cast<int>(part->marginLeft()) : 0;
int marginRight = part ? static_cast<int>(part->marginRight()) : 0;
startLength += marginLeft;
@@ -332,7 +332,7 @@
partRenderer->layout();
IntRect rect = oldRect;
- if (orientation() == HorizontalScrollbar) {
+ if (orientation() == ScrollbarOrientation::Horizontal) {
rect.setX(rect.x() + partRenderer->marginLeft());
rect.setWidth(rect.width() - partRenderer->horizontalMarginExtent());
} else {
@@ -348,7 +348,7 @@
if (!partRenderer)
return 0;
partRenderer->layout();
- return orientation() == HorizontalScrollbar ? partRenderer->width() : partRenderer->height();
+ return orientation() == ScrollbarOrientation::Horizontal ? partRenderer->width() : partRenderer->height();
}
float RenderScrollbar::opacity() const
Modified: trunk/Source/WebCore/rendering/RenderScrollbarPart.cpp (285315 => 285316)
--- trunk/Source/WebCore/rendering/RenderScrollbarPart.cpp 2021-11-04 21:43:02 UTC (rev 285315)
+++ trunk/Source/WebCore/rendering/RenderScrollbarPart.cpp 2021-11-04 21:58:31 UTC (rev 285316)
@@ -50,7 +50,7 @@
{
StackStats::LayoutCheckPoint layoutCheckPoint;
setLocation(LayoutPoint()); // We don't worry about positioning ourselves. We're just determining our minimum width/height.
- if (m_scrollbar->orientation() == HorizontalScrollbar)
+ if (m_scrollbar->orientation() == ScrollbarOrientation::Horizontal)
layoutHorizontalPart();
else
layoutVerticalPart();
Modified: trunk/Source/WebCore/rendering/RenderScrollbarTheme.cpp (285315 => 285316)
--- trunk/Source/WebCore/rendering/RenderScrollbarTheme.cpp 2021-11-04 21:43:02 UTC (rev 285315)
+++ trunk/Source/WebCore/rendering/RenderScrollbarTheme.cpp 2021-11-04 21:58:31 UTC (rev 285316)
@@ -43,7 +43,7 @@
IntRect secondButton = forwardButtonRect(scrollbar, ForwardButtonStartPart);
IntRect thirdButton = backButtonRect(scrollbar, BackButtonEndPart);
IntRect fourthButton = forwardButtonRect(scrollbar, ForwardButtonEndPart);
- if (scrollbar.orientation() == HorizontalScrollbar) {
+ if (scrollbar.orientation() == ScrollbarOrientation::Horizontal) {
beforeSize = firstButton.width() + secondButton.width();
afterSize = thirdButton.width() + fourthButton.width();
} else {
@@ -57,7 +57,7 @@
int startSize;
int endSize;
buttonSizesAlongTrackAxis(scrollbar, startSize, endSize);
- return (startSize + endSize) <= (scrollbar.orientation() == HorizontalScrollbar ? scrollbar.width() : scrollbar.height());
+ return (startSize + endSize) <= (scrollbar.orientation() == ScrollbarOrientation::Horizontal ? scrollbar.width() : scrollbar.height());
}
bool RenderScrollbarTheme::hasThumb(Scrollbar& scrollbar)
@@ -97,7 +97,7 @@
IntRect backRect = downcast<RenderScrollbar>(scrollbar).trackPieceRectWithMargins(BackTrackPart, rect);
IntRect forwardRect = downcast<RenderScrollbar>(scrollbar).trackPieceRectWithMargins(ForwardTrackPart, rect);
IntRect result = rect;
- if (scrollbar.orientation() == HorizontalScrollbar) {
+ if (scrollbar.orientation() == ScrollbarOrientation::Horizontal) {
result.setX(backRect.x());
result.setWidth(forwardRect.maxX() - backRect.x());
} else {
Modified: trunk/Source/WebKit/ChangeLog (285315 => 285316)
--- trunk/Source/WebKit/ChangeLog 2021-11-04 21:43:02 UTC (rev 285315)
+++ trunk/Source/WebKit/ChangeLog 2021-11-04 21:58:31 UTC (rev 285316)
@@ -1,3 +1,18 @@
+2021-11-04 Nikolaos Mouchtaris <[email protected]>
+
+ Make scrollbar orientation an enum class
+ https://bugs.webkit.org/show_bug.cgi?id=232648
+
+ Reviewed by Simon Fraser.
+
+ * Shared/WebHitTestResultData.cpp:
+ (WebKit::WebHitTestResultData::WebHitTestResultData):
+ * WebProcess/Plugins/PDF/PDFPlugin.mm:
+ (WebKit::PDFPlugin::updateScrollbars):
+ (WebKit::PDFPlugin::createScrollbar):
+ (WebKit::PDFPlugin::destroyScrollbar):
+ (WebKit::PDFPlugin::destroy):
+
2021-11-04 Aditya Keerthi <[email protected]>
Crash when opening and closing color picker while resetting form
Modified: trunk/Source/WebKit/Shared/WebHitTestResultData.cpp (285315 => 285316)
--- trunk/Source/WebKit/Shared/WebHitTestResultData.cpp 2021-11-04 21:43:02 UTC (rev 285315)
+++ trunk/Source/WebKit/Shared/WebHitTestResultData.cpp 2021-11-04 21:58:31 UTC (rev 285316)
@@ -58,7 +58,7 @@
, imageSize(0)
{
if (auto* scrollbar = hitTestResult.scrollbar())
- isScrollbar = scrollbar->orientation() == HorizontalScrollbar ? IsScrollbar::Horizontal : IsScrollbar::Vertical;
+ isScrollbar = scrollbar->orientation() == ScrollbarOrientation::Horizontal ? IsScrollbar::Horizontal : IsScrollbar::Vertical;
}
WebHitTestResultData::WebHitTestResultData(const WebCore::HitTestResult& hitTestResult, bool includeImage)
@@ -79,7 +79,7 @@
, imageSize(0)
{
if (auto* scrollbar = hitTestResult.scrollbar())
- isScrollbar = scrollbar->orientation() == HorizontalScrollbar ? IsScrollbar::Horizontal : IsScrollbar::Vertical;
+ isScrollbar = scrollbar->orientation() == ScrollbarOrientation::Horizontal ? IsScrollbar::Horizontal : IsScrollbar::Vertical;
if (!includeImage)
return;
Modified: trunk/Source/WebKit/UIProcess/win/WebPopupMenuProxyWin.cpp (285315 => 285316)
--- trunk/Source/WebKit/UIProcess/win/WebPopupMenuProxyWin.cpp 2021-11-04 21:43:02 UTC (rev 285315)
+++ trunk/Source/WebKit/UIProcess/win/WebPopupMenuProxyWin.cpp 2021-11-04 21:58:31 UTC (rev 285316)
@@ -199,7 +199,7 @@
HWND hostWindow = m_webView->window();
if (!m_scrollbar && visibleItems() < m_items.size()) {
- m_scrollbar = Scrollbar::createNativeScrollbar(*this, VerticalScrollbar, ScrollbarControlSize::Small);
+ m_scrollbar = Scrollbar::createNativeScrollbar(*this, ScrollbarOrientation::Vertical, ScrollbarControlSize::Small);
m_scrollbar->styleChanged();
}
@@ -983,12 +983,12 @@
int index = focusedIndex();
if (index < m_scrollOffset) {
- ScrollableArea::scrollToOffsetWithoutAnimation(VerticalScrollbar, index);
+ ScrollableArea::scrollToOffsetWithoutAnimation(ScrollbarOrientation::Vertical, index);
return true;
}
if (index >= m_scrollOffset + visibleItems()) {
- ScrollableArea::scrollToOffsetWithoutAnimation(VerticalScrollbar, index - visibleItems() + 1);
+ ScrollableArea::scrollToOffsetWithoutAnimation(ScrollbarOrientation::Vertical, index - visibleItems() + 1);
return true;
}
Modified: trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm (285315 => 285316)
--- trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm 2021-11-04 21:43:02 UTC (rev 285315)
+++ trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm 2021-11-04 21:58:31 UTC (rev 285316)
@@ -1312,15 +1312,15 @@
if (m_horizontalScrollbar) {
if (m_size.width() >= m_pdfDocumentSize.width())
- destroyScrollbar(HorizontalScrollbar);
+ destroyScrollbar(ScrollbarOrientation::Horizontal);
} else if (m_size.width() < m_pdfDocumentSize.width())
- m_horizontalScrollbar = createScrollbar(HorizontalScrollbar);
+ m_horizontalScrollbar = createScrollbar(ScrollbarOrientation::Horizontal);
if (m_verticalScrollbar) {
if (m_size.height() >= m_pdfDocumentSize.height())
- destroyScrollbar(VerticalScrollbar);
+ destroyScrollbar(ScrollbarOrientation::Vertical);
} else if (m_size.height() < m_pdfDocumentSize.height())
- m_verticalScrollbar = createScrollbar(VerticalScrollbar);
+ m_verticalScrollbar = createScrollbar(ScrollbarOrientation::Vertical);
IntSize scrollbarSpace = scrollbarIntrusion();
@@ -1385,7 +1385,7 @@
Ref<Scrollbar> PDFPlugin::createScrollbar(ScrollbarOrientation orientation)
{
auto widget = Scrollbar::createNativeScrollbar(*this, orientation, ScrollbarControlSize::Regular);
- if (orientation == HorizontalScrollbar) {
+ if (orientation == ScrollbarOrientation::Horizontal) {
m_horizontalScrollbarLayer = adoptNS([[WKPDFPluginScrollbarLayer alloc] initWithPDFPlugin:this]);
[m_containerLayer addSublayer:m_horizontalScrollbarLayer.get()];
} else {
@@ -1413,7 +1413,7 @@
void PDFPlugin::destroyScrollbar(ScrollbarOrientation orientation)
{
- RefPtr<Scrollbar>& scrollbar = orientation == HorizontalScrollbar ? m_horizontalScrollbar : m_verticalScrollbar;
+ RefPtr<Scrollbar>& scrollbar = orientation == ScrollbarOrientation::Horizontal ? m_horizontalScrollbar : m_verticalScrollbar;
if (!scrollbar)
return;
@@ -1421,7 +1421,7 @@
scrollbar->removeFromParent();
scrollbar = nullptr;
- if (orientation == HorizontalScrollbar) {
+ if (orientation == ScrollbarOrientation::Horizontal) {
[m_horizontalScrollbarLayer removeFromSuperlayer];
m_horizontalScrollbarLayer = 0;
} else {
@@ -1953,8 +1953,8 @@
m_activeAnnotation = nullptr;
m_annotationContainer = nullptr;
- destroyScrollbar(HorizontalScrollbar);
- destroyScrollbar(VerticalScrollbar);
+ destroyScrollbar(ScrollbarOrientation::Horizontal);
+ destroyScrollbar(ScrollbarOrientation::Vertical);
[m_scrollCornerLayer removeFromSuperlayer];
[m_contentLayer removeFromSuperlayer];