summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Source/JavaScriptCore/Target.pri13
-rw-r--r--Source/JavaScriptCore/dfg/DFGNodeFlags.h2
-rw-r--r--Source/JavaScriptCore/dfg/DFGNodeType.h2
-rw-r--r--Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp8
-rw-r--r--Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp2
-rw-r--r--Source/JavaScriptCore/jit/JITOpcodes.cpp16
-rw-r--r--Source/JavaScriptCore/jit/JITStubs.cpp7
-rw-r--r--Source/JavaScriptCore/jit/JITStubs.h30
-rw-r--r--Source/JavaScriptCore/jit/JITStubsMSVC64.asm84
-rw-r--r--Source/JavaScriptCore/jit/JSInterfaceJIT.h12
-rw-r--r--Source/JavaScriptCore/yarr/YarrJIT.cpp20
-rw-r--r--Source/WTF/wtf/Platform.h8
-rw-r--r--Source/WebCore/platform/graphics/GlyphBuffer.h16
-rw-r--r--Source/WebCore/platform/graphics/WidthIterator.h8
-rw-r--r--Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp9
-rw-r--r--Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp11
-rw-r--r--Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h3
-rw-r--r--Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp6
-rw-r--r--Tools/DumpRenderTree/qt/TestRunnerQt.cpp2
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp1
20 files changed, 241 insertions, 19 deletions
diff --git a/Source/JavaScriptCore/Target.pri b/Source/JavaScriptCore/Target.pri
index f609de10b..e1da901c1 100644
--- a/Source/JavaScriptCore/Target.pri
+++ b/Source/JavaScriptCore/Target.pri
@@ -297,6 +297,19 @@ linux-*:if(isEqual(QT_ARCH, "i386")|isEqual(QT_ARCH, "x86_64")) {
disassembler/udis86/udis86_syn.c \
}
+win32:!win32-g++*:isEqual(QT_ARCH, "x86_64"):{
+ asm_compiler.commands = ml64 /c
+ asm_compiler.commands += /Fo ${QMAKE_FILE_OUT} ${QMAKE_FILE_IN}
+ asm_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)}
+ asm_compiler.input = ASM_SOURCES
+ asm_compiler.variable_out = OBJECTS
+ asm_compiler.name = compiling[asm] ${QMAKE_FILE_IN}
+ silent:asm_compiler.commands = @echo compiling[asm] ${QMAKE_FILE_IN} && $$asm_compiler.commands
+ QMAKE_EXTRA_COMPILERS += asm_compiler
+
+ ASM_SOURCES += jit/JITStubsMSVC64.asm
+}
+
HEADERS += $$files(*.h, true)
*sh4* {
diff --git a/Source/JavaScriptCore/dfg/DFGNodeFlags.h b/Source/JavaScriptCore/dfg/DFGNodeFlags.h
index 5e41bfc6b..463451c39 100644
--- a/Source/JavaScriptCore/dfg/DFGNodeFlags.h
+++ b/Source/JavaScriptCore/dfg/DFGNodeFlags.h
@@ -54,7 +54,7 @@ namespace JSC { namespace DFG {
#define NodeBackPropMask 0x3C00
#define NodeUseBottom 0x000
-#define NodeUsedAsNumber 0x400 // The result of this computation may be used in a context that observes fractional results.
+#define NodeUsedAsNumber 0x400 // The result of this computation may be used in a context that observes fractional, or bigger-than-int32, results.
#define NodeNeedsNegZero 0x800 // The result of this computation may be used in a context that observes -0.
#define NodeUsedAsOther 0x1000 // The result of this computation may be used in a context that distinguishes between NaN and other things (like undefined).
#define NodeUsedAsValue (NodeUsedAsNumber | NodeNeedsNegZero | NodeUsedAsOther)
diff --git a/Source/JavaScriptCore/dfg/DFGNodeType.h b/Source/JavaScriptCore/dfg/DFGNodeType.h
index cbcdde660..b3fd78785 100644
--- a/Source/JavaScriptCore/dfg/DFGNodeType.h
+++ b/Source/JavaScriptCore/dfg/DFGNodeType.h
@@ -58,7 +58,7 @@ namespace JSC { namespace DFG {
/* VariableAccessData, and thus will share predictions. */\
macro(GetLocal, NodeResultJS) \
macro(SetLocal, 0) \
- macro(Phantom, NodeMustGenerate | NodeDoesNotExit) \
+ macro(Phantom, NodeMustGenerate) \
macro(Nop, 0 | NodeDoesNotExit) \
macro(Phi, 0 | NodeDoesNotExit) \
macro(Flush, NodeMustGenerate | NodeDoesNotExit) \
diff --git a/Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp b/Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp
index 5b6c28ff7..4226fcc6a 100644
--- a/Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp
+++ b/Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp
@@ -211,7 +211,13 @@ private:
case SetLocal: {
VariableAccessData* variableAccessData = node.variableAccessData();
changed |= variableAccessData->predict(m_graph[node.child1()].prediction());
- changed |= m_graph[node.child1()].mergeFlags(variableAccessData->flags());
+
+ // Assume conservatively that a SetLocal implies that the value may flow through a loop,
+ // and so we would have overflow leading to the program "observing" numbers even if all
+ // users of the value are doing toInt32. It might be worthwhile to revisit this at some
+ // point and actually check if the data flow involves loops, but right now I don't think
+ // we have evidence that this would be beneficial for benchmarks.
+ changed |= m_graph[node.child1()].mergeFlags(variableAccessData->flags() | NodeUsedAsNumber);
break;
}
diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
index f5b9ec9ce..fce151ef2 100644
--- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
+++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
@@ -3724,7 +3724,7 @@ void SpeculativeJIT::compile(Node& node)
case NewArrayWithSize: {
JSGlobalObject* globalObject = m_jit.graph().globalObjectFor(node.codeOrigin);
- if (!globalObject->isHavingABadTime()) {
+ if (!globalObject->isHavingABadTime() && !hasArrayStorage(node.indexingType())) {
globalObject->havingABadTimeWatchpoint()->add(speculationWatchpoint());
SpeculateStrictInt32Operand size(this, node.child1());
diff --git a/Source/JavaScriptCore/jit/JITOpcodes.cpp b/Source/JavaScriptCore/jit/JITOpcodes.cpp
index 9f0ce3a77..36e7ece1b 100644
--- a/Source/JavaScriptCore/jit/JITOpcodes.cpp
+++ b/Source/JavaScriptCore/jit/JITOpcodes.cpp
@@ -244,6 +244,7 @@ JIT::Label JIT::privateCompileCTINativeCall(JSGlobalData* globalData, bool isCon
peek(regT1);
emitPutToCallFrameHeader(regT1, JSStack::ReturnPC);
+#if !OS(WINDOWS)
// Calling convention: f(edi, esi, edx, ecx, ...);
// Host function signature: f(ExecState*);
move(callFrameRegister, X86Registers::edi);
@@ -256,6 +257,21 @@ JIT::Label JIT::privateCompileCTINativeCall(JSGlobalData* globalData, bool isCon
call(Address(X86Registers::r9, executableOffsetToFunction));
addPtr(TrustedImm32(16 - sizeof(int64_t)), stackPointerRegister);
+#else
+ // Calling convention: f(ecx, edx, r8, r9, ...);
+ // Host function signature: f(ExecState*);
+ move(callFrameRegister, X86Registers::ecx);
+
+ // Leave space for the callee parameter home addresses and align the stack.
+ subPtr(TrustedImm32(4 * sizeof(int64_t) + 16 - sizeof(int64_t)), stackPointerRegister);
+
+ emitGetFromCallFrameHeaderPtr(JSStack::Callee, X86Registers::edx);
+ loadPtr(Address(X86Registers::edx, OBJECT_OFFSETOF(JSFunction, m_executable)), X86Registers::r9);
+ move(regT0, callFrameRegister); // Eagerly restore caller frame register to avoid loading from stack.
+ call(Address(X86Registers::r9, executableOffsetToFunction));
+
+ addPtr(TrustedImm32(4 * sizeof(int64_t) + 16 - sizeof(int64_t)), stackPointerRegister);
+#endif
#elif CPU(ARM)
// Load caller frame's scope chain into this callframe so that whatever we call can
diff --git a/Source/JavaScriptCore/jit/JITStubs.cpp b/Source/JavaScriptCore/jit/JITStubs.cpp
index fbef1fcb9..eca0fb079 100644
--- a/Source/JavaScriptCore/jit/JITStubs.cpp
+++ b/Source/JavaScriptCore/jit/JITStubs.cpp
@@ -433,6 +433,13 @@ SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n"
"ret" "\n"
);
+#elif COMPILER(MSVC) && CPU(X86_64)
+
+// These ASSERTs remind you that, if you change the layout of JITStackFrame, you
+// need to change the assembly trampolines in JITStubsMSVC64.asm to match.
+COMPILE_ASSERT(offsetof(struct JITStackFrame, code) % 16 == 0x0, JITStackFrame_maintains_16byte_stack_alignment);
+COMPILE_ASSERT(offsetof(struct JITStackFrame, savedRBX) == 0x58, JITStackFrame_stub_argument_space_matches_ctiTrampoline);
+
#else
#error "JIT not supported on this platform."
#endif
diff --git a/Source/JavaScriptCore/jit/JITStubs.h b/Source/JavaScriptCore/jit/JITStubs.h
index 3bf13bbdf..fe64cd9bc 100644
--- a/Source/JavaScriptCore/jit/JITStubs.h
+++ b/Source/JavaScriptCore/jit/JITStubs.h
@@ -99,7 +99,7 @@ namespace JSC {
MacroAssemblerCodePtr ctiNativeConstruct;
};
-#if CPU(X86_64)
+#if !OS(WINDOWS) && CPU(X86_64)
struct JITStackFrame {
void* reserved; // Unused
JITStubArg args[6];
@@ -123,6 +123,34 @@ namespace JSC {
// When JIT code makes a call, it pushes its return address just below the rest of the stack.
ReturnAddressPtr* returnAddressSlot() { return reinterpret_cast<ReturnAddressPtr*>(this) - 1; }
};
+#elif OS(WINDOWS) && CPU(X86_64)
+ struct JITStackFrame {
+ void* shadow[4]; // Shadow space reserved for a callee's parameters home addresses
+ void* reserved; // Unused, also maintains the 16-bytes stack alignment
+ JITStubArg args[6];
+
+ void* savedRBX;
+ void* savedR15;
+ void* savedR14;
+ void* savedR13;
+ void* savedR12;
+ void* savedRBP;
+ void* savedRIP;
+
+ // Home addresses for our register passed parameters
+ // http://msdn.microsoft.com/en-us/library/ew5tede7.aspx
+ void* code;
+ JSStack* stack;
+ CallFrame* callFrame;
+ void* unused1;
+
+ // Passed on the stack
+ void* unused2;
+ JSGlobalData* globalData;
+
+ // When JIT code makes a call, it pushes its return address just below the rest of the stack.
+ ReturnAddressPtr* returnAddressSlot() { return reinterpret_cast<ReturnAddressPtr*>(this) - 1; }
+ };
#elif CPU(X86)
#if COMPILER(MSVC) || (OS(WINDOWS) && COMPILER(GCC))
#pragma pack(push)
diff --git a/Source/JavaScriptCore/jit/JITStubsMSVC64.asm b/Source/JavaScriptCore/jit/JITStubsMSVC64.asm
new file mode 100644
index 000000000..4a00e0d14
--- /dev/null
+++ b/Source/JavaScriptCore/jit/JITStubsMSVC64.asm
@@ -0,0 +1,84 @@
+;/*
+; Copyright (C) 2013 Digia Plc. and/or its subsidiary(-ies)
+;
+; Redistribution and use in source and binary forms, with or without
+; modification, are permitted provided that the following conditions
+; are met:
+; 1. Redistributions of source code must retain the above copyright
+; notice, this list of conditions and the following disclaimer.
+; 2. Redistributions in binary form must reproduce the above copyright
+; notice, this list of conditions and the following disclaimer in the
+; documentation and/or other materials provided with the distribution.
+;
+; THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+; PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+; OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+;*/
+
+EXTERN cti_vm_throw : near
+PUBLIC ctiTrampoline
+PUBLIC ctiVMThrowTrampoline
+PUBLIC ctiOpThrowNotCaught
+
+_TEXT SEGMENT
+
+ctiTrampoline PROC
+ ; Dump register parameters to their home address
+ mov qword ptr[rsp+20h], r9
+ mov qword ptr[rsp+18h], r8
+ mov qword ptr[rsp+10h], rdx
+ mov qword ptr[rsp+8h], rcx
+
+ push rbp
+ mov rbp, rsp
+ push r12
+ push r13
+ push r14
+ push r15
+ push rbx
+
+ ; Decrease rsp to point to the start of our JITStackFrame
+ sub rsp, 58h
+ mov r12, 512
+ mov r14, 0FFFF000000000000h
+ mov r15, 0FFFF000000000002h
+ mov r13, r8
+ call rcx
+ add rsp, 58h
+ pop rbx
+ pop r15
+ pop r14
+ pop r13
+ pop r12
+ pop rbp
+ ret
+ctiTrampoline ENDP
+
+ctiVMThrowTrampoline PROC
+ mov rcx, rsp
+ call cti_vm_throw
+ int 3
+ctiVMThrowTrampoline ENDP
+
+ctiOpThrowNotCaught PROC
+ add rsp, 58h
+ pop rbx
+ pop r15
+ pop r14
+ pop r13
+ pop r12
+ pop rbp
+ ret
+ctiOpThrowNotCaught ENDP
+
+_TEXT ENDS
+
+END \ No newline at end of file
diff --git a/Source/JavaScriptCore/jit/JSInterfaceJIT.h b/Source/JavaScriptCore/jit/JSInterfaceJIT.h
index d2a91ba0a..ad546d963 100644
--- a/Source/JavaScriptCore/jit/JSInterfaceJIT.h
+++ b/Source/JavaScriptCore/jit/JSInterfaceJIT.h
@@ -57,22 +57,26 @@ namespace JSC {
#if CPU(X86_64)
static const RegisterID returnValueRegister = X86Registers::eax;
static const RegisterID cachedResultRegister = X86Registers::eax;
+#if !OS(WINDOWS)
static const RegisterID firstArgumentRegister = X86Registers::edi;
-
+#else
+ static const RegisterID firstArgumentRegister = X86Registers::ecx;
+#endif
+
#if ENABLE(VALUE_PROFILER)
static const RegisterID bucketCounterRegister = X86Registers::r10;
#endif
-
+
static const RegisterID timeoutCheckRegister = X86Registers::r12;
static const RegisterID callFrameRegister = X86Registers::r13;
static const RegisterID tagTypeNumberRegister = X86Registers::r14;
static const RegisterID tagMaskRegister = X86Registers::r15;
-
+
static const RegisterID regT0 = X86Registers::eax;
static const RegisterID regT1 = X86Registers::edx;
static const RegisterID regT2 = X86Registers::ecx;
static const RegisterID regT3 = X86Registers::ebx;
-
+
static const FPRegisterID fpRegT0 = X86Registers::xmm0;
static const FPRegisterID fpRegT1 = X86Registers::xmm1;
static const FPRegisterID fpRegT2 = X86Registers::xmm2;
diff --git a/Source/JavaScriptCore/yarr/YarrJIT.cpp b/Source/JavaScriptCore/yarr/YarrJIT.cpp
index ce84e2c74..d5b215413 100644
--- a/Source/JavaScriptCore/yarr/YarrJIT.cpp
+++ b/Source/JavaScriptCore/yarr/YarrJIT.cpp
@@ -87,10 +87,20 @@ class YarrGenerator : private MacroAssembler {
static const RegisterID returnRegister = X86Registers::eax;
static const RegisterID returnRegister2 = X86Registers::edx;
#elif CPU(X86_64)
+#if !OS(WINDOWS)
static const RegisterID input = X86Registers::edi;
static const RegisterID index = X86Registers::esi;
static const RegisterID length = X86Registers::edx;
static const RegisterID output = X86Registers::ecx;
+#else
+ // If the return value doesn't fit in 64bits, its destination is pointed by rcx and the parameters are shifted.
+ // http://msdn.microsoft.com/en-us/library/7572ztz4.aspx
+ COMPILE_ASSERT(sizeof(MatchResult) > sizeof(void*), MatchResult_does_not_fit_in_64bits);
+ static const RegisterID input = X86Registers::edx;
+ static const RegisterID index = X86Registers::r8;
+ static const RegisterID length = X86Registers::r9;
+ static const RegisterID output = X86Registers::r10;
+#endif
static const RegisterID regT0 = X86Registers::eax;
static const RegisterID regT1 = X86Registers::ebx;
@@ -2502,6 +2512,10 @@ class YarrGenerator : private MacroAssembler {
push(X86Registers::ebp);
move(stackPointerRegister, X86Registers::ebp);
push(X86Registers::ebx);
+#if OS(WINDOWS)
+ if (compileMode == IncludeSubpatterns)
+ loadPtr(Address(X86Registers::ebp, 6 * sizeof(void*)), output);
+#endif
#elif CPU(X86)
push(X86Registers::ebp);
move(stackPointerRegister, X86Registers::ebp);
@@ -2540,6 +2554,12 @@ class YarrGenerator : private MacroAssembler {
void generateReturn()
{
#if CPU(X86_64)
+#if OS(WINDOWS)
+ // Store the return value in the allocated space pointed by rcx.
+ store64(returnRegister, Address(X86Registers::ecx));
+ store64(returnRegister2, Address(X86Registers::ecx, sizeof(void*)));
+ move(X86Registers::ecx, returnRegister);
+#endif
pop(X86Registers::ebx);
pop(X86Registers::ebp);
#elif CPU(X86)
diff --git a/Source/WTF/wtf/Platform.h b/Source/WTF/wtf/Platform.h
index 16030199a..6912392e0 100644
--- a/Source/WTF/wtf/Platform.h
+++ b/Source/WTF/wtf/Platform.h
@@ -882,12 +882,6 @@
#define ENABLE_JIT 0
#endif
-/* JIT is not implemented for Windows 64-bit */
-#if !defined(ENABLE_JIT) && OS(WINDOWS) && CPU(X86_64)
-#define ENABLE_JIT 0
-#define ENABLE_YARR_JIT 0
-#endif
-
#if !defined(ENABLE_JIT) && CPU(SH4) && PLATFORM(QT)
#define ENABLE_JIT 1
#endif
@@ -1028,7 +1022,7 @@
/* Pick which allocator to use; we only need an executable allocator if the assembler is compiled in.
On x86-64 we use a single fixed mmap, on other platforms we mmap on demand. */
#if ENABLE(ASSEMBLER)
-#if CPU(X86_64) || PLATFORM(IOS)
+#if CPU(X86_64) && !OS(WINDOWS) || PLATFORM(IOS)
#define ENABLE_EXECUTABLE_ALLOCATOR_FIXED 1
#else
#define ENABLE_EXECUTABLE_ALLOCATOR_DEMAND 1
diff --git a/Source/WebCore/platform/graphics/GlyphBuffer.h b/Source/WebCore/platform/graphics/GlyphBuffer.h
index 5feafb140..3aec08e65 100644
--- a/Source/WebCore/platform/graphics/GlyphBuffer.h
+++ b/Source/WebCore/platform/graphics/GlyphBuffer.h
@@ -56,6 +56,8 @@ class SimpleFontData;
typedef cairo_glyph_t GlyphBufferGlyph;
#elif OS(WINCE)
typedef wchar_t GlyphBufferGlyph;
+#elif PLATFORM(QT)
+typedef quint32 GlyphBufferGlyph;
#else
typedef Glyph GlyphBufferGlyph;
#endif
@@ -89,6 +91,18 @@ public:
private:
float advance;
};
+#elif PLATFORM(QT)
+struct GlyphBufferAdvance : public QPointF {
+public:
+ GlyphBufferAdvance(const QPointF& advance)
+ : QPointF(advance)
+ {
+ }
+
+ void setWidth(qreal width) { QPointF::setX(width); }
+ qreal width() const { return QPointF::x(); }
+ qreal height() const { return QPointF::y(); }
+};
#else
typedef FloatSize GlyphBufferAdvance;
#endif
@@ -156,6 +170,8 @@ public:
m_advances.append(advance);
#elif OS(WINCE)
m_advances.append(width);
+#elif PLATFORM(QT)
+ m_advances.append(QPointF(width, 0));
#else
m_advances.append(FloatSize(width, 0));
#endif
diff --git a/Source/WebCore/platform/graphics/WidthIterator.h b/Source/WebCore/platform/graphics/WidthIterator.h
index 1996a0978..8e4e06997 100644
--- a/Source/WebCore/platform/graphics/WidthIterator.h
+++ b/Source/WebCore/platform/graphics/WidthIterator.h
@@ -61,13 +61,15 @@ public:
static bool supportsTypesettingFeatures(const Font& font)
{
-#if !PLATFORM(MAC) || __MAC_OS_X_VERSION_MIN_REQUIRED <= 1080
- return !font.typesettingFeatures();
-#else
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED > 1080
if (!font.isPrinterFont())
return !font.typesettingFeatures();
return !(font.typesettingFeatures() & ~(Kerning | Ligatures));
+#elif PLATFORM(QT) && QT_VERSION >= 0x050100
+ return !(font.typesettingFeatures() & ~Kerning) && !font.isSmallCaps();
+#else
+ return !font.typesettingFeatures();
#endif
}
diff --git a/Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp b/Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp
index 529150a7b..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 {
@@ -71,7 +73,14 @@ FontPlatformData::FontPlatformData(const FontDescription& description, const Ato
font.setWeight(toQFontWeight(description.weight()));
font.setWordSpacing(wordSpacing);
font.setLetterSpacing(QFont::AbsoluteSpacing, letterSpacing);
+#if QT_VERSION < QT_VERSION_CHECK(5, 1, 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();
// WebKit allows font size zero but QFont does not. We will return
diff --git a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
index 5ceacd6bc..c3468f70a 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,16 @@ void DumpRenderTreeSupportQt::getTrackedRepaintRects(QWebFrameAdapter* adapter,
result.append(rects[i]);
}
+void DumpRenderTreeSupportQt::disableDefaultTypesettingFeatures()
+{
+ WebCore::Font::setDefaultTypesettingFeatures(0);
+}
+
+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..a236e4bdc 100644
--- a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h
+++ b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h
@@ -214,6 +214,9 @@ public:
static bool trackRepaintRects(QWebFrameAdapter*);
static void getTrackedRepaintRects(QWebFrameAdapter*, QVector<QRect>& result);
+ static void setShouldUseFontSmoothing(bool);
+ static void disableDefaultTypesettingFeatures();
+
static QString frameRenderTreeDump(QWebFrameAdapter*);
};
diff --git a/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp b/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp
index 60dcdbe94..e763eefd9 100644
--- a/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp
@@ -32,6 +32,7 @@
#include "Chrome.h"
#include "ChromeClientQt.h"
+#include "Font.h"
#include "Image.h"
#include "NotImplemented.h"
#include "Page.h"
@@ -71,6 +72,11 @@ Q_DECL_EXPORT void initializeWebKitQt()
if (initCallback) {
WebCore::RenderThemeQStyle::setStyleFactoryFunction(createStyleForPage);
WebCore::RenderThemeQt::setCustomTheme(WebCore::RenderThemeQStyle::create, new WebCore::ScrollbarThemeQStyle);
+#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
+ // Only enable kerning by default in Qt 5.1 where it can use the fast font path.
+ // In Qt 5.0 this would have forced the complex font path.
+ WebCore::Font::setDefaultTypesettingFeatures(WebCore::Kerning);
+#endif
}
}
diff --git a/Tools/DumpRenderTree/qt/TestRunnerQt.cpp b/Tools/DumpRenderTree/qt/TestRunnerQt.cpp
index d93505fc5..37b5bb330 100644
--- a/Tools/DumpRenderTree/qt/TestRunnerQt.cpp
+++ b/Tools/DumpRenderTree/qt/TestRunnerQt.cpp
@@ -93,6 +93,8 @@ void TestRunner::reset()
DumpRenderTreeSupportQt::dumpHistoryCallbacks(false);
DumpRenderTreeSupportQt::dumpVisitedLinksCallbacks(false);
DumpRenderTreeSupportQt::resetGeolocationMock(m_drt->pageAdapter());
+ DumpRenderTreeSupportQt::setShouldUseFontSmoothing(false);
+ DumpRenderTreeSupportQt::disableDefaultTypesettingFeatures();
setIconDatabaseEnabled(false);
clearAllDatabases();
// The default state for DRT is to block third-party cookies, mimicing the Mac port
diff --git a/Tools/WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp b/Tools/WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp
index 332ffcf02..ff24aa5ca 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp
@@ -39,6 +39,7 @@ void activateFonts()
{
WebKit::QtTestSupport::initializeTestFonts();
QCoreApplication::setAttribute(Qt::AA_Use96Dpi, true);
+ DumpRenderTreeSupportQt::disableDefaultTypesettingFeatures();
}
}