diff options
440 files changed, 12199 insertions, 4190 deletions
@@ -1,3 +1,56 @@ +2012-11-30 Simon Hausmann <simon.hausmann@digia.com> + + [Qt] Unreviewed doc fix + + Add additional search paths for API folders. + + * Source/qtwebkit.qdocconf: + +2012-11-30 Simon Hausmann <simon.hausmann@digia.com>, Pierre Rossi <pierre.rossi@digia.com> + + [Qt] Separate Qt WebKit into Qt WebKit and Qt WebKit Widgets + https://bugs.webkit.org/show_bug.cgi?id=99314 + + Reviewed by Tor Arne Vestbø. + + This big change separates QtWebKit into QtWebKit and QtWebKitWidgets as + shared libraries. + + It's a big refactoring that mostly involves moving WebCore dependent + code into QtWebKit and accessing it through exported QWebFrameAdapter + and QWebPageAdapter classes. + + * Source/QtWebKit.pro: + * Source/api.pri: + * Source/sync.profile: + * Source/widgetsapi.pri: Added. + * WebKit.pro: + +2012-11-30 Tor Arne Vestbø <tor.arne.vestbo@digia.com> + + [Qt] Build as a regular Qt module when production_build is enabled + + Instead of always setting CONFIG+=force_independent. This means the + libs, headers, and documentation will end up in qtbase for developer + builds of Qt, instead of always in the QtWebKit build directory. + + Reviewed by Simon Hausmann. + + * Source/api.pri: + +2012-11-29 Rafael Weinstein <rafaelw@chromium.org> + + [HTMLTemplateElement] Add feature flag + https://bugs.webkit.org/show_bug.cgi?id=103694 + + Reviewed by Adam Barth. + + This flag will guard the implementation of the HTMLTemplateElement. + http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/templates/index.html + + * Source/cmake/WebKitFeatures.cmake: + * Source/cmakeconfig.h.cmake: + 2012-11-28 Michael Pruett <michael@68k.org> IndexedDB: Remove duplicate toWireString() and createFromWire() methods in JSC SerializedScriptValue diff --git a/Source/JavaScriptCore/CMakeLists.txt b/Source/JavaScriptCore/CMakeLists.txt index 7e5656025..0a7a8bd3f 100644 --- a/Source/JavaScriptCore/CMakeLists.txt +++ b/Source/JavaScriptCore/CMakeLists.txt @@ -45,6 +45,9 @@ SET(JavaScriptCore_SOURCES bytecode/CallLinkInfo.cpp bytecode/CallLinkStatus.cpp bytecode/CodeBlock.cpp + bytecode/CodeBlockHash.cpp + bytecode/CodeOrigin.cpp + bytecode/CodeType.cpp bytecode/DFGExitProfile.cpp bytecode/ExecutionCounter.cpp bytecode/GetByIdStatus.cpp @@ -150,6 +153,7 @@ SET(JavaScriptCore_SOURCES jit/JITArithmetic.cpp jit/JITCall32_64.cpp jit/JITCall.cpp + jit/JITCode.cpp jit/JIT.cpp jit/JITDisassembler.cpp jit/JITExceptions.cpp @@ -182,6 +186,7 @@ SET(JavaScriptCore_SOURCES runtime/BooleanPrototype.cpp runtime/CallData.cpp runtime/CodeCache.cpp + runtime/CodeSpecializationKind.cpp runtime/CommonIdentifiers.cpp runtime/Completion.cpp runtime/ConstructData.cpp diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog index 9ab660ba2..13066e436 100644 --- a/Source/JavaScriptCore/ChangeLog +++ b/Source/JavaScriptCore/ChangeLog @@ -1,3 +1,225 @@ +2012-11-30 Tor Arne Vestbø <tor.arne.vestbo@digia.com> + + [Qt] Place the LLIntOffsetsExtractor binaries in debug/release subdirs on Mac + + Otherwise we'll end up using the same LLIntAssembly.h for both build + configs of JavaScriptCore -- one of them which will be for the wrong + config. + + Reviewed by Simon Hausmann. + + * LLIntOffsetsExtractor.pro: + +2012-11-30 Julien BRIANCEAU <jbrianceau@nds.com> + + [sh4] Fix compilation warnings in JavaScriptCore JIT for sh4 arch + https://bugs.webkit.org/show_bug.cgi?id=103378 + + Reviewed by Filip Pizlo. + + * assembler/MacroAssemblerSH4.h: + (JSC::MacroAssemblerSH4::branchTest32): + (JSC::MacroAssemblerSH4::branchAdd32): + (JSC::MacroAssemblerSH4::branchMul32): + (JSC::MacroAssemblerSH4::branchSub32): + (JSC::MacroAssemblerSH4::branchOr32): + +2012-11-29 Rafael Weinstein <rafaelw@chromium.org> + + [HTMLTemplateElement] Add feature flag + https://bugs.webkit.org/show_bug.cgi?id=103694 + + Reviewed by Adam Barth. + + This flag will guard the implementation of the HTMLTemplateElement. + http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/templates/index.html + + * Configurations/FeatureDefines.xcconfig: + +2012-11-29 Filip Pizlo <fpizlo@apple.com> + + It should be easy to find code blocks in debug dumps + https://bugs.webkit.org/show_bug.cgi?id=103623 + + Reviewed by Goeffrey Garen. + + This gives CodeBlock a relatively strong, but also relatively compact, hash. We compute + it lazily so that it only impacts run-time when debug support is enabled. We stringify + it smartly so that it's short and easy to type. We base it on the source code so that + the optimization level is irrelevant. And, we use SHA1 since it's already in our code + base. Now, when a piece of code wants to print some debugging to say that it's operating + on some code block, it can use this CodeBlockHash instead of memory addresses. + + This also takes CodeBlock debugging into the new world of print() and dataLog(). In + particular, CodeBlock::dump() corresponds to the thing you want printed if you do: + + dataLog("I heart ", *myCodeBlock); + + Probably, you want to just print some identifying information at this point rather than + the full bytecode dump. So, the existing CodeBlock::dump() has been renamed to + CodeBlock::dumpBytecode(), and CodeBlock::dump() now prints the CodeBlockHash plus just + a few little tidbits. + + Here's an example of CodeBlock::dump() output: + + EkILzr:[0x103883a00, BaselineFunctionCall] + + EkILzr is the CodeBlockHash. 0x103883a00 is the CodeBlock's address in memory. The other + part is self-explanatory. + + Finally, this new notion of CodeBlockHash is available for other purposes like bisecting + breakage. As such CodeBlockHash has all of the comparison operator overloads. When + bisecting in DFGDriver.cpp, you can now say things like: + + if (codeBlock->hash() < CodeBlockHash("CAAAAA")) + return false; + + And yes, CAAAAA is near the median hash, and the largest one is smaller than E99999. Such + is life when you use base 62 to encode a 32-bit number. + + * CMakeLists.txt: + * GNUmakefile.list.am: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: + * JavaScriptCore.xcodeproj/project.pbxproj: + * Target.pri: + * bytecode/CallLinkInfo.h: + (CallLinkInfo): + (JSC::CallLinkInfo::specializationKind): + * bytecode/CodeBlock.cpp: + (JSC::CodeBlock::hash): + (JSC): + (JSC::CodeBlock::dumpAssumingJITType): + (JSC::CodeBlock::dump): + (JSC::CodeBlock::dumpBytecode): + (JSC::CodeBlock::CodeBlock): + (JSC::CodeBlock::finalizeUnconditionally): + (JSC::CodeBlock::resetStubInternal): + (JSC::CodeBlock::reoptimize): + (JSC::ProgramCodeBlock::jettison): + (JSC::EvalCodeBlock::jettison): + (JSC::FunctionCodeBlock::jettison): + (JSC::CodeBlock::shouldOptimizeNow): + (JSC::CodeBlock::tallyFrequentExitSites): + (JSC::CodeBlock::dumpValueProfiles): + * bytecode/CodeBlock.h: + (JSC::CodeBlock::specializationKind): + (CodeBlock): + (JSC::CodeBlock::getJITType): + * bytecode/CodeBlockHash.cpp: Added. + (JSC): + (JSC::CodeBlockHash::CodeBlockHash): + (JSC::CodeBlockHash::dump): + * bytecode/CodeBlockHash.h: Added. + (JSC): + (CodeBlockHash): + (JSC::CodeBlockHash::CodeBlockHash): + (JSC::CodeBlockHash::hash): + (JSC::CodeBlockHash::operator==): + (JSC::CodeBlockHash::operator!=): + (JSC::CodeBlockHash::operator<): + (JSC::CodeBlockHash::operator>): + (JSC::CodeBlockHash::operator<=): + (JSC::CodeBlockHash::operator>=): + * bytecode/CodeBlockWithJITType.h: Added. + (JSC): + (CodeBlockWithJITType): + (JSC::CodeBlockWithJITType::CodeBlockWithJITType): + (JSC::CodeBlockWithJITType::dump): + * bytecode/CodeOrigin.cpp: Added. + (JSC): + (JSC::CodeOrigin::inlineDepthForCallFrame): + (JSC::CodeOrigin::inlineDepth): + (JSC::CodeOrigin::inlineStack): + (JSC::InlineCallFrame::hash): + * bytecode/CodeOrigin.h: + (InlineCallFrame): + (JSC::InlineCallFrame::specializationKind): + (JSC): + * bytecode/CodeType.cpp: Added. + (WTF): + (WTF::printInternal): + * bytecode/CodeType.h: + (WTF): + * bytecode/ExecutionCounter.cpp: + (JSC::ExecutionCounter::dump): + * bytecode/ExecutionCounter.h: + (ExecutionCounter): + * dfg/DFGByteCodeParser.cpp: + (JSC::DFG::ByteCodeParser::parseCodeBlock): + * dfg/DFGDisassembler.cpp: + (JSC::DFG::Disassembler::dump): + * dfg/DFGGraph.cpp: + (JSC::DFG::Graph::dumpCodeOrigin): + * dfg/DFGOSRExitCompiler.cpp: + * dfg/DFGOperations.cpp: + * dfg/DFGRepatch.cpp: + (JSC::DFG::generateProtoChainAccessStub): + (JSC::DFG::tryCacheGetByID): + (JSC::DFG::tryBuildGetByIDList): + (JSC::DFG::emitPutReplaceStub): + (JSC::DFG::emitPutTransitionStub): + (JSC::DFG::dfgLinkClosureCall): + * interpreter/Interpreter.cpp: + (JSC::Interpreter::dumpCallFrame): + * jit/JITCode.cpp: Added. + (WTF): + (WTF::printInternal): + * jit/JITCode.h: + (JSC::JITCode::jitType): + (WTF): + * jit/JITDisassembler.cpp: + (JSC::JITDisassembler::dump): + (JSC::JITDisassembler::dumpForInstructions): + * jit/JITPropertyAccess.cpp: + (JSC::JIT::privateCompilePutByIdTransition): + (JSC::JIT::privateCompilePatchGetArrayLength): + (JSC::JIT::privateCompileGetByIdProto): + (JSC::JIT::privateCompileGetByIdSelfList): + (JSC::JIT::privateCompileGetByIdProtoList): + (JSC::JIT::privateCompileGetByIdChainList): + (JSC::JIT::privateCompileGetByIdChain): + (JSC::JIT::privateCompileGetByVal): + (JSC::JIT::privateCompilePutByVal): + * jit/JITPropertyAccess32_64.cpp: + (JSC::JIT::privateCompilePutByIdTransition): + (JSC::JIT::privateCompilePatchGetArrayLength): + (JSC::JIT::privateCompileGetByIdProto): + (JSC::JIT::privateCompileGetByIdSelfList): + (JSC::JIT::privateCompileGetByIdProtoList): + (JSC::JIT::privateCompileGetByIdChainList): + (JSC::JIT::privateCompileGetByIdChain): + * jit/JITStubs.cpp: + (JSC::DEFINE_STUB_FUNCTION): + * runtime/CodeSpecializationKind.cpp: Added. + (WTF): + (WTF::printInternal): + * runtime/CodeSpecializationKind.h: + (JSC::specializationFromIsCall): + (JSC): + (JSC::specializationFromIsConstruct): + (WTF): + * runtime/Executable.cpp: + (JSC::ExecutableBase::hashFor): + (JSC): + (JSC::NativeExecutable::hashFor): + (JSC::ScriptExecutable::hashFor): + * runtime/Executable.h: + (ExecutableBase): + (NativeExecutable): + (ScriptExecutable): + (JSC::ScriptExecutable::source): + +2012-11-29 Michael Saboff <msaboff@apple.com> + + Speculative Windows build fix after r136086. + + Unreviewed build fix. + + Suspect that ?setDumpsGeneratedCode@BytecodeGenerator@JSC@@SAX_N@Z needs to be removed from Windows + export list since the symbol was removed in r136086. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + 2012-11-28 Filip Pizlo <fpizlo@apple.com> SpeculatedType dumping should not use the static char buffer[thingy] idiom diff --git a/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig b/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig index 588ddb80b..00678accd 100644 --- a/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig +++ b/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig @@ -143,6 +143,7 @@ ENABLE_SVG = ENABLE_SVG; ENABLE_SVG_DOM_OBJC_BINDINGS = $(ENABLE_SVG_DOM_OBJC_BINDINGS_$(PLATFORM_NAME)); ENABLE_SVG_DOM_OBJC_BINDINGS_macosx = ENABLE_SVG_DOM_OBJC_BINDINGS; ENABLE_SVG_FONTS = ENABLE_SVG_FONTS; +ENABLE_TEMPLATE_ELEMENT = ; ENABLE_TEXT_AUTOSIZING = ; ENABLE_TEXT_NOTIFICATIONS_ONLY = ENABLE_TEXT_NOTIFICATIONS_ONLY; ENABLE_TOUCH_ICON_LOADING = ; @@ -158,5 +159,5 @@ ENABLE_WORKERS = ENABLE_WORKERS; ENABLE_XHR_TIMEOUT = ENABLE_XHR_TIMEOUT; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_DEVICE_ADAPTATION) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_STICKY_POSITION) $(ENABLE_CSS_VARIABLES) $(ENABLE_CSS3_CONDITIONAL_RULES) $(ENABLE_CSS3_BACKGROUND) $(ENABLE_CSS3_TEXT) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIALOG_ELEMENT) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_DRAGGABLE_REGION) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LEGACY_VENDOR_PREFIXES) $(ENABLE_LEGACY_WEB_AUDIO) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_PROGRESS_ELEMENT) $(ENABLE_PROXIMITY_EVENTS) $(ENABLE_QUOTA) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SUBPIXEL_LAYOUT) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_USERSELECT_ALL) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XHR_TIMEOUT) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_DEVICE_ADAPTATION) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_STICKY_POSITION) $(ENABLE_CSS_VARIABLES) $(ENABLE_CSS3_CONDITIONAL_RULES) $(ENABLE_CSS3_BACKGROUND) $(ENABLE_CSS3_TEXT) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIALOG_ELEMENT) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_DRAGGABLE_REGION) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LEGACY_VENDOR_PREFIXES) $(ENABLE_LEGACY_WEB_AUDIO) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_PROGRESS_ELEMENT) $(ENABLE_PROXIMITY_EVENTS) $(ENABLE_QUOTA) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SUBPIXEL_LAYOUT) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEMPLATE_ELEMENT) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_USERSELECT_ALL) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XHR_TIMEOUT) $(ENABLE_XSLT); diff --git a/Source/JavaScriptCore/Configurations/Version.xcconfig b/Source/JavaScriptCore/Configurations/Version.xcconfig index 4f8baa4f2..943e88ecf 100644 --- a/Source/JavaScriptCore/Configurations/Version.xcconfig +++ b/Source/JavaScriptCore/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 537; -MINOR_VERSION = 20; +MINOR_VERSION = 21; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/Source/JavaScriptCore/GNUmakefile.list.am b/Source/JavaScriptCore/GNUmakefile.list.am index c42ee7dfe..701d80fae 100644 --- a/Source/JavaScriptCore/GNUmakefile.list.am +++ b/Source/JavaScriptCore/GNUmakefile.list.am @@ -94,9 +94,14 @@ javascriptcore_sources += \ Source/JavaScriptCore/bytecode/CallLinkStatus.cpp \ Source/JavaScriptCore/bytecode/CallLinkStatus.h \ Source/JavaScriptCore/bytecode/CallReturnOffsetToBytecodeOffset.h \ + Source/JavaScriptCore/bytecode/CodeType.cpp \ Source/JavaScriptCore/bytecode/CodeType.h \ Source/JavaScriptCore/bytecode/CodeBlock.cpp \ Source/JavaScriptCore/bytecode/CodeBlock.h \ + Source/JavaScriptCore/bytecode/CodeBlockHash.cpp \ + Source/JavaScriptCore/bytecode/CodeBlockHash.h \ + Source/JavaScriptCore/bytecode/CodeBlockWithJITType.h \ + Source/JavaScriptCore/bytecode/CodeOrigin.cpp \ Source/JavaScriptCore/bytecode/CodeOrigin.h \ Source/JavaScriptCore/bytecode/Comment.h \ Source/JavaScriptCore/bytecode/DataFormat.h \ @@ -399,6 +404,7 @@ javascriptcore_sources += \ Source/JavaScriptCore/jit/JITArithmetic.cpp \ Source/JavaScriptCore/jit/JITCall32_64.cpp \ Source/JavaScriptCore/jit/JITCall.cpp \ + Source/JavaScriptCore/jit/JITCode.cpp \ Source/JavaScriptCore/jit/JITCode.h \ Source/JavaScriptCore/jit/JITCompilationEffort.h \ Source/JavaScriptCore/jit/JITDisassembler.cpp \ @@ -499,6 +505,7 @@ javascriptcore_sources += \ Source/JavaScriptCore/runtime/ClassInfo.h \ Source/JavaScriptCore/runtime/CodeCache.cpp \ Source/JavaScriptCore/runtime/CodeCache.h \ + Source/JavaScriptCore/runtime/CodeSpecializationKind.cpp \ Source/JavaScriptCore/runtime/CodeSpecializationKind.h \ Source/JavaScriptCore/runtime/CommonIdentifiers.cpp \ Source/JavaScriptCore/runtime/CommonIdentifiers.h \ diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def index 7aa5673d8..422aac464 100755 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def @@ -340,7 +340,6 @@ EXPORTS ?retrieveLastCaller@Interpreter@JSC@@QBEXPAVExecState@2@AAH1AAVString@WTF@@AAVJSValue@2@@Z ?setConfigurable@PropertyDescriptor@JSC@@QAEX_N@Z ?setDescriptor@PropertyDescriptor@JSC@@QAEXVJSValue@2@I@Z - ?setDumpsGeneratedCode@BytecodeGenerator@JSC@@SAX_N@Z ?setEnumerable@PropertyDescriptor@JSC@@QAEX_N@Z ?setGarbageCollectionTimerEnabled@Heap@JSC@@QAEX_N@Z ?setGetter@PropertyDescriptor@JSC@@QAEXVJSValue@2@@Z diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj index d26a3b645..e8eda62f9 100644 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj @@ -646,6 +646,14 @@ >
</File>
<File
+ RelativePath="..\..\runtime\CodeSpecializationKind.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\CodeSpecializationKind.h"
+ >
+ </File>
+ <File
RelativePath="..\..\runtime\CommonIdentifiers.cpp"
>
</File>
@@ -1630,6 +1638,22 @@ >
</File>
<File
+ RelativePath="..\..\bytecode\CodeBlockHash.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\bytecode\CodeBlockHash.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\bytecode\CodeBlockWithJITType.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\bytecode\CodeOrigin.cpp"
+ >
+ </File>
+ <File
RelativePath="..\..\bytecode\CodeOrigin.h"
>
</File>
@@ -1638,6 +1662,10 @@ >
</File>
<File
+ RelativePath="..\..\bytecode\CodeType.cpp"
+ >
+ </File>
+ <File
RelativePath="..\..\bytecode\Comment.h"
>
</File>
@@ -1982,6 +2010,10 @@ >
</File>
<File
+ RelativePath="..\..\jit\JITCode.cpp"
+ >
+ </File>
+ <File
RelativePath="..\..\jit\JITCode.h"
>
</File>
diff --git a/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj b/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj index a2c4b5f52..61867036a 100644 --- a/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj +++ b/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj @@ -170,6 +170,12 @@ 0F8335B71639C1E6001443B5 /* ArrayAllocationProfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F8335B41639C1E3001443B5 /* ArrayAllocationProfile.cpp */; }; 0F8335B81639C1EA001443B5 /* ArrayAllocationProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F8335B51639C1E3001443B5 /* ArrayAllocationProfile.h */; settings = {ATTRIBUTES = (Private, ); }; }; 0F8364B7164B0C110053329A /* DFGBranchDirection.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F8364B5164B0C0E0053329A /* DFGBranchDirection.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 0F8F943C1667631300D61971 /* CodeSpecializationKind.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F8F943A1667631100D61971 /* CodeSpecializationKind.cpp */; }; + 0F8F94401667633000D61971 /* CodeBlockHash.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F8F943D1667632D00D61971 /* CodeBlockHash.cpp */; }; + 0F8F94411667633200D61971 /* CodeBlockHash.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F8F943E1667632D00D61971 /* CodeBlockHash.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 0F8F94421667633500D61971 /* CodeType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F8F943F1667632D00D61971 /* CodeType.cpp */; }; + 0F8F94441667635400D61971 /* JITCode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F8F94431667635200D61971 /* JITCode.cpp */; }; + 0F8F9446166764F100D61971 /* CodeOrigin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F8F9445166764EE00D61971 /* CodeOrigin.cpp */; }; 0F919D0C157EE09F004A4E7D /* JSSymbolTableObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F919D09157EE09D004A4E7D /* JSSymbolTableObject.cpp */; }; 0F919D0D157EE0A2004A4E7D /* JSSymbolTableObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F919D0A157EE09D004A4E7D /* JSSymbolTableObject.h */; settings = {ATTRIBUTES = (Private, ); }; }; 0F919D10157F3329004A4E7D /* JSSegmentedVariableObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F919D0E157F3327004A4E7D /* JSSegmentedVariableObject.cpp */; }; @@ -185,6 +191,7 @@ 0F9332A414CA7DD90085F3C6 /* PutByIdStatus.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F93329A14CA7DC10085F3C6 /* PutByIdStatus.h */; settings = {ATTRIBUTES = (Private, ); }; }; 0F9332A514CA7DDD0085F3C6 /* StructureSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F93329B14CA7DC10085F3C6 /* StructureSet.h */; settings = {ATTRIBUTES = (Private, ); }; }; 0F963B3813FC6FE90002D9B2 /* ValueProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F963B3613FC6FDE0002D9B2 /* ValueProfile.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 0F96EBB316676EF6008BADE3 /* CodeBlockWithJITType.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F96EBB116676EF4008BADE3 /* CodeBlockWithJITType.h */; settings = {ATTRIBUTES = (Private, ); }; }; 0F9D3370165DBB90005AD387 /* Disassembler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F9D336E165DBB8D005AD387 /* Disassembler.cpp */; }; 0F9FC8C314E1B5FE00D52AE0 /* PolymorphicPutByIdList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F9FC8BF14E1B5FB00D52AE0 /* PolymorphicPutByIdList.cpp */; }; 0F9FC8C414E1B60000D52AE0 /* PolymorphicPutByIdList.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F9FC8C014E1B5FB00D52AE0 /* PolymorphicPutByIdList.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -968,6 +975,12 @@ 0F8335B41639C1E3001443B5 /* ArrayAllocationProfile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ArrayAllocationProfile.cpp; sourceTree = "<group>"; }; 0F8335B51639C1E3001443B5 /* ArrayAllocationProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArrayAllocationProfile.h; sourceTree = "<group>"; }; 0F8364B5164B0C0E0053329A /* DFGBranchDirection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGBranchDirection.h; path = dfg/DFGBranchDirection.h; sourceTree = "<group>"; }; + 0F8F943A1667631100D61971 /* CodeSpecializationKind.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CodeSpecializationKind.cpp; sourceTree = "<group>"; }; + 0F8F943D1667632D00D61971 /* CodeBlockHash.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CodeBlockHash.cpp; sourceTree = "<group>"; }; + 0F8F943E1667632D00D61971 /* CodeBlockHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CodeBlockHash.h; sourceTree = "<group>"; }; + 0F8F943F1667632D00D61971 /* CodeType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CodeType.cpp; sourceTree = "<group>"; }; + 0F8F94431667635200D61971 /* JITCode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITCode.cpp; sourceTree = "<group>"; }; + 0F8F9445166764EE00D61971 /* CodeOrigin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CodeOrigin.cpp; sourceTree = "<group>"; }; 0F919D09157EE09D004A4E7D /* JSSymbolTableObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSymbolTableObject.cpp; sourceTree = "<group>"; }; 0F919D0A157EE09D004A4E7D /* JSSymbolTableObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSymbolTableObject.h; sourceTree = "<group>"; }; 0F919D0E157F3327004A4E7D /* JSSegmentedVariableObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSegmentedVariableObject.cpp; sourceTree = "<group>"; }; @@ -983,6 +996,7 @@ 0F93329A14CA7DC10085F3C6 /* PutByIdStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PutByIdStatus.h; sourceTree = "<group>"; }; 0F93329B14CA7DC10085F3C6 /* StructureSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StructureSet.h; sourceTree = "<group>"; }; 0F963B3613FC6FDE0002D9B2 /* ValueProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ValueProfile.h; sourceTree = "<group>"; }; + 0F96EBB116676EF4008BADE3 /* CodeBlockWithJITType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CodeBlockWithJITType.h; sourceTree = "<group>"; }; 0F9D336E165DBB8D005AD387 /* Disassembler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Disassembler.cpp; path = disassembler/Disassembler.cpp; sourceTree = "<group>"; }; 0F9FC8BF14E1B5FB00D52AE0 /* PolymorphicPutByIdList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PolymorphicPutByIdList.cpp; sourceTree = "<group>"; }; 0F9FC8C014E1B5FB00D52AE0 /* PolymorphicPutByIdList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PolymorphicPutByIdList.h; sourceTree = "<group>"; }; @@ -1838,6 +1852,7 @@ A75706DD118A2BCF0057F88F /* JITArithmetic32_64.cpp */, 86CC85A20EE79B7400288682 /* JITCall.cpp */, 146FE51111A710430087AE66 /* JITCall32_64.cpp */, + 0F8F94431667635200D61971 /* JITCode.cpp */, 86CCEFDD0F413F8900FD7F9E /* JITCode.h */, 0F0776BD14FF002800102332 /* JITCompilationEffort.h */, 0FAF7EFA165BA919000C8455 /* JITDisassembler.cpp */, @@ -2136,6 +2151,7 @@ BCA62DFE0E2826230004F30D /* CallData.cpp */, 145C507F0D9DF63B0088F6B9 /* CallData.h */, BC6AAAE40E1F426500AD87D8 /* ClassInfo.h */, + 0F8F943A1667631100D61971 /* CodeSpecializationKind.cpp */, 0F21C27914BE727300ADC64B /* CodeSpecializationKind.h */, 65EA73620BAE35D1001BB560 /* CommonIdentifiers.cpp */, 65EA73630BAE35D1001BB560 /* CommonIdentifiers.h */, @@ -2560,9 +2576,14 @@ 0F93329314CA7DC10085F3C6 /* CallLinkStatus.cpp */, 0F93329414CA7DC10085F3C6 /* CallLinkStatus.h */, 0F0B83B814BCF95B00885B4F /* CallReturnOffsetToBytecodeOffset.h */, + 0F8F943D1667632D00D61971 /* CodeBlockHash.cpp */, + 0F8F943E1667632D00D61971 /* CodeBlockHash.h */, + 0F96EBB116676EF4008BADE3 /* CodeBlockWithJITType.h */, 969A07900ED1D3AE00F1F681 /* CodeBlock.cpp */, 969A07910ED1D3AE00F1F681 /* CodeBlock.h */, + 0F8F9445166764EE00D61971 /* CodeOrigin.cpp */, 0FBD7E671447998F00481315 /* CodeOrigin.h */, + 0F8F943F1667632D00D61971 /* CodeType.cpp */, 0F0B83A514BCF50400885B4F /* CodeType.h */, FEB63AA2159B9DA3008932A6 /* Comment.h */, 0F426A4A1460CD6B00131F8F /* DataFormat.h */, @@ -3054,6 +3075,8 @@ 0FAF7EFE165BA91F000C8455 /* JITDisassembler.h in Headers */, 0F73D7AF165A143000ACAB71 /* ClosureCallStubRoutine.h in Headers */, 0FDDBFB61666EEDA00C55FEF /* DFGVariableAccessDataDump.h in Headers */, + 0F8F94411667633200D61971 /* CodeBlockHash.h in Headers */, + 0F96EBB316676EF6008BADE3 /* CodeBlockWithJITType.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3637,6 +3660,11 @@ 0F73D7AE165A142D00ACAB71 /* ClosureCallStubRoutine.cpp in Sources */, 0F9D3370165DBB90005AD387 /* Disassembler.cpp in Sources */, 0FDDBFB51666EED800C55FEF /* DFGVariableAccessDataDump.cpp in Sources */, + 0F8F943C1667631300D61971 /* CodeSpecializationKind.cpp in Sources */, + 0F8F94401667633000D61971 /* CodeBlockHash.cpp in Sources */, + 0F8F94421667633500D61971 /* CodeType.cpp in Sources */, + 0F8F94441667635400D61971 /* JITCode.cpp in Sources */, + 0F8F9446166764F100D61971 /* CodeOrigin.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Source/JavaScriptCore/LLIntOffsetsExtractor.pro b/Source/JavaScriptCore/LLIntOffsetsExtractor.pro index ae635c1b5..50cdd44ef 100644 --- a/Source/JavaScriptCore/LLIntOffsetsExtractor.pro +++ b/Source/JavaScriptCore/LLIntOffsetsExtractor.pro @@ -8,6 +8,8 @@ TEMPLATE = app TARGET = LLIntOffsetsExtractor +macx: DESTDIR = $$activeBuildConfig() + debug_and_release { CONFIG += force_build_all CONFIG += build_all diff --git a/Source/JavaScriptCore/Target.pri b/Source/JavaScriptCore/Target.pri index e1caa725f..f609de10b 100644 --- a/Source/JavaScriptCore/Target.pri +++ b/Source/JavaScriptCore/Target.pri @@ -55,6 +55,9 @@ SOURCES += \ bytecode/CallLinkInfo.cpp \ bytecode/CallLinkStatus.cpp \ bytecode/CodeBlock.cpp \ + bytecode/CodeBlockHash.cpp \ + bytecode/CodeOrigin.cpp \ + bytecode/CodeType.cpp \ bytecode/DFGExitProfile.cpp \ bytecode/ExecutionCounter.cpp \ bytecode/GetByIdStatus.cpp \ @@ -155,6 +158,7 @@ SOURCES += \ jit/JITArithmetic32_64.cpp \ jit/JITCall.cpp \ jit/JITCall32_64.cpp \ + jit/JITCode.cpp \ jit/JIT.cpp \ jit/JITDisassembler.cpp \ jit/JITExceptions.cpp \ @@ -191,6 +195,7 @@ SOURCES += \ runtime/BooleanPrototype.cpp \ runtime/CallData.cpp \ runtime/CodeCache.cpp \ + runtime/CodeSpecializationKind.cpp \ runtime/CommonIdentifiers.cpp \ runtime/Completion.cpp \ runtime/ConstructData.cpp \ diff --git a/Source/JavaScriptCore/assembler/MacroAssemblerSH4.h b/Source/JavaScriptCore/assembler/MacroAssemblerSH4.h index ec025cec3..0c7fe12c6 100644 --- a/Source/JavaScriptCore/assembler/MacroAssemblerSH4.h +++ b/Source/JavaScriptCore/assembler/MacroAssemblerSH4.h @@ -1793,7 +1793,7 @@ void or32(TrustedImm32 imm, RegisterID src, RegisterID dest) m_assembler.testlRegReg(reg, mask); - if (cond == NotEqual) + if (cond == NonZero) // NotEqual return branchFalse(); return branchTrue(); } @@ -1807,7 +1807,7 @@ void or32(TrustedImm32 imm, RegisterID src, RegisterID dest) else testlImm(mask.m_value, reg); - if (cond == NotEqual) + if (cond == NonZero) // NotEqual return branchFalse(); return branchTrue(); } @@ -1821,7 +1821,7 @@ void or32(TrustedImm32 imm, RegisterID src, RegisterID dest) else testImm(mask.m_value, address.offset, address.base); - if (cond == NotEqual) + if (cond == NonZero) // NotEqual return branchFalse(); return branchTrue(); } @@ -1842,7 +1842,7 @@ void or32(TrustedImm32 imm, RegisterID src, RegisterID dest) releaseScratch(scr); - if (cond == NotEqual) + if (cond == NonZero) // NotEqual return branchFalse(); return branchTrue(); } @@ -1895,7 +1895,7 @@ void or32(TrustedImm32 imm, RegisterID src, RegisterID dest) m_assembler.addlRegReg(src, dest); compare32(0, dest, Equal); - if (cond == NotEqual) + if (cond == NonZero) // NotEqual return branchFalse(); return branchTrue(); } @@ -1930,7 +1930,7 @@ void or32(TrustedImm32 imm, RegisterID src, RegisterID dest) compare32(0, dest, Equal); - if (cond == NotEqual) + if (cond == NonZero) // NotEqual return branchFalse(); return branchTrue(); } @@ -1964,7 +1964,7 @@ void or32(TrustedImm32 imm, RegisterID src, RegisterID dest) compare32(0, dest, static_cast<RelationalCondition>(cond)); - if (cond == NotEqual) + if (cond == NonZero) // NotEqual return branchFalse(); return branchTrue(); } @@ -1999,7 +1999,7 @@ void or32(TrustedImm32 imm, RegisterID src, RegisterID dest) sub32(src, dest); compare32(0, dest, static_cast<RelationalCondition>(cond)); - if (cond == NotEqual) + if (cond == NonZero) // NotEqual return branchFalse(); return branchTrue(); } @@ -2040,7 +2040,7 @@ void or32(TrustedImm32 imm, RegisterID src, RegisterID dest) or32(src, dest); compare32(0, dest, static_cast<RelationalCondition>(cond)); - if (cond == NotEqual) + if (cond == NonZero) // NotEqual return branchFalse(); return branchTrue(); } diff --git a/Source/JavaScriptCore/bytecode/CallLinkInfo.h b/Source/JavaScriptCore/bytecode/CallLinkInfo.h index 89403b0ca..57608435c 100644 --- a/Source/JavaScriptCore/bytecode/CallLinkInfo.h +++ b/Source/JavaScriptCore/bytecode/CallLinkInfo.h @@ -28,6 +28,7 @@ #include "ClosureCallStubRoutine.h" #include "CodeLocation.h" +#include "CodeSpecializationKind.h" #include "JITWriteBarrier.h" #include "JSFunction.h" #include "Opcode.h" @@ -65,6 +66,11 @@ struct CallLinkInfo : public BasicRawSentinelNode<CallLinkInfo> { if (isOnList()) remove(); } + + CodeSpecializationKind specializationKind() const + { + return specializationFromIsConstruct(callType == Construct); + } CodeLocationNearCall callReturnLocation; CodeLocationDataLabelPtr hotPathBegin; diff --git a/Source/JavaScriptCore/bytecode/CodeBlock.cpp b/Source/JavaScriptCore/bytecode/CodeBlock.cpp index 6e1edaa0e..00209f236 100644 --- a/Source/JavaScriptCore/bytecode/CodeBlock.cpp +++ b/Source/JavaScriptCore/bytecode/CodeBlock.cpp @@ -62,6 +62,24 @@ namespace JSC { using namespace DFG; #endif +CodeBlockHash CodeBlock::hash() const +{ + return CodeBlockHash(ownerExecutable()->source(), specializationKind()); +} + +void CodeBlock::dumpAssumingJITType(PrintStream& out, JITCode::JITType jitType) const +{ + out.print("#", hash(), ":[", RawPointer(this), ", ", jitType, codeType()); + if (codeType() == FunctionCode) + out.print(specializationKind()); + out.print("]"); +} + +void CodeBlock::dump(PrintStream& out) const +{ + dumpAssumingJITType(out, getJITType()); +} + static String escapeQuotes(const String& str) { String result = str; @@ -480,7 +498,7 @@ void CodeBlock::printStructures(const Instruction* vPC) ASSERT(vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_generic) || vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_generic) || vPC[0].u.opcode == interpreter->getOpcode(op_call) || vPC[0].u.opcode == interpreter->getOpcode(op_call_eval) || vPC[0].u.opcode == interpreter->getOpcode(op_construct)); } -void CodeBlock::dump() +void CodeBlock::dumpBytecode() { // We only use the ExecState* for things that don't actually lead to JS execution, // like converting a JSString to a String. Hence the globalExec is appropriate. @@ -491,12 +509,12 @@ void CodeBlock::dump() for (size_t i = 0; i < instructions().size(); i += opcodeLengths[exec->interpreter()->getOpcodeID(instructions()[i].u.opcode)]) ++instructionCount; + dataLog(*this); dataLogF( - "%lu m_instructions; %lu bytes at %p (%s); %d parameter(s); %d callee register(s); %d variable(s)", + ": %lu m_instructions; %lu bytes; %d parameter(s); %d callee register(s); %d variable(s)", static_cast<unsigned long>(instructions().size()), static_cast<unsigned long>(instructions().size() * sizeof(Instruction)), - this, codeTypeToString(codeType()), m_numParameters, m_numCalleeRegisters, - m_numVars); + m_numParameters, m_numCalleeRegisters, m_numVars); if (symbolTable() && symbolTable()->captureCount()) dataLogF("; %d captured var(s)", symbolTable()->captureCount()); if (usesArguments()) { @@ -512,7 +530,7 @@ void CodeBlock::dump() const Instruction* begin = instructions().begin(); const Instruction* end = instructions().end(); for (const Instruction* it = begin; it != end; ++it) - dump(exec, begin, it); + dumpBytecode(exec, begin, it); if (!m_identifiers.isEmpty()) { dataLogF("\nIdentifiers:\n"); @@ -607,7 +625,7 @@ void CodeBlock::dump() dataLogF("\n"); } -void CodeBlock::dump(ExecState* exec, const Instruction* begin, const Instruction*& it) +void CodeBlock::dumpBytecode(ExecState* exec, const Instruction* begin, const Instruction*& it) { int location = it - begin; switch (exec->interpreter()->getOpcodeID(it->u.opcode)) { @@ -1458,11 +1476,11 @@ void CodeBlock::dump(ExecState* exec, const Instruction* begin, const Instructio } } -void CodeBlock::dump(unsigned bytecodeOffset) +void CodeBlock::dumpBytecode(unsigned bytecodeOffset) { ExecState* exec = m_globalObject->globalExec(); const Instruction* it = instructions().begin() + bytecodeOffset; - dump(exec, instructions().begin(), it); + dumpBytecode(exec, instructions().begin(), it); } #if DUMP_CODE_BLOCK_STATISTICS @@ -1892,7 +1910,7 @@ CodeBlock::CodeBlock(ScriptExecutable* ownerExecutable, UnlinkedCodeBlock* unlin m_instructions = WTF::RefCountedArray<Instruction>(instructions); if (Options::dumpGeneratedBytecodes()) - dump(); + dumpBytecode(); m_globalData->finishedCompiling(this); } @@ -2186,7 +2204,7 @@ void CodeBlock::finalizeUnconditionally() for (unsigned i = 0; i < m_llintCallLinkInfos.size(); ++i) { if (m_llintCallLinkInfos[i].isLinked() && !Heap::isMarked(m_llintCallLinkInfos[i].callee.get())) { if (verboseUnlinking) - dataLogF("Clearing LLInt call from %p.\n", this); + dataLog("Clearing LLInt call from ", *this, "\n"); m_llintCallLinkInfos[i].unlink(); } if (!!m_llintCallLinkInfos[i].lastSeenCallee && !Heap::isMarked(m_llintCallLinkInfos[i].lastSeenCallee.get())) @@ -2199,14 +2217,14 @@ void CodeBlock::finalizeUnconditionally() // Check if we're not live. If we are, then jettison. if (!(shouldImmediatelyAssumeLivenessDuringScan() || m_dfgData->livenessHasBeenProved)) { if (verboseUnlinking) - dataLogF("Code block %p (executable %p) has dead weak references, jettisoning during GC.\n", this, ownerExecutable()); + dataLog(*this, " has dead weak references, jettisoning during GC.\n"); // Make sure that the baseline JIT knows that it should re-warm-up before // optimizing. alternative()->optimizeAfterWarmUp(); if (DFG::shouldShowDisassembly()) { - dataLogF("DFG CodeBlock %p will be jettisoned because of the following dead references:\n", this); + dataLog(*this, "will be jettisoned because of the following dead references:\n"); for (unsigned i = 0; i < m_dfgData->transitions.size(); ++i) { WeakReferenceTransition& transition = m_dfgData->transitions[i]; JSCell* origin = transition.m_codeOrigin.get(); @@ -2234,7 +2252,7 @@ void CodeBlock::finalizeUnconditionally() for (size_t size = m_putToBaseOperations.size(), i = 0; i < size; ++i) { if (m_putToBaseOperations[i].m_structure && !Heap::isMarked(m_putToBaseOperations[i].m_structure.get())) { if (verboseUnlinking) - dataLogF("Clearing putToBase info in %p.\n", this); + dataLog("Clearing putToBase info in ", *this, "\n"); m_putToBaseOperations[i].m_structure.clear(); } } @@ -2248,7 +2266,7 @@ void CodeBlock::finalizeUnconditionally() m_resolveOperations[i].last().m_structure.clear(); if (m_resolveOperations[i].last().m_structure && !Heap::isMarked(m_resolveOperations[i].last().m_structure.get())) { if (verboseUnlinking) - dataLogF("Clearing resolve info in %p.\n", this); + dataLog("Clearing resolve info in ", *this, "\n"); m_resolveOperations[i].last().m_structure.clear(); } } @@ -2262,13 +2280,23 @@ void CodeBlock::finalizeUnconditionally() if (ClosureCallStubRoutine* stub = callLinkInfo(i).stub.get()) { if (!Heap::isMarked(stub->structure()) || !Heap::isMarked(stub->executable())) { - if (verboseUnlinking) - dataLogF("Clearing closure call from %p to %p, stub routine %p.\n", this, stub->executable(), stub); + if (verboseUnlinking) { + dataLog( + "Clearing closure call from ", *this, " to ", + stub->executable()->hashFor(callLinkInfo(i).specializationKind()), + ", stub routine ", RawPointer(stub), ".\n"); + } callLinkInfo(i).unlink(*m_globalData, repatchBuffer); } } else if (!Heap::isMarked(callLinkInfo(i).callee.get())) { - if (verboseUnlinking) - dataLogF("Clearing call from %p to %p.\n", this, callLinkInfo(i).callee.get()); + if (verboseUnlinking) { + dataLog( + "Clearing call from ", *this, " to ", + RawPointer(callLinkInfo(i).callee.get()), " (", + callLinkInfo(i).callee.get()->executable()->hashFor( + callLinkInfo(i).specializationKind()), + ").\n"); + } callLinkInfo(i).unlink(*m_globalData, repatchBuffer); } } @@ -2303,7 +2331,7 @@ void CodeBlock::resetStubInternal(RepatchBuffer& repatchBuffer, StructureStubInf AccessType accessType = static_cast<AccessType>(stubInfo.accessType); if (verboseUnlinking) - dataLogF("Clearing structure cache (kind %d) in %p.\n", stubInfo.accessType, this); + dataLog("Clearing structure cache (kind ", static_cast<int>(stubInfo.accessType), ") in ", *this, ".\n"); if (isGetByIdAccess(accessType)) { if (getJITCode().jitType() == JITCode::DFGJIT) @@ -2769,7 +2797,7 @@ void CodeBlock::reoptimize() ASSERT(replacement()->alternative() == this); replacement()->tallyFrequentExitSites(); if (DFG::shouldShowDisassembly()) - dataLogF("DFG CodeBlock %p will be jettisoned due to reoptimization of %p.\n", replacement(), this); + dataLog(*replacement(), " will be jettisoned due to reoptimization of ", *this, ".\n"); replacement()->jettison(); countReoptimization(); optimizeAfterWarmUp(); @@ -2836,7 +2864,7 @@ void ProgramCodeBlock::jettison() ASSERT(JITCode::isOptimizingJIT(getJITType())); ASSERT(this == replacement()); if (DFG::shouldShowDisassembly()) - dataLogF("Jettisoning DFG CodeBlock %p.\n", this); + dataLog("Jettisoning ", *this, ".\n"); static_cast<ProgramExecutable*>(ownerExecutable())->jettisonOptimizedCode(*globalData()); } @@ -2845,7 +2873,7 @@ void EvalCodeBlock::jettison() ASSERT(JITCode::isOptimizingJIT(getJITType())); ASSERT(this == replacement()); if (DFG::shouldShowDisassembly()) - dataLogF("Jettisoning DFG CodeBlock %p.\n", this); + dataLog("Jettisoning ", *this, ".\n"); static_cast<EvalExecutable*>(ownerExecutable())->jettisonOptimizedCode(*globalData()); } @@ -2854,7 +2882,7 @@ void FunctionCodeBlock::jettison() ASSERT(JITCode::isOptimizingJIT(getJITType())); ASSERT(this == replacement()); if (DFG::shouldShowDisassembly()) - dataLogF("Jettisoning DFG CodeBlock %p.\n", this); + dataLog("Jettisoning ", *this, ".\n"); static_cast<FunctionExecutable*>(ownerExecutable())->jettisonOptimizedCodeFor(*globalData(), m_isConstructor ? CodeForConstruct : CodeForCall); } @@ -2948,7 +2976,7 @@ void CodeBlock::updateAllPredictions(OperationInProgress operation) bool CodeBlock::shouldOptimizeNow() { #if ENABLE(JIT_VERBOSE_OSR) - dataLogF("Considering optimizing %p...\n", this); + dataLog("Considering optimizing ", *this, "...\n"); #endif #if ENABLE(VERBOSE_VALUE_PROFILE) @@ -2996,7 +3024,7 @@ void CodeBlock::tallyFrequentExitSites() continue; #if DFG_ENABLE(DEBUG_VERBOSE) - dataLogF("OSR exit #%u (bc#%u, @%u, %s) for code block %p occurred frequently; counting as frequent exit site.\n", i, exit.m_codeOrigin.bytecodeIndex, exit.m_nodeIndex, DFG::exitKindToString(exit.m_kind), this); + dataLog("OSR exit #", i, " (bc#", exit.m_codeOrigin.bytecodeIndex, ", @", exit.m_nodeIndex, ", ", DFG::exitKindToString(exit.m_kind), ") for ", *this, " occurred frequently: counting as frequent exit site.\n"); #endif } } @@ -3005,7 +3033,7 @@ void CodeBlock::tallyFrequentExitSites() #if ENABLE(VERBOSE_VALUE_PROFILE) void CodeBlock::dumpValueProfiles() { - dataLogF("ValueProfile for %p:\n", this); + dataLog("ValueProfile for ", *this, ":\n"); for (unsigned i = 0; i < totalNumberOfValueProfiles(); ++i) { ValueProfile* profile = getFromAllValueProfiles(i); if (profile->m_bytecodeOffset < 0) { @@ -3020,12 +3048,12 @@ void CodeBlock::dumpValueProfiles() profile->dump(WTF::dataFile()); dataLogF("\n"); } - dataLogF("RareCaseProfile for %p:\n", this); + dataLog("RareCaseProfile for ", *this, ":\n"); for (unsigned i = 0; i < numberOfRareCaseProfiles(); ++i) { RareCaseProfile* profile = rareCaseProfile(i); dataLogF(" bc = %d: %u\n", profile->m_bytecodeOffset, profile->m_counter); } - dataLogF("SpecialFastCaseProfile for %p:\n", this); + dataLog("SpecialFastCaseProfile for ", *this, ":\n"); for (unsigned i = 0; i < numberOfSpecialFastCaseProfiles(); ++i) { RareCaseProfile* profile = specialFastCaseProfile(i); dataLogF(" bc = %d: %u\n", profile->m_bytecodeOffset, profile->m_counter); diff --git a/Source/JavaScriptCore/bytecode/CodeBlock.h b/Source/JavaScriptCore/bytecode/CodeBlock.h index 63a03630e..20f1e7452 100644 --- a/Source/JavaScriptCore/bytecode/CodeBlock.h +++ b/Source/JavaScriptCore/bytecode/CodeBlock.h @@ -35,6 +35,7 @@ #include "BytecodeConventions.h" #include "CallLinkInfo.h" #include "CallReturnOffsetToBytecodeOffset.h" +#include "CodeBlockHash.h" #include "CodeOrigin.h" #include "CodeType.h" #include "Comment.h" @@ -128,6 +129,10 @@ namespace JSC { public: JS_EXPORT_PRIVATE virtual ~CodeBlock(); + CodeBlockHash hash() const; + void dumpAssumingJITType(PrintStream&, JITCode::JITType) const; + void dump(PrintStream&) const; + int numParameters() const { return m_numParameters; } void setNumParameters(int newValue); @@ -138,11 +143,9 @@ namespace JSC { PassOwnPtr<CodeBlock> releaseAlternative() { return m_alternative.release(); } void setAlternative(PassOwnPtr<CodeBlock> alternative) { m_alternative = alternative; } - CodeSpecializationKind specializationKind() + CodeSpecializationKind specializationKind() const { - if (m_isConstructor) - return CodeForConstruct; - return CodeForCall; + return specializationFromIsConstruct(m_isConstructor); } #if ENABLE(JIT) @@ -163,8 +166,8 @@ namespace JSC { static void dumpStatistics(); - void dump(); - void dump(unsigned bytecodeOffset); + void dumpBytecode(); + void dumpBytecode(unsigned bytecodeOffset); void printStructures(const Instruction*); void printStructure(const char* name, const Instruction*, int operand); @@ -472,7 +475,7 @@ namespace JSC { } JITCode& getJITCode() { return m_jitCode; } MacroAssemblerCodePtr getJITCodeWithArityCheck() { return m_jitCodeWithArityCheck; } - JITCode::JITType getJITType() { return m_jitCode.jitType(); } + JITCode::JITType getJITType() const { return m_jitCode.jitType(); } ExecutableMemoryHandle* executableMemory() { return getJITCode().getExecutableMemory(); } virtual JSObject* compileOptimized(ExecState*, JSScope*, unsigned bytecodeIndex) = 0; virtual void jettison() = 0; @@ -1212,7 +1215,7 @@ namespace JSC { m_constantRegisters[i].set(*m_globalData, ownerExecutable(), constants[i].get()); } - void dump(ExecState*, const Instruction* begin, const Instruction*&); + void dumpBytecode(ExecState*, const Instruction* begin, const Instruction*&); CString registerName(ExecState*, int r) const; void printUnaryOp(ExecState*, int location, const Instruction*&, const char* op); diff --git a/Source/JavaScriptCore/bytecode/CodeBlockHash.cpp b/Source/JavaScriptCore/bytecode/CodeBlockHash.cpp new file mode 100644 index 000000000..79fe9ccb5 --- /dev/null +++ b/Source/JavaScriptCore/bytecode/CodeBlockHash.cpp @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2012 Apple 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 APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "CodeBlockHash.h" + +#include "SourceCode.h" +#include <wtf/SHA1.h> + +namespace JSC { + +#define TABLE ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") + +CodeBlockHash::CodeBlockHash(const char* string) + : m_hash(0) +{ + if (strlen(string) != 6) + CRASH(); + + for (unsigned i = 0; i < 6; ++i) { + m_hash *= 62; + unsigned c = string[i]; + if (c >= 'A' && c <= 'Z') { + m_hash += c - 'A'; + continue; + } + if (c >= 'a' && c <= 'z') { + m_hash += c - 'a' + 26; + continue; + } + ASSERT(c >= '0' && c <= '9'); + m_hash += c - '0' + 26 * 2; + } +} + +CodeBlockHash::CodeBlockHash(const SourceCode& sourceCode, CodeSpecializationKind kind) + : m_hash(0) +{ + SHA1 sha1; + sha1.addBytes(sourceCode.toString().utf8()); + Vector<uint8_t, 20> digest; + sha1.computeHash(digest); + m_hash += digest[0] | (digest[1] << 8) | (digest[2] << 16) | (digest[3] << 24); + m_hash ^= static_cast<unsigned>(kind); +} + +void CodeBlockHash::dump(PrintStream& out) const +{ + ASSERT(strlen(TABLE) == 62); + + char buffer[7]; + unsigned accumulator = m_hash; + for (unsigned i = 6; i--;) { + buffer[i] = TABLE[accumulator % 62]; + accumulator /= 62; + } + buffer[6] = 0; + +#if !ASSERT_DISABLED + CodeBlockHash recompute(buffer); + ASSERT(recompute == *this); +#endif // !ASSERT_DISABLED + + out.print(buffer); +} + +} // namespace JSC + diff --git a/Source/JavaScriptCore/bytecode/CodeBlockHash.h b/Source/JavaScriptCore/bytecode/CodeBlockHash.h new file mode 100644 index 000000000..20de8ed48 --- /dev/null +++ b/Source/JavaScriptCore/bytecode/CodeBlockHash.h @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2012 Apple 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 APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef CodeBlockHash_h +#define CodeBlockHash_h + +#include "CodeSpecializationKind.h" +#include <wtf/PrintStream.h> + +// CodeBlock hashes are useful for informally identifying code blocks. They correspond +// to the low 32 bits of a SHA1 hash of the source code with two low bit flipped +// according to the role that the code block serves (call, construct). Additionally, the +// hashes are typically operated over using a string in which the hash is transformed +// into a 6-byte alphanumeric representation. This can be retrieved by using +// toString(const CodeBlockHash&). Finally, we support CodeBlockHashes for native +// functions, in which case the hash is replaced by the function address. + +namespace JSC { + +class SourceCode; + +class CodeBlockHash { +public: + CodeBlockHash() + : m_hash(0) + { + } + + explicit CodeBlockHash(unsigned hash) + : m_hash(hash) + { + } + + CodeBlockHash(const SourceCode&, CodeSpecializationKind); + + explicit CodeBlockHash(const char*); + + unsigned hash() const { return m_hash; } + + void dump(PrintStream&) const; + + // Comparison methods useful for bisection. + bool operator==(const CodeBlockHash& other) const { return hash() == other.hash(); } + bool operator!=(const CodeBlockHash& other) const { return hash() != other.hash(); } + bool operator<(const CodeBlockHash& other) const { return hash() < other.hash(); } + bool operator>(const CodeBlockHash& other) const { return hash() > other.hash(); } + bool operator<=(const CodeBlockHash& other) const { return hash() <= other.hash(); } + bool operator>=(const CodeBlockHash& other) const { return hash() >= other.hash(); } + +private: + unsigned m_hash; +}; + +} // namespace JSC + +#endif // CodeBlockHash_h diff --git a/Source/JavaScriptCore/bytecode/CodeBlockWithJITType.h b/Source/JavaScriptCore/bytecode/CodeBlockWithJITType.h new file mode 100644 index 000000000..d87085841 --- /dev/null +++ b/Source/JavaScriptCore/bytecode/CodeBlockWithJITType.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2012 Apple 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 APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef CodeBlockWithJITType_h +#define CodeBlockWithJITType_h + +#include "CodeBlock.h" + +namespace JSC { + +// We sometimes what to print the CodeBlock's ID before setting its JITCode. At that +// point the CodeBlock will claim a bogus JITType. This helper class lets us do that. + +class CodeBlockWithJITType { +public: + CodeBlockWithJITType(CodeBlock* codeBlock, JITCode::JITType jitType) + : m_codeBlock(codeBlock) + , m_jitType(jitType) + { + } + + void dump(PrintStream& out) const + { + m_codeBlock->dumpAssumingJITType(out, m_jitType); + } +private: + CodeBlock* m_codeBlock; + JITCode::JITType m_jitType; +}; + +} // namespace JSC + +#endif // CodeBlockWithJITType_h + diff --git a/Source/JavaScriptCore/bytecode/CodeOrigin.cpp b/Source/JavaScriptCore/bytecode/CodeOrigin.cpp new file mode 100644 index 000000000..92e2b0fc9 --- /dev/null +++ b/Source/JavaScriptCore/bytecode/CodeOrigin.cpp @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2012 Apple 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 APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "CodeOrigin.h" + +#include "Executable.h" + +namespace JSC { + +unsigned CodeOrigin::inlineDepthForCallFrame(InlineCallFrame* inlineCallFrame) +{ + unsigned result = 1; + for (InlineCallFrame* current = inlineCallFrame; current; current = current->caller.inlineCallFrame) + result++; + return result; +} + +unsigned CodeOrigin::inlineDepth() const +{ + return inlineDepthForCallFrame(inlineCallFrame); +} + +Vector<CodeOrigin> CodeOrigin::inlineStack() const +{ + Vector<CodeOrigin> result(inlineDepth()); + result.last() = *this; + unsigned index = result.size() - 2; + for (InlineCallFrame* current = inlineCallFrame; current; current = current->caller.inlineCallFrame) + result[index--] = current->caller; + return result; +} + +CodeBlockHash InlineCallFrame::hash() const +{ + return executable->hashFor(specializationKind()); +} + +} // namespace JSC + diff --git a/Source/JavaScriptCore/bytecode/CodeOrigin.h b/Source/JavaScriptCore/bytecode/CodeOrigin.h index c9c0f7005..d8fbf7328 100644 --- a/Source/JavaScriptCore/bytecode/CodeOrigin.h +++ b/Source/JavaScriptCore/bytecode/CodeOrigin.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Apple Inc. All rights reserved. + * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,6 +26,8 @@ #ifndef CodeOrigin_h #define CodeOrigin_h +#include "CodeBlockHash.h" +#include "CodeSpecializationKind.h" #include "ValueRecovery.h" #include "WriteBarrier.h" #include <wtf/BitVector.h> @@ -98,6 +100,10 @@ struct InlineCallFrame { BitVector capturedVars; // Indexed by the machine call frame's variable numbering. unsigned stackOffset : 31; bool isCall : 1; + + CodeSpecializationKind specializationKind() const { return specializationFromIsCall(isCall); } + + CodeBlockHash hash() const; }; struct CodeOriginAtCallReturnOffset { @@ -105,36 +111,12 @@ struct CodeOriginAtCallReturnOffset { unsigned callReturnOffset; }; -inline unsigned CodeOrigin::inlineDepthForCallFrame(InlineCallFrame* inlineCallFrame) -{ - unsigned result = 1; - for (InlineCallFrame* current = inlineCallFrame; current; current = current->caller.inlineCallFrame) - result++; - return result; -} - -inline unsigned CodeOrigin::inlineDepth() const -{ - return inlineDepthForCallFrame(inlineCallFrame); -} - inline bool CodeOrigin::operator==(const CodeOrigin& other) const { return bytecodeIndex == other.bytecodeIndex && inlineCallFrame == other.inlineCallFrame; } -// Get the inline stack. This is slow, and is intended for debugging only. -inline Vector<CodeOrigin> CodeOrigin::inlineStack() const -{ - Vector<CodeOrigin> result(inlineDepth()); - result.last() = *this; - unsigned index = result.size() - 2; - for (InlineCallFrame* current = inlineCallFrame; current; current = current->caller.inlineCallFrame) - result[index--] = current->caller; - return result; -} - inline unsigned getCallReturnOffsetForCodeOrigin(CodeOriginAtCallReturnOffset* data) { return data->callReturnOffset; diff --git a/Source/JavaScriptCore/bytecode/CodeType.cpp b/Source/JavaScriptCore/bytecode/CodeType.cpp new file mode 100644 index 000000000..8b2cad56a --- /dev/null +++ b/Source/JavaScriptCore/bytecode/CodeType.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2012 Apple 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 APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "CodeType.h" + +#include <wtf/PrintStream.h> + +namespace WTF { + +void printInternal(PrintStream& out, JSC::CodeType codeType) +{ + switch (codeType) { + case JSC::GlobalCode: + out.print("Global"); + return; + case JSC::EvalCode: + out.print("Eval"); + return; + case JSC::FunctionCode: + out.print("Function"); + return; + default: + CRASH(); + return; + } +} + +} // namespace WTF + diff --git a/Source/JavaScriptCore/bytecode/CodeType.h b/Source/JavaScriptCore/bytecode/CodeType.h index d33677ae7..04afc1109 100644 --- a/Source/JavaScriptCore/bytecode/CodeType.h +++ b/Source/JavaScriptCore/bytecode/CodeType.h @@ -32,22 +32,14 @@ namespace JSC { enum CodeType { GlobalCode, EvalCode, FunctionCode }; -inline const char* codeTypeToString(CodeType codeType) -{ - switch (codeType) { - case GlobalCode: - return "GlobalCode"; - case EvalCode: - return "EvalCode"; - case FunctionCode: - return "FunctionCode"; - default: - ASSERT_NOT_REACHED(); - return 0; - } -} - } // namespace JSC +namespace WTF { + +class PrintStream; +void printInternal(PrintStream&, JSC::CodeType); + +} // namespace WTF + #endif // CodeType_h diff --git a/Source/JavaScriptCore/bytecode/ExecutionCounter.cpp b/Source/JavaScriptCore/bytecode/ExecutionCounter.cpp index 12a404981..e619a0376 100644 --- a/Source/JavaScriptCore/bytecode/ExecutionCounter.cpp +++ b/Source/JavaScriptCore/bytecode/ExecutionCounter.cpp @@ -160,11 +160,9 @@ void ExecutionCounter::reset() m_activeThreshold = 0; } -const char* ExecutionCounter::status() const +void ExecutionCounter::dump(PrintStream& out) const { - static char result[80]; - snprintf(result, sizeof(result), "%lf/%lf, %d", count(), static_cast<double>(m_activeThreshold), m_counter); - return result; + out.printf("%lf/%lf, %d", count(), static_cast<double>(m_activeThreshold), m_counter); } } // namespace JSC diff --git a/Source/JavaScriptCore/bytecode/ExecutionCounter.h b/Source/JavaScriptCore/bytecode/ExecutionCounter.h index f40650a31..c755c0445 100644 --- a/Source/JavaScriptCore/bytecode/ExecutionCounter.h +++ b/Source/JavaScriptCore/bytecode/ExecutionCounter.h @@ -28,6 +28,7 @@ #include "JSGlobalObject.h" #include "Options.h" +#include <wtf/PrintStream.h> #include <wtf/SimpleStats.h> namespace JSC { @@ -41,7 +42,7 @@ public: void setNewThreshold(int32_t threshold, CodeBlock*); void deferIndefinitely(); double count() const { return static_cast<double>(m_totalCount) + m_counter; } - const char* status() const; + void dump(PrintStream&) const; static double applyMemoryUsageHeuristics(int32_t value, CodeBlock*); static int32_t applyMemoryUsageHeuristicsAndConvertToInt(int32_t value, CodeBlock*); template<typename T> diff --git a/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp b/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp index c5ffb1fc6..3facd63bb 100644 --- a/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp +++ b/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp @@ -3645,21 +3645,23 @@ void ByteCodeParser::parseCodeBlock() CodeBlock* codeBlock = m_inlineStackTop->m_codeBlock; #if DFG_ENABLE(DEBUG_VERBOSE) - dataLogF("Parsing code block %p. codeType = %s, captureCount = %u, needsFullScopeChain = %s, needsActivation = %s, isStrictMode = %s\n", - codeBlock, - codeTypeToString(codeBlock->codeType()), - codeBlock->symbolTable() ? codeBlock->symbolTable()->captureCount() : 0, - codeBlock->needsFullScopeChain()?"true":"false", - codeBlock->ownerExecutable()->needsActivation()?"true":"false", - codeBlock->ownerExecutable()->isStrictMode()?"true":"false"); - codeBlock->baselineVersion()->dump(); + dataLog( + "Parsing ", *codeBlock, + ": captureCount = ", codeBlock->symbolTable() ? codeBlock->symbolTable()->captureCount() : 0, + ", needsFullScopeChain = ", codeBlock->needsFullScopeChain(), + ", needsActivation = ", codeBlock->ownerExecutable()->needsActivation(), + ", isStrictMode = ", codeBlock->ownerExecutable()->isStrictMode(), "\n"); + codeBlock->baselineVersion()->dumpBytecode(); #endif for (unsigned jumpTargetIndex = 0; jumpTargetIndex <= codeBlock->numberOfJumpTargets(); ++jumpTargetIndex) { // The maximum bytecode offset to go into the current basicblock is either the next jump target, or the end of the instructions. unsigned limit = jumpTargetIndex < codeBlock->numberOfJumpTargets() ? codeBlock->jumpTarget(jumpTargetIndex) : codeBlock->instructions().size(); #if DFG_ENABLE(DEBUG_VERBOSE) - dataLogF("Parsing bytecode with limit %p bc#%u at inline depth %u.\n", m_inlineStackTop->executable(), limit, CodeOrigin::inlineDepthForCallFrame(m_inlineStackTop->m_inlineCallFrame)); + dataLog( + "Parsing bytecode with limit ", m_inlineStackTop->m_inlineCallFrame->hash(), + " bc#", limit, " at inline depth ", + CodeOrigin::inlineDepthForCallFrame(m_inlineStackTop->m_inlineCallFrame), ".\n"); #endif ASSERT(m_currentIndex < limit); diff --git a/Source/JavaScriptCore/dfg/DFGDisassembler.cpp b/Source/JavaScriptCore/dfg/DFGDisassembler.cpp index f09b974a5..a7fccd58f 100644 --- a/Source/JavaScriptCore/dfg/DFGDisassembler.cpp +++ b/Source/JavaScriptCore/dfg/DFGDisassembler.cpp @@ -28,6 +28,7 @@ #if ENABLE(DFG_JIT) +#include "CodeBlockWithJITType.h" #include "DFGGraph.h" namespace JSC { namespace DFG { @@ -43,7 +44,7 @@ void Disassembler::dump(PrintStream& out, LinkBuffer& linkBuffer) { m_graph.m_dominators.computeIfNecessary(m_graph); - out.print("Generated JIT code for DFG CodeBlock ", RawPointer(m_graph.m_codeBlock), ", instruction count = ", m_graph.m_codeBlock->instructionCount(), ":\n"); + out.print("Generated JIT code for ", CodeBlockWithJITType(m_graph.m_codeBlock, JITCode::DFGJIT), ", instruction count = ", m_graph.m_codeBlock->instructionCount(), ":\n"); out.print(" Code at [", RawPointer(linkBuffer.debugAddress()), ", ", RawPointer(static_cast<char*>(linkBuffer.debugAddress()) + linkBuffer.debugSize()), "):\n"); const char* prefix = " "; diff --git a/Source/JavaScriptCore/dfg/DFGGraph.cpp b/Source/JavaScriptCore/dfg/DFGGraph.cpp index 270f53b87..c8008230a 100644 --- a/Source/JavaScriptCore/dfg/DFGGraph.cpp +++ b/Source/JavaScriptCore/dfg/DFGGraph.cpp @@ -88,14 +88,14 @@ void Graph::dumpCodeOrigin(PrintStream& out, const char* prefix, NodeIndex prevN for (unsigned i = previousInlineStack.size(); i-- > indexOfDivergence;) { out.print(prefix); printWhiteSpace(out, i * 2); - out.print("<-- ", RawPointer(previousInlineStack[i].inlineCallFrame->executable.get()), "\n"); + out.print("<-- #", previousInlineStack[i].inlineCallFrame->hash(), "\n"); } // Print the pushes. for (unsigned i = indexOfDivergence; i < currentInlineStack.size(); ++i) { out.print(prefix); printWhiteSpace(out, i * 2); - out.print("--> ", RawPointer(currentInlineStack[i].inlineCallFrame->executable.get()), "\n"); + out.print("--> #", currentInlineStack[i].inlineCallFrame->hash(), "\n"); } } diff --git a/Source/JavaScriptCore/dfg/DFGOSRExitCompiler.cpp b/Source/JavaScriptCore/dfg/DFGOSRExitCompiler.cpp index c65443e29..5d2155cba 100644 --- a/Source/JavaScriptCore/dfg/DFGOSRExitCompiler.cpp +++ b/Source/JavaScriptCore/dfg/DFGOSRExitCompiler.cpp @@ -32,6 +32,7 @@ #include "DFGCommon.h" #include "LinkBuffer.h" #include "RepatchBuffer.h" +#include <wtf/StringPrintStream.h> namespace JSC { namespace DFG { @@ -81,7 +82,10 @@ void compileOSRExit(ExecState* exec) recovery = &codeBlock->speculationRecovery(exit.m_recoveryIndex - 1); #if DFG_ENABLE(DEBUG_VERBOSE) - dataLogF("Generating OSR exit #%u (seq#%u, bc#%u, @%u, %s) for code block %p.\n", exitIndex, exit.m_streamIndex, exit.m_codeOrigin.bytecodeIndex, exit.m_nodeIndex, exitKindToString(exit.m_kind), codeBlock); + dataLog( + "Generating OSR exit #", exitIndex, " (seq#", exit.m_streamIndex, + ", bc#", exit.m_codeOrigin.bytecodeIndex, ", @", exit.m_nodeIndex, ", ", + exitKindToString(exit.m_kind), ") for ", *codeBlock, ".\n"); #endif { @@ -95,9 +99,9 @@ void compileOSRExit(ExecState* exec) exit.m_code = FINALIZE_CODE_IF( shouldShowDisassembly(), patchBuffer, - ("DFG OSR exit #%u (bc#%u, @%u, %s) from CodeBlock %p", - exitIndex, exit.m_codeOrigin.bytecodeIndex, exit.m_nodeIndex, - exitKindToString(exit.m_kind), codeBlock)); + ("DFG OSR exit #%u (bc#%u, @%u, %s) from %s", + exitIndex, exit.m_codeOrigin.bytecodeIndex, exit.m_nodeIndex, + exitKindToString(exit.m_kind), toCString(*codeBlock).data())); } { diff --git a/Source/JavaScriptCore/dfg/DFGOperations.cpp b/Source/JavaScriptCore/dfg/DFGOperations.cpp index 909c657a1..ad595ae1b 100644 --- a/Source/JavaScriptCore/dfg/DFGOperations.cpp +++ b/Source/JavaScriptCore/dfg/DFGOperations.cpp @@ -1522,22 +1522,24 @@ void DFG_OPERATION debugOperationPrintSpeculationFailure(ExecState* exec, void* SpeculationFailureDebugInfo* debugInfo = static_cast<SpeculationFailureDebugInfo*>(debugInfoRaw); CodeBlock* codeBlock = debugInfo->codeBlock; CodeBlock* alternative = codeBlock->alternative(); - dataLogF("Speculation failure in %p at @%u with executeCounter = %s, " - "reoptimizationRetryCounter = %u, optimizationDelayCounter = %u, " - "osrExitCounter = %u\n", - codeBlock, - debugInfo->nodeIndex, - alternative ? alternative->jitExecuteCounter().status() : 0, - alternative ? alternative->reoptimizationRetryCounter() : 0, - alternative ? alternative->optimizationDelayCounter() : 0, - codeBlock->osrExitCounter()); + dataLog( + "Speculation failure in ", *codeBlock, " at @", debugInfo->nodeIndex, + " with "); + if (alternative) { + dataLog( + "executeCounter = ", alternative->jitExecuteCounter(), + ", reoptimizationRetryCounter = ", alternative->reoptimizationRetryCounter(), + ", optimizationDelayCounter = ", alternative->optimizationDelayCounter()); + } else + dataLog("no alternative code block (i.e. we've been jettisoned)"); + dataLog(", osrExitCounter = ", codeBlock->osrExitCounter(), "\n"); } #endif extern "C" void DFG_OPERATION triggerReoptimizationNow(CodeBlock* codeBlock) { #if ENABLE(JIT_VERBOSE_OSR) - dataLogF("%p: Entered reoptimize\n", codeBlock); + dataLog(*codeBlock, ": Entered reoptimize\n"); #endif // We must be called with the baseline code block. ASSERT(JITCode::isBaselineCode(codeBlock->getJITType())); diff --git a/Source/JavaScriptCore/dfg/DFGRepatch.cpp b/Source/JavaScriptCore/dfg/DFGRepatch.cpp index a20eb544a..07a509061 100644 --- a/Source/JavaScriptCore/dfg/DFGRepatch.cpp +++ b/Source/JavaScriptCore/dfg/DFGRepatch.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Apple Inc. All rights reserved. + * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -37,6 +37,7 @@ #include "Operations.h" #include "PolymorphicPutByIdList.h" #include "RepatchBuffer.h" +#include <wtf/StringPrintStream.h> namespace JSC { namespace DFG { @@ -235,8 +236,8 @@ static void generateProtoChainAccessStub(ExecState* exec, StructureStubInfo& stu stubRoutine = FINALIZE_CODE_FOR_DFG_STUB( patchBuffer, - ("DFG prototype chain access stub for CodeBlock %p, return point %p", - exec->codeBlock(), successLabel.executableAddress())); + ("DFG prototype chain access stub for %s, return point %p", + toCString(*exec->codeBlock()).data(), successLabel.executableAddress())); } static bool tryCacheGetByID(ExecState* exec, JSValue baseValue, const Identifier& propertyName, const PropertySlot& slot, StructureStubInfo& stubInfo) @@ -296,9 +297,9 @@ static bool tryCacheGetByID(ExecState* exec, JSValue baseValue, const Identifier stubInfo.stubRoutine = FINALIZE_CODE_FOR_DFG_STUB( patchBuffer, - ("DFG GetById array length stub for CodeBlock %p, return point %p", - exec->codeBlock(), stubInfo.callReturnLocation.labelAtOffset( - stubInfo.patch.dfg.deltaCallToDone).executableAddress())); + ("DFG GetById array length stub for %s, return point %p", + toCString(*exec->codeBlock()).data(), stubInfo.callReturnLocation.labelAtOffset( + stubInfo.patch.dfg.deltaCallToDone).executableAddress())); RepatchBuffer repatchBuffer(codeBlock); replaceWithJump(repatchBuffer, stubInfo, stubInfo.stubRoutine->code().code()); @@ -525,9 +526,9 @@ static bool tryBuildGetByIDList(ExecState* exec, JSValue baseValue, const Identi createJITStubRoutine( FINALIZE_DFG_CODE( patchBuffer, - ("DFG GetById polymorphic list access for CodeBlock %p, return point %p", - exec->codeBlock(), stubInfo.callReturnLocation.labelAtOffset( - stubInfo.patch.dfg.deltaCallToDone).executableAddress())), + ("DFG GetById polymorphic list access for %s, return point %p", + toCString(*exec->codeBlock()).data(), stubInfo.callReturnLocation.labelAtOffset( + stubInfo.patch.dfg.deltaCallToDone).executableAddress())), *globalData, codeBlock->ownerExecutable(), slot.cachedPropertyType() == PropertySlot::Getter @@ -737,9 +738,9 @@ static void emitPutReplaceStub( stubRoutine = FINALIZE_CODE_FOR_DFG_STUB( patchBuffer, - ("DFG PutById replace stub for CodeBlock %p, return point %p", - exec->codeBlock(), stubInfo.callReturnLocation.labelAtOffset( - stubInfo.patch.dfg.deltaCallToDone).executableAddress())); + ("DFG PutById replace stub for %s, return point %p", + toCString(*exec->codeBlock()).data(), stubInfo.callReturnLocation.labelAtOffset( + stubInfo.patch.dfg.deltaCallToDone).executableAddress())); } static void emitPutTransitionStub( @@ -937,11 +938,11 @@ static void emitPutTransitionStub( createJITStubRoutine( FINALIZE_DFG_CODE( patchBuffer, - ("DFG PutById %stransition stub (%p -> %p) for CodeBlock %p, return point %p", - structure->outOfLineCapacity() != oldStructure->outOfLineCapacity() ? "reallocating " : "", - oldStructure, structure, - exec->codeBlock(), stubInfo.callReturnLocation.labelAtOffset( - stubInfo.patch.dfg.deltaCallToDone).executableAddress())), + ("DFG PutById %stransition stub (%p -> %p) for %s, return point %p", + structure->outOfLineCapacity() != oldStructure->outOfLineCapacity() ? "reallocating " : "", + oldStructure, structure, + toCString(*exec->codeBlock()).data(), stubInfo.callReturnLocation.labelAtOffset( + stubInfo.patch.dfg.deltaCallToDone).executableAddress())), *globalData, exec->codeBlock()->ownerExecutable(), structure->outOfLineCapacity() != oldStructure->outOfLineCapacity(), @@ -1230,9 +1231,9 @@ void dfgLinkClosureCall(ExecState* exec, CallLinkInfo& callLinkInfo, CodeBlock* RefPtr<ClosureCallStubRoutine> stubRoutine = adoptRef(new ClosureCallStubRoutine( FINALIZE_DFG_CODE( patchBuffer, - ("DFG closure call stub for CodeBlock %p, return point %p, target %p (CodeBlock %p)", - callerCodeBlock, callLinkInfo.callReturnLocation.labelAtOffset(0).executableAddress(), - codePtr.executableAddress(), calleeCodeBlock)), + ("DFG closure call stub for %s, return point %p, target %p (%s)", + toCString(*callerCodeBlock).data(), callLinkInfo.callReturnLocation.labelAtOffset(0).executableAddress(), + codePtr.executableAddress(), toCString(*calleeCodeBlock).data())), *globalData, callerCodeBlock->ownerExecutable(), structure, executable, callLinkInfo.codeOrigin)); RepatchBuffer repatchBuffer(callerCodeBlock); diff --git a/Source/JavaScriptCore/interpreter/Interpreter.cpp b/Source/JavaScriptCore/interpreter/Interpreter.cpp index ad89505fc..9b69d1b3d 100644 --- a/Source/JavaScriptCore/interpreter/Interpreter.cpp +++ b/Source/JavaScriptCore/interpreter/Interpreter.cpp @@ -380,7 +380,7 @@ void Interpreter::dumpCallFrame(CallFrame*) void Interpreter::dumpCallFrame(CallFrame* callFrame) { - callFrame->codeBlock()->dump(); + callFrame->codeBlock()->dumpBytecode(); dumpRegisters(callFrame); } diff --git a/Source/JavaScriptCore/jit/JITCode.cpp b/Source/JavaScriptCore/jit/JITCode.cpp new file mode 100644 index 000000000..5cfa6304b --- /dev/null +++ b/Source/JavaScriptCore/jit/JITCode.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2008, 2012 Apple 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 APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "JITCode.h" + +#include <wtf/PrintStream.h> + +namespace WTF { + +void printInternal(PrintStream& out, JSC::JITCode::JITType type) +{ + switch (type) { + case JSC::JITCode::None: + out.print("None"); + return; + case JSC::JITCode::HostCallThunk: + out.print("Host"); + return; + case JSC::JITCode::InterpreterThunk: + out.print("LLInt"); + return; + case JSC::JITCode::BaselineJIT: + out.print("Baseline"); + return; + case JSC::JITCode::DFGJIT: + out.print("DFG"); + return; + default: + CRASH(); + return; + } +} + +} // namespace WTF + diff --git a/Source/JavaScriptCore/jit/JITCode.h b/Source/JavaScriptCore/jit/JITCode.h index 93fa88a23..0929397ee 100644 --- a/Source/JavaScriptCore/jit/JITCode.h +++ b/Source/JavaScriptCore/jit/JITCode.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Apple Inc. All rights reserved. + * Copyright (C) 2008, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -157,7 +157,7 @@ namespace JSC { return m_ref.executableMemory(); } - JITType jitType() + JITType jitType() const { return m_jitType; } @@ -187,6 +187,13 @@ namespace JSC { #endif // ENABLE(JIT) || ENABLE(LLINT) }; -}; +} // namespace JSC + +namespace WTF { + +class PrintStream; +void printInternal(PrintStream&, JSC::JITCode::JITType); + +} // namespace WTF #endif diff --git a/Source/JavaScriptCore/jit/JITDisassembler.cpp b/Source/JavaScriptCore/jit/JITDisassembler.cpp index 0ec72e205..eaef844bf 100644 --- a/Source/JavaScriptCore/jit/JITDisassembler.cpp +++ b/Source/JavaScriptCore/jit/JITDisassembler.cpp @@ -29,6 +29,7 @@ #if ENABLE(JIT) #include "CodeBlock.h" +#include "CodeBlockWithJITType.h" #include "JIT.h" namespace JSC { @@ -46,7 +47,7 @@ JITDisassembler::~JITDisassembler() void JITDisassembler::dump(PrintStream& out, LinkBuffer& linkBuffer) { - out.print("Baseline JIT code for CodeBlock ", RawPointer(m_codeBlock), ", instruction count = ", m_codeBlock->instructionCount(), "\n"); + out.print("Baseline JIT code for ", CodeBlockWithJITType(m_codeBlock, JITCode::BaselineJIT), ", instruction count = ", m_codeBlock->instructionCount(), "\n"); out.print(" Code at [", RawPointer(linkBuffer.debugAddress()), ", ", RawPointer(static_cast<char*>(linkBuffer.debugAddress()) + linkBuffer.debugSize()), "):\n"); dumpDisassembly(out, linkBuffer, m_startOfCode, m_labelForBytecodeIndexInMainPath[0]); @@ -78,7 +79,7 @@ void JITDisassembler::dumpForInstructions(PrintStream& out, LinkBuffer& linkBuff continue; } out.print(prefix); - m_codeBlock->dump(i); + m_codeBlock->dumpBytecode(i); for (unsigned nextIndex = i + 1; ; nextIndex++) { if (nextIndex >= labels.size()) { dumpDisassembly(out, linkBuffer, labels[i], endLabel); diff --git a/Source/JavaScriptCore/jit/JITPropertyAccess.cpp b/Source/JavaScriptCore/jit/JITPropertyAccess.cpp index 57a5685eb..e377c8adb 100644 --- a/Source/JavaScriptCore/jit/JITPropertyAccess.cpp +++ b/Source/JavaScriptCore/jit/JITPropertyAccess.cpp @@ -42,6 +42,7 @@ #include "RepatchBuffer.h" #include "ResultType.h" #include "SamplingTool.h" +#include <wtf/StringPrintStream.h> #ifndef NDEBUG #include <stdio.h> @@ -746,8 +747,8 @@ void JIT::privateCompilePutByIdTransition(StructureStubInfo* stubInfo, Structure stubInfo->stubRoutine = createJITStubRoutine( FINALIZE_CODE( patchBuffer, - ("Baseline put_by_id transition for CodeBlock %p, return point %p", - m_codeBlock, returnAddress.value())), + ("Baseline put_by_id transition for %s, return point %p", + toCString(*m_codeBlock).data(), returnAddress.value())), *m_globalData, m_codeBlock->ownerExecutable(), willNeedStorageRealloc, @@ -815,9 +816,10 @@ void JIT::privateCompilePatchGetArrayLength(ReturnAddressPtr returnAddress) // Track the stub we have created so that it will be deleted later. stubInfo->stubRoutine = FINALIZE_CODE_FOR_STUB( patchBuffer, - ("Basline JIT get_by_id array length stub for CodeBlock %p, return point %p", - m_codeBlock, stubInfo->hotPathBegin.labelAtOffset( - stubInfo->patch.baseline.u.get.putResult).executableAddress())); + ("Basline JIT get_by_id array length stub for %s, return point %p", + toCString(*m_codeBlock).data(), + stubInfo->hotPathBegin.labelAtOffset( + stubInfo->patch.baseline.u.get.putResult).executableAddress())); // Finally patch the jump to slow case back in the hot path to jump here instead. CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(stubInfo->patch.baseline.u.get.structureCheck); @@ -883,9 +885,9 @@ void JIT::privateCompileGetByIdProto(StructureStubInfo* stubInfo, Structure* str stubInfo->stubRoutine = createJITStubRoutine( FINALIZE_CODE( patchBuffer, - ("Baseline JIT get_by_id proto stub for CodeBlock %p, return point %p", - m_codeBlock, stubInfo->hotPathBegin.labelAtOffset( - stubInfo->patch.baseline.u.get.putResult).executableAddress())), + ("Baseline JIT get_by_id proto stub for %s, return point %p", + toCString(*m_codeBlock).data(), stubInfo->hotPathBegin.labelAtOffset( + stubInfo->patch.baseline.u.get.putResult).executableAddress())), *m_globalData, m_codeBlock->ownerExecutable(), needsStubLink); @@ -948,9 +950,9 @@ void JIT::privateCompileGetByIdSelfList(StructureStubInfo* stubInfo, Polymorphic RefPtr<JITStubRoutine> stubCode = createJITStubRoutine( FINALIZE_CODE( patchBuffer, - ("Baseline JIT get_by_id list stub for CodeBlock %p, return point %p", - m_codeBlock, stubInfo->hotPathBegin.labelAtOffset( - stubInfo->patch.baseline.u.get.putResult).executableAddress())), + ("Baseline JIT get_by_id list stub for %s, return point %p", + toCString(*m_codeBlock).data(), stubInfo->hotPathBegin.labelAtOffset( + stubInfo->patch.baseline.u.get.putResult).executableAddress())), *m_globalData, m_codeBlock->ownerExecutable(), needsStubLink); @@ -1022,9 +1024,9 @@ void JIT::privateCompileGetByIdProtoList(StructureStubInfo* stubInfo, Polymorphi RefPtr<JITStubRoutine> stubCode = createJITStubRoutine( FINALIZE_CODE( patchBuffer, - ("Baseline JIT get_by_id proto list stub for CodeBlock %p, return point %p", - m_codeBlock, stubInfo->hotPathBegin.labelAtOffset( - stubInfo->patch.baseline.u.get.putResult).executableAddress())), + ("Baseline JIT get_by_id proto list stub for %s, return point %p", + toCString(*m_codeBlock).data(), stubInfo->hotPathBegin.labelAtOffset( + stubInfo->patch.baseline.u.get.putResult).executableAddress())), *m_globalData, m_codeBlock->ownerExecutable(), needsStubLink); @@ -1099,9 +1101,9 @@ void JIT::privateCompileGetByIdChainList(StructureStubInfo* stubInfo, Polymorphi RefPtr<JITStubRoutine> stubRoutine = createJITStubRoutine( FINALIZE_CODE( patchBuffer, - ("Baseline JIT get_by_id chain list stub for CodeBlock %p, return point %p", - m_codeBlock, stubInfo->hotPathBegin.labelAtOffset( - stubInfo->patch.baseline.u.get.putResult).executableAddress())), + ("Baseline JIT get_by_id chain list stub for %s, return point %p", + toCString(*m_codeBlock).data(), stubInfo->hotPathBegin.labelAtOffset( + stubInfo->patch.baseline.u.get.putResult).executableAddress())), *m_globalData, m_codeBlock->ownerExecutable(), needsStubLink); @@ -1174,9 +1176,9 @@ void JIT::privateCompileGetByIdChain(StructureStubInfo* stubInfo, Structure* str RefPtr<JITStubRoutine> stubRoutine = createJITStubRoutine( FINALIZE_CODE( patchBuffer, - ("Baseline JIT get_by_id chain stub for CodeBlock %p, return point %p", - m_codeBlock, stubInfo->hotPathBegin.labelAtOffset( - stubInfo->patch.baseline.u.get.putResult).executableAddress())), + ("Baseline JIT get_by_id chain stub for %s, return point %p", + toCString(*m_codeBlock).data(), stubInfo->hotPathBegin.labelAtOffset( + stubInfo->patch.baseline.u.get.putResult).executableAddress())), *m_globalData, m_codeBlock->ownerExecutable(), needsStubLink); @@ -1428,7 +1430,7 @@ void JIT::privateCompileGetByVal(ByValInfo* byValInfo, ReturnAddressPtr returnAd byValInfo->stubRoutine = FINALIZE_CODE_FOR_STUB( patchBuffer, - ("Baseline get_by_val stub for CodeBlock %p, return point %p", m_codeBlock, returnAddress.value())); + ("Baseline get_by_val stub for %s, return point %p", toCString(*m_codeBlock).data(), returnAddress.value())); RepatchBuffer repatchBuffer(m_codeBlock); repatchBuffer.relink(byValInfo->badTypeJump, CodeLocationLabel(byValInfo->stubRoutine->code().code())); @@ -1498,7 +1500,7 @@ void JIT::privateCompilePutByVal(ByValInfo* byValInfo, ReturnAddressPtr returnAd byValInfo->stubRoutine = FINALIZE_CODE_FOR_STUB( patchBuffer, - ("Baseline put_by_val stub for CodeBlock %p, return point %p", m_codeBlock, returnAddress.value())); + ("Baseline put_by_val stub for %s, return point %p", toCString(*m_codeBlock).data(), returnAddress.value())); RepatchBuffer repatchBuffer(m_codeBlock); repatchBuffer.relink(byValInfo->badTypeJump, CodeLocationLabel(byValInfo->stubRoutine->code().code())); diff --git a/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp b/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp index be146a402..391dd1d8c 100644 --- a/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp +++ b/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp @@ -42,6 +42,7 @@ #include "RepatchBuffer.h" #include "ResultType.h" #include "SamplingTool.h" +#include <wtf/StringPrintStream.h> #ifndef NDEBUG #include <stdio.h> @@ -704,8 +705,8 @@ void JIT::privateCompilePutByIdTransition(StructureStubInfo* stubInfo, Structure stubInfo->stubRoutine = createJITStubRoutine( FINALIZE_CODE( patchBuffer, - ("Baseline put_by_id transition stub for CodeBlock %p, return point %p", - m_codeBlock, returnAddress.value())), + ("Baseline put_by_id transition stub for %s, return point %p", + toCString(*m_codeBlock).data(), returnAddress.value())), *m_globalData, m_codeBlock->ownerExecutable(), willNeedStorageRealloc, @@ -778,9 +779,9 @@ void JIT::privateCompilePatchGetArrayLength(ReturnAddressPtr returnAddress) // Track the stub we have created so that it will be deleted later. stubInfo->stubRoutine = FINALIZE_CODE_FOR_STUB( patchBuffer, - ("Baseline get_by_id array length stub for CodeBlock %p, return point %p", - m_codeBlock, stubInfo->hotPathBegin.labelAtOffset( - stubInfo->patch.baseline.u.get.putResult).executableAddress())); + ("Baseline get_by_id array length stub for %s, return point %p", + toCString(*m_codeBlock).data(), stubInfo->hotPathBegin.labelAtOffset( + stubInfo->patch.baseline.u.get.putResult).executableAddress())); // Finally patch the jump to slow case back in the hot path to jump here instead. CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(stubInfo->patch.baseline.u.get.structureCheck); @@ -849,9 +850,9 @@ void JIT::privateCompileGetByIdProto(StructureStubInfo* stubInfo, Structure* str stubInfo->stubRoutine = createJITStubRoutine( FINALIZE_CODE( patchBuffer, - ("Baseline get_by_id proto stub for CodeBlock %p, return point %p", - m_codeBlock, stubInfo->hotPathBegin.labelAtOffset( - stubInfo->patch.baseline.u.get.putResult).executableAddress())), + ("Baseline get_by_id proto stub for %s, return point %p", + toCString(*m_codeBlock).data(), stubInfo->hotPathBegin.labelAtOffset( + stubInfo->patch.baseline.u.get.putResult).executableAddress())), *m_globalData, m_codeBlock->ownerExecutable(), needsStubLink); @@ -915,9 +916,9 @@ void JIT::privateCompileGetByIdSelfList(StructureStubInfo* stubInfo, Polymorphic RefPtr<JITStubRoutine> stubRoutine = createJITStubRoutine( FINALIZE_CODE( patchBuffer, - ("Baseline get_by_id self list stub for CodeBlock %p, return point %p", - m_codeBlock, stubInfo->hotPathBegin.labelAtOffset( - stubInfo->patch.baseline.u.get.putResult).executableAddress())), + ("Baseline get_by_id self list stub for %s, return point %p", + toCString(*m_codeBlock).data(), stubInfo->hotPathBegin.labelAtOffset( + stubInfo->patch.baseline.u.get.putResult).executableAddress())), *m_globalData, m_codeBlock->ownerExecutable(), needsStubLink); @@ -988,9 +989,9 @@ void JIT::privateCompileGetByIdProtoList(StructureStubInfo* stubInfo, Polymorphi RefPtr<JITStubRoutine> stubRoutine = createJITStubRoutine( FINALIZE_CODE( patchBuffer, - ("Baseline get_by_id proto list stub for CodeBlock %p, return point %p", - m_codeBlock, stubInfo->hotPathBegin.labelAtOffset( - stubInfo->patch.baseline.u.get.putResult).executableAddress())), + ("Baseline get_by_id proto list stub for %s, return point %p", + toCString(*m_codeBlock).data(), stubInfo->hotPathBegin.labelAtOffset( + stubInfo->patch.baseline.u.get.putResult).executableAddress())), *m_globalData, m_codeBlock->ownerExecutable(), needsStubLink); @@ -1066,9 +1067,9 @@ void JIT::privateCompileGetByIdChainList(StructureStubInfo* stubInfo, Polymorphi RefPtr<JITStubRoutine> stubRoutine = createJITStubRoutine( FINALIZE_CODE( patchBuffer, - ("Baseline get_by_id chain list stub for CodeBlock %p, return point %p", - m_codeBlock, stubInfo->hotPathBegin.labelAtOffset( - stubInfo->patch.baseline.u.get.putResult).executableAddress())), + ("Baseline get_by_id chain list stub for %s, return point %p", + toCString(*m_codeBlock).data(), stubInfo->hotPathBegin.labelAtOffset( + stubInfo->patch.baseline.u.get.putResult).executableAddress())), *m_globalData, m_codeBlock->ownerExecutable(), needsStubLink); @@ -1140,9 +1141,9 @@ void JIT::privateCompileGetByIdChain(StructureStubInfo* stubInfo, Structure* str RefPtr<JITStubRoutine> stubRoutine = createJITStubRoutine( FINALIZE_CODE( patchBuffer, - ("Baseline get_by_id chain stub for CodeBlock %p, return point %p", - m_codeBlock, stubInfo->hotPathBegin.labelAtOffset( - stubInfo->patch.baseline.u.get.putResult).executableAddress())), + ("Baseline get_by_id chain stub for %s, return point %p", + toCString(*m_codeBlock).data(), stubInfo->hotPathBegin.labelAtOffset( + stubInfo->patch.baseline.u.get.putResult).executableAddress())), *m_globalData, m_codeBlock->ownerExecutable(), needsStubLink); diff --git a/Source/JavaScriptCore/jit/JITStubs.cpp b/Source/JavaScriptCore/jit/JITStubs.cpp index 760ffd429..f47ac08ef 100644 --- a/Source/JavaScriptCore/jit/JITStubs.cpp +++ b/Source/JavaScriptCore/jit/JITStubs.cpp @@ -1808,12 +1808,16 @@ DEFINE_STUB_FUNCTION(void, optimize) unsigned bytecodeIndex = stackFrame.args[0].int32(); #if ENABLE(JIT_VERBOSE_OSR) - dataLogF("%p: Entered optimize with bytecodeIndex = %u, executeCounter = %s, reoptimizationRetryCounter = %u, optimizationDelayCounter = %u, exitCounter = ", codeBlock, bytecodeIndex, codeBlock->jitExecuteCounter().status(), codeBlock->reoptimizationRetryCounter(), codeBlock->optimizationDelayCounter()); + dataLog( + *codeBlock, ": Entered optimize with bytecodeIndex = ", bytecodeIndex, + ", executeCounter = ", codeBlock->jitExecuteCounter(), + ", optimizationDelayCounter = ", codeBlock->reoptimizationRetryCounter(), + ", exitCounter = "); if (codeBlock->hasOptimizedReplacement()) - dataLogF("%u", codeBlock->replacement()->osrExitCounter()); + dataLog(codeBlock->replacement()->osrExitCounter()); else - dataLogF("N/A"); - dataLogF("\n"); + dataLog("N/A"); + dataLog("\n"); #endif if (!codeBlock->checkIfOptimizationThresholdReached()) { @@ -1823,7 +1827,7 @@ DEFINE_STUB_FUNCTION(void, optimize) if (codeBlock->hasOptimizedReplacement()) { #if ENABLE(JIT_VERBOSE_OSR) - dataLogF("Considering OSR into %p(%p).\n", codeBlock, codeBlock->replacement()); + dataLogF("Considering OSR ", *codeBlock, " -> ", *codeBlock->replacement(), ".\n"); #endif // If we have an optimized replacement, then it must be the case that we entered // cti_optimize from a loop. That's because is there's an optimized replacement, @@ -1840,7 +1844,7 @@ DEFINE_STUB_FUNCTION(void, optimize) // additional checking anyway, to reduce the amount of recompilation thrashing. if (codeBlock->replacement()->shouldReoptimizeFromLoopNow()) { #if ENABLE(JIT_VERBOSE_OSR) - dataLogF("Triggering reoptimization of %p(%p) (in loop).\n", codeBlock, codeBlock->replacement()); + dataLogF("Triggering reoptimization of ", *codeBlock, "(", *codeBlock->replacement(), ") (in loop).\n"); #endif codeBlock->reoptimize(); return; @@ -1848,7 +1852,7 @@ DEFINE_STUB_FUNCTION(void, optimize) } else { if (!codeBlock->shouldOptimizeNow()) { #if ENABLE(JIT_VERBOSE_OSR) - dataLogF("Delaying optimization for %p (in loop) because of insufficient profiling.\n", codeBlock); + dataLogF("Delaying optimization for ", *codeBlock, " (in loop) because of insufficient profiling.\n"); #endif return; } @@ -1864,7 +1868,7 @@ DEFINE_STUB_FUNCTION(void, optimize) if (codeBlock->replacement() == codeBlock) { #if ENABLE(JIT_VERBOSE_OSR) - dataLogF("Optimizing %p failed.\n", codeBlock); + dataLogF("Optimizing ", *codeBlock, " failed.\n"); #endif ASSERT(codeBlock->getJITType() == JITCode::BaselineJIT); @@ -1878,12 +1882,12 @@ DEFINE_STUB_FUNCTION(void, optimize) if (void* address = DFG::prepareOSREntry(callFrame, optimizedCodeBlock, bytecodeIndex)) { if (Options::showDFGDisassembly()) { - dataLogF( - "Performing OSR from code block %p to code block %p, address %p to %p.\n", - codeBlock, optimizedCodeBlock, (STUB_RETURN_ADDRESS).value(), address); + dataLog( + "Performing OSR ", *codeBlock, " -> ", *optimizedCodeBlock, ", address ", + RawPointer((STUB_RETURN_ADDRESS).value()), " -> ", RawPointer(address), ".\n"); } #if ENABLE(JIT_VERBOSE_OSR) - dataLogF("Optimizing %p succeeded, performing OSR after a delay of %u.\n", codeBlock, codeBlock->optimizationDelayCounter()); + dataLogF("Optimizing ", *codeBlock, " succeeded, performing OSR after a delay of ", codeBlock->optimizationDelayCounter(), ".\n"); #endif codeBlock->optimizeSoon(); @@ -1892,7 +1896,7 @@ DEFINE_STUB_FUNCTION(void, optimize) } #if ENABLE(JIT_VERBOSE_OSR) - dataLogF("Optimizing %p succeeded, OSR failed, after a delay of %u.\n", codeBlock, codeBlock->optimizationDelayCounter()); + dataLogF("Optimizing ", *codeBlock, " succeeded, OSR failed, after a delay of ", codeBlock->optimizationDelayCounter(), ".\n"); #endif // Count the OSR failure as a speculation failure. If this happens a lot, then @@ -1900,7 +1904,7 @@ DEFINE_STUB_FUNCTION(void, optimize) optimizedCodeBlock->countOSRExit(); #if ENABLE(JIT_VERBOSE_OSR) - dataLogF("Encountered OSR failure into %p(%p).\n", codeBlock, codeBlock->replacement()); + dataLogF("Encountered OSR failure ", *codeBlock, " -> ", *codeBlock->replacement(), ".\n"); #endif // We are a lot more conservative about triggering reoptimization after OSR failure than @@ -1913,7 +1917,7 @@ DEFINE_STUB_FUNCTION(void, optimize) // reoptimization trigger. if (optimizedCodeBlock->shouldReoptimizeNow()) { #if ENABLE(JIT_VERBOSE_OSR) - dataLogF("Triggering reoptimization of %p(%p) (after OSR fail).\n", codeBlock, codeBlock->replacement()); + dataLogF("Triggering reoptimization of ", *codeBlock, " -> ", *codeBlock->replacement(), " (after OSR fail).\n"); #endif codeBlock->reoptimize(); return; diff --git a/Source/JavaScriptCore/runtime/CodeSpecializationKind.cpp b/Source/JavaScriptCore/runtime/CodeSpecializationKind.cpp new file mode 100644 index 000000000..202a1d9c7 --- /dev/null +++ b/Source/JavaScriptCore/runtime/CodeSpecializationKind.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2012 Apple 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 APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "CodeSpecializationKind.h" + +#include <wtf/PrintStream.h> + +namespace WTF { + +void printInternal(PrintStream& out, JSC::CodeSpecializationKind kind) +{ + if (kind == JSC::CodeForCall) { + out.print("Call"); + return; + } + + ASSERT(kind == JSC::CodeForConstruct); + out.print("Construct"); +} + +} // namespace WTF + + + diff --git a/Source/JavaScriptCore/runtime/CodeSpecializationKind.h b/Source/JavaScriptCore/runtime/CodeSpecializationKind.h index ba2a54f37..5c408c6df 100644 --- a/Source/JavaScriptCore/runtime/CodeSpecializationKind.h +++ b/Source/JavaScriptCore/runtime/CodeSpecializationKind.h @@ -30,7 +30,24 @@ namespace JSC { enum CodeSpecializationKind { CodeForCall, CodeForConstruct }; +inline CodeSpecializationKind specializationFromIsCall(bool isCall) +{ + return isCall ? CodeForCall : CodeForConstruct; +} + +inline CodeSpecializationKind specializationFromIsConstruct(bool isConstruct) +{ + return isConstruct ? CodeForConstruct : CodeForCall; +} + } // namespace JSC +namespace WTF { + +class PrintStream; +void printInternal(PrintStream&, JSC::CodeSpecializationKind); + +} // namespace WTF + #endif // CodeSpecializationKind_h diff --git a/Source/JavaScriptCore/runtime/Executable.cpp b/Source/JavaScriptCore/runtime/Executable.cpp index 49a0e256d..746e281e3 100644 --- a/Source/JavaScriptCore/runtime/Executable.cpp +++ b/Source/JavaScriptCore/runtime/Executable.cpp @@ -665,4 +665,26 @@ String FunctionExecutable::paramString() const return m_unlinkedExecutable->paramString(); } +CodeBlockHash ExecutableBase::hashFor(CodeSpecializationKind kind) const +{ + if (this->classInfo() == &NativeExecutable::s_info) + return jsCast<const NativeExecutable*>(this)->hashFor(kind); + + return jsCast<const ScriptExecutable*>(this)->hashFor(kind); +} + +CodeBlockHash NativeExecutable::hashFor(CodeSpecializationKind kind) const +{ + if (kind == CodeForCall) + return CodeBlockHash(static_cast<unsigned>(bitwise_cast<size_t>(m_function))); + + ASSERT(kind == CodeForConstruct); + return CodeBlockHash(static_cast<unsigned>(bitwise_cast<size_t>(m_constructor))); +} + +CodeBlockHash ScriptExecutable::hashFor(CodeSpecializationKind kind) const +{ + return CodeBlockHash(source(), kind); +} + } diff --git a/Source/JavaScriptCore/runtime/Executable.h b/Source/JavaScriptCore/runtime/Executable.h index c1c044b0e..83eb602c4 100644 --- a/Source/JavaScriptCore/runtime/Executable.h +++ b/Source/JavaScriptCore/runtime/Executable.h @@ -27,6 +27,7 @@ #define Executable_h #include "CallData.h" +#include "CodeBlockHash.h" #include "CodeSpecializationKind.h" #include "HandlerInfo.h" #include "JSFunction.h" @@ -86,6 +87,8 @@ namespace JSC { static const bool hasImmortalStructure = true; static void destroy(JSCell*); #endif + + CodeBlockHash hashFor(CodeSpecializationKind) const; bool isFunctionExecutable() { @@ -295,6 +298,8 @@ namespace JSC { static void destroy(JSCell*); #endif + CodeBlockHash hashFor(CodeSpecializationKind) const; + NativeFunction function() { return m_function; } NativeFunction constructor() { return m_constructor; } @@ -352,8 +357,10 @@ namespace JSC { #if ENABLE(JIT) static void destroy(JSCell*); #endif + + CodeBlockHash hashFor(CodeSpecializationKind) const; - const SourceCode& source() { return m_source; } + const SourceCode& source() const { return m_source; } intptr_t sourceID() const { return m_source.providerID(); } const String& sourceURL() const { return m_source.provider()->url(); } int lineNo() const { return m_firstLine; } diff --git a/Source/QtWebKit.pro b/Source/QtWebKit.pro index 59f9a0d81..19d52fc80 100644 --- a/Source/QtWebKit.pro +++ b/Source/QtWebKit.pro @@ -10,6 +10,11 @@ CONFIG += ordered api.file = api.pri SUBDIRS += api +build?(webkit1) { + webkitwidgets.file = widgetsapi.pri + SUBDIRS += webkitwidgets +} + build?(webkit2) { webprocess.file = WebKit2/WebProcess.pro SUBDIRS += webprocess diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog index 380ee628b..296d4d54f 100644 --- a/Source/WTF/ChangeLog +++ b/Source/WTF/ChangeLog @@ -1,3 +1,50 @@ +2012-11-30 Simon Hausmann <simon.hausmann@digia.com>, Pierre Rossi <pierre.rossi@digia.com> + + [Qt] Separate Qt WebKit into Qt WebKit and Qt WebKit Widgets + https://bugs.webkit.org/show_bug.cgi?id=99314 + + Reviewed by Tor Arne Vestbø. + + This big change separates QtWebKit into QtWebKit and QtWebKitWidgets as + shared libraries. + + It's a big refactoring that mostly involves moving WebCore dependent + code into QtWebKit and accessing it through exported QWebFrameAdapter + and QWebPageAdapter classes. + + + * wtf/text/WTFString.h: + (String): Export the QString conversions also as WTF_STRING_API. + +2012-11-29 Filip Pizlo <fpizlo@apple.com> + + It should be easy to find code blocks in debug dumps + https://bugs.webkit.org/show_bug.cgi?id=103623 + + Reviewed by Geoffrey Garen. + + Changed RawPointer to accept both const void* and void*, and use the former internally. + + Cleaned up SHA1 so that the functionality already used internally for self-testing is + available via the API. This includes addBytes(CString) and computing hex digests. + + * wtf/RawPointer.h: + (WTF::RawPointer::RawPointer): + (RawPointer): + (WTF::RawPointer::value): + * wtf/SHA1.cpp: + (WTF::expectSHA1): + (WTF::SHA1::hexDigest): + (WTF::SHA1::computeHexDigest): + * wtf/SHA1.h: + (WTF::SHA1::addBytes): + +2012-11-29 Patrick Gansterer <paroga@webkit.org> + + Build fix for WinCE after r136096. + + * wtf/StringPrintStream.cpp: Added missing include file. + 2012-11-28 Filip Pizlo <fpizlo@apple.com> SpeculatedType dumping should not use the static char buffer[thingy] idiom diff --git a/Source/WTF/wtf/RawPointer.h b/Source/WTF/wtf/RawPointer.h index 24ca074ef..6dc7292fb 100644 --- a/Source/WTF/wtf/RawPointer.h +++ b/Source/WTF/wtf/RawPointer.h @@ -40,10 +40,15 @@ public: { } - void* value() const { return m_value; } + explicit RawPointer(const void* value) + : m_value(value) + { + } + + const void* value() const { return m_value; } private: - void* m_value; + const void* m_value; }; } // namespace WTF diff --git a/Source/WTF/wtf/SHA1.cpp b/Source/WTF/wtf/SHA1.cpp index e76f6ac38..891c176eb 100644 --- a/Source/WTF/wtf/SHA1.cpp +++ b/Source/WTF/wtf/SHA1.cpp @@ -36,10 +36,9 @@ #include "SHA1.h" #include "Assertions.h" -#ifndef NDEBUG + #include "StringExtras.h" #include "text/CString.h" -#endif namespace WTF { @@ -52,15 +51,8 @@ static void expectSHA1(CString input, int repeat, CString expected) { SHA1 sha1; for (int i = 0; i < repeat; ++i) - sha1.addBytes(reinterpret_cast<const uint8_t*>(input.data()), input.length()); - Vector<uint8_t, 20> digest; - sha1.computeHash(digest); - char* buffer = 0; - CString actual = CString::newUninitialized(40, buffer); - for (size_t i = 0; i < 20; ++i) { - snprintf(buffer, 3, "%02X", digest.at(i)); - buffer += 2; - } + sha1.addBytes(input); + CString actual = sha1.computeHexDigest(); ASSERT_WITH_MESSAGE(actual == expected, "input: %s, repeat: %d, actual: %s, expected: %s", input.data(), repeat, actual.data(), expected.data()); } @@ -144,6 +136,25 @@ void SHA1::computeHash(Vector<uint8_t, 20>& digest) reset(); } +CString SHA1::hexDigest(const Vector<uint8_t, 20>& digest) +{ + char* start = 0; + CString result = CString::newUninitialized(40, start); + char* buffer = start; + for (size_t i = 0; i < 20; ++i) { + snprintf(buffer, 3, "%02X", digest.at(i)); + buffer += 2; + } + return result; +} + +CString SHA1::computeHexDigest() +{ + Vector<uint8_t, 20> digest; + computeHash(digest); + return hexDigest(digest); +} + void SHA1::finalize() { ASSERT(m_cursor < 64); diff --git a/Source/WTF/wtf/SHA1.h b/Source/WTF/wtf/SHA1.h index e8cc802e9..186a20a8b 100644 --- a/Source/WTF/wtf/SHA1.h +++ b/Source/WTF/wtf/SHA1.h @@ -32,6 +32,7 @@ #define WTF_SHA1_h #include <wtf/Vector.h> +#include <wtf/text/CString.h> namespace WTF { @@ -43,11 +44,27 @@ public: { addBytes(input.data(), input.size()); } + void addBytes(const CString& input) + { + const char* string = input.data(); + // Make sure that the creator of the CString didn't make the mistake + // of forcing length() to be the size of the buffer used to create the + // string, prior to inserting the null terminator earlier in the + // sequence. + ASSERT(input.length() == strlen(string)); + addBytes(reinterpret_cast<const uint8_t*>(string), input.length()); + } WTF_EXPORT_PRIVATE void addBytes(const uint8_t* input, size_t length); // computeHash has a side effect of resetting the state of the object. WTF_EXPORT_PRIVATE void computeHash(Vector<uint8_t, 20>&); - + + // Get a hex hash from the digest. Pass a limit less than 40 if you want a shorter digest. + WTF_EXPORT_PRIVATE static CString hexDigest(const Vector<uint8_t, 20>&); + + // Compute the hex digest directly. Pass a limit less than 40 if you want a shorter digest. + WTF_EXPORT_PRIVATE CString computeHexDigest(); + private: void finalize(); void processBlock(); diff --git a/Source/WTF/wtf/StringPrintStream.cpp b/Source/WTF/wtf/StringPrintStream.cpp index 41e1f83fe..60e503043 100644 --- a/Source/WTF/wtf/StringPrintStream.cpp +++ b/Source/WTF/wtf/StringPrintStream.cpp @@ -29,6 +29,7 @@ #include <stdarg.h> #include <stdio.h> #include <wtf/FastMalloc.h> +#include <wtf/StringExtras.h> namespace WTF { diff --git a/Source/WTF/wtf/text/WTFString.h b/Source/WTF/wtf/text/WTFString.h index 0066257c6..3a915b13a 100644 --- a/Source/WTF/wtf/text/WTFString.h +++ b/Source/WTF/wtf/text/WTFString.h @@ -416,9 +416,9 @@ public: #endif #if PLATFORM(QT) - String(const QString&); - String(const QStringRef&); - operator QString() const; + WTF_EXPORT_STRING_API String(const QString&); + WTF_EXPORT_STRING_API String(const QStringRef&); + WTF_EXPORT_STRING_API operator QString() const; #endif #if PLATFORM(WX) diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt index b40b4ad5f..961c5d559 100644 --- a/Source/WebCore/CMakeLists.txt +++ b/Source/WebCore/CMakeLists.txt @@ -1467,6 +1467,7 @@ SET(WebCore_SOURCES html/TextInputType.cpp html/TimeInputType.cpp html/TimeRanges.cpp + html/TypeAhead.cpp html/URLInputType.cpp html/ValidationMessage.cpp html/ValidityState.cpp diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index c8b1b688b..be4937610 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,1066 @@ +2012-11-29 Tommy Widenflycht <tommyw@google.com> + + Speech Recognition API: Update SpeechRecognitionEvent/Result to match the specification + https://bugs.webkit.org/show_bug.cgi?id=103407 + + Reviewed by Adam Barth. + + This patch does the following: + o Adds results, and removing result on SpeechRecognitionEvent + o Renaming SpeechRecognitionResult::final to isFinal + o Moving emma to SpeechRecognitionEvent from SpeechRecognitionResult + + Existing tests updated to test the new API. + + * Modules/speech/SpeechRecognition.cpp: + (WebCore::SpeechRecognition::start): + (WebCore::SpeechRecognition::didReceiveResults): + (WebCore): + * Modules/speech/SpeechRecognition.h: + (SpeechRecognition): + * Modules/speech/SpeechRecognitionEvent.cpp: + (WebCore::SpeechRecognitionEvent::createResult): + (WebCore): + (WebCore::SpeechRecognitionEvent::SpeechRecognitionEvent): + (WebCore::SpeechRecognitionEvent::~SpeechRecognitionEvent): + (WebCore::emmaQualifiedName): + (WebCore::SpeechRecognitionEvent::emma): + * Modules/speech/SpeechRecognitionEvent.h: + (WebCore): + (SpeechRecognitionEventInit): + (SpeechRecognitionEvent): + (WebCore::SpeechRecognitionEvent::resultIndex): + (WebCore::SpeechRecognitionEvent::results): + * Modules/speech/SpeechRecognitionEvent.idl: + * Modules/speech/SpeechRecognitionResult.cpp: + * Modules/speech/SpeechRecognitionResult.h: + (WebCore::SpeechRecognitionResult::isFinal): + (SpeechRecognitionResult): + * Modules/speech/SpeechRecognitionResult.idl: + * WebCore.gypi: + * bindings/v8/custom/V8SpeechRecognitionEventCustom.cpp: Renamed from Source/WebCore/bindings/v8/custom/V8SpeechRecognitionResultCustom.cpp. + (WebCore): + (WebCore::V8SpeechRecognitionEvent::opaqueRootForGC): + +2012-11-30 Simon Hausmann <simon.hausmann@digia.com>, Pierre Rossi <pierre.rossi@digia.com> + + [Qt] Separate Qt WebKit into Qt WebKit and Qt WebKit Widgets + https://bugs.webkit.org/show_bug.cgi?id=99314 + + Reviewed by Tor Arne Vestbø. + + This big change separates QtWebKit into QtWebKit and QtWebKitWidgets as + shared libraries. + + It's a big refactoring that mostly involves moving WebCore dependent + code into QtWebKit and accessing it through exported QWebFrameAdapter + and QWebPageAdapter classes. + + * Target.pri: + * platform/qt/QStyleFacade.h: Get rid of styleForPage function, not needed + anymore. + * platform/qt/QWebPageClient.h: + (QWebPageClient): Remove a whole lot of cruft in favour of a simple GL enabling + callback to select the GL texture mapper. + (QWebPageClient::makeOpenGLContextCurrentIfAvailable): + +2012-11-30 Simon Hausmann <simon.hausmann@digia.com> + + Unreviewed, rolling out r136227. + http://trac.webkit.org/changeset/136227 + + Broke the Qt bots due to version mismatch + + * platform/graphics/gstreamer/PlatformVideoWindowQt.cpp: + (FullScreenVideoWindow::FullScreenVideoWindow): + (PlatformVideoWindow::PlatformVideoWindow): + +2012-11-30 Samuel Rødal <samuel.rodal@digia.com> + + [Qt] Fixed use of to-be-removed compatibility functions in QWindow. + + Reviewed by Simon Hausmann. + + * platform/graphics/gstreamer/PlatformVideoWindowQt.cpp: + (FullScreenVideoWindow::FullScreenVideoWindow): + (PlatformVideoWindow::PlatformVideoWindow): + +2012-11-30 Arpita Bahuguna <arpitabahuguna@gmail.com> + + Caret is painted horizontally in vertical writing mode when there are no visible text + https://bugs.webkit.org/show_bug.cgi?id=102359 + + Reviewed by Ryosuke Niwa. + + In the vertical writing mode the caret rect on an empty editable box or + an empty line is rendered as per the horizontal writing mode. + + This changes though when any text is added; the caret is then displayed + in accordance with the vertical writing mode. + + Test: editing/selection/caret-alignment-for-vertical-text.html + + * rendering/RenderBox.cpp: + (WebCore::RenderBox::localCaretRect): + * rendering/RenderBoxModelObject.cpp: + (WebCore::RenderBoxModelObject::localCaretRectForEmptyElement): + The caret rect should be transposed for the vertical writing mode. Its + width and height values need to be interchanged for it to be oriented + as per the vertical text. + +2012-11-30 Sankeerth V S <sankeerth.vs@samsung.com> + + Web Inspector: [Timeline] JS error when clicking in Memory Statistics view + https://bugs.webkit.org/show_bug.cgi?id=103486 + + Reviewed by Alexander Pavlov. + + The counter value can be null/undefined. Hence a check is needed + before we access the "time" property on this counter object. + + No new tests required as UI related change. + + * inspector/front-end/MemoryStatistics.js: + (WebInspector.MemoryStatistics.prototype._onClick): + +2012-11-30 Kent Tamura <tkent@chromium.org> + + Fix typos in DateTimeNumericFieldElement.cpp and DateTimeSymbolicFieldElement.cpp + https://bugs.webkit.org/show_bug.cgi?id=103717 + + Reviewed by Hajime Morita. + + * html/shadow/DateTimeNumericFieldElement.cpp: + (WebCore::DateTimeNumericFieldElement::customStyleForRenderer): + maximum, not maxium. + * html/shadow/DateTimeSymbolicFieldElement.cpp: + (WebCore::DateTimeSymbolicFieldElement::customStyleForRenderer): Ditto. + +2012-11-30 Halton Huo <halton.huo@intel.com> + + [EFL] libwebcore_efl.a fail to link when enable webgl + https://bugs.webkit.org/show_bug.cgi?id=103610 + + Reviewed by Gyuyoung Kim. + + libwebcore_efl.a should link to X11, Xcomposite and Xrender libraries when ENABLE_WEBGL is ON + + No new tests, no behavior change for layout tests. + + * PlatformEfl.cmake: Append ${X11_X11_LIB}, ${X11_Xcomposite_LIB} and ${X11_Xrender_LIB} to WebCore_LIBRARIES + +2012-11-30 Tim Horton <timothy_horton@apple.com> + + Unreviewed, fix the PDFPlugin build after http://trac.webkit.org/changeset/136205. + + * WebCore.xcodeproj/project.pbxproj: + +2012-11-30 Mihai Maerean <mmaerean@adobe.com> + + [CSSRegions] when WebKit uses V8, there should be a single variable to store if the CSS Regions feature is enabled + https://bugs.webkit.org/show_bug.cgi?id=101192 + + Reviewed by Hajime Morita. + + Removed the CSS Regions flag in Settings and switched to using the new flag I have added in RuntimeEnabledFeatures. + + Tests: No new tests because there is no functional change. + + * WebCore.exp.in: + * WebCore.vcproj/copyForwardingHeaders.cmd: + * WebCore.xcodeproj/project.pbxproj: + * bindings/generic/RuntimeEnabledFeatures.cpp: + (WebCore): + * bindings/generic/RuntimeEnabledFeatures.h: + (RuntimeEnabledFeatures): + (WebCore::RuntimeEnabledFeatures::setCSSRegionsEnabled): + (WebCore::RuntimeEnabledFeatures::cssRegionsEnabled): + * dom/Document.cpp: + (WebCore::Document::cssRegionsEnabled): + * page/Settings.cpp: + (WebCore::Settings::Settings): + * page/Settings.h: + (Settings): + +2012-11-29 Martin Robinson <mrobinson@igalia.com> + + [GTK] [WebKit2] WebKitWebViewBase creates a GL context for the redirected XComposite window crashing WebKit in Xvfb + https://bugs.webkit.org/show_bug.cgi?id=103476 + + Reviewed by Alejandro G. Castro. + + Allow creation of RedirectedXCompositeWindow in a mode which does not have a backing + GLContext. For WebKit2 the GLContext is always in the WebProcess. Creating the GLContext + in both processes can cause crashes when library is run in Xvfb. + + No new tests. This fixes a crash running tests on some systems. + + * platform/gtk/RedirectedXCompositeWindow.cpp: + (WebCore::RedirectedXCompositeWindow::RedirectedXCompositeWindow): + (WebCore::RedirectedXCompositeWindow::resize): Do not create the GLContext when + in the new no-GLContext mode. + (WebCore::RedirectedXCompositeWindow::context): ASSERT that we are not in + no-GLContext mode. + +2012-11-29 Keishi Hattori <keishi@webkit.org> + + Better type ahead for DateTimeSymbolicFieldElement + https://bugs.webkit.org/show_bug.cgi?id=103031 + + Reviewed by Kent Tamura. + + This cuts out the type ahead code that will be used by HTMLSelectElement + and DateTimeSymbolicFieldElement into a TypeAhead class. This will + improve DateTimeSymbolicFieldElement type ahead which was first + character match only, by adding cycling, prefix match and index number + match. + + Added tests to month-multiple-fields-keyboard-events.html. + + * GNUmakefile.list.am: Added TypeAhead.{h,cpp} + * Target.pri: Ditto. + * WebCore.gypi: Ditto. + * WebCore.vcproj/WebCore.vcproj: Ditto. + * WebCore.xcodeproj/project.pbxproj: Ditto. + * CMakeLists.txt: Ditto. + * html/HTMLSelectElement.cpp: + (WebCore): + (WebCore::HTMLSelectElement::HTMLSelectElement): + (WebCore::HTMLSelectElement::indexOfSelectedOption): Returns index of current selection. + (WebCore::HTMLSelectElement::optionCount): Returns total number of options. + (WebCore::HTMLSelectElement::optionAtIndex): Returns option at index. + (WebCore::HTMLSelectElement::typeAheadFind): Use TypeAhead. + * html/HTMLSelectElement.h: + (HTMLSelectElement): + * html/TypeAhead.cpp: Added. + (WebCore): + (WebCore::TypeAhead::TypeAhead): + (WebCore::stripLeadingWhiteSpace): Moved from HTMLSelectElement.cpp. + (WebCore::TypeAhead::handleEvent): Returns index for match. + * html/TypeAhead.h: Added. + (WebCore): + (TypeAheadDataSource): Provide the data about the options that TypeAhead should match against. + (TypeAhead): + * html/shadow/DateTimeSymbolicFieldElement.cpp: + (WebCore::DateTimeSymbolicFieldElement::DateTimeSymbolicFieldElement): + (WebCore::DateTimeSymbolicFieldElement::handleKeyboardEvent): + (WebCore::DateTimeSymbolicFieldElement::indexOfSelectedOption): + (WebCore): + (WebCore::DateTimeSymbolicFieldElement::optionCount): + (WebCore::DateTimeSymbolicFieldElement::optionAtIndex): + * html/shadow/DateTimeSymbolicFieldElement.h: + (DateTimeSymbolicFieldElement): + +2012-11-29 Rafael Weinstein <rafaelw@chromium.org> + + [HTMLTemplateElement] Add feature flag + https://bugs.webkit.org/show_bug.cgi?id=103694 + + Reviewed by Adam Barth. + + This flag will guard the implementation of the HTMLTemplateElement. + http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/templates/index.html + + * Configurations/FeatureDefines.xcconfig: + * GNUmakefile.features.am: + +2012-11-29 Viatcheslav Ostapenko <v.ostapenko@samsung.com> + + Fix typo in commit 136189 + https://bugs.webkit.org/show_bug.cgi?id=103706 + + Reviewed by Kentaro Hara. + + Because of typo in commit 136189 blue color value was set twice for every pixel. + + * platform/image-decoders/jpeg/JPEGImageDecoder.cpp: + (WebCore::setPixel): + +2012-11-29 Elliott Sprehn <esprehn@chromium.org> + + Node::isDescendantOf contains logic that duplicates isDocumentNode + https://bugs.webkit.org/show_bug.cgi?id=103698 + + Reviewed by Hajime Morita. + + Instead of checking for documents with node->document() == node just + use node->isDocumentNode(). + + * dom/Node.cpp: + (WebCore::Node::isDescendantOf): + +2012-11-29 Alexey Proskuryakov <ap@apple.com> + + [WK2] Forward cookie jar calls to NetworkProcess + https://bugs.webkit.org/show_bug.cgi?id=103457 + + Reviewed by Darin Adler. + + * WebCore.exp.in: + * WebCore.xcodeproj/project.pbxproj: + PlatformCookieJar.h functions are now used in WebKit2. + + * loader/CookieJar.cpp: + (WebCore::cookies): + (WebCore::setCookies): + (WebCore::cookiesEnabled): + (WebCore::cookieRequestHeaderFieldValue): + (WebCore::getRawCookies): + (WebCore::deleteCookie): + (WebCore::getHostnamesWithCookies): + (WebCore::deleteCookiesForHostname): + (WebCore::deleteAllCookies): + Use a strategy instead of going to PlatformCookieJar directly. + + * platform/Cookie.h: (Cookie): Added a default constructor, so that Cookie could be + sent over IPC. + + * platform/CookiesStrategy.h: Added functions for cookie jar. + +2012-11-29 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r136167. + http://trac.webkit.org/changeset/136167 + https://bugs.webkit.org/show_bug.cgi?id=103701 + + Win debug build failure (Requested by zhenyao on #webkit). + + * platform/graphics/chromium/LazyDecodingPixelRef.cpp: + (WebCore::LazyDecodingPixelRef::LazyDecodingPixelRef): + * platform/graphics/chromium/LazyDecodingPixelRef.h: + (LazyDecodingPixelRef): + +2012-11-29 David Grogan <dgrogan@chromium.org> + + IndexedDB: Propagate more leveldb errors to script + https://bugs.webkit.org/show_bug.cgi?id=103580 + + Reviewed by Tony Chang. + + LevelDBDatabase used a single return value to indicate both I/O problems + and a missing key. Now an out variable is used to indicate if the + requested key was found. The return value is used to report corruption + or disk error. + + This is a small step toward propagating low level errors everywhere + possible. So far only one scenario will newly cause script to receive + an error: when leveldb has trouble looking for existing keys during an + objectstore->add. + + * Modules/indexeddb/IDBBackingStore.cpp: + (WebCore::getInt): + (WebCore::getVarInt): + (WebCore::getString): + (WebCore::IDBBackingStore::getKeyGeneratorCurrentNumber): + (WebCore::IDBBackingStore::maybeUpdateKeyGeneratorCurrentNumber): + (WebCore::IDBBackingStore::keyExistsInObjectStore): + * Modules/indexeddb/IDBBackingStore.h: + (IDBBackingStore): + * Modules/indexeddb/IDBObjectStoreBackendImpl.cpp: + (WebCore::IDBObjectStoreBackendImpl::setIndexKeys): + (WebCore::IDBObjectStoreBackendImpl::putInternal): + (WebCore::IDBObjectStoreBackendImpl::generateKey): + (WebCore::IDBObjectStoreBackendImpl::updateKeyGenerator): + * Modules/indexeddb/IDBObjectStoreBackendImpl.h: + (IDBObjectStoreBackendImpl): + * platform/leveldb/LevelDBDatabase.cpp: + (WebCore::LevelDBDatabase::safeGet): + * platform/leveldb/LevelDBDatabase.h: + (LevelDBDatabase): + * platform/leveldb/LevelDBTransaction.cpp: + (WebCore::LevelDBTransaction::safeGet): + (WebCore): + (WebCore::LevelDBTransaction::get): + * platform/leveldb/LevelDBTransaction.h: + (LevelDBTransaction): + +2012-11-29 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r136171. + http://trac.webkit.org/changeset/136171 + https://bugs.webkit.org/show_bug.cgi?id=103695 + + Likely caused ReOpenedWithID and ReOpenedWithURL to fail in + linux/chromeos (Requested by zhenyao on #webkit). + + * inspector/InspectorClient.h: + (WebCore::InspectorClient::startMainThreadMonitoring): + (WebCore::InspectorClient::stopMainThreadMonitoring): + * inspector/InspectorController.cpp: + * inspector/InspectorController.h: + (InspectorController): + * inspector/InspectorInstrumentation.cpp: + (WebCore): + (WebCore::InspectorInstrumentation::willProcessTaskImpl): + (WebCore::InspectorInstrumentation::didProcessTaskImpl): + * inspector/InspectorInstrumentation.h: + (InspectorInstrumentation): + (WebCore::InspectorInstrumentation::willProcessTask): + (WebCore): + (WebCore::InspectorInstrumentation::didProcessTask): + * inspector/InspectorTimelineAgent.cpp: + (WebCore::InspectorTimelineAgent::start): + (WebCore::InspectorTimelineAgent::stop): + +2012-11-29 Viatcheslav Ostapenko <v.ostapenko@samsung.com> + + Optimization in image decoding. + https://bugs.webkit.org/show_bug.cgi?id=88424 + + Reviewed by Brent Fulgham. + + Reduce branching and multiplications in JPEG image decoding loops and functions. + Code is moved to the template functions with scale and color space template parameters + because they were reason of branches inside loops. With templated funtions compiler + will generate separate instance of function for every set of parameters removing + unreachable code in every condition where constant value is used. + + Rebase and update of original patch by Misha Tyutyunik <michael.tyuytunik@nokia.com> . + + Thanks to Noel Gordon for his help in cleaning up remaining issues. + + Covered by existing tests. + + * platform/image-decoders/jpeg/JPEGImageDecoder.cpp: + (WebCore): + (WebCore::setPixel): + (WebCore::JPEGImageDecoder::outputScanlines): + * platform/image-decoders/jpeg/JPEGImageDecoder.h: + (JPEGImageDecoder): + +2012-11-29 Kentaro Hara <haraken@chromium.org> + + Unreviewed, rolling out r135862. + http://trac.webkit.org/changeset/135862 + https://bugs.webkit.org/show_bug.cgi?id=103367 + + We've been observing 'Fatal error in + v8::V8::AddMessageListener()' in bots + + * bindings/v8/V8Binding.cpp: + (WebCore::v8NonStringValueToWebCoreString): + * bindings/v8/V8StringResource.cpp: + (WebCore::int32ToWebCoreStringFast): + (WebCore::int32ToWebCoreString): + * bindings/v8/V8StringResource.h: + (WebCore::V8StringResource::V8StringResource): + (WebCore::V8StringResource::prepareBase): + (WebCore::V8StringResource::setString): + (V8StringResource): + (WebCore::V8StringResource::toString): + (WebCore::::prepare): + +2012-11-29 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: optimize repaint regions upon text editing + https://bugs.webkit.org/show_bug.cgi?id=103674 + + Reviewed by Vsevolod Vlasov. + + There is a lot happening that makes repaint area larger than it should be, + namely unnecessary tabbed pane and navigator updates. + + * inspector/front-end/NavigatorView.js: + (WebInspector.NavigatorView.prototype._updateScriptTitle): + * inspector/front-end/TabbedPane.js: + (WebInspector.TabbedPaneTab.prototype.set title): + +2012-11-29 KyungTae Kim <ktf.kim@samsung.com> + + Unused parameters on plugins/npapi.cpp + https://bugs.webkit.org/show_bug.cgi?id=103676 + + Reviewed by Kentaro Hara. + + Because 'instance' and 'menu' are not used when !PLATFORM(QT) || !defined(XP_MACOSX), + use UNUSED_PARAM macro to fix build warning -Wunused-parameter + + * plugins/npapi.cpp: + (NPN_PopUpContextMenu): + +2012-11-29 Pablo Flouret <pablof@motorola.com> + + REGRESSION(r134693): Compilation error on @supports grammar code + https://bugs.webkit.org/show_bug.cgi?id=103678 + + Reviewed by Tony Chang. + + Coming from https://bugs.webkit.org/show_bug.cgi?id=102295 + + No new tests, compile fix. + + * css/CSSGrammar.y.in: + +2012-11-29 Simon Fraser <simon.fraser@apple.com> + + Avoid painting lots of small rects in WebLayer painting + https://bugs.webkit.org/show_bug.cgi?id=103673 + + Reviewed by Tim Horton. + + r109186 added code in drawLayerContents() to enumerate over the rects in + the CALayer's dirty region, and paint them individually. This was done + to help performance on the IE Maze Solver test. + + On large, complex pages like Facebook, the overhead of traversing the + RenderLayer tree for painting is such that it's better to paint a single, + or fewer rects rather than lots of little ones. + + So adopt a heuristic similar to that in DrawingArea, where if the + combined area of the small rects is 75% or more of the combined rect, + just paint the combined rect. Also paint the combined rect if there + are more than 5 individual rects. + + I verified that this preserves the optimization for IE Maze Solver. + + * platform/graphics/mac/WebLayer.mm: + (drawLayerContents): + +2012-11-29 Eugene Klyuchnikov <eustas@chromium.org> + + Web Inspector: Web Inspector: Make main-thread monitoring go through InspectorController. + https://bugs.webkit.org/show_bug.cgi?id=103550 + + Reviewed by Pavel Feldman. + + InspectorInstrumentation was a wrong path. + + * inspector/InspectorClient.h: Remove start/stop methods. + * inspector/InspectorController.cpp: + Dispatch main thread activity notifications. + * inspector/InspectorController.h: Ditto. + * inspector/InspectorInstrumentation.cpp: Remove dispatching. + * inspector/InspectorInstrumentation.h: Ditto. + * inspector/InspectorTimelineAgent.cpp: + Do not subscribe for notifications explicitly. + +2012-11-29 Adam Barth <abarth@webkit.org> + + [V8] DOM callbacks shouldn't reimplement ScopedPersistent they should use it + https://bugs.webkit.org/show_bug.cgi?id=103662 + + Reviewed by Eric Seidel. + + This patch replaces yet another instance of the ScopedPersistent + pattern with ScopedPersistent. + + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateCallbackHeader): + (GenerateCallbackImplementation): + * bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp: + (WebCore::V8SQLStatementErrorCallback::handleEvent): + * bindings/v8/custom/V8MutationCallbackCustom.cpp: + (WebCore::V8MutationCallback::handleEvent): + +2012-11-29 Min Qin <qinmin@chromium.org> + + Make LazyDecodingPixelRef inherit from skia::LazyPixelRef so that cc thread can access it + https://bugs.webkit.org/show_bug.cgi?id=103555 + + Reviewed by Stephen White. + + Expose LazyDecodingPixelRef to the cc thread by inheriting from skia::LazyPixelRef. + No test added for now as impl side paiting is still WIP. + + * platform/graphics/chromium/LazyDecodingPixelRef.cpp: + (WebCore::LazyDecodingPixelRef::LazyDecodingPixelRef): + (WebCore::LazyDecodingPixelRef::PrepareToDecode): + (WebCore): + (WebCore::LazyDecodingPixelRef::Decode): + * platform/graphics/chromium/LazyDecodingPixelRef.h: + (LazyDecodingPixelRef): + +2012-11-29 Julien Chaffraix <jchaffraix@webkit.org> + + Unreviewed build fix. + + * WebCore.gypi: + The new file is GridTrackSize.h not GridTrackSizes.h. For some reason, the + EWS didn't complain. + +2012-11-29 John Knottenbelt <jknotten@chromium.org> + + Use GeolocationController's last geoposition as cached position. + https://bugs.webkit.org/show_bug.cgi?id=103540 + + Reviewed by Benjamin Poulain. + + The page's GeolocationController mediates access to the + GeolocationClient for multiple frames' Geolocation instances. This + patch changes the position cache to be on the GeolocationController + rather than on the Geolocation instance. + + This fixes a bug where if one frame has has received a fresh + position, then a request for a cached position from a second frame + does not succeed because the Geolocation instance in the second + frame's position cache hasn't received the position update that + went to the first frame. + + Test: fast/dom/Geolocation/cached-position-iframe.html + + * Modules/geolocation/Geolocation.cpp: + (WebCore::Geolocation::makeCachedPositionCallbacks): + (WebCore::Geolocation::haveSuitableCachedPosition): + (WebCore::Geolocation::positionChanged): + * Modules/geolocation/Geolocation.h: + * Modules/geolocation/GeolocationController.h: + (GeolocationController): + +2012-11-29 Alexei Filippov <alph@chromium.org> + + Web Inspector: Allow sorting in NMI snapshot grid view + https://bugs.webkit.org/show_bug.cgi?id=102955 + + Reviewed by Yury Semikhatsky. + + * English.lproj/localizedStrings.js: + * inspector/front-end/NativeMemorySnapshotView.js: + (WebInspector.NativeSnapshotDataGrid.prototype.sortingChanged): + (WebInspector.NativeSnapshotDataGrid.prototype._sortingFunction): + (WebInspector.NativeSnapshotNode): + (WebInspector.NativeSnapshotNode.prototype._storeState): + (WebInspector.NativeSnapshotNode.prototype._restoreState): + (WebInspector.NativeSnapshotNode.prototype.uid): + (WebInspector.NativeSnapshotNode.prototype._createSizeCell): + +2012-11-29 Martin Robinson <mrobinson@igalia.com> + + [GTK] [WebKit2] Embed the HTTP authentication dialog into the WebView + https://bugs.webkit.org/show_bug.cgi?id=103277 + + Reviewed by Carlos Garcia Campos. + + Refactor the WebCore authentication dialog so that it can be reused for the WebKit2 + embedded authentication dialog. The main purpose of this refactor is so that the + dialog does not rely on GtkDialog to add the action buttons to the dialog itself. + This also simplifies the structure of the dialog, using the GtkTable or GtkGrid to + contain more of the widget elements, greatly simplifying this code. We also expose + a new constructor that does not create the parent GtkDialog -- so that WebKit2 + can embed the dialog directly into the WebView. + + No new tests. This shouldn't change behavior, only slightly the look of the authentication + dialog. + + * platform/gtk/GtkAuthenticationDialog.cpp: + (WebCore::GtkAuthenticationDialog::GtkAuthenticationDialog): Added this new constructor + which does not add the dialog contents to a GtkDialog. + (WebCore::packTwoColumnLayoutInBox): Added this generic method for creating a two column + layout in the style the dialog box needs (for both GTK+ 2.x and GTK+ 3.x). + (WebCore::createDialogLabel): Added this helper. + (WebCore::createDialogEntry): ditto. + (WebCore::GtkAuthenticationDialog::createContentsInContainer): Added this method which + can be used by subclasses to add the guts of the dialog to the parent container. + (WebCore::GtkAuthenticationDialog::show): Added some focus/default handling code that + GtkDialog was calling before. + (WebCore::GtkAuthenticationDialog::buttonClickedCallback): Added a button clicked handler. + Before GtkDialog handled this. + * platform/gtk/GtkAuthenticationDialog.h: Updated methods to reflect new functionality. + (WebCore::GtkAuthenticationDialog::~GtkAuthenticationDialog): Inline the default constructor. + +2012-11-29 Beth Dakin <bdakin@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=103577 + TiledDrawingArea should recycle tiles + -and corresponding- + <rdar://problem/12714586> + + Reviewed by Simon Fraser. + + New class LayerPool will keep a list of layers to reuse so that + we can avoid creating and destroying so many layer. + + When removing layers, add them to the LayerPool + * platform/graphics/ca/mac/TileCache.mm: + (WebCore::TileCache::revalidateTiles): + + Before creating a new layer, try to get one of the appropriate size + from the LayerPool. + (WebCore::TileCache::createTileLayer): + + New class. + * WebCore.xcodeproj/project.pbxproj: + * platform/graphics/ca/mac/LayerPool.h: Added. + (WebCore): + (LayerPool): + (WebCore::LayerPool::capacity): + (WebCore::LayerPool::canReuseLayerWithSize): + * platform/graphics/ca/mac/LayerPool.mm: Added. + (WebCore): + (WebCore::LayerPool:: LayerPool): + (WebCore::LayerPool::sharedPool): + (WebCore::LayerPool::bytesBackingLayerWithPixelSize): + (WebCore::LayerPool::listOfLayersWithSize): + (WebCore::LayerPool::addLayer): + (WebCore::LayerPool::takeLayerWithSize): + (WebCore::LayerPool::decayedCapacity): + (WebCore::LayerPool::schedulePrune): + (WebCore::LayerPool::prune): + (WebCore::LayerPool::drain): + + If we're under memory pressure, drain the LayerPool + * platform/mac/MemoryPressureHandlerMac.mm: + (WebCore::MemoryPressureHandler::releaseMemory): + +2012-11-29 Julien Chaffraix <jchaffraix@webkit.org> + + [CSS Grid Layout] track sizing functions should have their own type + https://bugs.webkit.org/show_bug.cgi?id=103343 + + Reviewed by Tony Chang. + + The current code uses a Length to represent the track sizing function. This is + fine as we only parse <length> | <percentage> but in order to support minmax + sizing, we have to store 2 Lengths. We could go with a pair but that would make + the code not very readable so this change introduces GridTrackSize. + + Refactoring, covered by existing tests. + + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + Added GridTrackSize.h to all our build systems. + + * css/CSSComputedStyleDeclaration.cpp: + (WebCore::valueForGridTrackBreadth): + (WebCore::valueForGridTrackList): + * css/StyleResolver.cpp: + (WebCore::createGridTrackBreadth): + (WebCore::createGridTrackList): + (WebCore::StyleResolver::applyProperty): + * rendering/RenderGrid.cpp: + (WebCore::RenderGrid::computePreferredLogicalWidths): + (WebCore::RenderGrid::computedUsedBreadthOfGridTracks): + * rendering/style/RenderStyle.h: + Updated the above call sites to use GridTrackSize. While + touching them, changed the code to use an empty Vector to represent + 'none' instead of Length(Undefined). + + * rendering/style/StyleGridData.h: + Updated #include, removed a comment as it would have gone stale after + adding more grammar support and added a FIXME to rename some variables. + + * rendering/RenderGrid.cpp: + (WebCore::RenderGrid::layoutGridItems): + Implemented a work-around to avoid crashing due to implicit columns / rows. + + * rendering/style/GridTrackSize.h: Added. + (WebCore::GridTrackSize::GridTrackSize): + (WebCore::GridTrackSize::length): + (WebCore::GridTrackSize::setLength): + (WebCore::GridTrackSize::type): + (WebCore::GridTrackSize::operator==): + New class, it now only wraps a single Length. + +2012-11-29 Helder Correia <helder.correia@nokia.com> + + Typo in Color creation function name + https://bugs.webkit.org/show_bug.cgi?id=103464 + + Reviewed by Alexey Proskuryakov. + + Renaming createUnCheked() as createUnchecked(). + + No new tests. + + * platform/graphics/Color.cpp: + (WebCore::colorFromPremultipliedARGB): + * platform/graphics/Color.h: + (WebCore::Color::createUnchecked): + +2012-11-29 Otto Derek Cheung <otcheung@rim.com> + + [BlackBerry] Cookies in private mode should not have access to public cookies + https://bugs.webkit.org/show_bug.cgi?id=103649 + + Reviewed by Rob Buis. + + PR 253983 + + When CookieManager switches back from public to private mode, + we will clear the cookie tree so the browser won't have access + to the public cookies. + + Tested using browser.swlab.rim.net cookie tests and the steps in + the PR. + + * platform/blackberry/CookieManager.cpp: + (WebCore::CookieManager::setPrivateMode): + +2012-11-29 Brent Fulgham <bfulgham@gmail.com> + + Be consistent in handling of frameAtIndex (and related) returns. + https://bugs.webkit.org/show_bug.cgi?id=103207 + + Reviewed by David Hyatt. + + Under various conditions, frameAtIndex (and therefore, + nativeImageForCurrentFrame) returns null. A series of bugs over + the years has ensured null returns are handled in some cases, + but there are a handful of remaining cases where this is still a + problem. + + No new tests, as these low-level functions are covered by + numerous existing test cases. + +2012-11-29 David Hyatt <hyatt@apple.com> + + [New Multicolumn] Add minimum column height tracking and forced break tracking to column sets. + https://bugs.webkit.org/show_bug.cgi?id=103657 + + Reviewed by Simon Fraser. + + * rendering/RenderMultiColumnSet.cpp: + (WebCore::RenderMultiColumnSet::RenderMultiColumnSet): + * rendering/RenderMultiColumnSet.h: + (WebCore::RenderMultiColumnSet::updateMinimumColumnHeight): + (WebCore::RenderMultiColumnSet::minimumColumnHeight): + (RenderMultiColumnSet): + (WebCore::RenderMultiColumnSet::forcedBreaksCount): + (WebCore::RenderMultiColumnSet::forcedBreakOffset): + (WebCore::RenderMultiColumnSet::maximumDistanceBetweenForcedBreaks): + (WebCore::RenderMultiColumnSet::clearForcedBreaks): + (WebCore::RenderMultiColumnSet::addForcedBreak): + +2012-11-29 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: introduce fast case for within-chunk edit + https://bugs.webkit.org/show_bug.cgi?id=103545 + + Reviewed by Vsevolod Vlasov. + + Special-casing edits within the chunk for faster operation. + + * inspector/front-end/DOMExtension.js: + (removeSubsequentNodes): + * inspector/front-end/DefaultTextEditor.js: + (WebInspector.TextEditorMainPanel.prototype._updateChunksForRanges): + +2012-11-29 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: Console: hovering node wrappers in object tree should highlight them on the page + https://bugs.webkit.org/show_bug.cgi?id=101150 + + Reviewed by Vsevolod Vlasov. + + - Introduced a way to highlight nodes by object id in addition to node id. + - Decorated nodes in the object tree outline and added on-hover highlighting. + + * inspector/Inspector.json: + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::highlightNode): + * inspector/InspectorDOMAgent.h: + (InspectorDOMAgent): + * inspector/front-end/ConsoleMessage.js: + (WebInspector.ConsoleMessageImpl.prototype._appendPropertyPreview): + * inspector/front-end/DOMAgent.js: + (WebInspector.DOMAgent.prototype.highlightDOMNode): + * inspector/front-end/DOMPresentationUtils.js: + (WebInspector.DOMPresentationUtils.createSpansForNodeTitle): + * inspector/front-end/ObjectPropertiesSection.js: + (WebInspector.ObjectPropertyTreeElement.prototype.update): + (WebInspector.ObjectPropertyTreeElement.prototype._mouseMove): + (WebInspector.ObjectPropertyTreeElement.prototype._mouseOut): + * inspector/front-end/RemoteObject.js: + (WebInspector.RemoteObject.prototype.highlightAsDOMNode): + (WebInspector.RemoteObject.prototype.hideDOMNodeHighlight): + * inspector/front-end/TestController.js: + * inspector/front-end/externs.js: + * inspector/front-end/inspector.css: + (.console-formatted-node:hover): + * inspector/front-end/utilities.js: + +2012-11-29 Dan Bernstein <mitz@apple.com> + + <rdar://problem/12771885> Support ruby-position: {before, after} + https://bugs.webkit.org/show_bug.cgi?id=103569 + + Reviewed by Anders Carlsson. + + Specified in <http://www.w3.org/TR/2011/WD-css3-ruby-20110630/#rubypos>, the ruby-position + property takes four values: before, after, inter-character, and inline. This change adds + support for the values before and after. + + Test: fast/ruby/position-after.html + + * css/CSSComputedStyleDeclaration.cpp: + (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Handle ruby-position. + * css/CSSParser.cpp: + (WebCore::isValidKeywordPropertyAndValue): Accept before and after as valid values for + ruby-position. + (WebCore::isKeywordPropertyID): Added ruby-position to the list of properties with keyword + values. + (WebCore::CSSParser::parseValue): Added ruby-position to the switch statement. + * css/CSSPrimitiveValueMappings.h: + (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Added mapping from RubyPosition. + (WebCore::CSSPrimitiveValue::operator RubyPosition): Added mapping from CSSPrimitiveValue. + * css/CSSProperty.cpp: + (WebCore::CSSProperty::isInheritedProperty): Added ruby-position as an inherited property. + * css/CSSPropertyNames.in: Added -webkit-ruby-position. + * css/CSSValueKeywords.in: Added after and before. + * css/StyleBuilder.cpp: + (WebCore::StyleBuilder::StyleBuilder): Added a handler for ruby-position. + * css/StyleResolver.cpp: + (WebCore::StyleResolver::applyProperty): Added ruby-position. + * rendering/InlineFlowBox.cpp: + (WebCore::InlineFlowBox::placeBoxesInBlockDirection): Changed to choose which of + hasAnnotationsBefore and hasAnnotationsAfter to set based on ruby position. + (WebCore::InlineFlowBox::computeOverAnnotationAdjustment): Changed to adjust only for + ruby positioned before the base. + (WebCore::InlineFlowBox::computeUnderAnnotationAdjustment): Added adjustment for ruby + positioned after the base. + * rendering/RenderRubyRun.cpp: + (WebCore::RenderRubyRun::layout): Account for ruby-position when positioning the ruby text + relative to the base. + * rendering/style/RenderStyle.cpp: + (WebCore::RenderStyle::diff): Made a ruby-position difference a layout difference. + * rendering/style/RenderStyle.h: Added rubyPosition(), setRubyPosition(), and + initialRubyPosition(). + * rendering/style/RenderStyleConstants.h: Added the RubyPosition enum. + * rendering/style/StyleRareInheritedData.cpp: + (WebCore::StyleRareInheritedData::StyleRareInheritedData): Added initialized for + m_rubyPosition. Added copying the value of this member to the copy constructor. + (WebCore::StyleRareInheritedData::operator==): Added comparison of m_rubyPosition. + * rendering/style/StyleRareInheritedData.h: + (StyleRareInheritedData): Added m_rubyPosition member variable. + +2012-11-29 Tiancheng Jiang <tijiang@rim.com> + + [BlackBerry] Update BB10 form theme. + https://bugs.webkit.org/show_bug.cgi?id=100760 + + Reviewed by Rob Buis. + + Internally Reviewed by Eli Fidler. + Set text color after buttons are pressed. + + * css/themeBlackBerry.css: + (input[type="button"]:active, input[type="submit"]:active, input[type="reset"]:active, input[type="file"]:active::-webkit-file-upload-button, button:active): + (select:active): + * platform/blackberry/RenderThemeBlackBerry.cpp: + (WebCore): + (WebCore::RenderThemeBlackBerry::paintButton): + (WebCore::RenderThemeBlackBerry::paintMenuList): + +2012-11-29 Zeno Albisser <zeno@webkit.org> + + GraphicsSurfaceGLX: remove redundant parameter from resolveGLMethods. + https://bugs.webkit.org/show_bug.cgi?id=103636 + + Reviewed by Kenneth Rohde Christiansen. + + * platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp: + (WebCore::resolveGLMethods): + (WebCore::GraphicsSurface::platformCreate): + (WebCore::GraphicsSurface::platformImport): + +2012-11-29 Mike West <mkwst@chromium.org> + + Typo in 'autofocus' sandboxing error message. + https://bugs.webkit.org/show_bug.cgi?id=103616 + + Reviewed by Jochen Eisinger. + + The sandbox attribute name is 'allow-scripts', not 'allow-script'. :( + + * html/HTMLFormControlElement.cpp: + (WebCore::shouldAutofocus): + +2012-11-29 Hajime Morrita <morrita@google.com> + + HTMLMediaElement's .textTracks property does not reflect <track> element + https://bugs.webkit.org/show_bug.cgi?id=103420 + + Reviewed by Eric Carlson. + + There were some assumptions that <track> elements are valid only + if the parent <media> is in document. This change relaxes this + assumption so that <track> is valid when it has <media> as a + parent regardless whether the <media> is in the document or not. + + HTMLMediaElement::didAddTrack and didRemoveTrack are now called + when the <track> is inserted to or removed from the parent <media> + element. + + Test: media/track/track-node-add-remove.html + + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::didRemoveTrack): + Renamed from willRemoveTrack() to reflect the timing. This was once called from + Node::willRemove(), which was removed a while ago. + * html/HTMLMediaElement.h: + (HTMLMediaElement): + * html/HTMLTrackElement.cpp: + (WebCore::HTMLTrackElement::insertedInto): + The old code notified parent <media> only if the subtree became a part of the document. + Now it notifies the <media> when this <track> becomes a child of that <media>. + + (WebCore::HTMLTrackElement::removedFrom): + The old code notifies the parent <media> every time as long as the parent is available. + Now it notifies the <media> only if this <track> is removed from the parent <media>. + This matches how corresponding notification is done in insertedInto(). + + * html/track/LoadableTextTrack.cpp: + (WebCore::LoadableTextTrack::trackElementIndex): + +2012-11-29 Florin Malita <fmalita@chromium.org> + + [Skia] Add missing OpaqueRegionSkia notifier calls + https://bugs.webkit.org/show_bug.cgi?id=102824 + + Reviewed by Stephen White. + + http://trac.webkit.org/changeset/135390 exposed some canvas draw clients which are not + updating the opaque region tracker. This patch adds the required notifier calls. + + No new tests: platform unit tests added. + + * platform/graphics/skia/OpaqueRegionSkia.h: + (OpaqueRegionSkia): + * platform/graphics/skia/PlatformContextSkia.h: + (WebCore::PlatformContextSkia::writePixels): + (WebCore::PlatformContextSkia::drawBitmap): + (WebCore::PlatformContextSkia::drawBitmapRect): + (WebCore::PlatformContextSkia::drawIRect): + (WebCore::PlatformContextSkia::drawPosText): + (WebCore::PlatformContextSkia::drawPosTextH): + (WebCore::PlatformContextSkia::drawTextOnPath): + +2012-11-29 Andy Shaw <andy.shaw@digia.com> + + [Qt] Implement support for Cocoa based NPAPI plugins on Mac + https://bugs.webkit.org/show_bug.cgi?id=72358 + + Reviewed by Simon Hausmann. + + With later versions of Flash they are only Cocoa based which meant that it was not possible to use Flash in a QtWebKit browser. + This makes it possible to also use 64bit based plugins too. + + * plugins/PluginPackage.cpp: + (WebCore::PluginPackage::initializeBrowserFuncs): + (WebCore): + * plugins/PluginQuirkSet.h: + * plugins/PluginView.cpp: + (WebCore::PluginView::handleEvent): + (WebCore::PluginView::PluginView): + (WebCore): + (WebCore::PluginView::userAgent): + * plugins/PluginView.h: + (WebCore): + (PluginView): + * plugins/mac/PluginPackageMac.cpp: + (WebCore::PluginPackage::determineQuirks): + (WebCore::PluginPackage::fetchInfo): + * plugins/mac/PluginViewMac.mm: + (WebCore): + (WebCore::initializeNPCocoaEvent): + (WebCore::getModifiers): + (WebCore::PluginView::platformStart): + * plugins/npapi.cpp: + (NPN_PopUpContextMenu): + * plugins/npapi.h: + 2012-11-29 Sheriff Bot <webkit.review.bot@gmail.com> Unreviewed, rolling out r136111. diff --git a/Source/WebCore/Configurations/FeatureDefines.xcconfig b/Source/WebCore/Configurations/FeatureDefines.xcconfig index 588ddb80b..00678accd 100644 --- a/Source/WebCore/Configurations/FeatureDefines.xcconfig +++ b/Source/WebCore/Configurations/FeatureDefines.xcconfig @@ -143,6 +143,7 @@ ENABLE_SVG = ENABLE_SVG; ENABLE_SVG_DOM_OBJC_BINDINGS = $(ENABLE_SVG_DOM_OBJC_BINDINGS_$(PLATFORM_NAME)); ENABLE_SVG_DOM_OBJC_BINDINGS_macosx = ENABLE_SVG_DOM_OBJC_BINDINGS; ENABLE_SVG_FONTS = ENABLE_SVG_FONTS; +ENABLE_TEMPLATE_ELEMENT = ; ENABLE_TEXT_AUTOSIZING = ; ENABLE_TEXT_NOTIFICATIONS_ONLY = ENABLE_TEXT_NOTIFICATIONS_ONLY; ENABLE_TOUCH_ICON_LOADING = ; @@ -158,5 +159,5 @@ ENABLE_WORKERS = ENABLE_WORKERS; ENABLE_XHR_TIMEOUT = ENABLE_XHR_TIMEOUT; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_DEVICE_ADAPTATION) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_STICKY_POSITION) $(ENABLE_CSS_VARIABLES) $(ENABLE_CSS3_CONDITIONAL_RULES) $(ENABLE_CSS3_BACKGROUND) $(ENABLE_CSS3_TEXT) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIALOG_ELEMENT) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_DRAGGABLE_REGION) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LEGACY_VENDOR_PREFIXES) $(ENABLE_LEGACY_WEB_AUDIO) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_PROGRESS_ELEMENT) $(ENABLE_PROXIMITY_EVENTS) $(ENABLE_QUOTA) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SUBPIXEL_LAYOUT) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_USERSELECT_ALL) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XHR_TIMEOUT) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_DEVICE_ADAPTATION) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_STICKY_POSITION) $(ENABLE_CSS_VARIABLES) $(ENABLE_CSS3_CONDITIONAL_RULES) $(ENABLE_CSS3_BACKGROUND) $(ENABLE_CSS3_TEXT) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIALOG_ELEMENT) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_DRAGGABLE_REGION) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LEGACY_VENDOR_PREFIXES) $(ENABLE_LEGACY_WEB_AUDIO) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_PROGRESS_ELEMENT) $(ENABLE_PROXIMITY_EVENTS) $(ENABLE_QUOTA) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SUBPIXEL_LAYOUT) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEMPLATE_ELEMENT) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_USERSELECT_ALL) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XHR_TIMEOUT) $(ENABLE_XSLT); diff --git a/Source/WebCore/Configurations/Version.xcconfig b/Source/WebCore/Configurations/Version.xcconfig index 9eece5f65..5b85c8b22 100644 --- a/Source/WebCore/Configurations/Version.xcconfig +++ b/Source/WebCore/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 537; -MINOR_VERSION = 20; +MINOR_VERSION = 21; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/Source/WebCore/English.lproj/localizedStrings.js b/Source/WebCore/English.lproj/localizedStrings.js index e420fa50a..f721f9e23 100644 --- a/Source/WebCore/English.lproj/localizedStrings.js +++ b/Source/WebCore/English.lproj/localizedStrings.js @@ -231,6 +231,7 @@ localizedStrings["Inspected worker terminated"] = "Inspected worker terminated"; localizedStrings["Inspected worker has terminated. Once it restarts we will attach to it automatically."] = "Inspected worker has terminated. Once it restarts we will attach to it automatically."; localizedStrings["Install Timer"] = "Install Timer"; localizedStrings["Invalid property value."] = "Invalid property value."; +localizedStrings["KB"] = "KB"; localizedStrings["Key"] = "Key"; localizedStrings["Shortcuts"] = "Shortcuts"; localizedStrings["Layout"] = "Layout"; diff --git a/Source/WebCore/GNUmakefile.features.am b/Source/WebCore/GNUmakefile.features.am index c1276d161..218ab418b 100644 --- a/Source/WebCore/GNUmakefile.features.am +++ b/Source/WebCore/GNUmakefile.features.am @@ -84,6 +84,7 @@ feature_defines_defaults += \ ENABLE_SVG=1 \ ENABLE_SVG_DOM_OBJC_BINDINGS=0 \ ENABLE_SVG_FONTS=1 \ + ENABLE_TEMPLATE_ELEMENT=0 \ ENABLE_TEXT_AUTOSIZING=0 \ ENABLE_TOUCH_EVENTS=0 \ ENABLE_TOUCH_ICON_LOADING=0 \ diff --git a/Source/WebCore/GNUmakefile.list.am b/Source/WebCore/GNUmakefile.list.am index 8fb637870..e52a168ff 100644 --- a/Source/WebCore/GNUmakefile.list.am +++ b/Source/WebCore/GNUmakefile.list.am @@ -3625,6 +3625,8 @@ webcore_sources += \ Source/WebCore/html/track/WebVTTToken.h \ Source/WebCore/html/track/WebVTTTokenizer.h \ Source/WebCore/html/track/WebVTTTokenizer.cpp \ + Source/WebCore/html/TypeAhead.cpp \ + Source/WebCore/html/TypeAhead.h \ Source/WebCore/html/URLInputType.cpp \ Source/WebCore/html/URLInputType.h \ Source/WebCore/html/ValidationMessage.cpp \ @@ -4504,6 +4506,7 @@ webcore_sources += \ Source/WebCore/rendering/style/StyleVariableData.h \ Source/WebCore/rendering/style/StyleVisualData.cpp \ Source/WebCore/rendering/style/StyleVisualData.h \ + Source/WebCore/rendering/style/GridTrackSize.h \ Source/WebCore/rendering/TableLayout.h \ Source/WebCore/rendering/TrailingFloatsRootInlineBox.h \ Source/WebCore/storage/StorageTask.cpp \ diff --git a/Source/WebCore/Modules/geolocation/Geolocation.cpp b/Source/WebCore/Modules/geolocation/Geolocation.cpp index 519a1e45a..98b10d038 100644 --- a/Source/WebCore/Modules/geolocation/Geolocation.cpp +++ b/Source/WebCore/Modules/geolocation/Geolocation.cpp @@ -373,7 +373,7 @@ void Geolocation::makeCachedPositionCallbacks() GeoNotifierSet::const_iterator end = m_requestsAwaitingCachedPosition.end(); for (GeoNotifierSet::const_iterator iter = m_requestsAwaitingCachedPosition.begin(); iter != end; ++iter) { GeoNotifier* notifier = iter->get(); - notifier->runSuccessCallback(m_cachedPosition.get()); + notifier->runSuccessCallback(lastPosition()); // If this is a one-shot request, stop it. Otherwise, if the watch still // exists, start the service to get updates. @@ -404,14 +404,15 @@ void Geolocation::requestTimedOut(GeoNotifier* notifier) bool Geolocation::haveSuitableCachedPosition(PositionOptions* options) { - if (!m_cachedPosition) + Geoposition* cachedPosition = lastPosition(); + if (!cachedPosition) return false; if (!options->hasMaximumAge()) return true; if (!options->maximumAge()) return false; DOMTimeStamp currentTimeMillis = convertSecondsToDOMTimeStamp(currentTime()); - return m_cachedPosition->timestamp() > currentTimeMillis - options->maximumAge(); + return cachedPosition->timestamp() > currentTimeMillis - options->maximumAge(); } void Geolocation::clearWatch(int watchID) @@ -624,8 +625,6 @@ void Geolocation::positionChanged() { ASSERT(isAllowed()); - m_cachedPosition = lastPosition(); - // Stop all currently running timers. stopTimers(); diff --git a/Source/WebCore/Modules/geolocation/Geolocation.h b/Source/WebCore/Modules/geolocation/Geolocation.h index 0d95f4d64..f3bed34ee 100644 --- a/Source/WebCore/Modules/geolocation/Geolocation.h +++ b/Source/WebCore/Modules/geolocation/Geolocation.h @@ -173,7 +173,6 @@ private: No } m_allowGeolocation; - RefPtr<Geoposition> m_cachedPosition; GeoNotifierSet m_requestsAwaitingCachedPosition; }; diff --git a/Source/WebCore/Modules/indexeddb/IDBBackingStore.cpp b/Source/WebCore/Modules/indexeddb/IDBBackingStore.cpp index 9905d5b53..61253fa01 100644 --- a/Source/WebCore/Modules/indexeddb/IDBBackingStore.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBBackingStore.cpp @@ -91,7 +91,11 @@ template <typename DBOrTransaction> static bool getInt(DBOrTransaction* db, const LevelDBSlice& key, int64_t& foundInt) { Vector<char> result; - if (!db->get(key, result)) + bool found = false; + bool ok = db->safeGet(key, result, found); + // FIXME: Notify the caller if !ok. + ASSERT_UNUSED(ok, ok); + if (!found) return false; foundInt = decodeInt(result.begin(), result.end()); @@ -108,7 +112,11 @@ template <typename DBOrTransaction> static bool getVarInt(DBOrTransaction* db, const LevelDBSlice& key, int64_t& foundInt) { Vector<char> result; - if (!db->get(key, result)) + bool found = false; + bool ok = db->safeGet(key, result, found); + // FIXME: Notify the caller if !ok. + ASSERT_UNUSED(ok, ok); + if (!found) return false; return decodeVarInt(result.begin(), result.end(), foundInt) == result.end(); @@ -123,7 +131,11 @@ template <typename DBOrTransaction> static bool getString(DBOrTransaction* db, const LevelDBSlice& key, String& foundString) { Vector<char> result; - if (!db->get(key, result)) + bool found = false; + bool ok = db->safeGet(key, result, found); + // FIXME: Notify the caller if !ok. + ASSERT_UNUSED(ok, ok); + if (!found) return false; foundString = decodeString(result.begin(), result.end()); @@ -699,16 +711,22 @@ void IDBBackingStore::deleteRecord(IDBBackingStore::Transaction* transaction, in } -int64_t IDBBackingStore::getKeyGeneratorCurrentNumber(IDBBackingStore::Transaction* transaction, int64_t databaseId, int64_t objectStoreId) +bool IDBBackingStore::getKeyGeneratorCurrentNumber(IDBBackingStore::Transaction* transaction, int64_t databaseId, int64_t objectStoreId, int64_t& keyGeneratorCurrentNumber) { LevelDBTransaction* levelDBTransaction = IDBBackingStore::Transaction::levelDBTransactionFrom(transaction); const Vector<char> keyGeneratorCurrentNumberKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::KeyGeneratorCurrentNumber); - int64_t keyGeneratorCurrentNumber = -1; + keyGeneratorCurrentNumber = -1; Vector<char> data; - if (levelDBTransaction->get(keyGeneratorCurrentNumberKey, data)) + bool found = false; + bool ok = levelDBTransaction->safeGet(keyGeneratorCurrentNumberKey, data, found); + if (!ok) { + InternalError(IDBLevelDBBackingStoreReadError); + return false; + } + if (found) keyGeneratorCurrentNumber = decodeInt(data.begin(), data.end()); else { // Previously, the key generator state was not stored explicitly but derived from the @@ -741,29 +759,39 @@ int64_t IDBBackingStore::getKeyGeneratorCurrentNumber(IDBBackingStore::Transacti return keyGeneratorCurrentNumber; } -void IDBBackingStore::maybeUpdateKeyGeneratorCurrentNumber(IDBBackingStore::Transaction* transaction, int64_t databaseId, int64_t objectStoreId, int64_t newNumber, bool checkCurrent) +bool IDBBackingStore::maybeUpdateKeyGeneratorCurrentNumber(IDBBackingStore::Transaction* transaction, int64_t databaseId, int64_t objectStoreId, int64_t newNumber, bool checkCurrent) { LevelDBTransaction* levelDBTransaction = IDBBackingStore::Transaction::levelDBTransactionFrom(transaction); if (checkCurrent) { - int64_t currentNumber = getKeyGeneratorCurrentNumber(transaction, databaseId, objectStoreId); + int64_t currentNumber; + bool ok = getKeyGeneratorCurrentNumber(transaction, databaseId, objectStoreId, currentNumber); + if (!ok) + return false; if (newNumber <= currentNumber) - return; + return true; } const Vector<char> keyGeneratorCurrentNumberKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::KeyGeneratorCurrentNumber); putInt(levelDBTransaction, keyGeneratorCurrentNumberKey, newNumber); + return true; } -bool IDBBackingStore::keyExistsInObjectStore(IDBBackingStore::Transaction* transaction, int64_t databaseId, int64_t objectStoreId, const IDBKey& key, RecordIdentifier* foundRecordIdentifier) +bool IDBBackingStore::keyExistsInObjectStore(IDBBackingStore::Transaction* transaction, int64_t databaseId, int64_t objectStoreId, const IDBKey& key, RecordIdentifier* foundRecordIdentifier, bool& found) { IDB_TRACE("IDBBackingStore::keyExistsInObjectStore"); + found = false; LevelDBTransaction* levelDBTransaction = IDBBackingStore::Transaction::levelDBTransactionFrom(transaction); const Vector<char> leveldbKey = ObjectStoreDataKey::encode(databaseId, objectStoreId, key); Vector<char> data; - if (!levelDBTransaction->get(leveldbKey, data)) + bool ok = levelDBTransaction->safeGet(leveldbKey, data, found); + if (!ok) { + InternalError(IDBLevelDBBackingStoreReadError); return false; + } + if (!found) + return true; int64_t version; if (!decodeVarInt(data.begin(), data.end(), version)) diff --git a/Source/WebCore/Modules/indexeddb/IDBBackingStore.h b/Source/WebCore/Modules/indexeddb/IDBBackingStore.h index f4becb976..4f5596858 100644 --- a/Source/WebCore/Modules/indexeddb/IDBBackingStore.h +++ b/Source/WebCore/Modules/indexeddb/IDBBackingStore.h @@ -81,9 +81,9 @@ public: virtual void putRecord(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, const IDBKey&, const String& value, RecordIdentifier*); virtual void clearObjectStore(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId); virtual void deleteRecord(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, const RecordIdentifier&); - virtual int64_t getKeyGeneratorCurrentNumber(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId); - virtual void maybeUpdateKeyGeneratorCurrentNumber(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t newState, bool checkCurrent); - virtual bool keyExistsInObjectStore(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, const IDBKey&, RecordIdentifier* foundRecordIdentifier); + virtual bool getKeyGeneratorCurrentNumber(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t& currentNumber) WARN_UNUSED_RETURN; + virtual bool maybeUpdateKeyGeneratorCurrentNumber(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t newState, bool checkCurrent) WARN_UNUSED_RETURN; + virtual bool keyExistsInObjectStore(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, const IDBKey&, RecordIdentifier* foundRecordIdentifier, bool& found) WARN_UNUSED_RETURN; virtual Vector<IDBIndexMetadata> getIndexes(int64_t databaseId, int64_t objectStoreId); virtual bool createIndex(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t indexId, const String& name, const IDBKeyPath&, bool isUnique, bool isMultiEntry); diff --git a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp index c90dac224..714aed5da 100644 --- a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp @@ -231,7 +231,14 @@ void IDBObjectStoreBackendImpl::setIndexKeys(PassRefPtr<IDBKey> prpPrimaryKey, c // FIXME: This method could be asynchronous, but we need to evaluate if it's worth the extra complexity. IDBBackingStore::RecordIdentifier recordIdentifier; - if (!backingStore()->keyExistsInObjectStore(transaction->backingStoreTransaction(), databaseId(), id(), *primaryKey, &recordIdentifier)) { + bool found = false; + bool ok = backingStore()->keyExistsInObjectStore(transaction->backingStoreTransaction(), databaseId(), id(), *primaryKey, &recordIdentifier, found); + if (!ok) { + LOG_ERROR("keyExistsInObjectStore reported an error"); + transaction->abort(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "Internal error setting index keys.")); + return; + } + if (!found) { transaction->abort(); return; } @@ -300,9 +307,17 @@ void IDBObjectStoreBackendImpl::putInternal(ScriptExecutionContext*, PassRefPtr< ASSERT(key && key->isValid()); IDBBackingStore::RecordIdentifier recordIdentifier; - if (putMode == AddOnly && objectStore->backingStore()->keyExistsInObjectStore(transaction->backingStoreTransaction(), objectStore->databaseId(), objectStore->id(), *key, &recordIdentifier)) { - callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::CONSTRAINT_ERR, "Key already exists in the object store.")); - return; + if (putMode == AddOnly) { + bool found = false; + bool ok = objectStore->backingStore()->keyExistsInObjectStore(transaction->backingStoreTransaction(), objectStore->databaseId(), objectStore->id(), *key, &recordIdentifier, found); + if (!ok) { + callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "Internal error checking key existence.")); + return; + } + if (found) { + callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::CONSTRAINT_ERR, "Key already exists in the object store.")); + return; + } } Vector<OwnPtr<IndexWriter> > indexWriters; @@ -321,8 +336,13 @@ void IDBObjectStoreBackendImpl::putInternal(ScriptExecutionContext*, PassRefPtr< indexWriter->writeIndexKeys(recordIdentifier, *objectStore->backingStore(), transaction->backingStoreTransaction(), objectStore->databaseId(), objectStore->m_metadata.id); } - if (autoIncrement && putMode != CursorUpdate && key->type() == IDBKey::NumberType) - objectStore->updateKeyGenerator(transaction, key.get(), !keyWasGenerated); + if (autoIncrement && putMode != CursorUpdate && key->type() == IDBKey::NumberType) { + bool ok = objectStore->updateKeyGenerator(transaction, key.get(), !keyWasGenerated); + if (!ok) { + callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "Internal error updating key generator.")); + return; + } + } callbacks->onSuccess(key.release()); } @@ -525,17 +545,22 @@ void IDBObjectStoreBackendImpl::addIndexToMap(ScriptExecutionContext*, PassRefPt PassRefPtr<IDBKey> IDBObjectStoreBackendImpl::generateKey(PassRefPtr<IDBTransactionBackendImpl> transaction) { const int64_t maxGeneratorValue = 9007199254740992LL; // Maximum integer storable as ECMAScript number. - int64_t currentNumber = backingStore()->getKeyGeneratorCurrentNumber(transaction->backingStoreTransaction(), databaseId(), id()); + int64_t currentNumber; + bool ok = backingStore()->getKeyGeneratorCurrentNumber(transaction->backingStoreTransaction(), databaseId(), id(), currentNumber); + if (!ok) { + LOG_ERROR("Failed to getKeyGeneratorCurrentNumber"); + return IDBKey::createInvalid(); + } if (currentNumber < 0 || currentNumber > maxGeneratorValue) return IDBKey::createInvalid(); return IDBKey::createNumber(currentNumber); } -void IDBObjectStoreBackendImpl::updateKeyGenerator(PassRefPtr<IDBTransactionBackendImpl> transaction, const IDBKey* key, bool checkCurrent) +bool IDBObjectStoreBackendImpl::updateKeyGenerator(PassRefPtr<IDBTransactionBackendImpl> transaction, const IDBKey* key, bool checkCurrent) { ASSERT(key && key->type() == IDBKey::NumberType); - backingStore()->maybeUpdateKeyGeneratorCurrentNumber(transaction->backingStoreTransaction(), databaseId(), id(), static_cast<int64_t>(floor(key->number())) + 1, checkCurrent); + return backingStore()->maybeUpdateKeyGeneratorCurrentNumber(transaction->backingStoreTransaction(), databaseId(), id(), static_cast<int64_t>(floor(key->number())) + 1, checkCurrent); } } // namespace WebCore diff --git a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h index cfde3be7b..ae1aa6de0 100644 --- a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h +++ b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h @@ -96,7 +96,7 @@ private: void loadIndexes(); PassRefPtr<IDBKey> generateKey(PassRefPtr<IDBTransactionBackendImpl>); - void updateKeyGenerator(PassRefPtr<IDBTransactionBackendImpl>, const IDBKey*, bool checkCurrent); + bool updateKeyGenerator(PassRefPtr<IDBTransactionBackendImpl>, const IDBKey*, bool checkCurrent); static void getInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendImpl>); static void putInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, PutMode, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendImpl>, PassOwnPtr<Vector<int64_t> > popIndexNames, PassOwnPtr<Vector<IndexKeys> >); diff --git a/Source/WebCore/Modules/speech/SpeechRecognition.cpp b/Source/WebCore/Modules/speech/SpeechRecognition.cpp index 41f498fa9..beda8278f 100644 --- a/Source/WebCore/Modules/speech/SpeechRecognition.cpp +++ b/Source/WebCore/Modules/speech/SpeechRecognition.cpp @@ -54,6 +54,7 @@ void SpeechRecognition::start(ExceptionCode& ec) } setPendingActivity(this); + m_finalResults.clear(); m_controller->start(this, m_grammars.get(), m_lang, m_continuous, m_interimResults, m_maxAlternatives); m_started = true; } @@ -105,6 +106,20 @@ void SpeechRecognition::didReceiveResult(PassRefPtr<SpeechRecognitionResult> res dispatchEvent(SpeechRecognitionEvent::createResult(result, resultIndex, resultHistory)); } +void SpeechRecognition::didReceiveResults(const Vector<RefPtr<SpeechRecognitionResult> >& newFinalResults, const Vector<RefPtr<SpeechRecognitionResult> >& currentInterimResults) +{ + unsigned long resultIndex = m_finalResults.size(); + + for (size_t i = 0; i < newFinalResults.size(); ++i) + m_finalResults.append(newFinalResults[i]); + + Vector<RefPtr<SpeechRecognitionResult> > results = m_finalResults; + for (size_t i = 0; i < currentInterimResults.size(); ++i) + results.append(currentInterimResults[i]); + + dispatchEvent(SpeechRecognitionEvent::createResult(resultIndex, results)); +} + void SpeechRecognition::didReceiveNoMatch(PassRefPtr<SpeechRecognitionResult> result) { dispatchEvent(SpeechRecognitionEvent::createNoMatch(result)); diff --git a/Source/WebCore/Modules/speech/SpeechRecognition.h b/Source/WebCore/Modules/speech/SpeechRecognition.h index b5ca4dd0a..643dda8b8 100644 --- a/Source/WebCore/Modules/speech/SpeechRecognition.h +++ b/Source/WebCore/Modules/speech/SpeechRecognition.h @@ -73,6 +73,8 @@ public: void didEndSpeech(); void didEndSound(); void didEndAudio(); + void didReceiveResults(const Vector<RefPtr<SpeechRecognitionResult> >& newFinalResults, const Vector<RefPtr<SpeechRecognitionResult> >& currentInterimResults); + // FIXME: Remove this once we start using didReceiveResults. void didReceiveResult(PassRefPtr<SpeechRecognitionResult>, unsigned long resultIndex, PassRefPtr<SpeechRecognitionResultList> resultHistory); void didReceiveNoMatch(PassRefPtr<SpeechRecognitionResult>); void didReceiveError(PassRefPtr<SpeechRecognitionError>); @@ -124,6 +126,7 @@ private: SpeechRecognitionController* m_controller; bool m_stoppedByActiveDOMObject; bool m_started; + Vector<RefPtr<SpeechRecognitionResult> > m_finalResults; }; } // namespace WebCore diff --git a/Source/WebCore/Modules/speech/SpeechRecognitionEvent.cpp b/Source/WebCore/Modules/speech/SpeechRecognitionEvent.cpp index e2a8f7a1f..20227db55 100644 --- a/Source/WebCore/Modules/speech/SpeechRecognitionEvent.cpp +++ b/Source/WebCore/Modules/speech/SpeechRecognitionEvent.cpp @@ -29,6 +29,10 @@ #include "SpeechRecognitionEvent.h" +#include "Document.h" +#include "Element.h" +#include "Text.h" + namespace WebCore { SpeechRecognitionEventInit::SpeechRecognitionEventInit() @@ -51,6 +55,11 @@ PassRefPtr<SpeechRecognitionEvent> SpeechRecognitionEvent::createResult(PassRefP return adoptRef(new SpeechRecognitionEvent(eventNames().resultEvent, result, resultIndex, resultHistory)); } +PassRefPtr<SpeechRecognitionEvent> SpeechRecognitionEvent::createResult(unsigned long resultIndex, const Vector<RefPtr<SpeechRecognitionResult> >& results) +{ + return adoptRef(new SpeechRecognitionEvent(eventNames().resultEvent, resultIndex, results)); +} + PassRefPtr<SpeechRecognitionEvent> SpeechRecognitionEvent::createNoMatch(PassRefPtr<SpeechRecognitionResult> result) { return adoptRef(new SpeechRecognitionEvent(eventNames().nomatchEvent, result, 0, 0)); @@ -68,20 +77,80 @@ SpeechRecognitionEvent::SpeechRecognitionEvent() SpeechRecognitionEvent::SpeechRecognitionEvent(const AtomicString& eventName, const SpeechRecognitionEventInit& initializer) : Event(eventName, initializer) - , m_result(initializer.result) , m_resultIndex(initializer.resultIndex) + , m_result(initializer.result) , m_resultHistory(initializer.resultHistory) { } SpeechRecognitionEvent::SpeechRecognitionEvent(const AtomicString& eventName, PassRefPtr<SpeechRecognitionResult> result, short resultIndex, PassRefPtr<SpeechRecognitionResultList> resultHistory) : Event(eventName, /*canBubble=*/false, /*cancelable=*/false) - , m_result(result) , m_resultIndex(resultIndex) + , m_result(result) , m_resultHistory(resultHistory) { } +SpeechRecognitionEvent::SpeechRecognitionEvent(const AtomicString& eventName, unsigned long resultIndex, const Vector<RefPtr<SpeechRecognitionResult> >& results) + : Event(eventName, /*canBubble=*/false, /*cancelable=*/false) + , m_resultIndex(resultIndex) + , m_results(SpeechRecognitionResultList::create(results)) +{ +} + +SpeechRecognitionEvent::~SpeechRecognitionEvent() +{ +} + +static QualifiedName emmaQualifiedName(const char* localName) +{ + const char emmaNamespaceUrl[] = "http://www.w3.org/2003/04/emma"; + return QualifiedName("emma", localName, emmaNamespaceUrl); +} + +Document* SpeechRecognitionEvent::emma() +{ + if (m_emma) + return m_emma.get(); + + RefPtr<Document> document = Document::create(0, KURL()); + + for (size_t i = 0; i < m_results->length(); ++i) { + RefPtr<SpeechRecognitionResult> result = m_results->item(0); + + RefPtr<Element> emmaElement = document->createElement(emmaQualifiedName("emma"), false); + ExceptionCode ec = 0; + emmaElement->setAttribute("version", "1.0", ec); + ASSERT(!ec); + if (ec) + return 0; + + RefPtr<Element> oneOf = document->createElement(emmaQualifiedName("one-of"), false); + oneOf->setAttribute(emmaQualifiedName("medium"), "acoustic"); + oneOf->setAttribute(emmaQualifiedName("mode"), "voice"); + oneOf->setIdAttribute("one-of"); + + for (size_t i = 0; i < result->length(); ++i) { + const RefPtr<SpeechRecognitionAlternative>& alternative = result->item(i); + + RefPtr<Element> interpretation = document->createElement(emmaQualifiedName("interpretation"), false); + interpretation->setIdAttribute(String::number(i + 1)); + interpretation->setAttribute(emmaQualifiedName("confidence"), String::number(alternative->confidence())); + + RefPtr<Element> literal = document->createElement(emmaQualifiedName("literal"), false); + literal->appendChild(document->createTextNode(alternative->transcript())); + interpretation->appendChild(literal.release()); + oneOf->appendChild(interpretation.release()); + } + + emmaElement->appendChild(oneOf.release()); + document->appendChild(emmaElement.release()); + } + + m_emma = document; + return m_emma.get(); +} + } // namespace WebCore #endif // ENABLE(SCRIPTED_SPEECH) diff --git a/Source/WebCore/Modules/speech/SpeechRecognitionEvent.h b/Source/WebCore/Modules/speech/SpeechRecognitionEvent.h index d445c3a8d..6a616a7d5 100644 --- a/Source/WebCore/Modules/speech/SpeechRecognitionEvent.h +++ b/Source/WebCore/Modules/speech/SpeechRecognitionEvent.h @@ -36,6 +36,7 @@ namespace WebCore { +class Document; class SpeechRecognitionError; class SpeechRecognitionResult; class SpeechRecognitionResultList; @@ -43,21 +44,32 @@ class SpeechRecognitionResultList; struct SpeechRecognitionEventInit : public EventInit { SpeechRecognitionEventInit(); + // DEPRECATED RefPtr<SpeechRecognitionResult> result; - short resultIndex; RefPtr<SpeechRecognitionResultList> resultHistory; + + short resultIndex; + RefPtr<SpeechRecognitionResultList> results; }; class SpeechRecognitionEvent : public Event { public: static PassRefPtr<SpeechRecognitionEvent> create(); static PassRefPtr<SpeechRecognitionEvent> create(const AtomicString&, const SpeechRecognitionEventInit&); + virtual ~SpeechRecognitionEvent(); + // DEPRECATED static PassRefPtr<SpeechRecognitionEvent> createResult(PassRefPtr<SpeechRecognitionResult>, short resultIndex, PassRefPtr<SpeechRecognitionResultList> resultHistory); + + static PassRefPtr<SpeechRecognitionEvent> createResult(unsigned long resultIndex, const Vector<RefPtr<SpeechRecognitionResult> >& results); static PassRefPtr<SpeechRecognitionEvent> createNoMatch(PassRefPtr<SpeechRecognitionResult>); + unsigned long resultIndex() const { return m_resultIndex; } + SpeechRecognitionResultList* results() const { return m_results.get(); } + Document* emma(); + + // DEPRECATED SpeechRecognitionResult* result() const { return m_result.get(); } - short resultIndex() const { return m_resultIndex; } // FIXME: Spec says this should be short, but other indices are unsigned ints. SpeechRecognitionResultList* resultHistory() const { return m_resultHistory.get(); } // Event @@ -66,11 +78,16 @@ public: private: SpeechRecognitionEvent(); SpeechRecognitionEvent(const AtomicString&, const SpeechRecognitionEventInit&); - SpeechRecognitionEvent(const AtomicString& eventName, PassRefPtr<SpeechRecognitionResult>, short resultIndex, PassRefPtr<SpeechRecognitionResultList> resultHistory); + SpeechRecognitionEvent(const AtomicString& eventName, PassRefPtr<SpeechRecognitionResult>, short resultIndex, PassRefPtr<SpeechRecognitionResultList> resultHistory); // FIXME: Remove. + SpeechRecognitionEvent(const AtomicString& eventName, unsigned long resultIndex, const Vector<RefPtr<SpeechRecognitionResult> >& results); explicit SpeechRecognitionEvent(PassRefPtr<SpeechRecognitionError>); + unsigned long m_resultIndex; + RefPtr<SpeechRecognitionResultList> m_results; + RefPtr<Document> m_emma; + + // DEPRECATED RefPtr<SpeechRecognitionResult> m_result; - short m_resultIndex; RefPtr<SpeechRecognitionResultList> m_resultHistory; }; diff --git a/Source/WebCore/Modules/speech/SpeechRecognitionEvent.idl b/Source/WebCore/Modules/speech/SpeechRecognitionEvent.idl index 8eb789c0c..592d21bd9 100644 --- a/Source/WebCore/Modules/speech/SpeechRecognitionEvent.idl +++ b/Source/WebCore/Modules/speech/SpeechRecognitionEvent.idl @@ -25,9 +25,15 @@ [ Conditional=SCRIPTED_SPEECH, - ConstructorTemplate=Event + ConstructorTemplate=Event, + CustomIsReachable, + V8DependentLifetime ] interface SpeechRecognitionEvent : Event { + // DEPRECATED [InitializedByEventConstructor] readonly attribute SpeechRecognitionResult result; - [InitializedByEventConstructor] readonly attribute short resultIndex; [InitializedByEventConstructor] readonly attribute SpeechRecognitionResultList resultHistory; + + [InitializedByEventConstructor] readonly attribute short resultIndex; + [InitializedByEventConstructor] readonly attribute SpeechRecognitionResultList results; + readonly attribute Document emma; }; diff --git a/Source/WebCore/Modules/speech/SpeechRecognitionResult.cpp b/Source/WebCore/Modules/speech/SpeechRecognitionResult.cpp index d54f2bf74..9248744ef 100644 --- a/Source/WebCore/Modules/speech/SpeechRecognitionResult.cpp +++ b/Source/WebCore/Modules/speech/SpeechRecognitionResult.cpp @@ -29,10 +29,6 @@ #include "SpeechRecognitionResult.h" -#include "Document.h" -#include "Element.h" -#include "Text.h" - namespace WebCore { SpeechRecognitionResult::~SpeechRecognitionResult() @@ -52,51 +48,6 @@ SpeechRecognitionAlternative* SpeechRecognitionResult::item(unsigned long index) return m_alternatives[index].get(); } -static QualifiedName emmaQualifiedName(const char* localName) -{ - const char emmaNamespaceUrl[] = "http://www.w3.org/2003/04/emma"; - return QualifiedName("emma", localName, emmaNamespaceUrl); -} - -Document* SpeechRecognitionResult::emma() -{ - if (m_emma) - return m_emma.get(); - - RefPtr<Document> document = Document::create(0, KURL()); - - RefPtr<Element> emmaElement = document->createElement(emmaQualifiedName("emma"), false); - ExceptionCode ec = 0; - emmaElement->setAttribute("version", "1.0", ec); - ASSERT(!ec); - if (ec) - return 0; - - RefPtr<Element> oneOf = document->createElement(emmaQualifiedName("one-of"), false); - oneOf->setAttribute(emmaQualifiedName("medium"), "acoustic"); - oneOf->setAttribute(emmaQualifiedName("mode"), "voice"); - oneOf->setIdAttribute("one-of"); - - for (size_t i = 0; i < m_alternatives.size(); ++i) { - const RefPtr<SpeechRecognitionAlternative>& alternative = m_alternatives[i]; - - RefPtr<Element> interpretation = document->createElement(emmaQualifiedName("interpretation"), false); - interpretation->setIdAttribute(String::number(i + 1)); - interpretation->setAttribute(emmaQualifiedName("confidence"), String::number(alternative->confidence())); - - RefPtr<Element> literal = document->createElement(emmaQualifiedName("literal"), false); - literal->appendChild(document->createTextNode(alternative->transcript())); - interpretation->appendChild(literal.release()); - oneOf->appendChild(interpretation.release()); - } - - emmaElement->appendChild(oneOf.release()); - document->appendChild(emmaElement.release()); - - m_emma = document; - return m_emma.get(); -} - SpeechRecognitionResult::SpeechRecognitionResult(const Vector<RefPtr<SpeechRecognitionAlternative> >& alternatives, bool final) : m_alternatives(alternatives) , m_final(final) diff --git a/Source/WebCore/Modules/speech/SpeechRecognitionResult.h b/Source/WebCore/Modules/speech/SpeechRecognitionResult.h index 18f76e147..74cc7b309 100644 --- a/Source/WebCore/Modules/speech/SpeechRecognitionResult.h +++ b/Source/WebCore/Modules/speech/SpeechRecognitionResult.h @@ -34,8 +34,6 @@ namespace WebCore { -class Document; - class SpeechRecognitionResult : public RefCounted<SpeechRecognitionResult> { public: ~SpeechRecognitionResult(); @@ -43,15 +41,13 @@ public: unsigned long length() { return m_alternatives.size(); } SpeechRecognitionAlternative* item(unsigned long index); - bool final() { return m_final; } - Document* emma(); + bool isFinal() { return m_final; } private: SpeechRecognitionResult(const Vector<RefPtr<SpeechRecognitionAlternative> >&, bool final); Vector<RefPtr<SpeechRecognitionAlternative> > m_alternatives; bool m_final; - RefPtr<Document> m_emma; }; } // namespace WebCore diff --git a/Source/WebCore/Modules/speech/SpeechRecognitionResult.idl b/Source/WebCore/Modules/speech/SpeechRecognitionResult.idl index 609d6ea87..b749aed77 100644 --- a/Source/WebCore/Modules/speech/SpeechRecognitionResult.idl +++ b/Source/WebCore/Modules/speech/SpeechRecognitionResult.idl @@ -25,12 +25,9 @@ [ Conditional=SCRIPTED_SPEECH, - CustomIsReachable, - IndexedGetter, - V8DependentLifetime + IndexedGetter ] interface SpeechRecognitionResult { readonly attribute unsigned long length; SpeechRecognitionAlternative item(in [IsIndex] unsigned long index); - readonly attribute boolean final; - readonly attribute Document emma; + readonly attribute boolean isFinal; }; diff --git a/Source/WebCore/PlatformEfl.cmake b/Source/WebCore/PlatformEfl.cmake index 31e4c87df..01f7d39bd 100644 --- a/Source/WebCore/PlatformEfl.cmake +++ b/Source/WebCore/PlatformEfl.cmake @@ -297,6 +297,11 @@ IF (WTF_USE_3D_GRAPHICS) platform/graphics/texmap/TextureMapperGL.cpp platform/graphics/texmap/TextureMapperShaderManager.cpp ) + LIST(APPEND WebCore_LIBRARIES + ${X11_X11_LIB} + ${X11_Xcomposite_LIB} + ${X11_Xrender_LIB} + ) ENDIF () ADD_DEFINITIONS(-DDATA_DIR="${CMAKE_INSTALL_PREFIX}/${DATA_INSTALL_DIR}") diff --git a/Source/WebCore/Target.pri b/Source/WebCore/Target.pri index c57d58b20..4535a46bf 100644 --- a/Source/WebCore/Target.pri +++ b/Source/WebCore/Target.pri @@ -690,6 +690,7 @@ SOURCES += \ html/TextFieldInputType.cpp \ html/TextInputType.cpp \ html/TimeInputType.cpp \ + html/TypeAhead.cpp \ html/URLInputType.cpp \ html/ValidationMessage.cpp \ html/ValidityState.cpp \ @@ -1844,6 +1845,7 @@ HEADERS += \ html/StepRange.h \ html/TextDocument.h \ html/TimeRanges.h \ + html/TypeAhead.h \ html/ValidityState.h \ html/parser/CSSPreloadScanner.h \ html/parser/HTMLConstructionSite.h \ @@ -2476,6 +2478,7 @@ HEADERS += \ rendering/style/StyleTransformData.h \ rendering/style/StyleVariableData.h \ rendering/style/StyleVisualData.h \ + rendering/style/GridTrackSize.h \ rendering/style/SVGRenderStyleDefs.h \ rendering/style/SVGRenderStyle.h \ rendering/svg/RenderSVGBlock.h \ @@ -2854,7 +2857,6 @@ SOURCES += \ platform/qt/PasteboardQt.cpp \ platform/qt/PlatformKeyboardEventQt.cpp \ platform/qt/PlatformScreenQt.cpp \ - platform/qt/QStyleFacade.cpp \ platform/qt/RenderThemeQStyle.cpp \ platform/qt/RenderThemeQt.cpp \ platform/qt/RenderThemeQtMobile.cpp \ diff --git a/Source/WebCore/WebCore.exp.in b/Source/WebCore/WebCore.exp.in index af91d3d95..1d5e9b79e 100644 --- a/Source/WebCore/WebCore.exp.in +++ b/Source/WebCore/WebCore.exp.in @@ -206,6 +206,7 @@ __ZN7WebCore12TextIteratorD1Ev __ZN7WebCore12cacheStorageEv __ZN7WebCore12createMarkupEPKNS_4NodeENS_13EChildrenOnlyEPN3WTF6VectorIPS0_Lm0EEENS_13EAbsoluteURLsEPNS5_INS_13QualifiedNameELm0EEE __ZN7WebCore12createMarkupEPKNS_5RangeEPN3WTF6VectorIPNS_4NodeELm0EEENS_23EAnnotateForInterchangeEbNS_13EAbsoluteURLsE +__ZN7WebCore12deleteCookieEPNS_17NetworkingContextERKNS_4KURLERKN3WTF6StringE __ZN7WebCore12gcControllerEv __ZN7WebCore12iconDatabaseEv __ZN7WebCore13AXObjectCache10rootObjectEv @@ -231,8 +232,10 @@ __ZN7WebCore13ResourceErrorC1EP7NSError __ZN7WebCore13ResourceErrorC1EP9__CFError __ZN7WebCore13StyledElement22setInlineStylePropertyENS_13CSSPropertyIDERKN3WTF6StringEb __ZN7WebCore13StyledElement22setInlineStylePropertyENS_13CSSPropertyIDEdNS_17CSSPrimitiveValue9UnitTypesEb +__ZN7WebCore13cookiesForDOMEPNS_17NetworkingContextERKNS_4KURLES4_ __ZN7WebCore13createWrapperEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_4NodeE __ZN7WebCore13directoryNameERKN3WTF6StringE +__ZN7WebCore13getRawCookiesEPNS_17NetworkingContextERKNS_4KURLES4_RN3WTF6VectorINS_6CookieELm0EEE __ZN7WebCore13toArrayBufferEN3JSC7JSValueE __ZN7WebCore13toHTMLElementEPNS_21FormAssociatedElementE __ZN7WebCore13toJSDOMWindowEN3JSC7JSValueE @@ -279,6 +282,7 @@ __ZN7WebCore14FrameSelection9selectAllEv __ZN7WebCore14FrameSelectionC1EPNS_5FrameE __ZN7WebCore14LoaderStrategy21resourceLoadSchedulerEv __ZN7WebCore14PluginDocument10pluginNodeEv +__ZN7WebCore14cookiesEnabledEPNS_17NetworkingContextERKNS_4KURLES4_ __ZNK7WebCore5Frame25trackedRepaintRectsAsTextEv __ZN7WebCore9FrameView17setTracksRepaintsEb __ZN7WebCore9FrameView20resetTrackedRepaintsEv @@ -480,6 +484,7 @@ __ZN7WebCore16VisibleSelectionC1ERKNS_15VisiblePositionES3_b __ZN7WebCore16VisibleSelectionC1ERKNS_15VisiblePositionEb __ZN7WebCore16createFullMarkupEPKNS_4NodeE __ZN7WebCore16createFullMarkupEPKNS_5RangeE +__ZN7WebCore16deleteAllCookiesEPNS_17NetworkingContextE __ZN7WebCore16deleteAllCookiesEv __ZN7WebCore16enclosingIntRectERKNS_9FloatRectE __ZN7WebCore16isEndOfParagraphERKNS_15VisiblePositionENS_27EditingBoundaryCrossingRuleE @@ -503,6 +508,7 @@ __ZN7WebCore17SubresourceLoader6createEPNS_5FrameEPNS_14CachedResourceERKNS_15Re __ZN7WebCore17ViewportArguments19deprecatedTargetDPIE __ZN7WebCore17cacheDOMStructureEPNS_17JSDOMGlobalObjectEPN3JSC9StructureEPKNS2_9ClassInfoE __ZN7WebCore17openTemporaryFileERKN3WTF6StringERi +__ZN7WebCore17setCookiesFromDOMEPNS_17NetworkingContextERKNS_4KURLES4_RKN3WTF6StringE __ZN7WebCore17userVisibleStringEP5NSURL __ZN7WebCore18DOMWindowExtensionC1EPNS_5FrameEPNS_15DOMWrapperWorldE __ZN7WebCore18HTMLContentElement6createEPNS_8DocumentE @@ -642,6 +648,7 @@ __ZN7WebCore23createFragmentFromNodesEPNS_8DocumentERKN3WTF6VectorIPNS_4NodeELm0 __ZN7WebCore23dataForURLComponentTypeEP5NSURLl __ZN7WebCore23decodeHostNameWithRangeEP8NSString8_NSRange __ZN7WebCore23encodeHostNameWithRangeEP8NSString8_NSRange +__ZN7WebCore23getHostnamesWithCookiesEPNS_17NetworkingContextERN3WTF7HashSetINS2_6StringENS2_10StringHashENS2_10HashTraitsIS4_EEEE __ZN7WebCore23getHostnamesWithCookiesERN3WTF7HashSetINS0_6StringENS0_10StringHashENS0_10HashTraitsIS2_EEEE __ZN7WebCore24BinaryPropertyListWriter17writePropertyListEv __ZN7WebCore24CachedResourceHandleBase11setResourceEPNS_14CachedResourceE @@ -661,6 +668,7 @@ __ZN7WebCore24FrameDestructionObserverC2EPNS_5FrameE __ZN7WebCore24FrameDestructionObserverD2Ev __ZN7WebCore24createFragmentFromMarkupEPNS_8DocumentERKN3WTF6StringES5_NS_27FragmentScriptingPermissionE __ZN7WebCore24decodeURLEscapeSequencesERKN3WTF6StringE +__ZN7WebCore24deleteCookiesForHostnameEPNS_17NetworkingContextERKN3WTF6StringE __ZN7WebCore24deleteCookiesForHostnameERKN3WTF6StringE __ZN7WebCore24fileSystemRepresentationERKN3WTF6StringE __ZN7WebCore24notifyHistoryItemChangedE @@ -690,6 +698,7 @@ __ZN7WebCore27startObservingCookieChangesEv __ZN7WebCore26defaultCFHTTPCookieStorageEv __ZN7WebCore28encodeWithURLEscapeSequencesERKN3WTF6StringE __ZN7WebCore28removeLanguageChangeObserverEPv +__ZN7WebCore29cookieRequestHeaderFieldValueEPNS_17NetworkingContextERKNS_4KURLES4_ __ZN7WebCore29isCharacterSmartReplaceExemptEib __ZN7WebCore30hostNameNeedsDecodingWithRangeEP8NSString8_NSRange __ZN7WebCore30hostNameNeedsEncodingWithRangeEP8NSString8_NSRange @@ -2686,3 +2695,7 @@ _wkCaptionAppearanceGetRelativeCharacterSize _wkCaptionAppearanceGetTextEdgeStyle _wkCaptionAppearanceGetSettingsChangedNotification #endif + +#if ENABLE(CSS_REGIONS) +__ZN7WebCore22RuntimeEnabledFeatures19isCSSRegionsEnabledE +#endif diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi index d95a17d8d..5963846a2 100644 --- a/Source/WebCore/WebCore.gypi +++ b/Source/WebCore/WebCore.gypi @@ -628,6 +628,7 @@ 'rendering/style/StyleTransformData.h', 'rendering/style/StyleVariableData.h', 'rendering/style/StyleVisualData.h', + 'rendering/style/GridTrackSize.h', 'rendering/svg/SVGResourcesCache.h', 'workers/SharedWorkerStrategy.h', 'workers/WorkerRunLoop.h', @@ -2429,7 +2430,7 @@ 'bindings/v8/custom/V8SVGPathSegCustom.cpp', 'bindings/v8/custom/V8ScriptProfileCustom.cpp', 'bindings/v8/custom/V8ScriptProfileNodeCustom.cpp', - 'bindings/v8/custom/V8SpeechRecognitionResultCustom.cpp', + 'bindings/v8/custom/V8SpeechRecognitionEventCustom.cpp', 'bindings/v8/custom/V8StorageCustom.cpp', 'bindings/v8/custom/V8StyleSheetCustom.cpp', 'bindings/v8/custom/V8StyleSheetListCustom.cpp', @@ -4265,6 +4266,8 @@ 'html/ValidityState.h', 'html/WeekInputType.cpp', 'html/WeekInputType.h', + 'html/TypeAhead.cpp', + 'html/TypeAhead.h', 'html/canvas/CanvasContextAttributes.cpp', 'html/canvas/CanvasContextAttributes.h', 'html/canvas/CanvasGradient.cpp', diff --git a/Source/WebCore/WebCore.vcproj/WebCore.vcproj b/Source/WebCore/WebCore.vcproj/WebCore.vcproj index f055d22ea..d7106e1b7 100755 --- a/Source/WebCore/WebCore.vcproj/WebCore.vcproj +++ b/Source/WebCore/WebCore.vcproj/WebCore.vcproj @@ -46851,6 +46851,10 @@ >
</File>
<File
+ RelativePath="..\rendering\style\GridTrackSize.h"
+ >
+ </File>
+ <File
RelativePath="..\rendering\style\SVGRenderStyle.cpp"
>
<FileConfiguration
@@ -63989,6 +63993,14 @@ RelativePath="..\html\TimeRanges.h"
>
</File>
+ <File
+ RelativePath="..\html\TypeAhead.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\TypeAhead.h"
+ >
+ </File>
<File
RelativePath="..\html\URLInputType.cpp"
>
diff --git a/Source/WebCore/WebCore.vcproj/copyForwardingHeaders.cmd b/Source/WebCore/WebCore.vcproj/copyForwardingHeaders.cmd index 754a57fd0..b8365a191 100755 --- a/Source/WebCore/WebCore.vcproj/copyForwardingHeaders.cmd +++ b/Source/WebCore/WebCore.vcproj/copyForwardingHeaders.cmd @@ -63,6 +63,7 @@ xcopy /y /d "%ProjectDir%..\platform\network\%2\*.h" "%CONFIGURATIONBUILDDIR%\in xcopy /y /d "%ProjectDir%..\platform\sql\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" xcopy /y /d "%ProjectDir%..\platform\cairo\cairo\src\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" xcopy /y /d "%ProjectDir%..\bindings\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" +xcopy /y /d "%ProjectDir%..\bindings\generic\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" xcopy /y /d "%ProjectDir%..\bindings\js\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" xcopy /y /d "%ProjectDir%..\page\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" xcopy /y /d "%ProjectDir%..\page\animation\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj index b2d5756cc..3404cc15e 100644 --- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj +++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj @@ -3151,7 +3151,7 @@ 8C0E334E138A92C7008DA94F /* LevelDBWriteBatch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8C0E334A138A92C7008DA94F /* LevelDBWriteBatch.cpp */; }; 8C0E334F138A92C7008DA94F /* LevelDBWriteBatch.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C0E334B138A92C7008DA94F /* LevelDBWriteBatch.h */; }; 8C6EA61911EF7E0400FD8EE3 /* RuntimeEnabledFeatures.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8C6EA61711EF7E0400FD8EE3 /* RuntimeEnabledFeatures.cpp */; }; - 8C6EA61A11EF7E0400FD8EE3 /* RuntimeEnabledFeatures.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C6EA61811EF7E0400FD8EE3 /* RuntimeEnabledFeatures.h */; }; + 8C6EA61A11EF7E0400FD8EE3 /* RuntimeEnabledFeatures.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C6EA61811EF7E0400FD8EE3 /* RuntimeEnabledFeatures.h */; settings = {ATTRIBUTES = (Private, ); }; }; 8CADF2A9135C7B36009EF43F /* LevelDBComparator.h in Headers */ = {isa = PBXBuildFile; fileRef = 8CADF2A3135C7B36009EF43F /* LevelDBComparator.h */; }; 8CADF2AA135C7B36009EF43F /* LevelDBDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8CADF2A4135C7B36009EF43F /* LevelDBDatabase.cpp */; }; 8CADF2AB135C7B36009EF43F /* LevelDBDatabase.h in Headers */ = {isa = PBXBuildFile; fileRef = 8CADF2A5135C7B36009EF43F /* LevelDBDatabase.h */; }; @@ -3430,6 +3430,8 @@ 93F1D5C112D5335600832BEC /* JSWebGLLoseContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 93F1D5BF12D5335600832BEC /* JSWebGLLoseContext.h */; }; 93F6F1ED127F70B10055CB06 /* WebGLContextEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93F6F1EA127F70B10055CB06 /* WebGLContextEvent.cpp */; }; 93F6F1EE127F70B10055CB06 /* WebGLContextEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 93F6F1EB127F70B10055CB06 /* WebGLContextEvent.h */; }; + 93F72AF31666EDFC002A02BD /* LayerPool.h in Headers */ = {isa = PBXBuildFile; fileRef = 93F72AF11666EDFC002A02BD /* LayerPool.h */; }; + 93F72AF41666EDFC002A02BD /* LayerPool.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93F72AF21666EDFC002A02BD /* LayerPool.mm */; }; 93F925430F7EF5B8007E37C9 /* CheckedRadioButtons.h in Headers */ = {isa = PBXBuildFile; fileRef = 93F925410F7EF5B8007E37C9 /* CheckedRadioButtons.h */; settings = {ATTRIBUTES = (Private, ); }; }; 93F925440F7EF5B8007E37C9 /* CheckedRadioButtons.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93F925420F7EF5B8007E37C9 /* CheckedRadioButtons.cpp */; }; 93F9B6570BA0F35E00854064 /* DOMHTMLCanvasElement.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93F9B6540BA0F35E00854064 /* DOMHTMLCanvasElement.mm */; }; @@ -3821,6 +3823,7 @@ A120ACA413F998CA00FE4AC7 /* LayoutRepainter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A120ACA113F9984600FE4AC7 /* LayoutRepainter.cpp */; }; A12538D413F9B60A00024754 /* LayoutRepainter.h in Headers */ = {isa = PBXBuildFile; fileRef = A120ACA013F9983700FE4AC7 /* LayoutRepainter.h */; settings = {ATTRIBUTES = (Private, ); }; }; A12705C31656BD6500C2E27C /* GridPosition.h in Headers */ = {isa = PBXBuildFile; fileRef = A12705C21656BD6500C2E27C /* GridPosition.h */; settings = {ATTRIBUTES = (Private, ); }; }; + A12A1050166444FD008FA311 /* GridTrackSize.h in Headers */ = {isa = PBXBuildFile; fileRef = A12A104E166444DC008FA311 /* GridTrackSize.h */; settings = {ATTRIBUTES = (Private, ); }; }; A136A00C1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A136A00A1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.cpp */; }; A136A00D1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.h in Headers */ = {isa = PBXBuildFile; fileRef = A136A00B1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.h */; }; A17C81220F2A5CF7005DAAEB /* HTMLElementFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A17C81200F2A5CF7005DAAEB /* HTMLElementFactory.cpp */; }; @@ -5831,6 +5834,8 @@ C33EE5C514FB49610002095A /* BaseClickableWithKeyInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = C33EE5C314FB49610002095A /* BaseClickableWithKeyInputType.h */; }; C348612315FDE21E007A1CC9 /* InputTypeNames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C348612115FDE21E007A1CC9 /* InputTypeNames.cpp */; }; C348612415FDE21E007A1CC9 /* InputTypeNames.h in Headers */ = {isa = PBXBuildFile; fileRef = C348612215FDE21E007A1CC9 /* InputTypeNames.h */; }; + C375D7FD16639519006184AB /* TypeAhead.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C375D7FB16639519006184AB /* TypeAhead.cpp */; }; + C375D7FE16639519006184AB /* TypeAhead.h in Headers */ = {isa = PBXBuildFile; fileRef = C375D7FC16639519006184AB /* TypeAhead.h */; settings = {ATTRIBUTES = (Private, ); }; }; C37CDEBD149EF2030042090D /* ColorChooserClient.h in Headers */ = {isa = PBXBuildFile; fileRef = C37CDEBC149EF2030042090D /* ColorChooserClient.h */; settings = {ATTRIBUTES = (Private, ); }; }; C3CF17A415B0063F00276D39 /* IdTargetObserver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C3CF17A015B0063F00276D39 /* IdTargetObserver.cpp */; }; C3CF17A515B0063F00276D39 /* IdTargetObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = C3CF17A115B0063F00276D39 /* IdTargetObserver.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -5928,10 +5933,10 @@ CDB859F7160D48A400E5B07F /* MediaKeyEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDB859F4160D489900E5B07F /* MediaKeyEvent.cpp */; }; CDB859FA160D494900E5B07F /* JSMediaKeyEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDB859F8160D493E00E5B07F /* JSMediaKeyEvent.cpp */; }; CDB859FB160D494F00E5B07F /* JSMediaKeyError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDB859F0160D42DD00E5B07F /* JSMediaKeyError.cpp */; }; - CDC69DDA16371FD4007C38DF /* WebCoreFullScreenPlaceholderView.h in Headers */ = {isa = PBXBuildFile; fileRef = CDC69DD816371FD3007C38DF /* WebCoreFullScreenPlaceholderView.h */; settings = {ATTRIBUTES = (Private, ); }; }; - CDC69DDB16371FD4007C38DF /* WebCoreFullScreenPlaceholderView.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDC69DD916371FD3007C38DF /* WebCoreFullScreenPlaceholderView.mm */; }; CDC69DD61632026C007C38DF /* WebCoreFullScreenWarningView.h in Headers */ = {isa = PBXBuildFile; fileRef = CDC69DD41632026C007C38DF /* WebCoreFullScreenWarningView.h */; settings = {ATTRIBUTES = (Private, ); }; }; CDC69DD71632026C007C38DF /* WebCoreFullScreenWarningView.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDC69DD51632026C007C38DF /* WebCoreFullScreenWarningView.mm */; }; + CDC69DDA16371FD4007C38DF /* WebCoreFullScreenPlaceholderView.h in Headers */ = {isa = PBXBuildFile; fileRef = CDC69DD816371FD3007C38DF /* WebCoreFullScreenPlaceholderView.h */; settings = {ATTRIBUTES = (Private, ); }; }; + CDC69DDB16371FD4007C38DF /* WebCoreFullScreenPlaceholderView.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDC69DD916371FD3007C38DF /* WebCoreFullScreenPlaceholderView.mm */; }; CDD525D7145B6DD0008D204D /* JSHTMLMediaElementCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDF65CCC145B6AFE00C4C7AA /* JSHTMLMediaElementCustom.cpp */; }; CDEA763014608A53008B31F1 /* PlatformClockCA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDEA762E146084DE008B31F1 /* PlatformClockCA.cpp */; }; CDEA76341460B56F008B31F1 /* ClockGeneric.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDEA76321460AE29008B31F1 /* ClockGeneric.cpp */; }; @@ -6075,7 +6080,7 @@ E139866315478474001E3F65 /* StyleResolver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E139866115478474001E3F65 /* StyleResolver.cpp */; }; E139866415478474001E3F65 /* StyleResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = E139866215478474001E3F65 /* StyleResolver.h */; }; E13F01F11270E19000DFBA71 /* CookieStorageMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = E13F01F01270E19000DFBA71 /* CookieStorageMac.mm */; }; - E1424C8A164B3B4E00F32D40 /* PlatformCookieJar.h in Headers */ = {isa = PBXBuildFile; fileRef = E1424C89164B3B4E00F32D40 /* PlatformCookieJar.h */; }; + E1424C8A164B3B4E00F32D40 /* PlatformCookieJar.h in Headers */ = {isa = PBXBuildFile; fileRef = E1424C89164B3B4E00F32D40 /* PlatformCookieJar.h */; settings = {ATTRIBUTES = (Private, ); }; }; E1424C90164B460B00F32D40 /* CookieJarMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1424C8F164B460B00F32D40 /* CookieJarMac.mm */; }; E1424C93164B52C800F32D40 /* CookieJar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1424C91164B52C800F32D40 /* CookieJar.cpp */; }; E1424C94164B52C800F32D40 /* CookieJar.h in Headers */ = {isa = PBXBuildFile; fileRef = E1424C92164B52C800F32D40 /* CookieJar.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -10684,6 +10689,8 @@ 93F6F1EA127F70B10055CB06 /* WebGLContextEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebGLContextEvent.cpp; path = canvas/WebGLContextEvent.cpp; sourceTree = "<group>"; }; 93F6F1EB127F70B10055CB06 /* WebGLContextEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLContextEvent.h; path = canvas/WebGLContextEvent.h; sourceTree = "<group>"; }; 93F6F1EC127F70B10055CB06 /* WebGLContextEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = WebGLContextEvent.idl; path = canvas/WebGLContextEvent.idl; sourceTree = "<group>"; }; + 93F72AF11666EDFC002A02BD /* LayerPool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LayerPool.h; path = ca/mac/LayerPool.h; sourceTree = "<group>"; }; + 93F72AF21666EDFC002A02BD /* LayerPool.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = LayerPool.mm; path = ca/mac/LayerPool.mm; sourceTree = "<group>"; }; 93F8B3050A300FE100F61AB8 /* CodeGenerator.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; name = CodeGenerator.pm; path = scripts/CodeGenerator.pm; sourceTree = "<group>"; }; 93F8B3060A300FEA00F61AB8 /* CodeGeneratorJS.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; name = CodeGeneratorJS.pm; path = ../scripts/CodeGeneratorJS.pm; sourceTree = "<group>"; wrapsLines = 0; }; 93F8B3070A300FEA00F61AB8 /* generate-bindings.pl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; name = "generate-bindings.pl"; path = "scripts/generate-bindings.pl"; sourceTree = "<group>"; }; @@ -11136,6 +11143,7 @@ A120ACA013F9983700FE4AC7 /* LayoutRepainter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayoutRepainter.h; sourceTree = "<group>"; }; A120ACA113F9984600FE4AC7 /* LayoutRepainter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutRepainter.cpp; sourceTree = "<group>"; }; A12705C21656BD6500C2E27C /* GridPosition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GridPosition.h; path = style/GridPosition.h; sourceTree = "<group>"; }; + A12A104E166444DC008FA311 /* GridTrackSize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GridTrackSize.h; path = style/GridTrackSize.h; sourceTree = "<group>"; }; A136A00A1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLHttpRequestProgressEventThrottle.cpp; sourceTree = "<group>"; }; A136A00B1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XMLHttpRequestProgressEventThrottle.h; sourceTree = "<group>"; }; A17C81200F2A5CF7005DAAEB /* HTMLElementFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLElementFactory.cpp; sourceTree = "<group>"; }; @@ -13239,6 +13247,8 @@ C33EE5C314FB49610002095A /* BaseClickableWithKeyInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseClickableWithKeyInputType.h; sourceTree = "<group>"; }; C348612115FDE21E007A1CC9 /* InputTypeNames.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InputTypeNames.cpp; sourceTree = "<group>"; }; C348612215FDE21E007A1CC9 /* InputTypeNames.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InputTypeNames.h; sourceTree = "<group>"; }; + C375D7FB16639519006184AB /* TypeAhead.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TypeAhead.cpp; sourceTree = "<group>"; }; + C375D7FC16639519006184AB /* TypeAhead.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TypeAhead.h; sourceTree = "<group>"; }; C37CDEBC149EF2030042090D /* ColorChooserClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ColorChooserClient.h; sourceTree = "<group>"; }; C3CF17A015B0063F00276D39 /* IdTargetObserver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IdTargetObserver.cpp; sourceTree = "<group>"; }; C3CF17A115B0063F00276D39 /* IdTargetObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IdTargetObserver.h; sourceTree = "<group>"; }; @@ -13356,10 +13366,10 @@ CDB859F8160D493E00E5B07F /* JSMediaKeyEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaKeyEvent.cpp; sourceTree = "<group>"; }; CDB859F9160D493E00E5B07F /* JSMediaKeyEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMediaKeyEvent.h; sourceTree = "<group>"; }; CDBD93BA1333BD4B002570E3 /* fullscreenQuickTime.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = fullscreenQuickTime.css; sourceTree = "<group>"; }; - CDC69DD816371FD3007C38DF /* WebCoreFullScreenPlaceholderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreFullScreenPlaceholderView.h; sourceTree = "<group>"; }; - CDC69DD916371FD3007C38DF /* WebCoreFullScreenPlaceholderView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreFullScreenPlaceholderView.mm; sourceTree = "<group>"; }; CDC69DD41632026C007C38DF /* WebCoreFullScreenWarningView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreFullScreenWarningView.h; sourceTree = "<group>"; }; CDC69DD51632026C007C38DF /* WebCoreFullScreenWarningView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreFullScreenWarningView.mm; sourceTree = "<group>"; }; + CDC69DD816371FD3007C38DF /* WebCoreFullScreenPlaceholderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreFullScreenPlaceholderView.h; sourceTree = "<group>"; }; + CDC69DD916371FD3007C38DF /* WebCoreFullScreenPlaceholderView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreFullScreenPlaceholderView.mm; sourceTree = "<group>"; }; CDCE5CD014633BC900D47CCA /* EventTargetFactory.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = EventTargetFactory.in; sourceTree = "<group>"; }; CDEA762C14608224008B31F1 /* Clock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Clock.h; sourceTree = "<group>"; }; CDEA762E146084DE008B31F1 /* PlatformClockCA.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformClockCA.cpp; sourceTree = "<group>"; }; @@ -15396,6 +15406,8 @@ 4958782012A57DDF007238AC /* PlatformCALayerMac.mm */, 1AA71609149BC4DB0016EC19 /* TileCache.h */, 1AA71608149BC4DA0016EC19 /* TileCache.mm */, + 93F72AF11666EDFC002A02BD /* LayerPool.h */, + 93F72AF21666EDFC002A02BD /* LayerPool.mm */, 0F580FA11496939100FB5BD8 /* WebTileCacheLayer.h */, 0F580FA21496939100FB5BD8 /* WebTileCacheLayer.mm */, 1AA71625149BFFB20016EC19 /* WebTileLayer.h */, @@ -17892,6 +17904,8 @@ E446139D0CD6331000FADA75 /* TimeRanges.cpp */, E446139E0CD6331000FADA75 /* TimeRanges.h */, E446139F0CD6331000FADA75 /* TimeRanges.idl */, + C375D7FB16639519006184AB /* TypeAhead.cpp */, + C375D7FC16639519006184AB /* TypeAhead.h */, F55B3DA91251F12D003EF269 /* URLInputType.cpp */, F55B3DAA1251F12D003EF269 /* URLInputType.h */, F5A154251279534D00D0B0C0 /* ValidationMessage.cpp */, @@ -20742,6 +20756,7 @@ BC2274750E8366E200E7F975 /* SVGRenderStyle.h */, BC2274760E8366E200E7F975 /* SVGRenderStyleDefs.cpp */, BC2274770E8366E200E7F975 /* SVGRenderStyleDefs.h */, + A12A104E166444DC008FA311 /* GridTrackSize.h */, ); name = style; sourceTree = "<group>"; @@ -22506,6 +22521,7 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( + C375D7FE16639519006184AB /* TypeAhead.h in Headers */, FD1AF1501656F15100C6D4F7 /* ExclusionShapeValue.h in Headers */, BC7FA6210D1F0CBD00DB22A9 /* LiveNodeList.h in Headers */, A81369DA097374F600D74463 /* HTMLOptionsCollection.h in Headers */, @@ -25604,6 +25620,7 @@ E44613B00CD6331000FADA75 /* TimeRanges.h in Headers */, 49E912AE0EFAC906009D0CAF /* TimingFunction.h in Headers */, 070334D71459FFD5008D8D45 /* TrackBase.h in Headers */, + A12A1050166444FD008FA311 /* GridTrackSize.h in Headers */, 49E911C40EF86D47009D0CAF /* TransformationMatrix.h in Headers */, 49E911CE0EF86D47009D0CAF /* TransformOperation.h in Headers */, 49E911D00EF86D47009D0CAF /* TransformOperations.h in Headers */, @@ -25836,6 +25853,7 @@ FB2C15C3165D649D0039C9F8 /* CachedSVGDocumentReference.h in Headers */, 31741AAD16636609008A5B7E /* SimulatedClickOptions.h in Headers */, 15B8B7C91652C5220036EF55 /* JSWebKitCSSMixFunctionValue.h in Headers */, + 93F72AF31666EDFC002A02BD /* LayerPool.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -28939,6 +28957,8 @@ 447958051643B4B2001E0A7F /* ParsedContentType.cpp in Sources */, 15B8B7C81652C5220036EF55 /* JSWebKitCSSMixFunctionValue.cpp in Sources */, 86BA766E166427A8005BE5D1 /* FrameLoadRequest.cpp in Sources */, + 93F72AF41666EDFC002A02BD /* LayerPool.mm in Sources */, + C375D7FD16639519006184AB /* TypeAhead.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp b/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp index e08e40c07..f0169bed9 100644 --- a/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp +++ b/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp @@ -55,6 +55,7 @@ bool RuntimeEnabledFeatures::isDeviceMotionEnabled = true; bool RuntimeEnabledFeatures::isDeviceOrientationEnabled = true; bool RuntimeEnabledFeatures::isSpeechInputEnabled = true; bool RuntimeEnabledFeatures::isCSSExclusionsEnabled = false; +bool RuntimeEnabledFeatures::isCSSRegionsEnabled = false; bool RuntimeEnabledFeatures::isLangAttributeAwareFormControlUIEnabled = false; #if ENABLE(SCRIPTED_SPEECH) diff --git a/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h b/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h index bb95ce845..66f8e4589 100644 --- a/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h +++ b/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h @@ -71,6 +71,14 @@ public: static bool cssExclusionsEnabled() { return false; } #endif +#if ENABLE(CSS_REGIONS) + static void setCSSRegionsEnabled(bool isEnabled) { isCSSRegionsEnabled = isEnabled; } + static bool cssRegionsEnabled() { return isCSSRegionsEnabled; } +#else + static void setCSSRegionsEnabled(bool) { } + static bool cssRegionsEnabled() { return false; } +#endif + #if ENABLE(FULLSCREEN_API) // Mozilla version static bool webkitFullScreenAPIEnabled() { return isFullScreenAPIEnabled; } @@ -274,6 +282,7 @@ private: static bool isDeviceOrientationEnabled; static bool isSpeechInputEnabled; static bool isCSSExclusionsEnabled; + static bool isCSSRegionsEnabled; WEBCORE_TESTING static bool isLangAttributeAwareFormControlUIEnabled; #if ENABLE(SCRIPTED_SPEECH) static bool isScriptedSpeechEnabled; diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm index 8adb0ceff..7a6fdf20e 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -3263,6 +3263,7 @@ sub GenerateCallbackHeader my @unsortedIncludes = (); push(@unsortedIncludes, "#include \"ActiveDOMCallback.h\""); push(@unsortedIncludes, "#include \"$interfaceName.h\""); + push(@unsortedIncludes, "#include \"ScopedPersistent.h\""); push(@unsortedIncludes, "#include \"WorldContextHandle.h\""); push(@unsortedIncludes, "#include <v8.h>"); push(@unsortedIncludes, "#include <wtf/Forward.h>"); @@ -3315,12 +3316,10 @@ private: static void weakCallback(v8::Persistent<v8::Value> wrapper, void* parameter) { ${v8InterfaceName}* object = static_cast<${v8InterfaceName}*>(parameter); - object->m_callback.Dispose(); - object->m_callback.Clear(); + object->m_callback.clear(); } - // FIXME: m_callback should be a ScopedPersistent. - v8::Persistent<v8::Object> m_callback; + ScopedPersistent<v8::Object> m_callback; WorldContextHandle m_worldContext; }; @@ -3352,19 +3351,17 @@ sub GenerateCallbackImplementation push(@implContent, <<END); ${v8InterfaceName}::${v8InterfaceName}(v8::Handle<v8::Object> callback, ScriptExecutionContext* context, v8::Handle<v8::Object> owner) : ActiveDOMCallback(context) - , m_callback(v8::Persistent<v8::Object>::New(callback)) + , m_callback(callback) , m_worldContext(UseCurrentWorld) { - if (!owner.IsEmpty()) { - owner->SetHiddenValue(V8HiddenPropertyName::callback(), callback); - m_callback.MakeWeak(this, &${v8InterfaceName}::weakCallback); - } + if (owner.IsEmpty()) + return; + owner->SetHiddenValue(V8HiddenPropertyName::callback(), callback); + m_callback.get().MakeWeak(this, &${v8InterfaceName}::weakCallback); } ${v8InterfaceName}::~${v8InterfaceName}() { - if (!m_callback.IsEmpty()) - m_callback.Dispose(); } END @@ -3434,11 +3431,11 @@ END foreach my $param (@params) { next if $param->type ne $thisType; my $paramName = $param->name; - push(@implContent, " return !invokeCallback(m_callback, v8::Handle<v8::Object>::Cast(${paramName}Handle), " . scalar(@params) . ", argv, callbackReturnValue, scriptExecutionContext());\n"); + push(@implContent, " return !invokeCallback(m_callback.get(), v8::Handle<v8::Object>::Cast(${paramName}Handle), " . scalar(@params) . ", argv, callbackReturnValue, scriptExecutionContext());\n"); last; } } else { - push(@implContent, " return !invokeCallback(m_callback, " . scalar(@params) . ", argv, callbackReturnValue, scriptExecutionContext());\n"); + push(@implContent, " return !invokeCallback(m_callback.get(), " . scalar(@params) . ", argv, callbackReturnValue, scriptExecutionContext());\n"); } push(@implContent, "}\n"); } diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp index 8fa4845ed..332e470cc 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp @@ -41,19 +41,17 @@ namespace WebCore { V8TestCallback::V8TestCallback(v8::Handle<v8::Object> callback, ScriptExecutionContext* context, v8::Handle<v8::Object> owner) : ActiveDOMCallback(context) - , m_callback(v8::Persistent<v8::Object>::New(callback)) + , m_callback(callback) , m_worldContext(UseCurrentWorld) { - if (!owner.IsEmpty()) { - owner->SetHiddenValue(V8HiddenPropertyName::callback(), callback); - m_callback.MakeWeak(this, &V8TestCallback::weakCallback); - } + if (owner.IsEmpty()) + return; + owner->SetHiddenValue(V8HiddenPropertyName::callback(), callback); + m_callback.get().MakeWeak(this, &V8TestCallback::weakCallback); } V8TestCallback::~V8TestCallback() { - if (!m_callback.IsEmpty()) - m_callback.Dispose(); } // Functions @@ -75,7 +73,7 @@ bool V8TestCallback::callbackWithNoParam() v8::Handle<v8::Value> *argv = 0; bool callbackReturnValue = false; - return !invokeCallback(m_callback, 0, argv, callbackReturnValue, scriptExecutionContext()); + return !invokeCallback(m_callback.get(), 0, argv, callbackReturnValue, scriptExecutionContext()); } bool V8TestCallback::callbackWithClass1Param(Class1* class1Param) @@ -103,7 +101,7 @@ bool V8TestCallback::callbackWithClass1Param(Class1* class1Param) }; bool callbackReturnValue = false; - return !invokeCallback(m_callback, 1, argv, callbackReturnValue, scriptExecutionContext()); + return !invokeCallback(m_callback.get(), 1, argv, callbackReturnValue, scriptExecutionContext()); } bool V8TestCallback::callbackWithClass2Param(Class2* class2Param, const String& strArg) @@ -138,7 +136,7 @@ bool V8TestCallback::callbackWithClass2Param(Class2* class2Param, const String& }; bool callbackReturnValue = false; - return !invokeCallback(m_callback, 2, argv, callbackReturnValue, scriptExecutionContext()); + return !invokeCallback(m_callback.get(), 2, argv, callbackReturnValue, scriptExecutionContext()); } bool V8TestCallback::callbackWithStringList(RefPtr<DOMStringList> listParam) @@ -166,7 +164,7 @@ bool V8TestCallback::callbackWithStringList(RefPtr<DOMStringList> listParam) }; bool callbackReturnValue = false; - return !invokeCallback(m_callback, 1, argv, callbackReturnValue, scriptExecutionContext()); + return !invokeCallback(m_callback.get(), 1, argv, callbackReturnValue, scriptExecutionContext()); } bool V8TestCallback::callbackWithBoolean(bool boolParam) @@ -194,7 +192,7 @@ bool V8TestCallback::callbackWithBoolean(bool boolParam) }; bool callbackReturnValue = false; - return !invokeCallback(m_callback, 1, argv, callbackReturnValue, scriptExecutionContext()); + return !invokeCallback(m_callback.get(), 1, argv, callbackReturnValue, scriptExecutionContext()); } bool V8TestCallback::callbackRequiresThisToPass(Class8* class8Param, ThisClass* thisClassParam) @@ -231,7 +229,7 @@ bool V8TestCallback::callbackRequiresThisToPass(Class8* class8Param, ThisClass* }; bool callbackReturnValue = false; - return !invokeCallback(m_callback, v8::Handle<v8::Object>::Cast(thisClassParamHandle), 2, argv, callbackReturnValue, scriptExecutionContext()); + return !invokeCallback(m_callback.get(), v8::Handle<v8::Object>::Cast(thisClassParamHandle), 2, argv, callbackReturnValue, scriptExecutionContext()); } } // namespace WebCore diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.h b/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.h index 5edb1f9e5..13be0642a 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.h +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.h @@ -24,6 +24,7 @@ #define V8TestCallback_h #include "ActiveDOMCallback.h" +#include "ScopedPersistent.h" #include "TestCallback.h" #include "WorldContextHandle.h" #include <v8.h> @@ -60,12 +61,10 @@ private: static void weakCallback(v8::Persistent<v8::Value> wrapper, void* parameter) { V8TestCallback* object = static_cast<V8TestCallback*>(parameter); - object->m_callback.Dispose(); - object->m_callback.Clear(); + object->m_callback.clear(); } - // FIXME: m_callback should be a ScopedPersistent. - v8::Persistent<v8::Object> m_callback; + ScopedPersistent<v8::Object> m_callback; WorldContextHandle m_worldContext; }; diff --git a/Source/WebCore/bindings/v8/V8Binding.cpp b/Source/WebCore/bindings/v8/V8Binding.cpp index 0a11ff238..f1992f9bf 100644 --- a/Source/WebCore/bindings/v8/V8Binding.cpp +++ b/Source/WebCore/bindings/v8/V8Binding.cpp @@ -100,7 +100,7 @@ static String v8NonStringValueToWebCoreString(v8::Handle<v8::Value> object) { ASSERT(!object->IsString()); if (object->IsInt32()) - return int32ToWebCoreString<String>(object->Int32Value()); + return int32ToWebCoreString(object->Int32Value()); v8::TryCatch block; v8::Handle<v8::String> v8String = object->ToString(); diff --git a/Source/WebCore/bindings/v8/V8StringResource.cpp b/Source/WebCore/bindings/v8/V8StringResource.cpp index df9c8a0c3..371391d2b 100644 --- a/Source/WebCore/bindings/v8/V8StringResource.cpp +++ b/Source/WebCore/bindings/v8/V8StringResource.cpp @@ -190,8 +190,6 @@ String int32ToWebCoreStringFast(int value) // Most numbers used are <= 100. Even if they aren't used there's very little cost in using the space. const int kLowNumbers = 100; - - // FIXME: Store lowNumbers in V8PerIsolateData so that workers can also use them. DEFINE_STATIC_LOCAL(Vector<AtomicString>, lowNumbers, (kLowNumbers + 1)); String webCoreString; if (0 <= value && value <= kLowNumbers) { @@ -206,7 +204,7 @@ String int32ToWebCoreStringFast(int value) return webCoreString; } -template<> String int32ToWebCoreString<String>(int value) +String int32ToWebCoreString(int value) { // If we are on the main thread (this should always true for non-workers), call the faster one. if (isMainThread()) @@ -214,9 +212,4 @@ template<> String int32ToWebCoreString<String>(int value) return String::number(value); } -template<> AtomicString int32ToWebCoreString<AtomicString>(int value) -{ - return AtomicString(int32ToWebCoreString<String>(value)); -} - } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/V8StringResource.h b/Source/WebCore/bindings/v8/V8StringResource.h index 926f185ee..6b6be8776 100644 --- a/Source/WebCore/bindings/v8/V8StringResource.h +++ b/Source/WebCore/bindings/v8/V8StringResource.h @@ -142,8 +142,7 @@ enum ExternalMode { template <typename StringType> StringType v8StringToWebCoreString(v8::Handle<v8::String>, ExternalMode); -template <typename StringType> -StringType int32ToWebCoreString(int value); +String int32ToWebCoreString(int value); // V8StringResource is an adapter class that converts V8 values to Strings // or AtomicStrings as appropriate, using multiple typecast operators. @@ -159,6 +158,7 @@ public: V8StringResource(v8::Local<v8::Value> object) : m_v8Object(object) , m_mode(Externalize) + , m_string() { } @@ -169,10 +169,17 @@ public: private: bool prepareBase() { - ASSERT(!m_v8Object.IsEmpty()); - if (LIKELY(m_v8Object->IsString() || m_v8Object->IsInt32())) + if (m_v8Object.IsEmpty()) + return true; + + if (LIKELY(m_v8Object->IsString())) return true; + if (LIKELY(m_v8Object->IsInt32())) { + setString(int32ToWebCoreString(m_v8Object->Int32Value())); + return true; + } + m_mode = DoNotExternalize; v8::TryCatch block; m_v8Object = m_v8Object->ToString(); @@ -184,32 +191,35 @@ private: return true; } + void setString(const String& string) + { + m_string = string; + m_v8Object.Clear(); // To signal that String is ready. + } + template <class StringType> StringType toString() { - if (m_v8Object.IsEmpty()) - return StringType(); - if (m_v8Object->IsInt32()) - return int32ToWebCoreString<StringType>(m_v8Object->Int32Value()); - ASSERT(m_v8Object->IsString()); - return v8StringToWebCoreString<StringType>(m_v8Object.As<v8::String>(), m_mode); + if (LIKELY(!m_v8Object.IsEmpty())) + return v8StringToWebCoreString<StringType>(m_v8Object.As<v8::String>(), m_mode); + + return StringType(m_string); } v8::Local<v8::Value> m_v8Object; ExternalMode m_mode; + String m_string; }; template<> inline bool V8StringResource<DefaultMode>::prepare() { - if (m_v8Object.IsEmpty()) - return true; return prepareBase(); } template<> inline bool V8StringResource<WithNullCheck>::prepare() { if (m_v8Object.IsEmpty() || m_v8Object->IsNull()) { - m_v8Object.Clear(); + setString(String()); return true; } return prepareBase(); @@ -218,7 +228,7 @@ template<> inline bool V8StringResource<WithNullCheck>::prepare() template<> inline bool V8StringResource<WithUndefinedOrNullCheck>::prepare() { if (m_v8Object.IsEmpty() || m_v8Object->IsNull() || m_v8Object->IsUndefined()) { - m_v8Object.Clear(); + setString(String()); return true; } return prepareBase(); diff --git a/Source/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp b/Source/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp index b97f7d76b..7952398da 100644 --- a/Source/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp +++ b/Source/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp @@ -73,7 +73,7 @@ bool V8SQLStatementErrorCallback::handleEvent(SQLTransaction* transaction, SQLEr // statement, if any, or onto the next overall step otherwise. Otherwise, // the error callback did not return false, or there was no error callback. // Jump to the last step in the overall steps. - return invokeCallback(m_callback, 2, argv, callbackReturnValue, scriptExecutionContext()) || callbackReturnValue; + return invokeCallback(m_callback.get(), 2, argv, callbackReturnValue, scriptExecutionContext()) || callbackReturnValue; } } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/custom/V8MutationCallbackCustom.cpp b/Source/WebCore/bindings/v8/custom/V8MutationCallbackCustom.cpp index ee3e68022..b8e8d09c4 100644 --- a/Source/WebCore/bindings/v8/custom/V8MutationCallbackCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8MutationCallbackCustom.cpp @@ -83,7 +83,7 @@ bool V8MutationCallback::handleEvent(MutationRecordArray* mutations, MutationObs }; bool callbackReturnValue = false; - return !invokeCallback(m_callback, v8::Handle<v8::Object>::Cast(observerHandle), 2, argv, callbackReturnValue, scriptExecutionContext()); + return !invokeCallback(m_callback.get(), v8::Handle<v8::Object>::Cast(observerHandle), 2, argv, callbackReturnValue, scriptExecutionContext()); } } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/custom/V8SpeechRecognitionResultCustom.cpp b/Source/WebCore/bindings/v8/custom/V8SpeechRecognitionEventCustom.cpp index ef14565fc..afa461e1f 100644 --- a/Source/WebCore/bindings/v8/custom/V8SpeechRecognitionResultCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8SpeechRecognitionEventCustom.cpp @@ -27,18 +27,18 @@ #if ENABLE(SCRIPTED_SPEECH) -#include "V8SpeechRecognitionResult.h" +#include "V8SpeechRecognitionEvent.h" -#include "SpeechRecognitionResult.h" +#include "SpeechRecognitionEvent.h" #include "V8Binding.h" #include "V8GCController.h" namespace WebCore { -void* V8SpeechRecognitionResult::opaqueRootForGC(void* object, v8::Persistent<v8::Object> wrapper) +void* V8SpeechRecognitionEvent::opaqueRootForGC(void* object, v8::Persistent<v8::Object> wrapper) { - ASSERT(V8SpeechRecognitionResult::HasInstance(wrapper)); - SpeechRecognitionResult* impl = static_cast<SpeechRecognitionResult*>(object); + ASSERT(V8SpeechRecognitionEvent::HasInstance(wrapper)); + SpeechRecognitionEvent* impl = static_cast<SpeechRecognitionEvent*>(object); return V8GCController::opaqueRootForGC(impl->emma()); } diff --git a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp index 4bc7b084f..b4b19c798 100644 --- a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp +++ b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp @@ -983,27 +983,24 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForFilter(const RenderObj } #endif -static PassRefPtr<CSSValue> valueForGridTrackBreadth(const Length& trackLength, const RenderStyle* style) +static PassRefPtr<CSSValue> valueForGridTrackBreadth(const GridTrackSize& trackSize, const RenderStyle* style) { - if (trackLength.isPercent()) - return cssValuePool().createValue(trackLength); - if (trackLength.isAuto()) + if (trackSize.length().isPercent()) + return cssValuePool().createValue(trackSize.length()); + if (trackSize.length().isAuto()) return cssValuePool().createIdentifierValue(CSSValueAuto); - return zoomAdjustedPixelValue(trackLength.value(), style); + return zoomAdjustedPixelValue(trackSize.length().value(), style); } -static PassRefPtr<CSSValue> valueForGridTrackList(const Vector<Length>& trackLengths, const RenderStyle* style) +static PassRefPtr<CSSValue> valueForGridTrackList(const Vector<GridTrackSize>& trackSizes, const RenderStyle* style) { - // We should have at least an element! - ASSERT(trackLengths.size()); - // Handle the 'none' case here. - if (trackLengths.size() == 1 && trackLengths[0].isUndefined()) + if (!trackSizes.size()) return cssValuePool().createIdentifierValue(CSSValueNone); RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); - for (size_t i = 0; i < trackLengths.size(); ++i) - list->append(valueForGridTrackBreadth(trackLengths[i], style)); + for (size_t i = 0; i < trackSizes.size(); ++i) + list->append(valueForGridTrackBreadth(trackSizes[i], style)); return list.release(); } @@ -2025,6 +2022,8 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert return cssValuePool().createValue(style->position()); case CSSPropertyRight: return getPositionOffsetValue(style.get(), CSSPropertyRight, m_node->document()->renderView()); + case CSSPropertyWebkitRubyPosition: + return cssValuePool().createValue(style->rubyPosition()); case CSSPropertyTableLayout: return cssValuePool().createValue(style->tableLayout()); case CSSPropertyTextAlign: diff --git a/Source/WebCore/css/CSSGrammar.y.in b/Source/WebCore/css/CSSGrammar.y.in index 21b016135..f08e48643 100644 --- a/Source/WebCore/css/CSSGrammar.y.in +++ b/Source/WebCore/css/CSSGrammar.y.in @@ -713,11 +713,11 @@ supports_declaration_condition: CSSParser* p = static_cast<CSSParser*>(parser); if ($3 && $6) { p->m_valueList = p->sinkFloatingValueList($6); - int oldParsedProperties = p->m_parsedProperties->size(); + int oldParsedProperties = p->m_parsedProperties.size(); $$ = p->parseValue(static_cast<CSSPropertyID>($3), $7); // We just need to know if the declaration is supported as it is written. Rollback any additions. if ($$) - p->rollbackLastProperties(p->m_parsedProperties->size() - oldParsedProperties); + p->rollbackLastProperties(p->m_parsedProperties.size() - oldParsedProperties); p->m_valueList = nullptr; } p->markPropertyEnd($7, false); diff --git a/Source/WebCore/css/CSSParser.cpp b/Source/WebCore/css/CSSParser.cpp index 43a89e424..4f87fc93d 100644 --- a/Source/WebCore/css/CSSParser.cpp +++ b/Source/WebCore/css/CSSParser.cpp @@ -890,6 +890,12 @@ static inline bool isValidKeywordPropertyAndValue(CSSPropertyID propertyId, int if (valueID == CSSValueLogical || valueID == CSSValueVisual) return true; break; + + case CSSPropertyWebkitRubyPosition: + if (valueID == CSSValueBefore || valueID == CSSValueAfter) + return true; + break; + #if ENABLE(CSS3_TEXT) case CSSPropertyWebkitTextAlignLast: // auto | start | end | left | right | center | justify @@ -1057,6 +1063,7 @@ static inline bool isKeywordPropertyID(CSSPropertyID propertyId) case CSSPropertyWebkitRegionOverflow: #endif case CSSPropertyWebkitRtlOrdering: + case CSSPropertyWebkitRubyPosition: #if ENABLE(CSS3_TEXT) case CSSPropertyWebkitTextAlignLast: #endif // CSS3_TEXT @@ -2873,6 +2880,7 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important) case CSSPropertyWebkitRegionOverflow: #endif case CSSPropertyWebkitRtlOrdering: + case CSSPropertyWebkitRubyPosition: #if ENABLE(CSS3_TEXT) case CSSPropertyWebkitTextAlignLast: #endif // CSS3_TEXT diff --git a/Source/WebCore/css/CSSPrimitiveValueMappings.h b/Source/WebCore/css/CSSPrimitiveValueMappings.h index db10acadd..f5cedf623 100644 --- a/Source/WebCore/css/CSSPrimitiveValueMappings.h +++ b/Source/WebCore/css/CSSPrimitiveValueMappings.h @@ -2811,6 +2811,33 @@ template<> inline CSSPrimitiveValue::operator TextCombine() const return TextCombineNone; } +template<> inline CSSPrimitiveValue::CSSPrimitiveValue(RubyPosition position) + : CSSValue(PrimitiveClass) +{ + m_primitiveUnitType = CSS_IDENT; + switch (position) { + case RubyPositionBefore: + m_value.ident = CSSValueBefore; + break; + case RubyPositionAfter: + m_value.ident = CSSValueAfter; + break; + } +} + +template<> inline CSSPrimitiveValue::operator RubyPosition() const +{ + switch (m_value.ident) { + case CSSValueBefore: + return RubyPositionBefore; + case CSSValueAfter: + return RubyPositionAfter; + } + + ASSERT_NOT_REACHED(); + return RubyPositionBefore; +} + template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextEmphasisPosition position) : CSSValue(PrimitiveClass) { diff --git a/Source/WebCore/css/CSSProperty.cpp b/Source/WebCore/css/CSSProperty.cpp index 13d0b19e3..b25120321 100644 --- a/Source/WebCore/css/CSSProperty.cpp +++ b/Source/WebCore/css/CSSProperty.cpp @@ -324,6 +324,7 @@ bool CSSProperty::isInheritedProperty(CSSPropertyID propertyID) #endif case CSSPropertyWebkitPrintColorAdjust: case CSSPropertyWebkitRtlOrdering: + case CSSPropertyWebkitRubyPosition: case CSSPropertyWebkitTextCombine: #if ENABLE(CSS3_TEXT) case CSSPropertyWebkitTextDecorationLine: diff --git a/Source/WebCore/css/CSSPropertyNames.in b/Source/WebCore/css/CSSPropertyNames.in index d958c6b69..50ced6b03 100644 --- a/Source/WebCore/css/CSSPropertyNames.in +++ b/Source/WebCore/css/CSSPropertyNames.in @@ -351,6 +351,7 @@ z-index -webkit-perspective-origin-y -webkit-print-color-adjust -webkit-rtl-ordering +-webkit-ruby-position -webkit-text-combine -epub-text-combine = -webkit-text-combine #if defined(ENABLE_CSS3_TEXT) && ENABLE_CSS3_TEXT diff --git a/Source/WebCore/css/CSSValueKeywords.in b/Source/WebCore/css/CSSValueKeywords.in index 10ba6eae7..02a414ced 100644 --- a/Source/WebCore/css/CSSValueKeywords.in +++ b/Source/WebCore/css/CSSValueKeywords.in @@ -871,6 +871,10 @@ vertical-rl vertical-lr horizontal-bt +// -webkit-ruby-position +after +before + // -webkit-text-emphasis-position over under diff --git a/Source/WebCore/css/StyleBuilder.cpp b/Source/WebCore/css/StyleBuilder.cpp index ea4766f5b..aa6749389 100644 --- a/Source/WebCore/css/StyleBuilder.cpp +++ b/Source/WebCore/css/StyleBuilder.cpp @@ -2050,6 +2050,7 @@ StyleBuilder::StyleBuilder() setPropertyHandler(CSSPropertyWebkitRegionOverflow, ApplyPropertyDefault<RegionOverflow, &RenderStyle::regionOverflow, RegionOverflow, &RenderStyle::setRegionOverflow, RegionOverflow, &RenderStyle::initialRegionOverflow>::createHandler()); #endif setPropertyHandler(CSSPropertyWebkitRtlOrdering, ApplyPropertyDefault<Order, &RenderStyle::rtlOrdering, Order, &RenderStyle::setRTLOrdering, Order, &RenderStyle::initialRTLOrdering>::createHandler()); + setPropertyHandler(CSSPropertyWebkitRubyPosition, ApplyPropertyDefault<RubyPosition, &RenderStyle::rubyPosition, RubyPosition, &RenderStyle::setRubyPosition, RubyPosition, &RenderStyle::initialRubyPosition>::createHandler()); setPropertyHandler(CSSPropertyWebkitTextCombine, ApplyPropertyDefault<TextCombine, &RenderStyle::textCombine, TextCombine, &RenderStyle::setTextCombine, TextCombine, &RenderStyle::initialTextCombine>::createHandler()); setPropertyHandler(CSSPropertyWebkitTextEmphasisColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textEmphasisColor, &RenderStyle::setTextEmphasisColor, &RenderStyle::setVisitedLinkTextEmphasisColor, &RenderStyle::color>::createHandler()); setPropertyHandler(CSSPropertyWebkitTextEmphasisPosition, ApplyPropertyDefault<TextEmphasisPosition, &RenderStyle::textEmphasisPosition, TextEmphasisPosition, &RenderStyle::setTextEmphasisPosition, TextEmphasisPosition, &RenderStyle::initialTextEmphasisPosition>::createHandler()); diff --git a/Source/WebCore/css/StyleResolver.cpp b/Source/WebCore/css/StyleResolver.cpp index c6d033241..95a975779 100644 --- a/Source/WebCore/css/StyleResolver.cpp +++ b/Source/WebCore/css/StyleResolver.cpp @@ -2659,7 +2659,7 @@ bool StyleResolver::useSVGZoomRules() return m_element && m_element->isSVGElement(); } -static bool createGridTrackBreadth(CSSPrimitiveValue* primitiveValue, StyleResolver* selector, Length& length) +static bool createGridTrackBreadth(CSSPrimitiveValue* primitiveValue, StyleResolver* selector, GridTrackSize& trackSize) { Length workingLength = primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | ViewportPercentageConversion | AutoConversion>(selector->style(), selector->rootElementStyle(), selector->style()->effectiveZoom()); if (workingLength.isUndefined()) @@ -2668,20 +2668,16 @@ static bool createGridTrackBreadth(CSSPrimitiveValue* primitiveValue, StyleResol if (primitiveValue->isLength()) workingLength.setQuirk(primitiveValue->isQuirkValue()); - length = workingLength; + trackSize.setLength(workingLength); return true; } -static bool createGridTrackList(CSSValue* value, Vector<Length>& lengths, StyleResolver* selector) +static bool createGridTrackList(CSSValue* value, Vector<GridTrackSize>& trackSizes, StyleResolver* selector) { // Handle 'none'. if (value->isPrimitiveValue()) { CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); - if (primitiveValue->getIdent() == CSSValueNone) { - lengths.append(Length(Undefined)); - return true; - } - return false; + return primitiveValue->getIdent() == CSSValueNone; } if (value->isValueList()) { @@ -2690,11 +2686,11 @@ static bool createGridTrackList(CSSValue* value, Vector<Length>& lengths, StyleR if (!currValue->isPrimitiveValue()) return false; - Length length; - if (!createGridTrackBreadth(static_cast<CSSPrimitiveValue*>(currValue), selector, length)) + GridTrackSize trackSize; + if (!createGridTrackBreadth(static_cast<CSSPrimitiveValue*>(currValue), selector, trackSize)) return false; - lengths.append(length); + trackSizes.append(trackSize); } return true; } @@ -3544,17 +3540,17 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value) } #endif case CSSPropertyWebkitGridColumns: { - Vector<Length> lengths; - if (!createGridTrackList(value, lengths, this)) + Vector<GridTrackSize> trackSizes; + if (!createGridTrackList(value, trackSizes, this)) return; - m_style->setGridColumns(lengths); + m_style->setGridColumns(trackSizes); return; } case CSSPropertyWebkitGridRows: { - Vector<Length> lengths; - if (!createGridTrackList(value, lengths, this)) + Vector<GridTrackSize> trackSizes; + if (!createGridTrackList(value, trackSizes, this)) return; - m_style->setGridRows(lengths); + m_style->setGridRows(trackSizes); return; } @@ -3805,6 +3801,7 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value) case CSSPropertyWebkitRegionOverflow: #endif case CSSPropertyWebkitRtlOrdering: + case CSSPropertyWebkitRubyPosition: case CSSPropertyWebkitTextCombine: #if ENABLE(CSS3_TEXT) case CSSPropertyWebkitTextDecorationLine: diff --git a/Source/WebCore/css/themeBlackBerry.css b/Source/WebCore/css/themeBlackBerry.css index 8cd2e0e1c..2fcadc0bb 100644 --- a/Source/WebCore/css/themeBlackBerry.css +++ b/Source/WebCore/css/themeBlackBerry.css @@ -20,6 +20,15 @@ textarea { font-family: monospace; } +/* If the select do not have multiple nor size larger than 1 attribute, which are menulist appearance, we wanna change text color when it is actived. */ +input[type="button"]:active, input[type="submit"]:active, input[type="reset"]:active, input[type="file"]:active::-webkit-file-upload-button, button:active, select:not([multiple]):not([size]):active, select[size="0"]:active, select[size="1"]:active { + color: #fafafa; +} + +input[type="button"]:active:disabled, input[type="submit"]:active:disabled, input[type="reset"]:active:disabled, input[type="file"]:active:disabled::-webkit-file-upload-button, button:active:disabled, select:not([multiple]):not([size]):active:disabled, select[size="0"]:active:disabled, select[size="1"]:active:disabled { + color: GrayText; +} + select { border-radius: 0; } diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp index db74d55de..756967441 100644 --- a/Source/WebCore/dom/Document.cpp +++ b/Source/WebCore/dom/Document.cpp @@ -1124,7 +1124,7 @@ bool Document::cssStickyPositionEnabled() const bool Document::cssRegionsEnabled() const { - return settings() && settings()->cssRegionsEnabled(); + return RuntimeEnabledFeatures::cssRegionsEnabled(); } bool Document::cssGridLayoutEnabled() const diff --git a/Source/WebCore/dom/Node.cpp b/Source/WebCore/dom/Node.cpp index 9f08903c1..1d9dfc44d 100644 --- a/Source/WebCore/dom/Node.cpp +++ b/Source/WebCore/dom/Node.cpp @@ -1157,8 +1157,8 @@ bool Node::isDescendantOf(const Node *other) const // Return true if other is an ancestor of this, otherwise false if (!other || !other->hasChildNodes() || inDocument() != other->inDocument()) return false; - if (other == other->document()) - return document() == other && this != document() && inDocument(); + if (other->isDocumentNode()) + return document() == other && !isDocumentNode() && inDocument(); for (const ContainerNode* n = parentNode(); n; n = n->parentNode()) { if (n == other) return true; diff --git a/Source/WebCore/html/HTMLFormControlElement.cpp b/Source/WebCore/html/HTMLFormControlElement.cpp index d433946e8..0aff287b4 100644 --- a/Source/WebCore/html/HTMLFormControlElement.cpp +++ b/Source/WebCore/html/HTMLFormControlElement.cpp @@ -174,7 +174,7 @@ static bool shouldAutofocus(HTMLFormControlElement* element) return false; if (element->document()->isSandboxed(SandboxAutomaticFeatures)) { // FIXME: This message should be moved off the console once a solution to https://bugs.webkit.org/show_bug.cgi?id=103274 exists. - element->document()->addConsoleMessage(HTMLMessageSource, LogMessageType, ErrorMessageLevel, "Blocked autofocusing on a form control because the form's frame is sandboxed and the 'allow-script' permission is not set."); + element->document()->addConsoleMessage(HTMLMessageSource, LogMessageType, ErrorMessageLevel, "Blocked autofocusing on a form control because the form's frame is sandboxed and the 'allow-scripts' permission is not set."); return false; } if (element->hasAutofocused()) diff --git a/Source/WebCore/html/HTMLMediaElement.cpp b/Source/WebCore/html/HTMLMediaElement.cpp index 732b91717..c0d129eba 100644 --- a/Source/WebCore/html/HTMLMediaElement.cpp +++ b/Source/WebCore/html/HTMLMediaElement.cpp @@ -2841,7 +2841,7 @@ void HTMLMediaElement::didAddTrack(HTMLTrackElement* trackElement) scheduleLoad(TextTrackResource); } -void HTMLMediaElement::willRemoveTrack(HTMLTrackElement* trackElement) +void HTMLMediaElement::didRemoveTrack(HTMLTrackElement* trackElement) { ASSERT(trackElement->hasTagName(trackTag)); @@ -2851,7 +2851,7 @@ void HTMLMediaElement::willRemoveTrack(HTMLTrackElement* trackElement) #if !LOG_DISABLED if (trackElement->hasTagName(trackTag)) { KURL url = trackElement->getNonEmptyURLAttribute(srcAttr); - LOG(Media, "HTMLMediaElement::willRemoveTrack - 'src' is %s", urlForLogging(url).utf8().data()); + LOG(Media, "HTMLMediaElement::didRemoveTrack - 'src' is %s", urlForLogging(url).utf8().data()); } #endif diff --git a/Source/WebCore/html/HTMLMediaElement.h b/Source/WebCore/html/HTMLMediaElement.h index 80549c262..047c8f570 100644 --- a/Source/WebCore/html/HTMLMediaElement.h +++ b/Source/WebCore/html/HTMLMediaElement.h @@ -221,7 +221,7 @@ public: CueList currentlyActiveCues() const { return m_currentlyActiveCues; } virtual void didAddTrack(HTMLTrackElement*); - virtual void willRemoveTrack(HTMLTrackElement*); + virtual void didRemoveTrack(HTMLTrackElement*); struct TrackGroup { enum GroupKind { CaptionsAndSubtitles, Description, Chapter, Metadata, Other }; diff --git a/Source/WebCore/html/HTMLSelectElement.cpp b/Source/WebCore/html/HTMLSelectElement.cpp index 23ac57af4..f41ee0d07 100644 --- a/Source/WebCore/html/HTMLSelectElement.cpp +++ b/Source/WebCore/html/HTMLSelectElement.cpp @@ -64,16 +64,13 @@ using namespace HTMLNames; // Upper limit agreed upon with representatives of Opera and Mozilla. static const unsigned maxSelectItems = 10000; -static const DOMTimeStamp typeAheadTimeout = 1000; - HTMLSelectElement::HTMLSelectElement(const QualifiedName& tagName, Document* document, HTMLFormElement* form) : HTMLFormControlElementWithState(tagName, document, form) - , m_lastCharTime(0) + , m_typeAhead(this) , m_size(0) , m_lastOnChangeIndex(-1) , m_activeSelectionAnchorIndex(-1) , m_activeSelectionEndIndex(-1) - , m_repeatingChar(0) , m_isProcessingUserDrivenChange(false) , m_multiple(false) , m_activeSelectionState(false) @@ -1474,82 +1471,34 @@ int HTMLSelectElement::lastSelectedListIndex() const return -1; } -static String stripLeadingWhiteSpace(const String& string) +int HTMLSelectElement::indexOfSelectedOption() const { - int length = string.length(); - - int i; - for (i = 0; i < length; ++i) { - if (string[i] != noBreakSpace && (string[i] <= 0x7F ? !isASCIISpace(string[i]) : (direction(string[i]) != WhiteSpaceNeutral))) - break; - } - - return string.substring(i, length - i); + return optionToListIndex(selectedIndex()); } -void HTMLSelectElement::typeAheadFind(KeyboardEvent* event) +int HTMLSelectElement::optionCount() const { - if (event->timeStamp() < m_lastCharTime) - return; - - DOMTimeStamp delta = event->timeStamp() - m_lastCharTime; - m_lastCharTime = event->timeStamp(); - - UChar c = event->charCode(); - - String prefix; - int searchStartOffset = 1; - if (delta > typeAheadTimeout) { - prefix = String(&c, 1); - m_typedString = prefix; - m_repeatingChar = c; - } else { - m_typedString.append(c); - - if (c == m_repeatingChar) { - // The user is likely trying to cycle through all the items starting - // with this character, so just search on the character. - prefix = String(&c, 1); - } else { - m_repeatingChar = 0; - prefix = m_typedString; - searchStartOffset = 0; - } - } + return listItems().size(); +} +String HTMLSelectElement::optionAtIndex(int index) const +{ const Vector<HTMLElement*>& items = listItems(); - int itemCount = items.size(); - if (itemCount < 1) - return; + + HTMLElement* element = items[index]; + if (!element->hasTagName(optionTag) || toHTMLOptionElement(element)->disabled()) + return String(); + return toHTMLOptionElement(element)->textIndentedToRespectGroupLabel(); +} - int selected = selectedIndex(); - int index = optionToListIndex(selected >= 0 ? selected : 0) + searchStartOffset; +void HTMLSelectElement::typeAheadFind(KeyboardEvent* event) +{ + int index = m_typeAhead.handleEvent(event, TypeAhead::MatchPrefix | TypeAhead::CycleFirstChar); if (index < 0) return; - index %= itemCount; - - // Compute a case-folded copy of the prefix string before beginning the search for - // a matching element. This code uses foldCase to work around the fact that - // String::startWith does not fold non-ASCII characters. This code can be changed - // to use startWith once that is fixed. - String prefixWithCaseFolded(prefix.foldCase()); - for (int i = 0; i < itemCount; ++i, index = (index + 1) % itemCount) { - HTMLElement* element = items[index]; - if (!element->hasTagName(optionTag) || toHTMLOptionElement(element)->disabled()) - continue; - - // Fold the option string and check if its prefix is equal to the folded prefix. - String text = toHTMLOptionElement(element)->textIndentedToRespectGroupLabel(); - if (stripLeadingWhiteSpace(text).foldCase().startsWith(prefixWithCaseFolded)) { - selectOption(listToOptionIndex(index), DeselectOtherOptions | DispatchChangeEvent | UserDriven); - if (!usesMenuList()) - listBoxOnChange(); - - setOptionsChangedOnRenderer(); - setNeedsStyleRecalc(); - return; - } - } + selectOption(listToOptionIndex(index), DeselectOtherOptions | DispatchChangeEvent | UserDriven); + if (!usesMenuList()) + listBoxOnChange(); } Node::InsertionNotificationRequest HTMLSelectElement::insertedInto(ContainerNode* insertionPoint) diff --git a/Source/WebCore/html/HTMLSelectElement.h b/Source/WebCore/html/HTMLSelectElement.h index 6d88da178..a2f2650f6 100644 --- a/Source/WebCore/html/HTMLSelectElement.h +++ b/Source/WebCore/html/HTMLSelectElement.h @@ -29,13 +29,14 @@ #include "Event.h" #include "HTMLFormControlElementWithState.h" #include "HTMLOptionsCollection.h" +#include "TypeAhead.h" #include <wtf/Vector.h> namespace WebCore { class HTMLOptionElement; -class HTMLSelectElement : public HTMLFormControlElementWithState { +class HTMLSelectElement : public HTMLFormControlElementWithState, public TypeAheadDataSource { public: static PassRefPtr<HTMLSelectElement> create(const QualifiedName&, Document*, HTMLFormElement*); @@ -103,7 +104,7 @@ public: // For use in the implementation of HTMLOptionElement. void optionSelectionStateChanged(HTMLOptionElement*, bool optionIsSelected); - + protected: HTMLSelectElement(const QualifiedName&, Document*, HTMLFormElement*); @@ -181,17 +182,20 @@ private: virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); virtual bool areAuthorShadowsAllowed() const OVERRIDE { return false; } + // TypeAheadDataSource functions. + virtual int indexOfSelectedOption() const OVERRIDE; + virtual int optionCount() const OVERRIDE; + virtual String optionAtIndex(int index) const OVERRIDE; + // m_listItems contains HTMLOptionElement, HTMLOptGroupElement, and HTMLHRElement objects. mutable Vector<HTMLElement*> m_listItems; Vector<bool> m_lastOnChangeSelection; Vector<bool> m_cachedStateForActiveSelection; - DOMTimeStamp m_lastCharTime; - String m_typedString; + TypeAhead m_typeAhead; int m_size; int m_lastOnChangeIndex; int m_activeSelectionAnchorIndex; int m_activeSelectionEndIndex; - UChar m_repeatingChar; bool m_isProcessingUserDrivenChange; bool m_multiple; bool m_activeSelectionState; diff --git a/Source/WebCore/html/HTMLTrackElement.cpp b/Source/WebCore/html/HTMLTrackElement.cpp index 377fc6555..36d4342c6 100644 --- a/Source/WebCore/html/HTMLTrackElement.cpp +++ b/Source/WebCore/html/HTMLTrackElement.cpp @@ -75,22 +75,16 @@ PassRefPtr<HTMLTrackElement> HTMLTrackElement::create(const QualifiedName& tagNa Node::InsertionNotificationRequest HTMLTrackElement::insertedInto(ContainerNode* insertionPoint) { HTMLElement::insertedInto(insertionPoint); - if (insertionPoint->inDocument()) { - if (HTMLMediaElement* parent = mediaElement()) - parent->didAddTrack(this); - } - + HTMLMediaElement* parent = mediaElement(); + if (insertionPoint == parent) + parent->didAddTrack(this); return InsertionDone; } void HTMLTrackElement::removedFrom(ContainerNode* insertionPoint) { - HTMLMediaElement* parent = mediaElement(); - if (!parent && WebCore::isMediaElement(insertionPoint)) - parent = toMediaElement(insertionPoint); - if (parent) - parent->willRemoveTrack(this); - + if (!parentNode() && WebCore::isMediaElement(insertionPoint)) + toMediaElement(insertionPoint)->didRemoveTrack(this); HTMLElement::removedFrom(insertionPoint); } diff --git a/Source/WebCore/html/TypeAhead.cpp b/Source/WebCore/html/TypeAhead.cpp new file mode 100644 index 000000000..d79d7c067 --- /dev/null +++ b/Source/WebCore/html/TypeAhead.cpp @@ -0,0 +1,122 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (C) 1999 Lars Knoll (knoll@kde.org) + * (C) 1999 Antti Koivisto (koivisto@kde.org) + * (C) 2001 Dirk Mueller (mueller@kde.org) + * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights reserved. + * (C) 2006 Alexey Proskuryakov (ap@nypop.com) + * Copyright (C) 2010 Google Inc. All rights reserved. + * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) + * + * 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 "TypeAhead.h" + +#include "KeyboardEvent.h" +#include <wtf/unicode/CharacterNames.h> +#include <wtf/unicode/Unicode.h> + +using namespace WTF::Unicode; + +namespace WebCore { + +TypeAhead::TypeAhead(TypeAheadDataSource* dataSource) + : m_dataSource(dataSource) + , m_lastTypeTime(0) + , m_repeatingChar(0) +{ +} + +static const DOMTimeStamp typeAheadTimeout = 1000; + +static String stripLeadingWhiteSpace(const String& string) +{ + unsigned length = string.length(); + + unsigned i; + for (i = 0; i < length; ++i) { + if (string[i] != noBreakSpace && (string[i] <= 0x7F ? !isASCIISpace(string[i]) : (direction(string[i]) != WhiteSpaceNeutral))) + break; + } + + return string.substring(i, length - i); +} + +int TypeAhead::handleEvent(KeyboardEvent* event, MatchModeFlags matchMode) +{ + if (event->timeStamp() < m_lastTypeTime) + return -1; + + int optionCount = m_dataSource->optionCount(); + DOMTimeStamp delta = event->timeStamp() - m_lastTypeTime; + m_lastTypeTime = event->timeStamp(); + + UChar c = event->charCode(); + + if (delta > typeAheadTimeout) + m_buffer.clear(); + m_buffer.append(c); + + if (optionCount < 1) + return -1; + + int searchStartOffset = 1; + String prefix; + if (matchMode & CycleFirstChar && c == m_repeatingChar) { + // The user is likely trying to cycle through all the items starting + // with this character, so just search on the character. + prefix = String(&c, 1); + m_repeatingChar = c; + } else if (matchMode & MatchPrefix) { + prefix = m_buffer.toString(); + if (m_buffer.length() > 1) { + m_repeatingChar = 0; + searchStartOffset = 0; + } else + m_repeatingChar = c; + } + + if (!prefix.isEmpty()) { + int selected = m_dataSource->indexOfSelectedOption(); + int index = (selected < 0 ? 0 : selected) + searchStartOffset; + index %= optionCount; + + // Compute a case-folded copy of the prefix string before beginning the search for + // a matching element. This code uses foldCase to work around the fact that + // String::startWith does not fold non-ASCII characters. This code can be changed + // to use startWith once that is fixed. + String prefixWithCaseFolded(prefix.foldCase()); + for (int i = 0; i < optionCount; ++i, index = (index + 1) % optionCount) { + // Fold the option string and check if its prefix is equal to the folded prefix. + String text = m_dataSource->optionAtIndex(index); + if (stripLeadingWhiteSpace(text).foldCase().startsWith(prefixWithCaseFolded)) + return index; + } + } + + if (matchMode & MatchIndex) { + bool ok = false; + int index = m_buffer.toString().toInt(&ok); + if (index > 0 && index <= optionCount) + return index - 1; + } + return -1; +} + +} // namespace WebCore diff --git a/Source/WebCore/html/TypeAhead.h b/Source/WebCore/html/TypeAhead.h new file mode 100644 index 000000000..22b1d9af9 --- /dev/null +++ b/Source/WebCore/html/TypeAhead.h @@ -0,0 +1,69 @@ +/* + * 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 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 TypeAhead_h +#define TypeAhead_h + +#include "DOMTimeStamp.h" +#include <wtf/text/StringBuilder.h> +#include <wtf/text/WTFString.h> + +namespace WebCore { + +class KeyboardEvent; + +class TypeAheadDataSource { +public: + virtual ~TypeAheadDataSource() { } + + virtual int indexOfSelectedOption() const = 0; + virtual int optionCount() const = 0; + virtual String optionAtIndex(int index) const = 0; +}; + +class TypeAhead { +public: + TypeAhead(TypeAheadDataSource*); + + enum ModeFlag { + MatchPrefix = 1 << 0, + CycleFirstChar = 1 << 1, + MatchIndex = 1 << 2, + }; + typedef unsigned MatchModeFlags; + + // Returns the index for the matching option. + int handleEvent(KeyboardEvent*, MatchModeFlags); + +private: + TypeAheadDataSource* m_dataSource; + DOMTimeStamp m_lastTypeTime; + UChar m_repeatingChar; + StringBuilder m_buffer; +}; + +} // namespace WebCore + +#endif // TypeAhead_h diff --git a/Source/WebCore/html/shadow/DateTimeNumericFieldElement.cpp b/Source/WebCore/html/shadow/DateTimeNumericFieldElement.cpp index eb694322d..9aaad6757 100644 --- a/Source/WebCore/html/shadow/DateTimeNumericFieldElement.cpp +++ b/Source/WebCore/html/shadow/DateTimeNumericFieldElement.cpp @@ -79,10 +79,10 @@ PassRefPtr<RenderStyle> DateTimeNumericFieldElement::customStyleForRenderer() FontCachePurgePreventer fontCachePurgePreventer; RefPtr<RenderStyle> originalStyle = document()->styleResolver()->styleForElement(this); RefPtr<RenderStyle> style = RenderStyle::clone(originalStyle.get()); - float maxiumWidth = style->font().width(m_placeholder); - maxiumWidth = std::max(maxiumWidth, style->font().width(formatValue(maximum()))); - maxiumWidth = std::max(maxiumWidth, style->font().width(value())); - style->setMinWidth(Length(maxiumWidth, Fixed)); + float maximumWidth = style->font().width(m_placeholder); + maximumWidth = std::max(maximumWidth, style->font().width(formatValue(maximum()))); + maximumWidth = std::max(maximumWidth, style->font().width(value())); + style->setMinWidth(Length(maximumWidth, Fixed)); return style.release(); } diff --git a/Source/WebCore/html/shadow/DateTimeSymbolicFieldElement.cpp b/Source/WebCore/html/shadow/DateTimeSymbolicFieldElement.cpp index 8ef4dac2f..62ad52ad9 100644 --- a/Source/WebCore/html/shadow/DateTimeSymbolicFieldElement.cpp +++ b/Source/WebCore/html/shadow/DateTimeSymbolicFieldElement.cpp @@ -55,6 +55,7 @@ DateTimeSymbolicFieldElement::DateTimeSymbolicFieldElement(Document* document, F , m_symbols(symbols) , m_visibleEmptyValue(makeVisibleEmptyValue(symbols)) , m_selectedIndex(-1) + , m_typeAhead(this) { ASSERT(!symbols.isEmpty()); setHasCustomCallbacks(); @@ -65,10 +66,10 @@ PassRefPtr<RenderStyle> DateTimeSymbolicFieldElement::customStyleForRenderer() FontCachePurgePreventer fontCachePurgePreventer; RefPtr<RenderStyle> originalStyle = document()->styleResolver()->styleForElement(this); RefPtr<RenderStyle> style = RenderStyle::clone(originalStyle.get()); - float maxiumWidth = style->font().width(visibleEmptyValue()); + float maximumWidth = style->font().width(visibleEmptyValue()); for (unsigned index = 0; index < m_symbols.size(); ++index) - maxiumWidth = std::max(maxiumWidth, style->font().width(m_symbols[index])); - style->setMinWidth(Length(maxiumWidth, Fixed)); + maximumWidth = std::max(maximumWidth, style->font().width(m_symbols[index])); + style->setMinWidth(Length(maximumWidth, Fixed)); return style.release(); } @@ -82,12 +83,11 @@ void DateTimeSymbolicFieldElement::handleKeyboardEvent(KeyboardEvent* keyboardEv return; keyboardEvent->setDefaultHandled(); - for (unsigned index = 0; index < m_symbols.size(); ++index) { - if (!m_symbols[index].isEmpty() && WTF::Unicode::toLower(m_symbols[index][0]) == charCode) { - setValueAsInteger(index, DispatchEvent); - return; - } - } + + int index = m_typeAhead.handleEvent(keyboardEvent, TypeAhead::MatchPrefix | TypeAhead::CycleFirstChar | TypeAhead::MatchIndex); + if (index < 0) + return; + setValueAsInteger(index, DispatchEvent); } bool DateTimeSymbolicFieldElement::hasValue() const @@ -150,6 +150,21 @@ String DateTimeSymbolicFieldElement::visibleValue() const return hasValue() ? m_symbols[m_selectedIndex] : visibleEmptyValue(); } +int DateTimeSymbolicFieldElement::indexOfSelectedOption() const +{ + return m_selectedIndex; +} + +int DateTimeSymbolicFieldElement::optionCount() const +{ + return m_symbols.size(); +} + +String DateTimeSymbolicFieldElement::optionAtIndex(int index) const +{ + return m_symbols[index]; +} + } // namespace WebCore #endif diff --git a/Source/WebCore/html/shadow/DateTimeSymbolicFieldElement.h b/Source/WebCore/html/shadow/DateTimeSymbolicFieldElement.h index 5c6b05acb..aa6c8da21 100644 --- a/Source/WebCore/html/shadow/DateTimeSymbolicFieldElement.h +++ b/Source/WebCore/html/shadow/DateTimeSymbolicFieldElement.h @@ -28,12 +28,13 @@ #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) #include "DateTimeFieldElement.h" +#include "TypeAhead.h" namespace WebCore { // DateTimeSymbolicFieldElement represents non-numeric field of data time // format, such as: AM/PM, and month. -class DateTimeSymbolicFieldElement : public DateTimeFieldElement { +class DateTimeSymbolicFieldElement : public DateTimeFieldElement, public TypeAheadDataSource { WTF_MAKE_NONCOPYABLE(DateTimeSymbolicFieldElement); protected: @@ -59,12 +60,18 @@ private: virtual String value() const OVERRIDE FINAL; virtual String visibleValue() const OVERRIDE FINAL; + // TypeAheadDataSource functions. + virtual int indexOfSelectedOption() const OVERRIDE; + virtual int optionCount() const OVERRIDE; + virtual String optionAtIndex(int index) const OVERRIDE; + const Vector<String> m_symbols; // We use AtomicString to share visible empty value among multiple // DateTimeEditElements in the page. const AtomicString m_visibleEmptyValue; int m_selectedIndex; + TypeAhead m_typeAhead; }; } // namespace WebCore diff --git a/Source/WebCore/html/track/LoadableTextTrack.cpp b/Source/WebCore/html/track/LoadableTextTrack.cpp index 542efbc85..b1e882fd4 100644 --- a/Source/WebCore/html/track/LoadableTextTrack.cpp +++ b/Source/WebCore/html/track/LoadableTextTrack.cpp @@ -130,7 +130,7 @@ size_t LoadableTextTrack::trackElementIndex() size_t index = 0; for (Node* node = m_trackElement->parentNode()->firstChild(); node; node = node->nextSibling()) { - if (!node->hasTagName(trackTag) || !node->inDocument()) + if (!node->hasTagName(trackTag) || !node->parentNode()) continue; if (node == m_trackElement) return index; diff --git a/Source/WebCore/inspector/Inspector.json b/Source/WebCore/inspector/Inspector.json index 635fa9415..a2094cbb9 100644 --- a/Source/WebCore/inspector/Inspector.json +++ b/Source/WebCore/inspector/Inspector.json @@ -1858,10 +1858,11 @@ { "name": "highlightNode", "parameters": [ - { "name": "nodeId", "$ref": "NodeId", "description": "Identifier of the node to highlight." }, + { "name": "nodeId", "$ref": "NodeId", "optional": true, "description": "Identifier of the node to highlight." }, + { "name": "objectId", "$ref": "Runtime.RemoteObjectId", "optional": true, "description": "JavaScript object id of the node to be highlighted." }, { "name": "highlightConfig", "$ref": "HighlightConfig", "description": "A descriptor for the highlight appearance." } ], - "description": "Highlights DOM node with given id." + "description": "Highlights DOM node with given id or with the given JavaScript object wrapper. Either nodeId or objectId must be specified." }, { "name": "hideHighlight", diff --git a/Source/WebCore/inspector/InspectorDOMAgent.cpp b/Source/WebCore/inspector/InspectorDOMAgent.cpp index 1b0893472..9b8890ac6 100644 --- a/Source/WebCore/inspector/InspectorDOMAgent.cpp +++ b/Source/WebCore/inspector/InspectorDOMAgent.cpp @@ -1066,12 +1066,19 @@ void InspectorDOMAgent::highlightRect(ErrorString*, int x, int y, int width, int m_overlay->highlightRect(adoptPtr(new IntRect(x, y, width, height)), *highlightConfig); } -void InspectorDOMAgent::highlightNode( - ErrorString* errorString, - int nodeId, - const RefPtr<InspectorObject>& highlightInspectorObject) -{ - Node* node = nodeForId(nodeId); +void InspectorDOMAgent::highlightNode(ErrorString* errorString, const int* nodeId, const String* objectId, const RefPtr<InspectorObject>& highlightInspectorObject) +{ + Node* node = 0; + if (nodeId) { + node = assertNode(errorString, *nodeId); + } else if (objectId) { + InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(*objectId); + node = injectedScript.nodeForObjectId(*objectId); + if (!node) + *errorString = "Node for given objectId not found"; + } else + *errorString = "Either nodeId or objectId must be specified"; + if (!node) return; diff --git a/Source/WebCore/inspector/InspectorDOMAgent.h b/Source/WebCore/inspector/InspectorDOMAgent.h index 3b7265283..f7cc5fb18 100644 --- a/Source/WebCore/inspector/InspectorDOMAgent.h +++ b/Source/WebCore/inspector/InspectorDOMAgent.h @@ -141,7 +141,7 @@ public: virtual void pushNodeByPathToFrontend(ErrorString*, const String& path, int* nodeId); virtual void hideHighlight(ErrorString*); virtual void highlightRect(ErrorString*, int x, int y, int width, int height, const RefPtr<InspectorObject>* color, const RefPtr<InspectorObject>* outlineColor); - virtual void highlightNode(ErrorString*, int nodeId, const RefPtr<InspectorObject>& highlightConfig); + virtual void highlightNode(ErrorString*, const int* nodeId, const String* objectId, const RefPtr<InspectorObject>& highlightConfig); virtual void highlightFrame(ErrorString*, const String& frameId, const RefPtr<InspectorObject>* color, const RefPtr<InspectorObject>* outlineColor); virtual void moveTo(ErrorString*, int nodeId, int targetNodeId, const int* anchorNodeId, int* newNodeId); virtual void undo(ErrorString*); diff --git a/Source/WebCore/inspector/front-end/ConsoleMessage.js b/Source/WebCore/inspector/front-end/ConsoleMessage.js index 39e4f6b9c..64f1ca17b 100644 --- a/Source/WebCore/inspector/front-end/ConsoleMessage.js +++ b/Source/WebCore/inspector/front-end/ConsoleMessage.js @@ -351,12 +351,7 @@ WebInspector.ConsoleMessageImpl.prototype = { if (property.type === "object" && property.subtype === "node") { span.addStyleClass("console-formatted-preview-node"); - var match = property.value.match(/([^#.]+)(#[^.]+)?(\..*)?/); - span.createChild("span", "webkit-html-tag-name").textContent = match[1]; - if (match[2]) - span.createChild("span", "webkit-html-attribute-value").textContent = match[2]; - if (match[3]) - span.createChild("span", "webkit-html-attribute-name").textContent = match[3]; + WebInspector.DOMPresentationUtils.createSpansForNodeTitle(span, property.value); return; } diff --git a/Source/WebCore/inspector/front-end/DOMAgent.js b/Source/WebCore/inspector/front-end/DOMAgent.js index ef4869383..afbbd7655 100644 --- a/Source/WebCore/inspector/front-end/DOMAgent.js +++ b/Source/WebCore/inspector/front-end/DOMAgent.js @@ -1198,17 +1198,17 @@ WebInspector.DOMAgent.prototype = { /** * @param {?number} nodeId * @param {string=} mode + * @param {RuntimeAgent.RemoteObjectId=} objectId */ - highlightDOMNode: function(nodeId, mode) + highlightDOMNode: function(nodeId, mode, objectId) { if (this._hideDOMNodeHighlightTimeout) { clearTimeout(this._hideDOMNodeHighlightTimeout); delete this._hideDOMNodeHighlightTimeout; } - this._highlightedDOMNodeId = nodeId; - if (nodeId) - DOMAgent.highlightNode(nodeId, this._buildHighlightConfig(mode)); + if (objectId || nodeId) + DOMAgent.highlightNode(objectId ? undefined : nodeId, objectId, this._buildHighlightConfig(mode)); else DOMAgent.hideHighlight(); }, diff --git a/Source/WebCore/inspector/front-end/DOMExtension.js b/Source/WebCore/inspector/front-end/DOMExtension.js index 162fa964d..5bfcd2233 100644 --- a/Source/WebCore/inspector/front-end/DOMExtension.js +++ b/Source/WebCore/inspector/front-end/DOMExtension.js @@ -195,6 +195,18 @@ Element.prototype.remove = function() this.parentElement.removeChild(this); } +/** + * @param {Node} fromNode + * @param {Node} toNode + */ +function removeSubsequentNodes(fromNode, toNode) +{ + for (var node = fromNode; node && node !== toNode; ) { + var nodeToRemove = node; + node = node.nextSibling; + nodeToRemove.remove(); + } +} /** * @constructor diff --git a/Source/WebCore/inspector/front-end/DOMPresentationUtils.js b/Source/WebCore/inspector/front-end/DOMPresentationUtils.js index 905b78f9f..d70569dbe 100644 --- a/Source/WebCore/inspector/front-end/DOMPresentationUtils.js +++ b/Source/WebCore/inspector/front-end/DOMPresentationUtils.js @@ -76,6 +76,20 @@ WebInspector.DOMPresentationUtils.decorateNodeLabel = function(node, parentEleme parentElement.title = title; } +/** + * @param {Element} container + * @param {string} nodeTitle + */ +WebInspector.DOMPresentationUtils.createSpansForNodeTitle = function(container, nodeTitle) +{ + var match = nodeTitle.match(/([^#.]+)(#[^.]+)?(\..*)?/); + container.createChild("span", "webkit-html-tag-name").textContent = match[1]; + if (match[2]) + container.createChild("span", "webkit-html-attribute-value").textContent = match[2]; + if (match[3]) + container.createChild("span", "webkit-html-attribute-name").textContent = match[3]; +} + WebInspector.DOMPresentationUtils.linkifyNodeReference = function(node) { var link = document.createElement("span"); diff --git a/Source/WebCore/inspector/front-end/DefaultTextEditor.js b/Source/WebCore/inspector/front-end/DefaultTextEditor.js index 08f48e08f..458e54552 100644 --- a/Source/WebCore/inspector/front-end/DefaultTextEditor.js +++ b/Source/WebCore/inspector/front-end/DefaultTextEditor.js @@ -2415,13 +2415,28 @@ WebInspector.TextEditorMainPanel.prototype = { // Remove damaged chunks from DOM and from textChunks model. var lastUndamagedChunk = firstDamagedChunkNumber > 0 ? this._textChunks[firstDamagedChunkNumber - 1] : null; var firstUndamagedChunk = lastDamagedChunkNumber + 1 < this._textChunks.length ? this._textChunks[lastDamagedChunkNumber + 1] : null; + var removeDOMFromNode = lastUndamagedChunk ? lastUndamagedChunk.lastElement().nextSibling : this._container.firstChild; var removeDOMToNode = firstUndamagedChunk ? firstUndamagedChunk.firstElement() : null; - for (var node = removeDOMFromNode; node && node !== removeDOMToNode; ) { - var nodeToRemove = node; - node = node.nextSibling; - nodeToRemove.remove(); + + // Fast case - patch single expanded chunk that did not grow / shrink during edit. + if (!linesDiff && firstDamagedChunk === lastDamagedChunk && firstDamagedChunk._expandedLineRows) { + var lastUndamagedLineRow = lastDamagedChunk.expandedLineRow(oldRange.startLine - 1); + var firstUndamagedLineRow = firstDamagedChunk.expandedLineRow(oldRange.endLine + 1); + var localRemoveDOMFromNode = lastUndamagedLineRow ? lastUndamagedLineRow.nextSibling : removeDOMFromNode; + var localRemoveDOMToNode = firstUndamagedLineRow || removeDOMToNode; + removeSubsequentNodes(localRemoveDOMFromNode, localRemoveDOMToNode); + for (var i = newRange.startLine; i < newRange.endLine + 1; ++i) { + var row = firstDamagedChunk._createRow(i); + firstDamagedChunk._expandedLineRows[i - firstDamagedChunk.startLine] = row; + this._container.insertBefore(row, localRemoveDOMToNode); + } + firstDamagedChunk.updateCollapsedLineRow(); + this._assertDOMMatchesTextModel(); + return; } + + removeSubsequentNodes(removeDOMFromNode, removeDOMToNode); this._textChunks.splice(firstDamagedChunkNumber, lastDamagedChunkNumber - firstDamagedChunkNumber + 1); // Compute damaged chunks span diff --git a/Source/WebCore/inspector/front-end/MemoryStatistics.js b/Source/WebCore/inspector/front-end/MemoryStatistics.js index d44cc65d0..aa83b1f01 100644 --- a/Source/WebCore/inspector/front-end/MemoryStatistics.js +++ b/Source/WebCore/inspector/front-end/MemoryStatistics.js @@ -314,10 +314,11 @@ WebInspector.MemoryStatistics.prototype = { _onClick: function(event) { - var x = event.x - event.target.offsetParent.offsetLeft + var x = event.x - event.target.offsetParent.offsetLeft; var i = this._recordIndexAt(x); var counter = this._counters[i]; - this._timelinePanel.revealRecordAt(counter.time / 1000); + if (counter) + this._timelinePanel.revealRecordAt(counter.time / 1000); }, _onMouseOut: function(event) diff --git a/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js b/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js index a9d046c3f..d43099c97 100644 --- a/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js +++ b/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js @@ -55,22 +55,49 @@ WebInspector.NativeMemorySnapshotView.prototype = { WebInspector.NativeSnapshotDataGrid = function(profile) { var columns = { - object: { title: WebInspector.UIString("Object"), width: "200px", disclosure: true, sortable: false }, - size: { title: WebInspector.UIString("Size"), sortable: false }, + name: { title: WebInspector.UIString("Object"), width: "200px", disclosure: true, sortable: true }, + size: { title: WebInspector.UIString("Size"), sortable: true, sort: "descending" }, }; WebInspector.DataGrid.call(this, columns); - var totalNode = new WebInspector.NativeSnapshotNode(profile, profile); + this._totalNode = new WebInspector.NativeSnapshotNode(profile, profile); if (WebInspector.settings.showNativeSnapshotUninstrumentedSize.get()) { this.setRootNode(new WebInspector.DataGridNode(null, true)); - this.rootNode().appendChild(totalNode) - totalNode.expand(); + this.rootNode().appendChild(this._totalNode) + this._totalNode.expand(); } else { - this.setRootNode(totalNode); - totalNode._populate(); + this.setRootNode(this._totalNode); + this._totalNode._populate(); } + this.addEventListener("sorting changed", this.sortingChanged.bind(this), this); } WebInspector.NativeSnapshotDataGrid.prototype = { + sortingChanged: function() + { + var expandedNodes = {}; + this._totalNode._storeState(expandedNodes); + this._totalNode.removeChildren(); + this._totalNode._populate(); + this._totalNode._shouldRefreshChildren = true; + this._totalNode._restoreState(expandedNodes); + }, + + /** + * @param {MemoryAgent.MemoryBlock} nodeA + * @param {MemoryAgent.MemoryBlock} nodeB + */ + _sortingFunction: function(nodeA, nodeB) + { + var sortColumnIdentifier = this.sortColumnIdentifier; + var sortAscending = this.sortOrder === "ascending"; + var field1 = nodeA[sortColumnIdentifier]; + var field2 = nodeB[sortColumnIdentifier]; + var result = field1 < field2 ? -1 : (field1 > field2 ? 1 : 0); + if (!sortAscending) + result = -result; + return result; + }, + __proto__: WebInspector.DataGrid.prototype } @@ -85,7 +112,7 @@ WebInspector.NativeSnapshotNode = function(nodeData, profile) this._nodeData = nodeData; this._profile = profile; var viewProperties = WebInspector.MemoryBlockViewProperties._forMemoryBlock(nodeData); - var data = { object: viewProperties._description, size: this._nodeData.size }; + var data = { name: viewProperties._description, size: this._nodeData.size }; var hasChildren = !!nodeData.children && nodeData.children.length !== 0; WebInspector.DataGridNode.call(this, data, hasChildren); this.addEventListener("populate", this._populate, this); @@ -106,6 +133,40 @@ WebInspector.NativeSnapshotNode.prototype = { }, /** + * @param {Object} expandedNodes + */ + _storeState: function(expandedNodes) + { + if (!this.expanded) + return; + expandedNodes[this.uid()] = true; + for (var i in this.children) + this.children[i]._storeState(expandedNodes); + }, + + /** + * @param {Object} expandedNodes + */ + _restoreState: function(expandedNodes) + { + if (!expandedNodes[this.uid()]) + return; + this.expand(); + for (var i in this.children) + this.children[i]._restoreState(expandedNodes); + }, + + /** + * @return {string} + */ + uid: function() + { + if (!this._uid) + this._uid = (!this.parent || !this.parent.uid ? "" : this.parent.uid() || "") + "/" + this._nodeData.name; + return this._uid; + }, + + /** * @param {string} columnIdentifier * @return {Element} */ @@ -121,7 +182,7 @@ WebInspector.NativeSnapshotNode.prototype = { node = node.parent; } - var sizeKiB = this._nodeData.size / 1024; + var sizeKB = this._nodeData.size / 1024; var totalSize = this._profile.size; var percentage = this._nodeData.size / totalSize * 100; @@ -129,7 +190,7 @@ WebInspector.NativeSnapshotNode.prototype = { cell.className = columnIdentifier + "-column"; var textDiv = document.createElement("div"); - textDiv.textContent = Number.withThousandsSeparator(sizeKiB.toFixed(0)) + "\u2009" + WebInspector.UIString("KiB"); + textDiv.textContent = Number.withThousandsSeparator(sizeKB.toFixed(0)) + "\u2009" + WebInspector.UIString("KB"); textDiv.className = "size-text"; cell.appendChild(textDiv); @@ -157,11 +218,7 @@ WebInspector.NativeSnapshotNode.prototype = { _populate: function() { this.removeEventListener("populate", this._populate, this); - function comparator(a, b) { - return b.size - a.size; - } - if (this._nodeData !== this._profile) - this._nodeData.children.sort(comparator); + this._nodeData.children.sort(this.dataGrid._sortingFunction.bind(this.dataGrid)); for (var node in this._nodeData.children) { var nodeData = this._nodeData.children[node]; if (WebInspector.settings.showNativeSnapshotUninstrumentedSize.get() || nodeData.name !== "Other") diff --git a/Source/WebCore/inspector/front-end/NavigatorView.js b/Source/WebCore/inspector/front-end/NavigatorView.js index c9103bba2..b740bbf68 100644 --- a/Source/WebCore/inspector/front-end/NavigatorView.js +++ b/Source/WebCore/inspector/front-end/NavigatorView.js @@ -479,6 +479,8 @@ WebInspector.BaseNavigatorTreeElement.prototype = { set titleText(titleText) { + if (this._titleText === titleText) + return; this._titleText = titleText || ""; if (this.titleElement) this.titleElement.textContent = this._titleText; diff --git a/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js b/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js index bcbf01386..e4be780f9 100644 --- a/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js +++ b/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js @@ -234,7 +234,7 @@ WebInspector.ObjectPropertyTreeElement.prototype = { } else if (this.property.value.type === "function" && typeof description === "string") { this.valueElement.textContent = /.*/.exec(description)[0].replace(/ +$/g, ""); this.valueElement._originalTextContent = description; - } else + } else if (this.property.value.type !== "object" || this.property.value.subtype !== "node") this.valueElement.textContent = description; if (this.property.wasThrown) @@ -245,7 +245,12 @@ WebInspector.ObjectPropertyTreeElement.prototype = { this.valueElement.addStyleClass("console-formatted-" + this.property.value.type); this.valueElement.addEventListener("contextmenu", this._contextMenuFired.bind(this, this.property.value), false); - this.valueElement.title = description || ""; + if (this.property.value.type === "object" && this.property.value.subtype === "node") { + WebInspector.DOMPresentationUtils.createSpansForNodeTitle(this.valueElement, this.property.value.description); + this.valueElement.addEventListener("mousemove", this._mouseMove.bind(this, this.property.value), false); + this.valueElement.addEventListener("mouseout", this._mouseOut.bind(this, this.property.value), false); + } else + this.valueElement.title = description || ""; this.listItemElement.removeChildren(); @@ -270,6 +275,16 @@ WebInspector.ObjectPropertyTreeElement.prototype = { { }, + _mouseMove: function(event) + { + this.property.value.highlightAsDOMNode(); + }, + + _mouseOut: function(event) + { + this.property.value.hideDOMNodeHighlight(); + }, + updateSiblings: function() { if (this.parent.root) diff --git a/Source/WebCore/inspector/front-end/RemoteObject.js b/Source/WebCore/inspector/front-end/RemoteObject.js index 3f080b352..35cbf1b6b 100644 --- a/Source/WebCore/inspector/front-end/RemoteObject.js +++ b/Source/WebCore/inspector/front-end/RemoteObject.js @@ -288,6 +288,16 @@ WebInspector.RemoteObject.prototype = { callback(0); }, + highlightAsDOMNode: function() + { + WebInspector.domAgent.highlightDOMNode(undefined, undefined, this._objectId); + }, + + hideDOMNodeHighlight: function() + { + WebInspector.domAgent.hideDOMNodeHighlight(); + }, + /** * @param {function(this:Object)} functionDeclaration * @param {Array.<RuntimeAgent.CallArgument>=} args diff --git a/Source/WebCore/inspector/front-end/TabbedPane.js b/Source/WebCore/inspector/front-end/TabbedPane.js index 18ba6186d..817b0539e 100644 --- a/Source/WebCore/inspector/front-end/TabbedPane.js +++ b/Source/WebCore/inspector/front-end/TabbedPane.js @@ -598,6 +598,8 @@ WebInspector.TabbedPaneTab.prototype = { set title(title) { + if (title === this._title) + return; this._title = title; if (this._titleElement) this._titleElement.textContent = title; diff --git a/Source/WebCore/inspector/front-end/TestController.js b/Source/WebCore/inspector/front-end/TestController.js index b46026199..bb400ed32 100644 --- a/Source/WebCore/inspector/front-end/TestController.js +++ b/Source/WebCore/inspector/front-end/TestController.js @@ -45,7 +45,7 @@ WebInspector.TestController.prototype = { WebInspector.evaluateForTestInFrontend = function(callId, script) { - WebInspector.isUnderTest = true; + window.isUnderTest = true; function invokeMethod() { try { diff --git a/Source/WebCore/inspector/front-end/externs.js b/Source/WebCore/inspector/front-end/externs.js index be792be6d..8c5a4ef8a 100644 --- a/Source/WebCore/inspector/front-end/externs.js +++ b/Source/WebCore/inspector/front-end/externs.js @@ -65,6 +65,8 @@ function postMessage(message) {} /** @type {*} */ window.testRunner = null; +window.isUnderTest = false; + /** * @constructor */ diff --git a/Source/WebCore/inspector/front-end/inspector.css b/Source/WebCore/inspector/front-end/inspector.css index 54bb4695b..d0fab33ba 100644 --- a/Source/WebCore/inspector/front-end/inspector.css +++ b/Source/WebCore/inspector/front-end/inspector.css @@ -1141,6 +1141,10 @@ ol.watch-expressions > li.hovered { color: black; } +.console-formatted-node:hover { + background-color: rgba(56, 121, 217, 0.1); +} + .console-formatted-object .section, .console-formatted-node .section, .console-formatted-array .section { position: static; } diff --git a/Source/WebCore/inspector/front-end/utilities.js b/Source/WebCore/inspector/front-end/utilities.js index 043e886e9..b4bbec510 100644 --- a/Source/WebCore/inspector/front-end/utilities.js +++ b/Source/WebCore/inspector/front-end/utilities.js @@ -861,6 +861,7 @@ function importScript(scriptName) window.eval(xhr.responseText + "\n//@ sourceURL=" + scriptName); } +window.isUnderTest = false; /** * Mutation observers leak memory. Keep track of them and disconnect @@ -872,7 +873,7 @@ function NonLeakingMutationObserver(handler) { this._observer = new WebKitMutationObserver(handler); NonLeakingMutationObserver._instances.push(this); - if (!window.testRunner && !WebInspector.isUnderTest && !NonLeakingMutationObserver._unloadListener) { + if (!window.testRunner && !window.isUnderTest && !NonLeakingMutationObserver._unloadListener) { NonLeakingMutationObserver._unloadListener = function() { while (NonLeakingMutationObserver._instances.length) NonLeakingMutationObserver._instances[NonLeakingMutationObserver._instances.length - 1].disconnect(); diff --git a/Source/WebCore/loader/CookieJar.cpp b/Source/WebCore/loader/CookieJar.cpp index 80ff5fb59..f4f3a7a16 100644 --- a/Source/WebCore/loader/CookieJar.cpp +++ b/Source/WebCore/loader/CookieJar.cpp @@ -30,6 +30,11 @@ #include "Frame.h" #include "PlatformCookieJar.h" +#if USE(PLATFORM_STRATEGIES) +#include "CookiesStrategy.h" +#include "PlatformStrategies.h" +#endif + #if PLATFORM(BLACKBERRY) #error Blackberry currently uses a fork of this file because of layering violations #endif @@ -51,47 +56,83 @@ static NetworkingContext* networkingContext(const Document* document) String cookies(const Document* document, const KURL& url) { +#if USE(PLATFORM_STRATEGIES) + return platformStrategies()->cookiesStrategy()->cookiesForDOM(networkingContext(document), document->firstPartyForCookies(), url); +#else return cookiesForDOM(networkingContext(document), document->firstPartyForCookies(), url); +#endif } void setCookies(Document* document, const KURL& url, const String& cookieString) { +#if USE(PLATFORM_STRATEGIES) + platformStrategies()->cookiesStrategy()->setCookiesFromDOM(networkingContext(document), document->firstPartyForCookies(), url, cookieString); +#else setCookiesFromDOM(networkingContext(document), document->firstPartyForCookies(), url, cookieString); +#endif } bool cookiesEnabled(const Document* document) { +#if USE(PLATFORM_STRATEGIES) + return platformStrategies()->cookiesStrategy()->cookiesEnabled(networkingContext(document), document->firstPartyForCookies(), document->cookieURL()); +#else return cookiesEnabled(networkingContext(document), document->firstPartyForCookies(), document->cookieURL()); +#endif } String cookieRequestHeaderFieldValue(const Document* document, const KURL& url) { +#if USE(PLATFORM_STRATEGIES) + return platformStrategies()->cookiesStrategy()->cookieRequestHeaderFieldValue(networkingContext(document), document->firstPartyForCookies(), url); +#else return cookieRequestHeaderFieldValue(networkingContext(document), document->firstPartyForCookies(), url); +#endif } bool getRawCookies(const Document* document, const KURL& url, Vector<Cookie>& cookies) { +#if USE(PLATFORM_STRATEGIES) + return platformStrategies()->cookiesStrategy()->getRawCookies(networkingContext(document), document->firstPartyForCookies(), url, cookies); +#else return getRawCookies(networkingContext(document), document->firstPartyForCookies(), url, cookies); +#endif } void deleteCookie(const Document* document, const KURL& url, const String& cookieName) { +#if USE(PLATFORM_STRATEGIES) + platformStrategies()->cookiesStrategy()->deleteCookie(networkingContext(document), url, cookieName); +#else deleteCookie(networkingContext(document), url, cookieName); +#endif } void getHostnamesWithCookies(HashSet<String>& hostnames) { +#if USE(PLATFORM_STRATEGIES) + platformStrategies()->cookiesStrategy()->getHostnamesWithCookies(0, hostnames); +#else getHostnamesWithCookies(0, hostnames); +#endif } void deleteCookiesForHostname(const String& hostname) { +#if USE(PLATFORM_STRATEGIES) + platformStrategies()->cookiesStrategy()->deleteCookiesForHostname(0, hostname); +#else deleteCookiesForHostname(0, hostname); +#endif } void deleteAllCookies() { +#if USE(PLATFORM_STRATEGIES) + platformStrategies()->cookiesStrategy()->deleteAllCookies(0); +#else deleteAllCookies(0); +#endif } } diff --git a/Source/WebCore/page/Settings.cpp b/Source/WebCore/page/Settings.cpp index 9378c48de..b274e758f 100644 --- a/Source/WebCore/page/Settings.cpp +++ b/Source/WebCore/page/Settings.cpp @@ -164,9 +164,6 @@ Settings::Settings(Page* page) #if ENABLE(CSS_STICKY_POSITION) , m_cssStickyPositionEnabled(true) #endif -#if ENABLE(CSS_REGIONS) - , m_cssRegionsEnabled(false) -#endif #if ENABLE(CSS_VARIABLES) , m_cssVariablesEnabled(false) #endif diff --git a/Source/WebCore/page/Settings.h b/Source/WebCore/page/Settings.h index a86555046..7513ba35a 100644 --- a/Source/WebCore/page/Settings.h +++ b/Source/WebCore/page/Settings.h @@ -224,14 +224,6 @@ namespace WebCore { bool cssStickyPositionEnabled() const { return false; } #endif -#if ENABLE(CSS_REGIONS) - void setCSSRegionsEnabled(bool enabled) { m_cssRegionsEnabled = enabled; } - bool cssRegionsEnabled() const { return m_cssRegionsEnabled; } -#else - void setCSSRegionsEnabled(bool) { } - bool cssRegionsEnabled() const { return false; } -#endif - #if ENABLE(CSS_VARIABLES) void setCSSVariablesEnabled(bool enabled) { m_cssVariablesEnabled = enabled; } bool cssVariablesEnabled() const { return m_cssVariablesEnabled; } @@ -349,9 +341,6 @@ namespace WebCore { bool m_isCSSCustomFilterEnabled : 1; #if ENABLE(CSS_STICKY_POSITION) bool m_cssStickyPositionEnabled : 1; -#endif -#if ENABLE(CSS_REGIONS) - bool m_cssRegionsEnabled : 1; #endif #if ENABLE(CSS_VARIABLES) bool m_cssVariablesEnabled : 1; diff --git a/Source/WebCore/platform/Cookie.h b/Source/WebCore/platform/Cookie.h index cf3534210..27f670d97 100644 --- a/Source/WebCore/platform/Cookie.h +++ b/Source/WebCore/platform/Cookie.h @@ -35,6 +35,8 @@ namespace WebCore { // to the Web Inspector. struct Cookie { + Cookie() { } + Cookie(const String& name, const String& value, const String& domain, const String& path, double expires, bool httpOnly, bool secure, bool session) diff --git a/Source/WebCore/platform/CookiesStrategy.h b/Source/WebCore/platform/CookiesStrategy.h index 602825730..158d8b6c0 100644 --- a/Source/WebCore/platform/CookiesStrategy.h +++ b/Source/WebCore/platform/CookiesStrategy.h @@ -28,7 +28,10 @@ #if USE(PLATFORM_STRATEGIES) +#include <wtf/HashSet.h> #include <wtf/RetainPtr.h> +#include <wtf/Vector.h> +#include <wtf/text/WTFString.h> #if PLATFORM(MAC) || USE(CFNETWORK) typedef struct OpaqueCFHTTPCookieStorage* CFHTTPCookieStorageRef; @@ -36,6 +39,10 @@ typedef struct OpaqueCFHTTPCookieStorage* CFHTTPCookieStorageRef; namespace WebCore { +class KURL; +class NetworkingContext; +struct Cookie; + class CookiesStrategy { public: virtual void notifyCookiesChanged() = 0; @@ -44,6 +51,16 @@ public: virtual RetainPtr<CFHTTPCookieStorageRef> defaultCookieStorage() = 0; #endif + virtual String cookiesForDOM(NetworkingContext*, const KURL& firstParty, const KURL&) = 0; + virtual void setCookiesFromDOM(NetworkingContext*, const KURL& firstParty, const KURL&, const String& cookieString) = 0; + virtual bool cookiesEnabled(NetworkingContext*, const KURL& firstParty, const KURL&) = 0; + virtual String cookieRequestHeaderFieldValue(NetworkingContext*, const KURL& firstParty, const KURL&) = 0; + virtual bool getRawCookies(NetworkingContext*, const KURL& firstParty, const KURL&, Vector<Cookie>&) = 0; + virtual void deleteCookie(NetworkingContext*, const KURL&, const String& cookieName) = 0; + virtual void getHostnamesWithCookies(NetworkingContext*, HashSet<String>& hostnames) = 0; + virtual void deleteCookiesForHostname(NetworkingContext*, const String& hostname) = 0; + virtual void deleteAllCookies(NetworkingContext*) = 0; + protected: virtual ~CookiesStrategy() { } }; diff --git a/Source/WebCore/platform/blackberry/CookieManager.cpp b/Source/WebCore/platform/blackberry/CookieManager.cpp index 1377658ad..b4dd0ef6c 100644 --- a/Source/WebCore/platform/blackberry/CookieManager.cpp +++ b/Source/WebCore/platform/blackberry/CookieManager.cpp @@ -502,16 +502,18 @@ void CookieManager::getBackingStoreCookies() } } -void CookieManager::setPrivateMode(bool mode) +void CookieManager::setPrivateMode(bool privateMode) { - if (m_privateMode == mode) + if (m_privateMode == privateMode) return; - m_privateMode = mode; - if (!mode) { - removeAllCookies(DoNotRemoveFromBackingStore); + m_privateMode = privateMode; + + removeAllCookies(DoNotRemoveFromBackingStore); + + // If we are switching back to public mode, reload the database to memory. + if (!m_privateMode) getBackingStoreCookies(); - } } CookieMap* CookieManager::findOrCreateCookieMap(CookieMap* protocolMap, const ParsedCookie& candidateCookie) diff --git a/Source/WebCore/platform/blackberry/RenderThemeBlackBerry.cpp b/Source/WebCore/platform/blackberry/RenderThemeBlackBerry.cpp index 0e22fd065..975d1e4f0 100644 --- a/Source/WebCore/platform/blackberry/RenderThemeBlackBerry.cpp +++ b/Source/WebCore/platform/blackberry/RenderThemeBlackBerry.cpp @@ -123,7 +123,6 @@ const RGBA32 dragRollDark = 0xff69a8ff; const RGBA32 blackPen = Color::black; const RGBA32 focusRingPen = 0xffa3c8fe; -const RGBA32 activeTextColor = 0xfffafafa; float RenderThemeBlackBerry::defaultFontSize = 16; @@ -617,7 +616,6 @@ bool RenderThemeBlackBerry::paintButton(RenderObject* object, const PaintInfo& i drawNineSlice(context, rect, ctm.xScale(), disabled.get(), largeSlice); } else if (isPressed(object)) { drawNineSlice(context, rect, ctm.xScale(), pressed.get(), largeSlice); - object->style()->setTextFillColor(activeTextColor); } else drawNineSlice(context, rect, ctm.xScale(), inactive.get(), largeSlice); @@ -664,10 +662,9 @@ bool RenderThemeBlackBerry::paintMenuList(RenderObject* object, const PaintInfo& drawNineSlice(context, rect, ctm.xScale(), inactive.get(), largeSlice); drawNineSlice(context, rect, ctm.xScale(), disabled.get(), largeSlice); drawControl(context, tmpRect, arrowUp.get()); // FIXME: should have a disabled image. - } else if (isFocused(object)) { + } else if (isPressed(object)) { drawNineSlice(context, rect, ctm.xScale(), pressed.get(), largeSlice); drawControl(context, tmpRect, arrowUpPressed.get()); - object->style()->setTextFillColor(activeTextColor); } else { drawNineSlice(context, rect, ctm.xScale(), inactive.get(), largeSlice); drawControl(context, tmpRect, arrowUp.get()); diff --git a/Source/WebCore/platform/graphics/Color.cpp b/Source/WebCore/platform/graphics/Color.cpp index 6df62096a..f3cddc5f3 100644 --- a/Source/WebCore/platform/graphics/Color.cpp +++ b/Source/WebCore/platform/graphics/Color.cpp @@ -419,7 +419,7 @@ Color colorFromPremultipliedARGB(unsigned pixelColor) Color color; if (unsigned alpha = (pixelColor & 0xFF000000) >> 24) { - color = Color::createUnCheked( + color = Color::createUnchecked( ((pixelColor & 0x00FF0000) >> 16) * 255 / alpha, ((pixelColor & 0x0000FF00) >> 8) * 255 / alpha, (pixelColor & 0x000000FF) * 255 / alpha, diff --git a/Source/WebCore/platform/graphics/Color.h b/Source/WebCore/platform/graphics/Color.h index a2e48daa6..9b51ff790 100644 --- a/Source/WebCore/platform/graphics/Color.h +++ b/Source/WebCore/platform/graphics/Color.h @@ -89,12 +89,12 @@ public: explicit Color(const String&); explicit Color(const char*); - static Color createUnCheked(int r, int g, int b) + static Color createUnchecked(int r, int g, int b) { RGBA32 color = 0xFF000000 | r << 16 | g << 8 | b; return Color(color); } - static Color createUnCheked(int r, int g, int b, int a) + static Color createUnchecked(int r, int g, int b, int a) { RGBA32 color = a << 24 | r << 16 | g << 8 | b; return Color(color); diff --git a/Source/WebCore/platform/graphics/ca/mac/LayerPool.h b/Source/WebCore/platform/graphics/ca/mac/LayerPool.h new file mode 100644 index 000000000..2e7f378a9 --- /dev/null +++ b/Source/WebCore/platform/graphics/ca/mac/LayerPool.h @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2012 Apple 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 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 LayerPool_h +#define LayerPool_h + +#include "IntSize.h" +#include "IntSizeHash.h" +#include "Timer.h" +#include <wtf/Deque.h> +#include <wtf/HashMap.h> +#include <wtf/OwnPtr.h> +#include <wtf/RetainPtr.h> +#include <wtf/Vector.h> + +@class WebTileLayer; + +namespace WebCore { + +class LayerPool { + WTF_MAKE_NONCOPYABLE(LayerPool); +public: + static LayerPool* sharedPool(); + + void addLayer(const RetainPtr<WebTileLayer>&); + RetainPtr<WebTileLayer> takeLayerWithSize(const IntSize&); + + void drain(); + + // The maximum size of all queued layers in bytes. + unsigned capacity() const { return m_maxBytesForPool; } + +private: + LayerPool(); + + typedef Deque<RetainPtr<WebTileLayer> > LayerList; + + unsigned decayedCapacity() const; + + bool canReuseLayerWithSize(const IntSize& size) const { return m_maxBytesForPool && !size.isEmpty(); } + void schedulePrune(); + void pruneTimerFired(Timer<LayerPool>*); + + typedef enum { LeaveUnchanged, MarkAsUsed } AccessType; + LayerList& listOfLayersWithSize(const IntSize&, AccessType = LeaveUnchanged); + + static unsigned backingStoreBytesForSize(const IntSize&); + + HashMap<IntSize, LayerList> m_reuseLists; + // Ordered by recent use. The last size is the most recently used. + Vector<IntSize> m_sizesInPruneOrder; + unsigned m_totalBytes; + unsigned m_maxBytesForPool; + + Timer<LayerPool> m_pruneTimer; + + double m_lastAddTime; +}; + +} + +#endif diff --git a/Source/WebCore/platform/graphics/ca/mac/LayerPool.mm b/Source/WebCore/platform/graphics/ca/mac/LayerPool.mm new file mode 100644 index 000000000..a845b1efc --- /dev/null +++ b/Source/WebCore/platform/graphics/ca/mac/LayerPool.mm @@ -0,0 +1,139 @@ +/* + * Copyright (C) 2012 Apple 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 APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "LayerPool.h" + +#include "Logging.h" +#include "WebTileLayer.h" +#include <wtf/CurrentTime.h> + +namespace WebCore { + +static const double capacityDecayTime = 5; + +LayerPool::LayerPool() + : m_totalBytes(0) + , m_maxBytesForPool(48 * 1024 * 1024) + , m_pruneTimer(this, &LayerPool::pruneTimerFired) + , m_lastAddTime(0) +{ +} + +LayerPool* LayerPool::sharedPool() +{ + static LayerPool* sharedPool = new LayerPool; + return sharedPool; +} + +unsigned LayerPool::backingStoreBytesForSize(const IntSize& size) +{ + return size.width() * size.height() * 4; +} + +LayerPool::LayerList& LayerPool::listOfLayersWithSize(const IntSize& size, AccessType accessType) +{ + HashMap<IntSize, LayerList>::iterator it = m_reuseLists.find(size); + if (it == m_reuseLists.end()) { + it = m_reuseLists.add(size, LayerList()).iterator; + m_sizesInPruneOrder.append(size); + } else if (accessType == MarkAsUsed) { + m_sizesInPruneOrder.remove(m_sizesInPruneOrder.reverseFind(size)); + m_sizesInPruneOrder.append(size); + } + return it->value; +} + +void LayerPool::addLayer(const RetainPtr<WebTileLayer>& layer) +{ + IntSize layerSize([layer.get() bounds].size); + if (!canReuseLayerWithSize(layerSize)) + return; + + listOfLayersWithSize(layerSize).prepend(layer); + m_totalBytes += backingStoreBytesForSize(layerSize); + + m_lastAddTime = currentTime(); + schedulePrune(); +} + +RetainPtr<WebTileLayer> LayerPool::takeLayerWithSize(const IntSize& size) +{ + if (!canReuseLayerWithSize(size)) + return nil; + LayerList& reuseList = listOfLayersWithSize(size, MarkAsUsed); + if (reuseList.isEmpty()) + return nil; + m_totalBytes -= backingStoreBytesForSize(size); + return reuseList.takeFirst(); +} + +unsigned LayerPool::decayedCapacity() const +{ + // Decay to one quarter over capacityDecayTime + double timeSinceLastAdd = currentTime() - m_lastAddTime; + if (timeSinceLastAdd > capacityDecayTime) + return m_maxBytesForPool / 4; + float decayProgess = float(timeSinceLastAdd / capacityDecayTime); + return m_maxBytesForPool / 4 + m_maxBytesForPool * 3 / 4 * (1 - decayProgess); +} + +void LayerPool::schedulePrune() +{ + if (m_pruneTimer.isActive()) + return; + m_pruneTimer.startOneShot(0); +} + +void LayerPool::pruneTimerFired(Timer<LayerPool>*) +{ + unsigned shrinkTo = decayedCapacity(); + while (m_totalBytes > shrinkTo) { + ASSERT(!m_sizesInPruneOrder.isEmpty()); + IntSize sizeToDrop = m_sizesInPruneOrder.first(); + LayerList& oldestReuseList = m_reuseLists.find(sizeToDrop)->value; + if (oldestReuseList.isEmpty()) { + m_reuseLists.remove(sizeToDrop); + m_sizesInPruneOrder.remove(0); + continue; + } + + m_totalBytes -= backingStoreBytesForSize(sizeToDrop); + // The last element in the list is the oldest, hence most likely not to + // still have a backing store. + oldestReuseList.remove(--oldestReuseList.end()); + } + if (currentTime() - m_lastAddTime <= capacityDecayTime) + schedulePrune(); +} + +void LayerPool::drain() +{ + m_reuseLists.clear(); + m_sizesInPruneOrder.clear(); + m_totalBytes = 0; +} + +} diff --git a/Source/WebCore/platform/graphics/ca/mac/TileCache.mm b/Source/WebCore/platform/graphics/ca/mac/TileCache.mm index e26b01405..233352d57 100644 --- a/Source/WebCore/platform/graphics/ca/mac/TileCache.mm +++ b/Source/WebCore/platform/graphics/ca/mac/TileCache.mm @@ -29,6 +29,7 @@ #import "IntRect.h" #import "PlatformCALayer.h" #import "Region.h" +#import "LayerPool.h" #import "WebLayer.h" #import "WebTileCacheLayer.h" #import "WebTileLayer.h" @@ -419,7 +420,7 @@ void TileCache::revalidateTiles() // the tiles that are outside the coverage rect. When we know that we're going to be scrolling up, // we might want to remove the ones below the coverage rect but keep the ones above. for (size_t i = 0; i < tilesToRemove.size(); ++i) - m_tiles.remove(tilesToRemove[i]); + LayerPool::sharedPool()->addLayer(m_tiles.take(tilesToRemove[i])); TileIndex topLeft; TileIndex bottomRight; @@ -487,7 +488,13 @@ WebTileLayer* TileCache::tileLayerAtIndex(const TileIndex& index) const RetainPtr<WebTileLayer> TileCache::createTileLayer(const IntRect& tileRect) { - RetainPtr<WebTileLayer> layer = adoptNS([[WebTileLayer alloc] init]); + RetainPtr<WebTileLayer> layer = LayerPool::sharedPool()->takeLayerWithSize(tileRect.size()); + if (layer) { + // If we were able to restore a layer from the LayerPool, we should call setNeedsDisplay to + // ensure we avoid stale content. + [layer setNeedsDisplay]; + } else + layer = adoptNS([[WebTileLayer alloc] init]); [layer.get() setAnchorPoint:CGPointZero]; [layer.get() setFrame:tileRect]; [layer.get() setTileCache:this]; diff --git a/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp b/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp index 7033fa6da..8ba049b17 100644 --- a/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp +++ b/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp @@ -179,7 +179,8 @@ bool GraphicsContext3D::getImageData(Image* image, unsigned int format, unsigned OwnPtr<NativeImageCairo> nativeImage = adoptPtr(decoder.createFrameAtIndex(0)); imageSurface = nativeImage->surface(); } else { - imageSurface = image->nativeImageForCurrentFrame()->surface(); + NativeImageCairo* nativeImage = image->nativeImageForCurrentFrame(); + imageSurface = (nativeImage) ? nativeImage->surface() : 0; if (!premultiplyAlpha) alphaOp = AlphaDoUnmultiply; } diff --git a/Source/WebCore/platform/graphics/filters/skia/FEBlendSkia.cpp b/Source/WebCore/platform/graphics/filters/skia/FEBlendSkia.cpp index b597ba2ae..cdda2cb5e 100644 --- a/Source/WebCore/platform/graphics/filters/skia/FEBlendSkia.cpp +++ b/Source/WebCore/platform/graphics/filters/skia/FEBlendSkia.cpp @@ -72,8 +72,14 @@ bool FEBlend::platformApplySkia() RefPtr<Image> foreground = in->asImageBuffer()->copyImage(DontCopyBackingStore); RefPtr<Image> background = in2->asImageBuffer()->copyImage(DontCopyBackingStore); - SkBitmap foregroundBitmap = foreground->nativeImageForCurrentFrame()->bitmap(); - SkBitmap backgroundBitmap = background->nativeImageForCurrentFrame()->bitmap(); + NativeImageSkia* foregroundNativeImage = foreground->nativeImageForCurrentFrame(); + NativeImageSkia* backgroundNativeImage = background->nativeImageForCurrentFrame(); + + if (!foregroundNativeImage || !backgroundNativeImage) + return false; + + SkBitmap foregroundBitmap = foregroundNativeImage->bitmap(); + SkBitmap backgroundBitmap = backgroundNativeImage->bitmap(); SkAutoTUnref<SkImageFilter> backgroundSource(new SkBitmapSource(backgroundBitmap)); SkBlendImageFilter::Mode mode = toSkiaMode(m_mode); diff --git a/Source/WebCore/platform/graphics/filters/skia/FEComponentTransferSkia.cpp b/Source/WebCore/platform/graphics/filters/skia/FEComponentTransferSkia.cpp index 6b5fb6991..260954c41 100644 --- a/Source/WebCore/platform/graphics/filters/skia/FEComponentTransferSkia.cpp +++ b/Source/WebCore/platform/graphics/filters/skia/FEComponentTransferSkia.cpp @@ -43,7 +43,9 @@ bool FEComponentTransfer::platformApplySkia() return false; RefPtr<Image> image = in->asImageBuffer()->copyImage(DontCopyBackingStore); - SkBitmap bitmap = image->nativeImageForCurrentFrame()->bitmap(); + NativeImageSkia* nativeImage = image->nativeImageForCurrentFrame(); + if (!nativeImage) + return false; unsigned char rValues[256], gValues[256], bValues[256], aValues[256]; getValues(rValues, gValues, bValues, aValues); @@ -51,7 +53,7 @@ bool FEComponentTransfer::platformApplySkia() SkPaint paint; paint.setColorFilter(SkTableColorFilter::CreateARGB(aValues, rValues, gValues, bValues))->unref(); paint.setXfermodeMode(SkXfermode::kSrc_Mode); - resultImage->context()->platformContext()->drawBitmap(bitmap, 0, 0, &paint); + resultImage->context()->platformContext()->drawBitmap(nativeImage->bitmap(), 0, 0, &paint); return true; } diff --git a/Source/WebCore/platform/graphics/filters/skia/FELightingSkia.cpp b/Source/WebCore/platform/graphics/filters/skia/FELightingSkia.cpp index 5f33727b5..9f4c6b91e 100644 --- a/Source/WebCore/platform/graphics/filters/skia/FELightingSkia.cpp +++ b/Source/WebCore/platform/graphics/filters/skia/FELightingSkia.cpp @@ -98,6 +98,8 @@ bool FELighting::platformApplySkia() RefPtr<Image> image = in->asImageBuffer()->copyImage(DontCopyBackingStore); NativeImageSkia* nativeImage = image->nativeImageForCurrentFrame(); + if (!nativeImage) + return false; GraphicsContext* dstContext = resultImage->context(); diff --git a/Source/WebCore/platform/graphics/gstreamer/PlatformVideoWindowQt.cpp b/Source/WebCore/platform/graphics/gstreamer/PlatformVideoWindowQt.cpp index 11b6fb7e3..977fa3a24 100644 --- a/Source/WebCore/platform/graphics/gstreamer/PlatformVideoWindowQt.cpp +++ b/Source/WebCore/platform/graphics/gstreamer/PlatformVideoWindowQt.cpp @@ -38,7 +38,7 @@ static const int gHideMouseCursorDelay = 3000; FullScreenVideoWindow::FullScreenVideoWindow() : m_mediaElement(0) { - setModality(Qt::ApplicationModal); + setWindowModality(Qt::ApplicationModal); #ifndef QT_NO_CURSOR m_cursorTimer.setSingleShot(true); @@ -115,7 +115,7 @@ PlatformVideoWindow::PlatformVideoWindow() { QWindow* win = new FullScreenVideoWindow(); m_window = win; - win->setFlags(win->flags() | Qt::FramelessWindowHint); + win->setWindowFlags(win->windowFlags() | Qt::FramelessWindowHint); // FIXME: Port to Qt 5. win->showFullScreen(); m_videoWindowId = win->winId(); diff --git a/Source/WebCore/platform/graphics/mac/WebLayer.mm b/Source/WebCore/platform/graphics/mac/WebLayer.mm index d868135ed..e4663abaf 100644 --- a/Source/WebCore/platform/graphics/mac/WebLayer.mm +++ b/Source/WebCore/platform/graphics/mac/WebLayer.mm @@ -85,18 +85,37 @@ void drawLayerContents(CGContextRef context, CALayer *layer, WebCore::PlatformCA ThemeMac::setFocusRingClipRect(transform.mapRect(clipBounds)); #if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 - __block GraphicsContext* ctx = &graphicsContext; + const float wastedSpaceThreshold = 0.75f; + const unsigned maxRectsToPaint = 5; - wkCALayerEnumerateRectsBeingDrawnWithBlock(layer, context, ^(CGRect rect){ - FloatRect rectBeingDrawn(rect); - rectBeingDrawn.intersect(clipBounds); - - GraphicsContextStateSaver stateSaver(*ctx); - ctx->clip(rectBeingDrawn); - - layerContents->platformCALayerPaintContents(*ctx, enclosingIntRect(rectBeingDrawn)); + double clipArea = clipBounds.width() * clipBounds.height(); + __block double totalRectArea = 0; + __block unsigned rectCount = 0; + __block Vector<FloatRect, maxRectsToPaint> dirtyRects; + + wkCALayerEnumerateRectsBeingDrawnWithBlock(layer, context, ^(CGRect rect) { + if (++rectCount > maxRectsToPaint) + return; + + totalRectArea += rect.size.width * rect.size.height; + dirtyRects.append(rect); }); + if (rectCount < maxRectsToPaint && totalRectArea < clipArea * wastedSpaceThreshold) { + for (unsigned i = 0; i < rectCount; ++i) { + const FloatRect& currentRect = dirtyRects[i]; + + GraphicsContextStateSaver stateSaver(graphicsContext); + graphicsContext.clip(currentRect); + + layerContents->platformCALayerPaintContents(graphicsContext, enclosingIntRect(currentRect)); + } + } else { + // CGContextGetClipBoundingBox() gives us the bounds of the dirty region, so clipBounds + // encompasses all the dirty rects. + layerContents->platformCALayerPaintContents(graphicsContext, enclosingIntRect(clipBounds)); + } + #else IntRect clip(enclosingIntRect(clipBounds)); layerContents->platformCALayerPaintContents(graphicsContext, clip); diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp index f2063cebc..237d47eed 100644 --- a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp +++ b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp @@ -503,6 +503,9 @@ bool GraphicsContext3D::getImageData(Image* image, qtImage = QImage::fromData(reinterpret_cast<const uchar*>(image->data()->data()), image->data()->size()); else { QPixmap* nativePixmap = image->nativeImageForCurrentFrame(); + if (!nativePixmap) + return false; + // With QPA, we can avoid a deep copy. qtImage = *nativePixmap->handle()->buffer(); } diff --git a/Source/WebCore/platform/graphics/skia/OpaqueRegionSkia.h b/Source/WebCore/platform/graphics/skia/OpaqueRegionSkia.h index 7bd803918..dcc1fcb97 100644 --- a/Source/WebCore/platform/graphics/skia/OpaqueRegionSkia.h +++ b/Source/WebCore/platform/graphics/skia/OpaqueRegionSkia.h @@ -57,16 +57,17 @@ public: void setImageMask(const SkRect& imageOpaqueRect); - void didDrawRect(const PlatformContextSkia*, const SkRect&, const SkPaint&, const SkBitmap* sourceBitmap); - void didDrawPath(const PlatformContextSkia*, const SkPath&, const SkPaint&); - void didDrawPoints(const PlatformContextSkia*, SkCanvas::PointMode, int numPoints, const SkPoint[], const SkPaint&); - void didDrawBounded(const PlatformContextSkia*, const SkRect&, const SkPaint&); - enum DrawType { FillOnly, FillOrStroke }; + void didDrawRect(const PlatformContextSkia*, const SkRect&, const SkPaint&, const SkBitmap* sourceBitmap); + void didDrawPath(const PlatformContextSkia*, const SkPath&, const SkPaint&); + void didDrawPoints(const PlatformContextSkia*, SkCanvas::PointMode, int numPoints, const SkPoint[], const SkPaint&); + void didDrawBounded(const PlatformContextSkia*, const SkRect&, const SkPaint&); + void didDrawUnbounded(const PlatformContextSkia*, const SkPaint&, DrawType); + struct CanvasLayerState { CanvasLayerState() : hasImageMask(false) @@ -85,7 +86,6 @@ public: private: void didDraw(const PlatformContextSkia*, const SkRect&, const SkPaint&, const SkBitmap* sourceBitmap, bool fillsBounds, DrawType); - void didDrawUnbounded(const PlatformContextSkia*, const SkPaint&, DrawType); void applyOpaqueRegionFromLayer(const PlatformContextSkia*, const SkRect& layerOpaqueRect, const SkPaint&); void markRectAsOpaque(const SkRect&); void markRectAsNonOpaque(const SkRect&); diff --git a/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h b/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h index 494a138b8..501ac0552 100644 --- a/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h +++ b/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h @@ -302,6 +302,14 @@ inline void PlatformContextSkia::writePixels(const SkBitmap& bitmap, int x, int SkCanvas::Config8888 config8888) { m_canvas->writePixels(bitmap, x, y, config8888); + + if (m_trackOpaqueRegion) { + SkRect rect = SkRect::MakeXYWH(x, y, bitmap.width(), bitmap.height()); + SkPaint paint; + + paint.setXfermodeMode(SkXfermode::kSrc_Mode); + m_opaqueRegion.didDrawRect(this, rect, paint, &bitmap); + } } inline bool PlatformContextSkia::isDrawingToLayer() const @@ -363,12 +371,20 @@ inline void PlatformContextSkia::drawBitmap(const SkBitmap& bitmap, SkScalar lef const SkPaint* paint) { m_canvas->drawBitmap(bitmap, left, top, paint); + + if (m_trackOpaqueRegion) { + SkRect rect = SkRect::MakeXYWH(left, top, bitmap.width(), bitmap.height()); + m_opaqueRegion.didDrawRect(this, rect, *paint, &bitmap); + } } inline void PlatformContextSkia::drawBitmapRect(const SkBitmap& bitmap, const SkIRect* isrc, const SkRect& dst, const SkPaint* paint) { m_canvas->drawBitmapRect(bitmap, isrc, dst, paint); + + if (m_trackOpaqueRegion) + m_opaqueRegion.didDrawRect(this, dst, *paint, &bitmap); } inline void PlatformContextSkia::drawOval(const SkRect& oval, const SkPaint& paint) @@ -407,24 +423,41 @@ inline void PlatformContextSkia::drawRect(const SkRect& rect, const SkPaint& pai inline void PlatformContextSkia::drawIRect(const SkIRect& rect, const SkPaint& paint) { m_canvas->drawIRect(rect, paint); + + if (m_trackOpaqueRegion) { + SkRect r = SkRect::MakeFromIRect(rect); + m_opaqueRegion.didDrawRect(this, r, paint, 0); + } } inline void PlatformContextSkia::drawPosText(const void* text, size_t byteLength, const SkPoint pos[], const SkPaint& paint) { m_canvas->drawPosText(text, byteLength, pos, paint); + + // FIXME: compute bounds for positioned text. + if (m_trackOpaqueRegion) + m_opaqueRegion.didDrawUnbounded(this, paint, OpaqueRegionSkia::FillOrStroke); } inline void PlatformContextSkia::drawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[], SkScalar constY, const SkPaint& paint) { m_canvas->drawPosTextH(text, byteLength, xpos, constY, paint); + + // FIXME: compute bounds for positioned text. + if (m_trackOpaqueRegion) + m_opaqueRegion.didDrawUnbounded(this, paint, OpaqueRegionSkia::FillOrStroke); } inline void PlatformContextSkia::drawTextOnPath(const void* text, size_t byteLength, const SkPath& path, const SkMatrix* matrix, const SkPaint& paint) { m_canvas->drawTextOnPath(text, byteLength, path, matrix, paint); + + // FIXME: compute bounds for positioned text. + if (m_trackOpaqueRegion) + m_opaqueRegion.didDrawUnbounded(this, paint, OpaqueRegionSkia::FillOrStroke); } } diff --git a/Source/WebCore/platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp b/Source/WebCore/platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp index 01b72fbe0..a8a430aa7 100644 --- a/Source/WebCore/platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp +++ b/Source/WebCore/platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp @@ -384,7 +384,7 @@ private: bool m_isReceiver; }; -static bool resolveGLMethods(GraphicsSurfacePrivate*) +static bool resolveGLMethods() { static bool resolved = false; if (resolved) @@ -470,7 +470,7 @@ PassRefPtr<GraphicsSurface> GraphicsSurface::platformCreate(const IntSize& size, RefPtr<GraphicsSurface> surface = adoptRef(new GraphicsSurface(size, flags)); surface->m_private = new GraphicsSurfacePrivate(shareContext); - if (!resolveGLMethods(surface->m_private)) + if (!resolveGLMethods()) return PassRefPtr<GraphicsSurface>(); surface->m_platformSurface = surface->m_private->createSurface(size); @@ -490,7 +490,7 @@ PassRefPtr<GraphicsSurface> GraphicsSurface::platformImport(const IntSize& size, surface->m_platformSurface = token.frontBufferHandle; surface->m_private = new GraphicsSurfacePrivate(surface->m_platformSurface); - if (!resolveGLMethods(surface->m_private)) + if (!resolveGLMethods()) return PassRefPtr<GraphicsSurface>(); return surface; diff --git a/Source/WebCore/platform/graphics/win/ImageCGWin.cpp b/Source/WebCore/platform/graphics/win/ImageCGWin.cpp index 74a5d7664..d20eb3710 100644 --- a/Source/WebCore/platform/graphics/win/ImageCGWin.cpp +++ b/Source/WebCore/platform/graphics/win/ImageCGWin.cpp @@ -91,7 +91,7 @@ void BitmapImage::drawFrameMatchingSourceSize(GraphicsContext* ctxt, const Float size_t frames = frameCount(); for (size_t i = 0; i < frames; ++i) { CGImageRef image = frameAtIndex(i); - if (CGImageGetHeight(image) == static_cast<size_t>(srcSize.height()) && CGImageGetWidth(image) == static_cast<size_t>(srcSize.width())) { + if (image && CGImageGetHeight(image) == static_cast<size_t>(srcSize.height()) && CGImageGetWidth(image) == static_cast<size_t>(srcSize.width())) { size_t currentFrame = m_currentFrame; m_currentFrame = i; draw(ctxt, dstRect, FloatRect(0.0f, 0.0f, srcSize.width(), srcSize.height()), styleColorSpace, compositeOp); diff --git a/Source/WebCore/platform/graphics/wince/ImageWinCE.cpp b/Source/WebCore/platform/graphics/wince/ImageWinCE.cpp index aa06cafd9..b9dfd907f 100644 --- a/Source/WebCore/platform/graphics/wince/ImageWinCE.cpp +++ b/Source/WebCore/platform/graphics/wince/ImageWinCE.cpp @@ -118,16 +118,17 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, const Fl else { IntRect intSrcRect(srcRectIn); RefPtr<SharedBitmap> bmp = frameAtIndex(m_currentFrame); - - if (bmp->width() != m_source.size().width()) { - double scaleFactor = static_cast<double>(bmp->width()) / m_source.size().width(); - - intSrcRect.setX(stableRound(srcRectIn.x() * scaleFactor)); - intSrcRect.setWidth(stableRound(srcRectIn.width() * scaleFactor)); - intSrcRect.setY(stableRound(srcRectIn.y() * scaleFactor)); - intSrcRect.setHeight(stableRound(srcRectIn.height() * scaleFactor)); + if (bmp) { + if (bmp->width() != m_source.size().width()) { + double scaleFactor = static_cast<double>(bmp->width()) / m_source.size().width(); + + intSrcRect.setX(stableRound(srcRectIn.x() * scaleFactor)); + intSrcRect.setWidth(stableRound(srcRectIn.width() * scaleFactor)); + intSrcRect.setY(stableRound(srcRectIn.y() * scaleFactor)); + intSrcRect.setHeight(stableRound(srcRectIn.height() * scaleFactor)); + } + bmp->draw(ctxt, enclosingIntRect(dstRect), intSrcRect, styleColorSpace, compositeOp); } - bmp->draw(ctxt, enclosingIntRect(dstRect), intSrcRect, styleColorSpace, compositeOp); } startAnimation(); diff --git a/Source/WebCore/platform/gtk/GtkAuthenticationDialog.cpp b/Source/WebCore/platform/gtk/GtkAuthenticationDialog.cpp index af1242fda..992a5bc13 100644 --- a/Source/WebCore/platform/gtk/GtkAuthenticationDialog.cpp +++ b/Source/WebCore/platform/gtk/GtkAuthenticationDialog.cpp @@ -28,34 +28,16 @@ namespace WebCore { -#ifdef GTK_API_VERSION_2 -static GtkWidget* addEntryToTable(GtkTable* table, int row, const char* labelText) -#else -static GtkWidget* addEntryToGrid(GtkGrid* grid, int row, const char* labelText) -#endif -{ - GtkWidget* label = gtk_label_new(labelText); - gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); - - GtkWidget* entry = gtk_entry_new(); - gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE); - -#ifdef GTK_API_VERSION_2 - gtk_table_attach(table, label, 0, 1, row, row + 1, GTK_FILL, static_cast<GtkAttachOptions>(GTK_EXPAND | GTK_FILL), 0, 0); - gtk_table_attach_defaults(table, entry, 1, 2, row, row + 1); -#else - gtk_grid_attach(grid, label, 0, row, 1, 1); - gtk_widget_set_hexpand(label, TRUE); - - gtk_grid_attach(grid, entry, 1, row, 1, 1); - gtk_widget_set_hexpand(entry, TRUE); - gtk_widget_set_vexpand(entry, TRUE); -#endif - - return entry; -} +static const int gLayoutColumnSpacing = 12; +static const int gLayoutRowSpacing = 6; +static const int gButtonSpacing = 5; -GtkAuthenticationDialog::~GtkAuthenticationDialog() +GtkAuthenticationDialog::GtkAuthenticationDialog(const AuthenticationChallenge& challenge) + : m_dialog(0) + , m_loginEntry(0) + , m_passwordEntry(0) + , m_rememberCheckButton(0) + , m_challenge(challenge) { } @@ -66,135 +48,183 @@ GtkAuthenticationDialog::GtkAuthenticationDialog(GtkWindow* parentWindow, const , m_rememberCheckButton(0) , m_challenge(challenge) { - GtkDialog* dialog = GTK_DIALOG(m_dialog); - gtk_dialog_add_buttons(dialog, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); - - // Set the dialog up with HIG properties. - gtk_container_set_border_width(GTK_CONTAINER(dialog), 5); - gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(dialog)), 2); /* 2 * 5 + 2 = 12 */ - gtk_container_set_border_width(GTK_CONTAINER(gtk_dialog_get_action_area(dialog)), 5); - gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_action_area(dialog)), 6); + GtkWidget* contentArea = gtk_dialog_get_content_area(GTK_DIALOG(m_dialog)); + gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(m_dialog)), 5); + gtk_box_set_spacing(GTK_BOX(contentArea), 2); /* 2 * 5 + 2 = 12 */ GtkWindow* window = GTK_WINDOW(m_dialog); gtk_window_set_resizable(window, FALSE); gtk_window_set_title(window, ""); gtk_window_set_icon_name(window, GTK_STOCK_DIALOG_AUTHENTICATION); - gtk_dialog_set_default_response(dialog, GTK_RESPONSE_OK); - if (parentWindow) gtk_window_set_transient_for(window, parentWindow); - // Build contents. + createContentsInContainer(contentArea); +} + #ifdef GTK_API_VERSION_2 - GtkWidget* hBox = gtk_hbox_new(FALSE, 12); -#else - GtkWidget* hBox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12); -#endif - gtk_container_set_border_width(GTK_CONTAINER(hBox), 5); - gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(dialog)), hBox, TRUE, TRUE, 0); +static void packTwoColumnLayoutInBox(GtkWidget* box, ...) +{ + va_list argumentList; + va_start(argumentList, box); + + GtkWidget* table = gtk_table_new(1, 2, FALSE); + gtk_table_set_col_spacings(GTK_TABLE(table), gLayoutColumnSpacing); + gtk_table_set_row_spacings(GTK_TABLE(table), gLayoutRowSpacing); + + GtkWidget* firstColumnWidget = va_arg(argumentList, GtkWidget*); + int rowNumber = 0; + while (firstColumnWidget) { + if (rowNumber) + gtk_table_resize(GTK_TABLE(table), rowNumber + 1, 2); + + GtkWidget* secondColumnWidget = va_arg(argumentList, GtkWidget*); + GtkAttachOptions attachOptions = static_cast<GtkAttachOptions>(GTK_EXPAND | GTK_FILL); + gtk_table_attach(GTK_TABLE(table), firstColumnWidget, + 0, secondColumnWidget ? 1 : 2, + rowNumber, rowNumber + 1, + attachOptions, attachOptions, + 0, 0); + + if (secondColumnWidget) + gtk_table_attach_defaults(GTK_TABLE(table), secondColumnWidget, 1, 2, rowNumber, rowNumber + 1); + + firstColumnWidget = va_arg(argumentList, GtkWidget*); + rowNumber++; + } - GtkWidget* icon = gtk_image_new_from_stock(GTK_STOCK_DIALOG_AUTHENTICATION, GTK_ICON_SIZE_DIALOG); - gtk_misc_set_alignment(GTK_MISC(icon), 0.5, 0.0); - gtk_box_pack_start(GTK_BOX(hBox), icon, FALSE, FALSE, 0); + va_end(argumentList); -#ifdef GTK_API_VERSION_2 - GtkWidget* mainVBox = gtk_vbox_new(FALSE, 18); + gtk_box_pack_start(GTK_BOX(box), table, FALSE, FALSE, 0); +} #else - GtkWidget* mainVBox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 18); -#endif - gtk_box_pack_start(GTK_BOX(hBox), mainVBox, TRUE, TRUE, 0); +static void packTwoColumnLayoutInBox(GtkWidget* box, ...) +{ + va_list argumentList; + va_start(argumentList, box); - GOwnPtr<char> description(g_strdup_printf(_("A username and password are being requested by the site %s"), - m_challenge.protectionSpace().host().utf8().data())); - GtkWidget* descriptionLabel = gtk_label_new(description.get()); - gtk_misc_set_alignment(GTK_MISC(descriptionLabel), 0.0, 0.5); - gtk_label_set_line_wrap(GTK_LABEL(descriptionLabel), TRUE); - gtk_box_pack_start(GTK_BOX(mainVBox), GTK_WIDGET(descriptionLabel), FALSE, FALSE, 0); + GtkWidget* grid = gtk_grid_new(); + gtk_grid_set_column_spacing(GTK_GRID(grid), gLayoutRowSpacing); + gtk_grid_set_row_spacing(GTK_GRID(grid), gLayoutRowSpacing); + gtk_grid_set_column_homogeneous(GTK_GRID(grid), TRUE); + + GtkWidget* firstColumnWidget = va_arg(argumentList, GtkWidget*); + int rowNumber = 0; + while (firstColumnWidget) { + GtkWidget* secondColumnWidget = va_arg(argumentList, GtkWidget*); + int firstWidgetWidth = secondColumnWidget ? 1 : 2; + + gtk_grid_attach(GTK_GRID(grid), firstColumnWidget, 0, rowNumber, firstWidgetWidth, 1); + gtk_widget_set_hexpand(firstColumnWidget, TRUE); + gtk_widget_set_vexpand(firstColumnWidget, TRUE); + + if (secondColumnWidget) { + gtk_grid_attach(GTK_GRID(grid), secondColumnWidget, 1, rowNumber, 1, 1); + gtk_widget_set_hexpand(secondColumnWidget, TRUE); + gtk_widget_set_vexpand(secondColumnWidget, TRUE); + } + + firstColumnWidget = va_arg(argumentList, GtkWidget*); + rowNumber++; + } -#ifdef GTK_API_VERSION_2 - GtkWidget* vBox = gtk_vbox_new(FALSE, 6); -#else - GtkWidget* vBox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6); + va_end(argumentList); + + gtk_box_pack_start(GTK_BOX(box), grid, FALSE, FALSE, 0); +} #endif - gtk_box_pack_start(GTK_BOX(mainVBox), vBox, FALSE, FALSE, 0); - // The table that holds the entries. - GtkWidget* entryContainer = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); - gtk_alignment_set_padding(GTK_ALIGNMENT(entryContainer), 0, 0, 0, 0); - gtk_box_pack_start(GTK_BOX(vBox), entryContainer, FALSE, FALSE, 0); +static GtkWidget* createDialogLabel(const char* labelString, int horizontalPadding = 0) +{ + GtkWidget* label = gtk_label_new(labelString); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); + if (horizontalPadding) + gtk_misc_set_padding(GTK_MISC(label), 0, horizontalPadding); + return label; +} - // Checking that realm is not an empty string. - String realm = m_challenge.protectionSpace().realm(); - bool hasRealm = !realm.isEmpty(); +static GtkWidget* createDialogEntry(GtkWidget** member) +{ + *member = gtk_entry_new(); + gtk_entry_set_activates_default(GTK_ENTRY(*member), TRUE); + return *member; +} +void GtkAuthenticationDialog::createContentsInContainer(GtkWidget* container) +{ #ifdef GTK_API_VERSION_2 - GtkWidget* table = gtk_table_new(hasRealm ? 3 : 2, 2, FALSE); - gtk_table_set_col_spacings(GTK_TABLE(table), 12); - gtk_table_set_row_spacings(GTK_TABLE(table), 6); - gtk_container_add(GTK_CONTAINER(entryContainer), table); + GtkWidget* hBox = gtk_hbox_new(FALSE, gLayoutColumnSpacing); #else - GtkWidget* grid = gtk_grid_new(); - gtk_grid_set_column_spacing(GTK_GRID(grid), 12); - gtk_grid_set_row_spacing(GTK_GRID(grid), 6); - gtk_container_add(GTK_CONTAINER(entryContainer), grid); + GtkWidget* hBox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, gLayoutColumnSpacing); #endif + gtk_container_set_border_width(GTK_CONTAINER(hBox), gButtonSpacing); + gtk_container_add(GTK_CONTAINER(container), hBox); - if (hasRealm) { - GtkWidget* serverMessageDescriptionLabel = gtk_label_new(_("Server message:")); - gtk_misc_set_alignment(GTK_MISC(serverMessageDescriptionLabel), 0.0, 0.5); - gtk_label_set_line_wrap(GTK_LABEL(serverMessageDescriptionLabel), TRUE); -#ifdef GTK_API_VERSION_2 - gtk_table_attach_defaults(GTK_TABLE(table), serverMessageDescriptionLabel, 0, 1, 0, 1); -#else - gtk_grid_attach(GTK_GRID(grid), serverMessageDescriptionLabel, 0, 0, 1, 1); - gtk_widget_set_hexpand(serverMessageDescriptionLabel, TRUE); - gtk_widget_set_vexpand(serverMessageDescriptionLabel, TRUE); -#endif - GtkWidget* serverMessageLabel = gtk_label_new(realm.utf8().data()); - gtk_misc_set_alignment(GTK_MISC(serverMessageLabel), 0.0, 0.5); - gtk_label_set_line_wrap(GTK_LABEL(serverMessageLabel), TRUE); -#ifdef GTK_API_VERSION_2 - gtk_table_attach_defaults(GTK_TABLE(table), serverMessageLabel, 1, 2, 0, 1); -#else - gtk_grid_attach(GTK_GRID(grid), serverMessageLabel, 1, 0, 1, 1); - gtk_widget_set_hexpand(serverMessageLabel, TRUE); - gtk_widget_set_vexpand(serverMessageLabel, TRUE); -#endif - } + GtkWidget* icon = gtk_image_new_from_stock(GTK_STOCK_DIALOG_AUTHENTICATION, GTK_ICON_SIZE_DIALOG); + gtk_misc_set_alignment(GTK_MISC(icon), 0.5, 0); + gtk_box_pack_start(GTK_BOX(hBox), icon, FALSE, FALSE, 0); -#ifdef GTK_API_VERSION_2 - m_loginEntry = addEntryToTable(GTK_TABLE(table), hasRealm ? 1 : 0, _("Username:")); - m_passwordEntry = addEntryToTable(GTK_TABLE(table), hasRealm ? 2 : 1, _("Password:")); -#else - m_loginEntry = addEntryToGrid(GTK_GRID(grid), hasRealm ? 1 : 0, _("Username:")); - m_passwordEntry = addEntryToGrid(GTK_GRID(grid), hasRealm ? 2 : 1, _("Password:")); -#endif + GOwnPtr<char> prompt(g_strdup_printf( + _("The site %s:%i requests a username and password"), + m_challenge.protectionSpace().host().utf8().data(), + m_challenge.protectionSpace().port())); + + m_rememberCheckButton = gtk_check_button_new_with_mnemonic(_("_Remember password")); + gtk_label_set_line_wrap(GTK_LABEL(gtk_bin_get_child(GTK_BIN(m_rememberCheckButton))), TRUE); - gtk_entry_set_visibility(GTK_ENTRY(m_passwordEntry), FALSE); + // We are adding the button box here manually instead of using the ready-made GtkDialog buttons. + // This is so that we can share the code with implementations that do not use GtkDialog. #ifdef GTK_API_VERSION_2 - GtkWidget* rememberBox = gtk_vbox_new(FALSE, 6); + GtkWidget* buttonBox = gtk_hbutton_box_new(); #else - GtkWidget* rememberBox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6); + GtkWidget* buttonBox = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL); #endif - gtk_box_pack_start(GTK_BOX(vBox), rememberBox, FALSE, FALSE, 0); + gtk_box_set_spacing(GTK_BOX(buttonBox), gButtonSpacing); + gtk_button_box_set_layout(GTK_BUTTON_BOX(buttonBox), GTK_BUTTONBOX_END); - m_rememberCheckButton = gtk_check_button_new_with_mnemonic(_("_Remember password")); - gtk_label_set_line_wrap(GTK_LABEL(gtk_bin_get_child(GTK_BIN(m_rememberCheckButton))), TRUE); - gtk_box_pack_start(GTK_BOX(rememberBox), m_rememberCheckButton, FALSE, FALSE, 0); -} + m_okayButton = gtk_button_new_from_stock(GTK_STOCK_OK); + m_cancelButton = gtk_button_new_from_stock(GTK_STOCK_CANCEL); + gtk_box_pack_start(GTK_BOX(buttonBox), m_cancelButton, FALSE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(buttonBox), m_okayButton, FALSE, TRUE, 0); + g_signal_connect(m_okayButton, "clicked", G_CALLBACK(buttonClickedCallback), this); + g_signal_connect(m_cancelButton, "clicked", G_CALLBACK(buttonClickedCallback), this); -void GtkAuthenticationDialog::show() -{ + String realm = m_challenge.protectionSpace().realm(); + if (!realm.isEmpty()) { + packTwoColumnLayoutInBox(hBox, + createDialogLabel(prompt.get(), gLayoutRowSpacing), NULL, + createDialogLabel(_("Server message:")), createDialogLabel(realm.utf8().data()), + createDialogLabel(_("Username:")), createDialogEntry(&m_loginEntry), + createDialogLabel(_("Password:")), createDialogEntry(&m_passwordEntry), + m_rememberCheckButton, NULL, + buttonBox, NULL, NULL); + + } else { + packTwoColumnLayoutInBox(hBox, + createDialogLabel(prompt.get(), gLayoutRowSpacing), NULL, + createDialogLabel(_("Username:")), createDialogEntry(&m_loginEntry), + createDialogLabel(_("Password:")), createDialogEntry(&m_passwordEntry), + m_rememberCheckButton, NULL, NULL, + buttonBox, NULL, NULL); + } + + gtk_entry_set_visibility(GTK_ENTRY(m_passwordEntry), FALSE); const Credential& credentialFromPersistentStorage = m_challenge.proposedCredential(); if (!credentialFromPersistentStorage.isEmpty()) { gtk_entry_set_text(GTK_ENTRY(m_loginEntry), credentialFromPersistentStorage.user().utf8().data()); gtk_entry_set_text(GTK_ENTRY(m_passwordEntry), credentialFromPersistentStorage.password().utf8().data()); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_rememberCheckButton), TRUE); } +} + +void GtkAuthenticationDialog::show() +{ + gtk_widget_set_can_default(m_okayButton, TRUE); + gtk_widget_grab_default(m_okayButton); + gtk_widget_grab_focus(m_loginEntry); - g_signal_connect(m_dialog, "response", G_CALLBACK(authenticationDialogResponseCallback), this); gtk_widget_show_all(m_dialog); } @@ -212,10 +242,10 @@ void GtkAuthenticationDialog::authenticate(const Credential& credential) m_challenge.authenticationClient()->receivedCredential(m_challenge, credential); } -void GtkAuthenticationDialog::authenticationDialogResponseCallback(GtkWidget*, gint responseID, GtkAuthenticationDialog* dialog) +void GtkAuthenticationDialog::buttonClickedCallback(GtkWidget* button, GtkAuthenticationDialog* dialog) { Credential credential; - if (responseID == GTK_RESPONSE_OK) { + if (button == dialog->m_okayButton) { const char *username = gtk_entry_get_text(GTK_ENTRY(dialog->m_loginEntry)); const char *password = gtk_entry_get_text(GTK_ENTRY(dialog->m_passwordEntry)); CredentialPersistence persistence = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->m_rememberCheckButton)) ? diff --git a/Source/WebCore/platform/gtk/GtkAuthenticationDialog.h b/Source/WebCore/platform/gtk/GtkAuthenticationDialog.h index 7e6478fbf..8a8d56303 100644 --- a/Source/WebCore/platform/gtk/GtkAuthenticationDialog.h +++ b/Source/WebCore/platform/gtk/GtkAuthenticationDialog.h @@ -34,20 +34,24 @@ class GtkAuthenticationDialog { WTF_MAKE_FAST_ALLOCATED; public: + GtkAuthenticationDialog(const AuthenticationChallenge&); GtkAuthenticationDialog(GtkWindow*, const AuthenticationChallenge&); - virtual ~GtkAuthenticationDialog(); + virtual ~GtkAuthenticationDialog() { } void show(); + void destroy(); protected: + void createContentsInContainer(GtkWidget* container); virtual void authenticate(const Credential&); GtkWidget* m_dialog; GtkWidget* m_loginEntry; GtkWidget* m_passwordEntry; GtkWidget* m_rememberCheckButton; + GtkWidget* m_okayButton; + GtkWidget* m_cancelButton; private: - void destroy(); - static void authenticationDialogResponseCallback(GtkWidget*, gint responseID, GtkAuthenticationDialog*); + static void buttonClickedCallback(GtkWidget*, GtkAuthenticationDialog*); AuthenticationChallenge m_challenge; }; diff --git a/Source/WebCore/platform/gtk/RedirectedXCompositeWindow.cpp b/Source/WebCore/platform/gtk/RedirectedXCompositeWindow.cpp index 911058128..a008502a5 100644 --- a/Source/WebCore/platform/gtk/RedirectedXCompositeWindow.cpp +++ b/Source/WebCore/platform/gtk/RedirectedXCompositeWindow.cpp @@ -92,16 +92,17 @@ static bool supportsXDamageAndXComposite() return true; } -PassOwnPtr<RedirectedXCompositeWindow> RedirectedXCompositeWindow::create(const IntSize& size) +PassOwnPtr<RedirectedXCompositeWindow> RedirectedXCompositeWindow::create(const IntSize& size, GLContextNeeded needsContext) { - return supportsXDamageAndXComposite() ? adoptPtr(new RedirectedXCompositeWindow(size)) : nullptr; + return supportsXDamageAndXComposite() ? adoptPtr(new RedirectedXCompositeWindow(size, needsContext)) : nullptr; } -RedirectedXCompositeWindow::RedirectedXCompositeWindow(const IntSize& size) +RedirectedXCompositeWindow::RedirectedXCompositeWindow(const IntSize& size, GLContextNeeded needsContext) : m_size(size) , m_window(0) , m_parentWindow(0) , m_pixmap(0) + , m_needsContext(needsContext) , m_surface(0) , m_needsNewPixmapAfterResize(false) , m_damage(0) @@ -176,12 +177,14 @@ void RedirectedXCompositeWindow::resize(const IntSize& size) XResizeWindow(display, m_window, size.width(), size.height()); XFlush(display); - context()->waitNative(); - // This swap is based on code in Chromium. It tries to work-around a bug in the Intel drivers - // where a swap is necessary to ensure the front and back buffers are properly resized. - if (context() == GLContext::getCurrent()) - context()->swapBuffers(); + if (m_needsContext == CreateGLContext) { + context()->waitNative(); + // This swap is based on code in Chromium. It tries to work-around a bug in the Intel drivers + // where a swap is necessary to ensure the front and back buffers are properly resized. + if (context() == GLContext::getCurrent()) + context()->swapBuffers(); + } m_size = size; m_needsNewPixmapAfterResize = true; @@ -189,6 +192,8 @@ void RedirectedXCompositeWindow::resize(const IntSize& size) GLContext* RedirectedXCompositeWindow::context() { + ASSERT(m_needsContext); + if (m_context) return m_context.get(); diff --git a/Source/WebCore/platform/gtk/RedirectedXCompositeWindow.h b/Source/WebCore/platform/gtk/RedirectedXCompositeWindow.h index 7a98c3768..d3b2ca289 100644 --- a/Source/WebCore/platform/gtk/RedirectedXCompositeWindow.h +++ b/Source/WebCore/platform/gtk/RedirectedXCompositeWindow.h @@ -42,7 +42,8 @@ namespace WebCore { class RedirectedXCompositeWindow { public: - static PassOwnPtr<RedirectedXCompositeWindow> create(const IntSize&); + enum GLContextNeeded { CreateGLContext, DoNotCreateGLContext }; + static PassOwnPtr<RedirectedXCompositeWindow> create(const IntSize&, GLContextNeeded = CreateGLContext); virtual ~RedirectedXCompositeWindow(); const IntSize& size() { return m_size; } @@ -59,13 +60,14 @@ public: } private: - RedirectedXCompositeWindow(const IntSize&); + RedirectedXCompositeWindow(const IntSize&, GLContextNeeded); void cleanupPixmapAndPixmapSurface(); IntSize m_size; Window m_window; Window m_parentWindow; Pixmap m_pixmap; + GLContextNeeded m_needsContext; OwnPtr<GLContext> m_context; RefPtr<cairo_surface_t> m_surface; unsigned int m_pendingResizeSourceId; diff --git a/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp b/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp index e43743f9a..e152a2ecb 100644 --- a/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp +++ b/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp @@ -646,6 +646,78 @@ bool JPEGImageDecoder::setFailed() return ImageDecoder::setFailed(); } +template <int colorSpace> +void setPixel(ImageFrame& buffer, ImageFrame::PixelData* currentAddress, JSAMPARRAY samples, int column) +{ + JSAMPLE* jsample = *samples + column * (static_cast<J_COLOR_SPACE>(colorSpace) == JCS_RGB ? 3 : 4); + + switch (static_cast<J_COLOR_SPACE>(colorSpace)) { +#if defined(TURBO_JPEG_RGB_SWIZZLE) + case JCS_EXT_BGRA: + buffer.setRGBA(currentAddress, jsample[2], jsample[1], jsample[0], 0xFF); + break; + case JCS_EXT_RGBA: // Fallback to JSC_RGB case here. +#endif + case JCS_RGB: + buffer.setRGBA(currentAddress, jsample[0], jsample[1], jsample[2], 0xFF); + break; + case JCS_CMYK: + // Source is 'Inverted CMYK', output is RGB. + // See: http://www.easyrgb.com/math.php?MATH=M12#text12 + // Or: http://www.ilkeratalay.com/colorspacesfaq.php#rgb + // From CMYK to CMY: + // X = X * (1 - K ) + K [for X = C, M, or Y] + // Thus, from Inverted CMYK to CMY is: + // X = (1-iX) * (1 - (1-iK)) + (1-iK) => 1 - iX*iK + // From CMY (0..1) to RGB (0..1): + // R = 1 - C => 1 - (1 - iC*iK) => iC*iK [G and B similar] + unsigned k = jsample[3]; + buffer.setRGBA(currentAddress, jsample[0] * k / 255, jsample[1] * k / 255, jsample[2] * k / 255, 0xFF); + break; + } +} + +template <int colorSpace, bool isScaled> +bool JPEGImageDecoder::outputScanlines(ImageFrame& buffer) +{ + JSAMPARRAY samples = m_reader->samples(); + jpeg_decompress_struct* info = m_reader->info(); + + int width = isScaled ? m_scaledColumns.size() : info->output_width; + + while (info->output_scanline < info->output_height) { + // jpeg_read_scanlines will increase the scanline counter, so we + // save the scanline before calling it. + int sourceY = info->output_scanline; + /* Request one scanline. Returns 0 or 1 scanlines. */ + if (jpeg_read_scanlines(info, samples, 1) != 1) + return false; + + int destY = scaledY(sourceY); + if (destY < 0) + continue; + +#if USE(QCMSLIB) + if (m_reader->colorTransform() && colorSpace == JCS_RGB) + qcms_transform_data(m_reader->colorTransform(), *samples, *samples, info->output_width); +#endif + + ImageFrame::PixelData* currentAddress = buffer.getAddr(0, destY); + + for (int x = 0; x < width; ++x) { + setPixel<colorSpace>(buffer, currentAddress, samples, isScaled ? m_scaledColumns[x] : x); + ++currentAddress; + } + } + return true; +} + +template <int colorSpace> +bool JPEGImageDecoder::outputScanlines(ImageFrame& buffer) +{ + return m_scaled ? outputScanlines<colorSpace, true>(buffer) : outputScanlines<colorSpace, false>(buffer); +} + bool JPEGImageDecoder::outputScanlines() { if (m_frameBufferCache.isEmpty()) @@ -684,54 +756,26 @@ bool JPEGImageDecoder::outputScanlines() } #endif - JSAMPARRAY samples = m_reader->samples(); - - while (info->output_scanline < info->output_height) { - // jpeg_read_scanlines will increase the scanline counter, so we - // save the scanline before calling it. - int sourceY = info->output_scanline; - /* Request one scanline. Returns 0 or 1 scanlines. */ - if (jpeg_read_scanlines(info, samples, 1) != 1) - return false; - - int destY = scaledY(sourceY); - if (destY < 0) - continue; -#if USE(QCMSLIB) - if (m_reader->colorTransform() && info->out_color_space == JCS_RGB) - qcms_transform_data(m_reader->colorTransform(), *samples, *samples, info->output_width); -#endif - int width = m_scaled ? m_scaledColumns.size() : info->output_width; - for (int x = 0; x < width; ++x) { - JSAMPLE* jsample = *samples + (m_scaled ? m_scaledColumns[x] : x) * ((info->out_color_space == JCS_RGB) ? 3 : 4); - if (info->out_color_space == JCS_RGB) - buffer.setRGBA(x, destY, jsample[0], jsample[1], jsample[2], 0xFF); + switch (info->out_color_space) { + // The code inside outputScanlines<int, bool> will be executed + // for each pixel, so we want to avoid any extra comparisons there. + // That is why we use template and template specializations here so + // the proper code will be generated at compile time. + case JCS_RGB: + return outputScanlines<JCS_RGB>(buffer); #if defined(TURBO_JPEG_RGB_SWIZZLE) - else if (info->out_color_space == JCS_EXT_RGBA) - buffer.setRGBA(x, destY, jsample[0], jsample[1], jsample[2], 0xFF); - else if (info->out_color_space == JCS_EXT_BGRA) - buffer.setRGBA(x, destY, jsample[2], jsample[1], jsample[0], 0xFF); + case JCS_EXT_RGBA: + return outputScanlines<JCS_EXT_RGBA>(buffer); + case JCS_EXT_BGRA: + return outputScanlines<JCS_EXT_BGRA>(buffer); #endif - else if (info->out_color_space == JCS_CMYK) { - // Source is 'Inverted CMYK', output is RGB. - // See: http://www.easyrgb.com/math.php?MATH=M12#text12 - // Or: http://www.ilkeratalay.com/colorspacesfaq.php#rgb - // From CMYK to CMY: - // X = X * (1 - K ) + K [for X = C, M, or Y] - // Thus, from Inverted CMYK to CMY is: - // X = (1-iX) * (1 - (1-iK)) + (1-iK) => 1 - iX*iK - // From CMY (0..1) to RGB (0..1): - // R = 1 - C => 1 - (1 - iC*iK) => iC*iK [G and B similar] - unsigned k = jsample[3]; - buffer.setRGBA(x, destY, jsample[0] * k / 255, jsample[1] * k / 255, jsample[2] * k / 255, 0xFF); - } else { - ASSERT_NOT_REACHED(); - return setFailed(); - } - } + case JCS_CMYK: + return outputScanlines<JCS_CMYK>(buffer); + default: + ASSERT_NOT_REACHED(); } - return true; + return setFailed(); } void JPEGImageDecoder::jpegComplete() diff --git a/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h b/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h index 95fe8a40b..0badfd4cc 100644 --- a/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h +++ b/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h @@ -62,6 +62,12 @@ namespace WebCore { // data coming, sets the "decode failure" flag. void decode(bool onlySize); + template <int colorSpace> + bool outputScanlines(ImageFrame& buffer); + + template <int colorSpace, bool isScaled> + bool outputScanlines(ImageFrame& buffer); + OwnPtr<JPEGImageReader> m_reader; }; diff --git a/Source/WebCore/platform/leveldb/LevelDBDatabase.cpp b/Source/WebCore/platform/leveldb/LevelDBDatabase.cpp index edf9db257..2d5cfcd7f 100644 --- a/Source/WebCore/platform/leveldb/LevelDBDatabase.cpp +++ b/Source/WebCore/platform/leveldb/LevelDBDatabase.cpp @@ -198,8 +198,9 @@ bool LevelDBDatabase::remove(const LevelDBSlice& key) return false; } -bool LevelDBDatabase::get(const LevelDBSlice& key, Vector<char>& value, const LevelDBSnapshot* snapshot) +bool LevelDBDatabase::safeGet(const LevelDBSlice& key, Vector<char>& value, bool& found, const LevelDBSnapshot* snapshot) { + found = false; std::string result; leveldb::ReadOptions readOptions; readOptions.verify_checksums = true; // FIXME: Disable this if the performance impact is too great. @@ -207,11 +208,12 @@ bool LevelDBDatabase::get(const LevelDBSlice& key, Vector<char>& value, const Le const leveldb::Status s = m_db->Get(readOptions, makeSlice(key), &result); if (s.ok()) { + found = true; value = makeVector(result); return true; } if (s.IsNotFound()) - return false; + return true; LOG_ERROR("LevelDB get failed: %s", s.ToString().c_str()); return false; } diff --git a/Source/WebCore/platform/leveldb/LevelDBDatabase.h b/Source/WebCore/platform/leveldb/LevelDBDatabase.h index 2d32cd736..f9f4d4e1b 100644 --- a/Source/WebCore/platform/leveldb/LevelDBDatabase.h +++ b/Source/WebCore/platform/leveldb/LevelDBDatabase.h @@ -69,7 +69,7 @@ public: bool put(const LevelDBSlice& key, const Vector<char>& value); bool remove(const LevelDBSlice& key); - bool get(const LevelDBSlice& key, Vector<char>& value, const LevelDBSnapshot* = 0); + bool safeGet(const LevelDBSlice& key, Vector<char>& value, bool& found, const LevelDBSnapshot* = 0); bool write(LevelDBWriteBatch&); PassOwnPtr<LevelDBIterator> createIterator(const LevelDBSnapshot* = 0); const LevelDBComparator* comparator() const; diff --git a/Source/WebCore/platform/leveldb/LevelDBTransaction.cpp b/Source/WebCore/platform/leveldb/LevelDBTransaction.cpp index fe8262a24..5335a028a 100644 --- a/Source/WebCore/platform/leveldb/LevelDBTransaction.cpp +++ b/Source/WebCore/platform/leveldb/LevelDBTransaction.cpp @@ -107,20 +107,38 @@ void LevelDBTransaction::remove(const LevelDBSlice& key) set(key, Vector<char>(), true); } -bool LevelDBTransaction::get(const LevelDBSlice& key, Vector<char>& value) +bool LevelDBTransaction::safeGet(const LevelDBSlice& key, Vector<char>& value, bool& found) { + found = false; ASSERT(!m_finished); AVLTreeNode* node = m_tree.search(key); if (node) { if (node->deleted) - return false; + return true; value = node->value; + found = true; return true; } - return m_db->get(key, value, &m_snapshot); + bool ok = m_db->safeGet(key, value, found, &m_snapshot); + if (!ok) { + ASSERT(!found); + return false; + } + return true; +} + +bool LevelDBTransaction::get(const LevelDBSlice& key, Vector<char>& value) +{ + bool found = false; + bool ok = safeGet(key, value, found); + if (!ok) { + ASSERT(!found); + ASSERT_NOT_REACHED(); + } + return ok && found; } bool LevelDBTransaction::commit() diff --git a/Source/WebCore/platform/leveldb/LevelDBTransaction.h b/Source/WebCore/platform/leveldb/LevelDBTransaction.h index 94236ff76..233a60eea 100644 --- a/Source/WebCore/platform/leveldb/LevelDBTransaction.h +++ b/Source/WebCore/platform/leveldb/LevelDBTransaction.h @@ -54,6 +54,8 @@ public: ~LevelDBTransaction(); void put(const LevelDBSlice& key, const Vector<char>& value); void remove(const LevelDBSlice& key); + bool safeGet(const LevelDBSlice& key, Vector<char>& value, bool& found); + // FIXME: Convert all callers of get to safeGet then remove get. bool get(const LevelDBSlice& key, Vector<char>& value); bool commit(); void rollback(); diff --git a/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm b/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm index 2791feb5d..6ed11c81e 100644 --- a/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm +++ b/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm @@ -30,6 +30,7 @@ #import <WebCore/FontCache.h> #import <WebCore/MemoryCache.h> #import <WebCore/PageCache.h> +#import <WebCore/LayerPool.h> #import <wtf/CurrentTime.h> #import <wtf/FastMalloc.h> @@ -148,6 +149,8 @@ void MemoryPressureHandler::releaseMemory(bool critical) memoryCache()->pruneToPercentage(critical ? 0 : 0.5f); + LayerPool::sharedPool()->drain(); + gcController().discardAllCompiledCode(); WTF::releaseFastMallocFreeMemory(); diff --git a/Source/WebCore/platform/qt/QStyleFacade.h b/Source/WebCore/platform/qt/QStyleFacade.h index 73e8362b1..d3cb43166 100644 --- a/Source/WebCore/platform/qt/QStyleFacade.h +++ b/Source/WebCore/platform/qt/QStyleFacade.h @@ -155,8 +155,6 @@ public: virtual QObject* widgetForPainter(QPainter*) = 0; virtual bool isValid() const = 0; - - static QStyle* styleForPage(Page*); }; Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleFacade::State) diff --git a/Source/WebCore/platform/qt/QWebPageClient.h b/Source/WebCore/platform/qt/QWebPageClient.h index ae3fb4e2f..1526e9d20 100644 --- a/Source/WebCore/platform/qt/QWebPageClient.h +++ b/Source/WebCore/platform/qt/QWebPageClient.h @@ -58,17 +58,10 @@ public: virtual void scroll(int dx, int dy, const QRect&) = 0; virtual void update(const QRect&) = 0; + virtual void repaintViewport() = 0; virtual void setInputMethodEnabled(bool enable) = 0; virtual bool inputMethodEnabled() const = 0; -#if USE(ACCELERATED_COMPOSITING) - virtual void setRootGraphicsLayer(WebCore::GraphicsLayer* layer) { } - - // this gets called when the compositor wants us to sync the layers - // if scheduleSync is true, we schedule a sync ourselves. otherwise, - // we wait for the next update and sync the layers then. - virtual void markForSync(bool scheduleSync = false) {} - virtual bool allowsAcceleratedCompositing() const { return false; } -#endif + virtual bool makeOpenGLContextCurrentIfAvailable() { return false; } virtual void setInputMethodHints(Qt::InputMethodHints hint) = 0; @@ -106,11 +99,6 @@ public: virtual void setWidgetVisible(WebCore::Widget*, bool visible) = 0; -#if USE(3D_GRAPHICS) - virtual void createPlatformGraphicsContext3D(PlatformGraphicsContext3D*, - PlatformGraphicsSurface3D*, - QObject** = 0) = 0; -#endif virtual QWindow* ownerWindow() const; protected: diff --git a/Source/WebCore/platform/win/DragImageCGWin.cpp b/Source/WebCore/platform/win/DragImageCGWin.cpp index cb49f95b5..93025b7f9 100644 --- a/Source/WebCore/platform/win/DragImageCGWin.cpp +++ b/Source/WebCore/platform/win/DragImageCGWin.cpp @@ -148,8 +148,10 @@ DragImageRef createDragImageFromImage(Image* img, RespectImageOrientationEnum) CGContextScaleCTM(drawContext, 1, -1); CGContextSetFillColor(drawContext, white); CGContextFillRect(drawContext, rect); - CGContextSetBlendMode(drawContext, kCGBlendModeNormal); - CGContextDrawImage(drawContext, rect, srcImage); + if (srcImage) { + CGContextSetBlendMode(drawContext, kCGBlendModeNormal); + CGContextDrawImage(drawContext, rect, srcImage); + } CGContextRelease(drawContext); exit: diff --git a/Source/WebCore/platform/win/DragImageCairoWin.cpp b/Source/WebCore/platform/win/DragImageCairoWin.cpp index a2aa975c6..44a67f5ef 100644 --- a/Source/WebCore/platform/win/DragImageCairoWin.cpp +++ b/Source/WebCore/platform/win/DragImageCairoWin.cpp @@ -173,11 +173,14 @@ DragImageRef createDragImageFromImage(Image* img, RespectImageOrientationEnum) cairo_set_source_rgb(cr, 1.0, 0.0, 1.0); cairo_fill_preserve(cr); - cairo_surface_t* srcImage = img->nativeImageForCurrentFrame()->surface(); + NativeImageCairo* srcNativeImage = img->nativeImageForCurrentFrame(); + cairo_surface_t* srcImage = (srcNativeImage) ? srcNativeImage->surface() : 0; - // Draw the image. - cairo_set_source_surface(cr, srcImage, 0.0, 0.0); - cairo_paint(cr); + if (srcImage) { + // Draw the image. + cairo_set_source_surface(cr, srcImage, 0.0, 0.0); + cairo_paint(cr); + } deallocContext(drawContext); diff --git a/Source/WebCore/plugins/PluginPackage.cpp b/Source/WebCore/plugins/PluginPackage.cpp index 78e8bdb41..05b3eb6d7 100644 --- a/Source/WebCore/plugins/PluginPackage.cpp +++ b/Source/WebCore/plugins/PluginPackage.cpp @@ -330,8 +330,10 @@ void PluginPackage::initializeBrowserFuncs() m_browserFuncs.getvalueforurl = NPN_GetValueForURL; m_browserFuncs.setvalueforurl = NPN_SetValueForURL; m_browserFuncs.getauthenticationinfo = NPN_GetAuthenticationInfo; + + m_browserFuncs.popupcontextmenu = NPN_PopUpContextMenu; } -#endif +#endif // ENABLE(NETSCAPE_PLUGIN_API) #if ENABLE(PLUGIN_PACKAGE_SIMPLE_HASH) unsigned PluginPackage::hash() const diff --git a/Source/WebCore/plugins/PluginQuirkSet.h b/Source/WebCore/plugins/PluginQuirkSet.h index 1a684fee9..7e296dc25 100644 --- a/Source/WebCore/plugins/PluginQuirkSet.h +++ b/Source/WebCore/plugins/PluginQuirkSet.h @@ -48,7 +48,8 @@ namespace WebCore { PluginQuirkRequiresGtkToolKit = 1 << 12, PluginQuirkRequiresDefaultScreenDepth = 1 << 13, PluginQuirkDontCallSetWindowMoreThanOnce = 1 << 14, - PluginQuirkIgnoreRightClickInWindowlessMode = 1 << 15 + PluginQuirkIgnoreRightClickInWindowlessMode = 1 << 15, + PluginQuirkWantsChromeUserAgent = 1 << 16 }; class PluginQuirkSet { diff --git a/Source/WebCore/plugins/PluginView.cpp b/Source/WebCore/plugins/PluginView.cpp index 5d32c938f..8a31103af 100644 --- a/Source/WebCore/plugins/PluginView.cpp +++ b/Source/WebCore/plugins/PluginView.cpp @@ -62,6 +62,7 @@ #include "ScriptValue.h" #include "SecurityOrigin.h" #include "Settings.h" +#include "WheelEvent.h" #include "npruntime_impl.h" #include <wtf/ASCIICType.h> #include <wtf/text/WTFString.h> @@ -169,6 +170,10 @@ void PluginView::handleEvent(Event* event) handleMouseEvent(static_cast<MouseEvent*>(event)); else if (event->isKeyboardEvent()) handleKeyboardEvent(static_cast<KeyboardEvent*>(event)); +#if defined(XP_MACOSX) + else if (event->type() == eventNames().mousewheelEvent) + handleWheelEvent(static_cast<WheelEvent*>(event)); +#endif else if (event->type() == eventNames().contextmenuEvent) event->setDefaultHandled(); // We don't know if the plug-in has handled mousedown event by displaying a context menu, so we never want WebKit to show a default one. #if defined(XP_UNIX) && ENABLE(NETSCAPE_PLUGIN_API) @@ -832,6 +837,9 @@ PluginView::PluginView(Frame* parentFrame, const IntSize& size, PluginPackage* p , m_instance(0) #if defined(XP_MACOSX) , m_isWindowed(false) + , m_updatedCocoaTextInputRequested(false) + , m_keyDownSent(false) + , m_disregardKeyUpCounter(0) #else , m_isWindowed(true) #endif @@ -1255,11 +1263,27 @@ static const char* MozillaUserAgent = "Mozilla/5.0 (" #endif " en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0"; +static const char* const ChromeUserAgent = "Mozilla/5.0 (" +#if defined(XP_MACOSX) + "Macintosh; U; Intel Mac OS X;" +#elif defined(XP_WIN) + "Windows; U; Windows NT 5.1;" +#elif defined(XP_UNIX) + // The Gtk port uses X11 plugins in Mac. +#if OS(DARWIN) && PLATFORM(GTK) + "X11; U; Intel Mac OS X;" +#else + "X11; U; Linux i686;" +#endif +#endif + " AppleWebKit/534.34 (KHTML, like Gecko) Chrome/19.0.1055.1 Safari/534.34"; + const char* PluginView::userAgent() { if (m_plugin->quirks().contains(PluginQuirkWantsMozillaUserAgent)) return MozillaUserAgent; - + else if (m_plugin->quirks().contains(PluginQuirkWantsChromeUserAgent)) + return ChromeUserAgent; if (m_userAgent.isNull()) m_userAgent = m_parentFrame->loader()->userAgent(m_url).utf8(); diff --git a/Source/WebCore/plugins/PluginView.h b/Source/WebCore/plugins/PluginView.h index 63ac151fa..84e62d8ae 100644 --- a/Source/WebCore/plugins/PluginView.h +++ b/Source/WebCore/plugins/PluginView.h @@ -98,6 +98,7 @@ namespace WebCore { class PluginStream; class ResourceError; class ResourceResponse; + class WheelEvent; enum PluginStatus { PluginStatusCanNotFindPlugin, @@ -229,6 +230,10 @@ namespace WebCore { const String& mimeType() const { return m_mimeType; } const KURL& url() const { return m_url; } +#if defined(XP_MACOSX) && ENABLE(NETSCAPE_PLUGIN_API) + bool popUpContextMenu(NPMenu*); +#endif + #if OS(WINDOWS) && ENABLE(NETSCAPE_PLUGIN_API) static LRESULT CALLBACK PluginViewWndProc(HWND, UINT, WPARAM, LPARAM); LRESULT wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); @@ -323,6 +328,17 @@ namespace WebCore { bool dispatchNPEvent(NPEvent&); #endif // ENABLE(NETSCAPE_PLUGIN_API) #endif +#if defined(XP_MACOSX) && ENABLE(NETSCAPE_PLUGIN_API) + int16_t dispatchNPCocoaEvent(NPCocoaEvent&); + bool m_updatedCocoaTextInputRequested; + bool m_keyDownSent; + bool m_usePixmap; + uint16_t m_disregardKeyUpCounter; +#endif + +#if defined(XP_MACOSX) + void handleWheelEvent(WheelEvent*); +#endif void updatePluginWidget(); void paintMissingPluginIcon(GraphicsContext*, const IntRect&); diff --git a/Source/WebCore/plugins/mac/PluginPackageMac.cpp b/Source/WebCore/plugins/mac/PluginPackageMac.cpp index 103322731..fead89bc3 100644 --- a/Source/WebCore/plugins/mac/PluginPackageMac.cpp +++ b/Source/WebCore/plugins/mac/PluginPackageMac.cpp @@ -57,8 +57,7 @@ void PluginPackage::determineQuirks(const String& mimeType) } if (mimeType == "application/x-shockwave-flash") { - // The flash plugin only requests windowless plugins if we return a mozilla user agent - m_quirks.add(PluginQuirkWantsMozillaUserAgent); + m_quirks.add(PluginQuirkWantsChromeUserAgent); m_quirks.add(PluginQuirkThrottleInvalidate); m_quirks.add(PluginQuirkThrottleWMUserPlusOneMessages); m_quirks.add(PluginQuirkFlashURLNotifyBug); @@ -196,6 +195,7 @@ bool PluginPackage::fetchInfo() String description = (CFStringRef)CFDictionaryGetValue(extensionsDict.get(), CFSTR("WebPluginTypeDescription")); m_mimeToDescriptions.set(mimeType, description); + determineQuirks(mimeType); } m_name = (CFStringRef)CFBundleGetValueForInfoDictionaryKey(m_module, CFSTR("WebPluginName")); diff --git a/Source/WebCore/plugins/mac/PluginViewMac.mm b/Source/WebCore/plugins/mac/PluginViewMac.mm index 42ba6a645..849a57fdf 100644 --- a/Source/WebCore/plugins/mac/PluginViewMac.mm +++ b/Source/WebCore/plugins/mac/PluginViewMac.mm @@ -58,6 +58,7 @@ #include "RenderObject.h" #include "ScriptController.h" #include "Settings.h" +#include "WheelEvent.h" #include "npruntime_impl.h" #include "runtime_root.h" #include <runtime/JSLock.h> @@ -75,9 +76,12 @@ using JSC::JSValue; #include <QWidget> #include <QKeyEvent> #include <QPainter> +#include <QDateTime> +#include <QPixmap> #include "QWebPageClient.h" QT_BEGIN_NAMESPACE extern Q_GUI_EXPORT OSWindowRef qt_mac_window_for(const QWidget* w); +extern Q_GUI_EXPORT CGContextRef qt_mac_cg_context(const QPaintDevice *pdev); //qpaintdevice_mac.cpp QT_END_NAMESPACE #endif @@ -144,6 +148,25 @@ static inline IntPoint topLevelOffsetFor(PlatformWidget widget) return IntPoint(); } +// --------- Cocoa specific utility functions ---------- + +static void initializeNPCocoaEvent(NPCocoaEvent* event) +{ + memset(event, 0, sizeof(NPCocoaEvent)); +} + +static int32_t getModifiers(UIEventWithKeyState *event) +{ + int32_t modifiers = 0; + if (event->keyCode() == 57) modifiers |= NSAlphaShiftKeyMask; + if (event->shiftKey()) modifiers |= NSShiftKeyMask; + if (event->ctrlKey()) modifiers |= NSControlKeyMask; + if (event->metaKey()) modifiers |= NSCommandKeyMask; + if (event->altKey()) modifiers |= NSAlternateKeyMask; + + return modifiers; +} + // --------------- Lifetime management ----------------- bool PluginView::platformStart() @@ -179,28 +202,40 @@ bool PluginView::platformStart() NPBool eventModelSupported; if (getValueStatic(NPNVariable(NPNVsupportsCarbonBool + m_eventModel), &eventModelSupported) != NPERR_NO_ERROR || !eventModelSupported) { +#else + NPBool eventModelSupported; + if (getValueStatic(NPNVariable(NPNVsupportsCocoaBool/* + m_eventModel*/), &eventModelSupported) != NPERR_NO_ERROR + || !eventModelSupported) { #endif m_status = PluginStatusCanNotLoadPlugin; LOG(Plugins, "Plug-in '%s' uses unsupported event model %s", m_plugin->name().utf8().data(), prettyNameForEventModel(m_eventModel)); return false; -#ifndef NP_NO_CARBON } -#endif #ifndef NP_NO_QUICKDRAW NPBool drawingModelSupported; if (getValueStatic(NPNVariable(NPNVsupportsQuickDrawBool + m_drawingModel), &drawingModelSupported) != NPERR_NO_ERROR || !drawingModelSupported) { + m_status = PluginStatusCanNotLoadPlugin; + LOG(Plugins, "Plug-in '%s' uses unsupported drawing model %s", + m_plugin->name().utf8().data(), prettyNameForDrawingModel(m_drawingModel)); + return false; + } #endif + +#ifdef NP_NO_QUICKDRAW + NPBool drawingModelSupported; + if (getValueStatic(NPNVariable(NPNVsupportsCoreGraphicsBool/* + m_drawingModel*/), &drawingModelSupported) != NPERR_NO_ERROR + || !drawingModelSupported) { m_status = PluginStatusCanNotLoadPlugin; LOG(Plugins, "Plug-in '%s' uses unsupported drawing model %s", m_plugin->name().utf8().data(), prettyNameForDrawingModel(m_drawingModel)); return false; -#ifndef NP_NO_QUICKDRAW } #endif + #if PLATFORM(QT) // Set the platformPluginWidget only in the case of QWebView so that the context menu appears in the right place. // In all other cases, we use off-screen rendering @@ -215,27 +250,29 @@ bool PluginView::platformStart() #endif // Create a fake window relative to which all events will be sent when using offscreen rendering - if (!platformPluginWidget()) { #ifndef NP_NO_CARBON + if (!platformPluginWidget()) { // Make the default size really big. It is unclear why this is required but with a smaller size, mouse move // events don't get processed. Resizing the fake window to flash's size doesn't help. ::Rect windowBounds = { 0, 0, 1000, 1000 }; CreateNewWindow(kDocumentWindowClass, kWindowStandardDocumentAttributes, &windowBounds, &m_fakeWindow); // Flash requires the window to be hilited to process mouse move events. HiliteWindow(m_fakeWindow, true); -#endif } +#endif updatePluginWidget(); if (!m_plugin->quirks().contains(PluginQuirkDeferFirstSetWindowCall)) setNPWindowIfNeeded(); +#ifndef NP_NO_CARBON // TODO: Implement null timer throttling depending on plugin activation m_nullEventTimer = adoptPtr(new Timer<PluginView>(this, &PluginView::nullEventTimerFired)); m_nullEventTimer->startRepeating(0.02); m_lastMousePos.h = m_lastMousePos.v = 0; +#endif // NP_NO_CARBON return true; } @@ -276,7 +313,7 @@ bool PluginView::platformGetValueStatic(NPNVariable variable, void* value, NPErr #endif case NPNVsupportsCocoaBool: - *static_cast<NPBool*>(value) = false; + *static_cast<NPBool*>(value) = true; *result = NPERR_NO_ERROR; return true; @@ -286,6 +323,11 @@ bool PluginView::platformGetValueStatic(NPNVariable variable, void* value, NPErr *result = NPERR_NO_ERROR; return true; + case NPNVsupportsAdvancedKeyHandling: + *static_cast<NPBool*>(value) = true; + *result = NPERR_NO_ERROR; + return true; + #ifndef NP_NO_QUICKDRAW // QuickDraw is deprecated in 10.5 and not supported on 64-bit case NPNVsupportsQuickDrawBool: @@ -304,6 +346,20 @@ bool PluginView::platformGetValueStatic(NPNVariable variable, void* value, NPErr // Used only for variables that need a view to resolve bool PluginView::platformGetValue(NPNVariable variable, void* value, NPError* error) { + // In WebKit2, this is set if the plugin queries it's availiablity and + // no key down events have already been sent. + if (variable == NPNVsupportsUpdatedCocoaTextInputBool) { + if (m_keyDownSent && !m_updatedCocoaTextInputRequested) { + *static_cast<NPBool*>(value) = false; + *error = NPERR_NO_ERROR; + } + else { + *static_cast<NPBool*>(value) = true; + *error = NPERR_NO_ERROR; + m_updatedCocoaTextInputRequested = true; + } + return true; + } return false; } @@ -342,21 +398,22 @@ void PluginView::setFocus(bool focused) LOG(Plugins, "PluginView::setFocus(%d)", focused); if (!focused) { Widget::setFocus(focused); - return; + if (m_eventModel != NPEventModelCocoa) + return; } if (platformPluginWidget()) #if PLATFORM(QT) - static_cast<QWidget*>(platformPluginWidget())->setFocus(Qt::OtherFocusReason); + static_cast<QWidget*>(platformPluginWidget())->setFocus(Qt::OtherFocusReason); #else platformPluginWidget()->SetFocus(); #endif - else - Widget::setFocus(focused); + else + Widget::setFocus(focused); - // TODO: Also handle and pass on blur events (focus lost) #ifndef NP_NO_CARBON + // TODO: Also handle and pass on blur events (focus lost) EventRecord record; record.what = NPEventType_GetFocusEvent; record.message = 0; @@ -367,6 +424,17 @@ void PluginView::setFocus(bool focused) if (!dispatchNPEvent(record)) LOG(Events, "PluginView::setFocus(%d): Focus event not accepted", focused); #endif + { + NPCocoaEvent cocoaEvent; + initializeNPCocoaEvent(&cocoaEvent); + cocoaEvent.type = NPCocoaEventFocusChanged; + NPBool focus = focused; + cocoaEvent.data.focus.hasFocus = focus; + + if(!dispatchNPCocoaEvent(cocoaEvent)) { + LOG(Events, "PluginView::setFocus(): Focus event %d not accepted", cocoaEvent.type); + } + } } void PluginView::setParentVisible(bool visible) @@ -399,8 +467,10 @@ void PluginView::setNPWindowIfNeeded() m_npWindow.type = NPWindowTypeDrawable; } - if (!newContextRef || !newWindowRef) - return; + if (!newContextRef || !newWindowRef) { + if (!m_usePixmap) + return; + } m_npWindow.window = (void*)&m_npCgContext; #ifndef NP_NO_CARBON @@ -474,12 +544,32 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect) if (context->paintingDisabled()) return; - - setNPWindowIfNeeded(); - +#if PLATFORM(QT) + QPainter* p = context->platformContext(); + CGContextRef cgContext = qt_mac_cg_context(p->device()); +#else CGContextRef cgContext = m_npCgContext.context; - if (!cgContext) - return; +#endif + setNPWindowIfNeeded(); + if (!cgContext) { + cgContext = m_contextRef; + if (!cgContext) + return; + else { + m_usePixmap = true; + setNPWindowIfNeeded(); + } + } else + m_usePixmap = false; + + bool oldUsePixmap = m_usePixmap; + if (m_isTransparent && !m_usePixmap) { + if (m_pixmap.isNull()) + m_pixmap = QPixmap(frameRect().size()); + m_usePixmap = true; + setNPWindowIfNeeded(); + cgContext = qt_mac_cg_context(&m_pixmap); + } CGContextSaveGState(cgContext); if (platformPluginWidget()) { @@ -498,7 +588,7 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect) r.size.height = targetRect.height(); CGContextClipToRect(cgContext, r); - if (!platformPluginWidget() && m_isTransparent) { // clean the pixmap in transparent mode + if (!platformPluginWidget() || m_isTransparent) { // clean the pixmap in transparent mode #if PLATFORM(QT) QPainter painter(&m_pixmap); painter.setCompositionMode(QPainter::CompositionMode_Clear); @@ -507,39 +597,70 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect) } #ifndef NP_NO_CARBON - EventRecord event; - event.what = updateEvt; - event.message = (long unsigned int)m_npCgContext.window; - event.when = TickCount(); - event.where.h = 0; - event.where.v = 0; - event.modifiers = GetCurrentKeyModifiers(); - - if (!dispatchNPEvent(event)) - LOG(Events, "PluginView::paint(): Paint event not accepted"); + if (m_eventModel != NPEventModelCocoa) { + EventRecord event; + event.what = updateEvt; + event.message = (long unsigned int)m_npCgContext.window; + event.when = TickCount(); + event.where.h = 0; + event.where.v = 0; + event.modifiers = GetCurrentKeyModifiers(); + + if (!dispatchNPEvent(event)) + LOG(Events, "PluginView::paint(): Paint event not accepted"); + } else #endif - - CGContextRestoreGState(cgContext); - - if (!platformPluginWidget()) { + { + NPCocoaEvent cocoaEvent; + initializeNPCocoaEvent(&cocoaEvent); + cocoaEvent.type = NPCocoaEventDrawRect; + cocoaEvent.data.draw.x = m_usePixmap ? 0 : r.origin.x; + cocoaEvent.data.draw.y = m_usePixmap ? 0 : r.origin.y; + cocoaEvent.data.draw.width = m_usePixmap ? m_pixmap.width() : r.size.width; + cocoaEvent.data.draw.height = m_usePixmap ? m_pixmap.height() : r.size.height; + cocoaEvent.data.draw.context = cgContext; + + if(!dispatchNPCocoaEvent(cocoaEvent)) + LOG(Events, "PluginView::paint(): Paint event type %d not accepted", cocoaEvent.type); + } + + if (!platformPluginWidget() || m_isTransparent) { #if PLATFORM(QT) QPainter* painter = context->platformContext(); - painter->drawPixmap(targetRect.x(), targetRect.y(), m_pixmap, + painter->drawPixmap(targetRect.x(), targetRect.y(), m_pixmap, targetRect.x() - frameRect().x(), targetRect.y() - frameRect().y(), targetRect.width(), targetRect.height()); #endif } + CGContextRestoreGState(cgContext); + if (oldUsePixmap != m_usePixmap) { + m_usePixmap = oldUsePixmap; + m_pixmap = QPixmap(); + } } +bool PluginView::popUpContextMenu(NPMenu *menu) +{ + NSEvent* currentEvent = [NSApp currentEvent]; + + // NPN_PopUpContextMenu must be called from within the plug-in's NPP_HandleEvent. + if (!currentEvent) + return NPERR_GENERIC_ERROR; + + NSWindow* window = [currentEvent window]; + NSView* view = [window contentView]; + [NSMenu popUpContextMenu:(NSMenu*)menu withEvent:currentEvent forView:view]; + return true; +} + void PluginView::invalidateRect(const IntRect& rect) { - if (platformPluginWidget()) + if (platformPluginWidget() && m_isTransparent) #if PLATFORM(QT) static_cast<QWidget*>(platformPluginWidget())->update(convertToContainingWindow(rect)); #else platformPluginWidget()->RefreshRect(convertToContainingWindow(rect)); #endif - else - invalidateWindowlessPluginRect(rect); + invalidateWindowlessPluginRect(rect); } void PluginView::invalidateRect(NPRect* rect) @@ -561,129 +682,297 @@ void PluginView::forceRedraw() // ----------------- Event handling -------------------- +void PluginView::handleWheelEvent(WheelEvent *event) +{ + if (!m_isStarted || m_eventModel != NPEventModelCocoa) + return; + + NPCocoaEvent cocoaEvent; + initializeNPCocoaEvent(&cocoaEvent); + + NSEvent *currentEvent = [NSApp currentEvent]; + + cocoaEvent.type = NPCocoaEventScrollWheel; + + cocoaEvent.data.mouse.pluginX = event->layerX() - m_npWindow.x + m_windowRect.x() - m_element->offsetLeft(); + cocoaEvent.data.mouse.pluginY = event->layerY() - m_npWindow.y + m_windowRect.y() - m_element->offsetTop(); + cocoaEvent.data.mouse.deltaX = [currentEvent deltaX]; + cocoaEvent.data.mouse.deltaY = [currentEvent deltaY]; + cocoaEvent.data.mouse.deltaZ = [currentEvent deltaZ]; + cocoaEvent.data.mouse.modifierFlags = getModifiers(event); + + if(!dispatchNPCocoaEvent(cocoaEvent)) { + LOG(Events, "PluginView::handleMouseEvent(): Wheel event type %d at %d,%d not accepted", cocoaEvent.type + cocoaEvent.data.mouse.x, cocoaEvent.data.mouse.y); + } + event->setDefaultHandled(); +} void PluginView::handleMouseEvent(MouseEvent* event) { if (!m_isStarted) return; - + #ifndef NP_NO_CARBON - EventRecord record; - - if (event->type() == eventNames().mousemoveEvent) { - // Mouse movement is handled by null timer events - m_lastMousePos = mousePosForPlugin(event); - return; - } else if (event->type() == eventNames().mouseoverEvent) { - record.what = NPEventType_AdjustCursorEvent; - } else if (event->type() == eventNames().mouseoutEvent) { - record.what = NPEventType_AdjustCursorEvent; - } else if (event->type() == eventNames().mousedownEvent) { - record.what = mouseDown; - // The plugin needs focus to receive keyboard events - if (Page* page = m_parentFrame->page()) - page->focusController()->setFocusedFrame(m_parentFrame); - m_parentFrame->document()->setFocusedNode(m_element); - } else if (event->type() == eventNames().mouseupEvent) { - record.what = mouseUp; - } else { - return; - } - record.where = mousePosForPlugin(event); - record.modifiers = modifiersForEvent(event); - - if (!event->buttonDown()) - record.modifiers |= btnState; - - if (event->button() == 2) - record.modifiers |= controlKey; - - if (!dispatchNPEvent(record)) { - if (record.what == NPEventType_AdjustCursorEvent) - return; // Signals that the plugin wants a normal cursor - - LOG(Events, "PluginView::handleMouseEvent(): Mouse event type %d at %d,%d not accepted", + if (m_eventModel != NPEventModelCocoa) { + EventRecord record; + + if (event->type() == eventNames().mousemoveEvent) { + // Mouse movement is handled by null timer events + m_lastMousePos = mousePosForPlugin(event); + return; + } else if (event->type() == eventNames().mouseoverEvent) { + record.what = NPEventType_AdjustCursorEvent; + } else if (event->type() == eventNames().mouseoutEvent) { + record.what = NPEventType_AdjustCursorEvent; + } else if (event->type() == eventNames().mousedownEvent) { + record.what = mouseDown; + // The plugin needs focus to receive keyboard events + if (Page* page = m_parentFrame->page()) + page->focusController()->setFocusedFrame(m_parentFrame); + m_parentFrame->document()->setFocusedNode(m_element); + } else if (event->type() == eventNames().mouseupEvent) { + record.what = mouseUp; + } else { + return; + } + record.where = mousePosForPlugin(event); + record.modifiers = modifiersForEvent(event); + + if (!event->buttonDown()) + record.modifiers |= btnState; + + if (event->button() == 2) + record.modifiers |= controlKey; + + if (!dispatchNPEvent(record)) { + if (record.what == NPEventType_AdjustCursorEvent) + return; // Signals that the plugin wants a normal cursor + + LOG(Events, "PluginView::handleMouseEvent(): Mouse event type %d at %d,%d not accepted", record.what, record.where.h, record.where.v); - } else { + } else { + event->setDefaultHandled(); + } + } else +#endif + { + NPCocoaEventType eventType; + int32_t buttonNumber = 0; + int32_t clickCount = 0; + NSEvent *currentEvent = [NSApp currentEvent]; + + NSEventType type = [currentEvent type]; + + switch (type) { + case NSLeftMouseDown: + case NSRightMouseDown: + case NSOtherMouseDown: + buttonNumber = [currentEvent buttonNumber]; + clickCount = [currentEvent clickCount]; + eventType = NPCocoaEventMouseDown; + // The plugin needs focus to receive keyboard events + if (Page* page = m_parentFrame->page()) + page->focusController()->setFocusedFrame(m_parentFrame); + m_parentFrame->document()->setFocusedNode(m_element); + break; + + case NSLeftMouseUp: + case NSRightMouseUp: + case NSOtherMouseUp: + buttonNumber = [currentEvent buttonNumber]; + clickCount = [currentEvent clickCount]; + eventType = NPCocoaEventMouseUp; + break; + + case NSMouseMoved: + eventType = NPCocoaEventMouseMoved; + break; + + case NSLeftMouseDragged: + case NSRightMouseDragged: + case NSOtherMouseDragged: + buttonNumber = [currentEvent buttonNumber]; + eventType = NPCocoaEventMouseDragged; + break; + + case NSMouseEntered: + eventType = NPCocoaEventMouseEntered; + break; + + case NSMouseExited: + eventType = NPCocoaEventMouseExited; + default: + return; + } + + NPCocoaEvent cocoaEvent; + initializeNPCocoaEvent(&cocoaEvent); + + cocoaEvent.type = eventType; + if (!(NPCocoaEventMouseEntered == eventType || NPCocoaEventMouseExited == eventType)) { + cocoaEvent.data.mouse.buttonNumber = buttonNumber; + cocoaEvent.data.mouse.clickCount = clickCount; + } + + cocoaEvent.data.mouse.pluginX = event->layerX() - m_npWindow.x + m_windowRect.x() - m_element->offsetLeft(); + cocoaEvent.data.mouse.pluginY = event->layerY() - m_npWindow.y + m_windowRect.y() - m_element->offsetTop(); + cocoaEvent.data.mouse.deltaX = [currentEvent deltaX]; + cocoaEvent.data.mouse.deltaY = [currentEvent deltaY]; + cocoaEvent.data.mouse.deltaZ = [currentEvent deltaZ]; + cocoaEvent.data.mouse.modifierFlags = getModifiers(event); + + int16_t response = dispatchNPCocoaEvent(cocoaEvent); + if(response = kNPEventNotHandled) { + LOG(Events, "PluginView::handleMouseEvent(): Mouse event type %d at %d,%d not accepted", cocoaEvent.type + cocoaEvent.data.mouse.x, cocoaEvent.data.mouse.y); + } + + // Safari policy is to return true for all mouse events, because some plugins + // return false even if they have handled the event. event->setDefaultHandled(); } -#endif } - + void PluginView::handleKeyboardEvent(KeyboardEvent* event) { if (!m_isStarted) return; - LOG(Plugins, "PluginView::handleKeyboardEvent() ----------------- "); - + LOG(Plugins, "PV::hKE(): KE.keyCode: 0x%02X, KE.charCode: %d", - event->keyCode(), event->charCode()); - + event->keyCode(), event->charCode()); + #ifndef NP_NO_CARBON - EventRecord record; - - if (event->type() == eventNames().keydownEvent) { - // This event is the result of a PlatformEvent::KeyDown which - // was disambiguated into a PlatformKeyboardEvent::RawKeyDown. Since - // we don't have access to the text here, we return, and wait for the - // corresponding event based on PlatformKeyboardEvent::Char. - return; - } else if (event->type() == eventNames().keypressEvent) { - // Which would be this one. This event was disambiguated from the same - // PlatformEvent::KeyDown, but to a PlatformEvent::Char, - // which retains the text from the original event. So, we can safely pass - // on the event as a key-down event to the plugin. - record.what = keyDown; - } else if (event->type() == eventNames().keyupEvent) { - // PlatformEvent::KeyUp events always have the text, so nothing - // fancy here. - record.what = keyUp; - } else { - return; - } - - const PlatformKeyboardEvent* platformEvent = event->keyEvent(); - int keyCode = platformEvent->nativeVirtualKeyCode(); - - const String text = platformEvent->text(); - if (text.length() < 1) { - event->setDefaultHandled(); - return; - } - - WTF::RetainPtr<CFStringRef> cfText(WTF::AdoptCF, text.createCFString()); - - LOG(Plugins, "PV::hKE(): PKE.text: %s, PKE.unmodifiedText: %s, PKE.keyIdentifier: %s", + if (m_eventModel != NPEventModelCocoa) { + EventRecord record; + if (event->type() == eventNames().keydownEvent) { + // This event is the result of a PlatformKeyboardEvent::KeyDown which + // was disambiguated into a PlatformKeyboardEvent::RawKeyDown. Since + // we don't have access to the text here, we return, and wait for the + // corresponding event based on PlatformKeyboardEvent::Char. + return; + } else if (event->type() == eventNames().keypressEvent) { + // Which would be this one. This event was disambiguated from the same + // PlatformKeyboardEvent::KeyDown, but to a PlatformKeyboardEvent::Char, + // which retains the text from the original event. So, we can safely pass + // on the event as a key-down event to the plugin. + record.what = keyDown; + } else if (event->type() == eventNames().keyupEvent) { + // PlatformKeyboardEvent::KeyUp events always have the text, so nothing + // fancy here. + record.what = keyUp; + } else { + return; + } + + const PlatformKeyboardEvent* platformEvent = event->keyEvent(); + int keyCode = platformEvent->nativeVirtualKeyCode(); + + const String text = platformEvent->text(); + if (text.length() < 1) { + event->setDefaultHandled(); + return; + } + + WTF::RetainPtr<CFStringRef> cfText(WTF::AdoptCF, text.createCFString()); + + LOG(Plugins, "PV::hKE(): PKE.text: %s, PKE.unmodifiedText: %s, PKE.keyIdentifier: %s", text.ascii().data(), platformEvent->unmodifiedText().ascii().data(), platformEvent->keyIdentifier().ascii().data()); - - char charCodes[2] = { 0, 0 }; - if (!CFStringGetCString(cfText.get(), charCodes, 2, CFStringGetSystemEncoding())) { - LOG_ERROR("Could not resolve character code using system encoding."); - event->setDefaultHandled(); - return; - } - - record.where = globalMousePosForPlugin(); - record.modifiers = modifiersForEvent(event); - record.message = ((keyCode & 0xFF) << 8) | (charCodes[0] & 0xFF); - record.when = TickCount(); - - LOG(Plugins, "PV::hKE(): record.modifiers: %d", record.modifiers); - + + char charCodes[2] = { 0, 0 }; + if (!CFStringGetCString(cfText.get(), charCodes, 2, CFStringGetSystemEncoding())) { + LOG_ERROR("Could not resolve character code using system encoding."); + event->setDefaultHandled(); + return; + } + + record.where = globalMousePosForPlugin(); + record.modifiers = modifiersForEvent(event); + record.message = ((keyCode & 0xFF) << 8) | (charCodes[0] & 0xFF); + record.when = TickCount(); + + LOG(Plugins, "PV::hKE(): record.modifiers: %d", record.modifiers); + #if PLATFORM(QT) - LOG(Plugins, "PV::hKE(): PKE.qtEvent()->nativeVirtualKey: 0x%02X, charCode: %d", - keyCode, int(uchar(charCodes[0]))); + LOG(Plugins, "PV::hKE(): PKE.qtEvent()->nativeVirtualKey: 0x%02X, charCode: %d", + keyCode, int(uchar(charCodes[0]))); #endif - - if (!dispatchNPEvent(record)) - LOG(Events, "PluginView::handleKeyboardEvent(): Keyboard event type %d not accepted", record.what); - else - event->setDefaultHandled(); + + if (!dispatchNPEvent(record)) + LOG(Events, "PluginView::handleKeyboardEvent(): Keyboard event type %d not accepted", record.what); + else + event->setDefaultHandled(); + } else #endif + { + NSEvent *currentEvent = [NSApp currentEvent]; + NPCocoaEventType eventType; + NSEventType type = [currentEvent type]; + + switch (type) { + case NSKeyDown: + eventType = NPCocoaEventKeyDown; + m_keyDownSent = true; + break; + case NSKeyUp: + if (m_disregardKeyUpCounter > 0) { + m_disregardKeyUpCounter--; + event->setDefaultHandled(); + return; + } + eventType = NPCocoaEventKeyUp; + break; + case NSFlagsChanged: + eventType = NPCocoaEventFlagsChanged; + break; + default: + return; + } + + NPCocoaEvent cocoaEvent; + initializeNPCocoaEvent(&cocoaEvent); + cocoaEvent.type = eventType; + if (eventType != NPCocoaEventFlagsChanged) { + NSString *characters = [currentEvent characters]; + NSString *charactersIgnoringModifiers = [currentEvent charactersIgnoringModifiers]; + cocoaEvent.data.key.characters = reinterpret_cast<NPNSString*>(characters); + cocoaEvent.data.key.charactersIgnoringModifiers = reinterpret_cast<NPNSString*>(charactersIgnoringModifiers); + cocoaEvent.data.key.isARepeat = [currentEvent isARepeat]; + cocoaEvent.data.key.keyCode = [currentEvent keyCode]; + cocoaEvent.data.key.modifierFlags = getModifiers(event); + } + + int16_t response = dispatchNPCocoaEvent(cocoaEvent); + if(response == kNPEventNotHandled) { + LOG(Events, "PluginView::handleKeyboardEvent(): Keyboard event type %d not accepted", cocoaEvent.type); + } else if (response == kNPEventStartIME) { + // increment counter and resend as a text input + m_disregardKeyUpCounter++; + NPCocoaEvent textEvent; + initializeNPCocoaEvent(&textEvent); + textEvent.type = NPCocoaEventTextInput; + textEvent.data.text.text = reinterpret_cast<NPNSString*>([currentEvent characters]); + response = dispatchNPCocoaEvent(textEvent); + if(response == kNPEventNotHandled) + LOG(Events, "PluginView::handleKeyboardEvent(): Keyboard event type %d not accepted", cocoaEvent.type); + } + + // All keyboard events need to be handled to prevent them falling + // through to the page, unless they are Meta key events, in which + // case they are, unless they are Cmd+a. From WebKit2, possibly + // not the most elegant piece of key handling code..... + if (event->metaKey()) { + if (cocoaEvent.data.key.keyCode == 0) + event->setDefaultHandled(); + } else { + // else ignore, it's a Meta Key event for the browser. + event->setDefaultHandled(); + } + } } - + #ifndef NP_NO_CARBON void PluginView::nullEventTimerFired(Timer<PluginView>*) { @@ -782,6 +1071,21 @@ bool PluginView::dispatchNPEvent(NPEvent& event) } #endif + +int16_t PluginView::dispatchNPCocoaEvent(NPCocoaEvent& cocoaEvent) +{ + PluginView::setCurrentPluginView(this); + JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonJSGlobalData()); + setCallingPlugin(true); + + int16_t response = m_plugin->pluginFuncs()->event(m_instance, &cocoaEvent); + + setCallingPlugin(false); + PluginView::setCurrentPluginView(0); + + return response; +} + // ------------------- Miscellaneous ------------------ NPError PluginView::handlePostReadFile(Vector<char>& buffer, uint32_t len, const char* buf) diff --git a/Source/WebCore/plugins/npapi.cpp b/Source/WebCore/plugins/npapi.cpp index 38a18f570..662357143 100644 --- a/Source/WebCore/plugins/npapi.cpp +++ b/Source/WebCore/plugins/npapi.cpp @@ -199,3 +199,16 @@ NPError NPN_GetAuthenticationInfo(NPP instance, const char* protocol, const char { return pluginViewForInstance(instance)->getAuthenticationInfo(protocol, host, port, scheme, realm, username, ulen, password, plen); } + +NPError NPN_PopUpContextMenu(NPP instance, NPMenu* menu) +{ +#if PLATFORM(QT) && defined(XP_MACOSX) + PluginView* plugin = pluginViewForInstance(instance); + plugin->popUpContextMenu(menu); + return NPERR_NO_ERROR; +#else + UNUSED_PARAM(instance); + UNUSED_PARAM(menu); + return NPERR_NO_ERROR; +#endif // PLATFORM(QT) && defined(XP_MACOSX) +} diff --git a/Source/WebCore/plugins/npapi.h b/Source/WebCore/plugins/npapi.h index 305a1626c..296ef0ed4 100644 --- a/Source/WebCore/plugins/npapi.h +++ b/Source/WebCore/plugins/npapi.h @@ -415,7 +415,9 @@ typedef enum { NPNVSupportsWindowless = 17, - NPNVprivateModeBool = 18 + NPNVprivateModeBool = 18, + + NPNVsupportsAdvancedKeyHandling = 21 #if defined(XP_MACOSX) /* Used for negotiating drawing models */ diff --git a/Source/WebCore/rendering/InlineFlowBox.cpp b/Source/WebCore/rendering/InlineFlowBox.cpp index f2eed4b95..a0ef3c6c3 100644 --- a/Source/WebCore/rendering/InlineFlowBox.cpp +++ b/Source/WebCore/rendering/InlineFlowBox.cpp @@ -670,7 +670,7 @@ void InlineFlowBox::placeBoxesInBlockDirection(LayoutUnit top, LayoutUnit maxHei // Treat the leading on the first and last lines of ruby runs as not being part of the overall lineTop/lineBottom. // Really this is a workaround hack for the fact that ruby should have been done as line layout and not done using // inline-block. - if (!renderer()->style()->isFlippedLinesWritingMode()) + if (renderer()->style()->isFlippedLinesWritingMode() == (curr->renderer()->style()->rubyPosition() == RubyPositionAfter)) hasAnnotationsBefore = true; else hasAnnotationsAfter = true; @@ -1461,7 +1461,7 @@ LayoutUnit InlineFlowBox::computeOverAnnotationAdjustment(LayoutUnit allowedPosi if (curr->isInlineFlowBox()) result = max(result, toInlineFlowBox(curr)->computeOverAnnotationAdjustment(allowedPosition)); - if (curr->renderer()->isReplaced() && curr->renderer()->isRubyRun()) { + if (curr->renderer()->isReplaced() && curr->renderer()->isRubyRun() && curr->renderer()->style()->rubyPosition() == RubyPositionBefore) { RenderRubyRun* rubyRun = toRenderRubyRun(curr->renderer()); RenderRubyText* rubyText = rubyRun->rubyText(); if (!rubyText) @@ -1509,6 +1509,27 @@ LayoutUnit InlineFlowBox::computeUnderAnnotationAdjustment(LayoutUnit allowedPos if (curr->isInlineFlowBox()) result = max(result, toInlineFlowBox(curr)->computeUnderAnnotationAdjustment(allowedPosition)); + if (curr->renderer()->isReplaced() && curr->renderer()->isRubyRun() && curr->renderer()->style()->rubyPosition() == RubyPositionAfter) { + RenderRubyRun* rubyRun = toRenderRubyRun(curr->renderer()); + RenderRubyText* rubyText = rubyRun->rubyText(); + if (!rubyText) + continue; + + if (rubyRun->style()->isFlippedLinesWritingMode()) { + LayoutUnit topOfFirstRubyTextLine = rubyText->logicalTop() + (rubyText->firstRootBox() ? rubyText->firstRootBox()->lineTop() : LayoutUnit()); + if (topOfFirstRubyTextLine >= 0) + continue; + topOfFirstRubyTextLine += curr->logicalTop(); + result = max(result, allowedPosition - topOfFirstRubyTextLine); + } else { + LayoutUnit bottomOfLastRubyTextLine = rubyText->logicalTop() + (rubyText->lastRootBox() ? rubyText->lastRootBox()->lineBottom() : rubyText->logicalHeight()); + if (bottomOfLastRubyTextLine <= curr->logicalHeight()) + continue; + bottomOfLastRubyTextLine += curr->logicalTop(); + result = max(result, bottomOfLastRubyTextLine - allowedPosition); + } + } + if (curr->isInlineTextBox()) { RenderStyle* style = curr->renderer()->style(isFirstLineStyle()); if (style->textEmphasisMark() != TextEmphasisMarkNone && style->textEmphasisPosition() == TextEmphasisPositionUnder) { diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp index 44f3de11a..33dc945e9 100644 --- a/Source/WebCore/rendering/RenderBox.cpp +++ b/Source/WebCore/rendering/RenderBox.cpp @@ -3624,6 +3624,10 @@ LayoutRect RenderBox::localCaretRect(InlineBox* box, int caretOffset, LayoutUnit // Move to local coords rect.moveBy(-location()); + + if (!isHorizontalWritingMode()) + return rect.transposedRect(); + return rect; } diff --git a/Source/WebCore/rendering/RenderBoxModelObject.cpp b/Source/WebCore/rendering/RenderBoxModelObject.cpp index 293591d76..cd1822f3e 100644 --- a/Source/WebCore/rendering/RenderBoxModelObject.cpp +++ b/Source/WebCore/rendering/RenderBoxModelObject.cpp @@ -2758,7 +2758,7 @@ LayoutRect RenderBoxModelObject::localCaretRectForEmptyElement(LayoutUnit width, LayoutUnit y = paddingTop() + borderTop(); - return LayoutRect(x, y, caretWidth, height); + return currentStyle->isHorizontalWritingMode() ? LayoutRect(x, y, caretWidth, height) : LayoutRect(y, x, height, caretWidth); } bool RenderBoxModelObject::shouldAntialiasLines(GraphicsContext* context) diff --git a/Source/WebCore/rendering/RenderGrid.cpp b/Source/WebCore/rendering/RenderGrid.cpp index 492a83f88..e7a351c86 100644 --- a/Source/WebCore/rendering/RenderGrid.cpp +++ b/Source/WebCore/rendering/RenderGrid.cpp @@ -116,10 +116,10 @@ void RenderGrid::computePreferredLogicalWidths() // FIXME: We don't take our own logical width into account. - const Vector<Length>& trackStyles = style()->gridColumns(); + const Vector<GridTrackSize>& trackStyles = style()->gridColumns(); for (size_t i = 0; i < trackStyles.size(); ++i) { - Length trackLength = trackStyles[i]; + Length trackLength = trackStyles[i].length(); if (!trackLength.isFixed()) { notImplemented(); continue; @@ -138,11 +138,11 @@ void RenderGrid::computePreferredLogicalWidths() void RenderGrid::computedUsedBreadthOfGridTracks(TrackSizingDirection direction, Vector<GridTrack>& tracks) { - const Vector<Length>& trackStyles = (direction == ForColumns) ? style()->gridColumns() : style()->gridRows(); + const Vector<GridTrackSize>& trackStyles = (direction == ForColumns) ? style()->gridColumns() : style()->gridRows(); for (size_t i = 0; i < trackStyles.size(); ++i) { GridTrack track; - if (trackStyles[i].isFixed()) - track.m_usedBreadth = trackStyles[i].getFloatValue(); + if (trackStyles[i].length().isFixed()) + track.m_usedBreadth = trackStyles[i].length().getFloatValue(); else notImplemented(); @@ -165,10 +165,13 @@ void RenderGrid::layoutGridItems() size_t columnTrack = resolveGridPosition(child->style()->gridItemColumn()); size_t rowTrack = resolveGridPosition(child->style()->gridItemRow()); - // Because the grid area cannot be styled, we don't need to adjust - // the grid breadth to account for 'box-sizing'. - child->setOverrideContainingBlockContentLogicalWidth(columnTracks[columnTrack].m_usedBreadth); - child->setOverrideContainingBlockContentLogicalHeight(rowTracks[rowTrack].m_usedBreadth); + // FIXME: Properly support implicit rows and columns (bug 103573). + if (columnTrack < columnTracks.size() && rowTrack < rowTracks.size()) { + // Because the grid area cannot be styled, we don't need to adjust + // the grid breadth to account for 'box-sizing'. + child->setOverrideContainingBlockContentLogicalWidth(columnTracks[columnTrack].m_usedBreadth); + child->setOverrideContainingBlockContentLogicalHeight(rowTracks[rowTrack].m_usedBreadth); + } // FIXME: Grid items should stretch to fill their cells. Once we // implement grid-{column,row}-align, we can also shrink to fit. For diff --git a/Source/WebCore/rendering/RenderMultiColumnSet.cpp b/Source/WebCore/rendering/RenderMultiColumnSet.cpp index 686fc3cf0..21bf10fe7 100644 --- a/Source/WebCore/rendering/RenderMultiColumnSet.cpp +++ b/Source/WebCore/rendering/RenderMultiColumnSet.cpp @@ -41,6 +41,10 @@ RenderMultiColumnSet::RenderMultiColumnSet(Node* node, RenderFlowThread* flowThr , m_computedColumnCount(1) , m_computedColumnWidth(0) , m_computedColumnHeight(0) + , m_minimumColumnHeight(0) + , m_forcedBreaksCount(0) + , m_maximumDistanceBetweenForcedBreaks(0) + , m_forcedBreakOffset(0) { } diff --git a/Source/WebCore/rendering/RenderMultiColumnSet.h b/Source/WebCore/rendering/RenderMultiColumnSet.h index d9578ea85..88653035c 100644 --- a/Source/WebCore/rendering/RenderMultiColumnSet.h +++ b/Source/WebCore/rendering/RenderMultiColumnSet.h @@ -61,6 +61,29 @@ public: m_computedColumnHeight = height; } + void updateMinimumColumnHeight(LayoutUnit height) { m_minimumColumnHeight = std::max(height, m_minimumColumnHeight); } + LayoutUnit minimumColumnHeight() const { return m_minimumColumnHeight; } + + unsigned forcedBreaksCount() const { return m_forcedBreaksCount; } + LayoutUnit forcedBreakOffset() const { return m_forcedBreakOffset; } + LayoutUnit maximumDistanceBetweenForcedBreaks() const { return m_maximumDistanceBetweenForcedBreaks; } + void clearForcedBreaks() + { + m_forcedBreaksCount = 0; + m_maximumDistanceBetweenForcedBreaks = 0; + m_forcedBreakOffset = 0; + } + void addForcedBreak(LayoutUnit offsetFromFirstPage) + { + ASSERT(!computedColumnHeight()); + LayoutUnit distanceFromLastBreak = offsetFromFirstPage - m_forcedBreakOffset; + if (!distanceFromLastBreak) + return; + m_forcedBreaksCount++; + m_maximumDistanceBetweenForcedBreaks = std::max(m_maximumDistanceBetweenForcedBreaks, distanceFromLastBreak); + m_forcedBreakOffset = offsetFromFirstPage; + } + private: virtual void updateLogicalWidth() OVERRIDE; virtual void updateLogicalHeight() OVERRIDE; @@ -96,6 +119,12 @@ private: unsigned m_computedColumnCount; LayoutUnit m_computedColumnWidth; LayoutUnit m_computedColumnHeight; + + // The following variables are used when balancing the column set. + LayoutUnit m_minimumColumnHeight; + unsigned m_forcedBreaksCount; // FIXME: We will ultimately need to cache more information to balance around forced breaks properly. + LayoutUnit m_maximumDistanceBetweenForcedBreaks; + LayoutUnit m_forcedBreakOffset; }; } // namespace WebCore diff --git a/Source/WebCore/rendering/RenderRubyRun.cpp b/Source/WebCore/rendering/RenderRubyRun.cpp index 8481546f3..498d17d10 100644 --- a/Source/WebCore/rendering/RenderRubyRun.cpp +++ b/Source/WebCore/rendering/RenderRubyRun.cpp @@ -246,7 +246,7 @@ void RenderRubyRun::layout() lastLineRubyTextBottom = rootBox->logicalBottomLayoutOverflow(); } - if (!style()->isFlippedLinesWritingMode()) { + if (style()->isFlippedLinesWritingMode() == (style()->rubyPosition() == RubyPositionAfter)) { LayoutUnit firstLineTop = 0; if (RenderRubyBase* rb = rubyBase()) { RootInlineBox* rootBox = rb->firstRootBox(); diff --git a/Source/WebCore/rendering/style/GridTrackSize.h b/Source/WebCore/rendering/style/GridTrackSize.h new file mode 100644 index 000000000..1bc1d06a5 --- /dev/null +++ b/Source/WebCore/rendering/style/GridTrackSize.h @@ -0,0 +1,77 @@ +/* + * 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. 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 THE COPYRIGHT HOLDERS AND 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 + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef GridTrackSize_h +#define GridTrackSize_h + +#include "Length.h" + +namespace WebCore { + +enum GridTrackSizeType { + LengthTrackSizing +}; + +class GridTrackSize { +public: + GridTrackSize() + : m_type(LengthTrackSizing) + , m_length(Undefined) + { + } + + const Length& length() const + { + ASSERT(m_type == LengthTrackSizing); + ASSERT(!m_length.isUndefined()); + return m_length; + } + + void setLength(const Length& length) + { + m_type = LengthTrackSizing; + m_length = length; + } + + GridTrackSizeType type() const { return m_type; } + + bool operator==(const GridTrackSize& other) const + { + return m_type == other.m_type && m_length == other.m_length; + } + +private: + GridTrackSizeType m_type; + Length m_length; +}; + +} // namespace WebCore + +#endif // GridTrackSize_h diff --git a/Source/WebCore/rendering/style/RenderStyle.cpp b/Source/WebCore/rendering/style/RenderStyle.cpp index a51658b00..653f30fdf 100644 --- a/Source/WebCore/rendering/style/RenderStyle.cpp +++ b/Source/WebCore/rendering/style/RenderStyle.cpp @@ -478,6 +478,7 @@ StyleDifference RenderStyle::diff(const RenderStyle* other, unsigned& changedCon || rareInheritedData->hyphenationLimitAfter != other->rareInheritedData->hyphenationLimitAfter || rareInheritedData->hyphenationString != other->rareInheritedData->hyphenationString || rareInheritedData->locale != other->rareInheritedData->locale + || rareInheritedData->m_rubyPosition != other->rareInheritedData->m_rubyPosition || rareInheritedData->textEmphasisMark != other->rareInheritedData->textEmphasisMark || rareInheritedData->textEmphasisPosition != other->rareInheritedData->textEmphasisPosition || rareInheritedData->textEmphasisCustomMark != other->rareInheritedData->textEmphasisCustomMark diff --git a/Source/WebCore/rendering/style/RenderStyle.h b/Source/WebCore/rendering/style/RenderStyle.h index 74044f82f..06e5bb269 100644 --- a/Source/WebCore/rendering/style/RenderStyle.h +++ b/Source/WebCore/rendering/style/RenderStyle.h @@ -758,8 +758,8 @@ public: EFlexWrap flexWrap() const { return static_cast<EFlexWrap>(rareNonInheritedData->m_flexibleBox->m_flexWrap); } EJustifyContent justifyContent() const { return static_cast<EJustifyContent>(rareNonInheritedData->m_justifyContent); } - const Vector<Length>& gridColumns() const { return rareNonInheritedData->m_grid->m_gridColumns; } - const Vector<Length>& gridRows() const { return rareNonInheritedData->m_grid->m_gridRows; } + const Vector<GridTrackSize>& gridColumns() const { return rareNonInheritedData->m_grid->m_gridColumns; } + const Vector<GridTrackSize>& gridRows() const { return rareNonInheritedData->m_grid->m_gridRows; } const GridPosition& gridItemColumn() const { return rareNonInheritedData->m_gridItem->m_gridColumn; } const GridPosition& gridItemRow() const { return rareNonInheritedData->m_gridItem->m_gridRow; } @@ -835,7 +835,9 @@ public: const AtomicString& textEmphasisCustomMark() const { return rareInheritedData->textEmphasisCustomMark; } TextEmphasisPosition textEmphasisPosition() const { return static_cast<TextEmphasisPosition>(rareInheritedData->textEmphasisPosition); } const AtomicString& textEmphasisMarkString() const; - + + RubyPosition rubyPosition() const { return static_cast<RubyPosition>(rareInheritedData->m_rubyPosition); } + // Return true if any transform related property (currently transform, transformStyle3D or perspective) // indicates that we are transforming bool hasTransformRelatedProperty() const { return hasTransform() || preserves3D() || hasPerspective(); } @@ -1238,8 +1240,8 @@ public: void setFlexDirection(EFlexDirection direction) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexDirection, direction); } void setFlexWrap(EFlexWrap w) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexWrap, w); } void setJustifyContent(EJustifyContent p) { SET_VAR(rareNonInheritedData, m_justifyContent, p); } - void setGridColumns(const Vector<Length>& lengths) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridColumns, lengths); } - void setGridRows(const Vector<Length>& lengths) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridRows, lengths); } + void setGridColumns(const Vector<GridTrackSize>& lengths) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridColumns, lengths); } + void setGridRows(const Vector<GridTrackSize>& lengths) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridRows, lengths); } void setGridItemColumn(const GridPosition& columnPosition) { SET_VAR(rareNonInheritedData.access()->m_gridItem, m_gridColumn, columnPosition); } void setGridItemRow(const GridPosition& rowPosition) { SET_VAR(rareNonInheritedData.access()->m_gridItem, m_gridRow, rowPosition); } @@ -1300,6 +1302,8 @@ public: void setTextEmphasisCustomMark(const AtomicString& mark) { SET_VAR(rareInheritedData, textEmphasisCustomMark, mark); } void setTextEmphasisPosition(TextEmphasisPosition position) { SET_VAR(rareInheritedData, textEmphasisPosition, position); } + void setRubyPosition(RubyPosition position) { SET_VAR(rareInheritedData, m_rubyPosition, position); } + #if ENABLE(CSS_FILTERS) void setFilter(const FilterOperations& ops) { SET_VAR(rareNonInheritedData.access()->m_filter, m_operations, ops); } #endif @@ -1616,6 +1620,7 @@ public: static TextEmphasisMark initialTextEmphasisMark() { return TextEmphasisMarkNone; } static const AtomicString& initialTextEmphasisCustomMark() { return nullAtom; } static TextEmphasisPosition initialTextEmphasisPosition() { return TextEmphasisPositionOver; } + static RubyPosition initialRubyPosition() { return RubyPositionBefore; } static LineBoxContain initialLineBoxContain() { return LineBoxContainBlock | LineBoxContainInline | LineBoxContainReplaced; } static ImageOrientationEnum initialImageOrientation() { return OriginTopLeft; } static EImageRendering initialImageRendering() { return ImageRenderingAuto; } @@ -1627,16 +1632,8 @@ public: static PrintColorAdjust initialPrintColorAdjust() { return PrintColorAdjustEconomy; } // The initial value is 'none' for grid tracks. - static Vector<Length> initialGridTrackValue() - { - DEFINE_STATIC_LOCAL(Vector<Length>, defaultLength, ()); - // We need to manually add the Length here as the Length(0) is 'auto'. - if (!defaultLength.size()) - defaultLength.append(Length(Undefined)); - return defaultLength; - } - static Vector<Length> initialGridColumns() { return initialGridTrackValue(); } - static Vector<Length> initialGridRows() { return initialGridTrackValue(); } + static Vector<GridTrackSize> initialGridColumns() { return Vector<GridTrackSize>(); } + static Vector<GridTrackSize> initialGridRows() { return Vector<GridTrackSize>(); } // 'auto' is the default. static GridPosition initialGridItemColumn() { return GridPosition(); } diff --git a/Source/WebCore/rendering/style/RenderStyleConstants.h b/Source/WebCore/rendering/style/RenderStyleConstants.h index bfc1a5eab..341813299 100644 --- a/Source/WebCore/rendering/style/RenderStyleConstants.h +++ b/Source/WebCore/rendering/style/RenderStyleConstants.h @@ -475,6 +475,8 @@ enum WrapFlow { WrapFlowAuto, WrapFlowBoth, WrapFlowStart, WrapFlowEnd, WrapFlow enum WrapThrough { WrapThroughWrap, WrapThroughNone }; +enum RubyPosition { RubyPositionBefore, RubyPositionAfter }; + #if ENABLE(DRAGGABLE_REGION) enum DraggableRegionMode { DraggableRegionNone, DraggableRegionDrag, DraggableRegionNoDrag }; #endif diff --git a/Source/WebCore/rendering/style/StyleGridData.h b/Source/WebCore/rendering/style/StyleGridData.h index ddceadbbc..18ffcaba6 100644 --- a/Source/WebCore/rendering/style/StyleGridData.h +++ b/Source/WebCore/rendering/style/StyleGridData.h @@ -26,7 +26,7 @@ #ifndef StyleGridData_h #define StyleGridData_h -#include "Length.h" +#include "GridTrackSize.h" #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> #include <wtf/Vector.h> @@ -48,10 +48,9 @@ public: return !(*this == o); } - // FIXME: For the moment, we only support a subset of the grammar which correspond to: - // 'auto' | <length> | <percentage> | 'none' - Vector<Length> m_gridColumns; - Vector<Length> m_gridRows; + // FIXME: Update the naming of the following variables. + Vector<GridTrackSize> m_gridColumns; + Vector<GridTrackSize> m_gridRows; private: StyleGridData(); diff --git a/Source/WebCore/rendering/style/StyleRareInheritedData.cpp b/Source/WebCore/rendering/style/StyleRareInheritedData.cpp index c02c10591..14715e0a5 100644 --- a/Source/WebCore/rendering/style/StyleRareInheritedData.cpp +++ b/Source/WebCore/rendering/style/StyleRareInheritedData.cpp @@ -102,6 +102,7 @@ StyleRareInheritedData::StyleRareInheritedData() #if ENABLE(CSS3_TEXT) , m_textAlignLast(RenderStyle::initialTextAlignLast()) #endif // CSS3_TEXT + , m_rubyPosition(RenderStyle::initialRubyPosition()) , hyphenationLimitBefore(-1) , hyphenationLimitAfter(-1) , hyphenationLimitLines(-1) @@ -168,6 +169,7 @@ StyleRareInheritedData::StyleRareInheritedData(const StyleRareInheritedData& o) #if ENABLE(CSS3_TEXT) , m_textAlignLast(o.m_textAlignLast) #endif // CSS3_TEXT + , m_rubyPosition(o.m_rubyPosition) , hyphenationString(o.hyphenationString) , hyphenationLimitBefore(o.hyphenationLimitBefore) , hyphenationLimitAfter(o.hyphenationLimitAfter) @@ -260,6 +262,7 @@ bool StyleRareInheritedData::operator==(const StyleRareInheritedData& o) const #if ENABLE(CSS3_TEXT) && m_textAlignLast == o.m_textAlignLast #endif // CSS3_TEXT + && m_rubyPosition == o.m_rubyPosition && m_lineSnap == o.m_lineSnap #if ENABLE(CSS_VARIABLES) && m_variables == o.m_variables diff --git a/Source/WebCore/rendering/style/StyleRareInheritedData.h b/Source/WebCore/rendering/style/StyleRareInheritedData.h index 22388336a..216c10179 100644 --- a/Source/WebCore/rendering/style/StyleRareInheritedData.h +++ b/Source/WebCore/rendering/style/StyleRareInheritedData.h @@ -116,6 +116,7 @@ public: #if ENABLE(CSS3_TEXT) unsigned m_textAlignLast : 3; // ETextAlignLast #endif // CSS3_TEXT + unsigned m_rubyPosition : 1; // RubyPosition AtomicString hyphenationString; short hyphenationLimitBefore; diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog index a66f05e98..68e6531f0 100644 --- a/Source/WebKit/ChangeLog +++ b/Source/WebKit/ChangeLog @@ -1,3 +1,21 @@ +2012-11-30 Simon Hausmann <simon.hausmann@digia.com>, Pierre Rossi <pierre.rossi@digia.com> + + [Qt] Separate Qt WebKit into Qt WebKit and Qt WebKit Widgets + https://bugs.webkit.org/show_bug.cgi?id=99314 + + Reviewed by Tor Arne Vestbø. + + This big change separates QtWebKit into QtWebKit and QtWebKitWidgets as + shared libraries. + + It's a big refactoring that mostly involves moving WebCore dependent + code into QtWebKit and accessing it through exported QWebFrameAdapter + and QWebPageAdapter classes. + + * WebKit1.pro: + * WebKitWidgets.pri: Removed. + * WebKitWidgets.pro: Removed. + 2012-11-22 Jeff Rogers <jrogers@rim.com> [BlackBerry] Update Web Notifications Implementation diff --git a/Source/WebKit/WebKit1.pro b/Source/WebKit/WebKit1.pro index fee99e885..ea854e6c8 100644 --- a/Source/WebKit/WebKit1.pro +++ b/Source/WebKit/WebKit1.pro @@ -20,6 +20,8 @@ SOURCES += \ $$PWD/qt/Api/qwebelement.cpp \ $$PWD/qt/Api/qwebhistory.cpp \ $$PWD/qt/Api/qwebhistoryinterface.cpp \ + $$PWD/qt/Api/qwebkitglobal.cpp \ + $$PWD/qt/Api/qwebplugindatabase.cpp \ $$PWD/qt/Api/qwebpluginfactory.cpp \ $$PWD/qt/Api/qwebsecurityorigin.cpp \ $$PWD/qt/Api/qwebsettings.cpp \ @@ -39,10 +41,13 @@ SOURCES += \ $$PWD/qt/WebCoreSupport/PlatformStrategiesQt.cpp \ $$PWD/qt/WebCoreSupport/PopupMenuQt.cpp \ $$PWD/qt/WebCoreSupport/QtPlatformPlugin.cpp \ + $$PWD/qt/WebCoreSupport/QtPluginWidgetAdapter.cpp \ + $$PWD/qt/WebCoreSupport/QtPrintContext.cpp \ $$PWD/qt/WebCoreSupport/QWebFrameAdapter.cpp \ $$PWD/qt/WebCoreSupport/QWebPageAdapter.cpp \ $$PWD/qt/WebCoreSupport/SearchPopupMenuQt.cpp \ $$PWD/qt/WebCoreSupport/TextCheckerClientQt.cpp \ + $$PWD/qt/WebCoreSupport/TextureMapperLayerClientQt.cpp \ $$PWD/qt/WebCoreSupport/UndoStepQt.cpp \ $$PWD/qt/WebCoreSupport/WebEventConversion.cpp @@ -54,10 +59,12 @@ HEADERS += \ $$PWD/qt/Api/qwebhistory.h \ $$PWD/qt/Api/qwebhistory_p.h \ $$PWD/qt/Api/qwebhistoryinterface.h \ + $$PWD/qt/Api/qwebplugindatabase_p.h \ $$PWD/qt/Api/qwebpluginfactory.h \ $$PWD/qt/Api/qwebsecurityorigin.h \ $$PWD/qt/Api/qwebsettings.h \ $$PWD/qt/Api/qwebscriptworld_p.h \ + $$PWD/qt/Api/qwebkitplatformplugin.h \ $$PWD/qt/WebCoreSupport/ChromeClientQt.h \ $$PWD/qt/WebCoreSupport/ContextMenuClientQt.h \ $$PWD/qt/WebCoreSupport/DragClientQt.h \ @@ -73,10 +80,12 @@ HEADERS += \ $$PWD/qt/WebCoreSupport/PopupMenuQt.h \ $$PWD/qt/WebCoreSupport/QtPlatformPlugin.h \ $$PWD/qt/WebCoreSupport/QtPluginWidgetAdapter.h \ + $$PWD/qt/WebCoreSupport/QtPrintContext.h \ $$PWD/qt/WebCoreSupport/QWebFrameAdapter.h \ $$PWD/qt/WebCoreSupport/QWebPageAdapter.h \ $$PWD/qt/WebCoreSupport/SearchPopupMenuQt.h \ $$PWD/qt/WebCoreSupport/TextCheckerClientQt.h \ + $$PWD/qt/WebCoreSupport/TextureMapperLayerClientQt.h \ $$PWD/qt/WebCoreSupport/UndoStepQt.h \ $$PWD/qt/WebCoreSupport/WebEventConversion.h diff --git a/Source/WebKit/WebKitWidgets.pri b/Source/WebKit/WebKitWidgets.pri deleted file mode 100644 index 54c61485f..000000000 --- a/Source/WebKit/WebKitWidgets.pri +++ /dev/null @@ -1,33 +0,0 @@ -# ------------------------------------------------------------------- -# 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 deleted file mode 100644 index 5ca754192..000000000 --- a/Source/WebKit/WebKitWidgets.pro +++ /dev/null @@ -1,75 +0,0 @@ -# ------------------------------------------------------------------- -# 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 775887c06..23d1d3557 100644 --- a/Source/WebKit/blackberry/Api/WebPage.cpp +++ b/Source/WebKit/blackberry/Api/WebPage.cpp @@ -3635,9 +3635,11 @@ void WebPagePrivate::setViewportSize(const IntSize& transformedActualVisibleSize IntSize viewportSizeAfter = actualVisibleSize(); - IntSize offset( - roundf((viewportSizeBefore.width() - viewportSizeAfter.width()) / 2.0), - roundf((viewportSizeBefore.height() - viewportSizeAfter.height()) / 2.0)); + IntSize offset; + if (hasPendingOrientation) { + offset = IntSize(roundf((viewportSizeBefore.width() - viewportSizeAfter.width()) / 2.0), + roundf((viewportSizeBefore.height() - viewportSizeAfter.height()) / 2.0)); + } // As a special case, if we were anchored to the top left position at // the beginning of the rotation then preserve that anchor. diff --git a/Source/WebKit/blackberry/ChangeLog b/Source/WebKit/blackberry/ChangeLog index 981a30d4e..878ed52be 100644 --- a/Source/WebKit/blackberry/ChangeLog +++ b/Source/WebKit/blackberry/ChangeLog @@ -1,3 +1,58 @@ +2012-11-29 Jacky Jiang <zhajiang@rim.com> + + [BlackBerry] window.open can load url twice which can cause security and timing issues + https://bugs.webkit.org/show_bug.cgi?id=103670 + + Reviewed by Yong Li. + + PR: 252234 + When we call window.open() in JS, DOMWindow will create a window and + change the url to load the resources. However, during the window + creation, we dispatch an OpenWindow event with the url to browser side + and browser side loads the url thereafter as well. + DOMWindow::createWindow() is only required to create the window not to + load url as far as I can tell. This is unneccessary and can cause + unexpected issues. So just pass an empty url instead to avoid + the double-load issue. + + * WebCoreSupport/ChromeClientBlackBerry.cpp: + (WebCore::ChromeClientBlackBerry::createWindow): + +2012-11-29 Otto Derek Cheung <otcheung@rim.com> + + [BlackBerry] Modifying GeoClientBlackBerry to switch between high and low accuracy + https://bugs.webkit.org/show_bug.cgi?id=103666 + + Reviewed by Yong Li. + + Internally reviewed by Yong Li. + + PR 243420 + + Updating GeolocationClientBlackBerry to switch accuracy when GeolocationController + calls setEnableHighAccuracy. + + * WebCoreSupport/GeolocationClientBlackBerry.cpp: + (GeolocationClientBlackBerry::startUpdating): + (GeolocationClientBlackBerry::setEnableHighAccuracy): + +2012-11-29 Andrew Lo <anlo@rim.com> + + [BlackBerry] Do not adjust scroll position on viewport resizes that are not orientation change related + https://bugs.webkit.org/show_bug.cgi?id=103659 + + Reviewed by Rob Buis. + Internally reviewed by Gen Mak. + + Internal PR253893. + Only adjust scroll position during an orientation change + when setting viewport size. + We don't want the scroll position jumping around when opening + & closing the VKB. + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::setViewportSize): + 2012-11-28 Otto Derek Cheung <otcheung@rim.com> [BlackBerry] CookieJarBlackBerry will use document settings for cookiesEnabled diff --git a/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp index 657414010..e82e1b2a2 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp @@ -257,7 +257,7 @@ Page* ChromeClientBlackBerry::createWindow(Frame* frame, const FrameLoadRequest& if (features.dialog) flags |= WebPageClient::FlagWindowIsDialog; - WebPage* webPage = m_webPagePrivate->m_client->createWindow(x, y, width, height, flags, url.string(), request.frameName()); + WebPage* webPage = m_webPagePrivate->m_client->createWindow(x, y, width, height, flags, BlackBerry::Platform::String::emptyString(), request.frameName()); if (!webPage) return 0; diff --git a/Source/WebKit/blackberry/WebCoreSupport/GeolocationClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/GeolocationClientBlackBerry.cpp index 111c59aae..31e832f63 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/GeolocationClientBlackBerry.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/GeolocationClientBlackBerry.cpp @@ -52,7 +52,7 @@ void GeolocationClientBlackBerry::geolocationDestroyed() void GeolocationClientBlackBerry::startUpdating() { if (!m_isActive) - BlackBerry::Platform::GeolocationHandler::instance()->addListener(this, false); + BlackBerry::Platform::GeolocationHandler::instance()->addListener(this); m_isActive = true; } @@ -129,7 +129,9 @@ void GeolocationClientBlackBerry::onPermission(bool isAllowed) void GeolocationClientBlackBerry::setEnableHighAccuracy(bool newAccuracy) { - // FIXME: we have to implement high accuracy on our side too - m_accuracy = newAccuracy; + if (m_accuracy != newAccuracy) { + m_accuracy = newAccuracy; + BlackBerry::Platform::GeolocationHandler::instance()->switchAccuracy(this); + } } diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog index 293f6f11b..e597d313f 100644 --- a/Source/WebKit/chromium/ChangeLog +++ b/Source/WebKit/chromium/ChangeLog @@ -1,3 +1,169 @@ +2012-11-29 Tommy Widenflycht <tommyw@google.com> + + Speech Recognition API: Update SpeechRecognitionEvent to match the specification + https://bugs.webkit.org/show_bug.cgi?id=103407 + + Reviewed by Adam Barth. + + Adding the new didReceiveResults method. + + * public/WebSpeechRecognizerClient.h: + * src/SpeechRecognitionClientProxy.cpp: + (WebKit::SpeechRecognitionClientProxy::didReceiveResults): + (WebKit): + * src/SpeechRecognitionClientProxy.h: + (SpeechRecognitionClientProxy): + +2012-11-30 Keishi Hattori <keishi@webkit.org> + + [Chromium] Page popup doesn't change mouse cursor + https://bugs.webkit.org/show_bug.cgi?id=97454 + + Reviewed by Kent Tamura. + + The mouse cursor should change based on the page popup content and not the main window content. + On Mac the mousemove event propagates to both the page popup and main window causing the cursor to flicker. + The change to ChromeClientImpl stops that. + + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::setCursor): On Mac, don't update the mouse cursor if a popup is open. + * src/WebPagePopupImpl.cpp: Implement setCursor so the mouse cursor gets set based on the page popup content. + +2012-11-30 Mihai Maerean <mmaerean@adobe.com> + + [CSSRegions] when WebKit uses V8, there should be a single variable to store if the CSS Regions feature is enabled + https://bugs.webkit.org/show_bug.cgi?id=101192 + + Reviewed by Hajime Morita. + + Removed the CSS Regions flag in Settings and switched to using the new flag I have added in RuntimeEnabledFeatures. + + Tests: No new tests because there is no functional change. + + * public/WebRuntimeFeatures.h: + (WebRuntimeFeatures): + * public/WebSettings.h: moved setExperimentalCSSRegionsEnabled to the bottom of the interface and made it a + no-op. After this patch lands and Chromium's webkit_rev is increased, we'll remove any callers in Chromium. Once + the Chromium callers are gone and WebKit's chromium_rev is increased, we'll remove the deprecated API. + * src/WebRuntimeFeatures.cpp: + (WebKit::WebRuntimeFeatures::enableCSSRegions): + (WebKit): + (WebKit::WebRuntimeFeatures::isCSSRegionsEnabled): + * src/WebSettingsImpl.cpp: + * src/WebSettingsImpl.h: + (WebSettingsImpl): + +2012-11-29 Rafael Weinstein <rafaelw@chromium.org> + + [HTMLTemplateElement] Add feature flag + https://bugs.webkit.org/show_bug.cgi?id=103694 + + Reviewed by Adam Barth. + + This flag will guard the implementation of the HTMLTemplateElement. + http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/templates/index.html + + + * features.gypi: + +2012-11-29 David Grogan <dgrogan@chromium.org> + + IndexedDB: Propagate more leveldb errors to script + https://bugs.webkit.org/show_bug.cgi?id=103580 + + Reviewed by Tony Chang. + + * tests/IDBFakeBackingStore.h: + Update method signatures. + +2012-11-29 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r136171. + http://trac.webkit.org/changeset/136171 + https://bugs.webkit.org/show_bug.cgi?id=103695 + + Likely caused ReOpenedWithID and ReOpenedWithURL to fail in + linux/chromeos (Requested by zhenyao on #webkit). + + * src/InspectorClientImpl.cpp: + (WebKit::InspectorClientImpl::startMainThreadMonitoring): + (WebKit): + (WebKit::InspectorClientImpl::stopMainThreadMonitoring): + (WebKit::InspectorClientImpl::willProcessTask): + (WebKit::InspectorClientImpl::didProcessTask): + * src/InspectorClientImpl.h: + (InspectorClientImpl): + * src/WebDevToolsAgentImpl.cpp: + (WebKit::WebDevToolsAgentImpl::attach): + (WebKit::WebDevToolsAgentImpl::detach): + * src/WebDevToolsAgentImpl.h: + (WebDevToolsAgentImpl): + +2012-11-29 Sadrul Habib Chowdhury <sadrul@chromium.org> + + [chromium] Remove deprecated API since it is no longer used + https://bugs.webkit.org/show_bug.cgi?id=103570 + + Reviewed by Adam Barth. + + Remove WebPluginContainer::setIsAcceptingTouchEvents, since this is not used anymore, + in favour of WebPluginContainer::requestTouchEventType. + + * public/WebPluginContainer.h: + (WebPluginContainer): + * src/WebPluginContainerImpl.cpp: + * src/WebPluginContainerImpl.h: + (WebPluginContainerImpl): + +2012-11-29 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-11-29 Eugene Klyuchnikov <eustas@chromium.org> + + Web Inspector: Make main-thread monitoring go through InspectorController. + https://bugs.webkit.org/show_bug.cgi?id=103550 + + Reviewed by Pavel Feldman. + + InspectorInstrumentation was a wrong path + + * src/InspectorClientImpl.cpp: Remove TaskObserver implementation, and + listen/unlisten methods. + * src/InspectorClientImpl.h: Ditto. + * src/WebDevToolsAgentImpl.cpp: + (WebKit::WebDevToolsAgentImpl::attach): + Subscribe for main thread activity events. + (WebKit::WebDevToolsAgentImpl::detach): + Unsubscribe for main thread activity events. + (WebKit::WebDevToolsAgentImpl::willProcessTask): Implement TaskObserver + interface. Froward to InspectorController. + (WebKit::WebDevToolsAgentImpl::didProcessTask): Ditto. + * src/WebDevToolsAgentImpl.h: Implement TaskObserver interface. + +2012-11-29 Stephen Chenney <schenney@chromium.org> + + [Chromium] Add code supppression flags for skia + + Unreviewed addition of Skia build flags to allow for their removal from Chromium's skia.gyp. + + * skia_webkit.gyp: Added defines for SK_DISABLE_DITHER_32BIT_GRADIENT and SK_DISABLE_DASHING_OPTIMIZATION + +2012-11-29 Florin Malita <fmalita@chromium.org> + + [Skia] Add missing OpaqueRegionSkia notifier calls + https://bugs.webkit.org/show_bug.cgi?id=102824 + + Reviewed by Stephen White. + + Add opaque region tracking unit tests for the new PlatformContextSkia draw methods. + + * tests/PlatformContextSkiaTest.cpp: + (WebCore::TEST): + (WebCore): + 2012-11-29 Miguel Garcia <miguelg@chromium.org> Fix typo in description of openDateTimeChooser documentation diff --git a/Source/WebKit/chromium/DEPS b/Source/WebKit/chromium/DEPS index c04782eb3..ec58d99bf 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': '169895' + 'chromium_rev': '170244' } deps = { diff --git a/Source/WebKit/chromium/features.gypi b/Source/WebKit/chromium/features.gypi index a7bf6367a..621d4ce95 100644 --- a/Source/WebKit/chromium/features.gypi +++ b/Source/WebKit/chromium/features.gypi @@ -109,6 +109,7 @@ 'ENABLE_STYLE_SCOPED=1', 'ENABLE_SVG=<(enable_svg)', 'ENABLE_SVG_FONTS=<(enable_svg)', + 'ENABLE_TEMPLATE_ELEMENT=0', 'ENABLE_TEXT_AUTOSIZING=1', 'ENABLE_TOUCH_ADJUSTMENT=1', 'ENABLE_TOUCH_EVENTS=<(enable_touch_events)', diff --git a/Source/WebKit/chromium/public/WebPluginContainer.h b/Source/WebKit/chromium/public/WebPluginContainer.h index aad631f67..ce72cc591 100644 --- a/Source/WebKit/chromium/public/WebPluginContainer.h +++ b/Source/WebKit/chromium/public/WebPluginContainer.h @@ -117,9 +117,6 @@ public: // content. The rectangle is in the plugin's coordinate system. virtual bool isRectTopmost(const WebRect&) = 0; - // Notifies when the plugin starts/stops accepting touch events. This is deprecated, use requestTouchEventType instead. - virtual void setIsAcceptingTouchEvents(bool) = 0; - // Notifies when the plugin changes the kind of touch-events it accepts. virtual void requestTouchEventType(TouchEventRequestType) = 0; diff --git a/Source/WebKit/chromium/public/WebRuntimeFeatures.h b/Source/WebKit/chromium/public/WebRuntimeFeatures.h index 2f6ef1ce4..c916c1214 100644 --- a/Source/WebKit/chromium/public/WebRuntimeFeatures.h +++ b/Source/WebKit/chromium/public/WebRuntimeFeatures.h @@ -157,6 +157,9 @@ public: WEBKIT_EXPORT static void enableRequestAutocomplete(bool); WEBKIT_EXPORT static bool isRequestAutocompleteEnabled(); + WEBKIT_EXPORT static void enableCSSRegions(bool); + WEBKIT_EXPORT static bool isCSSRegionsEnabled(); + private: WebRuntimeFeatures(); }; diff --git a/Source/WebKit/chromium/public/WebSettings.h b/Source/WebKit/chromium/public/WebSettings.h index 4c9d0cc64..260036421 100644 --- a/Source/WebKit/chromium/public/WebSettings.h +++ b/Source/WebKit/chromium/public/WebSettings.h @@ -101,7 +101,6 @@ public: virtual void setExperimentalCSSCustomFilterEnabled(bool) = 0; virtual void setExperimentalCSSGridLayoutEnabled(bool) = 0; virtual void setCSSStickyPositionEnabled(bool) = 0; - virtual void setExperimentalCSSRegionsEnabled(bool) = 0; virtual void setExperimentalCSSVariablesEnabled(bool) = 0; virtual void setExperimentalWebGLEnabled(bool) = 0; virtual void setFantasyFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; @@ -174,6 +173,9 @@ public: // DEPRECATED (renamed. remove this after all call sites changed to the new name) void setApplyDefaultDeviceScaleFactorInCompositor(bool enabled) { setApplyDeviceScaleFactorInCompositor(enabled); } + // DEPRECATED + void setExperimentalCSSRegionsEnabled(bool) { } + protected: ~WebSettings() { } }; diff --git a/Source/WebKit/chromium/public/WebSpeechRecognizerClient.h b/Source/WebKit/chromium/public/WebSpeechRecognizerClient.h index ebdc0c173..056c4d358 100644 --- a/Source/WebKit/chromium/public/WebSpeechRecognizerClient.h +++ b/Source/WebKit/chromium/public/WebSpeechRecognizerClient.h @@ -68,8 +68,17 @@ public: virtual void didEndAudio(const WebSpeechRecognitionHandle&) = 0; // To be called when the speech recognizer returns a result. + // FIXME: Remove this when we have moved over to only use the function below. virtual void didReceiveResult(const WebSpeechRecognitionHandle&, const WebSpeechRecognitionResult&, unsigned long resultIndex, const WebVector<WebSpeechRecognitionResult>& resultHistory) = 0; + // To be called when the speech recognizer provides new results. + // - newFinalResults contains zero or more final results that are new since + // the last time the functions was called. + // - currentInterimResults contains zero or more inteirm results that + // replace the interim results that were reported the last time this + // function was called. + virtual void didReceiveResults(const WebSpeechRecognitionHandle&, const WebVector<WebSpeechRecognitionResult>& newFinalResults, const WebVector<WebSpeechRecognitionResult>& currentInterimResults) = 0; + // To be called when the speech recognizer returns a final result with no // recognizion hypothesis. virtual void didReceiveNoMatch(const WebSpeechRecognitionHandle&, const WebSpeechRecognitionResult&) = 0; diff --git a/Source/WebKit/chromium/skia_webkit.gyp b/Source/WebKit/chromium/skia_webkit.gyp index 0ecb0efb0..49e44d045 100644 --- a/Source/WebKit/chromium/skia_webkit.gyp +++ b/Source/WebKit/chromium/skia_webkit.gyp @@ -39,6 +39,10 @@ 'defines': [ # Place defines here that require significant WebKit rebaselining, or that # are otherwise best removed in WebKit and then rolled into Chromium. + # Defines should be in single quotes and a comma must appear after every one. + 'SK_DISABLE_DITHER_32BIT_GRADIENT', + + 'SK_DISABLE_DASHING_OPTIMIZATION', ], }, }, diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.cpp b/Source/WebKit/chromium/src/ChromeClientImpl.cpp index e617e8f5a..4215ad700 100644 --- a/Source/WebKit/chromium/src/ChromeClientImpl.cpp +++ b/Source/WebKit/chromium/src/ChromeClientImpl.cpp @@ -825,6 +825,12 @@ void ChromeClientImpl::setCursorHiddenUntilMouseMoves(bool) void ChromeClientImpl::setCursor(const WebCursorInfo& cursor) { +#if OS(DARWIN) + // On Mac the mousemove event propagates to both the popup and main window. + // If a popup is open we don't want the main window to change the cursor. + if (m_webView->hasOpenedPopup()) + return; +#endif if (m_webView->client()) m_webView->client()->didChangeCursor(cursor); } diff --git a/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.cpp b/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.cpp index 082747cdb..f7485ed9b 100644 --- a/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.cpp +++ b/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.cpp @@ -113,6 +113,21 @@ void SpeechRecognitionClientProxy::didReceiveResult(const WebSpeechRecognitionHa } +void SpeechRecognitionClientProxy::didReceiveResults(const WebSpeechRecognitionHandle& handle, const WebVector<WebSpeechRecognitionResult>& newFinalResults, const WebVector<WebSpeechRecognitionResult>& currentInterimResults) +{ + RefPtr<SpeechRecognition> recognition = PassRefPtr<SpeechRecognition>(handle); + + Vector<RefPtr<SpeechRecognitionResult> > finalResultsVector(newFinalResults.size()); + for (size_t i = 0; i < newFinalResults.size(); ++i) + finalResultsVector[i] = static_cast<PassRefPtr<SpeechRecognitionResult> >(newFinalResults[i]); + + Vector<RefPtr<SpeechRecognitionResult> > interimResultsVector(currentInterimResults.size()); + for (size_t i = 0; i < currentInterimResults.size(); ++i) + interimResultsVector[i] = static_cast<PassRefPtr<SpeechRecognitionResult> >(currentInterimResults[i]); + + recognition->didReceiveResults(finalResultsVector, interimResultsVector); +} + void SpeechRecognitionClientProxy::didReceiveNoMatch(const WebSpeechRecognitionHandle& handle, const WebSpeechRecognitionResult& result) { RefPtr<SpeechRecognition> recognition = PassRefPtr<SpeechRecognition>(handle); diff --git a/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.h b/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.h index 6194f6600..15958d4fb 100644 --- a/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.h +++ b/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.h @@ -56,6 +56,7 @@ public: virtual void didEndSound(const WebSpeechRecognitionHandle&) OVERRIDE; virtual void didEndAudio(const WebSpeechRecognitionHandle&) OVERRIDE; virtual void didReceiveResult(const WebSpeechRecognitionHandle&, const WebSpeechRecognitionResult&, unsigned long resultIndex, const WebVector<WebSpeechRecognitionResult>& resultHistory) OVERRIDE; + virtual void didReceiveResults(const WebSpeechRecognitionHandle&, const WebVector<WebSpeechRecognitionResult>& newFinalResults, const WebVector<WebSpeechRecognitionResult>& currentInterimResults) OVERRIDE; virtual void didReceiveNoMatch(const WebSpeechRecognitionHandle&, const WebSpeechRecognitionResult&) OVERRIDE; virtual void didReceiveError(const WebSpeechRecognitionHandle&, const WebString& message, WebSpeechRecognizerClient::ErrorCode) OVERRIDE; virtual void didStart(const WebSpeechRecognitionHandle&) OVERRIDE; diff --git a/Source/WebKit/chromium/src/WebPagePopupImpl.cpp b/Source/WebKit/chromium/src/WebPagePopupImpl.cpp index 53882f9e7..c4b934aaa 100644 --- a/Source/WebKit/chromium/src/WebPagePopupImpl.cpp +++ b/Source/WebKit/chromium/src/WebPagePopupImpl.cpp @@ -42,6 +42,7 @@ #include "PagePopupClient.h" #include "PageWidgetDelegate.h" #include "Settings.h" +#include "WebCursorInfo.h" #include "WebInputEventConversion.h" #include "WebPagePopup.h" #include "WebSettingsImpl.h" @@ -131,6 +132,12 @@ private: return PlatformPageClient(this); } + virtual void setCursor(const WebCore::Cursor& cursor) OVERRIDE + { + if (m_popup->m_webView->client()) + m_popup->m_webView->client()->didChangeCursor(WebCursorInfo(cursor)); + } + // PageClientChromium methods: virtual WebKit::WebScreenInfo screenInfo() OVERRIDE { diff --git a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp index 1059df748..12a9fb5e5 100644 --- a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp +++ b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp @@ -521,11 +521,6 @@ bool WebPluginContainerImpl::isRectTopmost(const WebRect& rect) return (nodes.first().get() == m_element); } -void WebPluginContainerImpl::setIsAcceptingTouchEvents(bool acceptingTouchEvents) -{ - requestTouchEventType(acceptingTouchEvents ? TouchEventRequestTypeRaw : TouchEventRequestTypeNone); -} - void WebPluginContainerImpl::requestTouchEventType(TouchEventRequestType requestType) { if (m_touchEventRequestType == requestType) diff --git a/Source/WebKit/chromium/src/WebPluginContainerImpl.h b/Source/WebKit/chromium/src/WebPluginContainerImpl.h index 70293a822..54c796238 100644 --- a/Source/WebKit/chromium/src/WebPluginContainerImpl.h +++ b/Source/WebKit/chromium/src/WebPluginContainerImpl.h @@ -113,7 +113,6 @@ public: virtual void zoomLevelChanged(double zoomLevel); virtual void setOpaque(bool); virtual bool isRectTopmost(const WebRect&); - virtual void setIsAcceptingTouchEvents(bool); virtual void requestTouchEventType(TouchEventRequestType); virtual void setWantsWheelEvents(bool); virtual WebPoint windowToLocalPoint(const WebPoint&); diff --git a/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp b/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp index a195de292..5600a425e 100644 --- a/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp +++ b/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp @@ -621,6 +621,16 @@ bool WebRuntimeFeatures::isCSSExclusionsEnabled() return RuntimeEnabledFeatures::cssExclusionsEnabled(); } +void WebRuntimeFeatures::enableCSSRegions(bool enable) +{ + RuntimeEnabledFeatures::setCSSRegionsEnabled(enable); +} + +bool WebRuntimeFeatures::isCSSRegionsEnabled() +{ + return RuntimeEnabledFeatures::cssRegionsEnabled(); +} + void WebRuntimeFeatures::enableRequestAutocomplete(bool enable) { #if ENABLE(REQUEST_AUTOCOMPLETE) diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.cpp b/Source/WebKit/chromium/src/WebSettingsImpl.cpp index 6a33786ac..cef575414 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.cpp +++ b/Source/WebKit/chromium/src/WebSettingsImpl.cpp @@ -371,11 +371,6 @@ void WebSettingsImpl::setCSSStickyPositionEnabled(bool enabled) m_settings->setCSSStickyPositionEnabled(enabled); } -void WebSettingsImpl::setExperimentalCSSRegionsEnabled(bool enabled) -{ - m_settings->setCSSRegionsEnabled(enabled); -} - void WebSettingsImpl::setExperimentalCSSGridLayoutEnabled(bool enabled) { m_settings->setCSSGridLayoutEnabled(enabled); diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.h b/Source/WebKit/chromium/src/WebSettingsImpl.h index ab92562fa..efa1bba9f 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.h +++ b/Source/WebKit/chromium/src/WebSettingsImpl.h @@ -93,7 +93,6 @@ public: virtual void setExperimentalCSSCustomFilterEnabled(bool); virtual void setExperimentalCSSGridLayoutEnabled(bool); virtual void setCSSStickyPositionEnabled(bool); - virtual void setExperimentalCSSRegionsEnabled(bool); virtual void setExperimentalCSSVariablesEnabled(bool); virtual void setExperimentalWebGLEnabled(bool); virtual void setFantasyFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); diff --git a/Source/WebKit/chromium/tests/IDBFakeBackingStore.h b/Source/WebKit/chromium/tests/IDBFakeBackingStore.h index 346363ac3..7418ba36c 100644 --- a/Source/WebKit/chromium/tests/IDBFakeBackingStore.h +++ b/Source/WebKit/chromium/tests/IDBFakeBackingStore.h @@ -47,9 +47,9 @@ public: virtual void putRecord(Transaction*, int64_t databaseId, int64_t objectStoreId, const IDBKey&, const String& value, RecordIdentifier*) OVERRIDE { } virtual void clearObjectStore(Transaction*, int64_t databaseId, int64_t objectStoreId) OVERRIDE { } virtual void deleteRecord(Transaction*, int64_t databaseId, int64_t objectStoreId, const RecordIdentifier&) OVERRIDE { } - virtual int64_t getKeyGeneratorCurrentNumber(Transaction*, int64_t databaseId, int64_t objectStoreId) OVERRIDE { return 0; } - virtual void maybeUpdateKeyGeneratorCurrentNumber(Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t newNumber, bool checkCurrent) OVERRIDE { } - virtual bool keyExistsInObjectStore(Transaction*, int64_t databaseId, int64_t objectStoreId, const IDBKey&, RecordIdentifier* foundRecordIdentifier) OVERRIDE { return false; } + virtual bool getKeyGeneratorCurrentNumber(Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t& currentNumber) OVERRIDE { return true; } + virtual bool maybeUpdateKeyGeneratorCurrentNumber(Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t newNumber, bool checkCurrent) OVERRIDE { return true; } + virtual bool keyExistsInObjectStore(Transaction*, int64_t databaseId, int64_t objectStoreId, const IDBKey&, RecordIdentifier* foundRecordIdentifier, bool& found) OVERRIDE { return true; } virtual Vector<IDBIndexMetadata> getIndexes(int64_t databaseId, int64_t objectStoreId) OVERRIDE { return Vector<IDBIndexMetadata>(); } virtual bool createIndex(Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t indexId, const String& name, const IDBKeyPath&, bool isUnique, bool isMultiEntry) OVERRIDE { return false; }; diff --git a/Source/WebKit/chromium/tests/LevelDBTest.cpp b/Source/WebKit/chromium/tests/LevelDBTest.cpp index 7dc0355df..4b9caf8cf 100644 --- a/Source/WebKit/chromium/tests/LevelDBTest.cpp +++ b/Source/WebKit/chromium/tests/LevelDBTest.cpp @@ -79,8 +79,10 @@ TEST(LevelDBDatabaseTest, CorruptionTest) leveldb = LevelDBDatabase::open(path, &comparator); EXPECT_TRUE(leveldb); - success = leveldb->get(key, gotValue); + bool found = false; + success = leveldb->safeGet(key, gotValue, found); EXPECT_TRUE(success); + EXPECT_TRUE(found); EXPECT_EQ(putValue, gotValue); leveldb.release(); EXPECT_FALSE(leveldb); @@ -98,8 +100,9 @@ TEST(LevelDBDatabaseTest, CorruptionTest) leveldb = LevelDBDatabase::open(path, &comparator); EXPECT_TRUE(leveldb); - success = leveldb->get(key, gotValue); - EXPECT_FALSE(success); + success = leveldb->safeGet(key, gotValue, found); + EXPECT_TRUE(success); + EXPECT_FALSE(found); } TEST(LevelDBDatabaseTest, Transaction) @@ -129,8 +132,10 @@ TEST(LevelDBDatabaseTest, Transaction) EXPECT_TRUE(success); EXPECT_EQ(comparator.compare(gotValue, oldValue), 0); - success = leveldb->get(key, gotValue); + bool found = false; + success = leveldb->safeGet(key, gotValue, found); EXPECT_TRUE(success); + EXPECT_TRUE(found); EXPECT_EQ(comparator.compare(gotValue, newValue), 0); const Vector<char> addedKey = encodeString("added key"); @@ -138,8 +143,9 @@ TEST(LevelDBDatabaseTest, Transaction) success = leveldb->put(addedKey, addedValue); EXPECT_TRUE(success); - success = leveldb->get(addedKey, gotValue); + success = leveldb->safeGet(addedKey, gotValue, found); EXPECT_TRUE(success); + EXPECT_TRUE(found); EXPECT_EQ(comparator.compare(gotValue, addedValue), 0); success = transaction->get(addedKey, gotValue); diff --git a/Source/WebKit/chromium/tests/PlatformContextSkiaTest.cpp b/Source/WebKit/chromium/tests/PlatformContextSkiaTest.cpp index c73b6149a..529aa7f07 100644 --- a/Source/WebKit/chromium/tests/PlatformContextSkiaTest.cpp +++ b/Source/WebKit/chromium/tests/PlatformContextSkiaTest.cpp @@ -664,6 +664,283 @@ TEST(PlatformContextSkiaTest, trackOpaqueOvalTest) EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); } +TEST(PlatformContextSkiaTest, trackOpaqueIRectTest) +{ + SkBitmap bitmap; + bitmap.setConfig(SkBitmap::kARGB_8888_Config, 200, 200); + bitmap.allocPixels(); + bitmap.eraseColor(0); + SkCanvas canvas(bitmap); + + PlatformContextSkia platformContext(&canvas); + platformContext.setTrackOpaqueRegion(true); + GraphicsContext context(&platformContext); + + Color opaque(1.0f, 0.0f, 0.0f, 1.0f); + Color alpha(0.0f, 0.0f, 0.0f, 0.0f); + + SkPaint opaquePaint; + opaquePaint.setColor(opaque.rgb()); + opaquePaint.setXfermodeMode(SkXfermode::kSrc_Mode); + SkPaint alphaPaint; + alphaPaint.setColor(alpha.rgb()); + alphaPaint.setXfermodeMode(SkXfermode::kSrc_Mode); + + EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + platformContext.drawIRect(SkIRect::MakeXYWH(10, 10, 90, 90), opaquePaint); + EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + platformContext.drawIRect(SkIRect::MakeXYWH(0, 0, 100, 10), alphaPaint); + EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + platformContext.drawIRect(SkIRect::MakeXYWH(0, 0, 100, 20), alphaPaint); + EXPECT_EQ_RECT(IntRect(10, 20, 90, 80), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + platformContext.drawIRect(SkIRect::MakeXYWH(50, 0, 50, 100), alphaPaint); + EXPECT_EQ_RECT(IntRect(10, 20, 40, 80), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); +} + +TEST(PlatformContextSkiaTest, trackOpaqueTextTest) +{ + SkBitmap bitmap; + bitmap.setConfig(SkBitmap::kARGB_8888_Config, 200, 200); + bitmap.allocPixels(); + bitmap.eraseColor(0); + SkCanvas canvas(bitmap); + + PlatformContextSkia platformContext(&canvas); + platformContext.setTrackOpaqueRegion(true); + GraphicsContext context(&platformContext); + + Color opaque(1.0f, 0.0f, 0.0f, 1.0f); + Color alpha(0.0f, 0.0f, 0.0f, 0.0f); + + SkPaint opaquePaint; + opaquePaint.setColor(opaque.rgb()); + opaquePaint.setXfermodeMode(SkXfermode::kSrc_Mode); + SkPaint alphaPaint; + alphaPaint.setColor(alpha.rgb()); + alphaPaint.setXfermodeMode(SkXfermode::kSrc_Mode); + + SkPoint point = SkPoint::Make(0, 0); + SkScalar pointX = 0; + SkPath path; + path.moveTo(SkPoint::Make(0, 0)); + path.lineTo(SkPoint::Make(100, 0)); + + context.fillRect(FloatRect(50, 50, 50, 50), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + EXPECT_EQ_RECT(IntRect(50, 50, 50, 50), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + platformContext.drawPosText("A", 1, &point, opaquePaint); + EXPECT_EQ_RECT(IntRect(50, 50, 50, 50), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + platformContext.drawPosText("A", 1, &point, alphaPaint); + EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.fillRect(FloatRect(50, 50, 50, 50), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + EXPECT_EQ_RECT(IntRect(50, 50, 50, 50), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + platformContext.drawPosTextH("A", 1, &pointX, 0, opaquePaint); + EXPECT_EQ_RECT(IntRect(50, 50, 50, 50), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + platformContext.drawPosTextH("A", 1, &pointX, 0, alphaPaint); + EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.fillRect(FloatRect(50, 50, 50, 50), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + EXPECT_EQ_RECT(IntRect(50, 50, 50, 50), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + platformContext.drawTextOnPath("A", 1, path, 0, opaquePaint); + EXPECT_EQ_RECT(IntRect(50, 50, 50, 50), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + platformContext.drawTextOnPath("A", 1, path, 0, alphaPaint); + EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); +} + +TEST(PlatformContextSkiaTest, trackOpaqueWritePixelsTest) +{ + SkBitmap bitmap; + bitmap.setConfig(SkBitmap::kARGB_8888_Config, 200, 200); + bitmap.allocPixels(); + bitmap.eraseColor(0); + SkCanvas canvas(bitmap); + + PlatformContextSkia platformContext(&canvas); + platformContext.setTrackOpaqueRegion(true); + GraphicsContext context(&platformContext); + + Color opaque(1.0f, 0.0f, 0.0f, 1.0f); + + SkBitmap opaqueBitmap; + opaqueBitmap.setConfig(SkBitmap::kARGB_8888_Config, 10, 10); + opaqueBitmap.allocPixels(); + opaqueBitmap.setIsOpaque(true); + for (int y = 0; y < opaqueBitmap.height(); ++y) + for (int x = 0; x < opaqueBitmap.width(); ++x) + *opaqueBitmap.getAddr32(x, y) = 0xFFFFFFFF; + + SkBitmap alphaBitmap; + alphaBitmap.setConfig(SkBitmap::kARGB_8888_Config, 10, 10); + alphaBitmap.allocPixels(); + alphaBitmap.setIsOpaque(false); + for (int y = 0; y < alphaBitmap.height(); ++y) + for (int x = 0; x < alphaBitmap.width(); ++x) + *alphaBitmap.getAddr32(x, y) = 0x00000000; + + SkPaint paint; + paint.setXfermodeMode(SkXfermode::kSrc_Mode); + + platformContext.writePixels(opaqueBitmap, 50, 50); + EXPECT_EQ_RECT(IntRect(50, 50, 10, 10), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.fillRect(FloatRect(10, 10, 90, 90), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + platformContext.writePixels(alphaBitmap, 10, 0); + EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + platformContext.writePixels(alphaBitmap, 10, 1); + EXPECT_EQ_RECT(IntRect(10, 11, 90, 89), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + platformContext.writePixels(alphaBitmap, 0, 10); + EXPECT_EQ_RECT(IntRect(10, 11, 90, 89), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + platformContext.writePixels(alphaBitmap, 1, 10); + EXPECT_EQ_RECT(IntRect(11, 11, 89, 89), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); +} + +TEST(PlatformContextSkiaTest, trackOpaqueDrawBitmapTest) +{ + SkBitmap bitmap; + bitmap.setConfig(SkBitmap::kARGB_8888_Config, 200, 200); + bitmap.allocPixels(); + bitmap.eraseColor(0); + SkCanvas canvas(bitmap); + + PlatformContextSkia platformContext(&canvas); + platformContext.setTrackOpaqueRegion(true); + GraphicsContext context(&platformContext); + + Color opaque(1.0f, 0.0f, 0.0f, 1.0f); + + SkBitmap opaqueBitmap; + opaqueBitmap.setConfig(SkBitmap::kARGB_8888_Config, 10, 10); + opaqueBitmap.allocPixels(); + opaqueBitmap.setIsOpaque(true); + for (int y = 0; y < opaqueBitmap.height(); ++y) + for (int x = 0; x < opaqueBitmap.width(); ++x) + *opaqueBitmap.getAddr32(x, y) = 0xFFFFFFFF; + + SkBitmap alphaBitmap; + alphaBitmap.setConfig(SkBitmap::kARGB_8888_Config, 10, 10); + alphaBitmap.allocPixels(); + alphaBitmap.setIsOpaque(false); + for (int y = 0; y < alphaBitmap.height(); ++y) + for (int x = 0; x < alphaBitmap.width(); ++x) + *alphaBitmap.getAddr32(x, y) = 0x00000000; + + SkPaint paint; + paint.setXfermodeMode(SkXfermode::kSrc_Mode); + + platformContext.drawBitmap(opaqueBitmap, 10, 10, &paint); + EXPECT_EQ_RECT(IntRect(10, 10, 10, 10), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.fillRect(FloatRect(10, 10, 90, 90), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + platformContext.drawBitmap(alphaBitmap, 10, 0, &paint); + EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + platformContext.drawBitmap(alphaBitmap, 10, 1, &paint); + EXPECT_EQ_RECT(IntRect(10, 11, 90, 89), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + platformContext.drawBitmap(alphaBitmap, 0, 10, &paint); + EXPECT_EQ_RECT(IntRect(10, 11, 90, 89), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + platformContext.drawBitmap(alphaBitmap, 1, 10, &paint); + EXPECT_EQ_RECT(IntRect(11, 11, 89, 89), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); +} + +TEST(PlatformContextSkiaTest, trackOpaqueDrawBitmapRectTest) +{ + SkBitmap bitmap; + bitmap.setConfig(SkBitmap::kARGB_8888_Config, 200, 200); + bitmap.allocPixels(); + bitmap.eraseColor(0); + SkCanvas canvas(bitmap); + + PlatformContextSkia platformContext(&canvas); + platformContext.setTrackOpaqueRegion(true); + GraphicsContext context(&platformContext); + + Color opaque(1.0f, 0.0f, 0.0f, 1.0f); + + SkBitmap opaqueBitmap; + opaqueBitmap.setConfig(SkBitmap::kARGB_8888_Config, 10, 10); + opaqueBitmap.allocPixels(); + opaqueBitmap.setIsOpaque(true); + for (int y = 0; y < opaqueBitmap.height(); ++y) + for (int x = 0; x < opaqueBitmap.width(); ++x) + *opaqueBitmap.getAddr32(x, y) = 0xFFFFFFFF; + + SkBitmap alphaBitmap; + alphaBitmap.setConfig(SkBitmap::kARGB_8888_Config, 10, 10); + alphaBitmap.allocPixels(); + alphaBitmap.setIsOpaque(false); + for (int y = 0; y < alphaBitmap.height(); ++y) + for (int x = 0; x < alphaBitmap.width(); ++x) + *alphaBitmap.getAddr32(x, y) = 0x00000000; + + SkPaint paint; + paint.setXfermodeMode(SkXfermode::kSrc_Mode); + + platformContext.drawBitmapRect(opaqueBitmap, 0, SkRect::MakeXYWH(10, 10, 90, 90), &paint); + EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + platformContext.drawBitmapRect(alphaBitmap, 0, SkRect::MakeXYWH(10, 0, 10, 10), &paint); + EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + platformContext.drawBitmapRect(alphaBitmap, 0, SkRect::MakeXYWH(10, 0, 10, 11), &paint); + EXPECT_EQ_RECT(IntRect(10, 11, 90, 89), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + platformContext.drawBitmapRect(alphaBitmap, 0, SkRect::MakeXYWH(0, 10, 10, 10), &paint); + EXPECT_EQ_RECT(IntRect(10, 11, 90, 89), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + platformContext.drawBitmapRect(alphaBitmap, 0, SkRect::MakeXYWH(0, 10, 11, 10), &paint); + EXPECT_EQ_RECT(IntRect(11, 11, 89, 89), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); +} + TEST(PlatformContextSkiaTest, contextTransparencyLayerTest) { SkBitmap bitmap; diff --git a/Source/WebKit/efl/ChangeLog b/Source/WebKit/efl/ChangeLog index 0310650bd..7a46a47d3 100644 --- a/Source/WebKit/efl/ChangeLog +++ b/Source/WebKit/efl/ChangeLog @@ -1,3 +1,37 @@ +2012-11-30 Mihai Maerean <mmaerean@adobe.com> + + [CSSRegions] when WebKit uses V8, there should be a single variable to store if the CSS Regions feature is enabled + https://bugs.webkit.org/show_bug.cgi?id=101192 + + Reviewed by Hajime Morita. + + Removed the CSS Regions flag in Settings and switched to using the new flag I have added in RuntimeEnabledFeatures. + + Tests: No new tests because there is no functional change. + + * WebCoreSupport/DumpRenderTreeSupportEfl.cpp: + (DumpRenderTreeSupportEfl::setCSSRegionsEnabled): + * ewk/ewk_view.cpp: + (_ewk_view_priv_new): + +2012-11-29 Alexey Proskuryakov <ap@apple.com> + + [WK2] Forward cookie jar calls to NetworkProcess + https://bugs.webkit.org/show_bug.cgi?id=103457 + + Reviewed by Darin Adler. + + * WebCoreSupport/PlatformStrategiesEfl.cpp: + (PlatformStrategiesEfl::cookiesForDOM): + (PlatformStrategiesEfl::setCookiesFromDOM): + (PlatformStrategiesEfl::cookiesEnabled): + (PlatformStrategiesEfl::cookieRequestHeaderFieldValue): + (PlatformStrategiesEfl::getRawCookies): + (PlatformStrategiesEfl::deleteCookie): + (PlatformStrategiesEfl::getHostnamesWithCookies): + (PlatformStrategiesEfl::deleteCookiesForHostname): + (PlatformStrategiesEfl::deleteAllCookies): + 2012-11-29 Ryuan Choi <ryuan.choi@samsung.com> [EFL] Broken rendering occurs when scrolling in ewk_view_single. diff --git a/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp b/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp index 7ea2721d8..14ff753f5 100644 --- a/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp +++ b/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp @@ -53,6 +53,7 @@ #include <PrintContext.h> #include <RenderTreeAsText.h> #include <ResourceLoadScheduler.h> +#include <RuntimeEnabledFeatures.h> #include <SchemeRegistry.h> #include <ScriptValue.h> #include <Settings.h> @@ -367,7 +368,7 @@ void DumpRenderTreeSupportEfl::setCSSRegionsEnabled(const Evas_Object* ewkView, { DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page); - page->settings()->setCSSRegionsEnabled(enabled); + WebCore::RuntimeEnabledFeatures::setCSSRegionsEnabled(enabled); } bool DumpRenderTreeSupportEfl::isCommandEnabled(const Evas_Object* ewkView, const char* name) diff --git a/Source/WebKit/efl/WebCoreSupport/PlatformStrategiesEfl.cpp b/Source/WebKit/efl/WebCoreSupport/PlatformStrategiesEfl.cpp index 7138aa8d7..ca194862d 100644 --- a/Source/WebKit/efl/WebCoreSupport/PlatformStrategiesEfl.cpp +++ b/Source/WebKit/efl/WebCoreSupport/PlatformStrategiesEfl.cpp @@ -29,6 +29,7 @@ #include "NotImplemented.h" #include "Page.h" #include "PageGroup.h" +#include "PlatformCookieJar.h" #include "PluginDatabase.h" #include "PluginPackage.h" @@ -80,6 +81,51 @@ void PlatformStrategiesEfl::notifyCookiesChanged() { } +String PlatformStrategiesEfl::cookiesForDOM(NetworkingContext* context, const KURL& firstParty, const KURL& url) +{ + return WebCore::cookiesForDOM(context, firstParty, url); +} + +void PlatformStrategiesEfl::setCookiesFromDOM(NetworkingContext* context, const KURL& firstParty, const KURL& url, const String& cookieString) +{ + WebCore::setCookiesFromDOM(context, firstParty, url, cookieString); +} + +bool PlatformStrategiesEfl::cookiesEnabled(NetworkingContext* context, const KURL& firstParty, const KURL& url) +{ + return WebCore::cookiesEnabled(context, firstParty, url); +} + +String PlatformStrategiesEfl::cookieRequestHeaderFieldValue(NetworkingContext* context, const KURL& firstParty, const KURL& url) +{ + return WebCore::cookieRequestHeaderFieldValue(context, firstParty, url); +} + +bool PlatformStrategiesEfl::getRawCookies(NetworkingContext* context, const KURL& firstParty, const KURL& url, Vector<Cookie>& rawCookies) +{ + return WebCore::getRawCookies(context, firstParty, url, rawCookies); +} + +void PlatformStrategiesEfl::deleteCookie(NetworkingContext* context, const KURL& url, const String& cookieName) +{ + WebCore::deleteCookie(context, url, cookieName); +} + +void PlatformStrategiesEfl::getHostnamesWithCookies(NetworkingContext* context, HashSet<String>& hostnames) +{ + WebCore::getHostnamesWithCookies(context, hostnames); +} + +void PlatformStrategiesEfl::deleteCookiesForHostname(NetworkingContext* context, const String& hostname) +{ + WebCore::deleteCookiesForHostname(context, hostname); +} + +void PlatformStrategiesEfl::deleteAllCookies(NetworkingContext* context) +{ + WebCore::deleteAllCookies(context); +} + void PlatformStrategiesEfl::refreshPlugins() { #if ENABLE(NETSCAPE_PLUGIN_API) diff --git a/Source/WebKit/efl/WebCoreSupport/PlatformStrategiesEfl.h b/Source/WebKit/efl/WebCoreSupport/PlatformStrategiesEfl.h index 01e61156c..baa7d0548 100644 --- a/Source/WebKit/efl/WebCoreSupport/PlatformStrategiesEfl.h +++ b/Source/WebKit/efl/WebCoreSupport/PlatformStrategiesEfl.h @@ -45,6 +45,15 @@ private: // WebCore::CookiesStrategy virtual void notifyCookiesChanged(); + virtual String cookiesForDOM(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&); + virtual void setCookiesFromDOM(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&, const String&); + virtual bool cookiesEnabled(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&); + virtual String cookieRequestHeaderFieldValue(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&); + virtual bool getRawCookies(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&, Vector<WebCore::Cookie>&); + virtual void deleteCookie(WebCore::NetworkingContext*, const WebCore::KURL&, const String&); + virtual void getHostnamesWithCookies(WebCore::NetworkingContext*, HashSet<String>& hostnames); + virtual void deleteCookiesForHostname(WebCore::NetworkingContext*, const String& hostname); + virtual void deleteAllCookies(WebCore::NetworkingContext*); // WebCore::PluginStrategy virtual void refreshPlugins(); diff --git a/Source/WebKit/efl/ewk/ewk_view.cpp b/Source/WebKit/efl/ewk/ewk_view.cpp index 03d69c073..677bbfa38 100644 --- a/Source/WebKit/efl/ewk/ewk_view.cpp +++ b/Source/WebKit/efl/ewk/ewk_view.cpp @@ -57,6 +57,7 @@ #include "RefPtrCairo.h" #include "RenderThemeEfl.h" #include "ResourceHandle.h" +#include "RuntimeEnabledFeatures.h" #include "Settings.h" #include "TiledBackingStore.h" #include "c_instance.h" @@ -821,7 +822,7 @@ static Ewk_View_Private_Data* _ewk_view_priv_new(Ewk_View_Smart_Data* smartData) priv->pageSettings->setSansSerifFontFamily("sans"); priv->pageSettings->setStandardFontFamily("sans"); priv->pageSettings->setHyperlinkAuditingEnabled(false); - priv->pageSettings->setCSSRegionsEnabled(true); + WebCore::RuntimeEnabledFeatures::setCSSRegionsEnabled(true); priv->pageSettings->setScriptEnabled(true); priv->pageSettings->setPluginsEnabled(true); priv->pageSettings->setLocalStorageEnabled(true); diff --git a/Source/WebKit/gtk/ChangeLog b/Source/WebKit/gtk/ChangeLog index e56a9f561..3f48b3f48 100644 --- a/Source/WebKit/gtk/ChangeLog +++ b/Source/WebKit/gtk/ChangeLog @@ -1,3 +1,35 @@ +2012-11-30 Mihai Maerean <mmaerean@adobe.com> + + [CSSRegions] when WebKit uses V8, there should be a single variable to store if the CSS Regions feature is enabled + https://bugs.webkit.org/show_bug.cgi?id=101192 + + Reviewed by Hajime Morita. + + Removed the CSS Regions flag in Settings and switched to using the new flag I have added in RuntimeEnabledFeatures. + + Tests: No new tests because there is no functional change. + + * WebCoreSupport/DumpRenderTreeSupportGtk.cpp: + (DumpRenderTreeSupportGtk::setCSSRegionsEnabled): + +2012-11-29 Alexey Proskuryakov <ap@apple.com> + + [WK2] Forward cookie jar calls to NetworkProcess + https://bugs.webkit.org/show_bug.cgi?id=103457 + + Reviewed by Darin Adler. + + * WebCoreSupport/PlatformStrategiesGtk.cpp: + (PlatformStrategiesGtk::cookiesForDOM): + (PlatformStrategiesGtk::setCookiesFromDOM): + (PlatformStrategiesGtk::cookiesEnabled): + (PlatformStrategiesGtk::cookieRequestHeaderFieldValue): + (PlatformStrategiesGtk::getRawCookies): + (PlatformStrategiesGtk::deleteCookie): + (PlatformStrategiesGtk::getHostnamesWithCookies): + (PlatformStrategiesGtk::deleteCookiesForHostname): + (PlatformStrategiesGtk::deleteAllCookies): + 2012-11-27 James Simonsen <simonjam@chromium.org> Consolidate FrameLoader::load() into one function taking a FrameLoadRequest diff --git a/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp b/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp index a37f83e14..cdb5b6e55 100644 --- a/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp +++ b/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp @@ -690,7 +690,7 @@ void DumpRenderTreeSupportGtk::setCSSGridLayoutEnabled(WebKitWebView* webView, b void DumpRenderTreeSupportGtk::setCSSRegionsEnabled(WebKitWebView* webView, bool enabled) { - core(webView)->settings()->setCSSRegionsEnabled(enabled); + RuntimeEnabledFeatures::setCSSRegionsEnabled(enabled); } void DumpRenderTreeSupportGtk::setCSSCustomFilterEnabled(WebKitWebView* webView, bool enabled) diff --git a/Source/WebKit/gtk/WebCoreSupport/PlatformStrategiesGtk.cpp b/Source/WebKit/gtk/WebCoreSupport/PlatformStrategiesGtk.cpp index 00a7062c9..8661300f9 100644 --- a/Source/WebKit/gtk/WebCoreSupport/PlatformStrategiesGtk.cpp +++ b/Source/WebKit/gtk/WebCoreSupport/PlatformStrategiesGtk.cpp @@ -22,6 +22,7 @@ #include "NotImplemented.h" #include "Page.h" #include "PageGroup.h" +#include "PlatformCookieJar.h" #include "PluginDatabase.h" #include "PluginPackage.h" @@ -74,6 +75,51 @@ void PlatformStrategiesGtk::notifyCookiesChanged() { } +String PlatformStrategiesGtk::cookiesForDOM(NetworkingContext* context, const KURL& firstParty, const KURL& url) +{ + return WebCore::cookiesForDOM(context, firstParty, url); +} + +void PlatformStrategiesGtk::setCookiesFromDOM(NetworkingContext* context, const KURL& firstParty, const KURL& url, const String& cookieString) +{ + WebCore::setCookiesFromDOM(context, firstParty, url, cookieString); +} + +bool PlatformStrategiesGtk::cookiesEnabled(NetworkingContext* context, const KURL& firstParty, const KURL& url) +{ + return WebCore::cookiesEnabled(context, firstParty, url); +} + +String PlatformStrategiesGtk::cookieRequestHeaderFieldValue(NetworkingContext* context, const KURL& firstParty, const KURL& url) +{ + return WebCore::cookieRequestHeaderFieldValue(context, firstParty, url); +} + +bool PlatformStrategiesGtk::getRawCookies(NetworkingContext* context, const KURL& firstParty, const KURL& url, Vector<Cookie>& rawCookies) +{ + return WebCore::getRawCookies(context, firstParty, url, rawCookies); +} + +void PlatformStrategiesGtk::deleteCookie(NetworkingContext* context, const KURL& url, const String& cookieName) +{ + WebCore::deleteCookie(context, url, cookieName); +} + +void PlatformStrategiesGtk::getHostnamesWithCookies(NetworkingContext* context, HashSet<String>& hostnames) +{ + WebCore::getHostnamesWithCookies(context, hostnames); +} + +void PlatformStrategiesGtk::deleteCookiesForHostname(NetworkingContext* context, const String& hostname) +{ + WebCore::deleteCookiesForHostname(context, hostname); +} + +void PlatformStrategiesGtk::deleteAllCookies(NetworkingContext* context) +{ + WebCore::deleteAllCookies(context); +} + // PluginStrategy void PlatformStrategiesGtk::refreshPlugins() { diff --git a/Source/WebKit/gtk/WebCoreSupport/PlatformStrategiesGtk.h b/Source/WebKit/gtk/WebCoreSupport/PlatformStrategiesGtk.h index cf34ae24b..c4536f17e 100644 --- a/Source/WebKit/gtk/WebCoreSupport/PlatformStrategiesGtk.h +++ b/Source/WebKit/gtk/WebCoreSupport/PlatformStrategiesGtk.h @@ -44,6 +44,15 @@ private: // WebCore::CookiesStrategy virtual void notifyCookiesChanged(); + virtual String cookiesForDOM(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&); + virtual void setCookiesFromDOM(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&, const String&); + virtual bool cookiesEnabled(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&); + virtual String cookieRequestHeaderFieldValue(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&); + virtual bool getRawCookies(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&, Vector<WebCore::Cookie>&); + virtual void deleteCookie(WebCore::NetworkingContext*, const WebCore::KURL&, const String&); + virtual void getHostnamesWithCookies(WebCore::NetworkingContext*, HashSet<String>& hostnames); + virtual void deleteCookiesForHostname(WebCore::NetworkingContext*, const String& hostname); + virtual void deleteAllCookies(WebCore::NetworkingContext*); // WebCore::PluginStrategy virtual void refreshPlugins(); diff --git a/Source/WebKit/mac/ChangeLog b/Source/WebKit/mac/ChangeLog index 50e12ae99..9e6ce6469 100644 --- a/Source/WebKit/mac/ChangeLog +++ b/Source/WebKit/mac/ChangeLog @@ -1,3 +1,52 @@ +2012-11-30 Mihai Maerean <mmaerean@adobe.com> + + [CSSRegions] when WebKit uses V8, there should be a single variable to store if the CSS Regions feature is enabled + https://bugs.webkit.org/show_bug.cgi?id=101192 + + Reviewed by Hajime Morita. + + Removed the CSS Regions flag in Settings and switched to using the new flag I have added in RuntimeEnabledFeatures. + + Tests: No new tests because there is no functional change. + + * WebView/WebView.mm: + (-[WebView _preferencesChanged:]): + +2012-11-29 Rafael Weinstein <rafaelw@chromium.org> + + [HTMLTemplateElement] Add feature flag + https://bugs.webkit.org/show_bug.cgi?id=103694 + + Reviewed by Adam Barth. + + This flag will guard the implementation of the HTMLTemplateElement. + http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/templates/index.html + + * Configurations/FeatureDefines.xcconfig: + +2012-11-29 Alexey Proskuryakov <ap@apple.com> + + [WK2] Forward cookie jar calls to NetworkProcess + https://bugs.webkit.org/show_bug.cgi?id=103457 + + Reviewed by Darin Adler. + + * WebCoreSupport/WebPlatformStrategies.h: + (WebPlatformStrategies): + * WebCoreSupport/WebPlatformStrategies.mm: + (WebPlatformStrategies::cookiesForDOM): + (WebPlatformStrategies::setCookiesFromDOM): + (WebPlatformStrategies::cookiesEnabled): + (WebPlatformStrategies::cookieRequestHeaderFieldValue): + (WebPlatformStrategies::getRawCookies): + (WebPlatformStrategies::deleteCookie): + (WebPlatformStrategies::getHostnamesWithCookies): + (WebPlatformStrategies::deleteCookiesForHostname): + (WebPlatformStrategies::deleteAllCookies): + (WebPlatformStrategies::getPluginInfo): + (WebPlatformStrategies::bufferForType): + WebKit1 strategy just uses PlatformCookieJar. + 2012-11-28 Beth Dakin <bdakin@apple.com> https://bugs.webkit.org/show_bug.cgi?id=102970 diff --git a/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig b/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig index b0d2dab41..1b0396831 100644 --- a/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig +++ b/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig @@ -143,6 +143,7 @@ ENABLE_SVG = ENABLE_SVG; ENABLE_SVG_DOM_OBJC_BINDINGS = $(ENABLE_SVG_DOM_OBJC_BINDINGS_$(PLATFORM_NAME)); ENABLE_SVG_DOM_OBJC_BINDINGS_macosx = ENABLE_SVG_DOM_OBJC_BINDINGS; ENABLE_SVG_FONTS = ENABLE_SVG_FONTS; +ENABLE_TEMPLATE_ELEMENT = ; ENABLE_TEXT_AUTOSIZING = ; ENABLE_TEXT_NOTIFICATIONS_ONLY = ENABLE_TEXT_NOTIFICATIONS_ONLY; ENABLE_TOUCH_ICON_LOADING = ; diff --git a/Source/WebKit/mac/Configurations/Version.xcconfig b/Source/WebKit/mac/Configurations/Version.xcconfig index dd8b134f6..58e8f5c07 100644 --- a/Source/WebKit/mac/Configurations/Version.xcconfig +++ b/Source/WebKit/mac/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 537; -MINOR_VERSION = 20; +MINOR_VERSION = 21; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h b/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h index f9d8c7719..9c5f511aa 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h +++ b/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h @@ -52,6 +52,15 @@ private: // WebCore::CookiesStrategy virtual void notifyCookiesChanged() OVERRIDE; virtual RetainPtr<CFHTTPCookieStorageRef> defaultCookieStorage() OVERRIDE; + virtual String cookiesForDOM(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&) OVERRIDE; + virtual void setCookiesFromDOM(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&, const String&) OVERRIDE; + virtual bool cookiesEnabled(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&) OVERRIDE; + virtual String cookieRequestHeaderFieldValue(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&) OVERRIDE; + virtual bool getRawCookies(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&, Vector<WebCore::Cookie>&) OVERRIDE; + virtual void deleteCookie(WebCore::NetworkingContext*, const WebCore::KURL&, const String&) OVERRIDE; + virtual void getHostnamesWithCookies(WebCore::NetworkingContext*, HashSet<String>& hostnames) OVERRIDE; + virtual void deleteCookiesForHostname(WebCore::NetworkingContext*, const String& hostname) OVERRIDE; + virtual void deleteAllCookies(WebCore::NetworkingContext*) OVERRIDE; // WebCore::PluginStrategy virtual void refreshPlugins() OVERRIDE; diff --git a/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm b/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm index c79b089b9..1591718f6 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm @@ -32,6 +32,7 @@ #import <WebCore/Color.h> #import <WebCore/Page.h> #import <WebCore/PageGroup.h> +#import <WebCore/PlatformCookieJar.h> #import <WebCore/PlatformPasteboard.h> #import <WebKitSystemInterface.h> @@ -94,12 +95,57 @@ RetainPtr<CFHTTPCookieStorageRef> WebPlatformStrategies::defaultCookieStorage() #endif } +String WebPlatformStrategies::cookiesForDOM(NetworkingContext* context, const KURL& firstParty, const KURL& url) +{ + return WebCore::cookiesForDOM(context, firstParty, url); +} + +void WebPlatformStrategies::setCookiesFromDOM(NetworkingContext* context, const KURL& firstParty, const KURL& url, const String& cookieString) +{ + WebCore::setCookiesFromDOM(context, firstParty, url, cookieString); +} + +bool WebPlatformStrategies::cookiesEnabled(NetworkingContext* context, const KURL& firstParty, const KURL& url) +{ + return WebCore::cookiesEnabled(context, firstParty, url); +} + +String WebPlatformStrategies::cookieRequestHeaderFieldValue(NetworkingContext* context, const KURL& firstParty, const KURL& url) +{ + return WebCore::cookieRequestHeaderFieldValue(context, firstParty, url); +} + +bool WebPlatformStrategies::getRawCookies(NetworkingContext* context, const KURL& firstParty, const KURL& url, Vector<Cookie>& rawCookies) +{ + return WebCore::getRawCookies(context, firstParty, url, rawCookies); +} + +void WebPlatformStrategies::deleteCookie(NetworkingContext* context, const KURL& url, const String& cookieName) +{ + WebCore::deleteCookie(context, url, cookieName); +} + +void WebPlatformStrategies::getHostnamesWithCookies(NetworkingContext* context, HashSet<String>& hostnames) +{ + WebCore::getHostnamesWithCookies(context, hostnames); +} + +void WebPlatformStrategies::deleteCookiesForHostname(NetworkingContext* context, const String& hostname) +{ + WebCore::deleteCookiesForHostname(context, hostname); +} + +void WebPlatformStrategies::deleteAllCookies(NetworkingContext* context) +{ + WebCore::deleteAllCookies(context); +} + void WebPlatformStrategies::refreshPlugins() { [[WebPluginDatabase sharedDatabase] refresh]; } -void WebPlatformStrategies::getPluginInfo(const WebCore::Page*, Vector<WebCore::PluginInfo>& plugins) +void WebPlatformStrategies::getPluginInfo(const Page*, Vector<PluginInfo>& plugins) { BEGIN_BLOCK_OBJC_EXCEPTIONS; @@ -128,7 +174,7 @@ void WebPlatformStrategies::getTypes(Vector<String>& types, const String& pasteb PlatformPasteboard(pasteboardName).getTypes(types); } -PassRefPtr<WebCore::SharedBuffer> WebPlatformStrategies::bufferForType(const String& pasteboardType, const String& pasteboardName) +PassRefPtr<SharedBuffer> WebPlatformStrategies::bufferForType(const String& pasteboardType, const String& pasteboardName) { return PlatformPasteboard(pasteboardName).bufferForType(pasteboardType); } diff --git a/Source/WebKit/mac/WebView/WebView.mm b/Source/WebKit/mac/WebView/WebView.mm index 1b17c67e4..f8e5b79f0 100644 --- a/Source/WebKit/mac/WebView/WebView.mm +++ b/Source/WebKit/mac/WebView/WebView.mm @@ -163,6 +163,7 @@ #import <WebCore/ResourceRequest.h> #import <WebCore/RunLoop.h> #import <WebCore/RuntimeApplicationChecks.h> +#import <WebCore/RuntimeEnabledFeatures.h> #import <WebCore/SchemeRegistry.h> #import <WebCore/ScriptController.h> #import <WebCore/ScriptValue.h> @@ -1538,7 +1539,7 @@ static bool needsSelfRetainWhileLoadingQuirk() #if ENABLE(CSS_SHADERS) settings->setCSSCustomFilterEnabled([preferences cssCustomFilterEnabled]); #endif - settings->setCSSRegionsEnabled([preferences cssRegionsEnabled]); + RuntimeEnabledFeatures::setCSSRegionsEnabled([preferences cssRegionsEnabled]); settings->setCSSGridLayoutEnabled([preferences cssGridLayoutEnabled]); #if ENABLE(FULLSCREEN_API) settings->setFullScreenEnabled([preferences fullScreenEnabled]); diff --git a/Source/WebKit/qt/Api/qwebelement.h b/Source/WebKit/qt/Api/qwebelement.h index efec5eb7c..e907a69a1 100644 --- a/Source/WebKit/qt/Api/qwebelement.h +++ b/Source/WebKit/qt/Api/qwebelement.h @@ -150,7 +150,7 @@ private: static QWebElement enclosingElement(WebCore::Node*); friend class DumpRenderTreeSupportQt; - friend class QWebFrame; + friend class QWebFrameAdapter; friend class QWebElementCollection; friend class QWebHitTestResult; friend class QWebHitTestResultPrivate; diff --git a/Source/WebKit/qt/Api/qwebframe_p.h b/Source/WebKit/qt/Api/qwebframe_p.h deleted file mode 100644 index dbdcbc85a..000000000 --- a/Source/WebKit/qt/Api/qwebframe_p.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) - Copyright (C) 2007 Staikos Computing Services Inc. - - 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 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" -#if USE(ACCELERATED_COMPOSITING) -#include "texmap/TextureMapper.h" -#endif -#include "ViewportArguments.h" -#include <wtf/RefPtr.h> -#include <wtf/text/WTFString.h> - - -namespace WebCore { - class FrameLoaderClientQt; - class FrameView; - class HTMLFrameOwnerElement; - class Scrollbar; - class TextureMapperLayer; -} -class QWebPage; - -class QWebFramePrivate : public QWebFrameAdapter { -public: - QWebFramePrivate() - : q(0) - , horizontalScrollBarPolicy(Qt::ScrollBarAsNeeded) - , verticalScrollBarPolicy(Qt::ScrollBarAsNeeded) - , page(0) -#if USE(ACCELERATED_COMPOSITING) - , rootTextureMapperLayer(0) -#endif - {} - void setPage(QWebPage*); - - inline QWebFrame *parentFrame() { return qobject_cast<QWebFrame*>(q->parent()); } - - WebCore::Scrollbar* horizontalScrollBar() const; - WebCore::Scrollbar* verticalScrollBar() const; - - 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) - void renderFromTiledBackingStore(WebCore::GraphicsContext*, const QRegion& clip); -#endif - -#if USE(ACCELERATED_COMPOSITING) - void renderCompositedLayers(WebCore::GraphicsContext*, const WebCore::IntRect& clip); -#endif - void renderFrameExtras(WebCore::GraphicsContext*, QFlags<QWebFrame::RenderLayer>, const QRegion& clip); - void _q_orientationChanged(); - - - // 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; - QWebPage *page; - -#if USE(ACCELERATED_COMPOSITING) - WebCore::TextureMapperLayer* rootTextureMapperLayer; - OwnPtr<WebCore::TextureMapper> textureMapper; -#endif - -#if ENABLE(ORIENTATION_EVENTS) - QOrientationSensor m_orientation; -#endif // ENABLE(ORIENTATION_EVENTS). -}; - -class QWebHitTestResultPrivate { -public: - QWebHitTestResultPrivate() : isContentEditable(false), isContentSelected(false), isScrollBar(false) {} - QWebHitTestResultPrivate(const WebCore::HitTestResult &hitTest); - - QPoint pos; - QRect boundingRect; - QWebElement enclosingBlock; - QString title; - QString linkText; - QUrl linkUrl; - QString linkTitle; - QPointer<QWebFrame> linkTargetFrame; - QWebElement linkElement; - QString alternateText; - QUrl imageUrl; - QPixmap pixmap; - bool isContentEditable; - bool isContentSelected; - bool isScrollBar; - QPointer<QWebFrame> frame; - RefPtr<WebCore::Node> innerNode; - RefPtr<WebCore::Node> innerNonSharedNode; -}; - -#endif diff --git a/Source/WebKit/qt/Api/qwebhistory.h b/Source/WebKit/qt/Api/qwebhistory.h index 753eb6376..092f425ee 100644 --- a/Source/WebKit/qt/Api/qwebhistory.h +++ b/Source/WebKit/qt/Api/qwebhistory.h @@ -101,7 +101,7 @@ private: ~QWebHistory(); friend class QWebPage; - friend class QWebPagePrivate; + friend class QWebPageAdapter; friend QWEBKIT_EXPORT QDataStream& operator>>(QDataStream&, QWebHistory&); friend QWEBKIT_EXPORT QDataStream& operator<<(QDataStream&, const QWebHistory&); diff --git a/Source/WebKit/qt/Api/qwebkitversion.cpp b/Source/WebKit/qt/Api/qwebkitglobal.cpp index 1143f99e0..0ae955b8f 100644 --- a/Source/WebKit/qt/Api/qwebkitversion.cpp +++ b/Source/WebKit/qt/Api/qwebkitglobal.cpp @@ -18,7 +18,8 @@ */ #include "config.h" -#include <qwebkitversion.h> +#include "qwebkitglobal.h" + #include <WebKitVersion.h> /*! diff --git a/Source/WebKit/qt/Api/qwebkitglobal.h b/Source/WebKit/qt/Api/qwebkitglobal.h index 947ba0654..1d61182c8 100644 --- a/Source/WebKit/qt/Api/qwebkitglobal.h +++ b/Source/WebKit/qt/Api/qwebkitglobal.h @@ -1,5 +1,6 @@ /* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + Copyright (C) 2009 Robert Hogan <robert@roberthogan.net> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -21,11 +22,8 @@ #define QWEBKITGLOBAL_H #include <QtCore/qglobal.h> +#include <QtCore/qstring.h> -#define QTWEBKIT_VERSION_STR "2.2.0" -// QTWEBKIT_VERSION is (major << 16) + (minor << 8) + patch. Similar to Qt. -#define QTWEBKIT_VERSION 0x020200 -// 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)) #ifndef QT_STATIC @@ -38,4 +36,8 @@ # define QWEBKIT_EXPORT #endif +QWEBKIT_EXPORT QString qWebKitVersion(); +QWEBKIT_EXPORT int qWebKitMajorVersion(); +QWEBKIT_EXPORT int qWebKitMinorVersion(); + #endif // QWEBKITGLOBAL_H diff --git a/Source/WebKit/qt/Api/qwebkitversion.h b/Source/WebKit/qt/Api/qwebkitversion.h deleted file mode 100644 index de79dd1a7..000000000 --- a/Source/WebKit/qt/Api/qwebkitversion.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - Copyright (C) 2009 Robert Hogan <robert@roberthogan.net> - - 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 <QtCore/qstring.h> - -#ifndef qwebkitversion_h -#define qwebkitversion_h - -#include <QtCore/qstring.h> -#include "qwebkitglobal.h" - -QWEBKIT_EXPORT QString qWebKitVersion(); -QWEBKIT_EXPORT int qWebKitMajorVersion(); -QWEBKIT_EXPORT int qWebKitMinorVersion(); - -#endif // qwebkitversion_h diff --git a/Source/WebKit/qt/Api/qwebsecurityorigin.h b/Source/WebKit/qt/Api/qwebsecurityorigin.h index 7328680f3..61c45f1d6 100644 --- a/Source/WebKit/qt/Api/qwebsecurityorigin.h +++ b/Source/WebKit/qt/Api/qwebsecurityorigin.h @@ -59,7 +59,7 @@ public: QWebSecurityOrigin &operator=(const QWebSecurityOrigin& other); private: friend class QWebDatabase; - friend class QWebFrame; + friend class QWebFrameAdapter; friend class WebCore::ChromeClientQt; QWebSecurityOrigin(QWebSecurityOriginPrivate* priv); diff --git a/Source/WebKit/qt/Api/qwebsettings.cpp b/Source/WebKit/qt/Api/qwebsettings.cpp index 74d8524d8..01818aff4 100644 --- a/Source/WebKit/qt/Api/qwebsettings.cpp +++ b/Source/WebKit/qt/Api/qwebsettings.cpp @@ -41,6 +41,7 @@ #include "Page.h" #include "PageCache.h" #include "PluginDatabase.h" +#include "RuntimeEnabledFeatures.h" #include "Settings.h" #include <QDir> #include <QFileInfo> @@ -167,7 +168,7 @@ void QWebSettingsPrivate::apply() value = attributes.value(QWebSettings::CSSRegionsEnabled, global->attributes.value(QWebSettings::CSSRegionsEnabled)); - settings->setCSSRegionsEnabled(value); + WebCore::RuntimeEnabledFeatures::setCSSRegionsEnabled(value); value = attributes.value(QWebSettings::CSSGridLayoutEnabled, global->attributes.value(QWebSettings::CSSGridLayoutEnabled)); settings->setCSSGridLayoutEnabled(value); @@ -533,7 +534,7 @@ QWebSettings::QWebSettings() d->attributes.insert(QWebSettings::LocalContentCanAccessRemoteUrls, false); d->attributes.insert(QWebSettings::LocalContentCanAccessFileUrls, true); d->attributes.insert(QWebSettings::AcceleratedCompositingEnabled, true); - d->attributes.insert(QWebSettings::WebGLEnabled, false); + d->attributes.insert(QWebSettings::WebGLEnabled, true); d->attributes.insert(QWebSettings::CSSRegionsEnabled, true); d->attributes.insert(QWebSettings::CSSGridLayoutEnabled, false); d->attributes.insert(QWebSettings::HyperlinkAuditingEnabled, false); diff --git a/Source/WebKit/qt/ChangeLog b/Source/WebKit/qt/ChangeLog index 7ec8fbc3e..7d55a135e 100644 --- a/Source/WebKit/qt/ChangeLog +++ b/Source/WebKit/qt/ChangeLog @@ -1,3 +1,887 @@ +2012-11-30 Simon Hausmann <simon.hausmann@digia.com> + + [Qt] Fix QML import installation with newer Qt + + Reviewed by Tor Arne Vestbø. + + The import path has been separated between QML1 and QML2. Use + QT_INSTALL_QML if it's available. + + * declarative/experimental/experimental.pri: + * declarative/public.pri: + +2012-11-30 Simon Hausmann <simon.hausmann@digia.com> + + Prospective build fix for --minimal build. + + * WebCoreSupport/QWebPageAdapter.cpp: + (QWebPageAdapter::triggerAction): + (QWebPageAdapter::contextMenuItemTagForAction): + +2012-11-30 Pierre Rossi <pierre.rossi@gmail.com> + + [Qt] Fix zoomIn/zoomOut related regression. + + Reviewed by Simon Hausmann. + + Following r136235, fix a case of refactoring gone wrong. + Implementing setTextSizeMultiplier in terms of + setZoomFactor, and not the other way around. + + * WebCoreSupport/QWebFrameAdapter.cpp: + (QWebFrameAdapter::setZoomFactor): + * WidgetApi/qwebframe.cpp: + (QWebFrame::setTextSizeMultiplier): + +2012-11-30 Simon Hausmann <simon.hausmann@digia.com>, Pierre Rossi <pierre.rossi@digia.com> + + [Qt] Separate Qt WebKit into Qt WebKit and Qt WebKit Widgets + https://bugs.webkit.org/show_bug.cgi?id=99314 + + Reviewed by Tor Arne Vestbø. + + This big change separates QtWebKit into QtWebKit and QtWebKitWidgets as + shared libraries. + + It's a big refactoring that mostly involves moving WebCore dependent + code into QtWebKit and accessing it through exported QWebFrameAdapter + and QWebPageAdapter classes. + + The QtWebKit version macros are now generated by syncqt and the version + query functions have moved to qwebkitglobal.h, similar to qVersion() in + qglobal.h. + + API wise qwebframe sees some small cleanups. + + * Api/qwebelement.h: + * Api/qwebframe_p.h: Removed. + * Api/qwebhistory.h: + * Api/qwebkitglobal.cpp: Renamed from Source/WebKit/qt/Api/qwebkitversion.cpp. + (qWebKitVersion): + (qWebKitMajorVersion): + (qWebKitMinorVersion): + * Api/qwebkitglobal.h: + * Api/qwebkitversion.h: Removed. + * Api/qwebsecurityorigin.h: + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::allowsAcceleratedCompositing): + * WebCoreSupport/ChromeClientQt.h: + (WebCore): + (ChromeClientQt): + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::frameRenderTreeDump): + * WebCoreSupport/DumpRenderTreeSupportQt.h: + * WebCoreSupport/InitWebCoreQt.cpp: + (WebKit): + (WebKit::setWebKitWidgetsInitCallback): + (WebKit::createStyleForPage): + (WebKit::initializeWebKitQt): + * WebCoreSupport/InitWebCoreQt.h: + (WebKit): + * WebCoreSupport/InspectorServerQt.cpp: + * WebCoreSupport/QWebFrameAdapter.cpp: + (QWebFrameAdapter::QWebFrameAdapter): + (QWebFrameAdapter::hasView): + (QWebFrameAdapter::handleGestureEvent): + (QWebFrameAdapter::evaluateJavaScript): + (QWebFrameAdapter::addToJavaScriptWindowObject): + (QWebFrameAdapter::toHtml): + (QWebFrameAdapter::toPlainText): + (QWebFrameAdapter::setContent): + (QWebFrameAdapter::setHtml): + (QWebFrameAdapter::metaData): + (QWebFrameAdapter::scrollPosition): + (QWebFrameAdapter::frameRect): + (QWebFrameAdapter::contentsSize): + (QWebFrameAdapter::setZoomFactor): + (QWebFrameAdapter::zoomFactor): + (QWebFrameAdapter::ensureAbsoluteUrl): + (QWebFrameAdapter::hitTestContent): + (QWebFrameAdapter::documentElement): + (QWebFrameAdapter::title): + (QWebFrameAdapter::clearCoreFrame): + (isCoreFrameClear): + (QWebFrameAdapter::baseUrl): + (QWebFrameAdapter::renderCompositedLayers): + (QWebFrameAdapter::coreFrameUrl): + (QWebFrameAdapter::lastRequestedUrl): + (QWebFrameAdapter::securityOrigin): + (QWebFrameAdapter::uniqueName): + (coalesceRectsIfPossible): + (QWebFrameAdapter::renderRelativeCoords): + (QWebFrameAdapter::renderFrameExtras): + (QWebFrameAdapter::setTiledBackingStoreFrozen): + (QWebFrameAdapter::tiledBackingStoreFrozen): + (QWebFrameAdapter::setTiledBackingStoreContentsScale): + (QWebFrameAdapter::renderFromTiledBackingStore): + (QWebFrameAdapter::_q_orientationChanged): + (QWebFrameAdapter::childFrames): + (QWebFrameAdapter::hasFocus): + (QWebFrameAdapter::setFocus): + (QWebFrameAdapter::setScrollBarPolicy): + (QWebFrameAdapter::scrollToAnchor): + (QWebFrameAdapter::scrollBy): + (QWebFrameAdapter::setScrollBarValue): + (QWebFrameAdapter::scrollBarValue): + (QWebFrameAdapter::scrollBarMaximum): + (QWebFrameAdapter::scrollBarGeometry): + (QWebFrameAdapter::horizontalScrollBar): + (QWebFrameAdapter::verticalScrollBar): + (QWebFrameAdapter::updateBackgroundRecursively): + (QWebFrameAdapter::cancelLoad): + (QWebHitTestResultPrivate::QWebHitTestResultPrivate): + (QWebHitTestResultPrivate::operator=): + (QWebHitTestResultPrivate::~QWebHitTestResultPrivate): + (QWebHitTestResultPrivate::elementForInnerNode): + (QWebFrameAdapter::customLayoutSize): + (QWebFrameAdapter::setCustomLayoutSize): + (QWebFrameAdapter::setFixedVisibleContentRect): + (QWebFrameAdapter::setViewportSize): + (QWebFrameAdapter::setPaintsEntireContents): + (QWebFrameAdapter::setDelegatesScrolling): + * WebCoreSupport/QWebFrameAdapter.h: + (WebCore): + * WebCoreSupport/QWebPageAdapter.cpp: + (dropActionToDragOp): + (dragOpToDropAction): + (frameLoadRequest): + (openNewWindow): + (QWebPageAdapter::QWebPageAdapter): + (QWebPageAdapter::~QWebPageAdapter): + (QWebPageAdapter::deletePage): + (QWebPageAdapter::viewportArguments): + (QWebPageAdapter::hasSelection): + (QWebPageAdapter::selectedText): + (QWebPageAdapter::selectedHtml): + (QWebPageAdapter::isContentEditable): + (QWebPageAdapter::setContentEditable): + (QWebPageAdapter::findText): + (QWebPageAdapter::adjustPointForClicking): + (hasMouseListener): + (isClickableElement): + (isValidFrameOwner): + (QWebPageAdapter::TouchAdjuster::TouchAdjuster): + (QWebPageAdapter::TouchAdjuster::findCandidatePointForTouch): + (QWebPageAdapter::mouseMoveEvent): + (QWebPageAdapter::mousePressEvent): + (QWebPageAdapter::mouseDoubleClickEvent): + (QWebPageAdapter::mouseTripleClickEvent): + (QWebPageAdapter::mouseReleaseEvent): + (QWebPageAdapter::handleSoftwareInputPanel): + (QWebPageAdapter::wheelEvent): + (QWebPageAdapter::dragEntered): + (QWebPageAdapter::dragLeaveEvent): + (QWebPageAdapter::dragUpdated): + (QWebPageAdapter::performDrag): + (QWebPageAdapter::inputMethodEvent): + (QWebPageAdapter::inputMethodQuery): + (QWebPageAdapter::dynamicPropertyChangeEvent): + (adapterActionForContextMenuAction): + (descriptionForPlatformMenu): + (QWebPageAdapter::updatePositionDependentMenuActions): + (extractContentTypeFromHash): + (extractContentTypeFromPluginVector): + (QWebPageAdapter::supportedContentTypes): + (QWebPageAdapter::_q_cleanupLeakMessages): + (QWebPageAdapter::_q_onLoadProgressChanged): + (QWebPageAdapter::supportsContentType): + (QWebPageAdapter::didShowInspector): + (QWebPageAdapter::didCloseInspector): + (QWebPageAdapter::updateActionInternal): + (QWebPageAdapter::triggerAction): + (QWebPageAdapter::contextMenuItemTagForAction): + (QWebPageAdapter::allowNotificationsForFrame): + (QWebPageAdapter::addNotificationPresenterClient): + (QWebPageAdapter::hasSystemTrayIcon): + (QWebPageAdapter::setSystemTrayIcon): + (QWebPageAdapter::setGeolocationEnabledForFrame): + (QWebPageAdapter::defaultUserAgentString): + (QWebPageAdapter::treatSchemeAsLocal): + (QWebPageAdapter::currentFrame): + (QWebPageAdapter::hasFocusedNode): + (QWebPageAdapter::viewportAttributesForSize): + (QWebPageAdapter::handleKeyEvent): + (QWebPageAdapter::handleScrolling): + (QWebPageAdapter::focusInEvent): + (QWebPageAdapter::focusOutEvent): + (QWebPageAdapter::handleShortcutOverrideEvent): + (QWebPageAdapter::touchEvent): + (QWebPageAdapter::swallowContextMenuEvent): + * WebCoreSupport/QWebPageAdapter.h: + (WebCore): + * WebCoreSupport/QtPluginWidgetAdapter.cpp: Copied from Source/WebKit/qt/WebCoreSupport/InitWebKitQt.h. + (QtPluginWidgetAdapter::QtPluginWidgetAdapter): + * WebCoreSupport/QtPluginWidgetAdapter.h: + * WebCoreSupport/QtPrintContext.cpp: Added. + (QtPrintContext::QtPrintContext): + (QtPrintContext::~QtPrintContext): + (QtPrintContext::pageCount): + (QtPrintContext::spoolPage): + * WebCoreSupport/QtPrintContext.h: Renamed from Source/WebCore/platform/qt/QStyleFacade.cpp. + (WebCore): + * WebCoreSupport/TextureMapperLayerClientQt.cpp: Added. + (TextureMapperLayerClientQt::TextureMapperLayerClientQt): + (TextureMapperLayerClientQt::~TextureMapperLayerClientQt): + (TextureMapperLayerClientQt::syncRootLayer): + (TextureMapperLayerClientQt::markForSync): + (TextureMapperLayerClientQt::rootLayer): + (TextureMapperLayerClientQt::setRootGraphicsLayer): + (TextureMapperLayerClientQt::syncLayers): + (TextureMapperLayerClientQt::renderCompositedLayers): + * WebCoreSupport/TextureMapperLayerClientQt.h: Added. + (WebCore): + (TextureMapperLayerClientQt): + * WebCoreSupport/UndoStepQt.h: + * WidgetApi/qgraphicswebview.cpp: Renamed from Source/WebKit/qt/Api/qgraphicswebview.cpp. + (QGraphicsWebViewPrivate): + (QGraphicsWebViewPrivate::QGraphicsWebViewPrivate): + (QGraphicsWebViewPrivate::overlay): + (QGraphicsWebViewPrivate::pageClient): + (QGraphicsWebViewPrivate::~QGraphicsWebViewPrivate): + (QGraphicsWebViewPrivate::_q_doLoadFinished): + (QGraphicsWebViewPrivate::_q_pageDestroyed): + (QGraphicsWebViewPrivate::updateResizesToContentsForPage): + (QGraphicsWebViewPrivate::_q_contentsSizeChanged): + (QGraphicsWebViewPrivate::_q_scaleChanged): + (QGraphicsWebView::QGraphicsWebView): + (QGraphicsWebView::~QGraphicsWebView): + (QGraphicsWebView::page): + (QGraphicsWebView::paint): + (QGraphicsWebView::sceneEvent): + (QGraphicsWebView::itemChange): + (QGraphicsWebView::sizeHint): + (QGraphicsWebView::inputMethodQuery): + (QGraphicsWebView::renderHints): + (QGraphicsWebView::setRenderHints): + (QGraphicsWebView::setRenderHint): + (QGraphicsWebView::event): + (QGraphicsWebViewPrivate::detachCurrentPage): + (QGraphicsWebView::setPage): + (QGraphicsWebView::setUrl): + (QGraphicsWebView::url): + (QGraphicsWebView::title): + (QGraphicsWebView::icon): + (QGraphicsWebView::setZoomFactor): + (QGraphicsWebView::zoomFactor): + (QGraphicsWebView::updateGeometry): + (QGraphicsWebView::setGeometry): + (QGraphicsWebView::stop): + (QGraphicsWebView::back): + (QGraphicsWebView::forward): + (QGraphicsWebView::reload): + (QGraphicsWebView::load): + (QGraphicsWebView::setHtml): + (QGraphicsWebView::setContent): + (QGraphicsWebView::history): + (QGraphicsWebView::isModified): + (QGraphicsWebView::settings): + (QGraphicsWebView::pageAction): + (QGraphicsWebView::triggerPageAction): + (QGraphicsWebView::findText): + (QGraphicsWebView::setResizesToContents): + (QGraphicsWebView::resizesToContents): + (QGraphicsWebView::isTiledBackingStoreFrozen): + (QGraphicsWebView::setTiledBackingStoreFrozen): + (QGraphicsWebView::hoverMoveEvent): + (QGraphicsWebView::hoverLeaveEvent): + (QGraphicsWebView::mouseMoveEvent): + (QGraphicsWebView::mousePressEvent): + (QGraphicsWebView::mouseReleaseEvent): + (QGraphicsWebView::mouseDoubleClickEvent): + (QGraphicsWebView::keyPressEvent): + (QGraphicsWebView::keyReleaseEvent): + (QGraphicsWebView::focusInEvent): + (QGraphicsWebView::focusOutEvent): + (QGraphicsWebView::focusNextPrevChild): + (QGraphicsWebView::dragEnterEvent): + (QGraphicsWebView::dragLeaveEvent): + (QGraphicsWebView::dragMoveEvent): + (QGraphicsWebView::dropEvent): + (QGraphicsWebView::contextMenuEvent): + (QGraphicsWebView::wheelEvent): + (QGraphicsWebView::inputMethodEvent): + * WidgetApi/qgraphicswebview.h: Renamed from Source/WebKit/qt/Api/qgraphicswebview.h. + * WidgetApi/qwebframe.cpp: Renamed from Source/WebKit/qt/Api/qwebframe.cpp. + (QWebFramePrivate::setPage): + (QWebFramePrivate::emitUrlChanged): + (QWebFramePrivate::didStartProvisionalLoad): + (QWebFramePrivate::didClearWindowObject): + (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::addToJavaScriptWindowObject): + (QWebFrame::toHtml): + (QWebFrame::toPlainText): + (QWebFrame::title): + (QWebFrame::metaData): + (QWebFrame::setUrl): + (QWebFrame::url): + (QWebFrame::requestedUrl): + (QWebFrame::baseUrl): + (QWebFrame::icon): + (QWebFrame::frameName): + (QWebFrame::page): + (QWebFrame::load): + (QWebFrame::setHtml): + (QWebFrame::setContent): + (QWebFrame::parentFrame): + (QWebFrame::childFrames): + (QWebFrame::scrollBarPolicy): + (QWebFrame::setScrollBarPolicy): + (QWebFrame::setScrollBarValue): + (QWebFrame::scrollBarValue): + (QWebFrame::scrollBarMaximum): + (QWebFrame::scrollBarMinimum): + (QWebFrame::scrollBarGeometry): + (QWebFrame::scroll): + (QWebFrame::scrollPosition): + (QWebFrame::setScrollPosition): + (QWebFrame::scrollToAnchor): + (QWebFrame::render): + (QWebFrame::setTextSizeMultiplier): + (QWebFrame::textSizeMultiplier): + (QWebFrame::setZoomFactor): + (QWebFrame::zoomFactor): + (QWebFrame::hasFocus): + (QWebFrame::setFocus): + (QWebFrame::pos): + (QWebFrame::geometry): + (QWebFrame::contentsSize): + (QWebFrame::documentElement): + (QWebFrame::findAllElements): + (QWebFrame::findFirstElement): + (QWebFrame::hitTestContent): + (QWebFrame::event): + (QWebFrame::print): + (QWebFrame::evaluateJavaScript): + (QWebFrame::securityOrigin): + (QWebFramePrivate::kit): + (QWebHitTestResult::QWebHitTestResult): + (QWebHitTestResult::operator=): + (QWebHitTestResult::~QWebHitTestResult): + (QWebHitTestResult::isNull): + (QWebHitTestResult::pos): + (QWebHitTestResult::boundingRect): + (QWebHitTestResult::enclosingBlockElement): + (QWebHitTestResult::title): + (QWebHitTestResult::linkText): + (QWebHitTestResult::linkUrl): + (QWebHitTestResult::linkTitle): + (QWebHitTestResult::linkElement): + (QWebHitTestResult::linkTargetFrame): + (QWebHitTestResult::alternateText): + (QWebHitTestResult::imageUrl): + (QWebHitTestResult::pixmap): + (QWebHitTestResult::isContentEditable): + (QWebHitTestResult::isContentSelected): + (QWebHitTestResult::element): + (QWebHitTestResult::frame): + (QWebFrame::handle): + * WidgetApi/qwebframe.h: Renamed from Source/WebKit/qt/Api/qwebframe.h. + (WebCore): + * WidgetApi/qwebframe_p.h: Added. + (WebCore): + (QWebFramePrivate): + (QWebFramePrivate::QWebFramePrivate): + (QWebFramePrivate::parentFrame): + * WidgetApi/qwebinspector.cpp: Renamed from Source/WebKit/qt/Api/qwebinspector.cpp. + (QWebInspector::QWebInspector): + (QWebInspector::~QWebInspector): + (QWebInspector::setPage): + (QWebInspector::page): + (QWebInspector::sizeHint): + (QWebInspector::event): + (QWebInspector::resizeEvent): + (QWebInspector::showEvent): + (QWebInspector::hideEvent): + (QWebInspector::closeEvent): + (QWebInspectorPrivate::setFrontend): + (QWebInspectorPrivate::adjustFrontendSize): + * WidgetApi/qwebinspector.h: Renamed from Source/WebKit/qt/Api/qwebinspector.h. + * WidgetApi/qwebinspector_p.h: Renamed from Source/WebKit/qt/Api/qwebinspector_p.h. + (QWebInspectorPrivate): + (QWebInspectorPrivate::QWebInspectorPrivate): + * WidgetApi/qwebpage.cpp: Renamed from Source/WebKit/qt/Api/qwebpage.cpp. + (QWebPagePrivate::QWebPagePrivate): + (QWebPagePrivate::~QWebPagePrivate): + (QWebPagePrivate::show): + (QWebPagePrivate::setFocus): + (QWebPagePrivate::unfocus): + (QWebPagePrivate::setWindowRect): + (QWebPagePrivate::viewportSize): + (QWebPagePrivate::createWindow): + (QWebPagePrivate::javaScriptConsoleMessage): + (QWebPagePrivate::javaScriptAlert): + (QWebPagePrivate::javaScriptConfirm): + (QWebPagePrivate::javaScriptPrompt): + (QWebPagePrivate::shouldInterruptJavaScript): + (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): + (webActionForAdapterMenuAction): + (adapterMenuActionForWebAction): + (createContextMenu): + (QWebPagePrivate::createAndSetCurrentContextMenu): + (QWebPagePrivate::_q_webActionTriggered): + (QWebPagePrivate::updateAction): + (QWebPagePrivate::updateNavigationActions): + (QWebPagePrivate::inspectorHandle): + (QWebPagePrivate::setInspectorFrontend): + (QWebPagePrivate::setInspectorWindowTitle): + (QWebPagePrivate::createWebInspector): + (iterateContextMenu): + (QWebPagePrivate::menuActionsAsText): + (QWebPagePrivate::emitViewportChangeRequested): + (QWebPagePrivate::updateEditorActions): + (QWebPagePrivate::timerEvent): + (QWebPagePrivate::requestSoftwareInputPanel): + (QWebPagePrivate::contextMenuEvent): + (QWebPage::createStandardContextMenu): + (QWebPagePrivate::editorActionForKeyEvent): + (QWebPagePrivate::keyPressEvent): + (QWebPagePrivate::keyReleaseEvent): + (QWebPagePrivate::dragEnterEvent): + (QWebPagePrivate::dragMoveEvent): + (QWebPagePrivate::dropEvent): + (QWebPagePrivate::leaveEvent): + (QWebPage::setPalette): + (QWebPage::palette): + (QWebPagePrivate::shortcutOverrideEvent): + (QWebPagePrivate::gestureEvent): + (QWebPage::inputMethodQuery): + (QWebPagePrivate::setInspector): + (QWebPagePrivate::getOrCreateInspector): + (QWebPage::ViewportAttributes::ViewportAttributes): + (QWebPage::ViewportAttributes::~ViewportAttributes): + (QWebPage::ViewportAttributes::operator=): + (QWebPage::QWebPage): + (QWebPage::~QWebPage): + (QWebPage::mainFrame): + (QWebPage::currentFrame): + (QWebPage::frameAt): + (QWebPage::history): + (QWebPage::setView): + (QWebPage::view): + (QWebPage::javaScriptConsoleMessage): + (QWebPage::javaScriptAlert): + (QWebPage::javaScriptConfirm): + (QWebPage::javaScriptPrompt): + (QWebPage::shouldInterruptJavaScript): + (QWebPage::setFeaturePermission): + (QWebPage::createWindow): + (QWebPage::createPlugin): + (QWebPage::supportedContentTypes): + (QWebPage::supportsContentType): + (collectChildFrames): + (QWebPage::triggerAction): + (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): + (getintenv): + (queryDeviceSizeForScreenContainingWidget): + (QWebPage::viewportAttributesForSize): + (QWebPage::preferredContentsSize): + (QWebPage::setPreferredContentsSize): + (QWebPage::setActualVisibleContentRect): + (QWebPage::acceptNavigationRequest): + (QWebPage::hasSelection): + (QWebPage::selectedText): + (QWebPage::selectedHtml): + (QWebPage::action): + (QWebPage::isModified): + (QWebPage::undoStack): + (QWebPage::event): + (QWebPage::focusNextPrevChild): + (QWebPage::setContentEditable): + (QWebPage::isContentEditable): + (QWebPage::setForwardUnsupportedContent): + (QWebPage::forwardUnsupportedContent): + (QWebPage::setLinkDelegationPolicy): + (QWebPage::linkDelegationPolicy): + (QWebPagePrivate::handleScrollbarContextMenuEvent): + (QWebPage::swallowContextMenuEvent): + (QWebPage::updatePositionDependentActions): + (QWebPage::extension): + (QWebPage::supportsExtension): + (QWebPage::handle): + (QWebPage::findText): + (QWebPage::settings): + (QWebPage::chooseFile): + (QWebPage::setNetworkAccessManager): + (QWebPage::networkAccessManager): + (QWebPage::setPluginFactory): + (QWebPage::pluginFactory): + (QWebPage::userAgentForUrl): + (QWebPage::totalBytes): + (QWebPage::bytesReceived): + * WidgetApi/qwebpage.h: Renamed from Source/WebKit/qt/Api/qwebpage.h. + (WebCore): + * WidgetApi/qwebpage_p.h: Renamed from Source/WebKit/qt/Api/qwebpage_p.h. + (WebCore): + (QtViewportAttributesPrivate): + (QtViewportAttributesPrivate::QtViewportAttributesPrivate): + (QWebPagePrivate): + * WidgetApi/qwebview.cpp: Renamed from Source/WebKit/qt/Api/qwebview.cpp. + (QWebViewPrivate): + (QWebViewPrivate::QWebViewPrivate): + (QWebViewPrivate::~QWebViewPrivate): + (QWebViewPrivate::_q_pageDestroyed): + (accessibleInterfaceFactory): + (QWebView::QWebView): + (QWebView::~QWebView): + (QWebView::page): + (QWebViewPrivate::detachCurrentPage): + (QWebView::setPage): + (QWebView::load): + (QWebView::setHtml): + (QWebView::setContent): + (QWebView::history): + (QWebView::settings): + (QWebView::title): + (QWebView::setUrl): + (QWebView::url): + (QWebView::icon): + (QWebView::hasSelection): + (QWebView::selectedText): + (QWebView::selectedHtml): + (QWebView::pageAction): + (QWebView::triggerPageAction): + (QWebView::isModified): + (QWebView::sizeHint): + (QWebView::setZoomFactor): + (QWebView::zoomFactor): + (QWebView::setTextSizeMultiplier): + (QWebView::textSizeMultiplier): + (QWebView::renderHints): + (QWebView::setRenderHints): + (QWebView::setRenderHint): + (QWebView::findText): + (QWebView::event): + (QWebView::print): + (QWebView::stop): + (QWebView::back): + (QWebView::forward): + (QWebView::reload): + (QWebView::resizeEvent): + (QWebView::paintEvent): + (QWebView::createWindow): + (QWebView::mouseMoveEvent): + (QWebView::mousePressEvent): + (QWebView::mouseDoubleClickEvent): + (QWebView::mouseReleaseEvent): + (QWebView::contextMenuEvent): + (QWebView::wheelEvent): + (QWebView::keyPressEvent): + (QWebView::keyReleaseEvent): + (QWebView::focusInEvent): + (QWebView::focusOutEvent): + (QWebView::dragEnterEvent): + (QWebView::dragLeaveEvent): + (QWebView::dragMoveEvent): + (QWebView::dropEvent): + (QWebView::focusNextPrevChild): + (QWebView::inputMethodQuery): + (QWebView::inputMethodEvent): + (QWebView::changeEvent): + * WidgetApi/qwebview.h: Renamed from Source/WebKit/qt/Api/qwebview.h. + * WidgetApi/qwebviewaccessible.cpp: Renamed from Source/WebKit/qt/Api/qwebviewaccessible.cpp. + (QWebFrameAccessible::QWebFrameAccessible): + (QWebFrameAccessible::frame): + (QWebFrameAccessible::parent): + (QWebFrameAccessible::text): + (QWebFrameAccessible::childCount): + (QWebFrameAccessible::child): + (QWebFrameAccessible::indexOfChild): + (QWebFrameAccessible::state): + (QWebFrameAccessible::role): + (QWebFrameAccessible::navigate): + (QWebPageAccessible::QWebPageAccessible): + (QWebPageAccessible::page): + (QWebPageAccessible::text): + (QWebPageAccessible::parent): + (QWebPageAccessible::child): + (QWebPageAccessible::childCount): + (QWebPageAccessible::indexOfChild): + (QWebPageAccessible::navigate): + (QWebPageAccessible::role): + (QWebPageAccessible::state): + (QWebViewAccessible::QWebViewAccessible): + (QWebViewAccessible::view): + (QWebViewAccessible::childCount): + (QWebViewAccessible::child): + * WidgetApi/qwebviewaccessible_p.h: Renamed from Source/WebKit/qt/Api/qwebviewaccessible_p.h. + (QWebFrameAccessible): + (QWebPageAccessible): + (QWebViewAccessible): + * WidgetSupport/DefaultFullScreenVideoHandler.cpp: Renamed from Source/WebKit/qt/WebCoreSupport/DefaultFullScreenVideoHandler.cpp. + (DefaultFullScreenVideoHandler::DefaultFullScreenVideoHandler): + (DefaultFullScreenVideoHandler::~DefaultFullScreenVideoHandler): + (DefaultFullScreenVideoHandler::requiresFullScreenForVideoPlayback): + (DefaultFullScreenVideoHandler::enterFullScreen): + (DefaultFullScreenVideoHandler::exitFullScreen): + * WidgetSupport/DefaultFullScreenVideoHandler.h: Renamed from Source/WebKit/qt/WebCoreSupport/DefaultFullScreenVideoHandler.h. + (WebKit): + (DefaultFullScreenVideoHandler): + * WidgetSupport/FullScreenVideoWidget.cpp: Renamed from Source/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.cpp. + (WebKit): + (WebKit::FullScreenVideoWidget::FullScreenVideoWidget): + (WebKit::FullScreenVideoWidget::~FullScreenVideoWidget): + (WebKit::FullScreenVideoWidget::show): + (WebKit::FullScreenVideoWidget::closeEvent): + (WebKit::FullScreenVideoWidget::event): + (WebKit::FullScreenVideoWidget::keyPressEvent): + (WebKit::FullScreenVideoWidget::hideCursor): + (WebKit::FullScreenVideoWidget::showCursor): + * WidgetSupport/FullScreenVideoWidget.h: Renamed from Source/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.h. + (WebKit): + (FullScreenVideoWidget): + * WidgetSupport/InitWebKitQt.cpp: Renamed from Source/WebKit/qt/WebCoreSupport/InitWebKitQt.cpp. + (WebKit): + (WebKit::initializeWebKitWidgets): + * WidgetSupport/InitWebKitQt.h: Renamed from Source/WebKit/qt/WebCoreSupport/InitWebKitQt.h. + (WebKit): + * WidgetSupport/InspectorClientWebPage.cpp: Renamed from Source/WebKit/qt/WebCoreSupport/InspectorClientWebPage.cpp. + (InspectorClientWebPage::InspectorClientWebPage): + (InspectorClientWebPage::createWindow): + (InspectorClientWebPage::javaScriptWindowObjectCleared): + * WidgetSupport/InspectorClientWebPage.h: Renamed from Source/WebKit/qt/WebCoreSupport/InspectorClientWebPage.h. + (WebKit): + (InspectorClientWebPage): + * WidgetSupport/PageClientQt.cpp: Renamed from Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp. + (QWebPageClient::ownerWindow): + (WebCore): + (WebCore::PageClientQWidget::scroll): + (WebCore::PageClientQWidget::update): + (WebCore::PageClientQWidget::repaintViewport): + (WebCore::PageClientQWidget::setInputMethodEnabled): + (WebCore::PageClientQWidget::inputMethodEnabled): + (WebCore::PageClientQWidget::setInputMethodHints): + (WebCore::PageClientQWidget::~PageClientQWidget): + (WebCore::PageClientQWidget::cursor): + (WebCore::PageClientQWidget::updateCursor): + (WebCore::PageClientQWidget::palette): + (WebCore::PageClientQWidget::screenNumber): + (WebCore::PageClientQWidget::ownerWidget): + (WebCore::PageClientQWidget::geometryRelativeToOwnerWidget): + (WebCore::PageClientQWidget::pluginParent): + (WebCore::PageClientQWidget::style): + (WebCore::PageClientQWidget::windowRect): + (WebCore::PageClientQWidget::setWidgetVisible): + (WebCore::PageClientQGraphicsWidget::~PageClientQGraphicsWidget): + (WebCore::PageClientQGraphicsWidget::scroll): + (WebCore::PageClientQGraphicsWidget::update): + (WebCore::PageClientQGraphicsWidget::repaintViewport): + (WebCore::PageClientQGraphicsWidget::makeOpenGLContextCurrentIfAvailable): + (WebCore::PageClientQGraphicsWidget::setInputMethodEnabled): + (WebCore::PageClientQGraphicsWidget::inputMethodEnabled): + (WebCore::PageClientQGraphicsWidget::setInputMethodHints): + (WebCore::PageClientQGraphicsWidget::cursor): + (WebCore::PageClientQGraphicsWidget::updateCursor): + (WebCore::PageClientQGraphicsWidget::palette): + (WebCore::PageClientQGraphicsWidget::screenNumber): + (WebCore::PageClientQGraphicsWidget::ownerWidget): + (WebCore::PageClientQGraphicsWidget::geometryRelativeToOwnerWidget): + (WebCore::PageClientQGraphicsWidget::graphicsItemVisibleRect): + (WebCore::PageClientQGraphicsWidget::pluginParent): + (WebCore::PageClientQGraphicsWidget::style): + (WebCore::PageClientQGraphicsWidget::setWidgetVisible): + (WebCore::PageClientQGraphicsWidget::windowRect): + * WidgetSupport/PageClientQt.h: Renamed from Source/WebKit/qt/WebCoreSupport/PageClientQt.h. + (WebCore): + (PageClientQWidget): + (WebCore::PageClientQWidget::PageClientQWidget): + (WebCore::PageClientQWidget::isQWidgetClient): + (WebCore::PageClientQWidget::viewResizesToContentsEnabled): + (QGraphicsItemOverlay): + (WebCore::QGraphicsItemOverlay::QGraphicsItemOverlay): + (WebCore::QGraphicsItemOverlay::boundingRect): + (WebCore::QGraphicsItemOverlay::paint): + (WebCore::QGraphicsItemOverlay::prepareGraphicsItemGeometryChange): + (PageClientQGraphicsWidget): + (WebCore::PageClientQGraphicsWidget::PageClientQGraphicsWidget): + (WebCore::PageClientQGraphicsWidget::isQWidgetClient): + (WebCore::PageClientQGraphicsWidget::viewResizesToContentsEnabled): + * WidgetSupport/QGraphicsWidgetPluginImpl.cpp: Renamed from Source/WebKit/qt/WebCoreSupport/QGraphicsWidgetPluginImpl.cpp. + (QGraphicsWidgetPluginImpl::~QGraphicsWidgetPluginImpl): + (QGraphicsWidgetPluginImpl::update): + (QGraphicsWidgetPluginImpl::setGeometryAndClip): + (QGraphicsWidgetPluginImpl::setVisible): + (QGraphicsWidgetPluginImpl::setWidgetParent): + (QGraphicsWidgetPluginImpl::handle): + * WidgetSupport/QGraphicsWidgetPluginImpl.h: Renamed from Source/WebKit/qt/WebCoreSupport/QGraphicsWidgetPluginImpl.h. + (QGraphicsWidgetPluginImpl): + (QGraphicsWidgetPluginImpl::QGraphicsWidgetPluginImpl): + * WidgetSupport/QStyleFacadeImp.cpp: Renamed from Source/WebKit/qt/WebCoreSupport/QStyleFacadeImp.cpp. + (WebKit): + (WebKit::convertToQStyleState): + (WebKit::convertToQStyleSubControl): + (WebKit::initGenericStyleOption): + (WebKit::initSpecificStyleOption): + (MappedStyleOption): + (WebKit::MappedStyleOption::MappedStyleOption): + (WebKit::convertPixelMetric): + (WebKit::convertToQStyleFacadeSubControl): + (WebKit::QStyleFacadeImp::QStyleFacadeImp): + (WebKit::QStyleFacadeImp::~QStyleFacadeImp): + (WebKit::QStyleFacadeImp::buttonSubElementRect): + (WebKit::QStyleFacadeImp::findFrameLineWidth): + (WebKit::QStyleFacadeImp::simplePixelMetric): + (WebKit::QStyleFacadeImp::buttonMargin): + (WebKit::QStyleFacadeImp::sliderLength): + (WebKit::QStyleFacadeImp::sliderThickness): + (WebKit::QStyleFacadeImp::progressBarChunkWidth): + (WebKit::QStyleFacadeImp::getButtonMetrics): + (WebKit::QStyleFacadeImp::comboBoxSizeFromContents): + (WebKit::QStyleFacadeImp::pushButtonSizeFromContents): + (WebKit::QStyleFacadeImp::paintButton): + (WebKit::QStyleFacadeImp::paintTextField): + (WebKit::QStyleFacadeImp::paintComboBox): + (WebKit::QStyleFacadeImp::paintComboBoxArrow): + (WebKit::QStyleFacadeImp::paintSliderTrack): + (WebKit::QStyleFacadeImp::paintSliderThumb): + (WebKit::QStyleFacadeImp::paintInnerSpinButton): + (WebKit::QStyleFacadeImp::paintProgressBar): + (WebKit::QStyleFacadeImp::scrollBarExtent): + (WebKit::QStyleFacadeImp::scrollBarMiddleClickAbsolutePositionStyleHint): + (WebKit::QStyleFacadeImp::paintScrollCorner): + (WebKit::QStyleFacadeImp::hitTestScrollBar): + (WebKit::QStyleFacadeImp::scrollBarSubControlRect): + (WebKit::QStyleFacadeImp::paintScrollBar): + (WebKit::QStyleFacadeImp::widgetForPainter): + (WebKit::QStyleFacadeImp::style): + * WidgetSupport/QStyleFacadeImp.h: Renamed from Source/WebKit/qt/WebCoreSupport/QStyleFacadeImp.h. + (WebKit): + (QStyleFacadeImp): + (WebKit::QStyleFacadeImp::create): + (WebKit::QStyleFacadeImp::isValid): + * WidgetSupport/QWebUndoCommand.cpp: Renamed from Source/WebKit/qt/WebCoreSupport/QWebUndoCommand.cpp. + (QWebUndoCommand::QWebUndoCommand): + (QWebUndoCommand::undo): + (QWebUndoCommand::redo): + * WidgetSupport/QWebUndoCommand.h: Renamed from Source/WebKit/qt/WebCoreSupport/QWebUndoCommand.h. + (QWebUndoCommand): + * WidgetSupport/QWidgetPluginImpl.cpp: Renamed from Source/WebKit/qt/WebCoreSupport/QWidgetPluginImpl.cpp. + (QWidgetPluginImpl::~QWidgetPluginImpl): + (QWidgetPluginImpl::update): + (QWidgetPluginImpl::setGeometryAndClip): + (QWidgetPluginImpl::setVisible): + (QWidgetPluginImpl::setStyleSheet): + (QWidgetPluginImpl::setWidgetParent): + (QWidgetPluginImpl::handle): + * WidgetSupport/QWidgetPluginImpl.h: Renamed from Source/WebKit/qt/WebCoreSupport/QWidgetPluginImpl.h. + (QWidgetPluginImpl): + (QWidgetPluginImpl::QWidgetPluginImpl): + * WidgetSupport/QtFallbackWebPopup.cpp: Renamed from Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp. + (WebCore): + (WebCore::QtFallbackWebPopup::QtFallbackWebPopup): + (WebCore::QtFallbackWebPopup::~QtFallbackWebPopup): + (WebCore::QtFallbackWebPopup::show): + (WebCore::QtFallbackWebPopup::hide): + (WebCore::QtFallbackWebPopup::populate): + (WebCore::QtFallbackWebPopup::activeChanged): + (WebCore::QtFallbackWebPopup::deleteComboBox): + (WebCore::QtFallbackWebPopup::pageClient): + * WidgetSupport/QtFallbackWebPopup.h: Renamed from Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h. + (WebCore): + (QtFallbackWebPopup): + (WebCore::QtFallbackWebPopup::setGeometry): + (WebCore::QtFallbackWebPopup::geometry): + (WebCore::QtFallbackWebPopup::setFont): + (WebCore::QtFallbackWebPopup::font): + * WidgetSupport/QtWebComboBox.cpp: Renamed from Source/WebKit/qt/WebCoreSupport/QtWebComboBox.cpp. + (WebCore): + (WebCore::QtWebComboBox::QtWebComboBox): + (WebCore::QtWebComboBox::showPopupAtCursorPosition): + (WebCore::QtWebComboBox::eventFilter): + * WidgetSupport/QtWebComboBox.h: Renamed from Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h. + (WebCore): + (QtWebComboBox): + * declarative/experimental/experimental.pri: + * declarative/public.pri: + * tests/qwebview/tst_qwebview.cpp: + +2012-11-30 Zeno Albisser <zeno@webkit.org> + + [Qt] Enable WebGL by default. + https://bugs.webkit.org/show_bug.cgi?id=103731 + + Reviewed by Simon Hausmann. + + * Api/qwebsettings.cpp: + (QWebSettings::QWebSettings): + +2012-11-30 Mihai Maerean <mmaerean@adobe.com> + + [CSSRegions] when WebKit uses V8, there should be a single variable to store if the CSS Regions feature is enabled + https://bugs.webkit.org/show_bug.cgi?id=101192 + + Reviewed by Hajime Morita. + + Removed the CSS Regions flag in Settings and switched to using the new flag I have added in RuntimeEnabledFeatures. + + Tests: No new tests because there is no functional change. + + * Api/qwebsettings.cpp: + (QWebSettingsPrivate::apply): + +2012-11-29 Alexey Proskuryakov <ap@apple.com> + + [WK2] Forward cookie jar calls to NetworkProcess + https://bugs.webkit.org/show_bug.cgi?id=103457 + + Reviewed by Darin Adler. + + * WebCoreSupport/PlatformStrategiesQt.cpp: + (PlatformStrategiesQt::cookiesForDOM): + (PlatformStrategiesQt::setCookiesFromDOM): + (PlatformStrategiesQt::cookiesEnabled): + (PlatformStrategiesQt::cookieRequestHeaderFieldValue): + (PlatformStrategiesQt::getRawCookies): + (PlatformStrategiesQt::deleteCookie): + (PlatformStrategiesQt::getHostnamesWithCookies): + (PlatformStrategiesQt::deleteCookiesForHostname): + (PlatformStrategiesQt::deleteAllCookies): + 2012-11-28 Huang Dongsung <luxtella@company100.net> [Texmap] REGRESSION(r135620) QtTestBrowser crashes on Google-gravity. diff --git a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp index 05f7b949d..71b45d6dd 100644 --- a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp @@ -60,6 +60,7 @@ #include "ScrollbarTheme.h" #include "SearchPopupMenuQt.h" #include "SecurityOrigin.h" +#include "TextureMapperLayerClientQt.h" #include "TiledBackingStore.h" #include "ViewportArguments.h" #include "WindowFeatures.h" @@ -165,7 +166,11 @@ bool ChromeClientQt::allowsAcceleratedCompositing() const { if (!platformPageClient()) return false; - return platformPageClient()->allowsAcceleratedCompositing(); +#if USE(ACCELERATED_COMPOSITING) + return true; +#else + return false; +#endif } FloatRect ChromeClientQt::pageRect() @@ -456,7 +461,8 @@ void ChromeClientQt::scroll(const IntSize& delta, const IntRect& scrollViewRect, void ChromeClientQt::delegatedScrollRequested(const IntPoint& point) { - IntSize currentPosition = m_webPage->mainFrameAdapter()->scrollPosition(); + const QPoint ofs = m_webPage->mainFrameAdapter()->scrollPosition(); + IntSize currentPosition(ofs.x(), ofs.y()); int x = point.x() - currentPosition.width(); int y = point.y() - currentPosition.height(); const QRect rect(QPoint(0, 0), m_webPage->viewportSize()); @@ -626,27 +632,28 @@ void ChromeClientQt::serviceScriptedAnimations() #if USE(ACCELERATED_COMPOSITING) void ChromeClientQt::attachRootGraphicsLayer(Frame* frame, GraphicsLayer* graphicsLayer) { - if (platformPageClient()) - platformPageClient()->setRootGraphicsLayer(graphicsLayer); + if (!m_textureMapperLayerClient) + m_textureMapperLayerClient = adoptPtr(new TextureMapperLayerClientQt(m_webPage->mainFrameAdapter())); + m_textureMapperLayerClient->setRootGraphicsLayer(graphicsLayer); } void ChromeClientQt::setNeedsOneShotDrawingSynchronization() { // we want the layers to synchronize next time we update the screen anyway - if (platformPageClient()) - platformPageClient()->markForSync(false); + if (m_textureMapperLayerClient) + m_textureMapperLayerClient->markForSync(false); } void ChromeClientQt::scheduleCompositingLayerFlush() { // we want the layers to synchronize ASAP - if (platformPageClient()) - platformPageClient()->markForSync(true); + if (m_textureMapperLayerClient) + m_textureMapperLayerClient->markForSync(true); } ChromeClient::CompositingTriggerFlags ChromeClientQt::allowedCompositingTriggers() const { - if (platformPageClient() && platformPageClient()->allowsAcceleratedCompositing()) + if (allowsAcceleratedCompositing()) return ThreeDTransformTrigger | VideoTrigger | CanvasTrigger | AnimationTrigger; return 0; @@ -661,7 +668,8 @@ IntRect ChromeClientQt::visibleRectForTiledBackingStore() const return IntRect(); if (!platformPageClient()->viewResizesToContentsEnabled()) { - IntSize offset = m_webPage->mainFrameAdapter()->scrollPosition(); + const QPoint ofs = m_webPage->mainFrameAdapter()->scrollPosition(); + IntSize offset(ofs.x(), ofs.y()); return QRect(QPoint(offset.width(), offset.height()), m_webPage->mainFrameAdapter()->frameRect().size()); } diff --git a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h index 96d8625c0..122b408fb 100644 --- a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h +++ b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h @@ -58,6 +58,7 @@ struct ViewportArguments; #if ENABLE(VIDEO) class FullScreenVideoQt; #endif +class TextureMapperLayerClientQt; class ChromeClientQt : public ChromeClient { public: @@ -222,6 +223,10 @@ public: static bool dumpVisitedLinksCallbacks; mutable QtPlatformPlugin m_platformPlugin; + +#if USE(ACCELERATED_COMPOSITING) + OwnPtr<TextureMapperLayerClientQt> m_textureMapperLayerClient; +#endif }; } diff --git a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp index 9a3be3523..5ceacd6bc 100644 --- a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp @@ -1048,3 +1048,11 @@ void DumpRenderTreeSupportQt::getTrackedRepaintRects(QWebFrameAdapter* adapter, for (size_t i = 0; i < rects.size(); ++i) result.append(rects[i]); } + +QString DumpRenderTreeSupportQt::frameRenderTreeDump(QWebFrameAdapter* adapter) +{ + if (adapter->frame->view() && adapter->frame->view()->layoutPending()) + adapter->frame->view()->layout(); + + return externalRepresentation(adapter->frame); +} diff --git a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h index 72505b8d3..d06a6b505 100644 --- a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h +++ b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h @@ -213,6 +213,8 @@ public: static void setTrackRepaintRects(QWebFrameAdapter*, bool enable); static bool trackRepaintRects(QWebFrameAdapter*); static void getTrackedRepaintRects(QWebFrameAdapter*, QVector<QRect>& result); + + static QString frameRenderTreeDump(QWebFrameAdapter*); }; #endif diff --git a/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp b/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp index d2f75ec18..60dcdbe94 100644 --- a/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp @@ -30,10 +30,12 @@ #include "config.h" #include "InitWebCoreQt.h" +#include "Chrome.h" +#include "ChromeClientQt.h" #include "Image.h" #include "NotImplemented.h" +#include "Page.h" #include "PlatformStrategiesQt.h" -#include "QStyleFacadeImp.h" #include "RenderThemeQStyle.h" #include "ScriptController.h" #include "ScrollbarThemeQStyle.h" @@ -48,18 +50,26 @@ namespace WebKit { -static QtStyleFactoryFunction initCallback = 0; +static QtStyleFacadeFactoryFunction initCallback = 0; -void setWebKitWidgetsInitCallback(QtStyleFactoryFunction callback) +Q_DECL_EXPORT void setWebKitWidgetsInitCallback(QtStyleFacadeFactoryFunction callback) { initCallback = callback; } +static WebCore::QStyleFacade* createStyleForPage(WebCore::Page* page) +{ + QWebPageAdapter* pageAdapter = 0; + if (page) + pageAdapter = static_cast<WebCore::ChromeClientQt*>(page->chrome()->client())->m_webPage; + return initCallback(pageAdapter); +} + // Called also from WebKit2's WebProcess Q_DECL_EXPORT void initializeWebKitQt() { if (initCallback) { - WebCore::RenderThemeQStyle::setStyleFactoryFunction(initCallback); + WebCore::RenderThemeQStyle::setStyleFactoryFunction(createStyleForPage); WebCore::RenderThemeQt::setCustomTheme(WebCore::RenderThemeQStyle::create, new WebCore::ScrollbarThemeQStyle); } } diff --git a/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.h b/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.h index 7e1b0b7a2..591399993 100644 --- a/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.h +++ b/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.h @@ -36,11 +36,13 @@ namespace WebCore { class Page; class QStyleFacade; } -typedef WebCore::QStyleFacade* (*QtStyleFactoryFunction)(WebCore::Page*); +class QWebPageAdapter; + +typedef WebCore::QStyleFacade* (*QtStyleFacadeFactoryFunction)(QWebPageAdapter*); namespace WebKit { -void setWebKitWidgetsInitCallback(QtStyleFactoryFunction); +Q_DECL_EXPORT void setWebKitWidgetsInitCallback(QtStyleFacadeFactoryFunction); Q_DECL_EXPORT void initializeWebKitQt(); Q_DECL_EXPORT void setImagePlatformResource(const char* /* name */, const QPixmap&); diff --git a/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp b/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp index abf9c3f78..15a3daf39 100644 --- a/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp @@ -363,3 +363,5 @@ void InspectorServerRequestHandlerQt::webSocketReadyRead() } } + +#include "moc_InspectorServerQt.cpp" diff --git a/Source/WebKit/qt/WebCoreSupport/PlatformStrategiesQt.cpp b/Source/WebKit/qt/WebCoreSupport/PlatformStrategiesQt.cpp index 5d9e755d0..07e84606e 100644 --- a/Source/WebKit/qt/WebCoreSupport/PlatformStrategiesQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/PlatformStrategiesQt.cpp @@ -40,6 +40,7 @@ #include <NotImplemented.h> #include <Page.h> #include <PageGroup.h> +#include <PlatformCookieJar.h> #include <PluginDatabase.h> #include <QCoreApplication> #include <QLocale> @@ -93,6 +94,51 @@ void PlatformStrategiesQt::notifyCookiesChanged() { } +String PlatformStrategiesQt::cookiesForDOM(NetworkingContext* context, const KURL& firstParty, const KURL& url) +{ + return WebCore::cookiesForDOM(context, firstParty, url); +} + +void PlatformStrategiesQt::setCookiesFromDOM(NetworkingContext* context, const KURL& firstParty, const KURL& url, const String& cookieString) +{ + WebCore::setCookiesFromDOM(context, firstParty, url, cookieString); +} + +bool PlatformStrategiesQt::cookiesEnabled(NetworkingContext* context, const KURL& firstParty, const KURL& url) +{ + return WebCore::cookiesEnabled(context, firstParty, url); +} + +String PlatformStrategiesQt::cookieRequestHeaderFieldValue(NetworkingContext* context, const KURL& firstParty, const KURL& url) +{ + return WebCore::cookieRequestHeaderFieldValue(context, firstParty, url); +} + +bool PlatformStrategiesQt::getRawCookies(NetworkingContext* context, const KURL& firstParty, const KURL& url, Vector<Cookie>& rawCookies) +{ + return WebCore::getRawCookies(context, firstParty, url, rawCookies); +} + +void PlatformStrategiesQt::deleteCookie(NetworkingContext* context, const KURL& url, const String& cookieName) +{ + WebCore::deleteCookie(context, url, cookieName); +} + +void PlatformStrategiesQt::getHostnamesWithCookies(NetworkingContext* context, HashSet<String>& hostnames) +{ + WebCore::getHostnamesWithCookies(context, hostnames); +} + +void PlatformStrategiesQt::deleteCookiesForHostname(NetworkingContext* context, const String& hostname) +{ + WebCore::deleteCookiesForHostname(context, hostname); +} + +void PlatformStrategiesQt::deleteAllCookies(NetworkingContext* context) +{ + WebCore::deleteAllCookies(context); +} + void PlatformStrategiesQt::refreshPlugins() { PluginDatabase::installedPlugins()->refresh(); diff --git a/Source/WebKit/qt/WebCoreSupport/PlatformStrategiesQt.h b/Source/WebKit/qt/WebCoreSupport/PlatformStrategiesQt.h index 2fe8fe62c..7ba16cf72 100644 --- a/Source/WebKit/qt/WebCoreSupport/PlatformStrategiesQt.h +++ b/Source/WebKit/qt/WebCoreSupport/PlatformStrategiesQt.h @@ -56,6 +56,15 @@ private: // WebCore::CookiesStrategy virtual void notifyCookiesChanged(); + virtual String cookiesForDOM(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&); + virtual void setCookiesFromDOM(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&, const String&); + virtual bool cookiesEnabled(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&); + virtual String cookieRequestHeaderFieldValue(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&); + virtual bool getRawCookies(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&, Vector<WebCore::Cookie>&); + virtual void deleteCookie(WebCore::NetworkingContext*, const WebCore::KURL&, const String&); + virtual void getHostnamesWithCookies(WebCore::NetworkingContext*, HashSet<String>& hostnames); + virtual void deleteCookiesForHostname(WebCore::NetworkingContext*, const String& hostname); + virtual void deleteAllCookies(WebCore::NetworkingContext*); // WebCore::PluginStrategy virtual void refreshPlugins(); diff --git a/Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.cpp b/Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.cpp index 380b74954..119da1de4 100644 --- a/Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.cpp +++ b/Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.cpp @@ -21,15 +21,44 @@ #include "config.h" #include "QWebFrameAdapter.h" +#include "APICast.h" +#include "Chrome.h" +#include "ChromeClientQt.h" +#include "DocumentLoader.h" +#include "FocusController.h" #include "Frame.h" #include "FrameLoadRequest.h" #include "FrameLoaderClientQt.h" +#include "FrameView.h" +#include "HTMLMetaElement.h" +#include "HTTPParsers.h" +#include "HitTestResult.h" +#include "InspectorController.h" +#include "JSDOMWindowBase.h" +#include "KURL.h" +#include "NavigationScheduler.h" +#include "NodeList.h" +#include "Page.h" #include "QWebPageAdapter.h" +#include "RenderObject.h" +#include "ScriptSourceCode.h" +#include "ScriptValue.h" +#include "SubstituteData.h" +#include "TextureMapperLayerClientQt.h" +#include "TiledBackingStore.h" #if ENABLE(GESTURE_EVENTS) #include "PlatformGestureEvent.h" #include "WebEventConversion.h" #endif +#include "htmlediting.h" +#include "markup.h" +#include "qt_runtime.h" +#include "qwebsecurityorigin.h" +#include "qwebsecurityorigin_p.h" +#include "qwebsettings.h" +#include <IntRect.h> +#include <IntSize.h> #include <QFileInfo> #include <QNetworkRequest> @@ -72,6 +101,8 @@ QWebFrameAdapter::QWebFrameAdapter() , allowsScrolling(true) , marginWidth(-1) , marginHeight(-1) + , horizontalScrollBarPolicy(Qt::ScrollBarAsNeeded) + , verticalScrollBarPolicy(Qt::ScrollBarAsNeeded) , frame(0) , frameLoaderClient(0) { @@ -139,10 +170,15 @@ void QWebFrameAdapter::load(const QNetworkRequest& req, QNetworkAccessManager::O pageAdapter->insideOpenCall = false; } +bool QWebFrameAdapter::hasView() const +{ + return frame && frame->view(); +} + #if ENABLE(GESTURE_EVENTS) void QWebFrameAdapter::handleGestureEvent(QGestureEventFacade* gestureEvent) { - ASSERT(hasView()); + ASSERT(frame && frame->view()); switch (gestureEvent->type) { case Qt::TapGesture: frame->eventHandler()->handleGestureEvent(convertGesture(gestureEvent)); @@ -156,18 +192,145 @@ void QWebFrameAdapter::handleGestureEvent(QGestureEventFacade* gestureEvent) } #endif -WebCore::IntSize QWebFrameAdapter::scrollPosition() const +QVariant QWebFrameAdapter::evaluateJavaScript(const QString &scriptSource) +{ + ScriptController* proxy = frame->script(); + QVariant rc; + if (proxy) { + int distance = 0; + JSC::JSValue v = frame->script()->executeScript(ScriptSourceCode(scriptSource)).jsValue(); + JSC::ExecState* exec = proxy->globalObject(mainThreadNormalWorld())->globalExec(); + JSValueRef* ignoredException = 0; + rc = JSC::Bindings::convertValueToQVariant(toRef(exec), toRef(exec, v), QMetaType::Void, &distance, ignoredException); + } + return rc; +} + +void QWebFrameAdapter::addToJavaScriptWindowObject(const QString& name, QObject* object, ValueOwnership ownership) +{ + if (!pageAdapter->settings->testAttribute(QWebSettings::JavascriptEnabled)) + return; + JSC::Bindings::QtInstance::ValueOwnership valueOwnership = static_cast<JSC::Bindings::QtInstance::ValueOwnership>(ownership); + JSDOMWindow* window = toJSDOMWindow(frame, mainThreadNormalWorld()); + JSC::Bindings::RootObject* root; + if (valueOwnership == JSC::Bindings::QtInstance::QtOwnership) + root = frame->script()->cacheableBindingRootObject(); + else + root = frame->script()->bindingRootObject(); + + if (!window) { + qDebug() << "Warning: couldn't get window object"; + return; + } + if (!root) { + qDebug() << "Warning: couldn't get root object"; + return; + } + + JSC::ExecState* exec = window->globalExec(); + JSC::JSLockHolder lock(exec); + + JSC::JSObject* runtimeObject = JSC::Bindings::QtInstance::getQtInstance(object, root, valueOwnership)->createRuntimeObject(exec); + + JSC::PutPropertySlot slot; + window->methodTable()->put(window, exec, JSC::Identifier(&exec->globalData(), reinterpret_cast_ptr<const UChar*>(name.constData()), name.length()), runtimeObject, slot); +} + +QString QWebFrameAdapter::toHtml() const { - if (!hasView()) - return IntSize(); - return frame->view()->scrollOffset(); + if (!frame->document()) + return QString(); + return createMarkup(frame->document()); +} + +QString QWebFrameAdapter::toPlainText() const +{ + if (frame->view() && frame->view()->layoutPending()) + frame->view()->layout(); + + Element* documentElement = frame->document()->documentElement(); + if (documentElement) + return documentElement->innerText(); + return QString(); +} + +void QWebFrameAdapter::setContent(const QByteArray &data, const QString &mimeType, const QUrl &baseUrl) +{ + KURL kurl(baseUrl); + WebCore::ResourceRequest request(kurl); + WTF::RefPtr<WebCore::SharedBuffer> buffer = WebCore::SharedBuffer::create(data.constData(), data.length()); + QString actualMimeType; + WTF::String encoding; + if (mimeType.isEmpty()) + actualMimeType = QLatin1String("text/html"); + else { + actualMimeType = extractMIMETypeFromMediaType(mimeType); + encoding = extractCharsetFromMediaType(mimeType); + } + WebCore::SubstituteData substituteData(buffer, WTF::String(actualMimeType), encoding, KURL()); + frame->loader()->load(WebCore::FrameLoadRequest(frame, request, substituteData)); +} + +void QWebFrameAdapter::setHtml(const QString &html, const QUrl &baseUrl) +{ + KURL kurl(baseUrl); + WebCore::ResourceRequest request(kurl); + const QByteArray utf8 = html.toUtf8(); + WTF::RefPtr<WebCore::SharedBuffer> data = WebCore::SharedBuffer::create(utf8.constData(), utf8.length()); + WebCore::SubstituteData substituteData(data, WTF::String("text/html"), WTF::String("utf-8"), KURL()); + frame->loader()->load(WebCore::FrameLoadRequest(frame, request, substituteData)); +} + +QMultiMap<QString, QString> QWebFrameAdapter::metaData() const +{ + if (!frame->document()) + return QMap<QString, QString>(); + + QMultiMap<QString, QString> map; + Document* doc = frame->document(); + RefPtr<NodeList> list = doc->getElementsByTagName("meta"); + unsigned len = list->length(); + for (unsigned i = 0; i < len; i++) { + HTMLMetaElement* meta = static_cast<HTMLMetaElement*>(list->item(i)); + map.insert(meta->name(), meta->content()); + } + return map; } -IntRect QWebFrameAdapter::frameRect() const +QPoint QWebFrameAdapter::scrollPosition() const { - if (!hasView()) - return IntRect(); - return frame->view()->frameRect(); + if (!frame || !frame->view()) + return QPoint(); + IntSize ofs = frame->view()->scrollOffset(); + return QPoint(ofs.width(), ofs.height()); +} + +QRect QWebFrameAdapter::frameRect() const +{ + if (!frame || !frame->view()) + return QRect(); + return QRect(frame->view()->frameRect()); +} + +QSize QWebFrameAdapter::contentsSize() const +{ + FrameView* view = frame->view(); + if (!view) + return QSize(); + return QSize(view->contentsWidth(), view->contentsHeight()); +} + +void QWebFrameAdapter::setZoomFactor(qreal factor) +{ + if (pageAdapter->settings->testAttribute(QWebSettings::ZoomTextOnly)) + frame->setTextZoomFactor(factor); + else + frame->setPageZoomFactor(factor); +} + +qreal QWebFrameAdapter::zoomFactor() const +{ + return pageAdapter->settings->testAttribute(QWebSettings::ZoomTextOnly) ? frame->textZoomFactor() : frame->pageZoomFactor(); } void QWebFrameAdapter::init(QWebPageAdapter* pageAdapter) @@ -196,16 +359,616 @@ QWebFrameAdapter* QWebFrameAdapter::kit(const Frame* frame) QUrl QWebFrameAdapter::ensureAbsoluteUrl(const QUrl& url) { - if (!url.isValid() || !url.isRelative()) - return url; + // FIXME: it would be nice if we could avoid doing this. + // Convert to KURL and back to preserve the old behavior (e.g. fixup of single slash in 'http:/') + QUrl validatedUrl = KURL(url); + + if (!validatedUrl.isValid() || !validatedUrl.isRelative()) + return validatedUrl; // This contains the URL with absolute path but without // the query and the fragment part. - QUrl baseUrl = QUrl::fromLocalFile(QFileInfo(url.toLocalFile()).absoluteFilePath()); + QUrl baseUrl = QUrl::fromLocalFile(QFileInfo(validatedUrl.toLocalFile()).absoluteFilePath()); // The path is removed so the query and the fragment parts are there. - QString pathRemoved = url.toString(QUrl::RemovePath); + QString pathRemoved = validatedUrl.toString(QUrl::RemovePath); QUrl toResolve(pathRemoved); return baseUrl.resolved(toResolve); } + +QWebHitTestResultPrivate* QWebFrameAdapter::hitTestContent(const QPoint& pos) const +{ + if (!frame->view() || !frame->contentRenderer()) + return 0; + + HitTestResult result = frame->eventHandler()->hitTestResultAtPoint(frame->view()->windowToContents(pos), /*allowShadowContent*/ false, /*ignoreClipping*/ true); + + if (result.scrollbar()) + return 0; + return new QWebHitTestResultPrivate(result); +} + +QWebElement QWebFrameAdapter::documentElement() const +{ + Document* doc = frame->document(); + if (!doc) + return QWebElement(); + return QWebElement(doc->documentElement()); +} + +QString QWebFrameAdapter::title() const +{ + if (frame->document()) + return frame->loader()->documentLoader()->title().string(); + return QString(); +} + +void QWebFrameAdapter::clearCoreFrame() +{ + DocumentLoader* documentLoader = frame->loader()->activeDocumentLoader(); + Q_ASSERT(documentLoader); + documentLoader->writer()->begin(); + documentLoader->writer()->end(); +} + + +static inline bool isCoreFrameClear(WebCore::Frame* frame) +{ + return frame->document()->url().isEmpty(); +} + +QUrl QWebFrameAdapter::baseUrl() const +{ + if (isCoreFrameClear(frame)) + return url.resolved(QUrl()); + return frame->document()->baseURL(); +} + +#if USE(ACCELERATED_COMPOSITING) +void QWebFrameAdapter::renderCompositedLayers(WebCore::GraphicsContext* context, const WebCore::IntRect& clip) +{ + WebCore::Page* page = frame->page(); + if (!page) + return; + if (TextureMapperLayerClientQt* client = static_cast<ChromeClientQt*>(page->chrome()->client())->m_textureMapperLayerClient.get()) + client->renderCompositedLayers(context, clip); +} +#endif +// FIXME: this might not be necessary, but for the sake of not breaking things, we'll use that for now. +QUrl QWebFrameAdapter::coreFrameUrl() const +{ + return frame->document()->url(); +} + +QUrl QWebFrameAdapter::lastRequestedUrl() const +{ + return frameLoaderClient->lastRequestedUrl(); +} + +QWebSecurityOrigin QWebFrameAdapter::securityOrigin() const +{ + QWebSecurityOriginPrivate* priv = new QWebSecurityOriginPrivate(frame->document()->securityOrigin()); + return QWebSecurityOrigin(priv); +} + +QString QWebFrameAdapter::uniqueName() const +{ + return frame->tree()->uniqueName(); +} + +// This code is copied from ChromeClientGtk.cpp. +static void coalesceRectsIfPossible(const QRect& clipRect, QVector<QRect>& rects) +{ + const unsigned rectThreshold = 10; + const float wastedSpaceThreshold = 0.75f; + bool useUnionedRect = (rects.size() <= 1) || (rects.size() > rectThreshold); + if (!useUnionedRect) { + // Attempt to guess whether or not we should use the unioned rect or the individual rects. + // We do this by computing the percentage of "wasted space" in the union. If that wasted space + // is too large, then we will do individual rect painting instead. + float unionPixels = (clipRect.width() * clipRect.height()); + float singlePixels = 0; + for (size_t i = 0; i < rects.size(); ++i) + singlePixels += rects[i].width() * rects[i].height(); + float wastedSpace = 1 - (singlePixels / unionPixels); + if (wastedSpace <= wastedSpaceThreshold) + useUnionedRect = true; + } + + if (!useUnionedRect) + return; + + rects.clear(); + rects.append(clipRect); +} + +void QWebFrameAdapter::renderRelativeCoords(QPainter* painter, int layers, const QRegion& clip) +{ + GraphicsContext context(painter); + if (context.paintingDisabled() && !context.updatingControlTints()) + return; + + if (!frame->view() || !frame->contentRenderer()) + return; + + QVector<QRect> vector = clip.rects(); + if (vector.isEmpty()) + return; + + WebCore::FrameView* view = frame->view(); + view->updateLayoutAndStyleIfNeededRecursive(); + + if (layers & ContentsLayer) { + QRect clipBoundingRect = clip.boundingRect(); + coalesceRectsIfPossible(clipBoundingRect, vector); + for (int i = 0; i < vector.size(); ++i) { + const QRect& clipRect = vector.at(i); + + QRect rect = clipRect.intersected(view->frameRect()); + + context.save(); + painter->setClipRect(clipRect, Qt::IntersectClip); + + int x = view->x(); + int y = view->y(); + + int scrollX = view->scrollX(); + int scrollY = view->scrollY(); + + context.translate(x, y); + rect.translate(-x, -y); + context.translate(-scrollX, -scrollY); + rect.translate(scrollX, scrollY); + context.clip(view->visibleContentRect()); + + view->paintContents(&context, rect); + + context.restore(); + } +#if USE(ACCELERATED_COMPOSITING) + renderCompositedLayers(&context, IntRect(clipBoundingRect)); +#endif + } + renderFrameExtras(&context, layers, clip); +#if ENABLE(INSPECTOR) + if (frame->page()->inspectorController()->highlightedNode()) { + context.save(); + frame->page()->inspectorController()->drawHighlight(context); + context.restore(); + } +#endif +} + +void QWebFrameAdapter::renderFrameExtras(WebCore::GraphicsContext* context, int layers, const QRegion& clip) +{ + if (!(layers & (PanIconLayer | ScrollBarLayer))) + return; + QPainter* painter = context->platformContext(); + WebCore::FrameView* view = frame->view(); + QVector<QRect> vector = clip.rects(); + for (int i = 0; i < vector.size(); ++i) { + const QRect& clipRect = vector.at(i); + + QRect intersectedRect = clipRect.intersected(view->frameRect()); + + painter->save(); + painter->setClipRect(clipRect, Qt::IntersectClip); + + int x = view->x(); + int y = view->y(); + + if (layers & ScrollBarLayer + && !view->scrollbarsSuppressed() + && (view->horizontalScrollbar() || view->verticalScrollbar())) { + + QRect rect = intersectedRect; + context->translate(x, y); + rect.translate(-x, -y); + view->paintScrollbars(context, rect); + context->translate(-x, -y); + } + +#if ENABLE(PAN_SCROLLING) + if (layers & PanIconLayer) + view->paintPanScrollIcon(context); +#endif + + painter->restore(); + } +} + +#if USE(TILED_BACKING_STORE) +void QWebFrameAdapter::setTiledBackingStoreFrozen(bool frozen) +{ + WebCore::TiledBackingStore* backingStore = frame->tiledBackingStore(); + if (!backingStore) + return; + backingStore->setContentsFrozen(frozen); +} + +bool QWebFrameAdapter::tiledBackingStoreFrozen() const +{ + WebCore::TiledBackingStore* backingStore = frame->tiledBackingStore(); + if (!backingStore) + return false; + return backingStore->contentsFrozen(); +} + +void QWebFrameAdapter::setTiledBackingStoreContentsScale(float scale) +{ + WebCore::TiledBackingStore* backingStore = frame->tiledBackingStore(); + if (!backingStore) + return; + backingStore->setContentsScale(scale); +} + +bool QWebFrameAdapter::renderFromTiledBackingStore(QPainter* painter, const QRegion& clip) +{ + // No tiled backing store? Tell the caller to fall back to regular rendering. + if (!frame->tiledBackingStore()) + return false; + + // FIXME: We should set the backing store viewport earlier than in paint + frame->tiledBackingStore()->coverWithTilesIfNeeded(); + + if (!frame->view() || !frame->contentRenderer()) + return true; + + QVector<QRect> vector = clip.rects(); + if (vector.isEmpty()) + return true; + + GraphicsContext context(painter); + + WebCore::FrameView* view = frame->view(); + + int scrollX = view->scrollX(); + int scrollY = view->scrollY(); + context.translate(-scrollX, -scrollY); + + for (int i = 0; i < vector.size(); ++i) { + const QRect& clipRect = vector.at(i); + + painter->save(); + + QRect rect = clipRect.translated(scrollX, scrollY); + painter->setClipRect(rect, Qt::IntersectClip); + + frame->tiledBackingStore()->paint(&context, rect); + + painter->restore(); + } + +#if USE(ACCELERATED_COMPOSITING) + renderCompositedLayers(&context, IntRect(clip.boundingRect())); + renderFrameExtras(&context, QWebFrameAdapter::ScrollBarLayer | QWebFrameAdapter::PanIconLayer, clip); +#endif + return true; +} +#endif + +void QWebFrameAdapter::_q_orientationChanged() +{ +#if ENABLE(ORIENTATION_EVENTS) + int orientation; + + switch (m_orientation.reading()->orientation()) { + case QOrientationReading::TopUp: + orientation = 0; + break; + case QOrientationReading::TopDown: + orientation = 180; + break; + case QOrientationReading::LeftUp: + orientation = -90; + break; + case QOrientationReading::RightUp: + orientation = 90; + break; + case QOrientationReading::FaceUp: + case QOrientationReading::FaceDown: + // WebCore unable to handle it + default: + return; + } + frame->sendOrientationChangeEvent(orientation); +#endif +} + +QList<QObject*> QWebFrameAdapter::childFrames() const +{ + QList<QObject*> originatingObjects; + if (frame) { + FrameTree* tree = frame->tree(); + for (Frame* child = tree->firstChild(); child; child = child->tree()->nextSibling()) { + FrameLoader* loader = child->loader(); + originatingObjects.append(loader->networkingContext()->originatingObject()); + } + } + return originatingObjects; +} + +bool QWebFrameAdapter::hasFocus() const +{ + Frame* ff = frame->page()->focusController()->focusedFrame(); + return ff && QWebFrameAdapter::kit(ff) == this; +} + +void QWebFrameAdapter::setFocus() +{ + frame->page()->focusController()->setFocusedFrame(frame); +} + +void QWebFrameAdapter::setScrollBarPolicy(Qt::Orientation orientation, Qt::ScrollBarPolicy policy) +{ + Q_ASSERT((int)ScrollbarAuto == (int)Qt::ScrollBarAsNeeded); + Q_ASSERT((int)ScrollbarAlwaysOff == (int)Qt::ScrollBarAlwaysOff); + Q_ASSERT((int)ScrollbarAlwaysOn == (int)Qt::ScrollBarAlwaysOn); + + if (orientation == Qt::Horizontal) { + horizontalScrollBarPolicy = policy; + if (frame->view()) { + frame->view()->setHorizontalScrollbarMode((ScrollbarMode)policy, policy != Qt::ScrollBarAsNeeded /* lock */); + frame->view()->updateCanHaveScrollbars(); + } + } else { + verticalScrollBarPolicy = policy; + if (frame->view()) { + frame->view()->setVerticalScrollbarMode((ScrollbarMode)policy, policy != Qt::ScrollBarAsNeeded /* lock */); + frame->view()->updateCanHaveScrollbars(); + } + } +} + +void QWebFrameAdapter::scrollToAnchor(const QString &anchor) +{ + FrameView* view = frame->view(); + if (view) + view->scrollToAnchor(anchor); +} + +void QWebFrameAdapter::scrollBy(int dx, int dy) +{ + if (!frame->view()) + return; + frame->view()->scrollBy(IntSize(dx, dy)); +} + +void QWebFrameAdapter::setScrollBarValue(Qt::Orientation orientation, int value) +{ + Scrollbar* sb; + sb = (orientation == Qt::Horizontal) ? horizontalScrollBar() : verticalScrollBar(); + if (sb) { + if (value < 0) + value = 0; + else if (value > scrollBarMaximum(orientation)) + value = scrollBarMaximum(orientation); + sb->scrollableArea()->scrollToOffsetWithoutAnimation(orientation == Qt::Horizontal ? HorizontalScrollbar : VerticalScrollbar, value); + } +} + +int QWebFrameAdapter::scrollBarValue(Qt::Orientation orientation) const +{ + Scrollbar* sb; + sb = (orientation == Qt::Horizontal) ? horizontalScrollBar() : verticalScrollBar(); + if (sb) + return sb->value(); + return 0; +} + +int QWebFrameAdapter::scrollBarMaximum(Qt::Orientation orientation) const +{ + Scrollbar* sb; + sb = (orientation == Qt::Horizontal) ? horizontalScrollBar() : verticalScrollBar(); + if (sb) + return sb->maximum(); + return 0; +} + +QRect QWebFrameAdapter::scrollBarGeometry(Qt::Orientation orientation) const +{ + Scrollbar* sb; + sb = (orientation == Qt::Horizontal) ? horizontalScrollBar() : verticalScrollBar(); + if (sb) + return sb->frameRect(); + return QRect(); +} + +WebCore::Scrollbar* QWebFrameAdapter::horizontalScrollBar() const +{ + if (!frame->view()) + return 0; + return frame->view()->horizontalScrollbar(); +} + +WebCore::Scrollbar* QWebFrameAdapter::verticalScrollBar() const +{ + if (!frame->view()) + return 0; + return frame->view()->verticalScrollbar(); +} + + +void QWebFrameAdapter::updateBackgroundRecursively(const QColor& backgroundColor) +{ + ASSERT(frame->view()); + frame->view()->updateBackgroundRecursively(backgroundColor, /*transparent*/ !backgroundColor.alpha()); +} + +void QWebFrameAdapter::cancelLoad() +{ + frame->navigationScheduler()->cancel(); +} + +// ========== QWebHitTestResultPrivate implementation =========== + +QWebHitTestResultPrivate::QWebHitTestResultPrivate(const WebCore::HitTestResult &hitTest) + : isContentEditable(false) + , isContentSelected(false) + , isScrollBar(false) + , webCoreFrame(0) +{ + if (!hitTest.innerNode()) + return; + pos = hitTest.roundedPointInInnerNodeFrame(); + WebCore::TextDirection dir; + title = hitTest.title(dir); + linkText = hitTest.textContent(); + linkUrl = hitTest.absoluteLinkURL(); + linkTitle = hitTest.titleDisplayString(); + alternateText = hitTest.altDisplayString(); + imageUrl = hitTest.absoluteImageURL(); + innerNode = hitTest.innerNode(); + innerNode->ref(); + innerNonSharedNode = hitTest.innerNonSharedNode(); + innerNonSharedNode->ref(); + boundingRect = innerNonSharedNode ? innerNonSharedNode->renderer()->absoluteBoundingBoxRect() : IntRect(); + WebCore::Image *img = hitTest.image(); + if (img) { + QPixmap* pix = img->nativeImageForCurrentFrame(); + if (pix) + pixmap = *pix; + } + WebCore::Frame *wframe = hitTest.targetFrame(); + if (wframe) { + linkTargetFrame = QWebFrameAdapter::kit(wframe)->handle(); + webCoreFrame = wframe; + webCoreFrame->ref(); + } + linkElement = QWebElement(hitTest.URLElement()); + + isContentEditable = hitTest.isContentEditable(); + isContentSelected = hitTest.isSelected(); + isScrollBar = hitTest.scrollbar(); + + WebCore::Frame *innerNodeFrame = hitTest.innerNodeFrame(); + if (innerNodeFrame) + frame = QWebFrameAdapter::kit(innerNodeFrame)->handle(); + + enclosingBlock = QWebElement(WebCore::enclosingBlock(innerNode)); +} + +QWebHitTestResultPrivate::QWebHitTestResultPrivate(const QWebHitTestResultPrivate& other) +{ + innerNode = 0; + innerNonSharedNode = 0; + webCoreFrame = 0; + *this = other; +} + +QWebHitTestResultPrivate& QWebHitTestResultPrivate::operator=(const QWebHitTestResultPrivate& other) +{ + pos = other.pos; + boundingRect = other.boundingRect; + enclosingBlock = other.enclosingBlock; + title = other.title; + linkText = other.linkText; + linkUrl = other.linkUrl; + linkTitle = other.linkTitle; + linkTargetFrame = other.linkTargetFrame; + linkElement = other.linkElement; + alternateText = other.alternateText; + imageUrl = other.imageUrl; + pixmap = other.pixmap; + isContentEditable = other.isContentEditable; + isContentSelected = other.isContentSelected; + isScrollBar = other.isScrollBar; + frame = other.frame; + + if (innerNode) + innerNode->deref(); + innerNode = other.innerNode; + if (innerNode) + innerNode->ref(); + + if (innerNonSharedNode) + innerNonSharedNode->deref(); + innerNonSharedNode = other.innerNonSharedNode; + if (innerNonSharedNode) + innerNonSharedNode->ref(); + + if (webCoreFrame) + webCoreFrame->deref(); + webCoreFrame = other.webCoreFrame; + if (webCoreFrame) + webCoreFrame->ref(); + + return *this; +} + +QWebHitTestResultPrivate::~QWebHitTestResultPrivate() +{ + if (innerNode) + innerNode->deref(); + if (innerNonSharedNode) + innerNonSharedNode->deref(); + if (webCoreFrame) + webCoreFrame->deref(); +} + +QWebElement QWebHitTestResultPrivate::elementForInnerNode() const +{ + if (!innerNonSharedNode || !innerNonSharedNode->isElementNode()) + return QWebElement(); + return QWebElement(static_cast<Element*>(innerNonSharedNode)); +} + +// ====================================================== + +QSize QWebFrameAdapter::customLayoutSize() const +{ + ASSERT(pageAdapter->mainFrameAdapter() == this); + FrameView* view = frame->view(); + ASSERT(view); + if (view->useFixedLayout()) + return view->fixedLayoutSize(); + return QSize(); +} + +void QWebFrameAdapter::setCustomLayoutSize(const QSize& size) +{ + ASSERT(pageAdapter->mainFrameAdapter() == this); + FrameView* view = frame->view(); + ASSERT(view); + + if (size.isValid()) { + view->setUseFixedLayout(true); + view->setFixedLayoutSize(size); + } else if (view->useFixedLayout()) + view->setUseFixedLayout(false); + + view->layout(); +} + +void QWebFrameAdapter::setFixedVisibleContentRect(const QRect& rect) +{ + ASSERT(pageAdapter->mainFrameAdapter() == this); + FrameView* view = frame->view(); + ASSERT(view); + view->setFixedVisibleContentRect(rect); +} + +void QWebFrameAdapter::setViewportSize(const QSize& size) +{ + ASSERT(pageAdapter->mainFrameAdapter() == this); + FrameView* view = frame->view(); + ASSERT(view); + view->resize(size); + view->adjustViewSize(); +} + + +void QWebFrameAdapter::setPaintsEntireContents(bool resizesToContents) +{ + ASSERT(pageAdapter->mainFrameAdapter() == this); + ASSERT(frame->view()); + frame->view()->setPaintsEntireContents(resizesToContents); +} + +void QWebFrameAdapter::setDelegatesScrolling(bool resizesToContents) +{ + ASSERT(pageAdapter->mainFrameAdapter() == this); + ASSERT(frame->view()); + frame->view()->setDelegatesScrolling(resizesToContents); +} diff --git a/Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.h b/Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.h index 17c41d539..c3c78eadd 100644 --- a/Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.h +++ b/Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.h @@ -22,17 +22,25 @@ #include "FrameLoaderClientQt.h" #include "PlatformEvent.h" +#if ENABLE(ORIENTATION_EVENTS) +#include "qorientationsensor.h" +#endif // ENABLE(ORIENTATION_EVENTS). +#include "qwebelement.h" -#include <FrameView.h> -#include <IntRect.h> -#include <IntSize.h> -#include <KURL.h> - +#include <QList> #include <QNetworkAccessManager> +#include <QRect> #include <QSize> +#include <QUrl> +#include <wtf/ExportMacros.h> +#include <wtf/RefPtr.h> +#include <wtf/text/WTFString.h> namespace WebCore { class Frame; +class GraphicsContext; +class IntRect; +class TextureMapperLayer; } QT_BEGIN_NAMESPACE @@ -44,6 +52,47 @@ class QGestureEventFacade; #endif class QWebFrame; class QWebPageAdapter; +class QWebSecurityOrigin; + +class WEBKIT_EXPORTDATA QWebHitTestResultPrivate { +public: + QWebHitTestResultPrivate() + : isContentEditable(false) + , isContentSelected(false), isScrollBar(false) + , innerNode(0) + , innerNonSharedNode(0) + , webCoreFrame(0) + { } + QWebHitTestResultPrivate(const WebCore::HitTestResult &); + QWebHitTestResultPrivate(const QWebHitTestResultPrivate&); + QWebHitTestResultPrivate& operator=(const QWebHitTestResultPrivate&); + ~QWebHitTestResultPrivate(); + + QWebElement elementForInnerNode() const; + + QPoint pos; + QRect boundingRect; + QWebElement enclosingBlock; + QString title; + QString linkText; + QUrl linkUrl; + QString linkTitle; + QPointer<QObject> linkTargetFrame; + QWebElement linkElement; + QString alternateText; + QUrl imageUrl; + QPixmap pixmap; + bool isContentEditable; + bool isContentSelected; + bool isScrollBar; + QPointer<QObject> frame; +private: + WebCore::Node* innerNode; + WebCore::Node* innerNonSharedNode; + WebCore::Frame* webCoreFrame; + friend class QWebFrameAdapter; + friend class QWebPageAdapter; +}; class QWebFrameData { public: @@ -61,8 +110,22 @@ public: int marginHeight; }; -class QWebFrameAdapter { +class WEBKIT_EXPORTDATA QWebFrameAdapter { public: + enum ValueOwnership { + QtOwnership, + ScriptOwnership, + AutoOwnership + }; + + enum RenderLayers { + ContentsLayer = 0x10, + ScrollBarLayer = 0x20, + PanIconLayer = 0x40, + + AllLayers = 0xff + }; + static QUrl ensureAbsoluteUrl(const QUrl&); QWebFrameAdapter(); @@ -83,28 +146,100 @@ public: 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(); } + bool hasView() const; #if ENABLE(GESTURE_EVENTS) void handleGestureEvent(QGestureEventFacade*); #endif QWebFrameAdapter* createFrame(QWebFrameData*); - WebCore::IntSize scrollPosition() const; - WebCore::IntRect frameRect() const; + QVariant evaluateJavaScript(const QString& scriptSource); + void addToJavaScriptWindowObject(const QString& name, QObject*, ValueOwnership); + + QString toHtml() const; + QString toPlainText() const; + + void setContent(const QByteArray& data, const QString& mimeType, const QUrl& baseUrl); + void setHtml(const QString& html, const QUrl& baseUrl); + + QMultiMap<QString, QString> metaData() const; + + QWebHitTestResultPrivate* hitTestContent(const QPoint&) const; + QWebElement documentElement() const; + QString title() const; + void clearCoreFrame(); + QUrl baseUrl() const; + QUrl coreFrameUrl() const; + QUrl lastRequestedUrl() const; + QWebSecurityOrigin securityOrigin() const; + QString uniqueName() const; + + void renderRelativeCoords(QPainter*, int layers, const QRegion& clip); + void renderFrameExtras(WebCore::GraphicsContext*, int layers, const QRegion& clip); +#if USE(ACCELERATED_COMPOSITING) + void renderCompositedLayers(WebCore::GraphicsContext*, const WebCore::IntRect& clip); +#endif +#if USE(TILED_BACKING_STORE) + void setTiledBackingStoreFrozen(bool); + bool tiledBackingStoreFrozen() const; + void setTiledBackingStoreContentsScale(float); + bool renderFromTiledBackingStore(QPainter*, const QRegion& clip); +#endif + + // Called from QWebFrame as a private slot: + void _q_orientationChanged(); + + QList<QObject*> childFrames() const; + bool hasFocus() const; + void setFocus(); + + void setScrollBarPolicy(Qt::Orientation, Qt::ScrollBarPolicy); + void scrollToAnchor(const QString&); + void scrollBy(int, int); + void setScrollBarValue(Qt::Orientation, int); + int scrollBarValue(Qt::Orientation) const; + int scrollBarMaximum(Qt::Orientation) const; + QRect scrollBarGeometry(Qt::Orientation) const; + + QPoint scrollPosition() const; + QRect frameRect() const; + QSize contentsSize() const; + + void setZoomFactor(qreal); + qreal zoomFactor() const; + + void updateBackgroundRecursively(const QColor&); + + void cancelLoad(); + + // FrameView related functions + QSize customLayoutSize() const; + void setCustomLayoutSize(const QSize&); + void setFixedVisibleContentRect(const QRect&); + void setViewportSize(const QSize&); + void setPaintsEntireContents(bool /*resizesToContents*/); + void setDelegatesScrolling(bool /*resizesToContents*/); + QWebPageAdapter* pageAdapter; // protected: bool allowsScrolling; int marginWidth; int marginHeight; + Qt::ScrollBarPolicy horizontalScrollBarPolicy; + Qt::ScrollBarPolicy verticalScrollBarPolicy; +#if ENABLE(ORIENTATION_EVENTS) + QOrientationSensor m_orientation; +#endif // ENABLE(ORIENTATION_EVENTS). // private: void init(QWebPageAdapter*); void init(QWebPageAdapter*, QWebFrameData*); + WebCore::Scrollbar* horizontalScrollBar() const; + WebCore::Scrollbar* verticalScrollBar() const; WebCore::Frame *frame; WebCore::FrameLoaderClientQt *frameLoaderClient; - WebCore::KURL url; + QUrl url; static QWebFrameAdapter* kit(const WebCore::Frame*); diff --git a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp index 3d639d99a..cb93cd9f7 100644 --- a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp +++ b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp @@ -21,52 +21,216 @@ #include "config.h" #include "QWebPageAdapter.h" +#include "CSSComputedStyleDeclaration.h" +#include "CSSParser.h" #include "Chrome.h" #include "ChromeClientQt.h" +#include "ClientRect.h" +#include "ContextMenu.h" +#include "ContextMenuClientQt.h" +#include "ContextMenuController.h" +#if ENABLE(DEVICE_ORIENTATION) +#include "DeviceMotionClientQt.h" +#include "DeviceOrientationClientMock.h" +#include "DeviceOrientationClientQt.h" +#endif +#include "DocumentLoader.h" +#include "DragClientQt.h" +#include "DragController.h" +#include "DragData.h" +#include "DragSession.h" +#include "EditorClientQt.h" +#include "FocusController.h" +#include "FrameView.h" +#if ENABLE(GEOLOCATION) +#include "GeolocationClientMock.h" +#include "GeolocationClientQt.h" +#include "GeolocationController.h" +#endif +#include "GeolocationPermissionClientQt.h" +#include "HTMLFrameOwnerElement.h" +#include "HTMLInputElement.h" +#include "HitTestResult.h" +#include "InitWebCoreQt.h" +#include "InspectorClientQt.h" +#include "InspectorController.h" +#include "InspectorServerQt.h" +#include "LocalizedStrings.h" +#include "MIMETypeRegistry.h" +#include "MemoryCache.h" +#include "NodeList.h" #include "NotificationPresenterClientQt.h" +#include "PageGroup.h" +#include "Pasteboard.h" +#include "PlatformKeyboardEvent.h" +#include "PlatformTouchEvent.h" +#include "PlatformWheelEvent.h" +#include "PluginDatabase.h" +#include "PluginPackage.h" +#include "ProgressTracker.h" #include "QWebFrameAdapter.h" +#include "RenderTextControl.h" +#include "SchemeRegistry.h" +#include "Scrollbar.h" +#include "ScrollbarTheme.h" +#include "Settings.h" #include "UndoStepQt.h" +#include "UserAgentQt.h" +#include "WebEventConversion.h" +#include "WebKitVersion.h" +#include "WindowFeatures.h" +#include "qwebhistory_p.h" #include "qwebpluginfactory.h" #include "qwebsettings.h" #include <Page.h> +#include <QBitArray> +#include <QGuiApplication> +#include <QMimeData> +#include <QMouseEvent> #include <QNetworkAccessManager> +#include <QStyleHints> +#include <QTextCharFormat> +#include <QTouchEvent> +#include <QWheelEvent> + +// from text/qfont.cpp +QT_BEGIN_NAMESPACE +extern Q_GUI_EXPORT int qt_defaultDpi(); +QT_END_NAMESPACE using namespace WebCore; bool QWebPageAdapter::drtRun = false; +typedef QWebPageAdapter::MenuItemDescription MenuItem; + +static inline DragOperation dropActionToDragOp(Qt::DropActions actions) +{ + unsigned result = 0; + if (actions & Qt::CopyAction) + result |= DragOperationCopy; + // DragOperationgeneric represents InternetExplorer's equivalent of Move operation, + // hence it should be considered as "move" + if (actions & Qt::MoveAction) + result |= (DragOperationMove | DragOperationGeneric); + if (actions & Qt::LinkAction) + result |= DragOperationLink; + if (result == (DragOperationCopy | DragOperationMove | DragOperationGeneric | DragOperationLink)) + result = DragOperationEvery; + return (DragOperation)result; +} + +static inline Qt::DropAction dragOpToDropAction(unsigned actions) +{ + Qt::DropAction result = Qt::IgnoreAction; + if (actions & DragOperationCopy) + result = Qt::CopyAction; + else if (actions & DragOperationMove) + result = Qt::MoveAction; + // DragOperationgeneric represents InternetExplorer's equivalent of Move operation, + // hence it should be considered as "move" + else if (actions & DragOperationGeneric) + result = Qt::MoveAction; + else if (actions & DragOperationLink) + result = Qt::LinkAction; + return result; +} + +static WebCore::FrameLoadRequest frameLoadRequest(const QUrl &url, WebCore::Frame *frame) +{ + return WebCore::FrameLoadRequest(frame->document()->securityOrigin(), + WebCore::ResourceRequest(url, frame->loader()->outgoingReferrer())); +} + +static void openNewWindow(const QUrl& url, Frame* frame) +{ + if (Page* oldPage = frame->page()) { + WindowFeatures features; + NavigationAction action; + FrameLoadRequest request = frameLoadRequest(url, frame); + if (Page* newPage = oldPage->chrome()->createWindow(frame, request, features, action)) { + newPage->mainFrame()->loader()->loadFrameRequest(request, false, false, 0, 0, MaybeSendReferrer); + newPage->chrome()->show(); + } + } +} + QWebPageAdapter::QWebPageAdapter() : settings(0) , page(0) , pluginFactory(0) , forwardUnsupportedContent(false) , insideOpenCall(false) + , clickCausedFocus(false) + , m_totalBytes(0) + , m_bytesReceived() , networkManager(0) { -} + WebCore::initializeWebCoreQt(); +#if ENABLE(GEOLOCATION) || ENABLE(DEVICE_ORIENTATION) + bool useMock = QWebPageAdapter::drtRun; +#endif -QWebPageAdapter::~QWebPageAdapter() -{ - delete page; - delete settings; + Page::PageClients pageClients; + pageClients.chromeClient = new ChromeClientQt(this); + pageClients.contextMenuClient = new ContextMenuClientQt(); + 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) { + // In case running in DumpRenderTree mode set the controller to mock provider. + GeolocationClientMock* mock = new GeolocationClientMock; + WebCore::provideGeolocationTo(page, mock); + mock->setController(WebCore::GeolocationController::from(page)); + } else + WebCore::provideGeolocationTo(page, new GeolocationClientQt(this)); +#endif +#if ENABLE(DEVICE_ORIENTATION) + if (useMock) + WebCore::provideDeviceOrientationTo(page, new DeviceOrientationClientMock); + else + WebCore::provideDeviceOrientationTo(page, new DeviceOrientationClientQt); + WebCore::provideDeviceMotionTo(page, new DeviceMotionClientQt); +#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 + // separate settings for each group, so that for instance an integrated browser/email reader + // can use different settings for displaying HTML pages and HTML email. To make QtWebKit work + // as expected out of the box, we use a default group similar to what other ports are doing. + page->setGroupName("Default Group"); + + page->addLayoutMilestones(DidFirstVisuallyNonEmptyLayout); + + settings = new QWebSettings(page->settings()); #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) - NotificationPresenterClientQt::notificationPresenter()->removeClient(); + WebCore::provideNotification(page, NotificationPresenterClientQt::notificationPresenter()); #endif + + history.d = new QWebHistoryPrivate(static_cast<WebCore::BackForwardListImpl*>(page->backForwardList())); + + PageGroup::setShouldTrackVisitedLinks(true); } -void QWebPageAdapter::init(Page* page) +QWebPageAdapter::~QWebPageAdapter() { - this->page = page; - settings = new QWebSettings(page->settings()); + delete page; + delete settings; #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) - WebCore::provideNotification(page, NotificationPresenterClientQt::notificationPresenter()); + NotificationPresenterClientQt::notificationPresenter()->removeClient(); #endif } void QWebPageAdapter::deletePage() { + // Before we delete the page, detach the mainframe's loader + FrameLoader* loader = mainFrameAdapter()->frame->loader(); + if (loader) + loader->detachFromParent(); delete page; page = 0; } @@ -76,7 +240,7 @@ QWebPageAdapter* QWebPageAdapter::kit(Page* page) return static_cast<ChromeClientQt*>(page->chrome()->client())->m_webPage; } -ViewportArguments QWebPageAdapter::viewportArguments() +ViewportArguments QWebPageAdapter::viewportArguments() const { return page ? page->viewportArguments() : WebCore::ViewportArguments(); } @@ -102,3 +266,1210 @@ QNetworkAccessManager* QWebPageAdapter::networkAccessManager() networkManager = new QNetworkAccessManager(handle()); return networkManager; } + +bool QWebPageAdapter::hasSelection() const +{ + Frame* frame = page->focusController()->focusedOrMainFrame(); + if (frame) + return (frame->selection()->selection().selectionType() != VisibleSelection::NoSelection); + return false; +} + +QString QWebPageAdapter::selectedText() const +{ + Frame* frame = page->focusController()->focusedOrMainFrame(); + if (frame->selection()->selection().selectionType() == VisibleSelection::NoSelection) + return QString(); + return frame->editor()->selectedText(); +} + +QString QWebPageAdapter::selectedHtml() const +{ + return page->focusController()->focusedOrMainFrame()->editor()->selectedRange()->toHTML(); +} + +bool QWebPageAdapter::isContentEditable() const +{ + return page->isEditable(); +} + +void QWebPageAdapter::setContentEditable(bool editable) +{ + page->setEditable(editable); + page->setTabKeyCyclesThroughElements(!editable); + + Frame* frame = mainFrameAdapter()->frame; + if (editable) { + frame->editor()->applyEditingStyleToBodyElement(); + // FIXME: mac port calls this if there is no selectedDOMRange + // frame->setSelectionFromNone(); + } + +} + +bool QWebPageAdapter::findText(const QString& subString, FindFlag options) +{ + ::TextCaseSensitivity caseSensitivity = ::TextCaseInsensitive; + if (options & FindCaseSensitively) + caseSensitivity = ::TextCaseSensitive; + + if (options & HighlightAllOccurrences) { + if (subString.isEmpty()) { + page->unmarkAllTextMatches(); + return true; + } + return page->markAllMatchesForText(subString, caseSensitivity, true, 0); + } + + if (subString.isEmpty()) { + page->mainFrame()->selection()->clear(); + Frame* frame = page->mainFrame()->tree()->firstChild(); + while (frame) { + frame->selection()->clear(); + frame = frame->tree()->traverseNextWithWrap(false); + } + } + ::FindDirection direction = ::FindDirectionForward; + if (options & FindBackward) + direction = ::FindDirectionBackward; + + const bool shouldWrap = options & FindWrapsAroundDocument; + + return page->findString(subString, caseSensitivity, direction, shouldWrap); +} + +void QWebPageAdapter::adjustPointForClicking(QMouseEvent* ev) +{ + QtPlatformPlugin platformPlugin; + OwnPtr<QWebTouchModifier> touchModifier = platformPlugin.createTouchModifier(); + if (!touchModifier) + return; + + unsigned topPadding = touchModifier->hitTestPaddingForTouch(QWebTouchModifier::Up); + unsigned rightPadding = touchModifier->hitTestPaddingForTouch(QWebTouchModifier::Right); + unsigned bottomPadding = touchModifier->hitTestPaddingForTouch(QWebTouchModifier::Down); + unsigned leftPadding = touchModifier->hitTestPaddingForTouch(QWebTouchModifier::Left); + + touchModifier = nullptr; + + if (!topPadding && !rightPadding && !bottomPadding && !leftPadding) + return; + + Document* startingDocument = page->mainFrame()->document(); + if (!startingDocument) + return; + + IntPoint originalPoint(ev->pos()); + TouchAdjuster touchAdjuster(topPadding, rightPadding, bottomPadding, leftPadding); + IntPoint adjustedPoint = touchAdjuster.findCandidatePointForTouch(originalPoint, startingDocument); + if (adjustedPoint == IntPoint::zero()) + return; + QMouseEvent* ret = new QMouseEvent(ev->type(), QPoint(adjustedPoint), ev->globalPos(), ev->button(), ev->buttons(), ev->modifiers()); + delete ev; + ev = ret; +} + +static bool hasMouseListener(Element* element) +{ + ASSERT(element); + return element->hasEventListeners(eventNames().clickEvent) + || element->hasEventListeners(eventNames().mousedownEvent) + || element->hasEventListeners(eventNames().mouseupEvent); +} + +static bool isClickableElement(Element* element, PassRefPtr<NodeList> prpList) +{ + ASSERT(element); + RefPtr<NodeList> list = prpList; + bool isClickable = hasMouseListener(element); + if (!isClickable && list) { + Element* parent = element->parentElement(); + unsigned count = list->length(); + for (unsigned i = 0; i < count && parent; i++) { + if (list->item(i) != parent) + continue; + + isClickable = hasMouseListener(parent); + if (isClickable) + break; + + parent = parent->parentElement(); + } + } + + ExceptionCode ec = 0; + return isClickable + || element->webkitMatchesSelector("a,*:link,*:visited,*[role=button],button,input,select,label", ec) + || CSSComputedStyleDeclaration::create(element)->getPropertyValue(cssPropertyID("cursor")) == "pointer"; +} + +static bool isValidFrameOwner(Element* element) +{ + ASSERT(element); + return element->isFrameOwnerElement() && static_cast<HTMLFrameOwnerElement*>(element)->contentFrame(); +} + +QWebPageAdapter::TouchAdjuster::TouchAdjuster(unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding) + : m_topPadding(topPadding) + , m_rightPadding(rightPadding) + , m_bottomPadding(bottomPadding) + , m_leftPadding(leftPadding) +{ +} + +IntPoint QWebPageAdapter::TouchAdjuster::findCandidatePointForTouch(const IntPoint& touchPoint, Document* document) const +{ + if (!document) + return IntPoint(); + + int x = touchPoint.x(); + int y = touchPoint.y(); + + RefPtr<NodeList> intersectedNodes = document->nodesFromRect(x, y, m_topPadding, m_rightPadding, m_bottomPadding, m_leftPadding, false /*ignoreClipping*/, false /*allowShadowContent*/); + if (!intersectedNodes) + return IntPoint(); + + Element* closestClickableElement = 0; + IntRect largestIntersectionRect; + FrameView* view = document->frame()->view(); + + // Touch rect in contents coordinates. + IntRect touchRect(HitTestLocation::rectForPoint(view->windowToContents(IntPoint(x, y)), m_topPadding, m_rightPadding, m_bottomPadding, m_leftPadding)); + + // Iterate over the list of nodes hit looking for the one whose bounding area + // has largest intersection with the touch area (point + padding). + for (unsigned i = 0; i < intersectedNodes->length(); i++) { + Node* currentNode = intersectedNodes->item(i); + + Element* currentElement = currentNode->isElementNode() ? toElement(currentNode) : 0; + if (!currentElement || (!isClickableElement(currentElement, 0) && !isValidFrameOwner(currentElement))) + continue; + + IntRect currentElementBoundingRect = currentElement->pixelSnappedBoundingBox(); + currentElementBoundingRect.intersect(touchRect); + + if (currentElementBoundingRect.isEmpty()) + continue; + + int currentIntersectionRectArea = currentElementBoundingRect.width() * currentElementBoundingRect.height(); + int largestIntersectionRectArea = largestIntersectionRect.width() * largestIntersectionRect.height(); + if (currentIntersectionRectArea > largestIntersectionRectArea) { + closestClickableElement = currentElement; + largestIntersectionRect = currentElementBoundingRect; + } + } + + if (largestIntersectionRect.isEmpty()) + return IntPoint(); + + // Handle the case when user taps a inner frame. It is done in three steps: + // 1) Transform the original touch point to the inner document coordinates; + // 1) Call nodesFromRect for the inner document in case; + // 3) Re-add the inner frame offset (location) before passing the new clicking + // position to WebCore. + if (closestClickableElement->isFrameOwnerElement()) { + // Adjust client coordinates' origin to be top left of inner frame viewport. + RefPtr<ClientRect> rect = closestClickableElement->getBoundingClientRect(); + IntPoint newTouchPoint = touchPoint; + IntSize offset = IntSize(rect->left(), rect->top()); + newTouchPoint -= offset; + + HTMLFrameOwnerElement* owner = static_cast<HTMLFrameOwnerElement*>(closestClickableElement); + Document* childDocument = owner->contentFrame()->document(); + return findCandidatePointForTouch(newTouchPoint, childDocument); + } + return view->contentsToWindow(largestIntersectionRect).center(); +} + +void QWebPageAdapter::mouseMoveEvent(QMouseEvent* ev) +{ + WebCore::Frame* frame = mainFrameAdapter()->frame; + if (!frame->view()) + return; + + bool accepted = frame->eventHandler()->mouseMoved(convertMouseEvent(ev, 0)); + ev->setAccepted(accepted); +} + +void QWebPageAdapter::mousePressEvent(QMouseEvent* ev) +{ + WebCore::Frame* frame = mainFrameAdapter()->frame; + if (!frame->view()) + return; + + RefPtr<WebCore::Node> oldNode; + Frame* focusedFrame = page->focusController()->focusedFrame(); + if (Document* focusedDocument = focusedFrame ? focusedFrame->document() : 0) + oldNode = focusedDocument->focusedNode(); + + if (tripleClickTimer.isActive() + && (ev->pos() - tripleClick).manhattanLength() < qGuiApp->styleHints()->startDragDistance()) { + mouseTripleClickEvent(ev); + return; + } + + bool accepted = false; + PlatformMouseEvent mev = convertMouseEvent(ev, 1); + // ignore the event if we can't map Qt's mouse buttons to WebCore::MouseButton + if (mev.button() != NoButton) + accepted = frame->eventHandler()->handleMousePressEvent(mev); + ev->setAccepted(accepted); + + RefPtr<WebCore::Node> newNode; + focusedFrame = page->focusController()->focusedFrame(); + if (Document* focusedDocument = focusedFrame ? focusedFrame->document() : 0) + newNode = focusedDocument->focusedNode(); + + if (newNode && oldNode != newNode) + clickCausedFocus = true; +} + +void QWebPageAdapter::mouseDoubleClickEvent(QMouseEvent *ev) +{ + WebCore::Frame* frame = mainFrameAdapter()->frame; + if (!frame->view()) + return; + + bool accepted = false; + PlatformMouseEvent mev = convertMouseEvent(ev, 2); + // ignore the event if we can't map Qt's mouse buttons to WebCore::MouseButton + if (mev.button() != NoButton) + accepted = frame->eventHandler()->handleMousePressEvent(mev); + ev->setAccepted(accepted); + + tripleClickTimer.start(qGuiApp->styleHints()->mouseDoubleClickInterval(), handle()); + tripleClick = QPointF(ev->pos()).toPoint(); +} + +void QWebPageAdapter::mouseTripleClickEvent(QMouseEvent *ev) +{ + WebCore::Frame* frame = mainFrameAdapter()->frame; + if (!frame->view()) + return; + + bool accepted = false; + PlatformMouseEvent mev = convertMouseEvent(ev, 3); + // ignore the event if we can't map Qt's mouse buttons to WebCore::MouseButton + if (mev.button() != NoButton) + accepted = frame->eventHandler()->handleMousePressEvent(mev); + ev->setAccepted(accepted); +} + +void QWebPageAdapter::mouseReleaseEvent(QMouseEvent *ev) +{ + WebCore::Frame* frame = mainFrameAdapter()->frame; + if (!frame->view()) + return; + + bool accepted = false; + PlatformMouseEvent mev = convertMouseEvent(ev, 0); + // ignore the event if we can't map Qt's mouse buttons to WebCore::MouseButton + if (mev.button() != NoButton) + accepted = frame->eventHandler()->handleMouseReleaseEvent(mev); + ev->setAccepted(accepted); + + handleSoftwareInputPanel(ev->button(), QPointF(ev->pos()).toPoint()); +} + +void QWebPageAdapter::handleSoftwareInputPanel(Qt::MouseButton button, const QPoint& pos) +{ + Frame* frame = page->focusController()->focusedFrame(); + if (!frame) + return; + + if (client && client->inputMethodEnabled() + && frame->document()->focusedNode() + && button == Qt::LeftButton && qGuiApp->property("autoSipEnabled").toBool()) { + if (!clickCausedFocus || requestSoftwareInputPanel()) { + HitTestResult result = frame->eventHandler()->hitTestResultAtPoint(frame->view()->windowToContents(pos), false); + if (result.isContentEditable()) { + QEvent event(QEvent::RequestSoftwareInputPanel); + QGuiApplication::sendEvent(client->ownerWidget(), &event); + } + } + } + + clickCausedFocus = false; +} + +#ifndef QT_NO_WHEELEVENT +void QWebPageAdapter::wheelEvent(QWheelEvent *ev, int wheelScrollLines) +{ + WebCore::Frame* frame = mainFrameAdapter()->frame; + if (!frame->view()) + return; + + PlatformWheelEvent pev = convertWheelEvent(ev, wheelScrollLines); + bool accepted = frame->eventHandler()->handleWheelEvent(pev); + ev->setAccepted(accepted); +} +#endif // QT_NO_WHEELEVENT + +#ifndef QT_NO_DRAGANDDROP + +Qt::DropAction QWebPageAdapter::dragEntered(const QMimeData *data, const QPoint &pos, Qt::DropActions possibleActions) +{ + DragData dragData(data, pos, QCursor::pos(), dropActionToDragOp(possibleActions)); + return dragOpToDropAction(page->dragController()->dragEntered(&dragData).operation); +} + +void QWebPageAdapter::dragLeaveEvent() +{ + DragData dragData(0, IntPoint(), QCursor::pos(), DragOperationNone); + page->dragController()->dragExited(&dragData); +} + +Qt::DropAction QWebPageAdapter::dragUpdated(const QMimeData *data, const QPoint &pos, Qt::DropActions possibleActions) +{ + DragData dragData(data, pos, QCursor::pos(), dropActionToDragOp(possibleActions)); + return dragOpToDropAction(page->dragController()->dragUpdated(&dragData).operation); +} + +bool QWebPageAdapter::performDrag(const QMimeData *data, const QPoint &pos, Qt::DropActions possibleActions) +{ + DragData dragData(data, pos, QCursor::pos(), dropActionToDragOp(possibleActions)); + return page->dragController()->performDrag(&dragData); +} + +void QWebPageAdapter::inputMethodEvent(QInputMethodEvent *ev) +{ + WebCore::Frame *frame = page->focusController()->focusedOrMainFrame(); + WebCore::Editor *editor = frame->editor(); + + if (!editor->canEdit()) { + ev->ignore(); + return; + } + + Node* node = 0; + if (frame->selection()->rootEditableElement()) + node = frame->selection()->rootEditableElement()->shadowAncestorNode(); + + Vector<CompositionUnderline> underlines; + bool hasSelection = false; + + for (int i = 0; i < ev->attributes().size(); ++i) { + const QInputMethodEvent::Attribute& a = ev->attributes().at(i); + switch (a.type) { + case QInputMethodEvent::TextFormat: { + QTextCharFormat textCharFormat = a.value.value<QTextFormat>().toCharFormat(); + QColor qcolor = textCharFormat.underlineColor(); + underlines.append(CompositionUnderline(qMin(a.start, (a.start + a.length)), qMax(a.start, (a.start + a.length)), Color(makeRGBA(qcolor.red(), qcolor.green(), qcolor.blue(), qcolor.alpha())), false)); + break; + } + case QInputMethodEvent::Cursor: { + frame->selection()->setCaretVisible(a.length); // if length is 0 cursor is invisible + if (a.length > 0) { + RenderObject* caretRenderer = frame->selection()->caretRenderer(); + if (caretRenderer) { + QColor qcolor = a.value.value<QColor>(); + caretRenderer->style()->setColor(Color(makeRGBA(qcolor.red(), qcolor.green(), qcolor.blue(), qcolor.alpha()))); + } + } + break; + } + case QInputMethodEvent::Selection: { + hasSelection = true; + // A selection in the inputMethodEvent is always reflected in the visible text + if (node) { + if (HTMLTextFormControlElement* textControl = toTextFormControl(node)) + textControl->setSelectionRange(qMin(a.start, (a.start + a.length)), qMax(a.start, (a.start + a.length))); + } + + if (!ev->preeditString().isEmpty()) + editor->setComposition(ev->preeditString(), underlines, qMin(a.start, (a.start + a.length)), qMax(a.start, (a.start + a.length))); + else { + // If we are in the middle of a composition, an empty pre-edit string and a selection of zero + // cancels the current composition + if (editor->hasComposition() && !(a.start + a.length)) + editor->setComposition(QString(), underlines, 0, 0); + } + break; + } + default: + break; + } + } + + if (node && ev->replacementLength() > 0) { + int cursorPos = frame->selection()->extent().offsetInContainerNode(); + int start = cursorPos + ev->replacementStart(); + if (HTMLTextFormControlElement* textControl = toTextFormControl(node)) + textControl->setSelectionRange(start, start + ev->replacementLength()); + // Commit regardless of whether commitString is empty, to get rid of selection. + editor->confirmComposition(ev->commitString()); + } else if (!ev->commitString().isEmpty()) { + if (editor->hasComposition()) + editor->confirmComposition(ev->commitString()); + else + editor->insertText(ev->commitString(), 0); + } else if (!hasSelection && !ev->preeditString().isEmpty()) + editor->setComposition(ev->preeditString(), underlines, 0, 0); + else if (ev->preeditString().isEmpty() && editor->hasComposition()) + editor->confirmComposition(String()); + + ev->accept(); +} + +QVariant QWebPageAdapter::inputMethodQuery(Qt::InputMethodQuery property) const +{ + Frame* frame = page->focusController()->focusedFrame(); + if (!frame) + return QVariant(); + + WebCore::Editor* editor = frame->editor(); + + RenderObject* renderer = 0; + RenderTextControl* renderTextControl = 0; + + if (frame->selection()->rootEditableElement()) + renderer = frame->selection()->rootEditableElement()->shadowAncestorNode()->renderer(); + + if (renderer && renderer->isTextControl()) + renderTextControl = toRenderTextControl(renderer); + + switch (property) { + case Qt::ImMicroFocus: { + WebCore::FrameView* view = frame->view(); + if (view && view->needsLayout()) { + // We can't access absoluteCaretBounds() while the view needs to layout. + return QVariant(); + } + return QVariant(view->contentsToWindow(frame->selection()->absoluteCaretBounds())); + } + case Qt::ImFont: { + if (renderTextControl) { + RenderStyle* renderStyle = renderTextControl->style(); + return QVariant(QFont(renderStyle->font().syntheticFont())); + } + return QVariant(QFont()); + } + case Qt::ImCursorPosition: { + if (editor->hasComposition()) + return QVariant(frame->selection()->end().offsetInContainerNode()); + return QVariant(frame->selection()->extent().offsetInContainerNode()); + } + case Qt::ImSurroundingText: { + if (renderTextControl && renderTextControl->textFormControlElement()) { + QString text = renderTextControl->textFormControlElement()->value(); + RefPtr<Range> range = editor->compositionRange(); + if (range) + text.remove(range->startPosition().offsetInContainerNode(), TextIterator::rangeLength(range.get())); + return QVariant(text); + } + return QVariant(); + } + case Qt::ImCurrentSelection: { + if (!editor->hasComposition() && renderTextControl && renderTextControl->textFormControlElement()) { + int start = frame->selection()->start().offsetInContainerNode(); + int end = frame->selection()->end().offsetInContainerNode(); + if (end > start) + return QVariant(QString(renderTextControl->textFormControlElement()->value()).mid(start, end - start)); + } + return QVariant(); + + } + case Qt::ImAnchorPosition: { + if (editor->hasComposition()) + return QVariant(frame->selection()->start().offsetInContainerNode()); + return QVariant(frame->selection()->base().offsetInContainerNode()); + } + case Qt::ImMaximumTextLength: { + if (frame->selection()->isContentEditable()) { + if (frame->document() && frame->document()->focusedNode()) { + if (frame->document()->focusedNode()->hasTagName(HTMLNames::inputTag)) { + HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(frame->document()->focusedNode()); + return QVariant(inputElement->maxLength()); + } + } + return QVariant(HTMLInputElement::maximumLength); + } + return QVariant(0); + } + default: + return QVariant(); + } +} + +typedef struct { + const char* name; + double deferredRepaintDelay; + double initialDeferredRepaintDelayDuringLoading; + double maxDeferredRepaintDelayDuringLoading; + double deferredRepaintDelayIncrementDuringLoading; +} QRepaintThrottlingPreset; + +void QWebPageAdapter::dynamicPropertyChangeEvent(QObject* obj, QDynamicPropertyChangeEvent* event) +{ + if (event->propertyName() == "_q_viewMode") { + page->setViewMode(Page::stringToViewMode(obj->property("_q_viewMode").toString())); + } else if (event->propertyName() == "_q_HTMLTokenizerChunkSize") { + int chunkSize = obj->property("_q_HTMLTokenizerChunkSize").toInt(); + page->setCustomHTMLTokenizerChunkSize(chunkSize); + } else if (event->propertyName() == "_q_HTMLTokenizerTimeDelay") { + double timeDelay = obj->property("_q_HTMLTokenizerTimeDelay").toDouble(); + page->setCustomHTMLTokenizerTimeDelay(timeDelay); + } else if (event->propertyName() == "_q_RepaintThrottlingDeferredRepaintDelay") { + double p = obj->property("_q_RepaintThrottlingDeferredRepaintDelay").toDouble(); + FrameView::setRepaintThrottlingDeferredRepaintDelay(p); + } else if (event->propertyName() == "_q_RepaintThrottlingnInitialDeferredRepaintDelayDuringLoading") { + double p = obj->property("_q_RepaintThrottlingnInitialDeferredRepaintDelayDuringLoading").toDouble(); + FrameView::setRepaintThrottlingnInitialDeferredRepaintDelayDuringLoading(p); + } else if (event->propertyName() == "_q_RepaintThrottlingMaxDeferredRepaintDelayDuringLoading") { + double p = obj->property("_q_RepaintThrottlingMaxDeferredRepaintDelayDuringLoading").toDouble(); + FrameView::setRepaintThrottlingMaxDeferredRepaintDelayDuringLoading(p); + } else if (event->propertyName() == "_q_RepaintThrottlingDeferredRepaintDelayIncrementDuringLoading") { + double p = obj->property("_q_RepaintThrottlingDeferredRepaintDelayIncrementDuringLoading").toDouble(); + FrameView::setRepaintThrottlingDeferredRepaintDelayIncrementDuringLoading(p); + } else if (event->propertyName() == "_q_RepaintThrottlingPreset") { + static const QRepaintThrottlingPreset presets[] = { + { "NoThrottling", 0, 0, 0, 0 }, + { "Legacy", 0.025, 0, 2.5, 0.5 }, + { "Minimal", 0.01, 0, 1, 0.2 }, + { "Medium", 0.025, 1, 5, 0.5 }, + { "Heavy", 0.1, 2, 10, 1 } + }; + + QString p = obj->property("_q_RepaintThrottlingPreset").toString(); + for (size_t i = 0; i < sizeof(presets) / sizeof(presets[0]); i++) { + if (p == QLatin1String(presets[i].name)) { + FrameView::setRepaintThrottlingDeferredRepaintDelay(presets[i].deferredRepaintDelay); + FrameView::setRepaintThrottlingnInitialDeferredRepaintDelayDuringLoading(presets[i].initialDeferredRepaintDelayDuringLoading); + FrameView::setRepaintThrottlingMaxDeferredRepaintDelayDuringLoading(presets[i].maxDeferredRepaintDelayDuringLoading); + FrameView::setRepaintThrottlingDeferredRepaintDelayIncrementDuringLoading(presets[i].deferredRepaintDelayIncrementDuringLoading); + break; + } + } + } else if (event->propertyName() == "_q_webInspectorServerPort") { +#if ENABLE(INSPECTOR) + QVariant port = obj->property("_q_webInspectorServerPort"); + if (port.isValid()) { + InspectorServerQt* inspectorServer = InspectorServerQt::server(); + inspectorServer->listen(port.toInt()); + } +#endif + } else if (event->propertyName() == "_q_deadDecodedDataDeletionInterval") { + double interval = obj->property("_q_deadDecodedDataDeletionInterval").toDouble(); + memoryCache()->setDeadDecodedDataDeletionInterval(interval); + } +} + +#endif // QT_NO_DRAGANDDROP + +#define MAP_ACTION_FROM_VALUE(Name, Value) \ + case Value: return QWebPageAdapter::Name + +static QWebPageAdapter::MenuAction adapterActionForContextMenuAction(WebCore::ContextMenuAction action) +{ + switch (action) { + FOR_EACH_MAPPED_MENU_ACTION(MAP_ACTION_FROM_VALUE, SEMICOLON_SEPARATOR); +#if ENABLE(INSPECTOR) + case WebCore::ContextMenuItemTagInspectElement: + return QWebPageAdapter::InspectElement; +#endif + default: + break; + } + return QWebPageAdapter::NoAction; +} + +QList<MenuItem> descriptionForPlatformMenu(const QList<ContextMenuItem>* items, Page* page) +{ + QList<MenuItem> itemDescriptions; + if (!items) + return itemDescriptions; + for (int i = 0; i < items->count(); ++i) { + const ContextMenuItem &item = items->at(i); + MenuItem description; + switch (item.type()) { + case WebCore::CheckableActionType: /* fall through */ + case WebCore::ActionType: { + QWebPageAdapter::MenuAction action = adapterActionForContextMenuAction(item.action()); + if (action > QWebPageAdapter::NoAction) { + description.type = MenuItem::Action; + description.action = action; + ContextMenuItem it(item); + page->contextMenuController()->checkOrEnableIfNeeded(it); + PlatformMenuItemDescription desc = it.releasePlatformDescription(); + if (desc.enabled) + description.traits |= MenuItem::Enabled; + if (item.type() == WebCore::CheckableActionType) { + description.traits |= MenuItem::Checkable; + if (desc.checked) + description.traits |= MenuItem::Checked; + } + } + break; + } + case WebCore::SeparatorType: + description.type = MenuItem::Separator; + break; + case WebCore::SubmenuType: { + description.type = MenuItem::SubMenu; + description.subMenu = descriptionForPlatformMenu(item.platformSubMenu(), page); + description.subMenuTitle = item.title(); + // Don't append empty submenu descriptions. + if (description.subMenu.isEmpty()) + continue; + } + } + if (description.type > MenuItem::NoType) + itemDescriptions.append(description); + } + return itemDescriptions; +} + +QWebHitTestResultPrivate* QWebPageAdapter::updatePositionDependentMenuActions(const QPoint& pos, QBitArray* visitedWebActions) +{ + ASSERT(visitedWebActions); + WebCore::Frame* focusedFrame = page->focusController()->focusedOrMainFrame(); + HitTestResult result = focusedFrame->eventHandler()->hitTestResultAtPoint(focusedFrame->view()->windowToContents(pos), /*allowShadowContent*/ false); + page->contextMenuController()->setHitTestResult(result); + +#if ENABLE(INSPECTOR) + if (page->inspectorController()->enabled()) + page->contextMenuController()->addInspectElementItem(); +#endif + + WebCore::ContextMenu* webcoreMenu = page->contextMenuController()->contextMenu(); + QList<MenuItem> itemDescriptions; + if (client && webcoreMenu) + itemDescriptions = descriptionForPlatformMenu(webcoreMenu->platformDescription(), page); + createAndSetCurrentContextMenu(itemDescriptions, visitedWebActions); + if (result.scrollbar()) + return 0; + return new QWebHitTestResultPrivate(result); +} + +static void extractContentTypeFromHash(const HashSet<String>& types, QStringList* list) +{ + if (!list) + return; + + HashSet<String>::const_iterator endIt = types.end(); + for (HashSet<String>::const_iterator it = types.begin(); it != endIt; ++it) + *list << *it; +} + +static void extractContentTypeFromPluginVector(const Vector<PluginPackage*>& plugins, QStringList* list) +{ + if (!list) + return; + + for (unsigned i = 0; i < plugins.size(); ++i) { + MIMEToDescriptionsMap::const_iterator it = plugins[i]->mimeToDescriptions().begin(); + MIMEToDescriptionsMap::const_iterator end = plugins[i]->mimeToDescriptions().end(); + for (; it != end; ++it) + *list << it->key; + } +} + +QStringList QWebPageAdapter::supportedContentTypes() const +{ + QStringList mimeTypes; + + extractContentTypeFromHash(MIMETypeRegistry::getSupportedImageMIMETypes(), &mimeTypes); + extractContentTypeFromHash(MIMETypeRegistry::getSupportedNonImageMIMETypes(), &mimeTypes); + if (page->settings() && page->settings()->arePluginsEnabled()) + extractContentTypeFromPluginVector(PluginDatabase::installedPlugins()->plugins(), &mimeTypes); + + return mimeTypes; +} + +void QWebPageAdapter::_q_cleanupLeakMessages() +{ +#ifndef NDEBUG + // Need this to make leak messages accurate. + memoryCache()->setCapacities(0, 0, 0); +#endif +} + +void QWebPageAdapter::_q_onLoadProgressChanged(int) +{ + m_totalBytes = page->progress()->totalPageAndResourceBytesToLoad(); + m_bytesReceived = page->progress()->totalBytesReceived(); +} + +bool QWebPageAdapter::supportsContentType(const QString& mimeType) const +{ + const String type = mimeType.toLower(); + if (MIMETypeRegistry::isSupportedImageMIMEType(type)) + return true; + + if (MIMETypeRegistry::isSupportedNonImageMIMEType(type)) + return true; + + if (page->settings() && page->settings()->arePluginsEnabled() + && PluginDatabase::installedPlugins()->isMIMETypeRegistered(type)) + return true; + + return false; +} + +void QWebPageAdapter::didShowInspector() +{ +#if ENABLE(INSPECTOR) + page->inspectorController()->show(); +#endif +} + +void QWebPageAdapter::didCloseInspector() +{ +#if ENABLE(INSPECTOR) + page->inspectorController()->close(); +#endif +} + +void QWebPageAdapter::updateActionInternal(QWebPageAdapter::MenuAction action, const char* commandName, bool* enabled, bool* checked) +{ + WebCore::FrameLoader* loader = mainFrameAdapter()->frame->loader(); + WebCore::Editor* editor = page->focusController()->focusedOrMainFrame()->editor(); + + switch (action) { + case QWebPageAdapter::Back: + *enabled = page->canGoBackOrForward(-1); + break; + case QWebPageAdapter::Forward: + *enabled = page->canGoBackOrForward(1); + break; + case QWebPageAdapter::Stop: + *enabled = loader->isLoading(); + break; + case QWebPageAdapter::Reload: + *enabled = !loader->isLoading(); + break; + case QWebPageAdapter::SetTextDirectionDefault: + case QWebPageAdapter::SetTextDirectionLeftToRight: + case QWebPageAdapter::SetTextDirectionRightToLeft: + *enabled = editor->canEdit(); + *checked = false; + break; + default: { + + // if it's an editor command, let its logic determine state + if (commandName) { + Editor::Command command = editor->command(commandName); + *enabled = command.isEnabled(); + if (*enabled) + *checked = command.state() != FalseTriState; + else + *checked = false; + } + break; + } + } +} + +void QWebPageAdapter::triggerAction(QWebPageAdapter::MenuAction action, QWebHitTestResultPrivate* hitTestResult, const char* commandName, bool endToEndReload) +{ + Frame* frame = page->focusController()->focusedOrMainFrame(); + if (!frame) + return; + Editor* editor = frame->editor(); + + // Convenience + QWebHitTestResultPrivate hitTest; + if (!hitTestResult) + hitTestResult = &hitTest; + + switch (action) { + case OpenLink: + if (Frame* targetFrame = hitTestResult->webCoreFrame) { + targetFrame->loader()->loadFrameRequest(frameLoadRequest(hitTestResult->linkUrl, targetFrame), /*lockHistory*/ false, /*lockBackForwardList*/ false, /*event*/ 0, /*FormState*/ 0, MaybeSendReferrer); + break; + } + // fall through + case OpenLinkInNewWindow: + openNewWindow(hitTestResult->linkUrl, frame); + break; + case OpenLinkInThisWindow: + frame->loader()->loadFrameRequest(frameLoadRequest(hitTestResult->linkUrl, frame), /*lockHistory*/ false, /*lockBackForwardList*/ false, /*event*/ 0, /*FormState*/ 0, MaybeSendReferrer); + break; + case OpenFrameInNewWindow: { + KURL url = frame->loader()->documentLoader()->unreachableURL(); + if (url.isEmpty()) + url = frame->loader()->documentLoader()->url(); + openNewWindow(url, frame); + break; + } + case CopyLinkToClipboard: { +#if defined(Q_WS_X11) + bool oldSelectionMode = Pasteboard::generalPasteboard()->isSelectionMode(); + Pasteboard::generalPasteboard()->setSelectionMode(true); + editor->copyURL(hitTestResult->linkUrl, hitTestResult->linkText); + Pasteboard::generalPasteboard()->setSelectionMode(oldSelectionMode); +#endif + editor->copyURL(hitTestResult->linkUrl, hitTestResult->linkText); + break; + } + case OpenImageInNewWindow: + openNewWindow(hitTestResult->imageUrl, frame); + break; + case DownloadImageToDisk: + frame->loader()->client()->startDownload(WebCore::ResourceRequest(hitTestResult->imageUrl, frame->loader()->outgoingReferrer())); + break; + case DownloadLinkToDisk: + frame->loader()->client()->startDownload(WebCore::ResourceRequest(hitTestResult->linkUrl, frame->loader()->outgoingReferrer())); + break; + case Back: + page->goBack(); + break; + case Forward: + page->goForward(); + break; + case Stop: + mainFrameAdapter()->frame->loader()->stopForUserCancel(); + updateNavigationActions(); + break; + case Reload: + mainFrameAdapter()->frame->loader()->reload(endToEndReload); + break; + + case SetTextDirectionDefault: + editor->setBaseWritingDirection(NaturalWritingDirection); + break; + case SetTextDirectionLeftToRight: + editor->setBaseWritingDirection(LeftToRightWritingDirection); + break; + case SetTextDirectionRightToLeft: + editor->setBaseWritingDirection(RightToLeftWritingDirection); + break; +#if ENABLE(INSPECTOR) + case InspectElement: { + ASSERT(hitTestResult != &hitTest); + page->inspectorController()->inspect(hitTestResult->innerNonSharedNode); + break; + } +#endif + default: + if (commandName) + editor->command(commandName).execute(); + break; + } +} + + +QString QWebPageAdapter::contextMenuItemTagForAction(QWebPageAdapter::MenuAction action, bool* checkable) const +{ + ASSERT(checkable); + switch (action) { + case OpenLink: + return contextMenuItemTagOpenLink(); + case OpenLinkInNewWindow: + return contextMenuItemTagOpenLinkInNewWindow(); + case OpenFrameInNewWindow: + return contextMenuItemTagOpenFrameInNewWindow(); + case OpenLinkInThisWindow: + return contextMenuItemTagOpenLinkInThisWindow(); + + case DownloadLinkToDisk: + return contextMenuItemTagDownloadLinkToDisk(); + case CopyLinkToClipboard: + return contextMenuItemTagCopyLinkToClipboard(); + + case OpenImageInNewWindow: + return contextMenuItemTagOpenImageInNewWindow(); + case DownloadImageToDisk: + return contextMenuItemTagDownloadImageToDisk(); + case CopyImageToClipboard: + return contextMenuItemTagCopyImageToClipboard(); + case CopyImageUrlToClipboard: + return contextMenuItemTagCopyImageUrlToClipboard(); + + case Cut: + return contextMenuItemTagCut(); + case Copy: + return contextMenuItemTagCopy(); + case Paste: + return contextMenuItemTagPaste(); + case SelectAll: + return contextMenuItemTagSelectAll(); + + case Back: + return contextMenuItemTagGoBack(); + case Forward: + return contextMenuItemTagGoForward(); + case Reload: + return contextMenuItemTagReload(); + case Stop: + return contextMenuItemTagStop(); + + case SetTextDirectionDefault: + return contextMenuItemTagDefaultDirection(); + case SetTextDirectionLeftToRight: + *checkable = true; + return contextMenuItemTagLeftToRight(); + case SetTextDirectionRightToLeft: + *checkable = true; + return contextMenuItemTagRightToLeft(); + + case ToggleBold: + *checkable = true; + return contextMenuItemTagBold(); + case ToggleItalic: + *checkable = true; + return contextMenuItemTagItalic(); + case ToggleUnderline: + *checkable = true; + return contextMenuItemTagUnderline(); + +#if ENABLE(INSPECTOR) + case InspectElement: + return contextMenuItemTagInspectElement(); +#endif + default: + ASSERT_NOT_REACHED(); + return QString(); + } +} + +#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) +void QWebPageAdapter::allowNotificationsForFrame(QWebFrameAdapter* frame) +{ + NotificationPresenterClientQt::notificationPresenter()->allowNotificationForFrame(frame->frame); +} + +void QWebPageAdapter::addNotificationPresenterClient() +{ + NotificationPresenterClientQt::notificationPresenter()->addClient(); +} + +#ifndef QT_NO_SYSTEMTRAYICON +bool QWebPageAdapter::hasSystemTrayIcon() const +{ + return NotificationPresenterClientQt::notificationPresenter()->hasSystemTrayIcon(); +} + +void QWebPageAdapter::setSystemTrayIcon(QObject *icon) +{ + NotificationPresenterClientQt::notificationPresenter()->setSystemTrayIcon(icon); +} +#endif // QT_NO_SYSTEMTRAYICON +#endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) + +#if ENABLE(GEOLOCATION) +void QWebPageAdapter::setGeolocationEnabledForFrame(QWebFrameAdapter* frame, bool on) +{ + GeolocationPermissionClientQt::geolocationPermissionClient()->setPermission(frame, on); +} +#endif + + +QString QWebPageAdapter::defaultUserAgentString() +{ + return UserAgentQt::standardUserAgent("", WEBKIT_MAJOR_VERSION, WEBKIT_MINOR_VERSION); +} + +bool QWebPageAdapter::treatSchemeAsLocal(const QString& scheme) +{ + return WebCore::SchemeRegistry::shouldTreatURLSchemeAsLocal(scheme); +} + +QObject* QWebPageAdapter::currentFrame() const +{ + Frame* frame = page->focusController()->focusedOrMainFrame(); + return frame->loader()->networkingContext()->originatingObject(); +} + +bool QWebPageAdapter::hasFocusedNode() const +{ + bool hasFocus = false; + Frame* frame = page->focusController()->focusedFrame(); + if (frame) { + Document* document = frame->document(); + hasFocus = document && document->focusedNode(); + } + return hasFocus; +} + +QWebPageAdapter::ViewportAttributes QWebPageAdapter::viewportAttributesForSize(const QSize &availableSize, const QSize &deviceSize) const +{ + static const int desktopWidth = 980; + + float devicePixelRatio = qt_defaultDpi() / WebCore::ViewportArguments::deprecatedTargetDPI; + + WebCore::ViewportAttributes conf = WebCore::computeViewportAttributes(viewportArguments(), desktopWidth, deviceSize.width(), deviceSize.height(), devicePixelRatio, availableSize); + WebCore::restrictMinimumScaleFactorToViewportSize(conf, availableSize, devicePixelRatio); + WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(conf); + + page->setDeviceScaleFactor(devicePixelRatio); + QWebPageAdapter::ViewportAttributes result; + + result.size = QSizeF(conf.layoutSize.width(), conf.layoutSize.height()); + result.initialScaleFactor = conf.initialScale; + result.minimumScaleFactor = conf.minimumScale; + result.maximumScaleFactor = conf.maximumScale; + result.devicePixelRatio = devicePixelRatio; + result.isUserScalable = static_cast<bool>(conf.userScalable); + + return result; +} + + +bool QWebPageAdapter::handleKeyEvent(QKeyEvent *ev) +{ + Frame* frame = page->focusController()->focusedOrMainFrame(); + return frame->eventHandler()->keyEvent(ev); +} + +bool QWebPageAdapter::handleScrolling(QKeyEvent *ev) +{ + Frame* frame = page->focusController()->focusedOrMainFrame(); + WebCore::ScrollDirection direction; + WebCore::ScrollGranularity granularity; + +#ifndef QT_NO_SHORTCUT + if (ev == QKeySequence::MoveToNextPage || (ev->key() == Qt::Key_Space && !(ev->modifiers() & Qt::ShiftModifier))) { + granularity = WebCore::ScrollByPage; + direction = WebCore::ScrollDown; + } else if (ev == QKeySequence::MoveToPreviousPage || ((ev->key() == Qt::Key_Space) && (ev->modifiers() & Qt::ShiftModifier))) { + granularity = WebCore::ScrollByPage; + direction = WebCore::ScrollUp; + } else +#endif // QT_NO_SHORTCUT + if ((ev->key() == Qt::Key_Up && ev->modifiers() & Qt::ControlModifier) || ev->key() == Qt::Key_Home) { + granularity = WebCore::ScrollByDocument; + direction = WebCore::ScrollUp; + } else if ((ev->key() == Qt::Key_Down && ev->modifiers() & Qt::ControlModifier) || ev->key() == Qt::Key_End) { + granularity = WebCore::ScrollByDocument; + direction = WebCore::ScrollDown; + } else { + switch (ev->key()) { + case Qt::Key_Up: + granularity = WebCore::ScrollByLine; + direction = WebCore::ScrollUp; + break; + case Qt::Key_Down: + granularity = WebCore::ScrollByLine; + direction = WebCore::ScrollDown; + break; + case Qt::Key_Left: + granularity = WebCore::ScrollByLine; + direction = WebCore::ScrollLeft; + break; + case Qt::Key_Right: + granularity = WebCore::ScrollByLine; + direction = WebCore::ScrollRight; + break; + default: + return false; + } + } + + return frame->eventHandler()->scrollRecursively(direction, granularity); +} + +void QWebPageAdapter::focusInEvent(QFocusEvent *) +{ + FocusController* focusController = page->focusController(); + focusController->setActive(true); + focusController->setFocused(true); + if (!focusController->focusedFrame()) + focusController->setFocusedFrame(mainFrameAdapter()->frame); +} + +void QWebPageAdapter::focusOutEvent(QFocusEvent *) +{ + // only set the focused frame inactive so that we stop painting the caret + // and the focus frame. But don't tell the focus controller so that upon + // focusInEvent() we can re-activate the frame. + FocusController* focusController = page->focusController(); + // Call setFocused first so that window.onblur doesn't get called twice + focusController->setFocused(false); + focusController->setActive(false); +} + +bool QWebPageAdapter::handleShortcutOverrideEvent(QKeyEvent* event) +{ + WebCore::Frame* frame = page->focusController()->focusedOrMainFrame(); + WebCore::Editor* editor = frame->editor(); + if (!editor->canEdit()) + return false; + if (event->modifiers() == Qt::NoModifier + || event->modifiers() == Qt::ShiftModifier + || event->modifiers() == Qt::KeypadModifier) { + if (event->key() < Qt::Key_Escape) + event->accept(); + else { + switch (event->key()) { + case Qt::Key_Return: + case Qt::Key_Enter: + case Qt::Key_Delete: + case Qt::Key_Home: + case Qt::Key_End: + case Qt::Key_Backspace: + case Qt::Key_Left: + case Qt::Key_Right: + case Qt::Key_Up: + case Qt::Key_Down: + case Qt::Key_Tab: + event->accept(); + default: + break; + } + } + } + return true; +} + +bool QWebPageAdapter::touchEvent(QTouchEvent* event) +{ +#if ENABLE(TOUCH_EVENTS) + Frame* frame = mainFrameAdapter()->frame; + if (!frame->view()) + return false; + + // Always accept the QTouchEvent so that we'll receive also TouchUpdate and TouchEnd events + event->setAccepted(true); + + // Return whether the default action was cancelled in the JS event handler + return frame->eventHandler()->handleTouchEvent(convertTouchEvent(event)); +#else + event->ignore(); + return false; +#endif +} + +bool QWebPageAdapter::swallowContextMenuEvent(QContextMenuEvent *event, QWebFrameAdapter *webFrame) +{ + // Check the first and last enum values match at least, since we cast. + ASSERT(int(QWebPageAdapter::ScrollUp) == int(WebCore::ScrollUp)); + ASSERT(int(QWebPageAdapter::ScrollRight) == int(WebCore::ScrollRight)); + ASSERT(int(QWebPageAdapter::ScrollByLine) == int(WebCore::ScrollByLine)); + ASSERT(int(QWebPageAdapter::ScrollByDocument) == int(WebCore::ScrollByDocument)); + + page->contextMenuController()->clearContextMenu(); + + if (webFrame) { + Frame* frame = webFrame->frame; + if (Scrollbar* scrollBar = frame->view()->scrollbarAtPoint(convertMouseEvent(event, 1).position())) { + bool horizontal = (scrollBar->orientation() == HorizontalScrollbar); + QWebPageAdapter::ScrollDirection direction = QWebPageAdapter::InvalidScrollDirection; + QWebPageAdapter::ScrollGranularity granularity = QWebPageAdapter::InvalidScrollGranularity; + bool scroll = handleScrollbarContextMenuEvent(event, horizontal, &direction, &granularity); + if (!scroll) + return true; + if (direction == QWebPageAdapter::InvalidScrollDirection || granularity == QWebPageAdapter::InvalidScrollGranularity) { + ScrollbarTheme* theme = scrollBar->theme(); + // Set the pressed position to the middle of the thumb so that when we + // do move, the delta will be from the current pixel position of the + // thumb to the new position + int position = theme->trackPosition(scrollBar) + theme->thumbPosition(scrollBar) + theme->thumbLength(scrollBar) / 2; + scrollBar->setPressedPos(position); + const QPoint pos = scrollBar->convertFromContainingWindow(event->pos()); + scrollBar->moveThumb(horizontal ? pos.x() : pos.y()); + } else + scrollBar->scrollableArea()->scroll(WebCore::ScrollDirection(direction), WebCore::ScrollGranularity(granularity)); + return true; + } + } + + WebCore::Frame* focusedFrame = page->focusController()->focusedOrMainFrame(); + focusedFrame->eventHandler()->sendContextMenuEvent(convertMouseEvent(event, 1)); + ContextMenu* menu = page->contextMenuController()->contextMenu(); + // If the website defines its own handler then sendContextMenuEvent takes care of + // calling/showing it and the context menu pointer will be zero. This is the case + // on maps.google.com for example. + + return !menu; +} diff --git a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h index 48298922e..87b4ecd14 100644 --- a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h +++ b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h @@ -22,29 +22,39 @@ #include "QWebPageClient.h" #include "ViewportArguments.h" +#include "qwebhistory.h" +#include <qbasictimer.h> +#include <qevent.h> #include <qnetworkrequest.h> #include <qrect.h> #include <qscopedpointer.h> #include <qsharedpointer.h> #include <qstring.h> #include <qurl.h> +#include <wtf/ExportMacros.h> QT_BEGIN_NAMESPACE +class QBitArray; class QKeyEvent; +class QMimeData; +class QMouseEvent; class QNetworkAccessManager; +class QWheelEvent; +class QInputMethodEvent; QT_END_NAMESPACE namespace WebCore { -class Page; class ChromeClientQt; class GeolocationClientQt; +class Page; class UndoStep; } class QtPluginWidgetAdapter; class QWebFrameAdapter; class QWebHistoryItem; +class QWebHitTestResultPrivate; class QWebPageClient; class QWebPluginFactory; class QWebSecurityOrigin; @@ -53,13 +63,75 @@ class QWebSettings; class QWebFullScreenVideoHandler; class UndoStepQt; - -class QWebPageAdapter { +class WEBKIT_EXPORTDATA QWebPageAdapter { public: + +#define FOR_EACH_MAPPED_MENU_ACTION(F, SEPARATOR) \ + F(OpenLink, WebCore::ContextMenuItemTagOpenLink) SEPARATOR \ + F(OpenLinkInNewWindow, WebCore::ContextMenuItemTagOpenLinkInNewWindow) SEPARATOR \ + F(OpenLinkInThisWindow, WebCore::ContextMenuItemTagOpenLinkInThisWindow) SEPARATOR \ + F(DownloadLinkToDisk, WebCore::ContextMenuItemTagDownloadLinkToDisk) SEPARATOR \ + F(CopyLinkToClipboard, WebCore::ContextMenuItemTagCopyLinkToClipboard) SEPARATOR \ + F(OpenImageInNewWindow, WebCore::ContextMenuItemTagOpenImageInNewWindow) SEPARATOR \ + F(DownloadImageToDisk, WebCore::ContextMenuItemTagDownloadImageToDisk) SEPARATOR \ + F(CopyImageToClipboard, WebCore::ContextMenuItemTagCopyImageToClipboard) SEPARATOR \ + F(CopyImageUrlToClipboard, WebCore::ContextMenuItemTagCopyImageUrlToClipboard) SEPARATOR \ + F(OpenFrameInNewWindow, WebCore::ContextMenuItemTagOpenFrameInNewWindow) SEPARATOR \ + F(Copy, WebCore::ContextMenuItemTagCopy) SEPARATOR \ + F(Back, WebCore::ContextMenuItemTagGoBack) SEPARATOR \ + F(Forward, WebCore::ContextMenuItemTagGoForward) SEPARATOR \ + F(Stop, WebCore::ContextMenuItemTagStop) SEPARATOR \ + F(Reload, WebCore::ContextMenuItemTagReload) SEPARATOR \ + F(Cut, WebCore::ContextMenuItemTagCut) SEPARATOR \ + F(Paste, WebCore::ContextMenuItemTagPaste) SEPARATOR \ + F(SetTextDirectionDefault, WebCore::ContextMenuItemTagDefaultDirection) SEPARATOR \ + F(SetTextDirectionLeftToRight, WebCore::ContextMenuItemTagLeftToRight) SEPARATOR \ + F(SetTextDirectionRightToLeft, WebCore::ContextMenuItemTagRightToLeft) SEPARATOR \ + F(ToggleBold, WebCore::ContextMenuItemTagBold) SEPARATOR \ + F(ToggleItalic, WebCore::ContextMenuItemTagItalic) SEPARATOR \ + F(ToggleUnderline, WebCore::ContextMenuItemTagUnderline) SEPARATOR \ + F(SelectAll, WebCore::ContextMenuItemTagSelectAll) +#define COMMA_SEPARATOR , +#define SEMICOLON_SEPARATOR ; +#define DEFINE_ACTION(Name, Value) \ + Name + + enum MenuAction { + NoAction = - 1, + FOR_EACH_MAPPED_MENU_ACTION(DEFINE_ACTION, COMMA_SEPARATOR) +#if ENABLE(INSPECTOR) + , InspectElement +#endif + , ActionCount + }; + + // Duplicated from qwebpage.h + enum FindFlag { + FindBackward = 1, + FindCaseSensitively = 2, + FindWrapsAroundDocument = 4, + HighlightAllOccurrences = 8 + }; + + // valid values matching those from ScrollTypes.h + enum ScrollDirection { + InvalidScrollDirection = -1, + ScrollUp, + ScrollDown, + ScrollLeft, + ScrollRight + }; + // same here + enum ScrollGranularity { + InvalidScrollGranularity = -1, + ScrollByLine, + ScrollByPage, + ScrollByDocument + }; + 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. @@ -140,15 +212,135 @@ public: virtual bool errorPageExtension(ErrorPageOption*, ErrorPageReturn*) = 0; virtual QtPluginWidgetAdapter* createPlugin(const QString&, const QUrl&, const QStringList&, const QStringList&) = 0; virtual QtPluginWidgetAdapter* adapterForWidget(QObject*) const = 0; - + virtual bool requestSoftwareInputPanel() const = 0; + struct MenuItemDescription { + MenuItemDescription() + : type(NoType) + , action(NoAction) + , traits(None) + { } + enum Type { + NoType, + Action, + Separator, + SubMenu + } type; + MenuAction action; + enum Trait { + None = 0, + Enabled = 1, + Checkable = 2, + Checked = 4 + }; + Q_DECLARE_FLAGS(Traits, Trait); + Traits traits; + QList<MenuItemDescription> subMenu; + QString subMenuTitle; + }; + virtual void createAndSetCurrentContextMenu(const QList<MenuItemDescription>&, QBitArray*) = 0; + virtual bool handleScrollbarContextMenuEvent(QContextMenuEvent*, bool, ScrollDirection*, ScrollGranularity*) = 0; static QWebPageAdapter* kit(WebCore::Page*); - WebCore::ViewportArguments viewportArguments(); + WebCore::ViewportArguments viewportArguments() const; void registerUndoStep(WTF::PassRefPtr<WebCore::UndoStep>); void setNetworkAccessManager(QNetworkAccessManager*); QNetworkAccessManager* networkAccessManager(); + bool hasSelection() const; + QString selectedText() const; + QString selectedHtml() const; + + bool isContentEditable() const; + void setContentEditable(bool); + + bool findText(const QString& subString, FindFlag options); + + class TouchAdjuster { + public: + TouchAdjuster(unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding); + + WebCore::IntPoint findCandidatePointForTouch(const WebCore::IntPoint&, WebCore::Document*) const; + + private: + unsigned m_topPadding; + unsigned m_rightPadding; + unsigned m_bottomPadding; + unsigned m_leftPadding; + }; + + void adjustPointForClicking(QMouseEvent*); + + void mouseMoveEvent(QMouseEvent*); + void mousePressEvent(QMouseEvent*); + void mouseDoubleClickEvent(QMouseEvent*); + void mouseTripleClickEvent(QMouseEvent*); + void mouseReleaseEvent(QMouseEvent*); + void handleSoftwareInputPanel(Qt::MouseButton, const QPoint&); +#ifndef QT_NO_WHEELEVENT + void wheelEvent(QWheelEvent*, int wheelScrollLines); +#endif +#ifndef QT_NO_DRAGANDDROP + Qt::DropAction dragEntered(const QMimeData*, const QPoint&, Qt::DropActions); + void dragLeaveEvent(); + Qt::DropAction dragUpdated(const QMimeData*, const QPoint&, Qt::DropActions); + bool performDrag(const QMimeData*, const QPoint&, Qt::DropActions); +#endif + void inputMethodEvent(QInputMethodEvent*); + QVariant inputMethodQuery(Qt::InputMethodQuery property) const; + void dynamicPropertyChangeEvent(QObject*, QDynamicPropertyChangeEvent*); + bool handleKeyEvent(QKeyEvent*); + bool handleScrolling(QKeyEvent*); + void focusInEvent(QFocusEvent*); + void focusOutEvent(QFocusEvent*); + bool handleShortcutOverrideEvent(QKeyEvent*); + // Returns whether the default action was cancelled in the JS event handler + bool touchEvent(QTouchEvent*); + bool swallowContextMenuEvent(QContextMenuEvent *, QWebFrameAdapter*); + + QWebHitTestResultPrivate* updatePositionDependentMenuActions(const QPoint&, QBitArray*); + void updateActionInternal(MenuAction, const char* commandName, bool* enabled, bool* checked); + void triggerAction(MenuAction, QWebHitTestResultPrivate*, const char* commandName, bool endToEndReload); + QString contextMenuItemTagForAction(MenuAction, bool* checkable) const; + + QStringList supportedContentTypes() const; +#if ENABLE(GEOLOCATION) + void setGeolocationEnabledForFrame(QWebFrameAdapter*, bool); +#endif +#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) + void allowNotificationsForFrame(QWebFrameAdapter*); + void addNotificationPresenterClient(); +#ifndef QT_NO_SYSTEMTRAYICON + bool hasSystemTrayIcon() const; + void setSystemTrayIcon(QObject*); +#endif // QT_NO_SYSTEMTRAYICON +#endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) + + // Called from QWebPage as private slots. + void _q_cleanupLeakMessages(); + void _q_onLoadProgressChanged(int); + + bool supportsContentType(const QString& mimeType) const; + + void didShowInspector(); + void didCloseInspector(); + + static QString defaultUserAgentString(); + static bool treatSchemeAsLocal(const QString&); + + QObject* currentFrame() const; + bool hasFocusedNode() const; + struct ViewportAttributes { + qreal initialScaleFactor; + qreal minimumScaleFactor; + qreal maximumScaleFactor; + qreal devicePixelRatio; + bool isUserScalable; + QSizeF size; + }; + + ViewportAttributes viewportAttributesForSize(const QSize& availableSize, const QSize& deviceSize) const; + QWebSettings *settings; WebCore::Page *page; @@ -158,6 +350,13 @@ public: bool forwardUnsupportedContent; bool insideOpenCall; + QPoint tripleClick; + QBasicTimer tripleClickTimer; + + bool clickCausedFocus; + quint64 m_totalBytes; + quint64 m_bytesReceived; + QWebHistory history; private: QNetworkAccessManager *networkManager; diff --git a/Source/WebKit/qt/WebCoreSupport/QtPluginWidgetAdapter.cpp b/Source/WebKit/qt/WebCoreSupport/QtPluginWidgetAdapter.cpp new file mode 100644 index 000000000..ef54a5ab8 --- /dev/null +++ b/Source/WebKit/qt/WebCoreSupport/QtPluginWidgetAdapter.cpp @@ -0,0 +1,26 @@ +/* + * 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 "QtPluginWidgetAdapter.h" + +QtPluginWidgetAdapter::QtPluginWidgetAdapter() +{ +} diff --git a/Source/WebKit/qt/WebCoreSupport/QtPluginWidgetAdapter.h b/Source/WebKit/qt/WebCoreSupport/QtPluginWidgetAdapter.h index 8494d3db2..324de7866 100644 --- a/Source/WebKit/qt/WebCoreSupport/QtPluginWidgetAdapter.h +++ b/Source/WebKit/qt/WebCoreSupport/QtPluginWidgetAdapter.h @@ -20,13 +20,16 @@ #ifndef QtPluginWidgetAdapter_h #define QtPluginWidgetAdapter_h +#include <PlatformExportMacros.h> #include <QObject> #include <QRect> #include <QString> +#include <qwebkitglobal.h> -class QtPluginWidgetAdapter : public QObject { +class WEBKIT_EXPORTDATA QtPluginWidgetAdapter : public QObject { Q_OBJECT public: + QtPluginWidgetAdapter(); virtual void update(const QRect&) = 0; virtual void setGeometryAndClip(const QRect&, const QRect&, bool isVisible = false) = 0; virtual void setVisible(bool) = 0; diff --git a/Source/WebKit/qt/WebCoreSupport/QtPrintContext.cpp b/Source/WebKit/qt/WebCoreSupport/QtPrintContext.cpp new file mode 100644 index 000000000..378ec2c68 --- /dev/null +++ b/Source/WebKit/qt/WebCoreSupport/QtPrintContext.cpp @@ -0,0 +1,58 @@ +/* + * 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 "QtPrintContext.h" + +#include "GraphicsContext.h" +#include "IntRect.h" +#include "PrintContext.h" +#include "QWebFrameAdapter.h" + +using namespace WebCore; + +QtPrintContext::QtPrintContext(QPainter* painter, const QRect& pageRect, QWebFrameAdapter* frameAdapter) + : m_graphicsContext(new GraphicsContext(painter)) + , m_printContext(new PrintContext(frameAdapter->frame)) +{ + m_printContext->begin(pageRect.width(), pageRect.height()); + + float pageHeight = 0; + m_printContext->computePageRects(IntRect(pageRect), /* headerHeight */ 0, /* footerHeight */ 0, /* userScaleFactor */ 1.0, pageHeight); +} + +QtPrintContext::~QtPrintContext() +{ + m_printContext->end(); + delete m_graphicsContext; + delete m_printContext; +} + +int QtPrintContext::pageCount() const +{ + return m_printContext->pageCount(); +} + +void QtPrintContext::spoolPage(int pageNumber, float width) +{ + m_printContext->spoolPage(*m_graphicsContext, pageNumber, width); +} + + diff --git a/Source/WebCore/platform/qt/QStyleFacade.cpp b/Source/WebKit/qt/WebCoreSupport/QtPrintContext.h index 4707a2fc1..d6968da4a 100644 --- a/Source/WebCore/platform/qt/QStyleFacade.cpp +++ b/Source/WebKit/qt/WebCoreSupport/QtPrintContext.h @@ -1,8 +1,5 @@ /* - * This file is part of the theme implementation for form controls in WebCore. - * * Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). - * Copyright (C) 2011-2012 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 @@ -20,27 +17,32 @@ * Boston, MA 02110-1301, USA. * */ +#ifndef QtPrintContext_h +#define QtPrintContext_h -#include "config.h" -#include "QStyleFacade.h" - -#include "QWebPageClient.h" -#include <Chrome.h> -#include <ChromeClient.h> -#include <Page.h> +#include <QPainter> +#include <QRect> +#include <qwebkitglobal.h> +#include <wtf/ExportMacros.h> namespace WebCore { +class PrintContext; +class GraphicsContext; +} -QStyle* QStyleFacade::styleForPage(Page* page) -{ - if (!page) - return 0; - QWebPageClient* pageClient = page->chrome()->client()->platformPageClient(); +class QWebFrameAdapter; - if (!pageClient) - return 0; +class WEBKIT_EXPORTDATA QtPrintContext { +public: + QtPrintContext(QPainter*, const QRect& pageRect, QWebFrameAdapter*); + ~QtPrintContext(); - return pageClient->style(); -} + int pageCount() const; + void spoolPage(int pageNumber, float width); -} +private: + WebCore::GraphicsContext* m_graphicsContext; + WebCore::PrintContext* m_printContext; +}; + +#endif diff --git a/Source/WebKit/qt/WebCoreSupport/TextureMapperLayerClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/TextureMapperLayerClientQt.cpp new file mode 100644 index 000000000..4442bafff --- /dev/null +++ b/Source/WebKit/qt/WebCoreSupport/TextureMapperLayerClientQt.cpp @@ -0,0 +1,125 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * 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 "TextureMapperLayerClientQt.h" + +#if USE(ACCELERATED_COMPOSITING) + +#include "FrameView.h" +#include "QWebFrameAdapter.h" +#include "QWebPageAdapter.h" +#include "TextureMapperLayer.h" + +using namespace WebCore; + +TextureMapperLayerClientQt::TextureMapperLayerClientQt(QWebFrameAdapter* frame) + : m_frame(frame) + , m_syncTimer(this, &TextureMapperLayerClientQt::syncLayers) + , m_rootTextureMapperLayer(0) +{ +} + +TextureMapperLayerClientQt::~TextureMapperLayerClientQt() +{ + m_rootTextureMapperLayer = 0; +} + +void TextureMapperLayerClientQt::syncRootLayer() +{ + m_rootGraphicsLayer->flushCompositingStateForThisLayerOnly(); +} + +void TextureMapperLayerClientQt::markForSync(bool scheduleSync) +{ + if (m_syncTimer.isActive()) + return; + m_syncTimer.startOneShot(0); +} + +TextureMapperLayer* TextureMapperLayerClientQt::rootLayer() +{ + return toTextureMapperLayer(m_rootGraphicsLayer.get()); +} + +void TextureMapperLayerClientQt::setRootGraphicsLayer(GraphicsLayer* layer) +{ + if (layer) { + m_rootGraphicsLayer = GraphicsLayer::create(0); + m_rootTextureMapperLayer = toTextureMapperLayer(m_rootGraphicsLayer.get()); + m_rootGraphicsLayer->addChild(layer); + m_rootGraphicsLayer->setDrawsContent(false); + m_rootGraphicsLayer->setMasksToBounds(false); + m_rootGraphicsLayer->setSize(IntSize(1, 1)); + TextureMapper::AccelerationMode mode = TextureMapper::SoftwareMode; + if (m_frame->pageAdapter->client->makeOpenGLContextCurrentIfAvailable()) + mode = TextureMapper::OpenGLMode; + m_textureMapper = TextureMapper::create(mode); + m_rootTextureMapperLayer->setTextureMapper(m_textureMapper.get()); + syncRootLayer(); + } else { + m_rootGraphicsLayer.clear(); + m_rootTextureMapperLayer = 0; + } +} + +void TextureMapperLayerClientQt::syncLayers(Timer<TextureMapperLayerClientQt>*) +{ + if (m_rootGraphicsLayer) + syncRootLayer(); + + m_frame->frame->view()->flushCompositingStateIncludingSubframes(); + + if (!m_rootGraphicsLayer) + return; + + if (rootLayer()->descendantsOrSelfHaveRunningAnimations() && !m_syncTimer.isActive()) + m_syncTimer.startOneShot(1.0 / 60.0); + + m_frame->pageAdapter->client->repaintViewport(); +} + +void TextureMapperLayerClientQt::renderCompositedLayers(GraphicsContext* context, const IntRect& clip) +{ + if (!m_rootTextureMapperLayer || !m_textureMapper) + return; + + m_textureMapper->setGraphicsContext(context); + m_textureMapper->setImageInterpolationQuality(context->imageInterpolationQuality()); + m_textureMapper->setTextDrawingMode(context->textDrawingMode()); + QPainter* painter = context->platformContext(); + const QTransform transform = painter->worldTransform(); + const TransformationMatrix matrix( + transform.m11(), transform.m12(), 0, transform.m13(), + transform.m21(), transform.m22(), 0, transform.m23(), + 0, 0, 1, 0, + transform.m31(), transform.m32(), 0, transform.m33() + ); + m_rootTextureMapperLayer->setTransform(matrix); + m_rootTextureMapperLayer->setOpacity(painter->opacity()); + m_textureMapper->beginPainting(); + m_textureMapper->beginClip(matrix, clip); + m_rootTextureMapperLayer->paint(); + m_textureMapper->endClip(); + m_textureMapper->endPainting(); +} + +#endif diff --git a/Source/WebKit/qt/WebCoreSupport/TextureMapperLayerClientQt.h b/Source/WebKit/qt/WebCoreSupport/TextureMapperLayerClientQt.h new file mode 100644 index 000000000..67328cc99 --- /dev/null +++ b/Source/WebKit/qt/WebCoreSupport/TextureMapperLayerClientQt.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * 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 TextureMapperLayerClientQt_h +#define TextureMapperLayerClientQt_h + +class QWebFrameAdapter; + +#include "GraphicsLayer.h" +#include "TextureMapper.h" +#include "Timer.h" +#include <wtf/OwnPtr.h> + +namespace WebCore { + +class TextureMapperLayer; + +#if USE(ACCELERATED_COMPOSITING) +class TextureMapperLayerClientQt { +public: + TextureMapperLayerClientQt(QWebFrameAdapter*); + ~TextureMapperLayerClientQt(); + void syncRootLayer(); + TextureMapperLayer* rootLayer(); + + void markForSync(bool scheduleSync); + + void setRootGraphicsLayer(GraphicsLayer*); + + void syncLayers(Timer<TextureMapperLayerClientQt>*); + + void renderCompositedLayers(GraphicsContext*, const IntRect& clip); +private: + QWebFrameAdapter* m_frame; + OwnPtr<GraphicsLayer> m_rootGraphicsLayer; + Timer<TextureMapperLayerClientQt> m_syncTimer; + WebCore::TextureMapperLayer* m_rootTextureMapperLayer; + OwnPtr<WebCore::TextureMapper> m_textureMapper; +}; +#endif + +} + +#endif diff --git a/Source/WebKit/qt/WebCoreSupport/UndoStepQt.h b/Source/WebKit/qt/WebCoreSupport/UndoStepQt.h index 85d7991c3..4950c99f4 100644 --- a/Source/WebKit/qt/WebCoreSupport/UndoStepQt.h +++ b/Source/WebKit/qt/WebCoreSupport/UndoStepQt.h @@ -23,11 +23,12 @@ #include <UndoStep.h> #include <qstring.h> +#include <qwebkitglobal.h> +#include <wtf/ExportMacros.h> #include <wtf/RefPtr.h> -class UndoStepQt { +class WEBKIT_EXPORTDATA UndoStepQt { public: - UndoStepQt(WTF::RefPtr<WebCore::UndoStep>); ~UndoStepQt(); void redo(); @@ -35,9 +36,12 @@ class UndoStepQt { QString text() const; private: + UndoStepQt(WTF::RefPtr<WebCore::UndoStep>); + WTF::RefPtr<WebCore::UndoStep> m_step; bool m_first; QString m_text; + friend class QWebPageAdapter; }; #endif diff --git a/Source/WebKit/qt/Api/qgraphicswebview.cpp b/Source/WebKit/qt/WidgetApi/qgraphicswebview.cpp index 84b4e801b..9827d224e 100644 --- a/Source/WebKit/qt/Api/qgraphicswebview.cpp +++ b/Source/WebKit/qt/WidgetApi/qgraphicswebview.cpp @@ -23,32 +23,25 @@ #if !defined(QT_NO_GRAPHICSVIEW) +#include "PageClientQt.h" #include "qwebframe.h" #include "qwebframe_p.h" #include "qwebpage.h" #include "qwebpage_p.h" -#include "Page.h" -#include "PageClientQt.h" -#include "Frame.h" -#include "FrameView.h" -#include "GraphicsContext.h" -#include "IntRect.h" -#include "TiledBackingStore.h" #include <qapplication.h> #include <qgraphicsscene.h> #include <qgraphicssceneevent.h> #include <qgraphicsview.h> +#include <qmetaobject.h> +#include <qpixmapcache.h> #include <qscrollbar.h> +#include <qsharedpointer.h> #include <qstyleoption.h> -#include <QtCore/qmetaobject.h> -#include <QtCore/qsharedpointer.h> -#include <QtCore/qtimer.h> -#include <QtGui/qpixmapcache.h> +#include <qtimer.h> #if defined(Q_WS_X11) #include <QX11Info> #endif -#include <Settings.h> using namespace WebCore; @@ -58,12 +51,11 @@ public: : q(parent) , page(0) , resizesToContents(false) - , renderHints(QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform) {} + , renderHints(QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform) + { } virtual ~QGraphicsWebViewPrivate(); - void syncLayers(); - void updateResizesToContentsForPage(); void detachCurrentPage(); @@ -97,13 +89,6 @@ QGraphicsWebViewPrivate::~QGraphicsWebViewPrivate() detachCurrentPage(); } -void QGraphicsWebViewPrivate::syncLayers() -{ -#if USE(ACCELERATED_COMPOSITING) - pageClient()->syncLayers(); -#endif -} - void QGraphicsWebViewPrivate::_q_doLoadFinished(bool success) { // If the page had no title, still make sure it gets the signal @@ -132,10 +117,10 @@ void QGraphicsWebViewPrivate::updateResizesToContentsForPage() q, SLOT(_q_contentsSizeChanged(const QSize&)), Qt::UniqueConnection); } else { QObject::disconnect(page->mainFrame(), SIGNAL(contentsSizeChanged(QSize)), - q, SLOT(_q_contentsSizeChanged(const QSize&))); + q, SLOT(_q_contentsSizeChanged(const QSize&))); } - page->d->page->mainFrame()->view()->setPaintsEntireContents(resizesToContents); - page->d->page->mainFrame()->view()->setDelegatesScrolling(resizesToContents); + page->d->mainFrameAdapter()->setPaintsEntireContents(resizesToContents); + page->d->mainFrameAdapter()->setDelegatesScrolling(resizesToContents); } void QGraphicsWebViewPrivate::_q_contentsSizeChanged(const QSize& size) @@ -150,7 +135,7 @@ void QGraphicsWebViewPrivate::_q_scaleChanged() #if USE(TILED_BACKING_STORE) if (!page) return; - pageClient()->updateTiledBackingStoreScale(); + page->d->mainFrameAdapter()->setTiledBackingStoreContentsScale(q->scale()); #endif } @@ -286,12 +271,8 @@ void QGraphicsWebView::paint(QPainter* painter, const QStyleOptionGraphicsItem* QPainter::RenderHints oldHints = painter->renderHints(); painter->setRenderHints(oldHints | d->renderHints); #if USE(TILED_BACKING_STORE) - if (WebCore::TiledBackingStore* backingStore = QWebFramePrivate::core(page()->mainFrame())->tiledBackingStore()) { - // FIXME: We should set the backing store viewport earlier than in paint - backingStore->coverWithTilesIfNeeded(); - // QWebFrame::render is a public API, bypass it for tiled rendering so behavior does not need to change. - WebCore::GraphicsContext context(painter); - page()->mainFrame()->d->renderFromTiledBackingStore(&context, option->exposedRect.toAlignedRect()); + // QWebFrame::render is a public API, bypass it for tiled rendering so behavior does not need to change. + if (page()->mainFrame()->d->renderFromTiledBackingStore(painter, option->exposedRect.toAlignedRect())) { painter->setRenderHints(oldHints); return; } @@ -307,10 +288,9 @@ bool QGraphicsWebView::sceneEvent(QEvent* event) // Re-implemented in order to allows fixing event-related bugs in patch releases. if (d->page && (event->type() == QEvent::TouchBegin - || event->type() == QEvent::TouchEnd - || event->type() == QEvent::TouchUpdate - || event->type() == QEvent::TouchCancel - )) { + || event->type() == QEvent::TouchEnd + || event->type() == QEvent::TouchUpdate + || event->type() == QEvent::TouchCancel)) { d->page->event(event); // Always return true so that we'll receive also TouchUpdate and TouchEnd events @@ -334,10 +314,10 @@ QVariant QGraphicsWebView::itemChange(GraphicsItemChange change, const QVariant& case ItemCursorChange: return value; case ItemCursorHasChanged: { - QEvent event(QEvent::CursorChange); - QApplication::sendEvent(this, &event); - return value; - } + QEvent event(QEvent::CursorChange); + QApplication::sendEvent(this, &event); + return value; + } default: break; } @@ -515,26 +495,26 @@ void QGraphicsWebView::setPage(QWebPage* page) QWebFrame* mainFrame = d->page->mainFrame(); connect(mainFrame, SIGNAL(titleChanged(QString)), - this, SIGNAL(titleChanged(QString))); + this, SIGNAL(titleChanged(QString))); connect(mainFrame, SIGNAL(iconChanged()), - this, SIGNAL(iconChanged())); + this, SIGNAL(iconChanged())); connect(mainFrame, SIGNAL(urlChanged(QUrl)), - this, SIGNAL(urlChanged(QUrl))); + this, SIGNAL(urlChanged(QUrl))); connect(d->page, SIGNAL(loadStarted()), - this, SIGNAL(loadStarted())); + this, SIGNAL(loadStarted())); connect(d->page, SIGNAL(loadProgress(int)), - this, SIGNAL(loadProgress(int))); + this, SIGNAL(loadProgress(int))); connect(d->page, SIGNAL(loadFinished(bool)), - this, SLOT(_q_doLoadFinished(bool))); + this, SLOT(_q_doLoadFinished(bool))); connect(d->page, SIGNAL(statusBarMessage(QString)), - this, SIGNAL(statusBarMessage(QString))); + this, SIGNAL(statusBarMessage(QString))); connect(d->page, SIGNAL(linkClicked(QUrl)), - this, SIGNAL(linkClicked(QUrl))); + this, SIGNAL(linkClicked(QUrl))); connect(d->page, SIGNAL(destroyed()), - this, SLOT(_q_pageDestroyed())); + this, SLOT(_q_pageDestroyed())); #if !defined(QT_NO_IM) && (defined(Q_WS_X11) || defined(Q_WS_QWS)) connect(d->page, SIGNAL(microFocusChanged()), - this, SLOT(updateMicroFocus())); + this, SLOT(updateMicroFocus())); #endif } @@ -716,9 +696,7 @@ void QGraphicsWebView::load(const QUrl& url) \sa url(), urlChanged() */ -void QGraphicsWebView::load(const QNetworkRequest& request, - QNetworkAccessManager::Operation operation, - const QByteArray& body) +void QGraphicsWebView::load(const QNetworkRequest& request, QNetworkAccessManager::Operation operation, const QByteArray& body) { page()->mainFrame()->load(request, operation, body); } @@ -904,10 +882,7 @@ bool QGraphicsWebView::resizesToContents() const bool QGraphicsWebView::isTiledBackingStoreFrozen() const { #if USE(TILED_BACKING_STORE) - WebCore::TiledBackingStore* backingStore = QWebFramePrivate::core(page()->mainFrame())->tiledBackingStore(); - if (!backingStore) - return false; - return backingStore->contentsFrozen(); + return page()->d->mainFrameAdapter()->tiledBackingStoreFrozen(); #else return false; #endif @@ -916,10 +891,7 @@ bool QGraphicsWebView::isTiledBackingStoreFrozen() const void QGraphicsWebView::setTiledBackingStoreFrozen(bool frozen) { #if USE(TILED_BACKING_STORE) - WebCore::TiledBackingStore* backingStore = QWebFramePrivate::core(page()->mainFrame())->tiledBackingStore(); - if (!backingStore) - return; - backingStore->setContentsFrozen(frozen); + page()->d->mainFrameAdapter()->setTiledBackingStoreFrozen(frozen); #else UNUSED_PARAM(frozen); #endif @@ -931,9 +903,7 @@ void QGraphicsWebView::hoverMoveEvent(QGraphicsSceneHoverEvent* ev) { if (d->page) { const bool accepted = ev->isAccepted(); - QMouseEvent me = QMouseEvent(QEvent::MouseMove, - ev->pos().toPoint(), Qt::NoButton, - Qt::NoButton, Qt::NoModifier); + QMouseEvent me = QMouseEvent(QEvent::MouseMove, ev->pos().toPoint(), Qt::NoButton, Qt::NoButton, Qt::NoModifier); d->page->event(&me); ev->setAccepted(accepted); } diff --git a/Source/WebKit/qt/Api/qgraphicswebview.h b/Source/WebKit/qt/WidgetApi/qgraphicswebview.h index 0f9f17b48..5c5b666d1 100644 --- a/Source/WebKit/qt/Api/qgraphicswebview.h +++ b/Source/WebKit/qt/WidgetApi/qgraphicswebview.h @@ -20,14 +20,14 @@ #ifndef QGraphicsWebView_h #define QGraphicsWebView_h -#include "qwebkitglobal.h" -#include "qwebpage.h" +#include <QtWebKit/qwebkitglobal.h> +#include <QtWebKitWidgets/qwebpage.h> #include <QtCore/qurl.h> -#include <QtWidgets/qgraphicswidget.h> #include <QtGui/qevent.h> #include <QtGui/qicon.h> #include <QtGui/qpainter.h> #include <QtNetwork/qnetworkaccessmanager.h> +#include <QtWidgets/qgraphicswidget.h> #if !defined(QT_NO_GRAPHICSVIEW) @@ -152,9 +152,6 @@ protected: private: Q_PRIVATE_SLOT(d, void _q_doLoadFinished(bool success)) Q_PRIVATE_SLOT(d, void _q_pageDestroyed()) - // we don't want to change the moc based on USE() macro, so this function is here - // but will be empty if ACCLERATED_COMPOSITING is disabled - Q_PRIVATE_SLOT(d, void syncLayers()) Q_PRIVATE_SLOT(d, void _q_contentsSizeChanged(const QSize&)) Q_PRIVATE_SLOT(d, void _q_scaleChanged()) diff --git a/Source/WebKit/qt/Api/qwebframe.cpp b/Source/WebKit/qt/WidgetApi/qwebframe.cpp index 3fa0e8b71..f07517f93 100644 --- a/Source/WebKit/qt/Api/qwebframe.cpp +++ b/Source/WebKit/qt/WidgetApi/qwebframe.cpp @@ -21,74 +21,15 @@ #include "config.h" #include "qwebframe.h" -#include "APICast.h" -#include "BridgeJSC.h" -#include "CallFrame.h" -#include "Document.h" -#include "DocumentLoader.h" -#include "DragData.h" -#include "Element.h" -#include "FocusController.h" -#include "Frame.h" -#include "FrameLoadRequest.h" -#include "FrameLoaderClientQt.h" -#include "FrameSelection.h" -#include "FrameTree.h" -#include "FrameView.h" -#include "GCController.h" -#include "GraphicsContext.h" -#include "HTMLFormElement.h" -#include "HTMLMetaElement.h" -#include "HitTestResult.h" -#include "HTTPParsers.h" -#include "IconDatabase.h" -#include "InspectorController.h" -#include "JavaScript.h" -#include "JSDOMBinding.h" -#include "JSDOMWindowBase.h" -#include "JSLock.h" -#include "JSObject.h" -#include "JSRetainPtr.h" -#include "OpaqueJSString.h" -#include "NetworkingContext.h" -#include "NodeList.h" -#include "Page.h" -#include "PlatformMouseEvent.h" -#include "PlatformWheelEvent.h" -#include "PrintContext.h" -#include "PropertyDescriptor.h" -#include "PutPropertySlot.h" -#include "RenderLayer.h" -#include "RenderTreeAsText.h" -#include "RenderView.h" -#include "ResourceRequest.h" -#include "ScriptController.h" -#include "ScriptSourceCode.h" -#include "ScriptValue.h" -#include "Scrollbar.h" -#include "Settings.h" -#include "SubstituteData.h" -#include "SVGSMILElement.h" -#include "TiledBackingStore.h" -#include "htmlediting.h" -#include "markup.h" -#include "qt_instance.h" -#include "qt_runtime.h" +#include "QtPrintContext.h" #include "qwebelement.h" #include "qwebframe_p.h" #include "qwebpage.h" #include "qwebpage_p.h" -#include "qwebsecurityorigin.h" -#include "qwebsecurityorigin_p.h" #include "qwebscriptworld.h" #include "qwebscriptworld_p.h" -#include "runtime_object.h" -#include "runtime_root.h" -#if USE(TEXTURE_MAPPER) -#include "texmap/TextureMapper.h" -#include "texmap/TextureMapperLayer.h" -#endif -#include "wtf/HashMap.h" +#include "qwebsecurityorigin.h" +#include "qwebsettings.h" #include <QMultiMap> #include <qdebug.h> #include <qevent.h> @@ -97,8 +38,8 @@ #if HAVE(QTPRINTSUPPORT) #include <qprinter.h> #endif -#include <qregion.h> #include <qnetworkrequest.h> +#include <qregion.h> using namespace WebCore; @@ -123,209 +64,9 @@ void QWebFramePrivate::setPage(QWebPage* newPage) emit q->pageChanged(); } -WebCore::Scrollbar* QWebFramePrivate::horizontalScrollBar() const -{ - if (!frame->view()) - return 0; - return frame->view()->horizontalScrollbar(); -} - -WebCore::Scrollbar* QWebFramePrivate::verticalScrollBar() const -{ - if (!frame->view()) - return 0; - return frame->view()->verticalScrollbar(); -} - -#if USE(TILED_BACKING_STORE) -void QWebFramePrivate::renderFromTiledBackingStore(GraphicsContext* context, const QRegion& clip) -{ - ASSERT(frame->tiledBackingStore()); - - if (!frame->view() || !frame->contentRenderer()) - return; - - QVector<QRect> vector = clip.rects(); - if (vector.isEmpty()) - return; - - QPainter* painter = context->platformContext(); - - WebCore::FrameView* view = frame->view(); - - int scrollX = view->scrollX(); - int scrollY = view->scrollY(); - context->translate(-scrollX, -scrollY); - - for (int i = 0; i < vector.size(); ++i) { - const QRect& clipRect = vector.at(i); - - painter->save(); - - QRect rect = clipRect.translated(scrollX, scrollY); - painter->setClipRect(rect, Qt::IntersectClip); - - frame->tiledBackingStore()->paint(context, rect); - - painter->restore(); - } - -#if USE(ACCELERATED_COMPOSITING) - renderCompositedLayers(context, IntRect(clip.boundingRect())); - renderFrameExtras(context, QFlags<QWebFrame::RenderLayer>(QWebFrame::ScrollBarLayer) | QWebFrame::PanIconLayer, clip); -#endif -} -#endif - -#if USE(ACCELERATED_COMPOSITING) -void QWebFramePrivate::renderCompositedLayers(GraphicsContext* context, const IntRect& clip) -{ - if (!rootTextureMapperLayer || !textureMapper) - return; - - textureMapper->setGraphicsContext(context); - textureMapper->setImageInterpolationQuality(context->imageInterpolationQuality()); - textureMapper->setTextDrawingMode(context->textDrawingMode()); - QPainter* painter = context->platformContext(); - const QTransform transform = painter->worldTransform(); - const TransformationMatrix matrix( - transform.m11(), transform.m12(), 0, transform.m13(), - transform.m21(), transform.m22(), 0, transform.m23(), - 0, 0, 1, 0, - transform.m31(), transform.m32(), 0, transform.m33() - ); - rootTextureMapperLayer->setTransform(matrix); - rootTextureMapperLayer->setOpacity(painter->opacity()); - textureMapper->beginPainting(); - textureMapper->beginClip(matrix, clip); - rootTextureMapperLayer->paint(); - textureMapper->endClip(); - textureMapper->endPainting(); -} -#endif - -// This code is copied from ChromeClientGtk.cpp. -static void coalesceRectsIfPossible(const QRect& clipRect, QVector<QRect>& rects) -{ - const unsigned int rectThreshold = 10; - const float wastedSpaceThreshold = 0.75f; - bool useUnionedRect = (rects.size() <= 1) || (rects.size() > rectThreshold); - if (!useUnionedRect) { - // Attempt to guess whether or not we should use the unioned rect or the individual rects. - // We do this by computing the percentage of "wasted space" in the union. If that wasted space - // is too large, then we will do individual rect painting instead. - float unionPixels = (clipRect.width() * clipRect.height()); - float singlePixels = 0; - for (size_t i = 0; i < rects.size(); ++i) - singlePixels += rects[i].width() * rects[i].height(); - float wastedSpace = 1 - (singlePixels / unionPixels); - if (wastedSpace <= wastedSpaceThreshold) - useUnionedRect = true; - } - - if (!useUnionedRect) - return; - - rects.clear(); - rects.append(clipRect); -} - -void QWebFramePrivate::renderRelativeCoords(GraphicsContext* context, QFlags<QWebFrame::RenderLayer> layers, const QRegion& clip) -{ - if (!frame->view() || !frame->contentRenderer()) - return; - - QVector<QRect> vector = clip.rects(); - if (vector.isEmpty()) - return; - - QPainter* painter = context->platformContext(); - - WebCore::FrameView* view = frame->view(); - view->updateLayoutAndStyleIfNeededRecursive(); - - if (layers & QWebFrame::ContentsLayer) { - QRect clipBoundingRect = clip.boundingRect(); - coalesceRectsIfPossible(clipBoundingRect, vector); - for (int i = 0; i < vector.size(); ++i) { - const QRect& clipRect = vector.at(i); - - QRect rect = clipRect.intersected(view->frameRect()); - - context->save(); - painter->setClipRect(clipRect, Qt::IntersectClip); - - int x = view->x(); - int y = view->y(); - - int scrollX = view->scrollX(); - int scrollY = view->scrollY(); - - context->translate(x, y); - rect.translate(-x, -y); - context->translate(-scrollX, -scrollY); - rect.translate(scrollX, scrollY); - context->clip(view->visibleContentRect()); - - view->paintContents(context, rect); - - context->restore(); - } -#if USE(ACCELERATED_COMPOSITING) - renderCompositedLayers(context, IntRect(clipBoundingRect)); -#endif - } - renderFrameExtras(context, layers, clip); -#if ENABLE(INSPECTOR) - if (frame->page()->inspectorController()->highlightedNode()) { - context->save(); - frame->page()->inspectorController()->drawHighlight(*context); - context->restore(); - } -#endif -} - -void QWebFramePrivate::renderFrameExtras(GraphicsContext* context, QFlags<QWebFrame::RenderLayer> layers, const QRegion& clip) -{ - if (!(layers & (QWebFrame::PanIconLayer | QWebFrame::ScrollBarLayer))) - return; - QPainter* painter = context->platformContext(); - WebCore::FrameView* view = frame->view(); - QVector<QRect> vector = clip.rects(); - for (int i = 0; i < vector.size(); ++i) { - const QRect& clipRect = vector.at(i); - - QRect intersectedRect = clipRect.intersected(view->frameRect()); - - painter->save(); - painter->setClipRect(clipRect, Qt::IntersectClip); - - int x = view->x(); - int y = view->y(); - - if (layers & QWebFrame::ScrollBarLayer - && !view->scrollbarsSuppressed() - && (view->horizontalScrollbar() || view->verticalScrollbar())) { - - QRect rect = intersectedRect; - context->translate(x, y); - rect.translate(-x, -y); - view->paintScrollbars(context, rect); - context->translate(-x, -y); - } - -#if ENABLE(PAN_SCROLLING) - if (layers & QWebFrame::PanIconLayer) - view->paintPanScrollIcon(context); -#endif - - painter->restore(); - } -} - void QWebFramePrivate::emitUrlChanged() { - url = frame->document()->url(); + url = coreFrameUrl(); emit q->urlChanged(url); } @@ -334,35 +75,6 @@ void QWebFramePrivate::didStartProvisionalLoad() emit q->provisionalLoad(); } -void QWebFramePrivate::_q_orientationChanged() -{ -#if ENABLE(ORIENTATION_EVENTS) - int orientation; - WebCore::Frame* frame = core(q); - - switch (m_orientation.reading()->orientation()) { - case QOrientationReading::TopUp: - orientation = 0; - break; - case QOrientationReading::TopDown: - orientation = 180; - break; - case QOrientationReading::LeftUp: - orientation = -90; - break; - case QOrientationReading::RightUp: - orientation = 90; - break; - case QOrientationReading::FaceUp: - case QOrientationReading::FaceDown: - // WebCore unable to handle it - default: - return; - } - frame->sendOrientationChangeEvent(orientation); -#endif -} - void QWebFramePrivate::didClearWindowObject() { emit q->javaScriptWindowObjectCleared(); @@ -543,33 +255,7 @@ QWebFrame::~QWebFrame() */ void QWebFrame::addToJavaScriptWindowObject(const QString &name, QObject *object, ValueOwnership ownership) { - if (!page()->settings()->testAttribute(QWebSettings::JavascriptEnabled)) - return; - JSC::Bindings::QtInstance::ValueOwnership valueOwnership = static_cast<JSC::Bindings::QtInstance::ValueOwnership>(ownership); - JSDOMWindow* window = toJSDOMWindow(d->frame, mainThreadNormalWorld()); - JSC::Bindings::RootObject* root; - if (valueOwnership == JSC::Bindings::QtInstance::QtOwnership) - root = d->frame->script()->cacheableBindingRootObject(); - else - root = d->frame->script()->bindingRootObject(); - - if (!window) { - qDebug() << "Warning: couldn't get window object"; - return; - } - if (!root) { - qDebug() << "Warning: couldn't get root object"; - return; - } - - JSC::ExecState* exec = window->globalExec(); - JSC::JSLockHolder lock(exec); - - JSC::JSObject* runtimeObject = - JSC::Bindings::QtInstance::getQtInstance(object, root, valueOwnership)->createRuntimeObject(exec); - - JSC::PutPropertySlot slot; - window->methodTable()->put(window, exec, JSC::Identifier(&exec->globalData(), reinterpret_cast_ptr<const UChar*>(name.constData()), name.length()), runtimeObject, slot); + d->addToJavaScriptWindowObject(name, object, static_cast<QWebFrameAdapter::ValueOwnership>(ownership)); } /*! @@ -579,9 +265,7 @@ void QWebFrame::addToJavaScriptWindowObject(const QString &name, QObject *object */ QString QWebFrame::toHtml() const { - if (!d->frame->document()) - return QString(); - return createMarkup(d->frame->document()); + return d->toHtml(); } /*! @@ -592,25 +276,7 @@ QString QWebFrame::toHtml() const */ QString QWebFrame::toPlainText() const { - if (d->frame->view() && d->frame->view()->layoutPending()) - d->frame->view()->layout(); - - Element *documentElement = d->frame->document()->documentElement(); - if (documentElement) - return documentElement->innerText(); - return QString(); -} - -/*! - Returns a dump of the rendering tree. This is mainly useful for debugging - html. -*/ -QString QWebFrame::renderTreeDump() const -{ - if (d->frame->view() && d->frame->view()->layoutPending()) - d->frame->view()->layout(); - - return externalRepresentation(d->frame); + return d->toPlainText(); } /*! @@ -622,9 +288,7 @@ QString QWebFrame::renderTreeDump() const QString QWebFrame::title() const { - if (d->frame->document()) - return d->frame->loader()->documentLoader()->title().string(); - return QString(); + return d->title(); } /*! @@ -660,31 +324,7 @@ QString QWebFrame::title() const */ QMultiMap<QString, QString> QWebFrame::metaData() const { - if (!d->frame->document()) - return QMap<QString, QString>(); - - QMultiMap<QString, QString> map; - Document* doc = d->frame->document(); - RefPtr<NodeList> list = doc->getElementsByTagName("meta"); - unsigned len = list->length(); - for (unsigned i = 0; i < len; i++) { - HTMLMetaElement* meta = static_cast<HTMLMetaElement*>(list->item(i)); - map.insert(meta->name(), meta->content()); - } - return map; -} - -static inline void clearCoreFrame(WebCore::Frame* frame) -{ - WebCore::DocumentLoader* documentLoader = frame->loader()->activeDocumentLoader(); - Q_ASSERT(documentLoader); - documentLoader->writer()->begin(); - documentLoader->writer()->end(); -} - -static inline bool isCoreFrameClear(WebCore::Frame* frame) -{ - return frame->document()->url().isEmpty(); + return d->metaData(); } /*! @@ -700,7 +340,7 @@ static inline bool isCoreFrameClear(WebCore::Frame* frame) void QWebFrame::setUrl(const QUrl &url) { - clearCoreFrame(d->frame); + d->clearCoreFrame(); const QUrl absolute = QWebFrameAdapter::ensureAbsoluteUrl(url); d->url = absolute; load(absolute); @@ -722,7 +362,7 @@ QUrl QWebFrame::url() const */ QUrl QWebFrame::requestedUrl() const { - return d->frameLoaderClient->lastRequestedUrl(); + return d->lastRequestedUrl(); } /*! \since 4.6 @@ -733,9 +373,7 @@ QUrl QWebFrame::requestedUrl() const QUrl QWebFrame::baseUrl() const { - if (isCoreFrameClear(d->frame)) - return QUrl(d->url).resolved(QUrl()); - return d->frame->document()->baseURL(); + return d->baseUrl(); } /*! @@ -747,7 +385,7 @@ QUrl QWebFrame::baseUrl() const QIcon QWebFrame::icon() const { - return QWebSettings::iconForUrl(d->frame->document()->url()); + return QWebSettings::iconForUrl(d->coreFrameUrl()); } /*! @@ -755,7 +393,7 @@ QIcon QWebFrame::icon() const */ QString QWebFrame::frameName() const { - return d->frame->tree()->uniqueName(); + return d->uniqueName(); } /*! @@ -791,9 +429,7 @@ void QWebFrame::load(const QUrl &url) \sa setUrl() */ -void QWebFrame::load(const QNetworkRequest &req, - QNetworkAccessManager::Operation operation, - const QByteArray &body) +void QWebFrame::load(const QNetworkRequest &req, QNetworkAccessManager::Operation operation, const QByteArray &body) { d->load(req, operation, body); } @@ -824,12 +460,7 @@ void QWebFrame::load(const QNetworkRequest &req, */ void QWebFrame::setHtml(const QString &html, const QUrl &baseUrl) { - KURL kurl(baseUrl); - WebCore::ResourceRequest request(kurl); - const QByteArray utf8 = html.toUtf8(); - WTF::RefPtr<WebCore::SharedBuffer> data = WebCore::SharedBuffer::create(utf8.constData(), utf8.length()); - WebCore::SubstituteData substituteData(data, WTF::String("text/html"), WTF::String("utf-8"), KURL()); - d->frame->loader()->load(WebCore::FrameLoadRequest(d->frame, request, substituteData)); + d->setHtml(html, baseUrl); } /*! @@ -847,19 +478,7 @@ void QWebFrame::setHtml(const QString &html, const QUrl &baseUrl) */ void QWebFrame::setContent(const QByteArray &data, const QString &mimeType, const QUrl &baseUrl) { - KURL kurl(baseUrl); - WebCore::ResourceRequest request(kurl); - WTF::RefPtr<WebCore::SharedBuffer> buffer = WebCore::SharedBuffer::create(data.constData(), data.length()); - QString actualMimeType; - WTF::String encoding; - if (mimeType.isEmpty()) - actualMimeType = QLatin1String("text/html"); - else { - actualMimeType = extractMIMETypeFromMediaType(mimeType); - encoding = extractCharsetFromMediaType(mimeType); - } - WebCore::SubstituteData substituteData(buffer, WTF::String(actualMimeType), encoding, KURL()); - d->frame->loader()->load(WebCore::FrameLoadRequest(d->frame, request, substituteData)); + d->setContent(data, mimeType, baseUrl); } /*! @@ -882,17 +501,14 @@ QWebFrame *QWebFrame::parentFrame() const */ QList<QWebFrame*> QWebFrame::childFrames() const { + QList<QObject*> objects = d->childFrames(); QList<QWebFrame*> rc; - if (d->frame) { - FrameTree *tree = d->frame->tree(); - for (Frame *child = tree->firstChild(); child; child = child->tree()->nextSibling()) { - FrameLoader *loader = child->loader(); - QWebFrame* webFrame = qobject_cast<QWebFrame*>(loader->networkingContext()->originatingObject()); - if (webFrame) - rc.append(webFrame); - } - + rc.reserve(objects.size()); + Q_FOREACH(QObject* object, objects) { + if (QWebFrame* frame = qobject_cast<QWebFrame*>(object)) + rc.append(frame); } + return rc; } @@ -911,23 +527,7 @@ Qt::ScrollBarPolicy QWebFrame::scrollBarPolicy(Qt::Orientation orientation) cons */ void QWebFrame::setScrollBarPolicy(Qt::Orientation orientation, Qt::ScrollBarPolicy policy) { - Q_ASSERT((int)ScrollbarAuto == (int)Qt::ScrollBarAsNeeded); - Q_ASSERT((int)ScrollbarAlwaysOff == (int)Qt::ScrollBarAlwaysOff); - Q_ASSERT((int)ScrollbarAlwaysOn == (int)Qt::ScrollBarAlwaysOn); - - if (orientation == Qt::Horizontal) { - d->horizontalScrollBarPolicy = policy; - if (d->frame->view()) { - d->frame->view()->setHorizontalScrollbarMode((ScrollbarMode)policy, policy != Qt::ScrollBarAsNeeded /* lock */); - d->frame->view()->updateCanHaveScrollbars(); - } - } else { - d->verticalScrollBarPolicy = policy; - if (d->frame->view()) { - d->frame->view()->setVerticalScrollbarMode((ScrollbarMode)policy, policy != Qt::ScrollBarAsNeeded /* lock */); - d->frame->view()->updateCanHaveScrollbars(); - } - } + d->setScrollBarPolicy(orientation, policy); } /*! @@ -941,15 +541,7 @@ void QWebFrame::setScrollBarPolicy(Qt::Orientation orientation, Qt::ScrollBarPol */ void QWebFrame::setScrollBarValue(Qt::Orientation orientation, int value) { - Scrollbar *sb; - sb = (orientation == Qt::Horizontal) ? d->horizontalScrollBar() : d->verticalScrollBar(); - if (sb) { - if (value < 0) - value = 0; - else if (value > scrollBarMaximum(orientation)) - value = scrollBarMaximum(orientation); - sb->scrollableArea()->scrollToOffsetWithoutAnimation(orientation == Qt::Horizontal ? HorizontalScrollbar : VerticalScrollbar, value); - } + d->setScrollBarValue(orientation, value); } /*! @@ -960,11 +552,7 @@ void QWebFrame::setScrollBarValue(Qt::Orientation orientation, int value) */ int QWebFrame::scrollBarValue(Qt::Orientation orientation) const { - Scrollbar *sb; - sb = (orientation == Qt::Horizontal) ? d->horizontalScrollBar() : d->verticalScrollBar(); - if (sb) - return sb->value(); - return 0; + return d->scrollBarValue(orientation); } /*! @@ -975,11 +563,7 @@ int QWebFrame::scrollBarValue(Qt::Orientation orientation) const */ int QWebFrame::scrollBarMaximum(Qt::Orientation orientation) const { - Scrollbar *sb; - sb = (orientation == Qt::Horizontal) ? d->horizontalScrollBar() : d->verticalScrollBar(); - if (sb) - return sb->maximum(); - return 0; + return d->scrollBarMaximum(orientation); } /*! @@ -991,7 +575,7 @@ int QWebFrame::scrollBarMaximum(Qt::Orientation orientation) const */ int QWebFrame::scrollBarMinimum(Qt::Orientation orientation) const { - Q_UNUSED(orientation) + Q_UNUSED(orientation); return 0; } @@ -1003,11 +587,7 @@ int QWebFrame::scrollBarMinimum(Qt::Orientation orientation) const */ QRect QWebFrame::scrollBarGeometry(Qt::Orientation orientation) const { - Scrollbar *sb; - sb = (orientation == Qt::Horizontal) ? d->horizontalScrollBar() : d->verticalScrollBar(); - if (sb) - return sb->frameRect(); - return QRect(); + return d->scrollBarGeometry(orientation); } /*! @@ -1020,10 +600,7 @@ QRect QWebFrame::scrollBarGeometry(Qt::Orientation orientation) const void QWebFrame::scroll(int dx, int dy) { - if (!d->frame->view()) - return; - - d->frame->view()->scrollBy(IntSize(dx, dy)); + d->scrollBy(dx, dy); } /*! @@ -1034,8 +611,7 @@ void QWebFrame::scroll(int dx, int dy) QPoint QWebFrame::scrollPosition() const { - IntSize ofs = d->scrollPosition(); - return QPoint(ofs.width(), ofs.height()); + return d->scrollPosition(); } void QWebFrame::setScrollPosition(const QPoint &pos) @@ -1052,9 +628,7 @@ void QWebFrame::setScrollPosition(const QPoint &pos) */ void QWebFrame::scrollToAnchor(const QString& anchor) { - FrameView *view = d->frame->view(); - if (view) - view->scrollToAnchor(anchor); + d->scrollToAnchor(anchor); } /*! @@ -1064,16 +638,12 @@ void QWebFrame::scrollToAnchor(const QString& anchor) \sa print() */ -void QWebFrame::render(QPainter* painter, RenderLayer layer, const QRegion& clip) +void QWebFrame::render(QPainter* painter, RenderLayers layer, const QRegion& clip) { - GraphicsContext context(painter); - if (context.paintingDisabled() && !context.updatingControlTints()) - return; - if (!clip.isEmpty()) - d->renderRelativeCoords(&context, layer, clip); - else if (d->frame->view()) - d->renderRelativeCoords(&context, layer, QRegion(d->frame->view()->frameRect())); + d->renderRelativeCoords(painter, layer, clip); + else if (d->hasView()) + d->renderRelativeCoords(painter, layer, QRegion(d->frameRect())); } /*! @@ -1081,26 +651,7 @@ void QWebFrame::render(QPainter* painter, RenderLayer layer, const QRegion& clip */ void QWebFrame::render(QPainter* painter, const QRegion& clip) { - GraphicsContext context(painter); - if (context.paintingDisabled() && !context.updatingControlTints()) - return; - - d->renderRelativeCoords(&context, AllLayers, clip); -} - -/*! - Render the frame into \a painter. -*/ -void QWebFrame::render(QPainter* painter) -{ - if (!d->frame->view()) - return; - - GraphicsContext context(painter); - if (context.paintingDisabled() && !context.updatingControlTints()) - return; - - d->renderRelativeCoords(&context, AllLayers, QRegion(d->frame->view()->frameRect())); + render(painter, AllLayers, clip); } /*! @@ -1122,8 +673,7 @@ void QWebFrame::render(QPainter* painter) void QWebFrame::setTextSizeMultiplier(qreal factor) { page()->settings()->setAttribute(QWebSettings::ZoomTextOnly, true); - - d->frame->setPageAndTextZoomFactors(1, factor); + d->setZoomFactor(factor); } /*! @@ -1131,7 +681,7 @@ void QWebFrame::setTextSizeMultiplier(qreal factor) */ qreal QWebFrame::textSizeMultiplier() const { - return page()->settings()->testAttribute(QWebSettings::ZoomTextOnly) ? d->frame->textZoomFactor() : d->frame->pageZoomFactor(); + return d->zoomFactor(); } /*! @@ -1142,15 +692,12 @@ qreal QWebFrame::textSizeMultiplier() const void QWebFrame::setZoomFactor(qreal factor) { - if (page()->settings()->testAttribute(QWebSettings::ZoomTextOnly)) - d->frame->setTextZoomFactor(factor); - else - d->frame->setPageZoomFactor(factor); + d->setZoomFactor(factor); } qreal QWebFrame::zoomFactor() const { - return page()->settings()->testAttribute(QWebSettings::ZoomTextOnly) ? d->frame->textZoomFactor() : d->frame->pageZoomFactor(); + return d->zoomFactor(); } /*! @@ -1161,8 +708,7 @@ qreal QWebFrame::zoomFactor() const */ bool QWebFrame::hasFocus() const { - WebCore::Frame* ff = d->frame->page()->focusController()->focusedFrame(); - return ff && QWebFramePrivate::kit(ff) == this; + return d->hasFocus(); } /*! @@ -1172,7 +718,7 @@ bool QWebFrame::hasFocus() const */ void QWebFrame::setFocus() { - QWebFramePrivate::core(this)->page()->focusController()->setFocusedFrame(QWebFramePrivate::core(this)); + d->setFocus(); } /*! @@ -1180,10 +726,10 @@ void QWebFrame::setFocus() */ QPoint QWebFrame::pos() const { - if (!d->frame->view()) + if (!d->hasView()) return QPoint(); - return d->frame->view()->frameRect().location(); + return d->frameRect().topLeft(); } /*! @@ -1202,10 +748,7 @@ QRect QWebFrame::geometry() const */ QSize QWebFrame::contentsSize() const { - FrameView *view = d->frame->view(); - if (!view) - return QSize(); - return QSize(view->contentsWidth(), view->contentsHeight()); + return d->contentsSize(); } /*! @@ -1218,10 +761,7 @@ QSize QWebFrame::contentsSize() const */ QWebElement QWebFrame::documentElement() const { - WebCore::Document *doc = d->frame->document(); - if (!doc) - return QWebElement(); - return QWebElement(doc->documentElement()); + return d->documentElement(); } /*! @@ -1260,15 +800,12 @@ QWebElement QWebFrame::findFirstElement(const QString &selectorQuery) const */ QWebHitTestResult QWebFrame::hitTestContent(const QPoint &pos) const { - if (!d->frame->view() || !d->frame->contentRenderer()) - return QWebHitTestResult(); + QWebHitTestResultPrivate* result = d->hitTestContent(pos); - HitTestResult result = d->frame->eventHandler()->hitTestResultAtPoint(d->frame->view()->windowToContents(pos), /*allowShadowContent*/ false, /*ignoreClipping*/ true); - - if (result.scrollbar()) + if (!result) return QWebHitTestResult(); - return QWebHitTestResult(new QWebHitTestResultPrivate(result)); + return QWebHitTestResult(result); } /*! \reimp @@ -1294,18 +831,11 @@ void QWebFrame::print(QPrinter *printer) const const qreal zoomFactorX = (qreal)printer->logicalDpiX() / qt_defaultDpi(); const qreal zoomFactorY = (qreal)printer->logicalDpiY() / qt_defaultDpi(); - PrintContext printContext(d->frame); - float pageHeight = 0; - QRect qprinterRect = printer->pageRect(); - IntRect pageRect(0, 0, - int(qprinterRect.width() / zoomFactorX), - int(qprinterRect.height() / zoomFactorY)); + QRect pageRect(0, 0, int(qprinterRect.width() / zoomFactorX), int(qprinterRect.height() / zoomFactorY)); - printContext.begin(pageRect.width(), pageRect.height()); - - printContext.computePageRects(pageRect, /* headerHeight */ 0, /* footerHeight */ 0, /* userScaleFactor */ 1.0, pageHeight); + QtPrintContext printContext(&painter, pageRect, d); int docCopies; int pageCopies; @@ -1321,7 +851,7 @@ void QWebFrame::print(QPrinter *printer) const int toPage = printer->toPage(); bool ascending = true; - if (fromPage == 0 && toPage == 0) { + if (!fromPage && !toPage) { fromPage = 1; toPage = printContext.pageCount(); } @@ -1342,7 +872,6 @@ void QWebFrame::print(QPrinter *printer) const } painter.scale(zoomFactorX, zoomFactorY); - GraphicsContext ctx(&painter); for (int i = 0; i < docCopies; ++i) { int page = fromPage; @@ -1350,10 +879,9 @@ void QWebFrame::print(QPrinter *printer) const for (int j = 0; j < pageCopies; ++j) { if (printer->printerState() == QPrinter::Aborted || printer->printerState() == QPrinter::Error) { - printContext.end(); return; } - printContext.spoolPage(ctx, page - 1, pageRect.width()); + printContext.spoolPage(page - 1, pageRect.width()); if (j < pageCopies - 1) printer->newPage(); } @@ -1369,11 +897,9 @@ void QWebFrame::print(QPrinter *printer) const printer->newPage(); } - if ( i < docCopies - 1) + if (i < docCopies - 1) printer->newPage(); } - - printContext.end(); #endif // HAVE(PRINTSUPPORT) } #endif // QT_NO_PRINTER @@ -1386,16 +912,7 @@ void QWebFrame::print(QPrinter *printer) const */ QVariant QWebFrame::evaluateJavaScript(const QString& scriptSource) { - ScriptController *proxy = d->frame->script(); - QVariant rc; - if (proxy) { - int distance = 0; - JSC::JSValue v = d->frame->script()->executeScript(ScriptSourceCode(scriptSource)).jsValue(); - JSC::ExecState* exec = proxy->globalObject(mainThreadNormalWorld())->globalExec(); - JSValueRef* ignoredException = 0; - rc = JSC::Bindings::convertValueToQVariant(toRef(exec), toRef(exec, v), QMetaType::Void, &distance, ignoredException); - } - return rc; + return d->evaluateJavaScript(scriptSource); } /*! @@ -1405,19 +922,7 @@ QVariant QWebFrame::evaluateJavaScript(const QString& scriptSource) */ QWebSecurityOrigin QWebFrame::securityOrigin() const { - QWebFrame* that = const_cast<QWebFrame*>(this); - QWebSecurityOriginPrivate* priv = new QWebSecurityOriginPrivate(QWebFramePrivate::core(that)->document()->securityOrigin()); - return QWebSecurityOrigin(priv); -} - -WebCore::Frame* QWebFramePrivate::core(const QWebFrame* webFrame) -{ - return webFrame->d->frame; -} - -QWebFrame* QWebFramePrivate::kit(const WebCore::Frame* coreFrame) -{ - return qobject_cast<QWebFrame*>(coreFrame->loader()->networkingContext()->originatingObject()); + return d->securityOrigin(); } QWebFrame *QWebFramePrivate::kit(const QWebFrameAdapter* frameAdapter) @@ -1537,46 +1042,6 @@ QWebHitTestResult::QWebHitTestResult(QWebHitTestResultPrivate *priv) { } -QWebHitTestResultPrivate::QWebHitTestResultPrivate(const WebCore::HitTestResult &hitTest) - : isContentEditable(false) - , isContentSelected(false) - , isScrollBar(false) -{ - if (!hitTest.innerNode()) - return; - pos = hitTest.roundedPointInInnerNodeFrame(); - WebCore::TextDirection dir; - title = hitTest.title(dir); - linkText = hitTest.textContent(); - linkUrl = hitTest.absoluteLinkURL(); - linkTitle = hitTest.titleDisplayString(); - alternateText = hitTest.altDisplayString(); - imageUrl = hitTest.absoluteImageURL(); - innerNode = hitTest.innerNode(); - innerNonSharedNode = hitTest.innerNonSharedNode(); - boundingRect = innerNonSharedNode ? innerNonSharedNode->renderer()->absoluteBoundingBoxRect() : IntRect(); - WebCore::Image *img = hitTest.image(); - if (img) { - QPixmap *pix = img->nativeImageForCurrentFrame(); - if (pix) - pixmap = *pix; - } - WebCore::Frame *wframe = hitTest.targetFrame(); - if (wframe) - linkTargetFrame = QWebFramePrivate::kit(wframe); - linkElement = QWebElement(hitTest.URLElement()); - - isContentEditable = hitTest.isContentEditable(); - isContentSelected = hitTest.isSelected(); - isScrollBar = hitTest.scrollbar(); - - WebCore::Frame *innerNodeFrame = hitTest.innerNodeFrame(); - if (innerNodeFrame) - frame = QWebFramePrivate::kit(innerNodeFrame); - - enclosingBlock = QWebElement(WebCore::enclosingBlock(innerNode.get())); -} - /*! Constructs a null hit test result. */ @@ -1729,7 +1194,7 @@ QWebFrame *QWebHitTestResult::linkTargetFrame() const { if (!d) return 0; - return d->linkTargetFrame.data(); + return qobject_cast<QWebFrame*>(d->linkTargetFrame.data()); } /*! @@ -1789,10 +1254,10 @@ bool QWebHitTestResult::isContentSelected() const */ QWebElement QWebHitTestResult::element() const { - if (!d || !d->innerNonSharedNode || !d->innerNonSharedNode->isElementNode()) + if (!d) return QWebElement(); - return QWebElement(static_cast<WebCore::Element*>(d->innerNonSharedNode.get())); + return d->elementForInnerNode(); } /*! @@ -1802,7 +1267,7 @@ QWebFrame *QWebHitTestResult::frame() const { if (!d) return 0; - return d->frame.data(); + return qobject_cast<QWebFrame*>(d->frame.data()); } /*! diff --git a/Source/WebKit/qt/Api/qwebframe.h b/Source/WebKit/qt/WidgetApi/qwebframe.h index fe00d81f5..f3676fed7 100644 --- a/Source/WebKit/qt/Api/qwebframe.h +++ b/Source/WebKit/qt/WidgetApi/qwebframe.h @@ -26,7 +26,7 @@ #include <QtCore/qvariant.h> #include <QtGui/qicon.h> #include <QtNetwork/qnetworkaccessmanager.h> -#include "qwebkitglobal.h" +#include <QtWebKit/qwebkitglobal.h> QT_BEGIN_NAMESPACE class QRect; @@ -138,7 +138,6 @@ public: void addToJavaScriptWindowObject(const QString &name, QObject *object, ValueOwnership ownership = QtOwnership); QString toHtml() const; QString toPlainText() const; - QString renderTreeDump() const; QString title() const; void setUrl(const QUrl &url); @@ -175,10 +174,10 @@ public: AllLayers = 0xff }; + Q_DECLARE_FLAGS(RenderLayers, RenderLayer) - void render(QPainter*); - void render(QPainter*, const QRegion& clip); - void render(QPainter*, RenderLayer layer, const QRegion& clip = QRegion()); + void render(QPainter*, const QRegion& clip = QRegion()); + void render(QPainter*, RenderLayers layer, const QRegion& clip = QRegion()); void setTextSizeMultiplier(qreal factor); qreal textSizeMultiplier() const; @@ -242,4 +241,6 @@ private: Q_PRIVATE_SLOT(d, void _q_orientationChanged()) }; +Q_DECLARE_OPERATORS_FOR_FLAGS(QWebFrame::RenderLayers) + #endif diff --git a/Source/WebKit/qt/WidgetApi/qwebframe_p.h b/Source/WebKit/qt/WidgetApi/qwebframe_p.h new file mode 100644 index 000000000..2a1c20278 --- /dev/null +++ b/Source/WebKit/qt/WidgetApi/qwebframe_p.h @@ -0,0 +1,71 @@ +/* + Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + Copyright (C) 2007 Staikos Computing Services Inc. + + 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 qwebframe_p_h +#define qwebframe_p_h + +#include "QWebFrameAdapter.h" + +#include "qwebframe.h" +#include "qwebpage_p.h" + + +namespace WebCore { +class FrameLoaderClientQt; +class FrameView; +class HTMLFrameOwnerElement; +class Scrollbar; +class TextureMapperLayer; +} +class QWebPage; + +class QWebFramePrivate : public QWebFrameAdapter { +public: + QWebFramePrivate() + : q(0) + , page(0) + { } + void setPage(QWebPage*); + + inline QWebFrame *parentFrame() { return qobject_cast<QWebFrame*>(q->parent()); } + + static QWebFrame* kit(const QWebFrameAdapter*); + + // 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; + QWebPage *page; + +}; + +#endif diff --git a/Source/WebKit/qt/Api/qwebinspector.cpp b/Source/WebKit/qt/WidgetApi/qwebinspector.cpp index 55089e1a1..9ae69dacf 100644 --- a/Source/WebKit/qt/Api/qwebinspector.cpp +++ b/Source/WebKit/qt/WidgetApi/qwebinspector.cpp @@ -20,8 +20,6 @@ #include "config.h" #include "qwebinspector.h" -#include "Element.h" -#include "InspectorController.h" #include "qwebelement.h" #include "qwebinspector_p.h" #include "qwebpage_p.h" @@ -161,7 +159,7 @@ void QWebInspector::showEvent(QShowEvent* event) #if ENABLE(INSPECTOR) // Allows QWebInspector::show() to init the inspector. if (d->page) - d->page->d->inspectorController()->show(); + d->page->d->didShowInspector(); #endif } @@ -170,7 +168,7 @@ void QWebInspector::hideEvent(QHideEvent* event) { #if ENABLE(INSPECTOR) if (d->page) - d->page->d->inspectorController()->close(); + d->page->d->didCloseInspector(); #endif } @@ -179,7 +177,7 @@ void QWebInspector::closeEvent(QCloseEvent* event) { #if ENABLE(INSPECTOR) if (d->page) - d->page->d->inspectorController()->close(); + d->page->d->didCloseInspector(); #endif } diff --git a/Source/WebKit/qt/Api/qwebinspector.h b/Source/WebKit/qt/WidgetApi/qwebinspector.h index f192e921b..373312933 100644 --- a/Source/WebKit/qt/Api/qwebinspector.h +++ b/Source/WebKit/qt/WidgetApi/qwebinspector.h @@ -20,10 +20,10 @@ #ifndef QWEBINSPECTOR_H #define QWEBINSPECTOR_H -#include "qwebkitglobal.h" -#include "qwebpage.h" +#include <QtWebKit/qwebkitglobal.h> +#include <QtWebKitWidgets/qwebpage.h> -#include "qwebview.h" +#include <QtWebKitWidgets/qwebview.h> class QWebInspectorPrivate; diff --git a/Source/WebKit/qt/Api/qwebinspector_p.h b/Source/WebKit/qt/WidgetApi/qwebinspector_p.h index 908de84ed..364eecff6 100644 --- a/Source/WebKit/qt/Api/qwebinspector_p.h +++ b/Source/WebKit/qt/WidgetApi/qwebinspector_p.h @@ -17,8 +17,8 @@ Boston, MA 02110-1301, USA. */ -#ifndef QWEBINSPECTOR_P_H -#define QWEBINSPECTOR_P_H +#ifndef qwebinspector_p_h +#define qwebinspector_p_h QT_BEGIN_NAMESPACE class QSize; @@ -33,10 +33,10 @@ public: : q(qq) , page(0) , frontend(0) - {} + { } void setFrontend(QObject* newFrontend); - void adjustFrontendSize(const QSize& size); + void adjustFrontendSize(const QSize&); QWebInspector* q; QWebPage* page; diff --git a/Source/WebKit/qt/Api/qwebpage.cpp b/Source/WebKit/qt/WidgetApi/qwebpage.cpp index 65624d190..c1176cf66 100644 --- a/Source/WebKit/qt/Api/qwebpage.cpp +++ b/Source/WebKit/qt/WidgetApi/qwebpage.cpp @@ -22,107 +22,26 @@ #include "config.h" #include "qwebpage.h" -#include "CSSComputedStyleDeclaration.h" -#include "CSSParser.h" -#include "ApplicationCacheStorage.h" -#include "BackForwardListImpl.h" -#include "MemoryCache.h" -#include "Chrome.h" -#include "ChromeClientQt.h" -#include "ClientRect.h" -#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" -#include "DeviceOrientationClientQt.h" -#endif -#include "DocumentLoader.h" -#include "DragClientQt.h" -#include "DragController.h" -#include "DragData.h" -#include "DragSession.h" -#include "Editor.h" -#include "EditorClientQt.h" -#include "FocusController.h" -#include "FormState.h" -#include "Frame.h" -#include "FrameLoadRequest.h" -#include "FrameLoader.h" -#include "FrameLoaderClientQt.h" -#include "FrameTree.h" -#include "FrameView.h" -#if ENABLE(GEOLOCATION) -#include "GeolocationClientMock.h" -#include "GeolocationClientQt.h" -#include "GeolocationController.h" -#endif -#include "GeolocationPermissionClientQt.h" -#include "HTMLFormElement.h" -#include "HTMLFrameOwnerElement.h" -#include "HTMLInputElement.h" -#include "HTMLNames.h" -#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" -#include "LocalizedStrings.h" -#include "MIMETypeRegistry.h" -#include "NavigationAction.h" -#include "NetworkingContext.h" -#include "NodeList.h" -#include "NotImplemented.h" -#include "NotificationPresenterClientQt.h" -#include "Page.h" #include "PageClientQt.h" -#include "PageGroup.h" -#include "Pasteboard.h" -#include "PlatformKeyboardEvent.h" -#include "PlatformTouchEvent.h" -#include "PlatformWheelEvent.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" -#include "SchemeRegistry.h" -#include "Scrollbar.h" -#include "ScrollbarTheme.h" -#include "SecurityOrigin.h" -#include "Settings.h" -#if defined Q_OS_WIN32 -#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" @@ -167,11 +86,6 @@ using namespace WebCore; -// from text/qfont.cpp -QT_BEGIN_NAMESPACE -extern Q_GUI_EXPORT int qt_defaultDpi(); -QT_END_NAMESPACE - // Lookup table mapping QWebPage::WebActions to the associated Editor commands static const char* editorCommandWebActions[] = { @@ -220,7 +134,7 @@ static const char* editorCommandWebActions[] = "MoveToEndOfLineAndModifySelection", // SelectEndOfLine, "MoveToBeginningOfParagraphAndModifySelection", // SelectStartOfBlock, "MoveToEndOfParagraphAndModifySelection", // SelectEndOfBlock, - "MoveToBeginningOfDocumentAndModifySelection", //SelectStartOfDocument, + "MoveToBeginningOfDocumentAndModifySelection", // SelectStartOfDocument, "MoveToEndOfDocumentAndModifySelection", // SelectEndOfDocument, "DeleteWordBackward", // DeleteStartOfWord, "DeleteWordForward", // DeleteEndOfWord, @@ -273,46 +187,11 @@ const char* QWebPagePrivate::editorCommandForWebActions(QWebPage::WebAction acti return 0; } -static inline DragOperation dropActionToDragOp(Qt::DropActions actions) -{ - unsigned result = 0; - if (actions & Qt::CopyAction) - result |= DragOperationCopy; - // DragOperationgeneric represents InternetExplorer's equivalent of Move operation, - // hence it should be considered as "move" - if (actions & Qt::MoveAction) - result |= (DragOperationMove | DragOperationGeneric); - if (actions & Qt::LinkAction) - result |= DragOperationLink; - if (result == (DragOperationCopy | DragOperationMove | DragOperationGeneric | DragOperationLink)) - result = DragOperationEvery; - return (DragOperation)result; -} - -static inline Qt::DropAction dragOpToDropAction(unsigned actions) -{ - Qt::DropAction result = Qt::IgnoreAction; - if (actions & DragOperationCopy) - result = Qt::CopyAction; - else if (actions & DragOperationMove) - result = Qt::MoveAction; - // DragOperationgeneric represents InternetExplorer's equivalent of Move operation, - // hence it should be considered as "move" - else if (actions & DragOperationGeneric) - result = Qt::MoveAction; - else if (actions & DragOperationLink) - result = Qt::LinkAction; - return result; -} - QWebPagePrivate::QWebPagePrivate(QWebPage *qq) : q(qq) #ifndef QT_NO_UNDOSTACK , undoStack(0) #endif - , m_totalBytes(0) - , m_bytesReceived() - , clickCausedFocus(false) , linkPolicy(QWebPage::DontDelegateLinks) , m_viewportSize(QSize(0, 0)) , useFixedLayout(false) @@ -321,59 +200,14 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq) , inspectorIsInternalOnly(false) , m_lastDropAction(Qt::IgnoreAction) { -#if ENABLE(GEOLOCATION) || ENABLE(DEVICE_ORIENTATION) - bool useMock = QWebPageAdapter::drtRun; -#endif - WebKit::initializeWebKitWidgets(); - WebCore::initializeWebCoreQt(); - - Page::PageClients pageClients; - pageClients.chromeClient = new ChromeClientQt(this); - pageClients.contextMenuClient = new ContextMenuClientQt(); - 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) { - // In case running in DumpRenderTree mode set the controller to mock provider. - GeolocationClientMock* mock = new GeolocationClientMock; - WebCore::provideGeolocationTo(page, mock); - mock->setController(WebCore::GeolocationController::from(page)); - } else - WebCore::provideGeolocationTo(page, new GeolocationClientQt(this)); -#endif -#if ENABLE(DEVICE_ORIENTATION) - if (useMock) - WebCore::provideDeviceOrientationTo(page, new DeviceOrientationClientMock); - else - WebCore::provideDeviceOrientationTo(page, new DeviceOrientationClientQt); - WebCore::provideDeviceMotionTo(page, new DeviceMotionClientQt); -#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 - // separate settings for each group, so that for instance an integrated browser/email reader - // can use different settings for displaying HTML pages and HTML email. To make QtWebKit work - // as expected out of the box, we use a default group similar to what other ports are doing. - page->setGroupName("Default Group"); - - page->addLayoutMilestones(DidFirstVisuallyNonEmptyLayout); - - QWebPageAdapter::init(page); - - history.d = new QWebHistoryPrivate(static_cast<WebCore::BackForwardListImpl*>(page->backForwardList())); memset(actions, 0, sizeof(actions)); - PageGroup::setShouldTrackVisitedLinks(true); - #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) - NotificationPresenterClientQt* presenter = NotificationPresenterClientQt::notificationPresenter(); - presenter->addClient(); + addNotificationPresenterClient(); #ifndef QT_NO_SYSTEMTRAYICON - if (!presenter->hasSystemTrayIcon()) - presenter->setSystemTrayIcon(new QSystemTrayIcon); + if (!hasSystemTrayIcon()) + setSystemTrayIcon(new QSystemTrayIcon); #endif // QT_NO_SYSTEMTRAYICON #endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) } @@ -385,6 +219,7 @@ QWebPagePrivate::~QWebPagePrivate() #endif #ifndef QT_NO_UNDOSTACK delete undoStack; + undoStack = 0; #endif if (inspector) { @@ -401,11 +236,6 @@ QWebPagePrivate::~QWebPagePrivate() deletePage(); } -WebCore::Page* QWebPagePrivate::core(const QWebPage* page) -{ - return page->d->page; -} - void QWebPagePrivate::show() { if (!view) @@ -617,74 +447,70 @@ void QWebPagePrivate::createMainFrame() } } -static QWebPage::WebAction webActionForContextMenuAction(WebCore::ContextMenuAction action) +#define MAP_WEB_ACTION_FROM_ADAPTER_EQUIVALENT(Name, Value) \ + case QWebPageAdapter::Name: return QWebPage::Name + +static QWebPage::WebAction webActionForAdapterMenuAction(QWebPageAdapter::MenuAction action) { switch (action) { - case WebCore::ContextMenuItemTagOpenLink: return QWebPage::OpenLink; - case WebCore::ContextMenuItemTagOpenLinkInNewWindow: return QWebPage::OpenLinkInNewWindow; - case WebCore::ContextMenuItemTagOpenLinkInThisWindow: return QWebPage::OpenLinkInThisWindow; - case WebCore::ContextMenuItemTagDownloadLinkToDisk: return QWebPage::DownloadLinkToDisk; - case WebCore::ContextMenuItemTagCopyLinkToClipboard: return QWebPage::CopyLinkToClipboard; - case WebCore::ContextMenuItemTagOpenImageInNewWindow: return QWebPage::OpenImageInNewWindow; - case WebCore::ContextMenuItemTagDownloadImageToDisk: return QWebPage::DownloadImageToDisk; - case WebCore::ContextMenuItemTagCopyImageToClipboard: return QWebPage::CopyImageToClipboard; - case WebCore::ContextMenuItemTagCopyImageUrlToClipboard: return QWebPage::CopyImageUrlToClipboard; - case WebCore::ContextMenuItemTagOpenFrameInNewWindow: return QWebPage::OpenFrameInNewWindow; - case WebCore::ContextMenuItemTagCopy: return QWebPage::Copy; - case WebCore::ContextMenuItemTagGoBack: return QWebPage::Back; - case WebCore::ContextMenuItemTagGoForward: return QWebPage::Forward; - case WebCore::ContextMenuItemTagStop: return QWebPage::Stop; - case WebCore::ContextMenuItemTagReload: return QWebPage::Reload; - case WebCore::ContextMenuItemTagCut: return QWebPage::Cut; - case WebCore::ContextMenuItemTagPaste: return QWebPage::Paste; - case WebCore::ContextMenuItemTagDefaultDirection: return QWebPage::SetTextDirectionDefault; - case WebCore::ContextMenuItemTagLeftToRight: return QWebPage::SetTextDirectionLeftToRight; - case WebCore::ContextMenuItemTagRightToLeft: return QWebPage::SetTextDirectionRightToLeft; - case WebCore::ContextMenuItemTagBold: return QWebPage::ToggleBold; - case WebCore::ContextMenuItemTagItalic: return QWebPage::ToggleItalic; - case WebCore::ContextMenuItemTagUnderline: return QWebPage::ToggleUnderline; - case WebCore::ContextMenuItemTagSelectAll: return QWebPage::SelectAll; + FOR_EACH_MAPPED_MENU_ACTION(MAP_WEB_ACTION_FROM_ADAPTER_EQUIVALENT, SEMICOLON_SEPARATOR); #if ENABLE(INSPECTOR) - case WebCore::ContextMenuItemTagInspectElement: return QWebPage::InspectElement; + case QWebPageAdapter::InspectElement: return QWebPage::InspectElement; #endif - default: break; + default: + ASSERT_NOT_REACHED(); + break; } return QWebPage::NoWebAction; } +#define MAP_ADAPTER_ACTION_FROM_WEBACTION_EQUIVALENT(Name, Value) \ + case QWebPage::Name: return QWebPageAdapter::Name + +static QWebPageAdapter::MenuAction adapterMenuActionForWebAction(QWebPage::WebAction action) +{ + switch (action) { + FOR_EACH_MAPPED_MENU_ACTION(MAP_ADAPTER_ACTION_FROM_WEBACTION_EQUIVALENT, SEMICOLON_SEPARATOR); +#if ENABLE(INSPECTOR) + case QWebPage::InspectElement: return QWebPageAdapter::InspectElement; +#endif + default: + ASSERT_NOT_REACHED(); + break; + } + return QWebPageAdapter::NoAction; +} + #ifndef QT_NO_CONTEXTMENU -QMenu *QWebPagePrivate::createContextMenu(const WebCore::ContextMenu *webcoreMenu, - const QList<WebCore::ContextMenuItem> *items, QBitArray *visitedWebActions) +typedef QWebPageAdapter::MenuItemDescription MenuItem; +QMenu *createContextMenu(QWebPage* page, const QList<MenuItem>& items, QBitArray *visitedWebActions) { - if (!client || !webcoreMenu) + if (items.isEmpty()) return 0; - 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); + QMenu* menu = new QMenu(page->view()); + for (int i = 0; i < items.count(); ++i) { + const MenuItem &item = items.at(i); + switch (item.type) { + case MenuItem::Action: { + QWebPage::WebAction action = webActionForAdapterMenuAction(item.action); + QAction *a = page->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); + a->setEnabled(item.traits & MenuItem::Enabled); + a->setCheckable(item.traits & MenuItem::Checkable); + a->setChecked(item.traits & MenuItem::Checked); menu->addAction(a); visitedWebActions->setBit(action); } break; } - case WebCore::SeparatorType: + case MenuItem::Separator: menu->addSeparator(); break; - case WebCore::SubmenuType: { - QMenu *subMenu = createContextMenu(webcoreMenu, item.platformSubMenu(), visitedWebActions); + case MenuItem::SubMenu: { + QMenu *subMenu = createContextMenu(page, item.subMenu, visitedWebActions); + Q_ASSERT(subMenu); bool anyEnabledAction = false; @@ -696,7 +522,7 @@ QMenu *QWebPagePrivate::createContextMenu(const WebCore::ContextMenu *webcoreMen // don't show sub-menus with just disabled actions if (anyEnabledAction) { - subMenu->setTitle(item.title()); + subMenu->setTitle(item.subMenuTitle); menu->addAction(subMenu->menuAction()); } else delete subMenu; @@ -708,6 +534,18 @@ QMenu *QWebPagePrivate::createContextMenu(const WebCore::ContextMenu *webcoreMen } #endif // QT_NO_CONTEXTMENU +void QWebPagePrivate::createAndSetCurrentContextMenu(const QList<MenuItemDescription>& items, QBitArray* visitedWebActions) +{ +#ifndef QT_NO_CONTEXTMENU + delete currentContextMenu.data(); + + currentContextMenu = createContextMenu(q, items, visitedWebActions); +#else + Q_UNUSED(menuDescription); + Q_UNUSED(visitedWebActions); +#endif // QT_NO_CONTEXTMENU +} + #ifndef QT_NO_ACTION void QWebPagePrivate::_q_webActionTriggered(bool checked) { @@ -719,14 +557,6 @@ void QWebPagePrivate::_q_webActionTriggered(bool checked) } #endif // QT_NO_ACTION -void QWebPagePrivate::_q_cleanupLeakMessages() -{ -#ifndef NDEBUG - // Need this to make leak messages accurate. - memoryCache()->setCapacities(0, 0, 0); -#endif -} - void QWebPagePrivate::updateAction(QWebPage::WebAction action) { #ifdef QT_NO_ACTION @@ -736,56 +566,41 @@ void QWebPagePrivate::updateAction(QWebPage::WebAction action) if (!a || !mainFrame) return; - WebCore::FrameLoader *loader = mainFrame.data()->d->frame->loader(); - WebCore::Editor *editor = page->focusController()->focusedOrMainFrame()->editor(); - bool enabled = a->isEnabled(); bool checked = a->isChecked(); + QWebPageAdapter::MenuAction mappedAction = QWebPageAdapter::NoAction; + const char* commandName = 0; + switch (action) { - case QWebPage::Back: - enabled = page->canGoBackOrForward(-1); - break; - case QWebPage::Forward: - enabled = page->canGoBackOrForward(1); - break; - case QWebPage::Stop: - enabled = loader->isLoading(); - break; - case QWebPage::Reload: - case QWebPage::ReloadAndBypassCache: - enabled = !loader->isLoading(); - break; + case QWebPage::Back: + case QWebPage::Forward: + case QWebPage::Stop: + case QWebPage::Reload: + case QWebPage::SetTextDirectionDefault: + case QWebPage::SetTextDirectionLeftToRight: + case QWebPage::SetTextDirectionRightToLeft: + mappedAction = adapterMenuActionForWebAction(action); + break; + case QWebPage::ReloadAndBypassCache: // Manual mapping + mappedAction = QWebPageAdapter::Reload; + break; #ifndef QT_NO_UNDOSTACK - case QWebPage::Undo: - case QWebPage::Redo: - // those two are handled by QUndoStack - break; + case QWebPage::Undo: + case QWebPage::Redo: + // those two are handled by QUndoStack + break; #endif // QT_NO_UNDOSTACK - case QWebPage::SelectAll: // editor command is always enabled - break; - case QWebPage::SetTextDirectionDefault: - case QWebPage::SetTextDirectionLeftToRight: - case QWebPage::SetTextDirectionRightToLeft: - enabled = editor->canEdit(); - checked = false; - break; - default: { - // see if it's an editor command - const char* commandName = editorCommandForWebActions(action); - - // if it's an editor command, let it's logic determine state - if (commandName) { - Editor::Command command = editor->command(commandName); - enabled = command.isEnabled(); - if (enabled) - checked = command.state() != FalseTriState; - else - checked = false; - } - break; - } + case QWebPage::SelectAll: // editor command is always enabled + break; + default: { + // see if it's an editor command + commandName = editorCommandForWebActions(action); + break; } + } + if (mappedAction != QWebPageAdapter::NoAction || commandName) + updateActionInternal(mappedAction, commandName, &enabled, &checked); a->setEnabled(enabled); @@ -925,120 +740,9 @@ void QWebPagePrivate::timerEvent(QTimerEvent *ev) q->timerEvent(ev); } -void QWebPagePrivate::mouseMoveEvent(QMouseEvent* ev) -{ - WebCore::Frame* frame = QWebFramePrivate::core(mainFrame.data()); - if (!frame->view()) - return; - - bool accepted = frame->eventHandler()->mouseMoved(convertMouseEvent(ev, 0)); - ev->setAccepted(accepted); -} - -void QWebPagePrivate::mousePressEvent(QMouseEvent* ev) -{ - WebCore::Frame* frame = QWebFramePrivate::core(mainFrame.data()); - if (!frame->view()) - return; - - RefPtr<WebCore::Node> oldNode; - Frame* focusedFrame = page->focusController()->focusedFrame(); - if (Document* focusedDocument = focusedFrame ? focusedFrame->document() : 0) - oldNode = focusedDocument->focusedNode(); - - if (tripleClickTimer.isActive() - && (ev->pos() - tripleClick).manhattanLength() - < QApplication::startDragDistance()) { - mouseTripleClickEvent(ev); - return; - } - - bool accepted = false; - adjustPointForClicking(ev); - PlatformMouseEvent mev = convertMouseEvent(ev, 1); - // ignore the event if we can't map Qt's mouse buttons to WebCore::MouseButton - if (mev.button() != NoButton) - accepted = frame->eventHandler()->handleMousePressEvent(mev); - ev->setAccepted(accepted); - - RefPtr<WebCore::Node> newNode; - focusedFrame = page->focusController()->focusedFrame(); - if (Document* focusedDocument = focusedFrame ? focusedFrame->document() : 0) - newNode = focusedDocument->focusedNode(); - - if (newNode && oldNode != newNode) - clickCausedFocus = true; -} - -void QWebPagePrivate::mouseDoubleClickEvent(QMouseEvent *ev) +bool QWebPagePrivate::requestSoftwareInputPanel() const { - WebCore::Frame* frame = QWebFramePrivate::core(mainFrame.data()); - if (!frame->view()) - return; - - bool accepted = false; - PlatformMouseEvent mev = convertMouseEvent(ev, 2); - // ignore the event if we can't map Qt's mouse buttons to WebCore::MouseButton - if (mev.button() != NoButton) - accepted = frame->eventHandler()->handleMousePressEvent(mev); - ev->setAccepted(accepted); - - tripleClickTimer.start(QApplication::doubleClickInterval(), q); - tripleClick = QPointF(ev->pos()).toPoint(); -} - -void QWebPagePrivate::mouseTripleClickEvent(QMouseEvent *ev) -{ - WebCore::Frame* frame = QWebFramePrivate::core(mainFrame.data()); - if (!frame->view()) - return; - - bool accepted = false; - PlatformMouseEvent mev = convertMouseEvent(ev, 3); - // ignore the event if we can't map Qt's mouse buttons to WebCore::MouseButton - if (mev.button() != NoButton) - accepted = frame->eventHandler()->handleMousePressEvent(mev); - ev->setAccepted(accepted); -} - -void QWebPagePrivate::mouseReleaseEvent(QMouseEvent *ev) -{ - WebCore::Frame* frame = QWebFramePrivate::core(mainFrame.data()); - if (!frame->view()) - return; - - bool accepted = false; - adjustPointForClicking(ev); - PlatformMouseEvent mev = convertMouseEvent(ev, 0); - // ignore the event if we can't map Qt's mouse buttons to WebCore::MouseButton - if (mev.button() != NoButton) - accepted = frame->eventHandler()->handleMouseReleaseEvent(mev); - ev->setAccepted(accepted); - - handleSoftwareInputPanel(ev->button(), QPointF(ev->pos()).toPoint()); -} - -void QWebPagePrivate::handleSoftwareInputPanel(Qt::MouseButton button, const QPoint& pos) -{ - Frame* frame = page->focusController()->focusedFrame(); - if (!frame) - return; - - if (client && client->inputMethodEnabled() - && frame->document()->focusedNode() - && button == Qt::LeftButton && qApp->autoSipEnabled()) { - QStyle::RequestSoftwareInputPanel behavior = QStyle::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()) { - QEvent event(QEvent::RequestSoftwareInputPanel); - QApplication::sendEvent(client->ownerWidget(), &event); - } - } - } - - clickCausedFocus = false; + return QStyle::RequestSoftwareInputPanel(client->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel)) == QStyle::RSIP_OnMouseClick; } #ifndef QT_NO_CONTEXTMENU @@ -1070,19 +774,6 @@ QMenu *QWebPage::createStandardContextMenu() #endif } -#ifndef QT_NO_WHEELEVENT -void QWebPagePrivate::wheelEvent(QWheelEvent *ev) -{ - WebCore::Frame* frame = QWebFramePrivate::core(mainFrame.data()); - if (!frame->view()) - return; - - PlatformWheelEvent pev = convertWheelEvent(ev, QApplication::wheelScrollLines()); - bool accepted = frame->eventHandler()->handleWheelEvent(pev); - ev->setAccepted(accepted); -} -#endif // QT_NO_WHEELEVENT - #ifndef QT_NO_SHORTCUT QWebPage::WebAction QWebPagePrivate::editorActionForKeyEvent(QKeyEvent* event) { @@ -1137,16 +828,14 @@ QWebPage::WebAction QWebPagePrivate::editorActionForKeyEvent(QKeyEvent* event) void QWebPagePrivate::keyPressEvent(QKeyEvent *ev) { - bool handled = false; - WebCore::Frame* frame = page->focusController()->focusedOrMainFrame(); // we forward the key event to WebCore first to handle potential DOM // defined event handlers and later on end up in EditorClientQt::handleKeyboardEvent // to trigger editor commands via triggerAction(). - if (!handled) - handled = frame->eventHandler()->keyEvent(ev); + bool handled = handleKeyEvent(ev); + if (!handled) { handled = true; - if (!handleScrolling(ev, frame)) { + if (!handleScrolling(ev)) { switch (ev->key()) { case Qt::Key_Back: q->triggerAction(QWebPage::Back); @@ -1183,60 +872,25 @@ void QWebPagePrivate::keyReleaseEvent(QKeyEvent *ev) return; } - WebCore::Frame* frame = page->focusController()->focusedOrMainFrame(); - bool handled = frame->eventHandler()->keyEvent(ev); + bool handled = handleKeyEvent(ev); ev->setAccepted(handled); } -void QWebPagePrivate::focusInEvent(QFocusEvent*) -{ - FocusController *focusController = page->focusController(); - focusController->setActive(true); - focusController->setFocused(true); - if (!focusController->focusedFrame()) - focusController->setFocusedFrame(QWebFramePrivate::core(mainFrame.data())); -} - -void QWebPagePrivate::focusOutEvent(QFocusEvent*) -{ - // only set the focused frame inactive so that we stop painting the caret - // and the focus frame. But don't tell the focus controller so that upon - // focusInEvent() we can re-activate the frame. - FocusController *focusController = page->focusController(); - // Call setFocused first so that window.onblur doesn't get called twice - focusController->setFocused(false); - focusController->setActive(false); -} - template<class T> void QWebPagePrivate::dragEnterEvent(T* ev) { #ifndef QT_NO_DRAGANDDROP - DragData dragData(ev->mimeData(), QPointF(ev->pos()).toPoint(), - QCursor::pos(), dropActionToDragOp(ev->possibleActions())); - Qt::DropAction action = dragOpToDropAction(page->dragController()->dragEntered(&dragData).operation); + Qt::DropAction action = dragEntered(ev->mimeData(), QPointF(ev->pos()).toPoint(), ev->possibleActions()); ev->setDropAction(action); ev->acceptProposedAction(); #endif } template<class T> -void QWebPagePrivate::dragLeaveEvent(T *ev) -{ -#ifndef QT_NO_DRAGANDDROP - DragData dragData(0, IntPoint(), QCursor::pos(), DragOperationNone); - page->dragController()->dragExited(&dragData); - ev->accept(); -#endif -} - -template<class T> void QWebPagePrivate::dragMoveEvent(T *ev) { #ifndef QT_NO_DRAGANDDROP - DragData dragData(ev->mimeData(), QPointF(ev->pos()).toPoint(), - QCursor::pos(), dropActionToDragOp(ev->possibleActions())); - m_lastDropAction = dragOpToDropAction(page->dragController()->dragUpdated(&dragData).operation); + m_lastDropAction = dragUpdated(ev->mimeData(), QPointF(ev->pos()).toPoint(), ev->possibleActions()); ev->setDropAction(m_lastDropAction); if (m_lastDropAction != Qt::IgnoreAction) ev->accept(); @@ -1247,9 +901,7 @@ template<class T> void QWebPagePrivate::dropEvent(T *ev) { #ifndef QT_NO_DRAGANDDROP - DragData dragData(ev->mimeData(), QPointF(ev->pos()).toPoint(), - QCursor::pos(), dropActionToDragOp(ev->possibleActions())); - if (page->dragController()->performDrag(&dragData)) { + if (performDrag(ev->mimeData(), QPointF(ev->pos()).toPoint(), ev->possibleActions())) { ev->setDropAction(m_lastDropAction); ev->accept(); } @@ -1276,12 +928,12 @@ void QWebPagePrivate::leaveEvent(QEvent*) void QWebPage::setPalette(const QPalette &pal) { d->palette = pal; - if (!d->mainFrame || !d->mainFrame.data()->d->frame->view()) + if (!d->mainFrame || !d->mainFrame.data()->d->hasView()) return; QBrush brush = pal.brush(QPalette::Base); QColor backgroundColor = brush.style() == Qt::SolidPattern ? brush.color() : QColor(); - QWebFramePrivate::core(d->mainFrame.data())->view()->updateBackgroundRecursively(backgroundColor, !backgroundColor.alpha()); + d->mainFrame.data()->d->updateBackgroundRecursively(backgroundColor); } QPalette QWebPage::palette() const @@ -1289,290 +941,15 @@ QPalette QWebPage::palette() const return d->palette; } -void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev) -{ - WebCore::Frame *frame = page->focusController()->focusedOrMainFrame(); - WebCore::Editor *editor = frame->editor(); - - if (!editor->canEdit()) { - ev->ignore(); - return; - } - - Node* node = 0; - if (frame->selection()->rootEditableElement()) - node = frame->selection()->rootEditableElement()->shadowAncestorNode(); - - Vector<CompositionUnderline> underlines; - bool hasSelection = false; - - for (int i = 0; i < ev->attributes().size(); ++i) { - const QInputMethodEvent::Attribute& a = ev->attributes().at(i); - switch (a.type) { - case QInputMethodEvent::TextFormat: { - QTextCharFormat textCharFormat = a.value.value<QTextFormat>().toCharFormat(); - QColor qcolor = textCharFormat.underlineColor(); - underlines.append(CompositionUnderline(qMin(a.start, (a.start + a.length)), qMax(a.start, (a.start + a.length)), Color(makeRGBA(qcolor.red(), qcolor.green(), qcolor.blue(), qcolor.alpha())), false)); - break; - } - case QInputMethodEvent::Cursor: { - frame->selection()->setCaretVisible(a.length); //if length is 0 cursor is invisible - if (a.length > 0) { - RenderObject* caretRenderer = frame->selection()->caretRenderer(); - if (caretRenderer) { - QColor qcolor = a.value.value<QColor>(); - caretRenderer->style()->setColor(Color(makeRGBA(qcolor.red(), qcolor.green(), qcolor.blue(), qcolor.alpha()))); - } - } - break; - } - case QInputMethodEvent::Selection: { - hasSelection = true; - // A selection in the inputMethodEvent is always reflected in the visible text - if (node) { - if (HTMLTextFormControlElement* textControl = toTextFormControl(node)) - textControl->setSelectionRange(qMin(a.start, (a.start + a.length)), qMax(a.start, (a.start + a.length))); - } - - if (!ev->preeditString().isEmpty()) - editor->setComposition(ev->preeditString(), underlines, qMin(a.start, (a.start + a.length)), qMax(a.start, (a.start + a.length))); - else { - // If we are in the middle of a composition, an empty pre-edit string and a selection of zero - // cancels the current composition - if (editor->hasComposition() && (a.start + a.length == 0)) - editor->setComposition(QString(), underlines, 0, 0); - } - break; - } - default: - break; - } - } - - if (node && ev->replacementLength() > 0) { - int cursorPos = frame->selection()->extent().offsetInContainerNode(); - int start = cursorPos + ev->replacementStart(); - if (HTMLTextFormControlElement* textControl = toTextFormControl(node)) - textControl->setSelectionRange(start, start + ev->replacementLength()); - // Commit regardless of whether commitString is empty, to get rid of selection. - editor->confirmComposition(ev->commitString()); - } else if (!ev->commitString().isEmpty()) { - if (editor->hasComposition()) - editor->confirmComposition(ev->commitString()); - else - editor->insertText(ev->commitString(), 0); - } else if (!hasSelection && !ev->preeditString().isEmpty()) - editor->setComposition(ev->preeditString(), underlines, 0, 0); - else if (ev->preeditString().isEmpty() && editor->hasComposition()) - editor->confirmComposition(String()); - - ev->accept(); -} - -#ifndef QT_NO_PROPERTIES -typedef struct { - const char* name; - double deferredRepaintDelay; - double initialDeferredRepaintDelayDuringLoading; - double maxDeferredRepaintDelayDuringLoading; - double deferredRepaintDelayIncrementDuringLoading; -} QRepaintThrottlingPreset; - -void QWebPagePrivate::dynamicPropertyChangeEvent(QDynamicPropertyChangeEvent* event) -{ - if (event->propertyName() == "_q_viewMode") { - page->setViewMode(Page::stringToViewMode(q->property("_q_viewMode").toString())); - } else if (event->propertyName() == "_q_HTMLTokenizerChunkSize") { - int chunkSize = q->property("_q_HTMLTokenizerChunkSize").toInt(); - q->handle()->page->setCustomHTMLTokenizerChunkSize(chunkSize); - } else if (event->propertyName() == "_q_HTMLTokenizerTimeDelay") { - double timeDelay = q->property("_q_HTMLTokenizerTimeDelay").toDouble(); - q->handle()->page->setCustomHTMLTokenizerTimeDelay(timeDelay); - } else if (event->propertyName() == "_q_RepaintThrottlingDeferredRepaintDelay") { - double p = q->property("_q_RepaintThrottlingDeferredRepaintDelay").toDouble(); - FrameView::setRepaintThrottlingDeferredRepaintDelay(p); - } else if (event->propertyName() == "_q_RepaintThrottlingnInitialDeferredRepaintDelayDuringLoading") { - double p = q->property("_q_RepaintThrottlingnInitialDeferredRepaintDelayDuringLoading").toDouble(); - FrameView::setRepaintThrottlingnInitialDeferredRepaintDelayDuringLoading(p); - } else if (event->propertyName() == "_q_RepaintThrottlingMaxDeferredRepaintDelayDuringLoading") { - double p = q->property("_q_RepaintThrottlingMaxDeferredRepaintDelayDuringLoading").toDouble(); - FrameView::setRepaintThrottlingMaxDeferredRepaintDelayDuringLoading(p); - } else if (event->propertyName() == "_q_RepaintThrottlingDeferredRepaintDelayIncrementDuringLoading") { - double p = q->property("_q_RepaintThrottlingDeferredRepaintDelayIncrementDuringLoading").toDouble(); - FrameView::setRepaintThrottlingDeferredRepaintDelayIncrementDuringLoading(p); - } else if (event->propertyName() == "_q_RepaintThrottlingPreset") { - static const QRepaintThrottlingPreset presets[] = { - { "NoThrottling", 0, 0, 0, 0 }, - { "Legacy", 0.025, 0, 2.5, 0.5 }, - { "Minimal", 0.01, 0, 1, 0.2 }, - { "Medium", 0.025, 1, 5, 0.5 }, - { "Heavy", 0.1, 2, 10, 1 } - }; - - QString p = q->property("_q_RepaintThrottlingPreset").toString(); - for (size_t i = 0; i < sizeof(presets) / sizeof(presets[0]); i++) { - if (p == QLatin1String(presets[i].name)) { - FrameView::setRepaintThrottlingDeferredRepaintDelay( - presets[i].deferredRepaintDelay); - FrameView::setRepaintThrottlingnInitialDeferredRepaintDelayDuringLoading( - presets[i].initialDeferredRepaintDelayDuringLoading); - FrameView::setRepaintThrottlingMaxDeferredRepaintDelayDuringLoading( - presets[i].maxDeferredRepaintDelayDuringLoading); - FrameView::setRepaintThrottlingDeferredRepaintDelayIncrementDuringLoading( - presets[i].deferredRepaintDelayIncrementDuringLoading); - break; - } - } - } - else if (event->propertyName() == "_q_webInspectorServerPort") { - InspectorServerQt* inspectorServer = InspectorServerQt::server(); - inspectorServer->listen(inspectorServerPort()); - } else if (event->propertyName() == "_q_deadDecodedDataDeletionInterval") { - double interval = q->property("_q_deadDecodedDataDeletionInterval").toDouble(); - memoryCache()->setDeadDecodedDataDeletionInterval(interval); - } -} -#endif - void QWebPagePrivate::shortcutOverrideEvent(QKeyEvent* event) { - WebCore::Frame* frame = page->focusController()->focusedOrMainFrame(); - WebCore::Editor* editor = frame->editor(); - if (editor->canEdit()) { - if (event->modifiers() == Qt::NoModifier - || event->modifiers() == Qt::ShiftModifier - || event->modifiers() == Qt::KeypadModifier) { - if (event->key() < Qt::Key_Escape) { - event->accept(); - } else { - switch (event->key()) { - case Qt::Key_Return: - case Qt::Key_Enter: - case Qt::Key_Delete: - case Qt::Key_Home: - case Qt::Key_End: - case Qt::Key_Backspace: - case Qt::Key_Left: - case Qt::Key_Right: - case Qt::Key_Up: - case Qt::Key_Down: - case Qt::Key_Tab: - event->accept(); - default: - break; - } - } - } -#ifndef QT_NO_SHORTCUT - else if (editorActionForKeyEvent(event) != QWebPage::NoWebAction) - event->accept(); -#endif - } -} - -bool QWebPagePrivate::handleScrolling(QKeyEvent *ev, Frame *frame) -{ - ScrollDirection direction; - ScrollGranularity granularity; - -#ifndef QT_NO_SHORTCUT - if (ev == QKeySequence::MoveToNextPage - || (ev->key() == Qt::Key_Space && !(ev->modifiers() & Qt::ShiftModifier))) { - granularity = ScrollByPage; - direction = ScrollDown; - } else if (ev == QKeySequence::MoveToPreviousPage - || ((ev->key() == Qt::Key_Space) && (ev->modifiers() & Qt::ShiftModifier))) { - granularity = ScrollByPage; - direction = ScrollUp; - } else -#endif // QT_NO_SHORTCUT - if ((ev->key() == Qt::Key_Up && ev->modifiers() & Qt::ControlModifier) - || ev->key() == Qt::Key_Home) { - granularity = ScrollByDocument; - direction = ScrollUp; - } else if ((ev->key() == Qt::Key_Down && ev->modifiers() & Qt::ControlModifier) - || ev->key() == Qt::Key_End) { - granularity = ScrollByDocument; - direction = ScrollDown; - } else { - switch (ev->key()) { - case Qt::Key_Up: - granularity = ScrollByLine; - direction = ScrollUp; - break; - case Qt::Key_Down: - granularity = ScrollByLine; - direction = ScrollDown; - break; - case Qt::Key_Left: - granularity = ScrollByLine; - direction = ScrollLeft; - break; - case Qt::Key_Right: - granularity = ScrollByLine; - direction = ScrollRight; - break; - default: - return false; - } - } - - return frame->eventHandler()->scrollRecursively(direction, granularity); -} - -void QWebPagePrivate::adjustPointForClicking(QMouseEvent*) -{ - notImplemented(); -} - -#if !defined(QT_NO_GRAPHICSVIEW) -void QWebPagePrivate::adjustPointForClicking(QGraphicsSceneMouseEvent* ev) -{ - QtPlatformPlugin platformPlugin; - OwnPtr<QWebTouchModifier> touchModifier = platformPlugin.createTouchModifier(); - if (!touchModifier) - return; - - unsigned topPadding = touchModifier->hitTestPaddingForTouch(QWebTouchModifier::Up); - unsigned rightPadding = touchModifier->hitTestPaddingForTouch(QWebTouchModifier::Right); - unsigned bottomPadding = touchModifier->hitTestPaddingForTouch(QWebTouchModifier::Down); - unsigned leftPadding = touchModifier->hitTestPaddingForTouch(QWebTouchModifier::Left); - - touchModifier = nullptr; - - if (!topPadding && !rightPadding && !bottomPadding && !leftPadding) - return; - - Document* startingDocument = page->mainFrame()->document(); - if (!startingDocument) - return; - - IntPoint originalPoint(QPointF(ev->pos()).toPoint()); - TouchAdjuster touchAdjuster(topPadding, rightPadding, bottomPadding, leftPadding); - IntPoint adjustedPoint = touchAdjuster.findCandidatePointForTouch(originalPoint, startingDocument); - if (adjustedPoint == IntPoint::zero()) + if (handleShortcutOverrideEvent(event)) return; - - ev->setPos(QPointF(adjustedPoint)); -} +#ifndef QT_NO_SHORTCUT + if (editorActionForKeyEvent(event) != QWebPage::NoWebAction) + event->accept(); #endif -bool QWebPagePrivate::touchEvent(QTouchEvent* event) -{ -#if ENABLE(TOUCH_EVENTS) - WebCore::Frame* frame = QWebFramePrivate::core(mainFrame.data()); - if (!frame->view()) - return false; - - // Always accept the QTouchEvent so that we'll receive also TouchUpdate and TouchEnd events - event->setAccepted(true); - - // Return whether the default action was cancelled in the JS event handler - return frame->eventHandler()->handleTouchEvent(convertTouchEvent(event)); -#else - event->ignore(); - return false; -#endif } bool QWebPagePrivate::gestureEvent(QGestureEvent* event) @@ -1623,82 +1000,7 @@ bool QWebPagePrivate::gestureEvent(QGestureEvent* event) */ QVariant QWebPage::inputMethodQuery(Qt::InputMethodQuery property) const { - Frame* frame = d->page->focusController()->focusedFrame(); - if (!frame) - return QVariant(); - - WebCore::Editor* editor = frame->editor(); - - RenderObject* renderer = 0; - RenderTextControl* renderTextControl = 0; - - if (frame->selection()->rootEditableElement()) - renderer = frame->selection()->rootEditableElement()->shadowAncestorNode()->renderer(); - - if (renderer && renderer->isTextControl()) - renderTextControl = toRenderTextControl(renderer); - - switch (property) { - case Qt::ImMicroFocus: { - WebCore::FrameView* view = frame->view(); - if (view && view->needsLayout()) { - // We can't access absoluteCaretBounds() while the view needs to layout. - return QVariant(); - } - return QVariant(view->contentsToWindow(frame->selection()->absoluteCaretBounds())); - } - case Qt::ImFont: { - if (renderTextControl) { - RenderStyle* renderStyle = renderTextControl->style(); - return QVariant(QFont(renderStyle->font().syntheticFont())); - } - return QVariant(QFont()); - } - case Qt::ImCursorPosition: { - if (editor->hasComposition()) - return QVariant(frame->selection()->end().offsetInContainerNode()); - return QVariant(frame->selection()->extent().offsetInContainerNode()); - } - case Qt::ImSurroundingText: { - if (renderTextControl && renderTextControl->textFormControlElement()) { - QString text = renderTextControl->textFormControlElement()->value(); - RefPtr<Range> range = editor->compositionRange(); - if (range) - text.remove(range->startPosition().offsetInContainerNode(), TextIterator::rangeLength(range.get())); - return QVariant(text); - } - return QVariant(); - } - case Qt::ImCurrentSelection: { - if (!editor->hasComposition() && renderTextControl && renderTextControl->textFormControlElement()) { - int start = frame->selection()->start().offsetInContainerNode(); - int end = frame->selection()->end().offsetInContainerNode(); - if (end > start) - return QVariant(QString(renderTextControl->textFormControlElement()->value()).mid(start, end - start)); - } - return QVariant(); - - } - case Qt::ImAnchorPosition: { - if (editor->hasComposition()) - return QVariant(frame->selection()->start().offsetInContainerNode()); - return QVariant(frame->selection()->base().offsetInContainerNode()); - } - case Qt::ImMaximumTextLength: { - if (frame->selection()->isContentEditable()) { - if (frame->document() && frame->document()->focusedNode()) { - if (frame->document()->focusedNode()->hasTagName(HTMLNames::inputTag)) { - HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(frame->document()->focusedNode()); - return QVariant(inputElement->maxLength()); - } - } - return QVariant(HTMLInputElement::maximumLength); - } - return QVariant(0); - } - default: - return QVariant(); - } + return d->inputMethodQuery(property); } /*! @@ -1735,143 +1037,6 @@ QWebInspector* QWebPagePrivate::getOrCreateInspector() return inspector; } -/*! \internal */ -InspectorController* QWebPagePrivate::inspectorController() -{ -#if ENABLE(INSPECTOR) - return page->inspectorController(); -#else - return 0; -#endif -} - -quint16 QWebPagePrivate::inspectorServerPort() -{ -#if ENABLE(INSPECTOR) && !defined(QT_NO_PROPERTIES) - if (q && q->property("_q_webInspectorServerPort").isValid()) - return q->property("_q_webInspectorServerPort").toInt(); -#endif - return 0; -} - -static bool hasMouseListener(Element* element) -{ - ASSERT(element); - return element->hasEventListeners(eventNames().clickEvent) - || element->hasEventListeners(eventNames().mousedownEvent) - || element->hasEventListeners(eventNames().mouseupEvent); -} - -static bool isClickableElement(Element* element, RefPtr<NodeList> list) -{ - ASSERT(element); - bool isClickable = hasMouseListener(element); - if (!isClickable && list) { - Element* parent = element->parentElement(); - unsigned count = list->length(); - for (unsigned i = 0; i < count && parent; i++) { - if (list->item(i) != parent) - continue; - - isClickable = hasMouseListener(parent); - if (isClickable) - break; - - parent = parent->parentElement(); - } - } - - ExceptionCode ec = 0; - return isClickable - || element->webkitMatchesSelector("a,*:link,*:visited,*[role=button],button,input,select,label", ec) - || CSSComputedStyleDeclaration::create(element)->getPropertyValue(cssPropertyID("cursor")) == "pointer"; -} - -static bool isValidFrameOwner(Element* element) -{ - ASSERT(element); - return element->isFrameOwnerElement() && static_cast<HTMLFrameOwnerElement*>(element)->contentFrame(); -} - -static Element* nodeToElement(Node* node) -{ - if (node && node->isElementNode()) - return static_cast<Element*>(node); - return 0; -} - -QWebPagePrivate::TouchAdjuster::TouchAdjuster(unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding) - : m_topPadding(topPadding) - , m_rightPadding(rightPadding) - , m_bottomPadding(bottomPadding) - , m_leftPadding(leftPadding) -{ -} - -IntPoint QWebPagePrivate::TouchAdjuster::findCandidatePointForTouch(const IntPoint& touchPoint, Document* document) const -{ - if (!document) - return IntPoint(); - - int x = touchPoint.x(); - int y = touchPoint.y(); - - RefPtr<NodeList> intersectedNodes = document->nodesFromRect(x, y, m_topPadding, m_rightPadding, m_bottomPadding, m_leftPadding, false /*ignoreClipping*/, false /*allowShadowContent*/); - if (!intersectedNodes) - return IntPoint(); - - Element* closestClickableElement = 0; - IntRect largestIntersectionRect; - FrameView* view = document->frame()->view(); - - // Touch rect in contents coordinates. - IntRect touchRect(HitTestLocation::rectForPoint(view->windowToContents(IntPoint(x, y)), m_topPadding, m_rightPadding, m_bottomPadding, m_leftPadding)); - - // Iterate over the list of nodes hit looking for the one whose bounding area - // has largest intersection with the touch area (point + padding). - for (unsigned i = 0; i < intersectedNodes->length(); i++) { - Node* currentNode = intersectedNodes->item(i); - - Element* currentElement = nodeToElement(currentNode); - if (!currentElement || (!isClickableElement(currentElement, 0) && !isValidFrameOwner(currentElement))) - continue; - - IntRect currentElementBoundingRect = currentElement->pixelSnappedBoundingBox(); - currentElementBoundingRect.intersect(touchRect); - - if (currentElementBoundingRect.isEmpty()) - continue; - - int currentIntersectionRectArea = currentElementBoundingRect.width() * currentElementBoundingRect.height(); - int largestIntersectionRectArea = largestIntersectionRect.width() * largestIntersectionRect.height(); - if (currentIntersectionRectArea > largestIntersectionRectArea) { - closestClickableElement = currentElement; - largestIntersectionRect = currentElementBoundingRect; - } - } - - if (largestIntersectionRect.isEmpty()) - return IntPoint(); - - // Handle the case when user taps a inner frame. It is done in three steps: - // 1) Transform the original touch point to the inner document coordinates; - // 1) Call nodesFromRect for the inner document in case; - // 3) Re-add the inner frame offset (location) before passing the new clicking - // position to WebCore. - if (closestClickableElement->isFrameOwnerElement()) { - // Adjust client coordinates' origin to be top left of inner frame viewport. - PassRefPtr<ClientRect> rect = closestClickableElement->getBoundingClientRect(); - IntPoint newTouchPoint = touchPoint; - IntSize offset = IntSize(rect->left(), rect->top()); - newTouchPoint -= offset; - - HTMLFrameOwnerElement* owner = static_cast<HTMLFrameOwnerElement*>(closestClickableElement); - Document* childDocument = owner->contentFrame()->document(); - return findCandidatePointForTouch(newTouchPoint, childDocument); - } - return view->contentsToWindow(largestIntersectionRect).center(); -} - /*! \enum QWebPage::FindFlag @@ -2199,10 +1364,6 @@ QWebPage::QWebPage(QObject *parent) */ QWebPage::~QWebPage() { - d->createMainFrame(); - FrameLoader* loader = d->mainFrame.data()->d->frame->loader(); - if (loader) - loader->detachFromParent(); delete d; } @@ -2228,8 +1389,7 @@ QWebFrame *QWebPage::mainFrame() const QWebFrame *QWebPage::currentFrame() const { d->createMainFrame(); - WebCore::Frame *frame = d->page->focusController()->focusedOrMainFrame(); - return qobject_cast<QWebFrame*>(frame->loader()->networkingContext()->originatingObject()); + return qobject_cast<QWebFrame*>(d->currentFrame()); } @@ -2307,7 +1467,7 @@ QWidget *QWebPage::view() const */ void QWebPage::javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID) { - Q_UNUSED(sourceID) + Q_UNUSED(sourceID); // Catch plugin logDestroy message for LayoutTests/plugins/open-and-close-window-with-plugin.html // At this point DRT's WebPage has already been destroyed @@ -2329,7 +1489,7 @@ void QWebPage::javaScriptConsoleMessage(const QString& message, int lineNumber, */ void QWebPage::javaScriptAlert(QWebFrame *frame, const QString& msg) { - Q_UNUSED(frame) + Q_UNUSED(frame); #ifndef QT_NO_MESSAGEBOX QMessageBox box(view()); box.setWindowTitle(tr("JavaScript Alert - %1").arg(mainFrame()->url().host())); @@ -2348,7 +1508,7 @@ void QWebPage::javaScriptAlert(QWebFrame *frame, const QString& msg) */ bool QWebPage::javaScriptConfirm(QWebFrame *frame, const QString& msg) { - Q_UNUSED(frame) + Q_UNUSED(frame); #ifdef QT_NO_MESSAGEBOX return true; #else @@ -2373,7 +1533,7 @@ bool QWebPage::javaScriptConfirm(QWebFrame *frame, const QString& msg) */ bool QWebPage::javaScriptPrompt(QWebFrame *frame, const QString& msg, const QString& defaultValue, QString* result) { - Q_UNUSED(frame) + Q_UNUSED(frame); bool ok = false; #ifndef QT_NO_INPUTDIALOG @@ -2427,13 +1587,13 @@ void QWebPage::setFeaturePermission(QWebFrame* frame, Feature feature, Permissio case Notifications: #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) if (policy == PermissionGrantedByUser) - NotificationPresenterClientQt::notificationPresenter()->allowNotificationForFrame(frame->d->frame); + d->allowNotificationsForFrame(frame->d); #endif break; case Geolocation: #if ENABLE(GEOLOCATION) if (policy != PermissionUnknown) - GeolocationPermissionClientQt::geolocationPermissionClient()->setPermission(frame->d, (policy == PermissionGrantedByUser)); + d->setGeolocationEnabledForFrame(frame->d, (policy == PermissionGrantedByUser)); #endif break; @@ -2477,49 +1637,19 @@ QWebPage *QWebPage::createWindow(WebWindowType type) */ QObject *QWebPage::createPlugin(const QString &classid, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues) { - Q_UNUSED(classid) - Q_UNUSED(url) - Q_UNUSED(paramNames) - Q_UNUSED(paramValues) + Q_UNUSED(classid); + Q_UNUSED(url); + Q_UNUSED(paramNames); + Q_UNUSED(paramValues); return 0; } -static void extractContentTypeFromHash(const HashSet<String>& types, QStringList* list) -{ - if (!list) - return; - - HashSet<String>::const_iterator endIt = types.end(); - for (HashSet<String>::const_iterator it = types.begin(); it != endIt; ++it) - *list << *it; -} - -static void extractContentTypeFromPluginVector(const Vector<PluginPackage*>& plugins, QStringList* list) -{ - if (!list) - return; - - for (unsigned int i = 0; i < plugins.size(); ++i) { - MIMEToDescriptionsMap::const_iterator map_it = plugins[i]->mimeToDescriptions().begin(); - MIMEToDescriptionsMap::const_iterator map_end = plugins[i]->mimeToDescriptions().end(); - for (; map_it != map_end; ++map_it) - *list << map_it->key; - } -} - /*! * Returns the list of all content types supported by QWebPage. */ QStringList QWebPage::supportedContentTypes() const { - QStringList mimeTypes; - - extractContentTypeFromHash(MIMETypeRegistry::getSupportedImageMIMETypes(), &mimeTypes); - extractContentTypeFromHash(MIMETypeRegistry::getSupportedNonImageMIMETypes(), &mimeTypes); - if (d->page->settings() && d->page->settings()->arePluginsEnabled()) - extractContentTypeFromPluginVector(PluginDatabase::installedPlugins()->plugins(), &mimeTypes); - - return mimeTypes; + return d->supportedContentTypes(); } /*! @@ -2527,46 +1657,15 @@ QStringList QWebPage::supportedContentTypes() const */ bool QWebPage::supportsContentType(const QString& mimeType) const { - const String type = mimeType.toLower(); - if (MIMETypeRegistry::isSupportedImageMIMEType(type)) - return true; - - if (MIMETypeRegistry::isSupportedNonImageMIMEType(type)) - return true; - - if (d->page->settings() && d->page->settings()->arePluginsEnabled() - && PluginDatabase::installedPlugins()->isMIMETypeRegistered(type)) - return true; - - return false; -} - -static WebCore::FrameLoadRequest frameLoadRequest(const QUrl &url, WebCore::Frame *frame) -{ - return WebCore::FrameLoadRequest(frame->document()->securityOrigin(), - WebCore::ResourceRequest(url, frame->loader()->outgoingReferrer())); -} - -static void openNewWindow(const QUrl& url, WebCore::Frame* frame) -{ - if (Page* oldPage = frame->page()) { - WindowFeatures features; - NavigationAction action; - FrameLoadRequest request = frameLoadRequest(url, frame); - if (Page* newPage = oldPage->chrome()->createWindow(frame, request, features, action)) { - newPage->mainFrame()->loader()->loadFrameRequest(request, false, false, 0, 0, MaybeSendReferrer); - newPage->chrome()->show(); - } - } + return d->supportsContentType(mimeType); } static void collectChildFrames(QWebFrame* frame, QList<QWebFrame*>& list) { list << frame->childFrames(); QListIterator<QWebFrame*> it(frame->childFrames()); - while (it.hasNext()) { + while (it.hasNext()) collectChildFrames(it.next(), list); - } } /*! @@ -2581,115 +1680,65 @@ static void collectChildFrames(QWebFrame* frame, QList<QWebFrame*>& list) */ void QWebPage::triggerAction(WebAction action, bool) { - WebCore::Frame *frame = d->page->focusController()->focusedOrMainFrame(); - if (!frame) - return; - WebCore::Editor *editor = frame->editor(); const char *command = 0; + QWebPageAdapter::MenuAction mappedAction = QWebPageAdapter::NoAction; + QWebHitTestResultPrivate* hitTestResult = d->hitTestResult.d; switch (action) { - case OpenLink: - if (QWebFrame *targetFrame = d->hitTestResult.linkTargetFrame()) { - WTF::RefPtr<WebCore::Frame> wcFrame = targetFrame->d->frame; - targetFrame->d->frame->loader()->loadFrameRequest(frameLoadRequest(d->hitTestResult.linkUrl(), wcFrame.get()), - /*lockHistory*/ false, /*lockBackForwardList*/ false, /*event*/ 0, - /*FormState*/ 0, MaybeSendReferrer); - break; - } - // fall through - case OpenLinkInNewWindow: - openNewWindow(d->hitTestResult.linkUrl(), frame); - break; - case OpenLinkInThisWindow: - frame->loader()->loadFrameRequest(frameLoadRequest(d->hitTestResult.linkUrl(), frame), - /*lockHistory*/ false, /*lockBackForwardList*/ false, /*event*/ 0, /*FormState*/ 0, MaybeSendReferrer); - break; - case OpenFrameInNewWindow: { - KURL url = frame->loader()->documentLoader()->unreachableURL(); - if (url.isEmpty()) - url = frame->loader()->documentLoader()->url(); - openNewWindow(url, frame); - break; - } - case CopyLinkToClipboard: { -#if defined(Q_WS_X11) - bool oldSelectionMode = Pasteboard::generalPasteboard()->isSelectionMode(); - Pasteboard::generalPasteboard()->setSelectionMode(true); - editor->copyURL(d->hitTestResult.linkUrl(), d->hitTestResult.linkText()); - Pasteboard::generalPasteboard()->setSelectionMode(oldSelectionMode); -#endif - editor->copyURL(d->hitTestResult.linkUrl(), d->hitTestResult.linkText()); - break; - } - case OpenImageInNewWindow: - openNewWindow(d->hitTestResult.imageUrl(), frame); - break; - case DownloadImageToDisk: - frame->loader()->client()->startDownload(WebCore::ResourceRequest(d->hitTestResult.imageUrl(), frame->loader()->outgoingReferrer())); - break; - case DownloadLinkToDisk: - frame->loader()->client()->startDownload(WebCore::ResourceRequest(d->hitTestResult.linkUrl(), frame->loader()->outgoingReferrer())); - break; + case OpenLink: + case OpenLinkInNewWindow: + case OpenLinkInThisWindow: + case OpenFrameInNewWindow: + case CopyLinkToClipboard: + case OpenImageInNewWindow: + case DownloadImageToDisk: + case DownloadLinkToDisk: + case Back: + case Forward: + case Stop: + case Reload: + case SetTextDirectionDefault: + case SetTextDirectionLeftToRight: + case SetTextDirectionRightToLeft: + mappedAction = adapterMenuActionForWebAction(action); + break; + case ReloadAndBypassCache: // Manual mapping + mappedAction = QWebPageAdapter::Reload; + break; #ifndef QT_NO_CLIPBOARD - case CopyImageToClipboard: - QApplication::clipboard()->setPixmap(d->hitTestResult.pixmap()); - break; - case CopyImageUrlToClipboard: - QApplication::clipboard()->setText(d->hitTestResult.imageUrl().toString()); - break; + case CopyImageToClipboard: + QApplication::clipboard()->setPixmap(d->hitTestResult.pixmap()); + break; + case CopyImageUrlToClipboard: + QApplication::clipboard()->setText(d->hitTestResult.imageUrl().toString()); + break; #endif - case Back: - d->page->goBack(); - break; - case Forward: - d->page->goForward(); - break; - case Stop: - mainFrame()->d->frame->loader()->stopForUserCancel(); - d->updateNavigationActions(); - break; - case Reload: - mainFrame()->d->frame->loader()->reload(/*endtoendreload*/false); - break; - case ReloadAndBypassCache: - mainFrame()->d->frame->loader()->reload(/*endtoendreload*/true); - break; - case SetTextDirectionDefault: - editor->setBaseWritingDirection(NaturalWritingDirection); - break; - case SetTextDirectionLeftToRight: - editor->setBaseWritingDirection(LeftToRightWritingDirection); - break; - case SetTextDirectionRightToLeft: - editor->setBaseWritingDirection(RightToLeftWritingDirection); - break; - case InspectElement: { + case InspectElement: { #if ENABLE(INSPECTOR) - if (!d->hitTestResult.isNull()) { - d->getOrCreateInspector(); // Make sure the inspector is created - d->inspector->show(); // The inspector is expected to be shown on inspection - d->page->inspectorController()->inspect(d->hitTestResult.d->innerNonSharedNode.get()); - } -#endif - break; + if (!d->hitTestResult.isNull()) { + d->getOrCreateInspector(); // Make sure the inspector is created + d->inspector->show(); // The inspector is expected to be shown on inspection + mappedAction = QWebPageAdapter::InspectElement; } - case StopScheduledPageRefresh: { - QWebFrame* topFrame = mainFrame(); - topFrame->d->frame->navigationScheduler()->cancel(); - QList<QWebFrame*> childFrames; - collectChildFrames(topFrame, childFrames); - QListIterator<QWebFrame*> it(childFrames); - while (it.hasNext()) - it.next()->d->frame->navigationScheduler()->cancel(); - break; - } - default: - command = QWebPagePrivate::editorCommandForWebActions(action); - break; +#endif + break; } - - if (command) - editor->command(command).execute(); + case StopScheduledPageRefresh: { + QWebFrame* topFrame = mainFrame(); + topFrame->d->cancelLoad(); + QList<QWebFrame*> childFrames; + collectChildFrames(topFrame, childFrames); + QListIterator<QWebFrame*> it(childFrames); + while (it.hasNext()) + it.next()->d->cancelLoad(); + break; + } + default: + command = QWebPagePrivate::editorCommandForWebActions(action); + break; + } + if (command || mappedAction != QWebPageAdapter::NoAction) + d->triggerAction(mappedAction, hitTestResult, command, /*endToEndReload*/ action == ReloadAndBypassCache); } @@ -2833,8 +1882,8 @@ const char *QWebPagePrivate::editorCommandForKeyEvent(QKeyEvent* event) QSize QWebPage::viewportSize() const { - if (d->mainFrame && d->mainFrame.data()->d->frame->view()) - return d->mainFrame.data()->d->frame->view()->frameRect().size(); + if (d->mainFrame && d->mainFrame.data()->d->hasView()) + return d->mainFrame.data()->d->frameRect().size(); return d->m_viewportSize; } @@ -2855,12 +1904,11 @@ void QWebPage::setViewportSize(const QSize &size) const { d->m_viewportSize = size; - QWebFrame *frame = mainFrame(); - if (frame->d->frame && frame->d->frame->view()) { - WebCore::FrameView* view = frame->d->frame->view(); - view->resize(size); - view->adjustViewSize(); - } + QWebFrameAdapter* mainFrame = d->mainFrameAdapter(); + if (!mainFrame->hasView()) + return; + + mainFrame->setViewportSize(size); } static int getintenv(const char* variable) @@ -2927,52 +1975,37 @@ static QSize queryDeviceSizeForScreenContainingWidget(const QWidget* widget) QWebPage::ViewportAttributes QWebPage::viewportAttributesForSize(const QSize& availableSize) const { - static int desktopWidth = 980; - ViewportAttributes result; - if (availableSize.isEmpty()) - return result; // Returns an invalid instance. + if (availableSize.isEmpty()) + return result; // Returns an invalid instance. - int deviceWidth = getintenv("QTWEBKIT_DEVICE_WIDTH"); - int deviceHeight = getintenv("QTWEBKIT_DEVICE_HEIGHT"); + QSize deviceSize(getintenv("QTWEBKIT_DEVICE_WIDTH"), getintenv("QTWEBKIT_DEVICE_HEIGHT")); // Both environment variables need to be set - or they will be ignored. - if (deviceWidth < 0 && deviceHeight < 0) { - QSize size = queryDeviceSizeForScreenContainingWidget(view()); - deviceWidth = size.width(); - deviceHeight = size.height(); - } - - float devicePixelRatio = qt_defaultDpi() / WebCore::ViewportArguments::deprecatedTargetDPI; - - WebCore::ViewportAttributes conf = WebCore::computeViewportAttributes(d->viewportArguments(), desktopWidth, deviceWidth, deviceHeight, devicePixelRatio, availableSize); - WebCore::restrictMinimumScaleFactorToViewportSize(conf, availableSize, devicePixelRatio); - WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(conf); + if (deviceSize.isNull()) + deviceSize = queryDeviceSizeForScreenContainingWidget(view()); + QWebPageAdapter::ViewportAttributes attr = d->viewportAttributesForSize(availableSize, deviceSize); result.m_isValid = true; - result.m_size = QSizeF(conf.layoutSize.width(), conf.layoutSize.height()); - result.m_initialScaleFactor = conf.initialScale; - result.m_minimumScaleFactor = conf.minimumScale; - result.m_maximumScaleFactor = conf.maximumScale; - result.m_devicePixelRatio = devicePixelRatio; - result.m_isUserScalable = static_cast<bool>(conf.userScalable); - - d->page->setDeviceScaleFactor(devicePixelRatio); + result.m_size = attr.size; + result.m_initialScaleFactor = attr.initialScaleFactor; + result.m_minimumScaleFactor = attr.minimumScaleFactor; + result.m_maximumScaleFactor = attr.maximumScaleFactor; + result.m_devicePixelRatio = attr.devicePixelRatio; + result.m_isUserScalable = attr.isUserScalable; return result; } QSize QWebPage::preferredContentsSize() const { - QWebFrame* frame = d->mainFrame.data(); - if (frame) { - WebCore::FrameView* view = frame->d->frame->view(); - if (view && view->useFixedLayout()) - return d->mainFrame.data()->d->frame->view()->fixedLayoutSize(); - } + QWebFrameAdapter* mainFrame = d->mainFrame ? d->mainFrame->d : 0; + QSize customSize; + if (mainFrame && mainFrame->hasView()) + customSize = mainFrame->customLayoutSize(); - return d->fixedLayoutSize; + return customSize.isNull() ? d->fixedLayoutSize : customSize; } /*! @@ -3000,19 +2033,11 @@ void QWebPage::setPreferredContentsSize(const QSize& size) const d->fixedLayoutSize = size; - QWebFrame* frame = mainFrame(); - if (!frame->d->frame || !frame->d->frame->view()) + QWebFrameAdapter* mainFrame = d->mainFrameAdapter(); + if (!mainFrame->hasView()) return; - WebCore::FrameView* view = frame->d->frame->view(); - - if (size.isValid()) { - view->setUseFixedLayout(true); - view->setFixedLayoutSize(size); - } else if (view->useFixedLayout()) - view->setUseFixedLayout(false); - - view->layout(); + mainFrame->setCustomLayoutSize(size); } /* @@ -3027,12 +2052,11 @@ void QWebPage::setPreferredContentsSize(const QSize& size) const */ void QWebPage::setActualVisibleContentRect(const QRect& rect) const { - QWebFrame* frame = mainFrame(); - if (!frame->d->frame || !frame->d->frame->view()) + QWebFrameAdapter* mainFrame = d->mainFrameAdapter(); + if (!mainFrame->hasView()) return; - WebCore::FrameView* view = frame->d->frame->view(); - view->setFixedVisibleContentRect(rect); + mainFrame->setFixedVisibleContentRect(rect); } /*! @@ -3051,21 +2075,21 @@ void QWebPage::setActualVisibleContentRect(const QRect& rect) const */ bool QWebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, QWebPage::NavigationType type) { - Q_UNUSED(frame) + Q_UNUSED(frame); if (type == NavigationTypeLinkClicked) { switch (d->linkPolicy) { - case DontDelegateLinks: - return true; + case DontDelegateLinks: + return true; - case DelegateExternalLinks: - if (WebCore::SchemeRegistry::shouldTreatURLSchemeAsLocal(request.url().scheme())) - return true; - emit linkClicked(request.url()); - return false; + case DelegateExternalLinks: + if (QWebPageAdapter::treatSchemeAsLocal(request.url().scheme())) + return true; + emit linkClicked(request.url()); + return false; - case DelegateAllLinks: - emit linkClicked(request.url()); - return false; + case DelegateAllLinks: + emit linkClicked(request.url()); + return false; } } return true; @@ -3080,10 +2104,7 @@ bool QWebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest & bool QWebPage::hasSelection() const { d->createMainFrame(); - WebCore::Frame* frame = d->page->focusController()->focusedOrMainFrame(); - if (frame) - return (frame->selection()->selection().selectionType() != VisibleSelection::NoSelection); - return false; + return d->hasSelection(); } /*! @@ -3097,10 +2118,7 @@ bool QWebPage::hasSelection() const QString QWebPage::selectedText() const { d->createMainFrame(); - WebCore::Frame* frame = d->page->focusController()->focusedOrMainFrame(); - if (frame->selection()->selection().selectionType() == VisibleSelection::NoSelection) - return QString(); - return frame->editor()->selectedText(); + return d->selectedText(); } /*! @@ -3115,7 +2133,7 @@ QString QWebPage::selectedText() const QString QWebPage::selectedHtml() const { d->createMainFrame(); - return d->page->focusController()->focusedOrMainFrame()->editor()->selectedRange()->toHTML(); + return d->selectedHtml(); } #ifndef QT_NO_ACTION @@ -3132,7 +2150,8 @@ QString QWebPage::selectedHtml() const */ QAction *QWebPage::action(WebAction action) const { - if (action == QWebPage::NoWebAction) return 0; + if (action == QWebPage::NoWebAction) + return 0; if (d->actions[action]) return d->actions[action]; @@ -3140,82 +2159,69 @@ QAction *QWebPage::action(WebAction action) const QIcon icon; QStyle *style = d->client ? d->client->style() : qApp->style(); bool checkable = false; + QWebPageAdapter::MenuAction mappedAction = QWebPageAdapter::NoAction; switch (action) { - case OpenLink: - text = contextMenuItemTagOpenLink(); - break; - case OpenLinkInNewWindow: - text = contextMenuItemTagOpenLinkInNewWindow(); - break; - case OpenFrameInNewWindow: - text = contextMenuItemTagOpenFrameInNewWindow(); - break; - case OpenLinkInThisWindow: - text = contextMenuItemTagOpenLinkInThisWindow(); - break; - - case DownloadLinkToDisk: - text = contextMenuItemTagDownloadLinkToDisk(); - break; - case CopyLinkToClipboard: - text = contextMenuItemTagCopyLinkToClipboard(); - break; - - case OpenImageInNewWindow: - text = contextMenuItemTagOpenImageInNewWindow(); - break; - case DownloadImageToDisk: - text = contextMenuItemTagDownloadImageToDisk(); - break; - case CopyImageToClipboard: - text = contextMenuItemTagCopyImageToClipboard(); - break; - case CopyImageUrlToClipboard: - text = contextMenuItemTagCopyImageUrlToClipboard(); - break; + // to be fetched from LocalizedStringsQt via the page adapter + case OpenLink: + case OpenLinkInNewWindow: + case OpenFrameInNewWindow: + case OpenLinkInThisWindow: + case DownloadLinkToDisk: + case CopyLinkToClipboard: + case OpenImageInNewWindow: + case DownloadImageToDisk: + case CopyImageToClipboard: + case CopyImageUrlToClipboard: + case Cut: + case Copy: + case Paste: + case SelectAll: + case SetTextDirectionDefault: + case SetTextDirectionLeftToRight: + case SetTextDirectionRightToLeft: + case ToggleBold: + case ToggleItalic: + case ToggleUnderline: + mappedAction = adapterMenuActionForWebAction(action); + break; + case InspectElement: +#if ENABLE(INSPECTOR) + mappedAction = QWebPageAdapter::InspectElement; +#endif + break; - case Back: - text = contextMenuItemTagGoBack(); - icon = style->standardIcon(QStyle::SP_ArrowBack); - break; - case Forward: - text = contextMenuItemTagGoForward(); - icon = style->standardIcon(QStyle::SP_ArrowForward); - break; - case Stop: - text = contextMenuItemTagStop(); - icon = style->standardIcon(QStyle::SP_BrowserStop); - break; - case Reload: - text = contextMenuItemTagReload(); - icon = style->standardIcon(QStyle::SP_BrowserReload); - break; + // icon needed as well, map by hand. + case Back: + mappedAction = QWebPageAdapter::Back; + icon = style->standardIcon(QStyle::SP_ArrowBack); + break; + case Forward: + mappedAction = QWebPageAdapter::Forward; + icon = style->standardIcon(QStyle::SP_ArrowForward); + break; + case Stop: + mappedAction = QWebPageAdapter::Stop; + icon = style->standardIcon(QStyle::SP_BrowserStop); + break; + case Reload: + mappedAction = QWebPageAdapter::Reload; + icon = style->standardIcon(QStyle::SP_BrowserReload); + break; - case Cut: - text = contextMenuItemTagCut(); - break; - case Copy: - text = contextMenuItemTagCopy(); - break; - case Paste: - text = contextMenuItemTagPaste(); - break; - case SelectAll: - text = contextMenuItemTagSelectAll(); - break; #ifndef QT_NO_UNDOSTACK - case Undo: { - QAction *a = undoStack()->createUndoAction(d->q); - d->actions[action] = a; - return a; - } - case Redo: { - QAction *a = undoStack()->createRedoAction(d->q); - d->actions[action] = a; - return a; - } + case Undo: { + QAction *a = undoStack()->createUndoAction(d->q); + d->actions[action] = a; + return a; + } + case Redo: { + QAction *a = undoStack()->createRedoAction(d->q); + d->actions[action] = a; + return a; + } #endif // QT_NO_UNDOSTACK + // in place l10n case MoveToNextChar: text = tr("Move the cursor to the next character"); break; @@ -3295,35 +2301,6 @@ QAction *QWebPage::action(WebAction action) const text = tr("Delete to the end of the word"); break; - case SetTextDirectionDefault: - text = contextMenuItemTagDefaultDirection(); - break; - case SetTextDirectionLeftToRight: - text = contextMenuItemTagLeftToRight(); - checkable = true; - break; - case SetTextDirectionRightToLeft: - text = contextMenuItemTagRightToLeft(); - checkable = true; - break; - - case ToggleBold: - text = contextMenuItemTagBold(); - checkable = true; - break; - case ToggleItalic: - text = contextMenuItemTagItalic(); - checkable = true; - break; - case ToggleUnderline: - text = contextMenuItemTagUnderline(); - checkable = true; - break; - - case InspectElement: - text = contextMenuItemTagInspectElement(); - break; - case InsertParagraphSeparator: text = tr("Insert a new paragraph"); break; @@ -3381,6 +2358,8 @@ QAction *QWebPage::action(WebAction action) const default: break; } + if (mappedAction != QWebPageAdapter::NoAction) + text = d->contextMenuItemTagForAction(mappedAction, &checkable); if (text.isEmpty()) return 0; @@ -3392,7 +2371,7 @@ QAction *QWebPage::action(WebAction action) const a->setIcon(icon); connect(a, SIGNAL(triggered(bool)), - this, SLOT(_q_webActionTriggered(bool))); + this, SLOT(_q_webActionTriggered(bool))); d->actions[action] = a; d->updateAction(action); @@ -3465,6 +2444,7 @@ bool QWebPage::event(QEvent *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->adjustPointForClicking(&dummyEvent); d->mouseReleaseEvent(&dummyEvent); ev->setAccepted(dummyEvent.isAccepted()); break; @@ -3472,6 +2452,7 @@ bool QWebPage::event(QEvent *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->adjustPointForClicking(&dummyEvent); d->mousePressEvent(&dummyEvent); ev->setAccepted(dummyEvent.isAccepted()); break; @@ -3479,6 +2460,7 @@ bool QWebPage::event(QEvent *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->adjustPointForClicking(&dummyEvent); d->mouseDoubleClickEvent(&dummyEvent); ev->setAccepted(dummyEvent.isAccepted()); break; @@ -3496,13 +2478,13 @@ bool QWebPage::event(QEvent *ev) #endif #ifndef QT_NO_WHEELEVENT case QEvent::Wheel: - d->wheelEvent(static_cast<QWheelEvent*>(ev)); + d->wheelEvent(static_cast<QWheelEvent*>(ev), QApplication::wheelScrollLines()); break; #if !defined(QT_NO_GRAPHICSVIEW) 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); + d->wheelEvent(&dummyEvent, QApplication::wheelScrollLines()); ev->setAccepted(dummyEvent.isAccepted()); break; } @@ -3525,7 +2507,8 @@ bool QWebPage::event(QEvent *ev) d->dragEnterEvent(static_cast<QDragEnterEvent*>(ev)); break; case QEvent::DragLeave: - d->dragLeaveEvent(static_cast<QDragLeaveEvent*>(ev)); + d->dragLeaveEvent(); + ev->accept(); break; case QEvent::DragMove: d->dragMoveEvent(static_cast<QDragMoveEvent*>(ev)); @@ -3541,7 +2524,8 @@ bool QWebPage::event(QEvent *ev) d->dragMoveEvent(static_cast<QGraphicsSceneDragDropEvent*>(ev)); break; case QEvent::GraphicsSceneDragLeave: - d->dragLeaveEvent(static_cast<QGraphicsSceneDragDropEvent*>(ev)); + d->dragLeaveEvent(); + ev->accept(); break; case QEvent::GraphicsSceneDrop: d->dropEvent(static_cast<QGraphicsSceneDragDropEvent*>(ev)); @@ -3571,7 +2555,7 @@ bool QWebPage::event(QEvent *ev) #endif #ifndef QT_NO_PROPERTIES case QEvent::DynamicPropertyChange: - d->dynamicPropertyChangeEvent(static_cast<QDynamicPropertyChangeEvent*>(ev)); + d->dynamicPropertyChangeEvent(this, static_cast<QDynamicPropertyChangeEvent*>(ev)); break; #endif default: @@ -3591,14 +2575,7 @@ bool QWebPage::focusNextPrevChild(bool next) { QKeyEvent ev(QEvent::KeyPress, Qt::Key_Tab, Qt::KeyboardModifiers(next ? Qt::NoModifier : Qt::ShiftModifier)); d->keyPressEvent(&ev); - bool hasFocusedNode = false; - Frame *frame = d->page->focusController()->focusedFrame(); - if (frame) { - Document *document = frame->document(); - hasFocusedNode = document && document->focusedNode(); - } - //qDebug() << "focusNextPrevChild(" << next << ") =" << ev.isAccepted() << "focusedNode?" << hasFocusedNode; - return hasFocusedNode; + return d->hasFocusedNode(); } /*! @@ -3615,24 +2592,14 @@ bool QWebPage::focusNextPrevChild(bool next) void QWebPage::setContentEditable(bool editable) { if (isContentEditable() != editable) { - d->page->setEditable(editable); - d->page->setTabKeyCyclesThroughElements(!editable); - if (d->mainFrame) { - WebCore::Frame* frame = d->mainFrame.data()->d->frame; - if (editable) { - frame->editor()->applyEditingStyleToBodyElement(); - // FIXME: mac port calls this if there is no selectedDOMRange - //frame->setSelectionFromNone(); - } - } - + d->setContentEditable(editable); d->updateEditorActions(); } } bool QWebPage::isContentEditable() const { - return d->page->isEditable(); + return d->isContentEditable(); } /*! @@ -3677,12 +2644,10 @@ QWebPage::LinkDelegationPolicy QWebPage::linkDelegationPolicy() const #ifndef QT_NO_CONTEXTMENU -static bool handleScrollbarContextMenuEvent(Scrollbar* scrollBar, QContextMenuEvent* event) +bool QWebPagePrivate::handleScrollbarContextMenuEvent(QContextMenuEvent* event, bool horizontal, QWebPageAdapter::ScrollDirection* direction, QWebPageAdapter::ScrollGranularity* granularity) { if (!QApplication::style()->styleHint(QStyle::SH_ScrollBar_ContextMenu)) - return true; - - bool horizontal = (scrollBar->orientation() == HorizontalScrollbar); + return false; QMenu menu; QAction* actScrollHere = menu.addAction(QCoreApplication::translate("QWebPage", "Scroll here")); @@ -3701,27 +2666,27 @@ static bool handleScrollbarContextMenuEvent(Scrollbar* scrollBar, QContextMenuEv QAction* actionSelected = menu.exec(event->globalPos()); - if (actionSelected == actScrollHere) { - ScrollbarTheme* theme = scrollBar->theme(); - // Set the pressed position to the middle of the thumb so that when we - // do move, the delta will be from the current pixel position of the - // thumb to the new position - int position = theme->trackPosition(scrollBar) + theme->thumbPosition(scrollBar) + theme->thumbLength(scrollBar) / 2; - scrollBar->setPressedPos(position); - const QPoint pos = scrollBar->convertFromContainingWindow(event->pos()); - scrollBar->moveThumb(horizontal ? pos.x() : pos.y()); - } else if (actionSelected == actScrollTop) - scrollBar->scrollableArea()->scroll(horizontal ? ScrollLeft : ScrollUp, ScrollByDocument); - else if (actionSelected == actScrollBottom) - scrollBar->scrollableArea()->scroll(horizontal ? ScrollRight : ScrollDown, ScrollByDocument); - else if (actionSelected == actPageUp) - scrollBar->scrollableArea()->scroll(horizontal ? ScrollLeft : ScrollUp, ScrollByPage); - else if (actionSelected == actPageDown) - scrollBar->scrollableArea()->scroll(horizontal ? ScrollRight : ScrollDown, ScrollByPage); - else if (actionSelected == actScrollUp) - scrollBar->scrollableArea()->scroll(horizontal ? ScrollLeft : ScrollUp, ScrollByLine); - else if (actionSelected == actScrollDown) - scrollBar->scrollableArea()->scroll(horizontal ? ScrollRight : ScrollDown, ScrollByLine); + if (actionSelected == actScrollHere) + return true; + if (actionSelected == actScrollTop) { + *direction = horizontal ? ScrollLeft : ScrollUp; + *granularity = ScrollByDocument; + } else if (actionSelected == actScrollBottom) { + *direction =horizontal ? ScrollRight : ScrollDown; + *granularity = ScrollByDocument; + } else if (actionSelected == actPageUp) { + *direction = horizontal ? ScrollLeft : ScrollUp; + *granularity = ScrollByPage; + } else if (actionSelected == actPageDown) { + *direction =horizontal ? ScrollRight : ScrollDown; + *granularity = ScrollByPage; + } else if (actionSelected == actScrollUp) { + *direction = horizontal ? ScrollLeft : ScrollUp; + *granularity = ScrollByLine; + } else if (actionSelected == actScrollDown) { + *direction =horizontal ? ScrollRight : ScrollDown; + *granularity = ScrollByLine; + } return true; } @@ -3736,22 +2701,8 @@ static bool handleScrollbarContextMenuEvent(Scrollbar* scrollBar, QContextMenuEv */ bool QWebPage::swallowContextMenuEvent(QContextMenuEvent *event) { - d->page->contextMenuController()->clearContextMenu(); - - if (QWebFrame* webFrame = frameAt(event->pos())) { - Frame* frame = QWebFramePrivate::core(webFrame); - if (Scrollbar* scrollbar = frame->view()->scrollbarAtPoint(convertMouseEvent(event, 1).position())) - return handleScrollbarContextMenuEvent(scrollbar, event); - } - - WebCore::Frame* focusedFrame = d->page->focusController()->focusedOrMainFrame(); - focusedFrame->eventHandler()->sendContextMenuEvent(convertMouseEvent(event, 1)); - ContextMenu *menu = d->page->contextMenuController()->contextMenu(); - // If the website defines its own handler then sendContextMenuEvent takes care of - // calling/showing it and the context menu pointer will be zero. This is the case - // on maps.google.com for example. - - return !menu; + QWebFrame* webFrame = frameAt(event->pos()); + return d->swallowContextMenuEvent(event, webFrame ? webFrame->d : 0); } #endif // QT_NO_CONTEXTMENU @@ -3764,8 +2715,8 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos) #ifndef QT_NO_ACTION // First we disable all actions, but keep track of which ones were originally enabled. QBitArray originallyEnabledWebActions(QWebPage::WebActionCount); - for (int i = ContextMenuItemTagNoAction; i < ContextMenuItemBaseApplicationTag; ++i) { - QWebPage::WebAction action = webActionForContextMenuAction(WebCore::ContextMenuAction(i)); + for (int i = QWebPageAdapter::NoAction + 1; i < QWebPageAdapter::ActionCount; ++i) { + QWebPage::WebAction action = webActionForAdapterMenuAction(QWebPageAdapter::MenuAction(i)); if (QAction *a = this->action(action)) { originallyEnabledWebActions.setBit(action, a->isEnabled()); a->setEnabled(false); @@ -3773,29 +2724,14 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos) } #endif // QT_NO_ACTION + QBitArray visitedWebActions(QWebPage::WebActionCount); d->createMainFrame(); - WebCore::Frame* focusedFrame = d->page->focusController()->focusedOrMainFrame(); - - HitTestResult result = focusedFrame->eventHandler()->hitTestResultAtPoint(focusedFrame->view()->windowToContents(pos), /*allowShadowContent*/ false); - if (result.scrollbar()) + // Then we let updatePositionDependantMenuActions() enable the actions that are put into the menu + QWebHitTestResultPrivate* result = d->updatePositionDependentMenuActions(pos, &visitedWebActions); + if (!result) d->hitTestResult = QWebHitTestResult(); else - d->hitTestResult = QWebHitTestResult(new QWebHitTestResultPrivate(result)); - d->page->contextMenuController()->setHitTestResult(result); - -#if ENABLE(INSPECTOR) - if (d->page->inspectorController()->enabled()) - d->page->contextMenuController()->addInspectElementItem(); -#endif - - QBitArray visitedWebActions(QWebPage::WebActionCount); - -#ifndef QT_NO_CONTEXTMENU - delete d->currentContextMenu.data(); - - // Then we let createContextMenu() enable the actions that are put into the menu - d->currentContextMenu = d->createContextMenu(d->page->contextMenuController()->contextMenu(), d->page->contextMenuController()->contextMenu()->platformDescription(), &visitedWebActions); -#endif // QT_NO_CONTEXTMENU + d->hitTestResult = QWebHitTestResult(result); #ifndef QT_NO_ACTION // Finally, we restore the original enablement for the actions that were not put into the menu. @@ -4069,33 +3005,7 @@ QWebPageAdapter *QWebPage::handle() const */ bool QWebPage::findText(const QString &subString, FindFlags options) { - ::TextCaseSensitivity caseSensitivity = ::TextCaseInsensitive; - if (options & FindCaseSensitively) - caseSensitivity = ::TextCaseSensitive; - - if (options & HighlightAllOccurrences) { - if (subString.isEmpty()) { - d->page->unmarkAllTextMatches(); - return true; - } else - return d->page->markAllMatchesForText(subString, caseSensitivity, true, 0); - } else { - if (subString.isEmpty()) { - d->page->mainFrame()->selection()->clear(); - Frame* frame = d->page->mainFrame()->tree()->firstChild(); - while (frame) { - frame->selection()->clear(); - frame = frame->tree()->traverseNextWithWrap(false); - } - } - ::FindDirection direction = ::FindDirectionForward; - if (options & FindBackward) - direction = ::FindDirectionBackward; - - const bool shouldWrap = options & FindWrapsAroundDocument; - - return d->page->findString(subString, caseSensitivity, direction, shouldWrap); - } + return d->findText(subString, static_cast<QWebPageAdapter::FindFlag>(options.operator int())); } /*! @@ -4119,7 +3029,7 @@ QWebSettings *QWebPage::settings() const */ QString QWebPage::chooseFile(QWebFrame *parentFrame, const QString& suggestedFile) { - Q_UNUSED(parentFrame) + Q_UNUSED(parentFrame); #ifndef QT_NO_FILEDIALOG return QFileDialog::getOpenFileName(view(), QString::null, suggestedFile); #else @@ -4195,14 +3105,7 @@ QWebPluginFactory *QWebPage::pluginFactory() const */ QString QWebPage::userAgentForUrl(const QUrl&) const { - return UserAgentQt::standardUserAgent("", WEBKIT_MAJOR_VERSION, WEBKIT_MINOR_VERSION); -} - - -void QWebPagePrivate::_q_onLoadProgressChanged(int) -{ - m_totalBytes = page->progress()->totalPageAndResourceBytesToLoad(); - m_bytesReceived = page->progress()->totalBytesReceived(); + return QWebPageAdapter::defaultUserAgentString(); } diff --git a/Source/WebKit/qt/Api/qwebpage.h b/Source/WebKit/qt/WidgetApi/qwebpage.h index bb5421fcc..5624b499b 100644 --- a/Source/WebKit/qt/Api/qwebpage.h +++ b/Source/WebKit/qt/WidgetApi/qwebpage.h @@ -21,8 +21,8 @@ #ifndef QWEBPAGE_H #define QWEBPAGE_H -#include "qwebsettings.h" -#include "qwebkitglobal.h" +#include <QtWebKit/qwebkitglobal.h> +#include <QtWebKit/qwebsettings.h> #include <QtCore/qobject.h> #include <QtCore/qurl.h> @@ -59,10 +59,7 @@ namespace WebCore { class InspectorClientQt; class InspectorServerRequestHandlerQt; class InspectorFrontendClientQt; - class NotificationPresenterClientQt; - class GeolocationPermissionClientQt; class ResourceHandle; - class HitTestResult; class QNetworkReplyHandler; struct FrameLoadRequest; @@ -441,8 +438,6 @@ private: friend class WebCore::InspectorClientQt; friend class WebCore::InspectorServerRequestHandlerQt; friend class WebCore::InspectorFrontendClientQt; - friend class WebCore::NotificationPresenterClientQt; - friend class WebCore::GeolocationPermissionClientQt; friend class WebCore::ResourceHandle; friend class WebCore::QNetworkReplyHandler; friend class DumpRenderTreeSupportQt; diff --git a/Source/WebKit/qt/Api/qwebpage_p.h b/Source/WebKit/qt/WidgetApi/qwebpage_p.h index 2434dd653..b35cf2e19 100644 --- a/Source/WebKit/qt/Api/qwebpage_p.h +++ b/Source/WebKit/qt/WidgetApi/qwebpage_p.h @@ -18,17 +18,15 @@ Boston, MA 02110-1301, USA. */ -#ifndef QWEBPAGE_P_H -#define QWEBPAGE_P_H +#ifndef qwebpage_p_h +#define qwebpage_p_h #include "QWebPageAdapter.h" #include "qwebframe.h" -#include "qwebhistory.h" #include "qwebpage.h" #include <QPointer> -#include <qbasictimer.h> #include <qevent.h> #include <qgesture.h> #include <qgraphicssceneevent.h> @@ -37,17 +35,16 @@ namespace WebCore { - class ContextMenuClientQt; - class ContextMenuItem; - class ContextMenu; - class Document; - class EditorClientQt; - class Element; - class InspectorController; - class IntRect; - class Node; - class NodeList; - class Frame; +class ContextMenuClientQt; +class ContextMenuItem; +class ContextMenu; +class Document; +class EditorClientQt; +class Element; +class IntRect; +class Node; +class NodeList; +class Frame; } QT_BEGIN_NAMESPACE @@ -138,83 +135,42 @@ public: virtual bool errorPageExtension(ErrorPageOption *, ErrorPageReturn *) OVERRIDE; virtual QtPluginWidgetAdapter* createPlugin(const QString &, const QUrl &, const QStringList &, const QStringList &) OVERRIDE; virtual QtPluginWidgetAdapter* adapterForWidget(QObject *) const OVERRIDE; + virtual bool requestSoftwareInputPanel() const OVERRIDE; + virtual void createAndSetCurrentContextMenu(const QList<MenuItemDescription>&, QBitArray*) OVERRIDE; + virtual bool handleScrollbarContextMenuEvent(QContextMenuEvent*, bool, ScrollDirection*, ScrollGranularity*) OVERRIDE; + void createMainFrame(); -#ifndef QT_NO_CONTEXTMENU - QMenu* createContextMenu(const WebCore::ContextMenu* webcoreMenu, const QList<WebCore::ContextMenuItem>* items, QBitArray* visitedWebActions); -#endif - void _q_onLoadProgressChanged(int); + void _q_webActionTriggered(bool checked); - void _q_cleanupLeakMessages(); - void updateAction(QWebPage::WebAction action); + void updateAction(QWebPage::WebAction); void updateEditorActions(); void timerEvent(QTimerEvent*); - 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 - void wheelEvent(QWheelEvent*); -#endif void keyPressEvent(QKeyEvent*); void keyReleaseEvent(QKeyEvent*); - void focusInEvent(QFocusEvent*); - void focusOutEvent(QFocusEvent*); template<class T> void dragEnterEvent(T*); - template<class T> void dragLeaveEvent(T*); template<class T> void dragMoveEvent(T*); template<class T> void dropEvent(T*); - void inputMethodEvent(QInputMethodEvent*); - -#ifndef QT_NO_PROPERTIES - void dynamicPropertyChangeEvent(QDynamicPropertyChangeEvent*); -#endif - void shortcutOverrideEvent(QKeyEvent*); void leaveEvent(QEvent*); - void handleSoftwareInputPanel(Qt::MouseButton, const QPoint&); - bool handleScrolling(QKeyEvent*, WebCore::Frame*); - - // Returns whether the default action was cancelled in the JS event handler - bool touchEvent(QTouchEvent*); bool gestureEvent(QGestureEvent*); - class TouchAdjuster { - public: - TouchAdjuster(unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding); - - WebCore::IntPoint findCandidatePointForTouch(const WebCore::IntPoint&, WebCore::Document*) const; - - private: - unsigned m_topPadding; - unsigned m_rightPadding; - unsigned m_bottomPadding; - unsigned m_leftPadding; - }; - - void adjustPointForClicking(QMouseEvent*); -#if !defined(QT_NO_GRAPHICSVIEW) - void adjustPointForClicking(QGraphicsSceneMouseEvent*); -#endif void setInspector(QWebInspector*); QWebInspector* getOrCreateInspector(); - WebCore::InspectorController* inspectorController(); - quint16 inspectorServerPort(); #ifndef QT_NO_SHORTCUT - static QWebPage::WebAction editorActionForKeyEvent(QKeyEvent* event); + static QWebPage::WebAction editorActionForKeyEvent(QKeyEvent*); #endif - static const char* editorCommandForWebActions(QWebPage::WebAction action); + static const char* editorCommandForWebActions(QWebPage::WebAction); QWebPage *q; QPointer<QWebFrame> mainFrame; @@ -225,20 +181,11 @@ public: QPointer<QWidget> view; - quint64 m_totalBytes; - quint64 m_bytesReceived; - - QPoint tripleClick; - QBasicTimer tripleClickTimer; - - bool clickCausedFocus; - QWebPage::LinkDelegationPolicy linkPolicy; QSize m_viewportSize; QSize fixedLayoutSize; - QWebHistory history; QWebHitTestResult hitTestResult; #ifndef QT_NO_CONTEXTMENU QPointer<QMenu> currentContextMenu; diff --git a/Source/WebKit/qt/Api/qwebview.cpp b/Source/WebKit/qt/WidgetApi/qwebview.cpp index 2eda6a18e..fcfc934be 100644 --- a/Source/WebKit/qt/Api/qwebview.cpp +++ b/Source/WebKit/qt/WidgetApi/qwebview.cpp @@ -22,22 +22,20 @@ #include "config.h" #include "qwebview.h" -#include "Page.h" #include "QWebPageClient.h" -#include "Settings.h" #include "qwebframe.h" #include "qwebpage_p.h" -#include "qbitmap.h" -#include "qevent.h" -#include "qpainter.h" -#if HAVE(QTPRINTSUPPORT) -#include "qprinter.h" -#endif -#include "qdir.h" -#include "qfile.h" #ifndef QT_NO_ACCESSIBILITY #include "qwebviewaccessible_p.h" #endif +#include <qbitmap.h> +#include <qdir.h> +#include <qevent.h> +#include <qfile.h> +#include <qpainter.h> +#if HAVE(QTPRINTSUPPORT) +#include <qprinter.h> +#endif class QWebViewPrivate { public: @@ -265,29 +263,29 @@ void QWebView::setPage(QWebPage* page) // #### connect signals QWebFrame *mainFrame = d->page->mainFrame(); connect(mainFrame, SIGNAL(titleChanged(QString)), - this, SIGNAL(titleChanged(QString))); + this, SIGNAL(titleChanged(QString))); connect(mainFrame, SIGNAL(iconChanged()), - this, SIGNAL(iconChanged())); + this, SIGNAL(iconChanged())); connect(mainFrame, SIGNAL(urlChanged(QUrl)), - this, SIGNAL(urlChanged(QUrl))); + this, SIGNAL(urlChanged(QUrl))); connect(d->page, SIGNAL(loadStarted()), - this, SIGNAL(loadStarted())); + this, SIGNAL(loadStarted())); connect(d->page, SIGNAL(loadProgress(int)), - this, SIGNAL(loadProgress(int))); + this, SIGNAL(loadProgress(int))); connect(d->page, SIGNAL(loadFinished(bool)), - this, SIGNAL(loadFinished(bool))); + this, SIGNAL(loadFinished(bool))); connect(d->page, SIGNAL(statusBarMessage(QString)), - this, SIGNAL(statusBarMessage(QString))); + this, SIGNAL(statusBarMessage(QString))); connect(d->page, SIGNAL(linkClicked(QUrl)), - this, SIGNAL(linkClicked(QUrl))); + this, SIGNAL(linkClicked(QUrl))); connect(d->page, SIGNAL(selectionChanged()), - this, SIGNAL(selectionChanged())); + this, SIGNAL(selectionChanged())); connect(d->page, SIGNAL(microFocusChanged()), - this, SLOT(updateMicroFocus())); + this, SLOT(updateMicroFocus())); connect(d->page, SIGNAL(destroyed()), - this, SLOT(_q_pageDestroyed())); + this, SLOT(_q_pageDestroyed())); } setAttribute(Qt::WA_OpaquePaintEvent, d->page); update(); @@ -317,9 +315,7 @@ void QWebView::load(const QUrl &url) \sa url(), urlChanged() */ -void QWebView::load(const QNetworkRequest &request, - QNetworkAccessManager::Operation operation, - const QByteArray &body) +void QWebView::load(const QNetworkRequest &request, QNetworkAccessManager::Operation operation, const QByteArray &body) { page()->mainFrame()->load(request, operation, body); } @@ -723,10 +719,9 @@ bool QWebView::event(QEvent *e) d->page->d->client->resetCursor(); #endif } else if (e->type() == QEvent::TouchBegin - || e->type() == QEvent::TouchEnd - || e->type() == QEvent::TouchUpdate - || e->type() == QEvent::TouchCancel - ) { + || e->type() == QEvent::TouchEnd + || e->type() == QEvent::TouchUpdate + || e->type() == QEvent::TouchCancel) { d->page->event(e); // Always return true so that we'll receive also TouchUpdate and TouchEnd events @@ -1032,7 +1027,7 @@ QVariant QWebView::inputMethodQuery(Qt::InputMethodQuery property) const void QWebView::inputMethodEvent(QInputMethodEvent *e) { if (d->page) - d->page->event(e); + d->page->event(e); } /*!\reimp diff --git a/Source/WebKit/qt/Api/qwebview.h b/Source/WebKit/qt/WidgetApi/qwebview.h index d4b4dd917..701fb36c2 100644 --- a/Source/WebKit/qt/Api/qwebview.h +++ b/Source/WebKit/qt/WidgetApi/qwebview.h @@ -21,13 +21,13 @@ #ifndef QWEBVIEW_H #define QWEBVIEW_H -#include "qwebkitglobal.h" -#include "qwebpage.h" -#include <QtWidgets/qwidget.h> +#include <QtWebKit/qwebkitglobal.h> +#include <QtWebKitWidgets/qwebpage.h> +#include <QtCore/qurl.h> #include <QtGui/qicon.h> #include <QtGui/qpainter.h> -#include <QtCore/qurl.h> #include <QtNetwork/qnetworkaccessmanager.h> +#include <QtWidgets/qwidget.h> QT_BEGIN_NAMESPACE class QNetworkRequest; diff --git a/Source/WebKit/qt/Api/qwebviewaccessible.cpp b/Source/WebKit/qt/WidgetApi/qwebviewaccessible.cpp index 7cae19a1a..7cae19a1a 100644 --- a/Source/WebKit/qt/Api/qwebviewaccessible.cpp +++ b/Source/WebKit/qt/WidgetApi/qwebviewaccessible.cpp diff --git a/Source/WebKit/qt/Api/qwebviewaccessible_p.h b/Source/WebKit/qt/WidgetApi/qwebviewaccessible_p.h index 7cbf44870..7cbf44870 100644 --- a/Source/WebKit/qt/Api/qwebviewaccessible_p.h +++ b/Source/WebKit/qt/WidgetApi/qwebviewaccessible_p.h diff --git a/Source/WebKit/qt/WebCoreSupport/DefaultFullScreenVideoHandler.cpp b/Source/WebKit/qt/WidgetSupport/DefaultFullScreenVideoHandler.cpp index 0fe24e8bd..0fe24e8bd 100644 --- a/Source/WebKit/qt/WebCoreSupport/DefaultFullScreenVideoHandler.cpp +++ b/Source/WebKit/qt/WidgetSupport/DefaultFullScreenVideoHandler.cpp diff --git a/Source/WebKit/qt/WebCoreSupport/DefaultFullScreenVideoHandler.h b/Source/WebKit/qt/WidgetSupport/DefaultFullScreenVideoHandler.h index e943c55e4..e943c55e4 100644 --- a/Source/WebKit/qt/WebCoreSupport/DefaultFullScreenVideoHandler.h +++ b/Source/WebKit/qt/WidgetSupport/DefaultFullScreenVideoHandler.h diff --git a/Source/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.cpp b/Source/WebKit/qt/WidgetSupport/FullScreenVideoWidget.cpp index 4105d02c6..4105d02c6 100644 --- a/Source/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.cpp +++ b/Source/WebKit/qt/WidgetSupport/FullScreenVideoWidget.cpp diff --git a/Source/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.h b/Source/WebKit/qt/WidgetSupport/FullScreenVideoWidget.h index 201cc49d1..201cc49d1 100644 --- a/Source/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.h +++ b/Source/WebKit/qt/WidgetSupport/FullScreenVideoWidget.h diff --git a/Source/WebKit/qt/WebCoreSupport/InitWebKitQt.cpp b/Source/WebKit/qt/WidgetSupport/InitWebKitQt.cpp index 71886037d..71886037d 100644 --- a/Source/WebKit/qt/WebCoreSupport/InitWebKitQt.cpp +++ b/Source/WebKit/qt/WidgetSupport/InitWebKitQt.cpp diff --git a/Source/WebKit/qt/WebCoreSupport/InitWebKitQt.h b/Source/WebKit/qt/WidgetSupport/InitWebKitQt.h index fbb2d18f7..fbb2d18f7 100644 --- a/Source/WebKit/qt/WebCoreSupport/InitWebKitQt.h +++ b/Source/WebKit/qt/WidgetSupport/InitWebKitQt.h diff --git a/Source/WebKit/qt/WebCoreSupport/InspectorClientWebPage.cpp b/Source/WebKit/qt/WidgetSupport/InspectorClientWebPage.cpp index dc4730b32..dc4730b32 100644 --- a/Source/WebKit/qt/WebCoreSupport/InspectorClientWebPage.cpp +++ b/Source/WebKit/qt/WidgetSupport/InspectorClientWebPage.cpp diff --git a/Source/WebKit/qt/WebCoreSupport/InspectorClientWebPage.h b/Source/WebKit/qt/WidgetSupport/InspectorClientWebPage.h index 887f29b0c..887f29b0c 100644 --- a/Source/WebKit/qt/WebCoreSupport/InspectorClientWebPage.h +++ b/Source/WebKit/qt/WidgetSupport/InspectorClientWebPage.h diff --git a/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp b/Source/WebKit/qt/WidgetSupport/PageClientQt.cpp index d2b090af2..095f9e582 100644 --- a/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp +++ b/Source/WebKit/qt/WidgetSupport/PageClientQt.cpp @@ -32,39 +32,6 @@ #include <QGLWidget> #endif -#if USE(3D_GRAPHICS) -#include <QWindow> - -static void createPlatformGraphicsContext3DFromWidget(QWidget* widget, PlatformGraphicsContext3D* context, PlatformGraphicsSurface3D* surface, QObject** surfaceOwner) -{ -#ifdef QT_OPENGL_LIB - *context = 0; - *surface = 0; - if (surfaceOwner) - *surfaceOwner = 0; - QAbstractScrollArea* scrollArea = qobject_cast<QAbstractScrollArea*>(widget); - if (!scrollArea) - return; - - QGLWidget* glViewport = qobject_cast<QGLWidget*>(scrollArea->viewport()); - if (!glViewport) - return; - QGLWidget* glWidget = new QGLWidget(0, glViewport); - if (glWidget->isValid()) { - // Geometry can be set to zero because m_glWidget is used only for its QGLContext. - glWidget->setGeometry(0, 0, 0, 0); - if (surfaceOwner) - *surfaceOwner = glWidget; - *surface = glWidget->windowHandle(); - *context = glWidget->context()->contextHandle(); - } else { - delete glWidget; - glWidget = 0; - } -#endif -} -#endif - #if USE(ACCELERATED_COMPOSITING) #include "TextureMapper.h" #include "texmap/TextureMapperLayer.h" @@ -84,71 +51,6 @@ QWindow* QWebPageClient::ownerWindow() const namespace WebCore { -#if USE(ACCELERATED_COMPOSITING) -TextureMapperLayerClientQt::TextureMapperLayerClientQt(QWebFrame* frame, GraphicsLayer* layer) - : m_frame(frame) - , m_rootGraphicsLayer(GraphicsLayer::create(0)) -{ - m_frame->d->rootTextureMapperLayer = rootLayer(); - m_rootGraphicsLayer->addChild(layer); - m_rootGraphicsLayer->setDrawsContent(false); - m_rootGraphicsLayer->setMasksToBounds(false); - m_rootGraphicsLayer->setSize(IntSize(1, 1)); -} - -void TextureMapperLayerClientQt::setTextureMapper(const PassOwnPtr<TextureMapper>& textureMapper) -{ - m_frame->d->textureMapper = textureMapper; - m_frame->d->rootTextureMapperLayer->setTextureMapper(m_frame->d->textureMapper.get()); - syncRootLayer(); -} - -TextureMapperLayerClientQt::~TextureMapperLayerClientQt() -{ - m_frame->d->rootTextureMapperLayer = 0; -} - -void TextureMapperLayerClientQt::syncRootLayer() -{ - m_rootGraphicsLayer->flushCompositingStateForThisLayerOnly(); -} - -TextureMapperLayer* TextureMapperLayerClientQt::rootLayer() -{ - return toTextureMapperLayer(m_rootGraphicsLayer.get()); -} - - -void PageClientQWidget::setRootGraphicsLayer(GraphicsLayer* layer) -{ - if (layer) { - TextureMapperLayerClient = adoptPtr(new TextureMapperLayerClientQt(page->mainFrame(), layer)); - TextureMapperLayerClient->setTextureMapper(TextureMapper::create()); - return; - } - TextureMapperLayerClient.clear(); -} - -void PageClientQWidget::markForSync(bool scheduleSync) -{ - if (syncTimer.isActive()) - return; - syncTimer.startOneShot(0); -} - -void PageClientQWidget::syncLayers(Timer<PageClientQWidget>*) -{ - if (TextureMapperLayerClient) - TextureMapperLayerClient->syncRootLayer(); - QWebFramePrivate::core(page->mainFrame())->view()->flushCompositingStateIncludingSubframes(); - if (!TextureMapperLayerClient) - return; - if (TextureMapperLayerClient->rootLayer()->descendantsOrSelfHaveRunningAnimations() && !syncTimer.isActive()) - syncTimer.startOneShot(1.0 / 60.0); - update(view->rect()); -} -#endif - void PageClientQWidget::scroll(int dx, int dy, const QRect& rectToScroll) { view->scroll(qreal(dx), qreal(dy), rectToScroll); @@ -159,6 +61,11 @@ void PageClientQWidget::update(const QRect & dirtyRect) view->update(dirtyRect); } +void PageClientQWidget::repaintViewport() +{ + update(view->rect()); +} + void PageClientQWidget::setInputMethodEnabled(bool enable) { view->setAttribute(Qt::WA_InputMethodEnabled, enable); @@ -236,13 +143,6 @@ void PageClientQWidget::setWidgetVisible(Widget* widget, bool visible) qtWidget->setVisible(visible); } -#if USE(3D_GRAPHICS) -void PageClientQWidget::createPlatformGraphicsContext3D(PlatformGraphicsContext3D* context, PlatformGraphicsSurface3D* surface, QObject** surfaceOwner) -{ - createPlatformGraphicsContext3DFromWidget(view, context, surface, surfaceOwner); -} -#endif - #if !defined(QT_NO_GRAPHICSVIEW) PageClientQGraphicsWidget::~PageClientQGraphicsWidget() { @@ -262,62 +162,26 @@ void PageClientQGraphicsWidget::update(const QRect& dirtyRect) overlay->update(QRectF(dirtyRect)); } -#if USE(ACCELERATED_COMPOSITING) -void PageClientQGraphicsWidget::syncLayers() +void PageClientQGraphicsWidget::repaintViewport() { - if (TextureMapperLayerClient) - TextureMapperLayerClient->syncRootLayer(); - - QWebFramePrivate::core(page->mainFrame())->view()->flushCompositingStateIncludingSubframes(); - - if (!TextureMapperLayerClient) - return; - - if (TextureMapperLayerClient->rootLayer()->descendantsOrSelfHaveRunningAnimations() && !syncTimer.isActive()) - syncTimer.startOneShot(1.0 / 60.0); update(view->boundingRect().toAlignedRect()); } -void PageClientQGraphicsWidget::setRootGraphicsLayer(GraphicsLayer* layer) -{ - if (layer) { - TextureMapperLayerClient = adoptPtr(new TextureMapperLayerClientQt(page->mainFrame(), layer)); -#if USE(TEXTURE_MAPPER_GL) && defined(QT_OPENGL_LIB) - QGraphicsView* graphicsView = view->scene()->views()[0]; - if (graphicsView && graphicsView->viewport()) { - QGLWidget* glWidget = qobject_cast<QGLWidget*>(graphicsView->viewport()); - if (glWidget) { - // The GL context belonging to the QGLWidget viewport must be current when TextureMapper is being created. - glWidget->makeCurrent(); - TextureMapperLayerClient->setTextureMapper(TextureMapper::create(TextureMapper::OpenGLMode)); - return; - } +bool PageClientQGraphicsWidget::makeOpenGLContextCurrentIfAvailable() +{ +#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_GL) && defined(QT_OPENGL_LIB) + QGraphicsView* graphicsView = view->scene()->views()[0]; + if (graphicsView && graphicsView->viewport()) { + QGLWidget* glWidget = qobject_cast<QGLWidget*>(graphicsView->viewport()); + if (glWidget) { + // The GL context belonging to the QGLWidget viewport must be current when TextureMapper is being created. + glWidget->makeCurrent(); + return true; } -#endif - TextureMapperLayerClient->setTextureMapper(TextureMapper::create()); - return; } - TextureMapperLayerClient.clear(); -} - -void PageClientQGraphicsWidget::markForSync(bool scheduleSync) -{ - if (syncTimer.isActive()) - return; - syncTimer.startOneShot(0); -} - #endif - -#if USE(TILED_BACKING_STORE) -void PageClientQGraphicsWidget::updateTiledBackingStoreScale() -{ - WebCore::TiledBackingStore* backingStore = QWebFramePrivate::core(page->mainFrame())->tiledBackingStore(); - if (!backingStore) - return; - backingStore->setContentsScale(view->scale()); + return false; } -#endif void PageClientQGraphicsWidget::setInputMethodEnabled(bool enable) { @@ -429,11 +293,5 @@ QRectF PageClientQGraphicsWidget::windowRect() const } #endif // QT_NO_GRAPHICSVIEW -#if USE(3D_GRAPHICS) -void PageClientQGraphicsWidget::createPlatformGraphicsContext3D(PlatformGraphicsContext3D* context, PlatformGraphicsSurface3D* surface, QObject** surfaceOwner) -{ - createPlatformGraphicsContext3DFromWidget(qobject_cast<QWidget*>(ownerWidget()), context, surface, surfaceOwner); -} -#endif - } // namespace WebCore + diff --git a/Source/WebKit/qt/WebCoreSupport/PageClientQt.h b/Source/WebKit/qt/WidgetSupport/PageClientQt.h index 72dca42c1..63a80ad03 100644 --- a/Source/WebKit/qt/WebCoreSupport/PageClientQt.h +++ b/Source/WebKit/qt/WidgetSupport/PageClientQt.h @@ -25,6 +25,7 @@ #include "GraphicsContext.h" #include "IntRect.h" #include "QWebPageClient.h" +#include "TextureMapperLayerClientQt.h" #include "TiledBackingStore.h" #include "qgraphicswebview.h" #include "qwebframe.h" @@ -38,33 +39,16 @@ #include <qmetaobject.h> #include <qscrollbar.h> #include <qstyleoption.h> +#include <qtimer.h> #include <qwidget.h> namespace WebCore { -#if USE(ACCELERATED_COMPOSITING) -class TextureMapperLayerClientQt { -public: - TextureMapperLayerClientQt(QWebFrame*, GraphicsLayer*); - virtual ~TextureMapperLayerClientQt(); - void setTextureMapper(const PassOwnPtr<TextureMapper>&); - void syncRootLayer(); - TextureMapperLayer* rootLayer(); - -private: - QWebFrame* m_frame; - OwnPtr<GraphicsLayer> m_rootGraphicsLayer; -}; -#endif - class PageClientQWidget : public QWebPageClient { public: PageClientQWidget(QWidget* newView, QWebPage* newPage) : view(newView) , page(newPage) -#if USE(ACCELERATED_COMPOSITING) - , syncTimer(this, &PageClientQWidget::syncLayers) -#endif { Q_ASSERT(view); } @@ -74,6 +58,7 @@ public: virtual void scroll(int dx, int dy, const QRect&); virtual void update(const QRect& dirtyRect); + virtual void repaintViewport(); virtual void setInputMethodEnabled(bool); virtual bool inputMethodEnabled() const; virtual void setInputMethodHints(Qt::InputMethodHints); @@ -98,29 +83,8 @@ public: virtual void setWidgetVisible(Widget*, bool visible); -#if USE(3D_GRAPHICS) - virtual void createPlatformGraphicsContext3D(PlatformGraphicsContext3D*, PlatformGraphicsSurface3D*, QObject**); -#endif - QWidget* view; QWebPage* page; - -#if USE(ACCELERATED_COMPOSITING) - virtual void setRootGraphicsLayer(GraphicsLayer*); - virtual void markForSync(bool scheduleSync); - void syncLayers(Timer<PageClientQWidget>*); -#endif - -#if USE(ACCELERATED_COMPOSITING) - virtual bool allowsAcceleratedCompositing() const { return true; } -#else - virtual bool allowsAcceleratedCompositing() const { return false; } -#endif - -#if USE(ACCELERATED_COMPOSITING) - Timer<PageClientQWidget> syncTimer; - OwnPtr<TextureMapperLayerClientQt> TextureMapperLayerClient; -#endif }; #if !defined(QT_NO_GRAPHICSVIEW) @@ -164,9 +128,6 @@ public: : view(newView) , page(newPage) , viewResizesToContents(false) -#if USE(ACCELERATED_COMPOSITING) - , syncTimer(this, &PageClientQGraphicsWidget::syncLayersTimeout) -#endif , overlay(0) { Q_ASSERT(view); @@ -183,6 +144,7 @@ public: virtual void scroll(int dx, int dy, const QRect&); virtual void update(const QRect& dirtyRect); + virtual void repaintViewport(); virtual void setInputMethodEnabled(bool); virtual bool inputMethodEnabled() const; virtual void setInputMethodHints(Qt::InputMethodHints); @@ -205,24 +167,11 @@ public: virtual void setWidgetVisible(Widget*, bool); -#if USE(3D_GRAPHICS) - virtual void createPlatformGraphicsContext3D(PlatformGraphicsContext3D*, PlatformGraphicsSurface3D*, QObject**); -#endif - #if USE(TILED_BACKING_STORE) - void updateTiledBackingStoreScale(); virtual QRectF graphicsItemVisibleRect() const; #endif -#if USE(ACCELERATED_COMPOSITING) - virtual void setRootGraphicsLayer(GraphicsLayer*); - virtual void markForSync(bool scheduleSync); - void syncLayers(); - void syncLayersTimeout(Timer<PageClientQGraphicsWidget>*) { syncLayers(); } - - // QGraphicsWebView can render composited layers - virtual bool allowsAcceleratedCompositing() const { return true; } -#endif + virtual bool makeOpenGLContextCurrentIfAvailable(); virtual QRectF windowRect() const; @@ -230,11 +179,6 @@ public: QWebPage* page; bool viewResizesToContents; -#if USE(ACCELERATED_COMPOSITING) - OwnPtr<TextureMapperLayerClientQt> TextureMapperLayerClient; - // we have to flush quite often, so we use a meta-method instead of QTimer::singleShot for putting the event in the queue - Timer<PageClientQGraphicsWidget> syncTimer; -#endif // the overlay gets instantiated when the root layer is attached, and get deleted when it's detached QGraphicsItemOverlay* overlay; diff --git a/Source/WebKit/qt/WebCoreSupport/QGraphicsWidgetPluginImpl.cpp b/Source/WebKit/qt/WidgetSupport/QGraphicsWidgetPluginImpl.cpp index 5137933a0..5137933a0 100644 --- a/Source/WebKit/qt/WebCoreSupport/QGraphicsWidgetPluginImpl.cpp +++ b/Source/WebKit/qt/WidgetSupport/QGraphicsWidgetPluginImpl.cpp diff --git a/Source/WebKit/qt/WebCoreSupport/QGraphicsWidgetPluginImpl.h b/Source/WebKit/qt/WidgetSupport/QGraphicsWidgetPluginImpl.h index 7f758226c..7f758226c 100644 --- a/Source/WebKit/qt/WebCoreSupport/QGraphicsWidgetPluginImpl.h +++ b/Source/WebKit/qt/WidgetSupport/QGraphicsWidgetPluginImpl.h diff --git a/Source/WebKit/qt/WebCoreSupport/QStyleFacadeImp.cpp b/Source/WebKit/qt/WidgetSupport/QStyleFacadeImp.cpp index 3af6cf694..bd6be1e47 100644 --- a/Source/WebKit/qt/WebCoreSupport/QStyleFacadeImp.cpp +++ b/Source/WebKit/qt/WidgetSupport/QStyleFacadeImp.cpp @@ -32,6 +32,7 @@ #include <QStyleFactory> #include <QStyleOption> +#include <QWebPageAdapter.h> #include <QWebPageClient.h> using namespace WebCore; @@ -135,7 +136,7 @@ static QStyleFacade::SubControl convertToQStyleFacadeSubControl(QStyle::SubContr #undef CONVERT_SUBCONTROL } -QStyleFacadeImp::QStyleFacadeImp(Page* page) +QStyleFacadeImp::QStyleFacadeImp(QWebPageAdapter* page) : m_page(page) , m_style(0) { @@ -272,23 +273,24 @@ void QStyleFacadeImp::paintComboBox(QPainter *painter, const QStyleFacadeOption MappedStyleOption<QStyleOptionComboBox> opt(widget, proxyOption); - IntRect rect = opt.rect; + QRect rect = opt.rect; #if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) // QMacStyle makes the combo boxes a little bit smaller to leave space for the focus rect. // Because of it, the combo button is drawn at a point to the left of where it was expect to be and may end up // overlapped with the text. This will force QMacStyle to draw the combo box with the expected width. - if (m_style->inherits("QMacStyle")) - rect.inflateX(3); + if (m_style->inherits("QMacStyle")) { + rect.setX(rect.x() - 3); + rect.setWidth(rect.width() + 2 * 3); + } #endif - const QPoint topLeft = rect.location(); - painter->translate(topLeft); + painter->translate(rect.topLeft()); opt.rect.moveTo(QPoint(0, 0)); opt.rect.setSize(rect.size()); style()->drawComplexControl(QStyle::CC_ComboBox, &opt, painter, widget); - painter->translate(-topLeft); + painter->translate(-rect.topLeft()); } void QStyleFacadeImp::paintComboBoxArrow(QPainter *painter, const QStyleFacadeOption &proxyOption) @@ -354,7 +356,7 @@ void QStyleFacadeImp::paintInnerSpinButton(QPainter* painter, const QStyleFacade } } - IntRect buttonRect = option.rect; + QRect buttonRect = option.rect; // Default to moving the buttons a little bit within the editor frame. int inflateX = -2; int inflateY = -2; @@ -370,8 +372,10 @@ void QStyleFacadeImp::paintInnerSpinButton(QPainter* painter, const QStyleFacade } #endif - buttonRect.inflateX(inflateX); - buttonRect.inflateY(inflateY); + buttonRect.setX(buttonRect.x() - inflateX); + buttonRect.setWidth(buttonRect.width() + 2 * inflateX); + buttonRect.setY(buttonRect.y() - inflateY); + buttonRect.setHeight(buttonRect.height() + 2 * inflateY); option.rect = buttonRect; style()->drawComplexControl(QStyle::CC_SpinBox, &option, painter, widget); @@ -484,7 +488,10 @@ QStyle* QStyleFacadeImp::style() const if (m_style) return m_style; - m_style = QStyleFacade::styleForPage(m_page); + if (m_page) { + if (QWebPageClient* pageClient = m_page->client.data()) + m_style = pageClient->style(); + } if (!m_style) m_style = QApplication::style(); diff --git a/Source/WebKit/qt/WebCoreSupport/QStyleFacadeImp.h b/Source/WebKit/qt/WidgetSupport/QStyleFacadeImp.h index 7221d72c4..3e677aeef 100644 --- a/Source/WebKit/qt/WebCoreSupport/QStyleFacadeImp.h +++ b/Source/WebKit/qt/WidgetSupport/QStyleFacadeImp.h @@ -35,18 +35,16 @@ class QPainter; class QObject; QT_END_NAMESPACE -namespace WebCore { -class Page; -} +class QWebPageAdapter; namespace WebKit { class QStyleFacadeImp : public WebCore::QStyleFacade { public: - QStyleFacadeImp(WebCore::Page* = 0); + QStyleFacadeImp(QWebPageAdapter* = 0); virtual ~QStyleFacadeImp(); - static WebCore::QStyleFacade* create(WebCore::Page* page) + static WebCore::QStyleFacade* create(QWebPageAdapter* page) { return new QStyleFacadeImp(page); } virtual QRect buttonSubElementRect(ButtonSubElement, State, const QRect& originalRect) const; @@ -87,7 +85,7 @@ public: private: QStyle* style() const; - WebCore::Page* m_page; + QWebPageAdapter* m_page; mutable QPointer<QStyle> m_style; QStyle* m_fallbackStyle; bool m_ownFallbackStyle; diff --git a/Source/WebKit/qt/WebCoreSupport/QWebUndoCommand.cpp b/Source/WebKit/qt/WidgetSupport/QWebUndoCommand.cpp index a196df50d..a196df50d 100644 --- a/Source/WebKit/qt/WebCoreSupport/QWebUndoCommand.cpp +++ b/Source/WebKit/qt/WidgetSupport/QWebUndoCommand.cpp diff --git a/Source/WebKit/qt/WebCoreSupport/QWebUndoCommand.h b/Source/WebKit/qt/WidgetSupport/QWebUndoCommand.h index 6e6121adc..6e6121adc 100644 --- a/Source/WebKit/qt/WebCoreSupport/QWebUndoCommand.h +++ b/Source/WebKit/qt/WidgetSupport/QWebUndoCommand.h diff --git a/Source/WebKit/qt/WebCoreSupport/QWidgetPluginImpl.cpp b/Source/WebKit/qt/WidgetSupport/QWidgetPluginImpl.cpp index 2beabf1d0..2beabf1d0 100644 --- a/Source/WebKit/qt/WebCoreSupport/QWidgetPluginImpl.cpp +++ b/Source/WebKit/qt/WidgetSupport/QWidgetPluginImpl.cpp diff --git a/Source/WebKit/qt/WebCoreSupport/QWidgetPluginImpl.h b/Source/WebKit/qt/WidgetSupport/QWidgetPluginImpl.h index 7459b7eff..7459b7eff 100644 --- a/Source/WebKit/qt/WebCoreSupport/QWidgetPluginImpl.h +++ b/Source/WebKit/qt/WidgetSupport/QWidgetPluginImpl.h diff --git a/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp b/Source/WebKit/qt/WidgetSupport/QtFallbackWebPopup.cpp index b2fbf624a..b2fbf624a 100644 --- a/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp +++ b/Source/WebKit/qt/WidgetSupport/QtFallbackWebPopup.cpp diff --git a/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h b/Source/WebKit/qt/WidgetSupport/QtFallbackWebPopup.h index 69b49bdbf..69b49bdbf 100644 --- a/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h +++ b/Source/WebKit/qt/WidgetSupport/QtFallbackWebPopup.h diff --git a/Source/WebKit/qt/WebCoreSupport/QtWebComboBox.cpp b/Source/WebKit/qt/WidgetSupport/QtWebComboBox.cpp index 2c22cd476..2c22cd476 100644 --- a/Source/WebKit/qt/WebCoreSupport/QtWebComboBox.cpp +++ b/Source/WebKit/qt/WidgetSupport/QtWebComboBox.cpp diff --git a/Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h b/Source/WebKit/qt/WidgetSupport/QtWebComboBox.h index e32427edf..e32427edf 100644 --- a/Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h +++ b/Source/WebKit/qt/WidgetSupport/QtWebComboBox.h diff --git a/Source/WebKit/qt/declarative/experimental/experimental.pri b/Source/WebKit/qt/declarative/experimental/experimental.pri index 3775056aa..2dbfd4bf4 100644 --- a/Source/WebKit/qt/declarative/experimental/experimental.pri +++ b/Source/WebKit/qt/declarative/experimental/experimental.pri @@ -24,7 +24,7 @@ contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols wince*:LIBS += $$QMAKE_LIBS_GUI -QT += network quick quick-private webkitwidgets webkitwidgets-private +QT += network quick quick-private webkit webkit-private DESTDIR = $${ROOT_BUILD_DIR}/imports/$${TARGET.module_name} @@ -37,11 +37,16 @@ DEFINES += HAVE_WEBKIT2 WEBKIT += wtf javascriptcore webkit2 -target.path = $$[QT_INSTALL_IMPORTS]/$${TARGET.module_name} +# The fallback to QT_INSTALL_IMPORTS can be removed once we +# depend on Qt 5 RC1. +importPath = $$[QT_INSTALL_QML] +isEmpty(importPath): importPath = $$[QT_INSTALL_IMPORTS] + +target.path = $${importPath}/$${TARGET.module_name} qmldir.files += $$PWD/qmldir -qmldir.path += $$[QT_INSTALL_IMPORTS]/$${TARGET.module_name} +qmldir.path += $${importPath}/$${TARGET.module_name} INSTALLS += target qmldir diff --git a/Source/WebKit/qt/declarative/public.pri b/Source/WebKit/qt/declarative/public.pri index 9216a8b64..32b3900be 100644 --- a/Source/WebKit/qt/declarative/public.pri +++ b/Source/WebKit/qt/declarative/public.pri @@ -24,7 +24,7 @@ contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols wince*:LIBS += $$QMAKE_LIBS_GUI -QT += webkitwidgets webkitwidgets-private quick quick-private +QT += webkit webkit-private quick quick-private WEBKIT += wtf @@ -40,10 +40,15 @@ build?(webkit2): { QT += network } -target.path = $$[QT_INSTALL_IMPORTS]/$${TARGET.module_name} +# The fallback to QT_INSTALL_IMPORTS can be removed once we +# depend on Qt 5 RC1. +importPath = $$[QT_INSTALL_QML] +isEmpty(importPath): importPath = $$[QT_INSTALL_IMPORTS] + +target.path = $${importPath}/$${TARGET.module_name} qmldir.files += $$PWD/qmldir -qmldir.path += $$[QT_INSTALL_IMPORTS]/$${TARGET.module_name} +qmldir.path += $${importPath}/$${TARGET.module_name} INSTALLS += target qmldir diff --git a/Source/WebKit/qt/tests/qwebview/tst_qwebview.cpp b/Source/WebKit/qt/tests/qwebview/tst_qwebview.cpp index 8e646e196..6ff2d1ff5 100644 --- a/Source/WebKit/qt/tests/qwebview/tst_qwebview.cpp +++ b/Source/WebKit/qt/tests/qwebview/tst_qwebview.cpp @@ -27,7 +27,6 @@ #include <qwebpage.h> #include <qnetworkrequest.h> #include <qdiriterator.h> -#include <qwebkitversion.h> #include <qwebelement.h> #include <qwebframe.h> diff --git a/Source/WebKit/win/ChangeLog b/Source/WebKit/win/ChangeLog index 74d351c4e..9d3b0a038 100644 --- a/Source/WebKit/win/ChangeLog +++ b/Source/WebKit/win/ChangeLog @@ -1,3 +1,35 @@ +2012-11-30 Mihai Maerean <mmaerean@adobe.com> + + [CSSRegions] when WebKit uses V8, there should be a single variable to store if the CSS Regions feature is enabled + https://bugs.webkit.org/show_bug.cgi?id=101192 + + Reviewed by Hajime Morita. + + Removed the CSS Regions flag in Settings and switched to using the new flag I have added in RuntimeEnabledFeatures. + + Tests: No new tests because there is no functional change. + + * WebView.cpp: + (WebView::notifyPreferencesChanged): + +2012-11-29 Alexey Proskuryakov <ap@apple.com> + + [WK2] Forward cookie jar calls to NetworkProcess + https://bugs.webkit.org/show_bug.cgi?id=103457 + + Reviewed by Darin Adler. + + * WebCoreSupport/WebPlatformStrategies.cpp: + (WebPlatformStrategies::cookiesForDOM): + (WebPlatformStrategies::setCookiesFromDOM): + (WebPlatformStrategies::cookiesEnabled): + (WebPlatformStrategies::cookieRequestHeaderFieldValue): + (WebPlatformStrategies::getRawCookies): + (WebPlatformStrategies::deleteCookie): + (WebPlatformStrategies::getHostnamesWithCookies): + (WebPlatformStrategies::deleteCookiesForHostname): + (WebPlatformStrategies::deleteAllCookies): + 2012-11-27 James Simonsen <simonjam@chromium.org> Consolidate FrameLoader::load() into one function taking a FrameLoadRequest diff --git a/Source/WebKit/win/WebCoreSupport/WebPlatformStrategies.cpp b/Source/WebKit/win/WebCoreSupport/WebPlatformStrategies.cpp index 75a03e219..c3d69da89 100644 --- a/Source/WebKit/win/WebCoreSupport/WebPlatformStrategies.cpp +++ b/Source/WebKit/win/WebCoreSupport/WebPlatformStrategies.cpp @@ -29,6 +29,7 @@ #include "WebFrameNetworkingContext.h" #include <WebCore/Page.h> #include <WebCore/PageGroup.h> +#include <WebCore/PlatformCookieJar.h> #include <WebCore/PluginDatabase.h> #if USE(CFNETWORK) #include <WebKitSystemInterface/WebKitSystemInterface.h> @@ -90,6 +91,51 @@ RetainPtr<CFHTTPCookieStorageRef> WebPlatformStrategies::defaultCookieStorage() } #endif +String WebPlatformStrategies::cookiesForDOM(NetworkingContext* context, const KURL& firstParty, const KURL& url) +{ + return WebCore::cookiesForDOM(context, firstParty, url); +} + +void WebPlatformStrategies::setCookiesFromDOM(NetworkingContext* context, const KURL& firstParty, const KURL& url, const String& cookieString) +{ + WebCore::setCookiesFromDOM(context, firstParty, url, cookieString); +} + +bool WebPlatformStrategies::cookiesEnabled(NetworkingContext* context, const KURL& firstParty, const KURL& url) +{ + return WebCore::cookiesEnabled(context, firstParty, url); +} + +String WebPlatformStrategies::cookieRequestHeaderFieldValue(NetworkingContext* context, const KURL& firstParty, const KURL& url) +{ + return WebCore::cookieRequestHeaderFieldValue(context, firstParty, url); +} + +bool WebPlatformStrategies::getRawCookies(NetworkingContext* context, const KURL& firstParty, const KURL& url, Vector<Cookie>& rawCookies) +{ + return WebCore::getRawCookies(context, firstParty, url, rawCookies); +} + +void WebPlatformStrategies::deleteCookie(NetworkingContext* context, const KURL& url, const String& cookieName) +{ + WebCore::deleteCookie(context, url, cookieName); +} + +void WebPlatformStrategies::getHostnamesWithCookies(NetworkingContext* context, HashSet<String>& hostnames) +{ + WebCore::getHostnamesWithCookies(context, hostnames); +} + +void WebPlatformStrategies::deleteCookiesForHostname(NetworkingContext* context, const String& hostname) +{ + WebCore::deleteCookiesForHostname(context, hostname); +} + +void WebPlatformStrategies::deleteAllCookies(NetworkingContext* context) +{ + WebCore::deleteAllCookies(context); +} + void WebPlatformStrategies::refreshPlugins() { PluginDatabase::installedPlugins()->refresh(); diff --git a/Source/WebKit/win/WebCoreSupport/WebPlatformStrategies.h b/Source/WebKit/win/WebCoreSupport/WebPlatformStrategies.h index 9777b8480..c2eb6ef84 100644 --- a/Source/WebKit/win/WebCoreSupport/WebPlatformStrategies.h +++ b/Source/WebKit/win/WebCoreSupport/WebPlatformStrategies.h @@ -53,6 +53,15 @@ private: #if USE(CFNETWORK) virtual RetainPtr<CFHTTPCookieStorageRef> defaultCookieStorage(); #endif + virtual String cookiesForDOM(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&); + virtual void setCookiesFromDOM(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&, const String&); + virtual bool cookiesEnabled(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&); + virtual String cookieRequestHeaderFieldValue(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&); + virtual bool getRawCookies(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&, Vector<WebCore::Cookie>&); + virtual void deleteCookie(WebCore::NetworkingContext*, const WebCore::KURL&, const String&); + virtual void getHostnamesWithCookies(WebCore::NetworkingContext*, HashSet<String>& hostnames); + virtual void deleteCookiesForHostname(WebCore::NetworkingContext*, const String& hostname); + virtual void deleteAllCookies(WebCore::NetworkingContext*); // WebCore::PluginStrategy virtual void refreshPlugins(); diff --git a/Source/WebKit/win/WebView.cpp b/Source/WebKit/win/WebView.cpp index 38d2e515e..1b4259062 100644 --- a/Source/WebKit/win/WebView.cpp +++ b/Source/WebKit/win/WebView.cpp @@ -129,6 +129,7 @@ #include <WebCore/ResourceHandle.h> #include <WebCore/ResourceHandleClient.h> #include <WebCore/ResourceRequest.h> +#include <WebCore/RuntimeEnabledFeatures.h> #include <WebCore/SchemeRegistry.h> #include <WebCore/ScriptValue.h> #include <WebCore/Scrollbar.h> @@ -4671,7 +4672,7 @@ HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification) hr = preferences->isCSSRegionsEnabled(&enabled); if (FAILED(hr)) return hr; - settings->setCSSRegionsEnabled(!!enabled); + RuntimeEnabledFeatures::setCSSRegionsEnabled(!!enabled); hr = preferences->privateBrowsingEnabled(&enabled); if (FAILED(hr)) diff --git a/Source/WebKit/wince/ChangeLog b/Source/WebKit/wince/ChangeLog index d46a6549d..cabdd9581 100644 --- a/Source/WebKit/wince/ChangeLog +++ b/Source/WebKit/wince/ChangeLog @@ -1,3 +1,21 @@ +2012-11-29 Alexey Proskuryakov <ap@apple.com> + + [WK2] Forward cookie jar calls to NetworkProcess + https://bugs.webkit.org/show_bug.cgi?id=103457 + + Reviewed by Darin Adler. + + * WebCoreSupport/PlatformStrategiesWinCE.cpp: + (PlatformStrategiesWinCE::cookiesForDOM): + (PlatformStrategiesWinCE::setCookiesFromDOM): + (PlatformStrategiesWinCE::cookiesEnabled): + (PlatformStrategiesWinCE::cookieRequestHeaderFieldValue): + (PlatformStrategiesWinCE::getRawCookies): + (PlatformStrategiesWinCE::deleteCookie): + (PlatformStrategiesWinCE::getHostnamesWithCookies): + (PlatformStrategiesWinCE::deleteCookiesForHostname): + (PlatformStrategiesWinCE::deleteAllCookies): + 2012-11-27 James Simonsen <simonjam@chromium.org> Consolidate FrameLoader::load() into one function taking a FrameLoadRequest diff --git a/Source/WebKit/wince/WebCoreSupport/PlatformStrategiesWinCE.cpp b/Source/WebKit/wince/WebCoreSupport/PlatformStrategiesWinCE.cpp index 425b0f3a8..51eda76cd 100644 --- a/Source/WebKit/wince/WebCoreSupport/PlatformStrategiesWinCE.cpp +++ b/Source/WebKit/wince/WebCoreSupport/PlatformStrategiesWinCE.cpp @@ -29,6 +29,7 @@ #include "IntSize.h" #include "Page.h" #include "PageGroup.h" +#include "PlatformCookieJar.h" #include "PluginDatabase.h" using namespace WebCore; @@ -77,6 +78,51 @@ void PlatformStrategiesWinCE::notifyCookiesChanged() { } +String PlatformStrategiesWinCE::cookiesForDOM(NetworkingContext* context, const KURL& firstParty, const KURL& url) +{ + return WebCore::cookiesForDOM(context, firstParty, url); +} + +void PlatformStrategiesWinCE::setCookiesFromDOM(NetworkingContext* context, const KURL& firstParty, const KURL& url, const String& cookieString) +{ + WebCore::setCookiesFromDOM(context, firstParty, url, cookieString); +} + +bool PlatformStrategiesWinCE::cookiesEnabled(NetworkingContext* context, const KURL& firstParty, const KURL& url) +{ + return WebCore::cookiesEnabled(context, firstParty, url); +} + +String PlatformStrategiesWinCE::cookieRequestHeaderFieldValue(NetworkingContext* context, const KURL& firstParty, const KURL& url) +{ + return WebCore::cookieRequestHeaderFieldValue(context, firstParty, url); +} + +bool PlatformStrategiesWinCE::getRawCookies(NetworkingContext* context, const KURL& firstParty, const KURL& url, Vector<Cookie>& rawCookies) +{ + return WebCore::getRawCookies(context, firstParty, url, rawCookies); +} + +void PlatformStrategiesWinCE::deleteCookie(NetworkingContext* context, const KURL& url, const String& cookieName) +{ + WebCore::deleteCookie(context, url, cookieName); +} + +void PlatformStrategiesWinCE::getHostnamesWithCookies(NetworkingContext* context, HashSet<String>& hostnames) +{ + WebCore::getHostnamesWithCookies(context, hostnames); +} + +void PlatformStrategiesWinCE::deleteCookiesForHostname(NetworkingContext* context, const String& hostname) +{ + WebCore::deleteCookiesForHostname(context, hostname); +} + +void PlatformStrategiesWinCE::deleteAllCookies(NetworkingContext* context) +{ + WebCore::deleteAllCookies(context); +} + void PlatformStrategiesWinCE::refreshPlugins() { PluginDatabase::installedPlugins()->refresh(); diff --git a/Source/WebKit/wince/WebCoreSupport/PlatformStrategiesWinCE.h b/Source/WebKit/wince/WebCoreSupport/PlatformStrategiesWinCE.h index 2ce48203c..306e569a7 100644 --- a/Source/WebKit/wince/WebCoreSupport/PlatformStrategiesWinCE.h +++ b/Source/WebKit/wince/WebCoreSupport/PlatformStrategiesWinCE.h @@ -49,6 +49,15 @@ private: // WebCore::CookiesStrategy virtual void notifyCookiesChanged(); + virtual String cookiesForDOM(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&); + virtual void setCookiesFromDOM(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&, const String&); + virtual bool cookiesEnabled(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&); + virtual String cookieRequestHeaderFieldValue(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&); + virtual bool getRawCookies(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&, Vector<WebCore::Cookie>&); + virtual void deleteCookie(WebCore::NetworkingContext*, const WebCore::KURL&, const String&); + virtual void getHostnamesWithCookies(WebCore::NetworkingContext*, HashSet<String>& hostnames); + virtual void deleteCookiesForHostname(WebCore::NetworkingContext*, const String& hostname); + virtual void deleteAllCookies(WebCore::NetworkingContext*); // WebCore::PluginStrategy virtual void refreshPlugins(); diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog index b80559488..cc9771486 100644 --- a/Source/WebKit2/ChangeLog +++ b/Source/WebKit2/ChangeLog @@ -1,3 +1,592 @@ +2012-11-30 Simon Hausmann <simon.hausmann@digia.com>, Pierre Rossi <pierre.rossi@digia.com> + + [Qt] Separate Qt WebKit into Qt WebKit and Qt WebKit Widgets + https://bugs.webkit.org/show_bug.cgi?id=99314 + + Reviewed by Tor Arne Vestbø. + + This big change separates QtWebKit into QtWebKit and QtWebKitWidgets as + shared libraries. + + It's a big refactoring that mostly involves moving WebCore dependent + code into QtWebKit and accessing it through exported QWebFrameAdapter + and QWebPageAdapter classes. + + + * UIProcess/API/qt/tests/inspectorserver/inspectorserver.pro: + * UIProcess/API/qt/tests/publicapi/publicapi.pro: + * UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro: + * UIProcess/API/qt/tests/qmltests/WebView.pro: + * UIProcess/API/qt/tests/qquickwebview/qquickwebview.pro: + * UIProcess/API/qt/tests/qrawwebview/qrawwebview.pro: + * UIProcess/API/qt/tests/tests.pri: + +2012-11-30 Joone Hur <joone.hur@intel.com> + + [EFL]Drawing artifacts while resizing the view + https://bugs.webkit.org/show_bug.cgi?id=101288 + + Reviewed by Kenneth Rohde Christiansen. + + An Evas GL surface is recreated when the window is resized, but the update of the surface is + asynchronously done, which gives Evas a chance of painting the empty surface on the screen. + As a result, the flickering problem happens while resizing the view. + So this patch allows to create an Evas GL surface synchronously with the update of the surface. + + * UIProcess/API/efl/EwkViewImpl.cpp: + (EwkViewImpl::EwkViewImpl): Set m_pendingSurfaceResize to false. + (EwkViewImpl::displayTimerFired): Create an Evas GL surface. + * UIProcess/API/efl/EwkViewImpl.h: + (EwkViewImpl::setNeedsSurfaceResize): Added. + (EwkViewImpl): + * UIProcess/API/efl/ewk_view.cpp: + (_ewk_view_smart_calculate): Set m_pendingSurfaceResize to true. + +2012-11-30 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [WK2] TiledBackingStore: Frame view re-layouts with wrong Fixed Visible Content Rect. + https://bugs.webkit.org/show_bug.cgi?id=103428 + + Reviewed by Kenneth Rohde Christiansen. + + Set now appropriate fixed visible content rect before layout when viewport + attributes change. + + * UIProcess/PageViewportController.cpp: + (WebKit::PageViewportController::syncVisibleContents): + (WebKit::PageViewportController::didChangeViewportAttributes): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::sendViewportAttributesChanged): + +2012-11-30 Sudarsana Nagineni <sudarsana.nagineni@intel.com> + + [EFL] Gardening after r136031 and r136142 + https://bugs.webkit.org/show_bug.cgi?id=103734 + + Unreviewed, API test EWK2UnitTestBase.ewk_view_setting_encoding_custom + is asserting after r136031. So, disabling the test until bug 103732 is + fixed. + + * UIProcess/API/efl/tests/test_ewk2_view.cpp: + (TEST_F): + +2012-11-30 Zeno Albisser <zeno@webkit.org> + + [Qt] Enable WebGL by default. + https://bugs.webkit.org/show_bug.cgi?id=103731 + + Reviewed by Simon Hausmann. + + * UIProcess/API/qt/qquickwebview.cpp: + (QQuickWebViewPrivate::initialize): + +2012-11-30 Mihai Maerean <mmaerean@adobe.com> + + [CSSRegions] when WebKit uses V8, there should be a single variable to store if the CSS Regions feature is enabled + https://bugs.webkit.org/show_bug.cgi?id=101192 + + Reviewed by Hajime Morita. + + Removed the CSS Regions flag in Settings and switched to using the new flag I have added in RuntimeEnabledFeatures. + + Tests: No new tests because there is no functional change. + + * WebProcess/InjectedBundle/InjectedBundle.cpp: + (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): + (WebKit::InjectedBundle::setCSSRegionsEnabled): + (WebKit): + * WebProcess/InjectedBundle/InjectedBundle.h: + (InjectedBundle): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::updatePreferences): + +2012-11-29 Tim Horton <timothy_horton@apple.com> + + PDFPlugin: Only plain text can be copied out of PDFs + https://bugs.webkit.org/show_bug.cgi?id=103591 + <rdar://problem/12555161> + + Reviewed by Alexey Proskuryakov. + + Don't write zero-length data to the pasteboard, just skip the item. + + As mentioned in the comment, we don't expect this to come up, and would like to know if it does, + so we assert that it doesn't happen in debug builds. + + * WebProcess/Plugins/PDF/PDFPlugin.mm: + (WebKit::PDFPlugin::writeItemsToPasteboard): + +2012-11-29 Martin Robinson <mrobinson@igalia.com> + + [GTK] [WebKit2] WebKitWebViewBase creates a GL context for the redirected XComposite window crashing WebKit in Xvfb + https://bugs.webkit.org/show_bug.cgi?id=103476 + + Reviewed by Alejandro G. Castro. + + Create the RedirectedXCompositeWindow with an argument specifying that it + should never have a GLContext backing it. + + * UIProcess/API/gtk/WebKitWebViewBase.cpp: + (_WebKitWebViewBasePrivate::_WebKitWebViewBasePrivate): + +2012-11-29 Rafael Weinstein <rafaelw@chromium.org> + + [HTMLTemplateElement] Add feature flag + https://bugs.webkit.org/show_bug.cgi?id=103694 + + Reviewed by Adam Barth. + + This flag will guard the implementation of the HTMLTemplateElement. + http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/templates/index.html + + * Configurations/FeatureDefines.xcconfig: + +2012-11-29 Alexey Proskuryakov <ap@apple.com> + + [WK2] Forward cookie jar calls to NetworkProcess + https://bugs.webkit.org/show_bug.cgi?id=103457 + + Reviewed by Darin Adler. + + * NetworkProcess/NetworkConnectionToWebProcess.messages.in: + Added messages to maniputate CookieJar in network process. + + * NetworkProcess/NetworkConnectionToWebProcess.h: + * NetworkProcess/NetworkConnectionToWebProcess.cpp: Removed unnecessary WebCore:: prefixes, + this file has a using direcive. + (WebKit::NetworkConnectionToWebProcess::cookiesForDOM): + (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM): + (WebKit::NetworkConnectionToWebProcess::cookiesEnabled): + (WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue): + (WebKit::NetworkConnectionToWebProcess::getRawCookies): + (WebKit::NetworkConnectionToWebProcess::deleteCookie): + (WebKit::NetworkConnectionToWebProcess::getHostnamesWithCookies): + (WebKit::NetworkConnectionToWebProcess::deleteCookiesForHostname): + (WebKit::NetworkConnectionToWebProcess::deleteAllCookies): + Added implementations that use PlatformCookieJar in the network process. + + * Scripts/webkit2/messages.py: (struct_or_class): + * Shared/WebCoreArgumentCoders.h: + * Shared/WebCoreArgumentCoders.cpp: + (CoreIPC::::encode): + (CoreIPC::::decode): + Added support for Cookie. + + * WebProcess/WebCoreSupport/WebPlatformStrategies.h: + * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: + (WebKit::WebPlatformStrategies::cookiesForDOM): + (WebKit::WebPlatformStrategies::setCookiesFromDOM): + (WebKit::WebPlatformStrategies::cookiesEnabled): + (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue): + (WebKit::WebPlatformStrategies::getRawCookies): + (WebKit::WebPlatformStrategies::deleteCookie): + (WebKit::WebPlatformStrategies::getHostnamesWithCookies): + (WebKit::WebPlatformStrategies::deleteCookiesForHostname): + (WebKit::WebPlatformStrategies::deleteAllCookies): + When using the network process, forward cookie calls to it. + +2012-11-29 Kiran Muppala <cmuppala@apple.com> + + Instantiate snapshot plugins in a PluginProcess with muted audio + https://bugs.webkit.org/show_bug.cgi?id=101536 + + Reviewed by Anders Carlsson. + + Plugins created for generation of a snapshot should be instantiated in a separate process with + muted audio so that any sound generated during the snapshot process is not audible to the user. + + * Configurations/WebKit2.xcconfig: Add CoreAudio to the list of linked frameworks. + * PluginProcess/PluginProcess.h: Add PluginProcess::Type enum with values for regular and + snapshot process types. Provide DefaultHash and IsInteger template specializations for the enum + so that PluginProcessConnectionManager can store it in a HashMap. + * PluginProcess/mac/PluginProcessMac.mm: + (WebKit::muteAudio): + (WebKit::PluginProcess::platformInitialize): Mute audio if the process creation parameters indicate + that the plugin process type is snapshot process. + * Shared/Plugins/PluginProcessCreationParameters.cpp: + (WebKit::PluginProcessCreationParameters::encode): + (WebKit::PluginProcessCreationParameters::decode): + * Shared/Plugins/PluginProcessCreationParameters.h: Add processType process creation parameter. + * UIProcess/Plugins/PluginProcessManager.cpp: + (WebKit::PluginProcessManager::getPluginProcessConnection): Add process type parameter. + (WebKit::PluginProcessManager::getSitesWithData): Forward message to regular plugin process only. + (WebKit::PluginProcessManager::clearSiteData): Forward message to regular plugin process only. + (WebKit::PluginProcessManager::pluginProcessWithPath): Add process type parameter. + (WebKit::PluginProcessManager::getOrCreatePluginProcess): Ditto. + * UIProcess/Plugins/PluginProcessManager.h: + * UIProcess/Plugins/PluginProcessProxy.cpp: + (WebKit::PluginProcessProxy::create): Add process type parameter. + (WebKit::PluginProcessProxy::PluginProcessProxy): Ditto. + (WebKit::PluginProcessProxy::didClose): Include process type with the plugin process crashed message. + (WebKit::PluginProcessProxy::didFinishLaunching): Set process type process creation parameter. + * UIProcess/Plugins/PluginProcessProxy.h: + (WebKit::PluginProcessProxy::processType): + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::getPluginProcessConnection): Pass along process type parameter to + PluginProcessManager. + * UIProcess/WebProcessProxy.h: + (WebProcessProxy): + * UIProcess/WebProcessProxy.messages.in: Add process type parameter to GetPluginProcessConnection message. + * WebProcess/Plugins/PluginProcessConnection.cpp: + (WebKit::PluginProcessConnection::PluginProcessConnection): Add process type parameter. + * WebProcess/Plugins/PluginProcessConnection.h: + (WebKit::PluginProcessConnection::create): Ditto. + (WebKit::PluginProcessConnection::processType): Ditto. + * WebProcess/Plugins/PluginProcessConnectionManager.cpp: + (WebKit::PluginProcessConnectionManager::getPluginProcessConnection): Add process type parameter. + (WebKit::PluginProcessConnectionManager::removePluginProcessConnection): Use process type in addition to + plugin path to find the connection to remove. + (WebKit::PluginProcessConnectionManager::pluginProcessCrashed): Add process type parameter. + * WebProcess/Plugins/PluginProcessConnectionManager.h: + * WebProcess/Plugins/PluginProxy.cpp: + (WebKit::PluginProxy::create): Ditto. + (WebKit::PluginProxy::PluginProxy): Ditto. + (WebKit::PluginProxy::initialize): Add process type parameter in call to + PluginProcessConnectionManager::getPluginProcessConnection. + * WebProcess/Plugins/PluginProxy.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::createPlugin): Determine process type based on display state of plugin element and + pass it to PluginProxy::create. + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::pluginProcessCrashed): Pass along process type parameter to + PluginProcessConnectionManager. + * WebProcess/WebProcess.h: + * WebProcess/WebProcess.messages.in: Add process type parameter to PluginProcessCrashed message. + +2012-11-29 Anders Carlsson <andersca@apple.com> + + Initialize m_xpcConnection to null if the identifier doesn't have an XPC connection + https://bugs.webkit.org/show_bug.cgi?id=103689 + + Reviewed by Darin Adler. + + * Platform/CoreIPC/mac/ConnectionMac.cpp: + (CoreIPC::Connection::platformInitialize): + +2012-11-29 Christophe Dumez <christophe.dumez@intel.com> + + [CoordinatedGraphics] Use OwnPtr for LayerMap's layers in LayerTreeRenderer + https://bugs.webkit.org/show_bug.cgi?id=103650 + + Reviewed by Noam Rosenthal. + + We currently store raw pointers to WebCore::GraphicsLayer in the LayerMap + meaning that we need to delete them manually. This patch leverages smart + pointers and stores layers as OwnPtr in the LayerMap so that the layers + are owned by the HashMap and we don't have to handle memory manually. + + * UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp: + (WebKit::LayerTreeRenderer::adjustPositionForFixedLayers): + (WebKit::LayerTreeRenderer::setLayerChildren): + (WebKit::LayerTreeRenderer::deleteLayer): + (WebKit::LayerTreeRenderer::ensureLayer): + * UIProcess/CoordinatedGraphics/LayerTreeRenderer.h: + +2012-11-29 Anders Carlsson <andersca@apple.com> + + Add a minimumLayoutWidth WKView property + https://bugs.webkit.org/show_bug.cgi?id=103660 + <rdar://problem/11791729> + + Reviewed by Beth Dakin. + + When minimumLayoutWidth is set to a positive value, the WKView will update its intrinsic content size given the layout width. + + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::intrinsicContentSizeDidChange): + Call the WKView. + + * UIProcess/API/mac/WKView.mm: + (-[WKView intrinsicContentSize]): + Override the intrinsicContentSize getter. + + (-[WKView _setIntrinsicContentSize:]): + Update the intrinsic content size and mark it as invalid. + + (-[WKView initWithFrame:contextRef:pageGroupRef:relatedToPage:]): + By default, the WKView should have no intrinsic size. + + (-[WKView minimumLayoutWidth]): + (-[WKView setMinimumLayoutWidth:]): + Call through to the WebPageProxy object. + + * UIProcess/API/mac/WKViewPrivate.h: + Add the SPI here. + + * UIProcess/DrawingAreaProxy.h: + (WebKit::DrawingAreaProxy::minimumLayoutWidthDidChange): + (WebKit::DrawingAreaProxy::didUpdateGeometry): + (WebKit::DrawingAreaProxy::intrinsicContentSizeDidChange): + Add empty stubs. + + * UIProcess/DrawingAreaProxy.messages.in: + Update the DidUpdateGeometry signature and add IntrinsicContentSizeDidChange. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::WebPageProxy): + Initialize the minimum layout width. + + (WebKit::WebPageProxy::setMinimumLayoutWidth): + Update the minimum layout width and call the drawing area proxy. + + * UIProcess/WebPageProxy.h: + (WebKit::WebPageProxy::minimumLayoutWidth): + Add getter. + + * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h: + (TiledCoreAnimationDrawingAreaProxy): + * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm: + (WebKit::TiledCoreAnimationDrawingAreaProxy::minimumLayoutWidthDidChange): + Update the geometry if needed. + + (WebKit::TiledCoreAnimationDrawingAreaProxy::didUpdateGeometry): + Update the intrinsic content size. + + (WebKit::TiledCoreAnimationDrawingAreaProxy::intrinsicContentSizeDidChange): + Call through to WebPageProxy::intrinsicContentSizeDidChange. + + (WebKit::TiledCoreAnimationDrawingAreaProxy::sendUpdateGeometry): + Pass along the minimum layout width. + + * UIProcess/mac/WebPageProxyMac.mm: + (WebKit::WebPageProxy::intrinsicContentSizeDidChange): + Call through to the page client. + + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::contentsSizeChanged): + Call DrawingArea::mainFrameContentSizeChanged. + + * WebProcess/WebPage/DrawingArea.h: + (WebKit::DrawingArea::mainFrameContentSizeChanged): + Add empty stub. + + (WebKit::DrawingArea::updateGeometry): + Update signature. + + * WebProcess/WebPage/DrawingArea.messages.in: + Add minimumLayoutWidth to UpdateGeometry. + + * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: + * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: + (WebKit::TiledCoreAnimationDrawingArea::mainFrameContentSizeChanged): + If the content size change is not coming from updateGeometry, send an InstrinsicContentSizeDidChange message. + + (WebKit::TiledCoreAnimationDrawingArea::updateGeometry): + If m_minimumLayoutWidth is positive, do an initial layout pass to figure out the height of the page and then do another + layout with the viewport set to that height. + +2012-11-29 Anders Carlsson <andersca@apple.com> + + CoreIPC::Connection should retain its xpc_connection_t + https://bugs.webkit.org/show_bug.cgi?id=103671 + <rdar://problem/12717331> + + Reviewed by Beth Dakin. + + * Platform/CoreIPC/mac/ConnectionMac.cpp: + (CoreIPC::Connection::platformInitialize): + Retain the xpc_connection_t object here to balance the xpc_object_release in platformInvalidate. + +2012-11-29 Brent Fulgham <bfulgham@webkit.org> + + [Windows, WinCairo] Unreviewed build fix. Build was failing + because the export definition file included a debug-only + symbol. It's not needed and shouldn't be included for export. + + * win/WebKit2.def: Don't require notSolidColor to be exported. + * win/WebKit2CFLite.def: Ditto. + +2012-11-29 Tim Horton <timothy_horton@apple.com> + + PDFPlugin: Only plain text can be copied out of PDFs + https://bugs.webkit.org/show_bug.cgi?id=103591 + <rdar://problem/12555161> + + Reviewed by Alexey Proskuryakov. + + Enable rich data to be copied from PDFKit to the pasteboard. + + * WebProcess/Plugins/PDF/PDFPlugin.h: + (PDFPlugin): Add writeItemsToPasteboard. + * WebProcess/Plugins/PDF/PDFPlugin.mm: + (-[WKPDFLayerControllerDelegate writeItemsToPasteboard:withTypes:]): Move implementation to PDFPlugin. + (WebKit::PDFPlugin::writeItemsToPasteboard): Don't round-trip through WebCore for pasteboard operations, + use WebContext directly. This provides a simple way to hand over a buffer for complex pasteboard types + (RTF, HTML, etc.). Use this interface for arbitrary non-plain-text pasteboard data that PDFKit hands us. + +2012-11-29 Martin Robinson <mrobinson@igalia.com> + + [GTK] [WebKit2] Embed the HTTP authentication dialog into the WebView + https://bugs.webkit.org/show_bug.cgi?id=103277 + + Reviewed by Carlos Garcia Campos. + + Embed the WebKit2 HTTP authentication dialog into the WebView. Add the dialog as a child + of the WebKitWebViewBase container (like the web inspector). + + We do not yet properly handle pages that require authentication for more than one resource. + As that is an uncommon situation, it will be handled in another patch. + + * UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.cpp: + (WebKit::drawSignal): We have to override the draw signal of the dialog to draw + a GtkWindow background on the widget. This is required because the widget doesn't + have a real GtkWindow to draw its background. + (WebKit::loadChangedSignal): When a new load starts in the WebView destroy the dialog. This + is so that the dialog doesn't stick around when the user chooses to navigate away from the + page requiring authentication. + (WebKit::WebKit2GtkAuthenticationDialog::WebKit2GtkAuthenticationDialog): Create an eventbox + and frame to hold the dialog contents. Also append the 'background' widget class to the + event box, so that it can draw a GtkWindow background in the draw signal handler. + (WebKit::WebKit2GtkAuthenticationDialog::~WebKit2GtkAuthenticationDialog): Disconnect the + load status changed signal handler. + (WebKit::WebKit2GtkAuthenticationDialog::show): When it's time to show the dialog, add it to + WebKitWebViewBase. + * UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.h: Add some new methods for handling the + embedded dialog. + * UIProcess/API/gtk/WebKitLoaderClient.cpp: + (didReceiveAuthenticationChallengeInFrame): Collapse the creation of the dialog into one line. + * UIProcess/API/gtk/WebKitWebViewBase.cpp: + (_WebKitWebViewBasePrivate): Add the dialog as a property of the private structure. + (webkitWebViewChildIsInternalWidget): Added this helper used for determining when a child widget + is "internal" (ie the web inspector or the authentication dialog). + (webkitWebViewBaseContainerAdd): Only add non-internal widgets to the children map. + (webkitWebViewBaseAddAuthenticationDialog): Added. + (webkitWebViewBaseAddWebInspector): Added this more-foolproof method of adding a web inspector + to the WebView. This also aligns it with the way the authentication dialog is added. + (webkitWebViewBaseContainerRemove): When removing the authentication dialog, zero out the + field in the private structure. + (webkitWebViewBaseContainerForall): Add support for the authentication dialog here too. + (webkitWebViewBaseChildMoveResize): Don't pass on move_resize events to internal children. + (webkit_web_view_base_init): Zero out the authentication dialog member on init. + (webkitWebViewBaseDraw): If the authentication dialog is active, draw a shadow over web content. + (resizeWebKitWebViewBaseFromAllocation): Make the authentication dialog centered in the view. + (webkitWebViewBaseKeyPressEvent): Pass on key events to the authentication dialog if active. + (webkitWebViewBaseButtonPressEvent): If the authentication dialog is active don't pass button events + to web content. + (webkitWebViewBaseButtonReleaseEvent): Ditto. + (webkitWebViewBaseScrollEvent): Ditto. + (webkitWebViewBaseMotionNotifyEvent): Ditto. + (webkitWebViewBaseFocus): Pass on focus events to the authentication dialog so that tabbing between + elements in the dialog works correctly. + (webkit_web_view_base_class_init): Hook up the focus event. + * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: Add new methods for adding the authentication dialog + and the web inspector. + * UIProcess/gtk/WebInspectorProxyGtk.cpp: + (WebKit::WebInspectorProxy::createInspectorWindow): Use the new method for adding the web inspector. + +2012-11-29 Andrei Bucur <abucur@adobe.com> + + Fix the build after r136095 + https://bugs.webkit.org/show_bug.cgi?id=103629 + + Unreviewed. + + Add a static_cast to fix the build. + + * Shared/mac/ObjCObjectGraphCoders.mm: + (WebKit::ObjCObjectGraphEncoder::baseEncode): + +2012-11-29 Christophe Dumez <christophe.dumez@intel.com> + + [CoordinatedGraphics] Have LayerTreeRenderer::ensureLayer() return the layer + https://bugs.webkit.org/show_bug.cgi?id=103645 + + Reviewed by Noam Rosenthal. + + The current LayerTreeRenderer code keep calling ensureLayer() and then + LayerMap::find() to retrieve the layer. Since ensureLayer() already has + a pointer to the layer, we can simply have the function return it. + This is slightly more efficient and it makes the code a bit simpler. + + * UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp: + (WebKit::LayerTreeRenderer::setLayerChildren): + (WebKit::LayerTreeRenderer::setLayerFilters): + (WebKit::LayerTreeRenderer::setLayerState): + (WebKit::LayerTreeRenderer::ensureLayer): + * UIProcess/CoordinatedGraphics/LayerTreeRenderer.h: + +2012-11-29 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [WK2] TiledBackingStore: User events are sent to web page before it is shown + https://bugs.webkit.org/show_bug.cgi?id=101753 + + Reviewed by Jocelyn Turcotte. + + User events are suppressed on WEB process side while drawing area is frozen. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::mouseEvent): + (WebKit::WebPage::wheelEvent): + (WebKit::WebPage::keyEvent): + (WebKit::WebPage::gestureEvent): + (WebKit::WebPage::touchEvent): + (WebKit::WebPage::sendIfEventCannotBeHandled): + (WebKit): + (WebKit::WebPage::didCompletePageTransition): + * WebProcess/WebPage/WebPage.h: + (WebPage): + +2012-11-29 Allan Sandfeld Jensen <allan.jensen@digia.com> + + Possible to resize out of bounds + https://bugs.webkit.org/show_bug.cgi?id=103521 + + Reviewed by Jocelyn Turcotte. + + Enforce the viewportBounds after resize, and ensure a user fitted page remains + fit on viewport resize, but not on content growth. + + * UIProcess/API/qt/tests/qmltests/WebView/tst_resize.qml: Added. + * UIProcess/PageViewportController.cpp: + (WebKit::PageViewportController::didChangeContentsSize): + (WebKit::PageViewportController::didChangeViewportAttributes): + (WebKit::PageViewportController::updateMinimumScaleToFit): + * UIProcess/PageViewportController.h: + (PageViewportController): + +2012-11-29 Michael Brüning <michael.bruning@digia.com> + + [Qt][WK2] Commit the preedit string in the input method when focus is about to be moved. + https://bugs.webkit.org/show_bug.cgi?id=97774 + + Reviewed by Kenneth Rohde Christiansen. + + Implements the handler for willSetInputMethodState in WebKit2 in Qt. + This is needed to tell the input method instance in Qt to commit its + preedit content when the focus has moved to another node to prevent a + bug where the old preedit string was kept as the preedit string and + the editor moved focus back to the old node when continuing to enter + text via the input method. + + This behavior is analog to the behavior of the QtQuick text input + elements. + + * UIProcess/API/qt/raw/qrawwebview.cpp: + (QRawWebViewPrivate::handleWillSetInputMethodState): + * UIProcess/API/qt/raw/qrawwebview_p_p.h: + (QRawWebViewPrivate): + * UIProcess/PageClient.h: + (PageClient): + * UIProcess/WebPageProxy.h: + (WebPageProxy): + * UIProcess/WebPageProxy.messages.in: + * UIProcess/qt/QtPageClient.cpp: + (WebKit::QtPageClient::handleWillSetInputMethodState): + (WebKit): + * UIProcess/qt/QtPageClient.h: + (QtPageClient): + * UIProcess/qt/QtWebPageEventHandler.cpp: + (WebKit::QtWebPageEventHandler::handleWillSetInputMethodState): + (WebKit): + * UIProcess/qt/QtWebPageEventHandler.h: + (QtWebPageEventHandler): + * UIProcess/qt/WebPageProxyQt.cpp: + (WebKit::WebPageProxy::willSetInputMethodState): + (WebKit): + * WebProcess/WebCoreSupport/WebEditorClient.cpp: + (WebKit::WebEditorClient::willSetInputMethodState): + 2012-11-28 Jocelyn Turcotte <jocelyn.turcotte@digia.com> [Qt] The WebView should be flickable only using touch events diff --git a/Source/WebKit2/Configurations/FeatureDefines.xcconfig b/Source/WebKit2/Configurations/FeatureDefines.xcconfig index b0d2dab41..1b0396831 100644 --- a/Source/WebKit2/Configurations/FeatureDefines.xcconfig +++ b/Source/WebKit2/Configurations/FeatureDefines.xcconfig @@ -143,6 +143,7 @@ ENABLE_SVG = ENABLE_SVG; ENABLE_SVG_DOM_OBJC_BINDINGS = $(ENABLE_SVG_DOM_OBJC_BINDINGS_$(PLATFORM_NAME)); ENABLE_SVG_DOM_OBJC_BINDINGS_macosx = ENABLE_SVG_DOM_OBJC_BINDINGS; ENABLE_SVG_FONTS = ENABLE_SVG_FONTS; +ENABLE_TEMPLATE_ELEMENT = ; ENABLE_TEXT_AUTOSIZING = ; ENABLE_TEXT_NOTIFICATIONS_ONLY = ENABLE_TEXT_NOTIFICATIONS_ONLY; ENABLE_TOUCH_ICON_LOADING = ; diff --git a/Source/WebKit2/Configurations/Version.xcconfig b/Source/WebKit2/Configurations/Version.xcconfig index c70f4a618..469856d5f 100644 --- a/Source/WebKit2/Configurations/Version.xcconfig +++ b/Source/WebKit2/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 537; -MINOR_VERSION = 20; +MINOR_VERSION = 21; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/Source/WebKit2/Configurations/WebKit2.xcconfig b/Source/WebKit2/Configurations/WebKit2.xcconfig index 3e4588c62..d88eb18c3 100644 --- a/Source/WebKit2/Configurations/WebKit2.xcconfig +++ b/Source/WebKit2/Configurations/WebKit2.xcconfig @@ -29,7 +29,7 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = $(WEBKIT2_FRAMEWORKS_DIR); DYLIB_INSTALL_NAME_BASE = $(NORMAL_WEBKIT2_FRAMEWORKS_DIR); -FRAMEWORK_AND_LIBRARY_LDFLAGS = -framework ApplicationServices -framework Carbon -framework Cocoa -framework CoreServices -framework IOKit -framework JavaScriptCore -licucore -framework QuartzCore -framework Security -framework WebCore; +FRAMEWORK_AND_LIBRARY_LDFLAGS = -framework ApplicationServices -framework Carbon -framework Cocoa -framework CoreServices -framework IOKit -framework JavaScriptCore -licucore -framework QuartzCore -framework Security -framework WebCore -framework CoreAudio; OTHER_LDFLAGS = $(OTHER_LDFLAGS_$(PLATFORM_NAME)) $(OTHER_LDFLAGS); OTHER_LDFLAGS_macosx = $(FRAMEWORK_AND_LIBRARY_LDFLAGS); diff --git a/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp b/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp index 50ce734f4..f07165107 100644 --- a/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp +++ b/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp @@ -29,6 +29,8 @@ #include "ConnectionStack.h" #include "NetworkProcess.h" #include "NetworkResourceLoader.h" +#include "RemoteNetworkingContext.h" +#include <WebCore/PlatformCookieJar.h> #include <WebCore/ResourceLoaderOptions.h> #include <WebCore/ResourceRequest.h> #include <WebCore/RunLoop.h> @@ -122,7 +124,7 @@ void NetworkConnectionToWebProcess::scheduleResourceLoad(const NetworkResourceLo resourceLoadIdentifier = NetworkProcess::shared().networkResourceLoadScheduler().scheduleResourceLoad(loadParameters, this); } -void NetworkConnectionToWebProcess::addLoadInProgress(const WebCore::KURL& url, ResourceLoadIdentifier& identifier) +void NetworkConnectionToWebProcess::addLoadInProgress(const KURL& url, ResourceLoadIdentifier& identifier) { identifier = NetworkProcess::shared().networkResourceLoadScheduler().addLoadInProgress(url); } @@ -152,6 +154,62 @@ void NetworkConnectionToWebProcess::setSerialLoadingEnabled(bool enabled) m_serialLoadingEnabled = enabled; } +void NetworkConnectionToWebProcess::cookiesForDOM(const KURL& firstParty, const KURL& url, String& result) +{ + // FIXME (NetworkProcess): Use a correct storage session. + result = WebCore::cookiesForDOM(RemoteNetworkingContext::create(false, false).get(), firstParty, url); +} + +void NetworkConnectionToWebProcess::setCookiesFromDOM(const KURL& firstParty, const KURL& url, const String& cookieString) +{ + // FIXME (NetworkProcess): Use a correct storage session. + WebCore::setCookiesFromDOM(RemoteNetworkingContext::create(false, false).get(), firstParty, url, cookieString); +} + +void NetworkConnectionToWebProcess::cookiesEnabled(const KURL& firstParty, const KURL& url, bool& result) +{ + // FIXME (NetworkProcess): Use a correct storage session. + result = WebCore::cookiesEnabled(RemoteNetworkingContext::create(false, false).get(), firstParty, url); +} + +void NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue(const KURL& firstParty, const KURL& url, String& result) +{ + // FIXME (NetworkProcess): Use a correct storage session. + result = WebCore::cookieRequestHeaderFieldValue(0, firstParty, url); +} + +void NetworkConnectionToWebProcess::getRawCookies(const KURL& firstParty, const KURL& url, Vector<Cookie>& result) +{ + // FIXME (NetworkProcess): Use a correct storage session. + WebCore::getRawCookies(RemoteNetworkingContext::create(false, false).get(), firstParty, url, result); +} + +void NetworkConnectionToWebProcess::deleteCookie(const KURL& url, const String& cookieName) +{ + // FIXME (NetworkProcess): Use a correct storage session. + WebCore::deleteCookie(RemoteNetworkingContext::create(false, false).get(), url, cookieName); +} + +void NetworkConnectionToWebProcess::getHostnamesWithCookies(Vector<String>& hostnames) +{ + // FIXME (NetworkProcess): Use a correct storage session. + HashSet<String> hostnamesSet; + WebCore::getHostnamesWithCookies(RemoteNetworkingContext::create(false, false).get(), hostnamesSet); + WTF::copyToVector(hostnamesSet, hostnames); +} + +void NetworkConnectionToWebProcess::deleteCookiesForHostname(const String& hostname) +{ + // FIXME (NetworkProcess): Use a correct storage session. + WebCore::deleteCookiesForHostname(RemoteNetworkingContext::create(false, false).get(), hostname); +} + +void NetworkConnectionToWebProcess::deleteAllCookies() +{ + // FIXME (NetworkProcess): Use a correct storage session. + WebCore::deleteAllCookies(RemoteNetworkingContext::create(false, false).get()); +} + } // namespace WebKit #endif // ENABLE(NETWORK_PROCESS) diff --git a/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h b/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h index 179bc2ddf..042a7dd00 100644 --- a/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h +++ b/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h @@ -82,7 +82,16 @@ private: void suspendPendingRequests(); void resumePendingRequests(); void setSerialLoadingEnabled(bool); - + void cookiesForDOM(const WebCore::KURL& firstParty, const WebCore::KURL&, String& result); + void setCookiesFromDOM(const WebCore::KURL& firstParty, const WebCore::KURL&, const String&); + void cookiesEnabled(const WebCore::KURL& firstParty, const WebCore::KURL&, bool& result); + void cookieRequestHeaderFieldValue(const WebCore::KURL& firstParty, const WebCore::KURL&, String& result); + void getRawCookies(const WebCore::KURL& firstParty, const WebCore::KURL&, Vector<WebCore::Cookie>&); + void deleteCookie(const WebCore::KURL&, const String& cookieName); + void getHostnamesWithCookies(Vector<String>& hostnames); + void deleteCookiesForHostname(const String& hostname); + void deleteAllCookies(); + RefPtr<CoreIPC::Connection> m_connection; HashSet<NetworkConnectionToWebProcessObserver*> m_observers; diff --git a/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in b/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in index 8c13e3cdf..d6c5f65b8 100644 --- a/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in +++ b/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in @@ -38,6 +38,16 @@ messages -> NetworkConnectionToWebProcess { ResumePendingRequests() -> () SetSerialLoadingEnabled(bool enabled) -> () + + CookiesForDOM(WebCore::KURL firstParty, WebCore::KURL url) -> (WTF::String result) + SetCookiesFromDOM(WebCore::KURL firstParty, WebCore::KURL url, WTF::String cookieString) + CookiesEnabled(WebCore::KURL firstParty, WebCore::KURL url) -> (bool enabled) + CookieRequestHeaderFieldValue(WebCore::KURL firstParty, WebCore::KURL url) -> (WTF::String result) + GetRawCookies(WebCore::KURL firstParty, WebCore::KURL url) -> (WTF::Vector<WebCore::Cookie> cookies) + DeleteCookie(WebCore::KURL url, WTF::String cookieName) + GetHostnamesWithCookies() -> (WTF::Vector<WTF::String> hostnames) + DeleteCookiesForHostname(WTF::String hostname) + DeleteAllCookies() } #endif // ENABLE(NETWORK_PROCESS) diff --git a/Source/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp b/Source/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp index 17d8ecbc8..950f20dd0 100644 --- a/Source/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp +++ b/Source/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp @@ -93,6 +93,10 @@ void Connection::platformInitialize(Identifier identifier) #if HAVE(XPC) m_xpcConnection = identifier.xpcConnection; + // FIXME: Instead of explicitly retaining the connection here, Identifier::xpcConnection + // should just be a smart pointer. + if (m_xpcConnection) + xpc_retain(m_xpcConnection); #endif } diff --git a/Source/WebKit2/PluginProcess/PluginProcess.h b/Source/WebKit2/PluginProcess/PluginProcess.h index d60c94b92..b4323ed17 100644 --- a/Source/WebKit2/PluginProcess/PluginProcess.h +++ b/Source/WebKit2/PluginProcess/PluginProcess.h @@ -45,6 +45,13 @@ struct PluginProcessCreationParameters; class PluginProcess : ChildProcess { WTF_MAKE_NONCOPYABLE(PluginProcess); public: + + enum Type { + // Start with value one since default HashTraits<> disallows zero as key. + TypeRegularProcess = 1, + TypeSnapshotProcess + }; + static PluginProcess& shared(); void initialize(CoreIPC::Connection::Identifier, WebCore::RunLoop*); @@ -115,6 +122,13 @@ private: } // namespace WebKit +namespace WTF { + +template<> struct DefaultHash<WebKit::PluginProcess::Type> { typedef DefaultHash<uint32_t>::Hash Hash; }; +template<> struct IsInteger<WebKit::PluginProcess::Type> { static const bool value = true; }; + +} // namespace WTF + #endif // ENABLE(PLUGIN_PROCESS) #endif // PluginProcess_h diff --git a/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm b/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm index 671f20d6d..b7c52e613 100644 --- a/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm +++ b/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm @@ -33,6 +33,7 @@ #import "PluginProcessShim.h" #import "PluginProcessProxyMessages.h" #import "PluginProcessCreationParameters.h" +#import <CoreAudio/AudioHardware.h> #import <WebCore/LocalizedStrings.h> #import <WebKitSystemInterface.h> #import <dlfcn.h> @@ -304,6 +305,14 @@ static void initializeSandbox(const String& pluginPath, const String& sandboxPro } #endif +static void muteAudio(void) +{ + AudioObjectPropertyAddress propertyAddress = { kAudioHardwarePropertyProcessIsAudible, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster }; + UInt32 propertyData = 0; + OSStatus result = AudioObjectSetPropertyData(kAudioObjectSystemObject, &propertyAddress, 0, 0, sizeof(UInt32), &propertyData); + ASSERT_UNUSED(result, result == noErr); +} + void PluginProcess::platformInitialize(const PluginProcessCreationParameters& parameters) { m_compositingRenderServerPort = parameters.acceleratedCompositingPort.port(); @@ -319,6 +328,9 @@ void PluginProcess::platformInitialize(const PluginProcessCreationParameters& pa #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 initializeSandbox(m_pluginPath, parameters.sandboxProfileDirectoryPath); #endif + + if (parameters.processType == TypeSnapshotProcess) + muteAudio(); } } // namespace WebKit diff --git a/Source/WebKit2/Scripts/webkit2/messages.py b/Source/WebKit2/Scripts/webkit2/messages.py index 69a9e352e..0c9b94116 100644 --- a/Source/WebKit2/Scripts/webkit2/messages.py +++ b/Source/WebKit2/Scripts/webkit2/messages.py @@ -164,6 +164,7 @@ def struct_or_class(namespace, type): 'WebCore::Animation', 'WebCore::EditorCommandsForKeyEvent', 'WebCore::CompositionUnderline', + 'WebCore::Cookie', 'WebCore::DragSession', 'WebCore::FloatPoint3D', 'WebCore::FileChooserSettings', diff --git a/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp b/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp index f53c26e6b..f5e5101ea 100644 --- a/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp +++ b/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp @@ -40,6 +40,7 @@ PluginProcessCreationParameters::PluginProcessCreationParameters() void PluginProcessCreationParameters::encode(CoreIPC::ArgumentEncoder& encoder) const { encoder << pluginPath; + encoder.encodeEnum(processType); encoder << supportsAsynchronousPluginInitialization; encoder << minimumLifetime; encoder << terminationTimeout; @@ -55,6 +56,8 @@ bool PluginProcessCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, { if (!decoder->decode(result.pluginPath)) return false; + if (!decoder->decodeEnum(result.processType)) + return false; if (!decoder->decode(result.supportsAsynchronousPluginInitialization)) return false; if (!decoder->decode(result.minimumLifetime)) diff --git a/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.h b/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.h index a414212be..1b3f9ff27 100644 --- a/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.h +++ b/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.h @@ -28,6 +28,7 @@ #if ENABLE(PLUGIN_PROCESS) +#include "PluginProcess.h" #include <wtf/text/WTFString.h> #if PLATFORM(MAC) @@ -48,6 +49,7 @@ struct PluginProcessCreationParameters { static bool decode(CoreIPC::ArgumentDecoder*, PluginProcessCreationParameters&); String pluginPath; + PluginProcess::Type processType; bool supportsAsynchronousPluginInitialization; double minimumLifetime; diff --git a/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp b/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp index 516b68b9b..12f387e5d 100644 --- a/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp +++ b/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp @@ -28,6 +28,7 @@ #include "ShareableBitmap.h" #include <WebCore/AuthenticationChallenge.h> +#include <WebCore/Cookie.h> #include <WebCore/Credential.h> #include <WebCore/Cursor.h> #include <WebCore/DatabaseDetails.h> @@ -686,6 +687,42 @@ bool ArgumentCoder<CompositionUnderline>::decode(ArgumentDecoder* decoder, Compo return true; } + +void ArgumentCoder<Cookie>::encode(ArgumentEncoder& encoder, const Cookie& cookie) +{ + encoder << cookie.name; + encoder << cookie.value; + encoder << cookie.domain; + encoder << cookie.path; + encoder << cookie.expires; + encoder << cookie.httpOnly; + encoder << cookie.secure; + encoder << cookie.session; +} + +bool ArgumentCoder<Cookie>::decode(ArgumentDecoder* decoder, Cookie& cookie) +{ + if (!decoder->decode(cookie.name)) + return false; + if (!decoder->decode(cookie.value)) + return false; + if (!decoder->decode(cookie.domain)) + return false; + if (!decoder->decode(cookie.path)) + return false; + if (!decoder->decode(cookie.expires)) + return false; + if (!decoder->decode(cookie.httpOnly)) + return false; + if (!decoder->decode(cookie.secure)) + return false; + if (!decoder->decode(cookie.session)) + return false; + + return true; +} + + #if ENABLE(SQL_DATABASE) void ArgumentCoder<DatabaseDetails>::encode(ArgumentEncoder& encoder, const DatabaseDetails& details) { diff --git a/Source/WebKit2/Shared/WebCoreArgumentCoders.h b/Source/WebKit2/Shared/WebCoreArgumentCoders.h index e25314758..75b4acc59 100644 --- a/Source/WebKit2/Shared/WebCoreArgumentCoders.h +++ b/Source/WebKit2/Shared/WebCoreArgumentCoders.h @@ -52,6 +52,7 @@ namespace WebCore { class UserStyleSheet; class UserScript; struct CompositionUnderline; + struct Cookie; struct DictationAlternative; struct DragSession; struct FileChooserSettings; @@ -207,6 +208,11 @@ template<> struct ArgumentCoder<WebCore::CompositionUnderline> { static bool decode(ArgumentDecoder*, WebCore::CompositionUnderline&); }; +template<> struct ArgumentCoder<WebCore::Cookie> { + static void encode(ArgumentEncoder&, const WebCore::Cookie&); + static bool decode(ArgumentDecoder*, WebCore::Cookie&); +}; + template<> struct ArgumentCoder<WebCore::DatabaseDetails> { static void encode(ArgumentEncoder&, const WebCore::DatabaseDetails&); static bool decode(ArgumentDecoder*, WebCore::DatabaseDetails&); diff --git a/Source/WebKit2/Shared/mac/ObjCObjectGraphCoders.mm b/Source/WebKit2/Shared/mac/ObjCObjectGraphCoders.mm index d19e981a5..d30e7e1a1 100644 --- a/Source/WebKit2/Shared/mac/ObjCObjectGraphCoders.mm +++ b/Source/WebKit2/Shared/mac/ObjCObjectGraphCoders.mm @@ -94,7 +94,7 @@ public: type = typeFromObject(m_root); if (type == UnknownType) { - [NSException raise:NSInvalidArgumentException format:@"Can not encode objects of class type '%@'", NSStringFromClass([m_root class])]; + [NSException raise:NSInvalidArgumentException format:@"Can not encode objects of class type '%@'", static_cast<NSString *>(NSStringFromClass([m_root class]))]; } encoder << static_cast<uint32_t>(type); diff --git a/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp b/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp index 50e4cb205..2f2629ce0 100644 --- a/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp +++ b/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp @@ -114,6 +114,9 @@ const Evas_Object* EwkViewImpl::viewFromPageViewMap(const WKPageRef page) EwkViewImpl::EwkViewImpl(Evas_Object* view, PassRefPtr<EwkContext> context, PassRefPtr<WebPageGroup> pageGroup, ViewBehavior behavior) : m_view(view) , m_context(context) +#if USE(ACCELERATED_COMPOSITING) + , m_pendingSurfaceResize(false) +#endif , m_pageClient(behavior == DefaultBehavior ? PageClientDefaultImpl::create(this) : PageClientLegacyImpl::create(this)) , m_pageProxy(m_context->webContext()->createWebPage(m_pageClient.get(), pageGroup.get())) , m_pageLoadClient(PageLoadClientEfl::create(this)) @@ -361,7 +364,12 @@ void EwkViewImpl::displayTimerFired(Timer<EwkViewImpl>*) #if USE(COORDINATED_GRAPHICS) Ewk_View_Smart_Data* sd = smartData(); - evas_gl_make_current(m_evasGL.get(), evasGLSurface(), evasGLContext()); + if (m_pendingSurfaceResize) { + // Create a GL surface here so that Evas has no chance of painting to an empty GL surface. + createGLSurface(IntSize(sd->view.w, sd->view.h)); + m_pendingSurfaceResize = false; + } else + evas_gl_make_current(m_evasGL.get(), evasGLSurface(), evasGLContext()); // We are supposed to clip to the actual viewport, nothing less. IntRect viewport(sd->view.x, sd->view.y, sd->view.w, sd->view.h); diff --git a/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h b/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h index cb1875672..bb93fedb1 100644 --- a/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h +++ b/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h @@ -161,6 +161,7 @@ public: bool createGLSurface(const WebCore::IntSize& viewSize); bool enterAcceleratedCompositingMode(); bool exitAcceleratedCompositingMode(); + void setNeedsSurfaceResize() { m_pendingSurfaceResize = true; } #endif #if ENABLE(INPUT_TYPE_COLOR) @@ -246,6 +247,7 @@ private: OwnPtr<Evas_GL> m_evasGL; OwnPtr<WebKit::EvasGLContext> m_evasGLContext; OwnPtr<WebKit::EvasGLSurface> m_evasGLSurface; + bool m_pendingSurfaceResize; #endif OwnPtr<WebKit::PageClientBase> m_pageClient; RefPtr<WebKit::WebPageProxy> m_pageProxy; diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp index d5d50ed0a..349b086e9 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp @@ -387,8 +387,7 @@ static void _ewk_view_smart_calculate(Evas_Object* ewkView) impl->page()->drawingArea()->setSize(IntSize(width, height), IntSize()); #if USE(ACCELERATED_COMPOSITING) - if (width && height) - impl->createGLSurface(IntSize(width, height)); + impl->setNeedsSurfaceResize(); #endif #if USE(TILED_BACKING_STORE) impl->pageClient()->updateViewportSize(IntSize(width, height)); diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp index 25fe0698b..922c3ec21 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp @@ -134,7 +134,7 @@ TEST_F(EWK2UnitTestBase, ewk_view_navigation) ASSERT_FALSE(ewk_view_forward_possible(webView())); } -TEST_F(EWK2UnitTestBase, ewk_view_setting_encoding_custom) +TEST_F(EWK2UnitTestBase, DISABLED_ewk_view_setting_encoding_custom) { ASSERT_FALSE(ewk_view_custom_encoding_get(webView())); ASSERT_TRUE(ewk_view_custom_encoding_set(webView(), "UTF-8")); diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.cpp index ef2da1c98..13efe8c68 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.cpp @@ -23,15 +23,40 @@ #include "AuthenticationChallengeProxy.h" #include "AuthenticationDecisionListener.h" #include "WebCredential.h" +#include "WebKitWebViewBasePrivate.h" +#include "WebKitWebViewPrivate.h" +#include <gtk/gtk.h> namespace WebKit { +// This is necessary because GtkEventBox does not draw a background by default, +// but we want it to have a normal GtkWindow background. +static gboolean drawSignal(GtkWidget* widget, cairo_t* cr, GtkStyleContext* styleContext) +{ + gtk_render_background(styleContext, cr, 0, 0, + gtk_widget_get_allocated_width(widget), gtk_widget_get_allocated_height(widget)); + return FALSE; +} + WebKit2GtkAuthenticationDialog::WebKit2GtkAuthenticationDialog(AuthenticationChallengeProxy* authenticationChallenge) - : GtkAuthenticationDialog(0, authenticationChallenge->core()) + : GtkAuthenticationDialog(authenticationChallenge->core()) , m_authenticationChallenge(authenticationChallenge) + , m_styleContext(adoptGRef(gtk_style_context_new())) { - // We aren't passing a toplevel to the GtkAuthenticationDialog constructor, - // because eventually this widget will be embedded into the WebView itself. + m_dialog = gtk_event_box_new(); + + GtkWidget* frame = gtk_frame_new(0); + gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); + gtk_container_add(GTK_CONTAINER(m_dialog), frame); + createContentsInContainer(frame); + + gtk_style_context_add_class(m_styleContext.get(), GTK_STYLE_CLASS_BACKGROUND); + GtkWidgetPath* path = gtk_widget_path_new(); + gtk_widget_path_append_type(path, GTK_TYPE_WINDOW); + gtk_style_context_set_path(m_styleContext.get(), path); + gtk_widget_path_free(path); + + g_signal_connect(m_dialog, "draw", G_CALLBACK(drawSignal), m_styleContext.get()); } void WebKit2GtkAuthenticationDialog::authenticate(const WebCore::Credential& credential) diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.h b/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.h index 60c5e0588..67064622c 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.h @@ -17,22 +17,32 @@ * Boston, MA 02110-1301, USA. */ +#ifndef WebKit2GtkAuthenticationDialog_h +#define WebKit2GtkAuthenticationDialog_h + #include "AuthenticationChallengeProxy.h" #include "WKRetainPtr.h" +#include "WebKitWebViewBase.h" #include <WebCore/Credential.h> #include <WebCore/GtkAuthenticationDialog.h> +#include <wtf/gobject/GRefPtr.h> namespace WebKit { class WebKit2GtkAuthenticationDialog : public WebCore::GtkAuthenticationDialog { public: WebKit2GtkAuthenticationDialog(AuthenticationChallengeProxy*); + virtual ~WebKit2GtkAuthenticationDialog() { } + GtkWidget* widget() { return m_dialog; } protected: virtual void authenticate(const WebCore::Credential&); private: RefPtr<AuthenticationChallengeProxy> m_authenticationChallenge; + GRefPtr<GtkStyleContext> m_styleContext; }; } // namespace WebKit + +#endif // WebKit2GtkAuthenticationDialog_h diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp index be06eddf6..1eae26753 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp @@ -118,8 +118,7 @@ static void didChangeBackForwardList(WKPageRef page, WKBackForwardListItemRef ad static void didReceiveAuthenticationChallengeInFrame(WKPageRef page, WKFrameRef frame, WKAuthenticationChallengeRef authenticationChallenge, const void *clientInfo) { - WebKit2GtkAuthenticationDialog* dialog = new WebKit2GtkAuthenticationDialog(toImpl(authenticationChallenge)); - dialog->show(); + webkitWebViewHandleAuthenticationChallenge(WEBKIT_WEB_VIEW(clientInfo), toImpl(authenticationChallenge)); } void attachLoaderClientToView(WebKitWebView* webView) diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp index 6598b6602..fb0c5ed9a 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp @@ -1261,6 +1261,7 @@ static void webkitWebViewEmitLoadChanged(WebKitWebView* webView, WebKitLoadEvent if (loadEvent == WEBKIT_LOAD_STARTED) { webkitWebViewSetIsLoading(webView, true); webkitWebViewWatchForChangesInFavicon(webView); + webkitWebViewBaseCancelAuthenticationDialog(WEBKIT_WEB_VIEW_BASE(webView)); } else if (loadEvent == WEBKIT_LOAD_FINISHED) { webkitWebViewSetIsLoading(webView, false); webView->priv->waitingForMainResource = false; @@ -1609,6 +1610,13 @@ void webkitWebViewSubmitFormRequest(WebKitWebView* webView, WebKitFormSubmission g_signal_emit(webView, signals[SUBMIT_FORM], 0, request); } +void webkitWebViewHandleAuthenticationChallenge(WebKitWebView* webView, AuthenticationChallengeProxy* authenticationChallenge) +{ + WebKit2GtkAuthenticationDialog* dialog = new WebKit2GtkAuthenticationDialog(authenticationChallenge); + webkitWebViewBaseAddAuthenticationDialog(WEBKIT_WEB_VIEW_BASE(webView), dialog); + dialog->show(); +} + /** * webkit_web_view_new: * diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp index de741c2e3..c46deb27a 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp @@ -83,7 +83,7 @@ struct _WebKitWebViewBasePrivate { _WebKitWebViewBasePrivate() : imContext(adoptGRef(gtk_im_multicontext_new())) #if USE(TEXTURE_MAPPER_GL) - , redirectedWindow(RedirectedXCompositeWindow::create(IntSize(1, 1))) + , redirectedWindow(RedirectedXCompositeWindow::create(IntSize(1, 1), RedirectedXCompositeWindow::DoNotCreateGLContext)) #endif { } @@ -106,6 +106,7 @@ struct _WebKitWebViewBasePrivate { IntSize resizerSize; GRefPtr<AtkObject> accessible; bool needsResizeOnMap; + WebKit2GtkAuthenticationDialog* authenticationDialog; GtkWidget* inspectorView; unsigned inspectorViewHeight; GOwnPtr<GdkEvent> contextMenuEvent; @@ -272,16 +273,20 @@ static void webkitWebViewBaseRealize(GtkWidget* widget) webkitWebViewBaseSetToplevelOnScreenWindow(webView, GTK_WINDOW(toplevel)); } +static bool webkitWebViewChildIsInternalWidget(WebKitWebViewBase* webViewBase, GtkWidget* widget) +{ + WebKitWebViewBasePrivate* priv = webViewBase->priv; + return widget == priv->inspectorView || (priv->authenticationDialog && priv->authenticationDialog->widget() == widget); +} + static void webkitWebViewBaseContainerAdd(GtkContainer* container, GtkWidget* widget) { WebKitWebViewBase* webView = WEBKIT_WEB_VIEW_BASE(container); WebKitWebViewBasePrivate* priv = webView->priv; - if (WEBKIT_IS_WEB_VIEW_BASE(widget) - && WebInspectorProxy::isInspectorPage(WEBKIT_WEB_VIEW_BASE(widget)->priv->pageProxy.get())) { - ASSERT(!priv->inspectorView); - priv->inspectorView = widget; - } else { + // Internal widgets like the web inspector and authentication dialog have custom + // allocations so we don't need to add them to our list of children. + if (!webkitWebViewChildIsInternalWidget(webView, widget)) { GtkAllocation childAllocation; gtk_widget_get_allocation(widget, &childAllocation); priv->children.set(widget, childAllocation); @@ -290,6 +295,26 @@ static void webkitWebViewBaseContainerAdd(GtkContainer* container, GtkWidget* wi gtk_widget_set_parent(widget, GTK_WIDGET(container)); } +void webkitWebViewBaseAddAuthenticationDialog(WebKitWebViewBase* webViewBase, WebKit2GtkAuthenticationDialog* dialog) +{ + webViewBase->priv->authenticationDialog = dialog; + gtk_container_add(GTK_CONTAINER(webViewBase), dialog->widget()); + gtk_widget_queue_draw(GTK_WIDGET(webViewBase)); // We need to draw the shadow over the widget. +} + +void webkitWebViewBaseCancelAuthenticationDialog(WebKitWebViewBase* webViewBase) +{ + WebKitWebViewBasePrivate* priv = webViewBase->priv; + if (priv->authenticationDialog) + priv->authenticationDialog->destroy(); +} + +void webkitWebViewBaseAddWebInspector(WebKitWebViewBase* webViewBase, GtkWidget* inspector) +{ + webViewBase->priv->inspectorView = inspector; + gtk_container_add(GTK_CONTAINER(webViewBase), inspector); +} + static void webkitWebViewBaseContainerRemove(GtkContainer* container, GtkWidget* widget) { WebKitWebViewBase* webView = WEBKIT_WEB_VIEW_BASE(container); @@ -302,6 +327,8 @@ static void webkitWebViewBaseContainerRemove(GtkContainer* container, GtkWidget* if (priv->inspectorView == widget) { priv->inspectorView = 0; priv->inspectorViewHeight = 0; + } else if (priv->authenticationDialog && priv->authenticationDialog->widget() == widget) { + priv->authenticationDialog = 0; } else { ASSERT(priv->children.contains(widget)); priv->children.remove(widget); @@ -322,12 +349,14 @@ static void webkitWebViewBaseContainerForall(GtkContainer* container, gboolean i if (includeInternals && priv->inspectorView) (*callback)(priv->inspectorView, callbackData); + + if (includeInternals && priv->authenticationDialog) + (*callback)(priv->authenticationDialog->widget(), callbackData); } void webkitWebViewBaseChildMoveResize(WebKitWebViewBase* webView, GtkWidget* child, const IntRect& childRect) { const IntRect& geometry = webView->priv->children.get(child); - if (geometry == childRect) return; @@ -359,6 +388,8 @@ static void webkitWebViewBaseConstructed(GObject* object) if (priv->redirectedWindow) priv->redirectedWindow->setDamageNotifyCallback(redirectedWindowDamagedCallback, object); #endif + + priv->authenticationDialog = 0; } #if USE(TEXTURE_MAPPER_GL) @@ -400,6 +431,12 @@ static gboolean webkitWebViewBaseDraw(GtkWidget* widget, cairo_t* cr) WebCore::Region unpaintedRegion; // This is simply unused. drawingArea->paint(cr, clipRect, unpaintedRegion); + if (webViewBase->priv->authenticationDialog) { + cairo_set_operator(cr, CAIRO_OPERATOR_OVER); + cairo_set_source_rgba(cr, 0, 0, 0, 0.5); + cairo_paint(cr); + } + return FALSE; } @@ -434,6 +471,22 @@ static void resizeWebKitWebViewBaseFromAllocation(WebKitWebViewBase* webViewBase viewRect.setHeight(allocation->height - priv->inspectorViewHeight); } + // The authentication dialog is centered in the view rect, which means that it + // never overlaps the web inspector. Thus, we need to calculate the allocation here + // after calculating the inspector allocation. + if (priv->authenticationDialog) { + GtkRequisition naturalSize; + gtk_widget_get_preferred_size(priv->authenticationDialog->widget(), 0, &naturalSize); + + GtkAllocation childAllocation = { + (viewRect.width() - naturalSize.width) / 2, + (viewRect.height() - naturalSize.height) / 2, + naturalSize.width, + naturalSize.height + }; + gtk_widget_size_allocate(priv->authenticationDialog->widget(), &childAllocation); + } + #if USE(TEXTURE_MAPPER_GL) if (sizeChanged && webViewBase->priv->redirectedWindow) webViewBase->priv->redirectedWindow->resize(viewRect.size()); @@ -515,6 +568,9 @@ static gboolean webkitWebViewBaseKeyPressEvent(GtkWidget* widget, GdkEventKey* e WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget); WebKitWebViewBasePrivate* priv = webViewBase->priv; + if (priv->authenticationDialog) + return GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->key_press_event(widget, event); + #if ENABLE(FULLSCREEN_API) if (priv->fullScreenModeActive) { switch (event->keyval) { @@ -561,6 +617,10 @@ static gboolean webkitWebViewBaseButtonPressEvent(GtkWidget* widget, GdkEventBut { WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget); WebKitWebViewBasePrivate* priv = webViewBase->priv; + + if (priv->authenticationDialog) + return TRUE; + gtk_widget_grab_focus(widget); if (!priv->clickCounter.shouldProcessButtonEvent(buttonEvent)) @@ -579,6 +639,9 @@ static gboolean webkitWebViewBaseButtonReleaseEvent(GtkWidget* widget, GdkEventB WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget); WebKitWebViewBasePrivate* priv = webViewBase->priv; + if (priv->authenticationDialog) + return TRUE; + gtk_widget_grab_focus(widget); priv->pageProxy->handleMouseEvent(NativeWebMouseEvent(reinterpret_cast<GdkEvent*>(event), 0 /* currentClickCount */)); @@ -590,6 +653,9 @@ static gboolean webkitWebViewBaseScrollEvent(GtkWidget* widget, GdkEventScroll* WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget); WebKitWebViewBasePrivate* priv = webViewBase->priv; + if (priv->authenticationDialog) + return TRUE; + priv->pageProxy->handleWheelEvent(NativeWebWheelEvent(reinterpret_cast<GdkEvent*>(event))); return TRUE; @@ -600,6 +666,9 @@ static gboolean webkitWebViewBaseMotionNotifyEvent(GtkWidget* widget, GdkEventMo WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget); WebKitWebViewBasePrivate* priv = webViewBase->priv; + if (priv->authenticationDialog) + return TRUE; + priv->pageProxy->handleMouseEvent(NativeWebMouseEvent(reinterpret_cast<GdkEvent*>(event), 0 /* currentClickCount */)); return TRUE; @@ -737,7 +806,20 @@ static void webkitWebViewBaseParentSet(GtkWidget* widget, GtkWidget* oldParent) { if (!gtk_widget_get_parent(widget)) webkitWebViewBaseSetToplevelOnScreenWindow(WEBKIT_WEB_VIEW_BASE(widget), 0); +} + +static gboolean webkitWebViewBaseFocus(GtkWidget* widget, GtkDirectionType direction) +{ + // If the authentication dialog is active, we need to forward focus events there. This + // ensures that you can tab between elements in the box. + WebKitWebViewBasePrivate* priv = WEBKIT_WEB_VIEW_BASE(widget)->priv; + if (priv->authenticationDialog) { + gboolean returnValue; + g_signal_emit_by_name(priv->authenticationDialog->widget(), "focus", direction, &returnValue); + return returnValue; + } + return GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->focus(widget, direction); } static void webkit_web_view_base_class_init(WebKitWebViewBaseClass* webkitWebViewBaseClass) @@ -748,6 +830,7 @@ static void webkit_web_view_base_class_init(WebKitWebViewBaseClass* webkitWebVie widgetClass->size_allocate = webkitWebViewBaseSizeAllocate; widgetClass->map = webkitWebViewBaseMap; widgetClass->unmap = webkitWebViewBaseUnmap; + widgetClass->focus = webkitWebViewBaseFocus; widgetClass->focus_in_event = webkitWebViewBaseFocusInEvent; widgetClass->focus_out_event = webkitWebViewBaseFocusOutEvent; widgetClass->key_press_event = webkitWebViewBaseKeyPressEvent; diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h index ef05f2289..2bd0bc002 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h @@ -29,6 +29,7 @@ #define WebKitWebViewBasePrivate_h #include "WebContextMenuProxyGtk.h" +#include "WebKit2GtkAuthenticationDialog.h" #include "WebKitPrivate.h" #include "WebKitWebViewBase.h" #include "WebPageProxy.h" @@ -64,4 +65,8 @@ typedef void (*WebKitWebViewBaseDownloadRequestHandler) (WebKitWebViewBase*, Web void webkitWebViewBaseSetDownloadRequestHandler(WebKitWebViewBase*, WebKitWebViewBaseDownloadRequestHandler); void webkitWebViewBaseHandleDownloadRequest(WebKitWebViewBase*, WebKit::DownloadProxy*); +void webkitWebViewBaseAddAuthenticationDialog(WebKitWebViewBase*, WebKit::WebKit2GtkAuthenticationDialog*); +void webkitWebViewBaseCancelAuthenticationDialog(WebKitWebViewBase*); +void webkitWebViewBaseAddWebInspector(WebKitWebViewBase*, GtkWidget* inspector); + #endif // WebKitWebViewBasePrivate_h diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h index 2e1fed30e..66da58476 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h @@ -55,5 +55,6 @@ bool webkitWebViewEnterFullScreen(WebKitWebView*); bool webkitWebViewLeaveFullScreen(WebKitWebView*); void webkitWebViewPopulateContextMenu(WebKitWebView*, WebKit::ImmutableArray* proposedMenu, WebKit::WebHitTestResult*); void webkitWebViewSubmitFormRequest(WebKitWebView*, WebKitFormSubmissionRequest*); +void webkitWebViewHandleAuthenticationChallenge(WebKitWebView*, WebKit::AuthenticationChallengeProxy*); #endif // WebKitWebViewPrivate_h diff --git a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h index 8768fd067..66b23e47c 100644 --- a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h +++ b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h @@ -139,6 +139,7 @@ private: virtual void recommendedScrollbarStyleDidChange(int32_t newStyle); virtual WKView* wkView() const { return m_wkView; } + virtual void intrinsicContentSizeDidChange(const WebCore::IntSize& intrinsicContentSize) OVERRIDE; #if USE(DICTATION_ALTERNATIVES) virtual uint64_t addDictationAlternatives(const RetainPtr<NSTextAlternatives>&); diff --git a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm index 9ed7feea1..0172cb077 100644 --- a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm +++ b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm @@ -558,6 +558,11 @@ void PageClientImpl::recommendedScrollbarStyleDidChange(int32_t newStyle) #endif } +void PageClientImpl::intrinsicContentSizeDidChange(const IntSize& intrinsicContentSize) +{ + [m_wkView _setIntrinsicContentSize:intrinsicContentSize]; +} + bool PageClientImpl::executeSavedCommandBySelector(const String& selectorString) { return [m_wkView _executeSavedCommandBySelector:NSSelectorFromString(selectorString)]; diff --git a/Source/WebKit2/UIProcess/API/mac/WKView.mm b/Source/WebKit2/UIProcess/API/mac/WKView.mm index 4e30b3368..b1470fea9 100644 --- a/Source/WebKit2/UIProcess/API/mac/WKView.mm +++ b/Source/WebKit2/UIProcess/API/mac/WKView.mm @@ -215,6 +215,8 @@ struct WKViewInterpretKeyEventsParameters { RefPtr<WebCore::Image> _promisedImage; String _promisedFilename; String _promisedURL; + + NSSize _intrinsicContentSize; } @end @@ -356,6 +358,11 @@ struct WKViewInterpretKeyEventsParameters { return YES; } +- (NSSize)intrinsicContentSize +{ + return _data->_intrinsicContentSize; +} + - (void)setFrameSize:(NSSize)size { if (!NSEqualSizes(size, [self frame].size)) @@ -2925,6 +2932,12 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) return ![sink.get() didReceiveUnhandledCommand]; } +- (void)_setIntrinsicContentSize:(NSSize)intrinsicContentSize +{ + _data->_intrinsicContentSize = intrinsicContentSize; + [self invalidateIntrinsicContentSize]; +} + - (void)_cacheWindowBottomCornerRect { #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 @@ -3021,6 +3034,8 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) _data->_mouseDownEvent = nil; _data->_ignoringMouseDraggedEvents = NO; + _data->_intrinsicContentSize = NSMakeSize(NSViewNoInstrinsicMetric, NSViewNoInstrinsicMetric); + [self _registerDraggedTypes]; if ([self _shouldUseTiledDrawingArea]) { @@ -3126,6 +3141,16 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) #endif } +- (CGFloat)minimumLayoutWidth +{ + return _data->_page->minimumLayoutWidth(); +} + +- (void)setMinimumLayoutWidth:(CGFloat)minimumLayoutWidth +{ + _data->_page->setMinimumLayoutWidth(minimumLayoutWidth); +} + @end @implementation WKResponderChainSink diff --git a/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h b/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h index 3f612d240..9b02947a3 100644 --- a/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h +++ b/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h @@ -61,6 +61,7 @@ namespace WebKit { - (BOOL)_interpretKeyEvent:(NSEvent *)theEvent savingCommandsTo:(Vector<WebCore::KeypressCommand>&)commands; - (void)_doneWithKeyEvent:(NSEvent *)event eventWasHandled:(BOOL)eventWasHandled; - (bool)_executeSavedCommandBySelector:(SEL)selector; +- (void)_setIntrinsicContentSize:(NSSize)intrinsicContentSize; - (NSRect)_convertToDeviceSpace:(NSRect)rect; - (NSRect)_convertToUserSpace:(NSRect)rect; - (void)_setFindIndicator:(PassRefPtr<WebKit::FindIndicator>)findIndicator fadeOut:(BOOL)fadeOut animate:(BOOL)animate; diff --git a/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h b/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h index 51578764f..2161eb786 100644 --- a/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h +++ b/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h @@ -50,4 +50,6 @@ - (void)performDictionaryLookupAtCurrentMouseLocation; + (void)hideWordDefinitionWindow; +@property (readwrite) CGFloat minimumLayoutWidth; + @end diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp index a45636a79..e83e13379 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp @@ -319,6 +319,7 @@ void QQuickWebViewPrivate::initialize(WKContextRef contextRef, WKPageGroupRef pa webPageProxy->pageGroup()->preferences()->setAcceleratedCompositingEnabled(true); webPageProxy->pageGroup()->preferences()->setForceCompositingMode(true); webPageProxy->pageGroup()->preferences()->setFrameFlatteningEnabled(true); + webPageProxy->pageGroup()->preferences()->setWebGLEnabled(true); pageClient.initialize(q_ptr, pageViewPrivate->eventHandler.data(), &undoController); webPageProxy->initializeWebPage(); diff --git a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp index f5f0bd3f9..3f9c3b2ae 100644 --- a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp +++ b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp @@ -130,6 +130,11 @@ void QRawWebViewPrivate::updateTextInputState() notImplemented(); } +void QRawWebViewPrivate::handleWillSetInputMethodState() +{ + notImplemented(); +} + #if ENABLE(GESTURE_EVENTS) void QRawWebViewPrivate::doneWithGestureEvent(const WebKit::WebGestureEvent& event, bool wasEventHandled) { diff --git a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p_p.h b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p_p.h index 545096d02..7bc6f1162 100644 --- a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p_p.h +++ b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p_p.h @@ -71,6 +71,7 @@ public: #endif // USE(ACCELERATED_COMPOSITING) virtual void updateTextInputState(); + virtual void handleWillSetInputMethodState(); #if ENABLE(GESTURE_EVENTS) virtual void doneWithGestureEvent(const WebKit::WebGestureEvent& event, bool wasEventHandled); #endif diff --git a/Source/WebKit2/UIProcess/API/qt/tests/inspectorserver/inspectorserver.pro b/Source/WebKit2/UIProcess/API/qt/tests/inspectorserver/inspectorserver.pro index bc5307f2d..4a8d86f80 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/inspectorserver/inspectorserver.pro +++ b/Source/WebKit2/UIProcess/API/qt/tests/inspectorserver/inspectorserver.pro @@ -1,4 +1,4 @@ include(../tests.pri) SOURCES += $${TARGET}.cpp -QT += webkitwidgets-private +QT += webkit-private DEFINES += IMPORT_DIR=\"\\\"$${ROOT_BUILD_DIR}$${QMAKE_DIR_SEP}imports\\\"\" diff --git a/Source/WebKit2/UIProcess/API/qt/tests/publicapi/publicapi.pro b/Source/WebKit2/UIProcess/API/qt/tests/publicapi/publicapi.pro index ba8f4cea3..02dc197c7 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/publicapi/publicapi.pro +++ b/Source/WebKit2/UIProcess/API/qt/tests/publicapi/publicapi.pro @@ -1,3 +1,3 @@ include(../tests.pri) SOURCES += $${TARGET}.cpp -QT += webkitwidgets-private +QT += webkit-private diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro index 7c72fd2f1..3fd3d4583 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro @@ -3,7 +3,7 @@ SOURCES += tst_qmltests.cpp TARGET = tst_qmltests_DesktopBehavior OBJECTS_DIR = obj_DesktopBehavior/$$activeBuildConfig() -QT += webkitwidgets-private +QT += webkit-private CONFIG += warn_on testcase QT += qmltest diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro index 3e217b369..b340235e4 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro @@ -3,7 +3,7 @@ SOURCES += tst_qmltests.cpp TARGET = tst_qmltests_WebView OBJECTS_DIR = obj_WebView/$$activeBuildConfig() -QT += webkitwidgets-private +QT += webkit-private CONFIG += warn_on testcase QT += qmltest diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_resize.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_resize.qml new file mode 100644 index 000000000..5f6c63b57 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_resize.qml @@ -0,0 +1,175 @@ +import QtQuick 2.0 +import QtTest 1.0 +import QtWebKit 3.0 +import QtWebKit.experimental 1.0 +import Test 1.0 +import "../common" + +Item { + TestWebView { + id: webView + width: 320 + height: 480 + + property variant result + + property variant content: "data:text/html," + + "<head>" + + " <meta name='viewport' content='width=device-width'>" + + "</head>" + + "<body>" + + " <div id='target' style='width: 240px; height: 360px;'>" + + " </div>" + + "</body>" + + signal resultReceived + } + + SignalSpy { + id: resultSpy + target: webView + signalName: "resultReceived" + } + + SignalSpy { + id: scaleSpy + target: webView.experimental.test + signalName: "contentsScaleCommitted" + } + + SignalSpy { + id: sizeSpy + target: webView.experimental.test + signalName: "contentsSizeChanged" + } + + TestCase { + name: "Resize" + when: windowShown + + property variant test: webView.experimental.test + + function init() { + resultSpy.clear() + scaleSpy.clear() + viewportSpy.clear() + } + + function run(signalSpy, script) { + signalSpy.clear(); + var result; + webView.experimental.evaluateJavaScript( + script, + function(value) { webView.resultReceived(); result = value }); + signalSpy.wait(); + return result; + } + + function contentsSize() { + return test.contentsSize.width + "x" + test.contentsSize.height; + } + + function elementRect(id) { + return JSON.parse(run(resultSpy, "JSON.stringify(document.getElementById('" + id + "').getBoundingClientRect());")) + } + + function doubleTapAtPoint(x, y) { + scaleSpy.clear() + test.touchDoubleTap(webView, x, y) + scaleSpy.wait() + } + + function resize(w, h) { + sizeSpy.clear() + webView.width = w + sizeSpy.wait() + webView.height = h + sizeSpy.wait() + } + + function test_basic() { + webView.url = webView.content + verify(webView.waitForViewportReady()) + + compare(contentsSize(), "320x480") + compare(test.contentsScale, 1.0) + + resize(480, 720) + compare(contentsSize(), "480x720") + compare(test.contentsScale, 1.0) + + resize(320, 480) + compare(contentsSize(), "320x480") + compare(test.contentsScale, 1.0) + + } + + function test_resizeAfterNeutralZoom() { + webView.url = webView.content + verify(webView.waitForViewportReady()) + + compare(contentsSize(), "320x480") + compare(test.contentsScale, 1.0) + + var target = elementRect("target"); + var targetScale = webView.width / (target.width + 2 * 10) // inflated by 10px + + // Zoom in and out. + doubleTapAtPoint(100, 50) + + compare(test.contentsScale, targetScale) + + doubleTapAtPoint(100, 50) + + compare(test.contentsScale, 1.0) + + // Now check resizing still works as expected. + resize(480, 720) + compare(contentsSize(), "480x720") + compare(test.contentsScale, 1.0) + + resize(320, 480) + compare(contentsSize(), "320x480") + compare(test.contentsScale, 1.0) + } + + function test_resizeZoomedIn() { + // Note that if we change the behavior of resize on zoomed-in content, for instance + // to preserve the visible width (like rotate), this test will need to be updated. + webView.url = webView.content + verify(webView.waitForViewportReady()) + + compare(contentsSize(), "320x480") + compare(test.contentsScale, 1.0) + + var target = elementRect("target"); + var targetScale = webView.width / (target.width + 2 * 10) // inflated by 10px + + // Double tap to zoom in. + doubleTapAtPoint(100, 50) + + compare(test.contentsScale, targetScale) + + // Resize just a small bit, not changing scale. + resize(288, 432) + compare(contentsSize(), "288x432") + compare(test.contentsScale, targetScale) + + // And double tap to reset zoom. + target = elementRect("target"); + targetScale = webView.width / (target.width + 2 * 10) + doubleTapAtPoint(100, 50) + compare(test.contentsScale, targetScale) + + // Double tap again to zoom out. + doubleTapAtPoint(100, 50) + compare(contentsSize(), "288x432") + compare(test.contentsScale, 1.0) + + // And reset + resize(320, 480) + compare(contentsSize(), "320x480") + compare(test.contentsScale, 1.0) + } + } +} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/qquickwebview.pro b/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/qquickwebview.pro index bc5307f2d..4a8d86f80 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/qquickwebview.pro +++ b/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/qquickwebview.pro @@ -1,4 +1,4 @@ include(../tests.pri) SOURCES += $${TARGET}.cpp -QT += webkitwidgets-private +QT += webkit-private DEFINES += IMPORT_DIR=\"\\\"$${ROOT_BUILD_DIR}$${QMAKE_DIR_SEP}imports\\\"\" diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/qrawwebview.pro b/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/qrawwebview.pro index ba8f4cea3..02dc197c7 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/qrawwebview.pro +++ b/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/qrawwebview.pro @@ -1,3 +1,3 @@ include(../tests.pri) SOURCES += $${TARGET}.cpp -QT += webkitwidgets-private +QT += webkit-private diff --git a/Source/WebKit2/UIProcess/API/qt/tests/tests.pri b/Source/WebKit2/UIProcess/API/qt/tests/tests.pri index 123b25ce2..a1133530d 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/tests.pri +++ b/Source/WebKit2/UIProcess/API/qt/tests/tests.pri @@ -6,7 +6,7 @@ TARGET = tst_$$TARGET INCLUDEPATH += $$PWD SOURCES += ../util.cpp -QT += testlib webkitwidgets +QT += testlib webkit have?(QTQUICK) { QT += qml quick quick-private HEADERS += ../bytearraytestdata.h \ diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp index 7fae9a011..71c4bcbd6 100644 --- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp +++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp @@ -216,8 +216,8 @@ void LayerTreeRenderer::adjustPositionForFixedLayers() FloatPoint renderedScrollPosition = boundedScrollPosition(m_renderedContentsScrollPosition, m_visibleContentsRect, m_contentsSize); FloatSize delta = scrollPosition - renderedScrollPosition; - LayerMap::iterator end = m_fixedLayers.end(); - for (LayerMap::iterator it = m_fixedLayers.begin(); it != end; ++it) + LayerRawPtrMap::iterator end = m_fixedLayers.end(); + for (LayerRawPtrMap::iterator it = m_fixedLayers.begin(); it != end; ++it) toTextureMapperLayer(it->value)->setScrollPositionDeltaIfNeeded(delta); } @@ -266,17 +266,16 @@ void LayerTreeRenderer::destroyCanvas(WebLayerID id) void LayerTreeRenderer::setLayerChildren(WebLayerID id, const Vector<WebLayerID>& childIDs) { - ensureLayer(id); - LayerMap::iterator it = m_layers.find(id); - GraphicsLayer* layer = it->value; + GraphicsLayer* layer = ensureLayer(id); Vector<GraphicsLayer*> children; for (size_t i = 0; i < childIDs.size(); ++i) { WebLayerID childID = childIDs[i]; GraphicsLayer* child = layerByID(childID); if (!child) { - child = createLayer(childID).leakPtr(); - m_layers.add(childID, child); + OwnPtr<GraphicsLayer*> newChild = createLayer(childID); + child = newChild.get(); + m_layers.add(childID, newChild.release()); } children.append(child); } @@ -286,11 +285,8 @@ void LayerTreeRenderer::setLayerChildren(WebLayerID id, const Vector<WebLayerID> #if ENABLE(CSS_FILTERS) void LayerTreeRenderer::setLayerFilters(WebLayerID id, const FilterOperations& filters) { - ensureLayer(id); - LayerMap::iterator it = m_layers.find(id); - ASSERT(it != m_layers.end()); + GraphicsLayer* layer = ensureLayer(id); - GraphicsLayer* layer = it->value; #if ENABLE(CSS_SHADERS) injectCachedCustomFilterPrograms(filters); #endif @@ -332,11 +328,7 @@ void LayerTreeRenderer::removeCustomFilterProgram(int id) void LayerTreeRenderer::setLayerState(WebLayerID id, const WebLayerInfo& layerInfo) { - ensureLayer(id); - LayerMap::iterator it = m_layers.find(id); - ASSERT(it != m_layers.end()); - - GraphicsLayer* layer = it->value; + GraphicsLayer* layer = ensureLayer(id); layer->setReplicatedByLayer(layerByID(layerInfo.replica)); layer->setMaskLayer(layerByID(layerInfo.mask)); @@ -371,26 +363,29 @@ void LayerTreeRenderer::setLayerState(WebLayerID id, const WebLayerInfo& layerIn void LayerTreeRenderer::deleteLayer(WebLayerID layerID) { - GraphicsLayer* layer = layerByID(layerID); + OwnPtr<GraphicsLayer> layer = m_layers.take(layerID); if (!layer) return; layer->removeFromParent(); - m_layers.remove(layerID); m_fixedLayers.remove(layerID); #if USE(GRAPHICS_SURFACE) m_surfaceBackingStores.remove(layerID); #endif - delete layer; } -void LayerTreeRenderer::ensureLayer(WebLayerID id) +WebCore::GraphicsLayer* LayerTreeRenderer::ensureLayer(WebLayerID id) { - // We have to leak the new layer's pointer and manage it ourselves, - // because OwnPtr is not copyable. - if (m_layers.find(id) == m_layers.end()) - m_layers.add(id, createLayer(id).leakPtr()); + LayerMap::iterator it = m_layers.find(id); + if (it != m_layers.end()) + return it->value.get(); + + OwnPtr<WebCore::GraphicsLayer> newLayer = createLayer(id); + WebCore::GraphicsLayer* layer = newLayer.get(); + m_layers.add(id, newLayer.release()); + + return layer; } void LayerTreeRenderer::setRootLayerID(WebLayerID layerID) diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h index 6f1056aac..946ac6d49 100644 --- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h +++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h @@ -142,7 +142,7 @@ private: void assignImageBackingToLayer(WebCore::GraphicsLayer*, CoordinatedImageBackingID); void removeReleasedImageBackingsIfNeeded(); void ensureRootLayer(); - void ensureLayer(WebLayerID); + WebCore::GraphicsLayer* ensureLayer(WebLayerID); void commitPendingBackingStoreOperations(); CoordinatedBackingStore* getBackingStore(WebCore::GraphicsLayer*); @@ -151,7 +151,6 @@ private: void removeBackingStoreIfNeeded(WebCore::GraphicsLayer*); void resetBackingStoreSizeToLayerSize(WebCore::GraphicsLayer*); - typedef HashMap<WebLayerID, WebCore::GraphicsLayer*> LayerMap; WebCore::FloatSize m_contentsSize; WebCore::FloatRect m_visibleContentsRect; @@ -181,8 +180,10 @@ private: OwnPtr<WebCore::GraphicsLayer> m_rootLayer; + typedef HashMap<WebLayerID, OwnPtr<WebCore::GraphicsLayer> > LayerMap; LayerMap m_layers; - LayerMap m_fixedLayers; + typedef HashMap<WebLayerID, WebCore::GraphicsLayer*> LayerRawPtrMap; + LayerRawPtrMap m_fixedLayers; WebLayerID m_rootLayerID; WebCore::IntPoint m_renderedContentsScrollPosition; WebCore::IntPoint m_pendingRenderedContentsScrollPosition; diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxy.h b/Source/WebKit2/UIProcess/DrawingAreaProxy.h index 74a87a455..c4ed068b4 100644 --- a/Source/WebKit2/UIProcess/DrawingAreaProxy.h +++ b/Source/WebKit2/UIProcess/DrawingAreaProxy.h @@ -81,6 +81,7 @@ public: virtual void waitForPossibleGeometryUpdate() { } virtual void colorSpaceDidChange() { } + virtual void minimumLayoutWidthDidChange() { } #if USE(COORDINATED_GRAPHICS) virtual void updateViewport(); @@ -118,7 +119,8 @@ private: virtual void updateAcceleratedCompositingMode(uint64_t /* backingStoreStateID */, const LayerTreeContext&) { } #endif #if PLATFORM(MAC) - virtual void didUpdateGeometry() { } + virtual void didUpdateGeometry(const WebCore::IntSize& newIntrinsicContentSize) { } + virtual void intrinsicContentSizeDidChange(const WebCore::IntSize& newIntrinsicContentSize) { } #endif }; diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in b/Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in index 7dbdcebab..b3f02afec 100644 --- a/Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in +++ b/Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in @@ -31,6 +31,7 @@ messages -> DrawingAreaProxy { #if PLATFORM(MAC) // Used by TiledCoreAnimationDrawingAreaProxy. - DidUpdateGeometry() + DidUpdateGeometry(WebCore::IntSize newIntrinsicContentSize) + IntrinsicContentSizeDidChange(WebCore::IntSize newIntrinsicContentSize) #endif } diff --git a/Source/WebKit2/UIProcess/PageClient.h b/Source/WebKit2/UIProcess/PageClient.h index dd0cd5a1c..56dc9a141 100644 --- a/Source/WebKit2/UIProcess/PageClient.h +++ b/Source/WebKit2/UIProcess/PageClient.h @@ -127,6 +127,7 @@ public: virtual void handleAuthenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password) = 0; virtual void handleCertificateVerificationRequest(const String& hostname, bool& ignoreErrors) = 0; virtual void handleProxyAuthenticationRequiredRequest(const String& hostname, uint16_t port, const String& prefilledUsername, String& username, String& password) = 0; + virtual void handleWillSetInputMethodState() = 0; #endif // PLATFORM(QT). #if PLATFORM(QT) || PLATFORM(EFL) @@ -224,6 +225,7 @@ public: #if USE(APPKIT) virtual WKView* wkView() const = 0; + virtual void intrinsicContentSizeDidChange(const WebCore::IntSize& intrinsicContentSize) = 0; #if USE(DICTATION_ALTERNATIVES) virtual uint64_t addDictationAlternatives(const RetainPtr<NSTextAlternatives>&) = 0; virtual void removeDictationAlternatives(uint64_t dictationContext) = 0; diff --git a/Source/WebKit2/UIProcess/PageViewportController.cpp b/Source/WebKit2/UIProcess/PageViewportController.cpp index ff135a2cf..e56869f23 100644 --- a/Source/WebKit2/UIProcess/PageViewportController.cpp +++ b/Source/WebKit2/UIProcess/PageViewportController.cpp @@ -111,7 +111,7 @@ void PageViewportController::didChangeContentsSize(const IntSize& newSize) { m_contentsSize = newSize; - bool minimumScaleUpdated = updateMinimumScaleToFit(); + bool minimumScaleUpdated = updateMinimumScaleToFit(false); if (m_initiallyFitToViewport) { // Restrict scale factors to m_minimumScaleToFit. @@ -209,7 +209,7 @@ void PageViewportController::didChangeContentsVisibility(const FloatPoint& viewp void PageViewportController::syncVisibleContents(const FloatPoint& trajectoryVector) { - DrawingAreaProxy* const drawingArea = m_webPageProxy->drawingArea(); + DrawingAreaProxy* drawingArea = m_webPageProxy->drawingArea(); if (!drawingArea || m_viewportSize.isEmpty() || m_contentsSize.isEmpty()) return; @@ -232,10 +232,8 @@ void PageViewportController::didChangeViewportAttributes(const WebCore::Viewport if (!m_initiallyFitToViewport) WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(m_rawAttributes); - if (updateMinimumScaleToFit()) + if (updateMinimumScaleToFit(true)) m_client->didChangeViewportAttributes(); - - syncVisibleContents(); } WebCore::FloatSize PageViewportController::viewportSizeInContentsCoordinates() const @@ -277,11 +275,13 @@ void PageViewportController::applyPositionAfterRenderingContents(const FloatPoin syncVisibleContents(); } -bool PageViewportController::updateMinimumScaleToFit() +bool PageViewportController::updateMinimumScaleToFit(bool userInitiatedUpdate) { if (m_viewportSize.isEmpty() || m_contentsSize.isEmpty()) return false; + bool currentlyScaledToFit = fuzzyCompare(m_effectiveScale, toViewportScale(m_minimumScaleToFit), 0.001); + float minimumScale = WebCore::computeMinimumScaleFactorForContentContained(m_rawAttributes, WebCore::roundedIntSize(m_viewportSize), WebCore::roundedIntSize(m_contentsSize), devicePixelRatio()); if (minimumScale <= 0) @@ -290,8 +290,16 @@ bool PageViewportController::updateMinimumScaleToFit() if (!fuzzyCompare(minimumScale, m_minimumScaleToFit, 0.001)) { m_minimumScaleToFit = minimumScale; - if (!m_hadUserInteraction && !hasSuspendedContent()) - applyScaleAfterRenderingContents(toViewportScale(minimumScale)); + if (!hasSuspendedContent()) { + if (!m_hadUserInteraction || (userInitiatedUpdate && currentlyScaledToFit)) + applyScaleAfterRenderingContents(toViewportScale(m_minimumScaleToFit)); + else { + // Ensure the effective scale stays within bounds. + float boundedScale = innerBoundedViewportScale(m_effectiveScale); + if (!fuzzyCompare(boundedScale, m_effectiveScale, 0.001)) + applyScaleAfterRenderingContents(boundedScale); + } + } return true; } diff --git a/Source/WebKit2/UIProcess/PageViewportController.h b/Source/WebKit2/UIProcess/PageViewportController.h index 052e89ab0..029228dde 100644 --- a/Source/WebKit2/UIProcess/PageViewportController.h +++ b/Source/WebKit2/UIProcess/PageViewportController.h @@ -84,7 +84,7 @@ private: void syncVisibleContents(const WebCore::FloatPoint &trajectoryVector = WebCore::FloatPoint::zero()); void applyScaleAfterRenderingContents(float scale); void applyPositionAfterRenderingContents(const WebCore::FloatPoint& pos); - bool updateMinimumScaleToFit(); + bool updateMinimumScaleToFit(bool userInitiatedUpdate); WebCore::FloatSize viewportSizeInContentsCoordinates() const; WebPageProxy* const m_webPageProxy; diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp b/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp index f497895db..834c87fc4 100644 --- a/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp +++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp @@ -45,12 +45,12 @@ PluginProcessManager::PluginProcessManager() { } -void PluginProcessManager::getPluginProcessConnection(const PluginInfoStore& pluginInfoStore, const String& pluginPath, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply> reply) +void PluginProcessManager::getPluginProcessConnection(const PluginInfoStore& pluginInfoStore, const String& pluginPath, PluginProcess::Type processType, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply> reply) { ASSERT(!pluginPath.isNull()); PluginModuleInfo plugin = pluginInfoStore.infoForPluginWithPath(pluginPath); - PluginProcessProxy* pluginProcess = getOrCreatePluginProcess(plugin); + PluginProcessProxy* pluginProcess = getOrCreatePluginProcess(plugin, processType); pluginProcess->getPluginProcessConnection(reply); } @@ -64,32 +64,33 @@ void PluginProcessManager::removePluginProcessProxy(PluginProcessProxy* pluginPr void PluginProcessManager::getSitesWithData(const PluginModuleInfo& plugin, WebPluginSiteDataManager* webPluginSiteDataManager, uint64_t callbackID) { - PluginProcessProxy* pluginProcess = getOrCreatePluginProcess(plugin); + PluginProcessProxy* pluginProcess = getOrCreatePluginProcess(plugin, PluginProcess::TypeRegularProcess); pluginProcess->getSitesWithData(webPluginSiteDataManager, callbackID); } void PluginProcessManager::clearSiteData(const PluginModuleInfo& plugin, WebPluginSiteDataManager* webPluginSiteDataManager, const Vector<String>& sites, uint64_t flags, uint64_t maxAgeInSeconds, uint64_t callbackID) { - PluginProcessProxy* pluginProcess = getOrCreatePluginProcess(plugin); + PluginProcessProxy* pluginProcess = getOrCreatePluginProcess(plugin, PluginProcess::TypeRegularProcess); pluginProcess->clearSiteData(webPluginSiteDataManager, sites, flags, maxAgeInSeconds, callbackID); } -PluginProcessProxy* PluginProcessManager::pluginProcessWithPath(const String& pluginPath) +PluginProcessProxy* PluginProcessManager::pluginProcessWithPath(const String& pluginPath, PluginProcess::Type processType) { for (size_t i = 0; i < m_pluginProcesses.size(); ++i) { - if (m_pluginProcesses[i]->pluginInfo().path == pluginPath) - return m_pluginProcesses[i].get(); + RefPtr<PluginProcessProxy>& pluginProcessProxy = m_pluginProcesses[i]; + if (pluginProcessProxy->pluginInfo().path == pluginPath && pluginProcessProxy->processType() == processType) + return pluginProcessProxy.get(); } return 0; } -PluginProcessProxy* PluginProcessManager::getOrCreatePluginProcess(const PluginModuleInfo& plugin) +PluginProcessProxy* PluginProcessManager::getOrCreatePluginProcess(const PluginModuleInfo& plugin, PluginProcess::Type processType) { - if (PluginProcessProxy* pluginProcess = pluginProcessWithPath(plugin.path)) + if (PluginProcessProxy* pluginProcess = pluginProcessWithPath(plugin.path, processType)) return pluginProcess; - RefPtr<PluginProcessProxy> pluginProcess = PluginProcessProxy::create(this, plugin); + RefPtr<PluginProcessProxy> pluginProcess = PluginProcessProxy::create(this, plugin, processType); PluginProcessProxy* pluginProcessPtr = pluginProcess.get(); m_pluginProcesses.append(pluginProcess.release()); diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h b/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h index 5e519427b..f84521a49 100644 --- a/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h +++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h @@ -29,6 +29,7 @@ #if ENABLE(PLUGIN_PROCESS) #include "PluginModuleInfo.h" +#include "PluginProcess.h" #include "WebProcessProxyMessages.h" #include <wtf/Forward.h> #include <wtf/Noncopyable.h> @@ -50,7 +51,7 @@ class PluginProcessManager { public: static PluginProcessManager& shared(); - void getPluginProcessConnection(const PluginInfoStore&, const String& pluginPath, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply>); + void getPluginProcessConnection(const PluginInfoStore&, const String& pluginPath, PluginProcess::Type, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply>); void removePluginProcessProxy(PluginProcessProxy*); void getSitesWithData(const PluginModuleInfo&, WebPluginSiteDataManager*, uint64_t callbackID); @@ -63,8 +64,8 @@ public: private: PluginProcessManager(); - PluginProcessProxy* getOrCreatePluginProcess(const PluginModuleInfo&); - PluginProcessProxy* pluginProcessWithPath(const String& pluginPath); + PluginProcessProxy* getOrCreatePluginProcess(const PluginModuleInfo&, PluginProcess::Type); + PluginProcessProxy* pluginProcessWithPath(const String& pluginPath, PluginProcess::Type); Vector<RefPtr<PluginProcessProxy> > m_pluginProcesses; }; diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp index 0c2e8689e..5a49f9598 100644 --- a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp +++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp @@ -50,12 +50,12 @@ namespace WebKit { static const double minimumLifetime = 30 * 60; static const double shutdownTimeout = 10 * 60; -PassRefPtr<PluginProcessProxy> PluginProcessProxy::create(PluginProcessManager* PluginProcessManager, const PluginModuleInfo& pluginInfo) +PassRefPtr<PluginProcessProxy> PluginProcessProxy::create(PluginProcessManager* PluginProcessManager, const PluginModuleInfo& pluginInfo, PluginProcess::Type processType) { - return adoptRef(new PluginProcessProxy(PluginProcessManager, pluginInfo)); + return adoptRef(new PluginProcessProxy(PluginProcessManager, pluginInfo, processType)); } -PluginProcessProxy::PluginProcessProxy(PluginProcessManager* PluginProcessManager, const PluginModuleInfo& pluginInfo) +PluginProcessProxy::PluginProcessProxy(PluginProcessManager* PluginProcessManager, const PluginModuleInfo& pluginInfo, PluginProcess::Type processType) : m_pluginProcessManager(PluginProcessManager) , m_pluginInfo(pluginInfo) , m_numPendingConnectionRequests(0) @@ -64,6 +64,7 @@ PluginProcessProxy::PluginProcessProxy(PluginProcessManager* PluginProcessManage , m_fullscreenWindowIsShowing(false) , m_preFullscreenAppPresentationOptions(0) #endif + , m_processType(processType) { ProcessLauncher::LaunchOptions launchOptions; launchOptions.processType = ProcessLauncher::PluginProcess; @@ -173,7 +174,7 @@ void PluginProcessProxy::didClose(CoreIPC::Connection*) const Vector<WebContext*>& contexts = WebContext::allContexts(); for (size_t i = 0; i < contexts.size(); ++i) - contexts[i]->sendToAllProcesses(Messages::WebProcess::PluginProcessCrashed(m_pluginInfo.path)); + contexts[i]->sendToAllProcesses(Messages::WebProcess::PluginProcessCrashed(m_pluginInfo.path, m_processType)); // This will cause us to be deleted. pluginProcessCrashedOrFailedToLaunch(); @@ -204,6 +205,7 @@ void PluginProcessProxy::didFinishLaunching(ProcessLauncher*, CoreIPC::Connectio PluginProcessCreationParameters parameters; parameters.pluginPath = m_pluginInfo.path; + parameters.processType = m_processType; parameters.minimumLifetime = minimumLifetime; parameters.terminationTimeout = shutdownTimeout; diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h index 1357e6c7f..194d7a373 100644 --- a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h +++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h @@ -30,6 +30,7 @@ #include "Connection.h" #include "PluginModuleInfo.h" +#include "PluginProcess.h" #include "ProcessLauncher.h" #include "WebProcessProxyMessages.h" #include <wtf/Deque.h> @@ -62,7 +63,7 @@ struct RawPluginMetaData { class PluginProcessProxy : public RefCounted<PluginProcessProxy>, CoreIPC::Connection::Client, ProcessLauncher::Client { public: - static PassRefPtr<PluginProcessProxy> create(PluginProcessManager*, const PluginModuleInfo&); + static PassRefPtr<PluginProcessProxy> create(PluginProcessManager*, const PluginModuleInfo&, PluginProcess::Type); ~PluginProcessProxy(); const PluginModuleInfo& pluginInfo() const { return m_pluginInfo; } @@ -82,6 +83,8 @@ public: bool isValid() const { return m_connection; } + PluginProcess::Type processType() const { return m_processType; } + #if PLATFORM(MAC) void setApplicationIsOccluded(bool); @@ -97,7 +100,7 @@ public: #endif private: - PluginProcessProxy(PluginProcessManager*, const PluginModuleInfo&); + PluginProcessProxy(PluginProcessManager*, const PluginModuleInfo&, PluginProcess::Type); void pluginProcessCrashedOrFailedToLaunch(); @@ -171,6 +174,8 @@ private: bool m_fullscreenWindowIsShowing; unsigned m_preFullscreenAppPresentationOptions; #endif + + PluginProcess::Type m_processType; }; } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebPageProxy.cpp b/Source/WebKit2/UIProcess/WebPageProxy.cpp index df416c09d..9d914cf28 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.cpp +++ b/Source/WebKit2/UIProcess/WebPageProxy.cpp @@ -233,6 +233,7 @@ WebPageProxy::WebPageProxy(PageClient* pageClient, PassRefPtr<WebProcessProxy> p , m_renderTreeSize(0) , m_shouldSendEventsSynchronously(false) , m_suppressVisibilityUpdates(false) + , m_minimumLayoutWidth(0) , m_mediaVolume(1) , m_mayStartMediaWhenInWindow(true) #if ENABLE(PAGE_VISIBILITY_API) @@ -4129,6 +4130,20 @@ void WebPageProxy::linkClicked(const String& url, const WebMouseEvent& event) m_process->send(Messages::WebPage::LinkClicked(url, event), m_pageID, 0); } +void WebPageProxy::setMinimumLayoutWidth(double minimumLayoutWidth) +{ + if (m_minimumLayoutWidth == minimumLayoutWidth) + return; + + m_minimumLayoutWidth = minimumLayoutWidth; + m_drawingArea->minimumLayoutWidthDidChange(); + +#if PLATFORM(MAC) + if (m_minimumLayoutWidth <= 0) + intrinsicContentSizeDidChange(IntSize(-1, -1)); +#endif +} + #if PLATFORM(MAC) void WebPageProxy::substitutionsPanelIsShowing(bool& isShowing) diff --git a/Source/WebKit2/UIProcess/WebPageProxy.h b/Source/WebKit2/UIProcess/WebPageProxy.h index 9139b482e..ff8ec5133 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.h +++ b/Source/WebKit2/UIProcess/WebPageProxy.h @@ -409,6 +409,7 @@ public: #if USE(APPKIT) WKView* wkView() const; + void intrinsicContentSizeDidChange(const WebCore::IntSize& intrinsicContentSize); #endif #endif #if PLATFORM(WIN) @@ -757,6 +758,9 @@ public: const WebLoaderClient& loaderClient() { return m_loaderClient; } + double minimumLayoutWidth() const { return m_minimumLayoutWidth; } + void setMinimumLayoutWidth(double); + private: WebPageProxy(PageClient*, PassRefPtr<WebProcessProxy>, WebPageGroup*, uint64_t pageID); @@ -895,6 +899,9 @@ private: #endif void editorStateChanged(const EditorState&); +#if PLATFORM(QT) + void willSetInputMethodState(); +#endif // Back/Forward list management void backForwardAddItem(uint64_t itemID); @@ -1239,6 +1246,7 @@ private: bool m_shouldSendEventsSynchronously; bool m_suppressVisibilityUpdates; + float m_minimumLayoutWidth; float m_mediaVolume; bool m_mayStartMediaWhenInWindow; diff --git a/Source/WebKit2/UIProcess/WebPageProxy.messages.in b/Source/WebKit2/UIProcess/WebPageProxy.messages.in index f88eda49e..5c89fae35 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.messages.in +++ b/Source/WebKit2/UIProcess/WebPageProxy.messages.in @@ -205,7 +205,9 @@ messages -> WebPageProxy { #if PLATFORM(WIN) DidChangeCompositionSelection(bool hasChanged) #endif - +#if PLATFORM(QT) + WillSetInputMethodState() +#endif # Find messages DidCountStringMatches(WTF::String string, uint32_t matchCount) SetFindIndicator(WebCore::FloatRect selectionRect, Vector<WebCore::FloatRect> textRects, float contentImageScaleFactor, WebKit::ShareableBitmap::Handle contentImageHandle, bool fadeOut, bool animate) diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.cpp b/Source/WebKit2/UIProcess/WebProcessProxy.cpp index fdeda3a8f..6ca003ab3 100644 --- a/Source/WebKit2/UIProcess/WebProcessProxy.cpp +++ b/Source/WebKit2/UIProcess/WebProcessProxy.cpp @@ -406,9 +406,9 @@ void WebProcessProxy::getPluginPath(const String& mimeType, const String& urlStr #if ENABLE(PLUGIN_PROCESS) -void WebProcessProxy::getPluginProcessConnection(const String& pluginPath, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply> reply) +void WebProcessProxy::getPluginProcessConnection(const String& pluginPath, uint32_t processType, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply> reply) { - PluginProcessManager::shared().getPluginProcessConnection(m_context->pluginInfoStore(), pluginPath, reply); + PluginProcessManager::shared().getPluginProcessConnection(m_context->pluginInfoStore(), pluginPath, static_cast<PluginProcess::Type>(processType), reply); } #elif ENABLE(NETSCAPE_PLUGIN_API) diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.h b/Source/WebKit2/UIProcess/WebProcessProxy.h index 4c9996125..32325d508 100644 --- a/Source/WebKit2/UIProcess/WebProcessProxy.h +++ b/Source/WebKit2/UIProcess/WebProcessProxy.h @@ -154,7 +154,7 @@ private: void sendDidGetPlugins(uint64_t requestID, PassOwnPtr<Vector<WebCore::PluginInfo> >); #endif // ENABLE(NETSCAPE_PLUGIN_API) #if ENABLE(PLUGIN_PROCESS) - void getPluginProcessConnection(const String& pluginPath, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply>); + void getPluginProcessConnection(const String& pluginPath, uint32_t processType, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply>); #elif ENABLE(NETSCAPE_PLUGIN_API) void didGetSitesWithPluginData(const Vector<String>& sites, uint64_t callbackID); void didClearPluginSiteData(uint64_t callbackID); diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.messages.in b/Source/WebKit2/UIProcess/WebProcessProxy.messages.in index 22e2f08ea..a83e1e84c 100644 --- a/Source/WebKit2/UIProcess/WebProcessProxy.messages.in +++ b/Source/WebKit2/UIProcess/WebProcessProxy.messages.in @@ -39,7 +39,7 @@ messages -> WebProcessProxy { GetPluginPath(WTF::String mimeType, WTF::String urlString) -> (WTF::String pluginPath, uint32_t pluginLoadPolicy) #endif // ENABLE(NETSCAPE_PLUGIN_API) #if ENABLE(PLUGIN_PROCESS) - GetPluginProcessConnection(WTF::String pluginPath) -> (CoreIPC::Attachment connectionHandle, bool supportsAsynchronousInitialization) Delayed + GetPluginProcessConnection(WTF::String pluginPath, uint32_t processType) -> (CoreIPC::Attachment connectionHandle, bool supportsAsynchronousInitialization) Delayed #endif #if ENABLE(NETSCAPE_PLUGIN_API) && !ENABLE(PLUGIN_PROCESS) void DidGetSitesWithPluginData(Vector<WTF::String> sites, uint64_t callbackID) diff --git a/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp b/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp index d4e4cd8bb..2b411fde0 100644 --- a/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp +++ b/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp @@ -93,7 +93,7 @@ void WebInspectorProxy::createInspectorWindow() gtk_window_set_title(GTK_WINDOW(m_inspectorWindow), _("Web Inspector")); gtk_window_set_default_size(GTK_WINDOW(m_inspectorWindow), initialWindowWidth, initialWindowHeight); - gtk_container_add(GTK_CONTAINER(m_inspectorWindow), m_inspectorView); + webkitWebViewBaseAddWebInspector(WEBKIT_WEB_VIEW_BASE(m_inspectorWindow), m_inspectorView); gtk_widget_show(m_inspectorView); g_object_add_weak_pointer(G_OBJECT(m_inspectorWindow), reinterpret_cast<void**>(&m_inspectorWindow)); diff --git a/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h b/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h index 08b16508d..c78610984 100644 --- a/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h +++ b/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h @@ -48,13 +48,15 @@ private: virtual void sizeDidChange() OVERRIDE; virtual void waitForPossibleGeometryUpdate() OVERRIDE; virtual void colorSpaceDidChange() OVERRIDE; + virtual void minimumLayoutWidthDidChange() OVERRIDE; virtual void enterAcceleratedCompositingMode(uint64_t backingStoreStateID, const LayerTreeContext&) OVERRIDE; virtual void exitAcceleratedCompositingMode(uint64_t backingStoreStateID, const UpdateInfo&) OVERRIDE; virtual void updateAcceleratedCompositingMode(uint64_t backingStoreStateID, const LayerTreeContext&) OVERRIDE; // Message handlers. - virtual void didUpdateGeometry() OVERRIDE; + virtual void didUpdateGeometry(const WebCore::IntSize& newIntrinsicContentSize) OVERRIDE; + virtual void intrinsicContentSizeDidChange(const WebCore::IntSize& newIntrinsicContentSize) OVERRIDE; void sendUpdateGeometry(); @@ -63,6 +65,9 @@ private: // The last size we sent to the web process. WebCore::IntSize m_lastSentSize; + + // The last minimum layout width we sent to the web process. + double m_lastSentMinimumLayoutWidth; }; } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm b/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm index a0c181768..3de8be7a6 100644 --- a/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm +++ b/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm @@ -47,6 +47,7 @@ PassOwnPtr<TiledCoreAnimationDrawingAreaProxy> TiledCoreAnimationDrawingAreaProx TiledCoreAnimationDrawingAreaProxy::TiledCoreAnimationDrawingAreaProxy(WebPageProxy* webPageProxy) : DrawingAreaProxy(DrawingAreaTypeTiledCoreAnimation, webPageProxy) , m_isWaitingForDidUpdateGeometry(false) + , m_lastSentMinimumLayoutWidth(0) { } @@ -103,6 +104,19 @@ void TiledCoreAnimationDrawingAreaProxy::colorSpaceDidChange() m_webPageProxy->process()->send(Messages::DrawingArea::SetColorSpace(m_webPageProxy->colorSpace()), m_webPageProxy->pageID()); } +void TiledCoreAnimationDrawingAreaProxy::minimumLayoutWidthDidChange() +{ + if (!m_webPageProxy->isValid()) + return; + + // We only want one UpdateGeometry message in flight at once, so if we've already sent one but + // haven't yet received the reply we'll just return early here. + if (m_isWaitingForDidUpdateGeometry) + return; + + sendUpdateGeometry(); +} + void TiledCoreAnimationDrawingAreaProxy::enterAcceleratedCompositingMode(uint64_t backingStoreStateID, const LayerTreeContext& layerTreeContext) { m_webPageProxy->enterAcceleratedCompositingMode(layerTreeContext); @@ -119,24 +133,36 @@ void TiledCoreAnimationDrawingAreaProxy::updateAcceleratedCompositingMode(uint64 m_webPageProxy->updateAcceleratedCompositingMode(layerTreeContext); } -void TiledCoreAnimationDrawingAreaProxy::didUpdateGeometry() +void TiledCoreAnimationDrawingAreaProxy::didUpdateGeometry(const IntSize& newIntrinsicContentSize) { ASSERT(m_isWaitingForDidUpdateGeometry); m_isWaitingForDidUpdateGeometry = false; + double minimumLayoutWidth = m_webPageProxy->minimumLayoutWidth(); + // If the WKView was resized while we were waiting for a DidUpdateGeometry reply from the web process, // we need to resend the new size here. - if (m_lastSentSize != m_size) + if (m_lastSentSize != m_size || m_lastSentMinimumLayoutWidth != minimumLayoutWidth) sendUpdateGeometry(); + + if (minimumLayoutWidth > 0) + m_webPageProxy->intrinsicContentSizeDidChange(newIntrinsicContentSize); +} + +void TiledCoreAnimationDrawingAreaProxy::intrinsicContentSizeDidChange(const IntSize& newIntrinsicContentSize) +{ + if (m_webPageProxy->minimumLayoutWidth() > 0) + m_webPageProxy->intrinsicContentSizeDidChange(newIntrinsicContentSize); } void TiledCoreAnimationDrawingAreaProxy::sendUpdateGeometry() { ASSERT(!m_isWaitingForDidUpdateGeometry); + m_lastSentMinimumLayoutWidth = m_webPageProxy->minimumLayoutWidth(); m_lastSentSize = m_size; - m_webPageProxy->process()->send(Messages::DrawingArea::UpdateGeometry(m_size), m_webPageProxy->pageID()); + m_webPageProxy->process()->send(Messages::DrawingArea::UpdateGeometry(m_size, m_lastSentMinimumLayoutWidth), m_webPageProxy->pageID()); m_isWaitingForDidUpdateGeometry = true; } diff --git a/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm index 137c22f2c..849ba20f8 100644 --- a/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm +++ b/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm @@ -474,6 +474,11 @@ WKView* WebPageProxy::wkView() const return m_pageClient->wkView(); } +void WebPageProxy::intrinsicContentSizeDidChange(const IntSize& intrinsicContentSize) +{ + m_pageClient->intrinsicContentSizeDidChange(intrinsicContentSize); +} + void WebPageProxy::setAcceleratedCompositingRootLayer(const GraphicsLayer* rootLayer) { m_pageClient->setAcceleratedCompositingRootLayer(rootLayer->platformLayer()); diff --git a/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp b/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp index b8ccd977b..1cf3ae568 100644 --- a/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp +++ b/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp @@ -88,7 +88,7 @@ void PageViewportControllerClientQt::setContentRectVisiblePositionAtScale(const // To animate the position together with the scale we multiply the position with the current scale // and add it to the page position (displacement on the flickable contentItem because of additional items). - QPointF newPosition(m_pageItem->position() + location * itemScale); + QPointF newPosition(m_pageItem->pos() + location * itemScale); m_viewportItem->setContentPos(newPosition); } @@ -317,7 +317,7 @@ QRectF PageViewportControllerClientQt::nearestValidVisibleContentsRect() const void PageViewportControllerClientQt::setViewportPosition(const FloatPoint& contentsPoint) { - QPointF newPosition((m_pageItem->position() + QPointF(contentsPoint)) * m_pageItem->contentsScale()); + QPointF newPosition((m_pageItem->pos() + QPointF(contentsPoint)) * m_pageItem->contentsScale()); m_viewportItem->setContentPos(newPosition); updateViewportController(); } diff --git a/Source/WebKit2/UIProcess/qt/QtPageClient.cpp b/Source/WebKit2/UIProcess/qt/QtPageClient.cpp index 7737f6529..89a40c923 100644 --- a/Source/WebKit2/UIProcess/qt/QtPageClient.cpp +++ b/Source/WebKit2/UIProcess/qt/QtPageClient.cpp @@ -256,6 +256,12 @@ void QtPageClient::updateTextInputState() m_eventHandler->updateTextInputState(); } +void QtPageClient::handleWillSetInputMethodState() +{ + ASSERT(m_eventHandler); + m_eventHandler->handleWillSetInputMethodState(); +} + #if ENABLE(GESTURE_EVENTS) void QtPageClient::doneWithGestureEvent(const WebGestureEvent& event, bool wasEventHandled) { diff --git a/Source/WebKit2/UIProcess/qt/QtPageClient.h b/Source/WebKit2/UIProcess/qt/QtPageClient.h index e493ce8ad..fc10ca653 100644 --- a/Source/WebKit2/UIProcess/qt/QtPageClient.h +++ b/Source/WebKit2/UIProcess/qt/QtPageClient.h @@ -103,6 +103,7 @@ public: virtual void pageTransitionViewportReady(); virtual void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&); virtual void updateTextInputState(); + virtual void handleWillSetInputMethodState(); virtual void doneWithGestureEvent(const WebGestureEvent&, bool wasEventHandled); #if ENABLE(TOUCH_EVENTS) virtual void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled); diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp index 88dae15b8..b80613438 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp +++ b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp @@ -435,6 +435,12 @@ void QtWebPageEventHandler::updateTextInputState() setInputPanelVisible(editor.isContentEditable); } +void QtWebPageEventHandler::handleWillSetInputMethodState() +{ + if (qApp->inputMethod()->isVisible()) + qApp->inputMethod()->commit(); +} + void QtWebPageEventHandler::doneWithGestureEvent(const WebGestureEvent& event, bool wasEventHandled) { if (event.type() != WebEvent::GestureSingleTap) diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h index 04c75ab3f..005cb4ca0 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h +++ b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h @@ -89,6 +89,7 @@ public: void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled); #endif void handleInputEvent(const QInputEvent*); + void handleWillSetInputMethodState(); void resetGestureRecognizers(); PageViewportControllerClientQt* viewportController() { return m_viewportController; } diff --git a/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp index 46429461f..8a205f91d 100644 --- a/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp +++ b/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp @@ -171,4 +171,9 @@ void WebPageProxy::closePopupMenu() process()->send(Messages::WebPage::HidePopupMenu(), m_pageID); } +void WebPageProxy::willSetInputMethodState() +{ + m_pageClient->handleWillSetInputMethodState(); +} + } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp index 1b2c83099..1b4e85af7 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp @@ -71,7 +71,7 @@ #include <wtf/OwnArrayPtr.h> #include <wtf/PassOwnArrayPtr.h> -#if ENABLE(SHADOW_DOM) +#if ENABLE(SHADOW_DOM) || ENABLE(CSS_REGIONS) #include <WebCore/RuntimeEnabledFeatures.h> #endif @@ -182,11 +182,15 @@ void InjectedBundle::overrideBoolPreferenceForTestRunner(WebPageGroupProxy* page } } +#if ENABLE(CSS_REGIONS) + if (preference == "WebKitCSSRegionsEnabled") + RuntimeEnabledFeatures::setCSSRegionsEnabled(enabled); +#endif + // Map the names used in LayoutTests with the names used in WebCore::Settings and WebPreferencesStore. #define FOR_EACH_OVERRIDE_BOOL_PREFERENCE(macro) \ macro(WebKitAcceleratedCompositingEnabled, AcceleratedCompositingEnabled, acceleratedCompositingEnabled) \ macro(WebKitCSSCustomFilterEnabled, CSSCustomFilterEnabled, cssCustomFilterEnabled) \ - macro(WebKitCSSRegionsEnabled, CSSRegionsEnabled, cssRegionsEnabled) \ macro(WebKitCSSGridLayoutEnabled, CSSGridLayoutEnabled, cssGridLayoutEnabled) \ macro(WebKitJavaEnabled, JavaEnabled, javaEnabled) \ macro(WebKitJavaScriptEnabled, ScriptEnabled, javaScriptEnabled) \ @@ -646,6 +650,15 @@ void InjectedBundle::setShadowDOMEnabled(bool enabled) #endif } +void InjectedBundle::setCSSRegionsEnabled(bool enabled) +{ +#if ENABLE(CSS_REGIONS) + RuntimeEnabledFeatures::setCSSRegionsEnabled(enabled); +#else + UNUSED_PARAM(enabled); +#endif +} + void InjectedBundle::dispatchPendingLoadRequests() { resourceLoadScheduler()->servePendingRequests(); diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h index fd716d3d3..8c065cc14 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h @@ -180,6 +180,7 @@ public: void setTabKeyCyclesThroughElements(WebPage*, bool enabled); void setSerialLoadingEnabled(bool); void setShadowDOMEnabled(bool); + void setCSSRegionsEnabled(bool); void dispatchPendingLoadRequests(); private: diff --git a/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.h b/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.h index 132c28774..67f53d241 100644 --- a/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.h +++ b/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.h @@ -67,6 +67,7 @@ public: void clickedLink(NSURL *); void saveToPDF(); + void writeItemsToPasteboard(NSArray *items, NSArray *types); private: explicit PDFPlugin(WebFrame*); diff --git a/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm b/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm index f50fb8c0e..7417929bc 100644 --- a/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm +++ b/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm @@ -36,10 +36,12 @@ #import "PDFPluginAnnotation.h" #import "PluginView.h" #import "ShareableBitmap.h" +#import "WebContextMessages.h" #import "WebEvent.h" #import "WebEventConversion.h" #import "WebPage.h" #import "WebPageProxyMessages.h" +#import "WebProcess.h" #import <PDFKit/PDFKit.h> #import <QuartzCore/QuartzCore.h> #import <WebCore/ArchiveResource.h> @@ -154,15 +156,7 @@ static const char* annotationStyle = - (void)writeItemsToPasteboard:(NSArray *)items withTypes:(NSArray *)types { - // FIXME: Handle types other than plain text. - - for (NSUInteger i = 0, count = items.count; i < count; ++i) { - NSString *type = [types objectAtIndex:i]; - if ([type isEqualToString:NSStringPboardType] || [type isEqualToString:NSPasteboardTypeString]) { - RetainPtr<NSString> plainTextString(AdoptNS, [[NSString alloc] initWithData:[items objectAtIndex:i] encoding:NSUTF8StringEncoding]); - Pasteboard::generalPasteboard()->writePlainText(plainTextString.get(), Pasteboard::CannotSmartReplace); - } - } + _pdfPlugin->writeItemsToPasteboard(items, types); } - (void)showDefinitionForAttributedString:(NSAttributedString *)string atPoint:(CGPoint)point @@ -765,6 +759,44 @@ void PDFPlugin::saveToPDF() webFrame()->page()->send(Messages::WebPageProxy::SavePDFToFileInDownloadsFolder(suggestedFilename(), webFrame()->url(), dataReference)); } +void PDFPlugin::writeItemsToPasteboard(NSArray *items, NSArray *types) +{ + Vector<String> pasteboardTypes; + + for (NSString *type in types) + pasteboardTypes.append(type); + + WebProcess::shared().connection()->send(Messages::WebContext::SetPasteboardTypes(NSGeneralPboard, pasteboardTypes), 0); + + for (NSUInteger i = 0, count = items.count; i < count; ++i) { + NSString *type = [types objectAtIndex:i]; + NSData *data = [items objectAtIndex:i]; + + // We don't expect the data for any items to be empty, but aren't completely sure. + // Avoid crashing in the SharedMemory constructor in release builds if we're wrong. + ASSERT(data.length); + if (!data.length) + continue; + + if ([type isEqualToString:NSStringPboardType] || [type isEqualToString:NSPasteboardTypeString]) { + RetainPtr<NSString> plainTextString(AdoptNS, [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]); + WebProcess::shared().connection()->send(Messages::WebContext::SetPasteboardStringForType(NSGeneralPboard, type, plainTextString.get()), 0); + } else { + RefPtr<SharedBuffer> buffer = SharedBuffer::wrapNSData(data); + + if (!buffer) + continue; + + SharedMemory::Handle handle; + RefPtr<SharedMemory> sharedMemory = SharedMemory::create(buffer->size()); + memcpy(sharedMemory->data(), buffer->data(), buffer->size()); + sharedMemory->createHandle(handle, SharedMemory::ReadOnly); + WebProcess::shared().connection()->send(Messages::WebContext::SetPasteboardBufferForType(NSGeneralPboard, type, handle, buffer->size()), 0); + } + } + +} + } // namespace WebKit #endif // ENABLE(PDFKIT_PLUGIN) diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp index 648a51eb8..b75c5a876 100644 --- a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp +++ b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp @@ -41,10 +41,11 @@ using namespace WebCore; namespace WebKit { -PluginProcessConnection::PluginProcessConnection(PluginProcessConnectionManager* pluginProcessConnectionManager, const String& pluginPath, CoreIPC::Connection::Identifier connectionIdentifier, bool supportsAsynchronousPluginInitialization) +PluginProcessConnection::PluginProcessConnection(PluginProcessConnectionManager* pluginProcessConnectionManager, const String& pluginPath, PluginProcess::Type processType, CoreIPC::Connection::Identifier connectionIdentifier, bool supportsAsynchronousPluginInitialization) : m_pluginProcessConnectionManager(pluginProcessConnectionManager) , m_pluginPath(pluginPath) , m_supportsAsynchronousPluginInitialization(supportsAsynchronousPluginInitialization) + , m_processType(processType) { m_connection = CoreIPC::Connection::createClientConnection(connectionIdentifier, this, WebProcess::shared().runLoop()); diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.h b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.h index bc6558ffd..35993d45e 100644 --- a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.h +++ b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.h @@ -30,6 +30,7 @@ #include "Connection.h" #include "Plugin.h" +#include "PluginProcess.h" #include <wtf/RefCounted.h> #include <wtf/text/WTFString.h> @@ -43,9 +44,9 @@ class PluginProxy; class PluginProcessConnection : public RefCounted<PluginProcessConnection>, CoreIPC::Connection::Client { public: - static PassRefPtr<PluginProcessConnection> create(PluginProcessConnectionManager* pluginProcessConnectionManager, const String& pluginPath, CoreIPC::Connection::Identifier connectionIdentifier, bool supportsAsynchronousPluginInitialization) + static PassRefPtr<PluginProcessConnection> create(PluginProcessConnectionManager* pluginProcessConnectionManager, const String& pluginPath, PluginProcess::Type processType, CoreIPC::Connection::Identifier connectionIdentifier, bool supportsAsynchronousPluginInitialization) { - return adoptRef(new PluginProcessConnection(pluginProcessConnectionManager, pluginPath, connectionIdentifier, supportsAsynchronousPluginInitialization)); + return adoptRef(new PluginProcessConnection(pluginProcessConnectionManager, pluginPath, processType, connectionIdentifier, supportsAsynchronousPluginInitialization)); } ~PluginProcessConnection(); @@ -60,8 +61,10 @@ public: bool supportsAsynchronousPluginInitialization() const { return m_supportsAsynchronousPluginInitialization; } + PluginProcess::Type processType() const { return m_processType; } + private: - PluginProcessConnection(PluginProcessConnectionManager*, const String& pluginPath, CoreIPC::Connection::Identifier connectionIdentifier, bool supportsAsynchronousInitialization); + PluginProcessConnection(PluginProcessConnectionManager*, const String& pluginPath, PluginProcess::Type, CoreIPC::Connection::Identifier connectionIdentifier, bool supportsAsynchronousInitialization); // CoreIPC::Connection::Client virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&) OVERRIDE; @@ -85,6 +88,8 @@ private: RefPtr<NPRemoteObjectMap> m_npRemoteObjectMap; bool m_supportsAsynchronousPluginInitialization; + + PluginProcess::Type m_processType; }; } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.cpp b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.cpp index b77050992..64bfc2b7d 100644 --- a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.cpp +++ b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.cpp @@ -49,16 +49,17 @@ PluginProcessConnectionManager::~PluginProcessConnectionManager() { } -PluginProcessConnection* PluginProcessConnectionManager::getPluginProcessConnection(const String& pluginPath) +PluginProcessConnection* PluginProcessConnectionManager::getPluginProcessConnection(const String& pluginPath, PluginProcess::Type processType) { for (size_t i = 0; i < m_pluginProcessConnections.size(); ++i) { - if (m_pluginProcessConnections[i]->pluginPath() == pluginPath) - return m_pluginProcessConnections[i].get(); + RefPtr<PluginProcessConnection>& pluginProcessConnection = m_pluginProcessConnections[i]; + if (pluginProcessConnection->pluginPath() == pluginPath && pluginProcessConnection->processType() == processType) + return pluginProcessConnection.get(); } CoreIPC::Attachment encodedConnectionIdentifier; bool supportsAsynchronousInitialization; - if (!WebProcess::shared().connection()->sendSync(Messages::WebProcessProxy::GetPluginProcessConnection(pluginPath), + if (!WebProcess::shared().connection()->sendSync(Messages::WebProcessProxy::GetPluginProcessConnection(pluginPath, processType), Messages::WebProcessProxy::GetPluginProcessConnection::Reply(encodedConnectionIdentifier, supportsAsynchronousInitialization), 0)) return 0; @@ -72,14 +73,14 @@ PluginProcessConnection* PluginProcessConnectionManager::getPluginProcessConnect return 0; #endif - RefPtr<PluginProcessConnection> pluginProcessConnection = PluginProcessConnection::create(this, pluginPath, connectionIdentifier, supportsAsynchronousInitialization); + RefPtr<PluginProcessConnection> pluginProcessConnection = PluginProcessConnection::create(this, pluginPath, processType, connectionIdentifier, supportsAsynchronousInitialization); m_pluginProcessConnections.append(pluginProcessConnection); { MutexLocker locker(m_pathsAndConnectionsMutex); - ASSERT(!m_pathsAndConnections.contains(pluginProcessConnection->pluginPath())); + ASSERT(!m_pathsAndConnections.contains(std::make_pair(pluginProcessConnection->pluginPath(), processType))); - m_pathsAndConnections.set(pluginPath, pluginProcessConnection->connection()); + m_pathsAndConnections.set(std::make_pair(pluginPath, processType), pluginProcessConnection->connection()); } return pluginProcessConnection.get(); @@ -92,18 +93,18 @@ void PluginProcessConnectionManager::removePluginProcessConnection(PluginProcess { MutexLocker locker(m_pathsAndConnectionsMutex); - ASSERT(m_pathsAndConnections.contains(pluginProcessConnection->pluginPath())); + ASSERT(m_pathsAndConnections.contains(std::make_pair(pluginProcessConnection->pluginPath(), pluginProcessConnection->processType()))); - m_pathsAndConnections.remove(pluginProcessConnection->pluginPath()); + m_pathsAndConnections.remove(std::make_pair(pluginProcessConnection->pluginPath(), pluginProcessConnection->processType())); } m_pluginProcessConnections.remove(vectorIndex); } -void PluginProcessConnectionManager::pluginProcessCrashed(const String& pluginPath) +void PluginProcessConnectionManager::pluginProcessCrashed(const String& pluginPath, PluginProcess::Type processType) { MutexLocker locker(m_pathsAndConnectionsMutex); - CoreIPC::Connection* connection = m_pathsAndConnections.get(pluginPath).get(); + CoreIPC::Connection* connection = m_pathsAndConnections.get(std::make_pair(pluginPath, processType)).get(); // It's OK for connection to be null here; it will happen if this web process doesn't know // anything about the plug-in process. diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.h b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.h index 45515cdf1..86449f651 100644 --- a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.h +++ b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.h @@ -28,6 +28,7 @@ #if ENABLE(PLUGIN_PROCESS) +#include "PluginProcess.h" #include <wtf/Forward.h> #include <wtf/HashMap.h> #include <wtf/Noncopyable.h> @@ -51,17 +52,17 @@ public: PluginProcessConnectionManager(); ~PluginProcessConnectionManager(); - PluginProcessConnection* getPluginProcessConnection(const String& pluginPath); + PluginProcessConnection* getPluginProcessConnection(const String& pluginPath, PluginProcess::Type); void removePluginProcessConnection(PluginProcessConnection*); // Called on the web process connection work queue. - void pluginProcessCrashed(const String& pluginPath); + void pluginProcessCrashed(const String& pluginPath, PluginProcess::Type); private: Vector<RefPtr<PluginProcessConnection> > m_pluginProcessConnections; Mutex m_pathsAndConnectionsMutex; - HashMap<String, RefPtr<CoreIPC::Connection> > m_pathsAndConnections; + HashMap<std::pair<String, PluginProcess::Type>, RefPtr<CoreIPC::Connection> > m_pathsAndConnections; }; } diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp b/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp index f7ead5664..6633d8247 100644 --- a/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp +++ b/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp @@ -55,12 +55,12 @@ static uint64_t generatePluginInstanceID() return ++uniquePluginInstanceID; } -PassRefPtr<PluginProxy> PluginProxy::create(const String& pluginPath) +PassRefPtr<PluginProxy> PluginProxy::create(const String& pluginPath, PluginProcess::Type processType) { - return adoptRef(new PluginProxy(pluginPath)); + return adoptRef(new PluginProxy(pluginPath, processType)); } -PluginProxy::PluginProxy(const String& pluginPath) +PluginProxy::PluginProxy(const String& pluginPath, PluginProcess::Type processType) : m_pluginPath(pluginPath) , m_pluginInstanceID(generatePluginInstanceID()) , m_pluginBackingStoreContainsValidData(false) @@ -69,6 +69,7 @@ PluginProxy::PluginProxy(const String& pluginPath) , m_wantsWheelEvents(false) , m_remoteLayerClientID(0) , m_waitingOnAsynchronousInitialization(false) + , m_processType(processType) { } @@ -84,7 +85,7 @@ void PluginProxy::pluginProcessCrashed() bool PluginProxy::initialize(const Parameters& parameters) { ASSERT(!m_connection); - m_connection = WebProcess::shared().pluginProcessConnectionManager().getPluginProcessConnection(m_pluginPath); + m_connection = WebProcess::shared().pluginProcessConnectionManager().getPluginProcessConnection(m_pluginPath, m_processType); if (!m_connection) return false; diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProxy.h b/Source/WebKit2/WebProcess/Plugins/PluginProxy.h index 535c8c7fe..af1d5e1ed 100644 --- a/Source/WebKit2/WebProcess/Plugins/PluginProxy.h +++ b/Source/WebKit2/WebProcess/Plugins/PluginProxy.h @@ -30,6 +30,7 @@ #include "Connection.h" #include "Plugin.h" +#include "PluginProcess.h" #include <WebCore/AffineTransform.h> #include <WebCore/IntRect.h> #include <WebCore/SecurityOrigin.h> @@ -54,7 +55,7 @@ struct PluginCreationParameters; class PluginProxy : public Plugin { public: - static PassRefPtr<PluginProxy> create(const String& pluginPath); + static PassRefPtr<PluginProxy> create(const String& pluginPath, PluginProcess::Type); ~PluginProxy(); uint64_t pluginInstanceID() const { return m_pluginInstanceID; } @@ -66,7 +67,7 @@ public: bool isBeingAsynchronouslyInitialized() const { return m_waitingOnAsynchronousInitialization; } private: - explicit PluginProxy(const String& pluginPath); + explicit PluginProxy(const String& pluginPath, PluginProcess::Type); // Plugin virtual bool initialize(const Parameters&); @@ -205,6 +206,8 @@ private: #if PLATFORM(MAC) RetainPtr<CALayer> m_pluginLayer; #endif + + PluginProcess::Type m_processType; }; } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp index 2a5da5c59..283a839c4 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp @@ -432,7 +432,7 @@ PlatformPageClient WebChromeClient::platformPageClient() const return 0; } -void WebChromeClient::contentsSizeChanged(Frame* frame, const IntSize& /*size*/) const +void WebChromeClient::contentsSizeChanged(Frame* frame, const IntSize& size) const { if (!m_page->corePage()->settings()->frameFlatteningEnabled()) { WebFrame* largestFrame = findLargestFrameInFrameSet(m_page); @@ -456,6 +456,8 @@ void WebChromeClient::contentsSizeChanged(Frame* frame, const IntSize& /*size*/) #endif + m_page->drawingArea()->mainFrameContentSizeChanged(size); + FrameView* frameView = frame->view(); if (frameView && !frameView->delegatesScrolling()) { bool hasHorizontalScrollbar = frameView->horizontalScrollbar(); diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp index 1c8c0b7b5..4a6cf83c5 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp @@ -469,7 +469,11 @@ void WebEditorClient::getGuessesForWord(const String& word, const String& contex void WebEditorClient::willSetInputMethodState() { +#if PLATFORM(QT) + m_page->send(Messages::WebPageProxy::WillSetInputMethodState()); +#else notImplemented(); +#endif } void WebEditorClient::setInputMethodState(bool) diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp index c04664439..88434f599 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp @@ -39,18 +39,20 @@ #include <WebCore/KURL.h> #include <WebCore/LoaderStrategy.h> #include <WebCore/Page.h> +#include <WebCore/PlatformCookieJar.h> #include <WebCore/PlatformPasteboard.h> #include <wtf/Atomics.h> +#if ENABLE(NETWORK_PROCESS) +#include "NetworkConnectionToWebProcessMessages.h" +#include "NetworkProcessConnection.h" +#endif + #if PLATFORM(WIN) && USE(CFNETWORK) #include "WebFrameNetworkingContext.h" #include <WebKitSystemInterface/WebKitSystemInterface.h> #endif -#if USE(CF) -#include <wtf/RetainPtr.h> -#endif - using namespace WebCore; namespace WebKit { @@ -113,6 +115,124 @@ RetainPtr<CFHTTPCookieStorageRef> WebPlatformStrategies::defaultCookieStorage() } #endif +String WebPlatformStrategies::cookiesForDOM(NetworkingContext* context, const KURL& firstParty, const KURL& url) +{ +#if ENABLE(NETWORK_PROCESS) + if (WebProcess::shared().usesNetworkProcess()) { + String result; + if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::CookiesForDOM(firstParty, url), Messages::NetworkConnectionToWebProcess::CookiesForDOM::Reply(result), 0)) + return String(); + return result; + } +#endif + + return WebCore::cookiesForDOM(context, firstParty, url); +} + +void WebPlatformStrategies::setCookiesFromDOM(NetworkingContext* context, const KURL& firstParty, const KURL& url, const String& cookieString) +{ +#if ENABLE(NETWORK_PROCESS) + if (WebProcess::shared().usesNetworkProcess()) { + WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::SetCookiesFromDOM(firstParty, url, cookieString), 0); + return; + } +#endif + + WebCore::setCookiesFromDOM(context, firstParty, url, cookieString); +} + +bool WebPlatformStrategies::cookiesEnabled(NetworkingContext* context, const KURL& firstParty, const KURL& url) +{ +#if ENABLE(NETWORK_PROCESS) + if (WebProcess::shared().usesNetworkProcess()) { + bool result; + if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::CookiesEnabled(firstParty, url), Messages::NetworkConnectionToWebProcess::CookiesEnabled::Reply(result), 0)) + return false; + return result; + } +#endif + + return WebCore::cookiesEnabled(context, firstParty, url); +} + +String WebPlatformStrategies::cookieRequestHeaderFieldValue(NetworkingContext* context, const KURL& firstParty, const KURL& url) +{ +#if ENABLE(NETWORK_PROCESS) + if (WebProcess::shared().usesNetworkProcess()) { + String result; + if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::CookieRequestHeaderFieldValue(firstParty, url), Messages::NetworkConnectionToWebProcess::CookieRequestHeaderFieldValue::Reply(result), 0)) + return String(); + return result; + } +#endif + + return WebCore::cookieRequestHeaderFieldValue(context, firstParty, url); +} + +bool WebPlatformStrategies::getRawCookies(NetworkingContext* context, const KURL& firstParty, const KURL& url, Vector<Cookie>& rawCookies) +{ +#if ENABLE(NETWORK_PROCESS) + if (WebProcess::shared().usesNetworkProcess()) { + if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::GetRawCookies(firstParty, url), Messages::NetworkConnectionToWebProcess::GetRawCookies::Reply(rawCookies), 0)) + return false; + return true; + } +#endif + + return WebCore::getRawCookies(context, firstParty, url, rawCookies); +} + +void WebPlatformStrategies::deleteCookie(NetworkingContext* context, const KURL& url, const String& cookieName) +{ +#if ENABLE(NETWORK_PROCESS) + if (WebProcess::shared().usesNetworkProcess()) { + WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::DeleteCookie(url, cookieName), 0); + return; + } +#endif + + WebCore::deleteCookie(context, url, cookieName); +} + +void WebPlatformStrategies::getHostnamesWithCookies(NetworkingContext* context, HashSet<String>& hostnames) +{ +#if ENABLE(NETWORK_PROCESS) + if (WebProcess::shared().usesNetworkProcess()) { + Vector<String> hostnamesVector; + WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::GetHostnamesWithCookies(), Messages::NetworkConnectionToWebProcess::GetHostnamesWithCookies::Reply(hostnamesVector), 0); + for (unsigned i = 0; i != hostnamesVector.size(); ++i) + hostnames.add(hostnamesVector[i]); + return; + } +#endif + + WebCore::getHostnamesWithCookies(context, hostnames); +} + +void WebPlatformStrategies::deleteCookiesForHostname(NetworkingContext* context, const String& hostname) +{ +#if ENABLE(NETWORK_PROCESS) + if (WebProcess::shared().usesNetworkProcess()) { + WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::DeleteCookiesForHostname(hostname), 0); + return; + } +#endif + + WebCore::deleteCookiesForHostname(context, hostname); +} + +void WebPlatformStrategies::deleteAllCookies(NetworkingContext* context) +{ +#if ENABLE(NETWORK_PROCESS) + if (WebProcess::shared().usesNetworkProcess()) { + WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::DeleteAllCookies(), 0); + return; + } +#endif + + WebCore::deleteAllCookies(context); +} + // LoaderStrategy #if ENABLE(NETWORK_PROCESS) diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h index 040cfb1a9..80acfe037 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h @@ -58,6 +58,15 @@ private: #if PLATFORM(MAC) || USE(CFNETWORK) virtual RetainPtr<CFHTTPCookieStorageRef> defaultCookieStorage() OVERRIDE; #endif + virtual String cookiesForDOM(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&) OVERRIDE; + virtual void setCookiesFromDOM(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&, const String&) OVERRIDE; + virtual bool cookiesEnabled(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&) OVERRIDE; + virtual String cookieRequestHeaderFieldValue(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&) OVERRIDE; + virtual bool getRawCookies(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&, Vector<WebCore::Cookie>&) OVERRIDE; + virtual void deleteCookie(WebCore::NetworkingContext*, const WebCore::KURL&, const String&) OVERRIDE; + virtual void getHostnamesWithCookies(WebCore::NetworkingContext*, HashSet<String>& hostnames) OVERRIDE; + virtual void deleteCookiesForHostname(WebCore::NetworkingContext*, const String& hostname) OVERRIDE; + virtual void deleteAllCookies(WebCore::NetworkingContext*) OVERRIDE; // WebCore::LoaderStrategy #if ENABLE(NETWORK_PROCESS) diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingArea.h b/Source/WebKit2/WebProcess/WebPage/DrawingArea.h index c8e96c3c0..327f651c9 100644 --- a/Source/WebKit2/WebProcess/WebPage/DrawingArea.h +++ b/Source/WebKit2/WebProcess/WebPage/DrawingArea.h @@ -86,6 +86,7 @@ public: virtual void setPaintingEnabled(bool) { } virtual void updatePreferences(const WebPreferencesStore&) { } + virtual void mainFrameContentSizeChanged(const WebCore::IntSize&) { } #if USE(ACCELERATED_COMPOSITING) virtual WebCore::GraphicsLayerFactory* graphicsLayerFactory() { return 0; } @@ -121,7 +122,7 @@ private: #if PLATFORM(MAC) // Used by TiledCoreAnimationDrawingArea. - virtual void updateGeometry(const WebCore::IntSize& viewSize) { } + virtual void updateGeometry(const WebCore::IntSize& viewSize, double minimumLayoutWidth) { } virtual void setDeviceScaleFactor(float) { } virtual void setColorSpace(const ColorSpaceData&) { } #endif diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in b/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in index fe98c7364..dec86ec22 100644 --- a/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in +++ b/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in @@ -30,7 +30,7 @@ messages -> DrawingArea { #if PLATFORM(MAC) // Used by TiledCoreAnimationDrawingArea. - UpdateGeometry(WebCore::IntSize viewSize) + UpdateGeometry(WebCore::IntSize viewSize, double minimumLayoutWidth) SetDeviceScaleFactor(float deviceScaleFactor) SetColorSpace(WebKit::ColorSpaceData colorSpace) #endif diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp index 83c0ae7fd..3e20c830d 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp @@ -114,6 +114,7 @@ #include <WebCore/ResourceRequest.h> #include <WebCore/ResourceResponse.h> #include <WebCore/RunLoop.h> +#include <WebCore/RuntimeEnabledFeatures.h> #include <WebCore/SchemeRegistry.h> #include <WebCore/ScriptValue.h> #include <WebCore/SerializedScriptValue.h> @@ -535,7 +536,8 @@ PassRefPtr<Plugin> WebPage::createPlugin(WebFrame* frame, HTMLPlugInElement* plu } #if ENABLE(PLUGIN_PROCESS) - return PluginProxy::create(pluginPath); + PluginProcess::Type processType = (pluginElement->displayState() == HTMLPlugInElement::WaitingForSnapshot ? PluginProcess::TypeSnapshotProcess : PluginProcess::TypeRegularProcess); + return PluginProxy::create(pluginPath, processType); #else NetscapePlugin::setSetExceptionFunction(NPRuntimeObjectMap::setGlobalException); return NetscapePlugin::create(NetscapePluginModule::getOrCreate(pluginPath)); @@ -1025,8 +1027,21 @@ void WebPage::sendViewportAttributesChanged() ViewportAttributes attr = computeViewportAttributes(m_page->viewportArguments(), minimumLayoutFallbackWidth, deviceWidth, deviceHeight, m_page->deviceScaleFactor(), m_viewportSize); attr.initialScale = m_page->viewportArguments().zoom; // Resets auto (-1) if no value was set by user. + // Keep the current position, update size only. + // For the new loads position is already reset to (0,0). + FrameView* view = m_page->mainFrame()->view(); + IntPoint contentFixedOrigin = view->fixedVisibleContentRect().location(); + + // Put the width and height to the viewport width and height. In css units however. + // FIXME: This should be in scaled units but this currently affects viewport attributes calculation. + IntSize contentFixedSize = m_viewportSize; + contentFixedSize.scale(1 / m_page->deviceScaleFactor()); + + setFixedVisibleContentRect(IntRect(contentFixedOrigin, contentFixedSize)); + // This also takes care of the relayout. - setFixedLayoutSize(IntSize(static_cast<int>(attr.layoutSize.width()), static_cast<int>(attr.layoutSize.height()))); + setFixedLayoutSize(roundedIntSize(attr.layoutSize)); + send(Messages::WebPageProxy::DidChangeViewportProperties(attr)); } @@ -1506,20 +1521,18 @@ void WebPage::mouseEvent(const WebMouseEvent& mouseEvent) return; } #endif - bool handled = false; - if (m_pageOverlay) { // Let the page overlay handle the event. handled = m_pageOverlay->mouseEvent(mouseEvent); } - if (!handled) { + if (!handled && canHandleUserEvents()) { CurrentEvent currentEvent(mouseEvent); // We need to do a full, normal hit test during this mouse event if the page is active or if a mouse - // button is currently pressed. It is possible that neither of those things will be true since on - // Lion when legacy scrollbars are enabled, WebKit receives mouse events all the time. If it is one + // button is currently pressed. It is possible that neither of those things will be true since on + // Lion when legacy scrollbars are enabled, WebKit receives mouse events all the time. If it is one // of those cases where the page is not active and the mouse is not pressed, then we can fire a more // efficient scrollbars-only version of the event. bool onlyUpdateScrollbars = !(m_page->focusController()->isActive() || (mouseEvent.button() != WebMouseEvent::NoButton)); @@ -1558,9 +1571,13 @@ static bool handleWheelEvent(const WebWheelEvent& wheelEvent, Page* page) void WebPage::wheelEvent(const WebWheelEvent& wheelEvent) { - CurrentEvent currentEvent(wheelEvent); + bool handled = false; - bool handled = handleWheelEvent(wheelEvent, m_page.get()); + if (canHandleUserEvents()) { + CurrentEvent currentEvent(wheelEvent); + + handled = handleWheelEvent(wheelEvent, m_page.get()); + } send(Messages::WebPageProxy::DidReceiveEvent(static_cast<uint32_t>(wheelEvent.type()), handled)); } @@ -1583,13 +1600,16 @@ static bool handleKeyEvent(const WebKeyboardEvent& keyboardEvent, Page* page) void WebPage::keyEvent(const WebKeyboardEvent& keyboardEvent) { - CurrentEvent currentEvent(keyboardEvent); + bool handled = false; - bool handled = handleKeyEvent(keyboardEvent, m_page.get()); - // FIXME: Platform default behaviors should be performed during normal DOM event dispatch (in most cases, in default keydown event handler). - if (!handled) - handled = performDefaultBehaviorForKeyEvent(keyboardEvent); + if (canHandleUserEvents()) { + CurrentEvent currentEvent(keyboardEvent); + handled = handleKeyEvent(keyboardEvent, m_page.get()); + // FIXME: Platform default behaviors should be performed during normal DOM event dispatch (in most cases, in default keydown event handler). + if (!handled) + handled = performDefaultBehaviorForKeyEvent(keyboardEvent); + } send(Messages::WebPageProxy::DidReceiveEvent(static_cast<uint32_t>(keyboardEvent.type()), handled)); } @@ -1615,9 +1635,13 @@ static bool handleGestureEvent(const WebGestureEvent& gestureEvent, Page* page) void WebPage::gestureEvent(const WebGestureEvent& gestureEvent) { - CurrentEvent currentEvent(gestureEvent); + bool handled = false; + + if (canHandleUserEvents()) { + CurrentEvent currentEvent(gestureEvent); - bool handled = handleGestureEvent(gestureEvent, m_page.get()); + handled = handleGestureEvent(gestureEvent, m_page.get()); + } send(Messages::WebPageProxy::DidReceiveEvent(static_cast<uint32_t>(gestureEvent.type()), handled)); } #endif @@ -1733,10 +1757,13 @@ static bool handleTouchEvent(const WebTouchEvent& touchEvent, Page* page) void WebPage::touchEvent(const WebTouchEvent& touchEvent) { - CurrentEvent currentEvent(touchEvent); + bool handled = false; - bool handled = handleTouchEvent(touchEvent, m_page.get()); + if (canHandleUserEvents()) { + CurrentEvent currentEvent(touchEvent); + handled = handleTouchEvent(touchEvent, m_page.get()); + } send(Messages::WebPageProxy::DidReceiveEvent(static_cast<uint32_t>(touchEvent.type()), handled)); } @@ -1883,6 +1910,15 @@ void WebPage::setCanStartMediaTimerFired() m_page->setCanStartMedia(true); } +inline bool WebPage::canHandleUserEvents() const +{ +#if USE(TILED_BACKING_STORE) + // Should apply only if the area was frozen by didStartPageTransition(). + return !m_drawingArea->layerTreeStateIsFrozen(); +#endif + return true; +} + void WebPage::setIsInWindow(bool isInWindow) { if (!isInWindow) { @@ -2236,7 +2272,7 @@ void WebPage::updatePreferences(const WebPreferencesStore& store) settings->setShowDebugBorders(store.getBoolValueForKey(WebPreferencesKey::compositingBordersVisibleKey())); settings->setShowRepaintCounter(store.getBoolValueForKey(WebPreferencesKey::compositingRepaintCountersVisibleKey())); settings->setCSSCustomFilterEnabled(store.getBoolValueForKey(WebPreferencesKey::cssCustomFilterEnabledKey())); - settings->setCSSRegionsEnabled(store.getBoolValueForKey(WebPreferencesKey::cssRegionsEnabledKey())); + RuntimeEnabledFeatures::setCSSRegionsEnabled(store.getBoolValueForKey(WebPreferencesKey::cssRegionsEnabledKey())); settings->setCSSGridLayoutEnabled(store.getBoolValueForKey(WebPreferencesKey::cssGridLayoutEnabledKey())); settings->setRegionBasedColumnsEnabled(store.getBoolValueForKey(WebPreferencesKey::regionBasedColumnsEnabledKey())); settings->setWebGLEnabled(store.getBoolValueForKey(WebPreferencesKey::webGLEnabledKey())); diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.h b/Source/WebKit2/WebProcess/WebPage/WebPage.h index 00ea81c8c..d4817c028 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.h +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.h @@ -781,6 +781,8 @@ private: void changeSelectedIndex(int32_t index); void setCanStartMediaTimerFired(); + bool canHandleUserEvents() const; + static bool platformCanHandleRequest(const WebCore::ResourceRequest&); OwnPtr<WebCore::Page> m_page; diff --git a/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h b/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h index 7d5b3be96..90c76c457 100644 --- a/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h +++ b/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h @@ -65,6 +65,7 @@ private: virtual void didUninstallPageOverlay() OVERRIDE; virtual void setPageOverlayNeedsDisplay(const WebCore::IntRect&) OVERRIDE; virtual void updatePreferences(const WebPreferencesStore&) OVERRIDE; + virtual void mainFrameContentSizeChanged(const WebCore::IntSize&) OVERRIDE; virtual void dispatchAfterEnsuringUpdatedScrollPosition(const Function<void ()>&) OVERRIDE; @@ -80,7 +81,7 @@ private: // Message handlers. virtual void suspendPainting() OVERRIDE; virtual void resumePainting() OVERRIDE; - virtual void updateGeometry(const WebCore::IntSize& viewSize) OVERRIDE; + virtual void updateGeometry(const WebCore::IntSize& viewSize, double minimumLayoutWidth) OVERRIDE; virtual void setDeviceScaleFactor(float) OVERRIDE; virtual void setLayerHostingMode(uint32_t) OVERRIDE; virtual void setColorSpace(const ColorSpaceData&) OVERRIDE; @@ -105,6 +106,10 @@ private: OwnPtr<WebCore::GraphicsLayer> m_pageOverlayLayer; bool m_isPaintingSuspended; + + double m_minimumLayoutWidth; + WebCore::IntSize m_lastSentIntrinsicContentSize; + bool m_inUpdateGeometry; }; } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm b/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm index cf5d23e01..103d2513b 100644 --- a/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm +++ b/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm @@ -33,6 +33,7 @@ #import "EventDispatcher.h" #import "LayerHostingContext.h" #import "LayerTreeContext.h" +#import "WebFrame.h" #import "WebPage.h" #import "WebPageCreationParameters.h" #import "WebPageProxyMessages.h" @@ -69,6 +70,7 @@ TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea(WebPage* webPage, c , m_layerTreeStateIsFrozen(false) , m_layerFlushScheduler(this) , m_isPaintingSuspended(!parameters.isVisible) + , m_minimumLayoutWidth(0) { Page* page = m_webPage->corePage(); @@ -229,6 +231,21 @@ void TiledCoreAnimationDrawingArea::updatePreferences(const WebPreferencesStore& ScrollingThread::dispatch(bind(&ScrollingTree::setDebugRootLayer, m_webPage->corePage()->scrollingCoordinator()->scrollingTree(), m_debugInfoLayer)); } +void TiledCoreAnimationDrawingArea::mainFrameContentSizeChanged(const IntSize& contentSize) +{ + if (!m_minimumLayoutWidth) + return; + + if (m_inUpdateGeometry) + return; + + if (m_lastSentIntrinsicContentSize == contentSize) + return; + + m_lastSentIntrinsicContentSize = contentSize; + m_webPage->send(Messages::DrawingAreaProxy::IntrinsicContentSizeDidChange(contentSize)); +} + void TiledCoreAnimationDrawingArea::dispatchAfterEnsuringUpdatedScrollPosition(const Function<void ()>& functionRef) { m_webPage->ref(); @@ -330,9 +347,24 @@ void TiledCoreAnimationDrawingArea::resumePainting() m_webPage->corePage()->resumeScriptedAnimations(); } -void TiledCoreAnimationDrawingArea::updateGeometry(const IntSize& viewSize) +void TiledCoreAnimationDrawingArea::updateGeometry(const IntSize& viewSize, double minimumLayoutWidth) { - m_webPage->setSize(viewSize); + m_inUpdateGeometry = true; + + m_minimumLayoutWidth = minimumLayoutWidth; + + IntSize size = viewSize; + IntSize contentSize = IntSize(-1, -1); + + if (m_minimumLayoutWidth > 0) { + m_webPage->setSize(IntSize(m_minimumLayoutWidth, 0)); + m_webPage->layoutIfNeeded(); + + contentSize = m_webPage->mainWebFrame()->contentBounds().size(); + size = contentSize; + } + + m_webPage->setSize(size); m_webPage->layoutIfNeeded(); if (m_pageOverlayLayer) @@ -351,7 +383,10 @@ void TiledCoreAnimationDrawingArea::updateGeometry(const IntSize& viewSize) [CATransaction flush]; [CATransaction synchronize]; - m_webPage->send(Messages::DrawingAreaProxy::DidUpdateGeometry()); + m_lastSentIntrinsicContentSize = contentSize; + m_webPage->send(Messages::DrawingAreaProxy::DidUpdateGeometry(contentSize)); + + m_inUpdateGeometry = false; } void TiledCoreAnimationDrawingArea::setDeviceScaleFactor(float deviceScaleFactor) diff --git a/Source/WebKit2/WebProcess/WebProcess.cpp b/Source/WebKit2/WebProcess/WebProcess.cpp index 28b7bfd7b..1621612f2 100644 --- a/Source/WebKit2/WebProcess/WebProcess.cpp +++ b/Source/WebKit2/WebProcess/WebProcess.cpp @@ -1079,9 +1079,9 @@ void WebProcess::networkProcessCrashed(CoreIPC::Connection*) #endif #if ENABLE(PLUGIN_PROCESS) -void WebProcess::pluginProcessCrashed(CoreIPC::Connection*, const String& pluginPath) +void WebProcess::pluginProcessCrashed(CoreIPC::Connection*, const String& pluginPath, uint32_t processType) { - m_pluginProcessConnectionManager.pluginProcessCrashed(pluginPath); + m_pluginProcessConnectionManager.pluginProcessCrashed(pluginPath, static_cast<PluginProcess::Type>(processType)); } #endif diff --git a/Source/WebKit2/WebProcess/WebProcess.h b/Source/WebKit2/WebProcess/WebProcess.h index 82e6cc8f2..01330a607 100644 --- a/Source/WebKit2/WebProcess/WebProcess.h +++ b/Source/WebKit2/WebProcess/WebProcess.h @@ -254,7 +254,7 @@ private: void networkProcessCrashed(CoreIPC::Connection*); #endif #if ENABLE(PLUGIN_PROCESS) - void pluginProcessCrashed(CoreIPC::Connection*, const String& pluginPath); + void pluginProcessCrashed(CoreIPC::Connection*, const String& pluginPath, uint32_t processType); #endif void startMemorySampler(const SandboxExtension::Handle&, const String&, const double); diff --git a/Source/WebKit2/WebProcess/WebProcess.messages.in b/Source/WebKit2/WebProcess/WebProcess.messages.in index edcad34ff..4346b9d81 100644 --- a/Source/WebKit2/WebProcess/WebProcess.messages.in +++ b/Source/WebKit2/WebProcess/WebProcess.messages.in @@ -69,7 +69,7 @@ messages -> WebProcess { #endif #if ENABLE(PLUGIN_PROCESS) - PluginProcessCrashed(String pluginProcess) DispatchOnConnectionQueue + PluginProcessCrashed(String pluginProcess, uint32_t processType) DispatchOnConnectionQueue #endif void StartMemorySampler(WebKit::SandboxExtension::Handle sampleLogFileHandle, WTF::String sampleLogFilePath, double interval); diff --git a/Source/WebKit2/win/WebKit2.def b/Source/WebKit2/win/WebKit2.def index 87c7f35b1..c5920940c 100644 --- a/Source/WebKit2/win/WebKit2.def +++ b/Source/WebKit2/win/WebKit2.def @@ -364,4 +364,3 @@ EXPORTS ?getCGImageRef@BitmapImage@WebCore@@UAEPAUCGImage@@XZ ?getFirstCGImageRefOfSize@BitmapImage@WebCore@@UAEPAUCGImage@@ABVIntSize@2@@Z ?getCGImageArray@BitmapImage@WebCore@@UAE?AV?$RetainPtr@PBU__CFArray@@@WTF@@XZ - ?notSolidColor@BitmapImage@WebCore@@UAE_NXZ diff --git a/Source/WebKit2/win/WebKit2CFLite.def b/Source/WebKit2/win/WebKit2CFLite.def index 420ecf0f4..b3bd1f099 100644 --- a/Source/WebKit2/win/WebKit2CFLite.def +++ b/Source/WebKit2/win/WebKit2CFLite.def @@ -353,4 +353,3 @@ EXPORTS ?frameAtIndex@BitmapImage@WebCore@@IAEPAVNativeImageCairo@2@I@Z ?draw@BitmapImage@WebCore@@MAEXPAVGraphicsContext@2@ABVFloatRect@2@1W4ColorSpace@2@W4CompositeOperator@2@W4RespectImageOrientationEnum@2@@Z ?frameCount@BitmapImage@WebCore@@MAEIXZ - ?notSolidColor@BitmapImage@WebCore@@UAE_NXZ diff --git a/Source/api.pri b/Source/api.pri index f6c3c3c75..010396169 100644 --- a/Source/api.pri +++ b/Source/api.pri @@ -8,31 +8,30 @@ load(qt_build_config) TEMPLATE = lib -TARGET = QtWebKitWidgets +TARGET = QtWebKit WEBKIT_DESTDIR = $${ROOT_BUILD_DIR}/lib WEBKIT += wtf javascriptcore webcore -build?(webkit1): WEBKIT += webkitwidgets webkit1 +build?(webkit1): WEBKIT += 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 - QMAKE_INTERNAL_INCLUDED_FILES *= WebKit/WebKitWidgets.pro } build?(webkit2): QMAKE_INTERNAL_INCLUDED_FILES *= WebKit2/Target.pri use?(3D_GRAPHICS): WEBKIT += angle -MODULE = webkitwidgets +MODULE = webkit +CONFIG += creating_module # This is the canonical list of dependencies for the public API of # the QtWebKit library, and will end up in the library's prl file. QT_API_DEPENDS = core gui network -build?(webkit1): QT_API_DEPENDS += widgets # We want the QtWebKit API forwarding includes to live in the root build dir. MODULE_BASE_DIR = $$_PRO_FILE_PWD_ @@ -53,7 +52,7 @@ load(webkit_modules) # For WebKit we don't want that behavior for the libraries, as we want # them to be self-contained in the WebKit build dir. # -CONFIG += force_independent +!production_build: CONFIG += force_independent BASE_TARGET = $$TARGET @@ -63,7 +62,7 @@ load(qt_module) macx:!debug_and_release:debug: TARGET = $$BASE_TARGET # Make sure the install_name of the QtWebKit library point to webkit -macx { +force_independent:macx { # We do our own absolute path so that we can trick qmake into # using the webkit build path instead of the Qt install path. CONFIG -= absolute_library_soname diff --git a/Source/cmake/WebKitFeatures.cmake b/Source/cmake/WebKitFeatures.cmake index b938b2838..3a0486eb2 100644 --- a/Source/cmake/WebKitFeatures.cmake +++ b/Source/cmake/WebKitFeatures.cmake @@ -108,6 +108,7 @@ MACRO (WEBKIT_OPTION_BEGIN) WEBKIT_OPTION_DEFINE(ENABLE_SVG "Toggle SVG support" ON) WEBKIT_OPTION_DEFINE(ENABLE_SVG_DOM_OBJC_BINDINGS "Toggle SVG DOM Objective-C bindings support (implies SVG support)" OFF) WEBKIT_OPTION_DEFINE(ENABLE_SVG_FONTS "Toggle SVG fonts support (imples SVG support)" ON) + WEBKIT_OPTION_DEFINE(ENABLE_TEMPLATE_ELEMENT "Toggle Template support" OFF) WEBKIT_OPTION_DEFINE(ENABLE_TEXT_AUTOSIZING "Toggle Text auto sizing support" OFF) WEBKIT_OPTION_DEFINE(ENABLE_TOUCH_EVENTS "Toggle Touch Events support" OFF) WEBKIT_OPTION_DEFINE(ENABLE_TOUCH_SLIDER "Toggle Touch Slider support" OFF) diff --git a/Source/cmakeconfig.h.cmake b/Source/cmakeconfig.h.cmake index 0a71369f2..05f255826 100644 --- a/Source/cmakeconfig.h.cmake +++ b/Source/cmakeconfig.h.cmake @@ -104,6 +104,7 @@ #cmakedefine01 ENABLE_SVG #cmakedefine01 ENABLE_SVG_DOM_OBJC_BINDINGS #cmakedefine01 ENABLE_SVG_FONTS +#cmakedefine01 ENABLE_TEMPLATE_ELEMENT #cmakedefine01 ENABLE_TEXT_AUTOSIZING #cmakedefine01 ENABLE_TOUCH_EVENTS #cmakedefine01 ENABLE_TOUCH_SLIDER diff --git a/Source/qtwebkit.qdocconf b/Source/qtwebkit.qdocconf index 73a8a8c96..a7a4f695b 100644 --- a/Source/qtwebkit.qdocconf +++ b/Source/qtwebkit.qdocconf @@ -5,20 +5,9 @@ project = qtwebkit description = "Qt WebKit API Documentation" version = 5.0.0 -headerdirs = WebKit/qt/Api WebKit2/UIProcess/API/qt -sourcedirs = WebKit/qt/Api WebKit/qt/docs Source/JavaScriptCore/qt/api WebKit2/UIProcess/API/qt +headerdirs = WebKit/qt/Api WebKit/qt/WidgetApi WebKit2/UIProcess/API/qt +sourcedirs = WebKit/qt/Api WebKit/qt/WidgetApi WebKit/qt/docs Source/JavaScriptCore/qt/api WebKit2/UIProcess/API/qt exampledirs = WebKit/qt/docs imagedirs = WebKit/qt/docs depends += qtcore qtwidgets qtgui qtscript qtdoc qtprintsupport qtxml - -qhp.projects = qtwebkit - -qhp.qtwebkit.file = qtwebkit.qhp -qhp.qtwebkit.namespace = org.qt-project.qtwebkit.500 -qhp.qtwebkit.indexTitle = Qt WebKit Documentation -qhp.qtwebkit.virtualFolder = qtwebkit -qhp.qtwebkit.subprojects = classes -qhp.qtwebkit.subprojects.classes.title = Qt WebKit C++ Classes -qhp.qtwebkit.subprojects.classes.selectors = class fake:headerfile -qhp.qtwebkit.subprojects.classes.sortPages = true diff --git a/Source/sync.profile b/Source/sync.profile index 86031425e..20835f4fa 100644 --- a/Source/sync.profile +++ b/Source/sync.profile @@ -1,8 +1,10 @@ %modules = ( # path to module name map + "QtWebKit" => "$basedir", "QtWebKitWidgets" => "$basedir" ); %moduleheaders = ( # restrict the module headers to those found in relative path - "QtWebKitWidgets" => "WebKit/qt/Api;WebKit2/UIProcess/API/qt", + "QtWebKit" => "WebKit/qt/Api;WebKit2/UIProcess/API/qt", + "QtWebKitWidgets" => "WebKit/qt/WidgetApi", ); %classnames = ( ); diff --git a/Source/widgetsapi.pri b/Source/widgetsapi.pri new file mode 100644 index 000000000..b54bc1d53 --- /dev/null +++ b/Source/widgetsapi.pri @@ -0,0 +1,130 @@ +# ------------------------------------------------------------------- +# Target file for the QtWebKitWidgets dynamic library +# +# See 'Tools/qmake/README' for an overview of the build system +# ------------------------------------------------------------------- + +# Use Qt5's module system +load(qt_build_config) + +TEMPLATE = lib +TARGET = QtWebKitWidgets + +WEBKIT_DESTDIR = $${ROOT_BUILD_DIR}/lib + +SOURCE_DIR = $${ROOT_WEBKIT_DIR}/Source/WebKit + +INCLUDEPATH += \ + $$SOURCE_DIR/qt/Api \ + $$SOURCE_DIR/qt/WidgetApi \ + $$SOURCE_DIR/qt/WebCoreSupport \ + $$SOURCE_DIR/qt/WidgetSupport \ + $$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 +} +QT += webkit + +use?(3D_GRAPHICS): WEBKIT += ANGLE + +WEBKIT += javascriptcore wtf webcore + +MODULE = webkitwidgets + +# We want the QtWebKit API forwarding includes to live in the root build dir. +MODULE_BASE_DIR = $$_PRO_FILE_PWD_ +MODULE_BASE_OUTDIR = $$ROOT_BUILD_DIR + +# This is the canonical list of dependencies for the public API of +# the QtWebKitWidgets library, and will end up in the library's prl file. +QT_API_DEPENDS = core gui widgets network webkit + +# ---------------- Custom developer-build handling ------------------- +# +# The assumption for Qt developer builds is that the module file +# will be put into qtbase/mkspecs/modules, and the libraries into +# qtbase/lib, with rpath/install_name set to the Qt lib dir. +# +# For WebKit we don't want that behavior for the libraries, as we want +# them to be self-contained in the WebKit build dir. +# +!production_build: CONFIG += force_independent + +BASE_TARGET = $$TARGET + +load(qt_module) + +# Allow doing a debug-only build of WebKit (not supported by Qt) +macx:!debug_and_release:debug: TARGET = $$BASE_TARGET + +SOURCES += \ + $$PWD/WebKit/qt/WidgetApi/qgraphicswebview.cpp \ + $$PWD/WebKit/qt/WidgetApi/qwebframe.cpp \ + $$PWD/WebKit/qt/WidgetApi/qwebpage.cpp \ + $$PWD/WebKit/qt/WidgetApi/qwebview.cpp \ + $$PWD/WebKit/qt/WidgetApi/qwebinspector.cpp \ + $$PWD/WebKit/qt/WidgetSupport/QtFallbackWebPopup.cpp \ + $$PWD/WebKit/qt/WidgetSupport/QtWebComboBox.cpp \ + $$PWD/WebKit/qt/WidgetSupport/QWebUndoCommand.cpp \ + $$PWD/WebKit/qt/WidgetSupport/DefaultFullScreenVideoHandler.cpp \ + $$PWD/WebKit/qt/WidgetSupport/InitWebKitQt.cpp \ + $$PWD/WebKit/qt/WidgetSupport/InspectorClientWebPage.cpp \ + $$PWD/WebKit/qt/WidgetSupport/PageClientQt.cpp \ + $$PWD/WebKit/qt/WidgetSupport/QStyleFacadeImp.cpp \ + $$PWD/WebKit/qt/WidgetSupport/QGraphicsWidgetPluginImpl.cpp \ + $$PWD/WebKit/qt/WidgetSupport/QWidgetPluginImpl.cpp + +HEADERS += \ + $$PWD/WebKit/qt/WidgetApi/qgraphicswebview.h \ + $$PWD/WebKit/qt/WidgetApi/qwebframe.h \ + $$PWD/WebKit/qt/WidgetApi/qwebframe_p.h \ + $$PWD/WebKit/qt/WidgetApi/qwebpage.h \ + $$PWD/WebKit/qt/WidgetApi/qwebpage_p.h \ + $$PWD/WebKit/qt/WidgetApi/qwebview.h \ + $$PWD/WebKit/qt/WidgetApi/qwebinspector.h \ + $$PWD/WebKit/qt/WidgetApi/qwebinspector_p.h \ + $$PWD/WebKit/qt/Api/qwebkitplatformplugin.h \ + $$PWD/WebKit/qt/WidgetSupport/InitWebKitQt.h \ + $$PWD/WebKit/qt/WidgetSupport/InspectorClientWebPage.h \ + $$PWD/WebKit/qt/WidgetSupport/DefaultFullScreenVideoHandler.h \ + $$PWD/WebKit/qt/WidgetSupport/QtFallbackWebPopup.h \ + $$PWD/WebKit/qt/WidgetSupport/QtWebComboBox.h \ + $$PWD/WebKit/qt/WidgetSupport/QWebUndoCommand.h \ + $$PWD/WebKit/qt/WidgetSupport/PageClientQt.h \ + $$PWD/WebKit/qt/WidgetSupport/QGraphicsWidgetPluginImpl.h \ + $$PWD/WebKit/qt/WidgetSupport/QStyleFacadeImp.h \ + $$PWD/WebKit/qt/WidgetSupport/QWidgetPluginImpl.h \ + +contains(QT_CONFIG, accessibility) { + SOURCES += $$PWD/WebKit/qt/WidgetApi/qwebviewaccessible.cpp + HEADERS += $$PWD/WebKit/qt/WidgetApi/qwebviewaccessible_p.h +} + +INCLUDEPATH += \ + $$PWD/qt/Api \ + $$PWD/qt/WebCoreSupport + +enable?(VIDEO) { + !use?(QTKIT):!use?(GSTREAMER):use?(QT_MULTIMEDIA) { + HEADERS += $$PWD/WebKit/qt/WidgetSupport/FullScreenVideoWidget.h + SOURCES += $$PWD/WebKit/qt/WidgetSupport/FullScreenVideoWidget.cpp + } +} + diff --git a/Tools/ChangeLog b/Tools/ChangeLog index 40be5de2c..fa9f11631 100644 --- a/Tools/ChangeLog +++ b/Tools/ChangeLog @@ -1,3 +1,265 @@ +2012-11-29 Tommy Widenflycht <tommyw@google.com> + + Speech Recognition API: Update SpeechRecognitionEvent to match the specification + https://bugs.webkit.org/show_bug.cgi?id=103407 + + Reviewed by Adam Barth. + + Changing the mock to use the new results delivery API. + + * DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp: + +2012-11-30 Simon Hausmann <simon.hausmann@digia.com>, Pierre Rossi <pierre.rossi@digia.com> + + [Qt] Separate Qt WebKit into Qt WebKit and Qt WebKit Widgets + https://bugs.webkit.org/show_bug.cgi?id=99314 + + Reviewed by Tor Arne Vestbø. + + This big change separates QtWebKit into QtWebKit and QtWebKitWidgets as + shared libraries. + + It's a big refactoring that mostly involves moving WebCore dependent + code into QtWebKit and accessing it through exported QWebFrameAdapter + and QWebPageAdapter classes. + + * DumpRenderTree/qt/DumpRenderTree.pro: + * DumpRenderTree/qt/DumpRenderTreeQt.cpp: + (WebCore::DumpRenderTree::dump): Adapt to internal API changes. + * MiniBrowser/qt/MiniBrowser.pro: + * Scripts/webkitpy/style/checker.py: Adapt Qt exceptions to new paths. + * Scripts/webkitpy/style/checker_unittest.py: + (GlobalVariablesTest.test_path_rules_specifier): + * WebKitTestRunner/InjectedBundle/Target.pri: + * qmake/mkspecs/features/default_post.prf: + * qmake/mkspecs/features/webkit_modules.prf: + * qmake/mkspecs/modules/webkitwidgets.prf: Removed. + +2012-11-30 Csaba Osztrogonác <ossy@webkit.org> + + [Qt] Unreviewed trivial fix. + + Add empty.cpp back, it was removed accidentally by r129092. + + * qmake/config.tests/gccdepends/empty.cpp: Added. + +2012-11-30 Tor Arne Vestbø <tor.arne.vestbo@digia.com> + + [Qt] Add support for prepare_docs and generate_docs + + Follow-up to changes in Qt in how documentation is built. + + Reviewed by Simon Hausmann. + + * qmake/mkspecs/features/default_post.prf: + +2012-11-30 Zan Dobersek <zandobersek@gmail.com> + + Finally remove webkitpy.common.system.deprecated_logging + https://bugs.webkit.org/show_bug.cgi?id=103624 + + Reviewed by Adam Barth. + + Remove the deprecated logging module and its unit tests now that such logging is not + used anymore in webkitpy. + + The tee and OutputTee classes are moved into a new module, webkitpy.common.system.outputtee. + The tee class is renamed to Tee to conform with the usual guidelines. + + Only unit test for the Tee class is currently provided as the OutputTee is not currently + using the webkitpy Filesystem abstraction that would make its functionality testable. + + * Scripts/webkitpy/common/system/executive.py: tee (now Tee) is now in a new module. + (Executive.run_and_throw_if_fail): + * Scripts/webkitpy/common/system/outputtee.py: Renamed from Tools/Scripts/webkitpy/common/system/deprecated_logging.py. + (Tee): + (Tee.__init__): + (Tee.write): + (OutputTee): + (OutputTee.__init__): + (OutputTee.add_log): + (OutputTee.remove_log): + (OutputTee._open_log_file): + (OutputTee._tee_outputs_to_files): + * Scripts/webkitpy/common/system/outputtee_unittest.py: Renamed from Tools/Scripts/webkitpy/common/system/deprecated_logging_unittest.py. + (SimpleTeeTest): + (SimpleTeeTest.test_simple_tee): + * Scripts/webkitpy/tool/bot/queueengine.py: OutputTee is now in a new module. + * Scripts/webkitpy/webkitpy.pyproj: Remove the deprecated_logging module and related unit test file. + +2012-11-30 Sudarsana Nagineni <sudarsana.nagineni@intel.com> + + [EFL][WK2] Add support for PlatformWebView::simulateRightClick() in TestWebKitAPI + https://bugs.webkit.org/show_bug.cgi?id=103634 + + Reviewed by Gyuyoung Kim. + + Add support for PlatformWebView::simulateRightClick() and enable + WebKit2 API test HitTestResultNodeHandle. + + * TestWebKitAPI/PlatformEfl.cmake: + * TestWebKitAPI/efl/PlatformWebView.cpp: + (TestWebKitAPI::PlatformWebView::simulateRightClick): + (TestWebKitAPI): + +2012-11-30 Mihai Maerean <mmaerean@adobe.com> + + [CSSRegions] when WebKit uses V8, there should be a single variable to store if the CSS Regions feature is enabled + https://bugs.webkit.org/show_bug.cgi?id=101192 + + Reviewed by Hajime Morita. + + Removed the CSS Regions flag in Settings and switched to using the new flag I have added in RuntimeEnabledFeatures. + + Tests: No new tests because there is no functional change. + + * DumpRenderTree/chromium/WebPreferences.cpp: + (WebPreferences::applyTo): + +2012-11-29 Rafael Weinstein <rafaelw@chromium.org> + + [HTMLTemplateElement] Add feature flag + https://bugs.webkit.org/show_bug.cgi?id=103694 + + Reviewed by Adam Barth. + + This flag will guard the implementation of the HTMLTemplateElement. + http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/templates/index.html + + * Scripts/webkitperl/FeatureList.pm: + +2012-11-29 Dirk Pranke <dpranke@chromium.org> + + Ignore errors when removing directories on win32 during autoinstall + https://bugs.webkit.org/show_bug.cgi?id=103699 + + Unreviewed, build fix. + + I think this will work on win32; if not, I'll have to actually + reproduce this :). The problem is that the logilab files + appear to contain a write-protected file, and deleting those + is problematic on windows. + + * Scripts/webkitpy/common/system/autoinstall.py: + (AutoInstaller._install): + (AutoInstaller.install): + +2012-11-29 Dirk Pranke <dpranke@chromium.org> + + webkitpy: autoinstaller is failing on windows + https://bugs.webkit.org/show_bug.cgi?id=103699 + + Unreviewed, build fix. + + We're attempting to create directories with forward slashes in them; + this is a no-no on windows. + + * Scripts/webkitpy/common/system/autoinstall.py: + (AutoInstaller._create_scratch_directory_inner): + +2012-11-29 Dirk Pranke <dpranke@chromium.org> + + Fix python unit tests after r136158 (android port tests failing) + https://bugs.webkit.org/show_bug.cgi?id=103581 + + Unreviewed, build fix. + + The unit tests apparently weren't ran for this patch; we failed + to update the mock executive calls out to adb to determine various + aspects of the environment, and were failing to create drivers. + + * Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py: + (MockRunCommand.mock_run_command_fn): + +2012-11-29 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r136175 and r136177. + http://trac.webkit.org/changeset/136175 + http://trac.webkit.org/changeset/136177 + https://bugs.webkit.org/show_bug.cgi?id=103683 + + Changes did not correct Windows build. (Requested by bfulgham + on #webkit). + + * TestWebKitAPI/Tests/WebCore/win/BitmapImage.cpp: + +2012-11-29 Brent Fulgham <bfulgham@webkit.org> + + [Windows, WinCairo] Unreviewed build correction. Correct debug + build case on build machine. + + * TestWebKitAPI/Tests/WebCore/win/BitmapImage.cpp: + +2012-11-29 Brent Fulgham <bfulgham@webkit.org> + + [Windows, WinCairo] Unreviewed build correction. Hide the + unexported 'notSolidColor' symbol when testing against + the BitmapImage class to avoid having to deal with a + debug-only symbol in the Windows export definition file. + + * TestWebKitAPI/Tests/WebCore/win/BitmapImage.cpp: + +2012-11-29 Peter Beverloo <peter@chromium.org> + + run-perf-tests --chromium-android should not require adb in my path + https://bugs.webkit.org/show_bug.cgi?id=103581 + + Reviewed by Eric Seidel. + + Remove the need to have "adb" available in the path for Layout and Performance + tests. We'll determine the versions of the "adb" version in path (if any) and + the one provided in the Chromium Android checkout. Unless the "adb" available + in the path is newer, the provided version will be used. + + Some other minor nits addressed: + - The path_to_forwarder/path_to_md5sum should not be in the "private overrides" + section, as they're not overriding anything and are used by the driver. + - Make _restart_adb_as_root slightly more robust by waiting for the device + to come back online regardless of the output. + + * Scripts/webkitpy/layout_tests/port/chromium_android.py: + (ChromiumAndroidPort.__init__): + (ChromiumAndroidPort.check_build): + (ChromiumAndroidPort.path_to_adb): + (ChromiumAndroidPort): + (ChromiumAndroidPort.path_to_forwarder): + (ChromiumAndroidPort.path_to_md5sum): + (ChromiumAndroidPort._path_to_helper): + (ChromiumAndroidPort._determine_adb_version): + (ChromiumAndroidPort._get_devices): + (ChromiumAndroidDriver.__init__): + (ChromiumAndroidDriver._setup_md5sum_and_push_data_if_needed): + (ChromiumAndroidDriver._push_executable): + (ChromiumAndroidDriver._restart_adb_as_root): + +2012-11-29 Martin Robinson <mrobinson@igalia.com> + + [GTK] [WebKit2] Embed the HTTP authentication dialog into the WebView + https://bugs.webkit.org/show_bug.cgi?id=103277 + + Reviewed by Carlos Garcia Campos. + + Skip the new WebKit2GtkAuthenticationDialog files so that they are not processed + during gtkdoc generation. + + * gtk/generate-gtkdoc: + (get_webkit2_options): + +2012-11-29 Eric Seidel <eric@webkit.org> + + run-perf-tests --chromium-android fails due to Skia INFO logging + https://bugs.webkit.org/show_bug.cgi?id=103585 + + Reviewed by Adam Barth. + + Ignore all INFO logging from Chromium code. + Also added some basic testing of the ignored-stderr lines code. + + * Scripts/webkitpy/performance_tests/perftest.py: + (PerfTest): + * Scripts/webkitpy/performance_tests/perftest_unittest.py: + (MainTest.test_ignored_stderr_lines): + 2012-11-29 Sudarsana Nagineni <sudarsana.nagineni@intel.com> [EFL][WK2] Add support for PlatformWebView::simulateMouseMove() in TestWebKitAPI diff --git a/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp b/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp index 88143c0ba..40d3cb4ba 100644 --- a/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp +++ b/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp @@ -69,10 +69,11 @@ public: WebVector<float> confidences(static_cast<size_t>(1)); transcripts[0] = m_transcript; confidences[0] = m_confidence; - WebSpeechRecognitionResult res; - res.assign(transcripts, confidences, true); + WebVector<WebSpeechRecognitionResult> finalResults(static_cast<size_t>(1)); + WebVector<WebSpeechRecognitionResult> interimResults; + finalResults[0].assign(transcripts, confidences, true); - m_recognizer->client()->didReceiveResult(m_recognizer->handle(), res, 0, WebVector<WebSpeechRecognitionResult>()); + m_recognizer->client()->didReceiveResults(m_recognizer->handle(), finalResults, interimResults); } private: diff --git a/Tools/DumpRenderTree/chromium/WebPreferences.cpp b/Tools/DumpRenderTree/chromium/WebPreferences.cpp index e13939d32..f64a7b156 100644 --- a/Tools/DumpRenderTree/chromium/WebPreferences.cpp +++ b/Tools/DumpRenderTree/chromium/WebPreferences.cpp @@ -30,6 +30,7 @@ #include "config.h" #include "WebPreferences.h" +#include "WebRuntimeFeatures.h" #include "WebView.h" @@ -200,7 +201,7 @@ void WebPreferences::applyTo(WebView* webView) settings->setDefaultTextEncodingName(defaultTextEncodingName); settings->setDeveloperExtrasEnabled(developerExtrasEnabled); settings->setExperimentalWebGLEnabled(experimentalWebGLEnabled); - settings->setExperimentalCSSRegionsEnabled(experimentalCSSRegionsEnabled); + WebRuntimeFeatures::enableCSSRegions(experimentalCSSRegionsEnabled); settings->setExperimentalCSSGridLayoutEnabled(experimentalCSSGridLayoutEnabled); settings->setExperimentalCSSCustomFilterEnabled(cssCustomFilterEnabled); settings->setJavaEnabled(javaEnabled); diff --git a/Tools/DumpRenderTree/qt/DumpRenderTree.pro b/Tools/DumpRenderTree/qt/DumpRenderTree.pro index 0bd0b16a6..ff696d398 100644 --- a/Tools/DumpRenderTree/qt/DumpRenderTree.pro +++ b/Tools/DumpRenderTree/qt/DumpRenderTree.pro @@ -16,6 +16,7 @@ INCLUDEPATH += \ $$PWD/.. \ $${ROOT_WEBKIT_DIR}/Source/WebCore/platform/qt \ $${ROOT_WEBKIT_DIR}/Source/WebKit/qt/WebCoreSupport \ + $${ROOT_WEBKIT_DIR}/Source/WebKit/qt/WidgetSupport \ $${ROOT_WEBKIT_DIR}/Source/WTF QT = core gui network testlib webkitwidgets widgets diff --git a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp index 88d8ae752..dea0edbc0 100755 --- a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp +++ b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp @@ -915,7 +915,7 @@ void DumpRenderTree::dump() if (m_controller->shouldDumpAsText()) resultString = dumpFramesAsText(mainFrame); else { - resultString = mainFrame->renderTreeDump(); + resultString = DumpRenderTreeSupportQt::frameRenderTreeDump(mainFrame->handle()); resultString += dumpFrameScrollPosition(mainFrame); } if (!resultString.isEmpty()) { diff --git a/Tools/MiniBrowser/qt/BrowserWindow.cpp b/Tools/MiniBrowser/qt/BrowserWindow.cpp index d9de51974..70750c6a7 100644 --- a/Tools/MiniBrowser/qt/BrowserWindow.cpp +++ b/Tools/MiniBrowser/qt/BrowserWindow.cpp @@ -39,8 +39,8 @@ BrowserWindow::BrowserWindow(WindowOptions* options) : m_windowOptions(options) { - setTitle("MiniBrowser"); - setFlags(Qt::Window | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); + setWindowTitle("MiniBrowser"); + setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); setResizeMode(QQuickView::SizeRootObjectToView); // This allows starting MiniBrowser from the build directory without previously defining QML_IMPORT_PATH. @@ -147,7 +147,7 @@ void BrowserWindow::onTitleChanged(QString title) { if (title.isEmpty()) title = QLatin1String("MiniBrowser"); - setTitle(title); + setWindowTitle(title); } void BrowserWindow::zoomIn() diff --git a/Tools/MiniBrowser/qt/MiniBrowser.pro b/Tools/MiniBrowser/qt/MiniBrowser.pro index 0fbddbe13..3db1c7887 100644 --- a/Tools/MiniBrowser/qt/MiniBrowser.pro +++ b/Tools/MiniBrowser/qt/MiniBrowser.pro @@ -30,7 +30,7 @@ DESTDIR = $${ROOT_BUILD_DIR}/bin have?(FONTCONFIG): PKGCONFIG += fontconfig -QT += network gui-private quick quick-private webkitwidgets webkitwidgets-private +QT += network gui-private quick quick-private webkit webkit-private macx: QT += xml RESOURCES += MiniBrowser.qrc diff --git a/Tools/Scripts/webkitperl/FeatureList.pm b/Tools/Scripts/webkitperl/FeatureList.pm index f5d02675c..c104d1f31 100644 --- a/Tools/Scripts/webkitperl/FeatureList.pm +++ b/Tools/Scripts/webkitperl/FeatureList.pm @@ -126,6 +126,7 @@ my ( $svgFontsSupport, $svgSupport, $systemMallocSupport, + $templateTagSupport, $textAutosizingSupport, $tiledBackingStoreSupport, $touchEventsSupport, @@ -393,6 +394,9 @@ my @features = ( { option => "system-malloc", desc => "Toggle system allocator instead of TCmalloc", define => "USE_SYSTEM_MALLOC", default => isWinCE(), value => \$systemMallocSupport }, + { option => "template-tag", desc => "Toggle Templates Tag support", + define => "ENABLE_TEMPLATE_ELEMENT", default => !isAppleWinWebKit(), value => \$templateTagSupport }, + { option => "text-autosizing", desc => "Toggle Text Autosizing support", define => "ENABLE_TEXT_AUTOSIZING", default => 0, value => \$textAutosizingSupport }, diff --git a/Tools/Scripts/webkitpy/common/system/autoinstall.py b/Tools/Scripts/webkitpy/common/system/autoinstall.py index f3045f86b..9d1f8cb2f 100755 --- a/Tools/Scripts/webkitpy/common/system/autoinstall.py +++ b/Tools/Scripts/webkitpy/common/system/autoinstall.py @@ -146,7 +146,7 @@ class AutoInstaller(object): # The tempfile.mkdtemp() method function requires that the # directory corresponding to the "dir" parameter already exist # if it is not None. - scratch_dir = tempfile.mkdtemp(prefix=prefix, dir=self._temp_dir) + scratch_dir = tempfile.mkdtemp(prefix=prefix.replace('/', '.'), dir=self._temp_dir) return scratch_dir def _create_scratch_directory(self, target_name): @@ -337,7 +337,7 @@ class AutoInstaller(object): if os.path.exists(target_path): if os.path.isdir(target_path): - shutil.rmtree(target_path) + shutil.rmtree(target_path, ignore_errors=True) else: os.remove(target_path) @@ -408,7 +408,7 @@ class AutoInstaller(object): % (target_name, target_path, err)) raise Exception(message) finally: - shutil.rmtree(scratch_dir) + shutil.rmtree(scratch_dir, ignore_errors=True) _log.debug('Auto-installed %s to:' % url) _log.debug(' "%s"' % target_path) return True diff --git a/Tools/Scripts/webkitpy/common/system/executive.py b/Tools/Scripts/webkitpy/common/system/executive.py index b1d239090..42a8122d3 100644 --- a/Tools/Scripts/webkitpy/common/system/executive.py +++ b/Tools/Scripts/webkitpy/common/system/executive.py @@ -37,7 +37,7 @@ import subprocess import sys import time -from webkitpy.common.system.deprecated_logging import tee +from webkitpy.common.system.outputtee import Tee from webkitpy.common.system.filesystem import FileSystem @@ -135,7 +135,7 @@ class Executive(object): if quiet: dev_null = open(os.devnull, "w") # FIXME: Does this need an encoding? tee_stdout = dev_null - child_stdout = tee(child_out_file, tee_stdout) + child_stdout = Tee(child_out_file, tee_stdout) exit_code = self._run_command_with_teed_output(args, child_stdout, **kwargs) if quiet: dev_null.close() diff --git a/Tools/Scripts/webkitpy/common/system/deprecated_logging.py b/Tools/Scripts/webkitpy/common/system/outputtee.py index 137535438..12366e865 100644 --- a/Tools/Scripts/webkitpy/common/system/deprecated_logging.py +++ b/Tools/Scripts/webkitpy/common/system/outputtee.py @@ -1,10 +1,10 @@ # Copyright (c) 2009, Google Inc. All rights reserved. # Copyright (c) 2009 Apple 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: -# +# # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above @@ -14,7 +14,7 @@ # * Neither the name of Google Inc. 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -26,26 +26,14 @@ # 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. -# -# WebKit's Python module for logging -# This module is now deprecated in favor of python's built-in logging.py. import codecs import os import sys -def log(string): - print >> sys.stderr, string - - -def error(string): - log("ERROR: %s" % string) - sys.exit(1) - - # Simple class to split output between multiple destinations -class tee: +class Tee: def __init__(self, *files): self.files = files @@ -84,8 +72,8 @@ class OutputTee: self._original_stdout = sys.stdout self._original_stderr = sys.stderr if files and len(files): - sys.stdout = tee(self._original_stdout, *files) - sys.stderr = tee(self._original_stderr, *files) + sys.stdout = Tee(self._original_stdout, *files) + sys.stderr = Tee(self._original_stderr, *files) else: sys.stdout = self._original_stdout sys.stderr = self._original_stderr diff --git a/Tools/Scripts/webkitpy/common/system/deprecated_logging_unittest.py b/Tools/Scripts/webkitpy/common/system/outputtee_unittest.py index b986609bb..6a509f0c2 100644 --- a/Tools/Scripts/webkitpy/common/system/deprecated_logging_unittest.py +++ b/Tools/Scripts/webkitpy/common/system/outputtee_unittest.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009 Google Inc. All rights reserved. +# Copyright (C) 2012 Zan Dobersek <zandobersek@gmail.com> # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are @@ -26,35 +26,18 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -import os import StringIO -import tempfile import unittest -from webkitpy.common.system.executive import ScriptError -from webkitpy.common.system.deprecated_logging import * +from webkitpy.common.system.outputtee import Tee, OutputTee -class LoggingTest(unittest.TestCase): - def assert_log_equals(self, log_input, expected_output): - original_stderr = sys.stderr - test_stderr = StringIO.StringIO() - sys.stderr = test_stderr +class SimpleTeeTest(unittest.TestCase): + def test_simple_tee(self): + file1, file2 = StringIO.StringIO(), StringIO.StringIO() + tee = Tee(file1, file2) + tee.write("foo bar\n") + tee.write("baz\n") - try: - log(log_input) - actual_output = test_stderr.getvalue() - finally: - sys.stderr = original_stderr - - self.assertEqual(actual_output, expected_output, "log(\"%s\") expected: %s actual: %s" % (log_input, expected_output, actual_output)) - - def test_log(self): - self.assert_log_equals("test", "test\n") - - # Test that log() does not throw an exception when passed an object instead of a string. - self.assert_log_equals(ScriptError(message="ScriptError"), "ScriptError\n") - - -if __name__ == '__main__': - unittest.main() + self.assertEqual(file1.getvalue(), "foo bar\nbaz\n") + self.assertEqual(file2.getvalue(), file1.getvalue()) diff --git a/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py b/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py index c18cd0941..91cd3100c 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py @@ -32,6 +32,7 @@ import logging import os import re import subprocess +import sys import threading import time @@ -43,7 +44,6 @@ from webkitpy.layout_tests.port import server_process _log = logging.getLogger(__name__) - # The root directory for test resources, which has the same structure as the # source root directory of Chromium. # This path is defined in Chromium's base/test/test_support_android.cc. @@ -155,6 +155,9 @@ MD5SUM_DEVICE_PATH = '/data/local/tmp/' + MD5SUM_DEVICE_FILE_NAME class ChromiumAndroidPort(chromium.ChromiumPort): port_name = 'chromium-android' + # Avoid initializing the adb path [worker count]+1 times by storing it as a static member. + _adb_path = None + FALLBACK_PATHS = [ 'chromium-android', 'chromium-linux', @@ -208,8 +211,8 @@ class ChromiumAndroidPort(chromium.ChromiumPort): def check_build(self, needs_http): result = super(ChromiumAndroidPort, self).check_build(needs_http) - result = self._check_file_exists(self._path_to_md5sum(), 'md5sum utility') and result - result = self._check_file_exists(self._path_to_forwarder(), 'forwarder utility') and result + result = self._check_file_exists(self.path_to_md5sum(), 'md5sum utility') and result + result = self._check_file_exists(self.path_to_forwarder(), 'forwarder utility') and result if not result: _log.error('For complete Android build requirements, please see:') _log.error('') @@ -260,6 +263,33 @@ class ChromiumAndroidPort(chromium.ChromiumPort): # Override to return the actual DumpRenderTree command line. return self.create_driver(0)._drt_cmd_line(self.get_option('pixel_tests'), []) + def path_to_adb(self): + if ChromiumAndroidPort._adb_path: + return ChromiumAndroidPort._adb_path + + provided_adb_path = self.path_from_chromium_base('third_party', 'android_tools', 'sdk', 'platform-tools', 'adb') + + path_version = self._determine_adb_version('adb') + provided_version = self._determine_adb_version(provided_adb_path) + assert provided_version, 'The checked in Android SDK is missing. Are you sure you ran update-webkit --chromium-android?' + + if not path_version: + ChromiumAndroidPort._adb_path = provided_adb_path + elif provided_version > path_version: + # FIXME: The Printer isn't initialized when this is called, so using _log would just show an unitialized logger error. + print >> sys.stderr, 'The "adb" version in your path is older than the one checked in, consider updating your local Android SDK. Using the checked in one.' + ChromiumAndroidPort._adb_path = provided_adb_path + else: + ChromiumAndroidPort._adb_path = 'adb' + + return ChromiumAndroidPort._adb_path + + def path_to_forwarder(self): + return self._build_path('forwarder') + + def path_to_md5sum(self): + return self._build_path(MD5SUM_DEVICE_FILE_NAME) + # Overridden private functions. def _build_path(self, *comps): @@ -280,12 +310,6 @@ class ChromiumAndroidPort(chromium.ChromiumPort): def _path_to_helper(self): return None - def _path_to_forwarder(self): - return self._build_path('forwarder') - - def _path_to_md5sum(self): - return self._build_path(MD5SUM_DEVICE_FILE_NAME) - def _path_to_image_diff(self): return self._host_port._path_to_image_diff() @@ -309,10 +333,21 @@ class ChromiumAndroidPort(chromium.ChromiumPort): # Local private functions. + def _determine_adb_version(self, adb_path): + re_version = re.compile('^.*version ([\d\.]+)$') + try: + output = self._executive.run_command([adb_path, 'version'], error_handler=self._executive.ignore_error) + except OSError: + return None + result = re_version.match(output) + if not output or not result: + return None + return [int(n) for n in result.group(1).split('.')] + def _get_devices(self): if not self._devices: re_device = re.compile('^([a-zA-Z0-9_:.-]+)\tdevice$', re.MULTILINE) - result = self._executive.run_command(['adb', 'devices'], error_handler=self._executive.ignore_error) + result = self._executive.run_command([self.path_to_adb(), 'devices'], error_handler=self._executive.ignore_error) self._devices = re_device.findall(result) if not self._devices: raise AssertionError('No devices attached. Result of "adb devices": %s' % result) @@ -338,14 +373,14 @@ class ChromiumAndroidDriver(driver.Driver): self._has_setup = False self._original_governors = {} self._device_serial = port._get_device_serial(worker_number) - self._adb_command = ['adb', '-s', self._device_serial] + self._adb_command = [port.path_to_adb(), '-s', self._device_serial] def __del__(self): self._teardown_performance() super(ChromiumAndroidDriver, self).__del__() def _setup_md5sum_and_push_data_if_needed(self): - self._md5sum_path = self._port._path_to_md5sum() + self._md5sum_path = self._port.path_to_md5sum() if not self._file_exists_on_device(MD5SUM_DEVICE_PATH): if not self._push_to_device(self._md5sum_path, MD5SUM_DEVICE_PATH): raise AssertionError('Could not push md5sum to device') @@ -403,7 +438,7 @@ class ChromiumAndroidDriver(driver.Driver): self._push_to_device(host_file, device_file) def _push_executable(self): - self._push_file_if_needed(self._port._path_to_forwarder(), DEVICE_FORWARDER_PATH) + self._push_file_if_needed(self._port.path_to_forwarder(), DEVICE_FORWARDER_PATH) self._push_file_if_needed(self._port._build_path('DumpRenderTree.pak'), DEVICE_DRT_DIR + 'DumpRenderTree.pak') self._push_file_if_needed(self._port._build_path('DumpRenderTree_resources'), DEVICE_DRT_DIR + 'DumpRenderTree_resources') self._push_file_if_needed(self._port._build_path('android_main_fonts.xml'), DEVICE_DRT_DIR + 'android_main_fonts.xml') @@ -433,11 +468,12 @@ class ChromiumAndroidDriver(driver.Driver): 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: + elif not 'restarting adbd as root' in output: self._log_error('Unrecognized output from adb root: %s' % output) + # Regardless the output, give the device a moment to come back online. + self._run_adb_command(['wait-for-device']) + def _run_adb_command(self, cmd, ignore_error=False): self._log_debug('Run adb command: ' + str(cmd)) if ignore_error: diff --git a/Tools/Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py b/Tools/Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py index 856ac3151..cfbc646df 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py @@ -50,10 +50,12 @@ class MockRunCommand(object): self._mock_ls_tombstones = '' def mock_run_command_fn(self, args): - if args[0] != 'adb': + if not args[0].endswith('adb'): return '' if args[1] == 'devices': return self._mock_devices_output + if args[1] == 'version': + return 'version 1.0' assert len(args) > 3 assert args[1] == '-s' diff --git a/Tools/Scripts/webkitpy/performance_tests/perftest.py b/Tools/Scripts/webkitpy/performance_tests/perftest.py index 623aef341..41115e41d 100644 --- a/Tools/Scripts/webkitpy/performance_tests/perftest.py +++ b/Tools/Scripts/webkitpy/performance_tests/perftest.py @@ -103,7 +103,9 @@ class PerfTest(object): _lines_to_ignore_in_stderr = [ re.compile(r'^Unknown option:'), - re.compile(r'^\[WARNING:proxy_service.cc')] + re.compile(r'^\[WARNING:proxy_service.cc'), + re.compile(r'^\[INFO:'), + ] def _should_ignore_line_in_stderr(self, line): return self._should_ignore_line(self._lines_to_ignore_in_stderr, line) diff --git a/Tools/Scripts/webkitpy/performance_tests/perftest_unittest.py b/Tools/Scripts/webkitpy/performance_tests/perftest_unittest.py index 9e275b635..741e8b644 100755 --- a/Tools/Scripts/webkitpy/performance_tests/perftest_unittest.py +++ b/Tools/Scripts/webkitpy/performance_tests/perftest_unittest.py @@ -99,6 +99,24 @@ class MainTest(unittest.TestCase): self.assertEqual(actual_stderr, '') self.assertEqual(actual_logs, 'some-unrecognizable-line\n') + def test_ignored_stderr_lines(self): + test = PerfTest(MockPort(), 'some-test', '/path/some-dir/some-test') + ignored_lines = [ + "Unknown option: --foo-bar", + "[WARNING:proxy_service.cc] bad moon a-rising", + "[INFO:SkFontHost_android.cpp(1158)] Use Test Config File Main /data/local/tmp/drt/android_main_fonts.xml, Fallback /data/local/tmp/drt/android_fallback_fonts.xml, Font Dir /data/local/tmp/drt/fonts/", + ] + for line in ignored_lines: + self.assertTrue(test._should_ignore_line_in_stderr(line)) + + non_ignored_lines = [ + "Should not be ignored", + "[WARNING:chrome.cc] Something went wrong", + "[ERROR:main.cc] The sky has fallen", + ] + for line in non_ignored_lines: + self.assertFalse(test._should_ignore_line_in_stderr(line)) + class TestPageLoadingPerfTest(unittest.TestCase): class MockDriver(object): diff --git a/Tools/Scripts/webkitpy/style/checker.py b/Tools/Scripts/webkitpy/style/checker.py index 282c33b70..7a1518b5b 100644 --- a/Tools/Scripts/webkitpy/style/checker.py +++ b/Tools/Scripts/webkitpy/style/checker.py @@ -149,7 +149,8 @@ _PATH_RULES_SPECIFIER = [ ([# The Qt APIs use Qt declaration style, it puts the * to # the variable name, not to the class. - "Source/WebKit/qt/Api/"], + "Source/WebKit/qt/Api/", + "Source/WebKit/qt/WidgetApi/"], ["-readability/naming", "-whitespace/declaration"]), diff --git a/Tools/Scripts/webkitpy/style/checker_unittest.py b/Tools/Scripts/webkitpy/style/checker_unittest.py index 3de39ebb0..3b7d94c02 100755 --- a/Tools/Scripts/webkitpy/style/checker_unittest.py +++ b/Tools/Scripts/webkitpy/style/checker_unittest.py @@ -227,7 +227,7 @@ class GlobalVariablesTest(unittest.TestCase): "readability/naming") # Test if Qt exceptions are indeed working - assertCheck("Source/WebKit/qt/Api/qwebpage.cpp", + assertCheck("Source/WebKit/qt/WidgetApi/qwebpage.cpp", "readability/braces") assertCheck("Source/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp", "readability/braces") @@ -235,7 +235,7 @@ class GlobalVariablesTest(unittest.TestCase): "readability/braces") assertCheck("Source/WebKit/qt/examples/platformplugin/WebPlugin.cpp", "readability/braces") - assertNoCheck("Source/WebKit/qt/Api/qwebpage.cpp", + assertNoCheck("Source/WebKit/qt/WidgetApi/qwebpage.cpp", "readability/naming") assertNoCheck("Source/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp", "readability/naming") diff --git a/Tools/Scripts/webkitpy/tool/bot/queueengine.py b/Tools/Scripts/webkitpy/tool/bot/queueengine.py index 0d2c97820..6d5576e28 100644 --- a/Tools/Scripts/webkitpy/tool/bot/queueengine.py +++ b/Tools/Scripts/webkitpy/tool/bot/queueengine.py @@ -34,7 +34,7 @@ import traceback from datetime import datetime, timedelta from webkitpy.common.system.executive import ScriptError -from webkitpy.common.system.deprecated_logging import OutputTee +from webkitpy.common.system.outputtee import OutputTee _log = logging.getLogger(__name__) diff --git a/Tools/Scripts/webkitpy/webkitpy.pyproj b/Tools/Scripts/webkitpy/webkitpy.pyproj index 0bff5fce6..588cfeaf5 100644 --- a/Tools/Scripts/webkitpy/webkitpy.pyproj +++ b/Tools/Scripts/webkitpy/webkitpy.pyproj @@ -130,8 +130,6 @@ <Compile Include="common\system\autoinstall.py" /> <Compile Include="common\system\crashlogs.py" /> <Compile Include="common\system\crashlogs_unittest.py" /> - <Compile Include="common\system\deprecated_logging.py" /> - <Compile Include="common\system\deprecated_logging_unittest.py" /> <Compile Include="common\system\environment.py" /> <Compile Include="common\system\environment_unittest.py" /> <Compile Include="common\system\executive.py" /> diff --git a/Tools/TestWebKitAPI/PlatformEfl.cmake b/Tools/TestWebKitAPI/PlatformEfl.cmake index e301968fe..b1aa579de 100644 --- a/Tools/TestWebKitAPI/PlatformEfl.cmake +++ b/Tools/TestWebKitAPI/PlatformEfl.cmake @@ -55,6 +55,7 @@ SET(test_webkit2_api_BINARIES FrameMIMETypeHTML FrameMIMETypePNG GetInjectedBundleInitializationUserDataCallback + HitTestResultNodeHandle InjectedBundleBasic InjectedBundleInitializationUserDataCallbackWins LoadAlternateHTMLStringWithNonDirectoryURL @@ -90,7 +91,6 @@ ADD_DEFINITIONS(-DTHEME_DIR="${THEME_BINARY_DIR}") # Tests disabled because of missing features on the test harness: # -# HitTestResultNodeHandle # ResponsivenessTimerDoesntFireEarly # SpacebarScrolling # diff --git a/Tools/TestWebKitAPI/efl/PlatformWebView.cpp b/Tools/TestWebKitAPI/efl/PlatformWebView.cpp index cdc97bd13..08407c6a3 100644 --- a/Tools/TestWebKitAPI/efl/PlatformWebView.cpp +++ b/Tools/TestWebKitAPI/efl/PlatformWebView.cpp @@ -102,4 +102,13 @@ void PlatformWebView::simulateMouseMove(unsigned x, unsigned y) evas_event_feed_mouse_move(evas, x, y, 0, 0); } +void PlatformWebView::simulateRightClick(unsigned x, unsigned y) +{ + Evas* evas = ecore_evas_get(m_window); + evas_object_show(m_view); + evas_event_feed_mouse_move(evas, x, y, 0, 0); + evas_event_feed_mouse_down(evas, 3, EVAS_BUTTON_NONE, 0, 0); + evas_event_feed_mouse_up(evas, 3, EVAS_BUTTON_NONE, 0, 0); +} + } // namespace TestWebKitAPI diff --git a/Tools/WebKitTestRunner/InjectedBundle/Target.pri b/Tools/WebKitTestRunner/InjectedBundle/Target.pri index d7305e3ac..b0091194a 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/Target.pri +++ b/Tools/WebKitTestRunner/InjectedBundle/Target.pri @@ -48,7 +48,7 @@ HEADERS += \ DESTDIR = $${ROOT_BUILD_DIR}/lib -QT += widgets webkitwidgets +QT += widgets webkit WEBKIT += wtf javascriptcore webcore diff --git a/Tools/gtk/generate-gtkdoc b/Tools/gtk/generate-gtkdoc index d40daebec..3edd13f3e 100755 --- a/Tools/gtk/generate-gtkdoc +++ b/Tools/gtk/generate-gtkdoc @@ -98,6 +98,7 @@ def get_webkit2_options(): 'ignored_files': glob.glob(src_path('*Private.h')) + \ glob.glob(src_path('*Client*')) + \ glob.glob(src_path('WebKitWebViewBaseAccessible.*')) + \ + glob.glob(src_path('WebKit2GtkAuthenticationDialog.*')) + \ glob.glob(src_path('WebKitGeolocationProvider.*')) + \ glob.glob(src_path('WebKitTextChecker.*')) + \ glob.glob(derived_sources_path('webkit2gtk', 'webkit2', 'WebKitMarshal.*')) + \ diff --git a/Tools/qmake/config.tests/gccdepends/empty.cpp b/Tools/qmake/config.tests/gccdepends/empty.cpp new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/Tools/qmake/config.tests/gccdepends/empty.cpp diff --git a/Tools/qmake/mkspecs/features/default_post.prf b/Tools/qmake/mkspecs/features/default_post.prf index dc5e438c1..589671883 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) - !contains(QT, webkitwidgets): DEFINES += BUILDING_WEBKIT + !contains(QT, webkit)|equals(MODULE, 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. @@ -172,12 +172,12 @@ contains(TEMPLATE, lib) { } } -contains(QT, webkitwidgets) { +contains(QT, webkit)|contains(QT, webkitwidgets) { # In addition to the main shared QtWebKit library we also # need to link to any intermediate shared libraries. force_static_libs_as_shared { WEBKIT += wtf javascriptcore webcore - build?(webkit1): WEBKIT += webkitwidgets webkit1 + build?(webkit1): WEBKIT += webkit1 build?(webkit2): WEBKIT += webkit2 } @@ -193,12 +193,12 @@ defineTest(needToLink) { contains(libraries, $$TARGET): return(true) # Or anything that uses QtWebKit in this special config - contains(QT, webkitwidgets): return(true) + contains(QT, webkit): return(true) } # Lastly, we allow apps (jsc) to link directly to the intermediate # libraries intead of using the exported symbols from QtWebKit. - contains(TEMPLATE, app):!contains(QT, webkitwidgets): return(true) + contains(TEMPLATE, app):!contains(QT, webkit):!contains(QT, webkitwidgets): return(true) # Anything else should just get include paths, etc, not link return(false) @@ -247,7 +247,7 @@ root_project_file { # qmake_all and generate all the derived sources, just to # build documentation. previous_subdir = - doc_targets = docs install_docs uninstall_docs + doc_targets = docs install_docs uninstall_docs prepare_docs generate_docs for(subdir, SUBDIRS) { equals(subdir, QtWebKit) { for(doc_target, doc_targets) { diff --git a/Tools/qmake/mkspecs/features/webkit_modules.prf b/Tools/qmake/mkspecs/features/webkit_modules.prf index 505b82658..189387835 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 = WebKitWidgets WebKit1 WebKit2 WebCore ANGLE JavaScriptCore WTF +libraries = WebKit1 WebKit2 WebCore ANGLE JavaScriptCore WTF for(library, libraries) { contains(WEBKIT, $$lower($$library)) { WEBKIT -= $$lower($$library) @@ -34,11 +34,9 @@ for(library, WEBKIT) { # Anything not linking dynamically to QtWebKit should make sure to have its export # macros synchronized with the code that it will be linked with statically. - !contains(QT, webkitwidgets): DEFINES += STATICALLY_LINKED_WITH_$$library + !contains(QT, webkit): DEFINES += STATICALLY_LINKED_WITH_$$library } -!isEmpty(MODULE): CONFIG += creating_module - creating_module { # Sanitize PKGCONFIG as we don't want any of these libraries # to end up in as public API dependenices in the QtWebKit prl file. diff --git a/Tools/qmake/mkspecs/modules/webkitwidgets.prf b/Tools/qmake/mkspecs/modules/webkitwidgets.prf deleted file mode 100644 index ca1643c8d..000000000 --- a/Tools/qmake/mkspecs/modules/webkitwidgets.prf +++ /dev/null @@ -1,9 +0,0 @@ -# ------------------------------------------------------------------- -# 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 136119 +revision 136242 You can browse the base of this snapshot at - http://trac.webkit.org/browser/trunk?rev=136119 + http://trac.webkit.org/browser/trunk?rev=136242 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 fba5b997a..876d55412 100644 --- a/WebKit.pro +++ b/WebKit.pro @@ -32,10 +32,6 @@ 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) { |