Modified: trunk/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp (279461 => 279462)
--- trunk/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp 2021-07-01 10:37:39 UTC (rev 279461)
+++ trunk/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp 2021-07-01 11:20:43 UTC (rev 279462)
@@ -37,6 +37,10 @@
#include <type_traits>
#include <wtf/text/TextStream.h>
+#if PLATFORM(WPE) || PLATFORM(GTK)
+#include "ThemeAdwaita.h"
+#endif
+
namespace Nicosia {
using namespace WebCore;
@@ -381,6 +385,9 @@
}
};
+ if (path.isEmpty())
+ return;
+
auto& state = this->state();
append(createCommand<FillPath>(path, Cairo::FillSource(state), Cairo::ShadowState(state)));
}
@@ -443,6 +450,9 @@
}
};
+ if (path.isEmpty())
+ return;
+
auto& state = this->state();
append(createCommand<StrokePath>(path, Cairo::StrokeSource(state), Cairo::ShadowState(state)));
}
@@ -608,6 +618,9 @@
}
};
+ if (strokeStyle() == NoStroke)
+ return;
+
auto& state = this->state();
append(createCommand<DrawLine>(point1, point2, state.strokeStyle, state.strokeColor, state.strokeThickness, state.shouldAntialias));
}
@@ -628,6 +641,9 @@
}
};
+ if (widths.isEmpty())
+ return;
+
auto& state = this->state();
append(createCommand<DrawLinesForText>(point, thickness, widths, printing, doubleUnderlines, state.strokeColor));
}
@@ -673,6 +689,10 @@
void CairoOperationRecorder::drawFocusRing(const Path& path, float width, float offset, const Color& color)
{
+#if PLATFORM(WPE) || PLATFORM(GTK)
+ ThemeAdwaita::paintFocus(*this, path, color);
+ UNUSED_PARAM(width);
+#else
struct DrawFocusRing final : PaintingOperation, OperationData<Path, float, Color> {
virtual ~DrawFocusRing() = default;
@@ -687,12 +707,17 @@
}
};
+ append(createCommand<DrawFocusRing>(path, width, color));
+#endif
UNUSED_PARAM(offset);
- append(createCommand<DrawFocusRing>(path, width, color));
}
void CairoOperationRecorder::drawFocusRing(const Vector<FloatRect>& rects, float width, float offset, const Color& color)
{
+#if PLATFORM(WPE) || PLATFORM(GTK)
+ ThemeAdwaita::paintFocus(*this, rects, color);
+ UNUSED_PARAM(width);
+#else
struct DrawFocusRing final : PaintingOperation, OperationData<Vector<FloatRect>, float, Color> {
virtual ~DrawFocusRing() = default;
@@ -707,8 +732,9 @@
}
};
+ append(createCommand<DrawFocusRing>(rects, width, color));
+#endif
UNUSED_PARAM(offset);
- append(createCommand<DrawFocusRing>(rects, width, color));
}
void CairoOperationRecorder::save()
@@ -727,6 +753,8 @@
}
};
+ GraphicsContext::save();
+
append(createCommand<Save>());
m_stateStack.append(m_stateStack.last());
@@ -734,9 +762,6 @@
void CairoOperationRecorder::restore()
{
- if (m_stateStack.isEmpty())
- return;
-
struct Restore final : PaintingOperation, OperationData<> {
virtual ~Restore() = default;
@@ -751,6 +776,14 @@
}
};
+ if (!stackSize())
+ return;
+
+ GraphicsContext::restore();
+
+ if (m_stateStack.isEmpty())
+ return;
+
append(createCommand<Restore>());
m_stateStack.removeLast();
@@ -917,6 +950,8 @@
}
};
+ GraphicsContext::beginTransparencyLayer(opacity);
+
append(createCommand<BeginTransparencyLayer>(opacity));
}
@@ -936,6 +971,8 @@
}
};
+ GraphicsContext::endTransparencyLayer();
+
append(createCommand<EndTransparencyLayer>());
}