summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@digia.com>2013-03-27 17:08:22 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-28 16:18:16 +0100
commit3f5a0c1161d18c4f1b17bc2cb0093b03b72ac772 (patch)
tree46db077b2e67ee5a6b327ff590d8c9eb05268619
parent44329e0faee75171545189ad7be58ac4c36652fe (diff)
downloadqtwebkit-3f5a0c1161d18c4f1b17bc2cb0093b03b72ac772.tar.gz
[Qt] Support -webkit-font-smoothing
https://bugs.webkit.org/show_bug.cgi?id=106009 Reviewed by Jocelyn Turcotte. Source/WebCore: Set QFont antialiasing settings based on the font smoothing settings in FontDescription. * platform/graphics/qt/FontPlatformDataQt.cpp: (WebCore::FontPlatformData::FontPlatformData): Source/WebKit/qt: Export an interface so DRT can also disable font-smoothing like WTR does. * WebCoreSupport/DumpRenderTreeSupportQt.cpp: (DumpRenderTreeSupportQt::setShouldUseFontSmoothing): * WebCoreSupport/DumpRenderTreeSupportQt.h: Tools: Set shouldUseFontSmoothing to false to match WebKitTestRunner. * DumpRenderTree/qt/TestRunnerQt.cpp: (TestRunnerQt::reset): Change-Id: I19457407ac310bd5de315943b631dd12dffc7683 git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146324 268f45cc-cd09-0410-ab3c-d52691b4dbfc Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
-rw-r--r--Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp8
-rw-r--r--Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp6
-rw-r--r--Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h2
-rw-r--r--Tools/DumpRenderTree/qt/TestRunnerQt.cpp1
4 files changed, 16 insertions, 1 deletions
diff --git a/Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp b/Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp
index 78d3c3ce8..067437188 100644
--- a/Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp
@@ -2,6 +2,7 @@
Copyright (C) 2008 Holger Hans Peter Freyther
Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/
Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
+ Copyright (C) 2013 Digia Plc. and/or its subsidiary(-ies)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -23,6 +24,7 @@
#include "config.h"
#include "FontPlatformData.h"
+#include "Font.h"
#include <wtf/text/WTFString.h>
namespace WebCore {
@@ -72,8 +74,12 @@ FontPlatformData::FontPlatformData(const FontDescription& description, const Ato
font.setWordSpacing(wordSpacing);
font.setLetterSpacing(QFont::AbsoluteSpacing, letterSpacing);
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
- // Kept enabled for Qt < 5.1 to maintain stable baselines for 5.0.
+ // To maintain stable baselines for Qt 5.0, keep force integer metrics enabled and ignore font-smoothing setting.
font.setStyleStrategy(QFont::ForceIntegerMetrics);
+#else
+ if (description.fontSmoothing() == NoSmoothing
+ || (description.fontSmoothing() == AutoSmoothing && !Font::shouldUseSmoothing()))
+ font.setStyleStrategy(QFont::NoAntialias);
#endif
m_data->bold = font.bold();
diff --git a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
index 5ceacd6bc..89dd10e51 100644
--- a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
@@ -39,6 +39,7 @@
#include "EditorClientQt.h"
#include "Element.h"
#include "FocusController.h"
+#include "Font.h"
#include "Frame.h"
#include "FrameLoadRequest.h"
#include "FrameLoaderClientQt.h"
@@ -1049,6 +1050,11 @@ void DumpRenderTreeSupportQt::getTrackedRepaintRects(QWebFrameAdapter* adapter,
result.append(rects[i]);
}
+void DumpRenderTreeSupportQt::setShouldUseFontSmoothing(bool enabled)
+{
+ WebCore::Font::setShouldUseSmoothing(enabled);
+}
+
QString DumpRenderTreeSupportQt::frameRenderTreeDump(QWebFrameAdapter* adapter)
{
if (adapter->frame->view() && adapter->frame->view()->layoutPending())
diff --git a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h
index d06a6b505..00cc4043e 100644
--- a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h
+++ b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h
@@ -214,6 +214,8 @@ public:
static bool trackRepaintRects(QWebFrameAdapter*);
static void getTrackedRepaintRects(QWebFrameAdapter*, QVector<QRect>& result);
+ static void setShouldUseFontSmoothing(bool);
+
static QString frameRenderTreeDump(QWebFrameAdapter*);
};
diff --git a/Tools/DumpRenderTree/qt/TestRunnerQt.cpp b/Tools/DumpRenderTree/qt/TestRunnerQt.cpp
index d93505fc5..f6b149c35 100644
--- a/Tools/DumpRenderTree/qt/TestRunnerQt.cpp
+++ b/Tools/DumpRenderTree/qt/TestRunnerQt.cpp
@@ -93,6 +93,7 @@ void TestRunner::reset()
DumpRenderTreeSupportQt::dumpHistoryCallbacks(false);
DumpRenderTreeSupportQt::dumpVisitedLinksCallbacks(false);
DumpRenderTreeSupportQt::resetGeolocationMock(m_drt->pageAdapter());
+ DumpRenderTreeSupportQt::setShouldUseFontSmoothing(false);
setIconDatabaseEnabled(false);
clearAllDatabases();
// The default state for DRT is to block third-party cookies, mimicing the Mac port