Diff
Modified: trunk/Source/WebCore/ChangeLog (279825 => 279826)
--- trunk/Source/WebCore/ChangeLog 2021-07-12 13:05:40 UTC (rev 279825)
+++ trunk/Source/WebCore/ChangeLog 2021-07-12 14:26:45 UTC (rev 279826)
@@ -1,3 +1,37 @@
+2021-07-12 Alexander Mikhaylenko <[email protected]>
+
+ [GTK][WPE] Support drawing scrollbar corner
+ https://bugs.webkit.org/show_bug.cgi?id=227868
+
+ Reviewed by Michael Catanzaro.
+
+ With dark scrollbars supported, the lack of scroll corner for non-overlay
+ scrollbars becomes very noticeable. Implement it.
+
+ To properly draw them, we need to know whether scrollbars are dark, and whether
+ the vertical scrollbar is on the left. Hence, pass ScrollableArea to
+ paintScrollCorner() so we can query it.
+
+ Only cover non-system scrollbars, it would take considerable amount of work to
+ make it work for system as well.
+
+ * platform/ScrollView.cpp:
+ (WebCore::ScrollView::paintScrollCorner):
+ * platform/ScrollbarTheme.h:
+ (WebCore::ScrollbarTheme::paintScrollCorner):
+ (WebCore::ScrollbarTheme::defaultPaintScrollCorner):
+ * platform/adwaita/ScrollbarThemeAdwaita.cpp:
+ (WebCore::ScrollbarThemeAdwaita::paintScrollCorner):
+ * platform/adwaita/ScrollbarThemeAdwaita.h:
+ * platform/mac/ScrollbarThemeMac.h:
+ * platform/mac/ScrollbarThemeMac.mm:
+ (WebCore::ScrollbarThemeMac::paintScrollCorner):
+ * rendering/RenderLayerScrollableArea.cpp:
+ (WebCore::RenderLayerScrollableArea::paintScrollCorner):
+ * rendering/RenderScrollbarTheme.cpp:
+ (WebCore::RenderScrollbarTheme::paintScrollCorner):
+ * rendering/RenderScrollbarTheme.h:
+
2021-07-12 Carlos Alberto Lopez Perez <[email protected]>
Unreviewed, reverting r279778.
Modified: trunk/Source/WebCore/platform/ScrollView.cpp (279825 => 279826)
--- trunk/Source/WebCore/platform/ScrollView.cpp 2021-07-12 13:05:40 UTC (rev 279825)
+++ trunk/Source/WebCore/platform/ScrollView.cpp 2021-07-12 14:26:45 UTC (rev 279826)
@@ -1237,7 +1237,7 @@
void ScrollView::paintScrollCorner(GraphicsContext& context, const IntRect& cornerRect)
{
- ScrollbarTheme::theme().paintScrollCorner(context, cornerRect);
+ ScrollbarTheme::theme().paintScrollCorner(*this, context, cornerRect);
}
void ScrollView::paintScrollbar(GraphicsContext& context, Scrollbar& bar, const IntRect& rect)
Modified: trunk/Source/WebCore/platform/ScrollbarTheme.h (279825 => 279826)
--- trunk/Source/WebCore/platform/ScrollbarTheme.h 2021-07-12 13:05:40 UTC (rev 279825)
+++ trunk/Source/WebCore/platform/ScrollbarTheme.h 2021-07-12 14:26:45 UTC (rev 279826)
@@ -33,6 +33,7 @@
namespace WebCore {
class PlatformMouseEvent;
+class ScrollableArea;
class Scrollbar;
class ScrollView;
@@ -84,8 +85,8 @@
virtual void invalidatePart(Scrollbar&, ScrollbarPart) { }
- virtual void paintScrollCorner(GraphicsContext& context, const IntRect& cornerRect) { defaultPaintScrollCorner(context, cornerRect); }
- static void defaultPaintScrollCorner(GraphicsContext& context, const IntRect& cornerRect) { context.fillRect(cornerRect, Color::white); }
+ virtual void paintScrollCorner(ScrollableArea& area, GraphicsContext& context, const IntRect& cornerRect) { defaultPaintScrollCorner(area, context, cornerRect); }
+ static void defaultPaintScrollCorner(ScrollableArea&, GraphicsContext& context, const IntRect& cornerRect) { context.fillRect(cornerRect, Color::white); }
virtual void paintTickmarks(GraphicsContext&, Scrollbar&, const IntRect&) { }
virtual void paintOverhangAreas(ScrollView&, GraphicsContext&, const IntRect&, const IntRect&, const IntRect&) { }
Modified: trunk/Source/WebCore/platform/adwaita/ScrollbarThemeAdwaita.cpp (279825 => 279826)
--- trunk/Source/WebCore/platform/adwaita/ScrollbarThemeAdwaita.cpp 2021-07-12 13:05:40 UTC (rev 279825)
+++ trunk/Source/WebCore/platform/adwaita/ScrollbarThemeAdwaita.cpp 2021-07-12 14:26:45 UTC (rev 279826)
@@ -242,6 +242,31 @@
return true;
}
+void ScrollbarThemeAdwaita::paintScrollCorner(ScrollableArea& scrollableArea, GraphicsContext& graphicsContext, const IntRect& cornerRect)
+{
+ if (graphicsContext.paintingDisabled())
+ return;
+
+ SRGBA<uint8_t> scrollbarBackgroundColor;
+ SRGBA<uint8_t> scrollbarBorderColor;
+
+ if (scrollableArea.useDarkAppearanceForScrollbars()) {
+ scrollbarBackgroundColor = scrollbarBackgroundColorDark;
+ scrollbarBorderColor = scrollbarBorderColorDark;
+ } else {
+ scrollbarBackgroundColor = scrollbarBackgroundColorLight;
+ scrollbarBorderColor = scrollbarBorderColorLight;
+ }
+
+ IntRect borderRect = IntRect(cornerRect.location(), IntSize(hoveredScrollbarBorderSize, hoveredScrollbarBorderSize));
+
+ if (scrollableArea.shouldPlaceVerticalScrollbarOnLeft())
+ borderRect.move(cornerRect.width() - hoveredScrollbarBorderSize, 0);
+
+ graphicsContext.fillRect(cornerRect, scrollbarBackgroundColor);
+ graphicsContext.fillRect(borderRect, scrollbarBorderColor);
+}
+
ScrollbarButtonPressAction ScrollbarThemeAdwaita::handleMousePressEvent(Scrollbar&, const PlatformMouseEvent& event, ScrollbarPart pressedPart)
{
gboolean warpSlider = FALSE;
Modified: trunk/Source/WebCore/platform/adwaita/ScrollbarThemeAdwaita.h (279825 => 279826)
--- trunk/Source/WebCore/platform/adwaita/ScrollbarThemeAdwaita.h 2021-07-12 13:05:40 UTC (rev 279825)
+++ trunk/Source/WebCore/platform/adwaita/ScrollbarThemeAdwaita.h 2021-07-12 14:26:45 UTC (rev 279826)
@@ -41,6 +41,7 @@
void updateScrollbarOverlayStyle(Scrollbar&) override;
bool paint(Scrollbar&, GraphicsContext&, const IntRect&) override;
+ void paintScrollCorner(ScrollableArea&, GraphicsContext&, const IntRect&) override;
ScrollbarButtonPressAction handleMousePressEvent(Scrollbar&, const PlatformMouseEvent&, ScrollbarPart) override;
int scrollbarThickness(ScrollbarControlSize, ScrollbarExpansionState) override;
Modified: trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.h (279825 => 279826)
--- trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.h 2021-07-12 13:05:40 UTC (rev 279825)
+++ trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.h 2021-07-12 14:26:45 UTC (rev 279826)
@@ -43,7 +43,7 @@
void updateEnabledState(Scrollbar&) override;
bool paint(Scrollbar&, GraphicsContext&, const IntRect& damageRect) override;
- void paintScrollCorner(GraphicsContext&, const IntRect& cornerRect) override;
+ void paintScrollCorner(ScrollableArea&, GraphicsContext&, const IntRect& cornerRect) override;
int scrollbarThickness(ScrollbarControlSize = ScrollbarControlSize::Regular, ScrollbarExpansionState = ScrollbarExpansionState::Expanded) override;
Modified: trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.mm (279825 => 279826)
--- trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.mm 2021-07-12 13:05:40 UTC (rev 279825)
+++ trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.mm 2021-07-12 14:26:45 UTC (rev 279826)
@@ -564,7 +564,7 @@
return true;
}
-void ScrollbarThemeMac::paintScrollCorner(GraphicsContext& context, const IntRect& cornerRect)
+void ScrollbarThemeMac::paintScrollCorner(ScrollableArea&, GraphicsContext& context, const IntRect& cornerRect)
{
if (context.paintingDisabled())
return;
Modified: trunk/Source/WebCore/rendering/RenderLayerScrollableArea.cpp (279825 => 279826)
--- trunk/Source/WebCore/rendering/RenderLayerScrollableArea.cpp 2021-07-12 13:05:40 UTC (rev 279825)
+++ trunk/Source/WebCore/rendering/RenderLayerScrollableArea.cpp 2021-07-12 14:26:45 UTC (rev 279826)
@@ -1374,7 +1374,7 @@
// We don't want to paint a corner if we have overlay scrollbars, since we need
// to see what is behind it.
if (!hasOverlayScrollbars())
- ScrollbarTheme::theme().paintScrollCorner(context, absRect);
+ ScrollbarTheme::theme().paintScrollCorner(*this, context, absRect);
}
void RenderLayerScrollableArea::drawPlatformResizerImage(GraphicsContext& context, const LayoutRect& resizerCornerRect)
Modified: trunk/Source/WebCore/rendering/RenderScrollbarTheme.cpp (279825 => 279826)
--- trunk/Source/WebCore/rendering/RenderScrollbarTheme.cpp 2021-07-12 13:05:40 UTC (rev 279825)
+++ trunk/Source/WebCore/rendering/RenderScrollbarTheme.cpp 2021-07-12 14:26:45 UTC (rev 279826)
@@ -126,9 +126,9 @@
}
}
-void RenderScrollbarTheme::paintScrollCorner(GraphicsContext& context, const IntRect& cornerRect)
+void RenderScrollbarTheme::paintScrollCorner(ScrollableArea& area, GraphicsContext& context, const IntRect& cornerRect)
{
- ScrollbarTheme::theme().paintScrollCorner(context, cornerRect);
+ ScrollbarTheme::theme().paintScrollCorner(area, context, cornerRect);
}
void RenderScrollbarTheme::paintScrollbarBackground(GraphicsContext& context, Scrollbar& scrollbar)
Modified: trunk/Source/WebCore/rendering/RenderScrollbarTheme.h (279825 => 279826)
--- trunk/Source/WebCore/rendering/RenderScrollbarTheme.h 2021-07-12 13:05:40 UTC (rev 279825)
+++ trunk/Source/WebCore/rendering/RenderScrollbarTheme.h 2021-07-12 14:26:45 UTC (rev 279826)
@@ -43,7 +43,7 @@
bool supportsControlTints() const override { return true; }
- void paintScrollCorner(GraphicsContext&, const IntRect& cornerRect) override;
+ void paintScrollCorner(ScrollableArea&, GraphicsContext&, const IntRect& cornerRect) override;
ScrollbarButtonPressAction handleMousePressEvent(Scrollbar& scrollbar, const PlatformMouseEvent& event, ScrollbarPart pressedPart) override { return ScrollbarTheme::theme().handleMousePressEvent(scrollbar, event, pressedPart); }
Modified: trunk/Source/WebKit/ChangeLog (279825 => 279826)
--- trunk/Source/WebKit/ChangeLog 2021-07-12 13:05:40 UTC (rev 279825)
+++ trunk/Source/WebKit/ChangeLog 2021-07-12 14:26:45 UTC (rev 279826)
@@ -1,3 +1,14 @@
+2021-07-12 Alexander Mikhaylenko <[email protected]>
+
+ [GTK][WPE] Support drawing scrollbar corner
+ https://bugs.webkit.org/show_bug.cgi?id=227868
+
+ Reviewed by Michael Catanzaro.
+
+ * WebProcess/Plugins/PDF/PDFPlugin.mm:
+ (WebKit::PDFPlugin::paintControlForLayerInContext):
+ Update the paintScrollCorner() call.
+
2021-07-12 Imanol Fernandez <[email protected]>
Cross platform compilation of PlatformXRSystem and PlatformXRSystemProxy
Modified: trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm (279825 => 279826)
--- trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm 2021-07-12 13:05:40 UTC (rev 279825)
+++ trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm 2021-07-12 14:26:45 UTC (rev 279826)
@@ -1953,7 +1953,7 @@
if (layer == m_scrollCornerLayer) {
IntRect scrollCornerRect = this->scrollCornerRect();
graphicsContext.translate(-scrollCornerRect.x(), -scrollCornerRect.y());
- ScrollbarTheme::theme().paintScrollCorner(graphicsContext, scrollCornerRect);
+ ScrollbarTheme::theme().paintScrollCorner(*this, graphicsContext, scrollCornerRect);
return;
}