Diff
Modified: releases/WebKitGTK/webkit-2.16/Source/WebCore/ChangeLog (214784 => 214785)
--- releases/WebKitGTK/webkit-2.16/Source/WebCore/ChangeLog 2017-04-03 13:06:15 UTC (rev 214784)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/ChangeLog 2017-04-03 13:07:59 UTC (rev 214785)
@@ -1,3 +1,34 @@
+2017-03-22 Michael Catanzaro <mcatanz...@igalia.com>
+
+ [GTK] Honor GTK+ font settings
+ https://bugs.webkit.org/show_bug.cgi?id=82889
+
+ Reviewed by Carlos Garcia Campos.
+
+ After much discussion with Behdad and Martin (who is still not completely convinced I think
+ :) I want to merge cairo font options into the Fontconfig pattern used for rendering using
+ cairo_ft_font_options_substitute(). This is how the API was designed to be used anyway.
+ Fontconfig will still have final say over whether to actually respect the desktop settings
+ or not, so it can still choose to ignore the desktop's settings, but I don't think it makes
+ sense to have desktop-wide font settings and not tell Fontconfig about them, especially when
+ the whole point of WebKitGTK+ is desktop integration. This should also reduce complaints
+ that we're not following desktop settings and that we're drawing fonts differently than
+ Firefox.
+
+ * PlatformGTK.cmake:
+ * platform/graphics/cairo/CairoUtilities.cpp:
+ (WebCore::getDefaultCairoFontOptions):
+ * platform/graphics/cairo/CairoUtilities.h:
+ * platform/graphics/freetype/FontCacheFreeType.cpp:
+ (WebCore::createFontConfigPatternForCharacters):
+ (WebCore::strongAliasesForFamily):
+ (WebCore::FontCache::createFontPlatformData):
+ * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
+ (WebCore::getDefaultFontconfigOptions):
+ (WebCore::getDefaultCairoFontOptions): Deleted.
+ * platform/graphics/gtk/GdkCairoUtilities.cpp:
+ (getDefaultCairoFontOptions):
+
2017-03-22 Chris Dumez <cdu...@apple.com>
WebKit should disallow beforeunload alerts from web pages users have never interacted with
Modified: releases/WebKitGTK/webkit-2.16/Source/WebCore/PlatformGTK.cmake (214784 => 214785)
--- releases/WebKitGTK/webkit-2.16/Source/WebCore/PlatformGTK.cmake 2017-04-03 13:06:15 UTC (rev 214784)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/PlatformGTK.cmake 2017-04-03 13:07:59 UTC (rev 214785)
@@ -112,6 +112,7 @@
platform/graphics/freetype/FontCacheFreeType.cpp
platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp
+ platform/graphics/freetype/FontPlatformDataFreeType.cpp
platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp
platform/graphics/freetype/SimpleFontDataFreeType.cpp
@@ -187,8 +188,6 @@
platform/graphics/PlatformDisplay.cpp
- platform/graphics/freetype/FontPlatformDataFreeType.cpp
-
platform/graphics/gtk/ColorGtk.cpp
platform/graphics/gtk/GdkCairoUtilities.cpp
platform/graphics/gtk/IconGtk.cpp
Modified: releases/WebKitGTK/webkit-2.16/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp (214784 => 214785)
--- releases/WebKitGTK/webkit-2.16/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp 2017-04-03 13:06:15 UTC (rev 214784)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp 2017-04-03 13:07:59 UTC (rev 214785)
@@ -39,6 +39,7 @@
#include "RefPtrCairo.h"
#include "Region.h"
#include <wtf/Assertions.h>
+#include <wtf/NeverDestroyed.h>
#include <wtf/Vector.h>
#if ENABLE(ACCELERATED_2D_CANVAS)
@@ -47,6 +48,14 @@
namespace WebCore {
+#if USE(FREETYPE) && !PLATFORM(GTK)
+const cairo_font_options_t* getDefaultCairoFontOptions()
+{
+ static NeverDestroyed<cairo_font_options_t*> options = cairo_font_options_create();
+ return options;
+}
+#endif
+
void copyContextProperties(cairo_t* srcCr, cairo_t* dstCr)
{
cairo_set_antialias(dstCr, cairo_get_antialias(srcCr));
Modified: releases/WebKitGTK/webkit-2.16/Source/WebCore/platform/graphics/cairo/CairoUtilities.h (214784 => 214785)
--- releases/WebKitGTK/webkit-2.16/Source/WebCore/platform/graphics/cairo/CairoUtilities.h 2017-04-03 13:06:15 UTC (rev 214784)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/platform/graphics/cairo/CairoUtilities.h 2017-04-03 13:07:59 UTC (rev 214785)
@@ -24,8 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef CairoUtilities_h
-#define CairoUtilities_h
+#pragma once
#if USE(CAIRO)
@@ -71,6 +70,8 @@
cairo_scaled_font_t* m_scaledFont { nullptr };
FT_Face m_ftFace { nullptr };
};
+
+const cairo_font_options_t* getDefaultCairoFontOptions();
#endif
void copyContextProperties(cairo_t* srcCr, cairo_t* dstCr);
@@ -97,5 +98,3 @@
} // namespace WebCore
#endif // USE(CAIRO)
-
-#endif // CairoUtilities_h
Modified: releases/WebKitGTK/webkit-2.16/Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp (214784 => 214785)
--- releases/WebKitGTK/webkit-2.16/Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp 2017-04-03 13:06:15 UTC (rev 214784)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp 2017-04-03 13:07:59 UTC (rev 214785)
@@ -22,6 +22,7 @@
#include "config.h"
#include "FontCache.h"
+#include "CairoUtilities.h"
#include "FcUniquePtr.h"
#include "Font.h"
#include "RefPtrCairo.h"
@@ -57,6 +58,7 @@
FcPatternAddBool(pattern.get(), FC_SCALABLE, FcTrue);
FcConfigSubstitute(nullptr, pattern.get(), FcMatchPattern);
+ cairo_ft_font_options_substitute(getDefaultCairoFontOptions(), pattern.get());
FcDefaultSubstitute(pattern.get());
return pattern;
}
@@ -266,6 +268,7 @@
return Vector<String>();
FcConfigSubstitute(nullptr, pattern.get(), FcMatchPattern);
+ cairo_ft_font_options_substitute(getDefaultCairoFontOptions(), pattern.get());
FcDefaultSubstitute(pattern.get());
FcUniquePtr<FcObjectSet> familiesOnly(FcObjectSetBuild(FC_FAMILY, nullptr));
@@ -360,6 +363,7 @@
// configuration step, before any matching occurs, we allow arbitrary family substitutions,
// since this is an exact matter of respecting the user's font configuration.
FcConfigSubstitute(nullptr, pattern.get(), FcMatchPattern);
+ cairo_ft_font_options_substitute(getDefaultCairoFontOptions(), pattern.get());
FcDefaultSubstitute(pattern.get());
FcChar8* fontConfigFamilyNameAfterConfiguration;
Modified: releases/WebKitGTK/webkit-2.16/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp (214784 => 214785)
--- releases/WebKitGTK/webkit-2.16/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp 2017-04-03 13:06:15 UTC (rev 214784)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp 2017-04-03 13:07:59 UTC (rev 214785)
@@ -37,10 +37,6 @@
#include <wtf/MathExtras.h>
#include <wtf/text/WTFString.h>
-#if PLATFORM(GTK)
-#include <gdk/gdk.h>
-#endif
-
namespace WebCore {
static cairo_subpixel_order_t convertFontConfigSubpixelOrder(int fontConfigOrder)
@@ -106,18 +102,6 @@
cairo_font_options_set_hint_style(options, CAIRO_HINT_STYLE_NONE);
}
-static CairoUniquePtr<cairo_font_options_t> getDefaultCairoFontOptions()
-{
-#if PLATFORM(GTK)
- if (GdkScreen* screen = gdk_screen_get_default()) {
- const cairo_font_options_t* screenOptions = gdk_screen_get_font_options(screen);
- if (screenOptions)
- return CairoUniquePtr<cairo_font_options_t>(cairo_font_options_copy(screenOptions));
- }
-#endif
- return CairoUniquePtr<cairo_font_options_t>(cairo_font_options_create());
-}
-
static FcPattern* getDefaultFontconfigOptions()
{
// Get some generic default settings from fontconfig for web fonts. Strategy
@@ -129,6 +113,7 @@
std::call_once(flag, [](FcPattern*) {
pattern = FcPatternCreate();
FcConfigSubstitute(nullptr, pattern, FcMatchPattern);
+ cairo_ft_font_options_substitute(getDefaultCairoFontOptions(), pattern);
FcDefaultSubstitute(pattern);
FcPatternDel(pattern, FC_FAMILY);
FcConfigSubstitute(nullptr, pattern, FcMatchFont);
@@ -305,7 +290,7 @@
void FontPlatformData::buildScaledFont(cairo_font_face_t* fontFace)
{
- CairoUniquePtr<cairo_font_options_t> options = getDefaultCairoFontOptions();
+ CairoUniquePtr<cairo_font_options_t> options(cairo_font_options_copy(getDefaultCairoFontOptions()));
FcPattern* optionsPattern = m_pattern ? m_pattern.get() : getDefaultFontconfigOptions();
setCairoFontOptionsFromFontConfigPattern(options.get(), optionsPattern);
Modified: releases/WebKitGTK/webkit-2.16/Source/WebCore/platform/graphics/gtk/GdkCairoUtilities.cpp (214784 => 214785)
--- releases/WebKitGTK/webkit-2.16/Source/WebCore/platform/graphics/gtk/GdkCairoUtilities.cpp 2017-04-03 13:06:15 UTC (rev 214784)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/platform/graphics/gtk/GdkCairoUtilities.cpp 2017-04-03 13:07:59 UTC (rev 214785)
@@ -31,9 +31,26 @@
#include "IntSize.h"
#include <cairo.h>
#include <gtk/gtk.h>
+#include <mutex>
+#include <wtf/NeverDestroyed.h>
-using namespace WebCore;
+namespace WebCore {
+const cairo_font_options_t* getDefaultCairoFontOptions()
+{
+ if (auto* screen = gdk_screen_get_default()) {
+ if (auto* options = gdk_screen_get_font_options(screen))
+ return options;
+ }
+
+ static LazyNeverDestroyed<cairo_font_options_t*> options;
+ static std::once_flag flag;
+ std::call_once(flag, [] {
+ options.construct(cairo_font_options_create());
+ });
+ return options;
+}
+
GdkPixbuf* cairoSurfaceToGdkPixbuf(cairo_surface_t* surface)
{
IntSize size = cairoSurfaceSize(surface);
@@ -40,3 +57,4 @@
return gdk_pixbuf_get_from_surface(surface, 0, 0, size.width(), size.height());
}
+}
Modified: releases/WebKitGTK/webkit-2.16/Source/WebCore/platform/graphics/gtk/GdkCairoUtilities.h (214784 => 214785)
--- releases/WebKitGTK/webkit-2.16/Source/WebCore/platform/graphics/gtk/GdkCairoUtilities.h 2017-04-03 13:06:15 UTC (rev 214784)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/platform/graphics/gtk/GdkCairoUtilities.h 2017-04-03 13:07:59 UTC (rev 214785)
@@ -23,9 +23,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef GdkCairoUtilities_h
-#define GdkCairoUtilities_h
+#pragma once
+namespace WebCore {
+
GdkPixbuf* cairoSurfaceToGdkPixbuf(cairo_surface_t*);
-#endif // GdkCairoUtilities_h
+}