https://bugs.webkit.org/show_bug.cgi?id=137175
Reviewed by Martin Robinson.
Remove the unused methods depending on GDK and simplify
GraphicsContext::drawFocusRing() using only cairo API.
* PlatformGTK.cmake: Move GraphicsContextCairo.cpp to the webcore sources.
* platform/graphics/GraphicsContext.h:
* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContext::drawFocusRing): Iterate the rectangles
instead of creating a region for the rectangles and call gdk_cairo_region().
(WebCore::GraphicsContext::setGdkExposeEvent): Deleted.
(WebCore::GraphicsContext::gdkExposeEvent): Deleted.
(WebCore::GraphicsContext::gdkWindow): Deleted.
* platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h:
(WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@174041
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2014-09-28 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ [cairo] GraphicsContext should not depend on GTK+
+ https://bugs.webkit.org/show_bug.cgi?id=137175
+
+ Reviewed by Martin Robinson.
+
+ Remove the unused methods depending on GDK and simplify
+ GraphicsContext::drawFocusRing() using only cairo API.
+
+ * PlatformGTK.cmake: Move GraphicsContextCairo.cpp to the webcore sources.
+ * platform/graphics/GraphicsContext.h:
+ * platform/graphics/cairo/GraphicsContextCairo.cpp:
+ (WebCore::GraphicsContext::drawFocusRing): Iterate the rectangles
+ instead of creating a region for the rectangles and call gdk_cairo_region().
+ (WebCore::GraphicsContext::setGdkExposeEvent): Deleted.
+ (WebCore::GraphicsContext::gdkExposeEvent): Deleted.
+ (WebCore::GraphicsContext::gdkWindow): Deleted.
+ * platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h:
+ (WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate):
+
2014-09-27 Chris Dumez <cdumez@apple.com>
HTMLPlugInElement::isUserObservable() is causing layout
platform/graphics/cairo/FontCairoHarfbuzzNG.cpp
platform/graphics/cairo/GradientCairo.cpp
platform/graphics/cairo/GraphicsContext3DCairo.cpp
+ platform/graphics/cairo/GraphicsContextCairo.cpp
platform/graphics/cairo/ImageBufferCairo.cpp
platform/graphics/cairo/ImageCairo.cpp
platform/graphics/cairo/IntRectCairo.cpp
platform/graphics/GLContext.cpp
- platform/graphics/cairo/GraphicsContextCairo.cpp
-
platform/graphics/egl/GLContextEGL.cpp
platform/graphics/freetype/FontPlatformDataFreeType.cpp
GraphicsContext(cairo_t*);
#endif
-#if PLATFORM(GTK)
- void setGdkExposeEvent(GdkEventExpose*);
- GdkWindow* gdkWindow() const;
- GdkEventExpose* gdkExposeEvent() const;
-#endif
-
static void adjustLineToPixelBoundaries(FloatPoint& p1, FloatPoint& p2, float strokeWidth, StrokeStyle);
private:
#include <stdio.h>
#include <wtf/MathExtras.h>
-#if PLATFORM(GTK)
-#include <gdk/gdk.h>
-#elif PLATFORM(WIN)
+#if PLATFORM(WIN)
#include <cairo-win32.h>
#endif
if (paintingDisabled())
return;
- unsigned rectCount = rects.size();
-
cairo_t* cr = platformContext()->cr();
cairo_save(cr);
cairo_push_group(cr);
cairo_new_path(cr);
#if PLATFORM(GTK)
-#ifdef GTK_API_VERSION_2
- GdkRegion* reg = gdk_region_new();
-#else
- cairo_region_t* reg = cairo_region_create();
-#endif
-
- for (unsigned i = 0; i < rectCount; i++) {
-#ifdef GTK_API_VERSION_2
- GdkRectangle rect = rects[i];
- gdk_region_union_with_rect(reg, &rect);
-#else
- cairo_rectangle_int_t rect = rects[i];
- cairo_region_union_rectangle(reg, &rect);
-#endif
- }
- gdk_cairo_region(cr, reg);
-#ifdef GTK_API_VERSION_2
- gdk_region_destroy(reg);
-#else
- cairo_region_destroy(reg);
-#endif
+ for (const auto& rect : rects)
+ cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height());
#else
+ unsigned rectCount = rects.size();
int radius = (width - 1) / 2;
Path path;
for (unsigned i = 0; i < rectCount; ++i) {
cairo_restore(cr);
}
-#if PLATFORM(GTK)
-void GraphicsContext::setGdkExposeEvent(GdkEventExpose* expose)
-{
- m_data->expose = expose;
-}
-
-GdkEventExpose* GraphicsContext::gdkExposeEvent() const
-{
- return m_data->expose;
-}
-
-GdkWindow* GraphicsContext::gdkWindow() const
-{
- if (!m_data->expose)
- return 0;
-
- return m_data->expose->window;
-}
-#endif
-
void GraphicsContext::setPlatformShouldAntialias(bool enable)
{
if (paintingDisabled())
#include <math.h>
#include <stdio.h>
-#if PLATFORM(GTK)
-#include <pango/pango.h>
-typedef struct _GdkExposeEvent GdkExposeEvent;
-#elif PLATFORM(WIN)
+#if PLATFORM(WIN)
#include <cairo-win32.h>
#endif
public:
GraphicsContextPlatformPrivate(PlatformContextCairo* newPlatformContext)
: platformContext(newPlatformContext)
-#if PLATFORM(GTK)
- , expose(0)
-#endif
#if PLATFORM(WIN) || (PLATFORM(GTK) && OS(WINDOWS))
// NOTE: These may note be needed: review and remove once Cairo implementation is complete
, m_hdc(0)
PlatformContextCairo* platformContext;
Vector<float> layers;
-#if PLATFORM(GTK)
- GdkEventExpose* expose;
-#endif
#if PLATFORM(WIN) || (PLATFORM(GTK) && OS(WINDOWS))
HDC m_hdc;
bool m_shouldIncludeChildWindows;