From fd977228c791d5cf767a1e5b4ed3596add8ed6d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=BDan=20Dober=C5=A1ek?= Date: Thu, 30 Mar 2023 10:36:24 -0700 Subject: [PATCH] Build fix around std::variant in SourceBrush for Clang/libstdc++ https://bugs.webkit.org/show_bug.cgi?id=254742 Unreviewed, build fix for the SourceBrush::Brush std::variant construction when using Clang with libstdc++. Things get mixed up when using Ref for constructing the variant, with the compiler using it as initialization for the LogicalGradient type, the other possible type in the variant, which ends up in a compile-time error. This can be avoided by using the in-place tag when constructing the variant in the SourceBrush::setPattern() method, specifying which variant-alternative type should be used. Similar fix for the same reasons is also needed in the decoding part of the ArgumentCoder> specialization, this being problematic due to the SourceBrush::Brush decoding produced for the generated serializers purpose. There the variant is constructed with the in-place tag that's based on the index value of the alternative. * Source/WebCore/platform/graphics/SourceBrush.cpp: (WebCore::SourceBrush::setPattern): * Source/WebCore/platform/graphics/SourceBrush.h: * Source/WebKit/Platform/IPC/ArgumentCoders.h: Canonical link: https://commits.webkit.org/262339@main --- Source/WebCore/platform/graphics/SourceBrush.cpp | 2 +- Source/WebCore/platform/graphics/SourceBrush.h | 3 ++- Source/WebKit/Platform/IPC/ArgumentCoders.h | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/WebCore/platform/graphics/SourceBrush.cpp b/Source/WebCore/platform/graphics/SourceBrush.cpp index f42e0d42f534..44135b7706ad 100644 --- a/Source/WebCore/platform/graphics/SourceBrush.cpp +++ b/Source/WebCore/platform/graphics/SourceBrush.cpp @@ -91,7 +91,7 @@ void SourceBrush::setGradient(Ref&& gradient, const AffineTransform& s void SourceBrush::setPattern(Ref&& pattern) { - m_brush = { WTFMove(pattern) }; + m_brush = { Brush::Variant { std::in_place_type>, WTFMove(pattern) } }; } WTF::TextStream& operator<<(TextStream& ts, const SourceBrush& brush) diff --git a/Source/WebCore/platform/graphics/SourceBrush.h b/Source/WebCore/platform/graphics/SourceBrush.h index 176b9fc85c18..cd97b82c7444 100644 --- a/Source/WebCore/platform/graphics/SourceBrush.h +++ b/Source/WebCore/platform/graphics/SourceBrush.h @@ -42,7 +42,8 @@ class SourceBrush { template static std::optional decode(Decoder&); }; - std::variant> brush; + using Variant = std::variant>; + Variant brush; }; SourceBrush() = default; diff --git a/Source/WebKit/Platform/IPC/ArgumentCoders.h b/Source/WebKit/Platform/IPC/ArgumentCoders.h index ae37b2145fc2..2d93984e3f36 100644 --- a/Source/WebKit/Platform/IPC/ArgumentCoders.h +++ b/Source/WebKit/Platform/IPC/ArgumentCoders.h @@ -743,7 +743,7 @@ template struct ArgumentCoder> { auto optional = decoder.template decode>>(); if (!optional) return std::nullopt; - return std::make_optional>(WTFMove(*optional)); + return std::make_optional>(std::in_place_index, WTFMove(*optional)); } return decode(decoder, std::make_index_sequence { }, i); } else From 93920b55f52ff8b883296f4845269e2ed746acb3 Mon Sep 17 00:00:00 2001 From: Michael Catanzaro Date: Fri, 31 Mar 2023 12:24:09 -0700 Subject: [PATCH] Fix build of SourceBrush.cpp https://bugs.webkit.org/show_bug.cgi?id=254821 Unreviewed build fix. * Source/WebCore/platform/graphics/SourceBrush.cpp: (WebCore::SourceBrush::setGradient): (WebCore::SourceBrush::setPattern): Canonical link: https://commits.webkit.org/262434@main --- Source/WebCore/platform/graphics/SourceBrush.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/WebCore/platform/graphics/SourceBrush.cpp b/Source/WebCore/platform/graphics/SourceBrush.cpp index 44135b7706ad..5377831d7902 100644 --- a/Source/WebCore/platform/graphics/SourceBrush.cpp +++ b/Source/WebCore/platform/graphics/SourceBrush.cpp @@ -86,12 +86,12 @@ Pattern* SourceBrush::pattern() const void SourceBrush::setGradient(Ref&& gradient, const AffineTransform& spaceTransform) { - m_brush = { Brush::LogicalGradient { { WTFMove(gradient) }, spaceTransform } }; + m_brush = Brush { Brush::LogicalGradient { { WTFMove(gradient) }, spaceTransform } }; } void SourceBrush::setPattern(Ref&& pattern) { - m_brush = { Brush::Variant { std::in_place_type>, WTFMove(pattern) } }; + m_brush = Brush { Brush::Variant { std::in_place_type>, WTFMove(pattern) } }; } WTF::TextStream& operator<<(TextStream& ts, const SourceBrush& brush) From 2fd83187cbe7cf7f57f4d6834f6060b00703683b Mon Sep 17 00:00:00 2001 From: Michael Catanzaro Date: Fri, 31 Mar 2023 13:23:45 -0500 Subject: [PATCH] [GTK] AcceleratedSurfaceDMABuf.cpp does not build on i368 https://bugs.webkit.org/show_bug.cgi?id=254828 Reviewed by NOBODY (OOPS!). * Source/WebKit/WebProcess/WebPage/gtk/AcceleratedSurfaceDMABuf.cpp: (WebKit::AcceleratedSurfaceDMABuf::clientResize): --- .../WebPage/gtk/AcceleratedSurfaceDMABuf.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/WebKit/WebProcess/WebPage/gtk/AcceleratedSurfaceDMABuf.cpp b/Source/WebKit/WebProcess/WebPage/gtk/AcceleratedSurfaceDMABuf.cpp index 2aa33586b317..34cca9f11d62 100644 --- a/Source/WebKit/WebProcess/WebPage/gtk/AcceleratedSurfaceDMABuf.cpp +++ b/Source/WebKit/WebProcess/WebPage/gtk/AcceleratedSurfaceDMABuf.cpp @@ -130,12 +130,12 @@ void AcceleratedSurfaceDMABuf::clientResize(const WebCore::IntSize& size) } UnixFileDescriptor backFD(gbm_bo_get_fd(backObject), UnixFileDescriptor::Adopt); Vector attributes = { - EGL_WIDTH, gbm_bo_get_width(backObject), - EGL_HEIGHT, gbm_bo_get_height(backObject), - EGL_LINUX_DRM_FOURCC_EXT, gbm_bo_get_format(backObject), + EGL_WIDTH, static_cast(gbm_bo_get_width(backObject)), + EGL_HEIGHT, static_cast(gbm_bo_get_height(backObject)), + EGL_LINUX_DRM_FOURCC_EXT, static_cast(gbm_bo_get_format(backObject)), EGL_DMA_BUF_PLANE0_FD_EXT, backFD.value(), - EGL_DMA_BUF_PLANE0_OFFSET_EXT, gbm_bo_get_offset(backObject, 0), - EGL_DMA_BUF_PLANE0_PITCH_EXT, gbm_bo_get_stride(backObject), + EGL_DMA_BUF_PLANE0_OFFSET_EXT, static_cast(gbm_bo_get_offset(backObject, 0)), + EGL_DMA_BUF_PLANE0_PITCH_EXT, static_cast(gbm_bo_get_stride(backObject)), EGL_NONE }; m_backImage = display.createEGLImage(EGL_NO_CONTEXT, EGL_LINUX_DMA_BUF_EXT, nullptr, attributes);