Diff
Modified: trunk/ChangeLog (94875 => 94876)
--- trunk/ChangeLog 2011-09-09 21:43:14 UTC (rev 94875)
+++ trunk/ChangeLog 2011-09-09 22:06:03 UTC (rev 94876)
@@ -1,3 +1,12 @@
+2011-09-09 Rafael Antognolli <antogno...@profusion.mobi>
+
+ Add replacement functions for gdk ones.
+ https://bugs.webkit.org/show_bug.cgi?id=66323
+
+ Reviewed by Martin Robinson.
+
+ * Source/cmake/FindPango.cmake:
+
2011-09-09 Laszlo Gombos <laszlo.1.gom...@nokia.com>
[Qt] Remove common.pri
Modified: trunk/Source/WebCore/CMakeListsEfl.txt (94875 => 94876)
--- trunk/Source/WebCore/CMakeListsEfl.txt 2011-09-09 21:43:14 UTC (rev 94875)
+++ trunk/Source/WebCore/CMakeListsEfl.txt 2011-09-09 22:06:03 UTC (rev 94876)
@@ -128,9 +128,11 @@
platform/graphics/pango/FontPlatformDataPango.cpp
platform/graphics/pango/GlyphPageTreeNodePango.cpp
platform/graphics/pango/SimpleFontDataPango.cpp
+ platform/graphics/pango/PangoUtilities.cpp
)
LIST(APPEND WebCore_LIBRARIES
- ${Pango_LIBRARIES}
+ ${Pango_LIBRARY}
+ ${Pango_Cairo_LIBRARY}
)
ENDIF ()
ENDIF ()
Modified: trunk/Source/WebCore/ChangeLog (94875 => 94876)
--- trunk/Source/WebCore/ChangeLog 2011-09-09 21:43:14 UTC (rev 94875)
+++ trunk/Source/WebCore/ChangeLog 2011-09-09 22:06:03 UTC (rev 94876)
@@ -1,3 +1,26 @@
+2011-09-09 Rafael Antognolli <antogno...@profusion.mobi>
+
+ Add replacement functions for gdk ones.
+ https://bugs.webkit.org/show_bug.cgi?id=66323
+
+ Reviewed by Martin Robinson.
+
+ This will allow the EFL port to don't depend on gdk anymore.
+
+ No new functionality so no new tests.
+
+ * CMakeListsEfl.txt:
+ * platform/graphics/cairo/CairoUtilities.cpp:
+ (WebCore::appendRegionToCairoContext):
+ * platform/graphics/cairo/CairoUtilities.h:
+ * platform/graphics/pango/FontPango.cpp:
+ (WebCore::drawGlyphsShadow):
+ (WebCore::Font::drawComplexText):
+ * platform/graphics/pango/PangoUtilities.cpp: Added.
+ (WebCore::getLineClipRegionFromLayoutIter):
+ (WebCore::getClipRegionFromPangoLayoutLine):
+ * platform/graphics/pango/PangoUtilities.h: Added.
+
2011-09-09 Mark Hahnenberg <mhahnenb...@apple.com>
Unzip initialization lists and constructors in JSCell hierarchy (5/7)
Modified: trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp (94875 => 94876)
--- trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp 2011-09-09 21:43:14 UTC (rev 94875)
+++ trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp 2011-09-09 22:06:03 UTC (rev 94876)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2010 Igalia S.L.
+ * Copyright (C) 2011 ProFUSION embedded systems
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -80,6 +81,19 @@
appendPathToCairoContext(context, path.platformPath()->context());
}
+void appendRegionToCairoContext(cairo_t* to, const cairo_region_t* region)
+{
+ if (!region)
+ return;
+
+ const int rectCount = cairo_region_num_rectangles(region);
+ for (int i = 0; i < rectCount; ++i) {
+ cairo_rectangle_int_t rect;
+ cairo_region_get_rectangle(region, i, &rect);
+ cairo_rectangle(to, rect.x, rect.y, rect.width, rect.height);
+ }
+}
+
cairo_operator_t toCairoOperator(CompositeOperator op)
{
switch (op) {
Modified: trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.h (94875 => 94876)
--- trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.h 2011-09-09 21:43:14 UTC (rev 94875)
+++ trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.h 2011-09-09 22:06:03 UTC (rev 94876)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2010 Igalia S.L.
+ * Copyright (C) 2011 ProFUSION embedded systems
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -43,6 +44,7 @@
void appendPathToCairoContext(cairo_t* to, cairo_t* from);
void setPathOnCairoContext(cairo_t* to, cairo_t* from);
void appendWebCorePathToCairoContext(cairo_t* context, const Path& path);
+void appendRegionToCairoContext(cairo_t*, const cairo_region_t*);
cairo_operator_t toCairoOperator(CompositeOperator op);
void drawPatternToCairoContext(cairo_t* cr, cairo_surface_t* image, const IntSize& imageSize, const FloatRect& tileRect,
const AffineTransform& patternTransform, const FloatPoint& phase, cairo_operator_t op, const FloatRect& destRect);
Modified: trunk/Source/WebCore/platform/graphics/pango/FontPango.cpp (94875 => 94876)
--- trunk/Source/WebCore/platform/graphics/pango/FontPango.cpp 2011-09-09 21:43:14 UTC (rev 94875)
+++ trunk/Source/WebCore/platform/graphics/pango/FontPango.cpp 2011-09-09 22:06:03 UTC (rev 94876)
@@ -6,6 +6,7 @@
* Copyright (C) 2007 Alp Toker <a...@atoker.com>
* Copyright (C) 2008 Xan Lopez <x...@gnome.org>
* Copyright (C) 2008 Nuanti Ltd.
+ * Copyright (C) 2011 ProFUSION embedded systems
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -42,10 +43,15 @@
#include "SimpleFontData.h"
#include "TextRun.h"
#include <cairo.h>
-#include <gdk/gdk.h>
#include <pango/pango.h>
#include <pango/pangocairo.h>
+#if PLATFORM(GTK)
+#include <gdk/gdk.h>
+#else
+#include "PangoUtilities.h"
+#endif
+
#if USE(FREETYPE)
#include <pango/pangofc-fontmap.h>
#endif
@@ -234,7 +240,11 @@
cairo_translate(context, totalOffset.x(), totalOffset.y());
setSourceRGBAFromColor(context, graphicsContext->state().shadowColor);
+#if PLATFORM(GTK)
gdk_cairo_region(context, renderRegion);
+#else
+ appendRegionToCairoContext(context, renderRegion);
+#endif
cairo_clip(context);
pango_cairo_show_layout_line(context, layoutLine);
@@ -256,7 +266,11 @@
cairo_t* context = graphicsContext->platformContext()->cr();
cairo_save(context);
cairo_translate(context, totalOffset.x(), totalOffset.y());
+#if PLATFORM(GTK)
gdk_cairo_region(context, renderRegion);
+#else
+ appendRegionToCairoContext(context, renderRegion);
+#endif
cairo_clip(context);
cairo_translate(context, -totalOffset.x(), -totalOffset.y());
@@ -291,7 +305,11 @@
char* start = g_utf8_offset_to_pointer(utf8, from);
char* end = g_utf8_offset_to_pointer(start, to - from);
int ranges[] = {start - utf8, end - utf8};
+#if PLATFORM(GTK)
partialRegion = gdk_pango_layout_line_get_clip_region(layoutLine, 0, 0, ranges, 1);
+#else
+ partialRegion = getClipRegionFromPangoLayoutLine(layoutLine, ranges);
+#endif
drawGlyphsShadow(context, point, layoutLine, partialRegion);
@@ -301,7 +319,11 @@
float red, green, blue, alpha;
context->fillColor().getRGBA(red, green, blue, alpha);
cairo_set_source_rgba(cr, red, green, blue, alpha);
- gdk_cairo_region(cr, partialRegion);
+#if PLATFORM(GTK)
+ gdk_cairo_region(cr, partialRegion);
+#else
+ appendRegionToCairoContext(cr, partialRegion);
+#endif
cairo_clip(cr);
pango_cairo_show_layout_line(cr, layoutLine);
Added: trunk/Source/WebCore/platform/graphics/pango/PangoUtilities.cpp (0 => 94876)
--- trunk/Source/WebCore/platform/graphics/pango/PangoUtilities.cpp (rev 0)
+++ trunk/Source/WebCore/platform/graphics/pango/PangoUtilities.cpp 2011-09-09 22:06:03 UTC (rev 94876)
@@ -0,0 +1,84 @@
+/*
+ * This code was mostly copied from gdk-pango.
+ * source: http://git.gnome.org/browse/gtk+/tree/gdk/gdkpango.c
+ *
+ * Copyright (C) 2000 Red Hat, Inc.
+ * Copyright (C) 2011 ProFUSION embedded systems
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+#include "PangoUtilities.h"
+
+#include <cairo.h>
+#include <pango/pango.h>
+
+namespace WebCore {
+
+static cairo_region_t* getLineClipRegionFromLayoutIter(PangoLayoutIter* iter, const int* indexRange)
+{
+ PangoRectangle logicalRect;
+ PangoLayoutLine* line = pango_layout_iter_get_line_readonly(iter);
+ cairo_region_t* clipRegion = cairo_region_create();
+ pango_layout_iter_get_line_extents(iter, 0, &logicalRect);
+ int baseline = pango_layout_iter_get_baseline(iter);
+
+ int* pixelRanges = 0;
+ int pixelRangeCount = 0;
+
+ if (indexRange[1] >= line->start_index
+ && indexRange[0] < line->start_index + line->length)
+ pango_layout_line_get_x_ranges(line,
+ indexRange[0],
+ indexRange[1],
+ &pixelRanges, &pixelRangeCount);
+
+ for (int j = 0; j < pixelRangeCount; ++j) {
+ int offsetX = PANGO_PIXELS(pixelRanges[2 * j] - logicalRect.x);
+ int offsetY = PANGO_PIXELS(baseline - logicalRect.y);
+
+ cairo_rectangle_int_t rect;
+ rect.x = offsetX;
+ rect.y = -offsetY;
+ rect.width = PANGO_PIXELS(pixelRanges[2 * j + 1] - logicalRect.x) - offsetX;
+ rect.height = PANGO_PIXELS(baseline - logicalRect.y + logicalRect.height) - offsetY;
+
+ cairo_region_union_rectangle(clipRegion, &rect);
+ }
+
+ free(pixelRanges);
+
+ return clipRegion;
+}
+
+cairo_region_t* getClipRegionFromPangoLayoutLine(PangoLayoutLine* line, const int* indexRange)
+{
+ if (!indexRange)
+ return 0;
+
+ PangoLayoutIter* iter = pango_layout_get_iter(line->layout);
+ while (pango_layout_iter_get_line_readonly(iter) != line)
+ pango_layout_iter_next_line(iter);
+
+ cairo_region_t* clipRegion = getLineClipRegionFromLayoutIter(iter, indexRange);
+
+ pango_layout_iter_free(iter);
+
+ return clipRegion;
+}
+
+} // namespace WebCore
Added: trunk/Source/WebCore/platform/graphics/pango/PangoUtilities.h (0 => 94876)
--- trunk/Source/WebCore/platform/graphics/pango/PangoUtilities.h (rev 0)
+++ trunk/Source/WebCore/platform/graphics/pango/PangoUtilities.h 2011-09-09 22:06:03 UTC (rev 94876)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2000 Red Hat, Inc.
+ * Copyright (C) 2011 ProFUSION embedded systems
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef PangoUtilities_h
+#define PangoUtilities_h
+
+#include "GraphicsTypes.h"
+
+typedef struct _PangoLayoutLine PangoLayoutLine;
+typedef struct _cairo_region cairo_region_t;
+
+namespace WebCore {
+
+cairo_region_t* getClipRegionFromPangoLayoutLine(PangoLayoutLine*, const int* indexRange);
+
+} // namespace WebCore
+
+#endif // PangoUtilities_h
Modified: trunk/Source/cmake/FindPango.cmake (94875 => 94876)
--- trunk/Source/cmake/FindPango.cmake 2011-09-09 21:43:14 UTC (rev 94875)
+++ trunk/Source/cmake/FindPango.cmake 2011-09-09 22:06:03 UTC (rev 94876)
@@ -12,6 +12,7 @@
# Use pkg-config to get hints about paths
libfind_pkg_check_modules(Pango_PKGCONF pango)
+libfind_pkg_check_modules(Pango_Cairo_PKGCONF pango)
# Include dir
find_path(Pango_INCLUDE_DIR
@@ -20,12 +21,23 @@
PATH_SUFFIXES pango-1.0
)
+find_path(Pango_Cairo_INCLUDE_DIR
+ NAMES pango/pangocairo.h
+ PATHS ${Pango_Cairo_PKGCONF_INCLUDE_DIRS}
+ PATH_SUFFIXES pango-1.0
+)
+
# Finally the library itself
find_library(Pango_LIBRARY
NAMES pango-1.0
PATHS ${Pango_PKGCONF_LIBRARY_DIRS}
)
+find_library(Pango_Cairo_LIBRARY
+ NAMES pangocairo-1.0
+ PATHS ${Pango_Cairo_PKGCONF_LIBRARY_DIRS}
+)
+
# Set the include dir variables and the libraries and let libfind_process do the rest.
# NOTE: Singular variables for this library, plural for libraries this this lib depends on.
set(Pango_PROCESS_INCLUDES Pango_INCLUDE_DIR Freetype_INCLUDE_DIRS)