Diff
Modified: trunk/Source/WTF/ChangeLog (260051 => 260052)
--- trunk/Source/WTF/ChangeLog 2020-04-14 00:32:26 UTC (rev 260051)
+++ trunk/Source/WTF/ChangeLog 2020-04-14 00:47:00 UTC (rev 260052)
@@ -1,3 +1,15 @@
+2020-04-13 Simon Fraser <[email protected]>
+
+ Add ENABLE_CUSTOM_SCROLLBARS and define it for macOS and for non-Cocoa platforms
+ https://bugs.webkit.org/show_bug.cgi?id=210460
+
+ Reviewed by Tim Horton.
+
+ Define ENABLE_CUSTOM_SCROLLBARS for PLATFORM(MAC) and other non-Cocoa platforms.
+
+ * wtf/PlatformEnable.h:
+ * wtf/PlatformEnableCocoa.h:
+
2020-04-13 David Kilzer <[email protected]>
Fix clang static analyzer warnings about unused instance variables in WebIconDatabase, WKView
Modified: trunk/Source/WTF/wtf/PlatformEnable.h (260051 => 260052)
--- trunk/Source/WTF/wtf/PlatformEnable.h 2020-04-14 00:32:26 UTC (rev 260051)
+++ trunk/Source/WTF/wtf/PlatformEnable.h 2020-04-14 00:47:00 UTC (rev 260052)
@@ -835,6 +835,10 @@
#endif
#endif
+#if !defined(ENABLE_CUSTOM_SCROLLBARS)
+#define ENABLE_CUSTOM_SCROLLBARS 1
+#endif
+
/* This feature works by embedding the OpcodeID in the 32 bit just before the generated LLint code
that executes each opcode. It cannot be supported by the CLoop since there's no way to embed the
OpcodeID word in the CLoop's switch statement cases. It is also currently not implemented for MSVC.
Modified: trunk/Source/WTF/wtf/PlatformEnableCocoa.h (260051 => 260052)
--- trunk/Source/WTF/wtf/PlatformEnableCocoa.h 2020-04-14 00:32:26 UTC (rev 260051)
+++ trunk/Source/WTF/wtf/PlatformEnableCocoa.h 2020-04-14 00:47:00 UTC (rev 260052)
@@ -211,6 +211,10 @@
#define ENABLE_ASYNC_SCROLLING 1
#endif
+#if !defined(ENABLE_CUSTOM_SCROLLBARS) && PLATFORM(MAC)
+#define ENABLE_CUSTOM_SCROLLBARS 1
+#endif
+
#if !defined(ENABLE_SCROLLING_THREAD) && PLATFORM(MAC)
#define ENABLE_SCROLLING_THREAD 1
#endif
Modified: trunk/Source/WebCore/ChangeLog (260051 => 260052)
--- trunk/Source/WebCore/ChangeLog 2020-04-14 00:32:26 UTC (rev 260051)
+++ trunk/Source/WebCore/ChangeLog 2020-04-14 00:47:00 UTC (rev 260052)
@@ -1,3 +1,39 @@
+2020-04-13 Simon Fraser <[email protected]>
+
+ Add ENABLE_CUSTOM_SCROLLBARS and define it for macOS and for non-Cocoa platforms
+ https://bugs.webkit.org/show_bug.cgi?id=210460
+
+ Reviewed by Tim Horton.
+
+ Wrap all custom scrollbar and custom scroll corner code in ENABLE(CUSTOM_SCROLLBARS).
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::createScrollbar):
+ (WebCore::FrameView::updateScrollCorner):
+ * page/FrameView.h:
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::createScrollbar):
+ (WebCore::RenderLayer::calculateClipRects const):
+ * rendering/RenderLayer.h:
+ * rendering/RenderLayerCompositor.cpp:
+ * rendering/RenderListBox.cpp:
+ (WebCore::RenderListBox::createScrollbar):
+ * rendering/RenderMenuList.cpp:
+ (RenderMenuList::createScrollbar):
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::containingBlock const):
+ * rendering/RenderObject.h:
+ * rendering/RenderScrollbar.cpp:
+ * rendering/RenderScrollbar.h:
+ * rendering/RenderScrollbarPart.cpp:
+ * rendering/RenderScrollbarPart.h:
+ * rendering/RenderScrollbarTheme.cpp:
+ * rendering/RenderScrollbarTheme.h:
+ * rendering/RenderSearchField.cpp:
+ (WebCore::RenderSearchField::createScrollbar):
+ * rendering/RenderTextControlSingleLine.cpp:
+ * style/StyleResolver.cpp:
+
2020-04-13 Kenneth Russell <[email protected]>
Clean up more resources during WebGLLayer teardown
Modified: trunk/Source/WebCore/page/FrameView.cpp (260051 => 260052)
--- trunk/Source/WebCore/page/FrameView.cpp 2020-04-14 00:32:26 UTC (rev 260051)
+++ trunk/Source/WebCore/page/FrameView.cpp 2020-04-14 00:47:00 UTC (rev 260052)
@@ -554,6 +554,7 @@
Ref<Scrollbar> FrameView::createScrollbar(ScrollbarOrientation orientation)
{
+#if ENABLE(CUSTOM_SCROLLBARS)
if (auto element = rootElementForCustomScrollbarPartStyle(PseudoId::Scrollbar))
return RenderScrollbar::createCustomScrollbar(*this, orientation, element.get());
@@ -562,6 +563,7 @@
RenderWidget* frameRenderer = frame().ownerRenderer();
if (frameRenderer && frameRenderer->style().hasPseudoStyle(PseudoId::Scrollbar))
return RenderScrollbar::createCustomScrollbar(*this, orientation, nullptr, &frame());
+#endif
// Nobody set a custom style, so we just use a native scrollbar.
return ScrollView::createScrollbar(orientation);
@@ -3949,6 +3951,7 @@
void FrameView::updateScrollCorner()
{
+#if ENABLE(CUSTOM_SCROLLBARS)
RenderElement* renderer = nullptr;
std::unique_ptr<RenderStyle> cornerStyle;
IntRect cornerRect = scrollCornerRect();
@@ -3989,6 +3992,7 @@
m_scrollCorner->setStyle(WTFMove(*cornerStyle));
invalidateScrollCorner(cornerRect);
}
+#endif
}
void FrameView::paintScrollCorner(GraphicsContext& context, const IntRect& cornerRect)
Modified: trunk/Source/WebCore/page/FrameView.h (260051 => 260052)
--- trunk/Source/WebCore/page/FrameView.h 2020-04-14 00:32:26 UTC (rev 260051)
+++ trunk/Source/WebCore/page/FrameView.h 2020-04-14 00:47:00 UTC (rev 260052)
@@ -502,7 +502,9 @@
WEBCORE_EXPORT FloatRect clientToLayoutViewportRect(FloatRect) const;
WEBCORE_EXPORT FloatPoint clientToLayoutViewportPoint(FloatPoint) const;
+#if ENABLE(CUSTOM_SCROLLBARS)
bool isFrameViewScrollCorner(const RenderScrollbarPart& scrollCorner) const { return m_scrollCorner.get() == &scrollCorner; }
+#endif
// isScrollable() takes an optional Scrollability parameter that allows the caller to define what they mean by 'scrollable.'
// Most callers are interested in the default value, Scrollability::Scrollable, which means that there is actually content
@@ -841,8 +843,10 @@
RefPtr<ContainerNode> m_maintainScrollPositionAnchor;
RefPtr<Node> m_nodeToDraw;
+#if ENABLE(CUSTOM_SCROLLBARS)
// Renderer to hold our custom scroll corner.
RenderPtr<RenderScrollbarPart> m_scrollCorner;
+#endif
Timer m_updateEmbeddedObjectsTimer;
Timer m_updateWidgetPositionsTimer;
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (260051 => 260052)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2020-04-14 00:32:26 UTC (rev 260051)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2020-04-14 00:47:00 UTC (rev 260052)
@@ -3489,11 +3489,14 @@
{
RefPtr<Scrollbar> widget;
ASSERT(rendererForScrollbar(renderer()));
+#if ENABLE(CUSTOM_SCROLLBARS)
auto& actualRenderer = *rendererForScrollbar(renderer());
bool hasCustomScrollbarStyle = is<RenderBox>(actualRenderer) && downcast<RenderBox>(actualRenderer).style().hasPseudoStyle(PseudoId::Scrollbar);
if (hasCustomScrollbarStyle)
widget = RenderScrollbar::createCustomScrollbar(*this, orientation, downcast<RenderBox>(actualRenderer).element());
- else {
+ else
+#endif
+ {
widget = Scrollbar::createNativeScrollbar(*this, orientation, RegularScrollbar);
didAddScrollbar(widget.get(), orientation);
if (page().isMonitoringWheelEvents())
@@ -6811,6 +6814,7 @@
void RenderLayer::updateScrollCornerStyle()
{
+#if ENABLE(CUSTOM_SCROLLBARS)
RenderElement* actualRenderer = rendererForScrollbar(renderer());
auto corner = renderer().hasOverflowClip() ? actualRenderer->getUncachedPseudoStyle({ PseudoId::ScrollbarCorner }, &actualRenderer->style()) : nullptr;
@@ -6826,18 +6830,23 @@
m_scrollCorner->initializeStyle();
} else
m_scrollCorner->setStyle(WTFMove(*corner));
+#endif
}
void RenderLayer::clearScrollCorner()
{
+#if ENABLE(CUSTOM_SCROLLBARS)
if (!m_scrollCorner)
return;
m_scrollCorner->setParent(nullptr);
m_scrollCorner = nullptr;
+#endif
+
}
void RenderLayer::updateResizerStyle()
{
+#if ENABLE(CUSTOM_SCROLLBARS)
RenderElement* actualRenderer = rendererForScrollbar(renderer());
auto resizer = renderer().hasOverflowClip() ? actualRenderer->getUncachedPseudoStyle({ PseudoId::Resizer }, &actualRenderer->style()) : nullptr;
@@ -6853,14 +6862,17 @@
m_resizer->initializeStyle();
} else
m_resizer->setStyle(WTFMove(*resizer));
+#endif
}
void RenderLayer::clearResizer()
{
+#if ENABLE(CUSTOM_SCROLLBARS)
if (!m_resizer)
return;
m_resizer->setParent(nullptr);
m_resizer = nullptr;
+#endif
}
RenderLayer* RenderLayer::reflectionLayer() const
Modified: trunk/Source/WebCore/rendering/RenderLayer.h (260051 => 260052)
--- trunk/Source/WebCore/rendering/RenderLayer.h 2020-04-14 00:32:26 UTC (rev 260051)
+++ trunk/Source/WebCore/rendering/RenderLayer.h 2020-04-14 00:47:00 UTC (rev 260052)
@@ -77,12 +77,15 @@
class RenderLayerFilters;
class RenderMarquee;
class RenderReplica;
-class RenderScrollbarPart;
class RenderStyle;
class RenderView;
class Scrollbar;
class TransformationMatrix;
+#if ENABLE(CUSTOM_SCROLLBARS)
+class RenderScrollbarPart;
+#endif
+
enum BorderRadiusClippingRule { IncludeSelfForBorderRadius, DoNotIncludeSelfForBorderRadius };
enum IncludeSelfOrNot { IncludeSelf, ExcludeSelf };
enum CrossFrameBoundaries { No, Yes };
@@ -1350,9 +1353,11 @@
// May ultimately be extended to many replicas (with their own paint order).
RenderPtr<RenderReplica> m_reflection;
+#if ENABLE(CUSTOM_SCROLLBARS)
// Renderers to hold our custom scroll corner and resizer.
RenderPtr<RenderScrollbarPart> m_scrollCorner;
RenderPtr<RenderScrollbarPart> m_resizer;
+#endif
// Pointer to the enclosing RenderLayer that caused us to be paginated. It is 0 if we are not paginated.
WeakPtr<RenderLayer> m_enclosingPaginationLayer;
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (260051 => 260052)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2020-04-14 00:32:26 UTC (rev 260051)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2020-04-14 00:47:00 UTC (rev 260052)
@@ -76,7 +76,6 @@
#if PLATFORM(IOS_FAMILY)
#include "LegacyTileCache.h"
-#include "RenderScrollbar.h"
#endif
#if PLATFORM(MAC)
Modified: trunk/Source/WebCore/rendering/RenderListBox.cpp (260051 => 260052)
--- trunk/Source/WebCore/rendering/RenderListBox.cpp 2020-04-14 00:32:26 UTC (rev 260051)
+++ trunk/Source/WebCore/rendering/RenderListBox.cpp 2020-04-14 00:47:00 UTC (rev 260052)
@@ -918,10 +918,13 @@
Ref<Scrollbar> RenderListBox::createScrollbar()
{
RefPtr<Scrollbar> widget;
+#if ENABLE(CUSTOM_SCROLLBARS)
bool hasCustomScrollbarStyle = style().hasPseudoStyle(PseudoId::Scrollbar);
if (hasCustomScrollbarStyle)
widget = RenderScrollbar::createCustomScrollbar(*this, VerticalScrollbar, &selectElement());
- else {
+ else
+#endif
+ {
widget = Scrollbar::createNativeScrollbar(*this, VerticalScrollbar, theme().scrollbarControlSizeForPart(ListboxPart));
didAddScrollbar(widget.get(), VerticalScrollbar);
if (page().isMonitoringWheelEvents())
Modified: trunk/Source/WebCore/rendering/RenderMenuList.cpp (260051 => 260052)
--- trunk/Source/WebCore/rendering/RenderMenuList.cpp 2020-04-14 00:32:26 UTC (rev 260051)
+++ trunk/Source/WebCore/rendering/RenderMenuList.cpp 2020-04-14 00:47:00 UTC (rev 260052)
@@ -560,9 +560,11 @@
Ref<Scrollbar> RenderMenuList::createScrollbar(ScrollableArea& scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize controlSize)
{
+#if ENABLE(CUSTOM_SCROLLBARS)
bool hasCustomScrollbarStyle = style().hasPseudoStyle(PseudoId::Scrollbar);
if (hasCustomScrollbarStyle)
return RenderScrollbar::createCustomScrollbar(scrollableArea, orientation, &selectElement());
+#endif
return Scrollbar::createNativeScrollbar(scrollableArea, orientation, controlSize);
}
Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (260051 => 260052)
--- trunk/Source/WebCore/rendering/RenderObject.cpp 2020-04-14 00:32:26 UTC (rev 260051)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp 2020-04-14 00:47:00 UTC (rev 260052)
@@ -632,11 +632,13 @@
if (is<RenderText>(*this))
return containingBlockForObjectInFlow();
+#if ENABLE(CUSTOM_SCROLLBARS)
if (!parent() && is<RenderScrollbarPart>(*this)) {
if (auto* scrollbarPart = downcast<RenderScrollbarPart>(*this).rendererOwningScrollbar())
return containingBlockForRenderer(*scrollbarPart);
return nullptr;
}
+#endif
return containingBlockForRenderer(downcast<RenderElement>(*this));
}
Modified: trunk/Source/WebCore/rendering/RenderObject.h (260051 => 260052)
--- trunk/Source/WebCore/rendering/RenderObject.h 2020-04-14 00:32:26 UTC (rev 260051)
+++ trunk/Source/WebCore/rendering/RenderObject.h 2020-04-14 00:47:00 UTC (rev 260052)
@@ -265,7 +265,9 @@
virtual bool isRenderMultiColumnFlow() const { return false; }
virtual bool isRenderMultiColumnSpannerPlaceholder() const { return false; }
+#if ENABLE(CUSTOM_SCROLLBARS)
virtual bool isRenderScrollbarPart() const { return false; }
+#endif
bool isDocumentElementRenderer() const { return document().documentElement() == &m_node; }
bool isBody() const { return node() && node()->hasTagName(HTMLNames::bodyTag); }
Modified: trunk/Source/WebCore/rendering/RenderScrollbar.cpp (260051 => 260052)
--- trunk/Source/WebCore/rendering/RenderScrollbar.cpp 2020-04-14 00:32:26 UTC (rev 260051)
+++ trunk/Source/WebCore/rendering/RenderScrollbar.cpp 2020-04-14 00:47:00 UTC (rev 260052)
@@ -26,6 +26,8 @@
#include "config.h"
#include "RenderScrollbar.h"
+#if ENABLE(CUSTOM_SCROLLBARS)
+
#include "Frame.h"
#include "FrameView.h"
#include "RenderScrollbarPart.h"
@@ -367,3 +369,6 @@
}
}
+
+#endif // ENABLE(CUSTOM_SCROLLBARS)
+
Modified: trunk/Source/WebCore/rendering/RenderScrollbar.h (260051 => 260052)
--- trunk/Source/WebCore/rendering/RenderScrollbar.h 2020-04-14 00:32:26 UTC (rev 260051)
+++ trunk/Source/WebCore/rendering/RenderScrollbar.h 2020-04-14 00:47:00 UTC (rev 260052)
@@ -30,6 +30,8 @@
#include "Scrollbar.h"
#include <wtf/HashMap.h>
+#if ENABLE(CUSTOM_SCROLLBARS)
+
namespace WebCore {
class Frame;
@@ -94,3 +96,5 @@
SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::RenderScrollbar)
static bool isType(const WebCore::Scrollbar& scrollbar) { return scrollbar.isCustomScrollbar(); }
SPECIALIZE_TYPE_TRAITS_END()
+
+#endif // ENABLE(CUSTOM_SCROLLBARS)
Modified: trunk/Source/WebCore/rendering/RenderScrollbarPart.cpp (260051 => 260052)
--- trunk/Source/WebCore/rendering/RenderScrollbarPart.cpp 2020-04-14 00:32:26 UTC (rev 260051)
+++ trunk/Source/WebCore/rendering/RenderScrollbarPart.cpp 2020-04-14 00:47:00 UTC (rev 260052)
@@ -26,6 +26,8 @@
#include "config.h"
#include "RenderScrollbarPart.h"
+#if ENABLE(CUSTOM_SCROLLBARS)
+
#include "PaintInfo.h"
#include "RenderScrollbar.h"
#include "RenderScrollbarTheme.h"
@@ -201,3 +203,4 @@
}
}
+#endif // ENABLE(CUSTOM_SCROLLBARS)
Modified: trunk/Source/WebCore/rendering/RenderScrollbarPart.h (260051 => 260052)
--- trunk/Source/WebCore/rendering/RenderScrollbarPart.h 2020-04-14 00:32:26 UTC (rev 260051)
+++ trunk/Source/WebCore/rendering/RenderScrollbarPart.h 2020-04-14 00:47:00 UTC (rev 260052)
@@ -28,6 +28,8 @@
#include "RenderBlock.h"
#include "ScrollTypes.h"
+#if ENABLE(CUSTOM_SCROLLBARS)
+
namespace WebCore {
class RenderScrollbar;
@@ -76,3 +78,5 @@
} // namespace WebCore
SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderScrollbarPart, isRenderScrollbarPart())
+
+#endif // ENABLE(CUSTOM_SCROLLBARS)
Modified: trunk/Source/WebCore/rendering/RenderScrollbarTheme.cpp (260051 => 260052)
--- trunk/Source/WebCore/rendering/RenderScrollbarTheme.cpp 2020-04-14 00:32:26 UTC (rev 260051)
+++ trunk/Source/WebCore/rendering/RenderScrollbarTheme.cpp 2020-04-14 00:47:00 UTC (rev 260052)
@@ -25,6 +25,9 @@
#include "config.h"
#include "RenderScrollbarTheme.h"
+
+#if ENABLE(CUSTOM_SCROLLBARS)
+
#include "RenderScrollbar.h"
#include <wtf/NeverDestroyed.h>
#include <wtf/StdLibExtras.h>
@@ -162,3 +165,5 @@
}
}
+
+#endif // ENABLE(CUSTOM_SCROLLBARS)
Modified: trunk/Source/WebCore/rendering/RenderScrollbarTheme.h (260051 => 260052)
--- trunk/Source/WebCore/rendering/RenderScrollbarTheme.h 2020-04-14 00:32:26 UTC (rev 260051)
+++ trunk/Source/WebCore/rendering/RenderScrollbarTheme.h 2020-04-14 00:47:00 UTC (rev 260052)
@@ -27,6 +27,8 @@
#include "ScrollbarThemeComposite.h"
+#if ENABLE(CUSTOM_SCROLLBARS)
+
namespace WebCore {
class PlatformMouseEvent;
@@ -81,3 +83,5 @@
};
} // namespace WebCore
+
+#endif // ENABLE(CUSTOM_SCROLLBARS)
Modified: trunk/Source/WebCore/rendering/RenderSearchField.cpp (260051 => 260052)
--- trunk/Source/WebCore/rendering/RenderSearchField.cpp 2020-04-14 00:32:26 UTC (rev 260051)
+++ trunk/Source/WebCore/rendering/RenderSearchField.cpp 2020-04-14 00:47:00 UTC (rev 260052)
@@ -359,9 +359,11 @@
Ref<Scrollbar> RenderSearchField::createScrollbar(ScrollableArea& scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize controlSize)
{
+#if ENABLE(CUSTOM_SCROLLBARS)
bool hasCustomScrollbarStyle = style().hasPseudoStyle(PseudoId::Scrollbar);
if (hasCustomScrollbarStyle)
return RenderScrollbar::createCustomScrollbar(scrollableArea, orientation, &inputElement());
+#endif
return Scrollbar::createNativeScrollbar(scrollableArea, orientation, controlSize);
}
Modified: trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp (260051 => 260052)
--- trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp 2020-04-14 00:32:26 UTC (rev 260051)
+++ trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp 2020-04-14 00:47:00 UTC (rev 260052)
@@ -34,7 +34,6 @@
#include "HitTestResult.h"
#include "LocalizedStrings.h"
#include "RenderLayer.h"
-#include "RenderScrollbar.h"
#include "RenderTheme.h"
#include "RenderView.h"
#include "StyleResolver.h"
Modified: trunk/Source/WebCore/style/StyleResolver.cpp (260051 => 260052)
--- trunk/Source/WebCore/style/StyleResolver.cpp 2020-04-14 00:32:26 UTC (rev 260051)
+++ trunk/Source/WebCore/style/StyleResolver.cpp 2020-04-14 00:47:00 UTC (rev 260052)
@@ -52,7 +52,6 @@
#include "NodeRenderStyle.h"
#include "PageRuleCollector.h"
#include "Pair.h"
-#include "RenderScrollbar.h"
#include "RenderStyleConstants.h"
#include "RenderView.h"
#include "RuleSet.h"