Diff
Modified: trunk/Source/WebCore/ChangeLog (264524 => 264525)
--- trunk/Source/WebCore/ChangeLog 2020-07-17 18:34:47 UTC (rev 264524)
+++ trunk/Source/WebCore/ChangeLog 2020-07-17 18:38:04 UTC (rev 264525)
@@ -1,3 +1,54 @@
+2020-07-17 Simon Fraser <[email protected]>
+
+ Make ScrollbarControlSize an enum class
+ https://bugs.webkit.org/show_bug.cgi?id=199325
+
+ Reviewed by Sam Weinig.
+
+ Make ScrollbarControlSize an enum class, and make some RenderScrollbar methods const.
+
+ * platform/ScrollTypes.h:
+ * platform/ScrollView.cpp:
+ (WebCore::ScrollView::createScrollbar):
+ * platform/ScrollbarTheme.h:
+ (WebCore::ScrollbarTheme::scrollbarThickness):
+ * platform/ios/ScrollbarThemeIOS.h:
+ * platform/mac/ScrollbarThemeMac.h:
+ * platform/mac/ScrollbarThemeMac.mm:
+ (WebCore::scrollbarControlSizeToNSControlSize):
+ (WebCore::scrollbarSizeToIndex):
+ (WebCore::ScrollbarThemeMac::hasButtons):
+ (WebCore::buttonRepaintRect):
+ (WebCore::ScrollbarThemeMac::backButtonRect):
+ (WebCore::ScrollbarThemeMac::forwardButtonRect):
+ (WebCore::ScrollbarThemeMac::trackRect):
+ * platform/mock/ScrollbarThemeMock.cpp:
+ (WebCore::ScrollbarThemeMock::scrollbarThickness):
+ * platform/mock/ScrollbarThemeMock.h:
+ * platform/playstation/ScrollbarThemePlayStation.h:
+ * platform/win/PopupMenuWin.cpp:
+ (WebCore::PopupMenuWin::show):
+ (WebCore::PopupMenuWin::calculatePositionAndSize):
+ * platform/win/ScrollbarThemeWin.h:
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::createScrollbar):
+ * rendering/RenderScrollbar.cpp:
+ (WebCore::RenderScrollbar::RenderScrollbar):
+ (WebCore::RenderScrollbar::buttonRect const):
+ (WebCore::RenderScrollbar::trackRect const):
+ (WebCore::RenderScrollbar::trackPieceRectWithMargins const):
+ (WebCore::RenderScrollbar::minimumThumbLength const):
+ (WebCore::RenderScrollbar::opacity const):
+ (WebCore::RenderScrollbar::buttonRect): Deleted.
+ (WebCore::RenderScrollbar::trackRect): Deleted.
+ (WebCore::RenderScrollbar::trackPieceRectWithMargins): Deleted.
+ (WebCore::RenderScrollbar::minimumThumbLength): Deleted.
+ (WebCore::RenderScrollbar::opacity): Deleted.
+ * rendering/RenderScrollbar.h:
+ * rendering/RenderTheme.h:
+ (WebCore::RenderTheme::scrollbarControlSizeForPart):
+ * rendering/RenderThemeMac.h:
+
2020-07-17 Rob Buis <[email protected]>
Changing URL.host should not override port
Modified: trunk/Source/WebCore/platform/ScrollTypes.h (264524 => 264525)
--- trunk/Source/WebCore/platform/ScrollTypes.h 2020-07-17 18:34:47 UTC (rev 264524)
+++ trunk/Source/WebCore/platform/ScrollTypes.h 2020-07-17 18:38:04 UTC (rev 264525)
@@ -148,9 +148,9 @@
ScrollbarAlwaysOn
};
-enum ScrollbarControlSize : uint8_t {
- RegularScrollbar,
- SmallScrollbar
+enum class ScrollbarControlSize : uint8_t {
+ Regular,
+ Small
};
enum class ScrollbarExpansionState : uint8_t {
Modified: trunk/Source/WebCore/platform/ScrollView.cpp (264524 => 264525)
--- trunk/Source/WebCore/platform/ScrollView.cpp 2020-07-17 18:34:47 UTC (rev 264524)
+++ trunk/Source/WebCore/platform/ScrollView.cpp 2020-07-17 18:38:04 UTC (rev 264525)
@@ -103,7 +103,7 @@
Ref<Scrollbar> ScrollView::createScrollbar(ScrollbarOrientation orientation)
{
- return Scrollbar::createNativeScrollbar(*this, orientation, RegularScrollbar);
+ return Scrollbar::createNativeScrollbar(*this, orientation, ScrollbarControlSize::Regular);
}
void ScrollView::setScrollbarModes(ScrollbarMode horizontalMode, ScrollbarMode verticalMode,
Modified: trunk/Source/WebCore/platform/ScrollbarTheme.h (264524 => 264525)
--- trunk/Source/WebCore/platform/ScrollbarTheme.h 2020-07-17 18:34:47 UTC (rev 264524)
+++ trunk/Source/WebCore/platform/ScrollbarTheme.h 2020-07-17 18:38:04 UTC (rev 264525)
@@ -51,7 +51,7 @@
virtual bool paint(Scrollbar&, GraphicsContext&, const IntRect& /*damageRect*/) { return false; }
virtual ScrollbarPart hitTest(Scrollbar&, const IntPoint&) { return NoPart; }
- virtual int scrollbarThickness(ScrollbarControlSize = RegularScrollbar, ScrollbarExpansionState = ScrollbarExpansionState::Expanded) { return 0; }
+ virtual int scrollbarThickness(ScrollbarControlSize = ScrollbarControlSize::Regular, ScrollbarExpansionState = ScrollbarExpansionState::Expanded) { return 0; }
virtual ScrollbarButtonsPlacement buttonsPlacement() const { return ScrollbarButtonsSingle; }
Modified: trunk/Source/WebCore/platform/ios/ScrollbarThemeIOS.h (264524 => 264525)
--- trunk/Source/WebCore/platform/ios/ScrollbarThemeIOS.h 2020-07-17 18:34:47 UTC (rev 264524)
+++ trunk/Source/WebCore/platform/ios/ScrollbarThemeIOS.h 2020-07-17 18:38:04 UTC (rev 264525)
@@ -38,7 +38,7 @@
bool paint(Scrollbar&, GraphicsContext&, const IntRect& damageRect) override;
- int scrollbarThickness(ScrollbarControlSize = RegularScrollbar, ScrollbarExpansionState = ScrollbarExpansionState::Expanded) override;
+ int scrollbarThickness(ScrollbarControlSize = ScrollbarControlSize::Regular, ScrollbarExpansionState = ScrollbarExpansionState::Expanded) override;
bool supportsControlTints() const override { return true; }
Modified: trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.h (264524 => 264525)
--- trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.h 2020-07-17 18:34:47 UTC (rev 264524)
+++ trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.h 2020-07-17 18:38:04 UTC (rev 264525)
@@ -45,7 +45,7 @@
bool paint(Scrollbar&, GraphicsContext&, const IntRect& damageRect) override;
void paintScrollCorner(GraphicsContext&, const IntRect& cornerRect) override;
- int scrollbarThickness(ScrollbarControlSize = RegularScrollbar, ScrollbarExpansionState = ScrollbarExpansionState::Expanded) override;
+ int scrollbarThickness(ScrollbarControlSize = ScrollbarControlSize::Regular, ScrollbarExpansionState = ScrollbarExpansionState::Expanded) override;
bool supportsControlTints() const override { return true; }
bool usesOverlayScrollbars() const override;
Modified: trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.mm (264524 => 264525)
--- trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.mm 2020-07-17 18:34:47 UTC (rev 264524)
+++ trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.mm 2020-07-17 18:38:04 UTC (rev 264525)
@@ -144,9 +144,9 @@
static NSControlSize scrollbarControlSizeToNSControlSize(ScrollbarControlSize controlSize)
{
switch (controlSize) {
- case RegularScrollbar:
+ case ScrollbarControlSize::Regular:
return NSControlSizeRegular;
- case SmallScrollbar:
+ case ScrollbarControlSize::Small:
return NSControlSizeSmall;
}
@@ -285,12 +285,20 @@
return gButtonPlacement;
}
+inline constexpr unsigned scrollbarSizeToIndex(ScrollbarControlSize scrollbarSize)
+{
+ switch (scrollbarSize) {
+ case ScrollbarControlSize::Regular: return 0;
+ case ScrollbarControlSize::Small: return 1;
+ }
+ return 0;
+}
+
bool ScrollbarThemeMac::hasButtons(Scrollbar& scrollbar)
{
- return scrollbar.enabled() && buttonsPlacement() != ScrollbarButtonsNone
- && (scrollbar.orientation() == HorizontalScrollbar
- ? scrollbar.width()
- : scrollbar.height()) >= 2 * (cRealButtonLength[scrollbar.controlSize()] - cButtonHitInset[scrollbar.controlSize()]);
+ if (scrollbar.enabled() && buttonsPlacement() != ScrollbarButtonsNone && (scrollbar.orientation() == HorizontalScrollbar))
+ return scrollbar.width();
+ return scrollbar.height() >= 2 * (cRealButtonLength[scrollbarSizeToIndex(scrollbar.controlSize())] - cButtonHitInset[scrollbarSizeToIndex(scrollbar.controlSize())]);
}
bool ScrollbarThemeMac::hasThumb(Scrollbar& scrollbar)
@@ -312,13 +320,13 @@
IntRect paintRect(buttonRect);
if (orientation == HorizontalScrollbar) {
- paintRect.setWidth(cRealButtonLength[controlSize]);
+ paintRect.setWidth(cRealButtonLength[scrollbarSizeToIndex(controlSize)]);
if (!start)
- paintRect.setX(buttonRect.x() - (cRealButtonLength[controlSize] - buttonRect.width()));
+ paintRect.setX(buttonRect.x() - (cRealButtonLength[scrollbarSizeToIndex(controlSize)] - buttonRect.width()));
} else {
- paintRect.setHeight(cRealButtonLength[controlSize]);
+ paintRect.setHeight(cRealButtonLength[scrollbarSizeToIndex(controlSize)]);
if (!start)
- paintRect.setY(buttonRect.y() - (cRealButtonLength[controlSize] - buttonRect.height()));
+ paintRect.setY(buttonRect.y() - (cRealButtonLength[scrollbarSizeToIndex(controlSize)] - buttonRect.height()));
}
return paintRect;
@@ -338,19 +346,19 @@
bool outerButton = part == BackButtonStartPart && (buttonsPlacement() == ScrollbarButtonsDoubleStart || buttonsPlacement() == ScrollbarButtonsDoubleBoth);
if (outerButton) {
if (scrollbar.orientation() == HorizontalScrollbar)
- result = IntRect(scrollbar.x(), scrollbar.y(), cOuterButtonLength[scrollbar.controlSize()] + (painting ? cOuterButtonOverlap : 0), thickness);
+ result = IntRect(scrollbar.x(), scrollbar.y(), cOuterButtonLength[scrollbarSizeToIndex(scrollbar.controlSize())] + (painting ? cOuterButtonOverlap : 0), thickness);
else
- result = IntRect(scrollbar.x(), scrollbar.y(), thickness, cOuterButtonLength[scrollbar.controlSize()] + (painting ? cOuterButtonOverlap : 0));
+ result = IntRect(scrollbar.x(), scrollbar.y(), thickness, cOuterButtonLength[scrollbarSizeToIndex(scrollbar.controlSize())] + (painting ? cOuterButtonOverlap : 0));
return result;
}
// Our repaint rect is slightly larger, since we are a button that is adjacent to the track.
if (scrollbar.orientation() == HorizontalScrollbar) {
- int start = part == BackButtonStartPart ? scrollbar.x() : scrollbar.x() + scrollbar.width() - cOuterButtonLength[scrollbar.controlSize()] - cButtonLength[scrollbar.controlSize()];
- result = IntRect(start, scrollbar.y(), cButtonLength[scrollbar.controlSize()], thickness);
+ 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 {
- int start = part == BackButtonStartPart ? scrollbar.y() : scrollbar.y() + scrollbar.height() - cOuterButtonLength[scrollbar.controlSize()] - cButtonLength[scrollbar.controlSize()];
- result = IntRect(scrollbar.x(), start, thickness, cButtonLength[scrollbar.controlSize()]);
+ int start = part == BackButtonStartPart ? scrollbar.y() : scrollbar.y() + scrollbar.height() - cOuterButtonLength[scrollbarSizeToIndex(scrollbar.controlSize())] - cButtonLength[scrollbarSizeToIndex(scrollbar.controlSize())];
+ result = IntRect(scrollbar.x(), start, thickness, cButtonLength[scrollbarSizeToIndex(scrollbar.controlSize())]);
}
if (painting)
@@ -369,8 +377,8 @@
return result;
int thickness = scrollbarThickness(scrollbar.controlSize());
- int outerButtonLength = cOuterButtonLength[scrollbar.controlSize()];
- int buttonLength = cButtonLength[scrollbar.controlSize()];
+ int outerButtonLength = cOuterButtonLength[scrollbarSizeToIndex(scrollbar.controlSize())];
+ int buttonLength = cButtonLength[scrollbarSizeToIndex(scrollbar.controlSize())];
bool outerButton = part == ForwardButtonEndPart && (buttonsPlacement() == ScrollbarButtonsDoubleEnd || buttonsPlacement() == ScrollbarButtonsDoubleBoth);
if (outerButton) {
@@ -407,8 +415,8 @@
int thickness = scrollbarThickness(scrollbar.controlSize());
int startWidth = 0;
int endWidth = 0;
- int outerButtonLength = cOuterButtonLength[scrollbar.controlSize()];
- int buttonLength = cButtonLength[scrollbar.controlSize()];
+ int outerButtonLength = cOuterButtonLength[scrollbarSizeToIndex(scrollbar.controlSize())];
+ int buttonLength = cButtonLength[scrollbarSizeToIndex(scrollbar.controlSize())];
int doubleButtonLength = outerButtonLength + buttonLength;
switch (buttonsPlacement()) {
case ScrollbarButtonsSingle:
Modified: trunk/Source/WebCore/platform/mock/ScrollbarThemeMock.cpp (264524 => 264525)
--- trunk/Source/WebCore/platform/mock/ScrollbarThemeMock.cpp 2020-07-17 18:34:47 UTC (rev 264524)
+++ trunk/Source/WebCore/platform/mock/ScrollbarThemeMock.cpp 2020-07-17 18:38:04 UTC (rev 264525)
@@ -41,7 +41,7 @@
int ScrollbarThemeMock::scrollbarThickness(ScrollbarControlSize controlSize, ScrollbarExpansionState)
{
- return cScrollbarThickness[controlSize];
+ return cScrollbarThickness[static_cast<uint8_t>(controlSize)];
}
void ScrollbarThemeMock::paintTrackBackground(GraphicsContext& context, Scrollbar& scrollbar, const IntRect& trackRect)
Modified: trunk/Source/WebCore/platform/mock/ScrollbarThemeMock.h (264524 => 264525)
--- trunk/Source/WebCore/platform/mock/ScrollbarThemeMock.h 2020-07-17 18:34:47 UTC (rev 264524)
+++ trunk/Source/WebCore/platform/mock/ScrollbarThemeMock.h 2020-07-17 18:38:04 UTC (rev 264525)
@@ -33,7 +33,7 @@
// Scrollbar theme used in image snapshots, to eliminate appearance differences between platforms.
class ScrollbarThemeMock : public ScrollbarThemeComposite {
public:
- int scrollbarThickness(ScrollbarControlSize = RegularScrollbar, ScrollbarExpansionState = ScrollbarExpansionState::Expanded) override;
+ int scrollbarThickness(ScrollbarControlSize = ScrollbarControlSize::Regular, ScrollbarExpansionState = ScrollbarExpansionState::Expanded) override;
protected:
bool hasButtons(Scrollbar&) override { return false; }
Modified: trunk/Source/WebCore/platform/playstation/ScrollbarThemePlayStation.h (264524 => 264525)
--- trunk/Source/WebCore/platform/playstation/ScrollbarThemePlayStation.h 2020-07-17 18:34:47 UTC (rev 264524)
+++ trunk/Source/WebCore/platform/playstation/ScrollbarThemePlayStation.h 2020-07-17 18:38:04 UTC (rev 264525)
@@ -34,7 +34,7 @@
ScrollbarThemePlayStation() = default;
virtual ~ScrollbarThemePlayStation() = default;
- int scrollbarThickness(ScrollbarControlSize = RegularScrollbar, ScrollbarExpansionState = ScrollbarExpansionState::Expanded) override;
+ int scrollbarThickness(ScrollbarControlSize = ScrollbarControlSize::Regular, ScrollbarExpansionState = ScrollbarExpansionState::Expanded) override;
bool hasButtons(Scrollbar&) override;
bool hasThumb(Scrollbar&) override;
Modified: trunk/Source/WebCore/platform/win/PopupMenuWin.cpp (264524 => 264525)
--- trunk/Source/WebCore/platform/win/PopupMenuWin.cpp 2020-07-17 18:34:47 UTC (rev 264524)
+++ trunk/Source/WebCore/platform/win/PopupMenuWin.cpp 2020-07-17 18:38:04 UTC (rev 264525)
@@ -141,7 +141,7 @@
if (!m_scrollbar && visibleItems() < client()->listSize()) {
// We need a scroll bar
- m_scrollbar = client()->createScrollbar(*this, VerticalScrollbar, SmallScrollbar);
+ m_scrollbar = client()->createScrollbar(*this, VerticalScrollbar, ScrollbarControlSize::Small);
m_scrollbar->styleChanged();
}
@@ -356,7 +356,7 @@
if (naturalHeight > maxPopupHeight)
// We need room for a scrollbar
- popupWidth += ScrollbarTheme::theme().scrollbarThickness(SmallScrollbar);
+ popupWidth += ScrollbarTheme::theme().scrollbarThickness(ScrollbarControlSize::Small);
// Add padding to align the popup text with the <select> text
popupWidth += std::max<int>(0, client()->clientPaddingRight() - client()->clientInsetRight()) + std::max<int>(0, client()->clientPaddingLeft() - client()->clientInsetLeft());
Modified: trunk/Source/WebCore/platform/win/ScrollbarThemeWin.h (264524 => 264525)
--- trunk/Source/WebCore/platform/win/ScrollbarThemeWin.h 2020-07-17 18:34:47 UTC (rev 264524)
+++ trunk/Source/WebCore/platform/win/ScrollbarThemeWin.h 2020-07-17 18:38:04 UTC (rev 264525)
@@ -35,7 +35,7 @@
ScrollbarThemeWin();
virtual ~ScrollbarThemeWin();
- int scrollbarThickness(ScrollbarControlSize = RegularScrollbar, ScrollbarExpansionState = ScrollbarExpansionState::Expanded) override;
+ int scrollbarThickness(ScrollbarControlSize = ScrollbarControlSize::Regular, ScrollbarExpansionState = ScrollbarExpansionState::Expanded) override;
void themeChanged() override;
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (264524 => 264525)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2020-07-17 18:34:47 UTC (rev 264524)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2020-07-17 18:38:04 UTC (rev 264525)
@@ -3477,7 +3477,7 @@
if (hasCustomScrollbarStyle)
widget = RenderScrollbar::createCustomScrollbar(*this, orientation, downcast<RenderBox>(actualRenderer).element());
else {
- widget = Scrollbar::createNativeScrollbar(*this, orientation, RegularScrollbar);
+ widget = Scrollbar::createNativeScrollbar(*this, orientation, ScrollbarControlSize::Regular);
didAddScrollbar(widget.get(), orientation);
if (page().isMonitoringWheelEvents())
scrollAnimator().setWheelEventTestMonitor(page().wheelEventTestMonitor());
Modified: trunk/Source/WebCore/rendering/RenderScrollbar.cpp (264524 => 264525)
--- trunk/Source/WebCore/rendering/RenderScrollbar.cpp 2020-07-17 18:34:47 UTC (rev 264524)
+++ trunk/Source/WebCore/rendering/RenderScrollbar.cpp 2020-07-17 18:38:04 UTC (rev 264525)
@@ -42,7 +42,7 @@
}
RenderScrollbar::RenderScrollbar(ScrollableArea& scrollableArea, ScrollbarOrientation orientation, Element* ownerElement, Frame* owningFrame)
- : Scrollbar(scrollableArea, orientation, RegularScrollbar, RenderScrollbarTheme::renderScrollbarTheme(), true)
+ : Scrollbar(scrollableArea, orientation, ScrollbarControlSize::Regular, RenderScrollbarTheme::renderScrollbarTheme(), true)
, m_ownerElement(ownerElement)
, m_owningFrame(owningFrame)
{
@@ -267,7 +267,7 @@
partRenderer->paintIntoRect(graphicsContext, location(), rect);
}
-IntRect RenderScrollbar::buttonRect(ScrollbarPart partType)
+IntRect RenderScrollbar::buttonRect(ScrollbarPart partType) const
{
RenderScrollbarPart* partRenderer = m_parts.get(partType);
if (!partRenderer)
@@ -299,7 +299,7 @@
isHorizontal ? height() : pixelSnappedIntSize.height());
}
-IntRect RenderScrollbar::trackRect(int startLength, int endLength)
+IntRect RenderScrollbar::trackRect(int startLength, int endLength) const
{
RenderScrollbarPart* part = m_parts.get(TrackBGPart);
if (part)
@@ -323,7 +323,7 @@
return IntRect(x(), y() + startLength, width(), height() - totalLength);
}
-IntRect RenderScrollbar::trackPieceRectWithMargins(ScrollbarPart partType, const IntRect& oldRect)
+IntRect RenderScrollbar::trackPieceRectWithMargins(ScrollbarPart partType, const IntRect& oldRect) const
{
RenderScrollbarPart* partRenderer = m_parts.get(partType);
if (!partRenderer)
@@ -342,7 +342,7 @@
return rect;
}
-int RenderScrollbar::minimumThumbLength()
+int RenderScrollbar::minimumThumbLength() const
{
RenderScrollbarPart* partRenderer = m_parts.get(ThumbPart);
if (!partRenderer)
@@ -351,7 +351,7 @@
return orientation() == HorizontalScrollbar ? partRenderer->width() : partRenderer->height();
}
-float RenderScrollbar::opacity()
+float RenderScrollbar::opacity() const
{
RenderScrollbarPart* partRenderer = m_parts.get(ScrollbarBGPart);
if (!partRenderer)
Modified: trunk/Source/WebCore/rendering/RenderScrollbar.h (264524 => 264525)
--- trunk/Source/WebCore/rendering/RenderScrollbar.h 2020-07-17 18:34:47 UTC (rev 264524)
+++ trunk/Source/WebCore/rendering/RenderScrollbar.h 2020-07-17 18:38:04 UTC (rev 264525)
@@ -48,13 +48,13 @@
void paintPart(GraphicsContext&, ScrollbarPart, const IntRect&);
- IntRect buttonRect(ScrollbarPart);
- IntRect trackRect(int startLength, int endLength);
- IntRect trackPieceRectWithMargins(ScrollbarPart, const IntRect&);
+ IntRect buttonRect(ScrollbarPart) const;
+ IntRect trackRect(int startLength, int endLength) const;
+ IntRect trackPieceRectWithMargins(ScrollbarPart, const IntRect&) const;
- int minimumThumbLength();
+ int minimumThumbLength() const;
- float opacity();
+ float opacity() const;
bool isHiddenByStyle() const final;
Modified: trunk/Source/WebCore/rendering/RenderTheme.h (264524 => 264525)
--- trunk/Source/WebCore/rendering/RenderTheme.h 2020-07-17 18:34:47 UTC (rev 264524)
+++ trunk/Source/WebCore/rendering/RenderTheme.h 2020-07-17 18:38:04 UTC (rev 264525)
@@ -199,7 +199,7 @@
virtual bool popupOptionSupportsTextIndent() const { return false; }
virtual PopupMenuStyle::PopupMenuSize popupMenuSize(const RenderStyle&, IntRect&) const { return PopupMenuStyle::PopupMenuSizeNormal; }
- virtual ScrollbarControlSize scrollbarControlSizeForPart(ControlPart) { return RegularScrollbar; }
+ virtual ScrollbarControlSize scrollbarControlSizeForPart(ControlPart) { return ScrollbarControlSize::Regular; }
// Returns the repeat interval of the animation for the progress bar.
virtual Seconds animationRepeatIntervalForProgressBar(RenderProgress&) const;
Modified: trunk/Source/WebCore/rendering/RenderThemeMac.h (264524 => 264525)
--- trunk/Source/WebCore/rendering/RenderThemeMac.h 2020-07-17 18:34:47 UTC (rev 264524)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.h 2020-07-17 18:38:04 UTC (rev 264525)
@@ -67,7 +67,7 @@
Color platformFocusRingColor(OptionSet<StyleColor::Options>) const final;
Color platformTextSearchHighlightColor(OptionSet<StyleColor::Options>) const final;
- ScrollbarControlSize scrollbarControlSizeForPart(ControlPart) final { return SmallScrollbar; }
+ ScrollbarControlSize scrollbarControlSizeForPart(ControlPart) final { return ScrollbarControlSize::Small; }
int minimumMenuListSize(const RenderStyle&) const final;
Modified: trunk/Source/WebKit/ChangeLog (264524 => 264525)
--- trunk/Source/WebKit/ChangeLog 2020-07-17 18:34:47 UTC (rev 264524)
+++ trunk/Source/WebKit/ChangeLog 2020-07-17 18:38:04 UTC (rev 264525)
@@ -1,3 +1,18 @@
+2020-07-17 Simon Fraser <[email protected]>
+
+ Make ScrollbarControlSize an enum class
+ https://bugs.webkit.org/show_bug.cgi?id=199325
+
+ Reviewed by Sam Weinig.
+
+ Make ScrollbarControlSize an enum class, and make some RenderScrollbar methods const.
+
+ * UIProcess/win/WebPopupMenuProxyWin.cpp:
+ (WebKit::WebPopupMenuProxyWin::showPopupMenu):
+ (WebKit::WebPopupMenuProxyWin::calculatePositionAndSize):
+ * WebProcess/Plugins/PDF/PDFPlugin.mm:
+ (WebKit::PDFPlugin::createScrollbar):
+
2020-07-17 Tim Horton <[email protected]>
Add a addition point for extra user media sandbox extensions
Modified: trunk/Source/WebKit/UIProcess/win/WebPopupMenuProxyWin.cpp (264524 => 264525)
--- trunk/Source/WebKit/UIProcess/win/WebPopupMenuProxyWin.cpp 2020-07-17 18:34:47 UTC (rev 264524)
+++ trunk/Source/WebKit/UIProcess/win/WebPopupMenuProxyWin.cpp 2020-07-17 18:38:04 UTC (rev 264525)
@@ -198,7 +198,7 @@
HWND hostWindow = m_webView->window();
if (!m_scrollbar && visibleItems() < m_items.size()) {
- m_scrollbar = Scrollbar::createNativeScrollbar(*this, VerticalScrollbar, SmallScrollbar);
+ m_scrollbar = Scrollbar::createNativeScrollbar(*this, VerticalScrollbar, ScrollbarControlSize::Small);
m_scrollbar->styleChanged();
}
@@ -384,7 +384,7 @@
if (naturalHeight > maxPopupHeight) {
// We need room for a scrollbar
- popupWidth += ScrollbarTheme::theme().scrollbarThickness(SmallScrollbar);
+ popupWidth += ScrollbarTheme::theme().scrollbarThickness(ScrollbarControlSize::Small);
}
popupHeight += 2 * popupWindowBorderWidth;
Modified: trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm (264524 => 264525)
--- trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm 2020-07-17 18:34:47 UTC (rev 264524)
+++ trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm 2020-07-17 18:38:04 UTC (rev 264525)
@@ -1286,7 +1286,7 @@
Ref<Scrollbar> PDFPlugin::createScrollbar(ScrollbarOrientation orientation)
{
- auto widget = Scrollbar::createNativeScrollbar(*this, orientation, RegularScrollbar);
+ auto widget = Scrollbar::createNativeScrollbar(*this, orientation, ScrollbarControlSize::Regular);
if (orientation == HorizontalScrollbar) {
m_horizontalScrollbarLayer = adoptNS([[WKPDFPluginScrollbarLayer alloc] initWithPDFPlugin:this]);
[m_containerLayer addSublayer:m_horizontalScrollbarLayer.get()];