diff options
351 files changed, 9204 insertions, 4510 deletions
@@ -1,3 +1,68 @@ +2012-11-23 Krzysztof Czech <k.czech@samsung.com> + + [EFL] Platform support for Accessibility feature. + https://bugs.webkit.org/show_bug.cgi?id=100848 + + Reviewed by Gyuyoung Kim. + + Add support for ATK library. + + * Source/cmake/FindATK.cmake: Added. + * Source/cmake/OptionsEfl.cmake: + +2012-09-26 Gustavo Noronha Silva <gns@gnome.org> + + [GTK] Split SVG from WebCore to work-around make limitation + https://bugs.webkit.org/show_bug.cgi?id=97735 + + Reviewed by Carlos Garcia Campos. + + Add a new libtool convenience library, libWebCoreSVG.la, to work-around + make limitation when linking libWebCore. + + * GNUmakefile.am: variables for the new library. + +2012-11-22 Simon Hausmann <simon.hausmann@digia.com>, Pierre Rossi <pierre.rossi@digia.com> + + [Qt] Separate QWidget dependant code into separate WebKitWidgets static library + https://bugs.webkit.org/show_bug.cgi?id=102800 + + Reviewed by Tor Arne Vestbø. + + This patch separates code that needs to use QWidget related APIs in + WebKit/qt/WebCoreSupport and Api from code that doesn't. This means for + example FrameLoaderClientQt.cpp remains in the WebKit1 static library, + while qwebpage.cpp and qwebframe.cpp become part of the WebKitWidgets + static library. WebKit1 is compiled without QT += widgets and therefore + any widget related dependency has been moved "up" and out of WebKit1 into + the WebKitWidgets library. + + Between the code in WebKit.a and WebKitWidgets.a new adapters and + interfaces have been introduced, such as QWebPageAdapter and + QWebFrameAdapter. QWebPageAdapter, when used from WebKit1, is a way to + call out into the API layer, implemented by QWebPage (QWebPagePrivate). + The other way around if QWebPage wants to access WebCore or + WebCoreSupport related functionality, it will go through + QWebPageAdapater (as base class). The separation in the direction up + into the API layer is complete with this patch, no code in WebKit1 + depends on QtWidgets. The separation the other way around, code in the + API layer not using any WebCore types, is not complete yet. + + Some classes such as QWebSettings, QWebElement or + DumpRenderTreeSupportQt remain in WebKit1. While they are API layer, + they do not depend on widget related Qt APIs and they make much more + use of WebCore internal APIs and therefore are easier to keep in + WebKit1. + + In the future we plan to place a real shared library boundary between + WebKit1 and WebKitWidgets, by keeping the WebKit1 static library as + part of the QtWebKit shared library and by turning the WebKitWidgets + static library into a shared one. + + + * Source/api.pri: + * WebKit.pro: + 2012-11-21 Ryuan Choi <ryuan.choi@gmail.com> [EFL] Remove unnecessary definition, -DENABLE_SPELLCHECK=1 diff --git a/GNUmakefile.am b/GNUmakefile.am index f4cb3fd25..52384c6e3 100644 --- a/GNUmakefile.am +++ b/GNUmakefile.am @@ -73,9 +73,11 @@ javascriptcore_built_sources := javascriptcore_built_nosources := llint_nosources := offlineasm_nosources := -webcore_cppflags := webcore_platform_sources := webcore_modules_sources := +webcore_svg_built_sources := +webcore_svg_sources := +webcore_cppflags := webcore_sources := webcore_libadd := webcore_built_sources := @@ -309,6 +311,7 @@ BUILT_SOURCES += \ $(javascriptcore_built_nosources) \ $(webcore_built_sources) \ $(webcore_built_nosources) \ + $(webcore_svg_built_sources) \ $(webkitgtk_built_sources) \ $(webkitgtk_built_nosources) \ $(webkit2_built_sources) \ diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog index aa92eade1..6172c5531 100644 --- a/Source/JavaScriptCore/ChangeLog +++ b/Source/JavaScriptCore/ChangeLog @@ -1,3 +1,60 @@ +2012-11-23 Julien BRIANCEAU <jbrianceau@nds.com> + + [sh4] JavaScriptCore JIT build is broken since r130839 + Add missing implementation for sh4 arch. + https://bugs.webkit.org/show_bug.cgi?id=101479 + + Reviewed by Filip Pizlo. + + * assembler/MacroAssemblerSH4.h: + (JSC::MacroAssemblerSH4::load8Signed): + (MacroAssemblerSH4): + (JSC::MacroAssemblerSH4::load16Signed): + (JSC::MacroAssemblerSH4::store8): + (JSC::MacroAssemblerSH4::store16): + (JSC::MacroAssemblerSH4::moveDoubleToInts): + (JSC::MacroAssemblerSH4::moveIntsToDouble): + (JSC::MacroAssemblerSH4::loadFloat): + (JSC::MacroAssemblerSH4::loadDouble): + (JSC::MacroAssemblerSH4::storeFloat): + (JSC::MacroAssemblerSH4::storeDouble): + (JSC::MacroAssemblerSH4::addDouble): + (JSC::MacroAssemblerSH4::convertFloatToDouble): + (JSC::MacroAssemblerSH4::convertDoubleToFloat): + (JSC::MacroAssemblerSH4::urshift32): + * assembler/SH4Assembler.h: + (JSC::SH4Assembler::sublRegReg): + (JSC::SH4Assembler::subvlRegReg): + (JSC::SH4Assembler::floatfpulfrn): + (JSC::SH4Assembler::fldsfpul): + (JSC::SH4Assembler::fstsfpul): + (JSC::SH4Assembler::dcnvsd): + (SH4Assembler): + (JSC::SH4Assembler::movbRegMem): + (JSC::SH4Assembler::sizeOfConstantPool): + (JSC::SH4Assembler::linkJump): + (JSC::SH4Assembler::printInstr): + (JSC::SH4Assembler::printBlockInstr): + +2012-11-22 Balazs Kilvady <kilvadyb@homejinni.com> + + Fix the MIPS build after r135330 + https://bugs.webkit.org/show_bug.cgi?id=102872 + + Reviewed by Gavin Barraclough. + + Revert/replace functions added to MIPS port. + + * assembler/MIPSAssembler.h: + (JSC::MIPSAssembler::revertJumpToMove): + (MIPSAssembler): + (JSC::MIPSAssembler::replaceWithJump): + * assembler/MacroAssemblerMIPS.h: + (MacroAssemblerMIPS): + (JSC::MacroAssemblerMIPS::startOfBranchPtrWithPatchOnRegister): + (JSC::MacroAssemblerMIPS::revertJumpReplacementToBranchPtrWithPatch): + (JSC::MacroAssemblerMIPS::startOfPatchableBranchPtrWithPatchOnAddress): + 2012-11-21 Filip Pizlo <fpizlo@apple.com> Rename dataLog() and dataLogV() to dataLogF() and dataLogFV() diff --git a/Source/JavaScriptCore/assembler/MIPSAssembler.h b/Source/JavaScriptCore/assembler/MIPSAssembler.h index 30f172fb8..026f87e52 100644 --- a/Source/JavaScriptCore/assembler/MIPSAssembler.h +++ b/Source/JavaScriptCore/assembler/MIPSAssembler.h @@ -825,6 +825,31 @@ public: #endif } + static void revertJumpToMove(void* instructionStart, RegisterID rt, int imm) + { + MIPSWord* insn = static_cast<MIPSWord*>(instructionStart) + 1; + ASSERT((*insn & 0xfc000000) == 0x34000000); + *insn = (*insn & 0xfc1f0000) | (imm & 0xffff); + cacheFlush(insn, sizeof(MIPSWord)); + } + + static void replaceWithJump(void* instructionStart, void* to) + { + MIPSWord* instruction = reinterpret_cast<MIPSWord*>(instructionStart); + intptr_t jumpTo = reinterpret_cast<intptr_t>(to); + + // lui + instruction[0] = 0x3c000000 | (MIPSRegisters::t9 << OP_SH_RT) | ((jumpTo >> 16) & 0xffff); + // ori + instruction[1] = 0x34000000 | (MIPSRegisters::t9 << OP_SH_RT) | (MIPSRegisters::t9 << OP_SH_RS) | (jumpTo & 0xffff); + // jr + instruction[2] = 0x00000008 | (MIPSRegisters::t9 << OP_SH_RS); + // nop + instruction[3] = 0x0; + + cacheFlush(instruction, sizeof(MIPSWord) * 4); + } + static void replaceWithLoad(void* instructionStart) { MIPSWord* insn = reinterpret_cast<MIPSWord*>(instructionStart); diff --git a/Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h b/Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h index 5b6da9663..4f81b4599 100644 --- a/Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h +++ b/Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h @@ -2244,7 +2244,17 @@ public: static bool canJumpReplacePatchableBranchPtrWithPatch() { return false; } - static CodeLocationLabel startOfPatchableBranchPtrWithPatch(CodeLocationDataLabelPtr label) + static CodeLocationLabel startOfBranchPtrWithPatchOnRegister(CodeLocationDataLabelPtr label) + { + return label.labelAtOffset(0); + } + + static void revertJumpReplacementToBranchPtrWithPatch(CodeLocationLabel instructionStart, RegisterID, void* initialValue) + { + MIPSAssembler::revertJumpToMove(instructionStart.dataLocation(), immTempRegister, reinterpret_cast<int>(initialValue) & 0xffff); + } + + static CodeLocationLabel startOfPatchableBranchPtrWithPatchOnAddress(CodeLocationDataLabelPtr) { UNREACHABLE_FOR_PLATFORM(); return CodeLocationLabel(); diff --git a/Source/JavaScriptCore/assembler/MacroAssemblerSH4.h b/Source/JavaScriptCore/assembler/MacroAssemblerSH4.h index ca410afa8..b6f3e6d57 100644 --- a/Source/JavaScriptCore/assembler/MacroAssemblerSH4.h +++ b/Source/JavaScriptCore/assembler/MacroAssemblerSH4.h @@ -602,6 +602,16 @@ void or32(TrustedImm32 imm, RegisterID src, RegisterID dest) releaseScratch(scr); } + void load8Signed(BaseIndex address, RegisterID dest) + { + RegisterID scr = claimScratch(); + move(address.index, scr); + lshift32(TrustedImm32(address.scale), scr); + add32(address.base, scr); + load8Signed(scr, address.offset, dest); + releaseScratch(scr); + } + void load32(BaseIndex address, RegisterID dest) { RegisterID scr = claimScratch(); @@ -649,6 +659,32 @@ void or32(TrustedImm32 imm, RegisterID src, RegisterID dest) releaseScratch(scr); } + void load8Signed(RegisterID base, int offset, RegisterID dest) + { + if (!offset) { + m_assembler.movbMemReg(base, dest); + return; + } + + if ((offset > 0) && (offset < 64) && (dest == SH4Registers::r0)) { + m_assembler.movbMemReg(offset, base, dest); + return; + } + + if (base != dest) { + m_assembler.loadConstant((offset), dest); + m_assembler.addlRegReg(base, dest); + m_assembler.movbMemReg(dest, dest); + return; + } + + RegisterID scr = claimScratch(); + m_assembler.loadConstant((offset), scr); + m_assembler.addlRegReg(base, scr); + m_assembler.movbMemReg(scr, dest); + releaseScratch(scr); + } + void load8(RegisterID base, int offset, RegisterID dest) { if (!offset) { @@ -749,6 +785,11 @@ void or32(TrustedImm32 imm, RegisterID src, RegisterID dest) extuw(dest, dest); } + void load16Signed(RegisterID src, RegisterID dest) + { + m_assembler.movwMemReg(src, dest); + } + void load16(RegisterID r0, RegisterID src, RegisterID dest) { ASSERT(r0 == SH4Registers::r0); @@ -756,6 +797,12 @@ void or32(TrustedImm32 imm, RegisterID src, RegisterID dest) extuw(dest, dest); } + void load16Signed(RegisterID r0, RegisterID src, RegisterID dest) + { + ASSERT(r0 == SH4Registers::r0); + m_assembler.movwR0mr(src, dest); + } + void load16(BaseIndex address, RegisterID dest) { RegisterID scr = claimScratch(); @@ -775,6 +822,51 @@ void or32(TrustedImm32 imm, RegisterID src, RegisterID dest) releaseScratch(scr); } + void load16Signed(BaseIndex address, RegisterID dest) + { + RegisterID scr = claimScratch(); + + move(address.index, scr); + lshift32(TrustedImm32(address.scale), scr); + + if (address.offset) + add32(TrustedImm32(address.offset), scr); + if (address.base == SH4Registers::r0) + load16Signed(address.base, scr, dest); + else { + add32(address.base, scr); + load16Signed(scr, dest); + } + + releaseScratch(scr); + } + + void store8(RegisterID src, BaseIndex address) + { + RegisterID scr = claimScratch(); + + move(address.index, scr); + lshift32(TrustedImm32(address.scale), scr); + add32(address.base, scr); + + m_assembler.movbRegMem(src, scr); + + releaseScratch(scr); + } + + void store16(RegisterID src, BaseIndex address) + { + RegisterID scr = claimScratch(); + + move(address.index, scr); + lshift32(TrustedImm32(address.scale), scr); + add32(address.base, scr); + + m_assembler.movwRegMem(src, scr); + + releaseScratch(scr); + } + void store32(RegisterID src, ImplicitAddress address) { RegisterID scr = claimScratch(); @@ -900,13 +992,59 @@ void or32(TrustedImm32 imm, RegisterID src, RegisterID dest) return result; } - // Floating-point operations + // Floating-point operations static bool supportsFloatingPoint() { return true; } static bool supportsFloatingPointTruncate() { return true; } static bool supportsFloatingPointSqrt() { return true; } static bool supportsFloatingPointAbs() { return false; } + void moveDoubleToInts(FPRegisterID src, RegisterID dest1, RegisterID dest2) + { + m_assembler.fldsfpul((FPRegisterID)(src + 1)); + m_assembler.stsfpulReg(dest1); + m_assembler.fldsfpul(src); + m_assembler.stsfpulReg(dest2); + } + + void moveIntsToDouble(RegisterID src1, RegisterID src2, FPRegisterID dest, FPRegisterID scratch) + { + UNUSED_PARAM(scratch); + m_assembler.ldsrmfpul(src1); + m_assembler.fstsfpul((FPRegisterID)(dest + 1)); + m_assembler.ldsrmfpul(src2); + m_assembler.fstsfpul(dest); + } + + void loadFloat(BaseIndex address, FPRegisterID dest) + { + RegisterID scr = claimScratch(); + + move(address.index, scr); + lshift32(TrustedImm32(address.scale), scr); + add32(address.base, scr); + if (address.offset) + add32(TrustedImm32(address.offset), scr); + + m_assembler.fmovsReadrm(scr, dest); + releaseScratch(scr); + } + + void loadDouble(BaseIndex address, FPRegisterID dest) + { + RegisterID scr = claimScratch(); + + move(address.index, scr); + lshift32(TrustedImm32(address.scale), scr); + add32(address.base, scr); + if (address.offset) + add32(TrustedImm32(address.offset), scr); + + m_assembler.fmovsReadrminc(scr, (FPRegisterID)(dest + 1)); + m_assembler.fmovsReadrm(scr, dest); + releaseScratch(scr); + } + void loadDouble(ImplicitAddress address, FPRegisterID dest) { RegisterID scr = claimScratch(); @@ -935,6 +1073,21 @@ void or32(TrustedImm32 imm, RegisterID src, RegisterID dest) releaseScratch(scr); } + void storeFloat(FPRegisterID src, BaseIndex address) + { + RegisterID scr = claimScratch(); + + move(address.index, scr); + lshift32(TrustedImm32(address.scale), scr); + add32(address.base, scr); + if (address.offset) + add32(TrustedImm32(address.offset), scr); + + m_assembler.fmovsWriterm(src, scr); + + releaseScratch(scr); + } + void storeDouble(FPRegisterID src, ImplicitAddress address) { RegisterID scr = claimScratch(); @@ -946,11 +1099,44 @@ void or32(TrustedImm32 imm, RegisterID src, RegisterID dest) releaseScratch(scr); } + void storeDouble(FPRegisterID src, BaseIndex address) + { + RegisterID scr = claimScratch(); + + move(address.index, scr); + lshift32(TrustedImm32(address.scale), scr); + add32(address.base, scr); + if (address.offset) + add32(TrustedImm32(address.offset), scr); + + m_assembler.fmovsWriterm((FPRegisterID)(src + 1), scr); + m_assembler.addlImm8r(4, scr); + m_assembler.fmovsWriterm(src, scr); + + releaseScratch(scr); + } + + void addDouble(FPRegisterID op1, FPRegisterID op2, FPRegisterID dest) + { + if (op1 == dest) + m_assembler.daddRegReg(op2, dest); + else { + m_assembler.dmovRegReg(op1, dest); + m_assembler.daddRegReg(op2, dest); + } + } + void addDouble(FPRegisterID src, FPRegisterID dest) { m_assembler.daddRegReg(src, dest); } + void addDouble(AbsoluteAddress address, FPRegisterID dest) + { + loadDouble(address.m_ptr, fscratch); + addDouble(fscratch, dest); + } + void addDouble(Address address, FPRegisterID dest) { loadDouble(address, fscratch); @@ -984,6 +1170,18 @@ void or32(TrustedImm32 imm, RegisterID src, RegisterID dest) m_assembler.ddivRegReg(src, dest); } + void convertFloatToDouble(FPRegisterID src, FPRegisterID dst) + { + m_assembler.fldsfpul(src); + m_assembler.dcnvsd(dst); + } + + void convertDoubleToFloat(FPRegisterID src, FPRegisterID dst) + { + m_assembler.dcnvds(src); + m_assembler.fstsfpul(dst); + } + void convertInt32ToDouble(RegisterID src, FPRegisterID dest) { m_assembler.ldsrmfpul(src); @@ -1893,7 +2091,7 @@ void or32(TrustedImm32 imm, RegisterID src, RegisterID dest) void urshift32(RegisterID src, TrustedImm32 shiftamount, RegisterID dest) { if (src != dest) - move(src, dest); + move(src, dest); urshift32(shiftamount, dest); } diff --git a/Source/JavaScriptCore/assembler/SH4Assembler.h b/Source/JavaScriptCore/assembler/SH4Assembler.h index 3dbde2fa5..2cd0aa82e 100644 --- a/Source/JavaScriptCore/assembler/SH4Assembler.h +++ b/Source/JavaScriptCore/assembler/SH4Assembler.h @@ -166,6 +166,7 @@ enum { FMOVS_WRITE_RN_DEC_OPCODE = 0xf00b, FMOVS_WRITE_R0RN_OPCODE = 0xf007, FCNVDS_DRM_FPUL_OPCODE = 0xf0bd, + FCNVSD_FPUL_DRN_OPCODE = 0xf0ad, LDS_RM_FPUL_OPCODE = 0x405a, FLDS_FRM_FPUL_OPCODE = 0xf01d, STS_FPUL_RN_OPCODE = 0x005a, @@ -326,8 +327,9 @@ public: padForAlign32 = 0x00090009, }; - enum JumpType { JumpFar, - JumpNear + enum JumpType { + JumpFar, + JumpNear }; SH4Assembler() @@ -491,14 +493,14 @@ public: void sublRegReg(RegisterID src, RegisterID dst) { - uint16_t opc = getOpcodeGroup1(SUB_OPCODE, dst, src); - oneShortOp(opc); + uint16_t opc = getOpcodeGroup1(SUB_OPCODE, dst, src); + oneShortOp(opc); } void subvlRegReg(RegisterID src, RegisterID dst) { - uint16_t opc = getOpcodeGroup1(SUBV_OPCODE, dst, src); - oneShortOp(opc); + uint16_t opc = getOpcodeGroup1(SUBV_OPCODE, dst, src); + oneShortOp(opc); } void xorlRegReg(RegisterID src, RegisterID dst) @@ -803,7 +805,7 @@ public: oneShortOp(opc); } - void floatfpulfrn(RegisterID src) + void floatfpulfrn(FPRegisterID src) { uint16_t opc = getOpcodeGroup2(FLOAT_OPCODE, src); oneShortOp(opc, true, false); @@ -857,13 +859,13 @@ public: oneShortOp(opc, true, false); } - void fldsfpul(RegisterID src) + void fldsfpul(FPRegisterID src) { uint16_t opc = getOpcodeGroup2(FLDS_FRM_FPUL_OPCODE, src); oneShortOp(opc); } - void fstsfpul(RegisterID src) + void fstsfpul(FPRegisterID src) { uint16_t opc = getOpcodeGroup2(FSTS_FPUL_FRN_OPCODE, src); oneShortOp(opc); @@ -889,6 +891,12 @@ public: oneShortOp(opc); } + void dcnvsd(FPRegisterID dst) + { + uint16_t opc = getOpcodeGroup7(FCNVSD_FPUL_DRN_OPCODE, dst >> 1); + oneShortOp(opc); + } + void dcmppeq(FPRegisterID src, FPRegisterID dst) { uint16_t opc = getOpcodeGroup8(FCMPEQ_OPCODE, dst >> 1, src >> 1); @@ -1082,6 +1090,12 @@ public: oneShortOp(getOpcodeGroup4(MOVL_READ_OFFRM_OPCODE, dst, base, offset)); } + void movbRegMem(RegisterID src, RegisterID base) + { + uint16_t opc = getOpcodeGroup1(MOVB_WRITE_RN_OPCODE, base, src); + oneShortOp(opc); + } + void movbMemReg(int offset, RegisterID base, RegisterID dst) { ASSERT(dst == SH4Registers::r0); @@ -1253,7 +1267,7 @@ public: int sizeOfConstantPool() { - return m_buffer.sizeOfConstantPool(); + return m_buffer.sizeOfConstantPool(); } AssemblerLabel align(int alignment) @@ -1305,7 +1319,7 @@ public: *instructionPtr = instruction; printBlockInstr(instructionPtr - 2, from.m_offset, 3); return; - } + } /* MOV #imm, reg => LDR reg braf @reg braf @reg @@ -1592,7 +1606,7 @@ public: size_t codeSize() const { return m_buffer.codeSize(); } #ifdef SH4_ASSEMBLER_TRACING - static void printInstr(uint16_t opc, unsigned int size, bool isdoubleInst = true) + static void printInstr(uint16_t opc, unsigned size, bool isdoubleInst = true) { if (!getenv("JavaScriptCoreDumpJIT")) return; @@ -2073,16 +2087,16 @@ public: WTF::dataLogFV(format, args); } - static void printBlockInstr(uint16_t* first, unsigned int offset, int nbInstr) + static void printBlockInstr(uint16_t* first, unsigned offset, int nbInstr) { printfStdoutInstr(">> repatch instructions after link\n"); for (int i = 0; i <= nbInstr; i++) - printInstr(*(first + i), offset + i); + printInstr(*(first + i), offset + i); printfStdoutInstr(">> end repatch\n"); } #else - static void printInstr(uint16_t opc, unsigned int size, bool isdoubleInst = true) {}; - static void printBlockInstr(uint16_t* first, unsigned int offset, int nbInstr) {}; + static void printInstr(uint16_t opc, unsigned size, bool isdoubleInst = true) { }; + static void printBlockInstr(uint16_t* first, unsigned offset, int nbInstr) { }; #endif static void replaceWithLoad(void* instructionStart) diff --git a/Source/Platform/ChangeLog b/Source/Platform/ChangeLog index 5c180fb65..7e7e10da2 100644 --- a/Source/Platform/ChangeLog +++ b/Source/Platform/ChangeLog @@ -1,3 +1,30 @@ +2012-11-23 Sami Kyostila <skyostil@chromium.org> + + [chromium] Remove WebScreenInfo.{horizontal,vertical}DPI + https://bugs.webkit.org/show_bug.cgi?id=101772 + + Reviewed by Adam Barth. + + Now that nothing is using WebScreenInfo.{horizontal,vertical}DPI we can simply + remove them. + + * chromium/public/WebScreenInfo.h: + (WebKit::WebScreenInfo::WebScreenInfo): + +2012-11-22 David Reveman <reveman@chromium.org> + + [Chromium] Add GL_CHROMIUM_pixel_transfer_buffer_object extension support. + https://bugs.webkit.org/show_bug.cgi?id=102528 + + Reviewed by James Robinson. + + Add mapBufferCHROMIUM and unmapBufferCHROMIUM prototypes to WebGraphicsContext3D.h. + + * chromium/public/WebGraphicsContext3D.h: + (WebGraphicsContext3D): + (WebKit::WebGraphicsContext3D::mapBufferCHROMIUM): + (WebKit::WebGraphicsContext3D::unmapBufferCHROMIUM): + 2012-11-21 Harald Alvestrand <hta@google.com> WebMediaStreamComponent: Add assignment and copy operators diff --git a/Source/Platform/chromium/public/WebGraphicsContext3D.h b/Source/Platform/chromium/public/WebGraphicsContext3D.h index 1707f87c0..8f311cc2e 100644 --- a/Source/Platform/chromium/public/WebGraphicsContext3D.h +++ b/Source/Platform/chromium/public/WebGraphicsContext3D.h @@ -457,6 +457,10 @@ public: virtual void bindTexImage2DCHROMIUM(WGC3Denum target, WGC3Dint imageId) { } virtual void releaseTexImage2DCHROMIUM(WGC3Denum target, WGC3Dint imageId) { } + // GL_CHROMIUM_pixel_transfer_buffer_object + virtual void* mapBufferCHROMIUM(WGC3Denum target, WGC3Denum access) { return 0; } + virtual WGC3Dboolean unmapBufferCHROMIUM(WGC3Denum target) { return false; } + GrGLInterface* createGrGLInterface(); protected: diff --git a/Source/Platform/chromium/public/WebScreenInfo.h b/Source/Platform/chromium/public/WebScreenInfo.h index 4af1c5569..ea43af7eb 100644 --- a/Source/Platform/chromium/public/WebScreenInfo.h +++ b/Source/Platform/chromium/public/WebScreenInfo.h @@ -36,12 +36,6 @@ namespace WebKit { struct WebScreenInfo { - // The horizontal screen dpi (deprecated). - int horizontalDPI; - - // The vertical screen dpi (deprecated). - int verticalDPI; - // Device scale factor. Specifies the ratio between physical and logical // pixels. float deviceScaleFactor; @@ -74,9 +68,7 @@ struct WebScreenInfo { WebRect availableRect; WebScreenInfo() - : horizontalDPI(0) - , verticalDPI(0) - , deviceScaleFactor(1) + : deviceScaleFactor(1) , depth(0) , depthPerComponent(0) , isMonochrome(false) { } diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog index 248a01dfb..39d9ad1fb 100644 --- a/Source/WTF/ChangeLog +++ b/Source/WTF/ChangeLog @@ -1,3 +1,28 @@ +2012-11-23 Krzysztof Czech <k.czech@samsung.com> + + [EFL] Platform support for Accessibility feature. + https://bugs.webkit.org/show_bug.cgi?id=100848 + + Reviewed by Gyuyoung Kim. + + Enable HAVE(ACCESSIBILITY) ifdefs so that EFL port can use it. + + * wtf/Platform.h: + +2012-11-22 Michael Saboff <msaboff@apple.com> + + HTML integer parsing functions don't natively handle 8 bit strings + https://bugs.webkit.org/show_bug.cgi?id=102997 + + Reviewed by Filip Pizlo. + + Added exports to the LChar* versions of charactersToIntStrict() and charactersToUIntStrict() + to support the changes made to parseHTMLInteger() and parseHTMLNonNegativeInteger(). + + * wtf/text/WTFString.h: + (WTF::charactersToIntStrict): Added export + (WTF::charactersToUIntStrict): Added export + 2012-11-21 Filip Pizlo <fpizlo@apple.com> Rename dataLog() and dataLogV() to dataLogF() and dataLogFV() diff --git a/Source/WTF/wtf/Platform.h b/Source/WTF/wtf/Platform.h index 84b9c031e..446dcd0bc 100644 --- a/Source/WTF/wtf/Platform.h +++ b/Source/WTF/wtf/Platform.h @@ -657,7 +657,7 @@ #endif #if !defined(HAVE_ACCESSIBILITY) -#if PLATFORM(IOS) || PLATFORM(MAC) || PLATFORM(WIN) || PLATFORM(GTK) || (PLATFORM(CHROMIUM) && !OS(ANDROID)) +#if PLATFORM(IOS) || PLATFORM(MAC) || PLATFORM(WIN) || PLATFORM(GTK) || (PLATFORM(CHROMIUM) && !OS(ANDROID)) || PLATFORM(EFL) #define HAVE_ACCESSIBILITY 1 #endif #endif /* !defined(HAVE_ACCESSIBILITY) */ diff --git a/Source/WTF/wtf/text/WTFString.h b/Source/WTF/wtf/text/WTFString.h index 1a0b481f7..0066257c6 100644 --- a/Source/WTF/wtf/text/WTFString.h +++ b/Source/WTF/wtf/text/WTFString.h @@ -58,9 +58,9 @@ struct StringHash; // Declarations of string operations -int charactersToIntStrict(const LChar*, size_t, bool* ok = 0, int base = 10); +WTF_EXPORT_STRING_API int charactersToIntStrict(const LChar*, size_t, bool* ok = 0, int base = 10); WTF_EXPORT_STRING_API int charactersToIntStrict(const UChar*, size_t, bool* ok = 0, int base = 10); -unsigned charactersToUIntStrict(const LChar*, size_t, bool* ok = 0, int base = 10); +WTF_EXPORT_STRING_API unsigned charactersToUIntStrict(const LChar*, size_t, bool* ok = 0, int base = 10); WTF_EXPORT_STRING_API unsigned charactersToUIntStrict(const UChar*, size_t, bool* ok = 0, int base = 10); int64_t charactersToInt64Strict(const LChar*, size_t, bool* ok = 0, int base = 10); int64_t charactersToInt64Strict(const UChar*, size_t, bool* ok = 0, int base = 10); diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt index 8813cd919..7f48a8400 100644 --- a/Source/WebCore/CMakeLists.txt +++ b/Source/WebCore/CMakeLists.txt @@ -334,6 +334,7 @@ SET(WebCore_IDL_FILES css/WebKitCSSMatrix.idl css/WebKitCSSRegionRule.idl css/WebKitCSSTransformValue.idl + css/WebKitCSSViewportRule.idl dom/Attr.idl dom/BeforeLoadEvent.idl @@ -1146,7 +1147,6 @@ SET(WebCore_SOURCES dom/DocumentStyleSheetCollection.cpp dom/DocumentType.cpp dom/DynamicNodeList.cpp - dom/EditingText.cpp dom/Element.cpp dom/ElementAttributeData.cpp dom/ElementRareData.cpp diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index a5278cc25..5d35714fa 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,1130 @@ +2012-11-23 Dan Carney <dcarney@google.com> + + Remove V8DOMWindowShell::getEntered + https://bugs.webkit.org/show_bug.cgi?id=96637 + + Reviewed by Adam Barth. + + V8DOMWindowShell::getEntered was refactored so that the window shell + no longer has to be kept alive by a v8 context. Instead, only + the DOMWrapperWorld will be kept alive. + + No new tests. No change in functionality. + + * bindings/v8/DOMDataStore.cpp: + (WebCore::DOMDataStore::current): + * bindings/v8/DOMWrapperWorld.cpp: + (WebCore::isolatedWorldWeakCallback): + (WebCore): + (WebCore::DOMWrapperWorld::makeContextWeak): + (WebCore::DOMWrapperWorld::setIsolatedWorldField): + * bindings/v8/DOMWrapperWorld.h: + (DOMWrapperWorld): + (WebCore::DOMWrapperWorld::isolated): + * bindings/v8/ScriptController.cpp: + (WebCore::ScriptController::existingWindowShell): + (WebCore::ScriptController::windowShell): + (WebCore::ScriptController::evaluateInIsolatedWorld): + (WebCore::ScriptController::currentWorldContext): + (WebCore::ScriptController::collectIsolatedContexts): + * bindings/v8/ScriptController.h: + (ScriptController): + * bindings/v8/V8Binding.h: + (WebCore::worldForEnteredContextIfIsolated): + * bindings/v8/V8DOMWindowShell.cpp: + (WebCore::V8DOMWindowShell::destroyIsolatedShell): + (WebCore::V8DOMWindowShell::disposeContext): + (WebCore::V8DOMWindowShell::initializeIfNeeded): + * bindings/v8/V8DOMWindowShell.h: + (V8DOMWindowShell): + * bindings/v8/V8PerContextData.h: + * bindings/v8/WorldContextHandle.cpp: + (WebCore::WorldContextHandle::WorldContextHandle): + +2012-11-23 Eugene Klyuchnikov <eustas.bug@gmail.com> + + Web Inspector: Refine JsDoc in ProfilesPanel.js + https://bugs.webkit.org/show_bug.cgi?id=103042 + + Reviewed by Yury Semikhatsky. + + I'm going to make profiler output typed. + + This will require some amount of refactoring. + + Before refactoring I would like to make things + unambiguous by adding JsDoc where they are missing. + + * inspector/front-end/ProfilesPanel.js: + (WebInspector.ProfilesPanel.prototype._onToggleProfiling): + Added to eliminate parameter type ambiguity. + +2012-11-23 Kent Tamura <tkent@chromium.org> + + Correct input[type=number] value sanitization for user-input + https://bugs.webkit.org/show_bug.cgi?id=103018 + + Reviewed by Kentaro Hara. + + If a number field has non-number string, HTMLInputElement::value is not + updated and returns the past valid value. It doesn't match to the value + sanitization algorithm defined by the HTML standard [1], and Opera's + behavior. We should sanitize non-number strings to "". + + [1] http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#number-state-(type=number) + > The value sanitization algorithm is as follows: If the value of the + > element is not a valid floating-point number, then set it to the empty + > string instead. + + No new tests. Update existing tests; + fast/forms/number/number-commit-valid-only.html and + fast/forms/number/number-unacceptable-style.html + + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::subtreeHasChanged): + Remove isAcceptableValue check. + + * html/HTMLInputElement.h: + (HTMLInputElement): isAcceptableValue is no longer needed. + * html/InputType.cpp: Remove isAcceptableValue. + * html/InputType.h: Ditto. + * html/NumberInputType.cpp: Ditto. + (WebCore::NumberInputType::hasUnacceptableValue): + Fold the isAcceptableValue content into this. + * html/NumberInputType.h: + (NumberInputType): Remove isAcceptableValue. + +2012-11-23 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r135592. + http://trac.webkit.org/changeset/135592 + https://bugs.webkit.org/show_bug.cgi?id=103126 + + broke Chromium Mac compilation (Requested by yurys on + #webkit). + + * WebCore.gypi: + +2012-11-23 Yury Semikhatsky <yurys@chromium.org> + + Remove references to non-chromium entries from WebCore.gypi (part 2) + https://bugs.webkit.org/show_bug.cgi?id=103124 + + Reviewed by Pavel Feldman. + + * WebCore.gypi: removed references to gtk, cocoa, posix, ios, cf, win and mac + +2012-11-23 Andrey Adaikin <aandrey@chromium.org> + + Web Inspector: [Canvas] add startCapturing and stopCapturing methods to protocol + https://bugs.webkit.org/show_bug.cgi?id=103053 + + Reviewed by Pavel Feldman. + + Add startCapturing and stopCapturing methods to the protocol to instrument several canvas frames in a row. + Drive-by: support start offset index in retrieving trace logs in the backend as well as "alive" flag. + + * inspector/InjectedScriptCanvasModule.cpp: + (WebCore::InjectedScriptCanvasModule::captureFrame): + (WebCore): + (WebCore::InjectedScriptCanvasModule::startCapturing): + (WebCore::InjectedScriptCanvasModule::callStartCapturingFunction): + (WebCore::InjectedScriptCanvasModule::stopCapturing): + (WebCore::InjectedScriptCanvasModule::dropTraceLog): + (WebCore::InjectedScriptCanvasModule::callVoidFunctionWithTraceLogIdArgument): + (WebCore::InjectedScriptCanvasModule::traceLog): + * inspector/InjectedScriptCanvasModule.h: + (InjectedScriptCanvasModule): + * inspector/InjectedScriptCanvasModuleSource.js: + (.): + * inspector/Inspector.json: + * inspector/InspectorCanvasAgent.cpp: + (WebCore::InspectorCanvasAgent::startCapturing): + (WebCore): + (WebCore::InspectorCanvasAgent::stopCapturing): + (WebCore::InspectorCanvasAgent::getTraceLog): + * inspector/InspectorCanvasAgent.h: + (InspectorCanvasAgent): + * inspector/front-end/CanvasProfileView.js: + (WebInspector.CanvasProfileView): + +2012-11-23 Andrey Kosyakov <caseq@chromium.org> + + Web Inspector: dispatch events upon certain user actions on inspector's notification services + https://bugs.webkit.org/show_bug.cgi?id=103114 + + Reviewed by Pavel Feldman. + + Add a bunch of WebInspector.UserMetrics.UserAction, so platform-specific code can wire to user actions + without breaking too often. + + * inspector/front-end/ElementsPanel.js: + (WebInspector.ElementsPanel.prototype._setPseudoClassForNodeId): + * inspector/front-end/JavaScriptSourceFrame.js: + (WebInspector.JavaScriptSourceFrame.prototype._setBreakpoint): + * inspector/front-end/NetworkItemView.js: + (WebInspector.NetworkItemView.prototype._tabSelected.set WebInspector): + (WebInspector.NetworkItemView.prototype._tabSelected): + * inspector/front-end/NetworkPanel.js: + (WebInspector.NetworkLogView.prototype._sortItems): + (WebInspector.NetworkDataGridNode.prototype.select): + * inspector/front-end/ProfilesPanel.js: + (WebInspector.ProfilesPanel.prototype.addProfileHeader): + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel.prototype._showSourceLine): + (WebInspector.ScriptsPanel.prototype._toggleFormatSource): + * inspector/front-end/UISourceCode.js: + (WebInspector.UISourceCode.prototype.revertToOriginal): + (WebInspector.UISourceCode.prototype.revertAndClearHistory): + (WebInspector.UISourceCode.prototype.commitWorkingCopy): + * inspector/front-end/UserMetrics.js: + * inspector/front-end/externs.js: + * inspector/front-end/inspector.js: + (WebInspector._requestZoom.set var): + (WebInspector._requestZoom): + +2012-11-23 Christophe Dumez <christophe.dumez@intel.com> + + WebSocket's MessageEvent.origin attribute is an empty string + https://bugs.webkit.org/show_bug.cgi?id=102889 + + Reviewed by Kentaro Hara. + + Fix WebSocket implementation so that the message event's origin + attribute is properly set to the Unicode serialization of the + origin of the URL that was passed to the WebSocket object's + constructor, instead of an empty string. + + The new behavior is according to the specification: + http://www.whatwg.org/specs/web-apps/current-work/multipage/network.html#feedback-from-the-protocol + + It also matches the behavior of Firefox. + + Tests: http/tests/websocket/tests/hybi/send-blob-onmessage-origin.html + http/tests/websocket/tests/hybi/send-onmessage-origin.html + + * Modules/websockets/WebSocket.cpp: + (WebCore::WebSocket::didReceiveMessage): + (WebCore::WebSocket::didReceiveBinaryData): + * dom/MessageEvent.cpp: + (WebCore::MessageEvent::MessageEvent): + * dom/MessageEvent.h: + (WebCore::MessageEvent::create): + (MessageEvent): + +2012-11-22 Eugene Klyuchnikov <eustas.bug@gmail.com> + + Web Inspector: No "Save Heap Snapshot" option after canceling save to file dialog. + https://bugs.webkit.org/show_bug.cgi?id=100916 + + Reviewed by Yury Semikhatsky. + + Fixed order of operations - now receiver is assigned only when save + dialog responds. + + * inspector/front-end/HeapSnapshotView.js: Fixed order of operations. + +2012-11-23 Allan Sandfeld Jensen <allan.jensen@digia.com> + + [Qt] REGRESSION(r135507): It made 13 tests fail + https://bugs.webkit.org/show_bug.cgi?id=103069 + + Reviewed by Simon Hausmann. + + The subframe loading logic depends on that script extensions are not recognized, + so avoid recognizing them in getMIMETypeForExtension which is used for pre-load + mimetype detection. + + * platform/qt/MIMETypeRegistryQt.cpp: + (WebCore::MIMETypeRegistry::getMIMETypeForExtension): + +2012-11-23 Jochen Eisinger <jochen@chromium.org> + + REGRESSION (r135455): Compilation without SVG enabled broken + https://bugs.webkit.org/show_bug.cgi?id=103108 + + Reviewed by Yury Semikhatsky. + + Move SVG-only code behind #if ENABLE(SVG) that was accidentially moved + outside of the #if block during the refactoring. + + * platform/graphics/filters/FilterOperation.h: + (ReferenceFilterOperation): + +2012-11-23 Julian Pastarmov <pastarmovj@chromium.org> + + REGRESSION (r128633): td changes size during re-layout of table although it shouldn't + https://bugs.webkit.org/show_bug.cgi?id=102802 + + Reviewed by Ojan Vafai. + + The bug was caused by incorrectly rewriting a nested condition which caused the else + clause to trigger in wrong cases. + + Test: fast/table/nested-tables-with-div-offset.html + + * rendering/RenderBox.cpp: + (WebCore::RenderBox::computePercentageLogicalHeight): + Reverted wrong combination of nested if statements. + +2012-11-23 Allan Sandfeld Jensen <allan.jensen@digia.com> + + [Qt] REGRESSION(r135507): It made 13 tests fail + https://bugs.webkit.org/show_bug.cgi?id=103069 + + Reviewed by Simon Hausmann. + + Fix regression in recognizing MHTML on some platforms. + + * platform/qt/MIMETypeRegistryQt.cpp: + (ExtensionMap): + (WebCore::MIMETypeRegistry::getMIMETypeForExtension): + (WebCore::MIMETypeRegistry::getMIMETypeForPath): + +2012-11-22 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: ctrl+end in editor does not select the last symbol. + https://bugs.webkit.org/show_bug.cgi?id=103078 + + Reviewed by Vsevolod Vlasov. + + Test: inspector/editor/text-editor-selection.html + + * inspector/front-end/DefaultTextEditor.js: + (WebInspector.DefaultTextEditor.prototype._handleScrollChanged): + (WebInspector.DefaultTextEditor.prototype.overrideViewportForTest): + (WebInspector.TextEditorChunkedPanel.prototype._repaintAll): + (WebInspector.TextEditorChunkedPanel.prototype._scrollTop): + (WebInspector.TextEditorChunkedPanel.prototype._clientHeight): + (WebInspector.TextEditorMainPanel.prototype._paintLineChunks): + (WebInspector.TextEditorMainPanel.prototype._selectionToPosition): + (WebInspector.TextEditorMainPanel.prototype._updateHighlightsForRange): + +2012-11-23 Yury Semikhatsky <yurys@chromium.org> + + Remove references to non-chromium entries from WebCore.gypi + https://bugs.webkit.org/show_bug.cgi?id=103103 + + Reviewed by Pavel Feldman. + + * WebCore.gypi: Removed references to files specific for wince, cairo, qt, wx and efl. + +2012-11-23 Alexander Pavlov <apavlov@chromium.org> + + Web Inspector: inspector overlay is always updated when inspector is open + https://bugs.webkit.org/show_bug.cgi?id=103106 + + Reviewed by Pavel Feldman. + + Provide empty size into the InspectorOverlay if the metrics emulation is disabled, + so that it will not get painted in all cases. + + * inspector/InspectorController.cpp: + (WebCore::InspectorController::webViewResized): Call InspectorPageAgent::webViewResized() rather than InspectorOverlay::resize(). + * inspector/InspectorPageAgent.cpp: + (WebCore::InspectorPageAgent::webViewResized): Provide empty size into InspectorOverlay::resize() if device metrics are not emulated. + * inspector/InspectorPageAgent.h: + +2012-11-23 Krzysztof Czech <k.czech@samsung.com> + + [EFL] Platform support for Accessibility feature. + https://bugs.webkit.org/show_bug.cgi?id=100848 + + Reviewed by Gyuyoung Kim. + + Add EFL platform's definitions to enable proper accessibility routines. + + No new tests. Covered by existing layout tests. + + * PlatformEfl.cmake: Add accessibility/atk content to compilation. + * accessibility/AccessibilityObject.cpp: + (WebCore::AccessibilityObject::AccessibilityObject): + * accessibility/AccessibilityObject.h: + (AccessibilityObject): + * accessibility/efl/AccessibilityObjectEfl.cpp: Removed. No needed platform specific implementation. ATK shared implementation will be used. + +2012-11-23 Thiago Marcos P. Santos <thiago.santos@intel.com> + + Expose DOM interface for CSS Device Adaptation + https://bugs.webkit.org/show_bug.cgi?id=95966 + + Reviewed by Kenneth Rohde Christiansen. + + Added V8 and JSC bindings for CSS Device Adapation. + + Test: css3/device-adapt/opera/cssom-001.xhtml + + * CMakeLists.txt: + * DerivedSources.make: + * DerivedSources.pri: + * GNUmakefile.list.am: + * WebCore.gypi: + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/JSCSSRuleCustom.cpp: + (WebCore::toJS): + * bindings/objc/DOMCSS.mm: + (kitClass): + * bindings/v8/custom/V8CSSRuleCustom.cpp: + (WebCore::wrap): + * css/CSSRule.idl: + * css/WebKitCSSViewportRule.idl: Added. + * page/DOMWindow.idl: + +2012-11-22 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r135549. + http://trac.webkit.org/changeset/135549 + https://bugs.webkit.org/show_bug.cgi?id=103102 + + Multiple layout test crashes (Requested by yurys on #webkit). + + * rendering/RenderTable.cpp: + (WebCore::RenderTable::layout): + * rendering/RenderTable.h: + (RenderTable): + +2012-11-22 Rick Byers <rbyers@chromium.org> + + window is missing Touch and TouchList - touch event conformance test failure + https://bugs.webkit.org/show_bug.cgi?id=96295 + + Reviewed by Adam Barth. + + Add Touch and TouchList constructors to window for ENABLE(TOUCH_EVENTS). + + Tests: fast/js/global-constructors.html + fast/events/touch/document-create-touch-list.html + + * page/DOMWindow.idl: + +2012-11-22 Dan Carney <dcarney@google.com> + + [V8] Make worker context prototype chain match other browsers + https://bugs.webkit.org/show_bug.cgi?id=103057 + + Reviewed by Adam Barth. + + The following should be defined in a worker: + Object.getOwnPropertyDescriptor(this.__proto__, "postMessage") + It is currently undefined in chrome only. This patch fixes that. + + No new tests. No change in functionality. + + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateImplementation): + +2012-11-22 Rafael Brandao <rafael.lobo@openbossa.org> + + Remove PLATFORM(HAIKU) leftovers code + https://bugs.webkit.org/show_bug.cgi?id=103086 + + Reviewed by Antti Koivisto. + + * platform/PlatformWheelEvent.h: + (PlatformWheelEvent): + +2012-11-22 Dirk Schulze <krit@webkit.org> + + -webkit-mask shorthand switches -webkit-mask-clip and -webkit-mask-origin values + https://bugs.webkit.org/show_bug.cgi?id=103083 + + Reviewed by Antti Koivisto. + + The order of CSSPropertyWebkitMaskOrigin and CSSPropertyWebkitMaskClip was not correct + for property value. Just changed the order in the property array to match behavior of + background and CSS Masking spec. + + Test: fast/masking/parsing-mask.html + + * css/StylePropertyShorthand.cpp: + (WebCore::webkitMaskShorthand): + +2012-11-22 John Mellor <johnme@chromium.org> + + Text Autosizing: Improve handling of nested comments on reddit.com + https://bugs.webkit.org/show_bug.cgi?id=102409 + + Reviewed by Kenneth Rohde Christiansen. + + No longer consider overflow != visible as requiring an independent + cluster. Some sites (e.g. reddit.com) wrap ordinary blocks (such as + comments) in overflow:hidden or overflow:auto, for various reasons + (like allowing it to be scrollable, or clipping an element that sticks + out). These reasons are not sufficient justification for a new cluster. + + On reddit.com this means that comments will all get the same multiplier, + rather than being independently assigned a variety of multipliers based + on how much text each comment contains (etc), which significantly + improves the look. + + Test: fast/text-autosizing/cluster-narrow-in-wide-ohidden.html + + * rendering/TextAutosizer.cpp: + (WebCore::TextAutosizer::isAutosizingCluster): + +2012-11-22 Pravin D <pravind.2k4@gmail.com> + + max-height property not respected in case of tables + https://bugs.webkit.org/show_bug.cgi?id=98633 + + Reviewed by Julien Chaffraix. + + The max-height property determines the maximum computed height an element can have. In case of tables + the computed height was not being limited by the max-height property. The current patch fixes the same. + + Test: fast/table/css-table-max-height.html + + * rendering/RenderTable.cpp: + (WebCore::RenderTable::convertStyleLogicalHeightToComputedHeight): + Helper function to compute height from the given style height. + This function handles style height of type fixed, percent and viewport percent. + As height of type 'calculated' gets internally resolved to either fixed or percent + there is no special handling required for the same. + + (WebCore): + (WebCore::RenderTable::layout): + Logic to compute the logical height of an element such that it does not exceed the max-height value given that + min-width < Content height < max-height, when min-height < max-height. + However max-height value is not respected if either min-height > max-height or Content height > max-height. + + * rendering/RenderTable.h: + (RenderTable): + Function definition for the newly add function convertStyleLogicalHeightToComputedHeight(). + +2012-11-22 Kentaro Hara <haraken@chromium.org> + + Remove 'module' from IDL parser + https://bugs.webkit.org/show_bug.cgi?id=102670 + + Reviewed by Adam Barth. + + The Web IDL spec no longer supports 'module'. We already removed + 'module's from WebKit IDL files. So this patch removes 'module' + from the IDL parser. + + No tests. No change in behavior. + + * bindings/scripts/IDLParser.pm: + (Parse): + (parseDefinitionOld): + +2012-11-22 Dan Carney <dcarney@google.com> + + [V8] fix DOMWrapperWorld destructor + https://bugs.webkit.org/show_bug.cgi?id=103066 + + Reviewed by Jochen Eisinger. + + DOMWrapperWorld had a workaround in place during deletion. + This patch brings it in line with WebKit standards. + + No new tests: refactor. + + * bindings/v8/DOMWrapperWorld.cpp: + (WebCore::DOMWrapperWorld::~DOMWrapperWorld): + (WebCore::DOMWrapperWorld::ensureIsolatedWorld): + * bindings/v8/DOMWrapperWorld.h: + (DOMWrapperWorld): + (WebCore::DOMWrapperWorld::isolatedWorldDOMDataStore): + +2012-11-22 Antti Koivisto <antti@apple.com> + + Remove SVGShadowText class + https://bugs.webkit.org/show_bug.cgi?id=103088 + + Reviewed by Ryosuke Niwa. + + Remove SVGShadowText class and merge the little functionality it has to Text. + + * dom/Text.cpp: + (WebCore): + (WebCore::isSVGShadowText): + + Figure out if we are a SVGShadowText from the context. + + (WebCore::isSVGText): + (WebCore::Text::createRenderer): + (WebCore::Text::recalcTextStyle): + + Factor SVG special case testing to functions. + + * dom/Text.h: + (Text): + + Get rid of the now unnecessary willRecalcTextStyle mechanism. + + * svg/SVGTRefElement.cpp: + (WebCore): + (WebCore::SVGTRefElement::updateReferencedText): + +2012-11-22 Andreas Kling <akling@apple.com> + + Style sharing: Remove O(n^2) presentation attribute checks that never found anything anyway. + <http://webkit.org/b/103019> + + Reviewed by Ojan Vafai. + + Rely on the global presentation attribute cache and remove the slow-path code that compares + the full StylePropertySets for attribute-derived style. + There are virtually no cases of logically equivalent presentation attribute styles that don't + already share the same memory address. (Zero hits on Apple and Chromium PLT content.) + + * css/StyleResolver.cpp: + (WebCore::haveIdenticalStyleAffectingAttributes): + (WebCore::StyleResolver::canShareStyleWithElement): + +2012-11-22 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: evaluate on hover regressed with the editor change + https://bugs.webkit.org/show_bug.cgi?id=103063 + + Reviewed by Vsevolod Vlasov. + + We are no longer mutating the editor's dom from outside. + + * inspector/front-end/DOMExtension.js: + (Element.prototype.remove): + * inspector/front-end/DefaultTextEditor.js: + (WebInspector.DefaultTextEditor.prototype.highlightRangesWithStyleClass): + (WebInspector.DefaultTextEditor.prototype.highlightExpression): + (WebInspector.DefaultTextEditor.prototype.hideHighlightedExpression): + * inspector/front-end/JavaScriptSourceFrame.js: + (WebInspector.JavaScriptSourceFrame.prototype._getPopoverAnchor): + (WebInspector.JavaScriptSourceFrame.prototype._onHidePopover): + (WebInspector.JavaScriptSourceFrame.prototype._highlightExpression): + +2012-09-26 Gustavo Noronha Silva <gns@gnome.org> + + [GTK] Split SVG from WebCore to work-around make limitation + https://bugs.webkit.org/show_bug.cgi?id=97735 + + Reviewed by Carlos Garcia Campos. + + Add a new libtool convenience library, libWebCoreSVG.la, to work-around + make limitation when linking libWebCore. + + * GNUmakefile.am: new libWebCoreSVG.la library. + * GNUmakefile.list.am: move SVG-related files to be part of the new library. + +2012-11-22 Pan Deng <pan.deng@intel.com> + + [Web Inspector]Code Style changes in TimelinePresentationModel.js. + https://bugs.webkit.org/show_bug.cgi?id=102885. + + Reviewed by Pavel Feldman. + + This patch changes "switch" code style for TimelinePresentationModel.js, no functionality update. + + No new tests. + + * inspector/front-end/TimelinePresentationModel.js: + (WebInspector.TimelinePresentationModel.Record.prototype._getRecordDetails): + +2012-11-22 Ryosuke Niwa <rniwa@webkit.org> + + Build fix attempt. + + * html/HTMLCollection.h: + (HTMLCollection): + +2012-11-22 Ryosuke Niwa <rniwa@webkit.org> + + Get rid of HTMLCollectionCacheBase + https://bugs.webkit.org/show_bug.cgi?id=103085 + + Reviewed by Sam Weinig. + + Merged HTMLCollectionCacheBase into HTMLCollection now that DynamicNodeList and HTMLCollection + share one implementation. + + * dom/DynamicNodeList.cpp: + (WebCore::DynamicNodeListCacheBase::rootNode): Merged ownerNodeHasItemRefAttribute since this was + the only caller of this function, and the function name didn't match what it was checking. + (WebCore::DynamicNodeListCacheBase::invalidateCache): + (WebCore::DynamicNodeListCacheBase::invalidateIdNameCacheMaps): + * dom/DynamicNodeList.h: + (WebCore): + (WebCore::DynamicNodeListCacheBase::cachedItemOffset): + (DynamicNodeListCacheBase): + * html/HTMLCollection.cpp: + (WebCore::HTMLCollection::HTMLCollection): + (WebCore::DynamicNodeListCacheBase::setItemCache): + (WebCore::DynamicNodeListCacheBase::itemBeforeOrAfterCachedItem): Merged cachedElementsArrayOffset() + now that this is the only caller. + (WebCore::HTMLCollection::append): + * html/HTMLCollection.h: + (HTMLCollection): + (WebCore::HTMLCollection::idCache): Moved from HTMLCollectionCacheBase. + (WebCore::HTMLCollection::nameCache): Ditto. + (WebCore::HTMLCollection::appendIdCache): Ditto. + (WebCore::HTMLCollection::appendNameCache): Ditto. + +2012-11-22 Antti Koivisto <antti@apple.com> + + Merge EditingText into Text + https://bugs.webkit.org/show_bug.cgi?id=103060 + + Reviewed by Ryosuke Niwa. + + Remove the EditingText class. Its only function beyond the regular Text is that it always creates a renderer. + It can be replaced with a bit. + + * CMakeLists.txt: + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * dom/CDATASection.cpp: + (WebCore::CDATASection::CDATASection): + * dom/Document.cpp: + (WebCore::Document::createEditingTextNode): + * dom/Document.h: + (WebCore): + (Document): + * dom/EditingText.cpp: Removed. + * dom/EditingText.h: Removed. + * dom/Node.h: + (WebCore::Node::hasName): + (WebCore::Node::isEditingText): + (WebCore::Node::setHasName): + + Use the same bit as hasName() which is Element specific. + + * dom/Text.cpp: + (WebCore::Text::create): + (WebCore): + (WebCore::Text::createEditingText): + (WebCore::Text::rendererIsNeeded): + * dom/Text.h: + (Text): + (WebCore::Text::Text): + * editing/Editor.cpp: + * editing/InsertTextCommand.cpp: + * editing/ReplaceSelectionCommand.cpp: + * editing/htmlediting.cpp: + * editing/mac/EditorMac.mm: + * page/Frame.cpp: + +2012-11-22 Eugene Klyuchnikov <eustas.bug@gmail.com> + + Web Inspector: Timeline: Disclosure arrows rendered underneath frame boundaries + https://bugs.webkit.org/show_bug.cgi?id=101053 + + Reviewed by Yury Semikhatsky. + + In Timeline, when in "frames" mode, event disclosure arrows are rendered + below the dividing lines for the frame (div.timeline-frame-divider). + When this happens, the frame divider can capture mouse clicks and make + it difficult to open the disclosure arrow. + + * inspector/front-end/timelinePanel.css: + (#timeline-grid-header): Render dividers under timeline bars. + +2012-11-22 Huang Dongsung <luxtella@company100.net> + + [TexMap] Reduce public methods of TextureMapperTiledBackingStore. + https://bugs.webkit.org/show_bug.cgi?id=103032 + + Reviewed by Noam Rosenthal. + + This patch makes two methods private and removes one method. + + No new tests, refactoring only. + + * platform/graphics/texmap/TextureMapperBackingStore.cpp: + (WebCore::TextureMapperTiledBackingStore::updateContentsFromImageIfNeeded): + * platform/graphics/texmap/TextureMapperBackingStore.h: + (WebCore::TextureMapperTiledBackingStore::create): + (TextureMapperTiledBackingStore): + (WebCore::TextureMapperTiledBackingStore::setContentsToImage): + (WebCore::TextureMapperTiledBackingStore::rect): + +2012-11-22 Simon Hausmann <simon.hausmann@digia.com>, Pierre Rossi <pierre.rossi@digia.com> + + [Qt] Separate QWidget dependant code into separate WebKitWidgets static library + https://bugs.webkit.org/show_bug.cgi?id=102800 + + Reviewed by Tor Arne Vestbø. + + This patch separates code that needs to use QWidget related APIs in + WebKit/qt/WebCoreSupport and Api from code that doesn't. This means for + example FrameLoaderClientQt.cpp remains in the WebKit1 static library, + while qwebpage.cpp and qwebframe.cpp become part of the WebKitWidgets + static library. WebKit1 is compiled without QT += widgets and therefore + any widget related dependency has been moved "up" and out of WebKit1 into + the WebKitWidgets library. + + Between the code in WebKit.a and WebKitWidgets.a new adapters and + interfaces have been introduced, such as QWebPageAdapter and + QWebFrameAdapter. QWebPageAdapter, when used from WebKit1, is a way to + call out into the API layer, implemented by QWebPage (QWebPagePrivate). + The other way around if QWebPage wants to access WebCore or + WebCoreSupport related functionality, it will go through + QWebPageAdapater (as base class). The separation in the direction up + into the API layer is complete with this patch, no code in WebKit1 + depends on QtWidgets. The separation the other way around, code in the + API layer not using any WebCore types, is not complete yet. + + Some classes such as QWebSettings, QWebElement or + DumpRenderTreeSupportQt remain in WebKit1. While they are API layer, + they do not depend on widget related Qt APIs and they make much more + use of WebCore internal APIs and therefore are easier to keep in + WebKit1. + + In the future we plan to place a real shared library boundary between + WebKit1 and WebKitWidgets, by keeping the WebKit1 static library as + part of the QtWebKit shared library and by turning the WebKitWidgets + static library into a shared one. + + * platform/qt/QWebPageClient.h: + (QWebPageClient): + +2012-11-22 Dan Carney <dcarney@google.com> + + [V8] Add context checks to WorldContextHandle and V8DOMWindowShell + https://bugs.webkit.org/show_bug.cgi?id=101573 + + Reviewed by Adam Barth. + + Added a bunch of assertions to ensure the problems with IndexedDB + contexts cannot reemerge. + + No new tests. No change in functionality. + + * bindings/v8/V8DOMWindowShell.cpp: + (WebCore): + (WebCore::V8DOMWindowShell::assertContextHasCorrectPrototype): + * bindings/v8/V8DOMWindowShell.h: + (V8DOMWindowShell): + (WebCore::V8DOMWindowShell::isolated): + * bindings/v8/WorldContextHandle.cpp: + (WebCore::WorldContextHandle::WorldContextHandle): + +2012-11-22 Allan Sandfeld Jensen <allan.jensen@digia.com> + + [Qt] Correct extensions on preferredFilename + https://bugs.webkit.org/show_bug.cgi?id=103054 + + Reviewed by Simon Hausmann. + + When guessing a filename we will now ensure it has an extension that is valid for its mimetype. + To do this the two missing methods getExtensionsForMIMEType and getPreferredExtensionForMIMEType + have been added to the Qt implementation of MIMETypeRegistry. + + * platform/network/qt/QNetworkReplyHandler.cpp: + (WebCore::QNetworkReplyHandler::sendResponseIfNeeded): + * platform/qt/MIMETypeRegistryQt.cpp: + (WebCore::MIMETypeRegistry::getExtensionsForMIMEType): + (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType): + +2012-11-22 Kent Tamura <tkent@chromium.org> + + INPUT_MULTIPLE_FIELDS_UI: Refactoring: Do not call updateInnerTextValue if only read-only sub-fields have values + https://bugs.webkit.org/show_bug.cgi?id=103033 + + Reviewed by Kentaro Hara. + + input[type=time] can have read-only sub fields. If only read-only fields + have values, we don't need to call updateInnerTextValue when + HTMLInputElement::value is set to "". + + Tests: this patch doesn't change any visible behavior, but we add test cases to + fast/forms/time-multiple-fields/time-multiple-fields-value-set-empty.html + just in case. + + * html/shadow/DateTimeEditElement.h: + (DateTimeEditElement): Declare anyEditableFieldsHaveValues. + * html/shadow/DateTimeEditElement.cpp: + (WebCore::DateTimeEditElement::anyEditableFieldsHaveValues): + Added. This function checks value existence against only editable sub-fields. + * html/BaseMultipleFieldsDateAndTimeInputType.cpp: + (WebCore::BaseMultipleFieldsDateAndTimeInputType::setValue): + Call DateTimeEditElement::anyEditableFieldsHaveValues() instead of + DateTimeFieldsState::hasAnyValue(). + * html/DateTimeFieldsState.h: Remove hasAnyValue. + +2012-11-22 Allan Sandfeld Jensen <allan.jensen@digia.com> + + [Qt] Lookup mimetypes using QMimeDatabase + https://bugs.webkit.org/show_bug.cgi?id=102667 + + Reviewed by Simon Hausmann. + + The Qt backend of MIMETypeRegistry now looks up using QMimeDatabase. + + * loader/archive/ArchiveFactory.cpp: + (WebCore::archiveMIMETypes): + Also map the preferred freedesktop mimetype for MIME archives to MIME archive constructor. + * platform/MIMETypeRegistry.cpp: + (WebCore::MIMETypeRegistry::getNormalizedMIMEType): + * platform/qt/MIMETypeRegistryQt.cpp: + (WebCore::MIMETypeRegistry::getMIMETypeForExtension): + (WebCore::MIMETypeRegistry::getMIMETypeForPath): + (WebCore::MIMETypeRegistry::getNormalizedMIMEType): + +2012-11-22 Cosmin Truta <ctruta@rim.com> + + Move URL-checking code into Frame + https://bugs.webkit.org/show_bug.cgi?id=103014 + + Reviewed by Ojan Vafai. + + Move the common URL checking logic from HTMLFrameElementBase::isURLAllowed + and HTMLPlugInImageElement::allowedToLoadFrameURL into Frame::isURLAllowed. + + No new tests. Refactoring. + + * html/HTMLFrameElementBase.cpp: + (WebCore::HTMLFrameElementBase::isURLAllowed): Call Frame::isURLAllowed. + * html/HTMLPlugInImageElement.cpp: + (WebCore::HTMLPlugInImageElement::allowedToLoadFrameURL): Call Frame::isURLAllowed. + * page/Frame.cpp: + (WebCore::Frame::isURLAllowed): Added. + * page/Frame.h: + (Frame): Added isURLAllowed. + +2012-11-22 Kentaro Hara <haraken@chromium.org> + + [V8] Rename toWebCoreStringWithNullOrUndefinedCheck() with toWebCoreStringWithUndefinedOrNullCheck() + https://bugs.webkit.org/show_bug.cgi?id=103013 + + Reviewed by Adam Barth. + + IDL attributes and other V8 and JSC files use "UndefinedOrNull" instead of "NullOrUndefined". + + No tests. No change in behavior. + + * bindings/v8/JavaScriptCallFrame.cpp: + (WebCore::JavaScriptCallFrame::functionName): + * bindings/v8/ScriptDebugServer.cpp: + (WebCore::ScriptDebugServer::setScriptSource): + (WebCore::ScriptDebugServer::dispatchDidParseSource): + (WebCore::ScriptDebugServer::compileScript): + (WebCore::ScriptDebugServer::runScript): + * bindings/v8/ScriptEventListener.cpp: + (WebCore::eventListenerHandlerLocation): + * bindings/v8/V8Binding.h: + (WebCore::toWebCoreStringWithUndefinedOrNullCheck): + * bindings/v8/custom/V8DOMWindowCustom.cpp: + (WebCore::V8DOMWindow::showModalDialogCallback): + (WebCore::V8DOMWindow::openCallback): + * bindings/v8/custom/V8JavaScriptCallFrameCustom.cpp: + (WebCore::V8JavaScriptCallFrame::evaluateCallback): + +2012-11-22 Harald Alvestrand <hta@google.com> + + Name enumerator function for GetStats RTCStatsElement + https://bugs.webkit.org/show_bug.cgi?id=102933 + + Reviewed by Adam Barth. + + Tested by extensions to the RTCPeerConnection-stats test. + + * Modules/mediastream/RTCStatsElement.cpp: + (WebCore::RTCStatsElement::names): + (WebCore): + * Modules/mediastream/RTCStatsElement.h: + (RTCStatsElement): + * Modules/mediastream/RTCStatsElement.idl: + +2012-11-22 Kentaro Hara <haraken@chromium.org> + + Rename the "eden" bit to something more descriptive + https://bugs.webkit.org/show_bug.cgi?id=102985 + + Reviewed by Adam Barth. + + InEdenFlag is not descriptive. Per the discussion in IRC, + we rename InEdenFlag to V8CollectableDuringMinorGCFlag. + + No tests. No change in behavior. + + * bindings/v8/V8GCController.cpp: + (WebCore::gcTree): + (WebCore::V8GCController::didCreateWrapperForNode): + (WebCore::V8GCController::minorGCPrologue): + * dom/Node.h: + (WebCore::Node::isV8CollectableDuringMinorGC): + (WebCore::Node::setV8CollectableDuringMinorGC): + +2012-11-22 Kentaro Hara <haraken@chromium.org> + + [V8] Move AddMessageListener() from WorkerContextExecutionProxy::initializeIfNeeded() to WorkerContextExecutionProxy::initIsolate() + https://bugs.webkit.org/show_bug.cgi?id=102998 + + Reviewed by Adam Barth. + + This is an incremental step for moving initializeIfNeeded() + to V8Initializer.h. Given that AddMessageListener() needs to + be called once per Isolate, we can move AddMessageListener() + from initializeIfNeeded() to initIsolate(). + + No tests. No change in behavior. + + * bindings/v8/WorkerContextExecutionProxy.cpp: + (WebCore::WorkerContextExecutionProxy::initIsolate): + (WebCore::WorkerContextExecutionProxy::initializeIfNeeded): + +2012-11-22 Michael Saboff <msaboff@apple.com> + + HTML integer parsing functions don't natively handle 8 bit strings + https://bugs.webkit.org/show_bug.cgi?id=102997 + + Reviewed by Filip Pizlo. + + In order to avoid unnecessary up convering of 8 bit strings to 16 bits, added 8 bit paths to + parseHTMLInteger() and parseHTMLNonNegativeInteger() by breaking out the core logic into + templated helper functions. These methods are primarily used to process attribute values. + + No new tests needed, functionnality covered by existing tests. + + * html/parser/HTMLParserIdioms.cpp: + (WebCore::parseHTMLIntegerInternal): + (WebCore::parseHTMLInteger): + (WebCore::parseHTMLNonNegativeIntegerInternal): + (WebCore::parseHTMLNonNegativeInteger): + +2012-11-22 Kentaro Hara <haraken@chromium.org> + + [V8] WebCoreStringResourceBase should be located in V8StringResource.h + https://bugs.webkit.org/show_bug.cgi?id=103002 + + Reviewed by Adam Barth. + + Currently WebCoreStringResourceBase is mis-located in V8ValueCache.h. + It should be in V8StringResource.h. + + No tests. No change in behavior. + + * bindings/v8/V8StringResource.cpp: + (WebCore::WebCoreStringResourceBase::toWebCoreStringResourceBase): + (WebCore): + (WebCore::WebCoreStringResourceBase::visitStrings): + * bindings/v8/V8StringResource.h: + (WebCore): + (WebCoreStringResourceBase): + (WebCore::WebCoreStringResourceBase::WebCoreStringResourceBase): + (WebCore::WebCoreStringResourceBase::~WebCoreStringResourceBase): + (WebCore::WebCoreStringResourceBase::webcoreString): + (WebCore::WebCoreStringResourceBase::atomicString): + (WebCore::WebCoreStringResourceBase::memoryConsumption): + (WebCoreStringResource16): + (WebCore::WebCoreStringResource16::WebCoreStringResource16): + (WebCoreStringResource8): + (WebCore::WebCoreStringResource8::WebCoreStringResource8): + * bindings/v8/V8ValueCache.cpp: + * bindings/v8/V8ValueCache.h: + (WebCore): + +2012-11-21 Ilya Tikhonovsky <loislo@chromium.org> + + Web Inspector: NMI add instrumentation to DynamicNodeList classes hierarchy. + https://bugs.webkit.org/show_bug.cgi?id=103025 + + Reviewed by Yury Semikhatsky. + + RNiwa changed pointer type in NodeRareData::NodeListAtomicNameCacheMap from the topmost + DynamicSubtreeNodeList to the base DynamicNodeListCacheBase at r135429. + As a result we got non zero count of pointers that don't match with tcmalloc data, + because DynamicNodeList uses multiple inheritance. + It could be fixed with help of explicit native memory instrumentation for DynamicNodeList class hierarchy. + + No change in behavior, so no new tests. + + * dom/Document.cpp: drive by fix. + (WebCore::Document::reportMemoryUsage): + * dom/DynamicNodeList.cpp: + (WebCore::DynamicNodeListCacheBase::reportMemoryUsage): + (WebCore): + (WebCore::DynamicNodeList::reportMemoryUsage): + (WebCore::DynamicSubtreeNodeList::reportMemoryUsage): + * dom/DynamicNodeList.h: + (WebCore::DynamicNodeListCacheBase::~DynamicNodeListCacheBase): + (DynamicNodeListCacheBase): + (DynamicNodeList): + (DynamicSubtreeNodeList): + +2012-11-22 Kentaro Hara <haraken@chromium.org> + + Unreviewed, rolling out r135482. + http://trac.webkit.org/changeset/135482 + https://bugs.webkit.org/show_bug.cgi?id=103002 + + It broke Chrome/Linux Debug build + + * bindings/v8/V8StringResource.cpp: + * bindings/v8/V8StringResource.h: + * bindings/v8/V8ValueCache.cpp: + (WebCore::WebCoreStringResourceBase::toWebCoreStringResourceBase): + (WebCore): + (WebCore::WebCoreStringResourceBase::visitStrings): + * bindings/v8/V8ValueCache.h: + (WebCore): + (WebCoreStringResourceBase): + (WebCore::WebCoreStringResourceBase::WebCoreStringResourceBase): + (WebCore::WebCoreStringResourceBase::~WebCoreStringResourceBase): + (WebCore::WebCoreStringResourceBase::webcoreString): + (WebCore::WebCoreStringResourceBase::atomicString): + (WebCore::WebCoreStringResourceBase::memoryConsumption): + (WebCoreStringResource16): + (WebCore::WebCoreStringResource16::WebCoreStringResource16): + (WebCoreStringResource8): + (WebCore::WebCoreStringResource8::WebCoreStringResource8): + +2012-11-22 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r134927 and r134944. + http://trac.webkit.org/changeset/134927 + http://trac.webkit.org/changeset/134944 + https://bugs.webkit.org/show_bug.cgi?id=103028 + + Reverting the reverts after merging. (Requested by vsevik on + #webkit). + + * English.lproj/localizedStrings.js: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * inspector/compile-front-end.py: + * inspector/front-end/AdvancedSearchController.js: + * inspector/front-end/CallStackSidebarPane.js: + (WebInspector.CallStackSidebarPane.prototype.registerShortcuts): + * inspector/front-end/ConsoleView.js: + (WebInspector.ConsoleView.prototype._registerShortcuts): + * inspector/front-end/ElementsPanel.js: + (WebInspector.ElementsPanel): + * inspector/front-end/ElementsPanelDescriptor.js: + (WebInspector.ElementsPanelDescriptor.prototype.registerShortcuts): + * inspector/front-end/GoToLineDialog.js: + (WebInspector.GoToLineDialog.install): + * inspector/front-end/KeyboardShortcut.js: + (WebInspector.KeyboardShortcut._keyName): + * inspector/front-end/Panel.js: + (WebInspector.Panel.prototype.registerShortcuts): + (WebInspector.PanelDescriptor.prototype.panel): + (WebInspector.PanelDescriptor.prototype.registerShortcuts): + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel): + (WebInspector.ScriptsPanel.prototype._createDebugToolbar): + (WebInspector.ScriptsPanel.prototype._createButtonAndRegisterShortcuts): + * inspector/front-end/ScriptsPanelDescriptor.js: + (WebInspector.ScriptsPanelDescriptor.prototype.registerShortcuts): + * inspector/front-end/ShortcutsScreen.js: + (WebInspector.ShortcutsScreen): + (WebInspector.ShortcutsSection): + (WebInspector.ShortcutsSection.prototype._renderKey): + * inspector/front-end/StylesSidebarPane.js: + * inspector/front-end/TimelinePanel.js: + (WebInspector.TimelinePanel.prototype._registerShortcuts): + * inspector/front-end/TimelinePanelDescriptor.js: Copied from Source/WebCore/inspector/front-end/ScriptsPanelDescriptor.js. + (WebInspector.TimelinePanelDescriptor): + (WebInspector.TimelinePanelDescriptor.prototype.registerShortcuts): + * inspector/front-end/WebKit.qrc: + * inspector/front-end/inspector.html: + * inspector/front-end/inspector.js: + (WebInspector._panelDescriptors): + (WebInspector._registerShortcuts): + 2012-11-21 Sheriff Bot <webkit.review.bot@gmail.com> Unreviewed, rolling out r135433 and r135479. diff --git a/Source/WebCore/DerivedSources.make b/Source/WebCore/DerivedSources.make index f8d9ae725..05896f18e 100644 --- a/Source/WebCore/DerivedSources.make +++ b/Source/WebCore/DerivedSources.make @@ -196,6 +196,7 @@ BINDING_IDLS = \ $(WebCore)/css/WebKitCSSMatrix.idl \ $(WebCore)/css/WebKitCSSRegionRule.idl \ $(WebCore)/css/WebKitCSSTransformValue.idl \ + $(WebCore)/css/WebKitCSSViewportRule.idl \ $(WebCore)/dom/Attr.idl \ $(WebCore)/dom/BeforeLoadEvent.idl \ $(WebCore)/dom/CDATASection.idl \ diff --git a/Source/WebCore/DerivedSources.pri b/Source/WebCore/DerivedSources.pri index 543708155..3686cc47b 100644 --- a/Source/WebCore/DerivedSources.pri +++ b/Source/WebCore/DerivedSources.pri @@ -213,6 +213,7 @@ IDL_BINDINGS += \ $$PWD/css/WebKitCSSMatrix.idl \ $$PWD/css/WebKitCSSRegionRule.idl \ $$PWD/css/WebKitCSSTransformValue.idl \ + $$PWD/css/WebKitCSSViewportRule.idl \ $$PWD/dom/Attr.idl \ $$PWD/dom/BeforeLoadEvent.idl \ $$PWD/dom/CharacterData.idl \ diff --git a/Source/WebCore/English.lproj/localizedStrings.js b/Source/WebCore/English.lproj/localizedStrings.js index 659dac41d..e420fa50a 100644 --- a/Source/WebCore/English.lproj/localizedStrings.js +++ b/Source/WebCore/English.lproj/localizedStrings.js @@ -221,8 +221,10 @@ localizedStrings["Hide console."] = "Hide console."; localizedStrings["Hide the records that are shorter than %s"] = "Hide the Precords that are shorter than %s"; localizedStrings["Image"] = "Image"; localizedStrings["Images"] = "Images"; -localizedStrings["Increment/decrement by %f"] = "Increment/decrement by %f"; -localizedStrings["Increment/decrement value"] = "Increment/decrement value"; +localizedStrings["Increment by %f"] = "Increment by %f"; +localizedStrings["Decrement by %f"] = "Decrement by %f"; +localizedStrings["Increment value"] = "Increment value"; +localizedStrings["Decrement value"] = "Decrement value"; localizedStrings["Inherited from"] = "Inherited from"; localizedStrings["Initiator"] = "Initiator"; localizedStrings["Inspected worker terminated"] = "Inspected worker terminated"; @@ -255,7 +257,7 @@ localizedStrings["Next/previous call frame"] = "Next/previous call frame"; localizedStrings["Next/previous command"] = "Next/previous command"; localizedStrings["Next/previous line"] = "Next/previous line"; localizedStrings["Next/previous property"] = "Next/previous property"; -localizedStrings["Next/previous suggestion"] = "Next/previous suggestion"; +localizedStrings["Autocomplete common prefix"] = "Autocomplete common prefix"; localizedStrings["No Application Cache information available."] = "No Application Cache information available."; localizedStrings["No Breakpoints"] = "No Breakpoints"; localizedStrings["No CSS Named Flows"] = "No CSS Named Flows"; diff --git a/Source/WebCore/GNUmakefile.am b/Source/WebCore/GNUmakefile.am index 56e91c49b..0ad046c0b 100644 --- a/Source/WebCore/GNUmakefile.am +++ b/Source/WebCore/GNUmakefile.am @@ -274,6 +274,31 @@ DerivedSources/WebCore/MathMLElementFactory.cpp DerivedSources/WebCore/MathMLNam # FIXME: allow a more fine-grained inclusion/generation of sources per SVG feature # ---- if ENABLE_SVG +nodist_libWebCoreSVG_la_SOURCES = \ + $(webcore_svg_built_sources) + +libWebCoreSVG_la_SOURCES = \ + $(webcore_svg_sources) + +libWebCoreSVG_la_CXXFLAGS = \ + $(SYMBOL_VISIBILITY_INLINES) \ + $(global_cxxflags) + +libWebCoreSVG_la_CFLAGS = \ + $(SYMBOL_VISIBILITY) \ + $(global_cflags) + +libWebCoreSVG_la_CPPFLAGS = \ + -DBUILDING_WebCore \ + -DBUILDING_WEBKIT \ + $(global_cppflags) \ + $(webcore_cppflags) \ + $(webcoregtk_cppflags) \ + $(javascriptcore_cppflags) \ + -fno-strict-aliasing \ + $(CAIRO_CFLAGS) \ + $(LIBSOUP_CFLAGS) + feature_defines_overrides += ENABLE_SVG=1 WEBCORE_CSS_PROPERTY_NAMES += $(WebCore)/css/SVGCSSPropertyNames.in WEBCORE_CSS_VALUE_KEYWORDS += $(WebCore)/css/SVGCSSValueKeywords.in @@ -605,6 +630,11 @@ noinst_LTLIBRARIES += \ libWebCoreModules.la \ libWebCore.la +if ENABLE_SVG +noinst_LTLIBRARIES += \ + libWebCoreSVG.la +endif + # Artificial dependency to try to force a relink of the WebCore libraries # When their makefiles change. webcore_lib_for_dep = libWebCore.la @@ -616,6 +646,9 @@ $(webcoremodules_lib_for_dep): $(srcdir)/Source/WebCore/GNUmakefile.am $(srcdir) webcoreplatform_lib_for_dep = libWebcorePlatform.la $(webcoreplatform_lib_for_dep): $(srcdir)/Source/WebCore/GNUmakefile.am $(srcdir)/Source/WebCore/GNUmakefile.list.am +webcoresvg_lib_for_dep = libWebCoreSVG.la +$(webcoresvg_lib_for_dep): $(srcdir)/Source/WebCore/GNUmakefile.am $(srcdir)/Source/WebCore/GNUmakefile.list.am + nodist_EXTRA_libWebCore_la_SOURCES = \ $(webcore_built_nosources) diff --git a/Source/WebCore/GNUmakefile.list.am b/Source/WebCore/GNUmakefile.list.am index b6477bb0a..deb87bb87 100644 --- a/Source/WebCore/GNUmakefile.list.am +++ b/Source/WebCore/GNUmakefile.list.am @@ -715,6 +715,171 @@ webcore_built_sources += \ DerivedSources/WebCore/JSStyleSheet.h \ DerivedSources/WebCore/JSStyleSheetList.cpp \ DerivedSources/WebCore/JSStyleSheetList.h \ + DerivedSources/WebCore/JSText.cpp \ + DerivedSources/WebCore/JSTextEvent.cpp \ + DerivedSources/WebCore/JSTextEvent.h \ + DerivedSources/WebCore/JSText.h \ + DerivedSources/WebCore/JSTextMetrics.cpp \ + DerivedSources/WebCore/JSTextMetrics.h \ + DerivedSources/WebCore/JSTextTrack.cpp \ + DerivedSources/WebCore/JSTextTrack.h \ + DerivedSources/WebCore/JSTextTrackCue.cpp \ + DerivedSources/WebCore/JSTextTrackCue.h \ + DerivedSources/WebCore/JSTextTrackCueList.cpp \ + DerivedSources/WebCore/JSTextTrackCueList.h \ + DerivedSources/WebCore/JSTextTrackList.cpp \ + DerivedSources/WebCore/JSTextTrackList.h \ + DerivedSources/WebCore/JSTimeRanges.cpp \ + DerivedSources/WebCore/JSTimeRanges.h \ + DerivedSources/WebCore/JSTouch.cpp \ + DerivedSources/WebCore/JSTouchEvent.cpp \ + DerivedSources/WebCore/JSTouchEvent.h \ + DerivedSources/WebCore/JSTouch.h \ + DerivedSources/WebCore/JSTouchList.cpp \ + DerivedSources/WebCore/JSTouchList.h \ + DerivedSources/WebCore/JSTrackEvent.cpp \ + DerivedSources/WebCore/JSTrackEvent.h \ + DerivedSources/WebCore/JSTreeWalker.cpp \ + DerivedSources/WebCore/JSTreeWalker.h \ + DerivedSources/WebCore/JSUIEvent.cpp \ + DerivedSources/WebCore/JSUIEvent.h \ + DerivedSources/WebCore/JSUint16Array.cpp \ + DerivedSources/WebCore/JSUint16Array.h \ + DerivedSources/WebCore/JSUint32Array.cpp \ + DerivedSources/WebCore/JSUint32Array.h \ + DerivedSources/WebCore/JSUint8Array.cpp \ + DerivedSources/WebCore/JSUint8Array.h \ + DerivedSources/WebCore/JSUint8ClampedArray.cpp \ + DerivedSources/WebCore/JSUint8ClampedArray.h \ + DerivedSources/WebCore/JSValidityState.cpp \ + DerivedSources/WebCore/JSValidityState.h \ + DerivedSources/WebCore/JSVoidCallback.cpp \ + DerivedSources/WebCore/JSVoidCallback.h \ + DerivedSources/WebCore/JSWaveShaperNode.cpp \ + DerivedSources/WebCore/JSWaveShaperNode.h \ + DerivedSources/WebCore/JSWaveTable.cpp \ + DerivedSources/WebCore/JSWaveTable.h \ + DerivedSources/WebCore/JSWebGLActiveInfo.cpp \ + DerivedSources/WebCore/JSWebGLActiveInfo.h \ + DerivedSources/WebCore/JSWebGLBuffer.cpp \ + DerivedSources/WebCore/JSWebGLBuffer.h \ + DerivedSources/WebCore/JSWebGLCompressedTextureS3TC.cpp \ + DerivedSources/WebCore/JSWebGLCompressedTextureS3TC.h \ + DerivedSources/WebCore/JSWebGLContextAttributes.cpp \ + DerivedSources/WebCore/JSWebGLContextAttributes.h \ + DerivedSources/WebCore/JSWebGLContextEvent.cpp \ + DerivedSources/WebCore/JSWebGLContextEvent.h \ + DerivedSources/WebCore/JSWebGLDepthTexture.cpp \ + DerivedSources/WebCore/JSWebGLDepthTexture.h \ + DerivedSources/WebCore/JSWebGLFramebuffer.cpp \ + DerivedSources/WebCore/JSWebGLFramebuffer.h \ + DerivedSources/WebCore/JSWebGLLoseContext.cpp \ + DerivedSources/WebCore/JSWebGLLoseContext.h \ + DerivedSources/WebCore/JSWebGLProgram.cpp \ + DerivedSources/WebCore/JSWebGLProgram.h \ + DerivedSources/WebCore/JSWebGLRenderbuffer.cpp \ + DerivedSources/WebCore/JSWebGLRenderbuffer.h \ + DerivedSources/WebCore/JSWebGLRenderingContext.cpp \ + DerivedSources/WebCore/JSWebGLRenderingContext.h \ + DerivedSources/WebCore/JSWebGLShader.cpp \ + DerivedSources/WebCore/JSWebGLShader.h \ + DerivedSources/WebCore/JSWebGLShaderPrecisionFormat.cpp \ + DerivedSources/WebCore/JSWebGLShaderPrecisionFormat.h \ + DerivedSources/WebCore/JSWebGLTexture.cpp \ + DerivedSources/WebCore/JSWebGLTexture.h \ + DerivedSources/WebCore/JSWebGLUniformLocation.cpp \ + DerivedSources/WebCore/JSWebGLUniformLocation.h \ + DerivedSources/WebCore/JSWebGLVertexArrayObjectOES.cpp \ + DerivedSources/WebCore/JSWebGLVertexArrayObjectOES.h \ + DerivedSources/WebCore/JSWebKitAnimation.cpp \ + DerivedSources/WebCore/JSWebKitAnimation.h \ + DerivedSources/WebCore/JSWebKitAnimationEvent.cpp \ + DerivedSources/WebCore/JSWebKitAnimationList.h \ + DerivedSources/WebCore/JSWebKitAnimationList.cpp \ + DerivedSources/WebCore/JSWebKitAnimationEvent.h \ + DerivedSources/WebCore/JSWebKitCSSFilterValue.cpp \ + DerivedSources/WebCore/JSWebKitCSSFilterValue.h \ + DerivedSources/WebCore/JSWebKitCSSKeyframeRule.cpp \ + DerivedSources/WebCore/JSWebKitCSSKeyframeRule.h \ + DerivedSources/WebCore/JSWebKitCSSKeyframesRule.cpp \ + DerivedSources/WebCore/JSWebKitCSSKeyframesRule.h \ + DerivedSources/WebCore/JSWebKitCSSMatrix.cpp \ + DerivedSources/WebCore/JSWebKitCSSMatrix.h \ + DerivedSources/WebCore/JSWebKitCSSRegionRule.cpp \ + DerivedSources/WebCore/JSWebKitCSSRegionRule.h \ + DerivedSources/WebCore/JSWebKitCSSTransformValue.cpp \ + DerivedSources/WebCore/JSWebKitCSSTransformValue.h \ + DerivedSources/WebCore/JSWebKitCSSViewportRule.cpp \ + DerivedSources/WebCore/JSWebKitCSSViewportRule.h \ + DerivedSources/WebCore/JSWebKitNamedFlow.cpp \ + DerivedSources/WebCore/JSWebKitNamedFlow.h \ + DerivedSources/WebCore/JSWebKitPoint.cpp \ + DerivedSources/WebCore/JSWebKitPoint.h \ + DerivedSources/WebCore/JSWebKitTransitionEvent.cpp \ + DerivedSources/WebCore/JSWebKitTransitionEvent.h \ + DerivedSources/WebCore/JSWebSocket.cpp \ + DerivedSources/WebCore/JSWebSocket.h \ + DerivedSources/WebCore/JSWheelEvent.cpp \ + DerivedSources/WebCore/JSWheelEvent.h \ + DerivedSources/WebCore/JSWorkerContext.cpp \ + DerivedSources/WebCore/JSWorkerContext.h \ + DerivedSources/WebCore/JSWorker.cpp \ + DerivedSources/WebCore/JSWorker.h \ + DerivedSources/WebCore/JSWorkerLocation.cpp \ + DerivedSources/WebCore/JSWorkerLocation.h \ + DerivedSources/WebCore/JSWorkerNavigator.cpp \ + DerivedSources/WebCore/JSWorkerNavigator.h \ + DerivedSources/WebCore/JSXMLHttpRequest.cpp \ + DerivedSources/WebCore/JSXMLHttpRequestException.cpp \ + DerivedSources/WebCore/JSXMLHttpRequestException.h \ + DerivedSources/WebCore/JSXMLHttpRequest.h \ + DerivedSources/WebCore/JSXMLHttpRequestProgressEvent.cpp \ + DerivedSources/WebCore/JSXMLHttpRequestProgressEvent.h \ + DerivedSources/WebCore/JSXMLHttpRequestUpload.cpp \ + DerivedSources/WebCore/JSXMLHttpRequestUpload.h \ + DerivedSources/WebCore/JSXMLSerializer.cpp \ + DerivedSources/WebCore/JSXMLSerializer.h \ + DerivedSources/WebCore/JSXPathEvaluator.cpp \ + DerivedSources/WebCore/JSXPathEvaluator.h \ + DerivedSources/WebCore/JSXPathException.cpp \ + DerivedSources/WebCore/JSXPathException.h \ + DerivedSources/WebCore/JSXPathExpression.cpp \ + DerivedSources/WebCore/JSXPathExpression.h \ + DerivedSources/WebCore/JSXPathNSResolver.cpp \ + DerivedSources/WebCore/JSXPathNSResolver.h \ + DerivedSources/WebCore/JSXPathResult.cpp \ + DerivedSources/WebCore/JSXPathResult.h \ + DerivedSources/WebCore/JSXSLTProcessor.cpp \ + DerivedSources/WebCore/JSXSLTProcessor.h \ + DerivedSources/WebCore/MathMLElementFactory.cpp \ + DerivedSources/WebCore/MathMLElementFactory.h \ + DerivedSources/WebCore/MathMLNames.cpp \ + DerivedSources/WebCore/MathMLNames.h \ + DerivedSources/WebCore/SettingsMacros.h \ + DerivedSources/WebCore/UserAgentGtk.h \ + DerivedSources/WebCore/UserAgentStyleSheetsData.cpp \ + DerivedSources/WebCore/UserAgentStyleSheets.h \ + DerivedSources/WebCore/WebKitFontFamilyNames.cpp \ + DerivedSources/WebCore/WebKitFontFamilyNames.h \ + DerivedSources/WebCore/XLinkNames.cpp \ + DerivedSources/WebCore/XMLNames.cpp \ + DerivedSources/WebCore/XMLNames.h \ + DerivedSources/WebCore/XMLNSNames.cpp \ + DerivedSources/WebCore/XMLNSNames.h \ + DerivedSources/WebCore/XMLViewerCSS.h \ + DerivedSources/WebCore/XMLViewerJS.h \ + DerivedSources/WebCore/XPathGrammar.cpp \ + DerivedSources/WebCore/XPathGrammar.h + +# These files need to be part of WebCore otherwise they cause undefined +# symbols havoc +webcore_built_sources += \ + DerivedSources/WebCore/JSSVGDocument.cpp \ + DerivedSources/WebCore/JSSVGDocument.h \ + DerivedSources/WebCore/SVGNames.cpp \ + DerivedSources/WebCore/SVGElementFactory.cpp + +webcore_svg_built_sources += \ DerivedSources/WebCore/JSSVGAElement.cpp \ DerivedSources/WebCore/JSSVGAElement.h \ DerivedSources/WebCore/JSSVGAltGlyphDefElement.cpp \ @@ -773,8 +938,6 @@ webcore_built_sources += \ DerivedSources/WebCore/JSSVGDefsElement.h \ DerivedSources/WebCore/JSSVGDescElement.cpp \ DerivedSources/WebCore/JSSVGDescElement.h \ - DerivedSources/WebCore/JSSVGDocument.cpp \ - DerivedSources/WebCore/JSSVGDocument.h \ DerivedSources/WebCore/JSSVGElement.cpp \ DerivedSources/WebCore/JSSVGElement.h \ DerivedSources/WebCore/JSSVGElementInstance.cpp \ @@ -1010,162 +1173,7 @@ webcore_built_sources += \ DerivedSources/WebCore/JSSVGZoomAndPan.cpp \ DerivedSources/WebCore/JSSVGZoomAndPan.h \ DerivedSources/WebCore/JSSVGZoomEvent.cpp \ - DerivedSources/WebCore/JSSVGZoomEvent.h \ - DerivedSources/WebCore/JSText.cpp \ - DerivedSources/WebCore/JSTextEvent.cpp \ - DerivedSources/WebCore/JSTextEvent.h \ - DerivedSources/WebCore/JSText.h \ - DerivedSources/WebCore/JSTextMetrics.cpp \ - DerivedSources/WebCore/JSTextMetrics.h \ - DerivedSources/WebCore/JSTextTrack.cpp \ - DerivedSources/WebCore/JSTextTrack.h \ - DerivedSources/WebCore/JSTextTrackCue.cpp \ - DerivedSources/WebCore/JSTextTrackCue.h \ - DerivedSources/WebCore/JSTextTrackCueList.cpp \ - DerivedSources/WebCore/JSTextTrackCueList.h \ - DerivedSources/WebCore/JSTextTrackList.cpp \ - DerivedSources/WebCore/JSTextTrackList.h \ - DerivedSources/WebCore/JSTimeRanges.cpp \ - DerivedSources/WebCore/JSTimeRanges.h \ - DerivedSources/WebCore/JSTouch.cpp \ - DerivedSources/WebCore/JSTouchEvent.cpp \ - DerivedSources/WebCore/JSTouchEvent.h \ - DerivedSources/WebCore/JSTouch.h \ - DerivedSources/WebCore/JSTouchList.cpp \ - DerivedSources/WebCore/JSTouchList.h \ - DerivedSources/WebCore/JSTrackEvent.cpp \ - DerivedSources/WebCore/JSTrackEvent.h \ - DerivedSources/WebCore/JSTreeWalker.cpp \ - DerivedSources/WebCore/JSTreeWalker.h \ - DerivedSources/WebCore/JSUIEvent.cpp \ - DerivedSources/WebCore/JSUIEvent.h \ - DerivedSources/WebCore/JSUint16Array.cpp \ - DerivedSources/WebCore/JSUint16Array.h \ - DerivedSources/WebCore/JSUint32Array.cpp \ - DerivedSources/WebCore/JSUint32Array.h \ - DerivedSources/WebCore/JSUint8Array.cpp \ - DerivedSources/WebCore/JSUint8Array.h \ - DerivedSources/WebCore/JSUint8ClampedArray.cpp \ - DerivedSources/WebCore/JSUint8ClampedArray.h \ - DerivedSources/WebCore/JSValidityState.cpp \ - DerivedSources/WebCore/JSValidityState.h \ - DerivedSources/WebCore/JSVoidCallback.cpp \ - DerivedSources/WebCore/JSVoidCallback.h \ - DerivedSources/WebCore/JSWaveShaperNode.cpp \ - DerivedSources/WebCore/JSWaveShaperNode.h \ - DerivedSources/WebCore/JSWaveTable.cpp \ - DerivedSources/WebCore/JSWaveTable.h \ - DerivedSources/WebCore/JSWebGLActiveInfo.cpp \ - DerivedSources/WebCore/JSWebGLActiveInfo.h \ - DerivedSources/WebCore/JSWebGLBuffer.cpp \ - DerivedSources/WebCore/JSWebGLBuffer.h \ - DerivedSources/WebCore/JSWebGLCompressedTextureS3TC.cpp \ - DerivedSources/WebCore/JSWebGLCompressedTextureS3TC.h \ - DerivedSources/WebCore/JSWebGLContextAttributes.cpp \ - DerivedSources/WebCore/JSWebGLContextAttributes.h \ - DerivedSources/WebCore/JSWebGLContextEvent.cpp \ - DerivedSources/WebCore/JSWebGLContextEvent.h \ - DerivedSources/WebCore/JSWebGLDepthTexture.cpp \ - DerivedSources/WebCore/JSWebGLDepthTexture.h \ - DerivedSources/WebCore/JSWebGLFramebuffer.cpp \ - DerivedSources/WebCore/JSWebGLFramebuffer.h \ - DerivedSources/WebCore/JSWebGLLoseContext.cpp \ - DerivedSources/WebCore/JSWebGLLoseContext.h \ - DerivedSources/WebCore/JSWebGLProgram.cpp \ - DerivedSources/WebCore/JSWebGLProgram.h \ - DerivedSources/WebCore/JSWebGLRenderbuffer.cpp \ - DerivedSources/WebCore/JSWebGLRenderbuffer.h \ - DerivedSources/WebCore/JSWebGLRenderingContext.cpp \ - DerivedSources/WebCore/JSWebGLRenderingContext.h \ - DerivedSources/WebCore/JSWebGLShader.cpp \ - DerivedSources/WebCore/JSWebGLShader.h \ - DerivedSources/WebCore/JSWebGLShaderPrecisionFormat.cpp \ - DerivedSources/WebCore/JSWebGLShaderPrecisionFormat.h \ - DerivedSources/WebCore/JSWebGLTexture.cpp \ - DerivedSources/WebCore/JSWebGLTexture.h \ - DerivedSources/WebCore/JSWebGLUniformLocation.cpp \ - DerivedSources/WebCore/JSWebGLUniformLocation.h \ - DerivedSources/WebCore/JSWebGLVertexArrayObjectOES.cpp \ - DerivedSources/WebCore/JSWebGLVertexArrayObjectOES.h \ - DerivedSources/WebCore/JSWebKitAnimation.cpp \ - DerivedSources/WebCore/JSWebKitAnimation.h \ - DerivedSources/WebCore/JSWebKitAnimationEvent.cpp \ - DerivedSources/WebCore/JSWebKitAnimationList.h \ - DerivedSources/WebCore/JSWebKitAnimationList.cpp \ - DerivedSources/WebCore/JSWebKitAnimationEvent.h \ - DerivedSources/WebCore/JSWebKitCSSFilterValue.cpp \ - DerivedSources/WebCore/JSWebKitCSSFilterValue.h \ - DerivedSources/WebCore/JSWebKitCSSKeyframeRule.cpp \ - DerivedSources/WebCore/JSWebKitCSSKeyframeRule.h \ - DerivedSources/WebCore/JSWebKitCSSKeyframesRule.cpp \ - DerivedSources/WebCore/JSWebKitCSSKeyframesRule.h \ - DerivedSources/WebCore/JSWebKitCSSMatrix.cpp \ - DerivedSources/WebCore/JSWebKitCSSMatrix.h \ - DerivedSources/WebCore/JSWebKitCSSRegionRule.cpp \ - DerivedSources/WebCore/JSWebKitCSSRegionRule.h \ - DerivedSources/WebCore/JSWebKitCSSTransformValue.cpp \ - DerivedSources/WebCore/JSWebKitCSSTransformValue.h \ - DerivedSources/WebCore/JSWebKitNamedFlow.cpp \ - DerivedSources/WebCore/JSWebKitNamedFlow.h \ - DerivedSources/WebCore/JSWebKitPoint.cpp \ - DerivedSources/WebCore/JSWebKitPoint.h \ - DerivedSources/WebCore/JSWebKitTransitionEvent.cpp \ - DerivedSources/WebCore/JSWebKitTransitionEvent.h \ - DerivedSources/WebCore/JSWebSocket.cpp \ - DerivedSources/WebCore/JSWebSocket.h \ - DerivedSources/WebCore/JSWheelEvent.cpp \ - DerivedSources/WebCore/JSWheelEvent.h \ - DerivedSources/WebCore/JSWorkerContext.cpp \ - DerivedSources/WebCore/JSWorkerContext.h \ - DerivedSources/WebCore/JSWorker.cpp \ - DerivedSources/WebCore/JSWorker.h \ - DerivedSources/WebCore/JSWorkerLocation.cpp \ - DerivedSources/WebCore/JSWorkerLocation.h \ - DerivedSources/WebCore/JSWorkerNavigator.cpp \ - DerivedSources/WebCore/JSWorkerNavigator.h \ - DerivedSources/WebCore/JSXMLHttpRequest.cpp \ - DerivedSources/WebCore/JSXMLHttpRequestException.cpp \ - DerivedSources/WebCore/JSXMLHttpRequestException.h \ - DerivedSources/WebCore/JSXMLHttpRequest.h \ - DerivedSources/WebCore/JSXMLHttpRequestProgressEvent.cpp \ - DerivedSources/WebCore/JSXMLHttpRequestProgressEvent.h \ - DerivedSources/WebCore/JSXMLHttpRequestUpload.cpp \ - DerivedSources/WebCore/JSXMLHttpRequestUpload.h \ - DerivedSources/WebCore/JSXMLSerializer.cpp \ - DerivedSources/WebCore/JSXMLSerializer.h \ - DerivedSources/WebCore/JSXPathEvaluator.cpp \ - DerivedSources/WebCore/JSXPathEvaluator.h \ - DerivedSources/WebCore/JSXPathException.cpp \ - DerivedSources/WebCore/JSXPathException.h \ - DerivedSources/WebCore/JSXPathExpression.cpp \ - DerivedSources/WebCore/JSXPathExpression.h \ - DerivedSources/WebCore/JSXPathNSResolver.cpp \ - DerivedSources/WebCore/JSXPathNSResolver.h \ - DerivedSources/WebCore/JSXPathResult.cpp \ - DerivedSources/WebCore/JSXPathResult.h \ - DerivedSources/WebCore/JSXSLTProcessor.cpp \ - DerivedSources/WebCore/JSXSLTProcessor.h \ - DerivedSources/WebCore/MathMLElementFactory.cpp \ - DerivedSources/WebCore/MathMLElementFactory.h \ - DerivedSources/WebCore/MathMLNames.cpp \ - DerivedSources/WebCore/MathMLNames.h \ - DerivedSources/WebCore/SettingsMacros.h \ - DerivedSources/WebCore/SVGElementFactory.cpp \ - DerivedSources/WebCore/SVGNames.cpp \ - DerivedSources/WebCore/UserAgentGtk.h \ - DerivedSources/WebCore/UserAgentStyleSheetsData.cpp \ - DerivedSources/WebCore/UserAgentStyleSheets.h \ - DerivedSources/WebCore/WebKitFontFamilyNames.cpp \ - DerivedSources/WebCore/WebKitFontFamilyNames.h \ - DerivedSources/WebCore/XLinkNames.cpp \ - DerivedSources/WebCore/XMLNames.cpp \ - DerivedSources/WebCore/XMLNames.h \ - DerivedSources/WebCore/XMLNSNames.cpp \ - DerivedSources/WebCore/XMLNSNames.h \ - DerivedSources/WebCore/XMLViewerCSS.h \ - DerivedSources/WebCore/XMLViewerJS.h \ - DerivedSources/WebCore/XPathGrammar.cpp \ - DerivedSources/WebCore/XPathGrammar.h + DerivedSources/WebCore/JSSVGZoomEvent.h dom_binding_idls += \ $(WebCore)/Modules/filesystem/DOMFileSystem.idl \ @@ -1330,6 +1338,7 @@ dom_binding_idls += \ $(WebCore)/css/WebKitCSSMatrix.idl \ $(WebCore)/css/WebKitCSSRegionRule.idl \ $(WebCore)/css/WebKitCSSTransformValue.idl \ + $(WebCore)/css/WebKitCSSViewportRule.idl \ $(WebCore)/dom/Attr.idl \ $(WebCore)/dom/BeforeLoadEvent.idl \ $(WebCore)/dom/CDATASection.idl \ @@ -2367,9 +2376,6 @@ webcore_sources += \ Source/WebCore/bindings/js/JSSQLResultSetRowListCustom.cpp \ Source/WebCore/bindings/js/JSSQLTransactionCustom.cpp \ Source/WebCore/bindings/js/JSSQLTransactionSyncCustom.cpp \ - Source/WebCore/bindings/js/JSSVGElementInstanceCustom.cpp \ - Source/WebCore/bindings/js/JSSVGLengthCustom.cpp \ - Source/WebCore/bindings/js/JSSVGPathSegCustom.cpp \ Source/WebCore/bindings/js/JSSharedWorkerCustom.cpp \ Source/WebCore/bindings/js/JSStorageCustom.cpp \ Source/WebCore/bindings/js/JSStorageCustom.h \ @@ -2479,7 +2485,6 @@ webcore_sources += \ Source/WebCore/config.h \ Source/WebCore/css/BasicShapeFunctions.cpp \ Source/WebCore/css/BasicShapeFunctions.h \ - Source/WebCore/css/CachedSVGDocumentReference.h \ Source/WebCore/css/Counter.h \ Source/WebCore/css/CSSAspectRatioValue.cpp \ Source/WebCore/css/CSSAspectRatioValue.h \ @@ -2642,13 +2647,10 @@ webcore_sources += \ Source/WebCore/css/StyleSheetContents.h \ Source/WebCore/css/StyleSheetList.cpp \ Source/WebCore/css/StyleSheetList.h \ - Source/WebCore/css/SVGCSSComputedStyleDeclaration.cpp \ - Source/WebCore/css/SVGCSSParser.cpp \ - Source/WebCore/css/SVGCSSStyleSelector.cpp \ Source/WebCore/css/ViewportStyleResolver.cpp \ Source/WebCore/css/ViewportStyleResolver.h \ - Source/WebCore/css/WebKitCSSArrayFunctionValue.cpp \ - Source/WebCore/css/WebKitCSSArrayFunctionValue.h \ + Source/WebCore/css/WebKitCSSArrayFunctionValue.cpp \ + Source/WebCore/css/WebKitCSSArrayFunctionValue.h \ Source/WebCore/css/WebKitCSSFilterValue.cpp \ Source/WebCore/css/WebKitCSSFilterValue.h \ Source/WebCore/css/WebKitCSSKeyframeRule.cpp \ @@ -2661,8 +2663,6 @@ webcore_sources += \ Source/WebCore/css/WebKitCSSMixFunctionValue.h \ Source/WebCore/css/WebKitCSSRegionRule.cpp \ Source/WebCore/css/WebKitCSSRegionRule.h \ - Source/WebCore/css/WebKitCSSSVGDocumentValue.cpp \ - Source/WebCore/css/WebKitCSSSVGDocumentValue.h \ Source/WebCore/css/WebKitCSSShaderValue.cpp \ Source/WebCore/css/WebKitCSSShaderValue.h \ Source/WebCore/css/WebKitCSSTransformValue.cpp \ @@ -2774,8 +2774,6 @@ webcore_sources += \ Source/WebCore/dom/DOMTimeStamp.h \ Source/WebCore/dom/DynamicNodeList.cpp \ Source/WebCore/dom/DynamicNodeList.h \ - Source/WebCore/dom/EditingText.cpp \ - Source/WebCore/dom/EditingText.h \ Source/WebCore/dom/Element.cpp \ Source/WebCore/dom/Element.h \ Source/WebCore/dom/ElementAttributeData.cpp \ @@ -3841,9 +3839,6 @@ webcore_sources += \ Source/WebCore/loader/cache/CachedShader.cpp \ Source/WebCore/loader/cache/CachedShader.h \ Source/WebCore/loader/cache/CachedStyleSheetClient.h \ - Source/WebCore/loader/cache/CachedSVGDocument.cpp \ - Source/WebCore/loader/cache/CachedSVGDocument.h \ - Source/WebCore/loader/cache/CachedSVGDocumentReference.h \ Source/WebCore/loader/cache/CachedTextTrack.cpp \ Source/WebCore/loader/cache/CachedTextTrack.h \ Source/WebCore/loader/cache/CachedXSLStyleSheet.cpp \ @@ -4504,6 +4499,165 @@ webcore_sources += \ Source/WebCore/rendering/style/StyleVariableData.h \ Source/WebCore/rendering/style/StyleVisualData.cpp \ Source/WebCore/rendering/style/StyleVisualData.h \ + Source/WebCore/rendering/TableLayout.h \ + Source/WebCore/rendering/TrailingFloatsRootInlineBox.h \ + Source/WebCore/storage/StorageTask.cpp \ + Source/WebCore/storage/StorageTask.h \ + Source/WebCore/storage/StorageThread.cpp \ + Source/WebCore/storage/StorageThread.h \ + Source/WebCore/storage/StorageArea.h \ + Source/WebCore/storage/StorageAreaImpl.cpp \ + Source/WebCore/storage/StorageAreaImpl.h \ + Source/WebCore/storage/StorageAreaSync.cpp \ + Source/WebCore/storage/StorageAreaSync.h \ + Source/WebCore/storage/Storage.cpp \ + Source/WebCore/storage/Storage.h \ + Source/WebCore/storage/StorageEvent.cpp \ + Source/WebCore/storage/StorageEvent.h \ + Source/WebCore/storage/StorageEventDispatcher.cpp \ + Source/WebCore/storage/StorageEventDispatcher.h \ + Source/WebCore/storage/StorageMap.cpp \ + Source/WebCore/storage/StorageMap.h \ + Source/WebCore/storage/StorageNamespace.cpp \ + Source/WebCore/storage/StorageNamespace.h \ + Source/WebCore/storage/StorageNamespaceImpl.cpp \ + Source/WebCore/storage/StorageNamespaceImpl.h \ + Source/WebCore/storage/StorageSyncManager.cpp \ + Source/WebCore/storage/StorageSyncManager.h \ + Source/WebCore/storage/StorageTracker.cpp \ + Source/WebCore/storage/StorageTracker.h \ + Source/WebCore/storage/StorageTrackerClient.h \ + Source/WebCore/WebCorePrefix.h \ + Source/WebCore/workers/AbstractWorker.cpp \ + Source/WebCore/workers/AbstractWorker.h \ + Source/WebCore/workers/DedicatedWorkerContext.cpp \ + Source/WebCore/workers/DedicatedWorkerContext.h \ + Source/WebCore/workers/DedicatedWorkerThread.cpp \ + Source/WebCore/workers/DedicatedWorkerThread.h \ + Source/WebCore/workers/DefaultSharedWorkerRepository.cpp \ + Source/WebCore/workers/DefaultSharedWorkerRepository.h \ + Source/WebCore/workers/SharedWorkerContext.cpp \ + Source/WebCore/workers/SharedWorkerContext.h \ + Source/WebCore/workers/SharedWorker.cpp \ + Source/WebCore/workers/SharedWorker.h \ + Source/WebCore/workers/SharedWorkerRepository.h \ + Source/WebCore/workers/SharedWorkerStrategy.h \ + Source/WebCore/workers/SharedWorkerThread.cpp \ + Source/WebCore/workers/SharedWorkerThread.h \ + Source/WebCore/workers/WorkerContext.cpp \ + Source/WebCore/workers/WorkerContext.h \ + Source/WebCore/workers/WorkerContextProxy.h \ + Source/WebCore/workers/WorkerEventQueue.cpp \ + Source/WebCore/workers/WorkerEventQueue.h \ + Source/WebCore/workers/Worker.cpp \ + Source/WebCore/workers/Worker.h \ + Source/WebCore/workers/WorkerLoaderProxy.h \ + Source/WebCore/workers/WorkerLocation.cpp \ + Source/WebCore/workers/WorkerLocation.h \ + Source/WebCore/workers/WorkerMessagingProxy.cpp \ + Source/WebCore/workers/WorkerMessagingProxy.h \ + Source/WebCore/workers/WorkerObjectProxy.h \ + Source/WebCore/workers/WorkerReportingProxy.h \ + Source/WebCore/workers/WorkerRunLoop.cpp \ + Source/WebCore/workers/WorkerRunLoop.h \ + Source/WebCore/workers/WorkerScriptLoaderClient.h \ + Source/WebCore/workers/WorkerScriptLoader.cpp \ + Source/WebCore/workers/WorkerScriptLoader.h \ + Source/WebCore/workers/WorkerThread.cpp \ + Source/WebCore/workers/WorkerThread.h \ + Source/WebCore/xml/parser/CharacterReferenceParserInlines.h \ + Source/WebCore/xml/parser/MarkupTokenBase.h \ + Source/WebCore/xml/parser/MarkupTokenizerBase.h \ + Source/WebCore/xml/parser/MarkupTokenizerInlines.h \ + Source/WebCore/xml/parser/NewXMLDocumentParser.cpp \ + Source/WebCore/xml/parser/NewXMLDocumentParser.h \ + Source/WebCore/xml/parser/XMLCharacterReferenceParser.cpp \ + Source/WebCore/xml/parser/XMLCharacterReferenceParser.h \ + Source/WebCore/xml/parser/XMLDocumentParser.cpp \ + Source/WebCore/xml/parser/XMLDocumentParser.h \ + Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp \ + Source/WebCore/xml/parser/XMLDocumentParserScope.cpp \ + Source/WebCore/xml/parser/XMLDocumentParserScope.h \ + Source/WebCore/xml/parser/XMLTokenizer.cpp \ + Source/WebCore/xml/parser/XMLTokenizer.h \ + Source/WebCore/xml/parser/XMLToken.h \ + Source/WebCore/xml/parser/XMLTreeBuilder.cpp \ + Source/WebCore/xml/parser/XMLTreeBuilder.h \ + Source/WebCore/xml/DOMParser.cpp \ + Source/WebCore/xml/DOMParser.h \ + Source/WebCore/xml/NativeXPathNSResolver.cpp \ + Source/WebCore/xml/NativeXPathNSResolver.h \ + Source/WebCore/xml/XMLErrors.cpp \ + Source/WebCore/xml/XMLErrors.h \ + Source/WebCore/xml/XMLHttpRequest.cpp \ + Source/WebCore/xml/XMLHttpRequestException.cpp \ + Source/WebCore/xml/XMLHttpRequestException.h \ + Source/WebCore/xml/XMLHttpRequest.h \ + Source/WebCore/xml/XMLHttpRequestProgressEvent.h \ + Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.cpp \ + Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.h \ + Source/WebCore/xml/XMLHttpRequestUpload.cpp \ + Source/WebCore/xml/XMLHttpRequestUpload.h \ + Source/WebCore/xml/XMLTreeViewer.cpp \ + Source/WebCore/xml/XMLTreeViewer.h \ + Source/WebCore/xml/XMLSerializer.cpp \ + Source/WebCore/xml/XMLSerializer.h \ + Source/WebCore/xml/XPathEvaluator.cpp \ + Source/WebCore/xml/XPathEvaluator.h \ + Source/WebCore/xml/XPathException.cpp \ + Source/WebCore/xml/XPathException.h \ + Source/WebCore/xml/XPathExpression.cpp \ + Source/WebCore/xml/XPathExpression.h \ + Source/WebCore/xml/XPathExpressionNode.cpp \ + Source/WebCore/xml/XPathExpressionNode.h \ + Source/WebCore/xml/XPathFunctions.cpp \ + Source/WebCore/xml/XPathFunctions.h \ + Source/WebCore/xml/XPathNodeSet.cpp \ + Source/WebCore/xml/XPathNodeSet.h \ + Source/WebCore/xml/XPathNSResolver.cpp \ + Source/WebCore/xml/XPathNSResolver.h \ + Source/WebCore/xml/XPathParser.cpp \ + Source/WebCore/xml/XPathParser.h \ + Source/WebCore/xml/XPathPath.cpp \ + Source/WebCore/xml/XPathPath.h \ + Source/WebCore/xml/XPathPredicate.cpp \ + Source/WebCore/xml/XPathPredicate.h \ + Source/WebCore/xml/XPathResult.cpp \ + Source/WebCore/xml/XPathResult.h \ + Source/WebCore/xml/XPathStep.cpp \ + Source/WebCore/xml/XPathStep.h \ + Source/WebCore/xml/XPathUtil.cpp \ + Source/WebCore/xml/XPathUtil.h \ + Source/WebCore/xml/XPathValue.cpp \ + Source/WebCore/xml/XPathValue.h \ + Source/WebCore/xml/XPathVariableReference.cpp \ + Source/WebCore/xml/XPathVariableReference.h \ + Source/WebCore/xml/XSLImportRule.cpp \ + Source/WebCore/xml/XSLImportRule.h \ + Source/WebCore/xml/XSLStyleSheet.h \ + Source/WebCore/xml/XSLStyleSheetLibxslt.cpp \ + Source/WebCore/xml/XSLTExtensions.cpp \ + Source/WebCore/xml/XSLTExtensions.h \ + Source/WebCore/xml/XSLTProcessor.cpp \ + Source/WebCore/xml/XSLTProcessor.h \ + Source/WebCore/xml/XSLTProcessorLibxslt.cpp \ + Source/WebCore/xml/XSLTUnicodeSort.cpp \ + Source/WebCore/xml/XSLTUnicodeSort.h + +webcore_svg_sources += \ + Source/WebCore/bindings/js/JSSVGElementInstanceCustom.cpp \ + Source/WebCore/bindings/js/JSSVGLengthCustom.cpp \ + Source/WebCore/bindings/js/JSSVGPathSegCustom.cpp \ + Source/WebCore/css/SVGCSSComputedStyleDeclaration.cpp \ + Source/WebCore/css/SVGCSSParser.cpp \ + Source/WebCore/css/SVGCSSStyleSelector.cpp \ + Source/WebCore/css/WebKitCSSSVGDocumentValue.cpp \ + Source/WebCore/css/WebKitCSSSVGDocumentValue.h \ + Source/WebCore/loader/cache/CachedSVGDocument.cpp \ + Source/WebCore/loader/cache/CachedSVGDocument.h \ + Source/WebCore/loader/cache/CachedSVGDocumentReference.h \ + Source/WebCore/platform/graphics/SVGGlyph.cpp \ + Source/WebCore/platform/graphics/SVGGlyph.h \ Source/WebCore/rendering/style/SVGRenderStyle.cpp \ Source/WebCore/rendering/style/SVGRenderStyleDefs.cpp \ Source/WebCore/rendering/style/SVGRenderStyleDefs.h \ @@ -4615,34 +4769,6 @@ webcore_sources += \ Source/WebCore/rendering/svg/SVGTextQuery.h \ Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp \ Source/WebCore/rendering/svg/SVGTextRunRenderingContext.h \ - Source/WebCore/rendering/TableLayout.h \ - Source/WebCore/rendering/TrailingFloatsRootInlineBox.h \ - Source/WebCore/storage/StorageTask.cpp \ - Source/WebCore/storage/StorageTask.h \ - Source/WebCore/storage/StorageThread.cpp \ - Source/WebCore/storage/StorageThread.h \ - Source/WebCore/storage/StorageArea.h \ - Source/WebCore/storage/StorageAreaImpl.cpp \ - Source/WebCore/storage/StorageAreaImpl.h \ - Source/WebCore/storage/StorageAreaSync.cpp \ - Source/WebCore/storage/StorageAreaSync.h \ - Source/WebCore/storage/Storage.cpp \ - Source/WebCore/storage/Storage.h \ - Source/WebCore/storage/StorageEvent.cpp \ - Source/WebCore/storage/StorageEvent.h \ - Source/WebCore/storage/StorageEventDispatcher.cpp \ - Source/WebCore/storage/StorageEventDispatcher.h \ - Source/WebCore/storage/StorageMap.cpp \ - Source/WebCore/storage/StorageMap.h \ - Source/WebCore/storage/StorageNamespace.cpp \ - Source/WebCore/storage/StorageNamespace.h \ - Source/WebCore/storage/StorageNamespaceImpl.cpp \ - Source/WebCore/storage/StorageNamespaceImpl.h \ - Source/WebCore/storage/StorageSyncManager.cpp \ - Source/WebCore/storage/StorageSyncManager.h \ - Source/WebCore/storage/StorageTracker.cpp \ - Source/WebCore/storage/StorageTracker.h \ - Source/WebCore/storage/StorageTrackerClient.h \ Source/WebCore/svg/animation/SMILTimeContainer.cpp \ Source/WebCore/svg/animation/SMILTimeContainer.h \ Source/WebCore/svg/animation/SMILTime.cpp \ @@ -5021,123 +5147,7 @@ webcore_sources += \ Source/WebCore/svg/SVGZoomAndPan.cpp \ Source/WebCore/svg/SVGZoomAndPan.h \ Source/WebCore/svg/SVGZoomEvent.cpp \ - Source/WebCore/svg/SVGZoomEvent.h \ - Source/WebCore/WebCorePrefix.h \ - Source/WebCore/workers/AbstractWorker.cpp \ - Source/WebCore/workers/AbstractWorker.h \ - Source/WebCore/workers/DedicatedWorkerContext.cpp \ - Source/WebCore/workers/DedicatedWorkerContext.h \ - Source/WebCore/workers/DedicatedWorkerThread.cpp \ - Source/WebCore/workers/DedicatedWorkerThread.h \ - Source/WebCore/workers/DefaultSharedWorkerRepository.cpp \ - Source/WebCore/workers/DefaultSharedWorkerRepository.h \ - Source/WebCore/workers/SharedWorkerContext.cpp \ - Source/WebCore/workers/SharedWorkerContext.h \ - Source/WebCore/workers/SharedWorker.cpp \ - Source/WebCore/workers/SharedWorker.h \ - Source/WebCore/workers/SharedWorkerRepository.h \ - Source/WebCore/workers/SharedWorkerStrategy.h \ - Source/WebCore/workers/SharedWorkerThread.cpp \ - Source/WebCore/workers/SharedWorkerThread.h \ - Source/WebCore/workers/WorkerContext.cpp \ - Source/WebCore/workers/WorkerContext.h \ - Source/WebCore/workers/WorkerContextProxy.h \ - Source/WebCore/workers/WorkerEventQueue.cpp \ - Source/WebCore/workers/WorkerEventQueue.h \ - Source/WebCore/workers/Worker.cpp \ - Source/WebCore/workers/Worker.h \ - Source/WebCore/workers/WorkerLoaderProxy.h \ - Source/WebCore/workers/WorkerLocation.cpp \ - Source/WebCore/workers/WorkerLocation.h \ - Source/WebCore/workers/WorkerMessagingProxy.cpp \ - Source/WebCore/workers/WorkerMessagingProxy.h \ - Source/WebCore/workers/WorkerObjectProxy.h \ - Source/WebCore/workers/WorkerReportingProxy.h \ - Source/WebCore/workers/WorkerRunLoop.cpp \ - Source/WebCore/workers/WorkerRunLoop.h \ - Source/WebCore/workers/WorkerScriptLoaderClient.h \ - Source/WebCore/workers/WorkerScriptLoader.cpp \ - Source/WebCore/workers/WorkerScriptLoader.h \ - Source/WebCore/workers/WorkerThread.cpp \ - Source/WebCore/workers/WorkerThread.h \ - Source/WebCore/xml/parser/CharacterReferenceParserInlines.h \ - Source/WebCore/xml/parser/MarkupTokenBase.h \ - Source/WebCore/xml/parser/MarkupTokenizerBase.h \ - Source/WebCore/xml/parser/MarkupTokenizerInlines.h \ - Source/WebCore/xml/parser/NewXMLDocumentParser.cpp \ - Source/WebCore/xml/parser/NewXMLDocumentParser.h \ - Source/WebCore/xml/parser/XMLCharacterReferenceParser.cpp \ - Source/WebCore/xml/parser/XMLCharacterReferenceParser.h \ - Source/WebCore/xml/parser/XMLDocumentParser.cpp \ - Source/WebCore/xml/parser/XMLDocumentParser.h \ - Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp \ - Source/WebCore/xml/parser/XMLDocumentParserScope.cpp \ - Source/WebCore/xml/parser/XMLDocumentParserScope.h \ - Source/WebCore/xml/parser/XMLTokenizer.cpp \ - Source/WebCore/xml/parser/XMLTokenizer.h \ - Source/WebCore/xml/parser/XMLToken.h \ - Source/WebCore/xml/parser/XMLTreeBuilder.cpp \ - Source/WebCore/xml/parser/XMLTreeBuilder.h \ - Source/WebCore/xml/DOMParser.cpp \ - Source/WebCore/xml/DOMParser.h \ - Source/WebCore/xml/NativeXPathNSResolver.cpp \ - Source/WebCore/xml/NativeXPathNSResolver.h \ - Source/WebCore/xml/XMLErrors.cpp \ - Source/WebCore/xml/XMLErrors.h \ - Source/WebCore/xml/XMLHttpRequest.cpp \ - Source/WebCore/xml/XMLHttpRequestException.cpp \ - Source/WebCore/xml/XMLHttpRequestException.h \ - Source/WebCore/xml/XMLHttpRequest.h \ - Source/WebCore/xml/XMLHttpRequestProgressEvent.h \ - Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.cpp \ - Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.h \ - Source/WebCore/xml/XMLHttpRequestUpload.cpp \ - Source/WebCore/xml/XMLHttpRequestUpload.h \ - Source/WebCore/xml/XMLTreeViewer.cpp \ - Source/WebCore/xml/XMLTreeViewer.h \ - Source/WebCore/xml/XMLSerializer.cpp \ - Source/WebCore/xml/XMLSerializer.h \ - Source/WebCore/xml/XPathEvaluator.cpp \ - Source/WebCore/xml/XPathEvaluator.h \ - Source/WebCore/xml/XPathException.cpp \ - Source/WebCore/xml/XPathException.h \ - Source/WebCore/xml/XPathExpression.cpp \ - Source/WebCore/xml/XPathExpression.h \ - Source/WebCore/xml/XPathExpressionNode.cpp \ - Source/WebCore/xml/XPathExpressionNode.h \ - Source/WebCore/xml/XPathFunctions.cpp \ - Source/WebCore/xml/XPathFunctions.h \ - Source/WebCore/xml/XPathNodeSet.cpp \ - Source/WebCore/xml/XPathNodeSet.h \ - Source/WebCore/xml/XPathNSResolver.cpp \ - Source/WebCore/xml/XPathNSResolver.h \ - Source/WebCore/xml/XPathParser.cpp \ - Source/WebCore/xml/XPathParser.h \ - Source/WebCore/xml/XPathPath.cpp \ - Source/WebCore/xml/XPathPath.h \ - Source/WebCore/xml/XPathPredicate.cpp \ - Source/WebCore/xml/XPathPredicate.h \ - Source/WebCore/xml/XPathResult.cpp \ - Source/WebCore/xml/XPathResult.h \ - Source/WebCore/xml/XPathStep.cpp \ - Source/WebCore/xml/XPathStep.h \ - Source/WebCore/xml/XPathUtil.cpp \ - Source/WebCore/xml/XPathUtil.h \ - Source/WebCore/xml/XPathValue.cpp \ - Source/WebCore/xml/XPathValue.h \ - Source/WebCore/xml/XPathVariableReference.cpp \ - Source/WebCore/xml/XPathVariableReference.h \ - Source/WebCore/xml/XSLImportRule.cpp \ - Source/WebCore/xml/XSLImportRule.h \ - Source/WebCore/xml/XSLStyleSheet.h \ - Source/WebCore/xml/XSLStyleSheetLibxslt.cpp \ - Source/WebCore/xml/XSLTExtensions.cpp \ - Source/WebCore/xml/XSLTExtensions.h \ - Source/WebCore/xml/XSLTProcessor.cpp \ - Source/WebCore/xml/XSLTProcessor.h \ - Source/WebCore/xml/XSLTProcessorLibxslt.cpp \ - Source/WebCore/xml/XSLTUnicodeSort.cpp \ - Source/WebCore/xml/XSLTUnicodeSort.h + Source/WebCore/svg/SVGZoomEvent.h webcore_platform_sources += \ Source/WebCore/platform/animation/Animation.cpp \ @@ -5519,8 +5529,6 @@ webcore_platform_sources += \ Source/WebCore/platform/graphics/StrokeStyleApplier.h \ Source/WebCore/platform/graphics/SurrogatePairAwareTextIterator.cpp \ Source/WebCore/platform/graphics/SurrogatePairAwareTextIterator.h \ - Source/WebCore/platform/graphics/SVGGlyph.cpp \ - Source/WebCore/platform/graphics/SVGGlyph.h \ Source/WebCore/platform/graphics/TextRenderingMode.h \ Source/WebCore/platform/graphics/TextRun.cpp \ Source/WebCore/platform/graphics/TextRun.h \ diff --git a/Source/WebCore/Modules/mediastream/RTCStatsElement.cpp b/Source/WebCore/Modules/mediastream/RTCStatsElement.cpp index 9d51e5405..6241673be 100644 --- a/Source/WebCore/Modules/mediastream/RTCStatsElement.cpp +++ b/Source/WebCore/Modules/mediastream/RTCStatsElement.cpp @@ -47,6 +47,16 @@ String RTCStatsElement::stat(const String& name) const return m_stats.get(name); } +Vector<String> RTCStatsElement::names() const +{ + Vector<String> result; + for (HashMap<String, String>::const_iterator it = m_stats.begin(); + it != m_stats.end(); ++it) { + result.append(it->key); + } + return result; +} + void RTCStatsElement::addStatistic(const String& name, const String& value) { m_stats.add(name, value); diff --git a/Source/WebCore/Modules/mediastream/RTCStatsElement.h b/Source/WebCore/Modules/mediastream/RTCStatsElement.h index 0afab5f2b..22d4acf0b 100644 --- a/Source/WebCore/Modules/mediastream/RTCStatsElement.h +++ b/Source/WebCore/Modules/mediastream/RTCStatsElement.h @@ -37,6 +37,7 @@ public: static PassRefPtr<RTCStatsElement> create(double timestamp); double timestamp() const { return m_timestamp; } String stat(const String& name) const; + Vector<String> names() const; void addStatistic(const String& name, const String& value); private: diff --git a/Source/WebCore/Modules/mediastream/RTCStatsElement.idl b/Source/WebCore/Modules/mediastream/RTCStatsElement.idl index aa4e79ffc..6a830de87 100644 --- a/Source/WebCore/Modules/mediastream/RTCStatsElement.idl +++ b/Source/WebCore/Modules/mediastream/RTCStatsElement.idl @@ -27,4 +27,5 @@ ] interface RTCStatsElement { readonly attribute Date timestamp; DOMString stat(in DOMString name); + sequence<String> names(); }; diff --git a/Source/WebCore/Modules/websockets/WebSocket.cpp b/Source/WebCore/Modules/websockets/WebSocket.cpp index 7f30738f8..8cdc7dae4 100644 --- a/Source/WebCore/Modules/websockets/WebSocket.cpp +++ b/Source/WebCore/Modules/websockets/WebSocket.cpp @@ -508,7 +508,7 @@ void WebSocket::didReceiveMessage(const String& msg) if (m_state != OPEN && m_state != CLOSING) return; ASSERT(scriptExecutionContext()); - dispatchEvent(MessageEvent::create(msg)); + dispatchEvent(MessageEvent::create(msg, SecurityOrigin::create(m_url)->toString())); } void WebSocket::didReceiveBinaryData(PassOwnPtr<Vector<char> > binaryData) @@ -521,12 +521,12 @@ void WebSocket::didReceiveBinaryData(PassOwnPtr<Vector<char> > binaryData) OwnPtr<BlobData> blobData = BlobData::create(); blobData->appendData(rawData.release(), 0, BlobDataItem::toEndOfFile); RefPtr<Blob> blob = Blob::create(blobData.release(), size); - dispatchEvent(MessageEvent::create(blob.release())); + dispatchEvent(MessageEvent::create(blob.release(), SecurityOrigin::create(m_url)->toString())); break; } case BinaryTypeArrayBuffer: - dispatchEvent(MessageEvent::create(ArrayBuffer::create(binaryData->data(), binaryData->size()))); + dispatchEvent(MessageEvent::create(ArrayBuffer::create(binaryData->data(), binaryData->size()), SecurityOrigin::create(m_url)->toString())); break; } } diff --git a/Source/WebCore/PlatformEfl.cmake b/Source/WebCore/PlatformEfl.cmake index 662be5a1b..31e4c87df 100644 --- a/Source/WebCore/PlatformEfl.cmake +++ b/Source/WebCore/PlatformEfl.cmake @@ -1,5 +1,5 @@ LIST(APPEND WebCore_INCLUDE_DIRECTORIES - "${WEBCORE_DIR}/accessibility/efl" + "${WEBCORE_DIR}/accessibility/atk" "${WEBCORE_DIR}/page/efl" "${WEBCORE_DIR}/platform/cairo" "${WEBCORE_DIR}/platform/efl" @@ -13,10 +13,26 @@ LIST(APPEND WebCore_INCLUDE_DIRECTORIES "${WEBCORE_DIR}/platform/network/soup" "${WEBCORE_DIR}/platform/text/efl" "${WEBCORE_DIR}/plugins/efl" + ${ATK_INCLUDE_DIRS} ) LIST(APPEND WebCore_SOURCES - accessibility/efl/AccessibilityObjectEfl.cpp + accessibility/atk/AXObjectCacheAtk.cpp + accessibility/atk/AccessibilityObjectAtk.cpp + accessibility/atk/WebKitAccessibleHyperlink.cpp + accessibility/atk/WebKitAccessibleInterfaceAction.cpp + accessibility/atk/WebKitAccessibleInterfaceComponent.cpp + accessibility/atk/WebKitAccessibleInterfaceDocument.cpp + accessibility/atk/WebKitAccessibleInterfaceEditableText.cpp + accessibility/atk/WebKitAccessibleInterfaceHyperlinkImpl.cpp + accessibility/atk/WebKitAccessibleInterfaceHypertext.cpp + accessibility/atk/WebKitAccessibleInterfaceImage.cpp + accessibility/atk/WebKitAccessibleInterfaceSelection.cpp + accessibility/atk/WebKitAccessibleInterfaceTable.cpp + accessibility/atk/WebKitAccessibleInterfaceText.cpp + accessibility/atk/WebKitAccessibleInterfaceValue.cpp + accessibility/atk/WebKitAccessibleUtil.cpp + accessibility/atk/WebKitAccessibleWrapperAtk.cpp editing/SmartReplaceICU.cpp page/efl/DragControllerEfl.cpp page/efl/EventHandlerEfl.cpp @@ -161,6 +177,7 @@ IF (WTF_USE_TEXTURE_MAPPER) ENDIF () LIST(APPEND WebCore_LIBRARIES + ${ATK_LIBRARIES} ${CAIRO_LIBRARIES} ${ECORE_LIBRARIES} ${ECORE_EVAS_LIBRARIES} diff --git a/Source/WebCore/Target.pri b/Source/WebCore/Target.pri index ad4a8f587..0b7ec42eb 100644 --- a/Source/WebCore/Target.pri +++ b/Source/WebCore/Target.pri @@ -385,7 +385,6 @@ SOURCES += \ dom/DOMStringMap.cpp \ dom/DatasetDOMStringMap.cpp \ dom/DynamicNodeList.cpp \ - dom/EditingText.cpp \ dom/Element.cpp \ dom/ElementAttributeData.cpp \ dom/ElementRareData.cpp \ @@ -1564,7 +1563,6 @@ HEADERS += \ dom/DOMTimeStamp.h \ dom/DatasetDOMStringMap.h \ dom/DynamicNodeList.h \ - dom/EditingText.h \ dom/Element.h \ dom/ElementShadow.h \ dom/ElementAttributeData.h \ diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi index a0c50b26e..e9f3b20e9 100644 --- a/Source/WebCore/WebCore.gypi +++ b/Source/WebCore/WebCore.gypi @@ -973,6 +973,7 @@ 'css/WebKitCSSMatrix.idl', 'css/WebKitCSSRegionRule.idl', 'css/WebKitCSSTransformValue.idl', + 'css/WebKitCSSViewportRule.idl', 'dom/Attr.idl', 'dom/BeforeLoadEvent.idl', 'dom/CDATASection.idl', @@ -1892,7 +1893,6 @@ 'accessibility/AccessibilityTableRow.h', 'accessibility/chromium/AXObjectCacheChromium.cpp', 'accessibility/chromium/AccessibilityObjectChromium.cpp', - 'accessibility/efl/AccessibilityObjectEfl.cpp', 'accessibility/atk/AXObjectCacheAtk.cpp', 'accessibility/atk/AccessibilityObjectAtk.cpp', 'accessibility/atk/WebKitAccessibleHyperlink.cpp', @@ -1927,11 +1927,9 @@ 'accessibility/mac/AccessibilityObjectMac.mm', 'accessibility/mac/WebAccessibilityObjectWrapper.h', 'accessibility/mac/WebAccessibilityObjectWrapper.mm', - 'accessibility/qt/AccessibilityObjectQt.cpp', 'accessibility/win/AXObjectCacheWin.cpp', 'accessibility/win/AccessibilityObjectWin.cpp', 'accessibility/win/AccessibilityObjectWrapperWin.h', - 'accessibility/wx/AccessibilityObjectWx.cpp', 'bindings/ScriptControllerBase.cpp', 'bindings/cpp/WebDOMCString.cpp', 'bindings/cpp/WebDOMCString.h', @@ -2163,7 +2161,6 @@ 'bindings/js/ScriptCallStackFactory.h', 'bindings/js/ScriptController.cpp', 'bindings/js/ScriptControllerMac.mm', - 'bindings/js/ScriptControllerQt.cpp', 'bindings/js/ScriptDebugServer.cpp', 'bindings/js/ScriptEventListener.cpp', 'bindings/js/ScriptEventListener.h', @@ -2471,14 +2468,6 @@ 'bridge/objc/objc_runtime.mm', 'bridge/objc/objc_utility.h', 'bridge/objc/objc_utility.mm', - 'bridge/qt/qt_class.cpp', - 'bridge/qt/qt_class.h', - 'bridge/qt/qt_instance.cpp', - 'bridge/qt/qt_instance.h', - 'bridge/qt/qt_pixmapruntime.cpp', - 'bridge/qt/qt_pixmapruntime.h', - 'bridge/qt/qt_runtime.cpp', - 'bridge/qt/qt_runtime.h', 'bridge/runtime_array.cpp', 'bridge/runtime_array.h', 'bridge/runtime_method.cpp', @@ -2486,7 +2475,6 @@ 'bridge/runtime_root.cpp', 'bridge/testbindings.cpp', 'bridge/testbindings.mm', - 'bridge/testqtbindings.cpp', 'config.h', 'css/BasicShapeFunctions.cpp', 'css/CSSAspectRatioValue.cpp', @@ -2758,9 +2746,7 @@ 'editing/mac/EditorMac.mm', 'editing/mac/FrameSelectionMac.mm', 'editing/markup.cpp', - 'editing/qt/EditorQt.cpp', 'editing/visible_units.cpp', - 'editing/wx/EditorWx.cpp', 'fileapi/AsyncFileStream.cpp', 'fileapi/AsyncFileStream.h', 'fileapi/Blob.cpp', @@ -2796,7 +2782,6 @@ 'history/PageCache.cpp', 'history/cf/HistoryPropertyList.cpp', 'history/mac/HistoryItemMac.mm', - 'history/qt/HistoryItemQt.cpp', 'icu/unicode/parseerr.h', 'icu/unicode/platform.h', 'icu/unicode/putil.h', @@ -3070,7 +3055,6 @@ 'loader/icon/IconRecord.h', 'loader/icon/PageURLRecord.cpp', 'loader/icon/PageURLRecord.h', - 'loader/icon/wince/IconDatabaseWinCE.cpp', 'loader/mac/DocumentLoaderMac.cpp', 'loader/mac/LoaderNSURLExtras.mm', 'loader/mac/ResourceLoaderMac.mm', @@ -3215,8 +3199,6 @@ 'page/chromium/ChromeClientChromium.h', 'page/chromium/DragControllerChromium.cpp', 'page/chromium/EventHandlerChromium.cpp', - 'page/efl/DragControllerEfl.cpp', - 'page/efl/EventHandlerEfl.cpp', 'page/gtk/DragControllerGtk.cpp', 'page/gtk/EventHandlerGtk.cpp', 'page/mac/ChromeMac.mm', @@ -3224,8 +3206,6 @@ 'page/mac/EventHandlerMac.mm', 'page/mac/FrameMac.mm', 'page/mac/PageMac.cpp', - 'page/qt/DragControllerQt.cpp', - 'page/qt/EventHandlerQt.cpp', 'page/scrolling/ScrollingConstraints.cpp', 'page/scrolling/ScrollingConstraints.h', 'page/scrolling/ScrollingCoordinator.cpp', @@ -3239,12 +3219,8 @@ 'page/win/DragControllerWin.cpp', 'page/win/EventHandlerWin.cpp', 'page/win/FrameCGWin.cpp', - 'page/win/FrameCairoWin.cpp', 'page/win/FrameWin.cpp', 'page/win/FrameWin.h', - 'page/wince/FrameWinCE.cpp', - 'page/wx/DragControllerWx.cpp', - 'page/wx/EventHandlerWx.cpp', 'plugins/DOMMimeType.cpp', 'plugins/DOMMimeType.h', 'plugins/DOMMimeTypeArray.cpp', @@ -3280,14 +3256,11 @@ 'plugins/mac/PluginPackageMac.cpp', 'plugins/mac/PluginViewMac.mm', 'plugins/npapi.cpp', - 'plugins/qt/PluginPackageQt.cpp', - 'plugins/qt/PluginViewQt.cpp', 'plugins/win/PluginDatabaseWin.cpp', 'plugins/win/PluginMessageThrottlerWin.cpp', 'plugins/win/PluginMessageThrottlerWin.h', 'plugins/win/PluginPackageWin.cpp', 'plugins/win/PluginViewWin.cpp', - 'plugins/wx/PluginDataWx.cpp', 'rendering/AutoTableLayout.cpp', 'rendering/AutoTableLayout.h', 'rendering/BidiRun.cpp', @@ -3496,8 +3469,6 @@ 'rendering/RenderThemeSafari.h', 'rendering/RenderThemeWin.cpp', 'rendering/RenderThemeWin.h', - 'rendering/RenderThemeWinCE.cpp', - 'rendering/RenderThemeWinCE.h', 'rendering/RenderTreeAsText.cpp', 'rendering/RenderVideo.cpp', 'rendering/RenderVideo.h', @@ -3640,10 +3611,6 @@ 'storage/StorageTracker.cpp', 'storage/StorageTracker.h', 'storage/chromium/IDBFactoryBackendInterface.cpp', - 'storage/wince/DatabaseThreadWinCE.cpp', - 'storage/wince/DatabaseThreadWinCE.h', - 'storage/wince/StorageThreadWinCE.cpp', - 'storage/wince/StorageThreadWinCE.h', 'workers/AbstractWorker.cpp', 'workers/AbstractWorker.h', 'workers/DedicatedWorkerContext.cpp', @@ -3689,7 +3656,6 @@ 'xml/parser/XMLDocumentParser.cpp', 'xml/parser/XMLDocumentParser.h', 'xml/parser/XMLDocumentParserLibxml2.cpp', - 'xml/parser/XMLDocumentParserQt.cpp', 'xml/parser/XMLDocumentParserScope.cpp', 'xml/parser/XMLDocumentParserScope.h', 'xml/parser/XMLTokenizer.cpp', @@ -3750,13 +3716,11 @@ 'xml/XSLImportRule.h', 'xml/XSLStyleSheet.h', 'xml/XSLStyleSheetLibxslt.cpp', - 'xml/XSLStyleSheetQt.cpp', 'xml/XSLTExtensions.cpp', 'xml/XSLTExtensions.h', 'xml/XSLTProcessor.cpp', 'xml/XSLTProcessor.h', 'xml/XSLTProcessorLibxslt.cpp', - 'xml/XSLTProcessorQt.cpp', 'xml/XSLTUnicodeSort.cpp', 'xml/XSLTUnicodeSort.h', ], @@ -3841,8 +3805,6 @@ 'dom/DocumentType.cpp', 'dom/DynamicNodeList.cpp', 'dom/DynamicNodeList.h', - 'dom/EditingText.cpp', - 'dom/EditingText.h', 'dom/ElementShadow.cpp', 'dom/Element.cpp', 'dom/ElementAttributeData.cpp', @@ -3986,7 +3948,6 @@ 'dom/TouchList.h', 'dom/TransformSource.h', 'dom/TransformSourceLibxslt.cpp', - 'dom/TransformSourceQt.cpp', 'dom/Traversal.cpp', 'dom/Traversal.h', 'dom/TreeDepthLimit.h', @@ -4749,37 +4710,6 @@ 'platform/chromium/WidgetChromium.cpp', 'platform/cocoa/KeyEventCocoa.h', 'platform/cocoa/KeyEventCocoa.mm', - 'platform/efl/ClipboardEfl.cpp', - 'platform/efl/ClipboardEfl.h', - 'platform/efl/ContextMenuEfl.cpp', - 'platform/efl/ContextMenuItemEfl.cpp', - 'platform/efl/CursorEfl.cpp', - 'platform/efl/DragDataEfl.cpp', - 'platform/efl/DragImageEfl.cpp', - 'platform/efl/EventLoopEfl.cpp', - 'platform/efl/FileSystemEfl.cpp', - 'platform/efl/KURLEfl.cpp', - 'platform/efl/LanguageEfl.cpp', - 'platform/efl/LocalizedStringsEfl.cpp', - 'platform/efl/LoggingEfl.cpp', - 'platform/efl/MIMETypeRegistryEfl.cpp', - 'platform/efl/PasteboardEfl.cpp', - 'platform/efl/PlatformKeyboardEventEfl.cpp', - 'platform/efl/PlatformMouseEventEfl.cpp', - 'platform/efl/PlatformScreenEfl.cpp', - 'platform/efl/PlatformWheelEventEfl.cpp', - 'platform/efl/RenderThemeEfl.cpp', - 'platform/efl/RenderThemeEfl.h', - 'platform/efl/ScrollViewEfl.cpp', - 'platform/efl/ScrollbarEfl.cpp', - 'platform/efl/ScrollbarEfl.h', - 'platform/efl/ScrollbarThemeEfl.cpp', - 'platform/efl/ScrollbarThemeEfl.h', - 'platform/efl/SharedTimerEfl.cpp', - 'platform/efl/SoundEfl.cpp', - 'platform/efl/SystemTimeEfl.cpp', - 'platform/efl/TemporaryLinkStubs.cpp', - 'platform/efl/WidgetEfl.cpp', 'platform/graphics/ANGLEWebKitBridge.cpp', 'platform/graphics/ANGLEWebKitBridge.h', 'platform/graphics/BitmapImage.cpp', @@ -4871,25 +4801,6 @@ 'platform/graphics/ca/win/PlatformCALayerWinInternal.h', 'platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp', 'platform/graphics/ca/win/WKCACFViewLayerTreeHost.h', - 'platform/graphics/cairo/CairoUtilities.cpp', - 'platform/graphics/cairo/CairoUtilities.h', - 'platform/graphics/cairo/DrawErrorUnderline.h', - 'platform/graphics/cairo/FloatRectCairo.cpp', - 'platform/graphics/cairo/FontCairo.cpp', - 'platform/graphics/cairo/FontCustomPlatformData.h', - 'platform/graphics/cairo/GradientCairo.cpp', - 'platform/graphics/cairo/GraphicsContextCairo.cpp', - 'platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h', - 'platform/graphics/cairo/ImageBufferCairo.cpp', - 'platform/graphics/cairo/ImageBufferDataCairo.h', - 'platform/graphics/cairo/ImageCairo.cpp', - 'platform/graphics/cairo/OwnPtrCairo.cpp', - 'platform/graphics/cairo/OwnPtrCairo.h', - 'platform/graphics/cairo/PathCairo.cpp', - 'platform/graphics/cairo/PatternCairo.cpp', - 'platform/graphics/cairo/RefPtrCairo.cpp', - 'platform/graphics/cairo/RefPtrCairo.h', - 'platform/graphics/cairo/TransformationMatrixCairo.cpp', 'platform/graphics/cg/BitmapImageCG.cpp', 'platform/graphics/cg/ColorCG.cpp', 'platform/graphics/cg/FloatPointCG.cpp', @@ -4968,10 +4879,6 @@ 'platform/graphics/chromium/VDMXParser.cpp', 'platform/graphics/chromium/VDMXParser.h', 'platform/graphics/cocoa/FontPlatformDataCocoa.mm', - 'platform/graphics/efl/IconEfl.cpp', - 'platform/graphics/efl/ImageEfl.cpp', - 'platform/graphics/efl/IntPointEfl.cpp', - 'platform/graphics/efl/IntRectEfl.cpp', 'platform/graphics/filters/CustomFilterArrayParameter.h', 'platform/graphics/filters/CustomFilterConstants.h', 'platform/graphics/filters/CustomFilterGlobalContext.cpp', @@ -5079,14 +4986,11 @@ 'platform/graphics/gpu/Texture.cpp', 'platform/graphics/gpu/Texture.h', 'platform/graphics/gpu/mac/DrawingBufferMac.mm', - 'platform/graphics/gpu/qt/DrawingBufferQt.cpp', 'platform/graphics/gstreamer/GRefPtrGStreamer.cpp', 'platform/graphics/gstreamer/GRefPtrGStreamer.h', 'platform/graphics/gstreamer/GStreamerGWorld.cpp', 'platform/graphics/gstreamer/GStreamerGWorld.h', 'platform/graphics/gstreamer/ImageGStreamer.h', - 'platform/graphics/gstreamer/ImageGStreamerCairo.cpp', - 'platform/graphics/gstreamer/ImageGStreamerQt.cpp', 'platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp', 'platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h', 'platform/graphics/gstreamer/PlatformVideoWindow.h', @@ -5094,14 +4998,11 @@ 'platform/graphics/gstreamer/PlatformVideoWindowGtk.cpp', 'platform/graphics/gstreamer/PlatformVideoWindowMac.mm', 'platform/graphics/gstreamer/PlatformVideoWindowPrivate.h', - 'platform/graphics/gstreamer/PlatformVideoWindowQt.cpp', 'platform/graphics/gstreamer/VideoSinkGStreamer.cpp', 'platform/graphics/gstreamer/VideoSinkGStreamer.h', 'platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp', 'platform/graphics/gstreamer/WebKitWebSourceGStreamer.h', 'platform/graphics/gtk/ColorGtk.cpp', - 'platform/graphics/gtk/GdkCairoUtilities.cpp', - 'platform/graphics/gtk/GdkCairoUtilities.h', 'platform/graphics/gtk/IconGtk.cpp', 'platform/graphics/gtk/ImageBufferGtk.cpp', 'platform/graphics/gtk/ImageGtk.cpp', @@ -5142,8 +5043,6 @@ 'platform/graphics/mac/IntPointMac.mm', 'platform/graphics/mac/IntRectMac.mm', 'platform/graphics/mac/IntSizeMac.mm', - 'platform/graphics/mac/MediaPlayerPrivateQTKit.h', - 'platform/graphics/mac/MediaPlayerPrivateQTKit.mm', 'platform/graphics/mac/SimpleFontDataCoreText.cpp', 'platform/graphics/mac/SimpleFontDataMac.mm', 'platform/graphics/mac/WebGLLayer.h', @@ -5188,38 +5087,6 @@ 'platform/graphics/pango/FontPlatformDataPango.cpp', 'platform/graphics/pango/GlyphPageTreeNodePango.cpp', 'platform/graphics/pango/SimpleFontDataPango.cpp', - 'platform/graphics/qt/ColorQt.cpp', - 'platform/graphics/qt/FloatPointQt.cpp', - 'platform/graphics/qt/FloatRectQt.cpp', - 'platform/graphics/qt/FontCacheQt.cpp', - 'platform/graphics/qt/FontCustomPlatformData.h', - 'platform/graphics/qt/FontCustomPlatformDataQt.cpp', - 'platform/graphics/qt/FontPlatformData.h', - 'platform/graphics/qt/FontPlatformDataQt.cpp', - 'platform/graphics/qt/FontQt.cpp', - 'platform/graphics/qt/GlyphPageTreeNodeQt.cpp', - 'platform/graphics/qt/GradientQt.cpp', - 'platform/graphics/qt/GraphicsContext3DQt.cpp', - 'platform/graphics/qt/GraphicsContextQt.cpp', - 'platform/graphics/qt/IconQt.cpp', - 'platform/graphics/qt/ImageBufferDataQt.h', - 'platform/graphics/qt/ImageBufferQt.cpp', - 'platform/graphics/qt/ImageDecoderQt.cpp', - 'platform/graphics/qt/ImageDecoderQt.h', - 'platform/graphics/qt/ImageQt.cpp', - 'platform/graphics/qt/IntPointQt.cpp', - 'platform/graphics/qt/IntRectQt.cpp', - 'platform/graphics/qt/IntSizeQt.cpp', - 'platform/graphics/qt/MediaPlayerPrivateQt.cpp', - 'platform/graphics/qt/MediaPlayerPrivateQt.h', - 'platform/graphics/qt/PathQt.cpp', - 'platform/graphics/qt/PatternQt.cpp', - 'platform/graphics/qt/SimpleFontDataQt.cpp', - 'platform/graphics/qt/StillImageQt.cpp', - 'platform/graphics/qt/StillImageQt.h', - 'platform/graphics/qt/TileQt.cpp', - 'platform/graphics/qt/TransformationMatrixQt.cpp', - 'platform/graphics/qt/TransparencyLayer.h', 'platform/graphics/skia/BitmapImageSingleFrameSkia.cpp', 'platform/graphics/skia/BitmapImageSingleFrameSkia.h', 'platform/graphics/skia/FloatPointSkia.cpp', @@ -5290,22 +5157,16 @@ 'platform/graphics/win/FontCacheWin.cpp', 'platform/graphics/win/FontCustomPlatformData.cpp', 'platform/graphics/win/FontCustomPlatformData.h', - 'platform/graphics/win/FontCustomPlatformDataCairo.cpp', - 'platform/graphics/win/FontCustomPlatformDataCairo.h', 'platform/graphics/win/FontPlatformDataCGWin.cpp', - 'platform/graphics/win/FontPlatformDataCairoWin.cpp', 'platform/graphics/win/FontPlatformDataWin.cpp', 'platform/graphics/win/FontWin.cpp', 'platform/graphics/win/GDIExtras.cpp', 'platform/graphics/win/GDIExtras.h', 'platform/graphics/win/GlyphPageTreeNodeCGWin.cpp', - 'platform/graphics/win/GlyphPageTreeNodeCairoWin.cpp', 'platform/graphics/win/GraphicsContextCGWin.cpp', - 'platform/graphics/win/GraphicsContextCairoWin.cpp', 'platform/graphics/win/GraphicsContextWin.cpp', 'platform/graphics/win/IconWin.cpp', 'platform/graphics/win/ImageCGWin.cpp', - 'platform/graphics/win/ImageCairoWin.cpp', 'platform/graphics/win/ImageWin.cpp', 'platform/graphics/win/IntPointWin.cpp', 'platform/graphics/win/IntRectWin.cpp', @@ -5317,77 +5178,14 @@ 'platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h', 'platform/graphics/win/MediaPlayerPrivateTaskTimer.cpp', 'platform/graphics/win/MediaPlayerPrivateTaskTimer.h', - 'platform/graphics/win/QTCFDictionary.cpp', - 'platform/graphics/win/QTCFDictionary.h', - 'platform/graphics/win/QTDecompressionSession.cpp', - 'platform/graphics/win/QTDecompressionSession.h', - 'platform/graphics/win/QTMovie.cpp', - 'platform/graphics/win/QTMovie.h', - 'platform/graphics/win/QTMovieGWorld.cpp', - 'platform/graphics/win/QTMovieGWorld.h', - 'platform/graphics/win/QTMovieTask.cpp', - 'platform/graphics/win/QTMovieTask.h', - 'platform/graphics/win/QTMovieVisualContext.cpp', - 'platform/graphics/win/QTMovieVisualContext.h', - 'platform/graphics/win/QTMovieWinTimer.cpp', - 'platform/graphics/win/QTMovieWinTimer.h', - 'platform/graphics/win/QTPixelBuffer.cpp', - 'platform/graphics/win/QTPixelBuffer.h', - 'platform/graphics/win/QTTrack.cpp', - 'platform/graphics/win/QTTrack.h', 'platform/graphics/win/RefCountedGDIHandle.h', 'platform/graphics/win/SimpleFontDataCGWin.cpp', - 'platform/graphics/win/SimpleFontDataCairoWin.cpp', 'platform/graphics/win/SimpleFontDataWin.cpp', 'platform/graphics/win/TransformationMatrixWin.cpp', 'platform/graphics/win/UniscribeController.cpp', 'platform/graphics/win/UniscribeController.h', 'platform/graphics/win/WKCAImageQueue.cpp', 'platform/graphics/win/WKCAImageQueue.h', - 'platform/graphics/wince/FontCacheWinCE.cpp', - 'platform/graphics/wince/FontCustomPlatformData.cpp', - 'platform/graphics/wince/FontCustomPlatformData.h', - 'platform/graphics/wince/FontPlatformData.cpp', - 'platform/graphics/wince/FontPlatformData.h', - 'platform/graphics/wince/FontWinCE.cpp', - 'platform/graphics/wince/GlyphPageTreeNodeWinCE.cpp', - 'platform/graphics/wince/GradientWinCE.cpp', - 'platform/graphics/wince/GraphicsContextWinCE.cpp', - 'platform/graphics/wince/ImageBufferDataWince.h', - 'platform/graphics/wince/ImageBufferWinCE.cpp', - 'platform/graphics/wince/ImageWinCE.cpp', - 'platform/graphics/wince/MediaPlayerPrivateWinCE.h', - 'platform/graphics/wince/MediaPlayerProxy.cpp', - 'platform/graphics/wince/MediaPlayerProxy.h', - 'platform/graphics/wince/PathWinCE.cpp', - 'platform/graphics/wince/PlatformPathWinCE.cpp', - 'platform/graphics/wince/PlatformPathWinCE.h', - 'platform/graphics/wince/SharedBitmap.cpp', - 'platform/graphics/wince/SharedBitmap.h', - 'platform/graphics/wince/SimpleFontDataWinCE.cpp', - 'platform/graphics/wince/WinCEGraphicsExtras.h', - 'platform/graphics/wx/ColorWx.cpp', - 'platform/graphics/wx/FloatRectWx.cpp', - 'platform/graphics/wx/FontCacheWx.cpp', - 'platform/graphics/wx/FontCustomPlatformData.cpp', - 'platform/graphics/wx/FontCustomPlatformData.h', - 'platform/graphics/wx/FontPlatformData.h', - 'platform/graphics/wx/FontPlatformDataWx.cpp', - 'platform/graphics/wx/FontPlatformDataWxMac.mm', - 'platform/graphics/wx/FontWx.cpp', - 'platform/graphics/wx/GlyphMapWx.cpp', - 'platform/graphics/wx/GradientWx.cpp', - 'platform/graphics/wx/GraphicsContextWx.cpp', - 'platform/graphics/wx/IconWx.cpp', - 'platform/graphics/wx/ImageBufferDataWx.h', - 'platform/graphics/wx/ImageBufferWx.cpp', - 'platform/graphics/wx/ImageWx.cpp', - 'platform/graphics/wx/IntPointWx.cpp', - 'platform/graphics/wx/IntRectWx.cpp', - 'platform/graphics/wx/IntSizeWx.cpp', - 'platform/graphics/wx/PathWx.cpp', - 'platform/graphics/wx/SimpleFontDataWx.cpp', - 'platform/graphics/wx/TransformationMatrixWx.cpp', 'platform/gtk/ClipboardGtk.cpp', 'platform/gtk/ClipboardGtk.h', 'platform/gtk/ClipboardUtilitiesGtk.cpp', @@ -5445,7 +5243,6 @@ 'platform/image-decoders/bmp/BMPImageDecoder.h', 'platform/image-decoders/bmp/BMPImageReader.cpp', 'platform/image-decoders/bmp/BMPImageReader.h', - 'platform/image-decoders/cairo/ImageDecoderCairo.cpp', 'platform/image-decoders/gif/GIFImageDecoder.cpp', 'platform/image-decoders/gif/GIFImageDecoder.h', 'platform/image-decoders/gif/GIFImageReader.cpp', @@ -5460,7 +5257,6 @@ 'platform/image-decoders/skia/ImageDecoderSkia.cpp', 'platform/image-decoders/webp/WEBPImageDecoder.cpp', 'platform/image-decoders/webp/WEBPImageDecoder.h', - 'platform/image-decoders/wx/ImageDecoderWx.cpp', 'platform/image-encoders/JPEGImageEncoder.cpp', 'platform/image-encoders/JPEGImageEncoder.h', 'platform/image-encoders/PNGImageEncoder.cpp', @@ -5633,23 +5429,6 @@ 'platform/network/mac/ResourceRequestMac.mm', 'platform/network/mac/ResourceResponseMac.mm', 'platform/network/mac/WebCoreURLResponse.mm', - 'platform/network/qt/AuthenticationChallenge.h', - 'platform/network/qt/CookieJarQt.cpp', - 'platform/network/qt/CredentialStorageQt.cpp', - 'platform/network/qt/NetworkStateNotifierPrivate.h', - 'platform/network/qt/NetworkStateNotifierQt.cpp', - 'platform/network/qt/ProxyServerQt.cpp', - 'platform/network/qt/QNetworkReplyHandler.cpp', - 'platform/network/qt/QNetworkReplyHandler.h', - 'platform/network/qt/ResourceError.h', - 'platform/network/qt/ResourceHandleQt.cpp', - 'platform/network/qt/ResourceRequest.h', - 'platform/network/qt/ResourceRequestQt.cpp', - 'platform/network/qt/ResourceResponse.h', - 'platform/network/qt/SocketStreamError.h', - 'platform/network/qt/SocketStreamHandle.h', - 'platform/network/qt/SocketStreamHandlePrivate.h', - 'platform/network/qt/SocketStreamHandleQt.cpp', 'platform/network/soup/AuthenticationChallenge.h', 'platform/network/soup/CookieJarSoup.cpp', 'platform/network/soup/CookieJarSoup.h', @@ -5681,35 +5460,6 @@ 'platform/network/win/SocketStreamHandleWin.cpp', 'platform/posix/FileSystemPOSIX.cpp', 'platform/posix/SharedBufferPOSIX.cpp', - 'platform/qt/ClipboardQt.cpp', - 'platform/qt/ClipboardQt.h', - 'platform/qt/ContextMenuItemQt.cpp', - 'platform/qt/ContextMenuQt.cpp', - 'platform/qt/CursorQt.cpp', - 'platform/qt/DragDataQt.cpp', - 'platform/qt/DragImageQt.cpp', - 'platform/qt/EventLoopQt.cpp', - 'platform/qt/FileSystemQt.cpp', - 'platform/qt/KURLQt.cpp', - 'platform/qt/LanguageQt.cpp', - 'platform/qt/LoggingQt.cpp', - 'platform/qt/MIMETypeRegistryQt.cpp', - 'platform/qt/PasteboardQt.cpp', - 'platform/qt/PlatformKeyboardEventQt.cpp', - 'platform/qt/PlatformScreenQt.cpp', - 'platform/qt/PlatformSupport.h', - 'platform/qt/PlatformSupportQt.cpp', - 'platform/qt/QWebPageClient.h', - 'platform/qt/RenderThemeQt.cpp', - 'platform/qt/RenderThemeQt.h', - 'platform/qt/ScreenQt.cpp', - 'platform/qt/ScrollViewQt.cpp', - 'platform/qt/ScrollbarThemeQt.cpp', - 'platform/qt/SharedBufferQt.cpp', - 'platform/qt/SharedTimerQt.cpp', - 'platform/qt/SoundQt.cpp', - 'platform/qt/TemporaryLinkStubsQt.cpp', - 'platform/qt/WidgetQt.cpp', 'platform/sql/SQLValue.cpp', 'platform/sql/SQLiteAuthorizer.cpp', 'platform/sql/SQLiteDatabase.cpp', @@ -5764,7 +5514,6 @@ 'platform/text/cf/StringImplCF.cpp', 'platform/text/chromium/Hyphenation.cpp', 'platform/text/chromium/TextBreakIteratorInternalICUChromium.cpp', - 'platform/text/efl/TextBreakIteratorInternalICUEfl.cpp', 'platform/text/gtk/TextBreakIteratorGtk.cpp', 'platform/text/gtk/TextBreakIteratorInternalICUGtk.cpp', 'platform/text/gtk/TextCodecGtk.cpp', @@ -5778,9 +5527,6 @@ 'platform/text/mac/TextBreakIteratorInternalICUMac.mm', 'platform/text/mac/TextCodecMac.cpp', 'platform/text/mac/TextCodecMac.h', - 'platform/text/qt/TextBoundariesQt.cpp', - 'platform/text/qt/TextCodecQt.cpp', - 'platform/text/qt/TextCodecQt.h', 'platform/text/transcoder/FontTranscoder.cpp', 'platform/text/transcoder/FontTranscoder.h', 'platform/text/win/LocaleWin.cpp', @@ -5788,7 +5534,6 @@ 'platform/text/win/TextBreakIteratorInternalICUWin.cpp', 'platform/text/win/TextCodecWin.cpp', 'platform/text/win/TextCodecWin.h', - 'platform/text/wince/TextBreakIteratorWinCE.cpp', 'platform/win/BString.cpp', 'platform/win/BString.h', 'platform/win/BitmapInfo.cpp', @@ -5803,7 +5548,6 @@ 'platform/win/CursorWin.cpp', 'platform/win/DragDataWin.cpp', 'platform/win/DragImageCGWin.cpp', - 'platform/win/DragImageCairoWin.cpp', 'platform/win/DragImageWin.cpp', 'platform/win/EditorWin.cpp', 'platform/win/EventLoopWin.cpp', @@ -5847,61 +5591,6 @@ 'platform/win/WindowMessageBroadcaster.cpp', 'platform/win/WindowMessageBroadcaster.h', 'platform/win/WindowMessageListener.h', - 'platform/wince/CursorWinCE.cpp', - 'platform/wince/DragImageWinCE.cpp', - 'platform/wince/FileSystemWinCE.cpp', - 'platform/wince/KURLWinCE.cpp', - 'platform/wince/PasteboardWinCE.cpp', - 'platform/wince/SearchPopupMenuWinCE.cpp', - 'platform/wince/SharedTimerWinCE.cpp', - 'platform/wx/ClipboardWx.cpp', - 'platform/wx/ClipboardWx.h', - 'platform/wx/ContextMenuItemWx.cpp', - 'platform/wx/ContextMenuWx.cpp', - 'platform/wx/CursorWx.cpp', - 'platform/wx/DragDataWx.cpp', - 'platform/wx/DragImageWx.cpp', - 'platform/wx/EventLoopWx.cpp', - 'platform/wx/FileSystemWx.cpp', - 'platform/wx/KURLWx.cpp', - 'platform/wx/KeyEventWin.cpp', - 'platform/wx/KeyboardEventWx.cpp', - 'platform/wx/LocalizedStringsWx.cpp', - 'platform/wx/LoggingWx.cpp', - 'platform/wx/MimeTypeRegistryWx.cpp', - 'platform/wx/MouseEventWx.cpp', - 'platform/wx/MouseWheelEventWx.cpp', - 'platform/wx/PasteboardWx.cpp', - 'platform/wx/PopupMenuWx.cpp', - 'platform/wx/PopupMenuWx.h', - 'platform/wx/RenderThemeWx.cpp', - 'platform/wx/SSLKeyGeneratorWx.cpp', - 'platform/wx/ScreenWx.cpp', - 'platform/wx/ScrollViewWx.cpp', - 'platform/wx/ScrollbarThemeWx.cpp', - 'platform/wx/ScrollbarThemeWx.h', - 'platform/wx/SearchPopupMenuWx.cpp', - 'platform/wx/SearchPopupMenuWx.h', - 'platform/wx/SharedBufferWx.cpp', - 'platform/wx/SharedTimerWx.cpp', - 'platform/wx/SoundWx.cpp', - 'platform/wx/SystemTimeWx.cpp', - 'platform/wx/TemporaryLinkStubs.cpp', - 'platform/wx/TextBreakIteratorInternalICUWx.cpp', - 'platform/wx/WidgetWx.cpp', - 'platform/wx/wxcode/fontprops.cpp', - 'platform/wx/wxcode/fontprops.h', - 'platform/wx/wxcode/gtk/fontprops.cpp', - 'platform/wx/wxcode/gtk/non-kerned-drawing.cpp', - 'platform/wx/wxcode/gtk/scrollbar_render.cpp', - 'platform/wx/wxcode/mac/carbon/fontprops.mm', - 'platform/wx/wxcode/mac/carbon/non-kerned-drawing.cpp', - 'platform/wx/wxcode/mac/carbon/scrollbar_render.cpp', - 'platform/wx/wxcode/non-kerned-drawing.h', - 'platform/wx/wxcode/scrollbar_render.h', - 'platform/wx/wxcode/win/fontprops.cpp', - 'platform/wx/wxcode/win/non-kerned-drawing.cpp', - 'platform/wx/wxcode/win/scrollbar_render.cpp', ], 'webcore_platform_geometry_files': [ 'platform/graphics/FloatPoint.cpp', @@ -6499,6 +6188,7 @@ 'inspector/front-end/TextPrompt.js', 'inspector/front-end/TimelineGrid.js', 'inspector/front-end/TimelineManager.js', + 'inspector/front-end/TimelinePanelDescriptor.js', 'inspector/front-end/Toolbar.js', 'inspector/front-end/treeoutline.js', 'inspector/front-end/UISourceCode.js', @@ -7302,6 +6992,9 @@ '<(PRODUCT_DIR)/DerivedSources/WebCore/DOMWebKitCSSTransformValue.h', '<(PRODUCT_DIR)/DerivedSources/WebCore/DOMWebKitCSSTransformValue.mm', '<(PRODUCT_DIR)/DerivedSources/WebCore/DOMWebKitCSSTransformValueInternal.h', + '<(PRODUCT_DIR)/DerivedSources/WebCore/DOMWebKitCSSViewportRule.h', + '<(PRODUCT_DIR)/DerivedSources/WebCore/DOMWebKitCSSViewportRule.mm', + '<(PRODUCT_DIR)/DerivedSources/WebCore/DOMWebKitCSSViewportRuleInternal.h', '<(PRODUCT_DIR)/DerivedSources/WebCore/DOMWheelEvent.mm', '<(PRODUCT_DIR)/DerivedSources/WebCore/DOMWheelEventInternal.h', '<(PRODUCT_DIR)/DerivedSources/WebCore/DOMXPathExpression.mm', @@ -8352,6 +8045,8 @@ '<(PRODUCT_DIR)/DerivedSources/WebCore/JSWebKitCSSRegionRule.h', '<(PRODUCT_DIR)/DerivedSources/WebCore/JSWebKitCSSTransformValue.cpp', '<(PRODUCT_DIR)/DerivedSources/WebCore/JSWebKitCSSTransformValue.h', + '<(PRODUCT_DIR)/DerivedSources/WebCore/JSWebKitCSSViewportRule.cpp', + '<(PRODUCT_DIR)/DerivedSources/WebCore/JSWebKitCSSViewportRule.h', '<(PRODUCT_DIR)/DerivedSources/WebCore/JSWebKitPoint.cpp', '<(PRODUCT_DIR)/DerivedSources/WebCore/JSWebKitPoint.h', '<(PRODUCT_DIR)/DerivedSources/WebCore/JSWebKitNamedFlow.cpp', diff --git a/Source/WebCore/WebCore.vcproj/WebCore.vcproj b/Source/WebCore/WebCore.vcproj/WebCore.vcproj index d16fe9d11..22eda2918 100755 --- a/Source/WebCore/WebCore.vcproj/WebCore.vcproj +++ b/Source/WebCore/WebCore.vcproj/WebCore.vcproj @@ -51077,63 +51077,7 @@ RelativePath="..\dom\DynamicNodeList.h"
>
</File>
- <File
- RelativePath="..\dom\EditingText.cpp"
- >
- <FileConfiguration
- Name="Debug|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_Cairo_CFLite|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release_Cairo_CFLite|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_All|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Production|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\dom\EditingText.h"
- >
- </File>
- <File
+ <File
RelativePath="..\dom\Element.cpp"
>
<FileConfiguration
@@ -76909,6 +76853,10 @@ >
</File>
<File
+ RelativePath="..\inspector\front-end\TimelinePanelDescriptor.js"
+ >
+ </File>
+ <File
RelativePath="..\inspector\front-end\TimelinePresentationModel.js"
>
</File>
diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj index 3c68e5d4b..f7173f8e9 100644 --- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj +++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj @@ -1040,6 +1040,11 @@ 3AC648B2129E146500C3EB25 /* EditingBoundary.h in Headers */ = {isa = PBXBuildFile; fileRef = 3AC648B1129E146500C3EB25 /* EditingBoundary.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3C244FEAA375AC633F88BE6F /* RenderLayerModelObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C244FE4A375AC633F88BE6F /* RenderLayerModelObject.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3C244FEBA375AC633F88BE6F /* RenderLayerModelObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C244FE5A375AC633F88BE6F /* RenderLayerModelObject.cpp */; }; + 3F2B33EB165AF15600E3987C /* DOMWebKitCSSViewportRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3F2B33E6165AF15500E3987C /* DOMWebKitCSSViewportRule.h */; }; + 3F2B33EC165AF15600E3987C /* DOMWebKitCSSViewportRule.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3F2B33E7165AF15500E3987C /* DOMWebKitCSSViewportRule.mm */; }; + 3F2B33ED165AF15600E3987C /* DOMWebKitCSSViewportRuleInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 3F2B33E8165AF15500E3987C /* DOMWebKitCSSViewportRuleInternal.h */; }; + 3F2B33EE165AF15600E3987C /* JSWebKitCSSViewportRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3F2B33E9165AF15500E3987C /* JSWebKitCSSViewportRule.cpp */; }; + 3F2B33EF165AF15600E3987C /* JSWebKitCSSViewportRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3F2B33EA165AF15500E3987C /* JSWebKitCSSViewportRule.h */; }; 3FFFF9A8159D9A550020BBD5 /* WebKitCSSViewportRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3FFFF9A6159D9A550020BBD5 /* WebKitCSSViewportRule.cpp */; }; 3FFFF9A9159D9A550020BBD5 /* WebKitCSSViewportRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3FFFF9A7159D9A550020BBD5 /* WebKitCSSViewportRule.h */; }; 3FFFF9AD159D9B060020BBD5 /* ViewportStyleResolver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3FFFF9AB159D9B060020BBD5 /* ViewportStyleResolver.cpp */; }; @@ -1770,8 +1775,6 @@ 6550B6A0099DF0270090D781 /* CharacterData.h in Headers */ = {isa = PBXBuildFile; fileRef = 6550B696099DF0270090D781 /* CharacterData.h */; settings = {ATTRIBUTES = (Private, ); }; }; 6550B6A1099DF0270090D781 /* Comment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6550B697099DF0270090D781 /* Comment.cpp */; }; 6550B6A2099DF0270090D781 /* Comment.h in Headers */ = {isa = PBXBuildFile; fileRef = 6550B698099DF0270090D781 /* Comment.h */; }; - 6550B6A3099DF0270090D781 /* EditingText.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6550B699099DF0270090D781 /* EditingText.cpp */; }; - 6550B6A4099DF0270090D781 /* EditingText.h in Headers */ = {isa = PBXBuildFile; fileRef = 6550B69A099DF0270090D781 /* EditingText.h */; }; 6550B6A5099DF0270090D781 /* Text.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6550B69B099DF0270090D781 /* Text.cpp */; }; 6550B6A6099DF0270090D781 /* Text.h in Headers */ = {isa = PBXBuildFile; fileRef = 6550B69C099DF0270090D781 /* Text.h */; settings = {ATTRIBUTES = (Private, ); }; }; 65653F2D0D9727D200CA9723 /* SVGAltGlyphElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65653F2A0D9727D200CA9723 /* SVGAltGlyphElement.cpp */; }; @@ -8219,6 +8222,12 @@ 3AC648B1129E146500C3EB25 /* EditingBoundary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditingBoundary.h; sourceTree = "<group>"; }; 3C244FE4A375AC633F88BE6F /* RenderLayerModelObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderLayerModelObject.h; sourceTree = "<group>"; }; 3C244FE5A375AC633F88BE6F /* RenderLayerModelObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderLayerModelObject.cpp; sourceTree = "<group>"; }; + 3F2B33E3165ABD3500E3987C /* WebKitCSSViewportRule.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebKitCSSViewportRule.idl; sourceTree = "<group>"; }; + 3F2B33E6165AF15500E3987C /* DOMWebKitCSSViewportRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWebKitCSSViewportRule.h; sourceTree = "<group>"; }; + 3F2B33E7165AF15500E3987C /* DOMWebKitCSSViewportRule.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMWebKitCSSViewportRule.mm; sourceTree = "<group>"; }; + 3F2B33E8165AF15500E3987C /* DOMWebKitCSSViewportRuleInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWebKitCSSViewportRuleInternal.h; sourceTree = "<group>"; }; + 3F2B33E9165AF15500E3987C /* JSWebKitCSSViewportRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitCSSViewportRule.cpp; sourceTree = "<group>"; }; + 3F2B33EA165AF15500E3987C /* JSWebKitCSSViewportRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebKitCSSViewportRule.h; sourceTree = "<group>"; }; 3FFFF9A6159D9A550020BBD5 /* WebKitCSSViewportRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitCSSViewportRule.cpp; sourceTree = "<group>"; }; 3FFFF9A7159D9A550020BBD5 /* WebKitCSSViewportRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitCSSViewportRule.h; sourceTree = "<group>"; }; 3FFFF9AB159D9B060020BBD5 /* ViewportStyleResolver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ViewportStyleResolver.cpp; sourceTree = "<group>"; }; @@ -9018,8 +9027,6 @@ 6550B696099DF0270090D781 /* CharacterData.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CharacterData.h; sourceTree = "<group>"; }; 6550B697099DF0270090D781 /* Comment.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Comment.cpp; sourceTree = "<group>"; }; 6550B698099DF0270090D781 /* Comment.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Comment.h; sourceTree = "<group>"; }; - 6550B699099DF0270090D781 /* EditingText.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = EditingText.cpp; sourceTree = "<group>"; }; - 6550B69A099DF0270090D781 /* EditingText.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = EditingText.h; sourceTree = "<group>"; }; 6550B69B099DF0270090D781 /* Text.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Text.cpp; sourceTree = "<group>"; }; 6550B69C099DF0270090D781 /* Text.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Text.h; sourceTree = "<group>"; }; 65653F2A0D9727D200CA9723 /* SVGAltGlyphElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAltGlyphElement.cpp; sourceTree = "<group>"; }; @@ -16254,6 +16261,9 @@ 31611E5E0E1C4E1400F6A579 /* DOMWebKitCSSTransformValue.h */, 31611E5F0E1C4E1400F6A579 /* DOMWebKitCSSTransformValue.mm */, 31611E600E1C4E1400F6A579 /* DOMWebKitCSSTransformValueInternal.h */, + 3F2B33E6165AF15500E3987C /* DOMWebKitCSSViewportRule.h */, + 3F2B33E7165AF15500E3987C /* DOMWebKitCSSViewportRule.mm */, + 3F2B33E8165AF15500E3987C /* DOMWebKitCSSViewportRuleInternal.h */, ); name = CSS; sourceTree = "<group>"; @@ -19065,6 +19075,8 @@ 8ACC24CE148E24B200EFCC0D /* JSWebKitCSSRegionRule.h */, 31611E580E1C4DE000F6A579 /* JSWebKitCSSTransformValue.cpp */, 31611E590E1C4DE000F6A579 /* JSWebKitCSSTransformValue.h */, + 3F2B33E9165AF15500E3987C /* JSWebKitCSSViewportRule.cpp */, + 3F2B33EA165AF15500E3987C /* JSWebKitCSSViewportRule.h */, ); name = CSS; sourceTree = "<group>"; @@ -21508,6 +21520,7 @@ 31611E540E1C4D4A00F6A579 /* WebKitCSSTransformValue.idl */, 3FFFF9A6159D9A550020BBD5 /* WebKitCSSViewportRule.cpp */, 3FFFF9A7159D9A550020BBD5 /* WebKitCSSViewportRule.h */, + 3F2B33E3165ABD3500E3987C /* WebKitCSSViewportRule.idl */, ); path = css; sourceTree = "<group>"; @@ -21891,8 +21904,6 @@ 05FD69DF12845D4300B2BEB3 /* DOMTimeStamp.h */, BC7FA61E0D1F0CBD00DB22A9 /* DynamicNodeList.cpp */, BC7FA61F0D1F0CBD00DB22A9 /* DynamicNodeList.h */, - 6550B699099DF0270090D781 /* EditingText.cpp */, - 6550B69A099DF0270090D781 /* EditingText.h */, A8C4A7F609D563270003AC8D /* Element.cpp */, A8C4A7F509D563270003AC8D /* Element.h */, 93EEC1EA09C2877700C515D1 /* Element.idl */, @@ -23541,7 +23552,6 @@ 4F1534E011B533020021FD86 /* EditingBehaviorTypes.h in Headers */, 3AC648B2129E146500C3EB25 /* EditingBoundary.h in Headers */, 9BAB6C6C12550631001626D4 /* EditingStyle.h in Headers */, - 6550B6A4099DF0270090D781 /* EditingText.h in Headers */, 4B3043CD0AE0373B00A82647 /* Editor.h in Headers */, 1AF326790D78B9440068F0C4 /* EditorClient.h in Headers */, 4BAE95B10B2FA9CE00AED8A0 /* EditorDeleteAction.h in Headers */, @@ -25785,6 +25795,9 @@ 50D32858163B313F0016111E /* ValidatedCustomFilterOperation.h in Headers */, 3FFFF9AE159D9B060020BBD5 /* ViewportStyleResolver.h in Headers */, 3FFFF9A9159D9A550020BBD5 /* WebKitCSSViewportRule.h in Headers */, + 3F2B33EB165AF15600E3987C /* DOMWebKitCSSViewportRule.h in Headers */, + 3F2B33ED165AF15600E3987C /* DOMWebKitCSSViewportRuleInternal.h in Headers */, + 3F2B33EF165AF15600E3987C /* JSWebKitCSSViewportRule.h in Headers */, 93C38BFF164473C700091EB2 /* ScrollingStateFixedNode.h in Headers */, 93C38C03164473DD00091EB2 /* ScrollingTreeFixedNode.h in Headers */, E1424C8A164B3B4E00F32D40 /* PlatformCookieJar.h in Headers */, @@ -26805,7 +26818,6 @@ FD6ED2C3136B8E42003CF072 /* DynamicsCompressorNode.cpp in Sources */, 93309DE3099E64920056E581 /* EditCommand.cpp in Sources */, 9BAB6C6D12550631001626D4 /* EditingStyle.cpp in Sources */, - 6550B6A3099DF0270090D781 /* EditingText.cpp in Sources */, 4B3043CC0AE0373B00A82647 /* Editor.cpp in Sources */, 93A38B4B0D0E5808006872C2 /* EditorCommand.cpp in Sources */, ED501DC60B249F2900AE18D9 /* EditorMac.mm in Sources */, @@ -28882,6 +28894,8 @@ 1AA21250163F0DA80000E63F /* AtomicStringCF.cpp in Sources */, 50D32857163B313F0016111E /* ValidatedCustomFilterOperation.cpp in Sources */, 3FFFF9A8159D9A550020BBD5 /* WebKitCSSViewportRule.cpp in Sources */, + 3F2B33EC165AF15600E3987C /* DOMWebKitCSSViewportRule.mm in Sources */, + 3F2B33EE165AF15600E3987C /* JSWebKitCSSViewportRule.cpp in Sources */, 4FFC022B1643B710004E1638 /* NodeRareData.cpp in Sources */, 4FFC022D1643B726004E1638 /* ElementRareData.cpp in Sources */, 93C38BFE164473C700091EB2 /* ScrollingStateFixedNode.cpp in Sources */, diff --git a/Source/WebCore/accessibility/AccessibilityObject.cpp b/Source/WebCore/accessibility/AccessibilityObject.cpp index 3ef84370c..a11281ede 100644 --- a/Source/WebCore/accessibility/AccessibilityObject.cpp +++ b/Source/WebCore/accessibility/AccessibilityObject.cpp @@ -73,7 +73,7 @@ AccessibilityObject::AccessibilityObject() , m_haveChildren(false) , m_role(UnknownRole) , m_cachedIsIgnoredValue(DefaultBehavior) -#if PLATFORM(GTK) +#if PLATFORM(GTK) || PLATFORM(EFL) , m_wrapper(0) #elif PLATFORM(CHROMIUM) , m_detached(false) diff --git a/Source/WebCore/accessibility/AccessibilityObject.h b/Source/WebCore/accessibility/AccessibilityObject.h index 05e130f15..8b4acfa95 100644 --- a/Source/WebCore/accessibility/AccessibilityObject.h +++ b/Source/WebCore/accessibility/AccessibilityObject.h @@ -61,7 +61,7 @@ OBJC_CLASS WebAccessibilityObjectWrapper; typedef WebAccessibilityObjectWrapper AccessibilityObjectWrapper; -#elif PLATFORM(GTK) +#elif PLATFORM(GTK) || PLATFORM(EFL) typedef struct _AtkObject AtkObject; typedef struct _AtkObject AccessibilityObjectWrapper; #elif PLATFORM(CHROMIUM) @@ -778,7 +778,7 @@ public: virtual String mathFencedCloseString() const { return String(); } #if HAVE(ACCESSIBILITY) -#if PLATFORM(GTK) +#if PLATFORM(GTK) || PLATFORM(EFL) AccessibilityObjectWrapper* wrapper() const; void setWrapper(AccessibilityObjectWrapper*); #elif !PLATFORM(CHROMIUM) @@ -826,7 +826,7 @@ protected: static bool objectMatchesSearchCriteriaWithResultLimit(AccessibilityObject*, AccessibilitySearchCriteria*, AccessibilityChildrenVector&); virtual AccessibilityRole buttonRoleType() const; -#if PLATFORM(GTK) +#if PLATFORM(GTK) || PLATFORM(EFL) bool allowsTextRanges() const; unsigned getLengthForTextRange() const; #else @@ -838,7 +838,7 @@ protected: RetainPtr<WebAccessibilityObjectWrapper> m_wrapper; #elif PLATFORM(WIN) && !OS(WINCE) COMPtr<AccessibilityObjectWrapper> m_wrapper; -#elif PLATFORM(GTK) +#elif PLATFORM(GTK) || PLATFORM(EFL) AtkObject* m_wrapper; #elif PLATFORM(CHROMIUM) bool m_detached; diff --git a/Source/WebCore/bindings/js/JSCSSRuleCustom.cpp b/Source/WebCore/bindings/js/JSCSSRuleCustom.cpp index a25cc543a..2a465dc7d 100644 --- a/Source/WebCore/bindings/js/JSCSSRuleCustom.cpp +++ b/Source/WebCore/bindings/js/JSCSSRuleCustom.cpp @@ -42,9 +42,11 @@ #include "JSWebKitCSSKeyframeRule.h" #include "JSWebKitCSSKeyframesRule.h" #include "JSWebKitCSSRegionRule.h" +#include "JSWebKitCSSViewportRule.h" #include "WebKitCSSKeyframeRule.h" #include "WebKitCSSKeyframesRule.h" #include "WebKitCSSRegionRule.h" +#include "WebKitCSSViewportRule.h" using namespace JSC; @@ -94,6 +96,11 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, CSSRule* rule) case CSSRule::WEBKIT_KEYFRAMES_RULE: wrapper = CREATE_DOM_WRAPPER(exec, globalObject, WebKitCSSKeyframesRule, rule); break; +#if ENABLE(CSS_DEVICE_ADAPTATION) + case CSSRule::WEBKIT_VIEWPORT_RULE: + wrapper = CREATE_DOM_WRAPPER(exec, globalObject, WebKitCSSViewportRule, rule); + break; +#endif #if ENABLE(CSS_REGIONS) case CSSRule::WEBKIT_REGION_RULE: wrapper = CREATE_DOM_WRAPPER(exec, globalObject, WebKitCSSRegionRule, rule); diff --git a/Source/WebCore/bindings/objc/DOMCSS.mm b/Source/WebCore/bindings/objc/DOMCSS.mm index 1adabff22..3c1da8231 100644 --- a/Source/WebCore/bindings/objc/DOMCSS.mm +++ b/Source/WebCore/bindings/objc/DOMCSS.mm @@ -57,6 +57,10 @@ #import "DOMWebKitCSSRegionRule.h" #endif +#if ENABLE(CSS_DEVICE_ADAPTATION) +#import "DOMWebKitCSSViewportRule.h" +#endif + #if ENABLE(SVG_DOM_OBJC_BINDINGS) #import "DOMSVGPaint.h" #endif @@ -95,6 +99,10 @@ Class kitClass(WebCore::CSSRule* impl) return [DOMWebKitCSSKeyframesRule class]; case DOM_WEBKIT_KEYFRAME_RULE: return [DOMWebKitCSSKeyframeRule class]; +#if ENABLE(CSS_DEVICE_ADAPTATION) + case DOM_WEBKIT_VIEWPORT_RULE: + return [DOMWebKitCSSViewportRule class]; +#endif #if ENABLE(CSS_REGIONS) case DOM_WEBKIT_REGION_RULE: return [DOMWebKitCSSRegionRule class]; diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm index 19c90be05..8d56bb682 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -3047,7 +3047,7 @@ END instance->SetAccessCheckCallbacks(V8DOMWindow::namedSecurityCheck, V8DOMWindow::indexedSecurityCheck, v8::External::New(&V8DOMWindow::info), false); END } - if ($interfaceName eq "HTMLDocument") { + if ($interfaceName eq "HTMLDocument" or $interfaceName eq "DedicatedWorkerContext" or $interfaceName eq "SharedWorkerContext") { push(@implContent, <<END); desc->SetHiddenPrototype(true); END diff --git a/Source/WebCore/bindings/scripts/IDLParser.pm b/Source/WebCore/bindings/scripts/IDLParser.pm index 5502efbaa..654c92012 100644 --- a/Source/WebCore/bindings/scripts/IDLParser.pm +++ b/Source/WebCore/bindings/scripts/IDLParser.pm @@ -35,14 +35,13 @@ use constant EmptyToken => 5; # Used to represent a parsed IDL document struct( idlDocument => { - module => '$', # Module identifier interfaces => '@', # All parsed interfaces fileName => '$' # file name }); # Used to represent 'interface' blocks struct( domInterface => { - name => '$', # Class identifier (without module) + name => '$', # Class identifier parents => '@', # List of strings constants => '@', # List of 'domConstant' functions => '@', # List of 'domFunction' @@ -173,7 +172,6 @@ sub Parse $document = $definitions[0]; } else { $document = idlDocument->new(); - $document->module(""); push(@{$document->interfaces}, @definitions); } @@ -2069,36 +2067,12 @@ sub parseDefinitionOld if ($next->value() eq "typedef") { return $self->parseTypedef({}); } - if ($next->value() eq "module") { - return $self->parseModule(); - } if ($next->type() == IdentifierToken || $next->value() eq "::") { return $self->parseImplementsStatement({}); } $self->assertUnexpectedToken($next->value(), __LINE__); } -sub parseModule -{ - my $self = shift; - my $next = $self->nextToken(); - if ($next->value() eq "module") { - my $document = idlDocument->new(); - $self->assertTokenValue($self->getToken(), "module", __LINE__); - my $extendedAttributeList = $self->parseExtendedAttributeListAllowEmpty(); - my $token = $self->getToken(); - $self->assertTokenType($token, IdentifierToken); - $self->assertTokenValue($self->getToken(), "{", __LINE__); - $document->module($token->value()); - my $definitions = $self->parseDefinitions(); - push(@{$document->interfaces}, @{$definitions}); - $self->assertTokenValue($self->getToken(), "}", __LINE__); - $self->parseOptionalSemicolon(); - return $document; - } - $self->assertUnexpectedToken($next->value(), __LINE__); -} - sub parseCallbackOrInterfaceOld { my $self = shift; diff --git a/Source/WebCore/bindings/v8/DOMDataStore.cpp b/Source/WebCore/bindings/v8/DOMDataStore.cpp index 58897c773..91fb9dce6 100644 --- a/Source/WebCore/bindings/v8/DOMDataStore.cpp +++ b/Source/WebCore/bindings/v8/DOMDataStore.cpp @@ -60,9 +60,9 @@ DOMDataStore* DOMDataStore::current(v8::Isolate* isolate) return data->domDataStore(); if (DOMWrapperWorld::isolatedWorldsExist()) { - V8DOMWindowShell* shell = V8DOMWindowShell::isolated(v8::Context::GetEntered()); - if (UNLIKELY(!!shell)) - return shell->world()->isolatedWorldDOMDataStore(); + DOMWrapperWorld* isolatedWorld = DOMWrapperWorld::isolated(v8::Context::GetEntered()); + if (UNLIKELY(!!isolatedWorld)) + return isolatedWorld->isolatedWorldDOMDataStore(); } return &mainWorldDOMDataStore; diff --git a/Source/WebCore/bindings/v8/DOMWrapperWorld.cpp b/Source/WebCore/bindings/v8/DOMWrapperWorld.cpp index d3a0952a9..0e9433b95 100644 --- a/Source/WebCore/bindings/v8/DOMWrapperWorld.cpp +++ b/Source/WebCore/bindings/v8/DOMWrapperWorld.cpp @@ -32,6 +32,9 @@ #include "DOMWrapperWorld.h" #include "DOMDataStore.h" +#include "V8Binding.h" +#include "V8DOMWindow.h" +#include "V8DOMWrapper.h" #include <wtf/MainThread.h> #include <wtf/StdLibExtras.h> @@ -64,6 +67,35 @@ DOMWrapperWorld* mainThreadNormalWorld() return cachedNormalWorld.get(); } +#ifndef NDEBUG +void DOMWrapperWorld::assertContextHasCorrectPrototype(v8::Handle<v8::Context> context) +{ + ASSERT(isMainThread()); + ASSERT(V8DOMWrapper::isWrapperOfType(toInnerGlobalObject(context), &V8DOMWindow::info)); +} +#endif + +static void isolatedWorldWeakCallback(v8::Persistent<v8::Value> object, void* parameter) +{ + object.Dispose(); + object.Clear(); + static_cast<DOMWrapperWorld*>(parameter)->deref(); +} + +void DOMWrapperWorld::makeContextWeak(v8::Handle<v8::Context> context) +{ + ASSERT(isIsolatedWorld()); + ASSERT(isolated(context) == this); + v8::Persistent<v8::Context>::New(context).MakeWeak(this, isolatedWorldWeakCallback); + // Matching deref is in weak callback. + this->ref(); +} + +void DOMWrapperWorld::setIsolatedWorldField(v8::Handle<v8::Context> context) +{ + context->SetAlignedPointerInEmbedderData(v8ContextIsolatedWorld, isMainWorld() ? 0 : this); +} + typedef HashMap<int, DOMWrapperWorld*> WorldMap; static WorldMap& isolatedWorldMap() { @@ -80,29 +112,24 @@ void DOMWrapperWorld::getAllWorlds(Vector<RefPtr<DOMWrapperWorld> >& worlds) worlds.append(it->value); } -void DOMWrapperWorld::deallocate(DOMWrapperWorld* world) +DOMWrapperWorld::~DOMWrapperWorld() { - int worldId = world->worldId(); + ASSERT(!isMainWorld()); - // Ensure we never deallocate mainThreadNormalWorld - if (worldId == mainWorldId) - return; - - delete world; - - if (worldId == uninitializedWorldId) + if (!isIsolatedWorld()) return; WorldMap& map = isolatedWorldMap(); - WorldMap::iterator i = map.find(worldId); + WorldMap::iterator i = map.find(m_worldId); if (i == map.end()) { ASSERT_NOT_REACHED(); return; } - ASSERT(i->value == world); + ASSERT(i->value == this); map.remove(i); isolatedWorldCount--; + ASSERT(map.size() == isolatedWorldCount); } static int temporaryWorldId = DOMWrapperWorld::uninitializedWorldId-1; @@ -126,6 +153,8 @@ PassRefPtr<DOMWrapperWorld> DOMWrapperWorld::ensureIsolatedWorld(int worldId, in RefPtr<DOMWrapperWorld> world = adoptRef(new DOMWrapperWorld(worldId, extensionGroup)); map.add(worldId, world.get()); isolatedWorldCount++; + ASSERT(map.size() == isolatedWorldCount); + return world.release(); } diff --git a/Source/WebCore/bindings/v8/DOMWrapperWorld.h b/Source/WebCore/bindings/v8/DOMWrapperWorld.h index 2900886d7..0ed826c19 100644 --- a/Source/WebCore/bindings/v8/DOMWrapperWorld.h +++ b/Source/WebCore/bindings/v8/DOMWrapperWorld.h @@ -32,6 +32,8 @@ #define DOMWrapperWorld_h #include "SecurityOrigin.h" +#include "V8PerContextData.h" +#include <v8.h> #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> #include <wtf/RefPtr.h> @@ -42,7 +44,7 @@ namespace WebCore { class DOMDataStore; // This class represent a collection of DOM wrappers for a specific world. -class DOMWrapperWorld : public WTF::RefCountedBase { +class DOMWrapperWorld : public RefCounted<DOMWrapperWorld> { public: static const int mainWorldId = 0; static const int mainWorldExtensionGroup = 0; @@ -50,9 +52,25 @@ public: static const int uninitializedExtensionGroup = -1; // If uninitializedWorldId is passed as worldId, the world will be assigned a temporary id instead. static PassRefPtr<DOMWrapperWorld> ensureIsolatedWorld(int worldId, int extensionGroup); + ~DOMWrapperWorld(); + static bool isolatedWorldsExist() { return isolatedWorldCount; } static bool isIsolatedWorldId(int worldId) { return worldId != mainWorldId && worldId != uninitializedWorldId; } static void getAllWorlds(Vector<RefPtr<DOMWrapperWorld> >& worlds); + + void makeContextWeak(v8::Handle<v8::Context>); + void setIsolatedWorldField(v8::Handle<v8::Context>); +#ifndef NDEBUG + static void assertContextHasCorrectPrototype(v8::Handle<v8::Context>); +#endif + static DOMWrapperWorld* isolated(v8::Handle<v8::Context> context) + { +#ifndef NDEBUG + assertContextHasCorrectPrototype(context); +#endif + return static_cast<DOMWrapperWorld*>(context->GetAlignedPointerFromEmbedderData(v8ContextIsolatedWorld)); + } + // Associates an isolated world (see above for description) with a security // origin. XMLHttpRequest instances used in that world will be considered // to come from that origin, not the frame's. @@ -85,16 +103,10 @@ public: ASSERT(isIsolatedWorld()); return m_domDataStore.get(); } - void deref() - { - if (derefBase()) - deallocate(this); - } private: static int isolatedWorldCount; static PassRefPtr<DOMWrapperWorld> createMainWorld(); - static void deallocate(DOMWrapperWorld*); DOMWrapperWorld(int worldId, int extensionGroup); diff --git a/Source/WebCore/bindings/v8/JavaScriptCallFrame.cpp b/Source/WebCore/bindings/v8/JavaScriptCallFrame.cpp index 3274def38..88652c838 100644 --- a/Source/WebCore/bindings/v8/JavaScriptCallFrame.cpp +++ b/Source/WebCore/bindings/v8/JavaScriptCallFrame.cpp @@ -95,7 +95,7 @@ String JavaScriptCallFrame::functionName() const v8::HandleScope handleScope; v8::Context::Scope contextScope(m_debuggerContext.get()); v8::Handle<v8::Value> result = m_callFrame.get()->Get(v8String("functionName")); - return toWebCoreStringWithNullOrUndefinedCheck(result); + return toWebCoreStringWithUndefinedOrNullCheck(result); } v8::Handle<v8::Value> JavaScriptCallFrame::scopeChain() const diff --git a/Source/WebCore/bindings/v8/ScriptController.cpp b/Source/WebCore/bindings/v8/ScriptController.cpp index 48d5bcdfc..f0aae1fa0 100644 --- a/Source/WebCore/bindings/v8/ScriptController.cpp +++ b/Source/WebCore/bindings/v8/ScriptController.cpp @@ -347,7 +347,7 @@ V8DOMWindowShell* ScriptController::existingWindowShell(DOMWrapperWorld* world) IsolatedWorldMap::iterator iter = m_isolatedWorlds.find(world->worldId()); if (iter == m_isolatedWorlds.end()) return 0; - return iter->value->isContextInitialized() ? iter->value : 0; + return iter->value->isContextInitialized() ? iter->value.get() : 0; } V8DOMWindowShell* ScriptController::windowShell(DOMWrapperWorld* world) @@ -360,11 +360,11 @@ V8DOMWindowShell* ScriptController::windowShell(DOMWrapperWorld* world) else { IsolatedWorldMap::iterator iter = m_isolatedWorlds.find(world->worldId()); if (iter != m_isolatedWorlds.end()) - shell = iter->value; + shell = iter->value.get(); else { OwnPtr<V8DOMWindowShell> isolatedWorldShell = V8DOMWindowShell::create(m_frame, world); shell = isolatedWorldShell.get(); - m_isolatedWorlds.set(world->worldId(), isolatedWorldShell.leakPtr()); + m_isolatedWorlds.set(world->worldId(), isolatedWorldShell.release()); } } if (!shell->isContextInitialized() && shell->initializeIfNeeded()) { @@ -407,9 +407,8 @@ void ScriptController::evaluateInIsolatedWorld(int worldID, const Vector<ScriptS // Mark temporary shell for weak destruction. if (worldID == DOMWrapperWorld::uninitializedWorldId) { - int actualWorldId = isolatedWorldShell->world()->worldId(); - m_isolatedWorlds.remove(actualWorldId); isolatedWorldShell->destroyIsolatedShell(); + m_isolatedWorlds.remove(world->worldId()); } v8Results = evaluateHandleScope.Close(resultArray); @@ -444,7 +443,7 @@ v8::Local<v8::Context> ScriptController::currentWorldContext() { if (v8::Context::InContext()) { v8::Handle<v8::Context> context = v8::Context::GetEntered(); - if (V8DOMWindowShell::isolated(context)) { + if (DOMWrapperWorld::isolated(context)) { if (m_frame == toFrameIfNotDetached(context)) return v8::Local<v8::Context>::New(context); return v8::Local<v8::Context>(); @@ -673,7 +672,7 @@ void ScriptController::collectIsolatedContexts(Vector<std::pair<ScriptState*, Se { v8::HandleScope handleScope; for (IsolatedWorldMap::iterator it = m_isolatedWorlds.begin(); it != m_isolatedWorlds.end(); ++it) { - V8DOMWindowShell* isolatedWorldShell = it->value; + V8DOMWindowShell* isolatedWorldShell = it->value.get(); SecurityOrigin* origin = isolatedWorldShell->world()->isolatedWorldSecurityOrigin(); if (!origin) continue; diff --git a/Source/WebCore/bindings/v8/ScriptController.h b/Source/WebCore/bindings/v8/ScriptController.h index b708ee228..66a573434 100644 --- a/Source/WebCore/bindings/v8/ScriptController.h +++ b/Source/WebCore/bindings/v8/ScriptController.h @@ -193,10 +193,7 @@ public: static int contextDebugId(v8::Handle<v8::Context>); private: - // Note: although the pointer is raw, the instance is kept alive by a strong - // reference to the v8 context it contains, which is not made weak until we - // call world->destroyIsolatedShell(). - typedef HashMap<int, V8DOMWindowShell*> IsolatedWorldMap; + typedef HashMap<int, OwnPtr<V8DOMWindowShell> > IsolatedWorldMap; void reset(); @@ -204,10 +201,6 @@ private: const String* m_sourceURL; OwnPtr<V8DOMWindowShell> m_windowShell; - - // The isolated worlds we are tracking for this frame. We hold them alive - // here so that they can be used again by future calls to - // evaluateInIsolatedWorld(). IsolatedWorldMap m_isolatedWorlds; bool m_paused; diff --git a/Source/WebCore/bindings/v8/ScriptDebugServer.cpp b/Source/WebCore/bindings/v8/ScriptDebugServer.cpp index ec0c68871..ad9d967da 100644 --- a/Source/WebCore/bindings/v8/ScriptDebugServer.cpp +++ b/Source/WebCore/bindings/v8/ScriptDebugServer.cpp @@ -239,7 +239,7 @@ bool ScriptDebugServer::setScriptSource(const String& sourceID, const String& ne if (tryCatch.HasCaught()) { v8::Local<v8::Message> message = tryCatch.Message(); if (!message.IsEmpty()) - *error = toWebCoreStringWithNullOrUndefinedCheck(message->Get()); + *error = toWebCoreStringWithUndefinedOrNullCheck(message->Get()); else *error = "Unknown error."; return false; @@ -377,12 +377,12 @@ void ScriptDebugServer::handleV8DebugEvent(const v8::Debug::EventDetails& eventD void ScriptDebugServer::dispatchDidParseSource(ScriptDebugListener* listener, v8::Handle<v8::Object> object) { - String sourceID = toWebCoreStringWithNullOrUndefinedCheck(object->Get(v8::String::New("id"))); + String sourceID = toWebCoreStringWithUndefinedOrNullCheck(object->Get(v8::String::New("id"))); ScriptDebugListener::Script script; - script.url = toWebCoreStringWithNullOrUndefinedCheck(object->Get(v8::String::New("name"))); - script.source = toWebCoreStringWithNullOrUndefinedCheck(object->Get(v8::String::New("source"))); - script.sourceMappingURL = toWebCoreStringWithNullOrUndefinedCheck(object->Get(v8::String::New("sourceMappingURL"))); + script.url = toWebCoreStringWithUndefinedOrNullCheck(object->Get(v8::String::New("name"))); + script.source = toWebCoreStringWithUndefinedOrNullCheck(object->Get(v8::String::New("source"))); + script.sourceMappingURL = toWebCoreStringWithUndefinedOrNullCheck(object->Get(v8::String::New("sourceMappingURL"))); script.startLine = object->Get(v8::String::New("startLine"))->ToInteger()->Value(); script.startColumn = object->Get(v8::String::New("startColumn"))->ToInteger()->Value(); script.endLine = object->Get(v8::String::New("endLine"))->ToInteger()->Value(); @@ -444,13 +444,13 @@ void ScriptDebugServer::compileScript(ScriptState* state, const String& expressi if (tryCatch.HasCaught()) { v8::Local<v8::Message> message = tryCatch.Message(); if (!message.IsEmpty()) - *exceptionMessage = toWebCoreStringWithNullOrUndefinedCheck(message->Get()); + *exceptionMessage = toWebCoreStringWithUndefinedOrNullCheck(message->Get()); return; } if (script.IsEmpty()) return; - *scriptId = toWebCoreStringWithNullOrUndefinedCheck(script->Id()); + *scriptId = toWebCoreStringWithUndefinedOrNullCheck(script->Id()); m_compiledScripts.set(*scriptId, adoptPtr(new ScopedPersistent<v8::Script>(script))); } @@ -488,7 +488,7 @@ void ScriptDebugServer::runScript(ScriptState* state, const String& scriptId, Sc *result = ScriptValue(tryCatch.Exception()); v8::Local<v8::Message> message = tryCatch.Message(); if (!message.IsEmpty()) - *exceptionMessage = toWebCoreStringWithNullOrUndefinedCheck(message->Get()); + *exceptionMessage = toWebCoreStringWithUndefinedOrNullCheck(message->Get()); } else *result = ScriptValue(value); } diff --git a/Source/WebCore/bindings/v8/ScriptEventListener.cpp b/Source/WebCore/bindings/v8/ScriptEventListener.cpp index c769a7723..550a24ecd 100644 --- a/Source/WebCore/bindings/v8/ScriptEventListener.cpp +++ b/Source/WebCore/bindings/v8/ScriptEventListener.cpp @@ -118,7 +118,7 @@ bool eventListenerHandlerLocation(Document* document, EventListener* listener, S v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(object); v8::Handle<v8::Value> scriptIdValue = function->GetScriptId(); - scriptId = toWebCoreStringWithNullOrUndefinedCheck(scriptIdValue); + scriptId = toWebCoreStringWithUndefinedOrNullCheck(scriptIdValue); v8::ScriptOrigin origin = function->GetScriptOrigin(); if (origin.ResourceName()->IsString() && !origin.ResourceName().IsEmpty()) sourceName = toWebCoreString(origin.ResourceName()); diff --git a/Source/WebCore/bindings/v8/V8Binding.h b/Source/WebCore/bindings/v8/V8Binding.h index 0a1dc09a1..eaba5d074 100644 --- a/Source/WebCore/bindings/v8/V8Binding.h +++ b/Source/WebCore/bindings/v8/V8Binding.h @@ -32,10 +32,10 @@ #define V8Binding_h #include "BindingSecurity.h" +#include "DOMWrapperWorld.h" #include "Document.h" #include "V8BindingMacros.h" #include "V8DOMConfiguration.h" -#include "V8DOMWindowShell.h" #include "V8DOMWrapper.h" #include "V8HiddenPropertyName.h" #include "V8ObjectConstructor.h" @@ -333,7 +333,7 @@ namespace WebCore { return value->IsNull() ? String() : toWebCoreString(value); } - inline String toWebCoreStringWithNullOrUndefinedCheck(v8::Handle<v8::Value> value) + inline String toWebCoreStringWithUndefinedOrNullCheck(v8::Handle<v8::Value> value) { return (value->IsNull() || value->IsUndefined()) ? String() : toWebCoreString(value); } @@ -383,10 +383,7 @@ namespace WebCore { { if (!v8::Context::InContext()) return 0; - V8DOMWindowShell* shell = V8DOMWindowShell::isolated(v8::Context::GetEntered()); - if (!shell) - return 0; - return shell->world(); + return DOMWrapperWorld::isolated(v8::Context::GetEntered()); } // If the current context causes out of memory, JavaScript setting diff --git a/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp b/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp index ca6e5e1f6..e67eb2e1f 100644 --- a/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp +++ b/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp @@ -94,18 +94,19 @@ V8DOMWindowShell::V8DOMWindowShell(Frame* frame, PassRefPtr<DOMWrapperWorld> wor void V8DOMWindowShell::destroyIsolatedShell() { - disposeContext(true); -} + ASSERT(m_world->isIsolatedWorld()); -static void isolatedContextWeakCallback(v8::Persistent<v8::Value> object, void* parameter) -{ - // Handle will be disposed in delete. - delete static_cast<V8DOMWindowShell*>(parameter); + if (m_context.isEmpty()) + return; + + v8::HandleScope handleScope; + m_world->makeContextWeak(m_context.get()); + disposeContext(); + destroyGlobal(); } -void V8DOMWindowShell::disposeContext(bool weak) +void V8DOMWindowShell::disposeContext() { - ASSERT(!m_context.get().IsWeak()); m_perContextData.clear(); if (m_context.isEmpty()) @@ -113,22 +114,13 @@ void V8DOMWindowShell::disposeContext(bool weak) m_frame->loader()->client()->willReleaseScriptContext(m_context.get(), m_world->worldId()); - if (!weak) - m_context.clear(); - else { - ASSERT(!m_world->isMainWorld()); - destroyGlobal(); - m_frame = 0; - m_context.get().MakeWeak(this, isolatedContextWeakCallback); - } + m_context.clear(); // It's likely that disposing the context has created a lot of // garbage. Notify V8 about this so it'll have a chance of cleaning // it up when idle. - if (m_world->isMainWorld()) { - bool isMainFrame = m_frame->page() && (m_frame->page()->mainFrame() == m_frame); - V8GCForContextDispose::instance().notifyContextDisposed(isMainFrame); - } + bool isMainFrame = m_frame->page() && (m_frame->page()->mainFrame() == m_frame); + V8GCForContextDispose::instance().notifyContextDisposed(isMainFrame); } void V8DOMWindowShell::destroyGlobal() @@ -222,6 +214,8 @@ bool V8DOMWindowShell::initializeIfNeeded() v8::Local<v8::Context> context = v8::Local<v8::Context>::New(m_context.get()); v8::Context::Scope contextScope(context); + m_world->setIsolatedWorldField(m_context.get()); + if (m_global.isEmpty()) { m_global.set(context->Global()); if (m_global.isEmpty()) { @@ -230,13 +224,10 @@ bool V8DOMWindowShell::initializeIfNeeded() } } - if (isMainWorld) - context->SetAlignedPointerInEmbedderData(v8ContextIsolatedWindowShell, 0); - else { + if (!isMainWorld) { V8DOMWindowShell* mainWindow = m_frame->script()->existingWindowShell(mainThreadNormalWorld()); if (mainWindow && !mainWindow->context().IsEmpty()) setInjectedScriptContextDebugId(m_context.get(), m_frame->script()->contextDebugId(mainWindow->context())); - context->SetAlignedPointerInEmbedderData(v8ContextIsolatedWindowShell, this); } m_perContextData = V8PerContextData::create(m_context.get()); @@ -328,7 +319,6 @@ bool V8DOMWindowShell::installDOMWindow() V8DOMWindow::installPerContextProperties(windowWrapper, window); V8DOMWrapper::setDOMWrapper(v8::Handle<v8::Object>::Cast(windowWrapper->GetPrototype()), &V8DOMWindow::info, window); - V8DOMWrapper::createDOMWrapper(PassRefPtr<DOMWindow>(window), &V8DOMWindow::info, windowWrapper); // Install the windowWrapper as the prototype of the innerGlobalObject. // The full structure of the global object is as follows: @@ -346,6 +336,7 @@ bool V8DOMWindowShell::installDOMWindow() v8::Handle<v8::Object> innerGlobalObject = toInnerGlobalObject(m_context.get()); V8DOMWrapper::setDOMWrapper(innerGlobalObject, &V8DOMWindow::info, window); innerGlobalObject->SetPrototype(windowWrapper); + V8DOMWrapper::createDOMWrapper(PassRefPtr<DOMWindow>(window), &V8DOMWindow::info, windowWrapper); return true; } diff --git a/Source/WebCore/bindings/v8/V8DOMWindowShell.h b/Source/WebCore/bindings/v8/V8DOMWindowShell.h index fbe252d37..5dec886f3 100644 --- a/Source/WebCore/bindings/v8/V8DOMWindowShell.h +++ b/Source/WebCore/bindings/v8/V8DOMWindowShell.h @@ -70,8 +70,6 @@ public: bool isContextInitialized() { return !m_context.isEmpty(); } bool isGlobalInitialized() { return !m_global.isEmpty(); } - v8::Persistent<v8::Context> createNewContext(v8::Handle<v8::Object> global, int extensionGroup, int worldId); - bool initializeIfNeeded(); void updateDocumentWrapper(v8::Handle<v8::Object> wrapper); @@ -80,12 +78,6 @@ public: void destroyGlobal(); - static V8DOMWindowShell* isolated(v8::Handle<v8::Context> context) - { - return static_cast<V8DOMWindowShell*>(context->GetAlignedPointerFromEmbedderData(v8ContextIsolatedWindowShell)); - } - - V8PerContextData* perContextData() { return m_perContextData.get(); } DOMWrapperWorld* world() { return m_world.get(); } void destroyIsolatedShell(); @@ -93,7 +85,7 @@ public: private: V8DOMWindowShell(Frame*, PassRefPtr<DOMWrapperWorld>); - void disposeContext(bool weak = false); + void disposeContext(); void setSecurityToken(); diff --git a/Source/WebCore/bindings/v8/V8GCController.cpp b/Source/WebCore/bindings/v8/V8GCController.cpp index 4cc03fbdc..99ce359f0 100644 --- a/Source/WebCore/bindings/v8/V8GCController.cpp +++ b/Source/WebCore/bindings/v8/V8GCController.cpp @@ -236,7 +236,7 @@ static void gcTree(Node* startNode) do { ASSERT(node); if (!node->wrapper().IsEmpty()) { - if (!node->inEden()) { + if (!node->isV8CollectableDuringMinorGC()) { // The fact that we encounter a node that is not in the Eden space // implies that its wrapper might be in the old space of V8. // This indicates that the minor GC cannot anyway judge reachability @@ -244,7 +244,7 @@ static void gcTree(Node* startNode) return; } // A once traversed node is removed from the Eden space. - node->setEden(false); + node->setV8CollectableDuringMinorGC(false); newSpaceWrappers.append(node->wrapper()); } if (node->firstChild()) { @@ -285,7 +285,7 @@ void V8GCController::didCreateWrapperForNode(Node* node) if (m_edenNodes->size() <= wrappersHandledByEachMinorGC) { // A node of a newly created wrapper is put into the Eden space. m_edenNodes->append(node); - node->setEden(true); + node->setV8CollectableDuringMinorGC(true); } } @@ -307,7 +307,7 @@ void V8GCController::minorGCPrologue() if (isMainThreadOrGCThread() && m_edenNodes) { for (size_t i = 0; i < m_edenNodes->size(); i++) { ASSERT(!m_edenNodes->at(i)->wrapper().IsEmpty()); - if (m_edenNodes->at(i)->inEden()) // This branch is just for performance. + if (m_edenNodes->at(i)->isV8CollectableDuringMinorGC()) // This branch is just for performance. gcTree(m_edenNodes->at(i)); } } diff --git a/Source/WebCore/bindings/v8/V8PerContextData.h b/Source/WebCore/bindings/v8/V8PerContextData.h index a33cecee3..8faeb626e 100644 --- a/Source/WebCore/bindings/v8/V8PerContextData.h +++ b/Source/WebCore/bindings/v8/V8PerContextData.h @@ -47,7 +47,7 @@ typedef WTF::HashMap<int, V8NPObjectVector> V8NPObjectMap; enum V8ContextEmbedderDataField { v8ContextDebugIdIndex, v8ContextPerContextDataIndex, - v8ContextIsolatedWindowShell, + v8ContextIsolatedWorld, // Rather than adding more embedder data fields to v8::Context, // consider adding the data to V8PerContextData instead. }; diff --git a/Source/WebCore/bindings/v8/V8StringResource.h b/Source/WebCore/bindings/v8/V8StringResource.h index 8a2b8f6da..a863ac349 100644 --- a/Source/WebCore/bindings/v8/V8StringResource.h +++ b/Source/WebCore/bindings/v8/V8StringResource.h @@ -27,6 +27,7 @@ #define V8StringResource_h #include <v8.h> +#include <wtf/Threading.h> #include <wtf/text/AtomicString.h> #include <wtf/text/WTFString.h> diff --git a/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp b/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp index 97cef8957..3f1a45111 100644 --- a/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp +++ b/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp @@ -104,6 +104,9 @@ void WorkerContextExecutionProxy::dispose() void WorkerContextExecutionProxy::initIsolate() { + // Setup the security handlers and message listener. + v8::V8::AddMessageListener(&v8MessageHandler); + // Tell V8 not to call the default OOM handler, binding code will handle it. v8::V8::IgnoreOutOfMemoryException(); v8::V8::SetFatalErrorHandler(reportFatalErrorInV8); @@ -129,12 +132,6 @@ bool WorkerContextExecutionProxy::initializeIfNeeded() if (!m_context.isEmpty()) return true; - // Setup the security handlers and message listener. This only has - // to be done once. - static bool isV8Initialized = false; - if (!isV8Initialized) - v8::V8::AddMessageListener(&v8MessageHandler); - // Create a new environment v8::Persistent<v8::ObjectTemplate> globalTemplate; m_context.adopt(v8::Context::New(0, globalTemplate)); diff --git a/Source/WebCore/bindings/v8/WorldContextHandle.cpp b/Source/WebCore/bindings/v8/WorldContextHandle.cpp index e2f687b85..c175b5aa5 100644 --- a/Source/WebCore/bindings/v8/WorldContextHandle.cpp +++ b/Source/WebCore/bindings/v8/WorldContextHandle.cpp @@ -34,28 +34,38 @@ #include "ScriptController.h" #include "V8Binding.h" #include "V8DOMWindow.h" -#include "V8DOMWindowShell.h" +#include "V8DedicatedWorkerContext.h" +#include "V8SharedWorkerContext.h" namespace WebCore { WorldContextHandle::WorldContextHandle(WorldToUse worldToUse) : m_worldToUse(worldToUse) { + ASSERT(worldToUse != UseWorkerWorld); + if (worldToUse == UseMainWorld || worldToUse == UseWorkerWorld) return; - if (v8::Context::InContext()) { - v8::Handle<v8::Context> context = v8::Context::GetCurrent(); + if (!v8::Context::InContext()) + CRASH(); + + v8::Handle<v8::Context> context = v8::Context::GetCurrent(); #if ENABLE(WORKERS) - if (UNLIKELY(!V8DOMWrapper::isWrapperOfType(toInnerGlobalObject(context), &V8DOMWindow::info))) { - m_worldToUse = UseWorkerWorld; - return; - } + if (UNLIKELY(!V8DOMWrapper::isWrapperOfType(toInnerGlobalObject(context), &V8DOMWindow::info))) { +#if ENABLE(SHARED_WORKERS) + ASSERT(V8DOMWrapper::isWrapperOfType(toInnerGlobalObject(context)->GetPrototype(), &V8DedicatedWorkerContext::info) || V8DOMWrapper::isWrapperOfType(toInnerGlobalObject(context)->GetPrototype(), &V8SharedWorkerContext::info)); +#else + ASSERT(V8DOMWrapper::isWrapperOfType(toInnerGlobalObject(context)->GetPrototype(), &V8DedicatedWorkerContext::info)); #endif - if (V8DOMWindowShell::isolated(context)) { - m_context = SharedPersistent<v8::Context>::create(context); - return; - } + m_worldToUse = UseWorkerWorld; + return; + } +#endif + + if (DOMWrapperWorld::isolated(context)) { + m_context = SharedPersistent<v8::Context>::create(context); + return; } m_worldToUse = UseMainWorld; diff --git a/Source/WebCore/bindings/v8/custom/V8CSSRuleCustom.cpp b/Source/WebCore/bindings/v8/custom/V8CSSRuleCustom.cpp index 172649db3..d151cd8b0 100644 --- a/Source/WebCore/bindings/v8/custom/V8CSSRuleCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8CSSRuleCustom.cpp @@ -41,6 +41,10 @@ #include "V8WebKitCSSKeyframesRule.h" #include "V8WebKitCSSRegionRule.h" +#if ENABLE(CSS_DEVICE_ADAPTATION) +#include "V8WebKitCSSViewportRule.h" +#endif + namespace WebCore { v8::Handle<v8::Object> wrap(CSSRule* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) @@ -68,6 +72,10 @@ v8::Handle<v8::Object> wrap(CSSRule* impl, v8::Handle<v8::Object> creationContex return wrap(static_cast<WebKitCSSKeyframeRule*>(impl), creationContext, isolate); case CSSRule::WEBKIT_KEYFRAMES_RULE: return wrap(static_cast<WebKitCSSKeyframesRule*>(impl), creationContext, isolate); +#if ENABLE(CSS_DEVICE_ADAPTATION) + case CSSRule::WEBKIT_VIEWPORT_RULE: + return wrap(static_cast<WebKitCSSViewportRule*>(impl), creationContext, isolate); +#endif case CSSRule::WEBKIT_REGION_RULE: return wrap(static_cast<WebKitCSSRegionRule*>(impl), creationContext, isolate); } diff --git a/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp b/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp index de25a640c..79a6c0c67 100644 --- a/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp @@ -431,9 +431,9 @@ v8::Handle<v8::Value> V8DOMWindow::showModalDialogCallback(const v8::Arguments& return v8::Undefined(); // FIXME: Handle exceptions properly. - String urlString = toWebCoreStringWithNullOrUndefinedCheck(args[0]); + String urlString = toWebCoreStringWithUndefinedOrNullCheck(args[0]); DialogHandler handler(args[1]); - String dialogFeaturesString = toWebCoreStringWithNullOrUndefinedCheck(args[2]); + String dialogFeaturesString = toWebCoreStringWithUndefinedOrNullCheck(args[2]); impl->showModalDialog(urlString, dialogFeaturesString, activeDOMWindow(state), firstDOMWindow(state), setUpDialog, &handler); @@ -449,9 +449,9 @@ v8::Handle<v8::Value> V8DOMWindow::openCallback(const v8::Arguments& args) return v8::Undefined(); // FIXME: Handle exceptions properly. - String urlString = toWebCoreStringWithNullOrUndefinedCheck(args[0]); + String urlString = toWebCoreStringWithUndefinedOrNullCheck(args[0]); AtomicString frameName = (args[1]->IsUndefined() || args[1]->IsNull()) ? "_blank" : AtomicString(toWebCoreString(args[1])); - String windowFeaturesString = toWebCoreStringWithNullOrUndefinedCheck(args[2]); + String windowFeaturesString = toWebCoreStringWithUndefinedOrNullCheck(args[2]); RefPtr<DOMWindow> openedWindow = impl->open(urlString, frameName, windowFeaturesString, activeDOMWindow(state), firstDOMWindow(state)); if (!openedWindow) diff --git a/Source/WebCore/bindings/v8/custom/V8JavaScriptCallFrameCustom.cpp b/Source/WebCore/bindings/v8/custom/V8JavaScriptCallFrameCustom.cpp index c17770d4c..eccc2ace9 100644 --- a/Source/WebCore/bindings/v8/custom/V8JavaScriptCallFrameCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8JavaScriptCallFrameCustom.cpp @@ -41,7 +41,7 @@ v8::Handle<v8::Value> V8JavaScriptCallFrame::evaluateCallback(const v8::Argument { INC_STATS("V8JavaScriptCallFrame.evaluateCallback()"); JavaScriptCallFrame* impl = V8JavaScriptCallFrame::toNative(args.Holder()); - String expression = toWebCoreStringWithNullOrUndefinedCheck(args[0]); + String expression = toWebCoreStringWithUndefinedOrNullCheck(args[0]); return impl->evaluate(expression); } diff --git a/Source/WebCore/css/CSSRule.idl b/Source/WebCore/css/CSSRule.idl index 585adab19..af118fe72 100644 --- a/Source/WebCore/css/CSSRule.idl +++ b/Source/WebCore/css/CSSRule.idl @@ -37,6 +37,9 @@ const unsigned short PAGE_RULE = 6; const unsigned short WEBKIT_KEYFRAMES_RULE = 7; const unsigned short WEBKIT_KEYFRAME_RULE = 8; +#if defined(ENABLE_CSS_DEVICE_ADAPTATION) && ENABLE_CSS_DEVICE_ADAPTATION + const unsigned short WEBKIT_VIEWPORT_RULE = 15; +#endif #if defined(ENABLE_CSS_REGIONS) && ENABLE_CSS_REGIONS const unsigned short WEBKIT_REGION_RULE = 16; #endif diff --git a/Source/WebCore/css/StylePropertyShorthand.cpp b/Source/WebCore/css/StylePropertyShorthand.cpp index 74a802967..38a91e3ba 100644 --- a/Source/WebCore/css/StylePropertyShorthand.cpp +++ b/Source/WebCore/css/StylePropertyShorthand.cpp @@ -375,8 +375,8 @@ const StylePropertyShorthand& webkitMaskShorthand() CSSPropertyWebkitMaskAttachment, CSSPropertyWebkitMaskPositionX, CSSPropertyWebkitMaskPositionY, - CSSPropertyWebkitMaskClip, - CSSPropertyWebkitMaskOrigin + CSSPropertyWebkitMaskOrigin, + CSSPropertyWebkitMaskClip }; DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitMaskLonghands, (maskProperties, WTF_ARRAY_LENGTH(maskProperties))); return webkitMaskLonghands; diff --git a/Source/WebCore/css/StyleResolver.cpp b/Source/WebCore/css/StyleResolver.cpp index 58ef9917f..30dbc56b6 100644 --- a/Source/WebCore/css/StyleResolver.cpp +++ b/Source/WebCore/css/StyleResolver.cpp @@ -1115,32 +1115,6 @@ bool StyleResolver::canShareStyleWithControl(StyledElement* element) const return true; } -// This function makes some assumptions that only make sense for attribute styles (we only compare CSSProperty::id() and CSSProperty::value().) -static inline bool attributeStylesEqual(const StylePropertySet* a, const StylePropertySet* b) -{ - if (a == b) - return true; - if (a->propertyCount() != b->propertyCount()) - return false; - unsigned propertyCount = a->propertyCount(); - for (unsigned i = 0; i < propertyCount; ++i) { - StylePropertySet::PropertyReference aProperty = a->propertyAt(i); - unsigned j; - for (j = 0; j < propertyCount; ++j) { - StylePropertySet::PropertyReference bProperty = b->propertyAt(j); - if (aProperty.id() != bProperty.id()) - continue; - // We could get a few more hits by comparing cssText() here, but that gets expensive quickly. - if (aProperty.value() != bProperty.value()) - return false; - break; - } - if (j == propertyCount) - return false; - } - return true; -} - static inline bool elementHasDirectionAuto(Element* element) { // FIXME: This line is surprisingly hot, we may wish to inline hasDirectionAuto into StyleResolver. @@ -1167,7 +1141,7 @@ static inline bool haveIdenticalStyleAffectingAttributes(StyledElement* a, Style return false; } - if (a->presentationAttributeStyle() && !attributeStylesEqual(a->presentationAttributeStyle(), b->presentationAttributeStyle())) + if (a->presentationAttributeStyle() != b->presentationAttributeStyle()) return false; #if ENABLE(PROGRESS_ELEMENT) @@ -1200,12 +1174,6 @@ bool StyleResolver::canShareStyleWithElement(StyledElement* element) const if (element->isSVGElement() && static_cast<SVGElement*>(element)->animatedSMILStyleProperties()) return false; #endif - if (!!element->presentationAttributeStyle() != !!m_styledElement->presentationAttributeStyle()) - return false; - const StylePropertySet* additionalPresentationAttributeStyleA = element->additionalPresentationAttributeStyle(); - const StylePropertySet* additionalPresentationAttributeStyleB = m_styledElement->additionalPresentationAttributeStyle(); - if (!additionalPresentationAttributeStyleA != !additionalPresentationAttributeStyleB) - return false; if (element->isLink() != m_element->isLink()) return false; if (style->affectedByUncommonAttributeSelectors()) @@ -1220,9 +1188,10 @@ bool StyleResolver::canShareStyleWithElement(StyledElement* element) const return false; if (element == element->document()->cssTarget()) return false; - if (!haveIdenticalStyleAffectingAttributes(element, m_styledElement)) return false; + if (element->additionalPresentationAttributeStyle() != m_styledElement->additionalPresentationAttributeStyle()) + return false; if (element->hasID() && m_features.idsInRules.contains(element->idForStyleResolution().impl())) return false; @@ -1261,9 +1230,6 @@ bool StyleResolver::canShareStyleWithElement(StyledElement* element) const if (elementHasDirectionAuto(element)) return false; - if (additionalPresentationAttributeStyleA && !attributeStylesEqual(additionalPresentationAttributeStyleA, additionalPresentationAttributeStyleB)) - return false; - if (element->isLink() && m_elementLinkState != style->insideLink()) return false; diff --git a/Source/WebCore/css/WebKitCSSViewportRule.idl b/Source/WebCore/css/WebKitCSSViewportRule.idl new file mode 100644 index 000000000..a19492290 --- /dev/null +++ b/Source/WebCore/css/WebKitCSSViewportRule.idl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * 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 THE COPYRIGHT HOLDER “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 THE COPYRIGHT HOLDER 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. + */ + +[ + Conditional=CSS_DEVICE_ADAPTATION, +] interface WebKitCSSViewportRule : CSSRule { + readonly attribute CSSStyleDeclaration style; +}; diff --git a/Source/WebCore/dom/CDATASection.cpp b/Source/WebCore/dom/CDATASection.cpp index 33a3acc58..611510b07 100644 --- a/Source/WebCore/dom/CDATASection.cpp +++ b/Source/WebCore/dom/CDATASection.cpp @@ -27,7 +27,7 @@ namespace WebCore { inline CDATASection::CDATASection(Document* document, const String& data) - : Text(document, data) + : Text(document, data, CreateText) { } diff --git a/Source/WebCore/dom/CharacterData.h b/Source/WebCore/dom/CharacterData.h index c1430f400..d8d7b2da9 100644 --- a/Source/WebCore/dom/CharacterData.h +++ b/Source/WebCore/dom/CharacterData.h @@ -54,7 +54,7 @@ protected: : Node(document, type) , m_data(!text.isNull() ? text : emptyString()) { - ASSERT(type == CreateOther || type == CreateText); + ASSERT(type == CreateOther || type == CreateText || type == CreateEditingText); } virtual bool rendererIsNeeded(const NodeRenderingContext&); diff --git a/Source/WebCore/dom/DOMAllInOne.cpp b/Source/WebCore/dom/DOMAllInOne.cpp index 23b3cecbf..997db9fb1 100644 --- a/Source/WebCore/dom/DOMAllInOne.cpp +++ b/Source/WebCore/dom/DOMAllInOne.cpp @@ -68,7 +68,6 @@ #include "DocumentParser.cpp" #include "DocumentType.cpp" #include "DynamicNodeList.cpp" -#include "EditingText.cpp" #include "Element.cpp" #include "ElementAttributeData.cpp" #include "ElementShadow.cpp" diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp index 383939850..3ecbdbb56 100644 --- a/Source/WebCore/dom/Document.cpp +++ b/Source/WebCore/dom/Document.cpp @@ -57,7 +57,6 @@ #include "DocumentMarkerController.h" #include "DocumentStyleSheetCollection.h" #include "DocumentType.h" -#include "EditingText.h" #include "Editor.h" #include "Element.h" #include "ElementShadow.h" @@ -918,9 +917,9 @@ PassRefPtr<EntityReference> Document::createEntityReference(const String& name, return EntityReference::create(this, name); } -PassRefPtr<EditingText> Document::createEditingTextNode(const String& text) +PassRefPtr<Text> Document::createEditingTextNode(const String& text) { - return EditingText::create(this, text); + return Text::createEditingText(this, text); } PassRefPtr<CSSStyleDeclaration> Document::createCSSStyleDeclaration() @@ -5909,6 +5908,7 @@ void Document::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const #if ENABLE(LINK_PRERENDER) info.addMember(m_prerenderer); #endif + info.addMember(m_listsInvalidatedAtDocument); } class ImmutableAttributeDataCacheKey { diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h index 343b0db57..da29598e0 100644 --- a/Source/WebCore/dom/Document.h +++ b/Source/WebCore/dom/Document.h @@ -81,7 +81,6 @@ class DocumentStyleSheetCollection; class DocumentType; class DocumentWeakReference; class DynamicNodeListCacheBase; -class EditingText; class Element; class ElementAttributeData; class EntityReference; @@ -525,7 +524,7 @@ public: // Special support for editing PassRefPtr<CSSStyleDeclaration> createCSSStyleDeclaration(); - PassRefPtr<EditingText> createEditingTextNode(const String&); + PassRefPtr<Text> createEditingTextNode(const String&); void recalcStyle(StyleChange = NoChange); bool childNeedsAndNotInStyleRecalc(); diff --git a/Source/WebCore/dom/DynamicNodeList.cpp b/Source/WebCore/dom/DynamicNodeList.cpp index bfdf1bfff..6bdc71da7 100644 --- a/Source/WebCore/dom/DynamicNodeList.cpp +++ b/Source/WebCore/dom/DynamicNodeList.cpp @@ -28,6 +28,7 @@ #include "HTMLCollection.h" #include "HTMLPropertiesCollection.h" #include "PropertyNodeList.h" +#include "WebCoreMemoryInstrumentation.h" namespace WebCore { @@ -36,7 +37,8 @@ Node* DynamicNodeListCacheBase::rootNode() const if (isRootedAtDocument() && m_ownerNode->inDocument()) return m_ownerNode->document(); - if (ownerNodeHasItemRefAttribute()) { +#if ENABLE(MICRODATA) + if (m_rootType == NodeListIsRootedAtDocumentIfOwnerHasItemrefAttr && toElement(ownerNode())->fastHasAttribute(HTMLNames::itemrefAttr)) { if (m_ownerNode->inDocument()) return m_ownerNode->document(); @@ -45,6 +47,7 @@ Node* DynamicNodeListCacheBase::rootNode() const root = parent; return root; } +#endif return m_ownerNode.get(); } @@ -59,7 +62,7 @@ void DynamicNodeListCacheBase::invalidateCache() const if (isNodeList(type())) return; - const HTMLCollectionCacheBase* cacheBase = static_cast<const HTMLCollectionCacheBase*>(this); + const HTMLCollection* cacheBase = static_cast<const HTMLCollection*>(this); cacheBase->m_idCache.clear(); cacheBase->m_nameCache.clear(); cacheBase->m_cachedElementsArrayOffset = 0; @@ -74,11 +77,31 @@ void DynamicNodeListCacheBase::invalidateCache() const void DynamicNodeListCacheBase::invalidateIdNameCacheMaps() const { ASSERT(hasIdNameCache()); - const HTMLCollectionCacheBase* cacheBase = static_cast<const HTMLCollectionCacheBase*>(this); + const HTMLCollection* cacheBase = static_cast<const HTMLCollection*>(this); cacheBase->m_idCache.clear(); cacheBase->m_nameCache.clear(); } +void DynamicNodeListCacheBase::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const +{ + MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); + info.addMember(m_ownerNode); + info.addWeakPointer(m_cachedItem); +} + +void DynamicNodeList::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const +{ + MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); + NodeList::reportMemoryUsage(memoryObjectInfo); + DynamicNodeListCacheBase::reportMemoryUsage(memoryObjectInfo); +} + +void DynamicSubtreeNodeList::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const +{ + MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); + DynamicNodeList::reportMemoryUsage(memoryObjectInfo); +} + unsigned DynamicNodeList::length() const { return lengthCommon(); diff --git a/Source/WebCore/dom/DynamicNodeList.h b/Source/WebCore/dom/DynamicNodeList.h index 3fbf601b4..50aa64198 100644 --- a/Source/WebCore/dom/DynamicNodeList.h +++ b/Source/WebCore/dom/DynamicNodeList.h @@ -26,7 +26,6 @@ #include "CollectionType.h" #include "Document.h" -#include "Element.h" #include "HTMLNames.h" #include "NodeList.h" #include <wtf/Forward.h> @@ -34,6 +33,8 @@ namespace WebCore { +class Element; + enum NodeListRootType { NodeListIsRootedAtNode, NodeListIsRootedAtDocument, @@ -67,6 +68,10 @@ public: ASSERT(!m_overridesItemAfter || !isNodeList(collectionType)); } + virtual ~DynamicNodeListCacheBase() { } + + virtual void reportMemoryUsage(MemoryObjectInfo*) const; + public: ALWAYS_INLINE bool hasIdNameCache() const { return !isNodeList(type()); } ALWAYS_INLINE bool isRootedAtDocument() const { return m_rootType == NodeListIsRootedAtDocument || m_rootType == NodeListIsRootedAtDocumentIfOwnerHasItemrefAttr; } @@ -93,7 +98,6 @@ protected: ALWAYS_INLINE bool isItemCacheValid() const { return m_isItemCacheValid; } ALWAYS_INLINE Node* cachedItem() const { return m_cachedItem; } ALWAYS_INLINE unsigned cachedItemOffset() const { return m_cachedItemOffset; } - unsigned cachedElementsArrayOffset() const; ALWAYS_INLINE bool isLengthCacheValid() const { return m_isLengthCacheValid; } ALWAYS_INLINE unsigned cachedLength() const { return m_cachedLength; } @@ -131,7 +135,6 @@ private: template <bool forward> Node* iterateForNextNode(Node* current) const; template<bool forward> Node* itemBeforeOrAfter(Node* previousItem) const; Node* itemBefore(Node* previousItem) const; - bool ownerNodeHasItemRefAttribute() const; RefPtr<Node> m_ownerNode; mutable Node* m_cachedItem; @@ -179,16 +182,6 @@ ALWAYS_INLINE bool DynamicNodeListCacheBase::shouldInvalidateTypeOnAttributeChan return false; } -ALWAYS_INLINE bool DynamicNodeListCacheBase::ownerNodeHasItemRefAttribute() const -{ -#if ENABLE(MICRODATA) - if (m_rootType == NodeListIsRootedAtDocumentIfOwnerHasItemrefAttr) - return toElement(ownerNode())->fastHasAttribute(HTMLNames::itemrefAttr); -#endif - - return false; -} - class DynamicNodeList : public NodeList, public DynamicNodeListCacheBase { public: DynamicNodeList(PassRefPtr<Node> ownerNode, CollectionType collectionType, NodeListRootType rootType, NodeListInvalidationType invalidationType) @@ -205,6 +198,8 @@ public: // Other methods (not part of DOM) virtual bool nodeMatches(Element*) const = 0; + virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE; + private: virtual bool isDynamicNodeList() const OVERRIDE { return true; } }; @@ -216,6 +211,8 @@ public: document()->unregisterNodeListCache(this); } + virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE; + protected: DynamicSubtreeNodeList(PassRefPtr<Node> node, CollectionType type, NodeListInvalidationType invalidationType, NodeListRootType rootType = NodeListIsRootedAtNode) : DynamicNodeList(node, type, rootType, invalidationType) diff --git a/Source/WebCore/dom/MessageEvent.cpp b/Source/WebCore/dom/MessageEvent.cpp index 24b52dd12..1282a2519 100644 --- a/Source/WebCore/dom/MessageEvent.cpp +++ b/Source/WebCore/dom/MessageEvent.cpp @@ -79,29 +79,29 @@ MessageEvent::MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& #endif } -MessageEvent::MessageEvent(const String& data) +MessageEvent::MessageEvent(const String& data, const String& origin) : Event(eventNames().messageEvent, false, false) , m_dataType(DataTypeString) , m_dataAsString(data) - , m_origin("") + , m_origin(origin) , m_lastEventId("") { } -MessageEvent::MessageEvent(PassRefPtr<Blob> data) +MessageEvent::MessageEvent(PassRefPtr<Blob> data, const String& origin) : Event(eventNames().messageEvent, false, false) , m_dataType(DataTypeBlob) , m_dataAsBlob(data) - , m_origin("") + , m_origin(origin) , m_lastEventId("") { } -MessageEvent::MessageEvent(PassRefPtr<ArrayBuffer> data) +MessageEvent::MessageEvent(PassRefPtr<ArrayBuffer> data, const String& origin) : Event(eventNames().messageEvent, false, false) , m_dataType(DataTypeArrayBuffer) , m_dataAsArrayBuffer(data) - , m_origin("") + , m_origin(origin) , m_lastEventId("") { } diff --git a/Source/WebCore/dom/MessageEvent.h b/Source/WebCore/dom/MessageEvent.h index 8a9d82cea..0afc3f3c2 100644 --- a/Source/WebCore/dom/MessageEvent.h +++ b/Source/WebCore/dom/MessageEvent.h @@ -64,17 +64,17 @@ public: { return adoptRef(new MessageEvent(data, origin, lastEventId, source, ports)); } - static PassRefPtr<MessageEvent> create(const String& data) + static PassRefPtr<MessageEvent> create(const String& data, const String& origin = "") { - return adoptRef(new MessageEvent(data)); + return adoptRef(new MessageEvent(data, origin)); } - static PassRefPtr<MessageEvent> create(PassRefPtr<Blob> data) + static PassRefPtr<MessageEvent> create(PassRefPtr<Blob> data, const String& origin = "") { - return adoptRef(new MessageEvent(data)); + return adoptRef(new MessageEvent(data, origin)); } - static PassRefPtr<MessageEvent> create(PassRefPtr<ArrayBuffer> data) + static PassRefPtr<MessageEvent> create(PassRefPtr<ArrayBuffer> data, const String& origin = "") { - return adoptRef(new MessageEvent(data)); + return adoptRef(new MessageEvent(data, origin)); } static PassRefPtr<MessageEvent> create(const AtomicString& type, const MessageEventInit& initializer) { @@ -119,9 +119,9 @@ private: MessageEvent(const ScriptValue& data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source, PassOwnPtr<MessagePortArray>); MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source, PassOwnPtr<MessagePortArray>); - explicit MessageEvent(const String& data); - explicit MessageEvent(PassRefPtr<Blob> data); - explicit MessageEvent(PassRefPtr<ArrayBuffer> data); + explicit MessageEvent(const String& data, const String& origin); + explicit MessageEvent(PassRefPtr<Blob> data, const String& origin); + explicit MessageEvent(PassRefPtr<ArrayBuffer> data, const String& origin); DataType m_dataType; ScriptValue m_dataAsScriptValue; diff --git a/Source/WebCore/dom/Node.h b/Source/WebCore/dom/Node.h index 2d9cacdb3..f57ca46c6 100644 --- a/Source/WebCore/dom/Node.h +++ b/Source/WebCore/dom/Node.h @@ -317,7 +317,7 @@ public: virtual void notifyLoadedSheetAndAllCriticalSubresources(bool /* error loading subresource */) { } virtual void startLoadingDynamicSheet() { ASSERT_NOT_REACHED(); } - bool hasName() const { return getFlag(HasNameFlag); } + bool hasName() const { return !isTextNode() && getFlag(HasNameOrIsEditingTextFlag); } bool hasID() const; bool hasClass() const; @@ -331,8 +331,9 @@ public: StyleChangeType styleChangeType() const { return static_cast<StyleChangeType>(m_nodeFlags & StyleChangeMask); } bool childNeedsStyleRecalc() const { return getFlag(ChildNeedsStyleRecalcFlag); } bool isLink() const { return getFlag(IsLinkFlag); } + bool isEditingText() const { return isTextNode() && getFlag(HasNameOrIsEditingTextFlag); } - void setHasName(bool f) { setFlag(f, HasNameFlag); } + void setHasName(bool f) { ASSERT(!isTextNode()); setFlag(f, HasNameOrIsEditingTextFlag); } void setChildNeedsStyleRecalc() { setFlag(ChildNeedsStyleRecalcFlag); } void clearChildNeedsStyleRecalc() { clearFlag(ChildNeedsStyleRecalcFlag); } @@ -356,8 +357,8 @@ public: bool hasEventTargetData() const { return getFlag(HasEventTargetDataFlag); } void setHasEventTargetData(bool flag) { setFlag(flag, HasEventTargetDataFlag); } - bool inEden() const { return getFlag(InEdenFlag); } - void setEden(bool flag) { setFlag(flag, InEdenFlag); } + bool isV8CollectableDuringMinorGC() const { return getFlag(V8CollectableDuringMinorGCFlag); } + void setV8CollectableDuringMinorGC(bool flag) { setFlag(flag, V8CollectableDuringMinorGCFlag); } enum ShouldSetAttached { SetAttached, @@ -717,14 +718,14 @@ private: SelfOrAncestorHasDirAutoFlag = 1 << 21, - HasNameFlag = 1 << 22, + HasNameOrIsEditingTextFlag = 1 << 22, InNamedFlowFlag = 1 << 23, HasSyntheticAttrChildNodesFlag = 1 << 24, HasCustomCallbacksFlag = 1 << 25, HasScopedHTMLStyleChildFlag = 1 << 26, HasEventTargetDataFlag = 1 << 27, - InEdenFlag = 1 << 28, + V8CollectableDuringMinorGCFlag = 1 << 28, IsInsertionPointFlag = 1 << 29, #if ENABLE(SVG) @@ -753,7 +754,8 @@ protected: CreateFrameOwnerElement = CreateHTMLElement | HasCustomCallbacksFlag, CreateSVGElement = CreateStyledElement | IsSVGFlag, CreateDocument = CreateContainer | InDocumentFlag, - CreateInsertionPoint = CreateHTMLElement | IsInsertionPointFlag + CreateInsertionPoint = CreateHTMLElement | IsInsertionPointFlag, + CreateEditingText = CreateText | HasNameOrIsEditingTextFlag, }; Node(Document*, ConstructionType); diff --git a/Source/WebCore/dom/Text.cpp b/Source/WebCore/dom/Text.cpp index 3fd0f15ea..9ef159a2d 100644 --- a/Source/WebCore/dom/Text.cpp +++ b/Source/WebCore/dom/Text.cpp @@ -42,7 +42,12 @@ namespace WebCore { PassRefPtr<Text> Text::create(Document* document, const String& data) { - return adoptRef(new Text(document, data)); + return adoptRef(new Text(document, data, CreateText)); +} + +PassRefPtr<Text> Text::createEditingText(Document* document, const String& data) +{ + return adoptRef(new Text(document, data, CreateEditingText)); } PassRefPtr<Text> Text::splitText(unsigned offset, ExceptionCode& ec) @@ -192,6 +197,8 @@ PassRefPtr<Node> Text::cloneNode(bool /*deep*/) bool Text::rendererIsNeeded(const NodeRenderingContext& context) { + if (isEditingText()) + return true; if (!CharacterData::rendererIsNeeded(context)) return false; @@ -231,11 +238,24 @@ bool Text::rendererIsNeeded(const NodeRenderingContext& context) return true; } +#if ENABLE(SVG) +static bool isSVGShadowText(Text* text) +{ + Node* parentNode = text->parentNode(); + return parentNode->isShadowRoot() && toShadowRoot(parentNode)->host()->hasTagName(SVGNames::trefTag); +} + +static bool isSVGText(Text* text) +{ + Node* parentOrHostNode = text->parentOrHostNode(); + return parentOrHostNode->isSVGElement() && !parentOrHostNode->hasTagName(SVGNames::foreignObjectTag); +} +#endif + RenderObject* Text::createRenderer(RenderArena* arena, RenderStyle* style) { #if ENABLE(SVG) - Node* parentOrHost = parentOrHostNode(); - if (parentOrHost->isSVGElement() && !parentOrHost->hasTagName(SVGNames::foreignObjectTag)) + if (isSVGText(this) || isSVGShadowText(this)) return new (arena) RenderSVGInlineText(this, dataImpl()); #endif @@ -253,15 +273,18 @@ void Text::attach() void Text::recalcTextStyle(StyleChange change) { - if (hasCustomCallbacks()) - willRecalcTextStyle(change); - RenderObject* renderer = this->renderer(); // The only time we have a renderer and our parent doesn't is if our parent // is a shadow root. - if (change != NoChange && renderer && !parentNode()->isShadowRoot()) - renderer->setStyle(parentNode()->renderer()->style()); + if (change != NoChange && renderer) { + if (!parentNode()->isShadowRoot()) + renderer->setStyle(parentNode()->renderer()->style()); +#if ENABLE(SVG) + else if (isSVGShadowText(this)) + renderer->setStyle(toShadowRoot(parentNode())->host()->renderer()->style()); +#endif + } if (needsStyleRecalc()) { if (renderer) { @@ -296,11 +319,6 @@ PassRefPtr<Text> Text::createWithLengthLimit(Document* document, const String& d return result; } -void Text::willRecalcTextStyle(StyleChange) -{ - ASSERT_NOT_REACHED(); -} - #ifndef NDEBUG void Text::formatForDebugger(char *buffer, unsigned length) const { diff --git a/Source/WebCore/dom/Text.h b/Source/WebCore/dom/Text.h index daf382240..27dccfc01 100644 --- a/Source/WebCore/dom/Text.h +++ b/Source/WebCore/dom/Text.h @@ -33,6 +33,7 @@ public: static PassRefPtr<Text> create(Document*, const String&); static PassRefPtr<Text> createWithLengthLimit(Document*, const String&, unsigned positionInString, unsigned lengthLimit = defaultLengthLimit); + static PassRefPtr<Text> createEditingText(Document*, const String&); PassRefPtr<Text> splitText(unsigned offset, ExceptionCode&); @@ -48,13 +49,11 @@ public: virtual bool canContainRangeEndPoint() const { return true; } protected: - Text(Document* document, const String& data) - : CharacterData(document, data, CreateText) + Text(Document* document, const String& data, ConstructionType type) + : CharacterData(document, data, type) { } - virtual void willRecalcTextStyle(StyleChange); - private: virtual String nodeName() const; virtual NodeType nodeType() const; diff --git a/Source/WebCore/editing/Editor.cpp b/Source/WebCore/editing/Editor.cpp index aadc273c4..6da965e1f 100644 --- a/Source/WebCore/editing/Editor.cpp +++ b/Source/WebCore/editing/Editor.cpp @@ -43,7 +43,6 @@ #include "DictationCommand.h" #include "DocumentFragment.h" #include "DocumentMarkerController.h" -#include "EditingText.h" #include "EditorClient.h" #include "EventHandler.h" #include "EventNames.h" diff --git a/Source/WebCore/editing/InsertTextCommand.cpp b/Source/WebCore/editing/InsertTextCommand.cpp index ac5b6ef94..2386307a8 100644 --- a/Source/WebCore/editing/InsertTextCommand.cpp +++ b/Source/WebCore/editing/InsertTextCommand.cpp @@ -28,10 +28,10 @@ #include "Document.h" #include "Element.h" -#include "EditingText.h" #include "Editor.h" #include "Frame.h" #include "HTMLInterchange.h" +#include "Text.h" #include "htmlediting.h" #include "visible_units.h" #include <wtf/unicode/CharacterNames.h> diff --git a/Source/WebCore/editing/ReplaceSelectionCommand.cpp b/Source/WebCore/editing/ReplaceSelectionCommand.cpp index 9f161ead8..09a4d3a67 100644 --- a/Source/WebCore/editing/ReplaceSelectionCommand.cpp +++ b/Source/WebCore/editing/ReplaceSelectionCommand.cpp @@ -35,7 +35,6 @@ #include "CSSValueKeywords.h" #include "Document.h" #include "DocumentFragment.h" -#include "EditingText.h" #include "Element.h" #include "EventNames.h" #include "Frame.h" @@ -52,6 +51,7 @@ #include "SimplifyMarkupCommand.h" #include "SmartReplace.h" #include "StylePropertySet.h" +#include "Text.h" #include "TextIterator.h" #include "htmlediting.h" #include "markup.h" diff --git a/Source/WebCore/editing/htmlediting.cpp b/Source/WebCore/editing/htmlediting.cpp index d782d177d..9e532d3b0 100644 --- a/Source/WebCore/editing/htmlediting.cpp +++ b/Source/WebCore/editing/htmlediting.cpp @@ -28,7 +28,6 @@ #include "AXObjectCache.h" #include "Document.h" -#include "EditingText.h" #include "Editor.h" #include "Frame.h" #include "HTMLBRElement.h" diff --git a/Source/WebCore/editing/mac/EditorMac.mm b/Source/WebCore/editing/mac/EditorMac.mm index 673996094..523f7a41b 100644 --- a/Source/WebCore/editing/mac/EditorMac.mm +++ b/Source/WebCore/editing/mac/EditorMac.mm @@ -31,7 +31,6 @@ #import "CachedResourceLoader.h" #import "DocumentFragment.h" #import "DOMRangeInternal.h" -#import "EditingText.h" #import "Editor.h" #import "EditorClient.h" #import "Font.h" @@ -47,6 +46,7 @@ #import "RenderBlock.h" #import "RuntimeApplicationChecks.h" #import "Sound.h" +#import "Text.h" #import "TypingCommand.h" #import "htmlediting.h" #import "WebNSAttributedStringExtras.h" diff --git a/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.cpp b/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.cpp index addc8063a..4bd7cde2c 100644 --- a/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.cpp +++ b/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.cpp @@ -325,7 +325,7 @@ FormControlState BaseMultipleFieldsDateAndTimeInputType::saveFormControlState() void BaseMultipleFieldsDateAndTimeInputType::setValue(const String& sanitizedValue, bool valueChanged, TextFieldEventBehavior eventBehavior) { InputType::setValue(sanitizedValue, valueChanged, eventBehavior); - if (valueChanged || (sanitizedValue.isEmpty() && m_dateTimeEditElement && m_dateTimeEditElement->valueAsDateTimeFieldsState().hasAnyValue())) + if (valueChanged || (sanitizedValue.isEmpty() && m_dateTimeEditElement && m_dateTimeEditElement->anyEditableFieldsHaveValues())) updateInnerTextValue(); } diff --git a/Source/WebCore/html/DateTimeFieldsState.h b/Source/WebCore/html/DateTimeFieldsState.h index a05ae59b5..2dd219546 100644 --- a/Source/WebCore/html/DateTimeFieldsState.h +++ b/Source/WebCore/html/DateTimeFieldsState.h @@ -74,7 +74,6 @@ public: bool hasSecond() const { return m_second != emptyValue; } bool hasWeekOfYear() const { return m_weekOfYear != emptyValue; } bool hasYear() const { return m_year != emptyValue; } - bool hasAnyValue() const { return hasAMPM() || hasDayOfMonth() || hasHour() || hasMillisecond() || hasMinute() || hasMonth() || hasSecond() || hasWeekOfYear() || hasYear(); } void setAMPM(AMPMValue ampm) { m_ampm = ampm; } void setDayOfMonth(unsigned dayOfMonth) { m_dayOfMonth = dayOfMonth; } diff --git a/Source/WebCore/html/HTMLCollection.cpp b/Source/WebCore/html/HTMLCollection.cpp index ac9e605e5..da2a4bfca 100644 --- a/Source/WebCore/html/HTMLCollection.cpp +++ b/Source/WebCore/html/HTMLCollection.cpp @@ -176,7 +176,7 @@ static NodeListInvalidationType invalidationTypeExcludingIdAndNameAttributes(Col HTMLCollection::HTMLCollection(Node* ownerNode, CollectionType type, ItemAfterOverrideType itemAfterOverrideType) - : HTMLCollectionCacheBase(ownerNode, rootTypeFromCollectionType(type), invalidationTypeExcludingIdAndNameAttributes(type), + : DynamicNodeListCacheBase(ownerNode, rootTypeFromCollectionType(type), invalidationTypeExcludingIdAndNameAttributes(type), WebCore::shouldOnlyIncludeDirectChildren(type), type, itemAfterOverrideType) { document()->registerNodeListCache(this); @@ -364,16 +364,11 @@ ALWAYS_INLINE void DynamicNodeListCacheBase::setItemCache(Node* item, unsigned o setItemCache(item, offset); if (overridesItemAfter()) { ASSERT(item->isElementNode()); - static_cast<const HTMLCollectionCacheBase*>(this)->m_cachedElementsArrayOffset = elementsArrayOffset; + static_cast<const HTMLCollection*>(this)->m_cachedElementsArrayOffset = elementsArrayOffset; } else ASSERT(!elementsArrayOffset); } -ALWAYS_INLINE unsigned DynamicNodeListCacheBase::cachedElementsArrayOffset() const -{ - return overridesItemAfter() ? static_cast<const HTMLCollectionCacheBase*>(this)->m_cachedElementsArrayOffset : 0; -} - unsigned DynamicNodeListCacheBase::lengthCommon() const { if (isLengthCacheValid()) @@ -441,7 +436,7 @@ Node* DynamicNodeListCacheBase::itemBeforeOrAfterCachedItem(unsigned offset) con return 0; } - unsigned offsetInArray = cachedElementsArrayOffset(); + unsigned offsetInArray = overridesItemAfter() ? static_cast<const HTMLCollection*>(this)->m_cachedElementsArrayOffset : 0; while ((currentItem = itemAfter(offsetInArray, currentItem))) { currentOffset++; if (currentOffset == offset) { @@ -584,7 +579,7 @@ PassRefPtr<NodeList> HTMLCollection::tags(const String& name) return ownerNode()->getElementsByTagName(name); } -void HTMLCollectionCacheBase::append(NodeCacheMap& map, const AtomicString& key, Element* element) +void HTMLCollection::append(NodeCacheMap& map, const AtomicString& key, Element* element) { OwnPtr<Vector<Element*> >& vector = map.add(key.impl(), nullptr).iterator->value; if (!vector) diff --git a/Source/WebCore/html/HTMLCollection.h b/Source/WebCore/html/HTMLCollection.h index 46a8f3f52..98f361fe9 100644 --- a/Source/WebCore/html/HTMLCollection.h +++ b/Source/WebCore/html/HTMLCollection.h @@ -33,39 +33,7 @@ namespace WebCore { -class Document; -class Element; -class Node; -class NodeList; - -class HTMLCollectionCacheBase : public DynamicNodeListCacheBase { -public: - HTMLCollectionCacheBase(Node* ownerNode, NodeListRootType rootType, NodeListInvalidationType invalidationType, - bool shouldOnlyIncludeDirectChildren, CollectionType collectionType, ItemAfterOverrideType itemAfterOverrideType) - : DynamicNodeListCacheBase(ownerNode, rootType, invalidationType, shouldOnlyIncludeDirectChildren, collectionType, itemAfterOverrideType) - { - } - -protected: - typedef HashMap<AtomicStringImpl*, OwnPtr<Vector<Element*> > > NodeCacheMap; - Vector<Element*>* idCache(const AtomicString& name) const { return m_idCache.get(name.impl()); } - Vector<Element*>* nameCache(const AtomicString& name) const { return m_nameCache.get(name.impl()); } - void appendIdCache(const AtomicString& name, Element* element) const { append(m_idCache, name, element); } - void appendNameCache(const AtomicString& name, Element* element) const { append(m_nameCache, name, element); } - - static void append(NodeCacheMap&, const AtomicString&, Element*); - -private: - using DynamicNodeListCacheBase::isRootedAtDocument; - - mutable NodeCacheMap m_idCache; - mutable NodeCacheMap m_nameCache; - mutable unsigned m_cachedElementsArrayOffset; - - friend class DynamicNodeListCacheBase; -}; - -class HTMLCollection : public ScriptWrappable, public RefCounted<HTMLCollection>, public HTMLCollectionCacheBase { +class HTMLCollection : public ScriptWrappable, public RefCounted<HTMLCollection>, public DynamicNodeListCacheBase { public: static PassRefPtr<HTMLCollection> create(Node* base, CollectionType); virtual ~HTMLCollection(); @@ -104,8 +72,22 @@ protected: virtual void updateNameCache() const; + typedef HashMap<AtomicStringImpl*, OwnPtr<Vector<Element*> > > NodeCacheMap; + Vector<Element*>* idCache(const AtomicString& name) const { return m_idCache.get(name.impl()); } + Vector<Element*>* nameCache(const AtomicString& name) const { return m_nameCache.get(name.impl()); } + void appendIdCache(const AtomicString& name, Element* element) const { append(m_idCache, name, element); } + void appendNameCache(const AtomicString& name, Element* element) const { append(m_nameCache, name, element); } + private: bool checkForNameMatch(Element*, bool checkName, const AtomicString& name) const; + + static void append(NodeCacheMap&, const AtomicString&, Element*); + + mutable NodeCacheMap m_idCache; + mutable NodeCacheMap m_nameCache; + mutable unsigned m_cachedElementsArrayOffset; + + friend class DynamicNodeListCacheBase; }; } // namespace diff --git a/Source/WebCore/html/HTMLFrameElementBase.cpp b/Source/WebCore/html/HTMLFrameElementBase.cpp index 7adc9c8fd..2cfb2fb37 100644 --- a/Source/WebCore/html/HTMLFrameElementBase.cpp +++ b/Source/WebCore/html/HTMLFrameElementBase.cpp @@ -66,22 +66,10 @@ bool HTMLFrameElementBase::isURLAllowed() const return false; } - if (Frame* parentFrame = document()->frame()) { - if (parentFrame->page()->subframeCount() >= Page::maxNumberOfFrames) - return false; - } + Frame* parentFrame = document()->frame(); + if (parentFrame) + return parentFrame->isURLAllowed(completeURL); - // We allow one level of self-reference because some sites depend on that. - // But we don't allow more than one. - bool foundSelfReference = false; - for (Frame* frame = document()->frame(); frame; frame = frame->tree()->parent()) { - if (equalIgnoringFragmentIdentifier(frame->document()->url(), completeURL)) { - if (foundSelfReference) - return false; - foundSelfReference = true; - } - } - return true; } diff --git a/Source/WebCore/html/HTMLInputElement.cpp b/Source/WebCore/html/HTMLInputElement.cpp index 6b2833729..5dac84963 100644 --- a/Source/WebCore/html/HTMLInputElement.cpp +++ b/Source/WebCore/html/HTMLInputElement.cpp @@ -555,9 +555,7 @@ void HTMLInputElement::subtreeHasChanged() // HTMLInputElement::handleBeforeTextInsertedEvent() has already called // sanitizeUserInputValue(). // sanitizeValue() is needed because IME input doesn't dispatch BeforeTextInsertedEvent. - String value = innerTextValue(); - if (isAcceptableValue(value)) - setValueFromRenderer(sanitizeValue(convertFromVisibleValue(value))); + setValueFromRenderer(sanitizeValue(convertFromVisibleValue(innerTextValue()))); updatePlaceholderVisibility(false); // Recalc for :invalid and hasUnacceptableValue() change. setNeedsStyleRecalc(); @@ -1411,11 +1409,6 @@ String HTMLInputElement::convertFromVisibleValue(const String& visibleValue) con return m_inputType->convertFromVisibleValue(visibleValue); } -bool HTMLInputElement::isAcceptableValue(const String& proposedValue) const -{ - return m_inputType->isAcceptableValue(proposedValue); -} - String HTMLInputElement::sanitizeValue(const String& proposedValue) const { if (proposedValue.isNull()) diff --git a/Source/WebCore/html/HTMLInputElement.h b/Source/WebCore/html/HTMLInputElement.h index 0471a3b67..422f40b97 100644 --- a/Source/WebCore/html/HTMLInputElement.h +++ b/Source/WebCore/html/HTMLInputElement.h @@ -164,8 +164,6 @@ public: // The value which is drawn by a renderer. String visibleValue() const; String convertFromVisibleValue(const String&) const; - // Returns true if the specified string can be set as the value of HTMLInputElement. - bool isAcceptableValue(const String&) const; const String& suggestedValue() const; void setSuggestedValue(const String&); diff --git a/Source/WebCore/html/HTMLPlugInImageElement.cpp b/Source/WebCore/html/HTMLPlugInImageElement.cpp index f1720b8d5..b809a1340 100644 --- a/Source/WebCore/html/HTMLPlugInImageElement.cpp +++ b/Source/WebCore/html/HTMLPlugInImageElement.cpp @@ -88,28 +88,13 @@ bool HTMLPlugInImageElement::isImageType() // depending on <param> values. bool HTMLPlugInImageElement::allowedToLoadFrameURL(const String& url) { - ASSERT(document()); - ASSERT(document()->frame()); - if (document()->frame()->page()->subframeCount() >= Page::maxNumberOfFrames) - return false; - KURL completeURL = document()->completeURL(url); - + if (contentFrame() && protocolIsJavaScript(completeURL) && !document()->securityOrigin()->canAccess(contentDocument()->securityOrigin())) return false; - - // We allow one level of self-reference because some sites depend on that. - // But we don't allow more than one. - bool foundSelfReference = false; - for (Frame* frame = document()->frame(); frame; frame = frame->tree()->parent()) { - if (equalIgnoringFragmentIdentifier(frame->document()->url(), completeURL)) { - if (foundSelfReference) - return false; - foundSelfReference = true; - } - } - return true; + + return document()->frame()->isURLAllowed(completeURL); } // We don't use m_url, or m_serviceType as they may not be the final values diff --git a/Source/WebCore/html/InputType.cpp b/Source/WebCore/html/InputType.cpp index d669cd61c..ad10269bc 100644 --- a/Source/WebCore/html/InputType.cpp +++ b/Source/WebCore/html/InputType.cpp @@ -689,11 +689,6 @@ String InputType::convertFromVisibleValue(const String& visibleValue) const return visibleValue; } -bool InputType::isAcceptableValue(const String&) -{ - return true; -} - String InputType::sanitizeValue(const String& proposedValue) const { return proposedValue; diff --git a/Source/WebCore/html/InputType.h b/Source/WebCore/html/InputType.h index 7f02245e6..6da537281 100644 --- a/Source/WebCore/html/InputType.h +++ b/Source/WebCore/html/InputType.h @@ -176,7 +176,6 @@ public: virtual String localizeValue(const String&) const; virtual String visibleValue() const; virtual String convertFromVisibleValue(const String&) const; - virtual bool isAcceptableValue(const String&); // Returing the null string means "use the default value." // This function must be called only by HTMLInputElement::sanitizeValue(). virtual String sanitizeValue(const String&) const; diff --git a/Source/WebCore/html/NumberInputType.cpp b/Source/WebCore/html/NumberInputType.cpp index ce833512d..7498cc991 100644 --- a/Source/WebCore/html/NumberInputType.cpp +++ b/Source/WebCore/html/NumberInputType.cpp @@ -253,12 +253,6 @@ String NumberInputType::convertFromVisibleValue(const String& visibleValue) cons return element()->locale().convertFromLocalizedNumber(visibleValue); } -bool NumberInputType::isAcceptableValue(const String& proposedValue) -{ - String standardValue = convertFromVisibleValue(proposedValue); - return standardValue.isEmpty() || isfinite(parseToDoubleForNumberType(standardValue)); -} - String NumberInputType::sanitizeValue(const String& proposedValue) const { if (proposedValue.isEmpty()) @@ -268,7 +262,10 @@ String NumberInputType::sanitizeValue(const String& proposedValue) const bool NumberInputType::hasUnacceptableValue() { - return element()->renderer() && !isAcceptableValue(element()->innerTextValue()); + if (!element()->renderer()) + return false; + String standardValue = convertFromVisibleValue(element()->innerTextValue()); + return !standardValue.isEmpty() && !isfinite(parseToDoubleForNumberType(standardValue)); } bool NumberInputType::shouldRespectSpeechAttribute() diff --git a/Source/WebCore/html/NumberInputType.h b/Source/WebCore/html/NumberInputType.h index 073432780..11cca557b 100644 --- a/Source/WebCore/html/NumberInputType.h +++ b/Source/WebCore/html/NumberInputType.h @@ -57,7 +57,6 @@ private: virtual String localizeValue(const String&) const OVERRIDE; virtual String visibleValue() const OVERRIDE; virtual String convertFromVisibleValue(const String&) const OVERRIDE; - virtual bool isAcceptableValue(const String&) OVERRIDE; virtual String sanitizeValue(const String&) const OVERRIDE; virtual bool hasUnacceptableValue() OVERRIDE; virtual bool shouldRespectSpeechAttribute() OVERRIDE; diff --git a/Source/WebCore/html/parser/HTMLParserIdioms.cpp b/Source/WebCore/html/parser/HTMLParserIdioms.cpp index 97565724a..e5201ce13 100644 --- a/Source/WebCore/html/parser/HTMLParserIdioms.cpp +++ b/Source/WebCore/html/parser/HTMLParserIdioms.cpp @@ -150,14 +150,9 @@ double parseToDoubleForNumberType(const String& string) return parseToDoubleForNumberType(string, std::numeric_limits<double>::quiet_NaN()); } -// http://www.whatwg.org/specs/web-apps/current-work/#rules-for-parsing-integers -bool parseHTMLInteger(const String& input, int& value) +template <typename CharacterType> +static bool parseHTMLIntegerInternal(const CharacterType* position, const CharacterType* end, int& value) { - // Step 1 - // Step 2 - const UChar* position = input.characters(); - const UChar* end = position + input.length(); - // Step 3 int sign = 1; @@ -197,18 +192,31 @@ bool parseHTMLInteger(const String& input, int& value) // Step 9 bool ok; - value = sign * charactersToIntStrict(digits.characters(), digits.length(), &ok); + if (digits.is8Bit()) + value = sign * charactersToIntStrict(digits.characters8(), digits.length(), &ok); + else + value = sign * charactersToIntStrict(digits.characters16(), digits.length(), &ok); return ok; } -// http://www.whatwg.org/specs/web-apps/current-work/#rules-for-parsing-non-negative-integers -bool parseHTMLNonNegativeInteger(const String& input, unsigned int& value) +// http://www.whatwg.org/specs/web-apps/current-work/#rules-for-parsing-integers +bool parseHTMLInteger(const String& input, int& value) { // Step 1 // Step 2 - const UChar* position = input.characters(); - const UChar* end = position + input.length(); + unsigned length = input.length(); + if (length && input.is8Bit()) { + const LChar* start = input.characters8(); + return parseHTMLIntegerInternal(start, start + length, value); + } + + const UChar* start = input.characters(); + return parseHTMLIntegerInternal(start, start + length, value); +} +template <typename CharacterType> +static bool parseHTMLNonNegativeIntegerInternal(const CharacterType* position, const CharacterType* end, unsigned& value) +{ // Step 3 while (position < end) { if (!isHTMLSpace(*position)) @@ -244,8 +252,27 @@ bool parseHTMLNonNegativeInteger(const String& input, unsigned int& value) // Step 9 bool ok; - value = charactersToUIntStrict(digits.characters(), digits.length(), &ok); + if (digits.is8Bit()) + value = charactersToUIntStrict(digits.characters8(), digits.length(), &ok); + else + value = charactersToUIntStrict(digits.characters16(), digits.length(), &ok); return ok; } + +// http://www.whatwg.org/specs/web-apps/current-work/#rules-for-parsing-non-negative-integers +bool parseHTMLNonNegativeInteger(const String& input, unsigned& value) +{ + // Step 1 + // Step 2 + unsigned length = input.length(); + if (length && input.is8Bit()) { + const LChar* start = input.characters8(); + return parseHTMLNonNegativeIntegerInternal(start, start + length, value); + } + + const UChar* start = input.characters(); + return parseHTMLNonNegativeIntegerInternal(start, start + length, value); +} + } diff --git a/Source/WebCore/html/shadow/DateTimeEditElement.cpp b/Source/WebCore/html/shadow/DateTimeEditElement.cpp index e612d2f0b..d36ec1cc6 100644 --- a/Source/WebCore/html/shadow/DateTimeEditElement.cpp +++ b/Source/WebCore/html/shadow/DateTimeEditElement.cpp @@ -317,6 +317,15 @@ void DateTimeEditElement::addField(PassRefPtr<DateTimeFieldElement> field) appendChild(field); } +bool DateTimeEditElement::anyEditableFieldsHaveValues() const +{ + for (size_t fieldIndex = 0; fieldIndex < m_fields.size(); ++fieldIndex) { + if (!m_fields[fieldIndex]->isReadOnly() && m_fields[fieldIndex]->hasValue()) + return true; + } + return false; +} + void DateTimeEditElement::blurByOwner() { if (DateTimeFieldElement* field = focusedField()) diff --git a/Source/WebCore/html/shadow/DateTimeEditElement.h b/Source/WebCore/html/shadow/DateTimeEditElement.h index 94cb0ac80..17952acf5 100644 --- a/Source/WebCore/html/shadow/DateTimeEditElement.h +++ b/Source/WebCore/html/shadow/DateTimeEditElement.h @@ -86,6 +86,7 @@ public: virtual ~DateTimeEditElement(); void addField(PassRefPtr<DateTimeFieldElement>); + bool anyEditableFieldsHaveValues() const; void blurByOwner(); virtual void defaultEventHandler(Event*) OVERRIDE; void disabledStateChanged(); diff --git a/Source/WebCore/inspector/InjectedScriptCanvasModule.cpp b/Source/WebCore/inspector/InjectedScriptCanvasModule.cpp index b1f1dca27..740b7bd85 100644 --- a/Source/WebCore/inspector/InjectedScriptCanvasModule.cpp +++ b/Source/WebCore/inspector/InjectedScriptCanvasModule.cpp @@ -86,28 +86,50 @@ ScriptObject InjectedScriptCanvasModule::callWrapContextFunction(const String& f void InjectedScriptCanvasModule::captureFrame(ErrorString* errorString, String* traceLogId) { - ScriptFunctionCall function(injectedScriptObject(), "captureFrame"); + callStartCapturingFunction("captureFrame", errorString, traceLogId); +} + +void InjectedScriptCanvasModule::startCapturing(ErrorString* errorString, String* traceLogId) +{ + callStartCapturingFunction("startCapturing", errorString, traceLogId); +} + +void InjectedScriptCanvasModule::callStartCapturingFunction(const String& functionName, ErrorString* errorString, String* traceLogId) +{ + ScriptFunctionCall function(injectedScriptObject(), functionName); RefPtr<InspectorValue> resultValue; makeCall(function, &resultValue); if (!resultValue || resultValue->type() != InspectorValue::TypeString || !resultValue->asString(traceLogId)) - *errorString = "Internal error: captureFrame"; + *errorString = "Internal error: " + functionName; +} + +void InjectedScriptCanvasModule::stopCapturing(ErrorString* errorString, const String& traceLogId) +{ + callVoidFunctionWithTraceLogIdArgument("stopCapturing", errorString, traceLogId); } void InjectedScriptCanvasModule::dropTraceLog(ErrorString* errorString, const String& traceLogId) { - ScriptFunctionCall function(injectedScriptObject(), "dropTraceLog"); + callVoidFunctionWithTraceLogIdArgument("dropTraceLog", errorString, traceLogId); +} + +void InjectedScriptCanvasModule::callVoidFunctionWithTraceLogIdArgument(const String& functionName, ErrorString* errorString, const String& traceLogId) +{ + ScriptFunctionCall function(injectedScriptObject(), functionName); function.appendArgument(traceLogId); bool hadException = false; callFunctionWithEvalEnabled(function, hadException); ASSERT(!hadException); if (hadException) - *errorString = "Internal error: dropTraceLog"; + *errorString = "Internal error: " + functionName; } -void InjectedScriptCanvasModule::traceLog(ErrorString* errorString, const String& traceLogId, RefPtr<TypeBuilder::Canvas::TraceLog>* traceLog) +void InjectedScriptCanvasModule::traceLog(ErrorString* errorString, const String& traceLogId, const int* startOffset, RefPtr<TypeBuilder::Canvas::TraceLog>* traceLog) { ScriptFunctionCall function(injectedScriptObject(), "traceLog"); function.appendArgument(traceLogId); + if (startOffset) + function.appendArgument(*startOffset); RefPtr<InspectorValue> resultValue; makeCall(function, &resultValue); if (!resultValue || resultValue->type() != InspectorValue::TypeObject) { diff --git a/Source/WebCore/inspector/InjectedScriptCanvasModule.h b/Source/WebCore/inspector/InjectedScriptCanvasModule.h index 2e960aa6e..b5e136090 100644 --- a/Source/WebCore/inspector/InjectedScriptCanvasModule.h +++ b/Source/WebCore/inspector/InjectedScriptCanvasModule.h @@ -56,12 +56,16 @@ public: #endif void captureFrame(ErrorString*, String*); + void startCapturing(ErrorString*, String*); + void stopCapturing(ErrorString*, const String&); void dropTraceLog(ErrorString*, const String&); - void traceLog(ErrorString*, const String&, RefPtr<TypeBuilder::Canvas::TraceLog>*); + void traceLog(ErrorString*, const String&, const int*, RefPtr<TypeBuilder::Canvas::TraceLog>*); void replayTraceLog(ErrorString*, const String&, int, String*); private: ScriptObject callWrapContextFunction(const String&, const ScriptObject&); + void callStartCapturingFunction(const String&, ErrorString*, String*); + void callVoidFunctionWithTraceLogIdArgument(const String&, ErrorString*, const String&); }; #endif diff --git a/Source/WebCore/inspector/InjectedScriptCanvasModuleSource.js b/Source/WebCore/inspector/InjectedScriptCanvasModuleSource.js index 0e19e4c5c..20b7221cf 100644 --- a/Source/WebCore/inspector/InjectedScriptCanvasModuleSource.js +++ b/Source/WebCore/inspector/InjectedScriptCanvasModuleSource.js @@ -2552,39 +2552,85 @@ InjectedScript.prototype = { return resource.proxyObject(); }, + /** + * @return {string} + */ captureFrame: function() { + return this._callStartCapturingFunction(this._manager.captureFrame); + }, + + /** + * @return {string} + */ + startCapturing: function() + { + return this._callStartCapturingFunction(this._manager.startCapturing); + }, + + /** + * @param {function(this:ResourceTrackingManager)} func + * @return {string} + */ + _callStartCapturingFunction: function(func) + { + var oldTraceLog = this._manager.lastTraceLog(); + func.call(this._manager); + var traceLog = this._manager.lastTraceLog(); + if (traceLog === oldTraceLog) { + for (var id in this._traceLogs) { + if (this._traceLogs[id] === traceLog) + return id; + } + } var id = this._makeTraceLogId(); - this._manager.captureFrame(); - this._traceLogs[id] = this._manager.lastTraceLog(); + this._traceLogs[id] = traceLog; return id; }, /** * @param {string} id */ + stopCapturing: function(id) + { + var traceLog = this._traceLogs[id]; + if (traceLog) + this._manager.stopCapturing(traceLog); + }, + + /** + * @param {string} id + */ dropTraceLog: function(id) { - if (this._traceLogPlayer && this._traceLogPlayer.traceLog() === this._traceLogs[id]) + this.stopCapturing(id); + if (this._traceLogPlayer && this._traceLogPlayer.traceLog() === this._traceLogs[id]) { this._traceLogPlayer = null; + this._replayContexts = []; + } delete this._traceLogs[id]; }, /** * @param {string} id + * @param {number=} startOffset * @return {Object|string} */ - traceLog: function(id) + traceLog: function(id, startOffset) { var traceLog = this._traceLogs[id]; if (!traceLog) return "Error: Trace log with this ID not found."; + startOffset = Math.max(0, startOffset || 0); + var alive = this._manager.capturing() && this._manager.lastTraceLog() === traceLog; var result = { id: id, - calls: [] + calls: [], + alive: alive, + startOffset: startOffset }; var calls = traceLog.replayableCalls(); - for (var i = 0, n = calls.length; i < n; ++i) { + for (var i = startOffset, n = calls.length; i < n; ++i) { var call = calls[i]; var args = call.args().map(function(argument) { return argument + ""; diff --git a/Source/WebCore/inspector/Inspector.json b/Source/WebCore/inspector/Inspector.json index 4a64836b0..635fa9415 100644 --- a/Source/WebCore/inspector/Inspector.json +++ b/Source/WebCore/inspector/Inspector.json @@ -3180,7 +3180,9 @@ "type": "object", "properties": [ { "name": "id", "$ref": "TraceLogId" }, - { "name": "calls", "type": "array", "items": { "$ref": "Call" } } + { "name": "calls", "type": "array", "items": { "$ref": "Call" } }, + { "name": "startOffset", "type": "integer", "optional": true }, + { "name": "alive", "type": "boolean", "optional": true } ] } ], @@ -3206,9 +3208,22 @@ ] }, { - "name": "getTraceLog", + "name": "startCapturing", + "returns": [ + { "name": "traceLogId", "$ref": "TraceLogId" } + ] + }, + { + "name": "stopCapturing", "parameters": [ { "name": "traceLogId", "$ref": "TraceLogId" } + ] + }, + { + "name": "getTraceLog", + "parameters": [ + { "name": "traceLogId", "$ref": "TraceLogId" }, + { "name": "startOffset", "type": "integer", "optional": true } ], "returns": [ { "name": "traceLog", "$ref": "TraceLog" } diff --git a/Source/WebCore/inspector/InspectorCanvasAgent.cpp b/Source/WebCore/inspector/InspectorCanvasAgent.cpp index 10bef0cd2..04feb3241 100644 --- a/Source/WebCore/inspector/InspectorCanvasAgent.cpp +++ b/Source/WebCore/inspector/InspectorCanvasAgent.cpp @@ -112,11 +112,29 @@ void InspectorCanvasAgent::captureFrame(ErrorString* errorString, String* traceL module.captureFrame(errorString, traceLogId); } -void InspectorCanvasAgent::getTraceLog(ErrorString* errorString, const String& traceLogId, RefPtr<TypeBuilder::Canvas::TraceLog>& traceLog) +void InspectorCanvasAgent::startCapturing(ErrorString* errorString, String* traceLogId) +{ + ScriptState* scriptState = mainWorldScriptState(m_inspectedPage->mainFrame()); + InjectedScriptCanvasModule module = InjectedScriptCanvasModule::moduleForState(m_injectedScriptManager, scriptState); + if (module.hasNoValue()) { + *errorString = "Inspected frame has gone"; + return; + } + module.startCapturing(errorString, traceLogId); +} + +void InspectorCanvasAgent::stopCapturing(ErrorString* errorString, const String& traceLogId) +{ + InjectedScriptCanvasModule module = injectedScriptCanvasModuleForTraceLogId(errorString, traceLogId); + if (!module.hasNoValue()) + module.stopCapturing(errorString, traceLogId); +} + +void InspectorCanvasAgent::getTraceLog(ErrorString* errorString, const String& traceLogId, const int* startOffset, RefPtr<TypeBuilder::Canvas::TraceLog>& traceLog) { InjectedScriptCanvasModule module = injectedScriptCanvasModuleForTraceLogId(errorString, traceLogId); if (!module.hasNoValue()) - module.traceLog(errorString, traceLogId, &traceLog); + module.traceLog(errorString, traceLogId, startOffset, &traceLog); } void InspectorCanvasAgent::replayTraceLog(ErrorString* errorString, const String& traceLogId, int stepNo, String* result) diff --git a/Source/WebCore/inspector/InspectorCanvasAgent.h b/Source/WebCore/inspector/InspectorCanvasAgent.h index ef4cbd58c..26b3a55c2 100644 --- a/Source/WebCore/inspector/InspectorCanvasAgent.h +++ b/Source/WebCore/inspector/InspectorCanvasAgent.h @@ -64,6 +64,7 @@ public: virtual void clearFrontend(); virtual void restore(); + // Called from InspectorCanvasInstrumentation ScriptObject wrapCanvas2DRenderingContextForInstrumentation(const ScriptObject&); #if ENABLE(WEBGL) ScriptObject wrapWebGLRenderingContextForInstrumentation(const ScriptObject&); @@ -74,13 +75,11 @@ public: virtual void disable(ErrorString*); virtual void dropTraceLog(ErrorString*, const String&); virtual void captureFrame(ErrorString*, String*); - virtual void getTraceLog(ErrorString*, const String&, RefPtr<TypeBuilder::Canvas::TraceLog>&); + virtual void startCapturing(ErrorString*, String*); + virtual void stopCapturing(ErrorString*, const String&); + virtual void getTraceLog(ErrorString*, const String&, const int*, RefPtr<TypeBuilder::Canvas::TraceLog>&); virtual void replayTraceLog(ErrorString*, const String&, int, String*); - // Called from the injected script. - - // Called from InspectorInstrumentation - private: InspectorCanvasAgent(InstrumentingAgents*, InspectorState*, Page*, InjectedScriptManager*); diff --git a/Source/WebCore/inspector/InspectorController.cpp b/Source/WebCore/inspector/InspectorController.cpp index 2ff0d39c5..f55865bdf 100644 --- a/Source/WebCore/inspector/InspectorController.cpp +++ b/Source/WebCore/inspector/InspectorController.cpp @@ -293,7 +293,7 @@ void InspectorController::setProcessId(long processId) void InspectorController::webViewResized(const IntSize& size) { - m_overlay->resize(size); + m_pageAgent->webViewResized(size); } void InspectorController::evaluateForTestInFrontend(long callId, const String& script) diff --git a/Source/WebCore/inspector/InspectorPageAgent.cpp b/Source/WebCore/inspector/InspectorPageAgent.cpp index de73f22a2..133de98a7 100644 --- a/Source/WebCore/inspector/InspectorPageAgent.cpp +++ b/Source/WebCore/inspector/InspectorPageAgent.cpp @@ -373,6 +373,12 @@ void InspectorPageAgent::restore() } } +void InspectorPageAgent::webViewResized(const IntSize& size) +{ + int currentWidth = static_cast<int>(m_state->getLong(PageAgentState::pageAgentScreenWidthOverride)); + m_overlay->resize(currentWidth ? size : IntSize()); +} + void InspectorPageAgent::enable(ErrorString*) { m_enabled = true; diff --git a/Source/WebCore/inspector/InspectorPageAgent.h b/Source/WebCore/inspector/InspectorPageAgent.h index debe90b63..daace3636 100644 --- a/Source/WebCore/inspector/InspectorPageAgent.h +++ b/Source/WebCore/inspector/InspectorPageAgent.h @@ -148,6 +148,8 @@ public: virtual void clearFrontend(); virtual void restore(); + void webViewResized(const IntSize&); + // Cross-agents API Frame* mainFrame(); String createIdentifier(); diff --git a/Source/WebCore/inspector/compile-front-end.py b/Source/WebCore/inspector/compile-front-end.py index 6eada471d..af5319b00 100755 --- a/Source/WebCore/inspector/compile-front-end.py +++ b/Source/WebCore/inspector/compile-front-end.py @@ -271,6 +271,7 @@ modules = [ "TimelineModel.js", "TimelineOverviewPane.js", "TimelinePanel.js", + "TimelinePanelDescriptor.js", "TimelinePresentationModel.js", "TimelineFrameController.js" ] diff --git a/Source/WebCore/inspector/front-end/AdvancedSearchController.js b/Source/WebCore/inspector/front-end/AdvancedSearchController.js index 9dfa78cd5..3f4f8dfd4 100644 --- a/Source/WebCore/inspector/front-end/AdvancedSearchController.js +++ b/Source/WebCore/inspector/front-end/AdvancedSearchController.js @@ -39,6 +39,9 @@ WebInspector.AdvancedSearchController = function() WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameNavigated, this._frameNavigated, this); } +/** + * @return {!WebInspector.KeyboardShortcut.Descriptor} + */ WebInspector.AdvancedSearchController.createShortcut = function() { if (WebInspector.isMac()) @@ -49,7 +52,7 @@ WebInspector.AdvancedSearchController.createShortcut = function() WebInspector.AdvancedSearchController.prototype = { /** - * @param {Event} event + * @param {KeyboardEvent} event * @return {boolean} */ handleShortcut: function(event) diff --git a/Source/WebCore/inspector/front-end/CPUProfileView.js b/Source/WebCore/inspector/front-end/CPUProfileView.js index 42f73cfbd..9e3d5af89 100644 --- a/Source/WebCore/inspector/front-end/CPUProfileView.js +++ b/Source/WebCore/inspector/front-end/CPUProfileView.js @@ -630,7 +630,7 @@ WebInspector.CPUProfileType.prototype = { /** * @constructor * @extends {WebInspector.ProfileHeader} - * @param {WebInspector.CPUProfileType} type + * @param {!WebInspector.CPUProfileType} type * @param {string} title * @param {number=} uid */ diff --git a/Source/WebCore/inspector/front-end/CSSSelectorProfileView.js b/Source/WebCore/inspector/front-end/CSSSelectorProfileView.js index e9d71ec85..c1e9b6f2e 100644 --- a/Source/WebCore/inspector/front-end/CSSSelectorProfileView.js +++ b/Source/WebCore/inspector/front-end/CSSSelectorProfileView.js @@ -373,7 +373,7 @@ WebInspector.CSSSelectorProfileType.prototype = { /** * @constructor * @extends {WebInspector.ProfileHeader} - * @param {WebInspector.CSSSelectorProfileType} type + * @param {!WebInspector.CSSSelectorProfileType} type * @param {string} title * @param {number=} uid * @param {CSSAgent.SelectorProfile=} protocolData diff --git a/Source/WebCore/inspector/front-end/CallStackSidebarPane.js b/Source/WebCore/inspector/front-end/CallStackSidebarPane.js index c065c9067..27ad2231c 100644 --- a/Source/WebCore/inspector/front-end/CallStackSidebarPane.js +++ b/Source/WebCore/inspector/front-end/CallStackSidebarPane.js @@ -115,17 +115,13 @@ WebInspector.CallStackSidebarPane.prototype = { InspectorFrontendHost.copyText(text); }, - registerShortcuts: function(section, registerShortcutDelegate) + /** + * @param {function(!Array.<!WebInspector.KeyboardShortcut.Descriptor>, function(KeyboardEvent))} registerShortcutDelegate + */ + registerShortcuts: function(registerShortcutDelegate) { - var nextCallFrame = WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Period, - WebInspector.KeyboardShortcut.Modifiers.Ctrl); - registerShortcutDelegate(nextCallFrame.key, this._selectNextCallFrameOnStack.bind(this)); - - var prevCallFrame = WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Comma, - WebInspector.KeyboardShortcut.Modifiers.Ctrl); - registerShortcutDelegate(prevCallFrame.key, this._selectPreviousCallFrameOnStack.bind(this)); - - section.addRelatedKeys([ nextCallFrame.name, prevCallFrame.name ], WebInspector.UIString("Next/previous call frame")); + registerShortcutDelegate(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.NextCallFrame, this._selectNextCallFrameOnStack.bind(this)); + registerShortcutDelegate(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.PrevCallFrame, this._selectPreviousCallFrameOnStack.bind(this)); }, setStatus: function(status) diff --git a/Source/WebCore/inspector/front-end/CanvasProfileView.js b/Source/WebCore/inspector/front-end/CanvasProfileView.js index 79f69a59a..9219dee39 100644 --- a/Source/WebCore/inspector/front-end/CanvasProfileView.js +++ b/Source/WebCore/inspector/front-end/CanvasProfileView.js @@ -72,7 +72,7 @@ WebInspector.CanvasProfileView = function(profile) this._splitView.show(this.element); this._enableWaitIcon(true); - CanvasAgent.getTraceLog(this._traceLogId, this._didReceiveTraceLog.bind(this)); + CanvasAgent.getTraceLog(this._traceLogId, 0, this._didReceiveTraceLog.bind(this)); } WebInspector.CanvasProfileView.prototype = { @@ -276,7 +276,7 @@ WebInspector.CanvasProfileType.prototype = { /** * @constructor * @extends {WebInspector.ProfileHeader} - * @param {WebInspector.CanvasProfileType} type + * @param {!WebInspector.CanvasProfileType} type * @param {string} title * @param {number=} uid */ diff --git a/Source/WebCore/inspector/front-end/ConsoleView.js b/Source/WebCore/inspector/front-end/ConsoleView.js index 9ea5bca61..dcf5f7afa 100644 --- a/Source/WebCore/inspector/front-end/ConsoleView.js +++ b/Source/WebCore/inspector/front-end/ConsoleView.js @@ -476,37 +476,36 @@ WebInspector.ConsoleView.prototype = { this._shortcuts = {}; var shortcut = WebInspector.KeyboardShortcut; + var section = WebInspector.shortcutsScreen.section(WebInspector.UIString("Console")); + var shortcutL = shortcut.makeDescriptor("l", WebInspector.KeyboardShortcut.Modifiers.Ctrl); + this._shortcuts[shortcutL.key] = this._requestClearMessages.bind(this); + var keys = [shortcutL]; if (WebInspector.isMac()) { var shortcutK = shortcut.makeDescriptor("k", WebInspector.KeyboardShortcut.Modifiers.Meta); this._shortcuts[shortcutK.key] = this._requestClearMessages.bind(this); + keys.unshift(shortcutK); } - - var shortcutL = shortcut.makeDescriptor("l", WebInspector.KeyboardShortcut.Modifiers.Ctrl); - this._shortcuts[shortcutL.key] = this._requestClearMessages.bind(this); - - var section = WebInspector.shortcutsScreen.section(WebInspector.UIString("Console")); - var keys = WebInspector.isMac() ? [ shortcutK.name, shortcutL.name ] : [ shortcutL.name ]; section.addAlternateKeys(keys, WebInspector.UIString("Clear console")); + section.addKey(shortcut.makeDescriptor(shortcut.Keys.Tab), WebInspector.UIString("Autocomplete common prefix")); + section.addKey(shortcut.makeDescriptor(shortcut.Keys.Right), WebInspector.UIString("Accept suggestion")); + keys = [ - shortcut.shortcutToString(shortcut.Keys.Tab), - shortcut.shortcutToString(shortcut.Keys.Tab, shortcut.Modifiers.Shift) - ]; - section.addRelatedKeys(keys, WebInspector.UIString("Next/previous suggestion")); - section.addKey(shortcut.shortcutToString(shortcut.Keys.Right), WebInspector.UIString("Accept suggestion")); - keys = [ - shortcut.shortcutToString(shortcut.Keys.Down), - shortcut.shortcutToString(shortcut.Keys.Up) + shortcut.makeDescriptor(shortcut.Keys.Down), + shortcut.makeDescriptor(shortcut.Keys.Up) ]; section.addRelatedKeys(keys, WebInspector.UIString("Next/previous line")); - keys = [ - shortcut.shortcutToString("N", shortcut.Modifiers.Alt), - shortcut.shortcutToString("P", shortcut.Modifiers.Alt) - ]; - if (WebInspector.isMac()) + + if (WebInspector.isMac()) { + keys = [ + shortcut.makeDescriptor("N", shortcut.Modifiers.Alt), + shortcut.makeDescriptor("P", shortcut.Modifiers.Alt) + ]; section.addRelatedKeys(keys, WebInspector.UIString("Next/previous command")); - section.addKey(shortcut.shortcutToString(shortcut.Keys.Enter), WebInspector.UIString("Execute command")); + } + + section.addKey(shortcut.makeDescriptor(shortcut.Keys.Enter), WebInspector.UIString("Execute command")); }, _requestClearMessages: function() diff --git a/Source/WebCore/inspector/front-end/DOMExtension.js b/Source/WebCore/inspector/front-end/DOMExtension.js index 483714ac3..1af5d3ebb 100644 --- a/Source/WebCore/inspector/front-end/DOMExtension.js +++ b/Source/WebCore/inspector/front-end/DOMExtension.js @@ -200,6 +200,13 @@ Element.prototype.isScrolledToBottom = function() return this.scrollTop + this.clientHeight === this.scrollHeight; } +Element.prototype.remove = function() +{ + if (this.parentElement) + this.parentElement.removeChild(this); +} + + /** * @constructor * @param {number} width diff --git a/Source/WebCore/inspector/front-end/DefaultTextEditor.js b/Source/WebCore/inspector/front-end/DefaultTextEditor.js index 21874e45c..f7e85ff4a 100644 --- a/Source/WebCore/inspector/front-end/DefaultTextEditor.js +++ b/Source/WebCore/inspector/front-end/DefaultTextEditor.js @@ -455,7 +455,7 @@ WebInspector.DefaultTextEditor.prototype = { _handleScrollChanged: function(event) { - var visibleFrom = this._mainPanel.element.scrollTop; + var visibleFrom = this._mainPanel._scrollTop(); var firstVisibleLineNumber = this._mainPanel._findFirstVisibleLineNumber(visibleFrom); this._delegate.scrollChanged(firstVisibleLineNumber); }, @@ -591,6 +591,79 @@ WebInspector.DefaultTextEditor.prototype = { this._freeCachedElements(); }, + /** + * @param {Element} element + * @param {Array.<Object>} resultRanges + * @param {string} styleClass + * @param {Array.<Object>=} changes + */ + highlightRangesWithStyleClass: function(element, resultRanges, styleClass, changes) + { + this._mainPanel.beginDomUpdates(); + WebInspector.highlightRangesWithStyleClass(element, resultRanges, styleClass, changes); + this._mainPanel.endDomUpdates(); + }, + + /** + * @param {Element} element + * @param {Object} skipClasses + * @param {Object} skipTokens + * @return {Element} + */ + highlightExpression: function(element, skipClasses, skipTokens) + { + // Collect tokens belonging to evaluated expression. + var tokens = [ element ]; + var token = element.previousSibling; + while (token && (skipClasses[token.className] || skipTokens[token.textContent.trim()])) { + tokens.push(token); + token = token.previousSibling; + } + tokens.reverse(); + + // Wrap them with highlight element. + this._mainPanel.beginDomUpdates(); + var parentElement = element.parentElement; + var nextElement = element.nextSibling; + var container = document.createElement("span"); + for (var i = 0; i < tokens.length; ++i) + container.appendChild(tokens[i]); + parentElement.insertBefore(container, nextElement); + this._mainPanel.endDomUpdates(); + return container; + }, + + /** + * @param {Element} highlightElement + */ + hideHighlightedExpression: function(highlightElement) + { + this._mainPanel.beginDomUpdates(); + var parentElement = highlightElement.parentElement; + if (parentElement) { + var child = highlightElement.firstChild; + while (child) { + var nextSibling = child.nextSibling; + parentElement.insertBefore(child, highlightElement); + child = nextSibling; + } + parentElement.removeChild(highlightElement); + } + this._mainPanel.endDomUpdates(); + }, + + /** + * @param {number} scrollTop + * @param {number} clientHeight + * @param {number} chunkSize + */ + overrideViewportForTest: function(scrollTop, clientHeight, chunkSize) + { + this._mainPanel._scrollTopOverrideForTest = scrollTop; + this._mainPanel._clientHeightOverrideForTest = clientHeight; + this._mainPanel._defaultChunkSize = chunkSize; + }, + __proto__: WebInspector.View.prototype } @@ -861,8 +934,8 @@ WebInspector.TextEditorChunkedPanel.prototype = { if (this._paintCoalescingLevel) return; - var visibleFrom = this.element.scrollTop; - var visibleTo = this.element.scrollTop + this.element.clientHeight; + var visibleFrom = this._scrollTop(); + var visibleTo = visibleFrom + this._clientHeight(); if (visibleTo) { var result = this._findVisibleChunks(visibleFrom, visibleTo); @@ -870,6 +943,16 @@ WebInspector.TextEditorChunkedPanel.prototype = { } }, + _scrollTop: function() + { + return typeof this._scrollTopOverrideForTest === "number" ? this._scrollTopOverrideForTest : this.element.scrollTop; + }, + + _clientHeight: function() + { + return typeof this._clientHeightOverrideForTest === "number" ? this._clientHeightOverrideForTest : this.element.clientHeight; + }, + /** * @param {number} fromIndex * @param {number} toIndex @@ -1690,7 +1773,7 @@ WebInspector.TextEditorMainPanel.prototype = { { // First, paint visible lines, so that in case of long lines we should start highlighting // the visible area immediately, instead of waiting for the lines above the visible area. - var visibleFrom = this.element.scrollTop; + var visibleFrom = this._scrollTop(); var firstVisibleLineNumber = this._findFirstVisibleLineNumber(visibleFrom); var chunk; @@ -1925,7 +2008,9 @@ WebInspector.TextEditorMainPanel.prototype = { // We reached our container node, traverse within itself until we reach given offset. if (node === container && offset) { var text = node.textContent; - for (var i = 0; i < offset; ++i) { + // In case offset == 1 and lineRow is a chunk div, we need to traverse it all. + var textOffset = (node._chunk && offset === 1) ? text.length : offset; + for (var i = 0; i < textOffset; ++i) { if (text.charAt(i) === "\n") { lineNumber++; column = 0; @@ -2356,8 +2441,8 @@ WebInspector.TextEditorMainPanel.prototype = { */ _updateHighlightsForRange: function(range) { - var visibleFrom = this.element.scrollTop; - var visibleTo = this.element.scrollTop + this.element.clientHeight; + var visibleFrom = this._scrollTop(); + var visibleTo = visibleFrom + this._clientHeight(); var result = this._findVisibleChunks(visibleFrom, visibleTo); var chunk = this._textChunks[result.end - 1]; diff --git a/Source/WebCore/inspector/front-end/ElementsPanel.js b/Source/WebCore/inspector/front-end/ElementsPanel.js index 1b86510a0..624c03a8e 100644 --- a/Source/WebCore/inspector/front-end/ElementsPanel.js +++ b/Source/WebCore/inspector/front-end/ElementsPanel.js @@ -98,8 +98,6 @@ WebInspector.ElementsPanel = function() this.sidebarPanes[pane].onattach(); } - this._registerShortcuts(); - this._popoverHelper = new WebInspector.PopoverHelper(this.element, this._getPopoverAnchor.bind(this), this._showPopover.bind(this)); this._popoverHelper.setTimeout(0); @@ -200,6 +198,13 @@ WebInspector.ElementsPanel.prototype = { WebInspector.cssModel.forcePseudoState(node.id, node.getUserProperty(WebInspector.ElementsTreeOutline.PseudoStateDecorator.PropertyName)); this._metricsPaneEdited(); this._stylesPaneEdited(); + + WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMetrics.UserAction, { + action: WebInspector.UserMetrics.UserActionNames.ForcedElementState, + selector: node.appropriateSelectorFor(false), + enabled: enable, + state: pseudoClass + }); }, _selectedNodeChanged: function() @@ -1005,27 +1010,6 @@ WebInspector.ElementsPanel.prototype = { eventListenersSidebarPane.needsUpdate = false; }, - _registerShortcuts: function() - { - var shortcut = WebInspector.KeyboardShortcut; - var section = WebInspector.shortcutsScreen.section(WebInspector.UIString("Elements Panel")); - var keys = [ - shortcut.shortcutToString(shortcut.Keys.Up), - shortcut.shortcutToString(shortcut.Keys.Down) - ]; - section.addRelatedKeys(keys, WebInspector.UIString("Navigate elements")); - - keys = [ - shortcut.shortcutToString(shortcut.Keys.Right), - shortcut.shortcutToString(shortcut.Keys.Left) - ]; - section.addRelatedKeys(keys, WebInspector.UIString("Expand/collapse")); - section.addKey(shortcut.shortcutToString(shortcut.Keys.Enter), WebInspector.UIString("Edit attribute")); - section.addKey(shortcut.shortcutToString(shortcut.Keys.F2), WebInspector.UIString("Toggle edit as HTML")); - - this.sidebarPanes.styles.registerShortcuts(); - }, - handleShortcut: function(event) { if (WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event) && !event.shiftKey && event.keyIdentifier === "U+005A") { // Z key diff --git a/Source/WebCore/inspector/front-end/ElementsPanelDescriptor.js b/Source/WebCore/inspector/front-end/ElementsPanelDescriptor.js index 8f71aae08..0267f45b4 100644 --- a/Source/WebCore/inspector/front-end/ElementsPanelDescriptor.js +++ b/Source/WebCore/inspector/front-end/ElementsPanelDescriptor.js @@ -52,5 +52,104 @@ WebInspector.ElementsPanelDescriptor.prototype = { this.panel().appendApplicableItems(event, contextMenu, target); }, + registerShortcuts: function() + { + var elementsSection = WebInspector.shortcutsScreen.section(WebInspector.UIString("Elements Panel")); + + var navigate = WebInspector.ElementsPanelDescriptor.ShortcutKeys.NavigateUp.concat(WebInspector.ElementsPanelDescriptor.ShortcutKeys.NavigateDown); + elementsSection.addRelatedKeys(navigate, WebInspector.UIString("Navigate elements")); + + var expandCollapse = WebInspector.ElementsPanelDescriptor.ShortcutKeys.Expand.concat(WebInspector.ElementsPanelDescriptor.ShortcutKeys.Collapse); + elementsSection.addRelatedKeys(expandCollapse, WebInspector.UIString("Expand/collapse")); + + elementsSection.addAlternateKeys(WebInspector.ElementsPanelDescriptor.ShortcutKeys.EditAttribute, WebInspector.UIString("Edit attribute")); + elementsSection.addAlternateKeys(WebInspector.ElementsPanelDescriptor.ShortcutKeys.ToggleEditAsHTML, WebInspector.UIString("Toggle edit as HTML")); + + var stylesPaneSection = WebInspector.shortcutsScreen.section(WebInspector.UIString("Styles Pane")); + + var nextPreviousProperty = WebInspector.ElementsPanelDescriptor.ShortcutKeys.NextProperty.concat(WebInspector.ElementsPanelDescriptor.ShortcutKeys.PreviousProperty); + stylesPaneSection.addRelatedKeys(nextPreviousProperty, WebInspector.UIString("Next/previous property")); + + stylesPaneSection.addRelatedKeys(WebInspector.ElementsPanelDescriptor.ShortcutKeys.IncrementValue, WebInspector.UIString("Increment value")); + stylesPaneSection.addRelatedKeys(WebInspector.ElementsPanelDescriptor.ShortcutKeys.DecrementValue, WebInspector.UIString("Decrement value")); + + stylesPaneSection.addAlternateKeys(WebInspector.ElementsPanelDescriptor.ShortcutKeys.IncrementBy10, WebInspector.UIString("Increment by %f", 10)); + stylesPaneSection.addAlternateKeys(WebInspector.ElementsPanelDescriptor.ShortcutKeys.DecrementBy10, WebInspector.UIString("Decrement by %f", 10)); + + stylesPaneSection.addAlternateKeys(WebInspector.ElementsPanelDescriptor.ShortcutKeys.IncrementBy100, WebInspector.UIString("Increment by %f", 100)); + stylesPaneSection.addAlternateKeys(WebInspector.ElementsPanelDescriptor.ShortcutKeys.DecrementBy100, WebInspector.UIString("Decrement by %f", 100)); + + stylesPaneSection.addAlternateKeys(WebInspector.ElementsPanelDescriptor.ShortcutKeys.IncrementBy01, WebInspector.UIString("Increment by %f", 0.1)); + stylesPaneSection.addAlternateKeys(WebInspector.ElementsPanelDescriptor.ShortcutKeys.DecrementBy01, WebInspector.UIString("Decrement by %f", 0.1)); + }, + __proto__: WebInspector.PanelDescriptor.prototype } + +WebInspector.ElementsPanelDescriptor.ShortcutKeys = { + NavigateUp: [ + WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Up) + ], + + NavigateDown: [ + WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Down) + ], + + Expand: [ + WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Right) + ], + + Collapse: [ + WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Left) + ], + + EditAttribute: [ + WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Enter) + ], + + ToggleEditAsHTML: [ + WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F2) + ], + + NextProperty: [ + WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Tab) + ], + + PreviousProperty: [ + WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Tab, WebInspector.KeyboardShortcut.Modifiers.Shift) + ], + + IncrementValue: [ + WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Up) + ], + + DecrementValue: [ + WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Down) + ], + + IncrementBy10: [ + WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.PageUp), + WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Up, WebInspector.KeyboardShortcut.Modifiers.Shift) + ], + + DecrementBy10: [ + WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.PageDown), + WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Down, WebInspector.KeyboardShortcut.Modifiers.Shift) + ], + + IncrementBy100: [ + WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.PageUp, WebInspector.KeyboardShortcut.Modifiers.Shift) + ], + + DecrementBy100: [ + WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.PageDown, WebInspector.KeyboardShortcut.Modifiers.Shift) + ], + + IncrementBy01: [ + WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.PageUp, WebInspector.KeyboardShortcut.Modifiers.Alt) + ], + + DecrementBy01: [ + WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.PageDown, WebInspector.KeyboardShortcut.Modifiers.Alt) + ] +}; diff --git a/Source/WebCore/inspector/front-end/FileUtils.js b/Source/WebCore/inspector/front-end/FileUtils.js index d6a1dec6c..ebccd052a 100644 --- a/Source/WebCore/inspector/front-end/FileUtils.js +++ b/Source/WebCore/inspector/front-end/FileUtils.js @@ -295,7 +295,7 @@ WebInspector.ChunkedXHRReader.prototype = { } /** - * @param {function(File)} callback + * @param {function(!File)} callback * @return {Node} */ WebInspector.createFileSelectorElement = function(callback) { diff --git a/Source/WebCore/inspector/front-end/GoToLineDialog.js b/Source/WebCore/inspector/front-end/GoToLineDialog.js index ac41b7ad9..576394eb0 100644 --- a/Source/WebCore/inspector/front-end/GoToLineDialog.js +++ b/Source/WebCore/inspector/front-end/GoToLineDialog.js @@ -65,7 +65,7 @@ WebInspector.GoToLineDialog.install = function(panel, viewGetter) } var goToLineShortcut = WebInspector.GoToLineDialog.createShortcut(); - panel.registerShortcut(goToLineShortcut.key, showGoToLineDialog); + panel.registerShortcuts([goToLineShortcut], showGoToLineDialog); } WebInspector.GoToLineDialog._show = function(sourceView) @@ -75,6 +75,9 @@ WebInspector.GoToLineDialog._show = function(sourceView) WebInspector.Dialog.show(sourceView.element, new WebInspector.GoToLineDialog(sourceView)); } +/** + * @return {!WebInspector.KeyboardShortcut.Descriptor} + */ WebInspector.GoToLineDialog.createShortcut = function() { var isMac = WebInspector.isMac(); diff --git a/Source/WebCore/inspector/front-end/HeapSnapshotDataGrids.js b/Source/WebCore/inspector/front-end/HeapSnapshotDataGrids.js index 1ca3fbb27..4757e09ba 100644 --- a/Source/WebCore/inspector/front-end/HeapSnapshotDataGrids.js +++ b/Source/WebCore/inspector/front-end/HeapSnapshotDataGrids.js @@ -585,7 +585,7 @@ WebInspector.HeapSnapshotConstructorsDataGrid.prototype = { this.snapshot.aggregates(false, key, filter, this._aggregatesReceived.bind(this, key)); }, - _filterSelectIndexChanged: function(profiles, profileIndex) + filterSelectIndexChanged: function(profiles, profileIndex) { this._profileIndex = profileIndex; diff --git a/Source/WebCore/inspector/front-end/HeapSnapshotView.js b/Source/WebCore/inspector/front-end/HeapSnapshotView.js index 6b718fcc8..2c48fa3ad 100644 --- a/Source/WebCore/inspector/front-end/HeapSnapshotView.js +++ b/Source/WebCore/inspector/front-end/HeapSnapshotView.js @@ -386,7 +386,7 @@ WebInspector.HeapSnapshotView.prototype = { _changeFilter: function() { var profileIndex = this.filterSelectElement.selectedIndex - 1; - this.dataGrid._filterSelectIndexChanged(this._profiles(), profileIndex); + this.dataGrid.filterSelectIndexChanged(this._profiles(), profileIndex); if (!this.currentQuery || !this._searchFinishedCallback || !this._searchResults) return; @@ -416,6 +416,9 @@ WebInspector.HeapSnapshotView.prototype = { this.dataGrid.changeNameFilter(filter); }, + /** + * @return {!Array.<!WebInspector.ProfileHeader>} + */ _profiles: function() { return this.parent.getProfiles(WebInspector.HeapSnapshotProfileType.TypeId); @@ -803,7 +806,7 @@ WebInspector.HeapSnapshotProfileType.prototype = { /** * @constructor * @extends {WebInspector.ProfileHeader} - * @param {WebInspector.HeapSnapshotProfileType} type + * @param {!WebInspector.HeapSnapshotProfileType} type * @param {string} title * @param {number=} uid * @param {number=} maxJSObjectId @@ -962,16 +965,18 @@ WebInspector.HeapProfileHeader.prototype = { saveToFile: function() { this._numberOfChunks = 0; + + var fileOutputStream = new WebInspector.FileOutputStream(); function onOpen() { + this._receiver = fileOutputStream; this._savedChunks = 0; this._updateTransferProgress(0, this._totalNumberOfChunks); ProfilerAgent.getProfile(this.profileType().id, this.uid); } this._savingToFile = true; this._fileName = this._fileName || "Heap-" + new Date().toISO8601Compact() + ".heapsnapshot"; - this._receiver = new WebInspector.FileOutputStream(); - this._receiver.open(this._fileName, onOpen.bind(this)); + fileOutputStream.open(this._fileName, onOpen.bind(this)); }, /** diff --git a/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js b/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js index 3210c3a8f..dbf990b43 100644 --- a/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js +++ b/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js @@ -289,7 +289,7 @@ WebInspector.JavaScriptSourceFrame.prototype = { // 2. 'highlight' them with artificial style to detect word boundaries var changes = []; - WebInspector.highlightRangesWithStyleClass(lineElement, ranges, "source-frame-token", changes); + this.textEditor.highlightRangesWithStyleClass(lineElement, ranges, "source-frame-token", changes); var lineOffsetLeft = lineElement.totalOffsetLeft(); for (var child = lineElement.firstChild; child; child = child.nextSibling) { if (child.nodeType !== Node.ELEMENT_NODE || !child.hasStyleClass("source-frame-token")) @@ -338,38 +338,17 @@ WebInspector.JavaScriptSourceFrame.prototype = { return; // FIXME: the text editor should maintain highlight on its own. The check below is a workaround for // the case when highlight element is detached from DOM by the TextEditor when re-building the DOM. - var parentElement = highlightElement.parentElement; - if (parentElement) { - var child = highlightElement.firstChild; - while (child) { - var nextSibling = child.nextSibling; - parentElement.insertBefore(child, highlightElement); - child = nextSibling; - } - parentElement.removeChild(highlightElement); - } + this.textEditor.hideHighlightedExpression(highlightElement); delete this._highlightElement; }, + /** + * @param {Element} element + * @return {Element} + */ _highlightExpression: function(element) { - // Collect tokens belonging to evaluated expression. - var tokens = [ element ]; - var token = element.previousSibling; - while (token && (token.className === "webkit-javascript-ident" || token.className === "source-frame-token" || token.className === "webkit-javascript-keyword" || token.textContent.trim() === ".")) { - tokens.push(token); - token = token.previousSibling; - } - tokens.reverse(); - - // Wrap them with highlight element. - var parentElement = element.parentElement; - var nextElement = element.nextSibling; - var container = document.createElement("span"); - for (var i = 0; i < tokens.length; ++i) - container.appendChild(tokens[i]); - parentElement.insertBefore(container, nextElement); - return container; + return this.textEditor.highlightExpression(element, { "webkit-javascript-ident": true, "source-frame-token": true, "webkit-javascript-keyword": true }, { ".": true }); }, /** @@ -635,6 +614,13 @@ WebInspector.JavaScriptSourceFrame.prototype = { _setBreakpoint: function(lineNumber, condition, enabled) { this._breakpointManager.setBreakpoint(this._uiSourceCode, lineNumber, condition, enabled); + + WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMetrics.UserAction, { + action: WebInspector.UserMetrics.UserActionNames.SetBreakpoint, + url: this._uiSourceCode.url, + line: lineNumber, + enabled: enabled + }); }, /** diff --git a/Source/WebCore/inspector/front-end/KeyboardShortcut.js b/Source/WebCore/inspector/front-end/KeyboardShortcut.js index 4c42d92a1..9b8d868f7 100644 --- a/Source/WebCore/inspector/front-end/KeyboardShortcut.js +++ b/Source/WebCore/inspector/front-end/KeyboardShortcut.js @@ -51,6 +51,10 @@ WebInspector.KeyboardShortcut.Modifiers = { } }; +/** @typedef {{code: number, name: (string|Object.<string, string>)}} */ +WebInspector.KeyboardShortcut.Key; + +/** @type {!Object.<string, !WebInspector.KeyboardShortcut.Key>} */ WebInspector.KeyboardShortcut.Keys = { Backspace: { code: 8, name: "\u21a4" }, Tab: { code: 9, name: { mac: "\u21e5", other: "<Tab>" } }, @@ -92,8 +96,10 @@ WebInspector.KeyboardShortcut.Keys = { /** * Creates a number encoding keyCode in the lower 8 bits and modifiers mask in the higher 8 bits. * It is useful for matching pressed keys. - * keyCode is the Code of the key, or a character "a-z" which is converted to a keyCode value. + * + * @param {number|string} keyCode The Code of the key, or a character "a-z" which is converted to a keyCode value. * @param {number=} modifiers Optional list of modifiers passed as additional paramerters. + * @return {number} */ WebInspector.KeyboardShortcut.makeKey = function(keyCode, modifiers) { @@ -103,6 +109,10 @@ WebInspector.KeyboardShortcut.makeKey = function(keyCode, modifiers) return WebInspector.KeyboardShortcut._makeKeyFromCodeAndModifiers(keyCode, modifiers); } +/** + * @param {KeyboardEvent} keyboardEvent + * @return {number} + */ WebInspector.KeyboardShortcut.makeKeyFromEvent = function(keyboardEvent) { var modifiers = WebInspector.KeyboardShortcut.Modifiers.None; @@ -117,13 +127,21 @@ WebInspector.KeyboardShortcut.makeKeyFromEvent = function(keyboardEvent) return WebInspector.KeyboardShortcut._makeKeyFromCodeAndModifiers(keyboardEvent.keyCode, modifiers); } +/** + * @param {KeyboardEvent} event + */ WebInspector.KeyboardShortcut.eventHasCtrlOrMeta = function(event) { return WebInspector.isMac() ? event.metaKey && !event.ctrlKey : event.ctrlKey && !event.metaKey; } +/** @typedef {{key: number, name: string}} */ +WebInspector.KeyboardShortcut.Descriptor; + /** + * @param {string|WebInspector.KeyboardShortcut.Key} key * @param {number=} modifiers + * @return {WebInspector.KeyboardShortcut.Descriptor} */ WebInspector.KeyboardShortcut.makeDescriptor = function(key, modifiers) { @@ -134,27 +152,42 @@ WebInspector.KeyboardShortcut.makeDescriptor = function(key, modifiers) } /** + * @param {string|WebInspector.KeyboardShortcut.Key} key * @param {number=} modifiers + * @return {string} */ WebInspector.KeyboardShortcut.shortcutToString = function(key, modifiers) { return WebInspector.KeyboardShortcut._modifiersToString(modifiers) + WebInspector.KeyboardShortcut._keyName(key); } +/** + * @param {string|WebInspector.KeyboardShortcut.Key} key + * @return {string} + */ WebInspector.KeyboardShortcut._keyName = function(key) { if (typeof key === "string") return key.toUpperCase(); if (typeof key.name === "string") return key.name; - return key.name[WebInspector.platform()] || key.name.other; + return key.name[WebInspector.platform()] || key.name.other || ''; } +/** + * @param {number} keyCode + * @param {?number} modifiers + * @return {number} + */ WebInspector.KeyboardShortcut._makeKeyFromCodeAndModifiers = function(keyCode, modifiers) { return (keyCode & 255) | (modifiers << 8); }; +/** + * @param {number|undefined} modifiers + * @return {string} + */ WebInspector.KeyboardShortcut._modifiersToString = function(modifiers) { const cmdKey = "\u2318"; diff --git a/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js b/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js index de49245e0..7696dda34 100644 --- a/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js +++ b/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js @@ -259,7 +259,7 @@ WebInspector.NativeMemoryProfileType.prototype = { /** * @constructor * @extends {WebInspector.ProfileHeader} - * @param {WebInspector.NativeMemoryProfileType} type + * @param {!WebInspector.NativeMemoryProfileType} type * @param {string} title * @param {number=} uid */ diff --git a/Source/WebCore/inspector/front-end/NetworkItemView.js b/Source/WebCore/inspector/front-end/NetworkItemView.js index 91b95130c..48d1b8c27 100644 --- a/Source/WebCore/inspector/front-end/NetworkItemView.js +++ b/Source/WebCore/inspector/front-end/NetworkItemView.js @@ -90,8 +90,16 @@ WebInspector.NetworkItemView.prototype = { _tabSelected: function(event) { - if (event.data.isUserGesture) - WebInspector.settings.resourceViewTab.set(event.data.tabId); + if (!event.data.isUserGesture) + return; + + WebInspector.settings.resourceViewTab.set(event.data.tabId); + + WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMetrics.UserAction, { + action: WebInspector.UserMetrics.UserActionNames.NetworkRequestTabSelected, + tab: event.data.tabId, + url: this._request.url + }); }, /** diff --git a/Source/WebCore/inspector/front-end/NetworkPanel.js b/Source/WebCore/inspector/front-end/NetworkPanel.js index 7837c1f10..f95878ee7 100644 --- a/Source/WebCore/inspector/front-end/NetworkPanel.js +++ b/Source/WebCore/inspector/front-end/NetworkPanel.js @@ -303,6 +303,12 @@ WebInspector.NetworkLogView.prototype = { this._updateOffscreenRows(); this.searchCanceled(); + + WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMetrics.UserAction, { + action: WebInspector.UserMetrics.UserActionNames.NetworkSort, + column: columnIdentifier, + sortOrder: this._dataGrid.sortOrder + }); }, _sortByTimeline: function() @@ -1823,6 +1829,11 @@ WebInspector.NetworkDataGridNode.prototype = { { this._parentView.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.RequestSelected, this._request); WebInspector.DataGridNode.prototype.select.apply(this, arguments); + + WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMetrics.UserAction, { + action: WebInspector.UserMetrics.UserActionNames.NetworkRequestSelected, + url: this._request.url + }); }, _highlightMatchedSubstring: function(regexp) diff --git a/Source/WebCore/inspector/front-end/Panel.js b/Source/WebCore/inspector/front-end/Panel.js index d537c4e8b..248db9953 100644 --- a/Source/WebCore/inspector/front-end/Panel.js +++ b/Source/WebCore/inspector/front-end/Panel.js @@ -229,6 +229,9 @@ WebInspector.Panel.prototype = { return []; }, + /** + * @param {KeyboardEvent} event + */ handleShortcut: function(event) { var shortcutKey = WebInspector.KeyboardShortcut.makeKeyFromEvent(event); @@ -239,14 +242,14 @@ WebInspector.Panel.prototype = { } }, - registerShortcut: function(key, handler) - { - this._shortcuts[key] = handler; - }, - - unregisterShortcut: function(key) + /** + * @param {!Array.<!WebInspector.KeyboardShortcut.Descriptor>} keys + * @param {function(KeyboardEvent)} handler + */ + registerShortcuts: function(keys, handler) { - delete this._shortcuts[key]; + for (var i = 0; i < keys.length; ++i) + this._shortcuts[keys[i].key] = handler; }, __proto__: WebInspector.View.prototype @@ -313,5 +316,7 @@ WebInspector.PanelDescriptor.prototype = { importScript(this._scriptName); this._panel = new WebInspector[this._className]; return this._panel; - } + }, + + registerShortcuts: function() {} } diff --git a/Source/WebCore/inspector/front-end/ProfilesPanel.js b/Source/WebCore/inspector/front-end/ProfilesPanel.js index 226ac9ae8..2ec28faee 100644 --- a/Source/WebCore/inspector/front-end/ProfilesPanel.js +++ b/Source/WebCore/inspector/front-end/ProfilesPanel.js @@ -27,6 +27,8 @@ const UserInitiatedProfileName = "org.webkit.profiles.user-initiated"; /** * @constructor + * @param {string} id + * @param {string} name */ WebInspector.ProfileType = function(id, name) { @@ -99,7 +101,7 @@ WebInspector.ProfileType.prototype = { /** * @constructor - * @param {WebInspector.ProfileType} profileType + * @param {!WebInspector.ProfileType} profileType * @param {string} title * @param {number=} uid */ @@ -118,6 +120,9 @@ WebInspector.ProfileHeader = function(profileType, title, uid) } WebInspector.ProfileHeader.prototype = { + /** + * @return {!WebInspector.ProfileType} + */ profileType: function() { return this._profileType; @@ -132,11 +137,17 @@ WebInspector.ProfileHeader.prototype = { throw new Error("Needs implemented."); }, + /** + * @return {?WebInspector.View} + */ existingView: function() { return this._view; }, + /** + * @return {!WebInspector.View} + */ view: function() { if (!this._view) @@ -146,6 +157,7 @@ WebInspector.ProfileHeader.prototype = { /** * @param {WebInspector.ProfilesPanel} profilesPanel + * @return {!WebInspector.View} */ createView: function(profilesPanel) { @@ -215,7 +227,7 @@ WebInspector.ProfilesPanel = function() this.enableToggleButton = new WebInspector.StatusBarButton("", "enable-toggle-status-bar-item"); if (Capabilities.profilerCausesRecompilation) { this._statusBarButtons.push(this.enableToggleButton); - this.enableToggleButton.addEventListener("click", this._toggleProfiling, this); + this.enableToggleButton.addEventListener("click", this._onToggleProfiling, this); } this.recordButton = new WebInspector.StatusBarButton("", "record-profile-status-bar-item"); this.recordButton.addEventListener("click", this.toggleRecordButton, this); @@ -268,6 +280,9 @@ WebInspector.ProfilesPanel.prototype = { this.element.appendChild(this._fileSelectorElement); }, + /** + * @param {!File} file + */ _loadFromFile: function(file) { if (!file.name.endsWith(".heapsnapshot")) { @@ -332,9 +347,12 @@ WebInspector.ProfilesPanel.prototype = { this._reset(); }, + /** + * @param {WebInspector.Event} event + */ _onProfileTypeSelected: function(event) { - this._selectedProfileType = event.data; + this._selectedProfileType = /** @type {!WebInspector.ProfileType} */ (event.data); this.recordButton.title = this._selectedProfileType.buttonTooltip; }, @@ -417,6 +435,9 @@ WebInspector.ProfilesPanel.prototype = { profileType.treeElement.childrenListElement.addEventListener("contextmenu", this._handleContextMenuEvent.bind(this), true); }, + /** + * @param {Event} event + */ _handleContextMenuEvent: function(event) { var element = event.srcElement; @@ -522,7 +543,9 @@ WebInspector.ProfilesPanel.prototype = { if (!profile.isTemporary) { if (!this.visibleView) this.showProfile(profile); - this.dispatchEventToListeners("profile added"); + this.dispatchEventToListeners("profile added", { + type: typeId + }); } }, @@ -588,7 +611,7 @@ WebInspector.ProfilesPanel.prototype = { /** * @param {string} typeId - * @return {Array.<WebInspector.ProfileHeader>} + * @return {!Array.<!WebInspector.ProfileHeader>} */ getProfiles: function(typeId) { @@ -979,13 +1002,23 @@ WebInspector.ProfilesPanel.prototype = { this._toggleProfiling(this.panelEnablerView.alwaysEnabled); }, - _toggleProfiling: function(optionalAlways) + /** + * @param {WebInspector.Event} event + */ + _onToggleProfiling: function(event) { + this._toggleProfiling(true); + }, + + /** + * @param {boolean} always + */ + _toggleProfiling: function(always) { if (this._profilerEnabled) { WebInspector.settings.profilerEnabled.set(false); ProfilerAgent.disable(this._profilerWasDisabled.bind(this)); } else { - WebInspector.settings.profilerEnabled.set(!!optionalAlways); + WebInspector.settings.profilerEnabled.set(always); ProfilerAgent.enable(this._profilerWasEnabled.bind(this)); } }, @@ -1016,6 +1049,9 @@ WebInspector.ProfilesPanel.prototype = { this._profilesWereRequested = true; }, + /** + * @param {!WebInspector.Event} event + */ sidebarResized: function(event) { this.onResize(); @@ -1123,10 +1159,11 @@ WebInspector.ProfilesPanel.prototype = { /** * @constructor * @implements {ProfilerAgent.Dispatcher} + * @param {WebInspector.ProfilesPanel} profilesPanel */ -WebInspector.ProfilerDispatcher = function(profiler) +WebInspector.ProfilerDispatcher = function(profilesPanel) { - this._profiler = profiler; + this._profilesPanel = profilesPanel; } WebInspector.ProfilerDispatcher.prototype = { @@ -1135,8 +1172,8 @@ WebInspector.ProfilerDispatcher.prototype = { */ addProfileHeader: function(profile) { - var profileType = this._profiler.getProfileType(profile.typeId); - this._profiler.addProfileHeader(profileType.createProfile(profile)); + var profileType = this._profilesPanel.getProfileType(profile.typeId); + this._profilesPanel.addProfileHeader(profileType.createProfile(profile)); }, /** @@ -1146,7 +1183,7 @@ WebInspector.ProfilerDispatcher.prototype = { */ addHeapSnapshotChunk: function(uid, chunk) { - this._profiler._addHeapSnapshotChunk(uid, chunk); + this._profilesPanel._addHeapSnapshotChunk(uid, chunk); }, /** @@ -1155,7 +1192,7 @@ WebInspector.ProfilerDispatcher.prototype = { */ finishHeapSnapshot: function(uid) { - this._profiler._finishHeapSnapshot(uid); + this._profilesPanel._finishHeapSnapshot(uid); }, /** @@ -1164,7 +1201,7 @@ WebInspector.ProfilerDispatcher.prototype = { */ setRecordingProfile: function(isProfiling) { - this._profiler.setRecordingProfile(WebInspector.CPUProfileType.TypeId, isProfiling); + this._profilesPanel.setRecordingProfile(WebInspector.CPUProfileType.TypeId, isProfiling); }, /** @@ -1172,7 +1209,7 @@ WebInspector.ProfilerDispatcher.prototype = { */ resetProfiles: function() { - this._profiler._reset(); + this._profilesPanel._reset(); }, /** @@ -1182,13 +1219,16 @@ WebInspector.ProfilerDispatcher.prototype = { */ reportHeapSnapshotProgress: function(done, total) { - this._profiler._reportHeapSnapshotProgress(done, total); + this._profilesPanel._reportHeapSnapshotProgress(done, total); } } /** * @constructor * @extends {WebInspector.SidebarTreeElement} + * @param {!WebInspector.ProfileHeader} profile + * @param {string} titleFormat + * @param {string} className */ WebInspector.ProfileSidebarTreeElement = function(profile, titleFormat, className) { @@ -1245,6 +1285,9 @@ WebInspector.ProfileSidebarTreeElement.prototype = { this.bubbleElement.addStyleClass("search-matches"); }, + /** + * @param {!Event} event + */ handleContextMenuEvent: function(event) { var profile = this.profile; @@ -1289,6 +1332,7 @@ WebInspector.ProfileGroupSidebarTreeElement.prototype = { /** * @constructor * @extends {WebInspector.SidebarTreeElement} + * @param {!WebInspector.ProfilesPanel} panel */ WebInspector.ProfilesSidebarTreeElement = function(panel) { diff --git a/Source/WebCore/inspector/front-end/ScriptsPanel.js b/Source/WebCore/inspector/front-end/ScriptsPanel.js index 851273bde..4480d5801 100644 --- a/Source/WebCore/inspector/front-end/ScriptsPanel.js +++ b/Source/WebCore/inspector/front-end/ScriptsPanel.js @@ -65,7 +65,7 @@ WebInspector.ScriptsPanel = function(workspaceForTest) WebInspector.GoToLineDialog.install(this, viewGetter.bind(this)); var helpSection = WebInspector.shortcutsScreen.section(WebInspector.UIString("Sources Panel")); - this.debugToolbar = this._createDebugToolbar(helpSection); + this.debugToolbar = this._createDebugToolbar(); const initialDebugSidebarWidth = 225; const minimumDebugSidebarWidthPercent = 50; @@ -137,18 +137,10 @@ WebInspector.ScriptsPanel = function(workspaceForTest) this.sidebarPanes.scopechain.expanded = true; this.sidebarPanes.jsBreakpoints.expanded = true; - this.sidebarPanes.callstack.registerShortcuts(helpSection, this.registerShortcut.bind(this)); - var evaluateInConsoleShortcut = WebInspector.KeyboardShortcut.makeDescriptor("e", WebInspector.KeyboardShortcut.Modifiers.Shift | WebInspector.KeyboardShortcut.Modifiers.Ctrl); - helpSection.addKey(evaluateInConsoleShortcut.name, WebInspector.UIString("Evaluate selection in console")); - this.registerShortcut(evaluateInConsoleShortcut.key, this._evaluateSelectionInConsole.bind(this)); - - var outlineShortcut = WebInspector.KeyboardShortcut.makeDescriptor("o", WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta | WebInspector.KeyboardShortcut.Modifiers.Shift); - helpSection.addKey(outlineShortcut.name, WebInspector.UIString("Go to member")); - this.registerShortcut(outlineShortcut.key, this._showOutlineDialog.bind(this)); - - var createBreakpointShortcut = WebInspector.KeyboardShortcut.makeDescriptor("b", WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta); - helpSection.addKey(createBreakpointShortcut.name, WebInspector.UIString("Toggle breakpoint")); - this.registerShortcut(createBreakpointShortcut.key, this._toggleBreakpoint.bind(this)); + this.sidebarPanes.callstack.registerShortcuts(this.registerShortcuts.bind(this)); + this.registerShortcuts(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.EvaluateSelectionInConsole, this._evaluateSelectionInConsole.bind(this)); + this.registerShortcuts(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.GoToMember, this._showOutlineDialog.bind(this)); + this.registerShortcuts(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.ToggleBreakpoint, this._toggleBreakpoint.bind(this)); var panelEnablerHeading = WebInspector.UIString("You need to enable debugging before you can use the Scripts panel."); var panelEnablerDisclaimer = WebInspector.UIString("Enabling debugging will make scripts run slower."); @@ -415,6 +407,12 @@ WebInspector.ScriptsPanel.prototype = { if (typeof lineNumber === "number") sourceFrame.highlightLine(lineNumber); sourceFrame.focus(); + + WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMetrics.UserAction, { + action: WebInspector.UserMetrics.UserActionNames.OpenSourceLink, + url: uiSourceCode.url, + lineNumber: lineNumber + }); }, /** @@ -754,48 +752,36 @@ WebInspector.ScriptsPanel.prototype = { WebInspector.evaluateInConsole(selection.toString()); }, - _createDebugToolbar: function(section) + _createDebugToolbar: function() { var debugToolbar = document.createElement("div"); debugToolbar.className = "status-bar"; debugToolbar.id = "scripts-debug-toolbar"; - var title, handler, shortcuts; + var title, handler; var platformSpecificModifier = WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta; // Continue. handler = this._togglePause.bind(this); - shortcuts = []; - shortcuts.push(WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F8)); - shortcuts.push(WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Slash, platformSpecificModifier)); - this.pauseButton = this._createButtonAndRegisterShortcuts(section, "scripts-pause", "", handler, shortcuts, WebInspector.UIString("Pause/Continue")); + this.pauseButton = this._createButtonAndRegisterShortcuts("scripts-pause", "", handler, WebInspector.ScriptsPanelDescriptor.ShortcutKeys.PauseContinue); debugToolbar.appendChild(this.pauseButton); // Step over. title = WebInspector.UIString("Step over next function call (%s)."); handler = this._stepOverClicked.bind(this); - shortcuts = []; - shortcuts.push(WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F10)); - shortcuts.push(WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.SingleQuote, platformSpecificModifier)); - this.stepOverButton = this._createButtonAndRegisterShortcuts(section, "scripts-step-over", title, handler, shortcuts, WebInspector.UIString("Step over")); + this.stepOverButton = this._createButtonAndRegisterShortcuts("scripts-step-over", title, handler, WebInspector.ScriptsPanelDescriptor.ShortcutKeys.StepOver); debugToolbar.appendChild(this.stepOverButton); // Step into. title = WebInspector.UIString("Step into next function call (%s)."); handler = this._stepIntoClicked.bind(this); - shortcuts = []; - shortcuts.push(WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F11)); - shortcuts.push(WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Semicolon, platformSpecificModifier)); - this.stepIntoButton = this._createButtonAndRegisterShortcuts(section, "scripts-step-into", title, handler, shortcuts, WebInspector.UIString("Step into")); + this.stepIntoButton = this._createButtonAndRegisterShortcuts("scripts-step-into", title, handler, WebInspector.ScriptsPanelDescriptor.ShortcutKeys.StepInto); debugToolbar.appendChild(this.stepIntoButton); // Step out. title = WebInspector.UIString("Step out of current function (%s)."); handler = this._stepOutClicked.bind(this); - shortcuts = []; - shortcuts.push(WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F11, WebInspector.KeyboardShortcut.Modifiers.Shift)); - shortcuts.push(WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Semicolon, WebInspector.KeyboardShortcut.Modifiers.Shift | platformSpecificModifier)); - this.stepOutButton = this._createButtonAndRegisterShortcuts(section, "scripts-step-out", title, handler, shortcuts, WebInspector.UIString("Step out")); + this.stepOutButton = this._createButtonAndRegisterShortcuts("scripts-step-out", title, handler, WebInspector.ScriptsPanelDescriptor.ShortcutKeys.StepOut); debugToolbar.appendChild(this.stepOutButton); this._toggleBreakpointsButton = new WebInspector.StatusBarButton(WebInspector.UIString("Deactivate breakpoints."), "toggle-breakpoints"); @@ -820,7 +806,13 @@ WebInspector.ScriptsPanel.prototype = { button.title = buttonTitle; }, - _createButtonAndRegisterShortcuts: function(section, buttonId, buttonTitle, handler, shortcuts, shortcutDescription) + /** + * @param {string} buttonId + * @param {string} buttonTitle + * @param {function(Event)} handler + * @param {!Array.<!WebInspector.KeyboardShortcut.Descriptor>} shortcuts + */ + _createButtonAndRegisterShortcuts: function(buttonId, buttonTitle, handler, shortcuts) { var button = document.createElement("button"); button.className = "status-bar-item"; @@ -831,12 +823,7 @@ WebInspector.ScriptsPanel.prototype = { button.appendChild(document.createElement("img")); button.addEventListener("click", handler, false); - var shortcutNames = []; - for (var i = 0; i < shortcuts.length; ++i) { - this.registerShortcut(shortcuts[i].key, handler); - shortcutNames.push(shortcuts[i].name); - } - section.addAlternateKeys(shortcutNames, shortcutDescription); + this.registerShortcuts(shortcuts, handler); return button; }, @@ -950,6 +937,12 @@ WebInspector.ScriptsPanel.prototype = { var uiSourceCodes = this._workspace.uiSourceCodes(); for (var i = 0; i < uiSourceCodes.length; ++i) uiSourceCodes[i].setFormatted(this._toggleFormatSourceButton.toggled); + + WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMetrics.UserAction, { + action: WebInspector.UserMetrics.UserActionNames.TogglePrettyPrint, + enabled: this._toggleFormatSourceButton.toggled, + url: this._editorContainer.currentFile().url + }); }, addToWatch: function(expression) diff --git a/Source/WebCore/inspector/front-end/ScriptsPanelDescriptor.js b/Source/WebCore/inspector/front-end/ScriptsPanelDescriptor.js index 8f387f65b..5e6542d71 100644 --- a/Source/WebCore/inspector/front-end/ScriptsPanelDescriptor.js +++ b/Source/WebCore/inspector/front-end/ScriptsPanelDescriptor.js @@ -55,5 +55,64 @@ WebInspector.ScriptsPanelDescriptor.prototype = { this.panel().appendApplicableItems(event, contextMenu, target); }, + registerShortcuts: function() + { + var section = WebInspector.shortcutsScreen.section(WebInspector.UIString("Sources Panel")); + + section.addAlternateKeys(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.PauseContinue, WebInspector.UIString("Pause/Continue")); + section.addAlternateKeys(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.StepOver, WebInspector.UIString("Step over")); + section.addAlternateKeys(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.StepInto, WebInspector.UIString("Step into")); + section.addAlternateKeys(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.StepOut, WebInspector.UIString("Step out")); + + var nextAndPrevFrameKeys = WebInspector.ScriptsPanelDescriptor.ShortcutKeys.NextCallFrame.concat(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.PrevCallFrame); + section.addRelatedKeys(nextAndPrevFrameKeys, WebInspector.UIString("Next/previous call frame")); + + section.addAlternateKeys(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.EvaluateSelectionInConsole, WebInspector.UIString("Evaluate selection in console")); + section.addAlternateKeys(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.GoToMember, WebInspector.UIString("Go to member")); + section.addAlternateKeys(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.ToggleBreakpoint, WebInspector.UIString("Toggle breakpoint")); + }, + __proto__: WebInspector.PanelDescriptor.prototype } + +WebInspector.ScriptsPanelDescriptor.ShortcutKeys = { + PauseContinue: [ + WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F8), + WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Slash, WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta) + ], + + StepOver: [ + WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F10), + WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.SingleQuote, WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta) + ], + + StepInto: [ + WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F11), + WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Semicolon, WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta) + ], + + StepOut: [ + WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F11, WebInspector.KeyboardShortcut.Modifiers.Shift), + WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Semicolon, WebInspector.KeyboardShortcut.Modifiers.Shift | WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta) + ], + + EvaluateSelectionInConsole: [ + WebInspector.KeyboardShortcut.makeDescriptor("e", WebInspector.KeyboardShortcut.Modifiers.Shift | WebInspector.KeyboardShortcut.Modifiers.Ctrl) + ], + + GoToMember: [ + WebInspector.KeyboardShortcut.makeDescriptor("o", WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta | WebInspector.KeyboardShortcut.Modifiers.Shift) + ], + + ToggleBreakpoint: [ + WebInspector.KeyboardShortcut.makeDescriptor("b", WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta) + ], + + NextCallFrame: [ + WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Period, WebInspector.KeyboardShortcut.Modifiers.Ctrl) + ], + + PrevCallFrame: [ + WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Comma, WebInspector.KeyboardShortcut.Modifiers.Ctrl) + ] +}; diff --git a/Source/WebCore/inspector/front-end/ShortcutsScreen.js b/Source/WebCore/inspector/front-end/ShortcutsScreen.js index 8a7ca1089..a136c307b 100644 --- a/Source/WebCore/inspector/front-end/ShortcutsScreen.js +++ b/Source/WebCore/inspector/front-end/ShortcutsScreen.js @@ -31,13 +31,16 @@ /** * @constructor */ -WebInspector.ShortcutsScreen = function(finishShortcutsRegistrationCallback) +WebInspector.ShortcutsScreen = function() { - this._sections = {}; - this._finishShortcutsRegistrationCallback = finishShortcutsRegistrationCallback; + this._sections = /** @type {Object.<string, !WebInspector.ShortcutsSection>} */ ({}); } WebInspector.ShortcutsScreen.prototype = { + /** + * @param {string} name + * @return {!WebInspector.ShortcutsSection} + */ section: function(name) { var section = this._sections[name]; @@ -46,12 +49,11 @@ WebInspector.ShortcutsScreen.prototype = { return section; }, + /** + * @return {!WebInspector.View} + */ createShortcutsTabView: function() { - if (this._finishShortcutsRegistrationCallback) - this._finishShortcutsRegistrationCallback(); - delete this._finishShortcutsRegistrationCallback; - var orderedSections = []; for (var section in this._sections) orderedSections.push(this._sections[section]); @@ -82,32 +84,49 @@ WebInspector.shortcutsScreen = null; /** * @constructor + * @param {string} name */ WebInspector.ShortcutsSection = function(name) { this.name = name; - this._lines = []; + this._lines = /** @type {!Array.<{key: !Node, text: string}>} */ ([]); this.order = ++WebInspector.ShortcutsSection._sequenceNumber; }; WebInspector.ShortcutsSection._sequenceNumber = 0; WebInspector.ShortcutsSection.prototype = { + /** + * @param {!WebInspector.KeyboardShortcut.Descriptor} key + * @param {string} description + */ addKey: function(key, description) { this._addLine(this._renderKey(key), description); }, + /** + * @param {!Array.<!WebInspector.KeyboardShortcut.Descriptor>} keys + * @param {string} description + */ addRelatedKeys: function(keys, description) { this._addLine(this._renderSequence(keys, "/"), description); }, + /** + * @param {!Array.<!WebInspector.KeyboardShortcut.Descriptor>} keys + * @param {string} description + */ addAlternateKeys: function(keys, description) { this._addLine(this._renderSequence(keys, WebInspector.UIString("or")), description); }, + /** + * @param {!Node} keyElement + * @param {string} description + */ _addLine: function(keyElement, description) { this._lines.push({ key: keyElement, text: description }) @@ -133,18 +152,33 @@ WebInspector.ShortcutsSection.prototype = { } }, + /** + * @param {!Array.<!WebInspector.KeyboardShortcut.Descriptor>} sequence + * @param {string} delimiter + * @return {!Node} + */ _renderSequence: function(sequence, delimiter) { var delimiterSpan = this._createSpan("help-key-delimiter", delimiter); return this._joinNodes(sequence.map(this._renderKey.bind(this)), delimiterSpan); }, + /** + * @param {!WebInspector.KeyboardShortcut.Descriptor} key + * @return {!Node} + */ _renderKey: function(key) { + var keyName = key.name; var plus = this._createSpan("help-combine-keys", "+"); - return this._joinNodes(key.split(" + ").map(this._createSpan.bind(this, "help-key monospace")), plus); + return this._joinNodes(keyName.split(" + ").map(this._createSpan.bind(this, "help-key monospace")), plus); }, + /** + * @param {string} className + * @param {string} textContent + * @return {!Element} + */ _createSpan: function(className, textContent) { var node = document.createElement("span"); @@ -153,6 +187,11 @@ WebInspector.ShortcutsSection.prototype = { return node; }, + /** + * @param {!Array.<!Element>} nodes + * @param {!Element} delimiter + * @return {!Node} + */ _joinNodes: function(nodes, delimiter) { var result = document.createDocumentFragment(); diff --git a/Source/WebCore/inspector/front-end/StylesSidebarPane.js b/Source/WebCore/inspector/front-end/StylesSidebarPane.js index 29b0e924e..f7196a1f2 100644 --- a/Source/WebCore/inspector/front-end/StylesSidebarPane.js +++ b/Source/WebCore/inspector/front-end/StylesSidebarPane.js @@ -693,42 +693,6 @@ WebInspector.StylesSidebarPane.prototype = { } }, - registerShortcuts: function() - { - var section = WebInspector.shortcutsScreen.section(WebInspector.UIString("Styles Pane")); - var shortcut = WebInspector.KeyboardShortcut; - var keys = [ - shortcut.shortcutToString(shortcut.Keys.Tab), - shortcut.shortcutToString(shortcut.Keys.Tab, shortcut.Modifiers.Shift) - ]; - section.addRelatedKeys(keys, WebInspector.UIString("Next/previous property")); - keys = [ - shortcut.shortcutToString(shortcut.Keys.Up), - shortcut.shortcutToString(shortcut.Keys.Down) - ]; - section.addRelatedKeys(keys, WebInspector.UIString("Increment/decrement value")); - keys = [ - shortcut.shortcutToString(shortcut.Keys.Up, shortcut.Modifiers.Shift), - shortcut.shortcutToString(shortcut.Keys.Down, shortcut.Modifiers.Shift) - ]; - section.addRelatedKeys(keys, WebInspector.UIString("Increment/decrement by %f", 10)); - keys = [ - shortcut.shortcutToString(shortcut.Keys.PageUp), - shortcut.shortcutToString(shortcut.Keys.PageDown) - ]; - section.addRelatedKeys(keys, WebInspector.UIString("Increment/decrement by %f", 10)); - keys = [ - shortcut.shortcutToString(shortcut.Keys.PageUp, shortcut.Modifiers.Shift), - shortcut.shortcutToString(shortcut.Keys.PageDown, shortcut.Modifiers.Shift) - ]; - section.addRelatedKeys(keys, WebInspector.UIString("Increment/decrement by %f", 100)); - keys = [ - shortcut.shortcutToString(shortcut.Keys.PageUp, shortcut.Modifiers.Alt), - shortcut.shortcutToString(shortcut.Keys.PageDown, shortcut.Modifiers.Alt) - ]; - section.addRelatedKeys(keys, WebInspector.UIString("Increment/decrement by %f", 0.1)); - }, - _toggleElementStatePane: function(event) { event.consume(); diff --git a/Source/WebCore/inspector/front-end/TextEditorModel.js b/Source/WebCore/inspector/front-end/TextEditorModel.js index 9541ef59d..6d73c723b 100644 --- a/Source/WebCore/inspector/front-end/TextEditorModel.js +++ b/Source/WebCore/inspector/front-end/TextEditorModel.js @@ -135,6 +135,11 @@ WebInspector.TextRange.prototype = { shift: function(lineOffset) { return new WebInspector.TextRange(this.startLine + lineOffset, this.startColumn, this.endLine + lineOffset, this.endColumn); + }, + + toString: function() + { + return JSON.stringify(this); } } diff --git a/Source/WebCore/inspector/front-end/TimelinePanel.js b/Source/WebCore/inspector/front-end/TimelinePanel.js index 64feb9dfd..7cf93b073 100644 --- a/Source/WebCore/inspector/front-end/TimelinePanel.js +++ b/Source/WebCore/inspector/front-end/TimelinePanel.js @@ -312,20 +312,10 @@ WebInspector.TimelinePanel.prototype = { _registerShortcuts: function() { - var shortcut = WebInspector.KeyboardShortcut; - var modifiers = shortcut.Modifiers; - var section = WebInspector.shortcutsScreen.section(WebInspector.UIString("Timeline Panel")); - - this._shortcuts[shortcut.makeKey("e", modifiers.CtrlOrMeta)] = this._toggleTimelineButtonClicked.bind(this); - section.addKey(shortcut.shortcutToString("e", modifiers.CtrlOrMeta), WebInspector.UIString("Start/stop recording")); - - if (InspectorFrontendHost.canSave()) { - this._shortcuts[shortcut.makeKey("s", modifiers.CtrlOrMeta)] = this._saveToFile.bind(this); - section.addKey(shortcut.shortcutToString("s", modifiers.CtrlOrMeta), WebInspector.UIString("Save timeline data")); - } - - this._shortcuts[shortcut.makeKey("o", modifiers.CtrlOrMeta)] = this._fileSelectorElement.click.bind(this._fileSelectorElement); - section.addKey(shortcut.shortcutToString("o", modifiers.CtrlOrMeta), WebInspector.UIString("Load timeline data")); + this.registerShortcuts(WebInspector.TimelinePanelDescriptor.ShortcutKeys.StartStopRecording, this._toggleTimelineButtonClicked.bind(this)); + if (InspectorFrontendHost.canSave()) + this.registerShortcuts(WebInspector.TimelinePanelDescriptor.ShortcutKeys.SaveToFile, this._saveToFile.bind(this)); + this.registerShortcuts(WebInspector.TimelinePanelDescriptor.ShortcutKeys.LoadFromFile, this._fileSelectorElement.click.bind(this._fileSelectorElement)); }, _createFileSelector: function() diff --git a/Source/WebCore/inspector/front-end/TimelinePanelDescriptor.js b/Source/WebCore/inspector/front-end/TimelinePanelDescriptor.js new file mode 100644 index 000000000..5834f0df6 --- /dev/null +++ b/Source/WebCore/inspector/front-end/TimelinePanelDescriptor.js @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * 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 GOOGLE INC. AND ITS CONTRIBUTORS + * "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 GOOGLE INC. + * OR ITS 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. + */ + +/** + * @constructor + * @extends {WebInspector.PanelDescriptor} + */ +WebInspector.TimelinePanelDescriptor = function() +{ + WebInspector.PanelDescriptor.call(this, "timeline", WebInspector.UIString("Timeline"), "TimelinePanel", "TimelinePanel.js"); +} + +WebInspector.TimelinePanelDescriptor.prototype = { + registerShortcuts: function() + { + var section = WebInspector.shortcutsScreen.section(WebInspector.UIString("Timeline Panel")); + section.addAlternateKeys(WebInspector.TimelinePanelDescriptor.ShortcutKeys.StartStopRecording, WebInspector.UIString("Start/stop recording")); + if (InspectorFrontendHost.canSave()) + section.addAlternateKeys(WebInspector.TimelinePanelDescriptor.ShortcutKeys.SaveToFile, WebInspector.UIString("Save timeline data")); + section.addAlternateKeys(WebInspector.TimelinePanelDescriptor.ShortcutKeys.LoadFromFile, WebInspector.UIString("Load timeline data")); + }, + + __proto__: WebInspector.PanelDescriptor.prototype +} + +WebInspector.TimelinePanelDescriptor.ShortcutKeys = { + StartStopRecording: [ + WebInspector.KeyboardShortcut.makeDescriptor("e", WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta) + ], + + SaveToFile: [ + WebInspector.KeyboardShortcut.makeDescriptor("s", WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta) + ], + + LoadFromFile: [ + WebInspector.KeyboardShortcut.makeDescriptor("o", WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta) + ] +} diff --git a/Source/WebCore/inspector/front-end/TimelinePresentationModel.js b/Source/WebCore/inspector/front-end/TimelinePresentationModel.js index f44f9464c..711490ba4 100644 --- a/Source/WebCore/inspector/front-end/TimelinePresentationModel.js +++ b/Source/WebCore/inspector/front-end/TimelinePresentationModel.js @@ -945,62 +945,62 @@ WebInspector.TimelinePresentationModel.Record.prototype = { { var details; switch (this.type) { - case WebInspector.TimelineModel.RecordType.GCEvent: - details = WebInspector.UIString("%s collected", Number.bytesToString(this.data["usedHeapSizeDelta"])); - break; - case WebInspector.TimelineModel.RecordType.TimerFire: - details = this._linkifyScriptLocation(this.data["timerId"]); - break; - case WebInspector.TimelineModel.RecordType.FunctionCall: - details = this._linkifyScriptLocation(); - break; - case WebInspector.TimelineModel.RecordType.FireAnimationFrame: - details = this._linkifyScriptLocation(this.data["id"]); - break; - case WebInspector.TimelineModel.RecordType.EventDispatch: - details = this.data ? this.data["type"] : null; - break; - case WebInspector.TimelineModel.RecordType.Paint: - details = this.data["width"] + "\u2009\u00d7\u2009" + this.data["height"]; - break; - case WebInspector.TimelineModel.RecordType.DecodeImage: - details = this.data["imageType"]; - break; - case WebInspector.TimelineModel.RecordType.ResizeImage: - details = this.data["cached"] ? WebInspector.UIString("cached") : WebInspector.UIString("non-cached"); - break; - case WebInspector.TimelineModel.RecordType.TimerInstall: - case WebInspector.TimelineModel.RecordType.TimerRemove: - details = this._linkifyTopCallFrame(this.data["timerId"]); - break; - case WebInspector.TimelineModel.RecordType.RequestAnimationFrame: - case WebInspector.TimelineModel.RecordType.CancelAnimationFrame: - details = this._linkifyTopCallFrame(this.data["id"]); - break; - case WebInspector.TimelineModel.RecordType.ParseHTML: - case WebInspector.TimelineModel.RecordType.RecalculateStyles: - details = this._linkifyTopCallFrame(); - break; - case WebInspector.TimelineModel.RecordType.EvaluateScript: - details = this.url ? this._linkifyLocation(this.url, this.data["lineNumber"], 0) : null; - break; - case WebInspector.TimelineModel.RecordType.XHRReadyStateChange: - case WebInspector.TimelineModel.RecordType.XHRLoad: - case WebInspector.TimelineModel.RecordType.ScheduleResourceRequest: - case WebInspector.TimelineModel.RecordType.ResourceSendRequest: - case WebInspector.TimelineModel.RecordType.ResourceReceivedData: - case WebInspector.TimelineModel.RecordType.ResourceReceiveResponse: - case WebInspector.TimelineModel.RecordType.ResourceFinish: - details = WebInspector.displayNameForURL(this.url); - break; - case WebInspector.TimelineModel.RecordType.Time: - case WebInspector.TimelineModel.RecordType.TimeEnd: - case WebInspector.TimelineModel.RecordType.TimeStamp: - details = this.data["message"]; - break; - default: - details = this._linkifyScriptLocation() || this._linkifyTopCallFrame() || null; - break; + case WebInspector.TimelineModel.RecordType.GCEvent: + details = WebInspector.UIString("%s collected", Number.bytesToString(this.data["usedHeapSizeDelta"])); + break; + case WebInspector.TimelineModel.RecordType.TimerFire: + details = this._linkifyScriptLocation(this.data["timerId"]); + break; + case WebInspector.TimelineModel.RecordType.FunctionCall: + details = this._linkifyScriptLocation(); + break; + case WebInspector.TimelineModel.RecordType.FireAnimationFrame: + details = this._linkifyScriptLocation(this.data["id"]); + break; + case WebInspector.TimelineModel.RecordType.EventDispatch: + details = this.data ? this.data["type"] : null; + break; + case WebInspector.TimelineModel.RecordType.Paint: + details = this.data["width"] + "\u2009\u00d7\u2009" + this.data["height"]; + break; + case WebInspector.TimelineModel.RecordType.DecodeImage: + details = this.data["imageType"]; + break; + case WebInspector.TimelineModel.RecordType.ResizeImage: + details = this.data["cached"] ? WebInspector.UIString("cached") : WebInspector.UIString("non-cached"); + break; + case WebInspector.TimelineModel.RecordType.TimerInstall: + case WebInspector.TimelineModel.RecordType.TimerRemove: + details = this._linkifyTopCallFrame(this.data["timerId"]); + break; + case WebInspector.TimelineModel.RecordType.RequestAnimationFrame: + case WebInspector.TimelineModel.RecordType.CancelAnimationFrame: + details = this._linkifyTopCallFrame(this.data["id"]); + break; + case WebInspector.TimelineModel.RecordType.ParseHTML: + case WebInspector.TimelineModel.RecordType.RecalculateStyles: + details = this._linkifyTopCallFrame(); + break; + case WebInspector.TimelineModel.RecordType.EvaluateScript: + details = this.url ? this._linkifyLocation(this.url, this.data["lineNumber"], 0) : null; + break; + case WebInspector.TimelineModel.RecordType.XHRReadyStateChange: + case WebInspector.TimelineModel.RecordType.XHRLoad: + case WebInspector.TimelineModel.RecordType.ScheduleResourceRequest: + case WebInspector.TimelineModel.RecordType.ResourceSendRequest: + case WebInspector.TimelineModel.RecordType.ResourceReceivedData: + case WebInspector.TimelineModel.RecordType.ResourceReceiveResponse: + case WebInspector.TimelineModel.RecordType.ResourceFinish: + details = WebInspector.displayNameForURL(this.url); + break; + case WebInspector.TimelineModel.RecordType.Time: + case WebInspector.TimelineModel.RecordType.TimeEnd: + case WebInspector.TimelineModel.RecordType.TimeStamp: + details = this.data["message"]; + break; + default: + details = this._linkifyScriptLocation() || this._linkifyTopCallFrame() || null; + break; } if (typeof details === "string") diff --git a/Source/WebCore/inspector/front-end/UISourceCode.js b/Source/WebCore/inspector/front-end/UISourceCode.js index 98a514651..f749cb9c5 100644 --- a/Source/WebCore/inspector/front-end/UISourceCode.js +++ b/Source/WebCore/inspector/front-end/UISourceCode.js @@ -258,6 +258,11 @@ WebInspector.UISourceCode.prototype = { } this.requestOriginalContent(callback.bind(this)); + + WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMetrics.UserAction, { + action: WebInspector.UserMetrics.UserActionNames.ApplyOriginalContent, + url: this.url + }); }, /** @@ -283,6 +288,11 @@ WebInspector.UISourceCode.prototype = { } this.requestOriginalContent(revert.bind(this)); + + WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMetrics.UserAction, { + action: WebInspector.UserMetrics.UserActionNames.RevertRevision, + url: this.url + }); }, /** @@ -330,6 +340,11 @@ WebInspector.UISourceCode.prototype = { this._commitContent(this._workingCopy); callback(null); + + WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMetrics.UserAction, { + action: WebInspector.UserMetrics.UserActionNames.FileSaved, + url: this.url + }); }, /** diff --git a/Source/WebCore/inspector/front-end/UserMetrics.js b/Source/WebCore/inspector/front-end/UserMetrics.js index d4f99e6be..24b61ab37 100644 --- a/Source/WebCore/inspector/front-end/UserMetrics.js +++ b/Source/WebCore/inspector/front-end/UserMetrics.js @@ -89,6 +89,22 @@ WebInspector.UserMetrics._PanelCodes = { console: 8 } +WebInspector.UserMetrics.UserAction = "UserAction"; + +WebInspector.UserMetrics.UserActionNames = { + ForcedElementState: "forcedElementState", + FileSaved: "fileSaved", + RevertRevision: "revertRevision", + ApplyOriginalContent: "applyOriginalContent", + TogglePrettyPrint: "togglePrettyPrint", + SetBreakpoint: "setBreakpoint", + OpenSourceLink: "openSourceLink", + NetworkSort: "networkSort", + NetworkRequestSelected: "networkRequestSelected", + NetworkRequestTabSelected: "networkRequestTabSelected", + ChoseHeapSnapshotBetween: "choseHeapSnapshotBetween" +}; + WebInspector.UserMetrics.prototype = { panelShown: function(panelName) { diff --git a/Source/WebCore/inspector/front-end/WebKit.qrc b/Source/WebCore/inspector/front-end/WebKit.qrc index ccfabc3c7..fda2ee842 100644 --- a/Source/WebCore/inspector/front-end/WebKit.qrc +++ b/Source/WebCore/inspector/front-end/WebKit.qrc @@ -203,6 +203,7 @@ <file>TimelineGrid.js</file> <file>TimelineOverviewPane.js</file> <file>TimelinePanel.js</file> + <file>TimelinePanelDescriptor.js</file> <file>Toolbar.js</file> <file>TopDownProfileDataGridTree.js</file> <file>treeoutline.js</file> diff --git a/Source/WebCore/inspector/front-end/externs.js b/Source/WebCore/inspector/front-end/externs.js index 815297c66..be792be6d 100644 --- a/Source/WebCore/inspector/front-end/externs.js +++ b/Source/WebCore/inspector/front-end/externs.js @@ -236,6 +236,7 @@ WebInspector.evaluateInConsole = function(expression, showResultOnly) {} WebInspector.queryParamsObject = {} WebInspector.Events = { + InspectorLoaded: "InspectorLoaded", InspectorClosing: "InspectorClosing" } diff --git a/Source/WebCore/inspector/front-end/inspector.html b/Source/WebCore/inspector/front-end/inspector.html index 19c93389f..418156f80 100644 --- a/Source/WebCore/inspector/front-end/inspector.html +++ b/Source/WebCore/inspector/front-end/inspector.html @@ -169,6 +169,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <script type="text/javascript" src="ElementsPanelDescriptor.js"></script> <script type="text/javascript" src="NetworkPanelDescriptor.js"></script> <script type="text/javascript" src="ScriptsPanelDescriptor.js"></script> + <script type="text/javascript" src="TimelinePanelDescriptor.js"></script> <script type="text/javascript" src="DockController.js"></script> </head> <body class="undocked" id="-webkit-web-inspector"> diff --git a/Source/WebCore/inspector/front-end/inspector.js b/Source/WebCore/inspector/front-end/inspector.js index dc13a3ef1..3edf3c5c0 100644 --- a/Source/WebCore/inspector/front-end/inspector.js +++ b/Source/WebCore/inspector/front-end/inspector.js @@ -41,7 +41,7 @@ var WebInspector = { var resources = new WebInspector.PanelDescriptor("resources", WebInspector.UIString("Resources"), "ResourcesPanel", "ResourcesPanel.js"); var network = new WebInspector.NetworkPanelDescriptor(); var scripts = new WebInspector.ScriptsPanelDescriptor(); - var timeline = new WebInspector.PanelDescriptor("timeline", WebInspector.UIString("Timeline"), "TimelinePanel", "TimelinePanel.js"); + var timeline = new WebInspector.TimelinePanelDescriptor(); var profiles = new WebInspector.PanelDescriptor("profiles", WebInspector.UIString("Profiles"), "ProfilesPanel", "ProfilesPanel.js"); var audits = new WebInspector.PanelDescriptor("audits", WebInspector.UIString("Audits"), "AuditsPanel", "AuditsPanel.js"); var console = new WebInspector.PanelDescriptor("console", WebInspector.UIString("Console"), "ConsolePanel"); @@ -55,7 +55,6 @@ var WebInspector = { panelDescriptors.push(console); return panelDescriptors; } - var allDescriptors = [elements, resources, network, scripts, timeline, profiles, audits, console]; var hiddenPanels = InspectorFrontendHost.hiddenPanels(); for (var i = 0; i < allDescriptors.length; ++i) { if (hiddenPanels.indexOf(allDescriptors[i].name()) === -1) @@ -291,6 +290,7 @@ var WebInspector = { } WebInspector.Events = { + InspectorLoaded: "InspectorLoaded", InspectorClosing: "InspectorClosing" } @@ -379,14 +379,17 @@ WebInspector.doLoadedDone = function() WebInspector._doLoadedDoneWithCapabilities = function() { - var panelDescriptors = this._panelDescriptors(); - WebInspector.shortcutsScreen = new WebInspector.ShortcutsScreen(this._registerShortcuts.bind(this, panelDescriptors)); + WebInspector.shortcutsScreen = new WebInspector.ShortcutsScreen(); + this._registerShortcuts(); // set order of some sections explicitly - WebInspector.shortcutsScreen.section(WebInspector.UIString("All Panels")); WebInspector.shortcutsScreen.section(WebInspector.UIString("Console")); WebInspector.shortcutsScreen.section(WebInspector.UIString("Elements Panel")); + var panelDescriptors = this._panelDescriptors(); + for (var i = 0; i < panelDescriptors.length; ++i) + panelDescriptors[i].registerShortcuts(); + this.console = new WebInspector.ConsoleModel(); this.console.addEventListener(WebInspector.ConsoleModel.Events.ConsoleCleared, this._updateErrorAndWarningCounts, this); this.console.addEventListener(WebInspector.ConsoleModel.Events.MessageAdded, this._updateErrorAndWarningCounts, this); @@ -491,6 +494,8 @@ WebInspector._doLoadedDoneWithCapabilities = function() WebInspector.WorkerManager.loadCompleted(); InspectorFrontendAPI.loadCompleted(); + + WebInspector.notifications.dispatchEventToListeners(WebInspector.Events.InspectorLoaded); } var windowLoaded = function() @@ -613,46 +618,46 @@ WebInspector.openResource = function(resourceURL, inResourcesPanel) InspectorFrontendHost.openInNewTab(resourceURL); } -WebInspector._registerShortcuts = function(panelDescriptors) +WebInspector._registerShortcuts = function() { var shortcut = WebInspector.KeyboardShortcut; var section = WebInspector.shortcutsScreen.section(WebInspector.UIString("All Panels")); var keys = [ - shortcut.shortcutToString("]", shortcut.Modifiers.CtrlOrMeta), - shortcut.shortcutToString("[", shortcut.Modifiers.CtrlOrMeta) + shortcut.makeDescriptor("]", shortcut.Modifiers.CtrlOrMeta), + shortcut.makeDescriptor("[", shortcut.Modifiers.CtrlOrMeta) ]; section.addRelatedKeys(keys, WebInspector.UIString("Go to the panel to the left/right")); var keys = [ - shortcut.shortcutToString("[", shortcut.Modifiers.CtrlOrMeta | shortcut.Modifiers.Alt), - shortcut.shortcutToString("]", shortcut.Modifiers.CtrlOrMeta | shortcut.Modifiers.Alt) + shortcut.makeDescriptor("[", shortcut.Modifiers.CtrlOrMeta | shortcut.Modifiers.Alt), + shortcut.makeDescriptor("]", shortcut.Modifiers.CtrlOrMeta | shortcut.Modifiers.Alt) ]; section.addRelatedKeys(keys, WebInspector.UIString("Go back/forward in panel history")); - section.addKey(shortcut.shortcutToString(shortcut.Keys.Esc), WebInspector.UIString("Toggle console")); - section.addKey(shortcut.shortcutToString("f", shortcut.Modifiers.CtrlOrMeta), WebInspector.UIString("Search")); + section.addKey(shortcut.makeDescriptor(shortcut.Keys.Esc), WebInspector.UIString("Toggle console")); + section.addKey(shortcut.makeDescriptor("f", shortcut.Modifiers.CtrlOrMeta), WebInspector.UIString("Search")); var advancedSearchShortcut = WebInspector.AdvancedSearchController.createShortcut(); - section.addKey(advancedSearchShortcut.name, WebInspector.UIString("Search across all sources")); + section.addKey(advancedSearchShortcut, WebInspector.UIString("Search across all sources")); var openResourceShortcut = WebInspector.KeyboardShortcut.makeDescriptor("o", WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta); - section.addKey(openResourceShortcut.name, WebInspector.UIString("Go to source")); + section.addKey(openResourceShortcut, WebInspector.UIString("Go to source")); if (WebInspector.isMac()) { keys = [ - shortcut.shortcutToString("g", shortcut.Modifiers.Meta), - shortcut.shortcutToString("g", shortcut.Modifiers.Meta | shortcut.Modifiers.Shift) + shortcut.makeDescriptor("g", shortcut.Modifiers.Meta), + shortcut.makeDescriptor("g", shortcut.Modifiers.Meta | shortcut.Modifiers.Shift) ]; section.addRelatedKeys(keys, WebInspector.UIString("Find next/previous")); } var goToShortcut = WebInspector.GoToLineDialog.createShortcut(); - section.addKey(goToShortcut.name, WebInspector.UIString("Go to line")); - - for (var i = 0; i < panelDescriptors.length; ++i) - panelDescriptors[i].panel(); + section.addKey(goToShortcut, WebInspector.UIString("Go to line")); } +/** + * @param {KeyboardEvent} event + */ WebInspector.documentKeyDown = function(event) { const helpKey = WebInspector.isMac() ? "U+003F" : "U+00BF"; // "?" for both platforms diff --git a/Source/WebCore/inspector/front-end/timelinePanel.css b/Source/WebCore/inspector/front-end/timelinePanel.css index de7cabe52..91471fdef 100644 --- a/Source/WebCore/inspector/front-end/timelinePanel.css +++ b/Source/WebCore/inspector/front-end/timelinePanel.css @@ -655,6 +655,7 @@ top: 90px; bottom: 0; pointer-events: none; + z-index: -100; } .timeline-cpu-bars { diff --git a/Source/WebCore/loader/archive/ArchiveFactory.cpp b/Source/WebCore/loader/archive/ArchiveFactory.cpp index 04fb5edb5..4ebb52bcf 100644 --- a/Source/WebCore/loader/archive/ArchiveFactory.cpp +++ b/Source/WebCore/loader/archive/ArchiveFactory.cpp @@ -70,6 +70,8 @@ static ArchiveMIMETypesMap& archiveMIMETypes() mimeTypes.set("multipart/related", archiveFactoryCreate<MHTMLArchive>); #if PLATFORM(GTK) mimeTypes.set("message/rfc822", archiveFactoryCreate<MHTMLArchive>); +#elif PLATFORM(QT) + mimeTypes.set("application/x-mimearchive", archiveFactoryCreate<MHTMLArchive>); #endif #endif diff --git a/Source/WebCore/page/DOMWindow.idl b/Source/WebCore/page/DOMWindow.idl index ef06190b7..db7c09d78 100644 --- a/Source/WebCore/page/DOMWindow.idl +++ b/Source/WebCore/page/DOMWindow.idl @@ -345,6 +345,10 @@ attribute WebKitCSSFilterValueConstructor WebKitCSSFilterValue; #endif +#if defined(ENABLE_CSS_DEVICE_ADAPTATION) && ENABLE_CSS_DEVICE_ADAPTATION + attribute WebKitCSSViewportRuleConstructor WebKitCSSViewportRule; +#endif + attribute CSSRuleConstructor CSSRule; attribute CSSCharsetRuleConstructor CSSCharsetRule; attribute CSSFontFaceRuleConstructor CSSFontFaceRule; @@ -554,7 +558,9 @@ attribute XMLHttpRequestProgressEventConstructor XMLHttpRequestProgressEvent; [Conditional=DEVICE_ORIENTATION, V8EnabledAtRuntime] attribute DeviceMotionEventConstructor DeviceMotionEvent; [Conditional=DEVICE_ORIENTATION, V8EnabledAtRuntime] attribute DeviceOrientationEventConstructor DeviceOrientationEvent; + [Conditional=TOUCH_EVENTS] attribute TouchConstructor Touch; [Conditional=TOUCH_EVENTS] attribute TouchEventConstructor TouchEvent; + [Conditional=TOUCH_EVENTS] attribute TouchListConstructor TouchList; attribute StorageEventConstructor StorageEvent; [Conditional=INPUT_SPEECH] attribute SpeechInputEventConstructor SpeechInputEvent; [Conditional=WEBGL] attribute WebGLContextEventConstructor WebGLContextEvent; diff --git a/Source/WebCore/page/Frame.cpp b/Source/WebCore/page/Frame.cpp index 4f73e785a..d16cf9480 100644 --- a/Source/WebCore/page/Frame.cpp +++ b/Source/WebCore/page/Frame.cpp @@ -40,7 +40,6 @@ #include "DOMWindow.h" #include "CachedResourceLoader.h" #include "DocumentType.h" -#include "EditingText.h" #include "EditorClient.h" #include "EventNames.h" #include "FloatQuad.h" @@ -1017,6 +1016,23 @@ void Frame::notifyChromeClientWheelEventHandlerCountChanged() const m_page->chrome()->client()->numWheelEventHandlersChanged(count); } +bool Frame::isURLAllowed(const KURL& url) const +{ + // We allow one level of self-reference because some sites depend on that, + // but we don't allow more than one. + if (m_page->subframeCount() >= Page::maxNumberOfFrames) + return false; + bool foundSelfReference = false; + for (const Frame* frame = this; frame; frame = frame->tree()->parent()) { + if (equalIgnoringFragmentIdentifier(frame->document()->url(), url)) { + if (foundSelfReference) + return false; + foundSelfReference = true; + } + } + return true; +} + #if !PLATFORM(MAC) && !PLATFORM(WIN) struct ScopedFramePaintingState { ScopedFramePaintingState(Frame* frame, Node* node) diff --git a/Source/WebCore/page/Frame.h b/Source/WebCore/page/Frame.h index 9c874ab88..7053eb240 100644 --- a/Source/WebCore/page/Frame.h +++ b/Source/WebCore/page/Frame.h @@ -202,6 +202,8 @@ namespace WebCore { // Should only be called on the main frame of a page. void notifyChromeClientWheelEventHandlerCountChanged() const; + bool isURLAllowed(const KURL&) const; + // ======== private: diff --git a/Source/WebCore/platform/MIMETypeRegistry.cpp b/Source/WebCore/platform/MIMETypeRegistry.cpp index 440b4299a..c5f31407c 100644 --- a/Source/WebCore/platform/MIMETypeRegistry.cpp +++ b/Source/WebCore/platform/MIMETypeRegistry.cpp @@ -491,6 +491,7 @@ String MIMETypeRegistry::getWellKnownMIMETypeForExtension(const String& extensio return findMimeType(commonMediaTypes, sizeof(commonMediaTypes) / sizeof(commonMediaTypes[0]), extension); } +#if !PLATFORM(QT) String MIMETypeRegistry::getMIMETypeForPath(const String& path) { size_t pos = path.reverseFind('.'); @@ -500,8 +501,9 @@ String MIMETypeRegistry::getMIMETypeForPath(const String& path) if (result.length()) return result; } - return "application/octet-stream"; + return defaultMIMEType(); } +#endif bool MIMETypeRegistry::isSupportedImageMIMEType(const String& mimeType) { @@ -638,6 +640,13 @@ const String& defaultMIMEType() return defaultMIMEType; } +#if !PLATFORM(QT) && !PLATFORM(BLACKBERRY) +String MIMETypeRegistry::getNormalizedMIMEType(const String& mimeType) +{ + return mimeType; +} +#endif + #if PLATFORM(BLACKBERRY) typedef HashMap<String, String> MIMETypeAssociationMap; @@ -696,18 +705,16 @@ static const MIMETypeAssociationMap& mimeTypeAssociationMap() return *mimeTypeMap; } -#endif String MIMETypeRegistry::getNormalizedMIMEType(const String& mimeType) { -#if PLATFORM(BLACKBERRY) MIMETypeAssociationMap::const_iterator it = mimeTypeAssociationMap().find(mimeType); if (it != mimeTypeAssociationMap().end()) return it->value; -#endif + return mimeType; } - +#endif } // namespace WebCore diff --git a/Source/WebCore/platform/PlatformWheelEvent.h b/Source/WebCore/platform/PlatformWheelEvent.h index b3ed0c5ab..ebb69ea2c 100644 --- a/Source/WebCore/platform/PlatformWheelEvent.h +++ b/Source/WebCore/platform/PlatformWheelEvent.h @@ -45,10 +45,6 @@ class wxMouseEvent; class wxPoint; #endif -#if PLATFORM(HAIKU) -class BMessage; -#endif - namespace WebCore { class FloatPoint; @@ -183,10 +179,6 @@ namespace WebCore { PlatformWheelEvent(const wxMouseEvent&, const wxPoint&); #endif -#if PLATFORM(HAIKU) - explicit PlatformWheelEvent(BMessage*); -#endif - protected: IntPoint m_position; IntPoint m_globalPosition; diff --git a/Source/WebCore/platform/graphics/filters/FilterOperation.h b/Source/WebCore/platform/graphics/filters/FilterOperation.h index 59bcd9707..fb9b67619 100644 --- a/Source/WebCore/platform/graphics/filters/FilterOperation.h +++ b/Source/WebCore/platform/graphics/filters/FilterOperation.h @@ -28,7 +28,6 @@ #if ENABLE(CSS_FILTERS) -#include "CachedSVGDocumentReference.h" #include "Color.h" #include "FilterEffect.h" #include "LayoutSize.h" @@ -42,6 +41,10 @@ #include <wtf/ThreadSafeRefCounted.h> #endif +#if ENABLE(SVG) +#include "CachedSVGDocumentReference.h" +#endif + // Annoyingly, wingdi.h #defines this. #ifdef PASSTHROUGH #undef PASSTHROUGH @@ -170,8 +173,10 @@ public: const String& url() const { return m_url; } const String& fragment() const { return m_fragment; } +#if ENABLE(SVG) CachedSVGDocumentReference* cachedSVGDocumentReference() const { return m_cachedSVGDocumentReference.get(); } void setCachedSVGDocumentReference(PassOwnPtr<CachedSVGDocumentReference> cachedSVGDocumentReference) { m_cachedSVGDocumentReference = cachedSVGDocumentReference; } +#endif FilterEffect* filterEffect() const { return m_filterEffect.get(); } void setFilterEffect(PassRefPtr<FilterEffect> filterEffect) { m_filterEffect = filterEffect; } @@ -195,7 +200,9 @@ private: String m_url; String m_fragment; +#if ENABLE(SVG) OwnPtr<CachedSVGDocumentReference> m_cachedSVGDocumentReference; +#endif RefPtr<FilterEffect> m_filterEffect; }; diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.cpp b/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.cpp index 59d2e05f9..0ced83611 100644 --- a/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.cpp +++ b/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.cpp @@ -96,7 +96,7 @@ void TextureMapperTiledBackingStore::updateContentsFromImageIfNeeded(TextureMapp if (!m_image) return; - updateContents(textureMapper, m_image.get(), BitmapTexture::UpdateCannotModifyOriginalImageData); + updateContents(textureMapper, m_image.get(), m_image->size(), m_image->rect(), BitmapTexture::UpdateCannotModifyOriginalImageData); m_image.clear(); } diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.h b/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.h index fbedc0418..a704ffd23 100644 --- a/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.h +++ b/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.h @@ -88,23 +88,22 @@ private: class TextureMapperTiledBackingStore : public TextureMapperBackingStore { public: - void updateContentsFromLayer(TextureMapper*, GraphicsLayer*, const IntRect&); + static PassRefPtr<TextureMapperTiledBackingStore> create() { return adoptRef(new TextureMapperTiledBackingStore); } virtual ~TextureMapperTiledBackingStore() { } - virtual void paintToTextureMapper(TextureMapper*, const FloatRect&, const TransformationMatrix&, float, BitmapTexture*); - virtual PassRefPtr<BitmapTexture> texture() const; + + virtual PassRefPtr<BitmapTexture> texture() const OVERRIDE; + virtual void paintToTextureMapper(TextureMapper*, const FloatRect&, const TransformationMatrix&, float, BitmapTexture*) OVERRIDE; void updateContents(TextureMapper*, Image*, const FloatSize&, const IntRect&, BitmapTexture::UpdateContentsFlag); - void updateContents(TextureMapper* textureMapper, Image* image, BitmapTexture::UpdateContentsFlag updateContentsFlag) { updateContents(textureMapper, image, image->size(), image->rect(), updateContentsFlag); } - inline FloatRect rect() const { return FloatRect(FloatPoint::zero(), m_size); } - static PassRefPtr<TextureMapperTiledBackingStore> create() { return adoptRef(new TextureMapperTiledBackingStore); } - void setContentsToImage(Image* image) { m_image = image; } - void updateContentsFromImageIfNeeded(TextureMapper*); + void setContentsToImage(Image* image) { m_image = image; } void setShowDebugBorders(bool drawsDebugBorders) { m_drawsDebugBorders = drawsDebugBorders; } void setDebugBorder(const Color&, float width); private: TextureMapperTiledBackingStore(); void createOrDestroyTilesIfNeeded(const FloatSize& backingStoreSize, const IntSize& tileSize, bool hasAlpha); + void updateContentsFromImageIfNeeded(TextureMapper*); + inline FloatRect rect() const { return FloatRect(FloatPoint::zero(), m_size); } Vector<TextureMapperTile> m_tiles; FloatSize m_size; diff --git a/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp b/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp index b83f2ba08..904e85983 100644 --- a/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp +++ b/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp @@ -32,6 +32,7 @@ #include <QDateTime> #include <QFile> #include <QFileInfo> +#include <QMimeDatabase> #include <QNetworkCookie> #include <QNetworkReply> @@ -581,8 +582,21 @@ void QNetworkReplyHandler::sendResponseIfNeeded() if (!suggestedFilename.isEmpty()) response.setSuggestedFilename(suggestedFilename); - else - response.setSuggestedFilename(url.lastPathComponent()); + else { + Vector<String> extensions = MIMETypeRegistry::getExtensionsForMIMEType(mimeType); + if (extensions.isEmpty()) + response.setSuggestedFilename(url.lastPathComponent()); + else { + // If the suffix doesn't match the MIME type, correct the suffix. + QString filename = url.lastPathComponent(); + const String suffix = QMimeDatabase().suffixForFileName(filename); + if (!extensions.contains(suffix)) { + filename.chop(suffix.length()); + filename += MIMETypeRegistry::getPreferredExtensionForMIMEType(mimeType); + } + response.setSuggestedFilename(filename); + } + } response.setHTTPStatusCode(statusCode); response.setHTTPStatusText(m_replyWrapper->reply()->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray().constData()); diff --git a/Source/WebCore/platform/qt/MIMETypeRegistryQt.cpp b/Source/WebCore/platform/qt/MIMETypeRegistryQt.cpp index bc5553aec..e45275e09 100644 --- a/Source/WebCore/platform/qt/MIMETypeRegistryQt.cpp +++ b/Source/WebCore/platform/qt/MIMETypeRegistryQt.cpp @@ -29,6 +29,7 @@ #include "config.h" #include "MIMETypeRegistry.h" +#include <QMimeDatabase> #include <wtf/Assertions.h> #include <wtf/MainThread.h> @@ -36,64 +37,37 @@ namespace WebCore { struct ExtensionMap { const char* extension; + const char* dotExtension; const char* mimeType; }; +// This is a short list of extensions not recognized by the freedesktop shared mimetype database 1.0. static const ExtensionMap extensionMap[] = { - { "bmp", "image/bmp" }, - { "css", "text/css" }, - { "gif", "image/gif" }, - { "html", "text/html" }, - { "htm", "text/html" }, - { "ico", "image/x-icon" }, - { "jpeg", "image/jpeg" }, - { "jpg", "image/jpeg" }, - { "js", "application/x-javascript" }, - { "mng", "video/x-mng" }, - { "mp4", "video/mp4" }, - { "m4v", "video/mp4" }, - { "m4a", "audio/x-m4a" }, - { "mht", "multipart/related" }, - { "mhtml", "multipart/related" }, - { "mp3", "audio/mp3" }, - { "ogv", "video/ogg" }, - { "oga", "audio/ogg" }, - { "ogm", "audio/ogg" }, - { "ogg", "audio/ogg" }, - { "webm", "video/webm" }, - { "webm", "audio/webm" }, - { "wav", "audio/wav" }, - { "mov", "video/quicktime" }, - { "pbm", "image/x-portable-bitmap" }, - { "pgm", "image/x-portable-graymap" }, - { "pdf", "application/pdf" }, - { "png", "image/png" }, - { "ppm", "image/x-portable-pixmap" }, - { "rss", "application/rss+xml" }, - { "svg", "image/svg+xml" }, - { "text", "text/plain" }, - { "tif", "image/tiff" }, - { "tiff", "image/tiff" }, - { "txt", "text/plain" }, - { "xbm", "image/x-xbitmap" }, - { "xml", "text/xml" }, - { "xpm", "image/x-xpm" }, - { "xsl", "text/xsl" }, - { "xhtml", "application/xhtml+xml" }, - { "wml", "text/vnd.wap.wml" }, - { "wmlc", "application/vnd.wap.wmlc" }, - { 0, 0 } + { "mht", ".mht", "application/x-mimearchive" }, + { "mhtml", ".mhtml", "application/x-mimearchive" }, + { "text", ".text", "text/plain" }, + { "wmlc", ".wmlc", "application/vnd.wap.wmlc" }, + { 0, 0, 0 } }; String MIMETypeRegistry::getMIMETypeForExtension(const String &ext) { - ASSERT(isMainThread()); + // QMimeDatabase lacks the ability to query by extension alone, so we create a fake filename to lookup. + String suffix = ext.lower(); + const QString filename = QStringLiteral("filename.") + QString(suffix); - String s = ext.lower(); + QMimeType mimeType = QMimeDatabase().mimeTypeForFile(filename, QMimeDatabase::MatchExtension); + if (mimeType.isValid() && !mimeType.isDefault()) { + // getMIMETypeForExtension is used for preload mimetype check, so image looking files can not be loaded as anything but images. + // Script looking files (.php) are loaded normally and will have their mimetype determined later. + if (mimeType.inherits(QStringLiteral("application/x-executable"))) + return String(); + return mimeType.name(); + } const ExtensionMap *e = extensionMap; while (e->extension) { - if (s == e->extension) + if (suffix == e->extension) return e->mimeType; ++e; } @@ -101,6 +75,54 @@ String MIMETypeRegistry::getMIMETypeForExtension(const String &ext) return String(); } +String MIMETypeRegistry::getMIMETypeForPath(const String& path) +{ + QMimeType type = QMimeDatabase().mimeTypeForFile(path, QMimeDatabase::MatchExtension); + if (type.isValid() && !type.isDefault()) + return type.name(); + + const ExtensionMap *e = extensionMap; + while (e->extension) { + if (path.endsWith(e->dotExtension)) + return e->mimeType; + ++e; + } + + return defaultMIMEType(); +} + +Vector<String> MIMETypeRegistry::getExtensionsForMIMEType(const String& mimeTypeName) +{ + Vector<String> extensions; + QMimeType mimeType = QMimeDatabase().mimeTypeForName(mimeTypeName); + if (mimeType.isValid() && !mimeType.isDefault()) { + Q_FOREACH(const QString& suffix, mimeType.suffixes()) { + extensions.append(suffix); + } + } + + return extensions; +} + +String MIMETypeRegistry::getPreferredExtensionForMIMEType(const String& mimeTypeName) +{ + QMimeType mimeType = QMimeDatabase().mimeTypeForName(mimeTypeName); + if (mimeType.isValid() && !mimeType.isDefault()) + return mimeType.preferredSuffix(); + + return String(); +} + +String MIMETypeRegistry::getNormalizedMIMEType(const String& mimeTypeName) +{ + // This looks up the mime type object by preferred name or alias, and returns the preferred name. + QMimeType mimeType = QMimeDatabase().mimeTypeForName(mimeTypeName); + if (mimeType.isValid() && !mimeType.isDefault()) + return mimeType.name(); + + return mimeTypeName; +} + bool MIMETypeRegistry::isApplicationPluginMIMEType(const String& mimeType) { return mimeType.startsWith("application/x-qt-plugin", false) diff --git a/Source/WebCore/platform/qt/QWebPageClient.h b/Source/WebCore/platform/qt/QWebPageClient.h index cda0b0f4d..ae3fb4e2f 100644 --- a/Source/WebCore/platform/qt/QWebPageClient.h +++ b/Source/WebCore/platform/qt/QWebPageClient.h @@ -91,7 +91,7 @@ public: virtual QPalette palette() const = 0; virtual int screenNumber() const = 0; - virtual QWidget* ownerWidget() const = 0; + virtual QObject* ownerWidget() const = 0; virtual QRect geometryRelativeToOwnerWidget() const = 0; virtual QObject* pluginParent() const = 0; diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp index 654d5ff83..6846aa90d 100644 --- a/Source/WebCore/rendering/RenderBox.cpp +++ b/Source/WebCore/rendering/RenderBox.cpp @@ -2208,25 +2208,27 @@ LayoutUnit RenderBox::computePercentageLogicalHeight(const Length& height) const if (isHorizontalWritingMode() != cb->isHorizontalWritingMode()) availableHeight = cb->contentLogicalWidth(); - else if (cb->isTableCell() && !skippedAutoHeightContainingBlock) { - // Table cells violate what the CSS spec says to do with heights. Basically we - // don't care if the cell specified a height or not. We just always make ourselves - // be a percentage of the cell's current content height. - if (!cb->hasOverrideHeight()) { - // Normally we would let the cell size intrinsically, but scrolling overflow has to be - // treated differently, since WinIE lets scrolled overflow regions shrink as needed. - // While we can't get all cases right, we can at least detect when the cell has a specified - // height or when the table has a specified height. In these cases we want to initially have - // no size and allow the flexing of the table or the cell to its specified height to cause us - // to grow to fill the space. This could end up being wrong in some cases, but it is - // preferable to the alternative (sizing intrinsically and making the row end up too big). - RenderTableCell* cell = toRenderTableCell(cb); - if (scrollsOverflowY() && (!cell->style()->logicalHeight().isAuto() || !cell->table()->style()->logicalHeight().isAuto())) - return 0; - return -1; + else if (cb->isTableCell()) { + if (!skippedAutoHeightContainingBlock) { + // Table cells violate what the CSS spec says to do with heights. Basically we + // don't care if the cell specified a height or not. We just always make ourselves + // be a percentage of the cell's current content height. + if (!cb->hasOverrideHeight()) { + // Normally we would let the cell size intrinsically, but scrolling overflow has to be + // treated differently, since WinIE lets scrolled overflow regions shrink as needed. + // While we can't get all cases right, we can at least detect when the cell has a specified + // height or when the table has a specified height. In these cases we want to initially have + // no size and allow the flexing of the table or the cell to its specified height to cause us + // to grow to fill the space. This could end up being wrong in some cases, but it is + // preferable to the alternative (sizing intrinsically and making the row end up too big). + RenderTableCell* cell = toRenderTableCell(cb); + if (scrollsOverflowY() && (!cell->style()->logicalHeight().isAuto() || !cell->table()->style()->logicalHeight().isAuto())) + return 0; + return -1; + } + availableHeight = cb->overrideLogicalContentHeight(); + includeBorderPadding = true; } - availableHeight = cb->overrideLogicalContentHeight(); - includeBorderPadding = true; } else if (cbstyle->logicalHeight().isFixed()) { LayoutUnit contentBoxHeightWithScrollbar = cb->adjustContentBoxLogicalHeightForBoxSizing(cbstyle->logicalHeight().value()); availableHeight = max<LayoutUnit>(0, contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight()); diff --git a/Source/WebCore/rendering/TextAutosizer.cpp b/Source/WebCore/rendering/TextAutosizer.cpp index 0a0791498..36067fd78 100644 --- a/Source/WebCore/rendering/TextAutosizer.cpp +++ b/Source/WebCore/rendering/TextAutosizer.cpp @@ -235,8 +235,6 @@ bool TextAutosizer::isAutosizingCluster(const RenderBlock* renderer) || renderer->isTableCaption() || renderer->isFlexibleBoxIncludingDeprecated() || renderer->hasColumns() - || renderer->style()->overflowX() != OVISIBLE - || renderer->style()->overflowY() != OVISIBLE || renderer->containingBlock()->isHorizontalWritingMode() != renderer->isHorizontalWritingMode(); // FIXME: Tables need special handling to multiply all their columns by // the same amount even if they're different widths; so do hasColumns() diff --git a/Source/WebCore/svg/SVGTRefElement.cpp b/Source/WebCore/svg/SVGTRefElement.cpp index ed48c3324..a8009a971 100644 --- a/Source/WebCore/svg/SVGTRefElement.cpp +++ b/Source/WebCore/svg/SVGTRefElement.cpp @@ -130,35 +130,6 @@ void SVGTRefTargetEventListener::handleEvent(ScriptExecutionContext*, Event* eve m_trefElement->detachTarget(); } -class SVGShadowText : public Text { -public: - static PassRefPtr<SVGShadowText> create(Document* document, const String& data) - { - return adoptRef(new SVGShadowText(document, data)); - } -private: - SVGShadowText(Document* document, const String& data) - : Text(document, data) - { - setHasCustomCallbacks(); - } - virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - virtual void willRecalcTextStyle(StyleChange); -}; - -RenderObject* SVGShadowText::createRenderer(RenderArena* arena, RenderStyle*) -{ - return new (arena) RenderSVGInlineText(this, dataImpl()); -} - -void SVGShadowText::willRecalcTextStyle(StyleChange change) -{ - if (change != NoChange && parentNode()->isShadowRoot()) { - if (renderer()) - renderer()->setStyle(toShadowRoot(parentNode())->host()->renderer()->style()); - } -} - inline SVGTRefElement::SVGTRefElement(const QualifiedName& tagName, Document* document) : SVGTextPositioningElement(tagName, document) , m_targetListener(SVGTRefTargetEventListener::create(this)) @@ -186,9 +157,11 @@ void SVGTRefElement::updateReferencedText(Element* target) ASSERT(shadow()); ShadowRoot* root = shadow()->oldestShadowRoot(); if (!root->firstChild()) - root->appendChild(SVGShadowText::create(document(), textContent), ASSERT_NO_EXCEPTION); - else + root->appendChild(Text::create(document(), textContent), ASSERT_NO_EXCEPTION); + else { + ASSERT(root->firstChild()->isTextNode()); root->firstChild()->setTextContent(textContent, ASSERT_NO_EXCEPTION); + } } void SVGTRefElement::detachTarget() diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog index 6f392306b..a66f05e98 100644 --- a/Source/WebKit/ChangeLog +++ b/Source/WebKit/ChangeLog @@ -1,3 +1,58 @@ +2012-11-22 Jeff Rogers <jrogers@rim.com> + + [BlackBerry] Update Web Notifications Implementation + https://bugs.webkit.org/show_bug.cgi?id=102621 + + Reviewed by George Staikos. + + Reviewed internally by George Staikos and Joe Mason. + Internal PR 172120 + Add new Notification files and remove obsolete ones. + + * PlatformBlackBerry.cmake: + +2012-11-22 Simon Hausmann <simon.hausmann@digia.com>, Pierre Rossi <pierre.rossi@digia.com> + + [Qt] Separate QWidget dependant code into separate WebKitWidgets static library + https://bugs.webkit.org/show_bug.cgi?id=102800 + + Reviewed by Tor Arne Vestbø. + + This patch separates code that needs to use QWidget related APIs in + WebKit/qt/WebCoreSupport and Api from code that doesn't. This means for + example FrameLoaderClientQt.cpp remains in the WebKit1 static library, + while qwebpage.cpp and qwebframe.cpp become part of the WebKitWidgets + static library. WebKit1 is compiled without QT += widgets and therefore + any widget related dependency has been moved "up" and out of WebKit1 into + the WebKitWidgets library. + + Between the code in WebKit.a and WebKitWidgets.a new adapters and + interfaces have been introduced, such as QWebPageAdapter and + QWebFrameAdapter. QWebPageAdapter, when used from WebKit1, is a way to + call out into the API layer, implemented by QWebPage (QWebPagePrivate). + The other way around if QWebPage wants to access WebCore or + WebCoreSupport related functionality, it will go through + QWebPageAdapater (as base class). The separation in the direction up + into the API layer is complete with this patch, no code in WebKit1 + depends on QtWidgets. The separation the other way around, code in the + API layer not using any WebCore types, is not complete yet. + + Some classes such as QWebSettings, QWebElement or + DumpRenderTreeSupportQt remain in WebKit1. While they are API layer, + they do not depend on widget related Qt APIs and they make much more + use of WebCore internal APIs and therefore are easier to keep in + WebKit1. + + In the future we plan to place a real shared library boundary between + WebKit1 and WebKitWidgets, by keeping the WebKit1 static library as + part of the QtWebKit shared library and by turning the WebKitWidgets + static library into a shared one. + + * WebKit1.pri: + * WebKit1.pro: + * WebKitWidgets.pri: Copied from Source/WebKit/WebKit1.pri. + * WebKitWidgets.pro: Added. + 2012-11-21 Kai Koehne <kai.koehne@digia.com> [Qt] MinGW: Don't add OpenGL library dependencies here diff --git a/Source/WebKit/PlatformBlackBerry.cmake b/Source/WebKit/PlatformBlackBerry.cmake index 96ad15021..d50b7e2e2 100644 --- a/Source/WebKit/PlatformBlackBerry.cmake +++ b/Source/WebKit/PlatformBlackBerry.cmake @@ -114,7 +114,7 @@ LIST(APPEND WebKit_SOURCES blackberry/WebCoreSupport/IconDatabaseClientBlackBerry.cpp blackberry/WebCoreSupport/InspectorClientBlackBerry.cpp blackberry/WebCoreSupport/NetworkInfoClientBlackBerry.cpp - blackberry/WebCoreSupport/NotificationPresenterImpl.cpp + blackberry/WebCoreSupport/NotificationClientBlackBerry.cpp blackberry/WebCoreSupport/PagePopupBlackBerry.cpp blackberry/WebCoreSupport/NavigatorContentUtilsClientBlackBerry.cpp blackberry/WebCoreSupport/SelectPopupClient.cpp @@ -132,6 +132,7 @@ LIST(APPEND WebKit_SOURCES blackberry/WebKitSupport/InputHandler.cpp blackberry/WebKitSupport/InRegionScrollableArea.cpp blackberry/WebKitSupport/InspectorOverlayBlackBerry.cpp + blackberry/WebKitSupport/NotificationManager.cpp blackberry/WebKitSupport/RenderQueue.cpp blackberry/WebKitSupport/SelectionHandler.cpp blackberry/WebKitSupport/SelectionOverlay.cpp diff --git a/Source/WebKit/WebKit1.pri b/Source/WebKit/WebKit1.pri index f988b4c6b..0297fcc92 100644 --- a/Source/WebKit/WebKit1.pri +++ b/Source/WebKit/WebKit1.pri @@ -18,16 +18,9 @@ enable?(DEVICE_ORIENTATION)|enable?(ORIENTATION_EVENTS) { enable?(GEOLOCATION): QT += location -use?(QT_MULTIMEDIA): QT *= multimediawidgets - contains(CONFIG, texmap): DEFINES += WTF_USE_TEXTURE_MAPPER=1 use?(PLUGIN_BACKEND_XLIB): PKGCONFIG += x11 -QT += network widgets -have?(QTQUICK): QT += quick -have?(QTPRINTSUPPORT): QT += printsupport +QT += network -use?(TEXTURE_MAPPER_GL)|enable?(WEBGL) { - QT *= opengl -} diff --git a/Source/WebKit/WebKit1.pro b/Source/WebKit/WebKit1.pro index 75d4d79de..fee99e885 100644 --- a/Source/WebKit/WebKit1.pro +++ b/Source/WebKit/WebKit1.pro @@ -15,30 +15,20 @@ QT += gui CONFIG += staticlib SOURCES += \ - $$PWD/qt/Api/qwebframe.cpp \ - $$PWD/qt/Api/qgraphicswebview.cpp \ - $$PWD/qt/Api/qwebpage.cpp \ - $$PWD/qt/Api/qwebview.cpp \ + $$PWD/qt/Api/qhttpheader.cpp \ + $$PWD/qt/Api/qwebdatabase.cpp \ $$PWD/qt/Api/qwebelement.cpp \ $$PWD/qt/Api/qwebhistory.cpp \ - $$PWD/qt/Api/qwebsettings.cpp \ $$PWD/qt/Api/qwebhistoryinterface.cpp \ - $$PWD/qt/Api/qwebplugindatabase.cpp \ $$PWD/qt/Api/qwebpluginfactory.cpp \ $$PWD/qt/Api/qwebsecurityorigin.cpp \ + $$PWD/qt/Api/qwebsettings.cpp \ $$PWD/qt/Api/qwebscriptworld.cpp \ - $$PWD/qt/Api/qwebdatabase.cpp \ - $$PWD/qt/Api/qwebinspector.cpp \ - $$PWD/qt/Api/qwebkitversion.cpp \ - $$PWD/qt/Api/qhttpheader.cpp \ - $$PWD/qt/WebCoreSupport/QtFallbackWebPopup.cpp \ - $$PWD/qt/WebCoreSupport/QtWebComboBox.cpp \ $$PWD/qt/WebCoreSupport/ChromeClientQt.cpp \ $$PWD/qt/WebCoreSupport/ContextMenuClientQt.cpp \ $$PWD/qt/WebCoreSupport/DragClientQt.cpp \ $$PWD/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp \ $$PWD/qt/WebCoreSupport/EditorClientQt.cpp \ - $$PWD/qt/WebCoreSupport/UndoStepQt.cpp \ $$PWD/qt/WebCoreSupport/FrameLoaderClientQt.cpp \ $$PWD/qt/WebCoreSupport/FrameNetworkingContextQt.cpp \ $$PWD/qt/WebCoreSupport/GeolocationPermissionClientQt.cpp \ @@ -46,67 +36,72 @@ SOURCES += \ $$PWD/qt/WebCoreSupport/InspectorClientQt.cpp \ $$PWD/qt/WebCoreSupport/InspectorServerQt.cpp \ $$PWD/qt/WebCoreSupport/NotificationPresenterClientQt.cpp \ - $$PWD/qt/WebCoreSupport/PageClientQt.cpp \ + $$PWD/qt/WebCoreSupport/PlatformStrategiesQt.cpp \ $$PWD/qt/WebCoreSupport/PopupMenuQt.cpp \ - $$PWD/qt/WebCoreSupport/QStyleFacadeImp.cpp \ $$PWD/qt/WebCoreSupport/QtPlatformPlugin.cpp \ + $$PWD/qt/WebCoreSupport/QWebFrameAdapter.cpp \ + $$PWD/qt/WebCoreSupport/QWebPageAdapter.cpp \ $$PWD/qt/WebCoreSupport/SearchPopupMenuQt.cpp \ $$PWD/qt/WebCoreSupport/TextCheckerClientQt.cpp \ - $$PWD/qt/WebCoreSupport/PlatformStrategiesQt.cpp \ + $$PWD/qt/WebCoreSupport/UndoStepQt.cpp \ $$PWD/qt/WebCoreSupport/WebEventConversion.cpp HEADERS += \ - $$PWD/qt/Api/qwebframe.h \ - $$PWD/qt/Api/qwebframe_p.h \ - $$PWD/qt/Api/qgraphicswebview.h \ - $$PWD/qt/Api/qwebkitglobal.h \ - $$PWD/qt/Api/qwebkitplatformplugin.h \ - $$PWD/qt/Api/qwebpage.h \ - $$PWD/qt/Api/qwebview.h \ - $$PWD/qt/Api/qwebsettings.h \ - $$PWD/qt/Api/qwebhistoryinterface.h \ + $$PWD/qt/Api/qhttpheader_p.h \ $$PWD/qt/Api/qwebdatabase.h \ - $$PWD/qt/Api/qwebsecurityorigin.h \ $$PWD/qt/Api/qwebelement.h \ $$PWD/qt/Api/qwebelement_p.h \ - $$PWD/qt/Api/qwebpluginfactory.h \ $$PWD/qt/Api/qwebhistory.h \ - $$PWD/qt/Api/qwebinspector.h \ - $$PWD/qt/Api/qwebkitversion.h \ - $$PWD/qt/Api/qwebplugindatabase_p.h \ - $$PWD/qt/Api/qhttpheader_p.h \ - $$PWD/qt/WebCoreSupport/InitWebCoreQt.h \ - $$PWD/qt/WebCoreSupport/InspectorServerQt.h \ - $$PWD/qt/WebCoreSupport/QtFallbackWebPopup.h \ - $$PWD/qt/WebCoreSupport/QtWebComboBox.h \ + $$PWD/qt/Api/qwebhistory_p.h \ + $$PWD/qt/Api/qwebhistoryinterface.h \ + $$PWD/qt/Api/qwebpluginfactory.h \ + $$PWD/qt/Api/qwebsecurityorigin.h \ + $$PWD/qt/Api/qwebsettings.h \ + $$PWD/qt/Api/qwebscriptworld_p.h \ + $$PWD/qt/WebCoreSupport/ChromeClientQt.h \ + $$PWD/qt/WebCoreSupport/ContextMenuClientQt.h \ + $$PWD/qt/WebCoreSupport/DragClientQt.h \ + $$PWD/qt/WebCoreSupport/EditorClientQt.h \ $$PWD/qt/WebCoreSupport/FrameLoaderClientQt.h \ $$PWD/qt/WebCoreSupport/FrameNetworkingContextQt.h \ $$PWD/qt/WebCoreSupport/GeolocationPermissionClientQt.h \ + $$PWD/qt/WebCoreSupport/InitWebCoreQt.h \ + $$PWD/qt/WebCoreSupport/InspectorClientQt.h \ + $$PWD/qt/WebCoreSupport/InspectorServerQt.h \ $$PWD/qt/WebCoreSupport/NotificationPresenterClientQt.h \ - $$PWD/qt/WebCoreSupport/PageClientQt.h \ + $$PWD/qt/WebCoreSupport/PlatformStrategiesQt.h \ $$PWD/qt/WebCoreSupport/PopupMenuQt.h \ - $$PWD/qt/WebCoreSupport/QStyleFacadeImp.h \ $$PWD/qt/WebCoreSupport/QtPlatformPlugin.h \ + $$PWD/qt/WebCoreSupport/QtPluginWidgetAdapter.h \ + $$PWD/qt/WebCoreSupport/QWebFrameAdapter.h \ + $$PWD/qt/WebCoreSupport/QWebPageAdapter.h \ $$PWD/qt/WebCoreSupport/SearchPopupMenuQt.h \ $$PWD/qt/WebCoreSupport/TextCheckerClientQt.h \ - $$PWD/qt/WebCoreSupport/PlatformStrategiesQt.h \ + $$PWD/qt/WebCoreSupport/UndoStepQt.h \ $$PWD/qt/WebCoreSupport/WebEventConversion.h -contains(QT_CONFIG,accessibility) { - SOURCES += $$PWD/qt/Api/qwebviewaccessible.cpp - HEADERS += $$PWD/qt/Api/qwebviewaccessible_p.h -} - INCLUDEPATH += \ - $$PWD/qt/Api \ $$PWD/qt/WebCoreSupport -enable?(VIDEO) { - !use?(QTKIT):!use?(GSTREAMER):use?(QT_MULTIMEDIA) { - HEADERS += $$PWD/qt/WebCoreSupport/FullScreenVideoWidget.h - SOURCES += $$PWD/qt/WebCoreSupport/FullScreenVideoWidget.cpp - } +use?(3D_GRAPHICS): WEBKIT += angle +enable?(GEOLOCATION) { + HEADERS += \ + $$PWD/qt/WebCoreSupport/GeolocationClientQt.h + SOURCES += \ + $$PWD/qt/WebCoreSupport/GeolocationClientQt.cpp +} + +enable?(ICONDATABASE) { + HEADERS += \ + $$PWD/../WebCore/loader/icon/IconDatabaseClient.h \ + $$PWD/qt/WebCoreSupport/IconDatabaseClientQt.h + + SOURCES += \ + $$PWD/qt/WebCoreSupport/IconDatabaseClientQt.cpp +} + +enable?(VIDEO) { use?(QTKIT) | use?(GSTREAMER) | use?(QT_MULTIMEDIA) { HEADERS += $$PWD/qt/WebCoreSupport/FullScreenVideoQt.h SOURCES += $$PWD/qt/WebCoreSupport/FullScreenVideoQt.cpp @@ -134,21 +129,4 @@ enable?(VIDEO) { } } -enable?(ICONDATABASE) { - HEADERS += \ - $$PWD/../WebCore/loader/icon/IconDatabaseClient.h \ - $$PWD/qt/WebCoreSupport/IconDatabaseClientQt.h - - SOURCES += \ - $$PWD/qt/WebCoreSupport/IconDatabaseClientQt.cpp -} - -enable?(GEOLOCATION) { - HEADERS += \ - $$PWD/qt/WebCoreSupport/GeolocationClientQt.h - SOURCES += \ - $$PWD/qt/WebCoreSupport/GeolocationClientQt.cpp -} - -use?(3D_GRAPHICS): WEBKIT += angle diff --git a/Source/WebKit/WebKitWidgets.pri b/Source/WebKit/WebKitWidgets.pri new file mode 100644 index 000000000..54c61485f --- /dev/null +++ b/Source/WebKit/WebKitWidgets.pri @@ -0,0 +1,33 @@ +# ------------------------------------------------------------------- +# This file contains shared rules used both when building WebKitWidgets +# itself, and by targets that use WebKitWidgets. +# +# See 'Tools/qmake/README' for an overview of the build system +# ------------------------------------------------------------------- + +SOURCE_DIR = $${ROOT_WEBKIT_DIR}/Source/WebKit + +INCLUDEPATH += \ + $$SOURCE_DIR/qt/Api \ + $$SOURCE_DIR/qt/WebCoreSupport \ + $$ROOT_WEBKIT_DIR/Source/WTF/wtf/qt + +enable?(DEVICE_ORIENTATION)|enable?(ORIENTATION_EVENTS) { + QT += sensors +} + +enable?(GEOLOCATION): QT += location + +use?(QT_MULTIMEDIA): QT *= multimediawidgets + +contains(CONFIG, texmap): DEFINES += WTF_USE_TEXTURE_MAPPER=1 + +use?(PLUGIN_BACKEND_XLIB): PKGCONFIG += x11 + +QT += network widgets +have?(QTQUICK): QT += quick +have?(QTPRINTSUPPORT): QT += printsupport + +use?(TEXTURE_MAPPER_GL)|enable?(WEBGL) { + QT *= opengl +} diff --git a/Source/WebKit/WebKitWidgets.pro b/Source/WebKit/WebKitWidgets.pro new file mode 100644 index 000000000..5ca754192 --- /dev/null +++ b/Source/WebKit/WebKitWidgets.pro @@ -0,0 +1,75 @@ +# ------------------------------------------------------------------- +# Target file for the WebKitWidgets static library +# +# See 'Tools/qmake/README' for an overview of the build system +# ------------------------------------------------------------------- + +TEMPLATE = lib +TARGET = WebKitWidgets + +include(WebKitWidgets.pri) + +WEBKIT += wtf javascriptcore webcore webkit1 +QT += gui + +CONFIG += staticlib + +SOURCES += \ + $$PWD/qt/Api/qgraphicswebview.cpp \ + $$PWD/qt/Api/qwebframe.cpp \ + $$PWD/qt/Api/qwebpage.cpp \ + $$PWD/qt/Api/qwebview.cpp \ + $$PWD/qt/Api/qwebplugindatabase.cpp \ + $$PWD/qt/Api/qwebinspector.cpp \ + $$PWD/qt/Api/qwebkitversion.cpp \ + $$PWD/qt/WebCoreSupport/QtFallbackWebPopup.cpp \ + $$PWD/qt/WebCoreSupport/QtWebComboBox.cpp \ + $$PWD/qt/WebCoreSupport/QWebUndoCommand.cpp \ + $$PWD/qt/WebCoreSupport/DefaultFullScreenVideoHandler.cpp \ + $$PWD/qt/WebCoreSupport/InitWebKitQt.cpp \ + $$PWD/qt/WebCoreSupport/InspectorClientWebPage.cpp \ + $$PWD/qt/WebCoreSupport/PageClientQt.cpp \ + $$PWD/qt/WebCoreSupport/QStyleFacadeImp.cpp \ + $$PWD/qt/WebCoreSupport/QGraphicsWidgetPluginImpl.cpp \ + $$PWD/qt/WebCoreSupport/QWidgetPluginImpl.cpp + +HEADERS += \ + $$PWD/qt/Api/qgraphicswebview.h \ + $$PWD/qt/Api/qwebframe.h \ + $$PWD/qt/Api/qwebframe_p.h \ + $$PWD/qt/Api/qwebkitglobal.h \ + $$PWD/qt/Api/qwebkitplatformplugin.h \ + $$PWD/qt/Api/qwebpage.h \ + $$PWD/qt/Api/qwebpage_p.h \ + $$PWD/qt/Api/qwebview.h \ + $$PWD/qt/Api/qwebinspector.h \ + $$PWD/qt/Api/qwebkitversion.h \ + $$PWD/qt/Api/qwebplugindatabase_p.h \ + $$PWD/qt/WebCoreSupport/InitWebKitQt.h \ + $$PWD/qt/WebCoreSupport/InspectorClientWebPage.h \ + $$PWD/qt/WebCoreSupport/DefaultFullScreenVideoHandler.h \ + $$PWD/qt/WebCoreSupport/QtFallbackWebPopup.h \ + $$PWD/qt/WebCoreSupport/QtWebComboBox.h \ + $$PWD/qt/WebCoreSupport/QWebUndoCommand.h \ + $$PWD/qt/WebCoreSupport/PageClientQt.h \ + $$PWD/qt/WebCoreSupport/QGraphicsWidgetPluginImpl.h \ + $$PWD/qt/WebCoreSupport/QStyleFacadeImp.h \ + $$PWD/qt/WebCoreSupport/QWidgetPluginImpl.h + +contains(QT_CONFIG, accessibility) { + SOURCES += $$PWD/qt/Api/qwebviewaccessible.cpp + HEADERS += $$PWD/qt/Api/qwebviewaccessible_p.h +} + +INCLUDEPATH += \ + $$PWD/qt/Api \ + $$PWD/qt/WebCoreSupport + +enable?(VIDEO) { + !use?(QTKIT):!use?(GSTREAMER):use?(QT_MULTIMEDIA) { + HEADERS += $$PWD/qt/WebCoreSupport/FullScreenVideoWidget.h + SOURCES += $$PWD/qt/WebCoreSupport/FullScreenVideoWidget.cpp + } +} + +use?(3D_GRAPHICS): WEBKIT += angle diff --git a/Source/WebKit/blackberry/Api/WebPage.cpp b/Source/WebKit/blackberry/Api/WebPage.cpp index bd372b961..aece95429 100644 --- a/Source/WebKit/blackberry/Api/WebPage.cpp +++ b/Source/WebKit/blackberry/Api/WebPage.cpp @@ -93,7 +93,7 @@ #include "NavigatorContentUtilsClientBlackBerry.h" #endif #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) -#include "NotificationPresenterImpl.h" +#include "NotificationClientBlackBerry.h" #endif #include "Page.h" #include "PageCache.h" @@ -429,6 +429,9 @@ WebPagePrivate::WebPagePrivate(WebPage* webPage, WebPageClient* client, const In , m_autofillManager(AutofillManager::create(this)) , m_documentStyleRecalcPostponed(false) , m_documentChildNeedsStyleRecalc(false) +#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) + , m_notificationManager(this) +#endif { static bool isInitialized = false; if (!isInitialized) { @@ -561,7 +564,7 @@ void WebPagePrivate::init(const BlackBerry::Platform::String& pageGroupName) #endif #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) - WebCore::provideNotification(m_page, NotificationPresenterImpl::instance()); + WebCore::provideNotification(m_page, new NotificationClientBlackBerry(this)); #endif #if ENABLE(NAVIGATOR_CONTENT_UTILS) @@ -5887,16 +5890,6 @@ BlackBerry::Platform::String WebPage::textHasAttribute(const BlackBerry::Platfor return ""; } -void WebPage::setAllowNotification(const BlackBerry::Platform::String& domain, bool allow) -{ -#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) - static_cast<NotificationPresenterImpl*>(NotificationPresenterImpl::instance())->onPermission(domain.c_str(), allow); -#else - UNUSED_PARAM(domain); - UNUSED_PARAM(allow); -#endif -} - void WebPage::setJavaScriptCanAccessClipboard(bool enabled) { d->m_page->settings()->setJavaScriptCanAccessClipboard(enabled); @@ -6160,5 +6153,51 @@ void WebPagePrivate::didComposite() InspectorInstrumentation::didComposite(m_page); } +void WebPage::updateNotificationPermission(const BlackBerry::Platform::String& requestId, bool allowed) +{ +#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) + d->notificationManager().updatePermission(requestId, allowed); +#else + UNUSED_PARAM(requestId); + UNUSED_PARAM(allowed); +#endif +} + +void WebPage::notificationClicked(const BlackBerry::Platform::String& notificationId) +{ +#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) + d->notificationManager().notificationClicked(notificationId); +#else + UNUSED_PARAM(notificationId); +#endif +} + +void WebPage::notificationClosed(const BlackBerry::Platform::String& notificationId) +{ +#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) + d->notificationManager().notificationClosed(notificationId); +#else + UNUSED_PARAM(notificationId); +#endif +} + +void WebPage::notificationError(const BlackBerry::Platform::String& notificationId) +{ +#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) + d->notificationManager().notificationError(notificationId); +#else + UNUSED_PARAM(notificationId); +#endif +} + +void WebPage::notificationShown(const BlackBerry::Platform::String& notificationId) +{ +#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) + d->notificationManager().notificationShown(notificationId); +#else + UNUSED_PARAM(notificationId); +#endif +} + } } diff --git a/Source/WebKit/blackberry/Api/WebPage.h b/Source/WebKit/blackberry/Api/WebPage.h index 2fe56ca31..fc75b0f9a 100644 --- a/Source/WebKit/blackberry/Api/WebPage.h +++ b/Source/WebKit/blackberry/Api/WebPage.h @@ -268,8 +268,6 @@ public: BlackBerry::Platform::String textHasAttribute(const BlackBerry::Platform::String& query) const; - void setAllowNotification(const BlackBerry::Platform::String& domain, bool allow); - Platform::WebContext webContext(TargetDetectionStrategy) const; typedef intptr_t BackForwardId; @@ -366,6 +364,12 @@ public: BlackBerry::Platform::String renderTreeAsText(); + void updateNotificationPermission(const BlackBerry::Platform::String& requestId, bool allowed); + void notificationClicked(const BlackBerry::Platform::String& notificationId); + void notificationClosed(const BlackBerry::Platform::String& notificationId); + void notificationError(const BlackBerry::Platform::String& notificationId); + void notificationShown(const BlackBerry::Platform::String& notificationId); + private: virtual ~WebPage(); diff --git a/Source/WebKit/blackberry/Api/WebPageClient.h b/Source/WebKit/blackberry/Api/WebPageClient.h index 69035ba1f..26ddf0918 100644 --- a/Source/WebKit/blackberry/Api/WebPageClient.h +++ b/Source/WebKit/blackberry/Api/WebPageClient.h @@ -267,6 +267,19 @@ public: virtual void requestUserMedia(const Platform::WebUserMediaRequest&) = 0; virtual void cancelUserMediaRequest(const Platform::WebUserMediaRequest&) = 0; virtual void updateFindStringResult(int numMatches, int currentIndex) = 0; + + // Match with NotificationClient::Permission. + enum Permission { + PermissionAllowed, // User has allowed notifications + PermissionNotAllowed, // User has not yet allowed + PermissionDenied // User has explicitly denied permission + }; + virtual void requestNotificationPermission(const BlackBerry::Platform::String& /*requestId*/, const BlackBerry::Platform::String& /*origin*/) = 0; + virtual Permission checkNotificationPermission(const BlackBerry::Platform::String& /*origin*/) = 0; + virtual void showNotification(const BlackBerry::Platform::String& /*notificationId*/, const BlackBerry::Platform::String& /*title*/, const BlackBerry::Platform::String& /*body*/, const BlackBerry::Platform::String& /*iconUrl*/, const BlackBerry::Platform::String& /*tag*/, const BlackBerry::Platform::String& /*origin*/) = 0; + virtual void cancelNotification(const BlackBerry::Platform::String& /*id*/) = 0; + virtual void clearNotifications(const std::vector<BlackBerry::Platform::String>& /*notificationIds*/) = 0; + virtual void notificationDestroyed(const BlackBerry::Platform::String& /*notificationId*/) = 0; }; } // namespace WebKit } // namespace BlackBerry diff --git a/Source/WebKit/blackberry/Api/WebPage_p.h b/Source/WebKit/blackberry/Api/WebPage_p.h index 9c0a26dcb..10a209e33 100644 --- a/Source/WebKit/blackberry/Api/WebPage_p.h +++ b/Source/WebKit/blackberry/Api/WebPage_p.h @@ -31,6 +31,9 @@ #include <EGL/egl.h> #endif #include "KURL.h" +#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) +#include "NotificationManager.h" +#endif #include "PageClientBlackBerry.h" #include "PlatformMouseEvent.h" #include "ScriptSourceCode.h" @@ -461,6 +464,10 @@ public: void willComposite(); void didComposite(); +#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) + NotificationManager& notificationManager() { return m_notificationManager; }; +#endif + WebPage* m_webPage; WebPageClient* m_client; WebCore::InspectorClientBlackBerry* m_inspectorClient; @@ -635,6 +642,11 @@ public: WebCore::IntPoint m_cachedHitTestContentPos; WebCore::HitTestResult m_cachedHitTestResult; + +#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) + NotificationManager m_notificationManager; +#endif + protected: virtual ~WebPagePrivate(); }; diff --git a/Source/WebKit/blackberry/ChangeLog b/Source/WebKit/blackberry/ChangeLog index ebd5d4673..4c00f23f4 100644 --- a/Source/WebKit/blackberry/ChangeLog +++ b/Source/WebKit/blackberry/ChangeLog @@ -1,3 +1,99 @@ +2012-11-23 Andrew Lo <anlo@rim.com> + + [BlackBerry] InputHandler::ensureFocusTextElementVisible incorrectly used y coordinate as x coordinate + https://bugs.webkit.org/show_bug.cgi?id=103091 + + Reviewed by Yong Li. + + Internally reviewed by Mike Fenton. + Internal PR249523 + Incorrectly used y coordinate as x coordinate in + InputHandler::ensureFocusTextElementVisible. + + * WebKitSupport/InputHandler.cpp: + (BlackBerry::WebKit::InputHandler::ensureFocusTextElementVisible): + +2012-11-22 Jeff Rogers <jrogers@rim.com> + + [BlackBerry] Update Web Notifications Implementation + https://bugs.webkit.org/show_bug.cgi?id=102621 + + Reviewed by George Staikos. + + Reviewed internally by George Staikos and Joe Mason + Internal PR 172120 + Add new notifications implementation for the BlackBerry port. Rename + existing class to match Client naming. Adds NotificationManager + implementation for managing notifications and permissions, and logic + for passing the notifications to the platform provider. + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::WebPagePrivate): + (BlackBerry::WebKit::WebPagePrivate::init): + (BlackBerry::WebKit::WebPage::updateNotificationPermission): + (WebKit): + (BlackBerry::WebKit::WebPage::notificationClicked): + (BlackBerry::WebKit::WebPage::notificationClosed): + (BlackBerry::WebKit::WebPage::notificationError): + (BlackBerry::WebKit::WebPage::notificationShown): + * Api/WebPage.h: + * Api/WebPageClient.h: + * Api/WebPage_p.h: + (WebPagePrivate): + (BlackBerry::WebKit::WebPagePrivate::notificationManager): + * WebCoreSupport/NotificationClientBlackBerry.cpp: Added. + (WebCore): + (WebCore::NotificationClientBlackBerry::NotificationClientBlackBerry): + (WebCore::NotificationClientBlackBerry::show): + (WebCore::NotificationClientBlackBerry::cancel): + (WebCore::NotificationClientBlackBerry::clearNotifications): + (WebCore::NotificationClientBlackBerry::notificationObjectDestroyed): + (WebCore::NotificationClientBlackBerry::notificationControllerDestroyed): + (WebCore::NotificationClientBlackBerry::requestPermission): + (WebCore::NotificationClientBlackBerry::cancelRequestsForPermission): + (WebCore::NotificationClientBlackBerry::checkPermission): + * WebCoreSupport/NotificationClientBlackBerry.h: Added. + (WebKit): + (WebCore): + (NotificationClientBlackBerry): + * WebCoreSupport/NotificationPresenterImpl.cpp: Removed. + * WebCoreSupport/NotificationPresenterImpl.h: Removed. + * WebKitSupport/NotificationManager.cpp: Added. + (WebKit): + (BlackBerry::WebKit::NotificationManager::NotificationManager): + (BlackBerry::WebKit::NotificationManager::~NotificationManager): + (BlackBerry::WebKit::NotificationManager::show): + (BlackBerry::WebKit::NotificationManager::cancel): + (BlackBerry::WebKit::NotificationManager::clearNotifications): + (BlackBerry::WebKit::NotificationManager::notificationObjectDestroyed): + (BlackBerry::WebKit::NotificationManager::requestPermission): + (BlackBerry::WebKit::NotificationManager::cancelRequestsForPermission): + (BlackBerry::WebKit::NotificationManager::checkPermission): + (BlackBerry::WebKit::NotificationManager::updatePermission): + (BlackBerry::WebKit::NotificationManager::notificationClicked): + (BlackBerry::WebKit::NotificationManager::notificationClosed): + (BlackBerry::WebKit::NotificationManager::notificationError): + (BlackBerry::WebKit::NotificationManager::notificationShown): + (BlackBerry::WebKit::NotificationManager::removeNotificationFromContextMap): + * WebKitSupport/NotificationManager.h: Added. + (WebKit): + (NotificationManager): + +2012-11-22 Mike Fenton <mifenton@rim.com> + + [BlackBerry] Guard against a lost focusedNode that input handler isn't yet informed of. + https://bugs.webkit.org/show_bug.cgi?id=103071 + + Reviewed by Rob Buis. + + Fix potential for a crash if input mode is active but + we can't get a focusedNode. + + Reviewed Internally by Gen Mak. + + * WebKitSupport/SelectionHandler.cpp: + (BlackBerry::WebKit::SelectionHandler::setCaretPosition): + 2012-11-21 Genevieve Mak <gmak@rim.com> [BlackBerry] Drop Synchronous Mouse Events diff --git a/Source/WebKit/blackberry/WebCoreSupport/NotificationClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/NotificationClientBlackBerry.cpp new file mode 100644 index 000000000..7780609ef --- /dev/null +++ b/Source/WebKit/blackberry/WebCoreSupport/NotificationClientBlackBerry.cpp @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "NotificationClientBlackBerry.h" + +#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) +#include "Notification.h" +#include "NotificationPermissionCallback.h" +#include "ScriptExecutionContext.h" +#include "VoidCallback.h" +#include "WebPage_p.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebCore { + +NotificationClientBlackBerry::NotificationClientBlackBerry(BlackBerry::WebKit::WebPagePrivate* webPagePrivate) + : m_webPagePrivate(webPagePrivate) +{ +} + +bool NotificationClientBlackBerry::show(Notification* notification) +{ + m_webPagePrivate->notificationManager().show(notification); + return true; +} + +void NotificationClientBlackBerry::cancel(Notification* notification) +{ + m_webPagePrivate->notificationManager().cancel(notification); +} + + +void NotificationClientBlackBerry::clearNotifications(ScriptExecutionContext* context) +{ + m_webPagePrivate->notificationManager().clearNotifications(context); +} + +void NotificationClientBlackBerry::notificationObjectDestroyed(Notification* notification) +{ + m_webPagePrivate->notificationManager().notificationObjectDestroyed(notification); +} + +void NotificationClientBlackBerry::notificationControllerDestroyed() +{ + delete this; +} + +void NotificationClientBlackBerry::requestPermission(ScriptExecutionContext* context, PassRefPtr<VoidCallback> callback) +{ + m_webPagePrivate->notificationManager().requestPermission(context, callback); +} + +void NotificationClientBlackBerry::requestPermission(ScriptExecutionContext* context, PassRefPtr<NotificationPermissionCallback> callback) +{ + m_webPagePrivate->notificationManager().requestPermission(context, callback); +} + +void NotificationClientBlackBerry::cancelRequestsForPermission(ScriptExecutionContext* context) +{ + m_webPagePrivate->notificationManager().cancelRequestsForPermission(context); +} + +NotificationClient::Permission NotificationClientBlackBerry::checkPermission(ScriptExecutionContext* context) +{ + return m_webPagePrivate->notificationManager().checkPermission(context); +} + +} + +#endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) diff --git a/Source/WebKit/blackberry/WebCoreSupport/NotificationClientBlackBerry.h b/Source/WebKit/blackberry/WebCoreSupport/NotificationClientBlackBerry.h new file mode 100644 index 000000000..ab4495d27 --- /dev/null +++ b/Source/WebKit/blackberry/WebCoreSupport/NotificationClientBlackBerry.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef NotificationClientBlackBerry_h +#define NotificationClientBlackBerry_h + +#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) +#include "NotificationClient.h" + +namespace BlackBerry { +namespace WebKit { +class WebPagePrivate; +} +} + +namespace WebCore { + +class NotificationClientBlackBerry : public NotificationClient { +public: + NotificationClientBlackBerry(BlackBerry::WebKit::WebPagePrivate*); + + virtual bool show(Notification*); + virtual void cancel(Notification*); + virtual void clearNotifications(ScriptExecutionContext*); + virtual void notificationObjectDestroyed(Notification*); + virtual void notificationControllerDestroyed(); +#if ENABLE(LEGACY_NOTIFICATIONS) + virtual void requestPermission(ScriptExecutionContext*, PassRefPtr<VoidCallback>); +#endif +#if ENABLE(NOTIFICATIONS) + virtual void requestPermission(ScriptExecutionContext*, PassRefPtr<NotificationPermissionCallback>); +#endif + virtual void cancelRequestsForPermission(ScriptExecutionContext*); + virtual Permission checkPermission(ScriptExecutionContext*); + +private: + BlackBerry::WebKit::WebPagePrivate* m_webPagePrivate; +}; + +} + +#endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) +#endif // NotificationClientBlackBerry_h diff --git a/Source/WebKit/blackberry/WebCoreSupport/NotificationPresenterImpl.cpp b/Source/WebKit/blackberry/WebCoreSupport/NotificationPresenterImpl.cpp deleted file mode 100644 index 8725d938e..000000000 --- a/Source/WebKit/blackberry/WebCoreSupport/NotificationPresenterImpl.cpp +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (C) 2011 Research In Motion Limited. All rights reserved. - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" -#include "NotificationPresenterImpl.h" - -#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) -#include <BlackBerryPlatformString.h> -#include <Event.h> -#include <Notification.h> -#include <NotificationPresenterBlackBerry.h> -#include <ScriptExecutionContext.h> -#include <UUID.h> - - -namespace WebCore { - -NotificationClient* NotificationPresenterImpl::instance() -{ - static NotificationPresenterImpl* s_instance = 0; - if (!s_instance) - s_instance = new NotificationPresenterImpl; - return s_instance; -} - -NotificationPresenterImpl::NotificationPresenterImpl() -{ - m_platformPresenter = adoptPtr(BlackBerry::Platform::NotificationPresenterBlackBerry::create(this)); -} - -NotificationPresenterImpl::~NotificationPresenterImpl() -{ -} - -bool NotificationPresenterImpl::show(Notification* notification) -{ - ASSERT(notification); - ASSERT(notification->scriptExecutionContext()); - RefPtr<Notification> n = notification; - if (m_notifications.contains(n)) - return false; - - if (checkPermission(notification->scriptExecutionContext()) != NotificationClient::PermissionAllowed) - return false; - - String uuid = createCanonicalUUIDString(); - m_notifications.add(n, uuid); - String message; - if (n->isHTML()) { - // FIXME: Load and display HTML content. - message = n->url().string(); - } else { - // FIXME: Strip the content into one line. - message = n->contents().title + ": " + n->contents().body; - } - - m_platformPresenter->show(uuid, message); - return true; -} - -void NotificationPresenterImpl::cancel(Notification* notification) -{ - ASSERT(notification); - RefPtr<Notification> n = notification; - - NotificationMap::iterator it = m_notifications.find(n); - if (it == m_notifications.end()) - return; - - m_platformPresenter->cancel(it->value); - m_notifications.remove(it); -} - -void NotificationPresenterImpl::notificationObjectDestroyed(Notification* notification) -{ - ASSERT(notification); - cancel(notification); -} - -void NotificationPresenterImpl::notificationControllerDestroyed() -{ -} - -void NotificationPresenterImpl::requestPermission(ScriptExecutionContext* context, PassRefPtr<VoidCallback> callback) -{ - ASSERT(context); - m_permissionRequests.add(context, callback); - m_platformPresenter->requestPermission(context->url().host()); -} - -void NotificationPresenterImpl::onPermission(const BlackBerry::Platform::String& domain, bool isAllowed) -{ - ASSERT(!domain.empty()); - PermissionRequestMap::iterator it = m_permissionRequests.begin(); - for (; it != m_permissionRequests.end(); ++it) { - if (it->key->url().host() != domain) - continue; - - if (isAllowed) { - m_allowedDomains.add(domain); - it->value->handleEvent(); - } else - m_allowedDomains.remove(domain); - - m_permissionRequests.remove(it); - return; - } -} - -void NotificationPresenterImpl::cancelRequestsForPermission(ScriptExecutionContext*) -{ - // Because we are using modal dialogs to request permission, it's impossible to cancel them. -} - -NotificationClient::Permission NotificationPresenterImpl::checkPermission(ScriptExecutionContext* context) -{ - ASSERT(context); - // FIXME: Should store the permission information into file permanently instead of in m_allowedDomains. - // The suggested place to do this is in m_platformPresenter->checkPermission(). - if (m_allowedDomains.contains(context->url().host())) - return NotificationClient::PermissionAllowed; - return NotificationClient::PermissionNotAllowed; -} - -// This function is called in platform side. -void NotificationPresenterImpl::notificationClicked(const BlackBerry::Platform::String& id) -{ - ASSERT(!id.empty()); - NotificationMap::iterator it = m_notifications.begin(); - for (; it != m_notifications.end(); ++it) { - if (it->value == id && it->key->scriptExecutionContext()) { - RefPtr<Notification> notification = it->key; - it->key->dispatchEvent(Event::create(eventNames().clickEvent, false, true)); - m_notifications.remove(notification); - return; - } - } -} - -} // namespace WebKit - -#endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) diff --git a/Source/WebKit/blackberry/WebCoreSupport/NotificationPresenterImpl.h b/Source/WebKit/blackberry/WebCoreSupport/NotificationPresenterImpl.h deleted file mode 100644 index 2d5e5204d..000000000 --- a/Source/WebKit/blackberry/WebCoreSupport/NotificationPresenterImpl.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (C) 2011 Research In Motion Limited. All rights reserved. - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef NotificationPresenterImpl_h -#define NotificationPresenterImpl_h - -#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) -#include <NotificationAckListener.h> -#include <NotificationClient.h> -#include <NotificationPresenterBlackBerry.h> -#include <wtf/HashMap.h> -#include <wtf/HashSet.h> -#include <wtf/OwnPtr.h> -#include <wtf/text/StringHash.h> - -namespace BlackBerry { -namespace Platform { -class String; -} -} - -namespace WebCore { - -class NotificationPresenterImpl : public WebCore::NotificationClient, public BlackBerry::Platform::NotificationAckListener { -public: - static NotificationClient* instance(); - virtual ~NotificationPresenterImpl(); - - // Requests that a notification be shown. - virtual bool show(WebCore::Notification*); - - // Requests that a notification that has already been shown be canceled. - virtual void cancel(WebCore::Notification*); - - // Informs the presenter that a WebCore::Notification object has been destroyed - // (such as by a page transition). The presenter may continue showing - // the notification, but must not attempt to call the event handlers. - virtual void notificationObjectDestroyed(WebCore::Notification*); - - virtual void notificationControllerDestroyed(); - - // Requests user permission to show desktop notifications from a particular - // script context. The callback parameter should be run when the user has - // made a decision. - virtual void requestPermission(WebCore::ScriptExecutionContext*, PassRefPtr<WebCore::VoidCallback>); - - // Cancel all outstanding requests for the ScriptExecutionContext. - virtual void cancelRequestsForPermission(WebCore::ScriptExecutionContext*); - - // Checks the current level of permission. - virtual Permission checkPermission(WebCore::ScriptExecutionContext*); - - // Interfaces inherited from NotificationAckListener. - virtual void notificationClicked(const BlackBerry::Platform::String& id); - virtual void onPermission(const BlackBerry::Platform::String& domain, bool isAllowed); - -private: - NotificationPresenterImpl(); - -private: - OwnPtr<BlackBerry::Platform::NotificationPresenterBlackBerry> m_platformPresenter; - - typedef HashMap<RefPtr<WebCore::Notification>, String> NotificationMap; - NotificationMap m_notifications; - - typedef HashMap<RefPtr<WebCore::ScriptExecutionContext>, RefPtr<WebCore::VoidCallback> > PermissionRequestMap; - PermissionRequestMap m_permissionRequests; - - HashSet<String> m_allowedDomains; -}; - -} // namespace WebKit - -#endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) -#endif // NotificationPresenterImpl_h diff --git a/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp b/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp index 3622e0adb..6a39aa5d5 100644 --- a/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp +++ b/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp @@ -1133,7 +1133,7 @@ void InputHandler::ensureFocusTextElementVisible(CaretScrollType scrollType) zoomScaleRequired = m_webPage->currentScale(); // Don't scale. // The scroll location we should go to given the zoom required, could be adjusted later. - WebCore::FloatPoint offset(selectionFocusRect.location().y() - m_webPage->scrollPosition().x(), selectionFocusRect.location().y() - m_webPage->scrollPosition().y()); + WebCore::FloatPoint offset(selectionFocusRect.location().x() - m_webPage->scrollPosition().x(), selectionFocusRect.location().y() - m_webPage->scrollPosition().y()); double inverseScale = zoomScaleRequired / m_webPage->currentScale(); WebCore::IntPoint destinationScrollLocation = WebCore::IntPoint(max(0, static_cast<int>(roundf(selectionFocusRect.location().x() - offset.x() / inverseScale))), max(0, static_cast<int>(roundf(selectionFocusRect.location().y() - offset.y() / inverseScale)))); diff --git a/Source/WebKit/blackberry/WebKitSupport/NotificationManager.cpp b/Source/WebKit/blackberry/WebKitSupport/NotificationManager.cpp new file mode 100644 index 000000000..098d4d343 --- /dev/null +++ b/Source/WebKit/blackberry/WebKitSupport/NotificationManager.cpp @@ -0,0 +1,231 @@ +/* + * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * 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. AND ITS CONTRIBUTORS ``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 ITS 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. + */ + +#include "config.h" +#include "NotificationManager.h" + +#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) +#include "UUID.h" +#include "UserGestureIndicator.h" +#include "WebPage_p.h" + +#include <BlackBerryPlatformString.h> + +#include <vector> + +using namespace WebCore; + +namespace BlackBerry { +namespace WebKit { + +NotificationManager::NotificationManager(WebPagePrivate* webPagePrivate) + : m_webPagePrivate(webPagePrivate) +{ +} + +NotificationManager::~NotificationManager() +{ +} + +bool NotificationManager::show(Notification* notification) +{ + String notificationID = createCanonicalUUIDString(); + m_notificationMap.set(notification, notificationID); + m_notificationIDMap.set(notificationID, notification); + + NotificationContextMap::iterator it = m_notificationContextMap.add(notification->scriptExecutionContext(), Vector<String>()).iterator; + it->second.append(notificationID); + + m_webPagePrivate->client()->showNotification(notificationID, notification->title(), notification->body(), notification->iconURL().string(), notification->tag(), notification->scriptExecutionContext()->securityOrigin()->toString()); + return true; +} + +void NotificationManager::cancel(Notification* notification) +{ + String notificationID = m_notificationMap.get(notification); + if (!notificationID) + return; + + m_webPagePrivate->client()->cancelNotification(notificationID); +} + +void NotificationManager::clearNotifications(ScriptExecutionContext* context) +{ + NotificationContextMap::iterator it = m_notificationContextMap.find(context); + if (it == m_notificationContextMap.end()) + return; + + Vector<String>& notificationIDs = it->second; + std::vector<BlackBerry::Platform::String> ids; + size_t count = notificationIDs.size(); + for (size_t i = 0; i < count; ++i) { + ids.push_back(notificationIDs[i]); + RefPtr<Notification> notification = m_notificationIDMap.take(notificationIDs[i]); + if (!notification) + continue; + + notification->finalize(); + m_notificationMap.remove(notification); + } + + m_webPagePrivate->client()->clearNotifications(ids); + m_notificationContextMap.remove(it); +} + +void NotificationManager::notificationObjectDestroyed(Notification* notification) +{ + String notificationID = m_notificationMap.take(notification); + if (!notificationID) + return; + + m_notificationIDMap.remove(notificationID); + removeNotificationFromContextMap(notificationID, notification); + m_webPagePrivate->client()->notificationDestroyed(notificationID); +} + +#if ENABLE(LEGACY_NOTIFICATIONS) +void NotificationManager::requestPermission(ScriptExecutionContext* context, PassRefPtr<VoidCallback> callback) +{ + SecurityOrigin* origin = context->securityOrigin(); + String requestID = createCanonicalUUIDString(); + m_originToIDMap.set(origin, requestID); + m_idToOriginMap.set(requestID, origin); + m_idToVoidCallbackMap.set(requestID, callback); + m_webPagePrivate->client()->requestNotificationPermission(requestID, origin->toString()); +} +#endif + +#if ENABLE(NOTIFICATIONS) +void NotificationManager::requestPermission(ScriptExecutionContext* context, PassRefPtr<NotificationPermissionCallback> callback) +{ + SecurityOrigin* origin = context->securityOrigin(); + String requestID = createCanonicalUUIDString(); + m_originToIDMap.set(origin, requestID); + m_idToOriginMap.set(requestID, origin); + m_idToCallbackMap.set(requestID, callback); + m_webPagePrivate->client()->requestNotificationPermission(requestID, origin->toString()); +} +#endif + +void NotificationManager::cancelRequestsForPermission(ScriptExecutionContext* context) +{ + SecurityOrigin* origin = context->securityOrigin(); + String requestID = m_originToIDMap.take(origin); + if (!requestID) + return; + + m_idToOriginMap.remove(requestID); +#if ENABLE(LEGACY_NOTIFICATIONS) + m_idToVoidCallbackMap.remove(requestID); +#endif +#if ENABLE(NOTIFICATIONS) + m_idToCallbackMap.remove(requestID); +#endif +} + +NotificationClient::Permission NotificationManager::checkPermission(ScriptExecutionContext* context) +{ + return static_cast<NotificationClient::Permission>(m_webPagePrivate->client()->checkNotificationPermission(context->securityOrigin()->toString())); +} + +void NotificationManager::updatePermission(const String& requestID, bool allowed) +{ + RefPtr<WebCore::SecurityOrigin> origin = m_idToOriginMap.take(requestID); + m_originToIDMap.remove(origin); + +#if ENABLE(LEGACY_NOTIFICATIONS) + RefPtr<VoidCallback> voidCallback = m_idToVoidCallbackMap.take(requestID); + if (voidCallback) { + voidCallback->handleEvent(); + return; + } +#endif + +#if ENABLE(NOTIFICATIONS) + RefPtr<NotificationPermissionCallback> callback = m_idToCallbackMap.take(requestID); + if (!callback) + return; + + callback->handleEvent(Notification::permissionString(allowed ? NotificationClient::PermissionAllowed : NotificationClient::PermissionDenied)); +#endif +} + +void NotificationManager::notificationClicked(const String& notificationID) +{ + RefPtr<Notification> notification = m_notificationIDMap.get(notificationID); + if (!notification) + return; + + // Indicate that this event is being dispatched in reaction to a user's interaction with a platform notification. + UserGestureIndicator indicator(DefinitelyProcessingUserGesture); + notification->dispatchClickEvent(); +} + +void NotificationManager::notificationClosed(const String& notificationID) +{ + RefPtr<Notification> notification = m_notificationIDMap.take(notificationID); + if (!notification) + return; + + m_notificationMap.remove(notification); + removeNotificationFromContextMap(notificationID, notification.get()); + notification->dispatchCloseEvent(); +} + +void NotificationManager::notificationError(const String& notificationID) +{ + RefPtr<Notification> notification = m_notificationIDMap.take(notificationID); + if (!notification) + return; + + notification->dispatchErrorEvent(); +} + +void NotificationManager::notificationShown(const String& notificationID) +{ + RefPtr<Notification> notification = m_notificationIDMap.get(notificationID); + if (!notification) + return; + + notification->dispatchShowEvent(); +} + +void NotificationManager::removeNotificationFromContextMap(const String& notificationID, Notification* notification) +{ + // This is a helper function for managing the hash maps. + NotificationContextMap::iterator it = m_notificationContextMap.find(notification->scriptExecutionContext()); + ASSERT(it != m_notificationContextMap.end()); + size_t index = it->second.find(notificationID); + ASSERT(index != notFound); + it->second.remove(index); + if (it->second.isEmpty()) + m_notificationContextMap.remove(it); +} + +} +} + +#endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) diff --git a/Source/WebKit/blackberry/WebKitSupport/NotificationManager.h b/Source/WebKit/blackberry/WebKitSupport/NotificationManager.h new file mode 100644 index 000000000..76d0eb697 --- /dev/null +++ b/Source/WebKit/blackberry/WebKitSupport/NotificationManager.h @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * 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. AND ITS CONTRIBUTORS ``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 ITS 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. + */ + +#ifndef NotificationManager_h +#define NotificationManager_h + +#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) +#include "Notification.h" +#include "NotificationClient.h" +#include "NotificationPermissionCallback.h" +#include "ScriptExecutionContext.h" +#include "SecurityOrigin.h" +#include "VoidCallback.h" +#include <wtf/HashMap.h> +#include <wtf/RefPtr.h> +#include <wtf/Vector.h> + +namespace BlackBerry { +namespace WebKit { +class WebPagePrivate; + +class NotificationManager { +public: + NotificationManager(WebPagePrivate*); + ~NotificationManager(); + + bool show(WebCore::Notification*); + void cancel(WebCore::Notification*); + void clearNotifications(WebCore::ScriptExecutionContext*); + void notificationObjectDestroyed(WebCore::Notification*); +#if ENABLE(LEGACY_NOTIFICATIONS) + void requestPermission(WebCore::ScriptExecutionContext*, PassRefPtr<WebCore::VoidCallback>); +#endif +#if ENABLE(NOTIFICATIONS) + void requestPermission(WebCore::ScriptExecutionContext*, PassRefPtr<WebCore::NotificationPermissionCallback>); +#endif + void cancelRequestsForPermission(WebCore::ScriptExecutionContext*); + WebCore::NotificationClient::Permission checkPermission(WebCore::ScriptExecutionContext*); + + void updatePermission(const String& requestID, bool allowed); + + void notificationClicked(const String& notificationID); + void notificationClosed(const String& notificationID); + void notificationError(const String& notificationID); + void notificationShown(const String& notificationID); + +private: + void removeNotificationFromContextMap(const String& notificationID, WebCore::Notification*); + + WebPagePrivate* m_webPagePrivate; + typedef HashMap<RefPtr<WebCore::Notification>, String> NotificationMap; + NotificationMap m_notificationMap; + + typedef HashMap<String, RefPtr<WebCore::Notification> > NotificationIdMap; + NotificationIdMap m_notificationIDMap; + + typedef HashMap<RefPtr<WebCore::ScriptExecutionContext>, Vector<String> > NotificationContextMap; + NotificationContextMap m_notificationContextMap; + +#if ENABLE(NOTIFICATIONS) + typedef HashMap<String, RefPtr<WebCore::NotificationPermissionCallback> > PermissionCallbackMap; + PermissionCallbackMap m_idToCallbackMap; +#endif +#if ENABLE(LEGACY_NOTIFICATIONS) + typedef HashMap<String, RefPtr<WebCore::VoidCallback> > VoidCallbackMap; + VoidCallbackMap m_idToVoidCallbackMap; +#endif + typedef HashMap<RefPtr<WebCore::SecurityOrigin>, String> OriginMap; + OriginMap m_originToIDMap; + + typedef HashMap<String, RefPtr<WebCore::SecurityOrigin> > OriginIdMap; + OriginIdMap m_idToOriginMap; +}; + +} +} + +#endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) +#endif // NotificationManager_h diff --git a/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp b/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp index 1b89071ac..587b904de 100644 --- a/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp +++ b/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp @@ -234,7 +234,7 @@ bool SelectionHandler::shouldUpdateSelectionOrCaretForPoint(const WebCore::IntPo void SelectionHandler::setCaretPosition(const WebCore::IntPoint &position) { - if (!m_webPage->m_inputHandler->isInputMode()) + if (!m_webPage->m_inputHandler->isInputMode() || !m_webPage->focusedOrMainFrame()->document()->focusedNode()) return; m_caretActive = true; diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog index d4d3171f0..d1cf5e0f8 100644 --- a/Source/WebKit/chromium/ChangeLog +++ b/Source/WebKit/chromium/ChangeLog @@ -1,3 +1,71 @@ +2012-11-23 Yury Semikhatsky <yurys@chromium.org> + + Unreviewed. Fix Chromium Win compilation after r135580. + https://bugs.webkit.org/show_bug.cgi?id=101772 + + * tests/WebFrameTest.cpp: + +2012-11-23 Sami Kyostila <skyostil@chromium.org> + + [chromium] Remove WebScreenInfo.{horizontal,vertical}DPI + https://bugs.webkit.org/show_bug.cgi?id=101772 + + Reviewed by Adam Barth. + + Now that nothing is using WebScreenInfo.{horizontal,vertical}DPI we can simply + remove them. + + * src/mac/WebScreenInfoFactory.mm: + (WebKit::WebScreenInfoFactory::screenInfo): + * src/win/WebScreenInfoFactory.cpp: + (WebKit::WebScreenInfoFactory::screenInfo): + * src/x11/WebScreenInfoFactory.cpp: + (WebKit::WebScreenInfoFactory::screenInfo): + +2012-11-22 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-11-22 Dana Jansens <danakj@chromium.org> + + [chromium] Add OS!="ios" to guard for gcc_version in WebKit.gyp + https://bugs.webkit.org/show_bug.cgi?id=103007 + + Reviewed by Adam Barth. + + This matches the guards used in chromium's chrome/chrome_browser.gypi. + + * WebKit.gyp: + +2012-11-22 Stephen Chenney <schenney@chromium.org> + + [Chromium]: Removing gyp flags controlling Skia features. + + Unreviewed, pre-tested rendering changes that have been waiting for a chance to rebaseline tests. + + Enabled fixes for test rendering, and fast patsh for anti-aliased primitives. + + * skia_webkit.gyp: + +2012-11-22 Dan Carney <dcarney@google.com> + + IDBRequestTest needs a v8 context + https://bugs.webkit.org/show_bug.cgi?id=102941 + + Reviewed by Jochen Eisinger. + + Added v8 context to IDBRequestTest tests. + + * tests/IDBRequestTest.cpp: + (IDBRequestTest): + (WebKit::IDBRequestTest::IDBRequestTest): + (WebKit::IDBRequestTest::context): + (WebKit::IDBRequestTest::scriptExecutionContext): + (WebKit): + (WebKit::TEST_F): + 2012-11-21 Tien-Ren Chen <trchen@chromium.org> [chromium] Device scale factor should be no-op when applyDeviceScaleFactorInCompositor == 0 diff --git a/Source/WebKit/chromium/DEPS b/Source/WebKit/chromium/DEPS index 222eb8b45..31ff1844f 100644 --- a/Source/WebKit/chromium/DEPS +++ b/Source/WebKit/chromium/DEPS @@ -32,7 +32,7 @@ vars = { 'chromium_svn': 'http://src.chromium.org/svn/trunk/src', - 'chromium_rev': '169021' + 'chromium_rev': '169306' } deps = { diff --git a/Source/WebKit/chromium/WebKit.gyp b/Source/WebKit/chromium/WebKit.gyp index 0dd53bfa3..92afddaa0 100644 --- a/Source/WebKit/chromium/WebKit.gyp +++ b/Source/WebKit/chromium/WebKit.gyp @@ -720,6 +720,7 @@ 'tests/FakeWebPlugin.cpp', 'tests/FrameTestHelpers.cpp', 'tests/IDBBindingUtilitiesTest.cpp', + 'tests/IDBRequestTest.cpp', 'tests/LevelDBTest.cpp', 'tests/ListenerLeakTest.cpp', 'tests/LinkHighlightTest.cpp', @@ -1077,7 +1078,7 @@ }, ], # targets 'conditions': [ - ['os_posix==1 and OS!="mac" and gcc_version>=46', { + ['os_posix==1 and OS!="mac" and OS!="ios" and gcc_version>=46', { 'target_defaults': { # Disable warnings about c++0x compatibility, as some names (such # as nullptr) conflict with upcoming c++0x types. diff --git a/Source/WebKit/chromium/skia_webkit.gyp b/Source/WebKit/chromium/skia_webkit.gyp index 14a740d0c..0ecb0efb0 100644 --- a/Source/WebKit/chromium/skia_webkit.gyp +++ b/Source/WebKit/chromium/skia_webkit.gyp @@ -37,19 +37,8 @@ 'type': 'none', 'direct_dependent_settings': { 'defines': [ - # temporary for landing Skia rev 3077 with minimal layout test breakage - 'SK_SIMPLE_TWOCOLOR_VERTICAL_GRADIENTS', - - # Temporarily disable the Skia fix in - # http://code.google.com/p/skia/source/detail?r=3037 ; enabling that - # fix will require substantial rebaselining. - 'SK_DRAW_POS_TEXT_IGNORE_SUBPIXEL_LEFT_ALIGN_FIX', - - # Temporarily ignore fix to antialias coverage, until we can rebaseline - 'SK_USE_LEGACY_AA_COVERAGE', - - # When enabled yields a 10x speedup on some devices. - 'SK_DISABLE_FAST_AA_STROKE_RECT', + # Place defines here that require significant WebKit rebaselining, or that + # are otherwise best removed in WebKit and then rolled into Chromium. ], }, }, diff --git a/Source/WebKit/chromium/src/mac/WebScreenInfoFactory.mm b/Source/WebKit/chromium/src/mac/WebScreenInfoFactory.mm index 003c8eb6e..157c23192 100644 --- a/Source/WebKit/chromium/src/mac/WebScreenInfoFactory.mm +++ b/Source/WebKit/chromium/src/mac/WebScreenInfoFactory.mm @@ -95,11 +95,7 @@ WebScreenInfo WebScreenInfoFactory::screenInfo(NSView* view) WebScreenInfo results; - float deviceDPI = 160 * deviceScaleFactor(view); - results.horizontalDPI = deviceDPI; - results.verticalDPI = deviceDPI; results.deviceScaleFactor = static_cast<int>(deviceScaleFactor(view)); - results.depth = NSBitsPerPixelFromDepth([screen depth]); results.depthPerComponent = NSBitsPerSampleFromDepth([screen depth]); results.isMonochrome = diff --git a/Source/WebKit/chromium/src/win/WebScreenInfoFactory.cpp b/Source/WebKit/chromium/src/win/WebScreenInfoFactory.cpp index 5a6c11214..e2bcd23a2 100644 --- a/Source/WebKit/chromium/src/win/WebScreenInfoFactory.cpp +++ b/Source/WebKit/chromium/src/win/WebScreenInfoFactory.cpp @@ -65,8 +65,7 @@ WebScreenInfo WebScreenInfoFactory::screenInfo(HWND window) ASSERT(hdc); WebScreenInfo results; - results.horizontalDPI = GetDeviceCaps(hdc, LOGPIXELSX); - results.verticalDPI = GetDeviceCaps(hdc, LOGPIXELSY); + // FIXME: Initialize the device scale factor. results.depth = devMode.dmBitsPerPel; results.depthPerComponent = devMode.dmBitsPerPel / 3; // Assumes RGB results.isMonochrome = devMode.dmColor == DMCOLOR_MONOCHROME; diff --git a/Source/WebKit/chromium/src/x11/WebScreenInfoFactory.cpp b/Source/WebKit/chromium/src/x11/WebScreenInfoFactory.cpp index b6afa458b..49f3a96a5 100644 --- a/Source/WebKit/chromium/src/x11/WebScreenInfoFactory.cpp +++ b/Source/WebKit/chromium/src/x11/WebScreenInfoFactory.cpp @@ -44,7 +44,6 @@ namespace WebKit { // function, but it appears to return stale data after the screen is resized. WebScreenInfo WebScreenInfoFactory::screenInfo(Display* display, int screenNumber) { - const float inchesPerMillimeter = 25.4; // XDisplayWidth() and XDisplayHeight() return cached values. To ensure that // we return the correct dimensions after the screen is resized, query the // root window's geometry each time. @@ -56,14 +55,8 @@ WebScreenInfo WebScreenInfoFactory::screenInfo(Display* display, int screenNumbe display, root, &rootRet, &x, &y, &width, &height, &border, &depth); WebScreenInfo results; - int displayWidth = DisplayWidth(display, screenNumber); - int displayWidthInMillimeters = DisplayWidthMM(display, screenNumber); - results.horizontalDPI = static_cast<int>(inchesPerMillimeter * displayWidth / displayWidthInMillimeters); - - int displayHeight = DisplayHeight(display, screenNumber); - int displayHeightInMillimeters = DisplayHeightMM(display, screenNumber); - results.verticalDPI = static_cast<int>(inchesPerMillimeter * displayHeight / displayHeightInMillimeters); + // FIXME: Initialize the device scale factor. // FIXME: Not all screens use 8bpp. results.depthPerComponent = 8; results.depth = depth; diff --git a/Source/WebKit/chromium/tests/IDBRequestTest.cpp b/Source/WebKit/chromium/tests/IDBRequestTest.cpp index 27f6c1e6b..a0734e14c 100644 --- a/Source/WebKit/chromium/tests/IDBRequestTest.cpp +++ b/Source/WebKit/chromium/tests/IDBRequestTest.cpp @@ -28,23 +28,64 @@ #include "IDBRequest.h" #include "DOMStringList.h" +#include "Document.h" +#include "Frame.h" +#include "FrameTestHelpers.h" #include "IDBCursorBackendInterface.h" #include "IDBDatabaseBackendImpl.h" #include "IDBTransactionCoordinator.h" +#include "WebFrame.h" +#include "WebFrameImpl.h" +#include "WebView.h" #include <gtest/gtest.h> #if ENABLE(INDEXED_DATABASE) using namespace WebCore; +using namespace WebKit; namespace { -TEST(IDBRequestTest, EventsAfterStopping) +class IDBRequestTest : public testing::Test { +public: + IDBRequestTest() + : m_webView(0) + { + } + + void SetUp() OVERRIDE + { + m_webView = FrameTestHelpers::createWebViewAndLoad("about:blank"); + m_webView->setFocus(true); + } + + void TearDown() OVERRIDE + { + m_webView->close(); + } + + v8::Handle<v8::Context> context() + { + return static_cast<WebFrameImpl*>(m_webView->mainFrame())->frame()->script()->mainWorldContext(); + } + + ScriptExecutionContext* scriptExecutionContext() + { + return static_cast<WebFrameImpl*>(m_webView->mainFrame())->frame()->document(); + } + +private: + WebView* m_webView; +}; + +TEST_F(IDBRequestTest, EventsAfterStopping) { - ScriptExecutionContext* context = 0; + v8::HandleScope handleScope; + v8::Context::Scope scope(context()); + IDBTransaction* transaction = 0; - RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::createInvalid(), transaction); + RefPtr<IDBRequest> request = IDBRequest::create(scriptExecutionContext(), IDBAny::createInvalid(), transaction); EXPECT_EQ(request->readyState(), "pending"); request->stop(); @@ -59,11 +100,13 @@ TEST(IDBRequestTest, EventsAfterStopping) request->onSuccess(IDBKey::createInvalid(), IDBKey::createInvalid(), SerializedScriptValue::nullValue()); } -TEST(IDBRequestTest, AbortErrorAfterAbort) +TEST_F(IDBRequestTest, AbortErrorAfterAbort) { - ScriptExecutionContext* context = 0; + v8::HandleScope handleScope; + v8::Context::Scope scope(context()); + IDBTransaction* transaction = 0; - RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::createInvalid(), transaction); + RefPtr<IDBRequest> request = IDBRequest::create(scriptExecutionContext(), IDBAny::createInvalid(), transaction); EXPECT_EQ(request->readyState(), "pending"); // Simulate the IDBTransaction having received onAbort from back end and aborting the request: diff --git a/Source/WebKit/chromium/tests/WebFrameTest.cpp b/Source/WebKit/chromium/tests/WebFrameTest.cpp index f503541f5..29e0f0b6c 100644 --- a/Source/WebKit/chromium/tests/WebFrameTest.cpp +++ b/Source/WebKit/chromium/tests/WebFrameTest.cpp @@ -293,7 +293,7 @@ TEST_F(WebFrameTest, ScaleFactorShouldNotOscillate) registerMockedHttpURLLoad("scale_oscillate.html"); FixedLayoutTestWebViewClient client; - client.m_screenInfo.horizontalDPI = 212; + client.m_screenInfo.deviceScaleFactor = static_cast<float>(1.325); int viewportWidth = 800; int viewportHeight = 1057; diff --git a/Source/WebKit/gtk/ChangeLog b/Source/WebKit/gtk/ChangeLog index 23dbf3d49..a218eed75 100644 --- a/Source/WebKit/gtk/ChangeLog +++ b/Source/WebKit/gtk/ChangeLog @@ -1,3 +1,15 @@ +2012-09-26 Gustavo Noronha Silva <gns@gnome.org> + + [GTK] Split SVG from WebCore to work-around make limitation + https://bugs.webkit.org/show_bug.cgi?id=97735 + + Reviewed by Carlos Garcia Campos. + + Add a new libtool convenience library, libWebCoreSVG.la, to work-around + make limitation when linking libWebCore. + + * GNUmakefile.am: link libWebCoreSVG.la into libwebkitgtk. + 2012-11-21 Allan Sandfeld Jensen <allan.jensen@digia.com> Disambiguate innerNodeFramePoint and mainFramePoint diff --git a/Source/WebKit/gtk/GNUmakefile.am b/Source/WebKit/gtk/GNUmakefile.am index 866bba2e4..ba097d0c2 100644 --- a/Source/WebKit/gtk/GNUmakefile.am +++ b/Source/WebKit/gtk/GNUmakefile.am @@ -76,12 +76,19 @@ libwebkitgtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_LDFL $(version_script) \ $(no_undefined) -libwebkitgtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_LIBADD = \ +libwebkitgtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_LIBADD := \ -lpthread \ libWebCore.la \ libWebCorePlatform.la \ libWebCoreModules.la \ - libWebCoreGtk.la \ + libWebCoreGtk.la + +if ENABLE_SVG +libwebkitgtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_LIBADD += \ + libWebCoreSVG.la +endif + +libwebkitgtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_LIBADD += \ libjavascriptcoregtk-@WEBKITGTK_API_MAJOR_VERSION@.@WEBKITGTK_API_MINOR_VERSION@.la \ $(CAIRO_LIBS) \ $(CLUTTER_LIBS) \ diff --git a/Source/WebKit/qt/Api/qgraphicswebview.cpp b/Source/WebKit/qt/Api/qgraphicswebview.cpp index ef42c9518..84b4e801b 100644 --- a/Source/WebKit/qt/Api/qgraphicswebview.cpp +++ b/Source/WebKit/qt/Api/qgraphicswebview.cpp @@ -88,7 +88,7 @@ public: PageClientQGraphicsWidget* pageClient() const { - return static_cast<WebCore::PageClientQGraphicsWidget*> (page->d->client.get()); + return static_cast<WebCore::PageClientQGraphicsWidget*> (page->d->client.data()); } }; @@ -468,7 +468,7 @@ void QGraphicsWebViewPrivate::detachCurrentPage() return; page->d->view = 0; - page->d->client = nullptr; + page->d->client.reset(); // if the page was created by us, we own it and need to // destroy it as well. @@ -501,7 +501,7 @@ void QGraphicsWebView::setPage(QWebPage* page) if (!d->page) return; - d->page->d->client = adoptPtr(new PageClientQGraphicsWidget(this, page)); + d->page->d->client.reset(new PageClientQGraphicsWidget(this, page)); if (d->overlay()) d->overlay()->prepareGraphicsItemGeometryChange(); diff --git a/Source/WebKit/qt/Api/qwebelement.cpp b/Source/WebKit/qt/Api/qwebelement.cpp index 108b9b06f..82f579d95 100644 --- a/Source/WebKit/qt/Api/qwebelement.cpp +++ b/Source/WebKit/qt/Api/qwebelement.cpp @@ -39,6 +39,7 @@ #include "JSHTMLElement.h" #include "JSObject.h" #include "PropertyNameArray.h" +#include <QWebFrameAdapter.h> #include <parser/SourceCode.h> #include "qt_runtime.h" #include "NodeList.h" @@ -47,8 +48,6 @@ #include "StaticNodeList.h" #include "StyleResolver.h" #include "markup.h" -#include "qwebframe.h" -#include "qwebframe_p.h" #include "runtime_root.h" #include <JSDocument.h> #include <wtf/Vector.h> @@ -706,7 +705,8 @@ QWebFrame *QWebElement::webFrame() const Frame* frame = document->frame(); if (!frame) return 0; - return QWebFramePrivate::kit(frame); + QWebFrameAdapter* frameAdapter = QWebFrameAdapter::kit(frame); + return frameAdapter->apiHandle(); } static bool setupScriptContext(WebCore::Element* element, JSC::JSValue& thisValue, ScriptState*& state, ScriptController*& scriptController) diff --git a/Source/WebKit/qt/Api/qwebframe.cpp b/Source/WebKit/qt/Api/qwebframe.cpp index 1310348ed..89474dd2e 100644 --- a/Source/WebKit/qt/Api/qwebframe.cpp +++ b/Source/WebKit/qt/Api/qwebframe.cpp @@ -106,54 +106,6 @@ QT_BEGIN_NAMESPACE extern Q_GUI_EXPORT int qt_defaultDpi(); QT_END_NAMESPACE -static inline ResourceRequestCachePolicy cacheLoadControlToCachePolicy(uint cacheLoadControl) -{ - switch (cacheLoadControl) { - case QNetworkRequest::AlwaysNetwork: - return WebCore::ReloadIgnoringCacheData; - case QNetworkRequest::PreferCache: - return WebCore::ReturnCacheDataElseLoad; - case QNetworkRequest::AlwaysCache: - return WebCore::ReturnCacheDataDontLoad; - default: - break; - } - return WebCore::UseProtocolCachePolicy; -} - -QWebFrameData::QWebFrameData(WebCore::Page* parentPage, WebCore::Frame* parentFrame, - WebCore::HTMLFrameOwnerElement* ownerFrameElement, - const WTF::String& frameName) - : name(frameName) - , ownerElement(ownerFrameElement) - , page(parentPage) - , allowsScrolling(true) - , marginWidth(0) - , marginHeight(0) -{ - frameLoaderClient = new FrameLoaderClientQt(); - frame = Frame::create(page, ownerElement, frameLoaderClient); - - // FIXME: All of the below should probably be moved over into WebCore - frame->tree()->setName(name); - if (parentFrame) - parentFrame->tree()->appendChild(frame); -} - -void QWebFramePrivate::init(QWebFrame *qframe, QWebFrameData *frameData) -{ - q = qframe; - - allowsScrolling = frameData->allowsScrolling; - marginWidth = frameData->marginWidth; - marginHeight = frameData->marginHeight; - frame = frameData->frame.get(); - frameLoaderClient = frameData->frameLoaderClient; - frameLoaderClient->setFrame(qframe, frame); - - frame->init(); -} - void QWebFramePrivate::setPage(QWebPage* newPage) { if (page == newPage) @@ -166,6 +118,7 @@ void QWebFramePrivate::setPage(QWebPage* newPage) q->setParent(newPage); page = newPage; + pageAdapter = newPage->handle(); emit q->pageChanged(); } @@ -375,6 +328,11 @@ void QWebFramePrivate::emitUrlChanged() emit q->urlChanged(url); } +void QWebFramePrivate::didStartProvisionalLoad() +{ + emit q->provisionalLoad(); +} + void QWebFramePrivate::_q_orientationChanged() { #if ENABLE(ORIENTATION_EVENTS) @@ -409,6 +367,65 @@ void QWebFramePrivate::didClearWindowObject() emit q->javaScriptWindowObjectCleared(); } +bool QWebFramePrivate::handleProgressFinished(QPoint *localPos) +{ + QWidget *view = q->page()->view(); + if (!view || !localPos) + return false; + *localPos = view->mapFromGlobal(QCursor::pos()); + return view->hasFocus() && view->rect().contains(*localPos); +} + +void QWebFramePrivate::emitInitialLayoutCompleted() +{ + emit q->initialLayoutCompleted(); +} + +void QWebFramePrivate::emitIconChanged() +{ + emit q->iconChanged(); +} + +void QWebFramePrivate::emitLoadStarted(bool originatingLoad) +{ + if (page && originatingLoad) + emit page->loadStarted(); + emit q->loadStarted(); +} + +void QWebFramePrivate::emitLoadFinished(bool originatingLoad, bool ok) +{ + if (page && originatingLoad) + emit page->loadFinished(ok); + emit q->loadFinished(ok); +} + +QWebFrameAdapter* QWebFramePrivate::createChildFrame(QWebFrameData* frameData) +{ + QWebFrame* newFrame = new QWebFrame(/*parent frame*/q, frameData); + return newFrame->d; +} + +QWebFrame *QWebFramePrivate::apiHandle() +{ + return q; +} + +QObject *QWebFramePrivate::handle() +{ + return q; +} + +void QWebFramePrivate::contentsSizeDidChange(const QSize &size) +{ + emit q->contentsSizeChanged(size); +} + +int QWebFramePrivate::scrollBarPolicy(Qt::Orientation orientation) const +{ + return (int) q->scrollBarPolicy(orientation); +} + /*! \class QWebFrame \since 4.4 @@ -472,29 +489,27 @@ void QWebFramePrivate::didClearWindowObject() \value AllLayers Includes all the above layers */ -QWebFrame::QWebFrame(QWebPage *parent, QWebFrameData *frameData) - : QObject(parent) +QWebFrame::QWebFrame(QWebPage *parentPage) + : QObject(parentPage) , d(new QWebFramePrivate) { - d->page = parent; - d->init(this, frameData); + d->page = parentPage; + d->q = this; + d->init(/*page adapter*/ parentPage->handle()); - if (!frameData->url.isEmpty()) { - WebCore::ResourceRequest request(frameData->url, frameData->referrer); - d->frame->loader()->load(request, frameData->name, false); - } #if ENABLE(ORIENTATION_EVENTS) connect(&d->m_orientation, SIGNAL(readingChanged()), this, SLOT(_q_orientationChanged())); d->m_orientation.start(); #endif } -QWebFrame::QWebFrame(QWebFrame *parent, QWebFrameData *frameData) +QWebFrame::QWebFrame(QWebFrame* parent, QWebFrameData* frameData) : QObject(parent) , d(new QWebFramePrivate) { d->page = parent->d->page; - d->init(this, frameData); + d->q = this; + d->init(parent->d->pageAdapter, frameData); #if ENABLE(ORIENTATION_EVENTS) connect(&d->m_orientation, SIGNAL(readingChanged()), this, SLOT(_q_orientationChanged())); d->m_orientation.start(); @@ -503,9 +518,6 @@ QWebFrame::QWebFrame(QWebFrame *parent, QWebFrameData *frameData) QWebFrame::~QWebFrame() { - if (d->frame && d->frame->loader() && d->frame->loader()->client()) - static_cast<FrameLoaderClientQt*>(d->frame->loader()->client())->m_webFrame = 0; - delete d; } @@ -674,22 +686,6 @@ static inline bool isCoreFrameClear(WebCore::Frame* frame) return frame->document()->url().isEmpty(); } -static inline QUrl ensureAbsoluteUrl(const QUrl &url) -{ - if (!url.isValid() || !url.isRelative()) - return url; - - // This contains the URL with absolute path but without - // the query and the fragment part. - QUrl baseUrl = QUrl::fromLocalFile(QFileInfo(url.toLocalFile()).absoluteFilePath()); - - // The path is removed so the query and the fragment parts are there. - QString pathRemoved = url.toString(QUrl::RemovePath); - QUrl toResolve(pathRemoved); - - return baseUrl.resolved(toResolve); -} - /*! \property QWebFrame::url \brief the url of the frame currently viewed @@ -704,7 +700,7 @@ static inline QUrl ensureAbsoluteUrl(const QUrl &url) void QWebFrame::setUrl(const QUrl &url) { clearCoreFrame(d->frame); - const QUrl absolute = ensureAbsoluteUrl(url); + const QUrl absolute = QWebFrameAdapter::ensureAbsoluteUrl(url); d->url = absolute; load(absolute); } @@ -798,58 +794,7 @@ void QWebFrame::load(const QNetworkRequest &req, QNetworkAccessManager::Operation operation, const QByteArray &body) { - if (d->parentFrame()) - d->page->d->insideOpenCall = true; - - QUrl url = ensureAbsoluteUrl(req.url()); - - WebCore::ResourceRequest request(url); - - switch (operation) { - case QNetworkAccessManager::HeadOperation: - request.setHTTPMethod("HEAD"); - break; - case QNetworkAccessManager::GetOperation: - request.setHTTPMethod("GET"); - break; - case QNetworkAccessManager::PutOperation: - request.setHTTPMethod("PUT"); - break; - case QNetworkAccessManager::PostOperation: - request.setHTTPMethod("POST"); - break; - case QNetworkAccessManager::DeleteOperation: - request.setHTTPMethod("DELETE"); - break; - case QNetworkAccessManager::CustomOperation: - request.setHTTPMethod(req.attribute(QNetworkRequest::CustomVerbAttribute).toByteArray().constData()); - break; - case QNetworkAccessManager::UnknownOperation: - // eh? - break; - } - - QVariant cacheLoad = req.attribute(QNetworkRequest::CacheLoadControlAttribute); - if (cacheLoad.isValid()) { - bool ok; - uint cacheLoadValue = cacheLoad.toUInt(&ok); - if (ok) - request.setCachePolicy(cacheLoadControlToCachePolicy(cacheLoadValue)); - } - - QList<QByteArray> httpHeaders = req.rawHeaderList(); - for (int i = 0; i < httpHeaders.size(); ++i) { - const QByteArray &headerName = httpHeaders.at(i); - request.addHTTPHeaderField(QString::fromLatin1(headerName), QString::fromLatin1(req.rawHeader(headerName))); - } - - if (!body.isEmpty()) - request.setHTTPBody(WebCore::FormData::create(body.constData(), body.size())); - - d->frame->loader()->load(request, false); - - if (d->parentFrame()) - d->page->d->insideOpenCall = false; + d->load(req, operation, body); } /*! @@ -1088,10 +1033,7 @@ void QWebFrame::scroll(int dx, int dy) QPoint QWebFrame::scrollPosition() const { - if (!d->frame->view()) - return QPoint(0, 0); - - IntSize ofs = d->frame->view()->scrollOffset(); + IntSize ofs = d->scrollPosition(); return QPoint(ofs.width(), ofs.height()); } @@ -1248,9 +1190,7 @@ QPoint QWebFrame::pos() const */ QRect QWebFrame::geometry() const { - if (!d->frame->view()) - return QRect(); - return d->frame->view()->frameRect(); + return d->frameRect(); } /*! @@ -1479,6 +1419,11 @@ QWebFrame* QWebFramePrivate::kit(const WebCore::Frame* coreFrame) return qobject_cast<QWebFrame*>(coreFrame->loader()->networkingContext()->originatingObject()); } +QWebFrame *QWebFramePrivate::kit(const QWebFrameAdapter* frameAdapter) +{ + return static_cast<const QWebFramePrivate*>(frameAdapter)->q; +} + /*! \fn void QWebFrame::javaScriptWindowObjectCleared() @@ -1859,4 +1804,12 @@ QWebFrame *QWebHitTestResult::frame() const return d->frame.data(); } +/*! + * \internal + */ +QWebFrameAdapter *QWebFrame::handle() const +{ + return d; +} + #include "moc_qwebframe.cpp" diff --git a/Source/WebKit/qt/Api/qwebframe.h b/Source/WebKit/qt/Api/qwebframe.h index ca96661e3..fe00d81f5 100644 --- a/Source/WebKit/qt/Api/qwebframe.h +++ b/Source/WebKit/qt/Api/qwebframe.h @@ -41,8 +41,10 @@ class QPrinter; QT_END_NAMESPACE class QWebNetworkRequest; +class QWebFrameAdapter; class QWebFramePrivate; class QWebPage; +class QWebPageAdapter; class QWebHitTestResult; class QWebHistoryItem; class QWebSecurityOrigin; @@ -115,8 +117,8 @@ class QWEBKIT_EXPORT QWebFrame : public QObject { Q_PROPERTY(QPoint scrollPosition READ scrollPosition WRITE setScrollPosition) Q_PROPERTY(bool focus READ hasFocus) private: - QWebFrame(QWebPage *parent, QWebFrameData *frameData); - QWebFrame(QWebFrame *parent, QWebFrameData *frameData); + QWebFrame(QWebPage *parentPage); + QWebFrame(QWebFrame* parent, QWebFrameData*); ~QWebFrame(); public: @@ -200,6 +202,7 @@ public: virtual bool event(QEvent *); QWebSecurityOrigin securityOrigin() const; + QWebFrameAdapter* handle() const; public Q_SLOTS: QVariant evaluateJavaScript(const QString& scriptSource); diff --git a/Source/WebKit/qt/Api/qwebframe_p.h b/Source/WebKit/qt/Api/qwebframe_p.h index d6779f2bc..dbdcbc85a 100644 --- a/Source/WebKit/qt/Api/qwebframe_p.h +++ b/Source/WebKit/qt/Api/qwebframe_p.h @@ -21,24 +21,25 @@ #ifndef QWEBFRAME_P_H #define QWEBFRAME_P_H +#include "QWebFrameAdapter.h" + #include "qwebframe.h" #include "qwebpage_p.h" #include "EventHandler.h" +#include "Frame.h" #include "GraphicsContext.h" #include "KURL.h" #if ENABLE(ORIENTATION_EVENTS) #include "qorientationsensor.h" #endif // ENABLE(ORIENTATION_EVENTS). #include "qwebelement.h" -#include "wtf/RefPtr.h" -#include "Frame.h" -#include "ViewportArguments.h" -#include <wtf/text/WTFString.h> - #if USE(ACCELERATED_COMPOSITING) #include "texmap/TextureMapper.h" #endif +#include "ViewportArguments.h" +#include <wtf/RefPtr.h> +#include <wtf/text/WTFString.h> namespace WebCore { @@ -50,42 +51,17 @@ namespace WebCore { } class QWebPage; -class QWebFrameData { -public: - QWebFrameData(WebCore::Page*, WebCore::Frame* parentFrame = 0, - WebCore::HTMLFrameOwnerElement* = 0, - const WTF::String& frameName = WTF::String()); - - WebCore::KURL url; - WTF::String name; - WebCore::HTMLFrameOwnerElement* ownerElement; - WebCore::Page* page; - RefPtr<WebCore::Frame> frame; - WebCore::FrameLoaderClientQt* frameLoaderClient; - - WTF::String referrer; - bool allowsScrolling; - int marginWidth; - int marginHeight; -}; - -class QWebFramePrivate { +class QWebFramePrivate : public QWebFrameAdapter { public: QWebFramePrivate() : q(0) , horizontalScrollBarPolicy(Qt::ScrollBarAsNeeded) , verticalScrollBarPolicy(Qt::ScrollBarAsNeeded) - , frameLoaderClient(0) - , frame(0) , page(0) - , allowsScrolling(true) - , marginWidth(-1) - , marginHeight(-1) #if USE(ACCELERATED_COMPOSITING) , rootTextureMapperLayer(0) #endif {} - void init(QWebFrame* qframe, QWebFrameData* frameData); void setPage(QWebPage*); inline QWebFrame *parentFrame() { return qobject_cast<QWebFrame*>(q->parent()); } @@ -95,6 +71,7 @@ public: static WebCore::Frame* core(const QWebFrame*); static QWebFrame* kit(const WebCore::Frame*); + static QWebFrame* kit(const QWebFrameAdapter*); void renderRelativeCoords(WebCore::GraphicsContext*, QFlags<QWebFrame::RenderLayer>, const QRegion& clip); #if USE(TILED_BACKING_STORE) @@ -105,22 +82,29 @@ public: void renderCompositedLayers(WebCore::GraphicsContext*, const WebCore::IntRect& clip); #endif void renderFrameExtras(WebCore::GraphicsContext*, QFlags<QWebFrame::RenderLayer>, const QRegion& clip); - void emitUrlChanged(); void _q_orientationChanged(); - void didClearWindowObject(); + + // Adapter implementation + virtual QWebFrame* apiHandle() OVERRIDE; + virtual QObject* handle() OVERRIDE; + virtual void contentsSizeDidChange(const QSize &) OVERRIDE; + virtual int scrollBarPolicy(Qt::Orientation) const OVERRIDE; + virtual void emitUrlChanged() OVERRIDE; + virtual void didStartProvisionalLoad() OVERRIDE; + virtual void didClearWindowObject() OVERRIDE; + virtual bool handleProgressFinished(QPoint*) OVERRIDE; + virtual void emitInitialLayoutCompleted() OVERRIDE; + virtual void emitIconChanged() OVERRIDE; + virtual void emitLoadStarted(bool originatingLoad) OVERRIDE; + virtual void emitLoadFinished(bool originatingLoad, bool ok) OVERRIDE; + virtual QWebFrameAdapter* createChildFrame(QWebFrameData*) OVERRIDE; QWebFrame *q; Qt::ScrollBarPolicy horizontalScrollBarPolicy; Qt::ScrollBarPolicy verticalScrollBarPolicy; - WebCore::FrameLoaderClientQt *frameLoaderClient; - WebCore::Frame *frame; QWebPage *page; - WebCore::KURL url; - bool allowsScrolling; - int marginWidth; - int marginHeight; #if USE(ACCELERATED_COMPOSITING) WebCore::TextureMapperLayer* rootTextureMapperLayer; OwnPtr<WebCore::TextureMapper> textureMapper; diff --git a/Source/WebKit/qt/Api/qwebhistory.cpp b/Source/WebKit/qt/Api/qwebhistory.cpp index f7849666e..a945b592b 100644 --- a/Source/WebKit/qt/Api/qwebhistory.cpp +++ b/Source/WebKit/qt/Api/qwebhistory.cpp @@ -20,15 +20,16 @@ #include "config.h" #include "qwebhistory.h" #include "qwebhistory_p.h" -#include "qwebframe_p.h" #include "BackForwardListImpl.h" +#include "Frame.h" #include "IconDatabaseBase.h" #include "Image.h" #include "IntSize.h" #include "KURL.h" #include "Page.h" #include "PageGroup.h" +#include <QWebPageAdapter.h> #include <wtf/text/WTFString.h> #include <QSharedData> @@ -552,9 +553,9 @@ QDataStream& operator>>(QDataStream& source, QWebHistory& history) return source; } -QWebPagePrivate* QWebHistoryPrivate::page() +QWebPageAdapter* QWebHistoryPrivate::page() { - return QWebFramePrivate::kit(static_cast<WebCore::BackForwardListImpl*>(lst)->page()->mainFrame())->page()->handle(); + return QWebPageAdapter::kit(static_cast<WebCore::BackForwardListImpl*>(lst)->page()); } WebCore::HistoryItem* QWebHistoryItemPrivate::core(const QWebHistoryItem* q) diff --git a/Source/WebKit/qt/Api/qwebhistory_p.h b/Source/WebKit/qt/Api/qwebhistory_p.h index aaee38632..17634ebc0 100644 --- a/Source/WebKit/qt/Api/qwebhistory_p.h +++ b/Source/WebKit/qt/Api/qwebhistory_p.h @@ -26,7 +26,7 @@ #include <QtCore/qglobal.h> #include <QtCore/qshareddata.h> -class QWebPagePrivate; +class QWebPageAdapter; class QWEBKIT_EXPORT QWebHistoryItemPrivate : public QSharedData { public: @@ -63,7 +63,7 @@ public: lst->deref(); } - QWebPagePrivate* page(); + QWebPageAdapter* page(); WebCore::BackForwardListImpl* lst; }; diff --git a/Source/WebKit/qt/Api/qwebinspector.cpp b/Source/WebKit/qt/Api/qwebinspector.cpp index 2fbbab249..55089e1a1 100644 --- a/Source/WebKit/qt/Api/qwebinspector.cpp +++ b/Source/WebKit/qt/Api/qwebinspector.cpp @@ -184,12 +184,12 @@ void QWebInspector::closeEvent(QCloseEvent* event) } /*! \internal */ -void QWebInspectorPrivate::setFrontend(QWidget* newFrontend) +void QWebInspectorPrivate::setFrontend(QObject* newFrontend) { if (frontend) frontend->setParent(0); - frontend = newFrontend; + frontend = qobject_cast<QWidget*>(newFrontend); if (frontend) { frontend->setParent(q); diff --git a/Source/WebKit/qt/Api/qwebinspector_p.h b/Source/WebKit/qt/Api/qwebinspector_p.h index 4d327cc5a..908de84ed 100644 --- a/Source/WebKit/qt/Api/qwebinspector_p.h +++ b/Source/WebKit/qt/Api/qwebinspector_p.h @@ -35,7 +35,7 @@ public: , frontend(0) {} - void setFrontend(QWidget* newFrontend); + void setFrontend(QObject* newFrontend); void adjustFrontendSize(const QSize& size); QWebInspector* q; diff --git a/Source/WebKit/qt/Api/qwebkitglobal.h b/Source/WebKit/qt/Api/qwebkitglobal.h index 7ee56de86..947ba0654 100644 --- a/Source/WebKit/qt/Api/qwebkitglobal.h +++ b/Source/WebKit/qt/Api/qwebkitglobal.h @@ -28,22 +28,14 @@ // Use: #if (QTWEBKIT_VERSION >= QTWEBKIT_VERSION_CHECK(2, 0, 0)). Similar to Qt. #define QTWEBKIT_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch)) -#if defined(QT_MAKEDLL) /* create a Qt DLL library */ +#ifndef QT_STATIC # if defined(BUILDING_WEBKIT) # define QWEBKIT_EXPORT Q_DECL_EXPORT # else # define QWEBKIT_EXPORT Q_DECL_IMPORT # endif -#elif defined(QT_DLL) /* use a Qt DLL library */ -# define QWEBKIT_EXPORT Q_DECL_IMPORT -#endif - -#if !defined(QWEBKIT_EXPORT) -# if defined(QT_SHARED) -# define QWEBKIT_EXPORT Q_DECL_EXPORT -# else -# define QWEBKIT_EXPORT -# endif +#else +# define QWEBKIT_EXPORT #endif #endif // QWEBKITGLOBAL_H diff --git a/Source/WebKit/qt/Api/qwebpage.cpp b/Source/WebKit/qt/Api/qwebpage.cpp index 02383ac67..65624d190 100644 --- a/Source/WebKit/qt/Api/qwebpage.cpp +++ b/Source/WebKit/qt/Api/qwebpage.cpp @@ -22,18 +22,6 @@ #include "config.h" #include "qwebpage.h" -#include "qwebview.h" -#include "qwebframe.h" -#include "qwebpage_p.h" -#include "qwebframe_p.h" -#include "qwebhistory.h" -#include "qwebhistory_p.h" -#include "qwebinspector.h" -#include "qwebinspector_p.h" -#include "qwebsettings.h" -#include "qwebkitplatformplugin.h" -#include "qwebkitversion.h" - #include "CSSComputedStyleDeclaration.h" #include "CSSParser.h" #include "ApplicationCacheStorage.h" @@ -45,6 +33,9 @@ #include "ContextMenu.h" #include "ContextMenuClientQt.h" #include "ContextMenuController.h" +#if USE(QT_MULTIMEDIA) +#include "DefaultFullScreenVideoHandler.h" +#endif #if ENABLE(DEVICE_ORIENTATION) #include "DeviceMotionClientQt.h" #include "DeviceOrientationClientMock.h" @@ -62,7 +53,6 @@ #include "Frame.h" #include "FrameLoadRequest.h" #include "FrameLoader.h" -#include "FrameLoader.h" #include "FrameLoaderClientQt.h" #include "FrameTree.h" #include "FrameView.h" @@ -79,7 +69,9 @@ #include "HitTestResult.h" #include "Image.h" #include "InitWebCoreQt.h" +#include "InitWebKitQt.h" #include "InspectorClientQt.h" +#include "InspectorClientWebPage.h" #include "InspectorController.h" #include "InspectorServerQt.h" #include "KURL.h" @@ -88,20 +80,22 @@ #include "NavigationAction.h" #include "NetworkingContext.h" #include "NodeList.h" -#include "NotificationPresenterClientQt.h" #include "NotImplemented.h" +#include "NotificationPresenterClientQt.h" #include "Page.h" #include "PageClientQt.h" #include "PageGroup.h" #include "Pasteboard.h" -#include "PlatformGestureEvent.h" #include "PlatformKeyboardEvent.h" #include "PlatformTouchEvent.h" #include "PlatformWheelEvent.h" #include "PluginDatabase.h" -#include "PluginDatabase.h" #include "PluginPackage.h" #include "ProgressTracker.h" +#include "QGraphicsWidgetPluginImpl.h" +#include "QWebUndoCommand.h" +#include "QWidgetPluginImpl.h" +#include "QtFallbackWebPopup.h" #include "QtPlatformPlugin.h" #include "RenderTextControl.h" #include "RenderThemeQt.h" @@ -114,16 +108,30 @@ #include "SystemInfo.h" #endif // Q_OS_WIN32 #include "TextIterator.h" +#include "UndoStepQt.h" #include "UserAgentQt.h" #include "WebEventConversion.h" #include "WebKitVersion.h" #include "WindowFeatures.h" #include "WorkerThread.h" +#include "qwebframe.h" +#include "qwebframe_p.h" +#include "qwebhistory.h" +#include "qwebhistory_p.h" +#include "qwebinspector.h" +#include "qwebinspector_p.h" +#include "qwebkitplatformplugin.h" +#include "qwebkitversion.h" +#include "qwebpage_p.h" +#include "qwebsettings.h" +#include "qwebview.h" + #include <QAction> #include <QApplication> #include <QBasicTimer> #include <QBitArray> +#include <QClipboard> #include <QColorDialog> #include <QDebug> #include <QDesktopWidget> @@ -137,24 +145,25 @@ #include <QLabel> #include <QMenu> #include <QMessageBox> +#include <QNetworkAccessManager> #include <QNetworkProxy> -#include <QUndoStack> -#include <QUrl> +#include <QNetworkRequest> #include <QPainter> -#include <QClipboard> #include <QSslSocket> #include <QStyle> #include <QSysInfo> +#if USE(QT_MOBILITY_SYSTEMINFO) +#include <qsysteminfo.h> +#endif +#include <QSystemTrayIcon> #include <QTextCharFormat> +#include <QToolTip> #include <QTouchEvent> -#include <QNetworkAccessManager> -#include <QNetworkRequest> +#include <QUndoStack> +#include <QUrl> #if defined(Q_WS_X11) #include <QX11Info> #endif -#if USE(QT_MOBILITY_SYSTEMINFO) -#include <qsysteminfo.h> -#endif using namespace WebCore; @@ -163,8 +172,6 @@ QT_BEGIN_NAMESPACE extern Q_GUI_EXPORT int qt_defaultDpi(); QT_END_NAMESPACE -bool QWebPagePrivate::drtRun = false; - // Lookup table mapping QWebPage::WebActions to the associated Editor commands static const char* editorCommandWebActions[] = { @@ -300,40 +307,33 @@ static inline Qt::DropAction dragOpToDropAction(unsigned actions) QWebPagePrivate::QWebPagePrivate(QWebPage *qq) : q(qq) - , page(0) #ifndef QT_NO_UNDOSTACK , undoStack(0) #endif - , insideOpenCall(false) , m_totalBytes(0) , m_bytesReceived() , clickCausedFocus(false) - , networkManager(0) - , forwardUnsupportedContent(false) - , smartInsertDeleteEnabled(true) - , selectTrailingWhitespaceEnabled(false) , linkPolicy(QWebPage::DontDelegateLinks) - , viewportSize(QSize(0, 0)) - , settings(0) + , m_viewportSize(QSize(0, 0)) , useFixedLayout(false) - , pluginFactory(0) , inspectorFrontend(0) , inspector(0) , inspectorIsInternalOnly(false) , m_lastDropAction(Qt::IgnoreAction) { #if ENABLE(GEOLOCATION) || ENABLE(DEVICE_ORIENTATION) - bool useMock = QWebPagePrivate::drtRun; + bool useMock = QWebPageAdapter::drtRun; #endif + WebKit::initializeWebKitWidgets(); WebCore::initializeWebCoreQt(); Page::PageClients pageClients; - pageClients.chromeClient = new ChromeClientQt(q); + pageClients.chromeClient = new ChromeClientQt(this); pageClients.contextMenuClient = new ContextMenuClientQt(); - pageClients.editorClient = new EditorClientQt(q); - pageClients.dragClient = new DragClientQt(q); - pageClients.inspectorClient = new InspectorClientQt(q); + pageClients.editorClient = new EditorClientQt(this); + pageClients.dragClient = new DragClientQt(pageClients.chromeClient); + pageClients.inspectorClient = new InspectorClientQt(this); page = new Page(pageClients); #if ENABLE(GEOLOCATION) if (useMock) { @@ -342,7 +342,7 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq) WebCore::provideGeolocationTo(page, mock); mock->setController(WebCore::GeolocationController::from(page)); } else - WebCore::provideGeolocationTo(page, new GeolocationClientQt(q)); + WebCore::provideGeolocationTo(page, new GeolocationClientQt(this)); #endif #if ENABLE(DEVICE_ORIENTATION) if (useMock) @@ -351,9 +351,6 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq) WebCore::provideDeviceOrientationTo(page, new DeviceOrientationClientQt); WebCore::provideDeviceMotionTo(page, new DeviceMotionClientQt); #endif -#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) - WebCore::provideNotification(page, NotificationPresenterClientQt::notificationPresenter()); -#endif // By default each page is put into their own unique page group, which affects popup windows // and visited links. Page groups (per process only) is a feature making it possible to use @@ -364,7 +361,7 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq) page->addLayoutMilestones(DidFirstVisuallyNonEmptyLayout); - settings = new QWebSettings(page->settings()); + QWebPageAdapter::init(page); history.d = new QWebHistoryPrivate(static_cast<WebCore::BackForwardListImpl*>(page->backForwardList())); memset(actions, 0, sizeof(actions)); @@ -372,8 +369,13 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq) PageGroup::setShouldTrackVisitedLinks(true); #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) - NotificationPresenterClientQt::notificationPresenter()->addClient(); -#endif + NotificationPresenterClientQt* presenter = NotificationPresenterClientQt::notificationPresenter(); + presenter->addClient(); +#ifndef QT_NO_SYSTEMTRAYICON + if (!presenter->hasSystemTrayIcon()) + presenter->setSystemTrayIcon(new QSystemTrayIcon); +#endif // QT_NO_SYSTEMTRAYICON +#endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) } QWebPagePrivate::~QWebPagePrivate() @@ -384,8 +386,6 @@ QWebPagePrivate::~QWebPagePrivate() #ifndef QT_NO_UNDOSTACK delete undoStack; #endif - delete settings; - delete page; if (inspector) { // If the inspector is ours, delete it, otherwise just detach from it. @@ -394,41 +394,225 @@ QWebPagePrivate::~QWebPagePrivate() else inspector->setPage(0); } + // Explicitly destruct the WebCore page at this point when the + // QWebPagePrivate / QWebPageAdapater vtables are still intact, + // in order for various destruction callbacks out of WebCore to + // work. + deletePage(); +} -#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) - NotificationPresenterClientQt::notificationPresenter()->removeClient(); +WebCore::Page* QWebPagePrivate::core(const QWebPage* page) +{ + return page->d->page; +} + +void QWebPagePrivate::show() +{ + if (!view) + return; + view->window()->show(); +} + +void QWebPagePrivate::setFocus() +{ + if (!view) + return; + view->setFocus(); +} + +void QWebPagePrivate::unfocus() +{ + if (!view) + return; + view->clearFocus(); +} + +void QWebPagePrivate::setWindowRect(const QRect &rect) +{ + emit q->geometryChangeRequested(rect); +} + +QSize QWebPagePrivate::viewportSize() const +{ + return q->viewportSize(); +} + +QWebPageAdapter *QWebPagePrivate::createWindow(bool dialog) +{ + QWebPage *newPage = q->createWindow(dialog ? QWebPage::WebModalDialog : QWebPage::WebBrowserWindow); + if (!newPage) + return 0; + // Make sure the main frame exists, as WebCore expects it when returning from this ChromeClient::createWindow() + newPage->d->createMainFrame(); + return newPage->d; +} + +void QWebPagePrivate::javaScriptConsoleMessage(const QString &message, int lineNumber, const QString &sourceID) +{ + q->javaScriptConsoleMessage(message, lineNumber, sourceID); +} + +void QWebPagePrivate::javaScriptAlert(QWebFrameAdapter* frame, const QString& msg) +{ + q->javaScriptAlert(QWebFramePrivate::kit(frame), msg); +} + +bool QWebPagePrivate::javaScriptConfirm(QWebFrameAdapter* frame, const QString& msg) +{ + return q->javaScriptConfirm(QWebFramePrivate::kit(frame), msg); +} + +bool QWebPagePrivate::javaScriptPrompt(QWebFrameAdapter *frame, const QString &msg, const QString &defaultValue, QString *result) +{ + return q->javaScriptPrompt(QWebFramePrivate::kit(frame), msg, defaultValue, result); +} + +bool QWebPagePrivate::shouldInterruptJavaScript() +{ + return q->shouldInterruptJavaScript(); +} + +void QWebPagePrivate::printRequested(QWebFrameAdapter *frame) +{ + emit q->printRequested(QWebFramePrivate::kit(frame)); +} + +void QWebPagePrivate::databaseQuotaExceeded(QWebFrameAdapter* frame, const QString& databaseName) +{ + emit q->databaseQuotaExceeded(QWebFramePrivate::kit(frame), databaseName); +} + +void QWebPagePrivate::applicationCacheQuotaExceeded(QWebSecurityOrigin *origin, quint64 defaultOriginQuota, quint64 c) +{ + emit q->applicationCacheQuotaExceeded(origin, defaultOriginQuota, c); +} + +void QWebPagePrivate::setToolTip(const QString &tip) +{ +#ifndef QT_NO_TOOLTIP + if (!view) + return; + + if (tip.isEmpty()) { + view->setToolTip(QString()); + QToolTip::hideText(); + } else { + QString dtip = QLatin1String("<p>") + QString(tip).toHtmlEscaped() + QLatin1String("</p>"); + view->setToolTip(dtip); + } +#else + Q_UNUSED(tip); #endif } -WebCore::ViewportArguments QWebPagePrivate::viewportArguments() +#if USE(QT_MULTIMEDIA) +QWebFullScreenVideoHandler *QWebPagePrivate::createFullScreenVideoHandler() { - return page ? page->viewportArguments() : WebCore::ViewportArguments(); + return new WebKit::DefaultFullScreenVideoHandler; } +#endif -WebCore::Page* QWebPagePrivate::core(const QWebPage* page) +QWebFrameAdapter *QWebPagePrivate::mainFrameAdapter() { - return page->d->page; + return q->mainFrame()->d; } -QWebPagePrivate* QWebPagePrivate::priv(QWebPage* page) +QStringList QWebPagePrivate::chooseFiles(QWebFrameAdapter *frame, bool allowMultiple, const QStringList &suggestedFileNames) { - return page->d; + if (allowMultiple && q->supportsExtension(QWebPage::ChooseMultipleFilesExtension)) { + QWebPage::ChooseMultipleFilesExtensionOption option; + option.parentFrame = QWebFramePrivate::kit(frame); + option.suggestedFileNames = suggestedFileNames; + + QWebPage::ChooseMultipleFilesExtensionReturn output; + q->extension(QWebPage::ChooseMultipleFilesExtension, &option, &output); + + return output.fileNames; + } + // Single file + QStringList result; + QString suggestedFile; + if (!suggestedFileNames.isEmpty()) + suggestedFile = suggestedFileNames.first(); + QString file = q->chooseFile(QWebFramePrivate::kit(frame), suggestedFile); + if (!file.isEmpty()) + result << file; + return result; } -bool QWebPagePrivate::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, QWebPage::NavigationType type) +bool QWebPagePrivate::acceptNavigationRequest(QWebFrameAdapter *frameAdapter, const QNetworkRequest &request, int type) { + QWebFrame *frame = frameAdapter ? QWebFramePrivate::kit(frameAdapter): 0; if (insideOpenCall && frame == mainFrame.data()) return true; - return q->acceptNavigationRequest(frame, request, type); + return q->acceptNavigationRequest(frame, request, QWebPage::NavigationType(type)); +} + +void QWebPagePrivate::emitRestoreFrameStateRequested(QWebFrameAdapter *frame) +{ + emit q->restoreFrameStateRequested(QWebFramePrivate::kit(frame)); +} + +void QWebPagePrivate::emitSaveFrameStateRequested(QWebFrameAdapter *frame, QWebHistoryItem *item) +{ + emit q->saveFrameStateRequested(QWebFramePrivate::kit(frame), item); +} + +void QWebPagePrivate::emitDownloadRequested(const QNetworkRequest &request) +{ + emit q->downloadRequested(request); +} + +void QWebPagePrivate::emitFrameCreated(QWebFrameAdapter *frame) +{ + emit q->frameCreated(QWebFramePrivate::kit(frame)); +} + +bool QWebPagePrivate::errorPageExtension(QWebPageAdapter::ErrorPageOption *opt, QWebPageAdapter::ErrorPageReturn *out) +{ + QWebPage::ErrorPageExtensionOption option; + if (opt->domain == QLatin1String("QtNetwork")) + option.domain = QWebPage::QtNetwork; + else if (opt->domain == QLatin1String("HTTP")) + option.domain = QWebPage::Http; + else if (opt->domain == QLatin1String("WebKit")) + option.domain = QWebPage::WebKit; + else + return false; + option.url = opt->url; + option.frame = QWebFramePrivate::kit(opt->frame); + option.error = opt->error; + option.errorString = opt->errorString; + QWebPage::ErrorPageExtensionReturn output; + if (!q->extension(QWebPage::ErrorPageExtension, &option, &output)) + return false; + out->baseUrl = output.baseUrl; + out->content = output.content; + out->contentType = output.contentType; + out->encoding = output.encoding; + return true; +} + +QtPluginWidgetAdapter *QWebPagePrivate::createPlugin(const QString &classid, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues) +{ + QObject *widget = q->createPlugin(classid, url, paramNames, paramValues); + return adapterForWidget(widget); +} + +QtPluginWidgetAdapter *QWebPagePrivate::adapterForWidget(QObject *object) const +{ + if (QWidget *widget = qobject_cast<QWidget*>(object)) + return new QWidgetPluginImpl(widget); + if (QGraphicsWidget *widget = qobject_cast<QGraphicsWidget*>(object)) + return new QGraphicsWidgetPluginImpl(widget); + return 0; } void QWebPagePrivate::createMainFrame() { if (!mainFrame) { - QWebFrameData frameData(page); - mainFrame = new QWebFrame(q, &frameData); - + mainFrame = new QWebFrame(q); emit q->frameCreated(mainFrame.data()); } } @@ -475,49 +659,49 @@ QMenu *QWebPagePrivate::createContextMenu(const WebCore::ContextMenu *webcoreMen if (!client || !webcoreMenu) return 0; - QMenu* menu = new QMenu(client->ownerWidget()); + QMenu* menu = new QMenu(q->view()); for (int i = 0; i < items->count(); ++i) { const ContextMenuItem &item = items->at(i); switch (item.type()) { - case WebCore::CheckableActionType: /* fall through */ - case WebCore::ActionType: { - QWebPage::WebAction action = webActionForContextMenuAction(item.action()); - QAction *a = q->action(action); - if (a) { - ContextMenuItem it(item); - page->contextMenuController()->checkOrEnableIfNeeded(it); - PlatformMenuItemDescription desc = it.releasePlatformDescription(); - a->setEnabled(desc.enabled); - a->setChecked(desc.checked); - a->setCheckable(item.type() == WebCore::CheckableActionType); - - menu->addAction(a); - visitedWebActions->setBit(action); - } - break; + case WebCore::CheckableActionType: /* fall through */ + case WebCore::ActionType: { + QWebPage::WebAction action = webActionForContextMenuAction(item.action()); + QAction *a = q->action(action); + if (a) { + ContextMenuItem it(item); + page->contextMenuController()->checkOrEnableIfNeeded(it); + PlatformMenuItemDescription desc = it.releasePlatformDescription(); + a->setEnabled(desc.enabled); + a->setChecked(desc.checked); + a->setCheckable(item.type() == WebCore::CheckableActionType); + + menu->addAction(a); + visitedWebActions->setBit(action); } - case WebCore::SeparatorType: - menu->addSeparator(); - break; - case WebCore::SubmenuType: { - QMenu *subMenu = createContextMenu(webcoreMenu, item.platformSubMenu(), visitedWebActions); - - bool anyEnabledAction = false; + break; + } + case WebCore::SeparatorType: + menu->addSeparator(); + break; + case WebCore::SubmenuType: { + QMenu *subMenu = createContextMenu(webcoreMenu, item.platformSubMenu(), visitedWebActions); - QList<QAction *> actions = subMenu->actions(); - for (int i = 0; i < actions.count(); ++i) { - if (actions.at(i)->isVisible()) - anyEnabledAction |= actions.at(i)->isEnabled(); - } + bool anyEnabledAction = false; - // don't show sub-menus with just disabled actions - if (anyEnabledAction) { - subMenu->setTitle(item.title()); - menu->addAction(subMenu->menuAction()); - } else - delete subMenu; - break; + QList<QAction *> actions = subMenu->actions(); + for (int i = 0; i < actions.count(); ++i) { + if (actions.at(i)->isVisible()) + anyEnabledAction |= actions.at(i)->isEnabled(); } + + // don't show sub-menus with just disabled actions + if (anyEnabledAction) { + subMenu->setTitle(item.title()); + menu->addAction(subMenu->menuAction()); + } else + delete subMenu; + break; + } } } return menu; @@ -619,6 +803,65 @@ void QWebPagePrivate::updateNavigationActions() updateAction(QWebPage::ReloadAndBypassCache); } +QObject *QWebPagePrivate::inspectorHandle() +{ + return getOrCreateInspector(); +} + +void QWebPagePrivate::setInspectorFrontend(QObject* frontend) +{ + inspectorFrontend = qobject_cast<QWidget*>(frontend); + if (inspector) + inspector->d->setFrontend(frontend); +} + +void QWebPagePrivate::setInspectorWindowTitle(const QString& title) +{ + if (inspector) + inspector->setWindowTitle(title); +} + +void QWebPagePrivate::createWebInspector(QObject** inspectorView, QWebPageAdapter** inspectorPage) +{ + QWebPage* page = new WebKit::InspectorClientWebPage; + *inspectorView = page->view(); + *inspectorPage = page->d; +} + +#ifndef QT_NO_MENU +static QStringList iterateContextMenu(QMenu* menu) +{ + if (!menu) + return QStringList(); + + QStringList items; + QList<QAction *> actions = menu->actions(); + for (int i = 0; i < actions.count(); ++i) { + if (actions.at(i)->isSeparator()) + items << QLatin1String("<separator>"); + else + items << actions.at(i)->text(); + if (actions.at(i)->menu()) + items << iterateContextMenu(actions.at(i)->menu()); + } + return items; +} +#endif + +QStringList QWebPagePrivate::menuActionsAsText() +{ +#ifndef QT_NO_MENU + return iterateContextMenu(currentContextMenu.data()); +#else + return QStringList(); +#endif +} + +void QWebPagePrivate::emitViewportChangeRequested() +{ + emit q->viewportChangeRequested(); +} + void QWebPagePrivate::updateEditorActions() { updateAction(QWebPage::Cut); @@ -682,8 +925,7 @@ void QWebPagePrivate::timerEvent(QTimerEvent *ev) q->timerEvent(ev); } -template<class T> -void QWebPagePrivate::mouseMoveEvent(T* ev) +void QWebPagePrivate::mouseMoveEvent(QMouseEvent* ev) { WebCore::Frame* frame = QWebFramePrivate::core(mainFrame.data()); if (!frame->view()) @@ -693,8 +935,7 @@ void QWebPagePrivate::mouseMoveEvent(T* ev) ev->setAccepted(accepted); } -template<class T> -void QWebPagePrivate::mousePressEvent(T* ev) +void QWebPagePrivate::mousePressEvent(QMouseEvent* ev) { WebCore::Frame* frame = QWebFramePrivate::core(mainFrame.data()); if (!frame->view()) @@ -729,8 +970,7 @@ void QWebPagePrivate::mousePressEvent(T* ev) clickCausedFocus = true; } -template<class T> -void QWebPagePrivate::mouseDoubleClickEvent(T *ev) +void QWebPagePrivate::mouseDoubleClickEvent(QMouseEvent *ev) { WebCore::Frame* frame = QWebFramePrivate::core(mainFrame.data()); if (!frame->view()) @@ -747,8 +987,7 @@ void QWebPagePrivate::mouseDoubleClickEvent(T *ev) tripleClick = QPointF(ev->pos()).toPoint(); } -template<class T> -void QWebPagePrivate::mouseTripleClickEvent(T *ev) +void QWebPagePrivate::mouseTripleClickEvent(QMouseEvent *ev) { WebCore::Frame* frame = QWebFramePrivate::core(mainFrame.data()); if (!frame->view()) @@ -762,8 +1001,7 @@ void QWebPagePrivate::mouseTripleClickEvent(T *ev) ev->setAccepted(accepted); } -template<class T> -void QWebPagePrivate::mouseReleaseEvent(T *ev) +void QWebPagePrivate::mouseReleaseEvent(QMouseEvent *ev) { WebCore::Frame* frame = QWebFramePrivate::core(mainFrame.data()); if (!frame->view()) @@ -790,7 +1028,7 @@ void QWebPagePrivate::handleSoftwareInputPanel(Qt::MouseButton button, const QPo && frame->document()->focusedNode() && button == Qt::LeftButton && qApp->autoSipEnabled()) { QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel( - client->ownerWidget()->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel)); + client->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel)); if (!clickCausedFocus || behavior == QStyle::RSIP_OnMouseClick) { HitTestResult result = frame->eventHandler()->hitTestResultAtPoint(frame->view()->windowToContents(pos), false); if (result.isContentEditable()) { @@ -833,14 +1071,13 @@ QMenu *QWebPage::createStandardContextMenu() } #ifndef QT_NO_WHEELEVENT -template<class T> -void QWebPagePrivate::wheelEvent(T *ev) +void QWebPagePrivate::wheelEvent(QWheelEvent *ev) { WebCore::Frame* frame = QWebFramePrivate::core(mainFrame.data()); if (!frame->view()) return; - PlatformWheelEvent pev = convertWheelEvent(ev); + PlatformWheelEvent pev = convertWheelEvent(ev, QApplication::wheelScrollLines()); bool accepted = frame->eventHandler()->handleWheelEvent(pev); ev->setAccepted(accepted); } @@ -1340,33 +1577,39 @@ bool QWebPagePrivate::touchEvent(QTouchEvent* event) bool QWebPagePrivate::gestureEvent(QGestureEvent* event) { -#if ENABLE(GESTURE_EVENTS) - WebCore::Frame* frame = QWebFramePrivate::core(mainFrame.data()); - if (!frame->view()) + QWebFrameAdapter* frame = mainFrame.data()->d; + if (!frame->hasView()) return false; - // QGestureEvents can contain updates for multiple gestures. bool handled = false; +#if ENABLE(GESTURE_EVENTS) + // QGestureEvent lives in Widgets, we'll need a dummy struct to mule the info it contains to the "other side" + QGestureEventFacade gestureFacade; + QGesture* gesture = event->gesture(Qt::TapGesture); // Beware that gestures send by DumpRenderTree will have state Qt::NoGesture, // due to not originating from a GestureRecognizer. if (gesture && (gesture->state() == Qt::GestureStarted || gesture->state() == Qt::NoGesture)) { - frame->eventHandler()->handleGestureEvent(convertGesture(event, gesture)); - event->setAccepted(true); + gestureFacade.type = Qt::TapGesture; + QPointF globalPos = static_cast<const QTapGesture*>(gesture)->position(); + gestureFacade.globalPos = globalPos.toPoint(); + gestureFacade.pos = event->widget()->mapFromGlobal(globalPos.toPoint()); + frame->handleGestureEvent(&gestureFacade); handled = true; } gesture = event->gesture(Qt::TapAndHoldGesture); if (gesture && (gesture->state() == Qt::GestureStarted || gesture->state() == Qt::NoGesture)) { - frame->eventHandler()->sendContextMenuEventForGesture(convertGesture(event, gesture)); - event->setAccepted(true); + gestureFacade.type = Qt::TapAndHoldGesture; + QPointF globalPos = static_cast<const QTapAndHoldGesture*>(gesture)->position(); + gestureFacade.globalPos = globalPos.toPoint(); + gestureFacade.pos = event->widget()->mapFromGlobal(globalPos.toPoint()); + frame->handleGestureEvent(&gestureFacade); handled = true; } +#endif // ENABLE(GESTURE_EVENTS) + event->setAccepted(handled); return handled; -#else - event->ignore(); - return false; -#endif } /*! @@ -2037,12 +2280,12 @@ void QWebPage::setView(QWidget* view) if (d->client) { if (d->client->isQWidgetClient()) - static_cast<PageClientQWidget*>(d->client.get())->view = view; + static_cast<PageClientQWidget*>(d->client.data())->view = view; return; } if (view) - d->client = adoptPtr(new PageClientQWidget(view, this)); + d->client.reset(new PageClientQWidget(view, this)); } /*! @@ -2068,7 +2311,7 @@ void QWebPage::javaScriptConsoleMessage(const QString& message, int lineNumber, // Catch plugin logDestroy message for LayoutTests/plugins/open-and-close-window-with-plugin.html // At this point DRT's WebPage has already been destroyed - if (QWebPagePrivate::drtRun) { + if (QWebPageAdapter::drtRun) { if (message == QLatin1String("PLUGIN: NPP_Destroy")) { fprintf(stdout, "CONSOLE MESSAGE: "); if (lineNumber) @@ -2088,8 +2331,7 @@ void QWebPage::javaScriptAlert(QWebFrame *frame, const QString& msg) { Q_UNUSED(frame) #ifndef QT_NO_MESSAGEBOX - QWidget* parent = (d->client) ? d->client->ownerWidget() : 0; - QMessageBox box(parent); + QMessageBox box(view()); box.setWindowTitle(tr("JavaScript Alert - %1").arg(mainFrame()->url().host())); box.setTextFormat(Qt::PlainText); box.setText(msg); @@ -2110,8 +2352,7 @@ bool QWebPage::javaScriptConfirm(QWebFrame *frame, const QString& msg) #ifdef QT_NO_MESSAGEBOX return true; #else - QWidget* parent = (d->client) ? d->client->ownerWidget() : 0; - QMessageBox box(parent); + QMessageBox box(view()); box.setWindowTitle(tr("JavaScript Confirm - %1").arg(mainFrame()->url().host())); box.setTextFormat(Qt::PlainText); box.setText(msg); @@ -2136,8 +2377,7 @@ bool QWebPage::javaScriptPrompt(QWebFrame *frame, const QString& msg, const QStr bool ok = false; #ifndef QT_NO_INPUTDIALOG - QWidget* parent = (d->client) ? d->client->ownerWidget() : 0; - QInputDialog dlg(parent); + QInputDialog dlg(view()); dlg.setWindowTitle(tr("JavaScript Prompt - %1").arg(mainFrame()->url().host())); // Hack to force the dialog's QLabel into plain text mode @@ -2171,18 +2411,13 @@ bool QWebPage::javaScriptPrompt(QWebFrame *frame, const QString& msg, const QStr If the user wanted to stop the JavaScript the implementation should return true; otherwise false. The default implementation executes the query using QMessageBox::information with QMessageBox::Yes and QMessageBox::No buttons. - - \warning Because of binary compatibility constraints, this function is not virtual. If you want to - provide your own implementation in a QWebPage subclass, reimplement the shouldInterruptJavaScript() - slot in your subclass instead. QtWebKit will dynamically detect the slot and call it. */ bool QWebPage::shouldInterruptJavaScript() { #ifdef QT_NO_MESSAGEBOX return false; #else - QWidget* parent = (d->client) ? d->client->ownerWidget() : 0; - return QMessageBox::Yes == QMessageBox::information(parent, tr("JavaScript Problem - %1").arg(mainFrame()->url().host()), tr("The script on this page appears to have a problem. Do you want to stop the script?"), QMessageBox::Yes, QMessageBox::No); + return QMessageBox::Yes == QMessageBox::information(view(), tr("JavaScript Problem - %1").arg(mainFrame()->url().host()), tr("The script on this page appears to have a problem. Do you want to stop the script?"), QMessageBox::Yes, QMessageBox::No); #endif } @@ -2197,7 +2432,8 @@ void QWebPage::setFeaturePermission(QWebFrame* frame, Feature feature, Permissio break; case Geolocation: #if ENABLE(GEOLOCATION) - GeolocationPermissionClientQt::geolocationPermissionClient()->setPermission(frame, policy); + if (policy != PermissionUnknown) + GeolocationPermissionClientQt::geolocationPermissionClient()->setPermission(frame->d, (policy == PermissionGrantedByUser)); #endif break; @@ -2461,20 +2697,146 @@ QColor QWebPagePrivate::colorSelectionRequested(const QColor &selectedColor) { QColor ret = selectedColor; #ifndef QT_NO_COLORDIALOG - QWidget* parent = (client) ? client->ownerWidget() : 0; - ret = QColorDialog::getColor(selectedColor, parent); + ret = QColorDialog::getColor(selectedColor, q->view()); if (!ret.isValid()) ret = selectedColor; #endif return ret; } +QWebSelectMethod *QWebPagePrivate::createSelectPopup() +{ + return new QtFallbackWebPopup(this); +} + +QRect QWebPagePrivate::viewRectRelativeToWindow() +{ + + QWidget* ownerWidget= client.isNull() ? 0 : qobject_cast<QWidget*>(client->ownerWidget()); + if (!ownerWidget) + return QRect(); + QWidget* topLevelWidget = ownerWidget->window(); + + QPoint topLeftCorner = ownerWidget->mapFrom(topLevelWidget, QPoint(0, 0)); + return QRect(topLeftCorner, ownerWidget->size()); +} + +void QWebPagePrivate::geolocationPermissionRequested(QWebFrameAdapter* frame) +{ + emit q->featurePermissionRequested(QWebFramePrivate::kit(frame), QWebPage::Geolocation); +} + +void QWebPagePrivate::geolocationPermissionRequestCancelled(QWebFrameAdapter* frame) +{ + emit q->featurePermissionRequestCanceled(QWebFramePrivate::kit(frame), QWebPage::Geolocation); +} + +void QWebPagePrivate::notificationsPermissionRequested(QWebFrameAdapter* frame) +{ + emit q->featurePermissionRequested(QWebFramePrivate::kit(frame), QWebPage::Notifications); +} + +void QWebPagePrivate::notificationsPermissionRequestCancelled(QWebFrameAdapter* frame) +{ + emit q->featurePermissionRequestCanceled(QWebFramePrivate::kit(frame), QWebPage::Notifications); +} + +void QWebPagePrivate::respondToChangedContents() +{ + updateEditorActions(); + + emit q->contentsChanged(); +} + +void QWebPagePrivate::respondToChangedSelection() +{ + updateEditorActions(); + emit q->selectionChanged(); +} + +void QWebPagePrivate::microFocusChanged() +{ + emit q->microFocusChanged(); +} + +void QWebPagePrivate::triggerCopyAction() +{ + q->triggerAction(QWebPage::Copy); +} + +void QWebPagePrivate::triggerActionForKeyEvent(QKeyEvent* event) +{ + QWebPage::WebAction action = editorActionForKeyEvent(event); + q->triggerAction(action); +} + +void QWebPagePrivate::clearUndoStack() +{ +#ifndef QT_NO_UNDOSTACK + if (undoStack) + undoStack->clear(); +#endif +} + +bool QWebPagePrivate::canUndo() const +{ +#ifndef QT_NO_UNDOSTACK + if (!undoStack) + return false; + return undoStack->canUndo(); +#else + return false; +#endif +} + +bool QWebPagePrivate::canRedo() const +{ +#ifndef QT_NO_UNDOSTACK + if (!undoStack) + return false; + return undoStack->canRedo(); +#else + return false; +#endif +} + +void QWebPagePrivate::undo() +{ +#ifndef QT_NO_UNDOSTACK + if (undoStack) + undoStack->undo(); +#endif +} + +void QWebPagePrivate::redo() +{ +#ifndef QT_NO_UNDOSTACK + if (undoStack) + undoStack->redo(); +#endif +} + +void QWebPagePrivate::createUndoStep(QSharedPointer<UndoStepQt> step) +{ +#ifndef QT_NO_UNDOSTACK + // Call undoStack() getter first to ensure stack is created + // if it doesn't exist yet. + q->undoStack()->push(new QWebUndoCommand(step)); +#endif +} + +const char *QWebPagePrivate::editorCommandForKeyEvent(QKeyEvent* event) +{ + QWebPage::WebAction action = editorActionForKeyEvent(event); + return editorCommandForWebActions(action); +} + QSize QWebPage::viewportSize() const { if (d->mainFrame && d->mainFrame.data()->d->frame->view()) return d->mainFrame.data()->d->frame->view()->frameRect().size(); - return d->viewportSize; + return d->m_viewportSize; } /*! @@ -2491,7 +2853,7 @@ QSize QWebPage::viewportSize() const */ void QWebPage::setViewportSize(const QSize &size) const { - d->viewportSize = size; + d->m_viewportSize = size; QWebFrame *frame = mainFrame(); if (frame->d->frame && frame->d->frame->view()) { @@ -2577,7 +2939,7 @@ QWebPage::ViewportAttributes QWebPage::viewportAttributesForSize(const QSize& av // Both environment variables need to be set - or they will be ignored. if (deviceWidth < 0 && deviceHeight < 0) { - QSize size = queryDeviceSizeForScreenContainingWidget((d->client) ? d->client->ownerWidget() : 0); + QSize size = queryDeviceSizeForScreenContainingWidget(view()); deviceWidth = size.width(); deviceHeight = size.height(); } @@ -3093,18 +3455,34 @@ bool QWebPage::event(QEvent *ev) d->mouseReleaseEvent(static_cast<QMouseEvent*>(ev)); break; #if !defined(QT_NO_GRAPHICSVIEW) - case QEvent::GraphicsSceneMouseMove: - d->mouseMoveEvent(static_cast<QGraphicsSceneMouseEvent*>(ev)); + case QEvent::GraphicsSceneMouseMove: { + QGraphicsSceneMouseEvent *gsEv = static_cast<QGraphicsSceneMouseEvent*>(ev); + QMouseEvent dummyEvent(QEvent::MouseMove, gsEv->pos(), gsEv->screenPos(), gsEv->button(), gsEv->buttons(), gsEv->modifiers()); + d->mouseMoveEvent(&dummyEvent); + ev->setAccepted(dummyEvent.isAccepted()); break; - case QEvent::GraphicsSceneMousePress: - d->mousePressEvent(static_cast<QGraphicsSceneMouseEvent*>(ev)); + } + case QEvent::GraphicsSceneMouseRelease: { + QGraphicsSceneMouseEvent *gsEv = static_cast<QGraphicsSceneMouseEvent*>(ev); + QMouseEvent dummyEvent(QEvent::MouseButtonRelease, gsEv->pos(), gsEv->screenPos(), gsEv->button(), gsEv->buttons(), gsEv->modifiers()); + d->mouseReleaseEvent(&dummyEvent); + ev->setAccepted(dummyEvent.isAccepted()); break; - case QEvent::GraphicsSceneMouseDoubleClick: - d->mouseDoubleClickEvent(static_cast<QGraphicsSceneMouseEvent*>(ev)); + } + case QEvent::GraphicsSceneMousePress: { + QGraphicsSceneMouseEvent *gsEv = static_cast<QGraphicsSceneMouseEvent*>(ev); + QMouseEvent dummyEvent(QEvent::MouseButtonPress, gsEv->pos(), gsEv->screenPos(), gsEv->button(), gsEv->buttons(), gsEv->modifiers()); + d->mousePressEvent(&dummyEvent); + ev->setAccepted(dummyEvent.isAccepted()); break; - case QEvent::GraphicsSceneMouseRelease: - d->mouseReleaseEvent(static_cast<QGraphicsSceneMouseEvent*>(ev)); + } + case QEvent::GraphicsSceneMouseDoubleClick: { + QGraphicsSceneMouseEvent *gsEv = static_cast<QGraphicsSceneMouseEvent*>(ev); + QMouseEvent dummyEvent(QEvent::MouseButtonDblClick, gsEv->pos(), gsEv->screenPos(), gsEv->button(), gsEv->buttons(), gsEv->modifiers()); + d->mouseDoubleClickEvent(&dummyEvent); + ev->setAccepted(dummyEvent.isAccepted()); break; + } #endif #ifndef QT_NO_CONTEXTMENU case QEvent::ContextMenu: @@ -3121,9 +3499,13 @@ bool QWebPage::event(QEvent *ev) d->wheelEvent(static_cast<QWheelEvent*>(ev)); break; #if !defined(QT_NO_GRAPHICSVIEW) - case QEvent::GraphicsSceneWheel: - d->wheelEvent(static_cast<QGraphicsSceneWheelEvent*>(ev)); + case QEvent::GraphicsSceneWheel: { + QGraphicsSceneWheelEvent *gsEv = static_cast<QGraphicsSceneWheelEvent*>(ev); + QWheelEvent dummyEvent(gsEv->pos(), gsEv->screenPos(), gsEv->delta(), gsEv->buttons(), gsEv->modifiers(), gsEv->orientation()); + d->wheelEvent(&dummyEvent); + ev->setAccepted(dummyEvent.isAccepted()); break; + } #endif #endif case QEvent::KeyPress: @@ -3639,8 +4021,7 @@ bool QWebPage::extension(Extension extension, const ExtensionOption *option, Ext if (extension == ChooseMultipleFilesExtension) { // FIXME: do not ignore suggestedFiles QStringList suggestedFiles = static_cast<const ChooseMultipleFilesExtensionOption*>(option)->suggestedFileNames; - QWidget* parent = (d->client) ? d->client->ownerWidget() : 0; - QStringList names = QFileDialog::getOpenFileNames(parent, QString::null); + QStringList names = QFileDialog::getOpenFileNames(view(), QString::null); static_cast<ChooseMultipleFilesExtensionReturn*>(output)->fileNames = names; return true; } @@ -3665,6 +4046,14 @@ bool QWebPage::supportsExtension(Extension extension) const } /*! + * \internal + */ +QWebPageAdapter *QWebPage::handle() const +{ + return d; +} + +/*! Finds the specified string, \a subString, in the page, using the given \a options. If the HighlightAllOccurrences flag is passed, the function will highlight all occurrences @@ -3732,8 +4121,7 @@ QString QWebPage::chooseFile(QWebFrame *parentFrame, const QString& suggestedFil { Q_UNUSED(parentFrame) #ifndef QT_NO_FILEDIALOG - QWidget* parent = (d->client) ? d->client->ownerWidget() : 0; - return QFileDialog::getOpenFileName(parent, QString::null, suggestedFile); + return QFileDialog::getOpenFileName(view(), QString::null, suggestedFile); #else return QString::null; #endif @@ -3750,11 +4138,7 @@ QString QWebPage::chooseFile(QWebFrame *parentFrame, const QString& suggestedFil */ void QWebPage::setNetworkAccessManager(QNetworkAccessManager *manager) { - if (manager == d->networkManager) - return; - if (d->networkManager && d->networkManager->parent() == this) - delete d->networkManager; - d->networkManager = manager; + d->setNetworkAccessManager(manager); } /*! @@ -3765,11 +4149,7 @@ void QWebPage::setNetworkAccessManager(QNetworkAccessManager *manager) */ QNetworkAccessManager *QWebPage::networkAccessManager() const { - if (!d->networkManager) { - QWebPage *that = const_cast<QWebPage *>(this); - that->d->networkManager = new QNetworkAccessManager(that); - } - return d->networkManager; + return d->networkAccessManager(); } /*! diff --git a/Source/WebKit/qt/Api/qwebpage.h b/Source/WebKit/qt/Api/qwebpage.h index b2caa131d..bb5421fcc 100644 --- a/Source/WebKit/qt/Api/qwebpage.h +++ b/Source/WebKit/qt/Api/qwebpage.h @@ -46,6 +46,7 @@ class QWebFrameData; class QWebHistoryItem; class QWebHitTestResult; class QWebNetworkInterface; +class QWebPageAdapter; class QWebPagePrivate; class QWebPluginFactory; class QWebSecurityOrigin; @@ -365,10 +366,9 @@ public: virtual bool extension(Extension extension, const ExtensionOption *option = 0, ExtensionReturn *output = 0); virtual bool supportsExtension(Extension extension) const; - inline QWebPagePrivate* handle() const { return d; } + QWebPageAdapter* handle() const; -public Q_SLOTS: - bool shouldInterruptJavaScript(); + virtual bool shouldInterruptJavaScript(); Q_SIGNALS: void loadStarted(); diff --git a/Source/WebKit/qt/Api/qwebpage_p.h b/Source/WebKit/qt/Api/qwebpage_p.h index 794322991..2434dd653 100644 --- a/Source/WebKit/qt/Api/qwebpage_p.h +++ b/Source/WebKit/qt/Api/qwebpage_p.h @@ -21,29 +21,22 @@ #ifndef QWEBPAGE_P_H #define QWEBPAGE_P_H -#include <QPointer> +#include "QWebPageAdapter.h" + +#include "qwebframe.h" +#include "qwebhistory.h" +#include "qwebpage.h" +#include <QPointer> #include <qbasictimer.h> -#include <qnetworkproxy.h> #include <qevent.h> #include <qgesture.h> #include <qgraphicssceneevent.h> +#include <qgraphicswidget.h> +#include <qnetworkproxy.h> -#include "qwebpage.h" -#include "qwebhistory.h" -#include "qwebframe.h" - -#include "IntPoint.h" -#include "KURL.h" - -#include <wtf/OwnPtr.h> -#include <wtf/RefPtr.h> -#include <wtf/text/WTFString.h> - -#include "ViewportArguments.h" namespace WebCore { - class ChromeClientQt; class ContextMenuClientQt; class ContextMenuItem; class ContextMenu; @@ -54,7 +47,6 @@ namespace WebCore { class IntRect; class Node; class NodeList; - class Page; class Frame; } @@ -64,8 +56,10 @@ class QMenu; class QBitArray; QT_END_NAMESPACE +class QtPluginWidgetAdapter; class QWebInspector; -class QWebPageClient; +class QWebFrameAdapter; +class UndoStepQt; class QtViewportAttributesPrivate : public QSharedData { public: @@ -76,13 +70,74 @@ public: QWebPage::ViewportAttributes* q; }; -class QWebPagePrivate { +class QWebPagePrivate : public QWebPageAdapter { public: QWebPagePrivate(QWebPage*); ~QWebPagePrivate(); static WebCore::Page* core(const QWebPage*); - static QWebPagePrivate* priv(QWebPage*); + + // Adapter implementation + virtual void show() OVERRIDE; + virtual void setFocus() OVERRIDE; + virtual void unfocus() OVERRIDE; + virtual void setWindowRect(const QRect &) OVERRIDE; + virtual QSize viewportSize() const OVERRIDE; + virtual QWebPageAdapter* createWindow(bool /*dialog*/) OVERRIDE; + virtual QObject* handle() OVERRIDE { return q; } + virtual void javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID) OVERRIDE; + virtual void javaScriptAlert(QWebFrameAdapter*, const QString& msg) OVERRIDE; + virtual bool javaScriptConfirm(QWebFrameAdapter*, const QString& msg) OVERRIDE; + virtual bool javaScriptPrompt(QWebFrameAdapter*, const QString& msg, const QString& defaultValue, QString* result) OVERRIDE; + virtual bool shouldInterruptJavaScript() OVERRIDE; + virtual void printRequested(QWebFrameAdapter*) OVERRIDE; + virtual void databaseQuotaExceeded(QWebFrameAdapter*, const QString& databaseName) OVERRIDE; + virtual void applicationCacheQuotaExceeded(QWebSecurityOrigin*, quint64 defaultOriginQuota, quint64 totalSpaceNeeded) OVERRIDE; + virtual void setToolTip(const QString&) OVERRIDE; +#if USE(QT_MULTIMEDIA) + virtual QWebFullScreenVideoHandler* createFullScreenVideoHandler() OVERRIDE; +#endif + virtual QWebFrameAdapter* mainFrameAdapter() OVERRIDE; + virtual QStringList chooseFiles(QWebFrameAdapter*, bool allowMultiple, const QStringList& suggestedFileNames) OVERRIDE; + virtual QColor colorSelectionRequested(const QColor& selectedColor) OVERRIDE; + virtual QWebSelectMethod* createSelectPopup() OVERRIDE; + virtual QRect viewRectRelativeToWindow() OVERRIDE; + virtual void geolocationPermissionRequested(QWebFrameAdapter*) OVERRIDE; + virtual void geolocationPermissionRequestCancelled(QWebFrameAdapter*) OVERRIDE; + virtual void notificationsPermissionRequested(QWebFrameAdapter*) OVERRIDE; + virtual void notificationsPermissionRequestCancelled(QWebFrameAdapter*) OVERRIDE; + + virtual void respondToChangedContents() OVERRIDE; + virtual void respondToChangedSelection() OVERRIDE; + virtual void microFocusChanged() OVERRIDE; + virtual void triggerCopyAction() OVERRIDE; + virtual void triggerActionForKeyEvent(QKeyEvent*) OVERRIDE; + virtual void clearUndoStack() OVERRIDE; + virtual bool canUndo() const OVERRIDE; + virtual bool canRedo() const OVERRIDE; + virtual void undo() OVERRIDE; + virtual void redo() OVERRIDE; + virtual void createUndoStep(QSharedPointer<UndoStepQt>) OVERRIDE; + virtual const char* editorCommandForKeyEvent(QKeyEvent*) OVERRIDE; + + void updateNavigationActions() OVERRIDE; + + virtual QObject* inspectorHandle() OVERRIDE; + virtual void setInspectorFrontend(QObject*) OVERRIDE; + virtual void setInspectorWindowTitle(const QString&) OVERRIDE; + virtual void createWebInspector(QObject** inspectorView, QWebPageAdapter** inspectorPage) OVERRIDE; + virtual QStringList menuActionsAsText() OVERRIDE; + virtual void emitViewportChangeRequested() OVERRIDE; + virtual bool acceptNavigationRequest(QWebFrameAdapter*, const QNetworkRequest&, int type) OVERRIDE; + virtual void emitRestoreFrameStateRequested(QWebFrameAdapter*) OVERRIDE; + virtual void emitSaveFrameStateRequested(QWebFrameAdapter*, QWebHistoryItem*) OVERRIDE; + virtual void emitDownloadRequested(const QNetworkRequest&) OVERRIDE; + virtual void emitFrameCreated(QWebFrameAdapter*) OVERRIDE; + virtual QString userAgentForUrl(const QUrl &url) const OVERRIDE { return q->userAgentForUrl(url); } + virtual bool supportsErrorPageExtension() const OVERRIDE { return q->supportsExtension(QWebPage::ErrorPageExtension); } + virtual bool errorPageExtension(ErrorPageOption *, ErrorPageReturn *) OVERRIDE; + virtual QtPluginWidgetAdapter* createPlugin(const QString &, const QUrl &, const QStringList &, const QStringList &) OVERRIDE; + virtual QtPluginWidgetAdapter* adapterForWidget(QObject *) const OVERRIDE; void createMainFrame(); #ifndef QT_NO_CONTEXTMENU @@ -92,23 +147,20 @@ public: void _q_webActionTriggered(bool checked); void _q_cleanupLeakMessages(); void updateAction(QWebPage::WebAction action); - void updateNavigationActions(); void updateEditorActions(); - QColor colorSelectionRequested(const QColor& selectedColor); - void timerEvent(QTimerEvent*); - template<class T> void mouseMoveEvent(T*); - template<class T> void mousePressEvent(T*); - template<class T> void mouseDoubleClickEvent(T*); - template<class T> void mouseTripleClickEvent(T*); - template<class T> void mouseReleaseEvent(T*); + void mouseMoveEvent(QMouseEvent*); + void mousePressEvent(QMouseEvent*); + void mouseDoubleClickEvent(QMouseEvent*); + void mouseTripleClickEvent(QMouseEvent*); + void mouseReleaseEvent(QMouseEvent*); #ifndef QT_NO_CONTEXTMENU void contextMenuEvent(const QPoint& globalPos); #endif #ifndef QT_NO_WHEELEVENT - template<class T> void wheelEvent(T*); + void wheelEvent(QWheelEvent*); #endif void keyPressEvent(QKeyEvent*); void keyReleaseEvent(QKeyEvent*); @@ -159,16 +211,12 @@ public: WebCore::InspectorController* inspectorController(); quint16 inspectorServerPort(); - WebCore::ViewportArguments viewportArguments(); - #ifndef QT_NO_SHORTCUT static QWebPage::WebAction editorActionForKeyEvent(QKeyEvent* event); #endif static const char* editorCommandForWebActions(QWebPage::WebAction action); QWebPage *q; - WebCore::Page *page; - OwnPtr<QWebPageClient> client; QPointer<QWebFrame> mainFrame; #ifndef QT_NO_UNDOSTACK @@ -177,7 +225,6 @@ public: QPointer<QWidget> view; - bool insideOpenCall; quint64 m_totalBytes; quint64 m_bytesReceived; @@ -186,15 +233,9 @@ public: bool clickCausedFocus; - bool acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, QWebPage::NavigationType type); - QNetworkAccessManager *networkManager; - - bool forwardUnsupportedContent; - bool smartInsertDeleteEnabled; - bool selectTrailingWhitespaceEnabled; QWebPage::LinkDelegationPolicy linkPolicy; - QSize viewportSize; + QSize m_viewportSize; QSize fixedLayoutSize; QWebHistory history; @@ -202,20 +243,15 @@ public: #ifndef QT_NO_CONTEXTMENU QPointer<QMenu> currentContextMenu; #endif - QWebSettings *settings; QPalette palette; bool useFixedLayout; QAction *actions[QWebPage::WebActionCount]; - QWebPluginFactory *pluginFactory; - QWidget* inspectorFrontend; QWebInspector* inspector; bool inspectorIsInternalOnly; // True if created through the Inspect context menu action Qt::DropAction m_lastDropAction; - - static bool drtRun; }; #endif diff --git a/Source/WebKit/qt/Api/qwebsettings.cpp b/Source/WebKit/qt/Api/qwebsettings.cpp index 768c80256..74d8524d8 100644 --- a/Source/WebKit/qt/Api/qwebsettings.cpp +++ b/Source/WebKit/qt/Api/qwebsettings.cpp @@ -20,41 +20,39 @@ #include "config.h" #include "qwebsettings.h" -#include "qwebpage.h" -#include "qwebpage_p.h" #include "qwebplugindatabase_p.h" #include "AbstractDatabase.h" -#include "MemoryCache.h" +#include "ApplicationCacheStorage.h" #include "CrossOriginPreflightResultCache.h" +#include "DatabaseTracker.h" +#include "FileSystem.h" #include "FontCache.h" +#include "IconDatabase.h" +#include "Image.h" #if ENABLE(ICONDATABASE) #include "IconDatabaseClientQt.h" #endif #include "InitWebCoreQt.h" +#include "IntSize.h" +#include "KURL.h" +#include "MemoryCache.h" +#include "NetworkStateNotifier.h" #include "Page.h" #include "PageCache.h" -#include "Settings.h" -#include "KURL.h" -#include "IconDatabase.h" #include "PluginDatabase.h" -#include "Image.h" -#include "IntSize.h" -#include "ApplicationCacheStorage.h" -#include "DatabaseTracker.h" -#include "FileSystem.h" -#include <wtf/text/WTFString.h> - -#include <QApplication> -#include <QStandardPaths> +#include "Settings.h" #include <QDir> +#include <QFileInfo> +#include <QFont> +#include <QGuiApplication> #include <QHash> #include <QSharedData> +#include <QStandardPaths> #include <QUrl> -#include <QFileInfo> -#include <QStyle> +#include <wtf/text/WTFString.h> + -#include "NetworkStateNotifier.h" void QWEBKIT_EXPORT qt_networkAccessAllowed(bool isAllowed) { diff --git a/Source/WebKit/qt/Api/qwebsettings.h b/Source/WebKit/qt/Api/qwebsettings.h index 5e7d3e1b4..49721b7cb 100644 --- a/Source/WebKit/qt/Api/qwebsettings.h +++ b/Source/WebKit/qt/Api/qwebsettings.h @@ -163,6 +163,7 @@ public: inline QWebSettingsPrivate* handle() const { return d; } private: + friend class QWebPageAdapter; friend class QWebPagePrivate; friend class QWebSettingsPrivate; diff --git a/Source/WebKit/qt/Api/qwebview.cpp b/Source/WebKit/qt/Api/qwebview.cpp index 9f2af5787..2eda6a18e 100644 --- a/Source/WebKit/qt/Api/qwebview.cpp +++ b/Source/WebKit/qt/Api/qwebview.cpp @@ -227,9 +227,9 @@ void QWebViewPrivate::detachCurrentPage() // to destroy it. if (page->d->client && page->d->client->isQWidgetClient()) - page->d->client.clear(); + page->d->client.reset(); - page->d->client.release(); + page->d->client.take(); // if the page was created by us, we own it and need to // destroy it as well. diff --git a/Source/WebKit/qt/ChangeLog b/Source/WebKit/qt/ChangeLog index f0791bfc0..4b0852a0c 100644 --- a/Source/WebKit/qt/ChangeLog +++ b/Source/WebKit/qt/ChangeLog @@ -1,3 +1,662 @@ +2012-11-23 Allan Sandfeld Jensen <allan.jensen@digia.com> + + tst_qwebpage fails after QMimeDatabase patch + https://bugs.webkit.org/show_bug.cgi?id=103125 + + Reviewed by Simon Hausmann. + + Replace the static extension->mimetype table with a QMimeDatabase lookup + + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::findText): + (tst_QWebPage::supportedContentType): + +2012-11-23 Simon Hausmann <simon.hausmann@digia.com> + + [Qt] Compiling against QtWebkit API requires QT_DLL to be defined + https://bugs.webkit.org/show_bug.cgi?id=102942 + + Reviewed by Tor Arne Vestbø. + + Remove the requirement of having QT_DLL defined in order for the QWEBKIT_EXPORT + macro to be defined as Q_DECL_IMPORT. Instead unify the export macro definition + to follow the same rules as other Qt 5 modules, with the exception that instead of + QT_BUILD_WEBKIT_LIB we continue to use BUILDING_WEBKIT, because that's used also + in other cross-platform header files to determine the correct meaning of export + macros. + + * Api/qwebkitglobal.h: + +2012-11-23 Simon Hausmann <simon.hausmann@digia.com> + + [Qt] QWebPage::shouldInterruptJavaScript should be virtual in Qt 5 + https://bugs.webkit.org/show_bug.cgi?id=103111 + + Reviewed by Kenneth Rohde Christiansen. + + This function was added as a slot during Qt 4.x times because adding + virtual functions breaks binary compatibility. This constraint is gone + with the initial release of WebKit with Qt 5, and therefore we can + make it virtual now. + + The change is fully source compatible as existing "re-implementations" + as slots will now be called through it being a virtual function. They + become unused slots. + + * Api/qwebpage.cpp: + (QWebPagePrivate::shouldInterruptJavaScript): + * Api/qwebpage.h: + * Api/qwebpage_p.h: + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::shouldInterruptJavaScript): + * WebCoreSupport/QWebPageAdapter.h: + (QWebPageAdapter): + * tests/qwebpage/tst_qwebpage.cpp: + (JSTestPage::shouldInterruptJavaScript): + (JSTestPage): + +2012-11-23 Pierre Rossi <pierre.rossi@gmail.com> + + [Qt] REGRESSION(r135515): 3 appcache tests still failing + https://bugs.webkit.org/show_bug.cgi?id=103073 + + Rubber-stamped by Simon Hausmann. + + Another sneaky typo. + + * Api/qwebpage.cpp: + (QWebPagePrivate::applicationCacheQuotaExceeded): + +2012-11-22 Pierre Rossi <pierre.rossi@gmail.com> + + [Qt] Avoid initializing PlatformStrategies twice. + + Rubber-stamped by Simon Hausmann. + + This fixes another regression introduced in r135515: + initializeWebKitQt shouldn't implicitely call initializeWebCoreQt + since it can be called from WebKit2 to initialize QStyle for testing. + This would then lead to things such as PlatformStrategies being + initialized twice. + + * Api/qwebpage.cpp: Explicitely call initializeWebCoreQt(). + (QWebPagePrivate::QWebPagePrivate): + * WebCoreSupport/InitWebCoreQt.cpp: + (WebKit::initializeWebKitQt): + +2012-11-23 Simon Hausmann <simon.hausmann@digia.com> + + Unreviewed trivial Qt/Win build fix: + + Include FormState.h/HTMLFormElement.h in the FrameLoaderClient + declaration because MSVC needs it. Also fix Q_DECL_EXPORT declarations + for functions that are supposed to be exported. + + * Api/qwebelement.cpp: + * WebCoreSupport/FrameLoaderClientQt.h: + * WebCoreSupport/InitWebCoreQt.h: + (WebKit): + * WebCoreSupport/InitWebKitQt.h: + (WebKit): + +2012-11-22 Pierre Rossi <pierre.rossi@gmail.com> + + [Qt] REGRESSION(r135515): It made 3-3 tests fail and crash + https://bugs.webkit.org/show_bug.cgi?id=103073 + + Rubber-stamped by Simon Hausmann. + + Removing the QNetworkAccessManager member in FrameNetworkingContextQt + was right, but we need to be careful as to how we fetch it back. + Since the WebCore Page is not always valid, get the QNAM instance + straight from the frame adapter through its page adapter instead. + + * WebCoreSupport/ChromeClientQt.cpp: [Style nit] Remove stray emit. + * WebCoreSupport/FrameNetworkingContextQt.cpp: + (WebCore::FrameNetworkingContextQt::networkAccessManager): + +2012-11-22 Simon Hausmann <simon.hausmann@digia.com> + + Unreviewed MSVC Windows build fix: Include header files referenced in RefPtr + instances. + + * Api/qwebelement.cpp: + +2012-11-22 Simon Hausmann <simon.hausmann@digia.com>, Pierre Rossi <pierre.rossi@digia.com> + + [Qt] Separate QWidget dependant code into separate WebKitWidgets static library + https://bugs.webkit.org/show_bug.cgi?id=102800 + + Reviewed by Tor Arne Vestbø. + + This patch separates code that needs to use QWidget related APIs in + WebKit/qt/WebCoreSupport and Api from code that doesn't. This means for + example FrameLoaderClientQt.cpp remains in the WebKit1 static library, + while qwebpage.cpp and qwebframe.cpp become part of the WebKitWidgets + static library. WebKit1 is compiled without QT += widgets and therefore + any widget related dependency has been moved "up" and out of WebKit1 into + the WebKitWidgets library. + + Between the code in WebKit.a and WebKitWidgets.a new adapters and + interfaces have been introduced, such as QWebPageAdapter and + QWebFrameAdapter. QWebPageAdapter, when used from WebKit1, is a way to + call out into the API layer, implemented by QWebPage (QWebPagePrivate). + The other way around if QWebPage wants to access WebCore or + WebCoreSupport related functionality, it will go through + QWebPageAdapater (as base class). The separation in the direction up + into the API layer is complete with this patch, no code in WebKit1 + depends on QtWidgets. The separation the other way around, code in the + API layer not using any WebCore types, is not complete yet. + + Some classes such as QWebSettings, QWebElement or + DumpRenderTreeSupportQt remain in WebKit1. While they are API layer, + they do not depend on widget related Qt APIs and they make much more + use of WebCore internal APIs and therefore are easier to keep in + WebKit1. + + In the future we plan to place a real shared library boundary between + WebKit1 and WebKitWidgets, by keeping the WebKit1 static library as + part of the QtWebKit shared library and by turning the WebKitWidgets + static library into a shared one. + + + * Api/qgraphicswebview.cpp: + (QGraphicsWebViewPrivate::pageClient): + (QGraphicsWebViewPrivate::detachCurrentPage): + (QGraphicsWebView::setPage): + * Api/qwebelement.cpp: + (QWebElement::webFrame): + * Api/qwebframe.cpp: + (QWebFramePrivate::setPage): + (QWebFramePrivate::didStartProvisionalLoad): + (QWebFramePrivate::handleProgressFinished): + (QWebFramePrivate::emitInitialLayoutCompleted): + (QWebFramePrivate::emitIconChanged): + (QWebFramePrivate::emitLoadStarted): + (QWebFramePrivate::emitLoadFinished): + (QWebFramePrivate::createChildFrame): + (QWebFramePrivate::apiHandle): + (QWebFramePrivate::handle): + (QWebFramePrivate::contentsSizeDidChange): + (QWebFramePrivate::scrollBarPolicy): + (QWebFrame::QWebFrame): + (QWebFrame::~QWebFrame): + (QWebFrame::setUrl): + (QWebFrame::load): + (QWebFrame::scrollPosition): + (QWebFrame::geometry): + (QWebFramePrivate::kit): + (QWebFrame::handle): + * Api/qwebframe.h: + * Api/qwebframe_p.h: + (QWebFramePrivate::QWebFramePrivate): + (QWebFramePrivate): + * Api/qwebhistory.cpp: + (QWebHistoryPrivate::page): + * Api/qwebhistory_p.h: + (QWebHistoryPrivate): + * Api/qwebinspector.cpp: + (QWebInspectorPrivate::setFrontend): + * Api/qwebinspector_p.h: + (QWebInspectorPrivate): + * Api/qwebpage.cpp: + (QWebPagePrivate::QWebPagePrivate): + (QWebPagePrivate::~QWebPagePrivate): + (QWebPagePrivate::core): + (QWebPagePrivate::show): + (QWebPagePrivate::setFocus): + (QWebPagePrivate::unfocus): + (QWebPagePrivate::setWindowRect): + (QWebPagePrivate::viewportSize): + (QWebPagePrivate::createWindow): + (QWebPagePrivate::javaScriptConsoleMessage): + (QWebPagePrivate::javaScriptAlert): + (QWebPagePrivate::javaScriptConfirm): + (QWebPagePrivate::javaScriptPrompt): + (QWebPagePrivate::printRequested): + (QWebPagePrivate::databaseQuotaExceeded): + (QWebPagePrivate::applicationCacheQuotaExceeded): + (QWebPagePrivate::setToolTip): + (QWebPagePrivate::createFullScreenVideoHandler): + (QWebPagePrivate::mainFrameAdapter): + (QWebPagePrivate::chooseFiles): + (QWebPagePrivate::acceptNavigationRequest): + (QWebPagePrivate::emitRestoreFrameStateRequested): + (QWebPagePrivate::emitSaveFrameStateRequested): + (QWebPagePrivate::emitDownloadRequested): + (QWebPagePrivate::emitFrameCreated): + (QWebPagePrivate::errorPageExtension): + (QWebPagePrivate::createPlugin): + (QWebPagePrivate::adapterForWidget): + (QWebPagePrivate::createMainFrame): + (QWebPagePrivate::createContextMenu): + (QWebPagePrivate::inspectorHandle): + (QWebPagePrivate::setInspectorFrontend): + (QWebPagePrivate::setInspectorWindowTitle): + (QWebPagePrivate::createWebInspector): + (iterateContextMenu): + (QWebPagePrivate::menuActionsAsText): + (QWebPagePrivate::emitViewportChangeRequested): + (QWebPagePrivate::mouseMoveEvent): + (QWebPagePrivate::mousePressEvent): + (QWebPagePrivate::mouseDoubleClickEvent): + (QWebPagePrivate::mouseTripleClickEvent): + (QWebPagePrivate::mouseReleaseEvent): + (QWebPagePrivate::handleSoftwareInputPanel): + (QWebPagePrivate::wheelEvent): + (QWebPagePrivate::gestureEvent): + (QWebPage::setView): + (QWebPage::javaScriptConsoleMessage): + (QWebPage::javaScriptAlert): + (QWebPage::javaScriptConfirm): + (QWebPage::javaScriptPrompt): + (QWebPage::shouldInterruptJavaScript): + (QWebPage::setFeaturePermission): + (QWebPagePrivate::colorSelectionRequested): + (QWebPagePrivate::createSelectPopup): + (QWebPagePrivate::viewRectRelativeToWindow): + (QWebPagePrivate::geolocationPermissionRequested): + (QWebPagePrivate::geolocationPermissionRequestCancelled): + (QWebPagePrivate::notificationsPermissionRequested): + (QWebPagePrivate::notificationsPermissionRequestCancelled): + (QWebPagePrivate::respondToChangedContents): + (QWebPagePrivate::respondToChangedSelection): + (QWebPagePrivate::microFocusChanged): + (QWebPagePrivate::triggerCopyAction): + (QWebPagePrivate::triggerActionForKeyEvent): + (QWebPagePrivate::clearUndoStack): + (QWebPagePrivate::canUndo): + (QWebPagePrivate::canRedo): + (QWebPagePrivate::undo): + (QWebPagePrivate::redo): + (QWebPagePrivate::createUndoStep): + (QWebPagePrivate::editorCommandForKeyEvent): + (QWebPage::viewportSize): + (QWebPage::setViewportSize): + (QWebPage::viewportAttributesForSize): + (QWebPage::event): + (QWebPage::extension): + (QWebPage::handle): + (QWebPage::chooseFile): + (QWebPage::setNetworkAccessManager): + (QWebPage::networkAccessManager): + * Api/qwebpage.h: + * Api/qwebpage_p.h: + (WebCore): + (QWebPagePrivate): + * Api/qwebsettings.cpp: + * Api/qwebsettings.h: + * Api/qwebview.cpp: + (QWebViewPrivate::detachCurrentPage): + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::ChromeClientQt): + (WebCore::ChromeClientQt::setWindowRect): + (WebCore::ChromeClientQt::focus): + (WebCore::ChromeClientQt::unfocus): + (WebCore::ChromeClientQt::createWindow): + (WebCore::ChromeClientQt::show): + (WebCore::ChromeClientQt::setToolbarsVisible): + (WebCore::ChromeClientQt::setStatusbarVisible): + (WebCore::ChromeClientQt::setMenubarVisible): + (WebCore::ChromeClientQt::addMessageToConsole): + (WebCore::ChromeClientQt::closeWindowSoon): + (WebCore::ChromeClientQt::runJavaScriptAlert): + (WebCore::ChromeClientQt::runJavaScriptConfirm): + (WebCore::ChromeClientQt::runJavaScriptPrompt): + (WebCore::ChromeClientQt::setStatusbarText): + (WebCore::ChromeClientQt::shouldInterruptJavaScript): + (WebCore::ChromeClientQt::keyboardUIMode): + (WebCore::ChromeClientQt::windowResizerRect): + * WebCoreSupport/ChromeClientQt.h: + (ChromeClientQt): + * WebCoreSupport/ContextMenuClientQt.cpp: + * WebCoreSupport/ContextMenuClientQt.h: + (ContextMenuClientQt): + * WebCoreSupport/DefaultFullScreenVideoHandler.cpp: Added. + (DefaultFullScreenVideoHandler::DefaultFullScreenVideoHandler): + (DefaultFullScreenVideoHandler::~DefaultFullScreenVideoHandler): + (DefaultFullScreenVideoHandler::requiresFullScreenForVideoPlayback): + (DefaultFullScreenVideoHandler::enterFullScreen): + (DefaultFullScreenVideoHandler::exitFullScreen): + * WebCoreSupport/DefaultFullScreenVideoHandler.h: Copied from Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h. + (WebKit): + (DefaultFullScreenVideoHandler): + * WebCoreSupport/DragClientQt.cpp: + (WebCore::DragClientQt::startDrag): + * WebCoreSupport/DragClientQt.h: + (WebCore): + (WebCore::DragClientQt::DragClientQt): + (DragClientQt): + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (toGeolocationClientMock): + (toDeviceOrientationClientMock): + (DumpRenderTreeSupportQt::initialize): + (DumpRenderTreeSupportQt::setDumpRenderTreeModeEnabled): + (DumpRenderTreeSupportQt::setFrameFlatteningEnabled): + (DumpRenderTreeSupportQt::webPageSetGroupName): + (DumpRenderTreeSupportQt::webPageGroupName): + (DumpRenderTreeSupportQt::webInspectorExecuteScript): + (DumpRenderTreeSupportQt::webInspectorShow): + (DumpRenderTreeSupportQt::webInspectorClose): + (DumpRenderTreeSupportQt::hasDocumentElement): + (DumpRenderTreeSupportQt::pauseAnimation): + (DumpRenderTreeSupportQt::pauseTransitionOfProperty): + (DumpRenderTreeSupportQt::numberOfActiveAnimations): + (DumpRenderTreeSupportQt::clearFrameName): + (DumpRenderTreeSupportQt::setCaretBrowsingEnabled): + (DumpRenderTreeSupportQt::setAuthorAndUserStylesEnabled): + (DumpRenderTreeSupportQt::setSmartInsertDeleteEnabled): + (DumpRenderTreeSupportQt::setSelectTrailingWhitespaceEnabled): + (DumpRenderTreeSupportQt::executeCoreCommandByName): + (DumpRenderTreeSupportQt::isCommandEnabled): + (DumpRenderTreeSupportQt::findString): + (DumpRenderTreeSupportQt::selectedRange): + (DumpRenderTreeSupportQt::firstRectForCharacterRange): + (DumpRenderTreeSupportQt::elementDoesAutoCompleteForElementWithId): + (DumpRenderTreeSupportQt::setWindowsBehaviorAsEditingBehavior): + (DumpRenderTreeSupportQt::viewportAsText): + (DumpRenderTreeSupportQt::scalePageBy): + (DumpRenderTreeSupportQt::setMockDeviceOrientation): + (DumpRenderTreeSupportQt::resetGeolocationMock): + (DumpRenderTreeSupportQt::setMockGeolocationPermission): + (DumpRenderTreeSupportQt::setMockGeolocationPosition): + (DumpRenderTreeSupportQt::setMockGeolocationPositionUnavailableError): + (DumpRenderTreeSupportQt::numberOfPendingGeolocationPermissionRequests): + (DumpRenderTreeSupportQt::shouldClose): + (DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld): + (DumpRenderTreeSupportQt::addUserStyleSheet): + (DumpRenderTreeSupportQt::removeUserStyleSheets): + (DumpRenderTreeSupportQt::setDefersLoading): + (DumpRenderTreeSupportQt::goBack): + (DumpRenderTreeSupportQt::responseMimeType): + (DumpRenderTreeSupportQt::clearOpener): + (DumpRenderTreeSupportQt::setInteractiveFormValidationEnabled): + (DumpRenderTreeSupportQt::contextMenu): + (DumpRenderTreeSupportQt::setMinimumTimerInterval): + (DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows): + (DumpRenderTreeSupportQt::mediaContentUrlByElementId): + (DumpRenderTreeSupportQt::setAlternateHtml): + (DumpRenderTreeSupportQt::confirmComposition): + (DumpRenderTreeSupportQt::injectInternalsObject): + (DumpRenderTreeSupportQt::resetInternalsObject): + (DumpRenderTreeSupportQt::paintPagesWithBoundaries): + (DumpRenderTreeSupportQt::setTrackRepaintRects): + (DumpRenderTreeSupportQt::trackRepaintRects): + (DumpRenderTreeSupportQt::getTrackedRepaintRects): + * WebCoreSupport/DumpRenderTreeSupportQt.h: + * WebCoreSupport/EditorClientQt.cpp: + (dumpRange): + (WebCore::EditorClientQt::shouldShowDeleteInterface): + (WebCore::EditorClientQt::shouldInsertText): + (WebCore::EditorClientQt::shouldChangeSelectedRange): + (WebCore::EditorClientQt::shouldApplyStyle): + (WebCore::EditorClientQt::respondToChangedContents): + (WebCore::EditorClientQt::respondToChangedSelection): + (WebCore::EditorClientQt::registerUndoStep): + (WebCore::EditorClientQt::clearUndoRedoOperations): + (WebCore::EditorClientQt::canUndo): + (WebCore::EditorClientQt::canRedo): + (WebCore::EditorClientQt::undo): + (WebCore::EditorClientQt::redo): + (WebCore::EditorClientQt::shouldInsertNode): + (WebCore::EditorClientQt::smartInsertDeleteEnabled): + (WebCore::EditorClientQt::toggleSmartInsertDelete): + (WebCore::EditorClientQt::isSelectTrailingWhitespaceEnabled): + (WebCore::EditorClientQt::handleKeyboardEvent): + (WebCore::EditorClientQt::EditorClientQt): + (WebCore::EditorClientQt::setInputMethodState): + * WebCoreSupport/EditorClientQt.h: + (EditorClientQt): + (WebCore::EditorClientQt::setSmartInsertDeleteEnabled): + (WebCore::EditorClientQt::setSelectTrailingWhitespaceEnabled): + * WebCoreSupport/FrameLoaderClientQt.cpp: + (drtDescriptionSuitableForTestResult): + (WebCore::FrameLoaderClientQt::setFrame): + (WebCore::FrameLoaderClientQt::transitionToCommittedForNewPage): + (WebCore::FrameLoaderClientQt::dispatchDidChangeLocationWithinPage): + (WebCore::FrameLoaderClientQt::dispatchDidStartProvisionalLoad): + (WebCore::FrameLoaderClientQt::dispatchDidCommitLoad): + (WebCore::FrameLoaderClientQt::dispatchDidFinishDocumentLoad): + (WebCore::FrameLoaderClientQt::dispatchDidFinishLoad): + (WebCore::FrameLoaderClientQt::dispatchDidLayout): + (WebCore::FrameLoaderClientQt::dispatchWillSubmitForm): + (WebCore::FrameLoaderClientQt::postProgressStartedNotification): + (WebCore::FrameLoaderClientQt::postProgressFinishedNotification): + (WebCore::FrameLoaderClientQt::frameLoadCompleted): + (WebCore::FrameLoaderClientQt::restoreViewState): + (WebCore::FrameLoaderClientQt::userAgent): + (WebCore::FrameLoaderClientQt::dispatchDidReceiveIcon): + (WebCore::FrameLoaderClientQt::frameLoaderDestroyed): + (WebCore::FrameLoaderClientQt::dispatchDidClearWindowObjectInWorld): + (WebCore::FrameLoaderClientQt::didPerformFirstNavigation): + (WebCore::FrameLoaderClientQt::onIconLoadedForPageURL): + (WebCore::FrameLoaderClientQt::updateGlobalHistoryRedirectLinks): + (WebCore::FrameLoaderClientQt::saveViewStateToItem): + (WebCore::FrameLoaderClientQt::cancelledError): + (WebCore::FrameLoaderClientQt::blockedError): + (WebCore::FrameLoaderClientQt::cannotShowURLError): + (WebCore::FrameLoaderClientQt::interruptedForPolicyChangeError): + (WebCore::FrameLoaderClientQt::cannotShowMIMETypeError): + (WebCore::FrameLoaderClientQt::fileDoesNotExistError): + (WebCore::FrameLoaderClientQt::pluginWillHandleLoadError): + (WebCore::FrameLoaderClientQt::download): + (WebCore::FrameLoaderClientQt::dispatchWillSendRequest): + (WebCore::FrameLoaderClientQt::dispatchDidReceiveResponse): + (WebCore::FrameLoaderClientQt::dispatchDidFinishLoading): + (WebCore::FrameLoaderClientQt::dispatchDidFailLoading): + (WebCore::FrameLoaderClientQt::callErrorPageExtension): + (WebCore::FrameLoaderClientQt::dispatchCreatePage): + (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction): + (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction): + (WebCore::FrameLoaderClientQt::startDownload): + (WebCore::FrameLoaderClientQt::createFrame): + (WebCore::FrameLoaderClientQt::createPlugin): + (WebCore::FrameLoaderClientQt::createJavaAppletWidget): + (WebCore::FrameLoaderClientQt::chooseFile): + (WebCore::FrameLoaderClientQt::createNetworkingContext): + (WebCore): + (WebCore::FrameLoaderClientQt::webFrame): + (WebCore::FrameLoaderClientQt::emitLoadStarted): + (WebCore::FrameLoaderClientQt::emitLoadFinished): + * WebCoreSupport/FrameLoaderClientQt.h: + (FrameLoaderClientQt): + * WebCoreSupport/FrameNetworkingContextQt.cpp: + (WebCore::FrameNetworkingContextQt::FrameNetworkingContextQt): + (WebCore::FrameNetworkingContextQt::create): + (WebCore::FrameNetworkingContextQt::networkAccessManager): + * WebCoreSupport/FrameNetworkingContextQt.h: + (FrameNetworkingContextQt): + * WebCoreSupport/FullScreenVideoQt.cpp: + (WebCore): + (WebCore::FullScreenVideoQt::FullScreenVideoQt): + * WebCoreSupport/FullScreenVideoQt.h: + (WebCore): + * WebCoreSupport/FullScreenVideoWidget.cpp: + * WebCoreSupport/FullScreenVideoWidget.h: + * WebCoreSupport/GeolocationClientQt.cpp: + (WebCore::GeolocationClientQt::GeolocationClientQt): + (WebCore::GeolocationClientQt::positionUpdated): + (WebCore::GeolocationClientQt::startUpdating): + (WebCore::GeolocationClientQt::requestPermission): + (WebCore::GeolocationClientQt::cancelPermissionRequest): + * WebCoreSupport/GeolocationClientQt.h: + (GeolocationClientQt): + * WebCoreSupport/GeolocationPermissionClientQt.cpp: + (WebCore::GeolocationPermissionClientQt::requestGeolocationPermissionForFrame): + (WebCore::GeolocationPermissionClientQt::cancelGeolocationPermissionRequestForFrame): + (WebCore::GeolocationPermissionClientQt::setPermission): + * WebCoreSupport/GeolocationPermissionClientQt.h: + (GeolocationPermissionClientQt): + * WebCoreSupport/InitWebCoreQt.cpp: + (WebKit): + (WebKit::setWebKitWidgetsInitCallback): + (WebKit::initializeWebKitQt): + (WebKit::setImagePlatformResource): + (WebCore::initializeWebCoreQt): + * WebCoreSupport/InitWebCoreQt.h: + (WebCore): + (WebKit): + * WebCoreSupport/InitWebKitQt.cpp: Added. + (WebKit): + (WebKit::initializeWebKitWidgets): + * WebCoreSupport/InitWebKitQt.h: Copied from Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h. + (WebKit): + * WebCoreSupport/InspectorClientQt.cpp: + (WebCore): + (WebCore::InspectorClientQt::InspectorClientQt): + (WebCore::InspectorClientQt::openInspectorFrontend): + (WebCore::InspectorClientQt::attachAndReplaceRemoteFrontend): + (WebCore::InspectorClientQt::detachRemoteFrontend): + (WebCore::InspectorClientQt::hideHighlight): + (WebCore::InspectorClientQt::sendMessageToFrontend): + (WebCore::InspectorFrontendClientQt::InspectorFrontendClientQt): + (WebCore::InspectorFrontendClientQt::updateWindowTitle): + (WebCore::InspectorFrontendClientQt::destroyInspectorView): + * WebCoreSupport/InspectorClientQt.h: + (InspectorClientQt): + (InspectorFrontendClientQt): + * WebCoreSupport/InspectorClientWebPage.cpp: Added. + (InspectorClientWebPage::InspectorClientWebPage): + (InspectorClientWebPage::createWindow): + (InspectorClientWebPage::javaScriptWindowObjectCleared): + * WebCoreSupport/InspectorClientWebPage.h: Copied from Source/WebKit/qt/WebCoreSupport/WebSystemInterface.h. + (WebKit): + (InspectorClientWebPage): + * WebCoreSupport/InspectorServerQt.cpp: + (WebCore::InspectorServerRequestHandlerQt::tcpReadyRead): + (WebCore::InspectorServerRequestHandlerQt::webSocketReadyRead): + * WebCoreSupport/InspectorServerQt.h: + (InspectorServerQt): + (InspectorServerRequestHandlerQt): + * WebCoreSupport/NotificationPresenterClientQt.cpp: + (WebCore::NotificationWrapper::NotificationWrapper): + (WebCore::NotificationPresenterClientQt::displayNotification): + (WebCore::NotificationPresenterClientQt::requestPermission): + (WebCore::NotificationPresenterClientQt::cancelRequestsForPermission): + (WebCore::NotificationPresenterClientQt::dumpShowText): + (WebCore::NotificationPresenterClientQt::toPage): + (WebCore::NotificationPresenterClientQt::toFrame): + * WebCoreSupport/NotificationPresenterClientQt.h: + (WebCore::NotificationWrapper::~NotificationWrapper): + (NotificationWrapper): + (NotificationPresenterClientQt): + (WebCore::NotificationPresenterClientQt::hasSystemTrayIcon): + (WebCore::NotificationPresenterClientQt::setSystemTrayIcon): + (CallbacksInfo): + (WebCore): + * WebCoreSupport/PageClientQt.cpp: + (createPlatformGraphicsContext3DFromWidget): + (QWebPageClient::ownerWindow): + (WebCore::PageClientQWidget::ownerWidget): + (WebCore::PageClientQWidget::createPlatformGraphicsContext3D): + (WebCore::PageClientQGraphicsWidget::ownerWidget): + (WebCore::PageClientQGraphicsWidget::createPlatformGraphicsContext3D): + * WebCoreSupport/PageClientQt.h: + (PageClientQWidget): + (WebCore::QGraphicsItemOverlay::QGraphicsItemOverlay): + (WebCore::PageClientQGraphicsWidget::PageClientQGraphicsWidget): + (PageClientQGraphicsWidget): + * WebCoreSupport/PlatformStrategiesQt.cpp: + (PlatformStrategiesQt::getPluginInfo): + * WebCoreSupport/PopupMenuQt.cpp: + (SelectData::SelectData): + * WebCoreSupport/QGraphicsWidgetPluginImpl.cpp: Added. + (QGraphicsWidgetPluginImpl::~QGraphicsWidgetPluginImpl): + (QGraphicsWidgetPluginImpl::update): + (QGraphicsWidgetPluginImpl::setGeometryAndClip): + (QGraphicsWidgetPluginImpl::setVisible): + (QGraphicsWidgetPluginImpl::setWidgetParent): + (QGraphicsWidgetPluginImpl::handle): + * WebCoreSupport/QGraphicsWidgetPluginImpl.h: Added. + (QGraphicsWidgetPluginImpl): + (QGraphicsWidgetPluginImpl::QGraphicsWidgetPluginImpl): + * WebCoreSupport/QWebFrameAdapter.cpp: Added. + (cacheLoadControlToCachePolicy): + (QWebFrameData::QWebFrameData): + (QWebFrameAdapter::QWebFrameAdapter): + (QWebFrameAdapter::~QWebFrameAdapter): + (QWebFrameAdapter::load): + (QWebFrameAdapter::handleGestureEvent): + (QWebFrameAdapter::scrollPosition): + (QWebFrameAdapter::frameRect): + (QWebFrameAdapter::init): + (QWebFrameAdapter::kit): + (QWebFrameAdapter::ensureAbsoluteUrl): + * WebCoreSupport/QWebFrameAdapter.h: Added. + (WebCore): + (QWebFrameData): + (QWebFrameAdapter): + (QWebFrameAdapter::hasView): + * WebCoreSupport/QWebPageAdapter.cpp: Added. + (QWebPageAdapter::QWebPageAdapter): + (QWebPageAdapter::~QWebPageAdapter): + (QWebPageAdapter::init): + (QWebPageAdapter::deletePage): + (QWebPageAdapter::kit): + (QWebPageAdapter::viewportArguments): + (QWebPageAdapter::registerUndoStep): + (QWebPageAdapter::setNetworkAccessManager): + (QWebPageAdapter::networkAccessManager): + * WebCoreSupport/QWebPageAdapter.h: Added. + (WebCore): + (QWebPageAdapter): + (ErrorPageOption): + (ErrorPageReturn): + * WebCoreSupport/QWebUndoCommand.cpp: Copied from Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h. + (QWebUndoCommand::QWebUndoCommand): + (QWebUndoCommand::undo): + (QWebUndoCommand::redo): + * WebCoreSupport/QWebUndoCommand.h: Copied from Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h. + (QWebUndoCommand): + * WebCoreSupport/QWidgetPluginImpl.cpp: Added. + (QWidgetPluginImpl::~QWidgetPluginImpl): + (QWidgetPluginImpl::update): + (QWidgetPluginImpl::setGeometryAndClip): + (QWidgetPluginImpl::setVisible): + (QWidgetPluginImpl::setStyleSheet): + (QWidgetPluginImpl::setWidgetParent): + (QWidgetPluginImpl::handle): + * WebCoreSupport/QWidgetPluginImpl.h: Copied from Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h. + (QWidgetPluginImpl): + (QWidgetPluginImpl::QWidgetPluginImpl): + * WebCoreSupport/QtFallbackWebPopup.cpp: + (WebCore::QtFallbackWebPopup::QtFallbackWebPopup): + (WebCore::QtFallbackWebPopup::show): + (WebCore::QtFallbackWebPopup::pageClient): + * WebCoreSupport/QtFallbackWebPopup.h: + (QtFallbackWebPopup): + * WebCoreSupport/QtPluginWidgetAdapter.h: Copied from Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h. + (QtPluginWidgetAdapter): + * WebCoreSupport/QtWebComboBox.cpp: + (WebCore::QtWebComboBox::showPopupAtCursorPosition): + * WebCoreSupport/QtWebComboBox.h: + * WebCoreSupport/SearchPopupMenuQt.h: + (SearchPopupMenuQt): + * WebCoreSupport/UndoStepQt.cpp: + (UndoStepQt::UndoStepQt): + (UndoStepQt::text): + * WebCoreSupport/UndoStepQt.h: + (UndoStepQt): + * WebCoreSupport/WebEventConversion.cpp: + (WebCore::mouseEventTypeAndMouseButtonFromQEvent): + (WebKitPlatformWheelEvent): + (WebCore::WebKitPlatformWheelEvent::applyDelta): + (WebCore::WebKitPlatformWheelEvent::WebKitPlatformWheelEvent): + (WebKitPlatformGestureEvent): + (WebCore::toPlatformEventType): + (WebCore::WebKitPlatformGestureEvent::WebKitPlatformGestureEvent): + (WebCore): + (WebCore::convertWheelEvent): + (WebCore::convertGesture): + * WebCoreSupport/WebEventConversion.h: + (QGestureEventFacade): + (WebCore): + * WebCoreSupport/WebSystemInterface.h: + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::loadHtml5Video): + (tst_QWebPage::multiplePageGroupsAndLocalStorage): + (tst_QWebPage::thirdPartyCookiePolicy): + 2012-11-21 Allan Sandfeld Jensen <allan.jensen@digia.com> Position in QWebHitTestResult does not match documentation diff --git a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp index eaaeb012f..05f7b949d 100644 --- a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp @@ -53,27 +53,25 @@ #include "NetworkingContext.h" #include "NotImplemented.h" #include "Page.h" -#include "PageClientQt.h" #include "PopupMenuQt.h" -#include "QtFallbackWebPopup.h" +#include "QWebFrameAdapter.h" +#include "QWebPageAdapter.h" #include "QWebPageClient.h" #include "ScrollbarTheme.h" #include "SearchPopupMenuQt.h" #include "SecurityOrigin.h" +#include "TiledBackingStore.h" #include "ViewportArguments.h" #include "WindowFeatures.h" - -#include "qgraphicswebview.h" -#include "qwebframe_p.h" -#include "qwebpage.h" -#include "qwebpage_p.h" +#include "qwebkitplatformplugin.h" #include "qwebsecurityorigin.h" #include "qwebsecurityorigin_p.h" -#include "qwebview.h" +#include "qwebsettings.h" + #include <qabstractanimation.h> #include <qdebug.h> #include <qeventloop.h> -#include <qtooltip.h> +#include <qwindow.h> #include <wtf/OwnPtr.h> #if ENABLE(VIDEO) && ((USE(GSTREAMER) && !defined(GST_API_VERSION_1)) || USE(QT_MULTIMEDIA) || USE(QTKIT)) @@ -124,8 +122,8 @@ private: bool ChromeClientQt::dumpVisitedLinksCallbacks = false; -ChromeClientQt::ChromeClientQt(QWebPage* webPage) - : m_webPage(webPage) +ChromeClientQt::ChromeClientQt(QWebPageAdapter* webPageAdapter) + : m_webPage(webPageAdapter) , m_eventLoop(0) #if ENABLE(VIDEO) && ((USE(GSTREAMER) && !defined(GST_API_VERSION_1)) || USE(QT_MULTIMEDIA) || USE(QTKIT)) , m_fullScreenVideo(0) @@ -148,8 +146,7 @@ void ChromeClientQt::setWindowRect(const FloatRect& rect) { if (!m_webPage) return; - emit m_webPage->geometryChangeRequested(QRect(qRound(rect.x()), qRound(rect.y()), - qRound(rect.width()), qRound(rect.height()))); + m_webPage->setWindowRect(QRect(qRound(rect.x()), qRound(rect.y()), qRound(rect.width()), qRound(rect.height()))); } /*! @@ -182,11 +179,7 @@ void ChromeClientQt::focus() { if (!m_webPage) return; - QWidget* view = m_webPage->view(); - if (!view) - return; - - view->setFocus(); + m_webPage->setFocus(); } @@ -194,10 +187,7 @@ void ChromeClientQt::unfocus() { if (!m_webPage) return; - QWidget* view = m_webPage->view(); - if (!view) - return; - view->clearFocus(); + m_webPage->unfocus(); } bool ChromeClientQt::canTakeFocus(FocusDirection) @@ -227,24 +217,18 @@ void ChromeClientQt::focusedFrameChanged(Frame*) Page* ChromeClientQt::createWindow(Frame*, const FrameLoadRequest& request, const WindowFeatures& features, const NavigationAction&) { - QWebPage* newPage = m_webPage->createWindow(features.dialog ? QWebPage::WebModalDialog : QWebPage::WebBrowserWindow); + QWebPageAdapter* newPage = m_webPage->createWindow(features.dialog); if (!newPage) return 0; - // A call to QWebPage::mainFrame() implicitly creates the main frame. - // Make sure it exists, as WebCore expects it when returning from this call. - newPage->mainFrame(); - return newPage->d->page; + return newPage->page; } void ChromeClientQt::show() { if (!m_webPage) return; - QWidget* view = m_webPage->view(); - if (!view) - return; - view->window()->show(); + m_webPage->show(); } @@ -266,7 +250,7 @@ void ChromeClientQt::runModal() void ChromeClientQt::setToolbarsVisible(bool visible) { toolBarsVisible = visible; - emit m_webPage->toolBarVisibilityChangeRequested(visible); + QMetaObject::invokeMethod(m_webPage->handle(), "toolBarVisibilityChangeRequested", Q_ARG(bool, visible)); } @@ -278,7 +262,7 @@ bool ChromeClientQt::toolbarsVisible() void ChromeClientQt::setStatusbarVisible(bool visible) { - emit m_webPage->statusBarVisibilityChangeRequested(visible); + QMetaObject::invokeMethod(m_webPage->handle(), "statusBarVisibilityChangeRequested", Q_ARG(bool, visible)); statusBarVisible = visible; } @@ -305,7 +289,7 @@ bool ChromeClientQt::scrollbarsVisible() void ChromeClientQt::setMenubarVisible(bool visible) { menuBarVisible = visible; - emit m_webPage->menuBarVisibilityChangeRequested(visible); + QMetaObject::invokeMethod(m_webPage->handle(), "menuBarVisibilityChangeRequested", Q_ARG(bool, visible)); } bool ChromeClientQt::menubarVisible() @@ -318,8 +302,7 @@ void ChromeClientQt::setResizable(bool) notImplemented(); } -void ChromeClientQt::addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, - unsigned int lineNumber, const String& sourceID) +void ChromeClientQt::addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceID) { QString x = message; QString y = sourceID; @@ -343,30 +326,26 @@ bool ChromeClientQt::runBeforeUnloadConfirmPanel(const String& message, Frame* f void ChromeClientQt::closeWindowSoon() { - m_webPage->d->page->setGroupName(String()); - m_webPage->mainFrame()->d->frame->loader()->stopAllLoaders(); - emit m_webPage->windowCloseRequested(); + m_webPage->page->setGroupName(String()); + m_webPage->page->mainFrame()->loader()->stopAllLoaders(); + QMetaObject::invokeMethod(m_webPage->handle(), "windowCloseRequested"); } void ChromeClientQt::runJavaScriptAlert(Frame* f, const String& msg) { - QString x = msg; - QWebFrame* webFrame = qobject_cast<QWebFrame*>(f->loader()->networkingContext()->originatingObject()); - m_webPage->javaScriptAlert(webFrame, x); + m_webPage->javaScriptAlert(QWebFrameAdapter::kit(f), msg); } bool ChromeClientQt::runJavaScriptConfirm(Frame* f, const String& msg) { - QString x = msg; - QWebFrame* webFrame = qobject_cast<QWebFrame*>(f->loader()->networkingContext()->originatingObject()); - return m_webPage->javaScriptConfirm(webFrame, x); + return m_webPage->javaScriptConfirm(QWebFrameAdapter::kit(f), msg); } bool ChromeClientQt::runJavaScriptPrompt(Frame* f, const String& message, const String& defaultValue, String& result) { QString x = result; - QWebFrame* webFrame = qobject_cast<QWebFrame*>(f->loader()->networkingContext()->originatingObject()); - bool rc = m_webPage->javaScriptPrompt(webFrame, (QString)message, (QString)defaultValue, &x); + QWebFrameAdapter* webFrame = QWebFrameAdapter::kit(f); + bool rc = m_webPage->javaScriptPrompt(webFrame, message, defaultValue, &x); // Fix up a quirk in the QInputDialog class. If no input happened the string should be empty // but it is null. See https://bugs.webkit.org/show_bug.cgi?id=30914. @@ -381,19 +360,17 @@ bool ChromeClientQt::runJavaScriptPrompt(Frame* f, const String& message, const void ChromeClientQt::setStatusbarText(const String& msg) { QString x = msg; - emit m_webPage->statusBarMessage(x); + QMetaObject::invokeMethod(m_webPage->handle(), "statusBarMessage", Q_ARG(QString, x)); } bool ChromeClientQt::shouldInterruptJavaScript() { - bool shouldInterrupt = false; - QMetaObject::invokeMethod(m_webPage, "shouldInterruptJavaScript", Qt::DirectConnection, Q_RETURN_ARG(bool, shouldInterrupt)); - return shouldInterrupt; + return m_webPage->shouldInterruptJavaScript(); } KeyboardUIMode ChromeClientQt::keyboardUIMode() { - return m_webPage->settings()->testAttribute(QWebSettings::LinksIncludedInFocusChain) + return m_webPage->settings->testAttribute(QWebSettings::LinksIncludedInFocusChain) ? KeyboardAccessTabsToLinks : KeyboardAccessDefault; } @@ -407,11 +384,10 @@ IntRect ChromeClientQt::windowResizerRect() const if (!pageClient) return IntRect(); - QWidget* ownerWidget = pageClient->ownerWidget(); - if (!ownerWidget) + QWindow* topLevelWidget = pageClient->ownerWindow(); + if (!topLevelWidget) return IntRect(); - QWidget* topLevelWidget = ownerWidget->window(); QRect topLevelGeometry(topLevelWidget->geometry()); // There's no API in Qt to query for the size of the resizer, so we assume @@ -423,12 +399,13 @@ IntRect ChromeClientQt::windowResizerRect() const // it might even be on the lower left side of the window, but in WebKit we // always draw scrollbars on the right hand side, so we assume this to be the // location when computing the resize rect to reserve for WebKit. - QPoint resizeCornerTopLeft = ownerWidget->mapFrom(topLevelWidget, - QPoint(topLevelGeometry.width(), topLevelGeometry.height()) - - QPoint(scollbarThickness, scollbarThickness)); + QPoint resizeCornerTopLeft = QPoint(topLevelGeometry.width(), topLevelGeometry.height()) + - QPoint(scollbarThickness, scollbarThickness)) + - m_webPage->viewRectRelativeToWindow().topLeft(); QRect resizeCornerRect = QRect(resizeCornerTopLeft, QSize(scollbarThickness, scollbarThickness)); return resizeCornerRect.intersected(pageClient->geometryRelativeToOwnerWidget()); + #else return IntRect(); #endif @@ -438,7 +415,7 @@ void ChromeClientQt::invalidateRootView(const IntRect& windowRect, bool) { #if USE(TILED_BACKING_STORE) if (platformPageClient()) { - WebCore::TiledBackingStore* backingStore = QWebFramePrivate::core(m_webPage->mainFrame())->tiledBackingStore(); + WebCore::TiledBackingStore* backingStore = m_webPage->mainFrameAdapter()->frame->tiledBackingStore(); if (!backingStore) return; backingStore->invalidate(windowRect); @@ -448,7 +425,7 @@ void ChromeClientQt::invalidateRootView(const IntRect& windowRect, bool) #endif } -void ChromeClientQt::invalidateContentsAndRootView(const IntRect& windowRect, bool immediate) +void ChromeClientQt::invalidateContentsAndRootView(const IntRect& windowRect, bool) { // No double buffer, so only update the QWidget if content changed. if (platformPageClient()) { @@ -457,9 +434,9 @@ void ChromeClientQt::invalidateContentsAndRootView(const IntRect& windowRect, bo if (!rect.isEmpty()) platformPageClient()->update(rect); } - QMetaObject::invokeMethod(m_webPage, "repaintRequested", Qt::QueuedConnection, Q_ARG(QRect, windowRect)); + QMetaObject::invokeMethod(m_webPage->handle(), "repaintRequested", Qt::QueuedConnection, Q_ARG(QRect, windowRect)); - // FIXME: There is no "immediate" support for window painting. This should be done always whenever the flag + // FIXME: There is no "immediate" support for window painting. This should be done always whenever the flag // is set. } @@ -472,14 +449,18 @@ void ChromeClientQt::scroll(const IntSize& delta, const IntRect& scrollViewRect, { if (platformPageClient()) platformPageClient()->scroll(delta.width(), delta.height(), scrollViewRect); - emit m_webPage->scrollRequested(delta.width(), delta.height(), scrollViewRect); + QMetaObject::invokeMethod(m_webPage->handle(), "scrollRequested", Q_ARG(int, delta.width()), Q_ARG(int, delta.height()), Q_ARG(QRect, scrollViewRect)); } #if USE(TILED_BACKING_STORE) void ChromeClientQt::delegatedScrollRequested(const IntPoint& point) { - QPoint currentPosition(m_webPage->mainFrame()->scrollPosition()); - emit m_webPage->scrollRequested(point.x() - currentPosition.x(), point.y() - currentPosition.y(), QRect(QPoint(0, 0), m_webPage->viewportSize())); + + IntSize currentPosition = m_webPage->mainFrameAdapter()->scrollPosition(); + int x = point.x() - currentPosition.width(); + int y = point.y() - currentPosition.height(); + const QRect rect(QPoint(0, 0), m_webPage->viewportSize()); + QMetaObject::invokeMethod(m_webPage->handle(), "scrollRequested", Q_ARG(int, x), Q_ARG(int, y), Q_ARG(QRect, rect)); } #endif @@ -489,12 +470,12 @@ IntRect ChromeClientQt::rootViewToScreen(const IntRect& rect) const if (!pageClient) return rect; - QWidget* ownerWidget = pageClient->ownerWidget(); - if (!ownerWidget) - return rect; + QWindow* ownerWindow = pageClient->ownerWindow(); + if (!ownerWindow) + return rect; QRect screenRect(rect); - screenRect.translate(ownerWidget->mapToGlobal(QPoint(0, 0))); + screenRect.translate(ownerWindow->mapToGlobal(m_webPage->viewRectRelativeToWindow().topLeft())); return screenRect; } @@ -505,22 +486,22 @@ IntPoint ChromeClientQt::screenToRootView(const IntPoint& point) const if (!pageClient) return point; - QWidget* ownerWidget = pageClient->ownerWidget(); - if (!ownerWidget) + QWindow* ownerWindow = pageClient->ownerWindow(); + if (!ownerWindow) return point; - return ownerWidget->mapFromGlobal(point); + return ownerWindow->mapFromGlobal(point) - m_webPage->viewRectRelativeToWindow().topLeft(); } PlatformPageClient ChromeClientQt::platformPageClient() const { - return m_webPage->d->client.get(); + return m_webPage->client.data(); } void ChromeClientQt::contentsSizeChanged(Frame* frame, const IntSize& size) const { if (frame->loader()->networkingContext()) - QWebFramePrivate::kit(frame)->contentsSizeChanged(size); + QWebFrameAdapter::kit(frame)->contentsSizeDidChange(size); } void ChromeClientQt::mouseDidMoveOverElement(const HitTestResult& result, unsigned) @@ -532,33 +513,19 @@ void ChromeClientQt::mouseDidMoveOverElement(const HitTestResult& result, unsign lastHoverURL = result.absoluteLinkURL(); lastHoverTitle = result.title(dir); lastHoverContent = result.textContent(); - emit m_webPage->linkHovered(lastHoverURL.string(), - lastHoverTitle, lastHoverContent); + QMetaObject::invokeMethod(m_webPage->handle(), "linkHovered", Q_ARG(QString, lastHoverURL.string()), + Q_ARG(QString, lastHoverTitle), Q_ARG(QString, lastHoverContent)); } } void ChromeClientQt::setToolTip(const String &tip, TextDirection) { -#ifndef QT_NO_TOOLTIP - QWidget* view = m_webPage->view(); - if (!view) - return; - - if (tip.isEmpty()) { - view->setToolTip(QString()); - QToolTip::hideText(); - } else { - QString dtip = QLatin1String("<p>") + QString(tip).toHtmlEscaped() + QLatin1String("</p>"); - view->setToolTip(dtip); - } -#else - Q_UNUSED(tip); -#endif + m_webPage->setToolTip(tip); } void ChromeClientQt::print(Frame* frame) { - emit m_webPage->printRequested(QWebFramePrivate::kit(frame)); + emit m_webPage->printRequested(QWebFrameAdapter::kit(frame)); } #if ENABLE(SQL_DATABASE) @@ -569,7 +536,7 @@ void ChromeClientQt::exceededDatabaseQuota(Frame* frame, const String& databaseN if (!DatabaseTracker::tracker().hasEntryForOrigin(frame->document()->securityOrigin())) DatabaseTracker::tracker().setQuota(frame->document()->securityOrigin(), quota); - emit m_webPage->databaseQuotaExceeded(QWebFramePrivate::kit(frame), databaseName); + m_webPage->databaseQuotaExceeded(QWebFrameAdapter::kit(frame), databaseName); } #endif @@ -588,15 +555,15 @@ void ChromeClientQt::reachedApplicationCacheOriginQuota(SecurityOrigin* origin, QWebSecurityOrigin* securityOrigin = new QWebSecurityOrigin(priv); if (!WebCore::cacheStorage().calculateQuotaForOrigin(origin, quota)) - WebCore::cacheStorage().storeUpdatedQuotaForOrigin(origin, defaultOriginQuota); + WebCore::cacheStorage().storeUpdatedQuotaForOrigin(origin, defaultOriginQuota); - emit m_webPage->applicationCacheQuotaExceeded(securityOrigin, defaultOriginQuota, static_cast<quint64>(totalSpaceNeeded)); + m_webPage->applicationCacheQuotaExceeded(securityOrigin, defaultOriginQuota, static_cast<quint64>(totalSpaceNeeded)); } #if ENABLE(INPUT_TYPE_COLOR) PassOwnPtr<ColorChooser> ChromeClientQt::createColorChooser(ColorChooserClient* client, const Color& color) { - const QColor selectedColor = m_webPage->d->colorSelectionRequested(QColor(color)); + const QColor selectedColor = m_webPage->colorSelectionRequested(QColor(color)); client->didChooseColor(selectedColor); client->didEndChooser(); return nullptr; @@ -606,32 +573,22 @@ PassOwnPtr<ColorChooser> ChromeClientQt::createColorChooser(ColorChooserClient* void ChromeClientQt::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> prpFileChooser) { RefPtr<FileChooser> fileChooser = prpFileChooser; - bool supportMulti = m_webPage->supportsExtension(QWebPage::ChooseMultipleFilesExtension); - - if (fileChooser->settings().allowsMultipleFiles && supportMulti) { - QWebPage::ChooseMultipleFilesExtensionOption option; - option.parentFrame = QWebFramePrivate::kit(frame); - if (!fileChooser->settings().selectedFiles.isEmpty()) - for (unsigned i = 0; i < fileChooser->settings().selectedFiles.size(); ++i) - option.suggestedFileNames += fileChooser->settings().selectedFiles[i]; + QStringList suggestedFileNames; + for (unsigned i = 0; i < fileChooser->settings().selectedFiles.size(); ++i) + suggestedFileNames += fileChooser->settings().selectedFiles[i]; - QWebPage::ChooseMultipleFilesExtensionReturn output; - m_webPage->extension(QWebPage::ChooseMultipleFilesExtension, &option, &output); + const bool allowMultiple = fileChooser->settings().allowsMultipleFiles; - if (!output.fileNames.isEmpty()) { + QStringList result = m_webPage->chooseFiles(QWebFrameAdapter::kit(frame), allowMultiple, suggestedFileNames); + if (!result.isEmpty()) { + if (allowMultiple) { Vector<String> names; - for (int i = 0; i < output.fileNames.count(); ++i) - names.append(output.fileNames.at(i)); + for (int i = 0; i < result.count(); ++i) + names.append(result.at(i)); fileChooser->chooseFiles(names); - } - } else { - QString suggestedFile; - if (!fileChooser->settings().selectedFiles.isEmpty()) - suggestedFile = fileChooser->settings().selectedFiles[0]; - QString file = m_webPage->chooseFile(QWebFramePrivate::kit(frame), suggestedFile); - if (!file.isEmpty()) - fileChooser->chooseFile(file); + } else + fileChooser->chooseFile(result.first()); } } @@ -662,7 +619,7 @@ void ChromeClientQt::scheduleAnimation() void ChromeClientQt::serviceScriptedAnimations() { - m_webPage->mainFrame()->d->frame->view()->serviceScriptedAnimations(convertSecondsToDOMTimeStamp(currentTime())); + m_webPage->mainFrameAdapter()->frame->view()->serviceScriptedAnimations(convertSecondsToDOMTimeStamp(currentTime())); } #endif @@ -703,8 +660,10 @@ IntRect ChromeClientQt::visibleRectForTiledBackingStore() const if (!platformPageClient() || !m_webPage) return IntRect(); - if (!platformPageClient()->viewResizesToContentsEnabled()) - return QRect(m_webPage->mainFrame()->scrollPosition(), m_webPage->mainFrame()->geometry().size()); + if (!platformPageClient()->viewResizesToContentsEnabled()) { + IntSize offset = m_webPage->mainFrameAdapter()->scrollPosition(); + return QRect(QPoint(offset.width(), offset.height()), m_webPage->mainFrameAdapter()->frameRect().size()); + } return enclosingIntRect(FloatRect(platformPageClient()->graphicsItemVisibleRect())); } @@ -751,7 +710,7 @@ PassOwnPtr<QWebSelectMethod> ChromeClientQt::createSelectPopup() const return result.release(); #if !defined(QT_NO_COMBOBOX) - return adoptPtr(new QtFallbackWebPopup(this)); + return adoptPtr(m_webPage->createSelectPopup()); #else return nullptr; #endif @@ -759,8 +718,18 @@ PassOwnPtr<QWebSelectMethod> ChromeClientQt::createSelectPopup() const void ChromeClientQt::dispatchViewportPropertiesDidChange(const ViewportArguments&) const { - emit m_webPage->viewportChangeRequested(); + m_webPage->emitViewportChangeRequested(); +} + +#if USE(QT_MULTIMEDIA) +QWebFullScreenVideoHandler* ChromeClientQt::createFullScreenVideoHandler() +{ + QWebFullScreenVideoHandler* handler = m_platformPlugin.createFullScreenVideoHandler().leakPtr(); + if (!handler) + handler = m_webPage->createFullScreenVideoHandler(); + return handler; } +#endif bool ChromeClientQt::selectItemWritingDirectionIsNatural() { @@ -794,7 +763,7 @@ void ChromeClientQt::populateVisitedLinks() // in a separate database if (dumpVisitedLinksCallbacks) { printf("Asked to populate visited links for WebView \"%s\"\n", - qPrintable(m_webPage->mainFrame()->url().toString())); + qPrintable(QUrl(m_webPage->mainFrameAdapter()->url).toString())); } } diff --git a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h index f7359d2e2..96d8625c0 100644 --- a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h +++ b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h @@ -42,6 +42,8 @@ class QEventLoop; QT_END_NAMESPACE class QWebPage; +class QWebPageAdapter; +class QWebFullScreenVideoHandler; namespace WebCore { @@ -59,7 +61,7 @@ class FullScreenVideoQt; class ChromeClientQt : public ChromeClient { public: - ChromeClientQt(QWebPage*); + ChromeClientQt(QWebPageAdapter*); virtual ~ChromeClientQt(); virtual void chromeDestroyed(); @@ -98,7 +100,7 @@ public: virtual void setResizable(bool); - virtual void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, unsigned int lineNumber, const String& sourceID); + virtual void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceID); virtual bool canRunBeforeUnloadConfirmPanel(); virtual bool runBeforeUnloadConfirmPanel(const String& message, Frame*); @@ -156,7 +158,7 @@ public: #if ENABLE(TOUCH_EVENTS) virtual void needTouchEvents(bool) { } #endif - + #if ENABLE(VIDEO) && (USE(GSTREAMER) || USE(QT_MULTIMEDIA) || USE(QTKIT)) virtual bool supportsFullscreenForNode(const Node*); virtual void enterFullscreenForNode(Node*); @@ -169,8 +171,8 @@ public: virtual PassOwnPtr<ColorChooser> createColorChooser(ColorChooserClient*, const Color&); #endif - virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>); - virtual void loadIconForFiles(const Vector<String>&, FileIconLoader*); + virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>); + virtual void loadIconForFiles(const Vector<String>&, FileIconLoader*); virtual void formStateDidChange(const Node*) { } @@ -198,7 +200,9 @@ public: virtual bool shouldRubberBandInDirection(WebCore::ScrollDirection) const { return true; } virtual void numWheelEventHandlersChanged(unsigned) { } - QWebPage* m_webPage; + QWebFullScreenVideoHandler* createFullScreenVideoHandler(); + + QWebPageAdapter* m_webPage; KURL lastHoverURL; String lastHoverTitle; String lastHoverContent; diff --git a/Source/WebKit/qt/WebCoreSupport/ContextMenuClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/ContextMenuClientQt.cpp index 29180e062..d2984c3d4 100644 --- a/Source/WebKit/qt/WebCoreSupport/ContextMenuClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/ContextMenuClientQt.cpp @@ -30,9 +30,8 @@ #include "HitTestResult.h" #include "KURL.h" #include "NotImplemented.h" -#include <wtf/RefCounted.h> -#include <stdio.h> +#include <wtf/RefCounted.h> namespace WebCore { diff --git a/Source/WebKit/qt/WebCoreSupport/ContextMenuClientQt.h b/Source/WebKit/qt/WebCoreSupport/ContextMenuClientQt.h index 0420f8d4a..eabac1b1a 100644 --- a/Source/WebKit/qt/WebCoreSupport/ContextMenuClientQt.h +++ b/Source/WebKit/qt/WebCoreSupport/ContextMenuClientQt.h @@ -40,7 +40,7 @@ public: virtual PlatformMenuDescription getCustomMenuFromDefaultItems(ContextMenu*); virtual void contextMenuItemSelected(ContextMenuItem*, const ContextMenu*); - virtual void downloadURL(const KURL& url); + virtual void downloadURL(const KURL&); virtual void lookUpInDictionary(Frame*); virtual void speak(const String&); virtual bool isSpeaking(); diff --git a/Source/WebKit/qt/WebCoreSupport/DefaultFullScreenVideoHandler.cpp b/Source/WebKit/qt/WebCoreSupport/DefaultFullScreenVideoHandler.cpp new file mode 100644 index 000000000..0fe24e8bd --- /dev/null +++ b/Source/WebKit/qt/WebCoreSupport/DefaultFullScreenVideoHandler.cpp @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). + * Copyright (C) 2011 Nokia Corporation 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 + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "DefaultFullScreenVideoHandler.h" + +#if USE(QT_MULTIMEDIA) + +#include "FullScreenVideoWidget.h" + +using namespace WebKit; + +bool DefaultFullScreenVideoHandler::s_shouldForceFullScreenVideoPlayback = false; + +DefaultFullScreenVideoHandler::DefaultFullScreenVideoHandler() + : QWebFullScreenVideoHandler() + , m_fullScreenWidget(new FullScreenVideoWidget) +{ + connect(m_fullScreenWidget, SIGNAL(didExitFullScreen()), this, SIGNAL(fullScreenClosed())); + m_fullScreenWidget->hide(); + + m_fullScreenWidget->close(); +} + +DefaultFullScreenVideoHandler::~DefaultFullScreenVideoHandler() +{ + delete m_fullScreenWidget; +} + +bool DefaultFullScreenVideoHandler::requiresFullScreenForVideoPlayback() const +{ + static bool initialized = false; + if (!initialized) { + QByteArray forceFullScreen = qgetenv("QT_WEBKIT_FORCE_FULLSCREEN_VIDEO"); + if (!forceFullScreen.isEmpty()) + s_shouldForceFullScreenVideoPlayback = true; + + initialized = true; + } + + return s_shouldForceFullScreenVideoPlayback; +} + +void DefaultFullScreenVideoHandler::enterFullScreen(QMediaPlayer* player) +{ + m_fullScreenWidget->show(player); +} + +void DefaultFullScreenVideoHandler::exitFullScreen() +{ + m_fullScreenWidget->close(); +} +#endif + + diff --git a/Source/WebKit/qt/WebCoreSupport/DefaultFullScreenVideoHandler.h b/Source/WebKit/qt/WebCoreSupport/DefaultFullScreenVideoHandler.h new file mode 100644 index 000000000..e943c55e4 --- /dev/null +++ b/Source/WebKit/qt/WebCoreSupport/DefaultFullScreenVideoHandler.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). + * Copyright (C) 2011 Nokia Corporation 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 + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ +#ifndef DefaultFullScreenVideoHandler_h +#define DefaultFullScreenVideoHandler_h + +#include "qwebkitplatformplugin.h" + +namespace WebKit { + +class FullScreenVideoWidget; + +// We do not use ENABLE or USE because moc does not expand these macros. +#if defined(WTF_USE_QT_MULTIMEDIA) && WTF_USE_QT_MULTIMEDIA +class DefaultFullScreenVideoHandler : public QWebFullScreenVideoHandler { + Q_OBJECT +public: + DefaultFullScreenVideoHandler(); + virtual ~DefaultFullScreenVideoHandler(); + bool requiresFullScreenForVideoPlayback() const; + +public Q_SLOTS: + void enterFullScreen(QMediaPlayer*); + void exitFullScreen(); + +private: + static bool s_shouldForceFullScreenVideoPlayback; + FullScreenVideoWidget *m_fullScreenWidget; +}; +#endif + +} // namespace WebKit + +#endif // DefaultFullScreenVideoHandler_h diff --git a/Source/WebKit/qt/WebCoreSupport/DragClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/DragClientQt.cpp index cb6328340..2e0d05ed1 100644 --- a/Source/WebKit/qt/WebCoreSupport/DragClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/DragClientQt.cpp @@ -26,16 +26,16 @@ #include "config.h" #include "DragClientQt.h" +#include "ChromeClient.h" #include "ClipboardQt.h" #include "DragController.h" #include "Frame.h" #include "Page.h" #include "PlatformMouseEvent.h" -#include "qwebpage.h" #include <QDrag> #include <QMimeData> - +#include <QWebPageClient.h> namespace WebCore { @@ -93,7 +93,7 @@ void DragClientQt::startDrag(DragImageRef dragImage, const IntPoint&, const IntP #ifndef QT_NO_DRAGANDDROP QMimeData* clipboardData = static_cast<ClipboardQt*>(clipboard)->clipboardData(); static_cast<ClipboardQt*>(clipboard)->invalidateWritableData(); - QWidget* view = m_webPage->view(); + QObject* view = m_chromeClient->platformPageClient()->ownerWidget(); if (view) { QDrag* drag = new QDrag(view); if (dragImage) @@ -105,7 +105,7 @@ void DragClientQt::startDrag(DragImageRef dragImage, const IntPoint&, const IntP Qt::DropAction actualDropAction = drag->exec(dragOperationsToDropActions(dragOperationMask)); // Send dragEnd event - PlatformMouseEvent me(m_webPage->view()->mapFromGlobal(QCursor::pos()), QCursor::pos(), LeftButton, PlatformEvent::MouseMoved, 0, false, false, false, false, 0); + PlatformMouseEvent me(m_chromeClient->screenToRootView(QCursor::pos()), QCursor::pos(), LeftButton, PlatformEvent::MouseMoved, 0, false, false, false, false, 0); frame->eventHandler()->dragSourceEndedAt(me, dropActionToDragOperation(actualDropAction)); } frame->page()->dragController()->dragEnded(); diff --git a/Source/WebKit/qt/WebCoreSupport/DragClientQt.h b/Source/WebKit/qt/WebCoreSupport/DragClientQt.h index 15724f1e1..aa8b8085b 100644 --- a/Source/WebKit/qt/WebCoreSupport/DragClientQt.h +++ b/Source/WebKit/qt/WebCoreSupport/DragClientQt.h @@ -28,13 +28,13 @@ #include "DragClient.h" -class QWebPage; - namespace WebCore { +class ChromeClient; + class DragClientQt : public DragClient { public: - DragClientQt(QWebPage* webPage) : m_webPage(webPage) {}; + DragClientQt(ChromeClient* chromeClient) : m_chromeClient(chromeClient) { }; virtual void willPerformDragDestinationAction(DragDestinationAction, DragData*); virtual DragDestinationAction actionMaskForDrag(DragData*); virtual void dragControllerDestroyed(); @@ -42,7 +42,7 @@ public: virtual void willPerformDragSourceAction(DragSourceAction, const IntPoint&, Clipboard*); virtual void startDrag(DragImageRef, const IntPoint& dragImageOrigin, const IntPoint& eventPos, Clipboard*, Frame*, bool linkDrag = false); private: - QWebPage* m_webPage; + ChromeClient* m_chromeClient; }; } diff --git a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp index edf20a460..8d08c4a10 100644 --- a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp @@ -43,8 +43,6 @@ #include "FrameLoaderClientQt.h" #include "FrameView.h" #include "GCController.h" -#include "JSNode.h" -#include "qt_runtime.h" #include "GeolocationClient.h" #include "GeolocationClientMock.h" #include "GeolocationController.h" @@ -53,8 +51,8 @@ #include "HTMLFormElement.h" #include "HTMLInputElement.h" #include "HistoryItem.h" -#include "InitWebCoreQt.h" #include "InspectorController.h" +#include "JSNode.h" #include "NodeList.h" #include "NotificationPresenterClientQt.h" #include "Page.h" @@ -63,6 +61,8 @@ #include "PluginView.h" #include "PositionError.h" #include "PrintContext.h" +#include "QWebFrameAdapter.h" +#include "QWebPageAdapter.h" #include "RenderListItem.h" #include "RenderTreeAsText.h" #include "SchemeRegistry.h" @@ -76,15 +76,10 @@ #include "ThirdPartyCookiesQt.h" #include "WebCoreTestSupport.h" #include "WorkerThread.h" -#include <wtf/CurrentTime.h> - +#include "qt_runtime.h" #include "qwebelement.h" -#include "qwebframe.h" -#include "qwebframe_p.h" #include "qwebhistory.h" #include "qwebhistory_p.h" -#include "qwebpage.h" -#include "qwebpage_p.h" #include "qwebscriptworld.h" #if ENABLE(VIDEO) && USE(QT_MULTIMEDIA) @@ -92,9 +87,8 @@ #include "MediaPlayerPrivateQt.h" #endif -#include <QAction> -#include <QMenu> #include <QPainter> +#include <wtf/CurrentTime.h> using namespace WebCore; @@ -103,15 +97,15 @@ QMap<int, QWebScriptWorld*> m_worldMap; #if ENABLE(GEOLOCATION) GeolocationClientMock* toGeolocationClientMock(GeolocationClient* client) { - ASSERT(QWebPagePrivate::drtRun); - return static_cast<GeolocationClientMock*>(client); + ASSERT(QWebPageAdapter::drtRun); + return static_cast<GeolocationClientMock*>(client); } #endif #if ENABLE(DEVICE_ORIENTATION) DeviceOrientationClientMock* toDeviceOrientationClientMock(DeviceOrientationClient* client) { - ASSERT(QWebPagePrivate::drtRun); + ASSERT(QWebPageAdapter::drtRun); return static_cast<DeviceOrientationClientMock*>(client); } #endif @@ -198,7 +192,6 @@ DumpRenderTreeSupportQt::~DumpRenderTreeSupportQt() void DumpRenderTreeSupportQt::initialize() { - WebCore::initializeWebCoreQt(); QtDRTNodeRuntime::initialize(); } @@ -225,58 +218,58 @@ int DumpRenderTreeSupportQt::workerThreadCount() void DumpRenderTreeSupportQt::setDumpRenderTreeModeEnabled(bool b) { - QWebPagePrivate::drtRun = b; + QWebPageAdapter::drtRun = b; #if ENABLE(NETSCAPE_PLUGIN_API) && defined(XP_UNIX) // PluginViewQt (X11) needs a few workarounds when running under DRT PluginView::setIsRunningUnderDRT(b); #endif } -void DumpRenderTreeSupportQt::setFrameFlatteningEnabled(QWebPage* page, bool enabled) +void DumpRenderTreeSupportQt::setFrameFlatteningEnabled(QWebPageAdapter* adapter, bool enabled) { - QWebPagePrivate::core(page)->settings()->setFrameFlatteningEnabled(enabled); + adapter->page->settings()->setFrameFlatteningEnabled(enabled); } -void DumpRenderTreeSupportQt::webPageSetGroupName(QWebPage* page, const QString& groupName) +void DumpRenderTreeSupportQt::webPageSetGroupName(QWebPageAdapter *adapter, const QString& groupName) { - page->handle()->page->setGroupName(groupName); + adapter->page->setGroupName(groupName); } -QString DumpRenderTreeSupportQt::webPageGroupName(QWebPage* page) +QString DumpRenderTreeSupportQt::webPageGroupName(QWebPageAdapter* adapter) { - return page->handle()->page->groupName(); + return adapter->page->groupName(); } -void DumpRenderTreeSupportQt::webInspectorExecuteScript(QWebPage* page, long callId, const QString& script) +void DumpRenderTreeSupportQt::webInspectorExecuteScript(QWebPageAdapter* adapter, long callId, const QString& script) { #if ENABLE(INSPECTOR) - if (!page->handle()->page->inspectorController()) + if (!adapter->page->inspectorController()) return; - page->handle()->page->inspectorController()->evaluateForTestInFrontend(callId, script); + adapter->page->inspectorController()->evaluateForTestInFrontend(callId, script); #endif } -void DumpRenderTreeSupportQt::webInspectorClose(QWebPage* page) +void DumpRenderTreeSupportQt::webInspectorShow(QWebPageAdapter* adapter) { #if ENABLE(INSPECTOR) - if (!page->handle()->page->inspectorController()) + if (!adapter->page->inspectorController()) return; - page->handle()->page->inspectorController()->close(); + adapter->page->inspectorController()->show(); #endif } -void DumpRenderTreeSupportQt::webInspectorShow(QWebPage* page) +void DumpRenderTreeSupportQt::webInspectorClose(QWebPageAdapter* adapter) { #if ENABLE(INSPECTOR) - if (!page->handle()->page->inspectorController()) + if (!adapter->page->inspectorController()) return; - page->handle()->page->inspectorController()->show(); + adapter->page->inspectorController()->close(); #endif } -bool DumpRenderTreeSupportQt::hasDocumentElement(QWebFrame* frame) +bool DumpRenderTreeSupportQt::hasDocumentElement(QWebFrameAdapter *adapter) { - return QWebFramePrivate::core(frame)->document()->documentElement(); + return adapter->frame->document()->documentElement(); } void DumpRenderTreeSupportQt::setAutofilled(const QWebElement& element, bool isAutofilled) @@ -306,9 +299,9 @@ void DumpRenderTreeSupportQt::setValueForUser(const QWebElement& element, const // Pause a given CSS animation or transition on the target node at a specific time. // If the animation or transition is already paused, it will update its pause time. // This method is only intended to be used for testing the CSS animation and transition system. -bool DumpRenderTreeSupportQt::pauseAnimation(QWebFrame *frame, const QString &animationName, double time, const QString &elementId) +bool DumpRenderTreeSupportQt::pauseAnimation(QWebFrameAdapter *adapter, const QString &animationName, double time, const QString &elementId) { - Frame* coreFrame = QWebFramePrivate::core(frame); + Frame* coreFrame = adapter->frame; if (!coreFrame) return false; @@ -326,9 +319,9 @@ bool DumpRenderTreeSupportQt::pauseAnimation(QWebFrame *frame, const QString &an return controller->pauseAnimationAtTime(coreNode->renderer(), animationName, time); } -bool DumpRenderTreeSupportQt::pauseTransitionOfProperty(QWebFrame *frame, const QString &propertyName, double time, const QString &elementId) +bool DumpRenderTreeSupportQt::pauseTransitionOfProperty(QWebFrameAdapter *adapter, const QString &propertyName, double time, const QString &elementId) { - Frame* coreFrame = QWebFramePrivate::core(frame); + Frame* coreFrame = adapter->frame; if (!coreFrame) return false; @@ -347,9 +340,9 @@ bool DumpRenderTreeSupportQt::pauseTransitionOfProperty(QWebFrame *frame, const } // Returns the total number of currently running animations (includes both CSS transitions and CSS animations). -int DumpRenderTreeSupportQt::numberOfActiveAnimations(QWebFrame *frame) +int DumpRenderTreeSupportQt::numberOfActiveAnimations(QWebFrameAdapter *adapter) { - Frame* coreFrame = QWebFramePrivate::core(frame); + Frame* coreFrame = adapter->frame; if (!coreFrame) return false; @@ -360,9 +353,9 @@ int DumpRenderTreeSupportQt::numberOfActiveAnimations(QWebFrame *frame) return controller->numberOfActiveAnimations(coreFrame->document()); } -void DumpRenderTreeSupportQt::clearFrameName(QWebFrame* frame) +void DumpRenderTreeSupportQt::clearFrameName(QWebFrameAdapter *adapter) { - Frame* coreFrame = QWebFramePrivate::core(frame); + Frame* coreFrame = adapter->frame; coreFrame->tree()->clearName(); } @@ -381,24 +374,6 @@ void DumpRenderTreeSupportQt::garbageCollectorCollectOnAlternateThread(bool wait gcController().garbageCollectOnAlternateThreadForDebugging(waitUntilDone); } -// Suspend active DOM objects in this frame. -void DumpRenderTreeSupportQt::suspendActiveDOMObjects(QWebFrame* frame) -{ - Frame* coreFrame = QWebFramePrivate::core(frame); - if (coreFrame->document()) - // FIXME: This function should be changed take a ReasonForSuspension parameter - // https://bugs.webkit.org/show_bug.cgi?id=45732 - coreFrame->document()->suspendActiveDOMObjects(ActiveDOMObject::JavaScriptDebuggerPaused); -} - -// Resume active DOM objects in this frame. -void DumpRenderTreeSupportQt::resumeActiveDOMObjects(QWebFrame* frame) -{ - Frame* coreFrame = QWebFramePrivate::core(frame); - if (coreFrame->document()) - coreFrame->document()->resumeActiveDOMObjects(); -} - void DumpRenderTreeSupportQt::whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains) { SecurityPolicy::addOriginAccessWhitelistEntry(*SecurityOrigin::createFromString(sourceOrigin), destinationProtocol, destinationHost, allowDestinationSubdomains); @@ -419,39 +394,39 @@ void DumpRenderTreeSupportQt::setDomainRelaxationForbiddenForURLScheme(bool forb SchemeRegistry::setDomainRelaxationForbiddenForURLScheme(forbidden, scheme); } -void DumpRenderTreeSupportQt::setCaretBrowsingEnabled(QWebPage* page, bool value) +void DumpRenderTreeSupportQt::setCaretBrowsingEnabled(QWebPageAdapter* adapter, bool value) { - page->handle()->page->settings()->setCaretBrowsingEnabled(value); + adapter->page->settings()->setCaretBrowsingEnabled(value); } -void DumpRenderTreeSupportQt::setAuthorAndUserStylesEnabled(QWebPage* page, bool value) +void DumpRenderTreeSupportQt::setAuthorAndUserStylesEnabled(QWebPageAdapter* adapter, bool value) { - page->handle()->page->settings()->setAuthorAndUserStylesEnabled(value); + adapter->page->settings()->setAuthorAndUserStylesEnabled(value); } -void DumpRenderTreeSupportQt::setSmartInsertDeleteEnabled(QWebPage* page, bool enabled) +void DumpRenderTreeSupportQt::setSmartInsertDeleteEnabled(QWebPageAdapter *adapter, bool enabled) { - page->d->smartInsertDeleteEnabled = enabled; + static_cast<EditorClientQt*>(adapter->page->editorClient())->setSmartInsertDeleteEnabled(enabled); } -void DumpRenderTreeSupportQt::setSelectTrailingWhitespaceEnabled(QWebPage* page, bool enabled) +void DumpRenderTreeSupportQt::setSelectTrailingWhitespaceEnabled(QWebPageAdapter *adapter, bool enabled) { - page->d->selectTrailingWhitespaceEnabled = enabled; + static_cast<EditorClientQt*>(adapter->page->editorClient())->setSelectTrailingWhitespaceEnabled(enabled); } -void DumpRenderTreeSupportQt::executeCoreCommandByName(QWebPage* page, const QString& name, const QString& value) +void DumpRenderTreeSupportQt::executeCoreCommandByName(QWebPageAdapter* adapter, const QString& name, const QString& value) { - page->handle()->page->focusController()->focusedOrMainFrame()->editor()->command(name).execute(value); + adapter->page->focusController()->focusedOrMainFrame()->editor()->command(name).execute(value); } -bool DumpRenderTreeSupportQt::isCommandEnabled(QWebPage* page, const QString& name) +bool DumpRenderTreeSupportQt::isCommandEnabled(QWebPageAdapter *adapter, const QString& name) { - return page->handle()->page->focusController()->focusedOrMainFrame()->editor()->command(name).isEnabled(); + return adapter->page->focusController()->focusedOrMainFrame()->editor()->command(name).isEnabled(); } -bool DumpRenderTreeSupportQt::findString(QWebPage* page, const QString& string, const QStringList& optionArray) +bool DumpRenderTreeSupportQt::findString(QWebPageAdapter *adapter, const QString& string, const QStringList& optionArray) { // 1. Parse the options from the array WebCore::FindOptions options = 0; @@ -473,7 +448,7 @@ bool DumpRenderTreeSupportQt::findString(QWebPage* page, const QString& string, } // 2. find the string - WebCore::Frame* frame = page->handle()->page->focusController()->focusedOrMainFrame(); + WebCore::Frame* frame = adapter->page->focusController()->focusedOrMainFrame(); return frame && frame->editor()->findString(string, options); } @@ -514,9 +489,9 @@ QVariantMap DumpRenderTreeSupportQt::computedStyleIncludingVisitedInfo(const QWe return res; } -QVariantList DumpRenderTreeSupportQt::selectedRange(QWebPage* page) +QVariantList DumpRenderTreeSupportQt::selectedRange(QWebPageAdapter *adapter) { - WebCore::Frame* frame = page->handle()->page->focusController()->focusedOrMainFrame(); + WebCore::Frame* frame = adapter->page->focusController()->focusedOrMainFrame(); QVariantList selectedRange; RefPtr<Range> range = frame->selection()->toNormalizedRange().get(); @@ -538,9 +513,9 @@ QVariantList DumpRenderTreeSupportQt::selectedRange(QWebPage* page) } -QVariantList DumpRenderTreeSupportQt::firstRectForCharacterRange(QWebPage* page, int location, int length) +QVariantList DumpRenderTreeSupportQt::firstRectForCharacterRange(QWebPageAdapter *adapter, int location, int length) { - WebCore::Frame* frame = page->handle()->page->focusController()->focusedOrMainFrame(); + WebCore::Frame* frame = adapter->page->focusController()->focusedOrMainFrame(); QVariantList rect; if ((location + length < location) && (location + length)) @@ -556,9 +531,9 @@ QVariantList DumpRenderTreeSupportQt::firstRectForCharacterRange(QWebPage* page, return rect; } -bool DumpRenderTreeSupportQt::elementDoesAutoCompleteForElementWithId(QWebFrame* frame, const QString& elementId) +bool DumpRenderTreeSupportQt::elementDoesAutoCompleteForElementWithId(QWebFrameAdapter *adapter, const QString& elementId) { - Frame* coreFrame = QWebFramePrivate::core(frame); + Frame* coreFrame = adapter->frame; if (!coreFrame) return false; @@ -574,9 +549,9 @@ bool DumpRenderTreeSupportQt::elementDoesAutoCompleteForElementWithId(QWebFrame* return inputElement->isTextField() && !inputElement->isPasswordField() && inputElement->shouldAutocomplete(); } -void DumpRenderTreeSupportQt::setWindowsBehaviorAsEditingBehavior(QWebPage* page) +void DumpRenderTreeSupportQt::setWindowsBehaviorAsEditingBehavior(QWebPageAdapter* adapter) { - Page* corePage = QWebPagePrivate::core(page); + Page* corePage = adapter->page; if (!corePage) return; corePage->settings()->setEditingBehaviorType(EditingWindowsBehavior); @@ -676,15 +651,15 @@ void DumpRenderTreeSupportQt::dumpNotification(bool b) #endif } -QString DumpRenderTreeSupportQt::viewportAsText(QWebPage* page, int deviceDPI, const QSize& deviceSize, const QSize& availableSize) +QString DumpRenderTreeSupportQt::viewportAsText(QWebPageAdapter* adapter, int deviceDPI, const QSize& deviceSize, const QSize& availableSize) { - WebCore::ViewportArguments args = page->d->viewportArguments(); + WebCore::ViewportArguments args = adapter->viewportArguments(); float devicePixelRatio = deviceDPI / WebCore::ViewportArguments::deprecatedTargetDPI; WebCore::ViewportAttributes conf = WebCore::computeViewportAttributes(args, - /* desktop-width */ 980, - /* device-width */ deviceSize.width(), - /* device-height */ deviceSize.height(), + /* desktop-width */980, + /* device-width */deviceSize.width(), + /* device-height */deviceSize.height(), devicePixelRatio, availableSize); WebCore::restrictMinimumScaleFactorToViewportSize(conf, availableSize, devicePixelRatio); @@ -692,72 +667,72 @@ QString DumpRenderTreeSupportQt::viewportAsText(QWebPage* page, int deviceDPI, c QString res; res = res.sprintf("viewport size %dx%d scale %f with limits [%f, %f] and userScalable %f\n", - static_cast<int>(conf.layoutSize.width()), - static_cast<int>(conf.layoutSize.height()), - conf.initialScale, - conf.minimumScale, - conf.maximumScale, - conf.userScalable); + static_cast<int>(conf.layoutSize.width()), + static_cast<int>(conf.layoutSize.height()), + conf.initialScale, + conf.minimumScale, + conf.maximumScale, + conf.userScalable); return res; } -void DumpRenderTreeSupportQt::scalePageBy(QWebFrame* frame, float scalefactor, const QPoint& origin) +void DumpRenderTreeSupportQt::scalePageBy(QWebFrameAdapter* adapter, float scalefactor, const QPoint& origin) { - WebCore::Frame* coreFrame = QWebFramePrivate::core(frame); + WebCore::Frame* coreFrame = adapter->frame; if (Page* page = coreFrame->page()) page->setPageScaleFactor(scalefactor, origin); } -void DumpRenderTreeSupportQt::setMockDeviceOrientation(QWebPage* page, bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma) +void DumpRenderTreeSupportQt::setMockDeviceOrientation(QWebPageAdapter* adapter, bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma) { #if ENABLE(DEVICE_ORIENTATION) - Page* corePage = QWebPagePrivate::core(page); + Page* corePage = adapter->page; DeviceOrientationClientMock* mockClient = toDeviceOrientationClientMock(DeviceOrientationController::from(corePage)->deviceOrientationClient()); mockClient->setOrientation(DeviceOrientationData::create(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma)); #endif } -void DumpRenderTreeSupportQt::resetGeolocationMock(QWebPage* page) +void DumpRenderTreeSupportQt::resetGeolocationMock(QWebPageAdapter* adapter) { #if ENABLE(GEOLOCATION) - Page* corePage = QWebPagePrivate::core(page); + Page* corePage = adapter->page; GeolocationClientMock* mockClient = toGeolocationClientMock(GeolocationController::from(corePage)->client()); mockClient->reset(); #endif } -void DumpRenderTreeSupportQt::setMockGeolocationPermission(QWebPage* page, bool allowed) +void DumpRenderTreeSupportQt::setMockGeolocationPermission(QWebPageAdapter* adapter, bool allowed) { #if ENABLE(GEOLOCATION) - Page* corePage = QWebPagePrivate::core(page); + Page* corePage = adapter->page; GeolocationClientMock* mockClient = toGeolocationClientMock(GeolocationController::from(corePage)->client()); mockClient->setPermission(allowed); #endif } -void DumpRenderTreeSupportQt::setMockGeolocationPosition(QWebPage* page, double latitude, double longitude, double accuracy) +void DumpRenderTreeSupportQt::setMockGeolocationPosition(QWebPageAdapter* adapter, double latitude, double longitude, double accuracy) { #if ENABLE(GEOLOCATION) - Page* corePage = QWebPagePrivate::core(page); + Page* corePage = adapter->page; GeolocationClientMock* mockClient = toGeolocationClientMock(GeolocationController::from(corePage)->client()); mockClient->setPosition(GeolocationPosition::create(currentTime(), latitude, longitude, accuracy)); #endif } -void DumpRenderTreeSupportQt::setMockGeolocationPositionUnavailableError(QWebPage* page, const QString& message) +void DumpRenderTreeSupportQt::setMockGeolocationPositionUnavailableError(QWebPageAdapter* adapter, const QString& message) { #if ENABLE(GEOLOCATION) - Page* corePage = QWebPagePrivate::core(page); + Page* corePage = adapter->page; GeolocationClientMock* mockClient = static_cast<GeolocationClientMock*>(GeolocationController::from(corePage)->client()); mockClient->setPositionUnavailableError(message); #endif } -int DumpRenderTreeSupportQt::numberOfPendingGeolocationPermissionRequests(QWebPage* page) +int DumpRenderTreeSupportQt::numberOfPendingGeolocationPermissionRequests(QWebPageAdapter* adapter) { #if ENABLE(GEOLOCATION) - Page* corePage = QWebPagePrivate::core(page); + Page* corePage = adapter->page; GeolocationClientMock* mockClient = toGeolocationClientMock(GeolocationController::from(corePage)->client()); return mockClient->numberOfPendingPermissionRequests(); #else @@ -794,9 +769,9 @@ QMap<QString, QWebHistoryItem> DumpRenderTreeSupportQt::getChildHistoryItems(con return kids; } -bool DumpRenderTreeSupportQt::shouldClose(QWebFrame* frame) +bool DumpRenderTreeSupportQt::shouldClose(QWebFrameAdapter *adapter) { - WebCore::Frame* coreFrame = QWebFramePrivate::core(frame); + WebCore::Frame* coreFrame = adapter->frame; return coreFrame->loader()->shouldClose(); } @@ -805,7 +780,7 @@ void DumpRenderTreeSupportQt::clearScriptWorlds() m_worldMap.clear(); } -void DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld(QWebFrame* frame, int worldID, const QString& script) +void DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld(QWebFrameAdapter *adapter, int worldID, const QString& script) { QWebScriptWorld* scriptWorld; if (!worldID) { @@ -816,7 +791,7 @@ void DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld(QWebFrame* frame, in } else scriptWorld = m_worldMap.value(worldID); - WebCore::Frame* coreFrame = QWebFramePrivate::core(frame); + WebCore::Frame* coreFrame = adapter->frame; ScriptController* proxy = coreFrame->script(); @@ -825,14 +800,14 @@ void DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld(QWebFrame* frame, in proxy->executeScriptInWorld(scriptWorld->world(), script, true); } -void DumpRenderTreeSupportQt::addUserStyleSheet(QWebPage* page, const QString& sourceCode) +void DumpRenderTreeSupportQt::addUserStyleSheet(QWebPageAdapter* adapter, const QString& sourceCode) { - page->handle()->page->group().addUserStyleSheetToWorld(mainThreadNormalWorld(), sourceCode, QUrl(), Vector<String>(), Vector<String>(), WebCore::InjectInAllFrames); + adapter->page->group().addUserStyleSheetToWorld(mainThreadNormalWorld(), sourceCode, QUrl(), Vector<String>(), Vector<String>(), WebCore::InjectInAllFrames); } -void DumpRenderTreeSupportQt::removeUserStyleSheets(QWebPage* page) +void DumpRenderTreeSupportQt::removeUserStyleSheets(QWebPageAdapter* adapter) { - page->handle()->page->group().removeUserStyleSheetsFromWorld(mainThreadNormalWorld()); + adapter->page->group().removeUserStyleSheetsFromWorld(mainThreadNormalWorld()); } void DumpRenderTreeSupportQt::simulateDesktopNotificationClick(const QString& title) @@ -842,31 +817,31 @@ void DumpRenderTreeSupportQt::simulateDesktopNotificationClick(const QString& ti #endif } -void DumpRenderTreeSupportQt::setDefersLoading(QWebPage* page, bool flag) +void DumpRenderTreeSupportQt::setDefersLoading(QWebPageAdapter* adapter, bool flag) { - Page* corePage = QWebPagePrivate::core(page); + Page* corePage = adapter->page; if (corePage) corePage->setDefersLoading(flag); } -void DumpRenderTreeSupportQt::goBack(QWebPage* page) +void DumpRenderTreeSupportQt::goBack(QWebPageAdapter* adapter) { - Page* corePage = QWebPagePrivate::core(page); + Page* corePage = adapter->page; if (corePage) corePage->goBack(); } // API Candidate? -QString DumpRenderTreeSupportQt::responseMimeType(QWebFrame* frame) +QString DumpRenderTreeSupportQt::responseMimeType(QWebFrameAdapter* adapter) { - WebCore::Frame* coreFrame = QWebFramePrivate::core(frame); + WebCore::Frame* coreFrame = adapter->frame; WebCore::DocumentLoader* docLoader = coreFrame->loader()->documentLoader(); return docLoader->responseMIMEType(); } -void DumpRenderTreeSupportQt::clearOpener(QWebFrame* frame) +void DumpRenderTreeSupportQt::clearOpener(QWebFrameAdapter* adapter) { - WebCore::Frame* coreFrame = QWebFramePrivate::core(frame); + WebCore::Frame* coreFrame = adapter->frame; coreFrame->loader()->setOpener(0); } @@ -875,40 +850,16 @@ void DumpRenderTreeSupportQt::addURLToRedirect(const QString& origin, const QStr FrameLoaderClientQt::URLsToRedirect[origin] = destination; } -void DumpRenderTreeSupportQt::setInteractiveFormValidationEnabled(QWebPage* page, bool enable) +void DumpRenderTreeSupportQt::setInteractiveFormValidationEnabled(QWebPageAdapter* adapter, bool enable) { - Page* corePage = QWebPagePrivate::core(page); + Page* corePage = adapter->page; if (corePage) corePage->settings()->setInteractiveFormValidationEnabled(enable); } -#ifndef QT_NO_MENU -static QStringList iterateContextMenu(QMenu* menu) -{ - if (!menu) - return QStringList(); - - QStringList items; - QList<QAction *> actions = menu->actions(); - for (int i = 0; i < actions.count(); ++i) { - if (actions.at(i)->isSeparator()) - items << QLatin1String("<separator>"); - else - items << actions.at(i)->text(); - if (actions.at(i)->menu()) - items << iterateContextMenu(actions.at(i)->menu()); - } - return items; -} -#endif - -QStringList DumpRenderTreeSupportQt::contextMenu(QWebPage* page) +QStringList DumpRenderTreeSupportQt::contextMenu(QWebPageAdapter* page) { -#ifndef QT_NO_CONTEXTMENU - return iterateContextMenu(page->d->currentContextMenu.data()); -#else - return QStringList(); -#endif + return page->menuActionsAsText(); } double DumpRenderTreeSupportQt::defaultMinimumTimerInterval() @@ -916,18 +867,18 @@ double DumpRenderTreeSupportQt::defaultMinimumTimerInterval() return Settings::defaultMinDOMTimerInterval(); } -void DumpRenderTreeSupportQt::setMinimumTimerInterval(QWebPage* page, double interval) +void DumpRenderTreeSupportQt::setMinimumTimerInterval(QWebPageAdapter* adapter, double interval) { - Page* corePage = QWebPagePrivate::core(page); + Page* corePage = adapter->page; if (!corePage) return; corePage->settings()->setMinDOMTimerInterval(interval); } -bool DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(QWebPage *page, const QUrl& url, const QUrl& firstPartyUrl) +bool DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(QWebPageAdapter *adapter, const QUrl& url, const QUrl& firstPartyUrl) { - Page* corePage = QWebPagePrivate::core(page); + Page* corePage = adapter->page; return thirdPartyCookiePolicyPermits(corePage->mainFrame()->loader()->networkingContext(), url, firstPartyUrl); } @@ -936,12 +887,12 @@ void DumpRenderTreeSupportQt::enableMockScrollbars() Settings::setMockScrollbarsEnabled(true); } -QUrl DumpRenderTreeSupportQt::mediaContentUrlByElementId(QWebFrame* frame, const QString& elementId) +QUrl DumpRenderTreeSupportQt::mediaContentUrlByElementId(QWebFrameAdapter* adapter, const QString& elementId) { QUrl res; #if ENABLE(VIDEO) && USE(QT_MULTIMEDIA) - Frame* coreFrame = QWebFramePrivate::core(frame); + Frame* coreFrame = adapter->frame; if (!coreFrame) return res; @@ -967,10 +918,10 @@ QUrl DumpRenderTreeSupportQt::mediaContentUrlByElementId(QWebFrame* frame, const } // API Candidate? -void DumpRenderTreeSupportQt::setAlternateHtml(QWebFrame* frame, const QString& html, const QUrl& baseUrl, const QUrl& failingUrl) +void DumpRenderTreeSupportQt::setAlternateHtml(QWebFrameAdapter* adapter, const QString& html, const QUrl& baseUrl, const QUrl& failingUrl) { KURL kurl(baseUrl); - WebCore::Frame* coreFrame = QWebFramePrivate::core(frame); + WebCore::Frame* coreFrame = adapter->frame; WebCore::ResourceRequest request(kurl); const QByteArray utf8 = html.toUtf8(); WTF::RefPtr<WebCore::SharedBuffer> data = WebCore::SharedBuffer::create(utf8.constData(), utf8.length()); @@ -978,9 +929,9 @@ void DumpRenderTreeSupportQt::setAlternateHtml(QWebFrame* frame, const QString& coreFrame->loader()->load(request, substituteData, false); } -void DumpRenderTreeSupportQt::confirmComposition(QWebPage* page, const char* text) +void DumpRenderTreeSupportQt::confirmComposition(QWebPageAdapter *adapter, const char* text) { - Frame* frame = page->handle()->page->focusController()->focusedOrMainFrame(); + Frame* frame = adapter->page->focusController()->focusedOrMainFrame(); if (!frame) return; @@ -997,15 +948,9 @@ void DumpRenderTreeSupportQt::confirmComposition(QWebPage* page, const char* tex editor->insertText(String::fromUTF8(text), 0); } -QString DumpRenderTreeSupportQt::layerTreeAsText(QWebFrame* frame) -{ - WebCore::Frame* coreFrame = QWebFramePrivate::core(frame); - return coreFrame->layerTreeAsText(); -} - -void DumpRenderTreeSupportQt::injectInternalsObject(QWebFrame* frame) +void DumpRenderTreeSupportQt::injectInternalsObject(QWebFrameAdapter* adapter) { - WebCore::Frame* coreFrame = QWebFramePrivate::core(frame); + WebCore::Frame* coreFrame = adapter->frame; JSDOMWindow* window = toJSDOMWindow(coreFrame, mainThreadNormalWorld()); Q_ASSERT(window); @@ -1022,9 +967,9 @@ void DumpRenderTreeSupportQt::injectInternalsObject(JSContextRef context) WebCoreTestSupport::injectInternalsObject(context); } -void DumpRenderTreeSupportQt::resetInternalsObject(QWebFrame* frame) +void DumpRenderTreeSupportQt::resetInternalsObject(QWebFrameAdapter* adapter) { - WebCore::Frame* coreFrame = QWebFramePrivate::core(frame); + WebCore::Frame* coreFrame = adapter->frame; JSDOMWindow* window = toJSDOMWindow(coreFrame, mainThreadNormalWorld()); Q_ASSERT(window); @@ -1041,9 +986,9 @@ void DumpRenderTreeSupportQt::resetInternalsObject(JSContextRef context) WebCoreTestSupport::resetInternalsObject(context); } -QImage DumpRenderTreeSupportQt::paintPagesWithBoundaries(QWebFrame* qframe) +QImage DumpRenderTreeSupportQt::paintPagesWithBoundaries(QWebFrameAdapter* adapter) { - Frame* frame = QWebFramePrivate::core(qframe); + Frame* frame = adapter->frame; PrintContext printContext(frame); QRect rect = frame->view()->frameRect(); @@ -1084,119 +1029,21 @@ QImage DumpRenderTreeSupportQt::paintPagesWithBoundaries(QWebFrame* qframe) return image; } -void DumpRenderTreeSupportQt::setTrackRepaintRects(QWebFrame* frame, bool enable) +void DumpRenderTreeSupportQt::setTrackRepaintRects(QWebFrameAdapter* adapter, bool enable) { - QWebFramePrivate::core(frame)->view()->setTracksRepaints(enable); + adapter->frame->view()->setTracksRepaints(enable); } -bool DumpRenderTreeSupportQt::trackRepaintRects(QWebFrame* frame) +bool DumpRenderTreeSupportQt::trackRepaintRects(QWebFrameAdapter* adapter) { - return QWebFramePrivate::core(frame)->view()->isTrackingRepaints(); + return adapter->frame->view()->isTrackingRepaints(); } -void DumpRenderTreeSupportQt::getTrackedRepaintRects(QWebFrame* frame, QVector<QRect>& result) +void DumpRenderTreeSupportQt::getTrackedRepaintRects(QWebFrameAdapter* adapter, QVector<QRect>& result) { - Frame* coreFrame = QWebFramePrivate::core(frame); + Frame* coreFrame = adapter->frame; const Vector<IntRect>& rects = coreFrame->view()->trackedRepaintRects(); result.resize(rects.size()); for (size_t i = 0; i < rects.size(); ++i) result.append(rects[i]); } - -// Provide a backward compatibility with previously exported private symbols as of QtWebKit 4.6 release - -void QWEBKIT_EXPORT qt_resumeActiveDOMObjects(QWebFrame* frame) -{ - DumpRenderTreeSupportQt::resumeActiveDOMObjects(frame); -} - -void QWEBKIT_EXPORT qt_suspendActiveDOMObjects(QWebFrame* frame) -{ - DumpRenderTreeSupportQt::suspendActiveDOMObjects(frame); -} - -void QWEBKIT_EXPORT qt_drt_clearFrameName(QWebFrame* frame) -{ - DumpRenderTreeSupportQt::clearFrameName(frame); -} - -void QWEBKIT_EXPORT qt_drt_garbageCollector_collect() -{ - DumpRenderTreeSupportQt::garbageCollectorCollect(); -} - -void QWEBKIT_EXPORT qt_drt_garbageCollector_collectOnAlternateThread(bool waitUntilDone) -{ - DumpRenderTreeSupportQt::garbageCollectorCollectOnAlternateThread(waitUntilDone); -} - -int QWEBKIT_EXPORT qt_drt_javaScriptObjectsCount() -{ - return DumpRenderTreeSupportQt::javaScriptObjectsCount(); -} - -int QWEBKIT_EXPORT qt_drt_numberOfActiveAnimations(QWebFrame* frame) -{ - return DumpRenderTreeSupportQt::numberOfActiveAnimations(frame); -} - -void QWEBKIT_EXPORT qt_drt_overwritePluginDirectories() -{ - DumpRenderTreeSupportQt::overwritePluginDirectories(); -} - -bool QWEBKIT_EXPORT qt_drt_pauseAnimation(QWebFrame* frame, const QString& animationName, double time, const QString& elementId) -{ - return DumpRenderTreeSupportQt::pauseAnimation(frame, animationName, time, elementId); -} - -bool QWEBKIT_EXPORT qt_drt_pauseTransitionOfProperty(QWebFrame* frame, const QString& propertyName, double time, const QString &elementId) -{ - return DumpRenderTreeSupportQt::pauseTransitionOfProperty(frame, propertyName, time, elementId); -} - -void QWEBKIT_EXPORT qt_drt_resetOriginAccessWhiteLists() -{ - DumpRenderTreeSupportQt::resetOriginAccessWhiteLists(); -} - -void QWEBKIT_EXPORT qt_drt_run(bool b) -{ - DumpRenderTreeSupportQt::setDumpRenderTreeModeEnabled(b); -} - -void QWEBKIT_EXPORT qt_drt_whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains) -{ - DumpRenderTreeSupportQt::whiteListAccessFromOrigin(sourceOrigin, destinationProtocol, destinationHost, allowDestinationSubdomains); -} - -QString QWEBKIT_EXPORT qt_webpage_groupName(QWebPage* page) -{ - return DumpRenderTreeSupportQt::webPageGroupName(page); -} - -void QWEBKIT_EXPORT qt_webpage_setGroupName(QWebPage* page, const QString& groupName) -{ - DumpRenderTreeSupportQt::webPageSetGroupName(page, groupName); -} - -void QWEBKIT_EXPORT qt_dump_frame_loader(bool b) -{ - DumpRenderTreeSupportQt::dumpFrameLoader(b); -} - -void QWEBKIT_EXPORT qt_dump_resource_load_callbacks(bool b) -{ - DumpRenderTreeSupportQt::dumpResourceLoadCallbacks(b); -} - -void QWEBKIT_EXPORT qt_dump_editing_callbacks(bool b) -{ - DumpRenderTreeSupportQt::dumpEditingCallbacks(b); -} - -void QWEBKIT_EXPORT qt_dump_set_accepts_editing(bool b) -{ - DumpRenderTreeSupportQt::dumpSetAcceptsEditing(b); -} - diff --git a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h index d0600ffa7..72505b8d3 100644 --- a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h +++ b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h @@ -43,7 +43,8 @@ class QtDRTNodeRuntime; class QWebElement; class QWebFrame; -class QWebPage; +class QWebFrameAdapter; +class QWebPageAdapter; class QWebHistoryItem; class QWebScriptWorld; @@ -89,25 +90,23 @@ public: static void initialize(); - static void executeCoreCommandByName(QWebPage* page, const QString& name, const QString& value); - static bool isCommandEnabled(QWebPage* page, const QString& name); - static bool findString(QWebPage* page, const QString& string, const QStringList& optionArray); - static void setSmartInsertDeleteEnabled(QWebPage* page, bool enabled); - static void setSelectTrailingWhitespaceEnabled(QWebPage* page, bool enabled); - static QVariantList selectedRange(QWebPage* page); - static QVariantList firstRectForCharacterRange(QWebPage* page, int location, int length); - static void confirmComposition(QWebPage*, const char* text); + static void executeCoreCommandByName(QWebPageAdapter*, const QString& name, const QString& value); + static bool isCommandEnabled(QWebPageAdapter*, const QString& name); + static bool findString(QWebPageAdapter*, const QString&, const QStringList& optionArray); + static void setSmartInsertDeleteEnabled(QWebPageAdapter*, bool enabled); + static void setSelectTrailingWhitespaceEnabled(QWebPageAdapter*, bool enabled); + static QVariantList selectedRange(QWebPageAdapter*); + static QVariantList firstRectForCharacterRange(QWebPageAdapter*, int location, int length); + static void confirmComposition(QWebPageAdapter*, const char* text); - static bool pauseAnimation(QWebFrame*, const QString& name, double time, const QString& elementId); - static bool pauseTransitionOfProperty(QWebFrame*, const QString& name, double time, const QString& elementId); - static void suspendActiveDOMObjects(QWebFrame* frame); - static void resumeActiveDOMObjects(QWebFrame* frame); + static bool pauseAnimation(QWebFrameAdapter*, const QString& name, double time, const QString& elementId); + static bool pauseTransitionOfProperty(QWebFrameAdapter*, const QString& name, double time, const QString& elementId); static void setDomainRelaxationForbiddenForURLScheme(bool forbidden, const QString& scheme); - static void setFrameFlatteningEnabled(QWebPage*, bool); - static void setCaretBrowsingEnabled(QWebPage* page, bool value); - static void setAuthorAndUserStylesEnabled(QWebPage*, bool); - static void setDumpRenderTreeModeEnabled(bool b); + static void setFrameFlatteningEnabled(QWebPageAdapter*, bool); + static void setCaretBrowsingEnabled(QWebPageAdapter*, bool value); + static void setAuthorAndUserStylesEnabled(QWebPageAdapter*, bool); + static void setDumpRenderTreeModeEnabled(bool); static void garbageCollectorCollect(); static void garbageCollectorCollectOnAlternateThread(bool waitUntilDone); @@ -115,20 +114,20 @@ public: static void setValueForUser(const QWebElement&, const QString& value); static int javaScriptObjectsCount(); static void clearScriptWorlds(); - static void evaluateScriptInIsolatedWorld(QWebFrame* frame, int worldID, const QString& script); + static void evaluateScriptInIsolatedWorld(QWebFrameAdapter*, int worldID, const QString& script); - static void webInspectorExecuteScript(QWebPage* page, long callId, const QString& script); - static void webInspectorShow(QWebPage* page); - static void webInspectorClose(QWebPage* page); + static void webInspectorExecuteScript(QWebPageAdapter*, long callId, const QString& script); + static void webInspectorShow(QWebPageAdapter*); + static void webInspectorClose(QWebPageAdapter*); - static QString webPageGroupName(QWebPage *page); - static void webPageSetGroupName(QWebPage* page, const QString& groupName); - static void clearFrameName(QWebFrame* frame); + static QString webPageGroupName(QWebPageAdapter*); + static void webPageSetGroupName(QWebPageAdapter*, const QString& groupName); + static void clearFrameName(QWebFrameAdapter*); static void overwritePluginDirectories(); - static int numberOfActiveAnimations(QWebFrame*); - static bool hasDocumentElement(QWebFrame* frame); - static bool elementDoesAutoCompleteForElementWithId(QWebFrame* frame, const QString& elementId); - static void setWindowsBehaviorAsEditingBehavior(QWebPage*); + static int numberOfActiveAnimations(QWebFrameAdapter*); + static bool hasDocumentElement(QWebFrameAdapter*); + static bool elementDoesAutoCompleteForElementWithId(QWebFrameAdapter*, const QString& elementId); + static void setWindowsBehaviorAsEditingBehavior(QWebPageAdapter*); static void clearAllApplicationCaches(); @@ -136,86 +135,84 @@ public: static void removeWhiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains); static void resetOriginAccessWhiteLists(); - static void setMockDeviceOrientation(QWebPage*, bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma); + static void setMockDeviceOrientation(QWebPageAdapter*, bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma); - static void resetGeolocationMock(QWebPage*); - static void setMockGeolocationPermission(QWebPage*, bool allowed); - static void setMockGeolocationPosition(QWebPage*, double latitude, double longitude, double accuracy); - static void setMockGeolocationPositionUnavailableError(QWebPage*, const QString& message); - static int numberOfPendingGeolocationPermissionRequests(QWebPage*); + static void resetGeolocationMock(QWebPageAdapter*); + static void setMockGeolocationPermission(QWebPageAdapter*, bool allowed); + static void setMockGeolocationPosition(QWebPageAdapter*, double latitude, double longitude, double accuracy); + static void setMockGeolocationPositionUnavailableError(QWebPageAdapter*, const QString& message); + static int numberOfPendingGeolocationPermissionRequests(QWebPageAdapter*); static int workerThreadCount(); static QString markerTextForListItem(const QWebElement& listItem); - static QVariantMap computedStyleIncludingVisitedInfo(const QWebElement& element); + static QVariantMap computedStyleIncludingVisitedInfo(const QWebElement&); - static void dumpFrameLoader(bool b); + static void dumpFrameLoader(bool); static void dumpProgressFinishedCallback(bool); - static void dumpUserGestureInFrameLoader(bool b); - static void dumpResourceLoadCallbacks(bool b); - static void dumpResourceResponseMIMETypes(bool b); + static void dumpUserGestureInFrameLoader(bool); + static void dumpResourceLoadCallbacks(bool); + static void dumpResourceResponseMIMETypes(bool); static void dumpResourceLoadCallbacksPath(const QString& path); static void dumpWillCacheResponseCallbacks(bool); - static void setWillSendRequestReturnsNullOnRedirect(bool b); - static void setWillSendRequestReturnsNull(bool b); - static void setWillSendRequestClearHeaders(const QStringList& headers); - static void dumpHistoryCallbacks(bool b); - static void dumpVisitedLinksCallbacks(bool b); + static void setWillSendRequestReturnsNullOnRedirect(bool); + static void setWillSendRequestReturnsNull(bool); + static void setWillSendRequestClearHeaders(const QStringList&); + static void dumpHistoryCallbacks(bool); + static void dumpVisitedLinksCallbacks(bool); - static void setDeferMainResourceDataLoad(bool b); + static void setDeferMainResourceDataLoad(bool); - static void dumpEditingCallbacks(bool b); - static void dumpSetAcceptsEditing(bool b); + static void dumpEditingCallbacks(bool); + static void dumpSetAcceptsEditing(bool); - static void dumpNotification(bool b); + static void dumpNotification(bool); + static QString viewportAsText(QWebPageAdapter*, int deviceDPI, const QSize& deviceSize, const QSize& availableSize); - static QMap<QString, QWebHistoryItem> getChildHistoryItems(const QWebHistoryItem& historyItem); - static bool isTargetItem(const QWebHistoryItem& historyItem); - static QString historyItemTarget(const QWebHistoryItem& historyItem); + static QMap<QString, QWebHistoryItem> getChildHistoryItems(const QWebHistoryItem&); + static bool isTargetItem(const QWebHistoryItem&); + static QString historyItemTarget(const QWebHistoryItem&); - static bool shouldClose(QWebFrame* frame); + static bool shouldClose(QWebFrameAdapter*); static void setCustomPolicyDelegate(bool enabled, bool permissive); - static void addUserStyleSheet(QWebPage* page, const QString& sourceCode); - static void removeUserStyleSheets(QWebPage*); + static void addUserStyleSheet(QWebPageAdapter*, const QString& sourceCode); + static void removeUserStyleSheets(QWebPageAdapter*); static void simulateDesktopNotificationClick(const QString& title); - static QString viewportAsText(QWebPage*, int deviceDPI, const QSize& deviceSize, const QSize& availableSize); - static void scalePageBy(QWebFrame*, float scale, const QPoint& origin); + static void scalePageBy(QWebFrameAdapter*, float scale, const QPoint& origin); - static QString responseMimeType(QWebFrame*); - static void clearOpener(QWebFrame*); + static QString responseMimeType(QWebFrameAdapter*); + static void clearOpener(QWebFrameAdapter*); static void addURLToRedirect(const QString& origin, const QString& destination); - static QStringList contextMenu(QWebPage*); + static QStringList contextMenu(QWebPageAdapter*); static double defaultMinimumTimerInterval(); // Not really tied to WebView - static void setMinimumTimerInterval(QWebPage*, double); + static void setMinimumTimerInterval(QWebPageAdapter*, double); - static QUrl mediaContentUrlByElementId(QWebFrame*, const QString& elementId); - static void setAlternateHtml(QWebFrame*, const QString& html, const QUrl& baseUrl, const QUrl& failingUrl); + static QUrl mediaContentUrlByElementId(QWebFrameAdapter*, const QString& elementId); + static void setAlternateHtml(QWebFrameAdapter*, const QString& html, const QUrl& baseUrl, const QUrl& failingUrl); - static QString layerTreeAsText(QWebFrame*); - - static void injectInternalsObject(QWebFrame*); + static void injectInternalsObject(QWebFrameAdapter*); static void injectInternalsObject(JSContextRef); - static void resetInternalsObject(QWebFrame*); + static void resetInternalsObject(QWebFrameAdapter*); static void resetInternalsObject(JSContextRef); - static void setInteractiveFormValidationEnabled(QWebPage*, bool); + static void setInteractiveFormValidationEnabled(QWebPageAdapter*, bool); - static void setDefersLoading(QWebPage*, bool flag); - static void goBack(QWebPage*); + static void setDefersLoading(QWebPageAdapter*, bool flag); + static void goBack(QWebPageAdapter*); - static bool thirdPartyCookiePolicyAllows(QWebPage*, const QUrl&, const QUrl& firstPartyUrl); + static bool thirdPartyCookiePolicyAllows(QWebPageAdapter*, const QUrl&, const QUrl& firstPartyUrl); static void enableMockScrollbars(); - static QImage paintPagesWithBoundaries(QWebFrame*); + static QImage paintPagesWithBoundaries(QWebFrameAdapter*); - static void setTrackRepaintRects(QWebFrame*, bool enable); - static bool trackRepaintRects(QWebFrame*); - static void getTrackedRepaintRects(QWebFrame*, QVector<QRect>& result); + static void setTrackRepaintRects(QWebFrameAdapter*, bool enable); + static bool trackRepaintRects(QWebFrameAdapter*); + static void getTrackedRepaintRects(QWebFrameAdapter*, QVector<QRect>& result); }; #endif diff --git a/Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp index eb73c9e9d..78c36f2b9 100644 --- a/Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp @@ -32,7 +32,6 @@ #include "EditorClientQt.h" #include "Document.h" -#include "UndoStepQt.h" #include "Editor.h" #include "FocusController.h" #include "Frame.h" @@ -44,6 +43,7 @@ #include "Page.h" #include "Pasteboard.h" #include "PlatformKeyboardEvent.h" +#include "QWebPageAdapter.h" #include "QWebPageClient.h" #include "Range.h" #include "Settings.h" @@ -51,11 +51,10 @@ #include "StylePropertySet.h" #include "WindowsKeyboardCodes.h" #include "qguiapplication.h" -#include "qwebpage.h" -#include "qwebpage_p.h" #include <QClipboard> -#include <QUndoStack> +#include <QKeyEvent> +#include <QKeySequence> #include <stdio.h> #include <wtf/OwnPtr.h> @@ -80,8 +79,8 @@ static QString dumpRange(WebCore::Range *range) WebCore::ExceptionCode code; QString str = QString::fromLatin1("range from %1 of %2 to %3 of %4") - .arg(range->startOffset(code)).arg(dumpPath(range->startContainer(code))) - .arg(range->endOffset(code)).arg(dumpPath(range->endContainer(code))); + .arg(range->startOffset(code)).arg(dumpPath(range->startContainer(code))) + .arg(range->endOffset(code)).arg(dumpPath(range->endContainer(code))); return str; } @@ -104,7 +103,7 @@ bool EditorClientQt::shouldDeleteRange(Range* range) bool EditorClientQt::shouldShowDeleteInterface(HTMLElement* element) { - if (QWebPagePrivate::drtRun) + if (QWebPageAdapter::drtRun) return element->getAttribute(classAttr) == "needsDeletionUI"; return false; } @@ -148,7 +147,7 @@ bool EditorClientQt::shouldInsertText(const String& string, Range* range, Editor }; printf("EDITING DELEGATE: shouldInsertText:%s replacingDOMRange:%s givenAction:%s\n", - QString(string).toUtf8().constData(), dumpRange(range).toUtf8().constData(), insertactionstring[action]); + QString(string).toUtf8().constData(), dumpRange(range).toUtf8().constData(), insertactionstring[action]); } return acceptsEditing; } @@ -166,19 +165,18 @@ bool EditorClientQt::shouldChangeSelectedRange(Range* currentRange, Range* propo }; printf("EDITING DELEGATE: shouldChangeSelectedDOMRange:%s toDOMRange:%s affinity:%s stillSelecting:%s\n", - dumpRange(currentRange).toUtf8().constData(), - dumpRange(proposedRange).toUtf8().constData(), - affinitystring[selectionAffinity], boolstring[stillSelecting]); + dumpRange(currentRange).toUtf8().constData(), + dumpRange(proposedRange).toUtf8().constData(), + affinitystring[selectionAffinity], boolstring[stillSelecting]); } return acceptsEditing; } -bool EditorClientQt::shouldApplyStyle(WebCore::StylePropertySet* style, - WebCore::Range* range) +bool EditorClientQt::shouldApplyStyle(WebCore::StylePropertySet* style, WebCore::Range* range) { if (dumpEditingCallbacks) printf("EDITING DELEGATE: shouldApplyStyle:%s toElementsInDOMRange:%s\n", - QString(style->asText()).toUtf8().constData(), dumpRange(range).toUtf8().constData()); + QString(style->asText()).toUtf8().constData(), dumpRange(range).toUtf8().constData()); return acceptsEditing; } @@ -199,9 +197,8 @@ void EditorClientQt::respondToChangedContents() { if (dumpEditingCallbacks) printf("EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification\n"); - m_page->d->updateEditorActions(); - emit m_page->contentsChanged(); + m_page->respondToChangedContents(); } void EditorClientQt::respondToChangedSelection(Frame* frame) @@ -220,8 +217,7 @@ void EditorClientQt::respondToChangedSelection(Frame* frame) Pasteboard::generalPasteboard()->setSelectionMode(oldSelectionMode); } - m_page->d->updateEditorActions(); - emit m_page->selectionChanged(); + m_page->respondToChangedSelection(); if (!frame->editor()->ignoreCompositionSelectionChange()) emit m_page->microFocusChanged(); } @@ -250,10 +246,10 @@ bool EditorClientQt::selectWordBeforeMenuEvent() void EditorClientQt::registerUndoStep(WTF::PassRefPtr<WebCore::UndoStep> step) { #ifndef QT_NO_UNDOSTACK - Frame* frame = m_page->d->page->focusController()->focusedOrMainFrame(); + Frame* frame = m_page->page->focusController()->focusedOrMainFrame(); if (m_inUndoRedo || (frame && !frame->editor()->lastEditCommand() /* HACK!! Don't recreate undos */)) return; - m_page->undoStack()->push(new UndoStepQt(step)); + m_page->registerUndoStep(step); #endif // QT_NO_UNDOSTACK } @@ -264,7 +260,7 @@ void EditorClientQt::registerRedoStep(WTF::PassRefPtr<WebCore::UndoStep>) void EditorClientQt::clearUndoRedoOperations() { #ifndef QT_NO_UNDOSTACK - return m_page->undoStack()->clear(); + return m_page->clearUndoStack(); #endif } @@ -283,7 +279,7 @@ bool EditorClientQt::canUndo() const #ifdef QT_NO_UNDOSTACK return false; #else - return m_page->undoStack()->canUndo(); + return m_page->canUndo(); #endif } @@ -292,7 +288,7 @@ bool EditorClientQt::canRedo() const #ifdef QT_NO_UNDOSTACK return false; #else - return m_page->undoStack()->canRedo(); + return m_page->canRedo(); #endif } @@ -300,7 +296,7 @@ void EditorClientQt::undo() { #ifndef QT_NO_UNDOSTACK m_inUndoRedo = true; - m_page->undoStack()->undo(); + m_page->undo(); m_inUndoRedo = false; #endif } @@ -309,7 +305,7 @@ void EditorClientQt::redo() { #ifndef QT_NO_UNDOSTACK m_inUndoRedo = true; - m_page->undoStack()->redo(); + m_page->redo(); m_inUndoRedo = false; #endif } @@ -324,7 +320,7 @@ bool EditorClientQt::shouldInsertNode(Node* node, Range* range, EditorInsertActi }; printf("EDITING DELEGATE: shouldInsertNode:%s replacingDOMRange:%s givenAction:%s\n", dumpPath(node).toUtf8().constData(), - dumpRange(range).toUtf8().constData(), insertactionstring[action]); + dumpRange(range).toUtf8().constData(), insertactionstring[action]); } return acceptsEditing; } @@ -336,18 +332,18 @@ void EditorClientQt::pageDestroyed() bool EditorClientQt::smartInsertDeleteEnabled() { - return m_page->d->smartInsertDeleteEnabled; + return m_smartInsertDeleteEnabled; } void EditorClientQt::toggleSmartInsertDelete() { - bool current = m_page->d->smartInsertDeleteEnabled; - m_page->d->smartInsertDeleteEnabled = !current; + bool current = m_smartInsertDeleteEnabled; + m_smartInsertDeleteEnabled = !current; } bool EditorClientQt::isSelectTrailingWhitespaceEnabled() { - return m_page->d->selectTrailingWhitespaceEnabled; + return m_selectTrailingWhitespaceEnabled; } void EditorClientQt::toggleContinuousSpellChecking() @@ -416,7 +412,7 @@ const char* editorCommandForKeyDownEvent(const KeyboardEvent* event) void EditorClientQt::handleKeyboardEvent(KeyboardEvent* event) { - Frame* frame = m_page->d->page->focusController()->focusedOrMainFrame(); + Frame* frame = m_page->page->focusController()->focusedOrMainFrame(); if (!frame) return; @@ -444,20 +440,19 @@ void EditorClientQt::handleKeyboardEvent(KeyboardEvent* event) } #ifndef QT_NO_SHORTCUT - QWebPage::WebAction action = QWebPagePrivate::editorActionForKeyEvent(kevent->qtEvent()); - if (action != QWebPage::NoWebAction && !doSpatialNavigation) { - const char* cmd = QWebPagePrivate::editorCommandForWebActions(action); + const char* cmd = m_page->editorCommandForKeyEvent(kevent->qtEvent()); + if (cmd && !doSpatialNavigation) { // WebKit doesn't have enough information about mode to decide how commands that just insert text if executed via Editor should be treated, // so we leave it upon WebCore to either handle them immediately (e.g. Tab that changes focus) or let a keypress event be generated // (e.g. Tab that inserts a Tab character, or Enter). - if (cmd && frame->editor()->command(cmd).isTextInsertion() + if (frame->editor()->command(cmd).isTextInsertion() && kevent->type() == PlatformEvent::RawKeyDown) return; - m_page->triggerAction(action); + m_page->triggerActionForKeyEvent(kevent->qtEvent()); event->setDefaultHandled(); return; - } else + } #endif // QT_NO_SHORTCUT { String commandName = editorCommandForKeyDownEvent(event); @@ -501,7 +496,7 @@ void EditorClientQt::handleKeyboardEvent(KeyboardEvent* event) } // Non editable content. - if (m_page->handle()->page->settings()->caretBrowsingEnabled()) { + if (m_page->page->settings()->caretBrowsingEnabled()) { switch (kevent->windowsVirtualKeyCode()) { case VK_LEFT: case VK_RIGHT: @@ -511,15 +506,13 @@ void EditorClientQt::handleKeyboardEvent(KeyboardEvent* event) case VK_END: { #ifndef QT_NO_SHORTCUT - QWebPage::WebAction action = QWebPagePrivate::editorActionForKeyEvent(kevent->qtEvent()); - ASSERT(action != QWebPage::NoWebAction); - m_page->triggerAction(action); + m_page->triggerActionForKeyEvent(kevent->qtEvent()); event->setDefaultHandled(); #endif return; } case VK_PRIOR: // PageUp - case VK_NEXT: // PageDown + case VK_NEXT: // PageDown { String commandName = editorCommandForKeyDownEvent(event); ASSERT(!commandName.isEmpty()); @@ -532,7 +525,7 @@ void EditorClientQt::handleKeyboardEvent(KeyboardEvent* event) #ifndef QT_NO_SHORTCUT if (kevent->qtEvent() == QKeySequence::Copy) { - m_page->triggerAction(QWebPage::Copy); + m_page->triggerCopyAction(); event->setDefaultHandled(); return; } @@ -543,8 +536,12 @@ void EditorClientQt::handleInputMethodKeydown(KeyboardEvent*) { } -EditorClientQt::EditorClientQt(QWebPage* page) - : m_page(page), m_editing(false), m_inUndoRedo(false) +EditorClientQt::EditorClientQt(QWebPageAdapter* pageAdapter) + : m_page(pageAdapter) + , m_editing(false) + , m_inUndoRedo(false) + , m_smartInsertDeleteEnabled(true) + , m_selectTrailingWhitespaceEnabled(false) { } @@ -607,12 +604,12 @@ void EditorClientQt::willSetInputMethodState() void EditorClientQt::setInputMethodState(bool active) { - QWebPageClient* webPageClient = m_page->d->client.get(); + QWebPageClient* webPageClient = m_page->client.data(); if (webPageClient) { Qt::InputMethodHints hints; HTMLInputElement* inputElement = 0; - Frame* frame = m_page->d->page->focusController()->focusedOrMainFrame(); + Frame* frame = m_page->page->focusController()->focusedOrMainFrame(); if (frame && frame->document() && frame->document()->focusedNode()) if (frame->document()->focusedNode()->hasTagName(HTMLNames::inputTag)) inputElement = static_cast<HTMLInputElement*>(frame->document()->focusedNode()); diff --git a/Source/WebKit/qt/WebCoreSupport/EditorClientQt.h b/Source/WebKit/qt/WebCoreSupport/EditorClientQt.h index 863c67b71..c49be4a40 100644 --- a/Source/WebKit/qt/WebCoreSupport/EditorClientQt.h +++ b/Source/WebKit/qt/WebCoreSupport/EditorClientQt.h @@ -36,12 +36,13 @@ #include <wtf/RefCounted.h> class QWebPage; +class QWebPageAdapter; namespace WebCore { class EditorClientQt : public EditorClient { public: - EditorClientQt(QWebPage* page); + EditorClientQt(QWebPageAdapter*); virtual void pageDestroyed(); virtual void frameWillDetachPage(Frame*) { } @@ -109,14 +110,19 @@ public: bool isEditing() const; + void setSmartInsertDeleteEnabled(bool b) { m_smartInsertDeleteEnabled = b; } + void setSelectTrailingWhitespaceEnabled(bool b) { m_selectTrailingWhitespaceEnabled = b; } + static bool dumpEditingCallbacks; static bool acceptsEditing; private: TextCheckerClientQt m_textCheckerClient; - QWebPage* m_page; + QWebPageAdapter* m_page; bool m_editing; bool m_inUndoRedo; // our undo stack works differently - don't re-enter! + bool m_smartInsertDeleteEnabled; + bool m_selectTrailingWhitespaceEnabled; }; } diff --git a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index 0731d9315..7a23ee268 100644 --- a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -59,7 +59,10 @@ #include "PluginDatabase.h" #include "ProgressTracker.h" #include "QNetworkReplyHandler.h" +#include "QWebFrameAdapter.h" +#include "QWebPageAdapter.h" #include "QWebPageClient.h" +#include "QtPluginWidgetAdapter.h" #include "RenderPart.h" #include "ResourceHandle.h" #include "ResourceHandleInternal.h" @@ -69,34 +72,30 @@ #include "Settings.h" #include "ViewportArguments.h" #include "WebEventConversion.h" - -#include "qwebframe.h" -#include "qwebframe_p.h" +#include "qwebhistory.h" #include "qwebhistory_p.h" #include "qwebhistoryinterface.h" -#include "qwebpage.h" -#include "qwebpage_p.h" #include "qwebpluginfactory.h" #include <QCoreApplication> #include <QDebug> #include <QFileInfo> -#include <QGraphicsScene> -#include <QGraphicsWidget> +#include <QMouseEvent> #include <QNetworkReply> #include <QNetworkRequest> #include <QStringList> #include <wtf/OwnPtr.h> +#include <wtf/text/StringBuilder.h> static QMap<unsigned long, QString> dumpAssignedUrls; // Compare with the file "WebKit/Tools/DumpRenderTree/mac/FrameLoadDelegate.mm". static QString drtDescriptionSuitableForTestResult(WebCore::Frame* webCoreFrame) { - QWebFrame* frame = QWebFramePrivate::kit(webCoreFrame); - QString name = frame->frameName(); + QWebFrameAdapter* frame = QWebFrameAdapter::kit(webCoreFrame); + QString name = webCoreFrame->tree()->uniqueName(); - bool isMainFrame = frame == frame->page()->mainFrame(); + bool isMainFrame = frame == frame->pageAdapter->mainFrameAdapter(); if (isMainFrame) { if (!name.isEmpty()) return QString::fromLatin1("main frame \"%1\"").arg(name); @@ -216,24 +215,24 @@ FrameLoaderClientQt::~FrameLoaderClientQt() { } -void FrameLoaderClientQt::setFrame(QWebFrame* webFrame, Frame* frame) +void FrameLoaderClientQt::setFrame(QWebFrameAdapter* webFrame, Frame* frame) { m_webFrame = webFrame; m_frame = frame; - if (!m_webFrame || !m_webFrame->page()) { + if (!m_webFrame || !m_webFrame->pageAdapter) { qWarning("FrameLoaderClientQt::setFrame frame without Page!"); return; } connect(this, SIGNAL(loadProgress(int)), - m_webFrame->page(), SIGNAL(loadProgress(int))); + m_webFrame->pageAdapter->handle(), SIGNAL(loadProgress(int))); connect(this, SIGNAL(unsupportedContent(QNetworkReply*)), - m_webFrame->page(), SIGNAL(unsupportedContent(QNetworkReply*))); + m_webFrame->pageAdapter->handle(), SIGNAL(unsupportedContent(QNetworkReply*))); connect(this, SIGNAL(titleChanged(QString)), - m_webFrame, SIGNAL(titleChanged(QString))); + m_webFrame->handle(), SIGNAL(titleChanged(QString))); } void FrameLoaderClientQt::callPolicyFunction(FramePolicyFunction function, PolicyAction action) @@ -261,11 +260,11 @@ void FrameLoaderClientQt::transitionToCommittedForNewPage() ASSERT(m_frame); ASSERT(m_webFrame); - QBrush brush = m_webFrame->page()->palette().brush(QPalette::Base); + QObject* qWebPage = m_webFrame->pageAdapter->handle(); + QBrush brush = qWebPage->property("palette").value<QPalette>().brush(QPalette::Base); QColor backgroundColor = brush.style() == Qt::SolidPattern ? brush.color() : QColor(); - QWebPage* page = m_webFrame->page(); - const QSize preferredLayoutSize = page->preferredContentsSize(); + const QSize preferredLayoutSize = qWebPage->property("preferredContentsSize").toSize(); ScrollbarMode hScrollbar = (ScrollbarMode) m_webFrame->scrollBarPolicy(Qt::Horizontal); ScrollbarMode vScrollbar = (ScrollbarMode) m_webFrame->scrollBarPolicy(Qt::Vertical); @@ -275,17 +274,18 @@ void FrameLoaderClientQt::transitionToCommittedForNewPage() // The HistoryController will update the scroll position later if needed. IntRect currentVisibleContentRect = m_frame->view() ? IntRect(IntPoint::zero(), m_frame->view()->fixedVisibleContentRect().size()) : IntRect(); - m_frame->createView(m_webFrame->page()->viewportSize(), - backgroundColor, !backgroundColor.alpha(), - preferredLayoutSize.isValid() ? IntSize(preferredLayoutSize) : IntSize(), - currentVisibleContentRect, - preferredLayoutSize.isValid(), - hScrollbar, hLock, - vScrollbar, vLock); + m_frame->createView(qWebPage->property("viewportSize").toSize(), + backgroundColor, !backgroundColor.alpha(), + preferredLayoutSize.isValid() ? IntSize(preferredLayoutSize) : IntSize(), + currentVisibleContentRect, + preferredLayoutSize.isValid(), + hScrollbar, hLock, + vScrollbar, vLock); bool isMainFrame = m_frame == m_frame->page()->mainFrame(); - if (isMainFrame && page->d->client) { - bool resizesToContents = page->d->client->viewResizesToContentsEnabled(); + if (isMainFrame &&m_webFrame->pageAdapter->client) { + bool resizesToContents = m_webFrame->pageAdapter->client->viewResizesToContentsEnabled(); + m_frame->view()->setPaintsEntireContents(resizesToContents); m_frame->view()->setDelegatesScrolling(resizesToContents); } @@ -392,8 +392,8 @@ void FrameLoaderClientQt::dispatchDidChangeLocationWithinPage() if (!m_webFrame) return; - m_webFrame->d->emitUrlChanged(); - m_webFrame->page()->d->updateNavigationActions(); + m_webFrame->emitUrlChanged(); + m_webFrame->pageAdapter->updateNavigationActions(); } @@ -440,7 +440,7 @@ void FrameLoaderClientQt::dispatchDidStartProvisionalLoad() return; emitLoadStarted(); postProgressEstimateChangedNotification(); - emit m_webFrame->provisionalLoad(); + m_webFrame->didStartProvisionalLoad(); } @@ -478,8 +478,8 @@ void FrameLoaderClientQt::dispatchDidCommitLoad() if (m_frame->tree()->parent() || !m_webFrame) return; - m_webFrame->d->emitUrlChanged(); - m_webFrame->page()->d->updateNavigationActions(); + m_webFrame->emitUrlChanged(); + m_webFrame->pageAdapter->updateNavigationActions(); // We should assume first the frame has no title. If it has, then the above dispatchDidReceiveTitle() // will be called very soon with the correct title. @@ -490,7 +490,7 @@ void FrameLoaderClientQt::dispatchDidCommitLoad() if (!isMainFrame) return; - emit m_webFrame->page()->viewportChangeRequested(); + emit m_webFrame->pageAdapter->emitViewportChangeRequested(); } @@ -499,7 +499,7 @@ void FrameLoaderClientQt::dispatchDidFinishDocumentLoad() if (dumpFrameLoaderCallbacks) printf("%s - didFinishDocumentLoadForFrame\n", qPrintable(drtDescriptionSuitableForTestResult(m_frame))); - if (QWebPagePrivate::drtRun) { + if (QWebPageAdapter::drtRun) { int unloadEventCount = m_frame->document()->domWindow()->pendingUnloadEventListeners(); if (unloadEventCount) printf("%s - has %u onunload handler(s)\n", qPrintable(drtDescriptionSuitableForTestResult(m_frame)), unloadEventCount); @@ -508,7 +508,7 @@ void FrameLoaderClientQt::dispatchDidFinishDocumentLoad() if (m_frame->tree()->parent() || !m_webFrame) return; - m_webFrame->page()->d->updateNavigationActions(); + m_webFrame->pageAdapter->updateNavigationActions(); } @@ -520,7 +520,7 @@ void FrameLoaderClientQt::dispatchDidFinishLoad() if (!m_webFrame) return; - m_webFrame->page()->d->updateNavigationActions(); + m_webFrame->pageAdapter->updateNavigationActions(); emitLoadFinished(true); } @@ -530,7 +530,7 @@ void FrameLoaderClientQt::dispatchDidLayout(LayoutMilestones milestones) return; if (milestones & DidFirstVisuallyNonEmptyLayout) - emit m_webFrame->initialLayoutCompleted(); + m_webFrame->emitInitialLayoutCompleted(); } void FrameLoaderClientQt::dispatchShow() @@ -545,8 +545,7 @@ void FrameLoaderClientQt::cancelPolicyCheck() } -void FrameLoaderClientQt::dispatchWillSubmitForm(FramePolicyFunction function, - PassRefPtr<FormState>) +void FrameLoaderClientQt::dispatchWillSubmitForm(FramePolicyFunction function, PassRefPtr<FormState>) { notImplemented(); // FIXME: This is surely too simple. @@ -560,7 +559,7 @@ void FrameLoaderClientQt::postProgressStartedNotification() m_isOriginatingLoad = true; if (m_frame->tree()->parent() || !m_webFrame) return; - m_webFrame->page()->d->updateNavigationActions(); + m_webFrame->pageAdapter->updateNavigationActions(); } void FrameLoaderClientQt::postProgressEstimateChangedNotification() @@ -577,14 +576,11 @@ void FrameLoaderClientQt::postProgressFinishedNotification() // Send a mousemove event to: // (1) update the cursor to change according to whatever is underneath the mouse cursor right now; // (2) display the tool tip if the mouse hovers a node which has a tool tip. - if (m_frame && m_frame->eventHandler() && m_webFrame->page()) { - QWidget* view = m_webFrame->page()->view(); - if (view && view->hasFocus()) { - QPoint localPos = view->mapFromGlobal(QCursor::pos()); - if (view->rect().contains(localPos)) { - QMouseEvent event(QEvent::MouseMove, localPos, Qt::NoButton, Qt::NoButton, Qt::NoModifier); - m_frame->eventHandler()->mouseMoved(convertMouseEvent(&event, 0)); - } + if (m_frame && m_frame->eventHandler() && m_webFrame) { + QPoint localPos; + if (m_webFrame->handleProgressFinished(&localPos)) { + QMouseEvent event(QEvent::MouseMove, localPos, Qt::NoButton, Qt::NoButton, Qt::NoModifier); + m_frame->eventHandler()->mouseMoved(convertMouseEvent(&event, 0)); } } } @@ -655,7 +651,7 @@ void FrameLoaderClientQt::frameLoadCompleted() // Note that this can be called multiple times. if (!m_webFrame) return; - m_webFrame->page()->d->updateNavigationActions(); + m_webFrame->pageAdapter->updateNavigationActions(); } @@ -663,7 +659,7 @@ void FrameLoaderClientQt::restoreViewState() { if (!m_webFrame) return; - emit m_webFrame->page()->restoreFrameStateRequested(m_webFrame); + m_webFrame->pageAdapter->emitRestoreFrameStateRequested(m_webFrame); } @@ -700,21 +696,23 @@ void FrameLoaderClientQt::setTitle(const StringWithDirection& title, const KURL& String FrameLoaderClientQt::userAgent(const KURL& url) { - if (m_webFrame) { - return m_webFrame->page()->userAgentForUrl(url).remove(QLatin1Char('\n')).remove(QLatin1Char('\r')); - } + if (m_webFrame) + return m_webFrame->pageAdapter->userAgentForUrl(url).remove(QLatin1Char('\n')).remove(QLatin1Char('\r')); return String(); } void FrameLoaderClientQt::dispatchDidReceiveIcon() { if (m_webFrame) - emit m_webFrame->iconChanged(); + m_webFrame->emitIconChanged(); } void FrameLoaderClientQt::frameLoaderDestroyed() { - delete m_webFrame; + // Delete QWebFrame (handle()), which owns QWebFramePrivate, which + // _is_ a QWebFrameAdapter. + if (m_webFrame) + delete m_webFrame->handle(); m_frame = 0; m_webFrame = 0; @@ -732,7 +730,7 @@ void FrameLoaderClientQt::dispatchDidClearWindowObjectInWorld(DOMWrapperWorld* w return; if (m_webFrame) - m_webFrame->d->didClearWindowObject(); + m_webFrame->didClearWindowObject(); } void FrameLoaderClientQt::documentElementAvailable() @@ -744,7 +742,7 @@ void FrameLoaderClientQt::didPerformFirstNavigation() const { if (m_frame->tree()->parent() || !m_webFrame) return; - m_webFrame->page()->d->updateNavigationActions(); + m_webFrame->pageAdapter->updateNavigationActions(); } void FrameLoaderClientQt::registerForIconNotification(bool shouldRegister) @@ -760,8 +758,8 @@ void FrameLoaderClientQt::registerForIconNotification(bool shouldRegister) void FrameLoaderClientQt::onIconLoadedForPageURL(const QString& url) { #if ENABLE(ICONDATABASE) - if (m_webFrame && m_webFrame->url() == url) - emit m_webFrame->iconChanged(); + if (m_webFrame && m_webFrame->url == url) + m_webFrame->emitIconChanged(); #endif } @@ -799,16 +797,16 @@ void FrameLoaderClientQt::updateGlobalHistoryRedirectLinks() if (!loader->clientRedirectSourceForHistory().isNull()) { if (dumpHistoryCallbacks) { printf("WebView performed a client redirect from \"%s\" to \"%s\".\n", - qPrintable(QString(loader->clientRedirectSourceForHistory())), - qPrintable(QString(loader->clientRedirectDestinationForHistory()))); + qPrintable(QString(loader->clientRedirectSourceForHistory())), + qPrintable(QString(loader->clientRedirectDestinationForHistory()))); } } if (!loader->serverRedirectSourceForHistory().isNull()) { if (dumpHistoryCallbacks) { printf("WebView performed a server redirect from \"%s\" to \"%s\".\n", - qPrintable(QString(loader->serverRedirectSourceForHistory())), - qPrintable(QString(loader->serverRedirectDestinationForHistory()))); + qPrintable(QString(loader->serverRedirectSourceForHistory())), + qPrintable(QString(loader->serverRedirectDestinationForHistory()))); } } } @@ -850,7 +848,7 @@ void FrameLoaderClientQt::didDetectXSS(const KURL&, bool) void FrameLoaderClientQt::saveViewStateToItem(WebCore::HistoryItem* item) { QWebHistoryItem historyItem(new QWebHistoryItemPrivate(item)); - emit m_webFrame->page()->saveFrameStateRequested(m_webFrame, &historyItem); + m_webFrame->pageAdapter->emitSaveFrameStateRequested(m_webFrame, &historyItem); } bool FrameLoaderClientQt::canCachePage() const @@ -896,7 +894,7 @@ void FrameLoaderClientQt::committedLoad(WebCore::DocumentLoader* loader, const c WebCore::ResourceError FrameLoaderClientQt::cancelledError(const WebCore::ResourceRequest& request) { ResourceError error = ResourceError("QtNetwork", QNetworkReply::OperationCanceledError, request.url().string(), - QCoreApplication::translate("QWebFrame", "Request cancelled", 0)); + QCoreApplication::translate("QWebFrame", "Request cancelled", 0)); error.setIsCancellation(true); return error; } @@ -916,38 +914,38 @@ enum { WebCore::ResourceError FrameLoaderClientQt::blockedError(const WebCore::ResourceRequest& request) { return ResourceError("WebKitErrorDomain", WebKitErrorCannotUseRestrictedPort, request.url().string(), - QCoreApplication::translate("QWebFrame", "Request blocked", 0)); + QCoreApplication::translate("QWebFrame", "Request blocked", 0)); } WebCore::ResourceError FrameLoaderClientQt::cannotShowURLError(const WebCore::ResourceRequest& request) { return ResourceError("WebKitErrorDomain", WebKitErrorCannotShowURL, request.url().string(), - QCoreApplication::translate("QWebFrame", "Cannot show URL", 0)); + QCoreApplication::translate("QWebFrame", "Cannot show URL", 0)); } WebCore::ResourceError FrameLoaderClientQt::interruptedForPolicyChangeError(const WebCore::ResourceRequest& request) { return ResourceError("WebKitErrorDomain", WebKitErrorFrameLoadInterruptedByPolicyChange, request.url().string(), - QCoreApplication::translate("QWebFrame", "Frame load interrupted by policy change", 0)); + QCoreApplication::translate("QWebFrame", "Frame load interrupted by policy change", 0)); } WebCore::ResourceError FrameLoaderClientQt::cannotShowMIMETypeError(const WebCore::ResourceResponse& response) { return ResourceError("WebKitErrorDomain", WebKitErrorCannotShowMIMEType, response.url().string(), - QCoreApplication::translate("QWebFrame", "Cannot show mimetype", 0)); + QCoreApplication::translate("QWebFrame", "Cannot show mimetype", 0)); } WebCore::ResourceError FrameLoaderClientQt::fileDoesNotExistError(const WebCore::ResourceResponse& response) { return ResourceError("QtNetwork", QNetworkReply::ContentNotFoundError, response.url().string(), - QCoreApplication::translate("QWebFrame", "File does not exist", 0)); + QCoreApplication::translate("QWebFrame", "File does not exist", 0)); } WebCore::ResourceError FrameLoaderClientQt::pluginWillHandleLoadError(const WebCore::ResourceResponse& response) { return ResourceError("WebKit", WebKitErrorPluginWillHandleLoad, response.url().string(), - QCoreApplication::translate("QWebFrame", "Loading is handled by the media engine", 0)); + QCoreApplication::translate("QWebFrame", "Loading is handled by the media engine", 0)); } bool FrameLoaderClientQt::shouldFallBack(const WebCore::ResourceError& error) @@ -991,8 +989,7 @@ void FrameLoaderClientQt::download(WebCore::ResourceHandle* handle, const WebCor QNetworkReplyHandler* handler = handle->getInternal()->m_job; QNetworkReply* reply = handler->release(); if (reply) { - QWebPage* page = m_webFrame->page(); - if (page->forwardUnsupportedContent()) + if (m_webFrame->pageAdapter->forwardUnsupportedContent) emit unsupportedContent(reply); else reply->abort(); @@ -1024,9 +1021,9 @@ void FrameLoaderClientQt::dispatchWillSendRequest(WebCore::DocumentLoader*, unsi { if (dumpResourceLoadCallbacks) printf("%s - willSendRequest %s redirectResponse %s\n", - qPrintable(dumpAssignedUrls[identifier]), - qPrintable(drtDescriptionSuitableForTestResult(newRequest)), - (redirectResponse.isNull()) ? "(null)" : qPrintable(drtDescriptionSuitableForTestResult(redirectResponse))); + qPrintable(dumpAssignedUrls[identifier]), + qPrintable(drtDescriptionSuitableForTestResult(newRequest)), + (redirectResponse.isNull()) ? "(null)" : qPrintable(drtDescriptionSuitableForTestResult(redirectResponse))); if (sendRequestReturnsNull) { blockRequest(newRequest); @@ -1043,11 +1040,11 @@ void FrameLoaderClientQt::dispatchWillSendRequest(WebCore::DocumentLoader*, unsi QString host = url.host(); QString urlScheme = url.scheme().toLower(); - if (QWebPagePrivate::drtRun + if (QWebPageAdapter::drtRun && !host.isEmpty() && (urlScheme == QLatin1String("http") || urlScheme == QLatin1String("https"))) { - QUrl testURL = m_webFrame->page()->mainFrame()->requestedUrl(); + QUrl testURL = m_webFrame->pageAdapter->mainFrameAdapter()->frameLoaderClient->lastRequestedUrl(); QString testHost = testURL.host(); QString testURLScheme = testURL.scheme().toLower(); @@ -1061,9 +1058,9 @@ void FrameLoaderClientQt::dispatchWillSendRequest(WebCore::DocumentLoader*, unsi } for (int i = 0; i < sendRequestClearHeaders.size(); ++i) - newRequest.setHTTPHeaderField(sendRequestClearHeaders.at(i).toLocal8Bit().constData(), QString()); + newRequest.setHTTPHeaderField(sendRequestClearHeaders.at(i).toLocal8Bit().constData(), QString()); - if (QWebPagePrivate::drtRun) { + if (QWebPageAdapter::drtRun) { QMap<QString, QString>::const_iterator it = URLsToRedirect.constFind(url.toString()); if (it != URLsToRedirect.constEnd()) newRequest.setURL(QUrl(it.value())); @@ -1094,17 +1091,17 @@ void FrameLoaderClientQt::dispatchDidReceiveResponse(WebCore::DocumentLoader*, u m_response = response; if (dumpWillCacheResponseCallbacks) printf("%s - willCacheResponse: called\n", - qPrintable(dumpAssignedUrls[identifier])); + qPrintable(dumpAssignedUrls[identifier])); if (dumpResourceLoadCallbacks) printf("%s - didReceiveResponse %s\n", - qPrintable(dumpAssignedUrls[identifier]), - qPrintable(drtDescriptionSuitableForTestResult(response))); + qPrintable(dumpAssignedUrls[identifier]), + qPrintable(drtDescriptionSuitableForTestResult(response))); if (dumpResourceResponseMIMETypes) { printf("%s has MIME type %s\n", - qPrintable(QString(response.url().lastPathComponent())), - qPrintable(QString(response.mimeType()))); + qPrintable(QString(response.url().lastPathComponent())), + qPrintable(QString(response.mimeType()))); } } @@ -1116,15 +1113,15 @@ void FrameLoaderClientQt::dispatchDidFinishLoading(WebCore::DocumentLoader*, uns { if (dumpResourceLoadCallbacks) printf("%s - didFinishLoading\n", - (dumpAssignedUrls.contains(identifier) ? qPrintable(dumpAssignedUrls[identifier]) : "<unknown>")); + (dumpAssignedUrls.contains(identifier) ? qPrintable(dumpAssignedUrls[identifier]) : "<unknown>")); } void FrameLoaderClientQt::dispatchDidFailLoading(WebCore::DocumentLoader* loader, unsigned long identifier, const WebCore::ResourceError& error) { if (dumpResourceLoadCallbacks) printf("%s - didFailLoadingWithError: %s\n", - (dumpAssignedUrls.contains(identifier) ? qPrintable(dumpAssignedUrls[identifier]) : "<unknown>"), - qPrintable(drtDescriptionSuitableForTestResult(error))); + (dumpAssignedUrls.contains(identifier) ? qPrintable(dumpAssignedUrls[identifier]) : "<unknown>"), + qPrintable(drtDescriptionSuitableForTestResult(error))); } bool FrameLoaderClientQt::dispatchDidLoadResourceFromMemoryCache(WebCore::DocumentLoader*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, int) @@ -1135,27 +1132,19 @@ bool FrameLoaderClientQt::dispatchDidLoadResourceFromMemoryCache(WebCore::Docume bool FrameLoaderClientQt::callErrorPageExtension(const WebCore::ResourceError& error) { - QWebPage* page = m_webFrame->page(); - if (!page->supportsExtension(QWebPage::ErrorPageExtension)) + QWebPageAdapter* page = m_webFrame->pageAdapter; + if (!page->supportsErrorPageExtension()) return false; - - QWebPage::ErrorPageExtensionOption option; - if (error.domain() == "QtNetwork") - option.domain = QWebPage::QtNetwork; - else if (error.domain() == "HTTP") - option.domain = QWebPage::Http; - else if (error.domain() == "WebKit") - option.domain = QWebPage::WebKit; - else - return false; - + QWebPageAdapter::ErrorPageOption option; option.url = QUrl(error.failingURL()); option.frame = m_webFrame; + option.domain = error.domain(); option.error = error.errorCode(); option.errorString = error.localizedDescription(); - QWebPage::ErrorPageExtensionReturn output; - if (!page->extension(QWebPage::ErrorPageExtension, &option, &output)) + QWebPageAdapter::ErrorPageReturn output; + + if (!page->errorPageExtension(&option, &output)) return false; KURL baseUrl(output.baseUrl); @@ -1200,10 +1189,10 @@ WebCore::Frame* FrameLoaderClientQt::dispatchCreatePage(const WebCore::Navigatio { if (!m_webFrame) return 0; - QWebPage *newPage = m_webFrame->page()->createWindow(QWebPage::WebBrowserWindow); + QWebPageAdapter* newPage = m_webFrame->pageAdapter->createWindow(/* modalDialog = */ false); if (!newPage) return 0; - return newPage->mainFrame()->d->frame; + return newPage->mainFrameAdapter()->frame; } void FrameLoaderClientQt::dispatchDecidePolicyForResponse(FramePolicyFunction function, const WebCore::ResourceResponse& response, const WebCore::ResourceRequest&) @@ -1230,9 +1219,8 @@ void FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction(FramePolicyFunc { Q_ASSERT(m_webFrame); QNetworkRequest r(request.toNetworkRequest(m_frame->loader()->networkingContext())); - QWebPage* page = m_webFrame->page(); - if (!page->d->acceptNavigationRequest(0, r, QWebPage::NavigationType(action.type()))) { + if (!m_webFrame->pageAdapter->acceptNavigationRequest(0, r, (int)action.type())) { if (action.type() == NavigationTypeFormSubmitted || action.type() == NavigationTypeFormResubmitted) m_frame->loader()->resetMultipleFormSubmissionProtection(); @@ -1251,7 +1239,6 @@ void FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction(FramePolicyFun { Q_ASSERT(m_webFrame); QNetworkRequest r(request.toNetworkRequest(m_frame->loader()->networkingContext())); - QWebPage*page = m_webFrame->page(); PolicyAction result; // Currently, this is only enabled by DRT. @@ -1260,27 +1247,27 @@ void FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction(FramePolicyFun for (const Event* event = action.event(); event; event = event->underlyingEvent()) { if (event->isMouseEvent()) { const MouseEvent* mouseEvent = static_cast<const MouseEvent*>(event); - node = QWebFramePrivate::core(m_webFrame)->eventHandler()->hitTestResultAtPoint( + node = m_webFrame->frame->eventHandler()->hitTestResultAtPoint( mouseEvent->absoluteLocation(), false).innerNonSharedNode(); break; } } printf("Policy delegate: attempt to load %s with navigation type '%s'%s\n", - qPrintable(drtDescriptionSuitableForTestResult(request.url())), navigationTypeToString(action.type()), - (node) ? qPrintable(QString::fromLatin1(" originating from ") + drtDescriptionSuitableForTestResult(node, 0)) : ""); + qPrintable(drtDescriptionSuitableForTestResult(request.url())), navigationTypeToString(action.type()), + (node) ? qPrintable(QString::fromLatin1(" originating from ") + drtDescriptionSuitableForTestResult(node, 0)) : ""); if (policyDelegatePermissive) result = PolicyUse; else result = PolicyIgnore; - page->d->acceptNavigationRequest(m_webFrame, r, QWebPage::NavigationType(action.type())); + m_webFrame->pageAdapter->acceptNavigationRequest(m_webFrame, r, (int)action.type()); callPolicyFunction(function, result); return; } - if (!page->d->acceptNavigationRequest(m_webFrame, r, QWebPage::NavigationType(action.type()))) { + if (!m_webFrame->pageAdapter->acceptNavigationRequest(m_webFrame, r, (int)action.type())) { if (action.type() == NavigationTypeFormSubmitted || action.type() == NavigationTypeFormResubmitted) m_frame->loader()->resetMultipleFormSubmissionProtection(); @@ -1305,40 +1292,39 @@ void FrameLoaderClientQt::startDownload(const WebCore::ResourceRequest& request, if (!m_webFrame) return; - emit m_webFrame->page()->downloadRequested(request.toNetworkRequest(m_frame->loader()->networkingContext())); + m_webFrame->pageAdapter->emitDownloadRequested(request.toNetworkRequest(m_frame->loader()->networkingContext())); } -PassRefPtr<Frame> FrameLoaderClientQt::createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement, - const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight) +PassRefPtr<Frame> FrameLoaderClientQt::createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement, const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight) { if (!m_webFrame) return 0; QWebFrameData frameData(m_frame->page(), m_frame, ownerElement, name); - if (url.isEmpty()) - frameData.url = blankURL(); - else - frameData.url = url; - frameData.referrer = referrer; frameData.allowsScrolling = allowsScrolling; frameData.marginWidth = marginWidth; frameData.marginHeight = marginHeight; - QPointer<QWebFrame> webFrame = new QWebFrame(m_webFrame, &frameData); + QWebFrameAdapter* childWebFrame = m_webFrame->createChildFrame(&frameData); // The creation of the frame may have run arbitrary JavaScript that removed it from the page already. - if (!webFrame.data()->d->frame->page()) { + if (!childWebFrame->frame->page()) { + QPointer<QObject> qWebFrame = childWebFrame->handle(); frameData.frame.release(); - ASSERT(webFrame.isNull()); + ASSERT_UNUSED(qWebFrame, !qWebFrame); return 0; } - emit m_webFrame->page()->frameCreated(webFrame.data()); + m_webFrame->pageAdapter->emitFrameCreated(childWebFrame); // FIXME: Set override encoding if we have one. - m_frame->loader()->loadURLIntoChildFrame(frameData.url, frameData.referrer, frameData.frame.get()); + KURL urlToLoad = url; + if (urlToLoad.isEmpty()) + urlToLoad = blankURL(); + + m_frame->loader()->loadURLIntoChildFrame(urlToLoad, frameData.referrer, frameData.frame.get()); // The frame's onload handler may have removed it from the document. if (!frameData.frame->tree()->parent()) @@ -1399,44 +1385,45 @@ static const CSSPropertyID qstyleSheetProperties[] = { const unsigned numqStyleSheetProperties = sizeof(qstyleSheetProperties) / sizeof(qstyleSheetProperties[0]); -class QtPluginWidget: public Widget -{ +class QtPluginWidget: public Widget { public: - QtPluginWidget(QWidget* w = 0): Widget(w) {} + QtPluginWidget(QtPluginWidgetAdapter* w) + : Widget(w->handle()) + , m_adapter(w) + { + setBindingObject(w->handle()); + } + ~QtPluginWidget() { - if (platformWidget()) - platformWidget()->deleteLater(); + delete m_adapter; } + + inline QtPluginWidgetAdapter* widgetAdapter() const + { + return m_adapter; + } + virtual void invalidateRect(const IntRect& r) { if (platformWidget()) - static_cast<QWidget*>(platformWidget())->update(r); + widgetAdapter()->update(r); } virtual void frameRectsChanged() { - QWidget* widget = static_cast<QWidget*>(platformWidget()); + QtPluginWidgetAdapter* widget = widgetAdapter(); if (!widget) return; - - IntRect windowRect = convertToContainingWindow(IntRect(0, 0, frameRect().width(), frameRect().height())); - widget->setGeometry(windowRect); + QRect windowRect = convertToContainingWindow(IntRect(0, 0, frameRect().width(), frameRect().height())); ScrollView* parentScrollView = parent(); - if (!parentScrollView) - return; - - ASSERT(parentScrollView->isFrameView()); - IntRect clipRect(static_cast<FrameView*>(parentScrollView)->windowClipRect()); - clipRect.move(-windowRect.x(), -windowRect.y()); - clipRect.intersect(widget->rect()); - - QRegion clipRegion = QRegion(clipRect); - widget->setMask(clipRegion); - - handleVisibility(); - - widget->update(); + QRect clipRect; + if (parentScrollView) { + ASSERT(parentScrollView->isFrameView()); + clipRect = static_cast<FrameView*>(parentScrollView)->windowClipRect(); + clipRect.translate(-windowRect.x(), -windowRect.y()); + } + widget->setGeometryAndClip(windowRect, clipRect, isVisible()); } virtual void show() @@ -1444,75 +1431,25 @@ public: Widget::show(); handleVisibility(); } + virtual void hide() + { + if (platformWidget()) + widgetAdapter()->setVisible(false); + } private: + QtPluginWidgetAdapter* m_adapter; + void handleVisibility() { if (!isVisible()) return; - - QWidget* widget = static_cast<QWidget*>(platformWidget()); - // If setMask is set with an empty QRegion, no clipping will - // be performed, so in that case we hide the platformWidget. - QRegion mask = widget->mask(); - widget->setVisible(!mask.isEmpty()); + widgetAdapter()->setVisible(true); } }; -#if !defined(QT_NO_GRAPHICSVIEW) -class QtPluginGraphicsWidget: public Widget -{ -public: - static RefPtr<QtPluginGraphicsWidget> create(QGraphicsWidget* w = 0) - { - return adoptRef(new QtPluginGraphicsWidget(w)); - } - ~QtPluginGraphicsWidget() - { - if (graphicsWidget) - graphicsWidget->deleteLater(); - } - virtual void invalidateRect(const IntRect& r) - { - QGraphicsScene* scene = graphicsWidget ? graphicsWidget->scene() : 0; - if (scene) - scene->update(QRect(r)); - } - virtual void frameRectsChanged() - { - if (!graphicsWidget) - return; - - IntRect windowRect = convertToContainingWindow(IntRect(0, 0, frameRect().width(), frameRect().height())); - graphicsWidget->setGeometry(QRect(windowRect)); - - // FIXME: Make the code handle clipping of graphics widgets. - } - virtual void show() - { - if (graphicsWidget) - graphicsWidget->show(); - } - virtual void hide() - { - if (graphicsWidget) - graphicsWidget->hide(); - } -private: - QtPluginGraphicsWidget(QGraphicsWidget* w = 0) - : Widget(0) - , graphicsWidget(w) - { - setBindingObject(graphicsWidget); - } - - QGraphicsWidget* graphicsWidget; -}; -#endif // QT_NO_GRAPHICSVIEW - -PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, HTMLPlugInElement* element, const KURL& url, const Vector<String>& paramNames, - const Vector<String>& paramValues, const String& mimeType, bool loadManually) +PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, HTMLPlugInElement* element, const KURL& url, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually) { // qDebug()<<"------ Creating plugin in FrameLoaderClientQt::createPlugin for "<<url.string() << mimeType; // qDebug()<<"------\t url = "<<url.string(); @@ -1535,72 +1472,55 @@ PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, QString urlStr(url.string()); QUrl qurl = urlStr; - QObject* object = 0; + QObject* pluginAdapter = 0; if (mimeType == "application/x-qt-plugin" || mimeType == "application/x-qt-styled-widget") { - object = m_webFrame->page()->createPlugin(classid, qurl, params, values); + pluginAdapter = m_webFrame->pageAdapter->createPlugin(classid, qurl, params, values); #ifndef QT_NO_STYLE_STYLESHEET - QWidget* widget = qobject_cast<QWidget*>(object); + QtPluginWidgetAdapter* widget = qobject_cast<QtPluginWidgetAdapter*>(pluginAdapter); if (widget && mimeType == "application/x-qt-styled-widget") { - QString styleSheet = element->getAttribute("style"); + StringBuilder styleSheet; + styleSheet.append(element->getAttribute("style")); if (!styleSheet.isEmpty()) - styleSheet += QLatin1Char(';'); + styleSheet.append(';'); for (unsigned i = 0; i < numqStyleSheetProperties; ++i) { CSSPropertyID property = qstyleSheetProperties[i]; - styleSheet += QString::fromLatin1(getPropertyName(property)); - styleSheet += QLatin1Char(':'); - styleSheet += CSSComputedStyleDeclaration::create(element)->getPropertyValue(property); - styleSheet += QLatin1Char(';'); + styleSheet.append(getPropertyName(property)); + styleSheet.append(':'); + styleSheet.append(CSSComputedStyleDeclaration::create(element)->getPropertyValue(property)); + styleSheet.append(';'); } - widget->setStyleSheet(styleSheet); + widget->setStyleSheet(styleSheet.toString()); } #endif // QT_NO_STYLE_STYLESHEET } - if (!object) { - QWebPluginFactory* factory = m_webFrame->page()->pluginFactory(); + if (!pluginAdapter) { + QWebPluginFactory* factory = m_webFrame->pageAdapter->pluginFactory; if (factory) - object = factory->create(mimeType, qurl, params, values); + pluginAdapter = m_webFrame->pageAdapter->adapterForWidget(factory->create(mimeType, qurl, params, values)); } - - if (object) { - QWidget* widget = qobject_cast<QWidget*>(object); + if (pluginAdapter) { + QtPluginWidgetAdapter* widget = qobject_cast<QtPluginWidgetAdapter*>(pluginAdapter); if (widget) { - QWidget* parentWidget = 0; - if (m_webFrame->page()->d->client) - parentWidget = qobject_cast<QWidget*>(m_webFrame->page()->d->client->pluginParent()); + QObject* parentWidget = 0; + if (m_webFrame->pageAdapter->client) + parentWidget = m_webFrame->pageAdapter->client->pluginParent(); if (parentWidget) // Don't reparent to nothing (i.e. keep whatever parent QWebPage::createPlugin() chose. - widget->setParent(parentWidget); - widget->hide(); - RefPtr<QtPluginWidget> w = adoptRef(new QtPluginWidget()); - w->setPlatformWidget(widget); + widget->setWidgetParent(parentWidget); + widget->setVisible(false); + RefPtr<QtPluginWidget> w = adoptRef(new QtPluginWidget(widget)); // Make sure it's invisible until properly placed into the layout. w->setFrameRect(IntRect(0, 0, 0, 0)); return w; } -#if !defined(QT_NO_GRAPHICSVIEW) - QGraphicsWidget* graphicsWidget = qobject_cast<QGraphicsWidget*>(object); - if (graphicsWidget) { - QGraphicsObject* parentWidget = 0; - if (m_webFrame->page()->d->client) - parentWidget = qobject_cast<QGraphicsObject*>(m_webFrame->page()->d->client->pluginParent()); - graphicsWidget->hide(); - if (parentWidget) // Don't reparent to nothing (i.e. keep whatever parent QWebPage::createPlugin() chose. - graphicsWidget->setParentItem(parentWidget); - RefPtr<QtPluginGraphicsWidget> w = QtPluginGraphicsWidget::create(graphicsWidget); - // Make sure it's invisible until properly placed into the layout. - w->setFrameRect(IntRect(0, 0, 0, 0)); - return w; - } -#endif // QT_NO_GRAPHICSVIEW - // FIXME: Make things work for widgetless plugins as well. - delete object; + delete pluginAdapter; } #if ENABLE(NETSCAPE_PLUGIN_API) else { // NPAPI Plugins @@ -1632,8 +1552,7 @@ void FrameLoaderClientQt::redirectDataToPlugin(Widget* pluginWidget) m_hasSentResponseToPlugin = false; } -PassRefPtr<Widget> FrameLoaderClientQt::createJavaAppletWidget(const IntSize& pluginSize, HTMLAppletElement* element, const KURL& url, - const Vector<String>& paramNames, const Vector<String>& paramValues) +PassRefPtr<Widget> FrameLoaderClientQt::createJavaAppletWidget(const IntSize& pluginSize, HTMLAppletElement* element, const KURL& url, const Vector<String>& paramNames, const Vector<String>& paramValues) { return createPlugin(pluginSize, element, url, paramNames, paramValues, "application/x-java-applet", true); } @@ -1645,23 +1564,26 @@ String FrameLoaderClientQt::overrideMediaType() const QString FrameLoaderClientQt::chooseFile(const QString& oldFile) { - return m_webFrame->page()->chooseFile(m_webFrame, oldFile); + QStringList result = m_webFrame->pageAdapter->chooseFiles(m_webFrame, /*allowMulti*/ false, (QStringList() << oldFile)); + return result.isEmpty() ? QString() : result.first(); } PassRefPtr<FrameNetworkingContext> FrameLoaderClientQt::createNetworkingContext() { - QVariant value = m_webFrame->page()->property("_q_MIMESniffingDisabled"); + QVariant value = m_webFrame->pageAdapter->handle()->property("_q_MIMESniffingDisabled"); bool MIMESniffingDisabled = value.isValid() && value.toBool(); - return FrameNetworkingContextQt::create(m_frame, m_webFrame, !MIMESniffingDisabled, m_webFrame->page()->networkAccessManager()); + return FrameNetworkingContextQt::create(m_frame, m_webFrame->handle(), !MIMESniffingDisabled); +} + +QWebFrameAdapter* FrameLoaderClientQt::webFrame() const +{ + return m_webFrame; } void FrameLoaderClientQt::emitLoadStarted() { - QWebPage* webPage = m_webFrame->page(); - if (m_isOriginatingLoad && webPage) - emit webPage->loadStarted(); - emit m_webFrame->loadStarted(); + m_webFrame->emitLoadStarted(m_isOriginatingLoad); } void FrameLoaderClientQt::emitLoadFinished(bool ok) @@ -1670,10 +1592,7 @@ void FrameLoaderClientQt::emitLoadFinished(bool ok) const bool wasOriginatingLoad = m_isOriginatingLoad; m_isOriginatingLoad = false; - QWebPage* webPage = m_webFrame->page(); - if (wasOriginatingLoad && webPage) - emit webPage->loadFinished(ok); - emit m_webFrame->loadFinished(ok); + m_webFrame->emitLoadFinished(wasOriginatingLoad, ok); } } diff --git a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h index 03102de3e..a2b4ede93 100644 --- a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h +++ b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h @@ -30,14 +30,15 @@ #ifndef FrameLoaderClientQt_h #define FrameLoaderClientQt_h - +#include "FormState.h" #include "Frame.h" #include "FrameLoader.h" #include "FrameLoaderClient.h" +#include "HTMLFormElement.h" #include "KURL.h" -#include "WebCore/plugins/PluginView.h" #include "ResourceError.h" #include "ResourceResponse.h" +#include "WebCore/plugins/PluginView.h" #include <QUrl> #include <qobject.h> #include <wtf/Forward.h> @@ -49,6 +50,7 @@ class QNetworkReply; QT_END_NAMESPACE class QWebFrame; +class QWebFrameAdapter; namespace WebCore { @@ -65,8 +67,8 @@ struct LoadErrorResetToken; class FrameLoaderClientQt : public QObject, public FrameLoaderClient { Q_OBJECT - friend class ::QWebFrame; - void callPolicyFunction(FramePolicyFunction function, PolicyAction action); + friend class ::QWebFrameAdapter; + void callPolicyFunction(FramePolicyFunction, PolicyAction); bool callErrorPageExtension(const ResourceError&); Q_SIGNALS: @@ -79,7 +81,7 @@ public: ~FrameLoaderClientQt(); virtual void frameLoaderDestroyed(); - void setFrame(QWebFrame* webFrame, Frame* frame); + void setFrame(QWebFrameAdapter*, Frame*); virtual bool hasWebView() const; // mainly for assertions @@ -128,9 +130,9 @@ public: virtual WebCore::Frame* dispatchCreatePage(const WebCore::NavigationAction&); virtual void dispatchShow(); - virtual void dispatchDecidePolicyForResponse(FramePolicyFunction function, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&); - virtual void dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const WebCore::NavigationAction&, const WebCore::ResourceRequest&, PassRefPtr<FormState>, const WTF::String&); - virtual void dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const WebCore::NavigationAction&, const WebCore::ResourceRequest&, PassRefPtr<FormState>); + virtual void dispatchDecidePolicyForResponse(FramePolicyFunction, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&); + virtual void dispatchDecidePolicyForNewWindowAction(FramePolicyFunction, const WebCore::NavigationAction&, const WebCore::ResourceRequest&, PassRefPtr<FormState>, const WTF::String&); + virtual void dispatchDecidePolicyForNavigationAction(FramePolicyFunction, const WebCore::NavigationAction&, const WebCore::ResourceRequest&, PassRefPtr<FormState>); virtual void cancelPolicyCheck(); virtual void dispatchUnableToImplementPolicy(const WebCore::ResourceError&); @@ -204,8 +206,7 @@ public: virtual bool canCachePage() const; virtual void download(WebCore::ResourceHandle*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&); - virtual PassRefPtr<Frame> createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement, - const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight); + virtual PassRefPtr<Frame> createFrame(const KURL&, const String& name, HTMLFrameOwnerElement*, const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight); virtual PassRefPtr<Widget> createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool); virtual void recreatePlugin(Widget*) { } virtual void redirectDataToPlugin(Widget* pluginWidget); @@ -227,6 +228,8 @@ public: const KURL& lastRequestedUrl() const { return m_lastRequestedUrl; } + QWebFrameAdapter* webFrame() const; + static bool dumpFrameLoaderCallbacks; static bool dumpProgressFinishedCallback; static bool dumpUserGestureInFrameLoaderCallbacks; @@ -251,7 +254,7 @@ private: void emitLoadFinished(bool ok); Frame *m_frame; - QWebFrame *m_webFrame; + QWebFrameAdapter *m_webFrame; ResourceResponse m_response; // Plugin view to redirect data to diff --git a/Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.cpp b/Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.cpp index 7e99624b5..5e665313f 100644 --- a/Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.cpp @@ -18,29 +18,28 @@ */ #include "config.h" - #include "FrameNetworkingContextQt.h" -#include "qwebframe.h" -#include "qwebframe_p.h" -#include "qwebpage.h" +#include "QWebFrameAdapter.h" +#include "QWebPageAdapter.h" +#include "qwebsettings.h" + #include <QNetworkAccessManager> #include <QNetworkCookie> #include <QNetworkCookieJar> namespace WebCore { -FrameNetworkingContextQt::FrameNetworkingContextQt(Frame* frame, QObject* originatingObject, bool mimeSniffingEnabled, QNetworkAccessManager* networkAccessManager) +FrameNetworkingContextQt::FrameNetworkingContextQt(Frame* frame, QObject* originatingObject, bool mimeSniffingEnabled) : FrameNetworkingContext(frame) , m_originatingObject(originatingObject) - , m_networkAccessManager(networkAccessManager) , m_mimeSniffingEnabled(mimeSniffingEnabled) { } -PassRefPtr<FrameNetworkingContextQt> FrameNetworkingContextQt::create(Frame* frame, QObject* originatingObject, bool mimeSniffingEnabled, QNetworkAccessManager* networkAccessManager) +PassRefPtr<FrameNetworkingContextQt> FrameNetworkingContextQt::create(Frame* frame, QObject* originatingObject, bool mimeSniffingEnabled) { - return adoptRef(new FrameNetworkingContextQt(frame, originatingObject, mimeSniffingEnabled, networkAccessManager)); + return adoptRef(new FrameNetworkingContextQt(frame, originatingObject, mimeSniffingEnabled)); } QObject* FrameNetworkingContextQt::originatingObject() const @@ -50,7 +49,7 @@ QObject* FrameNetworkingContextQt::originatingObject() const QNetworkAccessManager* FrameNetworkingContextQt::networkAccessManager() const { - return (qobject_cast<QWebFrame*>(m_originatingObject))->page()->networkAccessManager(); + return QWebFrameAdapter::kit(frame())->pageAdapter->networkAccessManager(); } bool FrameNetworkingContextQt::mimeSniffingEnabled() const diff --git a/Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.h b/Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.h index c95e630ac..b58abe48d 100644 --- a/Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.h +++ b/Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.h @@ -26,10 +26,10 @@ namespace WebCore { class FrameNetworkingContextQt : public FrameNetworkingContext { public: - static PassRefPtr<FrameNetworkingContextQt> create(Frame*, QObject* originatingObject, bool mimeSniffingEnabled, QNetworkAccessManager*); + static PassRefPtr<FrameNetworkingContextQt> create(Frame*, QObject* originatingObject, bool mimeSniffingEnabled); private: - FrameNetworkingContextQt(Frame*, QObject* originatingObject, bool mimeSniffingEnabled, QNetworkAccessManager*); + FrameNetworkingContextQt(Frame*, QObject* originatingObject, bool mimeSniffingEnabled); virtual QObject* originatingObject() const; virtual QNetworkAccessManager* networkAccessManager() const; @@ -37,7 +37,6 @@ private: virtual bool thirdPartyCookiePolicyPermission(const QUrl&) const; QObject* m_originatingObject; - QNetworkAccessManager* m_networkAccessManager; bool m_mimeSniffingEnabled; }; diff --git a/Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.cpp b/Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.cpp index 3b244c657..25e357aba 100644 --- a/Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.cpp @@ -23,7 +23,6 @@ #include "ChromeClientQt.h" #if USE(QT_MULTIMEDIA) -#include "FullScreenVideoWidget.h" #include "MediaPlayerPrivateQt.h" #endif #include "HTMLNames.h" @@ -40,10 +39,8 @@ #endif #if USE(QT_MULTIMEDIA) -#include <QGraphicsVideoItem> #include <QMediaPlayer> #endif -#include <QWidget> namespace WebCore { @@ -90,49 +87,6 @@ void GStreamerFullScreenVideoHandler::exitFullScreen() } #endif -#if USE(QT_MULTIMEDIA) -bool DefaultFullScreenVideoHandler::s_shouldForceFullScreenVideoPlayback = false; - -DefaultFullScreenVideoHandler::DefaultFullScreenVideoHandler() - : QWebFullScreenVideoHandler() - , m_fullScreenWidget(new FullScreenVideoWidget) -{ - connect(m_fullScreenWidget, SIGNAL(didExitFullScreen()), this, SIGNAL(fullScreenClosed())); - m_fullScreenWidget->hide(); - - m_fullScreenWidget->close(); -} - -DefaultFullScreenVideoHandler::~DefaultFullScreenVideoHandler() -{ - delete m_fullScreenWidget; -} - -bool DefaultFullScreenVideoHandler::requiresFullScreenForVideoPlayback() const -{ - static bool initialized = false; - if (!initialized) { - QByteArray forceFullScreen = qgetenv("QT_WEBKIT_FORCE_FULLSCREEN_VIDEO"); - if (!forceFullScreen.isEmpty()) - s_shouldForceFullScreenVideoPlayback = true; - - initialized = true; - } - - return s_shouldForceFullScreenVideoPlayback; -} - -void DefaultFullScreenVideoHandler::enterFullScreen(QMediaPlayer* player) -{ - m_fullScreenWidget->show(player); -} - -void DefaultFullScreenVideoHandler::exitFullScreen() -{ - m_fullScreenWidget->close(); -} -#endif - FullScreenVideoQt::FullScreenVideoQt(ChromeClientQt* chromeClient) : m_chromeClient(chromeClient) , m_videoElement(0) @@ -140,10 +94,7 @@ FullScreenVideoQt::FullScreenVideoQt(ChromeClientQt* chromeClient) Q_ASSERT(m_chromeClient); #if USE(QT_MULTIMEDIA) - m_FullScreenVideoHandler = m_chromeClient->m_platformPlugin.createFullScreenVideoHandler().leakPtr(); - if (!m_FullScreenVideoHandler) - m_FullScreenVideoHandler = new DefaultFullScreenVideoHandler; - + m_FullScreenVideoHandler = m_chromeClient->createFullScreenVideoHandler(); if (m_FullScreenVideoHandler) connect(m_FullScreenVideoHandler, SIGNAL(fullScreenClosed()), this, SLOT(aboutToClose())); #endif diff --git a/Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.h b/Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.h index 34bc90c0d..81a288da5 100644 --- a/Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.h +++ b/Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.h @@ -65,25 +65,6 @@ private: }; #endif -// We do not use ENABLE or USE because moc does not expand these macros. -#if defined(WTF_USE_QT_MULTIMEDIA) && WTF_USE_QT_MULTIMEDIA -class DefaultFullScreenVideoHandler : public QWebFullScreenVideoHandler { - Q_OBJECT -public: - DefaultFullScreenVideoHandler(); - virtual ~DefaultFullScreenVideoHandler(); - bool requiresFullScreenForVideoPlayback() const; - -public Q_SLOTS: - void enterFullScreen(QMediaPlayer*); - void exitFullScreen(); - -private: - static bool s_shouldForceFullScreenVideoPlayback; - FullScreenVideoWidget *m_fullScreenWidget; -}; -#endif - class FullScreenVideoQt : public QObject { Q_OBJECT public: diff --git a/Source/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.cpp b/Source/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.cpp index bb5e2b9f6..4105d02c6 100644 --- a/Source/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.cpp +++ b/Source/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.cpp @@ -25,6 +25,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "FullScreenVideoWidget.h" #include <QApplication> @@ -35,7 +36,7 @@ static const int gHideMouseCursorDelay = 3000; -namespace WebCore { +namespace WebKit { FullScreenVideoWidget::FullScreenVideoWidget() : QVideoWidget() diff --git a/Source/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.h b/Source/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.h index 7e7f8df1c..201cc49d1 100644 --- a/Source/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.h +++ b/Source/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.h @@ -35,7 +35,7 @@ QT_BEGIN_NAMESPACE class QMediaPlayer; QT_END_NAMESPACE -namespace WebCore { +namespace WebKit { class FullScreenVideoWidget : public QVideoWidget { Q_OBJECT diff --git a/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp index b6b4d70bd..26d1b407a 100644 --- a/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp @@ -33,10 +33,8 @@ #include "GeolocationPosition.h" #include "HTMLFormElement.h" #include "Page.h" -#include "qwebframe.h" -#include "qwebframe_p.h" -#include "qwebpage.h" -#include "qwebpage_p.h" +#include "QWebFrameAdapter.h" +#include "QWebPageAdapter.h" #include <QtLocation/QGeoPositionInfoSource> @@ -44,8 +42,8 @@ namespace WebCore { static const char failedToStartServiceErrorMessage[] = "Failed to start Geolocation service"; -GeolocationClientQt::GeolocationClientQt(const QWebPage* page) - : m_page(page) +GeolocationClientQt::GeolocationClientQt(const QWebPageAdapter* page) + : m_webPage(page) , m_lastPosition(0) , m_location(0) { @@ -85,12 +83,9 @@ void GeolocationClientQt::positionUpdated(const QGeoPositionInfo& geoPosition) double timeStampInSeconds = geoPosition.timestamp().toMSecsSinceEpoch() / 1000; - m_lastPosition = GeolocationPosition::create(timeStampInSeconds, latitude, longitude, - accuracy, providesAltitude, altitude, - providesAltitudeAccuracy, altitudeAccuracy, - providesHeading, heading, providesSpeed, speed); + m_lastPosition = GeolocationPosition::create(timeStampInSeconds, latitude, longitude, accuracy, providesAltitude, altitude, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed); - WebCore::Page* page = QWebPagePrivate::core(m_page); + WebCore::Page* page = m_webPage->page; GeolocationController::from(page)->positionChanged(m_lastPosition.get()); } @@ -100,7 +95,7 @@ void GeolocationClientQt::startUpdating() connect(m_location, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(positionUpdated(QGeoPositionInfo))); if (!m_location) { - WebCore::Page* page = QWebPagePrivate::core(m_page); + WebCore::Page* page = m_webPage->page; RefPtr<WebCore::GeolocationError> error = GeolocationError::create(GeolocationError::PositionUnavailable, failedToStartServiceErrorMessage); GeolocationController::from(page)->errorOccurred(error.get()); return; @@ -124,14 +119,14 @@ void GeolocationClientQt::setEnableHighAccuracy(bool) void GeolocationClientQt::requestPermission(Geolocation* geolocation) { ASSERT(geolocation); - QWebFrame* webFrame = QWebFramePrivate::kit(geolocation->frame()); + QWebFrameAdapter* webFrame = QWebFrameAdapter::kit(geolocation->frame()); GeolocationPermissionClientQt::geolocationPermissionClient()->requestGeolocationPermissionForFrame(webFrame, geolocation); } void GeolocationClientQt::cancelPermissionRequest(Geolocation* geolocation) { ASSERT(geolocation); - QWebFrame* webFrame = QWebFramePrivate::kit(geolocation->frame()); + QWebFrameAdapter* webFrame = QWebFrameAdapter::kit(geolocation->frame()); GeolocationPermissionClientQt::geolocationPermissionClient()->cancelGeolocationPermissionRequestForFrame(webFrame, geolocation); } diff --git a/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.h b/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.h index 2e94bdebc..c2287867f 100644 --- a/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.h +++ b/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.h @@ -28,16 +28,16 @@ #include "GeolocationClient.h" +#include <QGeoPositionInfo> #include <QObject> #include <wtf/RefPtr.h> -#include <QtLocation/QGeoPositionInfo> QT_BEGIN_NAMESPACE class QGeoPositionInfoSource; QT_END_NAMESPACE -class QWebPage; +class QWebPageAdapter; namespace WebCore { @@ -46,7 +46,7 @@ class GeolocationClientQt : public QObject, public GeolocationClient { Q_OBJECT public: - GeolocationClientQt(const QWebPage*); + GeolocationClientQt(const QWebPageAdapter*); virtual ~GeolocationClientQt(); virtual void geolocationDestroyed(); @@ -63,7 +63,7 @@ private Q_SLOTS: void positionUpdated(const QGeoPositionInfo&); private: - const QWebPage* m_page; + const QWebPageAdapter* m_webPage; RefPtr<GeolocationPosition> m_lastPosition; QGeoPositionInfoSource* m_location; }; diff --git a/Source/WebKit/qt/WebCoreSupport/GeolocationPermissionClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/GeolocationPermissionClientQt.cpp index 7500e993f..04e47688a 100644 --- a/Source/WebKit/qt/WebCoreSupport/GeolocationPermissionClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/GeolocationPermissionClientQt.cpp @@ -32,10 +32,9 @@ #include "GeolocationPermissionClientQt.h" #include "Geolocation.h" - -#include "qwebframe.h" +#include "QWebFrameAdapter.h" +#include "QWebPageAdapter.h" #include "qwebkitglobal.h" -#include "qwebpage.h" namespace WebCore { @@ -60,36 +59,30 @@ GeolocationPermissionClientQt::~GeolocationPermissionClientQt() { } -void GeolocationPermissionClientQt::requestGeolocationPermissionForFrame(QWebFrame* webFrame, Geolocation* listener) +void GeolocationPermissionClientQt::requestGeolocationPermissionForFrame(QWebFrameAdapter* webFrame, Geolocation* listener) { m_pendingPermissionRequests.insert(webFrame, listener); - QWebPage* page = webFrame->page(); - emit page->featurePermissionRequested(webFrame, QWebPage::Geolocation); + QWebPageAdapter* page = QWebPageAdapter::kit(webFrame->frame->page()); + page->geolocationPermissionRequested(webFrame); } -void GeolocationPermissionClientQt::cancelGeolocationPermissionRequestForFrame(QWebFrame* webFrame, Geolocation* listener) +void GeolocationPermissionClientQt::cancelGeolocationPermissionRequestForFrame(QWebFrameAdapter* webFrame, Geolocation* listener) { m_pendingPermissionRequests.remove(webFrame); - QWebPage* page = webFrame->page(); - emit page->featurePermissionRequestCanceled(webFrame, QWebPage::Geolocation); + QWebPageAdapter* page = QWebPageAdapter::kit(webFrame->frame->page()); + page->geolocationPermissionRequestCancelled(webFrame); } -void GeolocationPermissionClientQt::setPermission(QWebFrame* webFrame, QWebPage::PermissionPolicy permission) +void GeolocationPermissionClientQt::setPermission(QWebFrameAdapter* webFrame, bool granted) { if (!m_pendingPermissionRequests.contains(webFrame)) return; Geolocation* listener = m_pendingPermissionRequests.value(webFrame); - - if (permission == QWebPage::PermissionGrantedByUser) - listener->setIsAllowed(true); - else if (permission == QWebPage::PermissionDeniedByUser) - listener->setIsAllowed(false); - else - return; + listener->setIsAllowed(granted); m_pendingPermissionRequests.remove(webFrame); } diff --git a/Source/WebKit/qt/WebCoreSupport/GeolocationPermissionClientQt.h b/Source/WebKit/qt/WebCoreSupport/GeolocationPermissionClientQt.h index 1b4540d87..71183b497 100644 --- a/Source/WebKit/qt/WebCoreSupport/GeolocationPermissionClientQt.h +++ b/Source/WebKit/qt/WebCoreSupport/GeolocationPermissionClientQt.h @@ -34,12 +34,11 @@ #if ENABLE(GEOLOCATION) #include "Geolocation.h" -#include "qwebpage.h" #include <QHash> -class QWebFrame; -class QWebPage; +class QWebFrameAdapter; +class QWebPageAdapter; namespace WebCore { @@ -48,13 +47,13 @@ public: GeolocationPermissionClientQt(); ~GeolocationPermissionClientQt(); - void requestGeolocationPermissionForFrame(QWebFrame*, Geolocation*); - void cancelGeolocationPermissionRequestForFrame(QWebFrame*, Geolocation*); - void setPermission(QWebFrame*, QWebPage::PermissionPolicy); + void requestGeolocationPermissionForFrame(QWebFrameAdapter*, Geolocation*); + void cancelGeolocationPermissionRequestForFrame(QWebFrameAdapter*, Geolocation*); + void setPermission(QWebFrameAdapter*, bool /*granted*/); static GeolocationPermissionClientQt* geolocationPermissionClient(); private: - QHash<QWebFrame*, Geolocation*> m_pendingPermissionRequests; + QHash<QWebFrameAdapter*, Geolocation*> m_pendingPermissionRequests; }; } diff --git a/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp b/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp index d6065c14e..385fe9c39 100644 --- a/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp @@ -44,21 +44,31 @@ #include "qwebelement_p.h" #include <JavaScriptCore/runtime/InitializeThreading.h> -#include <QApplication> -#include <QStyle> #include <wtf/MainThread.h> namespace WebKit { -// Called also from WebKit2's WebProcess. -Q_DECL_EXPORT void initializeWebKit2Theme() +static QtStyleFactoryFunction initCallback = 0; + +void setWebKitWidgetsInitCallback(QtStyleFactoryFunction callback) { - if (qgetenv("QT_WEBKIT_THEME_NAME") == "qstyle") { - WebCore::RenderThemeQStyle::setStyleFactoryFunction(WebKit::QStyleFacadeImp::create); + initCallback = callback; +} + +// Called also from WebKit2's WebProcess +Q_DECL_EXPORT void initializeWebKitQt() +{ + if (initCallback) { + WebCore::RenderThemeQStyle::setStyleFactoryFunction(initCallback); WebCore::RenderThemeQt::setCustomTheme(WebCore::RenderThemeQStyle::create, new WebCore::ScrollbarThemeQStyle); } } +Q_DECL_EXPORT void setImagePlatformResource(const char* name, const QPixmap& pixmap) +{ + WebCore::Image::setPlatformResource(name, pixmap); +} + } namespace WebCore { @@ -79,18 +89,10 @@ void initializeWebCoreQt() PlatformStrategiesQt::initialize(); QtWebElementRuntime::initialize(); - RenderThemeQStyle::setStyleFactoryFunction(WebKit::QStyleFacadeImp::create); - RenderThemeQt::setCustomTheme(RenderThemeQStyle::create, new ScrollbarThemeQStyle); - #if USE(QTKIT) InitWebCoreSystemInterface(); #endif - // QWebSettings::SearchCancelButtonGraphic - Image::setPlatformResource("searchCancelButton", QApplication::style()->standardPixmap(QStyle::SP_DialogCloseButton)); - // QWebSettings::SearchCancelButtonPressedGraphic - Image::setPlatformResource("searchCancelButtonPressed", QApplication::style()->standardPixmap(QStyle::SP_DialogCloseButton)); - initialized = true; } diff --git a/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.h b/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.h index df1aaf776..56ea74321 100644 --- a/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.h +++ b/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.h @@ -30,6 +30,22 @@ #ifndef InitWebCoreQt_h #define InitWebCoreQt_h +#include "qimage.h" + +namespace WebCore { +class Page; +class QStyleFacade; +} +typedef WebCore::QStyleFacade* (*QtStyleFactoryFunction)(WebCore::Page*); + +namespace WebKit { + +void setWebKitWidgetsInitCallback(QtStyleFactoryFunction); +Q_DECL_EXPORT void initializeWebKitQt(); +Q_DECL_EXPORT void setImagePlatformResource(const char* /* name */, const QPixmap&); + +} + namespace WebCore { void initializeWebCoreQt(); diff --git a/Source/WebKit/qt/WebCoreSupport/InitWebKitQt.cpp b/Source/WebKit/qt/WebCoreSupport/InitWebKitQt.cpp new file mode 100644 index 000000000..71886037d --- /dev/null +++ b/Source/WebKit/qt/WebCoreSupport/InitWebKitQt.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2012 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 + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include "config.h" +#include "InitWebKitQt.h" + +#include "InitWebCoreQt.h" + +#include "QStyleFacadeImp.h" + +#include <QApplication> +#include <QStyle> + +namespace WebKit { + +Q_DECL_EXPORT void initializeWebKitWidgets() +{ + static bool initialized = false; + if (initialized) + return; + + setWebKitWidgetsInitCallback(QStyleFacadeImp::create); + initializeWebKitQt(); + + // QWebSettings::SearchCancelButtonGraphic + setImagePlatformResource("searchCancelButton", QApplication::style()->standardPixmap(QStyle::SP_DialogCloseButton)); + // QWebSettings::SearchCancelButtonPressedGraphic + setImagePlatformResource("searchCancelButtonPressed", QApplication::style()->standardPixmap(QStyle::SP_DialogCloseButton)); + + initialized = true; +} + +} diff --git a/Source/WebCore/accessibility/efl/AccessibilityObjectEfl.cpp b/Source/WebKit/qt/WebCoreSupport/InitWebKitQt.h index d57c3fa24..fbb2d18f7 100644 --- a/Source/WebCore/accessibility/efl/AccessibilityObjectEfl.cpp +++ b/Source/WebKit/qt/WebCoreSupport/InitWebKitQt.h @@ -1,7 +1,5 @@ /* - * Copyright (C) 2008 Apple Ltd. - * Copyright (C) 2009-2010 ProFUSION embedded systems - * Copyright (C) 2009-2010 Samsung Electronics + * Copyright (C) 2012 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 @@ -17,20 +15,15 @@ * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. + * */ -#include "config.h" -#include "AccessibilityObject.h" +#ifndef InitWebKitQt_h +#define InitWebKitQt_h -#if HAVE(ACCESSIBILITY) +namespace WebKit { -namespace WebCore { +Q_DECL_EXPORT void initializeWebKitWidgets(); -bool AccessibilityObject::accessibilityIgnoreAttachment() const -{ - return false; } - -} // namespace WebCore - -#endif // HAVE(ACCESSIBILITY) +#endif diff --git a/Source/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp index 025ad659d..1bfaa7b70 100644 --- a/Source/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp @@ -38,62 +38,22 @@ #include "InspectorServerQt.h" #include "NotImplemented.h" #include "Page.h" +#include "QWebFrameAdapter.h" +#include "QWebPageAdapter.h" #include "ScriptDebugServer.h" -#include "qwebinspector.h" -#include "qwebinspector_p.h" -#include "qwebpage.h" -#include "qwebpage_p.h" -#include "qwebview.h" +#include <QCoreApplication> +#include <QFile> +#include <QNetworkRequest> +#include <QSettings> +#include <QUrl> +#include <QVariant> #include <wtf/text/CString.h> -#include <QtCore/QCoreApplication> -#include <QtCore/QFile> -#include <QtCore/QSettings> -#include <QtCore/QVariant> namespace WebCore { static const QLatin1String settingStoragePrefix("Qt/QtWebKit/QWebInspector/"); static const QLatin1String settingStorageTypeSuffix(".type"); -class InspectorClientWebPage : public QWebPage { - Q_OBJECT - friend class InspectorClientQt; -public: - InspectorClientWebPage(QObject* parent = 0) - : QWebPage(parent) - { - connect(mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), SLOT(javaScriptWindowObjectCleared())); - } - - QWebPage* createWindow(QWebPage::WebWindowType) - { - QWebView* view = new QWebView; - QWebPage* page = new QWebPage; - view->setPage(page); - view->setAttribute(Qt::WA_DeleteOnClose); - return page; - } - -public Q_SLOTS: - void javaScriptWindowObjectCleared() - { -#ifndef QT_NO_PROPERTIES - QVariant inspectorJavaScriptWindowObjects = property("_q_inspectorJavaScriptWindowObjects"); - if (!inspectorJavaScriptWindowObjects.isValid()) - return; - QMap<QString, QVariant> javaScriptNameObjectMap = inspectorJavaScriptWindowObjects.toMap(); - QWebFrame* frame = mainFrame(); - QMap<QString, QVariant>::const_iterator it = javaScriptNameObjectMap.constBegin(); - for ( ; it != javaScriptNameObjectMap.constEnd(); ++it) { - QString name = it.key(); - QVariant value = it.value(); - QObject* obj = value.value<QObject*>(); - frame->addToJavaScriptWindowObject(name, obj); - } -#endif - } -}; - namespace { #if ENABLE(INSPECTOR) @@ -112,7 +72,7 @@ public: if (qsettings.status() == QSettings::AccessError) { // QCoreApplication::setOrganizationName and QCoreApplication::setApplicationName haven't been called qWarning("QWebInspector: QSettings couldn't read configuration setting [%s].", - qPrintable(static_cast<QString>(name))); + qPrintable(static_cast<QString>(name))); return String(); } @@ -134,7 +94,7 @@ public: QSettings qsettings; if (qsettings.status() == QSettings::AccessError) { qWarning("QWebInspector: QSettings couldn't persist configuration setting [%s].", - qPrintable(static_cast<QString>(name))); + qPrintable(static_cast<QString>(name))); return; } @@ -175,7 +135,7 @@ private: } -InspectorClientQt::InspectorClientQt(QWebPage* page) +InspectorClientQt::InspectorClientQt(QWebPageAdapter* page) : m_inspectedWebPage(page) , m_frontendWebPage(0) , m_frontendClient(0) @@ -204,12 +164,12 @@ WebCore::InspectorFrontendChannel* InspectorClientQt::openInspectorFrontend(WebC { WebCore::InspectorFrontendChannel* frontendChannel = 0; #if ENABLE(INSPECTOR) - OwnPtr<QWebView> inspectorView = adoptPtr(new QWebView); - // FIXME: Where does inspectorPage get deleted? - InspectorClientWebPage* inspectorPage = new InspectorClientWebPage(inspectorView.get()); - inspectorView->setPage(inspectorPage); + QObject* view = 0; + QWebPageAdapter* inspectorPage = 0; + m_inspectedWebPage->createWebInspector(&view, &inspectorPage); + OwnPtr<QObject> inspectorView = adoptPtr(view); - QWebInspector* inspector = m_inspectedWebPage->d->getOrCreateInspector(); + QObject* inspector = m_inspectedWebPage->inspectorHandle(); // Remote frontend was attached. if (m_remoteFrontEndChannel) return 0; @@ -228,21 +188,20 @@ WebCore::InspectorFrontendChannel* InspectorClientQt::openInspectorFrontend(WebC #ifndef QT_NO_PROPERTIES QVariant inspectorJavaScriptWindowObjects = inspector->property("_q_inspectorJavaScriptWindowObjects"); if (inspectorJavaScriptWindowObjects.isValid()) - inspectorPage->setProperty("_q_inspectorJavaScriptWindowObjects", inspectorJavaScriptWindowObjects); + inspectorPage->handle()->setProperty("_q_inspectorJavaScriptWindowObjects", inspectorJavaScriptWindowObjects); #endif - inspectorView->page()->mainFrame()->load(inspectorUrl); - m_inspectedWebPage->d->inspectorFrontend = inspectorView.get(); - inspector->d->setFrontend(inspectorView.get()); + inspectorPage->mainFrameAdapter()->load(QNetworkRequest(inspectorUrl)); + m_inspectedWebPage->setInspectorFrontend(inspectorView.get()); // Is 'controller' the same object as 'inspectorController' (which appears to be unused)? - InspectorController* controller = inspectorView->page()->d->page->inspectorController(); - OwnPtr<InspectorFrontendClientQt> frontendClient = adoptPtr(new InspectorFrontendClientQt(m_inspectedWebPage, inspectorView.release(), this)); + InspectorController* controller = inspectorPage->page->inspectorController(); + OwnPtr<InspectorFrontendClientQt> frontendClient = adoptPtr(new InspectorFrontendClientQt(m_inspectedWebPage, inspectorView.release(), inspectorPage->page, this)); m_frontendClient = frontendClient.get(); controller->setInspectorFrontendClient(frontendClient.release()); m_frontendWebPage = inspectorPage; // Web Inspector should not belong to any other page groups since it is a specialized debugger window. - m_frontendWebPage->handle()->page->setGroupName("__WebInspectorPageGroup__"); + m_frontendWebPage->page->setGroupName("__WebInspectorPageGroup__"); frontendChannel = this; #endif return frontendChannel; @@ -273,7 +232,7 @@ void InspectorClientQt::attachAndReplaceRemoteFrontend(InspectorServerRequestHan { #if ENABLE(INSPECTOR) m_remoteFrontEndChannel = channel; - m_inspectedWebPage->d->inspectorController()->connectFrontend(this); + m_inspectedWebPage->page->inspectorController()->connectFrontend(this); #endif } @@ -281,7 +240,7 @@ void InspectorClientQt::detachRemoteFrontend() { #if ENABLE(INSPECTOR) m_remoteFrontEndChannel = 0; - m_inspectedWebPage->d->inspectorController()->disconnectFrontend(); + m_inspectedWebPage->page->inspectorController()->disconnectFrontend(); #endif } @@ -292,9 +251,9 @@ void InspectorClientQt::highlight() void InspectorClientQt::hideHighlight() { - WebCore::Frame* frame = m_inspectedWebPage->d->page->mainFrame(); + WebCore::Frame* frame = m_inspectedWebPage->page->mainFrame(); if (frame) { - QRect rect = m_inspectedWebPage->mainFrame()->geometry(); + QRect rect = m_inspectedWebPage->mainFrameAdapter()->frameRect(); if (!rect.isEmpty()) frame->view()->invalidateRect(rect); } @@ -311,7 +270,7 @@ bool InspectorClientQt::sendMessageToFrontend(const String& message) if (!m_frontendWebPage) return false; - Page* frontendPage = QWebPagePrivate::core(m_frontendWebPage); + Page* frontendPage = m_frontendWebPage->page; return doDispatchMessageOnFrontendPage(frontendPage, message); #else return false; @@ -319,8 +278,8 @@ bool InspectorClientQt::sendMessageToFrontend(const String& message) } #if ENABLE(INSPECTOR) -InspectorFrontendClientQt::InspectorFrontendClientQt(QWebPage* inspectedWebPage, PassOwnPtr<QWebView> inspectorView, InspectorClientQt* inspectorClient) - : InspectorFrontendClientLocal(inspectedWebPage->d->page->inspectorController(), inspectorView->page()->d->page, adoptPtr(new InspectorFrontendSettingsQt())) +InspectorFrontendClientQt::InspectorFrontendClientQt(QWebPageAdapter* inspectedWebPage, PassOwnPtr<QObject> inspectorView, WebCore::Page* inspectorPage, InspectorClientQt* inspectorClient) + : InspectorFrontendClientLocal(inspectedWebPage->page->inspectorController(), inspectorPage, adoptPtr(new InspectorFrontendSettingsQt())) , m_inspectedWebPage(inspectedWebPage) , m_inspectorView(inspectorView) , m_destroyingInspectorView(false) @@ -386,10 +345,8 @@ void InspectorFrontendClientQt::inspectedURLChanged(const String& newURL) void InspectorFrontendClientQt::updateWindowTitle() { - if (m_inspectedWebPage->d->inspector) { - QString caption = QCoreApplication::translate("QWebPage", "Web Inspector - %2").arg(m_inspectedURL); - m_inspectedWebPage->d->inspector->setWindowTitle(caption); - } + QString caption = QCoreApplication::translate("QWebPage", "Web Inspector - %2").arg(m_inspectedURL); + m_inspectedWebPage->setInspectorWindowTitle(caption); } void InspectorFrontendClientQt::destroyInspectorView(bool notifyInspectorController) @@ -399,20 +356,20 @@ void InspectorFrontendClientQt::destroyInspectorView(bool notifyInspectorControl m_destroyingInspectorView = true; // Inspected page may have already been destroyed. - if (m_inspectedWebPage && m_inspectedWebPage->d->inspector) { + if (m_inspectedWebPage) { // Clear reference from QWebInspector to the frontend view. - m_inspectedWebPage->d->inspector->d->setFrontend(0); + m_inspectedWebPage->setInspectorFrontend(0); } #if ENABLE(INSPECTOR) if (notifyInspectorController) - m_inspectedWebPage->d->inspectorController()->disconnectFrontend(); + m_inspectedWebPage->page->inspectorController()->disconnectFrontend(); #endif if (m_inspectorClient) m_inspectorClient->releaseFrontendPage(); // Clear pointer before deleting WebView to avoid recursive calls to its destructor. - OwnPtr<QWebView> inspectorView = m_inspectorView.release(); + OwnPtr<QObject> inspectorView = m_inspectorView.release(); } void InspectorFrontendClientQt::inspectorClientDestroyed() @@ -424,4 +381,3 @@ void InspectorFrontendClientQt::inspectorClientDestroyed() #endif } -#include "InspectorClientQt.moc" diff --git a/Source/WebKit/qt/WebCoreSupport/InspectorClientQt.h b/Source/WebKit/qt/WebCoreSupport/InspectorClientQt.h index 49ba000ad..c6da4d61c 100644 --- a/Source/WebKit/qt/WebCoreSupport/InspectorClientQt.h +++ b/Source/WebKit/qt/WebCoreSupport/InspectorClientQt.h @@ -33,11 +33,14 @@ #include "InspectorClient.h" #include "InspectorFrontendChannel.h" #include "InspectorFrontendClientLocal.h" -#include <QtCore/QString> + +#include <QObject> +#include <QString> #include <wtf/Forward.h> #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> +class QWebPageAdapter; class QWebPage; class QWebView; @@ -48,7 +51,7 @@ class Page; class InspectorClientQt : public InspectorClient, public InspectorFrontendChannel { public: - InspectorClientQt(QWebPage*); + InspectorClientQt(QWebPageAdapter*); virtual void inspectorDestroyed(); @@ -67,8 +70,8 @@ public: void detachRemoteFrontend(); private: - QWebPage* m_inspectedWebPage; - QWebPage* m_frontendWebPage; + QWebPageAdapter* m_inspectedWebPage; + QWebPageAdapter* m_frontendWebPage; InspectorFrontendClientQt* m_frontendClient; bool m_remoteInspector; InspectorServerRequestHandlerQt* m_remoteFrontEndChannel; @@ -78,7 +81,7 @@ private: class InspectorFrontendClientQt : public InspectorFrontendClientLocal { public: - InspectorFrontendClientQt(QWebPage* inspectedWebPage, PassOwnPtr<QWebView> inspectorView, InspectorClientQt* inspectorClient); + InspectorFrontendClientQt(QWebPageAdapter* inspectedWebPage, PassOwnPtr<QObject> inspectorView, WebCore::Page* inspectorPage, InspectorClientQt*); virtual ~InspectorFrontendClientQt(); virtual void frontendLoaded(); @@ -93,7 +96,7 @@ public: virtual void attachWindow(); virtual void detachWindow(); - virtual void setAttachedWindowHeight(unsigned height); + virtual void setAttachedWindowHeight(unsigned); virtual void inspectedURLChanged(const String& newURL); @@ -102,8 +105,8 @@ public: private: void updateWindowTitle(); void destroyInspectorView(bool notifyInspectorController); - QWebPage* m_inspectedWebPage; - OwnPtr<QWebView> m_inspectorView; + QWebPageAdapter* m_inspectedWebPage; + OwnPtr<QObject> m_inspectorView; QString m_inspectedURL; bool m_destroyingInspectorView; InspectorClientQt* m_inspectorClient; diff --git a/Source/WebKit/qt/WebCoreSupport/InspectorClientWebPage.cpp b/Source/WebKit/qt/WebCoreSupport/InspectorClientWebPage.cpp new file mode 100644 index 000000000..dc4730b32 --- /dev/null +++ b/Source/WebKit/qt/WebCoreSupport/InspectorClientWebPage.cpp @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2007 Apple Inc. All rights reserved. + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2008 Holger Hans Peter Freyther + * Copyright (C) 2012 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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. + */ + +#include "config.h" +#include "InspectorClientWebPage.h" + +#include <qwebframe.h> + +using namespace WebKit; + +InspectorClientWebPage::InspectorClientWebPage() +{ + QWebView* view = new QWebView; + view->setPage(this); + setParent(view); + connect(mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), SLOT(javaScriptWindowObjectCleared())); +} + +QWebPage* InspectorClientWebPage::createWindow(QWebPage::WebWindowType) +{ + QWebView* view = new QWebView; + QWebPage* page = new QWebPage; + view->setPage(page); + view->setAttribute(Qt::WA_DeleteOnClose); + return page; +} + +void InspectorClientWebPage::javaScriptWindowObjectCleared() +{ + QVariant inspectorJavaScriptWindowObjects = property("_q_inspectorJavaScriptWindowObjects"); + if (!inspectorJavaScriptWindowObjects.isValid()) + return; + QMap<QString, QVariant> javaScriptNameObjectMap = inspectorJavaScriptWindowObjects.toMap(); + QWebFrame* frame = mainFrame(); + QMap<QString, QVariant>::const_iterator it = javaScriptNameObjectMap.constBegin(); + for ( ; it != javaScriptNameObjectMap.constEnd(); ++it) { + QString name = it.key(); + QVariant value = it.value(); + QObject* obj = value.value<QObject*>(); + frame->addToJavaScriptWindowObject(name, obj); + } +} + diff --git a/Source/WebKit/qt/WebCoreSupport/InspectorClientWebPage.h b/Source/WebKit/qt/WebCoreSupport/InspectorClientWebPage.h new file mode 100644 index 000000000..887f29b0c --- /dev/null +++ b/Source/WebKit/qt/WebCoreSupport/InspectorClientWebPage.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2007 Apple Inc. All rights reserved. + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2008 Holger Hans Peter Freyther + * Copyright (C) 2012 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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. + */ +#ifndef InspectorClientWebPage_h +#define InspectorClientWebPage_h + +#include <qwebpage.h> +#include <qwebview.h> + +namespace WebKit { + +class InspectorClientWebPage : public QWebPage { + Q_OBJECT + friend class InspectorClientQt; +public: + InspectorClientWebPage(); + + QWebPage* createWindow(QWebPage::WebWindowType); + +public Q_SLOTS: + void javaScriptWindowObjectCleared(); +}; + +} // namespace WebKit + +#endif // InspectorClientWebPage_h diff --git a/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp b/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp index 65bbad0f0..abf9c3f78 100644 --- a/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp @@ -23,16 +23,15 @@ #include "InspectorClientQt.h" #include "InspectorController.h" #include "Page.h" +#include "QWebFrameAdapter.h" +#include "QWebPageAdapter.h" #include "qhttpheader_p.h" -#include "qwebpage.h" -#include "qwebpage_p.h" #include <QFile> #include <QString> #include <QStringList> #include <QTcpServer> #include <QTcpSocket> #include <QUrl> -#include <QWidget> #include <qendian.h> #include <wtf/SHA1.h> #include <wtf/text/Base64.h> @@ -224,12 +223,11 @@ void InspectorServerRequestHandlerQt::tcpReadyRead() // If no path is specified, generate an index page. if (m_path.isEmpty() || (m_path == QString(QLatin1Char('/')))) { QString indexHtml = QLatin1String("<html><head><title>Remote Web Inspector</title></head><body><ul>\n"); - for (QMap<int, InspectorClientQt* >::const_iterator it = m_server->m_inspectorClients.begin(); - it != m_server->m_inspectorClients.end(); - ++it) { + for (QMap<int, InspectorClientQt* >::const_iterator it = m_server->m_inspectorClients.begin(); it != m_server->m_inspectorClients.end(); ++it) { + indexHtml.append(QString::fromLatin1("<li><a href=\"/webkit/inspector/inspector.html?page=%1\">%2</li>\n") - .arg(it.key()) - .arg(it.value()->m_inspectedWebPage->mainFrame()->url().toString())); + .arg(it.key()) + .arg(QUrl(it.value()->m_inspectedWebPage->mainFrameAdapter()->url).toString())); } indexHtml.append(QLatin1String("</ul></body></html>")); response = indexHtml.toLatin1(); @@ -356,8 +354,8 @@ void InspectorServerRequestHandlerQt::webSocketReadyRead() #if ENABLE(INSPECTOR) if (m_inspectorClient) { - InspectorController* inspectorController = m_inspectorClient->m_inspectedWebPage->d->page->inspectorController(); - inspectorController->dispatchMessageFromFrontend(QString::fromUtf8(payload)); + InspectorController* inspectorController = m_inspectorClient->m_inspectedWebPage->page->inspectorController(); + inspectorController->dispatchMessageFromFrontend(QString::fromUtf8(payload)); } #endif diff --git a/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.h b/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.h index b0bb0c79d..2754b58d9 100644 --- a/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.h +++ b/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.h @@ -45,8 +45,8 @@ public: void listen(quint16 port); - void registerClient(InspectorClientQt* client); - void unregisterClient(InspectorClientQt* client); + void registerClient(InspectorClientQt*); + void unregisterClient(InspectorClientQt*); void close(); InspectorClientQt* inspectorClientForPage(int pageNum); @@ -70,7 +70,7 @@ class InspectorServerRequestHandlerQt : public QObject { Q_OBJECT public: - InspectorServerRequestHandlerQt(QTcpSocket *tcpConnection, InspectorServerQt *server); + InspectorServerRequestHandlerQt(QTcpSocket* tcpConnection, InspectorServerQt*); virtual ~InspectorServerRequestHandlerQt(); virtual int webSocketSend(const QString& message); virtual int webSocketSend(const char *payload, size_t length); diff --git a/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp index 56ed0b4cb..06840c455 100644 --- a/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp @@ -33,18 +33,16 @@ #include "NotificationPresenterClientQt.h" #include "Document.h" -#include "DumpRenderTreeSupportQt.h" #include "EventNames.h" #include "KURL.h" #include "Page.h" +#include "QWebFrameAdapter.h" +#include "QWebPageAdapter.h" #include "QtPlatformPlugin.h" #include "ScriptExecutionContext.h" #include "SecurityOrigin.h" #include "UserGestureIndicator.h" - -#include "qwebframe_p.h" #include "qwebkitglobal.h" -#include "qwebpage.h" namespace WebCore { @@ -72,10 +70,6 @@ NotificationWrapper::NotificationWrapper() , m_displayEventTimer(this, &NotificationWrapper::sendDisplayEvent) { #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) - -#ifndef QT_NO_SYSTEMTRAYICON - m_notificationIcon = nullptr; -#endif m_presenter = nullptr; #endif } @@ -209,7 +203,6 @@ void NotificationPresenterClientQt::displayNotification(Notification* notificati #ifndef QT_NO_SYSTEMTRAYICON if (!dumpNotification) wrapper->m_closeTimer.startOneShot(notificationTimeout); - wrapper->m_notificationIcon = adoptPtr(new QSystemTrayIcon()); #endif } @@ -227,9 +220,9 @@ void NotificationPresenterClientQt::displayNotification(Notification* notificati } #ifndef QT_NO_SYSTEMTRAYICON - wrapper->connect(wrapper->m_notificationIcon.get(), SIGNAL(messageClicked()), wrapper, SLOT(notificationClicked())); - wrapper->m_notificationIcon->show(); - wrapper->m_notificationIcon->showMessage(notification->title(), notification->body()); + wrapper->connect(m_systemTrayIcon.data(), SIGNAL(messageClicked()), wrapper, SLOT(notificationClicked())); + QMetaObject::invokeMethod(m_systemTrayIcon.data(), "show"); + QMetaObject::invokeMethod(m_systemTrayIcon.data(), "showMessage", Q_ARG(QString, notification->title()), Q_ARG(QString, notification->body())); #endif } @@ -324,11 +317,10 @@ void NotificationPresenterClientQt::requestPermission(ScriptExecutionContext* co CallbacksInfo info; info.m_frame = toFrame(context); info.m_callbacks.append(cb); - m_pendingPermissionRequests.insert(context, info); if (toPage(context) && toFrame(context)) { m_pendingPermissionRequests.insert(context, info); - emit toPage(context)->featurePermissionRequested(toFrame(context), QWebPage::Notifications); + toPage(context)->notificationsPermissionRequested(toFrame(context)); } } } @@ -346,10 +338,10 @@ void NotificationPresenterClientQt::cancelRequestsForPermission(ScriptExecutionC if (iter == m_pendingPermissionRequests.end()) return; - QWebFrame* frame = iter.value().m_frame; + QWebFrameAdapter* frame = iter.value().m_frame; if (!frame) return; - QWebPage* page = frame->page(); + QWebPageAdapter* page = QWebPageAdapter::kit(frame->frame->page()); m_pendingPermissionRequests.erase(iter); if (!page) @@ -358,7 +350,7 @@ void NotificationPresenterClientQt::cancelRequestsForPermission(ScriptExecutionC if (dumpNotification) printf("DESKTOP NOTIFICATION PERMISSION REQUEST CANCELLED: %s\n", QString(context->securityOrigin()->toString()).toUtf8().constData()); - emit page->featurePermissionRequestCanceled(frame, QWebPage::Notifications); + page->notificationsPermissionRequestCancelled(frame); } void NotificationPresenterClientQt::allowNotificationForFrame(Frame* frame) @@ -436,13 +428,13 @@ void NotificationPresenterClientQt::dumpShowText(Notification* notification) printf("DESKTOP NOTIFICATION: contents at %s\n", QString(notification->url().string()).toUtf8().constData()); else { printf("DESKTOP NOTIFICATION:%s icon %s, title %s, text %s\n", - notification->dir() == "rtl" ? "(RTL)" : "", + notification->dir() == "rtl" ? "(RTL)" : "", QString(notification->iconURL().string()).toUtf8().constData(), QString(notification->title()).toUtf8().constData(), QString(notification->body()).toUtf8().constData()); } } -QWebPage* NotificationPresenterClientQt::toPage(ScriptExecutionContext* context) +QWebPageAdapter* NotificationPresenterClientQt::toPage(ScriptExecutionContext* context) { if (!context || context->isWorkerContext()) return 0; @@ -453,10 +445,10 @@ QWebPage* NotificationPresenterClientQt::toPage(ScriptExecutionContext* context) if (!page || !page->mainFrame()) return 0; - return QWebFramePrivate::kit(page->mainFrame())->page(); + return QWebPageAdapter::kit(page); } -QWebFrame* NotificationPresenterClientQt::toFrame(ScriptExecutionContext* context) +QWebFrameAdapter* NotificationPresenterClientQt::toFrame(ScriptExecutionContext* context) { if (!context || context->isWorkerContext()) return 0; @@ -465,7 +457,7 @@ QWebFrame* NotificationPresenterClientQt::toFrame(ScriptExecutionContext* contex if (!document || !document->frame()) return 0; - return QWebFramePrivate::kit(document->frame()); + return QWebFrameAdapter::kit(document->frame()); } #endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) diff --git a/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h b/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h index 5819b4d80..78668f35f 100644 --- a/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h +++ b/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h @@ -36,14 +36,13 @@ #include "NotificationClient.h" #include "QtPlatformPlugin.h" #include "Timer.h" - #include "qwebkitplatformplugin.h" #include <QMultiHash> -#include <QSystemTrayIcon> +#include <QScopedPointer> -class QWebFrame; -class QWebPage; +class QWebFrameAdapter; +class QWebPageAdapter; namespace WebCore { @@ -55,7 +54,7 @@ class NotificationWrapper : public QObject, public QWebNotificationData { Q_OBJECT public: NotificationWrapper(); - ~NotificationWrapper() {} + ~NotificationWrapper() { } void close(); void close(Timer<NotificationWrapper>*); @@ -69,14 +68,12 @@ public Q_SLOTS: void notificationClosed(); void notificationClicked(); -public: -#ifndef QT_NO_SYSTEMTRAYICON - OwnPtr<QSystemTrayIcon> m_notificationIcon; -#endif - +private: OwnPtr<QWebNotificationPresenter> m_presenter; Timer<NotificationWrapper> m_closeTimer; Timer<NotificationWrapper> m_displayEventTimer; + + friend class NotificationPresenterClientQt; }; #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) @@ -109,6 +106,10 @@ public: static bool dumpNotification; void addClient() { m_clientCount++; } +#ifndef QT_NO_SYSTEMTRAYICON + bool hasSystemTrayIcon() const { return !m_systemTrayIcon.isNull(); } + void setSystemTrayIcon(QObject* icon) { m_systemTrayIcon.reset(icon); } +#endif void removeClient(); static NotificationPresenterClientQt* notificationPresenter(); @@ -124,12 +125,12 @@ private: void detachNotification(Notification*); void dumpReplacedIdText(Notification*); void dumpShowText(Notification*); - QWebPage* toPage(ScriptExecutionContext*); - QWebFrame* toFrame(ScriptExecutionContext*); + QWebPageAdapter* toPage(ScriptExecutionContext*); + QWebFrameAdapter* toFrame(ScriptExecutionContext*); int m_clientCount; struct CallbacksInfo { - QWebFrame* m_frame; + QWebFrameAdapter* m_frame; QList<RefPtr<VoidCallback> > m_callbacks; }; QHash<ScriptExecutionContext*, CallbacksInfo > m_pendingPermissionRequests; @@ -137,10 +138,13 @@ private: NotificationsQueue m_notifications; QtPlatformPlugin m_platformPlugin; +#ifndef QT_NO_SYSTEMTRAYICON + QScopedPointer<QObject> m_systemTrayIcon; +#endif }; -#endif +#endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) } -#endif +#endif // NotificationPresenterClientQt_h diff --git a/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp index 141f98e30..92ab84b64 100644 --- a/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp @@ -35,8 +35,7 @@ #if USE(3D_GRAPHICS) #include <QWindow> -static void createPlatformGraphicsContext3DFromWidget(QWidget* widget, PlatformGraphicsContext3D* context, - PlatformGraphicsSurface3D* surface, QObject** surfaceOwner) +static void createPlatformGraphicsContext3DFromWidget(QWidget* widget, PlatformGraphicsContext3D* context, PlatformGraphicsSurface3D* surface, QObject** surfaceOwner) { #ifdef QT_OPENGL_LIB *context = 0; @@ -73,7 +72,7 @@ static void createPlatformGraphicsContext3DFromWidget(QWidget* widget, PlatformG QWindow* QWebPageClient::ownerWindow() const { - QWidget* widget = ownerWidget(); + QWidget* widget = qobject_cast<QWidget*>(ownerWidget()); if (!widget) return 0; if (QWindow *window = widget->windowHandle()) @@ -204,7 +203,7 @@ int PageClientQWidget::screenNumber() const return 0; } -QWidget* PageClientQWidget::ownerWidget() const +QObject* PageClientQWidget::ownerWidget() const { return view; } @@ -238,9 +237,7 @@ void PageClientQWidget::setWidgetVisible(Widget* widget, bool visible) } #if USE(3D_GRAPHICS) -void PageClientQWidget::createPlatformGraphicsContext3D(PlatformGraphicsContext3D* context, - PlatformGraphicsSurface3D* surface, - QObject** surfaceOwner) +void PageClientQWidget::createPlatformGraphicsContext3D(PlatformGraphicsContext3D* context, PlatformGraphicsSurface3D* surface, QObject** surfaceOwner) { createPlatformGraphicsContext3DFromWidget(view, context, surface, surfaceOwner); } @@ -363,7 +360,7 @@ int PageClientQGraphicsWidget::screenNumber() const return 0; } -QWidget* PageClientQGraphicsWidget::ownerWidget() const +QObject* PageClientQGraphicsWidget::ownerWidget() const { if (QGraphicsScene* scene = view->scene()) { const QList<QGraphicsView*> views = scene->views(); @@ -428,11 +425,9 @@ QRectF PageClientQGraphicsWidget::windowRect() const #endif // QT_NO_GRAPHICSVIEW #if USE(3D_GRAPHICS) -void PageClientQGraphicsWidget::createPlatformGraphicsContext3D(PlatformGraphicsContext3D* context, - PlatformGraphicsSurface3D* surface, - QObject** surfaceOwner) +void PageClientQGraphicsWidget::createPlatformGraphicsContext3D(PlatformGraphicsContext3D* context, PlatformGraphicsSurface3D* surface, QObject** surfaceOwner) { - createPlatformGraphicsContext3DFromWidget(ownerWidget(), context, surface, surfaceOwner); + createPlatformGraphicsContext3DFromWidget(qobject_cast<QWidget*>(ownerWidget()), context, surface, surfaceOwner); } #endif diff --git a/Source/WebKit/qt/WebCoreSupport/PageClientQt.h b/Source/WebKit/qt/WebCoreSupport/PageClientQt.h index e6b9e1694..72dca42c1 100644 --- a/Source/WebKit/qt/WebCoreSupport/PageClientQt.h +++ b/Source/WebKit/qt/WebCoreSupport/PageClientQt.h @@ -31,15 +31,14 @@ #include "qwebframe_p.h" #include "qwebpage.h" #include "qwebpage_p.h" +#include <Settings.h> #include <qgraphicsscene.h> #include <qgraphicsview.h> #include <qgraphicswidget.h> +#include <qmetaobject.h> #include <qscrollbar.h> #include <qstyleoption.h> #include <qwidget.h> -#include <QtCore/qmetaobject.h> - -#include <Settings.h> namespace WebCore { @@ -75,18 +74,18 @@ public: virtual void scroll(int dx, int dy, const QRect&); virtual void update(const QRect& dirtyRect); - virtual void setInputMethodEnabled(bool enable); + virtual void setInputMethodEnabled(bool); virtual bool inputMethodEnabled() const; - virtual void setInputMethodHints(Qt::InputMethodHints hints); + virtual void setInputMethodHints(Qt::InputMethodHints); #ifndef QT_NO_CURSOR virtual QCursor cursor() const; - virtual void updateCursor(const QCursor& cursor); + virtual void updateCursor(const QCursor&); #endif virtual QPalette palette() const; virtual int screenNumber() const; - virtual QWidget* ownerWidget() const; + virtual QObject* ownerWidget() const; virtual QRect geometryRelativeToOwnerWidget() const; virtual QObject* pluginParent() const; @@ -100,9 +99,7 @@ public: virtual void setWidgetVisible(Widget*, bool visible); #if USE(3D_GRAPHICS) - virtual void createPlatformGraphicsContext3D(PlatformGraphicsContext3D*, - PlatformGraphicsSurface3D*, - QObject**); + virtual void createPlatformGraphicsContext3D(PlatformGraphicsContext3D*, PlatformGraphicsSurface3D*, QObject**); #endif QWidget* view; @@ -132,9 +129,9 @@ public: class QGraphicsItemOverlay : public QGraphicsObject { public: QGraphicsItemOverlay(QGraphicsWidget* view, QWebPage* p) - :QGraphicsObject(view) - , q(view) - , page(p) + : QGraphicsObject(view) + , q(view) + , page(p) { setPos(0, 0); setFlag(QGraphicsItem::ItemUsesExtendedStyleOption, true); @@ -172,7 +169,7 @@ public: #endif , overlay(0) { - Q_ASSERT(view); + Q_ASSERT(view); #if USE(ACCELERATED_COMPOSITING) // the overlay and stays alive for the lifetime of // this QGraphicsWebView as the scrollbars are needed when there's no compositing @@ -186,18 +183,18 @@ public: virtual void scroll(int dx, int dy, const QRect&); virtual void update(const QRect& dirtyRect); - virtual void setInputMethodEnabled(bool enable); + virtual void setInputMethodEnabled(bool); virtual bool inputMethodEnabled() const; - virtual void setInputMethodHints(Qt::InputMethodHints hints); + virtual void setInputMethodHints(Qt::InputMethodHints); #ifndef QT_NO_CURSOR virtual QCursor cursor() const; - virtual void updateCursor(const QCursor& cursor); + virtual void updateCursor(const QCursor&); #endif virtual QPalette palette() const; virtual int screenNumber() const; - virtual QWidget* ownerWidget() const; + virtual QObject* ownerWidget() const; virtual QRect geometryRelativeToOwnerWidget() const; virtual QObject* pluginParent() const; @@ -209,9 +206,7 @@ public: virtual void setWidgetVisible(Widget*, bool); #if USE(3D_GRAPHICS) - virtual void createPlatformGraphicsContext3D(PlatformGraphicsContext3D*, - PlatformGraphicsSurface3D*, - QObject**); + virtual void createPlatformGraphicsContext3D(PlatformGraphicsContext3D*, PlatformGraphicsSurface3D*, QObject**); #endif #if USE(TILED_BACKING_STORE) diff --git a/Source/WebKit/qt/WebCoreSupport/PlatformStrategiesQt.cpp b/Source/WebKit/qt/WebCoreSupport/PlatformStrategiesQt.cpp index c31d9b007..5d9e755d0 100644 --- a/Source/WebKit/qt/WebCoreSupport/PlatformStrategiesQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/PlatformStrategiesQt.cpp @@ -32,16 +32,17 @@ #include "Chrome.h" #include "ChromeClientQt.h" +#include "QWebPageAdapter.h" +#include "qwebhistoryinterface.h" +#include "qwebpluginfactory.h" + #include <IntSize.h> -#include "NotImplemented.h" +#include <NotImplemented.h> #include <Page.h> #include <PageGroup.h> #include <PluginDatabase.h> #include <QCoreApplication> #include <QLocale> -#include <qwebhistoryinterface.h> -#include <qwebpage.h> -#include <qwebpluginfactory.h> #include <wtf/MathExtras.h> using namespace WebCore; @@ -99,9 +100,9 @@ void PlatformStrategiesQt::refreshPlugins() void PlatformStrategiesQt::getPluginInfo(const WebCore::Page* page, Vector<WebCore::PluginInfo>& outPlugins) { - QWebPage* qPage = static_cast<ChromeClientQt*>(page->chrome()->client())->m_webPage; + QWebPageAdapter* qPage = static_cast<ChromeClientQt*>(page->chrome()->client())->m_webPage; QWebPluginFactory* factory; - if (qPage && (factory = qPage->pluginFactory())) { + if (qPage && (factory = qPage->pluginFactory)) { QList<QWebPluginFactory::Plugin> qplugins = factory->plugins(); for (int i = 0; i < qplugins.count(); ++i) { @@ -117,7 +118,7 @@ void PlatformStrategiesQt::getPluginInfo(const WebCore::Page* page, Vector<WebCo mimeInfo.type = mimeType.name; mimeInfo.desc = mimeType.description; for (int k = 0; k < mimeType.fileExtensions.count(); ++k) - mimeInfo.extensions.append(mimeType.fileExtensions.at(k)); + mimeInfo.extensions.append(mimeType.fileExtensions.at(k)); info.mimes.append(mimeInfo); } @@ -130,7 +131,7 @@ void PlatformStrategiesQt::getPluginInfo(const WebCore::Page* page, Vector<WebCo outPlugins.resize(plugins.size()); - for (unsigned int i = 0; i < plugins.size(); ++i) { + for (int i = 0; i < plugins.size(); ++i) { PluginInfo info; PluginPackage* package = plugins[i]; diff --git a/Source/WebKit/qt/WebCoreSupport/PopupMenuQt.cpp b/Source/WebKit/qt/WebCoreSupport/PopupMenuQt.cpp index 29e4624eb..72d083f34 100644 --- a/Source/WebKit/qt/WebCoreSupport/PopupMenuQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/PopupMenuQt.cpp @@ -29,12 +29,11 @@ #include "ChromeClientQt.h" #include "FrameView.h" #include "PopupMenuClient.h" - #include "qwebkitplatformplugin.h" class SelectData : public QWebSelectData { public: - SelectData(WebCore::PopupMenuClient*& data) : d(data) {} + SelectData(WebCore::PopupMenuClient*& data) : d(data) { } virtual ItemType itemType(int) const; virtual QString itemText(int idx) const { return QString(d ? d->itemText(idx) : ""); } diff --git a/Source/WebKit/qt/WebCoreSupport/QGraphicsWidgetPluginImpl.cpp b/Source/WebKit/qt/WebCoreSupport/QGraphicsWidgetPluginImpl.cpp new file mode 100644 index 000000000..5137933a0 --- /dev/null +++ b/Source/WebKit/qt/WebCoreSupport/QGraphicsWidgetPluginImpl.cpp @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2012 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 + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include "config.h" +#include "QGraphicsWidgetPluginImpl.h" + +#include <QGraphicsScene> +#include <QGraphicsWidget> + +#ifndef QT_NO_GRAPHICSVIEW + +QGraphicsWidgetPluginImpl::~QGraphicsWidgetPluginImpl() +{ + m_graphicsWidget->deleteLater(); +} + +void QGraphicsWidgetPluginImpl::update(const QRect &rect) +{ + QGraphicsScene* scene = m_graphicsWidget->scene(); + if (scene) + scene->update(rect); +} + +void QGraphicsWidgetPluginImpl::setGeometryAndClip(const QRect &geometry, const QRect &, bool) +{ + m_graphicsWidget->setGeometry(geometry); + // FIXME: Make the code handle clipping of graphics widgets. +} + +void QGraphicsWidgetPluginImpl::setVisible(bool visible) +{ + m_graphicsWidget->setVisible(visible); +} + +void QGraphicsWidgetPluginImpl::setWidgetParent(QObject* parent) +{ + QGraphicsObject* parentItem = qobject_cast<QGraphicsObject*>(parent); + if (parentItem) + m_graphicsWidget->setParentItem(parentItem); +} + +QObject* QGraphicsWidgetPluginImpl::handle() const +{ + return m_graphicsWidget; +} + +#include "moc_QGraphicsWidgetPluginImpl.cpp" + +#endif // !defined(QT_NO_GRAPHICSVIEW) diff --git a/Source/WebKit/qt/WebCoreSupport/QGraphicsWidgetPluginImpl.h b/Source/WebKit/qt/WebCoreSupport/QGraphicsWidgetPluginImpl.h new file mode 100644 index 000000000..7f758226c --- /dev/null +++ b/Source/WebKit/qt/WebCoreSupport/QGraphicsWidgetPluginImpl.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2012 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 + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ +#ifndef QGraphicsWidgetPluginImpl_h +#define QGraphicsWidgetPluginImpl_h + +#ifndef QT_NO_GRAPHICSVIEW + +#include "QtPluginWidgetAdapter.h" + +QT_BEGIN_NAMESPACE +class QGraphicsWidget; +QT_END_NAMESPACE + +class QGraphicsWidgetPluginImpl : public QtPluginWidgetAdapter { + Q_OBJECT +public: + QGraphicsWidgetPluginImpl(QGraphicsWidget *w) : m_graphicsWidget(w) { } + virtual ~QGraphicsWidgetPluginImpl(); + virtual void update(const QRect &) OVERRIDE; + virtual void setGeometryAndClip(const QRect&, const QRect&, bool) OVERRIDE; + virtual void setVisible(bool); + virtual void setStyleSheet(const QString&) OVERRIDE { } + virtual void setWidgetParent(QObject*) OVERRIDE; + virtual QObject* handle() const OVERRIDE; +private: + QGraphicsWidget *m_graphicsWidget; +}; +#endif // !defined(QT_NO_GRAPHICSVIEW) + +#endif // QGraphicsWidgetPluginImpl_h diff --git a/Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.cpp b/Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.cpp new file mode 100644 index 000000000..e86413cf0 --- /dev/null +++ b/Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.cpp @@ -0,0 +1,210 @@ +/* + * Copyright (C) 2012 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 + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include "config.h" +#include "QWebFrameAdapter.h" + +#include "Frame.h" +#include "FrameLoaderClientQt.h" +#include "QWebPageAdapter.h" +#if ENABLE(GESTURE_EVENTS) +#include "PlatformGestureEvent.h" +#include "WebEventConversion.h" +#endif + +#include <QFileInfo> +#include <QNetworkRequest> + +using namespace WebCore; + +static inline ResourceRequestCachePolicy cacheLoadControlToCachePolicy(uint cacheLoadControl) +{ + switch (cacheLoadControl) { + case QNetworkRequest::AlwaysNetwork: + return WebCore::ReloadIgnoringCacheData; + case QNetworkRequest::PreferCache: + return WebCore::ReturnCacheDataElseLoad; + case QNetworkRequest::AlwaysCache: + return WebCore::ReturnCacheDataDontLoad; + default: + break; + } + return WebCore::UseProtocolCachePolicy; +} + +QWebFrameData::QWebFrameData(WebCore::Page* parentPage, WebCore::Frame* parentFrame, WebCore::HTMLFrameOwnerElement* ownerFrameElement, const WTF::String& frameName) + : name(frameName) + , ownerElement(ownerFrameElement) + , page(parentPage) + , allowsScrolling(true) + , marginWidth(0) + , marginHeight(0) +{ + frameLoaderClient = new FrameLoaderClientQt(); + frame = Frame::create(page, ownerElement, frameLoaderClient); + + // FIXME: All of the below should probably be moved over into WebCore + frame->tree()->setName(name); + if (parentFrame) + parentFrame->tree()->appendChild(frame); +} + +QWebFrameAdapter::QWebFrameAdapter() + : pageAdapter(0) + , allowsScrolling(true) + , marginWidth(-1) + , marginHeight(-1) + , frame(0) + , frameLoaderClient(0) +{ +} + +QWebFrameAdapter::~QWebFrameAdapter() +{ + if (frameLoaderClient) + frameLoaderClient->m_webFrame = 0; +} + +void QWebFrameAdapter::load(const QNetworkRequest& req, QNetworkAccessManager::Operation operation, const QByteArray& body) +{ + if (frame->tree()->parent()) + pageAdapter->insideOpenCall = true; + + QUrl url = ensureAbsoluteUrl(req.url()); + + WebCore::ResourceRequest request(url); + + switch (operation) { + case QNetworkAccessManager::HeadOperation: + request.setHTTPMethod("HEAD"); + break; + case QNetworkAccessManager::GetOperation: + request.setHTTPMethod("GET"); + break; + case QNetworkAccessManager::PutOperation: + request.setHTTPMethod("PUT"); + break; + case QNetworkAccessManager::PostOperation: + request.setHTTPMethod("POST"); + break; + case QNetworkAccessManager::DeleteOperation: + request.setHTTPMethod("DELETE"); + break; + case QNetworkAccessManager::CustomOperation: + request.setHTTPMethod(req.attribute(QNetworkRequest::CustomVerbAttribute).toByteArray().constData()); + break; + case QNetworkAccessManager::UnknownOperation: + // eh? + break; + } + + QVariant cacheLoad = req.attribute(QNetworkRequest::CacheLoadControlAttribute); + if (cacheLoad.isValid()) { + bool ok; + uint cacheLoadValue = cacheLoad.toUInt(&ok); + if (ok) + request.setCachePolicy(cacheLoadControlToCachePolicy(cacheLoadValue)); + } + + QList<QByteArray> httpHeaders = req.rawHeaderList(); + for (int i = 0; i < httpHeaders.size(); ++i) { + const QByteArray &headerName = httpHeaders.at(i); + request.addHTTPHeaderField(QString::fromLatin1(headerName), QString::fromLatin1(req.rawHeader(headerName))); + } + + if (!body.isEmpty()) + request.setHTTPBody(WebCore::FormData::create(body.constData(), body.size())); + + frame->loader()->load(request, false); + + if (frame->tree()->parent()) + pageAdapter->insideOpenCall = false; +} + +#if ENABLE(GESTURE_EVENTS) +void QWebFrameAdapter::handleGestureEvent(QGestureEventFacade* gestureEvent) +{ + ASSERT(hasView()); + switch (gestureEvent->type) { + case Qt::TapGesture: + frame->eventHandler()->handleGestureEvent(convertGesture(gestureEvent)); + break; + case Qt::TapAndHoldGesture: + frame->eventHandler()->sendContextMenuEventForGesture(convertGesture(gestureEvent)); + break; + default: + ASSERT_NOT_REACHED(); + } +} +#endif + +WebCore::IntSize QWebFrameAdapter::scrollPosition() const +{ + if (!hasView()) + return IntSize(); + return frame->view()->scrollOffset(); +} + +IntRect QWebFrameAdapter::frameRect() const +{ + if (!hasView()) + return IntRect(); + return frame->view()->frameRect(); +} + +void QWebFrameAdapter::init(QWebPageAdapter* pageAdapter) +{ + QWebFrameData frameData(pageAdapter->page); + init(pageAdapter, &frameData); +} + +void QWebFrameAdapter::init(QWebPageAdapter* pageAdapter, QWebFrameData* frameData) +{ + this->pageAdapter = pageAdapter; + allowsScrolling = frameData->allowsScrolling; + marginWidth = frameData->marginWidth; + marginHeight = frameData->marginHeight; + frame = frameData->frame.get(); + frameLoaderClient = frameData->frameLoaderClient; + frameLoaderClient->setFrame(this, frame); + + frame->init(); +} + +QWebFrameAdapter* QWebFrameAdapter::kit(const Frame* frame) +{ + return static_cast<FrameLoaderClientQt*>(frame->loader()->client())->webFrame(); +} + +QUrl QWebFrameAdapter::ensureAbsoluteUrl(const QUrl& url) +{ + if (!url.isValid() || !url.isRelative()) + return url; + + // This contains the URL with absolute path but without + // the query and the fragment part. + QUrl baseUrl = QUrl::fromLocalFile(QFileInfo(url.toLocalFile()).absoluteFilePath()); + + // The path is removed so the query and the fragment parts are there. + QString pathRemoved = url.toString(QUrl::RemovePath); + QUrl toResolve(pathRemoved); + + return baseUrl.resolved(toResolve); +} diff --git a/Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.h b/Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.h new file mode 100644 index 000000000..17c41d539 --- /dev/null +++ b/Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.h @@ -0,0 +1,114 @@ +/* + * Copyright (C) 2012 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 + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ +#ifndef QWebFrameAdapter_h +#define QWebFrameAdapter_h + +#include "FrameLoaderClientQt.h" +#include "PlatformEvent.h" + +#include <FrameView.h> +#include <IntRect.h> +#include <IntSize.h> +#include <KURL.h> + +#include <QNetworkAccessManager> +#include <QSize> + +namespace WebCore { +class Frame; +} + +QT_BEGIN_NAMESPACE +class QPoint; +QT_END_NAMESPACE + +#if ENABLE(GESTURE_EVENTS) +class QGestureEventFacade; +#endif +class QWebFrame; +class QWebPageAdapter; + +class QWebFrameData { +public: + QWebFrameData(WebCore::Page*, WebCore::Frame* parentFrame = 0, WebCore::HTMLFrameOwnerElement* = 0, const WTF::String& frameName = WTF::String()); + + WTF::String name; + WebCore::HTMLFrameOwnerElement* ownerElement; + WebCore::Page* page; + RefPtr<WebCore::Frame> frame; + WebCore::FrameLoaderClientQt* frameLoaderClient; + + WTF::String referrer; + bool allowsScrolling; + int marginWidth; + int marginHeight; +}; + +class QWebFrameAdapter { +public: + static QUrl ensureAbsoluteUrl(const QUrl&); + + QWebFrameAdapter(); + virtual ~QWebFrameAdapter(); + + virtual QWebFrame* apiHandle() = 0; + virtual QObject* handle() = 0; + virtual void contentsSizeDidChange(const QSize&) = 0; + virtual int scrollBarPolicy(Qt::Orientation) const = 0; + virtual void emitUrlChanged() = 0; + virtual void didStartProvisionalLoad() = 0; + virtual void didClearWindowObject() = 0; + virtual bool handleProgressFinished(QPoint*) = 0; + virtual void emitInitialLayoutCompleted() = 0; + virtual void emitIconChanged() = 0; + virtual void emitLoadStarted(bool originatingLoad) = 0; + virtual void emitLoadFinished(bool originatingLoad, bool ok) = 0; + virtual QWebFrameAdapter* createChildFrame(QWebFrameData*) = 0; + + void load(const QNetworkRequest&, QNetworkAccessManager::Operation = QNetworkAccessManager::GetOperation, const QByteArray& body = QByteArray()); + inline bool hasView() const { return frame && frame->view(); } +#if ENABLE(GESTURE_EVENTS) + void handleGestureEvent(QGestureEventFacade*); +#endif + QWebFrameAdapter* createFrame(QWebFrameData*); + + WebCore::IntSize scrollPosition() const; + WebCore::IntRect frameRect() const; + QWebPageAdapter* pageAdapter; + +// protected: + bool allowsScrolling; + int marginWidth; + int marginHeight; + +// private: + void init(QWebPageAdapter*); + void init(QWebPageAdapter*, QWebFrameData*); + + WebCore::Frame *frame; + WebCore::FrameLoaderClientQt *frameLoaderClient; + WebCore::KURL url; + + static QWebFrameAdapter* kit(const WebCore::Frame*); + +// friend class ChromeClientQt; +}; + +#endif // QWebFrameAdapter_h diff --git a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp new file mode 100644 index 000000000..3d639d99a --- /dev/null +++ b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2012 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 + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include "config.h" +#include "QWebPageAdapter.h" + +#include "Chrome.h" +#include "ChromeClientQt.h" +#include "NotificationPresenterClientQt.h" +#include "QWebFrameAdapter.h" +#include "UndoStepQt.h" +#include "qwebpluginfactory.h" +#include "qwebsettings.h" +#include <Page.h> +#include <QNetworkAccessManager> + +using namespace WebCore; + +bool QWebPageAdapter::drtRun = false; + +QWebPageAdapter::QWebPageAdapter() + : settings(0) + , page(0) + , pluginFactory(0) + , forwardUnsupportedContent(false) + , insideOpenCall(false) + , networkManager(0) +{ +} + +QWebPageAdapter::~QWebPageAdapter() +{ + delete page; + delete settings; + +#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) + NotificationPresenterClientQt::notificationPresenter()->removeClient(); +#endif +} + +void QWebPageAdapter::init(Page* page) +{ + this->page = page; + settings = new QWebSettings(page->settings()); + +#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) + WebCore::provideNotification(page, NotificationPresenterClientQt::notificationPresenter()); +#endif +} + +void QWebPageAdapter::deletePage() +{ + delete page; + page = 0; +} + +QWebPageAdapter* QWebPageAdapter::kit(Page* page) +{ + return static_cast<ChromeClientQt*>(page->chrome()->client())->m_webPage; +} + +ViewportArguments QWebPageAdapter::viewportArguments() +{ + return page ? page->viewportArguments() : WebCore::ViewportArguments(); +} + + +void QWebPageAdapter::registerUndoStep(WTF::PassRefPtr<WebCore::UndoStep> step) +{ + createUndoStep(QSharedPointer<UndoStepQt>(new UndoStepQt(step))); +} + +void QWebPageAdapter::setNetworkAccessManager(QNetworkAccessManager *manager) +{ + if (manager == networkManager) + return; + if (networkManager && networkManager->parent() == handle()) + delete networkManager; + networkManager = manager; +} + +QNetworkAccessManager* QWebPageAdapter::networkAccessManager() +{ + if (!networkManager) + networkManager = new QNetworkAccessManager(handle()); + return networkManager; +} diff --git a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h new file mode 100644 index 000000000..48298922e --- /dev/null +++ b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h @@ -0,0 +1,172 @@ +/* + * Copyright (C) 2012 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 + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ +#ifndef QWebPageAdapter_h +#define QWebPageAdapter_h + +#include "QWebPageClient.h" +#include "ViewportArguments.h" + +#include <qnetworkrequest.h> +#include <qrect.h> +#include <qscopedpointer.h> +#include <qsharedpointer.h> +#include <qstring.h> +#include <qurl.h> + +QT_BEGIN_NAMESPACE +class QKeyEvent; +class QNetworkAccessManager; +QT_END_NAMESPACE + +namespace WebCore { +class Page; +class ChromeClientQt; +class GeolocationClientQt; +class UndoStep; +} + +class QtPluginWidgetAdapter; +class QWebFrameAdapter; +class QWebHistoryItem; +class QWebPageClient; +class QWebPluginFactory; +class QWebSecurityOrigin; +class QWebSelectMethod; +class QWebSettings; +class QWebFullScreenVideoHandler; +class UndoStepQt; + + +class QWebPageAdapter { +public: + QWebPageAdapter(); + virtual ~QWebPageAdapter(); + + void init(WebCore::Page*); + // Called manually from ~QWebPage destructor to ensure that + // the QWebPageAdapter and the QWebPagePrivate are intact when + // various destruction callbacks from WebCore::Page::~Page() hit us. + void deletePage(); + + virtual void show() = 0; + virtual void setFocus() = 0; + virtual void unfocus() = 0; + virtual void setWindowRect(const QRect&) = 0; + virtual QSize viewportSize() const = 0; + virtual QWebPageAdapter* createWindow(bool /*dialog*/) = 0; + virtual QObject* handle() = 0; + virtual void javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID) = 0; + virtual void javaScriptAlert(QWebFrameAdapter*, const QString& msg) = 0; + virtual bool javaScriptConfirm(QWebFrameAdapter*, const QString& msg) = 0; + virtual bool javaScriptPrompt(QWebFrameAdapter*, const QString& msg, const QString& defaultValue, QString* result) = 0; + virtual bool shouldInterruptJavaScript() = 0; + virtual void printRequested(QWebFrameAdapter*) = 0; + virtual void databaseQuotaExceeded(QWebFrameAdapter*, const QString& databaseName) = 0; + virtual void applicationCacheQuotaExceeded(QWebSecurityOrigin*, quint64 defaultOriginQuota, quint64 totalSpaceNeeded) = 0; + virtual void setToolTip(const QString&) = 0; + virtual QStringList chooseFiles(QWebFrameAdapter*, bool allowMultiple, const QStringList& suggestedFileNames) = 0; + virtual QColor colorSelectionRequested(const QColor& selectedColor) = 0; + virtual QWebSelectMethod* createSelectPopup() = 0; + virtual QRect viewRectRelativeToWindow() = 0; + +#if USE(QT_MULTIMEDIA) + virtual QWebFullScreenVideoHandler* createFullScreenVideoHandler() = 0; +#endif + virtual void geolocationPermissionRequested(QWebFrameAdapter*) = 0; + virtual void geolocationPermissionRequestCancelled(QWebFrameAdapter*) = 0; + virtual void notificationsPermissionRequested(QWebFrameAdapter*) = 0; + virtual void notificationsPermissionRequestCancelled(QWebFrameAdapter*) = 0; + + virtual void respondToChangedContents() = 0; + virtual void respondToChangedSelection() = 0; + virtual void microFocusChanged() = 0; + virtual void triggerCopyAction() = 0; + virtual void triggerActionForKeyEvent(QKeyEvent*) = 0; + virtual void clearUndoStack() = 0; + virtual bool canUndo() const = 0; + virtual bool canRedo() const = 0; + virtual void undo() = 0; + virtual void redo() = 0; + virtual const char* editorCommandForKeyEvent(QKeyEvent*) = 0; + virtual void createUndoStep(QSharedPointer<UndoStepQt>) = 0; + + virtual void updateNavigationActions() = 0; + + virtual QWebFrameAdapter* mainFrameAdapter() = 0; + + virtual QObject* inspectorHandle() = 0; + virtual void setInspectorFrontend(QObject*) = 0; + virtual void setInspectorWindowTitle(const QString&) = 0; + virtual void createWebInspector(QObject** inspectorView, QWebPageAdapter** inspectorPage) = 0; + virtual QStringList menuActionsAsText() = 0; + virtual void emitViewportChangeRequested() = 0; + virtual bool acceptNavigationRequest(QWebFrameAdapter*, const QNetworkRequest&, int type) = 0; + virtual void emitRestoreFrameStateRequested(QWebFrameAdapter *) = 0; + virtual void emitSaveFrameStateRequested(QWebFrameAdapter *, QWebHistoryItem*) = 0; + virtual void emitDownloadRequested(const QNetworkRequest&) = 0; + virtual void emitFrameCreated(QWebFrameAdapter*) = 0; + virtual QString userAgentForUrl(const QUrl&) const = 0; + virtual bool supportsErrorPageExtension() const = 0; + struct ErrorPageOption { + QUrl url; + QWebFrameAdapter* frame; + QString domain; + int error; + QString errorString; + }; + struct ErrorPageReturn { + QString contentType; + QString encoding; + QUrl baseUrl; + QByteArray content; + }; + virtual bool errorPageExtension(ErrorPageOption*, ErrorPageReturn*) = 0; + virtual QtPluginWidgetAdapter* createPlugin(const QString&, const QUrl&, const QStringList&, const QStringList&) = 0; + virtual QtPluginWidgetAdapter* adapterForWidget(QObject*) const = 0; + + + static QWebPageAdapter* kit(WebCore::Page*); + WebCore::ViewportArguments viewportArguments(); + void registerUndoStep(WTF::PassRefPtr<WebCore::UndoStep>); + + void setNetworkAccessManager(QNetworkAccessManager*); + QNetworkAccessManager* networkAccessManager(); + + QWebSettings *settings; + + WebCore::Page *page; + QScopedPointer<QWebPageClient> client; + + QWebPluginFactory *pluginFactory; + + bool forwardUnsupportedContent; + bool insideOpenCall; + +private: + QNetworkAccessManager *networkManager; + +public: + static bool drtRun; + + friend class WebCore::ChromeClientQt; + friend class WebCore::GeolocationClientQt; +}; + +#endif // QWebPageAdapter_h diff --git a/Source/WebCore/dom/EditingText.cpp b/Source/WebKit/qt/WebCoreSupport/QWebUndoCommand.cpp index a3e7a4c53..a196df50d 100644 --- a/Source/WebCore/dom/EditingText.cpp +++ b/Source/WebKit/qt/WebCoreSupport/QWebUndoCommand.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2012 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 @@ -15,31 +15,30 @@ * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. + * */ - #include "config.h" -#include "EditingText.h" - -#include "Document.h" - -// FIXME: Does this really require a class? Perhaps instead any text node -// inside an editable element could have the "always create a renderer" behavior. +#include "QWebUndoCommand.h" -namespace WebCore { +#include "UndoStepQt.h" -inline EditingText::EditingText(Document* document, const String& data) - : Text(document, data) +#ifndef QT_NO_UNDOCOMMAND +QWebUndoCommand::QWebUndoCommand(QSharedPointer<UndoStepQt> undoStep, QUndoCommand* parent) + : QUndoCommand(parent) + , m_step(undoStep) { + Q_ASSERT(undoStep); + setText(m_step->text()); } -PassRefPtr<EditingText> EditingText::create(Document* document, const String& data) +void QWebUndoCommand::undo() { - return adoptRef(new EditingText(document, data)); + m_step->undo(); } -bool EditingText::rendererIsNeeded(const NodeRenderingContext&) +void QWebUndoCommand::redo() { - return true; + m_step->redo(); } -} // namespace WebCore +#endif // QT_NO_UNDOCOMMAND diff --git a/Source/WebCore/dom/EditingText.h b/Source/WebKit/qt/WebCoreSupport/QWebUndoCommand.h index 6536c7b38..6e6121adc 100644 --- a/Source/WebCore/dom/EditingText.h +++ b/Source/WebKit/qt/WebCoreSupport/QWebUndoCommand.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2012 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 @@ -17,24 +17,27 @@ * Boston, MA 02110-1301, USA. * */ +#ifndef QWebUndoCommand_h +#define QWebUndoCommand_h -#ifndef EditingText_h -#define EditingText_h +#include <qsharedpointer.h> +#include <qundostack.h> -#include "Text.h" +class UndoStepQt; -namespace WebCore { +#ifndef QT_NO_UNDOCOMMAND -class EditingText : public Text { +class QWebUndoCommand : public QUndoCommand { public: - static PassRefPtr<EditingText> create(Document*, const String&); + QWebUndoCommand(QSharedPointer<UndoStepQt>, QUndoCommand *parent = 0); -private: - virtual bool rendererIsNeeded(const NodeRenderingContext&); + void undo(); + void redo(); - EditingText(Document*, const String&); +private: + QSharedPointer<UndoStepQt> m_step; }; -} // namespace WebCore +#endif // QT_NO_UNDOCOMMAND -#endif // EditingText_h +#endif // QWebUndoCommand_h diff --git a/Source/WebKit/qt/WebCoreSupport/QWidgetPluginImpl.cpp b/Source/WebKit/qt/WebCoreSupport/QWidgetPluginImpl.cpp new file mode 100644 index 000000000..2beabf1d0 --- /dev/null +++ b/Source/WebKit/qt/WebCoreSupport/QWidgetPluginImpl.cpp @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2012 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 + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include "config.h" +#include "QWidgetPluginImpl.h" + +#include <QWidget> + +QWidgetPluginImpl::~QWidgetPluginImpl() +{ + m_widget->deleteLater(); +} + +void QWidgetPluginImpl::update(const QRect &rect) +{ + m_widget->update(rect); +} + +void QWidgetPluginImpl::setGeometryAndClip(const QRect &geometry, const QRect &clipRect, bool isVisible) +{ + m_widget->setGeometry(geometry); + if (!clipRect.isNull()) { + QRect clip(clipRect.intersected(m_widget->rect())); + m_widget->setMask(QRegion(clip)); + } + m_widget->update(); + setVisible(isVisible); +} + +void QWidgetPluginImpl::setVisible(bool visible) +{ + // If setMask is set with an empty QRegion, no clipping will + // be performed, so in that case we hide the platformWidget. + QRegion mask = m_widget->mask(); + m_widget->setVisible(visible && !mask.isEmpty()); +} + +void QWidgetPluginImpl::setStyleSheet(const QString &stylesheet) +{ + m_widget->setStyleSheet(stylesheet); +} + +void QWidgetPluginImpl::setWidgetParent(QObject *parent) +{ + if (!parent->isWidgetType()) + return; + m_widget->setParent(qobject_cast<QWidget*>(parent)); +} + +QObject* QWidgetPluginImpl::handle() const +{ + return m_widget; +} + +#include "moc_QWidgetPluginImpl.cpp" diff --git a/Source/WebKit/qt/WebCoreSupport/QWidgetPluginImpl.h b/Source/WebKit/qt/WebCoreSupport/QWidgetPluginImpl.h new file mode 100644 index 000000000..7459b7eff --- /dev/null +++ b/Source/WebKit/qt/WebCoreSupport/QWidgetPluginImpl.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2012 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 + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ +#ifndef QWidgetPluginImpl_h +#define QWidgetPluginImpl_h + +#include "QtPluginWidgetAdapter.h" + +QT_BEGIN_NAMESPACE +class QWidget; +QT_END_NAMESPACE + +class QWidgetPluginImpl : public QtPluginWidgetAdapter { + Q_OBJECT +public: + QWidgetPluginImpl(QWidget *w) : m_widget(w) { } + virtual ~QWidgetPluginImpl(); + virtual void update(const QRect &) OVERRIDE; + virtual void setGeometryAndClip(const QRect&, const QRect&, bool isVisible) OVERRIDE; + virtual void setVisible(bool) OVERRIDE; + virtual void setStyleSheet(const QString&) OVERRIDE; + virtual void setWidgetParent(QObject *) OVERRIDE; + virtual QObject* handle() const OVERRIDE; +private: + QWidget *m_widget; +}; + +#endif // QWidgetPluginImpl_h diff --git a/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp b/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp index cdc6ee0c9..b2fbf624a 100644 --- a/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp +++ b/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp @@ -23,18 +23,18 @@ #ifndef QT_NO_COMBOBOX -#include "ChromeClientQt.h" -#include "QtWebComboBox.h" +#include "QWebPageAdapter.h" #include "QWebPageClient.h" +#include "QtWebComboBox.h" #include "qgraphicswebview.h" #include <QGraphicsProxyWidget> #include <QtGui/QStandardItemModel> namespace WebCore { -QtFallbackWebPopup::QtFallbackWebPopup(const ChromeClientQt* chromeClient) +QtFallbackWebPopup::QtFallbackWebPopup(const QWebPageAdapter* page) : m_combo(0) - , m_chromeClient(chromeClient) + , m_page(page) { } @@ -63,9 +63,8 @@ void QtFallbackWebPopup::show(const QWebSelectData& data) proxy->setWidget(m_combo); proxy->setGeometry(rect); } else { - m_combo->setParent(pageClient()->ownerWidget()); - m_combo->setGeometry(QRect(rect.left(), rect.top(), - rect.width(), m_combo->sizeHint().height())); + m_combo->setParent(qobject_cast<QWidget*>(pageClient()->ownerWidget())); + m_combo->setGeometry(QRect(rect.left(), rect.top(), rect.width(), m_combo->sizeHint().height())); } m_combo->showPopupAtCursorPosition(); @@ -131,7 +130,7 @@ void QtFallbackWebPopup::deleteComboBox() QWebPageClient* QtFallbackWebPopup::pageClient() const { - return m_chromeClient->platformPageClient(); + return m_page->client.data(); } } diff --git a/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h b/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h index f753373be..69b49bdbf 100644 --- a/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h +++ b/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h @@ -23,8 +23,6 @@ #include "qwebkitplatformplugin.h" #include <wtf/Platform.h> -#include <QComboBox> - #ifndef QT_NO_COMBOBOX QT_BEGIN_NAMESPACE @@ -32,16 +30,16 @@ class QGraphicsProxyWidget; QT_END_NAMESPACE class QWebPageClient; +class QWebPageAdapter; namespace WebCore { -class ChromeClientQt; class QtWebComboBox; class QtFallbackWebPopup : public QWebSelectMethod { Q_OBJECT public: - QtFallbackWebPopup(const ChromeClientQt*); + QtFallbackWebPopup(const QWebPageAdapter*); ~QtFallbackWebPopup(); virtual void show(const QWebSelectData&); @@ -59,7 +57,7 @@ private Q_SLOTS: private: QtWebComboBox* m_combo; - const ChromeClientQt* m_chromeClient; + const QWebPageAdapter* m_page; QRect m_geometry; QFont m_font; diff --git a/Source/WebKit/qt/WebCoreSupport/QtPluginWidgetAdapter.h b/Source/WebKit/qt/WebCoreSupport/QtPluginWidgetAdapter.h new file mode 100644 index 000000000..8494d3db2 --- /dev/null +++ b/Source/WebKit/qt/WebCoreSupport/QtPluginWidgetAdapter.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2012 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 + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ +#ifndef QtPluginWidgetAdapter_h +#define QtPluginWidgetAdapter_h + +#include <QObject> +#include <QRect> +#include <QString> + +class QtPluginWidgetAdapter : public QObject { + Q_OBJECT +public: + virtual void update(const QRect&) = 0; + virtual void setGeometryAndClip(const QRect&, const QRect&, bool isVisible = false) = 0; + virtual void setVisible(bool) = 0; + virtual void setStyleSheet(const QString&) = 0; + virtual void setWidgetParent(QObject*) = 0; + virtual QObject* handle() const = 0; +}; + +#endif // QtPluginWidgetAdapter_h diff --git a/Source/WebKit/qt/WebCoreSupport/QtWebComboBox.cpp b/Source/WebKit/qt/WebCoreSupport/QtWebComboBox.cpp index f52465f0d..2c22cd476 100644 --- a/Source/WebKit/qt/WebCoreSupport/QtWebComboBox.cpp +++ b/Source/WebKit/qt/WebCoreSupport/QtWebComboBox.cpp @@ -41,8 +41,7 @@ QtWebComboBox::QtWebComboBox() void QtWebComboBox::showPopupAtCursorPosition() { - QMouseEvent event(QEvent::MouseButtonPress, QCursor::pos(), Qt::LeftButton, - Qt::LeftButton, Qt::NoModifier); + QMouseEvent event(QEvent::MouseButtonPress, QCursor::pos(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); QCoreApplication::sendEvent(this, &event); } diff --git a/Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h b/Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h index 426475766..e32427edf 100644 --- a/Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h +++ b/Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h @@ -21,9 +21,8 @@ #ifndef QtWebComboBox_h #define QtWebComboBox_h -#include <wtf/Platform.h> - #include <QComboBox> +#include <wtf/Platform.h> #ifndef QT_NO_COMBOBOX diff --git a/Source/WebKit/qt/WebCoreSupport/SearchPopupMenuQt.h b/Source/WebKit/qt/WebCoreSupport/SearchPopupMenuQt.h index 11a964105..4ae8582a3 100644 --- a/Source/WebKit/qt/WebCoreSupport/SearchPopupMenuQt.h +++ b/Source/WebKit/qt/WebCoreSupport/SearchPopupMenuQt.h @@ -27,7 +27,7 @@ namespace WebCore { class SearchPopupMenuQt : public SearchPopupMenu { public: - SearchPopupMenuQt(PassRefPtr<PopupMenu> popup); + SearchPopupMenuQt(PassRefPtr<PopupMenu>); virtual PopupMenu* popupMenu(); virtual void saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems); diff --git a/Source/WebKit/qt/WebCoreSupport/UndoStepQt.cpp b/Source/WebKit/qt/WebCoreSupport/UndoStepQt.cpp index 15df2ee50..6e2d54f78 100644 --- a/Source/WebKit/qt/WebCoreSupport/UndoStepQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/UndoStepQt.cpp @@ -20,9 +20,10 @@ #include "config.h" #include "UndoStepQt.h" +#include <qobject.h> + using namespace WebCore; -#ifndef QT_NO_UNDOCOMMAND static QString undoNameForEditAction(const EditAction editAction) { switch (editAction) { @@ -106,26 +107,18 @@ static QString undoNameForEditAction(const EditAction editAction) return QString(); } -UndoStepQt::UndoStepQt(WTF::RefPtr<UndoStep> step, QUndoCommand *parent) - : QUndoCommand(parent) - , m_step(step) - , m_first(true) -{ - setText(undoNameForEditAction(step->editingAction())); -} -#else UndoStepQt::UndoStepQt(WTF::RefPtr<UndoStep> step) : m_step(step) , m_first(true) { + m_text = undoNameForEditAction(step->editingAction()); } -#endif + UndoStepQt::~UndoStepQt() { } - void UndoStepQt::redo() { if (m_first) { @@ -143,5 +136,9 @@ void UndoStepQt::undo() m_step->unapply(); } +QString UndoStepQt::text() const +{ + return m_text; +} // vim: ts=4 sw=4 et diff --git a/Source/WebKit/qt/WebCoreSupport/UndoStepQt.h b/Source/WebKit/qt/WebCoreSupport/UndoStepQt.h index 3c143403a..85d7991c3 100644 --- a/Source/WebKit/qt/WebCoreSupport/UndoStepQt.h +++ b/Source/WebKit/qt/WebCoreSupport/UndoStepQt.h @@ -20,29 +20,24 @@ #ifndef UndoStepQt_h #define UndoStepQt_h -#include <QUndoCommand> #include <UndoStep.h> + +#include <qstring.h> #include <wtf/RefPtr.h> -class UndoStepQt -#ifndef QT_NO_UNDOCOMMAND - : public QUndoCommand -#endif -{ +class UndoStepQt { public: -#ifndef QT_NO_UNDOCOMMAND - UndoStepQt(WTF::RefPtr<WebCore::UndoStep> step, QUndoCommand *parent = 0); -#else - UndoStepQt(WTF::RefPtr<WebCore::UndoStep> step); -#endif + UndoStepQt(WTF::RefPtr<WebCore::UndoStep>); ~UndoStepQt(); void redo(); void undo(); + QString text() const; private: WTF::RefPtr<WebCore::UndoStep> m_step; bool m_first; + QString m_text; }; #endif diff --git a/Source/WebKit/qt/WebCoreSupport/WebEventConversion.cpp b/Source/WebKit/qt/WebCoreSupport/WebEventConversion.cpp index d6159241e..4449c1557 100644 --- a/Source/WebKit/qt/WebCoreSupport/WebEventConversion.cpp +++ b/Source/WebKit/qt/WebCoreSupport/WebEventConversion.cpp @@ -27,13 +27,8 @@ #include "PlatformTouchEvent.h" #include "PlatformTouchPoint.h" #include "PlatformWheelEvent.h" -#include <QApplication> -#include <QGesture> -#include <QGestureEvent> -#include <QGraphicsSceneMouseEvent> #include <QTouchEvent> #include <QWheelEvent> -#include <QWidget> #include <wtf/CurrentTime.h> namespace WebCore { @@ -53,54 +48,28 @@ static void mouseEventModifiersFromQtKeyboardModifiers(Qt::KeyboardModifiers key static void mouseEventTypeAndMouseButtonFromQEvent(const QEvent* event, PlatformEvent::Type& mouseEventType, MouseButton& mouseButton) { - enum { MouseEvent, GraphicsSceneMouseEvent } frameworkMouseEventType; switch (event->type()) { case QEvent::MouseButtonDblClick: case QEvent::MouseButtonPress: - frameworkMouseEventType = MouseEvent; mouseEventType = PlatformEvent::MousePressed; break; case QEvent::MouseButtonRelease: - frameworkMouseEventType = MouseEvent; mouseEventType = PlatformEvent::MouseReleased; break; case QEvent::MouseMove: - frameworkMouseEventType = MouseEvent; - mouseEventType = PlatformEvent::MouseMoved; - break; - case QEvent::GraphicsSceneMouseDoubleClick: - case QEvent::GraphicsSceneMousePress: - frameworkMouseEventType = GraphicsSceneMouseEvent; - mouseEventType = PlatformEvent::MousePressed; - break; - case QEvent::GraphicsSceneMouseRelease: - frameworkMouseEventType = GraphicsSceneMouseEvent; - mouseEventType = PlatformEvent::MouseReleased; - break; - case QEvent::GraphicsSceneMouseMove: - frameworkMouseEventType = GraphicsSceneMouseEvent; mouseEventType = PlatformEvent::MouseMoved; break; default: ASSERT_NOT_REACHED(); - frameworkMouseEventType = MouseEvent; mouseEventType = PlatformEvent::MouseMoved; break; } Qt::MouseButtons mouseButtons; - switch (frameworkMouseEventType) { - case MouseEvent: { - const QMouseEvent* mouseEvent = static_cast<const QMouseEvent*>(event); - mouseButtons = mouseEventType == PlatformEvent::MouseMoved ? mouseEvent->buttons() : mouseEvent->button(); - break; - } - case GraphicsSceneMouseEvent: { - const QGraphicsSceneMouseEvent* mouseEvent = static_cast<const QGraphicsSceneMouseEvent*>(event); - mouseButtons = mouseEventType == PlatformEvent::MouseMoved ? mouseEvent->buttons() : mouseEvent->button(); - break; - } - } + + const QMouseEvent* mouseEvent = static_cast<const QMouseEvent*>(event); + mouseButtons = mouseEventType == PlatformEvent::MouseMoved ? mouseEvent->buttons() : mouseEvent->button(); + if (mouseButtons & Qt::LeftButton) mouseButton = LeftButton; @@ -114,27 +83,9 @@ static void mouseEventTypeAndMouseButtonFromQEvent(const QEvent* event, Platform class WebKitPlatformMouseEvent : public PlatformMouseEvent { public: - WebKitPlatformMouseEvent(QGraphicsSceneMouseEvent*, int clickCount); WebKitPlatformMouseEvent(QInputEvent*, int clickCount); }; -WebKitPlatformMouseEvent::WebKitPlatformMouseEvent(QGraphicsSceneMouseEvent* event, int clickCount) -{ - m_timestamp = WTF::currentTime(); - - // FIXME: Why don't we handle a context menu event here as we do in PlatformMouseEvent(QInputEvent*, int)? - // See <https://bugs.webkit.org/show_bug.cgi?id=60728>. - PlatformEvent::Type type; - mouseEventTypeAndMouseButtonFromQEvent(event, type, m_button); - - m_type = type; - m_position = IntPoint(event->pos().toPoint()); - m_globalPosition = IntPoint(event->screenPos()); - - m_clickCount = clickCount; - mouseEventModifiersFromQtKeyboardModifiers(event->modifiers(), m_modifiers); -} - WebKitPlatformMouseEvent::WebKitPlatformMouseEvent(QInputEvent* event, int clickCount) { m_timestamp = WTF::currentTime(); @@ -169,21 +120,15 @@ PlatformMouseEvent convertMouseEvent(QInputEvent* event, int clickCount) return WebKitPlatformMouseEvent(event, clickCount); } -PlatformMouseEvent convertMouseEvent(QGraphicsSceneMouseEvent* event, int clickCount) -{ - return WebKitPlatformMouseEvent(event, clickCount); -} - class WebKitPlatformWheelEvent : public PlatformWheelEvent { public: - WebKitPlatformWheelEvent(QGraphicsSceneWheelEvent*); - WebKitPlatformWheelEvent(QWheelEvent*); + WebKitPlatformWheelEvent(QWheelEvent*, int wheelScrollLines); private: - void applyDelta(int delta, Qt::Orientation); + void applyDelta(int delta, Qt::Orientation, int wheelScrollLines); }; -void WebKitPlatformWheelEvent::applyDelta(int delta, Qt::Orientation orientation) +void WebKitPlatformWheelEvent::applyDelta(int delta, Qt::Orientation orientation, int wheelScrollLines) { if (orientation == Qt::Horizontal) { m_deltaX = delta; @@ -198,22 +143,11 @@ void WebKitPlatformWheelEvent::applyDelta(int delta, Qt::Orientation orientation // Since we request the scroll delta by the pixel, convert the wheel delta to pixel delta using the standard scroll step. // Use the same single scroll step as QTextEdit (in QTextEditPrivate::init [h,v]bar->setSingleStep) static const float cDefaultQtScrollStep = 20.f; - m_deltaX = m_wheelTicksX * QApplication::wheelScrollLines() * cDefaultQtScrollStep; - m_deltaY = m_wheelTicksY * QApplication::wheelScrollLines() * cDefaultQtScrollStep; + m_deltaX = m_wheelTicksX * wheelScrollLines * cDefaultQtScrollStep; + m_deltaY = m_wheelTicksY * wheelScrollLines * cDefaultQtScrollStep; } -WebKitPlatformWheelEvent::WebKitPlatformWheelEvent(QGraphicsSceneWheelEvent* e) -{ - m_timestamp = WTF::currentTime(); - mouseEventModifiersFromQtKeyboardModifiers(e->modifiers(), m_modifiers); - m_position = e->pos().toPoint(); - m_globalPosition = e->screenPos(); - m_granularity = ScrollByPixelWheelEvent; - m_directionInvertedFromDevice = false; - applyDelta(e->delta(), e->orientation()); -} - -WebKitPlatformWheelEvent::WebKitPlatformWheelEvent(QWheelEvent* e) +WebKitPlatformWheelEvent::WebKitPlatformWheelEvent(QWheelEvent* e, int wheelScrollLines) { m_timestamp = WTF::currentTime(); mouseEventModifiersFromQtKeyboardModifiers(e->modifiers(), m_modifiers); @@ -221,7 +155,7 @@ WebKitPlatformWheelEvent::WebKitPlatformWheelEvent(QWheelEvent* e) m_globalPosition = e->globalPos(); m_granularity = ScrollByPixelWheelEvent; m_directionInvertedFromDevice = false; - applyDelta(e->delta(), e->orientation()); + applyDelta(e->delta(), e->orientation(), wheelScrollLines); } #if ENABLE(TOUCH_EVENTS) @@ -309,43 +243,35 @@ WebKitPlatformTouchPoint::WebKitPlatformTouchPoint(const QTouchEvent::TouchPoint #if ENABLE(GESTURE_EVENTS) class WebKitPlatformGestureEvent : public PlatformGestureEvent { public: - WebKitPlatformGestureEvent(const QGestureEvent*, const QGesture*); + WebKitPlatformGestureEvent(QGestureEventFacade*); }; -WebKitPlatformGestureEvent::WebKitPlatformGestureEvent(const QGestureEvent* event, const QGesture* gesture) +static inline PlatformEvent::Type toPlatformEventType(Qt::GestureType type) { - switch (gesture->gestureType()) { - case Qt::TapGesture: { - m_type = PlatformEvent::GestureTap; - QPointF globalPos = static_cast<const QTapGesture*>(gesture)->position(); - m_globalPosition = globalPos.toPoint(); - m_position = event->widget()->mapFromGlobal(globalPos.toPoint()); - break; - } - case Qt::TapAndHoldGesture: { - m_type = PlatformEvent::GestureLongPress; - QPointF globalPos = static_cast<const QTapAndHoldGesture*>(gesture)->position(); - m_globalPosition = globalPos.toPoint(); - m_position = event->widget()->mapFromGlobal(globalPos.toPoint()); - break; - } + switch (type) { + case Qt::TapGesture: + return PlatformEvent::GestureTap; + case Qt::TapAndHoldGesture: + return PlatformEvent::GestureLongPress; default: ASSERT_NOT_REACHED(); - break; + return PlatformEvent::NoType; } - m_timestamp = WTF::currentTime(); } -#endif - -PlatformWheelEvent convertWheelEvent(QWheelEvent* event) +WebKitPlatformGestureEvent::WebKitPlatformGestureEvent(QGestureEventFacade* event) { - return WebKitPlatformWheelEvent(event); + m_type = toPlatformEventType(event->type); + m_globalPosition = event->globalPos; + m_position = event->pos; + m_timestamp = WTF::currentTime(); } -PlatformWheelEvent convertWheelEvent(QGraphicsSceneWheelEvent* event) +#endif + +PlatformWheelEvent convertWheelEvent(QWheelEvent* event, int wheelScrollLines) { - return WebKitPlatformWheelEvent(event); + return WebKitPlatformWheelEvent(event, wheelScrollLines); } #if ENABLE(TOUCH_EVENTS) @@ -356,10 +282,9 @@ PlatformTouchEvent convertTouchEvent(QTouchEvent* event) #endif #if ENABLE(GESTURE_EVENTS) -PlatformGestureEvent convertGesture(QGestureEvent* event, QGesture* gesture) +PlatformGestureEvent convertGesture(QGestureEventFacade* event) { - return WebKitPlatformGestureEvent(event, gesture); + return WebKitPlatformGestureEvent(event); } #endif - } diff --git a/Source/WebKit/qt/WebCoreSupport/WebEventConversion.h b/Source/WebKit/qt/WebCoreSupport/WebEventConversion.h index 3224eee90..0cf8cd849 100644 --- a/Source/WebKit/qt/WebCoreSupport/WebEventConversion.h +++ b/Source/WebKit/qt/WebCoreSupport/WebEventConversion.h @@ -19,27 +19,30 @@ Boston, MA 02110-1301, USA. */ -#include <qglobal.h> +#ifndef WebEventConversion_h +#define WebEventConversion_h + +#include <QPoint> QT_BEGIN_NAMESPACE class QInputEvent; -class QGraphicsSceneMouseEvent; class QWheelEvent; -class QGraphicsSceneWheelEvent; class QTouchEvent; -class QGesture; -class QGestureEvent; QT_END_NAMESPACE +struct QGestureEventFacade { + Qt::GestureType type; + QPoint globalPos; + QPoint pos; +}; + namespace WebCore { class PlatformMouseEvent; class PlatformWheelEvent; PlatformMouseEvent convertMouseEvent(QInputEvent*, int clickCount); -PlatformMouseEvent convertMouseEvent(QGraphicsSceneMouseEvent*, int clickCount); -PlatformWheelEvent convertWheelEvent(QWheelEvent*); -PlatformWheelEvent convertWheelEvent(QGraphicsSceneWheelEvent*); +PlatformWheelEvent convertWheelEvent(QWheelEvent*, int wheelScrollLines); #if ENABLE(TOUCH_EVENTS) class PlatformTouchEvent; @@ -48,6 +51,8 @@ PlatformTouchEvent convertTouchEvent(QTouchEvent*); #if ENABLE(GESTURE_EVENTS) class PlatformGestureEvent; -PlatformGestureEvent convertGesture(QGestureEvent*, QGesture*); +PlatformGestureEvent convertGesture(QGestureEventFacade*); #endif } + +#endif diff --git a/Source/WebKit/qt/WebCoreSupport/WebSystemInterface.h b/Source/WebKit/qt/WebCoreSupport/WebSystemInterface.h index 467b5ba37..9b03d4afc 100644 --- a/Source/WebKit/qt/WebCoreSupport/WebSystemInterface.h +++ b/Source/WebKit/qt/WebCoreSupport/WebSystemInterface.h @@ -26,6 +26,11 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#ifndef WebSystemInterface_h +#define WebSystemInterface_h + #include <stdint.h> void InitWebCoreSystemInterface(); + +#endif diff --git a/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index ff40b55f0..9f51f3f01 100644 --- a/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -27,6 +27,7 @@ #include <QLineEdit> #include <QMainWindow> #include <QMenu> +#include <QMimeDatabase> #include <QPushButton> #include <QStateMachine> #include <QStyle> @@ -281,10 +282,11 @@ public: JSTestPage(QObject* parent = 0) : QWebPage(parent) {} -public Q_SLOTS: - bool shouldInterruptJavaScript() { + virtual bool shouldInterruptJavaScript() + { return true; } +public Q_SLOTS: void requestPermission(QWebFrame* frame, QWebPage::Feature feature) { if (m_allowGeolocation) @@ -548,7 +550,7 @@ void tst_QWebPage::loadHtml5Video() QByteArray url("http://does.not/exist?a=1%2Cb=2"); m_view->setHtml("<p><video id ='video' src='" + url + "' autoplay/></p>"); QTest::qWait(2000); - QUrl mUrl = DumpRenderTreeSupportQt::mediaContentUrlByElementId(m_page->mainFrame(), "video"); + QUrl mUrl = DumpRenderTreeSupportQt::mediaContentUrlByElementId(m_page->mainFrame()->handle(), "video"); QEXPECT_FAIL("", "https://bugs.webkit.org/show_bug.cgi?id=65452", Continue); QCOMPARE(mUrl.toEncoded(), url); #else @@ -1026,12 +1028,12 @@ void tst_QWebPage::multiplePageGroupsAndLocalStorage() view1.page()->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true); view1.page()->settings()->setLocalStoragePath(QDir::toNativeSeparators(tmpDirPath() + "/path1")); - DumpRenderTreeSupportQt::webPageSetGroupName(view1.page(), "group1"); + DumpRenderTreeSupportQt::webPageSetGroupName(view1.page()->handle(), "group1"); view2.page()->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true); view2.page()->settings()->setLocalStoragePath(QDir::toNativeSeparators(tmpDirPath() + "/path2")); - DumpRenderTreeSupportQt::webPageSetGroupName(view2.page(), "group2"); - QCOMPARE(DumpRenderTreeSupportQt::webPageGroupName(view1.page()), QString("group1")); - QCOMPARE(DumpRenderTreeSupportQt::webPageGroupName(view2.page()), QString("group2")); + DumpRenderTreeSupportQt::webPageSetGroupName(view2.page()->handle(), "group2"); + QCOMPARE(DumpRenderTreeSupportQt::webPageGroupName(view1.page()->handle()), QString("group1")); + QCOMPARE(DumpRenderTreeSupportQt::webPageGroupName(view2.page()->handle()), QString("group2")); view1.setHtml(QString("<html><body> </body></html>"), QUrl("http://www.myexample.com")); @@ -2968,79 +2970,43 @@ void tst_QWebPage::findText() } } -struct ImageExtensionMap { - const char* extension; - const char* mimeType; -}; - -static const ImageExtensionMap extensionMap[] = { - { "bmp", "image/bmp" }, - { "css", "text/css" }, - { "gif", "image/gif" }, - { "html", "text/html" }, - { "htm", "text/html" }, - { "ico", "image/x-icon" }, - { "jpeg", "image/jpeg" }, - { "jpg", "image/jpeg" }, - { "js", "application/x-javascript" }, - { "mng", "video/x-mng" }, - { "pbm", "image/x-portable-bitmap" }, - { "pgm", "image/x-portable-graymap" }, - { "pdf", "application/pdf" }, - { "png", "image/png" }, - { "ppm", "image/x-portable-pixmap" }, - { "rss", "application/rss+xml" }, - { "svg", "image/svg+xml" }, - { "text", "text/plain" }, - { "tif", "image/tiff" }, - { "tiff", "image/tiff" }, - { "txt", "text/plain" }, - { "xbm", "image/x-xbitmap" }, - { "xml", "text/xml" }, - { "xpm", "image/x-xpm" }, - { "xsl", "text/xsl" }, - { "xhtml", "application/xhtml+xml" }, - { "wml", "text/vnd.wap.wml" }, - { "wmlc", "application/vnd.wap.wmlc" }, - { 0, 0 } -}; - static QString getMimeTypeForExtension(const QString &ext) { - const ImageExtensionMap *e = extensionMap; - while (e->extension) { - if (ext.compare(QLatin1String(e->extension), Qt::CaseInsensitive) == 0) - return QLatin1String(e->mimeType); - ++e; - } + QMimeType mimeType = QMimeDatabase().mimeTypeForFile(QStringLiteral("filename.") + ext.toLower(), QMimeDatabase::MatchExtension); + if (mimeType.isValid() && !mimeType.isDefault()) + return mimeType.name(); return QString(); } void tst_QWebPage::supportedContentType() { - QStringList contentTypes; + QStringList contentTypes; - // Add supported non image types... - contentTypes << "text/html" << "text/xml" << "text/xsl" << "text/plain" << "text/" - << "application/xml" << "application/xhtml+xml" << "application/vnd.wap.xhtml+xml" - << "application/rss+xml" << "application/atom+xml" << "application/json"; + // Add supported non image types... + contentTypes << "text/html" << "text/xml" << "text/xsl" << "text/plain" << "text/" + << "application/xml" << "application/xhtml+xml" << "application/vnd.wap.xhtml+xml" + << "application/rss+xml" << "application/atom+xml" << "application/json"; - // Add supported image types... - Q_FOREACH(const QByteArray& imageType, QImageWriter::supportedImageFormats()) { - const QString mimeType = getMimeTypeForExtension(imageType); - if (!mimeType.isEmpty()) - contentTypes << mimeType; - } +#if ENABLE_MHTML + contentTypes << "application/x-mimearchive"; +#endif + + // Add supported image types... + Q_FOREACH(const QByteArray& imageType, QImageWriter::supportedImageFormats()) { + const QString mimeType = getMimeTypeForExtension(imageType); + if (!mimeType.isEmpty()) + contentTypes << mimeType; + } - // Get the mime types supported by webkit... - const QStringList supportedContentTypes = m_page->supportedContentTypes(); + // Get the mime types supported by webkit... + const QStringList supportedContentTypes = m_page->supportedContentTypes(); - Q_FOREACH(const QString& mimeType, contentTypes) - QVERIFY2(supportedContentTypes.contains(mimeType), QString("'%1' is not a supported content type!").arg(mimeType).toLatin1()); + Q_FOREACH(const QString& mimeType, contentTypes) + QVERIFY2(supportedContentTypes.contains(mimeType), QString("'%1' is not a supported content type!").arg(mimeType).toLatin1()); - Q_FOREACH(const QString& mimeType, contentTypes) - QVERIFY2(m_page->supportsContentType(mimeType), QString("Cannot handle content types '%1'!").arg(mimeType).toLatin1()); + Q_FOREACH(const QString& mimeType, contentTypes) + QVERIFY2(m_page->supportsContentType(mimeType), QString("Cannot handle content types '%1'!").arg(mimeType).toLatin1()); } @@ -3062,35 +3028,35 @@ void tst_QWebPage::thirdPartyCookiePolicy() QVERIFY(m_page->networkAccessManager()->cookieJar()); // These are all first-party cookies, so should pass. - QVERIFY(DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page, + QVERIFY(DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page->handle(), QUrl("http://www.example.com"), QUrl("http://example.com"))); - QVERIFY(DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page, + QVERIFY(DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page->handle(), QUrl("http://www.example.com"), QUrl("http://doc.example.com"))); - QVERIFY(DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page, + QVERIFY(DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page->handle(), QUrl("http://aaa.www.example.com"), QUrl("http://doc.example.com"))); - QVERIFY(DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page, + QVERIFY(DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page->handle(), QUrl("http://example.com"), QUrl("http://www.example.com"))); - QVERIFY(DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page, + QVERIFY(DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page->handle(), QUrl("http://www.example.co.uk"), QUrl("http://example.co.uk"))); - QVERIFY(DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page, + QVERIFY(DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page->handle(), QUrl("http://www.example.co.uk"), QUrl("http://doc.example.co.uk"))); - QVERIFY(DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page, + QVERIFY(DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page->handle(), QUrl("http://aaa.www.example.co.uk"), QUrl("http://doc.example.co.uk"))); - QVERIFY(DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page, + QVERIFY(DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page->handle(), QUrl("http://example.co.uk"), QUrl("http://www.example.co.uk"))); // These are all third-party cookies, so should fail. - QVERIFY(!DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page, + QVERIFY(!DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page->handle(), QUrl("http://www.example.com"), QUrl("http://slashdot.org"))); - QVERIFY(!DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page, + QVERIFY(!DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page->handle(), QUrl("http://example.com"), QUrl("http://anotherexample.com"))); - QVERIFY(!DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page, + QVERIFY(!DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page->handle(), QUrl("http://anotherexample.com"), QUrl("http://example.com"))); - QVERIFY(!DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page, + QVERIFY(!DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page->handle(), QUrl("http://www.example.co.uk"), QUrl("http://slashdot.co.uk"))); - QVERIFY(!DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page, + QVERIFY(!DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page->handle(), QUrl("http://example.co.uk"), QUrl("http://anotherexample.co.uk"))); - QVERIFY(!DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page, + QVERIFY(!DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page->handle(), QUrl("http://anotherexample.co.uk"), QUrl("http://example.co.uk"))); } diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog index 987111132..576cd0538 100644 --- a/Source/WebKit2/ChangeLog +++ b/Source/WebKit2/ChangeLog @@ -1,3 +1,320 @@ +2012-11-23 Wojciech Bielawski <w.bielawski@samsung.com> + + [WK2][WKTR] WebKitTestRunner needs eventSender.contextClick() + https://bugs.webkit.org/show_bug.cgi?id=86881 + + Reviewed by Kenneth Rohde Christiansen. + + InjectedBundle API extended to retrieve contextMenu entries names. + WebContextMenu exteded with function to retrieve menu items. + This API is required by layout tests. + Common code in WebContextMenu.cpp moved to separate method menuItemsWithUserData(). + Behaviour of dependend methods is unchanged. + + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageGetContextMenuEntriesNames): + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/WebPage/WebContextMenu.cpp: + (WebKit::WebContextMenu::items): + (WebKit): + * WebProcess/WebPage/WebContextMenu.h: + (WebContextMenu): + +2012-11-22 Pierre Rossi <pierre.rossi@gmail.com> + + [Qt] Avoid initializing PlatformStrategies twice. + + Rubber-stamped by Simon Hausmann. + + This fixes another regression introduced in r135515: + initializeWebKitQt shouldn't implicitely call initializeWebCoreQt + since it can be called from WebKit2 to initialize QStyle for testing. + This would then lead to things such as PlatformStrategies being + initialized twice. + + * qt/MainQt.cpp: No need to initialize anything if we're not using QStyle. + (WebKit): + (main): + +2012-11-22 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Use custom private macros to define GObjects + https://bugs.webkit.org/show_bug.cgi?id=99705 + + Reviewed by Martin Robinson. + + Add WEBKIT_DEFINE_TYPE macros, similar and compatible with + G_DEFINE_TYPE macros, to define GObject types. These macros also + define the init and finalize functions reducing the GObject + boilerplate and hiding the placement new syntax that causes some + confusion. The patch replaces the use of G_DEFINE_TYPE macros by + WEBKIT_DEFINE_TYPE ones and removes the init and finalize + implementations, moving custom code when needed to the private + struct constructor/destructor or constructed/dispose virtual + methods when appropriate. + + * UIProcess/API/gtk/WebKitBackForwardList.cpp: + * UIProcess/API/gtk/WebKitBackForwardListItem.cpp: + (webkit_back_forward_list_item_class_init): + * UIProcess/API/gtk/WebKitContextMenu.cpp: + (webkitContextMenuDispose): + (webkit_context_menu_class_init): + * UIProcess/API/gtk/WebKitContextMenuItem.cpp: + (_WebKitContextMenuItemPrivate::~_WebKitContextMenuItemPrivate): + (_WebKitContextMenuItemPrivate): + (webkit_context_menu_item_class_init): + * UIProcess/API/gtk/WebKitCookieManager.cpp: + (_WebKitCookieManagerPrivate::~_WebKitCookieManagerPrivate): + (_WebKitCookieManagerPrivate): + * UIProcess/API/gtk/WebKitDownload.cpp: + (webkit_download_class_init): + * UIProcess/API/gtk/WebKitFaviconDatabase.cpp: + (webkit_favicon_database_class_init): + * UIProcess/API/gtk/WebKitFileChooserRequest.cpp: + (webkitFileChooserRequestDispose): + (webkit_file_chooser_request_class_init): + * UIProcess/API/gtk/WebKitFindController.cpp: + (webkit_find_controller_class_init): + * UIProcess/API/gtk/WebKitFormSubmissionRequest.cpp: + (webkitFormSubmissionRequestDispose): + (webkit_form_submission_request_class_init): + * UIProcess/API/gtk/WebKitGeolocationPermissionRequest.cpp: + (webkitGeolocationPermissionRequestDispose): + (webkit_geolocation_permission_request_class_init): + * UIProcess/API/gtk/WebKitHitTestResult.cpp: + (webkit_hit_test_result_class_init): + * UIProcess/API/gtk/WebKitNavigationPolicyDecision.cpp: + (webkit_navigation_policy_decision_class_init): + * UIProcess/API/gtk/WebKitPlugin.cpp: + (_WebKitPluginPrivate::~_WebKitPluginPrivate): + (_WebKitPluginPrivate): + (webkit_plugin_class_init): + * UIProcess/API/gtk/WebKitPolicyDecision.cpp: + (webkitPolicyDecisionDispose): + (webkit_policy_decision_class_init): + (webkit_policy_decision_use): + (webkit_policy_decision_ignore): + (webkit_policy_decision_download): + * UIProcess/API/gtk/WebKitPrintOperation.cpp: + (_WebKitPrintOperationPrivate::~_WebKitPrintOperationPrivate): + (_WebKitPrintOperationPrivate): + (webkit_print_operation_class_init): + * UIProcess/API/gtk/WebKitPrivate.h: + * UIProcess/API/gtk/WebKitResponsePolicyDecision.cpp: + (webkit_response_policy_decision_class_init): + * UIProcess/API/gtk/WebKitSecurityManager.cpp: + (webkit_security_manager_class_init): + * UIProcess/API/gtk/WebKitSettings.cpp: + (_WebKitSettingsPrivate::_WebKitSettingsPrivate): + (_WebKitSettingsPrivate): + (webkit_settings_class_init): + * UIProcess/API/gtk/WebKitURIRequest.cpp: + (webkit_uri_request_class_init): + * UIProcess/API/gtk/WebKitURIResponse.cpp: + (webkit_uri_response_class_init): + * UIProcess/API/gtk/WebKitURISchemeRequest.cpp: + (webkit_uri_scheme_request_class_init): + * UIProcess/API/gtk/WebKitWebContext.cpp: + * UIProcess/API/gtk/WebKitWebInspector.cpp: + (_WebKitWebInspectorPrivate::~_WebKitWebInspectorPrivate): + (_WebKitWebInspectorPrivate): + (webkit_web_inspector_class_init): + * UIProcess/API/gtk/WebKitWebResource.cpp: + (webkit_web_resource_class_init): + * UIProcess/API/gtk/WebKitWebView.cpp: + (_WebKitWebViewPrivate::~_WebKitWebViewPrivate): + (_WebKitWebViewPrivate): + (webkitWebViewConstructed): + (webkitWebViewDispose): + (webkit_web_view_class_init): + * UIProcess/API/gtk/WebKitWebViewBase.cpp: + (_WebKitWebViewBasePrivate::_WebKitWebViewBasePrivate): + (_WebKitWebViewBasePrivate): + (_WebKitWebViewBasePrivate::~_WebKitWebViewBasePrivate): + (webkitWebViewBaseDispose): + (webkitWebViewBaseConstructed): + (webkit_web_view_base_class_init): + * UIProcess/API/gtk/WebKitWebViewBaseAccessible.cpp: + (webkit_web_view_base_accessible_class_init): + * UIProcess/API/gtk/WebKitWindowProperties.cpp: + (webkit_window_properties_class_init): + +2012-11-22 KwangYong Choi <ky0.choi@samsung.com> + + [EFL][WK2] Buildfix when ENABLE_NETSCAPE_PLUGIN_API is disabled + https://bugs.webkit.org/show_bug.cgi?id=103044 + + Reviewed by Kentaro Hara. + + enum ProcessType has PluginProcess only if ENABLE(PLUGIN_PROCESS) is enabled. + So, guard PluginProcess with ENABLE(PLUGIN_PROCESS). + + * UIProcess/Launcher/efl/ProcessLauncherEfl.cpp: + (WebKit::ProcessLauncher::launchProcess): + +2012-09-26 Gustavo Noronha Silva <gns@gnome.org> + + [GTK] Split SVG from WebCore to work-around make limitation + https://bugs.webkit.org/show_bug.cgi?id=97735 + + Reviewed by Carlos Garcia Campos. + + Add a new libtool convenience library, libWebCoreSVG.la, to work-around + make limitation when linking libWebCore. + + * GNUmakefile.am: link libWebCoreSVG.la into libwebkit2gtk. + +2012-11-22 Simon Hausmann <simon.hausmann@digia.com>, Pierre Rossi <pierre.rossi@digia.com> + + [Qt] Separate QWidget dependant code into separate WebKitWidgets static library + https://bugs.webkit.org/show_bug.cgi?id=102800 + + Reviewed by Tor Arne Vestbø. + + This patch separates code that needs to use QWidget related APIs in + WebKit/qt/WebCoreSupport and Api from code that doesn't. This means for + example FrameLoaderClientQt.cpp remains in the WebKit1 static library, + while qwebpage.cpp and qwebframe.cpp become part of the WebKitWidgets + static library. WebKit1 is compiled without QT += widgets and therefore + any widget related dependency has been moved "up" and out of WebKit1 into + the WebKitWidgets library. + + Between the code in WebKit.a and WebKitWidgets.a new adapters and + interfaces have been introduced, such as QWebPageAdapter and + QWebFrameAdapter. QWebPageAdapter, when used from WebKit1, is a way to + call out into the API layer, implemented by QWebPage (QWebPagePrivate). + The other way around if QWebPage wants to access WebCore or + WebCoreSupport related functionality, it will go through + QWebPageAdapater (as base class). The separation in the direction up + into the API layer is complete with this patch, no code in WebKit1 + depends on QtWidgets. The separation the other way around, code in the + API layer not using any WebCore types, is not complete yet. + + Some classes such as QWebSettings, QWebElement or + DumpRenderTreeSupportQt remain in WebKit1. While they are API layer, + they do not depend on widget related Qt APIs and they make much more + use of WebCore internal APIs and therefore are easier to keep in + WebKit1. + + In the future we plan to place a real shared library boundary between + WebKit1 and WebKitWidgets, by keeping the WebKit1 static library as + part of the QtWebKit shared library and by turning the WebKitWidgets + static library into a shared one. + + * qt/MainQt.cpp: + (WebKit): + (main): + +2012-11-22 Kenneth Rohde Christiansen <kenneth@webkit.org> + + [WK2][EFL] No need to remove surface before replacing + https://bugs.webkit.org/show_bug.cgi?id=103055 + + Rubberstamped by Simon Hausmann. + + The surface is stored in a OwnPtr which automatically + frees the existing surface after replacing it with a new + one. For some reason, this also fixes resizing issues on + my Nvidia driver. + + * UIProcess/API/efl/EwkViewImpl.cpp: + (EwkViewImpl::createGLSurface): + * UIProcess/API/efl/EwkViewImpl.h: + * UIProcess/API/efl/ewk_view.cpp: + (_ewk_view_smart_calculate): + +2012-11-22 Christophe Dumez <christophe.dumez@intel.com> + + WebKitTestRunner needs layoutTestController.setCacheModel + https://bugs.webkit.org/show_bug.cgi?id=42684 + + Reviewed by Kenneth Rohde Christiansen. + + Add Bundle C API for WebKitTestRunner to set the + cache model. + + * WebProcess/InjectedBundle/API/c/WKBundle.cpp: + (WKBundleSetCacheModel): + * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h: + * WebProcess/InjectedBundle/InjectedBundle.cpp: + (WebKit::InjectedBundle::setCacheModel): + (WebKit): + * WebProcess/InjectedBundle/InjectedBundle.h: + (InjectedBundle): + * WebProcess/WebProcess.h: + (WebProcess): + +2012-11-22 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + REGRESSION(r135399): Wrong assertion causing an assertion failure: m_rawAttributes.initialScale > 0 + https://bugs.webkit.org/show_bug.cgi?id=102971 + + Reviewed by Kenneth Rohde Christiansen. + + m_rawAttributes.initialScale has to be initialized even if m_minimumScaleToFit hasn't changed + it's value. + + * UIProcess/PageViewportController.cpp: + (WebKit::PageViewportController::didChangeViewportAttributes): + +2012-11-22 Eunmi Lee <eunmi15.lee@samsung.com> + + [EFL][WK2] Correct the parameters of WebPlatformTouchPoint. + https://bugs.webkit.org/show_bug.cgi?id=102865 + + Reviewed by Kenneth Rohde Christiansen. + + Set the screen position as a third parameter and contents position as + a fourth parameter of WebPlatformTouchPoint(). + + * Shared/efl/WebEventFactory.cpp: + (WebKit::WebEventFactory::createWebTouchEvent): + +2012-11-22 Huang Dongsung <luxtella@company100.net> + + Coordinated Graphics: Remove an invisible TiledBackingStore of CoordinatedGraphicsLayer. + https://bugs.webkit.org/show_bug.cgi?id=102894 + + Reviewed by Kenneth Rohde Christiansen. + + CoordinatedGraphicsLayer does not need to have a backing store + if (!drawsContent() || !contentsAreVisible() || m_size.isEmpty()). + + * WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp: + (WebCore::CoordinatedGraphicsLayer::updateContentBuffers): + +2012-11-22 Huang Dongsung <luxtella@company100.net> + + Coordinated Graphics: refactor LayerTreeRenderer. + https://bugs.webkit.org/show_bug.cgi?id=103004 + + Reviewed by Noam Rosenthal. + + This patch changes two subjects. + 1. Add ASSERT(isMainThread()) in all methods that are called in the main thread. + In addition, make dispatchOnMainThread() use callOnMainThread(const Function<void()>& + function) instead of its own implementation. + + 2. Remove setAccelerationMode() because we don't use m_accelerationMode member + except for the setter. + + * UIProcess/API/efl/EwkViewImpl.cpp: + (EwkViewImpl::createGLSurface): + * UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp: + (WebKit): + (WebKit::LayerTreeRenderer::dispatchOnMainThread): + (WebKit::LayerTreeRenderer::LayerTreeRenderer): + (WebKit::LayerTreeRenderer::animationFrameReady): + (WebKit::LayerTreeRenderer::updateViewport): + (WebKit::LayerTreeRenderer::renderNextFrame): + (WebKit::LayerTreeRenderer::purgeGLResources): + (WebKit::LayerTreeRenderer::detach): + (WebKit::LayerTreeRenderer::setActive): + * UIProcess/CoordinatedGraphics/LayerTreeRenderer.h: + (LayerTreeRenderer): + * UIProcess/efl/PageClientBase.cpp: + (WebKit::PageClientBase::createDrawingAreaProxy): + 2012-11-21 Jinwoo Song <jinwoo7.song@samsung.com> [EFL][WK2] Use consistent class names in the clients diff --git a/Source/WebKit2/GNUmakefile.am b/Source/WebKit2/GNUmakefile.am index dfdd49d70..097cdc1fc 100644 --- a/Source/WebKit2/GNUmakefile.am +++ b/Source/WebKit2/GNUmakefile.am @@ -159,11 +159,18 @@ libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_LDF $(version_script) \ $(no_undefined) -libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_LIBADD = \ +libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_LIBADD := \ -lpthread \ libWebCore.la \ libWebCorePlatform.la \ - libWebCoreModules.la \ + libWebCoreModules.la + +if ENABLE_SVG +libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_LIBADD += \ + libWebCoreSVG.la +endif + +libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_LIBADD += \ libjavascriptcoregtk-@WEBKITGTK_API_MAJOR_VERSION@.@WEBKITGTK_API_MINOR_VERSION@.la \ libWebCoreGtk.la \ $(CAIRO_LIBS) \ @@ -533,7 +540,14 @@ Programs_WebKitPluginProcess_SOURCES = \ Programs_WebKitPluginProcess_LDADD = \ -lpthread \ libjavascriptcoregtk-@WEBKITGTK_API_MAJOR_VERSION@.@WEBKITGTK_API_MINOR_VERSION@.la \ - libWebCore.la \ + libWebCore.la + +#if ENABLE_SVG +Programs_WebKitPluginProcess_LDADD += \ + libWebCoreSVG.la +#endif + +Programs_WebKitPluginProcess_LDADD += \ libWebCorePlatform.la \ libWebCoreGtk2.la \ $(CAIRO_LIBS) \ diff --git a/Source/WebKit2/Shared/efl/WebEventFactory.cpp b/Source/WebKit2/Shared/efl/WebEventFactory.cpp index 042958714..b99925084 100644 --- a/Source/WebKit2/Shared/efl/WebEventFactory.cpp +++ b/Source/WebKit2/Shared/efl/WebEventFactory.cpp @@ -250,7 +250,7 @@ WebTouchEvent WebEventFactory::createWebTouchEvent(Ewk_Touch_Event_Type type, co } IntPoint pos(point->x, point->y); - touchPoints.append(WebPlatformTouchPoint(point->id, state, toWebContent.mapPoint(pos), toDeviceScreen.mapPoint(pos))); + touchPoints.append(WebPlatformTouchPoint(point->id, state, toDeviceScreen.mapPoint(pos), toWebContent.mapPoint(pos))); } return WebTouchEvent(typeForTouchEvent(type), touchPoints, modifiersForEvent(modifiers), timestamp); diff --git a/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp b/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp index 2e4462734..e0c59054d 100644 --- a/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp +++ b/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp @@ -617,7 +617,6 @@ bool EwkViewImpl::createGLSurface(const IntSize& viewSize) if (!m_evasGL) { WARN("Failed to create Evas_GL, falling back to software mode."); m_isHardwareAccelerated = false; - layerTreeRenderer()->setAccelerationMode(TextureMapper::SoftwareMode); #if ENABLE(WEBGL) m_pageProxy->pageGroup()->preferences()->setWebGLEnabled(false); #endif @@ -643,7 +642,7 @@ bool EwkViewImpl::createGLSurface(const IntSize& viewSize) EVAS_GL_MULTISAMPLE_NONE }; - ASSERT(!m_evasGLSurface); + // Replaces if non-null, and frees existing surface after (OwnPtr). m_evasGLSurface = EvasGLSurface::create(evasGL(), &evasGLConfig, viewSize); if (!m_evasGLSurface) return false; diff --git a/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h b/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h index 545c5ab68..379b57ebe 100644 --- a/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h +++ b/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h @@ -207,7 +207,6 @@ public: Evas_GL* evasGL() { return m_evasGL.get(); } Evas_GL_Context* evasGLContext() { return m_evasGLContext ? m_evasGLContext->context() : 0; } Evas_GL_Surface* evasGLSurface() { return m_evasGLSurface ? m_evasGLSurface->surface() : 0; } - void clearEvasGLSurface() { m_evasGLSurface.clear(); } #endif // FIXME: needs refactoring (split callback invoke) diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp index 42a8b1f29..d5d50ed0a 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp @@ -387,10 +387,6 @@ static void _ewk_view_smart_calculate(Evas_Object* ewkView) impl->page()->drawingArea()->setSize(IntSize(width, height), IntSize()); #if USE(ACCELERATED_COMPOSITING) - // Recreate surface if needed. - if (impl->evasGLSurface()) - impl->clearEvasGLSurface(); - if (width && height) impl->createGLSurface(IntSize(width, height)); #endif diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardList.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardList.cpp index 56eae4437..fbf302aa8 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardList.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardList.cpp @@ -63,27 +63,10 @@ struct _WebKitBackForwardListPrivate { static guint signals[LAST_SIGNAL] = { 0, }; -G_DEFINE_TYPE(WebKitBackForwardList, webkit_back_forward_list, G_TYPE_OBJECT) - -static void webkitBackForwardListFinalize(GObject* object) -{ - WEBKIT_BACK_FORWARD_LIST(object)->priv->~WebKitBackForwardListPrivate(); - G_OBJECT_CLASS(webkit_back_forward_list_parent_class)->finalize(object); -} - -static void webkit_back_forward_list_init(WebKitBackForwardList* list) -{ - WebKitBackForwardListPrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(list, WEBKIT_TYPE_BACK_FORWARD_LIST, WebKitBackForwardListPrivate); - list->priv = priv; - new (priv) WebKitBackForwardListPrivate(); -} +WEBKIT_DEFINE_TYPE(WebKitBackForwardList, webkit_back_forward_list, G_TYPE_OBJECT) static void webkit_back_forward_list_class_init(WebKitBackForwardListClass* listClass) { - GObjectClass* gObjectClass = G_OBJECT_CLASS(listClass); - - gObjectClass->finalize = webkitBackForwardListFinalize; - /** * WebKitBackForwardList::changed: * @back_forward_list: the #WebKitBackForwardList on which the signal was emitted @@ -105,8 +88,6 @@ static void webkit_back_forward_list_class_init(WebKitBackForwardListClass* list G_TYPE_NONE, 2, WEBKIT_TYPE_BACK_FORWARD_LIST_ITEM, G_TYPE_POINTER); - - g_type_class_add_private(listClass, sizeof(WebKitBackForwardListPrivate)); } static WebKitBackForwardListItem* webkitBackForwardListGetOrCreateItem(WebKitBackForwardList* list, WebBackForwardListItem* webListItem) diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardListItem.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardListItem.cpp index 8b22afc46..53fd1c8c2 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardListItem.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardListItem.cpp @@ -35,28 +35,10 @@ struct _WebKitBackForwardListItemPrivate { CString originalURI; }; -G_DEFINE_TYPE(WebKitBackForwardListItem, webkit_back_forward_list_item, G_TYPE_INITIALLY_UNOWNED) - -static void webkitBackForwardListItemFinalize(GObject* object) -{ - WEBKIT_BACK_FORWARD_LIST_ITEM(object)->priv->~WebKitBackForwardListItemPrivate(); - G_OBJECT_CLASS(webkit_back_forward_list_item_parent_class)->finalize(object); -} - -static void webkit_back_forward_list_item_init(WebKitBackForwardListItem* listItem) -{ - WebKitBackForwardListItemPrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(listItem, WEBKIT_TYPE_BACK_FORWARD_LIST_ITEM, WebKitBackForwardListItemPrivate); - listItem->priv = priv; - new (priv) WebKitBackForwardListItemPrivate(); -} +WEBKIT_DEFINE_TYPE(WebKitBackForwardListItem, webkit_back_forward_list_item, G_TYPE_INITIALLY_UNOWNED) static void webkit_back_forward_list_item_class_init(WebKitBackForwardListItemClass* listItemClass) { - GObjectClass* gObjectClass = G_OBJECT_CLASS(listItemClass); - - gObjectClass->finalize = webkitBackForwardListItemFinalize; - - g_type_class_add_private(listItemClass, sizeof(WebKitBackForwardListItemPrivate)); } typedef HashMap<WebBackForwardListItem*, WebKitBackForwardListItem*> HistoryItemsMap; diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenu.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenu.cpp index e65728aac..46ce958ee 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenu.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenu.cpp @@ -33,29 +33,18 @@ struct _WebKitContextMenuPrivate { WebKitContextMenuItem* parentItem; }; -G_DEFINE_TYPE(WebKitContextMenu, webkit_context_menu, G_TYPE_OBJECT) +WEBKIT_DEFINE_TYPE(WebKitContextMenu, webkit_context_menu, G_TYPE_OBJECT) -static void webkitContextMenuFinalize(GObject* object) +static void webkitContextMenuDispose(GObject* object) { - WebKitContextMenu* menu = WEBKIT_CONTEXT_MENU(object); - webkit_context_menu_remove_all(menu); - menu->priv->~WebKitContextMenuPrivate(); - G_OBJECT_CLASS(webkit_context_menu_parent_class)->finalize(object); -} - -static void webkit_context_menu_init(WebKitContextMenu* menu) -{ - WebKitContextMenuPrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(menu, WEBKIT_TYPE_CONTEXT_MENU, WebKitContextMenuPrivate); - menu->priv = priv; - new (priv) WebKitContextMenuPrivate(); + webkit_context_menu_remove_all(WEBKIT_CONTEXT_MENU(object)); + G_OBJECT_CLASS(webkit_context_menu_parent_class)->dispose(object); } static void webkit_context_menu_class_init(WebKitContextMenuClass* listClass) { GObjectClass* gObjectClass = G_OBJECT_CLASS(listClass); - gObjectClass->finalize = webkitContextMenuFinalize; - - g_type_class_add_private(listClass, sizeof(WebKitContextMenuPrivate)); + gObjectClass->dispose = webkitContextMenuDispose; } void webkitContextMenuPopulate(WebKitContextMenu* menu, Vector<ContextMenuItem>& contextMenuItems) diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuItem.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuItem.cpp index a73f07575..aa89b990b 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuItem.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuItem.cpp @@ -38,33 +38,20 @@ using namespace WebKit; using namespace WebCore; struct _WebKitContextMenuItemPrivate { + ~_WebKitContextMenuItemPrivate() + { + if (subMenu) + webkitContextMenuSetParentItem(subMenu.get(), 0); + } + OwnPtr<ContextMenuItem> menuItem; GRefPtr<WebKitContextMenu> subMenu; }; -G_DEFINE_TYPE(WebKitContextMenuItem, webkit_context_menu_item, G_TYPE_INITIALLY_UNOWNED) - -static void webkitContextMenuItemFinalize(GObject* object) -{ - WebKitContextMenuItemPrivate* priv = WEBKIT_CONTEXT_MENU_ITEM(object)->priv; - if (priv->subMenu) - webkitContextMenuSetParentItem(priv->subMenu.get(), 0); - priv->~WebKitContextMenuItemPrivate(); - G_OBJECT_CLASS(webkit_context_menu_item_parent_class)->finalize(object); -} - -static void webkit_context_menu_item_init(WebKitContextMenuItem* item) -{ - WebKitContextMenuItemPrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(item, WEBKIT_TYPE_CONTEXT_MENU_ITEM, WebKitContextMenuItemPrivate); - item->priv = priv; - new (priv) WebKitContextMenuItemPrivate(); -} +WEBKIT_DEFINE_TYPE(WebKitContextMenuItem, webkit_context_menu_item, G_TYPE_INITIALLY_UNOWNED) static void webkit_context_menu_item_class_init(WebKitContextMenuItemClass* itemClass) { - GObjectClass* gObjectClass = G_OBJECT_CLASS(itemClass); - gObjectClass->finalize = webkitContextMenuItemFinalize; - g_type_class_add_private(itemClass, sizeof(WebKitContextMenuItemPrivate)); } static bool checkAndWarnIfMenuHasParentItem(WebKitContextMenu* menu) diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.cpp index 66db1cc5b..29a37ebd3 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.cpp @@ -36,12 +36,17 @@ enum { }; struct _WebKitCookieManagerPrivate { + ~_WebKitCookieManagerPrivate() + { + webCookieManager->stopObservingCookieChanges(); + } + RefPtr<WebCookieManagerProxy> webCookieManager; }; static guint signals[LAST_SIGNAL] = { 0, }; -G_DEFINE_TYPE(WebKitCookieManager, webkit_cookie_manager, G_TYPE_OBJECT) +WEBKIT_DEFINE_TYPE(WebKitCookieManager, webkit_cookie_manager, G_TYPE_OBJECT) COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_COOKIE_PERSISTENT_STORAGE_TEXT, SoupCookiePersistentStorageText); COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_COOKIE_PERSISTENT_STORAGE_SQLITE, SoupCookiePersistentStorageSQLite); @@ -50,27 +55,9 @@ COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_COOKIE_POLICY_ACCEPT_ALWAYS, HTTPCookieAccep COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_COOKIE_POLICY_ACCEPT_NEVER, HTTPCookieAcceptPolicyNever); COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_COOKIE_POLICY_ACCEPT_NO_THIRD_PARTY, HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain); -static void webkit_cookie_manager_init(WebKitCookieManager* manager) -{ - WebKitCookieManagerPrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(manager, WEBKIT_TYPE_COOKIE_MANAGER, WebKitCookieManagerPrivate); - manager->priv = priv; - new (priv) WebKitCookieManagerPrivate(); -} - -static void webkitCookieManagerFinalize(GObject* object) -{ - WebKitCookieManagerPrivate* priv = WEBKIT_COOKIE_MANAGER(object)->priv; - priv->webCookieManager->stopObservingCookieChanges(); - priv->~WebKitCookieManagerPrivate(); - G_OBJECT_CLASS(webkit_cookie_manager_parent_class)->finalize(object); -} - static void webkit_cookie_manager_class_init(WebKitCookieManagerClass* findClass) { GObjectClass* gObjectClass = G_OBJECT_CLASS(findClass); - gObjectClass->finalize = webkitCookieManagerFinalize; - - g_type_class_add_private(findClass, sizeof(WebKitCookieManagerPrivate)); /** * WebKitCookieManager::changed: diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp index a6754de06..245f1a61b 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp @@ -53,6 +53,12 @@ enum { }; struct _WebKitDownloadPrivate { + ~_WebKitDownloadPrivate() + { + if (webView) + g_object_remove_weak_pointer(G_OBJECT(webView), reinterpret_cast<void**>(&webView)); + } + RefPtr<DownloadProxy> download; GRefPtr<WebKitURIRequest> request; @@ -68,16 +74,7 @@ struct _WebKitDownloadPrivate { static guint signals[LAST_SIGNAL] = { 0, }; -G_DEFINE_TYPE(WebKitDownload, webkit_download, G_TYPE_OBJECT) - -static void webkitDownloadFinalize(GObject* object) -{ - WebKitDownloadPrivate* priv = WEBKIT_DOWNLOAD(object)->priv; - if (priv->webView) - g_object_remove_weak_pointer(G_OBJECT(priv->webView), reinterpret_cast<void**>(&priv->webView)); - priv->~WebKitDownloadPrivate(); - G_OBJECT_CLASS(webkit_download_parent_class)->finalize(object); -} +WEBKIT_DEFINE_TYPE(WebKitDownload, webkit_download, G_TYPE_OBJECT) static void webkitDownloadGetProperty(GObject* object, guint propId, GValue* value, GParamSpec* paramSpec) { @@ -111,18 +108,10 @@ static gboolean webkitDownloadDecideDestination(WebKitDownload* download, const return TRUE; } -static void webkit_download_init(WebKitDownload* download) -{ - WebKitDownloadPrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(download, WEBKIT_TYPE_DOWNLOAD, WebKitDownloadPrivate); - download->priv = priv; - new (priv) WebKitDownloadPrivate(); -} - static void webkit_download_class_init(WebKitDownloadClass* downloadClass) { GObjectClass* objectClass = G_OBJECT_CLASS(downloadClass); objectClass->get_property = webkitDownloadGetProperty; - objectClass->finalize = webkitDownloadFinalize; downloadClass->decide_destination = webkitDownloadDecideDestination; @@ -264,8 +253,6 @@ static void webkit_download_class_init(WebKitDownloadClass* downloadClass) g_cclosure_marshal_VOID__STRING, G_TYPE_BOOLEAN, 1, G_TYPE_STRING); - - g_type_class_add_private(downloadClass, sizeof(WebKitDownloadPrivate)); } WebKitDownload* webkitDownloadCreate(DownloadProxy* downloadProxy) diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitFaviconDatabase.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitFaviconDatabase.cpp index 1847b9605..d50533b91 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitFaviconDatabase.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitFaviconDatabase.cpp @@ -52,14 +52,7 @@ struct _WebKitFaviconDatabasePrivate { HashMap<String, String> pageURLToIconURLMap; }; -G_DEFINE_TYPE(WebKitFaviconDatabase, webkit_favicon_database, G_TYPE_OBJECT) - -static void webkit_favicon_database_init(WebKitFaviconDatabase* manager) -{ - WebKitFaviconDatabasePrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(manager, WEBKIT_TYPE_FAVICON_DATABASE, WebKitFaviconDatabasePrivate); - manager->priv = priv; - new (priv) WebKitFaviconDatabasePrivate(); -} +WEBKIT_DEFINE_TYPE(WebKitFaviconDatabase, webkit_favicon_database, G_TYPE_OBJECT) static void webkitFaviconDatabaseDispose(GObject* object) { @@ -72,18 +65,10 @@ static void webkitFaviconDatabaseDispose(GObject* object) G_OBJECT_CLASS(webkit_favicon_database_parent_class)->dispose(object); } -static void webkitFaviconDatabaseFinalize(GObject* object) -{ - WebKitFaviconDatabase* database = WEBKIT_FAVICON_DATABASE(object); - database->priv->~WebKitFaviconDatabasePrivate(); - G_OBJECT_CLASS(webkit_favicon_database_parent_class)->finalize(object); -} - static void webkit_favicon_database_class_init(WebKitFaviconDatabaseClass* faviconDatabaseClass) { GObjectClass* gObjectClass = G_OBJECT_CLASS(faviconDatabaseClass); gObjectClass->dispose = webkitFaviconDatabaseDispose; - gObjectClass->finalize = webkitFaviconDatabaseFinalize; /** * WebKitFaviconDatabase::favicon-changed: @@ -108,8 +93,6 @@ static void webkit_favicon_database_class_init(WebKitFaviconDatabaseClass* favic G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING); - - g_type_class_add_private(faviconDatabaseClass, sizeof(WebKitFaviconDatabasePrivate)); } struct GetFaviconSurfaceAsyncData { diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitFileChooserRequest.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitFileChooserRequest.cpp index 26ab99b44..85ae0efa0 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitFileChooserRequest.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitFileChooserRequest.cpp @@ -56,7 +56,6 @@ using namespace WebCore; * WebKit will provide a default handler which will asynchronously run * a regular #GtkFileChooserDialog for the user to interact with. */ -G_DEFINE_TYPE(WebKitFileChooserRequest, webkit_file_chooser_request, G_TYPE_OBJECT) struct _WebKitFileChooserRequestPrivate { RefPtr<WebOpenPanelParameters> parameters; @@ -67,6 +66,8 @@ struct _WebKitFileChooserRequestPrivate { bool handledRequest; }; +WEBKIT_DEFINE_TYPE(WebKitFileChooserRequest, webkit_file_chooser_request, G_TYPE_OBJECT) + enum { PROP_0, PROP_FILTER, @@ -75,13 +76,7 @@ enum { PROP_SELECTED_FILES, }; -static void webkit_file_chooser_request_init(WebKitFileChooserRequest* request) -{ - request->priv = G_TYPE_INSTANCE_GET_PRIVATE(request, WEBKIT_TYPE_FILE_CHOOSER_REQUEST, WebKitFileChooserRequestPrivate); - new (request->priv) WebKitFileChooserRequestPrivate(); -} - -static void webkitFileChooserRequestFinalize(GObject* object) +static void webkitFileChooserRequestDispose(GObject* object) { WebKitFileChooserRequest* request = WEBKIT_FILE_CHOOSER_REQUEST(object); @@ -89,8 +84,7 @@ static void webkitFileChooserRequestFinalize(GObject* object) if (!request->priv->handledRequest) webkit_file_chooser_request_cancel(request); - request->priv->~WebKitFileChooserRequestPrivate(); - G_OBJECT_CLASS(webkit_file_chooser_request_parent_class)->finalize(object); + G_OBJECT_CLASS(webkit_file_chooser_request_parent_class)->dispose(object); } static void webkitFileChooserRequestGetProperty(GObject* object, guint propId, GValue* value, GParamSpec* paramSpec) @@ -118,9 +112,8 @@ static void webkitFileChooserRequestGetProperty(GObject* object, guint propId, G static void webkit_file_chooser_request_class_init(WebKitFileChooserRequestClass* requestClass) { GObjectClass* objectClass = G_OBJECT_CLASS(requestClass); - objectClass->finalize = webkitFileChooserRequestFinalize; + objectClass->dispose = webkitFileChooserRequestDispose; objectClass->get_property = webkitFileChooserRequestGetProperty; - g_type_class_add_private(requestClass, sizeof(WebKitFileChooserRequestPrivate)); /** * WebKitFileChooserRequest:filter: diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitFindController.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitFindController.cpp index be3f571d6..7e36a4ad5 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitFindController.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitFindController.cpp @@ -62,7 +62,7 @@ struct _WebKitFindControllerPrivate { static guint signals[LAST_SIGNAL] = { 0, }; -G_DEFINE_TYPE(WebKitFindController, webkit_find_controller, G_TYPE_OBJECT) +WEBKIT_DEFINE_TYPE(WebKitFindController, webkit_find_controller, G_TYPE_OBJECT) COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE, FindOptionsCaseInsensitive); COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_FIND_OPTIONS_AT_WORD_STARTS, FindOptionsAtWordStarts); @@ -85,13 +85,6 @@ static void didCountStringMatches(WKPageRef page, WKStringRef string, unsigned m g_signal_emit(WEBKIT_FIND_CONTROLLER(clientInfo), signals[COUNTED_MATCHES], 0, matchCount); } -static void webkit_find_controller_init(WebKitFindController* findController) -{ - WebKitFindControllerPrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(findController, WEBKIT_TYPE_FIND_CONTROLLER, WebKitFindControllerPrivate); - findController->priv = priv; - new (priv) WebKitFindControllerPrivate(); -} - static inline WebPageProxy* getPage(WebKitFindController* findController) { return webkitWebViewBaseGetPage(reinterpret_cast<WebKitWebViewBase*>(findController->priv->webView)); @@ -146,22 +139,12 @@ static void webkitFindControllerSetProperty(GObject* object, guint propId, const } } -static void webkitFindControllerFinalize(GObject* object) -{ - WEBKIT_FIND_CONTROLLER(object)->priv->~WebKitFindControllerPrivate(); - G_OBJECT_CLASS(webkit_find_controller_parent_class)->finalize(object); -} - static void webkit_find_controller_class_init(WebKitFindControllerClass* findClass) { GObjectClass* gObjectClass = G_OBJECT_CLASS(findClass); - gObjectClass->constructed = webkitFindControllerConstructed; gObjectClass->get_property = webkitFindControllerGetProperty; gObjectClass->set_property = webkitFindControllerSetProperty; - gObjectClass->finalize = webkitFindControllerFinalize; - - g_type_class_add_private(findClass, sizeof(WebKitFindControllerPrivate)); /** * WebKitFindController:text: diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequest.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequest.cpp index f901e7375..816cee3f6 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequest.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequest.cpp @@ -28,8 +28,6 @@ using namespace WebKit; -G_DEFINE_TYPE(WebKitFormSubmissionRequest, webkit_form_submission_request, G_TYPE_OBJECT) - struct _WebKitFormSubmissionRequestPrivate { RefPtr<ImmutableDictionary> webValues; RefPtr<WebFormSubmissionListenerProxy> listener; @@ -37,14 +35,9 @@ struct _WebKitFormSubmissionRequestPrivate { bool handledRequest; }; -static void webkit_form_submission_request_init(WebKitFormSubmissionRequest* request) -{ - WebKitFormSubmissionRequestPrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(request, WEBKIT_TYPE_FORM_SUBMISSION_REQUEST, WebKitFormSubmissionRequestPrivate); - request->priv = priv; - new (priv) WebKitFormSubmissionRequestPrivate(); -} +WEBKIT_DEFINE_TYPE(WebKitFormSubmissionRequest, webkit_form_submission_request, G_TYPE_OBJECT) -static void webkitFormSubmissionRequestFinalize(GObject* object) +static void webkitFormSubmissionRequestDispose(GObject* object) { WebKitFormSubmissionRequest* request = WEBKIT_FORM_SUBMISSION_REQUEST(object); @@ -52,15 +45,13 @@ static void webkitFormSubmissionRequestFinalize(GObject* object) if (!request->priv->handledRequest) webkit_form_submission_request_submit(request); - request->priv->~WebKitFormSubmissionRequestPrivate(); - G_OBJECT_CLASS(webkit_form_submission_request_parent_class)->finalize(object); + G_OBJECT_CLASS(webkit_form_submission_request_parent_class)->dispose(object); } static void webkit_form_submission_request_class_init(WebKitFormSubmissionRequestClass* requestClass) { GObjectClass* objectClass = G_OBJECT_CLASS(requestClass); - objectClass->finalize = webkitFormSubmissionRequestFinalize; - g_type_class_add_private(requestClass, sizeof(WebKitFormSubmissionRequestPrivate)); + objectClass->dispose = webkitFormSubmissionRequestDispose; } WebKitFormSubmissionRequest* webkitFormSubmissionRequestCreate(ImmutableDictionary* values, WebFormSubmissionListenerProxy* listener) diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitGeolocationPermissionRequest.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitGeolocationPermissionRequest.cpp index 664293770..f780dafb2 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitGeolocationPermissionRequest.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitGeolocationPermissionRequest.cpp @@ -36,16 +36,18 @@ using namespace WebKit; * permission to decide whether WebKit should provide the user's * location to a website when requested throught the Geolocation API. */ + static void webkit_permission_request_interface_init(WebKitPermissionRequestIface*); -G_DEFINE_TYPE_WITH_CODE(WebKitGeolocationPermissionRequest, webkit_geolocation_permission_request, G_TYPE_OBJECT, - G_IMPLEMENT_INTERFACE(WEBKIT_TYPE_PERMISSION_REQUEST, - webkit_permission_request_interface_init)) struct _WebKitGeolocationPermissionRequestPrivate { RefPtr<GeolocationPermissionRequestProxy> request; bool madeDecision; }; +WEBKIT_DEFINE_TYPE_WITH_CODE( + WebKitGeolocationPermissionRequest, webkit_geolocation_permission_request, G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE(WEBKIT_TYPE_PERMISSION_REQUEST, webkit_permission_request_interface_init)) + static void webkitGeolocationPermissionRequestAllow(WebKitPermissionRequest* request) { ASSERT(WEBKIT_IS_GEOLOCATION_PERMISSION_REQUEST(request)); @@ -80,29 +82,17 @@ static void webkit_permission_request_interface_init(WebKitPermissionRequestIfac iface->deny = webkitGeolocationPermissionRequestDeny; } -static void webkit_geolocation_permission_request_init(WebKitGeolocationPermissionRequest* request) +static void webkitGeolocationPermissionRequestDispose(GObject* object) { - request->priv = G_TYPE_INSTANCE_GET_PRIVATE(request, WEBKIT_TYPE_GEOLOCATION_PERMISSION_REQUEST, WebKitGeolocationPermissionRequestPrivate); - new (request->priv) WebKitGeolocationPermissionRequestPrivate(); -} - -static void webkitGeolocationPermissionRequestFinalize(GObject* object) -{ - WebKitGeolocationPermissionRequestPrivate* priv = WEBKIT_GEOLOCATION_PERMISSION_REQUEST(object)->priv; - // Default behaviour when no decision has been made is denying the request. - if (!priv->madeDecision) - priv->request->deny(); - - priv->~WebKitGeolocationPermissionRequestPrivate(); - G_OBJECT_CLASS(webkit_geolocation_permission_request_parent_class)->finalize(object); + webkitGeolocationPermissionRequestDeny(WEBKIT_PERMISSION_REQUEST(object)); + G_OBJECT_CLASS(webkit_geolocation_permission_request_parent_class)->dispose(object); } static void webkit_geolocation_permission_request_class_init(WebKitGeolocationPermissionRequestClass* klass) { GObjectClass* objectClass = G_OBJECT_CLASS(klass); - objectClass->finalize = webkitGeolocationPermissionRequestFinalize; - g_type_class_add_private(klass, sizeof(WebKitGeolocationPermissionRequestPrivate)); + objectClass->dispose = webkitGeolocationPermissionRequestDispose; } WebKitGeolocationPermissionRequest* webkitGeolocationPermissionRequestCreate(GeolocationPermissionRequestProxy* request) diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.cpp index 4c9486782..8df293cba 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.cpp @@ -74,13 +74,7 @@ struct _WebKitHitTestResultPrivate { CString mediaURI; }; -G_DEFINE_TYPE(WebKitHitTestResult, webkit_hit_test_result, G_TYPE_OBJECT) - -static void webkitHitTestResultFinalize(GObject* object) -{ - WEBKIT_HIT_TEST_RESULT(object)->priv->~WebKitHitTestResultPrivate(); - G_OBJECT_CLASS(webkit_hit_test_result_parent_class)->finalize(object); -} +WEBKIT_DEFINE_TYPE(WebKitHitTestResult, webkit_hit_test_result, G_TYPE_OBJECT) static void webkitHitTestResultGetProperty(GObject* object, guint propId, GValue* value, GParamSpec* paramSpec) { @@ -138,19 +132,11 @@ static void webkitHitTestResultSetProperty(GObject* object, guint propId, const } } -static void webkit_hit_test_result_init(WebKitHitTestResult* hitTestResult) -{ - WebKitHitTestResultPrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(hitTestResult, WEBKIT_TYPE_HIT_TEST_RESULT, WebKitHitTestResultPrivate); - hitTestResult->priv = priv; - new (priv) WebKitHitTestResultPrivate(); -} - static void webkit_hit_test_result_class_init(WebKitHitTestResultClass* hitTestResultClass) { GObjectClass* objectClass = G_OBJECT_CLASS(hitTestResultClass); objectClass->get_property = webkitHitTestResultGetProperty; objectClass->set_property = webkitHitTestResultSetProperty; - objectClass->finalize = webkitHitTestResultFinalize; GParamFlags paramFlags = static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); @@ -233,8 +219,6 @@ static void webkit_hit_test_result_class_init(WebKitHitTestResultClass* hitTestR _("The media URI"), 0, paramFlags)); - - g_type_class_add_private(hitTestResultClass, sizeof(WebKitHitTestResultPrivate)); } WebKitHitTestResult* webkitHitTestResultCreate(WebHitTestResult* hitTestResult) diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecision.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecision.cpp index 0901d8079..deef50c55 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecision.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecision.cpp @@ -43,8 +43,6 @@ using namespace WebCore; * the navigation was triggered by a mouse event. */ -G_DEFINE_TYPE(WebKitNavigationPolicyDecision, webkit_navigation_policy_decision, WEBKIT_TYPE_POLICY_DECISION) - struct _WebKitNavigationPolicyDecisionPrivate { WebKitNavigationType navigationType; unsigned modifiers; @@ -53,6 +51,8 @@ struct _WebKitNavigationPolicyDecisionPrivate { CString frameName; }; +WEBKIT_DEFINE_TYPE(WebKitNavigationPolicyDecision, webkit_navigation_policy_decision, WEBKIT_TYPE_POLICY_DECISION) + enum { PROP_0, PROP_NAVIGATION_TYPE, @@ -62,18 +62,6 @@ enum { PROP_FRAME_NAME, }; -static void webkit_navigation_policy_decision_init(WebKitNavigationPolicyDecision* decision) -{ - decision->priv = G_TYPE_INSTANCE_GET_PRIVATE(decision, WEBKIT_TYPE_NAVIGATION_POLICY_DECISION, WebKitNavigationPolicyDecisionPrivate); - new (decision->priv) WebKitNavigationPolicyDecisionPrivate(); -} - -static void webkitNavigationPolicyDecisionFinalize(GObject* object) -{ - WEBKIT_NAVIGATION_POLICY_DECISION(object)->priv->~WebKitNavigationPolicyDecisionPrivate(); - G_OBJECT_CLASS(webkit_navigation_policy_decision_parent_class)->finalize(object); -} - static void webkitNavigationPolicyDecisionGetProperty(GObject* object, guint propId, GValue* value, GParamSpec* paramSpec) { WebKitNavigationPolicyDecision* decision = WEBKIT_NAVIGATION_POLICY_DECISION(object); @@ -102,9 +90,7 @@ static void webkitNavigationPolicyDecisionGetProperty(GObject* object, guint pro static void webkit_navigation_policy_decision_class_init(WebKitNavigationPolicyDecisionClass* decisionClass) { GObjectClass* objectClass = G_OBJECT_CLASS(decisionClass); - objectClass->finalize = webkitNavigationPolicyDecisionFinalize; objectClass->get_property = webkitNavigationPolicyDecisionGetProperty; - g_type_class_add_private(decisionClass, sizeof(WebKitNavigationPolicyDecisionPrivate)); /** * WebKitNavigationPolicyDecision:navigation-type: diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitPlugin.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitPlugin.cpp index aff651aed..0dd1121cf 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitPlugin.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitPlugin.cpp @@ -27,6 +27,11 @@ using namespace WebKit; struct _WebKitPluginPrivate { + ~_WebKitPluginPrivate() + { + g_list_free_full(mimeInfoList, reinterpret_cast<GDestroyNotify>(webkit_mime_info_unref)); + } + PluginModuleInfo pluginInfo; CString name; CString description; @@ -34,29 +39,10 @@ struct _WebKitPluginPrivate { GList* mimeInfoList; }; -G_DEFINE_TYPE(WebKitPlugin, webkit_plugin, G_TYPE_OBJECT) - -static void webkitPluginFinalize(GObject* object) -{ - WebKitPluginPrivate* priv = WEBKIT_PLUGIN(object)->priv; - g_list_free_full(priv->mimeInfoList, reinterpret_cast<GDestroyNotify>(webkit_mime_info_unref)); - priv->~WebKitPluginPrivate(); - G_OBJECT_CLASS(webkit_plugin_parent_class)->finalize(object); -} - -static void webkit_plugin_init(WebKitPlugin* plugin) -{ - WebKitPluginPrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(plugin, WEBKIT_TYPE_PLUGIN, WebKitPluginPrivate); - plugin->priv = priv; - new (priv) WebKitPluginPrivate(); -} +WEBKIT_DEFINE_TYPE(WebKitPlugin, webkit_plugin, G_TYPE_OBJECT) static void webkit_plugin_class_init(WebKitPluginClass* pluginClass) { - GObjectClass* gObjectClass = G_OBJECT_CLASS(pluginClass); - gObjectClass->finalize = webkitPluginFinalize; - - g_type_class_add_private(pluginClass, sizeof(WebKitPluginPrivate)); } WebKitPlugin* webkitPluginCreate(const PluginModuleInfo& pluginInfo) diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitPolicyDecision.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitPolicyDecision.cpp index 3e9ef3fbf..ee44eaebb 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitPolicyDecision.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitPolicyDecision.cpp @@ -41,30 +41,18 @@ using namespace WebKit; * completes. To make a policy decision asynchronously, simply increment * the reference count of the #WebKitPolicyDecision object. */ -G_DEFINE_ABSTRACT_TYPE(WebKitPolicyDecision, webkit_policy_decision, G_TYPE_OBJECT) struct _WebKitPolicyDecisionPrivate { RefPtr<WebFramePolicyListenerProxy> listener; bool madePolicyDecision; }; -static void webkit_policy_decision_init(WebKitPolicyDecision* decision) -{ - decision->priv = G_TYPE_INSTANCE_GET_PRIVATE(decision, WEBKIT_TYPE_POLICY_DECISION, WebKitPolicyDecisionPrivate); - new (decision->priv) WebKitPolicyDecisionPrivate(); - decision->priv->madePolicyDecision = false; -} +WEBKIT_DEFINE_ABSTRACT_TYPE(WebKitPolicyDecision, webkit_policy_decision, G_TYPE_OBJECT) -static void webkitPolicyDecisionFinalize(GObject* object) +static void webkitPolicyDecisionDispose(GObject* object) { - WebKitPolicyDecisionPrivate* priv = WEBKIT_POLICY_DECISION(object)->priv; - - // This is the default choice for all policy decisions in WebPageProxy.cpp. - if (!priv->madePolicyDecision) - priv->listener->use(); - - priv->~WebKitPolicyDecisionPrivate(); - G_OBJECT_CLASS(webkit_policy_decision_parent_class)->finalize(object); + webkit_policy_decision_use(WEBKIT_POLICY_DECISION(object)); + G_OBJECT_CLASS(webkit_policy_decision_parent_class)->dispose(object); } void webkitPolicyDecisionSetListener(WebKitPolicyDecision* decision, WebFramePolicyListenerProxy* listener) @@ -75,8 +63,7 @@ void webkitPolicyDecisionSetListener(WebKitPolicyDecision* decision, WebFramePol static void webkit_policy_decision_class_init(WebKitPolicyDecisionClass* decisionClass) { GObjectClass* objectClass = G_OBJECT_CLASS(decisionClass); - objectClass->finalize = webkitPolicyDecisionFinalize; - g_type_class_add_private(decisionClass, sizeof(WebKitPolicyDecisionPrivate)); + objectClass->dispose = webkitPolicyDecisionDispose; } /** @@ -88,6 +75,10 @@ static void webkit_policy_decision_class_init(WebKitPolicyDecisionClass* decisio void webkit_policy_decision_use(WebKitPolicyDecision* decision) { g_return_if_fail(WEBKIT_IS_POLICY_DECISION(decision)); + + if (decision->priv->madePolicyDecision) + return; + decision->priv->listener->use(); decision->priv->madePolicyDecision = true; } @@ -102,6 +93,10 @@ void webkit_policy_decision_use(WebKitPolicyDecision* decision) void webkit_policy_decision_ignore(WebKitPolicyDecision* decision) { g_return_if_fail(WEBKIT_IS_POLICY_DECISION(decision)); + + if (decision->priv->madePolicyDecision) + return; + decision->priv->listener->ignore(); decision->priv->madePolicyDecision = true; } @@ -115,6 +110,10 @@ void webkit_policy_decision_ignore(WebKitPolicyDecision* decision) void webkit_policy_decision_download(WebKitPolicyDecision* decision) { g_return_if_fail(WEBKIT_IS_POLICY_DECISION(decision)); + + if (decision->priv->madePolicyDecision) + return; + decision->priv->listener->download(); decision->priv->madePolicyDecision = true; } diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitPrintOperation.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitPrintOperation.cpp index 7da0b197a..6b72d188d 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitPrintOperation.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitPrintOperation.cpp @@ -54,6 +54,11 @@ enum { }; struct _WebKitPrintOperationPrivate { + ~_WebKitPrintOperationPrivate() + { + g_signal_handler_disconnect(webView, webViewDestroyedId); + } + WebKitWebView* webView; gulong webViewDestroyedId; @@ -63,16 +68,7 @@ struct _WebKitPrintOperationPrivate { static guint signals[LAST_SIGNAL] = { 0, }; -G_DEFINE_TYPE(WebKitPrintOperation, webkit_print_operation, G_TYPE_OBJECT) - -static void webkitPrintOperationFinalize(GObject* object) -{ - WebKitPrintOperationPrivate* priv = WEBKIT_PRINT_OPERATION(object)->priv; - g_signal_handler_disconnect(priv->webView, priv->webViewDestroyedId); - - priv->~WebKitPrintOperationPrivate(); - G_OBJECT_CLASS(webkit_print_operation_parent_class)->finalize(object); -} +WEBKIT_DEFINE_TYPE(WebKitPrintOperation, webkit_print_operation, G_TYPE_OBJECT) static void webViewDestroyed(GtkWidget* webView, GObject* printOperation) { @@ -128,17 +124,9 @@ static void webkitPrintOperationSetProperty(GObject* object, guint propId, const } } -static void webkit_print_operation_init(WebKitPrintOperation* printOperation) -{ - WebKitPrintOperationPrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(printOperation, WEBKIT_TYPE_PRINT_OPERATION, WebKitPrintOperationPrivate); - printOperation->priv = priv; - new (priv) WebKitPrintOperationPrivate(); -} - static void webkit_print_operation_class_init(WebKitPrintOperationClass* printOperationClass) { GObjectClass* gObjectClass = G_OBJECT_CLASS(printOperationClass); - gObjectClass->finalize = webkitPrintOperationFinalize; gObjectClass->constructed = webkitPrintOperationConstructed; gObjectClass->get_property = webkitPrintOperationGetProperty; gObjectClass->set_property = webkitPrintOperationSetProperty; @@ -213,8 +201,6 @@ static void webkit_print_operation_class_init(WebKitPrintOperationClass* printOp g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); - - g_type_class_add_private(printOperationClass, sizeof(WebKitPrintOperationPrivate)); } #ifdef HAVE_GTK_UNIX_PRINTING diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h index 5aabcbc2e..be39e802c 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h @@ -66,6 +66,57 @@ static void destroy##structName(structName* data) \ g_slice_free(structName, data); \ } +#define WEBKIT_DEFINE_TYPE(TypeName, type_name, TYPE_PARENT) _WEBKIT_DEFINE_TYPE_EXTENDED(TypeName, type_name, TYPE_PARENT, 0, { }) +#define WEBKIT_DEFINE_ABSTRACT_TYPE(TypeName, type_name, TYPE_PARENT) _WEBKIT_DEFINE_TYPE_EXTENDED(TypeName, type_name, TYPE_PARENT, G_TYPE_FLAG_ABSTRACT, { }) +#define WEBKIT_DEFINE_TYPE_WITH_CODE(TypeName, type_name, TYPE_PARENT, Code) _WEBKIT_DEFINE_TYPE_EXTENDED_BEGIN(TypeName, type_name, TYPE_PARENT, 0) {Code;} _WEBKIT_DEFINE_TYPE_EXTENDED_END() + +#define _WEBKIT_DEFINE_TYPE_EXTENDED(TypeName, type_name, TYPE_PARENT, flags, Code) _WEBKIT_DEFINE_TYPE_EXTENDED_BEGIN(TypeName, type_name, TYPE_PARENT, flags) {Code;} _WEBKIT_DEFINE_TYPE_EXTENDED_END() +#define _WEBKIT_DEFINE_TYPE_EXTENDED_BEGIN(TypeName, type_name, TYPE_PARENT, flags) \ +\ +static void type_name##_class_init(TypeName##Class* klass); \ +static gpointer type_name##_parent_class = 0; \ +static void type_name##_finalize(GObject* object) \ +{ \ + TypeName* self = (TypeName*)object; \ + self->priv->~TypeName##Private(); \ + G_OBJECT_CLASS(type_name##_parent_class)->finalize(object); \ +} \ +\ +static void type_name##_class_intern_init(gpointer klass) \ +{ \ + GObjectClass* gObjectClass = G_OBJECT_CLASS(klass); \ + g_type_class_add_private(klass, sizeof(TypeName##Private)); \ + type_name##_parent_class = g_type_class_peek_parent(klass); \ + type_name##_class_init((TypeName##Class*)klass); \ + gObjectClass->finalize = type_name##_finalize; \ +} \ +\ +static void type_name##_init(TypeName* self) \ +{ \ + TypeName##Private* priv = G_TYPE_INSTANCE_GET_PRIVATE(self, type_name##_get_type(), TypeName##Private); \ + self->priv = priv; \ + new (priv) TypeName##Private(); \ +}\ +GType type_name##_get_type(void) \ +{ \ + static volatile gsize g_define_type_id__volatile = 0; \ + if (g_once_init_enter(&g_define_type_id__volatile)) { \ + GType g_define_type_id = \ + g_type_register_static_simple( \ + TYPE_PARENT, \ + g_intern_static_string(#TypeName), \ + sizeof(TypeName##Class), \ + (GClassInitFunc)type_name##_class_intern_init, \ + sizeof(TypeName), \ + (GInstanceInitFunc)type_name##_init, \ + (GTypeFlags)flags); \ + // Custom code follows. +#define _WEBKIT_DEFINE_TYPE_EXTENDED_END() \ + g_once_init_leave(&g_define_type_id__volatile, g_define_type_id); \ + } \ + return g_define_type_id__volatile; \ +} // Closes type_name##_get_type(). + unsigned wkEventModifiersToGdkModifiers(WKEventModifiers); unsigned wkEventMouseButtonToWebKitMouseButton(WKEventMouseButton); diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecision.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecision.cpp index ab5f38c97..3a75e38c9 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecision.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecision.cpp @@ -44,31 +44,20 @@ using namespace WebKit; * whether or not to download a particular resource or to load it * normally. */ -G_DEFINE_TYPE(WebKitResponsePolicyDecision, webkit_response_policy_decision, WEBKIT_TYPE_POLICY_DECISION) struct _WebKitResponsePolicyDecisionPrivate { GRefPtr<WebKitURIRequest> request; GRefPtr<WebKitURIResponse> response; }; +WEBKIT_DEFINE_TYPE(WebKitResponsePolicyDecision, webkit_response_policy_decision, WEBKIT_TYPE_POLICY_DECISION) + enum { PROP_0, PROP_REQUEST, PROP_RESPONSE, }; -static void webkit_response_policy_decision_init(WebKitResponsePolicyDecision* decision) -{ - decision->priv = G_TYPE_INSTANCE_GET_PRIVATE(decision, WEBKIT_TYPE_RESPONSE_POLICY_DECISION, WebKitResponsePolicyDecisionPrivate); - new (decision->priv) WebKitResponsePolicyDecisionPrivate(); -} - -static void webkitResponsePolicyDecisionFinalize(GObject* object) -{ - WEBKIT_RESPONSE_POLICY_DECISION(object)->priv->~WebKitResponsePolicyDecisionPrivate(); - G_OBJECT_CLASS(webkit_response_policy_decision_parent_class)->finalize(object); -} - static void webkitResponsePolicyDecisionGetProperty(GObject* object, guint propId, GValue* value, GParamSpec* paramSpec) { WebKitResponsePolicyDecision* decision = WEBKIT_RESPONSE_POLICY_DECISION(object); @@ -88,9 +77,7 @@ static void webkitResponsePolicyDecisionGetProperty(GObject* object, guint propI static void webkit_response_policy_decision_class_init(WebKitResponsePolicyDecisionClass* decisionClass) { GObjectClass* objectClass = G_OBJECT_CLASS(decisionClass); - objectClass->finalize = webkitResponsePolicyDecisionFinalize; objectClass->get_property = webkitResponsePolicyDecisionGetProperty; - g_type_class_add_private(decisionClass, sizeof(WebKitResponsePolicyDecisionPrivate)); /** * WebKitResponsePolicyDecision:request: diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitSecurityManager.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitSecurityManager.cpp index d170fcf3f..cd8803749 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitSecurityManager.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitSecurityManager.cpp @@ -40,28 +40,10 @@ struct _WebKitSecurityManagerPrivate { WebKitWebContext* webContext; }; -G_DEFINE_TYPE(WebKitSecurityManager, webkit_security_manager, G_TYPE_OBJECT) - -static void webkit_security_manager_init(WebKitSecurityManager* manager) -{ - WebKitSecurityManagerPrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(manager, WEBKIT_TYPE_SECURITY_MANAGER, WebKitSecurityManagerPrivate); - manager->priv = priv; - new (priv) WebKitSecurityManagerPrivate(); -} - -static void webkitSecurityManagerFinalize(GObject* object) -{ - WebKitSecurityManagerPrivate* priv = WEBKIT_SECURITY_MANAGER(object)->priv; - priv->~WebKitSecurityManagerPrivate(); - G_OBJECT_CLASS(webkit_security_manager_parent_class)->finalize(object); -} +WEBKIT_DEFINE_TYPE(WebKitSecurityManager, webkit_security_manager, G_TYPE_OBJECT) static void webkit_security_manager_class_init(WebKitSecurityManagerClass* klass) { - GObjectClass* gObjectClass = G_OBJECT_CLASS(klass); - gObjectClass->finalize = webkitSecurityManagerFinalize; - - g_type_class_add_private(klass, sizeof(WebKitSecurityManagerPrivate)); } WebKitSecurityManager* webkitSecurityManagerCreate(WebKitWebContext* webContext) diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp index 005aaae78..bf1ede057 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp @@ -43,6 +43,19 @@ using namespace WebKit; struct _WebKitSettingsPrivate { + _WebKitSettingsPrivate() + : preferences(WebPreferences::create()) + { + defaultFontFamily = preferences->standardFontFamily().utf8(); + monospaceFontFamily = preferences->fixedFontFamily().utf8(); + serifFontFamily = preferences->serifFontFamily().utf8(); + sansSerifFontFamily = preferences->sansSerifFontFamily().utf8(); + cursiveFontFamily = preferences->cursiveFontFamily().utf8(); + fantasyFontFamily = preferences->fantasyFontFamily().utf8(); + pictographFontFamily = preferences->pictographFontFamily().utf8(); + defaultCharset = preferences->defaultTextEncodingName().utf8(); + } + RefPtr<WebPreferences> preferences; CString defaultFontFamily; CString monospaceFontFamily; @@ -74,8 +87,7 @@ struct _WebKitSettingsPrivate { * </programlisting></informalexample> */ - -G_DEFINE_TYPE(WebKitSettings, webkit_settings, G_TYPE_OBJECT) +WEBKIT_DEFINE_TYPE(WebKitSettings, webkit_settings, G_TYPE_OBJECT) enum { PROP_0, @@ -405,18 +417,11 @@ static void webKitSettingsGetProperty(GObject* object, guint propId, GValue* val } } -static void webKitSettingsFinalize(GObject* object) -{ - WEBKIT_SETTINGS(object)->priv->~WebKitSettingsPrivate(); - G_OBJECT_CLASS(webkit_settings_parent_class)->finalize(object); -} - static void webkit_settings_class_init(WebKitSettingsClass* klass) { GObjectClass* gObjectClass = G_OBJECT_CLASS(klass); gObjectClass->set_property = webKitSettingsSetProperty; gObjectClass->get_property = webKitSettingsGetProperty; - gObjectClass->finalize = webKitSettingsFinalize; GParamFlags readWriteConstructParamFlags = static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT); @@ -1062,26 +1067,6 @@ static void webkit_settings_class_init(WebKitSettingsClass* klass) _("Whether to enable smooth scrolling"), FALSE, readWriteConstructParamFlags)); - - g_type_class_add_private(klass, sizeof(WebKitSettingsPrivate)); -} - -static void webkit_settings_init(WebKitSettings* settings) -{ - WebKitSettingsPrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(settings, WEBKIT_TYPE_SETTINGS, WebKitSettingsPrivate); - settings->priv = priv; - new (priv) WebKitSettingsPrivate(); - - priv->preferences = WebPreferences::create(); - priv->defaultFontFamily = priv->preferences->standardFontFamily().utf8(); - priv->monospaceFontFamily = priv->preferences->fixedFontFamily().utf8(); - priv->serifFontFamily = priv->preferences->serifFontFamily().utf8(); - priv->sansSerifFontFamily = priv->preferences->sansSerifFontFamily().utf8(); - priv->cursiveFontFamily = priv->preferences->cursiveFontFamily().utf8(); - priv->fantasyFontFamily = priv->preferences->fantasyFontFamily().utf8(); - priv->pictographFontFamily = priv->preferences->pictographFontFamily().utf8(); - priv->defaultCharset = priv->preferences->defaultTextEncodingName().utf8(); - } void webkitSettingsAttachSettingsToPage(WebKitSettings* settings, WebPageProxy* page) diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitURIRequest.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitURIRequest.cpp index c882cb788..147d17e1c 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitURIRequest.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitURIRequest.cpp @@ -33,18 +33,12 @@ enum { using namespace WebCore; -G_DEFINE_TYPE(WebKitURIRequest, webkit_uri_request, G_TYPE_OBJECT) - struct _WebKitURIRequestPrivate { WebCore::ResourceRequest resourceRequest; CString uri; }; -static void webkitURIRequestFinalize(GObject* object) -{ - WEBKIT_URI_REQUEST(object)->priv->~WebKitURIRequestPrivate(); - G_OBJECT_CLASS(webkit_uri_request_parent_class)->finalize(object); -} +WEBKIT_DEFINE_TYPE(WebKitURIRequest, webkit_uri_request, G_TYPE_OBJECT) static void webkitURIRequestGetProperty(GObject* object, guint propId, GValue* value, GParamSpec* paramSpec) { @@ -75,8 +69,6 @@ static void webkitURIRequestSetProperty(GObject* object, guint propId, const GVa static void webkit_uri_request_class_init(WebKitURIRequestClass* requestClass) { GObjectClass* objectClass = G_OBJECT_CLASS(requestClass); - - objectClass->finalize = webkitURIRequestFinalize; objectClass->get_property = webkitURIRequestGetProperty; objectClass->set_property = webkitURIRequestSetProperty; @@ -91,15 +83,6 @@ static void webkit_uri_request_class_init(WebKitURIRequestClass* requestClass) _("The URI to which the request will be made."), 0, static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY))); - - g_type_class_add_private(requestClass, sizeof(WebKitURIRequestPrivate)); -} - -static void webkit_uri_request_init(WebKitURIRequest* request) -{ - WebKitURIRequestPrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(request, WEBKIT_TYPE_URI_REQUEST, WebKitURIRequestPrivate); - request->priv = priv; - new (priv) WebKitURIRequestPrivate(); } /** diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp index d4404147b..576ce953a 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp @@ -40,8 +40,6 @@ enum { PROP_SUGGESTED_FILENAME }; -G_DEFINE_TYPE(WebKitURIResponse, webkit_uri_response, G_TYPE_OBJECT) - struct _WebKitURIResponsePrivate { ResourceResponse resourceResponse; CString uri; @@ -49,11 +47,7 @@ struct _WebKitURIResponsePrivate { CString suggestedFilename; }; -static void webkitURIResponseFinalize(GObject* object) -{ - WEBKIT_URI_RESPONSE(object)->priv->~WebKitURIResponsePrivate(); - G_OBJECT_CLASS(webkit_uri_response_parent_class)->finalize(object); -} +WEBKIT_DEFINE_TYPE(WebKitURIResponse, webkit_uri_response, G_TYPE_OBJECT) static void webkitURIResponseGetProperty(GObject* object, guint propId, GValue* value, GParamSpec* paramSpec) { @@ -83,8 +77,6 @@ static void webkitURIResponseGetProperty(GObject* object, guint propId, GValue* static void webkit_uri_response_class_init(WebKitURIResponseClass* responseClass) { GObjectClass* objectClass = G_OBJECT_CLASS(responseClass); - - objectClass->finalize = webkitURIResponseFinalize; objectClass->get_property = webkitURIResponseGetProperty; /** @@ -150,15 +142,6 @@ static void webkit_uri_response_class_init(WebKitURIResponseClass* responseClass _("The suggested filename for the URI response"), 0, WEBKIT_PARAM_READABLE)); - - g_type_class_add_private(responseClass, sizeof(WebKitURIResponsePrivate)); -} - -static void webkit_uri_response_init(WebKitURIResponse* response) -{ - WebKitURIResponsePrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(response, WEBKIT_TYPE_URI_RESPONSE, WebKitURIResponsePrivate); - response->priv = priv; - new (priv) WebKitURIResponsePrivate(); } /** diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitURISchemeRequest.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitURISchemeRequest.cpp index e2542e844..f65789fce 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitURISchemeRequest.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitURISchemeRequest.cpp @@ -35,8 +35,6 @@ using namespace WebKit; static const unsigned int gReadBufferSize = 8192; -G_DEFINE_TYPE(WebKitURISchemeRequest, webkit_uri_scheme_request, G_TYPE_OBJECT) - struct _WebKitURISchemeRequestPrivate { WebKitWebContext* webContext; RefPtr<WebSoupRequestManagerProxy> webRequestManager; @@ -53,24 +51,10 @@ struct _WebKitURISchemeRequestPrivate { CString mimeType; }; -static void webkit_uri_scheme_request_init(WebKitURISchemeRequest* request) -{ - WebKitURISchemeRequestPrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(request, WEBKIT_TYPE_URI_SCHEME_REQUEST, WebKitURISchemeRequestPrivate); - request->priv = priv; - new (priv) WebKitURISchemeRequestPrivate(); -} - -static void webkitURISchemeRequestFinalize(GObject* object) -{ - WEBKIT_URI_SCHEME_REQUEST(object)->priv->~WebKitURISchemeRequestPrivate(); - G_OBJECT_CLASS(webkit_uri_scheme_request_parent_class)->finalize(object); -} +WEBKIT_DEFINE_TYPE(WebKitURISchemeRequest, webkit_uri_scheme_request, G_TYPE_OBJECT) static void webkit_uri_scheme_request_class_init(WebKitURISchemeRequestClass* requestClass) { - GObjectClass* objectClass = G_OBJECT_CLASS(requestClass); - objectClass->finalize = webkitURISchemeRequestFinalize; - g_type_class_add_private(requestClass, sizeof(WebKitURISchemeRequestPrivate)); } WebKitURISchemeRequest* webkitURISchemeRequestCreate(WebKitWebContext* webContext, WebSoupRequestManagerProxy* webRequestManager, WebURL* webURL, WebPageProxy* initiatingPage, uint64_t requestID) diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp index 7707c70ab..3dbcfe88f 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp @@ -114,25 +114,11 @@ struct _WebKitWebContextPrivate { static guint signals[LAST_SIGNAL] = { 0, }; -G_DEFINE_TYPE(WebKitWebContext, webkit_web_context, G_TYPE_OBJECT) - -static void webkitWebContextFinalize(GObject* object) -{ - WEBKIT_WEB_CONTEXT(object)->priv->~WebKitWebContextPrivate(); - G_OBJECT_CLASS(webkit_web_context_parent_class)->finalize(object); -} - -static void webkit_web_context_init(WebKitWebContext* webContext) -{ - WebKitWebContextPrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(webContext, WEBKIT_TYPE_WEB_CONTEXT, WebKitWebContextPrivate); - webContext->priv = priv; - new (priv) WebKitWebContextPrivate(); -} +WEBKIT_DEFINE_TYPE(WebKitWebContext, webkit_web_context, G_TYPE_OBJECT) static void webkit_web_context_class_init(WebKitWebContextClass* webContextClass) { GObjectClass* gObjectClass = G_OBJECT_CLASS(webContextClass); - gObjectClass->finalize = webkitWebContextFinalize; /** * WebKitWebContext::download-started: @@ -149,8 +135,6 @@ static void webkit_web_context_class_init(WebKitWebContextClass* webContextClass g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, WEBKIT_TYPE_DOWNLOAD); - - g_type_class_add_private(webContextClass, sizeof(WebKitWebContextPrivate)); } static gpointer createDefaultWebContext(gpointer) diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebInspector.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebInspector.cpp index b788f1771..378a1f4c0 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebInspector.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebInspector.cpp @@ -47,14 +47,19 @@ enum { }; struct _WebKitWebInspectorPrivate { + ~_WebKitWebInspectorPrivate() + { + WKInspectorSetInspectorClientGtk(toAPI(webInspector.get()), 0); + } + RefPtr<WebInspectorProxy> webInspector; CString inspectedURI; unsigned attachedHeight; }; -static guint signals[LAST_SIGNAL] = { 0, }; +WEBKIT_DEFINE_TYPE(WebKitWebInspector, webkit_web_inspector, G_TYPE_OBJECT) -G_DEFINE_TYPE(WebKitWebInspector, webkit_web_inspector, G_TYPE_OBJECT) +static guint signals[LAST_SIGNAL] = { 0, }; static void webkitWebInspectorGetProperty(GObject* object, guint propId, GValue* value, GParamSpec* paramSpec) { @@ -72,29 +77,11 @@ static void webkitWebInspectorGetProperty(GObject* object, guint propId, GValue* } } -static void webkitWebInspectorFinalize(GObject* object) -{ - WebKitWebInspectorPrivate* priv = WEBKIT_WEB_INSPECTOR(object)->priv; - WKInspectorSetInspectorClientGtk(toAPI(priv->webInspector.get()), 0); - priv->~WebKitWebInspectorPrivate(); - G_OBJECT_CLASS(webkit_web_inspector_parent_class)->finalize(object); -} - -static void webkit_web_inspector_init(WebKitWebInspector* inspector) -{ - WebKitWebInspectorPrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(inspector, WEBKIT_TYPE_WEB_INSPECTOR, WebKitWebInspectorPrivate); - inspector->priv = priv; - new (priv) WebKitWebInspectorPrivate(); -} - static void webkit_web_inspector_class_init(WebKitWebInspectorClass* findClass) { GObjectClass* gObjectClass = G_OBJECT_CLASS(findClass); - gObjectClass->finalize = webkitWebInspectorFinalize; gObjectClass->get_property = webkitWebInspectorGetProperty; - g_type_class_add_private(findClass, sizeof(WebKitWebInspectorPrivate)); - /** * WebKitWebInspector:inspected-uri: * diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebResource.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebResource.cpp index 73736f68f..7a540d353 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebResource.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebResource.cpp @@ -55,15 +55,9 @@ struct _WebKitWebResourcePrivate { bool isMainResource; }; -static guint signals[LAST_SIGNAL] = { 0, }; - -G_DEFINE_TYPE(WebKitWebResource, webkit_web_resource, G_TYPE_OBJECT) +WEBKIT_DEFINE_TYPE(WebKitWebResource, webkit_web_resource, G_TYPE_OBJECT) -static void webkitWebResourceFinalize(GObject* object) -{ - WEBKIT_WEB_RESOURCE(object)->priv->~WebKitWebResourcePrivate(); - G_OBJECT_CLASS(webkit_web_resource_parent_class)->finalize(object); -} +static guint signals[LAST_SIGNAL] = { 0, }; static void webkitWebResourceGetProperty(GObject* object, guint propId, GValue* value, GParamSpec* paramSpec) { @@ -81,18 +75,10 @@ static void webkitWebResourceGetProperty(GObject* object, guint propId, GValue* } } -static void webkit_web_resource_init(WebKitWebResource* resource) -{ - WebKitWebResourcePrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(resource, WEBKIT_TYPE_WEB_RESOURCE, WebKitWebResourcePrivate); - resource->priv = priv; - new (priv) WebKitWebResourcePrivate(); -} - static void webkit_web_resource_class_init(WebKitWebResourceClass* resourceClass) { GObjectClass* objectClass = G_OBJECT_CLASS(resourceClass); objectClass->get_property = webkitWebResourceGetProperty; - objectClass->finalize = webkitWebResourceFinalize; /** * WebKitWebResource:uri: @@ -194,8 +180,6 @@ static void webkit_web_resource_class_init(WebKitWebResourceClass* resourceClass g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); - - g_type_class_add_private(resourceClass, sizeof(WebKitWebResourcePrivate)); } static void webkitWebResourceUpdateURI(WebKitWebResource* resource, const CString& requestURI) diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp index 2ff70d931..6598b6602 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp @@ -116,6 +116,16 @@ typedef HashMap<uint64_t, GRefPtr<WebKitWebResource> > LoadingResourcesMap; typedef HashMap<String, GRefPtr<WebKitWebResource> > ResourcesMap; struct _WebKitWebViewPrivate { + ~_WebKitWebViewPrivate() + { + if (javascriptGlobalContext) + JSGlobalContextRelease(javascriptGlobalContext); + + // For modal dialogs, make sure the main loop is stopped when finalizing the webView. + if (modalLoop && g_main_loop_is_running(modalLoop.get())) + g_main_loop_quit(modalLoop.get()); + } + WebKitWebContext* context; CString title; CString customTextEncoding; @@ -153,7 +163,7 @@ struct _WebKitWebViewPrivate { static guint signals[LAST_SIGNAL] = { 0, }; -G_DEFINE_TYPE(WebKitWebView, webkit_web_view, WEBKIT_TYPE_WEB_VIEW_BASE) +WEBKIT_DEFINE_TYPE(WebKitWebView, webkit_web_view, WEBKIT_TYPE_WEB_VIEW_BASE) static inline WebPageProxy* getPage(WebKitWebView* webView) { @@ -441,6 +451,7 @@ static void webkitWebViewConstructed(GObject* object) attachFormClientToView(webView); priv->backForwardList = adoptGRef(webkitBackForwardListCreate(getPage(webView)->backForwardList())); + priv->windowProperties = adoptGRef(webkitWindowPropertiesCreate()); GRefPtr<WebKitSettings> settings = adoptGRef(webkit_settings_new()); webkitWebViewSetSettings(webView, settings.get()); @@ -495,34 +506,15 @@ static void webkitWebViewGetProperty(GObject* object, guint propId, GValue* valu } } -static void webkitWebViewFinalize(GObject* object) +static void webkitWebViewDispose(GObject* object) { WebKitWebView* webView = WEBKIT_WEB_VIEW(object); - WebKitWebViewPrivate* priv = webView->priv; - - if (priv->javascriptGlobalContext) - JSGlobalContextRelease(priv->javascriptGlobalContext); - - // For modal dialogs, make sure the main loop is stopped when finalizing the webView. - if (priv->modalLoop && g_main_loop_is_running(priv->modalLoop.get())) - g_main_loop_quit(priv->modalLoop.get()); - webkitWebViewCancelFaviconRequest(webView); webkitWebViewDisconnectMainResourceResponseChangedSignalHandler(webView); webkitWebViewDisconnectSettingsSignalHandlers(webView); webkitWebViewDisconnectFaviconDatabaseSignalHandlers(webView); - priv->~WebKitWebViewPrivate(); - G_OBJECT_CLASS(webkit_web_view_parent_class)->finalize(object); -} - -static void webkit_web_view_init(WebKitWebView* webView) -{ - WebKitWebViewPrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(webView, WEBKIT_TYPE_WEB_VIEW, WebKitWebViewPrivate); - webView->priv = priv; - new (priv) WebKitWebViewPrivate(); - - webView->priv->windowProperties = adoptGRef(webkitWindowPropertiesCreate()); + G_OBJECT_CLASS(webkit_web_view_parent_class)->dispose(object); } static gboolean webkitWebViewAccumulatorObjectHandled(GSignalInvocationHint*, GValue* returnValue, const GValue* handlerReturn, gpointer) @@ -541,7 +533,7 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) gObjectClass->constructed = webkitWebViewConstructed; gObjectClass->set_property = webkitWebViewSetProperty; gObjectClass->get_property = webkitWebViewGetProperty; - gObjectClass->finalize = webkitWebViewFinalize; + gObjectClass->dispose = webkitWebViewDispose; webViewClass->load_failed = webkitWebViewLoadFail; webViewClass->create = webkitWebViewCreate; @@ -550,8 +542,6 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) webViewClass->permission_request = webkitWebViewPermissionRequest; webViewClass->run_file_chooser = webkitWebViewRunFileChooser; - g_type_class_add_private(webViewClass, sizeof(WebKitWebViewPrivate)); - /** * WebKitWebView:web-context: * diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp index 015f668cd..de741c2e3 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp @@ -80,6 +80,19 @@ void redirectedWindowDamagedCallback(void* data); #endif struct _WebKitWebViewBasePrivate { + _WebKitWebViewBasePrivate() + : imContext(adoptGRef(gtk_im_multicontext_new())) +#if USE(TEXTURE_MAPPER_GL) + , redirectedWindow(RedirectedXCompositeWindow::create(IntSize(1, 1))) +#endif + { + } + + ~_WebKitWebViewBasePrivate() + { + pageProxy->close(); + } + WebKitWebViewChildrenMap children; OwnPtr<PageClientImpl> pageClient; RefPtr<WebPageProxy> pageProxy; @@ -120,7 +133,7 @@ struct _WebKitWebViewBasePrivate { #endif }; -G_DEFINE_TYPE(WebKitWebViewBase, webkit_web_view_base, GTK_TYPE_CONTAINER) +WEBKIT_DEFINE_TYPE(WebKitWebViewBase, webkit_web_view_base, GTK_TYPE_CONTAINER) static void webkitWebViewBaseNotifyResizerSize(WebKitWebViewBase* webViewBase) { @@ -322,42 +335,29 @@ void webkitWebViewBaseChildMoveResize(WebKitWebViewBase* webView, GtkWidget* chi gtk_widget_queue_resize_no_redraw(GTK_WIDGET(webView)); } -static void webkitWebViewBaseFinalize(GObject* gobject) +static void webkitWebViewBaseDispose(GObject* gobject) { - WebKitWebViewBase* webkitWebViewBase = WEBKIT_WEB_VIEW_BASE(gobject); - WebKitWebViewBasePrivate* priv = webkitWebViewBase->priv; - priv->pageProxy->close(); - - webkitWebViewBaseSetToplevelOnScreenWindow(webkitWebViewBase, 0); - - priv->~WebKitWebViewBasePrivate(); - G_OBJECT_CLASS(webkit_web_view_base_parent_class)->finalize(gobject); + webkitWebViewBaseSetToplevelOnScreenWindow(WEBKIT_WEB_VIEW_BASE(gobject), 0); + G_OBJECT_CLASS(webkit_web_view_base_parent_class)->dispose(gobject); } -static void webkit_web_view_base_init(WebKitWebViewBase* webkitWebViewBase) +static void webkitWebViewBaseConstructed(GObject* object) { - WebKitWebViewBasePrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(webkitWebViewBase, WEBKIT_TYPE_WEB_VIEW_BASE, WebKitWebViewBasePrivate); - webkitWebViewBase->priv = priv; - new (priv) WebKitWebViewBasePrivate(); - - priv->shouldForwardNextKeyEvent = FALSE; + G_OBJECT_CLASS(webkit_web_view_base_parent_class)->constructed(object); - GtkWidget* viewWidget = GTK_WIDGET(webkitWebViewBase); + GtkWidget* viewWidget = GTK_WIDGET(object); gtk_widget_set_can_focus(viewWidget, TRUE); - priv->imContext = adoptGRef(gtk_im_multicontext_new()); - - priv->pageClient = PageClientImpl::create(viewWidget); - - priv->dragAndDropHelper.setWidget(viewWidget); - gtk_drag_dest_set(viewWidget, static_cast<GtkDestDefaults>(0), 0, 0, static_cast<GdkDragAction>(GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK | GDK_ACTION_PRIVATE)); gtk_drag_dest_set_target_list(viewWidget, PasteboardHelper::defaultPasteboardHelper()->targetList()); + WebKitWebViewBasePrivate* priv = WEBKIT_WEB_VIEW_BASE(object)->priv; + priv->pageClient = PageClientImpl::create(viewWidget); + priv->dragAndDropHelper.setWidget(viewWidget); + #if USE(TEXTURE_MAPPER_GL) - priv->redirectedWindow = RedirectedXCompositeWindow::create(IntSize(1, 1)); if (priv->redirectedWindow) - priv->redirectedWindow->setDamageNotifyCallback(redirectedWindowDamagedCallback, webkitWebViewBase); + priv->redirectedWindow->setDamageNotifyCallback(redirectedWindowDamagedCallback, object); #endif } @@ -767,14 +767,13 @@ static void webkit_web_view_base_class_init(WebKitWebViewBaseClass* webkitWebVie widgetClass->parent_set = webkitWebViewBaseParentSet; GObjectClass* gobjectClass = G_OBJECT_CLASS(webkitWebViewBaseClass); - gobjectClass->finalize = webkitWebViewBaseFinalize; + gobjectClass->constructed = webkitWebViewBaseConstructed; + gobjectClass->dispose = webkitWebViewBaseDispose; GtkContainerClass* containerClass = GTK_CONTAINER_CLASS(webkitWebViewBaseClass); containerClass->add = webkitWebViewBaseContainerAdd; containerClass->remove = webkitWebViewBaseContainerRemove; containerClass->forall = webkitWebViewBaseContainerForall; - - g_type_class_add_private(webkitWebViewBaseClass, sizeof(WebKitWebViewBasePrivate)); } WebKitWebViewBase* webkitWebViewBaseCreate(WebContext* context, WebPageGroup* pageGroup) diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBaseAccessible.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBaseAccessible.cpp index 09a11abe6..7b069dd94 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBaseAccessible.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBaseAccessible.cpp @@ -20,20 +20,14 @@ #include "config.h" #include "WebKitWebViewBaseAccessible.h" +#include "WebKitPrivate.h" #include <gtk/gtk.h> struct _WebKitWebViewBaseAccessiblePrivate { GtkWidget* widget; }; -G_DEFINE_TYPE(WebKitWebViewBaseAccessible, webkit_web_view_base_accessible, ATK_TYPE_SOCKET) - -static void webkitWebViewBaseAccessibleFinalize(GObject* gobject) -{ - WebKitWebViewBaseAccessible* accessible = WEBKIT_WEB_VIEW_BASE_ACCESSIBLE(gobject); - accessible->priv->~WebKitWebViewBaseAccessiblePrivate(); - G_OBJECT_CLASS(webkit_web_view_base_accessible_parent_class)->finalize(gobject); -} +WEBKIT_DEFINE_TYPE(WebKitWebViewBaseAccessible, webkit_web_view_base_accessible, ATK_TYPE_SOCKET) static void webkitWebViewBaseAccessibleWidgetDestroyed(GtkWidget* widget, WebKitWebViewBaseAccessible* accessible) { @@ -94,18 +88,8 @@ static gint webkitWebViewBaseAccessibleGetIndexInParent(AtkObject* atkObject) return -1; } -static void webkit_web_view_base_accessible_init(WebKitWebViewBaseAccessible* accessible) -{ - WebKitWebViewBaseAccessiblePrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(accessible, WEBKIT_TYPE_WEB_VIEW_BASE_ACCESSIBLE, WebKitWebViewBaseAccessiblePrivate); - accessible->priv = priv; - new (priv) WebKitWebViewBaseAccessiblePrivate(); -} - static void webkit_web_view_base_accessible_class_init(WebKitWebViewBaseAccessibleClass* klass) { - GObjectClass* gObjectClass = G_OBJECT_CLASS(klass); - gObjectClass->finalize = webkitWebViewBaseAccessibleFinalize; - // No need to implement get_n_children() and ref_child() here // since this is a subclass of AtkSocket and all the logic related // to those functions will be implemented by the ATK bridge. @@ -113,8 +97,6 @@ static void webkit_web_view_base_accessible_class_init(WebKitWebViewBaseAccessib atkObjectClass->initialize = webkitWebViewBaseAccessibleInitialize; atkObjectClass->ref_state_set = webkitWebViewBaseAccessibleRefStateSet; atkObjectClass->get_index_in_parent = webkitWebViewBaseAccessibleGetIndexInParent; - - g_type_class_add_private(klass, sizeof(WebKitWebViewBaseAccessiblePrivate)); } WebKitWebViewBaseAccessible* webkitWebViewBaseAccessibleNew(GtkWidget* widget) diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWindowProperties.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWindowProperties.cpp index 930cf8676..bdfc72589 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWindowProperties.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWindowProperties.cpp @@ -106,8 +106,6 @@ enum { PROP_FULLSCREEN }; -G_DEFINE_TYPE(WebKitWindowProperties, webkit_window_properties, G_TYPE_OBJECT) - struct _WebKitWindowPropertiesPrivate { GdkRectangle geometry; @@ -121,11 +119,7 @@ struct _WebKitWindowPropertiesPrivate { bool fullscreen : 1; }; -static void webkitWindowPropertiesFinalize(GObject* object) -{ - WEBKIT_WINDOW_PROPERTIES(object)->priv->~WebKitWindowPropertiesPrivate(); - G_OBJECT_CLASS(webkit_window_properties_parent_class)->finalize(object); -} +WEBKIT_DEFINE_TYPE(WebKitWindowProperties, webkit_window_properties, G_TYPE_OBJECT) static void webkitWindowPropertiesGetProperty(GObject* object, guint propId, GValue* value, GParamSpec* paramSpec) { @@ -199,8 +193,6 @@ static void webkitWindowPropertiesSetProperty(GObject* object, guint propId, con static void webkit_window_properties_class_init(WebKitWindowPropertiesClass* requestClass) { GObjectClass* objectClass = G_OBJECT_CLASS(requestClass); - - objectClass->finalize = webkitWindowPropertiesFinalize; objectClass->get_property = webkitWindowPropertiesGetProperty; objectClass->set_property = webkitWindowPropertiesSetProperty; @@ -308,15 +300,6 @@ static void webkit_window_properties_class_init(WebKitWindowPropertiesClass* req _("Whether window will be displayed fullscreen."), FALSE, paramFlags)); - - g_type_class_add_private(requestClass, sizeof(WebKitWindowPropertiesPrivate)); -} - -static void webkit_window_properties_init(WebKitWindowProperties* request) -{ - WebKitWindowPropertiesPrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(request, WEBKIT_TYPE_WINDOW_PROPERTIES, WebKitWindowPropertiesPrivate); - request->priv = priv; - new (priv) WebKitWindowPropertiesPrivate(); } WebKitWindowProperties* webkitWindowPropertiesCreate() diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp index 29ba92994..305882edd 100644 --- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp +++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp @@ -48,37 +48,12 @@ namespace WebKit { using namespace WebCore; -template<class T> class MainThreadGuardedInvoker { -public: - static void call(PassRefPtr<T> objectToGuard, const Function<void()>& function) - { - MainThreadGuardedInvoker<T>* invoker = new MainThreadGuardedInvoker<T>(objectToGuard, function); - callOnMainThread(invoke, invoker); - } - -private: - MainThreadGuardedInvoker(PassRefPtr<T> object, const Function<void()>& newFunction) - : objectToGuard(object) - , function(newFunction) - { - } - - RefPtr<T> objectToGuard; - Function<void()> function; - static void invoke(void* data) - { - MainThreadGuardedInvoker<T>* invoker = static_cast<MainThreadGuardedInvoker<T>*>(data); - invoker->function(); - delete invoker; - } -}; - void LayerTreeRenderer::dispatchOnMainThread(const Function<void()>& function) { if (isMainThread()) function(); else - MainThreadGuardedInvoker<LayerTreeRenderer>::call(this, function); + callOnMainThread(function); } static FloatPoint boundedScrollPosition(const FloatPoint& scrollPosition, const FloatRect& visibleContentRect, const FloatSize& contentSize) @@ -99,10 +74,10 @@ LayerTreeRenderer::LayerTreeRenderer(LayerTreeCoordinatorProxy* layerTreeCoordin #if ENABLE(REQUEST_ANIMATION_FRAME) , m_animationFrameRequested(false) #endif - , m_accelerationMode(TextureMapper::OpenGLMode) , m_backgroundColor(Color::white) , m_setDrawsBackground(false) { + ASSERT(isMainThread()); } LayerTreeRenderer::~LayerTreeRenderer() @@ -171,6 +146,7 @@ void LayerTreeRenderer::paintToCurrentGLContext(const TransformationMatrix& matr #if ENABLE(REQUEST_ANIMATION_FRAME) void LayerTreeRenderer::animationFrameReady() { + ASSERT(isMainThread()); if (m_layerTreeCoordinatorProxy) m_layerTreeCoordinatorProxy->animationFrameReady(); } @@ -216,6 +192,7 @@ void LayerTreeRenderer::setVisibleContentsRect(const FloatRect& rect) void LayerTreeRenderer::updateViewport() { + ASSERT(isMainThread()); if (m_layerTreeCoordinatorProxy) m_layerTreeCoordinatorProxy->updateViewport(); } @@ -573,6 +550,7 @@ void LayerTreeRenderer::flushLayerChanges() void LayerTreeRenderer::renderNextFrame() { + ASSERT(isMainThread()); if (m_layerTreeCoordinatorProxy) m_layerTreeCoordinatorProxy->renderNextFrame(); } @@ -615,6 +593,7 @@ void LayerTreeRenderer::syncRemoteContent() void LayerTreeRenderer::purgeGLResources() { + ASSERT(isMainThread()); TextureMapperLayer* layer = toTextureMapperLayer(rootLayer()); if (layer) @@ -634,8 +613,8 @@ void LayerTreeRenderer::purgeGLResources() m_backingStoresWithPendingBuffers.clear(); setActive(false); - - dispatchOnMainThread(bind(&LayerTreeRenderer::purgeBackingStores, this)); + if (m_layerTreeCoordinatorProxy) + m_layerTreeCoordinatorProxy->purgeBackingStores(); } void LayerTreeRenderer::setLayerAnimations(WebLayerID id, const GraphicsLayerAnimations& animations) @@ -662,14 +641,9 @@ void LayerTreeRenderer::setAnimationsLocked(bool locked) m_animationsLocked = locked; } -void LayerTreeRenderer::purgeBackingStores() -{ - if (m_layerTreeCoordinatorProxy) - m_layerTreeCoordinatorProxy->purgeBackingStores(); -} - void LayerTreeRenderer::detach() { + ASSERT(isMainThread()); m_layerTreeCoordinatorProxy = 0; } @@ -685,6 +659,7 @@ void LayerTreeRenderer::appendUpdate(const Function<void()>& function) void LayerTreeRenderer::setActive(bool active) { + ASSERT(isMainThread()); if (m_isActive == active) return; diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h index 6c203f2d5..40333cfa1 100644 --- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h +++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h @@ -114,12 +114,6 @@ public: void animationFrameReady(); #endif - void setAccelerationMode(WebCore::TextureMapper::AccelerationMode mode) - { - // The acceleration mode is set only before TextureMapper was created. - ASSERT(!m_textureMapper); - m_accelerationMode = mode; - } private: PassOwnPtr<WebCore::GraphicsLayer> createLayer(WebLayerID); @@ -131,7 +125,8 @@ private: // Reimplementations from WebCore::GraphicsLayerClient. virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double) { } virtual void notifyFlushRequired(const WebCore::GraphicsLayer*) { } - void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect&) { } + virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect&) OVERRIDE { } + void updateViewport(); void dispatchOnMainThread(const Function<void()>&); void adjustPositionForFixedLayers(); @@ -142,7 +137,6 @@ private: void ensureLayer(WebLayerID); void commitTileOperations(); void renderNextFrame(); - void purgeBackingStores(); PassRefPtr<CoordinatedBackingStore> getBackingStore(WebCore::GraphicsLayer*); void removeBackingStoreIfNeeded(WebCore::GraphicsLayer*); @@ -182,7 +176,6 @@ private: #if ENABLE(REQUEST_ANIMATION_FRAME) bool m_animationFrameRequested; #endif - WebCore::TextureMapper::AccelerationMode m_accelerationMode; WebCore::Color m_backgroundColor; bool m_setDrawsBackground; diff --git a/Source/WebKit2/UIProcess/Launcher/efl/ProcessLauncherEfl.cpp b/Source/WebKit2/UIProcess/Launcher/efl/ProcessLauncherEfl.cpp index 23d213545..83bb3ba49 100644 --- a/Source/WebKit2/UIProcess/Launcher/efl/ProcessLauncherEfl.cpp +++ b/Source/WebKit2/UIProcess/Launcher/efl/ProcessLauncherEfl.cpp @@ -49,9 +49,11 @@ void ProcessLauncher::launchProcess() case WebProcess: executablePath = executablePathOfWebProcess(); break; +#if ENABLE(PLUGIN_PROCESS) case PluginProcess: executablePath = executablePathOfPluginProcess(); break; +#endif default: ASSERT_NOT_REACHED(); return; diff --git a/Source/WebKit2/UIProcess/PageViewportController.cpp b/Source/WebKit2/UIProcess/PageViewportController.cpp index 35f361cad..5de791920 100644 --- a/Source/WebKit2/UIProcess/PageViewportController.cpp +++ b/Source/WebKit2/UIProcess/PageViewportController.cpp @@ -219,8 +219,7 @@ void PageViewportController::didChangeViewportAttributes(const WebCore::Viewport m_rawAttributes = newAttributes; m_allowsUserScaling = !!m_rawAttributes.userScalable; - if (!updateMinimumScaleToFit()) - return; + bool minimumScaleUpdated = updateMinimumScaleToFit(); ASSERT(m_minimumScaleToFit > 0); @@ -230,7 +229,8 @@ void PageViewportController::didChangeViewportAttributes(const WebCore::Viewport WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(m_rawAttributes); - m_client->didChangeViewportAttributes(); + if (minimumScaleUpdated) + m_client->didChangeViewportAttributes(); } WebCore::FloatSize PageViewportController::viewportSizeInContentsCoordinates() const diff --git a/Source/WebKit2/UIProcess/efl/PageClientBase.cpp b/Source/WebKit2/UIProcess/efl/PageClientBase.cpp index 0ce82aae4..b3d511b2e 100644 --- a/Source/WebKit2/UIProcess/efl/PageClientBase.cpp +++ b/Source/WebKit2/UIProcess/efl/PageClientBase.cpp @@ -70,10 +70,6 @@ EwkViewImpl* PageClientBase::viewImpl() const PassOwnPtr<DrawingAreaProxy> PageClientBase::createDrawingAreaProxy() { OwnPtr<DrawingAreaProxy> drawingArea = DrawingAreaProxyImpl::create(m_viewImpl->page()); -#if USE(ACCELERATED_COMPOSITING) - if (!m_viewImpl->isHardwareAccelerated()) - drawingArea->layerTreeCoordinatorProxy()->layerTreeRenderer()->setAccelerationMode(TextureMapper::SoftwareMode); -#endif return drawingArea.release(); } diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp index 95273a704..e7d5611f0 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp @@ -77,6 +77,11 @@ void WKBundleActivateMacFontAscentHack(WKBundleRef bundleRef) toImpl(bundleRef)->activateMacFontAscentHack(); } +void WKBundleSetCacheModel(WKBundleRef bundleRef, uint32_t cacheModel) +{ + toImpl(bundleRef)->setCacheModel(cacheModel); +} + void WKBundleGarbageCollectJavaScriptObjects(WKBundleRef bundleRef) { toImpl(bundleRef)->garbageCollectJavaScriptObjects(); diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp index 53ddf6107..005811ac0 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp @@ -30,13 +30,19 @@ #include "InjectedBundleBackForwardList.h" #include "InjectedBundleNodeHandle.h" #include "WKAPICast.h" +#include "WKArray.h" #include "WKBundleAPICast.h" +#include "WKRetainPtr.h" +#include "WKString.h" +#include "WebContextMenu.h" +#include "WebContextMenuItem.h" #include "WebFrame.h" #include "WebFullScreenManager.h" #include "WebImage.h" #include "WebPage.h" #include "WebRenderLayer.h" #include "WebRenderObject.h" +#include "WebString.h" #include "WebURL.h" #include "WebURLRequest.h" @@ -145,6 +151,22 @@ WKBundleFrameRef WKBundlePageGetMainFrame(WKBundlePageRef pageRef) return toAPI(toImpl(pageRef)->mainWebFrame()); } +WKArrayRef WKBundlePageCopyContextMenuItemTitles(WKBundlePageRef pageRef) +{ +#if ENABLE(CONTEXT_MENUS) + WebContextMenu* contextMenu = toImpl(pageRef)->contextMenu(); + const Vector<WebContextMenuItemData> &items = contextMenu->items(); + size_t arrayLength = items.size(); + OwnArrayPtr<WKTypeRef> itemNames = adoptArrayPtr(new WKTypeRef[arrayLength]); + for (size_t i = 0; i < arrayLength; ++i) + itemNames[i] = WKStringCreateWithUTF8CString(items[i].title().utf8().data()); + + return WKArrayCreateAdoptingValues(itemNames.get(), arrayLength); +#else + return 0; +#endif +} + void* WKAccessibilityRootObject(WKBundlePageRef pageRef) { #if HAVE(ACCESSIBILITY) diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h index 11b20dc93..d769fb4c1 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h @@ -77,6 +77,8 @@ WK_EXPORT bool WKBundlePageCanShowMIMEType(WKBundlePageRef, WKStringRef mimeType WK_EXPORT void* WKAccessibilityRootObject(WKBundlePageRef); WK_EXPORT void* WKAccessibilityFocusedObject(WKBundlePageRef); +WK_EXPORT WKArrayRef WKBundlePageCopyContextMenuItemTitles(WKBundlePageRef); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h index 15b2e7c85..2cacb5976 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h @@ -41,6 +41,7 @@ WK_EXPORT void WKBundleSetShouldTrackVisitedLinks(WKBundleRef bundle, bool shoul WK_EXPORT void WKBundleSetAlwaysAcceptCookies(WKBundleRef bundle, bool); WK_EXPORT void WKBundleRemoveAllVisitedLinks(WKBundleRef bundle); WK_EXPORT void WKBundleActivateMacFontAscentHack(WKBundleRef bundle); +WK_EXPORT void WKBundleSetCacheModel(WKBundleRef bundle, uint32_t cacheModel); // Will make WebProcess ignore this preference until a preferences change notification, only for WebKitTestRunner use. WK_EXPORT void WKBundleOverrideBoolPreferenceForTestRunner(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKStringRef preference, bool enabled); WK_EXPORT void WKBundleSetAllowUniversalAccessFromFileURLs(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp index 317911a9d..1b2c83099 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp @@ -141,6 +141,11 @@ void InjectedBundle::removeAllVisitedLinks() PageGroup::removeAllVisitedLinks(); } +void InjectedBundle::setCacheModel(uint32_t cacheModel) +{ + WebProcess::shared().setCacheModel(cacheModel); +} + void InjectedBundle::overrideBoolPreferenceForTestRunner(WebPageGroupProxy* pageGroup, const String& preference, bool enabled) { const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroup->identifier())->pages(); diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h index c621f2483..fd716d3d3 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h @@ -107,6 +107,7 @@ public: void setShouldTrackVisitedLinks(bool); void setAlwaysAcceptCookies(bool); void removeAllVisitedLinks(); + void setCacheModel(uint32_t); void activateMacFontAscentHack(); void overrideBoolPreferenceForTestRunner(WebPageGroupProxy*, const String& preference, bool enabled); void overrideXSSAuditorEnabledForTestRunner(WebPageGroupProxy* pageGroup, bool enabled); diff --git a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp index c167d3abb..e5639cf79 100644 --- a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp +++ b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp @@ -748,7 +748,7 @@ void CoordinatedGraphicsLayer::removeTile(int tileID) void CoordinatedGraphicsLayer::updateContentBuffers() { - if (!drawsContent()) { + if (!drawsContent() || !contentsAreVisible() || m_size.isEmpty()) { m_mainBackingStore.clear(); m_previousBackingStore.clear(); return; diff --git a/Source/WebKit2/WebProcess/WebPage/WebContextMenu.cpp b/Source/WebKit2/WebProcess/WebPage/WebContextMenu.cpp index 3273bdc09..d21af0301 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebContextMenu.cpp +++ b/Source/WebKit2/WebProcess/WebPage/WebContextMenu.cpp @@ -66,6 +66,32 @@ void WebContextMenu::show() if (!view) return; + Vector<WebContextMenuItemData> menuItems; + RefPtr<APIObject> userData; + menuItemsWithUserData(menuItems, userData); + WebHitTestResult::Data webHitTestResultData(controller->hitTestResult()); + + // Mark the WebPage has having a shown context menu then notify the UIProcess. + m_page->contextMenuShowing(); + m_page->send(Messages::WebPageProxy::ShowContextMenu(view->contentsToWindow(controller->hitTestResult().roundedPointInInnerNodeFrame()), webHitTestResultData, menuItems, InjectedBundleUserMessageEncoder(userData.get()))); +} + +void WebContextMenu::itemSelected(const WebContextMenuItemData& item) +{ + ContextMenuItem coreItem(ActionType, static_cast<ContextMenuAction>(item.action()), item.title()); + m_page->corePage()->contextMenuController()->contextMenuItemSelected(&coreItem); +} + +void WebContextMenu::menuItemsWithUserData(Vector<WebContextMenuItemData> &menuItems, RefPtr<APIObject>& userData) const +{ + ContextMenuController* controller = m_page->corePage()->contextMenuController(); + if (!controller) + return; + + ContextMenu* menu = controller->contextMenu(); + if (!menu) + return; + // Give the bundle client a chance to process the menu. #if USE(CROSS_PLATFORM_CONTEXT_MENUS) const Vector<ContextMenuItem>& coreItems = menu->items(); @@ -74,22 +100,18 @@ void WebContextMenu::show() #endif Vector<WebContextMenuItemData> proposedMenu = kitItems(coreItems, menu); Vector<WebContextMenuItemData> newMenu; - RefPtr<APIObject> userData; RefPtr<InjectedBundleHitTestResult> hitTestResult = InjectedBundleHitTestResult::create(controller->hitTestResult()); if (m_page->injectedBundleContextMenuClient().getCustomMenuFromDefaultItems(m_page, hitTestResult.get(), proposedMenu, newMenu, userData)) proposedMenu = newMenu; - - WebHitTestResult::Data webHitTestResultData(controller->hitTestResult()); - - // Mark the WebPage has having a shown context menu then notify the UIProcess. - m_page->contextMenuShowing(); - m_page->send(Messages::WebPageProxy::ShowContextMenu(view->contentsToWindow(controller->hitTestResult().roundedPointInInnerNodeFrame()), webHitTestResultData, proposedMenu, InjectedBundleUserMessageEncoder(userData.get()))); + menuItems = proposedMenu; } -void WebContextMenu::itemSelected(const WebContextMenuItemData& item) +Vector<WebContextMenuItemData> WebContextMenu::items() const { - ContextMenuItem coreItem(ActionType, static_cast<ContextMenuAction>(item.action()), item.title()); - m_page->corePage()->contextMenuController()->contextMenuItemSelected(&coreItem); + Vector<WebContextMenuItemData> menuItems; + RefPtr<APIObject> userData; + menuItemsWithUserData(menuItems, userData); + return menuItems; } } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebPage/WebContextMenu.h b/Source/WebKit2/WebProcess/WebPage/WebContextMenu.h index c8a5f5a46..b4fa66ee3 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebContextMenu.h +++ b/Source/WebKit2/WebProcess/WebPage/WebContextMenu.h @@ -43,10 +43,12 @@ public: void show(); void itemSelected(const WebContextMenuItemData&); + Vector<WebContextMenuItemData> items() const; private: WebContextMenu(WebPage*); - + void menuItemsWithUserData(Vector<WebContextMenuItemData>&, RefPtr<APIObject>&) const; + WebPage* m_page; }; diff --git a/Source/WebKit2/WebProcess/WebProcess.h b/Source/WebKit2/WebProcess/WebProcess.h index eddccc153..82e6cc8f2 100644 --- a/Source/WebKit2/WebProcess/WebProcess.h +++ b/Source/WebKit2/WebProcess/WebProcess.h @@ -208,6 +208,8 @@ public: WebResourceLoadScheduler& webResourceLoadScheduler() { return m_webResourceLoadScheduler; } #endif + void setCacheModel(uint32_t); + private: WebProcess(); @@ -234,7 +236,6 @@ private: void visitedLinkStateChanged(const Vector<WebCore::LinkHash>& linkHashes); void allVisitedLinkStateChanged(); - void setCacheModel(uint32_t); void platformSetCacheModel(CacheModel); static void calculateCacheSizes(CacheModel cacheModel, uint64_t memorySize, uint64_t diskFreeSize, unsigned& cacheTotalCapacity, unsigned& cacheMinDeadCapacity, unsigned& cacheMaxDeadCapacity, double& deadDecodedDataDeletionInterval, diff --git a/Source/WebKit2/qt/MainQt.cpp b/Source/WebKit2/qt/MainQt.cpp index 1e1ce2b3d..17ad8537d 100644 --- a/Source/WebKit2/qt/MainQt.cpp +++ b/Source/WebKit2/qt/MainQt.cpp @@ -42,8 +42,8 @@ typedef QApplication ApplicationType; namespace WebKit { Q_DECL_IMPORT int WebProcessMainQt(QGuiApplication*); -#if defined(HAVE_WEBKIT1) -Q_DECL_IMPORT void initializeWebKit2Theme(); +#if !defined(QT_NO_WIDGETS) +Q_DECL_IMPORT void initializeWebKitWidgets(); #endif } @@ -82,15 +82,20 @@ int main(int argc, char** argv) } #endif -#if defined(HAVE_WEBKIT1) - WebKit::initializeWebKit2Theme(); -#endif - // Has to be done before QApplication is constructed in case // QApplication itself produces debug output. QByteArray suppressOutput = qgetenv("QT_WEBKIT_SUPPRESS_WEB_PROCESS_OUTPUT"); if (!suppressOutput.isEmpty() && suppressOutput != "0") qInstallMessageHandler(messageHandler); - return WebKit::WebProcessMainQt(new ApplicationType(argc, argv)); + // QApplication must be created before we call initializeWebKitWidgets() so that + // the standard pixmaps can be fetched from the style. + ApplicationType* appInstance = new ApplicationType(argc, argv); + +#if !defined(QT_NO_WIDGETS) + if (qgetenv("QT_WEBKIT_THEME_NAME") == "qstyle") + WebKit::initializeWebKitWidgets(); +#endif + + return WebKit::WebProcessMainQt(appInstance); } diff --git a/Source/api.pri b/Source/api.pri index a47b7359d..f6c3c3c75 100644 --- a/Source/api.pri +++ b/Source/api.pri @@ -14,12 +14,15 @@ WEBKIT_DESTDIR = $${ROOT_BUILD_DIR}/lib WEBKIT += wtf javascriptcore webcore -build?(webkit1): WEBKIT += webkit1 +build?(webkit1): WEBKIT += webkitwidgets webkit1 build?(webkit2): WEBKIT += webkit2 # Ensure that changes to the WebKit1 and WebKit2 API will trigger a qmake of this # file, which in turn runs syncqt to update the forwarding headers. -build?(webkit1): QMAKE_INTERNAL_INCLUDED_FILES *= WebKit/WebKit1.pro +build?(webkit1): { + QMAKE_INTERNAL_INCLUDED_FILES *= WebKit/WebKit1.pro + QMAKE_INTERNAL_INCLUDED_FILES *= WebKit/WebKitWidgets.pro +} build?(webkit2): QMAKE_INTERNAL_INCLUDED_FILES *= WebKit2/Target.pri use?(3D_GRAPHICS): WEBKIT += angle diff --git a/Source/cmake/FindATK.cmake b/Source/cmake/FindATK.cmake new file mode 100644 index 000000000..c58ba92bb --- /dev/null +++ b/Source/cmake/FindATK.cmake @@ -0,0 +1,44 @@ +# - Try to find ATK +# Once done, this will define +# +# ATK_INCLUDE_DIRS - the ATK include drectories +# ATK_LIBRARIES - link these to use ATK +# +# Copyright (C) 2012 Samsung Electronics +# +# 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 THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``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 THE COPYRIGHT HOLDER OR ITS +# 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. + +FIND_PACKAGE(PkgConfig) +PKG_CHECK_MODULES(PC_ATK atk) + +FIND_PATH(ATK_INCLUDE_DIRS + NAMES atk/atk.h + HINTS ${PC_ATK_INCLUDEDIR} + ${PC_ATK_INCLUDE_DIRS} + PATH_SUFFIXES atk-1.0 +) + +FIND_LIBRARY(ATK_LIBRARIES + NAMES atk-1.0 + HINTS ${PC_ATK_LIBRARY_DIRS} + ${PC_ATK_LIBDIR} +) diff --git a/Source/cmake/OptionsEfl.cmake b/Source/cmake/OptionsEfl.cmake index ebc94e63d..6a287f3ce 100644 --- a/Source/cmake/OptionsEfl.cmake +++ b/Source/cmake/OptionsEfl.cmake @@ -192,3 +192,5 @@ ENDIF() IF (ENABLE_SPELLCHECK) FIND_PACKAGE(Enchant REQUIRED) ENDIF() + +FIND_PACKAGE(ATK REQUIRED) diff --git a/Tools/ChangeLog b/Tools/ChangeLog index fbacc95f3..59f37ca69 100644 --- a/Tools/ChangeLog +++ b/Tools/ChangeLog @@ -1,3 +1,277 @@ +2012-11-23 Sudarsana Nagineni <sudarsana.nagineni@intel.com> + + [EFL][WK2] Add support for PlatformWebView::simulateSpacebarKeyPress() in TestWebKitAPI + https://bugs.webkit.org/show_bug.cgi?id=103123 + + Reviewed by Kenneth Rohde Christiansen. + + Add support for PlatformWebView::simulateSpacebarKeyPress() and enable + WebKit2 API test ResponsivenessTimerDoesntFireEarly. + + * TestWebKitAPI/PlatformEfl.cmake: Enable ResponsivenessTimerDoesntFireEarly + test. + * TestWebKitAPI/efl/PlatformUtilities.cpp: + (TestWebKitAPI::Util::sleep): Use usleep() instead of sleep since the + test case is passing 0.5 seconds to sleep. + * TestWebKitAPI/efl/PlatformWebView.cpp: + (TestWebKitAPI::PlatformWebView::simulateSpacebarKeyPress): Implemented. + (TestWebKitAPI): + +2012-11-23 Wojciech Bielawski <w.bielawski@samsung.com> + + [WK2][WKTR] WebKitTestRunner needs eventSender.contextClick() + https://bugs.webkit.org/show_bug.cgi?id=86881 + + Reviewed by Kenneth Rohde Christiansen. + + eventSender object extended with contextClick() method in WebKitTestRunner. + contextClick() method returns an array of menu items objects with field 'title' containing title of single + context menu entry. According to some tests menu items objects shall also support 'click()' method, but it's not + delivered in this patch. + + * WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl: + * WebKitTestRunner/InjectedBundle/EventSendingController.cpp: + (WTR::EventSendingController::contextClick): + (WTR): + * WebKitTestRunner/InjectedBundle/EventSendingController.h: + (EventSendingController): + +2012-11-23 Simon Hausmann <simon.hausmann@digia.com> + + [Qt] Compiling against QtWebkit API requires QT_DLL to be defined + https://bugs.webkit.org/show_bug.cgi?id=102942 + + Reviewed by Tor Arne Vestbø. + + Remove the requirement of having QT_DLL defined in order for the QWEBKIT_EXPORT + macro to be defined as Q_DECL_IMPORT. Instead unify the export macro definition + to follow the same rules as other Qt 5 modules, with the exception that instead of + QT_BUILD_WEBKIT_LIB we continue to use BUILDING_WEBKIT, because that's used also + in other cross-platform header files to determine the correct meaning of export + macros. + + * qmake/mkspecs/features/default_post.prf: + * qmake/mkspecs/features/win32/default_post.prf: + +2012-11-23 Simon Hausmann <simon.hausmann@digia.com> + + [Qt] QWebPage::shouldInterruptJavaScript should be virtual in Qt 5 + https://bugs.webkit.org/show_bug.cgi?id=103111 + + Reviewed by Kenneth Rohde Christiansen. + + This function was added as a slot during Qt 4.x times because adding + virtual functions breaks binary compatibility. This constraint is gone + with the initial release of WebKit with Qt 5, and therefore we can + make it virtual now. + + The change is fully source compatible as existing "re-implementations" + as slots will now be called through it being a virtual function. They + become unused slots. + + * DumpRenderTree/qt/DumpRenderTreeQt.h: + (WebCore::WebPage::shouldInterruptJavaScript): + (WebPage): + * QtTestBrowser/webpage.h: + (WebPage): + +2012-11-22 Peter Beverloo <peter@chromium.org> + + [Chromium] Return an accurate exit code when running Android suites, and wait after restarting adb as root + https://bugs.webkit.org/show_bug.cgi?id=103065 + + Reviewed by Dirk Pranke. + + This addresses two further reliability issues in the Android test running + scripts. Firstly, the run_tests.py script needs to have the --exit_code + argument passed in order to return non-zero codes, which we need for the + build master to distinguish failures from successful runs. + + Secondly, it modifies the layout test runner to briefly wait (through + the wait-for-device command) after requesting a device to switch to root + mode. Without this waiting period, commands might get lost and thereby + unexpectedly fail. + + * Scripts/run-api-tests: + * Scripts/run-chromium-webkit-unit-tests: + * Scripts/webkitpy/layout_tests/port/chromium_android.py: + (ChromiumAndroidDriver._setup_test): + (ChromiumAndroidDriver._restart_adb_as_root): + +2012-11-22 Simon Hausmann <simon.hausmann@digia.com>, Pierre Rossi <pierre.rossi@digia.com> + + [Qt] Separate QWidget dependant code into separate WebKitWidgets static library + https://bugs.webkit.org/show_bug.cgi?id=102800 + + Reviewed by Tor Arne Vestbø. + + This patch separates code that needs to use QWidget related APIs in + WebKit/qt/WebCoreSupport and Api from code that doesn't. This means for + example FrameLoaderClientQt.cpp remains in the WebKit1 static library, + while qwebpage.cpp and qwebframe.cpp become part of the WebKitWidgets + static library. WebKit1 is compiled without QT += widgets and therefore + any widget related dependency has been moved "up" and out of WebKit1 into + the WebKitWidgets library. + + Between the code in WebKit.a and WebKitWidgets.a new adapters and + interfaces have been introduced, such as QWebPageAdapter and + QWebFrameAdapter. QWebPageAdapter, when used from WebKit1, is a way to + call out into the API layer, implemented by QWebPage (QWebPagePrivate). + The other way around if QWebPage wants to access WebCore or + WebCoreSupport related functionality, it will go through + QWebPageAdapater (as base class). The separation in the direction up + into the API layer is complete with this patch, no code in WebKit1 + depends on QtWidgets. The separation the other way around, code in the + API layer not using any WebCore types, is not complete yet. + + Some classes such as QWebSettings, QWebElement or + DumpRenderTreeSupportQt remain in WebKit1. While they are API layer, + they do not depend on widget related Qt APIs and they make much more + use of WebCore internal APIs and therefore are easier to keep in + WebKit1. + + In the future we plan to place a real shared library boundary between + WebKit1 and WebKitWidgets, by keeping the WebKit1 static library as + part of the QtWebKit shared library and by turning the WebKitWidgets + static library into a shared one. + + * DumpRenderTree/qt/DumpRenderTreeQt.cpp: + (WebCore::WebPage::resetSettings): + (WebCore::WebPage::createWindow): + (WebCore::DumpRenderTree::DumpRenderTree): + (WebCore::DumpRenderTree::resetToConsistentStateBeforeTesting): + (WebCore::DumpRenderTree::initJSObjects): + (WebCore::DumpRenderTree::dumpFrameScrollPosition): + (WebCore::DumpRenderTree::dumpFramesAsText): + (WebCore::DumpRenderTree::dump): + (WebCore::DumpRenderTree::createWindow): + (WebCore::DumpRenderTree::pageAdapter): + (WebCore): + (WebCore::DumpRenderTree::mainFrameAdapter): + * DumpRenderTree/qt/DumpRenderTreeQt.h: + (DumpRenderTree): + * DumpRenderTree/qt/EventSenderQt.cpp: + (EventSender::contextClick): + (EventSender::scalePageBy): + * DumpRenderTree/qt/TestRunnerQt.cpp: + (TestRunner::reset): + (TestRunner::display): + (TestRunner::closeWebInspector): + (TestRunner::showWebInspector): + (TestRunner::evaluateInWebInspector): + (TestRunner::setFrameFlatteningEnabled): + (TestRunner::goBack): + (TestRunner::setDefersLoading): + (TestRunner::pauseAnimationAtTimeOnElementWithId): + (TestRunner::pauseTransitionAtTimeOnElementWithId): + (TestRunner::numberOfActiveAnimations): + (TestRunner::setCaretBrowsingEnabled): + (TestRunner::setAuthorAndUserStylesEnabled): + (TestRunner::callShouldCloseOnWebView): + (TestRunner::setSmartInsertDeleteEnabled): + (TestRunner::setSelectTrailingWhitespaceEnabled): + (TestRunner::execCommand): + (TestRunner::isCommandEnabled): + (TestRunner::findString): + (TestRunner::elementDoesAutoCompleteForElementWithId): + (TestRunner::setMockDeviceOrientation): + (TestRunner::setGeolocationPermission): + (TestRunner::numberOfPendingGeolocationPermissionRequests): + (TestRunner::setMockGeolocationPositionUnavailableError): + (TestRunner::setMockGeolocationPosition): + (TestRunner::evaluateScriptInIsolatedWorld): + (TestRunner::addUserStyleSheet): + (TestRunner::setMinimumTimerInterval): + * DumpRenderTree/qt/TextInputControllerQt.cpp: + (TextInputController::selectedRange): + (TextInputController::firstRectForCharacterRange): + (TextInputController::unmarkText): + * DumpRenderTree/qt/WorkQueueItemQt.cpp: + (LoadAlternateHTMLStringItem::invoke): + * qmake/mkspecs/features/default_post.prf: + * qmake/mkspecs/features/production_build.prf: + * qmake/mkspecs/features/webkit_modules.prf: + * qmake/mkspecs/modules/webkitwidgets.prf: Added. + +2012-11-22 Christophe Dumez <christophe.dumez@intel.com> + + WebKitTestRunner needs layoutTestController.setCacheModel + https://bugs.webkit.org/show_bug.cgi?id=42684 + + Reviewed by Kenneth Rohde Christiansen. + + Add support for testRunner.setCacheModel to WebKitTestRunner. + + * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: + * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: + (WTR::InjectedBundle::beginTesting): + * WebKitTestRunner/InjectedBundle/TestRunner.cpp: + (WTR::TestRunner::setCacheModel): + (WTR): + * WebKitTestRunner/InjectedBundle/TestRunner.h: + (TestRunner): + +2012-11-22 Balazs Kelemen <kbalazs@webkit.org> + + [Qt][WTR] TestController::platformRunUntil should not do busy waiting + https://bugs.webkit.org/show_bug.cgi?id=101327 + + Reviewed by Simon Hausmann. + + Avoid busy waiting for events in platformRunUntil while making + sure we don't change the behavior of modal event loops. + + * WebKitTestRunner/TestController.cpp: + (WTR::TestController::~TestController): + * WebKitTestRunner/TestController.h: + (TestController): + * WebKitTestRunner/efl/TestControllerEfl.cpp: + (WTR::TestController::platformDestroy): + (WTR): + * WebKitTestRunner/gtk/TestControllerGtk.cpp: + (WTR::TestController::platformDestroy): + (WTR): + * WebKitTestRunner/mac/TestControllerMac.mm: + (WTR::TestController::platformDestroy): + (WTR): + * WebKitTestRunner/qt/TestControllerQt.cpp: + (TestController::RunLoop): Helper class to handle + the event loop logic + (WTR): + (WTR::TestController::RunLoop::RunLoop): + (WTR::TestController::RunLoop::runUntil): Use QEventLoop to implement + the run loop. This is the appropriate API to push the WaitForMoreEvents + flag to QCoreApplication::processEvents and also being able to exit the + loop if we have timed out. + (WTR::TestController::RunLoop::notifyDone): + (WTR::TestController::RunLoop::timerFired): + (WTR::TestController::RunLoop::runModal): + (WTR::TestController::notifyDone): + (WTR::TestController::platformInitialize): + (WTR::TestController::platformDestroy): + (WTR::TestController::platformRunUntil): + (WTR::TestController::runModal): + * WebKitTestRunner/win/TestControllerWin.cpp: + (WTR::TestController::platformDestroy): + (WTR): + +2012-11-22 Sudarsana Nagineni <sudarsana.nagineni@intel.com> + + [EFL][WK2] Enable WKPreferences and AboutBlankLoad API tests + https://bugs.webkit.org/show_bug.cgi?id=102926 + + Reviewed by Kenneth Rohde Christiansen. + + Add missing bits needed by WKPreferences and AboutBlankLoad API + tests in the test harness and enable these tests on EFL port. + + * TestWebKitAPI/PlatformEfl.cmake: + * TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp: + (TestWebKitAPI::TEST): + * TestWebKitAPI/efl/PlatformUtilities.cpp: + (TestWebKitAPI::Util::MIMETypeForWKURLResponse): + (Util): + 2012-11-21 Zan Dobersek <zandobersek@gmail.com> [GTK][WTR] Implement AccessibilityUIElement::stringValue diff --git a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp index 34ee5ad4a..16c237866 100755 --- a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp +++ b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp @@ -36,6 +36,7 @@ #include "DumpRenderTreeSupportQt.h" #include "EventSenderQt.h" #include "GCControllerQt.h" +#include "InitWebKitQt.h" #include "QtTestSupport.h" #include "TestRunnerQt.h" #include "TextInputControllerQt.h" @@ -62,19 +63,14 @@ #include <QProgressBar> #include <QUndoStack> #include <QUrl> - -#include <qwebsettings.h> -#include <qwebsecurityorigin.h> - #include <limits.h> #include <locale.h> - +#include <qwebsecurityorigin.h> +#include <qwebsettings.h> #ifndef Q_OS_WIN #include <unistd.h> #endif -#include <qdebug.h> - namespace WebCore { const int databaseDefaultQuota = 5 * 1024 * 1024; @@ -206,14 +202,14 @@ void WebPage::resetSettings() QWebSettings::setMaximumPagesInCache(0); // reset to default settings()->setUserStyleSheetUrl(QUrl()); // reset to default - DumpRenderTreeSupportQt::setMinimumTimerInterval(this, DumpRenderTreeSupportQt::defaultMinimumTimerInterval()); + DumpRenderTreeSupportQt::setMinimumTimerInterval(handle(), DumpRenderTreeSupportQt::defaultMinimumTimerInterval()); - DumpRenderTreeSupportQt::resetInternalsObject(mainFrame()); + DumpRenderTreeSupportQt::resetInternalsObject(mainFrame()->handle()); m_pendingGeolocationRequests.clear(); } -QWebPage *WebPage::createWindow(QWebPage::WebWindowType) +QWebPage* WebPage::createWindow(QWebPage::WebWindowType) { return m_drt->createWindow(); } @@ -399,6 +395,7 @@ DumpRenderTree::DumpRenderTree() if (viewMode == "graphics") setGraphicsBased(true); + WebKit::initializeWebKitWidgets(); DumpRenderTreeSupportQt::initialize(); // Set running in DRT mode for qwebpage to create testable objects. @@ -421,7 +418,7 @@ DumpRenderTree::DumpRenderTree() } // Use a frame group name for all pages created by DumpRenderTree to allow // testing of cross-page frame lookup. - DumpRenderTreeSupportQt::webPageSetGroupName(m_page, "org.webkit.qt.DumpRenderTree"); + DumpRenderTreeSupportQt::webPageSetGroupName(pageAdapter(), "org.webkit.qt.DumpRenderTree"); m_mainView->setContextMenuPolicy(Qt::NoContextMenu); m_mainView->resize(QSize(TestRunner::maxViewWidth, TestRunner::maxViewHeight)); @@ -470,7 +467,7 @@ DumpRenderTree::DumpRenderTree() QObject::connect(this, SIGNAL(quit()), qApp, SLOT(quit()), Qt::QueuedConnection); DumpRenderTreeSupportQt::setDumpRenderTreeModeEnabled(true); - DumpRenderTreeSupportQt::setInteractiveFormValidationEnabled(webPage(), true); + DumpRenderTreeSupportQt::setInteractiveFormValidationEnabled(pageAdapter(), true); DumpRenderTreeSupportQt::enableMockScrollbars(); QFocusEvent event(QEvent::FocusIn, Qt::ActiveWindowFocusReason); @@ -541,9 +538,9 @@ void DumpRenderTree::resetToConsistentStateBeforeTesting(const QUrl& url) #endif clearHistory(m_page); - DumpRenderTreeSupportQt::scalePageBy(m_page->mainFrame(), 1, QPoint(0, 0)); - DumpRenderTreeSupportQt::clearFrameName(m_page->mainFrame()); - DumpRenderTreeSupportQt::removeUserStyleSheets(m_page); + DumpRenderTreeSupportQt::scalePageBy(mainFrameAdapter(), 1, QPoint(0, 0)); + DumpRenderTreeSupportQt::clearFrameName(mainFrameAdapter()); + DumpRenderTreeSupportQt::removeUserStyleSheets(pageAdapter()); m_page->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAsNeeded); m_page->mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAsNeeded); @@ -561,7 +558,7 @@ void DumpRenderTree::resetToConsistentStateBeforeTesting(const QUrl& url) DumpRenderTreeSupportQt::resetOriginAccessWhiteLists(); - DumpRenderTreeSupportQt::setWindowsBehaviorAsEditingBehavior(m_page); + DumpRenderTreeSupportQt::setWindowsBehaviorAsEditingBehavior(pageAdapter()); QLocale::setDefault(QLocale::c()); @@ -570,7 +567,7 @@ void DumpRenderTree::resetToConsistentStateBeforeTesting(const QUrl& url) setlocale(LC_ALL, ""); #endif - DumpRenderTreeSupportQt::clearOpener(m_page->mainFrame()); + DumpRenderTreeSupportQt::clearOpener(mainFrameAdapter()); } static bool isGlobalHistoryTest(const QUrl& url) @@ -739,7 +736,7 @@ void DumpRenderTree::initJSObjects() frame->addToJavaScriptWindowObject(QLatin1String("eventSender"), m_eventSender); frame->addToJavaScriptWindowObject(QLatin1String("textInputController"), m_textInputController); frame->addToJavaScriptWindowObject(QLatin1String("GCController"), m_gcController); - DumpRenderTreeSupportQt::injectInternalsObject(frame); + DumpRenderTreeSupportQt::injectInternalsObject(frame->handle()); } void DumpRenderTree::showPage() @@ -757,7 +754,7 @@ void DumpRenderTree::hidePage() QString DumpRenderTree::dumpFrameScrollPosition(QWebFrame* frame) { - if (!frame || !DumpRenderTreeSupportQt::hasDocumentElement(frame)) + if (!frame || !DumpRenderTreeSupportQt::hasDocumentElement(frame->handle())) return QString(); QString result; @@ -779,7 +776,7 @@ QString DumpRenderTree::dumpFrameScrollPosition(QWebFrame* frame) QString DumpRenderTree::dumpFramesAsText(QWebFrame* frame) { - if (!frame || !DumpRenderTreeSupportQt::hasDocumentElement(frame)) + if (!frame || !DumpRenderTreeSupportQt::hasDocumentElement(frame->handle())) return QString(); QString result; @@ -907,7 +904,7 @@ void DumpRenderTree::dump() fprintf(stdout, "Source:\n\n%s\n", markup.toUtf8().constData()); } - QString mimeType = DumpRenderTreeSupportQt::responseMimeType(mainFrame); + QString mimeType = DumpRenderTreeSupportQt::responseMimeType(mainFrame->handle()); if (mimeType == "text/plain") m_controller->dumpAsText(); @@ -947,11 +944,11 @@ void DumpRenderTree::dump() mainFrame->render(&painter); painter.end(); } else - image = DumpRenderTreeSupportQt::paintPagesWithBoundaries(mainFrame); + image = DumpRenderTreeSupportQt::paintPagesWithBoundaries(mainFrame->handle()); - if (DumpRenderTreeSupportQt::trackRepaintRects(m_page->mainFrame())) { + if (DumpRenderTreeSupportQt::trackRepaintRects(mainFrameAdapter())) { QVector<QRect> repaintRects; - DumpRenderTreeSupportQt::getTrackedRepaintRects(m_page->mainFrame(), repaintRects); + DumpRenderTreeSupportQt::getTrackedRepaintRects(mainFrameAdapter(), repaintRects); QImage mask(image.size(), image.format()); mask.fill(QColor(0, 0, 0, 0.66 * 255)); @@ -963,7 +960,7 @@ void DumpRenderTree::dump() QPainter painter(&image); painter.drawImage(image.rect(), mask); - DumpRenderTreeSupportQt::setTrackRepaintRects(m_page->mainFrame(), false); + DumpRenderTreeSupportQt::setTrackRepaintRects(mainFrameAdapter(), false); } QCryptographicHash hash(QCryptographicHash::Md5); @@ -1098,7 +1095,7 @@ QWebPage *DumpRenderTree::createWindow() // Use a frame group name for all pages created by DumpRenderTree to allow // testing of cross-page frame lookup. - DumpRenderTreeSupportQt::webPageSetGroupName(page, "org.webkit.qt.DumpRenderTree"); + DumpRenderTreeSupportQt::webPageSetGroupName(page->handle(), "org.webkit.qt.DumpRenderTree"); return page; } @@ -1134,6 +1131,16 @@ void DumpRenderTree::switchFocus(bool focused) } +QWebPageAdapter* DumpRenderTree::pageAdapter() const +{ + return m_page->handle(); +} + +QWebFrameAdapter* DumpRenderTree::mainFrameAdapter() const +{ + return m_page->mainFrame()->handle(); +} + QList<WebPage*> DumpRenderTree::getAllPages() const { QList<WebPage*> pages; diff --git a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h index 98429c44e..7a6f76fb0 100644 --- a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h +++ b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h @@ -53,7 +53,8 @@ class QUrl; class QFile; QT_END_NAMESPACE -class QWebFrame; +class QWebFrameAdapter; +class QWebPageAdapter; class TestRunner; class DumpRenderTreeSupportQt; @@ -97,6 +98,9 @@ public: void switchFocus(bool focused); WebPage *webPage() const { return m_page; } + QWebPageAdapter *pageAdapter() const; + QWebFrameAdapter *mainFrameAdapter() const; + QList<WebPage*> getAllPages() const; void processArgsLine(const QStringList&); @@ -200,8 +204,9 @@ public: void permissionSet(QWebPage::Feature feature); + virtual bool shouldInterruptJavaScript() { return false; } + public Q_SLOTS: - bool shouldInterruptJavaScript() { return false; } void requestPermission(QWebFrame* frame, QWebPage::Feature feature); void cancelPermission(QWebFrame* frame, QWebPage::Feature feature); diff --git a/Tools/DumpRenderTree/qt/EventSenderQt.cpp b/Tools/DumpRenderTree/qt/EventSenderQt.cpp index dcf9f1bb2..80be13178 100644 --- a/Tools/DumpRenderTree/qt/EventSenderQt.cpp +++ b/Tools/DumpRenderTree/qt/EventSenderQt.cpp @@ -431,7 +431,7 @@ QStringList EventSender::contextClick() QContextMenuEvent ctxEvent(QContextMenuEvent::Mouse, m_mousePos); sendEvent(m_page->view(), &ctxEvent); } - return DumpRenderTreeSupportQt::contextMenu(m_page); + return DumpRenderTreeSupportQt::contextMenu(m_page->handle()); } void EventSender::scheduleAsynchronousClick() @@ -616,7 +616,7 @@ void EventSender::textZoomOut() void EventSender::scalePageBy(float scaleFactor, float x, float y) { if (QWebFrame* frame = m_page->mainFrame()) - DumpRenderTreeSupportQt::scalePageBy(frame, scaleFactor, QPoint(x, y)); + DumpRenderTreeSupportQt::scalePageBy(frame->handle(), scaleFactor, QPoint(x, y)); } QWebFrame* EventSender::frameUnderMouse() const diff --git a/Tools/DumpRenderTree/qt/TestRunnerQt.cpp b/Tools/DumpRenderTree/qt/TestRunnerQt.cpp index 6067514f0..d93505fc5 100644 --- a/Tools/DumpRenderTree/qt/TestRunnerQt.cpp +++ b/Tools/DumpRenderTree/qt/TestRunnerQt.cpp @@ -92,7 +92,7 @@ void TestRunner::reset() DumpRenderTreeSupportQt::setCustomPolicyDelegate(false, false); DumpRenderTreeSupportQt::dumpHistoryCallbacks(false); DumpRenderTreeSupportQt::dumpVisitedLinksCallbacks(false); - DumpRenderTreeSupportQt::resetGeolocationMock(m_drt->webPage()); + DumpRenderTreeSupportQt::resetGeolocationMock(m_drt->pageAdapter()); setIconDatabaseEnabled(false); clearAllDatabases(); // The default state for DRT is to block third-party cookies, mimicing the Mac port @@ -243,7 +243,7 @@ void TestRunner::simulateLegacyWebNotificationClick(const QString& title) void TestRunner::display() { - DumpRenderTreeSupportQt::setTrackRepaintRects(m_topLoadingFrame, true); + DumpRenderTreeSupportQt::setTrackRepaintRects(m_topLoadingFrame->handle(), true); emit showPage(); } @@ -417,7 +417,7 @@ QString TestRunner::decodeHostName(const QString& host) void TestRunner::closeWebInspector() { - DumpRenderTreeSupportQt::webInspectorClose(m_drt->webPage()); + DumpRenderTreeSupportQt::webInspectorClose(m_drt->pageAdapter()); m_drt->webPage()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, false); } @@ -434,27 +434,27 @@ void TestRunner::setAsynchronousSpellCheckingEnabled(bool) void TestRunner::showWebInspector() { m_drt->webPage()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); - DumpRenderTreeSupportQt::webInspectorShow(m_drt->webPage()); + DumpRenderTreeSupportQt::webInspectorShow(m_drt->pageAdapter()); } void TestRunner::evaluateInWebInspector(long callId, const QString& script) { - DumpRenderTreeSupportQt::webInspectorExecuteScript(m_drt->webPage(), callId, script); + DumpRenderTreeSupportQt::webInspectorExecuteScript(m_drt->pageAdapter(), callId, script); } void TestRunner::setFrameFlatteningEnabled(bool enabled) { - DumpRenderTreeSupportQt::setFrameFlatteningEnabled(m_drt->webPage(), enabled); + DumpRenderTreeSupportQt::setFrameFlatteningEnabled(m_drt->pageAdapter(), enabled); } void TestRunner::goBack() { - DumpRenderTreeSupportQt::goBack(m_drt->webPage()); + DumpRenderTreeSupportQt::goBack(m_drt->pageAdapter()); } void TestRunner::setDefersLoading(bool flag) { - DumpRenderTreeSupportQt::setDefersLoading(m_drt->webPage(), flag); + DumpRenderTreeSupportQt::setDefersLoading(m_drt->pageAdapter(), flag); } void TestRunner::setAllowUniversalAccessFromFileURLs(bool enabled) @@ -544,7 +544,7 @@ bool TestRunner::pauseAnimationAtTimeOnElementWithId(const QString& animationNam { QWebFrame* frame = m_drt->webPage()->mainFrame(); Q_ASSERT(frame); - return DumpRenderTreeSupportQt::pauseAnimation(frame, animationName, time, elementId); + return DumpRenderTreeSupportQt::pauseAnimation(frame->handle(), animationName, time, elementId); } bool TestRunner::pauseTransitionAtTimeOnElementWithId(const QString& propertyName, @@ -553,14 +553,14 @@ bool TestRunner::pauseTransitionAtTimeOnElementWithId(const QString& propertyNam { QWebFrame* frame = m_drt->webPage()->mainFrame(); Q_ASSERT(frame); - return DumpRenderTreeSupportQt::pauseTransitionOfProperty(frame, propertyName, time, elementId); + return DumpRenderTreeSupportQt::pauseTransitionOfProperty(frame->handle(), propertyName, time, elementId); } unsigned TestRunner::numberOfActiveAnimations() const { QWebFrame* frame = m_drt->webPage()->mainFrame(); Q_ASSERT(frame); - return DumpRenderTreeSupportQt::numberOfActiveAnimations(frame); + return DumpRenderTreeSupportQt::numberOfActiveAnimations(frame->handle()); } void TestRunner::disableImageLoading() @@ -698,12 +698,12 @@ void TestRunner::setUserStyleSheetLocation(const QString& url) void TestRunner::setCaretBrowsingEnabled(bool value) { - DumpRenderTreeSupportQt::setCaretBrowsingEnabled(m_drt->webPage(), value); + DumpRenderTreeSupportQt::setCaretBrowsingEnabled(m_drt->pageAdapter(), value); } void TestRunner::setAuthorAndUserStylesEnabled(bool value) { - DumpRenderTreeSupportQt::setAuthorAndUserStylesEnabled(m_drt->webPage(), value); + DumpRenderTreeSupportQt::setAuthorAndUserStylesEnabled(m_drt->pageAdapter(), value); } void TestRunner::setUserStyleSheetEnabled(bool enabled) @@ -728,7 +728,7 @@ int TestRunner::workerThreadCount() bool TestRunner::callShouldCloseOnWebView() { - return DumpRenderTreeSupportQt::shouldClose(m_drt->webPage()->mainFrame()); + return DumpRenderTreeSupportQt::shouldClose(m_drt->mainFrameAdapter()); } void TestRunner::setScrollbarPolicy(const QString& orientation, const QString& policy) @@ -757,27 +757,27 @@ void TestRunner::setScrollbarPolicy(const QString& orientation, const QString& p void TestRunner::setSmartInsertDeleteEnabled(bool enable) { - DumpRenderTreeSupportQt::setSmartInsertDeleteEnabled(m_drt->webPage(), enable); + DumpRenderTreeSupportQt::setSmartInsertDeleteEnabled(m_drt->pageAdapter(), enable); } void TestRunner::setSelectTrailingWhitespaceEnabled(bool enable) { - DumpRenderTreeSupportQt::setSelectTrailingWhitespaceEnabled(m_drt->webPage(), enable); + DumpRenderTreeSupportQt::setSelectTrailingWhitespaceEnabled(m_drt->pageAdapter(), enable); } void TestRunner::execCommand(const QString& name, const QString& value) { - DumpRenderTreeSupportQt::executeCoreCommandByName(m_drt->webPage(), name, value); + DumpRenderTreeSupportQt::executeCoreCommandByName(m_drt->pageAdapter(), name, value); } bool TestRunner::isCommandEnabled(const QString& name) const { - return DumpRenderTreeSupportQt::isCommandEnabled(m_drt->webPage(), name); + return DumpRenderTreeSupportQt::isCommandEnabled(m_drt->pageAdapter(), name); } bool TestRunner::findString(const QString& string, const QStringList& optionArray) { - return DumpRenderTreeSupportQt::findString(m_drt->webPage(), string, optionArray); + return DumpRenderTreeSupportQt::findString(m_drt->pageAdapter(), string, optionArray); } QString TestRunner::markerTextForListItem(const QWebElement& listItem) @@ -792,7 +792,7 @@ QVariantMap TestRunner::computedStyleIncludingVisitedInfo(const QWebElement& ele bool TestRunner::elementDoesAutoCompleteForElementWithId(const QString& elementId) { - return DumpRenderTreeSupportQt::elementDoesAutoCompleteForElementWithId(m_drt->webPage()->mainFrame(), elementId); + return DumpRenderTreeSupportQt::elementDoesAutoCompleteForElementWithId(m_drt->mainFrameAdapter(), elementId); } void TestRunner::authenticateSession(const QString&, const QString&, const QString&) @@ -812,7 +812,7 @@ void TestRunner::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bo { QList<WebCore::WebPage*> pages = m_drt->getAllPages(); foreach (WebCore::WebPage* page, pages) - DumpRenderTreeSupportQt::setMockDeviceOrientation(page, canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma); + DumpRenderTreeSupportQt::setMockDeviceOrientation(page->handle(), canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma); } void TestRunner::setGeolocationPermission(bool allow) @@ -820,7 +820,7 @@ void TestRunner::setGeolocationPermission(bool allow) setGeolocationPermissionCommon(allow); QList<WebCore::WebPage*> pages = m_drt->getAllPages(); foreach (WebCore::WebPage* page, pages) - DumpRenderTreeSupportQt::setMockGeolocationPermission(page, allow); + DumpRenderTreeSupportQt::setMockGeolocationPermission(page->handle(), allow); } int TestRunner::numberOfPendingGeolocationPermissionRequests() @@ -828,7 +828,7 @@ int TestRunner::numberOfPendingGeolocationPermissionRequests() int pendingPermissionCount = 0; QList<WebCore::WebPage*> pages = m_drt->getAllPages(); foreach (WebCore::WebPage* page, pages) - pendingPermissionCount += DumpRenderTreeSupportQt::numberOfPendingGeolocationPermissionRequests(page); + pendingPermissionCount += DumpRenderTreeSupportQt::numberOfPendingGeolocationPermissionRequests(page->handle()); return pendingPermissionCount; } @@ -843,14 +843,14 @@ void TestRunner::setMockGeolocationPositionUnavailableError(const QString& messa { QList<WebCore::WebPage*> pages = m_drt->getAllPages(); foreach (WebCore::WebPage* page, pages) - DumpRenderTreeSupportQt::setMockGeolocationPositionUnavailableError(page, message); + DumpRenderTreeSupportQt::setMockGeolocationPositionUnavailableError(page->handle(), message); } void TestRunner::setMockGeolocationPosition(double latitude, double longitude, double accuracy) { QList<WebCore::WebPage*> pages = m_drt->getAllPages(); foreach (WebCore::WebPage* page, pages) - DumpRenderTreeSupportQt::setMockGeolocationPosition(page, latitude, longitude, accuracy); + DumpRenderTreeSupportQt::setMockGeolocationPosition(page->handle(), latitude, longitude, accuracy); } void TestRunner::addMockSpeechInputResult(const QString& result, double confidence, const QString& language) @@ -878,12 +878,12 @@ void TestRunner::evaluateScriptInIsolatedWorldAndReturnValue(int worldID, const void TestRunner::evaluateScriptInIsolatedWorld(int worldID, const QString& script) { - DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld(m_drt->webPage()->mainFrame(), worldID, script); + DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld(m_drt->mainFrameAdapter(), worldID, script); } void TestRunner::addUserStyleSheet(const QString& sourceCode) { - DumpRenderTreeSupportQt::addUserStyleSheet(m_drt->webPage(), sourceCode); + DumpRenderTreeSupportQt::addUserStyleSheet(m_drt->pageAdapter(), sourceCode); } void TestRunner::removeAllVisitedLinks() @@ -900,7 +900,7 @@ void TestRunner::addURLToRedirect(const QString& origin, const QString& destinat void TestRunner::setMinimumTimerInterval(double minimumTimerInterval) { - DumpRenderTreeSupportQt::setMinimumTimerInterval(m_drt->webPage(), minimumTimerInterval); + DumpRenderTreeSupportQt::setMinimumTimerInterval(m_drt->pageAdapter(), minimumTimerInterval); } void TestRunner::originsWithLocalStorage() diff --git a/Tools/DumpRenderTree/qt/TextInputControllerQt.cpp b/Tools/DumpRenderTree/qt/TextInputControllerQt.cpp index d5645a523..38e489d78 100644 --- a/Tools/DumpRenderTree/qt/TextInputControllerQt.cpp +++ b/Tools/DumpRenderTree/qt/TextInputControllerQt.cpp @@ -149,15 +149,15 @@ void TextInputController::insertText(const QString& string) QVariantList TextInputController::selectedRange() { - return DumpRenderTreeSupportQt::selectedRange(qobject_cast<QWebPage*>(parent())); + return DumpRenderTreeSupportQt::selectedRange(qobject_cast<QWebPage*>(parent())->handle()); } QVariantList TextInputController::firstRectForCharacterRange(int location, int length) { - return DumpRenderTreeSupportQt::firstRectForCharacterRange(qobject_cast<QWebPage*>(parent()), location, length); + return DumpRenderTreeSupportQt::firstRectForCharacterRange(qobject_cast<QWebPage*>(parent())->handle(), location, length); } void TextInputController::unmarkText() { - DumpRenderTreeSupportQt::confirmComposition(qobject_cast<QWebPage*>(parent()), 0); + DumpRenderTreeSupportQt::confirmComposition(qobject_cast<QWebPage*>(parent())->handle(), 0); } diff --git a/Tools/DumpRenderTree/qt/WorkQueueItemQt.cpp b/Tools/DumpRenderTree/qt/WorkQueueItemQt.cpp index b09336667..7cf9fcaf1 100644 --- a/Tools/DumpRenderTree/qt/WorkQueueItemQt.cpp +++ b/Tools/DumpRenderTree/qt/WorkQueueItemQt.cpp @@ -81,7 +81,7 @@ bool LoadAlternateHTMLStringItem::invoke() const if (!frame) return false; - DumpRenderTreeSupportQt::setAlternateHtml(frame, m_content, QUrl(m_baseURL), QUrl(m_failingURL)); + DumpRenderTreeSupportQt::setAlternateHtml(frame->handle(), m_content, QUrl(m_baseURL), QUrl(m_failingURL)); return true; } diff --git a/Tools/QtTestBrowser/webpage.h b/Tools/QtTestBrowser/webpage.h index 9f98212d0..0965b56c9 100644 --- a/Tools/QtTestBrowser/webpage.h +++ b/Tools/QtTestBrowser/webpage.h @@ -52,10 +52,11 @@ public: QString userAgentForUrl(const QUrl& url) const; void setInterruptingJavaScriptEnabled(bool enabled) { m_interruptingJavaScriptEnabled = enabled; } + virtual bool shouldInterruptJavaScript(); + public Q_SLOTS: void openUrlInDefaultBrowser(const QUrl& url = QUrl()); void setUserAgent(const QString& ua) { m_userAgent = ua; } - bool shouldInterruptJavaScript(); void authenticationRequired(QNetworkReply*, QAuthenticator*); void requestPermission(QWebFrame* frame, QWebPage::Feature feature); void featurePermissionRequestCanceled(QWebFrame* frame, QWebPage::Feature feature); diff --git a/Tools/Scripts/run-api-tests b/Tools/Scripts/run-api-tests index 5913cee8f..ca71ac541 100755 --- a/Tools/Scripts/run-api-tests +++ b/Tools/Scripts/run-api-tests @@ -83,7 +83,7 @@ setConfiguration(); # When running TestWebKitAPI for Chromium on Android, defer to the test runner in # Chromium as we can't execute the binary locally. if (isChromiumAndroid()) { - my @runTestCommand = ('build/android/run_tests.py', '--verbose', '--webkit', '--out-directory', sourceDir() . '/out', '-s', 'TestWebKitAPI'); + my @runTestCommand = ('build/android/run_tests.py', '--verbose', '--webkit', '--exit_code', '--out-directory', sourceDir() . '/out', '-s', 'TestWebKitAPI'); if (configuration() eq "Release") { push @runTestCommand, '--release'; } diff --git a/Tools/Scripts/run-chromium-webkit-unit-tests b/Tools/Scripts/run-chromium-webkit-unit-tests index 33c7cc25e..114f77af7 100755 --- a/Tools/Scripts/run-chromium-webkit-unit-tests +++ b/Tools/Scripts/run-chromium-webkit-unit-tests @@ -38,7 +38,7 @@ setConfiguration(); # Defer to Android's test runners for running webkit_unit_tests on a device. if (checkForArgumentAndRemoveFromARGV('--platform=chromium-android')) { - my @runTestCommand = ('build/android/run_tests.py', '--verbose', '--webkit', '--out-directory', sourceDir() . '/out', '-s', 'webkit_unit_tests'); + my @runTestCommand = ('build/android/run_tests.py', '--verbose', '--webkit', '--exit_code', '--out-directory', sourceDir() . '/out', '-s', 'webkit_unit_tests'); if (configuration() eq "Release") { push @runTestCommand, '--release'; } diff --git a/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py b/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py index 2924f24e2..a077dc92e 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py @@ -354,7 +354,7 @@ class ChromiumAndroidDriver(driver.Driver): if self._has_setup: return - self._run_adb_command(['root']) + self._restart_adb_as_root() self._setup_md5sum_and_push_data_if_needed() self._has_setup = True self._setup_performance() @@ -425,6 +425,15 @@ class ChromiumAndroidDriver(driver.Driver): for resource in TEST_RESOURCES_TO_PUSH: self._push_file_if_needed(self._port.layout_tests_dir() + '/' + resource, DEVICE_LAYOUT_TESTS_DIR + resource) + def _restart_adb_as_root(self): + output = self._run_adb_command(['root']) + if 'adbd is already running as root' in output: + return + elif 'restarting adbd as root' in output: + self._run_adb_command(['wait-for-device']) + else: + self._log_error('Unrecognized output from adb root: %s' % output) + def _run_adb_command(self, cmd, ignore_error=False): self._log_debug('Run adb command: ' + str(cmd)) if ignore_error: diff --git a/Tools/TestWebKitAPI/PlatformEfl.cmake b/Tools/TestWebKitAPI/PlatformEfl.cmake index d6d913005..c6ea7302c 100644 --- a/Tools/TestWebKitAPI/PlatformEfl.cmake +++ b/Tools/TestWebKitAPI/PlatformEfl.cmake @@ -44,6 +44,7 @@ SET(webkit2_api_harness_SOURCES # Release builds before adding it to test_webkit2_api_BINARIES. SET(test_webkit2_api_BINARIES + AboutBlankLoad CookieManager DOMWindowExtensionNoCache DocumentStartUserScriptAlertCrash @@ -65,7 +66,9 @@ SET(test_webkit2_api_BINARIES ParentFrame PreventEmptyUserAgent PrivateBrowsingPushStateNoHistoryCallback + ResponsivenessTimerDoesntFireEarly WKConnection + WKPreferences WKString WKStringJSString WKURL @@ -87,12 +90,9 @@ ADD_DEFINITIONS(-DTHEME_DIR="${THEME_BINARY_DIR}") # Tests disabled because of missing features on the test harness: # -# AboutBlankLoad # HitTestResultNodeHandle # MouseMoveAfterCrash -# ResponsivenessTimerDoesntFireEarly # SpacebarScrolling -# WKPreferences # # Flaky test, fails on Release but passes on Debug: # diff --git a/Tools/TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp b/Tools/TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp index 5c0751bb0..3c4bedaf4 100644 --- a/Tools/TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp +++ b/Tools/TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp @@ -57,7 +57,7 @@ TEST(WebKit2, WKPreferencesDefaults) static const char* expectedCursiveFontFamily = "Apple Chancery"; static const char* expectedFantasyFontFamily = "Papyrus"; static const char* expectedPictographFontFamily = "Apple Color Emoji"; -#elif PLATFORM(GTK) +#elif PLATFORM(GTK) || PLATFORM(EFL) static const char* expectedStandardFontFamily = "Times"; static const char* expectedFixedFontFamily = "Courier New"; static const char* expectedSerifFontFamily = "Times"; diff --git a/Tools/TestWebKitAPI/efl/PlatformUtilities.cpp b/Tools/TestWebKitAPI/efl/PlatformUtilities.cpp index 96745459f..65c54e1a7 100644 --- a/Tools/TestWebKitAPI/efl/PlatformUtilities.cpp +++ b/Tools/TestWebKitAPI/efl/PlatformUtilities.cpp @@ -42,7 +42,7 @@ void run(bool* done) void sleep(double seconds) { - sleep(seconds); + usleep(seconds * 1000000); } WKURLRef createURLForResource(const char* resource, const char* extension) @@ -64,6 +64,11 @@ WKURLRef URLForNonExistentResource() return WKURLCreateWithUTF8CString("file:///does-not-exist.html"); } +WKRetainPtr<WKStringRef> MIMETypeForWKURLResponse(WKURLResponseRef wkResponse) +{ + return adoptWK(WKURLResponseCopyMIMEType(wkResponse)); +} + } // namespace Util } // namespace TestWebKitAPI diff --git a/Tools/TestWebKitAPI/efl/PlatformWebView.cpp b/Tools/TestWebKitAPI/efl/PlatformWebView.cpp index 2e87f7087..acec6ed84 100644 --- a/Tools/TestWebKitAPI/efl/PlatformWebView.cpp +++ b/Tools/TestWebKitAPI/efl/PlatformWebView.cpp @@ -80,4 +80,12 @@ WKPageRef PlatformWebView::page() const return WKViewGetPage(toAPI(m_view)); } +void PlatformWebView::simulateSpacebarKeyPress() +{ + Evas* evas = ecore_evas_get(m_window); + evas_object_focus_set(m_view, true); + evas_event_feed_key_down(evas, "space", "space", " ", 0, 0, 0); + evas_event_feed_key_up(evas, "space", "space", " ", 0, 1, 0); +} + } // namespace TestWebKitAPI diff --git a/Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl b/Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl index 52a7a5b62..1d62c9b23 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl +++ b/Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl @@ -29,6 +29,7 @@ interface EventSendingController { void mouseMoveTo(in long x, in long y); void mouseScrollBy(in long x, in long y); void continuousMouseScrollBy(in long x, in long y, in [Optional] boolean paged); + object contextClick(); void scheduleAsynchronousClick(); void leapForward(in long milliseconds); diff --git a/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl b/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl index 6dad1b2bd..354d2b580 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl +++ b/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl @@ -72,6 +72,7 @@ interface TestRunner { void setTabKeyCyclesThroughElements(in boolean enabled); void setSerializeHTTPLoads(); void dispatchPendingLoadRequests(); + void setCacheModel(in int model); // Special DOM functions. void clearBackForwardList(); diff --git a/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp b/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp index bf6d9bcb1..4ee7821b8 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp +++ b/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp @@ -319,6 +319,37 @@ void EventSendingController::continuousMouseScrollBy(int x, int y, bool paged) WKBundlePostSynchronousMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0); } +JSValueRef EventSendingController::contextClick() +{ + WKBundlePageRef page = InjectedBundle::shared().page()->page(); + WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(page); + JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame); +#if ENABLE(CONTEXT_MENUS) + // Do mouse context click. + mouseDown(2, 0); + mouseUp(2, 0); + + WKRetainPtr<WKArrayRef> entriesNames = adoptWK(WKBundlePageCopyContextMenuItemTitles(page)); + JSRetainPtr<JSStringRef> jsPropertyName(Adopt, JSStringCreateWithUTF8CString("title")); + size_t entriesSize = WKArrayGetSize(entriesNames.get()); + OwnArrayPtr<JSValueRef> jsValuesArray = adoptArrayPtr(new JSValueRef[entriesSize]); + for (size_t i = 0; i < entriesSize; ++i) { + ASSERT(WKGetTypeID(WKArrayGetItemAtIndex(entriesNames.get(), i)) == WKStringGetTypeID()); + + WKStringRef wkEntryName = static_cast<WKStringRef>(WKArrayGetItemAtIndex(entriesNames.get(), i)); + JSObjectRef jsItemObject = JSObjectMake(context, /* JSClassRef */0, /* privData */0); + JSRetainPtr<JSStringRef> jsNameCopy(Adopt, WKStringCopyJSString(wkEntryName)); + JSValueRef jsEntryName = JSValueMakeString(context, jsNameCopy.get()); + JSObjectSetProperty(context, jsItemObject, jsPropertyName.get(), jsEntryName, kJSPropertyAttributeReadOnly, 0); + jsValuesArray[i] = jsItemObject; + } + + return JSObjectMakeArray(context, entriesSize, jsValuesArray.get(), 0); +#else + return JSValueMakeUndefined(context); +#endif +} + #ifdef USE_WEBPROCESS_EVENT_SIMULATION void EventSendingController::updateClickCount(WKEventMouseButton button) { diff --git a/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h b/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h index 413b91cd1..69c54f926 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h +++ b/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h @@ -52,6 +52,7 @@ public: void mouseMoveTo(int x, int y); void mouseScrollBy(int x, int y); void continuousMouseScrollBy(int x, int y, bool paged); + JSValueRef contextClick(); void leapForward(int milliseconds); void scheduleAsynchronousClick(); diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp index 0684d6df2..fa7939d3e 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp +++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp @@ -256,6 +256,7 @@ void InjectedBundle::beginTesting(WKDictionaryRef settings) WKBundleSetAlwaysAcceptCookies(m_bundle, false); WKBundleSetSerialLoadingEnabled(m_bundle, false); WKBundleSetShadowDOMEnabled(m_bundle, true); + WKBundleSetCacheModel(m_bundle, 1 /*CacheModelDocumentBrowser*/); WKBundleRemoveAllUserContent(m_bundle, m_pageGroup); diff --git a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp index a294da7d4..10fccc23e 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp +++ b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp @@ -755,6 +755,11 @@ void TestRunner::dispatchPendingLoadRequests() WKBundleDispatchPendingLoadRequests(InjectedBundle::shared().bundle()); } +void TestRunner::setCacheModel(int model) +{ + WKBundleSetCacheModel(InjectedBundle::shared().bundle(), model); +} + void TestRunner::grantWebNotificationPermission(JSStringRef origin) { WKRetainPtr<WKStringRef> originWK = toWK(origin); diff --git a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h index 48b922c49..3a974a989 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h +++ b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h @@ -112,6 +112,7 @@ public: void setTabKeyCyclesThroughElements(bool); void setSerializeHTTPLoads(); void dispatchPendingLoadRequests(); + void setCacheModel(int); // Special DOM functions. JSValueRef computedStyleIncludingVisitedInfo(JSValueRef element); diff --git a/Tools/WebKitTestRunner/TestController.cpp b/Tools/WebKitTestRunner/TestController.cpp index 145c27087..0e47f3c24 100644 --- a/Tools/WebKitTestRunner/TestController.cpp +++ b/Tools/WebKitTestRunner/TestController.cpp @@ -109,6 +109,7 @@ TestController::TestController(int argc, const char* argv[]) TestController::~TestController() { + platformDestroy(); } static WKRect getWindowFrame(WKPageRef page, const void* clientInfo) diff --git a/Tools/WebKitTestRunner/TestController.h b/Tools/WebKitTestRunner/TestController.h index 56c3c4702..332e33b70 100644 --- a/Tools/WebKitTestRunner/TestController.h +++ b/Tools/WebKitTestRunner/TestController.h @@ -92,6 +92,7 @@ private: bool runTest(const char* pathOrURL); void platformInitialize(); + void platformDestroy(); void platformInitializeContext(); void platformRunUntil(bool& done, double timeout); void platformDidCommitLoadForFrame(WKPageRef, WKFrameRef); @@ -182,6 +183,11 @@ private: OwnPtr<EventSenderProxy> m_eventSenderProxy; #endif +#if PLATFORM(QT) + class RunLoop; + RunLoop* m_runLoop; +#endif + WorkQueueManager m_workQueueManager; }; diff --git a/Tools/WebKitTestRunner/efl/TestControllerEfl.cpp b/Tools/WebKitTestRunner/efl/TestControllerEfl.cpp index f68351d7b..6f514ff2e 100644 --- a/Tools/WebKitTestRunner/efl/TestControllerEfl.cpp +++ b/Tools/WebKitTestRunner/efl/TestControllerEfl.cpp @@ -57,6 +57,10 @@ void TestController::platformInitialize() } } +void TestController::platformDestroy() +{ +} + void TestController::platformRunUntil(bool& condition, double timeout) { if (timeout == m_noTimeout) { diff --git a/Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp b/Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp index 90bdb7279..4aeb65fc7 100644 --- a/Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp +++ b/Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp @@ -54,6 +54,10 @@ void TestController::platformInitialize() { } +void TestController::platformDestroy() +{ +} + static gboolean timeoutCallback(gpointer) { fprintf(stderr, "FAIL: TestControllerRunLoop timed out.\n"); diff --git a/Tools/WebKitTestRunner/mac/TestControllerMac.mm b/Tools/WebKitTestRunner/mac/TestControllerMac.mm index 3b68a0073..fbae25617 100644 --- a/Tools/WebKitTestRunner/mac/TestControllerMac.mm +++ b/Tools/WebKitTestRunner/mac/TestControllerMac.mm @@ -40,6 +40,10 @@ void TestController::platformInitialize() { } +void TestController::platformDestroy() +{ +} + void TestController::initializeInjectedBundlePath() { NSString *nsBundlePath = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"WebKitTestRunnerInjectedBundle.bundle"]; diff --git a/Tools/WebKitTestRunner/qt/TestControllerQt.cpp b/Tools/WebKitTestRunner/qt/TestControllerQt.cpp index 04ddb8b76..9d3515c82 100644 --- a/Tools/WebKitTestRunner/qt/TestControllerQt.cpp +++ b/Tools/WebKitTestRunner/qt/TestControllerQt.cpp @@ -32,44 +32,106 @@ #include <cstdlib> #include <QCoreApplication> -#include <QElapsedTimer> #include <QEventLoop> #include <QFileInfo> #include <QLibrary> #include <QObject> -#include <qquickwebview_p.h> +#include <QTimer> #include <QtGlobal> +#include <qquickwebview_p.h> #include <wtf/Platform.h> #include <wtf/text/WTFString.h> namespace WTR { -void TestController::notifyDone() +class TestController::RunLoop : public QObject { + Q_OBJECT +public: + RunLoop(); + + void runUntil(double timeout); + void notifyDone(); + void runModal(PlatformWebView*); +public Q_SLOTS: + void timerFired(); +private: + QEventLoop m_runUntilLoop; + QEventLoop m_modalLoop; + QTimer m_runUntilLoopTimer; + bool m_runUntilLoopClosePending; +}; + +TestController::RunLoop::RunLoop() + : m_runUntilLoopClosePending(false) { + m_runUntilLoopTimer.setSingleShot(true); + QObject::connect(&m_runUntilLoopTimer, SIGNAL(timeout()), this, SLOT(timerFired())); } -void TestController::platformInitialize() +void TestController::RunLoop::runUntil(double timeout) { - QQuickWebView::platformInitialize(); + ASSERT(!m_runUntilLoop.isRunning()); + if (timeout) { + const int timeoutInMilliSecs = timeout * 1000; + m_runUntilLoopTimer.start(timeoutInMilliSecs); + } + m_runUntilLoop.exec(QEventLoop::ExcludeUserInputEvents); } -void TestController::platformRunUntil(bool& condition, double timeout) +void TestController::RunLoop::notifyDone() { - if (qgetenv("QT_WEBKIT2_DEBUG") == "1" || timeout == m_noTimeout) { - // Never timeout if we are debugging or not meant to timeout. - while (!condition) - QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents, 50); + if (m_modalLoop.isRunning()) { + // Wait for the modal loop first. We only kill it if we timeout. + m_runUntilLoopClosePending = true; return; } - int timeoutInMSecs = timeout * 1000; - QElapsedTimer timer; - timer.start(); - while (!condition) { - if (timer.elapsed() > timeoutInMSecs) - return; - QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents, timeoutInMSecs - timer.elapsed()); + m_runUntilLoopTimer.stop(); + m_runUntilLoop.exit(); +} + +void TestController::RunLoop::timerFired() +{ + if (m_modalLoop.isRunning()) { + m_runUntilLoopClosePending = true; + m_modalLoop.exit(); + return; } + + m_runUntilLoop.exit(); +} + +void TestController::RunLoop::runModal(PlatformWebView* view) +{ + ASSERT(!m_modalLoop.isRunning()); + view->setModalEventLoop(&m_modalLoop); + m_modalLoop.exec(QEventLoop::ExcludeUserInputEvents); + + if (m_runUntilLoopClosePending) + m_runUntilLoop.exit(); +} + +void TestController::notifyDone() +{ + m_runLoop->notifyDone(); +} + +void TestController::platformInitialize() +{ + m_runLoop = new RunLoop; + QQuickWebView::platformInitialize(); +} + +void TestController::platformDestroy() +{ + delete m_runLoop; +} + +void TestController::platformRunUntil(bool& condition, double timeout) +{ + UNUSED_PARAM(condition); + const bool shouldTimeout = !(qgetenv("QT_WEBKIT2_DEBUG") == "1" || timeout == m_noTimeout); + m_runLoop->runUntil(shouldTimeout ? timeout : 0); } static bool isExistingLibrary(const QString& path) @@ -113,9 +175,7 @@ void TestController::platformInitializeContext() void TestController::runModal(PlatformWebView* view) { - QEventLoop eventLoop; - view->setModalEventLoop(&eventLoop); - eventLoop.exec(QEventLoop::ExcludeUserInputEvents); + shared().m_runLoop->runModal(view); } const char* TestController::platformLibraryPathForTesting() @@ -124,3 +184,5 @@ const char* TestController::platformLibraryPathForTesting() } } // namespace WTR + +#include "TestControllerQt.moc" diff --git a/Tools/WebKitTestRunner/win/TestControllerWin.cpp b/Tools/WebKitTestRunner/win/TestControllerWin.cpp index ba4f753b4..8f2eaaf48 100644 --- a/Tools/WebKitTestRunner/win/TestControllerWin.cpp +++ b/Tools/WebKitTestRunner/win/TestControllerWin.cpp @@ -121,6 +121,10 @@ void TestController::platformInitialize() webProcessCrashingEvent = ::CreateEventA(0, FALSE, FALSE, webProcessCrashingEventName); } +void TestController::platformDestroy() +{ +} + void TestController::initializeInjectedBundlePath() { CFStringRef exeContainerPath = CFURLCopyFileSystemPath(CFURLCreateCopyDeletingLastPathComponent(0, CFBundleCopyExecutableURL(CFBundleGetMainBundle())), kCFURLWindowsPathStyle); diff --git a/Tools/qmake/mkspecs/features/default_post.prf b/Tools/qmake/mkspecs/features/default_post.prf index 4776d1d92..dc5e438c1 100644 --- a/Tools/qmake/mkspecs/features/default_post.prf +++ b/Tools/qmake/mkspecs/features/default_post.prf @@ -156,7 +156,7 @@ contains(TEMPLATE, lib) { DEFINES += BUILDING_$${TARGET} # Triggers the right export macro for the QtWebKit API (see qwebkitglobal.h) - DEFINES += BUILDING_WEBKIT + !contains(QT, webkitwidgets): DEFINES += BUILDING_WEBKIT # Prevent name clashes when building both debug and release. Qt5's module # system already takes care of this for the top level QtWebKit library. @@ -177,7 +177,7 @@ contains(QT, webkitwidgets) { # need to link to any intermediate shared libraries. force_static_libs_as_shared { WEBKIT += wtf javascriptcore webcore - build?(webkit1): WEBKIT += webkit1 + build?(webkit1): WEBKIT += webkitwidgets webkit1 build?(webkit2): WEBKIT += webkit2 } diff --git a/Tools/qmake/mkspecs/features/production_build.prf b/Tools/qmake/mkspecs/features/production_build.prf index b3f36abb4..c980d09d0 100644 --- a/Tools/qmake/mkspecs/features/production_build.prf +++ b/Tools/qmake/mkspecs/features/production_build.prf @@ -8,7 +8,7 @@ CONFIG *= use_all_in_one_files # by compiling any static library like WTF or JSC with release flags instead and keep debug # symbols for the static libraries that implement API. linux-*|win32-g++*:if(CONFIG(debug, debug|release)|contains(QT_CONFIG,separate_debug_info)):contains(TEMPLATE, lib):staticlib { - !equals(TARGET, WebKit2):!equals(TARGET, WebKit1) { + !equals(TARGET, WebKit2):!equals(TARGET, WebKitWidgets) { CONFIG += no_debug_info CONFIG -= separate_debug_info QMAKE_CFLAGS += $$QMAKE_CFLAGS_RELEASE diff --git a/Tools/qmake/mkspecs/features/webkit_modules.prf b/Tools/qmake/mkspecs/features/webkit_modules.prf index b2f335364..505b82658 100644 --- a/Tools/qmake/mkspecs/features/webkit_modules.prf +++ b/Tools/qmake/mkspecs/features/webkit_modules.prf @@ -7,7 +7,7 @@ # Reorder libraries so that the link and include order is correct, # and make sure the case matches the original case. -libraries = WebKit1 WebKit2 WebCore ANGLE JavaScriptCore WTF +libraries = WebKitWidgets WebKit1 WebKit2 WebCore ANGLE JavaScriptCore WTF for(library, libraries) { contains(WEBKIT, $$lower($$library)) { WEBKIT -= $$lower($$library) diff --git a/Tools/qmake/mkspecs/features/win32/default_post.prf b/Tools/qmake/mkspecs/features/win32/default_post.prf index 93861ef0a..acf2e861b 100644 --- a/Tools/qmake/mkspecs/features/win32/default_post.prf +++ b/Tools/qmake/mkspecs/features/win32/default_post.prf @@ -39,5 +39,3 @@ shared:contains(TEMPLATE, lib) { GENERATED_SOURCES += $$forwarded_exports.target } -# To ensure the Qt export macros are set to dllexport -contains(TEMPLATE, lib):!contains(QT, webkitwidgets): DEFINES += QT_MAKEDLL diff --git a/Tools/qmake/mkspecs/modules/webkitwidgets.prf b/Tools/qmake/mkspecs/modules/webkitwidgets.prf new file mode 100644 index 000000000..ca1643c8d --- /dev/null +++ b/Tools/qmake/mkspecs/modules/webkitwidgets.prf @@ -0,0 +1,9 @@ +# ------------------------------------------------------------------- +# Module file for WebKitWidget, used by targets that depend on WebKitWidget +# +# See 'Tools/qmake/README' for an overview of the build system +# ------------------------------------------------------------------- + +WEBKIT.webkitwidgets.root_source_dir = $${ROOT_WEBKIT_DIR}/Source/WebKit + +include($${WEBKIT.webkitwidgets.root_source_dir}/WebKitWidgets.pri) @@ -1,9 +1,9 @@ This is a snapshot of WebKit. It is based on the upstream trunk subversion -revision 135485 +revision 135602 You can browse the base of this snapshot at - http://trac.webkit.org/browser/trunk?rev=135485 + http://trac.webkit.org/browser/trunk?rev=135602 Additional patches may have been applied on top and files not required by the Qt port may have been removed. diff --git a/WebKit.pro b/WebKit.pro index 876d55412..fba5b997a 100644 --- a/WebKit.pro +++ b/WebKit.pro @@ -32,6 +32,10 @@ build?(webkit1) { webkit1.file = Source/WebKit/WebKit1.pro webkit1.makefile = Makefile.WebKit1 SUBDIRS += webkit1 + + webkitwidgets.file = Source/WebKit/WebKitWidgets.pro + webkitwidgets.makefile = Makefile.WebKitWidgets + SUBDIRS += webkitwidgets } build?(webkit2) { |