diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-09-19 17:54:27 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-09-19 17:54:27 +0200 |
commit | f952f4a4ce4464beda012e1fe0cd4da9f91a23a8 (patch) | |
tree | b613af97e2052e1db1689a0b004bacd9621800c1 | |
parent | 84bef97f5004ccc60dbba0faa4f4b8d40838ee23 (diff) | |
parent | 55f814fc556631b390f0c5764bb4ee3ceeea1d45 (diff) | |
download | qtwebkit-f952f4a4ce4464beda012e1fe0cd4da9f91a23a8.tar.gz |
Merge remote-tracking branch 'origin/5.4' into dev
Change-Id: I98b8afb91dff72023dabf58f0b570cada8804cf2
35 files changed, 269 insertions, 113 deletions
diff --git a/Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h b/Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h index 754e5cf4e..927b08b07 100644 --- a/Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h +++ b/Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h @@ -768,7 +768,53 @@ public: void load16Unaligned(BaseIndex address, RegisterID dest) { - load16(address, dest); + if (address.offset >= -32768 && address.offset <= 32766 && !m_fixedWidth) { + /* + sll addrtemp, address.index, address.scale + addu addrtemp, addrtemp, address.base + lbu immTemp, address.offset+x(addrtemp) (x=0 for LE, x=1 for BE) + lbu dest, address.offset+x(addrtemp) (x=1 for LE, x=0 for BE) + sll dest, dest, 8 + or dest, dest, immTemp + */ + m_assembler.sll(addrTempRegister, address.index, address.scale); + m_assembler.addu(addrTempRegister, addrTempRegister, address.base); +#if CPU(BIG_ENDIAN) + m_assembler.lbu(immTempRegister, addrTempRegister, address.offset + 1); + m_assembler.lbu(dest, addrTempRegister, address.offset); +#else + m_assembler.lbu(immTempRegister, addrTempRegister, address.offset); + m_assembler.lbu(dest, addrTempRegister, address.offset + 1); +#endif + m_assembler.sll(dest, dest, 8); + m_assembler.orInsn(dest, dest, immTempRegister); + } else { + /* + sll addrTemp, address.index, address.scale + addu addrTemp, addrTemp, address.base + lui immTemp, address.offset >> 16 + ori immTemp, immTemp, address.offset & 0xffff + addu addrTemp, addrTemp, immTemp + lbu immTemp, x(addrtemp) (x=0 for LE, x=1 for BE) + lbu dest, x(addrtemp) (x=1 for LE, x=0 for BE) + sll dest, dest, 8 + or dest, dest, immTemp + */ + m_assembler.sll(addrTempRegister, address.index, address.scale); + m_assembler.addu(addrTempRegister, addrTempRegister, address.base); + m_assembler.lui(immTempRegister, address.offset >> 16); + m_assembler.ori(immTempRegister, immTempRegister, address.offset); + m_assembler.addu(addrTempRegister, addrTempRegister, immTempRegister); +#if CPU(BIG_ENDIAN) + m_assembler.lbu(immTempRegister, addrTempRegister, 1); + m_assembler.lbu(dest, addrTempRegister, 0); +#else + m_assembler.lbu(immTempRegister, addrTempRegister, 0); + m_assembler.lbu(dest, addrTempRegister, 1); +#endif + m_assembler.sll(dest, dest, 8); + m_assembler.orInsn(dest, dest, immTempRegister); + } } void load32WithUnalignedHalfWords(BaseIndex address, RegisterID dest) diff --git a/Source/JavaScriptCore/dfg/DFGCCallHelpers.h b/Source/JavaScriptCore/dfg/DFGCCallHelpers.h index ab33677ba..ebf0bfd89 100644 --- a/Source/JavaScriptCore/dfg/DFGCCallHelpers.h +++ b/Source/JavaScriptCore/dfg/DFGCCallHelpers.h @@ -489,6 +489,12 @@ public: swap(GPRInfo::argumentGPR2, GPRInfo::argumentGPR3); } +#if CPU(MIPS) +#define POKE_ARGUMENT_OFFSET 4 +#else +#define POKE_ARGUMENT_OFFSET 0 +#endif + #if CPU(X86_64) ALWAYS_INLINE void setupArguments(FPRReg arg1) { @@ -549,6 +555,21 @@ public: setupStubArguments(arg1, arg2); move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); } + + ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32, FPRReg arg2, GPRReg arg3) + { + moveDouble(arg2, FPRInfo::argumentFPR0); + move(arg3, GPRInfo::argumentGPR1); + move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); + } + + ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImm32, FPRReg arg4) + { + moveDouble(arg4, FPRInfo::argumentFPR0); + setupStubArguments(arg1, arg2); + move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); + } + #else ALWAYS_INLINE void setupArguments(FPRReg arg1) { @@ -575,6 +596,24 @@ public: assembler().vmov(GPRInfo::argumentGPR3, GPRInfo::nonArgGPR0, arg3); poke(GPRInfo::nonArgGPR0); } + + ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, FPRReg arg2, GPRReg arg3) + { + poke(arg3, POKE_ARGUMENT_OFFSET); + move(arg1, GPRInfo::argumentGPR1); + assembler().vmov(GPRInfo::argumentGPR2, GPRInfo::argumentGPR3, arg2); + move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); + } + + ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImm32 arg3, FPRReg arg4) + { + setupStubArguments(arg1, arg2); + move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); + move(arg3, GPRInfo::argumentGPR3); + assembler().vmov(GPRInfo::nonArgGPR0, GPRInfo::nonArgGPR1, arg4); + poke(GPRInfo::nonArgGPR0, POKE_ARGUMENT_OFFSET); + poke(GPRInfo::nonArgGPR1, POKE_ARGUMENT_OFFSET + 1); + } #endif // CPU(ARM_HARDFP) #elif CPU(MIPS) ALWAYS_INLINE void setupArguments(FPRReg arg1) @@ -609,6 +648,16 @@ public: move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); poke(arg3, 4); } + + ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, FPRReg arg2, GPRReg arg3) + { + setupArgumentsWithExecState(arg2, arg3); + } + + ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImm32 arg3, FPRReg arg4) + { + setupArgumentsWithExecState(arg1, arg2, arg4); + } #elif CPU(SH4) ALWAYS_INLINE void setupArguments(FPRReg arg1) { @@ -868,12 +917,6 @@ public: // exactly 4 argument registers, e.g. ARMv7. #if NUMBER_OF_ARGUMENT_REGISTERS == 4 -#if CPU(MIPS) -#define POKE_ARGUMENT_OFFSET 4 -#else -#define POKE_ARGUMENT_OFFSET 0 -#endif - ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4) { poke(arg4, POKE_ARGUMENT_OFFSET); diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h index f4e80996e..648b6951f 100644 --- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h +++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h @@ -1033,12 +1033,6 @@ public: return appendCallWithExceptionCheck(operation); } - JITCompiler::Call callOperation(V_DFGOperation_EOZD operation, GPRReg arg1, GPRReg arg2, FPRReg arg3) - { - m_jit.setupArgumentsWithExecState(arg1, arg2, arg3); - return appendCallWithExceptionCheck(operation); - } - JITCompiler::Call callOperation(V_DFGOperation_W operation, WatchpointSet* watchpointSet) { m_jit.setupArguments(TrustedImmPtr(watchpointSet)); @@ -1264,6 +1258,12 @@ public: return appendCallWithExceptionCheckSetResult(operation, result); } + JITCompiler::Call callOperation(V_DFGOperation_EOZD operation, GPRReg arg1, GPRReg arg2, FPRReg arg3) + { + m_jit.setupArgumentsWithExecState(arg1, arg2, arg3); + return appendCallWithExceptionCheck(operation); + } + JITCompiler::Call callOperation(V_DFGOperation_EJPP operation, GPRReg arg1, GPRReg arg2, void* pointer) { m_jit.setupArgumentsWithExecState(arg1, arg2, TrustedImmPtr(pointer)); @@ -1411,7 +1411,7 @@ public: } JITCompiler::Call callOperation(J_DFGOperation_EDA operation, GPRReg resultTag, GPRReg resultPayload, FPRReg arg1, GPRReg arg2) { - m_jit.setupArgumentsWithExecState(arg1, arg2); + m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1, arg2); return appendCallWithExceptionCheckSetResult(operation, resultPayload, resultTag); } JITCompiler::Call callOperation(J_DFGOperation_EJA operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2) @@ -1511,6 +1511,12 @@ public: return appendCallWithExceptionCheckSetResult(operation, resultPayload, resultTag); } + JITCompiler::Call callOperation(V_DFGOperation_EOZD operation, GPRReg arg1, GPRReg arg2, FPRReg arg3) + { + m_jit.setupArgumentsWithExecState(arg1, arg2, EABI_32BIT_DUMMY_ARG arg3); + return appendCallWithExceptionCheck(operation); + } + JITCompiler::Call callOperation(V_DFGOperation_EJPP operation, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2, void* pointer) { m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, arg2, TrustedImmPtr(pointer)); diff --git a/Source/JavaScriptCore/heap/HeapStatistics.cpp b/Source/JavaScriptCore/heap/HeapStatistics.cpp index 55e3e9d9d..b63c316ce 100644 --- a/Source/JavaScriptCore/heap/HeapStatistics.cpp +++ b/Source/JavaScriptCore/heap/HeapStatistics.cpp @@ -232,22 +232,23 @@ void HeapStatistics::showObjectStatistics(Heap* heap) dataLogF("\n=== Heap Statistics: ===\n"); dataLogF("size: %ldkB\n", static_cast<long>(heap->m_sizeAfterLastCollect / KB)); dataLogF("capacity: %ldkB\n", static_cast<long>(heap->capacity() / KB)); - dataLogF("pause time: %lfms\n\n", heap->m_lastGCLength); + dataLogF("pause time: %lfs\n\n", heap->m_lastGCLength); StorageStatistics storageStatistics; heap->m_objectSpace.forEachLiveCell(storageStatistics); - dataLogF("wasted .property storage: %ldkB (%ld%%)\n", - static_cast<long>( - (storageStatistics.storageCapacity() - storageStatistics.storageSize()) / KB), - static_cast<long>( - (storageStatistics.storageCapacity() - storageStatistics.storageSize()) * 100 - / storageStatistics.storageCapacity())); - dataLogF("objects with out-of-line .property storage: %ld (%ld%%)\n", - static_cast<long>( - storageStatistics.objectWithOutOfLineStorageCount()), - static_cast<long>( - storageStatistics.objectWithOutOfLineStorageCount() * 100 - / storageStatistics.objectCount())); + long wastedPropertyStorageBytes = 0; + long wastedPropertyStoragePercent = 0; + long objectWithOutOfLineStorageCount = 0; + long objectsWithOutOfLineStoragePercent = 0; + if ((storageStatistics.storageCapacity() > 0) && (storageStatistics.objectCount() > 0)) { + wastedPropertyStorageBytes = static_cast<long>((storageStatistics.storageCapacity() - storageStatistics.storageSize()) / KB); + wastedPropertyStoragePercent = static_cast<long>( + (storageStatistics.storageCapacity() - storageStatistics.storageSize()) * 100 / storageStatistics.storageCapacity()); + objectWithOutOfLineStorageCount = static_cast<long>(storageStatistics.objectWithOutOfLineStorageCount()); + objectsWithOutOfLineStoragePercent = objectWithOutOfLineStorageCount * 100 / storageStatistics.objectCount(); + } + dataLogF("wasted .property storage: %ldkB (%ld%%)\n", wastedPropertyStorageBytes, wastedPropertyStoragePercent); + dataLogF("objects with out-of-line .property storage: %ld (%ld%%)\n", objectWithOutOfLineStorageCount, objectsWithOutOfLineStoragePercent); } } // namespace JSC diff --git a/Source/JavaScriptCore/jit/JITStubs.h b/Source/JavaScriptCore/jit/JITStubs.h index 51873507e..2659d6899 100644 --- a/Source/JavaScriptCore/jit/JITStubs.h +++ b/Source/JavaScriptCore/jit/JITStubs.h @@ -140,7 +140,7 @@ struct JITStackFrame { ReturnAddressPtr* returnAddressSlot() { return reinterpret_cast<ReturnAddressPtr*>(this) - 1; } }; #elif CPU(X86) -#if COMPILER(MSVC) || (OS(WINDOWS) && COMPILER(GCC)) +#if COMPILER(MSVC) || (OS(WINDOWS) && COMPILER(GCC)) || OS(QNX) #pragma pack(push) #pragma pack(4) #endif // COMPILER(MSVC) || (OS(WINDOWS) && COMPILER(GCC)) diff --git a/Source/JavaScriptCore/offlineasm/mips.rb b/Source/JavaScriptCore/offlineasm/mips.rb index c0adfd029..08fd02662 100644 --- a/Source/JavaScriptCore/offlineasm/mips.rb +++ b/Source/JavaScriptCore/offlineasm/mips.rb @@ -231,9 +231,10 @@ def lowerMIPSCondBranch(list, condOp, node) [node.operands[0], MIPS_ZERO_REG, node.operands[-1]], node.annotation) elsif node.operands.size == 3 + tl = condOp[-1, 1] tmp = Tmp.new(node.codeOrigin, :gpr) list << Instruction.new(node.codeOrigin, - "andi", + "and" + tl, [node.operands[0], node.operands[1], tmp], node.annotation) list << Instruction.new(node.codeOrigin, @@ -503,6 +504,10 @@ def mipsLowerMisplacedAddresses(list) newList << Instruction.new(node.codeOrigin, node.opcode, riscAsRegisters(newList, [], node.operands, "b")) + when "andb" + newList << Instruction.new(node.codeOrigin, + "andi", + riscAsRegisters(newList, [], node.operands, "b")) when /^(bz|bnz|bs|bo)/ tl = $~.post_match == "" ? "i" : $~.post_match newList << Instruction.new(node.codeOrigin, diff --git a/Source/ThirdParty/ANGLE/Target.pri b/Source/ThirdParty/ANGLE/Target.pri index 52fef9e61..dc08a1550 100644 --- a/Source/ThirdParty/ANGLE/Target.pri +++ b/Source/ThirdParty/ANGLE/Target.pri @@ -147,9 +147,7 @@ else: SOURCES += src/compiler/ossource_posix.cpp # Make sure the derived sources are built include(DerivedSources.pri) -*g++* { - QMAKE_CXXFLAGS += -Wno-unused-variable -Wno-missing-noreturn -Wno-unused-function -Wno-reorder -Wno-error -Wno-unknown-pragmas -Wno-undef -} +CONFIG += compiling_thirdparty_code # We do not need anything from Qt QT = diff --git a/Source/ThirdParty/leveldb/Target.pri b/Source/ThirdParty/leveldb/Target.pri index e071b6d5c..6ea57d97c 100644 --- a/Source/ThirdParty/leveldb/Target.pri +++ b/Source/ThirdParty/leveldb/Target.pri @@ -108,11 +108,6 @@ mac: DEFINES += OS_MACOSX linux: DEFINES += OS_LINUX freebsd*: DEFINES += OS_FREEBSD -gcc { - greaterThan(QT_GCC_MAJOR_VERSION, 4)|greaterThan(QT_GCC_MINOR_VERSION, 5) { - QMAKE_CXXFLAGS_WARN_ON += -Wno-error=unused-but-set-variable - QMAKE_CXXFLAGS += -Wno-error=unused-but-set-variable - } -} +CONFIG += compiling_thirdparty_code QT += core diff --git a/Source/WTF/wtf/Compiler.h b/Source/WTF/wtf/Compiler.h index 493894c09..ead844f9e 100644 --- a/Source/WTF/wtf/Compiler.h +++ b/Source/WTF/wtf/Compiler.h @@ -62,11 +62,6 @@ #define WTF_COMPILER_SUPPORTS_CXX_STRONG_ENUMS __has_feature(cxx_strong_enums) #define WTF_COMPILER_SUPPORTS_CXX_REFERENCE_QUALIFIED_FUNCTIONS __has_feature(cxx_reference_qualified_functions) -#if defined(__APPLE__) && COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES) && defined(_GLIBCXX_VERSION) && (_GLIBCXX_VERSION <= 20070719) -/* WTF expects the standard library to have std::move when the compiler supports rvalue references, but some old versions of stdc++11 shipped by Apple does not. */ -#define WTF_COMPILER_SUPPORTS_CXX_RVALUE_REFERENCES 0 -#endif - #endif #ifndef CLANG_PRAGMA @@ -185,6 +180,20 @@ #define WTF_COMPILER_SUPPORTS_EABI 1 #endif +/* Library C++11 support */ +#if COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES) +/* WTF expects the standard library to have std::move when the compiler supports rvalue references */ +#if defined(__APPLE__) && defined(_GLIBCXX_VERSION) && (_GLIBCXX_VERSION <= 20070719) +/* Some old versions of stdc++11 shipped by Apple does not have std::move. */ +#undef WTF_COMPILER_SUPPORTS_CXX_RVALUE_REFERENCES +#define WTF_COMPILER_SUPPORTS_CXX_RVALUE_REFERENCES 0 +#elif defined(__QNXNTO__) && (defined(_YVALS) || defined(_LIBCPP_VER)) +/* libcpp (Dinkumware) does not support std::move */ +#undef WTF_COMPILER_SUPPORTS_CXX_RVALUE_REFERENCES +#define WTF_COMPILER_SUPPORTS_CXX_RVALUE_REFERENCES 0 +#endif +#endif + /* ==== Compiler features ==== */ /* ALWAYS_INLINE */ diff --git a/Source/WTF/wtf/MathExtras.h b/Source/WTF/wtf/MathExtras.h index 1bdbc6108..859722386 100644 --- a/Source/WTF/wtf/MathExtras.h +++ b/Source/WTF/wtf/MathExtras.h @@ -148,8 +148,8 @@ inline double trunc(double num) { return num > 0 ? floor(num) : ceil(num); } #endif -#if COMPILER(GCC) && OS(QNX) -// The stdlib on QNX doesn't contain long abs(long). See PR #104666. +#if COMPILER(GCC) && OS(QNX) && _CPPLIB_VER < 640 +// The stdlib on QNX < 6.6 doesn't contain long abs(long). See PR #104666. inline long long abs(long num) { return labs(num); } #endif diff --git a/Source/WTF/wtf/Platform.h b/Source/WTF/wtf/Platform.h index 1327ef54c..1339642b4 100644 --- a/Source/WTF/wtf/Platform.h +++ b/Source/WTF/wtf/Platform.h @@ -694,11 +694,6 @@ #define HAVE_VIRTUALALLOC 1 #endif -#if OS(QNX) -#define HAVE_MADV_FREE_REUSE 1 -#define HAVE_MADV_FREE 1 -#endif - /* ENABLE macro defaults */ /* FIXME: move out all ENABLE() defines from here to FeatureDefines.h */ diff --git a/Source/WebCore/bridge/qt/qt_runtime.cpp b/Source/WebCore/bridge/qt/qt_runtime.cpp index e6a3e6b9f..58259ff3e 100644 --- a/Source/WebCore/bridge/qt/qt_runtime.cpp +++ b/Source/WebCore/bridge/qt/qt_runtime.cpp @@ -638,7 +638,7 @@ QVariant convertValueToQVariant(JSContextRef context, JSValueRef value, QMetaTyp *distance = 1; return QVariant(); } - if (type == Object) { + if (JSValueIsObject(context, value)) { // Since we haven't really visited this object yet, we remove it visitedObjects->remove(object); } diff --git a/Source/WebCore/platform/graphics/Font.cpp b/Source/WebCore/platform/graphics/Font.cpp index f58bcc843..4f6570f8a 100644 --- a/Source/WebCore/platform/graphics/Font.cpp +++ b/Source/WebCore/platform/graphics/Font.cpp @@ -329,7 +329,7 @@ float Font::width(const TextRun& run, int& charsConsumed, String& glyphName) con return width(run); } -#if !PLATFORM(MAC) +#if !PLATFORM(MAC) && !PLATFORM(QT) PassOwnPtr<TextLayout> Font::createLayout(RenderText*, float, bool) const { return nullptr; diff --git a/Source/WebCore/platform/graphics/Font.h b/Source/WebCore/platform/graphics/Font.h index 08e0ad49a..f2625871f 100644 --- a/Source/WebCore/platform/graphics/Font.h +++ b/Source/WebCore/platform/graphics/Font.h @@ -212,6 +212,7 @@ private: friend struct WidthIterator; friend class SVGTextRunRenderingContext; + friend class TextLayout; public: // Useful for debugging the different font rendering code paths. diff --git a/Source/WebCore/platform/graphics/WidthIterator.cpp b/Source/WebCore/platform/graphics/WidthIterator.cpp index 48a59a27c..8e83544b7 100644 --- a/Source/WebCore/platform/graphics/WidthIterator.cpp +++ b/Source/WebCore/platform/graphics/WidthIterator.cpp @@ -265,7 +265,7 @@ inline unsigned WidthIterator::advanceInternal(TextIterator& textIterator, Glyph m_isAfterExpansion = false; } - if (shouldApplyFontTransforms() && glyphBuffer && Font::treatAsSpace(character)) + if (shouldApplyFontTransforms() && glyphBuffer && (Font::treatAsSpace(character) || Font::treatAsZeroWidthSpace(character))) charactersTreatedAsSpace.append(make_pair(glyphBuffer->size(), OriginalAdvancesForCharacterTreatedAsSpace(character == ' ', glyphBuffer->size() ? glyphBuffer->advanceAt(glyphBuffer->size() - 1).width() : 0, width))); diff --git a/Source/WebCore/platform/graphics/qt/FontQt.cpp b/Source/WebCore/platform/graphics/qt/FontQt.cpp index 324fdf05f..3eead7e70 100644 --- a/Source/WebCore/platform/graphics/qt/FontQt.cpp +++ b/Source/WebCore/platform/graphics/qt/FontQt.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) + Copyright (C) 2012, 2014 Digia Plc. and/or its subsidiary(-ies) Copyright (C) 2008, 2010 Holger Hans Peter Freyther Copyright (C) 2009 Dirk Schulze <krit@webkit.org> @@ -31,6 +31,8 @@ #include "GraphicsContext.h" #include "NotImplemented.h" #include "Pattern.h" +#include "RenderBlock.h" +#include "RenderText.h" #include "ShadowBlur.h" #include "TextRun.h" @@ -62,6 +64,7 @@ static QTextLine setupLayout(QTextLayout* layout, const TextRun& style) int flags = style.rtl() ? Qt::TextForceRightToLeft : Qt::TextForceLeftToRight; if (style.expansion()) flags |= Qt::TextJustificationForced; + layout->setCacheEnabled(true); layout->setFlags(flags); layout->beginLayout(); QTextLine line = layout->createLine(); @@ -168,6 +171,67 @@ static void drawQtGlyphRun(GraphicsContext* context, const QGlyphRun& qtGlyphRun } } +class TextLayout { +public: + static bool isNeeded(RenderText* text, const Font& font) + { + TextRun run = RenderBlock::constructTextRun(text, font, text, text->style()); + return font.codePath(run) == Font::Complex; + } + + TextLayout(RenderText* text, const Font& font, float xPos) + { + const TextRun run(constructTextRun(text, font, xPos)); + const String sanitized = Font::normalizeSpaces(run.characters16(), run.length()); + const QString string(sanitized); + m_layout.setText(string); + m_layout.setRawFont(font.rawFont()); + font.initFormatForTextLayout(&m_layout, run); + m_line = setupLayout(&m_layout, run); + } + + float width(unsigned from, unsigned len, HashSet<const SimpleFontData*>* fallbackFonts) + { + Q_UNUSED(fallbackFonts); + float x1 = m_line.cursorToX(from); + float x2 = m_line.cursorToX(from + len); + float width = qAbs(x2 - x1); + + return width; + } + +private: + static TextRun constructTextRun(RenderText* text, const Font& font, float xPos) + { + TextRun run = RenderBlock::constructTextRun(text, font, text, text->style()); + run.setCharactersLength(text->textLength()); + ASSERT(run.charactersLength() >= run.length()); + + run.setXPos(xPos); + return run; + } + + QTextLayout m_layout; + QTextLine m_line; +}; + +PassOwnPtr<TextLayout> Font::createLayout(RenderText* text, float xPos, bool collapseWhiteSpace) const +{ + if (!collapseWhiteSpace || !TextLayout::isNeeded(text, *this)) + return PassOwnPtr<TextLayout>(); + return adoptPtr(new TextLayout(text, *this, xPos)); +} + +void Font::deleteLayout(TextLayout* layout) +{ + delete layout; +} + +float Font::width(TextLayout& layout, unsigned from, unsigned len, HashSet<const SimpleFontData*>* fallbackFonts) +{ + return layout.width(from, len, fallbackFonts); +} + void Font::drawComplexText(GraphicsContext* ctx, const TextRun& run, const FloatPoint& point, int from, int to) const { String sanitized = Font::normalizeSpaces(run.characters16(), run.length()); diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp index 1e57fd386..9e455a82a 100644 --- a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp +++ b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp @@ -46,6 +46,10 @@ #if USE(3D_GRAPHICS) +QT_BEGIN_NAMESPACE +extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha); +QT_END_NAMESPACE + namespace WebCore { #if !defined(GLchar) @@ -216,11 +220,6 @@ GraphicsContext3DPrivate::~GraphicsContext3DPrivate() m_surfaceOwner = 0; } -static inline quint32 swapBgrToRgb(quint32 pixel) -{ - return (((pixel << 16) | (pixel >> 16)) & 0x00ff00ff) | (pixel & 0xff00ff00); -} - #if USE(ACCELERATED_COMPOSITING) void GraphicsContext3DPrivate::paintToTextureMapper(TextureMapper* textureMapper, const FloatRect& targetRect, const TransformationMatrix& matrix, float opacity) { @@ -235,6 +234,7 @@ void GraphicsContext3DPrivate::paintToTextureMapper(TextureMapper* textureMapper return; } + // Alternatively read pixels to a memory buffer. GraphicsContext* context = textureMapper->graphicsContext(); QPainter* painter = context->platformContext(); painter->save(); @@ -244,37 +244,12 @@ void GraphicsContext3DPrivate::paintToTextureMapper(TextureMapper* textureMapper const int height = m_context->m_currentHeight; const int width = m_context->m_currentWidth; - // Alternatively read pixels to a memory buffer. - QImage offscreenImage(width, height, QImage::Format_ARGB32); - quint32* imagePixels = reinterpret_cast<quint32*>(offscreenImage.bits()); - painter->beginNativePainting(); makeCurrentIfNeeded(); glBindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_context->m_fbo); - glReadPixels(/* x */ 0, /* y */ 0, width, height, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, imagePixels); + QImage offscreenImage = qt_gl_read_framebuffer(QSize(width, height), true, true); glBindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_context->m_state.boundFBO); - // OpenGL gives us ABGR on 32 bits, and with the origin at the bottom left - // We need RGB32 or ARGB32_PM, with the origin at the top left. - quint32* pixelsSrc = imagePixels; - const int halfHeight = height / 2; - for (int row = 0; row < halfHeight; ++row) { - const int targetIdx = (height - 1 - row) * width; - quint32* pixelsDst = imagePixels + targetIdx; - for (int column = 0; column < width; ++column) { - quint32 tempPixel = *pixelsSrc; - *pixelsSrc = swapBgrToRgb(*pixelsDst); - *pixelsDst = swapBgrToRgb(tempPixel); - ++pixelsSrc; - ++pixelsDst; - } - } - if (static_cast<int>(height) % 2) { - for (int column = 0; column < width; ++column) { - *pixelsSrc = swapBgrToRgb(*pixelsSrc); - ++pixelsSrc; - } - } painter->endNativePainting(); painter->drawImage(targetRect, offscreenImage); diff --git a/Source/WebCore/platform/qt/PlatformKeyboardEventQt.cpp b/Source/WebCore/platform/qt/PlatformKeyboardEventQt.cpp index 67b85ceef..f6c4df777 100644 --- a/Source/WebCore/platform/qt/PlatformKeyboardEventQt.cpp +++ b/Source/WebCore/platform/qt/PlatformKeyboardEventQt.cpp @@ -140,7 +140,7 @@ String keyIdentifierForQtKeyCode(int keyCode) case Qt::Key_Zoom: return ASCIILiteral("Zoom"); case Qt::Key_Comma: - return ASCIILiteral("Seperator"); + return ASCIILiteral("Separator"); case Qt::Key_Plus: return ASCIILiteral("Add"); case Qt::Key_Minus: diff --git a/Source/WebCore/plugins/PluginQuirkSet.h b/Source/WebCore/plugins/PluginQuirkSet.h index 7e296dc25..37068c9c1 100644 --- a/Source/WebCore/plugins/PluginQuirkSet.h +++ b/Source/WebCore/plugins/PluginQuirkSet.h @@ -49,7 +49,8 @@ namespace WebCore { PluginQuirkRequiresDefaultScreenDepth = 1 << 13, PluginQuirkDontCallSetWindowMoreThanOnce = 1 << 14, PluginQuirkIgnoreRightClickInWindowlessMode = 1 << 15, - PluginQuirkWantsChromeUserAgent = 1 << 16 + PluginQuirkWantsChromeUserAgent = 1 << 16, + PluginQuirkNeedsSetWindowTwice = 1 << 17 }; class PluginQuirkSet { diff --git a/Source/WebCore/plugins/PluginStream.cpp b/Source/WebCore/plugins/PluginStream.cpp index b03436166..8fb5d6e34 100644 --- a/Source/WebCore/plugins/PluginStream.cpp +++ b/Source/WebCore/plugins/PluginStream.cpp @@ -307,8 +307,12 @@ void PluginStream::destroyStream() if (!m_loadManually && m_client) m_client->streamDidFinishLoading(this); - if (!m_path.isNull()) - deleteFile(m_path); + if (!m_path.isNull()) { + if (m_client) + m_client->streamDidSaveTempFile(m_path); + else + deleteFile(m_path); + } } void PluginStream::delayDeliveryTimerFired(Timer<PluginStream>* timer) diff --git a/Source/WebCore/plugins/PluginStream.h b/Source/WebCore/plugins/PluginStream.h index 55d1702bf..52606b8be 100644 --- a/Source/WebCore/plugins/PluginStream.h +++ b/Source/WebCore/plugins/PluginStream.h @@ -52,6 +52,7 @@ namespace WebCore { class PluginStreamClient { public: virtual ~PluginStreamClient() {} + virtual void streamDidSaveTempFile(const String &) {} virtual void streamDidFinishLoading(PluginStream*) {} }; diff --git a/Source/WebCore/plugins/PluginView.cpp b/Source/WebCore/plugins/PluginView.cpp index 74fd5d79a..237cda701 100644 --- a/Source/WebCore/plugins/PluginView.cpp +++ b/Source/WebCore/plugins/PluginView.cpp @@ -383,6 +383,11 @@ void PluginView::stop() LOG_NPERROR(npErr); PluginView::setCurrentPluginView(0); + Vector<String>::iterator e = m_streamTempFilePaths.end(); + for (Vector<String>::iterator it = m_streamTempFilePaths.begin(); it != e; ++it) + deleteFile(*it); + m_streamTempFilePaths.clear(); + #if ENABLE(NETSCAPE_PLUGIN_API) if (savedData) { // TODO: Actually save this data instead of just discarding it diff --git a/Source/WebCore/plugins/PluginView.h b/Source/WebCore/plugins/PluginView.h index a81bd0ad4..0fa2436d4 100644 --- a/Source/WebCore/plugins/PluginView.h +++ b/Source/WebCore/plugins/PluginView.h @@ -194,6 +194,7 @@ namespace WebCore { void privateBrowsingStateChanged(bool); void disconnectStream(PluginStream*); + void streamDidSaveTempFile(const String &path) { m_streamTempFilePaths.append(path); } void streamDidFinishLoading(PluginStream* stream) { disconnectStream(stream); } // Widget functions @@ -364,6 +365,7 @@ namespace WebCore { HashSet<RefPtr<PluginStream> > m_streams; Vector<OwnPtr<PluginRequest> > m_requests; + Vector<String> m_streamTempFilePaths; bool m_isWindowed; bool m_isTransparent; diff --git a/Source/WebCore/plugins/win/PluginPackageWin.cpp b/Source/WebCore/plugins/win/PluginPackageWin.cpp index ab8459f75..988fbfeef 100644 --- a/Source/WebCore/plugins/win/PluginPackageWin.cpp +++ b/Source/WebCore/plugins/win/PluginPackageWin.cpp @@ -162,6 +162,12 @@ void PluginPackage::determineQuirks(const String& mimeType) if (compareFileVersion(lastKnownUnloadableRealPlayerVersion) > 0) m_quirks.add(PluginQuirkDontUnloadPlugin); } + + // The Adobe Acrobat plugin only displays the pdf correctly on the first load if set window is + // called on it twice in a row. + if (name() == "Adobe Acrobat") + m_quirks.add(PluginQuirkNeedsSetWindowTwice); + } bool PluginPackage::fetchInfo() diff --git a/Source/WebCore/plugins/win/PluginViewWin.cpp b/Source/WebCore/plugins/win/PluginViewWin.cpp index fd03ac7fa..3fa897db8 100644 --- a/Source/WebCore/plugins/win/PluginViewWin.cpp +++ b/Source/WebCore/plugins/win/PluginViewWin.cpp @@ -865,6 +865,8 @@ void PluginView::setNPWindowRect(const IntRect& rect) JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM()); setCallingPlugin(true); m_plugin->pluginFuncs()->setwindow(m_instance, &m_npWindow); + if (m_plugin->quirks().contains(PluginQuirkNeedsSetWindowTwice)) + m_plugin->pluginFuncs()->setwindow(m_instance, &m_npWindow); setCallingPlugin(false); m_haveCalledSetWindow = true; diff --git a/Source/WebCore/rendering/RenderLayerBacking.cpp b/Source/WebCore/rendering/RenderLayerBacking.cpp index 143c7d32c..acfc67776 100644 --- a/Source/WebCore/rendering/RenderLayerBacking.cpp +++ b/Source/WebCore/rendering/RenderLayerBacking.cpp @@ -1925,35 +1925,32 @@ void RenderLayerBacking::setContentsNeedDisplayInRect(const IntRect& r) { ASSERT(!paintsIntoCompositedAncestor()); + LayoutRect layerDirtyRect(r); + layerDirtyRect.move(m_subpixelAccumulation); if (m_graphicsLayer && m_graphicsLayer->drawsContent()) { - IntRect layerDirtyRect = r; layerDirtyRect.move(-m_graphicsLayer->offsetFromRenderer()); - m_graphicsLayer->setNeedsDisplayInRect(layerDirtyRect); + m_graphicsLayer->setNeedsDisplayInRect(enclosingIntRect(layerDirtyRect)); } if (m_foregroundLayer && m_foregroundLayer->drawsContent()) { - IntRect layerDirtyRect = r; layerDirtyRect.move(-m_foregroundLayer->offsetFromRenderer()); - m_foregroundLayer->setNeedsDisplayInRect(layerDirtyRect); + m_foregroundLayer->setNeedsDisplayInRect(enclosingIntRect(layerDirtyRect)); } // FIXME: need to split out repaints for the background. if (m_backgroundLayer && m_backgroundLayer->drawsContent()) { - IntRect layerDirtyRect = r; layerDirtyRect.move(-m_backgroundLayer->offsetFromRenderer()); - m_backgroundLayer->setNeedsDisplayInRect(layerDirtyRect); + m_backgroundLayer->setNeedsDisplayInRect(enclosingIntRect(layerDirtyRect)); } if (m_maskLayer && m_maskLayer->drawsContent()) { - IntRect layerDirtyRect = r; layerDirtyRect.move(-m_maskLayer->offsetFromRenderer()); - m_maskLayer->setNeedsDisplayInRect(layerDirtyRect); + m_maskLayer->setNeedsDisplayInRect(enclosingIntRect(layerDirtyRect)); } if (m_scrollingContentsLayer && m_scrollingContentsLayer->drawsContent()) { - IntRect layerDirtyRect = r; layerDirtyRect.move(-m_scrollingContentsLayer->offsetFromRenderer()); - m_scrollingContentsLayer->setNeedsDisplayInRect(layerDirtyRect); + m_scrollingContentsLayer->setNeedsDisplayInRect(enclosingIntRect(layerDirtyRect)); } } diff --git a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp index 13fbe88d3..ca0f7d371 100644 --- a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp +++ b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp @@ -258,8 +258,10 @@ void QWebPageAdapter::initializeWebCorePage() m_deviceMotionClient = new DeviceMotionClientQt; } #endif - WebCore::provideDeviceOrientationTo(page, m_deviceOrientationClient); - WebCore::provideDeviceMotionTo(page, m_deviceMotionClient); + if (m_deviceOrientationClient) + WebCore::provideDeviceOrientationTo(page, m_deviceOrientationClient); + if (m_deviceMotionClient) + WebCore::provideDeviceMotionTo(page, m_deviceMotionClient); #endif // By default each page is put into their own unique page group, which affects popup windows diff --git a/Source/WebKit/qt/WidgetSupport/QWidgetPluginImpl.cpp b/Source/WebKit/qt/WidgetSupport/QWidgetPluginImpl.cpp index 2beabf1d0..b34e1fd21 100644 --- a/Source/WebKit/qt/WidgetSupport/QWidgetPluginImpl.cpp +++ b/Source/WebKit/qt/WidgetSupport/QWidgetPluginImpl.cpp @@ -54,7 +54,9 @@ void QWidgetPluginImpl::setVisible(bool visible) void QWidgetPluginImpl::setStyleSheet(const QString &stylesheet) { +#ifndef QT_NO_STYLE_STYLESHEET m_widget->setStyleSheet(stylesheet); +#endif } void QWidgetPluginImpl::setWidgetParent(QObject *parent) diff --git a/Source/WebKit/qt/docs/qtwebkit-bridge.qdoc b/Source/WebKit/qt/docs/qtwebkit-bridge.qdoc index c7b3c27e7..5db9e931c 100644 --- a/Source/WebKit/qt/docs/qtwebkit-bridge.qdoc +++ b/Source/WebKit/qt/docs/qtwebkit-bridge.qdoc @@ -360,8 +360,8 @@ \snippet webkitsnippets/qtwebkit_bridge_snippets.cpp 1 The JavaScript environment can then use the pixmap from Qt and display it inside the HTML environment, - by assigning it to an existing \c{<img>} element with \c{assignToHTMLImageElement()}. It can also use the \c{toDataURL()} function, - which allows using the pixmap as the \c{src} attribute of an image or as a \c{background-image} URL. Note that the \c{toDataURL()} + by assigning it to an existing \c{<img>} element with \c{assignToHTMLImageElement()}. It can also use the \c{toDataUrl()} function, + which allows using the pixmap as the \c{src} attribute of an image or as a \c{background-image} URL. Note that the \c{toDataUrl()} function is costly and should be used with caution. It can also use the \c{toImageData()} function to convert the pixmap to a JavaScript \c{ImageData} object. diff --git a/Source/WebKit/qt/docs/webkitsnippets/qtwebkit_bridge_snippets.cpp b/Source/WebKit/qt/docs/webkitsnippets/qtwebkit_bridge_snippets.cpp index 27018af33..14331d195 100644 --- a/Source/WebKit/qt/docs/webkitsnippets/qtwebkit_bridge_snippets.cpp +++ b/Source/WebKit/qt/docs/webkitsnippets/qtwebkit_bridge_snippets.cpp @@ -13,7 +13,7 @@ void wrapInFunction() { width: ..., height: ..., - toDataURL: function() { ... }, + toDataUrl: function() { ... }, assignToHTMLImageElement: function(element) { ... } toImageData: function() { ... } } diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp index 86b8cb4d4..e260bb56f 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp @@ -527,6 +527,7 @@ void QQuickWebViewPrivate::didChangeBackForwardList(WKPageRef, WKBackForwardList void QQuickWebViewPrivate::setTransparentBackground(bool enable) { webPageProxy->setDrawsTransparentBackground(enable); + webPageProxy->setDrawsBackground(!enable); } bool QQuickWebViewPrivate::transparentBackground() const diff --git a/Tools/qmake/mkspecs/features/default_post.prf b/Tools/qmake/mkspecs/features/default_post.prf index 79b64547a..e07d5e47d 100644 --- a/Tools/qmake/mkspecs/features/default_post.prf +++ b/Tools/qmake/mkspecs/features/default_post.prf @@ -91,7 +91,7 @@ contains(TEMPLATE, derived) { # on Linux and Mac OS X. On Windows we do have a convenience copy in # Qt5's top-level repository, so let's add that to the PATH if we can # find it. - win32 { + equals(QMAKE_HOST.os, Windows) { GNUTOOLS_DIR=$$[QT_HOST_DATA]/../gnuwin32/bin exists($$GNUTOOLS_DIR/gperf.exe) { GNUTOOLS = "(set $$escape_expand(\\\")PATH=$$toSystemPath($$GNUTOOLS_DIR);%PATH%$$escape_expand(\\\"))" diff --git a/Tools/qmake/mkspecs/features/default_pre.prf b/Tools/qmake/mkspecs/features/default_pre.prf index 69f039387..06f10dec5 100644 --- a/Tools/qmake/mkspecs/features/default_pre.prf +++ b/Tools/qmake/mkspecs/features/default_pre.prf @@ -106,7 +106,7 @@ if(win32|mac):!macx-xcode { # A newer version of flex is required on Windows. At the moment the only # one that appears to provide binaries and is not cygwin is winflex. FLEX = flex -win32: FLEX = win_flex +equals(QMAKE_HOST.os, Windows): FLEX = win_flex BIN_EXTENSION = win32: BIN_EXTENSION = .exe diff --git a/Tools/qmake/mkspecs/features/functions.prf b/Tools/qmake/mkspecs/features/functions.prf index 46293fe6a..7b3ab01c4 100644 --- a/Tools/qmake/mkspecs/features/functions.prf +++ b/Tools/qmake/mkspecs/features/functions.prf @@ -196,7 +196,7 @@ defineTest(haveQt) { } defineTest(programExistsInPath) { - win32: program = $${1}.exe + equals(QMAKE_HOST.os, Windows): program = $${1}.exe else: program = $$1 PATH = "$$(PATH)" diff --git a/Tools/qmake/mkspecs/features/unix/default_post.prf b/Tools/qmake/mkspecs/features/unix/default_post.prf index 5d92b548c..9c524065d 100644 --- a/Tools/qmake/mkspecs/features/unix/default_post.prf +++ b/Tools/qmake/mkspecs/features/unix/default_post.prf @@ -23,7 +23,6 @@ linux-g++*:isEqual(QT_ARCH,i386) { greaterThan(QT_GCC_MAJOR_VERSION, 4)|greaterThan(QT_GCC_MINOR_VERSION, 7) { QMAKE_CXXFLAGS_DEBUG += -fdebug-types-section QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += -fdebug-types-section - separate_debug_info: QMAKE_CXXFLAGS_RELEASE += -fdebug-types-section QMAKE_LFLAGS += -fdebug-types-section } else { # If DWARF-2 is desired -feliminate-dwarf2-dups can be used with GCC 4.7, @@ -32,10 +31,6 @@ linux-g++*:isEqual(QT_ARCH,i386) { QMAKE_CXXFLAGS_DEBUG += -gstabs QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO -= -g QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += -gstabs - separate_debug_info { - QMAKE_CXXFLAGS_RELEASE -= -g - QMAKE_CXXFLAGS_RELEASE += -gstabs - } } } @@ -66,7 +61,7 @@ linux-*g++* { contains(TEMPLATE, app): CONFIG += rpath -CONFIG(debug, debug|release)|force_debug_info|separate_debug_info { +CONFIG(debug, debug|release)|force_debug_info { # Make ld not cache the symbol tables of input files in memory to avoid memory exhaustion during the linking phase. !force_static_libs_as_shared:config_gnuld: QMAKE_LFLAGS += -Wl,--no-keep-memory } |