diff options
author | Steve Block <steveblock@google.com> | 2010-08-04 11:41:34 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-08-09 12:04:44 +0100 |
commit | db14019a23d96bc8a444b6576a5da8bd1cfbc8b0 (patch) | |
tree | 9f793c5b0f5e1f2aca8247158920e2c4bf962bbf | |
parent | bf916837aa84f1e4b00e6ed6268516c2acd27545 (diff) | |
download | external_webkit-db14019a23d96bc8a444b6576a5da8bd1cfbc8b0.zip external_webkit-db14019a23d96bc8a444b6576a5da8bd1cfbc8b0.tar.gz external_webkit-db14019a23d96bc8a444b6576a5da8bd1cfbc8b0.tar.bz2 |
Merge WebKit at r64523 : Initial merge by git.
Change-Id: Ibb796c6802e757b1d9b40f58205cfbe4da95fcd4
579 files changed, 19512 insertions, 4585 deletions
diff --git a/JavaScriptCore/CMakeLists.txt b/JavaScriptCore/CMakeLists.txt index 08a0e72..c33146d 100644 --- a/JavaScriptCore/CMakeLists.txt +++ b/JavaScriptCore/CMakeLists.txt @@ -265,5 +265,6 @@ TARGET_LINK_LIBRARIES(${JavaScriptCore_LIBRARY_NAME} ${JavaScriptCore_LIBRARIES} ADD_TARGET_PROPERTIES(${JavaScriptCore_LIBRARY_NAME} LINK_FLAGS ${JavaScriptCore_LINK_FLAGS}) IF (SHARED_CORE) + SET_TARGET_PROPERTIES(${JavaScriptCore_LIBRARY_NAME} PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR}) INSTALL(TARGETS ${JavaScriptCore_LIBRARY_NAME} DESTINATION lib) ENDIF () diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog index 2e8c1d1..aafb0aa 100644 --- a/JavaScriptCore/ChangeLog +++ b/JavaScriptCore/ChangeLog @@ -1,3 +1,284 @@ +2010-08-02 Mahesh Kulkarni <mahesh.kulkarni@nokia.com> + + Reviewed by Simon Hausmann. + + [QT] build fix for symbian + https://bugs.webkit.org/show_bug.cgi?id=43234 + + 1) wrong order of passing param's + 2) static_cast complains on symbian so using reinterpret_cast + + No new tests added. Just a build fix for qt symbian + + * wtf/PageAllocation.cpp: + (WTF::PageAllocation::commit): + (WTF::PageAllocation::decommit): + (WTF::PageAllocation::reserve): + +2010-07-30 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Simon Fraser. + + Enabling view modes to all platforms + https://bugs.webkit.org/show_bug.cgi?id=37505 + + Removing ENABLE_WIDGETS_10_SUPPORT flag. + + As view mode media feature is not part of widget 1.0 specification + any more the ENABLE_WIDGETS_10_SUPPORT flag may be removed. The only use + of this flag was related to view mode media feature implementation in Qt. + + * wtf/Platform.h: + +2010-07-30 Andy Estes <aestes@apple.com> + + Reviewed by David Kilzer. + + Add Xcode support for compiling WebKit against iOS SDKs. + https://bugs.webkit.org/show_bug.cgi?id=42796 + + * Configurations/Base.xcconfig: + * Configurations/DebugRelease.xcconfig: + * Configurations/FeatureDefines.xcconfig: + +2010-07-30 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by Davin Levin. + + Added a yield() function. + https://bugs.webkit.org/show_bug.cgi?id=42843 + + * JavaScriptCore.exp: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * wtf/Threading.h: + * wtf/ThreadingPthreads.cpp: + (WTF::yield): + * wtf/ThreadingWin.cpp: + (WTF::yield): + * wtf/gtk/ThreadingGtk.cpp: + (WTF::yield): + * wtf/qt/ThreadingQt.cpp: + (WTF::yield): + +2010-07-30 Rafael Antognolli <antognolli@profusion.mobi> + + Reviewed by Antonio Gomes. + + [EFL] Add library version and soname to EFL generated libraries and binary. + https://bugs.webkit.org/show_bug.cgi?id=43212 + + Add version and soname to libjavascriptcore.so and libwtf.so in case of + linking as shared libraries, and version to jsc executable. + + * CMakeLists.txt: + * jsc/CMakeLists.txt: + * wtf/CMakeLists.txt: + +2010-07-30 Mahesh Kulkarni <mahesh.kulkarni@nokia.com> + + Reviewed by Simon Hausmann. + + [QT] build fix for symbian + https://bugs.webkit.org/show_bug.cgi?id=43234 + + * wtf/PageAllocation.h: + (WTF::PageAllocation::PageAllocation): + +2010-07-29 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r64313. + http://trac.webkit.org/changeset/64313 + https://bugs.webkit.org/show_bug.cgi?id=43233 + + Some Chromium bots are not happy with it for some unknown + reason. (Requested by dumi on #webkit). + + * JavaScriptCore.exp: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * wtf/Threading.h: + * wtf/ThreadingPthreads.cpp: + * wtf/ThreadingWin.cpp: + * wtf/gtk/ThreadingGtk.cpp: + * wtf/qt/ThreadingQt.cpp: + +2010-07-29 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r64302. + http://trac.webkit.org/changeset/64302 + https://bugs.webkit.org/show_bug.cgi?id=43223 + + Assertion is bogus (Requested by olliej on #webkit). + + * assembler/ARMAssembler.cpp: + (JSC::ARMAssembler::executableCopy): + * assembler/AssemblerBuffer.h: + (JSC::AssemblerBuffer::putShortUnchecked): + (JSC::AssemblerBuffer::putIntUnchecked): + (JSC::AssemblerBuffer::putInt64Unchecked): + * jit/JITStubs.cpp: + * pcre/pcre_compile.cpp: + (jsRegExpCompile): + * wtf/FastMalloc.cpp: + (WTF::PageHeapAllocator::New): + (WTF::TCMalloc_Central_FreeList::Populate): + * wtf/MD5.cpp: + (WTF::reverseBytes): + (WTF::MD5::addBytes): + (WTF::MD5::checksum): + * wtf/StdLibExtras.h: + * wtf/Vector.h: + (WTF::VectorBuffer::inlineBuffer): + * wtf/qt/StringQt.cpp: + (WebCore::String::String): + +2010-07-29 Michael Saboff <msaboff@apple.com> + + Reviewed by Gavin Barraclough. + + Changed the handling for removing and adding elements at the front + of an array. The code now keeps a bias that indicates the amount of + JSValue sized holes are prior to the ArrayStorage block. This means + that shift operations are now memmove's of the header part of + the ArrayStorage and unshift operations are similar, but may require a + realloc first to create the space. Similar operations are performed + for special cases of splice and slice. + Also optimized the new Array(size) case so that we don't allocate and + initialize array elements until the JS code starts using elements. + The array growth code is slightly more aggressive for initial growth + based on size growth of any previous array. + + * Configurations/JavaScriptCore.xcconfig: + * jit/JITPropertyAccess.cpp: + (JSC::JIT::emit_op_get_by_val): + (JSC::JIT::emit_op_put_by_val): + (JSC::JIT::privateCompilePatchGetArrayLength): + * jit/JITPropertyAccess32_64.cpp: + (JSC::JIT::emit_op_get_by_val): + (JSC::JIT::emit_op_put_by_val): + (JSC::JIT::privateCompilePatchGetArrayLength): + * runtime/ArrayPrototype.cpp: + (JSC::arrayProtoFuncShift): + (JSC::arrayProtoFuncSplice): + (JSC::arrayProtoFuncUnShift): + * runtime/JSArray.cpp: + (JSC::JSArray::JSArray): + (JSC::JSArray::~JSArray): + (JSC::JSArray::getOwnPropertySlot): + (JSC::JSArray::getOwnPropertyDescriptor): + (JSC::JSArray::put): + (JSC::JSArray::putSlowCase): + (JSC::JSArray::deleteProperty): + (JSC::JSArray::getOwnPropertyNames): + (JSC::JSArray::getNewVectorLength): + (JSC::JSArray::increaseVectorLength): + (JSC::JSArray::increaseVectorPrefixLength): + (JSC::JSArray::setLength): + (JSC::JSArray::pop): + (JSC::JSArray::push): + (JSC::JSArray::shiftCount): + (JSC::JSArray::unshiftCount): + (JSC::JSArray::sortNumeric): + (JSC::JSArray::sort): + (JSC::JSArray::fillArgList): + (JSC::JSArray::copyToRegisters): + (JSC::JSArray::compactForSorting): + (JSC::JSArray::subclassData): + (JSC::JSArray::setSubclassData): + (JSC::JSArray::checkConsistency): + * runtime/JSArray.h: + (JSC::JSArray::length): + (JSC::JSArray::canGetIndex): + (JSC::JSArray::getIndex): + (JSC::JSArray::setIndex): + (JSC::JSArray::uncheckedSetIndex): + (JSC::JSArray::arrayStorage): + (JSC::JSArray::setArrayStorage): + (JSC::JSArray::markChildrenDirect): + +2010-07-29 Michael Saboff <msaboff@apple.com> + + Reviewed by Darin Adler. + + Changed MINIMUM_CELL_SIZE to be fixed at 64 bytes. + + * runtime/Collector.h: + +2010-07-28 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by David Levin. + + Added a yield() function. + https://bugs.webkit.org/show_bug.cgi?id=42843 + + * JavaScriptCore.exp: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * wtf/Threading.h: + * wtf/ThreadingPthreads.cpp: + (WTF::yield): + * wtf/ThreadingWin.cpp: + (WTF::yield): + * wtf/gtk/ThreadingGtk.cpp: + (WTF::yield): + * wtf/qt/ThreadingQt.cpp: + (WTF::yield): + +2010-07-29 Michael Saboff <msaboff@apple.com> + + Reviewed by Oliver Hunt. + + Fixed issue where RegExp greedy jit code loops when no input is + consumed. Changed the code to only loop if some input was consumed, + but fall through if we successfully match an alternative that + doesn't consume any input. + https://bugs.webkit.org/show_bug.cgi?id=42664 + + * yarr/RegexJIT.cpp: + (JSC::Yarr::RegexGenerator::generateParenthesesGreedyNoBacktrack): + +2010-07-29 Gabor Loki <loki@webkit.org> + + Reviewed by Gavin Barraclough. + + Avoid increasing required alignment of target type warning on ARM + https://bugs.webkit.org/show_bug.cgi?id=38045 + + The reinterpret_cast<Type1*>([pointer to Type2]) expressions - where + sizeof(Type1) > sizeof(Type2) - cause the following warning on ARM: + increases required alignment of target type warnings. + Casting the type of [pointer to Type2] object to void* bypasses the + warning. + + * assembler/ARMAssembler.cpp: + (JSC::ARMAssembler::executableCopy): + * assembler/AssemblerBuffer.h: + (JSC::AssemblerBuffer::putShortUnchecked): + (JSC::AssemblerBuffer::putIntUnchecked): + (JSC::AssemblerBuffer::putInt64Unchecked): + * jit/JITStubs.cpp: + * pcre/pcre_compile.cpp: + (jsRegExpCompile): + * wtf/FastMalloc.cpp: + (WTF::PageHeapAllocator::New): + (WTF::TCMalloc_Central_FreeList::Populate): + * wtf/MD5.cpp: + (WTF::reverseBytes): + (WTF::MD5::addBytes): + (WTF::MD5::checksum): + * wtf/StdLibExtras.h: + (reinterpret_cast_ptr): + * wtf/Vector.h: + (WTF::VectorBuffer::inlineBuffer): + * wtf/qt/StringQt.cpp: + (WebCore::String::String): + +2010-07-29 Martin Robinson <mrobinson@igalia.com> + + Unreviewed build fix. + + Include a missing header in the source list to fix 'make dist.' + + * GNUmakefile.am: Include missing header. + 2010-07-28 Gavin Barraclough <barraclough@apple.com> Reviewed by Darin Adler. diff --git a/JavaScriptCore/Configurations/Base.xcconfig b/JavaScriptCore/Configurations/Base.xcconfig index 4854b64..72de2fe 100644 --- a/JavaScriptCore/Configurations/Base.xcconfig +++ b/JavaScriptCore/Configurations/Base.xcconfig @@ -1,4 +1,4 @@ -// Copyright (C) 2009 Apple Inc. All rights reserved. +// Copyright (C) 2009, 2010 Apple Inc. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions @@ -36,7 +36,8 @@ GCC_ENABLE_SYMBOL_SEPARATION = NO; GCC_FAST_OBJC_DISPATCH = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; GCC_INLINES_ARE_PRIVATE_EXTERN = YES; -GCC_MODEL_TUNING = G5; +GCC_MODEL_TUNING = $(GCC_MODEL_TUNING_$(REAL_PLATFORM_NAME)); +GCC_MODEL_TUNING_macosx = G5; GCC_OBJC_CALL_CXX_CDTORS = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREPROCESSOR_DEFINITIONS = $(DEBUG_DEFINES) HAVE_DTRACE=$(HAVE_DTRACE) WEBKIT_VERSION_MIN_REQUIRED=WEBKIT_VERSION_LATEST $(GCC_PREPROCESSOR_DEFINITIONS); @@ -49,15 +50,21 @@ GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; LINKER_DISPLAYS_MANGLED_NAMES = YES; PREBINDING = NO; -VALID_ARCHS = i386 ppc x86_64 ppc64 $(ARCHS_UNIVERSAL_IPHONE_OS); -WARNING_CFLAGS = $(WARNING_CFLAGS_$(CURRENT_ARCH)); -WARNING_CFLAGS_BASE = -Wall -Wextra -Wcast-align -Wcast-qual -Wchar-subscripts -Wextra-tokens -Wformat=2 -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wpacked -Wpointer-arith -Wredundant-decls -Wundef -Wwrite-strings; -WARNING_CFLAGS_ = $(WARNING_CFLAGS_BASE) -Wshorten-64-to-32; -WARNING_CFLAGS_i386 = $(WARNING_CFLAGS_BASE) -Wshorten-64-to-32; -WARNING_CFLAGS_ppc = $(WARNING_CFLAGS_BASE) -Wshorten-64-to-32; +VALID_ARCHS = $(VALID_ARCHS_$(REAL_PLATFORM_NAME)); +VALID_ARCHS_iphoneos = $(ARCHS_STANDARD_32_BIT); +VALID_ARCHS_iphonesimulator = $(ARCHS_STANDARD_32_BIT); +VALID_ARCHS_macosx = i386 ppc x86_64 ppc64 $(ARCHS_UNIVERSAL_IPHONE_OS); +WARNING_CFLAGS_BASE = -Wall -Wextra -Wcast-qual -Wchar-subscripts -Wextra-tokens -Wformat=2 -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wpacked -Wpointer-arith -Wredundant-decls -Wundef -Wwrite-strings; +WARNING_CFLAGS = $(WARNING_CFLAGS_$(REAL_PLATFORM_NAME)); +WARNING_CFLAGS_iphoneos = $(WARNING_CFLAGS_BASE) -Wshorten-64-to-32; +WARNING_CFLAGS_iphonesimulator = $(WARNING_CFLAGS_BASE) -Wcast-align -Wshorten-64-to-32; +WARNING_CFLAGS_macosx = $(WARNING_CFLAGS_macosx_$(CURRENT_ARCH)); +WARNING_CFLAGS_macosx_ = $(WARNING_CFLAGS_BASE) -Wcast-align -Wshorten-64-to-32; +WARNING_CFLAGS_macosx_i386 = $(WARNING_CFLAGS_BASE) -Wcast-align -Wshorten-64-to-32; +WARNING_CFLAGS_macosx_ppc = $(WARNING_CFLAGS_BASE) -Wcast-align -Wshorten-64-to-32; // FIXME: JavaScriptCore 64-bit builds should build with -Wshorten-64-to-32 -WARNING_CFLAGS_ppc64 = $(WARNING_CFLAGS_BASE); -WARNING_CFLAGS_x86_64 = $(WARNING_CFLAGS_BASE); +WARNING_CFLAGS_macosx_ppc64 = $(WARNING_CFLAGS_BASE) -Wcast-align; +WARNING_CFLAGS_macosx_x86_64 = $(WARNING_CFLAGS_BASE) -Wcast-align; HEADER_SEARCH_PATHS = . icu $(HEADER_SEARCH_PATHS); @@ -94,15 +101,18 @@ SECTORDER_FLAGS = -sectorder __TEXT __text JavaScriptCore.order; // Note that Xcode versions as new as 3.1.2 use XCODE_VERSION_ACTUAL for the minor version // number. Newer versions of Xcode use XCODE_VERSION_MINOR for the minor version, and // XCODE_VERSION_ACTUAL for the full version number. -TARGET_GCC_VERSION = $(TARGET_GCC_VERSION_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -TARGET_GCC_VERSION_ = $(TARGET_GCC_VERSION_1040); -TARGET_GCC_VERSION_1040 = GCC_40; -TARGET_GCC_VERSION_1050 = $(TARGET_GCC_VERSION_1050_$(XCODE_VERSION_MINOR)); -TARGET_GCC_VERSION_1050_ = $(TARGET_GCC_VERSION_1050_$(XCODE_VERSION_ACTUAL)); -TARGET_GCC_VERSION_1050_0310 = GCC_42; -TARGET_GCC_VERSION_1050_0320 = GCC_42; -TARGET_GCC_VERSION_1060 = GCC_42; -TARGET_GCC_VERSION_1070 = LLVM_GCC_42; +TARGET_GCC_VERSION = $(TARGET_GCC_VERSION_$(REAL_PLATFORM_NAME)); +TARGET_GCC_VERSION_iphoneos = LLVM_GCC_42; +TARGET_GCC_VERSION_iphonesimulator = GCC_42; +TARGET_GCC_VERSION_macosx = $(TARGET_GCC_VERSION_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +TARGET_GCC_VERSION_macosx_ = $(TARGET_GCC_VERSION_macosx_1040); +TARGET_GCC_VERSION_macosx_1040 = GCC_40; +TARGET_GCC_VERSION_macosx_1050 = $(TARGET_GCC_VERSION_macosx_1050_$(XCODE_VERSION_MINOR)); +TARGET_GCC_VERSION_macosx_1050_ = $(TARGET_GCC_VERSION_macosx_1050_$(XCODE_VERSION_ACTUAL)); +TARGET_GCC_VERSION_macosx_1050_0310 = GCC_42; +TARGET_GCC_VERSION_macosx_1050_0320 = GCC_42; +TARGET_GCC_VERSION_macosx_1060 = GCC_42; +TARGET_GCC_VERSION_macosx_1070 = LLVM_GCC_42; GCC_VERSION = $(GCC_VERSION_$(TARGET_GCC_VERSION)); GCC_VERSION_GCC_40 = 4.0; @@ -122,7 +132,7 @@ SDKROOT_1070_1060 = macosx10.6; // HAVE_DTRACE is disabled on Leopard due to <rdar://problem/5628149> HAVE_DTRACE = $(HAVE_DTRACE_$(REAL_PLATFORM_NAME)); HAVE_DTRACE_iphoneos = 1; -HAVE_DTRACE_iphonesimulator = 0; +HAVE_DTRACE_iphonesimulator = 1; HAVE_DTRACE_macosx = $(HAVE_DTRACE_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); HAVE_DTRACE_macosx_ = $(HAVE_DTRACE_macosx_1040); HAVE_DTRACE_macosx_1040 = 0; diff --git a/JavaScriptCore/Configurations/DebugRelease.xcconfig b/JavaScriptCore/Configurations/DebugRelease.xcconfig index 1e981f8..a98e1ce 100644 --- a/JavaScriptCore/Configurations/DebugRelease.xcconfig +++ b/JavaScriptCore/Configurations/DebugRelease.xcconfig @@ -1,4 +1,4 @@ -// Copyright (C) 2009 Apple Inc. All rights reserved. +// Copyright (C) 2009, 2010 Apple Inc. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions @@ -35,12 +35,15 @@ ARCHS_macosx_1070 = $(ARCHS_STANDARD_32_64_BIT); ONLY_ACTIVE_ARCH = YES; -MACOSX_DEPLOYMENT_TARGET = $(MACOSX_DEPLOYMENT_TARGET_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -MACOSX_DEPLOYMENT_TARGET_ = 10.4; -MACOSX_DEPLOYMENT_TARGET_1040 = 10.4; -MACOSX_DEPLOYMENT_TARGET_1050 = 10.5; -MACOSX_DEPLOYMENT_TARGET_1060 = 10.6; -MACOSX_DEPLOYMENT_TARGET_1070 = 10.7; +MACOSX_DEPLOYMENT_TARGET = $(MACOSX_DEPLOYMENT_TARGET_$(REAL_PLATFORM_NAME)); +MACOSX_DEPLOYMENT_TARGET_iphoneos = 10.5; +MACOSX_DEPLOYMENT_TARGET_iphonesimulator = 10.5; +MACOSX_DEPLOYMENT_TARGET_macosx = $(MACOSX_DEPLOYMENT_TARGET_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +MACOSX_DEPLOYMENT_TARGET_macosx_ = 10.4; +MACOSX_DEPLOYMENT_TARGET_macosx_1040 = 10.4; +MACOSX_DEPLOYMENT_TARGET_macosx_1050 = 10.5; +MACOSX_DEPLOYMENT_TARGET_macosx_1060 = 10.6; +MACOSX_DEPLOYMENT_TARGET_macosx_1070 = 10.7; GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES; diff --git a/JavaScriptCore/Configurations/FeatureDefines.xcconfig b/JavaScriptCore/Configurations/FeatureDefines.xcconfig index 8e33a91..9810cf7 100644 --- a/JavaScriptCore/Configurations/FeatureDefines.xcconfig +++ b/JavaScriptCore/Configurations/FeatureDefines.xcconfig @@ -1,4 +1,4 @@ -// Copyright (C) 2009 Apple Inc. All rights reserved. +// Copyright (C) 2009, 2010 Apple Inc. All rights reserved. // Copyright (C) 2009 Google Inc. All rights reserved. // // Redistribution and use in source and binary forms, with or without @@ -33,31 +33,52 @@ ENABLE_LINK_PREFETCH = ; -ENABLE_3D_CANVAS = $(ENABLE_3D_CANVAS_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -ENABLE_3D_CANVAS_1060 = ENABLE_3D_CANVAS; -ENABLE_3D_CANVAS_1070 = ENABLE_3D_CANVAS; +ENABLE_3D_CANVAS = $(ENABLE_3D_CANVAS_$(REAL_PLATFORM_NAME)); +ENABLE_3D_CANVAS_macosx = $(ENABLE_3D_CANVAS_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +ENABLE_3D_CANVAS_macosx_1060 = ENABLE_3D_CANVAS; +ENABLE_3D_CANVAS_macosx_1070 = ENABLE_3D_CANVAS; -ENABLE_3D_RENDERING = $(ENABLE_3D_RENDERING_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -ENABLE_3D_RENDERING_1050 = ENABLE_3D_RENDERING; -ENABLE_3D_RENDERING_1060 = ENABLE_3D_RENDERING; -ENABLE_3D_RENDERING_1070 = ENABLE_3D_RENDERING; +ENABLE_3D_RENDERING = $(ENABLE_3D_RENDERING_$(REAL_PLATFORM_NAME)); +ENABLE_3D_RENDERING_iphoneos = ENABLE_3D_RENDERING; +ENABLE_3D_RENDERING_iphonesimulator = $(ENABLE_3D_RENDERING_iphoneos); +ENABLE_3D_RENDERING_macosx = $(ENABLE_3D_RENDERING_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +ENABLE_3D_RENDERING_macosx_1050 = ENABLE_3D_RENDERING; +ENABLE_3D_RENDERING_macosx_1060 = ENABLE_3D_RENDERING; +ENABLE_3D_RENDERING_macosx_1070 = ENABLE_3D_RENDERING; + +ENABLE_BLOB_SLICE = $(ENABLE_BLOB_SLICE_$(REAL_PLATFORM_NAME)); +ENABLE_BLOB_SLICE_macosx = ENABLE_BLOB_SLICE; + +ENABLE_CHANNEL_MESSAGING = $(ENABLE_CHANNEL_MESSAGING_$(REAL_PLATFORM_NAME)); +ENABLE_CHANNEL_MESSAGING_macosx = ENABLE_CHANNEL_MESSAGING; + +ENABLE_CLIENT_BASED_GEOLOCATION = $(ENABLE_CLIENT_BASED_GEOLOCATION_$(REAL_PLATFORM_NAME)); +ENABLE_CLIENT_BASED_GEOLOCATION_macosx = ENABLE_CLIENT_BASED_GEOLOCATION; -ENABLE_BLOB_SLICE = ENABLE_BLOB_SLICE; -ENABLE_CHANNEL_MESSAGING = ENABLE_CHANNEL_MESSAGING; -ENABLE_CLIENT_BASED_GEOLOCATION = ENABLE_CLIENT_BASED_GEOLOCATION; ENABLE_DATABASE = ENABLE_DATABASE; ENABLE_DATAGRID = ; -ENABLE_DATALIST = ENABLE_DATALIST; + +ENABLE_DATALIST = $(ENABLE_DATALIST_$(REAL_PLATFORM_NAME)); +ENABLE_DATALIST_macosx = ENABLE_DATALIST; + ENABLE_DEVICE_ORIENTATION = ; ENABLE_DIRECTORY_UPLOAD = ; ENABLE_DOM_STORAGE = ENABLE_DOM_STORAGE; ENABLE_EVENTSOURCE = ENABLE_EVENTSOURCE; -ENABLE_FILTERS = ENABLE_FILTERS; -ENABLE_FILE_READER = ENABLE_FILE_READER; + +ENABLE_FILTERS = $(ENABLE_FILTERS_$(REAL_PLATFORM_NAME)); +ENABLE_FILTERS_macosx = ENABLE_FILTERS; + +ENABLE_FILE_READER = $(ENABLE_FILE_READER_$(REAL_PLATFORM_NAME)); +ENABLE_FILE_READER_macosx = ENABLE_FILE_READER; + ENABLE_FILE_WRITER = ; ENABLE_FILE_SYSTEM = ; ENABLE_GEOLOCATION = ENABLE_GEOLOCATION; -ENABLE_ICONDATABASE = ENABLE_ICONDATABASE; + +ENABLE_ICONDATABASE = $(ENABLE_ICONDATABASE_$(REAL_PLATFORM_NAME)); +ENABLE_ICONDATABASE_macosx = ENABLE_ICONDATABASE; + ENABLE_IMAGE_RESIZER = ; ENABLE_INDEXED_DATABASE = ; ENABLE_INPUT_SPEECH = ; @@ -67,21 +88,37 @@ ENABLE_METER_TAG = ENABLE_METER_TAG; ENABLE_NOTIFICATIONS = ; ENABLE_OFFLINE_WEB_APPLICATIONS = ENABLE_OFFLINE_WEB_APPLICATIONS; ENABLE_PROGRESS_TAG = ENABLE_PROGRESS_TAG; -ENABLE_RUBY = ENABLE_RUBY; -ENABLE_SANDBOX = ENABLE_SANDBOX; -ENABLE_SHARED_WORKERS = ENABLE_SHARED_WORKERS; + +ENABLE_RUBY = $(ENABLE_RUBY_$(REAL_PLATFORM_NAME)); +ENABLE_RUBY_macosx = ENABLE_RUBY; + +ENABLE_SANDBOX = $(ENABLE_SANDBOX_$(REAL_PLATFORM_NAME)); +ENABLE_SANDBOX_macosx = ENABLE_SANDBOX; + +ENABLE_SHARED_WORKERS = $(ENABLE_SHARED_WORKERS_$(REAL_PLATFORM_NAME)); +ENABLE_SHARED_WORKERS_macosx = ENABLE_SHARED_WORKERS; + ENABLE_SVG = ENABLE_SVG; ENABLE_SVG_ANIMATION = ENABLE_SVG_ANIMATION; ENABLE_SVG_AS_IMAGE = ENABLE_SVG_AS_IMAGE; -ENABLE_SVG_DOM_OBJC_BINDINGS = ENABLE_SVG_DOM_OBJC_BINDINGS; + +ENABLE_SVG_DOM_OBJC_BINDINGS = $(ENABLE_SVG_DOM_OBJC_BINDINGS_$(REAL_PLATFORM_NAME)); +ENABLE_SVG_DOM_OBJC_BINDINGS_macosx = ENABLE_SVG_DOM_OBJC_BINDINGS; + ENABLE_SVG_FONTS = ENABLE_SVG_FONTS; ENABLE_SVG_FOREIGN_OBJECT = ENABLE_SVG_FOREIGN_OBJECT; ENABLE_SVG_USE = ENABLE_SVG_USE; ENABLE_VIDEO = ENABLE_VIDEO; -ENABLE_WEB_SOCKETS = ENABLE_WEB_SOCKETS; + +ENABLE_WEB_SOCKETS = $(ENABLE_WEB_SOCKETS_$(REAL_PLATFORM_NAME)); +ENABLE_WEB_SOCKETS_macosx = ENABLE_WEB_SOCKETS; + ENABLE_WEB_TIMING = ; ENABLE_WML = ; -ENABLE_WORKERS = ENABLE_WORKERS; + +ENABLE_WORKERS = $(ENABLE_WORKERS_$(REAL_PLATFORM_NAME)); +ENABLE_WORKERS_macosx = ENABLE_WORKERS; + ENABLE_XHTMLMP = ; ENABLE_XPATH = ENABLE_XPATH; ENABLE_XSLT = ENABLE_XSLT; diff --git a/JavaScriptCore/Configurations/Version.xcconfig b/JavaScriptCore/Configurations/Version.xcconfig index c1b6b32..2893a3c 100644 --- a/JavaScriptCore/Configurations/Version.xcconfig +++ b/JavaScriptCore/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 534; -MINOR_VERSION = 4; +MINOR_VERSION = 5; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/JavaScriptCore/GNUmakefile.am b/JavaScriptCore/GNUmakefile.am index 98f491c..1dd15e4 100644 --- a/JavaScriptCore/GNUmakefile.am +++ b/JavaScriptCore/GNUmakefile.am @@ -409,6 +409,7 @@ javascriptcore_sources += \ JavaScriptCore/wtf/Assertions.h \ JavaScriptCore/wtf/Atomics.h \ JavaScriptCore/wtf/AVLTree.h \ + JavaScriptCore/wtf/BumpPointerAllocator.h \ JavaScriptCore/wtf/ByteArray.cpp \ JavaScriptCore/wtf/ByteArray.h \ JavaScriptCore/wtf/CrossThreadRefCounted.h \ diff --git a/JavaScriptCore/JavaScriptCore.exp b/JavaScriptCore/JavaScriptCore.exp index 93e01e2..b66d8df 100644 --- a/JavaScriptCore/JavaScriptCore.exp +++ b/JavaScriptCore/JavaScriptCore.exp @@ -367,6 +367,7 @@ __ZN3WTF5Mutex6unlockEv __ZN3WTF5Mutex7tryLockEv __ZN3WTF5MutexC1Ev __ZN3WTF5MutexD1Ev +__ZN3WTF5yieldEv __ZN3WTF6strtodEPKcPPc __ZN3WTF7CString11mutableDataEv __ZN3WTF7CString16newUninitializedEmRPc diff --git a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def index a6ff1c2..a478725 100644 --- a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def +++ b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def @@ -330,6 +330,7 @@ EXPORTS ?wait@ThreadCondition@WTF@@QAEXAAVMutex@2@@Z ?waitForThreadCompletion@WTF@@YAHIPAPAX@Z ?writable@PropertyDescriptor@JSC@@QBE_NXZ + ?yield@WTF@@YAXXZ WTFLog WTFLogVerbose WTFReportArgumentAssertionFailure diff --git a/JavaScriptCore/jit/JITPropertyAccess.cpp b/JavaScriptCore/jit/JITPropertyAccess.cpp index 580e73f..10dcd3f 100644 --- a/JavaScriptCore/jit/JITPropertyAccess.cpp +++ b/JavaScriptCore/jit/JITPropertyAccess.cpp @@ -103,10 +103,10 @@ void JIT::emit_op_get_by_val(Instruction* currentInstruction) emitJumpSlowCaseIfNotJSCell(regT0, base); addSlowCase(branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsArrayVPtr))); - loadPtr(Address(regT0, OBJECT_OFFSETOF(JSArray, m_storage)), regT2); + loadPtr(Address(regT0, OBJECT_OFFSETOF(JSArray, m_vector)), regT2); addSlowCase(branch32(AboveOrEqual, regT1, Address(regT0, OBJECT_OFFSETOF(JSArray, m_vectorLength)))); - loadPtr(BaseIndex(regT2, regT1, ScalePtr, OBJECT_OFFSETOF(ArrayStorage, m_vector[0])), regT0); + loadPtr(BaseIndex(regT2, regT1, ScalePtr), regT0); addSlowCase(branchTestPtr(Zero, regT0)); emitPutVirtualRegister(dst); @@ -214,22 +214,21 @@ void JIT::emit_op_put_by_val(Instruction* currentInstruction) addSlowCase(branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsArrayVPtr))); addSlowCase(branch32(AboveOrEqual, regT1, Address(regT0, OBJECT_OFFSETOF(JSArray, m_vectorLength)))); - loadPtr(Address(regT0, OBJECT_OFFSETOF(JSArray, m_storage)), regT2); - - Jump empty = branchTestPtr(Zero, BaseIndex(regT2, regT1, ScalePtr, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]))); + loadPtr(Address(regT0, OBJECT_OFFSETOF(JSArray, m_vector)), regT2); + Jump empty = branchTestPtr(Zero, BaseIndex(regT2, regT1, ScalePtr)); Label storeResult(this); emitGetVirtualRegister(value, regT0); - storePtr(regT0, BaseIndex(regT2, regT1, ScalePtr, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]))); + storePtr(regT0, BaseIndex(regT2, regT1, ScalePtr)); Jump end = jump(); empty.link(this); - add32(Imm32(1), Address(regT2, OBJECT_OFFSETOF(ArrayStorage, m_numValuesInVector))); - branch32(Below, regT1, Address(regT2, OBJECT_OFFSETOF(ArrayStorage, m_length))).linkTo(storeResult, this); + add32(Imm32(1), Address(regT2, OBJECT_OFFSETOF(ArrayStorage, m_numValuesInVector)-OBJECT_OFFSETOF(ArrayStorage, m_vector))); + branch32(Below, regT1, Address(regT2, OBJECT_OFFSETOF(ArrayStorage, m_length)-OBJECT_OFFSETOF(ArrayStorage, m_vector))).linkTo(storeResult, this); move(regT1, regT0); add32(Imm32(1), regT0); - store32(regT0, Address(regT2, OBJECT_OFFSETOF(ArrayStorage, m_length))); + store32(regT0, Address(regT2, OBJECT_OFFSETOF(ArrayStorage, m_length)-OBJECT_OFFSETOF(ArrayStorage, m_vector))); jump().linkTo(storeResult, this); end.link(this); @@ -726,9 +725,8 @@ void JIT::privateCompilePatchGetArrayLength(ReturnAddressPtr returnAddress) Jump failureCases1 = branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsArrayVPtr)); // Checks out okay! - get the length from the storage - loadPtr(Address(regT0, OBJECT_OFFSETOF(JSArray, m_storage)), regT2); - load32(Address(regT2, OBJECT_OFFSETOF(ArrayStorage, m_length)), regT2); - + loadPtr(Address(regT0, OBJECT_OFFSETOF(JSArray, m_vector)), regT3); + load32(Address(regT3, OBJECT_OFFSETOF(ArrayStorage, m_length)-OBJECT_OFFSETOF(ArrayStorage, m_vector)), regT2); Jump failureCases2 = branch32(Above, regT2, Imm32(JSImmediate::maxImmediateInt)); emitFastArithIntToImmNoCheck(regT2, regT0); diff --git a/JavaScriptCore/jit/JITPropertyAccess32_64.cpp b/JavaScriptCore/jit/JITPropertyAccess32_64.cpp index 6234842..375d3e8 100644 --- a/JavaScriptCore/jit/JITPropertyAccess32_64.cpp +++ b/JavaScriptCore/jit/JITPropertyAccess32_64.cpp @@ -311,11 +311,11 @@ void JIT::emit_op_get_by_val(Instruction* currentInstruction) emitJumpSlowCaseIfNotJSCell(base, regT1); addSlowCase(branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsArrayVPtr))); - loadPtr(Address(regT0, OBJECT_OFFSETOF(JSArray, m_storage)), regT3); + loadPtr(Address(regT0, OBJECT_OFFSETOF(JSArray, m_vector)), regT3); addSlowCase(branch32(AboveOrEqual, regT2, Address(regT0, OBJECT_OFFSETOF(JSArray, m_vectorLength)))); - load32(BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]) + OBJECT_OFFSETOF(JSValue, u.asBits.tag)), regT1); // tag - load32(BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]) + OBJECT_OFFSETOF(JSValue, u.asBits.payload)), regT0); // payload + load32(BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.tag)), regT1); // tag + load32(BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.payload)), regT0); // payload addSlowCase(branch32(Equal, regT1, Imm32(JSValue::EmptyValueTag))); emitStore(dst, regT1, regT0); @@ -364,22 +364,22 @@ void JIT::emit_op_put_by_val(Instruction* currentInstruction) addSlowCase(branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsArrayVPtr))); addSlowCase(branch32(AboveOrEqual, regT2, Address(regT0, OBJECT_OFFSETOF(JSArray, m_vectorLength)))); - loadPtr(Address(regT0, OBJECT_OFFSETOF(JSArray, m_storage)), regT3); + loadPtr(Address(regT0, OBJECT_OFFSETOF(JSArray, m_vector)), regT3); - Jump empty = branch32(Equal, BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]) + OBJECT_OFFSETOF(JSValue, u.asBits.tag)), Imm32(JSValue::EmptyValueTag)); + Jump empty = branch32(Equal, BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.tag)), Imm32(JSValue::EmptyValueTag)); Label storeResult(this); emitLoad(value, regT1, regT0); - store32(regT0, BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]) + OBJECT_OFFSETOF(JSValue, u.asBits.payload))); // payload - store32(regT1, BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]) + OBJECT_OFFSETOF(JSValue, u.asBits.tag))); // tag + store32(regT0, BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.payload))); // payload + store32(regT1, BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.tag))); // tag Jump end = jump(); empty.link(this); - add32(Imm32(1), Address(regT3, OBJECT_OFFSETOF(ArrayStorage, m_numValuesInVector))); - branch32(Below, regT2, Address(regT3, OBJECT_OFFSETOF(ArrayStorage, m_length))).linkTo(storeResult, this); + add32(Imm32(1), Address(regT3, OBJECT_OFFSETOF(ArrayStorage, m_numValuesInVector)-OBJECT_OFFSETOF(ArrayStorage, m_vector))); + branch32(Below, regT2, Address(regT3, OBJECT_OFFSETOF(ArrayStorage, m_length)-OBJECT_OFFSETOF(ArrayStorage, m_vector))).linkTo(storeResult, this); add32(Imm32(1), regT2, regT0); - store32(regT0, Address(regT3, OBJECT_OFFSETOF(ArrayStorage, m_length))); + store32(regT0, Address(regT3, OBJECT_OFFSETOF(ArrayStorage, m_length)-OBJECT_OFFSETOF(ArrayStorage, m_vector))); jump().linkTo(storeResult, this); end.link(this); @@ -731,8 +731,8 @@ void JIT::privateCompilePatchGetArrayLength(ReturnAddressPtr returnAddress) Jump failureCases1 = branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsArrayVPtr)); // Checks out okay! - get the length from the storage - loadPtr(Address(regT0, OBJECT_OFFSETOF(JSArray, m_storage)), regT2); - load32(Address(regT2, OBJECT_OFFSETOF(ArrayStorage, m_length)), regT2); + loadPtr(Address(regT0, OBJECT_OFFSETOF(JSArray, m_vector)), regT2); + load32(Address(regT2, OBJECT_OFFSETOF(ArrayStorage, m_length)-OBJECT_OFFSETOF(ArrayStorage, m_vector)), regT2); Jump failureCases2 = branch32(Above, regT2, Imm32(INT_MAX)); move(regT2, regT0); diff --git a/JavaScriptCore/jsc/CMakeLists.txt b/JavaScriptCore/jsc/CMakeLists.txt index 970c20f..756ba92 100644 --- a/JavaScriptCore/jsc/CMakeLists.txt +++ b/JavaScriptCore/jsc/CMakeLists.txt @@ -16,3 +16,4 @@ INCLUDE_DIRECTORIES(./ ${JavaScriptCore_INCLUDE_DIRECTORIES}) ADD_EXECUTABLE(${JSC_EXECUTABLE_NAME} ${JSC_HEADERS} ${JSC_SOURCES}) TARGET_LINK_LIBRARIES(${JSC_EXECUTABLE_NAME} ${JSC_LIBRARIES}) ADD_TARGET_PROPERTIES(${JSC_EXECUTABLE_NAME} LINK_FLAGS ${JSC_LINK_FLAGS}) +SET_TARGET_PROPERTIES(${JSC_EXECUTABLE_NAME} PROPERTIES VERSION ${PROJECT_VERSION}) diff --git a/JavaScriptCore/runtime/ArrayPrototype.cpp b/JavaScriptCore/runtime/ArrayPrototype.cpp index e79c46d..fa6eb99 100644 --- a/JavaScriptCore/runtime/ArrayPrototype.cpp +++ b/JavaScriptCore/runtime/ArrayPrototype.cpp @@ -424,13 +424,17 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncShift(ExecState* exec) result = jsUndefined(); } else { result = thisObj->get(exec, 0); - for (unsigned k = 1; k < length; k++) { - if (JSValue obj = getProperty(exec, thisObj, k)) - thisObj->put(exec, k - 1, obj); - else - thisObj->deleteProperty(exec, k - 1); + if (isJSArray(&exec->globalData(), thisObj)) + ((JSArray *)thisObj)->shiftCount(exec, 1); + else { + for (unsigned k = 1; k < length; k++) { + if (JSValue obj = getProperty(exec, thisObj, k)) + thisObj->put(exec, k - 1, obj); + else + thisObj->deleteProperty(exec, k - 1); + } + thisObj->deleteProperty(exec, length - 1); } - thisObj->deleteProperty(exec, length - 1); putProperty(exec, thisObj, exec->propertyNames().length, jsNumber(exec, length - 1)); } return JSValue::encode(result); @@ -578,20 +582,28 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncSplice(ExecState* exec) unsigned additionalArgs = std::max<int>(exec->argumentCount() - 2, 0); if (additionalArgs != deleteCount) { if (additionalArgs < deleteCount) { - for (unsigned k = begin; k < length - deleteCount; ++k) { - if (JSValue v = getProperty(exec, thisObj, k + deleteCount)) - thisObj->put(exec, k + additionalArgs, v); - else - thisObj->deleteProperty(exec, k + additionalArgs); + if ((!begin) && (isJSArray(&exec->globalData(), thisObj))) + ((JSArray *)thisObj)->shiftCount(exec, deleteCount - additionalArgs); + else { + for (unsigned k = begin; k < length - deleteCount; ++k) { + if (JSValue v = getProperty(exec, thisObj, k + deleteCount)) + thisObj->put(exec, k + additionalArgs, v); + else + thisObj->deleteProperty(exec, k + additionalArgs); + } + for (unsigned k = length; k > length - deleteCount + additionalArgs; --k) + thisObj->deleteProperty(exec, k - 1); } - for (unsigned k = length; k > length - deleteCount + additionalArgs; --k) - thisObj->deleteProperty(exec, k - 1); } else { - for (unsigned k = length - deleteCount; k > begin; --k) { - if (JSValue obj = getProperty(exec, thisObj, k + deleteCount - 1)) - thisObj->put(exec, k + additionalArgs - 1, obj); - else - thisObj->deleteProperty(exec, k + additionalArgs - 1); + if ((!begin) && (isJSArray(&exec->globalData(), thisObj))) + ((JSArray *)thisObj)->unshiftCount(exec, additionalArgs - deleteCount); + else { + for (unsigned k = length - deleteCount; k > begin; --k) { + if (JSValue obj = getProperty(exec, thisObj, k + deleteCount - 1)) + thisObj->put(exec, k + additionalArgs - 1, obj); + else + thisObj->deleteProperty(exec, k + additionalArgs - 1); + } } } } @@ -610,12 +622,16 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncUnShift(ExecState* exec) // 15.4.4.13 unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec); unsigned nrArgs = exec->argumentCount(); - if (nrArgs) { - for (unsigned k = length; k > 0; --k) { - if (JSValue v = getProperty(exec, thisObj, k - 1)) - thisObj->put(exec, k + nrArgs - 1, v); - else - thisObj->deleteProperty(exec, k + nrArgs - 1); + if ((nrArgs) && (length)) { + if (isJSArray(&exec->globalData(), thisObj)) + ((JSArray *)thisObj)->unshiftCount(exec, nrArgs); + else { + for (unsigned k = length; k > 0; --k) { + if (JSValue v = getProperty(exec, thisObj, k - 1)) + thisObj->put(exec, k + nrArgs - 1, v); + else + thisObj->deleteProperty(exec, k + nrArgs - 1); + } } } for (unsigned k = 0; k < nrArgs; ++k) diff --git a/JavaScriptCore/runtime/Collector.h b/JavaScriptCore/runtime/Collector.h index f5bf113..1dc9445 100644 --- a/JavaScriptCore/runtime/Collector.h +++ b/JavaScriptCore/runtime/Collector.h @@ -185,16 +185,6 @@ namespace JSC { }; // tunable parameters - template<size_t bytesPerWord> struct CellSize; - - // cell size needs to be a power of two for certain optimizations in collector.cpp -#if USE(JSVALUE32) - template<> struct CellSize<sizeof(uint32_t)> { static const size_t m_value = 32; }; -#else - template<> struct CellSize<sizeof(uint32_t)> { static const size_t m_value = 64; }; -#endif - template<> struct CellSize<sizeof(uint64_t)> { static const size_t m_value = 64; }; - #if OS(WINCE) || OS(SYMBIAN) const size_t BLOCK_SIZE = 64 * 1024; // 64k #else @@ -204,7 +194,7 @@ namespace JSC { // derived constants const size_t BLOCK_OFFSET_MASK = BLOCK_SIZE - 1; const size_t BLOCK_MASK = ~BLOCK_OFFSET_MASK; - const size_t MINIMUM_CELL_SIZE = CellSize<sizeof(void*)>::m_value; + const size_t MINIMUM_CELL_SIZE = 64; const size_t CELL_ARRAY_LENGTH = (MINIMUM_CELL_SIZE / sizeof(double)) + (MINIMUM_CELL_SIZE % sizeof(double) != 0 ? sizeof(double) : 0); const size_t CELL_SIZE = CELL_ARRAY_LENGTH * sizeof(double); const size_t SMALL_CELL_SIZE = CELL_SIZE / 2; diff --git a/JavaScriptCore/runtime/JSArray.cpp b/JavaScriptCore/runtime/JSArray.cpp index 56603a3..99e1a10 100644 --- a/JavaScriptCore/runtime/JSArray.cpp +++ b/JavaScriptCore/runtime/JSArray.cpp @@ -78,6 +78,14 @@ ASSERT_CLASS_FITS_IN_CELL(JSArray); // 0xFFFFFFFF is a bit weird -- is not an array index even though it's an integer. #define MAX_ARRAY_INDEX 0xFFFFFFFEU +// The value BASE_VECTOR_LEN is the maximum number of vector elements we'll allocate +// for an array that was created with a sepcified length (e.g. a = new Array(123)) +#define BASE_VECTOR_LEN 4U + +// The upper bound to the size we'll grow a zero length array when the first element +// is added. +#define FIRST_VECTOR_GROW 4U + // Our policy for when to use a vector and when to use a sparse map. // For all array indices under MIN_SPARSE_ARRAY_INDEX, we always use a vector. // When indices greater than MIN_SPARSE_ARRAY_INDEX are involved, we use a vector @@ -86,6 +94,11 @@ static const unsigned minDensityMultiplier = 8; const ClassInfo JSArray::info = {"Array", 0, 0, 0}; +// We keep track of the size of the last array after it was grown. We use this +// as a simple heuristic for as the value to grow the next array from size 0. +// This value is capped by the constant FIRST_VECTOR_GROW defined above. +static unsigned lastArraySize = 0; + static inline size_t storageSize(unsigned vectorLength) { ASSERT(vectorLength <= MAX_STORAGE_VECTOR_LENGTH); @@ -100,21 +113,6 @@ static inline size_t storageSize(unsigned vectorLength) return size; } -static inline unsigned increasedVectorLength(unsigned newLength) -{ - ASSERT(newLength <= MAX_STORAGE_VECTOR_LENGTH); - - // Mathematically equivalent to: - // increasedLength = (newLength * 3 + 1) / 2; - // or: - // increasedLength = (unsigned)ceil(newLength * 1.5)); - // This form is not prone to internal overflow. - unsigned increasedLength = newLength + (newLength >> 1) + (newLength & 1); - ASSERT(increasedLength >= newLength); - - return min(increasedLength, MAX_STORAGE_VECTOR_LENGTH); -} - static inline bool isDenseEnoughForVector(unsigned length, unsigned numValues) { return length / minDensityMultiplier <= numValues; @@ -133,7 +131,9 @@ JSArray::JSArray(NonNullPassRefPtr<Structure> structure) { unsigned initialCapacity = 0; - m_storage = static_cast<ArrayStorage*>(fastZeroedMalloc(storageSize(initialCapacity))); + ArrayStorage* storage = static_cast<ArrayStorage*>(fastZeroedMalloc(storageSize(initialCapacity))); + m_indexBias = 0; + setArrayStorage(storage); m_vectorLength = initialCapacity; checkConsistency(); @@ -146,33 +146,36 @@ JSArray::JSArray(NonNullPassRefPtr<Structure> structure, unsigned initialLength, if (creationMode == CreateCompact) initialCapacity = initialLength; else - initialCapacity = min(initialLength, MIN_SPARSE_ARRAY_INDEX); - - m_storage = static_cast<ArrayStorage*>(fastMalloc(storageSize(initialCapacity))); + initialCapacity = min(BASE_VECTOR_LEN, MIN_SPARSE_ARRAY_INDEX); + + ArrayStorage* storage = static_cast<ArrayStorage*>(fastMalloc(storageSize(initialCapacity))); + storage->m_length = initialLength; + m_indexBias = 0; m_vectorLength = initialCapacity; - m_storage->m_sparseValueMap = 0; - m_storage->subclassData = 0; - m_storage->reportedMapCapacity = 0; + setArrayStorage(storage); + storage->m_sparseValueMap = 0; + storage->subclassData = 0; + storage->reportedMapCapacity = 0; if (creationMode == CreateCompact) { #if CHECK_ARRAY_CONSISTENCY - m_storage->m_inCompactInitialization = !!initialCapacity; + storage->m_inCompactInitialization = !!initialCapacity; #endif - m_storage->m_length = 0; - m_storage->m_numValuesInVector = initialCapacity; + storage->m_length = 0; + storage->m_numValuesInVector = initialCapacity; } else { #if CHECK_ARRAY_CONSISTENCY - m_storage->m_inCompactInitialization = false; + storage->m_inCompactInitialization = false; #endif - m_storage->m_length = initialLength; - m_storage->m_numValuesInVector = 0; - JSValue* vector = m_storage->m_vector; + storage->m_length = initialLength; + storage->m_numValuesInVector = 0; + JSValue* vector = m_vector; for (size_t i = 0; i < initialCapacity; ++i) vector[i] = JSValue(); } checkConsistency(); - + Heap::heap(this)->reportExtraMemoryCost(initialCapacity * sizeof(JSValue)); } @@ -181,21 +184,24 @@ JSArray::JSArray(NonNullPassRefPtr<Structure> structure, const ArgList& list) { unsigned initialCapacity = list.size(); - m_storage = static_cast<ArrayStorage*>(fastMalloc(storageSize(initialCapacity))); - m_storage->m_length = initialCapacity; + ArrayStorage* storage = static_cast<ArrayStorage*>(fastMalloc(storageSize(initialCapacity))); + m_indexBias = 0; + storage->m_length = initialCapacity; m_vectorLength = initialCapacity; - m_storage->m_numValuesInVector = initialCapacity; - m_storage->m_sparseValueMap = 0; - m_storage->subclassData = 0; - m_storage->reportedMapCapacity = 0; + storage->m_numValuesInVector = initialCapacity; + storage->m_sparseValueMap = 0; + storage->subclassData = 0; + storage->reportedMapCapacity = 0; #if CHECK_ARRAY_CONSISTENCY - m_storage->m_inCompactInitialization = false; + storage->m_inCompactInitialization = false; #endif + setArrayStorage(storage); size_t i = 0; + JSValue* vector = m_vector; ArgList::const_iterator end = list.end(); for (ArgList::const_iterator it = list.begin(); it != end; ++it, ++i) - m_storage->m_vector[i] = *it; + vector[i] = *it; checkConsistency(); @@ -207,14 +213,16 @@ JSArray::~JSArray() ASSERT(vptr() == JSGlobalData::jsArrayVPtr); checkConsistency(DestructorConsistencyCheck); - delete m_storage->m_sparseValueMap; - fastFree(m_storage); + ArrayStorage* storage = arrayStorage(); + delete storage->m_sparseValueMap; + char* realStorage = reinterpret_cast<char*>(storage) - (m_indexBias * sizeof(JSValue)); + fastFree(realStorage); } bool JSArray::getOwnPropertySlot(ExecState* exec, unsigned i, PropertySlot& slot) { - ArrayStorage* storage = m_storage; - + ArrayStorage* storage = arrayStorage(); + if (i >= storage->m_length) { if (i > MAX_ARRAY_INDEX) return getOwnPropertySlot(exec, Identifier::from(exec, i), slot); @@ -222,7 +230,7 @@ bool JSArray::getOwnPropertySlot(ExecState* exec, unsigned i, PropertySlot& slot } if (i < m_vectorLength) { - JSValue& valueSlot = storage->m_vector[i]; + JSValue& valueSlot = m_vector[i]; if (valueSlot) { slot.setValueSlot(&valueSlot); return true; @@ -261,19 +269,21 @@ bool JSArray::getOwnPropertyDescriptor(ExecState* exec, const Identifier& proper descriptor.setDescriptor(jsNumber(exec, length()), DontDelete | DontEnum); return true; } + + ArrayStorage* storage = arrayStorage(); bool isArrayIndex; unsigned i = propertyName.toArrayIndex(&isArrayIndex); if (isArrayIndex) { - if (i >= m_storage->m_length) + if (i >= storage->m_length) return false; if (i < m_vectorLength) { - JSValue& value = m_storage->m_vector[i]; + JSValue& value = m_vector[i]; if (value) { descriptor.setDescriptor(value, 0); return true; } - } else if (SparseArrayValueMap* map = m_storage->m_sparseValueMap) { + } else if (SparseArrayValueMap* map = storage->m_sparseValueMap) { if (i >= MIN_SPARSE_ARRAY_INDEX) { SparseArrayValueMap::iterator it = map->find(i); if (it != map->end()) { @@ -313,21 +323,23 @@ void JSArray::put(ExecState* exec, unsigned i, JSValue value) { checkConsistency(); - unsigned length = m_storage->m_length; + ArrayStorage* storage = arrayStorage(); + + unsigned length = storage->m_length; if (i >= length && i <= MAX_ARRAY_INDEX) { length = i + 1; - m_storage->m_length = length; + storage->m_length = length; } if (i < m_vectorLength) { - JSValue& valueSlot = m_storage->m_vector[i]; + JSValue& valueSlot = m_vector[i]; if (valueSlot) { valueSlot = value; checkConsistency(); return; } valueSlot = value; - ++m_storage->m_numValuesInVector; + ++storage->m_numValuesInVector; checkConsistency(); return; } @@ -337,7 +349,8 @@ void JSArray::put(ExecState* exec, unsigned i, JSValue value) NEVER_INLINE void JSArray::putSlowCase(ExecState* exec, unsigned i, JSValue value) { - ArrayStorage* storage = m_storage; + ArrayStorage* storage = arrayStorage(); + SparseArrayValueMap* map = storage->m_sparseValueMap; if (i >= MIN_SPARSE_ARRAY_INDEX) { @@ -374,9 +387,8 @@ NEVER_INLINE void JSArray::putSlowCase(ExecState* exec, unsigned i, JSValue valu // Fast case is when there is no sparse map, so we can increase the vector size without moving values from it. if (!map || map->isEmpty()) { if (increaseVectorLength(i + 1)) { - storage = m_storage; - storage->m_vector[i] = value; - ++storage->m_numValuesInVector; + m_vector[i] = value; + ++arrayStorage()->m_numValuesInVector; checkConsistency(); } else throwOutOfMemoryError(exec); @@ -385,7 +397,7 @@ NEVER_INLINE void JSArray::putSlowCase(ExecState* exec, unsigned i, JSValue valu // Decide how many values it would be best to move from the map. unsigned newNumValuesInVector = storage->m_numValuesInVector + 1; - unsigned newVectorLength = increasedVectorLength(i + 1); + unsigned newVectorLength = getNewVectorLength(i + 1); for (unsigned j = max(m_vectorLength, MIN_SPARSE_ARRAY_INDEX); j < newVectorLength; ++j) newNumValuesInVector += map->contains(j); if (i >= MIN_SPARSE_ARRAY_INDEX) @@ -394,7 +406,7 @@ NEVER_INLINE void JSArray::putSlowCase(ExecState* exec, unsigned i, JSValue valu unsigned proposedNewNumValuesInVector = newNumValuesInVector; // If newVectorLength is already the maximum - MAX_STORAGE_VECTOR_LENGTH - then do not attempt to grow any further. while (newVectorLength < MAX_STORAGE_VECTOR_LENGTH) { - unsigned proposedNewVectorLength = increasedVectorLength(newVectorLength + 1); + unsigned proposedNewVectorLength = getNewVectorLength(newVectorLength + 1); for (unsigned j = max(newVectorLength, MIN_SPARSE_ARRAY_INDEX); j < proposedNewVectorLength; ++j) proposedNewNumValuesInVector += map->contains(j); if (!isDenseEnoughForVector(proposedNewVectorLength, proposedNewNumValuesInVector)) @@ -404,31 +416,37 @@ NEVER_INLINE void JSArray::putSlowCase(ExecState* exec, unsigned i, JSValue valu } } - if (!tryFastRealloc(storage, storageSize(newVectorLength)).getValue(storage)) { + int baseBias = m_indexBias * sizeof(JSValue); + char* baseStorage = reinterpret_cast<char*>(storage - baseBias); + + if (!tryFastRealloc(baseStorage, storageSize(newVectorLength + m_indexBias)).getValue(baseStorage)) { throwOutOfMemoryError(exec); return; } + storage = reinterpret_cast<ArrayStorage*>(baseStorage + baseBias); + setArrayStorage(storage); + unsigned vectorLength = m_vectorLength; if (newNumValuesInVector == storage->m_numValuesInVector + 1) { for (unsigned j = vectorLength; j < newVectorLength; ++j) - storage->m_vector[j] = JSValue(); + m_vector[j] = JSValue(); if (i > MIN_SPARSE_ARRAY_INDEX) map->remove(i); } else { for (unsigned j = vectorLength; j < max(vectorLength, MIN_SPARSE_ARRAY_INDEX); ++j) - storage->m_vector[j] = JSValue(); + m_vector[j] = JSValue(); for (unsigned j = max(vectorLength, MIN_SPARSE_ARRAY_INDEX); j < newVectorLength; ++j) - storage->m_vector[j] = map->take(j); + m_vector[j] = map->take(j); } - storage->m_vector[i] = value; + ASSERT(i < newVectorLength); m_vectorLength = newVectorLength; storage->m_numValuesInVector = newNumValuesInVector; - m_storage = storage; + m_vector[i] = value; checkConsistency(); @@ -452,10 +470,10 @@ bool JSArray::deleteProperty(ExecState* exec, unsigned i) { checkConsistency(); - ArrayStorage* storage = m_storage; - + ArrayStorage* storage = arrayStorage(); + if (i < m_vectorLength) { - JSValue& valueSlot = storage->m_vector[i]; + JSValue& valueSlot = m_vector[i]; if (!valueSlot) { checkConsistency(); return false; @@ -491,11 +509,11 @@ void JSArray::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNa // is incredibly inefficient for large arrays. We need a different approach, // which almost certainly means a different structure for PropertyNameArray. - ArrayStorage* storage = m_storage; - + ArrayStorage* storage = arrayStorage(); + unsigned usedVectorLength = min(storage->m_length, m_vectorLength); for (unsigned i = 0; i < usedVectorLength; ++i) { - if (storage->m_vector[i]) + if (m_vector[i]) propertyNames.add(Identifier::from(exec, i)); } @@ -511,32 +529,101 @@ void JSArray::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNa JSObject::getOwnPropertyNames(exec, propertyNames, mode); } +ALWAYS_INLINE unsigned JSArray::getNewVectorLength(unsigned desiredLength) +{ + ASSERT(desiredLength <= MAX_STORAGE_VECTOR_LENGTH); + + unsigned increasedLength; + unsigned length = arrayStorage()->m_length; + + if (desiredLength < length) + increasedLength = length; + else if (!m_vectorLength) + increasedLength = max(desiredLength, lastArraySize); + else { + // Mathematically equivalent to: + // increasedLength = (newLength * 3 + 1) / 2; + // or: + // increasedLength = (unsigned)ceil(newLength * 1.5)); + // This form is not prone to internal overflow. + increasedLength = desiredLength + (desiredLength >> 1) + (desiredLength & 1); + } + + ASSERT(increasedLength >= desiredLength); + + lastArraySize = min(increasedLength, FIRST_VECTOR_GROW); + + return min(increasedLength, MAX_STORAGE_VECTOR_LENGTH); +} + bool JSArray::increaseVectorLength(unsigned newLength) { // This function leaves the array in an internally inconsistent state, because it does not move any values from sparse value map // to the vector. Callers have to account for that, because they can do it more efficiently. - ArrayStorage* storage = m_storage; + ArrayStorage* storage = arrayStorage(); unsigned vectorLength = m_vectorLength; ASSERT(newLength > vectorLength); ASSERT(newLength <= MAX_STORAGE_VECTOR_INDEX); - unsigned newVectorLength = increasedVectorLength(newLength); + unsigned newVectorLength = getNewVectorLength(newLength); + int baseBias = m_indexBias * sizeof(JSValue); + char* baseStorage = reinterpret_cast<char*>(storage) - baseBias; - if (!tryFastRealloc(storage, storageSize(newVectorLength)).getValue(storage)) + if (!tryFastRealloc(baseStorage, storageSize(newVectorLength + m_indexBias)).getValue(baseStorage)) return false; + + storage = reinterpret_cast<ArrayStorage*>(baseStorage + baseBias); + setArrayStorage(storage); + + JSValue* vector = m_vector; + for (unsigned i = vectorLength; i < newVectorLength; ++i) + vector[i] = JSValue(); m_vectorLength = newVectorLength; + + Heap::heap(this)->reportExtraMemoryCost(storageSize(newVectorLength) - storageSize(vectorLength)); - for (unsigned i = vectorLength; i < newVectorLength; ++i) - storage->m_vector[i] = JSValue(); + return true; +} - m_storage = storage; +bool JSArray::increaseVectorPrefixLength(unsigned newLength) +{ + // This function leaves the array in an internally inconsistent state, because it does not move any values from sparse value map + // to the vector. Callers have to account for that, because they can do it more efficiently. + + ArrayStorage* storage = arrayStorage(); + ArrayStorage* newStorage; + + unsigned vectorLength = m_vectorLength; + ASSERT(newLength > vectorLength); + ASSERT(newLength <= MAX_STORAGE_VECTOR_INDEX); + unsigned newVectorLength = getNewVectorLength(newLength); + char* baseStorage = reinterpret_cast<char*>(storage) - (m_indexBias * sizeof(JSValue)); + + char* newBaseStorage = reinterpret_cast<char*>(fastMalloc(storageSize(newVectorLength + m_indexBias))); + if (!newBaseStorage) + return false; + + m_indexBias += newVectorLength - newLength; + int newStorageOffset = m_indexBias * sizeof(JSValue); + + newStorage = reinterpret_cast<ArrayStorage*>(newBaseStorage + newStorageOffset); + + memcpy(newStorage, storage, storageSize(0)); + memcpy(&newStorage->m_vector[newLength - m_vectorLength], &storage->m_vector[0], storage->m_length * sizeof(JSValue)); + + m_vectorLength = newLength; + + fastFree(baseStorage); + setArrayStorage(newStorage); + Heap::heap(this)->reportExtraMemoryCost(storageSize(newVectorLength) - storageSize(vectorLength)); - + return true; } + void JSArray::setLength(unsigned newLength) { @@ -547,14 +634,14 @@ void JSArray::setLength(unsigned newLength) m_storage->m_inCompactInitialization = false; #endif - ArrayStorage* storage = m_storage; - - unsigned length = m_storage->m_length; + ArrayStorage* storage = arrayStorage(); + + unsigned length = storage->m_length; if (newLength < length) { unsigned usedVectorLength = min(length, m_vectorLength); for (unsigned i = newLength; i < usedVectorLength; ++i) { - JSValue& valueSlot = storage->m_vector[i]; + JSValue& valueSlot = m_vector[i]; bool hadValue = valueSlot; valueSlot = JSValue(); storage->m_numValuesInVector -= hadValue; @@ -574,7 +661,7 @@ void JSArray::setLength(unsigned newLength) } } - m_storage->m_length = newLength; + storage->m_length = newLength; checkConsistency(); } @@ -583,7 +670,9 @@ JSValue JSArray::pop() { checkConsistency(); - unsigned length = m_storage->m_length; + ArrayStorage* storage = arrayStorage(); + + unsigned length = storage->m_length; if (!length) return jsUndefined(); @@ -592,29 +681,29 @@ JSValue JSArray::pop() JSValue result; if (length < m_vectorLength) { - JSValue& valueSlot = m_storage->m_vector[length]; + JSValue& valueSlot = m_vector[length]; if (valueSlot) { - --m_storage->m_numValuesInVector; + --storage->m_numValuesInVector; result = valueSlot; valueSlot = JSValue(); } else result = jsUndefined(); } else { result = jsUndefined(); - if (SparseArrayValueMap* map = m_storage->m_sparseValueMap) { + if (SparseArrayValueMap* map = storage->m_sparseValueMap) { SparseArrayValueMap::iterator it = map->find(length); if (it != map->end()) { result = it->second; map->remove(it); if (map->isEmpty()) { delete map; - m_storage->m_sparseValueMap = 0; + storage->m_sparseValueMap = 0; } } } } - m_storage->m_length = length; + storage->m_length = length; checkConsistency(); @@ -624,22 +713,25 @@ JSValue JSArray::pop() void JSArray::push(ExecState* exec, JSValue value) { checkConsistency(); + + ArrayStorage* storage = arrayStorage(); - if (m_storage->m_length < m_vectorLength) { - m_storage->m_vector[m_storage->m_length] = value; - ++m_storage->m_numValuesInVector; - ++m_storage->m_length; + if (storage->m_length < m_vectorLength) { + m_vector[storage->m_length] = value; + ++storage->m_numValuesInVector; + ++storage->m_length; checkConsistency(); return; } - if (m_storage->m_length < MIN_SPARSE_ARRAY_INDEX) { - SparseArrayValueMap* map = m_storage->m_sparseValueMap; + if (storage->m_length < MIN_SPARSE_ARRAY_INDEX) { + SparseArrayValueMap* map = storage->m_sparseValueMap; if (!map || map->isEmpty()) { - if (increaseVectorLength(m_storage->m_length + 1)) { - m_storage->m_vector[m_storage->m_length] = value; - ++m_storage->m_numValuesInVector; - ++m_storage->m_length; + if (increaseVectorLength(storage->m_length + 1)) { + storage = arrayStorage(); + m_vector[storage->m_length] = value; + ++storage->m_numValuesInVector; + ++storage->m_length; checkConsistency(); return; } @@ -649,7 +741,98 @@ void JSArray::push(ExecState* exec, JSValue value) } } - putSlowCase(exec, m_storage->m_length++, value); + putSlowCase(exec, storage->m_length++, value); +} + +void JSArray::shiftCount(ExecState* exec, int count) +{ + ASSERT(count > 0); + + ArrayStorage* storage = arrayStorage(); + + unsigned oldLength = storage->m_length; + + if (!oldLength) + return; + + if (oldLength != storage->m_numValuesInVector) { + // If m_length and m_numValuesInVector aren't the same, we have a sparse vector + // which means we need to go through each entry looking for the the "empty" + // slots and then fill them with possible properties. See ECMA spec. + // 15.4.4.9 steps 11 through 13. + for (unsigned i = count; i < oldLength; ++i) { + if ((i >= m_vectorLength) || (!m_vector[i])) { + PropertySlot slot(this); + JSValue p = prototype(); + if ((!p.isNull()) && (asObject(p)->getPropertySlot(exec, i, slot))) + put(exec, i, slot.getValue(exec, i)); + } + } + + storage = arrayStorage(); // The put() above could have grown the vector and realloc'ed storage. + + // Need to decrement numValuesInvector based on number of real entries + for (unsigned i = 0; i < (unsigned)count; ++i) + if ((i < m_vectorLength) && (m_vector[i])) + --storage->m_numValuesInVector; + } else + storage->m_numValuesInVector -= count; + + storage->m_length -= count; + + if (m_vectorLength) { + count = min(m_vectorLength, (unsigned)count); + + m_vectorLength -= count; + + if (m_vectorLength) { + char* newBaseStorage = reinterpret_cast<char*>(storage) + count * sizeof(JSValue); + memmove(newBaseStorage, storage, storageSize(0)); + storage = reinterpret_cast<ArrayStorage*>(newBaseStorage); + + m_indexBias += count; + setArrayStorage(storage); + } + } +} + +void JSArray::unshiftCount(ExecState* exec, int count) +{ + ArrayStorage* storage = arrayStorage(); + + ASSERT(m_indexBias >= 0); + ASSERT(count >= 0); + + unsigned length = storage->m_length; + + if (length != storage->m_numValuesInVector) { + // If m_length and m_numValuesInVector aren't the same, we have a sparse vector + // which means we need to go through each entry looking for the the "empty" + // slots and then fill them with possible properties. See ECMA spec. + // 15.4.4.13 steps 8 through 10. + for (unsigned i = 0; i < length; ++i) { + if ((i >= m_vectorLength) || (!m_vector[i])) { + PropertySlot slot(this); + JSValue p = prototype(); + if ((!p.isNull()) && (asObject(p)->getPropertySlot(exec, i, slot))) + put(exec, i, slot.getValue(exec, i)); + } + } + } + + storage = arrayStorage(); // The put() above could have grown the vector and realloc'ed storage. + + if (m_indexBias >= count) { + m_indexBias -= count; + char* newBaseStorage = reinterpret_cast<char*>(storage) - count * sizeof(JSValue); + memmove(newBaseStorage, storage, storageSize(0)); + storage = reinterpret_cast<ArrayStorage*>(newBaseStorage); + setArrayStorage(storage); + m_vectorLength += count; + } else if ((!m_indexBias) && (!increaseVectorPrefixLength(m_vectorLength + count))) { + throwOutOfMemoryError(exec); + return; + } } void JSArray::markChildren(MarkStack& markStack) @@ -675,8 +858,10 @@ static int compareByStringPairForQSort(const void* a, const void* b) void JSArray::sortNumeric(ExecState* exec, JSValue compareFunction, CallType callType, const CallData& callData) { + ArrayStorage* storage = arrayStorage(); + unsigned lengthNotIncludingUndefined = compactForSorting(); - if (m_storage->m_sparseValueMap) { + if (storage->m_sparseValueMap) { throwOutOfMemoryError(exec); return; } @@ -685,9 +870,9 @@ void JSArray::sortNumeric(ExecState* exec, JSValue compareFunction, CallType cal return; bool allValuesAreNumbers = true; - size_t size = m_storage->m_numValuesInVector; + size_t size = storage->m_numValuesInVector; for (size_t i = 0; i < size; ++i) { - if (!m_storage->m_vector[i].isNumber()) { + if (!m_vector[i].isNumber()) { allValuesAreNumbers = false; break; } @@ -699,15 +884,17 @@ void JSArray::sortNumeric(ExecState* exec, JSValue compareFunction, CallType cal // For numeric comparison, which is fast, qsort is faster than mergesort. We // also don't require mergesort's stability, since there's no user visible // side-effect from swapping the order of equal primitive values. - qsort(m_storage->m_vector, size, sizeof(JSValue), compareNumbersForQSort); + qsort(m_vector, size, sizeof(JSValue), compareNumbersForQSort); checkConsistency(SortConsistencyCheck); } void JSArray::sort(ExecState* exec) { + ArrayStorage* storage = arrayStorage(); + unsigned lengthNotIncludingUndefined = compactForSorting(); - if (m_storage->m_sparseValueMap) { + if (storage->m_sparseValueMap) { throwOutOfMemoryError(exec); return; } @@ -727,7 +914,7 @@ void JSArray::sort(ExecState* exec) } for (size_t i = 0; i < lengthNotIncludingUndefined; i++) { - JSValue value = m_storage->m_vector[i]; + JSValue value = m_vector[i]; ASSERT(!value.isUndefined()); values[i].first = value; } @@ -759,7 +946,7 @@ void JSArray::sort(ExecState* exec) // modifying the vector incorrectly. for (size_t i = 0; i < lengthNotIncludingUndefined; i++) - m_storage->m_vector[i] = values[i].first; + m_vector[i] = values[i].first; checkConsistency(SortConsistencyCheck); } @@ -846,18 +1033,20 @@ void JSArray::sort(ExecState* exec, JSValue compareFunction, CallType callType, { checkConsistency(); + ArrayStorage* storage = arrayStorage(); + // FIXME: This ignores exceptions raised in the compare function or in toNumber. // The maximum tree depth is compiled in - but the caller is clearly up to no good // if a larger array is passed. - ASSERT(m_storage->m_length <= static_cast<unsigned>(std::numeric_limits<int>::max())); - if (m_storage->m_length > static_cast<unsigned>(std::numeric_limits<int>::max())) + ASSERT(storage->m_length <= static_cast<unsigned>(std::numeric_limits<int>::max())); + if (storage->m_length > static_cast<unsigned>(std::numeric_limits<int>::max())) return; - if (!m_storage->m_length) + if (!storage->m_length) return; - unsigned usedVectorLength = min(m_storage->m_length, m_vectorLength); + unsigned usedVectorLength = min(storage->m_length, m_vectorLength); AVLTree<AVLTreeAbstractorForArrayCompare, 44> tree; // Depth 44 is enough for 2^31 items tree.abstractor().m_exec = exec; @@ -865,7 +1054,7 @@ void JSArray::sort(ExecState* exec, JSValue compareFunction, CallType callType, tree.abstractor().m_compareCallType = callType; tree.abstractor().m_compareCallData = &callData; tree.abstractor().m_globalThisValue = exec->globalThisValue(); - tree.abstractor().m_nodes.resize(usedVectorLength + (m_storage->m_sparseValueMap ? m_storage->m_sparseValueMap->size() : 0)); + tree.abstractor().m_nodes.resize(usedVectorLength + (storage->m_sparseValueMap ? storage->m_sparseValueMap->size() : 0)); if (callType == CallTypeJS) tree.abstractor().m_cachedCall = adoptPtr(new CachedCall(exec, asFunction(compareFunction), 2, exec->exceptionSlot())); @@ -883,14 +1072,14 @@ void JSArray::sort(ExecState* exec, JSValue compareFunction, CallType callType, // Iterate over the array, ignoring missing values, counting undefined ones, and inserting all other ones into the tree. for (; numDefined < usedVectorLength; ++numDefined) { - JSValue v = m_storage->m_vector[numDefined]; + JSValue v = m_vector[numDefined]; if (!v || v.isUndefined()) break; tree.abstractor().m_nodes[numDefined].value = v; tree.insert(numDefined); } for (unsigned i = numDefined; i < usedVectorLength; ++i) { - JSValue v = m_storage->m_vector[i]; + JSValue v = m_vector[i]; if (v) { if (v.isUndefined()) ++numUndefined; @@ -904,7 +1093,7 @@ void JSArray::sort(ExecState* exec, JSValue compareFunction, CallType callType, unsigned newUsedVectorLength = numDefined + numUndefined; - if (SparseArrayValueMap* map = m_storage->m_sparseValueMap) { + if (SparseArrayValueMap* map = storage->m_sparseValueMap) { newUsedVectorLength += map->size(); if (newUsedVectorLength > m_vectorLength) { // Check that it is possible to allocate an array large enough to hold all the entries. @@ -913,6 +1102,8 @@ void JSArray::sort(ExecState* exec, JSValue compareFunction, CallType callType, return; } } + + storage = arrayStorage(); SparseArrayValueMap::iterator end = map->end(); for (SparseArrayValueMap::iterator it = map->begin(); it != end; ++it) { @@ -922,7 +1113,7 @@ void JSArray::sort(ExecState* exec, JSValue compareFunction, CallType callType, } delete map; - m_storage->m_sparseValueMap = 0; + storage->m_sparseValueMap = 0; } ASSERT(tree.abstractor().m_nodes.size() >= numDefined); @@ -934,27 +1125,29 @@ void JSArray::sort(ExecState* exec, JSValue compareFunction, CallType callType, AVLTree<AVLTreeAbstractorForArrayCompare, 44>::Iterator iter; iter.start_iter_least(tree); for (unsigned i = 0; i < numDefined; ++i) { - m_storage->m_vector[i] = tree.abstractor().m_nodes[*iter].value; + m_vector[i] = tree.abstractor().m_nodes[*iter].value; ++iter; } // Put undefined values back in. for (unsigned i = numDefined; i < newUsedVectorLength; ++i) - m_storage->m_vector[i] = jsUndefined(); + m_vector[i] = jsUndefined(); // Ensure that unused values in the vector are zeroed out. for (unsigned i = newUsedVectorLength; i < usedVectorLength; ++i) - m_storage->m_vector[i] = JSValue(); + m_vector[i] = JSValue(); - m_storage->m_numValuesInVector = newUsedVectorLength; + storage->m_numValuesInVector = newUsedVectorLength; checkConsistency(SortConsistencyCheck); } void JSArray::fillArgList(ExecState* exec, MarkedArgumentBuffer& args) { - JSValue* vector = m_storage->m_vector; - unsigned vectorEnd = min(m_storage->m_length, m_vectorLength); + ArrayStorage* storage = arrayStorage(); + + JSValue* vector = storage->m_vector; + unsigned vectorEnd = min(storage->m_length, m_vectorLength); unsigned i = 0; for (; i < vectorEnd; ++i) { JSValue& v = vector[i]; @@ -963,15 +1156,15 @@ void JSArray::fillArgList(ExecState* exec, MarkedArgumentBuffer& args) args.append(v); } - for (; i < m_storage->m_length; ++i) + for (; i < storage->m_length; ++i) args.append(get(exec, i)); } void JSArray::copyToRegisters(ExecState* exec, Register* buffer, uint32_t maxSize) { - ASSERT(m_storage->m_length >= maxSize); + ASSERT(arrayStorage()->m_length >= maxSize); UNUSED_PARAM(maxSize); - JSValue* vector = m_storage->m_vector; + JSValue* vector = m_vector; unsigned vectorEnd = min(maxSize, m_vectorLength); unsigned i = 0; for (; i < vectorEnd; ++i) { @@ -989,25 +1182,25 @@ unsigned JSArray::compactForSorting() { checkConsistency(); - ArrayStorage* storage = m_storage; + ArrayStorage* storage = arrayStorage(); - unsigned usedVectorLength = min(m_storage->m_length, m_vectorLength); + unsigned usedVectorLength = min(storage->m_length, m_vectorLength); unsigned numDefined = 0; unsigned numUndefined = 0; for (; numDefined < usedVectorLength; ++numDefined) { - JSValue v = storage->m_vector[numDefined]; + JSValue v = m_vector[numDefined]; if (!v || v.isUndefined()) break; } for (unsigned i = numDefined; i < usedVectorLength; ++i) { - JSValue v = storage->m_vector[i]; + JSValue v = m_vector[i]; if (v) { if (v.isUndefined()) ++numUndefined; else - storage->m_vector[numDefined++] = v; + m_vector[numDefined++] = v; } } @@ -1020,21 +1213,22 @@ unsigned JSArray::compactForSorting() // exception is thrown by caller. if ((newUsedVectorLength > MAX_STORAGE_VECTOR_LENGTH) || !increaseVectorLength(newUsedVectorLength)) return 0; - storage = m_storage; + + storage = arrayStorage(); } SparseArrayValueMap::iterator end = map->end(); for (SparseArrayValueMap::iterator it = map->begin(); it != end; ++it) - storage->m_vector[numDefined++] = it->second; + m_vector[numDefined++] = it->second; delete map; storage->m_sparseValueMap = 0; } for (unsigned i = numDefined; i < newUsedVectorLength; ++i) - storage->m_vector[i] = jsUndefined(); + m_vector[i] = jsUndefined(); for (unsigned i = newUsedVectorLength; i < usedVectorLength; ++i) - storage->m_vector[i] = JSValue(); + m_vector[i] = JSValue(); storage->m_numValuesInVector = newUsedVectorLength; @@ -1045,42 +1239,44 @@ unsigned JSArray::compactForSorting() void* JSArray::subclassData() const { - return m_storage->subclassData; + return arrayStorage()->subclassData; } void JSArray::setSubclassData(void* d) { - m_storage->subclassData = d; + arrayStorage()->subclassData = d; } #if CHECK_ARRAY_CONSISTENCY void JSArray::checkConsistency(ConsistencyCheckType type) { - ASSERT(m_storage); + ArrayStorage* storage = arrayStorage(); + + ASSERT(storage); if (type == SortConsistencyCheck) - ASSERT(!m_storage->m_sparseValueMap); + ASSERT(!storage->m_sparseValueMap); unsigned numValuesInVector = 0; for (unsigned i = 0; i < m_vectorLength; ++i) { - if (JSValue value = m_storage->m_vector[i]) { - ASSERT(i < m_storage->m_length); + if (JSValue value = m_vector[i]) { + ASSERT(i < storage->m_length); if (type != DestructorConsistencyCheck) value.isUndefined(); // Likely to crash if the object was deallocated. ++numValuesInVector; } else { if (type == SortConsistencyCheck) - ASSERT(i >= m_storage->m_numValuesInVector); + ASSERT(i >= storage->m_numValuesInVector); } } - ASSERT(numValuesInVector == m_storage->m_numValuesInVector); - ASSERT(numValuesInVector <= m_storage->m_length); + ASSERT(numValuesInVector == storage->m_numValuesInVector); + ASSERT(numValuesInVector <= storage->m_length); - if (m_storage->m_sparseValueMap) { - SparseArrayValueMap::iterator end = m_storage->m_sparseValueMap->end(); - for (SparseArrayValueMap::iterator it = m_storage->m_sparseValueMap->begin(); it != end; ++it) { + if (storage->m_sparseValueMap) { + SparseArrayValueMap::iterator end = storage->m_sparseValueMap->end(); + for (SparseArrayValueMap::iterator it = storage->m_sparseValueMap->begin(); it != end; ++it) { unsigned index = it->first; - ASSERT(index < m_storage->m_length); + ASSERT(index < storage->m_length); ASSERT(index >= m_vectorLength); ASSERT(index <= MAX_ARRAY_INDEX); ASSERT(it->second); diff --git a/JavaScriptCore/runtime/JSArray.h b/JavaScriptCore/runtime/JSArray.h index b6dd7cc..a7ce328 100644 --- a/JavaScriptCore/runtime/JSArray.h +++ b/JavaScriptCore/runtime/JSArray.h @@ -29,8 +29,13 @@ namespace JSC { typedef HashMap<unsigned, JSValue> SparseArrayValueMap; + // This struct holds the actual data values of an array. A JSArray object points to it's contained ArrayStorage + // struct by pointing to m_vector. To access the contained ArrayStorage struct, use the getStorage() and + // setStorage() methods. It is important to note that there may be space before the ArrayStorage that + // is used to quick unshift / shift operation. The actual allocated pointer is available by using: + // getStorage() - m_indexBias * sizeof(JSValue) struct ArrayStorage { - unsigned m_length; + unsigned m_length; // The "length" property on the array unsigned m_numValuesInVector; SparseArrayValueMap* m_sparseValueMap; void* subclassData; // A JSArray subclass can use this to fill the vector lazily. @@ -67,8 +72,8 @@ namespace JSC { virtual void put(ExecState*, unsigned propertyName, JSValue); // FIXME: Make protected and add setItem. static JS_EXPORTDATA const ClassInfo info; - - unsigned length() const { return m_storage->m_length; } + + unsigned length() const { return arrayStorage()->m_length; } void setLength(unsigned); // OK to use on new arrays, but not if it might be a RegExpMatchArray. void sort(ExecState*); @@ -78,33 +83,39 @@ namespace JSC { void push(ExecState*, JSValue); JSValue pop(); - bool canGetIndex(unsigned i) { return i < m_vectorLength && m_storage->m_vector[i]; } + void shiftCount(ExecState*, int count); + void unshiftCount(ExecState*, int count); + + bool canGetIndex(unsigned i) { return i < m_vectorLength && m_vector[i]; } JSValue getIndex(unsigned i) { ASSERT(canGetIndex(i)); - return m_storage->m_vector[i]; + return m_vector[i]; } bool canSetIndex(unsigned i) { return i < m_vectorLength; } void setIndex(unsigned i, JSValue v) { ASSERT(canSetIndex(i)); - JSValue& x = m_storage->m_vector[i]; + + JSValue& x = m_vector[i]; if (!x) { - ++m_storage->m_numValuesInVector; - if (i >= m_storage->m_length) - m_storage->m_length = i + 1; + ArrayStorage *storage = arrayStorage(); + ++storage->m_numValuesInVector; + if (i >= storage->m_length) + storage->m_length = i + 1; } x = v; } - + void uncheckedSetIndex(unsigned i, JSValue v) { ASSERT(canSetIndex(i)); + ArrayStorage *storage = arrayStorage(); #if CHECK_ARRAY_CONSISTENCY - ASSERT(m_storage->m_inCompactInitialization); + ASSERT(storage->m_inCompactInitialization); #endif - m_storage->m_vector[i] = v; + storage->m_vector[i] = v; } void fillArgList(ExecState*, MarkedArgumentBuffer&); @@ -127,6 +138,16 @@ namespace JSC { void* subclassData() const; void setSubclassData(void*); + + inline ArrayStorage *arrayStorage() const + { + return reinterpret_cast<ArrayStorage*>(reinterpret_cast<char*>(m_vector) - (sizeof(ArrayStorage) - sizeof(JSValue))); + } + + inline void setArrayStorage(ArrayStorage *storage) + { + m_vector = &storage->m_vector[0]; + } private: virtual const ClassInfo* classInfo() const { return &info; } @@ -134,15 +155,18 @@ namespace JSC { bool getOwnPropertySlotSlowCase(ExecState*, unsigned propertyName, PropertySlot&); void putSlowCase(ExecState*, unsigned propertyName, JSValue); + unsigned getNewVectorLength(unsigned desiredLength); bool increaseVectorLength(unsigned newLength); + bool increaseVectorPrefixLength(unsigned newLength); unsigned compactForSorting(); enum ConsistencyCheckType { NormalConsistencyCheck, DestructorConsistencyCheck, SortConsistencyCheck }; void checkConsistency(ConsistencyCheckType = NormalConsistencyCheck); - unsigned m_vectorLength; - ArrayStorage* m_storage; + unsigned m_vectorLength; // The valid length of m_vector + int m_indexBias; // The number of JSValue sized blocks before ArrayStorage. + JSValue* m_vector; // Copy of ArrayStorage.m_vector. Used for quick vector access and to materialize ArrayStorage ptr. }; JSArray* asArray(JSValue); @@ -168,7 +192,7 @@ namespace JSC { { JSObject::markChildrenDirect(markStack); - ArrayStorage* storage = m_storage; + ArrayStorage* storage = arrayStorage(); unsigned usedVectorLength = std::min(storage->m_length, m_vectorLength); markStack.appendValues(storage->m_vector, usedVectorLength, MayContainNullValues); diff --git a/JavaScriptCore/wtf/CMakeLists.txt b/JavaScriptCore/wtf/CMakeLists.txt index 1119b3c..5cf108f 100644 --- a/JavaScriptCore/wtf/CMakeLists.txt +++ b/JavaScriptCore/wtf/CMakeLists.txt @@ -42,5 +42,6 @@ TARGET_LINK_LIBRARIES(${WTF_LIBRARY_NAME} ${WTF_LIBRARIES}) ADD_TARGET_PROPERTIES(${WTF_LIBRARY_NAME} LINK_FLAGS ${WTF_LINK_FLAGS}) IF (SHARED_CORE) + SET_TARGET_PROPERTIES(${WTF_LIBRARY_NAME} PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR}) INSTALL(TARGETS ${WTF_LIBRARY_NAME} DESTINATION lib) ENDIF () diff --git a/JavaScriptCore/wtf/PageAllocation.cpp b/JavaScriptCore/wtf/PageAllocation.cpp index 58a10f6..4cf2ea9 100644 --- a/JavaScriptCore/wtf/PageAllocation.cpp +++ b/JavaScriptCore/wtf/PageAllocation.cpp @@ -176,7 +176,7 @@ size_t PageAllocation::pagesize() bool PageAllocation::commit(void* start, size_t size, bool writable, bool executable) const { if (m_chunk) { - intptr_t offset = static_cast<intptr_t>(base()) - static_cast<intptr_t>(start); + intptr_t offset = reinterpret_cast<intptr_t>(base()) - reinterpret_cast<intptr_t>(start); m_chunk->Commit(offset, size); } return true; @@ -185,7 +185,7 @@ bool PageAllocation::commit(void* start, size_t size, bool writable, bool execut void PageAllocation::decommit(void* start, size_t size) const { if (m_chunk) { - intptr_t offset = static_cast<intptr_t>(base()) - static_cast<intptr_t>(start); + intptr_t offset = reinterpret_cast<intptr_t>(base()) - reinterpret_cast<intptr_t>(start); m_chunk->Decommit(offset, size); } } @@ -205,7 +205,7 @@ PageAllocation PageAllocation::reserve(size_t size, Usage usage, bool writable, return PageAllocation(fastMalloc(size), size, 0); RChunk* rchunk = new RChunk(); TInt errorCode = rchunk->CreateLocalCode(0, size); - return PageAllocation(rchunk, rchunk->Base(), size); + return PageAllocation(rchunk->Base(), size, rchunk); } void PageAllocation::deallocate() diff --git a/JavaScriptCore/wtf/PageAllocation.h b/JavaScriptCore/wtf/PageAllocation.h index 00b5363..b846482 100644 --- a/JavaScriptCore/wtf/PageAllocation.h +++ b/JavaScriptCore/wtf/PageAllocation.h @@ -67,7 +67,7 @@ public: : m_base(base) , m_size(size) #if OS(SYMBIAN) - , m_chunk(parent.chunk) + , m_chunk(parent.m_chunk) #endif { #if defined(NDEBUG) && !OS(SYMBIAN) diff --git a/JavaScriptCore/wtf/Platform.h b/JavaScriptCore/wtf/Platform.h index 30948fa..eca4248 100644 --- a/JavaScriptCore/wtf/Platform.h +++ b/JavaScriptCore/wtf/Platform.h @@ -571,9 +571,6 @@ #if PLATFORM(QT) #define WTF_USE_QT4_UNICODE 1 -#if !defined(ENABLE_WIDGETS_10_SUPPORT) -#define ENABLE_WIDGETS_10_SUPPORT 1 -#endif #elif OS(WINCE) #define WTF_USE_WINCE_UNICODE 1 #elif PLATFORM(GTK) @@ -838,10 +835,6 @@ #define ENABLE_DASHBOARD_SUPPORT 0 #endif -#if !defined(ENABLE_WIDGETS_10_SUPPORT) -#define ENABLE_WIDGETS_10_SUPPORT 0 -#endif - #if !defined(ENABLE_INSPECTOR) #define ENABLE_INSPECTOR 1 #endif diff --git a/JavaScriptCore/wtf/Threading.h b/JavaScriptCore/wtf/Threading.h index 415a8fc..044365f 100644 --- a/JavaScriptCore/wtf/Threading.h +++ b/JavaScriptCore/wtf/Threading.h @@ -101,6 +101,7 @@ ThreadIdentifier currentThread(); int waitForThreadCompletion(ThreadIdentifier, void**); void detachThread(ThreadIdentifier); +void yield(); void lockAtomicallyInitializedStaticMutex(); void unlockAtomicallyInitializedStaticMutex(); @@ -112,5 +113,6 @@ using WTF::createThread; using WTF::currentThread; using WTF::detachThread; using WTF::waitForThreadCompletion; +using WTF::yield; #endif // Threading_h diff --git a/JavaScriptCore/wtf/ThreadingPthreads.cpp b/JavaScriptCore/wtf/ThreadingPthreads.cpp index d01cc4a..98286d3 100644 --- a/JavaScriptCore/wtf/ThreadingPthreads.cpp +++ b/JavaScriptCore/wtf/ThreadingPthreads.cpp @@ -44,6 +44,7 @@ #if !COMPILER(MSVC) #include <limits.h> +#include <sched.h> #include <sys/time.h> #endif @@ -221,6 +222,11 @@ void detachThread(ThreadIdentifier threadID) pthread_detach(pthreadHandle); } +void yield() +{ + sched_yield(); +} + ThreadIdentifier currentThread() { ThreadIdentifier id = ThreadIdentifierData::identifier(); diff --git a/JavaScriptCore/wtf/ThreadingWin.cpp b/JavaScriptCore/wtf/ThreadingWin.cpp index c16be5a..a29fbbb 100644 --- a/JavaScriptCore/wtf/ThreadingWin.cpp +++ b/JavaScriptCore/wtf/ThreadingWin.cpp @@ -266,6 +266,11 @@ void detachThread(ThreadIdentifier threadID) clearThreadHandleForIdentifier(threadID); } +void yield() +{ + ::Sleep(1); +} + ThreadIdentifier currentThread() { return static_cast<ThreadIdentifier>(GetCurrentThreadId()); diff --git a/JavaScriptCore/wtf/gtk/ThreadingGtk.cpp b/JavaScriptCore/wtf/gtk/ThreadingGtk.cpp index 981eacb..863ee81 100644 --- a/JavaScriptCore/wtf/gtk/ThreadingGtk.cpp +++ b/JavaScriptCore/wtf/gtk/ThreadingGtk.cpp @@ -167,6 +167,11 @@ ThreadIdentifier currentThread() return establishIdentifierForThread(currentThread); } +void yield() +{ + g_thread_yield(); +} + Mutex::Mutex() : m_mutex(g_mutex_new()) { diff --git a/JavaScriptCore/wtf/qt/ThreadingQt.cpp b/JavaScriptCore/wtf/qt/ThreadingQt.cpp index 7f81646..8041dea 100644 --- a/JavaScriptCore/wtf/qt/ThreadingQt.cpp +++ b/JavaScriptCore/wtf/qt/ThreadingQt.cpp @@ -208,6 +208,11 @@ ThreadIdentifier currentThread() return establishIdentifierForThread(currentThread); } +void yield() +{ + QThread::yieldCurrentThread(); +} + Mutex::Mutex() : m_mutex(new QMutex()) { diff --git a/JavaScriptCore/yarr/RegexJIT.cpp b/JavaScriptCore/yarr/RegexJIT.cpp index 609417f..9eff75a 100644 --- a/JavaScriptCore/yarr/RegexJIT.cpp +++ b/JavaScriptCore/yarr/RegexJIT.cpp @@ -1032,6 +1032,9 @@ class RegexGenerator : private MacroAssembler { TermGenerationState parenthesesState(disjunction, state.checkedTotal); Label matchAgain(this); + + storeToFrame(index, parenthesesTerm.frameLocation); // Save the current index to check for zero len matches later. + for (parenthesesState.resetAlternative(); parenthesesState.alternativeValid(); parenthesesState.nextAlternative()) { PatternAlternative* alternative = parenthesesState.alternative(); @@ -1046,9 +1049,9 @@ class RegexGenerator : private MacroAssembler { for (parenthesesState.resetTerm(); parenthesesState.termValid(); parenthesesState.nextTerm()) generateTerm(parenthesesState); - // If we get here, we matched! Limit not yet supported, so just try to match more! - jump(matchAgain); - + // If we get here, we matched! If the index advanced then try to match more since limit isn't supported yet. + branch32(GreaterThan, index, Address(stackPointerRegister, (parenthesesTerm.frameLocation * sizeof(void*))), matchAgain); + parenthesesState.linkAlternativeBacktracks(this); // We get here if the alternative fails to match - fall through to the next iteration, or out of the loop. diff --git a/JavaScriptGlue/Configurations/Version.xcconfig b/JavaScriptGlue/Configurations/Version.xcconfig index c1b6b32..2893a3c 100644 --- a/JavaScriptGlue/Configurations/Version.xcconfig +++ b/JavaScriptGlue/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 534; -MINOR_VERSION = 4; +MINOR_VERSION = 5; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/LayoutTests/fast/dom/DeviceOrientation/basic-operation-expected.txt b/LayoutTests/fast/dom/DeviceOrientation/basic-operation-expected.txt new file mode 100644 index 0000000..48dc123 --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/basic-operation-expected.txt @@ -0,0 +1,12 @@ +Tests the basic operation of DeviceOrientation using the mock. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS deviceOrientationEvent.alpha is mockAlpha +PASS deviceOrientationEvent.beta is mockBeta +PASS deviceOrientationEvent.gamma is mockGamma +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/dom/DeviceOrientation/basic-operation.html b/LayoutTests/fast/dom/DeviceOrientation/basic-operation.html new file mode 100644 index 0000000..4bc77ce --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/basic-operation.html @@ -0,0 +1,12 @@ +<html> +<head> +<link rel="stylesheet" href="../../js/resources/js-test-style.css"> +<script src="../../js/resources/js-test-pre.js"></script> +</head> +<body> +<p id="description"></p> +<div id="console"></div> +<script src="script-tests/basic-operation.js"></script> +<script src="../../js/resources/js-test-post.js"></script> +</body> +</html> diff --git a/LayoutTests/fast/dom/DeviceOrientation/script-tests/basic-operation.js b/LayoutTests/fast/dom/DeviceOrientation/script-tests/basic-operation.js new file mode 100644 index 0000000..6e68b06 --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/script-tests/basic-operation.js @@ -0,0 +1,22 @@ +description("Tests the basic operation of DeviceOrientation using the mock."); + +var mockAlpha = 1.1; +var mockBeta = 2.2; +var mockGamma = 3.3; + +if (window.layoutTestController) + layoutTestController.setMockDeviceOrientation(true, mockAlpha, true, mockBeta, true, mockGamma); +else + debug('This test can not be run without the LayoutTestController'); + +var deviceOrientationEvent; +window.addEventListener("deviceorientation", function(e) { + deviceOrientationEvent = e; + shouldBe('deviceOrientationEvent.alpha', 'mockAlpha'); + shouldBe('deviceOrientationEvent.beta', 'mockBeta'); + shouldBe('deviceOrientationEvent.gamma', 'mockGamma'); + finishJSTest(); +}); + +window.jsTestIsAsync = true; +window.successfullyParsed = true; diff --git a/WebCore/Android.derived.jscbindings.mk b/WebCore/Android.derived.jscbindings.mk index e1cd523..7dfb90e 100644 --- a/WebCore/Android.derived.jscbindings.mk +++ b/WebCore/Android.derived.jscbindings.mk @@ -392,12 +392,12 @@ GEN := \ $(intermediates)/storage/JSIDBDatabaseRequest.h \ $(intermediates)/storage/JSIDBErrorEvent.h \ $(intermediates)/storage/JSIDBEvent.h \ - $(intermediates)/storage/JSIDBIndexRequest.h \ + $(intermediates)/storage/JSIDBFactory.h \ + $(intermediates)/storage/JSIDBIndex.h \ $(intermediates)/storage/JSIDBKey.h \ $(intermediates)/storage/JSIDBKeyRange.h \ $(intermediates)/storage/JSIDBRequest.h \ - $(intermediates)/storage/JSIDBSuccessEvent.h \ - $(intermediates)/storage/JSIndexedDatabaseRequest.h + $(intermediates)/storage/JSIDBSuccessEvent.h $(GEN): PRIVATE_PATH := $(LOCAL_PATH) $(GEN): PRIVATE_CUSTOM_TOOL = perl -I$(PRIVATE_PATH)/bindings/scripts $(PRIVATE_PATH)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS --include dom --include html --include storage --outputdir $(dir $@) $< diff --git a/WebCore/Android.derived.v8bindings.mk b/WebCore/Android.derived.v8bindings.mk index 06865c1..5f576ea 100644 --- a/WebCore/Android.derived.v8bindings.mk +++ b/WebCore/Android.derived.v8bindings.mk @@ -386,12 +386,12 @@ GEN := \ $(intermediates)/bindings/V8IDBDatabaseRequest.h \ $(intermediates)/bindings/V8IDBErrorEvent.h \ $(intermediates)/bindings/V8IDBEvent.h \ - $(intermediates)/bindings/V8IDBIndexRequest.h \ + $(intermediates)/bindings/V8IDBFactory.h \ + $(intermediates)/bindings/V8IDBIndex.h \ $(intermediates)/bindings/V8IDBKey.h \ $(intermediates)/bindings/V8IDBKeyRange.h \ $(intermediates)/bindings/V8IDBRequest.h \ - $(intermediates)/bindings/V8IDBSuccessEvent.h \ - $(intermediates)/bindings/V8IndexedDatabaseRequest.h + $(intermediates)/bindings/V8IDBSuccessEvent.h $(GEN): PRIVATE_PATH := $(LOCAL_PATH) $(GEN): PRIVATE_CUSTOM_TOOL = SOURCE_ROOT=$(PRIVATE_PATH) perl -I$(PRIVATE_PATH)/bindings/scripts $(PRIVATE_PATH)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator V8 --include dom --include html --include storage --outputdir $(dir $@) $< diff --git a/WebCore/Android.mk b/WebCore/Android.mk index 82b444a..bc7cc1e 100644 --- a/WebCore/Android.mk +++ b/WebCore/Android.mk @@ -565,7 +565,9 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ platform/image-decoders/gif/GIFImageDecoder.cpp \ platform/image-decoders/gif/GIFImageReader.cpp \ \ + platform/mock/DeviceOrientationClientMock.cpp \ platform/mock/GeolocationServiceMock.cpp \ + platform/mock/SpeechInputClientMock.cpp \ \ platform/network/AuthenticationChallengeBase.cpp \ platform/network/Credential.cpp \ @@ -813,17 +815,23 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ storage/IDBDatabaseRequest.cpp \ storage/IDBErrorEvent.cpp \ storage/IDBEvent.cpp \ - storage/IDBIndexImpl.cpp \ - storage/IDBIndexRequest.cpp \ + storage/IDBIndex.cpp \ + storage/IDBIndexBackendImpl.cpp \ storage/IDBKey.cpp \ storage/IDBKeyRange.cpp \ storage/IDBObjectStoreImpl.cpp \ storage/IDBObjectStoreRequest.cpp \ storage/IDBRequest.cpp \ storage/IDBSuccessEvent.cpp \ +<<<<<<< HEAD storage/IndexedDatabase.cpp \ storage/IndexedDatabaseImpl.cpp \ storage/IndexedDatabaseRequest.cpp \ +======= + storage/IDBFactory.cpp \ + storage/IDBFactoryBackendInterface.cpp \ + storage/IDBFactoryBackendImpl.cpp \ +>>>>>>> webkit.org at r64523 storage/LocalStorageTask.cpp \ storage/LocalStorageThread.cpp \ storage/OriginQuotaManager.cpp \ diff --git a/WebCore/CMakeLists.txt b/WebCore/CMakeLists.txt index a0f5123..e0a64af 100644 --- a/WebCore/CMakeLists.txt +++ b/WebCore/CMakeLists.txt @@ -49,6 +49,7 @@ SET(WebCore_INCLUDE_DIRECTORIES "${WEBCORE_DIR}/svg/graphics" "${WEBCORE_DIR}/svg/graphics/filters" "${WEBCORE_DIR}/websockets" + "${WEBCORE_DIR}/wml" "${WEBCORE_DIR}/workers" "${WEBCORE_DIR}/xml" "${JAVASCRIPTCORE_DIR}" @@ -337,13 +338,13 @@ SET(WebCore_IDL_FILES storage/IDBDatabaseRequest.idl storage/IDBErrorEvent.idl storage/IDBEvent.idl - storage/IDBIndexRequest.idl + storage/IDBFactory.idl + storage/IDBIndex.idl storage/IDBKey.idl storage/IDBKeyRange.idl storage/IDBObjectStoreRequest.idl storage/IDBRequest.idl storage/IDBSuccessEvent.idl - storage/IndexedDatabaseRequest.idl storage/SQLError.idl storage/SQLException.idl storage/SQLResultSet.idl @@ -1274,6 +1275,7 @@ SET(WebCore_SOURCES platform/image-decoders/jpeg/JPEGImageDecoder.cpp platform/image-decoders/png/PNGImageDecoder.cpp + platform/mock/DeviceOrientationClientMock.cpp platform/mock/GeolocationServiceMock.cpp platform/network/AuthenticationChallengeBase.cpp @@ -1436,15 +1438,17 @@ SET(WebCore_SOURCES storage/IDBDatabaseRequest.cpp storage/IDBErrorEvent.cpp storage/IDBEvent.cpp + storage/IDBIndex.cpp + storage/IDBIndexBackendImpl.cpp storage/IDBKey.cpp storage/IDBKeyRange.cpp storage/IDBRequest.cpp storage/IDBObjectStoreImpl.cpp storage/IDBObjectStoreRequest.cpp storage/IDBSuccessEvent.cpp - storage/IndexedDatabase.cpp - storage/IndexedDatabaseImpl.cpp - storage/IndexedDatabaseRequest.cpp + storage/IDBFactory.cpp + storage/IDBFactoryBackendInterface.cpp + storage/IDBFactoryBackendImpl.cpp storage/LocalStorageTask.cpp storage/LocalStorageThread.cpp storage/OriginQuotaManager.cpp @@ -1736,6 +1740,49 @@ IF (ENABLE_SVG) ) ENDIF() +IF (ENABLE_WML) + LIST(APPEND WebCore_SOURCES + ${DERIVED_SOURCES_DIR}/WMLElementFactory.cpp + ${DERIVED_SOURCES_DIR}/WMLNames.cpp + wml/WMLAElement.cpp + wml/WMLAccessElement.cpp + wml/WMLAnchorElement.cpp + wml/WMLBRElement.cpp + wml/WMLCardElement.cpp + wml/WMLDoElement.cpp + wml/WMLDocument.cpp + wml/WMLElement.cpp + wml/WMLErrorHandling.cpp + wml/WMLEventHandlingElement.cpp + wml/WMLFieldSetElement.cpp + wml/WMLFormControlElement.cpp + wml/WMLGoElement.cpp + wml/WMLImageElement.cpp + wml/WMLImageLoader.cpp + wml/WMLInputElement.cpp + wml/WMLInsertedLegendElement.cpp + wml/WMLIntrinsicEvent.cpp + wml/WMLIntrinsicEventHandler.cpp + wml/WMLMetaElement.cpp + wml/WMLNoopElement.cpp + wml/WMLOnEventElement.cpp + wml/WMLPElement.cpp + wml/WMLOptGroupElement.cpp + wml/WMLOptionElement.cpp + wml/WMLPageState.cpp + wml/WMLPostfieldElement.cpp + wml/WMLPrevElement.cpp + wml/WMLRefreshElement.cpp + wml/WMLSelectElement.cpp + wml/WMLSetvarElement.cpp + wml/WMLTableElement.cpp + wml/WMLTaskElement.cpp + wml/WMLTemplateElement.cpp + wml/WMLTimerElement.cpp + wml/WMLVariables.cpp + ) +ENDIF() + SET(IDL_INCLUDES "") FOREACH (_include ${WebCore_IDL_INCLUDES}) LIST(APPEND IDL_INCLUDES --include=${WEBCORE_DIR}/${_include}) @@ -1780,6 +1827,7 @@ ADD_SOURCE_DERIVED_DEPENDENCIES(${WEBCORE_DIR}/css/CSSStyleSelector.cpp UserAgen GENERATE_DOM_NAMES_FACTORY(HTML ${WEBCORE_DIR}/html/HTMLTagNames.in ${WEBCORE_DIR}/html/HTMLAttributeNames.in "${HTML_FEATURES}") GENERATE_DOM_NAMES_FACTORY(MathML ${WEBCORE_DIR}/mathml/mathtags.in ${WEBCORE_DIR}/mathml/mathattrs.in "${MATHML_FEATURES}") GENERATE_DOM_NAMES_FACTORY(SVG ${WEBCORE_DIR}/svg/svgtags.in ${WEBCORE_DIR}/svg/svgattrs.in "${SVG_FEATURES}") +GENERATE_DOM_NAMES_FACTORY(WML ${WEBCORE_DIR}/wml/WMLTagNames.in ${WEBCORE_DIR}/wml/WMLAttributeNames.in "${WML_FEATURES}") GENERATE_DOM_NAMES_ONLY(XLink ${WEBCORE_DIR}/svg/xlinkattrs.in) GENERATE_DOM_NAMES_ONLY(XMLNS ${WEBCORE_DIR}/xml/xmlnsattrs.in) GENERATE_DOM_NAMES_ONLY(XML ${WEBCORE_DIR}/xml/xmlattrs.in) @@ -1833,5 +1881,6 @@ ADD_TARGET_PROPERTIES(${WebCore_LIBRARY_NAME} LINK_FLAGS ${WebCore_LINK_FLAGS}) IF (SHARED_CORE) + SET_TARGET_PROPERTIES(${WebCore_LIBRARY_NAME} PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR}) INSTALL(TARGETS ${WebCore_LIBRARY_NAME} DESTINATION lib) ENDIF () diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog index 999b591..aac8d9f 100644 --- a/WebCore/ChangeLog +++ b/WebCore/ChangeLog @@ -1,3 +1,4040 @@ +2010-08-02 Brady Eidson <beidson@apple.com> + + Reviewed by Anders Carlsson. + + Add VisitedLinkStrategy for each platform to implement + https://bugs.webkit.org/show_bug.cgi?id=43393 + + No new tests. (No change in behavior) + + * WebCore.exp.in: + * WebCore.xcodeproj/project.pbxproj: + + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::SelectorChecker::determineLinkStateSlowCase): Use VisitedLinkStrategy if it's enabled. + + * loader/HistoryController.cpp: + (WebCore::addVisitedLink): Choose VisitedLinkStrategy if it's enabled, else fallback to PageGroup. + (WebCore::HistoryController::updateForStandardLoad): Use addVisitedLink helper. + (WebCore::HistoryController::updateForRedirectWithLockedBackForwardList): Ditto. + (WebCore::HistoryController::updateForClientRedirect): Ditto. + (WebCore::HistoryController::updateForSameDocumentNavigation): Ditto. + + * platform/PlatformStrategies.h: + (WebCore::PlatformStrategies::visitedLinkStrategy): + (WebCore::PlatformStrategies::PlatformStrategies): + +2010-08-02 Chris Fleizach <cfleizach@apple.com> + + Unreviewed, rolling out r64471. + http://trac.webkit.org/changeset/64471 + https://bugs.webkit.org/show_bug.cgi?id=43005 + + Rolling out https://bugs.webkit.org/show_bug.cgi?id=43005 + until further discussion + + * Android.derived.v8bindings.mk: + * Android.jscbindings.mk: + * DerivedSources.cpp: + * DerivedSources.make: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pri: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * accessibility/AXObjectCache.h: + (WebCore::AXObjectCache::): + * accessibility/Accessibility.cpp: Removed. + * accessibility/Accessibility.h: Removed. + * accessibility/Accessibility.idl: Removed. + * accessibility/AccessibilityObject.h: + * accessibility/ScreenReader.cpp: Removed. + * accessibility/ScreenReader.h: Removed. + * accessibility/ScreenReader.idl: Removed. + * accessibility/mac/AXObjectCacheMac.mm: + (WebCore::AXObjectCache::postPlatformNotification): + * accessibility/mac/AccessibilityObjectMac.mm: + * page/Navigator.cpp: + (WebCore::Navigator::disconnectFrame): + (WebCore::Navigator::mimeTypes): + * page/Navigator.h: + * page/Navigator.idl: + +2010-08-02 Ryosuke Niwa <rniwa@webkit.org> + + Reviewed by Eric Seidel. + + Range::create should not be calling deprecatedEditingOffset and node on start and end + https://bugs.webkit.org/show_bug.cgi?id=43385 + + Replaced node() and deprecatedEditingOffset() by containerNode() and computeOffsetInContainerNode(). + + No new tests added since this does not change the behavior. + + * dom/Range.cpp: + (WebCore::Range::create): + +2010-08-02 Chris Fleizach <cfleizach@apple.com> + + Unreviewed, rolling out r64472. + http://trac.webkit.org/changeset/64472 + https://bugs.webkit.org/show_bug.cgi?id=43005 + + Rolling out https://bugs.webkit.org/show_bug.cgi?id=43005 + until further discussion + + * WebCore.vcproj/WebCore.vcproj: + +2010-08-02 Chris Fleizach <cfleizach@apple.com> + + Unreviewed, rolling out r64476. + http://trac.webkit.org/changeset/64476 + + Rolling out https://bugs.webkit.org/show_bug.cgi?id=43005 + until further discussion + + * WebCore.vcproj/WebCore.vcproj: + +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + Classes PopupMenu and SearchPopupMenu have been made pure virtual. + + * platform/PopupMenu.h: + (WebCore::PopupMenu::~PopupMenu): + * platform/SearchPopupMenu.h: + (WebCore::SearchPopupMenu::~SearchPopupMenu): + + Classes RenderMenuList and RenderTexyControlSingleLine have been changed to use + the new pure virtual PopupMenu and SearchPopupMenu. + + * rendering/RenderMenuList.cpp: + (WebCore::RenderMenuList::adjustInnerStyle): + (WebCore::RenderMenuList::showPopup): + * rendering/RenderMenuList.h: + * rendering/RenderTextControlSingleLine.cpp: + (WebCore::RenderTextControlSingleLine::~RenderTextControlSingleLine): + (WebCore::RenderTextControlSingleLine::addSearchResult): + (WebCore::RenderTextControlSingleLine::showPopup): + (WebCore::RenderTextControlSingleLine::hidePopup): + (WebCore::RenderTextControlSingleLine::updateFromElement): + (WebCore::RenderTextControlSingleLine::valueChanged): + * rendering/RenderTextControlSingleLine.h: + + Chrome and ChromeClient were made responsible for providing instances of classes + PopupMenu and SearchPopupMenu to its users. + + * loader/EmptyClients.h: + (WebCore::EmptyPopupMenu::show): + (WebCore::EmptyPopupMenu::hide): + (WebCore::EmptyPopupMenu::updateFromElement): + (WebCore::EmptyPopupMenu::disconnectClient): + (WebCore::EmptySearchPopupMenu::popupMenu): + (WebCore::EmptySearchPopupMenu::saveRecentSearches): + (WebCore::EmptySearchPopupMenu::loadRecentSearches): + (WebCore::EmptySearchPopupMenu::enabled): + (WebCore::EmptyChromeClient::selectItemWritingDirectionIsNatural): + (WebCore::EmptyChromeClient::createPopupMenu): + (WebCore::EmptyChromeClient::createSearchPopupMenu): + * page/Chrome.cpp: + (WebCore::Chrome::selectItemWritingDirectionIsNatural): + (WebCore::Chrome::createPopupMenu): + (WebCore::Chrome::createSearchPopupMenu): + * page/Chrome.h: + * page/ChromeClient.h: + + Original contents of files PopupMenu.h and SearchPopupMenu.h have been splited + in several files, two for each platform (PopupMenuXXX.h and SearchPopupMenuXXX.h). + Each of new the files contain the concrete classes that inherit form PopupMenu or + SearchPopupMenu and are specific for the corresponding platform. + + brew: + + * platform/brew/PopupMenuBrew.cpp: + (WebCore::PopupMenuBrew::PopupMenuBrew): + (WebCore::PopupMenuBrew::~PopupMenuBrew): + (WebCore::PopupMenuBrew::disconnectClient): + (WebCore::PopupMenuBrew::show): + (WebCore::PopupMenuBrew::hide): + (WebCore::PopupMenuBrew::updateFromElement): + * platform/brew/PopupMenuBrew.h: Added. + (WebCore::PopupMenuBrew::client): + * platform/brew/SearchPopupMenuBrew.cpp: + (WebCore::SearchPopupMenuBrew::saveRecentSearches): + (WebCore::SearchPopupMenuBrew::loadRecentSearches): + (WebCore::SearchPopupMenuBrew::SearchPopupMenuBrew): + (WebCore::SearchPopupMenuBrew::enabled): + (WebCore::SearchPopupMenuBrew::popupMenu): + * platform/brew/SearchPopupMenuBrew.h: Added. + + chromium: + + * WebCore.gypi: + * platform/chromium/PopupMenuChromium.cpp: + (WebCore::PopupMenuChromium::PopupMenuChromium): + (WebCore::PopupMenuChromium::~PopupMenuChromium): + (WebCore::PopupMenuChromium::show): + (WebCore::PopupMenuChromium::hide): + (WebCore::PopupMenuChromium::updateFromElement): + (WebCore::PopupMenuChromium::disconnectClient): + * platform/chromium/PopupMenuChromium.h: + (WebCore::PopupMenuChromium::client): + * platform/chromium/SearchPopupMenuChromium.cpp: + (WebCore::SearchPopupMenuChromium::SearchPopupMenuChromium): + (WebCore::SearchPopupMenuChromium::popupMenu): + (WebCore::SearchPopupMenuChromium::enabled): + (WebCore::SearchPopupMenuChromium::saveRecentSearches): + (WebCore::SearchPopupMenuChromium::loadRecentSearches): + * platform/chromium/SearchPopupMenuChromium.h: Added. + + efl: + + * platform/efl/PopupMenuEfl.cpp: + (WebCore::PopupMenuEfl::PopupMenuEfl): + (WebCore::PopupMenuEfl::~PopupMenuEfl): + (WebCore::PopupMenuEfl::show): + (WebCore::PopupMenuEfl::hide): + (WebCore::PopupMenuEfl::updateFromElement): + (WebCore::PopupMenuEfl::disconnectClient): + * platform/efl/PopupMenuEfl.h: Added. + (WebCore::PopupMenuEfl::client): + * platform/efl/SearchPopupMenuEfl.cpp: + (WebCore::SearchPopupMenuEfl::SearchPopupMenuEfl): + (WebCore::SearchPopupMenuEfl::popupMenu): + (WebCore::SearchPopupMenuEfl::saveRecentSearches): + (WebCore::SearchPopupMenuEfl::loadRecentSearches): + (WebCore::SearchPopupMenuEfl::enabled): + * platform/efl/SearchPopupMenuEfl.h: Added. + + gtk: + + * GNUmakefile.am: + * platform/gtk/PopupMenuGtk.cpp: + (WebCore::PopupMenuGtk::PopupMenuGtk): + (WebCore::PopupMenuGtk::~PopupMenuGtk): + (WebCore::PopupMenuGtk::show): + (WebCore::PopupMenuGtk::hide): + (WebCore::PopupMenuGtk::updateFromElement): + (WebCore::PopupMenuGtk::disconnectClient): + (WebCore::PopupMenuGtk::menuItemActivated): + (WebCore::PopupMenuGtk::menuUnmapped): + (WebCore::PopupMenuGtk::menuPositionFunction): + (WebCore::PopupMenuGtk::menuRemoveItem): + * platform/gtk/PopupMenuGtk.h: Added. + (WebCore::PopupMenuGtk::client): + * platform/gtk/SearchPopupMenuGtk.cpp: + (WebCore::SearchPopupMenuGtk::SearchPopupMenuGtk): + (WebCore::SearchPopupMenuGtk::popupMenu): + (WebCore::SearchPopupMenuGtk::saveRecentSearches): + (WebCore::SearchPopupMenuGtk::loadRecentSearches): + (WebCore::SearchPopupMenuGtk::enabled): + * platform/gtk/SearchPopupMenuGtk.h: Added. + + haiku: + + * platform/haiku/PopupMenuHaiku.cpp: + (WebCore::HaikuPopup::HaikuPopup): + (WebCore::HaikuPopup::~HaikuPopup): + (WebCore::PopupMenuHaiku::PopupMenuHaiku): + (WebCore::PopupMenuHaiku::~PopupMenuHaiku): + (WebCore::PopupMenuHaiku::disconnectClient): + (WebCore::PopupMenuHaiku::show): + (WebCore::PopupMenuHaiku::hide): + (WebCore::PopupMenuHaiku::updateFromElement): + * platform/haiku/PopupMenuHaiku.h: Added. + (WebCore::PopupMenuHaiku::disconnectClient): + (WebCore::PopupMenuHaiku::client): + * platform/haiku/SearchPopupMenuHaiku.cpp: + (WebCore::SearchPopupMenuHaiku::SearchPopupMenuHaiku): + (WebCore::SearchPopupMenuHaiku::saveRecentSearches): + (WebCore::SearchPopupMenuHaiku::loadRecentSearches): + (WebCore::SearchPopupMenuHaiku::enabled): + (WebCore::SearchPopupMenuHaiku::popupMenu): + * platform/haiku/SearchPopupMenuHaiku.h: Added. + + mac: + + * WebCore.exp.in: + * WebCore.xcodeproj/project.pbxproj: + * platform/mac/PopupMenuMac.h: Added. + (WebCore::PopupMenuMac::disconnectClient): + (WebCore::PopupMenuMac::client): + * platform/mac/PopupMenuMac.mm: + (WebCore::PopupMenuMac::PopupMenuMac): + (WebCore::PopupMenuMac::~PopupMenuMac): + (WebCore::PopupMenuMac::clear): + (WebCore::PopupMenuMac::populate): + (WebCore::PopupMenuMac::show): + (WebCore::PopupMenuMac::hide): + (WebCore::PopupMenuMac::updateFromElement): + (WebCore::PopupMenuMac::itemWritingDirectionIsNatural): + * platform/mac/SearchPopupMenuMac.h: Added. + * platform/mac/SearchPopupMenuMac.mm: + (WebCore::SearchPopupMenuMac::SearchPopupMenuMac): + (WebCore::SearchPopupMenuMac::popupMenu): + (WebCore::SearchPopupMenuMac::enabled): + (WebCore::SearchPopupMenuMac::saveRecentSearches): + (WebCore::SearchPopupMenuMac::loadRecentSearches): + + qt: + + * WebCore.pro: + * platform/qt/PopupMenuQt.cpp: + (WebCore::PopupMenuQt::PopupMenuQt): + (WebCore::PopupMenuQt::~PopupMenuQt): + (WebCore::PopupMenuQt::disconnectClient): + (WebCore::PopupMenuQt::show): + (WebCore::PopupMenuQt::hide): + (WebCore::PopupMenuQt::updateFromElement): + * platform/qt/PopupMenuQt.h: Added. + * platform/qt/QtAbstractWebPopup.h: + * platform/qt/SearchPopupMenuQt.cpp: + (WebCore::SearchPopupMenuQt::SearchPopupMenuQt): + (WebCore::SearchPopupMenuQt::popupMenu): + (WebCore::SearchPopupMenuQt::saveRecentSearches): + (WebCore::SearchPopupMenuQt::loadRecentSearches): + (WebCore::SearchPopupMenuQt::enabled): + * platform/qt/SearchPopupMenuQt.h: Added. + + win: + + * WebCore.vcproj/WebCore.vcproj: + * platform/win/PopupMenuWin.cpp: + (WebCore::PopupMenuWin::PopupMenuWin): + (WebCore::PopupMenuWin::~PopupMenuWin): + (WebCore::PopupMenuWin::disconnectClient): + (WebCore::PopupMenuWin::popupClassName): + (WebCore::PopupMenuWin::show): + (WebCore::PopupMenuWin::hide): + (WebCore::PopupMenuWin::calculatePositionAndSize): + (WebCore::PopupMenuWin::setFocusedIndex): + (WebCore::PopupMenuWin::visibleItems): + (WebCore::PopupMenuWin::listIndexAtPoint): + (WebCore::PopupMenuWin::focusedIndex): + (WebCore::PopupMenuWin::focusFirst): + (WebCore::PopupMenuWin::focusLast): + (WebCore::PopupMenuWin::down): + (WebCore::PopupMenuWin::up): + (WebCore::PopupMenuWin::invalidateItem): + (WebCore::PopupMenuWin::clientRect): + (WebCore::PopupMenuWin::incrementWheelDelta): + (WebCore::PopupMenuWin::reduceWheelDelta): + (WebCore::PopupMenuWin::scrollToRevealSelection): + (WebCore::PopupMenuWin::updateFromElement): + (WebCore::PopupMenuWin::paint): + (WebCore::PopupMenuWin::valueChanged): + (WebCore::PopupMenuWin::invalidateScrollbarRect): + (WebCore::PopupMenuWin::registerClass): + (WebCore::PopupMenuWin::PopupMenuWndProc): + (WebCore::PopupMenuWin::wndProc): + * platform/win/PopupMenuWin.h: Added. + (WebCore::PopupMenuWin::client): + (WebCore::PopupMenuWin::scrollbar): + (WebCore::PopupMenuWin::itemHeight): + (WebCore::PopupMenuWin::windowRect): + (WebCore::PopupMenuWin::popupHandle): + (WebCore::PopupMenuWin::setWasClicked): + (WebCore::PopupMenuWin::wasClicked): + (WebCore::PopupMenuWin::setScrollOffset): + (WebCore::PopupMenuWin::scrollOffset): + (WebCore::PopupMenuWin::wheelDelta): + (WebCore::PopupMenuWin::scrollbarCapturingMouse): + (WebCore::PopupMenuWin::setScrollbarCapturingMouse): + * platform/win/SearchPopupMenuWin.cpp: + (WebCore::SearchPopupMenuWin::SearchPopupMenuWin): + (WebCore::SearchPopupMenuWin::popupMenu): + (WebCore::SearchPopupMenuWin::enabled): + (WebCore::SearchPopupMenuWin::saveRecentSearches): + (WebCore::SearchPopupMenuWin::loadRecentSearches): + * platform/win/SearchPopupMenuWin.h: Added. + + wx: + + * platform/wx/PopupMenuWx.cpp: + (WebCore::PopupMenuWx::PopupMenuWx): + (WebCore::PopupMenuWx::~PopupMenuWx): + (WebCore::PopupMenuWx::disconnectClient): + (WebCore::PopupMenuWx::show): + (WebCore::PopupMenuWx::OnMenuItemSelected): + (WebCore::PopupMenuWx::hide): + (WebCore::PopupMenuWx::updateFromElement): + * platform/wx/PopupMenuWx.h: Added. + (WebCore::PopupMenuWx::client): + * platform/wx/SearchPopupMenuWx.cpp: + (WebCore::SearchPopupMenuWx::SearchPopupMenuWx): + (WebCore::SearchPopupMenuWx::saveRecentSearches): + (WebCore::SearchPopupMenuWx::loadRecentSearches): + (WebCore::SearchPopupMenuWx::enabled): + (WebCore::SearchPopupMenuWx::popupMenu): + * platform/wx/SearchPopupMenuWx.h: Added. + + + +2010-08-02 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Xan Lopez. + + [GTK] Use GdkPixbuf for ImageBuffer::toDataURL + https://bugs.webkit.org/show_bug.cgi?id=43088 + + Implement ImageBuffer::toDataURL with GdkPixbuf instead of Cairo. This + allows the method to support a larger variety of image types. + + * GNUmakefile.am: Add new files to the source list. + * platform/MIMETypeRegistry.cpp: + (WebCore::initializeSupportedImageMIMETypesForEncoding): + Add the list of image types supported by GTK. + * platform/graphics/cairo/ImageBufferCairo.cpp: + * platform/graphics/gtk/CairoUtilities.cpp: Added. + (getCairoSurfacePixel): Move this method from ImageGtk.cpp. + (getGdkPixbufPixel): Move this method from ImageGtk.cpp. + (cairoImageSurfaceToGdkPixbuf): Move this method from ImageGtk.cpp. + * platform/graphics/gtk/CairoUtilities.h: Added. + * platform/graphics/gtk/ImageBufferGtk.cpp: Added. + (WebCore::ImageBuffer::toDataURL): Use GdkPixbuf to do the conversion to a data url. + * platform/graphics/gtk/ImageGtk.cpp: + (WebCore::BitmapImage::getGdkPixbuf): Use the new helper method in CairoUtilities.h. + +2010-08-02 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + [GTK] Add support for the Audio element in the DOM bindings + https://bugs.webkit.org/show_bug.cgi?id=43313 + + The IDL definition of some HTMLMediaElement methods does not match + the C++ implementation API, take this fact into account when + generating the bindings. + + * bindings/gobject/WebKitHTMLElementWrapperFactory.cpp: + (WebKit::createAudioWrapper): + (WebKit::createHTMLElementWrapper): + * bindings/scripts/CodeGeneratorGObject.pm: + +2010-08-02 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Fix plug-in test failures and remove tests from the Skipped list + https://bugs.webkit.org/show_bug.cgi?id=43389 + + * WebCore.exp.in: + Export FrameLoader::cancelledError. + +2010-08-02 Brady Eidson <beidson@apple.com> + + Reviewed by Anders Carlsson. + + Basic WK2 visited link coloring + https://bugs.webkit.org/show_bug.cgi?id=43377 + + No new tests. (No change in behavior) + + * WebCore.exp.in: + + * page/PageGroup.cpp: + (WebCore::PageGroup::addVisitedLinkHash): + * page/PageGroup.h: + +2010-08-02 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Xan Lopez. + + [GTK] Style cleanup for CairoPath.h + https://bugs.webkit.org/show_bug.cgi?id=43133 + + Turn CairoPath into a class, as it has a constructor and destructor. + Change raw member access to use the new accessor. + + No new tests as functionality has not changed. + + * platform/graphics/cairo/CairoPath.h: Cleanup and indentation fix. + (WebCore::CairoPath::CairoPath): + (WebCore::CairoPath::~CairoPath): + (WebCore::CairoPath::context): + * platform/graphics/cairo/GraphicsContextCairo.cpp: + (WebCore::GraphicsContext::addPath): Convert raw member access to accessor access. + (WebCore::GraphicsContext::clip): Ditto. + * platform/graphics/cairo/PathCairo.cpp: + (WebCore::Path::Path): Ditto. + (WebCore::Path::operator=): Ditto. + (WebCore::Path::clear): Ditto. + (WebCore::Path::isEmpty): Ditto. + (WebCore::Path::currentPoint): Ditto. + (WebCore::Path::translate): Ditto. + (WebCore::Path::moveTo): Ditto. + (WebCore::Path::addLineTo): Ditto. + (WebCore::Path::addRect): Ditto. + (WebCore::Path::addQuadCurveTo): Ditto. + (WebCore::Path::addBezierCurveTo): Ditto. + (WebCore::Path::addArc): Ditto. + (WebCore::Path::addArcTo): Ditto. + (WebCore::Path::addEllipse): Ditto. + (WebCore::Path::closeSubpath): Ditto. + (WebCore::Path::boundingRect): Ditto. + (WebCore::Path::strokeBoundingRect): Ditto. + (WebCore::Path::contains): Ditto. + (WebCore::Path::strokeContains): Ditto. + (WebCore::Path::apply): Ditto. + (WebCore::Path::transform): Ditto. + (WebCore::Path::debugString): Ditto. + +2010-07-20 Ojan Vafai <ojan@chromium.org> + + Reviewed by Eric Seidel. + + focusing the body of a contentEditable iframe resets the selection + https://bugs.webkit.org/show_bug.cgi?id=42645 + + The selection shouldn't be reset to the beginning of the rootEditableElement + if it is already inside the rootEditableElement. + + Test: editing/selection/focus-contenteditable-iframe.html + + * dom/Element.cpp: + (WebCore::Element::updateFocusAppearance): + +2010-07-20 Ojan Vafai <ojan@chromium.org> + + Reviewed by Eric Seidel. + + focusing an unfocused contentEditable element should place the cursor at the beginning + https://bugs.webkit.org/show_bug.cgi?id=42646 + + r14666 made this change for the body and html elements, but not for all contentEditable + elements. Doing this for all contentEditable elements matches all other browsers. + + * dom/Element.cpp: + (WebCore::Element::updateFocusAppearance): + +2010-08-02 Ryosuke Niwa <rniwa@webkit.org> + + Reviewed by Kent Tamura. + + Group functions used in createMarkup (range version) into a class so they are easier to understand + https://bugs.webkit.org/show_bug.cgi?id=43227 + + Added MarkupAccumulatorWrapper to group getStartMarkup, getEndMarkup, joinMarkups, and addStyleMarkup. + MarkupAccumulatorWrapper is intended to be merged with MarkupAccumulator in the future. + + No new tests added since this is a clean up. + + * editing/markup.cpp: + (WebCore::MarkupAccumulatorWrapper::MarkupAccumulatorWrapper): Added. + (WebCore::MarkupAccumulatorWrapper::insertString): Added. + (WebCore::MarkupAccumulatorWrapper::insertOpenTag): Added. + (WebCore::MarkupAccumulatorWrapper::insertEndTag): Added. + (WebCore::MarkupAccumulatorWrapper::wrapWithNode): Added. + (WebCore::MarkupAccumulatorWrapper::wrapWithStyleNode): Added. + (WebCore::MarkupAccumulatorWrapper::takeResults): Added. + (WebCore::createMarkup): Uses MarkupAccumulatorWrapper. + +2010-08-02 Brian Weinstein <bweinstein@apple.com> + + Add a missing </File> tag to WebCore.vcproj. + + * WebCore.vcproj/WebCore.vcproj: + +2010-08-02 Mario Sanchez Prada <msanchez@igalia.com> + + Reviewed by Chris Fleizach. + + [GTK] Implement support for get_character_extents and get_range_extents + https://bugs.webkit.org/show_bug.cgi?id=25677 + + Implement get_range_extents() and modify get_character_extents() + to properly work after "The Great Flattening" occurred in the ATK + objects hierarchy, some months ago. + + In the case of the GTK port, not just the text controls should be + considered when it comes to these functions but also those + composite objects that would also allow to work with text ranges, + such as headings and links. To take care of this, a new function + AccessibilityObject::allowsTextRanges() was defined with a default + implementation in the header file and an specific one for GTK in + AccessibilityObjectAtk.cpp. + + Based on a previous patch by Joanmarie Diggs. + + * accessibility/AccessibilityObject.cpp: + (WebCore::AccessibilityObject::visiblePositionRangeForRange): + * accessibility/AccessibilityObject.h: + (WebCore::AccessibilityObject::allowsTextRanges): New + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::visiblePositionForIndex): + (WebCore::AccessibilityRenderObject::doAXBoundsForRange): + * accessibility/gtk/AccessibilityObjectAtk.cpp: + (WebCore::AccessibilityObject::allowsTextRanges): New + * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: + (textExtents): + (webkit_accessible_text_get_character_extents): + (webkit_accessible_text_get_range_extents): + (atk_text_interface_init): + +2010-08-02 Chris Fleizach <cfleizach@apple.com> + + AX: Support methods for web apps to interact with the native accessibility APIs + https://bugs.webkit.org/show_bug.cgi?id=43005 + + Fix for windows build. No review. + + * WebCore.vcproj/WebCore.vcproj: + +2010-08-02 Chris Fleizach <cfleizach@apple.com> + + Reviewed by David Kilzer. + + AX: Support methods for web apps to interact with the native accessibility APIs + https://bugs.webkit.org/show_bug.cgi?id=43005 + + Adds a new "accessibility" object that hangs off of "window.navigator". + This accessibility object will allow web apps to interact with native accessibility APIs + to provide a richer experience (for screen reader users primarily). + + Test: platform/mac/accessibility/js-accessibility.html + + * Android.derived.v8bindings.mk: + * Android.jscbindings.mk: + * DerivedSources.cpp: + * DerivedSources.make: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pri: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * accessibility/AXObjectCache.h: + (WebCore::AXObjectCache::): + * accessibility/Accessibility.cpp: Added. + (WebCore::Accessibility::Accessibility): + (WebCore::Accessibility::~Accessibility): + (WebCore::Accessibility::disconnectFrame): + (WebCore::Accessibility::screenChanged): + (WebCore::Accessibility::elementsChanged): + (WebCore::Accessibility::screenReader): + * accessibility/Accessibility.h: Added. + (WebCore::Accessibility::create): + * accessibility/Accessibility.idl: Added. + * accessibility/AccessibilityObject.h: + (WebCore::AccessibilityObject::isScreenReaderRunning): + (WebCore::AccessibilityObject::screenReaderFocusedElement): + (WebCore::AccessibilityObject::screenReaderVersion): + * accessibility/ScreenReader.cpp: Added. + (WebCore::ScreenReader::ScreenReader): + (WebCore::ScreenReader::~ScreenReader): + (WebCore::ScreenReader::disconnectFrame): + (WebCore::ScreenReader::active): + (WebCore::ScreenReader::activeElement): + (WebCore::ScreenReader::version): + * accessibility/ScreenReader.h: Added. + (WebCore::ScreenReader::create): + * accessibility/ScreenReader.idl: Added. + * accessibility/mac/AXObjectCacheMac.mm: + (WebCore::AXObjectCache::postPlatformNotification): + * accessibility/mac/AccessibilityObjectMac.mm: + (WebCore::AccessibilityObject::isScreenReaderRunning): + (WebCore::AccessibilityObject::screenReaderFocusedElement): + (WebCore::AccessibilityObject::screenReaderVersion): + * page/Navigator.cpp: + (WebCore::Navigator::disconnectFrame): + (WebCore::Navigator::accessibility): + * page/Navigator.h: + * page/Navigator.idl: + +2010-08-02 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Xan Lopez. + + [Gtk] DOM listeners get wrong keycodes for some keys + https://bugs.webkit.org/show_bug.cgi?id=35170 + + Emit the proper DOM keyCode for the print screen, keypad insert, + and keypad delete keys. + + * platform/gtk/KeyEventGtk.cpp: + (WebCore::windowsKeyCodeForKeyEvent): Fix mapping between GDK key codes + and Windows key codes. + +2010-08-02 Dirk Schulze <krit@webkit.org> + + Unreviewed sort of XCode project file. + + * WebCore.xcodeproj/project.pbxproj: + +2010-08-02 Kristian Monsen <kristianm@google.com> + + Reviewed by Steve Block. + + Compile fix for Android, adding guards around filter specific code. + https://bugs.webkit.org/show_bug.cgi?id=43338 + This CL introduced the code: + http://trac.webkit.org/changeset/64196 + + Compile fix only, no new tests. + + * rendering/SVGResourcesCycleSolver.cpp: + (WebCore::SVGResourcesCycleSolver::breakCycle): + +2010-08-02 Kristian Monsen <kristianm@google.com> + + Reviewed by Steve Block. + + Compile fix for Android, guard inspector code with ENABLE(INSPECTOR). + https://bugs.webkit.org/show_bug.cgi?id=43345 + Code introduced in this CL: + http://trac.webkit.org/changeset/63891 + + No new tests, just a compile fix. + + * bindings/v8/ScriptValue.cpp: + +2010-08-02 Jeremy Orlow <jorlow@chromium.org> + + Speculative revert of 64425 due to Chromium instability + https://bugs.webkit.org/show_bug.cgi?id=43347 + + * GNUmakefile.am: + * WebCore.exp.in: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * loader/EmptyClients.h: + * page/Chrome.cpp: + * page/Chrome.h: + * page/ChromeClient.h: + * platform/PopupMenu.h: + (WebCore::PopupMenu::create): + (WebCore::PopupMenu::disconnectClient): + (WebCore::PopupMenu::client): + (WebCore::PopupMenu::scrollbar): + (WebCore::PopupMenu::itemHeight): + (WebCore::PopupMenu::windowRect): + (WebCore::PopupMenu::popupHandle): + (WebCore::PopupMenu::setWasClicked): + (WebCore::PopupMenu::wasClicked): + (WebCore::PopupMenu::setScrollOffset): + (WebCore::PopupMenu::scrollOffset): + (WebCore::PopupMenu::wheelDelta): + (WebCore::PopupMenu::scrollbarCapturingMouse): + (WebCore::PopupMenu::setScrollbarCapturingMouse): + (WebCore::PopupMenu::isActive): + (WebCore::PopupMenu::scrollbarCornerPresent): + * platform/SearchPopupMenu.h: + (WebCore::SearchPopupMenu::create): + * platform/brew/PopupMenuBrew.cpp: + (WebCore::PopupMenu::PopupMenu): + (WebCore::PopupMenu::~PopupMenu): + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::hide): + (WebCore::PopupMenu::updateFromElement): + (WebCore::PopupMenu::itemWritingDirectionIsNatural): + * platform/brew/PopupMenuBrew.h: Removed. + * platform/brew/SearchPopupMenuBrew.cpp: + (WebCore::SearchPopupMenu::saveRecentSearches): + (WebCore::SearchPopupMenu::loadRecentSearches): + (WebCore::SearchPopupMenu::SearchPopupMenu): + (WebCore::SearchPopupMenu::enabled): + * platform/brew/SearchPopupMenuBrew.h: Removed. + * platform/chromium/PopupMenuChromium.cpp: + (WebCore::PopupMenu::PopupMenu): + (WebCore::PopupMenu::~PopupMenu): + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::hide): + (WebCore::PopupMenu::updateFromElement): + (WebCore::PopupMenu::itemWritingDirectionIsNatural): + * platform/chromium/PopupMenuChromium.h: + * platform/chromium/SearchPopupMenuChromium.cpp: + (WebCore::SearchPopupMenu::SearchPopupMenu): + (WebCore::SearchPopupMenu::enabled): + (WebCore::SearchPopupMenu::saveRecentSearches): + (WebCore::SearchPopupMenu::loadRecentSearches): + * platform/chromium/SearchPopupMenuChromium.h: Removed. + * platform/efl/PopupMenuEfl.cpp: + (WebCore::PopupMenu::PopupMenu): + (WebCore::PopupMenu::~PopupMenu): + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::hide): + (WebCore::PopupMenu::updateFromElement): + (WebCore::PopupMenu::itemWritingDirectionIsNatural): + * platform/efl/PopupMenuEfl.h: Removed. + * platform/efl/SearchPopupMenuEfl.cpp: + (WebCore::SearchPopupMenu::SearchPopupMenu): + (WebCore::SearchPopupMenu::saveRecentSearches): + (WebCore::SearchPopupMenu::loadRecentSearches): + (WebCore::SearchPopupMenu::enabled): + * platform/efl/SearchPopupMenuEfl.h: Removed. + * platform/gtk/PopupMenuGtk.cpp: + (WebCore::PopupMenu::PopupMenu): + (WebCore::PopupMenu::~PopupMenu): + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::hide): + (WebCore::PopupMenu::updateFromElement): + (WebCore::PopupMenu::itemWritingDirectionIsNatural): + (WebCore::PopupMenu::menuItemActivated): + (WebCore::PopupMenu::menuUnmapped): + (WebCore::PopupMenu::menuPositionFunction): + (WebCore::PopupMenu::menuRemoveItem): + * platform/gtk/PopupMenuGtk.h: Removed. + * platform/gtk/SearchPopupMenuGtk.cpp: + (WebCore::SearchPopupMenu::SearchPopupMenu): + (WebCore::SearchPopupMenu::saveRecentSearches): + (WebCore::SearchPopupMenu::loadRecentSearches): + (WebCore::SearchPopupMenu::enabled): + * platform/gtk/SearchPopupMenuGtk.h: Removed. + * platform/haiku/PopupMenuHaiku.cpp: + (WebCore::PopupMenuHaiku::PopupMenuHaiku): + (WebCore::PopupMenuHaiku::~PopupMenuHaiku): + (WebCore::PopupMenu::PopupMenu): + (WebCore::PopupMenu::~PopupMenu): + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::hide): + (WebCore::PopupMenu::updateFromElement): + (WebCore::PopupMenu::itemWritingDirectionIsNatural): + * platform/haiku/PopupMenuHaiku.h: Removed. + * platform/haiku/SearchPopupMenuHaiku.cpp: + (WebCore::SearchPopupMenu::SearchPopupMenu): + (WebCore::SearchPopupMenu::saveRecentSearches): + (WebCore::SearchPopupMenu::loadRecentSearches): + (WebCore::SearchPopupMenu::enabled): + * platform/haiku/SearchPopupMenuHaiku.h: Removed. + * platform/mac/PopupMenuMac.h: Removed. + * platform/mac/PopupMenuMac.mm: + (WebCore::PopupMenu::PopupMenu): + (WebCore::PopupMenu::~PopupMenu): + (WebCore::PopupMenu::clear): + (WebCore::PopupMenu::populate): + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::hide): + (WebCore::PopupMenu::updateFromElement): + (WebCore::PopupMenu::itemWritingDirectionIsNatural): + * platform/mac/SearchPopupMenuMac.h: Removed. + * platform/mac/SearchPopupMenuMac.mm: + (WebCore::SearchPopupMenu::SearchPopupMenu): + (WebCore::SearchPopupMenu::enabled): + (WebCore::SearchPopupMenu::saveRecentSearches): + (WebCore::SearchPopupMenu::loadRecentSearches): + * platform/qt/PopupMenuQt.cpp: + (WebCore::PopupMenu::PopupMenu): + (WebCore::PopupMenu::~PopupMenu): + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::hide): + (WebCore::PopupMenu::updateFromElement): + (WebCore::PopupMenu::itemWritingDirectionIsNatural): + * platform/qt/PopupMenuQt.h: Removed. + * platform/qt/QtAbstractWebPopup.h: + * platform/qt/SearchPopupMenuQt.cpp: + (WebCore::SearchPopupMenu::SearchPopupMenu): + (WebCore::SearchPopupMenu::saveRecentSearches): + (WebCore::SearchPopupMenu::loadRecentSearches): + (WebCore::SearchPopupMenu::enabled): + * platform/qt/SearchPopupMenuQt.h: Removed. + * platform/win/PopupMenuWin.cpp: + (WebCore::PopupMenu::PopupMenu): + (WebCore::PopupMenu::~PopupMenu): + (WebCore::PopupMenu::popupClassName): + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::hide): + (WebCore::PopupMenu::calculatePositionAndSize): + (WebCore::PopupMenu::setFocusedIndex): + (WebCore::PopupMenu::visibleItems): + (WebCore::PopupMenu::listIndexAtPoint): + (WebCore::PopupMenu::focusedIndex): + (WebCore::PopupMenu::focusFirst): + (WebCore::PopupMenu::focusLast): + (WebCore::PopupMenu::down): + (WebCore::PopupMenu::up): + (WebCore::PopupMenu::invalidateItem): + (WebCore::PopupMenu::clientRect): + (WebCore::PopupMenu::incrementWheelDelta): + (WebCore::PopupMenu::reduceWheelDelta): + (WebCore::PopupMenu::scrollToRevealSelection): + (WebCore::PopupMenu::updateFromElement): + (WebCore::PopupMenu::itemWritingDirectionIsNatural): + (WebCore::PopupMenu::paint): + (WebCore::PopupMenu::valueChanged): + (WebCore::PopupMenu::invalidateScrollbarRect): + (WebCore::PopupMenu::registerClass): + (WebCore::PopupMenu::PopupMenuWndProc): + (WebCore::PopupMenu::wndProc): + * platform/win/PopupMenuWin.h: Removed. + * platform/win/SearchPopupMenuWin.cpp: + (WebCore::SearchPopupMenu::SearchPopupMenu): + (WebCore::SearchPopupMenu::enabled): + (WebCore::SearchPopupMenu::saveRecentSearches): + (WebCore::SearchPopupMenu::loadRecentSearches): + * platform/win/SearchPopupMenuWin.h: Removed. + * platform/wx/PopupMenuWx.cpp: + (WebCore::PopupMenu::PopupMenu): + (WebCore::PopupMenu::~PopupMenu): + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::OnMenuItemSelected): + (WebCore::PopupMenu::hide): + (WebCore::PopupMenu::updateFromElement): + (WebCore::PopupMenu::itemWritingDirectionIsNatural): + * platform/wx/PopupMenuWx.h: Removed. + * platform/wx/SearchPopupMenuWx.cpp: + (WebCore::SearchPopupMenu::SearchPopupMenu): + (WebCore::SearchPopupMenu::saveRecentSearches): + (WebCore::SearchPopupMenu::loadRecentSearches): + (WebCore::SearchPopupMenu::enabled): + * platform/wx/SearchPopupMenuWx.h: Removed. + * rendering/RenderMenuList.cpp: + (WebCore::RenderMenuList::adjustInnerStyle): + (WebCore::RenderMenuList::showPopup): + * rendering/RenderMenuList.h: + * rendering/RenderTextControlSingleLine.cpp: + (WebCore::RenderTextControlSingleLine::~RenderTextControlSingleLine): + (WebCore::RenderTextControlSingleLine::addSearchResult): + (WebCore::RenderTextControlSingleLine::showPopup): + (WebCore::RenderTextControlSingleLine::hidePopup): + (WebCore::RenderTextControlSingleLine::updateFromElement): + (WebCore::RenderTextControlSingleLine::valueChanged): + * rendering/RenderTextControlSingleLine.h: + +2010-08-02 Markus Goetz <Markus.Goetz@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Do not link to SharedBufferCF.cpp + The Qt port does not need this file. + We plan to implement the platformData() + for SharedBuffer at some point soon. + https://bugs.webkit.org/show_bug.cgi?id=43242 + + * WebCore.pro: + * platform/SharedBuffer.cpp: + +2010-08-02 Balazs Kelemen <kb@inf.u-szeged.hu> + + Reviewed by Simon Hausmann. + + [Qt] Generate forwarding headers for WebKit2 + + https://bugs.webkit.org/show_bug.cgi?id=43336 + + * WebCore.pri: Removed header copying logic. + * WebCore.pro: Add include paths for WebKit2. + +2010-08-02 Andrey Kosyakov <caseq@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: adding experimental support for WebInspector extensions API. + https://bugs.webkit.org/show_bug.cgi?id=40425 + + Tests: inspector/extensions-api.html + inspector/extensions.html + + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * inspector/InspectorController.cpp: + (WebCore::InspectorController::inspectedWindowScriptObjectCleared): + (WebCore::InspectorController::didCommitLoad): + * inspector/InspectorFrontendHost.cpp: + (WebCore::InspectorFrontendHost::setExtensionAPI): + * inspector/InspectorFrontendHost.h: + * inspector/InspectorFrontendHost.idl: + * inspector/front-end/ElementsPanel.js: + (WebInspector.ElementsPanel.this.treeOutline.focusedNodeChanged): + (WebInspector.ElementsPanel): + * inspector/front-end/ExtensionAPI.js: Added. An API implementation that gets injected into the extension context. + (injectedExtensionAPI): + (injectedExtensionAPI.EventSinkImpl.prototype.addListener): + (injectedExtensionAPI.EventSinkImpl.prototype.removeListener): + (injectedExtensionAPI.EventSinkImpl.prototype._fire): + (injectedExtensionAPI.EventSink): + (injectedExtensionAPI.InspectorExtensionAPI): + (injectedExtensionAPI.InspectorExtensionAPI.prototype.log): + (injectedExtensionAPI.Resources.prototype.getAll): + (injectedExtensionAPI.Resources.prototype.get return): + (injectedExtensionAPI.Resources.prototype): + (injectedExtensionAPI.Panels): + (injectedExtensionAPI.Panels.prototype.create.callbackWrapper): + (injectedExtensionAPI.Panels.prototype.create): + (injectedExtensionAPI.PanelImpl): + (injectedExtensionAPI.PanelImpl.prototype.createSidebarPane.callbackWrapper): + (injectedExtensionAPI.PanelImpl.prototype.createSidebarPane): + (injectedExtensionAPI.ExtensionPanel): + (injectedExtensionAPI.ExtensionSidebarPaneImpl): + (injectedExtensionAPI.ExtensionSidebarPaneImpl.prototype.setHeight): + (injectedExtensionAPI.ExtensionSidebarPaneImpl.prototype.setExpanded): + (injectedExtensionAPI.InspectedWindow): + (injectedExtensionAPI.InspectedWindow.prototype.reload): + (injectedExtensionAPI.InspectedWindow.prototype.evaluate): + (injectedExtensionAPI.ExtensionServerClient.prototype.sendRequest): + (injectedExtensionAPI.ExtensionServerClient.prototype.registerHandler): + (injectedExtensionAPI.ExtensionServerClient.prototype.nextObjectId): + (injectedExtensionAPI.ExtensionServerClient.prototype._registerCallback): + (injectedExtensionAPI.ExtensionServerClient.prototype._onCallback): + (injectedExtensionAPI.ExtensionServerClient.prototype._onMessage): + (injectedExtensionAPI.expandURL): + (injectedExtensionAPI.): + * inspector/front-end/ExtensionPanel.js: Added. A class that provides WebInspector's Panel interface to the inspector, hosts extension panel within an IFrame and proxies Panel callbacks to the extension. + (WebInspector.ExtensionPanel): + (WebInspector.ExtensionPanel.prototype.get defaultFocusedElement): + (WebInspector.ExtensionPanel.prototype.updateMainViewWidth): + (WebInspector.ExtensionPanel.prototype.searchCanceled): + (WebInspector.ExtensionPanel.prototype.performSearch): + (WebInspector.ExtensionPanel.prototype.jumpToNextSearchResult): + (WebInspector.ExtensionPanel.prototype.jumpToPreviousSearchResult): + (WebInspector.ExtensionPanel.prototype._addStyleRule): + * inspector/front-end/ExtensionRegistryStub.js: Added. A stub for ExtensionRegistry class that is meant to provide a list of extensions. Actual implementations may be browser-specfic. + (.WebInspector.InspectorExtensionRegistryStub): + (.WebInspector.InspectorExtensionRegistryStub.prototype.getExtensionsAsync): + * inspector/front-end/ExtensionServer.js: Added. Communicates with ExtensionAPI via DOM messaging and proxies requests to WebInspector classes. + (WebInspector.ExtensionServer): + (WebInspector.ExtensionServer.prototype.notifyPanelShown): + (WebInspector.ExtensionServer.prototype.notifyObjectSelected): + (WebInspector.ExtensionServer.prototype.notifyResourceFinished): + (WebInspector.ExtensionServer.prototype.notifySearchAction): + (WebInspector.ExtensionServer.prototype.notifyInspectedPageLoaded): + (WebInspector.ExtensionServer.prototype.notifyInspectedURLChanged): + (WebInspector.ExtensionServer.prototype.notifyInspectorReset): + (WebInspector.ExtensionServer.prototype._convertResource): + (WebInspector.ExtensionServer.prototype._postNotification): + (WebInspector.ExtensionServer.prototype._onSubscribe): + (WebInspector.ExtensionServer.prototype._onUnsubscribe): + (WebInspector.ExtensionServer.prototype._onCreatePanel): + (WebInspector.ExtensionServer.prototype._onCreateSidebar): + (WebInspector.ExtensionServer.prototype._createClientIframe): + (WebInspector.ExtensionServer.prototype._onSetSidebarHeight): + (WebInspector.ExtensionServer.prototype._onSetSidebarExpansion): + (WebInspector.ExtensionServer.prototype._onLog): + (WebInspector.ExtensionServer.prototype._onEvaluateOnInspectedPage): + (WebInspector.ExtensionServer.prototype._onRevealAndSelect): + (WebInspector.ExtensionServer.prototype._onRevealAndSelectResource): + (WebInspector.ExtensionServer.prototype._dispatchCallback): + (WebInspector.ExtensionServer.prototype._onGetResources): + (WebInspector.ExtensionServer.prototype.initExtensions): + (WebInspector.ExtensionServer.prototype._addExtensions): + (WebInspector.ExtensionServer.prototype._onWindowMessage): + (WebInspector.ExtensionServer.prototype._onmessage): + (WebInspector.ExtensionServer.prototype._registerHandler): + (WebInspector.ExtensionStatus): + (WebInspector.addExtensions): + * inspector/front-end/InjectedScript.js: + (injectedScriptConstructor): + * inspector/front-end/InjectedScriptAccess.js: + * inspector/front-end/InspectorFrontendHostStub.js: + (.WebInspector.InspectorFrontendHostStub.prototype.setExtensionAPI): + (.WebInspector.InspectorFrontendHostStub.prototype.canAttachWindow): + * inspector/front-end/WebKit.qrc: + * inspector/front-end/inspector.html: + * inspector/front-end/inspector.js: + (WebInspector.loaded): + (WebInspector.updateResource): + (WebInspector.reset): + (WebInspector.inspectedURLChanged): + (WebInspector.didCommitLoad): + +2010-08-02 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Yury Semikhatsky. + + WebInspector: Inspector is not working when it is loaded as html page. + https://bugs.webkit.org/show_bug.cgi?id=43334 + + * inspector/front-end/InspectorFrontendHostStub.js: + (.WebInspector.InspectorFrontendHostStub.prototype.canAttachWindow): + (.WebInspector.InspectorFrontendHostStub.prototype.sendMessageToBackend): + +2010-08-01 Nikolas Zimmermann <nzimmermann@rim.com> + + Reviewed by Dirk Schulze. + + SVG gradients do not update when scripted via xlink + https://bugs.webkit.org/show_bug.cgi?id=42953 + + Unify cycle detection logic for chainable (through xlink:href) and ordinary resources. + All operate on the render tree now, instead of falling back to the DOM tree for xlink:href queries. + + When linking resources, register as regular client, so the regular update mechanisms work as expected. + <linearGradient id="foo"><stop../> </linearGradient> + <linearGradient id="bar" xlink:href="#foo"/> + <rect fill="url(#bar)"/> + + Without that the rect won't receive invalidation notifications, as foo <-> bar had no connection. + Fixes the last outstanding class of invalidations. Also speeds up the cycle detetion, when using chained resources, + as no SVG DOM queries have to be executed anymore. + + Test: svg/custom/js-update-stop-linked-gradient.svg + + * rendering/RenderSVGResourceContainer.cpp: + (WebCore::RenderSVGResourceContainer::markAllClientsForInvalidation): + (WebCore::linkedResourceForContainer): + * rendering/SVGResources.cpp: + (WebCore::SVGResources::SVGResources): + (WebCore::chainableResourceTags): + (WebCore::targetReferenceFromResource): + (WebCore::registerPendingResource): + (WebCore::SVGResources::buildCachedResources): + (WebCore::SVGResources::invalidateClient): + (WebCore::SVGResources::resourceDestroyed): + (WebCore::SVGResources::buildSetOfResources): + (WebCore::SVGResources::setLinkedResource): + (WebCore::SVGResources::resetLinkedResource): + (WebCore::SVGResources::dump): + * rendering/SVGResources.h: + (WebCore::SVGResources::linkedResource): + * rendering/SVGResourcesCycleSolver.cpp: + (WebCore::SVGResourcesCycleSolver::resolveCycles): + (WebCore::SVGResourcesCycleSolver::breakCycle): + * rendering/SVGResourcesCycleSolver.h: + * svg/SVGFilterElement.cpp: + (WebCore::SVGFilterElement::SVGFilterElement): + * svg/SVGFilterElement.h: + * svg/SVGGradientElement.cpp: + (WebCore::SVGGradientElement::SVGGradientElement): + * svg/SVGGradientElement.h: + * svg/SVGLinearGradientElement.cpp: + (WebCore::SVGLinearGradientElement::collectGradientProperties): + * svg/SVGPatternElement.cpp: + (WebCore::SVGPatternElement::SVGPatternElement): + (WebCore::SVGPatternElement::collectPatternProperties): + * svg/SVGPatternElement.h: + * svg/SVGRadialGradientElement.cpp: + (WebCore::SVGRadialGradientElement::collectGradientProperties): + +2010-07-31 Dan Bernstein <mitz@apple.com> + + Try to fix the Windows build when zlib is not available. + + * platform/graphics/WOFFFileFormat.cpp: + +2010-07-31 Dan Bernstein <mitz@apple.com> + + Try to fix the Windows build when zlib is not available. + + * platform/graphics/WOFFFileFormat.cpp: + +2010-07-31 Dan Bernstein <mitz@apple.com> + + Try to fix the Windows build when zlib is not available. + + * platform/graphics/WOFFFileFormat.cpp: + +2010-07-31 Dan Bernstein <mitz@apple.com> + + Fix typo in attempted build fix. + + * platform/graphics/WOFFFileFormat.cpp: + +2010-07-31 Dan Bernstein <mitz@apple.com> + + Try to fix the Windows build when zlib is not available. + + * platform/graphics/WOFFFileFormat.cpp: + +2010-07-31 Dan Bernstein <mitz@apple.com> + + Reviewed by Darin Adler. + + <rdar://problem/8234766> Add WOFF support for @font-face + https://bugs.webkit.org/show_bug.cgi?id=31302 + + * WebCore.vcproj/WebCore.vcproj: Added WOFFFileFormat.{cpp,h}. + * WebCore.vcproj/WebCoreCommon.vsprops: Added $(WebKitLibraries)\include\zlib to the header search path. + * WebCore.xcodeproj/project.pbxproj: Added WOFFFileFormat.{cpp,h} and linking against libz. + * css/CSSFontFaceSrcValue.cpp: + (WebCore::CSSFontFaceSrcValue::isSupportedFormat): Replaced hard-coded list of supported formats with + call to FontCustomPlatformData::supportsFormat(). + * platform/graphics/WOFFFileFormat.cpp: Added. + (WebCore::isWOFF): Checks if the buffer has the WOFF signature. + (WebCore::convertWOFFToSfnt): Extracts the sfnt payload of a WOFF package. + * platform/graphics/WOFFFileFormat.h: Added. + * platform/graphics/cairo/FontCustomPlatformData.cpp: + (WebCore::FontCustomPlatformData::supportsFormat): Added. Returns true for truetype and opentype. + * platform/graphics/cairo/FontCustomPlatformData.h: + * platform/graphics/chromium/FontCustomPlatformData.cpp: + (WebCore::FontCustomPlatformData::supportsFormat): Added. Returns true for truetype and opentype, + and also for woff if the OpenType sanitizer is enabled. + * platform/graphics/chromium/FontCustomPlatformData.h: + * platform/graphics/gtk/FontCustomPlatformDataPango.cpp: + (WebCore::FontCustomPlatformData::supportsFormat): Added. Returns false. + * platform/graphics/haiku/FontCustomPlatformData.cpp: + (WebCore::FontCustomPlatformData::supportsFormat): Ditto. + * platform/graphics/haiku/FontCustomPlatformData.h: + * platform/graphics/mac/FontCustomPlatformData.cpp: + (WebCore::freeSfntData): + (WebCore::createFontCustomPlatformData): If the OpenType font sanitizer is not enabled, use convertWOFFToSfnt(). + (WebCore::FontCustomPlatformData::supportsFormat): Added. Returns true for truetype, opentype and woff. + * platform/graphics/mac/FontCustomPlatformData.h: + * platform/graphics/qt/FontCustomPlatformData.h: + * platform/graphics/qt/FontCustomPlatformDataQt.cpp: + (WebCore::FontCustomPlatformData::supportsFormat): Added. Returns true for truetype and opentype. + * platform/graphics/win/FontCustomPlatformData.cpp: + (WebCore::createFontCustomPlatformData): If the OpenType font sanitizer is not enabled, use convertWOFFToSfnt(). + (WebCore::FontCustomPlatformData::supportsFormat): Added. Returns true for truetype, opentype and woff. + * platform/graphics/win/FontCustomPlatformData.h: + * platform/graphics/win/FontCustomPlatformDataCairo.cpp: + (WebCore::FontCustomPlatformData::supportsFormat): Added. Returns true for truetype and opentype. + * platform/graphics/win/FontCustomPlatformDataCairo.h: + * platform/graphics/wince/FontCustomPlatformData.cpp: + (WebCore::FontCustomPlatformData::supportsFormat): Ditto. + * platform/graphics/wince/FontCustomPlatformData.h: + +2010-07-31 Ryosuke Niwa <rniwa@webkit.org> + + Reviewed by Ojan Vafai. + + SplitElementCommand shouldn't be duplicating id attribute + https://bugs.webkit.org/show_bug.cgi?id=27156 + + Modified SplitElementCommand to delete the id attribute from the second element when splitting an element. + Since this causes WebKit not to merge split elements, added shouldSplitElement to ApplyStyleCommand which + determines the necessity of splitting the element. + + To share code between shouldSplitElement and removeInlineStyleFromElement (extracted from applyInlineStyle) + dontRemove was added as the 3rd argument to removeHTMLFontStyle, removeHTMLBidiEmbeddingStyle, and removeCSSStyle. + + Test: editing/style/split-element-id-duplication.html + + * editing/ApplyStyleCommand.cpp: + (WebCore::ApplyStyleCommand::applyBlockStyle): Added 3rd argument for removeCSSStyle. + (WebCore::ApplyStyleCommand::applyInlineStyle): Calls shouldSplitElement. + (WebCore::ApplyStyleCommand::removeInlineStyleFromElement): Extracted from removeInlineStyle. + (WebCore::ApplyStyleCommand::shouldRemoveInlineStyleFromElement): Inline helper for removeInlineStyleFromElement. + (WebCore::ApplyStyleCommand::removeHTMLFontStyle): Added dontRemove. + (WebCore::ApplyStyleCommand::removeHTMLBidiEmbeddingStyle): Added dontRemove. + (WebCore::ApplyStyleCommand::removeCSSStyle): Added dontRemove. + (WebCore::ApplyStyleCommand::removeInlineStyle): Calls removeInlineStyleFromElement. + (WebCore::ApplyStyleCommand::splitTextElementAtStart): Removed the call to splitTextAtStart. + Branching is now done in applyInlineStyle. + (WebCore::ApplyStyleCommand::splitTextElementAtEnd): Ditto for splitTextAtEnd. + (WebCore::ApplyStyleCommand::shouldSplitElement): Added. + * editing/ApplyStyleCommand.h: + * editing/SplitElementCommand.cpp: + (WebCore::SplitElementCommand::executeApply): Deletes the id attribute from the second element. + (WebCore::SplitElementCommand::doUnapply): Recovers the id attribute of the second element. + +2010-07-31 Luiz Agostini <luiz.agostini@openbossa.org> + + Build fix: Windows. + + * platform/win/PopupMenuWin.h: + +2010-07-31 Luiz Agostini <luiz.agostini@openbossa.org> + + Windows build fix. + + * platform/win/PopupMenuWin.cpp: + (WebCore::PopupMenuWin::PopupMenuWndProc): + +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + Classes PopupMenu and SearchPopupMenu have been made pure virtual. + + * platform/PopupMenu.h: + (WebCore::PopupMenu::~PopupMenu): + * platform/SearchPopupMenu.h: + (WebCore::SearchPopupMenu::~SearchPopupMenu): + + Classes RenderMenuList and RenderTexyControlSingleLine have been changed to use + the new pure virtual PopupMenu and SearchPopupMenu. + + * rendering/RenderMenuList.cpp: + (WebCore::RenderMenuList::adjustInnerStyle): + (WebCore::RenderMenuList::showPopup): + * rendering/RenderMenuList.h: + * rendering/RenderTextControlSingleLine.cpp: + (WebCore::RenderTextControlSingleLine::~RenderTextControlSingleLine): + (WebCore::RenderTextControlSingleLine::addSearchResult): + (WebCore::RenderTextControlSingleLine::showPopup): + (WebCore::RenderTextControlSingleLine::hidePopup): + (WebCore::RenderTextControlSingleLine::updateFromElement): + (WebCore::RenderTextControlSingleLine::valueChanged): + * rendering/RenderTextControlSingleLine.h: + + Chrome and ChromeClient were made responsible for providing instances of classes + PopupMenu and SearchPopupMenu to its users. + + * loader/EmptyClients.h: + (WebCore::EmptyPopupMenu::show): + (WebCore::EmptyPopupMenu::hide): + (WebCore::EmptyPopupMenu::updateFromElement): + (WebCore::EmptyPopupMenu::disconnectClient): + (WebCore::EmptySearchPopupMenu::popupMenu): + (WebCore::EmptySearchPopupMenu::saveRecentSearches): + (WebCore::EmptySearchPopupMenu::loadRecentSearches): + (WebCore::EmptySearchPopupMenu::enabled): + (WebCore::EmptyChromeClient::selectItemWritingDirectionIsNatural): + (WebCore::EmptyChromeClient::createPopupMenu): + (WebCore::EmptyChromeClient::createSearchPopupMenu): + * page/Chrome.cpp: + (WebCore::Chrome::selectItemWritingDirectionIsNatural): + (WebCore::Chrome::createPopupMenu): + (WebCore::Chrome::createSearchPopupMenu): + * page/Chrome.h: + * page/ChromeClient.h: + + Original contents of files PopupMenu.h and SearchPopupMenu.h have been splited + in several files, two for each platform (PopupMenuXXX.h and SearchPopupMenuXXX.h). + Each of new the files contain the concrete classes that inherit form PopupMenu or + SearchPopupMenu and are specific for the corresponding platform. + + brew: + + * platform/brew/PopupMenuBrew.cpp: + (WebCore::PopupMenuBrew::PopupMenuBrew): + (WebCore::PopupMenuBrew::~PopupMenuBrew): + (WebCore::PopupMenuBrew::disconnectClient): + (WebCore::PopupMenuBrew::show): + (WebCore::PopupMenuBrew::hide): + (WebCore::PopupMenuBrew::updateFromElement): + * platform/brew/PopupMenuBrew.h: Added. + (WebCore::PopupMenuBrew::client): + * platform/brew/SearchPopupMenuBrew.cpp: + (WebCore::SearchPopupMenuBrew::saveRecentSearches): + (WebCore::SearchPopupMenuBrew::loadRecentSearches): + (WebCore::SearchPopupMenuBrew::SearchPopupMenuBrew): + (WebCore::SearchPopupMenuBrew::enabled): + (WebCore::SearchPopupMenuBrew::popupMenu): + * platform/brew/SearchPopupMenuBrew.h: Added. + + chromium: + + * WebCore.gypi: + * platform/chromium/PopupMenuChromium.cpp: + (WebCore::PopupMenuChromium::PopupMenuChromium): + (WebCore::PopupMenuChromium::~PopupMenuChromium): + (WebCore::PopupMenuChromium::show): + (WebCore::PopupMenuChromium::hide): + (WebCore::PopupMenuChromium::updateFromElement): + (WebCore::PopupMenuChromium::disconnectClient): + * platform/chromium/PopupMenuChromium.h: + (WebCore::PopupMenuChromium::client): + * platform/chromium/SearchPopupMenuChromium.cpp: + (WebCore::SearchPopupMenuChromium::SearchPopupMenuChromium): + (WebCore::SearchPopupMenuChromium::popupMenu): + (WebCore::SearchPopupMenuChromium::enabled): + (WebCore::SearchPopupMenuChromium::saveRecentSearches): + (WebCore::SearchPopupMenuChromium::loadRecentSearches): + * platform/chromium/SearchPopupMenuChromium.h: Added. + + efl: + + * platform/efl/PopupMenuEfl.cpp: + (WebCore::PopupMenuEfl::PopupMenuEfl): + (WebCore::PopupMenuEfl::~PopupMenuEfl): + (WebCore::PopupMenuEfl::show): + (WebCore::PopupMenuEfl::hide): + (WebCore::PopupMenuEfl::updateFromElement): + (WebCore::PopupMenuEfl::disconnectClient): + * platform/efl/PopupMenuEfl.h: Added. + (WebCore::PopupMenuEfl::client): + * platform/efl/SearchPopupMenuEfl.cpp: + (WebCore::SearchPopupMenuEfl::SearchPopupMenuEfl): + (WebCore::SearchPopupMenuEfl::popupMenu): + (WebCore::SearchPopupMenuEfl::saveRecentSearches): + (WebCore::SearchPopupMenuEfl::loadRecentSearches): + (WebCore::SearchPopupMenuEfl::enabled): + * platform/efl/SearchPopupMenuEfl.h: Added. + + gtk: + + * GNUmakefile.am: + * platform/gtk/PopupMenuGtk.cpp: + (WebCore::PopupMenuGtk::PopupMenuGtk): + (WebCore::PopupMenuGtk::~PopupMenuGtk): + (WebCore::PopupMenuGtk::show): + (WebCore::PopupMenuGtk::hide): + (WebCore::PopupMenuGtk::updateFromElement): + (WebCore::PopupMenuGtk::disconnectClient): + (WebCore::PopupMenuGtk::menuItemActivated): + (WebCore::PopupMenuGtk::menuUnmapped): + (WebCore::PopupMenuGtk::menuPositionFunction): + (WebCore::PopupMenuGtk::menuRemoveItem): + * platform/gtk/PopupMenuGtk.h: Added. + (WebCore::PopupMenuGtk::client): + * platform/gtk/SearchPopupMenuGtk.cpp: + (WebCore::SearchPopupMenuGtk::SearchPopupMenuGtk): + (WebCore::SearchPopupMenuGtk::popupMenu): + (WebCore::SearchPopupMenuGtk::saveRecentSearches): + (WebCore::SearchPopupMenuGtk::loadRecentSearches): + (WebCore::SearchPopupMenuGtk::enabled): + * platform/gtk/SearchPopupMenuGtk.h: Added. + + haiku: + + * platform/haiku/PopupMenuHaiku.cpp: + (WebCore::HaikuPopup::HaikuPopup): + (WebCore::HaikuPopup::~HaikuPopup): + (WebCore::PopupMenuHaiku::PopupMenuHaiku): + (WebCore::PopupMenuHaiku::~PopupMenuHaiku): + (WebCore::PopupMenuHaiku::disconnectClient): + (WebCore::PopupMenuHaiku::show): + (WebCore::PopupMenuHaiku::hide): + (WebCore::PopupMenuHaiku::updateFromElement): + * platform/haiku/PopupMenuHaiku.h: Added. + (WebCore::PopupMenuHaiku::disconnectClient): + (WebCore::PopupMenuHaiku::client): + * platform/haiku/SearchPopupMenuHaiku.cpp: + (WebCore::SearchPopupMenuHaiku::SearchPopupMenuHaiku): + (WebCore::SearchPopupMenuHaiku::saveRecentSearches): + (WebCore::SearchPopupMenuHaiku::loadRecentSearches): + (WebCore::SearchPopupMenuHaiku::enabled): + (WebCore::SearchPopupMenuHaiku::popupMenu): + * platform/haiku/SearchPopupMenuHaiku.h: Added. + + mac: + + * WebCore.exp.in: + * WebCore.xcodeproj/project.pbxproj: + * platform/mac/PopupMenuMac.h: Added. + (WebCore::PopupMenuMac::disconnectClient): + (WebCore::PopupMenuMac::client): + * platform/mac/PopupMenuMac.mm: + (WebCore::PopupMenuMac::PopupMenuMac): + (WebCore::PopupMenuMac::~PopupMenuMac): + (WebCore::PopupMenuMac::clear): + (WebCore::PopupMenuMac::populate): + (WebCore::PopupMenuMac::show): + (WebCore::PopupMenuMac::hide): + (WebCore::PopupMenuMac::updateFromElement): + (WebCore::PopupMenuMac::itemWritingDirectionIsNatural): + * platform/mac/SearchPopupMenuMac.h: Added. + * platform/mac/SearchPopupMenuMac.mm: + (WebCore::SearchPopupMenuMac::SearchPopupMenuMac): + (WebCore::SearchPopupMenuMac::popupMenu): + (WebCore::SearchPopupMenuMac::enabled): + (WebCore::SearchPopupMenuMac::saveRecentSearches): + (WebCore::SearchPopupMenuMac::loadRecentSearches): + + qt: + + * WebCore.pro: + * platform/qt/PopupMenuQt.cpp: + (WebCore::PopupMenuQt::PopupMenuQt): + (WebCore::PopupMenuQt::~PopupMenuQt): + (WebCore::PopupMenuQt::disconnectClient): + (WebCore::PopupMenuQt::show): + (WebCore::PopupMenuQt::hide): + (WebCore::PopupMenuQt::updateFromElement): + * platform/qt/PopupMenuQt.h: Added. + * platform/qt/QtAbstractWebPopup.h: + * platform/qt/SearchPopupMenuQt.cpp: + (WebCore::SearchPopupMenuQt::SearchPopupMenuQt): + (WebCore::SearchPopupMenuQt::popupMenu): + (WebCore::SearchPopupMenuQt::saveRecentSearches): + (WebCore::SearchPopupMenuQt::loadRecentSearches): + (WebCore::SearchPopupMenuQt::enabled): + * platform/qt/SearchPopupMenuQt.h: Added. + + win: + + * WebCore.vcproj/WebCore.vcproj: + * platform/win/PopupMenuWin.cpp: + (WebCore::PopupMenuWin::PopupMenuWin): + (WebCore::PopupMenuWin::~PopupMenuWin): + (WebCore::PopupMenuWin::disconnectClient): + (WebCore::PopupMenuWin::popupClassName): + (WebCore::PopupMenuWin::show): + (WebCore::PopupMenuWin::hide): + (WebCore::PopupMenuWin::calculatePositionAndSize): + (WebCore::PopupMenuWin::setFocusedIndex): + (WebCore::PopupMenuWin::visibleItems): + (WebCore::PopupMenuWin::listIndexAtPoint): + (WebCore::PopupMenuWin::focusedIndex): + (WebCore::PopupMenuWin::focusFirst): + (WebCore::PopupMenuWin::focusLast): + (WebCore::PopupMenuWin::down): + (WebCore::PopupMenuWin::up): + (WebCore::PopupMenuWin::invalidateItem): + (WebCore::PopupMenuWin::clientRect): + (WebCore::PopupMenuWin::incrementWheelDelta): + (WebCore::PopupMenuWin::reduceWheelDelta): + (WebCore::PopupMenuWin::scrollToRevealSelection): + (WebCore::PopupMenuWin::updateFromElement): + (WebCore::PopupMenuWin::paint): + (WebCore::PopupMenuWin::valueChanged): + (WebCore::PopupMenuWin::invalidateScrollbarRect): + (WebCore::PopupMenuWin::registerClass): + (WebCore::PopupMenuWin::PopupMenuWndProc): + (WebCore::PopupMenuWin::wndProc): + * platform/win/PopupMenuWin.h: Added. + (WebCore::PopupMenuWin::client): + (WebCore::PopupMenuWin::scrollbar): + (WebCore::PopupMenuWin::itemHeight): + (WebCore::PopupMenuWin::windowRect): + (WebCore::PopupMenuWin::popupHandle): + (WebCore::PopupMenuWin::setWasClicked): + (WebCore::PopupMenuWin::wasClicked): + (WebCore::PopupMenuWin::setScrollOffset): + (WebCore::PopupMenuWin::scrollOffset): + (WebCore::PopupMenuWin::wheelDelta): + (WebCore::PopupMenuWin::scrollbarCapturingMouse): + (WebCore::PopupMenuWin::setScrollbarCapturingMouse): + * platform/win/SearchPopupMenuWin.cpp: + (WebCore::SearchPopupMenuWin::SearchPopupMenuWin): + (WebCore::SearchPopupMenuWin::popupMenu): + (WebCore::SearchPopupMenuWin::enabled): + (WebCore::SearchPopupMenuWin::saveRecentSearches): + (WebCore::SearchPopupMenuWin::loadRecentSearches): + * platform/win/SearchPopupMenuWin.h: Added. + + wx: + + * platform/wx/PopupMenuWx.cpp: + (WebCore::PopupMenuWx::PopupMenuWx): + (WebCore::PopupMenuWx::~PopupMenuWx): + (WebCore::PopupMenuWx::disconnectClient): + (WebCore::PopupMenuWx::show): + (WebCore::PopupMenuWx::OnMenuItemSelected): + (WebCore::PopupMenuWx::hide): + (WebCore::PopupMenuWx::updateFromElement): + * platform/wx/PopupMenuWx.h: Added. + (WebCore::PopupMenuWx::client): + * platform/wx/SearchPopupMenuWx.cpp: + (WebCore::SearchPopupMenuWx::SearchPopupMenuWx): + (WebCore::SearchPopupMenuWx::saveRecentSearches): + (WebCore::SearchPopupMenuWx::loadRecentSearches): + (WebCore::SearchPopupMenuWx::enabled): + (WebCore::SearchPopupMenuWx::popupMenu): + * platform/wx/SearchPopupMenuWx.h: Added. + + + +2010-07-31 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r64422. + http://trac.webkit.org/changeset/64422 + https://bugs.webkit.org/show_bug.cgi?id=43304 + + Build fixes are needed for Snow Leopard and Windows. + (Requested by lca on #webkit). + + * GNUmakefile.am: + * WebCore.exp.in: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * loader/EmptyClients.h: + * page/Chrome.cpp: + * page/Chrome.h: + * page/ChromeClient.h: + * platform/PopupMenu.h: + (WebCore::PopupMenu::create): + (WebCore::PopupMenu::disconnectClient): + (WebCore::PopupMenu::client): + (WebCore::PopupMenu::scrollbar): + (WebCore::PopupMenu::itemHeight): + (WebCore::PopupMenu::windowRect): + (WebCore::PopupMenu::popupHandle): + (WebCore::PopupMenu::setWasClicked): + (WebCore::PopupMenu::wasClicked): + (WebCore::PopupMenu::setScrollOffset): + (WebCore::PopupMenu::scrollOffset): + (WebCore::PopupMenu::wheelDelta): + (WebCore::PopupMenu::scrollbarCapturingMouse): + (WebCore::PopupMenu::setScrollbarCapturingMouse): + (WebCore::PopupMenu::isActive): + (WebCore::PopupMenu::scrollbarCornerPresent): + * platform/SearchPopupMenu.h: + (WebCore::SearchPopupMenu::create): + * platform/brew/PopupMenuBrew.cpp: + (WebCore::PopupMenu::PopupMenu): + (WebCore::PopupMenu::~PopupMenu): + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::hide): + (WebCore::PopupMenu::updateFromElement): + (WebCore::PopupMenu::itemWritingDirectionIsNatural): + * platform/brew/PopupMenuBrew.h: Removed. + * platform/brew/SearchPopupMenuBrew.cpp: + (WebCore::SearchPopupMenu::saveRecentSearches): + (WebCore::SearchPopupMenu::loadRecentSearches): + (WebCore::SearchPopupMenu::SearchPopupMenu): + (WebCore::SearchPopupMenu::enabled): + * platform/brew/SearchPopupMenuBrew.h: Removed. + * platform/chromium/PopupMenuChromium.cpp: + (WebCore::PopupMenu::PopupMenu): + (WebCore::PopupMenu::~PopupMenu): + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::hide): + (WebCore::PopupMenu::updateFromElement): + (WebCore::PopupMenu::itemWritingDirectionIsNatural): + * platform/chromium/PopupMenuChromium.h: + * platform/chromium/SearchPopupMenuChromium.cpp: + (WebCore::SearchPopupMenu::SearchPopupMenu): + (WebCore::SearchPopupMenu::enabled): + (WebCore::SearchPopupMenu::saveRecentSearches): + (WebCore::SearchPopupMenu::loadRecentSearches): + * platform/chromium/SearchPopupMenuChromium.h: Removed. + * platform/efl/PopupMenuEfl.cpp: + (WebCore::PopupMenu::PopupMenu): + (WebCore::PopupMenu::~PopupMenu): + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::hide): + (WebCore::PopupMenu::updateFromElement): + (WebCore::PopupMenu::itemWritingDirectionIsNatural): + * platform/efl/PopupMenuEfl.h: Removed. + * platform/efl/SearchPopupMenuEfl.cpp: + (WebCore::SearchPopupMenu::SearchPopupMenu): + (WebCore::SearchPopupMenu::saveRecentSearches): + (WebCore::SearchPopupMenu::loadRecentSearches): + (WebCore::SearchPopupMenu::enabled): + * platform/efl/SearchPopupMenuEfl.h: Removed. + * platform/gtk/PopupMenuGtk.cpp: + (WebCore::PopupMenu::PopupMenu): + (WebCore::PopupMenu::~PopupMenu): + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::hide): + (WebCore::PopupMenu::updateFromElement): + (WebCore::PopupMenu::itemWritingDirectionIsNatural): + (WebCore::PopupMenu::menuItemActivated): + (WebCore::PopupMenu::menuUnmapped): + (WebCore::PopupMenu::menuPositionFunction): + (WebCore::PopupMenu::menuRemoveItem): + * platform/gtk/PopupMenuGtk.h: Removed. + * platform/gtk/SearchPopupMenuGtk.cpp: + (WebCore::SearchPopupMenu::SearchPopupMenu): + (WebCore::SearchPopupMenu::saveRecentSearches): + (WebCore::SearchPopupMenu::loadRecentSearches): + (WebCore::SearchPopupMenu::enabled): + * platform/gtk/SearchPopupMenuGtk.h: Removed. + * platform/haiku/PopupMenuHaiku.cpp: + (WebCore::PopupMenuHaiku::PopupMenuHaiku): + (WebCore::PopupMenuHaiku::~PopupMenuHaiku): + (WebCore::PopupMenu::PopupMenu): + (WebCore::PopupMenu::~PopupMenu): + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::hide): + (WebCore::PopupMenu::updateFromElement): + (WebCore::PopupMenu::itemWritingDirectionIsNatural): + * platform/haiku/PopupMenuHaiku.h: Removed. + * platform/haiku/SearchPopupMenuHaiku.cpp: + (WebCore::SearchPopupMenu::SearchPopupMenu): + (WebCore::SearchPopupMenu::saveRecentSearches): + (WebCore::SearchPopupMenu::loadRecentSearches): + (WebCore::SearchPopupMenu::enabled): + * platform/haiku/SearchPopupMenuHaiku.h: Removed. + * platform/mac/PopupMenuMac.h: Removed. + * platform/mac/PopupMenuMac.mm: + (WebCore::PopupMenu::PopupMenu): + (WebCore::PopupMenu::~PopupMenu): + (WebCore::PopupMenu::clear): + (WebCore::PopupMenu::populate): + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::hide): + (WebCore::PopupMenu::updateFromElement): + (WebCore::PopupMenu::itemWritingDirectionIsNatural): + * platform/mac/SearchPopupMenuMac.h: Removed. + * platform/mac/SearchPopupMenuMac.mm: + (WebCore::SearchPopupMenu::SearchPopupMenu): + (WebCore::SearchPopupMenu::enabled): + (WebCore::SearchPopupMenu::saveRecentSearches): + (WebCore::SearchPopupMenu::loadRecentSearches): + * platform/qt/PopupMenuQt.cpp: + (WebCore::PopupMenu::PopupMenu): + (WebCore::PopupMenu::~PopupMenu): + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::hide): + (WebCore::PopupMenu::updateFromElement): + (WebCore::PopupMenu::itemWritingDirectionIsNatural): + * platform/qt/PopupMenuQt.h: Removed. + * platform/qt/QtAbstractWebPopup.h: + * platform/qt/SearchPopupMenuQt.cpp: + (WebCore::SearchPopupMenu::SearchPopupMenu): + (WebCore::SearchPopupMenu::saveRecentSearches): + (WebCore::SearchPopupMenu::loadRecentSearches): + (WebCore::SearchPopupMenu::enabled): + * platform/qt/SearchPopupMenuQt.h: Removed. + * platform/win/PopupMenuWin.cpp: + (WebCore::PopupMenu::PopupMenu): + (WebCore::PopupMenu::~PopupMenu): + (WebCore::PopupMenu::popupClassName): + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::hide): + (WebCore::PopupMenu::calculatePositionAndSize): + (WebCore::PopupMenu::setFocusedIndex): + (WebCore::PopupMenu::visibleItems): + (WebCore::PopupMenu::listIndexAtPoint): + (WebCore::PopupMenu::focusedIndex): + (WebCore::PopupMenu::focusFirst): + (WebCore::PopupMenu::focusLast): + (WebCore::PopupMenu::down): + (WebCore::PopupMenu::up): + (WebCore::PopupMenu::invalidateItem): + (WebCore::PopupMenu::clientRect): + (WebCore::PopupMenu::incrementWheelDelta): + (WebCore::PopupMenu::reduceWheelDelta): + (WebCore::PopupMenu::scrollToRevealSelection): + (WebCore::PopupMenu::updateFromElement): + (WebCore::PopupMenu::itemWritingDirectionIsNatural): + (WebCore::PopupMenu::paint): + (WebCore::PopupMenu::valueChanged): + (WebCore::PopupMenu::invalidateScrollbarRect): + (WebCore::PopupMenu::registerClass): + (WebCore::PopupMenu::PopupMenuWndProc): + (WebCore::PopupMenu::wndProc): + * platform/win/PopupMenuWin.h: Removed. + * platform/win/SearchPopupMenuWin.cpp: + (WebCore::SearchPopupMenu::SearchPopupMenu): + (WebCore::SearchPopupMenu::enabled): + (WebCore::SearchPopupMenu::saveRecentSearches): + (WebCore::SearchPopupMenu::loadRecentSearches): + * platform/win/SearchPopupMenuWin.h: Removed. + * platform/wx/PopupMenuWx.cpp: + (WebCore::PopupMenu::PopupMenu): + (WebCore::PopupMenu::~PopupMenu): + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::OnMenuItemSelected): + (WebCore::PopupMenu::hide): + (WebCore::PopupMenu::updateFromElement): + (WebCore::PopupMenu::itemWritingDirectionIsNatural): + * platform/wx/PopupMenuWx.h: Removed. + * platform/wx/SearchPopupMenuWx.cpp: + (WebCore::SearchPopupMenu::SearchPopupMenu): + (WebCore::SearchPopupMenu::saveRecentSearches): + (WebCore::SearchPopupMenu::loadRecentSearches): + (WebCore::SearchPopupMenu::enabled): + * platform/wx/SearchPopupMenuWx.h: Removed. + * rendering/RenderMenuList.cpp: + (WebCore::RenderMenuList::adjustInnerStyle): + (WebCore::RenderMenuList::showPopup): + * rendering/RenderMenuList.h: + * rendering/RenderTextControlSingleLine.cpp: + (WebCore::RenderTextControlSingleLine::~RenderTextControlSingleLine): + (WebCore::RenderTextControlSingleLine::addSearchResult): + (WebCore::RenderTextControlSingleLine::showPopup): + (WebCore::RenderTextControlSingleLine::hidePopup): + (WebCore::RenderTextControlSingleLine::updateFromElement): + (WebCore::RenderTextControlSingleLine::valueChanged): + * rendering/RenderTextControlSingleLine.h: + +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + Classes PopupMenu and SearchPopupMenu have been made pure virtual. + + * platform/PopupMenu.h: + (WebCore::PopupMenu::~PopupMenu): + * platform/SearchPopupMenu.h: + (WebCore::SearchPopupMenu::~SearchPopupMenu): + + Classes RenderMenuList and RenderTexyControlSingleLine have been changed to use + the new pure virtual PopupMenu and SearchPopupMenu. + + * rendering/RenderMenuList.cpp: + (WebCore::RenderMenuList::adjustInnerStyle): + (WebCore::RenderMenuList::showPopup): + * rendering/RenderMenuList.h: + * rendering/RenderTextControlSingleLine.cpp: + (WebCore::RenderTextControlSingleLine::~RenderTextControlSingleLine): + (WebCore::RenderTextControlSingleLine::addSearchResult): + (WebCore::RenderTextControlSingleLine::showPopup): + (WebCore::RenderTextControlSingleLine::hidePopup): + (WebCore::RenderTextControlSingleLine::updateFromElement): + (WebCore::RenderTextControlSingleLine::valueChanged): + * rendering/RenderTextControlSingleLine.h: + + Chrome and ChromeClient were made responsible for providing instances of classes + PopupMenu and SearchPopupMenu to its users. + + * loader/EmptyClients.h: + (WebCore::EmptyPopupMenu::show): + (WebCore::EmptyPopupMenu::hide): + (WebCore::EmptyPopupMenu::updateFromElement): + (WebCore::EmptyPopupMenu::disconnectClient): + (WebCore::EmptySearchPopupMenu::popupMenu): + (WebCore::EmptySearchPopupMenu::saveRecentSearches): + (WebCore::EmptySearchPopupMenu::loadRecentSearches): + (WebCore::EmptySearchPopupMenu::enabled): + (WebCore::EmptyChromeClient::selectItemWritingDirectionIsNatural): + (WebCore::EmptyChromeClient::createPopupMenu): + (WebCore::EmptyChromeClient::createSearchPopupMenu): + * page/Chrome.cpp: + (WebCore::Chrome::selectItemWritingDirectionIsNatural): + (WebCore::Chrome::createPopupMenu): + (WebCore::Chrome::createSearchPopupMenu): + * page/Chrome.h: + * page/ChromeClient.h: + + Original contents of files PopupMenu.h and SearchPopupMenu.h have been splited + in several files, two for each platform (PopupMenuXXX.h and SearchPopupMenuXXX.h). + Each of new the files contain the concrete classes that inherit form PopupMenu or + SearchPopupMenu and are specific for the corresponding platform. + + brew: + + * platform/brew/PopupMenuBrew.cpp: + (WebCore::PopupMenuBrew::PopupMenuBrew): + (WebCore::PopupMenuBrew::~PopupMenuBrew): + (WebCore::PopupMenuBrew::disconnectClient): + (WebCore::PopupMenuBrew::show): + (WebCore::PopupMenuBrew::hide): + (WebCore::PopupMenuBrew::updateFromElement): + * platform/brew/PopupMenuBrew.h: Added. + (WebCore::PopupMenuBrew::client): + * platform/brew/SearchPopupMenuBrew.cpp: + (WebCore::SearchPopupMenuBrew::saveRecentSearches): + (WebCore::SearchPopupMenuBrew::loadRecentSearches): + (WebCore::SearchPopupMenuBrew::SearchPopupMenuBrew): + (WebCore::SearchPopupMenuBrew::enabled): + (WebCore::SearchPopupMenuBrew::popupMenu): + * platform/brew/SearchPopupMenuBrew.h: Added. + + chromium: + + * WebCore.gypi: + * platform/chromium/PopupMenuChromium.cpp: + (WebCore::PopupMenuChromium::PopupMenuChromium): + (WebCore::PopupMenuChromium::~PopupMenuChromium): + (WebCore::PopupMenuChromium::show): + (WebCore::PopupMenuChromium::hide): + (WebCore::PopupMenuChromium::updateFromElement): + (WebCore::PopupMenuChromium::disconnectClient): + * platform/chromium/PopupMenuChromium.h: + (WebCore::PopupMenuChromium::client): + * platform/chromium/SearchPopupMenuChromium.cpp: + (WebCore::SearchPopupMenuChromium::SearchPopupMenuChromium): + (WebCore::SearchPopupMenuChromium::popupMenu): + (WebCore::SearchPopupMenuChromium::enabled): + (WebCore::SearchPopupMenuChromium::saveRecentSearches): + (WebCore::SearchPopupMenuChromium::loadRecentSearches): + * platform/chromium/SearchPopupMenuChromium.h: Added. + + efl: + + * platform/efl/PopupMenuEfl.cpp: + (WebCore::PopupMenuEfl::PopupMenuEfl): + (WebCore::PopupMenuEfl::~PopupMenuEfl): + (WebCore::PopupMenuEfl::show): + (WebCore::PopupMenuEfl::hide): + (WebCore::PopupMenuEfl::updateFromElement): + (WebCore::PopupMenuEfl::disconnectClient): + * platform/efl/PopupMenuEfl.h: Added. + (WebCore::PopupMenuEfl::client): + * platform/efl/SearchPopupMenuEfl.cpp: + (WebCore::SearchPopupMenuEfl::SearchPopupMenuEfl): + (WebCore::SearchPopupMenuEfl::popupMenu): + (WebCore::SearchPopupMenuEfl::saveRecentSearches): + (WebCore::SearchPopupMenuEfl::loadRecentSearches): + (WebCore::SearchPopupMenuEfl::enabled): + * platform/efl/SearchPopupMenuEfl.h: Added. + + gtk: + + * GNUmakefile.am: + * platform/gtk/PopupMenuGtk.cpp: + (WebCore::PopupMenuGtk::PopupMenuGtk): + (WebCore::PopupMenuGtk::~PopupMenuGtk): + (WebCore::PopupMenuGtk::show): + (WebCore::PopupMenuGtk::hide): + (WebCore::PopupMenuGtk::updateFromElement): + (WebCore::PopupMenuGtk::disconnectClient): + (WebCore::PopupMenuGtk::menuItemActivated): + (WebCore::PopupMenuGtk::menuUnmapped): + (WebCore::PopupMenuGtk::menuPositionFunction): + (WebCore::PopupMenuGtk::menuRemoveItem): + * platform/gtk/PopupMenuGtk.h: Added. + (WebCore::PopupMenuGtk::client): + * platform/gtk/SearchPopupMenuGtk.cpp: + (WebCore::SearchPopupMenuGtk::SearchPopupMenuGtk): + (WebCore::SearchPopupMenuGtk::popupMenu): + (WebCore::SearchPopupMenuGtk::saveRecentSearches): + (WebCore::SearchPopupMenuGtk::loadRecentSearches): + (WebCore::SearchPopupMenuGtk::enabled): + * platform/gtk/SearchPopupMenuGtk.h: Added. + + haiku: + + * platform/haiku/PopupMenuHaiku.cpp: + (WebCore::HaikuPopup::HaikuPopup): + (WebCore::HaikuPopup::~HaikuPopup): + (WebCore::PopupMenuHaiku::PopupMenuHaiku): + (WebCore::PopupMenuHaiku::~PopupMenuHaiku): + (WebCore::PopupMenuHaiku::disconnectClient): + (WebCore::PopupMenuHaiku::show): + (WebCore::PopupMenuHaiku::hide): + (WebCore::PopupMenuHaiku::updateFromElement): + * platform/haiku/PopupMenuHaiku.h: Added. + (WebCore::PopupMenuHaiku::disconnectClient): + (WebCore::PopupMenuHaiku::client): + * platform/haiku/SearchPopupMenuHaiku.cpp: + (WebCore::SearchPopupMenuHaiku::SearchPopupMenuHaiku): + (WebCore::SearchPopupMenuHaiku::saveRecentSearches): + (WebCore::SearchPopupMenuHaiku::loadRecentSearches): + (WebCore::SearchPopupMenuHaiku::enabled): + (WebCore::SearchPopupMenuHaiku::popupMenu): + * platform/haiku/SearchPopupMenuHaiku.h: Added. + + mac: + + * WebCore.exp.in: + * WebCore.xcodeproj/project.pbxproj: + * platform/mac/PopupMenuMac.h: Added. + (WebCore::PopupMenuMac::disconnectClient): + (WebCore::PopupMenuMac::client): + * platform/mac/PopupMenuMac.mm: + (WebCore::PopupMenuMac::PopupMenuMac): + (WebCore::PopupMenuMac::~PopupMenuMac): + (WebCore::PopupMenuMac::clear): + (WebCore::PopupMenuMac::populate): + (WebCore::PopupMenuMac::show): + (WebCore::PopupMenuMac::hide): + (WebCore::PopupMenuMac::updateFromElement): + (WebCore::PopupMenuMac::itemWritingDirectionIsNatural): + * platform/mac/SearchPopupMenuMac.h: Added. + * platform/mac/SearchPopupMenuMac.mm: + (WebCore::SearchPopupMenuMac::SearchPopupMenuMac): + (WebCore::SearchPopupMenuMac::popupMenu): + (WebCore::SearchPopupMenuMac::enabled): + (WebCore::SearchPopupMenuMac::saveRecentSearches): + (WebCore::SearchPopupMenuMac::loadRecentSearches): + + qt: + + * WebCore.pro: + * platform/qt/PopupMenuQt.cpp: + (WebCore::PopupMenuQt::PopupMenuQt): + (WebCore::PopupMenuQt::~PopupMenuQt): + (WebCore::PopupMenuQt::disconnectClient): + (WebCore::PopupMenuQt::show): + (WebCore::PopupMenuQt::hide): + (WebCore::PopupMenuQt::updateFromElement): + * platform/qt/PopupMenuQt.h: Added. + * platform/qt/QtAbstractWebPopup.h: + * platform/qt/SearchPopupMenuQt.cpp: + (WebCore::SearchPopupMenuQt::SearchPopupMenuQt): + (WebCore::SearchPopupMenuQt::popupMenu): + (WebCore::SearchPopupMenuQt::saveRecentSearches): + (WebCore::SearchPopupMenuQt::loadRecentSearches): + (WebCore::SearchPopupMenuQt::enabled): + * platform/qt/SearchPopupMenuQt.h: Added. + + win: + + * WebCore.vcproj/WebCore.vcproj: + * platform/win/PopupMenuWin.cpp: + (WebCore::PopupMenuWin::PopupMenuWin): + (WebCore::PopupMenuWin::~PopupMenuWin): + (WebCore::PopupMenuWin::disconnectClient): + (WebCore::PopupMenuWin::popupClassName): + (WebCore::PopupMenuWin::show): + (WebCore::PopupMenuWin::hide): + (WebCore::PopupMenuWin::calculatePositionAndSize): + (WebCore::PopupMenuWin::setFocusedIndex): + (WebCore::PopupMenuWin::visibleItems): + (WebCore::PopupMenuWin::listIndexAtPoint): + (WebCore::PopupMenuWin::focusedIndex): + (WebCore::PopupMenuWin::focusFirst): + (WebCore::PopupMenuWin::focusLast): + (WebCore::PopupMenuWin::down): + (WebCore::PopupMenuWin::up): + (WebCore::PopupMenuWin::invalidateItem): + (WebCore::PopupMenuWin::clientRect): + (WebCore::PopupMenuWin::incrementWheelDelta): + (WebCore::PopupMenuWin::reduceWheelDelta): + (WebCore::PopupMenuWin::scrollToRevealSelection): + (WebCore::PopupMenuWin::updateFromElement): + (WebCore::PopupMenuWin::paint): + (WebCore::PopupMenuWin::valueChanged): + (WebCore::PopupMenuWin::invalidateScrollbarRect): + (WebCore::PopupMenuWin::registerClass): + (WebCore::PopupMenuWin::PopupMenuWndProc): + (WebCore::PopupMenuWin::wndProc): + * platform/win/PopupMenuWin.h: Added. + (WebCore::PopupMenuWin::client): + (WebCore::PopupMenuWin::scrollbar): + (WebCore::PopupMenuWin::itemHeight): + (WebCore::PopupMenuWin::windowRect): + (WebCore::PopupMenuWin::popupHandle): + (WebCore::PopupMenuWin::setWasClicked): + (WebCore::PopupMenuWin::wasClicked): + (WebCore::PopupMenuWin::setScrollOffset): + (WebCore::PopupMenuWin::scrollOffset): + (WebCore::PopupMenuWin::wheelDelta): + (WebCore::PopupMenuWin::scrollbarCapturingMouse): + (WebCore::PopupMenuWin::setScrollbarCapturingMouse): + * platform/win/SearchPopupMenuWin.cpp: + (WebCore::SearchPopupMenuWin::SearchPopupMenuWin): + (WebCore::SearchPopupMenuWin::popupMenu): + (WebCore::SearchPopupMenuWin::enabled): + (WebCore::SearchPopupMenuWin::saveRecentSearches): + (WebCore::SearchPopupMenuWin::loadRecentSearches): + * platform/win/SearchPopupMenuWin.h: Added. + + wx: + + * platform/wx/PopupMenuWx.cpp: + (WebCore::PopupMenuWx::PopupMenuWx): + (WebCore::PopupMenuWx::~PopupMenuWx): + (WebCore::PopupMenuWx::disconnectClient): + (WebCore::PopupMenuWx::show): + (WebCore::PopupMenuWx::OnMenuItemSelected): + (WebCore::PopupMenuWx::hide): + (WebCore::PopupMenuWx::updateFromElement): + * platform/wx/PopupMenuWx.h: Added. + (WebCore::PopupMenuWx::client): + * platform/wx/SearchPopupMenuWx.cpp: + (WebCore::SearchPopupMenuWx::SearchPopupMenuWx): + (WebCore::SearchPopupMenuWx::saveRecentSearches): + (WebCore::SearchPopupMenuWx::loadRecentSearches): + (WebCore::SearchPopupMenuWx::enabled): + (WebCore::SearchPopupMenuWx::popupMenu): + * platform/wx/SearchPopupMenuWx.h: Added. + + + +2010-07-31 David Kilzer <ddkilzer@apple.com> + + <http://webkit.org/b/43300> Simplify variables in *.xcconfig files after adding iOS support + + Reviewed by Darin Adler. + + * Configurations/WebCore.xcconfig: Extracted + PRODUCTION_FRAMEWORKS_DIR variable. + +2010-07-31 Nikolas Zimmermann <nzimmermann@rim.com> + + Reviewed by Dirk Schulze. + + HTMLStyleElement/SVGStyleElement need to share more code + https://bugs.webkit.org/show_bug.cgi?id=43293 + + Simplify HTMLStyleElement/SVGStyleElement. They look identically now, as all code is shared in StyleElement. + Doesn't affect any tests. + + * dom/StyleElement.cpp: + (WebCore::StyleElement::StyleElement): Take createdByParser & Document arguments, to share the line number extraction logic. Store it in m_lineNumber. + (WebCore::StyleElement::insertedIntoDocument): Moved addStyleSheetCandidateNode here, to share code between HTML/SVGStyleElement. + (WebCore::StyleElement::removedFromDocument): Same for removeStyleSheetCandidateNode. + (WebCore::StyleElement::childrenChanged): Introduced new helper function. + (WebCore::StyleElement::finishParsingChildren): Ditto. + (WebCore::StyleElement::process): Use stored m_lineNumber, avoids a parameter. + (WebCore::StyleElement::createSheet): No need to call the virtual setLoading() function, just store m_loading in StyleElement, and set it from here. + (WebCore::StyleElement::isLoading): Introduced new helper function. + (WebCore::StyleElement::sheetLoaded): Ditto. + * dom/StyleElement.h: + * html/HTMLStyleElement.cpp: + (WebCore::HTMLStyleElement::HTMLStyleElement): Pass Document & createdByParser arguments to StyleElement. + (WebCore::HTMLStyleElement::finishParsingChildren): Delegate work to StyleElement. + (WebCore::HTMLStyleElement::insertedIntoDocument): Ditto. + (WebCore::HTMLStyleElement::removedFromDocument): Ditto. + (WebCore::HTMLStyleElement::childrenChanged): Ditto. + * html/HTMLStyleElement.h: + (WebCore::HTMLStyleElement::isLoading): Ditto. + (WebCore::HTMLStyleElement::sheetLoaded): Ditto. + * svg/SVGStyleElement.cpp: + (WebCore::SVGStyleElement::SVGStyleElement): Pass Document & createdByParser arguments to StyleElement. + (WebCore::SVGStyleElement::finishParsingChildren): Delegate work to StyleElement. + (WebCore::SVGStyleElement::insertedIntoDocument): Ditto. + (WebCore::SVGStyleElement::removedFromDocument): Ditto. + (WebCore::SVGStyleElement::childrenChanged): Ditto. + * svg/SVGStyleElement.h: + (WebCore::SVGStyleElement::isLoading): Ditto. + (WebCore::SVGStyleElement::sheetLoaded): Ditto. + +2010-07-31 Kinuko Yasuda <kinuko@chromium.org> + + Unreviewed. Attempt to fix release build failure. + + Having 'fail:' label without goto statement generates a compiler + warning that causes a build failure in release build. + + * bindings/scripts/CodeGeneratorV8.pm: + +2010-07-31 Kinuko Yasuda <kinuko@chromium.org> + + Reviewed by Nikolas Zimmermann. + + Fix 'bool' in bindings/scripts/test/TestObj. + + * bindings/scripts/test/CPP/WebDOMTestObj.cpp: + (WebDOMTestObj::CREATE): + (WebDOMTestObj::setCREATE): + * bindings/scripts/test/CPP/WebDOMTestObj.h: + * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: + (webkit_dom_test_obj_get_create): + (webkit_dom_test_obj_set_create): + (webkit_dom_test_obj_set_property): + (webkit_dom_test_obj_get_property): + (webkit_dom_test_obj_class_init): + * bindings/scripts/test/GObject/WebKitDOMTestObj.h: + * bindings/scripts/test/JS/JSTestObj.cpp: + (WebCore::jsTestObjCreate): + (WebCore::setJSTestObjCreate): + * bindings/scripts/test/ObjC/DOMTestObj.h: + * bindings/scripts/test/ObjC/DOMTestObj.mm: + (-[DOMTestObj CREATE]): + (-[DOMTestObj setCREATE:]): + * bindings/scripts/test/TestObj.idl: + * bindings/scripts/test/V8/V8TestObj.cpp: + (WebCore::TestObjInternal::CREATEAttrGetter): + (WebCore::TestObjInternal::CREATEAttrSetter): + +2010-07-30 Kinuko Yasuda <kinuko@chromium.org> + + Reviewed by Dumitru Daniliuc. + + Add idl and mock implementation for HTML5 FileSystem API + https://bugs.webkit.org/show_bug.cgi?id=43134 + + Add idl for: FileSystem (as DOMFileSystem), Entry, Flags, Metadata, + FileSystemCallback, EntryCallback and ErrorCallback. + http://dev.w3.org/2009/dap/file-system/file-dir-sys.html + + They are added only for Mac and chromium. + + Tests will be added when we expose the entry point and add implementation. + + * DerivedSources.make: + * WebCore.gypi: + * WebCore.xcodeproj/project.pbxproj: + + * storage/DOMFileSystem.cpp: Added. + * storage/DOMFileSystem.h: Added. + * storage/DOMFileSystem.idl: Added. + * storage/Entry.cpp: Added. + * storage/Entry.h: Added. + * storage/Entry.idl: Added. + * storage/EntryCallback.h: Added. + * storage/EntryCallback.idl: Added. + * storage/ErrorCallback.h: Added. + * storage/ErrorCallback.idl: Added. + * storage/FileSystemCallback.h: Added. + * storage/FileSystemCallback.idl: Added. + * storage/Flags.h: Added. + * storage/Flags.idl: Added. + * storage/Metadata.h: Added. + * storage/Metadata.idl: Added. + * storage/MetadataCallback.h: Added. + * storage/MetadataCallback.idl: Added. + + * bindings/scripts/CodeGenerator.pm: Added special case handlings for generating setter/getter names for CREATE/EXCLUSIVE attributes in Flags.idl. + + * bindings/scripts/test/TestObj.idl: Updated. + * bindings/scripts/test/CPP/WebDOMTestObj.cpp: Updated. + * bindings/scripts/test/CPP/WebDOMTestObj.cpp: Updated. + * bindings/scripts/test/CPP/WebDOMTestObj.h: Updated. + * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: Updated. + * bindings/scripts/test/GObject/WebKitDOMTestObj.h: Updated. + * bindings/scripts/test/JS/JSTestObj.cpp: Updated. + * bindings/scripts/test/JS/JSTestObj.h: Updated. + * bindings/scripts/test/ObjC/DOMTestObj.h: Updated. + * bindings/scripts/test/ObjC/DOMTestObj.mm: Updated. + +2010-07-30 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r64408. + http://trac.webkit.org/changeset/64408 + https://bugs.webkit.org/show_bug.cgi?id=43292 + + Causing failed tests on Chromium canaries due to wrong history + item counts (Requested by atwilson on #webkit). + + * loader/RedirectScheduler.cpp: + (WebCore::RedirectScheduler::scheduleRedirect): + (WebCore::RedirectScheduler::mustLockBackForwardList): + (WebCore::RedirectScheduler::scheduleLocationChange): + (WebCore::RedirectScheduler::scheduleFormSubmission): + * loader/RedirectScheduler.h: + +2010-07-30 Dan Bernstein <mitz@apple.com> + + Reviewed by Darin Adler. + + <rdar://problem/8257783> Short documents may print a second blank page + https://bugs.webkit.org/show_bug.cgi?id=43271 + + Test: printing/stretch-to-view-height.html + + * WebCore.exp.in: Export Frame::forceLayoutForPagination(), replacing forceLayoutWithPageWidthRange(). + * page/Frame.cpp: + (WebCore::Frame::setPrinting): Now takes a page width and height and a maximum shrink factor and passes + them down to forceLayoutForPagination(). + * page/Frame.h: + (WebCore::Frame::): + * page/FrameView.cpp: + (WebCore::FrameView::reset): Initialize m_pageHeight. + (WebCore::FrameView::forceLayoutForPagination): Renamed forceLayoutWithPageWidthRange() to this and + changed it to take a page width and height and a maximum shrink factor. Sets m_pageHeight, which is + queried by RenderBox::calcHeight() during layout. If the given pageHeight is 0, m_pageHeight is set + to the visible height, retaining the behavior before this change. + * page/FrameView.h: + (WebCore::FrameView::pageHeight): Added this accessor. + * page/PrintContext.cpp: + (WebCore::PrintContext::begin): Added a height parameter, used when calling setPrinting(). + (WebCore::PrintContext::end): Updated for setPrinting() changes. + (WebCore::PrintContext::pageNumberForElement): Account for shrink-to-fit. + (WebCore::PrintContext::pageProperty): Pass 0 for the height, retaining current behavior. + (WebCore::PrintContext::numberOfPages): Account for shrink-to-fit. + (WebCore::PrintContext::spoolAllPagesWithBoundaries): Pass the page width to begin(). + * page/PrintContext.h: + * rendering/RenderBox.cpp: + (WebCore::RenderBox::calcHeight): When printing, use FrameView::pageHeight() as the basis for + viewport-relative heights. + +2010-07-30 Mihai Parparita <mihaip@chromium.org> + + Reviewed by Darin Fisher. + + Session history should skip over JS redirects + https://bugs.webkit.org/show_bug.cgi?id=42861 + + Lock the back/forward list for location changes that happen before the + onload event fires that are not the result of user gestures. + + Test: fast/history/gesture-before-onload.html and updated expectations + for http/tests/history tests that used to fail. + + * loader/RedirectScheduler.cpp: + (WebCore::RedirectScheduler::scheduleRedirect): + (WebCore::RedirectScheduler::mustLockBackForwardList): + (WebCore::RedirectScheduler::scheduleLocationChange): + (WebCore::RedirectScheduler::scheduleFormSubmission): + * loader/RedirectScheduler.h: + +2010-07-30 Matthew Delaney <mdelaney@apple.com> + + Reviewed by Darin Adler. + + ctx.clearRect improperly clears shadow + https://bugs.webkit.org/show_bug.cgi?id=43213 + + Tests: canvas/philip/tests/2d.clearRect+fillRect.alpha0.5.html + canvas/philip/tests/2d.clearRect+fillRect.alpha0.html + canvas/philip/tests/2d.clearRect+fillRect.basic.html + + * html/canvas/CanvasRenderingContext2D.cpp: + (WebCore::CanvasRenderingContext2D::setAllAttributesToDefault): + Added a new method to wipe out all context attributes to their defaults. + (WebCore::CanvasRenderingContext2D::clearRect): + Updated clearRect to ignore shadow, alpha, and global composite attributes + when clearing the input rect to match the canvas spec. + * html/canvas/CanvasRenderingContext2D.h: + +2010-07-30 Kinuko Yasuda <kinuko@chromium.org> + + Reviewed by Jian Li. + + Decouple FileThread from FileStream to support generic file-related async tasks + https://bugs.webkit.org/show_bug.cgi?id=43135 + + No new tests as this doesn't change any functionality. + + * html/FileThread.cpp: + (WebCore::FileThread::stop): + (WebCore::SameInstancePredicate::SameFilePredicate): + (WebCore::SameInstancePredicate::operator()): + (WebCore::FileThread::unscheduleTasksInternal): + * html/FileThread.h: + (WebCore::FileThread::create): + (WebCore::FileThread::Task::instance): + (WebCore::FileThread::Task::Task): + * html/FileThreadTask.h: Changed all templates to take any type as a callee instance. + (WebCore::createFileThreadTask): + +2010-07-30 Darin Fisher <darin@chromium.org> + + Reviewed by Darin Adler. + + Eliminate BackForwardList::pushStateItem + https://bugs.webkit.org/show_bug.cgi?id=43282 + + The layout test was previously disabled because of the assertion being + hit in BackForwardList::pushStateItem. That assertion revealed the need + for this patch. + + Test: fast/loader/stateobjects/pushstate-in-iframe.html + + * history/BackForwardList.h: + * history/BackForwardListChromium.cpp: + * history/BackForwardListImpl.cpp: + * history/BackForwardListImpl.h: + + * loader/HistoryController.cpp: Move the logic, of adding a null state + object to the HistoryItem that was previously the current HistoryItem, to + HistoryController::pushState from BackForwardList::pushStateItem. The + BackForwardList was the wrong place for that logic since it lacked convenient + access to the target HistoryItem. It is just given the top-most HistoryItem + corresponding to the new navigation. + + (WebCore::HistoryController::updateBackForwardListClippedAtTarget): + (WebCore::HistoryController::pushState): + +2010-07-30 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Simon Fraser. + + Enabling view modes to all platforms + https://bugs.webkit.org/show_bug.cgi?id=37505 + + View mode media feature implementation as specified in http://www.w3.org/TR/view-mode. + + The view mode media feature layout tests are stil skipped for all platforms except Qt + because of the lack of support of LayoutTestController in those platforms. + + Test: fast/media/view-mode-media-feature.html + + * css/MediaFeatureNames.h: + * css/MediaQueryEvaluator.cpp: + (WebCore::view_modeMediaFeatureEval): + * page/ChromeClient.h: + * page/Page.cpp: + (WebCore::Page::Page): + (WebCore::createViewModesSet): + (WebCore::Page::setViewMode): + * page/Page.h: + (WebCore::Page::viewMode): + +2010-07-30 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by David Kilzer. + + Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas) + https://bugs.webkit.org/show_bug.cgi?id=40627 + + Part 4 - Client Notification when the Quota is Reached + + Notify the WebKit client when the per-origin quota is reached + via a delegate method reachedApplicationCacheOriginQuota. + + Call the delegate method when the quota is reached. + + * loader/appcache/ApplicationCacheGroup.cpp: + (WebCore::ApplicationCacheGroup::ApplicationCacheGroup): + (WebCore::ApplicationCacheGroup::didFinishLoading): + (WebCore::ApplicationCacheGroup::didReachOriginQuota): + (WebCore::ApplicationCacheGroup::cacheUpdateFailedDueToOriginQuota): + (WebCore::ApplicationCacheGroup::checkIfLoadIsComplete): + (WebCore::ApplicationCacheGroup::scheduleReachedOriginQuotaCallback): + * loader/appcache/ApplicationCacheGroup.h: + + Some minor refactoring to access more quota information + without repeating code. Such as origin usage, and creating + an origin record. + + * loader/appcache/ApplicationCacheStorage.cpp: + (WebCore::ApplicationCacheStorage::usageForOrigin): + (WebCore::ApplicationCacheStorage::storeUpdatedQuotaForOrigin): + (WebCore::ApplicationCacheStorage::store): + (WebCore::ApplicationCacheStorage::ensureOriginRecord): + * loader/appcache/ApplicationCacheStorage.h: + + Boilerplate. Exports and definition of the delegate method. + + * WebCore.OfflineWebApplications.exp: + * loader/EmptyClients.h: + (WebCore::EmptyChromeClient::reachedApplicationCacheOriginQuota): + * page/ChromeClient.h: + +2010-07-30 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by David Kilzer. + + Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas) + https://bugs.webkit.org/show_bug.cgi?id=40627 + + Part 3 - Refactor storeNewestCache to allow Failure Reason Output + + Storing can result in an error in a number of reasons. Previously + the reasons were global and binary and could be determined by + checking ApplicationCacheStorage state. Now, with per-origin quotas + a per-origin quota can cause a failure that is not in global state. + Current failure reasons are: + + OriginQuotaReached = per-origin quota reached, no storage is allowed. + TotalQuotaReached = database quota reached, no storage is allowed. + DiskOrOperationFailure = SQL error such as failed prepare or query. Not expected to happen. + + This part provides an implementation of storeNewestCache for those + that care about the failure reason, and not just if it succeeded + or not. This moves the final origin quota check into the transaction. + + * loader/appcache/ApplicationCache.h: style fix for forwarding headers. + * loader/appcache/ApplicationCacheGroup.cpp: + (WebCore::ApplicationCacheGroup::checkIfLoadIsComplete): move origin quota check into storeNewestCache's SQL transaction. + * loader/appcache/ApplicationCacheStorage.cpp: + (WebCore::ApplicationCacheStorage::storeNewestCache): old implementation calls the new implementation ignoring failure reason. + (WebCore::ApplicationCacheStorage::storeNewestCache): new implementation provides a failure reason in case of failure. + * loader/appcache/ApplicationCacheStorage.h: + (WebCore::ApplicationCacheStorage::): added FailureReason enum and storeNewestCache allowing it. + +2010-07-30 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by David Kilzer. + + Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas) + https://bugs.webkit.org/show_bug.cgi?id=40627 + + Part 2 - Update Schema and enforce Per-Origin Quotas + + Added an "Origins" table to the application cache databases. + This, like the Database's Origins table, is a list of origin + and quota pairs. Origins records are added as soon as they are + needed, and deleted only when the ApplicationCacheStorage is + emptied. This means Origins records persist even after all + caches for that origin may be deleted. The "CacheGroups" table + now has a foreign key column "origin" which relates to the + "Origins" table. + + To enforce the quotas, remaining quota space is checked at + the start of update as an estimate and at the end before + inserting. Currently, reaching the quota limit will simply + cause an update error. A later part will provide a + notification to the client to allow an action, and refactor + the final quota limit check into a transaction. + + Respect the quota during the update process. And cause + the update process to fail when the quota is reached. + + * loader/appcache/ApplicationCacheGroup.cpp: added loading counter, counts bytes as they load + (WebCore::ApplicationCacheGroup::ApplicationCacheGroup): + (WebCore::ApplicationCacheGroup::didReceiveData): + (WebCore::ApplicationCacheGroup::didFinishLoading): + (WebCore::ApplicationCacheGroup::checkIfLoadIsComplete): + * loader/appcache/ApplicationCacheGroup.h: added security origin, based on the manifest URL + (WebCore::ApplicationCacheGroup::origin): accessor + + Updates the schema of the database tables as described + above. Handle other SQL operations such as checking the + remaining space and inserting and deleting Origins records. + + * loader/appcache/ApplicationCacheStorage.cpp: + (WebCore::ApplicationCacheStorage::quotaForOrigin): query for the quota of an origin, may return the default origin quota if it didn't exist. + (WebCore::ApplicationCacheStorage::remainingSizeForOriginExcludingCache): calculate the remaining size in a quota for an origin, possibly excluding a cache. + (WebCore::ApplicationCacheStorage::storeUpdatedQuotaForOrigin): persistent update. + (WebCore::ApplicationCacheStorage::openDatabase): updated schema for CachesGroups, added new table Origins. + (WebCore::ApplicationCacheStorage::empty): wipe Origins table as well. + (WebCore::ApplicationCacheStorage::unknownQuota): constant to mean unknown quota + +2010-07-30 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by David Kilzer. + + Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas) + https://bugs.webkit.org/show_bug.cgi?id=40627 + + Part 1 - Add Total and Per-Origin Quota Preferences. + + Allow the application cache total size to be a preference, and + add a new preference for the default per-origin quota. + + Handle the per-origin quota in the global cacheStorage() object. + The per-origin quota will be used in a later part, this just + handles interaction with it from a client. + + * loader/appcache/ApplicationCacheStorage.cpp: + (WebCore::ApplicationCacheStorage::setDefaultOriginQuota): setter + (WebCore::ApplicationCacheStorage::ApplicationCacheStorage): default to "noQuota" on construction + * loader/appcache/ApplicationCacheStorage.h: + (WebCore::ApplicationCacheStorage::noQuota): constant to mean unlimited storage + (WebCore::ApplicationCacheStorage::defaultOriginQuota): accessor + + Move around some exports around for Offline Web Applications. + + * WebCore.exp.in: Added OFFLINE_WEB_APPLICATIONS exports. + +2010-07-30 Andy Estes <aestes@apple.com> + + Reviewed by David Kilzer. + + Add Xcode support for compiling WebKit against iOS SDKs. + https://bugs.webkit.org/show_bug.cgi?id=42796 + + * Configurations/Base.xcconfig: + * Configurations/DebugRelease.xcconfig: + * Configurations/FeatureDefines.xcconfig: + * Configurations/Version.xcconfig: + * Configurations/WebCore.xcconfig: + +2010-07-30 James Robinson <jamesr@chromium.org> + + Compile fix: fix a typo in forward declaration, add EmptyClients impl. + + * loader/EmptyClients.h: + (WebCore::EmptyChromeClient::getOnscreenGLES2Context): + (WebCore::EmptyChromeClient::getOffscreenGLES2Context): + * page/ChromeClient.h: + +2010-07-30 James Robinson <jamesr@chromium.org> + + Reviewed by Darin Fisher. + + Move GLES2 context manipulation to ChromeClient.h and put it behind the right #if guard + https://bugs.webkit.org/show_bug.cgi?id=43281 + + These calls were initially put in ChromeClientChromium, but they aren't chromium specific. + In theory any port that could create the proper OpenGL ES 2 contexts could implement + these functions. Also moves the calls to be behind the correct #if guard. + + * page/ChromeClient.h: + * page/chromium/ChromeClientChromium.h: + +2010-07-30 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by David Levin. + + Interrupt all DB operations when the worker is terminating. + https://bugs.webkit.org/show_bug.cgi?id=42843 + + Tests: fast/workers/storage/interrupt-database-sync.html + fast/workers/storage/interrupt-database.html + + * bindings/js/JSCustomVoidCallback.cpp: + (WebCore::JSCustomVoidCallback::~JSCustomVoidCallback): If the + destructor is called on the context thread, delete m_data directly + instead of posting a task to do that. We need to do that to make + sure that all JS objects are destroyed before + WorkerThreadShutdownFinishTask (in WorkerThread.cpp) calls + WorkerContext::clearScript(). + + * bindings/scripts/CodeGeneratorJS.pm: Same change as above, for + all auto-generated callbacks. + + * bindings/scripts/test/JS/JSTestCallback.cpp: + (WebCore::JSTestCallback::~JSTestCallback): Updated the + expectations for run-bindings-tests. + + * platform/sql/SQLiteDatabase.cpp: Added the ability to interrupt + all DB operations in progress, unless the database was closed or + is being closed. Unlike sqlite3_interrupt(), + SQLiteDatabase::interrupt() is sticky: once it's called, trying to + run any statement on that database will fail with a + SQLITE_INTERRUPT error code. + (WebCore::SQLiteDatabase::SQLiteDatabase): + (WebCore::SQLiteDatabase::close): + (WebCore::SQLiteDatabase::interrupt): + (WebCore::SQLiteDatabase::isInterrupted): + + * platform/sql/SQLiteDatabase.h: Added a mutex that can used by + SQLiteStatement to check if the database was interrupted. + (WebCore::SQLiteDatabase::databaseMutex): + + * platform/sql/SQLiteStatement.cpp: Changed prepare() and step() + to check if the database was interrupted, before trying to prepare + or run the statement. The other methods don't need to hold on to + the DB lock while running, because they're fast, so we don't need + to interrupt them. + (WebCore::SQLiteStatement::prepare): + (WebCore::SQLiteStatement::step): + + * storage/AbstractDatabase.cpp: Made SQLiteDatabase::interrupt() + and isInterrupted() visible to WebSQLDatabases classes. + (WebCore::AbstractDatabase::interrupt): + (WebCore::AbstractDatabase::isInterrupted): + * storage/AbstractDatabase.h: + + * storage/DatabaseTracker.cpp: Added a method to interrupt all + databases in a given context. + (WebCore::DatabaseTracker::interruptAllDatabasesForContext): + * storage/DatabaseTracker.h: + + * storage/SQLStatement.cpp: Changed the exception/error reported + when a statement is interrupted. + (WebCore::SQLStatement::execute): + * storage/SQLStatementSync.cpp: + (WebCore::SQLStatementSync::execute): + + * storage/SQLTransaction.cpp: Changed the code to release the + callback objects as soon as they're not needed. + (WebCore::SQLTransaction::checkAndHandleClosedOrInterruptedDatabase): + Changed this method to not schedule the next transaction step when + the database is interrupted. + (WebCore::SQLTransaction::performNextStep): + (WebCore::SQLTransaction::performPendingCallback): + (WebCore::SQLTransaction::deliverTransactionCallback): + (WebCore::SQLTransaction::postflightAndCommit): + (WebCore::SQLTransaction::deliverTransactionErrorCallback): + (WebCore::SQLTransaction::cleanupAfterTransactionErrorCallback): + * storage/SQLTransaction.h: + + * storage/chromium/DatabaseTrackerChromium.cpp: Added a method to + interrupt all databases in a given context. + (WebCore::DatabaseTracker::interruptAllDatabasesForContext): + + * workers/WorkerThread.cpp: + (WebCore::WorkerThread::stop): Added a call to + DatabaseTracker::interruptAllDatabasesForContext(). + +2010-07-30 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Darin Adler. + + connect-compositing-iframe2.html test sometimes shows blank iframe content + https://bugs.webkit.org/show_bug.cgi?id=42046 + + Hooking up compositing iframes requires setNeedsStyleRecalc(SyntheticStyleChange) to + always result in a call to RenderLayer::styleChanged(). However, the semantics of + setNeedsStyleRecalc() was that each call would overwrite the existing styleChangeType, + allowing a "lesser" style change to override a "greater" one. In the test content, + SyntheticStyleChange was being replaced by FullStyleChange when the classname changed. + This resulted in RenderLayer::styleChanged() not being called. + + Fix by changing the behavior of setNeedsStyleRecalc() to only touch the style change + type if a "lesser" change is being replaced with a "greater" one. This required adding + a new clearNeedsStyleRecalc() method to reset the style change type to NoStyleChange. + + In addition, in Node::setNeedsStyleRecalc(), only propagate the childNeedsStyleRecalc + up the parent change if the node was not already needing recalc. In order to fix issues + with attaching, this required new call to clearNeedsStyleRecalc() at the end of attach(). + + * manual-tests/compositing/missing-iframe-contents.html: Added. + * manual-tests/compositing/resources/composited-subframe.html: Copied from LayoutTests/compositing/iframes/resources/composited-subframe.html. + + * dom/Document.cpp: + (WebCore::Document::recalcStyle): Call clearNeedsStyleRecalc(). + * dom/Element.cpp: + (WebCore::Element::recalcStyle): Call clearNeedsStyleRecalc(). + + * dom/Node.h: + (WebCore::Node::clearNeedsStyleRecalc): New method. + * dom/Node.cpp: + (WebCore::Node::setNeedsStyleRecalc): Only call setStyleChange() if the change type + is greater than the current change type. + (WebCore::Node::attach): After attaching, we can call clearNeedsStyleRecalc(). + + * dom/Text.cpp: + (WebCore::Text::recalcStyle): Call clearNeedsStyleRecalc(). + * html/HTMLFrameSetElement.cpp: + (WebCore::HTMLFrameSetElement::recalcStyle): Call clearNeedsStyleRecalc(). + +2010-07-30 W. James MacLean <wjmaclean@google.com> + + Reviewed by Nikolas Zimmermann. + + SVG - numeric overflow for very large elements + https://bugs.webkit.org/show_bug.cgi?id=25645 + + Two of the expected test outputs were incorrect now that parsing of large values + is handled correctly. + - Revised FloatRect to remove bad float-to-int conversions in enclosingIntRect() + - Revised _parseNumber to do right-to-left float-based parsing of input value + + Test: svg/custom/massive-coordinates.svg + + * platform/graphics/FloatRect.cpp: + (WebCore::safeFloatToInt): + (WebCore::enclosingIntRect): + * svg/SVGParserUtilities.cpp: + (WebCore::_parseNumber): + +2010-07-30 James Robinson <jamesr@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Make the GLES2 texture map generic and teach ImageSkia and ImageBufferSkia about GLES2 + https://bugs.webkit.org/show_bug.cgi?id=43218 + + This makes the GLES2Canvas' TextureHashMap key on void* instead of NativeImagePtr + to make it easier to use with other backends. It also teaches ImageSkia how + to draw to a GLES2Canvas instead of a skia buffer. + + No change in functionality (yet), no new tests. + + * platform/graphics/chromium/GLES2Canvas.cpp: + (WebCore::GLES2Canvas::GLES2Canvas): + (WebCore::GLES2Canvas::createTexture): + (WebCore::GLES2Canvas::getTexture): + * platform/graphics/chromium/GLES2Canvas.h: + * platform/graphics/skia/ImageBufferSkia.cpp: + (WebCore::ImageBuffer::getUnmultipliedImageData): + (WebCore::ImageBuffer::getPremultipliedImageData): + * platform/graphics/skia/ImageSkia.cpp: + (WebCore::drawBitmapGLES2): + (WebCore::BitmapImage::draw): + (WebCore::BitmapImageSingleFrameSkia::draw): + +2010-07-30 Yong Li <yoli@rim.com> + + Reviewed by Darin Adler. + + Implement SVGScriptElement::shouldExecuteAsJavaScript() otherwise + SVGScriptElement cannot run when XHTMLMP is enabled. + https://bugs.webkit.org/show_bug.cgi?id=43267 + + No test needed, because it fails all SVG <script> tests when XHTMLMP is on. + + * svg/SVGScriptElement.cpp: + (WebCore::SVGScriptElement::shouldExecuteAsJavaScript): + * svg/SVGScriptElement.h: + +2010-07-30 Chris Fleizach <cfleizach@apple.com> + + Reviewed by Darin Adler. + + Style errors in Navigator.h + https://bugs.webkit.org/show_bug.cgi?id=43262 + + Fixing style changes. No new tests. + + * page/Navigator.h: + (WebCore::Navigator::create): + (WebCore::Navigator::frame): + (WebCore::Navigator::optionalGeolocation): + +2010-07-27 Darin Fisher <darin@chromium.org> + + Reviewed by Brady Eidson. + + History.pushState() + navigation operates on top frame when called from + nested context + https://bugs.webkit.org/show_bug.cgi?id=43080 + + Test: fast/loader/stateobjects/pushstate-in-iframe.html + + * loader/HistoryController.cpp: + (WebCore::HistoryController::pushState): createTreeItem should be + called on the top-most HistoryController so that we properly clone + the HistoryItem tree starting at the root node. + +2010-07-30 fsamuel@chromium.org <fsamuel@chromium.org> + + Reviewed by Dimitri Glazkov. + + Expand SVG Attribute Macros + https://bugs.webkit.org/show_bug.cgi?id=43254 + + Expanded SVG Attribute Macros to reduce debugging headache. + + No change in behavior, so no new tests. + + * rendering/style/SVGRenderStyle.h: Expanded and removed references to SVG_RS_DEFINE_ATTRIBUTE* macros. + * rendering/style/SVGRenderStyleDefs.h: Removed definitons for expanded macros. + +2010-07-30 Kinuko Yasuda <kinuko@chromium.org> + + Reviewed by Dumitru Daniliuc. + + Add callback arguments support to binding code generator scripts + https://bugs.webkit.org/show_bug.cgi?id=43130 + + Tests: bindings/scripts/test/TestObj.idl + + * bindings/scripts/CodeGeneratorJS.pm: + * bindings/scripts/CodeGeneratorV8.pm: + + * bindings/scripts/test/JS/JSTestObj.cpp: + (WebCore::jsTestObjPrototypeFunctionMethodWithCallbackArg): + (WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg): + (WebCore::jsTestObjPrototypeFunctionMethodWithCallbackAndOptionalArg): + * bindings/scripts/test/JS/JSTestObj.h: + * bindings/scripts/test/TestObj.idl: + * bindings/scripts/test/V8/V8TestObj.cpp: + (WebCore::TestObjInternal::methodWithCallbackArgCallback): + (WebCore::TestObjInternal::methodWithNonCallbackArgAndCallbackArgCallback): + (WebCore::TestObjInternal::methodWithCallbackAndOptionalArgCallback): + (WebCore::ConfigureV8TestObjTemplate): + +2010-07-30 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Implement NPN_InvokeDefault + https://bugs.webkit.org/show_bug.cgi?id=43266 + + * bindings/js/JSPluginElementFunctions.cpp: + (WebCore::isPluginElement): + Add convenience function. + + (WebCore::pluginInstance): + Call isPluginElement. + + (WebCore::pluginScriptObjectFromPluginViewBase): + Given an JSHTMLElement, ask the PluginViewBase for the scriptable object. + + (WebCore::pluginScriptObject): + Call isPluginElement. Call pluginScriptObjectFromPluginViewBase. + + (WebCore::callPlugin): + Get the script object, assemble the arguments and call "call" directly. + + (WebCore::runtimeObjectGetCallData): + Try to get the script object from the PluginViewBase first. + + * plugins/PluginViewBase.h: + (WebCore::PluginViewBase::scriptObject): + Remove ExecState parameter. + +2010-07-30 Adam Roben <aroben@apple.com> + + Roll our r64361 and r64363 + + We can't make these changes until QuartzCore.lib is included in + WebKitSupportLibrary. + +2010-07-30 Adam Roben <aroben@apple.com> + + Remove uses of CACFContextRef and CARender* from WebCore + + These types are now wrapped in a WKCACFContext type exported by + WebKitSystemInterface. + + Fixes <http://webkit.org/b/43244>. + + Reviewed by Sam Weinig. + + * platform/graphics/win/WKCACFContextFlusher.cpp: + (WebCore::WKCACFContextFlusher::addContext): + (WebCore::WKCACFContextFlusher::removeContext): + (WebCore::WKCACFContextFlusher::flushAllContexts): + * platform/graphics/win/WKCACFContextFlusher.h: + Changed to use WKCACFContext. We don't retain/release the context when + putting it into/taking it out of the set. WKCACFContext is not a + ref-counted type, so we can't retain/release it, but the + retain/release was also unnecessary as WKCACFLayerRenderer calls + removeContext before the context is destroyed. + + * platform/graphics/win/WKCACFLayer.cpp: + (WebCore::WKCACFLayer::becomeRootLayerForContext): + * platform/graphics/win/WKCACFLayer.h: + Changed to use WKCACFContext. + + * platform/graphics/win/WKCACFLayerRenderer.cpp: + (WebCore::WKCACFLayerRenderer::didFlushContext): + (WebCore::WKCACFLayerRenderer::WKCACFLayerRenderer): + (WebCore::WKCACFLayerRenderer::~WKCACFLayerRenderer): + (WebCore::WKCACFLayerRenderer::layerTreeDidChange): + (WebCore::WKCACFLayerRenderer::createRenderer): + (WebCore::WKCACFLayerRenderer::destroyRenderer): + (WebCore::WKCACFLayerRenderer::render): Also replaced uses of + CGSRegion with WebKitSystemInterface functions/types. + (WebCore::WKCACFLayerRenderer::resetDevice): + * platform/graphics/win/WKCACFLayerRenderer.h: + Replaced our CACFContextRef, CARenderContext, and CARenderOGLContext + with a single WKCACFContext, which wraps all three. We hold a bare + pointer to it and destroy it in our destructor. + +2010-07-30 Adam Roben <aroben@apple.com> + + Remove knowledge of WKCACFContextFlusher from WKCACFLayer + + Fixes <http://webkit.org/b/43248> WKCACFLayer shouldn't know about + WKCACFContextFlusher + + Reviewed by Sam Weinig. + + * platform/graphics/win/WKCACFLayer.cpp: + (WebCore::WKCACFLayer::setNeedsCommit): Don't bother calling to + WKCACFContextFlusher. Our root layer will do this for us. + + * platform/graphics/win/WKCACFLayerRenderer.cpp: + (WebCore::WKCACFRootLayer::setNeedsRender): Changed to call the new + layerTreeDidChange function. + (WebCore::WKCACFLayerRenderer::layerTreeDidChange): Added. Tells + WKCACFContextFlusher that the context has changed, and schedules a + render. + + * platform/graphics/win/WKCACFLayerRenderer.h: Added + layerTreeDidChange. + +2010-07-29 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Steve Block. + + Rename all the IDBIndex classses to match the latest conventions + https://bugs.webkit.org/show_bug.cgi?id=43190 + + No functionality has changed. + + IDBIndexRequest -> IDBIndex in the spec. So that's the first change. + IDBIndex was the name of our interface class though, so we need to rename + it to get it out of the way. While we're at it, we might as well clean + up the naming in general to make things more clear. In the future, we're + going to need another layer (yes, yuck) which will be shared by the async + and sync classes which will do caching and other optimizations. That will + then connect to the backend. We also added "Interface" to make it more + clear that's what the file/class is. + + Existing layout tests are enough since nothing should change as far as JavaScript can see. + + * Android.derived.jscbindings.mk: + * Android.derived.v8bindings.mk: + * Android.mk: + * CMakeLists.txt: + * DerivedSources.cpp: + * DerivedSources.make: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pri: + * WebCore.pro: + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/JSIDBAnyCustom.cpp: + (WebCore::toJS): + * bindings/v8/custom/V8IDBAnyCustom.cpp: + (WebCore::toV8): + * storage/IDBAny.cpp: + (WebCore::IDBAny::idbIndex): + (WebCore::IDBAny::set): + * storage/IDBAny.h: + (WebCore::IDBAny::): + * storage/IDBCallbacks.h: + * storage/IDBIndex.cpp: Added. + (WebCore::IDBIndex::IDBIndex): + (WebCore::IDBIndex::~IDBIndex): + * storage/IDBIndex.h: + (WebCore::IDBIndex::create): + (WebCore::IDBIndex::name): + (WebCore::IDBIndex::keyPath): + (WebCore::IDBIndex::unique): + * storage/IDBIndex.idl: Added. + * storage/IDBIndexBackendImpl.cpp: Added. + (WebCore::IDBIndexBackendImpl::IDBIndexBackendImpl): + (WebCore::IDBIndexBackendImpl::~IDBIndexBackendImpl): + * storage/IDBIndexBackendImpl.h: Added. + (WebCore::IDBIndexBackendImpl::create): + (WebCore::IDBIndexBackendImpl::name): + (WebCore::IDBIndexBackendImpl::keyPath): + (WebCore::IDBIndexBackendImpl::unique): + * storage/IDBIndexBackendInterface.h: Added. + (WebCore::IDBIndexBackendInterface::~IDBIndexBackendInterface): + * storage/IDBIndexImpl.cpp: Removed. + * storage/IDBIndexImpl.h: Removed. + * storage/IDBIndexRequest.cpp: Removed. + * storage/IDBIndexRequest.h: Removed. + * storage/IDBIndexRequest.idl: Removed. + * storage/IDBObjectStore.h: + * storage/IDBObjectStoreImpl.cpp: + (WebCore::IDBObjectStoreImpl::createIndex): + (WebCore::IDBObjectStoreImpl::index): + * storage/IDBObjectStoreImpl.h: + * storage/IDBObjectStoreRequest.cpp: + (WebCore::IDBObjectStoreRequest::index): + * storage/IDBObjectStoreRequest.h: + * storage/IDBObjectStoreRequest.idl: + * storage/IDBRequest.cpp: + (WebCore::IDBRequest::onSuccess): + * storage/IDBRequest.h: + +2010-07-30 Rafael Antognolli <antognolli@profusion.mobi> + + Reviewed by Antonio Gomes. + + [EFL] Add library version and soname to EFL generated libraries and binary. + https://bugs.webkit.org/show_bug.cgi?id=43212 + + Add version and soname to libwebcore.so in case of linking as shared + library. + + No new feature, so no new tests. + + * CMakeLists.txt: + +2010-07-30 Steve Block <steveblock@google.com> + + Reviewed by Steve Block. + + Add LayoutTestController methods to test DeviceOrientation + https://bugs.webkit.org/show_bug.cgi?id=39589 + + This patch does not hook up the new LayoutTestController method to WebKit + for any platform. This will be done in later patches. + https://bugs.webkit.org/show_bug.cgi?id=43181 tracks this for Mac. + + Test: fast/dom/DeviceOrientation/basic-operation.html + + * Android.mk: + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.exp.in: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * dom/DeviceOrientationClient.h: + (WebCore::DeviceOrientationClient::~DeviceOrientationClient): + * dom/DeviceOrientationController.cpp: + (WebCore::DeviceOrientationController::DeviceOrientationController): + * dom/DeviceOrientationEvent.cpp: + * platform/mock/DeviceOrientationClientMock.cpp: Added. + (WebCore::DeviceOrientationClientMock::DeviceOrientationClientMock): + (WebCore::DeviceOrientationClientMock::setController): + (WebCore::DeviceOrientationClientMock::startUpdating): + (WebCore::DeviceOrientationClientMock::stopUpdating): + (WebCore::DeviceOrientationClientMock::setOrientation): + (WebCore::DeviceOrientationClientMock::timerFired): + * platform/mock/DeviceOrientationClientMock.h: Added. + (WebCore::DeviceOrientationClientMock::lastOrientation): + +2010-07-30 Satish Sampath <satish@chromium.org> + + Reviewed by Jeremy Orlow. + + Add a mock in WebCore for testing speech input + https://bugs.webkit.org/show_bug.cgi?id=42603 + + Layout tests will be added in a subsequent patch using this mock. + + * Android.mk: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * platform/mock/SpeechInputClientMock.cpp: Added. + (WebCore::SpeechInputClientMock::SpeechInputClientMock): + (WebCore::SpeechInputClientMock::startRecognition): + (WebCore::SpeechInputClientMock::stopRecording): + (WebCore::SpeechInputClientMock::cancelRecognition): + (WebCore::SpeechInputClientMock::setRecognitionResult): + (WebCore::SpeechInputClientMock::timerFired): + * platform/mock/SpeechInputClientMock.h: Added. + +2010-07-30 Nikolas Zimmermann <nzimmermann@rim.com> + + Reviewed by Dirk Schulze. + + Optimize SVGResources memory usage + https://bugs.webkit.org/show_bug.cgi?id=43236 + + Instead of storing pointers to all possible resources that could be applied to an element, group them in three categories: + clipper/filter/masker, marker-start/marker-mid/marker-end, and fill/stroke. + + Only build the cached resources data for elements where the properties can be applied to. Maintain a static list of tagnames + for each of the three categories, to avoid doing unncessary work. + + Doesn't affect any tests. + + * rendering/SVGResources.cpp: + (WebCore::SVGResources::SVGResources): + (WebCore::clipperFilterMaskerTags): + (WebCore::markerTags): + (WebCore::fillAndStrokeTags): + (WebCore::SVGResources::buildCachedResources): + (WebCore::SVGResources::invalidateClient): + (WebCore::SVGResources::resourceDestroyed): + (WebCore::SVGResources::buildSetOfResources): + (WebCore::SVGResources::setClipper): + (WebCore::SVGResources::resetClipper): + (WebCore::SVGResources::setFilter): + (WebCore::SVGResources::resetFilter): + (WebCore::SVGResources::setMarkerStart): + (WebCore::SVGResources::resetMarkerStart): + (WebCore::SVGResources::setMarkerMid): + (WebCore::SVGResources::resetMarkerMid): + (WebCore::SVGResources::setMarkerEnd): + (WebCore::SVGResources::resetMarkerEnd): + (WebCore::SVGResources::setMasker): + (WebCore::SVGResources::resetMasker): + (WebCore::SVGResources::setFill): + (WebCore::SVGResources::resetFill): + (WebCore::SVGResources::setStroke): + (WebCore::SVGResources::resetStroke): + (WebCore::SVGResources::dump): + * rendering/SVGResources.h: + (WebCore::SVGResources::clipper): + (WebCore::SVGResources::filter): + (WebCore::SVGResources::markerStart): + (WebCore::SVGResources::markerMid): + (WebCore::SVGResources::markerEnd): + (WebCore::SVGResources::masker): + (WebCore::SVGResources::fill): + (WebCore::SVGResources::stroke): + (WebCore::SVGResources::ClipperFilterMaskerData::ClipperFilterMaskerData): + (WebCore::SVGResources::ClipperFilterMaskerData::create): + (WebCore::SVGResources::MarkerData::MarkerData): + (WebCore::SVGResources::MarkerData::create): + (WebCore::SVGResources::FillStrokeData::FillStrokeData): + (WebCore::SVGResources::FillStrokeData::create): + +2010-07-26 Andrei Popescu <andreip@google.com> + + Reviewed by Jeremy Orlow. + + [IndexedDB] IndexedDatabase should be called IDBFactory. + https://bugs.webkit.org/show_bug.cgi?id=42967 + + Rename IndexedDatabase to IDBFactory to match the specification. + + Also implement the following new naming convention: + IDBFoo IDL interfaces are implemented using IDBFoo C++ classes. + IDBFoo objects have pointers to IDBFooBackendInterface objects. + IDBFooBackendInterface is implemented by IDBFooBackendImpl and + IDBFooBackendProxy (for Chromium). + + No new tests needed, just renaming. + + * Android.derived.jscbindings.mk: + * Android.derived.v8bindings.mk: + * Android.mk: + * CMakeLists.txt: + * DerivedSources.cpp: + * DerivedSources.make: + * GNUmakefile.am: + * WebCore.gyp/WebCore.gyp: + * WebCore.gypi: + * WebCore.pri: + * WebCore.pro: + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/JSIDBAnyCustom.cpp: + (WebCore::toJS): + * bindings/v8/custom/V8IDBAnyCustom.cpp: + (WebCore::toV8): + * page/DOMWindow.cpp: + (WebCore::DOMWindow::clear): + (WebCore::DOMWindow::indexedDB): + * page/DOMWindow.h: + * page/DOMWindow.idl: + * page/PageGroup.cpp: + (WebCore::PageGroup::idbFactory): + * page/PageGroup.h: + * platform/chromium/ChromiumBridge.h: + * storage/IDBAny.cpp: + (WebCore::IDBAny::idbFactory): + (WebCore::IDBAny::set): + * storage/IDBAny.h: + (WebCore::IDBAny::): + * storage/IDBDatabaseRequest.cpp: + * storage/IDBFactory.cpp: Added. + (WebCore::IDBFactory::IDBFactory): + (WebCore::IDBFactory::~IDBFactory): + (WebCore::IDBFactory::open): + * storage/IDBFactory.h: Added. + (WebCore::IDBFactory::create): + * storage/IDBFactory.idl: Added. + * storage/IDBFactoryBackendInterface.cpp: Added. + (WebCore::IDBFactoryBackendInterface::create): + * storage/IDBFactoryBackendInterface.h: Added. + (WebCore::IDBFactoryBackendInterface::~IDBFactoryBackendInterface): + * storage/IDBFactoryBackendImpl.cpp: Added. + (WebCore::IDBFactoryBackendImpl::create): + (WebCore::IDBFactoryBackendImpl::IDBFactoryBackendImpl): + (WebCore::IDBFactoryBackendImpl::~IDBFactoryBackendImpl): + (WebCore::IDBFactoryBackendImpl::open): + * storage/IDBFactoryBackendImpl.h: Added. + * storage/IDBKeyRange.cpp: + (WebCore::IDBKeyRange::only): + (WebCore::IDBKeyRange::leftBound): + (WebCore::IDBKeyRange::rightBound): + (WebCore::IDBKeyRange::bound): + * storage/IDBKeyRange.h: + * storage/IDBKeyRange.idl: + * storage/IndexedDatabase.cpp: Removed. + * storage/IndexedDatabase.h: Removed. + * storage/IndexedDatabaseImpl.cpp: Removed. + * storage/IndexedDatabaseImpl.h: Removed. + * storage/IndexedDatabaseRequest.cpp: Removed. + * storage/IndexedDatabaseRequest.h: Removed. + * storage/IndexedDatabaseRequest.idl: Removed. + * storage/chromium/IDBFactoryBackendInterface.cpp: Added. + (WebCore::IDBFactoryBackendInterface::create): + * storage/chromium/IndexedDatabase.cpp: Removed. + +2010-07-29 Alexander Pavlov <apavlov@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: Crash on refresh with a comment selected in the Elements panel + https://bugs.webkit.org/show_bug.cgi?id=43183 + + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::nodeForPath): + * inspector/front-end/ElementsPanel.js: + (WebInspector.ElementsPanel.prototype.reset): + +2010-07-30 Renata Hodovan <reni@inf.u-szeged.hu> + + Reviewed by Nikolas Zimmermann. + + feTurbulence is not implemented. + https://bugs.webkit.org/show_bug.cgi?id=5864 + + This code is based on the previous implementation of + Dirk Schulze, extended with some modification and optimization. + + LayoutTests: Updating expected values for turbulence filter. + svg/W3C-SVG-1.1/filters-turb-01-f.svg + + * svg/SVGFETurbulenceElement.cpp: + (WebCore::SVGFETurbulenceElement::build): + * svg/graphics/filters/SVGFETurbulence.cpp: + (WebCore::FETurbulence::FETurbulence): + (WebCore::FETurbulence::create): + (WebCore::FETurbulence::PaintingData::PaintingData): + (WebCore::FETurbulence::PaintingData::random): + (WebCore::smoothCurve): + (WebCore::linearInterpolation): + (WebCore::FETurbulence::initPaint): + (WebCore::checkNoise): + (WebCore::FETurbulence::noise2D): + (WebCore::Noise::if): + (WebCore::FETurbulence::calculateTurbulenceValueForPoint): + (WebCore::FETurbulence::apply): + * svg/graphics/filters/SVGFETurbulence.h: + (WebCore::): + +2010-07-29 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Dirk Schulze. + + Cairo: Need to implement GraphicsContext::clipConvexPolygon() + https://bugs.webkit.org/show_bug.cgi?id=41308 + + Implement clipConvexPolygon for Cairo ports and enable new path based + borders for that port as well. + + * platform/graphics/cairo/GraphicsContextCairo.cpp: + (WebCore::addConvexPolygonToContext): Add this helper method. + (WebCore::GraphicsContext::drawConvexPolygon): Use the new addConvexPolygonToContext helper. + (WebCore::GraphicsContext::clipConvexPolygon): Implement this method. + * rendering/RenderObject.h: Enable path based borders for Cairo. + +2010-07-29 Ryosuke Niwa <rniwa@webkit.org> + + Reviewed by Darin Adler. + + InsertOrderedList does not switch the list type properly when it has an inner list. + https://bugs.webkit.org/show_bug.cgi?id=43166 + + The bug was caused by forcedCreateList was not set to true when the start and the end + of the selection lies in the same list. Added selectionHasListOfType to fix this problem. + + WebKit used not to convert the outer lists even when the list is fully selected. + Corrected this behavior by converting the entire list at once when the list is fully selected. + To decide whether or not a list is fully selected, added currentSelection argument to doApplyForSingleParagraph. + + Tests: editing/execCommand/switch-list-type-with-inner-list.html + editing/execCommand/switch-list-type-with-orphaned-li.html + + * editing/InsertListCommand.cpp: + (WebCore::InsertListCommand::mergeWithNeighboringLists): Extracted the code to merge lists. + (WebCore::InsertListCommand::selectionHasListOfType): attachment.cgi + (WebCore::InsertListCommand::doApply): Calls selectionHasListOfType. + (WebCore::InsertListCommand::doApplyForSingleParagraph): See above. + (WebCore::InsertListCommand::listifyParagraph): Calls mergeWithNeighboringLists. + * editing/InsertListCommand.h: + * editing/htmlediting.cpp: + (WebCore::canMergeLists): Ensures lists being merged are instances of HTMLElement. + (WebCore::isNodeVisiblyContainedWithin): Works properly when one end is inside the range. + +2010-07-29 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Dirk Schulze. + + [Cairo] Bring behavior of paths on the Cairo GraphicsContext into line with the CoreGraphics port + https://bugs.webkit.org/show_bug.cgi?id=41732 + + Do not apply paths added to the Cairo GraphicsContext, until they are used. + This prevents drawing routines such as fillRect from interacting with any + path which callers are constructing on the GraphicsContext. + + This behavior is necessary to close bug https://bugs.webkit.org/show_bug.cgi?id=41308 + so tests for that issue will test this fix. + + * platform/graphics/cairo/GraphicsContextCairo.cpp: + (WebCore::appendPathToCairoContext): Added. A helper method which adds a path + to a native Cairo context. + (WebCore::setPathOnCairoContext): Added. Like appendPathToCairoContext, but clears the + existing path first. + (WebCore::appendWebCorePathToCairoContext): Added. Like appendPathToCairoContext, but + operates on a WebCore path. + (WebCore::fillCurrentCairoPath): Added. Helper which fills the current cairo context path. + (WebCore::strokeCurrentCairoPath): Added. Helper which strokes the current cairo context path. + (WebCore::GraphicsContext::drawEllipse): Only clear the Cairo path if cairo_stroke + was not called, because cairo_stroke implicitly clears the path. + (WebCore::GraphicsContext::drawConvexPolygon): Ditto. + (WebCore::GraphicsContext::fillPath): Copy the path from m_pendingPath to the context + and clear m_pendingPath, instead of relying on the pre-existing context path. Do the + actual fill via the new helper. + (WebCore::GraphicsContext::strokePath): Ditto. + (WebCore::GraphicsContext::drawPath): Ditto. + (WebCore::GraphicsContext::fillRect): Use the new fillCurrentCairoPath helper. + (WebCore::GraphicsContext::drawFocusRing): Use the new appendWebCorePathToCairoContext helper instead + of addPath (which will blow away any path callers are building). + (WebCore::GraphicsContext::addInnerRoundedRectClip): Use the new appendWebCorePathToCairoContext helper instead + of addPath (which will blow away any path callers are building). + (WebCore::GraphicsContext::strokeRect): Use the new strokeCurrentCairoPath helper. + (WebCore::GraphicsContext::beginPath): Clear out m_pendingPath here instead of the main native context. + (WebCore::GraphicsContext::addPath): Add the path to m_pendingPath instead of the main native context. + Also ensure that the transformation matrix of the m_pendingPath is equal to that of the main + cairo context. + (WebCore::GraphicsContext::clipOut): Use the appendWebCorePathToCairoContext helper here. + (WebCore::GraphicsContext::fillRoundedRect): Ditto and remove an unnecessary beginPath call. + * platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h: Add a new m_pendingPath member. + +2010-07-29 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r64313. + http://trac.webkit.org/changeset/64313 + https://bugs.webkit.org/show_bug.cgi?id=43233 + + Some Chromium bots are not happy with it for some unknown + reason. (Requested by dumi on #webkit). + + * bindings/js/JSCustomVoidCallback.cpp: + (WebCore::JSCustomVoidCallback::~JSCustomVoidCallback): + * bindings/scripts/CodeGeneratorJS.pm: + * bindings/scripts/test/JS/JSTestCallback.cpp: + (WebCore::JSTestCallback::~JSTestCallback): + * platform/sql/SQLiteDatabase.cpp: + (WebCore::SQLiteDatabase::SQLiteDatabase): + (WebCore::SQLiteDatabase::close): + (WebCore::SQLiteDatabase::lock): + (WebCore::SQLiteDatabase::unlock): + * platform/sql/SQLiteDatabase.h: + * platform/sql/SQLiteStatement.cpp: + (WebCore::SQLiteStatement::prepare): + (WebCore::SQLiteStatement::step): + * storage/AbstractDatabase.cpp: + * storage/AbstractDatabase.h: + * storage/DatabaseTracker.cpp: + * storage/DatabaseTracker.h: + * storage/SQLStatement.cpp: + (WebCore::SQLStatement::execute): + * storage/SQLStatementSync.cpp: + (WebCore::SQLStatementSync::execute): + * storage/SQLTransaction.cpp: + (WebCore::SQLTransaction::checkAndHandleClosedDatabase): + (WebCore::SQLTransaction::performNextStep): + (WebCore::SQLTransaction::performPendingCallback): + (WebCore::SQLTransaction::deliverTransactionCallback): + (WebCore::SQLTransaction::postflightAndCommit): + (WebCore::SQLTransaction::deliverTransactionErrorCallback): + (WebCore::SQLTransaction::cleanupAfterTransactionErrorCallback): + * storage/SQLTransaction.h: + * storage/chromium/DatabaseTrackerChromium.cpp: + * workers/WorkerThread.cpp: + (WebCore::WorkerThread::stop): + +2010-07-29 Martin Robinson <mrobinson@igalia.com> + + Unreviewed, rolling out r64318. + http://trac.webkit.org/changeset/64318 + https://bugs.webkit.org/show_bug.cgi?id=41732 + + This change broke many tests. + + * platform/graphics/cairo/GraphicsContextCairo.cpp: + (WebCore::GraphicsContext::drawEllipse): + (WebCore::GraphicsContext::drawConvexPolygon): + (WebCore::GraphicsContext::fillPath): + (WebCore::GraphicsContext::strokePath): + (WebCore::GraphicsContext::drawPath): + (WebCore::GraphicsContext::drawFocusRing): + (WebCore::GraphicsContext::addInnerRoundedRectClip): + (WebCore::GraphicsContext::beginPath): + (WebCore::GraphicsContext::addPath): + (WebCore::GraphicsContext::clipOut): + (WebCore::GraphicsContext::fillRoundedRect): + * platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h: + +2010-07-29 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Dirk Schulze. + + [Cairo] Bring behavior of paths on the Cairo GraphicsContext into line with the CoreGraphics port + https://bugs.webkit.org/show_bug.cgi?id=41732 + + Do not apply paths added to the Cairo GraphicsContext, until they are used. + This prevents drawing routines such as fillRect from interacting with any + path which callers are constructing on the GraphicsContext. + + This behavior is necessary to close bug https://bugs.webkit.org/show_bug.cgi?id=41308 + so tests for that issue will test this fix. + + * platform/graphics/cairo/GraphicsContextCairo.cpp: + (WebCore::appendPathToCairoContext): Added. A helper method which adds a path + to a native Cairo context. + (WebCore::setPathOnCairoContext): Added. Like appendPathToCairoContext, but clears the + existing path first. + (WebCore::appendWebCorePathToCairoContext): Added. Like appendPathToCairoContext, but + operates on a WebCore path. + (WebCore::GraphicsContext::drawEllipse): Only clear the Cairo path if cairo_stroke + was not called, because cairo_stroke implicitly clears the path. + (WebCore::GraphicsContext::drawConvexPolygon): Ditto. + (WebCore::GraphicsContext::fillPath): Copy the path from m_pendingPath to the context + and clear m_pendingPath, instead of relying on the pre-existing context path. + (WebCore::GraphicsContext::strokePath): Ditto. + (WebCore::GraphicsContext::drawPath): Ditto. + (WebCore::GraphicsContext::drawFocusRing): Use the new appendWebCorePathToCairoContext helper instead + of addPath (which will blow away any path callers are building). + (WebCore::GraphicsContext::addInnerRoundedRectClip): Use the new appendWebCorePathToCairoContext helper instead + of addPath (which will blow away any path callers are building). + (WebCore::GraphicsContext::beginPath): Clear out m_pendingPath here instead of the main native context. + (WebCore::GraphicsContext::addPath): Add the path to m_pendingPath instead of the main native context. + Also ensure that the transformation matrix of the m_pendingPath is equal to that of the main + cairo context. + (WebCore::GraphicsContext::clipOut): Use the appendWebCorePathToCairoContext helper here. + (WebCore::GraphicsContext::fillRoundedRect): Ditto and remove an unnecessary beginPath call. + * platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h: Add a new m_pendingPath member. + +2010-07-29 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Dirk Schulze. + + [Cairo] Remove setStrokeStyle workaround for InlineTextBoxes + https://bugs.webkit.org/show_bug.cgi?id=43136 + + Remove workaround added in https://bugs.webkit.org/show_bug.cgi?id=15659 + to fix stroke style for InlineTextBox underlines. + + No new tests as this should not change functionality. + + * platform/graphics/cairo/GraphicsContextCairo.cpp: + (WebCore::GraphicsContext::drawLineForText): Remove old workaround. + +2010-07-28 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by David Levin. + + Interrupt all DB operations when the worker is terminating. + https://bugs.webkit.org/show_bug.cgi?id=42843 + + Tests: fast/workers/storage/interrupt-database-sync.html + fast/workers/storage/interrupt-database.html + + * bindings/js/JSCustomVoidCallback.cpp: + (WebCore::JSCustomVoidCallback::~JSCustomVoidCallback): If the + destructor is called on the context thread, delete m_data directly + instead of posting a task to do that. We need to do that to make + sure that all JS objects are destroyed before + WorkerThreadShutdownFinishTask (in WorkerThread.cpp) calls + WorkerContext::clearScript(). + + * bindings/scripts/CodeGeneratorJS.pm: Same change as above, for + all auto-generated callbacks. + + * bindings/scripts/test/JS/JSTestCallback.cpp: + (WebCore::JSTestCallback::~JSTestCallback): Updated the + expectations for run-bindings-tests. + + * platform/sql/SQLiteDatabase.cpp: Added the ability to interrupt + all DB operations in progress, unless the database was closed or + is being closed. Unlike sqlite3_interrupt(), + SQLiteDatabase::interrupt() is sticky: once it's called, trying to + run any statement on that database will fail with a + SQLITE_INTERRUPT error code. + (WebCore::SQLiteDatabase::SQLiteDatabase): + (WebCore::SQLiteDatabase::close): + (WebCore::SQLiteDatabase::interrupt): + (WebCore::SQLiteDatabase::isInterrupted): + + * platform/sql/SQLiteDatabase.h: Added a mutex that can used by + SQLiteStatement to check if the database was interrupted. + (WebCore::SQLiteDatabase::databaseMutex): + + * platform/sql/SQLiteStatement.cpp: Changed prepare() and step() + to check if the database was interrupted, before trying to prepare + or run the statement. The other methods don't need to hold on to + the DB lock while running, because they're fast, so we don't need + to interrupt them. + (WebCore::SQLiteStatement::prepare): + (WebCore::SQLiteStatement::step): + + * storage/AbstractDatabase.cpp: Made SQLiteDatabase::interrupt() + and isInterrupted() visible to WebSQLDatabases classes. + (WebCore::AbstractDatabase::interrupt): + (WebCore::AbstractDatabase::isInterrupted): + * storage/AbstractDatabase.h: + + * storage/DatabaseTracker.cpp: Added a method to interrupt all + databases in a given context. + (WebCore::DatabaseTracker::interruptAllDatabasesForContext): + * storage/DatabaseTracker.h: + + * storage/SQLStatement.cpp: Changed the exception/error reported + when a statement is interrupted. + (WebCore::SQLStatement::execute): + * storage/SQLStatementSync.cpp: + (WebCore::SQLStatementSync::execute): + + * storage/SQLTransaction.cpp: Changed the code to release the + callback objects as soon as they're not needed. + (WebCore::SQLTransaction::checkAndHandleClosedOrInterruptedDatabase): + Changed this method to not schedule the next transaction step when + the database is interrupted. + (WebCore::SQLTransaction::performNextStep): + (WebCore::SQLTransaction::performPendingCallback): + (WebCore::SQLTransaction::deliverTransactionCallback): + (WebCore::SQLTransaction::postflightAndCommit): + (WebCore::SQLTransaction::deliverTransactionErrorCallback): + (WebCore::SQLTransaction::cleanupAfterTransactionErrorCallback): + * storage/SQLTransaction.h: + + * storage/chromium/DatabaseTrackerChromium.cpp: Added a method to + interrupt all databases in a given context. + (WebCore::DatabaseTracker::interruptAllDatabasesForContext): + + * workers/WorkerThread.cpp: + (WebCore::WorkerThread::stop): Added a call to + DatabaseTracker::interruptAllDatabasesForContext(). + +2010-07-29 Bernhard Bauer <bauerb@chromium.org> + + Reviewed by Darin Fisher. + + Check if plugins are allowed before creating a Java applet. + https://bugs.webkit.org/show_bug.cgi?id=43196 + + * loader/SubframeLoader.cpp: + (WebCore::SubframeLoader::createJavaAppletWidget): + +2010-07-29 James Robinson <jamesr@chromium.org> + + Reviewed by Simon Fraser. + + Ask a canvas' rendering context if it is accelerated instead tying it directly to webgl + https://bugs.webkit.org/show_bug.cgi?id=43206 + + This unifies the logic for whether a canvas is accelerated or not into one place + and makes it easier to expand the logic in the future to, for example, cover some + 2d canvases. + + Just a refactoring, no change in behavior so no new tests. + + * html/canvas/CanvasRenderingContext.h: + (WebCore::CanvasRenderingContext::isAccelerated): + * html/canvas/WebGLRenderingContext.h: + (WebCore::WebGLRenderingContext::isAccelerated): + * rendering/RenderHTMLCanvas.cpp: + (WebCore::RenderHTMLCanvas::requiresLayer): + * rendering/RenderLayerCompositor.cpp: + (WebCore::RenderLayerCompositor::requiresCompositingForCanvas): + +2010-07-29 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Implement NPN_Status + https://bugs.webkit.org/show_bug.cgi?id=43205 + + * WebCore.exp.in: + Export Chrome::setStatusText. + +2010-07-29 Victor Wang <victorw@chromium.org> + + Unreviewed, rolling out r64270. + http://trac.webkit.org/changeset/64270 + https://bugs.webkit.org/show_bug.cgi?id=39589 + + The patch breaks chromium webkit unittest + + * WebCore.exp.in: + * WebCore.xcodeproj/project.pbxproj: + * dom/DeviceOrientationClient.h: + (WebCore::DeviceOrientationClient::~DeviceOrientationClient): + * dom/DeviceOrientationController.cpp: + (WebCore::DeviceOrientationController::DeviceOrientationController): + * dom/DeviceOrientationEvent.cpp: + * platform/mock/DeviceOrientationClientMock.cpp: Removed. + * platform/mock/DeviceOrientationClientMock.h: Removed. + +2010-07-29 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Darin Adler. + + Resizer control does not paint in otherwise empty compositing layer + https://bugs.webkit.org/show_bug.cgi?id=42306 + + Ensure that we create backing store for an empty element with resize: both, + in order to render the resizer control. + + Test: compositing/overflow/resize-painting.html + + * rendering/RenderLayerBacking.h: + * rendering/RenderLayerBacking.cpp: + (WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer): Check for hasOverflowControls() + earlier, before any child checks. + (WebCore::RenderLayerBacking::hasNonCompositingDescendants): Renamed from hasNonCompositingContent() + to clarify its purpose. + +2010-07-29 Adam Roben <aroben@apple.com> + + Remove WKCACFLayer::Lanczos + + This member is also unused. + + Rubber-stamped in advance by John Sullivan. + + * platform/graphics/win/WKCACFLayer.cpp: + (WebCore::toCACFFilterType): + (WebCore::fromCACFFilterType): + * platform/graphics/win/WKCACFLayer.h: + (WebCore::WKCACFLayer::): + +2010-07-29 Adam Roben <aroben@apple.com> + + Remove some unused WKCACFLayer members + + Fixes <http://webkit.org/b/43200> WKCACFLayer has some unused members + + Reviewed by John Sullivan. + + * platform/graphics/win/WKCACFLayer.h: Removed [set]ClearsContext, + [set]Filters, and [set]SortsSublayers. + +2010-07-28 Justin Schuh <jschuh@chromium.org> + + Reviewed by Nate Chapin. + + Clear PluginData's page pointer on Page destruction + https://bugs.webkit.org/show_bug.cgi?id=43147 + + Test: plugins/access-after-page-destroyed.html + + * page/Page.cpp: + (WebCore::Page::~Page): + +2010-07-29 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Darin Adler. + + SHOULD NEVER BE REACHED assertion when switching tabs with composited content + https://bugs.webkit.org/show_bug.cgi?id=43167 + + When the root layer becomes unattached (e.g. when switching tabs), don't return + 'false' from paintingGoesToWindow() because that will cause a -setNeedsDispay, which + both allocates wasteful backing store, and causes an assertion when we try to + paint the layer. + + Test: manual-tests/compositing/assert-on-tab-switch.html: Added. + + * rendering/RenderLayerBacking.cpp: + (WebCore::RenderLayerBacking::paintingGoesToWindow): + +2010-07-29 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Pavel Feldman. + + Crash when computing pseudo-style of a vanished scrollbar in inspector + https://bugs.webkit.org/show_bug.cgi?id=42561 + + When a styled overflow:scroll scrollbar gets destroyed, we need to clear out the m_owner pointer, + otherwise the event handling code (which keeps the Scrollbar alive) later causes the scrollbar + to try to use m_owner to get pseudo style. + + Test: scrollbars/overflow-custom-scrollbar-crash.html + + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::destroyScrollbar): If this is a custom scrollbar, clear the owning renderer. + * rendering/RenderScrollbar.cpp: + (WebCore::RenderScrollbar::getScrollbarPseudoStyle): Bail if m_owner is 0. + * rendering/RenderScrollbar.h: + (WebCore::RenderScrollbar::clearOwningRenderer): New method. + +2010-07-29 Nikolas Zimmermann <nzimmermann@rim.com> + + Not reviewed. Fix release builds, by removing unused variables, that only served for ASSERTs that are no longer needed. + + * rendering/SVGRenderSupport.cpp: + (WebCore::SVGRenderSupport::prepareToRenderSVGContent): + (WebCore::SVGRenderSupport::pointInClippingArea): + +2010-07-29 Nikolas Zimmermann <nzimmermann@rim.com> + + Not reviewed. Fix build warning about unreachable code, seen on the windows slave. + + * rendering/RenderSVGContainer.cpp: + (WebCore::RenderSVGContainer::selfWillPaint): + * rendering/RenderSVGRoot.cpp: + (WebCore::RenderSVGRoot::selfWillPaint): + +2010-07-29 Nikolas Zimmermann <nzimmermann@rim.com> + + Reviewed by Dirk Schulze. + + WebKit shouldn't ignore resource cycles, but break them as Opera does + https://bugs.webkit.org/show_bug.cgi?id=43031 + + mask images are not updated when render objects' bounds change + https://bugs.webkit.org/show_bug.cgi?id=15124 + + SVG Gradients do not resize correctly + https://bugs.webkit.org/show_bug.cgi?id=41902 + + svg/dynamic-updates: SVGMarkerElement markerHeight/Width tests are broken + https://bugs.webkit.org/show_bug.cgi?id=42616 + + svg/dynamic-updates: SVGMaskElement tests are all broken + https://bugs.webkit.org/show_bug.cgi?id=42617 + + Don't ignore resources containing cyclic references, but break them, as discussed on SVG WG mailing lists - to be compatible with Opera which already does that. + + We used to lookup RenderSVGResourceContainers objects, by extracting the URI reference from the SVGRenderStyle, then utilizing getElementById() to lookup the + node, and access its renderer. Opera ignores such references, if they point to resources that contain cyclic references. Ignoring them would mean we have + to mutate the render style to empty the resource strings. That obviously doesn't work, as it would break expectations (getComputedStyle, etc.). + + Introduce a SVGResources class that stores pointers to all resources, that can be applied to a RenderObject (clipper/filter/markers/masker). + Add a SVGResourcesCache class, which is basically a HashMap<RenderObject*, SVGResources*>. Whenever a RenderObject receives style, we extract the URI references + from the SVGRenderStyle, look up the RenderSVGResourceContainer* objects, and store them in a SVGResources* class. Then we execute a cycle detection logic, + which detects cyclic references and breaks them. Breaking them means just nulling the pointer to the resource in the SVGResources object. Those SVGResources + objects are cached, and used throughout the render tree to access resources. This way it's guaranteed that all cyclic references are resolved until layout/paint + phase begins. + + Add destroy/styleDidChange/updateFromElement methods to all SVG renderers, in order to keep track of resource/client changes in the SVGResourcesCache. + As side-effect the SVGResourcesCache now knows which RenderObject references which resource, and thus can handle client registration for a RenderSVGResourceContainer. + The RenderSVGResourceContainer now holds a HashSet of RenderObjects, that's always up2date, and not related to the fact wheter a resources has already been used + for painting. The old logic missed to register clients for a resource, when the resource was in an invalid state. Fixing that fixes the svg/dynamic-updates/SVGMaskElement* tests. + + Rewrite all svg/custom/recursive-(filter|gradient|mask|pattern).svg tests to contain a reference image how it should be renderered. All 1:1 compatible with Opera now. + + * rendering/RenderForeignObject.cpp: + (WebCore::RenderForeignObject::layout): Grab selfNeedsLayout() before calling RenderBlock::layout(), otherwhise it's always false. + * rendering/RenderPath.cpp: Don't look up resources manually, use SVGResourcesCache. + (WebCore::RenderPath::fillContains): Remove constness, to avoid the need to pass around const RenderObjects* to the SVGResourcesCache. + (WebCore::RenderPath::strokeContains): Ditto. + (WebCore::RenderPath::layout): s/RenderSVGResource::invalidateAllResourcesOfRenderer/SVGResourcesCache::clientLayoutChanged/. + (WebCore::RenderPath::calculateMarkerBoundsIfNeeded): Remove special client handling for markers, it's all unified now. + (WebCore::RenderPath::styleWillChange): Only call setNeedsBoundariesUpdate when handling StyleDifferenceRepaint/Layout. + * rendering/RenderPath.h: + * rendering/RenderSVGBlock.cpp: + (WebCore::RenderSVGBlock::destroy): Forward to SVGResourcesCache::clientDestroyed. + (WebCore::RenderSVGBlock::styleDidChange): Forward to SVGResourcesCache::clientStyleChanged. + (WebCore::RenderSVGBlock::updateFromElement): Forward to SVGResourcesCache::clientUpdatedFromElement. + * rendering/RenderSVGBlock.h: + * rendering/RenderSVGContainer.cpp: + (WebCore::RenderSVGContainer::layout): s/RenderSVGResource::invalidateAllResourcesOfRenderer/SVGResourcesCache::clientLayoutChanged/. + (WebCore::RenderSVGContainer::selfWillPaint): Don't look up resources manually, use SVGResourcesCache. + * rendering/RenderSVGContainer.h: + * rendering/RenderSVGGradientStop.cpp: + (WebCore::RenderSVGGradientStop::styleDidChange): Rewrite, as invalidateResourceClients() is gone. + * rendering/RenderSVGHiddenContainer.h: Make layout() protected, as RenderSVGResourceContainer overrides it. + * rendering/RenderSVGImage.cpp: + (WebCore::RenderSVGImage::layout): s/RenderSVGResource::invalidateAllResourcesOfRenderer/SVGResourcesCache::clientLayoutChanged/. + (WebCore::RenderSVGImage::destroy): Forward to SVGResourcesCache::clientDestroyed. + (WebCore::RenderSVGImage::styleDidChange): Forward to SVGResourcesCache::clientStyleChanged. + (WebCore::RenderSVGImage::updateFromElement): Forward to SVGResourcesCache::clientUpdatedFromElement. + (WebCore::RenderSVGImage::imageChanged): Don't look up resources manually, use SVGResourcesCache. + * rendering/RenderSVGImage.h: + * rendering/RenderSVGInline.cpp: + (WebCore::RenderSVGInline::destroy): Forward to SVGResourcesCache::clientDestroyed. + (WebCore::RenderSVGInline::styleDidChange): Forward to SVGResourcesCache::clientStyleChanged. + (WebCore::RenderSVGInline::updateFromElement): Forward to SVGResourcesCache::clientUpdatedFromElement. + * rendering/RenderSVGInline.h: + * rendering/RenderSVGModelObject.cpp: + (WebCore::RenderSVGModelObject::destroy): Forward to SVGResourcesCache::clientDestroyed. + (WebCore::RenderSVGModelObject::styleDidChange): Forward to SVGResourcesCache::clientStyleChanged. + (WebCore::RenderSVGModelObject::updateFromElement): Forward to SVGResourcesCache::clientUpdatedFromElement. + * rendering/RenderSVGModelObject.h: + * rendering/RenderSVGResource.cpp: + (WebCore::RenderSVGResource::fillPaintingResource): Remove const from RenderObject parameter. + (WebCore::RenderSVGResource::strokePaintingResource): Ditto. + (WebCore::RenderSVGResource::markForLayoutAndParentResourceInvalidation): Early exit if we found the first parent resource. + * rendering/RenderSVGResource.h: + * rendering/RenderSVGResourceClipper.cpp: + (WebCore::RenderSVGResourceClipper::~RenderSVGResourceClipper): Early exit if m_clipper is empty. + (WebCore::RenderSVGResourceClipper::invalidateClients): Use new helper functions to invalidate clients, shared between all resources in RenderSVGResourceContainer. + (WebCore::RenderSVGResourceClipper::invalidateClient): Ditto. + (WebCore::RenderSVGResourceClipper::applyResource): Remove containsCyclicReference() check, SVGResourcesCycleSolver breaks cyclic references, resources do not need to take care anymore. + (WebCore::RenderSVGResourceClipper::createClipData): Don't look up resources manually, use SVGResourcesCache. + (WebCore::RenderSVGResourceClipper::hitTestClipContent): Remove containsCyclicReference() check, SVGResourcesCycleSolver breaks cyclic references, resources do not need to take care anymore. + * rendering/RenderSVGResourceClipper.h: + * rendering/RenderSVGResourceContainer.cpp: + (WebCore::svgExtensionsFromNode): + (WebCore::RenderSVGResourceContainer::RenderSVGResourceContainer): Stop registering resource from the constructor, delegate to styleDidChange. + (WebCore::RenderSVGResourceContainer::~RenderSVGResourceContainer): Only deregister resource if it was ever registered. + (WebCore::RenderSVGResourceContainer::layout): invalidateClients() here, to avoid the need for invalidateResourceClients() in the SVG DOM. Just call setNeedsLayout() from the SVG DOM. + (WebCore::RenderSVGResourceContainer::destroy): Forward to SVGResourcesCache::resourceDestroyed. + (WebCore::RenderSVGResourceContainer::styleDidChange): Register resource not in the constructor but when it first receives style. + (WebCore::RenderSVGResourceContainer::idChanged): Don't duplicate code, use existing methods from SVGResourcesCache. + (WebCore::RenderSVGResourceContainer::markAllClientsForInvalidation): Add new helper function, to share code between all resources. + (WebCore::RenderSVGResourceContainer::markClientForInvalidation): Ditto. + (WebCore::RenderSVGResourceContainer::addClient): SVGResourcesCache now manages the list of clients. It calls addClient() for each RenderObject that uses this resource. + (WebCore::RenderSVGResourceContainer::removeClient): SVGResourcesCache now manages the list of clients. + (WebCore::RenderSVGResourceContainer::registerResource): New helper function sharing code between idChanged / styleDidChange. + (WebCore::RenderSVGResourceContainer::transformOnNonScalingStroke): Add FIXME that the function is misplaced. + * rendering/RenderSVGResourceContainer.h: Move most functions to the new RenderSVGResourceContainer.cpp file. + * rendering/RenderSVGResourceFilter.cpp: + (WebCore::RenderSVGResourceFilter::~RenderSVGResourceFilter): Early exit if m_filter is empty. + (WebCore::RenderSVGResourceFilter::invalidateClients): Use new helper functions to invalidate clients, shared between all resources in RenderSVGResourceContainer. + (WebCore::RenderSVGResourceFilter::invalidateClient): Ditto. + * rendering/RenderSVGResourceGradient.cpp: + (WebCore::RenderSVGResourceGradient::~RenderSVGResourceGradient): Early exit if m_gradient is empty. + (WebCore::RenderSVGResourceGradient::invalidateClients): Use new helper functions to invalidate clients, shared between all resources in RenderSVGResourceContainer. + (WebCore::RenderSVGResourceGradient::invalidateClient): Ditto. + * rendering/RenderSVGResourceMarker.cpp: + (WebCore::RenderSVGResourceMarker::~RenderSVGResourceMarker): Now a no-op, markers are unified within the new client handling concept, no more special code needed. + (WebCore::RenderSVGResourceMarker::layout): As RenderSVGResourceMarker skips the RenderSVGResourceContainer::layout() method, we also need to call invalidateClients() here. + (WebCore::RenderSVGResourceMarker::invalidateClients): Use new helper functions to invalidate clients, shared between all resources in RenderSVGResourceContainer. + (WebCore::RenderSVGResourceMarker::invalidateClient): Ditto. + (WebCore::RenderSVGResourceMarker::draw): Remove marker specific logic to catch circular references. + * rendering/RenderSVGResourceMarker.h: + * rendering/RenderSVGResourceMasker.cpp: + (WebCore::RenderSVGResourceMasker::~RenderSVGResourceMasker): Early exit if m_masker is empty. + (WebCore::RenderSVGResourceMasker::invalidateClients): Use new helper functions to invalidate clients, shared between all resources in RenderSVGResourceContainer. + (WebCore::RenderSVGResourceMasker::invalidateClient): Ditto. + (WebCore::RenderSVGResourceMasker::applyResource): Remove containsCyclicReference() check, SVGResourcesCycleSolver breaks cyclic references, resources do not need to take care anymore. + * rendering/RenderSVGResourceMasker.h: + * rendering/RenderSVGResourcePattern.cpp: + (WebCore::RenderSVGResourcePattern::~RenderSVGResourcePattern): Early exit if m_pattern is empty. + (WebCore::RenderSVGResourcePattern::invalidateClients): Use new helper functions to invalidate clients, shared between all resources in RenderSVGResourceContainer. + (WebCore::RenderSVGResourcePattern::invalidateClient): Ditto. + (WebCore::RenderSVGResourcePattern::createTileImage): Remove containsCyclicReference() check, SVGResourcesCycleSolver breaks cyclic references, resources do not need to take care anymore. + * rendering/RenderSVGResourcePattern.h: + * rendering/RenderSVGRoot.cpp: + (WebCore::RenderSVGRoot::selfWillPaint): Don't look up resources manually, use SVGResourcesCache. + (WebCore::RenderSVGRoot::destroy): Forward to SVGResourcesCache::clientDestroyed. + (WebCore::RenderSVGRoot::styleDidChange): Forward to SVGResourcesCache::clientStyleChanged. + (WebCore::RenderSVGRoot::updateFromElement): Forward to SVGResourcesCache::clientUpdatedFromElement. + * rendering/RenderSVGRoot.h: + * rendering/RenderSVGText.cpp: + (WebCore::RenderSVGText::layout): s/RenderSVGResource::invalidateAllResourcesOfRenderer/SVGResourcesCache::clientLayoutChanged/. + * rendering/RenderSVGText.h: + * rendering/SVGInlineTextBox.cpp: + (WebCore::SVGInlineTextBox::acquirePaintingResource): Add RenderObject* parameter, don't assume the style comes from the InlineTextBox parent renderer. + (WebCore::SVGInlineTextBox::prepareGraphicsContextForTextPainting): Pass the parent()->renderer() to acquirePaintingResource. + (WebCore::SVGInlineTextBox::paintDecoration): Pass the decoration renderer to acquirePaintingResource. + (WebCore::SVGInlineTextBox::paintDecorationWithStyle): Ditto. + (WebCore::SVGInlineTextBox::paintText): When a selection pseudo style is used to paint the selection, swap styles in the SVGResourcesCache, to take the right resources when painting. + * rendering/SVGInlineTextBox.h: + * rendering/SVGRenderSupport.cpp: + (WebCore::SVGRenderSupport::prepareToRenderSVGContent): Don't look up resources manually, use SVGResourcesCache. + (WebCore::SVGRenderSupport::finishRenderSVGContent): Ditto. + (WebCore::SVGRenderSupport::intersectRepaintRectWithResources): Ditto. + (WebCore::SVGRenderSupport::pointInClippingArea): Remove const from RenderObject parameter. + * rendering/SVGRenderSupport.h: + * rendering/SVGRenderTreeAsText.cpp: + (WebCore::writeStyle): Add two const_cast now that fill/strokePaintingResource take RenderObject* parameters. This was the less intrusive approach, otherwhise more const_casts would be needed. + (WebCore::writeResources): Add FIXME that we should dump the resources present in the SVGResourcesCache instead of manually looking them up from the SVGRenderStyle, to avoid dumping cycles. + * rendering/SVGResourcesCache.cpp: + (WebCore::SVGResourcesCache::clientStyleChanged): Use markForLayoutAndParentResourceInvalidation() instead of duplicating code. + * rendering/SVGResourcesCycleSolver.cpp: + (WebCore::setFollowLinkForChainableResource): Implemented stub method. + * rendering/style/SVGRenderStyle.cpp: + (WebCore::SVGRenderStyle::diff): Return StyleDifferenceLayout, not Repaint for stroke paint changes, otherwhise the cached boundaries are not correctly updated. + * svg/SVGClipPathElement.cpp: + (WebCore::SVGClipPathElement::svgAttributeChanged): Don't use invalidateResourceClients(), it's not needed anymore, only call setNeedsLayout() on the renderer. + (WebCore::SVGClipPathElement::childrenChanged): Ditto. + * svg/SVGClipPathElement.h: + (WebCore::SVGClipPathElement::needsPendingResourceHandling): Return false, buildPendingResource() logic not needed anymore for resources, handled by RenderSVGResourceContainer. + * svg/SVGElement.cpp: + (WebCore::SVGElement::insertedIntoDocument): Only execute buildPendingResource() logic, if needsPendingResourceHandling() returns true. Cleaned up code a bit, to deploy early returns. + * svg/SVGElement.h: + (WebCore::SVGElement::needsPendingResourceHandling): Return true (default). Only needed by SVGTextPathElement/SVGUseElement, and should be removed in future. + * svg/SVGFilterElement.cpp: + (WebCore::SVGFilterElement::SVGFilterElement): Initialize m_followLink=true. + (WebCore::SVGFilterElement::setFilterRes): Don't use invalidateResourceClients(), it's not needed anymore, only call setNeedsLayout() on the renderer. + (WebCore::SVGFilterElement::svgAttributeChanged): Ditto. + (WebCore::SVGFilterElement::childrenChanged): Ditto. + * svg/SVGFilterElement.h: + (WebCore::SVGFilterElement::needsPendingResourceHandling): Return false, buildPendingResource() logic not needed anymore for resources, handled by RenderSVGResourceContainer. + (WebCore::SVGFilterElement::setFollowLink): Used by SVGResourcesCycleSolver, to stop following xlink:href links, if that leads to cyclic references. + * svg/SVGFilterPrimitiveStandardAttributes.cpp: + (WebCore::SVGFilterPrimitiveStandardAttributes::childrenChanged): Don't use invalidateResourceClients(), it's a no-op as effects don't have a renderer -> use invalidateFilter(). + * svg/SVGFilterPrimitiveStandardAttributes.h: + (WebCore::SVGFilterPrimitiveStandardAttributes::invalidateFilter): Don't use invalidateResourceClients(), it's not needed anymore, only call setNeedsLayout() on the renderer. + * svg/SVGGradientElement.cpp: + (WebCore::SVGGradientElement::SVGGradientElement): Initialize m_followLink=true. + (WebCore::SVGGradientElement::svgAttributeChanged): Don't use invalidateResourceClients(), it's not needed anymore, only call setNeedsLayout() on the renderer. + (WebCore::SVGGradientElement::childrenChanged): Ditto. + * svg/SVGGradientElement.h: + (WebCore::SVGGradientElement::needsPendingResourceHandling): Return false, buildPendingResource() logic not needed anymore for resources, handled by RenderSVGResourceContainer. + (WebCore::SVGGradientElement::setFollowLink): Used by SVGResourcesCycleSolver, to stop following xlink:href links, if that leads to cyclic references. + * svg/SVGLinearGradientElement.cpp: + (WebCore::SVGLinearGradientElement::svgAttributeChanged): Don't use invalidateResourceClients(), it's not needed anymore, only call setNeedsLayout() on the renderer. + (WebCore::SVGLinearGradientElement::collectGradientProperties): Only follow xlink:href links if m_followLinks == true. + * svg/SVGMarkerElement.cpp: + (WebCore::SVGMarkerElement::svgAttributeChanged): Don't use invalidateResourceClients(), it's not needed anymore, only call setNeedsLayout() on the renderer. + (WebCore::SVGMarkerElement::childrenChanged): Ditto. + (WebCore::SVGMarkerElement::setOrientToAuto): Ditto. + (WebCore::SVGMarkerElement::setOrientToAngle): Ditto. + * svg/SVGMarkerElement.h: + (WebCore::SVGMarkerElement::needsPendingResourceHandling): Return false, buildPendingResource() logic not needed anymore for resources, handled by RenderSVGResourceContainer. + * svg/SVGMaskElement.cpp: + (WebCore::SVGMaskElement::svgAttributeChanged): Don't use invalidateResourceClients(), it's not needed anymore, only call setNeedsLayout() on the renderer. + (WebCore::SVGMaskElement::childrenChanged): Ditto. + * svg/SVGMaskElement.h: + (WebCore::SVGMaskElement::needsPendingResourceHandling): Return false, buildPendingResource() logic not needed anymore for resources, handled by RenderSVGResourceContainer. + * svg/SVGPatternElement.cpp: + (WebCore::SVGPatternElement::SVGPatternElement): Initialize m_followLink=true. + (WebCore::SVGPatternElement::svgAttributeChanged): Don't use invalidateResourceClients(), it's not needed anymore, only call setNeedsLayout() on the renderer. + (WebCore::SVGPatternElement::childrenChanged): Ditto. + (WebCore::SVGPatternElement::collectPatternProperties): Only follow xlink:href links if m_followLinks == true. + * svg/SVGPatternElement.h: + (WebCore::SVGPatternElement::needsPendingResourceHandling): Return false, buildPendingResource() logic not needed anymore for resources, handled by RenderSVGResourceContainer. + (WebCore::SVGPatternElement::setFollowLink): Used by SVGResourcesCycleSolver, to stop following xlink:href links, if that leads to cyclic references. + * svg/SVGRadialGradientElement.cpp: + (WebCore::SVGRadialGradientElement::svgAttributeChanged): Don't use invalidateResourceClients(), it's not needed anymore, only call setNeedsLayout() on the renderer. + (WebCore::SVGRadialGradientElement::collectGradientProperties): Only follow xlink:href links if m_followLinks == true. + * svg/SVGStyledElement.cpp: + (WebCore::SVGStyledElement::attach): Call updateFromElement upon attach(), needed by all resource renderers. Defaults to a no-op in RenderObject.h + * svg/SVGStyledElement.h: Remove invalidateResourceClients(), it's not needed anymore. + +2010-07-29 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + Reviewed by Kenneth Rohde Christiansen. + + [EFL] Support to enable WML in WebKit EFL + https://bugs.webkit.org/show_bug.cgi?id=43178 + + WebKit EFL cannot enable WML. WML files are added to CMakeLists.txt + to enable WML in WebKit EFL. + + * CMakeLists.txt: Support to enable WML. + +2010-07-21 Grace Kloba <klobag@gmail.com> , Antonio Gomes <tonikitoo@webkit.org> + + Reviewed by David Hyatt. + + Enhance the hit testing to take a rectangle instead of a point + https://bugs.webkit.org/show_bug.cgi?id=40197 + + The primary goal of this change is to provide mechanisms for more precise tap + actions by the users on mobile devices. + + Patch extends the hit testing system to work considering a rectangular area + as input instead of a point, when applicable. For that, the HitTestResult class + was modified to take a padding (IntSize). The padding specifies a fuzzy range for + accepting input events in pixels coordinates for both vertical and horizontal + orientations. In other words, it tells how much to expand the search rect + around a supposed touch point. + + If it is non-positive padding (e.g. (-1, -1), (5, -1), (0, 0)), hit testing will behavior + as the current point based hit testing: methods are no-op'ed to not regress it performance-wise + since it is the common behavior. When positive padding is provided, the HitTestResult class will + keep record of all nodes that intersect the built up test area. The logic will continue searching + when it finds a candidate until the hit test area is fully enclosed by the boundaries of a candidate. + The result will be a list of nodes in the z-order they are hit-tested. Caller will decide how + to process them. + + In order to expose the functionality, the patch: + + - Adds a nodesFromRect method to the Document class, exposing the funcionality + to the DOM. Method returns a NodeList with all nodes that intersect the given + hit-tested area. + - Extends hitTestResultAtPoint method of the EventHandler with an extra 'padding' + parameter, defaulting to IntSize(-1, -1). The rect-based hit test is performed when a + non-negative padding is passed in. + + Test: fast/dom/nodesFromRect-basic.html + + * WebCore.base.exp: + * dom/Document.cpp: + (WebCore::Document::nodesFromRect): This method exposes the rect based funcionality to + the DOM. It works similarly to elementFromPoint, however receiving a rectangular area + as input instead of a point, and returning a z-index ordered list of nodes (not elements) + whose area intersect the hit test rect. + * dom/Document.h: Ditto. + * dom/Document.idl: Ditto. + * page/EventHandler.cpp: + (WebCore::EventHandler::hitTestResultAtPoint): The funcionality is also exposed through this + method. Patch adds a additional IntSize parameter to work as the padding area, building up + the hit test rect. + * page/EventHandler.h: Ditto. + * rendering/HitTestResult.cpp: + (WebCore::HitTestResult::HitTestResult): Rect based hit test constructor. Receives a + padding IntSize as parameter. It can be (0,0). + (WebCore::HitTestResult::operator=): Modified to assign the m_rectBasedTestResult as well. + (WebCore::HitTestResult::append): Merge to HitTestResult objects in a way that the + list node's of both objects get amended. + (WebCore::HitTestResult::addNodeToRectBasedTestResult): Adds a given Node to the list of + hit nodes. + * rendering/HitTestResult.h: + (WebCore::HitTestResult::padding): Returns the padding as an IntSize. + (WebCore::HitTestResult::isRectBasedTest): Returns if the HitTestResult is rect based or not. + (WebCore::HitTestResult::.rectBasedTestResult): Returns the list nodes hit. + (WebCore::HitTestResult::rectFromPoint): Returns the hit test rect given the hit test point + and padding. + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::hitTestLayer): + (WebCore::RenderLayer::hitTestList): + (WebCore::RenderLayer::hitTestChildLayerColumns): + * rendering/EllipsisBox.cpp: + (WebCore::EllipsisBox::nodeAtPoint): Method is modified to support rect based hit test extension. + Now it not just checks if the boundary of the node being hit-tested contains a hit test point, but + instead it checks if the boundary of the node intersects a hit test rect. It is implemented so + that the common case (point based hit test) works as previously. + * rendering/InlineFlowBox.cpp: + (WebCore::InlineFlowBox::nodeAtPoint): Ditto. + * rendering/InlineTextBox.cpp: + (WebCore::InlineTextBox::nodeAtPoint): Ditto. + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::nodeAtPoint): Ditto. + (WebCore::RenderBlock::hitTestColumns): Ditto. + * rendering/RenderBox.cpp: + (WebCore::RenderBox::nodeAtPoint): Ditto. + * rendering/RenderImage.cpp: + (WebCore::RenderImage::nodeAtPoint): Ditto. + * rendering/RenderLineBoxList.cpp: + (WebCore::RenderLineBoxList::hitTest): + * rendering/RenderSVGRoot.cpp: + (WebCore::RenderSVGRoot::nodeAtPoint): Ditto. + * rendering/RenderTable.cpp: + (WebCore::RenderTable::nodeAtPoint): Ditto. + * rendering/RenderTableSection.cpp: + (WebCore::RenderTableSection::nodeAtPoint): Ditto. + * rendering/RenderWidget.cpp: + (WebCore::RenderWidget::nodeAtPoint): Ditto. + +2010-07-29 Steve Block <steveblock@google.com> + + Reviewed by Jeremy Orlow. + + Add LayoutTestController methods to test DeviceOrientation + https://bugs.webkit.org/show_bug.cgi?id=39589 + + This patch does not hook up the new LayoutTestController method to WebKit + for any platform. This will be done in later patches. + https://bugs.webkit.org/show_bug.cgi?id=43181 tracks this for Mac. + + Test: fast/dom/DeviceOrientation/basic-operation.html + + * WebCore/WebCore.exp.in: + * WebCore.xcodeproj/project.pbxproj: + * dom/DeviceOrientationClient.h: + (WebCore::DeviceOrientationClient::~DeviceOrientationClient): + * dom/DeviceOrientationController.cpp: + (WebCore::DeviceOrientationController::DeviceOrientationController): + * dom/DeviceOrientationEvent.cpp: + * platform/mock/DeviceOrientationClientMock.cpp: Added. + (WebCore::DeviceOrientationClientMock::DeviceOrientationClientMock): + (WebCore::DeviceOrientationClientMock::setController): + (WebCore::DeviceOrientationClientMock::startUpdating): + (WebCore::DeviceOrientationClientMock::stopUpdating): + (WebCore::DeviceOrientationClientMock::setOrientation): + (WebCore::DeviceOrientationClientMock::timerFired): + * platform/mock/DeviceOrientationClientMock.h: Added. + (WebCore::DeviceOrientationClientMock::lastOrientation): + +2010-07-29 Satish Sampath <satish@chromium.org> + + Reviewed by Steve Block. + + Runtime feature switch for speech input. + https://bugs.webkit.org/show_bug.cgi?id=43146 + + Add a runtime feature switch that decides whether speech input attributes are available or not. + Defaults to true. + + * bindings/generic/RuntimeEnabledFeatures.cpp: + * bindings/generic/RuntimeEnabledFeatures.h: + (WebCore::RuntimeEnabledFeatures::setSpeechInputEnabled): + (WebCore::RuntimeEnabledFeatures::speechInputEnabled): + (WebCore::RuntimeEnabledFeatures::speechEnabled): + * html/HTMLInputElement.idl: + +2010-07-27 Alexander Pavlov <apavlov@chromium.org> + + Reviewed by Pavel Feldman. + + Inspector should display CDATA section data + https://bugs.webkit.org/show_bug.cgi?id=16259 + + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::buildObjectForNode): + * inspector/front-end/ElementsTreeOutline.js: + (): + +2010-07-28 Kavita Kanetkar <kkanetkar@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: Enable UI for chromium's appcache inspection. + https://bugs.webkit.org/show_bug.cgi?id=43098 + + * inspector/front-end/Settings.js: Removed appCacheEnabled. + * inspector/front-end/StoragePanel.js: Removed appCacheEnabled condition. + (WebInspector.StoragePanel): + (WebInspector.StoragePanel.prototype.reset): + (WebInspector.StoragePanel.prototype.addApplicationCache): + 2010-07-28 Bryan Gislason <bgislason@rim.com> Reviewed by Nate Chapin. diff --git a/WebCore/Configurations/Base.xcconfig b/WebCore/Configurations/Base.xcconfig index aa68bdb..be19c22 100644 --- a/WebCore/Configurations/Base.xcconfig +++ b/WebCore/Configurations/Base.xcconfig @@ -1,4 +1,4 @@ -// Copyright (C) 2009 Apple Inc. All rights reserved. +// Copyright (C) 2009, 2010 Apple Inc. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions @@ -28,11 +28,15 @@ GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_CPP_EXCEPTIONS = NO; GCC_ENABLE_CPP_RTTI = NO; GCC_ENABLE_OBJC_EXCEPTIONS = YES; -GCC_ENABLE_OBJC_GC = supported; +GCC_ENABLE_OBJC_GC = $(GCC_ENABLE_OBJC_GC_$(REAL_PLATFORM_NAME)); +GCC_ENABLE_OBJC_GC_iphoneos = NO; +GCC_ENABLE_OBJC_GC_iphonesimulator = NO; +GCC_ENABLE_OBJC_GC_macosx = supported; GCC_ENABLE_SYMBOL_SEPARATION = NO; GCC_FAST_OBJC_DISPATCH = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; -GCC_MODEL_TUNING = G5; +GCC_MODEL_TUNING = $(GCC_MODEL_TUNING_$(REAL_PLATFORM_NAME)); +GCC_MODEL_TUNING_macosx = G5; GCC_OBJC_CALL_CXX_CDTORS = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_THREADSAFE_STATICS = NO; @@ -43,19 +47,27 @@ GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; LINKER_DISPLAYS_MANGLED_NAMES = YES; PREBINDING = NO; -VALID_ARCHS = i386 ppc x86_64 ppc64; -WARNING_CFLAGS = $(WARNING_CFLAGS_$(CURRENT_ARCH)); -WARNING_CFLAGS_BASE = -Wall -Wextra -Wcast-align -Wcast-qual -Wchar-subscripts -Wextra-tokens -Wformat=2 -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wpacked -Wpointer-arith -Wredundant-decls -Wundef -Wwrite-strings; -WARNING_CFLAGS_ = $(WARNING_CFLAGS_BASE) -Wshorten-64-to-32; -WARNING_CFLAGS_i386 = $(WARNING_CFLAGS_BASE) -Wshorten-64-to-32; -WARNING_CFLAGS_ppc = $(WARNING_CFLAGS_BASE) -Wshorten-64-to-32; +VALID_ARCHS = $(VALID_ARCHS_$(REAL_PLATFORM_NAME)); +VALID_ARCHS_iphoneos = $(ARCHS_STANDARD_32_BIT); +VALID_ARCHS_iphonesimulator = $(ARCHS_STANDARD_32_BIT); +VALID_ARCHS_macosx = i386 ppc x86_64 ppc64; +WARNING_CFLAGS_BASE = -Wall -Wextra -Wcast-qual -Wchar-subscripts -Wextra-tokens -Wformat=2 -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wpacked -Wpointer-arith -Wredundant-decls -Wundef -Wwrite-strings; +WARNING_CFLAGS = $(WARNING_CFLAGS_$(REAL_PLATFORM_NAME)); +WARNING_CFLAGS_iphoneos = $(WARNING_CFLAGS_BASE) -Wshorten-64-to-32; +WARNING_CFLAGS_iphonesimulator = $(WARNING_CFLAGS_BASE) -Wcast-align -Wshorten-64-to-32; +WARNING_CFLAGS_macosx = $(WARNING_CFLAGS_macosx_$(CURRENT_ARCH)); +WARNING_CFLAGS_macosx_ = $(WARNING_CFLAGS_BASE) -Wcast-align -Wshorten-64-to-32; +WARNING_CFLAGS_macosx_i386 = $(WARNING_CFLAGS_BASE) -Wcast-align -Wshorten-64-to-32; +WARNING_CFLAGS_macosx_ppc = $(WARNING_CFLAGS_BASE) -Wcast-align -Wshorten-64-to-32; // FIXME: WebCore 64-bit builds should build with -Wshorten-64-to-32 -WARNING_CFLAGS_ppc64 = $(WARNING_CFLAGS_BASE); -WARNING_CFLAGS_x86_64 = $(WARNING_CFLAGS_BASE); +WARNING_CFLAGS_macosx_ppc64 = $(WARNING_CFLAGS_BASE) -Wcast-align; +WARNING_CFLAGS_macosx_x86_64 = $(WARNING_CFLAGS_BASE) -Wcast-align; REAL_PLATFORM_NAME = $(REAL_PLATFORM_NAME_$(PLATFORM_NAME)); REAL_PLATFORM_NAME_ = $(REAL_PLATFORM_NAME_macosx); +REAL_PLATFORM_NAME_iphoneos = iphoneos; +REAL_PLATFORM_NAME_iphonesimulator = iphonesimulator; REAL_PLATFORM_NAME_macosx = macosx; TARGET_MAC_OS_X_VERSION_MAJOR = $(MAC_OS_X_VERSION_MAJOR); @@ -82,27 +94,31 @@ DEAD_CODE_STRIPPING = $(DEAD_CODE_STRIPPING_$(CURRENT_VARIANT)); SECTORDER_FLAGS = -sectorder __TEXT __text WebCore.order; WEBCORE_SQLITE3_HEADER_SEARCH_PATHS = $(NEXT_ROOT)/usr/local/include/WebCoreSQLite3; -SQLITE3_HEADER_SEARCH_PATHS = $(SQLITE3_HEADER_SEARCH_PATHS_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -SQLITE3_HEADER_SEARCH_PATHS_ = $(SQLITE3_HEADER_SEARCH_PATHS_1040); -SQLITE3_HEADER_SEARCH_PATHS_1040 = $(WEBCORE_SQLITE3_HEADER_SEARCH_PATHS); -SQLITE3_HEADER_SEARCH_PATHS_1050 = $(WEBCORE_SQLITE3_HEADER_SEARCH_PATHS); -SQLITE3_HEADER_SEARCH_PATHS_1060 = ; -SQLITE3_HEADER_SEARCH_PATHS_1070 = ; +SQLITE3_HEADER_SEARCH_PATHS = $(SQLITE3_HEADER_SEARCH_PATHS_$(REAL_PLATFORM_NAME)); +SQLITE3_HEADER_SEARCH_PATHS_macosx = $(SQLITE3_HEADER_SEARCH_PATHS_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +SQLITE3_HEADER_SEARCH_PATHS_macosx_ = $(SQLITE3_HEADER_SEARCH_PATHS_macosx_1040); +SQLITE3_HEADER_SEARCH_PATHS_macosx_1040 = $(WEBCORE_SQLITE3_HEADER_SEARCH_PATHS); +SQLITE3_HEADER_SEARCH_PATHS_macosx_1050 = $(WEBCORE_SQLITE3_HEADER_SEARCH_PATHS); +SQLITE3_HEADER_SEARCH_PATHS_macosx_1060 = ; +SQLITE3_HEADER_SEARCH_PATHS_macosx_1070 = ; // Use GCC 4.2 with Xcode 3.1, which includes GCC 4.2 but defaults to GCC 4.0. // Note that Xcode versions as new as 3.1.2 use XCODE_VERSION_ACTUAL for the minor version // number. Newer versions of Xcode use XCODE_VERSION_MINOR for the minor version, and // XCODE_VERSION_ACTUAL for the full version number. -TARGET_GCC_VERSION = $(TARGET_GCC_VERSION_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -TARGET_GCC_VERSION_ = $(TARGET_GCC_VERSION_1040); -TARGET_GCC_VERSION_1040 = GCC_40; -TARGET_GCC_VERSION_1050 = $(TARGET_GCC_VERSION_1050_$(XCODE_VERSION_MINOR)); -TARGET_GCC_VERSION_1050_ = $(TARGET_GCC_VERSION_1050_$(XCODE_VERSION_ACTUAL)); -TARGET_GCC_VERSION_1050_0310 = GCC_42; -TARGET_GCC_VERSION_1050_0320 = GCC_42; -TARGET_GCC_VERSION_1060 = GCC_42; -TARGET_GCC_VERSION_1070 = LLVM_GCC_42; +TARGET_GCC_VERSION = $(TARGET_GCC_VERSION_$(REAL_PLATFORM_NAME)); +TARGET_GCC_VERSION_iphoneos = LLVM_GCC_42; +TARGET_GCC_VERSION_iphonesimulator = GCC_42; +TARGET_GCC_VERSION_macosx = $(TARGET_GCC_VERSION_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +TARGET_GCC_VERSION_macosx_ = $(TARGET_GCC_VERSION_macosx_1040); +TARGET_GCC_VERSION_macosx_1040 = GCC_40; +TARGET_GCC_VERSION_macosx_1050 = $(TARGET_GCC_VERSION_macosx_1050_$(XCODE_VERSION_MINOR)); +TARGET_GCC_VERSION_macosx_1050_ = $(TARGET_GCC_VERSION_macosx_1050_$(XCODE_VERSION_ACTUAL)); +TARGET_GCC_VERSION_macosx_1050_0310 = GCC_42; +TARGET_GCC_VERSION_macosx_1050_0320 = GCC_42; +TARGET_GCC_VERSION_macosx_1060 = GCC_42; +TARGET_GCC_VERSION_macosx_1070 = LLVM_GCC_42; GCC_VERSION = $(GCC_VERSION_$(TARGET_GCC_VERSION)); GCC_VERSION_GCC_40 = 4.0; diff --git a/WebCore/Configurations/DebugRelease.xcconfig b/WebCore/Configurations/DebugRelease.xcconfig index 449358e..a291536 100644 --- a/WebCore/Configurations/DebugRelease.xcconfig +++ b/WebCore/Configurations/DebugRelease.xcconfig @@ -1,4 +1,4 @@ -// Copyright (C) 2009 Apple Inc. All rights reserved. +// Copyright (C) 2009, 2010 Apple Inc. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions @@ -23,21 +23,27 @@ #include "Base.xcconfig" -ARCHS = $(ARCHS_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -ARCHS_ = $(ARCHS_1040); -ARCHS_1040 = $(NATIVE_ARCH); -ARCHS_1050 = $(NATIVE_ARCH); -ARCHS_1060 = $(ARCHS_STANDARD_32_64_BIT); -ARCHS_1070 = $(ARCHS_STANDARD_32_64_BIT); +ARCHS = $(ARCHS_$(REAL_PLATFORM_NAME)); +ARCHS_iphoneos = $(ARCHS_STANDARD_32_BIT); +ARCHS_iphonesimulator = $(ARCHS_STANDARD_32_BIT); +ARCHS_macosx = $(ARCHS_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +ARCHS_macosx_ = $(ARCHS_macosx_1040); +ARCHS_macosx_1040 = $(NATIVE_ARCH); +ARCHS_macosx_1050 = $(NATIVE_ARCH); +ARCHS_macosx_1060 = $(ARCHS_STANDARD_32_64_BIT); +ARCHS_macosx_1070 = $(ARCHS_STANDARD_32_64_BIT); ONLY_ACTIVE_ARCH = YES; -MACOSX_DEPLOYMENT_TARGET = $(MACOSX_DEPLOYMENT_TARGET_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -MACOSX_DEPLOYMENT_TARGET_ = 10.4; -MACOSX_DEPLOYMENT_TARGET_1040 = 10.4; -MACOSX_DEPLOYMENT_TARGET_1050 = 10.5; -MACOSX_DEPLOYMENT_TARGET_1060 = 10.6; -MACOSX_DEPLOYMENT_TARGET_1070 = 10.7; +MACOSX_DEPLOYMENT_TARGET = $(MACOSX_DEPLOYMENT_TARGET_$(REAL_PLATFORM_NAME)); +MACOSX_DEPLOYMENT_TARGET_iphoneos = 10.5; +MACOSX_DEPLOYMENT_TARGET_iphonesimulator = 10.5; +MACOSX_DEPLOYMENT_TARGET_macosx = $(MACOSX_DEPLOYMENT_TARGET_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +MACOSX_DEPLOYMENT_TARGET_macosx_ = 10.4; +MACOSX_DEPLOYMENT_TARGET_macosx_1040 = 10.4; +MACOSX_DEPLOYMENT_TARGET_macosx_1050 = 10.5; +MACOSX_DEPLOYMENT_TARGET_macosx_1060 = 10.6; +MACOSX_DEPLOYMENT_TARGET_macosx_1070 = 10.7; GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES; diff --git a/WebCore/Configurations/FeatureDefines.xcconfig b/WebCore/Configurations/FeatureDefines.xcconfig index 8e33a91..9810cf7 100644 --- a/WebCore/Configurations/FeatureDefines.xcconfig +++ b/WebCore/Configurations/FeatureDefines.xcconfig @@ -1,4 +1,4 @@ -// Copyright (C) 2009 Apple Inc. All rights reserved. +// Copyright (C) 2009, 2010 Apple Inc. All rights reserved. // Copyright (C) 2009 Google Inc. All rights reserved. // // Redistribution and use in source and binary forms, with or without @@ -33,31 +33,52 @@ ENABLE_LINK_PREFETCH = ; -ENABLE_3D_CANVAS = $(ENABLE_3D_CANVAS_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -ENABLE_3D_CANVAS_1060 = ENABLE_3D_CANVAS; -ENABLE_3D_CANVAS_1070 = ENABLE_3D_CANVAS; +ENABLE_3D_CANVAS = $(ENABLE_3D_CANVAS_$(REAL_PLATFORM_NAME)); +ENABLE_3D_CANVAS_macosx = $(ENABLE_3D_CANVAS_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +ENABLE_3D_CANVAS_macosx_1060 = ENABLE_3D_CANVAS; +ENABLE_3D_CANVAS_macosx_1070 = ENABLE_3D_CANVAS; -ENABLE_3D_RENDERING = $(ENABLE_3D_RENDERING_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -ENABLE_3D_RENDERING_1050 = ENABLE_3D_RENDERING; -ENABLE_3D_RENDERING_1060 = ENABLE_3D_RENDERING; -ENABLE_3D_RENDERING_1070 = ENABLE_3D_RENDERING; +ENABLE_3D_RENDERING = $(ENABLE_3D_RENDERING_$(REAL_PLATFORM_NAME)); +ENABLE_3D_RENDERING_iphoneos = ENABLE_3D_RENDERING; +ENABLE_3D_RENDERING_iphonesimulator = $(ENABLE_3D_RENDERING_iphoneos); +ENABLE_3D_RENDERING_macosx = $(ENABLE_3D_RENDERING_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +ENABLE_3D_RENDERING_macosx_1050 = ENABLE_3D_RENDERING; +ENABLE_3D_RENDERING_macosx_1060 = ENABLE_3D_RENDERING; +ENABLE_3D_RENDERING_macosx_1070 = ENABLE_3D_RENDERING; + +ENABLE_BLOB_SLICE = $(ENABLE_BLOB_SLICE_$(REAL_PLATFORM_NAME)); +ENABLE_BLOB_SLICE_macosx = ENABLE_BLOB_SLICE; + +ENABLE_CHANNEL_MESSAGING = $(ENABLE_CHANNEL_MESSAGING_$(REAL_PLATFORM_NAME)); +ENABLE_CHANNEL_MESSAGING_macosx = ENABLE_CHANNEL_MESSAGING; + +ENABLE_CLIENT_BASED_GEOLOCATION = $(ENABLE_CLIENT_BASED_GEOLOCATION_$(REAL_PLATFORM_NAME)); +ENABLE_CLIENT_BASED_GEOLOCATION_macosx = ENABLE_CLIENT_BASED_GEOLOCATION; -ENABLE_BLOB_SLICE = ENABLE_BLOB_SLICE; -ENABLE_CHANNEL_MESSAGING = ENABLE_CHANNEL_MESSAGING; -ENABLE_CLIENT_BASED_GEOLOCATION = ENABLE_CLIENT_BASED_GEOLOCATION; ENABLE_DATABASE = ENABLE_DATABASE; ENABLE_DATAGRID = ; -ENABLE_DATALIST = ENABLE_DATALIST; + +ENABLE_DATALIST = $(ENABLE_DATALIST_$(REAL_PLATFORM_NAME)); +ENABLE_DATALIST_macosx = ENABLE_DATALIST; + ENABLE_DEVICE_ORIENTATION = ; ENABLE_DIRECTORY_UPLOAD = ; ENABLE_DOM_STORAGE = ENABLE_DOM_STORAGE; ENABLE_EVENTSOURCE = ENABLE_EVENTSOURCE; -ENABLE_FILTERS = ENABLE_FILTERS; -ENABLE_FILE_READER = ENABLE_FILE_READER; + +ENABLE_FILTERS = $(ENABLE_FILTERS_$(REAL_PLATFORM_NAME)); +ENABLE_FILTERS_macosx = ENABLE_FILTERS; + +ENABLE_FILE_READER = $(ENABLE_FILE_READER_$(REAL_PLATFORM_NAME)); +ENABLE_FILE_READER_macosx = ENABLE_FILE_READER; + ENABLE_FILE_WRITER = ; ENABLE_FILE_SYSTEM = ; ENABLE_GEOLOCATION = ENABLE_GEOLOCATION; -ENABLE_ICONDATABASE = ENABLE_ICONDATABASE; + +ENABLE_ICONDATABASE = $(ENABLE_ICONDATABASE_$(REAL_PLATFORM_NAME)); +ENABLE_ICONDATABASE_macosx = ENABLE_ICONDATABASE; + ENABLE_IMAGE_RESIZER = ; ENABLE_INDEXED_DATABASE = ; ENABLE_INPUT_SPEECH = ; @@ -67,21 +88,37 @@ ENABLE_METER_TAG = ENABLE_METER_TAG; ENABLE_NOTIFICATIONS = ; ENABLE_OFFLINE_WEB_APPLICATIONS = ENABLE_OFFLINE_WEB_APPLICATIONS; ENABLE_PROGRESS_TAG = ENABLE_PROGRESS_TAG; -ENABLE_RUBY = ENABLE_RUBY; -ENABLE_SANDBOX = ENABLE_SANDBOX; -ENABLE_SHARED_WORKERS = ENABLE_SHARED_WORKERS; + +ENABLE_RUBY = $(ENABLE_RUBY_$(REAL_PLATFORM_NAME)); +ENABLE_RUBY_macosx = ENABLE_RUBY; + +ENABLE_SANDBOX = $(ENABLE_SANDBOX_$(REAL_PLATFORM_NAME)); +ENABLE_SANDBOX_macosx = ENABLE_SANDBOX; + +ENABLE_SHARED_WORKERS = $(ENABLE_SHARED_WORKERS_$(REAL_PLATFORM_NAME)); +ENABLE_SHARED_WORKERS_macosx = ENABLE_SHARED_WORKERS; + ENABLE_SVG = ENABLE_SVG; ENABLE_SVG_ANIMATION = ENABLE_SVG_ANIMATION; ENABLE_SVG_AS_IMAGE = ENABLE_SVG_AS_IMAGE; -ENABLE_SVG_DOM_OBJC_BINDINGS = ENABLE_SVG_DOM_OBJC_BINDINGS; + +ENABLE_SVG_DOM_OBJC_BINDINGS = $(ENABLE_SVG_DOM_OBJC_BINDINGS_$(REAL_PLATFORM_NAME)); +ENABLE_SVG_DOM_OBJC_BINDINGS_macosx = ENABLE_SVG_DOM_OBJC_BINDINGS; + ENABLE_SVG_FONTS = ENABLE_SVG_FONTS; ENABLE_SVG_FOREIGN_OBJECT = ENABLE_SVG_FOREIGN_OBJECT; ENABLE_SVG_USE = ENABLE_SVG_USE; ENABLE_VIDEO = ENABLE_VIDEO; -ENABLE_WEB_SOCKETS = ENABLE_WEB_SOCKETS; + +ENABLE_WEB_SOCKETS = $(ENABLE_WEB_SOCKETS_$(REAL_PLATFORM_NAME)); +ENABLE_WEB_SOCKETS_macosx = ENABLE_WEB_SOCKETS; + ENABLE_WEB_TIMING = ; ENABLE_WML = ; -ENABLE_WORKERS = ENABLE_WORKERS; + +ENABLE_WORKERS = $(ENABLE_WORKERS_$(REAL_PLATFORM_NAME)); +ENABLE_WORKERS_macosx = ENABLE_WORKERS; + ENABLE_XHTMLMP = ; ENABLE_XPATH = ENABLE_XPATH; ENABLE_XSLT = ENABLE_XSLT; diff --git a/WebCore/Configurations/Version.xcconfig b/WebCore/Configurations/Version.xcconfig index c1b6b32..9ac1583 100644 --- a/WebCore/Configurations/Version.xcconfig +++ b/WebCore/Configurations/Version.xcconfig @@ -1,4 +1,4 @@ -// Copyright (C) 2009 Apple Inc. All rights reserved. +// Copyright (C) 2009, 2010 Apple Inc. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 534; -MINOR_VERSION = 4; +MINOR_VERSION = 5; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); @@ -31,12 +31,15 @@ BUNDLE_VERSION = $(BUNDLE_VERSION_$(CONFIGURATION)); SHORT_VERSION_STRING = $(SHORT_VERSION_STRING_$(CONFIGURATION)) // The system version prefix is based on the current system version. -SYSTEM_VERSION_PREFIX = $(SYSTEM_VERSION_PREFIX_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -SYSTEM_VERSION_PREFIX_ = 4; // Some Tiger versions of Xcode don't set MAC_OS_X_VERSION_MAJOR. -SYSTEM_VERSION_PREFIX_1040 = 4; -SYSTEM_VERSION_PREFIX_1050 = 5; -SYSTEM_VERSION_PREFIX_1060 = 6; -SYSTEM_VERSION_PREFIX_1070 = 7; +SYSTEM_VERSION_PREFIX = $(SYSTEM_VERSION_PREFIX_$(REAL_PLATFORM_NAME)); +SYSTEM_VERSION_PREFIX_iphoneos = 6; // iOS is most like SnowLeopard currently. +SYSTEM_VERSION_PREFIX_iphonesimulator = $(SYSTEM_VERSION_PREFIX_iphoneos); +SYSTEM_VERSION_PREFIX_macosx = $(SYSTEM_VERSION_PREFIX_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +SYSTEM_VERSION_PREFIX_macosx_ = 4; // Some Tiger versions of Xcode don't set MAC_OS_X_VERSION_MAJOR. +SYSTEM_VERSION_PREFIX_macosx_1040 = 4; +SYSTEM_VERSION_PREFIX_macosx_1050 = 5; +SYSTEM_VERSION_PREFIX_macosx_1060 = 6; +SYSTEM_VERSION_PREFIX_macosx_1070 = 7; // The production build always uses the full version with a system version prefix. BUNDLE_VERSION_Production = $(SYSTEM_VERSION_PREFIX)$(FULL_VERSION); diff --git a/WebCore/Configurations/WebCore.xcconfig b/WebCore/Configurations/WebCore.xcconfig index a918146..73e3519 100644 --- a/WebCore/Configurations/WebCore.xcconfig +++ b/WebCore/Configurations/WebCore.xcconfig @@ -1,4 +1,4 @@ -// Copyright (C) 2009 Apple Inc. All rights reserved. +// Copyright (C) 2009, 2010 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,39 +26,65 @@ EXPORTED_SYMBOLS_FILE = $(EXPORTED_SYMBOLS_FILE_$(CURRENT_ARCH)); EXPORTED_SYMBOLS_FILE_ = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/WebCore.exp; +EXPORTED_SYMBOLS_FILE_armv5 = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/WebCore.LP64.exp; +EXPORTED_SYMBOLS_FILE_armv6 = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/WebCore.LP64.exp; +EXPORTED_SYMBOLS_FILE_armv7 = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/WebCore.LP64.exp; EXPORTED_SYMBOLS_FILE_i386 = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/WebCore.exp; EXPORTED_SYMBOLS_FILE_ppc = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/WebCore.exp; EXPORTED_SYMBOLS_FILE_ppc64 = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/WebCore.LP64.exp; EXPORTED_SYMBOLS_FILE_x86_64 = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/WebCore.LP64.exp; GCC_PREFIX_HEADER = WebCorePrefix.h; GCC_PREPROCESSOR_DEFINITIONS = $(DEBUG_DEFINES) $(FEATURE_DEFINES) WEBKIT_VERSION_MIN_REQUIRED=WEBKIT_VERSION_LATEST $(GCC_PREPROCESSOR_DEFINITIONS); -FRAMEWORK_SEARCH_PATHS = $(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks $(FRAMEWORK_SEARCH_PATHS); +FRAMEWORK_SEARCH_PATHS = $(FRAMEWORK_SEARCH_PATHS_$(REAL_PLATFORM_NAME)); +FRAMEWORK_SEARCH_PATHS_iphoneos = $(FRAMEWORK_SEARCH_PATHS_iphoneos_$(CONFIGURATION)); +FRAMEWORK_SEARCH_PATHS_iphoneos_Debug = $(BUILT_PRODUCTS_DIR) $(PRODUCTION_FRAMEWORKS_DIR); +FRAMEWORK_SEARCH_PATHS_iphoneos_Release = $(FRAMEWORK_SEARCH_PATHS_iphoneos_Debug); +FRAMEWORK_SEARCH_PATHS_iphoneos_Production = $(PRODUCTION_FRAMEWORKS_DIR); +FRAMEWORK_SEARCH_PATHS_iphonesimulator = $(FRAMEWORK_SEARCH_PATHS_iphoneos_$(CONFIGURATION)); +FRAMEWORK_SEARCH_PATHS_macosx = $(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks $(FRAMEWORK_SEARCH_PATHS); + HEADER_SEARCH_PATHS = ForwardingHeaders icu /usr/include/libxslt /usr/include/libxml2 $(SQLITE3_HEADER_SEARCH_PATHS) "${BUILT_PRODUCTS_DIR}/DerivedSources/WebCore" $(HEADER_SEARCH_PATHS); INFOPLIST_FILE = Info.plist; -INSTALL_PATH = $(SYSTEM_LIBRARY_DIR)/Frameworks/WebKit.framework/Versions/A/Frameworks; +INSTALL_PATH = $(INSTALL_PATH_$(REAL_PLATFORM_NAME)); +INSTALL_PATH_macosx = $(SYSTEM_LIBRARY_DIR)/Frameworks/WebKit.framework/Versions/A/Frameworks; INSTALLHDRS_COPY_PHASE = YES; INSTALLHDRS_SCRIPT_PHASE = YES; PRODUCT_NAME = WebCore; +OTHER_LDFLAGS_BASE = -l$(SQLITE3_LIBRARY) -lobjc; +OTHER_LDFLAGS = $(OTHER_LDFLAGS_$(REAL_PLATFORM_NAME)); +OTHER_LDFLAGS_iphoneos = $(OTHER_LDFLAGS_BASE) -framework CFNetwork -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework GraphicsServices -framework ImageIO -framework QuartzCore; +OTHER_LDFLAGS_iphonesimulator = $(OTHER_LDFLAGS_iphoneos); +OTHER_LDFLAGS_macosx = $(OTHER_LDFLAGS_BASE) -sub_library libobjc -umbrella WebKit $(WEBKIT2_LDFLAGS); -OTHER_LDFLAGS = -l$(SQLITE3_LIBRARY) -lobjc -sub_library libobjc -umbrella WebKit $(WEBKIT2_LDFLAGS); +PRODUCTION_FRAMEWORKS_DIR = $(PRODUCTION_FRAMEWORKS_DIR_$(REAL_PLATFORM_NAME)); +PRODUCTION_FRAMEWORKS_DIR_iphoneos = $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks; +PRODUCTION_FRAMEWORKS_DIR_iphonesimulator = $(PRODUCTION_FRAMEWORKS_DIR_iphoneos); +PRODUCTION_FRAMEWORKS_DIR_macosx = $(NEXT_ROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks; WEBKIT2_LDFLAGS = $(WEBKIT2_LDFLAGS_$(TARGET_MAC_OS_X_VERSION_MAJOR)); WEBKIT2_LDFLAGS_1060 = -allowable_client WebKit2; WEBKIT2_LDFLAGS_1070 = $(WEBKIT2_LDFLAGS_1060); -JAVASCRIPTCORE_PRIVATE_HEADERS_DIR = $(JAVASCRIPTCORE_PRIVATE_HEADERS_DIR_$(REAL_PLATFORM_NAME)_$(CONFIGURATION)); -JAVASCRIPTCORE_PRIVATE_HEADERS_DIR_macosx_Release = $(JAVASCRIPTCORE_PRIVATE_HEADERS_engineering); -JAVASCRIPTCORE_PRIVATE_HEADERS_DIR_macosx_Debug = $(JAVASCRIPTCORE_PRIVATE_HEADERS_engineering); -JAVASCRIPTCORE_PRIVATE_HEADERS_DIR_macosx_Production = $(NEXT_ROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/JavaScriptCore.framework/PrivateHeaders; +JAVASCRIPTCORE_PRIVATE_HEADERS_DIR = $(JAVASCRIPTCORE_PRIVATE_HEADERS_DIR_$(CONFIGURATION)); +JAVASCRIPTCORE_PRIVATE_HEADERS_DIR_Release = $(JAVASCRIPTCORE_PRIVATE_HEADERS_engineering); +JAVASCRIPTCORE_PRIVATE_HEADERS_DIR_Debug = $(JAVASCRIPTCORE_PRIVATE_HEADERS_engineering); +JAVASCRIPTCORE_PRIVATE_HEADERS_DIR_Production = $(PRODUCTION_FRAMEWORKS_DIR)/JavaScriptCore.framework/PrivateHeaders; JAVASCRIPTCORE_PRIVATE_HEADERS_engineering = $(BUILT_PRODUCTS_DIR)/JavaScriptCore.framework/PrivateHeaders; -EXCLUDED_SOURCE_FILE_NAMES = $(EXCLUDED_SOURCE_FILE_NAMES_$(ENABLE_SVG_DOM_OBJC_BINDINGS)) -EXCLUDED_SOURCE_FILE_NAMES_ = DOMSVG*.* DOMHTMLFrameElementPrivate.h DOMHTMLIFrameElementPrivate.h; -EXCLUDED_SOURCE_FILE_NAMES_ENABLE_SVG_DOM_OBJC_BINDINGS = ; +EXCLUDED_SOURCE_FILE_NAMES_SVG_DOM_OBJC_BINDINGS = $(EXCLUDED_SOURCE_FILE_NAMES_SVG_DOM_OBJC_BINDINGS_$(ENABLE_SVG_DOM_OBJC_BINDINGS)); +EXCLUDED_SOURCE_FILE_NAMES_SVG_DOM_OBJC_BINDINGS_ = DOMSVG*.* DOMHTMLFrameElementPrivate.h DOMHTMLIFrameElementPrivate.h; +EXCLUDED_SOURCE_FILE_NAMES_SVG_DOM_OBJC_BINDINGS_ENABLE_SVG_DOM_OBJC_BINDINGS = ; + +EXCLUDED_SOURCE_FILE_NAMES = $(EXCLUDED_SOURCE_FILE_NAMES_$(REAL_PLATFORM_NAME)) $(EXCLUDED_SOURCE_FILE_NAMES_SVG_DOM_OBJC_BINDINGS); +EXCLUDED_SOURCE_FILE_NAMES_iphoneos = *.tiff *Cursor.png localizedStrings.js; +EXCLUDED_SOURCE_FILE_NAMES_iphonesimulator = $(EXCLUDED_SOURCE_FILE_NAMES_iphoneos); -SQLITE3_LIBRARY = $(SQLITE3_LIBRARY_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -SQLITE3_LIBRARY_ = WebCoreSQLite3; -SQLITE3_LIBRARY_1040 = WebCoreSQLite3; -SQLITE3_LIBRARY_1050 = WebCoreSQLite3; -SQLITE3_LIBRARY_1060 = sqlite3; -SQLITE3_LIBRARY_1070 = sqlite3; +SQLITE3_LIBRARY = $(SQLITE3_LIBRARY_$(REAL_PLATFORM_NAME)); +SQLITE3_LIBRARY_iphoneos = sqlite3; +SQLITE3_LIBRARY_iphonesimulator = sqlite3; +SQLITE3_LIBRARY_macosx = $(SQLITE3_LIBRARY_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +SQLITE3_LIBRARY_macosx_ = $(SQLITE3_LIBRARY_macosx_1040); +SQLITE3_LIBRARY_macosx_1040 = WebCoreSQLite3; +SQLITE3_LIBRARY_macosx_1050 = WebCoreSQLite3; +SQLITE3_LIBRARY_macosx_1060 = sqlite3; +SQLITE3_LIBRARY_macosx_1070 = sqlite3; diff --git a/WebCore/DerivedSources.cpp b/WebCore/DerivedSources.cpp index ea6e47e..3e5fb60 100644 --- a/WebCore/DerivedSources.cpp +++ b/WebCore/DerivedSources.cpp @@ -181,14 +181,14 @@ #include "JSIDBDatabaseRequest.cpp" #include "JSIDBErrorEvent.cpp" #include "JSIDBEvent.cpp" -#include "JSIDBIndexRequest.cpp" +#include "JSIDBFactory.cpp" +#include "JSIDBIndex.cpp" #include "JSIDBKey.cpp" #include "JSIDBKeyRange.cpp" #include "JSIDBObjectStoreRequest.cpp" #include "JSIDBRequest.cpp" #include "JSIDBSuccessEvent.cpp" #include "JSImageData.cpp" -#include "JSIndexedDatabaseRequest.cpp" #include "JSInjectedScriptHost.cpp" #include "JSInspectorFrontendHost.cpp" #include "JSJavaScriptCallFrame.cpp" diff --git a/WebCore/DerivedSources.make b/WebCore/DerivedSources.make index 3b0f38d..3f2f0f4 100644 --- a/WebCore/DerivedSources.make +++ b/WebCore/DerivedSources.make @@ -111,6 +111,7 @@ DOM_CLASSES = \ DedicatedWorkerContext \ DOMApplicationCache \ DOMCoreException \ + DOMFileSystem \ DOMFormData \ DOMImplementation \ DOMMimeType \ @@ -133,6 +134,9 @@ DOM_CLASSES = \ ElementTimeControl \ Entity \ EntityReference \ + Entry \ + EntryCallback \ + ErrorCallback \ ErrorEvent \ Event \ EventException \ @@ -143,6 +147,8 @@ DOM_CLASSES = \ FileError \ FileList \ FileReader \ + FileSystemCallback \ + Flags \ Geolocation \ Geoposition \ HTMLAllCollection \ @@ -224,14 +230,14 @@ DOM_CLASSES = \ IDBDatabaseRequest \ IDBErrorEvent \ IDBEvent \ - IDBIndexRequest \ + IDBFactory \ + IDBIndex \ IDBKey \ IDBKeyRange \ IDBObjectStoreRequest \ IDBRequest \ IDBSuccessEvent \ ImageData \ - IndexedDatabaseRequest \ InjectedScriptHost \ InspectorFrontendHost \ KeyboardEvent \ @@ -242,6 +248,8 @@ DOM_CLASSES = \ MessageChannel \ MessageEvent \ MessagePort \ + Metadata \ + MetadataCallback \ MouseEvent \ MutationEvent \ NamedNodeMap \ diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am index 8389ed6..885bd6c 100644 --- a/WebCore/GNUmakefile.am +++ b/WebCore/GNUmakefile.am @@ -1897,8 +1897,12 @@ webcore_sources += \ WebCore/platform/Logging.h \ WebCore/platform/MIMETypeRegistry.cpp \ WebCore/platform/MIMETypeRegistry.h \ + WebCore/platform/mock/DeviceOrientationClientMock.cpp \ + WebCore/platform/mock/DeviceOrientationClientMock.h \ WebCore/platform/mock/GeolocationServiceMock.cpp \ WebCore/platform/mock/GeolocationServiceMock.h \ + WebCore/platform/mock/SpeechInputClientMock.cpp \ + WebCore/platform/mock/SpeechInputClientMock.h \ WebCore/platform/NotImplemented.h \ WebCore/platform/Pasteboard.h \ WebCore/platform/PlatformKeyboardEvent.h \ @@ -2420,8 +2424,11 @@ webcoregtk_sources += \ WebCore/platform/graphics/cairo/PatternCairo.cpp \ WebCore/platform/graphics/cairo/TransformationMatrixCairo.cpp \ WebCore/platform/graphics/gtk/ColorGtk.cpp \ + WebCore/platform/graphics/gtk/CairoUtilities.cpp \ + WebCore/platform/graphics/gtk/CairoUtilities.h \ WebCore/platform/graphics/gtk/FontGtk.cpp \ WebCore/platform/graphics/gtk/IconGtk.cpp \ + WebCore/platform/graphics/gtk/ImageBufferGtk.cpp \ WebCore/platform/graphics/gtk/ImageGtk.cpp \ WebCore/platform/graphics/gtk/IntPointGtk.cpp \ WebCore/platform/graphics/gtk/IntRectGtk.cpp \ @@ -2461,6 +2468,7 @@ webcoregtk_sources += \ WebCore/platform/gtk/PasteboardHelper.h \ WebCore/platform/gtk/PlatformScreenGtk.cpp \ WebCore/platform/gtk/PopupMenuGtk.cpp \ + WebCore/platform/gtk/PopupMenuGtk.h \ WebCore/platform/gtk/RenderThemeGtk.cpp \ WebCore/platform/gtk/RenderThemeGtk.h \ WebCore/platform/gtk/ScrollbarGtk.cpp \ @@ -2469,6 +2477,7 @@ webcoregtk_sources += \ WebCore/platform/gtk/ScrollbarThemeGtk.h \ WebCore/platform/gtk/ScrollViewGtk.cpp \ WebCore/platform/gtk/SearchPopupMenuGtk.cpp \ + WebCore/platform/gtk/SearchPopupMenuGtk.h \ WebCore/platform/gtk/SharedBufferGtk.cpp \ WebCore/platform/gtk/SharedTimerGtk.cpp \ WebCore/platform/gtk/SoundGtk.cpp \ @@ -2832,8 +2841,10 @@ webcore_built_sources += \ DerivedSources/WebCore/JSIDBErrorEvent.h \ DerivedSources/WebCore/JSIDBEvent.cpp \ DerivedSources/WebCore/JSIDBEvent.h \ - DerivedSources/WebCore/JSIDBIndexRequest.cpp \ - DerivedSources/WebCore/JSIDBIndexRequest.h \ + DerivedSources/WebCore/JSIDBFactory.cpp \ + DerivedSources/WebCore/JSIDBFactory.h \ + DerivedSources/WebCore/JSIDBIndex.cpp \ + DerivedSources/WebCore/JSIDBIndex.h \ DerivedSources/WebCore/JSIDBKeyRange.cpp \ DerivedSources/WebCore/JSIDBKeyRange.h \ DerivedSources/WebCore/JSIDBObjectStoreRequest.cpp \ @@ -2841,9 +2852,7 @@ webcore_built_sources += \ DerivedSources/WebCore/JSIDBRequest.cpp \ DerivedSources/WebCore/JSIDBRequest.h \ DerivedSources/WebCore/JSIDBSuccessEvent.cpp \ - DerivedSources/WebCore/JSIDBSuccessEvent.h \ - DerivedSources/WebCore/JSIndexedDatabaseRequest.cpp \ - DerivedSources/WebCore/JSIndexedDatabaseRequest.h + DerivedSources/WebCore/JSIDBSuccessEvent.h webcore_sources += \ WebCore/storage/IDBAny.cpp \ @@ -2860,11 +2869,11 @@ webcore_sources += \ WebCore/storage/IDBErrorEvent.h \ WebCore/storage/IDBEvent.cpp \ WebCore/storage/IDBEvent.h \ + WebCore/storage/IDBIndex.cpp \ WebCore/storage/IDBIndex.h \ - WebCore/storage/IDBIndexImpl.cpp \ - WebCore/storage/IDBIndexImpl.h \ - WebCore/storage/IDBIndexRequest.cpp \ - WebCore/storage/IDBIndexRequest.h \ + WebCore/storage/IDBIndexBackendInterface.h \ + WebCore/storage/IDBIndexBackendImpl.cpp \ + WebCore/storage/IDBIndexBackendImpl.h \ WebCore/storage/IDBKeyRange.cpp \ WebCore/storage/IDBKeyRange.h \ WebCore/storage/IDBObjectStore.h \ @@ -2876,12 +2885,12 @@ webcore_sources += \ WebCore/storage/IDBRequest.h \ WebCore/storage/IDBSuccessEvent.cpp \ WebCore/storage/IDBSuccessEvent.h \ - WebCore/storage/IndexedDatabase.cpp \ - WebCore/storage/IndexedDatabase.h \ - WebCore/storage/IndexedDatabaseImpl.cpp \ - WebCore/storage/IndexedDatabaseImpl.h \ - WebCore/storage/IndexedDatabaseRequest.cpp \ - WebCore/storage/IndexedDatabaseRequest.h + WebCore/storage/IDBFactory.cpp \ + WebCore/storage/IDBFactory.h \ + WebCore/storage/IDBFactoryBackendInterface.cpp \ + WebCore/storage/IDBFactoryBackendInterface.h \ + WebCore/storage/IDBFactoryBackendImpl.cpp \ + WebCore/storage/IDBFactoryBackendImpl.h endif # END ENABLE_INDEXED_DATABASE # ---- diff --git a/WebCore/WebCore.exp.in b/WebCore/WebCore.exp.in index c1079d5..c07a5b8 100644 --- a/WebCore/WebCore.exp.in +++ b/WebCore/WebCore.exp.in @@ -217,7 +217,7 @@ __ZN7WebCore12EventHandler15sendScrollEventEv __ZN7WebCore12EventHandler16handleWheelEventERNS_18PlatformWheelEventE __ZN7WebCore12EventHandler17scrollRecursivelyENS_15ScrollDirectionENS_17ScrollGranularityEPNS_4NodeE __ZN7WebCore12EventHandler20handleTextInputEventERKNS_6StringEPNS_5EventEbb -__ZN7WebCore12EventHandler20hitTestResultAtPointERKNS_8IntPointEbbNS_17HitTestScrollbarsEj +__ZN7WebCore12EventHandler20hitTestResultAtPointERKNS_8IntPointEbbNS_17HitTestScrollbarsEjRKNS_7IntSizeE __ZN7WebCore12EventHandler21handleMousePressEventERKNS_18PlatformMouseEventE __ZN7WebCore12EventHandler23handleMouseReleaseEventERKNS_18PlatformMouseEventE __ZN7WebCore12EventHandler27capsLockStateMayHaveChangedEv @@ -250,6 +250,7 @@ __ZN7WebCore12IconDatabase27checkIntegrityBeforeOpeningEv __ZN7WebCore12IconDatabase4openERKNS_6StringE __ZN7WebCore12IconDatabase5closeEv __ZN7WebCore12IconDatabase9setClientEPNS_18IconDatabaseClientE +__ZN7WebCore12PopupMenuMacC1EPNS_15PopupMenuClientE __ZN7WebCore12PrintContext12pagePropertyEPNS_5FrameEPKci __ZN7WebCore12PrintContext13numberOfPagesEPNS_5FrameERKNS_9FloatSizeE __ZN7WebCore12PrintContext16isPageBoxVisibleEPNS_5FrameEi @@ -361,6 +362,7 @@ __ZN7WebCore15StringTruncator5widthERKNS_6StringERKNS_4FontEb __ZN7WebCore15VisiblePositionC1EPNS_4NodeEiNS_9EAffinityE __ZN7WebCore15VisiblePositionC1ERKNS_8PositionENS_9EAffinityE __ZN7WebCore15reportExceptionEPN3JSC9ExecStateENS0_7JSValueE +__ZN7WebCore15visitedLinkHashEPKtj __ZN7WebCore16AbstractDatabase14setIsAvailableEb __ZN7WebCore16FontFallbackList15releaseFontDataEv __ZN7WebCore16FontPlatformDataC1EP6NSFontbb @@ -402,6 +404,7 @@ __ZN7WebCore16isEndOfParagraphERKNS_15VisiblePositionE __ZN7WebCore16jsStringSlowCaseEPN3JSC9ExecStateERNS0_9WeakGCMapIPNS_10StringImplEPNS0_8JSStringEEES5_ __ZN7WebCore17CredentialStorage3getERKNS_15ProtectionSpaceE __ZN7WebCore17DOMImplementation14isTextMIMETypeERKNS_6StringE +__ZN7WebCore17DeviceOrientation6createEbdbdbd __ZN7WebCore17GlyphPageTreeNode18treeGlyphPageCountEv __ZN7WebCore17HTMLPlugInElement11getNPObjectEv __ZN7WebCore17HistoryController26saveDocumentAndScrollStateEv @@ -410,6 +413,7 @@ __ZN7WebCore17openTemporaryFileEPKcRi __ZN7WebCore18deprecatedParseURLERKNS_6StringE __ZN7WebCore18isStartOfParagraphERKNS_15VisiblePositionE __ZN7WebCore18pluginScriptObjectEPN3JSC9ExecStateEPNS_13JSHTMLElementE +__ZN7WebCore18SearchPopupMenuMacC1EPNS_15PopupMenuClientE __ZN7WebCore19AnimationController16resumeAnimationsEPNS_8DocumentE __ZN7WebCore19AnimationController17suspendAnimationsEPNS_8DocumentE __ZN7WebCore19AnimationController20pauseAnimationAtTimeEPNS_12RenderObjectERKNS_6StringEd @@ -458,11 +462,6 @@ __ZN7WebCore22contextMenuItemTagBoldEv __ZN7WebCore22counterValueForElementEPNS_7ElementE __ZN7WebCore22createFragmentFromTextEPNS_5RangeERKNS_6StringE __ZN7WebCore22externalRepresentationEPNS_5FrameEj -__ZN7WebCore23ApplicationCacheStorage14setMaximumSizeEx -__ZN7WebCore23ApplicationCacheStorage16storeCopyOfCacheERKNS_6StringEPNS_20ApplicationCacheHostE -__ZN7WebCore23ApplicationCacheStorage17setCacheDirectoryERKNS_6StringE -__ZN7WebCore23ApplicationCacheStorage18vacuumDatabaseFileEv -__ZN7WebCore23ApplicationCacheStorage5emptyEv __ZN7WebCore23ReplaceSelectionCommandC1EPNS_8DocumentEN3WTF10PassRefPtrINS_16DocumentFragmentEEEbbbbbNS_10EditActionE __ZN7WebCore23createFragmentFromNodesEPNS_8DocumentERKN3WTF6VectorIPNS_4NodeELm0EEE __ZN7WebCore24BinaryPropertyListWriter17writePropertyListEv @@ -490,6 +489,8 @@ __ZN7WebCore26contextMenuItemTagFontMenuEv __ZN7WebCore26contextMenuItemTagOpenLinkEv __ZN7WebCore26usesTestModeFocusRingColorEv __ZN7WebCore27CSSComputedStyleDeclarationC1EN3WTF10PassRefPtrINS_4NodeEEEbRKNS_6StringE +__ZN7WebCore27DeviceOrientationClientMock14setOrientationEN3WTF10PassRefPtrINS_17DeviceOrientationEEE +__ZN7WebCore27DeviceOrientationClientMockC1Ev __ZN7WebCore27applicationIsAdobeInstallerEv __ZN7WebCore27contextMenuItemTagShowFontsEv __ZN7WebCore27contextMenuItemTagUnderlineEv @@ -596,6 +597,7 @@ __ZN7WebCore5Range6setEndEN3WTF10PassRefPtrINS_4NodeEEEiRi __ZN7WebCore5Range8setStartEN3WTF10PassRefPtrINS_4NodeEEEiRi __ZN7WebCore5RangeD1Ev __ZN7WebCore5cacheEv +__ZN7WebCore6Chrome16setStatusbarTextEPNS_5FrameERKNS_6StringE __ZN7WebCore6Cursor8fromTypeENS0_4TypeE __ZN7WebCore6CursorD1Ev __ZN7WebCore6CursoraSERKS0_ @@ -770,7 +772,7 @@ __ZN7WebCore9FrameView21flushDeferredRepaintsEv __ZN7WebCore9FrameView22setBaseBackgroundColorENS_5ColorE __ZN7WebCore9FrameView23layoutIfNeededRecursiveEv __ZN7WebCore9FrameView23updateCanHaveScrollbarsEv -__ZN7WebCore9FrameView29forceLayoutWithPageWidthRangeEffb +__ZN7WebCore9FrameView24forceLayoutForPaginationERKNS_9FloatSizeEfNS_5Frame19AdjustViewSizeOrNotE __ZN7WebCore9FrameView29setShouldUpdateWhileOffscreenEb __ZN7WebCore9FrameView29syncCompositingStateRecursiveEv __ZN7WebCore9FrameView38scrollPositionChangedViaPlatformWidgetEv @@ -813,8 +815,10 @@ __ZN7WebCore9HTMLNames9scriptTagE __ZN7WebCore9JSElement6s_infoE __ZN7WebCore9PageCache11setCapacityEi __ZN7WebCore9PageCache27releaseAutoreleasedPagesNowEv +__ZN7WebCore9PageGroup13isLinkVisitedEy __ZN7WebCore9PageGroup14addVisitedLinkEPKtm __ZN7WebCore9PageGroup17closeLocalStorageEv +__ZN7WebCore9PageGroup18addVisitedLinkHashEy __ZN7WebCore9PageGroup20addUserScriptToWorldEPNS_15DOMWrapperWorldERKNS_6StringERKNS_4KURLEN3WTF10PassOwnPtrINS9_6VectorIS3_Lm0EEEEESD_NS_23UserScriptInjectionTimeENS_25UserContentInjectedFramesE __ZN7WebCore9PageGroup20removeAllUserContentEv __ZN7WebCore9PageGroup21removeAllVisitedLinksEv @@ -848,6 +852,7 @@ __ZNK7WebCore10ScrollView16contentsToWindowERKNS_7IntRectE __ZNK7WebCore10ScrollView18visibleContentRectEb __ZNK7WebCore11CachedImage5imageEv __ZNK7WebCore11FrameLoader10isCompleteEv +__ZNK7WebCore11FrameLoader14cancelledErrorERKNS_15ResourceRequestE __ZNK7WebCore11FrameLoader14frameHasLoadedEv __ZNK7WebCore11FrameLoader16outgoingReferrerEv __ZNK7WebCore11FrameLoader20activeDocumentLoaderEv @@ -1464,3 +1469,17 @@ __ZN7WebCore16HTMLMediaElement19setMediaPlayerProxyEP19WebMediaPlayerProxy __ZN7WebCore9HTMLNames8audioTagE __ZN7WebCore9HTMLNames8videoTagE #endif + +#if ENABLE(OFFLINE_WEB_APPLICATIONS) +__ZN7WebCore23ApplicationCacheStorage14quotaForOriginEPKNS_14SecurityOriginERx +__ZN7WebCore23ApplicationCacheStorage14setMaximumSizeEx +__ZN7WebCore23ApplicationCacheStorage14usageForOriginEPKNS_14SecurityOriginERx +__ZN7WebCore23ApplicationCacheStorage16storeCopyOfCacheERKNS_6StringEPNS_20ApplicationCacheHostE +__ZN7WebCore23ApplicationCacheStorage17setCacheDirectoryERKNS_6StringE +__ZN7WebCore23ApplicationCacheStorage18vacuumDatabaseFileEv +__ZN7WebCore23ApplicationCacheStorage21setDefaultOriginQuotaEx +__ZN7WebCore23ApplicationCacheStorage26storeUpdatedQuotaForOriginEPKNS_14SecurityOriginEx +__ZN7WebCore23ApplicationCacheStorage36remainingSizeForOriginExcludingCacheEPKNS_14SecurityOriginEPNS_16ApplicationCacheERx +__ZN7WebCore23ApplicationCacheStorage5emptyEv +__ZNK7WebCore23ApplicationCacheStorage11maximumSizeEv +#endif diff --git a/WebCore/WebCore.gyp/WebCore.gyp b/WebCore/WebCore.gyp/WebCore.gyp index abd49e7..5ecb48a 100644 --- a/WebCore/WebCore.gyp/WebCore.gyp +++ b/WebCore/WebCore.gyp/WebCore.gyp @@ -841,8 +841,8 @@ # Don't build StorageEventDispatcher. We have our own implementation. '../storage/StorageEventDispatcher.cpp', - # Don't build IndexedDatabase. We have our own implementation. - '../storage/IndexedDatabase.cpp', + # Don't build IDBFactoryBackendInterface. We have our own implementation. + '../storage/IDBFactoryBackendInterface.cpp', # Use history/BackForwardListChromium.cpp instead. '../history/BackForwardListImpl.cpp', diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi index 698e302..20482bb 100644 --- a/WebCore/WebCore.gypi +++ b/WebCore/WebCore.gypi @@ -230,19 +230,27 @@ 'storage/Database.idl', 'storage/DatabaseCallback.idl', 'storage/DatabaseSync.idl', + 'storage/DOMFileSystem.idl', + 'storage/Entry.idl', + 'storage/EntryCallback.idl', + 'storage/ErrorCallback.idl', + 'storage/FileSystemCallback.idl', + 'storage/Flags.idl', 'storage/IDBAny.idl', 'storage/IDBDatabaseError.idl', 'storage/IDBDatabaseException.idl', 'storage/IDBDatabaseRequest.idl', 'storage/IDBErrorEvent.idl', 'storage/IDBEvent.idl', - 'storage/IDBIndexRequest.idl', + 'storage/IDBFactory.idl', + 'storage/IDBIndex.idl', 'storage/IDBKey.idl', 'storage/IDBKeyRange.idl', 'storage/IDBObjectStoreRequest.idl', 'storage/IDBRequest.idl', 'storage/IDBSuccessEvent.idl', - 'storage/IndexedDatabaseRequest.idl', + 'storage/Metadata.idl', + 'storage/MetadataCallback.idl', 'storage/SQLError.idl', 'storage/SQLException.idl', 'storage/SQLResultSet.idl', @@ -2122,6 +2130,7 @@ 'platform/chromium/ScrollbarThemeChromiumMac.mm', 'platform/chromium/ScrollbarThemeChromiumWin.cpp', 'platform/chromium/SearchPopupMenuChromium.cpp', + 'platform/chromium/SearchPopupMenuChromium.h', 'platform/chromium/SharedTimerChromium.cpp', 'platform/chromium/SoundChromiumPosix.cpp', 'platform/chromium/SoundChromiumWin.cpp', @@ -2614,6 +2623,7 @@ 'platform/mac/PasteboardMac.mm', 'platform/mac/PlatformMouseEventMac.mm', 'platform/mac/PlatformScreenMac.mm', + 'platform/mac/PopupMenuMac.h', 'platform/mac/PopupMenuMac.mm', 'platform/mac/PurgeableBufferMac.cpp', 'platform/mac/SSLKeyGeneratorMac.mm', @@ -2621,6 +2631,7 @@ 'platform/mac/ScrollViewMac.mm', 'platform/mac/ScrollbarThemeMac.h', 'platform/mac/ScrollbarThemeMac.mm', + 'platform/mac/SearchPopupMenuMac.h', 'platform/mac/SearchPopupMenuMac.mm', 'platform/mac/SharedBufferMac.mm', 'platform/mac/SharedTimerMac.mm', @@ -2771,6 +2782,7 @@ 'platform/qt/PlatformMouseEventQt.cpp', 'platform/qt/PlatformScreenQt.cpp', 'platform/qt/PopupMenuQt.cpp', + 'platform/qt/PopupMenuQt.h', 'platform/qt/QWebPopup.cpp', 'platform/qt/QWebPopup.h', 'platform/qt/RenderThemeQt.cpp', @@ -2781,6 +2793,7 @@ 'platform/qt/ScrollbarThemeQt.cpp', 'platform/qt/ScrollbarThemeQt.h', 'platform/qt/SearchPopupMenuQt.cpp', + 'platform/qt/SearchPopupMenuQt.h', 'platform/qt/SharedBufferQt.cpp', 'platform/qt/SharedTimerQt.cpp', 'platform/qt/SoundQt.cpp', @@ -3012,8 +3025,12 @@ 'platform/Logging.h', 'platform/MIMETypeRegistry.cpp', 'platform/MIMETypeRegistry.h', + 'platform/mock/DeviceOrientationClientMock.cpp', + 'platform/mock/DeviceOrientationClientMock.h', 'platform/mock/GeolocationServiceMock.cpp', 'platform/mock/GeolocationServiceMock.h', + 'platform/mock/SpeechInputClientMock.cpp', + 'platform/mock/SpeechInputClientMock.h', 'platform/NotImplemented.h', 'platform/Pasteboard.h', 'platform/PlatformKeyboardEvent.h', @@ -3448,7 +3465,7 @@ 'storage/ChangeVersionWrapper.cpp', 'storage/ChangeVersionWrapper.h', 'storage/chromium/DatabaseObserver.h', - 'storage/chromium/IndexedDatabase.cpp', + 'storage/chromium/IDBFactoryBackendInterface.cpp', 'storage/chromium/DatabaseTrackerChromium.cpp', 'storage/chromium/QuotaTracker.cpp', 'storage/chromium/QuotaTracker.h', @@ -3468,6 +3485,13 @@ 'storage/DatabaseTracker.cpp', 'storage/DatabaseTracker.h', 'storage/DatabaseTrackerClient.h', + 'storage/DOMFileSystem.cpp', + 'storage/DOMFileSystem.h', + 'storage/Entry.cpp', + 'storage/Entry.h', + 'storage/EntryCallback.h', + 'storage/FileSystemCallback.h', + 'storage/Flags.h', 'storage/IDBAny.cpp', 'storage/IDBAny.h', 'storage/IDBCallbacks.h', @@ -3482,11 +3506,17 @@ 'storage/IDBEvent.h', 'storage/IDBErrorEvent.cpp', 'storage/IDBErrorEvent.h', + 'storage/IDBFactory.cpp', + 'storage/IDBFactory.h', + 'storage/IDBFactoryBackendInterface.cpp', + 'storage/IDBFactoryBackendInterface.h', + 'storage/IDBFactoryBackendImpl.cpp', + 'storage/IDBFactoryBackendImpl.h', + 'storage/IDBIndex.cpp', 'storage/IDBIndex.h', - 'storage/IDBIndexImpl.cpp', - 'storage/IDBIndexImpl.h', - 'storage/IDBIndexRequest.cpp', - 'storage/IDBIndexRequest.h', + 'storage/IDBIndexBackendInterface.h', + 'storage/IDBIndexBackendImpl.cpp', + 'storage/IDBIndexBackendImpl.h', 'storage/IDBKey.cpp', 'storage/IDBKey.h', 'storage/IDBKeyRange.cpp', @@ -3501,16 +3531,12 @@ 'storage/IDBRequest.h', 'storage/IDBSuccessEvent.cpp', 'storage/IDBSuccessEvent.h', - 'storage/IndexedDatabase.cpp', - 'storage/IndexedDatabase.h', - 'storage/IndexedDatabaseImpl.cpp', - 'storage/IndexedDatabaseImpl.h', - 'storage/IndexedDatabaseRequest.cpp', - 'storage/IndexedDatabaseRequest.h', 'storage/LocalStorageTask.cpp', 'storage/LocalStorageTask.h', 'storage/LocalStorageThread.cpp', 'storage/LocalStorageThread.h', + 'storage/Metadata.h', + 'storage/MetadataCallback.h', 'storage/OriginQuotaManager.cpp', 'storage/OriginQuotaManager.h', 'storage/OriginUsageRecord.cpp', @@ -4029,6 +4055,10 @@ 'inspector/front-end/ElementsPanel.js', 'inspector/front-end/ElementsTreeOutline.js', 'inspector/front-end/EventListenersSidebarPane.js', + 'inspector/front-end/ExtensionAPI.js', + 'inspector/front-end/ExtensionPanel.js', + 'inspector/front-end/ExtensionRegistryStub.js', + 'inspector/front-end/ExtensionServer.js', 'inspector/front-end/FontView.js', 'inspector/front-end/HAREntry.js', 'inspector/front-end/HelpScreen.js', diff --git a/WebCore/WebCore.pri b/WebCore/WebCore.pri index ef87a45..ff65cae 100644 --- a/WebCore/WebCore.pri +++ b/WebCore/WebCore.pri @@ -488,13 +488,13 @@ IDL_BINDINGS += \ storage/IDBDatabaseRequest.idl \ storage/IDBErrorEvent.idl \ storage/IDBEvent.idl \ - storage/IDBIndexRequest.idl \ + storage/IDBIndex.idl \ storage/IDBKey.idl \ storage/IDBKeyRange.idl \ storage/IDBObjectStoreRequest.idl \ storage/IDBRequest.idl \ storage/IDBSuccessEvent.idl \ - storage/IndexedDatabaseRequest.idl \ + storage/IDBFactory.idl \ storage/Storage.idl \ storage/StorageEvent.idl \ storage/SQLError.idl \ @@ -667,93 +667,6 @@ IDL_BINDINGS += \ INSPECTOR_INTERFACES = inspector/Inspector.idl -WEBCORE_HEADERS_FOR_WEBKIT2 += \ - bindings/js/DOMWrapperWorld.h \ - platform/FileChooser.h \ - platform/network/qt/ResourceError.h \ - platform/network/qt/ResourceRequest.h \ - platform/network/qt/ResourceResponse.h \ - dom/KeyboardEvent.h \ - editing/EditCommand.h \ - history/BackForwardList.h \ - history/BackForwardControllerClient.h \ - history/HistoryItem.h \ - html/HTMLFormElement.h \ - html/HTMLFrameOwnerElement.h \ - inspector/InspectorClient.h \ - loader/appcache/ApplicationCacheStorage.h \ - loader/DocumentLoader.h \ - loader/FormState.h \ - loader/FrameLoader.h \ - loader/FrameLoaderClient.h \ - loader/FrameLoaderTypes.h \ - loader/PolicyChecker.h \ - loader/ProgressTracker.h \ - page/animation/AnimationController.h \ - page/Chrome.h \ - page/ChromeClient.h \ - page/ContextMenuClient.h \ - page/DragClient.h \ - page/EditorClient.h \ - page/EventHandler.h \ - page/FocusController.h \ - page/Frame.h \ - page/FrameLoadRequest.h \ - page/FrameView.h \ - page/Page.h \ - page/Settings.h \ - page/WindowFeatures.h \ - platform/Cursor.h \ - platform/PlatformKeyboardEvent.h \ - platform/PlatformMouseEvent.h \ - platform/PlatformWheelEvent.h \ - platform/Widget.h \ - platform/KURL.h \ - platform/graphics/Color.h \ - platform/graphics/ColorSpace.h \ - platform/graphics/GraphicsTypes.h \ - platform/graphics/Image.h \ - platform/graphics/ImageSource.h \ - platform/graphics/FloatRect.h \ - platform/graphics/GraphicsContext.h \ - platform/graphics/GraphicsLayerClient.h \ - platform/graphics/IntPoint.h \ - platform/graphics/IntRect.h \ - platform/graphics/IntSize.h \ - platform/graphics/Tile.h \ - platform/graphics/TiledBackingStore.h \ - platform/graphics/TiledBackingStoreClient.h \ - platform/sql/SQLiteDatabase.h \ - platform/text/PlatformString.h \ - platform/text/StringImpl.h \ - platform/MIMETypeRegistry.h \ - rendering/RenderTreeAsText.h \ - plugins/PluginData.h \ - -JSC_HEADERS_FOR_WEBKIT2 += \ - ../JavaScriptCore/runtime/JSObject.h \ - -WEBKIT2_API_HEADERS += \ - ../WebKit2/UIProcess/API/C/WKAPICast.h \ - ../WebKit2/UIProcess/API/C/WKBase.h \ - ../WebKit2/UIProcess/API/C/WKContext.h \ - ../WebKit2/UIProcess/API/C/WKContextPrivate.h \ - ../WebKit2/UIProcess/API/C/WKFrame.h \ - ../WebKit2/UIProcess/API/C/WKFramePolicyListener.h \ - ../WebKit2/UIProcess/API/C/WKNavigationData.h \ - ../WebKit2/UIProcess/API/C/WKPage.h \ - ../WebKit2/UIProcess/API/C/WKPageNamespace.h \ - ../WebKit2/UIProcess/API/C/WKPagePrivate.h \ - ../WebKit2/UIProcess/API/C/WKPreferences.h \ - ../WebKit2/UIProcess/API/C/WKString.h \ - ../WebKit2/UIProcess/API/C/WKURL.h \ - ../WebKit2/UIProcess/API/C/WebKit2.h \ - ../WebKit2/UIProcess/API/cpp/WKRetainPtr.h \ - ../WebKit2/UIProcess/API/qt/qgraphicswkview.h \ - ../WebKit2/UIProcess/API/qt/qwkpage.h \ - ../WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBase.h \ - ../WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h \ - mathmlnames.output = $${WC_GENERATED_SOURCES_DIR}/MathMLNames.cpp mathmlnames.input = MATHML_NAMES mathmlnames.wkScript = $$PWD/dom/make_names.pl @@ -917,31 +830,3 @@ webkitversion.commands = perl $$webkitversion.wkScript --config $$PWD/../WebKit/ webkitversion.clean = ${QMAKE_VAR_WC_GENERATED_SOURCES_DIR}/WebKitVersion.h webkitversion.wkAddOutputToSources = false addExtraCompiler(webkitversion) - -webkit2 { - -# GENERATOR 12: Copy WebCore headers for WebKit2 -webcoreheaders.output = ../include/WebCore/${QMAKE_FILE_BASE}.h -webcoreheaders.input = WEBCORE_HEADERS_FOR_WEBKIT2 -webcoreheaders.commands = $$QMAKE_COPY ${QMAKE_FILE_NAME} ${QMAKE_FILE_OUT} -webcoreheaders.clean = ${QMAKE_FILE_OUT} -webcoreheaders.wkAddOutputToSources = false -addExtraCompiler(webcoreheaders) - -# GENERATOR 12-B: Copy JavaScriptCore headers for WebKit2 -jscheaders.output = ../include/JavaScriptCore/${QMAKE_FILE_BASE}.h -jscheaders.input = JSC_HEADERS_FOR_WEBKIT2 -jscheaders.commands = $$QMAKE_COPY ${QMAKE_FILE_NAME} ${QMAKE_FILE_OUT} -jscheaders.clean = ${QMAKE_FILE_OUT} -jscheaders.wkAddOutputToSources = false -addExtraCompiler(jscheaders) - -# GENERATOR 13: Copy WebKit2 headers -webkit2headers.output = ../include/WebKit2/${QMAKE_FILE_BASE}.h -webkit2headers.input = WEBKIT2_API_HEADERS -webkit2headers.commands = $$QMAKE_COPY ${QMAKE_FILE_NAME} ${QMAKE_FILE_OUT} -webkit2headers.clean = ${QMAKE_FILE_OUT} -webkit2headers.wkAddOutputToSources = false -addExtraCompiler(webkit2headers) - -} diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro index b7f152e..03af4df 100644 --- a/WebCore/WebCore.pro +++ b/WebCore/WebCore.pro @@ -912,7 +912,9 @@ SOURCES += \ platform/LinkHash.cpp \ platform/Logging.cpp \ platform/MIMETypeRegistry.cpp \ + platform/mock/DeviceOrientationClientMock.cpp \ platform/mock/GeolocationServiceMock.cpp \ + platform/mock/SpeechInputClientMock.cpp \ platform/network/AuthenticationChallengeBase.cpp \ platform/network/Credential.cpp \ platform/network/FormData.cpp \ @@ -1630,7 +1632,9 @@ HEADERS += \ platform/FileChooser.h \ platform/GeolocationService.h \ platform/image-decoders/ImageDecoder.h \ + platform/mock/DeviceOrientationClientMock.h \ platform/mock/GeolocationServiceMock.h \ + platform/mock/SpeechInputClientMock.h \ platform/graphics/BitmapImage.h \ platform/graphics/Color.h \ platform/graphics/filters/FEBlend.h \ @@ -1705,6 +1709,7 @@ HEADERS += \ platform/network/ResourceResponseBase.h \ platform/PlatformTouchEvent.h \ platform/PlatformTouchPoint.h \ + platform/PopupMenu.h \ platform/qt/ClipboardQt.h \ platform/qt/QWebPageClient.h \ platform/qt/QtAbstractWebPopup.h \ @@ -1714,6 +1719,7 @@ HEADERS += \ platform/Scrollbar.h \ platform/ScrollbarThemeComposite.h \ platform/ScrollView.h \ + platform/SearchPopupMenu.h \ platform/SharedBuffer.h \ platform/sql/SQLiteDatabase.h \ platform/sql/SQLiteFileSystem.h \ @@ -2268,8 +2274,7 @@ maemo5 { mac { SOURCES += \ platform/text/cf/StringCF.cpp \ - platform/text/cf/StringImplCF.cpp \ - platform/cf/SharedBufferCF.cpp + platform/text/cf/StringImplCF.cpp LIBS_PRIVATE += -framework Carbon -framework AppKit } @@ -2425,19 +2430,19 @@ contains(DEFINES, ENABLE_INDEXED_DATABASE=1) { storage/IDBDatabaseRequest.h \ storage/IDBErrorEvent.h \ storage/IDBEvent.h \ + storage/IDBFactory.h \ + storage/IDBFactoryBackendInterface.h \ + storage/IDBFactoryBackendImpl.h \ storage/IDBIndex.h \ - storage/IDBIndexImpl.h \ - storage/IDBIndexRequest.h \ + storage/IDBIndexBackendInterface.h \ + storage/IDBIndexBackendImpl.h \ storage/IDBKey.h \ storage/IDBKeyRange.h \ storage/IDBObjectStore.h \ storage/IDBObjectStoreImpl.h \ storage/IDBObjectStoreRequest.h \ storage/IDBRequest.h \ - storage/IDBSuccessEvent.h \ - storage/IndexedDatabase.h \ - storage/IndexedDatabaseImpl.h \ - storage/IndexedDatabaseRequest.h + storage/IDBSuccessEvent.h SOURCES += \ bindings/js/IDBBindingUtilities.cpp \ @@ -2448,17 +2453,17 @@ contains(DEFINES, ENABLE_INDEXED_DATABASE=1) { storage/IDBDatabaseRequest.cpp \ storage/IDBErrorEvent.cpp \ storage/IDBEvent.cpp \ - storage/IDBIndexImpl.cpp \ - storage/IDBIndexRequest.cpp \ + storage/IDBFactory.cpp \ + storage/IDBFactoryBackendInterface.cpp \ + storage/IDBFactoryBackendImpl.cpp \ + storage/IDBIndex.cpp \ + storage/IDBIndexBackendImpl.cpp \ storage/IDBKey.cpp \ storage/IDBKeyRange.cpp \ storage/IDBObjectStoreImpl.cpp \ storage/IDBObjectStoreRequest.cpp \ storage/IDBRequest.cpp \ - storage/IDBSuccessEvent.cpp \ - storage/IndexedDatabase.cpp \ - storage/IndexedDatabaseImpl.cpp \ - storage/IndexedDatabaseRequest.cpp + storage/IDBSuccessEvent.cpp } contains(DEFINES, ENABLE_DOM_STORAGE=1) { @@ -3293,6 +3298,8 @@ HEADERS += \ ../WebKit2/WebProcess/WebCoreSupport/WebErrors.h \ ../WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h \ ../WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.h \ + ../WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.h \ + ../WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.h \ ../WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.h \ ../WebKit2/WebProcess/WebPage/DrawingArea.h \ ../WebKit2/WebProcess/WebPage/WebFrame.h \ @@ -3365,6 +3372,8 @@ SOURCES += \ ../WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp \ ../WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp \ ../WebKit2/WebProcess/WebCoreSupport/WebBackForwardControllerClient.cpp \ + ../WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp \ + ../WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp \ ../WebKit2/WebProcess/WebCoreSupport/qt/WebErrorsQt.cpp \ ../WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp \ ../WebKit2/WebProcess/WebPage/DrawingArea.cpp \ @@ -3376,6 +3385,11 @@ SOURCES += \ ../WebKit2/WebProcess/WebProcess.cpp \ ../WebKit2/WebProcess/qt/WebProcessMainQt.cpp +INCLUDEPATH = \ + $$OUTPUT_DIR/WebCore/generated \ + $$INCLUDEPATH \ + $$OUPUT_DIR/include + } symbian { diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj index de4b3c4..7e80fb2 100644 --- a/WebCore/WebCore.vcproj/WebCore.vcproj +++ b/WebCore/WebCore.vcproj/WebCore.vcproj @@ -23740,6 +23740,10 @@ >
</File>
<File
+ RelativePath="..\platform\win\PopupMenuWin.h"
+ >
+ </File>
+ <File
RelativePath="..\platform\win\ScrollbarThemeSafari.cpp"
>
</File>
@@ -23760,6 +23764,10 @@ >
</File>
<File
+ RelativePath="..\platform\win\SearchPopupMenuWin.h"
+ >
+ </File>
+ <File
RelativePath="..\platform\win\SharedBufferWin.cpp"
>
</File>
@@ -24372,6 +24380,14 @@ >
</File>
<File
+ RelativePath="..\platform\graphics\WOFFFileFormat.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\graphics\WOFFFileFormat.h"
+ >
+ </File>
+ <File
RelativePath="..\platform\graphics\UnitBezier.h"
>
</File>
@@ -28192,6 +28208,14 @@ Name="mock"
>
<File
+ RelativePath="..\platform\mock\DeviceOrientationClientMock.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\mock\DeviceOrientationClientMock.h"
+ >
+ </File>
+ <File
RelativePath="..\platform\mock\GeolocationServiceMock.cpp"
>
</File>
@@ -28199,6 +28223,14 @@ RelativePath="..\platform\mock\GeolocationServiceMock.h"
>
</File>
+ <File
+ RelativePath="..\platform\mock\SpeechInputClientMock.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\mock\SpeechInputClientMock.h"
+ >
+ </File>
</Filter>
</Filter>
<Filter
@@ -44768,7 +44800,7 @@ >
</File>
<File
- RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBIndexRequest.cpp"
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBIndex.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -44820,7 +44852,7 @@ </FileConfiguration>
</File>
<File
- RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBIndexRequest.h"
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBIndex.h"
>
</File>
<File
@@ -45316,7 +45348,7 @@ </FileConfiguration>
</File>
<File
- RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIndexedDatabaserequest.cpp"
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBFactory.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -45368,7 +45400,7 @@ </FileConfiguration>
</File>
<File
- RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIndexedDatabaseRequest.h"
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBFactory.h"
>
</File>
<File
@@ -50157,23 +50189,23 @@ >
</File>
<File
- RelativePath="..\storage\IDBIndex.h"
+ RelativePath="..\storage\IDBIndex.cpp"
>
</File>
<File
- RelativePath="..\storage\IDBIndexImpl.cpp"
+ RelativePath="..\storage\IDBIndex.h"
>
</File>
<File
- RelativePath="..\storage\IDBIndexImpl.h"
+ RelativePath="..\storage\IDBIndexBackendInterface.h"
>
</File>
<File
- RelativePath="..\storage\IDBIndexRequest.cpp"
+ RelativePath="..\storage\IDBIndexBackendImpl.cpp"
>
</File>
<File
- RelativePath="..\storage\IDBIndexRequest.h"
+ RelativePath="..\storage\IDBIndexBackendImpl.h"
>
</File>
<File
@@ -50228,28 +50260,28 @@ RelativePath="..\storage\IDBSuccessEvent.h"
>
</File>
+ <File
+ RelativePath="..\storage\IDBFactory.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\storage\IDBFactory.h"
+ >
+ </File>
<File
- RelativePath="..\storage\IndexedDatabase.cpp"
+ RelativePath="..\storage\IDBFactoryBackendInterface.cpp"
>
</File>
<File
- RelativePath="..\storage\IndexedDatabase.h"
+ RelativePath="..\storage\IDBFactoryBackendInterface.h"
>
</File>
<File
- RelativePath="..\storage\IndexedDatabaseImpl.cpp"
+ RelativePath="..\storage\IDBFactoryBackendImpl.cpp"
>
</File>
<File
- RelativePath="..\storage\IndexedDatabaseImpl.h"
- >
- </File>
- <File
- RelativePath="..\storage\IndexedDatabaseRequest.cpp"
- >
- </File>
- <File
- RelativePath="..\storage\IndexedDatabaseRequest.h"
+ RelativePath="..\storage\IDBFactoryBackendImpl.h"
>
</File>
<File
@@ -50900,6 +50932,22 @@ >
</File>
<File
+ RelativePath="..\inspector\front-end\ExtensionAPI.js"
+ >
+ </File>
+ <File
+ RelativePath="..\inspector\front-end\ExtensionPanel.js"
+ >
+ </File>
+ <File
+ RelativePath="..\inspector\front-end\ExtensionRegistryStub.js"
+ >
+ </File>
+ <File
+ RelativePath="..\inspector\front-end\ExtensionServer.js"
+ >
+ </File>
+ <File
RelativePath="..\inspector\front-end\FontView.js"
>
</File>
diff --git a/WebCore/WebCore.vcproj/WebCoreCommon.vsprops b/WebCore/WebCore.vcproj/WebCoreCommon.vsprops index 537e129..25fa58e 100644 --- a/WebCore/WebCore.vcproj/WebCoreCommon.vsprops +++ b/WebCore/WebCore.vcproj/WebCoreCommon.vsprops @@ -7,7 +7,7 @@ >
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectDir)..";"$(ProjectDir)..\accessibility";"$(ProjectDir)..\accessibility\win";"$(ProjectDir)..\bridge";"$(ProjectDir)..\bridge\c";"$(ProjectDir)..\bridge\jsc";"$(ProjectDir)..\css";"$(ProjectDir)..\editing";"$(ProjectDir)..\rendering";"$(ProjectDir)..\rendering\style";"$(ProjectDir)..\bindings";"$(ProjectDir)..\bindings\generic";"$(ProjectDir)..\bindings\js";"$(ProjectDir)..\dom";"$(ProjectDir)..\dom\default";"$(ProjectDir)..\history";"$(ProjectDir)..\html";"$(ProjectDir)..\html\canvas";"$(ProjectDir)..\inspector";"$(ProjectDir)..\loader";"$(ProjectDir)..\loader\appcache";"$(ProjectDir)..\loader\archive";"$(ProjectDir)..\loader\archive\cf";"$(ProjectDir)..\loader\icon";"$(ProjectDir)..\notifications";"$(ProjectDir)..\page";"$(ProjectDir)..\page\animation";"$(ProjectDir)..\page\win";"$(ProjectDir)..\platform";"$(ProjectDir)..\platform\animation";"$(ProjectDir)..\platform\mock";"$(ProjectDir)..\platform\sql";"$(ProjectDir)..\platform\win";"$(ProjectDir)..\platform\network";"$(ProjectDir)..\platform\network\win";"$(ProjectDir)..\platform\cf";"$(ProjectDir)..\platform\graphics";"$(ProjectDir)..\platform\graphics\filters";"$(ProjectDir)..\platform\graphics\opentype";"$(ProjectDir)..\platform\graphics\transforms";"$(ProjectDir)..\platform\text";"$(ProjectDir)..\platform\text\transcoder";"$(ProjectDir)..\platform\graphics\win";"$(ProjectDir)..\xml";"$(WebKitOutputDir)\obj\WebCore\DerivedSources";"$(ProjectDir)..\plugins";"$(ProjectDir)..\plugins\win";"$(ProjectDir)..\svg\animation";"$(ProjectDir)..\svg\graphics";"$(ProjectDir)..\svg\graphics\filters";"$(ProjectDir)..\svg";"$(ProjectDir)..\wml";"$(ProjectDir)..\storage";"$(ProjectDir)..\websockets";"$(ProjectDir)..\workers";"$(WebKitOutputDir)\include";"$(WebKitOutputDir)\include\private";"$(WebKitOutputDir)\include\JavaScriptCore";"$(WebKitOutputDir)\include\private\JavaScriptCore";"$(ProjectDir)..\ForwardingHeaders";"$(WebKitLibrariesDir)\include";"$(WebKitLibrariesDir)\include\private";"$(WebKitLibrariesDir)\include\private\JavaScriptCore";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitLibrariesDir)\include\sqlite";"$(WebKitLibrariesDir)\include\JavaScriptCore""
+ AdditionalIncludeDirectories=""$(ProjectDir)..";"$(ProjectDir)..\accessibility";"$(ProjectDir)..\accessibility\win";"$(ProjectDir)..\bridge";"$(ProjectDir)..\bridge\c";"$(ProjectDir)..\bridge\jsc";"$(ProjectDir)..\css";"$(ProjectDir)..\editing";"$(ProjectDir)..\rendering";"$(ProjectDir)..\rendering\style";"$(ProjectDir)..\bindings";"$(ProjectDir)..\bindings\generic";"$(ProjectDir)..\bindings\js";"$(ProjectDir)..\dom";"$(ProjectDir)..\dom\default";"$(ProjectDir)..\history";"$(ProjectDir)..\html";"$(ProjectDir)..\html\canvas";"$(ProjectDir)..\inspector";"$(ProjectDir)..\loader";"$(ProjectDir)..\loader\appcache";"$(ProjectDir)..\loader\archive";"$(ProjectDir)..\loader\archive\cf";"$(ProjectDir)..\loader\icon";"$(ProjectDir)..\notifications";"$(ProjectDir)..\page";"$(ProjectDir)..\page\animation";"$(ProjectDir)..\page\win";"$(ProjectDir)..\platform";"$(ProjectDir)..\platform\animation";"$(ProjectDir)..\platform\mock";"$(ProjectDir)..\platform\sql";"$(ProjectDir)..\platform\win";"$(ProjectDir)..\platform\network";"$(ProjectDir)..\platform\network\win";"$(ProjectDir)..\platform\cf";"$(ProjectDir)..\platform\graphics";"$(ProjectDir)..\platform\graphics\filters";"$(ProjectDir)..\platform\graphics\opentype";"$(ProjectDir)..\platform\graphics\transforms";"$(ProjectDir)..\platform\text";"$(ProjectDir)..\platform\text\transcoder";"$(ProjectDir)..\platform\graphics\win";"$(ProjectDir)..\xml";"$(WebKitOutputDir)\obj\WebCore\DerivedSources";"$(ProjectDir)..\plugins";"$(ProjectDir)..\plugins\win";"$(ProjectDir)..\svg\animation";"$(ProjectDir)..\svg\graphics";"$(ProjectDir)..\svg\graphics\filters";"$(ProjectDir)..\svg";"$(ProjectDir)..\wml";"$(ProjectDir)..\storage";"$(ProjectDir)..\websockets";"$(ProjectDir)..\workers";"$(WebKitOutputDir)\include";"$(WebKitOutputDir)\include\private";"$(WebKitOutputDir)\include\JavaScriptCore";"$(WebKitOutputDir)\include\private\JavaScriptCore";"$(ProjectDir)..\ForwardingHeaders";"$(WebKitLibrariesDir)\include";"$(WebKitLibrariesDir)\include\private";"$(WebKitLibrariesDir)\include\private\JavaScriptCore";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitLibrariesDir)\include\sqlite";"$(WebKitLibrariesDir)\include\JavaScriptCore";"$(WebKitLibrariesDir)\include\zlib""
PreprocessorDefinitions="__WIN32__;DISABLE_3D_RENDERING;WEBCORE_CONTEXT_MENUS"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="WebCorePrefix.h"
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj index 7af6387..853d1ca 100644 --- a/WebCore/WebCore.xcodeproj/project.pbxproj +++ b/WebCore/WebCore.xcodeproj/project.pbxproj @@ -42,7 +42,7 @@ 065AD4F50B0C2EDA005A2B1D /* ContextMenuClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 065AD4F20B0C2EDA005A2B1D /* ContextMenuClient.h */; settings = {ATTRIBUTES = (Private, ); }; }; 065AD4F60B0C2EDA005A2B1D /* ContextMenuController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 065AD4F30B0C2EDA005A2B1D /* ContextMenuController.cpp */; }; 065AD4F70B0C2EDA005A2B1D /* ContextMenuController.h in Headers */ = {isa = PBXBuildFile; fileRef = 065AD4F40B0C2EDA005A2B1D /* ContextMenuController.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 0668E18B0ADD9624004128E0 /* PopupMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = 0668E1890ADD9624004128E0 /* PopupMenu.h */; }; + 0668E18B0ADD9624004128E0 /* PopupMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = 0668E1890ADD9624004128E0 /* PopupMenu.h */; settings = {ATTRIBUTES = (Private, ); }; }; 0668E1900ADD9640004128E0 /* PopupMenuMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0668E18E0ADD9640004128E0 /* PopupMenuMac.mm */; }; 066C772B0AB603B700238CC4 /* FileChooser.h in Headers */ = {isa = PBXBuildFile; fileRef = 066C772A0AB603B700238CC4 /* FileChooser.h */; settings = {ATTRIBUTES = (Private, ); }; }; 066C772D0AB603D200238CC4 /* FileChooserMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 066C772C0AB603D200238CC4 /* FileChooserMac.mm */; }; @@ -783,6 +783,9 @@ 3784C34B0E11AA34007D8D48 /* FontTraitsMask.h in Headers */ = {isa = PBXBuildFile; fileRef = 3784C34A0E11AA34007D8D48 /* FontTraitsMask.h */; settings = {ATTRIBUTES = (Private, ); }; }; 37919C230B7D188600A56998 /* PositionIterator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37919C210B7D188600A56998 /* PositionIterator.cpp */; }; 37919C240B7D188600A56998 /* PositionIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 37919C220B7D188600A56998 /* PositionIterator.h */; settings = {ATTRIBUTES = (); }; }; + 379919961200DDF400EA041C /* WOFFFileFormat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 379919941200DDF400EA041C /* WOFFFileFormat.cpp */; }; + 379919971200DDF400EA041C /* WOFFFileFormat.h in Headers */ = {isa = PBXBuildFile; fileRef = 379919951200DDF400EA041C /* WOFFFileFormat.h */; }; + 379919B21200DE5000EA041C /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 379919B11200DE5000EA041C /* libz.dylib */; }; 37ACCE420DA2980F0089E602 /* FontRenderingMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 37ACCE410DA2980F0089E602 /* FontRenderingMode.h */; settings = {ATTRIBUTES = (Private, ); }; }; 37ACCF690DA414E70089E602 /* FontDescription.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37ACCE620DA2AA960089E602 /* FontDescription.cpp */; }; 37C2360B1097EDED00EF9F72 /* FontComplexTextMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37C2360A1097EDED00EF9F72 /* FontComplexTextMac.cpp */; }; @@ -1108,6 +1111,7 @@ 514C767D0CE923A1007EF3CD /* ResourceRequestBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 514C76680CE923A1007EF3CD /* ResourceRequestBase.h */; settings = {ATTRIBUTES = (Private, ); }; }; 514C767E0CE923A1007EF3CD /* ResourceResponseBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 514C76690CE923A1007EF3CD /* ResourceResponseBase.cpp */; }; 514C767F0CE923A1007EF3CD /* ResourceResponseBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 514C766A0CE923A1007EF3CD /* ResourceResponseBase.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 515788C11207852C00A37C4A /* VisitedLinkStrategy.h in Headers */ = {isa = PBXBuildFile; fileRef = 515788C01207852C00A37C4A /* VisitedLinkStrategy.h */; settings = {ATTRIBUTES = (Private, ); }; }; 515B03990CD1642A00B7EA9C /* SQLStatement.h in Headers */ = {isa = PBXBuildFile; fileRef = 515B03970CD1642A00B7EA9C /* SQLStatement.h */; settings = {ATTRIBUTES = (Private, ); }; }; 515B039A0CD1642A00B7EA9C /* SQLStatement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 515B03980CD1642A00B7EA9C /* SQLStatement.cpp */; }; 5160300B0CC4251200C8AC25 /* FileSystemPOSIX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5160300A0CC4251200C8AC25 /* FileSystemPOSIX.cpp */; }; @@ -1190,10 +1194,12 @@ 54C50F7B0E801DF3009832A0 /* XMLDocumentParserLibxml2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 54C50F7A0E801DF3009832A0 /* XMLDocumentParserLibxml2.cpp */; }; 550A0BC9085F6039007353D6 /* QualifiedName.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 550A0BC7085F6039007353D6 /* QualifiedName.cpp */; }; 550A0BCA085F6039007353D6 /* QualifiedName.h in Headers */ = {isa = PBXBuildFile; fileRef = 550A0BC8085F6039007353D6 /* QualifiedName.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 590E1B4911E4EF4B0069F784 /* DeviceOrientation.h in Headers */ = {isa = PBXBuildFile; fileRef = 590E1B4811E4EF4B0069F784 /* DeviceOrientation.h */; }; + 590E1B4911E4EF4B0069F784 /* DeviceOrientation.h in Headers */ = {isa = PBXBuildFile; fileRef = 590E1B4811E4EF4B0069F784 /* DeviceOrientation.h */; settings = {ATTRIBUTES = (Private, ); }; }; 590E1B4B11E4EF700069F784 /* JSDeviceOrientationEventCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 590E1B4A11E4EF700069F784 /* JSDeviceOrientationEventCustom.cpp */; }; 5913953B110758450083EC55 /* JNIBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 5913953A110758450083EC55 /* JNIBridge.h */; }; 5913953D1107584E0083EC55 /* JNIBridge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5913953C1107584E0083EC55 /* JNIBridge.cpp */; }; + 59309A1111F4AE5800250603 /* DeviceOrientationClientMock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59309A1011F4AE5800250603 /* DeviceOrientationClientMock.cpp */; }; + 59309A1311F4AE6A00250603 /* DeviceOrientationClientMock.h in Headers */ = {isa = PBXBuildFile; fileRef = 59309A1211F4AE6A00250603 /* DeviceOrientationClientMock.h */; settings = {ATTRIBUTES = (Private, ); }; }; 596229781133EFD700DC4CBB /* GeolocationPositionCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 596229771133EFD700DC4CBB /* GeolocationPositionCache.cpp */; }; 5962297A1133EFE200DC4CBB /* GeolocationPositionCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 596229791133EFE200DC4CBB /* GeolocationPositionCache.h */; settings = {ATTRIBUTES = (Private, ); }; }; 599E759011055A1F00D904FA /* Bridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 599E758F11055A1F00D904FA /* Bridge.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -1203,7 +1209,7 @@ 59A86008119DAFA100DEF1EF /* JSDeviceOrientationEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 59A86007119DAFA100DEF1EF /* JSDeviceOrientationEvent.h */; }; 59A8F1D411A69508001AC34A /* DeviceOrientationController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59A8F1D311A69508001AC34A /* DeviceOrientationController.cpp */; }; 59A8F1D611A69513001AC34A /* DeviceOrientationController.h in Headers */ = {isa = PBXBuildFile; fileRef = 59A8F1D511A69513001AC34A /* DeviceOrientationController.h */; }; - 59A8F1D811A69520001AC34A /* DeviceOrientationClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 59A8F1D711A69520001AC34A /* DeviceOrientationClient.h */; }; + 59A8F1D811A69520001AC34A /* DeviceOrientationClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 59A8F1D711A69520001AC34A /* DeviceOrientationClient.h */; settings = {ATTRIBUTES = (Private, ); }; }; 59A9E7B01104758800DFB4C1 /* JavaInstanceJSC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59A9E7AF1104758800DFB4C1 /* JavaInstanceJSC.cpp */; }; 59A9E7B21104759400DFB4C1 /* JavaInstanceJSC.h in Headers */ = {isa = PBXBuildFile; fileRef = 59A9E7B11104759400DFB4C1 /* JavaInstanceJSC.h */; }; 59B597731108656B007159E8 /* BridgeJSC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59B597721108656B007159E8 /* BridgeJSC.cpp */; }; @@ -1349,6 +1355,8 @@ 750D029311D0E7F300BD1B27 /* RenderInputSpeech.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 750D029111D0E7F300BD1B27 /* RenderInputSpeech.cpp */; }; 750D029411D0E7F300BD1B27 /* RenderInputSpeech.h in Headers */ = {isa = PBXBuildFile; fileRef = 750D029211D0E7F300BD1B27 /* RenderInputSpeech.h */; }; 750D02C111D0EE7D00BD1B27 /* inputSpeech.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 750D02C011D0EE7D00BD1B27 /* inputSpeech.tiff */; }; + 7535BC9412020CFF0037EC45 /* SpeechInputClientMock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7535BC9212020CFF0037EC45 /* SpeechInputClientMock.cpp */; }; + 7535BC9512020CFF0037EC45 /* SpeechInputClientMock.h in Headers */ = {isa = PBXBuildFile; fileRef = 7535BC9312020CFF0037EC45 /* SpeechInputClientMock.h */; }; 754133A8102E00E800075D00 /* InspectorTimelineAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 754133A7102E00E800075D00 /* InspectorTimelineAgent.h */; }; 754133AA102E00F400075D00 /* InspectorTimelineAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 754133A9102E00F400075D00 /* InspectorTimelineAgent.cpp */; }; 7553CFE8108F473F00EA281E /* TimelineRecordFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 7553CFE6108F473F00EA281E /* TimelineRecordFactory.h */; }; @@ -3589,12 +3597,12 @@ AB4CB4EB0B8BDA3D009F40B0 /* JSHTMLSelectElementCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = AB4CB4EA0B8BDA3D009F40B0 /* JSHTMLSelectElementCustom.h */; }; AB67D1A8097F3AE300F9392E /* RenderTextControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB67D1A6097F3AE300F9392E /* RenderTextControl.cpp */; }; AB67D1A9097F3AE300F9392E /* RenderTextControl.h in Headers */ = {isa = PBXBuildFile; fileRef = AB67D1A7097F3AE300F9392E /* RenderTextControl.h */; }; - AB7170890B3118080017123E /* SearchPopupMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = AB7170880B3118080017123E /* SearchPopupMenu.h */; }; + AB7170890B3118080017123E /* SearchPopupMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = AB7170880B3118080017123E /* SearchPopupMenu.h */; settings = {ATTRIBUTES = (Private, ); }; }; AB7170A00B31193B0017123E /* SearchPopupMenuMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB71709F0B31193B0017123E /* SearchPopupMenuMac.mm */; }; ABAF22080C03B1C700B0BCF0 /* ChromeMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABAF22070C03B1C700B0BCF0 /* ChromeMac.mm */; }; ABB5419E0ACDDFE4002820EB /* RenderListBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABB5419C0ACDDFE4002820EB /* RenderListBox.cpp */; }; ABB5419F0ACDDFE4002820EB /* RenderListBox.h in Headers */ = {isa = PBXBuildFile; fileRef = ABB5419D0ACDDFE4002820EB /* RenderListBox.h */; }; - ABC128770B33AA6D00C693D5 /* PopupMenuClient.h in Headers */ = {isa = PBXBuildFile; fileRef = ABC128760B33AA6D00C693D5 /* PopupMenuClient.h */; }; + ABC128770B33AA6D00C693D5 /* PopupMenuClient.h in Headers */ = {isa = PBXBuildFile; fileRef = ABC128760B33AA6D00C693D5 /* PopupMenuClient.h */; settings = {ATTRIBUTES = (Private, ); }; }; ABDDFE790A5C6E7000A3E11D /* RenderMenuList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABDDFE730A5C6E6F00A3E11D /* RenderMenuList.cpp */; }; ABDDFE7A0A5C6E7000A3E11D /* RenderMenuList.h in Headers */ = {isa = PBXBuildFile; fileRef = ABDDFE740A5C6E7000A3E11D /* RenderMenuList.h */; }; ABFE7E120D32FAF60066F4D2 /* MediaControlElements.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABFE7E100D32FAF50066F4D2 /* MediaControlElements.cpp */; }; @@ -4913,6 +4921,13 @@ C55610F111A704EB00B82D27 /* DOMStringList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C55610F011A704EB00B82D27 /* DOMStringList.cpp */; }; C55E38BF10040D5D00A56BDB /* StorageNamespaceImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = C55E38BB10040D5D00A56BDB /* StorageNamespaceImpl.h */; }; C55E38C010040D5D00A56BDB /* StorageNamespaceImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C55E38BC10040D5D00A56BDB /* StorageNamespaceImpl.cpp */; }; + C572EE0A1201C736007D8F82 /* IDBIndex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C572EE041201C736007D8F82 /* IDBIndex.cpp */; }; + C572EE0B1201C736007D8F82 /* IDBIndex.h in Headers */ = {isa = PBXBuildFile; fileRef = C572EE051201C736007D8F82 /* IDBIndex.h */; }; + C572EE0D1201C736007D8F82 /* IDBIndexBackendImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C572EE071201C736007D8F82 /* IDBIndexBackendImpl.cpp */; }; + C572EE0E1201C736007D8F82 /* IDBIndexBackendImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = C572EE081201C736007D8F82 /* IDBIndexBackendImpl.h */; }; + C572EE0F1201C736007D8F82 /* IDBIndexBackendInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = C572EE091201C736007D8F82 /* IDBIndexBackendInterface.h */; }; + C572EE1E1201C9BC007D8F82 /* JSIDBIndex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C572EE1C1201C9BC007D8F82 /* JSIDBIndex.cpp */; }; + C572EE1F1201C9BC007D8F82 /* JSIDBIndex.h in Headers */ = {isa = PBXBuildFile; fileRef = C572EE1D1201C9BC007D8F82 /* JSIDBIndex.h */; }; C585A65E11D4FAB2004C3E4B /* JSIDBAnyCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A65C11D4FAB2004C3E4B /* JSIDBAnyCustom.cpp */; }; C585A65F11D4FAB2004C3E4B /* JSIDBKeyCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A65D11D4FAB2004C3E4B /* JSIDBKeyCustom.cpp */; }; C585A66211D4FAC5004C3E4B /* IDBBindingUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A66011D4FAC5004C3E4B /* IDBBindingUtilities.cpp */; }; @@ -4929,8 +4944,6 @@ C585A68511D4FB08004C3E4B /* JSIDBErrorEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A66D11D4FB07004C3E4B /* JSIDBErrorEvent.h */; }; C585A68611D4FB08004C3E4B /* JSIDBEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A66E11D4FB07004C3E4B /* JSIDBEvent.cpp */; }; C585A68711D4FB08004C3E4B /* JSIDBEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A66F11D4FB07004C3E4B /* JSIDBEvent.h */; }; - C585A68811D4FB08004C3E4B /* JSIDBIndexRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A67011D4FB07004C3E4B /* JSIDBIndexRequest.cpp */; }; - C585A68911D4FB08004C3E4B /* JSIDBIndexRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A67111D4FB07004C3E4B /* JSIDBIndexRequest.h */; }; C585A68A11D4FB08004C3E4B /* JSIDBKey.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A67211D4FB07004C3E4B /* JSIDBKey.cpp */; }; C585A68B11D4FB08004C3E4B /* JSIDBKey.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A67311D4FB07004C3E4B /* JSIDBKey.h */; }; C585A68C11D4FB08004C3E4B /* JSIDBKeyRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A67411D4FB07004C3E4B /* JSIDBKeyRange.cpp */; }; @@ -4941,8 +4954,8 @@ C585A69111D4FB08004C3E4B /* JSIDBRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A67911D4FB07004C3E4B /* JSIDBRequest.h */; }; C585A69211D4FB08004C3E4B /* JSIDBSuccessEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A67A11D4FB07004C3E4B /* JSIDBSuccessEvent.cpp */; }; C585A69311D4FB08004C3E4B /* JSIDBSuccessEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A67B11D4FB07004C3E4B /* JSIDBSuccessEvent.h */; }; - C585A69611D4FB13004C3E4B /* JSIndexedDatabaseRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A69411D4FB13004C3E4B /* JSIndexedDatabaseRequest.cpp */; }; - C585A69711D4FB13004C3E4B /* JSIndexedDatabaseRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A69511D4FB13004C3E4B /* JSIndexedDatabaseRequest.h */; }; + C585A69611D4FB13004C3E4B /* JSIDBFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A69411D4FB13004C3E4B /* JSIDBFactory.cpp */; }; + C585A69711D4FB13004C3E4B /* JSIDBFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A69511D4FB13004C3E4B /* JSIDBFactory.h */; }; C585A6CC11D4FB3D004C3E4B /* IDBAny.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A69811D4FB3D004C3E4B /* IDBAny.cpp */; }; C585A6CD11D4FB3D004C3E4B /* IDBAny.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A69911D4FB3D004C3E4B /* IDBAny.h */; }; C585A6CF11D4FB3D004C3E4B /* IDBCallbacks.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A69B11D4FB3D004C3E4B /* IDBCallbacks.h */; }; @@ -4957,11 +4970,6 @@ C585A6DB11D4FB3D004C3E4B /* IDBErrorEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A6A711D4FB3D004C3E4B /* IDBErrorEvent.h */; }; C585A6DD11D4FB3D004C3E4B /* IDBEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A6A911D4FB3D004C3E4B /* IDBEvent.cpp */; }; C585A6DE11D4FB3D004C3E4B /* IDBEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A6AA11D4FB3D004C3E4B /* IDBEvent.h */; }; - C585A6E011D4FB3D004C3E4B /* IDBIndex.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A6AC11D4FB3D004C3E4B /* IDBIndex.h */; }; - C585A6E111D4FB3D004C3E4B /* IDBIndexImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A6AD11D4FB3D004C3E4B /* IDBIndexImpl.cpp */; }; - C585A6E211D4FB3D004C3E4B /* IDBIndexImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A6AE11D4FB3D004C3E4B /* IDBIndexImpl.h */; }; - C585A6E311D4FB3D004C3E4B /* IDBIndexRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A6AF11D4FB3D004C3E4B /* IDBIndexRequest.cpp */; }; - C585A6E411D4FB3D004C3E4B /* IDBIndexRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A6B011D4FB3D004C3E4B /* IDBIndexRequest.h */; }; C585A6E611D4FB3D004C3E4B /* IDBKey.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A6B211D4FB3D004C3E4B /* IDBKey.cpp */; }; C585A6E711D4FB3D004C3E4B /* IDBKey.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A6B311D4FB3D004C3E4B /* IDBKey.h */; }; C585A6E911D4FB3D004C3E4B /* IDBKeyRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A6B511D4FB3D004C3E4B /* IDBKeyRange.cpp */; }; @@ -4976,12 +4984,12 @@ C585A6F411D4FB3D004C3E4B /* IDBRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A6C011D4FB3D004C3E4B /* IDBRequest.h */; }; C585A6F611D4FB3D004C3E4B /* IDBSuccessEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A6C211D4FB3D004C3E4B /* IDBSuccessEvent.cpp */; }; C585A6F711D4FB3D004C3E4B /* IDBSuccessEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A6C311D4FB3D004C3E4B /* IDBSuccessEvent.h */; }; - C585A6F911D4FB3D004C3E4B /* IndexedDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A6C511D4FB3D004C3E4B /* IndexedDatabase.cpp */; }; - C585A6FA11D4FB3D004C3E4B /* IndexedDatabase.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A6C611D4FB3D004C3E4B /* IndexedDatabase.h */; }; - C585A6FB11D4FB3D004C3E4B /* IndexedDatabaseImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A6C711D4FB3D004C3E4B /* IndexedDatabaseImpl.cpp */; }; - C585A6FC11D4FB3D004C3E4B /* IndexedDatabaseImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A6C811D4FB3D004C3E4B /* IndexedDatabaseImpl.h */; }; - C585A6FD11D4FB3D004C3E4B /* IndexedDatabaseRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A6C911D4FB3D004C3E4B /* IndexedDatabaseRequest.cpp */; }; - C585A6FE11D4FB3D004C3E4B /* IndexedDatabaseRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A6CA11D4FB3D004C3E4B /* IndexedDatabaseRequest.h */; }; + C585A6F911D4FB3D004C3E4B /* IDBFactoryBackendInterface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A6C511D4FB3D004C3E4B /* IDBFactoryBackendInterface.cpp */; }; + C585A6FA11D4FB3D004C3E4B /* IDBFactoryBackendInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A6C611D4FB3D004C3E4B /* IDBFactoryBackendInterface.h */; }; + C585A6FB11D4FB3D004C3E4B /* IDBFactoryBackendImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A6C711D4FB3D004C3E4B /* IDBFactoryBackendImpl.cpp */; }; + C585A6FC11D4FB3D004C3E4B /* IDBFactoryBackendImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A6C811D4FB3D004C3E4B /* IDBFactoryBackendImpl.h */; }; + C585A6FD11D4FB3D004C3E4B /* IDBFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A6C911D4FB3D004C3E4B /* IDBFactory.cpp */; }; + C585A6FE11D4FB3D004C3E4B /* IDBFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A6CA11D4FB3D004C3E4B /* IDBFactory.h */; }; C5D4AA7A116BAFB60069CA93 /* GlyphMetricsMap.h in Headers */ = {isa = PBXBuildFile; fileRef = C5D4AA78116BAFB60069CA93 /* GlyphMetricsMap.h */; settings = {ATTRIBUTES = (Private, ); }; }; C5E9B67710697E1300C7BB1A /* StorageEventDispatcher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C5E9B67610697E1300C7BB1A /* StorageEventDispatcher.cpp */; }; C5EBDD84105EDDEC0056816F /* StorageEventDispatcher.h in Headers */ = {isa = PBXBuildFile; fileRef = C5EBDD81105EDDEC0056816F /* StorageEventDispatcher.h */; }; @@ -5015,6 +5023,8 @@ D23CA55D0AB0EAAE005108A5 /* JSRangeException.h in Headers */ = {isa = PBXBuildFile; fileRef = D23CA55C0AB0EAAE005108A5 /* JSRangeException.h */; }; D23CA55F0AB0EAB6005108A5 /* JSRangeException.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D23CA55E0AB0EAB6005108A5 /* JSRangeException.cpp */; }; D23CA56C0AB0EB8D005108A5 /* RangeException.h in Headers */ = {isa = PBXBuildFile; fileRef = D23CA56B0AB0EB8D005108A5 /* RangeException.h */; }; + D39D006D11F8E308006041F2 /* PopupMenuMac.h in Headers */ = {isa = PBXBuildFile; fileRef = D39D006C11F8E308006041F2 /* PopupMenuMac.h */; settings = {ATTRIBUTES = (Private, ); }; }; + D39D009D11F907E6006041F2 /* SearchPopupMenuMac.h in Headers */ = {isa = PBXBuildFile; fileRef = D39D009C11F907E6006041F2 /* SearchPopupMenuMac.h */; settings = {ATTRIBUTES = (Private, ); }; }; D8B6152F1032495100C8554A /* Cookie.h in Headers */ = {isa = PBXBuildFile; fileRef = D8B6152E1032495100C8554A /* Cookie.h */; settings = {ATTRIBUTES = (Private, ); }; }; DB23C2CB0A508D29002489EB /* IndentOutdentCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DB23C2C90A508D29002489EB /* IndentOutdentCommand.cpp */; }; DB23C2CC0A508D29002489EB /* IndentOutdentCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = DB23C2CA0A508D29002489EB /* IndentOutdentCommand.h */; }; @@ -6491,6 +6501,9 @@ 3784C34A0E11AA34007D8D48 /* FontTraitsMask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontTraitsMask.h; sourceTree = "<group>"; }; 37919C210B7D188600A56998 /* PositionIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = PositionIterator.cpp; sourceTree = "<group>"; }; 37919C220B7D188600A56998 /* PositionIterator.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PositionIterator.h; sourceTree = "<group>"; }; + 379919941200DDF400EA041C /* WOFFFileFormat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WOFFFileFormat.cpp; sourceTree = "<group>"; }; + 379919951200DDF400EA041C /* WOFFFileFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WOFFFileFormat.h; sourceTree = "<group>"; }; + 379919B11200DE5000EA041C /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = /usr/lib/libz.dylib; sourceTree = "<absolute>"; }; 37ACCE410DA2980F0089E602 /* FontRenderingMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontRenderingMode.h; sourceTree = "<group>"; }; 37ACCE620DA2AA960089E602 /* FontDescription.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontDescription.cpp; sourceTree = "<group>"; }; 37C2360A1097EDED00EF9F72 /* FontComplexTextMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontComplexTextMac.cpp; sourceTree = "<group>"; }; @@ -6864,6 +6877,7 @@ 514C766A0CE923A1007EF3CD /* ResourceResponseBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceResponseBase.h; sourceTree = "<group>"; }; 5150C2A10702629000AF642C /* WebDashboardRegion.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebDashboardRegion.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 5150C2A50702629800AF642C /* WebDashboardRegion.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebDashboardRegion.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; + 515788C01207852C00A37C4A /* VisitedLinkStrategy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VisitedLinkStrategy.h; sourceTree = "<group>"; }; 515B03970CD1642A00B7EA9C /* SQLStatement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQLStatement.h; sourceTree = "<group>"; }; 515B03980CD1642A00B7EA9C /* SQLStatement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SQLStatement.cpp; sourceTree = "<group>"; }; 5160300A0CC4251200C8AC25 /* FileSystemPOSIX.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileSystemPOSIX.cpp; sourceTree = "<group>"; }; @@ -6964,6 +6978,8 @@ 590E1B4A11E4EF700069F784 /* JSDeviceOrientationEventCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDeviceOrientationEventCustom.cpp; sourceTree = "<group>"; }; 5913953A110758450083EC55 /* JNIBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JNIBridge.h; sourceTree = "<group>"; }; 5913953C1107584E0083EC55 /* JNIBridge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JNIBridge.cpp; sourceTree = "<group>"; }; + 59309A1011F4AE5800250603 /* DeviceOrientationClientMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DeviceOrientationClientMock.cpp; path = mock/DeviceOrientationClientMock.cpp; sourceTree = "<group>"; }; + 59309A1211F4AE6A00250603 /* DeviceOrientationClientMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DeviceOrientationClientMock.h; path = mock/DeviceOrientationClientMock.h; sourceTree = "<group>"; }; 596229771133EFD700DC4CBB /* GeolocationPositionCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GeolocationPositionCache.cpp; sourceTree = "<group>"; }; 596229791133EFE200DC4CBB /* GeolocationPositionCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeolocationPositionCache.h; sourceTree = "<group>"; }; 599E758F11055A1F00D904FA /* Bridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Bridge.h; path = bridge/Bridge.h; sourceTree = "<group>"; }; @@ -7128,6 +7144,8 @@ 750D029111D0E7F300BD1B27 /* RenderInputSpeech.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderInputSpeech.cpp; sourceTree = "<group>"; }; 750D029211D0E7F300BD1B27 /* RenderInputSpeech.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderInputSpeech.h; sourceTree = "<group>"; }; 750D02C011D0EE7D00BD1B27 /* inputSpeech.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = inputSpeech.tiff; sourceTree = "<group>"; }; + 7535BC9212020CFF0037EC45 /* SpeechInputClientMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SpeechInputClientMock.cpp; path = mock/SpeechInputClientMock.cpp; sourceTree = "<group>"; }; + 7535BC9312020CFF0037EC45 /* SpeechInputClientMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SpeechInputClientMock.h; path = mock/SpeechInputClientMock.h; sourceTree = "<group>"; }; 754133A7102E00E800075D00 /* InspectorTimelineAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorTimelineAgent.h; sourceTree = "<group>"; }; 754133A9102E00F400075D00 /* InspectorTimelineAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorTimelineAgent.cpp; sourceTree = "<group>"; }; 7553CFE6108F473F00EA281E /* TimelineRecordFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimelineRecordFactory.h; sourceTree = "<group>"; }; @@ -8056,6 +8074,36 @@ 895253DA116C4EF500CABF00 /* FileStreamProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileStreamProxy.cpp; sourceTree = "<group>"; }; 895253DB116C4EF500CABF00 /* FileStreamProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileStreamProxy.h; sourceTree = "<group>"; }; 895253DE116C4F0600CABF00 /* FileThreadTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileThreadTask.h; sourceTree = "<group>"; }; + 897A2D1911FF58A50082740C /* DOMFileSystem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMFileSystem.cpp; sourceTree = "<group>"; }; + 897A2D1A11FF58A50082740C /* DOMFileSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMFileSystem.h; sourceTree = "<group>"; }; + 897A2D1B11FF58A50082740C /* DOMFileSystem.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMFileSystem.idl; sourceTree = "<group>"; }; + 897A2D1C11FF58A50082740C /* Entry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Entry.cpp; sourceTree = "<group>"; }; + 897A2D1D11FF58A50082740C /* Entry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Entry.h; sourceTree = "<group>"; }; + 897A2D1E11FF58A50082740C /* EntryCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EntryCallback.h; sourceTree = "<group>"; }; + 897A2D1F11FF58A50082740C /* EntryCallback.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = EntryCallback.idl; sourceTree = "<group>"; }; + 897A2D2011FF58A50082740C /* ErrorCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ErrorCallback.h; sourceTree = "<group>"; }; + 897A2D2111FF58A50082740C /* FileSystemCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileSystemCallback.h; sourceTree = "<group>"; }; + 897A2D3B11FF63860082740C /* Entry.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Entry.idl; sourceTree = "<group>"; }; + 897A2D4911FF6C900082740C /* JSEntry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEntry.cpp; sourceTree = "<group>"; }; + 897A2D4A11FF6C900082740C /* JSEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEntry.h; sourceTree = "<group>"; }; + 897A2D4B11FF6C900082740C /* JSEntryCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEntryCallback.cpp; sourceTree = "<group>"; }; + 897A2D4C11FF6C900082740C /* JSEntryCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEntryCallback.h; sourceTree = "<group>"; }; + 897A2D4D11FF6C900082740C /* JSErrorCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSErrorCallback.cpp; sourceTree = "<group>"; }; + 897A2D4E11FF6C900082740C /* JSErrorCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSErrorCallback.h; sourceTree = "<group>"; }; + 897A2D5511FF6CA40082740C /* JSFileSystemCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSFileSystemCallback.cpp; sourceTree = "<group>"; }; + 897A2D5611FF6CA40082740C /* JSFileSystemCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSFileSystemCallback.h; sourceTree = "<group>"; }; + 897A2D5D120000FF0082740C /* ErrorCallback.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ErrorCallback.idl; sourceTree = "<group>"; }; + 897A2D5F120001220082740C /* FileSystemCallback.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = FileSystemCallback.idl; sourceTree = "<group>"; }; + 897A2D60120001220082740C /* Flags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Flags.h; sourceTree = "<group>"; }; + 897A2D61120001220082740C /* Flags.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Flags.idl; sourceTree = "<group>"; }; + 897A2D73120001440082740C /* Metadata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Metadata.h; sourceTree = "<group>"; }; + 897A2D74120001440082740C /* Metadata.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Metadata.idl; sourceTree = "<group>"; }; + 897A2D75120001440082740C /* MetadataCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MetadataCallback.h; sourceTree = "<group>"; }; + 897A2D76120001440082740C /* MetadataCallback.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MetadataCallback.idl; sourceTree = "<group>"; }; + 897A2D8D1200035F0082740C /* JSDOMFileSystem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMFileSystem.cpp; sourceTree = "<group>"; }; + 897A2D8E1200035F0082740C /* JSDOMFileSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMFileSystem.h; sourceTree = "<group>"; }; + 897A2D91120003760082740C /* JSFlags.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSFlags.cpp; sourceTree = "<group>"; }; + 897A2D92120003760082740C /* JSFlags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSFlags.h; sourceTree = "<group>"; }; 8988E10C11A3508B00DB732E /* BlobItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BlobItem.cpp; sourceTree = "<group>"; }; 8988E10D11A3508B00DB732E /* BlobItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlobItem.h; sourceTree = "<group>"; }; 89B5EA9F11E8003D00F2367E /* LineEnding.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LineEnding.cpp; sourceTree = "<group>"; }; @@ -10574,6 +10622,14 @@ C55610F011A704EB00B82D27 /* DOMStringList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMStringList.cpp; sourceTree = "<group>"; }; C55E38BB10040D5D00A56BDB /* StorageNamespaceImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageNamespaceImpl.h; sourceTree = "<group>"; }; C55E38BC10040D5D00A56BDB /* StorageNamespaceImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StorageNamespaceImpl.cpp; sourceTree = "<group>"; }; + C572EE041201C736007D8F82 /* IDBIndex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBIndex.cpp; sourceTree = "<group>"; }; + C572EE051201C736007D8F82 /* IDBIndex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBIndex.h; sourceTree = "<group>"; }; + C572EE061201C736007D8F82 /* IDBIndex.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDBIndex.idl; sourceTree = "<group>"; }; + C572EE071201C736007D8F82 /* IDBIndexBackendImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBIndexBackendImpl.cpp; sourceTree = "<group>"; }; + C572EE081201C736007D8F82 /* IDBIndexBackendImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBIndexBackendImpl.h; sourceTree = "<group>"; }; + C572EE091201C736007D8F82 /* IDBIndexBackendInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBIndexBackendInterface.h; sourceTree = "<group>"; }; + C572EE1C1201C9BC007D8F82 /* JSIDBIndex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBIndex.cpp; sourceTree = "<group>"; }; + C572EE1D1201C9BC007D8F82 /* JSIDBIndex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBIndex.h; sourceTree = "<group>"; }; C585A65C11D4FAB2004C3E4B /* JSIDBAnyCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBAnyCustom.cpp; sourceTree = "<group>"; }; C585A65D11D4FAB2004C3E4B /* JSIDBKeyCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBKeyCustom.cpp; sourceTree = "<group>"; }; C585A66011D4FAC5004C3E4B /* IDBBindingUtilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBBindingUtilities.cpp; sourceTree = "<group>"; }; @@ -10590,8 +10646,6 @@ C585A66D11D4FB07004C3E4B /* JSIDBErrorEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBErrorEvent.h; sourceTree = "<group>"; }; C585A66E11D4FB07004C3E4B /* JSIDBEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBEvent.cpp; sourceTree = "<group>"; }; C585A66F11D4FB07004C3E4B /* JSIDBEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBEvent.h; sourceTree = "<group>"; }; - C585A67011D4FB07004C3E4B /* JSIDBIndexRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBIndexRequest.cpp; sourceTree = "<group>"; }; - C585A67111D4FB07004C3E4B /* JSIDBIndexRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBIndexRequest.h; sourceTree = "<group>"; }; C585A67211D4FB07004C3E4B /* JSIDBKey.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBKey.cpp; sourceTree = "<group>"; }; C585A67311D4FB07004C3E4B /* JSIDBKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBKey.h; sourceTree = "<group>"; }; C585A67411D4FB07004C3E4B /* JSIDBKeyRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBKeyRange.cpp; sourceTree = "<group>"; }; @@ -10602,8 +10656,8 @@ C585A67911D4FB07004C3E4B /* JSIDBRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBRequest.h; sourceTree = "<group>"; }; C585A67A11D4FB07004C3E4B /* JSIDBSuccessEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBSuccessEvent.cpp; sourceTree = "<group>"; }; C585A67B11D4FB07004C3E4B /* JSIDBSuccessEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBSuccessEvent.h; sourceTree = "<group>"; }; - C585A69411D4FB13004C3E4B /* JSIndexedDatabaseRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIndexedDatabaseRequest.cpp; sourceTree = "<group>"; }; - C585A69511D4FB13004C3E4B /* JSIndexedDatabaseRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIndexedDatabaseRequest.h; sourceTree = "<group>"; }; + C585A69411D4FB13004C3E4B /* JSIDBFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBFactory.cpp; sourceTree = "<group>"; }; + C585A69511D4FB13004C3E4B /* JSIDBFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBFactory.h; sourceTree = "<group>"; }; C585A69811D4FB3D004C3E4B /* IDBAny.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBAny.cpp; sourceTree = "<group>"; }; C585A69911D4FB3D004C3E4B /* IDBAny.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBAny.h; sourceTree = "<group>"; }; C585A69A11D4FB3D004C3E4B /* IDBAny.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDBAny.idl; sourceTree = "<group>"; }; @@ -10624,12 +10678,6 @@ C585A6A911D4FB3D004C3E4B /* IDBEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBEvent.cpp; sourceTree = "<group>"; }; C585A6AA11D4FB3D004C3E4B /* IDBEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBEvent.h; sourceTree = "<group>"; }; C585A6AB11D4FB3D004C3E4B /* IDBEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDBEvent.idl; sourceTree = "<group>"; }; - C585A6AC11D4FB3D004C3E4B /* IDBIndex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBIndex.h; sourceTree = "<group>"; }; - C585A6AD11D4FB3D004C3E4B /* IDBIndexImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBIndexImpl.cpp; sourceTree = "<group>"; }; - C585A6AE11D4FB3D004C3E4B /* IDBIndexImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBIndexImpl.h; sourceTree = "<group>"; }; - C585A6AF11D4FB3D004C3E4B /* IDBIndexRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBIndexRequest.cpp; sourceTree = "<group>"; }; - C585A6B011D4FB3D004C3E4B /* IDBIndexRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBIndexRequest.h; sourceTree = "<group>"; }; - C585A6B111D4FB3D004C3E4B /* IDBIndexRequest.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDBIndexRequest.idl; sourceTree = "<group>"; }; C585A6B211D4FB3D004C3E4B /* IDBKey.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBKey.cpp; sourceTree = "<group>"; }; C585A6B311D4FB3D004C3E4B /* IDBKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBKey.h; sourceTree = "<group>"; }; C585A6B411D4FB3D004C3E4B /* IDBKey.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDBKey.idl; sourceTree = "<group>"; }; @@ -10649,13 +10697,13 @@ C585A6C211D4FB3D004C3E4B /* IDBSuccessEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBSuccessEvent.cpp; sourceTree = "<group>"; }; C585A6C311D4FB3D004C3E4B /* IDBSuccessEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBSuccessEvent.h; sourceTree = "<group>"; }; C585A6C411D4FB3D004C3E4B /* IDBSuccessEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDBSuccessEvent.idl; sourceTree = "<group>"; }; - C585A6C511D4FB3D004C3E4B /* IndexedDatabase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IndexedDatabase.cpp; sourceTree = "<group>"; }; - C585A6C611D4FB3D004C3E4B /* IndexedDatabase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IndexedDatabase.h; sourceTree = "<group>"; }; - C585A6C711D4FB3D004C3E4B /* IndexedDatabaseImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IndexedDatabaseImpl.cpp; sourceTree = "<group>"; }; - C585A6C811D4FB3D004C3E4B /* IndexedDatabaseImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IndexedDatabaseImpl.h; sourceTree = "<group>"; }; - C585A6C911D4FB3D004C3E4B /* IndexedDatabaseRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IndexedDatabaseRequest.cpp; sourceTree = "<group>"; }; - C585A6CA11D4FB3D004C3E4B /* IndexedDatabaseRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IndexedDatabaseRequest.h; sourceTree = "<group>"; }; - C585A6CB11D4FB3D004C3E4B /* IndexedDatabaseRequest.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IndexedDatabaseRequest.idl; sourceTree = "<group>"; }; + C585A6C511D4FB3D004C3E4B /* IDBFactoryBackendInterface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBFactoryBackendInterface.cpp; sourceTree = "<group>"; }; + C585A6C611D4FB3D004C3E4B /* IDBFactoryBackendInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBFactoryBackendInterface.h; sourceTree = "<group>"; }; + C585A6C711D4FB3D004C3E4B /* IDBFactoryBackendImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBFactoryBackendImpl.cpp; sourceTree = "<group>"; }; + C585A6C811D4FB3D004C3E4B /* IDBFactoryBackendImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBFactoryBackendImpl.h; sourceTree = "<group>"; }; + C585A6C911D4FB3D004C3E4B /* IDBFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBFactory.cpp; sourceTree = "<group>"; }; + C585A6CA11D4FB3D004C3E4B /* IDBFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBFactory.h; sourceTree = "<group>"; }; + C585A6CB11D4FB3D004C3E4B /* IDBFactory.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDBFactory.idl; sourceTree = "<group>"; }; C5D4AA78116BAFB60069CA93 /* GlyphMetricsMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GlyphMetricsMap.h; sourceTree = "<group>"; }; C5E9B67610697E1300C7BB1A /* StorageEventDispatcher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StorageEventDispatcher.cpp; sourceTree = "<group>"; }; C5EBDD81105EDDEC0056816F /* StorageEventDispatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageEventDispatcher.h; sourceTree = "<group>"; }; @@ -10690,6 +10738,8 @@ D23CA55C0AB0EAAE005108A5 /* JSRangeException.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSRangeException.h; sourceTree = "<group>"; }; D23CA55E0AB0EAB6005108A5 /* JSRangeException.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSRangeException.cpp; sourceTree = "<group>"; }; D23CA56B0AB0EB8D005108A5 /* RangeException.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RangeException.h; sourceTree = "<group>"; }; + D39D006C11F8E308006041F2 /* PopupMenuMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PopupMenuMac.h; sourceTree = "<group>"; }; + D39D009C11F907E6006041F2 /* SearchPopupMenuMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SearchPopupMenuMac.h; sourceTree = "<group>"; }; D8B6152E1032495100C8554A /* Cookie.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Cookie.h; sourceTree = "<group>"; }; DB23C2C90A508D29002489EB /* IndentOutdentCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = IndentOutdentCommand.cpp; sourceTree = "<group>"; }; DB23C2CA0A508D29002489EB /* IndentOutdentCommand.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IndentOutdentCommand.h; sourceTree = "<group>"; }; @@ -10996,6 +11046,7 @@ 93F19B1708245E59001E9ABC /* libicucore.dylib in Frameworks */, 1CFAE3230A6D6A3F0032593D /* libobjc.dylib in Frameworks */, DD763BB20992C2C900740B8E /* libxml2.dylib in Frameworks */, + 379919B21200DE5000EA041C /* libz.dylib in Frameworks */, 49C7BA791042EFAE0009D447 /* OpenGL.framework in Frameworks */, A88AD52F09524B92001DD196 /* QuartzCore.framework in Frameworks */, 1A7FA7CC0DDA4B770028F8A5 /* SystemConfiguration.framework in Frameworks */, @@ -11065,6 +11116,7 @@ 93F1D31A0558CC5C00821BC0 /* libicucore.dylib */, 1CFAE3220A6D6A3F0032593D /* libobjc.dylib */, DD763BB10992C2C900740B8E /* libxml2.dylib */, + 379919B11200DE5000EA041C /* libz.dylib */, 49C7BA781042EFAE0009D447 /* OpenGL.framework */, A85D7A2F0879EBA9006A9172 /* QuartzCore.framework */, 1A7FA7CB0DDA4B770028F8A5 /* SystemConfiguration.framework */, @@ -11315,6 +11367,20 @@ 1AD51A130CB59CD300953D11 /* DatabaseTracker.cpp */, 1AD51A120CB59CD300953D11 /* DatabaseTracker.h */, 51FAFE330CECBF2D00BB3F24 /* DatabaseTrackerClient.h */, + 897A2D1911FF58A50082740C /* DOMFileSystem.cpp */, + 897A2D1A11FF58A50082740C /* DOMFileSystem.h */, + 897A2D1B11FF58A50082740C /* DOMFileSystem.idl */, + 897A2D1C11FF58A50082740C /* Entry.cpp */, + 897A2D1D11FF58A50082740C /* Entry.h */, + 897A2D3B11FF63860082740C /* Entry.idl */, + 897A2D1E11FF58A50082740C /* EntryCallback.h */, + 897A2D1F11FF58A50082740C /* EntryCallback.idl */, + 897A2D2011FF58A50082740C /* ErrorCallback.h */, + 897A2D5D120000FF0082740C /* ErrorCallback.idl */, + 897A2D2111FF58A50082740C /* FileSystemCallback.h */, + 897A2D5F120001220082740C /* FileSystemCallback.idl */, + 897A2D60120001220082740C /* Flags.h */, + 897A2D61120001220082740C /* Flags.idl */, C585A69811D4FB3D004C3E4B /* IDBAny.cpp */, C585A69911D4FB3D004C3E4B /* IDBAny.h */, C585A69A11D4FB3D004C3E4B /* IDBAny.idl */, @@ -11335,12 +11401,19 @@ C585A6A911D4FB3D004C3E4B /* IDBEvent.cpp */, C585A6AA11D4FB3D004C3E4B /* IDBEvent.h */, C585A6AB11D4FB3D004C3E4B /* IDBEvent.idl */, - C585A6AC11D4FB3D004C3E4B /* IDBIndex.h */, - C585A6AD11D4FB3D004C3E4B /* IDBIndexImpl.cpp */, - C585A6AE11D4FB3D004C3E4B /* IDBIndexImpl.h */, - C585A6AF11D4FB3D004C3E4B /* IDBIndexRequest.cpp */, - C585A6B011D4FB3D004C3E4B /* IDBIndexRequest.h */, - C585A6B111D4FB3D004C3E4B /* IDBIndexRequest.idl */, + C585A6C911D4FB3D004C3E4B /* IDBFactory.cpp */, + C585A6CA11D4FB3D004C3E4B /* IDBFactory.h */, + C585A6CB11D4FB3D004C3E4B /* IDBFactory.idl */, + C585A6C711D4FB3D004C3E4B /* IDBFactoryBackendImpl.cpp */, + C585A6C811D4FB3D004C3E4B /* IDBFactoryBackendImpl.h */, + C585A6C511D4FB3D004C3E4B /* IDBFactoryBackendInterface.cpp */, + C585A6C611D4FB3D004C3E4B /* IDBFactoryBackendInterface.h */, + C572EE041201C736007D8F82 /* IDBIndex.cpp */, + C572EE051201C736007D8F82 /* IDBIndex.h */, + C572EE061201C736007D8F82 /* IDBIndex.idl */, + C572EE071201C736007D8F82 /* IDBIndexBackendImpl.cpp */, + C572EE081201C736007D8F82 /* IDBIndexBackendImpl.h */, + C572EE091201C736007D8F82 /* IDBIndexBackendInterface.h */, C585A6B211D4FB3D004C3E4B /* IDBKey.cpp */, C585A6B311D4FB3D004C3E4B /* IDBKey.h */, C585A6B411D4FB3D004C3E4B /* IDBKey.idl */, @@ -11360,17 +11433,14 @@ C585A6C211D4FB3D004C3E4B /* IDBSuccessEvent.cpp */, C585A6C311D4FB3D004C3E4B /* IDBSuccessEvent.h */, C585A6C411D4FB3D004C3E4B /* IDBSuccessEvent.idl */, - C585A6C511D4FB3D004C3E4B /* IndexedDatabase.cpp */, - C585A6C611D4FB3D004C3E4B /* IndexedDatabase.h */, - C585A6C711D4FB3D004C3E4B /* IndexedDatabaseImpl.cpp */, - C585A6C811D4FB3D004C3E4B /* IndexedDatabaseImpl.h */, - C585A6C911D4FB3D004C3E4B /* IndexedDatabaseRequest.cpp */, - C585A6CA11D4FB3D004C3E4B /* IndexedDatabaseRequest.h */, - C585A6CB11D4FB3D004C3E4B /* IndexedDatabaseRequest.idl */, 511F23130DC160DA004F0032 /* LocalStorageTask.cpp */, 511F23140DC160DA004F0032 /* LocalStorageTask.h */, 511F23150DC160DA004F0032 /* LocalStorageThread.cpp */, 511F23160DC160DA004F0032 /* LocalStorageThread.h */, + 897A2D73120001440082740C /* Metadata.h */, + 897A2D74120001440082740C /* Metadata.idl */, + 897A2D75120001440082740C /* MetadataCallback.h */, + 897A2D76120001440082740C /* MetadataCallback.idl */, 51A926780D53F0570063ECC2 /* OriginQuotaManager.cpp */, 51A926790D53F0570063ECC2 /* OriginQuotaManager.h */, 51A9267A0D53F0570063ECC2 /* OriginUsageRecord.cpp */, @@ -12044,6 +12114,10 @@ 59C77F101054591C00506104 /* mock */ = { isa = PBXGroup; children = ( + 59309A1011F4AE5800250603 /* DeviceOrientationClientMock.cpp */, + 59309A1211F4AE6A00250603 /* DeviceOrientationClientMock.h */, + 7535BC9212020CFF0037EC45 /* SpeechInputClientMock.cpp */, + 7535BC9312020CFF0037EC45 /* SpeechInputClientMock.h */, ); name = mock; sourceTree = "<group>"; @@ -12236,10 +12310,12 @@ 4B2709810AF2E5E00065127F /* PasteboardMac.mm */, 935C476F09AC4D7300A6AAB4 /* PlatformMouseEventMac.mm */, BC94D1070C274F88006BC617 /* PlatformScreenMac.mm */, + D39D006C11F8E308006041F2 /* PopupMenuMac.h */, 0668E18E0ADD9640004128E0 /* PopupMenuMac.mm */, E4D687760ED7AE3D006EA978 /* PurgeableBufferMac.cpp */, 447D69010FA626810015CCB1 /* RuntimeApplicationChecks.h */, 447D69020FA626810015CCB1 /* RuntimeApplicationChecks.mm */, + D39D009C11F907E6006041F2 /* SearchPopupMenuMac.h */, 1CE24F960D7CAF0E007E04C2 /* SchedulePairMac.mm */, BCAA90C20A7EBA60008B1229 /* Scrollbar.cpp */, BC8B853C0E7C7F1100AB6984 /* ScrollbarThemeMac.h */, @@ -14757,6 +14833,18 @@ B59DD697119029E5007E9684 /* JSDatabaseCallback.h */, B58CEB6811913607002A6790 /* JSDatabaseSync.cpp */, B58CEB6711913607002A6790 /* JSDatabaseSync.h */, + 897A2D8D1200035F0082740C /* JSDOMFileSystem.cpp */, + 897A2D8E1200035F0082740C /* JSDOMFileSystem.h */, + 897A2D4911FF6C900082740C /* JSEntry.cpp */, + 897A2D4A11FF6C900082740C /* JSEntry.h */, + 897A2D4B11FF6C900082740C /* JSEntryCallback.cpp */, + 897A2D4C11FF6C900082740C /* JSEntryCallback.h */, + 897A2D4D11FF6C900082740C /* JSErrorCallback.cpp */, + 897A2D4E11FF6C900082740C /* JSErrorCallback.h */, + 897A2D5511FF6CA40082740C /* JSFileSystemCallback.cpp */, + 897A2D5611FF6CA40082740C /* JSFileSystemCallback.h */, + 897A2D91120003760082740C /* JSFlags.cpp */, + 897A2D92120003760082740C /* JSFlags.h */, C585A66411D4FB07004C3E4B /* JSIDBAny.cpp */, C585A66511D4FB07004C3E4B /* JSIDBAny.h */, C585A66611D4FB07004C3E4B /* JSIDBDatabaseError.cpp */, @@ -14769,8 +14857,10 @@ C585A66D11D4FB07004C3E4B /* JSIDBErrorEvent.h */, C585A66E11D4FB07004C3E4B /* JSIDBEvent.cpp */, C585A66F11D4FB07004C3E4B /* JSIDBEvent.h */, - C585A67011D4FB07004C3E4B /* JSIDBIndexRequest.cpp */, - C585A67111D4FB07004C3E4B /* JSIDBIndexRequest.h */, + C585A69411D4FB13004C3E4B /* JSIDBFactory.cpp */, + C585A69511D4FB13004C3E4B /* JSIDBFactory.h */, + C572EE1C1201C9BC007D8F82 /* JSIDBIndex.cpp */, + C572EE1D1201C9BC007D8F82 /* JSIDBIndex.h */, C585A67211D4FB07004C3E4B /* JSIDBKey.cpp */, C585A67311D4FB07004C3E4B /* JSIDBKey.h */, C585A67411D4FB07004C3E4B /* JSIDBKeyRange.cpp */, @@ -14781,8 +14871,6 @@ C585A67911D4FB07004C3E4B /* JSIDBRequest.h */, C585A67A11D4FB07004C3E4B /* JSIDBSuccessEvent.cpp */, C585A67B11D4FB07004C3E4B /* JSIDBSuccessEvent.h */, - C585A69411D4FB13004C3E4B /* JSIndexedDatabaseRequest.cpp */, - C585A69511D4FB13004C3E4B /* JSIndexedDatabaseRequest.h */, 514C76350CE9225E007EF3CD /* JSSQLError.cpp */, BC8243250D0CE8A200460C8F /* JSSQLError.h */, B525A96411CA2340003A23A8 /* JSSQLException.cpp */, @@ -15517,6 +15605,8 @@ E4AFCFA40DAF29A300F5F55C /* UnitBezier.h */, 939B02EC0EA2DBC400C54570 /* WidthIterator.cpp */, 939B02ED0EA2DBC400C54570 /* WidthIterator.h */, + 379919941200DDF400EA041C /* WOFFFileFormat.cpp */, + 379919951200DDF400EA041C /* WOFFFileFormat.h */, ); path = graphics; sourceTree = "<group>"; @@ -16291,6 +16381,7 @@ 1419D2C40CEA6F6100FF507A /* TreeShared.h */, 2E3BBF051162DA1100B9409A /* UUID.cpp */, 2E3BBF061162DA1100B9409A /* UUID.h */, + 515788C01207852C00A37C4A /* VisitedLinkStrategy.h */, 9380F47109A11AB4001FDB34 /* Widget.cpp */, 9380F47209A11AB4001FDB34 /* Widget.h */, E1E1BEFF115FF6FB006F52CA /* WindowsKeyboardCodes.h */, @@ -17471,6 +17562,7 @@ 93F1996D08245E59001E9ABC /* DeprecatedPtrListImpl.h in Headers */, 590E1B4911E4EF4B0069F784 /* DeviceOrientation.h in Headers */, 59A8F1D811A69520001AC34A /* DeviceOrientationClient.h in Headers */, + 59309A1311F4AE6A00250603 /* DeviceOrientationClientMock.h in Headers */, 59A8F1D611A69513001AC34A /* DeviceOrientationController.h in Headers */, 59A85EA4119D68EC00DEF1EF /* DeviceOrientationEvent.h in Headers */, B2F34FE60E82F81400F627CD /* DNS.h in Headers */, @@ -18488,9 +18580,12 @@ C585A6D811D4FB3D004C3E4B /* IDBDatabaseRequest.h in Headers */, C585A6DB11D4FB3D004C3E4B /* IDBErrorEvent.h in Headers */, C585A6DE11D4FB3D004C3E4B /* IDBEvent.h in Headers */, - C585A6E011D4FB3D004C3E4B /* IDBIndex.h in Headers */, - C585A6E211D4FB3D004C3E4B /* IDBIndexImpl.h in Headers */, - C585A6E411D4FB3D004C3E4B /* IDBIndexRequest.h in Headers */, + C585A6FE11D4FB3D004C3E4B /* IDBFactory.h in Headers */, + C585A6FC11D4FB3D004C3E4B /* IDBFactoryBackendImpl.h in Headers */, + C585A6FA11D4FB3D004C3E4B /* IDBFactoryBackendInterface.h in Headers */, + C572EE0B1201C736007D8F82 /* IDBIndex.h in Headers */, + C572EE0E1201C736007D8F82 /* IDBIndexBackendImpl.h in Headers */, + C572EE0F1201C736007D8F82 /* IDBIndexBackendInterface.h in Headers */, C585A6E711D4FB3D004C3E4B /* IDBKey.h in Headers */, C585A6EA11D4FB3D004C3E4B /* IDBKeyRange.h in Headers */, C585A6EC11D4FB3D004C3E4B /* IDBKeyTree.h in Headers */, @@ -18514,9 +18609,6 @@ 4B3480940EEF50D400AC1B41 /* ImageSourceCG.h in Headers */, 316FE1180E6E1DA700BF6088 /* ImplicitAnimation.h in Headers */, DB23C2CC0A508D29002489EB /* IndentOutdentCommand.h in Headers */, - C585A6FA11D4FB3D004C3E4B /* IndexedDatabase.h in Headers */, - C585A6FC11D4FB3D004C3E4B /* IndexedDatabaseImpl.h in Headers */, - C585A6FE11D4FB3D004C3E4B /* IndexedDatabaseRequest.h in Headers */, F3644B001119805900E0D537 /* InjectedScript.h in Headers */, 7A0E76FA10BF08ED00A0276E /* InjectedScriptHost.h in Headers */, A8CFF5E50A155A05000A4234 /* InlineBox.h in Headers */, @@ -18741,7 +18833,8 @@ C585A68311D4FB08004C3E4B /* JSIDBDatabaseRequest.h in Headers */, C585A68511D4FB08004C3E4B /* JSIDBErrorEvent.h in Headers */, C585A68711D4FB08004C3E4B /* JSIDBEvent.h in Headers */, - C585A68911D4FB08004C3E4B /* JSIDBIndexRequest.h in Headers */, + C585A69711D4FB13004C3E4B /* JSIDBFactory.h in Headers */, + C572EE1F1201C9BC007D8F82 /* JSIDBIndex.h in Headers */, C585A68B11D4FB08004C3E4B /* JSIDBKey.h in Headers */, C585A68D11D4FB08004C3E4B /* JSIDBKeyRange.h in Headers */, C585A68F11D4FB08004C3E4B /* JSIDBObjectStoreRequest.h in Headers */, @@ -18749,7 +18842,6 @@ C585A69311D4FB08004C3E4B /* JSIDBSuccessEvent.h in Headers */, BC6C49F40D7DBA0500FFA558 /* JSImageConstructor.h in Headers */, A77979290D6B9E64003851B9 /* JSImageData.h in Headers */, - C585A69711D4FB13004C3E4B /* JSIndexedDatabaseRequest.h in Headers */, 7A0E76DB10BF059800A0276E /* JSInjectedScriptHost.h in Headers */, 7A0E771F10C00DB100A0276E /* JSInspectorFrontendHost.h in Headers */, 49EECF07105070C400099FAB /* JSInt16Array.h in Headers */, @@ -19392,6 +19484,7 @@ 626CDE0F1140424C001E5A68 /* SpatialNavigation.h in Headers */, 7578F90C11DDF26900D933C5 /* SpeechInput.h in Headers */, 7578F90D11DDF26900D933C5 /* SpeechInputClient.h in Headers */, + 7535BC9512020CFF0037EC45 /* SpeechInputClientMock.h in Headers */, 7578F92011E4E32800D933C5 /* SpeechInputListener.h in Headers */, 93309E12099E64920056E581 /* SplitElementCommand.h in Headers */, 93309E14099E64920056E581 /* SplitTextNodeCommand.h in Headers */, @@ -19611,6 +19704,9 @@ BC22747B0E8366E200E7F975 /* SVGRenderStyleDefs.h in Headers */, A8F4FB940C169E7B002AFED5 /* SVGRenderSupport.h in Headers */, B2EBDC9D0AF77E3400AE4A68 /* SVGRenderTreeAsText.h in Headers */, + 084D0E3D11F5816100081E1A /* SVGResources.h in Headers */, + 084D0E3F11F5816100081E1A /* SVGResourcesCache.h in Headers */, + 085B05C311FAE16C004D65F6 /* SVGResourcesCycleSolver.h in Headers */, 853CA9E90AEEC608002372DC /* SVGRootInlineBox.h in Headers */, B2227AA30D00BF220071B782 /* SVGScriptElement.h in Headers */, B2227AA60D00BF220071B782 /* SVGSetElement.h in Headers */, @@ -19816,6 +19912,7 @@ 080FAE1B0EEEBDA800AACDE9 /* WMLTemplateElement.h in Headers */, 081D81320EE0E74D00D73689 /* WMLTimerElement.h in Headers */, 084DBAA20ED39D360038C226 /* WMLVariables.h in Headers */, + 379919971200DDF400EA041C /* WOFFFileFormat.h in Headers */, 2E4346460F546A8200B0F1BA /* Worker.h in Headers */, 2E4346490F546A8200B0F1BA /* WorkerContext.h in Headers */, 2E43464B0F546A8200B0F1BA /* WorkerContextProxy.h in Headers */, @@ -19868,9 +19965,9 @@ E1BE512E0CF6C512002EA959 /* XSLTUnicodeSort.h in Headers */, 97DD4D870FDF4D6E00ECF9A4 /* XSSAuditor.h in Headers */, CE172E011136E8CE0062A533 /* ZoomMode.h in Headers */, - 084D0E3D11F5816100081E1A /* SVGResources.h in Headers */, - 084D0E3F11F5816100081E1A /* SVGResourcesCache.h in Headers */, - 085B05C311FAE16C004D65F6 /* SVGResourcesCycleSolver.h in Headers */, + 515788C11207852C00A37C4A /* VisitedLinkStrategy.h in Headers */, + D39D006D11F8E308006041F2 /* PopupMenuMac.h in Headers */, + D39D009D11F907E6006041F2 /* SearchPopupMenuMac.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -20378,6 +20475,7 @@ 93309DE0099E64920056E581 /* DeleteSelectionCommand.cpp in Sources */, 93F19A3C08245E59001E9ABC /* DeprecatedPtrListImpl.cpp in Sources */, 59D1C10411EB5DCF00B638C8 /* DeviceOrientation.cpp in Sources */, + 59309A1111F4AE5800250603 /* DeviceOrientationClientMock.cpp in Sources */, 59A8F1D411A69508001AC34A /* DeviceOrientationController.cpp in Sources */, 59A85EA2119D68D900DEF1EF /* DeviceOrientationEvent.cpp in Sources */, B2F34FE90E82F82700F627CD /* DNSCFNet.cpp in Sources */, @@ -20911,8 +21009,11 @@ C585A6D711D4FB3D004C3E4B /* IDBDatabaseRequest.cpp in Sources */, C585A6DA11D4FB3D004C3E4B /* IDBErrorEvent.cpp in Sources */, C585A6DD11D4FB3D004C3E4B /* IDBEvent.cpp in Sources */, - C585A6E111D4FB3D004C3E4B /* IDBIndexImpl.cpp in Sources */, - C585A6E311D4FB3D004C3E4B /* IDBIndexRequest.cpp in Sources */, + C585A6FD11D4FB3D004C3E4B /* IDBFactory.cpp in Sources */, + C585A6FB11D4FB3D004C3E4B /* IDBFactoryBackendImpl.cpp in Sources */, + C585A6F911D4FB3D004C3E4B /* IDBFactoryBackendInterface.cpp in Sources */, + C572EE0A1201C736007D8F82 /* IDBIndex.cpp in Sources */, + C572EE0D1201C736007D8F82 /* IDBIndexBackendImpl.cpp in Sources */, C585A6E611D4FB3D004C3E4B /* IDBKey.cpp in Sources */, C585A6E911D4FB3D004C3E4B /* IDBKeyRange.cpp in Sources */, C585A6EE11D4FB3D004C3E4B /* IDBObjectStoreImpl.cpp in Sources */, @@ -20932,9 +21033,6 @@ 4B3480930EEF50D400AC1B41 /* ImageSourceCGMac.mm in Sources */, 316FE1170E6E1DA700BF6088 /* ImplicitAnimation.cpp in Sources */, DB23C2CB0A508D29002489EB /* IndentOutdentCommand.cpp in Sources */, - C585A6F911D4FB3D004C3E4B /* IndexedDatabase.cpp in Sources */, - C585A6FB11D4FB3D004C3E4B /* IndexedDatabaseImpl.cpp in Sources */, - C585A6FD11D4FB3D004C3E4B /* IndexedDatabaseRequest.cpp in Sources */, F3644AFF1119805900E0D537 /* InjectedScript.cpp in Sources */, 7A0E76F910BF08ED00A0276E /* InjectedScriptHost.cpp in Sources */, A8CFF5E60A155A05000A4234 /* InlineBox.cpp in Sources */, @@ -21204,7 +21302,8 @@ C585A68211D4FB08004C3E4B /* JSIDBDatabaseRequest.cpp in Sources */, C585A68411D4FB08004C3E4B /* JSIDBErrorEvent.cpp in Sources */, C585A68611D4FB08004C3E4B /* JSIDBEvent.cpp in Sources */, - C585A68811D4FB08004C3E4B /* JSIDBIndexRequest.cpp in Sources */, + C585A69611D4FB13004C3E4B /* JSIDBFactory.cpp in Sources */, + C572EE1E1201C9BC007D8F82 /* JSIDBIndex.cpp in Sources */, C585A68A11D4FB08004C3E4B /* JSIDBKey.cpp in Sources */, C585A65F11D4FAB2004C3E4B /* JSIDBKeyCustom.cpp in Sources */, C585A68C11D4FB08004C3E4B /* JSIDBKeyRange.cpp in Sources */, @@ -21214,7 +21313,6 @@ BC6C49F30D7DBA0500FFA558 /* JSImageConstructor.cpp in Sources */, A77979280D6B9E64003851B9 /* JSImageData.cpp in Sources */, A7D0318E0E93540300E24ACD /* JSImageDataCustom.cpp in Sources */, - C585A69611D4FB13004C3E4B /* JSIndexedDatabaseRequest.cpp in Sources */, 7A0E76DA10BF059800A0276E /* JSInjectedScriptHost.cpp in Sources */, 7A0E76D510BF050700A0276E /* JSInjectedScriptHostCustom.cpp in Sources */, 7A0E771E10C00DB100A0276E /* JSInspectorFrontendHost.cpp in Sources */, @@ -21724,6 +21822,7 @@ A8F5C0B90F9285AC0098E06B /* RenderSVGModelObject.cpp in Sources */, 08563BD0117865F50012B578 /* RenderSVGResource.cpp in Sources */, 84BDA16B11358D2A00DBF64C /* RenderSVGResourceClipper.cpp in Sources */, + 086A400611F6D6B7002CEC53 /* RenderSVGResourceContainer.cpp in Sources */, 841FDC261178C9BE00F8AC9B /* RenderSVGResourceFilter.cpp in Sources */, 08C34AF51179C057002D7456 /* RenderSVGResourceGradient.cpp in Sources */, 08C34AF71179C057002D7456 /* RenderSVGResourceLinearGradient.cpp in Sources */, @@ -21853,6 +21952,7 @@ D01A27AD10C9BFD800026A42 /* SpaceSplitString.cpp in Sources */, 626CDE0E1140424C001E5A68 /* SpatialNavigation.cpp in Sources */, 7578F90B11DDF26900D933C5 /* SpeechInput.cpp in Sources */, + 7535BC9412020CFF0037EC45 /* SpeechInputClientMock.cpp in Sources */, 93309E11099E64920056E581 /* SplitElementCommand.cpp in Sources */, 93309E13099E64920056E581 /* SplitTextNodeCommand.cpp in Sources */, 93309E15099E64920056E581 /* SplitTextNodeContainingElementCommand.cpp in Sources */, @@ -22048,6 +22148,9 @@ BC22747A0E8366E200E7F975 /* SVGRenderStyleDefs.cpp in Sources */, A8F4FB960C169E85002AFED5 /* SVGRenderSupport.cpp in Sources */, B2EBDC9C0AF77E3400AE4A68 /* SVGRenderTreeAsText.cpp in Sources */, + 084D0E3C11F5816100081E1A /* SVGResources.cpp in Sources */, + 084D0E3E11F5816100081E1A /* SVGResourcesCache.cpp in Sources */, + 085B05C211FAE16C004D65F6 /* SVGResourcesCycleSolver.cpp in Sources */, 853CA9E80AEEC608002372DC /* SVGRootInlineBox.cpp in Sources */, B2227AA20D00BF220071B782 /* SVGScriptElement.cpp in Sources */, B2227AA50D00BF220071B782 /* SVGSetElement.cpp in Sources */, @@ -22221,6 +22324,7 @@ 080FAE1A0EEEBDA800AACDE9 /* WMLTemplateElement.cpp in Sources */, 081D81310EE0E74D00D73689 /* WMLTimerElement.cpp in Sources */, 084DBAA10ED39D360038C226 /* WMLVariables.cpp in Sources */, + 379919961200DDF400EA041C /* WOFFFileFormat.cpp in Sources */, 2E4346450F546A8200B0F1BA /* Worker.cpp in Sources */, 2E4346480F546A8200B0F1BA /* WorkerContext.cpp in Sources */, 2E43464C0F546A8200B0F1BA /* WorkerLocation.cpp in Sources */, @@ -22266,10 +22370,6 @@ 93F19B0508245E59001E9ABC /* XSLTProcessorLibxslt.cpp in Sources */, E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */, 97DD4D860FDF4D6E00ECF9A4 /* XSSAuditor.cpp in Sources */, - 084D0E3C11F5816100081E1A /* SVGResources.cpp in Sources */, - 084D0E3E11F5816100081E1A /* SVGResourcesCache.cpp in Sources */, - 086A400611F6D6B7002CEC53 /* RenderSVGResourceContainer.cpp in Sources */, - 085B05C211FAE16C004D65F6 /* SVGResourcesCycleSolver.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/WebCore/accessibility/AccessibilityObject.cpp b/WebCore/accessibility/AccessibilityObject.cpp index a0959e6..b0ae86b 100644 --- a/WebCore/accessibility/AccessibilityObject.cpp +++ b/WebCore/accessibility/AccessibilityObject.cpp @@ -373,7 +373,24 @@ VisiblePositionRange AccessibilityObject::styleRangeForPosition(const VisiblePos // NOTE: Consider providing this utility method as AX API VisiblePositionRange AccessibilityObject::visiblePositionRangeForRange(const PlainTextRange& range) const { - if (range.start + range.length > text().length()) + unsigned textLength = text().length(); +#if PLATFORM(GTK) + // Gtk ATs need this for all text objects; not just text controls. + if (!textLength) { + Node* node = this->node(); + if (node) { + RenderText* renderText = toRenderText(node->renderer()); + if (renderText) + textLength = renderText->textLength(); + + // Get the text length from the elements under the + // accessibility object if not a RenderText object. + if (!textLength && allowsTextRanges()) + textLength = textUnderElement().length(); + } + } +#endif + if (range.start + range.length > textLength) return VisiblePositionRange(); VisiblePosition startPosition = visiblePositionForIndex(range.start); diff --git a/WebCore/accessibility/AccessibilityObject.h b/WebCore/accessibility/AccessibilityObject.h index b8b0875..c517855 100644 --- a/WebCore/accessibility/AccessibilityObject.h +++ b/WebCore/accessibility/AccessibilityObject.h @@ -571,6 +571,12 @@ protected: virtual void clearChildren(); virtual bool isDetached() const { return true; } +#if PLATFORM(GTK) + bool allowsTextRanges() const; +#else + bool allowsTextRanges() const { return isTextControl(); } +#endif + #if PLATFORM(MAC) RetainPtr<AccessibilityObjectWrapper> m_wrapper; #elif PLATFORM(WIN) && !OS(WINCE) diff --git a/WebCore/accessibility/AccessibilityRenderObject.cpp b/WebCore/accessibility/AccessibilityRenderObject.cpp index 5144950..a5e1cc3 100644 --- a/WebCore/accessibility/AccessibilityRenderObject.cpp +++ b/WebCore/accessibility/AccessibilityRenderObject.cpp @@ -2393,8 +2393,8 @@ VisiblePosition AccessibilityRenderObject::visiblePositionForIndex(int index) co if (isNativeTextControl()) return toRenderTextControl(m_renderer)->visiblePositionForIndex(index); - - if (!isTextControl() && !m_renderer->isText()) + + if (!allowsTextRanges() && !m_renderer->isText()) return VisiblePosition(); Node* node = m_renderer->node(); @@ -2653,7 +2653,7 @@ String AccessibilityRenderObject::doAXStringForRange(const PlainTextRange& range // on the display screen, in pixels. IntRect AccessibilityRenderObject::doAXBoundsForRange(const PlainTextRange& range) const { - if (isTextControl()) + if (allowsTextRanges()) return boundsForVisiblePositionRange(visiblePositionRangeForRange(range)); return IntRect(); } diff --git a/WebCore/accessibility/gtk/AccessibilityObjectAtk.cpp b/WebCore/accessibility/gtk/AccessibilityObjectAtk.cpp index e32340a..d00574b 100644 --- a/WebCore/accessibility/gtk/AccessibilityObjectAtk.cpp +++ b/WebCore/accessibility/gtk/AccessibilityObjectAtk.cpp @@ -93,6 +93,11 @@ void AccessibilityObject::setWrapper(AccessibilityObjectWrapper* wrapper) g_object_ref(m_wrapper); } +bool AccessibilityObject::allowsTextRanges() const +{ + return isTextControl() || isWebArea() || isGroup() || isLink() || isHeading(); +} + } // namespace WebCore #endif // HAVE(ACCESSIBILITY) diff --git a/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp b/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp index 3d7e712..716188a 100644 --- a/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp +++ b/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp @@ -1259,29 +1259,48 @@ static AtkAttributeSet* webkit_accessible_text_get_default_attributes(AtkText* t return getAttributeSetForAccessibilityObject(coreObject); } -static void webkit_accessible_text_get_character_extents(AtkText* text, gint offset, gint* x, gint* y, gint* width, gint* height, AtkCoordType coords) +static IntRect textExtents(AtkText* text, gint startOffset, gint length, AtkCoordType coords) { - IntRect extents = core(text)->doAXBoundsForRange(PlainTextRange(offset, 1)); - // FIXME: Use the AtkCoordType - // Requires WebCore::ScrollView::contentsToScreen() to be implemented + gchar* textContent = webkit_accessible_text_get_text(text, startOffset, -1); + gint textLength = g_utf8_strlen(textContent, -1); + + // The first case (endOffset of -1) should work, but seems broken for all Gtk+ apps. + gint rangeLength = length; + if (rangeLength < 0 || rangeLength > textLength) + rangeLength = textLength; + AccessibilityObject* coreObject = core(text); -#if 0 + IntRect extents = coreObject->doAXBoundsForRange(PlainTextRange(startOffset, rangeLength)); switch(coords) { case ATK_XY_SCREEN: - extents = core(text)->document()->view()->contentsToScreen(extents); + extents = coreObject->document()->view()->contentsToScreen(extents); break; case ATK_XY_WINDOW: // No-op break; } -#endif + return extents; +} + +static void webkit_accessible_text_get_character_extents(AtkText* text, gint offset, gint* x, gint* y, gint* width, gint* height, AtkCoordType coords) +{ + IntRect extents = textExtents(text, offset, 1, coords); *x = extents.x(); *y = extents.y(); *width = extents.width(); *height = extents.height(); } +static void webkit_accessible_text_get_range_extents(AtkText* text, gint startOffset, gint endOffset, AtkCoordType coords, AtkTextRectangle* rect) +{ + IntRect extents = textExtents(text, startOffset, endOffset - startOffset + 1, coords); + rect->x = extents.x(); + rect->y = extents.y(); + rect->width = extents.width(); + rect->height = extents.height(); +} + static gint webkit_accessible_text_get_character_count(AtkText* text) { AccessibilityObject* coreObject = core(text); @@ -1391,6 +1410,7 @@ static void atk_text_interface_init(AtkTextIface* iface) iface->get_run_attributes = webkit_accessible_text_get_run_attributes; iface->get_default_attributes = webkit_accessible_text_get_default_attributes; iface->get_character_extents = webkit_accessible_text_get_character_extents; + iface->get_range_extents = webkit_accessible_text_get_range_extents; iface->get_character_count = webkit_accessible_text_get_character_count; iface->get_offset_at_point = webkit_accessible_text_get_offset_at_point; iface->get_n_selections = webkit_accessible_text_get_n_selections; diff --git a/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp b/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp index 153f995..eb027c3 100644 --- a/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp +++ b/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp @@ -48,6 +48,7 @@ bool RuntimeEnabledFeatures::isWebGLEnabled = false; bool RuntimeEnabledFeatures::isPushStateEnabled = false; bool RuntimeEnabledFeatures::isTouchEnabled = true; bool RuntimeEnabledFeatures::isDeviceOrientationEnabled = true; +bool RuntimeEnabledFeatures::isSpeechInputEnabled = true; #if ENABLE(VIDEO) diff --git a/WebCore/bindings/generic/RuntimeEnabledFeatures.h b/WebCore/bindings/generic/RuntimeEnabledFeatures.h index b059d6e..c9eb21f 100644 --- a/WebCore/bindings/generic/RuntimeEnabledFeatures.h +++ b/WebCore/bindings/generic/RuntimeEnabledFeatures.h @@ -119,6 +119,10 @@ public: static bool deviceOrientationEventEnabled() { return isDeviceOrientationEnabled; } static bool ondeviceorientationEnabled() { return isDeviceOrientationEnabled; } + static void setSpeechInputEnabled(bool isEnabled) { isSpeechInputEnabled = isEnabled; } + static bool speechInputEnabled() { return isSpeechInputEnabled; } + static bool speechEnabled() { return isSpeechInputEnabled; } + private: // Never instantiate. RuntimeEnabledFeatures() { } @@ -133,6 +137,7 @@ private: static bool isPushStateEnabled; static bool isTouchEnabled; static bool isDeviceOrientationEnabled; + static bool isSpeechInputEnabled; }; } // namespace WebCore diff --git a/WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.cpp b/WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.cpp index 1513b66..44928eb 100644 --- a/WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.cpp +++ b/WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.cpp @@ -37,6 +37,7 @@ #include "HTMLAnchorElement.h" #include "HTMLAppletElement.h" #include "HTMLAreaElement.h" +#include "HTMLAudioElement.h" #include "HTMLBRElement.h" #include "HTMLBaseElement.h" #include "HTMLBaseFontElement.h" @@ -95,6 +96,7 @@ #include "webkit/WebKitDOMHTMLAnchorElementPrivate.h" #include "webkit/WebKitDOMHTMLAppletElementPrivate.h" #include "webkit/WebKitDOMHTMLAreaElementPrivate.h" +#include "webkit/WebKitDOMHTMLAudioElementPrivate.h" #include "webkit/WebKitDOMHTMLBRElementPrivate.h" #include "webkit/WebKitDOMHTMLBaseElementPrivate.h" #include "webkit/WebKitDOMHTMLBaseFontElementPrivate.h" @@ -175,6 +177,11 @@ static gpointer createAreaWrapper(PassRefPtr<HTMLElement> element) return wrapHTMLAreaElement(static_cast<HTMLAreaElement*>(element.get())); } +static gpointer createAudioWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLAudioElement(static_cast<HTMLAudioElement*>(element.get())); +} + static gpointer createBaseWrapper(PassRefPtr<HTMLElement> element) { return wrapHTMLBaseElement(static_cast<HTMLBaseElement*>(element.get())); @@ -446,6 +453,7 @@ gpointer createHTMLElementWrapper(PassRefPtr<WebCore::HTMLElement> element) if (map.isEmpty()) { map.set(aTag.localName().impl(), createAnchorWrapper); map.set(appletTag.localName().impl(), createAppletWrapper); + map.set(audioTag.localName().impl(), createAudioWrapper); map.set(areaTag.localName().impl(), createAreaWrapper); map.set(baseTag.localName().impl(), createBaseWrapper); map.set(basefontTag.localName().impl(), createBaseFontWrapper); diff --git a/WebCore/bindings/js/JSCustomVoidCallback.cpp b/WebCore/bindings/js/JSCustomVoidCallback.cpp index d5c4ac3..96b5412 100644 --- a/WebCore/bindings/js/JSCustomVoidCallback.cpp +++ b/WebCore/bindings/js/JSCustomVoidCallback.cpp @@ -48,7 +48,10 @@ JSCustomVoidCallback::JSCustomVoidCallback(JSObject* callback, JSDOMGlobalObject JSCustomVoidCallback::~JSCustomVoidCallback() { - m_scriptExecutionContext->postTask(DeleteCallbackDataTask::create(m_data)); + if (m_scriptExecutionContext->isContextThread()) + delete m_data; + else + m_scriptExecutionContext->postTask(DeleteCallbackDataTask::create(m_data)); #ifndef NDEBUG m_data = 0; #endif diff --git a/WebCore/bindings/js/JSIDBAnyCustom.cpp b/WebCore/bindings/js/JSIDBAnyCustom.cpp index b7c845e..92f725a 100644 --- a/WebCore/bindings/js/JSIDBAnyCustom.cpp +++ b/WebCore/bindings/js/JSIDBAnyCustom.cpp @@ -33,15 +33,15 @@ #include "IDBAny.h" #include "IDBDatabaseRequest.h" -#include "IDBIndexRequest.h" +#include "IDBFactory.h" +#include "IDBIndex.h" #include "IDBKey.h" #include "IDBObjectStoreRequest.h" -#include "IndexedDatabaseRequest.h" #include "JSIDBDatabaseRequest.h" -#include "JSIDBIndexRequest.h" +#include "JSIDBFactory.h" +#include "JSIDBIndex.h" #include "JSIDBKey.h" #include "JSIDBObjectStoreRequest.h" -#include "JSIndexedDatabaseRequest.h" #include "SerializedScriptValue.h" using namespace JSC; @@ -60,14 +60,14 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, IDBAny* idbAny) return jsNull(); case IDBAny::IDBDatabaseRequestType: return toJS(exec, globalObject, idbAny->idbDatabaseRequest()); - case IDBAny::IDBIndexRequestType: - return toJS(exec, globalObject, idbAny->idbIndexRequest()); + case IDBAny::IDBIndexType: + return toJS(exec, globalObject, idbAny->idbIndex()); case IDBAny::IDBKeyType: return toJS(exec, globalObject, idbAny->idbKey()); case IDBAny::IDBObjectStoreRequestType: return toJS(exec, globalObject, idbAny->idbObjectStoreRequest()); - case IDBAny::IndexedDatabaseRequestType: - return toJS(exec, globalObject, idbAny->indexedDatabaseRequest()); + case IDBAny::IDBFactoryType: + return toJS(exec, globalObject, idbAny->idbFactory()); case IDBAny::SerializedScriptValueType: return idbAny->serializedScriptValue()->deserialize(exec, globalObject); } diff --git a/WebCore/bindings/js/JSPluginElementFunctions.cpp b/WebCore/bindings/js/JSPluginElementFunctions.cpp index cf43e91..893b967 100644 --- a/WebCore/bindings/js/JSPluginElementFunctions.cpp +++ b/WebCore/bindings/js/JSPluginElementFunctions.cpp @@ -35,12 +35,18 @@ using namespace HTMLNames; // Runtime object support code for JSHTMLAppletElement, JSHTMLEmbedElement and JSHTMLObjectElement. +static inline bool isPluginElement(Node* node) +{ + return node->hasTagName(objectTag) || node->hasTagName(embedTag) || node->hasTagName(appletTag); +} + Instance* pluginInstance(Node* node) { if (!node) return 0; - if (!(node->hasTagName(objectTag) || node->hasTagName(embedTag) || node->hasTagName(appletTag))) + if (!isPluginElement(node)) return 0; + HTMLPlugInElement* plugInElement = static_cast<HTMLPlugInElement*>(node); // The plugin element holds an owning reference, so we don't have to. Instance* instance = plugInElement->getInstance().get(); @@ -49,22 +55,40 @@ Instance* pluginInstance(Node* node) return instance; } +static JSObject* pluginScriptObjectFromPluginViewBase(HTMLPlugInElement* pluginElement, JSGlobalObject* globalObject) +{ + Widget* pluginWidget = pluginElement->pluginWidget(); + if (!pluginWidget) + return 0; + + if (!pluginWidget->isPluginViewBase()) + return 0; + + PluginViewBase* pluginViewBase = static_cast<PluginViewBase*>(pluginWidget); + return pluginViewBase->scriptObject(globalObject); +} + +static JSObject* pluginScriptObjectFromPluginViewBase(JSHTMLElement* jsHTMLElement) +{ + HTMLElement* element = jsHTMLElement->impl(); + if (!isPluginElement(element)) + return 0; + + HTMLPlugInElement* pluginElement = static_cast<HTMLPlugInElement*>(element); + return pluginScriptObjectFromPluginViewBase(pluginElement, jsHTMLElement->globalObject()); +} + JSObject* pluginScriptObject(ExecState* exec, JSHTMLElement* jsHTMLElement) { HTMLElement* element = jsHTMLElement->impl(); - if (!(element->hasTagName(objectTag) || element->hasTagName(embedTag) || element->hasTagName(appletTag))) + if (!isPluginElement(element)) return 0; HTMLPlugInElement* pluginElement = static_cast<HTMLPlugInElement*>(element); // First, see if we can ask the plug-in view for its script object. - if (Widget* pluginWidget = pluginElement->pluginWidget()) { - if (pluginWidget->isPluginViewBase()) { - PluginViewBase* pluginViewBase = static_cast<PluginViewBase*>(pluginWidget); - if (JSObject* scriptObject = pluginViewBase->scriptObject(exec, jsHTMLElement->globalObject())) - return scriptObject; - } - } + if (JSObject* scriptObject = pluginScriptObjectFromPluginViewBase(pluginElement, jsHTMLElement->globalObject())) + return scriptObject; // Otherwise, fall back to getting the object from the instance. @@ -127,15 +151,39 @@ bool runtimeObjectCustomPut(ExecState* exec, const Identifier& propertyName, JSV static EncodedJSValue JSC_HOST_CALL callPlugin(ExecState* exec) { - Instance* instance = pluginInstance(static_cast<JSHTMLElement*>(exec->callee())->impl()); - instance->begin(); - JSValue result = instance->invokeDefaultMethod(exec); - instance->end(); + JSHTMLElement* element = static_cast<JSHTMLElement*>(exec->callee()); + + // Get the plug-in script object. + JSObject* scriptObject = pluginScriptObject(exec, element); + ASSERT(scriptObject); + + size_t argumentCount = exec->argumentCount(); + MarkedArgumentBuffer argumentList; + for (size_t i = 0; i < argumentCount; i++) + argumentList.append(exec->argument(i)); + + CallData callData; + CallType callType = getCallData(scriptObject, callData); + ASSERT(callType == CallTypeHost); + + // Call the object. + JSValue result = call(exec, scriptObject, callType, callData, exec->hostThisValue(), argumentList); return JSValue::encode(result); } CallType runtimeObjectGetCallData(JSHTMLElement* element, CallData& callData) { + // First, ask the plug-in view base for its runtime object. + if (JSObject* scriptObject = pluginScriptObjectFromPluginViewBase(element)) { + CallData scriptObjectCallData; + + if (scriptObject->getCallData(scriptObjectCallData) == CallTypeNone) + return CallTypeNone; + + callData.native.function = callPlugin; + return CallTypeHost; + } + Instance* instance = pluginInstance(element->impl()); if (!instance || !instance->supportsInvokeDefaultMethod()) return CallTypeNone; diff --git a/WebCore/bindings/scripts/CodeGenerator.pm b/WebCore/bindings/scripts/CodeGenerator.pm index 363fdc5..adc47d0 100644 --- a/WebCore/bindings/scripts/CodeGenerator.pm +++ b/WebCore/bindings/scripts/CodeGenerator.pm @@ -343,6 +343,11 @@ sub WK_ucfirst my ($object, $param) = @_; my $ret = ucfirst($param); $ret =~ s/Xml/XML/ if $ret =~ /^Xml[^a-z]/; + + # For HTML5 FileSystem API Flags attributes. + $ret =~ s/^CREATE/Create/ if $ret =~ /^CREATE$/; + $ret =~ s/^EXCLUSIVE/Exclusive/ if $ret =~ /^EXCLUSIVE$/; + return $ret; } @@ -357,6 +362,11 @@ sub WK_lcfirst $ret =~ s/jS/js/ if $ret =~ /^jS/; $ret =~ s/xML/xml/ if $ret =~ /^xML/; $ret =~ s/xSLT/xslt/ if $ret =~ /^xSLT/; + + # For HTML5 FileSystem API Flags attributes. + $ret =~ s/^cREATE/isCreate/ if $ret =~ /^cREATE$/; + $ret =~ s/^eXCLUSIVE/isExclusive/ if $ret =~ /^eXCLUSIVE$/; + return $ret; } diff --git a/WebCore/bindings/scripts/CodeGeneratorGObject.pm b/WebCore/bindings/scripts/CodeGeneratorGObject.pm index ae4ac39..bc5aace 100644 --- a/WebCore/bindings/scripts/CodeGeneratorGObject.pm +++ b/WebCore/bindings/scripts/CodeGeneratorGObject.pm @@ -822,6 +822,15 @@ sub GenerateFunction { } } + # Not quite sure what to do with this yet, but we need to take into + # account the difference in parameters between the IDL file and the + # actual implementation. + if ($function->signature->extendedAttributes->{"NeedsUserGestureCheck"}) { + $functionSig .= ", gboolean isUserGesture"; + $callImplParams .= ", " if $callImplParams; + $callImplParams .= "false"; + } + if ($returnType ne "void" && $returnValueIsGDOMType && $functionSigType ne "DOMObject") { if ($functionSigType ne "EventTarget") { $implIncludes{"webkit/WebKitDOM${functionSigType}Private.h"} = 1; diff --git a/WebCore/bindings/scripts/CodeGeneratorJS.pm b/WebCore/bindings/scripts/CodeGeneratorJS.pm index 05f532c..247430f 100644 --- a/WebCore/bindings/scripts/CodeGeneratorJS.pm +++ b/WebCore/bindings/scripts/CodeGeneratorJS.pm @@ -219,6 +219,14 @@ sub GetVisibleClassName return $className; } +sub GetCallbackClassName +{ + my $className = shift; + + return "JSCustomVoidCallback" if $className eq "VoidCallback"; + return "JS$className"; +} + sub AvoidInclusionOfType { my $type = shift; @@ -1913,7 +1921,7 @@ sub GenerateImplementation } my $name = $parameter->name; - + if ($parameter->type eq "XPathNSResolver") { push(@implContent, " RefPtr<XPathNSResolver> customResolver;\n"); push(@implContent, " XPathNSResolver* resolver = toXPathNSResolver(exec->argument($argsIndex));\n"); @@ -1923,6 +1931,15 @@ sub GenerateImplementation push(@implContent, " return JSValue::encode(jsUndefined());\n"); push(@implContent, " resolver = customResolver.get();\n"); push(@implContent, " }\n"); + } elsif ($parameter->extendedAttributes->{"Callback"}) { + my $callbackClassName = GetCallbackClassName($parameter->type); + $implIncludes{"$callbackClassName.h"} = 1; + $implIncludes{"ExceptionCode.h"} = 1; + push(@implContent, " if (exec->argumentCount() <= $argsIndex || !exec->argument($argsIndex).isObject()) {\n"); + push(@implContent, " setDOMException(exec, TYPE_MISMATCH_ERR);\n"); + push(@implContent, " return jsUndefined();\n"); + push(@implContent, " }\n"); + push(@implContent, " RefPtr<" . $parameter->type . "> $name = " . $callbackClassName . "::create(asObject(exec->argument($argsIndex)), castedThis->globalObject());\n"); } else { push(@implContent, " " . GetNativeTypeFromSignature($parameter) . " $name = " . JSValueToNative($parameter, "exec->argument($argsIndex)") . ";\n"); @@ -2151,7 +2168,10 @@ sub GenerateCallbackImplementation # Destructor push(@implContent, "${className}::~${className}()\n"); push(@implContent, "{\n"); - push(@implContent, " m_scriptExecutionContext->postTask(DeleteCallbackDataTask::create(m_data));\n"); + push(@implContent, " if (m_scriptExecutionContext->isContextThread())\n"); + push(@implContent, " delete m_data;\n"); + push(@implContent, " else\n"); + push(@implContent, " m_scriptExecutionContext->postTask(DeleteCallbackDataTask::create(m_data));\n"); push(@implContent, "#ifndef NDEBUG\n"); push(@implContent, " m_data = 0;\n"); push(@implContent, "#endif\n"); diff --git a/WebCore/bindings/scripts/CodeGeneratorV8.pm b/WebCore/bindings/scripts/CodeGeneratorV8.pm index c963e04..c852f7b 100644 --- a/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -1139,7 +1139,7 @@ END my $raisesExceptions = @{$function->raisesExceptions}; if (!$raisesExceptions) { foreach my $parameter (@{$function->parameters}) { - if (TypeCanFailConversion($parameter) or $parameter->extendedAttributes->{"IsIndex"}) { + if ((!$parameter->extendedAttributes->{"Callback"} and TypeCanFailConversion($parameter)) or $parameter->extendedAttributes->{"IsIndex"}) { $raisesExceptions = 1; } } @@ -1183,6 +1183,21 @@ END push(@implContentDecls, " }\n"); } + if ($parameter->extendedAttributes->{"Callback"}) { + my $className = GetCallbackClassName($parameter->type); + $implIncludes{"$className.h"} = 1; + $implIncludes{"ExceptionCode.h"} = 1; + push(@implContentDecls, " if (args.Length() <= $paramIndex || !args[$paramIndex]->IsObject())\n"); + push(@implContentDecls, " return throwError(TYPE_MISMATCH_ERR);\n"); + if ($parameter->type eq "VoidCallback") { + push(@implContentDecls, " RefPtr<" . $parameter->type . "> $parameterName = " . $className . "::create(args[$paramIndex], getScriptExecutionContext());\n"); + } else { + push(@implContentDecls, " RefPtr<" . $parameter->type . "> $parameterName = " . $className . "::create(args[$paramIndex]);\n"); + } + $paramIndex++; + next; + } + if ($parameter->type eq "SerializedScriptValue") { $implIncludes{"SerializedScriptValue.h"} = 1; push(@implContentDecls, " bool ${parameterName}DidThrow = false;\n"); @@ -3235,6 +3250,14 @@ sub GetVisibleInterfaceName return $interfaceName; } +sub GetCallbackClassName +{ + my $interfaceName = shift; + + return "V8CustomVoidCallback" if $interfaceName eq "VoidCallback"; + return "V8$interfaceName"; +} + sub DebugPrint { my $output = shift; diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp index 179b301..b8c551e 100644 --- a/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp +++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp @@ -176,6 +176,38 @@ void WebDOMTestObj::setTestObjAttr(const WebDOMTestObj& newTestObjAttr) impl()->setTestObjAttr(toWebCore(newTestObjAttr)); } +WebDOMTestObj WebDOMTestObj::XMLObjAttr() const +{ + if (!impl()) + return WebDOMTestObj(); + + return toWebKit(WTF::getPtr(impl()->xmlObjAttr())); +} + +void WebDOMTestObj::setXMLObjAttr(const WebDOMTestObj& newXMLObjAttr) +{ + if (!impl()) + return; + + impl()->setXMLObjAttr(toWebCore(newXMLObjAttr)); +} + +bool WebDOMTestObj::CREATE() const +{ + if (!impl()) + return false; + + return impl()->isCreate(); +} + +void WebDOMTestObj::setCREATE(bool newCREATE) +{ + if (!impl()) + return; + + impl()->setCreate(newCREATE); +} + WebDOMString WebDOMTestObj::reflectedStringAttr() const { if (!impl()) diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h index 09c77db..c3b65ca 100644 --- a/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h +++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h @@ -69,6 +69,10 @@ public: void setStringAttr(const WebDOMString&); WebDOMTestObj testObjAttr() const; void setTestObjAttr(const WebDOMTestObj&); + WebDOMTestObj XMLObjAttr() const; + void setXMLObjAttr(const WebDOMTestObj&); + bool CREATE() const; + void setCREATE(bool); WebDOMString reflectedStringAttr() const; void setReflectedStringAttr(const WebDOMString&); int reflectedIntegralAttr() const; diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp index b4b6787..6a8399e 100644 --- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp @@ -475,6 +475,48 @@ webkit_dom_test_obj_set_test_obj_attr(WebKitDOMTestObj* self, WebKitDOMTestObj* item->setTestObjAttr(converted_value); } +WebKitDOMTestObj* +webkit_dom_test_obj_get_xml_obj_attr(WebKitDOMTestObj* self) +{ + WebCore::JSMainThreadNullState state; + g_return_val_if_fail(self, 0); + WebCore::TestObj * item = WebKit::core(self); + PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->xmlObjAttr()); + WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get())); + return res; +} + +void +webkit_dom_test_obj_set_xml_obj_attr(WebKitDOMTestObj* self, WebKitDOMTestObj* value) +{ + WebCore::JSMainThreadNullState state; + g_return_if_fail(self); + WebCore::TestObj * item = WebKit::core(self); + g_return_if_fail(value); + WebCore::TestObj * converted_value = WebKit::core(value); + g_return_if_fail(converted_value); + item->setXMLObjAttr(converted_value); +} + +gboolean +webkit_dom_test_obj_get_create(WebKitDOMTestObj* self) +{ + WebCore::JSMainThreadNullState state; + g_return_val_if_fail(self, 0); + WebCore::TestObj * item = WebKit::core(self); + gboolean res = item->isCreate(); + return res; +} + +void +webkit_dom_test_obj_set_create(WebKitDOMTestObj* self, gboolean value) +{ + WebCore::JSMainThreadNullState state; + g_return_if_fail(self); + WebCore::TestObj * item = WebKit::core(self); + item->setCreate(value); +} + gchar* webkit_dom_test_obj_get_reflected_string_attr(WebKitDOMTestObj* self) { @@ -932,6 +974,8 @@ enum { PROP_UNSIGNED_LONG_LONG_ATTR, PROP_STRING_ATTR, PROP_TEST_OBJ_ATTR, + PROP_XML_OBJ_ATTR, + PROP_CREATE, PROP_REFLECTED_STRING_ATTR, PROP_REFLECTED_INTEGRAL_ATTR, PROP_REFLECTED_BOOLEAN_ATTR, @@ -1000,6 +1044,11 @@ static void webkit_dom_test_obj_set_property(GObject* object, guint prop_id, con coreSelf->setStringAttr(WebCore::String::fromUTF8(g_value_get_string(value))); break; } + case PROP_CREATE: + { + coreSelf->setCreate((g_value_get_boolean(value))); + break; + } case PROP_REFLECTED_STRING_ATTR: { coreSelf->setAttribute(WebCore::HTMLNames::reflectedstringattrAttr, WebCore::String::fromUTF8(g_value_get_string(value))); @@ -1155,6 +1204,17 @@ static void webkit_dom_test_obj_get_property(GObject* object, guint prop_id, GVa g_value_set_object(value, WebKit::kit(ptr.get())); break; } + case PROP_XML_OBJ_ATTR: + { + RefPtr<WebCore::TestObj> ptr = coreSelf->xmlObjAttr(); + g_value_set_object(value, WebKit::kit(ptr.get())); + break; + } + case PROP_CREATE: + { + g_value_set_boolean(value, coreSelf->isCreate()); + break; + } case PROP_REFLECTED_STRING_ATTR: { g_value_take_string(value, convertToUTF8String(coreSelf->getAttribute(WebCore::HTMLNames::reflectedstringattrAttr))); @@ -1355,6 +1415,20 @@ G_MAXUINT64, /* min */ WEBKIT_TYPE_DOM_TEST_OBJ, /* gobject type */ WEBKIT_PARAM_READWRITE)); g_object_class_install_property(gobjectClass, + PROP_XML_OBJ_ATTR, + g_param_spec_object("xml-obj-attr", /* name */ + "test_obj_xml-obj-attr", /* short description */ + "read-write WebKitDOMTestObj* TestObj.xml-obj-attr", /* longer - could do with some extra doc stuff here */ + WEBKIT_TYPE_DOM_TEST_OBJ, /* gobject type */ + WEBKIT_PARAM_READWRITE)); + g_object_class_install_property(gobjectClass, + PROP_CREATE, + g_param_spec_boolean("create", /* name */ + "test_obj_create", /* short description */ + "read-write gboolean TestObj.create", /* longer - could do with some extra doc stuff here */ + FALSE, /* default */ + WEBKIT_PARAM_READWRITE)); + g_object_class_install_property(gobjectClass, PROP_REFLECTED_STRING_ATTR, g_param_spec_string("reflected-string-attr", /* name */ "test_obj_reflected-string-attr", /* short description */ diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h index baf278c..c9a1821 100644 --- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h @@ -163,6 +163,18 @@ webkit_dom_test_obj_get_test_obj_attr(WebKitDOMTestObj* self); WEBKIT_API void webkit_dom_test_obj_set_test_obj_attr(WebKitDOMTestObj* self, WebKitDOMTestObj* value); +WEBKIT_API WebKitDOMTestObj* +webkit_dom_test_obj_get_xml_obj_attr(WebKitDOMTestObj* self); + +WEBKIT_API void +webkit_dom_test_obj_set_xml_obj_attr(WebKitDOMTestObj* self, WebKitDOMTestObj* value); + +WEBKIT_API gboolean +webkit_dom_test_obj_get_create(WebKitDOMTestObj* self); + +WEBKIT_API void +webkit_dom_test_obj_set_create(WebKitDOMTestObj* self, gboolean value); + WEBKIT_API gchar* webkit_dom_test_obj_get_reflected_string_attr(WebKitDOMTestObj* self); diff --git a/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp b/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp index 043a6ed..6f6b568 100644 --- a/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp +++ b/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp @@ -43,7 +43,10 @@ JSTestCallback::JSTestCallback(JSObject* callback, JSDOMGlobalObject* globalObje JSTestCallback::~JSTestCallback() { - m_scriptExecutionContext->postTask(DeleteCallbackDataTask::create(m_data)); + if (m_scriptExecutionContext->isContextThread()) + delete m_data; + else + m_scriptExecutionContext->postTask(DeleteCallbackDataTask::create(m_data)); #ifndef NDEBUG m_data = 0; #endif diff --git a/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/WebCore/bindings/scripts/test/JS/JSTestObj.cpp index 5aa54da..9c11bde 100644 --- a/WebCore/bindings/scripts/test/JS/JSTestObj.cpp +++ b/WebCore/bindings/scripts/test/JS/JSTestObj.cpp @@ -21,10 +21,12 @@ #include "config.h" #include "JSTestObj.h" +#include "ExceptionCode.h" #include "HTMLNames.h" #include "IDBBindingUtilities.h" #include "IDBKey.h" #include "JSEventListener.h" +#include "JSTestCallback.h" #include "JSTestObj.h" #include "JSlog.h" #include "KURL.h" @@ -49,7 +51,7 @@ ASSERT_CLASS_FITS_IN_CELL(JSTestObj); #define THUNK_GENERATOR(generator) #endif -static const HashTableValue JSTestObjTableValues[32] = +static const HashTableValue JSTestObjTableValues[34] = { { "readOnlyIntAttr", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReadOnlyIntAttr), (intptr_t)0 THUNK_GENERATOR(0) }, { "readOnlyStringAttr", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReadOnlyStringAttr), (intptr_t)0 THUNK_GENERATOR(0) }, @@ -59,6 +61,8 @@ static const HashTableValue JSTestObjTableValues[32] = { "unsignedLongLongAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjUnsignedLongLongAttr), (intptr_t)setJSTestObjUnsignedLongLongAttr THUNK_GENERATOR(0) }, { "stringAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjStringAttr), (intptr_t)setJSTestObjStringAttr THUNK_GENERATOR(0) }, { "testObjAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjTestObjAttr), (intptr_t)setJSTestObjTestObjAttr THUNK_GENERATOR(0) }, + { "XMLObjAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjXMLObjAttr), (intptr_t)setJSTestObjXMLObjAttr THUNK_GENERATOR(0) }, + { "CREATE", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCreate), (intptr_t)setJSTestObjCreate THUNK_GENERATOR(0) }, { "reflectedStringAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedStringAttr), (intptr_t)setJSTestObjReflectedStringAttr THUNK_GENERATOR(0) }, { "reflectedIntegralAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedIntegralAttr), (intptr_t)setJSTestObjReflectedIntegralAttr THUNK_GENERATOR(0) }, { "reflectedBooleanAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedBooleanAttr), (intptr_t)setJSTestObjReflectedBooleanAttr THUNK_GENERATOR(0) }, @@ -92,7 +96,7 @@ static const HashTableValue JSTestObjTableValues[32] = }; #undef THUNK_GENERATOR -static JSC_CONST_HASHTABLE HashTable JSTestObjTable = { 68, 63, JSTestObjTableValues, 0 }; +static JSC_CONST_HASHTABLE HashTable JSTestObjTable = { 132, 127, JSTestObjTableValues, 0 }; /* Hash table for constructor */ #if ENABLE(JIT) #define THUNK_GENERATOR(generator) , generator @@ -172,7 +176,7 @@ bool JSTestObjConstructor::getOwnPropertyDescriptor(ExecState* exec, const Ident #define THUNK_GENERATOR(generator) #endif -static const HashTableValue JSTestObjPrototypeTableValues[42] = +static const HashTableValue JSTestObjPrototypeTableValues[45] = { { "CONST_VALUE_0", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCONST_VALUE_0), (intptr_t)0 THUNK_GENERATOR(0) }, { "CONST_VALUE_1", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCONST_VALUE_1), (intptr_t)0 THUNK_GENERATOR(0) }, @@ -214,12 +218,15 @@ static const HashTableValue JSTestObjPrototypeTableValues[42] = { "methodWithOptionalArg", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalArg), (intptr_t)1 THUNK_GENERATOR(0) }, { "methodWithNonOptionalArgAndOptionalArg", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg), (intptr_t)2 THUNK_GENERATOR(0) }, { "methodWithNonOptionalArgAndTwoOptionalArgs", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs), (intptr_t)3 THUNK_GENERATOR(0) }, + { "methodWithCallbackArg", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithCallbackArg), (intptr_t)1 THUNK_GENERATOR(0) }, + { "methodWithNonCallbackArgAndCallbackArg", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg), (intptr_t)2 THUNK_GENERATOR(0) }, + { "methodWithCallbackAndOptionalArg", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithCallbackAndOptionalArg), (intptr_t)1 THUNK_GENERATOR(0) }, { "overloadedMethod", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionOverloadedMethod), (intptr_t)2 THUNK_GENERATOR(0) }, { 0, 0, 0, 0 THUNK_GENERATOR(0) } }; #undef THUNK_GENERATOR -static JSC_CONST_HASHTABLE HashTable JSTestObjPrototypeTable = { 134, 127, JSTestObjPrototypeTableValues, 0 }; +static JSC_CONST_HASHTABLE HashTable JSTestObjPrototypeTable = { 135, 127, JSTestObjPrototypeTableValues, 0 }; const ClassInfo JSTestObjPrototype::s_info = { "TestObjPrototype", 0, &JSTestObjPrototypeTable, 0 }; JSObject* JSTestObjPrototype::self(ExecState* exec, JSGlobalObject* globalObject) @@ -337,6 +344,24 @@ JSValue jsTestObjTestObjAttr(ExecState* exec, JSValue slotBase, const Identifier return result; } +JSValue jsTestObjXMLObjAttr(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->xmlObjAttr())); + return result; +} + +JSValue jsTestObjCreate(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSValue result = jsBoolean(imp->isCreate()); + return result; +} + JSValue jsTestObjReflectedStringAttr(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); @@ -585,6 +610,20 @@ void setJSTestObjTestObjAttr(ExecState* exec, JSObject* thisObject, JSValue valu imp->setTestObjAttr(toTestObj(value)); } +void setJSTestObjXMLObjAttr(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + imp->setXMLObjAttr(toTestObj(value)); +} + +void setJSTestObjCreate(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + imp->setCreate(value.toBoolean(exec)); +} + void setJSTestObjReflectedStringAttr(ExecState* exec, JSObject* thisObject, JSValue value) { JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); @@ -1189,6 +1228,65 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgA return JSValue::encode(jsUndefined()); } +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackArg(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwVMTypeError(exec); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + if (exec->argumentCount() <= 0 || !exec->argument(0).isObject()) { + setDOMException(exec, TYPE_MISMATCH_ERR); + return jsUndefined(); + } + RefPtr<TestCallback> callback = JSTestCallback::create(asObject(exec->argument(0)), castedThis->globalObject()); + + imp->methodWithCallbackArg(callback); + return JSValue::encode(jsUndefined()); +} + +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwVMTypeError(exec); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + int nonCallback = exec->argument(0).toInt32(exec); + if (exec->argumentCount() <= 1 || !exec->argument(1).isObject()) { + setDOMException(exec, TYPE_MISMATCH_ERR); + return jsUndefined(); + } + RefPtr<TestCallback> callback = JSTestCallback::create(asObject(exec->argument(1)), castedThis->globalObject()); + + imp->methodWithNonCallbackArgAndCallbackArg(nonCallback, callback); + return JSValue::encode(jsUndefined()); +} + +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackAndOptionalArg(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwVMTypeError(exec); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + + int argsCount = exec->argumentCount(); + if (argsCount < 1) { + imp->methodWithCallbackAndOptionalArg(); + return JSValue::encode(jsUndefined()); + } + + if (exec->argumentCount() <= 0 || !exec->argument(0).isObject()) { + setDOMException(exec, TYPE_MISMATCH_ERR); + return jsUndefined(); + } + RefPtr<TestCallback> callback = JSTestCallback::create(asObject(exec->argument(0)), castedThis->globalObject()); + + imp->methodWithCallbackAndOptionalArg(callback); + return JSValue::encode(jsUndefined()); +} + static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod1(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); diff --git a/WebCore/bindings/scripts/test/JS/JSTestObj.h b/WebCore/bindings/scripts/test/JS/JSTestObj.h index 0648526..993df8c 100644 --- a/WebCore/bindings/scripts/test/JS/JSTestObj.h +++ b/WebCore/bindings/scripts/test/JS/JSTestObj.h @@ -115,6 +115,9 @@ JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptExecutionC JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(JSC::ExecState*); JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg(JSC::ExecState*); JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackArg(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackAndOptionalArg(JSC::ExecState*); JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(JSC::ExecState*); // Attributes @@ -131,6 +134,10 @@ JSC::JSValue jsTestObjStringAttr(JSC::ExecState*, JSC::JSValue, const JSC::Ident void setJSTestObjStringAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsTestObjTestObjAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); void setJSTestObjTestObjAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestObjXMLObjAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjXMLObjAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestObjCreate(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjCreate(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsTestObjReflectedStringAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); void setJSTestObjReflectedStringAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsTestObjReflectedIntegralAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); diff --git a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h index a96b499..4a0f065 100644 --- a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h +++ b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h @@ -62,6 +62,10 @@ enum { - (void)setStringAttr:(NSString *)newStringAttr; - (DOMTestObj *)testObjAttr; - (void)setTestObjAttr:(DOMTestObj *)newTestObjAttr; +- (DOMTestObj *)XMLObjAttr; +- (void)setXMLObjAttr:(DOMTestObj *)newXMLObjAttr; +- (BOOL)CREATE; +- (void)setCREATE:(BOOL)newCREATE; - (NSString *)reflectedStringAttr; - (void)setReflectedStringAttr:(NSString *)newReflectedStringAttr; - (int)reflectedIntegralAttr; diff --git a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm index 99c3cc6..71d3508 100644 --- a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm +++ b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm @@ -154,6 +154,32 @@ IMPL->setTestObjAttr(core(newTestObjAttr)); } +- (DOMTestObj *)XMLObjAttr +{ + WebCore::JSMainThreadNullState state; + return kit(WTF::getPtr(IMPL->xmlObjAttr())); +} + +- (void)setXMLObjAttr:(DOMTestObj *)newXMLObjAttr +{ + WebCore::JSMainThreadNullState state; + ASSERT(newXMLObjAttr); + + IMPL->setXMLObjAttr(core(newXMLObjAttr)); +} + +- (BOOL)CREATE +{ + WebCore::JSMainThreadNullState state; + return IMPL->isCreate(); +} + +- (void)setCREATE:(BOOL)newCREATE +{ + WebCore::JSMainThreadNullState state; + IMPL->setCreate(newCREATE); +} + - (NSString *)reflectedStringAttr { WebCore::JSMainThreadNullState state; diff --git a/WebCore/bindings/scripts/test/TestObj.idl b/WebCore/bindings/scripts/test/TestObj.idl index a5daa24..a2bc89d 100644 --- a/WebCore/bindings/scripts/test/TestObj.idl +++ b/WebCore/bindings/scripts/test/TestObj.idl @@ -41,6 +41,11 @@ module test { attribute DOMString stringAttr; attribute TestObj testObjAttr; + JS, V8 + // WK_ucfirst, WK_lcfirst exceptional cases. + attribute TestObj XMLObjAttr; + attribute boolean CREATE; + // Reflected DOM attributes attribute [Reflect] DOMString reflectedStringAttr; attribute [Reflect] long reflectedIntegralAttr; @@ -109,6 +114,13 @@ module test { void methodWithNonOptionalArgAndOptionalArg(in long nonOpt, in [Optional] long opt); void methodWithNonOptionalArgAndTwoOptionalArgs(in long nonOpt, in [Optional] long opt1, in long opt2); +#if defined(TESTING_V8) || defined(TESTING_JS) + // 'Callback' extended attribute + void methodWithCallbackArg(in [Callback] TestCallback callback); + void methodWithNonCallbackArgAndCallbackArg(in long nonCallback, in [Callback] TestCallback callback); + void methodWithCallbackAndOptionalArg(in [Callback, Optional] TestCallback callback); +#endif + // 'ConvertScriptString' extended attribute readonly attribute [ConvertScriptString] DOMString scriptStringAttr; diff --git a/WebCore/bindings/scripts/test/V8/V8TestObj.cpp b/WebCore/bindings/scripts/test/V8/V8TestObj.cpp index 09d99f8..5584eaf 100644 --- a/WebCore/bindings/scripts/test/V8/V8TestObj.cpp +++ b/WebCore/bindings/scripts/test/V8/V8TestObj.cpp @@ -33,6 +33,7 @@ #include "V8DOMWrapper.h" #include "V8IsolatedContext.h" #include "V8Proxy.h" +#include "V8TestCallback.h" #include "V8log.h" #include <wtf/GetPtr.h> #include <wtf/RefCounted.h> @@ -154,6 +155,38 @@ static void testObjAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Valu return; } +static v8::Handle<v8::Value> XMLObjAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.XMLObjAttr._get"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + return toV8(imp->xmlObjAttr()); +} + +static void XMLObjAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.XMLObjAttr._set"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + TestObj* v = V8TestObj::HasInstance(value) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(value)) : 0; + imp->setXMLObjAttr(WTF::getPtr(v)); + return; +} + +static v8::Handle<v8::Value> CREATEAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.CREATE._get"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + return v8Boolean(imp->isCreate()); +} + +static void CREATEAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.CREATE._set"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + bool v = value->BooleanValue(); + imp->setCreate(v); + return; +} + static v8::Handle<v8::Value> reflectedStringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { INC_STATS("DOM.TestObj.reflectedStringAttr._get"); @@ -862,6 +895,44 @@ static v8::Handle<v8::Value> methodWithNonOptionalArgAndTwoOptionalArgsCallback( return v8::Handle<v8::Value>(); } +static v8::Handle<v8::Value> methodWithCallbackArgCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestObj.methodWithCallbackArg"); + TestObj* imp = V8TestObj::toNative(args.Holder()); + if (args.Length() <= 0 || !args[0]->IsObject()) + return throwError(TYPE_MISMATCH_ERR); + RefPtr<TestCallback> callback = V8TestCallback::create(args[0]); + imp->methodWithCallbackArg(callback); + return v8::Handle<v8::Value>(); +} + +static v8::Handle<v8::Value> methodWithNonCallbackArgAndCallbackArgCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestObj.methodWithNonCallbackArgAndCallbackArg"); + TestObj* imp = V8TestObj::toNative(args.Holder()); + int nonCallback = toInt32(args[0]); + if (args.Length() <= 1 || !args[1]->IsObject()) + return throwError(TYPE_MISMATCH_ERR); + RefPtr<TestCallback> callback = V8TestCallback::create(args[1]); + imp->methodWithNonCallbackArgAndCallbackArg(nonCallback, callback); + return v8::Handle<v8::Value>(); +} + +static v8::Handle<v8::Value> methodWithCallbackAndOptionalArgCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestObj.methodWithCallbackAndOptionalArg"); + TestObj* imp = V8TestObj::toNative(args.Holder()); + if (args.Length() <= 0) { + imp->methodWithCallbackAndOptionalArg(); + return v8::Handle<v8::Value>(); + } + if (args.Length() <= 0 || !args[0]->IsObject()) + return throwError(TYPE_MISMATCH_ERR); + RefPtr<TestCallback> callback = V8TestCallback::create(args[0]); + imp->methodWithCallbackAndOptionalArg(callback); + return v8::Handle<v8::Value>(); +} + static v8::Handle<v8::Value> overloadedMethod1Callback(const v8::Arguments& args) { INC_STATS("DOM.TestObj.overloadedMethod1"); @@ -938,6 +1009,10 @@ static const BatchedAttribute TestObjAttrs[] = { {"stringAttr", TestObjInternal::stringAttrAttrGetter, TestObjInternal::stringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'testObjAttr' (Type: 'attribute' ExtAttr: '') {"testObjAttr", TestObjInternal::testObjAttrAttrGetter, TestObjInternal::testObjAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'XMLObjAttr' (Type: 'attribute' ExtAttr: '') + {"XMLObjAttr", TestObjInternal::XMLObjAttrAttrGetter, TestObjInternal::XMLObjAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'CREATE' (Type: 'attribute' ExtAttr: '') + {"CREATE", TestObjInternal::CREATEAttrGetter, TestObjInternal::CREATEAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'reflectedStringAttr' (Type: 'attribute' ExtAttr: 'Reflect') {"reflectedStringAttr", TestObjInternal::reflectedStringAttrAttrGetter, TestObjInternal::reflectedStringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'reflectedIntegralAttr' (Type: 'attribute' ExtAttr: 'Reflect') @@ -1013,6 +1088,7 @@ static const BatchedCallback TestObjCallbacks[] = { {"methodWithOptionalArg", TestObjInternal::methodWithOptionalArgCallback}, {"methodWithNonOptionalArgAndOptionalArg", TestObjInternal::methodWithNonOptionalArgAndOptionalArgCallback}, {"methodWithNonOptionalArgAndTwoOptionalArgs", TestObjInternal::methodWithNonOptionalArgAndTwoOptionalArgsCallback}, + {"methodWithCallbackAndOptionalArg", TestObjInternal::methodWithCallbackAndOptionalArgCallback}, {"overloadedMethod", TestObjInternal::overloadedMethodCallback}, }; static const BatchedConstant TestObjConsts[] = { @@ -1085,6 +1161,18 @@ static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestObjTemplate(v8::Persi v8::Handle<v8::FunctionTemplate> customArgsAndExceptionArgv[customArgsAndExceptionArgc] = { V8log::GetRawTemplate() }; v8::Handle<v8::Signature> customArgsAndExceptionSignature = v8::Signature::New(desc, customArgsAndExceptionArgc, customArgsAndExceptionArgv); proto->Set(v8::String::New("customArgsAndException"), v8::FunctionTemplate::New(TestObjInternal::customArgsAndExceptionCallback, v8::Handle<v8::Value>(), customArgsAndExceptionSignature)); + + // Custom Signature 'methodWithCallbackArg' + const int methodWithCallbackArgArgc = 1; + v8::Handle<v8::FunctionTemplate> methodWithCallbackArgArgv[methodWithCallbackArgArgc] = { V8TestCallback::GetRawTemplate() }; + v8::Handle<v8::Signature> methodWithCallbackArgSignature = v8::Signature::New(desc, methodWithCallbackArgArgc, methodWithCallbackArgArgv); + proto->Set(v8::String::New("methodWithCallbackArg"), v8::FunctionTemplate::New(TestObjInternal::methodWithCallbackArgCallback, v8::Handle<v8::Value>(), methodWithCallbackArgSignature)); + + // Custom Signature 'methodWithNonCallbackArgAndCallbackArg' + const int methodWithNonCallbackArgAndCallbackArgArgc = 2; + v8::Handle<v8::FunctionTemplate> methodWithNonCallbackArgAndCallbackArgArgv[methodWithNonCallbackArgAndCallbackArgArgc] = { v8::Handle<v8::FunctionTemplate>(), V8TestCallback::GetRawTemplate() }; + v8::Handle<v8::Signature> methodWithNonCallbackArgAndCallbackArgSignature = v8::Signature::New(desc, methodWithNonCallbackArgAndCallbackArgArgc, methodWithNonCallbackArgAndCallbackArgArgv); + proto->Set(v8::String::New("methodWithNonCallbackArgAndCallbackArg"), v8::FunctionTemplate::New(TestObjInternal::methodWithNonCallbackArgAndCallbackArgCallback, v8::Handle<v8::Value>(), methodWithNonCallbackArgAndCallbackArgSignature)); batchConfigureConstants(desc, proto, TestObjConsts, sizeof(TestObjConsts) / sizeof(*TestObjConsts)); // Custom toString template diff --git a/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp b/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp index def1120..2ec3dcd 100644 --- a/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp +++ b/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp @@ -33,10 +33,10 @@ #include "SerializedScriptValue.h" #include "V8IDBDatabaseRequest.h" -#include "V8IDBIndexRequest.h" +#include "V8IDBFactory.h" +#include "V8IDBIndex.h" #include "V8IDBKey.h" #include "V8IDBObjectStoreRequest.h" -#include "V8IndexedDatabaseRequest.h" namespace WebCore { @@ -52,14 +52,14 @@ v8::Handle<v8::Value> toV8(IDBAny* impl) return v8::Null(); case IDBAny::IDBDatabaseRequestType: return toV8(impl->idbDatabaseRequest()); - case IDBAny::IDBIndexRequestType: - return toV8(impl->idbIndexRequest()); + case IDBAny::IDBIndexType: + return toV8(impl->idbIndex()); case IDBAny::IDBKeyType: return toV8(impl->idbKey()); case IDBAny::IDBObjectStoreRequestType: return toV8(impl->idbObjectStoreRequest()); - case IDBAny::IndexedDatabaseRequestType: - return toV8(impl->indexedDatabaseRequest()); + case IDBAny::IDBFactoryType: + return toV8(impl->idbFactory()); case IDBAny::SerializedScriptValueType: return impl->serializedScriptValue()->deserialize(); } diff --git a/WebCore/config.h b/WebCore/config.h index 5d5c6c1..d9a5899 100644 --- a/WebCore/config.h +++ b/WebCore/config.h @@ -325,3 +325,4 @@ typedef float CGFloat; #if PLATFORM(WIN) && PLATFORM(CG) #define WTF_USE_SAFARI_THEME 1 #endif + diff --git a/WebCore/css/CSSFontFaceSrcValue.cpp b/WebCore/css/CSSFontFaceSrcValue.cpp index 21eea04..5b204d7 100644 --- a/WebCore/css/CSSFontFaceSrcValue.cpp +++ b/WebCore/css/CSSFontFaceSrcValue.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2010 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,7 @@ #include "config.h" #include "CSSFontFaceSrcValue.h" #include "CSSStyleSheet.h" +#include "FontCustomPlatformData.h" #include "Node.h" namespace WebCore { @@ -48,10 +49,7 @@ bool CSSFontFaceSrcValue::isSupportedFormat() const return true; } - return equalIgnoringCase(m_format, "truetype") || equalIgnoringCase(m_format, "opentype") -#if ENABLE(OPENTYPE_SANITIZER) - || equalIgnoringCase(m_format, "woff") -#endif + return FontCustomPlatformData::supportsFormat(m_format) #if ENABLE(SVG_FONTS) || isSVGFontFaceSrc() #endif diff --git a/WebCore/css/CSSStyleSelector.cpp b/WebCore/css/CSSStyleSelector.cpp index 89d4f3e..6f64235 100644 --- a/WebCore/css/CSSStyleSelector.cpp +++ b/WebCore/css/CSSStyleSelector.cpp @@ -97,6 +97,11 @@ #include <wtf/StdLibExtras.h> #include <wtf/Vector.h> +#if USE(PLATFORM_STRATEGIES) +#include "PlatformStrategies.h" +#include "VisitedLinkStrategy.h" +#endif + #if ENABLE(DASHBOARD_SUPPORT) #include "DashboardRegion.h" #endif @@ -929,7 +934,12 @@ EInsideLink CSSStyleSelector::SelectorChecker::determineLinkStateSlowCase(Elemen return InsideUnvisitedLink; m_linksCheckedForVisitedState.add(hash); + +#if USE(PLATFORM_STRATEGIES) + return platformStrategies()->visitedLinkStrategy()->isLinkVisited(page, hash) ? InsideVisitedLink : InsideUnvisitedLink; +#else return page->group().isLinkVisited(hash) ? InsideVisitedLink : InsideUnvisitedLink; +#endif } bool CSSStyleSelector::SelectorChecker::checkSelector(CSSSelector* sel, Element* element) const diff --git a/WebCore/css/MediaFeatureNames.h b/WebCore/css/MediaFeatureNames.h index 8aaedb2..b8f2720 100644 --- a/WebCore/css/MediaFeatureNames.h +++ b/WebCore/css/MediaFeatureNames.h @@ -25,13 +25,6 @@ namespace WebCore { namespace MediaFeatureNames { -#if ENABLE(WIDGETS_10_SUPPORT) -#define CSS_MEDIAQUERY_NAMES_FOR_WIDGETS_10_MEDIAFEATURE(macro) \ - macro(view_mode, "-webkit-view-mode") -#else -#define CSS_MEDIAQUERY_NAMES_FOR_WIDGETS_10_MEDIAFEATURE(macro) -#endif - #define CSS_MEDIAQUERY_NAMES_FOR_EACH_MEDIAFEATURE(macro) \ macro(color, "color") \ macro(grid, "grid") \ @@ -66,7 +59,7 @@ namespace WebCore { macro(transform_3d, "-webkit-transform-3d") \ macro(transition, "-webkit-transition") \ macro(animation, "-webkit-animation") \ - CSS_MEDIAQUERY_NAMES_FOR_WIDGETS_10_MEDIAFEATURE(macro) + macro(view_mode, "-webkit-view-mode") // end of macro diff --git a/WebCore/css/MediaQueryEvaluator.cpp b/WebCore/css/MediaQueryEvaluator.cpp index 9d5822f..0b5507e 100644 --- a/WebCore/css/MediaQueryEvaluator.cpp +++ b/WebCore/css/MediaQueryEvaluator.cpp @@ -498,28 +498,13 @@ static bool transform_3dMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* f return returnValueIfNoParameter; } -#if ENABLE(WIDGETS_10_SUPPORT) static bool view_modeMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* frame, MediaFeaturePrefix op) { - if (value) { - String mode = static_cast<CSSPrimitiveValue*>(value)->getStringValue(); - if (ChromeClient* client = frame->page()->chrome()->client()) { - if (mode == "windowed" && client->isWindowed()) - return true; - if (mode == "floating" && client->isFloating()) - return true; - if (mode == "fullscreen" && client->isFullscreen()) - return true; - if (mode == "maximized" && client->isMaximized()) - return true; - if (mode == "minimized" && client->isMinimized()) - return true; - return false; - } - } - return true; + UNUSED_PARAM(op); + if (!value) + return true; + return Page::stringToViewMode(static_cast<CSSPrimitiveValue*>(value)->getStringValue()) == frame->page()->viewMode(); } -#endif static void createFunctionMap() { diff --git a/WebCore/dom/DeviceOrientationClient.h b/WebCore/dom/DeviceOrientationClient.h index 427412f..c969c95 100644 --- a/WebCore/dom/DeviceOrientationClient.h +++ b/WebCore/dom/DeviceOrientationClient.h @@ -29,15 +29,16 @@ namespace WebCore { class DeviceOrientation; +class DeviceOrientationController; class DeviceOrientationClient { public: + virtual ~DeviceOrientationClient() {} + + virtual void setController(DeviceOrientationController*) = 0; virtual void startUpdating() = 0; virtual void stopUpdating() = 0; virtual DeviceOrientation* lastOrientation() const = 0; - -protected: - virtual ~DeviceOrientationClient() {} }; } // namespace WebCore diff --git a/WebCore/dom/DeviceOrientationController.cpp b/WebCore/dom/DeviceOrientationController.cpp index a6a33f5..111577f 100644 --- a/WebCore/dom/DeviceOrientationController.cpp +++ b/WebCore/dom/DeviceOrientationController.cpp @@ -26,8 +26,6 @@ #include "config.h" #include "DeviceOrientationController.h" -#if ENABLE(DEVICE_ORIENTATION) - #include "DeviceOrientation.h" #include "DeviceOrientationClient.h" #include "DeviceOrientationEvent.h" @@ -39,6 +37,8 @@ DeviceOrientationController::DeviceOrientationController(Page* page, DeviceOrien , m_client(client) , m_timer(this, &DeviceOrientationController::timerFired) { + ASSERT(m_client); + m_client->setController(this); } void DeviceOrientationController::timerFired(Timer<DeviceOrientationController>* timer) @@ -105,5 +105,3 @@ void DeviceOrientationController::didChangeDeviceOrientation(DeviceOrientation* } } // namespace WebCore - -#endif // ENABLE(DEVICE_ORIENTATION) diff --git a/WebCore/dom/DeviceOrientationEvent.cpp b/WebCore/dom/DeviceOrientationEvent.cpp index 992b6ce..932cb75 100644 --- a/WebCore/dom/DeviceOrientationEvent.cpp +++ b/WebCore/dom/DeviceOrientationEvent.cpp @@ -28,8 +28,6 @@ #include "DeviceOrientation.h" -#if ENABLE(DEVICE_ORIENTATION) - namespace WebCore { DeviceOrientationEvent::~DeviceOrientationEvent() @@ -57,5 +55,3 @@ void DeviceOrientationEvent::initDeviceOrientationEvent(const AtomicString& type } } // namespace WebCore - -#endif // ENABLE(DEVICE_ORIENTATION) diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp index f1571cd..8447f22 100644 --- a/WebCore/dom/Document.cpp +++ b/WebCore/dom/Document.cpp @@ -119,6 +119,7 @@ #include "SegmentedString.h" #include "SelectionController.h" #include "Settings.h" +#include "StaticHashSetNodeList.h" #include "StringBuffer.h" #include "StyleSheetList.h" #include "TextEvent.h" @@ -1034,6 +1035,63 @@ KURL Document::baseURI() const return m_baseURL; } +// FIXME: We need to discuss the DOM API here at some point. Ideas: +// * making it receive a rect as parameter, i.e. nodesFromRect(x, y, w, h); +// * making it receive the expading size of each direction separately, +// i.e. nodesFromRect(x, y, topSize, rightSize, bottomSize, leftSize); +PassRefPtr<NodeList> Document::nodesFromRect(int centerX, int centerY, unsigned hPadding, unsigned vPadding, bool ignoreClipping) const +{ + // FIXME: Share code between this, elementFromPoint and caretRangeFromPoint. + if (!renderer()) + return 0; + Frame* frame = this->frame(); + if (!frame) + return 0; + FrameView* frameView = frame->view(); + if (!frameView) + return 0; + + float zoomFactor = frameView->pageZoomFactor(); + IntPoint point = roundedIntPoint(FloatPoint(centerX * zoomFactor + view()->scrollX(), centerY * zoomFactor + view()->scrollY())); + IntSize padding(hPadding, vPadding); + + int type = HitTestRequest::ReadOnly | HitTestRequest::Active; + + // When ignoreClipping is false, this method returns null for coordinates outside of the viewport. + if (ignoreClipping) + type |= HitTestRequest::IgnoreClipping; + else if (!frameView->visibleContentRect().intersects(IntRect(point, padding))) + return 0; + + HitTestRequest request(type); + + // Passing a zero padding will trigger a rect hit test, however for the purposes of nodesFromRect, + // we special handle this case in order to return a valid NodeList. + if (padding.isZero()) { + HitTestResult result(point); + return handleZeroPadding(request, result); + } + + HitTestResult result(point, padding); + renderView()->layer()->hitTest(request, result); + + return StaticHashSetNodeList::adopt(result.rectBasedTestResult()); +} + +PassRefPtr<NodeList> Document::handleZeroPadding(const HitTestRequest& request, HitTestResult& result) const +{ + renderView()->layer()->hitTest(request, result); + + Node* node = result.innerNode(); + if (!node) + return 0; + + node = node->shadowAncestorNode(); + ListHashSet<RefPtr<Node> > list; + list.add(node); + return StaticHashSetNodeList::adopt(list); +} + Element* Document::elementFromPoint(int x, int y) const { // FIXME: Share code between this and caretRangeFromPoint. @@ -1431,7 +1489,7 @@ void Document::recalcStyle(StyleChange change) #endif bail_out: - setNeedsStyleRecalc(NoStyleChange); + clearNeedsStyleRecalc(); clearChildNeedsStyleRecalc(); unscheduleStyleRecalc(); diff --git a/WebCore/dom/Document.h b/WebCore/dom/Document.h index 5bc3fa3..36379ee 100644 --- a/WebCore/dom/Document.h +++ b/WebCore/dom/Document.h @@ -87,6 +87,7 @@ namespace WebCore { class HTMLMapElement; class HistoryItem; class HitTestRequest; + class HitTestResult; class InspectorTimelineAgent; class IntPoint; class DOMWrapperWorld; @@ -302,6 +303,18 @@ public: bool hasElementWithId(AtomicStringImpl* id) const; bool containsMultipleElementsWithId(const AtomicString& elementId) { return m_duplicateIds.contains(elementId.impl()); } + /** + * Retrieve all nodes that intersect a rect in the window's document, until it is fully enclosed by + * the boundaries of node. + * + * @param centerX x reference for the rectangle in CSS pixels + * @param centerY y reference for the rectangle in CSS pixels + * @param hPadding How much to expand the rectangle horizontally + * @param vPadding How much to expand the rectangle vertically + * @param ignoreClipping whether or not to ignore the root scroll frame when retrieving the element. + * If false, this method returns null for coordinates outside of the viewport. + */ + PassRefPtr<NodeList> nodesFromRect(int centerX, int centerY, unsigned hPadding, unsigned vPadding, bool ignoreClipping) const; Element* elementFromPoint(int x, int y) const; PassRefPtr<Range> caretRangeFromPoint(int x, int y); @@ -1059,6 +1072,8 @@ private: void enqueuePopstateEvent(PassRefPtr<SerializedScriptValue> stateObject); void pendingEventTimerFired(Timer<Document>*); + PassRefPtr<NodeList> handleZeroPadding(const HitTestRequest&, HitTestResult&) const; + OwnPtr<CSSStyleSelector> m_styleSelector; bool m_didCalculateStyleSelector; diff --git a/WebCore/dom/Document.idl b/WebCore/dom/Document.idl index 9599d76..3ae551e 100644 --- a/WebCore/dom/Document.idl +++ b/WebCore/dom/Document.idl @@ -186,6 +186,11 @@ module core { readonly attribute [ConvertNullStringTo=Undefined] DOMString defaultCharset; readonly attribute [ConvertNullStringTo=Undefined] DOMString readyState; + + NodeList nodesFromRect(in long x, in long y, + in unsigned long hPadding, + in unsigned long vPadding, + in boolean ignoreClipping); Element elementFromPoint(in long x, in long y); Range caretRangeFromPoint(in long x, in long y); diff --git a/WebCore/dom/Element.cpp b/WebCore/dom/Element.cpp index a1ff56d..2fa75ce 100644 --- a/WebCore/dom/Element.cpp +++ b/WebCore/dom/Element.cpp @@ -905,7 +905,7 @@ void Element::recalcStyle(StyleChange change) detach(); attach(); // FIXME: The style gets computed twice by calling attach. We could do better if we passed the style along. // attach recalulates the style for all children. No need to do it twice. - setNeedsStyleRecalc(NoStyleChange); + clearNeedsStyleRecalc(); clearChildNeedsStyleRecalc(); return; } @@ -971,7 +971,7 @@ void Element::recalcStyle(StyleChange change) forceCheckOfNextElementSibling = childRulesChanged && hasDirectAdjacentRules; } - setNeedsStyleRecalc(NoStyleChange); + clearNeedsStyleRecalc(); clearChildNeedsStyleRecalc(); } @@ -1330,9 +1330,13 @@ void Element::updateFocusAppearance(bool /*restorePreviousSelection*/) Frame* frame = document()->frame(); if (!frame) return; + + // When focusing an editable element in an iframe, don't reset the selection if it already contains a selection. + if (this == frame->selection()->rootEditableElement()) + return; // FIXME: We should restore the previous selection if there is one. - VisibleSelection newSelection = hasTagName(htmlTag) || hasTagName(bodyTag) ? VisibleSelection(Position(this, 0), DOWNSTREAM) : VisibleSelection::selectionFromContentsOfNode(this); + VisibleSelection newSelection = VisibleSelection(Position(this, 0), DOWNSTREAM); if (frame->shouldChangeSelection(newSelection)) { frame->selection()->setSelection(newSelection); diff --git a/WebCore/dom/Node.cpp b/WebCore/dom/Node.cpp index 2032612..6e1bd13 100644 --- a/WebCore/dom/Node.cpp +++ b/WebCore/dom/Node.cpp @@ -731,15 +731,18 @@ inline void Node::setStyleChange(StyleChangeType changeType) void Node::setNeedsStyleRecalc(StyleChangeType changeType) { - if ((changeType != NoStyleChange) && !attached()) // changed compared to what? + ASSERT(changeType != NoStyleChange); + if (!attached()) // changed compared to what? return; - if (!(changeType == InlineStyleChange && (styleChangeType() == FullStyleChange || styleChangeType() == SyntheticStyleChange))) + StyleChangeType existingChangeType = styleChangeType(); + if (changeType > existingChangeType) setStyleChange(changeType); - if (styleChangeType() != NoStyleChange) { + if (existingChangeType == NoStyleChange) { for (Node* p = parentNode(); p && !p->childNeedsStyleRecalc(); p = p->parentNode()) p->setChildNeedsStyleRecalc(); + if (document()->childNeedsStyleRecalc()) document()->scheduleStyleRecalc(); } @@ -1261,6 +1264,7 @@ void Node::attach() } setAttached(); + clearNeedsStyleRecalc(); } void Node::willRemove() diff --git a/WebCore/dom/Node.h b/WebCore/dom/Node.h index a839c0e..8a76084 100644 --- a/WebCore/dom/Node.h +++ b/WebCore/dom/Node.h @@ -309,7 +309,10 @@ public: void setInActiveChain() { setFlag(InActiveChainFlag); } void clearInActiveChain() { clearFlag(InActiveChainFlag); } + void setNeedsStyleRecalc(StyleChangeType changeType = FullStyleChange); + void clearNeedsStyleRecalc() { m_nodeFlags &= ~StyleChangeMask; } + void setIsLink(bool f) { setFlag(f, IsLinkFlag); } void setIsLink() { setFlag(IsLinkFlag); } void clearIsLink() { clearFlag(IsLinkFlag); } diff --git a/WebCore/dom/Range.cpp b/WebCore/dom/Range.cpp index a5abdd4..33a21bb 100644 --- a/WebCore/dom/Range.cpp +++ b/WebCore/dom/Range.cpp @@ -94,8 +94,7 @@ PassRefPtr<Range> Range::create(PassRefPtr<Document> ownerDocument, PassRefPtr<N PassRefPtr<Range> Range::create(PassRefPtr<Document> ownerDocument, const Position& start, const Position& end) { - // FIXME: we shouldn't be using deprecatedEditingOffset here - return adoptRef(new Range(ownerDocument, start.node(), start.deprecatedEditingOffset(), end.node(), end.deprecatedEditingOffset())); + return adoptRef(new Range(ownerDocument, start.containerNode(), start.computeOffsetInContainerNode(), end.containerNode(), end.computeOffsetInContainerNode())); } Range::~Range() diff --git a/WebCore/dom/StyleElement.cpp b/WebCore/dom/StyleElement.cpp index 580f318..4c0e56f 100644 --- a/WebCore/dom/StyleElement.cpp +++ b/WebCore/dom/StyleElement.cpp @@ -26,11 +26,17 @@ #include "Element.h" #include "MediaList.h" #include "MediaQueryEvaluator.h" +#include "ScriptableDocumentParser.h" namespace WebCore { -StyleElement::StyleElement() +StyleElement::StyleElement(Document* document, bool createdByParser) + : m_createdByParser(createdByParser) + , m_loading(false) + , m_startLineNumber(0) { + if (createdByParser && document && document->scriptableDocumentParser()) + m_startLineNumber = document->scriptableDocumentParser()->lineNumber(); } StyleSheet* StyleElement::sheet(Element* e) @@ -40,13 +46,23 @@ StyleSheet* StyleElement::sheet(Element* e) return m_sheet.get(); } -void StyleElement::insertedIntoDocument(Document*, Element* element) +void StyleElement::insertedIntoDocument(Document* document, Element* element) { - process(element, 0); + ASSERT(document); + ASSERT(element); + document->addStyleSheetCandidateNode(element, m_createdByParser); + if (m_createdByParser) + return; + + process(element); } -void StyleElement::removedFromDocument(Document* document) +void StyleElement::removedFromDocument(Document* document, Element* element) { + ASSERT(document); + ASSERT(element); + document->removeStyleSheetCandidateNode(element); + // If we're in document teardown, then we don't need to do any notification of our sheet's removal. if (!document->renderer()) return; @@ -56,7 +72,24 @@ void StyleElement::removedFromDocument(Document* document) document->updateStyleSelector(); } -void StyleElement::process(Element* e, int startLineNumber) +void StyleElement::childrenChanged(Element* element) +{ + ASSERT(element); + if (m_createdByParser) + return; + + process(element); +} + +void StyleElement::finishParsingChildren(Element* element) +{ + ASSERT(element); + process(element); + sheet(element); + m_createdByParser = false; +} + +void StyleElement::process(Element* e) { if (!e || !e->inDocument()) return; @@ -82,14 +115,15 @@ void StyleElement::process(Element* e, int startLineNumber) } ASSERT(p == text + resultLength); - createSheet(e, startLineNumber, sheetText); + createSheet(e, m_startLineNumber, sheetText); } void StyleElement::createSheet(Element* e, int startLineNumber, const String& text) { + ASSERT(e); Document* document = e->document(); if (m_sheet) { - if (static_cast<CSSStyleSheet*>(m_sheet.get())->isLoading()) + if (m_sheet->isLoading()) document->removePendingSheet(); m_sheet = 0; } @@ -102,12 +136,12 @@ void StyleElement::createSheet(Element* e, int startLineNumber, const String& te MediaQueryEvaluator printEval("print", true); if (screenEval.eval(mediaList.get()) || printEval.eval(mediaList.get())) { document->addPendingSheet(); - setLoading(true); + m_loading = true; m_sheet = CSSStyleSheet::create(e, String(), KURL(), document->inputEncoding()); m_sheet->parseStringAtLine(text, !document->inCompatMode(), startLineNumber); m_sheet->setMedia(mediaList.get()); m_sheet->setTitle(e->title()); - setLoading(false); + m_loading = false; } } @@ -115,4 +149,21 @@ void StyleElement::createSheet(Element* e, int startLineNumber, const String& te m_sheet->checkLoaded(); } +bool StyleElement::isLoading() const +{ + if (m_loading) + return true; + return m_sheet ? m_sheet->isLoading() : false; +} + +bool StyleElement::sheetLoaded(Document* document) +{ + ASSERT(document); + if (isLoading()) + return false; + + document->removePendingSheet(); + return true; +} + } diff --git a/WebCore/dom/StyleElement.h b/WebCore/dom/StyleElement.h index 4ec10c4..00e45ed 100644 --- a/WebCore/dom/StyleElement.h +++ b/WebCore/dom/StyleElement.h @@ -17,6 +17,7 @@ * Boston, MA 02110-1301, USA. * */ + #ifndef StyleElement_h #define StyleElement_h @@ -29,27 +30,34 @@ class Element; class StyleElement { public: - StyleElement(); + StyleElement(Document*, bool createdByParser); virtual ~StyleElement() {} protected: - StyleSheet* sheet(Element*); - - virtual void setLoading(bool) {} - virtual const AtomicString& type() const = 0; virtual const AtomicString& media() const = 0; - void insertedIntoDocument(Document*, Element*); - void removedFromDocument(Document*); - void process(Element*, int startLineNumber); + StyleSheet* sheet(Element*); - void createSheet(Element* e, int startLineNumber, const String& text = String()); + bool isLoading() const; + bool sheetLoaded(Document*); + + void insertedIntoDocument(Document*, Element*); + void removedFromDocument(Document*, Element*); + void childrenChanged(Element*); + void finishParsingChildren(Element*); -protected: RefPtr<CSSStyleSheet> m_sheet; + +private: + void createSheet(Element*, int startLineNumber, const String& text = String()); + void process(Element*); + + bool m_createdByParser; + bool m_loading; + int m_startLineNumber; }; -} //namespace +} #endif diff --git a/WebCore/dom/Text.cpp b/WebCore/dom/Text.cpp index 1589b11..928b975 100644 --- a/WebCore/dom/Text.cpp +++ b/WebCore/dom/Text.cpp @@ -284,7 +284,7 @@ void Text::recalcStyle(StyleChange change) attach(); } } - setNeedsStyleRecalc(NoStyleChange); + clearNeedsStyleRecalc(); } bool Text::childTypeAllowed(NodeType) diff --git a/WebCore/editing/ApplyStyleCommand.cpp b/WebCore/editing/ApplyStyleCommand.cpp index 8847714..d865468 100644 --- a/WebCore/editing/ApplyStyleCommand.cpp +++ b/WebCore/editing/ApplyStyleCommand.cpp @@ -910,7 +910,10 @@ void ApplyStyleCommand::applyInlineStyle(CSSMutableStyleDeclaration *style) // split the start node and containing element if the selection starts inside of it bool splitStart = isValidCaretPositionInTextNode(start); if (splitStart) { - splitTextElementAtStart(start, end); + if (shouldSplitTextElement(start.node()->parentElement(), style)) + splitTextElementAtStart(start, end); + else + splitTextAtStart(start, end); start = startPosition(); end = endPosition(); startDummySpanAncestor = dummySpanAncestorForNode(start.node()); @@ -919,7 +922,10 @@ void ApplyStyleCommand::applyInlineStyle(CSSMutableStyleDeclaration *style) // split the end node and containing element if the selection ends inside of it bool splitEnd = isValidCaretPositionInTextNode(end); if (splitEnd) { - splitTextElementAtEnd(start, end); + if (shouldSplitTextElement(end.node()->parentElement(), style)) + splitTextElementAtEnd(start, end); + else + splitTextAtEnd(start, end); start = startPosition(); end = endPosition(); endDummySpanAncestor = dummySpanAncestorForNode(end.node()); @@ -1176,6 +1182,40 @@ bool ApplyStyleCommand::implicitlyStyledElementShouldBeRemovedWhenApplyingStyle( return false; } +bool ApplyStyleCommand::removeInlineStyleFromElement(CSSMutableStyleDeclaration* style, HTMLElement* element, InlineStyleRemovalMode mode) +{ + ASSERT(style); + ASSERT(element); + + bool removed = false; + + if (m_styledInlineElement && element->hasTagName(m_styledInlineElement->tagQName())) { + removed = true; + if (mode == RemoveAttributesAndElements) + removeNodePreservingChildren(element); + } + + if (implicitlyStyledElementShouldBeRemovedWhenApplyingStyle(element, style)) { + removed = true; + if (mode == RemoveAttributesAndElements) + replaceWithSpanOrRemoveIfWithoutAttributes(element); + } + + if (!element->inDocument()) + return removed; + + // If the node was converted to a span, the span may still contain relevant + // styles which must be removed (e.g. <b style='font-weight: bold'>) + if (removeHTMLFontStyle(style, element, mode)) + removed = true; + if (removeHTMLBidiEmbeddingStyle(style, element, mode)) + removed = true; + if (removeCSSStyle(style, element, mode)) + removed = true; + + return removed; +} + void ApplyStyleCommand::replaceWithSpanOrRemoveIfWithoutAttributes(HTMLElement*& elem) { bool removeNode = false; @@ -1200,65 +1240,84 @@ void ApplyStyleCommand::replaceWithSpanOrRemoveIfWithoutAttributes(HTMLElement*& } } -void ApplyStyleCommand::removeHTMLFontStyle(CSSMutableStyleDeclaration *style, HTMLElement *elem) +bool ApplyStyleCommand::removeHTMLFontStyle(CSSMutableStyleDeclaration* style, HTMLElement* elem, InlineStyleRemovalMode mode) { ASSERT(style); ASSERT(elem); if (!elem->hasLocalName(fontTag)) - return; - + return false; + + bool removed = false; CSSMutableStyleDeclaration::const_iterator end = style->end(); for (CSSMutableStyleDeclaration::const_iterator it = style->begin(); it != end; ++it) { + const QualifiedName* attrToRemove = 0; switch ((*it).id()) { - case CSSPropertyColor: - removeNodeAttribute(elem, colorAttr); - break; - case CSSPropertyFontFamily: - removeNodeAttribute(elem, faceAttr); - break; - case CSSPropertyFontSize: - removeNodeAttribute(elem, sizeAttr); - break; + case CSSPropertyColor: + attrToRemove = &colorAttr; + break; + case CSSPropertyFontFamily: + attrToRemove = &faceAttr; + break; + case CSSPropertyFontSize: + attrToRemove = &sizeAttr; + break; + } + + if (attrToRemove) { + removed = true; + if (mode == RemoveAttributesAndElements) + removeNodeAttribute(elem, *attrToRemove); } } - if (isEmptyFontTag(elem)) + if (isEmptyFontTag(elem) && mode == RemoveAttributesAndElements) removeNodePreservingChildren(elem); + + return removed; } -void ApplyStyleCommand::removeHTMLBidiEmbeddingStyle(CSSMutableStyleDeclaration *style, HTMLElement *elem) +bool ApplyStyleCommand::removeHTMLBidiEmbeddingStyle(CSSMutableStyleDeclaration* style, HTMLElement* elem, InlineStyleRemovalMode mode) { ASSERT(style); ASSERT(elem); if (!elem->hasAttribute(dirAttr)) - return; + return false; if (!style->getPropertyCSSValue(CSSPropertyUnicodeBidi) && !style->getPropertyCSSValue(CSSPropertyDirection)) - return; + return false; + + if (mode == RemoveNone) + return true; removeNodeAttribute(elem, dirAttr); // FIXME: should this be isSpanWithoutAttributesOrUnstyleStyleSpan? Need a test. if (isUnstyledStyleSpan(elem)) removeNodePreservingChildren(elem); + + return true; } -void ApplyStyleCommand::removeCSSStyle(CSSMutableStyleDeclaration* style, HTMLElement* elem) +bool ApplyStyleCommand::removeCSSStyle(CSSMutableStyleDeclaration* style, HTMLElement* elem, InlineStyleRemovalMode mode) { ASSERT(style); ASSERT(elem); CSSMutableStyleDeclaration* decl = elem->inlineStyleDecl(); if (!decl) - return; + return false; + bool removed = false; CSSMutableStyleDeclaration::const_iterator end = style->end(); for (CSSMutableStyleDeclaration::const_iterator it = style->begin(); it != end; ++it) { CSSPropertyID propertyID = static_cast<CSSPropertyID>((*it).id()); RefPtr<CSSValue> value = decl->getPropertyCSSValue(propertyID); if (value && (propertyID != CSSPropertyWhiteSpace || !isTabSpanNode(elem))) { + removed = true; + if (mode == RemoveNone) + return true; removeCSSProperty(decl, propertyID); if (propertyID == CSSPropertyUnicodeBidi && !decl->getPropertyValue(CSSPropertyDirection).isEmpty()) removeCSSProperty(decl, CSSPropertyDirection); @@ -1271,6 +1330,8 @@ void ApplyStyleCommand::removeCSSStyle(CSSMutableStyleDeclaration* style, HTMLEl if (isSpanWithoutAttributesOrUnstyleStyleSpan(elem)) removeNodePreservingChildren(elem); + + return removed; } static bool hasTextDecorationProperty(Node *node) @@ -1472,19 +1533,7 @@ void ApplyStyleCommand::removeInlineStyle(PassRefPtr<CSSMutableStyleDeclaration> HTMLElement* elem = static_cast<HTMLElement*>(node); Node* prev = elem->traversePreviousNodePostOrder(); Node* next = elem->traverseNextNode(); - if (m_styledInlineElement && elem->hasTagName(m_styledInlineElement->tagQName())) - removeNodePreservingChildren(elem); - - if (implicitlyStyledElementShouldBeRemovedWhenApplyingStyle(elem, style.get())) - replaceWithSpanOrRemoveIfWithoutAttributes(elem); - - // If the node was converted to a span, the span may still contain relevant - // styles which must be removed (e.g. <b style='font-weight: bold'>) - if (elem->inDocument()) { - removeHTMLFontStyle(style.get(), elem); - removeHTMLBidiEmbeddingStyle(style.get(), elem); - removeCSSStyle(style.get(), elem); - } + removeInlineStyleFromElement(style.get(), elem); if (!elem->inDocument()) { if (s.node() == elem) { // Since elem must have been fully selected, and it is at the start @@ -1554,10 +1603,6 @@ void ApplyStyleCommand::splitTextAtEnd(const Position& start, const Position& en void ApplyStyleCommand::splitTextElementAtStart(const Position& start, const Position& end) { - Node* parent = start.node()->parentNode(); - if (!parent || !parent->parentElement() || !parent->parentElement()->isContentEditable()) - return splitTextAtStart(start, end); - int endOffsetAdjustment = start.node() == end.node() ? start.deprecatedEditingOffset() : 0; Text* text = static_cast<Text*>(start.node()); splitTextNodeContainingElement(text, start.deprecatedEditingOffset()); @@ -1566,10 +1611,6 @@ void ApplyStyleCommand::splitTextElementAtStart(const Position& start, const Pos void ApplyStyleCommand::splitTextElementAtEnd(const Position& start, const Position& end) { - Node* parent = end.node()->parentNode(); - if (!parent || !parent->parentElement() || !parent->parentElement()->isContentEditable()) - return splitTextAtEnd(start, end); - Text* text = static_cast<Text*>(end.node()); splitTextNodeContainingElement(text, end.deprecatedEditingOffset()); @@ -1580,6 +1621,14 @@ void ApplyStyleCommand::splitTextElementAtEnd(const Position& start, const Posit updateStartEnd(Position(startNode, start.deprecatedEditingOffset()), Position(prevNode->parent(), prevNode->nodeIndex() + 1)); } +bool ApplyStyleCommand::shouldSplitTextElement(Element* element, CSSMutableStyleDeclaration* style) +{ + if (!element || !element->isHTMLElement() || !element->parentElement() || !element->parentElement()->isContentEditable()) + return false; + + return shouldRemoveInlineStyleFromElement(style, static_cast<HTMLElement*>(element)); +} + bool ApplyStyleCommand::isValidCaretPositionInTextNode(const Position& position) { Node* node = position.node(); diff --git a/WebCore/editing/ApplyStyleCommand.h b/WebCore/editing/ApplyStyleCommand.h index 199b9db..0aa8110 100644 --- a/WebCore/editing/ApplyStyleCommand.h +++ b/WebCore/editing/ApplyStyleCommand.h @@ -42,6 +42,7 @@ enum ShouldIncludeTypingStyle { class ApplyStyleCommand : public CompositeEditCommand { public: enum EPropertyLevel { PropertyDefault, ForceBlockProperties }; + enum InlineStyleRemovalMode { RemoveAttributesAndElements, RemoveNone }; static PassRefPtr<ApplyStyleCommand> create(Document* document, CSSStyleDeclaration* style, EditAction action = EditActionChangeAttributes, EPropertyLevel level = PropertyDefault) { @@ -71,10 +72,12 @@ private: // style-removal helpers bool shouldRemoveTextDecorationTag(CSSStyleDeclaration* styleToApply, int textDecorationAddedByTag) const; bool implicitlyStyledElementShouldBeRemovedWhenApplyingStyle(HTMLElement*, CSSMutableStyleDeclaration*); + bool removeInlineStyleFromElement(CSSMutableStyleDeclaration*, HTMLElement*, InlineStyleRemovalMode = RemoveAttributesAndElements); + inline bool shouldRemoveInlineStyleFromElement(CSSMutableStyleDeclaration* style, HTMLElement* element) {return removeInlineStyleFromElement(style, element, RemoveNone);} void replaceWithSpanOrRemoveIfWithoutAttributes(HTMLElement*&); - void removeHTMLFontStyle(CSSMutableStyleDeclaration*, HTMLElement*); - void removeHTMLBidiEmbeddingStyle(CSSMutableStyleDeclaration*, HTMLElement*); - void removeCSSStyle(CSSMutableStyleDeclaration*, HTMLElement*); + bool removeHTMLFontStyle(CSSMutableStyleDeclaration*, HTMLElement*, InlineStyleRemovalMode = RemoveAttributesAndElements); + bool removeHTMLBidiEmbeddingStyle(CSSMutableStyleDeclaration*, HTMLElement*, InlineStyleRemovalMode = RemoveAttributesAndElements); + bool removeCSSStyle(CSSMutableStyleDeclaration*, HTMLElement*, InlineStyleRemovalMode = RemoveAttributesAndElements); void removeInlineStyle(PassRefPtr<CSSMutableStyleDeclaration>, const Position& start, const Position& end); bool nodeFullySelected(Node*, const Position& start, const Position& end) const; bool nodeFullyUnselected(Node*, const Position& start, const Position& end) const; @@ -95,6 +98,7 @@ private: void splitTextAtEnd(const Position& start, const Position& end); void splitTextElementAtStart(const Position& start, const Position& end); void splitTextElementAtEnd(const Position& start, const Position& end); + bool shouldSplitTextElement(Element* elem, CSSMutableStyleDeclaration*); bool isValidCaretPositionInTextNode(const Position& position); bool mergeStartWithPreviousIfIdentical(const Position& start, const Position& end); bool mergeEndWithNextIfIdentical(const Position& start, const Position& end); diff --git a/WebCore/editing/InsertListCommand.cpp b/WebCore/editing/InsertListCommand.cpp index 8f9c0de..59a8bce 100644 --- a/WebCore/editing/InsertListCommand.cpp +++ b/WebCore/editing/InsertListCommand.cpp @@ -54,6 +54,42 @@ HTMLElement* InsertListCommand::fixOrphanedListChild(Node* node) return listElement.get(); } +PassRefPtr<HTMLElement> InsertListCommand::mergeWithNeighboringLists(PassRefPtr<HTMLElement> passedList) +{ + RefPtr<HTMLElement> list = passedList; + Element* previousList = list->previousElementSibling(); + if (canMergeLists(previousList, list.get())) + mergeIdenticalElements(previousList, list); + + if (!list || !list->nextElementSibling() || !list->nextElementSibling()->isHTMLElement()) + return list.release(); + + RefPtr<HTMLElement> nextList = static_cast<HTMLElement*>(list->nextElementSibling()); + if (canMergeLists(list.get(), nextList.get())) { + mergeIdenticalElements(list, nextList); + return nextList.release(); + } + return list.release(); +} + +bool InsertListCommand::selectionHasListOfType(const VisibleSelection& selection, const QualifiedName& listTag) +{ + VisiblePosition start = selection.visibleStart(); + + if (!enclosingList(start.deepEquivalent().node())) + return false; + + VisiblePosition end = selection.visibleEnd(); + while (start.isNotNull() && start != end) { + Element* listNode = enclosingList(start.deepEquivalent().node()); + if (!listNode || !listNode->hasTagName(listTag)) + return false; + start = startOfNextParagraph(start); + } + + return true; +} + InsertListCommand::InsertListCommand(Document* document, Type type) : CompositeEditCommand(document), m_type(type) { @@ -80,6 +116,7 @@ void InsertListCommand::doApply() if (visibleEnd != visibleStart && isStartOfParagraph(visibleEnd)) setEndingSelection(VisibleSelection(visibleStart, visibleEnd.previous(true))); + const QualifiedName& listTag = (m_type == OrderedList) ? olTag : ulTag; if (endingSelection().isRange()) { VisibleSelection selection = selectionForParagraphIteration(endingSelection()); ASSERT(selection.isRange()); @@ -88,10 +125,9 @@ void InsertListCommand::doApply() VisiblePosition startOfLastParagraph = startOfParagraph(endOfSelection); if (startOfParagraph(startOfSelection) != startOfLastParagraph) { - Node* startList = enclosingList(startOfSelection.deepEquivalent().node()); - Node* endList = enclosingList(endOfSelection.deepEquivalent().node()); - bool forceCreateList = !startList || startList != endList; + bool forceCreateList = !selectionHasListOfType(selection, listTag); + RefPtr<Range> currentSelection = endingSelection().firstRange(); VisiblePosition startOfCurrentParagraph = startOfSelection; while (startOfCurrentParagraph != startOfLastParagraph) { // doApply() may operate on and remove the last paragraph of the selection from the document @@ -102,7 +138,7 @@ void InsertListCommand::doApply() if (!startOfLastParagraph.deepEquivalent().node()->inDocument()) return; setEndingSelection(startOfCurrentParagraph); - doApplyForSingleParagraph(forceCreateList); + doApplyForSingleParagraph(forceCreateList, listTag, currentSelection.get()); // Fetch the start of the selection after moving the first paragraph, // because moving the paragraph will invalidate the original start. @@ -114,7 +150,7 @@ void InsertListCommand::doApply() startOfCurrentParagraph = startOfNextParagraph(endingSelection().visibleStart()); } setEndingSelection(endOfSelection); - doApplyForSingleParagraph(forceCreateList); + doApplyForSingleParagraph(forceCreateList, listTag, currentSelection.get()); // Fetch the end of the selection, for the reason mentioned above. endOfSelection = endingSelection().visibleEnd(); setEndingSelection(VisibleSelection(startOfSelection, endOfSelection)); @@ -122,28 +158,44 @@ void InsertListCommand::doApply() } } - doApplyForSingleParagraph(false); + doApplyForSingleParagraph(false, listTag, endingSelection().firstRange().get()); } -void InsertListCommand::doApplyForSingleParagraph(bool forceCreateList) +void InsertListCommand::doApplyForSingleParagraph(bool forceCreateList, const QualifiedName& listTag, Range* currentSelection) { // FIXME: This will produce unexpected results for a selection that starts just before a // table and ends inside the first cell, selectionForParagraphIteration should probably // be renamed and deployed inside setEndingSelection(). Node* selectionNode = endingSelection().start().node(); - const QualifiedName listTag = (m_type == OrderedList) ? olTag : ulTag; Node* listChildNode = enclosingListChild(selectionNode); bool switchListType = false; if (listChildNode) { // Remove the list chlild. - HTMLElement* listNode = enclosingList(listChildNode); - if (!listNode) + RefPtr<HTMLElement> listNode = enclosingList(listChildNode); + if (!listNode) { listNode = fixOrphanedListChild(listChildNode); + listNode = mergeWithNeighboringLists(listNode); + } if (!listNode->hasTagName(listTag)) // listChildNode will be removed from the list and a list of type m_type will be created. switchListType = true; - unlistifyParagraph(endingSelection().visibleStart(), listNode, listChildNode); + // If the list is of the desired type, and we are not removing the list, then exit early. + if (!switchListType && forceCreateList) + return; + + // If the entire list is selected, then convert the whole list. + if (switchListType && isNodeVisiblyContainedWithin(listNode.get(), currentSelection)) { + RefPtr<HTMLElement> newList = createHTMLElement(document(), listTag); + insertNodeBefore(newList, listNode); + Node* outerBlock = listChildNode->isBlockFlow() ? listChildNode : listNode.get(); + moveParagraphWithClones(firstPositionInNode(listNode.get()), lastPositionInNode(listNode.get()), newList.get(), outerBlock); + newList = mergeWithNeighboringLists(newList); + setEndingSelection(VisiblePosition(firstPositionInNode(newList.get()))); + return; + } + + unlistifyParagraph(endingSelection().visibleStart(), listNode.get(), listChildNode); } if (!listChildNode || switchListType || forceCreateList) @@ -285,20 +337,10 @@ PassRefPtr<HTMLElement> InsertListCommand::listifyParagraph(const VisiblePositio moveParagraph(start, end, VisiblePosition(Position(placeholder.get(), 0)), true); - // FIXME: listifyParagraph should not depend on a member variable. - // Since fixOrphanedListChild is the only other method that updates m_listElement, - // we should fix unlistifyParagraph to support orphaned list child to get rid of this assignment. - if (!listElement && m_listElement) - listElement = m_listElement; - - if (listElement) { - previousList = listElement->previousElementSibling(); - nextList = listElement->nextElementSibling(); - if (canMergeLists(previousList, listElement.get())) - mergeIdenticalElements(previousList, listElement.get()); - if (canMergeLists(listElement.get(), nextList)) - mergeIdenticalElements(listElement.get(), nextList); - } else if (canMergeLists(nextList, previousList)) + if (listElement) + return mergeWithNeighboringLists(listElement); + + if (canMergeLists(previousList, nextList)) mergeIdenticalElements(previousList, nextList); return listElement; diff --git a/WebCore/editing/InsertListCommand.h b/WebCore/editing/InsertListCommand.h index 7fbf936..b81ae74 100644 --- a/WebCore/editing/InsertListCommand.h +++ b/WebCore/editing/InsertListCommand.h @@ -52,8 +52,9 @@ private: virtual EditAction editingAction() const { return EditActionInsertList; } HTMLElement* fixOrphanedListChild(Node*); - bool modifyRange(); - void doApplyForSingleParagraph(bool forceCreateList); + bool selectionHasListOfType(const VisibleSelection& selection, const QualifiedName&); + PassRefPtr<HTMLElement> mergeWithNeighboringLists(PassRefPtr<HTMLElement>); + void doApplyForSingleParagraph(bool forceCreateList, const QualifiedName&, Range* currentSelection); void unlistifyParagraph(const VisiblePosition& originalStart, HTMLElement* listNode, Node* listChildNode); PassRefPtr<HTMLElement> listifyParagraph(const VisiblePosition& originalStart, const QualifiedName& listTag); RefPtr<HTMLElement> m_listElement; diff --git a/WebCore/editing/SplitElementCommand.cpp b/WebCore/editing/SplitElementCommand.cpp index 2998c6a..5047205 100644 --- a/WebCore/editing/SplitElementCommand.cpp +++ b/WebCore/editing/SplitElementCommand.cpp @@ -27,6 +27,7 @@ #include "SplitElementCommand.h" #include "Element.h" +#include "HTMLNames.h" #include <wtf/Assertions.h> namespace WebCore { @@ -58,7 +59,11 @@ void SplitElementCommand::executeApply() parent->insertBefore(m_element1.get(), m_element2.get(), ec); if (ec) return; - + + // Delete id attribute from the second element because the same id cannot be used for more than one element + m_element2->removeAttribute(HTMLNames::idAttr, ec); + ASSERT(!ec); + size_t size = children.size(); for (size_t i = 0; i < size; ++i) m_element1->appendChild(children[i], ec); @@ -88,6 +93,10 @@ void SplitElementCommand::doUnapply() for (size_t i = 0; i < size; ++i) m_element2->insertBefore(children[i].get(), refChild.get(), ec); + // Recover the id attribute of the original element. + if (m_element1->hasAttribute(HTMLNames::idAttr)) + m_element2->setAttribute(HTMLNames::idAttr, m_element1->getAttribute(HTMLNames::idAttr)); + m_element1->remove(ec); } diff --git a/WebCore/editing/htmlediting.cpp b/WebCore/editing/htmlediting.cpp index 9f73167..53b5d7e 100644 --- a/WebCore/editing/htmlediting.cpp +++ b/WebCore/editing/htmlediting.cpp @@ -829,7 +829,7 @@ HTMLElement* outermostEnclosingList(Node* node, Node* rootList) bool canMergeLists(Element* firstList, Element* secondList) { - if (!firstList || !secondList) + if (!firstList || !secondList || !firstList->isHTMLElement() || !secondList->isHTMLElement()) return false; return firstList->hasTagName(secondList->tagQName())// make sure the list types match (ol vs. ul) @@ -1133,9 +1133,15 @@ bool isNodeVisiblyContainedWithin(Node* node, const Range* selectedRange) if (selectedRange->compareNode(node, ec) == Range::NODE_INSIDE) return true; - // If the node starts and ends at where selectedRange starts and ends, the node is contained within - return visiblePositionBeforeNode(node) == selectedRange->startPosition() - && visiblePositionAfterNode(node) == selectedRange->endPosition(); + bool startIsVisuallySame = visiblePositionBeforeNode(node) == selectedRange->startPosition(); + if (startIsVisuallySame && comparePositions(Position(node->parentNode(), node->nodeIndex()+1), selectedRange->endPosition()) < 0) + return true; + + bool endIsVisuallySame = visiblePositionAfterNode(node) == selectedRange->endPosition(); + if (endIsVisuallySame && comparePositions(selectedRange->startPosition(), Position(node->parentNode(), node->nodeIndex())) < 0) + return true; + + return startIsVisuallySame && endIsVisuallySame; } bool isRenderedAsNonInlineTableImageOrHR(const Node* node) diff --git a/WebCore/editing/markup.cpp b/WebCore/editing/markup.cpp index dcb53d6..22e700a 100644 --- a/WebCore/editing/markup.cpp +++ b/WebCore/editing/markup.cpp @@ -555,13 +555,6 @@ static void appendStartMarkup(Vector<UChar>& result, const Node* node, const Ran } } -static String getStartMarkup(const Node* node, const Range* range, EAnnotateForInterchange annotate, EAbsoluteURLs absoluteURLs, bool convertBlocksToInlines = false, HashMap<AtomicStringImpl*, AtomicStringImpl*>* namespaces = 0, RangeFullySelectsNode rangeFullySelectsNode = DoesFullySelectNode) -{ - Vector<UChar> result; - appendStartMarkup(result, node, range, annotate, absoluteURLs, convertBlocksToInlines, namespaces, rangeFullySelectsNode); - return String::adopt(result); -} - static inline bool doesHTMLForbidEndTag(const Node *node) { if (node->isHTMLElement()) { @@ -598,13 +591,6 @@ static void appendEndMarkup(Vector<UChar>& result, const Node* node) result.append('>'); } -static String getEndMarkup(const Node *node) -{ - Vector<UChar> result; - appendEndMarkup(result, node); - return String::adopt(result); -} - class MarkupAccumulator { public: MarkupAccumulator(Node* nodeToSkip, Vector<Node*>* nodes) @@ -722,30 +708,6 @@ static bool isElementPresentational(const Node* node) return !propertyMissingOrEqualToNone(style.get(), CSSPropertyTextDecoration); } -static String joinMarkups(const Vector<String>& preMarkups, const Vector<String>& postMarkups) -{ - size_t length = 0; - - size_t preCount = preMarkups.size(); - for (size_t i = 0; i < preCount; ++i) - length += preMarkups[i].length(); - - size_t postCount = postMarkups.size(); - for (size_t i = 0; i < postCount; ++i) - length += postMarkups[i].length(); - - Vector<UChar> result; - result.reserveInitialCapacity(length); - - for (size_t i = preCount; i > 0; --i) - append(result, preMarkups[i - 1]); - - for (size_t i = 0; i < postCount; ++i) - append(result, postMarkups[i]); - - return String::adopt(result); -} - static bool isSpecialAncestorBlock(Node* node) { if (!node || !isBlock(node)) @@ -773,24 +735,88 @@ static bool shouldIncludeWrapperForFullySelectedRoot(Node* fullySelectedRoot, CS style->getPropertyCSSValue(CSSPropertyBackgroundColor); } -static void addStyleMarkup(Vector<String>& preMarkups, Vector<String>& postMarkups, CSSStyleDeclaration* style, Document* document, bool isBlock = false) -{ - // All text-decoration-related elements should have been treated as special ancestors - // If we ever hit this ASSERT, we should export StyleChange in ApplyStyleCommand and use it here - ASSERT(propertyMissingOrEqualToNone(style, CSSPropertyTextDecoration) && propertyMissingOrEqualToNone(style, CSSPropertyWebkitTextDecorationsInEffect)); - DEFINE_STATIC_LOCAL(const String, divStyle, ("<div style=\"")); - DEFINE_STATIC_LOCAL(const String, divClose, ("</div>")); - DEFINE_STATIC_LOCAL(const String, styleSpanOpen, ("<span class=\"" AppleStyleSpanClass "\" style=\"")); - DEFINE_STATIC_LOCAL(const String, styleSpanClose, ("</span>")); - Vector<UChar> openTag; - append(openTag, isBlock ? divStyle : styleSpanOpen); - appendAttributeValue(openTag, style->cssText(), document->isHTMLDocument()); - openTag.append('\"'); - openTag.append('>'); - preMarkups.append(String::adopt(openTag)); - - postMarkups.append(isBlock ? divClose : styleSpanClose); -} +class MarkupAccumulatorWrapper { +public: + MarkupAccumulatorWrapper() + { + } + + void insertString(const String& s) + { + postMarkups.append(s); + } + + void insertOpenTag(const Node* node, const Range* range, EAnnotateForInterchange annotate, EAbsoluteURLs absoluteURLs, bool convertBlocksToInlines = false, RangeFullySelectsNode rangeFullySelectsNode = DoesFullySelectNode) + { + Vector<UChar> result; + appendStartMarkup(result, node, range, annotate, absoluteURLs, convertBlocksToInlines, 0, rangeFullySelectsNode); + postMarkups.append(String::adopt(result)); + } + + void insertEndTag(const Node* node) + { + Vector<UChar> result; + appendEndMarkup(result, node); + postMarkups.append(String::adopt(result)); + } + + void wrapWithNode(const Node* node, const Range* range, EAnnotateForInterchange annotate, EAbsoluteURLs absoluteURLs, bool convertBlocksToInlines = false, RangeFullySelectsNode rangeFullySelectsNode = DoesFullySelectNode) + { + Vector<UChar> result; + appendStartMarkup(result, node, range, annotate, absoluteURLs, convertBlocksToInlines, 0, rangeFullySelectsNode); + preMarkups.append(String::adopt(result)); + insertEndTag(node); + } + + void wrapWithStyleNode(CSSStyleDeclaration* style, Document* document, bool isBlock = false) + { + // All text-decoration-related elements should have been treated as special ancestors + // If we ever hit this ASSERT, we should export StyleChange in ApplyStyleCommand and use it here + ASSERT(propertyMissingOrEqualToNone(style, CSSPropertyTextDecoration) && propertyMissingOrEqualToNone(style, CSSPropertyWebkitTextDecorationsInEffect)); + DEFINE_STATIC_LOCAL(const String, divStyle, ("<div style=\"")); + DEFINE_STATIC_LOCAL(const String, divClose, ("</div>")); + DEFINE_STATIC_LOCAL(const String, styleSpanOpen, ("<span class=\"" AppleStyleSpanClass "\" style=\"")); + DEFINE_STATIC_LOCAL(const String, styleSpanClose, ("</span>")); + Vector<UChar> openTag; + WebCore::append(openTag, isBlock ? divStyle : styleSpanOpen); + appendAttributeValue(openTag, style->cssText(), document->isHTMLDocument()); + openTag.append('\"'); + openTag.append('>'); + preMarkups.append(String::adopt(openTag)); + postMarkups.append(isBlock ? divClose : styleSpanClose); + } + + // FIXME: This is a very inefficient way of accumulating the markup. + // We're converting results of appendStartMarkup and appendEndMarkup from Vector<UChar> to String + // and then back to Vector<UChar> and again to String here. + String takeResults() + { + size_t length = 0; + + size_t preCount = preMarkups.size(); + for (size_t i = 0; i < preCount; ++i) + length += preMarkups[i].length(); + + size_t postCount = postMarkups.size(); + for (size_t i = 0; i < postCount; ++i) + length += postMarkups[i].length(); + + Vector<UChar> result; + result.reserveInitialCapacity(length); + + for (size_t i = preCount; i > 0; --i) + WebCore::append(result, preMarkups[i - 1]); + + for (size_t i = 0; i < postCount; ++i) + WebCore::append(result, postMarkups[i]); + + return String::adopt(result); + } + +private: + Vector<String> preMarkups; + Vector<String> postMarkups; +}; // FIXME: Shouldn't we omit style info when annotate == DoNotAnnotateForInterchange? // FIXME: At least, annotation and style info should probably not be included in range.markupString() @@ -828,8 +854,7 @@ String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterc document->updateLayoutIgnorePendingStylesheets(); - Vector<String> markups; - Vector<String> preMarkups; + MarkupAccumulatorWrapper accumulator; Node* pastEnd = updatedRange->pastLastNode(); Node* lastClosed = 0; Vector<Node*> ancestorsToClose; @@ -844,7 +869,7 @@ String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterc return interchangeNewlineString; } - markups.append(interchangeNewlineString); + accumulator.insertString(interchangeNewlineString); startNode = visibleStart.next().deepEquivalent().node(); if (pastEnd && Range::compareBoundaryPoints(startNode, 0, pastEnd, 0) >= 0) { @@ -883,7 +908,8 @@ String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterc // Add the node to the markup. if (addMarkupForNode) { - markups.append(getStartMarkup(n, updatedRange.get(), annotate, absoluteURLs)); + + accumulator.insertOpenTag(n, updatedRange.get(), annotate, absoluteURLs); if (nodes) nodes->append(n); } @@ -891,7 +917,7 @@ String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterc if (n->firstChild() == 0 || skipDescendants) { // Node has no children, or we are skipping it's descendants, add its close tag now. if (addMarkupForNode) { - markups.append(getEndMarkup(n)); + accumulator.insertEndTag(n); lastClosed = n; } @@ -904,7 +930,7 @@ String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterc if (next != pastEnd && next->isDescendantOf(ancestor)) break; // Not at the end of the range, close ancestors up to sibling of next node. - markups.append(getEndMarkup(ancestor)); + accumulator.insertEndTag(ancestor); lastClosed = ancestor; ancestorsToClose.removeLast(); } while (!ancestorsToClose.isEmpty()); @@ -920,8 +946,7 @@ String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterc continue; // or b) ancestors that we never encountered during a pre-order traversal starting at startNode: ASSERT(startNode->isDescendantOf(parent)); - preMarkups.append(getStartMarkup(parent, updatedRange.get(), annotate, absoluteURLs)); - markups.append(getEndMarkup(parent)); + accumulator.wrapWithNode(parent, updatedRange.get(), annotate, absoluteURLs); if (nodes) nodes->append(parent); lastClosed = parent; @@ -1001,13 +1026,12 @@ String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterc fullySelectedRootStyle->setProperty(CSSPropertyTextDecoration, CSSValueNone); if (!propertyMissingOrEqualToNone(fullySelectedRootStyle.get(), CSSPropertyWebkitTextDecorationsInEffect)) fullySelectedRootStyle->setProperty(CSSPropertyWebkitTextDecorationsInEffect, CSSValueNone); - addStyleMarkup(preMarkups, markups, fullySelectedRootStyle.get(), document, true); + accumulator.wrapWithStyleNode(fullySelectedRootStyle.get(), document, true); } } else { // Since this node and all the other ancestors are not in the selection we want to set RangeFullySelectsNode to DoesNotFullySelectNode // so that styles that affect the exterior of the node are not included. - preMarkups.append(getStartMarkup(ancestor, updatedRange.get(), annotate, absoluteURLs, convertBlocksToInlines, 0, DoesNotFullySelectNode)); - markups.append(getEndMarkup(ancestor)); + accumulator.wrapWithNode(ancestor, updatedRange.get(), annotate, absoluteURLs, convertBlocksToInlines, DoesNotFullySelectNode); } if (nodes) nodes->append(ancestor); @@ -1039,7 +1063,7 @@ String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterc style->removeBlockProperties(); if (style->length() > 0) - addStyleMarkup(preMarkups, markups, style.get(), document); + accumulator.wrapWithStyleNode(style.get(), document); } if (lastClosed && lastClosed != document->documentElement()) { @@ -1049,17 +1073,17 @@ String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterc RefPtr<CSSMutableStyleDeclaration> defaultStyle = ApplyStyleCommand::editingStyleAtPosition(Position(document->documentElement(), 0)); if (defaultStyle->length() > 0) - addStyleMarkup(preMarkups, markups, defaultStyle.get(), document); + accumulator.wrapWithStyleNode(defaultStyle.get(), document); } // FIXME: The interchange newline should be placed in the block that it's in, not after all of the content, unconditionally. if (annotate && needInterchangeNewlineAfter(visibleEnd.previous())) - markups.append(interchangeNewlineString); - + accumulator.insertString(interchangeNewlineString); + if (deleteButton) deleteButton->enable(); - return joinMarkups(preMarkups, markups); + return accumulator.takeResults(); } PassRefPtr<DocumentFragment> createFragmentFromMarkup(Document* document, const String& markup, const String& baseURL, FragmentScriptingPermission scriptingPermission) diff --git a/WebCore/history/BackForwardList.h b/WebCore/history/BackForwardList.h index 0813054..861b43b 100644 --- a/WebCore/history/BackForwardList.h +++ b/WebCore/history/BackForwardList.h @@ -94,8 +94,6 @@ public: virtual void removeItem(HistoryItem*) = 0; virtual HistoryItemVector& entries() = 0; - virtual void pushStateItem(PassRefPtr<HistoryItem>) = 0; - #if ENABLE(WML) virtual void clearWMLPageHistory() = 0; #endif diff --git a/WebCore/history/BackForwardListChromium.cpp b/WebCore/history/BackForwardListChromium.cpp index ec0f117..dc1efc9 100644 --- a/WebCore/history/BackForwardListChromium.cpp +++ b/WebCore/history/BackForwardListChromium.cpp @@ -121,16 +121,6 @@ HistoryItem* BackForwardListImpl::itemAtIndex(int index) return m_client->itemAtIndex(index); } -void BackForwardListImpl::pushStateItem(PassRefPtr<HistoryItem> newItem) -{ - RefPtr<HistoryItem> current = m_client->currentItem(); - - addItem(newItem); - - if (!current->stateObject()) - current->setStateObject(SerializedScriptValue::create()); -} - HistoryItemVector& BackForwardListImpl::entries() { static HistoryItemVector noEntries; diff --git a/WebCore/history/BackForwardListImpl.cpp b/WebCore/history/BackForwardListImpl.cpp index 9da3cad..cdb888c 100644 --- a/WebCore/history/BackForwardListImpl.cpp +++ b/WebCore/history/BackForwardListImpl.cpp @@ -242,20 +242,6 @@ HistoryItemVector& BackForwardListImpl::entries() return m_entries; } -void BackForwardListImpl::pushStateItem(PassRefPtr<HistoryItem> newItem) -{ - ASSERT(newItem); - ASSERT(newItem->stateObject()); - - RefPtr<HistoryItem> current = currentItem(); - ASSERT(current); - - addItem(newItem); - - if (!current->stateObject()) - current->setStateObject(SerializedScriptValue::create()); -} - void BackForwardListImpl::close() { int size = m_entries.size(); diff --git a/WebCore/history/BackForwardListImpl.h b/WebCore/history/BackForwardListImpl.h index 86e1227..ab92710 100644 --- a/WebCore/history/BackForwardListImpl.h +++ b/WebCore/history/BackForwardListImpl.h @@ -80,8 +80,6 @@ public: void removeItem(HistoryItem*); HistoryItemVector& entries(); - void pushStateItem(PassRefPtr<HistoryItem>); - #if ENABLE(WML) void clearWMLPageHistory(); #endif diff --git a/WebCore/html/FileThread.cpp b/WebCore/html/FileThread.cpp index 02b1718..3a3413c 100644 --- a/WebCore/html/FileThread.cpp +++ b/WebCore/html/FileThread.cpp @@ -61,7 +61,7 @@ bool FileThread::start() void FileThread::stop() { - return m_queue.kill(); + m_queue.kill(); } void FileThread::postTask(PassOwnPtr<Task> task) @@ -69,17 +69,17 @@ void FileThread::postTask(PassOwnPtr<Task> task) m_queue.append(task); } -class SameFilePredicate { +class SameInstancePredicate { public: - SameFilePredicate(const FileStream* stream) : m_stream(stream) { } - bool operator()(FileThread::Task* task) const { return task->stream() == m_stream; } + SameInstancePredicate(const void* instance) : m_instance(instance) { } + bool operator()(FileThread::Task* task) const { return task->instance() == m_instance; } private: - const FileStream* m_stream; + const void* m_instance; }; -void FileThread::unscheduleTasks(const FileStream* stream) +void FileThread::unscheduleTasks(const void* instance) { - SameFilePredicate predicate(stream); + SameInstancePredicate predicate(instance); m_queue.removeIf(predicate); } diff --git a/WebCore/html/FileThread.h b/WebCore/html/FileThread.h index d27273a..2eba98e 100644 --- a/WebCore/html/FileThread.h +++ b/WebCore/html/FileThread.h @@ -44,7 +44,11 @@ class FileStream; class FileThread : public ThreadSafeShared<FileThread> { public: - static PassRefPtr<FileThread> create() { return adoptRef(new FileThread()); } + static PassRefPtr<FileThread> create() + { + return adoptRef(new FileThread()); + } + ~FileThread(); bool start(); @@ -54,14 +58,15 @@ public: public: virtual ~Task() { } virtual void performTask() = 0; - FileStream* stream() const { return m_stream; } + void* instance() const { return m_instance; } protected: - Task(FileStream* stream) : m_stream(stream) { } - FileStream* m_stream; + Task(void* instance) : m_instance(instance) { } + void* m_instance; }; void postTask(PassOwnPtr<Task> task); - void unscheduleTasks(const FileStream*); + + void unscheduleTasks(const void* instance); private: FileThread(); diff --git a/WebCore/html/FileThreadTask.h b/WebCore/html/FileThreadTask.h index de11798..09b647f 100644 --- a/WebCore/html/FileThreadTask.h +++ b/WebCore/html/FileThreadTask.h @@ -32,73 +32,55 @@ #define FileThreadTask_h #include "CrossThreadCopier.h" +#include "CrossThreadTask.h" #include "FileThread.h" -#include <memory> #include <wtf/PassOwnPtr.h> #include <wtf/PassRefPtr.h> -#include <wtf/TypeTraits.h> namespace WebCore { -// Traits for the Task. -template<typename T> struct FileThreadTaskTraits { - typedef const T& ParamType; -}; - -template<typename T> struct FileThreadTaskTraits<T*> { - typedef T* ParamType; -}; - -template<typename T> struct FileThreadTaskTraits<PassRefPtr<T> > { - typedef PassRefPtr<T> ParamType; -}; - -template<typename T> struct FileThreadTaskTraits<PassOwnPtr<T> > { - typedef PassOwnPtr<T> ParamType; -}; - -template<typename R> +template<typename R, typename T> class FileThreadTask0 : public FileThread::Task { public: - typedef R (FileStream::*Method)(); - typedef FileThreadTask0<R> FileThreadTask; + typedef R (T::*Method)(); + typedef FileThreadTask0<R, T> FileThreadTaskImpl; - static PassOwnPtr<FileThreadTask> create(FileStream* stream, Method method) + static PassOwnPtr<FileThreadTaskImpl> create(T* instance, Method method) { - return new FileThreadTask(stream, method); + return new FileThreadTaskImpl(instance, method); } private: - FileThreadTask0(FileStream* stream, Method method) - : FileThread::Task(stream) + FileThreadTask0(T* instance, Method method) + : FileThread::Task(instance) , m_method(method) { } virtual void performTask() { - (*stream().*m_method)(); + (*static_cast<T*>(instance()).*m_method)(); } private: Method m_method; }; -template<typename R, typename P1, typename MP1> +template<typename R, typename T, typename P1, typename MP1> class FileThreadTask1 : public FileThread::Task { public: - typedef R (FileStream::*Method)(MP1); - typedef FileThreadTask1<R, P1, MP1> FileThreadTask; - typedef typename FileThreadTaskTraits<P1>::ParamType Param1; + typedef R (T::*Method)(MP1); + typedef FileThreadTask1<R, T, P1, MP1> FileThreadTaskImpl; + typedef typename CrossThreadTaskTraits<P1>::ParamType Param1; - static PassOwnPtr<FileThreadTask> create(FileStream* stream, Method method, Param1 parameter1) + static PassOwnPtr<FileThreadTaskImpl> create(T* instance, Method method, Param1 parameter1) { - return new FileThreadTask(stream, method, parameter1); + return new FileThreadTaskImpl(instance, method, parameter1); } private: - FileThreadTask1(FileStream* stream, Method method, Param1 parameter1) - : FileThread::Task(stream) + FileThreadTask1(T* instance, Method method, Param1 parameter1) + : FileThread::Task(instance) , m_method(method) , m_parameter1(parameter1) { @@ -106,7 +88,7 @@ private: virtual void performTask() { - (*stream().*m_method)(m_parameter1); + (*static_cast<T*>(instance()).*m_method)(m_parameter1); } private: @@ -114,22 +96,22 @@ private: P1 m_parameter1; }; -template<typename R, typename P1, typename MP1, typename P2, typename MP2> +template<typename R, typename T, typename P1, typename MP1, typename P2, typename MP2> class FileThreadTask2 : public FileThread::Task { public: - typedef R (FileStream::*Method)(MP1, MP2); - typedef FileThreadTask2<R, P1, MP1, P2, MP2> FileThreadTask; - typedef typename FileThreadTaskTraits<P1>::ParamType Param1; - typedef typename FileThreadTaskTraits<P2>::ParamType Param2; + typedef R (T::*Method)(MP1, MP2); + typedef FileThreadTask2<R, T, P1, MP1, P2, MP2> FileThreadTaskImpl; + typedef typename CrossThreadTaskTraits<P1>::ParamType Param1; + typedef typename CrossThreadTaskTraits<P2>::ParamType Param2; - static PassOwnPtr<FileThreadTask> create(FileStream* stream, Method method, Param1 parameter1, Param2 parameter2) + static PassOwnPtr<FileThreadTaskImpl> create(T* instance, Method method, Param1 parameter1, Param2 parameter2) { - return new FileThreadTask(stream, method, parameter1, parameter2); + return new FileThreadTaskImpl(instance, method, parameter1, parameter2); } private: - FileThreadTask2(FileStream* stream, Method method, Param1 parameter1, Param2 parameter2) - : FileThread::Task(stream) + FileThreadTask2(T* instance, Method method, Param1 parameter1, Param2 parameter2) + : FileThread::Task(instance) , m_method(method) , m_parameter1(parameter1) , m_parameter2(parameter2) @@ -138,7 +120,7 @@ private: virtual void performTask() { - (*stream().*m_method)(m_parameter1, m_parameter2); + (*static_cast<T*>(instance()).*m_method)(m_parameter1, m_parameter2); } private: @@ -147,23 +129,23 @@ private: P2 m_parameter2; }; -template<typename R, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3> +template<typename R, typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3> class FileThreadTask3 : public FileThread::Task { public: - typedef R (FileStream::*Method)(MP1, MP2, MP3); - typedef FileThreadTask3<R, P1, MP1, P2, MP2, P3, MP3> FileThreadTask; - typedef typename FileThreadTaskTraits<P1>::ParamType Param1; - typedef typename FileThreadTaskTraits<P2>::ParamType Param2; - typedef typename FileThreadTaskTraits<P3>::ParamType Param3; + typedef void (T::*Method)(MP1, MP2, MP3); + typedef FileThreadTask3<R, T, P1, MP1, P2, MP2, P3, MP3> FileThreadTaskImpl; + typedef typename CrossThreadTaskTraits<P1>::ParamType Param1; + typedef typename CrossThreadTaskTraits<P2>::ParamType Param2; + typedef typename CrossThreadTaskTraits<P3>::ParamType Param3; - static PassOwnPtr<FileThreadTask> create(FileStream* stream, Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3) + static PassOwnPtr<FileThreadTaskImpl> create(T* instance, Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3) { - return new FileThreadTask(stream, method, parameter1, parameter2, parameter3); + return new FileThreadTaskImpl(instance, method, parameter1, parameter2, parameter3); } private: - FileThreadTask3(FileStream* stream, Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3) - : FileThread::Task(stream) + FileThreadTask3(T* instance, Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3) + : FileThread::Task(instance) , m_method(method) , m_parameter1(parameter1) , m_parameter2(parameter2) @@ -173,7 +155,7 @@ private: virtual void performTask() { - (*stream().*m_method)(m_parameter1, m_parameter2, m_parameter3); + (*static_cast<T*>(instance()).*m_method)(m_parameter1, m_parameter2, m_parameter3); } private: @@ -183,56 +165,56 @@ private: P3 m_parameter3; }; -template<typename R> +template<typename R, typename T> PassOwnPtr<FileThread::Task> createFileThreadTask( - FileStream* const callee, - R (FileStream::*method)()); + T* const callee, + R (T::*method)()); -template<typename R> +template<typename R, typename T> PassOwnPtr<FileThread::Task> createFileThreadTask( - FileStream* const callee, - R (FileStream::*method)()) + T* const callee, + R (T::*method)()) { - return FileThreadTask0<R>::create( + return FileThreadTask0<R, T>::create( callee, method); } -template<typename R, typename P1, typename MP1> +template<typename R, typename T, typename P1, typename MP1> PassOwnPtr<FileThread::Task> createFileThreadTask( - FileStream* const callee, - R (FileStream::*method)(MP1), + T* const callee, + R (T::*method)(MP1), const P1& parameter1) { - return FileThreadTask1<R, typename CrossThreadCopier<P1>::Type, MP1>::create( + return FileThreadTask1<R, T, typename CrossThreadCopier<P1>::Type, MP1>::create( callee, method, CrossThreadCopier<P1>::copy(parameter1)); } -template<typename R, typename P1, typename MP1, typename P2, typename MP2> +template<typename R, typename T, typename P1, typename MP1, typename P2, typename MP2> PassOwnPtr<FileThread::Task> createFileThreadTask( - FileStream* const callee, - R (FileStream::*method)(MP1, MP2), + T* const callee, + R (T::*method)(MP1, MP2), const P1& parameter1, const P2& parameter2) { - return FileThreadTask2<R, typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2>::create( + return FileThreadTask2<R, T, typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2>::create( callee, method, CrossThreadCopier<P1>::copy(parameter1), CrossThreadCopier<P2>::copy(parameter2)); } -template<typename R, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3> +template<typename R, typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3> PassOwnPtr<FileThread::Task> createFileThreadTask( - FileStream* const callee, - R (FileStream::*method)(MP1, MP2, MP3), + T* const callee, + R (T::*method)(MP1, MP2, MP3), const P1& parameter1, const P2& parameter2, const P3& parameter3) { - return FileThreadTask3<R, typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3>::create( + return FileThreadTask3<R, T, typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3>::create( callee, method, CrossThreadCopier<P1>::copy(parameter1), diff --git a/WebCore/html/HTMLFrameSetElement.cpp b/WebCore/html/HTMLFrameSetElement.cpp index 1b38a1d..d0f84ef 100644 --- a/WebCore/html/HTMLFrameSetElement.cpp +++ b/WebCore/html/HTMLFrameSetElement.cpp @@ -208,10 +208,14 @@ void HTMLFrameSetElement::recalcStyle(StyleChange ch) { if (needsStyleRecalc() && renderer()) { renderer()->setNeedsLayout(true); +<<<<<<< HEAD #ifdef ANDROID_FLATTEN_FRAMESET static_cast<RenderFrameSet*>(renderer())->setGridNeedsLayout(); #endif setNeedsStyleRecalc(NoStyleChange); +======= + clearNeedsStyleRecalc(); +>>>>>>> webkit.org at r64523 } HTMLElement::recalcStyle(ch); } diff --git a/WebCore/html/HTMLInputElement.idl b/WebCore/html/HTMLInputElement.idl index c66e775..c726caa 100644 --- a/WebCore/html/HTMLInputElement.idl +++ b/WebCore/html/HTMLInputElement.idl @@ -100,7 +100,7 @@ module html { readonly attribute NodeList labels; #if defined(ENABLE_INPUT_SPEECH) && ENABLE_INPUT_SPEECH - attribute [Reflect] boolean speech; + attribute [Reflect, EnabledAtRuntime] boolean speech; #endif }; diff --git a/WebCore/html/HTMLStyleElement.cpp b/WebCore/html/HTMLStyleElement.cpp index 4fa08ad..1066c75 100644 --- a/WebCore/html/HTMLStyleElement.cpp +++ b/WebCore/html/HTMLStyleElement.cpp @@ -36,13 +36,9 @@ using namespace HTMLNames; inline HTMLStyleElement::HTMLStyleElement(const QualifiedName& tagName, Document* document, bool createdByParser) : HTMLElement(tagName, document) - , m_loading(false) - , m_createdByParser(createdByParser) - , m_startLineNumber(0) + , StyleElement(document, createdByParser) { ASSERT(hasTagName(styleTag)); - if (createdByParser && document && document->scriptableDocumentParser()) - m_startLineNumber = document->scriptableDocumentParser()->lineNumber(); } PassRefPtr<HTMLStyleElement> HTMLStyleElement::create(const QualifiedName& tagName, Document* document, bool createdByParser) @@ -62,32 +58,25 @@ void HTMLStyleElement::parseMappedAttribute(Attribute* attr) void HTMLStyleElement::finishParsingChildren() { - StyleElement::process(this, m_startLineNumber); - StyleElement::sheet(this); - m_createdByParser = false; + StyleElement::finishParsingChildren(this); HTMLElement::finishParsingChildren(); } void HTMLStyleElement::insertedIntoDocument() { HTMLElement::insertedIntoDocument(); - - document()->addStyleSheetCandidateNode(this, m_createdByParser); - if (!m_createdByParser) - StyleElement::insertedIntoDocument(document(), this); + StyleElement::insertedIntoDocument(document(), this); } void HTMLStyleElement::removedFromDocument() { HTMLElement::removedFromDocument(); - document()->removeStyleSheetCandidateNode(this); - StyleElement::removedFromDocument(document()); + StyleElement::removedFromDocument(document(), this); } void HTMLStyleElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) { - if (!changedByParser) - StyleElement::process(this, 0); + StyleElement::childrenChanged(this); HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); } @@ -96,24 +85,6 @@ StyleSheet* HTMLStyleElement::sheet() return StyleElement::sheet(this); } -bool HTMLStyleElement::isLoading() const -{ - if (m_loading) - return true; - if (!m_sheet) - return false; - return static_cast<CSSStyleSheet *>(m_sheet.get())->isLoading(); -} - -bool HTMLStyleElement::sheetLoaded() -{ - if (!isLoading()) { - document()->removePendingSheet(); - return true; - } - return false; -} - const AtomicString& HTMLStyleElement::media() const { return getAttribute(mediaAttr); diff --git a/WebCore/html/HTMLStyleElement.h b/WebCore/html/HTMLStyleElement.h index 10f5b10..07b5bd9 100644 --- a/WebCore/html/HTMLStyleElement.h +++ b/WebCore/html/HTMLStyleElement.h @@ -53,19 +53,13 @@ private: virtual void finishParsingChildren(); - virtual bool isLoading() const; - virtual bool sheetLoaded(); - - virtual void setLoading(bool loading) { m_loading = loading; } + virtual bool isLoading() const { return StyleElement::isLoading(); } + virtual bool sheetLoaded() { return StyleElement::sheetLoaded(document()); } virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const; virtual const AtomicString& media() const; virtual const AtomicString& type() const; - - bool m_loading; - bool m_createdByParser; - int m_startLineNumber; }; } //namespace diff --git a/WebCore/html/canvas/CanvasRenderingContext.h b/WebCore/html/canvas/CanvasRenderingContext.h index f752377..2ee1693 100644 --- a/WebCore/html/canvas/CanvasRenderingContext.h +++ b/WebCore/html/canvas/CanvasRenderingContext.h @@ -46,6 +46,7 @@ namespace WebCore { virtual bool is2d() const { return false; } virtual bool is3d() const { return false; } + virtual bool isAccelerated() const { return false; } private: HTMLCanvasElement* m_canvas; diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/WebCore/html/canvas/CanvasRenderingContext2D.cpp index 6c3d372..3b05348 100644 --- a/WebCore/html/canvas/CanvasRenderingContext2D.cpp +++ b/WebCore/html/canvas/CanvasRenderingContext2D.cpp @@ -164,6 +164,23 @@ void CanvasRenderingContext2D::restore() c->restore(); } +void CanvasRenderingContext2D::setAllAttributesToDefault() +{ + state().m_globalAlpha = 1; + state().m_shadowOffset = FloatSize(); + state().m_shadowBlur = 0; + state().m_shadowColor = Color::transparent; + state().m_globalComposite = CompositeSourceOver; + + GraphicsContext* context = drawingContext(); + if (!context) + return; + + context->setShadow(FloatSize(), 0, Color::transparent, DeviceColorSpace); + context->setAlpha(1); + context->setCompositeOperation(CompositeSourceOver); +} + CanvasStyle* CanvasRenderingContext2D::strokeStyle() const { return state().m_strokeStyle.get(); @@ -790,14 +807,18 @@ void CanvasRenderingContext2D::clearRect(float x, float y, float width, float he { if (!validateRectForCanvas(x, y, width, height)) return; - GraphicsContext* c = drawingContext(); - if (!c) + GraphicsContext* context = drawingContext(); + if (!context) return; if (!state().m_invertibleCTM) return; FloatRect rect(x, y, width, height); + + save(); + setAllAttributesToDefault(); willDraw(rect); - c->clearRect(rect); + context->clearRect(rect); + restore(); } void CanvasRenderingContext2D::fillRect(float x, float y, float width, float height) diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.h b/WebCore/html/canvas/CanvasRenderingContext2D.h index fb5f27a..22ed7fc 100644 --- a/WebCore/html/canvas/CanvasRenderingContext2D.h +++ b/WebCore/html/canvas/CanvasRenderingContext2D.h @@ -104,6 +104,7 @@ public: void save(); void restore(); + void setAllAttributesToDefault(); void scale(float sx, float sy); void rotate(float angleInRadians); diff --git a/WebCore/html/canvas/WebGLRenderingContext.h b/WebCore/html/canvas/WebGLRenderingContext.h index fa9ffdb..017570b 100644 --- a/WebCore/html/canvas/WebGLRenderingContext.h +++ b/WebCore/html/canvas/WebGLRenderingContext.h @@ -58,6 +58,7 @@ class WebKitCSSMatrix; virtual ~WebGLRenderingContext(); virtual bool is3d() const { return true; } + virtual bool isAccelerated() const { return true; } // Helper to return the size in bytes of OpenGL data types // like GL_FLOAT, GL_INT, etc. diff --git a/WebCore/inspector/InspectorController.cpp b/WebCore/inspector/InspectorController.cpp index e29c7ae..369b40b 100644 --- a/WebCore/inspector/InspectorController.cpp +++ b/WebCore/inspector/InspectorController.cpp @@ -458,9 +458,18 @@ void InspectorController::inspectedWindowScriptObjectCleared(Frame* frame) if (m_inspectorFrontendClient && frame == m_inspectedPage->mainFrame()) m_inspectorFrontendClient->windowObjectCleared(); - if (!enabled() || !m_frontend || frame != m_inspectedPage->mainFrame()) + if (!enabled()) return; - m_injectedScriptHost->discardInjectedScripts(); + + if (m_frontend && frame != m_inspectedPage->mainFrame()) + m_injectedScriptHost->discardInjectedScripts(); + if (m_scriptsToEvaluateOnLoad.size()) { + ScriptState* scriptState = mainWorldScriptState(frame); + for (Vector<String>::iterator it = m_scriptsToEvaluateOnLoad.begin(); + it != m_scriptsToEvaluateOnLoad.end(); ++it) { + m_injectedScriptHost->injectScript(*it, scriptState); + } + } } void InspectorController::setSearchingForNode(bool enabled) @@ -802,14 +811,6 @@ void InspectorController::didCommitLoad(DocumentLoader* loader) for (Frame* frame = loader->frame(); frame; frame = frame->tree()->traverseNext(loader->frame())) if (ResourcesMap* resourceMap = m_frameResources.get(frame)) pruneResources(resourceMap, loader); - - if (m_scriptsToEvaluateOnLoad.size()) { - ScriptState* scriptState = mainWorldScriptState(loader->frame()); - for (Vector<String>::iterator it = m_scriptsToEvaluateOnLoad.begin(); - it != m_scriptsToEvaluateOnLoad.end(); ++it) { - m_injectedScriptHost->injectScript(*it, scriptState); - } - } } void InspectorController::frameDetachedFromParent(Frame* frame) diff --git a/WebCore/inspector/InspectorDOMAgent.cpp b/WebCore/inspector/InspectorDOMAgent.cpp index 3a14830..075944a 100644 --- a/WebCore/inspector/InspectorDOMAgent.cpp +++ b/WebCore/inspector/InspectorDOMAgent.cpp @@ -774,6 +774,7 @@ PassRefPtr<InspectorObject> InspectorDOMAgent::buildObjectForNode(Node* node, in switch (node->nodeType()) { case Node::TEXT_NODE: case Node::COMMENT_NODE: + case Node::CDATA_SECTION_NODE: nodeValue = node->nodeValue(); break; case Node::ATTRIBUTE_NODE: @@ -1559,6 +1560,8 @@ Node* InspectorDOMAgent::nodeForPath(const String& path) Vector<String> pathTokens; path.split(",", false, pathTokens); + if (!pathTokens.size()) + return 0; for (size_t i = 0; i < pathTokens.size() - 1; i += 2) { bool success = true; unsigned childNumber = pathTokens[i].toUInt(&success); diff --git a/WebCore/inspector/InspectorFrontendHost.cpp b/WebCore/inspector/InspectorFrontendHost.cpp index 6957dd1..0dacde6 100644 --- a/WebCore/inspector/InspectorFrontendHost.cpp +++ b/WebCore/inspector/InspectorFrontendHost.cpp @@ -192,6 +192,14 @@ void InspectorFrontendHost::moveWindowBy(float x, float y) const m_client->moveWindowBy(x, y); } +void InspectorFrontendHost::setExtensionAPI(const String& script) +{ + InspectorController* inspector = m_frontendPage->inspectorController(); + + inspector->removeAllScriptsToEvaluateOnLoad(); + inspector->addScriptToEvaluateOnLoad(script); +} + String InspectorFrontendHost::localizedStringsURL() { return m_client->localizedStringsURL(); diff --git a/WebCore/inspector/InspectorFrontendHost.h b/WebCore/inspector/InspectorFrontendHost.h index 7fb4a1e..4b343fd 100644 --- a/WebCore/inspector/InspectorFrontendHost.h +++ b/WebCore/inspector/InspectorFrontendHost.h @@ -67,6 +67,7 @@ public: void setAttachedWindowHeight(unsigned height); void moveWindowBy(float x, float y) const; + void setExtensionAPI(const String& script); String localizedStringsURL(); String hiddenPanels(); diff --git a/WebCore/inspector/InspectorFrontendHost.idl b/WebCore/inspector/InspectorFrontendHost.idl index d1b3604..0c7cf8b 100644 --- a/WebCore/inspector/InspectorFrontendHost.idl +++ b/WebCore/inspector/InspectorFrontendHost.idl @@ -41,6 +41,7 @@ module core { void requestDetachWindow(); void setAttachedWindowHeight(in unsigned long height); void moveWindowBy(in float x, in float y); + void setExtensionAPI(in DOMString script); DOMString localizedStringsURL(); DOMString hiddenPanels(); diff --git a/WebCore/inspector/front-end/ElementsPanel.js b/WebCore/inspector/front-end/ElementsPanel.js index ec9559f..09a84f7 100644 --- a/WebCore/inspector/front-end/ElementsPanel.js +++ b/WebCore/inspector/front-end/ElementsPanel.js @@ -56,8 +56,10 @@ WebInspector.ElementsPanel = function() this.panel.updateProperties(); this.panel.updateEventListeners(); - if (this._focusedDOMNode) + if (this._focusedDOMNode) { InspectorBackend.addInspectedNode(this._focusedDOMNode.id); + WebInspector.extensionServer.notifyObjectSelected(this.name, "DOMNode"); + } }; this.contentElement.appendChild(this.treeOutline.element); @@ -161,7 +163,7 @@ WebInspector.ElementsPanel.prototype = { if (this.focusedDOMNode) { this._selectedPathOnReset = []; var node = this.focusedDOMNode; - while ("index" in node) { + while ("index" in node && node.nodeName && node.nodeName.length) { this._selectedPathOnReset.push(node.nodeName); this._selectedPathOnReset.push(node.index); node = node.parentNode; diff --git a/WebCore/inspector/front-end/ElementsTreeOutline.js b/WebCore/inspector/front-end/ElementsTreeOutline.js index 7247ba0..3cd22ae 100644 --- a/WebCore/inspector/front-end/ElementsTreeOutline.js +++ b/WebCore/inspector/front-end/ElementsTreeOutline.js @@ -1320,6 +1320,10 @@ WebInspector.ElementsTreeElement.prototype = { info.title += " [" + node.internalSubset + "]"; info.title += "></span>"; break; + + case Node.CDATA_SECTION_NODE: + info.title = "<span class=\"webkit-html-text-node\"><![CDATA[" + node.nodeValue.escapeHTML() + "]]></span>"; + break; default: info.title = this.treeOutline.nodeNameToCorrectCase(node.nodeName).collapseWhitespace().escapeHTML(); } diff --git a/WebCore/inspector/front-end/ExtensionAPI.js b/WebCore/inspector/front-end/ExtensionAPI.js new file mode 100644 index 0000000..476a463 --- /dev/null +++ b/WebCore/inspector/front-end/ExtensionAPI.js @@ -0,0 +1,322 @@ +/* + * Copyright (C) 2010 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. + */ + +var injectedExtensionAPI = function(InjectedScriptHost, inspectedWindow, injectedScriptId) +{ + +// Here and below, all constructors are private to API implementation. +// For a public type Foo, if internal fields are present, these are on +// a private FooImpl type, an instance of FooImpl is used in a closure +// by Foo consutrctor to re-bind publicly exported members to an instance +// of Foo. + +function EventSinkImpl(type) +{ + this._type = type; + this._listeners = []; +} + +EventSinkImpl.prototype = { + addListener: function(callback) + { + if (this._listeners.length === 0) + extensionServer.sendRequest({ command: "subscribe", type: this._type }); + this._listeners.push(callback); + extensionServer.registerHandler("notify-" + this._type, bind(this._fire, this)); + }, + + removeListener: function(callback) + { + var listeners = this._listeners; + + for (var i = 0; i < listeners.length; ++i) { + if (listeners[i] === callback) { + listeners.splice(i, 1); + break; + } + } + if (this._listeners.length === 0) + extensionServer.sendRequest({ command: "unsubscribe", type: this._type }); + }, + + _fire: function(request) + { + var listeners = this._listeners.slice(); + for (var i = 0; i < listeners.length; ++i) + listeners[i].apply(null, request.arguments); + } +} + +function EventSink(type) +{ + var impl = new EventSinkImpl(type); + this.addListener = bind(impl.addListener, impl); + this.removeListener = bind(impl.removeListener, impl); +} + +function InspectorExtensionAPI() +{ + this.inspectedWindow = new InspectedWindow(); + this.panels = new Panels(); + this.resources = new Resources(); + this.onReset = new EventSink("reset"); +} + +InspectorExtensionAPI.prototype = { + log: function(message) + { + extensionServer.sendRequest({ command: "log", message: message }); + } +} + +function Resources() +{ + this.onFinished = new EventSink("resource-finished"); +} + +Resources.prototype = { + getAll: function(callback) + { + return extensionServer.sendRequest({ command: "getResources" }, callback); + }, + + get: function(id, callback) + { + return extensionServer.sendRequest({ command: "getResources", id: id }, callback); + } +} + +var wellKnownPanelNames = [ + "elements", + "scripts" +]; + +function Panels() +{ + var panels = []; + function panelGetter(name) + { + return panels[name]; + } + + for (var i = 0; i < wellKnownPanelNames.length; ++i) { + var name = wellKnownPanelNames[i]; + panels[name] = new Panel(name); + this.__defineGetter__(name, bind(panelGetter, null, name)); + } +} + +Panels.prototype = { + create: function(label, pageURL, iconURL, callback) + { + var id = "extension-panel-" + extensionServer.nextObjectId(); + function callbackWrapper(result) + { + if (result.isError) + callback(result); + else { + panel = new ExtensionPanel(id); + callback(panel); + } + } + var request = { + command: "createPanel", + id: id, + label: label, + url: expandURL(pageURL), + icon: expandURL(iconURL) + }; + extensionServer.sendRequest(request, callback && bind(callbackWrapper, this)); + } +} + +function PanelImpl(id) +{ + this._id = id; + this.onSelectionChanged = new EventSink("panel-objectSelected-" + id); +} + +PanelImpl.prototype = { + createSidebarPane: function(title, url, callback) + { + var id = "extension-sidebar-" + extensionServer.nextObjectId(); + function callbackWrapper(result) + { + if (result.isError) + callback(result); + else + callback(new ExtensionSidebarPane(id)); + } + extensionServer.sendRequest({ command: "createSidebarPane", panel: this._id, id: id, title: title, url: expandURL(url) }, callback && callbackWrapper); + } +} + +function Panel(id) +{ + var impl = new PanelImpl(id); + this.createSidebarPane = bind(impl.createSidebarPane, impl); +} + +function ExtensionPanel(id) +{ + Panel.call(this, id); + this.onSearch = new EventSink("panel-search-" + id); +} + +ExtensionPanel.prototype = { +} + +ExtensionPanel.prototype.__proto__ = Panel.prototype; + +function ExtensionSidebarPaneImpl(id) +{ + this._id = id; +} + +ExtensionSidebarPaneImpl.prototype = { + setHeight: function(height) + { + extensionServer.sendRequest({ command: "setSidebarHeight", id: this._id, height: height }); + }, + + setExpanded: function(expanded) + { + extensionServer.sendRequest({ command: "setSidebarExpanded", id: this._id, expanded: expanded }); + } +} + +function ExtensionSidebarPane(id) +{ + var impl = new ExtensionSidebarPaneImpl(id); + this.setHeight = bind(impl.setHeight, impl); + this.setExpanded = bind(impl.setExpanded, impl); +} + +function InspectedWindow() +{ + this.onLoaded = new EventSink("inspectedPageLoaded"); + this.onNavigated = new EventSink("inspectedURLChanged"); + this.onDOMContentLoaded = new EventSink("DOMContentLoaded"); +} + +InspectedWindow.prototype = { + reload: function() + { + return extensionServer.sendRequest({ command: "reload" }); + }, + + evaluate: function(expression, callback) + { + return extensionServer.sendRequest({ command: "evaluateOnInspectedPage", expression: expression }, callback); + } +} + +function ExtensionServerClient() +{ + this._callbacks = {}; + this._handlers = {}; + this._lastRequestId = 0; + this._lastObjectId = 0; + + this.registerHandler("callback", bind(this._onCallback, this)); + + var channel = new MessageChannel(); + this._port = channel.port1; + this._port.addEventListener("message", bind(this._onMessage, this), false); + this._port.start(); + + top.postMessage("registerExtension", [ channel.port2 ], "*"); +} + +ExtensionServerClient.prototype = { + sendRequest: function(message, callback) + { + if (typeof callback === "function") + message.requestId = this._registerCallback(callback); + return this._port.postMessage(message); + }, + + registerHandler: function(command, handler) + { + this._handlers[command] = handler; + }, + + nextObjectId: function() + { + return injectedScriptId + "_" + ++this._lastObjectId; + }, + + _registerCallback: function(callback) + { + var id = ++this._lastRequestId; + this._callbacks[id] = callback; + return id; + }, + + _onCallback: function(request) + { + if (request.requestId in this._callbacks) { + this._callbacks[request.requestId](request.result); + delete this._callbacks[request.requestId]; + } + }, + + _onMessage: function(event) + { + var request = event.data; + var handler = this._handlers[request.command]; + if (handler) + handler.call(this, request); + } +} + +function expandURL(url) +{ + if (!url) + return url; + if (/^[^/]+:/.exec(url)) // See if url has schema. + return url; + var baseURL = location.protocol + "//" + location.hostname + location.port; + if (/^\//.exec(url)) + return baseURL + url; + return baseURL + location.pathname.replace(/\/[^/]*$/,"/") + url; +} + +function bind(func, thisObject) +{ + var args = Array.prototype.slice.call(arguments, 2); + return function() { return func.apply(thisObject, args.concat(Array.prototype.slice.call(arguments, 0))); }; +} + +var extensionServer = new ExtensionServerClient(); + +webInspector = new InspectorExtensionAPI(); + +} diff --git a/WebCore/inspector/front-end/ExtensionPanel.js b/WebCore/inspector/front-end/ExtensionPanel.js new file mode 100644 index 0000000..ba5fa8e --- /dev/null +++ b/WebCore/inspector/front-end/ExtensionPanel.js @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2010 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. + */ + +WebInspector.ExtensionPanel = function(id, label, iconURL, options) +{ + this.toolbarItemLabel = label; + this._addStyleRule(".toolbar-item." + id + " .toolbar-icon", "background-image: url(" + iconURL + ");"); + WebInspector.Panel.call(this, id); +} + +WebInspector.ExtensionPanel.prototype = { + get defaultFocusedElement() + { + return this.sidebarTreeElement || this.element; + }, + + updateMainViewWidth: function(width) + { + this.bodyElement.style.left = width + "px"; + this.resize(); + }, + + searchCanceled: function(startingNewSearch) + { + WebInspector.extensionServer.notifySearchAction(this._id, "cancelSearch"); + WebInspector.Panel.prototype.searchCanceled.apply(this, arguments); + }, + + performSearch: function(query) + { + WebInspector.extensionServer.notifySearchAction(this._id, "performSearch", query); + WebInspector.Panel.prototype.performSearch.apply(this, arguments); + }, + + jumpToNextSearchResult: function() + { + WebInspector.extensionServer.notifySearchAction(this._id, "nextSearchResult"); + WebInspector.Panel.prototype.jumpToNextSearchResult.call(this); + }, + + jumpToPreviousSearchResult: function() + { + WebInspector.extensionServer.notifySearchAction(this._id, "previousSearchResult"); + WebInspector.Panel.prototype.jumpToPreviousSearchResult.call(this); + }, + + _addStyleRule: function(selector, body) + { + var style = document.createElement("style"); + style.textContent = selector + " { " + body + " }"; + document.head.appendChild(style); + } +} + +WebInspector.ExtensionPanel.prototype.__proto__ = WebInspector.Panel.prototype; diff --git a/WebCore/inspector/front-end/ExtensionRegistryStub.js b/WebCore/inspector/front-end/ExtensionRegistryStub.js new file mode 100644 index 0000000..a9c96ef --- /dev/null +++ b/WebCore/inspector/front-end/ExtensionRegistryStub.js @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2010 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. + */ + +if (!window.InspectorExtensionRegistry) { + +WebInspector.InspectorExtensionRegistryStub = function() +{ +} + +WebInspector.InspectorExtensionRegistryStub.prototype = { + getExtensionsAsync: function() + { + } +}; + +InspectorExtensionRegistry = new WebInspector.InspectorExtensionRegistryStub(); + +} diff --git a/WebCore/inspector/front-end/ExtensionServer.js b/WebCore/inspector/front-end/ExtensionServer.js new file mode 100644 index 0000000..2d2eab1 --- /dev/null +++ b/WebCore/inspector/front-end/ExtensionServer.js @@ -0,0 +1,319 @@ +/* + * Copyright (C) 2010 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. + */ + +WebInspector.ExtensionServer = function() +{ + this._clientObjects = {}; + this._handlers = {}; + this._subscribers = {}; + this._status = new WebInspector.ExtensionStatus(); + + this._registerHandler("subscribe", this._onSubscribe.bind(this)); + this._registerHandler("unsubscribe", this._onUnsubscribe.bind(this)); + this._registerHandler("getResources", this._onGetResources.bind(this)); + this._registerHandler("createPanel", this._onCreatePanel.bind(this)); + this._registerHandler("createSidebarPane", this._onCreateSidebar.bind(this)); + this._registerHandler("log", this._onLog.bind(this)); + this._registerHandler("evaluateOnInspectedPage", this._onEvaluateOnInspectedPage.bind(this)); + this._registerHandler("setSidebarHeight", this._onSetSidebarHeight.bind(this)); + this._registerHandler("setSidebarExpanded", this._onSetSidebarExpansion.bind(this)); + + window.addEventListener("message", this._onWindowMessage.bind(this), false); +} + +WebInspector.ExtensionServer.prototype = { + notifyPanelShown: function(panelName) + { + this._postNotification("panel-shown-" + panelName); + }, + + notifyObjectSelected: function(panelId, objectType, objectId) + { + this._postNotification("panel-objectSelected-" + panelId, objectType, objectId); + }, + + notifyResourceFinished: function(resource) + { + this._postNotification("resource-finished", this._convertResource(resource)); + }, + + notifySearchAction: function(panelId, action, searchString) + { + this._postNotification("panel-search-" + panelId, action, searchString); + }, + + notifyInspectedPageLoaded: function() + { + this._postNotification("inspectedPageLoaded"); + }, + + notifyInspectedURLChanged: function() + { + this._postNotification("inspectedURLChanged"); + }, + + notifyInspectorReset: function() + { + this._postNotification("reset"); + }, + + _convertResource: function(resource) + { + return { + id: resource.identifier, + type: resource.type, + har: (new WebInspector.HAREntry(resource)).build(), + }; + }, + + _postNotification: function(type, details) + { + var subscribers = this._subscribers[type]; + if (!subscribers) + return; + var message = { + command: "notify-" + type, + arguments: Array.prototype.slice.call(arguments, 1) + }; + for (var i = 0; i < subscribers.length; ++i) + subscribers[i].postMessage(message); + }, + + _onSubscribe: function(message, port) + { + var subscribers = this._subscribers[message.type]; + if (subscribers) + subscribers.push(port); + else + this._subscribers[message.type] = [ port ]; + }, + + _onUnsubscribe: function(message, port) + { + var subscribers = this._subscribers[message.type]; + if (!subscribers) + return; + subscribers.remove(port); + if (!subscribers.length) + delete this._subscribers[message.type]; + }, + + _onCreatePanel: function(message, port) + { + var id = message.id; + // The ids are generated on the client API side and must be unique, so the check below + // shouldn't be hit unless someone is bypassing the API. + if (id in this._clientObjects || id in WebInspector.panels) + return this._status.E_EXISTS(id); + var panel = new WebInspector.ExtensionPanel(id, message.label, message.icon); + this._clientObjects[id] = panel; + + var toolbarElement = document.getElementById("toolbar"); + var lastToolbarItem = WebInspector.panelOrder[WebInspector.panelOrder.length - 1].toolbarItem; + WebInspector.addPanelToolbarIcon(toolbarElement, panel, lastToolbarItem); + WebInspector.panels[id] = panel; + this._createClientIframe(panel.element, message.url); + return this._status.OK(); + }, + + _onCreateSidebar: function(message, port) + { + var panel = WebInspector.panels[message.panel]; + if (!panel) + return this._status.E_NOTFOUND(message.panel); + if (!panel.sidebarElement || !panel.sidebarPanes) + return this._status.E_NOTSUPPORTED(); + var id = message.id; + var sidebar = new WebInspector.SidebarPane(message.title); + this._clientObjects[id] = sidebar; + panel.sidebarPanes[id] = sidebar; + panel.sidebarElement.appendChild(sidebar.element); + this._createClientIframe(sidebar.bodyElement, message.url); + return this._status.OK(); + }, + + _createClientIframe: function(parent, url, requestId, port) + { + var iframe = document.createElement("iframe"); + iframe.src = url; + iframe.style.width = "100%"; + parent.appendChild(iframe); + }, + + _onSetSidebarHeight: function(message) + { + var sidebar = this._clientObjects[message.id]; + if (!sidebar) + return this._status.E_NOTFOUND(message.id); + sidebar.bodyElement.firstChild.style.height = message.height; + }, + + _onSetSidebarExpansion: function(message) + { + var sidebar = this._clientObjects[message.id]; + if (!sidebar) + return this._status.E_NOTFOUND(message.id); + if (message.expanded) + sidebar.expand(); + else + sidebar.collapse(); + }, + + _onLog: function(message) + { + WebInspector.log(message.message); + }, + + _onEvaluateOnInspectedPage: function(message, port) + { + InjectedScriptAccess.getDefault().evaluateAndStringify(message.expression, this._dispatchCallback.bind(this, message.requestId, port)); + }, + + _onRevealAndSelect: function(message) + { + if (message.panelId === "resources" && type === "resource") + return this._onRevealAndSelectResource(message); + else + return this._status.E_NOTSUPPORTED(message.panelId, message.type); + }, + + _onRevealAndSelectResource: function(message) + { + var id = message.id; + var resource = null; + + resource = typeof id === "number" ? WebInspector.resources[id] : WebInspector.resourceForURL(id); + if (!resource) + return this._status.E_NOTFOUND(typeof id + ": " + id); + WebInspector.panels.resources.showResource(resource, message.line); + WebInspector.showResourcesPanel(); + }, + + _dispatchCallback: function(requestId, port, result) + { + port.postMessage({ command: "callback", requestId: requestId, result: result }); + }, + + _onGetResources: function(request) + { + function resourceWrapper(id) + { + return WebInspector.extensionServer._convertResource(WebInspector.resources[id]); + } + + var response; + if (request.id) + response = WebInspector.resources[request.id] ? resourceWrapper(request.id) : this._status.E_NOTFOUND(request.id); + else + response = Object.properties(WebInspector.resources).map(resourceWrapper); + return response; + }, + + initExtensions: function() + { + InspectorExtensionRegistry.getExtensionsAsync(); + }, + + _addExtensions: function(extensions) + { + InspectorFrontendHost.setExtensionAPI("(" + injectedExtensionAPI.toString() + ")"); // See ExtensionAPI.js for details. + for (var i = 0; i < extensions.length; ++i) { + var extension = extensions[i]; + try { + if (!extension.startPage) + return; + var iframe = document.createElement("iframe"); + iframe.src = extension.startPage; + iframe.style.display = "none"; + document.body.appendChild(iframe); + } catch (e) { + console.error("Failed to initialize extension " + extension.startPage + ":" + e); + } + } + }, + + _onWindowMessage: function(event) + { + if (event.data !== "registerExtension") + return; + var port = event.ports[0]; + port.addEventListener("message", this._onmessage.bind(this), false); + port.start(); + }, + + _onmessage: function(event) + { + var request = event.data; + var result; + + if (request.command in this._handlers) + result = this._handlers[request.command](request, event.target); + else + result = this._status.E_NOTSUPPORTED(request.command); + + if (result && request.requestId) + this._dispatchCallback(request.requestId, event.target, result); + }, + + _registerHandler: function(command, callback) + { + this._handlers[command] = callback; + } +} + +WebInspector.ExtensionServer._statuses = +{ + OK: "", + E_NOTFOUND: "Object not found (%s)", + E_NOTSUPPORTED: "Object does not support requested operation (%s)", + E_EXISTS: "Object already exists (%s)" +} + +WebInspector.ExtensionStatus = function() +{ + function makeStatus(code) + { + var description = WebInspector.ExtensionServer._statuses[code] || code; + var details = Array.prototype.slice.call(arguments, 1); + var status = { code: code, description: description, details: details }; + if (code !== "OK") { + status.isError = true; + console.log("Extension server error: " + String.vsprintf(description, details)); + } + return status; + } + for (status in WebInspector.ExtensionServer._statuses) + this[status] = makeStatus.bind(null, status); +} + +WebInspector.addExtensions = function(extensions) +{ + WebInspector.extensionServer._addExtensions(extensions); +} diff --git a/WebCore/inspector/front-end/InjectedScript.js b/WebCore/inspector/front-end/InjectedScript.js index ce187d2..3a114c0 100644 --- a/WebCore/inspector/front-end/InjectedScript.js +++ b/WebCore/inspector/front-end/InjectedScript.js @@ -238,6 +238,19 @@ InjectedScript.getCompletions = function(expression, includeInspectorCommandLine return props; } +InjectedScript.evaluateAndStringify = function(expression) +{ + var result = {}; + try { + var value = InjectedScript._evaluateOn(inspectedWindow.eval, inspectedWindow, expression, false); + result.value = JSON.stringify(value); + } catch (e) { + result.value = e.toString(); + result.isException = true; + } + return result; +} + InjectedScript.evaluate = function(expression, objectGroup) { return InjectedScript._evaluateAndWrap(inspectedWindow.eval, inspectedWindow, expression, objectGroup); diff --git a/WebCore/inspector/front-end/InjectedScriptAccess.js b/WebCore/inspector/front-end/InjectedScriptAccess.js index 5950421..59aa70c 100644 --- a/WebCore/inspector/front-end/InjectedScriptAccess.js +++ b/WebCore/inspector/front-end/InjectedScriptAccess.js @@ -75,14 +75,15 @@ InjectedScriptAccess._installHandler = function(methodName, async) // - Make sure last parameter of all the InjectedSriptAccess.* calls is a callback function. // We keep these sorted. InjectedScriptAccess._installHandler("evaluate"); +InjectedScriptAccess._installHandler("evaluateAndStringify"); InjectedScriptAccess._installHandler("evaluateInCallFrame"); +InjectedScriptAccess._installHandler("evaluateOnSelf"); InjectedScriptAccess._installHandler("getCompletions"); InjectedScriptAccess._installHandler("getProperties"); InjectedScriptAccess._installHandler("getPrototypes"); InjectedScriptAccess._installHandler("openInInspectedWindow"); InjectedScriptAccess._installHandler("pushNodeToFrontend"); InjectedScriptAccess._installHandler("setPropertyValue"); -InjectedScriptAccess._installHandler("evaluateOnSelf"); // Some methods can't run synchronously even on the injected script side (such as DB transactions). // Mark them as asynchronous here. diff --git a/WebCore/inspector/front-end/InspectorFrontendHostStub.js b/WebCore/inspector/front-end/InspectorFrontendHostStub.js index 39bbe02..c4e6bf4 100644 --- a/WebCore/inspector/front-end/InspectorFrontendHostStub.js +++ b/WebCore/inspector/front-end/InspectorFrontendHostStub.js @@ -84,6 +84,10 @@ WebInspector.InspectorFrontendHostStub.prototype = { { }, + setExtensionAPI: function(script) + { + }, + loaded: function() { }, @@ -109,6 +113,10 @@ WebInspector.InspectorFrontendHostStub.prototype = { canAttachWindow: function() { return false; + }, + + sendMessageToBackend: function(message) + { } } diff --git a/WebCore/inspector/front-end/Settings.js b/WebCore/inspector/front-end/Settings.js index 22db491..e54acc7 100644 --- a/WebCore/inspector/front-end/Settings.js +++ b/WebCore/inspector/front-end/Settings.js @@ -43,7 +43,6 @@ var Preferences = { debuggerAlwaysEnabled: false, profilerAlwaysEnabled: false, auditsPanelEnabled: true, - appCacheEnabled: true } WebInspector.populateApplicationSettings = function(settingsString) diff --git a/WebCore/inspector/front-end/StoragePanel.js b/WebCore/inspector/front-end/StoragePanel.js index 03a099f..68563de 100644 --- a/WebCore/inspector/front-end/StoragePanel.js +++ b/WebCore/inspector/front-end/StoragePanel.js @@ -49,12 +49,11 @@ WebInspector.StoragePanel = function(database) this.sidebarTree.appendChild(this.cookieListTreeElement); this.cookieListTreeElement.expand(); - if (Preferences.appCacheEnabled) { - this.applicationCacheListTreeElement = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("APPLICATION CACHE"), {}, true); - this.sidebarTree.appendChild(this.applicationCacheListTreeElement); - this.applicationCacheListTreeElement.expand(); - } - + + this.applicationCacheListTreeElement = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("APPLICATION CACHE"), {}, true); + this.sidebarTree.appendChild(this.applicationCacheListTreeElement); + this.applicationCacheListTreeElement.expand(); + this.storageViews = document.createElement("div"); this.storageViews.id = "storage-views"; this.element.appendChild(this.storageViews); @@ -111,8 +110,7 @@ WebInspector.StoragePanel.prototype = { this.sessionStorageListTreeElement.removeChildren(); this.cookieListTreeElement.removeChildren(); - if (Preferences.appCacheEnabled) - this.applicationCacheListTreeElement.removeChildren(); + this.applicationCacheListTreeElement.removeChildren(); this.storageViews.removeChildren(); @@ -150,8 +148,6 @@ WebInspector.StoragePanel.prototype = { addApplicationCache: function(domain) { - if (!Preferences.appCacheEnabled) - return; var applicationCacheTreeElement = new WebInspector.ApplicationCacheSidebarTreeElement(domain); this.applicationCacheListTreeElement.appendChild(applicationCacheTreeElement); }, diff --git a/WebCore/inspector/front-end/WebKit.qrc b/WebCore/inspector/front-end/WebKit.qrc index 42ad915..a54936c 100644 --- a/WebCore/inspector/front-end/WebKit.qrc +++ b/WebCore/inspector/front-end/WebKit.qrc @@ -34,6 +34,10 @@ <file>ElementsPanel.js</file> <file>ElementsTreeOutline.js</file> <file>EventListenersSidebarPane.js</file> + <file>ExtensionAPI.js</file> + <file>ExtensionPanel.js</file> + <file>ExtensionRegistryStub.js</file> + <file>ExtensionServer.js</file> <file>FontView.js</file> <file>HAREntry.js</file> <file>HelpScreen.js</file> diff --git a/WebCore/inspector/front-end/inspector.html b/WebCore/inspector/front-end/inspector.html index c829195..48e95bb 100644 --- a/WebCore/inspector/front-end/inspector.html +++ b/WebCore/inspector/front-end/inspector.html @@ -39,6 +39,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <script type="text/javascript" src="inspector.js"></script> <script type="text/javascript" src="InspectorBackendStub.js"></script> <script type="text/javascript" src="InspectorFrontendHostStub.js"></script> + <script type="text/javascript" src="ExtensionRegistryStub.js"></script> <script type="text/javascript" src="Object.js"></script> <script type="text/javascript" src="Settings.js"></script> <script type="text/javascript" src="CSSStyleModel.js"></script> @@ -96,6 +97,9 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <script type="text/javascript" src="StoragePanel.js"></script> <script type="text/javascript" src="ProfilesPanel.js"></script> <script type="text/javascript" src="ConsolePanel.js"></script> + <script type="text/javascript" src="ExtensionAPI.js"></script> + <script type="text/javascript" src="ExtensionServer.js"></script> + <script type="text/javascript" src="ExtensionPanel.js"></script> <script type="text/javascript" src="AuditsPanel.js"></script> <script type="text/javascript" src="AuditResultView.js"></script> <script type="text/javascript" src="AuditLauncherView.js"></script> diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js index 0adf057..4bb30c7 100644 --- a/WebCore/inspector/front-end/inspector.js +++ b/WebCore/inspector/front-end/inspector.js @@ -526,6 +526,9 @@ WebInspector.loaded = function() document.getElementById("close-button-left").addEventListener("click", this.close, true); document.getElementById("close-button-right").addEventListener("click", this.close, true); + this.extensionServer = new WebInspector.ExtensionServer(); + this.extensionServer.initExtensions(); + InspectorFrontendHost.loaded(); } @@ -1202,6 +1205,7 @@ WebInspector.updateResource = function(identifier, payload) resource.finished = payload.finished; if (this.panels.audits) this.panels.audits.resourceFinished(resource); + this.extensionServer.notifyResourceFinished(resource); } if (payload.didTimingChange) { @@ -1426,6 +1430,7 @@ WebInspector.reset = function() delete this.mainResource; this.console.clearMessages(); + this.extensionServer.notifyInspectorReset(); } WebInspector.resetProfilesPanel = function() @@ -1442,6 +1447,7 @@ WebInspector.bringToFront = function() WebInspector.inspectedURLChanged = function(url) { InspectorFrontendHost.inspectedURLChanged(url); + this.extensionServer.notifyInspectedURLChanged(); } WebInspector.resourceURLChanged = function(resource, oldURL) @@ -1454,6 +1460,7 @@ WebInspector.didCommitLoad = function() { // Cleanup elements panel early on inspected page refresh. WebInspector.setDocument(null); + this.extensionServer.notifyInspectedPageLoaded(); } WebInspector.updateConsoleMessageExpiredCount = function(count) diff --git a/WebCore/loader/EmptyClients.h b/WebCore/loader/EmptyClients.h index aab30fc..8043b21 100644 --- a/WebCore/loader/EmptyClients.h +++ b/WebCore/loader/EmptyClients.h @@ -1,6 +1,7 @@ /* * Copyright (C) 2006 Eric Seidel (eric@webkit.org) * Copyright (C) 2008, 2009, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -28,8 +29,8 @@ #define EmptyClients_h #include "ChromeClient.h" -#include "ContextMenuClient.h" #include "Console.h" +#include "ContextMenuClient.h" #include "DocumentLoader.h" #include "DragClient.h" #include "EditCommand.h" @@ -39,7 +40,13 @@ #include "FrameLoaderClient.h" #include "InspectorClient.h" #include "PluginHalterClient.h" +#include "PopupMenu.h" #include "ResourceError.h" +#include "SearchPopupMenu.h" + +#if USE(GLES2_RENDERING) +#include "GLES2Context.h" +#endif /* This file holds empty Client stubs for use by WebCore. @@ -56,6 +63,25 @@ namespace WebCore { +class EmptyPopupMenu : public PopupMenu { +public: + virtual void show(const IntRect&, FrameView*, int) {} + virtual void hide() {} + virtual void updateFromElement() {} + virtual void disconnectClient() {} +}; + +class EmptySearchPopupMenu : public SearchPopupMenu { +public: + virtual PopupMenu* popupMenu() { return m_popup.get(); } + virtual void saveRecentSearches(const AtomicString&, const Vector<String>&) {} + virtual void loadRecentSearches(const AtomicString&, Vector<String>&) {} + virtual bool enabled() { return false; } + +private: + RefPtr<EmptyPopupMenu> m_popup; +}; + class EmptyChromeClient : public ChromeClient { public: virtual ~EmptyChromeClient() { } @@ -112,6 +138,10 @@ public: virtual bool runJavaScriptPrompt(Frame*, const String&, const String&, String&) { return false; } virtual bool shouldInterruptJavaScript() { return false; } + virtual bool selectItemWritingDirectionIsNatural() { return false; } + virtual PassRefPtr<PopupMenu> createPopupMenu(PopupMenuClient*) const { return adoptRef(new EmptyPopupMenu()); } + virtual PassRefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const { return adoptRef(new EmptySearchPopupMenu()); } + virtual void setStatusbarText(const String&) { } virtual bool tabsToLinks() const { return false; } @@ -141,6 +171,7 @@ public: #if ENABLE(OFFLINE_WEB_APPLICATIONS) virtual void reachedMaxAppCacheSize(int64_t) { } + virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*) { } #endif #if ENABLE(NOTIFICATIONS) @@ -170,6 +201,11 @@ public: virtual void scheduleCompositingLayerSync() {}; #endif +#if USE(GLES2_RENDERING) + virtual PassOwnPtr<GLES2Context> getOnscreenGLES2Context() { return 0; } + virtual PassOwnPtr<GLES2Context> getOffscreenGLES2Context() { return 0; } +#endif + #if PLATFORM(WIN) virtual void setLastSetCursorToCurrentCursor() { } #endif diff --git a/WebCore/loader/HistoryController.cpp b/WebCore/loader/HistoryController.cpp index 5ccdf72..144faa5 100644 --- a/WebCore/loader/HistoryController.cpp +++ b/WebCore/loader/HistoryController.cpp @@ -48,8 +48,22 @@ #include "Settings.h" #include <wtf/text/CString.h> +#if USE(PLATFORM_STRATEGIES) +#include "PlatformStrategies.h" +#include "VisitedLinkStrategy.h" +#endif + namespace WebCore { +static inline void addVisitedLink(Page* page, const KURL& url) +{ +#if USE(PLATFORM_STRATEGIES) + platformStrategies()->visitedLinkStrategy()->addVisitedLink(page, visitedLinkHash(url.string().characters(), url.string().length())); +#else + page->group().addVisitedLink(url); +#endif +} + HistoryController::HistoryController(Frame* frame) : m_frame(frame) { @@ -290,7 +304,7 @@ void HistoryController::updateForStandardLoad(HistoryUpdateType updateType) if (!historyURL.isEmpty() && !needPrivacy) { if (Page* page = m_frame->page()) - page->group().addVisitedLink(historyURL); + addVisitedLink(page, historyURL); if (!frameLoader->documentLoader()->didCreateGlobalHistoryEntry() && frameLoader->documentLoader()->unreachableURL().isEmpty() && !frameLoader->url().isEmpty()) frameLoader->client()->updateGlobalHistoryRedirectLinks(); @@ -334,7 +348,7 @@ void HistoryController::updateForRedirectWithLockedBackForwardList() if (!historyURL.isEmpty() && !needPrivacy) { if (Page* page = m_frame->page()) - page->group().addVisitedLink(historyURL); + addVisitedLink(page, historyURL); if (!m_frame->loader()->documentLoader()->didCreateGlobalHistoryEntry() && m_frame->loader()->documentLoader()->unreachableURL().isEmpty() && !m_frame->loader()->url().isEmpty()) m_frame->loader()->client()->updateGlobalHistoryRedirectLinks(); @@ -361,7 +375,7 @@ void HistoryController::updateForClientRedirect() if (!historyURL.isEmpty() && !needPrivacy) { if (Page* page = m_frame->page()) - page->group().addVisitedLink(historyURL); + addVisitedLink(page, historyURL); } } @@ -399,7 +413,7 @@ void HistoryController::updateForSameDocumentNavigation() if (!page) return; - page->group().addVisitedLink(m_frame->loader()->url()); + addVisitedLink(page, m_frame->loader()->url()); } void HistoryController::updateForFrameLoadCompleted() @@ -619,9 +633,9 @@ void HistoryController::updateBackForwardListClippedAtTarget(bool doClip) frameLoader->checkDidPerformFirstNavigation(); - RefPtr<HistoryItem> item = frameLoader->history()->createItemTree(m_frame, doClip); - LOG(BackForward, "WebCoreBackForward - Adding backforward item %p for frame %s", item.get(), m_frame->loader()->documentLoader()->url().string().ascii().data()); - page->backForwardList()->addItem(item); + RefPtr<HistoryItem> topItem = frameLoader->history()->createItemTree(m_frame, doClip); + LOG(BackForward, "WebCoreBackForward - Adding backforward item %p for frame %s", topItem.get(), m_frame->loader()->documentLoader()->url().string().ascii().data()); + page->backForwardList()->addItem(topItem.release()); } void HistoryController::pushState(PassRefPtr<SerializedScriptValue> stateObject, const String& title, const String& urlString) @@ -633,15 +647,21 @@ void HistoryController::pushState(PassRefPtr<SerializedScriptValue> stateObject, ASSERT(page); // Get a HistoryItem tree for the current frame tree. - RefPtr<HistoryItem> item = createItemTree(m_frame, false); - ASSERT(item->isTargetItem()); + RefPtr<HistoryItem> topItem = page->mainFrame()->loader()->history()->createItemTree(m_frame, false); - // Override data in the target item to reflect the pushState() arguments. - item->setTitle(title); - item->setStateObject(stateObject); - item->setURLString(urlString); + // Override data in the current item (created by createItemTree) to reflect + // the pushState() arguments. + m_currentItem->setTitle(title); + m_currentItem->setStateObject(stateObject); + m_currentItem->setURLString(urlString); + + // Create a null state object for the previous HistoryItem so that we will + // generate a popstate event when navigating back to it. + // FIXME: http://webkit.org/b/41372 implies that we shouldn't need this. + if (!m_previousItem->stateObject()) + m_previousItem->setStateObject(SerializedScriptValue::create()); - page->backForwardList()->pushStateItem(item.release()); + page->backForwardList()->addItem(topItem.release()); } void HistoryController::replaceState(PassRefPtr<SerializedScriptValue> stateObject, const String& title, const String& urlString) diff --git a/WebCore/loader/SubframeLoader.cpp b/WebCore/loader/SubframeLoader.cpp index 2821a50..e7dafa1 100644 --- a/WebCore/loader/SubframeLoader.cpp +++ b/WebCore/loader/SubframeLoader.cpp @@ -226,7 +226,9 @@ PassRefPtr<Widget> SubframeLoader::createJavaAppletWidget(const IntSize& size, H baseURLString = m_frame->document()->baseURL().string(); KURL baseURL = completeURL(baseURLString); - RefPtr<Widget> widget = m_frame->loader()->client()->createJavaAppletWidget(size, element, baseURL, paramNames, paramValues); + RefPtr<Widget> widget; + if (allowPlugins(AboutToInstantiatePlugin)) + widget = m_frame->loader()->client()->createJavaAppletWidget(size, element, baseURL, paramNames, paramValues); if (!widget) return 0; diff --git a/WebCore/loader/appcache/ApplicationCache.h b/WebCore/loader/appcache/ApplicationCache.h index 08e2dd3..d6e15ed 100644 --- a/WebCore/loader/appcache/ApplicationCache.h +++ b/WebCore/loader/appcache/ApplicationCache.h @@ -41,7 +41,6 @@ class ApplicationCacheGroup; class ApplicationCacheResource; class DocumentLoader; class KURL; - class ResourceRequest; typedef Vector<std::pair<KURL, KURL> > FallbackURLVector; diff --git a/WebCore/loader/appcache/ApplicationCacheGroup.cpp b/WebCore/loader/appcache/ApplicationCacheGroup.cpp index 9b05e0d..395d9ad 100644 --- a/WebCore/loader/appcache/ApplicationCacheGroup.cpp +++ b/WebCore/loader/appcache/ApplicationCacheGroup.cpp @@ -42,6 +42,7 @@ #include "MainResourceLoader.h" #include "ManifestParser.h" #include "Page.h" +#include "SecurityOrigin.h" #include "Settings.h" #include <wtf/HashMap.h> @@ -57,6 +58,7 @@ namespace WebCore { ApplicationCacheGroup::ApplicationCacheGroup(const KURL& manifestURL, bool isCopy) : m_manifestURL(manifestURL) + , m_origin(SecurityOrigin::create(manifestURL)) , m_updateStatus(Idle) , m_downloadingPendingMasterResourceLoadersCount(0) , m_progressTotal(0) @@ -67,6 +69,9 @@ ApplicationCacheGroup::ApplicationCacheGroup(const KURL& manifestURL, bool isCop , m_completionType(None) , m_isCopy(isCopy) , m_calledReachedMaxAppCacheSize(false) + , m_loadedSize(0) + , m_availableSpaceInQuota(ApplicationCacheStorage::unknownQuota()) + , m_originQuotaReached(false) { } @@ -592,6 +597,8 @@ void ApplicationCacheGroup::didReceiveData(ResourceHandle* handle, const char* d ASSERT(m_currentResource); m_currentResource->data()->append(data, length); + + m_loadedSize += length; } void ApplicationCacheGroup::didFinishLoading(ResourceHandle* handle) @@ -605,7 +612,23 @@ void ApplicationCacheGroup::didFinishLoading(ResourceHandle* handle) didFinishLoadingManifest(); return; } - + + // After finishing the loading of any resource, we check if it will + // fit in our last known quota limit. + if (m_availableSpaceInQuota == ApplicationCacheStorage::unknownQuota()) { + // Failed to determine what is left in the quota. Fallback to allowing anything. + if (!cacheStorage().remainingSizeForOriginExcludingCache(m_origin.get(), m_newestCache.get(), m_availableSpaceInQuota)) + m_availableSpaceInQuota = ApplicationCacheStorage::noQuota(); + } + + // Check each resource, as it loads, to see if it would fit in our + // idea of the available quota space. + if (m_availableSpaceInQuota < m_loadedSize) { + m_currentResource = 0; + cacheUpdateFailedDueToOriginQuota(); + return; + } + ASSERT(m_currentHandle == handle); ASSERT(m_pendingEntries.contains(handle->firstRequest().url())); @@ -770,6 +793,13 @@ void ApplicationCacheGroup::didReachMaxAppCacheSize() checkIfLoadIsComplete(); } +void ApplicationCacheGroup::didReachOriginQuota(PassRefPtr<Frame> frame) +{ + // Inform the client the origin quota has been reached, + // they may decide to increase the quota. + frame->page()->chrome()->client()->reachedApplicationCacheOriginQuota(m_origin.get()); +} + void ApplicationCacheGroup::cacheUpdateFailed() { stopLoading(); @@ -779,6 +809,16 @@ void ApplicationCacheGroup::cacheUpdateFailed() m_completionType = Failure; deliverDelayedMainResources(); } + +void ApplicationCacheGroup::cacheUpdateFailedDueToOriginQuota() +{ + if (!m_originQuotaReached) { + m_originQuotaReached = true; + scheduleReachedOriginQuotaCallback(); + } + + cacheUpdateFailed(); +} void ApplicationCacheGroup::manifestNotFound() { @@ -858,10 +898,10 @@ void ApplicationCacheGroup::checkIfLoadIsComplete() ASSERT(cacheStorage().isMaximumSizeReached() && m_calledReachedMaxAppCacheSize); } + ApplicationCacheStorage::FailureReason failureReason; RefPtr<ApplicationCache> oldNewestCache = (m_newestCache == m_cacheBeingUpdated) ? 0 : m_newestCache; - setNewestCache(m_cacheBeingUpdated.release()); - if (cacheStorage().storeNewestCache(this)) { + if (cacheStorage().storeNewestCache(this, oldNewestCache.get(), failureReason)) { // New cache stored, now remove the old cache. if (oldNewestCache) cacheStorage().remove(oldNewestCache.get()); @@ -872,8 +912,18 @@ void ApplicationCacheGroup::checkIfLoadIsComplete() // Fire the success event. postListenerTask(isUpgradeAttempt ? ApplicationCacheHost::UPDATEREADY_EVENT : ApplicationCacheHost::CACHED_EVENT, m_associatedDocumentLoaders); + // It is clear that the origin quota was not reached, so clear the flag if it was set. + m_originQuotaReached = false; } else { - if (cacheStorage().isMaximumSizeReached() && !m_calledReachedMaxAppCacheSize) { + if (failureReason == ApplicationCacheStorage::OriginQuotaReached) { + // We ran out of space for this origin. Roll back to previous state. + if (oldNewestCache) + setNewestCache(oldNewestCache.release()); + cacheUpdateFailedDueToOriginQuota(); + return; + } + + if (failureReason == ApplicationCacheStorage::TotalQuotaReached && !m_calledReachedMaxAppCacheSize) { // We ran out of space. All the changes in the cache storage have // been rolled back. We roll back to the previous state in here, // as well, call the chrome client asynchronously and retry to @@ -887,30 +937,30 @@ void ApplicationCacheGroup::checkIfLoadIsComplete() } scheduleReachedMaxAppCacheSizeCallback(); return; + } + + // Run the "cache failure steps" + // Fire the error events to all pending master entries, as well any other cache hosts + // currently associated with a cache in this group. + postListenerTask(ApplicationCacheHost::ERROR_EVENT, m_associatedDocumentLoaders); + // Disassociate the pending master entries from the failed new cache. Note that + // all other loaders in the m_associatedDocumentLoaders are still associated with + // some other cache in this group. They are not associated with the failed new cache. + + // Need to copy loaders, because the cache group may be destroyed at the end of iteration. + Vector<DocumentLoader*> loaders; + copyToVector(m_pendingMasterResourceLoaders, loaders); + size_t count = loaders.size(); + for (size_t i = 0; i != count; ++i) + disassociateDocumentLoader(loaders[i]); // This can delete this group. + + // Reinstate the oldNewestCache, if there was one. + if (oldNewestCache) { + // This will discard the failed new cache. + setNewestCache(oldNewestCache.release()); } else { - // Run the "cache failure steps" - // Fire the error events to all pending master entries, as well any other cache hosts - // currently associated with a cache in this group. - postListenerTask(ApplicationCacheHost::ERROR_EVENT, m_associatedDocumentLoaders); - // Disassociate the pending master entries from the failed new cache. Note that - // all other loaders in the m_associatedDocumentLoaders are still associated with - // some other cache in this group. They are not associated with the failed new cache. - - // Need to copy loaders, because the cache group may be destroyed at the end of iteration. - Vector<DocumentLoader*> loaders; - copyToVector(m_pendingMasterResourceLoaders, loaders); - size_t count = loaders.size(); - for (size_t i = 0; i != count; ++i) - disassociateDocumentLoader(loaders[i]); // This can delete this group. - - // Reinstate the oldNewestCache, if there was one. - if (oldNewestCache) { - // This will discard the failed new cache. - setNewestCache(oldNewestCache.release()); - } else { - // We must have been deleted by the last call to disassociateDocumentLoader(). - return; - } + // We must have been deleted by the last call to disassociateDocumentLoader(). + return; } } break; @@ -922,6 +972,8 @@ void ApplicationCacheGroup::checkIfLoadIsComplete() m_completionType = None; setUpdateStatus(Idle); m_frame = 0; + m_loadedSize = 0; + m_availableSpaceInQuota = ApplicationCacheStorage::unknownQuota(); m_calledReachedMaxAppCacheSize = false; } @@ -1027,6 +1079,25 @@ private: ApplicationCacheGroup* m_cacheGroup; }; +class OriginQuotaReachedCallbackTimer: public TimerBase { +public: + OriginQuotaReachedCallbackTimer(ApplicationCacheGroup* cacheGroup, Frame* frame) + : m_cacheGroup(cacheGroup) + , m_frame(frame) + { + } + +private: + virtual void fired() + { + m_cacheGroup->didReachOriginQuota(m_frame.release()); + delete this; + } + + ApplicationCacheGroup* m_cacheGroup; + RefPtr<Frame> m_frame; +}; + void ApplicationCacheGroup::scheduleReachedMaxAppCacheSizeCallback() { ASSERT(isMainThread()); @@ -1035,6 +1106,15 @@ void ApplicationCacheGroup::scheduleReachedMaxAppCacheSizeCallback() // The timer will delete itself once it fires. } +void ApplicationCacheGroup::scheduleReachedOriginQuotaCallback() +{ + ASSERT(isMainThread()); + RefPtr<Frame> frameProtector = m_frame; + OriginQuotaReachedCallbackTimer* timer = new OriginQuotaReachedCallbackTimer(this, frameProtector.get()); + timer->startOneShot(0); + // The timer will delete itself once it fires. +} + class CallCacheListenerTask : public ScriptExecutionContext::Task { public: static PassOwnPtr<CallCacheListenerTask> create(PassRefPtr<DocumentLoader> loader, ApplicationCacheHost::EventID eventID, int progressTotal, int progressDone) diff --git a/WebCore/loader/appcache/ApplicationCacheGroup.h b/WebCore/loader/appcache/ApplicationCacheGroup.h index 9b8a6ab..b5cdf7b 100644 --- a/WebCore/loader/appcache/ApplicationCacheGroup.h +++ b/WebCore/loader/appcache/ApplicationCacheGroup.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008, 2009 Apple Inc. All Rights Reserved. + * Copyright (C) 2008, 2009, 2010 Apple Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -28,10 +28,6 @@ #if ENABLE(OFFLINE_WEB_APPLICATIONS) -#include <wtf/Noncopyable.h> -#include <wtf/HashMap.h> -#include <wtf/HashSet.h> - #include "DOMApplicationCache.h" #include "KURL.h" #include "PlatformString.h" @@ -39,6 +35,10 @@ #include "ResourceHandleClient.h" #include "SharedBuffer.h" +#include <wtf/Noncopyable.h> +#include <wtf/HashMap.h> +#include <wtf/HashSet.h> + namespace WebCore { class ApplicationCache; @@ -46,6 +46,7 @@ class ApplicationCacheResource; class Document; class DocumentLoader; class Frame; +class SecurityOrigin; enum ApplicationCacheUpdateOption { ApplicationCacheUpdateWithBrowsingContext, @@ -66,6 +67,7 @@ public: static void selectCacheWithoutManifestURL(Frame*); const KURL& manifestURL() const { return m_manifestURL; } + const SecurityOrigin* origin() const { return m_origin.get(); } UpdateStatus updateStatus() const { return m_updateStatus; } void setUpdateStatus(UpdateStatus status); @@ -98,6 +100,7 @@ private: static void postListenerTask(ApplicationCacheHost::EventID, int progressTotal, int progressDone, DocumentLoader*); void scheduleReachedMaxAppCacheSizeCallback(); + void scheduleReachedOriginQuotaCallback(); PassRefPtr<ResourceHandle> createResourceHandle(const KURL&, ApplicationCacheResource* newestCachedResource); @@ -117,11 +120,13 @@ private: void didReceiveManifestData(const char*, int); void didFinishLoadingManifest(); void didReachMaxAppCacheSize(); + void didReachOriginQuota(PassRefPtr<Frame> frame); void startLoadingEntry(); void deliverDelayedMainResources(); void checkIfLoadIsComplete(); void cacheUpdateFailed(); + void cacheUpdateFailedDueToOriginQuota(); void manifestNotFound(); void addEntry(const String&, unsigned type); @@ -131,6 +136,7 @@ private: void stopLoading(); KURL m_manifestURL; + RefPtr<SecurityOrigin> m_origin; UpdateStatus m_updateStatus; // This is the newest complete cache in the group. @@ -194,7 +200,12 @@ private: RefPtr<ApplicationCacheResource> m_manifestResource; RefPtr<ResourceHandle> m_manifestHandle; + int64_t m_loadedSize; + int64_t m_availableSpaceInQuota; + bool m_originQuotaReached; + friend class ChromeClientCallbackTimer; + friend class OriginQuotaReachedCallbackTimer; }; } // namespace WebCore diff --git a/WebCore/loader/appcache/ApplicationCacheStorage.cpp b/WebCore/loader/appcache/ApplicationCacheStorage.cpp index 9a11307..ec83911 100644 --- a/WebCore/loader/appcache/ApplicationCacheStorage.cpp +++ b/WebCore/loader/appcache/ApplicationCacheStorage.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008, 2009 Apple Inc. All Rights Reserved. + * Copyright (C) 2008, 2009, 2010 Apple Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,13 +29,14 @@ #if ENABLE(OFFLINE_WEB_APPLICATIONS) #include "ApplicationCache.h" -#include "ApplicationCacheHost.h" #include "ApplicationCacheGroup.h" +#include "ApplicationCacheHost.h" #include "ApplicationCacheResource.h" #include "FileSystem.h" #include "KURL.h" #include "SQLiteStatement.h" #include "SQLiteTransaction.h" +#include "SecurityOrigin.h" #include <wtf/text/CString.h> #include <wtf/StdLibExtras.h> #include <wtf/StringExtras.h> @@ -414,6 +415,126 @@ int64_t ApplicationCacheStorage::spaceNeeded(int64_t cacheToSave) return spaceNeeded; } +void ApplicationCacheStorage::setDefaultOriginQuota(int64_t quota) +{ + m_defaultOriginQuota = quota; +} + +bool ApplicationCacheStorage::quotaForOrigin(const SecurityOrigin* origin, int64_t& quota) +{ + // If an Origin record doesn't exist, then the COUNT will be 0 and quota will be 0. + // Using the count to determine if a record existed or not is a safe way to determine + // if a quota of 0 is real, from the record, or from null. + SQLiteStatement statement(m_database, "SELECT COUNT(quota), quota FROM Origins WHERE origin=?"); + if (statement.prepare() != SQLResultOk) + return false; + + statement.bindText(1, origin->databaseIdentifier()); + int result = statement.step(); + + // Return the quota, or if it was null the default. + if (result == SQLResultRow) { + bool wasNoRecord = statement.getColumnInt64(0) == 0; + quota = wasNoRecord ? m_defaultOriginQuota : statement.getColumnInt64(1); + return true; + } + + LOG_ERROR("Could not get the quota of an origin, error \"%s\"", m_database.lastErrorMsg()); + return false; +} + +bool ApplicationCacheStorage::usageForOrigin(const SecurityOrigin* origin, int64_t& usage) +{ + // If an Origins record doesn't exist, then the SUM will be null, + // which will become 0, as expected, when converting to a number. + SQLiteStatement statement(m_database, "SELECT SUM(Caches.size)" + " FROM CacheGroups" + " INNER JOIN Origins ON CacheGroups.origin = Origins.origin" + " INNER JOIN Caches ON CacheGroups.id = Caches.cacheGroup" + " WHERE Origins.origin=?"); + if (statement.prepare() != SQLResultOk) + return false; + + statement.bindText(1, origin->databaseIdentifier()); + int result = statement.step(); + + if (result == SQLResultRow) { + usage = statement.getColumnInt64(0); + return true; + } + + LOG_ERROR("Could not get the quota of an origin, error \"%s\"", m_database.lastErrorMsg()); + return false; +} + +bool ApplicationCacheStorage::remainingSizeForOriginExcludingCache(const SecurityOrigin* origin, ApplicationCache* cache, int64_t& remainingSize) +{ + openDatabase(false); + if (!m_database.isOpen()) + return false; + + // Remaining size = total origin quota - size of all caches with origin excluding the provided cache. + // Keep track of the number of caches so we can tell if the result was a calculation or not. + const char* query; + int64_t excludingCacheIdentifier = cache ? cache->storageID() : 0; + if (excludingCacheIdentifier != 0) { + query = "SELECT COUNT(Caches.size), Origins.quota - SUM(Caches.size)" + " FROM CacheGroups" + " INNER JOIN Origins ON CacheGroups.origin = Origins.origin" + " INNER JOIN Caches ON CacheGroups.id = Caches.cacheGroup" + " WHERE Origins.origin=?" + " AND Caches.id!=?"; + } else { + query = "SELECT COUNT(Caches.size), Origins.quota - SUM(Caches.size)" + " FROM CacheGroups" + " INNER JOIN Origins ON CacheGroups.origin = Origins.origin" + " INNER JOIN Caches ON CacheGroups.id = Caches.cacheGroup" + " WHERE Origins.origin=?"; + } + + SQLiteStatement statement(m_database, query); + if (statement.prepare() != SQLResultOk) + return false; + + statement.bindText(1, origin->databaseIdentifier()); + if (excludingCacheIdentifier != 0) + statement.bindInt64(2, excludingCacheIdentifier); + int result = statement.step(); + + // If the count was 0 that then we have to query the origin table directly + // for its quota. Otherwise we can use the calculated value. + if (result == SQLResultRow) { + int64_t numberOfCaches = statement.getColumnInt64(0); + if (numberOfCaches == 0) + quotaForOrigin(origin, remainingSize); + else + remainingSize = statement.getColumnInt64(1); + return true; + } + + LOG_ERROR("Could not get the remaining size of an origin's quota, error \"%s\"", m_database.lastErrorMsg()); + return false; +} + +bool ApplicationCacheStorage::storeUpdatedQuotaForOrigin(const SecurityOrigin* origin, int64_t quota) +{ + openDatabase(false); + if (!m_database.isOpen()) + return false; + + if (!ensureOriginRecord(origin)) + return false; + + SQLiteStatement updateStatement(m_database, "UPDATE Origins SET quota=? WHERE origin=?"); + if (updateStatement.prepare() != SQLResultOk) + return false; + + updateStatement.bindInt64(1, quota); + updateStatement.bindText(2, origin->databaseIdentifier()); + + return executeStatement(updateStatement); +} + bool ApplicationCacheStorage::executeSQLCommand(const String& sql) { ASSERT(m_database.isOpen()); @@ -426,7 +547,10 @@ bool ApplicationCacheStorage::executeSQLCommand(const String& sql) return result; } -static const int schemaVersion = 5; +// Update the schemaVersion when the schema of any the Application Cache +// SQLite tables changes. This allows the database to be rebuilt when +// a new, incompatible change has been introduced to the database schema. +static const int schemaVersion = 6; void ApplicationCacheStorage::verifySchemaVersion() { @@ -475,7 +599,7 @@ void ApplicationCacheStorage::openDatabase(bool createIfDoesNotExist) // Create tables executeSQLCommand("CREATE TABLE IF NOT EXISTS CacheGroups (id INTEGER PRIMARY KEY AUTOINCREMENT, " - "manifestHostHash INTEGER NOT NULL ON CONFLICT FAIL, manifestURL TEXT UNIQUE ON CONFLICT FAIL, newestCache INTEGER)"); + "manifestHostHash INTEGER NOT NULL ON CONFLICT FAIL, manifestURL TEXT UNIQUE ON CONFLICT FAIL, newestCache INTEGER, origin TEXT)"); executeSQLCommand("CREATE TABLE IF NOT EXISTS Caches (id INTEGER PRIMARY KEY AUTOINCREMENT, cacheGroup INTEGER, size INTEGER)"); executeSQLCommand("CREATE TABLE IF NOT EXISTS CacheWhitelistURLs (url TEXT NOT NULL ON CONFLICT FAIL, cache INTEGER NOT NULL ON CONFLICT FAIL)"); executeSQLCommand("CREATE TABLE IF NOT EXISTS CacheAllowsAllNetworkRequests (wildcard INTEGER NOT NULL ON CONFLICT FAIL, cache INTEGER NOT NULL ON CONFLICT FAIL)"); @@ -485,6 +609,7 @@ void ApplicationCacheStorage::openDatabase(bool createIfDoesNotExist) executeSQLCommand("CREATE TABLE IF NOT EXISTS CacheResources (id INTEGER PRIMARY KEY AUTOINCREMENT, url TEXT NOT NULL ON CONFLICT FAIL, " "statusCode INTEGER NOT NULL, responseURL TEXT NOT NULL, mimeType TEXT, textEncodingName TEXT, headers TEXT, data INTEGER NOT NULL ON CONFLICT FAIL)"); executeSQLCommand("CREATE TABLE IF NOT EXISTS CacheResourceData (id INTEGER PRIMARY KEY AUTOINCREMENT, data BLOB)"); + executeSQLCommand("CREATE TABLE IF NOT EXISTS Origins (origin TEXT UNIQUE ON CONFLICT IGNORE, quota INTEGER NOT NULL ON CONFLICT FAIL)"); // When a cache is deleted, all its entries and its whitelist should be deleted. executeSQLCommand("CREATE TRIGGER IF NOT EXISTS CacheDeleted AFTER DELETE ON Caches" @@ -523,16 +648,20 @@ bool ApplicationCacheStorage::store(ApplicationCacheGroup* group, GroupStorageID ASSERT(group->storageID() == 0); ASSERT(journal); - SQLiteStatement statement(m_database, "INSERT INTO CacheGroups (manifestHostHash, manifestURL) VALUES (?, ?)"); + SQLiteStatement statement(m_database, "INSERT INTO CacheGroups (manifestHostHash, manifestURL, origin) VALUES (?, ?, ?)"); if (statement.prepare() != SQLResultOk) return false; statement.bindInt64(1, urlHostHash(group->manifestURL())); statement.bindText(2, group->manifestURL()); + statement.bindText(3, group->origin()->databaseIdentifier()); if (!executeStatement(statement)) return false; + if (!ensureOriginRecord(group->origin())) + return false; + group->setStorageID(static_cast<unsigned>(m_database.lastInsertRowID())); journal->add(group, 0); return true; @@ -745,7 +874,21 @@ bool ApplicationCacheStorage::store(ApplicationCacheResource* resource, Applicat return true; } -bool ApplicationCacheStorage::storeNewestCache(ApplicationCacheGroup* group) +bool ApplicationCacheStorage::ensureOriginRecord(const SecurityOrigin* origin) +{ + SQLiteStatement insertOriginStatement(m_database, "INSERT INTO Origins (origin, quota) VALUES (?, ?)"); + if (insertOriginStatement.prepare() != SQLResultOk) + return false; + + insertOriginStatement.bindText(1, origin->databaseIdentifier()); + insertOriginStatement.bindInt64(2, m_defaultOriginQuota); + if (!executeStatement(insertOriginStatement)) + return false; + + return true; +} + +bool ApplicationCacheStorage::storeNewestCache(ApplicationCacheGroup* group, ApplicationCache* oldCache, FailureReason& failureReason) { openDatabase(true); @@ -759,11 +902,21 @@ bool ApplicationCacheStorage::storeNewestCache(ApplicationCacheGroup* group) storeCacheTransaction.begin(); + // Check if this would reach the per-origin quota. + int64_t remainingSpaceInOrigin; + if (remainingSizeForOriginExcludingCache(group->origin(), oldCache, remainingSpaceInOrigin)) { + if (remainingSpaceInOrigin < group->newestCache()->estimatedSizeInStorage()) { + failureReason = OriginQuotaReached; + return false; + } + } + GroupStorageIDJournal groupStorageIDJournal; if (!group->storageID()) { // Store the group if (!store(group, &groupStorageIDJournal)) { checkForMaxSizeReached(); + failureReason = isMaximumSizeReached() ? TotalQuotaReached : DiskOrOperationFailure; return false; } } @@ -780,20 +933,25 @@ bool ApplicationCacheStorage::storeNewestCache(ApplicationCacheGroup* group) // Store the newest cache if (!store(group->newestCache(), &resourceStorageIDJournal)) { checkForMaxSizeReached(); + failureReason = isMaximumSizeReached() ? TotalQuotaReached : DiskOrOperationFailure; return false; } // Update the newest cache in the group. SQLiteStatement statement(m_database, "UPDATE CacheGroups SET newestCache=? WHERE id=?"); - if (statement.prepare() != SQLResultOk) + if (statement.prepare() != SQLResultOk) { + failureReason = DiskOrOperationFailure; return false; + } statement.bindInt64(1, group->newestCache()->storageID()); statement.bindInt64(2, group->storageID()); - if (!executeStatement(statement)) + if (!executeStatement(statement)) { + failureReason = DiskOrOperationFailure; return false; + } groupStorageIDJournal.commit(); resourceStorageIDJournal.commit(); @@ -801,6 +959,13 @@ bool ApplicationCacheStorage::storeNewestCache(ApplicationCacheGroup* group) return true; } +bool ApplicationCacheStorage::storeNewestCache(ApplicationCacheGroup* group) +{ + // Ignore the reason for failing, just attempt the store. + FailureReason ignoredFailureReason; + return storeNewestCache(group, 0, ignoredFailureReason); +} + static inline void parseHeader(const UChar* header, size_t headerLength, ResourceResponse& response) { int pos = find(header, headerLength, ':'); @@ -964,9 +1129,10 @@ void ApplicationCacheStorage::empty() if (!m_database.isOpen()) return; - // Clear cache groups, caches and cache resources. + // Clear cache groups, caches, cache resources, and origins. executeSQLCommand("DELETE FROM CacheGroups"); executeSQLCommand("DELETE FROM Caches"); + executeSQLCommand("DELETE FROM Origins"); // Clear the storage IDs for the caches in memory. // The caches will still work, but cached resources will not be saved to disk @@ -1120,8 +1286,9 @@ void ApplicationCacheStorage::checkForMaxSizeReached() } ApplicationCacheStorage::ApplicationCacheStorage() - : m_maximumSize(INT_MAX) + : m_maximumSize(ApplicationCacheStorage::noQuota()) , m_isMaximumSizeReached(false) + , m_defaultOriginQuota(ApplicationCacheStorage::noQuota()) { } diff --git a/WebCore/loader/appcache/ApplicationCacheStorage.h b/WebCore/loader/appcache/ApplicationCacheStorage.h index aaa5c9c..c990fa7 100644 --- a/WebCore/loader/appcache/ApplicationCacheStorage.h +++ b/WebCore/loader/appcache/ApplicationCacheStorage.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Apple Inc. All Rights Reserved. + * Copyright (C) 2008, 2010 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,15 +37,22 @@ namespace WebCore { class ApplicationCache; -class ApplicationCacheHost; class ApplicationCacheGroup; +class ApplicationCacheHost; class ApplicationCacheResource; class KURL; template <class T> class StorageIDJournal; +class SecurityOrigin; class ApplicationCacheStorage : public Noncopyable { public: + enum FailureReason { + OriginQuotaReached, + TotalQuotaReached, + DiskOrOperationFailure + }; + void setCacheDirectory(const String&); const String& cacheDirectory() const; @@ -54,6 +61,13 @@ public: bool isMaximumSizeReached() const; int64_t spaceNeeded(int64_t cacheToSave); + int64_t defaultOriginQuota() const { return m_defaultOriginQuota; } + void setDefaultOriginQuota(int64_t quota); + bool usageForOrigin(const SecurityOrigin*, int64_t& usage); + bool quotaForOrigin(const SecurityOrigin*, int64_t& quota); + bool remainingSizeForOriginExcludingCache(const SecurityOrigin*, ApplicationCache*, int64_t& remainingSize); + bool storeUpdatedQuotaForOrigin(const SecurityOrigin*, int64_t quota); + ApplicationCacheGroup* cacheGroupForURL(const KURL&); // Cache to load a main resource from. ApplicationCacheGroup* fallbackCacheGroupForURL(const KURL&); // Cache that has a fallback entry to load a main resource from if normal loading fails. @@ -61,6 +75,7 @@ public: void cacheGroupDestroyed(ApplicationCacheGroup*); void cacheGroupMadeObsolete(ApplicationCacheGroup*); + bool storeNewestCache(ApplicationCacheGroup*, ApplicationCache* oldCache, FailureReason& failureReason); bool storeNewestCache(ApplicationCacheGroup*); // Updates the cache group, but doesn't remove old cache. bool store(ApplicationCacheResource*, ApplicationCache*); bool storeUpdatedType(ApplicationCacheResource*, ApplicationCache*); @@ -76,6 +91,9 @@ public: bool cacheGroupSize(const String& manifestURL, int64_t* size); bool deleteCacheGroup(const String& manifestURL); void vacuumDatabaseFile(); + + static int64_t unknownQuota() { return -1; } + static int64_t noQuota() { return std::numeric_limits<int64_t>::max(); } private: ApplicationCacheStorage(); PassRefPtr<ApplicationCache> loadCache(unsigned storageID); @@ -88,6 +106,8 @@ private: bool store(ApplicationCache*, ResourceStorageIDJournal*); bool store(ApplicationCacheResource*, unsigned cacheStorageID); + bool ensureOriginRecord(const SecurityOrigin*); + void loadManifestHostHashes(); void verifySchemaVersion(); @@ -105,6 +125,8 @@ private: int64_t m_maximumSize; bool m_isMaximumSizeReached; + int64_t m_defaultOriginQuota; + SQLiteDatabase m_database; // In order to quickly determine if a given resource exists in an application cache, diff --git a/WebCore/manual-tests/compositing/assert-on-tab-switch.html b/WebCore/manual-tests/compositing/assert-on-tab-switch.html new file mode 100644 index 0000000..5b82c49 --- /dev/null +++ b/WebCore/manual-tests/compositing/assert-on-tab-switch.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> + +<html> +<head> + <style type="text/css" media="screen"> + .box { + width: 100px; + height: 100px; + background-color: blue; + -webkit-transform: translateZ(0); + } + + </style> +</head> +<body> + <div class="box"></div> + <p><a href="https://bugs.webkit.org/show_bug.cgi?id=43167">https://bugs.webkit.org/show_bug.cgi?id=43167</a><br> + You should not hit an assertion if you load this file in a tab, then switch back and forth between other tabs.</p> +</body> +</html> diff --git a/WebCore/manual-tests/compositing/missing-iframe-contents.html b/WebCore/manual-tests/compositing/missing-iframe-contents.html new file mode 100644 index 0000000..d769e43 --- /dev/null +++ b/WebCore/manual-tests/compositing/missing-iframe-contents.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> + +<html> +<head> + <style type="text/css" media="screen"> + iframe { + border: 10px solid black; + padding: 5px; + margin: 20px; + height: 150px; + width: 300px; + -webkit-box-shadow: 0 0 20px black; + -webkit-transform: translateZ(0); + } + + </style> + <script type="text/javascript" charset="utf-8"> + function doTest() + { + document.getElementById('iframe').className = 'dummy'; + } + + window.addEventListener('load', doTest, false); + </script> +</head> +<body> + + <iframe id="iframe" src="resources/composited-subframe.html"></iframe> + + <p><a href="https://bugs.webkit.org/show_bug.cgi?id=42046">https://bugs.webkit.org/show_bug.cgi?id=42046</a><br> + You should see a blue rectangle inside the iframe when the page loads.</p> +</body> +</html> diff --git a/WebCore/manual-tests/compositing/resources/composited-subframe.html b/WebCore/manual-tests/compositing/resources/composited-subframe.html new file mode 100644 index 0000000..4a4f53e --- /dev/null +++ b/WebCore/manual-tests/compositing/resources/composited-subframe.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> + +<html> +<head> + <style type="text/css" media="screen"> + body { background-color:silver } + + .box { + height: 200px; + width: 200px; + margin: 10px; + padding: 5px; + background-color: blue; + -webkit-transform: translateZ(0); + overflow:hidden; + } + .box:hover { + -webkit-transform: none; + } + </style> +</head> +<body> + + <div id="iframe-content" class="box"> + </div> + +</body> +</html> diff --git a/WebCore/page/Chrome.cpp b/WebCore/page/Chrome.cpp index 0c66925..bff0100 100644 --- a/WebCore/page/Chrome.cpp +++ b/WebCore/page/Chrome.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. - * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2008, 2010 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 @@ -482,5 +482,19 @@ bool ChromeClient::paintCustomScrollCorner(GraphicsContext*, const FloatRect&) return false; } +bool Chrome::selectItemWritingDirectionIsNatural() +{ + return m_client->selectItemWritingDirectionIsNatural(); +} + +PassRefPtr<PopupMenu> Chrome::createPopupMenu(PopupMenuClient* client) const +{ + return m_client->createPopupMenu(client); +} + +PassRefPtr<SearchPopupMenu> Chrome::createSearchPopupMenu(PopupMenuClient* client) const +{ + return m_client->createSearchPopupMenu(client); +} } // namespace WebCore diff --git a/WebCore/page/Chrome.h b/WebCore/page/Chrome.h index 537468a..30edf28 100644 --- a/WebCore/page/Chrome.h +++ b/WebCore/page/Chrome.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2010 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 @@ -24,6 +25,8 @@ #include "FileChooser.h" #include "FocusDirection.h" #include "HostWindow.h" +#include "PopupMenu.h" +#include "SearchPopupMenu.h" #include <wtf/Forward.h> #include <wtf/RefPtr.h> @@ -44,6 +47,7 @@ namespace WebCore { class IntRect; class Node; class Page; + class PopupMenuClient; class String; #if ENABLE(NOTIFICATIONS) class NotificationPresenter; @@ -144,6 +148,10 @@ namespace WebCore { NotificationPresenter* notificationPresenter() const; #endif + bool selectItemWritingDirectionIsNatural(); + PassRefPtr<PopupMenu> createPopupMenu(PopupMenuClient*) const; + PassRefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const; + private: Page* m_page; ChromeClient* m_client; diff --git a/WebCore/page/ChromeClient.h b/WebCore/page/ChromeClient.h index 1b2d1cc..f90e01e 100644 --- a/WebCore/page/ChromeClient.h +++ b/WebCore/page/ChromeClient.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2006, 2007, 2008, 2009 Apple, Inc. All rights reserved. + * Copyright (C) 2010 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 @@ -26,7 +27,10 @@ #include "GraphicsContext.h" #include "HTMLParserQuirks.h" #include "HostWindow.h" +#include "PopupMenu.h" +#include "PopupMenuClient.h" #include "ScrollTypes.h" +#include "SearchPopupMenu.h" #include <wtf/Forward.h> #include <wtf/PassOwnPtr.h> #include <wtf/Vector.h> @@ -53,6 +57,8 @@ namespace WebCore { class IntRect; class Node; class Page; + class SecurityOrigin; + class PopupMenuClient; class String; class Widget; @@ -64,6 +70,10 @@ namespace WebCore { class GraphicsLayer; #endif +#if USE(GLES2_RENDERING) + class GLES2Context; +#endif + #if ENABLE(NOTIFICATIONS) class NotificationPresenter; #endif @@ -163,6 +173,13 @@ namespace WebCore { // The chrome client would need to take some action such as evicting some // old caches. virtual void reachedMaxAppCacheSize(int64_t spaceNeeded) = 0; + + // Callback invoked when the application cache origin quota is reached. This + // means that the resources attempting to be cached via the manifest are + // more than allowed on this origin. This callback allows the chrome client + // to take action, such as prompting the user to ask to increase the quota + // for this origin. + virtual void reachedApplicationCacheOriginQuota(SecurityOrigin* origin) = 0; #endif #if ENABLE(DASHBOARD_SUPPORT) @@ -219,6 +236,12 @@ namespace WebCore { virtual bool allowsAcceleratedCompositing() const { return true; } #endif +#if USE(GLES2_RENDERING) + // Request a GL ES 2 context to use for compositing this page's content. + virtual PassOwnPtr<GLES2Context> getOnscreenGLES2Context() = 0; + virtual PassOwnPtr<GLES2Context> getOffscreenGLES2Context() = 0; +#endif + virtual bool supportsFullscreenForNode(const Node*) { return false; } virtual void enterFullscreenForNode(Node*) { } virtual void exitFullscreenForNode(Node*) { } @@ -244,13 +267,9 @@ namespace WebCore { virtual void needTouchEvents(bool) = 0; #endif -#if ENABLE(WIDGETS_10_SUPPORT) - virtual bool isWindowed() { return false; } - virtual bool isFloating() { return false; } - virtual bool isFullscreen() { return false; } - virtual bool isMaximized() { return false; } - virtual bool isMinimized() { return false; } -#endif + virtual bool selectItemWritingDirectionIsNatural() = 0; + virtual PassRefPtr<PopupMenu> createPopupMenu(PopupMenuClient*) const = 0; + virtual PassRefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const = 0; #if ENABLE(ANDROID_INSTALLABLE_WEB_APPS) virtual void webAppCanBeInstalled() = 0; diff --git a/WebCore/page/DOMWindow.cpp b/WebCore/page/DOMWindow.cpp index a369a32..526e824 100644 --- a/WebCore/page/DOMWindow.cpp +++ b/WebCore/page/DOMWindow.cpp @@ -38,6 +38,7 @@ #include "DocumentLoader.h" #include "DOMApplicationCache.h" #include "DOMSelection.h" +#include "DOMStringList.h" #include "DOMTimer.h" #include "Database.h" #include "DatabaseCallback.h" @@ -56,9 +57,9 @@ #include "FrameView.h" #include "HTMLFrameOwnerElement.h" #include "History.h" +#include "IDBFactory.h" +#include "IDBFactoryBackendInterface.h" #include "IDBKeyRange.h" -#include "IndexedDatabase.h" -#include "IndexedDatabaseRequest.h" #include "InspectorController.h" #include "InspectorTimelineAgent.h" #include "Location.h" @@ -484,8 +485,8 @@ void DOMWindow::clear() #endif #if ENABLE(INDEXED_DATABASE) - m_idb_key_range = 0; - m_indexedDatabaseRequest = 0; + m_idbFactory = 0; + m_idbKeyRange = 0; #endif } @@ -687,10 +688,10 @@ void DOMWindow::pageDestroyed() } #if ENABLE(INDEXED_DATABASE) -IndexedDatabaseRequest* DOMWindow::indexedDB() const +IDBFactory* DOMWindow::indexedDB() const { - if (m_indexedDatabaseRequest) - return m_indexedDatabaseRequest.get(); + if (m_idbFactory) + return m_idbFactory.get(); Document* document = this->document(); if (!document) @@ -704,16 +705,16 @@ IndexedDatabaseRequest* DOMWindow::indexedDB() const // FIXME: See if indexedDatabase access is allowed. - m_indexedDatabaseRequest = IndexedDatabaseRequest::create(page->group().indexedDatabase()); - return m_indexedDatabaseRequest.get(); + m_idbFactory = IDBFactory::create(page->group().idbFactory()); + return m_idbFactory.get(); } IDBKeyRange* DOMWindow::iDBKeyRange() const { - if (!m_idb_key_range) - m_idb_key_range = IDBKeyRange::create(0, 0, 0); + if (!m_idbKeyRange) + m_idbKeyRange = IDBKeyRange::create(0, 0, 0); - return m_idb_key_range.get(); + return m_idbKeyRange.get(); } #endif diff --git a/WebCore/page/DOMWindow.h b/WebCore/page/DOMWindow.h index 7a13651..51d407c 100644 --- a/WebCore/page/DOMWindow.h +++ b/WebCore/page/DOMWindow.h @@ -53,8 +53,8 @@ namespace WebCore { class FloatRect; class Frame; class History; + class IDBFactory; class IDBKeyRange; - class IndexedDatabaseRequest; class InspectorTimelineAgent; class Location; class StyleMedia; @@ -232,8 +232,8 @@ namespace WebCore { void pageDestroyed(); #if ENABLE(INDEXED_DATABASE) + IDBFactory* indexedDB() const; IDBKeyRange* iDBKeyRange() const; - IndexedDatabaseRequest* indexedDB() const; #endif void postMessage(PassRefPtr<SerializedScriptValue> message, const MessagePortArray*, const String& targetOrigin, DOMWindow* source, ExceptionCode&); @@ -424,8 +424,8 @@ namespace WebCore { mutable RefPtr<NotificationCenter> m_notifications; #endif #if ENABLE(INDEXED_DATABASE) - mutable RefPtr<IDBKeyRange> m_idb_key_range; - mutable RefPtr<IndexedDatabaseRequest> m_indexedDatabaseRequest; + mutable RefPtr<IDBFactory> m_idbFactory; + mutable RefPtr<IDBKeyRange> m_idbKeyRange; #endif EventTargetData m_eventTargetData; diff --git a/WebCore/page/DOMWindow.idl b/WebCore/page/DOMWindow.idl index 74e7504..c024460 100644 --- a/WebCore/page/DOMWindow.idl +++ b/WebCore/page/DOMWindow.idl @@ -173,7 +173,7 @@ module window { readonly attribute [EnabledAtRuntime] NotificationCenter webkitNotifications; #endif #if defined(ENABLE_INDEXED_DATABASE) && ENABLE_INDEXED_DATABASE - readonly attribute [EnabledAtRuntime] IndexedDatabaseRequest indexedDB; + readonly attribute [EnabledAtRuntime] IDBFactory indexedDB; readonly attribute [EnabledAtRuntime] IDBKeyRange IDBKeyRange; #endif diff --git a/WebCore/page/EventHandler.cpp b/WebCore/page/EventHandler.cpp index 9816814..8f213c6 100644 --- a/WebCore/page/EventHandler.cpp +++ b/WebCore/page/EventHandler.cpp @@ -870,6 +870,7 @@ void EventHandler::allowDHTMLDrag(bool& flagDHTML, bool& flagUA) const } #endif // ENABLE(DRAG_SUPPORT) +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE HitTestResult EventHandler::hitTestResultAtPoint(const IntPoint& point, bool allowShadowContent, bool ignoreClipping, HitTestScrollbars testScrollbars, HitTestRequest::HitTestRequestType hitType, const IntSize& pointPadding) #else @@ -881,6 +882,11 @@ HitTestResult EventHandler::hitTestResultAtPoint(const IntPoint& point, bool all #else HitTestResult result(point); #endif +======= +HitTestResult EventHandler::hitTestResultAtPoint(const IntPoint& point, bool allowShadowContent, bool ignoreClipping, HitTestScrollbars testScrollbars, HitTestRequest::HitTestRequestType hitType, const IntSize& padding) +{ + HitTestResult result(point, padding); +>>>>>>> webkit.org at r64523 if (!m_frame->contentRenderer()) return result; if (ignoreClipping) @@ -901,11 +907,15 @@ HitTestResult EventHandler::hitTestResultAtPoint(const IntPoint& point, bool all FrameView* view = static_cast<FrameView*>(widget); IntPoint widgetPoint(result.localPoint().x() + view->scrollX() - renderWidget->borderLeft() - renderWidget->paddingLeft(), result.localPoint().y() + view->scrollY() - renderWidget->borderTop() - renderWidget->paddingTop()); +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE HitTestResult widgetHitTestResult(widgetPoint, pointPadding); #else HitTestResult widgetHitTestResult(widgetPoint); #endif +======= + HitTestResult widgetHitTestResult(widgetPoint, padding); +>>>>>>> webkit.org at r64523 frame->contentRenderer()->layer()->hitTest(HitTestRequest(hitType), widgetHitTestResult); result = widgetHitTestResult; @@ -927,7 +937,7 @@ HitTestResult EventHandler::hitTestResultAtPoint(const IntPoint& point, bool all if (resultView && mainView) { IntPoint windowPoint = resultView->contentsToWindow(result.point()); IntPoint mainFramePoint = mainView->windowToContents(windowPoint); - result = mainFrame->eventHandler()->hitTestResultAtPoint(mainFramePoint, allowShadowContent, ignoreClipping); + result = mainFrame->eventHandler()->hitTestResultAtPoint(mainFramePoint, allowShadowContent, ignoreClipping, testScrollbars, hitType, padding); } } } diff --git a/WebCore/page/EventHandler.h b/WebCore/page/EventHandler.h index 6a5ef4c..34b7e28 100644 --- a/WebCore/page/EventHandler.h +++ b/WebCore/page/EventHandler.h @@ -106,11 +106,18 @@ public: void dispatchFakeMouseMoveEventSoonInQuad(const FloatQuad&); +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE HitTestResult hitTestResultAtPoint(const IntPoint&, bool allowShadowContent, bool ignoreClipping = false, HitTestScrollbars scrollbars = DontHitTestScrollbars, HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active, const IntSize& pointPadding = IntSize()); #else HitTestResult hitTestResultAtPoint(const IntPoint&, bool allowShadowContent, bool ignoreClipping = false, HitTestScrollbars scrollbars = DontHitTestScrollbars, HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active); #endif +======= + HitTestResult hitTestResultAtPoint(const IntPoint&, bool allowShadowContent, bool ignoreClipping = false, + HitTestScrollbars scrollbars = DontHitTestScrollbars, + HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active, + const IntSize& padding = IntSize()); +>>>>>>> webkit.org at r64523 bool mousePressed() const { return m_mousePressed; } void setMousePressed(bool pressed) { m_mousePressed = pressed; } diff --git a/WebCore/page/Frame.cpp b/WebCore/page/Frame.cpp index 77bf071..c0b11d3 100644 --- a/WebCore/page/Frame.cpp +++ b/WebCore/page/Frame.cpp @@ -621,16 +621,16 @@ void Frame::paintDragCaret(GraphicsContext* p, int tx, int ty, const IntRect& cl #endif } -void Frame::setPrinting(bool printing, float minPageWidth, float maxPageWidth, bool adjustViewSize) +void Frame::setPrinting(bool printing, const FloatSize& pageSize, float maximumShrinkRatio, AdjustViewSizeOrNot shouldAdjustViewSize) { m_doc->setPrinting(printing); view()->adjustMediaTypeForPrinting(printing); m_doc->updateStyleSelector(); - view()->forceLayoutWithPageWidthRange(minPageWidth, maxPageWidth, adjustViewSize); + view()->forceLayoutForPagination(pageSize, maximumShrinkRatio, shouldAdjustViewSize); for (Frame* child = tree()->firstChild(); child; child = child->tree()->nextSibling()) - child->setPrinting(printing, minPageWidth, maxPageWidth, adjustViewSize); + child->setPrinting(printing, pageSize, maximumShrinkRatio, shouldAdjustViewSize); } void Frame::setNeedsReapplyStyles() diff --git a/WebCore/page/Frame.h b/WebCore/page/Frame.h index c2d364f..4e522c4 100644 --- a/WebCore/page/Frame.h +++ b/WebCore/page/Frame.h @@ -140,7 +140,8 @@ namespace WebCore { Settings* settings() const; // can be NULL - void setPrinting(bool printing, float minPageWidth, float maxPageWidth, bool adjustViewSize); + enum AdjustViewSizeOrNot { DoNotAdjustViewSize, AdjustViewSize }; + void setPrinting(bool printing, const FloatSize& pageSize, float maximumShrinkRatio, AdjustViewSizeOrNot); bool inViewSourceMode() const; void setInViewSourceMode(bool = true); diff --git a/WebCore/page/FrameView.cpp b/WebCore/page/FrameView.cpp index d460da3..cb18ed1 100644 --- a/WebCore/page/FrameView.cpp +++ b/WebCore/page/FrameView.cpp @@ -221,6 +221,7 @@ void FrameView::reset() m_wasScrolledByUser = false; m_lastLayoutSize = IntSize(); m_lastZoomFactor = 1.0f; + m_pageHeight = 0; m_deferringRepaints = 0; m_repaintCount = 0; m_repaintRects.clear(); @@ -2080,33 +2081,36 @@ void FrameView::forceLayout(bool allowSubtree) //unscheduleRelayout(); } -void FrameView::forceLayoutWithPageWidthRange(float minPageWidth, float maxPageWidth, bool _adjustViewSize) +void FrameView::forceLayoutForPagination(const FloatSize& pageSize, float maximumShrinkFactor, Frame::AdjustViewSizeOrNot shouldAdjustViewSize) { // Dumping externalRepresentation(m_frame->renderer()).ascii() is a good trick to see // the state of things before and after the layout RenderView *root = toRenderView(m_frame->document()->renderer()); if (root) { - // This magic is basically copied from khtmlview::print - int pageW = (int)ceilf(minPageWidth); + int pageW = ceilf(pageSize.width()); + m_pageHeight = pageSize.height() ? pageSize.height() : visibleHeight(); root->setWidth(pageW); root->setNeedsLayoutAndPrefWidthsRecalc(); forceLayout(); - // If we don't fit in the minimum page width, we'll lay out again. If we don't fit in the - // maximum page width, we will lay out to the maximum page width and clip extra content. + // If we don't fit in the given page width, we'll lay out again. If we don't fit in the + // page width when shrunk, we will lay out at maximum shrink and clip extra content. // FIXME: We are assuming a shrink-to-fit printing implementation. A cropping // implementation should not do this! int rightmostPos = root->rightmostPosition(); - if (rightmostPos > minPageWidth) { - pageW = std::min(rightmostPos, (int)ceilf(maxPageWidth)); + if (rightmostPos > pageSize.width()) { + pageW = std::min<int>(rightmostPos, ceilf(pageSize.width() * maximumShrinkFactor)); + if (pageSize.height()) + m_pageHeight = pageW / pageSize.width() * pageSize.height(); root->setWidth(pageW); root->setNeedsLayoutAndPrefWidthsRecalc(); forceLayout(); } } - if (_adjustViewSize) + if (shouldAdjustViewSize) adjustViewSize(); + m_pageHeight = 0; } void FrameView::adjustPageHeight(float *newBottom, float oldTop, float oldBottom, float /*bottomLimit*/) diff --git a/WebCore/page/FrameView.h b/WebCore/page/FrameView.h index 718b793..9765c6f 100644 --- a/WebCore/page/FrameView.h +++ b/WebCore/page/FrameView.h @@ -199,7 +199,8 @@ public: void setIsVisuallyNonEmpty() { m_isVisuallyNonEmpty = true; } void forceLayout(bool allowSubtree = false); - void forceLayoutWithPageWidthRange(float minPageWidth, float maxPageWidth, bool adjustViewSize); + void forceLayoutForPagination(const FloatSize& pageSize, float maximumShrinkFactor, Frame::AdjustViewSizeOrNot); + int pageHeight() const { return m_pageHeight; } void adjustPageHeight(float* newBottom, float oldTop, float oldBottom, float bottomLimit); @@ -332,6 +333,8 @@ private: String m_mediaType; String m_mediaTypeWhenNotPrinting; + int m_pageHeight; + unsigned m_enqueueEvents; Vector<ScheduledEvent*> m_scheduledEvents; diff --git a/WebCore/page/Navigator.h b/WebCore/page/Navigator.h index b40bed4..a435f74 100644 --- a/WebCore/page/Navigator.h +++ b/WebCore/page/Navigator.h @@ -28,6 +28,7 @@ namespace WebCore { +<<<<<<< HEAD class DOMMimeTypeArray; class DOMPluginArray; class Frame; @@ -59,6 +60,35 @@ namespace WebCore { Geolocation* geolocation() const; // This is used for GC marking. Geolocation* optionalGeolocation() const { return m_geolocation.get(); } +======= +class DOMMimeTypeArray; +class DOMPluginArray; +class Frame; +class Geolocation; +class PluginData; +class String; + +class Navigator : public NavigatorBase, public RefCounted<Navigator> { +public: + static PassRefPtr<Navigator> create(Frame* frame) { return adoptRef(new Navigator(frame)); } + virtual ~Navigator(); + + void disconnectFrame(); + Frame* frame() const { return m_frame; } + + String appVersion() const; + String language() const; + DOMPluginArray* plugins() const; + DOMMimeTypeArray* mimeTypes() const; + bool cookieEnabled() const; + bool javaEnabled() const; + + virtual String userAgent() const; + + Geolocation* geolocation() const; + // This is used for GC marking. + Geolocation* optionalGeolocation() const { return m_geolocation.get(); } +>>>>>>> webkit.org at r64523 #if PLATFORM(ANDROID) Connection* connection() const; @@ -70,10 +100,11 @@ namespace WebCore { #endif #if ENABLE(DOM_STORAGE) - // Relinquishes the storage lock, if one exists. - void getStorageUpdates(); + // Relinquishes the storage lock, if one exists. + void getStorageUpdates(); #endif +<<<<<<< HEAD private: Navigator(Frame*); Frame* m_frame; @@ -89,6 +120,15 @@ namespace WebCore { String m_applicationNameQuery; #endif }; +======= +private: + Navigator(Frame*); + Frame* m_frame; + mutable RefPtr<DOMPluginArray> m_plugins; + mutable RefPtr<DOMMimeTypeArray> m_mimeTypes; + mutable RefPtr<Geolocation> m_geolocation; +}; +>>>>>>> webkit.org at r64523 } diff --git a/WebCore/page/Page.cpp b/WebCore/page/Page.cpp index 6db0e73..49a14c2 100644 --- a/WebCore/page/Page.cpp +++ b/WebCore/page/Page.cpp @@ -182,6 +182,7 @@ Page::Page(const PageClients& pageClients) , m_customHTMLTokenizerTimeDelay(-1) , m_customHTMLTokenizerChunkSize(-1) , m_canStartMedia(true) + , m_viewMode(ViewModeWindowed) { if (!allPages) { allPages = new HashSet<Page*>; @@ -219,6 +220,9 @@ Page::~Page() frame->pageDestroyed(); m_editorClient->pageDestroyed(); + if (m_pluginData) + m_pluginData->disconnectPage(); + #if ENABLE(INSPECTOR) m_inspectorController->inspectedPageDestroyed(); #endif @@ -235,6 +239,45 @@ Page::~Page() #endif } +struct ViewModeInfo { + const char* name; + Page::ViewMode type; +}; +static const int viewModeMapSize = 5; +static ViewModeInfo viewModeMap[viewModeMapSize] = { + {"windowed", Page::ViewModeWindowed}, + {"floating", Page::ViewModeFloating}, + {"fullscreen", Page::ViewModeFullscreen}, + {"maximized", Page::ViewModeMaximized}, + {"minimized", Page::ViewModeMinimized} +}; + +Page::ViewMode Page::stringToViewMode(const String& text) +{ + for (int i = 0; i < viewModeMapSize; ++i) { + if (text == viewModeMap[i].name) + return viewModeMap[i].type; + } + return Page::ViewModeInvalid; +} + +void Page::setViewMode(ViewMode viewMode) +{ + if (viewMode == m_viewMode || viewMode == ViewModeInvalid) + return; + + m_viewMode = viewMode; + + if (!m_mainFrame) + return; + + if (m_mainFrame->view()) + m_mainFrame->view()->forceLayout(); + + if (m_mainFrame->document()) + m_mainFrame->document()->updateStyleSelector(); +} + void Page::setMainFrame(PassRefPtr<Frame> mainFrame) { ASSERT(!m_mainFrame); // Should only be called during initialization diff --git a/WebCore/page/Page.h b/WebCore/page/Page.h index aab95f3..62af0a7 100644 --- a/WebCore/page/Page.h +++ b/WebCore/page/Page.h @@ -186,6 +186,20 @@ namespace WebCore { #endif Settings* settings() const { return m_settings.get(); } ProgressTracker* progress() const { return m_progress.get(); } + + + enum ViewMode { + ViewModeInvalid, + ViewModeWindowed, + ViewModeFloating, + ViewModeFullscreen, + ViewModeMaximized, + ViewModeMinimized + }; + static ViewMode stringToViewMode(const String&); + + ViewMode viewMode() const { return m_viewMode; } + void setViewMode(ViewMode); void setTabKeyCyclesThroughElements(bool b) { m_tabKeyCyclesThroughElements = b; } bool tabKeyCyclesThroughElements() const { return m_tabKeyCyclesThroughElements; } @@ -361,6 +375,8 @@ namespace WebCore { #if ENABLE(NOTIFICATIONS) NotificationPresenter* m_notificationPresenter; #endif + + ViewMode m_viewMode; }; } // namespace WebCore diff --git a/WebCore/page/PageGroup.cpp b/WebCore/page/PageGroup.cpp index e0502c5..15d4d8d 100644 --- a/WebCore/page/PageGroup.cpp +++ b/WebCore/page/PageGroup.cpp @@ -30,7 +30,7 @@ #include "ChromeClient.h" #include "Document.h" #include "Frame.h" -#include "IndexedDatabase.h" +#include "IDBFactoryBackendInterface.h" #include "Page.h" #include "Settings.h" #include "StorageNamespace.h" @@ -136,6 +136,11 @@ bool PageGroup::isLinkVisited(LinkHash visitedLinkHash) #endif } +void PageGroup::addVisitedLinkHash(LinkHash hash) +{ + addVisitedLink(hash); +} + inline void PageGroup::addVisitedLink(LinkHash hash) { ASSERT(shouldTrackVisitedLinks); @@ -203,13 +208,13 @@ StorageNamespace* PageGroup::localStorage() #endif #if ENABLE(INDEXED_DATABASE) -IndexedDatabase* PageGroup::indexedDatabase() +IDBFactoryBackendInterface* PageGroup::idbFactory() { // Do not add page setting based access control here since this object is shared by all pages in // the group and having per-page controls is misleading. - if (!m_indexedDatabase) - m_indexedDatabase = IndexedDatabase::create(); - return m_indexedDatabase.get(); + if (!m_factoryBackend) + m_factoryBackend = IDBFactoryBackendInterface::create(); + return m_factoryBackend.get(); } #endif diff --git a/WebCore/page/PageGroup.h b/WebCore/page/PageGroup.h index 77aa281..08b03d7 100644 --- a/WebCore/page/PageGroup.h +++ b/WebCore/page/PageGroup.h @@ -36,7 +36,7 @@ namespace WebCore { class KURL; - class IndexedDatabase; + class IDBFactoryBackendInterface; class Page; class StorageNamespace; @@ -58,6 +58,7 @@ namespace WebCore { void addVisitedLink(const KURL&); void addVisitedLink(const UChar*, size_t); + void addVisitedLinkHash(LinkHash); void removeVisitedLinks(); static void setShouldTrackVisitedLinks(bool); @@ -71,7 +72,7 @@ namespace WebCore { bool hasLocalStorage() { return m_localStorage; } #endif #if ENABLE(INDEXED_DATABASE) - IndexedDatabase* indexedDatabase(); + IDBFactoryBackendInterface* idbFactory(); #endif void addUserScriptToWorld(DOMWrapperWorld*, const String& source, const KURL&, @@ -108,7 +109,7 @@ namespace WebCore { RefPtr<StorageNamespace> m_localStorage; #endif #if ENABLE(INDEXED_DATABASE) - RefPtr<IndexedDatabase> m_indexedDatabase; + RefPtr<IDBFactoryBackendInterface> m_factoryBackend; #endif OwnPtr<UserScriptMap> m_userScripts; diff --git a/WebCore/page/PrintContext.cpp b/WebCore/page/PrintContext.cpp index 74af4b1..7b0179d 100644 --- a/WebCore/page/PrintContext.cpp +++ b/WebCore/page/PrintContext.cpp @@ -117,7 +117,7 @@ void PrintContext::computePageRectsWithPageSizeInternal(const FloatSize& pageSiz } while (printedPagesHeight < docHeight); } -void PrintContext::begin(float width) +void PrintContext::begin(float width, float height) { ASSERT(!m_isPrinting); m_isPrinting = true; @@ -136,11 +136,11 @@ void PrintContext::begin(float width) const float PrintingMaximumShrinkFactor = 2.0f; float minLayoutWidth = width * PrintingMinimumShrinkFactor; - float maxLayoutWidth = width * PrintingMaximumShrinkFactor; + float minLayoutHeight = height * PrintingMinimumShrinkFactor; // FIXME: This will modify the rendering of the on-screen frame. // Could lead to flicker during printing. - m_frame->setPrinting(true, minLayoutWidth, maxLayoutWidth, true); + m_frame->setPrinting(true, FloatSize(minLayoutWidth, minLayoutHeight), PrintingMaximumShrinkFactor / PrintingMinimumShrinkFactor, Frame::AdjustViewSize); } void PrintContext::spoolPage(GraphicsContext& ctx, int pageNumber, float width) @@ -160,7 +160,7 @@ void PrintContext::end() { ASSERT(m_isPrinting); m_isPrinting = false; - m_frame->setPrinting(false, 0, 0, true); + m_frame->setPrinting(false, FloatSize(), 0, Frame::AdjustViewSize); } static RenderBoxModelObject* enclosingBoxModelObject(RenderObject* object) @@ -186,8 +186,10 @@ int PrintContext::pageNumberForElement(Element* element, const FloatSize& pageSi Frame* frame = element->document()->frame(); FloatRect pageRect(FloatPoint(0, 0), pageSizeInPixels); PrintContext printContext(frame); - printContext.begin(pageRect.width()); - printContext.computePageRectsWithPageSize(pageSizeInPixels, false); + printContext.begin(pageRect.width(), pageRect.height()); + FloatSize scaledPageSize = pageSizeInPixels; + scaledPageSize.scale(frame->view()->contentsSize().width() / pageRect.width()); + printContext.computePageRectsWithPageSize(scaledPageSize, false); int top = box->offsetTop(); int left = box->offsetLeft(); @@ -244,8 +246,11 @@ int PrintContext::numberOfPages(Frame* frame, const FloatSize& pageSizeInPixels) FloatRect pageRect(FloatPoint(0, 0), pageSizeInPixels); PrintContext printContext(frame); - printContext.begin(pageRect.width()); - printContext.computePageRectsWithPageSize(pageSizeInPixels, false); + printContext.begin(pageRect.width(), pageRect.height()); + // Account for shrink-to-fit. + FloatSize scaledPageSize = pageSizeInPixels; + scaledPageSize.scale(frame->view()->contentsSize().width() / pageRect.width()); + printContext.computePageRectsWithPageSize(scaledPageSize, false); return printContext.pageCount(); } @@ -257,7 +262,7 @@ void PrintContext::spoolAllPagesWithBoundaries(Frame* frame, GraphicsContext& gr frame->document()->updateLayout(); PrintContext printContext(frame); - printContext.begin(pageSizeInPixels.width()); + printContext.begin(pageSizeInPixels.width(), pageSizeInPixels.height()); float pageHeight; printContext.computePageRects(FloatRect(FloatPoint(0, 0), pageSizeInPixels), 0, 0, 1, pageHeight); diff --git a/WebCore/page/PrintContext.h b/WebCore/page/PrintContext.h index 8492718..ed1cfa4 100644 --- a/WebCore/page/PrintContext.h +++ b/WebCore/page/PrintContext.h @@ -46,7 +46,7 @@ public: void computePageRectsWithPageSize(const FloatSize& pageSizeInPixels, bool allowHorizontalMultiPages); // TODO: eliminate width param - void begin(float width); + void begin(float width, float height = 0); // TODO: eliminate width param void spoolPage(GraphicsContext& ctx, int pageNumber, float width); diff --git a/WebCore/page/chromium/ChromeClientChromium.h b/WebCore/page/chromium/ChromeClientChromium.h index 46985b1..e897c15 100644 --- a/WebCore/page/chromium/ChromeClientChromium.h +++ b/WebCore/page/chromium/ChromeClientChromium.h @@ -39,10 +39,6 @@ class AccessibilityObject; class IntRect; class PopupContainer; -#if USE(ACCELERATED_COMPOSITING) -class GLES2Context; -#endif - // Contains Chromium-specific extensions to the ChromeClient. Only put // things here that don't make sense for other ports. class ChromeClientChromium : public ChromeClient { @@ -59,12 +55,6 @@ public: // Notifies embedder that the state of an accessibility object has changed. virtual void didChangeAccessibilityObjectState(AccessibilityObject*) = 0; - -#if USE(ACCELERATED_COMPOSITING) - // Request a GL ES 2 context to use for compositing this page's content. - virtual PassOwnPtr<GLES2Context> getOnscreenGLES2Context() = 0; - virtual PassOwnPtr<GLES2Context> getOffscreenGLES2Context() = 0; -#endif }; } // namespace WebCore diff --git a/WebCore/platform/MIMETypeRegistry.cpp b/WebCore/platform/MIMETypeRegistry.cpp index e6eb209..e9e5dd3 100644 --- a/WebCore/platform/MIMETypeRegistry.cpp +++ b/WebCore/platform/MIMETypeRegistry.cpp @@ -180,6 +180,12 @@ static void initializeSupportedImageMIMETypesForEncoding() } supportedImageMIMETypesForEncoding->remove("application/octet-stream"); +#elif PLATFORM(GTK) + supportedImageMIMETypesForEncoding->add("image/png"); + supportedImageMIMETypesForEncoding->add("image/jpeg"); + supportedImageMIMETypesForEncoding->add("image/tiff"); + supportedImageMIMETypesForEncoding->add("image/bmp"); + supportedImageMIMETypesForEncoding->add("image/ico"); #elif PLATFORM(CAIRO) supportedImageMIMETypesForEncoding->add("image/png"); #endif diff --git a/WebCore/platform/PlatformStrategies.h b/WebCore/platform/PlatformStrategies.h index f585202..c02ce00 100644 --- a/WebCore/platform/PlatformStrategies.h +++ b/WebCore/platform/PlatformStrategies.h @@ -32,6 +32,7 @@ namespace WebCore { class PluginStrategy; class LocalizationStrategy; +class VisitedLinkStrategy; class PlatformStrategies { public: @@ -49,10 +50,18 @@ public: return m_localizationStrategy; } + VisitedLinkStrategy* visitedLinkStrategy() + { + if (!m_visitedLinkStrategy) + m_visitedLinkStrategy = createVisitedLinkStrategy(); + return m_visitedLinkStrategy; + } + protected: PlatformStrategies() - : m_pluginStrategy(0), - m_localizationStrategy(0) + : m_pluginStrategy(0) + , m_localizationStrategy(0) + , m_visitedLinkStrategy(0) { } @@ -63,9 +72,11 @@ protected: private: virtual PluginStrategy* createPluginStrategy() = 0; virtual LocalizationStrategy* createLocalizationStrategy() = 0; + virtual VisitedLinkStrategy* createVisitedLinkStrategy() = 0; PluginStrategy* m_pluginStrategy; LocalizationStrategy* m_localizationStrategy; + VisitedLinkStrategy* m_visitedLinkStrategy; }; PlatformStrategies* platformStrategies(); diff --git a/WebCore/platform/PopupMenu.h b/WebCore/platform/PopupMenu.h index d9d2740..8ebba03 100644 --- a/WebCore/platform/PopupMenu.h +++ b/WebCore/platform/PopupMenu.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2010 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 @@ -21,180 +21,22 @@ #ifndef PopupMenu_h #define PopupMenu_h -#include "IntRect.h" -#include "PopupMenuClient.h" -#include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> -#if PLATFORM(MAC) -#include <wtf/RetainPtr.h> -#ifdef __OBJC__ -@class NSPopUpButtonCell; -#else -class NSPopUpButtonCell; -#endif -#elif PLATFORM(WIN) -#include "Scrollbar.h" -#include "ScrollbarClient.h" -#include <wtf/RefPtr.h> -typedef struct HWND__* HWND; -typedef struct HDC__* HDC; -typedef struct HBITMAP__* HBITMAP; -#elif PLATFORM(QT) -namespace WebCore { -class QtAbstractWebPopup; -} -#elif PLATFORM(GTK) -typedef struct _GtkMenu GtkMenu; -typedef struct _GtkMenuItem GtkMenuItem; -typedef struct _GtkWidget GtkWidget; -#include "GRefPtrGtk.h" -#include <wtf/HashMap.h> -#include <glib.h> -#elif PLATFORM(WX) -#ifdef __WXMSW__ -#include <wx/msw/winundef.h> -#endif -class wxMenu; -#include <wx/defs.h> -#include <wx/event.h> -#elif PLATFORM(CHROMIUM) -#include "PopupMenuPrivate.h" -#elif PLATFORM(HAIKU) -namespace WebCore { -class PopupMenuHaiku; -} -#endif - namespace WebCore { class FrameView; -class Scrollbar; +class IntRect; -class PopupMenu : public RefCounted<PopupMenu> -#if PLATFORM(WIN) - , private ScrollbarClient -#endif -#if PLATFORM(WX) - , public wxEvtHandler -#endif -{ +class PopupMenu : public RefCounted<PopupMenu> { public: - static PassRefPtr<PopupMenu> create(PopupMenuClient* client) { return adoptRef(new PopupMenu(client)); } - ~PopupMenu(); - - void disconnectClient() { m_popupClient = 0; } - - void show(const IntRect&, FrameView*, int index); - void hide(); - - void updateFromElement(); - - PopupMenuClient* client() const { return m_popupClient; } - - static bool itemWritingDirectionIsNatural(); - -#if PLATFORM(WIN) - Scrollbar* scrollbar() const { return m_scrollbar.get(); } - - static LPCTSTR popupClassName(); - - bool up(unsigned lines = 1); - bool down(unsigned lines = 1); - - int itemHeight() const { return m_itemHeight; } - const IntRect& windowRect() const { return m_windowRect; } - IntRect clientRect() const; - - int visibleItems() const; - - int listIndexAtPoint(const IntPoint&) const; - - bool setFocusedIndex(int index, bool hotTracking = false); - int focusedIndex() const; - void focusFirst(); - void focusLast(); - - void paint(const IntRect& damageRect, HDC = 0); - - HWND popupHandle() const { return m_popup; } - - void setWasClicked(bool b = true) { m_wasClicked = b; } - bool wasClicked() const { return m_wasClicked; } - - void setScrollOffset(int offset) { m_scrollOffset = offset; } - int scrollOffset() const { return m_scrollOffset; } - - bool scrollToRevealSelection(); - - void incrementWheelDelta(int delta); - void reduceWheelDelta(int delta); - int wheelDelta() const { return m_wheelDelta; } - - bool scrollbarCapturingMouse() const { return m_scrollbarCapturingMouse; } - void setScrollbarCapturingMouse(bool b) { m_scrollbarCapturingMouse = b; } -#endif - -protected: - PopupMenu(PopupMenuClient*); - -private: - PopupMenuClient* m_popupClient; - -#if PLATFORM(MAC) - void clear(); - void populate(); - - RetainPtr<NSPopUpButtonCell> m_popup; -#elif PLATFORM(QT) - QtAbstractWebPopup* m_popup; -#elif PLATFORM(WIN) - // ScrollBarClient - virtual void valueChanged(Scrollbar*); - virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&); - virtual bool isActive() const { return true; } - virtual bool scrollbarCornerPresent() const { return false; } - - void calculatePositionAndSize(const IntRect&, FrameView*); - void invalidateItem(int index); - - static LRESULT CALLBACK PopupMenuWndProc(HWND, UINT, WPARAM, LPARAM); - LRESULT wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); - static void registerClass(); - - RefPtr<Scrollbar> m_scrollbar; - HWND m_popup; - HDC m_DC; - HBITMAP m_bmp; - bool m_wasClicked; - IntRect m_windowRect; - int m_itemHeight; - int m_scrollOffset; - int m_wheelDelta; - int m_focusedIndex; - bool m_scrollbarCapturingMouse; - bool m_showPopup; -#elif PLATFORM(GTK) - IntPoint m_menuPosition; - GRefPtr<GtkMenu> m_popup; - HashMap<GtkWidget*, int> m_indexMap; - static void menuItemActivated(GtkMenuItem* item, PopupMenu*); - static void menuUnmapped(GtkWidget*, PopupMenu*); - static void menuPositionFunction(GtkMenu*, gint*, gint*, gboolean*, PopupMenu*); - static void menuRemoveItem(GtkWidget*, PopupMenu*); -#elif PLATFORM(EFL) || PLATFORM(BREWMP) - FrameView* m_view; -#elif PLATFORM(WX) - wxMenu* m_menu; - void OnMenuItemSelected(wxCommandEvent&); -#elif PLATFORM(CHROMIUM) - PopupMenuPrivate p; -#elif PLATFORM(HAIKU) - PopupMenuHaiku* m_menu; -#endif - + virtual ~PopupMenu() {} + virtual void show(const IntRect&, FrameView*, int index) = 0; + virtual void hide() = 0; + virtual void updateFromElement() = 0; + virtual void disconnectClient() = 0; }; } -#endif +#endif // PopupMenu_h diff --git a/WebCore/platform/SearchPopupMenu.h b/WebCore/platform/SearchPopupMenu.h index 4285cdf..d1ecd0f 100644 --- a/WebCore/platform/SearchPopupMenu.h +++ b/WebCore/platform/SearchPopupMenu.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2010 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 @@ -23,24 +23,21 @@ #include "PopupMenu.h" #include <wtf/Vector.h> +#include <wtf/text/WTFString.h> namespace WebCore { class AtomicString; -class SearchPopupMenu : public PopupMenu { +class SearchPopupMenu : public RefCounted<SearchPopupMenu> { public: - static PassRefPtr<SearchPopupMenu> create(PopupMenuClient* client) { return adoptRef(new SearchPopupMenu(client)); } - - void saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems); - void loadRecentSearches(const AtomicString& name, Vector<String>& searchItems); - - bool enabled(); - -private: - SearchPopupMenu(PopupMenuClient*); + virtual ~SearchPopupMenu() {} + virtual PopupMenu* popupMenu() = 0; + virtual void saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) = 0; + virtual void loadRecentSearches(const AtomicString& name, Vector<String>& searchItems) = 0; + virtual bool enabled() = 0; }; } -#endif +#endif // SearchPopupMenu_h diff --git a/WebCore/platform/SharedBuffer.cpp b/WebCore/platform/SharedBuffer.cpp index 6cf1131..35a7b7c 100644 --- a/WebCore/platform/SharedBuffer.cpp +++ b/WebCore/platform/SharedBuffer.cpp @@ -239,7 +239,7 @@ unsigned SharedBuffer::getSomeData(const char*& someData, unsigned position) con return segment == segments - 1 ? segmentedSize - position : segmentSize - positionInSegment; } -#if !PLATFORM(CF) +#if !PLATFORM(CF) || PLATFORM(QT) inline void SharedBuffer::clearPlatformData() { diff --git a/WebCore/platform/brew/PopupMenuBrew.cpp b/WebCore/platform/brew/PopupMenuBrew.cpp index eb03c66..18b2b45 100644 --- a/WebCore/platform/brew/PopupMenuBrew.cpp +++ b/WebCore/platform/brew/PopupMenuBrew.cpp @@ -4,6 +4,7 @@ * Copyright (C) 2009-2010 ProFUSION embedded systems * Copyright (C) 2009-2010 Samsung Electronics * Copyright (C) 2010 Company 100, Inc. + * Copyright (C) 2010 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 @@ -23,7 +24,7 @@ */ #include "config.h" -#include "PopupMenu.h" +#include "PopupMenuBrew.h" #include "Chrome.h" #include "ChromeClientBrew.h" @@ -32,20 +33,25 @@ namespace WebCore { -PopupMenu::PopupMenu(PopupMenuClient* menuList) +PopupMenuBrew::PopupMenuBrew(PopupMenuClient* menuList) : m_popupClient(menuList) , m_view(0) { } -PopupMenu::~PopupMenu() +PopupMenuBrew::~PopupMenuBrew() { // Tell client to destroy data related to this popup since this object is // going away. hide(); } -void PopupMenu::show(const IntRect& rect, FrameView* view, int index) +void PopupMenuBrew::disconnectClient() +{ + m_popupClient = 0; +} + +void PopupMenuBrew::show(const IntRect& rect, FrameView* view, int index) { ASSERT(m_popupClient); ChromeClientBrew* chromeClient = static_cast<ChromeClientBrew*>(view->frame()->page()->chrome()->client()); @@ -55,7 +61,7 @@ void PopupMenu::show(const IntRect& rect, FrameView* view, int index) chromeClient->createSelectPopup(m_popupClient, index, rect); } -void PopupMenu::hide() +void PopupMenuBrew::hide() { ASSERT(m_view); ChromeClientBrew* chromeClient = static_cast<ChromeClientBrew*>(m_view->frame()->page()->chrome()->client()); @@ -64,14 +70,18 @@ void PopupMenu::hide() chromeClient->destroySelectPopup(); } -void PopupMenu::updateFromElement() +void PopupMenuBrew::updateFromElement() { client()->setTextFromItem(client()->selectedIndex()); } -bool PopupMenu::itemWritingDirectionIsNatural() -{ - return true; -} +// This code must be moved to the concrete brew ChromeClient that is not in repository. +// I kept this code commented out here to prevent loosing the information of what +// must be the return value for brew. + +// bool PopupMenuBrew::itemWritingDirectionIsNatural() +// { +// return true; +// } } // namespace WebCore diff --git a/WebCore/platform/brew/PopupMenuBrew.h b/WebCore/platform/brew/PopupMenuBrew.h new file mode 100644 index 0000000..0c171df --- /dev/null +++ b/WebCore/platform/brew/PopupMenuBrew.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef PopupMenuBrew_h +#define PopupMenuBrew_h + +#include "IntRect.h" +#include "PopupMenu.h" +#include "PopupMenuClient.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace WebCore { + +class FrameView; +class Scrollbar; + +class PopupMenuBrew : public PopupMenu { +public: + PopupMenuBrew(PopupMenuClient*); + ~PopupMenuBrew(); + + virtual void show(const IntRect&, FrameView*, int index); + virtual void hide(); + virtual void updateFromElement(); + virtual void disconnectClient(); + +private: + PopupMenuClient* client() const { return m_popupClient; } + + PopupMenuClient* m_popupClient; + FrameView* m_view; +}; + +} + +#endif // PopupMenuBrew_h diff --git a/WebCore/platform/brew/SearchPopupMenuBrew.cpp b/WebCore/platform/brew/SearchPopupMenuBrew.cpp index 780c7e5..81ca624 100644 --- a/WebCore/platform/brew/SearchPopupMenuBrew.cpp +++ b/WebCore/platform/brew/SearchPopupMenuBrew.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2010 Company 100, Inc. All rights reserved. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -24,29 +25,34 @@ */ #include "config.h" -#include "SearchPopupMenu.h" +#include "SearchPopupMenuBrew.h" namespace WebCore { // Save the past searches stored in 'searchItems' to a database associated with 'name' -void SearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) +void SearchPopupMenuBrew::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) { } // Load past searches associated with 'name' from the database to 'searchItems' -void SearchPopupMenu::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems) +void SearchPopupMenuBrew::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems) { } // Create a search popup menu - not sure what else we have to do here -SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client) - : PopupMenu(client) +SearchPopupMenuBrew::SearchPopupMenuBrew(PopupMenuClient* client) + : m_popup(adoptRef(new PopupMenuBrew(client))) { } -bool SearchPopupMenu::enabled() +bool SearchPopupMenuBrew::enabled() { return false; } +PopupMenu* SearchPopupMenuBrew::popupMenu() +{ + return m_popup.get(); +} + } // namespace WebCore diff --git a/WebCore/platform/brew/SearchPopupMenuBrew.h b/WebCore/platform/brew/SearchPopupMenuBrew.h new file mode 100644 index 0000000..4ce7005 --- /dev/null +++ b/WebCore/platform/brew/SearchPopupMenuBrew.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef SearchPopupMenuBrew_h +#define SearchPopupMenuBrew_h + +#include "PopupMenuBrew.h" +#include "SearchPopupMenu.h" + +namespace WebCore { + +class SearchPopupMenuBrew : public SearchPopupMenu { +public: + SearchPopupMenuBrew(PopupMenuClient*); + + virtual PopupMenu* popupMenu(); + virtual void saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems); + virtual void loadRecentSearches(const AtomicString& name, Vector<String>& searchItems); + virtual bool enabled(); + +private: + RefPtr<PopupMenuBrew> m_popup; +}; + +} + +#endif // SearchPopupMenuBrew_h diff --git a/WebCore/platform/chromium/ChromiumBridge.h b/WebCore/platform/chromium/ChromiumBridge.h index 711c728..acfefe1 100644 --- a/WebCore/platform/chromium/ChromiumBridge.h +++ b/WebCore/platform/chromium/ChromiumBridge.h @@ -70,7 +70,7 @@ namespace WebCore { class GeolocationServiceChromium; class GraphicsContext; class Image; - class IndexedDatabase; + class IDBFactoryBackendInterface; class IntRect; class KURL; class String; @@ -166,7 +166,7 @@ namespace WebCore { static long long databaseGetFileSize(const String& vfsFileName); // IndexedDB ---------------------------------------------------------- - static PassRefPtr<IndexedDatabase> indexedDatabase(); + static PassRefPtr<IDBFactoryBackendInterface> idbFactory(); // JavaScript --------------------------------------------------------- static void notifyJSOutOfMemory(Frame*); diff --git a/WebCore/platform/chromium/PopupMenuChromium.cpp b/WebCore/platform/chromium/PopupMenuChromium.cpp index d07ba2e..9c73a9c 100644 --- a/WebCore/platform/chromium/PopupMenuChromium.cpp +++ b/WebCore/platform/chromium/PopupMenuChromium.cpp @@ -1,5 +1,6 @@ /* * Copyright (c) 2008, 2009, Google Inc. All rights reserved. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -48,7 +49,6 @@ #include "PlatformMouseEvent.h" #include "PlatformScreen.h" #include "PlatformWheelEvent.h" -#include "PopupMenu.h" #include "RenderTheme.h" #include "ScrollbarTheme.h" #include "StringTruncator.h" @@ -1340,20 +1340,20 @@ bool PopupListBox::isPointInBounds(const IntPoint& point) } /////////////////////////////////////////////////////////////////////////////// -// PopupMenu implementation +// PopupMenuChromium implementation // // Note: you cannot add methods to this class, since it is defined above the // portability layer. To access methods and properties on the // popup widgets, use |popupWindow| above. -PopupMenu::PopupMenu(PopupMenuClient* client) +PopupMenuChromium::PopupMenuChromium(PopupMenuClient* client) : m_popupClient(client) { } -PopupMenu::~PopupMenu() +PopupMenuChromium::~PopupMenuChromium() { - // When the PopupMenu is destroyed, the client could already have been + // When the PopupMenuChromium is destroyed, the client could already have been // deleted. if (p.popup) p.popup->listBox()->disconnectClient(); @@ -1364,7 +1364,7 @@ PopupMenu::~PopupMenu() // to display, handle the input tracking and menu item selection for the popup. // Windows and Linux Chromium let our WebKit port handle the display, while // another process manages the popup window and input handling. -void PopupMenu::show(const IntRect& r, FrameView* v, int index) +void PopupMenuChromium::show(const IntRect& r, FrameView* v, int index) { if (!p.popup) p.popup = PopupContainer::create(client(), PopupContainer::Select, dropDownSettings); @@ -1375,20 +1375,21 @@ void PopupMenu::show(const IntRect& r, FrameView* v, int index) #endif } -void PopupMenu::hide() +void PopupMenuChromium::hide() { if (p.popup) p.popup->hide(); } -void PopupMenu::updateFromElement() +void PopupMenuChromium::updateFromElement() { p.popup->listBox()->updateFromElement(); } -bool PopupMenu::itemWritingDirectionIsNatural() -{ - return false; + +void PopupMenuChromium::disconnectClient() +{ + m_popupClient = 0; } } // namespace WebCore diff --git a/WebCore/platform/chromium/PopupMenuChromium.h b/WebCore/platform/chromium/PopupMenuChromium.h index a85cf49..0d0e23c 100644 --- a/WebCore/platform/chromium/PopupMenuChromium.h +++ b/WebCore/platform/chromium/PopupMenuChromium.h @@ -36,6 +36,8 @@ #include "FramelessScrollView.h" #include "IntRect.h" +#include "PopupMenu.h" +#include "PopupMenuPrivate.h" namespace WebCore { @@ -201,6 +203,23 @@ private: bool m_popupOpen; }; +class PopupMenuChromium : public PopupMenu { +public: + PopupMenuChromium(PopupMenuClient*); + ~PopupMenuChromium(); + + virtual void show(const IntRect&, FrameView*, int index); + virtual void hide(); + virtual void updateFromElement(); + virtual void disconnectClient(); + +private: + PopupMenuClient* client() const { return m_popupClient; } + + PopupMenuClient* m_popupClient; + PopupMenuPrivate p; +}; + } // namespace WebCore #endif diff --git a/WebCore/platform/chromium/SearchPopupMenuChromium.cpp b/WebCore/platform/chromium/SearchPopupMenuChromium.cpp index 89bfddd..d4d4ff5 100644 --- a/WebCore/platform/chromium/SearchPopupMenuChromium.cpp +++ b/WebCore/platform/chromium/SearchPopupMenuChromium.cpp @@ -1,5 +1,6 @@ /* * Copyright (c) 2008, 2009, Google Inc. All rights reserved. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -29,29 +30,34 @@ */ #include "config.h" -#include "SearchPopupMenu.h" +#include "SearchPopupMenuChromium.h" #include "AtomicString.h" #include "NotImplemented.h" namespace WebCore { -SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client) - : PopupMenu(client) +SearchPopupMenuChromium::SearchPopupMenuChromium(PopupMenuClient* client) + : m_popup(adoptRef(new PopupMenuChromium(client))) { } -bool SearchPopupMenu::enabled() +PopupMenu* SearchPopupMenuChromium::popupMenu() +{ + return m_popup.get(); +} + +bool SearchPopupMenuChromium::enabled() { return false; } -void SearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) +void SearchPopupMenuChromium::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) { notImplemented(); } -void SearchPopupMenu::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems) +void SearchPopupMenuChromium::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems) { notImplemented(); } diff --git a/WebCore/platform/chromium/SearchPopupMenuChromium.h b/WebCore/platform/chromium/SearchPopupMenuChromium.h new file mode 100644 index 0000000..827ff66 --- /dev/null +++ b/WebCore/platform/chromium/SearchPopupMenuChromium.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef SearchPopupMenuChromium_h +#define SearchPopupMenuChromium_h + +#include "PopupMenuChromium.h" +#include "SearchPopupMenu.h" + +namespace WebCore { + +class SearchPopupMenuChromium : public SearchPopupMenu { +public: + SearchPopupMenuChromium(PopupMenuClient*); + + virtual PopupMenu* popupMenu(); + virtual void saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems); + virtual void loadRecentSearches(const AtomicString& name, Vector<String>& searchItems); + virtual bool enabled(); + +private: + RefPtr<PopupMenuChromium> m_popup; +}; + +} + +#endif // SearchPopupMenuChromium_h diff --git a/WebCore/platform/efl/PopupMenuEfl.cpp b/WebCore/platform/efl/PopupMenuEfl.cpp index 9dc6986..401f24f 100644 --- a/WebCore/platform/efl/PopupMenuEfl.cpp +++ b/WebCore/platform/efl/PopupMenuEfl.cpp @@ -3,6 +3,7 @@ * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia * Copyright (C) 2009-2010 ProFUSION embedded systems * Copyright (C) 2009-2010 Samsung Electronics + * Copyright (C) 2010 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 @@ -22,29 +23,30 @@ */ #include "config.h" -#include "PopupMenu.h" +#include "PopupMenuEfl.h" #include "Chrome.h" #include "ChromeClientEfl.h" #include "FrameView.h" #include "NotImplemented.h" +#include "PopupMenuClient.h" namespace WebCore { -PopupMenu::PopupMenu(PopupMenuClient* client) +PopupMenuEfl::PopupMenuEfl(PopupMenuClient* client) : m_popupClient(client) , m_view(0) { } -PopupMenu::~PopupMenu() +PopupMenuEfl::~PopupMenuEfl() { // Tell client to destroy data related to this popup since this object is // going away. hide(); } -void PopupMenu::show(const IntRect& rect, FrameView* view, int index) +void PopupMenuEfl::show(const IntRect& rect, FrameView* view, int index) { ASSERT(m_popupClient); ChromeClientEfl* chromeClient = static_cast<ChromeClientEfl*>(view->frame()->page()->chrome()->client()); @@ -54,7 +56,7 @@ void PopupMenu::show(const IntRect& rect, FrameView* view, int index) chromeClient->createSelectPopup(m_popupClient, index, rect); } -void PopupMenu::hide() +void PopupMenuEfl::hide() { ASSERT(m_view); ChromeClientEfl* chromeClient = static_cast<ChromeClientEfl*>(m_view->frame()->page()->chrome()->client()); @@ -63,14 +65,14 @@ void PopupMenu::hide() chromeClient->destroySelectPopup(); } -void PopupMenu::updateFromElement() +void PopupMenuEfl::updateFromElement() { client()->setTextFromItem(client()->selectedIndex()); } -bool PopupMenu::itemWritingDirectionIsNatural() +void PopupMenuEfl::disconnectClient() { - return true; + m_popupClient = 0; } } diff --git a/WebCore/platform/efl/PopupMenuEfl.h b/WebCore/platform/efl/PopupMenuEfl.h new file mode 100644 index 0000000..4a2dbfc --- /dev/null +++ b/WebCore/platform/efl/PopupMenuEfl.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef PopupMenuEfl_h +#define PopupMenuEfl_h + +#include "IntRect.h" +#include "PopupMenu.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace WebCore { + +class FrameView; +class Scrollbar; +class PopupMenuClient; + +class PopupMenuEfl : public PopupMenu { +public: + PopupMenuEfl(PopupMenuClient*); + ~PopupMenuEfl(); + + virtual void show(const IntRect&, FrameView*, int index); + virtual void hide(); + virtual void updateFromElement(); + virtual void disconnectClient(); + +private: + PopupMenuClient* client() const { return m_popupClient; } + + PopupMenuClient* m_popupClient; + FrameView* m_view; +}; + +} + +#endif // PopupMenuEfl_h diff --git a/WebCore/platform/efl/SearchPopupMenuEfl.cpp b/WebCore/platform/efl/SearchPopupMenuEfl.cpp index d18174f..20ecb09 100644 --- a/WebCore/platform/efl/SearchPopupMenuEfl.cpp +++ b/WebCore/platform/efl/SearchPopupMenuEfl.cpp @@ -2,6 +2,7 @@ * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia * Copyright (C) 2009-2010 ProFUSION embedded systems * Copyright (C) 2009-2010 Samsung Electronics + * Copyright (C) 2010 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 Lesser General Public @@ -19,29 +20,34 @@ */ #include "config.h" -#include "SearchPopupMenu.h" +#include "SearchPopupMenuEfl.h" #include "NotImplemented.h" namespace WebCore { -SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client) - : PopupMenu(client) +SearchPopupMenuEfl::SearchPopupMenuEfl(PopupMenuClient* client) + : m_popup(adoptRef(new PopupMenuEfl(client))) { notImplemented(); } -void SearchPopupMenu::saveRecentSearches(const AtomicString&, const Vector<String>&) +PopupMenu* SearchPopupMenuEfl::popupMenu() +{ + return m_popup.get(); +} + +void SearchPopupMenuEfl::saveRecentSearches(const AtomicString&, const Vector<String>&) { notImplemented(); } -void SearchPopupMenu::loadRecentSearches(const AtomicString&, Vector<String>&) +void SearchPopupMenuEfl::loadRecentSearches(const AtomicString&, Vector<String>&) { notImplemented(); } -bool SearchPopupMenu::enabled() +bool SearchPopupMenuEfl::enabled() { notImplemented(); return true; diff --git a/WebCore/platform/efl/SearchPopupMenuEfl.h b/WebCore/platform/efl/SearchPopupMenuEfl.h new file mode 100644 index 0000000..4ffb62e --- /dev/null +++ b/WebCore/platform/efl/SearchPopupMenuEfl.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef SearchPopupMenuEfl_h +#define SearchPopupMenuEfl_h + +#include "PopupMenuEfl.h" +#include "SearchPopupMenu.h" + +namespace WebCore { + +class SearchPopupMenuEfl : public SearchPopupMenu { +public: + SearchPopupMenuEfl(PopupMenuClient*); + + virtual PopupMenu* popupMenu(); + virtual void saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems); + virtual void loadRecentSearches(const AtomicString& name, Vector<String>& searchItems); + virtual bool enabled(); + +private: + RefPtr<PopupMenuEfl> m_popup; +}; + +} + +#endif // SearchPopupMenuEfl_h diff --git a/WebCore/platform/graphics/FloatRect.cpp b/WebCore/platform/graphics/FloatRect.cpp index 7a54f21..6dfa808 100644 --- a/WebCore/platform/graphics/FloatRect.cpp +++ b/WebCore/platform/graphics/FloatRect.cpp @@ -30,6 +30,7 @@ #include "FloatConversion.h" #include "IntRect.h" #include <algorithm> +#include <limits> #include <math.h> using std::max; @@ -110,13 +111,26 @@ void FloatRect::scale(float sx, float sy) m_size.setHeight(height() * sy); } +static inline int safeFloatToInt(float x) +{ + static const int s_intMax = std::numeric_limits<int>::max(); + static const int s_intMin = std::numeric_limits<int>::min(); + + if (x >= static_cast<float>(s_intMax)) + return s_intMax; + if (x < static_cast<float>(s_intMin)) + return s_intMin; + return static_cast<int>(x); +} + IntRect enclosingIntRect(const FloatRect& rect) { - int l = static_cast<int>(floorf(rect.x())); - int t = static_cast<int>(floorf(rect.y())); - int r = static_cast<int>(ceilf(rect.right())); - int b = static_cast<int>(ceilf(rect.bottom())); - return IntRect(l, t, r - l, b - t); + float left = floorf(rect.x()); + float top = floorf(rect.y()); + float width = ceilf(rect.right()) - left; + float height = ceilf(rect.bottom()) - top; + return IntRect(safeFloatToInt(left), safeFloatToInt(top), + safeFloatToInt(width), safeFloatToInt(height)); } FloatRect mapRect(const FloatRect& r, const FloatRect& srcRect, const FloatRect& destRect) diff --git a/WebCore/platform/graphics/WOFFFileFormat.cpp b/WebCore/platform/graphics/WOFFFileFormat.cpp new file mode 100644 index 0000000..dc73603 --- /dev/null +++ b/WebCore/platform/graphics/WOFFFileFormat.cpp @@ -0,0 +1,258 @@ +/* + * Copyright (C) 2010 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. + */ + +#include "config.h" +#include "WOFFFileFormat.h" + +#if !ENABLE(OPENTYPE_SANITIZER) + +#include "SharedBuffer.h" + +#if !PLATFORM(WIN) +#include <zlib.h> +#else +#include "SoftLinking.h" + +typedef unsigned char Bytef; +typedef unsigned long uLong; +typedef unsigned long uLongf; +#define Z_OK 0 + +SOFT_LINK_LIBRARY(zlib1); +SOFT_LINK(zlib1, uncompress, int, __cdecl, (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen), (dest, destLen, source, sourceLen)); + +#if CPU(BIG_ENDIAN) +#define ntohs(x) ((uint16_t)(x)) +#define htons(x) ((uint16_t)(x)) +#define ntohl(x) ((uint32_t)(x)) +#define htonl(x) ((uint32_t)(x)) +#elif CPU(MIDDLE_ENDIAN) +#define ntohs(x) ((unit16_t)(x)) +#define htons(x) ((uint16_t)(x)) +#define ntohl(x) ((uint32_t)((((uint32_t)(x) & 0xffff0000) >> 16) | (((uint32_t)(x) & 0xffff) << 16)) +#define htonl(x) ntohl(x) +#else +#define ntohs(x) ((uint16_t)((((uint16_t)(x) & 0xff00) >> 8) | (((uint16_t)(x) & 0x00ff) << 8))) +#define htons(x) ntohs(x) +#define ntohl(x) ((uint32_t)((((uint32_t)(x) & 0xff000000) >> 24) | (((uint32_t)(x) & 0x00ff0000) >> 8) | \ + (((uint32_t)(x) & 0x0000ff00) << 8) | (((uint32_t)(x) & 0x000000ff) << 24))) +#define htonl(x) ntohl(x) +#endif + +#endif // PLATFORM(WIN) + +namespace WebCore { + +static bool readUInt32(SharedBuffer* buffer, size_t& offset, uint32_t& value) +{ + ASSERT_ARG(offset, offset <= buffer->size()); + if (buffer->size() - offset < sizeof(value)) + return false; + + value = ntohl(*reinterpret_cast<const uint32_t*>(buffer->data() + offset)); + offset += sizeof(value); + + return true; +} + +static bool readUInt16(SharedBuffer* buffer, size_t& offset, uint16_t& value) +{ + ASSERT_ARG(offset, offset <= buffer->size()); + if (buffer->size() - offset < sizeof(value)) + return false; + + value = ntohs(*reinterpret_cast<const uint16_t*>(buffer->data() + offset)); + offset += sizeof(value); + + return true; +} + +static bool writeUInt32(Vector<char>& vector, uint32_t value) +{ + uint32_t bigEndianValue = htonl(value); + return vector.tryAppend(reinterpret_cast<char*>(&bigEndianValue), sizeof(bigEndianValue)); +} + +static bool writeUInt16(Vector<char>& vector, uint16_t value) +{ + uint16_t bigEndianValue = htons(value); + return vector.tryAppend(reinterpret_cast<char*>(&bigEndianValue), sizeof(bigEndianValue)); +} + +static const uint32_t woffSignature = 0x774f4646; /* 'wOFF' */ + +bool isWOFF(SharedBuffer* buffer) +{ + size_t offset = 0; + uint32_t signature; + + return readUInt32(buffer, offset, signature) && signature == woffSignature; +} + +bool convertWOFFToSfnt(SharedBuffer* woff, Vector<char>& sfnt) +{ +#if PLATFORM(WINDOWS) + if (!zlib1Library()) + return false; +#endif + ASSERT_ARG(sfnt, sfnt.isEmpty()); + + size_t offset = 0; + + // Read the WOFF header. + uint32_t signature; + if (!readUInt32(woff, offset, signature) || signature != woffSignature) { + ASSERT_NOT_REACHED(); + return false; + } + + uint32_t flavor; + if (!readUInt32(woff, offset, flavor)) + return false; + + uint32_t length; + if (!readUInt32(woff, offset, length) || length != woff->size()) + return false; + + uint16_t numTables; + if (!readUInt16(woff, offset, numTables)) + return false; + + if (!numTables || numTables > 0x0fff) + return false; + + uint16_t reserved; + if (!readUInt16(woff, offset, reserved) || reserved) + return false; + + uint32_t totalSfntSize; + if (!readUInt32(woff, offset, totalSfntSize)) + return false; + + if (woff->size() - offset < sizeof(uint16_t) + sizeof(uint16_t) + sizeof(uint32_t) + sizeof(uint32_t) + sizeof(uint32_t) + sizeof(uint32_t) + sizeof(uint32_t)) + return false; + + offset += sizeof(uint16_t); // majorVersion + offset += sizeof(uint16_t); // minorVersion + offset += sizeof(uint32_t); // metaOffset + offset += sizeof(uint32_t); // metaLength + offset += sizeof(uint32_t); // metaOrigLength + offset += sizeof(uint32_t); // privOffset + offset += sizeof(uint32_t); // privLength + + // Check if the WOFF can supply as many tables as it claims it has. + if (woff->size() - offset < numTables * 5 * sizeof(uint32_t)) + return false; + + // Write the sfnt offset subtable. + uint16_t entrySelector = 0; + uint16_t searchRange = 1; + while (searchRange < numTables >> 1) { + entrySelector++; + searchRange <<= 1; + } + searchRange <<= 4; + uint16_t rangeShift = (numTables << 4) - searchRange; + + if (!writeUInt32(sfnt, flavor) + || !writeUInt16(sfnt, numTables) + || !writeUInt16(sfnt, searchRange) + || !writeUInt16(sfnt, entrySelector) + || !writeUInt16(sfnt, rangeShift)) + return false; + + if (sfnt.size() > totalSfntSize) + return false; + + if (totalSfntSize - sfnt.size() < numTables * 4 * sizeof(uint32_t)) + return false; + + size_t sfntTableDirectoryCursor = sfnt.size(); + sfnt.grow(sfnt.size() + numTables * 4 * sizeof(uint32_t)); + + // Process tables. + for (uint16_t i = 0; i < numTables; ++i) { + // Read a WOFF table directory entry. + uint32_t tableTag; + if (!readUInt32(woff, offset, tableTag)) + return false; + + uint32_t tableOffset; + if (!readUInt32(woff, offset, tableOffset)) + return false; + + uint32_t tableCompLength; + if (!readUInt32(woff, offset, tableCompLength)) + return false; + + if (tableOffset > woff->size() || tableCompLength > woff->size() - tableOffset) + return false; + + uint32_t tableOrigLength; + if (!readUInt32(woff, offset, tableOrigLength) || tableCompLength > tableOrigLength) + return false; + + if (tableOrigLength > totalSfntSize || sfnt.size() > totalSfntSize - tableOrigLength) + return false; + + uint32_t tableOrigChecksum; + if (!readUInt32(woff, offset, tableOrigChecksum)) + return false; + + // Write an sfnt table directory entry. + uint32_t* sfntTableDirectoryPtr = reinterpret_cast<uint32_t*>(sfnt.data() + sfntTableDirectoryCursor); + *sfntTableDirectoryPtr++ = htonl(tableTag); + *sfntTableDirectoryPtr++ = htonl(tableOrigChecksum); + *sfntTableDirectoryPtr++ = htonl(sfnt.size()); + *sfntTableDirectoryPtr++ = htonl(tableOrigLength); + sfntTableDirectoryCursor += 4 * sizeof(uint32_t); + + if (tableCompLength == tableOrigLength) { + // The table is not compressed. + if (!sfnt.tryAppend(woff->data() + tableOffset, tableCompLength)) + return false; + } else { + uLongf destLen = tableOrigLength; + if (!sfnt.tryReserveCapacity(sfnt.size() + tableOrigLength)) + return false; + Bytef* dest = reinterpret_cast<Bytef*>(sfnt.end()); + sfnt.grow(sfnt.size() + tableOrigLength); + if (uncompress(dest, &destLen, reinterpret_cast<const Bytef*>(woff->data() + tableOffset), tableCompLength) != Z_OK) + return false; + if (destLen != tableOrigLength) + return false; + } + + // Pad to a multiple of 4 bytes. + while (sfnt.size() % 4) + sfnt.append(0); + } + + return sfnt.size() == totalSfntSize; +} + +#endif // !ENABLE(OPENTYPE_SANITIZER) + +} // namespace WebCore diff --git a/WebCore/platform/graphics/WOFFFileFormat.h b/WebCore/platform/graphics/WOFFFileFormat.h new file mode 100644 index 0000000..9351d0e --- /dev/null +++ b/WebCore/platform/graphics/WOFFFileFormat.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 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 WOFFFileFormat_h +#define WOFFFileFormat_h + +#if !ENABLE(OPENTYPE_SANITIZER) + +#include <wtf/Vector.h> + +namespace WebCore { + +class SharedBuffer; + +// Returns whether the buffer is a WOFF file. +bool isWOFF(SharedBuffer* buffer); + +// Returns false if the WOFF file woff is invalid or could not be converted to sfnt (for example, +// if conversion ran out of memory). Otherwise returns true and writes the sfnt payload into sfnt. +bool convertWOFFToSfnt(SharedBuffer* woff, Vector<char>& sfnt); + +} // namespace WebCore + +#endif // !ENABLE(OPENTYPE_SANITIZER) + +#endif // WOFFFileFormat_h diff --git a/WebCore/platform/graphics/cairo/CairoPath.h b/WebCore/platform/graphics/cairo/CairoPath.h index b761ce6..da7affb 100644 --- a/WebCore/platform/graphics/cairo/CairoPath.h +++ b/WebCore/platform/graphics/cairo/CairoPath.h @@ -1,5 +1,6 @@ /* Copyright (C) 2007 Alp Toker <alp.toker@collabora.co.uk> + Copyright (C) 2010 Igalia S.L. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -24,21 +25,25 @@ namespace WebCore { - // This is necessary since cairo_path_fixed_t isn't exposed in Cairo's public API. - struct CairoPath { - cairo_t* m_cr; - - CairoPath() - { - static cairo_surface_t* pathSurface = cairo_image_surface_create(CAIRO_FORMAT_A8, 1, 1); - m_cr = cairo_create(pathSurface); - } - - ~CairoPath() - { - cairo_destroy(m_cr); - } - }; +// This is necessary since cairo_path_fixed_t isn't exposed in Cairo's public API. +class CairoPath { +public: + CairoPath() + { + static cairo_surface_t* pathSurface = cairo_image_surface_create(CAIRO_FORMAT_A8, 1, 1); + m_cr = cairo_create(pathSurface); + } + + ~CairoPath() + { + cairo_destroy(m_cr); + } + + cairo_t* context() { return m_cr; } + +private: + cairo_t* m_cr; +}; } // namespace WebCore diff --git a/WebCore/platform/graphics/cairo/FontCustomPlatformData.cpp b/WebCore/platform/graphics/cairo/FontCustomPlatformData.cpp index bb2e064..6b76c2a 100644 --- a/WebCore/platform/graphics/cairo/FontCustomPlatformData.cpp +++ b/WebCore/platform/graphics/cairo/FontCustomPlatformData.cpp @@ -21,8 +21,8 @@ #include "config.h" #include "FontCustomPlatformData.h" -#include "SharedBuffer.h" #include "FontPlatformData.h" +#include "SharedBuffer.h" namespace WebCore { @@ -70,4 +70,9 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer) return new FontCustomPlatformData(fontFace); } +bool FontCustomPlatformData::supportsFormat(const String& format) +{ + return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype"); +} + } diff --git a/WebCore/platform/graphics/cairo/FontCustomPlatformData.h b/WebCore/platform/graphics/cairo/FontCustomPlatformData.h index b36cc79..2816427 100644 --- a/WebCore/platform/graphics/cairo/FontCustomPlatformData.h +++ b/WebCore/platform/graphics/cairo/FontCustomPlatformData.h @@ -30,6 +30,7 @@ namespace WebCore { class FontPlatformData; class SharedBuffer; +class String; struct FontCustomPlatformData : Noncopyable { FontCustomPlatformData(cairo_font_face_t* fontFace) @@ -40,6 +41,8 @@ struct FontCustomPlatformData : Noncopyable { FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontRenderingMode = NormalRenderingMode); + static bool supportsFormat(const String&); + cairo_font_face_t* m_fontFace; }; diff --git a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp index 96cd4ee..f3fc943 100644 --- a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp +++ b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp @@ -4,6 +4,7 @@ * Copyright (C) 2008, 2009 Dirk Schulze <krit@webkit.org> * Copyright (C) 2008 Nuanti Ltd. * Copyright (C) 2009 Brent Fulgham <bfulgham@webkit.org> + * Copyright (C) 2010 Igalia S.L. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -143,6 +144,35 @@ static inline void copyContextProperties(cairo_t* srcCr, cairo_t* dstCr) cairo_set_fill_rule(dstCr, cairo_get_fill_rule(srcCr)); } +static void appendPathToCairoContext(cairo_t* to, cairo_t* from) +{ + cairo_path_t* cairoPath = cairo_copy_path(from); + cairo_append_path(to, cairoPath); + cairo_path_destroy(cairoPath); +} + +// We apply the pending path built via addPath to the Cairo context +// lazily. This prevents interaction between the path and other routines +// such as fillRect. +static void setPathOnCairoContext(cairo_t* to, cairo_t* from) +{ + cairo_new_path(to); + appendPathToCairoContext(to, from); +} + +static void appendWebCorePathToCairoContext(cairo_t* context, const Path& path) +{ + appendPathToCairoContext(context, path.platformPath()->context()); +} + +static void addConvexPolygonToContext(cairo_t* context, size_t numPoints, const FloatPoint* points) +{ + cairo_move_to(context, points[0].x(), points[0].y()); + for (size_t i = 1; i < numPoints; i++) + cairo_line_to(context, points[i].x(), points[i].y()); + cairo_close_path(context); +} + void GraphicsContext::calculateShadowBufferDimensions(IntSize& shadowBufferSize, FloatRect& shadowRect, float& kernelSize, const FloatRect& sourceRect, const FloatSize& shadowSize, float shadowBlur) { #if ENABLE(FILTERS) @@ -201,6 +231,22 @@ static inline void drawPathShadow(GraphicsContext* context, GraphicsContextPriva #endif } +static void fillCurrentCairoPath(GraphicsContext* context, GraphicsContextPrivate* gcp, cairo_t* cairoContext) +{ + cairo_set_fill_rule(cairoContext, context->fillRule() == RULE_EVENODD ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING); + drawPathShadow(context, gcp, true, false); + + setPlatformFill(context, cairoContext, gcp); + cairo_new_path(cairoContext); +} + +static void strokeCurrentCairoPath(GraphicsContext* context, GraphicsContextPrivate* gcp, cairo_t* cairoContext) +{ + drawPathShadow(context, gcp, false, true); + setPlatformStroke(context, cairoContext, gcp); + cairo_new_path(cairoContext); +} + GraphicsContext::GraphicsContext(PlatformGraphicsContext* cr) : m_common(createGraphicsContextPrivate()) , m_data(new GraphicsContextPlatformPrivate) @@ -380,9 +426,8 @@ void GraphicsContext::drawEllipse(const IntRect& rect) setColor(cr, strokeColor()); cairo_set_line_width(cr, strokeThickness()); cairo_stroke(cr); - } - - cairo_new_path(cr); + } else + cairo_new_path(cr); } void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSpan) @@ -483,10 +528,7 @@ void GraphicsContext::drawConvexPolygon(size_t npoints, const FloatPoint* points cairo_save(cr); cairo_set_antialias(cr, shouldAntialias ? CAIRO_ANTIALIAS_DEFAULT : CAIRO_ANTIALIAS_NONE); - cairo_move_to(cr, points[0].x(), points[0].y()); - for (size_t i = 1; i < npoints; i++) - cairo_line_to(cr, points[i].x(), points[i].y()); - cairo_close_path(cr); + addConvexPolygonToContext(cr, npoints, points); if (fillColor().alpha()) { setColor(cr, fillColor()); @@ -498,9 +540,9 @@ void GraphicsContext::drawConvexPolygon(size_t npoints, const FloatPoint* points setColor(cr, strokeColor()); cairo_set_line_width(cr, strokeThickness()); cairo_stroke(cr); - } + } else + cairo_new_path(cr); - cairo_new_path(cr); cairo_restore(cr); } @@ -511,8 +553,20 @@ void GraphicsContext::clipConvexPolygon(size_t numPoints, const FloatPoint* poin if (numPoints <= 1) return; - - // FIXME: IMPLEMENT! + + cairo_t* cr = m_data->cr; + + cairo_new_path(cr); + cairo_fill_rule_t savedFillRule = cairo_get_fill_rule(cr); + cairo_antialias_t savedAntialiasRule = cairo_get_antialias(cr); + + cairo_set_antialias(cr, CAIRO_ANTIALIAS_DEFAULT); + cairo_set_fill_rule(cr, CAIRO_FILL_RULE_WINDING); + addConvexPolygonToContext(cr, numPoints, points); + cairo_clip(cr); + + cairo_set_antialias(cr, savedAntialiasRule); + cairo_set_fill_rule(cr, savedFillRule); } void GraphicsContext::fillPath() @@ -522,11 +576,8 @@ void GraphicsContext::fillPath() cairo_t* cr = m_data->cr; - cairo_set_fill_rule(cr, fillRule() == RULE_EVENODD ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING); - drawPathShadow(this, m_common, true, false); - - setPlatformFill(this, cr, m_common); - cairo_new_path(cr); + setPathOnCairoContext(cr, m_data->m_pendingPath.context()); + fillCurrentCairoPath(this, m_common, cr); } void GraphicsContext::strokePath() @@ -535,11 +586,8 @@ void GraphicsContext::strokePath() return; cairo_t* cr = m_data->cr; - drawPathShadow(this, m_common, false, true); - - setPlatformStroke(this, cr, m_common); - cairo_new_path(cr); - + setPathOnCairoContext(cr, m_data->m_pendingPath.context()); + strokeCurrentCairoPath(this, m_common, cr); } void GraphicsContext::drawPath() @@ -549,6 +597,8 @@ void GraphicsContext::drawPath() cairo_t* cr = m_data->cr; + setPathOnCairoContext(cr, m_data->m_pendingPath.context()); + cairo_set_fill_rule(cr, fillRule() == RULE_EVENODD ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING); drawPathShadow(this, m_common, true, true); @@ -565,7 +615,7 @@ void GraphicsContext::fillRect(const FloatRect& rect) cairo_t* cr = m_data->cr; cairo_save(cr); cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height()); - fillPath(); + fillCurrentCairoPath(this, m_common, cr); cairo_restore(cr); } @@ -673,7 +723,7 @@ void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int width, int #else int radius = (width - 1) / 2; for (unsigned i = 0; i < rectCount; i++) - addPath(Path::createRoundedRectangle(rects[i], FloatSize(radius, radius))); + appendWebCorePathToCairoContext(cr, Path::createRoundedRectangle(rects[i], FloatSize(radius, radius))); // Force the alpha to 50%. This matches what the Mac does with outline rings. Color ringColor(color.red(), color.green(), color.blue(), 127); @@ -700,14 +750,8 @@ void GraphicsContext::drawLineForText(const IntPoint& origin, int width, bool pr if (paintingDisabled()) return; - // This is a workaround for http://bugs.webkit.org/show_bug.cgi?id=15659 - StrokeStyle savedStrokeStyle = strokeStyle(); - setStrokeStyle(SolidStroke); - IntPoint endPoint = origin + IntSize(width, 0); drawLine(origin, endPoint); - - setStrokeStyle(savedStrokeStyle); } #if !PLATFORM(GTK) @@ -846,6 +890,7 @@ void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, int thickness if (paintingDisabled()) return; + cairo_t* cr = m_data->cr; clip(rect); Path p; @@ -855,9 +900,8 @@ void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, int thickness // Add inner ellipse r.inflate(-thickness); p.addEllipse(r); - addPath(p); + appendWebCorePathToCairoContext(cr, p); - cairo_t* cr = m_data->cr; cairo_fill_rule_t savedFillRule = cairo_get_fill_rule(cr); cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD); cairo_clip(cr); @@ -968,7 +1012,7 @@ void GraphicsContext::strokeRect(const FloatRect& rect, float width) cairo_save(cr); cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height()); cairo_set_line_width(cr, width); - strokePath(); + strokeCurrentCairoPath(this, m_common, cr); cairo_restore(cr); } @@ -1085,8 +1129,7 @@ void GraphicsContext::beginPath() if (paintingDisabled()) return; - cairo_t* cr = m_data->cr; - cairo_new_path(cr); + cairo_new_path(m_data->m_pendingPath.context()); } void GraphicsContext::addPath(const Path& path) @@ -1094,10 +1137,10 @@ void GraphicsContext::addPath(const Path& path) if (paintingDisabled()) return; - cairo_t* cr = m_data->cr; - cairo_path_t* p = cairo_copy_path(path.platformPath()->m_cr); - cairo_append_path(cr, p); - cairo_path_destroy(p); + cairo_matrix_t currentMatrix; + cairo_get_matrix(m_data->cr, ¤tMatrix); + cairo_set_matrix(m_data->m_pendingPath.context(), ¤tMatrix); + appendWebCorePathToCairoContext(m_data->m_pendingPath.context(), path); } void GraphicsContext::clip(const Path& path) @@ -1106,7 +1149,7 @@ void GraphicsContext::clip(const Path& path) return; cairo_t* cr = m_data->cr; - cairo_path_t* p = cairo_copy_path(path.platformPath()->m_cr); + cairo_path_t* p = cairo_copy_path(path.platformPath()->context()); cairo_append_path(cr, p); cairo_path_destroy(p); cairo_fill_rule_t savedFillRule = cairo_get_fill_rule(cr); @@ -1130,7 +1173,7 @@ void GraphicsContext::clipOut(const Path& path) double x1, y1, x2, y2; cairo_clip_extents(cr, &x1, &y1, &x2, &y2); cairo_rectangle(cr, x1, y1, x2 - x1, y2 - y1); - addPath(path); + appendWebCorePathToCairoContext(cr, path); cairo_fill_rule_t savedFillRule = cairo_get_fill_rule(cr); cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD); @@ -1189,8 +1232,7 @@ void GraphicsContext::fillRoundedRect(const IntRect& r, const IntSize& topLeft, cairo_t* cr = m_data->cr; cairo_save(cr); - beginPath(); - addPath(Path::createRoundedRectangle(r, topLeft, topRight, bottomLeft, bottomRight)); + appendWebCorePathToCairoContext(cr, Path::createRoundedRectangle(r, topLeft, topRight, bottomLeft, bottomRight)); setColor(cr, color); drawPathShadow(this, m_common, true, false); cairo_fill(cr); diff --git a/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h b/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h index 5e38832..97e7e07 100644 --- a/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h +++ b/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h @@ -95,6 +95,7 @@ public: cairo_t* cr; Vector<float> layers; + CairoPath m_pendingPath; #if PLATFORM(GTK) GdkEventExpose* expose; diff --git a/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp b/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp index c298e18..1a43e54 100644 --- a/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp +++ b/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp @@ -277,6 +277,7 @@ void ImageBuffer::putPremultipliedImageData(ImageData* source, const IntRect& so putImageData<Premultiplied>(source, sourceRect, destPoint, m_data, m_size); } +#if !PLATFORM(GTK) static cairo_status_t writeFunction(void* closure, const unsigned char* data, unsigned int length) { Vector<char>* in = reinterpret_cast<Vector<char>*>(closure); @@ -303,5 +304,6 @@ String ImageBuffer::toDataURL(const String& mimeType, const double*) const return "data:" + actualMimeType + ";base64," + String(out.data(), out.size()); } +#endif } // namespace WebCore diff --git a/WebCore/platform/graphics/cairo/PathCairo.cpp b/WebCore/platform/graphics/cairo/PathCairo.cpp index d880626..05c6952 100644 --- a/WebCore/platform/graphics/cairo/PathCairo.cpp +++ b/WebCore/platform/graphics/cairo/PathCairo.cpp @@ -51,8 +51,8 @@ Path::~Path() Path::Path(const Path& other) : m_path(new CairoPath()) { - cairo_t* cr = platformPath()->m_cr; - cairo_path_t* p = cairo_copy_path(other.platformPath()->m_cr); + cairo_t* cr = platformPath()->context(); + cairo_path_t* p = cairo_copy_path(other.platformPath()->context()); cairo_append_path(cr, p); cairo_path_destroy(p); } @@ -63,8 +63,8 @@ Path& Path::operator=(const Path& other) return *this; clear(); - cairo_t* cr = platformPath()->m_cr; - cairo_path_t* p = cairo_copy_path(other.platformPath()->m_cr); + cairo_t* cr = platformPath()->context(); + cairo_path_t* p = cairo_copy_path(other.platformPath()->context()); cairo_append_path(cr, p); cairo_path_destroy(p); return *this; @@ -72,13 +72,13 @@ Path& Path::operator=(const Path& other) void Path::clear() { - cairo_t* cr = platformPath()->m_cr; + cairo_t* cr = platformPath()->context(); cairo_new_path(cr); } bool Path::isEmpty() const { - return !cairo_has_current_point(platformPath()->m_cr); + return !cairo_has_current_point(platformPath()->context()); } bool Path::hasCurrentPoint() const @@ -91,31 +91,31 @@ FloatPoint Path::currentPoint() const // FIXME: Is this the correct way? double x; double y; - cairo_get_current_point(platformPath()->m_cr, &x, &y); + cairo_get_current_point(platformPath()->context(), &x, &y); return FloatPoint(x, y); } void Path::translate(const FloatSize& p) { - cairo_t* cr = platformPath()->m_cr; + cairo_t* cr = platformPath()->context(); cairo_translate(cr, -p.width(), -p.height()); } void Path::moveTo(const FloatPoint& p) { - cairo_t* cr = platformPath()->m_cr; + cairo_t* cr = platformPath()->context(); cairo_move_to(cr, p.x(), p.y()); } void Path::addLineTo(const FloatPoint& p) { - cairo_t* cr = platformPath()->m_cr; + cairo_t* cr = platformPath()->context(); cairo_line_to(cr, p.x(), p.y()); } void Path::addRect(const FloatRect& rect) { - cairo_t* cr = platformPath()->m_cr; + cairo_t* cr = platformPath()->context(); cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height()); } @@ -124,7 +124,7 @@ void Path::addRect(const FloatRect& rect) */ void Path::addQuadCurveTo(const FloatPoint& controlPoint, const FloatPoint& point) { - cairo_t* cr = platformPath()->m_cr; + cairo_t* cr = platformPath()->context(); double x, y; double x1 = controlPoint.x(); double y1 = controlPoint.y(); @@ -139,7 +139,7 @@ void Path::addQuadCurveTo(const FloatPoint& controlPoint, const FloatPoint& poin void Path::addBezierCurveTo(const FloatPoint& controlPoint1, const FloatPoint& controlPoint2, const FloatPoint& controlPoint3) { - cairo_t* cr = platformPath()->m_cr; + cairo_t* cr = platformPath()->context(); cairo_curve_to(cr, controlPoint1.x(), controlPoint1.y(), controlPoint2.x(), controlPoint2.y(), controlPoint3.x(), controlPoint3.y()); @@ -152,7 +152,7 @@ void Path::addArc(const FloatPoint& p, float r, float sa, float ea, bool anticlo if (!isfinite(r) || !isfinite(sa) || !isfinite(ea)) return; - cairo_t* cr = platformPath()->m_cr; + cairo_t* cr = platformPath()->context(); if (anticlockwise) cairo_arc_negative(cr, p.x(), p.y(), r, sa, ea); else @@ -164,7 +164,7 @@ void Path::addArcTo(const FloatPoint& p1, const FloatPoint& p2, float radius) if (isEmpty()) return; - cairo_t* cr = platformPath()->m_cr; + cairo_t* cr = platformPath()->context(); double x0, y0; cairo_get_current_point(cr, &x0, &y0); @@ -237,7 +237,7 @@ void Path::addArcTo(const FloatPoint& p1, const FloatPoint& p2, float radius) void Path::addEllipse(const FloatRect& rect) { - cairo_t* cr = platformPath()->m_cr; + cairo_t* cr = platformPath()->context(); cairo_save(cr); float yRadius = .5 * rect.height(); float xRadius = .5 * rect.width(); @@ -249,13 +249,13 @@ void Path::addEllipse(const FloatRect& rect) void Path::closeSubpath() { - cairo_t* cr = platformPath()->m_cr; + cairo_t* cr = platformPath()->context(); cairo_close_path(cr); } FloatRect Path::boundingRect() const { - cairo_t* cr = platformPath()->m_cr; + cairo_t* cr = platformPath()->context(); double x0, x1, y0, y1; cairo_path_extents(cr, &x0, &y0, &x1, &y1); return FloatRect(x0, y0, x1 - x0, y1 - y0); @@ -263,7 +263,7 @@ FloatRect Path::boundingRect() const FloatRect Path::strokeBoundingRect(StrokeStyleApplier* applier) { - cairo_t* cr = platformPath()->m_cr; + cairo_t* cr = platformPath()->context(); if (applier) { GraphicsContext gc(cr); applier->strokeStyle(&gc); @@ -276,7 +276,7 @@ FloatRect Path::strokeBoundingRect(StrokeStyleApplier* applier) bool Path::contains(const FloatPoint& point, WindRule rule) const { - cairo_t* cr = platformPath()->m_cr; + cairo_t* cr = platformPath()->context(); cairo_fill_rule_t cur = cairo_get_fill_rule(cr); cairo_set_fill_rule(cr, rule == RULE_EVENODD ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING); bool contains = cairo_in_fill(cr, point.x(), point.y()); @@ -287,7 +287,7 @@ bool Path::contains(const FloatPoint& point, WindRule rule) const bool Path::strokeContains(StrokeStyleApplier* applier, const FloatPoint& point) const { ASSERT(applier); - cairo_t* cr = platformPath()->m_cr; + cairo_t* cr = platformPath()->context(); GraphicsContext gc(cr); applier->strokeStyle(&gc); @@ -296,7 +296,7 @@ bool Path::strokeContains(StrokeStyleApplier* applier, const FloatPoint& point) void Path::apply(void* info, PathApplierFunction function) const { - cairo_t* cr = platformPath()->m_cr; + cairo_t* cr = platformPath()->context(); cairo_path_t* path = cairo_copy_path(cr); cairo_path_data_t* data; PathElement pelement; @@ -334,10 +334,10 @@ void Path::apply(void* info, PathApplierFunction function) const void Path::transform(const AffineTransform& trans) { - cairo_t* m_cr = platformPath()->m_cr; + cairo_t* cr = platformPath()->context(); cairo_matrix_t c_matrix = cairo_matrix_t(trans); cairo_matrix_invert(&c_matrix); - cairo_transform(m_cr, &c_matrix); + cairo_transform(cr, &c_matrix); } String Path::debugString() const @@ -346,7 +346,7 @@ String Path::debugString() const return String(); String pathString; - cairo_path_t* path = cairo_copy_path(platformPath()->m_cr); + cairo_path_t* path = cairo_copy_path(platformPath()->context()); cairo_path_data_t* data; for (int i = 0; i < path->num_data; i += path->data[i].header.length) { diff --git a/WebCore/platform/graphics/chromium/FontCustomPlatformData.cpp b/WebCore/platform/graphics/chromium/FontCustomPlatformData.cpp index 74f1e26..b6d6e65 100644 --- a/WebCore/platform/graphics/chromium/FontCustomPlatformData.cpp +++ b/WebCore/platform/graphics/chromium/FontCustomPlatformData.cpp @@ -201,4 +201,13 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer) #endif } +bool FontCustomPlatformData::supportsFormat(const String& format) +{ + return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype") +#if ENABLE(OPENTYPE_SANITIZER) + || equalIgnoringCase(format, "woff") +#endif + ; +} + } diff --git a/WebCore/platform/graphics/chromium/FontCustomPlatformData.h b/WebCore/platform/graphics/chromium/FontCustomPlatformData.h index e1fbd48..03e1b8c 100644 --- a/WebCore/platform/graphics/chromium/FontCustomPlatformData.h +++ b/WebCore/platform/graphics/chromium/FontCustomPlatformData.h @@ -46,6 +46,7 @@ namespace WebCore { class FontPlatformData; class SharedBuffer; +class String; struct FontCustomPlatformData : Noncopyable { #if OS(WINDOWS) @@ -64,6 +65,8 @@ struct FontCustomPlatformData : Noncopyable { FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontRenderingMode = NormalRenderingMode); + static bool supportsFormat(const String&); + #if OS(WINDOWS) HANDLE m_fontReference; String m_name; diff --git a/WebCore/platform/graphics/chromium/GLES2Canvas.cpp b/WebCore/platform/graphics/chromium/GLES2Canvas.cpp index ec188c8..9fc8917 100644 --- a/WebCore/platform/graphics/chromium/GLES2Canvas.cpp +++ b/WebCore/platform/graphics/chromium/GLES2Canvas.cpp @@ -99,6 +99,10 @@ GLES2Canvas::GLES2Canvas(GLES2Context* context, const IntSize& size) m_stateStack.append(State()); m_state = &m_stateStack.last(); + + // Force the source over composite mode to be applied. + m_lastCompositeOp = CompositeClear; + applyCompositeOperator(CompositeSourceOver); } GLES2Canvas::~GLES2Canvas() diff --git a/WebCore/platform/graphics/chromium/GLES2Canvas.h b/WebCore/platform/graphics/chromium/GLES2Canvas.h index e3a7a3b..4e500be 100644 --- a/WebCore/platform/graphics/chromium/GLES2Canvas.h +++ b/WebCore/platform/graphics/chromium/GLES2Canvas.h @@ -42,6 +42,7 @@ #include <wtf/HashMap.h> #include <wtf/Noncopyable.h> +#include <wtf/Vector.h> namespace WebCore { diff --git a/WebCore/platform/graphics/gtk/CairoUtilities.cpp b/WebCore/platform/graphics/gtk/CairoUtilities.cpp new file mode 100644 index 0000000..81e00f0 --- /dev/null +++ b/WebCore/platform/graphics/gtk/CairoUtilities.cpp @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2010 Igalia S.L. + * + * 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 COMPUTER, 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 "CairoUtilities.h" + +#include <cairo.h> +#include <gtk/gtk.h> + +static inline unsigned char* getCairoSurfacePixel(unsigned char* data, unsigned x, unsigned y, unsigned rowStride) +{ + return data + (y * rowStride) + x * 4; +} + +static inline guchar* getGdkPixbufPixel(guchar* data, unsigned x, unsigned y, unsigned rowStride) +{ + return data + (y * rowStride) + x * 4; +} + +GdkPixbuf* cairoImageSurfaceToGdkPixbuf(cairo_surface_t* surface) +{ + int width = cairo_image_surface_get_width(surface); + int height = cairo_image_surface_get_height(surface); + unsigned char* surfaceData = cairo_image_surface_get_data(surface); + int surfaceRowStride = cairo_image_surface_get_stride(surface); + + GdkPixbuf* dest = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, width, height); + if (!dest) + return 0; + + guchar* pixbufData = gdk_pixbuf_get_pixels(dest); + int pixbufRowStride = gdk_pixbuf_get_rowstride(dest); + + /* From: http://cairographics.org/manual/cairo-image-surface.html#cairo-format-t + * "CAIRO_FORMAT_ARGB32: each pixel is a 32-bit quantity, with alpha in + * the upper 8 bits, then red, then green, then blue. The 32-bit + * quantities are stored native-endian. Pre-multiplied alpha is used. + * (That is, 50% transparent red is 0x80800000, not 0x80ff0000.)" + * + * See http://developer.gimp.org/api/2.0/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf + * for information on the structure of GdkPixbufs stored with GDK_COLORSPACE_RGB. + * + * RGB color channels in CAIRO_FORMAT_ARGB32 are stored based on the + * endianness of the machine and are also multiplied by the alpha channel. + * To properly transfer the data from the Cairo surface we must divide each + * of the RGB channels by the alpha channel and then reorder all channels + * if this machine is little-endian. + */ + for (int y = 0; y < height; y++) { + for (int x = 0; x < width; x++) { + unsigned char* source = getCairoSurfacePixel(surfaceData, x, y, surfaceRowStride); + guchar* dest = getGdkPixbufPixel(pixbufData, x, y, pixbufRowStride); + +#if G_BYTE_ORDER == G_LITTLE_ENDIAN + guchar alpha = source[3]; + dest[0] = alpha ? ((source[2] * 255) / alpha) : 0; + dest[1] = alpha ? ((source[1] * 255) / alpha) : 0; + dest[2] = alpha ? ((source[0] * 255) / alpha) : 0; + dest[3] = alpha; +#else + guchar alpha = source[0]; + dest[0] = alpha ? ((source[1] * 255) / alpha) : 0; + dest[1] = alpha ? ((source[2] * 255) / alpha) : 0; + dest[2] = alpha ? ((source[3] * 255) / alpha) : 0; + dest[3] = alpha; +#endif + } + } + + return dest; +} + diff --git a/WebCore/platform/graphics/gtk/CairoUtilities.h b/WebCore/platform/graphics/gtk/CairoUtilities.h new file mode 100644 index 0000000..89eb458 --- /dev/null +++ b/WebCore/platform/graphics/gtk/CairoUtilities.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2010 Igalia S.L. + * + * 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 COMPUTER, 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. + */ + +#ifndef CairoUtilities_h +#define CairoUtilities_h + +typedef struct _cairo_surface cairo_surface_t; +typedef struct _GdkPixbuf GdkPixbuf; +GdkPixbuf* cairoImageSurfaceToGdkPixbuf(cairo_surface_t* surface); + +#endif // CairoUtilities_h diff --git a/WebCore/platform/graphics/gtk/FontCustomPlatformDataPango.cpp b/WebCore/platform/graphics/gtk/FontCustomPlatformDataPango.cpp index 4f2f2bb..d5f3173 100644 --- a/WebCore/platform/graphics/gtk/FontCustomPlatformDataPango.cpp +++ b/WebCore/platform/graphics/gtk/FontCustomPlatformDataPango.cpp @@ -46,4 +46,9 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer) return 0; } +bool FontCustomPlatformData::supportsFormat(const String& /* format */) +{ + return false; +} + } diff --git a/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp b/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp new file mode 100644 index 0000000..d0b0274 --- /dev/null +++ b/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2010 Igalia S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "config.h" +#include "ImageBuffer.h" + +#include "Base64.h" +#include "CairoUtilities.h" +#include "GOwnPtr.h" +#include "GRefPtrGtk.h" +#include "MIMETypeRegistry.h" +#include <cairo.h> +#include <gtk/gtk.h> +#include <wtf/text/CString.h> + +namespace WebCore { + +String ImageBuffer::toDataURL(const String& mimeType, const double* quality) const +{ + ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); + + if (!mimeType.startsWith("image/")) + return "data:,"; + + // List of supported image types comes from the GdkPixbuf documentation. + // http://library.gnome.org/devel/gdk-pixbuf/stable/gdk-pixbuf-file-saving.html#gdk-pixbuf-save-to-bufferv + String type = mimeType.substring(sizeof "image"); + if (type != "jpeg" && type != "png" && type != "tiff" && type != "ico" && type != "bmp") + return "data:,"; + + GRefPtr<GdkPixbuf> pixbuf = cairoImageSurfaceToGdkPixbuf(m_data.m_surface); + if (!pixbuf) + return "data:,"; + + GOwnPtr<gchar> buffer(0); + gsize bufferSize; + GError* error = 0; + gboolean success = FALSE; + if (type == "jpeg" && quality && *quality >= 0.0 && *quality <= 1.0) { + String qualityString = String::format("%f", *quality); + success = gdk_pixbuf_save_to_buffer(pixbuf.get(), &buffer.outPtr(), &bufferSize, + type.utf8().data(), &error, "quality", qualityString.utf8().data(), NULL); + } else { + success = gdk_pixbuf_save_to_buffer(pixbuf.get(), &buffer.outPtr(), &bufferSize, type.utf8().data(), &error, NULL); + } + + if (!success) + return "data:,"; + + Vector<char> out; + base64Encode(reinterpret_cast<const char*>(buffer.get()), bufferSize, out); + out.append('\0'); + + return String::format("data:%s;base64,%s", mimeType.utf8().data(), out.data()); +} + +} diff --git a/WebCore/platform/graphics/gtk/ImageGtk.cpp b/WebCore/platform/graphics/gtk/ImageGtk.cpp index 3de8495..30db6d7 100644 --- a/WebCore/platform/graphics/gtk/ImageGtk.cpp +++ b/WebCore/platform/graphics/gtk/ImageGtk.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "BitmapImage.h" +#include "CairoUtilities.h" #include "GOwnPtr.h" #include "SharedBuffer.h" #include <wtf/text/CString.h> @@ -172,67 +173,9 @@ PassRefPtr<Image> Image::loadPlatformThemeIcon(const char* name, int size) return loadImageFromFile(getThemeIconFileName(name, size)); } -static inline unsigned char* getCairoSurfacePixel(unsigned char* data, unsigned x, unsigned y, unsigned rowStride) -{ - return data + (y * rowStride) + x * 4; -} - -static inline guchar* getGdkPixbufPixel(guchar* data, unsigned x, unsigned y, unsigned rowStride) -{ - return data + (y * rowStride) + x * 4; -} - GdkPixbuf* BitmapImage::getGdkPixbuf() { - int width = cairo_image_surface_get_width(frameAtIndex(currentFrame())); - int height = cairo_image_surface_get_height(frameAtIndex(currentFrame())); - unsigned char* surfaceData = cairo_image_surface_get_data(frameAtIndex(currentFrame())); - int surfaceRowStride = cairo_image_surface_get_stride(frameAtIndex(currentFrame())); - - GdkPixbuf* dest = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, width, height); - if (!dest) - return 0; - - guchar* pixbufData = gdk_pixbuf_get_pixels(dest); - int pixbufRowStride = gdk_pixbuf_get_rowstride(dest); - - /* From: http://cairographics.org/manual/cairo-image-surface.html#cairo-format-t - * "CAIRO_FORMAT_ARGB32: each pixel is a 32-bit quantity, with alpha in - * the upper 8 bits, then red, then green, then blue. The 32-bit - * quantities are stored native-endian. Pre-multiplied alpha is used. - * (That is, 50% transparent red is 0x80800000, not 0x80ff0000.)" - * - * See http://developer.gimp.org/api/2.0/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf - * for information on the structure of GdkPixbufs stored with GDK_COLORSPACE_RGB. - * - * RGB color channels in CAIRO_FORMAT_ARGB32 are stored based on the - * endianness of the machine and are also multiplied by the alpha channel. - * To properly transfer the data from the Cairo surface we must divide each - * of the RGB channels by the alpha channel and then reorder all channels - * if this machine is little-endian. - */ - for (int y = 0; y < height; y++) { - for (int x = 0; x < width; x++) { - unsigned char* source = getCairoSurfacePixel(surfaceData, x, y, surfaceRowStride); - guchar* dest = getGdkPixbufPixel(pixbufData, x, y, pixbufRowStride); - -#if G_BYTE_ORDER == G_LITTLE_ENDIAN - guchar alpha = source[3]; - dest[0] = alpha ? ((source[2] * 255) / alpha) : 0; - dest[1] = alpha ? ((source[1] * 255) / alpha) : 0; - dest[2] = alpha ? ((source[0] * 255) / alpha) : 0; - dest[3] = alpha; -#else - guchar alpha = source[0]; - dest[0] = alpha ? ((source[1] * 255) / alpha) : 0; - dest[1] = alpha ? ((source[2] * 255) / alpha) : 0; - dest[2] = alpha ? ((source[3] * 255) / alpha) : 0; - dest[3] = alpha; -#endif - } - } - - return dest; + return cairoImageSurfaceToGdkPixbuf(frameAtIndex(currentFrame())); } } diff --git a/WebCore/platform/graphics/haiku/FontCustomPlatformData.cpp b/WebCore/platform/graphics/haiku/FontCustomPlatformData.cpp index 6008bb1..4b39fdd 100644 --- a/WebCore/platform/graphics/haiku/FontCustomPlatformData.cpp +++ b/WebCore/platform/graphics/haiku/FontCustomPlatformData.cpp @@ -42,4 +42,9 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer) return 0; } +bool FontCustomPlatformData::supportsFormat(const String& /* format */) +{ + return false; +} + } diff --git a/WebCore/platform/graphics/haiku/FontCustomPlatformData.h b/WebCore/platform/graphics/haiku/FontCustomPlatformData.h index c5a814e..9db6cc6 100644 --- a/WebCore/platform/graphics/haiku/FontCustomPlatformData.h +++ b/WebCore/platform/graphics/haiku/FontCustomPlatformData.h @@ -28,12 +28,15 @@ namespace WebCore { class FontPlatformData; class SharedBuffer; + class String; struct FontCustomPlatformData : Noncopyable { public: FontCustomPlatformData() { } ~FontCustomPlatformData(); + static bool supportsFormat(const String&); + FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontRenderingMode = NormalRenderingMode); }; diff --git a/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp b/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp index 256b5a4..c591ddc 100644 --- a/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp +++ b/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 Apple Computer, Inc. + * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -21,10 +21,11 @@ #include "config.h" #include "FontCustomPlatformData.h" -#include <ApplicationServices/ApplicationServices.h> -#include "SharedBuffer.h" #include "FontPlatformData.h" #include "OpenTypeSanitizer.h" +#include "SharedBuffer.h" +#include "WOFFFileFormat.h" +#include <ApplicationServices/ApplicationServices.h> namespace WebCore { @@ -50,6 +51,16 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer) if (!transcodeBuffer) return 0; // validation failed. buffer = transcodeBuffer.get(); +#else + RefPtr<SharedBuffer> sfntBuffer; + if (isWOFF(buffer)) { + Vector<char> sfnt; + if (!convertWOFFToSfnt(buffer, sfnt)) + return 0; + + sfntBuffer = SharedBuffer::adoptVector(sfnt); + buffer = sfntBuffer.get(); + } #endif ATSFontContainerRef containerRef = 0; @@ -60,7 +71,7 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer) #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) RetainPtr<CFDataRef> bufferData(AdoptCF, buffer->createCFData()); RetainPtr<CGDataProviderRef> dataProvider(AdoptCF, CGDataProviderCreateWithCFData(bufferData.get())); - + cgFontRef.adoptCF(CGFontCreateWithDataProvider(dataProvider.get())); if (!cgFontRef) return 0; @@ -101,4 +112,9 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer) return new FontCustomPlatformData(containerRef, fontRef, cgFontRef.releaseRef()); } +bool FontCustomPlatformData::supportsFormat(const String& format) +{ + return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype") || equalIgnoringCase(format, "woff"); +} + } diff --git a/WebCore/platform/graphics/mac/FontCustomPlatformData.h b/WebCore/platform/graphics/mac/FontCustomPlatformData.h index 2c1222f..f2cd2cc 100644 --- a/WebCore/platform/graphics/mac/FontCustomPlatformData.h +++ b/WebCore/platform/graphics/mac/FontCustomPlatformData.h @@ -33,6 +33,7 @@ namespace WebCore { class FontPlatformData; class SharedBuffer; +class String; struct FontCustomPlatformData : Noncopyable { FontCustomPlatformData(ATSFontContainerRef container, ATSFontRef atsFont, CGFontRef cgFont) @@ -42,6 +43,8 @@ struct FontCustomPlatformData : Noncopyable { FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontRenderingMode = NormalRenderingMode); + static bool supportsFormat(const String&); + ATSFontContainerRef m_atsContainer; ATSFontRef m_atsFont; CGFontRef m_cgFont; diff --git a/WebCore/platform/graphics/qt/FontCustomPlatformData.h b/WebCore/platform/graphics/qt/FontCustomPlatformData.h index 0f2a6ce..6837059 100644 --- a/WebCore/platform/graphics/qt/FontCustomPlatformData.h +++ b/WebCore/platform/graphics/qt/FontCustomPlatformData.h @@ -27,8 +27,9 @@ namespace WebCore { -class SharedBuffer; class FontPlatformData; +class SharedBuffer; +class String; struct FontCustomPlatformData : Noncopyable { ~FontCustomPlatformData(); @@ -37,6 +38,8 @@ struct FontCustomPlatformData : Noncopyable { int m_handle; FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontRenderingMode = NormalRenderingMode); + + static bool supportsFormat(const String&); }; FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer); diff --git a/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp b/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp index 6e9d053..dbf0b16 100644 --- a/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp +++ b/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp @@ -61,5 +61,9 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer) return data; } +bool FontCustomPlatformData::supportsFormat(const String& format) +{ + return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype"); } +} diff --git a/WebCore/platform/graphics/skia/ImageBufferSkia.cpp b/WebCore/platform/graphics/skia/ImageBufferSkia.cpp index 26c44f2..3eb033d 100644 --- a/WebCore/platform/graphics/skia/ImageBufferSkia.cpp +++ b/WebCore/platform/graphics/skia/ImageBufferSkia.cpp @@ -198,11 +198,13 @@ PassRefPtr<ImageData> getImageData(const IntRect& rect, const SkBitmap& bitmap, PassRefPtr<ImageData> ImageBuffer::getUnmultipliedImageData(const IntRect& rect) const { + context()->platformContext()->syncSoftwareCanvas(); return getImageData<Unmultiplied>(rect, *context()->platformContext()->bitmap(), m_size); } PassRefPtr<ImageData> ImageBuffer::getPremultipliedImageData(const IntRect& rect) const { + context()->platformContext()->syncSoftwareCanvas(); return getImageData<Premultiplied>(rect, *context()->platformContext()->bitmap(), m_size); } diff --git a/WebCore/platform/graphics/skia/ImageSkia.cpp b/WebCore/platform/graphics/skia/ImageSkia.cpp index d1d1692..a2485e6 100644 --- a/WebCore/platform/graphics/skia/ImageSkia.cpp +++ b/WebCore/platform/graphics/skia/ImageSkia.cpp @@ -47,6 +47,11 @@ #include "skia/ext/image_operations.h" #include "skia/ext/platform_canvas.h" +#if USE(GLES2_RENDERING) +#include "GLES2Canvas.h" +#include "GLES2Context.h" +#include "SkPixelRef.h" +#endif namespace WebCore { @@ -404,6 +409,24 @@ void Image::drawPattern(GraphicsContext* context, context->platformContext()->paintSkPaint(destRect, paint); } +#if USE(GLES2_RENDERING) +static void drawBitmapGLES2(GraphicsContext* ctxt, NativeImageSkia* bitmap, const FloatRect& srcRect, const FloatRect& dstRect, ColorSpace styleColorSpace, CompositeOperator compositeOp) +{ + ctxt->platformContext()->prepareForHardwareDraw(); + GLES2Canvas* gpuCanvas = ctxt->platformContext()->gpuCanvas(); + gpuCanvas->gles2Context()->makeCurrent(); + GLES2Texture* texture = gpuCanvas->getTexture(bitmap); + if (!texture) { + ASSERT(bitmap->config() == SkBitmap::kARGB_8888_Config); + ASSERT(bitmap->rowBytes() == bitmap->width() * 4); + texture = gpuCanvas->createTexture(bitmap, GLES2Texture::BGRA8, bitmap->width(), bitmap->height()); + ASSERT(bitmap->pixelRef()); + texture->load(bitmap->pixelRef()->pixels()); + } + gpuCanvas->drawTexturedRect(texture, srcRect, dstRect, styleColorSpace, compositeOp); +} +#endif + // ================================================ // BitmapImage Class // ================================================ @@ -429,7 +452,7 @@ void BitmapImage::checkForSolidColor() } void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, - const FloatRect& srcRect, ColorSpace, CompositeOperator compositeOp) + const FloatRect& srcRect, ColorSpace colorSpace, CompositeOperator compositeOp) { if (!m_source.initialized()) return; @@ -439,16 +462,24 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, // causing flicker and wasting CPU. startAnimation(); - const NativeImageSkia* bm = nativeImageForCurrentFrame(); + NativeImageSkia* bm = nativeImageForCurrentFrame(); if (!bm) return; // It's too early and we don't have an image yet. +#if USE(GLES2_RENDERING) + if (ctxt->platformContext()->useGPU()) { + drawBitmapGLES2(ctxt, bm, srcRect, dstRect, colorSpace, compositeOp); + return; + } +#endif FloatRect normDstRect = normalizeRect(dstRect); FloatRect normSrcRect = normalizeRect(srcRect); if (normSrcRect.isEmpty() || normDstRect.isEmpty()) return; // Nothing to draw. + ctxt->platformContext()->prepareForSoftwareDraw(); + paintSkBitmap(ctxt->platformContext(), *bm, enclosingIntRect(normSrcRect), @@ -470,6 +501,15 @@ void BitmapImageSingleFrameSkia::draw(GraphicsContext* ctxt, if (normSrcRect.isEmpty() || normDstRect.isEmpty()) return; // Nothing to draw. +#if USE(GLES2_RENDERING) + if (ctxt->platformContext()->useGPU()) { + drawBitmapGLES2(ctxt, &m_nativeImage, srcRect, dstRect, styleColorSpace, compositeOp); + return; + } +#endif + + ctxt->platformContext()->prepareForSoftwareDraw(); + paintSkBitmap(ctxt->platformContext(), m_nativeImage, enclosingIntRect(normSrcRect), diff --git a/WebCore/platform/graphics/win/FontCustomPlatformData.cpp b/WebCore/platform/graphics/win/FontCustomPlatformData.cpp index e9f83ab..6e59ad7 100644 --- a/WebCore/platform/graphics/win/FontCustomPlatformData.cpp +++ b/WebCore/platform/graphics/win/FontCustomPlatformData.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -26,6 +26,7 @@ #include "OpenTypeUtilities.h" #include "SharedBuffer.h" #include "SoftLinking.h" +#include "WOFFFileFormat.h" #include <ApplicationServices/ApplicationServices.h> #include <WebKitSystemInterface/WebKitSystemInterface.h> #include <wtf/RetainPtr.h> @@ -167,6 +168,16 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer) ASSERT_ARG(buffer, buffer); ASSERT(T2embedLibrary()); + RefPtr<SharedBuffer> sfntBuffer; + if (isWOFF(buffer)) { + Vector<char> sfnt; + if (!convertWOFFToSfnt(buffer, sfnt)) + return 0; + + sfntBuffer = SharedBuffer::adoptVector(sfnt); + buffer = sfntBuffer.get(); + } + // Introduce the font to GDI. AddFontMemResourceEx cannot be used, because it will pollute the process's // font namespace (Windows has no API for creating an HFONT from data without exposing the font to the // entire process first). TTLoadEmbeddedFont lets us override the font family name, so using a unique name @@ -200,4 +211,9 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer) return new FontCustomPlatformData(fontReference, fontName); } +bool FontCustomPlatformData::supportsFormat(const String& format) +{ + return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype") || equalIgnoringCase(format, "woff"); +} + } diff --git a/WebCore/platform/graphics/win/FontCustomPlatformData.h b/WebCore/platform/graphics/win/FontCustomPlatformData.h index f75f12a..46ddbb5 100644 --- a/WebCore/platform/graphics/win/FontCustomPlatformData.h +++ b/WebCore/platform/graphics/win/FontCustomPlatformData.h @@ -31,6 +31,7 @@ namespace WebCore { class FontPlatformData; class SharedBuffer; +class String; struct FontCustomPlatformData : Noncopyable { FontCustomPlatformData(HANDLE fontReference, const String& name) @@ -43,6 +44,8 @@ struct FontCustomPlatformData : Noncopyable { FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontRenderingMode = NormalRenderingMode); + static bool supportsFormat(const String&); + HANDLE m_fontReference; String m_name; }; diff --git a/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.cpp b/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.cpp index e54d85a..35839f5 100644 --- a/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.cpp +++ b/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.cpp @@ -58,4 +58,9 @@ FontCustomPlatformDataCairo* createFontCustomPlatformData(SharedBuffer* buffer) return new FontCustomPlatformDataCairo(fontFace); } +bool FontCustomPlatformData::supportsFormat(const String& format) +{ + return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype"); +} + } diff --git a/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.h b/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.h index 87794b5..75fe3d1 100644 --- a/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.h +++ b/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.h @@ -29,6 +29,7 @@ namespace WebCore { class FontPlatformData; class SharedBuffer; +class String; struct FontCustomPlatformDataCairo : Noncopyable { FontCustomPlatformDataCairo(cairo_font_face_t* fontFace) @@ -39,6 +40,8 @@ struct FontCustomPlatformDataCairo : Noncopyable { FontPlatformData fontPlatformData(int size, bool bold, bool italic); + static bool supportsFormat(const String&); + cairo_font_face_t* m_fontFace; }; diff --git a/WebCore/platform/graphics/win/WKCACFLayer.cpp b/WebCore/platform/graphics/win/WKCACFLayer.cpp index d3928f1..b5f3427 100644 --- a/WebCore/platform/graphics/win/WKCACFLayer.cpp +++ b/WebCore/platform/graphics/win/WKCACFLayer.cpp @@ -29,7 +29,6 @@ #include "WKCACFLayer.h" -#include "WKCACFContextFlusher.h" #include "WKCACFLayerRenderer.h" #include <wtf/text/CString.h> @@ -123,7 +122,6 @@ static CFStringRef toCACFFilterType(WKCACFLayer::FilterType type) case WKCACFLayer::Linear: return kCACFFilterLinear; case WKCACFLayer::Nearest: return kCACFFilterNearest; case WKCACFLayer::Trilinear: return kCACFFilterTrilinear; - case WKCACFLayer::Lanczos: return kCACFFilterLanczos; default: return 0; } } @@ -136,9 +134,6 @@ static WKCACFLayer::FilterType fromCACFFilterType(CFStringRef string) if (CFEqual(string, kCACFFilterTrilinear)) return WKCACFLayer::Trilinear; - if (CFEqual(string, kCACFFilterLanczos)) - return WKCACFLayer::Lanczos; - return WKCACFLayer::Linear; } @@ -180,15 +175,6 @@ void WKCACFLayer::setNeedsCommit() { WKCACFLayer* root = rootLayer(); - CACFContextRef context = CACFLayerGetContext(root->layer()); - - // The context might now be set yet. This happens if a property gets set - // before placing the layer in the tree. In this case we don't need to - // worry about remembering the context because we will when the layer is - // added to the tree. - if (context) - WKCACFContextFlusher::shared().addContext(context); - // Call setNeedsRender on the root layer, which will cause a render to // happen in WKCACFLayerRenderer root->setNeedsRender(); diff --git a/WebCore/platform/graphics/win/WKCACFLayer.h b/WebCore/platform/graphics/win/WKCACFLayer.h index 5e8eb05..ed39297 100644 --- a/WebCore/platform/graphics/win/WKCACFLayer.h +++ b/WebCore/platform/graphics/win/WKCACFLayer.h @@ -56,7 +56,7 @@ protected: class WKCACFLayer : public RefCounted<WKCACFLayer> { public: enum LayerType { Layer, TransformLayer }; - enum FilterType { Linear, Nearest, Trilinear, Lanczos }; + enum FilterType { Linear, Nearest, Trilinear }; enum ContentsGravityType { Center, Top, Bottom, Left, Right, TopLeft, TopRight, BottomLeft, BottomRight, Resize, ResizeAspect, ResizeAspectFill }; @@ -162,9 +162,6 @@ public: virtual void setBounds(const CGRect&); CGRect bounds() const { return CACFLayerGetBounds(layer()); } - void setClearsContext(bool clears) { CACFLayerSetClearsContext(layer(), clears); setNeedsCommit(); } - bool clearsContext() const { return CACFLayerGetClearsContext(layer()); } - void setContents(CFTypeRef contents) { CACFLayerSetContents(layer(), contents); setNeedsCommit(); } CFTypeRef contents() const { return CACFLayerGetContents(layer()); } @@ -180,9 +177,6 @@ public: void setEdgeAntialiasingMask(uint32_t mask) { CACFLayerSetEdgeAntialiasingMask(layer(), mask); setNeedsCommit(); } uint32_t edgeAntialiasingMask() const { return CACFLayerGetEdgeAntialiasingMask(layer()); } - void setFilters(CFArrayRef filters) { CACFLayerSetFilters(layer(), filters); setNeedsCommit(); } - CFArrayRef filters() const { return CACFLayerGetFilters(layer()); } - virtual void setFrame(const CGRect&); CGRect frame() const { return CACFLayerGetFrame(layer()); } @@ -226,9 +220,6 @@ public: WKCACFLayer* rootLayer() const; - void setSortsSublayers(bool sorts) { CACFLayerSetSortsSublayers(layer(), sorts); setNeedsCommit(); } - bool sortsSublayers() const { return CACFLayerGetSortsSublayers(layer()); } - void setSublayerTransform(const CATransform3D& transform) { CACFLayerSetSublayerTransform(layer(), transform); setNeedsCommit(); } CATransform3D sublayerTransform() const { return CACFLayerGetSublayerTransform(layer()); } diff --git a/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp b/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp index 0ee61f3..2a355c2 100644 --- a/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp +++ b/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp @@ -98,7 +98,7 @@ public: return adoptRef(new WKCACFRootLayer(renderer)); } - virtual void setNeedsRender() { m_renderer->renderSoon(); } + virtual void setNeedsRender() { m_renderer->layerTreeDidChange(); } // Overload this to avoid calling setNeedsDisplay on the layer, which would override the contents // we have placed on the root layer. @@ -333,6 +333,12 @@ void WKCACFLayerRenderer::setRootChildLayer(WKCACFLayer* layer) } } +void WKCACFLayerRenderer::layerTreeDidChange() +{ + WKCACFContextFlusher::shared().addContext(m_context.get()); + renderSoon(); +} + void WKCACFLayerRenderer::setNeedsDisplay() { ASSERT(m_rootLayer); diff --git a/WebCore/platform/graphics/win/WKCACFLayerRenderer.h b/WebCore/platform/graphics/win/WKCACFLayerRenderer.h index 1ff955a..2647c5f 100644 --- a/WebCore/platform/graphics/win/WKCACFLayerRenderer.h +++ b/WebCore/platform/graphics/win/WKCACFLayerRenderer.h @@ -70,6 +70,7 @@ public: void setRootContents(CGImageRef); void setRootContentsAndDisplay(CGImageRef); void setRootChildLayer(WKCACFLayer* layer); + void layerTreeDidChange(); void setNeedsDisplay(); void setHostWindow(HWND window) { m_hostWindow = window; } void setBackingStoreDirty(bool dirty) { m_backingStoreDirty = dirty; } diff --git a/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp b/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp index f8a1e26..3605c72 100644 --- a/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp +++ b/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp @@ -83,4 +83,9 @@ FontCustomPlatformData* createFontCustomPlatformData(const SharedBuffer* buffer) return 0; } +bool FontCustomPlatformData::supportsFormat(const String& format) +{ + return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype"); +} + } diff --git a/WebCore/platform/graphics/wince/FontCustomPlatformData.h b/WebCore/platform/graphics/wince/FontCustomPlatformData.h index 89d1fdd..5ce0ea6 100644 --- a/WebCore/platform/graphics/wince/FontCustomPlatformData.h +++ b/WebCore/platform/graphics/wince/FontCustomPlatformData.h @@ -45,6 +45,9 @@ namespace WebCore { ~FontCustomPlatformData(); FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontRenderingMode = NormalRenderingMode); + + static bool supportsFormat(const String&); + String m_name; }; diff --git a/WebCore/platform/gtk/KeyEventGtk.cpp b/WebCore/platform/gtk/KeyEventGtk.cpp index 193b7e5..e9756d8 100644 --- a/WebCore/platform/gtk/KeyEventGtk.cpp +++ b/WebCore/platform/gtk/KeyEventGtk.cpp @@ -264,15 +264,14 @@ static int windowsKeyCodeForKeyEvent(unsigned int keycode) case GDK_Select: return VK_SELECT; // (29) SELECT key case GDK_Print: - return VK_PRINT; // (2A) PRINT key + return VK_SNAPSHOT; // (2C) PRINT SCREEN key case GDK_Execute: return VK_EXECUTE;// (2B) EXECUTE key - //dunno on this - //case GDK_PrintScreen: - // return VK_SNAPSHOT; // (2C) PRINT SCREEN key case GDK_Insert: + case GDK_KP_Insert: return VK_INSERT; // (2D) INS key case GDK_Delete: + case GDK_KP_Delete: return VK_DELETE; // (2E) DEL key case GDK_Help: return VK_HELP; // (2F) HELP key diff --git a/WebCore/platform/gtk/PopupMenuGtk.cpp b/WebCore/platform/gtk/PopupMenuGtk.cpp index bf8cfb4..ca067d9 100644 --- a/WebCore/platform/gtk/PopupMenuGtk.cpp +++ b/WebCore/platform/gtk/PopupMenuGtk.cpp @@ -4,6 +4,7 @@ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com * Copyright (C) 2008 Collabora Ltd. + * Copyright (C) 2010 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 @@ -23,7 +24,7 @@ */ #include "config.h" -#include "PopupMenu.h" +#include "PopupMenuGtk.h" #include "FrameView.h" #include "GtkVersioning.h" @@ -34,12 +35,12 @@ namespace WebCore { -PopupMenu::PopupMenu(PopupMenuClient* client) +PopupMenuGtk::PopupMenuGtk(PopupMenuClient* client) : m_popupClient(client) { } -PopupMenu::~PopupMenu() +PopupMenuGtk::~PopupMenuGtk() { if (m_popup) { g_signal_handlers_disconnect_matched(m_popup.get(), G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, this); @@ -47,7 +48,7 @@ PopupMenu::~PopupMenu() } } -void PopupMenu::show(const IntRect& rect, FrameView* view, int index) +void PopupMenuGtk::show(const IntRect& rect, FrameView* view, int index) { ASSERT(client()); @@ -110,43 +111,43 @@ void PopupMenu::show(const IntRect& rect, FrameView* view, int index) gtk_menu_popup(m_popup.get(), 0, 0, reinterpret_cast<GtkMenuPositionFunc>(menuPositionFunction), this, 0, gtk_get_current_event_time()); } -void PopupMenu::hide() +void PopupMenuGtk::hide() { ASSERT(m_popup); gtk_menu_popdown(m_popup.get()); } -void PopupMenu::updateFromElement() +void PopupMenuGtk::updateFromElement() { client()->setTextFromItem(client()->selectedIndex()); } -bool PopupMenu::itemWritingDirectionIsNatural() +void PopupMenuGtk::disconnectClient() { - return true; + m_popupClient = 0; } -void PopupMenu::menuItemActivated(GtkMenuItem* item, PopupMenu* that) +void PopupMenuGtk::menuItemActivated(GtkMenuItem* item, PopupMenuGtk* that) { ASSERT(that->client()); ASSERT(that->m_indexMap.contains(GTK_WIDGET(item))); that->client()->valueChanged(that->m_indexMap.get(GTK_WIDGET(item))); } -void PopupMenu::menuUnmapped(GtkWidget*, PopupMenu* that) +void PopupMenuGtk::menuUnmapped(GtkWidget*, PopupMenuGtk* that) { ASSERT(that->client()); that->client()->popupDidHide(); } -void PopupMenu::menuPositionFunction(GtkMenu*, gint* x, gint* y, gboolean* pushIn, PopupMenu* that) +void PopupMenuGtk::menuPositionFunction(GtkMenu*, gint* x, gint* y, gboolean* pushIn, PopupMenuGtk* that) { *x = that->m_menuPosition.x(); *y = that->m_menuPosition.y(); *pushIn = true; } -void PopupMenu::menuRemoveItem(GtkWidget* widget, PopupMenu* that) +void PopupMenuGtk::menuRemoveItem(GtkWidget* widget, PopupMenuGtk* that) { ASSERT(that->m_popup); gtk_container_remove(GTK_CONTAINER(that->m_popup.get()), widget); diff --git a/WebCore/platform/gtk/PopupMenuGtk.h b/WebCore/platform/gtk/PopupMenuGtk.h new file mode 100644 index 0000000..fb4e7dd --- /dev/null +++ b/WebCore/platform/gtk/PopupMenuGtk.h @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef PopupMenuGtk_h +#define PopupMenuGtk_h + +#include "GRefPtrGtk.h" +#include "IntRect.h" +#include "PopupMenu.h" +#include "PopupMenuClient.h" +#include <glib.h> +#include <wtf/HashMap.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +typedef struct _GtkMenu GtkMenu; +typedef struct _GtkMenuItem GtkMenuItem; +typedef struct _GtkWidget GtkWidget; + +namespace WebCore { + +class FrameView; +class Scrollbar; + +class PopupMenuGtk : public PopupMenu { +public: + PopupMenuGtk(PopupMenuClient*); + ~PopupMenuGtk(); + + virtual void show(const IntRect&, FrameView*, int index); + virtual void hide(); + virtual void updateFromElement(); + virtual void disconnectClient(); + +private: + PopupMenuClient* client() const { return m_popupClient; } + + static void menuItemActivated(GtkMenuItem* item, PopupMenuGtk*); + static void menuUnmapped(GtkWidget*, PopupMenuGtk*); + static void menuPositionFunction(GtkMenu*, gint*, gint*, gboolean*, PopupMenuGtk*); + static void menuRemoveItem(GtkWidget*, PopupMenuGtk*); + + PopupMenuClient* m_popupClient; + IntPoint m_menuPosition; + GRefPtr<GtkMenu> m_popup; + HashMap<GtkWidget*, int> m_indexMap; +}; + +} + +#endif // PopupMenuGtk_h diff --git a/WebCore/platform/gtk/SearchPopupMenuGtk.cpp b/WebCore/platform/gtk/SearchPopupMenuGtk.cpp index fbaa527..2413773 100644 --- a/WebCore/platform/gtk/SearchPopupMenuGtk.cpp +++ b/WebCore/platform/gtk/SearchPopupMenuGtk.cpp @@ -1,4 +1,6 @@ /* + * Copyright (C) 2010 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 Lesser General Public * License as published by the Free Software Foundation; either @@ -15,29 +17,34 @@ */ #include "config.h" -#include "SearchPopupMenu.h" +#include "SearchPopupMenuGtk.h" #include "NotImplemented.h" namespace WebCore { -SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client) - : PopupMenu(client) +SearchPopupMenuGtk::SearchPopupMenuGtk(PopupMenuClient* client) + : m_popup(adoptRef(new PopupMenuGtk(client))) { notImplemented(); } -void SearchPopupMenu::saveRecentSearches(const AtomicString&, const Vector<String>&) +PopupMenu* SearchPopupMenuGtk::popupMenu() +{ + return m_popup.get(); +} + +void SearchPopupMenuGtk::saveRecentSearches(const AtomicString&, const Vector<String>&) { notImplemented(); } -void SearchPopupMenu::loadRecentSearches(const AtomicString&, Vector<String>&) +void SearchPopupMenuGtk::loadRecentSearches(const AtomicString&, Vector<String>&) { notImplemented(); } -bool SearchPopupMenu::enabled() +bool SearchPopupMenuGtk::enabled() { notImplemented(); return false; diff --git a/WebCore/platform/gtk/SearchPopupMenuGtk.h b/WebCore/platform/gtk/SearchPopupMenuGtk.h new file mode 100644 index 0000000..453c63d --- /dev/null +++ b/WebCore/platform/gtk/SearchPopupMenuGtk.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef SearchPopupMenuGtk_h +#define SearchPopupMenuGtk_h + +#include "PopupMenuGtk.h" +#include "SearchPopupMenu.h" + +namespace WebCore { + +class SearchPopupMenuGtk : public SearchPopupMenu { +public: + SearchPopupMenuGtk(PopupMenuClient*); + + virtual PopupMenu* popupMenu(); + virtual void saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems); + virtual void loadRecentSearches(const AtomicString& name, Vector<String>& searchItems); + virtual bool enabled(); + +private: + RefPtr<PopupMenuGtk> m_popup; +}; + +} + +#endif // SearchPopupMenuGtk_h diff --git a/WebCore/platform/haiku/PopupMenuHaiku.cpp b/WebCore/platform/haiku/PopupMenuHaiku.cpp index 5adbc66..e3edb83 100644 --- a/WebCore/platform/haiku/PopupMenuHaiku.cpp +++ b/WebCore/platform/haiku/PopupMenuHaiku.cpp @@ -2,6 +2,7 @@ * This file is part of the popup menu implementation for <select> elements in WebCore. * * Copyright (C) 2010 Stephan Aßmus <superstippi@gmx.de> + * Copyright (C) 2010 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 @@ -21,7 +22,7 @@ */ #include "config.h" -#include "PopupMenu.h" +#include "PopupMenuHaiku.h" #include "FrameView.h" @@ -72,9 +73,9 @@ private: PopupMenuClient* m_popupClient; }; -class PopupMenuHaiku : public BPopUpMenu { +class HaikuPopup : public BPopUpMenu { public: - PopupMenuHaiku(PopupMenuClient* popupClient) + HaikuPopup(PopupMenuClient* popupClient) : BPopUpMenu("WebCore Popup", true, false) , m_popupClient(popupClient) , m_Handler(popupClient) @@ -86,7 +87,7 @@ public: SetAsyncAutoDestruct(false); } - virtual ~PopupMenuHaiku() + virtual ~HaikuPopup() { if (be_app->Lock()) { be_app->RemoveHandler(&m_Handler); @@ -153,39 +154,39 @@ private: PopupMenuHandler m_Handler; }; -PopupMenu::PopupMenu(PopupMenuClient* client) +PopupMenuHaiku::PopupMenuHaiku(PopupMenuClient* client) : m_popupClient(client) - , m_menu(new PopupMenuHaiku(client)) + , m_menu(new HaikuPopup(client)) { // We don't need additional references to the client, since we completely // control any sub-objects we create that need it as well. } -PopupMenu::~PopupMenu() +PopupMenuHaiku::~PopupMenuHaiku() { delete m_menu; } -void PopupMenu::show(const IntRect& rect, FrameView* view, int index) +void PopupMenuHaiku::disconnectClient() +{ + m_popupClient = 0; +} + +void PopupMenuHaiku::show(const IntRect& rect, FrameView* view, int index) { // The menu will update itself from the PopupMenuClient before showing. m_menu->show(rect, view, index); } -void PopupMenu::hide() +void PopupMenuHaiku::hide() { m_menu->hide(); } -void PopupMenu::updateFromElement() +void PopupMenuHaiku::updateFromElement() { client()->setTextFromItem(m_popupClient->selectedIndex()); } -bool PopupMenu::itemWritingDirectionIsNatural() -{ - return false; -} - } // namespace WebCore diff --git a/WebCore/platform/haiku/PopupMenuHaiku.h b/WebCore/platform/haiku/PopupMenuHaiku.h new file mode 100644 index 0000000..9207923 --- /dev/null +++ b/WebCore/platform/haiku/PopupMenuHaiku.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef PopupMenuHaiku_h +#define PopupMenuHaiku_h + +#include "IntRect.h" +#include "PopupMenu.h" +#include "PopupMenuClient.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace WebCore { + +class FrameView; +class HaikuPopup; +class Scrollbar; + +class PopupMenuHaiku : public PopupMenu { +public: + PopupMenuHaiku(PopupMenuClient*); + ~PopupMenuHaiku(); + + virtual void show(const IntRect&, FrameView*, int index); + virtual void hide(); + virtual void updateFromElement(); + virtual void disconnectClient(); + +private: + PopupMenuClient* client() const { return m_popupClient; } + + PopupMenuClient* m_popupClient; + HaikuPopup* m_menu; +}; + +} + +#endif // PopupMenuHaiku_h diff --git a/WebCore/platform/haiku/SearchPopupMenuHaiku.cpp b/WebCore/platform/haiku/SearchPopupMenuHaiku.cpp index fd5d96c..109409a 100644 --- a/WebCore/platform/haiku/SearchPopupMenuHaiku.cpp +++ b/WebCore/platform/haiku/SearchPopupMenuHaiku.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com> + * Copyright (C) 2010 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 @@ -18,7 +19,7 @@ */ #include "config.h" -#include "SearchPopupMenu.h" +#include "SearchPopupMenuHaiku.h" #include "AtomicString.h" #include "NotImplemented.h" @@ -26,26 +27,31 @@ namespace WebCore { -SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client) - : PopupMenu(client) +SearchPopupMenuHaiku::SearchPopupMenuHaiku(PopupMenuClient* client) + : m_popup(adoptRef(new PopupMenuHaiku(client))) { } -void SearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) +void SearchPopupMenuHaiku::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) { notImplemented(); } -void SearchPopupMenu::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems) +void SearchPopupMenuHaiku::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems) { notImplemented(); } -bool SearchPopupMenu::enabled() +bool SearchPopupMenuHaiku::enabled() { notImplemented(); return false; } +PopupMenu* SearchPopupMenuHaiku::popupMenu() +{ + return m_popup.get(); +} + } // namespace WebCore diff --git a/WebCore/platform/haiku/SearchPopupMenuHaiku.h b/WebCore/platform/haiku/SearchPopupMenuHaiku.h new file mode 100644 index 0000000..a9e8e8d --- /dev/null +++ b/WebCore/platform/haiku/SearchPopupMenuHaiku.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef SearchPopupMenuHaiku_h +#define SearchPopupMenuHaiku_h + +#include "PopupMenuHaiku.h" +#include "SearchPopupMenu.h" + +namespace WebCore { + +class SearchPopupMenuHaiku : public SearchPopupMenu { +public: + SearchPopupMenuHaiku(PopupMenuClient*); + + virtual PopupMenu* popupMenu(); + virtual void saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems); + virtual void loadRecentSearches(const AtomicString& name, Vector<String>& searchItems); + virtual bool enabled(); + +private: + RefPtr<PopupMenuHaiku> m_popup; +}; + +} + +#endif // SearchPopupMenuHaiku_h diff --git a/WebCore/platform/mac/PopupMenuMac.h b/WebCore/platform/mac/PopupMenuMac.h new file mode 100644 index 0000000..e969fff --- /dev/null +++ b/WebCore/platform/mac/PopupMenuMac.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef PopupMenuMac_h +#define PopupMenuMac_h + +#include "IntRect.h" +#include "PopupMenu.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/RetainPtr.h> + +class NSPopUpButtonCell; + +namespace WebCore { + +class PopupMenuClient; +class FrameView; +class Scrollbar; + +class PopupMenuMac : public PopupMenu { +public: + PopupMenuMac(PopupMenuClient*); + ~PopupMenuMac(); + + virtual void show(const IntRect&, FrameView*, int index); + virtual void hide(); + virtual void updateFromElement(); + virtual void disconnectClient(); + +private: + void clear(); + void populate(); + PopupMenuClient* client() const { return m_popupClient; } + + PopupMenuClient* m_popupClient; + RetainPtr<NSPopUpButtonCell> m_popup; +}; + +} + +#endif // PopupMenuMac_h diff --git a/WebCore/platform/mac/PopupMenuMac.mm b/WebCore/platform/mac/PopupMenuMac.mm index 6c067b9..1bf500b 100644 --- a/WebCore/platform/mac/PopupMenuMac.mm +++ b/WebCore/platform/mac/PopupMenuMac.mm @@ -1,5 +1,6 @@ /* * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2010 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 @@ -18,7 +19,7 @@ */ #import "config.h" -#import "PopupMenu.h" +#import "PopupMenuMac.h" #import "AXObjectCache.h" #import "Chrome.h" @@ -31,6 +32,7 @@ #import "HTMLOptionElement.h" #import "HTMLSelectElement.h" #import "Page.h" +#import "PopupMenuClient.h" #import "SimpleFontData.h" #import "WebCoreSystemInterface.h" @@ -38,24 +40,24 @@ namespace WebCore { using namespace HTMLNames; -PopupMenu::PopupMenu(PopupMenuClient* client) +PopupMenuMac::PopupMenuMac(PopupMenuClient* client) : m_popupClient(client) { } -PopupMenu::~PopupMenu() +PopupMenuMac::~PopupMenuMac() { if (m_popup) [m_popup.get() setControlView:nil]; } -void PopupMenu::clear() +void PopupMenuMac::clear() { if (m_popup) [m_popup.get() removeAllItems]; } -void PopupMenu::populate() +void PopupMenuMac::populate() { if (m_popup) clear(); @@ -114,7 +116,7 @@ void PopupMenu::populate() [[m_popup.get() menu] setMenuChangedMessagesEnabled:messagesEnabled]; } -void PopupMenu::show(const IntRect& r, FrameView* v, int index) +void PopupMenuMac::show(const IntRect& r, FrameView* v, int index) { populate(); int numItems = [m_popup.get() numberOfItems]; @@ -162,7 +164,7 @@ void PopupMenu::show(const IntRect& r, FrameView* v, int index) RefPtr<Frame> frame = v->frame(); NSEvent* event = [frame->eventHandler()->currentNSEvent() retain]; - RefPtr<PopupMenu> protector(this); + RefPtr<PopupMenuMac> protector(this); RetainPtr<NSView> dummyView(AdoptNS, [[NSView alloc] initWithFrame:r]); [view addSubview:dummyView.get()]; @@ -194,18 +196,18 @@ void PopupMenu::show(const IntRect& r, FrameView* v, int index) [event release]; } -void PopupMenu::hide() +void PopupMenuMac::hide() { [m_popup.get() dismissPopUp]; } -void PopupMenu::updateFromElement() +void PopupMenuMac::updateFromElement() { } -bool PopupMenu::itemWritingDirectionIsNatural() +void PopupMenuMac::disconnectClient() { - return true; + m_popupClient = 0; } } diff --git a/WebCore/platform/mac/SearchPopupMenuMac.h b/WebCore/platform/mac/SearchPopupMenuMac.h new file mode 100644 index 0000000..828b07f --- /dev/null +++ b/WebCore/platform/mac/SearchPopupMenuMac.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef SearchPopupMenuMac_h +#define SearchPopupMenuMac_h + +#include "PopupMenuMac.h" +#include "SearchPopupMenu.h" + +namespace WebCore { + +class SearchPopupMenuMac : public SearchPopupMenu { +public: + SearchPopupMenuMac(PopupMenuClient*); + + virtual PopupMenu* popupMenu(); + virtual void saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems); + virtual void loadRecentSearches(const AtomicString& name, Vector<String>& searchItems); + virtual bool enabled(); + +private: + RefPtr<PopupMenuMac> m_popup; +}; + +} + +#endif // SearchPopupMenuMac_h diff --git a/WebCore/platform/mac/SearchPopupMenuMac.mm b/WebCore/platform/mac/SearchPopupMenuMac.mm index 262734d..69018ee 100644 --- a/WebCore/platform/mac/SearchPopupMenuMac.mm +++ b/WebCore/platform/mac/SearchPopupMenuMac.mm @@ -1,5 +1,6 @@ /* * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2010 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 @@ -18,14 +19,14 @@ */ #import "config.h" -#import "SearchPopupMenu.h" +#import "SearchPopupMenuMac.h" #import "AtomicString.h" namespace WebCore { -SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client) - : PopupMenu(client) +SearchPopupMenuMac::SearchPopupMenuMac(PopupMenuClient* client) + : m_popup(adoptRef(new PopupMenuMac(client))) { } @@ -34,12 +35,17 @@ static NSString* autosaveKey(const String& name) return [@"com.apple.WebKit.searchField:" stringByAppendingString:name]; } -bool SearchPopupMenu::enabled() +PopupMenu* SearchPopupMenuMac::popupMenu() +{ + return m_popup.get(); +} + +bool SearchPopupMenuMac::enabled() { return true; } -void SearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) +void SearchPopupMenuMac::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) { if (name.isEmpty()) return; @@ -56,7 +62,7 @@ void SearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector< } } -void SearchPopupMenu::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems) +void SearchPopupMenuMac::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems) { if (name.isEmpty()) return; diff --git a/WebCore/platform/mock/DeviceOrientationClientMock.cpp b/WebCore/platform/mock/DeviceOrientationClientMock.cpp new file mode 100644 index 0000000..c2c9316 --- /dev/null +++ b/WebCore/platform/mock/DeviceOrientationClientMock.cpp @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2010 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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. + */ + +#include "config.h" +#include "DeviceOrientationClientMock.h" + +#include "DeviceOrientationController.h" + +namespace WebCore { + +DeviceOrientationClientMock::DeviceOrientationClientMock() + : m_controller(0) + , m_timer(this, &DeviceOrientationClientMock::timerFired) + , m_isUpdating(false) +{ +} + +void DeviceOrientationClientMock::setController(DeviceOrientationController* controller) +{ + m_controller = controller; + ASSERT(m_controller); +} + +void DeviceOrientationClientMock::startUpdating() +{ + m_isUpdating = true; +} + +void DeviceOrientationClientMock::stopUpdating() +{ + m_isUpdating = false; + m_timer.stop(); +} + +void DeviceOrientationClientMock::setOrientation(PassRefPtr<DeviceOrientation> orientation) +{ + m_orientation = orientation; + if (m_isUpdating && !m_timer.isActive()) + m_timer.startOneShot(0); +} + +void DeviceOrientationClientMock::timerFired(Timer<DeviceOrientationClientMock>* timer) +{ + ASSERT_UNUSED(timer, timer == &m_timer); + m_timer.stop(); + m_controller->didChangeDeviceOrientation(m_orientation.get()); +} + +} // namespace WebCore diff --git a/WebCore/platform/mock/DeviceOrientationClientMock.h b/WebCore/platform/mock/DeviceOrientationClientMock.h new file mode 100644 index 0000000..6691130 --- /dev/null +++ b/WebCore/platform/mock/DeviceOrientationClientMock.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2010 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 DeviceOrientationClientMock_h +#define DeviceOrientationClientMock_h + +#include "DeviceOrientation.h" +#include "DeviceOrientationClient.h" +#include "Timer.h" + +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebCore { + +class DeviceOrientationController; + +// A mock implementation of DeviceOrientationClient used to test the feature in +// DumpRenderTree. Embedders should should configure the Page object to use this +// client when running DumpRenderTree. +class DeviceOrientationClientMock : public DeviceOrientationClient { +public: + DeviceOrientationClientMock(); + + // DeviceOrientationClient + virtual void setController(DeviceOrientationController*); + virtual void startUpdating(); + virtual void stopUpdating(); + virtual DeviceOrientation* lastOrientation() const { return m_orientation.get(); } + + void setOrientation(PassRefPtr<DeviceOrientation>); + +private: + void timerFired(Timer<DeviceOrientationClientMock>*); + + RefPtr<DeviceOrientation> m_orientation; + DeviceOrientationController* m_controller; + Timer<DeviceOrientationClientMock> m_timer; + bool m_isUpdating; +}; + +} // namespace WebCore + +#endif // DeviceOrientationClientMock_h diff --git a/WebCore/platform/mock/SpeechInputClientMock.cpp b/WebCore/platform/mock/SpeechInputClientMock.cpp new file mode 100644 index 0000000..74a3151 --- /dev/null +++ b/WebCore/platform/mock/SpeechInputClientMock.cpp @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2010 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. + */ + +#include "config.h" +#include "SpeechInputClientMock.h" + +#if ENABLE(INPUT_SPEECH) + +#include "SpeechInputListener.h" + +namespace WebCore { + +SpeechInputClientMock::SpeechInputClientMock() + : m_recording(false) + , m_timer(this, &SpeechInputClientMock::timerFired) + , m_listener(0) +{ +} + +bool SpeechInputClientMock::startRecognition(SpeechInputListener* listener) +{ + if (m_timer.isActive()) + return false; + m_listener = listener; + m_recording = true; + m_timer.startOneShot(0); + return true; +} + +void SpeechInputClientMock::stopRecording() +{ + if (m_timer.isActive() && m_recording) { + m_timer.stop(); + timerFired(&m_timer); + } +} + +void SpeechInputClientMock::cancelRecognition() +{ + if (m_timer.isActive()) { + m_timer.stop(); + m_recording = false; + m_listener->didCompleteRecognition(); + m_listener = 0; + } +} + +void SpeechInputClientMock::setRecognitionResult(const String& result) +{ + m_recognitionResult = result; +} + +void SpeechInputClientMock::timerFired(WebCore::Timer<SpeechInputClientMock>*) +{ + if (m_recording) { + m_recording = false; + m_listener->didCompleteRecording(); + m_timer.startOneShot(0); + } else { + m_listener->setRecognitionResult(m_recognitionResult); + m_listener->didCompleteRecognition(); + m_listener = 0; + } +} + +} // namespace WebCore + +#endif // ENABLE(INPUT_SPEECH) diff --git a/WebCore/platform/mock/SpeechInputClientMock.h b/WebCore/platform/mock/SpeechInputClientMock.h new file mode 100644 index 0000000..faca444 --- /dev/null +++ b/WebCore/platform/mock/SpeechInputClientMock.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2010 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 SpeechInputClientMock_h +#define SpeechInputClientMock_h + +#include "PlatformString.h" +#include "SpeechInputClient.h" +#include "Timer.h" + +#if ENABLE(INPUT_SPEECH) + +namespace WebCore { + +class SpeechInputListener; + +// Provides a mock object for the speech input embedder API called by WebCore. +class SpeechInputClientMock : public SpeechInputClient { +public: + SpeechInputClientMock(); + + void setRecognitionResult(const String& result); + + // SpeechInputClient methods. + bool startRecognition(SpeechInputListener*); + void stopRecording(); + void cancelRecognition(); + +private: + void timerFired(Timer<SpeechInputClientMock>*); + + bool m_recording; + Timer<SpeechInputClientMock> m_timer; + SpeechInputListener* m_listener; + String m_recognitionResult; +}; + +} // namespace WebCore + +#endif // ENABLE(INPUT_SPEECH) + +#endif // SpeechInputClientMock_h diff --git a/WebCore/platform/qt/PopupMenuQt.cpp b/WebCore/platform/qt/PopupMenuQt.cpp index 315b891..5590556 100644 --- a/WebCore/platform/qt/PopupMenuQt.cpp +++ b/WebCore/platform/qt/PopupMenuQt.cpp @@ -24,7 +24,7 @@ */ #include "config.h" -#include "PopupMenu.h" +#include "PopupMenuQt.h" #include "Chrome.h" #include "ChromeClientQt.h" @@ -35,18 +35,24 @@ namespace WebCore { -PopupMenu::PopupMenu(PopupMenuClient* client) +PopupMenuQt::PopupMenuQt(PopupMenuClient* client) : m_popupClient(client) , m_popup(0) { } -PopupMenu::~PopupMenu() +PopupMenuQt::~PopupMenuQt() { delete m_popup; } -void PopupMenu::show(const IntRect& rect, FrameView* view, int index) + +void PopupMenuQt::disconnectClient() +{ + m_popupClient = 0; +} + +void PopupMenuQt::show(const IntRect& rect, FrameView* view, int index) { ChromeClientQt* chromeClient = static_cast<ChromeClientQt*>( view->frame()->page()->chrome()->client()); @@ -67,19 +73,14 @@ void PopupMenu::show(const IntRect& rect, FrameView* view, int index) } -void PopupMenu::hide() +void PopupMenuQt::hide() { m_popup->hide(); } -void PopupMenu::updateFromElement() -{ - client()->setTextFromItem(m_popupClient->selectedIndex()); -} - -bool PopupMenu::itemWritingDirectionIsNatural() +void PopupMenuQt::updateFromElement() { - return false; + m_popupClient->setTextFromItem(m_popupClient->selectedIndex()); } } diff --git a/WebCore/platform/qt/PopupMenuQt.h b/WebCore/platform/qt/PopupMenuQt.h new file mode 100644 index 0000000..25a9f76 --- /dev/null +++ b/WebCore/platform/qt/PopupMenuQt.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef PopupMenuQt_h +#define PopupMenuQt_h + +#include "PopupMenu.h" + +namespace WebCore { + +class FrameView; +class QtAbstractWebPopup; +class Scrollbar; +class PopupMenuClient; + +class PopupMenuQt : public PopupMenu { +public: + PopupMenuQt(PopupMenuClient*); + ~PopupMenuQt(); + + virtual void show(const IntRect&, FrameView*, int index); + virtual void hide(); + virtual void updateFromElement(); + virtual void disconnectClient(); + +private: + PopupMenuClient* m_popupClient; + QtAbstractWebPopup* m_popup; +}; + +} + +#endif // PopupMenuQt_h diff --git a/WebCore/platform/qt/QtAbstractWebPopup.h b/WebCore/platform/qt/QtAbstractWebPopup.h index dad4997..5f6f619 100644 --- a/WebCore/platform/qt/QtAbstractWebPopup.h +++ b/WebCore/platform/qt/QtAbstractWebPopup.h @@ -63,7 +63,7 @@ public: QFont font() { return m_popupClient->menuStyle().font().font(); } private: - friend class PopupMenu; + friend class PopupMenuQt; PopupMenuClient* m_popupClient; QWebPageClient* m_pageClient; int m_currentIndex; diff --git a/WebCore/platform/qt/SearchPopupMenuQt.cpp b/WebCore/platform/qt/SearchPopupMenuQt.cpp index 187a5de..a05d08a 100644 --- a/WebCore/platform/qt/SearchPopupMenuQt.cpp +++ b/WebCore/platform/qt/SearchPopupMenuQt.cpp @@ -1,5 +1,6 @@ /* * Copyright C 2006 Zack Rusin <zack@kde.org> + * Copyright (C) 2010 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 @@ -18,26 +19,29 @@ */ #include "config.h" -#include "SearchPopupMenu.h" - -#include "AtomicString.h" +#include "SearchPopupMenuQt.h" namespace WebCore { -SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client) - : PopupMenu(client) +SearchPopupMenuQt::SearchPopupMenuQt(PopupMenuClient* client) + : m_popup(adoptRef(new PopupMenuQt(client))) +{ +} + +PopupMenu* SearchPopupMenuQt::popupMenu() { + return m_popup.get(); } -void SearchPopupMenu::saveRecentSearches(const AtomicString&, const Vector<String>&) +void SearchPopupMenuQt::saveRecentSearches(const AtomicString&, const Vector<String>&) { } -void SearchPopupMenu::loadRecentSearches(const AtomicString&, Vector<String>&) +void SearchPopupMenuQt::loadRecentSearches(const AtomicString&, Vector<String>&) { } -bool SearchPopupMenu::enabled() +bool SearchPopupMenuQt::enabled() { return true; } diff --git a/WebCore/platform/qt/SearchPopupMenuQt.h b/WebCore/platform/qt/SearchPopupMenuQt.h new file mode 100644 index 0000000..0fbeafd --- /dev/null +++ b/WebCore/platform/qt/SearchPopupMenuQt.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef SearchPopupMenuQt_h +#define SearchPopupMenuQt_h + +#include "PopupMenuQt.h" +#include "SearchPopupMenu.h" + +namespace WebCore { + +class SearchPopupMenuQt : public SearchPopupMenu { +public: + SearchPopupMenuQt(PopupMenuClient*); + + virtual PopupMenu* popupMenu(); + virtual void saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems); + virtual void loadRecentSearches(const AtomicString& name, Vector<String>& searchItems); + virtual bool enabled(); + +private: + RefPtr<PopupMenuQt> m_popup; +}; + +} + +#endif // SearchPopupMenuQt_h diff --git a/WebCore/platform/sql/SQLiteDatabase.cpp b/WebCore/platform/sql/SQLiteDatabase.cpp index 75fc032..05a2a22 100644 --- a/WebCore/platform/sql/SQLiteDatabase.cpp +++ b/WebCore/platform/sql/SQLiteDatabase.cpp @@ -31,8 +31,8 @@ #include "Logging.h" #include "SQLiteFileSystem.h" #include "SQLiteStatement.h" - #include <sqlite3.h> +#include <wtf/Threading.h> namespace WebCore { @@ -42,7 +42,7 @@ const int SQLResultOk = SQLITE_OK; const int SQLResultRow = SQLITE_ROW; const int SQLResultSchema = SQLITE_SCHEMA; const int SQLResultFull = SQLITE_FULL; - +const int SQLResultInterrupt = SQLITE_INTERRUPT; SQLiteDatabase::SQLiteDatabase() : m_db(0) @@ -50,6 +50,7 @@ SQLiteDatabase::SQLiteDatabase() , m_transactionInProgress(false) , m_sharable(false) , m_openingThread(0) + , m_interrupted(false) { } @@ -85,13 +86,37 @@ void SQLiteDatabase::close() if (m_db) { // FIXME: This is being called on themain thread during JS GC. <rdar://problem/5739818> // ASSERT(currentThread() == m_openingThread); - sqlite3_close(m_db); - m_db = 0; + sqlite3* db = m_db; + { + MutexLocker locker(m_databaseClosingMutex); + m_db = 0; + } + sqlite3_close(db); } m_openingThread = 0; } +void SQLiteDatabase::interrupt() +{ + m_interrupted = true; + while (!m_lockingMutex.tryLock()) { + MutexLocker locker(m_databaseClosingMutex); + if (!m_db) + return; + sqlite3_interrupt(m_db); + yield(); + } + + m_lockingMutex.unlock(); +} + +bool SQLiteDatabase::isInterrupted() +{ + ASSERT(!m_lockingMutex.tryLock()); + return m_interrupted; +} + void SQLiteDatabase::setFullsync(bool fsync) { if (fsync) @@ -397,16 +422,6 @@ void SQLiteDatabase::enableAuthorizer(bool enable) sqlite3_set_authorizer(m_db, NULL, 0); } -void SQLiteDatabase::lock() -{ - m_lockingMutex.lock(); -} - -void SQLiteDatabase::unlock() -{ - m_lockingMutex.unlock(); -} - bool SQLiteDatabase::isAutoCommitOn() const { return sqlite3_get_autocommit(m_db); diff --git a/WebCore/platform/sql/SQLiteDatabase.h b/WebCore/platform/sql/SQLiteDatabase.h index c5924c0..8151380 100644 --- a/WebCore/platform/sql/SQLiteDatabase.h +++ b/WebCore/platform/sql/SQLiteDatabase.h @@ -48,6 +48,7 @@ extern const int SQLResultOk; extern const int SQLResultRow; extern const int SQLResultSchema; extern const int SQLResultFull; +extern const int SQLResultInterrupt; class SQLiteDatabase : public Noncopyable { friend class SQLiteTransaction; @@ -58,6 +59,8 @@ public: bool open(const String& filename, bool forWebSQLDatabase = false); bool isOpen() const { return m_db; } void close(); + void interrupt(); + bool isInterrupted(); bool executeCommand(const String&); bool returnsAtLeastOneResult(const String&); @@ -105,9 +108,7 @@ public: void setAuthorizer(PassRefPtr<DatabaseAuthorizer>); - // (un)locks the database like a mutex - void lock(); - void unlock(); + Mutex& databaseMutex() { return m_lockingMutex; } bool isAutoCommitOn() const; // The SQLite AUTO_VACUUM pragma can be either NONE, FULL, or INCREMENTAL. @@ -149,7 +150,9 @@ private: Mutex m_lockingMutex; ThreadIdentifier m_openingThread; - + + Mutex m_databaseClosingMutex; + bool m_interrupted; }; // class SQLiteDatabase } // namespace WebCore diff --git a/WebCore/platform/sql/SQLiteStatement.cpp b/WebCore/platform/sql/SQLiteStatement.cpp index 78bbfeb..ac467a6 100644 --- a/WebCore/platform/sql/SQLiteStatement.cpp +++ b/WebCore/platform/sql/SQLiteStatement.cpp @@ -61,6 +61,11 @@ SQLiteStatement::~SQLiteStatement() int SQLiteStatement::prepare() { ASSERT(!m_isPrepared); + + MutexLocker databaseLock(m_database.databaseMutex()); + if (m_database.isInterrupted()) + return SQLITE_INTERRUPT; + const void* tail = 0; LOG(SQLDatabase, "SQL - prepare - %s", m_query.ascii().data()); String strippedQuery = m_query.stripWhiteSpace(); @@ -88,6 +93,11 @@ int SQLiteStatement::prepare() int SQLiteStatement::step() { ASSERT(m_isPrepared); + + MutexLocker databaseLock(m_database.databaseMutex()); + if (m_database.isInterrupted()) + return SQLITE_INTERRUPT; + if (!m_statement) return SQLITE_OK; LOG(SQLDatabase, "SQL - step - %s", m_query.ascii().data()); diff --git a/WebCore/platform/win/PopupMenuWin.cpp b/WebCore/platform/win/PopupMenuWin.cpp index 4bc6dc7..aaadc53 100644 --- a/WebCore/platform/win/PopupMenuWin.cpp +++ b/WebCore/platform/win/PopupMenuWin.cpp @@ -1,6 +1,7 @@ /* * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. * Copyright (C) 2007-2009 Torch Mobile Inc. + * Copyright (C) 2010 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,7 +21,7 @@ */ #include "config.h" -#include "PopupMenu.h" +#include "PopupMenuWin.h" #include "BitmapInfo.h" #include "Document.h" @@ -86,7 +87,7 @@ static void translatePoint(LPARAM& lParam, HWND from, HWND to) lParam = MAKELPARAM(pt.x, pt.y); } -PopupMenu::PopupMenu(PopupMenuClient* client) +PopupMenuWin::PopupMenuWin(PopupMenuClient* client) : m_popupClient(client) , m_scrollbar(0) , m_popup(0) @@ -102,7 +103,7 @@ PopupMenu::PopupMenu(PopupMenuClient* client) { } -PopupMenu::~PopupMenu() +PopupMenuWin::~PopupMenuWin() { if (m_bmp) ::DeleteObject(m_bmp); @@ -114,12 +115,17 @@ PopupMenu::~PopupMenu() m_scrollbar->setParent(0); } -LPCTSTR PopupMenu::popupClassName() +void PopupMenuWin::disconnectClient() +{ + m_popupClient = 0; +} + +LPCTSTR PopupMenuWin::popupClassName() { return kPopupWindowClassName; } -void PopupMenu::show(const IntRect& r, FrameView* view, int index) +void PopupMenuWin::show(const IntRect& r, FrameView* view, int index) { calculatePositionAndSize(r, view); if (clientRect().isEmpty()) @@ -267,7 +273,7 @@ void PopupMenu::show(const IntRect& r, FrameView* view, int index) hide(); } -void PopupMenu::hide() +void PopupMenuWin::hide() { if (!m_showPopup) return; @@ -283,7 +289,7 @@ void PopupMenu::hide() ::PostMessage(m_popup, WM_NULL, 0, 0); } -void PopupMenu::calculatePositionAndSize(const IntRect& r, FrameView* v) +void PopupMenuWin::calculatePositionAndSize(const IntRect& r, FrameView* v) { // r is in absolute document coordinates, but we want to be in screen coordinates @@ -373,7 +379,7 @@ void PopupMenu::calculatePositionAndSize(const IntRect& r, FrameView* v) return; } -bool PopupMenu::setFocusedIndex(int i, bool hotTracking) +bool PopupMenuWin::setFocusedIndex(int i, bool hotTracking) { if (i < 0 || i >= client()->listSize() || i == focusedIndex()) return false; @@ -395,22 +401,22 @@ bool PopupMenu::setFocusedIndex(int i, bool hotTracking) return true; } -int PopupMenu::visibleItems() const +int PopupMenuWin::visibleItems() const { return clientRect().height() / m_itemHeight; } -int PopupMenu::listIndexAtPoint(const IntPoint& point) const +int PopupMenuWin::listIndexAtPoint(const IntPoint& point) const { return m_scrollOffset + point.y() / m_itemHeight; } -int PopupMenu::focusedIndex() const +int PopupMenuWin::focusedIndex() const { return m_focusedIndex; } -void PopupMenu::focusFirst() +void PopupMenuWin::focusFirst() { if (!client()) return; @@ -424,7 +430,7 @@ void PopupMenu::focusFirst() } } -void PopupMenu::focusLast() +void PopupMenuWin::focusLast() { if (!client()) return; @@ -438,7 +444,7 @@ void PopupMenu::focusLast() } } -bool PopupMenu::down(unsigned lines) +bool PopupMenuWin::down(unsigned lines) { if (!client()) return false; @@ -457,7 +463,7 @@ bool PopupMenu::down(unsigned lines) return setFocusedIndex(lastSelectableIndex); } -bool PopupMenu::up(unsigned lines) +bool PopupMenuWin::up(unsigned lines) { if (!client()) return false; @@ -476,7 +482,7 @@ bool PopupMenu::up(unsigned lines) return setFocusedIndex(lastSelectableIndex); } -void PopupMenu::invalidateItem(int index) +void PopupMenuWin::invalidateItem(int index) { if (!m_popup) return; @@ -491,7 +497,7 @@ void PopupMenu::invalidateItem(int index) ::InvalidateRect(m_popup, &r, TRUE); } -IntRect PopupMenu::clientRect() const +IntRect PopupMenuWin::clientRect() const { IntRect clientRect = m_windowRect; clientRect.inflate(-popupWindowBorderWidth); @@ -499,12 +505,12 @@ IntRect PopupMenu::clientRect() const return clientRect; } -void PopupMenu::incrementWheelDelta(int delta) +void PopupMenuWin::incrementWheelDelta(int delta) { m_wheelDelta += delta; } -void PopupMenu::reduceWheelDelta(int delta) +void PopupMenuWin::reduceWheelDelta(int delta) { ASSERT(delta >= 0); ASSERT(delta <= abs(m_wheelDelta)); @@ -517,7 +523,7 @@ void PopupMenu::reduceWheelDelta(int delta) return; } -bool PopupMenu::scrollToRevealSelection() +bool PopupMenuWin::scrollToRevealSelection() { if (!m_scrollbar) return false; @@ -537,7 +543,7 @@ bool PopupMenu::scrollToRevealSelection() return false; } -void PopupMenu::updateFromElement() +void PopupMenuWin::updateFromElement() { if (!m_popup) return; @@ -549,14 +555,9 @@ void PopupMenu::updateFromElement() ::UpdateWindow(m_popup); } -bool PopupMenu::itemWritingDirectionIsNatural() -{ - return true; -} - const int separatorPadding = 4; const int separatorHeight = 1; -void PopupMenu::paint(const IntRect& damageRect, HDC hdc) +void PopupMenuWin::paint(const IntRect& damageRect, HDC hdc) { if (!m_popup) return; @@ -663,7 +664,7 @@ void PopupMenu::paint(const IntRect& damageRect, HDC hdc) ::ReleaseDC(m_popup, localDC); } -void PopupMenu::valueChanged(Scrollbar* scrollBar) +void PopupMenuWin::valueChanged(Scrollbar* scrollBar) { ASSERT(m_scrollbar); @@ -699,7 +700,7 @@ void PopupMenu::valueChanged(Scrollbar* scrollBar) ::UpdateWindow(m_popup); } -void PopupMenu::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rect) +void PopupMenuWin::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rect) { IntRect scrollRect = rect; scrollRect.move(scrollbar->x(), scrollbar->y()); @@ -707,7 +708,7 @@ void PopupMenu::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rec ::InvalidateRect(m_popup, &r, false); } -void PopupMenu::registerClass() +void PopupMenuWin::registerClass() { static bool haveRegisteredWindowClass = false; @@ -743,7 +744,7 @@ void PopupMenu::registerClass() } -LRESULT CALLBACK PopupMenu::PopupMenuWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +LRESULT CALLBACK PopupMenuWin::PopupMenuWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { #if OS(WINCE) LONG longPtr = GetWindowLong(hWnd, 0); @@ -751,7 +752,7 @@ LRESULT CALLBACK PopupMenu::PopupMenuWndProc(HWND hWnd, UINT message, WPARAM wPa LONG_PTR longPtr = GetWindowLongPtr(hWnd, 0); #endif - if (PopupMenu* popup = reinterpret_cast<PopupMenu*>(longPtr)) + if (PopupMenuWin* popup = reinterpret_cast<PopupMenuWin*>(longPtr)) return popup->wndProc(hWnd, message, wParam, lParam); if (message == WM_CREATE) { @@ -771,7 +772,7 @@ LRESULT CALLBACK PopupMenu::PopupMenuWndProc(HWND hWnd, UINT message, WPARAM wPa const int smoothScrollAnimationDuration = 5000; -LRESULT PopupMenu::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +LRESULT PopupMenuWin::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { LRESULT lResult = 0; diff --git a/WebCore/platform/win/PopupMenuWin.h b/WebCore/platform/win/PopupMenuWin.h new file mode 100644 index 0000000..d4a4255 --- /dev/null +++ b/WebCore/platform/win/PopupMenuWin.h @@ -0,0 +1,123 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef PopupMenuWin_h +#define PopupMenuWin_h + +#include "IntRect.h" +#include "PopupMenu.h" +#include "PopupMenuClient.h" +#include "Scrollbar.h" +#include "ScrollbarClient.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/RefPtr.h> + +typedef struct HWND__* HWND; +typedef struct HDC__* HDC; +typedef struct HBITMAP__* HBITMAP; + +namespace WebCore { + +class FrameView; +class Scrollbar; + +class PopupMenuWin : public PopupMenu, private ScrollbarClient { +public: + PopupMenuWin(PopupMenuClient*); + ~PopupMenuWin(); + + virtual void show(const IntRect&, FrameView*, int index); + virtual void hide(); + virtual void updateFromElement(); + virtual void disconnectClient(); + + static LPCTSTR popupClassName(); + +private: + PopupMenuClient* client() const { return m_popupClient; } + + Scrollbar* scrollbar() const { return m_scrollbar.get(); } + + bool up(unsigned lines = 1); + bool down(unsigned lines = 1); + + int itemHeight() const { return m_itemHeight; } + const IntRect& windowRect() const { return m_windowRect; } + IntRect clientRect() const; + + int visibleItems() const; + + int listIndexAtPoint(const IntPoint&) const; + + bool setFocusedIndex(int index, bool hotTracking = false); + int focusedIndex() const; + void focusFirst(); + void focusLast(); + + void paint(const IntRect& damageRect, HDC = 0); + + HWND popupHandle() const { return m_popup; } + + void setWasClicked(bool b = true) { m_wasClicked = b; } + bool wasClicked() const { return m_wasClicked; } + + void setScrollOffset(int offset) { m_scrollOffset = offset; } + int scrollOffset() const { return m_scrollOffset; } + + bool scrollToRevealSelection(); + + void incrementWheelDelta(int delta); + void reduceWheelDelta(int delta); + int wheelDelta() const { return m_wheelDelta; } + + bool scrollbarCapturingMouse() const { return m_scrollbarCapturingMouse; } + void setScrollbarCapturingMouse(bool b) { m_scrollbarCapturingMouse = b; } + + // ScrollBarClient + virtual void valueChanged(Scrollbar*); + virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&); + virtual bool isActive() const { return true; } + virtual bool scrollbarCornerPresent() const { return false; } + + void calculatePositionAndSize(const IntRect&, FrameView*); + void invalidateItem(int index); + + static LRESULT CALLBACK PopupMenuWndProc(HWND, UINT, WPARAM, LPARAM); + LRESULT wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); + static void registerClass(); + + PopupMenuClient* m_popupClient; + RefPtr<Scrollbar> m_scrollbar; + HWND m_popup; + HDC m_DC; + HBITMAP m_bmp; + bool m_wasClicked; + IntRect m_windowRect; + int m_itemHeight; + int m_scrollOffset; + int m_wheelDelta; + int m_focusedIndex; + bool m_scrollbarCapturingMouse; + bool m_showPopup; +}; + +} + +#endif // PopupMenuWin_h diff --git a/WebCore/platform/win/SearchPopupMenuWin.cpp b/WebCore/platform/win/SearchPopupMenuWin.cpp index f2709bb..e1bbe68 100644 --- a/WebCore/platform/win/SearchPopupMenuWin.cpp +++ b/WebCore/platform/win/SearchPopupMenuWin.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2006, 2007 Apple Inc. + * Copyright (C) 2010 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 @@ -18,19 +19,24 @@ */ #include "config.h" -#include "SearchPopupMenu.h" +#include "SearchPopupMenuWin.h" #include "AtomicString.h" #include <wtf/RetainPtr.h> namespace WebCore { -SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client) - : PopupMenu(client) +SearchPopupMenuWin::SearchPopupMenuWin(PopupMenuClient* client) + : m_popup(adoptRef(new PopupMenuWin(client))) { } -bool SearchPopupMenu::enabled() +PopupMenu* SearchPopupMenuWin::popupMenu() +{ + return m_popup.get(); +} + +bool SearchPopupMenuWin::enabled() { return true; } @@ -41,7 +47,7 @@ static RetainPtr<CFStringRef> autosaveKey(const String& name) return RetainPtr<CFStringRef>(AdoptCF, key.createCFString()); } -void SearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) +void SearchPopupMenuWin::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) { if (name.isEmpty()) return; @@ -61,7 +67,7 @@ void SearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector< CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication); } -void SearchPopupMenu::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems) +void SearchPopupMenuWin::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems) { if (name.isEmpty()) return; diff --git a/WebCore/platform/win/SearchPopupMenuWin.h b/WebCore/platform/win/SearchPopupMenuWin.h new file mode 100644 index 0000000..299a133 --- /dev/null +++ b/WebCore/platform/win/SearchPopupMenuWin.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef SearchPopupMenuWin_h +#define SearchPopupMenuWin_h + +#include "PopupMenuWin.h" +#include "SearchPopupMenu.h" + +namespace WebCore { + +class SearchPopupMenuWin : public SearchPopupMenu { +public: + SearchPopupMenuWin(PopupMenuClient*); + + virtual PopupMenu* popupMenu(); + virtual void saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems); + virtual void loadRecentSearches(const AtomicString& name, Vector<String>& searchItems); + virtual bool enabled(); + +private: + RefPtr<PopupMenuWin> m_popup; +}; + +} + +#endif // SearchPopupMenuWin_h diff --git a/WebCore/platform/wx/PopupMenuWx.cpp b/WebCore/platform/wx/PopupMenuWx.cpp index 9b0deba..e88d1e5 100644 --- a/WebCore/platform/wx/PopupMenuWx.cpp +++ b/WebCore/platform/wx/PopupMenuWx.cpp @@ -2,6 +2,7 @@ * This file is part of the popup menu implementation for <select> elements in WebCore. * * Copyright (C) 2008 Apple Computer, Inc. + * Copyright (C) 2010 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 @@ -21,7 +22,7 @@ */ #include "config.h" -#include "PopupMenu.h" +#include "PopupMenuWx.h" #include "Frame.h" #include "FrameView.h" @@ -41,18 +42,23 @@ static int s_menuStartId = wxNewId(); namespace WebCore { -PopupMenu::PopupMenu(PopupMenuClient* client) +PopupMenuWx::PopupMenuWx(PopupMenuClient* client) : m_popupClient(client) , m_menu(NULL) { } -PopupMenu::~PopupMenu() +PopupMenuWx::~PopupMenuWx() { delete m_menu; } -void PopupMenu::show(const IntRect& r, FrameView* v, int index) +void PopupMenuWx::disconnectClient() +{ + m_popupClient = 0; +} + +void PopupMenuWx::show(const IntRect& r, FrameView* v, int index) { // just delete and recreate delete m_menu; @@ -78,13 +84,13 @@ void PopupMenu::show(const IntRect& r, FrameView* v, int index) m_menu->Append(s_menuStartId + i, client()->itemText(i)); } } - nativeWin->Connect(s_menuStartId, s_menuStartId + (size-1), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(PopupMenu::OnMenuItemSelected), NULL, this); + nativeWin->Connect(s_menuStartId, s_menuStartId + (size-1), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(PopupMenuWx::OnMenuItemSelected), 0, this); nativeWin->PopupMenu(m_menu, r.x() - v->scrollX(), r.y() - v->scrollY()); - nativeWin->Disconnect(s_menuStartId, s_menuStartId + (size-1), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(PopupMenu::OnMenuItemSelected), NULL, this); + nativeWin->Disconnect(s_menuStartId, s_menuStartId + (size-1), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(PopupMenuWx::OnMenuItemSelected), 0, this); } } -void PopupMenu::OnMenuItemSelected(wxCommandEvent& event) +void PopupMenuWx::OnMenuItemSelected(wxCommandEvent& event) { if (client()) { client()->valueChanged(event.GetId() - s_menuStartId); @@ -93,20 +99,15 @@ void PopupMenu::OnMenuItemSelected(wxCommandEvent& event) // TODO: Do we need to call Disconnect here? Do we have a ref to the native window still? } -void PopupMenu::hide() +void PopupMenuWx::hide() { // we don't need to do anything here, the native control only exists during the time // show is called } -void PopupMenu::updateFromElement() +void PopupMenuWx::updateFromElement() { client()->setTextFromItem(m_popupClient->selectedIndex()); } -bool PopupMenu::itemWritingDirectionIsNatural() -{ - return false; -} - } diff --git a/WebCore/platform/wx/PopupMenuWx.h b/WebCore/platform/wx/PopupMenuWx.h new file mode 100644 index 0000000..c2573fc --- /dev/null +++ b/WebCore/platform/wx/PopupMenuWx.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef PopupMenuWx_h +#define PopupMenuWx_h + +#include "IntRect.h" +#include "PopupMenu.h" +#include "PopupMenuClient.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +#ifdef __WXMSW__ +#include <wx/msw/winundef.h> +#endif +class wxMenu; +#include <wx/defs.h> +#include <wx/event.h> + +namespace WebCore { + +class FrameView; +class Scrollbar; + +class PopupMenuWx : public PopupMenu, public wxEvtHandler { +public: + PopupMenuWx(PopupMenuClient*); + ~PopupMenuWx(); + + virtual void show(const IntRect&, FrameView*, int index); + virtual void hide(); + virtual void updateFromElement(); + virtual void disconnectClient(); + +private: + void OnMenuItemSelected(wxCommandEvent&); + PopupMenuClient* client() const { return m_popupClient; } + + PopupMenuClient* m_popupClient; + wxMenu* m_menu; +}; + +} + +#endif // PopupMenuWx_h diff --git a/WebCore/platform/wx/SearchPopupMenuWx.cpp b/WebCore/platform/wx/SearchPopupMenuWx.cpp index dbbe339..b724cf1 100644 --- a/WebCore/platform/wx/SearchPopupMenuWx.cpp +++ b/WebCore/platform/wx/SearchPopupMenuWx.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2009 Apple Inc. All Rights Reserved. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -24,32 +25,37 @@ */ #include "config.h" -#include "SearchPopupMenu.h" +#include "SearchPopupMenuWx.h" #include "NotImplemented.h" namespace WebCore { -SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client) - : PopupMenu(client) +SearchPopupMenuWx::SearchPopupMenuWx(PopupMenuClient* client) + : m_popup(adoptRef(new PopupMenuWx(client))) { notImplemented(); } -void SearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) +void SearchPopupMenuWx::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) { notImplemented(); } -void SearchPopupMenu::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems) +void SearchPopupMenuWx::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems) { notImplemented(); } -bool SearchPopupMenu::enabled() +bool SearchPopupMenuWx::enabled() { return true; } +PopupMenu* SearchPopupMenuWx::popupMenu() +{ + return m_popup.get(); +} + } diff --git a/WebCore/platform/wx/SearchPopupMenuWx.h b/WebCore/platform/wx/SearchPopupMenuWx.h new file mode 100644 index 0000000..552a8fe --- /dev/null +++ b/WebCore/platform/wx/SearchPopupMenuWx.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef SearchPopupMenuWx_h +#define SearchPopupMenuWx_h + +#include "PopupMenuWx.h" +#include "SearchPopupMenu.h" + +namespace WebCore { + +class SearchPopupMenuWx : public SearchPopupMenu { +public: + SearchPopupMenuWx(PopupMenuClient*); + + virtual PopupMenu* popupMenu(); + virtual void saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems); + virtual void loadRecentSearches(const AtomicString& name, Vector<String>& searchItems); + virtual bool enabled(); + +private: + RefPtr<PopupMenuWx> m_popup; +}; + +} + +#endif // SearchPopupMenuWx_h diff --git a/WebCore/plugins/PluginViewBase.h b/WebCore/plugins/PluginViewBase.h index 3c43c00..4e5fe1a 100644 --- a/WebCore/plugins/PluginViewBase.h +++ b/WebCore/plugins/PluginViewBase.h @@ -44,7 +44,7 @@ public: virtual PlatformLayer* platformLayer() const { return 0; } #endif - virtual JSC::JSObject* scriptObject(JSC::ExecState*, JSC::JSGlobalObject*) { return 0; } + virtual JSC::JSObject* scriptObject(JSC::JSGlobalObject*) { return 0; } protected: PluginViewBase(PlatformWidget widget) : Widget(widget) { } diff --git a/WebCore/rendering/EllipsisBox.cpp b/WebCore/rendering/EllipsisBox.cpp index 96efbe2..951df9f 100644 --- a/WebCore/rendering/EllipsisBox.cpp +++ b/WebCore/rendering/EllipsisBox.cpp @@ -113,6 +113,7 @@ bool EllipsisBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu } } +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE IntRect boundsRect = IntRect(tx, ty, m_width, m_height); if (visibleToHitTesting() && result.intersects(x, y, boundsRect)) { @@ -129,6 +130,13 @@ bool EllipsisBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu } #endif return true; +======= + IntRect boundsRect = IntRect(tx, ty, m_width, m_height); + if (visibleToHitTesting() && boundsRect.intersects(result.rectFromPoint(x, y))) { + renderer()->updateHitTestResult(result, IntPoint(x - tx, y - ty)); + if (!result.addNodeToRectBasedTestResult(renderer()->node(), x, y, boundsRect)) + return true; +>>>>>>> webkit.org at r64523 } return false; diff --git a/WebCore/rendering/HitTestResult.cpp b/WebCore/rendering/HitTestResult.cpp index 8a4ef3c..e1dfecb 100644 --- a/WebCore/rendering/HitTestResult.cpp +++ b/WebCore/rendering/HitTestResult.cpp @@ -49,9 +49,11 @@ using namespace HTMLNames; HitTestResult::HitTestResult(const IntPoint& point) : m_point(point) , m_isOverWidget(false) + , m_isRectBased(false) { } +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE HitTestResult::HitTestResult(const IntPoint& point, const IntSize& padding) : m_point(point) @@ -60,6 +62,17 @@ HitTestResult::HitTestResult(const IntPoint& point, const IntSize& padding) { } #endif +======= +HitTestResult::HitTestResult(const IntPoint& centerPoint, const IntSize& padding) + : m_point(centerPoint) + , m_isOverWidget(false) +{ + // If a zero padding is passed in or either width or height is negative, then it + // is not a valid padding and hence not a rect based hit test. + m_isRectBased = !(padding.isZero() || (padding.width() < 0 || padding.height() < 0)); + m_padding = m_isRectBased ? padding : IntSize(); +} +>>>>>>> webkit.org at r64523 HitTestResult::HitTestResult(const HitTestResult& other) : m_innerNode(other.innerNode()) @@ -74,6 +87,12 @@ HitTestResult::HitTestResult(const HitTestResult& other) , m_rawNodeList(other.rawNodeList()) #endif { + // Only copy the padding and ListHashSet in case of rect hit test. + // Copying the later is rather expensive. + if ((m_isRectBased = other.isRectBasedTest())) { + m_padding = other.padding(); + m_rectBasedTestResult = other.rectBasedTestResult(); + } } HitTestResult::~HitTestResult() @@ -89,10 +108,19 @@ HitTestResult& HitTestResult::operator=(const HitTestResult& other) m_innerURLElement = other.URLElement(); m_scrollbar = other.scrollbar(); m_isOverWidget = other.isOverWidget(); +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE m_pointPadding = other.pointPadding(); m_rawNodeList = other.rawNodeList(); #endif +======= + // Only copy the padding and ListHashSet in case of rect hit test. + // Copying the later is rather expensive. + if ((m_isRectBased = other.isRectBasedTest())) { + m_padding = other.padding(); + m_rectBasedTestResult = other.rectBasedTestResult(); + } +>>>>>>> webkit.org at r64523 return *this; } @@ -379,6 +407,7 @@ bool HitTestResult::isContentEditable() const return m_innerNonSharedNode->isContentEditable(); } +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE bool HitTestResult::intersects(int x, int y, const IntRect& other) const @@ -395,6 +424,29 @@ bool HitTestResult::containedBy(int x, int y, const IntRect& other) const void HitTestResult::merge(const HitTestResult& other) { +======= +bool HitTestResult::addNodeToRectBasedTestResult(Node* node, int x, int y, const IntRect& rect) +{ + // If it is not a rect-based hit test, this method has to be no-op. + // Return false, so the hit test stops. + if (!isRectBasedTest()) + return false; + + // If node is null, return true so the hit test can continue. + if (!node) + return true; + + node = node->shadowAncestorNode(); + m_rectBasedTestResult.add(node); + + return !rect.contains(rectFromPoint(x, y)); +} + +void HitTestResult::append(const HitTestResult& other) +{ + ASSERT(isRectBasedTest() && other.isRectBasedTest()); + +>>>>>>> webkit.org at r64523 if (!m_innerNode && other.innerNode()) { m_innerNode = other.innerNode(); m_innerNonSharedNode = other.innerNonSharedNode(); @@ -404,6 +456,7 @@ void HitTestResult::merge(const HitTestResult& other) m_isOverWidget = other.isOverWidget(); } +<<<<<<< HEAD const Vector<RefPtr<Node> >& list = other.rawNodeList(); Vector<RefPtr<Node> >::const_iterator last = list.end(); for (Vector<RefPtr<Node> >::const_iterator it = list.begin(); it != last; ++it) @@ -425,4 +478,12 @@ void HitTestResult::addRawNode(Node* node) #endif // ANDROID_HITTEST_WITHSIZE +======= + const ListHashSet<RefPtr<Node> >& list = other.rectBasedTestResult(); + ListHashSet<RefPtr<Node> >::const_iterator last = list.end(); + for (ListHashSet<RefPtr<Node> >::const_iterator it = list.begin(); it != last; ++it) + m_rectBasedTestResult.add(it->get()); +} + +>>>>>>> webkit.org at r64523 } // namespace WebCore diff --git a/WebCore/rendering/HitTestResult.h b/WebCore/rendering/HitTestResult.h index 0f45900..6d39e8d 100644 --- a/WebCore/rendering/HitTestResult.h +++ b/WebCore/rendering/HitTestResult.h @@ -21,11 +21,17 @@ #define HitTestResult_h #include "IntPoint.h" +#include "IntRect.h" +#include "IntSize.h" #include "TextDirection.h" +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE #include <IntSize.h> #include <wtf/Vector.h> #endif +======= +#include <wtf/ListHashSet.h> +>>>>>>> webkit.org at r64523 #include <wtf/RefPtr.h> namespace WebCore { @@ -42,6 +48,8 @@ class String; class HitTestResult { public: HitTestResult(const IntPoint&); + // Pass a non-negative IntSize value as padding to perform a rect-based hit test. + HitTestResult(const IntPoint& centerPoint, const IntSize& padding); HitTestResult(const HitTestResult&); ~HitTestResult(); HitTestResult& operator=(const HitTestResult&); @@ -80,6 +88,7 @@ public: bool isLiveLink() const; bool isContentEditable() const; +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE HitTestResult(const IntPoint&, const IntSize&); @@ -92,8 +101,23 @@ public: void addRawNode(Node*); const Vector<RefPtr<Node> >& rawNodeList() const { return m_rawNodeList; } #endif +======= + // Rect-based hit test related methods. + bool isRectBasedTest() const { return m_isRectBased; } + IntRect rectFromPoint(int x, int y) const; + IntRect rectFromPoint(const IntPoint&) const; + IntSize padding() const { return m_padding; } + int paddingWidth() const { return m_padding.width() >= 0 ? m_padding.width() : 0; } + int paddingHeight() const { return m_padding.height() >= 0 ? m_padding.height() : 0; } + // Returns true if it is rect-based hit test and needs to continue until the rect is fully + // enclosed by the boundaries of a node. + bool addNodeToRectBasedTestResult(Node*, int x, int y, const IntRect& rect = IntRect()); + const ListHashSet<RefPtr<Node> >& rectBasedTestResult() const { return m_rectBasedTestResult; } + void append(const HitTestResult&); +>>>>>>> webkit.org at r64523 private: + RefPtr<Node> m_innerNode; RefPtr<Node> m_innerNonSharedNode; IntPoint m_point; @@ -102,13 +126,45 @@ private: RefPtr<Element> m_innerURLElement; RefPtr<Scrollbar> m_scrollbar; bool m_isOverWidget; // Returns true if we are over a widget (and not in the border/padding area of a RenderWidget for example). +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE IntSize m_pointPadding; Vector<RefPtr<Node> > m_rawNodeList; #endif +======= + bool m_isRectBased; + IntSize m_padding; + ListHashSet<RefPtr<Node> > m_rectBasedTestResult; +>>>>>>> webkit.org at r64523 }; +inline IntRect HitTestResult::rectFromPoint(int x, int y) const +{ + return rectFromPoint(IntPoint(x, y)); +} + +// Formula: +// x = p.x() - padding.width() +// y = p.y() - padding.height() +// width = 2 * padding.width() + 1 +// height = 2 * m_padding.height() + 1 +inline IntRect HitTestResult::rectFromPoint(const IntPoint& point) const +{ + IntPoint realPoint(point); + IntSize realPadding(m_padding); + + // Real IntPoint for the rect. + realPadding.clampNegativeToZero(); + realPoint -= realPadding; + + // Real IntSize for the rect. + realPadding.scale(2); + realPadding += IntSize(1, 1); + + return IntRect(realPoint, realPadding); +} + String displayString(const String&, const Node*); } // namespace WebCore diff --git a/WebCore/rendering/InlineFlowBox.cpp b/WebCore/rendering/InlineFlowBox.cpp index 8ac8c40..daa48f2 100644 --- a/WebCore/rendering/InlineFlowBox.cpp +++ b/WebCore/rendering/InlineFlowBox.cpp @@ -611,11 +611,15 @@ bool InlineFlowBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& re { IntRect overflowRect(visibleOverflowRect()); overflowRect.move(tx, ty); +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE if (!result.intersects(x, y, overflowRect)) #else if (!overflowRect.contains(x, y)) #endif +======= + if (!overflowRect.intersects(result.rectFromPoint(x, y))) +>>>>>>> webkit.org at r64523 return false; // Check children first. @@ -628,6 +632,7 @@ bool InlineFlowBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& re // Now check ourselves. IntRect rect(tx + m_x, ty + m_y, m_width, height()); +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE if (visibleToHitTesting() && result.intersects(x, y, rect)) { #else @@ -643,6 +648,12 @@ bool InlineFlowBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& re } #endif return true; +======= + if (visibleToHitTesting() && rect.intersects(result.rectFromPoint(x, y))) { + renderer()->updateHitTestResult(result, IntPoint(x - tx, y - ty)); // Don't add in m_x or m_y here, we want coords in the containing block's space. + if (!result.addNodeToRectBasedTestResult(renderer()->node(), x, y, rect)) + return true; +>>>>>>> webkit.org at r64523 } return false; diff --git a/WebCore/rendering/InlineTextBox.cpp b/WebCore/rendering/InlineTextBox.cpp index d6bd70c..b0e2887 100644 --- a/WebCore/rendering/InlineTextBox.cpp +++ b/WebCore/rendering/InlineTextBox.cpp @@ -287,6 +287,7 @@ bool InlineTextBox::nodeAtPoint(const HitTestRequest&, HitTestResult& result, in return false; IntRect rect(tx + m_x, ty + m_y, m_width, height()); +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE if (m_truncation != cFullTruncation && visibleToHitTesting() && result.intersects(x, y, rect)) { #else @@ -302,6 +303,12 @@ bool InlineTextBox::nodeAtPoint(const HitTestRequest&, HitTestResult& result, in } #endif return true; +======= + if (m_truncation != cFullTruncation && visibleToHitTesting() && rect.intersects(result.rectFromPoint(x, y))) { + renderer()->updateHitTestResult(result, IntPoint(x - tx, y - ty)); + if (!result.addNodeToRectBasedTestResult(renderer()->node(), x, y, rect)) + return true; +>>>>>>> webkit.org at r64523 } return false; } diff --git a/WebCore/rendering/RenderBlock.cpp b/WebCore/rendering/RenderBlock.cpp index 1b855d4..3f369c3 100644 --- a/WebCore/rendering/RenderBlock.cpp +++ b/WebCore/rendering/RenderBlock.cpp @@ -3767,16 +3767,21 @@ bool RenderBlock::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu // Check if we need to do anything at all. IntRect overflowBox = visibleOverflowRect(); overflowBox.move(tx, ty); +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE if (!result.intersects(_x, _y, overflowBox)) #else if (!overflowBox.contains(_x, _y)) #endif +======= + if (!overflowBox.intersects(result.rectFromPoint(_x, _y))) +>>>>>>> webkit.org at r64523 return false; } if ((hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChildBlockBackground) && isPointInOverflowControl(result, _x, _y, tx, ty)) { updateHitTestResult(result, IntPoint(_x - tx, _y - ty)); +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE // TODO: isPointInOverflowControl() doesn't handle region test yet. if (result.isRegionTest()) { @@ -3785,16 +3790,26 @@ bool RenderBlock::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu } else #endif return true; +======= + // FIXME: isPointInOverflowControl() doesn't handle rect-based tests yet. + if (!result.addNodeToRectBasedTestResult(node(), _x, _y)) + return true; +>>>>>>> webkit.org at r64523 } // If we have clipping, then we can't have any spillout. bool useOverflowClip = hasOverflowClip() && !hasSelfPaintingLayer(); bool useClip = (hasControlClip() || useOverflowClip); +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE bool checkChildren = !useClip || (hasControlClip() ? result.intersects(_x, _y, controlClipRect(tx, ty)) : result.intersects(_x, _y, overflowClipRect(tx, ty))); #else bool checkChildren = !useClip || (hasControlClip() ? controlClipRect(tx, ty).contains(_x, _y) : overflowClipRect(tx, ty).contains(_x, _y)); #endif +======= + IntRect hitTestArea(result.rectFromPoint(_x, _y)); + bool checkChildren = !useClip || (hasControlClip() ? controlClipRect(tx, ty).intersects(hitTestArea) : overflowClipRect(tx, ty).intersects(hitTestArea)); +>>>>>>> webkit.org at r64523 if (checkChildren) { // Hit test descendants first. int scrolledX = tx; @@ -3842,6 +3857,7 @@ bool RenderBlock::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu // Now hit test our background if (hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChildBlockBackground) { IntRect boundsRect(tx, ty, width(), height()); +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE if (visibleToHitTesting() && result.intersects(_x, _y, boundsRect)) { #else @@ -3857,6 +3873,12 @@ bool RenderBlock::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu } #endif return true; +======= + if (visibleToHitTesting() && boundsRect.intersects(result.rectFromPoint(_x, _y))) { + updateHitTestResult(result, IntPoint(_x - tx, _y - ty)); + if (!result.addNodeToRectBasedTestResult(node(), _x, _y, boundsRect)) + return true; +>>>>>>> webkit.org at r64523 } } @@ -3881,22 +3903,33 @@ bool RenderBlock::hitTestColumns(const HitTestRequest& request, HitTestResult& r currYOffset += colRect.height(); colRect.move(tx, ty); +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE if (result.intersects(x, y, colRect)) { #else if (colRect.contains(x, y)) { #endif +======= + if (colRect.intersects(result.rectFromPoint(x, y))) { +>>>>>>> webkit.org at r64523 // The point is inside this column. // Adjust tx and ty to change where we hit test. int finalX = tx + currXOffset; int finalY = ty + currYOffset; +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE if (result.isRegionTest() && !result.containedBy(x, y, colRect)) hitTestContents(request, result, x, y, finalX, finalY, hitTestAction); else #endif return hitTestContents(request, result, x, y, finalX, finalY, hitTestAction); +======= + if (result.isRectBasedTest() && !colRect.contains(result.rectFromPoint(x, y))) + hitTestContents(request, result, x, y, finalX, finalY, hitTestAction); + else + return hitTestContents(request, result, x, y, finalX, finalY, hitTestAction); +>>>>>>> webkit.org at r64523 } } diff --git a/WebCore/rendering/RenderBox.cpp b/WebCore/rendering/RenderBox.cpp index 2deeffc..b546893 100644 --- a/WebCore/rendering/RenderBox.cpp +++ b/WebCore/rendering/RenderBox.cpp @@ -31,6 +31,7 @@ #include "Document.h" #include "FrameView.h" #include "GraphicsContext.h" +#include "HitTestResult.h" #include "htmlediting.h" #include "HTMLElement.h" #include "HTMLNames.h" @@ -568,6 +569,7 @@ bool RenderBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result #else // Check our bounds next. For this purpose always assume that we can only be hit in the // foreground phase (which is true for replaced elements like images). +<<<<<<< HEAD if (visibleToHitTesting() && action == HitTestForeground && IntRect(tx, ty, width(), height()).contains(xPos, yPos)) { #endif updateHitTestResult(result, IntPoint(xPos - tx, yPos - ty)); @@ -580,6 +582,13 @@ bool RenderBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result } #endif return true; +======= + IntRect boundsRect = IntRect(tx, ty, width(), height()); + if (visibleToHitTesting() && action == HitTestForeground && boundsRect.intersects(result.rectFromPoint(xPos, yPos))) { + updateHitTestResult(result, IntPoint(xPos - tx, yPos - ty)); + if (!result.addNodeToRectBasedTestResult(node(), xPos, yPos, boundsRect)) + return true; +>>>>>>> webkit.org at r64523 } return false; @@ -1595,7 +1604,7 @@ void RenderBox::calcHeight() && (isRoot() || (isBody() && document()->documentElement()->renderer()->style()->height().isPercent())); if (stretchesToViewHeight() || printingNeedsBaseHeight) { int margins = collapsedMarginTop() + collapsedMarginBottom(); - int visHeight = document()->printing() ? view()->frameView()->visibleHeight() : view()->viewHeight(); + int visHeight = document()->printing() ? view()->frameView()->pageHeight() : view()->viewHeight(); if (isRoot()) setHeight(max(height(), visHeight - margins)); else { diff --git a/WebCore/rendering/RenderForeignObject.cpp b/WebCore/rendering/RenderForeignObject.cpp index 8b84f97..50c1a42 100644 --- a/WebCore/rendering/RenderForeignObject.cpp +++ b/WebCore/rendering/RenderForeignObject.cpp @@ -117,14 +117,16 @@ void RenderForeignObject::layout() // FIXME: Investigate in location rounding issues - only affects RenderForeignObject & RenderSVGText setLocation(roundedIntPoint(viewportLocation)); + + bool layoutChanged = m_everHadLayout && selfNeedsLayout(); RenderBlock::layout(); + ASSERT(!needsLayout()); - // Invalidate all resources of this client, if we changed something. - if (m_everHadLayout && selfNeedsLayout()) - RenderSVGResource::invalidateAllResourcesOfRenderer(this); + // Invalidate all resources of this client if our layout changed. + if (layoutChanged) + SVGResourcesCache::clientLayoutChanged(this); repainter.repaintAfterLayout(); - setNeedsLayout(false); } bool RenderForeignObject::nodeAtFloatPoint(const HitTestRequest& request, HitTestResult& result, const FloatPoint& pointInParent, HitTestAction hitTestAction) diff --git a/WebCore/rendering/RenderHTMLCanvas.cpp b/WebCore/rendering/RenderHTMLCanvas.cpp index 8c17a0e..c89495b 100644 --- a/WebCore/rendering/RenderHTMLCanvas.cpp +++ b/WebCore/rendering/RenderHTMLCanvas.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "RenderHTMLCanvas.h" +#include "CanvasRenderingContext.h" #include "Document.h" #include "GraphicsContext.h" #include "HTMLCanvasElement.h" @@ -48,12 +49,8 @@ bool RenderHTMLCanvas::requiresLayer() const if (RenderReplaced::requiresLayer()) return true; -#if ENABLE(3D_CANVAS) HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(node()); - return canvas && canvas->is3D(); -#else - return false; -#endif + return canvas && canvas->renderingContext() && canvas->renderingContext()->isAccelerated(); } void RenderHTMLCanvas::paintReplaced(PaintInfo& paintInfo, int tx, int ty) diff --git a/WebCore/rendering/RenderImage.cpp b/WebCore/rendering/RenderImage.cpp index 643fac9..3612ed5 100644 --- a/WebCore/rendering/RenderImage.cpp +++ b/WebCore/rendering/RenderImage.cpp @@ -387,6 +387,7 @@ HTMLMapElement* RenderImage::imageMap() const bool RenderImage::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, int x, int y, int tx, int ty, HitTestAction hitTestAction) { +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE HitTestResult tempResult(result.point(), result.pointPadding()); #else @@ -399,6 +400,12 @@ bool RenderImage::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu #else if (inside && node()) { #endif +======= + HitTestResult tempResult(result.point(), result.padding()); + bool inside = RenderReplaced::nodeAtPoint(request, tempResult, x, y, tx, ty, hitTestAction); + + if (tempResult.innerNode() && node()) { +>>>>>>> webkit.org at r64523 if (HTMLMapElement* map = imageMap()) { IntRect contentBox = contentBoxRect(); float zoom = style()->effectiveZoom(); @@ -409,10 +416,15 @@ bool RenderImage::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu } } +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE if (!inside && result.isRegionTest()) result.merge(tempResult); #endif +======= + if (!inside && result.isRectBasedTest()) + result.append(tempResult); +>>>>>>> webkit.org at r64523 if (inside) result = tempResult; return inside; diff --git a/WebCore/rendering/RenderLayer.cpp b/WebCore/rendering/RenderLayer.cpp index 756a9b3..998ffa7 100644 --- a/WebCore/rendering/RenderLayer.cpp +++ b/WebCore/rendering/RenderLayer.cpp @@ -1800,6 +1800,9 @@ void RenderLayer::destroyScrollbar(ScrollbarOrientation orientation) { RefPtr<Scrollbar>& scrollbar = orientation == HorizontalScrollbar ? m_hBar : m_vBar; if (scrollbar) { + if (scrollbar->isCustomScrollbar()) + static_cast<RenderScrollbar*>(scrollbar.get())->clearOwningRenderer(); + scrollbar->removeFromParent(); scrollbar->setClient(0); scrollbar = 0; @@ -2749,18 +2752,24 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* cont #if USE(ACCELERATED_COMPOSITING) useTemporaryClipRects = compositor()->inCompositingMode(); #endif - + + IntRect hitTestArea = result.rectFromPoint(hitTestPoint); + // Apply a transform if we have one. if (transform() && !appliedTransform) { // Make sure the parent's clip rects have been calculated. if (parent()) { IntRect clipRect = backgroundClipRect(rootLayer, useTemporaryClipRects); // Go ahead and test the enclosing clip now. +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE if (!result.intersects(hitTestPoint.x(), hitTestPoint.y(), clipRect)) #else if (!clipRect.contains(hitTestPoint)) #endif +======= + if (!clipRect.intersects(hitTestArea)) +>>>>>>> webkit.org at r64523 return 0; } @@ -2873,6 +2882,7 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* cont } // Next we want to see if the mouse pos is inside the child RenderObjects of the layer. +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE if (result.intersects(hitTestPoint.x(), hitTestPoint.y(), fgRect) && isSelfPaintingLayer()) { #else @@ -2892,15 +2902,31 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* cont else #endif result = tempResult; +======= + if (fgRect.intersects(hitTestArea) && isSelfPaintingLayer()) { + // Hit test with a temporary HitTestResult, because we only want to commit to 'result' if we know we're frontmost. + HitTestResult tempResult(result.point(), result.padding()); + if (hitTestContents(request, tempResult, layerBounds, hitTestPoint, HitTestDescendants) && + isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTransformState.get())) { + if (result.isRectBasedTest()) + result.append(tempResult); + else + result = tempResult; +>>>>>>> webkit.org at r64523 if (!depthSortDescendants) return this; // Foreground can depth-sort with descendant layers, so keep this as a candidate. candidateLayer = this; +<<<<<<< HEAD } #ifdef ANDROID_HITTEST_WITHSIZE else if (result.isRegionTest()) result.merge(tempResult); #endif +======= + } else if (result.isRectBasedTest()) + result.append(tempResult); +>>>>>>> webkit.org at r64523 } // Now check our negative z-index children. @@ -2916,6 +2942,7 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* cont if (candidateLayer) return candidateLayer; +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE if (result.intersects(hitTestPoint.x(), hitTestPoint.y(), bgRect) && isSelfPaintingLayer()) { HitTestResult tempResult(result.point(), result.pointPadding()); @@ -2937,6 +2964,19 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* cont else if (result.isRegionTest()) result.merge(tempResult); #endif +======= + if (bgRect.intersects(hitTestArea) && isSelfPaintingLayer()) { + HitTestResult tempResult(result.point(), result.padding()); + if (hitTestContents(request, tempResult, layerBounds, hitTestPoint, HitTestSelf) && + isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTransformState.get())) { + if (result.isRectBasedTest()) + result.append(tempResult); + else + result = tempResult; + return this; + } else if (result.isRectBasedTest()) + result.append(tempResult); +>>>>>>> webkit.org at r64523 } return 0; @@ -2948,8 +2988,9 @@ bool RenderLayer::hitTestContents(const HitTestRequest& request, HitTestResult& layerBounds.x() - renderBoxX(), layerBounds.y() - renderBoxY(), hitTestFilter)) { - // It's wrong to set innerNode, but then claim that you didn't hit anything. - ASSERT(!result.innerNode()); + // It's wrong to set innerNode, but then claim that you didn't hit anything, unless it is + // a rect-based test. + ASSERT(!result.innerNode() || (result.isRectBasedTest() && result.rectBasedTestResult().size())); return false; } @@ -2983,25 +3024,39 @@ RenderLayer* RenderLayer::hitTestList(Vector<RenderLayer*>* list, RenderLayer* r for (int i = list->size() - 1; i >= 0; --i) { RenderLayer* childLayer = list->at(i); RenderLayer* hitLayer = 0; +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE HitTestResult tempResult(result.point(), result.pointPadding()); #else HitTestResult tempResult(result.point()); #endif +======= + HitTestResult tempResult(result.point(), result.padding()); +>>>>>>> webkit.org at r64523 if (childLayer->isPaginated()) hitLayer = hitTestPaginatedChildLayer(childLayer, rootLayer, request, tempResult, hitTestRect, hitTestPoint, transformState, zOffsetForDescendants); else hitLayer = childLayer->hitTestLayer(rootLayer, this, request, tempResult, hitTestRect, hitTestPoint, false, transformState, zOffsetForDescendants); +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE if (result.isRegionTest()) result.merge(tempResult); #endif +======= + + // If it a rect-based test, we can safely append the temporary result since it might had hit + // nodes but not necesserily had hitLayer set. + if (result.isRectBasedTest()) + result.append(tempResult); + +>>>>>>> webkit.org at r64523 if (isHitCandidate(hitLayer, depthSortDescendants, zOffset, unflattenedTransformState)) { #ifdef ANDROID_HITTEST_WITHSIZE if (!result.isRegionTest()) #endif resultLayer = hitLayer; - result = tempResult; + if (!result.isRectBasedTest()) + result = tempResult; if (!depthSortDescendants) break; } @@ -3061,7 +3116,7 @@ RenderLayer* RenderLayer::hitTestChildLayerColumns(RenderLayer* childLayer, Rend IntRect localClipRect(hitTestRect); localClipRect.intersect(colRect); - if (!localClipRect.isEmpty() && localClipRect.contains(hitTestPoint)) { + if (!localClipRect.isEmpty() && localClipRect.intersects(result.rectFromPoint(hitTestPoint))) { RenderLayer* hitLayer = 0; if (!columnIndex) { // Apply a translation transform to change where the layer paints. diff --git a/WebCore/rendering/RenderLayerBacking.cpp b/WebCore/rendering/RenderLayerBacking.cpp index d66dfc2..e1cf2a2 100644 --- a/WebCore/rendering/RenderLayerBacking.cpp +++ b/WebCore/rendering/RenderLayerBacking.cpp @@ -666,6 +666,9 @@ bool RenderLayerBacking::isSimpleContainerCompositingLayer() const if (hasBoxDecorationsOrBackground(renderObject)) return false; + if (m_owningLayer->hasOverflowControls()) + return false; + // If we have got this far and the renderer has no children, then we're ok. if (!renderObject->firstChild()) return true; @@ -694,26 +697,23 @@ bool RenderLayerBacking::isSimpleContainerCompositingLayer() const if (hasBoxDecorationsOrBackgroundImage(style)) return false; - // Ceck to see if all the body's children are compositing layers. - if (hasNonCompositingContent()) + // Check to see if all the body's children are compositing layers. + if (hasNonCompositingDescendants()) return false; return true; } // Check to see if all the renderer's children are compositing layers. - if (hasNonCompositingContent()) + if (hasNonCompositingDescendants()) return false; return true; } // Conservative test for having no rendered children. -bool RenderLayerBacking::hasNonCompositingContent() const +bool RenderLayerBacking::hasNonCompositingDescendants() const { - if (m_owningLayer->hasOverflowControls()) - return true; - // Some HTML can cause whitespace text nodes to have renderers, like: // <div> // <img src=...> @@ -911,7 +911,7 @@ FloatPoint RenderLayerBacking::contentsToGraphicsLayerCoordinates(const Graphics bool RenderLayerBacking::paintingGoesToWindow() const { if (m_owningLayer->isRootLayer()) - return compositor()->rootLayerAttachment() == RenderLayerCompositor::RootLayerAttachedViaChromeClient; + return compositor()->rootLayerAttachment() != RenderLayerCompositor::RootLayerAttachedViaEnclosingIframe; return false; } diff --git a/WebCore/rendering/RenderLayerBacking.h b/WebCore/rendering/RenderLayerBacking.h index 852fc04..808000b 100644 --- a/WebCore/rendering/RenderLayerBacking.h +++ b/WebCore/rendering/RenderLayerBacking.h @@ -173,7 +173,7 @@ private: bool rendererHasBackground() const; const Color rendererBackgroundColor() const; - bool hasNonCompositingContent() const; + bool hasNonCompositingDescendants() const; void paintIntoLayer(RenderLayer* rootLayer, GraphicsContext*, const IntRect& paintDirtyRect, PaintBehavior paintBehavior, GraphicsLayerPaintingPhase, RenderObject* paintingRoot); diff --git a/WebCore/rendering/RenderLayerCompositor.cpp b/WebCore/rendering/RenderLayerCompositor.cpp index 3d16864..b60dec9 100644 --- a/WebCore/rendering/RenderLayerCompositor.cpp +++ b/WebCore/rendering/RenderLayerCompositor.cpp @@ -29,6 +29,7 @@ #include "RenderLayerCompositor.h" #include "AnimationController.h" +#include "CanvasRenderingContext.h" #include "CSSPropertyNames.h" #include "Chrome.h" #include "ChromeClient.h" @@ -1271,14 +1272,10 @@ bool RenderLayerCompositor::requiresCompositingForVideo(RenderObject* renderer) bool RenderLayerCompositor::requiresCompositingForCanvas(RenderObject* renderer) const { -#if ENABLE(3D_CANVAS) if (renderer->isCanvas()) { HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(renderer->node()); - return canvas->is3D(); + return canvas->renderingContext() && canvas->renderingContext()->isAccelerated(); } -#else - UNUSED_PARAM(renderer); -#endif return false; } diff --git a/WebCore/rendering/RenderLineBoxList.cpp b/WebCore/rendering/RenderLineBoxList.cpp index 3e4c882..06aab89 100644 --- a/WebCore/rendering/RenderLineBoxList.cpp +++ b/WebCore/rendering/RenderLineBoxList.cpp @@ -29,6 +29,7 @@ #include "config.h" #include "RenderLineBoxList.h" +#include "HitTestResult.h" #include "InlineTextBox.h" #ifdef ANDROID_HITTEST_WITHSIZE #include "HitTestResult.h" @@ -248,22 +249,32 @@ bool RenderLineBoxList::hitTest(RenderBoxModelObject* renderer, const HitTestReq // contain the point. This is a quick short-circuit that we can take to avoid walking any lines. // FIXME: This check is flawed in the following extremely obscure way: // if some line in the middle has a huge overflow, it might actually extend below the last line. +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE if ((y - result.pointPadding().height() >= ty + lastLineBox()->root()->bottomVisibleOverflow()) || (y + result.pointPadding().height() < ty + firstLineBox()->root()->topVisibleOverflow())) #else if ((y >= ty + lastLineBox()->root()->bottomVisibleOverflow()) || (y < ty + firstLineBox()->root()->topVisibleOverflow())) #endif +======= + if (y - result.paddingHeight() >= ty + lastLineBox()->root()->bottomVisibleOverflow() + || y + result.paddingHeight() < ty + firstLineBox()->root()->topVisibleOverflow()) +>>>>>>> webkit.org at r64523 return false; // See if our root lines contain the point. If so, then we hit test // them further. Note that boxes can easily overlap, so we can't make any assumptions // based off positions of our first line box or our last line box. for (InlineFlowBox* curr = lastLineBox(); curr; curr = curr->prevLineBox()) { +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE if (y + result.pointPadding().height() >= ty + curr->root()->topVisibleOverflow() && y - result.pointPadding().height() < ty + curr->root()->bottomVisibleOverflow()) { #else if (y >= ty + curr->root()->topVisibleOverflow() && y < ty + curr->root()->bottomVisibleOverflow()) { #endif +======= + if (y + result.paddingHeight() >= ty + curr->root()->topVisibleOverflow() + && y - result.paddingHeight() < ty + curr->root()->bottomVisibleOverflow()) { +>>>>>>> webkit.org at r64523 bool inside = curr->nodeAtPoint(request, result, x, y, tx, ty); if (inside) { renderer->updateHitTestResult(result, IntPoint(x - tx, y - ty)); diff --git a/WebCore/rendering/RenderMenuList.cpp b/WebCore/rendering/RenderMenuList.cpp index ff16e7e..b6a97a9 100644 --- a/WebCore/rendering/RenderMenuList.cpp +++ b/WebCore/rendering/RenderMenuList.cpp @@ -26,6 +26,7 @@ #include "RenderMenuList.h" #include "AXObjectCache.h" +#include "Chrome.h" #include "CSSStyleSelector.h" #include "Frame.h" #include "FrameView.h" @@ -88,8 +89,8 @@ void RenderMenuList::adjustInnerStyle() m_innerBlock->style()->setPaddingRight(Length(theme()->popupInternalPaddingRight(style()), Fixed)); m_innerBlock->style()->setPaddingTop(Length(theme()->popupInternalPaddingTop(style()), Fixed)); m_innerBlock->style()->setPaddingBottom(Length(theme()->popupInternalPaddingBottom(style()), Fixed)); - - if (PopupMenu::itemWritingDirectionIsNatural()) { + + if (document()->page()->chrome()->selectItemWritingDirectionIsNatural()) { // Items in the popup will not respect the CSS text-align and direction properties, // so we must adjust our own style to match. m_innerBlock->style()->setTextAlign(LEFT); @@ -278,7 +279,7 @@ void RenderMenuList::showPopup() // inside the showPopup call and it would fail. createInnerBlock(); if (!m_popup) - m_popup = PopupMenu::create(this); + m_popup = document()->page()->chrome()->createPopupMenu(this); SelectElement* select = toSelectElement(static_cast<Element*>(node())); m_popupIsVisible = true; diff --git a/WebCore/rendering/RenderMenuList.h b/WebCore/rendering/RenderMenuList.h index aef8d4f..512fa9b 100644 --- a/WebCore/rendering/RenderMenuList.h +++ b/WebCore/rendering/RenderMenuList.h @@ -24,6 +24,7 @@ #ifndef RenderMenuList_h #define RenderMenuList_h +#include "PopupMenu.h" #include "PopupMenuClient.h" #include "RenderFlexibleBox.h" @@ -35,7 +36,6 @@ namespace WebCore { -class PopupMenu; class RenderText; #if ENABLE(NO_LISTBOX_RENDERING) diff --git a/WebCore/rendering/RenderObject.h b/WebCore/rendering/RenderObject.h index 3f78e45..46169d0 100644 --- a/WebCore/rendering/RenderObject.h +++ b/WebCore/rendering/RenderObject.h @@ -38,7 +38,7 @@ #include "TransformationMatrix.h" #include <wtf/UnusedParam.h> -#if PLATFORM(CG) +#if PLATFORM(CG) || PLATFORM(CAIRO) #define HAVE_PATH_BASED_BORDER_RADIUS_DRAWING 1 #endif diff --git a/WebCore/rendering/RenderPath.cpp b/WebCore/rendering/RenderPath.cpp index dd79397..915be5d 100644 --- a/WebCore/rendering/RenderPath.cpp +++ b/WebCore/rendering/RenderPath.cpp @@ -35,11 +35,12 @@ #include "PointerEventsHitRules.h" #include "RenderSVGContainer.h" #include "RenderSVGResourceMarker.h" -#include "StrokeStyleApplier.h" #include "SVGRenderSupport.h" +#include "SVGResources.h" #include "SVGStyledTransformableElement.h" #include "SVGTransformList.h" #include "SVGURIReference.h" +#include "StrokeStyleApplier.h" #include <wtf/MathExtras.h> namespace WebCore { @@ -72,7 +73,7 @@ RenderPath::RenderPath(SVGStyledTransformableElement* node) { } -bool RenderPath::fillContains(const FloatPoint& point, bool requiresFill, WindRule fillRule) const +bool RenderPath::fillContains(const FloatPoint& point, bool requiresFill, WindRule fillRule) { if (!m_fillBoundingBox.contains(point)) return false; @@ -83,7 +84,7 @@ bool RenderPath::fillContains(const FloatPoint& point, bool requiresFill, WindRu return m_path.contains(point, fillRule); } -bool RenderPath::strokeContains(const FloatPoint& point, bool requiresStroke) const +bool RenderPath::strokeContains(const FloatPoint& point, bool requiresStroke) { if (!m_strokeAndMarkerBoundingBox.contains(point)) return false; @@ -111,9 +112,9 @@ void RenderPath::layout() m_needsTransformUpdate = false; } - // Invalidate all resources of this client, if we changed something. + // Invalidate all resources of this client if our layout changed. if (m_everHadLayout && selfNeedsLayout()) - RenderSVGResource::invalidateAllResourcesOfRenderer(this); + SVGResourcesCache::clientLayoutChanged(this); // At this point LayoutRepainter already grabbed the old bounds, // recalculate them now so repaintAfterLayout() uses the new bounds @@ -234,8 +235,6 @@ bool RenderPath::nodeAtFloatPoint(const HitTestRequest& request, HitTestResult& FloatRect RenderPath::calculateMarkerBoundsIfNeeded() { - Document* doc = document(); - SVGElement* svgElement = static_cast<SVGElement*>(node()); ASSERT(svgElement && svgElement->document()); if (!svgElement->isStyled()) @@ -248,39 +247,24 @@ FloatRect RenderPath::calculateMarkerBoundsIfNeeded() const SVGRenderStyle* svgStyle = style()->svgStyle(); ASSERT(svgStyle->hasMarkers()); - AtomicString startMarkerId(svgStyle->markerStartResource()); - AtomicString midMarkerId(svgStyle->markerMidResource()); - AtomicString endMarkerId(svgStyle->markerEndResource()); - - RenderSVGResourceMarker* startMarker = getRenderSVGResourceById<RenderSVGResourceMarker>(doc, startMarkerId); - RenderSVGResourceMarker* midMarker = getRenderSVGResourceById<RenderSVGResourceMarker>(doc, midMarkerId); - RenderSVGResourceMarker* endMarker = getRenderSVGResourceById<RenderSVGResourceMarker>(doc, endMarkerId); - - if (!startMarker && !startMarkerId.isEmpty()) - svgElement->document()->accessSVGExtensions()->addPendingResource(startMarkerId, styledElement); - else if (startMarker) - startMarker->addClient(this); - - if (!midMarker && !midMarkerId.isEmpty()) - svgElement->document()->accessSVGExtensions()->addPendingResource(midMarkerId, styledElement); - else if (midMarker) - midMarker->addClient(this); - - if (!endMarker && !endMarkerId.isEmpty()) - svgElement->document()->accessSVGExtensions()->addPendingResource(endMarkerId, styledElement); - else if (endMarker) - endMarker->addClient(this); + SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(this); + if (!resources) + return FloatRect(); - if (!startMarker && !midMarker && !endMarker) + RenderSVGResourceMarker* markerStart = resources->markerStart(); + RenderSVGResourceMarker* markerMid = resources->markerMid(); + RenderSVGResourceMarker* markerEnd = resources->markerEnd(); + if (!markerStart && !markerMid && !markerEnd) return FloatRect(); float strokeWidth = SVGRenderStyle::cssPrimitiveToLength(this, svgStyle->strokeWidth(), 1.0f); - return m_markerLayoutInfo.calculateBoundaries(startMarker, midMarker, endMarker, strokeWidth, m_path); + return m_markerLayoutInfo.calculateBoundaries(markerStart, markerMid, markerEnd, strokeWidth, m_path); } void RenderPath::styleWillChange(StyleDifference diff, const RenderStyle* newStyle) { - setNeedsBoundariesUpdate(); + if (diff == StyleDifferenceLayout) + setNeedsBoundariesUpdate(); RenderSVGModelObject::styleWillChange(diff, newStyle); } diff --git a/WebCore/rendering/RenderPath.h b/WebCore/rendering/RenderPath.h index 3748f39..57900ad 100644 --- a/WebCore/rendering/RenderPath.h +++ b/WebCore/rendering/RenderPath.h @@ -47,8 +47,8 @@ public: private: // Hit-detection seperated for the fill and the stroke - bool fillContains(const FloatPoint&, bool requiresFill = true, WindRule fillRule = RULE_NONZERO) const; - bool strokeContains(const FloatPoint&, bool requiresStroke = true) const; + bool fillContains(const FloatPoint&, bool requiresFill = true, WindRule fillRule = RULE_NONZERO); + bool strokeContains(const FloatPoint&, bool requiresStroke = true); virtual FloatRect objectBoundingBox() const { return m_fillBoundingBox; } virtual FloatRect strokeBoundingBox() const { return m_strokeAndMarkerBoundingBox; } diff --git a/WebCore/rendering/RenderSVGBlock.cpp b/WebCore/rendering/RenderSVGBlock.cpp index 2bae158..d6022b5 100644 --- a/WebCore/rendering/RenderSVGBlock.cpp +++ b/WebCore/rendering/RenderSVGBlock.cpp @@ -25,6 +25,7 @@ #if ENABLE(SVG) #include "RenderSVGBlock.h" +#include "RenderSVGResource.h" #include "SVGElement.h" namespace WebCore { @@ -73,6 +74,25 @@ void RenderSVGBlock::absoluteRects(Vector<IntRect>&, int, int) // This code path should never be taken for SVG, as we're assuming useTransforms=true everywhere, absoluteQuads should be used. ASSERT_NOT_REACHED(); } + +void RenderSVGBlock::destroy() +{ + SVGResourcesCache::clientDestroyed(this); + RenderBlock::destroy(); +} + +void RenderSVGBlock::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) +{ + RenderBlock::styleDidChange(diff, oldStyle); + SVGResourcesCache::clientStyleChanged(this, diff, style()); +} + +void RenderSVGBlock::updateFromElement() +{ + RenderBlock::updateFromElement(); + SVGResourcesCache::clientUpdatedFromElement(this, style()); +} + } #endif diff --git a/WebCore/rendering/RenderSVGBlock.h b/WebCore/rendering/RenderSVGBlock.h index 8dd140b..c4337cc 100644 --- a/WebCore/rendering/RenderSVGBlock.h +++ b/WebCore/rendering/RenderSVGBlock.h @@ -38,6 +38,10 @@ private: virtual void updateBoxModelInfoFromStyle(); virtual void absoluteRects(Vector<IntRect>&, int tx, int ty); + + virtual void destroy(); + virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); + virtual void updateFromElement(); }; } diff --git a/WebCore/rendering/RenderSVGContainer.cpp b/WebCore/rendering/RenderSVGContainer.cpp index ad63771..bab07a4 100644 --- a/WebCore/rendering/RenderSVGContainer.cpp +++ b/WebCore/rendering/RenderSVGContainer.cpp @@ -31,6 +31,7 @@ #include "RenderSVGResourceFilter.h" #include "RenderView.h" #include "SVGRenderSupport.h" +#include "SVGResources.h" #include "SVGStyledElement.h" namespace WebCore { @@ -58,23 +59,22 @@ void RenderSVGContainer::layout() SVGRenderSupport::layoutChildren(this, selfNeedsLayout()); - // Invalidate all resources of this client, if we changed something. + // Invalidate all resources of this client if our layout changed. if (m_everHadLayout && selfNeedsLayout()) - RenderSVGResource::invalidateAllResourcesOfRenderer(this); + SVGResourcesCache::clientLayoutChanged(this); repainter.repaintAfterLayout(); setNeedsLayout(false); } -bool RenderSVGContainer::selfWillPaint() const +bool RenderSVGContainer::selfWillPaint() { #if ENABLE(FILTERS) - const SVGRenderStyle* svgStyle = style()->svgStyle(); - RenderSVGResourceFilter* filter = getRenderSVGResourceById<RenderSVGResourceFilter>(document(), svgStyle->filterResource()); - if (filter) - return true; -#endif + SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(this); + return resources && resources->filter(); +#else return false; +#endif } void RenderSVGContainer::paint(PaintInfo& paintInfo, int, int) diff --git a/WebCore/rendering/RenderSVGContainer.h b/WebCore/rendering/RenderSVGContainer.h index 53f1a97..0a122cd 100644 --- a/WebCore/rendering/RenderSVGContainer.h +++ b/WebCore/rendering/RenderSVGContainer.h @@ -69,7 +69,7 @@ protected: virtual void applyViewportClip(PaintInfo&) { } virtual bool pointIsInsideViewportClip(const FloatPoint& /*pointInParent*/) { return true; } - bool selfWillPaint() const; + bool selfWillPaint(); private: RenderObjectChildList m_children; diff --git a/WebCore/rendering/RenderSVGGradientStop.cpp b/WebCore/rendering/RenderSVGGradientStop.cpp index 754f31f..3494aa7 100644 --- a/WebCore/rendering/RenderSVGGradientStop.cpp +++ b/WebCore/rendering/RenderSVGGradientStop.cpp @@ -25,8 +25,10 @@ #if ENABLE(SVG) #include "RenderSVGGradientStop.h" +#include "RenderSVGResourceContainer.h" #include "SVGGradientElement.h" #include "SVGNames.h" +#include "SVGResourcesCache.h" #include "SVGStopElement.h" namespace WebCore { @@ -48,8 +50,17 @@ void RenderSVGGradientStop::styleDidChange(StyleDifference diff, const RenderSty // <stop> elements should only be allowed to make renderers under gradient elements // but I can imagine a few cases we might not be catching, so let's not crash if our parent isn't a gradient. - if (SVGGradientElement* gradient = gradientElement()) - gradient->invalidateResourceClients(); + SVGGradientElement* gradient = gradientElement(); + if (!gradient) + return; + + RenderObject* renderer = gradient->renderer(); + if (!renderer) + return; + + ASSERT(renderer->isSVGResourceContainer()); + RenderSVGResourceContainer* container = renderer->toRenderSVGResourceContainer(); + container->invalidateClients(); } void RenderSVGGradientStop::layout() diff --git a/WebCore/rendering/RenderSVGHiddenContainer.h b/WebCore/rendering/RenderSVGHiddenContainer.h index 297a738..e0daac1 100644 --- a/WebCore/rendering/RenderSVGHiddenContainer.h +++ b/WebCore/rendering/RenderSVGHiddenContainer.h @@ -24,7 +24,6 @@ #define RenderSVGHiddenContainer_h #if ENABLE(SVG) - #include "RenderSVGContainer.h" namespace WebCore { @@ -39,11 +38,13 @@ namespace WebCore { virtual const char* renderName() const { return "RenderSVGHiddenContainer"; } + protected: + virtual void layout(); + private: virtual bool isSVGHiddenContainer() const { return true; } virtual bool requiresLayer() const { return false; } - virtual void layout(); virtual void paint(PaintInfo&, int parentX, int parentY); virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer); diff --git a/WebCore/rendering/RenderSVGImage.cpp b/WebCore/rendering/RenderSVGImage.cpp index 44b68b1..5a92e33 100644 --- a/WebCore/rendering/RenderSVGImage.cpp +++ b/WebCore/rendering/RenderSVGImage.cpp @@ -39,6 +39,7 @@ #include "SVGLength.h" #include "SVGPreserveAspectRatio.h" #include "SVGRenderSupport.h" +#include "SVGResources.h" namespace WebCore { @@ -70,9 +71,9 @@ void RenderSVGImage::layout() m_localBounds = FloatRect(image->x().value(image), image->y().value(image), image->width().value(image), image->height().value(image)); m_cachedLocalRepaintRect = FloatRect(); - // Invalidate all resources of this client, if we changed something. + // Invalidate all resources of this client if our layout changed. if (m_everHadLayout && selfNeedsLayout()) - RenderSVGResource::invalidateAllResourcesOfRenderer(this); + SVGResourcesCache::clientLayoutChanged(this); repainter.repaintAfterLayout(); setNeedsLayout(false); @@ -110,10 +111,22 @@ void RenderSVGImage::paint(PaintInfo& paintInfo, int, int) void RenderSVGImage::destroy() { - RenderSVGResource::invalidateAllResourcesOfRenderer(this); + SVGResourcesCache::clientDestroyed(this); RenderImage::destroy(); } +void RenderSVGImage::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) +{ + RenderImage::styleDidChange(diff, oldStyle); + SVGResourcesCache::clientStyleChanged(this, diff, style()); +} + +void RenderSVGImage::updateFromElement() +{ + RenderImage::updateFromElement(); + SVGResourcesCache::clientUpdatedFromElement(this, style()); +} + bool RenderSVGImage::nodeAtFloatPoint(const HitTestRequest& request, HitTestResult& result, const FloatPoint& pointInParent, HitTestAction hitTestAction) { // We only draw in the forground phase, so we only hit-test then. @@ -160,12 +173,12 @@ FloatRect RenderSVGImage::repaintRectInLocalCoordinates() const void RenderSVGImage::imageChanged(WrappedImagePtr image, const IntRect* rect) { RenderImage::imageChanged(image, rect); -#if ENABLE(FILTERS) + // The image resource defaults to nullImage until the resource arrives. - // This empty image may be cached by SVG filter effects which must be invalidated. - if (RenderSVGResourceFilter* filter = getRenderSVGResourceById<RenderSVGResourceFilter>(document(), style()->svgStyle()->filterResource())) - filter->invalidateClient(this); -#endif + // This empty image may be cached by SVG resources which must be invalidated. + if (SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(this)) + resources->invalidateClient(this); + repaint(); } diff --git a/WebCore/rendering/RenderSVGImage.h b/WebCore/rendering/RenderSVGImage.h index 3baac23..6ee0179 100644 --- a/WebCore/rendering/RenderSVGImage.h +++ b/WebCore/rendering/RenderSVGImage.h @@ -65,6 +65,8 @@ private: virtual void paint(PaintInfo&, int parentX, int parentY); virtual void destroy(); + virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); + virtual void updateFromElement(); virtual bool requiresLayer() const { return false; } diff --git a/WebCore/rendering/RenderSVGInline.cpp b/WebCore/rendering/RenderSVGInline.cpp index ffc6b62..93e6a06 100644 --- a/WebCore/rendering/RenderSVGInline.cpp +++ b/WebCore/rendering/RenderSVGInline.cpp @@ -26,6 +26,7 @@ #if ENABLE(SVG) #include "RenderSVGInline.h" +#include "RenderSVGResource.h" #include "SVGInlineFlowBox.h" namespace WebCore { @@ -92,6 +93,24 @@ void RenderSVGInline::absoluteQuads(Vector<FloatQuad>& quads) quads.append(localToAbsoluteQuad(FloatRect(textBoundingBox.x() + box->x(), textBoundingBox.y() + box->y(), box->width(), box->height()))); } +void RenderSVGInline::destroy() +{ + SVGResourcesCache::clientDestroyed(this); + RenderInline::destroy(); +} + +void RenderSVGInline::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) +{ + RenderInline::styleDidChange(diff, oldStyle); + SVGResourcesCache::clientStyleChanged(this, diff, style()); +} + +void RenderSVGInline::updateFromElement() +{ + RenderInline::updateFromElement(); + SVGResourcesCache::clientUpdatedFromElement(this, style()); +} + } diff --git a/WebCore/rendering/RenderSVGInline.h b/WebCore/rendering/RenderSVGInline.h index 6f44162..56d911f 100644 --- a/WebCore/rendering/RenderSVGInline.h +++ b/WebCore/rendering/RenderSVGInline.h @@ -54,6 +54,10 @@ public: private: virtual InlineFlowBox* createInlineFlowBox(); + + virtual void destroy(); + virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); + virtual void updateFromElement(); }; } diff --git a/WebCore/rendering/RenderSVGModelObject.cpp b/WebCore/rendering/RenderSVGModelObject.cpp index 49404cb..5a19749 100644 --- a/WebCore/rendering/RenderSVGModelObject.cpp +++ b/WebCore/rendering/RenderSVGModelObject.cpp @@ -83,16 +83,20 @@ void RenderSVGModelObject::absoluteQuads(Vector<FloatQuad>& quads) void RenderSVGModelObject::destroy() { - RenderSVGResource::invalidateAllResourcesOfRenderer(this); + SVGResourcesCache::clientDestroyed(this); RenderObject::destroy(); } void RenderSVGModelObject::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) { RenderObject::styleDidChange(diff, oldStyle); + SVGResourcesCache::clientStyleChanged(this, diff, style()); +} - if (style() && (diff == StyleDifferenceLayout || diff == StyleDifferenceRepaint)) - RenderSVGResource::markForLayoutAndParentResourceInvalidation(this, false); +void RenderSVGModelObject::updateFromElement() +{ + RenderObject::updateFromElement(); + SVGResourcesCache::clientUpdatedFromElement(this, style()); } bool RenderSVGModelObject::nodeAtPoint(const HitTestRequest&, HitTestResult&, int, int, int, int, HitTestAction) diff --git a/WebCore/rendering/RenderSVGModelObject.h b/WebCore/rendering/RenderSVGModelObject.h index 741cd61..35c4dc3 100644 --- a/WebCore/rendering/RenderSVGModelObject.h +++ b/WebCore/rendering/RenderSVGModelObject.h @@ -62,6 +62,7 @@ public: virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&) const; virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); + virtual void updateFromElement(); private: // This method should never be called, SVG uses a different nodeAtPoint method diff --git a/WebCore/rendering/RenderSVGResource.cpp b/WebCore/rendering/RenderSVGResource.cpp index b4f499e..9c89d3c 100644 --- a/WebCore/rendering/RenderSVGResource.cpp +++ b/WebCore/rendering/RenderSVGResource.cpp @@ -26,28 +26,13 @@ #if ENABLE(SVG) #include "RenderSVGResource.h" -#include "RenderSVGResourceClipper.h" #include "RenderSVGResourceContainer.h" -#include "RenderSVGResourceFilter.h" -#include "RenderSVGResourceMarker.h" -#include "RenderSVGResourceMasker.h" #include "RenderSVGResourceSolidColor.h" +#include "SVGResources.h" #include "SVGURIReference.h" namespace WebCore { -static inline void registerPendingResource(const AtomicString& id, const SVGPaint::SVGPaintType& paintType, const RenderObject* object) -{ - if (paintType != SVGPaint::SVG_PAINTTYPE_URI) - return; - - SVGElement* svgElement = static_cast<SVGElement*>(object->node()); - ASSERT(svgElement); - ASSERT(svgElement->isStyled()); - - object->document()->accessSVGExtensions()->addPendingResource(id, static_cast<SVGStyledElement*>(svgElement)); -} - inline void RenderSVGResource::adjustColorForPseudoRules(const RenderStyle* style, bool useFillPaint, Color& color) { if (style->insideLink() != InsideVisitedLink) @@ -69,7 +54,7 @@ inline void RenderSVGResource::adjustColorForPseudoRules(const RenderStyle* styl } // FIXME: This method and strokePaintingResource() should be refactored, to share even more code -RenderSVGResource* RenderSVGResource::fillPaintingResource(const RenderObject* object, const RenderStyle* style) +RenderSVGResource* RenderSVGResource::fillPaintingResource(RenderObject* object, const RenderStyle* style) { ASSERT(object); ASSERT(style); @@ -84,13 +69,9 @@ RenderSVGResource* RenderSVGResource::fillPaintingResource(const RenderObject* o RenderSVGResource* fillPaintingResource = 0; SVGPaint::SVGPaintType paintType = fillPaint->paintType(); - if (paintType == SVGPaint::SVG_PAINTTYPE_URI - || paintType == SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR) { - AtomicString id(SVGURIReference::getTarget(fillPaint->uri())); - fillPaintingResource = getRenderSVGResourceContainerById(object->document(), id); - - if (!fillPaintingResource) - registerPendingResource(id, paintType, object); + if (paintType == SVGPaint::SVG_PAINTTYPE_URI || paintType == SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR) { + if (SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(object)) + fillPaintingResource = resources->fill(); } if (paintType != SVGPaint::SVG_PAINTTYPE_URI && !fillPaintingResource) { @@ -122,7 +103,7 @@ RenderSVGResource* RenderSVGResource::fillPaintingResource(const RenderObject* o return fillPaintingResource; } -RenderSVGResource* RenderSVGResource::strokePaintingResource(const RenderObject* object, const RenderStyle* style) +RenderSVGResource* RenderSVGResource::strokePaintingResource(RenderObject* object, const RenderStyle* style) { ASSERT(object); ASSERT(style); @@ -138,13 +119,9 @@ RenderSVGResource* RenderSVGResource::strokePaintingResource(const RenderObject* FloatRect objectBoundingBox = object->objectBoundingBox(); SVGPaint::SVGPaintType paintType = strokePaint->paintType(); - if (!objectBoundingBox.isEmpty() - && (paintType == SVGPaint::SVG_PAINTTYPE_URI || paintType == SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR)) { - AtomicString id(SVGURIReference::getTarget(strokePaint->uri())); - strokePaintingResource = getRenderSVGResourceContainerById(object->document(), id); - - if (!strokePaintingResource) - registerPendingResource(id, paintType, object); + if (!objectBoundingBox.isEmpty() && (paintType == SVGPaint::SVG_PAINTTYPE_URI || paintType == SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR)) { + if (SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(object)) + strokePaintingResource = resources->stroke(); } if (paintType != SVGPaint::SVG_PAINTTYPE_URI && !strokePaintingResource) { @@ -184,72 +161,6 @@ RenderSVGResourceSolidColor* RenderSVGResource::sharedSolidPaintingResource() return s_sharedSolidPaintingResource; } -void RenderSVGResource::markForLayoutAndResourceInvalidation(RenderObject* object, bool needsBoundariesUpdate) -{ - ASSERT(object); - ASSERT(object->node()); - ASSERT(object->node()->isSVGElement()); - - // Eventually mark the renderer needing a boundaries update - if (needsBoundariesUpdate) - object->setNeedsBoundariesUpdate(); - - markForLayoutAndParentResourceInvalidation(object); -} - -static inline void invalidatePaintingResource(SVGPaint* paint, RenderObject* object) -{ - ASSERT(paint); - - SVGPaint::SVGPaintType paintType = paint->paintType(); - if (paintType != SVGPaint::SVG_PAINTTYPE_URI && paintType != SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR) - return; - - AtomicString id(SVGURIReference::getTarget(paint->uri())); - if (RenderSVGResourceContainer* paintingResource = getRenderSVGResourceContainerById(object->document(), id)) - paintingResource->invalidateClient(object); -} - -void RenderSVGResource::invalidateAllResourcesOfRenderer(RenderObject* object) -{ - ASSERT(object); - ASSERT(object->style()); - - Document* document = object->document(); - ASSERT(document); - - const SVGRenderStyle* svgStyle = object->style()->svgStyle(); - ASSERT(svgStyle); - - // Masker - if (RenderSVGResourceMasker* masker = getRenderSVGResourceById<RenderSVGResourceMasker>(document, svgStyle->maskerResource())) - masker->invalidateClient(object); - - // Clipper - if (RenderSVGResourceClipper* clipper = getRenderSVGResourceById<RenderSVGResourceClipper>(document, svgStyle->clipperResource())) - clipper->invalidateClient(object); - - // Filter -#if ENABLE(FILTERS) - if (RenderSVGResourceFilter* filter = getRenderSVGResourceById<RenderSVGResourceFilter>(document, svgStyle->filterResource())) - filter->invalidateClient(object); -#endif - - // Markers - if (RenderSVGResourceMarker* startMarker = getRenderSVGResourceById<RenderSVGResourceMarker>(document, svgStyle->markerStartResource())) - startMarker->invalidateClient(object); - if (RenderSVGResourceMarker* midMarker = getRenderSVGResourceById<RenderSVGResourceMarker>(document, svgStyle->markerMidResource())) - midMarker->invalidateClient(object); - if (RenderSVGResourceMarker* endMarker = getRenderSVGResourceById<RenderSVGResourceMarker>(document, svgStyle->markerEndResource())) - endMarker->invalidateClient(object); - - // Gradients/Patterns - if (svgStyle->hasFill()) - invalidatePaintingResource(svgStyle->fillPaint(), object); - if (svgStyle->hasStroke()) - invalidatePaintingResource(svgStyle->strokePaint(), object); -} - void RenderSVGResource::markForLayoutAndParentResourceInvalidation(RenderObject* object, bool needsLayout) { ASSERT(object); @@ -259,8 +170,10 @@ void RenderSVGResource::markForLayoutAndParentResourceInvalidation(RenderObject* // Invalidate resources in ancestor chain, if needed. RenderObject* current = object->parent(); while (current) { - if (current->isSVGResourceContainer()) + if (current->isSVGResourceContainer()) { current->toRenderSVGResourceContainer()->invalidateClients(); + break; + } current = current->parent(); } diff --git a/WebCore/rendering/RenderSVGResource.h b/WebCore/rendering/RenderSVGResource.h index b3ea6fb..e2d8216 100644 --- a/WebCore/rendering/RenderSVGResource.h +++ b/WebCore/rendering/RenderSVGResource.h @@ -22,6 +22,7 @@ #define RenderSVGResource_h #if ENABLE(SVG) +#include "RenderStyleConstants.h" #include "SVGDocumentExtensions.h" namespace WebCore { @@ -75,18 +76,14 @@ public: } // Helper utilities used in the render tree to access resources used for painting shapes/text (gradients & patterns only) - static RenderSVGResource* fillPaintingResource(const RenderObject*, const RenderStyle*); - static RenderSVGResource* strokePaintingResource(const RenderObject*, const RenderStyle*); + static RenderSVGResource* fillPaintingResource(RenderObject*, const RenderStyle*); + static RenderSVGResource* strokePaintingResource(RenderObject*, const RenderStyle*); static RenderSVGResourceSolidColor* sharedSolidPaintingResource(); - static void invalidateAllResourcesOfRenderer(RenderObject*); static void markForLayoutAndParentResourceInvalidation(RenderObject*, bool needsLayout = true); private: static void adjustColorForPseudoRules(const RenderStyle*, bool useFillPaint, Color&); - -protected: - void markForLayoutAndResourceInvalidation(RenderObject*, bool needsBoundariesUpdate = true); }; } diff --git a/WebCore/rendering/RenderSVGResourceClipper.cpp b/WebCore/rendering/RenderSVGResourceClipper.cpp index e923f7e..a201d1f 100644 --- a/WebCore/rendering/RenderSVGResourceClipper.cpp +++ b/WebCore/rendering/RenderSVGResourceClipper.cpp @@ -21,6 +21,7 @@ */ #include "config.h" + #if ENABLE(SVG) #include "RenderSVGResourceClipper.h" @@ -32,11 +33,12 @@ #include "ImageBuffer.h" #include "IntRect.h" #include "RenderObject.h" -#include "RenderStyle.h" #include "RenderSVGResource.h" +#include "RenderStyle.h" #include "SVGClipPathElement.h" #include "SVGElement.h" #include "SVGRenderSupport.h" +#include "SVGResources.h" #include "SVGStyledElement.h" #include "SVGStyledTransformableElement.h" #include "SVGUnitTypes.h" @@ -55,6 +57,9 @@ RenderSVGResourceClipper::RenderSVGResourceClipper(SVGClipPathElement* node) RenderSVGResourceClipper::~RenderSVGResourceClipper() { + if (m_clipper.isEmpty()) + return; + deleteAllValues(m_clipper); m_clipper.clear(); } @@ -64,26 +69,26 @@ void RenderSVGResourceClipper::invalidateClients() if (m_invalidationBlocked) return; - HashMap<RenderObject*, ClipperData*>::const_iterator end = m_clipper.end(); - for (HashMap<RenderObject*, ClipperData*>::const_iterator it = m_clipper.begin(); it != end; ++it) - markForLayoutAndResourceInvalidation(it->first); - - deleteAllValues(m_clipper); - m_clipper.clear(); m_clipBoundaries = FloatRect(); + if (!m_clipper.isEmpty()) { + deleteAllValues(m_clipper); + m_clipper.clear(); + } + + markAllClientsForInvalidation(LayoutAndBoundariesInvalidation); } -void RenderSVGResourceClipper::invalidateClient(RenderObject* object) +void RenderSVGResourceClipper::invalidateClient(RenderObject* client) { + ASSERT(client); if (m_invalidationBlocked) return; - ASSERT(object); - if (!m_clipper.contains(object)) - return; + ASSERT(client->selfNeedsLayout()); + if (m_clipper.contains(client)) + delete m_clipper.take(client); - delete m_clipper.take(object); - markForLayoutAndResourceInvalidation(object); + markClientForInvalidation(client, BoundariesInvalidation); } bool RenderSVGResourceClipper::applyResource(RenderObject* object, RenderStyle*, GraphicsContext*& context, unsigned short resourceMode) @@ -96,10 +101,6 @@ bool RenderSVGResourceClipper::applyResource(RenderObject* object, RenderStyle*, UNUSED_PARAM(resourceMode); #endif - // Early exit, if this resource contains a child which references ourselves. - if (containsCyclicReference(node())) - return false; - applyClippingToContext(object, object->objectBoundingBox(), object->repaintRectInLocalCoordinates(), context); return true; } @@ -191,11 +192,13 @@ bool RenderSVGResourceClipper::createClipData(ClipperData* clipperData, const Fl maskContext->translate(-repaintRect.x(), -repaintRect.y()); // clipPath can also be clipped by another clipPath. - if (RenderSVGResourceClipper* clipper = getRenderSVGResourceById<RenderSVGResourceClipper>(this->document(), style()->svgStyle()->clipperResource())) { - if (!clipper->applyClippingToContext(this, objectBoundingBox, repaintRect, maskContext)) { - maskContext->restore(); - return false; - } + if (SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(this)) { + if (RenderSVGResourceClipper* clipper = resources->clipper()) { + if (!clipper->applyClippingToContext(this, objectBoundingBox, repaintRect, maskContext)) { + maskContext->restore(); + return false; + } + } } SVGClipPathElement* clipPath = static_cast<SVGClipPathElement*>(node()); @@ -280,12 +283,6 @@ void RenderSVGResourceClipper::calculateClipContentRepaintRect() bool RenderSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundingBox, const FloatPoint& nodeAtPoint) { - // FIXME: We should be able to check whether m_clipper.contains(object) - this doesn't work at the moment - // as resourceBoundingBox() has already created ClipperData, even if applyResource() returned false. - // Early exit, if this resource contains a child which references ourselves. - if (containsCyclicReference(node())) - return false; - FloatPoint point = nodeAtPoint; if (!SVGRenderSupport::pointInClippingArea(this, point)) return false; @@ -312,14 +309,6 @@ bool RenderSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundin return false; } -bool RenderSVGResourceClipper::childElementReferencesResource(const SVGRenderStyle* style, const String& referenceId) const -{ - if (!style->hasClipper()) - return false; - - return style->clipperResource() == referenceId; -} - FloatRect RenderSVGResourceClipper::resourceBoundingBox(RenderObject* object) { // Resource was not layouted yet. Give back the boundingBox of the object. diff --git a/WebCore/rendering/RenderSVGResourceClipper.h b/WebCore/rendering/RenderSVGResourceClipper.h index 7128aa1..3c76bc8 100644 --- a/WebCore/rendering/RenderSVGResourceClipper.h +++ b/WebCore/rendering/RenderSVGResourceClipper.h @@ -68,8 +68,6 @@ private: bool createClipData(ClipperData*, const FloatRect&, const FloatRect&); void calculateClipContentRepaintRect(); - virtual bool childElementReferencesResource(const SVGRenderStyle*, const String&) const; - bool m_invalidationBlocked; FloatRect m_clipBoundaries; HashMap<RenderObject*, ClipperData*> m_clipper; diff --git a/WebCore/rendering/RenderSVGResourceContainer.cpp b/WebCore/rendering/RenderSVGResourceContainer.cpp index 3707797..7e43300 100644 --- a/WebCore/rendering/RenderSVGResourceContainer.cpp +++ b/WebCore/rendering/RenderSVGResourceContainer.cpp @@ -28,102 +28,147 @@ namespace WebCore { +static inline SVGDocumentExtensions* svgExtensionsFromNode(Node* node) +{ + ASSERT(node); + ASSERT(node->document()); + return node->document()->accessSVGExtensions(); +} + RenderSVGResourceContainer::RenderSVGResourceContainer(SVGStyledElement* node) : RenderSVGHiddenContainer(node) - , RenderSVGResource() , m_id(node->hasID() ? node->getIdAttribute() : nullAtom) + , m_registered(false) { - ASSERT(node->document()); - node->document()->accessSVGExtensions()->addResource(m_id, this); } RenderSVGResourceContainer::~RenderSVGResourceContainer() { - ASSERT(node()); - ASSERT(node()->document()); - node()->document()->accessSVGExtensions()->removeResource(m_id); + if (m_registered) + svgExtensionsFromNode(node())->removeResource(m_id); } -void RenderSVGResourceContainer::idChanged() +void RenderSVGResourceContainer::layout() { - ASSERT(node()); - ASSERT(node()->document()); - SVGDocumentExtensions* extensions = node()->document()->accessSVGExtensions(); + // Invalidate all resources if our layout changed. + if (m_everHadLayout && selfNeedsLayout()) + invalidateClients(); - // Remove old id, that is guaranteed to be present in cache - extensions->removeResource(m_id); - m_id = static_cast<Element*>(node())->getIdAttribute(); + RenderSVGHiddenContainer::layout(); +} - // It's possible that an element is referencing us with the new id, and has to be notified that we're existing now - if (extensions->isPendingResource(m_id)) { - OwnPtr<HashSet<SVGStyledElement*> > clients(extensions->removePendingResource(m_id)); - if (clients->isEmpty()) - return; +void RenderSVGResourceContainer::destroy() +{ + SVGResourcesCache::resourceDestroyed(this); + RenderSVGHiddenContainer::destroy(); +} - HashSet<SVGStyledElement*>::const_iterator it = clients->begin(); - const HashSet<SVGStyledElement*>::const_iterator end = clients->end(); +void RenderSVGResourceContainer::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) +{ + RenderSVGHiddenContainer::styleDidChange(diff, oldStyle); - for (; it != end; ++it) { - if (RenderObject* renderer = (*it)->renderer()) - renderer->setNeedsLayout(true); - } + if (!m_registered) { + m_registered = true; + registerResource(); } - - // Recache us with the new id - extensions->addResource(m_id, this); } -AffineTransform RenderSVGResourceContainer::transformOnNonScalingStroke(RenderObject* object, const AffineTransform& resourceTransform) +void RenderSVGResourceContainer::idChanged() { - if (!object->isRenderPath()) - return resourceTransform; + // Invalidate all our current clients. + invalidateClients(); - SVGStyledTransformableElement* element = static_cast<SVGStyledTransformableElement*>(object->node()); - AffineTransform transform = resourceTransform; - transform.multiply(element->getScreenCTM()); - return transform; + // Remove old id, that is guaranteed to be present in cache. + SVGDocumentExtensions* extensions = svgExtensionsFromNode(node()); + extensions->removeResource(m_id); + m_id = static_cast<Element*>(node())->getIdAttribute(); + + registerResource(); } -bool RenderSVGResourceContainer::containsCyclicReference(const Node* startNode) const +void RenderSVGResourceContainer::markAllClientsForInvalidation(InvalidationMode mode) { - ASSERT(startNode->document()); + if (m_clients.isEmpty()) + return; - for (Node* node = startNode->firstChild(); node; node = node->nextSibling()) { - if (!node->isSVGElement()) - continue; + bool needsLayout = mode == LayoutAndBoundariesInvalidation; - RenderObject* renderer = node->renderer(); - if (!renderer) + HashSet<RenderObject*>::iterator end = m_clients.end(); + for (HashSet<RenderObject*>::iterator it = m_clients.begin(); it != end; ++it) { + RenderObject* client = *it; + if (client->isSVGResourceContainer()) { + client->toRenderSVGResourceContainer()->invalidateClients(); continue; + } - RenderStyle* style = renderer->style(); - if (!style) - continue; + markClientForInvalidation(client, mode); + RenderSVGResource::markForLayoutAndParentResourceInvalidation(client, needsLayout); + } +} - const SVGRenderStyle* svgStyle = style->svgStyle(); - ASSERT(svgStyle); +void RenderSVGResourceContainer::markClientForInvalidation(RenderObject* client, InvalidationMode mode) +{ + ASSERT(client); + ASSERT(!m_clients.isEmpty()); + + switch (mode) { + case LayoutAndBoundariesInvalidation: + case BoundariesInvalidation: + client->setNeedsBoundariesUpdate(); + break; + case RepaintInvalidation: + if (client->view()) + client->repaint(); + break; + } +} - // Let the class inheriting from us decide whether the child element references ourselves. - if (childElementReferencesResource(svgStyle, m_id)) - return true; +void RenderSVGResourceContainer::addClient(RenderObject* client) +{ + ASSERT(client); + m_clients.add(client); +} - // Dive into shadow tree to check for cycles there. - if (node->hasTagName(SVGNames::useTag)) { - ASSERT(renderer->isSVGShadowTreeRootContainer()); - if (Node* shadowRoot = static_cast<RenderSVGShadowTreeRootContainer*>(renderer)->rootElement()) { - if (containsCyclicReference(shadowRoot)) - return true; - } +void RenderSVGResourceContainer::removeClient(RenderObject* client) +{ + ASSERT(client); + m_clients.remove(client); +} - } +void RenderSVGResourceContainer::registerResource() +{ + SVGDocumentExtensions* extensions = svgExtensionsFromNode(node()); + if (!extensions->isPendingResource(m_id)) { + extensions->addResource(m_id, this); + return; + } - if (node->hasChildNodes()) { - if (containsCyclicReference(node)) - return true; - } + OwnPtr<HashSet<SVGStyledElement*> > clients(extensions->removePendingResource(m_id)); + + // Cache us with the new id. + extensions->addResource(m_id, this); + + // Update cached resources of pending clients. + const HashSet<SVGStyledElement*>::const_iterator end = clients->end(); + for (HashSet<SVGStyledElement*>::const_iterator it = clients->begin(); it != end; ++it) { + RenderObject* renderer = (*it)->renderer(); + if (!renderer) + continue; + SVGResourcesCache::clientUpdatedFromElement(renderer, renderer->style()); + renderer->setNeedsLayout(true); } +} + +// FIXME: This does not belong here. +AffineTransform RenderSVGResourceContainer::transformOnNonScalingStroke(RenderObject* object, const AffineTransform& resourceTransform) +{ + if (!object->isRenderPath()) + return resourceTransform; - return false; + SVGStyledTransformableElement* element = static_cast<SVGStyledTransformableElement*>(object->node()); + AffineTransform transform = resourceTransform; + transform.multiply(element->getScreenCTM()); + return transform; } } diff --git a/WebCore/rendering/RenderSVGResourceContainer.h b/WebCore/rendering/RenderSVGResourceContainer.h index d57b1db..4271a5f 100644 --- a/WebCore/rendering/RenderSVGResourceContainer.h +++ b/WebCore/rendering/RenderSVGResourceContainer.h @@ -23,10 +23,7 @@ #if ENABLE(SVG) #include "RenderSVGHiddenContainer.h" - -#include "SVGStyledTransformableElement.h" #include "RenderSVGResource.h" -#include "RenderSVGShadowTreeRootContainer.h" namespace WebCore { @@ -36,27 +33,40 @@ public: RenderSVGResourceContainer(SVGStyledElement*); virtual ~RenderSVGResourceContainer(); - void idChanged(); + virtual void layout(); + virtual void destroy(); + virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); virtual bool isSVGResourceContainer() const { return true; } virtual bool drawsContents() { return false; } - virtual RenderSVGResourceContainer* toRenderSVGResourceContainer() { return this; } - virtual bool childElementReferencesResource(const SVGRenderStyle*, const String&) const { return false; } static AffineTransform transformOnNonScalingStroke(RenderObject*, const AffineTransform& resourceTransform); - bool containsCyclicReference(const Node* startNode) const; + void idChanged(); + +protected: + enum InvalidationMode { + LayoutAndBoundariesInvalidation, + BoundariesInvalidation, + RepaintInvalidation + }; + + // Used from the invalidateClient/invalidateClients methods from classes, inheriting from us. + void markAllClientsForInvalidation(InvalidationMode); + void markClientForInvalidation(RenderObject*, InvalidationMode); private: friend class SVGResourcesCache; - - // FIXME: No-ops for now, until follow-up patch on bug 43031 lands. - void addClient(RenderObject*) { } - void removeClient(RenderObject*) { } + void addClient(RenderObject*); + void removeClient(RenderObject*); private: + void registerResource(); + AtomicString m_id; + bool m_registered; + HashSet<RenderObject*> m_clients; }; inline RenderSVGResourceContainer* getRenderSVGResourceContainerById(Document* document, const AtomicString& id) diff --git a/WebCore/rendering/RenderSVGResourceFilter.cpp b/WebCore/rendering/RenderSVGResourceFilter.cpp index a6358f0..bc5feaf 100644 --- a/WebCore/rendering/RenderSVGResourceFilter.cpp +++ b/WebCore/rendering/RenderSVGResourceFilter.cpp @@ -60,28 +60,32 @@ RenderSVGResourceFilter::RenderSVGResourceFilter(SVGFilterElement* node) RenderSVGResourceFilter::~RenderSVGResourceFilter() { + if (m_filter.isEmpty()) + return; + deleteAllValues(m_filter); m_filter.clear(); } void RenderSVGResourceFilter::invalidateClients() { - HashMap<RenderObject*, FilterData*>::const_iterator end = m_filter.end(); - for (HashMap<RenderObject*, FilterData*>::const_iterator it = m_filter.begin(); it != end; ++it) - markForLayoutAndResourceInvalidation(it->first); + if (!m_filter.isEmpty()) { + deleteAllValues(m_filter); + m_filter.clear(); + } - deleteAllValues(m_filter); - m_filter.clear(); + markAllClientsForInvalidation(LayoutAndBoundariesInvalidation); } -void RenderSVGResourceFilter::invalidateClient(RenderObject* object) +void RenderSVGResourceFilter::invalidateClient(RenderObject* client) { - ASSERT(object); - if (!m_filter.contains(object)) - return; + ASSERT(client); + ASSERT(client->selfNeedsLayout()); + + if (m_filter.contains(client)) + delete m_filter.take(client); - delete m_filter.take(object); - markForLayoutAndResourceInvalidation(object); + markClientForInvalidation(client, BoundariesInvalidation); } PassRefPtr<SVGFilterBuilder> RenderSVGResourceFilter::buildPrimitives() diff --git a/WebCore/rendering/RenderSVGResourceGradient.cpp b/WebCore/rendering/RenderSVGResourceGradient.cpp index ce51369..73b2ab6 100644 --- a/WebCore/rendering/RenderSVGResourceGradient.cpp +++ b/WebCore/rendering/RenderSVGResourceGradient.cpp @@ -43,28 +43,32 @@ RenderSVGResourceGradient::RenderSVGResourceGradient(SVGGradientElement* node) RenderSVGResourceGradient::~RenderSVGResourceGradient() { + if (m_gradient.isEmpty()) + return; + deleteAllValues(m_gradient); m_gradient.clear(); } void RenderSVGResourceGradient::invalidateClients() { - const HashMap<RenderObject*, GradientData*>::const_iterator end = m_gradient.end(); - for (HashMap<RenderObject*, GradientData*>::const_iterator it = m_gradient.begin(); it != end; ++it) - markForLayoutAndResourceInvalidation(it->first, false); + if (!m_gradient.isEmpty()) { + deleteAllValues(m_gradient); + m_gradient.clear(); + } - deleteAllValues(m_gradient); - m_gradient.clear(); + markAllClientsForInvalidation(RepaintInvalidation); } -void RenderSVGResourceGradient::invalidateClient(RenderObject* object) +void RenderSVGResourceGradient::invalidateClient(RenderObject* client) { - ASSERT(object); - if (!m_gradient.contains(object)) - return; + ASSERT(client); + ASSERT(client->selfNeedsLayout()); + + if (m_gradient.contains(client)) + delete m_gradient.take(client); - delete m_gradient.take(object); - markForLayoutAndResourceInvalidation(object, false); + markClientForInvalidation(client, RepaintInvalidation); } #if PLATFORM(CG) diff --git a/WebCore/rendering/RenderSVGResourceMarker.cpp b/WebCore/rendering/RenderSVGResourceMarker.cpp index 4f0cace..fa00fa3 100644 --- a/WebCore/rendering/RenderSVGResourceMarker.cpp +++ b/WebCore/rendering/RenderSVGResourceMarker.cpp @@ -21,6 +21,7 @@ */ #include "config.h" + #if ENABLE(SVG) #include "RenderSVGResourceMarker.h" @@ -43,39 +44,30 @@ RenderSVGResourceMarker::RenderSVGResourceMarker(SVGMarkerElement* node) RenderSVGResourceMarker::~RenderSVGResourceMarker() { - m_marker.clear(); } void RenderSVGResourceMarker::layout() { + // Invalidate all resources if our layout changed. + if (m_everHadLayout && selfNeedsLayout()) + invalidateClients(); + // RenderSVGHiddenContainer overwrites layout(). We need the // layouting of RenderSVGContainer for calculating local // transformations and repaint. RenderSVGContainer::layout(); } -void RenderSVGResourceMarker::addClient(const RenderObject* object) -{ - m_marker.add(object); -} - void RenderSVGResourceMarker::invalidateClients() { - const HashSet<const RenderObject*>::const_iterator end = m_marker.end(); - for (HashSet<const RenderObject*>::const_iterator it = m_marker.begin(); it != end; ++it) - markForLayoutAndResourceInvalidation(const_cast<RenderObject*>(*it)); - - m_marker.clear(); + markAllClientsForInvalidation(LayoutAndBoundariesInvalidation); } -void RenderSVGResourceMarker::invalidateClient(RenderObject* object) +void RenderSVGResourceMarker::invalidateClient(RenderObject* client) { - ASSERT(object); - if (!m_marker.contains(object)) - return; - - m_marker.remove(object); - markForLayoutAndResourceInvalidation(object); + ASSERT(client); + ASSERT(client->selfNeedsLayout()); + markClientForInvalidation(client, BoundariesInvalidation); } void RenderSVGResourceMarker::applyViewportClip(PaintInfo& paintInfo) @@ -140,20 +132,11 @@ AffineTransform RenderSVGResourceMarker::markerTransformation(const FloatPoint& void RenderSVGResourceMarker::draw(PaintInfo& paintInfo, const AffineTransform& transform) { - DEFINE_STATIC_LOCAL(HashSet<RenderSVGResourceMarker*>, currentlyDrawingMarkers, ()); - - // avoid drawing circular marker references - if (currentlyDrawingMarkers.contains(this)) - return; - - currentlyDrawingMarkers.add(this); PaintInfo info(paintInfo); info.context->save(); info.applyTransform(transform); RenderSVGContainer::paint(info, 0, 0); info.context->restore(); - - currentlyDrawingMarkers.remove(this); } AffineTransform RenderSVGResourceMarker::markerContentTransformation(const AffineTransform& contentTransformation, const FloatPoint& origin, float strokeWidth) const diff --git a/WebCore/rendering/RenderSVGResourceMarker.h b/WebCore/rendering/RenderSVGResourceMarker.h index 75c442e..8509aca 100644 --- a/WebCore/rendering/RenderSVGResourceMarker.h +++ b/WebCore/rendering/RenderSVGResourceMarker.h @@ -41,7 +41,6 @@ public: virtual const char* renderName() const { return "RenderSVGResourceMarker"; } - void addClient(const RenderObject*); virtual void invalidateClients(); virtual void invalidateClient(RenderObject*); @@ -74,9 +73,6 @@ private: AffineTransform viewportTransform() const; - // Save objects using this marker for invalidation. - HashSet<const RenderObject*> m_marker; - mutable AffineTransform m_localToParentTransform; FloatRect m_viewport; }; diff --git a/WebCore/rendering/RenderSVGResourceMasker.cpp b/WebCore/rendering/RenderSVGResourceMasker.cpp index 83a64b5..2c36c96 100644 --- a/WebCore/rendering/RenderSVGResourceMasker.cpp +++ b/WebCore/rendering/RenderSVGResourceMasker.cpp @@ -19,6 +19,7 @@ */ #include "config.h" + #if ENABLE(SVG) #include "RenderSVGResourceMasker.h" @@ -51,37 +52,33 @@ RenderSVGResourceMasker::RenderSVGResourceMasker(SVGMaskElement* node) RenderSVGResourceMasker::~RenderSVGResourceMasker() { + if (m_masker.isEmpty()) + return; + deleteAllValues(m_masker); m_masker.clear(); } void RenderSVGResourceMasker::invalidateClients() { - HashMap<RenderObject*, MaskerData*>::const_iterator end = m_masker.end(); - for (HashMap<RenderObject*, MaskerData*>::const_iterator it = m_masker.begin(); it != end; ++it) - markForLayoutAndResourceInvalidation(it->first); - - deleteAllValues(m_masker); - m_masker.clear(); m_maskBoundaries = FloatRect(); -} - -void RenderSVGResourceMasker::invalidateClient(RenderObject* object) -{ - ASSERT(object); - if (!m_masker.contains(object)) - return; + if (!m_masker.isEmpty()) { + deleteAllValues(m_masker); + m_masker.clear(); + } - delete m_masker.take(object); - markForLayoutAndResourceInvalidation(object); + markAllClientsForInvalidation(LayoutAndBoundariesInvalidation); } -bool RenderSVGResourceMasker::childElementReferencesResource(const SVGRenderStyle* style, const String& referenceId) const +void RenderSVGResourceMasker::invalidateClient(RenderObject* client) { - if (!style->hasMasker()) - return false; + ASSERT(client); + ASSERT(client->selfNeedsLayout()); - return style->maskerResource() == referenceId; + if (m_masker.contains(client)) + delete m_masker.take(client); + + markClientForInvalidation(client, BoundariesInvalidation); } bool RenderSVGResourceMasker::applyResource(RenderObject* object, RenderStyle*, GraphicsContext*& context, unsigned short resourceMode) @@ -102,11 +99,6 @@ bool RenderSVGResourceMasker::applyResource(RenderObject* object, RenderStyle*, SVGMaskElement* maskElement = static_cast<SVGMaskElement*>(node()); if (!maskElement) return false; - - // Early exit, if this resource contains a child which references ourselves. - if (containsCyclicReference(node())) - return false; - createMaskImage(maskerData, maskElement, object); } diff --git a/WebCore/rendering/RenderSVGResourceMasker.h b/WebCore/rendering/RenderSVGResourceMasker.h index 56f657b..f6301cb 100644 --- a/WebCore/rendering/RenderSVGResourceMasker.h +++ b/WebCore/rendering/RenderSVGResourceMasker.h @@ -69,8 +69,6 @@ private: void createMaskImage(MaskerData*, const SVGMaskElement*, RenderObject*); void calculateMaskContentRepaintRect(); - virtual bool childElementReferencesResource(const SVGRenderStyle*, const String&) const; - FloatRect m_maskBoundaries; HashMap<RenderObject*, MaskerData*> m_masker; }; diff --git a/WebCore/rendering/RenderSVGResourcePattern.cpp b/WebCore/rendering/RenderSVGResourcePattern.cpp index a2234c8..902ff02 100644 --- a/WebCore/rendering/RenderSVGResourcePattern.cpp +++ b/WebCore/rendering/RenderSVGResourcePattern.cpp @@ -40,43 +40,32 @@ RenderSVGResourcePattern::RenderSVGResourcePattern(SVGPatternElement* node) RenderSVGResourcePattern::~RenderSVGResourcePattern() { - deleteAllValues(m_pattern); - m_pattern.clear(); -} - -void RenderSVGResourcePattern::invalidateClients() -{ - const HashMap<RenderObject*, PatternData*>::const_iterator end = m_pattern.end(); - for (HashMap<RenderObject*, PatternData*>::const_iterator it = m_pattern.begin(); it != end; ++it) - markForLayoutAndResourceInvalidation(it->first, false); + if (m_pattern.isEmpty()) + return; deleteAllValues(m_pattern); m_pattern.clear(); } -void RenderSVGResourcePattern::invalidateClient(RenderObject* object) +void RenderSVGResourcePattern::invalidateClients() { - ASSERT(object); - if (!m_pattern.contains(object)) - return; + if (!m_pattern.isEmpty()) { + deleteAllValues(m_pattern); + m_pattern.clear(); + } - delete m_pattern.take(object); - markForLayoutAndResourceInvalidation(object, false); + markAllClientsForInvalidation(RepaintInvalidation); } -bool RenderSVGResourcePattern::childElementReferencesResource(const SVGRenderStyle* style, const String& referenceId) const +void RenderSVGResourcePattern::invalidateClient(RenderObject* client) { - if (style->hasFill()) { - if (style->fillPaint()->matchesTargetURI(referenceId)) - return true; - } + ASSERT(client); + ASSERT(client->selfNeedsLayout()); - if (style->hasStroke()) { - if (style->strokePaint()->matchesTargetURI(referenceId)) - return true; - } + if (m_pattern.contains(client)) + delete m_pattern.take(client); - return false; + markClientForInvalidation(client, RepaintInvalidation); } bool RenderSVGResourcePattern::applyResource(RenderObject* object, RenderStyle* style, GraphicsContext*& context, unsigned short resourceMode) @@ -244,10 +233,6 @@ PassOwnPtr<ImageBuffer> RenderSVGResourcePattern::createTileImage(PatternData* p if (!attributes.patternContentElement()) return 0; - // Early exit, if this resource contains a child which references ourselves. - if (containsCyclicReference(attributes.patternContentElement())) - return 0; - FloatRect objectBoundingBox = object->objectBoundingBox(); FloatRect patternBoundaries = calculatePatternBoundaries(attributes, objectBoundingBox, patternElement); AffineTransform patternTransform = attributes.patternTransform(); diff --git a/WebCore/rendering/RenderSVGResourcePattern.h b/WebCore/rendering/RenderSVGResourcePattern.h index ec89777..690b0de 100644 --- a/WebCore/rendering/RenderSVGResourcePattern.h +++ b/WebCore/rendering/RenderSVGResourcePattern.h @@ -67,8 +67,6 @@ private: FloatRect calculatePatternBoundariesIncludingOverflow(PatternAttributes&, const FloatRect& objectBoundingBox, const AffineTransform& viewBoxCTM, const FloatRect& patternBoundaries) const; - virtual bool childElementReferencesResource(const SVGRenderStyle*, const String&) const; - HashMap<RenderObject*, PatternData*> m_pattern; }; diff --git a/WebCore/rendering/RenderSVGRoot.cpp b/WebCore/rendering/RenderSVGRoot.cpp index 1659e40..7ddebf2 100644 --- a/WebCore/rendering/RenderSVGRoot.cpp +++ b/WebCore/rendering/RenderSVGRoot.cpp @@ -26,14 +26,19 @@ #include "RenderSVGRoot.h" #include "GraphicsContext.h" +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE #include "HitTestResult.h" #endif +======= +#include "HitTestResult.h" +>>>>>>> webkit.org at r64523 #include "RenderSVGContainer.h" #include "RenderSVGResource.h" #include "RenderView.h" #include "SVGLength.h" #include "SVGRenderSupport.h" +#include "SVGResources.h" #include "SVGSVGElement.h" #include "SVGStyledElement.h" #include "TransformState.h" @@ -131,15 +136,14 @@ void RenderSVGRoot::layout() setNeedsLayout(false); } -bool RenderSVGRoot::selfWillPaint() const +bool RenderSVGRoot::selfWillPaint() { #if ENABLE(FILTERS) - const SVGRenderStyle* svgStyle = style()->svgStyle(); - RenderSVGResourceFilter* filter = getRenderSVGResourceById<RenderSVGResourceFilter>(document(), svgStyle->filterResource()); - if (filter) - return true; -#endif + SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(this); + return resources && resources->filter(); +#else return false; +#endif } void RenderSVGRoot::paint(PaintInfo& paintInfo, int parentX, int parentY) @@ -194,10 +198,22 @@ void RenderSVGRoot::paint(PaintInfo& paintInfo, int parentX, int parentY) void RenderSVGRoot::destroy() { - RenderSVGResource::invalidateAllResourcesOfRenderer(this); + SVGResourcesCache::clientDestroyed(this); RenderBox::destroy(); } +void RenderSVGRoot::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) +{ + RenderBox::styleDidChange(diff, oldStyle); + SVGResourcesCache::clientStyleChanged(this, diff, style()); +} + +void RenderSVGRoot::updateFromElement() +{ + RenderBox::updateFromElement(); + SVGResourcesCache::clientUpdatedFromElement(this, style()); +} + void RenderSVGRoot::calcViewport() { SVGSVGElement* svg = static_cast<SVGSVGElement*>(node()); @@ -322,6 +338,7 @@ bool RenderSVGRoot::nodeAtPoint(const HitTestRequest& request, HitTestResult& re if (child->nodeAtFloatPoint(request, result, localPoint, hitTestAction)) { // FIXME: CSS/HTML assumes the local point is relative to the border box, right? updateHitTestResult(result, pointInBorderBox); +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE // TODO: nodeAtFloatPoint() doesn't handle region test yet. if (result.isRegionTest()) { @@ -329,6 +346,10 @@ bool RenderSVGRoot::nodeAtPoint(const HitTestRequest& request, HitTestResult& re result.addRawNode(node()); } else #endif +======= + // FIXME: nodeAtFloatPoint() doesn't handle rect-based hit tests yet. + result.addNodeToRectBasedTestResult(child->node(), _x, _y); +>>>>>>> webkit.org at r64523 return true; } } diff --git a/WebCore/rendering/RenderSVGRoot.h b/WebCore/rendering/RenderSVGRoot.h index 0a08ab5..b90113c 100644 --- a/WebCore/rendering/RenderSVGRoot.h +++ b/WebCore/rendering/RenderSVGRoot.h @@ -58,6 +58,8 @@ private: virtual void paint(PaintInfo&, int parentX, int parentY); virtual void destroy(); + virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); + virtual void updateFromElement(); virtual const AffineTransform& localToParentTransform() const; @@ -77,7 +79,7 @@ private: void calcViewport(); - bool selfWillPaint() const; + bool selfWillPaint(); IntSize parentOriginToBorderBox() const; IntSize borderOriginToContentBox() const; diff --git a/WebCore/rendering/RenderSVGText.cpp b/WebCore/rendering/RenderSVGText.cpp index 58348db..c4fc353 100644 --- a/WebCore/rendering/RenderSVGText.cpp +++ b/WebCore/rendering/RenderSVGText.cpp @@ -98,9 +98,9 @@ void RenderSVGText::layout() ASSERT(childrenInline()); forceLayoutInlineChildren(); - // Invalidate all resources of this client, if we changed something. + // Invalidate all resources of this client if our layout changed. if (m_everHadLayout && selfNeedsLayout()) - RenderSVGResource::invalidateAllResourcesOfRenderer(this); + SVGResourcesCache::clientLayoutChanged(this); repainter.repaintAfterLayout(); setNeedsLayout(false); @@ -132,12 +132,6 @@ bool RenderSVGText::nodeAtFloatPoint(const HitTestRequest& request, HitTestResul return false; } -void RenderSVGText::destroy() -{ - RenderSVGResource::invalidateAllResourcesOfRenderer(this); - RenderSVGBlock::destroy(); -} - bool RenderSVGText::nodeAtPoint(const HitTestRequest&, HitTestResult&, int, int, int, int, HitTestAction) { ASSERT_NOT_REACHED(); diff --git a/WebCore/rendering/RenderSVGText.h b/WebCore/rendering/RenderSVGText.h index 6e7d03a..be19419 100644 --- a/WebCore/rendering/RenderSVGText.h +++ b/WebCore/rendering/RenderSVGText.h @@ -51,8 +51,6 @@ private: virtual bool requiresLayer() const { return false; } virtual void layout(); - virtual void destroy(); - virtual void absoluteQuads(Vector<FloatQuad>&); virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer); diff --git a/WebCore/rendering/RenderScrollbar.cpp b/WebCore/rendering/RenderScrollbar.cpp index 63fce8d..817dd02 100644 --- a/WebCore/rendering/RenderScrollbar.cpp +++ b/WebCore/rendering/RenderScrollbar.cpp @@ -130,6 +130,9 @@ ScrollbarPart RenderScrollbar::partForStyleResolve() PassRefPtr<RenderStyle> RenderScrollbar::getScrollbarPseudoStyle(ScrollbarPart partType, PseudoId pseudoId) { + if (!m_owner) + return 0; + s_styleResolvePart = partType; s_styleResolveScrollbar = this; RefPtr<RenderStyle> result = m_owner->getUncachedPseudoStyle(pseudoId, m_owner->style()); diff --git a/WebCore/rendering/RenderScrollbar.h b/WebCore/rendering/RenderScrollbar.h index b3c00ef..8cc263a 100644 --- a/WebCore/rendering/RenderScrollbar.h +++ b/WebCore/rendering/RenderScrollbar.h @@ -49,6 +49,7 @@ public: static RenderScrollbar* scrollbarForStyleResolve(); RenderBox* owningRenderer() const { return m_owner; } + void clearOwningRenderer() { m_owner = 0; } void paintPart(GraphicsContext*, ScrollbarPart, const IntRect&); diff --git a/WebCore/rendering/RenderTable.cpp b/WebCore/rendering/RenderTable.cpp index 6359c09..7c54837 100644 --- a/WebCore/rendering/RenderTable.cpp +++ b/WebCore/rendering/RenderTable.cpp @@ -31,9 +31,13 @@ #include "Document.h" #include "FixedTableLayout.h" #include "FrameView.h" +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE #include "HitTestResult.h" #endif +======= +#include "HitTestResult.h" +>>>>>>> webkit.org at r64523 #include "HTMLNames.h" #include "RenderLayer.h" #include "RenderTableCell.h" @@ -1183,11 +1187,15 @@ bool RenderTable::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu ty += y(); // Check kids first. +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE if (!hasOverflowClip() || result.intersects(xPos, yPos, overflowClipRect(tx, ty))) { #else if (!hasOverflowClip() || overflowClipRect(tx, ty).contains(xPos, yPos)) { #endif +======= + if (!hasOverflowClip() || overflowClipRect(tx, ty).intersects(result.rectFromPoint(xPos, yPos))) { +>>>>>>> webkit.org at r64523 for (RenderObject* child = lastChild(); child; child = child->previousSibling()) { if (child->isBox() && !toRenderBox(child)->hasSelfPaintingLayer() && (child->isTableSection() || child == m_caption) && child->nodeAtPoint(request, result, xPos, yPos, tx, ty, action)) { @@ -1198,6 +1206,7 @@ bool RenderTable::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu } // Check our bounds next. +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE IntRect boundsRect = IntRect(tx, ty, width(), height()); if (visibleToHitTesting() && (action == HitTestBlockBackground || action == HitTestChildBlockBackground) && result.intersects(xPos, yPos, boundsRect)) { @@ -1214,6 +1223,13 @@ bool RenderTable::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu } #endif return true; +======= + IntRect boundsRect = IntRect(tx, ty, width(), height()); + if (visibleToHitTesting() && (action == HitTestBlockBackground || action == HitTestChildBlockBackground) && boundsRect.intersects(result.rectFromPoint(xPos, yPos))) { + updateHitTestResult(result, IntPoint(xPos - tx, yPos - ty)); + if (!result.addNodeToRectBasedTestResult(node(), xPos, yPos, boundsRect)) + return true; +>>>>>>> webkit.org at r64523 } return false; diff --git a/WebCore/rendering/RenderTableSection.cpp b/WebCore/rendering/RenderTableSection.cpp index c439a13..e094f36 100644 --- a/WebCore/rendering/RenderTableSection.cpp +++ b/WebCore/rendering/RenderTableSection.cpp @@ -28,9 +28,13 @@ #include "CachedImage.h" #include "Document.h" +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE #include "HitTestResult.h" #endif +======= +#include "HitTestResult.h" +>>>>>>> webkit.org at r64523 #include "HTMLNames.h" #include "RenderTableCell.h" #include "RenderTableCol.h" @@ -1289,11 +1293,15 @@ bool RenderTableSection::nodeAtPoint(const HitTestRequest& request, HitTestResul tx += x(); ty += y(); +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE if (hasOverflowClip() && !result.intersects(xPos, yPos, overflowClipRect(tx, ty))) #else if (hasOverflowClip() && !overflowClipRect(tx, ty).contains(xPos, yPos)) #endif +======= + if (hasOverflowClip() && !overflowClipRect(tx, ty).intersects(result.rectFromPoint(xPos, yPos))) +>>>>>>> webkit.org at r64523 return false; for (RenderObject* child = lastChild(); child; child = child->previousSibling()) { diff --git a/WebCore/rendering/RenderTextControlSingleLine.cpp b/WebCore/rendering/RenderTextControlSingleLine.cpp index 5b57513..4ba2dc7 100644 --- a/WebCore/rendering/RenderTextControlSingleLine.cpp +++ b/WebCore/rendering/RenderTextControlSingleLine.cpp @@ -2,6 +2,7 @@ * Copyright (C) 2006, 2007, 2010 Apple Inc. All rights reserved. * (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) * Copyright (C) 2010 Google Inc. All rights reserved. + * Copyright (C) 2010 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 @@ -23,6 +24,7 @@ #include "config.h" #include "RenderTextControlSingleLine.h" +#include "Chrome.h" #include "CSSStyleSelector.h" #include "Event.h" #include "EventNames.h" @@ -38,7 +40,6 @@ #include "RenderLayer.h" #include "RenderScrollbar.h" #include "RenderTheme.h" -#include "SearchPopupMenu.h" #include "SelectionController.h" #include "Settings.h" #include "SimpleFontData.h" @@ -62,7 +63,7 @@ RenderTextControlSingleLine::RenderTextControlSingleLine(Node* node, bool placeh RenderTextControlSingleLine::~RenderTextControlSingleLine() { if (m_searchPopup) { - m_searchPopup->disconnectClient(); + m_searchPopup->popupMenu()->disconnectClient(); m_searchPopup = 0; } @@ -107,7 +108,7 @@ void RenderTextControlSingleLine::addSearchResult() const AtomicString& name = autosaveName(); if (!m_searchPopup) - m_searchPopup = SearchPopupMenu::create(this); + m_searchPopup = document()->page()->chrome()->createSearchPopupMenu(this); m_searchPopup->saveRecentSearches(name, m_recentSearches); } @@ -125,7 +126,7 @@ void RenderTextControlSingleLine::showPopup() return; if (!m_searchPopup) - m_searchPopup = SearchPopupMenu::create(this); + m_searchPopup = document()->page()->chrome()->createSearchPopupMenu(this); if (!m_searchPopup->enabled()) return; @@ -145,14 +146,14 @@ void RenderTextControlSingleLine::showPopup() m_searchPopup->saveRecentSearches(name, m_recentSearches); } - m_searchPopup->show(absoluteBoundingBoxRect(true), document()->view(), -1); + m_searchPopup->popupMenu()->show(absoluteBoundingBoxRect(true), document()->view(), -1); } void RenderTextControlSingleLine::hidePopup() { ASSERT(node()->isHTMLElement()); if (m_searchPopup) - m_searchPopup->hide(); + m_searchPopup->popupMenu()->hide(); } void RenderTextControlSingleLine::subtreeHasChanged() @@ -689,7 +690,7 @@ void RenderTextControlSingleLine::updateFromElement() } if (m_searchPopupIsVisible) - m_searchPopup->updateFromElement(); + m_searchPopup->popupMenu()->updateFromElement(); } void RenderTextControlSingleLine::cacheSelection(int start, int end) @@ -887,7 +888,7 @@ void RenderTextControlSingleLine::valueChanged(unsigned listIndex, bool fireEven const AtomicString& name = autosaveName(); if (!name.isEmpty()) { if (!m_searchPopup) - m_searchPopup = SearchPopupMenu::create(this); + m_searchPopup = document()->page()->chrome()->createSearchPopupMenu(this); m_searchPopup->saveRecentSearches(name, m_recentSearches); } } diff --git a/WebCore/rendering/RenderTextControlSingleLine.h b/WebCore/rendering/RenderTextControlSingleLine.h index 8c7e844..4bc80cf 100644 --- a/WebCore/rendering/RenderTextControlSingleLine.h +++ b/WebCore/rendering/RenderTextControlSingleLine.h @@ -1,6 +1,7 @@ /* * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) + * Copyright (C) 2010 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 @@ -24,6 +25,7 @@ #include "PopupMenuClient.h" #include "RenderTextControl.h" +#include "SearchPopupMenu.h" #include "Timer.h" namespace WebCore { @@ -32,7 +34,6 @@ class InputElement; class InputFieldSpeechButtonElement; class SearchFieldCancelButtonElement; class SearchFieldResultsButtonElement; -class SearchPopupMenu; class SpinButtonElement; class TextControlInnerElement; diff --git a/WebCore/rendering/RenderWidget.cpp b/WebCore/rendering/RenderWidget.cpp index bebe6c8..3854e6a 100644 --- a/WebCore/rendering/RenderWidget.cpp +++ b/WebCore/rendering/RenderWidget.cpp @@ -396,7 +396,7 @@ bool RenderWidget::nodeAtPoint(const HitTestRequest& request, HitTestResult& res bool inside = RenderReplaced::nodeAtPoint(request, result, x, y, tx, ty, action); // Check to see if we are really over the widget itself (and not just in the border/padding area). - if (inside && !hadResult && result.innerNode() == node()) + if ((inside || result.isRectBasedTest()) && !hadResult && result.innerNode() == node()) result.setIsOverWidget(contentBoxRect().contains(result.localPoint())); #ifdef ANDROID_HITTEST_WITHSIZE else if (result.isRegionTest() && !hadResult && result.innerNode() == node()) { diff --git a/WebCore/rendering/SVGInlineTextBox.cpp b/WebCore/rendering/SVGInlineTextBox.cpp index 8e498ad..a293124 100644 --- a/WebCore/rendering/SVGInlineTextBox.cpp +++ b/WebCore/rendering/SVGInlineTextBox.cpp @@ -295,17 +295,16 @@ void SVGInlineTextBox::paint(PaintInfo& paintInfo, int, int) ASSERT(!m_paintingResource); } -bool SVGInlineTextBox::acquirePaintingResource(GraphicsContext*& context, RenderStyle* style) +bool SVGInlineTextBox::acquirePaintingResource(GraphicsContext*& context, RenderObject* renderer, RenderStyle* style) { + ASSERT(renderer); + ASSERT(style); ASSERT(m_paintingResourceMode != ApplyToDefaultMode); - RenderObject* parentRenderer = parent()->renderer(); - ASSERT(parentRenderer); - if (m_paintingResourceMode & ApplyToFillMode) - m_paintingResource = RenderSVGResource::fillPaintingResource(parentRenderer, style); + m_paintingResource = RenderSVGResource::fillPaintingResource(renderer, style); else if (m_paintingResourceMode & ApplyToStrokeMode) - m_paintingResource = RenderSVGResource::strokePaintingResource(parentRenderer, style); + m_paintingResource = RenderSVGResource::strokePaintingResource(renderer, style); else { // We're either called for stroking or filling. ASSERT_NOT_REACHED(); @@ -314,7 +313,7 @@ bool SVGInlineTextBox::acquirePaintingResource(GraphicsContext*& context, Render if (!m_paintingResource) return false; - m_paintingResource->applyResource(parentRenderer, style, context, m_paintingResourceMode); + m_paintingResource->applyResource(renderer, style, context, m_paintingResourceMode); return true; } @@ -331,7 +330,7 @@ void SVGInlineTextBox::releasePaintingResource(GraphicsContext*& context) bool SVGInlineTextBox::prepareGraphicsContextForTextPainting(GraphicsContext*& context, TextRun& textRun, RenderStyle* style) { - bool acquiredResource = acquirePaintingResource(context, style); + bool acquiredResource = acquirePaintingResource(context, parent()->renderer(), style); #if ENABLE(SVG_FONTS) // SVG Fonts need access to the painting resource used to draw the current text chunk. @@ -508,21 +507,24 @@ void SVGInlineTextBox::paintDecoration(GraphicsContext* context, const FloatPoin if (hasDecorationFill) { m_paintingResourceMode = ApplyToFillMode; - paintDecorationWithStyle(context, textOrigin, decorationStyle, decoration); + paintDecorationWithStyle(context, textOrigin, decorationRenderer, decoration); } if (hasDecorationStroke) { m_paintingResourceMode = ApplyToStrokeMode; - paintDecorationWithStyle(context, textOrigin, decorationStyle, decoration); + paintDecorationWithStyle(context, textOrigin, decorationRenderer, decoration); } } -void SVGInlineTextBox::paintDecorationWithStyle(GraphicsContext* context, const FloatPoint& textOrigin, RenderStyle* decorationStyle, ETextDecoration decoration) +void SVGInlineTextBox::paintDecorationWithStyle(GraphicsContext* context, const FloatPoint& textOrigin, RenderObject* decorationRenderer, ETextDecoration decoration) { ASSERT(!m_paintingResource); ASSERT(m_paintingResourceMode != ApplyToDefaultMode); ASSERT(m_currentChunkPart.isValid()); + RenderStyle* decorationStyle = decorationRenderer->style(); + ASSERT(decorationStyle); + const Font& font = decorationStyle->font(); // The initial y value refers to overline position. @@ -534,7 +536,7 @@ void SVGInlineTextBox::paintDecorationWithStyle(GraphicsContext* context, const context->beginPath(); context->addPath(Path::createRectangle(FloatRect(x, y, m_currentChunkPart.width, thickness))); - if (acquirePaintingResource(context, decorationStyle)) + if (acquirePaintingResource(context, decorationRenderer, decorationStyle)) releasePaintingResource(context); context->restore(); @@ -614,9 +616,15 @@ void SVGInlineTextBox::paintText(GraphicsContext* context, const FloatPoint& tex paintTextWithShadows(context, textOrigin, style, textRun, 0, startPos); // Draw text using selection style from the start to the end position of the selection + if (style != selectionStyle) + SVGResourcesCache::clientStyleChanged(parent()->renderer(), StyleDifferenceRepaint, selectionStyle); + TextRun selectionTextRun(constructTextRun(selectionStyle)); paintTextWithShadows(context, textOrigin, selectionStyle, textRun, startPos, endPos); + if (style != selectionStyle) + SVGResourcesCache::clientStyleChanged(parent()->renderer(), StyleDifferenceRepaint, style); + // Eventually draw text using regular style from the end position of the selection to the end of the current chunk part if (endPos < m_currentChunkPart.length && !paintSelectedTextOnly) paintTextWithShadows(context, textOrigin, style, textRun, endPos, m_currentChunkPart.length); diff --git a/WebCore/rendering/SVGInlineTextBox.h b/WebCore/rendering/SVGInlineTextBox.h index 602fff1..7711db4 100644 --- a/WebCore/rendering/SVGInlineTextBox.h +++ b/WebCore/rendering/SVGInlineTextBox.h @@ -75,7 +75,7 @@ private: TextRun constructTextRun(RenderStyle*) const; AffineTransform buildChunkTransformation(SVGChar& firstCharacter) const; - bool acquirePaintingResource(GraphicsContext*&, RenderStyle*); + bool acquirePaintingResource(GraphicsContext*&, RenderObject*, RenderStyle*); void releasePaintingResource(GraphicsContext*&); bool prepareGraphicsContextForTextPainting(GraphicsContext*&, TextRun&, RenderStyle*); @@ -83,7 +83,7 @@ private: void computeTextMatchMarkerRect(RenderStyle*); void paintDecoration(GraphicsContext*, const FloatPoint& textOrigin, ETextDecoration, bool hasSelection); - void paintDecorationWithStyle(GraphicsContext*, const FloatPoint& textOrigin, RenderStyle*, ETextDecoration); + void paintDecorationWithStyle(GraphicsContext*, const FloatPoint& textOrigin, RenderObject*, ETextDecoration); void paintSelection(GraphicsContext*, const FloatPoint& textOrigin, RenderStyle*); void paintText(GraphicsContext*, const FloatPoint& textOrigin, RenderStyle*, RenderStyle* selectionStyle, bool hasSelection, bool paintSelectedTextOnly); void paintTextWithShadows(GraphicsContext*, const FloatPoint& textOrigin, RenderStyle*, TextRun&, int startPos, int endPos); diff --git a/WebCore/rendering/SVGRenderSupport.cpp b/WebCore/rendering/SVGRenderSupport.cpp index 0d4a42b..34f6659 100644 --- a/WebCore/rendering/SVGRenderSupport.cpp +++ b/WebCore/rendering/SVGRenderSupport.cpp @@ -40,6 +40,7 @@ #include "RenderSVGResourceMarker.h" #include "RenderSVGResourceMasker.h" #include "RenderSVGRoot.h" +#include "SVGResources.h" #include "SVGStyledElement.h" #include "TransformState.h" #include <wtf/UnusedParam.h> @@ -79,10 +80,7 @@ void SVGRenderSupport::mapLocalToContainer(const RenderObject* object, RenderBox bool SVGRenderSupport::prepareToRenderSVGContent(RenderObject* object, PaintInfo& paintInfo) { ASSERT(object); - SVGElement* svgElement = static_cast<SVGElement*>(object->node()); - ASSERT(svgElement && svgElement->document() && svgElement->isStyled()); - SVGStyledElement* styledElement = static_cast<SVGStyledElement*>(svgElement); RenderStyle* style = object->style(); ASSERT(style); @@ -109,33 +107,22 @@ bool SVGRenderSupport::prepareToRenderSVGContent(RenderObject* object, PaintInfo paintInfo.context->beginTransparencyLayer(1); } - Document* document = object->document(); + SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(object); + if (!resources) + return true; - if (svgStyle->hasMasker()) { - AtomicString maskerId(svgStyle->maskerResource()); - if (RenderSVGResourceMasker* masker = getRenderSVGResourceById<RenderSVGResourceMasker>(document, maskerId)) { - if (!masker->applyResource(object, style, paintInfo.context, ApplyToDefaultMode)) - return false; - } else - document->accessSVGExtensions()->addPendingResource(maskerId, styledElement); + if (RenderSVGResourceMasker* masker = resources->masker()) { + if (!masker->applyResource(object, style, paintInfo.context, ApplyToDefaultMode)) + return false; } - if (svgStyle->hasClipper()) { - AtomicString clipperId(svgStyle->clipperResource()); - if (RenderSVGResourceClipper* clipper = getRenderSVGResourceById<RenderSVGResourceClipper>(document, clipperId)) - clipper->applyResource(object, style, paintInfo.context, ApplyToDefaultMode); - else - document->accessSVGExtensions()->addPendingResource(clipperId, styledElement); - } + if (RenderSVGResourceClipper* clipper = resources->clipper()) + clipper->applyResource(object, style, paintInfo.context, ApplyToDefaultMode); #if ENABLE(FILTERS) - if (svgStyle->hasFilter()) { - AtomicString filterId(svgStyle->filterResource()); - if (RenderSVGResourceFilter* filter = getRenderSVGResourceById<RenderSVGResourceFilter>(document, filterId)) { - if (!filter->applyResource(object, style, paintInfo.context, ApplyToDefaultMode)) - return false; - } else - document->accessSVGExtensions()->addPendingResource(filterId, styledElement); + if (RenderSVGResourceFilter* filter = resources->filter()) { + if (!filter->applyResource(object, style, paintInfo.context, ApplyToDefaultMode)) + return false; } #endif @@ -157,9 +144,9 @@ void SVGRenderSupport::finishRenderSVGContent(RenderObject* object, PaintInfo& p ASSERT(svgStyle); #if ENABLE(FILTERS) - if (svgStyle->hasFilter()) { - AtomicString filterId(svgStyle->filterResource()); - if (RenderSVGResourceFilter* filter = getRenderSVGResourceById<RenderSVGResourceFilter>(object->document(), filterId)) { + SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(object); + if (resources) { + if (RenderSVGResourceFilter* filter = resources->filter()) { filter->postApplyResource(object, paintInfo.context, ApplyToDefaultMode); paintInfo.context = savedContext; } @@ -289,49 +276,46 @@ bool SVGRenderSupport::isOverflowHidden(const RenderObject* object) void SVGRenderSupport::intersectRepaintRectWithResources(const RenderObject* object, FloatRect& repaintRect) { ASSERT(object); - ASSERT(object->style()); - const SVGRenderStyle* svgStyle = object->style()->svgStyle(); - if (!svgStyle) - return; - + + RenderStyle* style = object->style(); + ASSERT(style); + + const SVGRenderStyle* svgStyle = style->svgStyle(); + ASSERT(svgStyle); + RenderObject* renderer = const_cast<RenderObject*>(object); -#if ENABLE(FILTERS) - if (svgStyle->hasFilter()) { - if (RenderSVGResourceFilter* filter = getRenderSVGResourceById<RenderSVGResourceFilter>(object->document(), svgStyle->filterResource())) - repaintRect = filter->resourceBoundingBox(renderer); + SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(renderer); + if (!resources) { + svgStyle->inflateForShadow(repaintRect); + return; } + +#if ENABLE(FILTERS) + if (RenderSVGResourceFilter* filter = resources->filter()) + repaintRect = filter->resourceBoundingBox(renderer); #endif - if (svgStyle->hasClipper()) { - if (RenderSVGResourceClipper* clipper = getRenderSVGResourceById<RenderSVGResourceClipper>(object->document(), svgStyle->clipperResource())) - repaintRect.intersect(clipper->resourceBoundingBox(renderer)); - } - - if (svgStyle->hasMasker()) { - if (RenderSVGResourceMasker* masker = getRenderSVGResourceById<RenderSVGResourceMasker>(object->document(), svgStyle->maskerResource())) - repaintRect.intersect(masker->resourceBoundingBox(renderer)); - } - + if (RenderSVGResourceClipper* clipper = resources->clipper()) + repaintRect.intersect(clipper->resourceBoundingBox(renderer)); + + if (RenderSVGResourceMasker* masker = resources->masker()) + repaintRect.intersect(masker->resourceBoundingBox(renderer)); + svgStyle->inflateForShadow(repaintRect); } -bool SVGRenderSupport::pointInClippingArea(const RenderObject* object, const FloatPoint& point) +bool SVGRenderSupport::pointInClippingArea(RenderObject* object, const FloatPoint& point) { ASSERT(object); - ASSERT(object->style()); - - Document* document = object->document(); - ASSERT(document); - - const SVGRenderStyle* svgStyle = object->style()->svgStyle(); - ASSERT(svgStyle); // We just take clippers into account to determine if a point is on the node. The Specification may // change later and we also need to check maskers. - if (svgStyle->hasClipper()) { - if (RenderSVGResourceClipper* clipper = getRenderSVGResourceById<RenderSVGResourceClipper>(document, svgStyle->clipperResource())) - return clipper->hitTestClipContent(object->objectBoundingBox(), point); - } + SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(object); + if (!resources) + return true; + + if (RenderSVGResourceClipper* clipper = resources->clipper()) + return clipper->hitTestClipContent(object->objectBoundingBox(), point); return true; } diff --git a/WebCore/rendering/SVGRenderSupport.h b/WebCore/rendering/SVGRenderSupport.h index 8eb486e6..371ac75 100644 --- a/WebCore/rendering/SVGRenderSupport.h +++ b/WebCore/rendering/SVGRenderSupport.h @@ -56,7 +56,7 @@ public: static void intersectRepaintRectWithResources(const RenderObject*, FloatRect&); // Determines whether the passed point lies in a clipping area - static bool pointInClippingArea(const RenderObject*, const FloatPoint&); + static bool pointInClippingArea(RenderObject*, const FloatPoint&); enum ContainerBoundingBoxMode { ObjectBoundingBox, diff --git a/WebCore/rendering/SVGRenderTreeAsText.cpp b/WebCore/rendering/SVGRenderTreeAsText.cpp index bec78e7..d298544 100644 --- a/WebCore/rendering/SVGRenderTreeAsText.cpp +++ b/WebCore/rendering/SVGRenderTreeAsText.cpp @@ -366,7 +366,7 @@ static void writeStyle(TextStream& ts, const RenderObject& object) if (object.isRenderPath()) { const RenderPath& path = static_cast<const RenderPath&>(object); - if (RenderSVGResource* strokePaintingResource = RenderSVGResource::strokePaintingResource(&path, path.style())) { + if (RenderSVGResource* strokePaintingResource = RenderSVGResource::strokePaintingResource(const_cast<RenderPath*>(&path), path.style())) { TextStreamSeparator s(" "); ts << " [stroke={" << s; writeSVGPaintingResource(ts, strokePaintingResource); @@ -387,7 +387,7 @@ static void writeStyle(TextStream& ts, const RenderObject& object) ts << "}]"; } - if (RenderSVGResource* fillPaintingResource = RenderSVGResource::fillPaintingResource(&path, path.style())) { + if (RenderSVGResource* fillPaintingResource = RenderSVGResource::fillPaintingResource(const_cast<RenderPath*>(&path), path.style())) { TextStreamSeparator s(" "); ts << " [fill={" << s; writeSVGPaintingResource(ts, fillPaintingResource); @@ -734,6 +734,8 @@ void writeResources(TextStream& ts, const RenderObject& object, int indent) const RenderStyle* style = object.style(); const SVGRenderStyle* svgStyle = style->svgStyle(); + // FIXME: We want to use SVGResourcesCache to determine which resources are present, instead of quering the resource <-> id cache. + // For now leave the DRT output as is, but later on we should change this so cycles are properly ignored in the DRT output. RenderObject& renderer = const_cast<RenderObject&>(object); if (!svgStyle->maskerResource().isEmpty()) { if (RenderSVGResourceMasker* masker = getRenderSVGResourceById<RenderSVGResourceMasker>(object.document(), svgStyle->maskerResource())) { diff --git a/WebCore/rendering/SVGResources.cpp b/WebCore/rendering/SVGResources.cpp index de23ce1..fa1677b 100644 --- a/WebCore/rendering/SVGResources.cpp +++ b/WebCore/rendering/SVGResources.cpp @@ -25,24 +25,128 @@ #include "RenderSVGResourceFilter.h" #include "RenderSVGResourceMarker.h" #include "RenderSVGResourceMasker.h" +#include "SVGFilterElement.h" +#include "SVGGradientElement.h" #include "SVGPaint.h" +#include "SVGPatternElement.h" #include "SVGRenderStyle.h" #include "SVGURIReference.h" namespace WebCore { SVGResources::SVGResources() - : m_clipper(0) -#if ENABLE(FILTERS) - , m_filter(0) -#endif - , m_markerStart(0) - , m_markerMid(0) - , m_markerEnd(0) - , m_masker(0) - , m_fill(0) - , m_stroke(0) + : m_clipperFilterMaskerData(0) + , m_markerData(0) + , m_fillStrokeData(0) + , m_linkedResource(0) +{ +} + +static HashSet<AtomicStringImpl*>& clipperFilterMaskerTags() { + DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, s_tagList, ()); + if (s_tagList.isEmpty()) { + // "container elements": http://www.w3.org/TR/SVG11/intro.html#TermContainerElement + // "graphics elements" : http://www.w3.org/TR/SVG11/intro.html#TermGraphicsElement + s_tagList.add(SVGNames::aTag.localName().impl()); + s_tagList.add(SVGNames::circleTag.localName().impl()); + s_tagList.add(SVGNames::ellipseTag.localName().impl()); + s_tagList.add(SVGNames::glyphTag.localName().impl()); + s_tagList.add(SVGNames::gTag.localName().impl()); + s_tagList.add(SVGNames::imageTag.localName().impl()); + s_tagList.add(SVGNames::lineTag.localName().impl()); + s_tagList.add(SVGNames::markerTag.localName().impl()); + s_tagList.add(SVGNames::maskTag.localName().impl()); + s_tagList.add(SVGNames::missing_glyphTag.localName().impl()); + s_tagList.add(SVGNames::pathTag.localName().impl()); + s_tagList.add(SVGNames::polygonTag.localName().impl()); + s_tagList.add(SVGNames::polylineTag.localName().impl()); + s_tagList.add(SVGNames::rectTag.localName().impl()); + s_tagList.add(SVGNames::svgTag.localName().impl()); + s_tagList.add(SVGNames::textTag.localName().impl()); + s_tagList.add(SVGNames::useTag.localName().impl()); + + // Not listed in the definitions is the clipPath element, the SVG spec says though: + // The "clipPath" element or any of its children can specify property "clip-path". + // So we have to add clipPathTag here, otherwhise clip-path on clipPath will fail. + // (Already mailed SVG WG, waiting for a solution) + s_tagList.add(SVGNames::clipPathTag.localName().impl()); + + // Not listed in the definitions are the text content elements, though filter/clipper/masker on tspan/text/.. is allowed. + // (Already mailed SVG WG, waiting for a solution) + s_tagList.add(SVGNames::altGlyphTag.localName().impl()); + s_tagList.add(SVGNames::textPathTag.localName().impl()); + s_tagList.add(SVGNames::trefTag.localName().impl()); + s_tagList.add(SVGNames::tspanTag.localName().impl()); + + // Elements that we ignore, as it doesn't make any sense. + // defs, pattern, switch (FIXME: Mail SVG WG about these) + // symbol (is converted to a svg element, when referenced by use, we can safely ignore it.) + } + + return s_tagList; +} + +static HashSet<AtomicStringImpl*>& markerTags() +{ + DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, s_tagList, ()); + if (s_tagList.isEmpty()) { + s_tagList.add(SVGNames::lineTag.localName().impl()); + s_tagList.add(SVGNames::pathTag.localName().impl()); + s_tagList.add(SVGNames::polygonTag.localName().impl()); + s_tagList.add(SVGNames::polylineTag.localName().impl()); + } + + return s_tagList; +} + +static HashSet<AtomicStringImpl*>& fillAndStrokeTags() +{ + DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, s_tagList, ()); + if (s_tagList.isEmpty()) { + s_tagList.add(SVGNames::altGlyphTag.localName().impl()); + s_tagList.add(SVGNames::circleTag.localName().impl()); + s_tagList.add(SVGNames::ellipseTag.localName().impl()); + s_tagList.add(SVGNames::lineTag.localName().impl()); + s_tagList.add(SVGNames::pathTag.localName().impl()); + s_tagList.add(SVGNames::polygonTag.localName().impl()); + s_tagList.add(SVGNames::polylineTag.localName().impl()); + s_tagList.add(SVGNames::rectTag.localName().impl()); + s_tagList.add(SVGNames::textTag.localName().impl()); + s_tagList.add(SVGNames::textPathTag.localName().impl()); + s_tagList.add(SVGNames::trefTag.localName().impl()); + s_tagList.add(SVGNames::tspanTag.localName().impl()); + } + + return s_tagList; +} + +static HashSet<AtomicStringImpl*>& chainableResourceTags() +{ + DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, s_tagList, ()); + if (s_tagList.isEmpty()) { + s_tagList.add(SVGNames::linearGradientTag.localName().impl()); + s_tagList.add(SVGNames::filterTag.localName().impl()); + s_tagList.add(SVGNames::patternTag.localName().impl()); + s_tagList.add(SVGNames::radialGradientTag.localName().impl()); + } + + return s_tagList; +} + +static inline String targetReferenceFromResource(SVGElement* element) +{ + String target; + if (element->hasTagName(SVGNames::patternTag)) + target = static_cast<SVGPatternElement*>(element)->href(); + else if (element->hasTagName(SVGNames::linearGradientTag) || element->hasTagName(SVGNames::radialGradientTag)) + target = static_cast<SVGGradientElement*>(element)->href(); + else if (element->hasTagName(SVGNames::filterTag)) + target = static_cast<SVGFilterElement*>(element)->href(); + else + ASSERT_NOT_REACHED(); + + return SVGURIReference::getTarget(target); } static inline RenderSVGResourceContainer* paintingResourceFromSVGPaint(Document* document, SVGPaint* paint, AtomicString& id, bool& hasPendingResource) @@ -61,17 +165,13 @@ static inline RenderSVGResourceContainer* paintingResourceFromSVGPaint(Document* return 0; } -static inline void registerPendingResource(SVGDocumentExtensions* extensions, const AtomicString& id, Node* node) +static inline void registerPendingResource(SVGDocumentExtensions* extensions, const AtomicString& id, SVGElement* element) { - ASSERT(node); - if (!node->isSVGElement()) - return; - - SVGElement* svgElement = static_cast<SVGElement*>(node); - if (!svgElement->isStyled()) + ASSERT(element); + if (!element->isStyled()) return; - extensions->addPendingResource(id, static_cast<SVGStyledElement*>(svgElement)); + extensions->addPendingResource(id, static_cast<SVGStyledElement*>(element)); } bool SVGResources::buildCachedResources(const RenderObject* object, const SVGRenderStyle* style) @@ -81,6 +181,11 @@ bool SVGResources::buildCachedResources(const RenderObject* object, const SVGRen Node* node = object->node(); ASSERT(node); + ASSERT(node->isSVGElement()); + + SVGElement* element = static_cast<SVGElement*>(node); + if (!element) + return false; Document* document = object->document(); ASSERT(document); @@ -88,77 +193,85 @@ bool SVGResources::buildCachedResources(const RenderObject* object, const SVGRen SVGDocumentExtensions* extensions = document->accessSVGExtensions(); ASSERT(extensions); - bool foundResources = false; - if (style->hasClipper()) { - AtomicString id(style->clipperResource()); - m_clipper = getRenderSVGResourceById<RenderSVGResourceClipper>(document, id); - if (m_clipper) - foundResources = true; - else - registerPendingResource(extensions, id, node); - } + AtomicStringImpl* tagNameImpl = element->tagQName().localName().impl(); + if (!tagNameImpl) + return false; - if (style->hasMasker()) { - AtomicString id(style->maskerResource()); - m_masker = getRenderSVGResourceById<RenderSVGResourceMasker>(document, id); - if (m_masker) - foundResources = true; - else - registerPendingResource(extensions, id, node); - } + bool foundResources = false; + if (clipperFilterMaskerTags().contains(tagNameImpl)) { + if (style->hasClipper()) { + AtomicString id(style->clipperResource()); + if (setClipper(getRenderSVGResourceById<RenderSVGResourceClipper>(document, id))) + foundResources = true; + else + registerPendingResource(extensions, id, element); + } #if ENABLE(FILTERS) - if (style->hasFilter()) { - AtomicString id(style->filterResource()); - m_filter = getRenderSVGResourceById<RenderSVGResourceFilter>(document, id); - if (m_filter) - foundResources = true; - else - registerPendingResource(extensions, id, node); - } + if (style->hasFilter()) { + AtomicString id(style->filterResource()); + if (setFilter(getRenderSVGResourceById<RenderSVGResourceFilter>(document, id))) + foundResources = true; + else + registerPendingResource(extensions, id, element); + } #endif - if (style->hasMarkers()) { + if (style->hasMasker()) { + AtomicString id(style->maskerResource()); + if (setMasker(getRenderSVGResourceById<RenderSVGResourceMasker>(document, id))) + foundResources = true; + else + registerPendingResource(extensions, id, element); + } + } + + if (markerTags().contains(tagNameImpl) && style->hasMarkers()) { AtomicString markerStartId(style->markerStartResource()); - m_markerStart = getRenderSVGResourceById<RenderSVGResourceMarker>(document, markerStartId); - if (m_markerStart) + if (setMarkerStart(getRenderSVGResourceById<RenderSVGResourceMarker>(document, markerStartId))) foundResources = true; else - registerPendingResource(extensions, markerStartId, node); + registerPendingResource(extensions, markerStartId, element); AtomicString markerMidId(style->markerMidResource()); - m_markerMid = getRenderSVGResourceById<RenderSVGResourceMarker>(document, markerMidId); - if (m_markerMid) + if (setMarkerMid(getRenderSVGResourceById<RenderSVGResourceMarker>(document, markerMidId))) foundResources = true; else - registerPendingResource(extensions, markerMidId, node); + registerPendingResource(extensions, markerMidId, element); AtomicString markerEndId(style->markerEndResource()); - m_markerEnd = getRenderSVGResourceById<RenderSVGResourceMarker>(document, markerEndId); - if (m_markerEnd) + if (setMarkerEnd(getRenderSVGResourceById<RenderSVGResourceMarker>(document, markerEndId))) foundResources = true; else - registerPendingResource(extensions, markerEndId, node); + registerPendingResource(extensions, markerEndId, element); } - if (style->hasFill()) { - bool hasPendingResource = false; - AtomicString id; - m_fill = paintingResourceFromSVGPaint(document, style->fillPaint(), id, hasPendingResource); - if (m_fill) - foundResources = true; - else if (hasPendingResource) - registerPendingResource(extensions, id, node); + if (fillAndStrokeTags().contains(tagNameImpl)) { + if (style->hasFill()) { + bool hasPendingResource = false; + AtomicString id; + if (setFill(paintingResourceFromSVGPaint(document, style->fillPaint(), id, hasPendingResource))) + foundResources = true; + else if (hasPendingResource) + registerPendingResource(extensions, id, element); + } + + if (style->hasStroke()) { + bool hasPendingResource = false; + AtomicString id; + if (setStroke(paintingResourceFromSVGPaint(document, style->strokePaint(), id, hasPendingResource))) + foundResources = true; + else if (hasPendingResource) + registerPendingResource(extensions, id, element); + } } - if (style->hasStroke()) { - bool hasPendingResource = false; - AtomicString id; - m_stroke = paintingResourceFromSVGPaint(document, style->strokePaint(), id, hasPendingResource); - if (m_stroke) + if (chainableResourceTags().contains(tagNameImpl)) { + AtomicString id(targetReferenceFromResource(element)); + if (setLinkedResource(getRenderSVGResourceContainerById(document, id))) foundResources = true; - else if (hasPendingResource) - registerPendingResource(extensions, id, node); + else + registerPendingResource(extensions, id, element); } return foundResources; @@ -166,81 +279,115 @@ bool SVGResources::buildCachedResources(const RenderObject* object, const SVGRen void SVGResources::invalidateClient(RenderObject* object) const { - // Ordinary resources - if (m_clipper) - m_clipper->invalidateClient(object); + if (!m_clipperFilterMaskerData && !m_markerData && !m_fillStrokeData && !m_linkedResource) + return; + + if (m_linkedResource) { + ASSERT(!m_clipperFilterMaskerData); + ASSERT(!m_markerData); + ASSERT(!m_fillStrokeData); + m_linkedResource->invalidateClient(object); + return; + } + + if (m_clipperFilterMaskerData) { + if (m_clipperFilterMaskerData->clipper) + m_clipperFilterMaskerData->clipper->invalidateClient(object); #if ENABLE(FILTERS) - if (m_filter) - m_filter->invalidateClient(object); + if (m_clipperFilterMaskerData->filter) + m_clipperFilterMaskerData->filter->invalidateClient(object); #endif - if (m_masker) - m_masker->invalidateClient(object); - if (m_markerStart) - m_markerStart->invalidateClient(object); - if (m_markerMid) - m_markerMid->invalidateClient(object); - if (m_markerEnd) - m_markerEnd->invalidateClient(object); - - // Paint servers - if (m_fill) - m_fill->invalidateClient(object); - if (m_stroke) - m_stroke->invalidateClient(object); + if (m_clipperFilterMaskerData->masker) + m_clipperFilterMaskerData->masker->invalidateClient(object); + } + + if (m_markerData) { + if (m_markerData->markerStart) + m_markerData->markerStart->invalidateClient(object); + if (m_markerData->markerMid) + m_markerData->markerMid->invalidateClient(object); + if (m_markerData->markerEnd) + m_markerData->markerEnd->invalidateClient(object); + } + + if (m_fillStrokeData) { + if (m_fillStrokeData->fill) + m_fillStrokeData->fill->invalidateClient(object); + if (m_fillStrokeData->stroke) + m_fillStrokeData->stroke->invalidateClient(object); + } } void SVGResources::resourceDestroyed(RenderSVGResourceContainer* resource) { ASSERT(resource); + if (!m_clipperFilterMaskerData && !m_markerData && !m_fillStrokeData && !m_linkedResource) + return; + + if (m_linkedResource == resource) { + ASSERT(!m_clipperFilterMaskerData); + ASSERT(!m_markerData); + ASSERT(!m_fillStrokeData); + m_linkedResource->invalidateClients(); + m_linkedResource = 0; + return; + } switch (resource->resourceType()) { case MaskerResourceType: - if (m_masker == resource) { - m_masker->invalidateClients(); - m_masker = 0; + if (!m_clipperFilterMaskerData) + break; + if (m_clipperFilterMaskerData->masker == resource) { + m_clipperFilterMaskerData->masker->invalidateClients(); + m_clipperFilterMaskerData->masker = 0; } break; case MarkerResourceType: - if (m_markerStart == resource) { - m_markerStart->invalidateClients(); - m_markerStart = 0; + if (!m_markerData) + break; + if (m_markerData->markerStart == resource) { + m_markerData->markerStart->invalidateClients(); + m_markerData->markerStart = 0; } - - if (m_markerMid == resource) { - m_markerMid->invalidateClients(); - m_markerMid = 0; + if (m_markerData->markerMid == resource) { + m_markerData->markerMid->invalidateClients(); + m_markerData->markerMid = 0; } - - if (m_markerEnd == resource) { - m_markerEnd->invalidateClients(); - m_markerEnd = 0; + if (m_markerData->markerEnd == resource) { + m_markerData->markerEnd->invalidateClients(); + m_markerData->markerEnd = 0; } break; case PatternResourceType: case LinearGradientResourceType: case RadialGradientResourceType: - if (m_fill == resource) { - m_fill->invalidateClients(); - m_fill = 0; + if (!m_fillStrokeData) + break; + if (m_fillStrokeData->fill == resource) { + m_fillStrokeData->fill->invalidateClients(); + m_fillStrokeData->fill = 0; } - - if (m_stroke == resource) { - m_stroke->invalidateClients(); - m_stroke = 0; + if (m_fillStrokeData->stroke == resource) { + m_fillStrokeData->stroke->invalidateClients(); + m_fillStrokeData->stroke = 0; } break; #if ENABLE(FILTERS) case FilterResourceType: - if (m_filter == resource) { - m_filter->invalidateClients(); - m_filter = 0; + if (!m_clipperFilterMaskerData) + break; + if (m_clipperFilterMaskerData->filter == resource) { + m_clipperFilterMaskerData->filter->invalidateClients(); + m_clipperFilterMaskerData->filter = 0; } break; #endif case ClipperResourceType: - if (m_clipper == resource) { - m_clipper->invalidateClients(); - m_clipper = 0; + if (!m_clipperFilterMaskerData) + break; + if (m_clipperFilterMaskerData->clipper == resource) { + m_clipperFilterMaskerData->clipper->invalidateClients(); + m_clipperFilterMaskerData->clipper = 0; } break; case SolidColorResourceType: @@ -250,77 +397,212 @@ void SVGResources::resourceDestroyed(RenderSVGResourceContainer* resource) void SVGResources::buildSetOfResources(HashSet<RenderSVGResourceContainer*>& set) { - // Ordinary resources - if (m_clipper) - set.add(m_clipper); + if (!m_clipperFilterMaskerData && !m_markerData && !m_fillStrokeData && !m_linkedResource) + return; + + if (m_linkedResource) { + ASSERT(!m_clipperFilterMaskerData); + ASSERT(!m_markerData); + ASSERT(!m_fillStrokeData); + set.add(m_linkedResource); + return; + } + + if (m_clipperFilterMaskerData) { + if (m_clipperFilterMaskerData->clipper) + set.add(m_clipperFilterMaskerData->clipper); #if ENABLE(FILTERS) - if (m_filter) - set.add(m_filter); + if (m_clipperFilterMaskerData->filter) + set.add(m_clipperFilterMaskerData->filter); #endif - if (m_markerStart) - set.add(m_markerStart); - if (m_markerMid) - set.add(m_markerMid); - if (m_markerEnd) - set.add(m_markerEnd); - if (m_masker) - set.add(m_masker); - - // Paint servers - if (m_fill) - set.add(m_fill); - if (m_stroke) - set.add(m_stroke); + if (m_clipperFilterMaskerData->masker) + set.add(m_clipperFilterMaskerData->masker); + } + + if (m_markerData) { + if (m_markerData->markerStart) + set.add(m_markerData->markerStart); + if (m_markerData->markerMid) + set.add(m_markerData->markerMid); + if (m_markerData->markerEnd) + set.add(m_markerData->markerEnd); + } + + if (m_fillStrokeData) { + if (m_fillStrokeData->fill) + set.add(m_fillStrokeData->fill); + if (m_fillStrokeData->stroke) + set.add(m_fillStrokeData->stroke); + } +} + +bool SVGResources::setClipper(RenderSVGResourceClipper* clipper) +{ + if (!clipper) + return false; + + if (!m_clipperFilterMaskerData) + m_clipperFilterMaskerData = ClipperFilterMaskerData::create(); + + m_clipperFilterMaskerData->clipper = clipper; + return true; } void SVGResources::resetClipper() { - ASSERT(m_clipper); - m_clipper = 0; + ASSERT(m_clipperFilterMaskerData); + ASSERT(m_clipperFilterMaskerData->clipper); + m_clipperFilterMaskerData->clipper = 0; } #if ENABLE(FILTERS) +bool SVGResources::setFilter(RenderSVGResourceFilter* filter) +{ + if (!filter) + return false; + + if (!m_clipperFilterMaskerData) + m_clipperFilterMaskerData = ClipperFilterMaskerData::create(); + + m_clipperFilterMaskerData->filter = filter; + return true; +} + void SVGResources::resetFilter() { - ASSERT(m_filter); - m_filter = 0; + ASSERT(m_clipperFilterMaskerData); + ASSERT(m_clipperFilterMaskerData->filter); + m_clipperFilterMaskerData->filter = 0; } #endif +bool SVGResources::setMarkerStart(RenderSVGResourceMarker* markerStart) +{ + if (!markerStart) + return false; + + if (!m_markerData) + m_markerData = MarkerData::create(); + + m_markerData->markerStart = markerStart; + return true; +} + void SVGResources::resetMarkerStart() { - ASSERT(m_markerStart); - m_markerStart = 0; + ASSERT(m_markerData); + ASSERT(m_markerData->markerStart); + m_markerData->markerStart = 0; +} + +bool SVGResources::setMarkerMid(RenderSVGResourceMarker* markerMid) +{ + if (!markerMid) + return false; + + if (!m_markerData) + m_markerData = MarkerData::create(); + + m_markerData->markerMid = markerMid; + return true; } void SVGResources::resetMarkerMid() { - ASSERT(m_markerMid); - m_markerMid = 0; + ASSERT(m_markerData); + ASSERT(m_markerData->markerMid); + m_markerData->markerMid = 0; +} + +bool SVGResources::setMarkerEnd(RenderSVGResourceMarker* markerEnd) +{ + if (!markerEnd) + return false; + + if (!m_markerData) + m_markerData = MarkerData::create(); + + m_markerData->markerEnd = markerEnd; + return true; } void SVGResources::resetMarkerEnd() { - ASSERT(m_markerEnd); - m_markerEnd = 0; + ASSERT(m_markerData); + ASSERT(m_markerData->markerEnd); + m_markerData->markerEnd = 0; +} + +bool SVGResources::setMasker(RenderSVGResourceMasker* masker) +{ + if (!masker) + return false; + + if (!m_clipperFilterMaskerData) + m_clipperFilterMaskerData = ClipperFilterMaskerData::create(); + + m_clipperFilterMaskerData->masker = masker; + return true; } void SVGResources::resetMasker() { - ASSERT(m_masker); - m_masker = 0; + ASSERT(m_clipperFilterMaskerData); + ASSERT(m_clipperFilterMaskerData->masker); + m_clipperFilterMaskerData->masker = 0; +} + +bool SVGResources::setFill(RenderSVGResourceContainer* fill) +{ + if (!fill) + return false; + + if (!m_fillStrokeData) + m_fillStrokeData = FillStrokeData::create(); + + m_fillStrokeData->fill = fill; + return true; } void SVGResources::resetFill() { - ASSERT(m_fill); - m_fill = 0; + ASSERT(m_fillStrokeData); + ASSERT(m_fillStrokeData->fill); + m_fillStrokeData->fill = 0; +} + +bool SVGResources::setStroke(RenderSVGResourceContainer* stroke) +{ + if (!stroke) + return false; + + if (!m_fillStrokeData) + m_fillStrokeData = FillStrokeData::create(); + + m_fillStrokeData->stroke = stroke; + return true; } void SVGResources::resetStroke() { - ASSERT(m_stroke); - m_stroke = 0; + ASSERT(m_fillStrokeData); + ASSERT(m_fillStrokeData->stroke); + m_fillStrokeData->stroke = 0; +} + +bool SVGResources::setLinkedResource(RenderSVGResourceContainer* linkedResource) +{ + if (!linkedResource) + return false; + + m_linkedResource = linkedResource; + return true; +} + +void SVGResources::resetLinkedResource() +{ + ASSERT(m_linkedResource); + m_linkedResource = 0; } #ifndef NDEBUG @@ -334,24 +616,35 @@ void SVGResources::dump(const RenderObject* object) object->node()->showTreeForThis(); fprintf(stderr, "\n | List of resources:\n"); - if (m_clipper) - fprintf(stderr, " |-> Clipper : %p (node=%p)\n", m_clipper, m_clipper->node()); + if (m_clipperFilterMaskerData) { + if (RenderSVGResourceClipper* clipper = m_clipperFilterMaskerData->clipper) + fprintf(stderr, " |-> Clipper : %p (node=%p)\n", clipper, clipper->node()); #if ENABLE(FILTERS) - if (m_filter) - fprintf(stderr, " |-> Filter : %p (node=%p)\n", m_filter, m_filter->node()); + if (RenderSVGResourceFilter* filter = m_clipperFilterMaskerData->filter) + fprintf(stderr, " |-> Filter : %p (node=%p)\n", filter, filter->node()); #endif - if (m_markerStart) - fprintf(stderr, " |-> MarkerStart: %p (node=%p)\n", m_markerStart, m_markerStart->node()); - if (m_markerMid) - fprintf(stderr, " |-> MarkerMid : %p (node=%p)\n", m_markerMid, m_markerMid->node()); - if (m_markerEnd) - fprintf(stderr, " |-> MarkerEnd : %p (node=%p)\n", m_markerEnd, m_markerEnd->node()); - if (m_masker) - fprintf(stderr, " |-> Masker : %p (node=%p)\n", m_masker, m_masker->node()); - if (m_fill) - fprintf(stderr, " |-> Fill : %p (node=%p)\n", m_fill, m_fill->node()); - if (m_stroke) - fprintf(stderr, " |-> Stroke : %p (node=%p)\n", m_stroke, m_stroke->node()); + if (RenderSVGResourceMasker* masker = m_clipperFilterMaskerData->masker) + fprintf(stderr, " |-> Masker : %p (node=%p)\n", masker, masker->node()); + } + + if (m_markerData) { + if (RenderSVGResourceMarker* markerStart = m_markerData->markerStart) + fprintf(stderr, " |-> MarkerStart: %p (node=%p)\n", markerStart, markerStart->node()); + if (RenderSVGResourceMarker* markerMid = m_markerData->markerMid) + fprintf(stderr, " |-> MarkerMid : %p (node=%p)\n", markerMid, markerMid->node()); + if (RenderSVGResourceMarker* markerEnd = m_markerData->markerEnd) + fprintf(stderr, " |-> MarkerEnd : %p (node=%p)\n", markerEnd, markerEnd->node()); + } + + if (m_fillStrokeData) { + if (RenderSVGResourceContainer* fill = m_fillStrokeData->fill) + fprintf(stderr, " |-> Fill : %p (node=%p)\n", fill, fill->node()); + if (RenderSVGResourceContainer* stroke = m_fillStrokeData->stroke) + fprintf(stderr, " |-> Stroke : %p (node=%p)\n", stroke, stroke->node()); + } + + if (m_linkedResource) + fprintf(stderr, " |-> xlink:href : %p (node=%p)\n", m_linkedResource, m_linkedResource->node()); } #endif diff --git a/WebCore/rendering/SVGResources.h b/WebCore/rendering/SVGResources.h index 57a4140..a07a990 100644 --- a/WebCore/rendering/SVGResources.h +++ b/WebCore/rendering/SVGResources.h @@ -23,6 +23,8 @@ #if ENABLE(SVG) #include <wtf/HashSet.h> #include <wtf/Noncopyable.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> namespace WebCore { @@ -43,18 +45,21 @@ public: bool buildCachedResources(const RenderObject*, const SVGRenderStyle*); // Ordinary resources - RenderSVGResourceClipper* clipper() const { return m_clipper; } + RenderSVGResourceClipper* clipper() const { return m_clipperFilterMaskerData ? m_clipperFilterMaskerData->clipper : 0; } #if ENABLE(FILTERS) - RenderSVGResourceFilter* filter() const { return m_filter; } + RenderSVGResourceFilter* filter() const { return m_clipperFilterMaskerData ? m_clipperFilterMaskerData->filter : 0; } #endif - RenderSVGResourceMarker* markerStart() const { return m_markerStart; } - RenderSVGResourceMarker* markerMid() const { return m_markerMid; } - RenderSVGResourceMarker* markerEnd() const { return m_markerEnd; } - RenderSVGResourceMasker* masker() const { return m_masker; } + RenderSVGResourceMarker* markerStart() const { return m_markerData ? m_markerData->markerStart : 0; } + RenderSVGResourceMarker* markerMid() const { return m_markerData ? m_markerData->markerMid : 0; } + RenderSVGResourceMarker* markerEnd() const { return m_markerData ? m_markerData->markerEnd : 0; } + RenderSVGResourceMasker* masker() const { return m_clipperFilterMaskerData ? m_clipperFilterMaskerData->masker : 0; } // Paint servers - RenderSVGResourceContainer* fill() const { return m_fill; } - RenderSVGResourceContainer* stroke() const { return m_stroke; } + RenderSVGResourceContainer* fill() const { return m_fillStrokeData ? m_fillStrokeData->fill : 0; } + RenderSVGResourceContainer* stroke() const { return m_fillStrokeData ? m_fillStrokeData->stroke : 0; } + + // Chainable resources - linked through xlink:href + RenderSVGResourceContainer* linkedResource() const { return m_linkedResource; } void buildSetOfResources(HashSet<RenderSVGResourceContainer*>&); @@ -80,21 +85,92 @@ private: void resetMasker(); void resetFill(); void resetStroke(); + void resetLinkedResource(); private: - // Ordinary resources - RenderSVGResourceClipper* m_clipper; + bool setClipper(RenderSVGResourceClipper*); +#if ENABLE(FILTERS) + bool setFilter(RenderSVGResourceFilter*); +#endif + bool setMarkerStart(RenderSVGResourceMarker*); + bool setMarkerMid(RenderSVGResourceMarker*); + bool setMarkerEnd(RenderSVGResourceMarker*); + bool setMasker(RenderSVGResourceMasker*); + bool setFill(RenderSVGResourceContainer*); + bool setStroke(RenderSVGResourceContainer*); + bool setLinkedResource(RenderSVGResourceContainer*); + + // From SVG 1.1 2nd Edition + // clipper: 'container elements' and 'graphics elements' + // filter: 'container elements' and 'graphics elements' + // masker: 'container elements' and 'graphics elements' + // -> a, circle, defs, ellipse, glyph, g, image, line, marker, mask, missing-glyph, path, pattern, polygon, polyline, rect, svg, switch, symbol, text, use + struct ClipperFilterMaskerData { + ClipperFilterMaskerData() + : clipper(0) #if ENABLE(FILTERS) - RenderSVGResourceFilter* m_filter; + , filter(0) #endif - RenderSVGResourceMarker* m_markerStart; - RenderSVGResourceMarker* m_markerMid; - RenderSVGResourceMarker* m_markerEnd; - RenderSVGResourceMasker* m_masker; + , masker(0) + { + } - // Paint servers - RenderSVGResourceContainer* m_fill; - RenderSVGResourceContainer* m_stroke; + static PassOwnPtr<ClipperFilterMaskerData> create() + { + return new ClipperFilterMaskerData; + } + + RenderSVGResourceClipper* clipper; +#if ENABLE(FILTERS) + RenderSVGResourceFilter* filter; +#endif + RenderSVGResourceMasker* masker; + }; + + // From SVG 1.1 2nd Edition + // marker: line, path, polygon, polyline + struct MarkerData { + MarkerData() + : markerStart(0) + , markerMid(0) + , markerEnd(0) + { + } + + static PassOwnPtr<MarkerData> create() + { + return new MarkerData; + } + + RenderSVGResourceMarker* markerStart; + RenderSVGResourceMarker* markerMid; + RenderSVGResourceMarker* markerEnd; + }; + + // From SVG 1.1 2nd Edition + // fill: 'shapes' and 'text content elements' + // stroke: 'shapes' and 'text content elements' + // -> altGlyph, circle, ellipse, line, path, polygon, polyline, rect, text, textPath, tref, tspan + struct FillStrokeData { + FillStrokeData() + : fill(0) + , stroke(0) + { + } + + static PassOwnPtr<FillStrokeData> create() + { + return new FillStrokeData; + } + + RenderSVGResourceContainer* fill; + RenderSVGResourceContainer* stroke; + }; + + OwnPtr<ClipperFilterMaskerData> m_clipperFilterMaskerData; + OwnPtr<MarkerData> m_markerData; + OwnPtr<FillStrokeData> m_fillStrokeData; + RenderSVGResourceContainer* m_linkedResource; }; } diff --git a/WebCore/rendering/SVGResourcesCache.cpp b/WebCore/rendering/SVGResourcesCache.cpp index 46586cc..b922b44 100644 --- a/WebCore/rendering/SVGResourcesCache.cpp +++ b/WebCore/rendering/SVGResourcesCache.cpp @@ -131,17 +131,7 @@ void SVGResourcesCache::clientStyleChanged(RenderObject* renderer, StyleDifferen return; clientUpdatedFromElement(renderer, newStyle); - - // Invalidate resources in ancestor chain, if needed. - RenderObject* parent = renderer->parent(); - while (parent) { - if (parent->isSVGResourceContainer()) { - parent->toRenderSVGResourceContainer()->invalidateClients(); - break; - } - - parent = parent->parent(); - } + RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer, false); } void SVGResourcesCache::clientUpdatedFromElement(RenderObject* renderer, const RenderStyle* newStyle) diff --git a/WebCore/rendering/SVGResourcesCycleSolver.cpp b/WebCore/rendering/SVGResourcesCycleSolver.cpp index e150144..ec2e036 100644 --- a/WebCore/rendering/SVGResourcesCycleSolver.cpp +++ b/WebCore/rendering/SVGResourcesCycleSolver.cpp @@ -94,6 +94,7 @@ bool SVGResourcesCycleSolver::resourceContainsCycles(RenderObject* renderer) con return false; } +<<<<<<< HEAD static inline String targetReferenceFromResource(SVGElement* element, bool& isValid) { String target; @@ -177,6 +178,8 @@ bool SVGResourcesCycleSolver::chainableResourceContainsCycles(RenderSVGResourceC return false; } +======= +>>>>>>> webkit.org at r64523 void SVGResourcesCycleSolver::resolveCycles() { ASSERT(m_allResources.isEmpty()); @@ -221,6 +224,10 @@ void SVGResourcesCycleSolver::resolveCycles() for (HashSet<RenderSVGResourceContainer*>::iterator it = parentResources.begin(); it != end; ++it) m_allResources.add(*it); + // If we're a resource, add ourselves to the HashSet. + if (m_renderer->isSVGResourceContainer()) + m_allResources.add(m_renderer->toRenderSVGResourceContainer()); + ASSERT(!m_allResources.isEmpty()); // The job of this function is to determine wheter any of the 'resources' associated with the given 'renderer' @@ -228,22 +235,6 @@ void SVGResourcesCycleSolver::resolveCycles() end = localResources.end(); for (HashSet<RenderSVGResourceContainer*>::iterator it = localResources.begin(); it != end; ++it) { RenderSVGResourceContainer* resource = *it; - - // Special handling for resources that can be chained using xlink:href - need to detect cycles as well! - switch (resource->resourceType()) { - case PatternResourceType: - case LinearGradientResourceType: - case RadialGradientResourceType: - case FilterResourceType: - if (chainableResourceContainsCycles(resource)) { - breakCycle(resource); - continue; - } - break; - default: - break; - } - if (parentResources.contains(resource) || resourceContainsCycles(resource)) breakCycle(resource); } @@ -259,6 +250,11 @@ void SVGResourcesCycleSolver::resolveCycles() void SVGResourcesCycleSolver::breakCycle(RenderSVGResourceContainer* resourceLeadingToCycle) { ASSERT(resourceLeadingToCycle); + if (resourceLeadingToCycle == m_resources->linkedResource()) { + m_resources->resetLinkedResource(); + return; + } + switch (resourceLeadingToCycle->resourceType()) { case MaskerResourceType: ASSERT(resourceLeadingToCycle == m_resources->masker()); diff --git a/WebCore/rendering/SVGResourcesCycleSolver.h b/WebCore/rendering/SVGResourcesCycleSolver.h index 1f49354..e63ee63 100644 --- a/WebCore/rendering/SVGResourcesCycleSolver.h +++ b/WebCore/rendering/SVGResourcesCycleSolver.h @@ -38,7 +38,6 @@ public: private: bool resourceContainsCycles(RenderObject*) const; - bool chainableResourceContainsCycles(RenderSVGResourceContainer*) const; void breakCycle(RenderSVGResourceContainer*); RenderObject* m_renderer; diff --git a/WebCore/rendering/style/SVGRenderStyle.cpp b/WebCore/rendering/style/SVGRenderStyle.cpp index 93e50cc..2a9003c 100644 --- a/WebCore/rendering/style/SVGRenderStyle.cpp +++ b/WebCore/rendering/style/SVGRenderStyle.cpp @@ -165,13 +165,14 @@ StyleDifference SVGRenderStyle::diff(const SVGRenderStyle* other) const // Some stroke properties, requires relayouts, as the cached stroke boundaries need to be recalculated. if (stroke != other->stroke) { if (stroke->width != other->stroke->width + || stroke->paint != other->stroke->paint || stroke->miterLimit != other->stroke->miterLimit || stroke->dashArray != other->stroke->dashArray || stroke->dashOffset != other->stroke->dashOffset) return StyleDifferenceLayout; - // Only these two cases remain, where we only need a repaint. - ASSERT(stroke->paint != other->stroke->paint || stroke->opacity != other->stroke->opacity); + // Only the stroke-opacity case remains, where we only need a repaint. + ASSERT(stroke->opacity != other->stroke->opacity); return StyleDifferenceRepaint; } diff --git a/WebCore/rendering/style/SVGRenderStyle.h b/WebCore/rendering/style/SVGRenderStyle.h index c87dd2b..c1d72e9 100644 --- a/WebCore/rendering/style/SVGRenderStyle.h +++ b/WebCore/rendering/style/SVGRenderStyle.h @@ -56,59 +56,237 @@ public: bool operator==(const SVGRenderStyle&) const; bool operator!=(const SVGRenderStyle& o) const { return !(*this == o); } - // SVG CSS Properties - SVG_RS_DEFINE_ATTRIBUTE(EAlignmentBaseline, AlignmentBaseline, alignmentBaseline, AB_AUTO) - SVG_RS_DEFINE_ATTRIBUTE(EDominantBaseline, DominantBaseline, dominantBaseline, DB_AUTO) - SVG_RS_DEFINE_ATTRIBUTE(EBaselineShift, BaselineShift, baselineShift, BS_BASELINE) - SVG_RS_DEFINE_ATTRIBUTE(EVectorEffect, VectorEffect, vectorEffect, VE_NONE) - - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(LineCap, CapStyle, capStyle, ButtCap) - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(WindRule, ClipRule, clipRule, RULE_NONZERO) - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EColorInterpolation, ColorInterpolation, colorInterpolation, CI_SRGB) - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EColorInterpolation, ColorInterpolationFilters, colorInterpolationFilters, CI_LINEARRGB) - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EColorRendering, ColorRendering, colorRendering, CR_AUTO) - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(WindRule, FillRule, fillRule, RULE_NONZERO) - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EImageRendering, ImageRendering, imageRendering, IR_AUTO) - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(LineJoin, JoinStyle, joinStyle, MiterJoin) - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EShapeRendering, ShapeRendering, shapeRendering, SR_AUTO) - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(ETextAnchor, TextAnchor, textAnchor, TA_START) - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EWritingMode, WritingMode, writingMode, WM_LRTB) - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EGlyphOrientation, GlyphOrientationHorizontal, glyphOrientationHorizontal, GO_0DEG) - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EGlyphOrientation, GlyphOrientationVertical, glyphOrientationVertical, GO_AUTO) - - // SVG CSS Properties (using DataRef's) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(float, fill, opacity, FillOpacity, fillOpacity, 1.0f) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(SVGPaint, fill, paint, FillPaint, fillPaint, SVGPaint::defaultFill()) - - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(float, stroke, opacity, StrokeOpacity, strokeOpacity, 1.0f) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(SVGPaint, stroke, paint, StrokePaint, strokePaint, SVGPaint::defaultStroke()) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(CSSValueList, stroke, dashArray, StrokeDashArray, strokeDashArray, 0) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(float, stroke, miterLimit, StrokeMiterLimit, strokeMiterLimit, 4.0f) + // Initial values for all the properties + static EAlignmentBaseline initialAlignmentBaseline() { return AB_AUTO; } + static EDominantBaseline initialDominantBaseline() { return DB_AUTO; } + static EBaselineShift initialBaselineShift() { return BS_BASELINE; } + static EVectorEffect initialVectorEffect() { return VE_NONE; } + static LineCap initialCapStyle() { return ButtCap; } + static WindRule initialClipRule() { return RULE_NONZERO; } + static EColorInterpolation initialColorInterpolation() { return CI_SRGB; } + static EColorInterpolation initialColorInterpolationFilters() { return CI_LINEARRGB; } + static EColorRendering initialColorRendering() { return CR_AUTO; } + static WindRule initialFillRule() { return RULE_NONZERO; } + static EImageRendering initialImageRendering() { return IR_AUTO; } + static LineJoin initialJoinStyle() { return MiterJoin; } + static EShapeRendering initialShapeRendering() { return SR_AUTO; } + static ETextAnchor initialTextAnchor() { return TA_START; } + static EWritingMode initialWritingMode() { return WM_LRTB; } + static EGlyphOrientation initialGlyphOrientationHorizontal() { return GO_0DEG; } + static EGlyphOrientation initialGlyphOrientationVertical() { return GO_AUTO; } + static float initialFillOpacity() { return 1.0f; } + static SVGPaint* initialFillPaint() { return SVGPaint::defaultFill(); } + static float initialStrokeOpacity() { return 1.0f; } + static SVGPaint* initialStrokePaint() { return SVGPaint::defaultStroke(); } + static CSSValueList* initialStrokeDashArray() { return 0; } + static float initialStrokeMiterLimit() { return 4.0f; } + static CSSValue* initialStrokeWidth() { return 0; } + static CSSValue* initialStrokeDashOffset() { return 0; }; + static CSSValue* initialKerning() { return 0; } + static float initialStopOpacity() { return 1.0f; } + static Color initialStopColor() { return Color(0, 0, 0); } + static float initialFloodOpacity() { return 1.0f; } + static Color initialFloodColor() { return Color(0, 0, 0); } + static Color initialLightingColor() { return Color(255, 255, 255); } + static CSSValue* initialBaselineShiftValue() { return 0; } + static ShadowData* initialShadow() { return 0; } + static String initialClipperResource() { return String(); } + static String initialFilterResource() { return String(); } + static String initialMaskerResource() { return String(); } + static String initialMarkerStartResource() { return String(); } + static String initialMarkerMidResource() { return String(); } + static String initialMarkerEndResource() { return String(); } + + // SVG CSS Property setters + void setAlignmentBaseline(EAlignmentBaseline val) { svg_noninherited_flags.f._alignmentBaseline = val; } + void setDominantBaseline(EDominantBaseline val) { svg_noninherited_flags.f._dominantBaseline = val; } + void setBaselineShift(EBaselineShift val) { svg_noninherited_flags.f._baselineShift = val; } + void setVectorEffect(EVectorEffect val) { svg_noninherited_flags.f._vectorEffect = val; } + void setCapStyle(LineCap val) { svg_inherited_flags._capStyle = val; } + void setClipRule(WindRule val) { svg_inherited_flags._clipRule = val; } + void setColorInterpolation(EColorInterpolation val) { svg_inherited_flags._colorInterpolation = val; } + void setColorInterpolationFilters(EColorInterpolation val) { svg_inherited_flags._colorInterpolationFilters = val; } + void setColorRendering(EColorRendering val) { svg_inherited_flags._colorRendering = val; } + void setFillRule(WindRule val) { svg_inherited_flags._fillRule = val; } + void setImageRendering(EImageRendering val) { svg_inherited_flags._imageRendering = val; } + void setJoinStyle(LineJoin val) { svg_inherited_flags._joinStyle = val; } + void setShapeRendering(EShapeRendering val) { svg_inherited_flags._shapeRendering = val; } + void setTextAnchor(ETextAnchor val) { svg_inherited_flags._textAnchor = val; } + void setWritingMode(EWritingMode val) { svg_inherited_flags._writingMode = val; } + void setGlyphOrientationHorizontal(EGlyphOrientation val) { svg_inherited_flags._glyphOrientationHorizontal = val; } + void setGlyphOrientationVertical(EGlyphOrientation val) { svg_inherited_flags._glyphOrientationVertical = val; } - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(CSSValue, stroke, width, StrokeWidth, strokeWidth, 0) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(CSSValue, stroke, dashOffset, StrokeDashOffset, strokeDashOffset, 0); + void setFillOpacity(float obj) + { + if (!(fill->opacity == obj)) + fill.access()->opacity = obj; + } + + void setFillPaint(PassRefPtr<SVGPaint> obj) + { + if (!(fill->paint == obj)) + fill.access()->paint = obj; + } + + void setStrokeOpacity(float obj) + { + if (!(stroke->opacity == obj)) + stroke.access()->opacity = obj; + } + + void setStrokePaint(PassRefPtr<SVGPaint> obj) + { + if (!(stroke->paint == obj)) + stroke.access()->paint = obj; + } + + void setStrokeDashArray(PassRefPtr<CSSValueList> obj) + { + if (!(stroke->dashArray == obj)) + stroke.access()->dashArray = obj; + } + + void setStrokeMiterLimit(float obj) + { + if (!(stroke->miterLimit == obj)) + stroke.access()->miterLimit = obj; + } - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(CSSValue, text, kerning, Kerning, kerning, 0) + void setStrokeWidth(PassRefPtr<CSSValue> obj) + { + if (!(stroke->width == obj)) + stroke.access()->width = obj; + } - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(float, stops, opacity, StopOpacity, stopOpacity, 1.0f) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(Color, stops, color, StopColor, stopColor, Color(0, 0, 0)) + void setStrokeDashOffset(PassRefPtr<CSSValue> obj) + { + if (!(stroke->dashOffset == obj)) + stroke.access()->dashOffset = obj; + } - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(float, misc, floodOpacity, FloodOpacity, floodOpacity, 1.0f) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(Color, misc, floodColor, FloodColor, floodColor, Color(0, 0, 0)) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(Color, misc, lightingColor, LightingColor, lightingColor, Color(255, 255, 255)) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(CSSValue, misc, baselineShiftValue, BaselineShiftValue, baselineShiftValue, 0) + void setKerning(PassRefPtr<CSSValue> obj) + { + if (!(text->kerning == obj)) + text.access()->kerning = obj; + } - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_OWNPTR(ShadowData, shadowSVG, shadow, Shadow, shadow, 0) + void setStopOpacity(float obj) + { + if (!(stops->opacity == obj)) + stops.access()->opacity = obj; + } - // Non-inherited resources - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, resources, clipper, ClipperResource, clipperResource, String()) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, resources, filter, FilterResource, filterResource, String()) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, resources, masker, MaskerResource, maskerResource, String()) + void setStopColor(Color obj) + { + if (!(stops->color == obj)) + stops.access()->color = obj; + } + + void setFloodOpacity(float obj) + { + if (!(misc->floodOpacity == obj)) + misc.access()->floodOpacity = obj; + } + + void setFloodColor(Color obj) + { + if (!(misc->floodColor == obj)) + misc.access()->floodColor = obj; + } + + void setLightingColor(Color obj) + { + if (!(misc->lightingColor == obj)) + misc.access()->lightingColor = obj; + } + + void setBaselineShiftValue(PassRefPtr<CSSValue> obj) + { + if (!(misc->baselineShiftValue == obj)) + misc.access()->baselineShiftValue = obj; + } + + void setShadow(PassOwnPtr<ShadowData> obj) { shadowSVG.access()->shadow = obj; + } + + // Setters for non-inherited resources + void setClipperResource(String obj) + { + if (!(resources->clipper == obj)) + resources.access()->clipper = obj; + } + + void setFilterResource(String obj) + { + if (!(resources->filter == obj)) + resources.access()->filter = obj; + } + + void setMaskerResource(String obj) + { + if (!(resources->masker == obj)) + resources.access()->masker = obj; + } + + // Setters for inherited resources + void setMarkerStartResource(String obj) + { + if (!(inheritedResources->markerStart == obj)) + inheritedResources.access()->markerStart = obj; + } + + void setMarkerMidResource(String obj) + { + if (!(inheritedResources->markerMid == obj)) + inheritedResources.access()->markerMid = obj; + } + + void setMarkerEndResource(String obj) + { + if (!(inheritedResources->markerEnd == obj)) + inheritedResources.access()->markerEnd = obj; + } - // Inherited resources - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, inheritedResources, markerStart, MarkerStartResource, markerStartResource, String()) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, inheritedResources, markerMid, MarkerMidResource, markerMidResource, String()) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, inheritedResources, markerEnd, MarkerEndResource, markerEndResource, String()) + // Read accessors for all the properties + EAlignmentBaseline alignmentBaseline() const { return (EAlignmentBaseline) svg_noninherited_flags.f._alignmentBaseline; } + EDominantBaseline dominantBaseline() const { return (EDominantBaseline) svg_noninherited_flags.f._dominantBaseline; } + EBaselineShift baselineShift() const { return (EBaselineShift) svg_noninherited_flags.f._baselineShift; } + EVectorEffect vectorEffect() const { return (EVectorEffect) svg_noninherited_flags.f._vectorEffect; } + LineCap capStyle() const { return (LineCap) svg_inherited_flags._capStyle; } + WindRule clipRule() const { return (WindRule) svg_inherited_flags._clipRule; } + EColorInterpolation colorInterpolation() const { return (EColorInterpolation) svg_inherited_flags._colorInterpolation; } + EColorInterpolation colorInterpolationFilters() const { return (EColorInterpolation) svg_inherited_flags._colorInterpolationFilters; } + EColorRendering colorRendering() const { return (EColorRendering) svg_inherited_flags._colorRendering; } + WindRule fillRule() const { return (WindRule) svg_inherited_flags._fillRule; } + EImageRendering imageRendering() const { return (EImageRendering) svg_inherited_flags._imageRendering; } + LineJoin joinStyle() const { return (LineJoin) svg_inherited_flags._joinStyle; } + EShapeRendering shapeRendering() const { return (EShapeRendering) svg_inherited_flags._shapeRendering; } + ETextAnchor textAnchor() const { return (ETextAnchor) svg_inherited_flags._textAnchor; } + EWritingMode writingMode() const { return (EWritingMode) svg_inherited_flags._writingMode; } + EGlyphOrientation glyphOrientationHorizontal() const { return (EGlyphOrientation) svg_inherited_flags._glyphOrientationHorizontal; } + EGlyphOrientation glyphOrientationVertical() const { return (EGlyphOrientation) svg_inherited_flags._glyphOrientationVertical; } + float fillOpacity() const { return fill->opacity; } + SVGPaint* fillPaint() const { return fill->paint.get(); } + float strokeOpacity() const { return stroke->opacity; } + SVGPaint* strokePaint() const { return stroke->paint.get(); } + CSSValueList* strokeDashArray() const { return stroke->dashArray.get(); } + float strokeMiterLimit() const { return stroke->miterLimit; } + CSSValue* strokeWidth() const { return stroke->width.get(); } + CSSValue* strokeDashOffset() const { return stroke->dashOffset.get(); } + CSSValue* kerning() const { return text->kerning.get(); } + float stopOpacity() const { return stops->opacity; } + Color stopColor() const { return stops->color; } + float floodOpacity() const { return misc->floodOpacity; } + Color floodColor() const { return misc->floodColor; } + Color lightingColor() const { return misc->lightingColor; } + CSSValue* baselineShiftValue() const { return misc->baselineShiftValue.get(); } + ShadowData* shadow() const { return shadowSVG->shadow.get(); } + String clipperResource() const { return resources->clipper; } + String filterResource() const { return resources->filter; } + String maskerResource() const { return resources->masker; } + String markerStartResource() const { return inheritedResources->markerStart; } + String markerMidResource() const { return inheritedResources->markerMid; } + String markerEndResource() const { return inheritedResources->markerEnd; } // convenience bool hasClipper() const { return !clipperResource().isEmpty(); } diff --git a/WebCore/rendering/style/SVGRenderStyleDefs.h b/WebCore/rendering/style/SVGRenderStyleDefs.h index 5173894..adb890c 100644 --- a/WebCore/rendering/style/SVGRenderStyleDefs.h +++ b/WebCore/rendering/style/SVGRenderStyleDefs.h @@ -38,46 +38,6 @@ #include <wtf/RefCounted.h> #include <wtf/RefPtr.h> -// Helper macros for 'SVGRenderStyle' -#define SVG_RS_DEFINE_ATTRIBUTE(Data, Type, Name, Initial) \ - void set##Type(Data val) { svg_noninherited_flags.f._##Name = val; } \ - Data Name() const { return (Data) svg_noninherited_flags.f._##Name; } \ - static Data initial##Type() { return Initial; } - -#define SVG_RS_DEFINE_ATTRIBUTE_INHERITED(Data, Type, Name, Initial) \ - void set##Type(Data val) { svg_inherited_flags._##Name = val; } \ - Data Name() const { return (Data) svg_inherited_flags._##Name; } \ - static Data initial##Type() { return Initial; } - -// "Helper" macros for SVG's RenderStyle properties -// FIXME: These are impossible to work with or debug. -#define SVG_RS_DEFINE_ATTRIBUTE_DATAREF(Data, Group, Variable, Type, Name) \ - Data Name() const { return Group->Variable; } \ - void set##Type(Data obj) { SVG_RS_SET_VARIABLE(Group, Variable, obj) } - -#define SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(Data, Group, Variable, Type, Name, Initial) \ - SVG_RS_DEFINE_ATTRIBUTE_DATAREF(Data, Group, Variable, Type, Name) \ - static Data initial##Type() { return Initial; } - -#define SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(Data, Group, Variable, Type, Name, Initial) \ - Data* Name() const { return Group->Variable.get(); } \ - void set##Type(PassRefPtr<Data> obj) { \ - if (!(Group->Variable == obj)) \ - Group.access()->Variable = obj; \ - } \ - static Data* initial##Type() { return Initial; } - -#define SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_OWNPTR(Data, Group, Variable, Type, Name, Initial) \ - Data* Name() const { return Group->Variable.get(); } \ - void set##Type(PassOwnPtr<Data> obj) { \ - Group.access()->Variable = obj; \ - } \ - static Data* initial##Type() { return Initial; } - -#define SVG_RS_SET_VARIABLE(Group, Variable, Value) \ - if (!(Group->Variable == Value)) \ - Group.access()->Variable = Value; - namespace WebCore { enum EBaselineShift { diff --git a/WebCore/storage/AbstractDatabase.cpp b/WebCore/storage/AbstractDatabase.cpp index bcc5d06..7827ec8 100644 --- a/WebCore/storage/AbstractDatabase.cpp +++ b/WebCore/storage/AbstractDatabase.cpp @@ -474,6 +474,17 @@ void AbstractDatabase::incrementalVacuumIfNeeded() m_sqliteDatabase.runIncrementalVacuumCommand(); } +void AbstractDatabase::interrupt() +{ + m_sqliteDatabase.interrupt(); +} + +bool AbstractDatabase::isInterrupted() +{ + MutexLocker locker(m_sqliteDatabase.databaseMutex()); + return m_sqliteDatabase.isInterrupted(); +} + } // namespace WebCore #endif // ENABLE(DATABASE) diff --git a/WebCore/storage/AbstractDatabase.h b/WebCore/storage/AbstractDatabase.h index e302909..3d8d363 100644 --- a/WebCore/storage/AbstractDatabase.h +++ b/WebCore/storage/AbstractDatabase.h @@ -68,6 +68,8 @@ public: unsigned long long maximumSize() const; void incrementalVacuumIfNeeded(); + void interrupt(); + bool isInterrupted(); // FIXME: move all version-related methods to a DatabaseVersionTracker class bool versionMatchesExpected() const; diff --git a/WebCore/storage/DOMFileSystem.cpp b/WebCore/storage/DOMFileSystem.cpp new file mode 100644 index 0000000..19c75fc --- /dev/null +++ b/WebCore/storage/DOMFileSystem.cpp @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2010 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. + */ + +#include "config.h" +#include "DOMFileSystem.h" + +#if ENABLE(FILE_SYSTEM) + +#include "Entry.h" + +namespace WebCore { + +DOMFileSystem::DOMFileSystem(const String& name, const String& rootPath) + : m_rootPath(rootPath) + , m_name(name) +{ +} + +PassRefPtr<Entry> DOMFileSystem::root() +{ + return Entry::create(this, "/"); +} + +} // namespace + +#endif // ENABLE(FILE_SYSTEM) diff --git a/WebCore/storage/DOMFileSystem.h b/WebCore/storage/DOMFileSystem.h new file mode 100644 index 0000000..454205d --- /dev/null +++ b/WebCore/storage/DOMFileSystem.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2010 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 DOMFileSystem_h +#define DOMFileSystem_h + +#if ENABLE(FILE_SYSTEM) + +#include "PlatformString.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace WebCore { + +class Entry; + +class DOMFileSystem : public RefCounted<DOMFileSystem> { +public: + static PassRefPtr<DOMFileSystem> create(const String& name, const String& rootPath) + { + return adoptRef(new DOMFileSystem(name, rootPath)); + } + + const String& name() const { return m_name; } + PassRefPtr<Entry> root(); + +private: + DOMFileSystem(const String& name, const String& rootPath); + + String m_rootPath; + String m_name; +}; + +} // namespace + +#endif // ENABLE(FILE_SYSTEM) + +#endif // DOMFileSystem_h diff --git a/WebCore/storage/DOMFileSystem.idl b/WebCore/storage/DOMFileSystem.idl new file mode 100644 index 0000000..0241c4a --- /dev/null +++ b/WebCore/storage/DOMFileSystem.idl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2010 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. + */ + +module storage { + interface [ + Conditional=FILE_SYSTEM + ] DOMFileSystem { + readonly attribute DOMString name; + readonly attribute Entry root; + }; +} diff --git a/WebCore/storage/DatabaseTracker.cpp b/WebCore/storage/DatabaseTracker.cpp index de38ec3..0764db0 100644 --- a/WebCore/storage/DatabaseTracker.cpp +++ b/WebCore/storage/DatabaseTracker.cpp @@ -235,6 +235,35 @@ void DatabaseTracker::databaseChanged(AbstractDatabase* database) originQuotaManager().markDatabase(database); } +void DatabaseTracker::interruptAllDatabasesForContext(const ScriptExecutionContext* context) +{ + Vector<RefPtr<AbstractDatabase> > openDatabases; + { + MutexLocker openDatabaseMapLock(m_openDatabaseMapGuard); + + if (!m_openDatabaseMap) + return; + + DatabaseNameMap* nameMap = m_openDatabaseMap->get(context->securityOrigin()); + if (!nameMap) + return; + + DatabaseNameMap::const_iterator dbNameMapEndIt = nameMap->end(); + for (DatabaseNameMap::const_iterator dbNameMapIt = nameMap->begin(); dbNameMapIt != dbNameMapEndIt; ++dbNameMapIt) { + DatabaseSet* databaseSet = dbNameMapIt->second; + DatabaseSet::const_iterator dbSetEndIt = databaseSet->end(); + for (DatabaseSet::const_iterator dbSetIt = databaseSet->begin(); dbSetIt != dbSetEndIt; ++dbSetIt) { + if ((*dbSetIt)->scriptExecutionContext() == context) + openDatabases.append(*dbSetIt); + } + } + } + + Vector<RefPtr<AbstractDatabase> >::const_iterator openDatabasesEndIt = openDatabases.end(); + for (Vector<RefPtr<AbstractDatabase> >::const_iterator openDatabasesIt = openDatabases.begin(); openDatabasesIt != openDatabasesEndIt; ++openDatabasesIt) + (*openDatabasesIt)->interrupt(); +} + String DatabaseTracker::originPath(SecurityOrigin* origin) const { return SQLiteFileSystem::appendDatabaseFileNameToPath(m_databaseDirectoryPath.threadsafeCopy(), origin->databaseIdentifier()); diff --git a/WebCore/storage/DatabaseTracker.h b/WebCore/storage/DatabaseTracker.h index 094ee66..1557f0a 100644 --- a/WebCore/storage/DatabaseTracker.h +++ b/WebCore/storage/DatabaseTracker.h @@ -78,6 +78,8 @@ public: unsigned long long getMaxSizeForDatabase(const AbstractDatabase*); void databaseChanged(AbstractDatabase*); + void interruptAllDatabasesForContext(const ScriptExecutionContext*); + private: DatabaseTracker(const String& databasePath); diff --git a/WebCore/storage/Entry.cpp b/WebCore/storage/Entry.cpp new file mode 100644 index 0000000..b882297 --- /dev/null +++ b/WebCore/storage/Entry.cpp @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2010 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. + */ +#include "config.h" +#include "Entry.h" + +#if ENABLE(FILE_SYSTEM) + +#include "DOMFileSystem.h" +#include "EntryCallback.h" +#include "ErrorCallback.h" +#include "MetadataCallback.h" +#include "VoidCallback.h" + +namespace WebCore { + +Entry::Entry(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath, bool isDirectory) + : m_fileSystem(fileSystem) + , m_fullPath(fullPath) + , m_isDirectory(isDirectory) +{ + int index = fullPath.reverseFind("/"); + if (index != -1) + m_name = fullPath.substring(index); + else + m_name = fullPath; +} + +void Entry::getMetadata(ScriptExecutionContext*, PassRefPtr<MetadataCallback>, PassRefPtr<ErrorCallback>) +{ + // FIXME: to be implemented. +} + +void Entry::moveTo(ScriptExecutionContext*, PassRefPtr<Entry>, const String&, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>) +{ + // FIXME: to be implemented. +} + +void Entry::copyTo(ScriptExecutionContext*, PassRefPtr<Entry>, const String&, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>) +{ + // FIXME: to be implemented. +} + +void Entry::remove(ScriptExecutionContext*, PassRefPtr<VoidCallback>, PassRefPtr<ErrorCallback>) +{ + // FIXME: to be implemented. +} + +void Entry::getParent(ScriptExecutionContext*, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>) +{ + // FIXME: to be implemented. +} + +String Entry::toURI(const String&) +{ + // FIXME: to be implemented. + return String(); +} + +} // namespace WebCore + +#endif // ENABLE(FILE_SYSTEM) diff --git a/WebCore/storage/Entry.h b/WebCore/storage/Entry.h new file mode 100644 index 0000000..1cabe58 --- /dev/null +++ b/WebCore/storage/Entry.h @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2010 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 Entry_h +#define Entry_h + +#if ENABLE(FILE_SYSTEM) + +#include "DOMFileSystem.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace WebCore { + +class EntryCallback; +class ErrorCallback; +class MetadataCallback; +class ScriptExecutionContext; +class VoidCallback; + +class Entry : public RefCounted<Entry> { +public: + static PassRefPtr<Entry> create(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath, bool isDirectory = false) + { + return adoptRef(new Entry(fileSystem, fullPath, isDirectory)); + } + + virtual ~Entry() { } + + virtual bool isFile() const { return !m_isDirectory; } + virtual bool isDirectory() const { return m_isDirectory; } + + const String& fullPath() const { return m_fullPath; } + const String& name() const { return m_name; } + + DOMFileSystem* filesystem() const { return m_fileSystem.get(); } + + virtual void getMetadata(ScriptExecutionContext*, PassRefPtr<MetadataCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0); + + virtual void moveTo(ScriptExecutionContext*, PassRefPtr<Entry> parent, const String& name = String(), PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0); + virtual void copyTo(ScriptExecutionContext*, PassRefPtr<Entry> parent, const String& name = String(), PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0); + virtual void remove(ScriptExecutionContext*, PassRefPtr<VoidCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0); + virtual void getParent(ScriptExecutionContext*, PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0); + + virtual String toURI(const String& mimeType = String()); + +protected: + Entry(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath, bool isDirectory); + + RefPtr<DOMFileSystem> m_fileSystem; + String m_fullPath; // virtual path + String m_name; + bool m_isDirectory; +}; + +} // namespace WebCore + +#endif // ENABLE(FILE_SYSTEM) + +#endif // Entry_h diff --git a/WebCore/storage/Entry.idl b/WebCore/storage/Entry.idl new file mode 100644 index 0000000..972751e --- /dev/null +++ b/WebCore/storage/Entry.idl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2010 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. + */ + +module storage { + interface [ + Conditional=FILE_SYSTEM + ] Entry { + readonly attribute boolean isFile; + readonly attribute boolean isDirectory; + readonly attribute DOMString name; + readonly attribute DOMString fullPath; + readonly attribute DOMFileSystem filesystem; + + [CallWith=ScriptExecutionContext] void moveTo(in Entry parent, in [Optional] DOMString name, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); + [CallWith=ScriptExecutionContext] void copyTo(in Entry parent, in [Optional] DOMString name, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); + DOMString toURI(in [Optional] DOMString mimeType); + [CallWith=ScriptExecutionContext] void remove(in [Optional, Callback] VoidCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); + [CallWith=ScriptExecutionContext] void getParent(in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); + }; +} diff --git a/WebCore/storage/EntryCallback.h b/WebCore/storage/EntryCallback.h new file mode 100644 index 0000000..58aa34a --- /dev/null +++ b/WebCore/storage/EntryCallback.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2010 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 EntryCallback_h +#define EntryCallback_h + +#if ENABLE(FILE_SYSTEM) + +#include <wtf/RefCounted.h> + +namespace WebCore { + +class Entry; +class ScriptExecutionContext; + +class EntryCallback : public RefCounted<EntryCallback> { +public: + virtual ~EntryCallback() { } + virtual bool handleEvent(ScriptExecutionContext*, Entry*) = 0; +}; + +} // namespace + +#endif // ENABLE(FILE_SYSTEM) + +#endif // EntryCallback_h diff --git a/WebCore/storage/EntryCallback.idl b/WebCore/storage/EntryCallback.idl new file mode 100644 index 0000000..bea3fd1 --- /dev/null +++ b/WebCore/storage/EntryCallback.idl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2010 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. + */ + +module storage { + interface [ + Conditional=FILE_SYSTEM, + Callback + ] EntryCallback { + boolean handleEvent(in Entry entry); + }; +} diff --git a/WebCore/storage/ErrorCallback.h b/WebCore/storage/ErrorCallback.h new file mode 100644 index 0000000..8cddbc7 --- /dev/null +++ b/WebCore/storage/ErrorCallback.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2010 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 ErrorCallback_h +#define ErrorCallback_h + +#if ENABLE(FILE_SYSTEM) + +#include <wtf/RefCounted.h> + +namespace WebCore { + +class FileError; +class ScriptExecutionContext; + +class ErrorCallback : public RefCounted<ErrorCallback> { +public: + virtual ~ErrorCallback() { } + virtual bool handleEvent(ScriptExecutionContext*, FileError*) = 0; +}; + +} // namespace + +#endif // ENABLE(FILE_SYSTEM) + +#endif // ErrorCallback_h diff --git a/WebCore/storage/ErrorCallback.idl b/WebCore/storage/ErrorCallback.idl new file mode 100644 index 0000000..fc7fa85 --- /dev/null +++ b/WebCore/storage/ErrorCallback.idl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2010 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. + */ + +module storage { + interface [ + Conditional=FILE_SYSTEM, + Callback + ] ErrorCallback { + boolean handleEvent(in FileError error); + }; +} diff --git a/WebCore/storage/FileSystemCallback.h b/WebCore/storage/FileSystemCallback.h new file mode 100644 index 0000000..a3bf34d --- /dev/null +++ b/WebCore/storage/FileSystemCallback.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2010 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 FileSystemCallback_h +#define FileSystemCallback_h + +#if ENABLE(FILE_SYSTEM) + +#include <wtf/RefCounted.h> + +namespace WebCore { + +class DOMFileSystem; +class ScriptExecutionContext; + +class FileSystemCallback : public RefCounted<FileSystemCallback> { +public: + virtual ~FileSystemCallback() { } + virtual bool handleEvent(ScriptExecutionContext*, DOMFileSystem*) = 0; +}; + +} // namespace + +#endif // ENABLE(FILE_SYSTEM) + +#endif // FileSystemCallback_h diff --git a/WebCore/storage/FileSystemCallback.idl b/WebCore/storage/FileSystemCallback.idl new file mode 100644 index 0000000..cf686ff --- /dev/null +++ b/WebCore/storage/FileSystemCallback.idl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2010 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. + */ + +module storage { + interface [ + Conditional=FILE_SYSTEM, + Callback + ] FileSystemCallback { + boolean handleEvent(in DOMFileSystem fileSystem); + }; +} diff --git a/WebCore/storage/Flags.h b/WebCore/storage/Flags.h new file mode 100644 index 0000000..ffe3403 --- /dev/null +++ b/WebCore/storage/Flags.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2010 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 Flags_h +#define Flags_h + +#if ENABLE(FILE_SYSTEM) + +#include <wtf/RefCounted.h> + +namespace WebCore { + +class Flags : public RefCounted<Flags> { +public: + static PassRefPtr<Flags> create(bool create = false, bool exclusive = false) + { + return adoptRef(new Flags(create, exclusive)); + } + + bool isCreate() const { return m_create; } + void setCreate(bool create) { m_create = create; } + bool isExclusive() const { return m_exclusive; } + void setExclusive(bool exclusive) { m_exclusive = exclusive; } + +private: + Flags(bool create, bool exclusive) + : m_create(create) + , m_exclusive(exclusive) + { + } + bool m_create; + bool m_exclusive; +}; + +} // namespace + +#endif // ENABLE(FILE_SYSTEM) + +#endif // Flags_h diff --git a/WebCore/storage/Flags.idl b/WebCore/storage/Flags.idl new file mode 100644 index 0000000..cfe73d2 --- /dev/null +++ b/WebCore/storage/Flags.idl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2010 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. + */ + +module storage { + interface [ + Conditional=FILE_SYSTEM + ] Flags { + attribute boolean CREATE; + attribute boolean EXCLUSIVE; + }; +} diff --git a/WebCore/storage/IDBAny.cpp b/WebCore/storage/IDBAny.cpp index 9a18980..da0cb22 100644 --- a/WebCore/storage/IDBAny.cpp +++ b/WebCore/storage/IDBAny.cpp @@ -29,9 +29,9 @@ #if ENABLE(INDEXED_DATABASE) #include "IDBDatabaseRequest.h" -#include "IDBIndexRequest.h" +#include "IDBFactory.h" +#include "IDBIndex.h" #include "IDBObjectStoreRequest.h" -#include "IndexedDatabaseRequest.h" #include "SerializedScriptValue.h" namespace WebCore { @@ -56,10 +56,10 @@ PassRefPtr<IDBDatabaseRequest> IDBAny::idbDatabaseRequest() return m_idbDatabaseRequest; } -PassRefPtr<IDBIndexRequest> IDBAny::idbIndexRequest() +PassRefPtr<IDBIndex> IDBAny::idbIndex() { - ASSERT(m_type == IDBIndexRequestType); - return m_idbIndexRequest; + ASSERT(m_type == IDBIndexType); + return m_idbIndex; } PassRefPtr<IDBKey> IDBAny::idbKey() @@ -74,10 +74,10 @@ PassRefPtr<IDBObjectStoreRequest> IDBAny::idbObjectStoreRequest() return m_idbObjectStoreRequest; } -PassRefPtr<IndexedDatabaseRequest> IDBAny::indexedDatabaseRequest() +PassRefPtr<IDBFactory> IDBAny::idbFactory() { - ASSERT(m_type == IndexedDatabaseRequestType); - return m_indexedDatabaseRequest; + ASSERT(m_type == IDBFactoryType); + return m_idbFactory; } PassRefPtr<SerializedScriptValue> IDBAny::serializedScriptValue() @@ -99,11 +99,11 @@ void IDBAny::set(PassRefPtr<IDBDatabaseRequest> value) m_idbDatabaseRequest = value; } -void IDBAny::set(PassRefPtr<IDBIndexRequest> value) +void IDBAny::set(PassRefPtr<IDBIndex> value) { ASSERT(m_type == UndefinedType); m_type = IDBDatabaseRequestType; - m_idbIndexRequest = value; + m_idbIndex = value; } void IDBAny::set(PassRefPtr<IDBKey> value) @@ -120,11 +120,11 @@ void IDBAny::set(PassRefPtr<IDBObjectStoreRequest> value) m_idbObjectStoreRequest = value; } -void IDBAny::set(PassRefPtr<IndexedDatabaseRequest> value) +void IDBAny::set(PassRefPtr<IDBFactory> value) { ASSERT(m_type == UndefinedType); - m_type = IndexedDatabaseRequestType; - m_indexedDatabaseRequest = value; + m_type = IDBFactoryType; + m_idbFactory = value; } void IDBAny::set(PassRefPtr<SerializedScriptValue> value) diff --git a/WebCore/storage/IDBAny.h b/WebCore/storage/IDBAny.h index 77bba7c..a7859a1 100644 --- a/WebCore/storage/IDBAny.h +++ b/WebCore/storage/IDBAny.h @@ -35,10 +35,10 @@ namespace WebCore { class IDBDatabaseRequest; -class IDBIndexRequest; +class IDBIndex; class IDBKey; class IDBObjectStoreRequest; -class IndexedDatabaseRequest; +class IDBFactory; class SerializedScriptValue; class IDBAny : public RefCounted<IDBAny> { @@ -57,29 +57,29 @@ public: UndefinedType = 0, NullType, IDBDatabaseRequestType, - IDBIndexRequestType, + IDBFactoryType, + IDBIndexType, IDBKeyType, IDBObjectStoreRequestType, - IndexedDatabaseRequestType, SerializedScriptValueType }; Type type() const { return m_type; } // Use type() to figure out which one of these you're allowed to call. PassRefPtr<IDBDatabaseRequest> idbDatabaseRequest(); - PassRefPtr<IDBIndexRequest> idbIndexRequest(); + PassRefPtr<IDBFactory> idbFactory(); + PassRefPtr<IDBIndex> idbIndex(); PassRefPtr<IDBKey> idbKey(); PassRefPtr<IDBObjectStoreRequest> idbObjectStoreRequest(); - PassRefPtr<IndexedDatabaseRequest> indexedDatabaseRequest(); PassRefPtr<SerializedScriptValue> serializedScriptValue(); // Set can only be called once. void set(); // For "null". void set(PassRefPtr<IDBDatabaseRequest>); - void set(PassRefPtr<IDBIndexRequest>); + void set(PassRefPtr<IDBFactory>); + void set(PassRefPtr<IDBIndex>); void set(PassRefPtr<IDBKey>); void set(PassRefPtr<IDBObjectStoreRequest>); - void set(PassRefPtr<IndexedDatabaseRequest>); void set(PassRefPtr<SerializedScriptValue>); private: @@ -89,10 +89,10 @@ private: // Only one of the following should ever be in use at any given time. RefPtr<IDBDatabaseRequest> m_idbDatabaseRequest; - RefPtr<IDBIndexRequest> m_idbIndexRequest; + RefPtr<IDBFactory> m_idbFactory; + RefPtr<IDBIndex> m_idbIndex; RefPtr<IDBKey> m_idbKey; RefPtr<IDBObjectStoreRequest> m_idbObjectStoreRequest; - RefPtr<IndexedDatabaseRequest> m_indexedDatabaseRequest; RefPtr<SerializedScriptValue> m_serializedScriptValue; }; diff --git a/WebCore/storage/IDBCallbacks.h b/WebCore/storage/IDBCallbacks.h index 37fdc46..d79cdec 100644 --- a/WebCore/storage/IDBCallbacks.h +++ b/WebCore/storage/IDBCallbacks.h @@ -31,7 +31,7 @@ #include "IDBDatabase.h" #include "IDBDatabaseError.h" -#include "IDBIndex.h" +#include "IDBIndexBackendInterface.h" #include "IDBKey.h" #include "IDBObjectStore.h" #include "SerializedScriptValue.h" @@ -48,7 +48,7 @@ public: virtual void onError(PassRefPtr<IDBDatabaseError>) = 0; virtual void onSuccess() = 0; // For "null". virtual void onSuccess(PassRefPtr<IDBDatabase>) = 0; - virtual void onSuccess(PassRefPtr<IDBIndex>) = 0; + virtual void onSuccess(PassRefPtr<IDBIndexBackendInterface>) = 0; virtual void onSuccess(PassRefPtr<IDBKey>) = 0; virtual void onSuccess(PassRefPtr<IDBObjectStore>) = 0; virtual void onSuccess(PassRefPtr<SerializedScriptValue>) = 0; diff --git a/WebCore/storage/IDBDatabaseRequest.cpp b/WebCore/storage/IDBDatabaseRequest.cpp index fce2671..8a40e9e 100644 --- a/WebCore/storage/IDBDatabaseRequest.cpp +++ b/WebCore/storage/IDBDatabaseRequest.cpp @@ -27,9 +27,9 @@ #include "IDBDatabaseRequest.h" #include "IDBAny.h" +#include "IDBFactoryBackendInterface.h" #include "IDBObjectStoreRequest.h" #include "IDBRequest.h" -#include "IndexedDatabase.h" #include "ScriptExecutionContext.h" #if ENABLE(INDEXED_DATABASE) diff --git a/WebCore/storage/IndexedDatabaseRequest.cpp b/WebCore/storage/IDBFactory.cpp index c1c5515..d3a83a5 100644 --- a/WebCore/storage/IndexedDatabaseRequest.cpp +++ b/WebCore/storage/IDBFactory.cpp @@ -27,32 +27,33 @@ */ #include "config.h" -#include "IndexedDatabaseRequest.h" +#include "IDBFactory.h" +#include "DOMStringList.h" #include "Document.h" #include "ExceptionCode.h" #include "Frame.h" #include "IDBDatabase.h" +#include "IDBFactoryBackendInterface.h" #include "IDBKeyRange.h" #include "IDBRequest.h" -#include "IndexedDatabase.h" #if ENABLE(INDEXED_DATABASE) namespace WebCore { -IndexedDatabaseRequest::IndexedDatabaseRequest(IndexedDatabase* indexedDatabase) - : m_indexedDatabase(indexedDatabase) +IDBFactory::IDBFactory(IDBFactoryBackendInterface* factory) + : m_factoryBackend(factory) { // We pass a reference to this object before it can be adopted. relaxAdoptionRequirement(); } -IndexedDatabaseRequest::~IndexedDatabaseRequest() +IDBFactory::~IDBFactory() { } -PassRefPtr<IDBRequest> IndexedDatabaseRequest::open(ScriptExecutionContext* context, const String& name, const String& description) +PassRefPtr<IDBRequest> IDBFactory::open(ScriptExecutionContext* context, const String& name, const String& description) { if (!context->isDocument()) { // FIXME: make this work with workers. @@ -64,7 +65,7 @@ PassRefPtr<IDBRequest> IndexedDatabaseRequest::open(ScriptExecutionContext* cont return 0; RefPtr<IDBRequest> request = IDBRequest::create(document, IDBAny::create(this)); - m_indexedDatabase->open(name, description, request, document->securityOrigin(), document->frame()); + m_factoryBackend->open(name, description, request, document->securityOrigin(), document->frame()); return request; } diff --git a/WebCore/storage/IndexedDatabaseRequest.h b/WebCore/storage/IDBFactory.h index 57f8a78..61619b9 100644 --- a/WebCore/storage/IndexedDatabaseRequest.h +++ b/WebCore/storage/IDBFactory.h @@ -25,11 +25,12 @@ * (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 IndexedDatabaseRequest_h -#define IndexedDatabaseRequest_h +#ifndef IDBFactory_h +#define IDBFactory_h +#include "DOMStringList.h" #include "ExceptionCode.h" -#include "IndexedDatabase.h" +#include "IDBFactoryBackendInterface.h" #include "PlatformString.h" #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> @@ -42,28 +43,28 @@ namespace WebCore { class IDBKey; class IDBKeyRange; class IDBRequest; -class IndexedDatabase; +class IDBFactoryBackendInterface; class ScriptExecutionContext; -class IndexedDatabaseRequest : public RefCounted<IndexedDatabaseRequest> { +class IDBFactory : public RefCounted<IDBFactory> { public: - static PassRefPtr<IndexedDatabaseRequest> create(IndexedDatabase* indexedDatabase) + static PassRefPtr<IDBFactory> create(IDBFactoryBackendInterface* factory) { - return adoptRef(new IndexedDatabaseRequest(indexedDatabase)); + return adoptRef(new IDBFactory(factory)); } - ~IndexedDatabaseRequest(); + ~IDBFactory(); PassRefPtr<IDBRequest> open(ScriptExecutionContext*, const String& name, const String& description); private: - IndexedDatabaseRequest(IndexedDatabase*); + IDBFactory(IDBFactoryBackendInterface*); - RefPtr<IndexedDatabase> m_indexedDatabase; + RefPtr<IDBFactoryBackendInterface> m_factoryBackend; }; } // namespace WebCore #endif -#endif // IndexedDatabaseRequest_h +#endif // IDBFactory_h diff --git a/WebCore/storage/IndexedDatabaseRequest.idl b/WebCore/storage/IDBFactory.idl index e6ee446..cd887f0 100644 --- a/WebCore/storage/IndexedDatabaseRequest.idl +++ b/WebCore/storage/IDBFactory.idl @@ -27,7 +27,7 @@ module storage { interface [ Conditional=INDEXED_DATABASE - ] IndexedDatabaseRequest { + ] IDBFactory { [CallWith=ScriptExecutionContext] IDBRequest open(in DOMString name, in DOMString description); }; diff --git a/WebCore/storage/IndexedDatabaseImpl.cpp b/WebCore/storage/IDBFactoryBackendImpl.cpp index e6af901..e965c3f 100644 --- a/WebCore/storage/IndexedDatabaseImpl.cpp +++ b/WebCore/storage/IDBFactoryBackendImpl.cpp @@ -27,8 +27,9 @@ */ #include "config.h" -#include "IndexedDatabaseImpl.h" +#include "IDBFactoryBackendImpl.h" +#include "DOMStringList.h" #include "IDBDatabaseImpl.h" #include "SecurityOrigin.h" #include <wtf/Threading.h> @@ -38,20 +39,20 @@ namespace WebCore { -PassRefPtr<IndexedDatabaseImpl> IndexedDatabaseImpl::create() +PassRefPtr<IDBFactoryBackendImpl> IDBFactoryBackendImpl::create() { - return adoptRef(new IndexedDatabaseImpl); + return adoptRef(new IDBFactoryBackendImpl); } -IndexedDatabaseImpl::IndexedDatabaseImpl() +IDBFactoryBackendImpl::IDBFactoryBackendImpl() { } -IndexedDatabaseImpl::~IndexedDatabaseImpl() +IDBFactoryBackendImpl::~IDBFactoryBackendImpl() { } -void IndexedDatabaseImpl::open(const String& name, const String& description, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin>, Frame*) +void IDBFactoryBackendImpl::open(const String& name, const String& description, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin>, Frame*) { RefPtr<IDBDatabase> database; IDBDatabaseMap::iterator it = m_databaseMap.find(name); diff --git a/WebCore/storage/IndexedDatabaseImpl.h b/WebCore/storage/IDBFactoryBackendImpl.h index b9520ee..bb28b6d 100644 --- a/WebCore/storage/IndexedDatabaseImpl.h +++ b/WebCore/storage/IDBFactoryBackendImpl.h @@ -25,10 +25,10 @@ * (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 IndexedDatabaseImpl_h -#define IndexedDatabaseImpl_h +#ifndef IDBFactoryBackendImpl_h +#define IDBFactoryBackendImpl_h -#include "IndexedDatabase.h" +#include "IDBFactoryBackendInterface.h" #include "StringHash.h" #include <wtf/HashMap.h> @@ -36,26 +36,28 @@ namespace WebCore { -class IndexedDatabaseImpl : public IndexedDatabase { +class DOMStringList; + +class IDBFactoryBackendImpl : public IDBFactoryBackendInterface { public: - static PassRefPtr<IndexedDatabaseImpl> create(); - virtual ~IndexedDatabaseImpl(); + static PassRefPtr<IDBFactoryBackendImpl> create(); + virtual ~IDBFactoryBackendImpl(); virtual void open(const String& name, const String& description, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*); private: - IndexedDatabaseImpl(); + IDBFactoryBackendImpl(); typedef HashMap<String, RefPtr<IDBDatabase> > IDBDatabaseMap; IDBDatabaseMap m_databaseMap; // We only create one instance of this class at a time. - static IndexedDatabaseImpl* indexedDatabaseImpl; + static IDBFactoryBackendImpl* idbFactoryBackendImpl; }; } // namespace WebCore #endif -#endif // IndexedDatabaseImpl_h +#endif // IDBFactoryBackendImpl_h diff --git a/WebCore/storage/IndexedDatabase.cpp b/WebCore/storage/IDBFactoryBackendInterface.cpp index a20974b..f1c0fb7 100644 --- a/WebCore/storage/IndexedDatabase.cpp +++ b/WebCore/storage/IDBFactoryBackendInterface.cpp @@ -26,9 +26,9 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" -#include "IndexedDatabase.h" +#include "IDBFactoryBackendInterface.h" -#include "IndexedDatabaseImpl.h" +#include "IDBFactoryBackendImpl.h" #if PLATFORM(CHROMIUM) #error "Chromium should not compile this file and instead define its own version of this factory that navigates the multi-process boundry." @@ -38,9 +38,9 @@ namespace WebCore { -PassRefPtr<IndexedDatabase> IndexedDatabase::create() +PassRefPtr<IDBFactoryBackendInterface> IDBFactoryBackendInterface::create() { - return IndexedDatabaseImpl::create(); + return IDBFactoryBackendImpl::create(); } } // namespace WebCore diff --git a/WebCore/storage/IndexedDatabase.h b/WebCore/storage/IDBFactoryBackendInterface.h index e6abf4a..ba18098 100644 --- a/WebCore/storage/IndexedDatabase.h +++ b/WebCore/storage/IDBFactoryBackendInterface.h @@ -25,8 +25,8 @@ * (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 IndexedDatabase_h -#define IndexedDatabase_h +#ifndef IDBFactoryBackendInterface_h +#define IDBFactoryBackendInterface_h #include "ExceptionCode.h" #include "IDBCallbacks.h" @@ -41,14 +41,14 @@ class Frame; class IDBDatabase; class SecurityOrigin; -// This class is shared by IndexedDatabaseRequest (async) and IndexedDatabaseSync (sync). -// This is implemented by IndexedDatabaseImpl and optionally others (in order to proxy +// This class is shared by IDBFactory (async) and IDBFactorySync (sync). +// This is implemented by IDBFactoryBackendImpl and optionally others (in order to proxy // calls across process barriers). All calls to these classes should be non-blocking and // trigger work on a background thread if necessary. -class IndexedDatabase : public ThreadSafeShared<IndexedDatabase> { +class IDBFactoryBackendInterface : public ThreadSafeShared<IDBFactoryBackendInterface> { public: - static PassRefPtr<IndexedDatabase> create(); - virtual ~IndexedDatabase() { } + static PassRefPtr<IDBFactoryBackendInterface> create(); + virtual ~IDBFactoryBackendInterface() { } virtual void open(const String& name, const String& description, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*) = 0; }; @@ -57,5 +57,5 @@ public: #endif -#endif // IndexedDatabase_h +#endif // IDBFactoryBackendInterface_h diff --git a/WebCore/storage/IDBIndexRequest.cpp b/WebCore/storage/IDBIndex.cpp index 30aee4b..62c1da8 100644 --- a/WebCore/storage/IDBIndexRequest.cpp +++ b/WebCore/storage/IDBIndex.cpp @@ -24,18 +24,18 @@ */ #include "config.h" -#include "IDBIndexRequest.h" +#include "IDBIndex.h" #if ENABLE(INDEXED_DATABASE) namespace WebCore { -IDBIndexRequest::IDBIndexRequest(PassRefPtr<IDBIndex> idbIndex) - : m_idbIndex(idbIndex) +IDBIndex::IDBIndex(PassRefPtr<IDBIndexBackendInterface> backend) + : m_backend(backend) { } -IDBIndexRequest::~IDBIndexRequest() +IDBIndex::~IDBIndex() { } diff --git a/WebCore/storage/IDBIndex.h b/WebCore/storage/IDBIndex.h index d0e8cab..5e716b7 100644 --- a/WebCore/storage/IDBIndex.h +++ b/WebCore/storage/IDBIndex.h @@ -26,21 +26,31 @@ #ifndef IDBIndex_h #define IDBIndex_h +#include "IDBIndexBackendInterface.h" #include "PlatformString.h" -#include <wtf/PassRefPtr.h> -#include <wtf/Threading.h> +#include <wtf/Forward.h> #if ENABLE(INDEXED_DATABASE) namespace WebCore { -class IDBIndex : public ThreadSafeShared<IDBIndex> { +class IDBIndex : public RefCounted<IDBIndex> { public: - virtual ~IDBIndex() { } + static PassRefPtr<IDBIndex> create(PassRefPtr<IDBIndexBackendInterface> backend) + { + return adoptRef(new IDBIndex(backend)); + } + ~IDBIndex(); - virtual String name() = 0; - virtual String keyPath() = 0; - virtual bool unique() = 0; + // Implement the IDL + String name() const { return m_backend->name(); } + String keyPath() const { return m_backend->keyPath(); } + bool unique() const { return m_backend->unique(); } + +private: + IDBIndex(PassRefPtr<IDBIndexBackendInterface>); + + RefPtr<IDBIndexBackendInterface> m_backend; }; } // namespace WebCore diff --git a/WebCore/storage/IDBIndexRequest.idl b/WebCore/storage/IDBIndex.idl index ad35f52..e796b03 100644 --- a/WebCore/storage/IDBIndexRequest.idl +++ b/WebCore/storage/IDBIndex.idl @@ -27,7 +27,7 @@ module storage { interface [ Conditional=INDEXED_DATABASE - ] IDBIndexRequest { + ] IDBIndex { // FIXME: Complete this file. readonly attribute DOMString name; diff --git a/WebCore/storage/IDBIndexImpl.cpp b/WebCore/storage/IDBIndexBackendImpl.cpp index f78939a..406e37f 100644 --- a/WebCore/storage/IDBIndexImpl.cpp +++ b/WebCore/storage/IDBIndexBackendImpl.cpp @@ -24,20 +24,20 @@ */ #include "config.h" -#include "IDBIndexImpl.h" +#include "IDBIndexBackendImpl.h" #if ENABLE(INDEXED_DATABASE) namespace WebCore { -IDBIndexImpl::IDBIndexImpl(const String& name, const String& keyPath, bool unique) +IDBIndexBackendImpl::IDBIndexBackendImpl(const String& name, const String& keyPath, bool unique) : m_name(name) , m_keyPath(keyPath) , m_unique(unique) { } -IDBIndexImpl::~IDBIndexImpl() +IDBIndexBackendImpl::~IDBIndexBackendImpl() { } diff --git a/WebCore/storage/IDBIndexImpl.h b/WebCore/storage/IDBIndexBackendImpl.h index b0034d5..ca3f01e 100644 --- a/WebCore/storage/IDBIndexImpl.h +++ b/WebCore/storage/IDBIndexBackendImpl.h @@ -23,30 +23,30 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef IDBIndexImpl_h -#define IDBIndexImpl_h +#ifndef IDBIndexBackendImpl_h +#define IDBIndexBackendImpl_h -#include "IDBIndex.h" +#include "IDBIndexBackendInterface.h" #if ENABLE(INDEXED_DATABASE) namespace WebCore { -class IDBIndexImpl : public IDBIndex { +class IDBIndexBackendImpl : public IDBIndexBackendInterface { public: - static PassRefPtr<IDBIndex> create(const String& name, const String& keyPath, bool unique) + static PassRefPtr<IDBIndexBackendImpl> create(const String& name, const String& keyPath, bool unique) { - return adoptRef(new IDBIndexImpl(name, keyPath, unique)); + return adoptRef(new IDBIndexBackendImpl(name, keyPath, unique)); } - virtual ~IDBIndexImpl(); + virtual ~IDBIndexBackendImpl(); - // Implements IDBIndex + // Implements IDBIndexBackendInterface. virtual String name() { return m_name; } virtual String keyPath() { return m_keyPath; } virtual bool unique() { return m_unique; } private: - IDBIndexImpl(const String& name, const String& keyPath, bool unique); + IDBIndexBackendImpl(const String& name, const String& keyPath, bool unique); String m_name; String m_keyPath; @@ -57,4 +57,4 @@ private: #endif -#endif // IDBIndexImpl_h +#endif // IDBIndexBackendImpl_h diff --git a/WebCore/storage/IDBIndexBackendInterface.h b/WebCore/storage/IDBIndexBackendInterface.h new file mode 100644 index 0000000..0d1ea34 --- /dev/null +++ b/WebCore/storage/IDBIndexBackendInterface.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 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 AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef IDBIndexBackendInterface_h +#define IDBIndexBackendInterface_h + +#include "PlatformString.h" +#include <wtf/Forward.h> + +#if ENABLE(INDEXED_DATABASE) + +namespace WebCore { + +class IDBIndexBackendInterface : public ThreadSafeShared<IDBIndexBackendInterface> { +public: + virtual ~IDBIndexBackendInterface() { } + + virtual String name() = 0; + virtual String keyPath() = 0; + virtual bool unique() = 0; +}; + +} // namespace WebCore + +#endif + +#endif // IDBIndexBackendInterface_h diff --git a/WebCore/storage/IDBIndexRequest.h b/WebCore/storage/IDBIndexRequest.h deleted file mode 100644 index ce6fc57..0000000 --- a/WebCore/storage/IDBIndexRequest.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2010 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 AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef IDBIndexRequest_h -#define IDBIndexRequest_h - -#include "IDBIndex.h" -#include "PlatformString.h" -#include <wtf/PassRefPtr.h> -#include <wtf/RefCounted.h> -#include <wtf/RefPtr.h> - -#if ENABLE(INDEXED_DATABASE) - -namespace WebCore { - -class IDBIndexRequest : public RefCounted<IDBIndexRequest> { -public: - static PassRefPtr<IDBIndexRequest> create(PassRefPtr<IDBIndex> idbIndex) - { - return adoptRef(new IDBIndexRequest(idbIndex)); - } - ~IDBIndexRequest(); - - // Implement the IDL - String name() const { return m_idbIndex->name(); } - String keyPath() const { return m_idbIndex->keyPath(); } - bool unique() const { return m_idbIndex->unique(); } - -private: - IDBIndexRequest(PassRefPtr<IDBIndex>); - - RefPtr<IDBIndex> m_idbIndex; -}; - -} // namespace WebCore - -#endif - -#endif // IDBIndexRequest_h diff --git a/WebCore/storage/IDBKeyRange.h b/WebCore/storage/IDBKeyRange.h index 9ce07af..5a426b7 100644 --- a/WebCore/storage/IDBKeyRange.h +++ b/WebCore/storage/IDBKeyRange.h @@ -49,6 +49,7 @@ public: { return adoptRef(new IDBKeyRange(left, right, flags)); } + ~IDBKeyRange() { } @@ -60,6 +61,7 @@ public: static PassRefPtr<IDBKeyRange> leftBound(PassRefPtr<IDBKey> bound, bool open = false); static PassRefPtr<IDBKeyRange> rightBound(PassRefPtr<IDBKey> bound, bool open = false); static PassRefPtr<IDBKeyRange> bound(PassRefPtr<IDBKey> left, PassRefPtr<IDBKey> right, bool openLeft = false, bool openRight = false); + private: IDBKeyRange(PassRefPtr<IDBKey> left, PassRefPtr<IDBKey> right, unsigned short flags); diff --git a/WebCore/storage/IDBObjectStore.h b/WebCore/storage/IDBObjectStore.h index e78e62a..4a53eb4 100644 --- a/WebCore/storage/IDBObjectStore.h +++ b/WebCore/storage/IDBObjectStore.h @@ -35,7 +35,7 @@ namespace WebCore { class DOMStringList; class IDBCallbacks; -class IDBIndex; +class IDBIndexBackendInterface; class IDBKey; class SerializedScriptValue; @@ -52,7 +52,7 @@ public: virtual void remove(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks>) = 0; virtual void createIndex(const String& name, const String& keyPath, bool unique, PassRefPtr<IDBCallbacks>) = 0; - virtual PassRefPtr<IDBIndex> index(const String& name) = 0; + virtual PassRefPtr<IDBIndexBackendInterface> index(const String& name) = 0; virtual void removeIndex(const String& name, PassRefPtr<IDBCallbacks>) = 0; }; diff --git a/WebCore/storage/IDBObjectStoreImpl.cpp b/WebCore/storage/IDBObjectStoreImpl.cpp index d678400..8c6444a 100755 --- a/WebCore/storage/IDBObjectStoreImpl.cpp +++ b/WebCore/storage/IDBObjectStoreImpl.cpp @@ -30,7 +30,7 @@ #include "IDBBindingUtilities.h" #include "IDBCallbacks.h" #include "IDBDatabaseException.h" -#include "IDBIndexImpl.h" +#include "IDBIndexBackendImpl.h" #include "IDBKeyTree.h" #if ENABLE(INDEXED_DATABASE) @@ -108,13 +108,13 @@ void IDBObjectStoreImpl::createIndex(const String& name, const String& keyPath, return; } - RefPtr<IDBIndex> index = IDBIndexImpl::create(name, keyPath, unique); + RefPtr<IDBIndexBackendInterface> index = IDBIndexBackendImpl::create(name, keyPath, unique); ASSERT(index->name() == name); m_indexes.set(name, index); callbacks->onSuccess(index.release()); } -PassRefPtr<IDBIndex> IDBObjectStoreImpl::index(const String& name) +PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreImpl::index(const String& name) { return m_indexes.get(name); } diff --git a/WebCore/storage/IDBObjectStoreImpl.h b/WebCore/storage/IDBObjectStoreImpl.h index c4d2eb8..f2c2e03 100644 --- a/WebCore/storage/IDBObjectStoreImpl.h +++ b/WebCore/storage/IDBObjectStoreImpl.h @@ -53,7 +53,7 @@ public: void remove(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks>); void createIndex(const String& name, const String& keyPath, bool unique, PassRefPtr<IDBCallbacks>); - PassRefPtr<IDBIndex> index(const String& name); + PassRefPtr<IDBIndexBackendInterface> index(const String& name); void removeIndex(const String& name, PassRefPtr<IDBCallbacks>); private: @@ -63,7 +63,7 @@ private: String m_keyPath; bool m_autoIncrement; - typedef HashMap<String, RefPtr<IDBIndex> > IndexMap; + typedef HashMap<String, RefPtr<IDBIndexBackendInterface> > IndexMap; IndexMap m_indexes; typedef IDBKeyTree<SerializedScriptValue> Tree; diff --git a/WebCore/storage/IDBObjectStoreRequest.cpp b/WebCore/storage/IDBObjectStoreRequest.cpp index 3e095c1..0778214 100644 --- a/WebCore/storage/IDBObjectStoreRequest.cpp +++ b/WebCore/storage/IDBObjectStoreRequest.cpp @@ -28,7 +28,7 @@ #include "DOMStringList.h" #include "IDBAny.h" -#include "IDBIndexRequest.h" +#include "IDBIndex.h" #include "IDBKey.h" #include "SerializedScriptValue.h" #include <wtf/UnusedParam.h> @@ -94,11 +94,11 @@ PassRefPtr<IDBRequest> IDBObjectStoreRequest::createIndex(ScriptExecutionContext return request; } -PassRefPtr<IDBIndexRequest> IDBObjectStoreRequest::index(const String& name) +PassRefPtr<IDBIndex> IDBObjectStoreRequest::index(const String& name) { - RefPtr<IDBIndex> index = m_objectStore->index(name); + RefPtr<IDBIndexBackendInterface> index = m_objectStore->index(name); ASSERT(index); // FIXME: If this is null, we should raise a NOT_FOUND_ERR. - return IDBIndexRequest::create(index.release()); + return IDBIndex::create(index.release()); } PassRefPtr<IDBRequest> IDBObjectStoreRequest::removeIndex(ScriptExecutionContext* context, const String& name) diff --git a/WebCore/storage/IDBObjectStoreRequest.h b/WebCore/storage/IDBObjectStoreRequest.h index 86f64d6..bfd01f0 100644 --- a/WebCore/storage/IDBObjectStoreRequest.h +++ b/WebCore/storage/IDBObjectStoreRequest.h @@ -61,7 +61,7 @@ public: PassRefPtr<IDBRequest> remove(ScriptExecutionContext*, PassRefPtr<IDBKey> key); PassRefPtr<IDBRequest> createIndex(ScriptExecutionContext*, const String& name, const String& keyPath, bool unique = false); - PassRefPtr<IDBIndexRequest> index(const String& name); + PassRefPtr<IDBIndex> index(const String& name); PassRefPtr<IDBRequest> removeIndex(ScriptExecutionContext*, const String& name); private: diff --git a/WebCore/storage/IDBObjectStoreRequest.idl b/WebCore/storage/IDBObjectStoreRequest.idl index a816b73..6db6ad8 100644 --- a/WebCore/storage/IDBObjectStoreRequest.idl +++ b/WebCore/storage/IDBObjectStoreRequest.idl @@ -38,7 +38,7 @@ module storage { // FIXME: write openCursor [CallWith=ScriptExecutionContext] IDBRequest createIndex(in DOMString name, in [ConvertNullToNullString] DOMString keyPath, in [Optional] boolean unique); // FIXME: This needs to raise an IDBDatabaseException on errors. - IDBIndexRequest index(in DOMString name); + IDBIndex index(in DOMString name); [CallWith=ScriptExecutionContext] IDBRequest removeIndex(in DOMString name); readonly attribute DOMString name; diff --git a/WebCore/storage/IDBRequest.cpp b/WebCore/storage/IDBRequest.cpp index 78dd15a..b836cc3 100644 --- a/WebCore/storage/IDBRequest.cpp +++ b/WebCore/storage/IDBRequest.cpp @@ -36,7 +36,7 @@ #include "EventListener.h" #include "EventNames.h" #include "IDBDatabaseRequest.h" -#include "IDBIndexRequest.h" +#include "IDBIndex.h" #include "IDBErrorEvent.h" #include "IDBObjectStoreRequest.h" #include "IDBSuccessEvent.h" @@ -79,10 +79,10 @@ void IDBRequest::onSuccess(PassRefPtr<IDBDatabase> idbDatabase) m_result->set(IDBDatabaseRequest::create(idbDatabase)); } -void IDBRequest::onSuccess(PassRefPtr<IDBIndex> idbIndex) +void IDBRequest::onSuccess(PassRefPtr<IDBIndexBackendInterface> backend) { onEventCommon(); - m_result->set(IDBIndexRequest::create(idbIndex)); + m_result->set(IDBIndex::create(backend)); } void IDBRequest::onSuccess(PassRefPtr<IDBKey> idbKey) diff --git a/WebCore/storage/IDBRequest.h b/WebCore/storage/IDBRequest.h index c763d96..39f6a51 100644 --- a/WebCore/storage/IDBRequest.h +++ b/WebCore/storage/IDBRequest.h @@ -65,7 +65,7 @@ public: virtual void onError(PassRefPtr<IDBDatabaseError>); virtual void onSuccess(); // For "null". virtual void onSuccess(PassRefPtr<IDBDatabase>); - virtual void onSuccess(PassRefPtr<IDBIndex>); + virtual void onSuccess(PassRefPtr<IDBIndexBackendInterface>); virtual void onSuccess(PassRefPtr<IDBKey>); virtual void onSuccess(PassRefPtr<IDBObjectStore>); virtual void onSuccess(PassRefPtr<SerializedScriptValue>); diff --git a/WebCore/storage/Metadata.h b/WebCore/storage/Metadata.h new file mode 100644 index 0000000..0b06f90 --- /dev/null +++ b/WebCore/storage/Metadata.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2010 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 Metadata_h +#define Metadata_h + +#if ENABLE(FILE_SYSTEM) + +#include <wtf/RefCounted.h> + +namespace WebCore { + +class Metadata : public RefCounted<Metadata> { +public: + static PassRefPtr<Metadata> create(double modificationTime) + { + return adoptRef(new Metadata(modificationTime)); + } + double modificationTime() const { return m_modificationTime; } + +private: + Metadata(double modificationTime) + : m_modificationTime(modificationTime) + { + } + + double m_modificationTime; +}; + +} // namespace + +#endif // ENABLE(FILE_SYSTEM) + +#endif // Metadata_h diff --git a/WebCore/storage/Metadata.idl b/WebCore/storage/Metadata.idl new file mode 100644 index 0000000..711fae8 --- /dev/null +++ b/WebCore/storage/Metadata.idl @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2010 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. + */ + +module storage { + interface [ + Conditional=FILE_SYSTEM + ] Metadata { + readonly attribute double modificationTime; + }; +} diff --git a/WebCore/storage/MetadataCallback.h b/WebCore/storage/MetadataCallback.h new file mode 100644 index 0000000..96e4c91 --- /dev/null +++ b/WebCore/storage/MetadataCallback.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2010 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 MetadataCallback_h +#define MetadataCallback_h + +#if ENABLE(FILE_SYSTEM) + +#include <wtf/RefCounted.h> + +namespace WebCore { + +class Metadata; +class ScriptExecutionContext; + +class MetadataCallback : public RefCounted<MetadataCallback> { +public: + virtual ~MetadataCallback() { } + virtual bool handleEvent(ScriptExecutionContext*, Metadata*) = 0; +}; + +} // namespace + +#endif // ENABLE(FILE_SYSTEM) + +#endif // MetadataCallback_h diff --git a/WebCore/storage/MetadataCallback.idl b/WebCore/storage/MetadataCallback.idl new file mode 100644 index 0000000..44ca180 --- /dev/null +++ b/WebCore/storage/MetadataCallback.idl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2010 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. + */ + +module storage { + interface [ + Conditional=FILE_SYSTEM, + Callback + ] MetadataCallback { + boolean handleEvent(in Metadata metadata); + }; +} diff --git a/WebCore/storage/SQLStatement.cpp b/WebCore/storage/SQLStatement.cpp index 2d7d78e..9dd249a 100644 --- a/WebCore/storage/SQLStatement.cpp +++ b/WebCore/storage/SQLStatement.cpp @@ -78,7 +78,7 @@ bool SQLStatement::execute(Database* db) if (result != SQLResultOk) { LOG(StorageAPI, "Unable to verify correctness of statement %s - error %i (%s)", m_statement.ascii().data(), result, database->lastErrorMsg()); - m_error = SQLError::create(SQLError::SYNTAX_ERR, database->lastErrorMsg()); + m_error = SQLError::create(result == SQLResultInterrupt ? SQLError::DATABASE_ERR : SQLError::SYNTAX_ERR, database->lastErrorMsg()); return false; } @@ -86,7 +86,7 @@ bool SQLStatement::execute(Database* db) // If this is the case, they might be trying to do something fishy or malicious if (statement.bindParameterCount() != m_arguments.size()) { LOG(StorageAPI, "Bind parameter count doesn't match number of question marks"); - m_error = SQLError::create(SQLError::SYNTAX_ERR, "number of '?'s in statement string does not match argument count"); + m_error = SQLError::create(db->isInterrupted() ? SQLError::DATABASE_ERR : SQLError::SYNTAX_ERR, "number of '?'s in statement string does not match argument count"); return false; } diff --git a/WebCore/storage/SQLStatementSync.cpp b/WebCore/storage/SQLStatementSync.cpp index 7be3f50..e47919f 100644 --- a/WebCore/storage/SQLStatementSync.cpp +++ b/WebCore/storage/SQLStatementSync.cpp @@ -61,12 +61,12 @@ PassRefPtr<SQLResultSet> SQLStatementSync::execute(DatabaseSync* db, ExceptionCo SQLiteStatement statement(*database, m_statement); int result = statement.prepare(); if (result != SQLResultOk) { - ec = SQLException::SYNTAX_ERR; + ec = (result == SQLResultInterrupt ? SQLException::DATABASE_ERR : SQLException::SYNTAX_ERR); return 0; } if (statement.bindParameterCount() != m_arguments.size()) { - ec = SQLException::SYNTAX_ERR; + ec = (db->isInterrupted()? SQLException::DATABASE_ERR : SQLException::SYNTAX_ERR); return 0; } diff --git a/WebCore/storage/SQLTransaction.cpp b/WebCore/storage/SQLTransaction.cpp index e43d844..454ea63 100644 --- a/WebCore/storage/SQLTransaction.cpp +++ b/WebCore/storage/SQLTransaction.cpp @@ -146,17 +146,22 @@ const char* SQLTransaction::debugStepName(SQLTransaction::TransactionStepMethod } #endif -void SQLTransaction::checkAndHandleClosedDatabase() +void SQLTransaction::checkAndHandleClosedOrInterruptedDatabase() { - if (m_database->opened()) + if (m_database->opened() && !m_database->isInterrupted()) return; // If the database was stopped, don't do anything and cancel queued work - LOG(StorageAPI, "Database was stopped - cancelling work for this transaction"); + LOG(StorageAPI, "Database was stopped or interrupted - cancelling work for this transaction"); MutexLocker locker(m_statementMutex); m_statementQueue.clear(); m_nextStep = 0; + // Release the unneeded callbacks, to break reference cycles. + m_callback = 0; + m_successCallback = 0; + m_errorCallback = 0; + // The next steps should be executed only if we're on the DB thread. if (currentThread() != database()->scriptExecutionContext()->databaseThread()->getThreadID()) return; @@ -183,7 +188,7 @@ bool SQLTransaction::performNextStep() m_nextStep == &SQLTransaction::cleanupAfterSuccessCallback || m_nextStep == &SQLTransaction::cleanupAfterTransactionErrorCallback); - checkAndHandleClosedDatabase(); + checkAndHandleClosedOrInterruptedDatabase(); if (m_nextStep) (this->*m_nextStep)(); @@ -202,7 +207,7 @@ void SQLTransaction::performPendingCallback() m_nextStep == &SQLTransaction::deliverQuotaIncreaseCallback || m_nextStep == &SQLTransaction::deliverSuccessCallback); - checkAndHandleClosedDatabase(); + checkAndHandleClosedOrInterruptedDatabase(); if (m_nextStep) (this->*m_nextStep)(); @@ -292,6 +297,7 @@ void SQLTransaction::deliverTransactionCallback() m_executeSqlAllowed = true; shouldDeliverErrorCallback = !m_callback->handleEvent(m_database->scriptExecutionContext(), this); m_executeSqlAllowed = false; + m_callback = 0; } // Transaction Step 5 - If the transaction callback was null or raised an exception, jump to the error callback @@ -459,6 +465,7 @@ void SQLTransaction::postflightAndCommit() // If the commit failed, the transaction will still be marked as "in progress" if (m_sqliteTransaction->inProgress()) { + m_successCallback = 0; m_transactionError = SQLError::create(SQLError::DATABASE_ERR, "failed to commit the transaction"); handleTransactionError(false); return; @@ -473,7 +480,6 @@ void SQLTransaction::postflightAndCommit() m_database->transactionClient()->didCommitWriteTransaction(database()); // Now release our unneeded callbacks, to break reference cycles. - m_callback = 0; m_errorCallback = 0; // Transaction Step 10 - Deliver success callback, if there is one @@ -546,8 +552,10 @@ void SQLTransaction::deliverTransactionErrorCallback() // Transaction Step 12 - If exists, invoke error callback with the last // error to have occurred in this transaction. - if (m_errorCallback) + if (m_errorCallback) { m_errorCallback->handleEvent(m_database->scriptExecutionContext(), m_transactionError.get()); + m_errorCallback = 0; + } m_nextStep = &SQLTransaction::cleanupAfterTransactionErrorCallback; LOG(StorageAPI, "Scheduling cleanupAfterTransactionErrorCallback for transaction %p\n", this); @@ -579,10 +587,6 @@ void SQLTransaction::cleanupAfterTransactionErrorCallback() ASSERT(!m_database->sqliteDatabase().transactionInProgress()); m_nextStep = 0; - // Now release our callbacks, to break reference cycles. - m_callback = 0; - m_errorCallback = 0; - // Now release the lock on this database m_database->transactionCoordinator()->releaseLock(this); } diff --git a/WebCore/storage/SQLTransaction.h b/WebCore/storage/SQLTransaction.h index 5c62ca2..2eb200b 100644 --- a/WebCore/storage/SQLTransaction.h +++ b/WebCore/storage/SQLTransaction.h @@ -87,7 +87,7 @@ private: void enqueueStatement(PassRefPtr<SQLStatement>); - void checkAndHandleClosedDatabase(); + void checkAndHandleClosedOrInterruptedDatabase(); void acquireLock(); void openTransactionAndPreflight(); diff --git a/WebCore/storage/chromium/DatabaseTrackerChromium.cpp b/WebCore/storage/chromium/DatabaseTrackerChromium.cpp index aad4ed9..361e203 100644 --- a/WebCore/storage/chromium/DatabaseTrackerChromium.cpp +++ b/WebCore/storage/chromium/DatabaseTrackerChromium.cpp @@ -174,6 +174,35 @@ unsigned long long DatabaseTracker::getMaxSizeForDatabase(const AbstractDatabase return databaseSize + spaceAvailable; } +void DatabaseTracker::interruptAllDatabasesForContext(const ScriptExecutionContext* context) +{ + Vector<RefPtr<AbstractDatabase> > openDatabases; + { + MutexLocker openDatabaseMapLock(m_openDatabaseMapGuard); + + if (!m_openDatabaseMap) + return; + + DatabaseNameMap* nameMap = m_openDatabaseMap->get(context->securityOrigin()); + if (!nameMap) + return; + + DatabaseNameMap::const_iterator dbNameMapEndIt = nameMap->end(); + for (DatabaseNameMap::const_iterator dbNameMapIt = nameMap->begin(); dbNameMapIt != dbNameMapEndIt; ++dbNameMapIt) { + DatabaseSet* databaseSet = dbNameMapIt->second; + DatabaseSet::const_iterator dbSetEndIt = databaseSet->end(); + for (DatabaseSet::const_iterator dbSetIt = databaseSet->begin(); dbSetIt != dbSetEndIt; ++dbSetIt) { + if ((*dbSetIt)->scriptExecutionContext() == context) + openDatabases.append(*dbSetIt); + } + } + } + + Vector<RefPtr<AbstractDatabase> >::const_iterator openDatabasesEndIt = openDatabases.end(); + for (Vector<RefPtr<AbstractDatabase> >::const_iterator openDatabasesIt = openDatabases.begin(); openDatabasesIt != openDatabasesEndIt; ++openDatabasesIt) + (*openDatabasesIt)->interrupt(); +} + } #endif // ENABLE(DATABASE) diff --git a/WebCore/storage/chromium/IndexedDatabase.cpp b/WebCore/storage/chromium/IDBFactoryBackendInterface.cpp index 6f53f92..016cab0 100644 --- a/WebCore/storage/chromium/IndexedDatabase.cpp +++ b/WebCore/storage/chromium/IDBFactoryBackendInterface.cpp @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" -#include "IndexedDatabase.h" +#include "IDBFactoryBackendInterface.h" #include "ChromiumBridge.h" @@ -34,9 +34,9 @@ namespace WebCore { -PassRefPtr<IndexedDatabase> IndexedDatabase::create() +PassRefPtr<IDBFactoryBackendInterface> IDBFactoryBackendInterface::create() { - return ChromiumBridge::indexedDatabase(); + return ChromiumBridge::idbFactory(); } } // namespace WebCore diff --git a/WebCore/svg/SVGClipPathElement.cpp b/WebCore/svg/SVGClipPathElement.cpp index c3a514e..5c23031 100644 --- a/WebCore/svg/SVGClipPathElement.cpp +++ b/WebCore/svg/SVGClipPathElement.cpp @@ -69,12 +69,16 @@ void SVGClipPathElement::svgAttributeChanged(const QualifiedName& attrName) { SVGStyledTransformableElement::svgAttributeChanged(attrName); + RenderObject* object = renderer(); + if (!object) + return; + if (attrName == SVGNames::clipPathUnitsAttr || SVGTests::isKnownAttribute(attrName) || SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName) || SVGStyledTransformableElement::isKnownAttribute(attrName)) - invalidateResourceClients(); + object->setNeedsLayout(true); } void SVGClipPathElement::synchronizeProperty(const QualifiedName& attrName) @@ -97,8 +101,11 @@ void SVGClipPathElement::childrenChanged(bool changedByParser, Node* beforeChang { SVGStyledTransformableElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); - if (!changedByParser) - invalidateResourceClients(); + if (changedByParser) + return; + + if (RenderObject* object = renderer()) + object->setNeedsLayout(true); } RenderObject* SVGClipPathElement::createRenderer(RenderArena* arena, RenderStyle*) diff --git a/WebCore/svg/SVGClipPathElement.h b/WebCore/svg/SVGClipPathElement.h index eb74f72..11b07fb 100644 --- a/WebCore/svg/SVGClipPathElement.h +++ b/WebCore/svg/SVGClipPathElement.h @@ -39,6 +39,7 @@ public: virtual ~SVGClipPathElement(); virtual bool isValid() const { return SVGTests::isValid(); } + virtual bool needsPendingResourceHandling() const { return false; } virtual void parseMappedAttribute(Attribute*); virtual void svgAttributeChanged(const QualifiedName&); diff --git a/WebCore/svg/SVGElement.cpp b/WebCore/svg/SVGElement.cpp index b262e45..0497edf 100644 --- a/WebCore/svg/SVGElement.cpp +++ b/WebCore/svg/SVGElement.cpp @@ -278,20 +278,22 @@ bool SVGElement::childShouldCreateRenderer(Node* child) const void SVGElement::insertedIntoDocument() { StyledElement::insertedIntoDocument(); - SVGDocumentExtensions* extensions = document()->accessSVGExtensions(); - String resourceId = getIdAttribute(); - if (extensions->isPendingResource(resourceId)) { - OwnPtr<HashSet<SVGStyledElement*> > clients(extensions->removePendingResource(resourceId)); - if (clients->isEmpty()) - return; + if (!needsPendingResourceHandling()) + return; - HashSet<SVGStyledElement*>::const_iterator it = clients->begin(); - const HashSet<SVGStyledElement*>::const_iterator end = clients->end(); + SVGDocumentExtensions* extensions = document()->accessSVGExtensions(); + String resourceId = getIdAttribute(); + if (!extensions->isPendingResource(resourceId)) + return; + + OwnPtr<HashSet<SVGStyledElement*> > clients(extensions->removePendingResource(resourceId)); + if (clients->isEmpty()) + return; - for (; it != end; ++it) - (*it)->buildPendingResource(); - } + const HashSet<SVGStyledElement*>::const_iterator end = clients->end(); + for (HashSet<SVGStyledElement*>::const_iterator it = clients->begin(); it != end; ++it) + (*it)->buildPendingResource(); } void SVGElement::attributeChanged(Attribute* attr, bool preserveDecls) diff --git a/WebCore/svg/SVGElement.h b/WebCore/svg/SVGElement.h index 64afe8e..eccf03e 100644 --- a/WebCore/svg/SVGElement.h +++ b/WebCore/svg/SVGElement.h @@ -97,6 +97,8 @@ namespace WebCore { virtual bool isSupported(StringImpl* feature, StringImpl* version) const; virtual ContainerNode* eventParentNode(); + + virtual bool needsPendingResourceHandling() const { return true; } virtual void buildPendingResource() { } void mapInstanceToElement(SVGElementInstance*); diff --git a/WebCore/svg/SVGFETurbulenceElement.cpp b/WebCore/svg/SVGFETurbulenceElement.cpp index e5b5419..e4987c5 100644 --- a/WebCore/svg/SVGFETurbulenceElement.cpp +++ b/WebCore/svg/SVGFETurbulenceElement.cpp @@ -99,6 +99,9 @@ void SVGFETurbulenceElement::synchronizeProperty(const QualifiedName& attrName) PassRefPtr<FilterEffect> SVGFETurbulenceElement::build(SVGFilterBuilder*) { + if (baseFrequencyX() < 0 || baseFrequencyY() < 0) + return 0; + return FETurbulence::create(static_cast<TurbulanceType>(type()), baseFrequencyX(), baseFrequencyY(), numOctaves(), seed(), stitchTiles() == SVG_STITCHTYPE_STITCH); } diff --git a/WebCore/svg/SVGFilterElement.cpp b/WebCore/svg/SVGFilterElement.cpp index 4387e71..0d55bb1 100644 --- a/WebCore/svg/SVGFilterElement.cpp +++ b/WebCore/svg/SVGFilterElement.cpp @@ -66,7 +66,9 @@ void SVGFilterElement::setFilterRes(unsigned long filterResX, unsigned long filt { setFilterResXBaseValue(filterResX); setFilterResYBaseValue(filterResY); - invalidateResourceClients(); + + if (RenderObject* object = renderer()) + object->setNeedsLayout(true); } void SVGFilterElement::parseMappedAttribute(Attribute* attr) @@ -121,6 +123,10 @@ void SVGFilterElement::svgAttributeChanged(const QualifiedName& attrName) updateRelativeLengthsInformation(); } + RenderObject* object = renderer(); + if (!object) + return; + if (invalidateClients || attrName == SVGNames::filterUnitsAttr || attrName == SVGNames::primitiveUnitsAttr @@ -129,7 +135,7 @@ void SVGFilterElement::svgAttributeChanged(const QualifiedName& attrName) || SVGURIReference::isKnownAttribute(attrName) || SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) - invalidateResourceClients(); + object->setNeedsLayout(true); } void SVGFilterElement::synchronizeProperty(const QualifiedName& attrName) @@ -175,8 +181,11 @@ void SVGFilterElement::childrenChanged(bool changedByParser, Node* beforeChange, { SVGStyledElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); - if (!changedByParser) - invalidateResourceClients(); + if (changedByParser) + return; + + if (RenderObject* object = renderer()) + object->setNeedsLayout(true); } FloatRect SVGFilterElement::filterBoundingBox(const FloatRect& objectBoundingBox) const diff --git a/WebCore/svg/SVGFilterElement.h b/WebCore/svg/SVGFilterElement.h index 7b0192c..cdb2297 100644 --- a/WebCore/svg/SVGFilterElement.h +++ b/WebCore/svg/SVGFilterElement.h @@ -43,6 +43,8 @@ public: SVGFilterElement(const QualifiedName&, Document*); virtual ~SVGFilterElement(); + virtual bool needsPendingResourceHandling() const { return false; } + void setFilterRes(unsigned long filterResX, unsigned long filterResY); FloatRect filterBoundingBox(const FloatRect&) const; diff --git a/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp b/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp index 8e284e6..042d93b 100644 --- a/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp +++ b/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp @@ -107,7 +107,7 @@ void SVGFilterPrimitiveStandardAttributes::childrenChanged(bool changedByParser, SVGStyledElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); if (!changedByParser) - invalidateResourceClients(); + invalidateFilter(); } void SVGFilterPrimitiveStandardAttributes::setStandardAttributes(bool primitiveBoundingBoxMode, FilterEffect* filterEffect) const diff --git a/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h b/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h index 14784a5..19f6f3a 100644 --- a/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h +++ b/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h @@ -55,7 +55,8 @@ protected: { if (!inDocument() || !parentNode()->hasTagName(SVGNames::filterTag)) return; - static_cast<SVGFilterElement*>(parentNode())->invalidateResourceClients(); + if (RenderObject* object = parentNode()->renderer()) + object->setNeedsLayout(true); } private: diff --git a/WebCore/svg/SVGGradientElement.cpp b/WebCore/svg/SVGGradientElement.cpp index b314674..0d06955 100644 --- a/WebCore/svg/SVGGradientElement.cpp +++ b/WebCore/svg/SVGGradientElement.cpp @@ -85,13 +85,17 @@ void SVGGradientElement::svgAttributeChanged(const QualifiedName& attrName) { SVGStyledElement::svgAttributeChanged(attrName); + RenderObject* object = renderer(); + if (!object) + return; + if (attrName == SVGNames::gradientUnitsAttr || attrName == SVGNames::gradientTransformAttr || attrName == SVGNames::spreadMethodAttr || SVGURIReference::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName) || SVGStyledElement::isKnownAttribute(attrName)) - invalidateResourceClients(); + object->setNeedsLayout(true); } void SVGGradientElement::synchronizeProperty(const QualifiedName& attrName) @@ -123,8 +127,11 @@ void SVGGradientElement::childrenChanged(bool changedByParser, Node* beforeChang { SVGStyledElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); - if (!changedByParser) - invalidateResourceClients(); + if (changedByParser) + return; + + if (RenderObject* object = renderer()) + object->setNeedsLayout(true); } Vector<Gradient::ColorStop> SVGGradientElement::buildStops() diff --git a/WebCore/svg/SVGGradientElement.h b/WebCore/svg/SVGGradientElement.h index 2736ab3..11a13e4 100644 --- a/WebCore/svg/SVGGradientElement.h +++ b/WebCore/svg/SVGGradientElement.h @@ -37,6 +37,8 @@ namespace WebCore { SVGGradientElement(const QualifiedName&, Document*); virtual ~SVGGradientElement(); + virtual bool needsPendingResourceHandling() const { return false; } + virtual void parseMappedAttribute(Attribute*); virtual void svgAttributeChanged(const QualifiedName&); virtual void synchronizeProperty(const QualifiedName&); diff --git a/WebCore/svg/SVGLinearGradientElement.cpp b/WebCore/svg/SVGLinearGradientElement.cpp index d95c084..37f380b 100644 --- a/WebCore/svg/SVGLinearGradientElement.cpp +++ b/WebCore/svg/SVGLinearGradientElement.cpp @@ -76,7 +76,12 @@ void SVGLinearGradientElement::svgAttributeChanged(const QualifiedName& attrName || attrName == SVGNames::x2Attr || attrName == SVGNames::y2Attr) { updateRelativeLengthsInformation(); - invalidateResourceClients(); + + RenderObject* object = renderer(); + if (!object) + return; + + object->setNeedsLayout(true); } } @@ -155,8 +160,10 @@ LinearGradientAttributes SVGLinearGradientElement::collectGradientProperties() current = static_cast<SVGGradientElement*>(refNode); // Cycle detection - if (processedGradients.contains(current)) - return LinearGradientAttributes(); + if (processedGradients.contains(current)) { + current = 0; + break; + } isLinear = current->hasTagName(SVGNames::linearGradientTag); } else diff --git a/WebCore/svg/SVGMarkerElement.cpp b/WebCore/svg/SVGMarkerElement.cpp index 01faf21..195e91d 100644 --- a/WebCore/svg/SVGMarkerElement.cpp +++ b/WebCore/svg/SVGMarkerElement.cpp @@ -113,6 +113,10 @@ void SVGMarkerElement::svgAttributeChanged(const QualifiedName& attrName) updateRelativeLengthsInformation(); } + RenderObject* object = renderer(); + if (!object) + return; + if (invalidateClients || attrName == SVGNames::markerUnitsAttr || attrName == SVGNames::orientAttr @@ -120,7 +124,7 @@ void SVGMarkerElement::svgAttributeChanged(const QualifiedName& attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName) || SVGFitToViewBox::isKnownAttribute(attrName) || SVGStyledElement::isKnownAttribute(attrName)) - invalidateResourceClients(); + object->setNeedsLayout(true); } void SVGMarkerElement::synchronizeProperty(const QualifiedName& attrName) @@ -166,8 +170,11 @@ void SVGMarkerElement::childrenChanged(bool changedByParser, Node* beforeChange, { SVGStyledElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); - if (!changedByParser) - invalidateResourceClients(); + if (changedByParser) + return; + + if (RenderObject* object = renderer()) + object->setNeedsLayout(true); } void SVGMarkerElement::setOrientToAuto() @@ -175,7 +182,8 @@ void SVGMarkerElement::setOrientToAuto() setOrientTypeBaseValue(SVG_MARKER_ORIENT_AUTO); setOrientAngleBaseValue(SVGAngle()); - invalidateResourceClients(); + if (RenderObject* object = renderer()) + object->setNeedsLayout(true); } void SVGMarkerElement::setOrientToAngle(const SVGAngle& angle) @@ -183,7 +191,8 @@ void SVGMarkerElement::setOrientToAngle(const SVGAngle& angle) setOrientTypeBaseValue(SVG_MARKER_ORIENT_ANGLE); setOrientAngleBaseValue(angle); - invalidateResourceClients(); + if (RenderObject* object = renderer()) + object->setNeedsLayout(true); } RenderObject* SVGMarkerElement::createRenderer(RenderArena* arena, RenderStyle*) diff --git a/WebCore/svg/SVGMarkerElement.h b/WebCore/svg/SVGMarkerElement.h index 689a7e5..7b13d34 100644 --- a/WebCore/svg/SVGMarkerElement.h +++ b/WebCore/svg/SVGMarkerElement.h @@ -56,6 +56,8 @@ public: SVGMarkerElement(const QualifiedName&, Document*); virtual ~SVGMarkerElement(); + virtual bool needsPendingResourceHandling() const { return false; } + AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) const; void setOrientToAuto(); diff --git a/WebCore/svg/SVGMaskElement.cpp b/WebCore/svg/SVGMaskElement.cpp index 5013e5c..a87c28e 100644 --- a/WebCore/svg/SVGMaskElement.cpp +++ b/WebCore/svg/SVGMaskElement.cpp @@ -102,6 +102,10 @@ void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName) updateRelativeLengthsInformation(); } + RenderObject* object = renderer(); + if (!object) + return; + if (invalidateClients || attrName == SVGNames::maskUnitsAttr || attrName == SVGNames::maskContentUnitsAttr @@ -109,7 +113,7 @@ void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName) || SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName) || SVGStyledElement::isKnownAttribute(attrName)) - invalidateResourceClients(); + object->setNeedsLayout(true); } void SVGMaskElement::synchronizeProperty(const QualifiedName& attrName) @@ -141,8 +145,11 @@ void SVGMaskElement::childrenChanged(bool changedByParser, Node* beforeChange, N { SVGStyledElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); - if (!changedByParser) - invalidateResourceClients(); + if (changedByParser) + return; + + if (RenderObject* object = renderer()) + object->setNeedsLayout(true); } FloatRect SVGMaskElement::maskBoundingBox(const FloatRect& objectBoundingBox) const diff --git a/WebCore/svg/SVGMaskElement.h b/WebCore/svg/SVGMaskElement.h index e941667..2df8f31 100644 --- a/WebCore/svg/SVGMaskElement.h +++ b/WebCore/svg/SVGMaskElement.h @@ -40,6 +40,7 @@ namespace WebCore { virtual ~SVGMaskElement(); virtual bool isValid() const { return SVGTests::isValid(); } + virtual bool needsPendingResourceHandling() const { return false; } FloatRect maskBoundingBox(const FloatRect&) const; virtual void parseMappedAttribute(Attribute*); diff --git a/WebCore/svg/SVGParserUtilities.cpp b/WebCore/svg/SVGParserUtilities.cpp index 14e3d58..b5e695b 100644 --- a/WebCore/svg/SVGParserUtilities.cpp +++ b/WebCore/svg/SVGParserUtilities.cpp @@ -40,8 +40,8 @@ namespace WebCore { */ template <typename FloatType> static bool _parseNumber(const UChar*& ptr, const UChar* end, FloatType& number, bool skip) { - int integer, exponent; - FloatType decimal, frac; + int exponent; + FloatType integer, decimal, frac; int sign, expsign; const UChar* start = ptr; @@ -64,9 +64,19 @@ template <typename FloatType> static bool _parseNumber(const UChar*& ptr, const // The first character of a number must be one of [0-9+-.] return false; - // read the integer part + // read the integer part, build right-to-left + const UChar* ptrStartIntPart = ptr; while (ptr < end && *ptr >= '0' && *ptr <= '9') - integer = (integer * 10) + *(ptr++) - '0'; + ++ptr; // Advance to first non-digit. + + if (ptr != ptrStartIntPart) { + const UChar* ptrScanIntPart = ptr - 1; + FloatType multiplier = 1; + while (ptrScanIntPart >= ptrStartIntPart) { + integer += multiplier * static_cast<FloatType>(*(ptrScanIntPart--) - '0'); + multiplier *= 10; + } + } if (ptr < end && *ptr == '.') { // read the decimals ptr++; diff --git a/WebCore/svg/SVGPatternElement.cpp b/WebCore/svg/SVGPatternElement.cpp index e258946..ee42118 100644 --- a/WebCore/svg/SVGPatternElement.cpp +++ b/WebCore/svg/SVGPatternElement.cpp @@ -129,6 +129,10 @@ void SVGPatternElement::svgAttributeChanged(const QualifiedName& attrName) updateRelativeLengthsInformation(); } + RenderObject* object = renderer(); + if (!object) + return; + if (invalidateClients || attrName == SVGNames::patternUnitsAttr || attrName == SVGNames::patternContentUnitsAttr @@ -139,7 +143,7 @@ void SVGPatternElement::svgAttributeChanged(const QualifiedName& attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName) || SVGFitToViewBox::isKnownAttribute(attrName) || SVGStyledElement::isKnownAttribute(attrName)) - invalidateResourceClients(); + object->setNeedsLayout(true); } void SVGPatternElement::synchronizeProperty(const QualifiedName& attrName) @@ -188,8 +192,11 @@ void SVGPatternElement::childrenChanged(bool changedByParser, Node* beforeChange { SVGStyledElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); - if (!changedByParser) - invalidateResourceClients(); + if (changedByParser) + return; + + if (RenderObject* object = renderer()) + object->setNeedsLayout(true); } RenderObject* SVGPatternElement::createRenderer(RenderArena* arena, RenderStyle*) @@ -236,8 +243,10 @@ PatternAttributes SVGPatternElement::collectPatternProperties() const current = static_cast<const SVGPatternElement*>(const_cast<const Node*>(refNode)); // Cycle detection - if (processedPatterns.contains(current)) - return PatternAttributes(); + if (processedPatterns.contains(current)) { + current = 0; + break; + } } else current = 0; } diff --git a/WebCore/svg/SVGPatternElement.h b/WebCore/svg/SVGPatternElement.h index 105b8e2..2a8a7fe 100644 --- a/WebCore/svg/SVGPatternElement.h +++ b/WebCore/svg/SVGPatternElement.h @@ -47,6 +47,7 @@ namespace WebCore { virtual ~SVGPatternElement(); virtual bool isValid() const { return SVGTests::isValid(); } + virtual bool needsPendingResourceHandling() const { return false; } virtual void parseMappedAttribute(Attribute*); virtual void svgAttributeChanged(const QualifiedName&); diff --git a/WebCore/svg/SVGRadialGradientElement.cpp b/WebCore/svg/SVGRadialGradientElement.cpp index 2a97b9d..a970817 100644 --- a/WebCore/svg/SVGRadialGradientElement.cpp +++ b/WebCore/svg/SVGRadialGradientElement.cpp @@ -83,7 +83,12 @@ void SVGRadialGradientElement::svgAttributeChanged(const QualifiedName& attrName || attrName == SVGNames::fyAttr || attrName == SVGNames::rAttr) { updateRelativeLengthsInformation(); - invalidateResourceClients(); + + RenderObject* object = renderer(); + if (!object) + return; + + object->setNeedsLayout(true); } } @@ -168,8 +173,10 @@ RadialGradientAttributes SVGRadialGradientElement::collectGradientProperties() current = static_cast<SVGGradientElement*>(refNode); // Cycle detection - if (processedGradients.contains(current)) - return RadialGradientAttributes(); + if (processedGradients.contains(current)) { + current = 0; + break; + } isRadial = current->hasTagName(SVGNames::radialGradientTag); } else diff --git a/WebCore/svg/SVGScriptElement.cpp b/WebCore/svg/SVGScriptElement.cpp index abe77a9..ea4ac1f 100644 --- a/WebCore/svg/SVGScriptElement.cpp +++ b/WebCore/svg/SVGScriptElement.cpp @@ -242,6 +242,11 @@ void SVGScriptElement::dispatchErrorEvent() dispatchEvent(Event::create(eventNames().errorEvent, true, false)); } +bool SVGScriptElement::shouldExecuteAsJavaScript() const +{ + return m_data.shouldExecuteAsJavaScript(); +} + } #endif // ENABLE(SVG) diff --git a/WebCore/svg/SVGScriptElement.h b/WebCore/svg/SVGScriptElement.h index 770dc89..2d9cae8 100644 --- a/WebCore/svg/SVGScriptElement.h +++ b/WebCore/svg/SVGScriptElement.h @@ -56,7 +56,7 @@ namespace WebCore { virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const; - virtual bool shouldExecuteAsJavaScript() const { return false; } + virtual bool shouldExecuteAsJavaScript() const; protected: virtual bool haveLoadedRequiredResources(); diff --git a/WebCore/svg/SVGStyleElement.cpp b/WebCore/svg/SVGStyleElement.cpp index 48fbe69..6050e84 100644 --- a/WebCore/svg/SVGStyleElement.cpp +++ b/WebCore/svg/SVGStyleElement.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org> + Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> Copyright (C) 2006 Apple Computer, Inc. Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> @@ -34,12 +34,10 @@ namespace WebCore { -using namespace SVGNames; - -SVGStyleElement::SVGStyleElement(const QualifiedName& tagName, Document* doc, bool createdByParser) - : SVGElement(tagName, doc) - , SVGLangSpace() - , m_createdByParser(createdByParser) +SVGStyleElement::SVGStyleElement(const QualifiedName& tagName, Document* document, bool createdByParser) + : SVGElement(tagName, document) + , SVGLangSpace() + , StyleElement(document, createdByParser) { } @@ -90,31 +88,26 @@ void SVGStyleElement::parseMappedAttribute(Attribute* attr) void SVGStyleElement::finishParsingChildren() { - StyleElement::sheet(this); - m_createdByParser = false; + StyleElement::finishParsingChildren(this); SVGElement::finishParsingChildren(); } void SVGStyleElement::insertedIntoDocument() { SVGElement::insertedIntoDocument(); - document()->addStyleSheetCandidateNode(this, m_createdByParser); - if (!m_createdByParser) - StyleElement::insertedIntoDocument(document(), this); + StyleElement::insertedIntoDocument(document(), this); } void SVGStyleElement::removedFromDocument() { SVGElement::removedFromDocument(); - if (document()->renderer()) - document()->removeStyleSheetCandidateNode(this); - StyleElement::removedFromDocument(document()); + StyleElement::removedFromDocument(document(), this); } void SVGStyleElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) { + StyleElement::childrenChanged(this); SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); - StyleElement::process(this, 0); } StyleSheet* SVGStyleElement::sheet() @@ -122,13 +115,6 @@ StyleSheet* SVGStyleElement::sheet() return StyleElement::sheet(this); } -bool SVGStyleElement::sheetLoaded() -{ - document()->removePendingSheet(); - return true; -} - } -// vim:ts=4:noet #endif // ENABLE(SVG) diff --git a/WebCore/svg/SVGStyleElement.h b/WebCore/svg/SVGStyleElement.h index ae7ed57..fe11f9c 100644 --- a/WebCore/svg/SVGStyleElement.h +++ b/WebCore/svg/SVGStyleElement.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org> + Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> This library is free software; you can redistribute it and/or @@ -20,48 +20,43 @@ #ifndef SVGStyleElement_h #define SVGStyleElement_h -#if ENABLE(SVG) -#include <SVGElement.h> +#if ENABLE(SVG) +#include "SVGElement.h" #include "SVGLangSpace.h" #include "StyleElement.h" namespace WebCore { - class SVGStyleElement : public SVGElement, - public SVGLangSpace, - public StyleElement { - public: - SVGStyleElement(const QualifiedName&, Document*, bool createdByParser); +class SVGStyleElement : public SVGElement + , public SVGLangSpace + , public StyleElement { +public: + SVGStyleElement(const QualifiedName&, Document*, bool createdByParser); - // Derived from: 'Element' - virtual void parseMappedAttribute(Attribute*); - virtual void insertedIntoDocument(); - virtual void removedFromDocument(); - virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); + virtual void parseMappedAttribute(Attribute*); + virtual void insertedIntoDocument(); + virtual void removedFromDocument(); + virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); - virtual void finishParsingChildren(); + virtual void finishParsingChildren(); - virtual bool sheetLoaded(); + virtual bool isLoading() const { return StyleElement::isLoading(); } + virtual bool sheetLoaded() { return StyleElement::sheetLoaded(document()); } - virtual const AtomicString& type() const; - void setType(const AtomicString&, ExceptionCode&); + virtual const AtomicString& type() const; + void setType(const AtomicString&, ExceptionCode&); - virtual const AtomicString& media() const; - void setMedia(const AtomicString&, ExceptionCode&); + virtual const AtomicString& media() const; + void setMedia(const AtomicString&, ExceptionCode&); - virtual String title() const; - void setTitle(const AtomicString&, ExceptionCode&); + virtual String title() const; + void setTitle(const AtomicString&, ExceptionCode&); - StyleSheet* sheet(); - - protected: - bool m_createdByParser; - }; + StyleSheet* sheet(); +}; } // namespace WebCore #endif // ENABLE(SVG) #endif // SVGStyleElement_h - -// vim:ts=4:noet diff --git a/WebCore/svg/SVGStyledElement.cpp b/WebCore/svg/SVGStyledElement.cpp index 6c2993c..09447c5 100644 --- a/WebCore/svg/SVGStyledElement.cpp +++ b/WebCore/svg/SVGStyledElement.cpp @@ -258,17 +258,12 @@ void SVGStyledElement::synchronizeProperty(const QualifiedName& attrName) synchronizeClassName(); } -void SVGStyledElement::invalidateResourceClients() +void SVGStyledElement::attach() { - if (document()->parsing()) - return; - - RenderObject* object = renderer(); - if (!object) - return; + SVGElement::attach(); - if (object->isSVGResourceContainer()) - object->toRenderSVGResourceContainer()->invalidateClients(); + if (RenderObject* object = renderer()) + object->updateFromElement(); } void SVGStyledElement::insertedIntoDocument() diff --git a/WebCore/svg/SVGStyledElement.h b/WebCore/svg/SVGStyledElement.h index 4982908..79ee0d5 100644 --- a/WebCore/svg/SVGStyledElement.h +++ b/WebCore/svg/SVGStyledElement.h @@ -57,6 +57,7 @@ namespace WebCore { virtual void svgAttributeChanged(const QualifiedName&); virtual void synchronizeProperty(const QualifiedName&); + virtual void attach(); virtual void insertedIntoDocument(); virtual void removedFromDocument(); virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); @@ -64,8 +65,6 @@ namespace WebCore { // Centralized place to force a manual style resolution. Hacky but needed for now. PassRefPtr<RenderStyle> resolveStyle(RenderStyle* parentStyle); - void invalidateResourceClients(); - bool instanceUpdatesBlocked() const; void setInstanceUpdatesBlocked(bool); diff --git a/WebCore/svg/graphics/filters/SVGFETurbulence.cpp b/WebCore/svg/graphics/filters/SVGFETurbulence.cpp index db4b0bb..8042a47 100644 --- a/WebCore/svg/graphics/filters/SVGFETurbulence.cpp +++ b/WebCore/svg/graphics/filters/SVGFETurbulence.cpp @@ -2,6 +2,8 @@ Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005 Rob Buis <buis@kde.org> 2005 Eric Seidel <eric@webkit.org> + 2009 Dirk Schulze <krit@webkit.org> + 2010 Renata Hodovan <reni@inf.u-szeged.hu> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -23,13 +25,31 @@ #if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFETurbulence.h" -#include "SVGRenderTreeAsText.h" + +#include "CanvasPixelArray.h" #include "Filter.h" +#include "ImageData.h" +#include "SVGRenderTreeAsText.h" + +#include <wtf/MathExtras.h> namespace WebCore { -FETurbulence::FETurbulence(TurbulanceType type, const float& baseFrequencyX, const float& baseFrequencyY, - const int& numOctaves, const float& seed, bool stitchTiles) +/* + Produces results in the range [1, 2**31 - 2]. Algorithm is: + r = (a * r) mod m where a = randAmplitude = 16807 and + m = randMaximum = 2**31 - 1 = 2147483647, r = seed. + See [Park & Miller], CACM vol. 31 no. 10 p. 1195, Oct. 1988 + To test: the algorithm should produce the result 1043618065 + as the 10,000th generated number if the original seed is 1. +*/ +static const int s_perlinNoise = 4096; +static const long s_randMaximum = 2147483647; // 2**31 - 1 +static const int s_randAmplitude = 16807; // 7**5; primitive root of m +static const int s_randQ = 127773; // m / a +static const int s_randR = 2836; // m % a + +FETurbulence::FETurbulence(TurbulanceType type, float baseFrequencyX, float baseFrequencyY, int numOctaves, float seed, bool stitchTiles) : FilterEffect() , m_type(type) , m_baseFrequencyX(baseFrequencyX) @@ -40,8 +60,7 @@ FETurbulence::FETurbulence(TurbulanceType type, const float& baseFrequencyX, con { } -PassRefPtr<FETurbulence> FETurbulence::create(TurbulanceType type, const float& baseFrequencyX, const float& baseFrequencyY, - const int& numOctaves, const float& seed, bool stitchTiles) +PassRefPtr<FETurbulence> FETurbulence::create(TurbulanceType type, float baseFrequencyX, float baseFrequencyY, int numOctaves, float seed, bool stitchTiles) { return adoptRef(new FETurbulence(type, baseFrequencyX, baseFrequencyY, numOctaves, seed, stitchTiles)); } @@ -106,8 +125,226 @@ void FETurbulence::setStitchTiles(bool stitch) m_stitchTiles = stitch; } -void FETurbulence::apply(Filter*) +// The turbulence calculation code is an adapted version of what appears in the SVG 1.1 specification: +// http://www.w3.org/TR/SVG11/filters.html#feTurbulence + +FETurbulence::PaintingData::PaintingData(long paintingSeed, const IntSize& paintingSize) + : seed(paintingSeed) + , width(0) + , height(0) + , wrapX(0) + , wrapY(0) + , channel(0) + , filterSize(paintingSize) +{ +} + +// Compute pseudo random number. +inline long FETurbulence::PaintingData::random() +{ + long result = s_randAmplitude * (seed % s_randQ) - s_randR * (seed / s_randQ); + if (result <= 0) + result += s_randMaximum; + seed = result; + return result; +} + +inline float smoothCurve(float t) +{ + return t * t * (3 - 2 * t); +} + +inline float linearInterpolation(float t, float a, float b) +{ + return a + t * (b - a); +} + +inline void FETurbulence::initPaint(PaintingData& paintingData) { + float normalizationFactor; + + // The seed value clamp to the range [1, s_randMaximum - 1]. + if (paintingData.seed <= 0) + paintingData.seed = -(paintingData.seed % (s_randMaximum - 1)) + 1; + if (paintingData.seed > s_randMaximum - 1) + paintingData.seed = s_randMaximum - 1; + + float* gradient; + for (int channel = 0; channel < 4; ++channel) { + for (int i = 0; i < s_blockSize; ++i) { + paintingData.latticeSelector[i] = i; + gradient = paintingData.gradient[channel][i]; + gradient[0] = static_cast<float>((paintingData.random() % (2 * s_blockSize)) - s_blockSize) / s_blockSize; + gradient[1] = static_cast<float>((paintingData.random() % (2 * s_blockSize)) - s_blockSize) / s_blockSize; + normalizationFactor = sqrtf(gradient[0] * gradient[0] + gradient[1] * gradient[1]); + gradient[0] /= normalizationFactor; + gradient[1] /= normalizationFactor; + } + } + for (int i = s_blockSize - 1; i >= 0; --i) { + int k = paintingData.latticeSelector[i]; + int j = paintingData.random() % s_blockSize; + ASSERT(j >= 0); + ASSERT(j < 2 * s_blockSize + 2); + paintingData.latticeSelector[i] = paintingData.latticeSelector[j]; + paintingData.latticeSelector[j] = k; + } + for (int i = 0; i < s_blockSize + 2; ++i) { + paintingData.latticeSelector[s_blockSize + i] = paintingData.latticeSelector[i]; + for (int channel = 0; channel < 4; ++channel) { + paintingData.gradient[channel][s_blockSize + i][0] = paintingData.gradient[channel][i][0]; + paintingData.gradient[channel][s_blockSize + i][1] = paintingData.gradient[channel][i][1]; + } + } +} + +inline void checkNoise(int& noiseValue, int limitValue, int newValue) +{ + if (noiseValue >= limitValue) + noiseValue -= newValue; + if (noiseValue >= limitValue - 1) + noiseValue -= newValue - 1; +} + +float FETurbulence::noise2D(PaintingData& paintingData, const FloatPoint& noiseVector) +{ + struct Noise { + int noisePositionIntegerValue; + float noisePositionFractionValue; + + Noise(float component) + { + float position = component + s_perlinNoise; + noisePositionIntegerValue = static_cast<int>(position); + noisePositionFractionValue = position - noisePositionIntegerValue; + } + }; + + Noise noiseX(noiseVector.x()); + Noise noiseY(noiseVector.y()); + float* q; + float sx, sy, a, b, u, v; + + // If stitching, adjust lattice points accordingly. + if (m_stitchTiles) { + checkNoise(noiseX.noisePositionIntegerValue, paintingData.wrapX, paintingData.width); + checkNoise(noiseY.noisePositionIntegerValue, paintingData.wrapY, paintingData.height); + } + + noiseX.noisePositionIntegerValue &= s_blockMask; + noiseY.noisePositionIntegerValue &= s_blockMask; + int latticeIndex = paintingData.latticeSelector[noiseX.noisePositionIntegerValue]; + int nextLatticeIndex = paintingData.latticeSelector[(noiseX.noisePositionIntegerValue + 1) & s_blockMask]; + + sx = smoothCurve(noiseX.noisePositionFractionValue); + sy = smoothCurve(noiseY.noisePositionFractionValue); + + // This is taken 1:1 from SVG spec: http://www.w3.org/TR/SVG11/filters.html#feTurbulenceElement. + int temp = paintingData.latticeSelector[latticeIndex + noiseY.noisePositionIntegerValue]; + q = paintingData.gradient[paintingData.channel][temp]; + u = noiseX.noisePositionFractionValue * q[0] + noiseY.noisePositionFractionValue * q[1]; + temp = paintingData.latticeSelector[nextLatticeIndex + noiseY.noisePositionIntegerValue]; + q = paintingData.gradient[paintingData.channel][temp]; + v = (noiseX.noisePositionFractionValue - 1) * q[0] + noiseY.noisePositionFractionValue * q[1]; + a = linearInterpolation(sx, u, v); + temp = paintingData.latticeSelector[latticeIndex + noiseY.noisePositionIntegerValue + 1]; + q = paintingData.gradient[paintingData.channel][temp]; + u = noiseX.noisePositionFractionValue * q[0] + (noiseY.noisePositionFractionValue - 1) * q[1]; + temp = paintingData.latticeSelector[nextLatticeIndex + noiseY.noisePositionIntegerValue + 1]; + q = paintingData.gradient[paintingData.channel][temp]; + v = (noiseX.noisePositionFractionValue - 1) * q[0] + (noiseY.noisePositionFractionValue - 1) * q[1]; + b = linearInterpolation(sx, u, v); + return linearInterpolation(sy, a, b); +} + +unsigned char FETurbulence::calculateTurbulenceValueForPoint(PaintingData& paintingData, const FloatPoint& point) +{ + float tileWidth = paintingData.filterSize.width(); + ASSERT(tileWidth > 0); + float tileHeight = paintingData.filterSize.height(); + ASSERT(tileHeight > 0); + // Adjust the base frequencies if necessary for stitching. + if (m_stitchTiles) { + // When stitching tiled turbulence, the frequencies must be adjusted + // so that the tile borders will be continuous. + if (m_baseFrequencyX) { + float lowFrequency = floorf(tileWidth * m_baseFrequencyX) / tileWidth; + float highFrequency = ceilf(tileWidth * m_baseFrequencyX) / tileWidth; + // BaseFrequency should be non-negative according to the standard. + if (m_baseFrequencyX / lowFrequency < highFrequency / m_baseFrequencyX) + m_baseFrequencyX = lowFrequency; + else + m_baseFrequencyX = highFrequency; + } + if (m_baseFrequencyY) { + float lowFrequency = floorf(tileHeight * m_baseFrequencyY) / tileHeight; + float highFrequency = ceilf(tileHeight * m_baseFrequencyY) / tileHeight; + if (m_baseFrequencyY / lowFrequency < highFrequency / m_baseFrequencyY) + m_baseFrequencyY = lowFrequency; + else + m_baseFrequencyY = highFrequency; + } + // Set up TurbulenceInitial stitch values. + paintingData.width = roundf(tileWidth * m_baseFrequencyX); + paintingData.wrapX = s_perlinNoise + paintingData.width; + paintingData.height = roundf(tileHeight * m_baseFrequencyY); + paintingData.wrapY = s_perlinNoise + paintingData.height; + } + float turbulenceFunctionResult = 0; + FloatPoint noiseVector(point.x() * m_baseFrequencyX, point.y() * m_baseFrequencyY); + float ratio = 1; + for (int octave = 0; octave < m_numOctaves; ++octave) { + if (m_type == FETURBULENCE_TYPE_FRACTALNOISE) + turbulenceFunctionResult += noise2D(paintingData, noiseVector) / ratio; + else + turbulenceFunctionResult += fabsf(noise2D(paintingData, noiseVector)) / ratio; + noiseVector.setX(noiseVector.x() * 2); + noiseVector.setY(noiseVector.y() * 2); + ratio *= 2; + if (m_stitchTiles) { + // Update stitch values. Subtracting s_perlinNoiseoise before the multiplication and + // adding it afterward simplifies to subtracting it once. + paintingData.width *= 2; + paintingData.wrapX = 2 * paintingData.wrapX - s_perlinNoise; + paintingData.height *= 2; + paintingData.wrapY = 2 * paintingData.wrapY - s_perlinNoise; + } + } + + // Clamp result + turbulenceFunctionResult = std::max(std::min(turbulenceFunctionResult, 255.f), 0.f); + if (m_type == FETURBULENCE_TYPE_FRACTALNOISE) + return static_cast<unsigned char>(turbulenceFunctionResult * 127.5f + 127.5f); // It comes form (turbulenceFunctionResult * 255 + 255) / 2 + return static_cast<unsigned char>(turbulenceFunctionResult * 255); +} + +void FETurbulence::apply(Filter* filter) +{ + if (!getEffectContext()) + return; + + IntRect imageRect(IntPoint(), resultImage()->size()); + if (!imageRect.size().width() || !imageRect.size().height()) + return; + + RefPtr<ImageData> imageData = ImageData::create(imageRect.width(), imageRect.height()); + PaintingData paintingData(floorf(fabsf(m_seed)), imageRect.size()); + initPaint(paintingData); + + FloatRect filterRegion = filter->filterRegion(); + FloatPoint point; + point.setY(filterRegion.y()); + int indexOfPixelChannel = 0; + for (int y = 0; y < imageRect.height(); ++y) { + point.setY(point.y() + 1); + point.setX(filterRegion.x()); + for (int x = 0; x < imageRect.width(); ++x) { + point.setX(point.x() + 1); + for (paintingData.channel = 0; paintingData.channel < 4; ++paintingData.channel, ++indexOfPixelChannel) + imageData->data()->set(indexOfPixelChannel, calculateTurbulenceValueForPoint(paintingData, point)); + } + } + resultImage()->putUnmultipliedImageData(imageData.get(), imageRect, IntPoint()); } void FETurbulence::dump() diff --git a/WebCore/svg/graphics/filters/SVGFETurbulence.h b/WebCore/svg/graphics/filters/SVGFETurbulence.h index bed0637..33e185e 100644 --- a/WebCore/svg/graphics/filters/SVGFETurbulence.h +++ b/WebCore/svg/graphics/filters/SVGFETurbulence.h @@ -2,6 +2,8 @@ Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005 Rob Buis <buis@kde.org> 2005 Eric Seidel <eric@webkit.org> + 2009 Dirk Schulze <krit@webkit.org> + 2010 Renata Hodovan <reni@inf.u-szeged.hu> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -28,51 +30,71 @@ namespace WebCore { - enum TurbulanceType { - FETURBULENCE_TYPE_UNKNOWN = 0, - FETURBULENCE_TYPE_FRACTALNOISE = 1, - FETURBULENCE_TYPE_TURBULENCE = 2 - }; +enum TurbulanceType { + FETURBULENCE_TYPE_UNKNOWN = 0, + FETURBULENCE_TYPE_FRACTALNOISE = 1, + FETURBULENCE_TYPE_TURBULENCE = 2 +}; + +class FETurbulence : public FilterEffect { +public: + static PassRefPtr<FETurbulence> create(TurbulanceType, float, float, int, float, bool); - class FETurbulence : public FilterEffect { - public: - static PassRefPtr<FETurbulence> create(TurbulanceType, const float&, const float&, const int&, const float&, - bool); + TurbulanceType type() const; + void setType(TurbulanceType); - TurbulanceType type() const; - void setType(TurbulanceType); + float baseFrequencyY() const; + void setBaseFrequencyY(float); - float baseFrequencyY() const; - void setBaseFrequencyY(float); + float baseFrequencyX() const; + void setBaseFrequencyX(float); - float baseFrequencyX() const; - void setBaseFrequencyX(float); + float seed() const; + void setSeed(float); - float seed() const; - void setSeed(float); + int numOctaves() const; + void setNumOctaves(bool); - int numOctaves() const; - void setNumOctaves(bool); + bool stitchTiles() const; + void setStitchTiles(bool); - bool stitchTiles() const; - void setStitchTiles(bool); + void apply(Filter*); + void dump(); + TextStream& externalRepresentation(TextStream&, int indent) const; - void apply(Filter*); - void dump(); - TextStream& externalRepresentation(TextStream&, int indent) const; +private: + static const int s_blockSize = 256; + static const int s_blockMask = s_blockSize - 1; - private: - FETurbulence(TurbulanceType, const float&, const float&, const int&, const float&, - bool); + struct PaintingData { + long seed; + int latticeSelector[2 * s_blockSize + 2]; + float gradient[4][2 * s_blockSize + 2][2]; + int width; // How much to subtract to wrap for stitching. + int height; + int wrapX; // Minimum value to wrap. + int wrapY; + int channel; + IntSize filterSize; - TurbulanceType m_type; - float m_baseFrequencyX; - float m_baseFrequencyY; - int m_numOctaves; - float m_seed; - bool m_stitchTiles; + PaintingData(long paintingSeed, const IntSize& paintingSize); + inline long random(); }; + FETurbulence(TurbulanceType, float, float, int, float, bool); + + inline void initPaint(PaintingData&); + float noise2D(PaintingData&, const FloatPoint&); + unsigned char calculateTurbulenceValueForPoint(PaintingData&, const FloatPoint&); + + TurbulanceType m_type; + float m_baseFrequencyX; + float m_baseFrequencyY; + int m_numOctaves; + float m_seed; + bool m_stitchTiles; +}; + } // namespace WebCore #endif // ENABLE(SVG) && ENABLE(FILTERS) diff --git a/WebCore/workers/WorkerThread.cpp b/WebCore/workers/WorkerThread.cpp index 96ca89b..d6a1e05 100644 --- a/WebCore/workers/WorkerThread.cpp +++ b/WebCore/workers/WorkerThread.cpp @@ -30,7 +30,6 @@ #include "WorkerThread.h" -#include "DatabaseTask.h" #include "DedicatedWorkerContext.h" #include "KURL.h" #include "PlatformString.h" @@ -41,6 +40,11 @@ #include <utility> #include <wtf/Noncopyable.h> +#if ENABLE(DATABASE) +#include "DatabaseTask.h" +#include "DatabaseTracker.h" +#endif + namespace WebCore { static Mutex& threadCountMutex() @@ -225,6 +229,10 @@ void WorkerThread::stop() if (m_workerContext) { m_workerContext->script()->forbidExecution(WorkerScriptController::TerminateRunningScript); +#if ENABLE(DATABASE) + DatabaseTracker::tracker().interruptAllDatabasesForContext(m_workerContext.get()); +#endif + // FIXME: Rudely killing the thread won't work when we allow nested workers, because they will try to post notifications of their destruction. // This can likely use the same mechanism as used for databases above. diff --git a/WebKit/CMakeLists.txt b/WebKit/CMakeLists.txt index 3ed3e9c..3fee2c6 100644 --- a/WebKit/CMakeLists.txt +++ b/WebKit/CMakeLists.txt @@ -67,6 +67,7 @@ INCLUDE_DIRECTORIES(${WebKit_INCLUDE_DIRECTORIES}) ADD_LIBRARY(${WebKit_LIBRARY_NAME} ${WebKit_LIBRARY_TYPE} ${WebKit_SOURCES}) TARGET_LINK_LIBRARIES(${WebKit_LIBRARY_NAME} ${WebKit_LIBRARIES}) ADD_TARGET_PROPERTIES(${WebKit_LIBRARY_NAME} LINK_FLAGS "${WebKit_LINK_FLAGS}") +SET_TARGET_PROPERTIES(${WebKit_LIBRARY_NAME} PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR}) INSTALL(TARGETS ${WebKit_LIBRARY_NAME} DESTINATION lib) diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog index 76b6fb4..75181e6 100644 --- a/WebKit/ChangeLog +++ b/WebKit/ChangeLog @@ -1,3 +1,41 @@ +2010-07-31 David Kilzer <ddkilzer@apple.com> + + <http://webkit.org/b/43307> Make sure all private headers are copied to PrivateHeaders directory + + Reviewed by Dan Bernstein. + + This also fixes compilation of DumpRenderTree after changes for + Bug 40627. + + * WebKit.xcodeproj/project.pbxproj: Set the PRIVATE attribute on + the following headers: + - WebFormDelegatePrivate.h + - WebKitStatisticsPrivate.h + - WebSecurityOriginPrivate.h + +2010-07-30 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by David Kilzer. + + Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas) + https://bugs.webkit.org/show_bug.cgi?id=40627 + + * WebKit.xcodeproj/project.pbxproj: + * efl/WebCoreSupport/ChromeClientEfl.cpp: + (WebCore::ChromeClientEfl::reachedApplicationCacheOriginQuota): + * efl/WebCoreSupport/ChromeClientEfl.h: + +2010-07-30 Rafael Antognolli <antognolli@profusion.mobi> + + Reviewed by Antonio Gomes. + + [EFL] Add library version and soname to EFL generated libraries and binary. + https://bugs.webkit.org/show_bug.cgi?id=43212 + + Add version and soname to libewebkit.so. + + * CMakeLists.txt: + 2010-07-26 Rafael Antognolli <antognolli@profusion.mobi> Reviewed by Antonio Gomes. diff --git a/WebKit/WebKit.xcodeproj/project.pbxproj b/WebKit/WebKit.xcodeproj/project.pbxproj index 634a430..e447b7f 100644 --- a/WebKit/WebKit.xcodeproj/project.pbxproj +++ b/WebKit/WebKit.xcodeproj/project.pbxproj @@ -93,9 +93,6 @@ 441793A60E34EE150055E1AE /* WebHTMLRepresentationInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 441793A50E34EE150055E1AE /* WebHTMLRepresentationInternal.h */; }; 4BF99F900AE050BC00815C2B /* WebEditorClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF99F8E0AE050BC00815C2B /* WebEditorClient.h */; settings = {ATTRIBUTES = (); }; }; 4BF99F910AE050BC00815C2B /* WebEditorClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BF99F8F0AE050BC00815C2B /* WebEditorClient.mm */; }; - 51079D170CED11B00077247D /* WebSecurityOrigin.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51079D140CED11B00077247D /* WebSecurityOrigin.mm */; }; - 51079D180CED11B00077247D /* WebSecurityOriginInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 51079D150CED11B00077247D /* WebSecurityOriginInternal.h */; }; - 51079D190CED11B00077247D /* WebSecurityOriginPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 51079D160CED11B00077247D /* WebSecurityOriginPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 511F3FD50CECC88F00852565 /* WebDatabaseManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = 511F3FD10CECC88F00852565 /* WebDatabaseManager.mm */; }; 511F3FD60CECC88F00852565 /* WebDatabaseManagerPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 511F3FD20CECC88F00852565 /* WebDatabaseManagerPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 511F3FD70CECC88F00852565 /* WebDatabaseTrackerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 511F3FD30CECC88F00852565 /* WebDatabaseTrackerClient.h */; }; @@ -155,7 +152,7 @@ 9398101D0824BF01008DF038 /* WebKitLogging.h in Headers */ = {isa = PBXBuildFile; fileRef = 93AEB17D032C1735008635CE /* WebKitLogging.h */; settings = {ATTRIBUTES = (); }; }; 9398101E0824BF01008DF038 /* WebKitNSStringExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 7082F56F038EADAA00A80180 /* WebKitNSStringExtras.h */; settings = {ATTRIBUTES = (Private, ); }; }; 9398101F0824BF01008DF038 /* WebKitStatistics.h in Headers */ = {isa = PBXBuildFile; fileRef = F53444CE02E87CBA018635CA /* WebKitStatistics.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 939810200824BF01008DF038 /* WebKitStatisticsPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = F53444D202E87D4B018635CA /* WebKitStatisticsPrivate.h */; }; + 939810200824BF01008DF038 /* WebKitStatisticsPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = F53444D202E87D4B018635CA /* WebKitStatisticsPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 939810210824BF01008DF038 /* WebNSControlExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 9345DDB20365FFD0008635CE /* WebNSControlExtras.h */; }; 939810220824BF01008DF038 /* WebNSImageExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 8398847A03426FB000BC5F5E /* WebNSImageExtras.h */; }; 939810230824BF01008DF038 /* WebNSPasteboardExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = ED2B2474033A2DA800C1A526 /* WebNSPasteboardExtras.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -196,7 +193,7 @@ 9398105F0824BF01008DF038 /* WebRenderNode.h in Headers */ = {isa = PBXBuildFile; fileRef = F5F81C3902B67C26018635CA /* WebRenderNode.h */; settings = {ATTRIBUTES = (Private, ); }; }; 939810600824BF01008DF038 /* WebResourceLoadDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 513D422E034CF55A00CA2ACD /* WebResourceLoadDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; 939810630824BF01008DF038 /* WebHistoryItemInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 516F296F03A6C45A00CA2D3A /* WebHistoryItemInternal.h */; }; - 939810640824BF01008DF038 /* WebFormDelegatePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D36FD5E03F78F9E00A80166 /* WebFormDelegatePrivate.h */; }; + 939810640824BF01008DF038 /* WebFormDelegatePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D36FD5E03F78F9E00A80166 /* WebFormDelegatePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 939810650824BF01008DF038 /* CarbonWindowAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = F7EBEE9003F9DBA103CA0DE6 /* CarbonWindowAdapter.h */; }; 939810660824BF01008DF038 /* CarbonWindowContentView.h in Headers */ = {isa = PBXBuildFile; fileRef = F7EBEE9203F9DBA103CA0DE6 /* CarbonWindowContentView.h */; }; 939810670824BF01008DF038 /* CarbonWindowFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = F7EBEE9403F9DBA103CA0DE6 /* CarbonWindowFrame.h */; }; @@ -316,6 +313,13 @@ 93EB178D09F88D460091F8FF /* WebSystemInterface.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93EB178C09F88D460091F8FF /* WebSystemInterface.mm */; }; 93EB178F09F88D510091F8FF /* WebSystemInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 93EB178E09F88D510091F8FF /* WebSystemInterface.h */; }; 93FDE9330D79CAF30074F029 /* WebHistoryInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 93FDE9320D79CAF30074F029 /* WebHistoryInternal.h */; }; + A5DEFC0A11D5331C00885273 /* WebSecurityOrigin.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5DEFC0711D5331C00885273 /* WebSecurityOrigin.mm */; }; + A5DEFC0B11D5331C00885273 /* WebSecurityOriginInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = A5DEFC0811D5331C00885273 /* WebSecurityOriginInternal.h */; }; + A5DEFC0C11D5331C00885273 /* WebSecurityOriginPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = A5DEFC0911D5331C00885273 /* WebSecurityOriginPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; + A5DEFC0F11D5343E00885273 /* WebDatabaseSecurityOrigin.h in Headers */ = {isa = PBXBuildFile; fileRef = A5DEFC0D11D5343E00885273 /* WebDatabaseSecurityOrigin.h */; }; + A5DEFC1011D5343E00885273 /* WebDatabaseSecurityOrigin.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5DEFC0E11D5343E00885273 /* WebDatabaseSecurityOrigin.mm */; }; + A5DEFC1311D5344B00885273 /* WebApplicationCacheSecurityOrigin.h in Headers */ = {isa = PBXBuildFile; fileRef = A5DEFC1111D5344B00885273 /* WebApplicationCacheSecurityOrigin.h */; }; + A5DEFC1411D5344B00885273 /* WebApplicationCacheSecurityOrigin.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5DEFC1211D5344B00885273 /* WebApplicationCacheSecurityOrigin.mm */; }; A70936AF0B5608DC00CDB48E /* WebDragClient.h in Headers */ = {isa = PBXBuildFile; fileRef = A70936AD0B5608DC00CDB48E /* WebDragClient.h */; }; A70936B00B5608DC00CDB48E /* WebDragClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = A70936AE0B5608DC00CDB48E /* WebDragClient.mm */; }; A7D3C5BC0B5773C5002CA450 /* WebPasteboardHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D3C5BA0B5773C5002CA450 /* WebPasteboardHelper.h */; }; @@ -472,9 +476,6 @@ 449098B90F8F82DF0076A327 /* FeatureDefines.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = FeatureDefines.xcconfig; sourceTree = "<group>"; }; 4BF99F8E0AE050BC00815C2B /* WebEditorClient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebEditorClient.h; sourceTree = "<group>"; }; 4BF99F8F0AE050BC00815C2B /* WebEditorClient.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebEditorClient.mm; sourceTree = "<group>"; }; - 51079D140CED11B00077247D /* WebSecurityOrigin.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebSecurityOrigin.mm; sourceTree = "<group>"; }; - 51079D150CED11B00077247D /* WebSecurityOriginInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSecurityOriginInternal.h; sourceTree = "<group>"; }; - 51079D160CED11B00077247D /* WebSecurityOriginPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSecurityOriginPrivate.h; sourceTree = "<group>"; }; 511F3FD10CECC88F00852565 /* WebDatabaseManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDatabaseManager.mm; sourceTree = "<group>"; }; 511F3FD20CECC88F00852565 /* WebDatabaseManagerPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDatabaseManagerPrivate.h; sourceTree = "<group>"; }; 511F3FD30CECC88F00852565 /* WebDatabaseTrackerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDatabaseTrackerClient.h; sourceTree = "<group>"; }; @@ -607,6 +608,13 @@ 9CAE9D070252A4130ECA16EA /* WebPreferencesPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebPreferencesPrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 9CE1F8A302A5C6F30ECA2ACD /* WebImageRendererFactory.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebImageRendererFactory.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 9CF0E249021361B00ECA16EA /* WebFramePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebFramePrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; + A5DEFC0711D5331C00885273 /* WebSecurityOrigin.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebSecurityOrigin.mm; sourceTree = "<group>"; }; + A5DEFC0811D5331C00885273 /* WebSecurityOriginInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSecurityOriginInternal.h; sourceTree = "<group>"; }; + A5DEFC0911D5331C00885273 /* WebSecurityOriginPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSecurityOriginPrivate.h; sourceTree = "<group>"; }; + A5DEFC0D11D5343E00885273 /* WebDatabaseSecurityOrigin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDatabaseSecurityOrigin.h; sourceTree = "<group>"; }; + A5DEFC0E11D5343E00885273 /* WebDatabaseSecurityOrigin.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDatabaseSecurityOrigin.mm; sourceTree = "<group>"; }; + A5DEFC1111D5344B00885273 /* WebApplicationCacheSecurityOrigin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebApplicationCacheSecurityOrigin.h; sourceTree = "<group>"; }; + A5DEFC1211D5344B00885273 /* WebApplicationCacheSecurityOrigin.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebApplicationCacheSecurityOrigin.mm; sourceTree = "<group>"; }; A70936AD0B5608DC00CDB48E /* WebDragClient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebDragClient.h; sourceTree = "<group>"; }; A70936AE0B5608DC00CDB48E /* WebDragClient.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDragClient.mm; sourceTree = "<group>"; }; A7D3C5BA0B5773C5002CA450 /* WebPasteboardHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPasteboardHelper.h; sourceTree = "<group>"; }; @@ -1012,11 +1020,10 @@ 511F3FD10CECC88F00852565 /* WebDatabaseManager.mm */, 51AEDEF00CECF45700854328 /* WebDatabaseManagerInternal.h */, 511F3FD20CECC88F00852565 /* WebDatabaseManagerPrivate.h */, + A5DEFC0D11D5343E00885273 /* WebDatabaseSecurityOrigin.h */, + A5DEFC0E11D5343E00885273 /* WebDatabaseSecurityOrigin.mm */, 511F3FD30CECC88F00852565 /* WebDatabaseTrackerClient.h */, 511F3FD40CECC88F00852565 /* WebDatabaseTrackerClient.mm */, - 51079D140CED11B00077247D /* WebSecurityOrigin.mm */, - 51079D150CED11B00077247D /* WebSecurityOriginInternal.h */, - 51079D160CED11B00077247D /* WebSecurityOriginPrivate.h */, ); name = Storage; path = mac/Storage; @@ -1231,6 +1238,8 @@ children = ( B68049710FFBCEC1009F7F62 /* WebApplicationCache.h */, B68049720FFBCEC1009F7F62 /* WebApplicationCache.mm */, + A5DEFC1111D5344B00885273 /* WebApplicationCacheSecurityOrigin.h */, + A5DEFC1211D5344B00885273 /* WebApplicationCacheSecurityOrigin.mm */, 51CBFCAC0D10E6C5002DBF51 /* WebCachedFramePlatformData.h */, 14D8252D0AF955090004F057 /* WebChromeClient.h */, 14D8252E0AF955090004F057 /* WebChromeClient.mm */, @@ -1260,6 +1269,9 @@ 1AA879B511CBE9BF003C664F /* WebPlatformStrategies.mm */, 0A2D87FB107AF52B00CDDEE3 /* WebPluginHalterClient.h */, 0A2D87FC107AF52B00CDDEE3 /* WebPluginHalterClient.mm */, + A5DEFC0711D5331C00885273 /* WebSecurityOrigin.mm */, + A5DEFC0811D5331C00885273 /* WebSecurityOriginInternal.h */, + A5DEFC0911D5331C00885273 /* WebSecurityOriginPrivate.h */, 93EB178E09F88D510091F8FF /* WebSystemInterface.h */, 93EB178C09F88D460091F8FF /* WebSystemInterface.mm */, F5F7174C02885C5B018635CA /* WebViewFactory.h */, @@ -1535,8 +1547,6 @@ C0167BF80D7F5DD00028696E /* WebScriptDebugger.h in Headers */, C0B1F7E810AC8E3100C925D9 /* WebScriptWorld.h in Headers */, C0B1F7EA10AC8E3100C925D9 /* WebScriptWorldInternal.h in Headers */, - 51079D180CED11B00077247D /* WebSecurityOriginInternal.h in Headers */, - 51079D190CED11B00077247D /* WebSecurityOriginPrivate.h in Headers */, BC26C69E10B743F400B687ED /* WebSerializedJSValue.h in Headers */, 939810270824BF01008DF038 /* WebStringTruncator.h in Headers */, 93EB178F09F88D510091F8FF /* WebSystemInterface.h in Headers */, @@ -1557,6 +1567,10 @@ 939810710824BF01008DF038 /* WebViewPrivate.h in Headers */, 0FD3B0F81076C3F700039B96 /* WebWindowAnimation.h in Headers */, 41F4484F10338E8C0030E55E /* WebWorkersPrivate.h in Headers */, + A5DEFC0B11D5331C00885273 /* WebSecurityOriginInternal.h in Headers */, + A5DEFC0C11D5331C00885273 /* WebSecurityOriginPrivate.h in Headers */, + A5DEFC0F11D5343E00885273 /* WebDatabaseSecurityOrigin.h in Headers */, + A5DEFC1311D5344B00885273 /* WebApplicationCacheSecurityOrigin.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1899,7 +1913,6 @@ 7E6FEF0908985A7200C44C3F /* WebScriptDebugDelegate.mm in Sources */, C0167BF90D7F5DD00028696E /* WebScriptDebugger.mm in Sources */, C0B1F7E910AC8E3100C925D9 /* WebScriptWorld.mm in Sources */, - 51079D170CED11B00077247D /* WebSecurityOrigin.mm in Sources */, BC26C6A510B7447A00B687ED /* WebSerializedJSValue.mm in Sources */, 939810CC0824BF01008DF038 /* WebStringTruncator.mm in Sources */, 93EB178D09F88D460091F8FF /* WebSystemInterface.mm in Sources */, @@ -1916,6 +1929,9 @@ 939810E80824BF01008DF038 /* WebViewFactory.mm in Sources */, 0FD3B0F91076C3F700039B96 /* WebWindowAnimation.m in Sources */, 41F4485010338E8C0030E55E /* WebWorkersPrivate.mm in Sources */, + A5DEFC0A11D5331C00885273 /* WebSecurityOrigin.mm in Sources */, + A5DEFC1011D5343E00885273 /* WebDatabaseSecurityOrigin.mm in Sources */, + A5DEFC1411D5344B00885273 /* WebApplicationCacheSecurityOrigin.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog index 2c720e1..9a33ade 100644 --- a/WebKit/chromium/ChangeLog +++ b/WebKit/chromium/ChangeLog @@ -1,3 +1,252 @@ +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu + instances, concrete classes that inherit from ChromeClient needed to be changed to + implement the new methods. + + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::selectItemWritingDirectionIsNatural): + (WebKit::ChromeClientImpl::createPopupMenu): + (WebKit::ChromeClientImpl::createSearchPopupMenu): + * src/ChromeClientImpl.h: + +2010-08-02 Kent Tamura <tkent@chromium.org> + + Reviewed by Dimitri Glazkov. + + [DRT/Chromium] Always initialize GTK + https://bugs.webkit.org/show_bug.cgi?id=43327 + + * WebKit.gyp: Add GTK dependency for DRT. + +2010-08-02 Jeremy Orlow <jorlow@chromium.org> + + Speculative revert of 64425 due to Chromium instability + https://bugs.webkit.org/show_bug.cgi?id=43347 + + * src/ChromeClientImpl.cpp: + * src/ChromeClientImpl.h: + * tests/PopupMenuTest.cpp: + (WebKit::SelectPopupMenuTest::SetUp): + +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu + instances, concrete classes that inherit from ChromeClient needed to be changed to + implement the new methods. + + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::selectItemWritingDirectionIsNatural): + (WebKit::ChromeClientImpl::createPopupMenu): + (WebKit::ChromeClientImpl::createSearchPopupMenu): + * src/ChromeClientImpl.h: + +2010-07-31 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r64422. + http://trac.webkit.org/changeset/64422 + https://bugs.webkit.org/show_bug.cgi?id=43304 + + Build fixes are needed for Snow Leopard and Windows. + (Requested by lca on #webkit). + + * src/ChromeClientImpl.cpp: + * src/ChromeClientImpl.h: + +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu + instances, concrete classes that inherit from ChromeClient needed to be changed to + implement the new methods. + + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::selectItemWritingDirectionIsNatural): + (WebKit::ChromeClientImpl::createPopupMenu): + (WebKit::ChromeClientImpl::createSearchPopupMenu): + * src/ChromeClientImpl.h: + +2010-07-30 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by David Kilzer. + + Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas) + https://bugs.webkit.org/show_bug.cgi?id=40627 + + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::reachedApplicationCacheOriginQuota): + * src/ChromeClientImpl.h: + +2010-07-30 James Robinson <jamesr@chromium.org> + + Compile fix. Put GLES2 functions behind USE(GLES2_RENDERING) instead of + USE(ACCELERATED_COMPOSITING) to match WebCore. Fixes the compile when + USE(GLES2_RENDERING) is true and USE(ACCELERATED_COMPOSITING) is false. + + * src/ChromeClientImpl.cpp: + * src/ChromeClientImpl.h: + +2010-07-27 Darin Fisher <darin@chromium.org> + + Reviewed by Brady Eidson. + + History.pushState() + navigation operates on top frame when called from + nested context + https://bugs.webkit.org/show_bug.cgi?id=43080 + + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::pluginLoadObserver): The WebDataSource + can be null if the Frame has already been detached from the Page. This + happens if a popstate event handler removes the frame. + +2010-07-29 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Steve Block. + + Rename all the IDBIndex classses to match the latest conventions + https://bugs.webkit.org/show_bug.cgi?id=43190 + + Fix up stuff in WebKit layer to handle the renamings in WebCore. + + * WebKit.gyp: + * src/IDBCallbacksProxy.cpp: + (WebCore::IDBCallbacksProxy::onSuccess): + * src/IDBCallbacksProxy.h: + * src/IDBIndexBackendProxy.cpp: Added. + (WebCore::IDBIndexBackendProxy::create): + (WebCore::IDBIndexBackendProxy::IDBIndexBackendProxy): + (WebCore::IDBIndexBackendProxy::~IDBIndexBackendProxy): + (WebCore::IDBIndexBackendProxy::name): + (WebCore::IDBIndexBackendProxy::keyPath): + (WebCore::IDBIndexBackendProxy::unique): + * src/IDBIndexBackendProxy.h: Added. + * src/IDBIndexProxy.cpp: Removed. + * src/IDBIndexProxy.h: Removed. + * src/IDBObjectStoreProxy.cpp: + (WebCore::IDBObjectStoreProxy::index): + * src/IDBObjectStoreProxy.h: + * src/WebIDBCallbacksImpl.cpp: + (WebCore::WebIDBCallbacksImpl::onSuccess): + * src/WebIDBIndexImpl.cpp: + (WebKit::WebIDBIndexImpl::WebIDBIndexImpl): + (WebKit::WebIDBIndexImpl::name): + (WebKit::WebIDBIndexImpl::keyPath): + (WebKit::WebIDBIndexImpl::unique): + * src/WebIDBIndexImpl.h: + * src/WebIDBObjectStoreImpl.cpp: + (WebKit::WebIDBObjectStoreImpl::index): + +2010-07-30 Satish Sampath <satish@chromium.org> + + Reviewed by Jeremy Orlow. + + Add a check for WebViewClient being null. + https://bugs.webkit.org/show_bug.cgi?id=43240 + + * src/SpeechInputClientImpl.cpp: + (WebKit::SpeechInputClientImpl::SpeechInputClientImpl): + +2010-07-30 Hans Wennborg <hans@chromium.org> + + Reviewed by Steve Block. + + Disable runtime switch for device orientation in chromium + https://bugs.webkit.org/show_bug.cgi?id=43237 + + Explicitly set the runtime switch for device orientation + in WebView::create until we implement the feature. + If the flag is accidentally on while no DeviceOrientationClient + is provided, the program will crash. + + * src/WebViewImpl.cpp: + (WebKit::WebView::create): + +2010-07-26 Andrei Popescu <andreip@google.com> + + Reviewed by Jeremy Orlow. + + [IndexedDB] IndexedDatabase should be called IDBFactory. + https://bugs.webkit.org/show_bug.cgi?id=42967 + + * WebKit.gyp: + * public/WebIDBFactory.h: Added. + (WebKit::WebIDBFactory::~WebIDBFactory): + (WebKit::WebIDBFactory::databases): + (WebKit::WebIDBFactory::open): + * public/WebIndexedDatabase.h: Removed. + * public/WebKitClient.h: + (WebKit::WebKitClient::idbFactory): + * src/ChromiumBridge.cpp: + (WebCore::ChromiumBridge::idbFactory): + * src/IDBFactoryBackendProxy.cpp: Added. + (WebCore::IDBFactoryBackendProxy::create): + (WebCore::IDBFactoryBackendProxy::IDBFactoryBackendProxy): + (WebCore::IDBFactoryBackendProxy::~IDBFactoryBackendProxy): + (WebCore::IDBFactoryBackendProxy::open): + * src/IDBFactoryBackendProxy.h: Added. + * src/IndexedDatabaseProxy.cpp: Removed. + * src/IndexedDatabaseProxy.h: Removed. + * src/WebIDBFactoryImpl.cpp: Added. + (WebKit::WebIDBFactory::create): + (WebKit::WebIDBFactoryImpl::WebIDBFactoryImpl): + (WebKit::WebIDBFactoryImpl::~WebIDBFactoryImpl): + (WebKit::WebIDBFactoryImpl::open): + * src/WebIDBFactoryImpl.h: Added. + * src/WebIndexedDatabaseImpl.cpp: Removed. + * src/WebIndexedDatabaseImpl.h: Removed. + +2010-07-29 Andrei Popescu <andreip@google.com> + + Reviewed by Jeremy Orlow. + + [IndexedDB] WebDOMStringList ctor is not exported and causes link errors for the multi-dll chromium build + https://bugs.webkit.org/show_bug.cgi?id=43186 + + Add WEBKIT_API to WebDOMStringList default ctor. + + * public/WebDOMStringList.h: + +2010-07-29 Satish Sampath <satish@chromium.org> + + Reviewed by Steve Block. + + Runtime feature switch for speech input + https://bugs.webkit.org/show_bug.cgi?id=43146 + + Add a runtime feature switch that decides whether speech input attributes are available or not. + Defaults to true. + + * public/WebRuntimeFeatures.h: + * src/SpeechInputClientImpl.cpp: + (WebKit::SpeechInputClientImpl::SpeechInputClientImpl): + * src/WebRuntimeFeatures.cpp: + (WebKit::WebRuntimeFeatures::enableSpeechInput): + (WebKit::WebRuntimeFeatures::isSpeechInputEnabled): + +2010-07-28 Kavita Kanetkar <kkanetkar@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: Enable UI for chromium's appcache inspection. + https://bugs.webkit.org/show_bug.cgi?id=43098 + + * src/js/DevTools.js: + (WebInspector.loaded): + 2010-07-28 Dominic Mazzoni <dmazzoni@google.com> Reviewed by Dimitri Glazkov. diff --git a/WebKit/chromium/WebKit.gyp b/WebKit/chromium/WebKit.gyp index 97efddc..10f01e5 100644 --- a/WebKit/chromium/WebKit.gyp +++ b/WebKit/chromium/WebKit.gyp @@ -178,10 +178,10 @@ 'public/WebIDBCallbacks.h', 'public/WebIDBDatabase.h', 'public/WebIDBDatabaseError.h', + 'public/WebIDBFactory.h', 'public/WebIDBIndex.h', 'public/WebIDBKey.h', 'public/WebIDBObjectStore.h', - 'public/WebIndexedDatabase.h', 'public/WebInputElement.h', 'public/WebInputEvent.h', 'public/WebKit.h', @@ -321,12 +321,12 @@ 'src/IDBCallbacksProxy.h', 'src/IDBDatabaseProxy.cpp', 'src/IDBDatabaseProxy.h', - 'src/IDBIndexProxy.cpp', - 'src/IDBIndexProxy.h', + 'src/IDBFactoryBackendProxy.cpp', + 'src/IDBFactoryBackendProxy.h', + 'src/IDBIndexBackendProxy.cpp', + 'src/IDBIndexBackendProxy.h', 'src/IDBObjectStoreProxy.cpp', 'src/IDBObjectStoreProxy.h', - 'src/IndexedDatabaseProxy.cpp', - 'src/IndexedDatabaseProxy.h', 'src/InspectorClientImpl.cpp', 'src/InspectorClientImpl.h', 'src/InspectorFrontendClientImpl.cpp', @@ -417,6 +417,8 @@ 'src/WebIDBDatabaseError.cpp', 'src/WebIDBDatabaseImpl.cpp', 'src/WebIDBDatabaseImpl.h', + 'src/WebIDBFactoryImpl.cpp', + 'src/WebIDBFactoryImpl.h', 'src/WebIDBIndexImpl.cpp', 'src/WebIDBIndexImpl.h', 'src/WebIDBKey.cpp', @@ -425,8 +427,6 @@ 'src/WebImageCG.cpp', 'src/WebImageDecoder.cpp', 'src/WebImageSkia.cpp', - 'src/WebIndexedDatabaseImpl.cpp', - 'src/WebIndexedDatabaseImpl.h', 'src/WebInputElement.cpp', 'src/WebInputEvent.cpp', 'src/WebInputEventConversion.cpp', @@ -854,6 +854,13 @@ ] }], ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', { + 'dependencies': [ + '<(chromium_src_dir)/build/linux/system.gyp:fontconfig', + '<(chromium_src_dir)/build/linux/system.gyp:gtk', + ], + 'include_dirs': [ + 'public/gtk', + ], 'copies': [{ 'destination': '<(PRODUCT_DIR)', 'files': [ diff --git a/WebKit/chromium/public/WebDOMStringList.h b/WebKit/chromium/public/WebDOMStringList.h index d88fcee..dabf1b7 100644 --- a/WebKit/chromium/public/WebDOMStringList.h +++ b/WebKit/chromium/public/WebDOMStringList.h @@ -46,7 +46,7 @@ class WebDOMStringList { public: ~WebDOMStringList() { reset(); } - WebDOMStringList(); + WEBKIT_API WebDOMStringList(); WebDOMStringList(const WebDOMStringList& l) { assign(l); } WebDOMStringList& operator=(const WebDOMStringList& l) { diff --git a/WebKit/chromium/public/WebIndexedDatabase.h b/WebKit/chromium/public/WebIDBFactory.h index 5517a0c..5eb6f58 100644..100755 --- a/WebKit/chromium/public/WebIndexedDatabase.h +++ b/WebKit/chromium/public/WebIDBFactory.h @@ -26,10 +26,11 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebIndexedDatabase_h -#define WebIndexedDatabase_h +#ifndef WebIDBFactory_h +#define WebIDBFactory_h #include "WebCommon.h" +#include "WebDOMStringList.h" #include "WebIDBCallbacks.h" #include "WebSecurityOrigin.h" #include "WebString.h" @@ -41,14 +42,14 @@ class WebIDBDatabase; class WebString; class WebSecurityOrigin; -// The entry point into the IndexedDatabase API. These classes match their _____Request and -// _____Sync counterparts in the spec, but operate only in an async manner. +// The entry point into the IndexedDatabase API. These classes match their Foo and +// FooSync counterparts in the spec, but operate only in an async manner. // http://dev.w3.org/2006/webapi/WebSimpleDB/ -class WebIndexedDatabase { +class WebIDBFactory { public: - WEBKIT_API static WebIndexedDatabase* create(); + WEBKIT_API static WebIDBFactory* create(); - virtual ~WebIndexedDatabase() { } + virtual ~WebIDBFactory() { } // The WebKit implementation of open ignores the WebFrame* parameter. virtual void open(const WebString& name, const WebString& description, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame* webFrame) @@ -66,4 +67,4 @@ public: } // namespace WebKit -#endif // WebIndexedDatabase_h +#endif // WebIDBFactory_h diff --git a/WebKit/chromium/public/WebKitClient.h b/WebKit/chromium/public/WebKitClient.h index 48765ac..5959a1c 100644 --- a/WebKit/chromium/public/WebKitClient.h +++ b/WebKit/chromium/public/WebKitClient.h @@ -52,7 +52,7 @@ class WebCookieJar; class WebFileSystem; class WebGLES2Context; class WebGraphicsContext3D; -class WebIndexedDatabase; +class WebIDBFactory; class WebMessagePortChannel; class WebMimeRegistry; class WebPluginListBuilder; @@ -131,7 +131,7 @@ public: // Indexed Database ---------------------------------------------------- - virtual WebIndexedDatabase* indexedDatabase() { return 0; } + virtual WebIDBFactory* idbFactory() { return 0; } // Keygen -------------------------------------------------------------- diff --git a/WebKit/chromium/public/WebRuntimeFeatures.h b/WebKit/chromium/public/WebRuntimeFeatures.h index 95307a2..517aad5 100644 --- a/WebKit/chromium/public/WebRuntimeFeatures.h +++ b/WebKit/chromium/public/WebRuntimeFeatures.h @@ -80,6 +80,9 @@ public: WEBKIT_API static void enableDeviceOrientation(bool); WEBKIT_API static bool isDeviceOrientationEnabled(); + WEBKIT_API static void enableSpeechInput(bool); + WEBKIT_API static bool isSpeechInputEnabled(); + private: WebRuntimeFeatures(); }; diff --git a/WebKit/chromium/src/ChromeClientImpl.cpp b/WebKit/chromium/src/ChromeClientImpl.cpp index d43d88a..2a5c32e 100644 --- a/WebKit/chromium/src/ChromeClientImpl.cpp +++ b/WebKit/chromium/src/ChromeClientImpl.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2009 Google Inc. All rights reserved. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -55,7 +56,9 @@ #include "NotificationPresenterImpl.h" #include "Page.h" #include "PopupMenuChromium.h" +#include "SearchPopupMenuChromium.h" #include "ScriptController.h" +#include "SecurityOrigin.h" #include "WebGeolocationService.h" #if USE(V8) #include "V8Proxy.h" @@ -579,6 +582,11 @@ void ChromeClientImpl::reachedMaxAppCacheSize(int64_t spaceNeeded) { ASSERT_NOT_REACHED(); } + +void ChromeClientImpl::reachedApplicationCacheOriginQuota(SecurityOrigin*) +{ + ASSERT_NOT_REACHED(); +} #endif void ChromeClientImpl::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> fileChooser) @@ -734,7 +742,9 @@ void ChromeClientImpl::scheduleCompositingLayerSync() { m_webView->setRootLayerNeedsDisplay(); } +#endif +#if USE(GLES2_RENDERING) PassOwnPtr<GLES2Context> ChromeClientImpl::getOnscreenGLES2Context() { return m_webView->getOnscreenGLES2Context(); @@ -765,4 +775,19 @@ void ChromeClientImpl::exitFullscreenForNode(WebCore::Node* node) m_webView->client()->exitFullscreenForNode(WebNode(node)); } +bool ChromeClientImpl::selectItemWritingDirectionIsNatural() +{ + return false; +} + +PassRefPtr<PopupMenu> ChromeClientImpl::createPopupMenu(PopupMenuClient* client) const +{ + return adoptRef(new PopupMenuChromium(client)); +} + +PassRefPtr<SearchPopupMenu> ChromeClientImpl::createSearchPopupMenu(PopupMenuClient* client) const +{ + return adoptRef(new SearchPopupMenuChromium(client)); +} + } // namespace WebKit diff --git a/WebKit/chromium/src/ChromeClientImpl.h b/WebKit/chromium/src/ChromeClientImpl.h index e824381..7f3febf 100644 --- a/WebKit/chromium/src/ChromeClientImpl.h +++ b/WebKit/chromium/src/ChromeClientImpl.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2009 Google Inc. All rights reserved. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -32,12 +33,15 @@ #define ChromeClientImpl_h #include "ChromeClientChromium.h" +#include "PopupMenu.h" +#include "SearchPopupMenu.h" namespace WebCore { class AccessibilityObject; class FileChooser; class HTMLParserQuirks; class PopupContainer; +class PopupMenuClient; class SecurityOrigin; struct WindowFeatures; } @@ -118,6 +122,7 @@ public: WebCore::Frame*, const WebCore::String& databaseName); #if ENABLE(OFFLINE_WEB_APPLICATIONS) virtual void reachedMaxAppCacheSize(int64_t spaceNeeded); + virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*); #endif #if ENABLE(NOTIFICATIONS) virtual WebCore::NotificationPresenter* notificationPresenter() const; @@ -145,7 +150,9 @@ public: // Sets a flag to specify that the view needs to be updated, so we need // to do an eager layout before the drawing. virtual void scheduleCompositingLayerSync(); +#endif +#if USE(GLES2_RENDERING) virtual PassOwnPtr<WebCore::GLES2Context> getOnscreenGLES2Context(); virtual PassOwnPtr<WebCore::GLES2Context> getOffscreenGLES2Context(); #endif @@ -165,6 +172,10 @@ public: void setCursor(const WebCursorInfo& cursor); void setCursorForPlugin(const WebCursorInfo& cursor); + virtual bool selectItemWritingDirectionIsNatural(); + virtual PassRefPtr<WebCore::PopupMenu> createPopupMenu(WebCore::PopupMenuClient*) const; + virtual PassRefPtr<WebCore::SearchPopupMenu> createSearchPopupMenu(WebCore::PopupMenuClient*) const; + private: void getPopupMenuInfo(WebCore::PopupContainer*, WebPopupMenuInfo*); diff --git a/WebKit/chromium/src/ChromiumBridge.cpp b/WebKit/chromium/src/ChromiumBridge.cpp index 78e0693..397ea17 100644 --- a/WebKit/chromium/src/ChromiumBridge.cpp +++ b/WebKit/chromium/src/ChromiumBridge.cpp @@ -77,7 +77,7 @@ #include "Cookie.h" #include "FrameView.h" #include "GraphicsContext.h" -#include "IndexedDatabaseProxy.h" +#include "IDBFactoryBackendProxy.h" #include "KURL.h" #include "NotImplemented.h" #include "PlatformContextSkia.h" @@ -493,11 +493,11 @@ long long ChromiumBridge::databaseGetFileSize(const String& vfsFileName) // Indexed Database ----------------------------------------------------------- -PassRefPtr<IndexedDatabase> ChromiumBridge::indexedDatabase() +PassRefPtr<IDBFactoryBackendInterface> ChromiumBridge::idbFactory() { // There's no reason why we need to allocate a new proxy each time, but // there's also no strong reason not to. - return IndexedDatabaseProxy::create(); + return IDBFactoryBackendProxy::create(); } // Keygen --------------------------------------------------------------------- diff --git a/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/WebKit/chromium/src/FrameLoaderClientImpl.cpp index dae9348..b416e35 100644 --- a/WebKit/chromium/src/FrameLoaderClientImpl.cpp +++ b/WebKit/chromium/src/FrameLoaderClientImpl.cpp @@ -1488,6 +1488,12 @@ PassOwnPtr<WebPluginLoadObserver> FrameLoaderClientImpl::pluginLoadObserver() { WebDataSourceImpl* ds = WebDataSourceImpl::fromDocumentLoader( m_webFrame->frame()->loader()->activeDocumentLoader()); + if (!ds) { + // We can arrive here if a popstate event handler detaches this frame. + // FIXME: Remove this code once http://webkit.org/b/36202 is fixed. + ASSERT(!m_webFrame->frame()->page()); + return 0; + } return ds->releasePluginLoadObserver(); } diff --git a/WebKit/chromium/src/IDBCallbacksProxy.cpp b/WebKit/chromium/src/IDBCallbacksProxy.cpp index 3591bee..4489e9b 100644 --- a/WebKit/chromium/src/IDBCallbacksProxy.cpp +++ b/WebKit/chromium/src/IDBCallbacksProxy.cpp @@ -75,9 +75,9 @@ void IDBCallbacksProxy::onSuccess(PassRefPtr<IDBDatabase> idbDatabase) m_callbacks.clear(); } -void IDBCallbacksProxy::onSuccess(PassRefPtr<IDBIndex> idbIndex) +void IDBCallbacksProxy::onSuccess(PassRefPtr<IDBIndexBackendInterface> backend) { - m_callbacks->onSuccess(new WebKit::WebIDBIndexImpl(idbIndex)); + m_callbacks->onSuccess(new WebKit::WebIDBIndexImpl(backend)); m_callbacks.clear(); } diff --git a/WebKit/chromium/src/IDBCallbacksProxy.h b/WebKit/chromium/src/IDBCallbacksProxy.h index c5a8858..10fc31a 100644 --- a/WebKit/chromium/src/IDBCallbacksProxy.h +++ b/WebKit/chromium/src/IDBCallbacksProxy.h @@ -50,7 +50,7 @@ public: virtual void onError(PassRefPtr<IDBDatabaseError>); virtual void onSuccess(); // For "null". virtual void onSuccess(PassRefPtr<IDBDatabase>); - virtual void onSuccess(PassRefPtr<IDBIndex>); + virtual void onSuccess(PassRefPtr<IDBIndexBackendInterface>); virtual void onSuccess(PassRefPtr<IDBKey>); virtual void onSuccess(PassRefPtr<IDBObjectStore>); virtual void onSuccess(PassRefPtr<SerializedScriptValue>); diff --git a/WebKit/chromium/src/IndexedDatabaseProxy.cpp b/WebKit/chromium/src/IDBFactoryBackendProxy.cpp index bee99b2..44cbb40 100644..100755 --- a/WebKit/chromium/src/IndexedDatabaseProxy.cpp +++ b/WebKit/chromium/src/IDBFactoryBackendProxy.cpp @@ -27,15 +27,16 @@ */ #include "config.h" -#include "IndexedDatabaseProxy.h" +#include "IDBFactoryBackendProxy.h" +#include "DOMStringList.h" #include "IDBDatabaseError.h" #include "IDBDatabaseProxy.h" #include "WebFrameImpl.h" #include "WebIDBCallbacksImpl.h" #include "WebIDBDatabase.h" #include "WebIDBDatabaseError.h" -#include "WebIndexedDatabase.h" +#include "WebIDBFactory.h" #include "WebKit.h" #include "WebKitClient.h" @@ -43,24 +44,24 @@ namespace WebCore { -PassRefPtr<IndexedDatabase> IndexedDatabaseProxy::create() +PassRefPtr<IDBFactoryBackendInterface> IDBFactoryBackendProxy::create() { - return adoptRef(new IndexedDatabaseProxy()); + return adoptRef(new IDBFactoryBackendProxy()); } -IndexedDatabaseProxy::IndexedDatabaseProxy() - : m_webIndexedDatabase(WebKit::webKitClient()->indexedDatabase()) +IDBFactoryBackendProxy::IDBFactoryBackendProxy() + : m_webIDBFactory(WebKit::webKitClient()->idbFactory()) { } -IndexedDatabaseProxy::~IndexedDatabaseProxy() +IDBFactoryBackendProxy::~IDBFactoryBackendProxy() { } -void IndexedDatabaseProxy::open(const String& name, const String& description, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin> origin, Frame* frame) +void IDBFactoryBackendProxy::open(const String& name, const String& description, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin> origin, Frame* frame) { WebKit::WebFrame* webFrame = WebKit::WebFrameImpl::fromFrame(frame); - m_webIndexedDatabase->open(name, description, new WebIDBCallbacksImpl(callbacks), origin, webFrame); + m_webIDBFactory->open(name, description, new WebIDBCallbacksImpl(callbacks), origin, webFrame); } } // namespace WebCore diff --git a/WebKit/chromium/src/IndexedDatabaseProxy.h b/WebKit/chromium/src/IDBFactoryBackendProxy.h index 53097f0..969a9d7 100644..100755 --- a/WebKit/chromium/src/IndexedDatabaseProxy.h +++ b/WebKit/chromium/src/IDBFactoryBackendProxy.h @@ -26,34 +26,37 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef IndexedDatabaseProxy_h -#define IndexedDatabaseProxy_h +#ifndef IDBFactoryBackendProxy_h +#define IDBFactoryBackendProxy_h -#include "IndexedDatabase.h" +#include "IDBFactoryBackendInterface.h" #if ENABLE(INDEXED_DATABASE) -namespace WebKit { class WebIndexedDatabase; } +namespace WebKit { class WebIDBFactory; } namespace WebCore { -class IndexedDatabaseProxy : public IndexedDatabase { +class DOMStringList; + +class IDBFactoryBackendProxy : public IDBFactoryBackendInterface { public: - static PassRefPtr<IndexedDatabase> create(); - virtual ~IndexedDatabaseProxy(); + static PassRefPtr<IDBFactoryBackendInterface> create(); + virtual ~IDBFactoryBackendProxy(); + PassRefPtr<DOMStringList> databases(void) const; virtual void open(const String& name, const String& description, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*); private: - IndexedDatabaseProxy(); + IDBFactoryBackendProxy(); // We don't own this pointer (unlike all the other proxy classes which do). - WebKit::WebIndexedDatabase* m_webIndexedDatabase; + WebKit::WebIDBFactory* m_webIDBFactory; }; } // namespace WebCore #endif -#endif // IndexedDatabaseProxy_h +#endif // IDBFactoryBackendProxy_h diff --git a/WebKit/chromium/src/IDBIndexProxy.cpp b/WebKit/chromium/src/IDBIndexBackendProxy.cpp index f80eff3..5f1b9d9 100644 --- a/WebKit/chromium/src/IDBIndexProxy.cpp +++ b/WebKit/chromium/src/IDBIndexBackendProxy.cpp @@ -24,7 +24,7 @@ */ #include "config.h" -#include "IDBIndexProxy.h" +#include "IDBIndexBackendProxy.h" #include "WebIDBDatabaseError.h" #include "WebIDBIndex.h" @@ -33,31 +33,31 @@ namespace WebCore { -PassRefPtr<IDBIndex> IDBIndexProxy::create(PassOwnPtr<WebKit::WebIDBIndex> Index) +PassRefPtr<IDBIndexBackendInterface> IDBIndexBackendProxy::create(PassOwnPtr<WebKit::WebIDBIndex> index) { - return adoptRef(new IDBIndexProxy(Index)); + return adoptRef(new IDBIndexBackendProxy(index)); } -IDBIndexProxy::IDBIndexProxy(PassOwnPtr<WebKit::WebIDBIndex> Index) - : m_webIDBIndex(Index) +IDBIndexBackendProxy::IDBIndexBackendProxy(PassOwnPtr<WebKit::WebIDBIndex> index) + : m_webIDBIndex(index) { } -IDBIndexProxy::~IDBIndexProxy() +IDBIndexBackendProxy::~IDBIndexBackendProxy() { } -String IDBIndexProxy::name() +String IDBIndexBackendProxy::name() { return m_webIDBIndex->name(); } -String IDBIndexProxy::keyPath() +String IDBIndexBackendProxy::keyPath() { return m_webIDBIndex->keyPath(); } -bool IDBIndexProxy::unique() +bool IDBIndexBackendProxy::unique() { return m_webIDBIndex->unique(); } diff --git a/WebKit/chromium/src/IDBIndexProxy.h b/WebKit/chromium/src/IDBIndexBackendProxy.h index 35e6b30..1b378dd 100644 --- a/WebKit/chromium/src/IDBIndexProxy.h +++ b/WebKit/chromium/src/IDBIndexBackendProxy.h @@ -23,13 +23,12 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef IDBIndexProxy_h -#define IDBIndexProxy_h +#ifndef IDBIndexBackendProxy_h +#define IDBIndexBackendProxy_h -#include "IDBIndex.h" +#include "IDBIndexBackendInterface.h" #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> -#include <wtf/PassRefPtr.h> #if ENABLE(INDEXED_DATABASE) @@ -37,10 +36,10 @@ namespace WebKit { class WebIDBIndex; } namespace WebCore { -class IDBIndexProxy : public IDBIndex { +class IDBIndexBackendProxy : public IDBIndexBackendInterface { public: - static PassRefPtr<IDBIndex> create(PassOwnPtr<WebKit::WebIDBIndex>); - virtual ~IDBIndexProxy(); + static PassRefPtr<IDBIndexBackendInterface> create(PassOwnPtr<WebKit::WebIDBIndex>); + virtual ~IDBIndexBackendProxy(); virtual String name(); virtual String keyPath(); @@ -49,7 +48,7 @@ public: // FIXME: Add other methods. private: - IDBIndexProxy(PassOwnPtr<WebKit::WebIDBIndex>); + IDBIndexBackendProxy(PassOwnPtr<WebKit::WebIDBIndex>); OwnPtr<WebKit::WebIDBIndex> m_webIDBIndex; }; @@ -58,4 +57,4 @@ private: #endif -#endif // IDBIndexProxy_h +#endif // IDBIndexBackendProxy_h diff --git a/WebKit/chromium/src/IDBObjectStoreProxy.cpp b/WebKit/chromium/src/IDBObjectStoreProxy.cpp index cec4ed3..858ed20 100755 --- a/WebKit/chromium/src/IDBObjectStoreProxy.cpp +++ b/WebKit/chromium/src/IDBObjectStoreProxy.cpp @@ -28,7 +28,7 @@ #include "DOMStringList.h" #include "IDBCallbacks.h" -#include "IDBIndexProxy.h" +#include "IDBIndexBackendProxy.h" #include "WebIDBCallbacksImpl.h" #include "WebIDBIndex.h" #include "WebIDBKey.h" @@ -88,12 +88,12 @@ void IDBObjectStoreProxy::createIndex(const String& name, const String& keyPath, m_webIDBObjectStore->createIndex(name, keyPath, unique, new WebIDBCallbacksImpl(callbacks)); } -PassRefPtr<IDBIndex> IDBObjectStoreProxy::index(const String& name) +PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreProxy::index(const String& name) { WebKit::WebIDBIndex* index = m_webIDBObjectStore->index(name); if (!index) return 0; - return IDBIndexProxy::create(index); + return IDBIndexBackendProxy::create(index); } void IDBObjectStoreProxy::removeIndex(const String& name, PassRefPtr<IDBCallbacks> callbacks) diff --git a/WebKit/chromium/src/IDBObjectStoreProxy.h b/WebKit/chromium/src/IDBObjectStoreProxy.h index b8e4a01..b380bdc 100755 --- a/WebKit/chromium/src/IDBObjectStoreProxy.h +++ b/WebKit/chromium/src/IDBObjectStoreProxy.h @@ -37,9 +37,6 @@ namespace WebKit { class WebIDBObjectStore; } namespace WebCore { -class DOMStringList; -class IDBIndex; - class IDBObjectStoreProxy : public IDBObjectStore { public: static PassRefPtr<IDBObjectStore> create(PassOwnPtr<WebKit::WebIDBObjectStore>); @@ -54,7 +51,7 @@ public: void remove(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks>); void createIndex(const String& name, const String& keyPath, bool unique, PassRefPtr<IDBCallbacks>); - PassRefPtr<IDBIndex> index(const String& name); + PassRefPtr<IDBIndexBackendInterface> index(const String& name); void removeIndex(const String& name, PassRefPtr<IDBCallbacks>); private: diff --git a/WebKit/chromium/src/SpeechInputClientImpl.cpp b/WebKit/chromium/src/SpeechInputClientImpl.cpp index 8bccacf..66525e3 100644 --- a/WebKit/chromium/src/SpeechInputClientImpl.cpp +++ b/WebKit/chromium/src/SpeechInputClientImpl.cpp @@ -42,10 +42,9 @@ namespace WebKit { SpeechInputClientImpl::SpeechInputClientImpl(WebViewClient* web_view_client) - : m_controller(web_view_client->speechInputController(this)) + : m_controller(web_view_client ? web_view_client->speechInputController(this) : 0) , m_listener(0) { - ASSERT(m_controller); } SpeechInputClientImpl::~SpeechInputClientImpl() diff --git a/WebKit/chromium/src/WebIDBCallbacksImpl.cpp b/WebKit/chromium/src/WebIDBCallbacksImpl.cpp index 21c9eed..dbf7d85 100644 --- a/WebKit/chromium/src/WebIDBCallbacksImpl.cpp +++ b/WebKit/chromium/src/WebIDBCallbacksImpl.cpp @@ -29,7 +29,7 @@ #include "IDBCallbacks.h" #include "IDBDatabaseError.h" #include "IDBDatabaseProxy.h" -#include "IDBIndexProxy.h" +#include "IDBIndexBackendProxy.h" #include "IDBKey.h" #include "IDBObjectStoreProxy.h" #include "WebIDBCallbacks.h" @@ -79,7 +79,7 @@ void WebIDBCallbacksImpl::onSuccess(const WebKit::WebIDBKey& key) void WebIDBCallbacksImpl::onSuccess(WebKit::WebIDBIndex* webKitInstance) { - m_callbacks->onSuccess(IDBIndexProxy::create(webKitInstance)); + m_callbacks->onSuccess(IDBIndexBackendProxy::create(webKitInstance)); m_callbacks.clear(); } diff --git a/WebKit/chromium/src/WebIndexedDatabaseImpl.cpp b/WebKit/chromium/src/WebIDBFactoryImpl.cpp index 27a6247..5ac89f4 100644..100755 --- a/WebKit/chromium/src/WebIndexedDatabaseImpl.cpp +++ b/WebKit/chromium/src/WebIDBFactoryImpl.cpp @@ -29,10 +29,11 @@ */ #include "config.h" -#include "WebIndexedDatabaseImpl.h" +#include "WebIDBFactoryImpl.h" +#include "DOMStringList.h" #include "IDBCallbacksProxy.h" -#include "IndexedDatabaseImpl.h" +#include "IDBFactoryBackendImpl.h" #include "SecurityOrigin.h" #include "WebIDBDatabaseError.h" #include <wtf/OwnPtr.h> @@ -43,23 +44,23 @@ using namespace WebCore; namespace WebKit { -WebIndexedDatabase* WebIndexedDatabase::create() +WebIDBFactory* WebIDBFactory::create() { - return new WebIndexedDatabaseImpl(); + return new WebIDBFactoryImpl(); } -WebIndexedDatabaseImpl::WebIndexedDatabaseImpl() - : m_indexedDatabase(WebCore::IndexedDatabaseImpl::create()) +WebIDBFactoryImpl::WebIDBFactoryImpl() + : m_idbFactoryBackend(WebCore::IDBFactoryBackendImpl::create()) { } -WebIndexedDatabaseImpl::~WebIndexedDatabaseImpl() +WebIDBFactoryImpl::~WebIDBFactoryImpl() { } -void WebIndexedDatabaseImpl::open(const WebString& name, const WebString& description, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame*) +void WebIDBFactoryImpl::open(const WebString& name, const WebString& description, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame*) { - m_indexedDatabase->open(name, description, IDBCallbacksProxy::create(callbacks), origin, 0); + m_idbFactoryBackend->open(name, description, IDBCallbacksProxy::create(callbacks), origin, 0); } } // namespace WebKit diff --git a/WebKit/chromium/src/WebIndexedDatabaseImpl.h b/WebKit/chromium/src/WebIDBFactoryImpl.h index 76781e5..c9ec9a3 100644..100755 --- a/WebKit/chromium/src/WebIndexedDatabaseImpl.h +++ b/WebKit/chromium/src/WebIDBFactoryImpl.h @@ -26,27 +26,28 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebIndexedDatabaseImpl_h -#define WebIndexedDatabaseImpl_h +#ifndef WebIDBFactoryImpl_h +#define WebIDBFactoryImpl_h -#include "WebIndexedDatabase.h" +#include "WebDOMStringList.h" +#include "WebIDBFactory.h" #include <wtf/RefPtr.h> -namespace WebCore { class IndexedDatabase; } +namespace WebCore { class IDBFactoryBackendInterface; } namespace WebKit { -class WebIndexedDatabaseImpl : public WebIndexedDatabase { +class WebIDBFactoryImpl : public WebIDBFactory { public: - WebIndexedDatabaseImpl(); - virtual ~WebIndexedDatabaseImpl(); + WebIDBFactoryImpl(); + virtual ~WebIDBFactoryImpl(); virtual void open(const WebString& name, const WebString& description, WebIDBCallbacks*, const WebSecurityOrigin&, WebFrame*); private: - WTF::RefPtr<WebCore::IndexedDatabase> m_indexedDatabase; + WTF::RefPtr<WebCore::IDBFactoryBackendInterface> m_idbFactoryBackend; }; } // namespace WebKit -#endif // WebIndexedDatabaseImpl_h +#endif // WebIDBFactoryImpl_h diff --git a/WebKit/chromium/src/WebIDBIndexImpl.cpp b/WebKit/chromium/src/WebIDBIndexImpl.cpp index 304217c..777ec32 100644 --- a/WebKit/chromium/src/WebIDBIndexImpl.cpp +++ b/WebKit/chromium/src/WebIDBIndexImpl.cpp @@ -34,8 +34,8 @@ using namespace WebCore; namespace WebKit { -WebIDBIndexImpl::WebIDBIndexImpl(PassRefPtr<IDBIndex> idbIndex) - : m_idbIndex(idbIndex) +WebIDBIndexImpl::WebIDBIndexImpl(PassRefPtr<IDBIndexBackendInterface> backend) + : m_backend(backend) { } @@ -45,17 +45,17 @@ WebIDBIndexImpl::~WebIDBIndexImpl() WebString WebIDBIndexImpl::name() const { - return m_idbIndex->name(); + return m_backend->name(); } WebString WebIDBIndexImpl::keyPath() const { - return m_idbIndex->keyPath(); + return m_backend->keyPath(); } bool WebIDBIndexImpl::unique() const { - return m_idbIndex->unique(); + return m_backend->unique(); } } // namespace WebCore diff --git a/WebKit/chromium/src/WebIDBIndexImpl.h b/WebKit/chromium/src/WebIDBIndexImpl.h index e1f0538..73f3819 100644 --- a/WebKit/chromium/src/WebIDBIndexImpl.h +++ b/WebKit/chromium/src/WebIDBIndexImpl.h @@ -31,14 +31,14 @@ #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> -namespace WebCore { class IDBIndex; } +namespace WebCore { class IDBIndexBackendInterface; } namespace WebKit { // See comment in WebIndexedDatabase for a high level overview these classes. class WebIDBIndexImpl : public WebIDBIndex { public: - WebIDBIndexImpl(WTF::PassRefPtr<WebCore::IDBIndex> idbIndex); + WebIDBIndexImpl(WTF::PassRefPtr<WebCore::IDBIndexBackendInterface>); virtual ~WebIDBIndexImpl(); virtual WebString name() const; @@ -46,7 +46,7 @@ public: virtual bool unique() const; private: - WTF::RefPtr<WebCore::IDBIndex> m_idbIndex; + WTF::RefPtr<WebCore::IDBIndexBackendInterface> m_backend; }; } // namespace WebKit diff --git a/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp b/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp index d8e98db..7b6a32a 100755 --- a/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp +++ b/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp @@ -85,7 +85,7 @@ void WebIDBObjectStoreImpl::createIndex(const WebString& name, const WebString& WebIDBIndex* WebIDBObjectStoreImpl::index(const WebString& name) { - RefPtr<IDBIndex> index = m_objectStore->index(name); + RefPtr<IDBIndexBackendInterface> index = m_objectStore->index(name); if (!index) return 0; return new WebIDBIndexImpl(index); diff --git a/WebKit/chromium/src/WebRuntimeFeatures.cpp b/WebKit/chromium/src/WebRuntimeFeatures.cpp index efb287c..217553b 100644 --- a/WebKit/chromium/src/WebRuntimeFeatures.cpp +++ b/WebKit/chromium/src/WebRuntimeFeatures.cpp @@ -236,4 +236,14 @@ bool WebRuntimeFeatures::isDeviceOrientationEnabled() return RuntimeEnabledFeatures::deviceOrientationEnabled(); } +void WebRuntimeFeatures::enableSpeechInput(bool enable) +{ + RuntimeEnabledFeatures::setSpeechInputEnabled(enable); +} + +bool WebRuntimeFeatures::isSpeechInputEnabled() +{ + return RuntimeEnabledFeatures::speechInputEnabled(); +} + } // namespace WebKit diff --git a/WebKit/chromium/src/WebViewImpl.cpp b/WebKit/chromium/src/WebViewImpl.cpp index bb6d07c..691f143 100644 --- a/WebKit/chromium/src/WebViewImpl.cpp +++ b/WebKit/chromium/src/WebViewImpl.cpp @@ -106,6 +106,7 @@ #include "WebPoint.h" #include "WebPopupMenuImpl.h" #include "WebRect.h" +#include "WebRuntimeFeatures.h" #include "WebSettingsImpl.h" #include "WebString.h" #include "WebVector.h" @@ -176,6 +177,9 @@ static const PopupContainerSettings autoFillPopupSettings = { WebView* WebView::create(WebViewClient* client, WebDevToolsAgentClient* devToolsClient) { + // Keep runtime flag for device orientation turned off until it's implemented. + WebRuntimeFeatures::enableDeviceOrientation(false); + // Pass the WebViewImpl's self-reference to the caller. return adoptRef(new WebViewImpl(client, devToolsClient)).leakRef(); } diff --git a/WebKit/chromium/src/js/DevTools.js b/WebKit/chromium/src/js/DevTools.js index 640474b..674f1d7 100644 --- a/WebKit/chromium/src/js/DevTools.js +++ b/WebKit/chromium/src/js/DevTools.js @@ -165,8 +165,7 @@ WebInspector.loaded = function() Preferences.debuggerAlwaysEnabled = true; Preferences.profilerAlwaysEnabled = true; Preferences.canEditScriptSource = true; - Preferences.appCacheEnabled = false; - + if ("page" in WebInspector._paramsObject) { WebInspector.loadedDone = true; if (WebInspector.socketOpened) diff --git a/WebKit/chromium/tests/PopupMenuTest.cpp b/WebKit/chromium/tests/PopupMenuTest.cpp index 44b262d..50319af 100644 --- a/WebKit/chromium/tests/PopupMenuTest.cpp +++ b/WebKit/chromium/tests/PopupMenuTest.cpp @@ -180,7 +180,7 @@ protected: { m_webView = static_cast<WebViewImpl*>(WebView::create(&m_webviewClient, 0)); m_webView->initializeMainFrame(&m_webFrameClient); - m_popupMenu = PopupMenu::create(&m_popupMenuClient); + m_popupMenu = adoptRef(new PopupMenuChromium(&m_popupMenuClient)); } virtual void TearDown() diff --git a/WebKit/efl/ChangeLog b/WebKit/efl/ChangeLog index ad44392..80595aa 100644 --- a/WebKit/efl/ChangeLog +++ b/WebKit/efl/ChangeLog @@ -1,3 +1,74 @@ +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu + instances, concrete classes that inherit from ChromeClient needed to be changed to + implement the new methods. + + * WebCoreSupport/ChromeClientEfl.cpp: + (WebCore::ChromeClientEfl::selectItemWritingDirectionIsNatural): + (WebCore::ChromeClientEfl::createPopupMenu): + (WebCore::ChromeClientEfl::createSearchPopupMenu): + * WebCoreSupport/ChromeClientEfl.h: + +2010-08-02 Jeremy Orlow <jorlow@chromium.org> + + Speculative revert of 64425 due to Chromium instability + https://bugs.webkit.org/show_bug.cgi?id=43347 + + * WebCoreSupport/ChromeClientEfl.cpp: + * WebCoreSupport/ChromeClientEfl.h: + +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu + instances, concrete classes that inherit from ChromeClient needed to be changed to + implement the new methods. + + * WebCoreSupport/ChromeClientEfl.cpp: + (WebCore::ChromeClientEfl::selectItemWritingDirectionIsNatural): + (WebCore::ChromeClientEfl::createPopupMenu): + (WebCore::ChromeClientEfl::createSearchPopupMenu): + * WebCoreSupport/ChromeClientEfl.h: + +2010-07-31 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r64422. + http://trac.webkit.org/changeset/64422 + https://bugs.webkit.org/show_bug.cgi?id=43304 + + Build fixes are needed for Snow Leopard and Windows. + (Requested by lca on #webkit). + + * WebCoreSupport/ChromeClientEfl.cpp: + * WebCoreSupport/ChromeClientEfl.h: + +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu + instances, concrete classes that inherit from ChromeClient needed to be changed to + implement the new methods. + + * WebCoreSupport/ChromeClientEfl.cpp: + (WebCore::ChromeClientEfl::selectItemWritingDirectionIsNatural): + (WebCore::ChromeClientEfl::createPopupMenu): + (WebCore::ChromeClientEfl::createSearchPopupMenu): + * WebCoreSupport/ChromeClientEfl.h: + 2010-07-26 Steve Block <steveblock@google.com> Reviewed by Jeremy Orlow. diff --git a/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp b/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp index ffbd642..21747a1 100644 --- a/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp +++ b/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp @@ -5,6 +5,7 @@ * Copyright (C) 2008 Diego Gonzalez * Copyright (C) 2009-2010 ProFUSION embedded systems * Copyright (C) 2009-2010 Samsung Electronics + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * All rights reserved. * @@ -47,6 +48,9 @@ #include "KURL.h" #include "NotImplemented.h" #include "PlatformString.h" +#include "SecurityOrigin.h" +#include "PopupMenuEfl.h" +#include "SearchPopupMenuEfl.h" #include "ViewportArguments.h" #include "WindowFeatures.h" #include "ewk_private.h" @@ -376,6 +380,11 @@ void ChromeClientEfl::reachedMaxAppCacheSize(int64_t spaceNeeded) // FIXME: Free some space. notImplemented(); } + +void ChromeClientEfl::reachedApplicationCacheOriginQuota(SecurityOrigin*) +{ + notImplemented(); +} #endif #if ENABLE(DATABASE) @@ -513,4 +522,19 @@ void ChromeClientEfl::didReceiveViewportArguments(Frame* frame, const ViewportAr ewk_view_viewport_set(m_view, arguments.width, arguments.height, arguments.initialScale, arguments.minimumScale, arguments.maximumScale, arguments.userScalable); } +bool ChromeClientEfl::selectItemWritingDirectionIsNatural() +{ + return true; +} + +PassRefPtr<PopupMenu> ChromeClientEfl::createPopupMenu(PopupMenuClient* client) const +{ + return adoptRef(new PopupMenuEfl(client)); +} + +PassRefPtr<SearchPopupMenu> ChromeClientEfl::createSearchPopupMenu(PopupMenuClient* client) const +{ + return adoptRef(new SearchPopupMenuEfl(client)); +} + } diff --git a/WebKit/efl/WebCoreSupport/ChromeClientEfl.h b/WebKit/efl/WebCoreSupport/ChromeClientEfl.h index ce8abd1..d939ae6 100644 --- a/WebKit/efl/WebCoreSupport/ChromeClientEfl.h +++ b/WebKit/efl/WebCoreSupport/ChromeClientEfl.h @@ -3,6 +3,7 @@ * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia * Copyright (C) 2009-2010 ProFUSION embedded systems * Copyright (C) 2009-2010 Samsung Electronics + * Copyright (C) 2010 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 @@ -111,6 +112,7 @@ public: #if ENABLE(OFFLINE_WEB_APPLICATIONS) virtual void reachedMaxAppCacheSize(int64_t spaceNeeded); + virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*); #endif virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>); @@ -137,6 +139,10 @@ public: virtual void didReceiveViewportArguments(Frame* frame, const ViewportArguments& arguments) const; + virtual bool selectItemWritingDirectionIsNatural(); + virtual PassRefPtr<PopupMenu> createPopupMenu(PopupMenuClient*) const; + virtual PassRefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const; + Evas_Object* m_view; KURL m_hoveredLinkURL; }; diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog index bf1777d..3d3436f 100644 --- a/WebKit/gtk/ChangeLog +++ b/WebKit/gtk/ChangeLog @@ -1,3 +1,126 @@ +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu + instances, concrete classes that inherit from ChromeClient needed to be changed to + implement the new methods. + + * WebCoreSupport/ChromeClientGtk.cpp: + (WebKit::ChromeClient::selectItemWritingDirectionIsNatural): + (WebKit::ChromeClient::createPopupMenu): + (WebKit::ChromeClient::createSearchPopupMenu): + * WebCoreSupport/ChromeClientGtk.h: + +2010-08-02 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Xan Lopez. + + [GTK] Create a frame-created signal + https://bugs.webkit.org/show_bug.cgi?id=43284 + + Add a frame-created signal, which will allow developers to track + the beginning of a frame lifecycle and attach signal handlers to + all new frames. + + * WebCoreSupport/FrameLoaderClientGtk.cpp: + (WebKit::FrameLoaderClient::createFrame): Emit the frame-created signal. + * tests/testwebframe.c: Add a test which verifies that the correct number of + frame-created signals is fired when a page with iframes loads. + (createFrameSignalTestFrameCreatedCallback): Added. + (createFrameSignalTestTimeout): Added. + (test_webkit_web_frame_created_signal): Added. + (main): Add a reference to the new test. + * webkit/webkitprivate.h: De-normalize webkit_web_frame_init_with_web_view into + the one place that it is used, so that the frame-created signal may be fired there. + * webkit/webkitwebframe.cpp: Remove webkit_web_frame_init_with_web_view. + * webkit/webkitwebview.cpp: + (webkit_web_view_class_init): Add the frame-created signal declaration. + +2010-08-02 Mario Sanchez Prada <msanchez@igalia.com> + + Reviewed by Chris Fleizach. + + [GTK] Implement support for get_character_extents and get_range_extents + https://bugs.webkit.org/show_bug.cgi?id=25677 + + Added new unit tests to check get_character_extents and + get_range_extents functions for the ATK_TEXT interface + + Based on a previous patch by Joanmarie Diggs. + + * tests/testatk.c: + (test_webkit_atk_get_extents): + (main): + +2010-08-02 Jeremy Orlow <jorlow@chromium.org> + + Speculative revert of 64425 due to Chromium instability + https://bugs.webkit.org/show_bug.cgi?id=43347 + + * WebCoreSupport/ChromeClientGtk.cpp: + * WebCoreSupport/ChromeClientGtk.h: + +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu + instances, concrete classes that inherit from ChromeClient needed to be changed to + implement the new methods. + + * WebCoreSupport/ChromeClientGtk.cpp: + (WebKit::ChromeClient::selectItemWritingDirectionIsNatural): + (WebKit::ChromeClient::createPopupMenu): + (WebKit::ChromeClient::createSearchPopupMenu): + * WebCoreSupport/ChromeClientGtk.h: + +2010-07-31 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r64422. + http://trac.webkit.org/changeset/64422 + https://bugs.webkit.org/show_bug.cgi?id=43304 + + Build fixes are needed for Snow Leopard and Windows. + (Requested by lca on #webkit). + + * WebCoreSupport/ChromeClientGtk.cpp: + * WebCoreSupport/ChromeClientGtk.h: + +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu + instances, concrete classes that inherit from ChromeClient needed to be changed to + implement the new methods. + + * WebCoreSupport/ChromeClientGtk.cpp: + (WebKit::ChromeClient::selectItemWritingDirectionIsNatural): + (WebKit::ChromeClient::createPopupMenu): + (WebKit::ChromeClient::createSearchPopupMenu): + * WebCoreSupport/ChromeClientGtk.h: + +2010-07-30 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by David Kilzer. + + Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas) + https://bugs.webkit.org/show_bug.cgi?id=40627 + + * WebCoreSupport/ChromeClientGtk.cpp: + (WebKit::ChromeClient::reachedApplicationCacheOriginQuota): + * WebCoreSupport/ChromeClientGtk.h: + 2010-07-26 Steve Block <steveblock@google.com> Reviewed by Jeremy Orlow. diff --git a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp index 88440ba..081c942 100644 --- a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp @@ -4,6 +4,7 @@ * Copyright (C) 2008 Nuanti Ltd. * Copyright (C) 2008 Alp Toker <alp@atoker.com> * Copyright (C) 2008 Gustavo Noronha Silva <gns@gnome.org> + * Copyright (C) 2010 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 Lesser General Public @@ -30,10 +31,14 @@ #include "FrameLoadRequest.h" #include "GtkVersioning.h" #include "IntRect.h" -#include "PlatformString.h" #include "HitTestResult.h" #include "Icon.h" #include "KURL.h" +#include "PlatformString.h" +#include "PopupMenuClient.h" +#include "PopupMenuGtk.h" +#include "SearchPopupMenuGtk.h" +#include "SecurityOrigin.h" #include "webkitgeolocationpolicydecision.h" #include "webkitwebview.h" #include "webkitnetworkrequest.h" @@ -549,6 +554,11 @@ void ChromeClient::reachedMaxAppCacheSize(int64_t spaceNeeded) // FIXME: Free some space. notImplemented(); } + +void ChromeClient::reachedApplicationCacheOriginQuota(SecurityOrigin*) +{ + notImplemented(); +} #endif void ChromeClient::runOpenPanel(Frame*, PassRefPtr<FileChooser> prpFileChooser) @@ -616,4 +626,19 @@ void ChromeClient::cancelGeolocationPermissionRequestForFrame(WebCore::Frame* fr g_signal_emit_by_name(webView, "geolocation-policy-decision-cancelled", webFrame); } +bool ChromeClient::selectItemWritingDirectionIsNatural() +{ + return true; +} + +PassRefPtr<WebCore::PopupMenu> ChromeClient::createPopupMenu(WebCore::PopupMenuClient* client) const +{ + return adoptRef(new PopupMenuGtk(client)); +} + +PassRefPtr<WebCore::SearchPopupMenu> ChromeClient::createSearchPopupMenu(WebCore::PopupMenuClient* client) const +{ + return adoptRef(new SearchPopupMenuGtk(client)); +} + } diff --git a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h index ce5c5a7..8c667c4 100644 --- a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h +++ b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2007 Holger Hans Peter Freyther + * Copyright (C) 2010 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 @@ -22,9 +23,15 @@ #include "ChromeClient.h" #include "KURL.h" +#include "PopupMenu.h" +#include "SearchPopupMenu.h" typedef struct _WebKitWebView WebKitWebView; +namespace WebCore { +class PopupMenuClient; +} + namespace WebKit { class ChromeClient : public WebCore::ChromeClient { @@ -108,6 +115,7 @@ namespace WebKit { #endif #if ENABLE(OFFLINE_WEB_APPLICATIONS) virtual void reachedMaxAppCacheSize(int64_t spaceNeeded); + virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*); #endif virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>); virtual void chooseIconForFiles(const Vector<WebCore::String>&, WebCore::FileChooser*); @@ -122,6 +130,10 @@ namespace WebKit { virtual void requestGeolocationPermissionForFrame(WebCore::Frame*, WebCore::Geolocation*); virtual void cancelGeolocationPermissionRequestForFrame(WebCore::Frame*, WebCore::Geolocation*); + virtual bool selectItemWritingDirectionIsNatural(); + virtual PassRefPtr<WebCore::PopupMenu> createPopupMenu(WebCore::PopupMenuClient*) const; + virtual PassRefPtr<WebCore::SearchPopupMenu> createSearchPopupMenu(WebCore::PopupMenuClient*) const; + private: WebKitWebView* m_webView; WebCore::KURL m_hoveredLinkURL; diff --git a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp index 340b789..98ac4a1 100644 --- a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp @@ -5,6 +5,7 @@ * Copyright (C) 2008, 2009 Collabora Ltd. All rights reserved. * Copyright (C) 2009, 2010 Gustavo Noronha Silva <gns@gnome.org> * Copyright (C) Research In Motion Limited 2009. All rights reserved. + * Copyright (C) 2010 Igalia S.L. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -472,14 +473,20 @@ PassRefPtr<Widget> FrameLoaderClient::createPlugin(const IntSize& pluginSize, HT PassRefPtr<Frame> FrameLoaderClient::createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement, const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight) { - Frame* coreFrame = core(m_frame); - - ASSERT(core(getViewFromFrame(m_frame)) == coreFrame->page()); + ASSERT(m_frame); + Frame* parentFrame = core(m_frame); + WebKitWebView* webView = getViewFromFrame(m_frame); + WebCore::Page* page = core(webView); + ASSERT(page == parentFrame->page()); - RefPtr<Frame> childFrame = webkit_web_frame_init_with_web_view(getViewFromFrame(m_frame), ownerElement); + WebKitWebFrame* kitFrame = WEBKIT_WEB_FRAME(g_object_new(WEBKIT_TYPE_WEB_FRAME, NULL)); + WebKitWebFramePrivate* framePrivate = kitFrame->priv; + framePrivate->webView = webView; - coreFrame->tree()->appendChild(childFrame); + RefPtr<Frame> childFrame = Frame::create(page, ownerElement, new FrameLoaderClient(kitFrame)); + framePrivate->coreFrame = childFrame.get(); + parentFrame->tree()->appendChild(childFrame); childFrame->tree()->setName(name); childFrame->init(); @@ -493,6 +500,7 @@ PassRefPtr<Frame> FrameLoaderClient::createFrame(const KURL& url, const String& if (!childFrame->tree()->parent()) return 0; + g_signal_emit_by_name(webView, "frame-created", kitFrame); return childFrame.release(); } diff --git a/WebKit/gtk/tests/testatk.c b/WebKit/gtk/tests/testatk.c index 8f13a95..e159f8a 100644 --- a/WebKit/gtk/tests/testatk.c +++ b/WebKit/gtk/tests/testatk.c @@ -26,6 +26,8 @@ #if GLIB_CHECK_VERSION(2, 16, 0) && GTK_CHECK_VERSION(2, 14, 0) +static const char* centeredContents = "<html><body><p style='text-align: center;'>Short line</p><p style='text-align: center;'>Long-size line with some foo bar baz content</p><p style='text-align: center;'>Short line</p><p style='text-align: center;'>This is a multi-line paragraph<br />where the first line<br />is the biggest one</p></body></html>"; + static const char* contents = "<html><body><p>This is a test. This is the second sentence. And this the third.</p></body></html>"; static const char* contentsWithNewlines = "<html><body><p>This is a test. \n\nThis\n is the second sentence. And this the third.</p></body></html>"; @@ -738,6 +740,109 @@ static void testWebkitAtkTextAttributes(void) atk_attribute_set_free(set3); } +static void test_webkit_atk_get_extents(void) +{ + WebKitWebView* webView; + AtkObject* obj; + GMainLoop* loop; + + webView = WEBKIT_WEB_VIEW(webkit_web_view_new()); + g_object_ref_sink(webView); + GtkAllocation alloc = { 0, 0, 800, 600 }; + gtk_widget_size_allocate(GTK_WIDGET(webView), &alloc); + webkit_web_view_load_string(webView, centeredContents, NULL, NULL, NULL); + loop = g_main_loop_new(NULL, TRUE); + + g_timeout_add(100, (GSourceFunc)bail_out, loop); + g_main_loop_run(loop); + + obj = gtk_widget_get_accessible(GTK_WIDGET(webView)); + g_assert(obj); + + AtkText* short_text1 = ATK_TEXT(atk_object_ref_accessible_child(obj, 0)); + g_assert(ATK_IS_TEXT(short_text1)); + AtkText* long_text = ATK_TEXT(atk_object_ref_accessible_child(obj, 1)); + g_assert(ATK_IS_TEXT(long_text)); + AtkText* short_text2 = ATK_TEXT(atk_object_ref_accessible_child(obj, 2)); + g_assert(ATK_IS_TEXT(short_text2)); + AtkText* multiline_text = ATK_TEXT(atk_object_ref_accessible_child(obj, 3)); + g_assert(ATK_IS_TEXT(multiline_text)); + + // Start with window extents. + AtkTextRectangle sline_window1, sline_window2, lline_window, mline_window; + atk_text_get_range_extents(short_text1, 0, 10, ATK_XY_WINDOW, &sline_window1); + atk_text_get_range_extents(long_text, 0, 44, ATK_XY_WINDOW, &lline_window); + atk_text_get_range_extents(short_text2, 0, 10, ATK_XY_WINDOW, &sline_window2); + atk_text_get_range_extents(multiline_text, 0, 60, ATK_XY_WINDOW, &mline_window); + + // Check vertical line position. + g_assert_cmpint(sline_window1.y + sline_window1.height, <=, lline_window.y); + g_assert_cmpint(lline_window.y + lline_window.height + sline_window2.height, <=, mline_window.y); + + // Paragraphs 1 and 3 have identical text and alignment. + g_assert_cmpint(sline_window1.x, ==, sline_window2.x); + g_assert_cmpint(sline_window1.width, ==, sline_window2.width); + g_assert_cmpint(sline_window1.height, ==, sline_window2.height); + + // All lines should be the same height; line 2 is the widest line. + g_assert_cmpint(sline_window1.height, ==, lline_window.height); + g_assert_cmpint(sline_window1.width, <, lline_window.width); + + // Make sure the character extents jive with the range extents. + gint x, y, width, height; + + // First paragraph (short text) + atk_text_get_character_extents(short_text1, 0, &x, &y, &width, &height, ATK_XY_WINDOW); + g_assert_cmpint(x, ==, sline_window1.x); + g_assert_cmpint(y, ==, sline_window1.y); + g_assert_cmpint(height, ==, sline_window1.height); + + atk_text_get_character_extents(short_text1, 9, &x, &y, &width, &height, ATK_XY_WINDOW); + g_assert_cmpint(x, ==, sline_window1.x + sline_window1.width - width); + g_assert_cmpint(y, ==, sline_window1.y); + g_assert_cmpint(height, ==, sline_window1.height); + + // Second paragraph (long text) + atk_text_get_character_extents(long_text, 0, &x, &y, &width, &height, ATK_XY_WINDOW); + g_assert_cmpint(x, ==, lline_window.x); + g_assert_cmpint(y, ==, lline_window.y); + g_assert_cmpint(height, ==, lline_window.height); + + atk_text_get_character_extents(long_text, 43, &x, &y, &width, &height, ATK_XY_WINDOW); + g_assert_cmpint(x, ==, lline_window.x + lline_window.width - width); + g_assert_cmpint(y, ==, lline_window.y); + g_assert_cmpint(height, ==, lline_window.height); + + // Third paragraph (short text) + atk_text_get_character_extents(short_text2, 0, &x, &y, &width, &height, ATK_XY_WINDOW); + g_assert_cmpint(x, ==, sline_window2.x); + g_assert_cmpint(y, ==, sline_window2.y); + g_assert_cmpint(height, ==, sline_window2.height); + + atk_text_get_character_extents(short_text2, 9, &x, &y, &width, &height, ATK_XY_WINDOW); + g_assert_cmpint(x, ==, sline_window2.x + sline_window2.width - width); + g_assert_cmpint(y, ==, sline_window2.y); + g_assert_cmpint(height, ==, sline_window2.height); + + // Four paragraph (3 lines multi-line text) + atk_text_get_character_extents(multiline_text, 0, &x, &y, &width, &height, ATK_XY_WINDOW); + g_assert_cmpint(x, ==, mline_window.x); + g_assert_cmpint(y, ==, mline_window.y); + g_assert_cmpint(3 * height, ==, mline_window.height); + + atk_text_get_character_extents(multiline_text, 59, &x, &y, &width, &height, ATK_XY_WINDOW); + // Last line won't fill the whole width of the rectangle + g_assert_cmpint(x, <=, mline_window.x + mline_window.width - width); + g_assert_cmpint(y, ==, mline_window.y + mline_window.height - height); + g_assert_cmpint(height, <=, mline_window.height); + + g_object_unref(short_text1); + g_object_unref(short_text2); + g_object_unref(long_text); + g_object_unref(multiline_text); + g_object_unref(webView); +} + int main(int argc, char** argv) { g_thread_init(NULL); @@ -754,6 +859,7 @@ int main(int argc, char** argv) g_test_add_func("/webkit/atk/getTextInTable", testWebkitAtkGetTextInTable); g_test_add_func("/webkit/atk/getHeadersInTable", testWebkitAtkGetHeadersInTable); g_test_add_func("/webkit/atk/textAttributes", testWebkitAtkTextAttributes); + g_test_add_func("/webkit/atk/get_extents", test_webkit_atk_get_extents); return g_test_run (); } diff --git a/WebKit/gtk/tests/testwebframe.c b/WebKit/gtk/tests/testwebframe.c index 620c9c9..59c7c2b 100644 --- a/WebKit/gtk/tests/testwebframe.c +++ b/WebKit/gtk/tests/testwebframe.c @@ -27,6 +27,50 @@ #if GLIB_CHECK_VERSION(2, 16, 0) && GTK_CHECK_VERSION(2, 14, 0) +static int numberOfFramesCreated = 0; + +static void createFrameSignalTestFrameCreatedCallback(WebKitWebView* webView, WebKitWebFrame* frame, gpointer data) +{ + numberOfFramesCreated++; +} + +static gboolean createFrameSignalTestTimeout(gpointer data) +{ + g_assert_cmpint(numberOfFramesCreated, ==, 2); + g_main_loop_quit((GMainLoop*) data); + return FALSE; +} + +static void test_webkit_web_frame_created_signal(void) +{ + GtkWidget* webView; + GtkWidget* window; + GMainLoop* loop = g_main_loop_new(NULL, TRUE); + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + + webView = webkit_web_view_new(); + g_signal_connect(webView, "frame-created", G_CALLBACK(createFrameSignalTestFrameCreatedCallback), loop); + + // We want to ensure that exactly two create-frame signals are + // fired and no more, so we set a timeout here. There does not appear + // to be a simple way via the API to figure out when all frames have + // loaded. + g_timeout_add(500, createFrameSignalTestTimeout, loop); + + gtk_container_add(GTK_CONTAINER(window), webView); + gtk_widget_show(window); + gtk_widget_show(webView); + + webkit_web_view_load_string(WEBKIT_WEB_VIEW(webView), + "<html><body>Frames!" + "<iframe></iframe>" + "<iframe></iframe>" + "</body></html>", + "text/html", "utf-8", "file://"); + g_main_loop_run(loop); +} + static void test_webkit_web_frame_create_destroy(void) { GtkWidget *webView; @@ -170,6 +214,7 @@ int main(int argc, char** argv) g_test_bug_base("https://bugs.webkit.org/"); g_test_add_func("/webkit/webview/create_destroy", test_webkit_web_frame_create_destroy); + g_test_add_func("/webkit/webview/frame-created_signal", test_webkit_web_frame_created_signal); g_test_add_func("/webkit/webframe/lifetime", test_webkit_web_frame_lifetime); g_test_add_func("/webkit/webview/printing", test_webkit_web_frame_printing); g_test_add_func("/webkit/webview/response", test_webkit_web_frame_response); diff --git a/WebKit/gtk/webkit/webkitprivate.h b/WebKit/gtk/webkit/webkitprivate.h index 73f9fcc..3ce77e6 100644 --- a/WebKit/gtk/webkit/webkitprivate.h +++ b/WebKit/gtk/webkit/webkitprivate.h @@ -196,9 +196,6 @@ extern "C" { gboolean disposed; }; - PassRefPtr<WebCore::Frame> - webkit_web_frame_init_with_web_view(WebKitWebView*, WebCore::HTMLFrameOwnerElement*); - void webkit_web_frame_core_frame_gone(WebKitWebFrame*); diff --git a/WebKit/gtk/webkit/webkitwebframe.cpp b/WebKit/gtk/webkit/webkitwebframe.cpp index 344f94e..5e82d57 100644 --- a/WebKit/gtk/webkit/webkitwebframe.cpp +++ b/WebKit/gtk/webkit/webkitwebframe.cpp @@ -408,21 +408,6 @@ WebKitWebFrame* webkit_web_frame_new(WebKitWebView* webView) return frame; } -PassRefPtr<Frame> webkit_web_frame_init_with_web_view(WebKitWebView* webView, HTMLFrameOwnerElement* element) -{ - WebKitWebFrame* frame = WEBKIT_WEB_FRAME(g_object_new(WEBKIT_TYPE_WEB_FRAME, NULL)); - WebKitWebFramePrivate* priv = frame->priv; - WebKitWebViewPrivate* viewPriv = WEBKIT_WEB_VIEW_GET_PRIVATE(webView); - - priv->webView = webView; - WebKit::FrameLoaderClient* client = new WebKit::FrameLoaderClient(frame); - - RefPtr<Frame> coreFrame = Frame::create(viewPriv->corePage, element, client); - priv->coreFrame = coreFrame.get(); - - return coreFrame.release(); -} - /** * webkit_web_frame_get_title: * @frame: a #WebKitWebFrame diff --git a/WebKit/gtk/webkit/webkitwebview.cpp b/WebKit/gtk/webkit/webkitwebview.cpp index cde9148..8747d42 100644 --- a/WebKit/gtk/webkit/webkitwebview.cpp +++ b/WebKit/gtk/webkit/webkitwebview.cpp @@ -172,6 +172,7 @@ enum { GEOLOCATION_POLICY_DECISION_REQUESTED, GEOLOCATION_POLICY_DECISION_CANCELLED, ONLOAD_EVENT, + FRAME_CREATED, LAST_SIGNAL }; @@ -2447,6 +2448,26 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) G_TYPE_NONE, 1, WEBKIT_TYPE_WEB_FRAME); + /* + * WebKitWebView::frame-created + * @web_view: the object which received the signal + * @web_frame: the #WebKitWebFrame which was just created. + * + * Emitted when a WebKitWebView has created a new frame. This signal will + * be emitted for all sub-frames created during page load. It will not be + * emitted for the main frame, which originates in the WebKitWebView constructor + * and may be accessed at any time using webkit_web_view_get_main_frame. + * + * Since: 1.3.4 + */ + webkit_web_view_signals[FRAME_CREATED] = g_signal_new("frame-created", + G_TYPE_FROM_CLASS(webViewClass), + (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), + 0, + NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, + WEBKIT_TYPE_WEB_FRAME); /* * implementations of virtual methods diff --git a/WebKit/haiku/ChangeLog b/WebKit/haiku/ChangeLog index 841a94c..9e2e24d 100644 --- a/WebKit/haiku/ChangeLog +++ b/WebKit/haiku/ChangeLog @@ -1,3 +1,85 @@ +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu + instances, concrete classes that inherit from ChromeClient needed to be changed to + implement the new methods. + + * WebCoreSupport/ChromeClientHaiku.cpp: + (WebCore::ChromeClientHaiku::selectItemWritingDirectionIsNatural): + (WebCore::ChromeClientHaiku::createPopupMenu): + (WebCore::ChromeClientHaiku::createSearchPopupMenu): + * WebCoreSupport/ChromeClientHaiku.h: + +2010-08-02 Jeremy Orlow <jorlow@chromium.org> + + Speculative revert of 64425 due to Chromium instability + https://bugs.webkit.org/show_bug.cgi?id=43347 + + * WebCoreSupport/ChromeClientHaiku.cpp: + * WebCoreSupport/ChromeClientHaiku.h: + +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu + instances, concrete classes that inherit from ChromeClient needed to be changed to + implement the new methods. + + * WebCoreSupport/ChromeClientHaiku.cpp: + (WebCore::ChromeClientHaiku::selectItemWritingDirectionIsNatural): + (WebCore::ChromeClientHaiku::createPopupMenu): + (WebCore::ChromeClientHaiku::createSearchPopupMenu): + * WebCoreSupport/ChromeClientHaiku.h: + +2010-07-31 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r64422. + http://trac.webkit.org/changeset/64422 + https://bugs.webkit.org/show_bug.cgi?id=43304 + + Build fixes are needed for Snow Leopard and Windows. + (Requested by lca on #webkit). + + * WebCoreSupport/ChromeClientHaiku.cpp: + * WebCoreSupport/ChromeClientHaiku.h: + +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu + instances, concrete classes that inherit from ChromeClient needed to be changed to + implement the new methods. + + * WebCoreSupport/ChromeClientHaiku.cpp: + (WebCore::ChromeClientHaiku::selectItemWritingDirectionIsNatural): + (WebCore::ChromeClientHaiku::createPopupMenu): + (WebCore::ChromeClientHaiku::createSearchPopupMenu): + * WebCoreSupport/ChromeClientHaiku.h: + +2010-07-30 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by David Kilzer. + + Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas) + https://bugs.webkit.org/show_bug.cgi?id=40627 + + * WebCoreSupport/ChromeClientHaiku.cpp: + (WebCore::ChromeClientWx::reachedApplicationCacheOriginQuota): + * WebCoreSupport/ChromeClientHaiku.h: + 2010-07-16 Zhe Su <suzhe@chromium.org> Reviewed by Darin Adler. diff --git a/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.cpp b/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.cpp index d18b84d..6c54424 100644 --- a/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.cpp +++ b/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.cpp @@ -2,6 +2,7 @@ * Copyright (C) 2006 Zack Rusin <zack@kde.org> * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com> All rights reserved. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * * Redistribution and use in source and binary forms, with or without @@ -35,6 +36,9 @@ #include "Icon.h" #include "NotImplemented.h" #include "PlatformString.h" +#include "SecurityOrigin.h" +#include "PopupMenuHaiku.h" +#include "SearchPopupMenuHaiku.h" #include <Alert.h> #include <String.h> @@ -345,6 +349,11 @@ void ChromeClientWx::reachedMaxAppCacheSize(int64_t spaceNeeded) { notImplemented(); } + +void ChromeClientWx::reachedApplicationCacheOriginQuota(SecurityOrigin*) +{ + notImplemented(); +} #endif void ChromeClientHaiku::requestGeolocationPermissionForFrame(Frame*, Geolocation*) @@ -380,5 +389,20 @@ PassOwnPtr<HTMLParserQuirks> ChromeClientHaiku::createHTMLParserQuirks() return 0; } +bool ChromeClientHaiku::selectItemWritingDirectionIsNatural() +{ + return false; +} + +PassRefPtr<PopupMenu> ChromeClientHaiku::createPopupMenu(PopupMenuClient* client) const +{ + return adoptRef(new PopupMenuHaiku(client)); +} + +PassRefPtr<SearchPopupMenu> ChromeClientHaiku::createSearchPopupMenu(PopupMenuClient* client) const +{ + return adoptRef(new SearchPopupMenuHaiku(client)); +} + } // namespace WebCore diff --git a/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.h b/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.h index 963e72f..8201fae 100644 --- a/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.h +++ b/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.h @@ -1,6 +1,7 @@ /* * Copyright (C) 2006 Zack Rusin <zack@kde.org> * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com> All rights reserved. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * * Redistribution and use in source and binary forms, with or without @@ -128,8 +129,13 @@ namespace WebCore { void exceededDatabaseQuota(Frame*, const String& databaseName); + virtual bool selectItemWritingDirectionIsNatural(); + virtual PassRefPtr<PopupMenu> createPopupMenu(PopupMenuClient*) const; + virtual PassRefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const; + #if ENABLE(OFFLINE_WEB_APPLICATIONS) virtual void reachedMaxAppCacheSize(int64_t spaceNeeded); + virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*); #endif // This is an asynchronous call. The ChromeClient can display UI asking the user for permission diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog index 013780d..bb42e9d 100644 --- a/WebKit/mac/ChangeLog +++ b/WebKit/mac/ChangeLog @@ -1,3 +1,237 @@ +2010-08-02 Brady Eidson <beidson@apple.com> + + Reviewed by Anders Carlsson. + + Add VisitedLinkStrategy for each platform to implement + https://bugs.webkit.org/show_bug.cgi?id=43393 + + * WebCoreSupport/WebPlatformStrategies.h: + * WebCoreSupport/WebPlatformStrategies.mm: + (WebPlatformStrategies::createVisitedLinkStrategy): + (WebPlatformStrategies::isLinkVisited): Call back into PageGroup's visited links. + (WebPlatformStrategies::addVisitedLink): Ditto. + +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu + instances, concrete classes that inherit from ChromeClient needed to be changed to + implement the new methods. + + * WebCoreSupport/WebChromeClient.h: + * WebCoreSupport/WebChromeClient.mm: + (WebChromeClient::selectItemWritingDirectionIsNatural): + (WebChromeClient::createPopupMenu): + (WebChromeClient::createSearchPopupMenu): + +2010-08-02 Jeremy Orlow <jorlow@chromium.org> + + Speculative revert of 64425 due to Chromium instability + https://bugs.webkit.org/show_bug.cgi?id=43347 + + * WebCoreSupport/WebChromeClient.h: + * WebCoreSupport/WebChromeClient.mm: + +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu + instances, concrete classes that inherit from ChromeClient needed to be changed to + implement the new methods. + + * WebCoreSupport/WebChromeClient.h: + * WebCoreSupport/WebChromeClient.mm: + (WebChromeClient::selectItemWritingDirectionIsNatural): + (WebChromeClient::createPopupMenu): + (WebChromeClient::createSearchPopupMenu): + +2010-07-31 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r64422. + http://trac.webkit.org/changeset/64422 + https://bugs.webkit.org/show_bug.cgi?id=43304 + + Build fixes are needed for Snow Leopard and Windows. + (Requested by lca on #webkit). + + * WebCoreSupport/WebChromeClient.h: + * WebCoreSupport/WebChromeClient.mm: + +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu + instances, concrete classes that inherit from ChromeClient needed to be changed to + implement the new methods. + + * WebCoreSupport/WebChromeClient.h: + * WebCoreSupport/WebChromeClient.mm: + (WebChromeClient::selectItemWritingDirectionIsNatural): + (WebChromeClient::createPopupMenu): + (WebChromeClient::createSearchPopupMenu): + +2010-07-31 David Kilzer <ddkilzer@apple.com> + + <http://webkit.org/b/43300> Simplify variables in *.xcconfig files after adding iOS support + + Reviewed by Darin Adler. + + * Configurations/WebKit.xcconfig: Extracted + PRODUCTION_FRAMEWORKS_DIR and PRODUCTION_ROOT variables. + +2010-07-30 Dan Bernstein <mitz@apple.com> + + Reviewed by Darin Adler. + + <rdar://problem/8257783> Short documents may print a second blank page + https://bugs.webkit.org/show_bug.cgi?id=43271 + + * WebView/WebHTMLView.mm: + (-[WebHTMLView _web_setPrintingModeRecursive]): Updated for additional height parameter + to _setPrinting:minimumPageWidth:height:maximumPageWidth:adjustViewSize:. + (-[WebHTMLView _web_clearPrintingModeRecursive]): Ditto. + (-[WebHTMLView _web_setPrintingModeRecursiveAndAdjustViewSize]): Ditto. + (-[WebHTMLView _beginPrintModeWithPageWidth:height:shrinkToFit:]): Added height parameter, + which is scaled and passed on to _setPrinting:minimumPageWidth:height:maximumPageWidth:adjustViewSize:. + (-[WebHTMLView _endPrintMode]): Updated for additional height parameter to + _setPrinting:minimumPageWidth:height:maximumPageWidth:adjustViewSize:. + (-[WebHTMLView layoutToMinimumPageWidth:height:maximumPageWidth:adjustingViewSize:]): Added + height parameter, which is passed on to FrameView::forceLayoutForPagination(). + (-[WebHTMLView layout]): Updated for additional height parameter. + (-[WebHTMLView _setPrinting:minimumPageWidth:height:maximumPageWidth:adjustViewSize:]): Added height + parameter, which is passed on to -layoutToMinimumPageWidth:height:maximumPageWidth:adjustViewSize:. + (-[WebHTMLView adjustPageHeightNew:top:bottom:limit:]): Updated for additional height + parameter. + (-[WebHTMLView setPageWidthForPrinting:]): Ditto. + (-[WebHTMLView knowsPageRange:]): Pass the available height on the page on to + _setPrinting:minimumPageWidth:height:maximumPageWidth:adjustViewSize. + * WebView/WebHTMLViewPrivate.h: + +2010-07-30 Joseph Pecoraro <joepeck@webkit.org> + + Fix for tests that broke after r64400. Tracking a more + ideal solution in https://bugs.webkit.org/show_bug.cgi?id=40627 + + Switch the interface back to (unsigned long long), and move + the WebDatabaseSecurityOrigin implementation up into WebSecurityOrigin. + The subclasses' implementations were not getting called. + + * Storage/WebDatabaseSecurityOrigin.mm: + * WebCoreSupport/WebApplicationCacheSecurityOrigin.mm: + (-[WebApplicationCacheSecurityOrigin quota]): + (-[WebApplicationCacheSecurityOrigin setQuota:]): + * WebCoreSupport/WebSecurityOrigin.mm: + (-[WebSecurityOrigin usage]): + (-[WebSecurityOrigin quota]): + (-[WebSecurityOrigin setQuota:]): + * WebCoreSupport/WebSecurityOriginPrivate.h: + +2010-07-30 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by David Kilzer. + + Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas) + https://bugs.webkit.org/show_bug.cgi?id=40627 + + Part 4 - Client Notification when the Quota is Reached + + Notify the WebKit client when the per-origin quota is reached + via a delegate method reachedApplicationCacheOriginQuota. + + Refactor the WebSecurityOrigin class to be generic enough to + allow quota management of both Databases or Application Caches + via subclasses. + + * Storage/WebDatabaseSecurityOrigin.h: Added. + * Storage/WebDatabaseSecurityOrigin.mm: Added. + (-[WebDatabaseSecurityOrigin quota]): + (-[WebDatabaseSecurityOrigin setQuota:]): + * WebCoreSupport/WebApplicationCacheSecurityOrigin.h: Added. + * WebCoreSupport/WebApplicationCacheSecurityOrigin.mm: Added. + (-[WebApplicationCacheSecurityOrigin quota]): + (-[WebApplicationCacheSecurityOrigin setQuota:]): + * Storage/WebSecurityOrigin.mm: Removed. (Moved to WebCoreSupport) + * Storage/WebSecurityOriginPrivate.h: Removed. (Moved to WebCoreSupport) + * WebCoreSupport/WebSecurityOrigin.mm: Added. + (-[WebSecurityOrigin usage]): to be implemented by subclasses. + (-[WebSecurityOrigin quota]): to be implemented by subclasses. + (-[WebSecurityOrigin setQuota:]): to be implemented by subclasses. + * WebCoreSupport/WebSecurityOriginInternal.h: Renamed from WebKit/mac/Storage/WebSecurityOriginInternal.h. + * WebCoreSupport/WebSecurityOriginPrivate.h: Added. + + Turn the notification into a WebUI Delegate to call. Following + the example of Databases. + + * DefaultDelegates/WebDefaultUIDelegate.m: + (-[WebDefaultUIDelegate webView:exceededApplicationCacheOriginQuotaForSecurityOrigin:]): + * WebCoreSupport/WebChromeClient.h: + * WebCoreSupport/WebChromeClient.mm: + (WebChromeClient::exceededDatabaseQuota): use the Databases Security Origin subclass. + (WebChromeClient::reachedApplicationCacheOriginQuota): use the Application Cache Security Origin subclass. + * WebView/WebUIDelegatePrivate.h: + +2010-07-30 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by David Kilzer. + + Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas) + https://bugs.webkit.org/show_bug.cgi?id=40627 + + Part 1 - Add Total and Per-Origin Quota Preferences. + + Allow the application cache total size to be a preference, and + add a new preference for the default per-origin quota. + + Storage quotas were int64_t (long long). Boilerplate for + these types added for consistency. + + * Misc/WebNSDictionaryExtras.h: + * Misc/WebNSDictionaryExtras.m: + (-[NSMutableDictionary _webkit_setLongLong:forKey:]): + * WebCoreSupport/WebApplicationCache.h: setters and accessors for WebCore's cacheStorage. + * WebCoreSupport/WebApplicationCache.mm: + (+[WebApplicationCache maximumSize:]): + (+[WebApplicationCache setMaximumSize:]): + (+[WebApplicationCache defaultOriginQuota]): + (+[WebApplicationCache setDefaultOriginQuota:]): + * WebView/WebPreferenceKeysPrivate.h: + * WebView/WebPreferences.mm: + (+[WebPreferences initialize]): defaults to noQuota for both preferences. + (-[WebPreferences _longLongValueForKey:]): + (-[WebPreferences _setLongLongValue:forKey:]): + (-[WebPreferences applicationCacheTotalQuota]): + (-[WebPreferences setApplicationCacheTotalQuota:]): + (-[WebPreferences applicationCacheDefaultOriginQuota]): + (-[WebPreferences setApplicationCacheDefaultOriginQuota:]): + * WebView/WebPreferencesPrivate.h: + * WebView/WebView.mm: + (-[WebView _preferencesChangedNotification:]): respect updates to the preferences. + +2010-07-30 Andy Estes <aestes@apple.com> + + Reviewed by David Kilzer. + + Add Xcode support for compiling WebKit against iOS SDKs. + https://bugs.webkit.org/show_bug.cgi?id=42796 + + * Configurations/Base.xcconfig: + * Configurations/DebugRelease.xcconfig: + * Configurations/FeatureDefines.xcconfig: + * Configurations/Version.xcconfig: + * Configurations/WebKit.xcconfig: + 2010-07-26 Steve Block <steveblock@google.com> Reviewed by Jeremy Orlow. diff --git a/WebKit/mac/Configurations/Base.xcconfig b/WebKit/mac/Configurations/Base.xcconfig index 7914aed..b3f8ea6 100644 --- a/WebKit/mac/Configurations/Base.xcconfig +++ b/WebKit/mac/Configurations/Base.xcconfig @@ -1,4 +1,4 @@ -// Copyright (C) 2009 Apple Inc. All rights reserved. +// Copyright (C) 2009, 2010 Apple Inc. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions @@ -28,11 +28,15 @@ GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_CPP_EXCEPTIONS = NO; GCC_ENABLE_CPP_RTTI = NO; GCC_ENABLE_OBJC_EXCEPTIONS = YES; -GCC_ENABLE_OBJC_GC = supported; +GCC_ENABLE_OBJC_GC = $(GCC_ENABLE_OBJC_GC_$(REAL_PLATFORM_NAME)); +GCC_ENABLE_OBJC_GC_iphoneos = NO; +GCC_ENABLE_OBJC_GC_iphonesimulator = NO; +GCC_ENABLE_OBJC_GC_macosx = supported; GCC_ENABLE_SYMBOL_SEPARATION = NO; GCC_FAST_OBJC_DISPATCH = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; -GCC_MODEL_TUNING = G5; +GCC_MODEL_TUNING = $(GCC_MODEL_TUNING_$(REAL_PLATFORM_NAME)); +GCC_MODEL_TUNING_macosx = G5; GCC_OBJC_CALL_CXX_CDTORS = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_THREADSAFE_STATICS = NO; @@ -44,13 +48,22 @@ GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; LINKER_DISPLAYS_MANGLED_NAMES = YES; OTHER_MIGFLAGS = -F$(BUILT_PRODUCTS_DIR); PREBINDING = NO; -VALID_ARCHS = i386 ppc x86_64 ppc64; +VALID_ARCHS = $(VALID_ARCHS_$(REAL_PLATFORM_NAME)); +VALID_ARCHS_iphoneos = $(ARCHS_STANDARD_32_BIT); +VALID_ARCHS_iphonesimulator = $(ARCHS_STANDARD_32_BIT); +VALID_ARCHS_macosx = i386 ppc x86_64 ppc64; // FIXME: <rdar://problem/5070292> WebKit should build with -Wshorten-64-to-32 -WARNING_CFLAGS = -Wall -Wextra -Wcast-align -Wchar-subscripts -Wextra-tokens -Wformat-security -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wno-unused-parameter -Wpacked -Wpointer-arith -Wredundant-decls -Wundef -Wwrite-strings; +WARNING_CFLAGS_BASE = -Wall -Wextra -Wchar-subscripts -Wextra-tokens -Wformat-security -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wno-unused-parameter -Wpacked -Wpointer-arith -Wredundant-decls -Wundef -Wwrite-strings; +WARNING_CFLAGS = $(WARNING_CFLAGS_$(REAL_PLATFORM_NAME)); +WARNING_CFLAGS_iphoneos = $(WARNING_CFLAGS_BASE); +WARNING_CFLAGS_iphonesimulator = $(WARNING_CFLAGS_BASE) -Wcast-align; +WARNING_CFLAGS_macosx = $(WARNING_CFLAGS_BASE) -Wcast-align; REAL_PLATFORM_NAME = $(REAL_PLATFORM_NAME_$(PLATFORM_NAME)); REAL_PLATFORM_NAME_ = $(REAL_PLATFORM_NAME_macosx); +REAL_PLATFORM_NAME_iphoneos = iphoneos; +REAL_PLATFORM_NAME_iphonesimulator = iphonesimulator; REAL_PLATFORM_NAME_macosx = macosx; TARGET_MAC_OS_X_VERSION_MAJOR = $(MAC_OS_X_VERSION_MAJOR); @@ -80,15 +93,18 @@ SECTORDER_FLAGS = -sectorder __TEXT __text mac/WebKit.order; // Note that Xcode versions as new as 3.1.2 use XCODE_VERSION_ACTUAL for the minor version // number. Newer versions of Xcode use XCODE_VERSION_MINOR for the minor version, and // XCODE_VERSION_ACTUAL for the full version number. -TARGET_GCC_VERSION = $(TARGET_GCC_VERSION_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -TARGET_GCC_VERSION_ = $(TARGET_GCC_VERSION_1040); -TARGET_GCC_VERSION_1040 = GCC_40; -TARGET_GCC_VERSION_1050 = $(TARGET_GCC_VERSION_1050_$(XCODE_VERSION_MINOR)); -TARGET_GCC_VERSION_1050_ = $(TARGET_GCC_VERSION_1050_$(XCODE_VERSION_ACTUAL)); -TARGET_GCC_VERSION_1050_0310 = GCC_42; -TARGET_GCC_VERSION_1050_0320 = GCC_42; -TARGET_GCC_VERSION_1060 = GCC_42; -TARGET_GCC_VERSION_1070 = LLVM_GCC_42; +TARGET_GCC_VERSION = $(TARGET_GCC_VERSION_$(REAL_PLATFORM_NAME)); +TARGET_GCC_VERSION_iphoneos = LLVM_GCC_42; +TARGET_GCC_VERSION_iphonesimulator = GCC_42; +TARGET_GCC_VERSION_macosx = $(TARGET_GCC_VERSION_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +TARGET_GCC_VERSION_macosx_ = $(TARGET_GCC_VERSION_macosx_1040); +TARGET_GCC_VERSION_macosx_1040 = GCC_40; +TARGET_GCC_VERSION_macosx_1050 = $(TARGET_GCC_VERSION_macosx_1050_$(XCODE_VERSION_MINOR)); +TARGET_GCC_VERSION_macosx_1050_ = $(TARGET_GCC_VERSION_macosx_1050_$(XCODE_VERSION_ACTUAL)); +TARGET_GCC_VERSION_macosx_1050_0310 = GCC_42; +TARGET_GCC_VERSION_macosx_1050_0320 = GCC_42; +TARGET_GCC_VERSION_macosx_1060 = GCC_42; +TARGET_GCC_VERSION_macosx_1070 = LLVM_GCC_42; GCC_VERSION = $(GCC_VERSION_$(TARGET_GCC_VERSION)); GCC_VERSION_GCC_40 = 4.0; diff --git a/WebKit/mac/Configurations/DebugRelease.xcconfig b/WebKit/mac/Configurations/DebugRelease.xcconfig index 77f7893..5a86e25 100644 --- a/WebKit/mac/Configurations/DebugRelease.xcconfig +++ b/WebKit/mac/Configurations/DebugRelease.xcconfig @@ -1,4 +1,4 @@ -// Copyright (C) 2009 Apple Inc. All rights reserved. +// Copyright (C) 2009, 2010 Apple Inc. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions @@ -23,29 +23,38 @@ #include "Base.xcconfig" -ARCHS = $(ARCHS_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -ARCHS_ = $(ARCHS_1040); -ARCHS_1040 = $(NATIVE_ARCH); -ARCHS_1050 = $(NATIVE_ARCH); -ARCHS_1060 = $(ARCHS_STANDARD_32_64_BIT); -ARCHS_1070 = $(ARCHS_STANDARD_32_64_BIT); +ARCHS = $(ARCHS_$(REAL_PLATFORM_NAME)); +ARCHS_iphoneos = $(ARCHS_STANDARD_32_BIT); +ARCHS_iphonesimulator = $(ARCHS_STANDARD_32_BIT); +ARCHS_macosx = $(ARCHS_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +ARCHS_macosx_ = $(ARCHS_macosx_1040); +ARCHS_macosx_1040 = $(NATIVE_ARCH); +ARCHS_macosx_1050 = $(NATIVE_ARCH); +ARCHS_macosx_1060 = $(ARCHS_STANDARD_32_64_BIT); +ARCHS_macosx_1070 = $(ARCHS_STANDARD_32_64_BIT); ONLY_ACTIVE_ARCH = YES; -MACOSX_DEPLOYMENT_TARGET = $(MACOSX_DEPLOYMENT_TARGET_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -MACOSX_DEPLOYMENT_TARGET_ = 10.4; -MACOSX_DEPLOYMENT_TARGET_1040 = 10.4; -MACOSX_DEPLOYMENT_TARGET_1050 = 10.5; -MACOSX_DEPLOYMENT_TARGET_1060 = 10.6; -MACOSX_DEPLOYMENT_TARGET_1070 = 10.7; +MACOSX_DEPLOYMENT_TARGET = $(MACOSX_DEPLOYMENT_TARGET_$(REAL_PLATFORM_NAME)); +MACOSX_DEPLOYMENT_TARGET_iphoneos = 10.5; +MACOSX_DEPLOYMENT_TARGET_iphonesimulator = 10.5; +MACOSX_DEPLOYMENT_TARGET_macosx = $(MACOSX_DEPLOYMENT_TARGET_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +MACOSX_DEPLOYMENT_TARGET_macosx_ = 10.4; +MACOSX_DEPLOYMENT_TARGET_macosx_1040 = 10.4; +MACOSX_DEPLOYMENT_TARGET_macosx_1050 = 10.5; +MACOSX_DEPLOYMENT_TARGET_macosx_1060 = 10.6; +MACOSX_DEPLOYMENT_TARGET_macosx_1070 = 10.7; GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES; SECTORDER_FLAGS = ; -WEBKIT_SYSTEM_INTERFACE_LIBRARY = $(WEBKIT_SYSTEM_INTERFACE_LIBRARY_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -WEBKIT_SYSTEM_INTERFACE_LIBRARY_ = WebKitSystemInterfaceTiger; -WEBKIT_SYSTEM_INTERFACE_LIBRARY_1040 = WebKitSystemInterfaceTiger; -WEBKIT_SYSTEM_INTERFACE_LIBRARY_1050 = WebKitSystemInterfaceLeopard; -WEBKIT_SYSTEM_INTERFACE_LIBRARY_1060 = WebKitSystemInterfaceSnowLeopard; -WEBKIT_SYSTEM_INTERFACE_LIBRARY_1070 = WebKitSystemInterfaceSnowLeopard; +WEBKIT_SYSTEM_INTERFACE_LIBRARY = $(WEBKIT_SYSTEM_INTERFACE_LIBRARY_$(REAL_PLATFORM_NAME)); +WEBKIT_SYSTEM_INTERFACE_LIBRARY_iphoneos = WebKitSystemInterface; +WEBKIT_SYSTEM_INTERFACE_LIBRARY_iphonesimulator = $(WEBKIT_SYSTEM_INTERFACE_LIBRARY_iphoneos); +WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx = $(WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_ = WebKitSystemInterfaceTiger; +WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_1040 = WebKitSystemInterfaceTiger; +WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_1050 = WebKitSystemInterfaceLeopard; +WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_1060 = WebKitSystemInterfaceSnowLeopard; +WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_1070 = WebKitSystemInterfaceSnowLeopard; diff --git a/WebKit/mac/Configurations/FeatureDefines.xcconfig b/WebKit/mac/Configurations/FeatureDefines.xcconfig index 8e33a91..9810cf7 100644 --- a/WebKit/mac/Configurations/FeatureDefines.xcconfig +++ b/WebKit/mac/Configurations/FeatureDefines.xcconfig @@ -1,4 +1,4 @@ -// Copyright (C) 2009 Apple Inc. All rights reserved. +// Copyright (C) 2009, 2010 Apple Inc. All rights reserved. // Copyright (C) 2009 Google Inc. All rights reserved. // // Redistribution and use in source and binary forms, with or without @@ -33,31 +33,52 @@ ENABLE_LINK_PREFETCH = ; -ENABLE_3D_CANVAS = $(ENABLE_3D_CANVAS_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -ENABLE_3D_CANVAS_1060 = ENABLE_3D_CANVAS; -ENABLE_3D_CANVAS_1070 = ENABLE_3D_CANVAS; +ENABLE_3D_CANVAS = $(ENABLE_3D_CANVAS_$(REAL_PLATFORM_NAME)); +ENABLE_3D_CANVAS_macosx = $(ENABLE_3D_CANVAS_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +ENABLE_3D_CANVAS_macosx_1060 = ENABLE_3D_CANVAS; +ENABLE_3D_CANVAS_macosx_1070 = ENABLE_3D_CANVAS; -ENABLE_3D_RENDERING = $(ENABLE_3D_RENDERING_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -ENABLE_3D_RENDERING_1050 = ENABLE_3D_RENDERING; -ENABLE_3D_RENDERING_1060 = ENABLE_3D_RENDERING; -ENABLE_3D_RENDERING_1070 = ENABLE_3D_RENDERING; +ENABLE_3D_RENDERING = $(ENABLE_3D_RENDERING_$(REAL_PLATFORM_NAME)); +ENABLE_3D_RENDERING_iphoneos = ENABLE_3D_RENDERING; +ENABLE_3D_RENDERING_iphonesimulator = $(ENABLE_3D_RENDERING_iphoneos); +ENABLE_3D_RENDERING_macosx = $(ENABLE_3D_RENDERING_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +ENABLE_3D_RENDERING_macosx_1050 = ENABLE_3D_RENDERING; +ENABLE_3D_RENDERING_macosx_1060 = ENABLE_3D_RENDERING; +ENABLE_3D_RENDERING_macosx_1070 = ENABLE_3D_RENDERING; + +ENABLE_BLOB_SLICE = $(ENABLE_BLOB_SLICE_$(REAL_PLATFORM_NAME)); +ENABLE_BLOB_SLICE_macosx = ENABLE_BLOB_SLICE; + +ENABLE_CHANNEL_MESSAGING = $(ENABLE_CHANNEL_MESSAGING_$(REAL_PLATFORM_NAME)); +ENABLE_CHANNEL_MESSAGING_macosx = ENABLE_CHANNEL_MESSAGING; + +ENABLE_CLIENT_BASED_GEOLOCATION = $(ENABLE_CLIENT_BASED_GEOLOCATION_$(REAL_PLATFORM_NAME)); +ENABLE_CLIENT_BASED_GEOLOCATION_macosx = ENABLE_CLIENT_BASED_GEOLOCATION; -ENABLE_BLOB_SLICE = ENABLE_BLOB_SLICE; -ENABLE_CHANNEL_MESSAGING = ENABLE_CHANNEL_MESSAGING; -ENABLE_CLIENT_BASED_GEOLOCATION = ENABLE_CLIENT_BASED_GEOLOCATION; ENABLE_DATABASE = ENABLE_DATABASE; ENABLE_DATAGRID = ; -ENABLE_DATALIST = ENABLE_DATALIST; + +ENABLE_DATALIST = $(ENABLE_DATALIST_$(REAL_PLATFORM_NAME)); +ENABLE_DATALIST_macosx = ENABLE_DATALIST; + ENABLE_DEVICE_ORIENTATION = ; ENABLE_DIRECTORY_UPLOAD = ; ENABLE_DOM_STORAGE = ENABLE_DOM_STORAGE; ENABLE_EVENTSOURCE = ENABLE_EVENTSOURCE; -ENABLE_FILTERS = ENABLE_FILTERS; -ENABLE_FILE_READER = ENABLE_FILE_READER; + +ENABLE_FILTERS = $(ENABLE_FILTERS_$(REAL_PLATFORM_NAME)); +ENABLE_FILTERS_macosx = ENABLE_FILTERS; + +ENABLE_FILE_READER = $(ENABLE_FILE_READER_$(REAL_PLATFORM_NAME)); +ENABLE_FILE_READER_macosx = ENABLE_FILE_READER; + ENABLE_FILE_WRITER = ; ENABLE_FILE_SYSTEM = ; ENABLE_GEOLOCATION = ENABLE_GEOLOCATION; -ENABLE_ICONDATABASE = ENABLE_ICONDATABASE; + +ENABLE_ICONDATABASE = $(ENABLE_ICONDATABASE_$(REAL_PLATFORM_NAME)); +ENABLE_ICONDATABASE_macosx = ENABLE_ICONDATABASE; + ENABLE_IMAGE_RESIZER = ; ENABLE_INDEXED_DATABASE = ; ENABLE_INPUT_SPEECH = ; @@ -67,21 +88,37 @@ ENABLE_METER_TAG = ENABLE_METER_TAG; ENABLE_NOTIFICATIONS = ; ENABLE_OFFLINE_WEB_APPLICATIONS = ENABLE_OFFLINE_WEB_APPLICATIONS; ENABLE_PROGRESS_TAG = ENABLE_PROGRESS_TAG; -ENABLE_RUBY = ENABLE_RUBY; -ENABLE_SANDBOX = ENABLE_SANDBOX; -ENABLE_SHARED_WORKERS = ENABLE_SHARED_WORKERS; + +ENABLE_RUBY = $(ENABLE_RUBY_$(REAL_PLATFORM_NAME)); +ENABLE_RUBY_macosx = ENABLE_RUBY; + +ENABLE_SANDBOX = $(ENABLE_SANDBOX_$(REAL_PLATFORM_NAME)); +ENABLE_SANDBOX_macosx = ENABLE_SANDBOX; + +ENABLE_SHARED_WORKERS = $(ENABLE_SHARED_WORKERS_$(REAL_PLATFORM_NAME)); +ENABLE_SHARED_WORKERS_macosx = ENABLE_SHARED_WORKERS; + ENABLE_SVG = ENABLE_SVG; ENABLE_SVG_ANIMATION = ENABLE_SVG_ANIMATION; ENABLE_SVG_AS_IMAGE = ENABLE_SVG_AS_IMAGE; -ENABLE_SVG_DOM_OBJC_BINDINGS = ENABLE_SVG_DOM_OBJC_BINDINGS; + +ENABLE_SVG_DOM_OBJC_BINDINGS = $(ENABLE_SVG_DOM_OBJC_BINDINGS_$(REAL_PLATFORM_NAME)); +ENABLE_SVG_DOM_OBJC_BINDINGS_macosx = ENABLE_SVG_DOM_OBJC_BINDINGS; + ENABLE_SVG_FONTS = ENABLE_SVG_FONTS; ENABLE_SVG_FOREIGN_OBJECT = ENABLE_SVG_FOREIGN_OBJECT; ENABLE_SVG_USE = ENABLE_SVG_USE; ENABLE_VIDEO = ENABLE_VIDEO; -ENABLE_WEB_SOCKETS = ENABLE_WEB_SOCKETS; + +ENABLE_WEB_SOCKETS = $(ENABLE_WEB_SOCKETS_$(REAL_PLATFORM_NAME)); +ENABLE_WEB_SOCKETS_macosx = ENABLE_WEB_SOCKETS; + ENABLE_WEB_TIMING = ; ENABLE_WML = ; -ENABLE_WORKERS = ENABLE_WORKERS; + +ENABLE_WORKERS = $(ENABLE_WORKERS_$(REAL_PLATFORM_NAME)); +ENABLE_WORKERS_macosx = ENABLE_WORKERS; + ENABLE_XHTMLMP = ; ENABLE_XPATH = ENABLE_XPATH; ENABLE_XSLT = ENABLE_XSLT; diff --git a/WebKit/mac/Configurations/Version.xcconfig b/WebKit/mac/Configurations/Version.xcconfig index c1b6b32..cc30ce9 100644 --- a/WebKit/mac/Configurations/Version.xcconfig +++ b/WebKit/mac/Configurations/Version.xcconfig @@ -1,4 +1,4 @@ -// Copyright (C) 2009 Apple Inc. All rights reserved. +// Copyright (C) 2009, 2010 Apple Inc. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 534; -MINOR_VERSION = 4; +MINOR_VERSION = 5; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); @@ -31,12 +31,15 @@ BUNDLE_VERSION = $(BUNDLE_VERSION_$(CONFIGURATION)); SHORT_VERSION_STRING = $(SHORT_VERSION_STRING_$(CONFIGURATION)) // The system version prefix is based on the current system version. -SYSTEM_VERSION_PREFIX = $(SYSTEM_VERSION_PREFIX_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -SYSTEM_VERSION_PREFIX_ = 4; // Some Tiger versions of Xcode don't set MAC_OS_X_VERSION_MAJOR. -SYSTEM_VERSION_PREFIX_1040 = 4; -SYSTEM_VERSION_PREFIX_1050 = 5; -SYSTEM_VERSION_PREFIX_1060 = 6; -SYSTEM_VERSION_PREFIX_1070 = 7; +SYSTEM_VERSION_PREFIX = $(SYSTEM_VERSION_PREFIX_$(REAL_PLATFORM_NAME)); +SYSTEM_VERSION_PREFIX_iphoneos = 6; // iPhone OS is most like SnowLeopard currently. +SYSTEM_VERSION_PREFIX_iphonesimulator = $(SYSTEM_VERSION_PREFIX_iphoneos); +SYSTEM_VERSION_PREFIX_macosx = $(SYSTEM_VERSION_PREFIX_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +SYSTEM_VERSION_PREFIX_macosx_ = 4; // Some Tiger versions of Xcode don't set MAC_OS_X_VERSION_MAJOR. +SYSTEM_VERSION_PREFIX_macosx_1040 = 4; +SYSTEM_VERSION_PREFIX_macosx_1050 = 5; +SYSTEM_VERSION_PREFIX_macosx_1060 = 6; +SYSTEM_VERSION_PREFIX_macosx_1070 = 7; // The production build always uses the full version with a system version prefix. BUNDLE_VERSION_Production = $(SYSTEM_VERSION_PREFIX)$(FULL_VERSION); diff --git a/WebKit/mac/Configurations/WebKit.xcconfig b/WebKit/mac/Configurations/WebKit.xcconfig index b9dbc87..def76fd 100644 --- a/WebKit/mac/Configurations/WebKit.xcconfig +++ b/WebKit/mac/Configurations/WebKit.xcconfig @@ -1,4 +1,4 @@ -// Copyright (C) 2009 Apple Inc. All rights reserved. +// Copyright (C) 2009, 2010 Apple Inc. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions @@ -24,26 +24,66 @@ #include "FeatureDefines.xcconfig" #include "Version.xcconfig" +EXCLUDED_SOURCE_FILE_NAMES = $(EXCLUDED_SOURCE_FILE_NAMES_$(REAL_PLATFORM_NAME)); +EXCLUDED_SOURCE_FILE_NAMES_iphoneos = *.nib *.tiff; +EXCLUDED_SOURCE_FILE_NAMES_iphonesimulator = $(EXCLUDED_SOURCE_FILE_NAMES_iphoneos); + EXPORTED_SYMBOLS_FILE = $(EXPORTED_SYMBOLS_FILE_$(CURRENT_ARCH)); EXPORTED_SYMBOLS_FILE_ = mac/WebKit.exp; +EXPORTED_SYMBOLS_FILE_armv5 = mac/WebKit.exp; +EXPORTED_SYMBOLS_FILE_armv6 = mac/WebKit.exp; +EXPORTED_SYMBOLS_FILE_armv7 = mac/WebKit.exp; EXPORTED_SYMBOLS_FILE_i386 = mac/WebKit.exp; EXPORTED_SYMBOLS_FILE_ppc = mac/WebKit.exp; EXPORTED_SYMBOLS_FILE_ppc64 = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/WebKit.LP64.exp; EXPORTED_SYMBOLS_FILE_x86_64 = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/WebKit.LP64.exp; -FRAMEWORK_SEARCH_PATHS = $(UMBRELLA_FRAMEWORKS_DIR) $(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/Quartz.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/PrivateFrameworks $(FRAMEWORK_SEARCH_PATHS); + +FRAMEWORK_SEARCH_PATHS = $(FRAMEWORK_SEARCH_PATHS_$(REAL_PLATFORM_NAME)); +FRAMEWORK_SEARCH_PATHS_iphoneos = $(FRAMEWORK_SEARCH_PATHS_iphoneos_$(CONFIGURATION)); +FRAMEWORK_SEARCH_PATHS_iphoneos_Debug = $(BUILT_PRODUCTS_DIR) $(PRODUCTION_FRAMEWORKS_DIR); +FRAMEWORK_SEARCH_PATHS_iphoneos_Release = $(FRAMEWORK_SEARCH_PATHS_iphoneos_Debug); +FRAMEWORK_SEARCH_PATHS_iphoneos_Production = $(PRODUCTION_FRAMEWORKS_DIR); +FRAMEWORK_SEARCH_PATHS_iphonesimulator = $(FRAMEWORK_SEARCH_PATHS_iphoneos_$(CONFIGURATION)); +FRAMEWORK_SEARCH_PATHS_macosx = $(UMBRELLA_FRAMEWORKS_DIR) $(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/Quartz.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/PrivateFrameworks $(FRAMEWORK_SEARCH_PATHS); + GCC_PREFIX_HEADER = mac/WebKitPrefix.h; GCC_PREPROCESSOR_DEFINITIONS = $(DEBUG_DEFINES) $(FEATURE_DEFINES) FRAMEWORK_NAME=WebKit WEBKIT_VERSION_MIN_REQUIRED=WEBKIT_VERSION_LATEST $(GCC_PREPROCESSOR_DEFINITIONS); -HEADER_SEARCH_PATHS = $(WEBCORE_PRIVATE_HEADERS_DIR)/ForwardingHeaders $(WEBCORE_PRIVATE_HEADERS_DIR)/icu "${BUILT_PRODUCTS_DIR}/usr/local/include" "${BUILT_PRODUCTS_DIR}/DerivedSources/WebKit" $(HEADER_SEARCH_PATHS); +HEADER_SEARCH_PATHS = $(WEBCORE_PRIVATE_HEADERS_DIR)/ForwardingHeaders $(WEBCORE_PRIVATE_HEADERS_DIR)/icu $(WEBKITSYSTEMINTERFACE_STATIC_LIBRARY_HEADERS_FOLDER_PATH) "${BUILT_PRODUCTS_DIR}/DerivedSources/WebKit" $(HEADER_SEARCH_PATHS); INFOPLIST_FILE = mac/Info.plist; -INSTALL_PATH = $(SYSTEM_LIBRARY_DIR)/Frameworks; +INSTALL_PATH = $(INSTALL_PATH_$(REAL_PLATFORM_NAME)); +INSTALL_PATH_macosx = $(SYSTEM_LIBRARY_DIR)/Frameworks; INSTALLHDRS_COPY_PHASE = YES; INSTALLHDRS_SCRIPT_PHASE = YES; PRODUCT_NAME = WebKit; -UMBRELLA_FRAMEWORKS_DIR = $(NEXT_ROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/WebKit.framework/Versions/A/Frameworks; -OTHER_LDFLAGS = -sub_umbrella WebCore $(OTHER_LDFLAGS); +UMBRELLA_FRAMEWORKS_DIR = $(PRODUCTION_FRAMEWORKS_DIR)/WebKit.framework/Versions/A/Frameworks; + +OTHER_LDFLAGS = $(OTHER_LDFLAGS_$(REAL_PLATFORM_NAME)); +OTHER_LDFLAGS_iphoneos = -lobjc -framework CFNetwork -framework CoreFoundation -framework CoreGraphics -framework Foundation -framework GraphicsServices -framework ImageIO -framework WebCore; +OTHER_LDFLAGS_iphonesimulator = $(OTHER_LDFLAGS_iphoneos); +OTHER_LDFLAGS_macosx = -sub_umbrella WebCore $(OTHER_LDFLAGS); -WEBCORE_PRIVATE_HEADERS_DIR = $(WEBCORE_PRIVATE_HEADERS_DIR_$(REAL_PLATFORM_NAME)_$(CONFIGURATION)); -WEBCORE_PRIVATE_HEADERS_DIR_macosx_Release = $(WEBCORE_PRIVATE_HEADERS_engineering); -WEBCORE_PRIVATE_HEADERS_DIR_macosx_Debug = $(WEBCORE_PRIVATE_HEADERS_engineering); -WEBCORE_PRIVATE_HEADERS_DIR_macosx_Production = $(UMBRELLA_FRAMEWORKS_DIR)/WebCore.framework/PrivateHeaders; +PRODUCTION_FRAMEWORKS_DIR = $(PRODUCTION_FRAMEWORKS_DIR_$(REAL_PLATFORM_NAME)); +PRODUCTION_FRAMEWORKS_DIR_iphoneos = $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks; +PRODUCTION_FRAMEWORKS_DIR_iphonesimulator = $(PRODUCTION_FRAMEWORKS_DIR_iphoneos); +PRODUCTION_FRAMEWORKS_DIR_macosx = $(NEXT_ROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks; + +PRODUCTION_ROOT = $(PRODUCTION_ROOT_$(REAL_PLATORM_NAME)); +PRODUCTION_ROOT_iphoneos = $(SDKROOT); +PRODUCTION_ROOT_iphonesimulator = $(SDKROOT); +PRODUCTION_ROOT_macosx = $(NEXT_ROOT); + +WEBCORE_PRIVATE_HEADERS_DIR = $(WEBCORE_PRIVATE_HEADERS_DIR_$(CONFIGURATION)); +WEBCORE_PRIVATE_HEADERS_DIR_Release = $(WEBCORE_PRIVATE_HEADERS_engineering); +WEBCORE_PRIVATE_HEADERS_DIR_Debug = $(WEBCORE_PRIVATE_HEADERS_engineering); +WEBCORE_PRIVATE_HEADERS_DIR_Production = $(WEBCORE_PRIVATE_HEADERS_DIR_Production_$(REAL_PLATFORM_NAME)); +WEBCORE_PRIVATE_HEADERS_DIR_Production_iphoneos = $(PRODUCTION_FRAMEWORKS_DIR)/WebCore.framework/PrivateHeaders; +WEBCORE_PRIVATE_HEADERS_DIR_Production_iphonesimulator = $(WEBCORE_PRIVATE_HEADERS_DIR_Production_iphoneos); +WEBCORE_PRIVATE_HEADERS_DIR_Production_macosx = $(UMBRELLA_FRAMEWORKS_DIR)/WebCore.framework/PrivateHeaders; WEBCORE_PRIVATE_HEADERS_engineering = $(BUILT_PRODUCTS_DIR)/WebCore.framework/PrivateHeaders; + +WEBKITSYSTEMINTERFACE_STATIC_LIBRARY_HEADERS_FOLDER_PATH = $(WEBKITSYSTEMINTERFACE_STATIC_LIBRARY_HEADERS_FOLDER_PATH_$(CONFIGURATION)); +WEBKITSYSTEMINTERFACE_STATIC_LIBRARY_HEADERS_FOLDER_PATH_Debug = $(WEBKITSYSTEMINTERFACE_STATIC_LIBRARY_HEADERS_FOLDER_PATH_engineering); +WEBKITSYSTEMINTERFACE_STATIC_LIBRARY_HEADERS_FOLDER_PATH_Release = $(WEBKITSYSTEMINTERFACE_STATIC_LIBRARY_HEADERS_FOLDER_PATH_engineering); +WEBKITSYSTEMINTERFACE_STATIC_LIBRARY_HEADERS_FOLDER_PATH_Production = $(PRODUCTION_ROOT)/usr/local/include; +WEBKITSYSTEMINTERFACE_STATIC_LIBRARY_HEADERS_FOLDER_PATH_engineering = $(BUILT_PRODUCTS_DIR)/usr/local/include; + diff --git a/WebKit/mac/DefaultDelegates/WebDefaultUIDelegate.m b/WebKit/mac/DefaultDelegates/WebDefaultUIDelegate.m index 68fa05e..a327fd4 100644 --- a/WebKit/mac/DefaultDelegates/WebDefaultUIDelegate.m +++ b/WebKit/mac/DefaultDelegates/WebDefaultUIDelegate.m @@ -227,6 +227,10 @@ static WebDefaultUIDelegate *sharedDelegate = nil; { } +- (void)webView:(WebView *)sender exceededApplicationCacheOriginQuotaForSecurityOrigin:(WebSecurityOrigin *)origin +{ +} + - (BOOL)webView:(WebView *)sender shouldReplaceUploadFile:(NSString *)path usingGeneratedFilename:(NSString **)filename { return NO; diff --git a/WebKit/mac/Misc/WebNSDictionaryExtras.h b/WebKit/mac/Misc/WebNSDictionaryExtras.h index 95445f8..0bbc5d5 100644 --- a/WebKit/mac/Misc/WebNSDictionaryExtras.h +++ b/WebKit/mac/Misc/WebNSDictionaryExtras.h @@ -43,5 +43,6 @@ - (void)_webkit_setInt:(int)value forKey:(id)key; - (void)_webkit_setFloat:(float)value forKey:(id)key; - (void)_webkit_setBool:(BOOL)value forKey:(id)key; +- (void)_webkit_setLongLong:(long long)value forKey:(id)key; - (void)_webkit_setUnsignedLongLong:(unsigned long long)value forKey:(id)key; @end diff --git a/WebKit/mac/Misc/WebNSDictionaryExtras.m b/WebKit/mac/Misc/WebNSDictionaryExtras.m index a47fd0b..366f361 100644 --- a/WebKit/mac/Misc/WebNSDictionaryExtras.m +++ b/WebKit/mac/Misc/WebNSDictionaryExtras.m @@ -108,6 +108,13 @@ [object release]; } +- (void)_webkit_setLongLong:(long long)value forKey:(id)key +{ + NSNumber *object = [[NSNumber alloc] initWithLongLong:value]; + [self setObject:object forKey:key]; + [object release]; +} + - (void)_webkit_setUnsignedLongLong:(unsigned long long)value forKey:(id)key { NSNumber *object = [[NSNumber alloc] initWithUnsignedLongLong:value]; diff --git a/WebKit/mac/Storage/WebDatabaseSecurityOrigin.h b/WebKit/mac/Storage/WebDatabaseSecurityOrigin.h new file mode 100644 index 0000000..a06ca3d --- /dev/null +++ b/WebKit/mac/Storage/WebDatabaseSecurityOrigin.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2010 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. + */ + +#import "WebSecurityOriginInternal.h" + +@interface WebDatabaseSecurityOrigin : WebSecurityOrigin +@end diff --git a/WebKit/mac/Storage/WebDatabaseSecurityOrigin.mm b/WebKit/mac/Storage/WebDatabaseSecurityOrigin.mm new file mode 100644 index 0000000..a0c3529 --- /dev/null +++ b/WebKit/mac/Storage/WebDatabaseSecurityOrigin.mm @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2007, 2010 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. + */ + +#import "WebDatabaseSecurityOrigin.h" +#import <WebCore/SecurityOrigin.h> + +using namespace WebCore; + +@implementation WebDatabaseSecurityOrigin + +// FIXME: https://bugs.webkit.org/show_bug.cgi?id=40627 +// Proper steps should be taken to have subclass implementations of SecurityOrigin's +// origin, quota, and setQuota methods. + +@end diff --git a/WebKit/mac/WebCoreSupport/WebApplicationCache.h b/WebKit/mac/WebCoreSupport/WebApplicationCache.h index 282157f..78b06b7 100644 --- a/WebKit/mac/WebCoreSupport/WebApplicationCache.h +++ b/WebKit/mac/WebCoreSupport/WebApplicationCache.h @@ -25,8 +25,12 @@ #import <Foundation/Foundation.h> -@interface WebApplicationCache: NSObject { -} +@interface WebApplicationCache: NSObject + ++ (long long)maximumSize; ++ (void)setMaximumSize:(long long)size; + ++ (long long)defaultOriginQuota; ++ (void)setDefaultOriginQuota:(long long)size; -+ (void)setMaximumSize:(unsigned long long)size; @end diff --git a/WebKit/mac/WebCoreSupport/WebApplicationCache.mm b/WebKit/mac/WebCoreSupport/WebApplicationCache.mm index 4ca749c..5c2a208 100644 --- a/WebKit/mac/WebCoreSupport/WebApplicationCache.mm +++ b/WebKit/mac/WebCoreSupport/WebApplicationCache.mm @@ -32,13 +32,28 @@ using namespace WebCore; @implementation WebApplicationCache -+ (void)setMaximumSize:(unsigned long long)size ++ (long long)maximumSize +{ + return cacheStorage().maximumSize(); +} + ++ (void)setMaximumSize:(long long)size { cacheStorage().empty(); cacheStorage().vacuumDatabaseFile(); cacheStorage().setMaximumSize(size); } ++ (long long)defaultOriginQuota +{ + return cacheStorage().defaultOriginQuota(); +} + ++ (void)setDefaultOriginQuota:(long long)size +{ + cacheStorage().setDefaultOriginQuota(size); +} + @end #endif diff --git a/WebKit/mac/WebCoreSupport/WebApplicationCacheSecurityOrigin.h b/WebKit/mac/WebCoreSupport/WebApplicationCacheSecurityOrigin.h new file mode 100644 index 0000000..09c0610 --- /dev/null +++ b/WebKit/mac/WebCoreSupport/WebApplicationCacheSecurityOrigin.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2010 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. + */ + +#import "WebSecurityOriginInternal.h" + +@interface WebApplicationCacheSecurityOrigin : WebSecurityOrigin +@end diff --git a/WebKit/mac/WebCoreSupport/WebApplicationCacheSecurityOrigin.mm b/WebKit/mac/WebCoreSupport/WebApplicationCacheSecurityOrigin.mm new file mode 100644 index 0000000..dac41ae --- /dev/null +++ b/WebKit/mac/WebCoreSupport/WebApplicationCacheSecurityOrigin.mm @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2010 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. + */ + +#import "WebApplicationCacheSecurityOrigin.h" + +#import <WebCore/ApplicationCacheStorage.h> + +using namespace WebCore; + +@implementation WebApplicationCacheSecurityOrigin + +- (unsigned long long)usage +{ +#if ENABLE(OFFLINE_WEB_APPLICATIONS) + long long usage; + if (cacheStorage().usageForOrigin(reinterpret_cast<SecurityOrigin*>(_private), usage)) + return usage; + return 0; +#else + return 0; +#endif +} + +- (unsigned long long)quota +{ +#if ENABLE(OFFLINE_WEB_APPLICATIONS) + long long quota; + if (cacheStorage().quotaForOrigin(reinterpret_cast<SecurityOrigin*>(_private), quota)) + return quota; + return 0; +#else + return 0; +#endif +} + +- (void)setQuota:(unsigned long long)quota +{ +#if ENABLE(OFFLINE_WEB_APPLICATIONS) + cacheStorage().storeUpdatedQuotaForOrigin(reinterpret_cast<SecurityOrigin*>(_private), quota); +#endif +} + +@end diff --git a/WebKit/mac/WebCoreSupport/WebChromeClient.h b/WebKit/mac/WebCoreSupport/WebChromeClient.h index 707d080..50c159c 100644 --- a/WebKit/mac/WebCoreSupport/WebChromeClient.h +++ b/WebKit/mac/WebCoreSupport/WebChromeClient.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. - * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -117,6 +117,7 @@ public: #endif #if ENABLE(OFFLINE_WEB_APPLICATIONS) virtual void reachedMaxAppCacheSize(int64_t spaceNeeded); + virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*); #endif virtual void populateVisitedLinks(); @@ -167,6 +168,10 @@ public: virtual void requestGeolocationPermissionForFrame(WebCore::Frame*, WebCore::Geolocation*); virtual void cancelGeolocationPermissionRequestForFrame(WebCore::Frame*, WebCore::Geolocation*) { } + virtual bool selectItemWritingDirectionIsNatural(); + virtual PassRefPtr<WebCore::PopupMenu> createPopupMenu(WebCore::PopupMenuClient*) const; + virtual PassRefPtr<WebCore::SearchPopupMenu> createSearchPopupMenu(WebCore::PopupMenuClient*) const; + private: WebView *m_webView; }; diff --git a/WebKit/mac/WebCoreSupport/WebChromeClient.mm b/WebKit/mac/WebCoreSupport/WebChromeClient.mm index eb56240..1a3736e 100644 --- a/WebKit/mac/WebCoreSupport/WebChromeClient.mm +++ b/WebKit/mac/WebCoreSupport/WebChromeClient.mm @@ -1,6 +1,6 @@ /* * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. - * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,6 +30,8 @@ #import "WebChromeClient.h" #import "DOMNodeInternal.h" +#import "WebApplicationCacheSecurityOrigin.h" +#import "WebDatabaseSecurityOrigin.h" #import "WebDefaultUIDelegate.h" #import "WebDelegateImplementationCaching.h" #import "WebElementDictionary.h" @@ -62,12 +64,16 @@ #import <WebCore/Page.h> #import <WebCore/PlatformScreen.h> #import <WebCore/PlatformString.h> +#import <WebCore/PopupMenuMac.h> #import <WebCore/ResourceRequest.h> +#import <WebCore/SearchPopupMenuMac.h> #import <WebCore/Widget.h> #import <WebCore/WindowFeatures.h> #import <wtf/PassRefPtr.h> #import <wtf/Vector.h> + + #if USE(ACCELERATED_COMPOSITING) #import <WebCore/GraphicsLayer.h> #endif @@ -553,7 +559,7 @@ void WebChromeClient::exceededDatabaseQuota(Frame* frame, const String& database { BEGIN_BLOCK_OBJC_EXCEPTIONS; - WebSecurityOrigin *webOrigin = [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:frame->document()->securityOrigin()]; + WebDatabaseSecurityOrigin *webOrigin = [[WebDatabaseSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:frame->document()->securityOrigin()]; // FIXME: remove this workaround once shipping Safari has the necessary delegate implemented. if (WKAppVersionCheckLessThan(@"com.apple.Safari", -1, 3.1)) { const unsigned long long defaultQuota = 5 * 1024 * 1024; // 5 megabytes should hopefully be enough to test storage support. @@ -571,6 +577,17 @@ void WebChromeClient::reachedMaxAppCacheSize(int64_t spaceNeeded) { // FIXME: Free some space. } + +void WebChromeClient::reachedApplicationCacheOriginQuota(SecurityOrigin* origin) +{ + BEGIN_BLOCK_OBJC_EXCEPTIONS; + + WebApplicationCacheSecurityOrigin *webOrigin = [[WebApplicationCacheSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:origin]; + CallUIDelegate(m_webView, @selector(webView:exceededApplicationCacheOriginQuotaForSecurityOrigin:), webOrigin); + [webOrigin release]; + + END_BLOCK_OBJC_EXCEPTIONS; +} #endif void WebChromeClient::populateVisitedLinks() @@ -724,6 +741,21 @@ void WebChromeClient::formDidBlur(const WebCore::Node* node) CallUIDelegate(m_webView, @selector(webView:formDidBlurNode:), kit(const_cast<WebCore::Node*>(node))); } +bool WebChromeClient::selectItemWritingDirectionIsNatural() +{ + return true; +} + +PassRefPtr<WebCore::PopupMenu> WebChromeClient::createPopupMenu(WebCore::PopupMenuClient* client) const +{ + return adoptRef(new PopupMenuMac(client)); +} + +PassRefPtr<WebCore::SearchPopupMenu> WebChromeClient::createSearchPopupMenu(WebCore::PopupMenuClient* client) const +{ + return adoptRef(new SearchPopupMenuMac(client)); +} + #if USE(ACCELERATED_COMPOSITING) void WebChromeClient::attachRootGraphicsLayer(Frame* frame, GraphicsLayer* graphicsLayer) diff --git a/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h b/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h index 0ac4f16..3d34dbe 100644 --- a/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h +++ b/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h @@ -29,8 +29,9 @@ #include <WebCore/PlatformStrategies.h> #include <WebCore/PluginStrategy.h> #include <WebCore/LocalizationStrategy.h> +#include <WebCore/VisitedLinkStrategy.h> -class WebPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::PluginStrategy, private WebCore::LocalizationStrategy { +class WebPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::PluginStrategy, private WebCore::LocalizationStrategy, private WebCore::VisitedLinkStrategy { public: static void initialize(); @@ -40,6 +41,7 @@ private: // WebCore::PlatformStrategies virtual WebCore::PluginStrategy* createPluginStrategy(); virtual WebCore::LocalizationStrategy* createLocalizationStrategy(); + virtual WebCore::VisitedLinkStrategy* createVisitedLinkStrategy(); // WebCore::PluginStrategy virtual void refreshPlugins(); @@ -148,6 +150,10 @@ private: virtual WebCore::String validationMessageRangeUnderflowText(); virtual WebCore::String validationMessageRangeOverflowText(); virtual WebCore::String validationMessageStepMismatchText(); + + // WebCore::VisitedLinkStrategy + virtual bool isLinkVisited(WebCore::Page*, WebCore::LinkHash); + virtual void addVisitedLink(WebCore::Page*, WebCore::LinkHash); }; #endif // WebPlatformStrategies_h diff --git a/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm b/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm index 6805f5e..2900ccf 100644 --- a/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm +++ b/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm @@ -30,6 +30,8 @@ #import "WebPluginPackage.h" #import <WebCore/BlockExceptions.h> #import <WebCore/IntSize.h> +#import <WebCore/Page.h> +#import <WebCore/PageGroup.h> #import <wtf/StdLibExtras.h> #ifdef BUILDING_ON_TIGER @@ -60,6 +62,11 @@ LocalizationStrategy* WebPlatformStrategies::createLocalizationStrategy() return this; } +VisitedLinkStrategy* WebPlatformStrategies::createVisitedLinkStrategy() +{ + return this; +} + void WebPlatformStrategies::refreshPlugins() { [[WebPluginDatabase sharedDatabase] refresh]; @@ -762,3 +769,13 @@ String WebPlatformStrategies::validationMessageStepMismatchText() return UI_STRING("step mismatch", "Validation message for input form controls with value not respecting the step attribute"); } +// VisitedLinkStrategy +bool WebPlatformStrategies::isLinkVisited(Page* page, LinkHash hash) +{ + return page->group().isLinkVisited(hash); +} + +void WebPlatformStrategies::addVisitedLink(Page* page, LinkHash hash) +{ + return page->group().addVisitedLinkHash(hash); +} diff --git a/WebKit/mac/Storage/WebSecurityOrigin.mm b/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm index 56a21f5..0d49445 100644 --- a/WebKit/mac/Storage/WebSecurityOrigin.mm +++ b/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -28,9 +28,9 @@ #import "WebSecurityOriginInternal.h" -#import <WebCore/DatabaseTracker.h> #import <WebCore/KURL.h> #import <WebCore/SecurityOrigin.h> +#import <WebCore/DatabaseTracker.h> using namespace WebCore; @@ -69,6 +69,10 @@ using namespace WebCore; return reinterpret_cast<SecurityOrigin*>(_private)->port(); } +// FIXME: https://bugs.webkit.org/show_bug.cgi?id=40627 +// Proper steps should be taken to have subclass implementations of SecurityOrigin's +// origin, quota, and setQuota methods. + - (unsigned long long)usage { #if ENABLE(DATABASE) @@ -87,9 +91,9 @@ using namespace WebCore; #endif } -// Sets the storage quota (in bytes) -// If the quota is set to a value lower than the current usage, that quota will "stick" but no data will be purged to meet the new quota. -// This will simply prevent new data from being added to databases in that origin +// If the quota is set to a value lower than the current usage, that quota will +// "stick" but no data will be purged to meet the new quota. This will simply +// prevent new data from being added to databases in that origin - (void)setQuota:(unsigned long long)quota { #if ENABLE(DATABASE) diff --git a/WebKit/mac/Storage/WebSecurityOriginInternal.h b/WebKit/mac/WebCoreSupport/WebSecurityOriginInternal.h index 7bd6817..7bd6817 100644 --- a/WebKit/mac/Storage/WebSecurityOriginInternal.h +++ b/WebKit/mac/WebCoreSupport/WebSecurityOriginInternal.h diff --git a/WebKit/mac/Storage/WebSecurityOriginPrivate.h b/WebKit/mac/WebCoreSupport/WebSecurityOriginPrivate.h index c7836f8..6518a16 100644 --- a/WebKit/mac/Storage/WebSecurityOriginPrivate.h +++ b/WebKit/mac/WebCoreSupport/WebSecurityOriginPrivate.h @@ -37,17 +37,19 @@ - (NSString*)protocol; - (NSString*)host; -// Returns zero if the port is the default port for the protocol, non-zero otherwise +// Returns zero if the port is the default port for the protocol, non-zero otherwise. - (unsigned short)port; -// Returns the current total usage of all databases in this security origin in bytes +// Meant to be implemented in a subclass. +// Returns the current total usage of all relevant items in this security origin in bytes. - (unsigned long long)usage; +// Meant to be implemented in a subclass. +// Returns the quota of this security origin in bytes. - (unsigned long long)quota; -// Sets the storage quota (in bytes) -// If the quota is set to a value lower than the current usage, that quota will "stick" but no data will be purged to meet the new quota. -// This will simply prevent new data from being added to databases in that origin -- (void)setQuota:(unsigned long long)quota; +// Meant to be implemented in a subclass. +// Sets the storage quota in bytes. +- (void)setQuota:(unsigned long long)quota; @end diff --git a/WebKit/mac/WebView/WebHTMLView.mm b/WebKit/mac/WebView/WebHTMLView.mm index 08c8911..58ce124 100644 --- a/WebKit/mac/WebView/WebHTMLView.mm +++ b/WebKit/mac/WebView/WebHTMLView.mm @@ -399,7 +399,7 @@ static CachedResourceClient* promisedDataClient() #endif @interface WebHTMLView (WebForwardDeclaration) // FIXME: Put this in a normal category and stop doing the forward declaration trick. -- (void)_setPrinting:(BOOL)printing minimumPageWidth:(float)minPageWidth maximumPageWidth:(float)maxPageWidth adjustViewSize:(BOOL)adjustViewSize; +- (void)_setPrinting:(BOOL)printing minimumPageWidth:(float)minPageWidth height:(float)minPageHeight maximumPageWidth:(float)maxPageWidth adjustViewSize:(BOOL)adjustViewSize; @end @class NSTextInputContext; @@ -1040,7 +1040,7 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart) - (void)_web_setPrintingModeRecursive { - [self _setPrinting:YES minimumPageWidth:0.0f maximumPageWidth:0.0f adjustViewSize:NO]; + [self _setPrinting:YES minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:NO]; #ifndef NDEBUG _private->enumeratingSubviews = YES; @@ -1052,7 +1052,7 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart) unsigned count = [descendantWebHTMLViews count]; for (unsigned i = 0; i < count; ++i) - [[descendantWebHTMLViews objectAtIndex:i] _setPrinting:YES minimumPageWidth:0.0f maximumPageWidth:0.0f adjustViewSize:NO]; + [[descendantWebHTMLViews objectAtIndex:i] _setPrinting:YES minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:NO]; [descendantWebHTMLViews release]; @@ -1063,7 +1063,7 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart) - (void)_web_clearPrintingModeRecursive { - [self _setPrinting:NO minimumPageWidth:0.0f maximumPageWidth:0.0f adjustViewSize:NO]; + [self _setPrinting:NO minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:NO]; #ifndef NDEBUG _private->enumeratingSubviews = YES; @@ -1075,7 +1075,7 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart) unsigned count = [descendantWebHTMLViews count]; for (unsigned i = 0; i < count; ++i) - [[descendantWebHTMLViews objectAtIndex:i] _setPrinting:NO minimumPageWidth:0.0f maximumPageWidth:0.0f adjustViewSize:NO]; + [[descendantWebHTMLViews objectAtIndex:i] _setPrinting:NO minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:NO]; [descendantWebHTMLViews release]; @@ -1086,7 +1086,7 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart) - (void)_web_setPrintingModeRecursiveAndAdjustViewSize { - [self _setPrinting:YES minimumPageWidth:0.0f maximumPageWidth:0.0f adjustViewSize:YES]; + [self _setPrinting:YES minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:YES]; #ifndef NDEBUG _private->enumeratingSubviews = YES; @@ -1098,7 +1098,7 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart) unsigned count = [descendantWebHTMLViews count]; for (unsigned i = 0; i < count; ++i) - [[descendantWebHTMLViews objectAtIndex:i] _setPrinting:YES minimumPageWidth:0.0f maximumPageWidth:0.0f adjustViewSize:YES]; + [[descendantWebHTMLViews objectAtIndex:i] _setPrinting:YES minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:YES]; [descendantWebHTMLViews release]; @@ -2230,29 +2230,31 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info) return _private->printing; } -- (BOOL)_beginPrintModeWithPageWidth:(float)pageWidth shrinkToFit:(BOOL)shrinkToFit +- (BOOL)_beginPrintModeWithPageWidth:(float)pageWidth height:(float)pageHeight shrinkToFit:(BOOL)shrinkToFit { Frame* frame = core([self _frame]); if (!frame) return NO; float minLayoutWidth = 0; + float minLayoutHeight = 0; float maxLayoutWidth = 0; // If we are a frameset just print with the layout we have onscreen, otherwise relayout // according to the page width. if (!frame->document() || !frame->document()->isFrameSet()) { minLayoutWidth = shrinkToFit ? pageWidth * _WebHTMLViewPrintingMinimumShrinkFactor : pageWidth; + minLayoutHeight = shrinkToFit ? pageHeight * _WebHTMLViewPrintingMinimumShrinkFactor : pageHeight; maxLayoutWidth = shrinkToFit ? pageWidth * _WebHTMLViewPrintingMaximumShrinkFactor : pageWidth; } - [self _setPrinting:YES minimumPageWidth:minLayoutWidth maximumPageWidth:maxLayoutWidth adjustViewSize:YES]; + [self _setPrinting:YES minimumPageWidth:minLayoutWidth height:minLayoutHeight maximumPageWidth:maxLayoutWidth adjustViewSize:YES]; return YES; } - (void)_endPrintMode { - [self _setPrinting:NO minimumPageWidth:0 maximumPageWidth:0 adjustViewSize:YES]; + [self _setPrinting:NO minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:YES]; } - (CGFloat)_adjustedBottomOfPageWithTop:(CGFloat)top bottom:(CGFloat)bottom limit:(CGFloat)bottomLimit @@ -3104,7 +3106,7 @@ WEBCORE_COMMAND(yankAndSelect) // Do a layout, but set up a new fixed width for the purposes of doing printing layout. // minPageWidth==0 implies a non-printing layout -- (void)layoutToMinimumPageWidth:(float)minPageWidth maximumPageWidth:(float)maxPageWidth adjustingViewSize:(BOOL)adjustViewSize +- (void)layoutToMinimumPageWidth:(float)minPageWidth height:(float)minPageHeight maximumPageWidth:(float)maxPageWidth adjustingViewSize:(BOOL)adjustViewSize { [self reapplyStyles]; @@ -3123,7 +3125,7 @@ WEBCORE_COMMAND(yankAndSelect) if (FrameView* coreView = coreFrame->view()) { if (minPageWidth > 0.0) - coreView->forceLayoutWithPageWidthRange(minPageWidth, maxPageWidth, adjustViewSize); + coreView->forceLayoutForPagination(FloatSize(minPageWidth, minPageHeight), maxPageWidth / minPageWidth, adjustViewSize ? Frame::AdjustViewSize : Frame::DoNotAdjustViewSize); else { coreView->forceLayout(!adjustViewSize); if (adjustViewSize) @@ -3139,7 +3141,7 @@ WEBCORE_COMMAND(yankAndSelect) - (void)layout { - [self layoutToMinimumPageWidth:0.0f maximumPageWidth:0.0f adjustingViewSize:NO]; + [self layoutToMinimumPageWidth:0 height:0 maximumPageWidth:0 adjustingViewSize:NO]; } // Deliver mouseup events to the DOM for button 2. @@ -3820,7 +3822,7 @@ static BOOL isInPasswordField(Frame* coreFrame) // Does setNeedsDisplay:NO as a side effect when printing is ending. // pageWidth != 0 implies we will relayout to a new width -- (void)_setPrinting:(BOOL)printing minimumPageWidth:(float)minPageWidth maximumPageWidth:(float)maxPageWidth adjustViewSize:(BOOL)adjustViewSize +- (void)_setPrinting:(BOOL)printing minimumPageWidth:(float)minPageWidth height:(float)minPageHeight maximumPageWidth:(float)maxPageWidth adjustViewSize:(BOOL)adjustViewSize { WebFrame *frame = [self _frame]; NSArray *subframes = [frame childFrames]; @@ -3830,7 +3832,7 @@ static BOOL isInPasswordField(Frame* coreFrame) WebFrame *subframe = [subframes objectAtIndex:i]; WebFrameView *frameView = [subframe frameView]; if ([[subframe _dataSource] _isDocumentHTML]) { - [(WebHTMLView *)[frameView documentView] _setPrinting:printing minimumPageWidth:0.0f maximumPageWidth:0.0f adjustViewSize:adjustViewSize]; + [(WebHTMLView *)[frameView documentView] _setPrinting:printing minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:adjustViewSize]; } } @@ -3842,7 +3844,7 @@ static BOOL isInPasswordField(Frame* coreFrame) _private->avoidingPrintOrphan = NO; [self setNeedsToApplyStyles:YES]; [self setNeedsLayout:YES]; - [self layoutToMinimumPageWidth:minPageWidth maximumPageWidth:maxPageWidth adjustingViewSize:adjustViewSize]; + [self layoutToMinimumPageWidth:minPageWidth height:minPageHeight maximumPageWidth:maxPageWidth adjustingViewSize:adjustViewSize]; if (!printing) { // Can't do this when starting printing or nested printing won't work, see 3491427. [self setNeedsDisplay:NO]; @@ -3863,7 +3865,7 @@ static BOOL isInPasswordField(Frame* coreFrame) // If the WebHTMLView itself is what we're printing, then we will never have to do this. BOOL wasInPrintingMode = _private->printing; if (!wasInPrintingMode) - [self _setPrinting:YES minimumPageWidth:0.0f maximumPageWidth:0.0f adjustViewSize:NO]; + [self _setPrinting:YES minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:NO]; *newBottom = [self _adjustedBottomOfPageWithTop:oldTop bottom:oldBottom limit:bottomLimit]; @@ -3874,7 +3876,7 @@ static BOOL isInPasswordField(Frame* coreFrame) [self performSelector:@selector(_delayedEndPrintMode:) withObject:currenPrintOperation afterDelay:0]; else // not sure if this is actually ever invoked, it probably shouldn't be - [self _setPrinting:NO minimumPageWidth:0.0f maximumPageWidth:0.0f adjustViewSize:NO]; + [self _setPrinting:NO minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:NO]; } } @@ -3904,8 +3906,8 @@ static BOOL isInPasswordField(Frame* coreFrame) // This is used for Carbon printing. At some point we might want to make this public API. - (void)setPageWidthForPrinting:(float)pageWidth { - [self _setPrinting:NO minimumPageWidth:0.0f maximumPageWidth:0.0f adjustViewSize:NO]; - [self _setPrinting:YES minimumPageWidth:pageWidth maximumPageWidth:pageWidth adjustViewSize:YES]; + [self _setPrinting:NO minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:NO]; + [self _setPrinting:YES minimumPageWidth:pageWidth height:0 maximumPageWidth:pageWidth adjustViewSize:YES]; } - (void)_endPrintModeAndRestoreWindowAutodisplay @@ -3948,8 +3950,9 @@ static BOOL isInPasswordField(Frame* coreFrame) [self displayIfNeeded]; [[self window] setAutodisplay:NO]; + [[self _webView] _adjustPrintingMarginsForHeaderAndFooter]; NSPrintOperation *printOperation = [NSPrintOperation currentOperation]; - if (![self _beginPrintModeWithPageWidth:[printOperation _web_availablePaperWidth] shrinkToFit:YES]) + if (![self _beginPrintModeWithPageWidth:[printOperation _web_availablePaperWidth] height:[printOperation _web_availablePaperHeight] shrinkToFit:YES]) return NO; // Certain types of errors, including invalid page ranges, can cause beginDocument and @@ -3959,7 +3962,6 @@ static BOOL isInPasswordField(Frame* coreFrame) // If not cancelled, this delayed call will be invoked in the next pass through the main event loop, // which is after beginDocument and endDocument would be called. [self performSelector:@selector(_delayedEndPrintMode:) withObject:printOperation afterDelay:0]; - [[self _webView] _adjustPrintingMarginsForHeaderAndFooter]; // There is a theoretical chance that someone could do some drawing between here and endDocument, // if something caused setNeedsDisplay after this point. If so, it's not a big tragedy, because diff --git a/WebKit/mac/WebView/WebHTMLViewPrivate.h b/WebKit/mac/WebView/WebHTMLViewPrivate.h index 3beb0d6..c2ca3fe 100644 --- a/WebKit/mac/WebView/WebHTMLViewPrivate.h +++ b/WebKit/mac/WebView/WebHTMLViewPrivate.h @@ -135,7 +135,7 @@ extern const float _WebHTMLViewPrintingMaximumShrinkFactor; - (void)_layoutForPrinting; - (WebCGFloat)_adjustedBottomOfPageWithTop:(WebCGFloat)top bottom:(WebCGFloat)bottom limit:(WebCGFloat)bottomLimit; - (BOOL)_isInPrintMode; -- (BOOL)_beginPrintModeWithPageWidth:(float)pageWidth shrinkToFit:(BOOL)shrinkToFit; +- (BOOL)_beginPrintModeWithPageWidth:(float)pageWidth height:(float)pageHeight shrinkToFit:(BOOL)shrinkToFit; - (void)_endPrintMode; - (BOOL)_canSmartReplaceWithPasteboard:(NSPasteboard *)pasteboard; diff --git a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h index 4175a5d..a8ebdca 100644 --- a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h +++ b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h @@ -83,6 +83,8 @@ #define WebKitLocalStorageDatabasePathPreferenceKey @"WebKitLocalStorageDatabasePathPreferenceKey" #define WebKitEnableFullDocumentTeardownPreferenceKey @"WebKitEnableFullDocumentTeardown" #define WebKitOfflineWebApplicationCacheEnabledPreferenceKey @"WebKitOfflineWebApplicationCacheEnabled" +#define WebKitApplicationCacheTotalQuota @"WebKitApplicationCacheTotalQuota" +#define WebKitApplicationCacheDefaultOriginQuota @"WebKitApplicationCacheDefaultOriginQuota" #define WebKitZoomsTextOnlyPreferenceKey @"WebKitZoomsTextOnly" #define WebKitJavaScriptCanAccessClipboardPreferenceKey @"WebKitJavaScriptCanAccessClipboard" #define WebKitXSSAuditorEnabledPreferenceKey @"WebKitXSSAuditorEnabled" diff --git a/WebKit/mac/WebView/WebPreferences.mm b/WebKit/mac/WebView/WebPreferences.mm index 63915dc..7ec2439 100644 --- a/WebKit/mac/WebView/WebPreferences.mm +++ b/WebKit/mac/WebView/WebPreferences.mm @@ -30,6 +30,7 @@ #import "WebPreferencesPrivate.h" #import "WebPreferenceKeysPrivate.h" +#import "WebApplicationCache.h" #import "WebKitLogging.h" #import "WebKitNSStringExtras.h" #import "WebKitSystemBits.h" @@ -37,6 +38,7 @@ #import "WebKitVersionChecks.h" #import "WebNSDictionaryExtras.h" #import "WebNSURLExtras.h" +#import <WebCore/ApplicationCacheStorage.h> NSString *WebPreferencesChangedNotification = @"WebPreferencesChangedNotification"; NSString *WebPreferencesRemovedNotification = @"WebPreferencesRemovedNotification"; @@ -170,6 +172,8 @@ static WebCacheModel cacheModelForMainBundle(void) - (void)_setIntegerValue:(int)value forKey:(NSString *)key; - (float)_floatValueForKey:(NSString *)key; - (void)_setFloatValue:(float)value forKey:(NSString *)key; +- (void)_setLongLongValue:(long long)value forKey:(NSString *)key; +- (long long)_longLongValueForKey:(NSString *)key; - (void)_setUnsignedLongLongValue:(unsigned long long)value forKey:(NSString *)key; - (unsigned long long)_unsignedLongLongValueForKey:(NSString *)key; @end @@ -364,6 +368,8 @@ static WebCacheModel cacheModelForMainBundle(void) [NSNumber numberWithBool:NO], WebKitHTML5TreeBuilderEnabledPreferenceKey, [NSNumber numberWithBool:YES], WebKitDNSPrefetchingEnabledPreferenceKey, [NSNumber numberWithBool:NO], WebKitMemoryInfoEnabledPreferenceKey, + [NSNumber numberWithLongLong:WebCore::ApplicationCacheStorage::noQuota()], WebKitApplicationCacheTotalQuota, + [NSNumber numberWithLongLong:WebCore::ApplicationCacheStorage::noQuota()], WebKitApplicationCacheDefaultOriginQuota, nil]; // This value shouldn't ever change, which is assumed in the initialization of WebKitPDFDisplayModePreferenceKey above @@ -461,6 +467,23 @@ static WebCacheModel cacheModelForMainBundle(void) [self _postPreferencesChangesNotification]; } +- (long long)_longLongValueForKey:(NSString *)key +{ + id o = [self _valueForKey:key]; + return [o respondsToSelector:@selector(longLongValue)] ? [o longLongValue] : 0; +} + +- (void)_setLongLongValue:(long long)value forKey:(NSString *)key +{ + if ([self _longLongValueForKey:key] == value) + return; + NSString *_key = KEY(key); + [_private->values _webkit_setLongLong:value forKey:_key]; + if (_private->autosaves) + [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithLongLong:value] forKey:_key]; + [self _postPreferencesChangesNotification]; +} + - (unsigned long long)_unsignedLongLongValueForKey:(NSString *)key { id o = [self _valueForKey:key]; @@ -973,6 +996,31 @@ static WebCacheModel cacheModelForMainBundle(void) [self _setFloatValue:factor forKey:WebKitPDFScaleFactorPreferenceKey]; } +- (int64_t)applicationCacheTotalQuota +{ + ASSERT([self _longLongValueForKey:WebKitApplicationCacheTotalQuota] == [WebApplicationCache maximumSize]); + return [self _longLongValueForKey:WebKitApplicationCacheTotalQuota]; +} + +- (void)setApplicationCacheTotalQuota:(int64_t)quota +{ + [self _setLongLongValue:quota forKey:WebKitApplicationCacheTotalQuota]; + + // Application Cache Preferences are stored on the global cache storage manager, not in Settings. + [WebApplicationCache setMaximumSize:quota]; +} + +- (int64_t)applicationCacheDefaultOriginQuota +{ + ASSERT([self _longLongValueForKey:WebKitApplicationCacheDefaultOriginQuota] == [WebApplicationCache defaultOriginQuota]); + return [self _longLongValueForKey:WebKitApplicationCacheDefaultOriginQuota]; +} + +- (void)setApplicationCacheDefaultOriginQuota:(int64_t)quota +{ + [self _setLongLongValue:quota forKey:WebKitApplicationCacheDefaultOriginQuota]; +} + - (PDFDisplayMode)PDFDisplayMode { PDFDisplayMode value = [self _integerValueForKey:WebKitPDFDisplayModePreferenceKey]; diff --git a/WebKit/mac/WebView/WebPreferencesPrivate.h b/WebKit/mac/WebView/WebPreferencesPrivate.h index 073b364..01f2aa8 100644 --- a/WebKit/mac/WebView/WebPreferencesPrivate.h +++ b/WebKit/mac/WebView/WebPreferencesPrivate.h @@ -134,6 +134,12 @@ extern NSString *WebPreferencesRemovedNotification; - (float)PDFScaleFactor; - (void)setPDFScaleFactor:(float)scale; +- (int64_t)applicationCacheTotalQuota; +- (void)setApplicationCacheTotalQuota:(int64_t)quota; + +- (int64_t)applicationCacheDefaultOriginQuota; +- (void)setApplicationCacheDefaultOriginQuota:(int64_t)quota; + - (WebKitEditableLinkBehavior)editableLinkBehavior; - (void)setEditableLinkBehavior:(WebKitEditableLinkBehavior)behavior; diff --git a/WebKit/mac/WebView/WebUIDelegatePrivate.h b/WebKit/mac/WebView/WebUIDelegatePrivate.h index eccb10f..0fb120c 100644 --- a/WebKit/mac/WebView/WebUIDelegatePrivate.h +++ b/WebKit/mac/WebView/WebUIDelegatePrivate.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -125,6 +125,16 @@ enum { */ - (void)webView:(WebView *)sender frame:(WebFrame *)frame exceededDatabaseQuotaForSecurityOrigin:(WebSecurityOrigin *)origin database:(NSString *)databaseIdentifier; +/*! + @method webView:exceededApplicationCacheOriginQuotaForSecurityOrigin: + @param sender The WebView sending the delegate method. + @param origin The security origin that needs a larger quota + @discussion This method is called when a page attempts to store more in the Application Cache + for an origin than was allowed by the quota (or default) set for the origin. This allows the + quota to be increased for the security origin. +*/ +- (void)webView:(WebView *)sender exceededApplicationCacheOriginQuotaForSecurityOrigin:(WebSecurityOrigin *)origin; + - (WebView *)webView:(WebView *)sender createWebViewWithRequest:(NSURLRequest *)request windowFeatures:(NSDictionary *)features; - (BOOL)webView:(WebView *)sender shouldReplaceUploadFile:(NSString *)path usingGeneratedFilename:(NSString **)filename; diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm index 3d878bc..aefd56b 100644 --- a/WebKit/mac/WebView/WebView.mm +++ b/WebKit/mac/WebView/WebView.mm @@ -34,6 +34,7 @@ #import "DOMCSSStyleDeclarationInternal.h" #import "DOMNodeInternal.h" #import "DOMRangeInternal.h" +#import "WebApplicationCache.h" #import "WebBackForwardListInternal.h" #import "WebBaseNetscapePluginView.h" #import "WebCache.h" @@ -1440,6 +1441,9 @@ static bool fastDocumentTeardownEnabled() settings->setHTML5TreeBuilderEnabled_DO_NOT_USE([preferences html5TreeBuilderEnabled]); settings->setPaginateDuringLayoutEnabled([preferences paginateDuringLayoutEnabled]); settings->setMemoryInfoEnabled([preferences memoryInfoEnabled]); + + // Application Cache Preferences are stored on the global cache storage manager, not in Settings. + [WebApplicationCache setDefaultOriginQuota:[preferences applicationCacheDefaultOriginQuota]]; } static inline IMP getMethod(id o, SEL s) diff --git a/WebKit/qt/Api/qgraphicswebview.cpp b/WebKit/qt/Api/qgraphicswebview.cpp index 8a94c9b..53c1494 100644 --- a/WebKit/qt/Api/qgraphicswebview.cpp +++ b/WebKit/qt/Api/qgraphicswebview.cpp @@ -711,7 +711,12 @@ void QGraphicsWebView::load(const QNetworkRequest& request, through the charset attribute of the HTML script tag. Alternatively, the encoding can also be specified by the web server. - \sa load(), setContent(), QWebFrame::toHtml() + This is a convenience function equivalent to setContent(html, "text/html", baseUrl). + + \warning This function works only for HTML, for other mime types (i.e. XHTML, SVG) + setContent() should be used instead. + + \sa load(), setContent(), QWebFrame::toHtml(), QWebFrame::setContent() */ void QGraphicsWebView::setHtml(const QString& html, const QUrl& baseUrl) { diff --git a/WebKit/qt/Api/qwebframe.cpp b/WebKit/qt/Api/qwebframe.cpp index f10d5b4..e90367e 100644 --- a/WebKit/qt/Api/qwebframe.cpp +++ b/WebKit/qt/Api/qwebframe.cpp @@ -793,9 +793,14 @@ void QWebFrame::load(const QNetworkRequest &req, script can be specified through the charset attribute of the HTML script tag. It is also possible for the encoding to be specified by web server. + This is a convenience function equivalent to setContent(html, "text/html", baseUrl). + \note This method will not affect session or global history for the frame. - \sa toHtml(), setContent() + \warning This function works only for HTML, for other mime types (i.e. XHTML, SVG) + setContent() should be used instead. + + \sa toHtml(), setContent(), load() */ void QWebFrame::setHtml(const QString &html, const QUrl &baseUrl) { diff --git a/WebKit/qt/Api/qwebpage.cpp b/WebKit/qt/Api/qwebpage.cpp index fa49293..a8bd06a 100644 --- a/WebKit/qt/Api/qwebpage.cpp +++ b/WebKit/qt/Api/qwebpage.cpp @@ -1218,14 +1218,7 @@ typedef struct { void QWebPagePrivate::dynamicPropertyChangeEvent(QDynamicPropertyChangeEvent* event) { if (event->propertyName() == "_q_viewMode") { - QString mode = q->property("_q_viewMode").toString(); - if (mode != viewMode) { - viewMode = mode; - WebCore::Frame* frame = QWebFramePrivate::core(q->mainFrame()); - WebCore::FrameView* view = frame->view(); - frame->document()->updateStyleSelector(); - view->layout(); - } + 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); diff --git a/WebKit/qt/Api/qwebpage_p.h b/WebKit/qt/Api/qwebpage_p.h index 44ceb87..cf4ab88 100644 --- a/WebKit/qt/Api/qwebpage_p.h +++ b/WebKit/qt/Api/qwebpage_p.h @@ -201,8 +201,6 @@ public: QWebInspector* inspector; bool inspectorIsInternalOnly; // True if created through the Inspect context menu action Qt::DropAction m_lastDropAction; - - QString viewMode; static bool drtRun; }; diff --git a/WebKit/qt/Api/qwebview.cpp b/WebKit/qt/Api/qwebview.cpp index 3daa045..773c79a 100644 --- a/WebKit/qt/Api/qwebview.cpp +++ b/WebKit/qt/Api/qwebview.cpp @@ -470,7 +470,12 @@ void QWebView::load(const QNetworkRequest &request, through the charset attribute of the HTML script tag. Alternatively, the encoding can also be specified by the web server. - \sa load(), setContent(), QWebFrame::toHtml() + This is a convenience function equivalent to setContent(html, "text/html", baseUrl). + + \warning This function works only for HTML, for other mime types (i.e. XHTML, SVG) + setContent() should be used instead. + + \sa load(), setContent(), QWebFrame::toHtml(), QWebFrame::setContent() */ void QWebView::setHtml(const QString &html, const QUrl &baseUrl) { diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog index 455fd89..b49385a 100644 --- a/WebKit/qt/ChangeLog +++ b/WebKit/qt/ChangeLog @@ -1,3 +1,119 @@ +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu + instances, concrete classes that inherit from ChromeClient needed to be changed to + implement the new methods. + + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::selectItemWritingDirectionIsNatural): + (WebCore::ChromeClientQt::createPopupMenu): + (WebCore::ChromeClientQt::createSearchPopupMenu): + * WebCoreSupport/ChromeClientQt.h: + +2010-08-02 Jeremy Orlow <jorlow@chromium.org> + + Speculative revert of 64425 due to Chromium instability + https://bugs.webkit.org/show_bug.cgi?id=43347 + + * WebCoreSupport/ChromeClientQt.cpp: + * WebCoreSupport/ChromeClientQt.h: + +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu + instances, concrete classes that inherit from ChromeClient needed to be changed to + implement the new methods. + + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::selectItemWritingDirectionIsNatural): + (WebCore::ChromeClientQt::createPopupMenu): + (WebCore::ChromeClientQt::createSearchPopupMenu): + * WebCoreSupport/ChromeClientQt.h: + +2010-07-31 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r64422. + http://trac.webkit.org/changeset/64422 + https://bugs.webkit.org/show_bug.cgi?id=43304 + + Build fixes are needed for Snow Leopard and Windows. + (Requested by lca on #webkit). + + * WebCoreSupport/ChromeClientQt.cpp: + * WebCoreSupport/ChromeClientQt.h: + +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu + instances, concrete classes that inherit from ChromeClient needed to be changed to + implement the new methods. + + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::selectItemWritingDirectionIsNatural): + (WebCore::ChromeClientQt::createPopupMenu): + (WebCore::ChromeClientQt::createSearchPopupMenu): + * WebCoreSupport/ChromeClientQt.h: + +2010-07-30 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Simon Fraser. + + Enabling view modes to all platforms + https://bugs.webkit.org/show_bug.cgi?id=37505 + + As view mode media feature is now supported by WebCore there is no need + to keep its implementation here. QtWebKit now uses WebCore's view mode media feature + implementation. + + * Api/qwebpage.cpp: + (QWebPagePrivate::dynamicPropertyChangeEvent): + * Api/qwebpage_p.h: + * WebCoreSupport/ChromeClientQt.cpp: + * WebCoreSupport/ChromeClientQt.h: + +2010-07-30 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by David Kilzer. + + Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas) + https://bugs.webkit.org/show_bug.cgi?id=40627 + + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::reachedApplicationCacheOriginQuota): + * WebCoreSupport/ChromeClientQt.h: + +2010-07-29 Alexis Menard <alexis.menard@nokia.com> + + Reviewed by Antonio Gomes. + + QWebFrame and QWebView documentation fix. + + The QWebFrame and the QWebView setHtml() methods are a bit confusing. + There are a few registered bugs in Webkit's bugzilla that source is + in a bad usage of the function. + Additional information were added. + + https://bugs.webkit.org/show_bug.cgi?id=31115 + + * Api/qgraphicswebview.cpp: + * Api/qwebframe.cpp: + * Api/qwebview.cpp: + 2010-07-28 Kim Grönholm <kim.1.gronholm@nokia.com> Reviewed by Antonio Gomes. diff --git a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp index 2c64a78..a0bac72 100644 --- a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp @@ -1,6 +1,7 @@ /* * Copyright (C) 2006 Zack Rusin <zack@kde.org> * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * All rights reserved. * @@ -45,6 +46,7 @@ #include "NotImplemented.h" #include "NotificationPresenterClientQt.h" #include "PageClientQt.h" +#include "PopupMenuQt.h" #if defined(Q_WS_MAEMO_5) #include "QtMaemoWebPopup.h" #else @@ -52,6 +54,7 @@ #endif #include "QWebPageClient.h" #include "ScrollbarTheme.h" +#include "SearchPopupMenuQt.h" #include "SecurityOrigin.h" #include "ViewportArguments.h" #include "WindowFeatures.h" @@ -483,6 +486,11 @@ void ChromeClientQt::reachedMaxAppCacheSize(int64_t) // FIXME: Free some space. notImplemented(); } + +void ChromeClientQt::reachedApplicationCacheOriginQuota(SecurityOrigin*) +{ + notImplemented(); +} #endif #if ENABLE(NOTIFICATIONS) @@ -598,33 +606,6 @@ QtAbstractWebPopup* ChromeClientQt::createSelectPopup() #endif } -#if ENABLE(WIDGETS_10_SUPPORT) -bool ChromeClientQt::isWindowed() -{ - return m_webPage->d->viewMode == "windowed"; -} - -bool ChromeClientQt::isFloating() -{ - return m_webPage->d->viewMode == "floating"; -} - -bool ChromeClientQt::isFullscreen() -{ - return m_webPage->d->viewMode == "fullscreen"; -} - -bool ChromeClientQt::isMaximized() -{ - return m_webPage->d->viewMode == "maximized"; -} - -bool ChromeClientQt::isMinimized() -{ - return m_webPage->d->viewMode == "minimized"; -} -#endif - void ChromeClientQt::didReceiveViewportArguments(Frame* frame, const ViewportArguments& arguments) const { if (m_webPage->mainFrame()->d->initialLayoutComplete) @@ -644,4 +625,19 @@ void ChromeClientQt::didReceiveViewportArguments(Frame* frame, const ViewportArg emit m_webPage->viewportChangeRequested(hints); } +bool ChromeClientQt::selectItemWritingDirectionIsNatural() +{ + return false; +} + +PassRefPtr<PopupMenu> ChromeClientQt::createPopupMenu(PopupMenuClient* client) const +{ + return adoptRef(new PopupMenuQt(client)); +} + +PassRefPtr<SearchPopupMenu> ChromeClientQt::createSearchPopupMenu(PopupMenuClient* client) const +{ + return adoptRef(new SearchPopupMenuQt(client)); +} + } // namespace WebCore diff --git a/WebKit/qt/WebCoreSupport/ChromeClientQt.h b/WebKit/qt/WebCoreSupport/ChromeClientQt.h index 70b4a25..aab2813 100644 --- a/WebKit/qt/WebCoreSupport/ChromeClientQt.h +++ b/WebKit/qt/WebCoreSupport/ChromeClientQt.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2006 Zack Rusin <zack@kde.org> + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * All rights reserved. * @@ -131,6 +132,7 @@ namespace WebCore { #endif #if ENABLE(OFFLINE_WEB_APPLICATIONS) virtual void reachedMaxAppCacheSize(int64_t spaceNeeded); + virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*); #endif #if ENABLE(NOTIFICATIONS) @@ -168,13 +170,9 @@ namespace WebCore { virtual void requestGeolocationPermissionForFrame(Frame*, Geolocation*); virtual void cancelGeolocationPermissionRequestForFrame(Frame*, Geolocation*) { } -#if ENABLE(WIDGETS_10_SUPPORT) - virtual bool isWindowed(); - virtual bool isFloating(); - virtual bool isFullscreen(); - virtual bool isMaximized(); - virtual bool isMinimized(); -#endif + virtual bool selectItemWritingDirectionIsNatural(); + virtual PassRefPtr<PopupMenu> createPopupMenu(PopupMenuClient*) const; + virtual PassRefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const; QtAbstractWebPopup* createSelectPopup(); diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog index 6b81bcc..d4a850e 100644 --- a/WebKit/win/ChangeLog +++ b/WebKit/win/ChangeLog @@ -1,3 +1,120 @@ +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu + instances, concrete classes that inherit from ChromeClient needed to be changed to + implement the new methods. + + * WebCoreSupport/WebChromeClient.cpp: + (WebChromeClient::selectItemWritingDirectionIsNatural): + (WebChromeClient::createPopupMenu): + (WebChromeClient::createSearchPopupMenu): + * WebCoreSupport/WebChromeClient.h: + +2010-08-02 Jon Honeycutt <jhoneycutt@apple.com> + + Move InjectedBundle.vcproj to where the other WebKitTestRunner vcprojs live. + + Reviewed by Sam Weinig. + + * WebKit.vcproj/WebKit.sln: + +2010-08-02 Jeremy Orlow <jorlow@chromium.org> + + Speculative revert of 64425 due to Chromium instability + https://bugs.webkit.org/show_bug.cgi?id=43347 + + * WebCoreSupport/WebChromeClient.cpp: + * WebCoreSupport/WebChromeClient.h: + * WebView.cpp: + (WebView::mouseWheel): + +2010-07-31 Luiz Agostini <luiz.agostini@openbossa.org> + + Build fix: Windows. + + * WebView.cpp: + (WebView::mouseWheel): + +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu + instances, concrete classes that inherit from ChromeClient needed to be changed to + implement the new methods. + + * WebCoreSupport/WebChromeClient.cpp: + (WebChromeClient::selectItemWritingDirectionIsNatural): + (WebChromeClient::createPopupMenu): + (WebChromeClient::createSearchPopupMenu): + * WebCoreSupport/WebChromeClient.h: + +2010-07-31 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r64422. + http://trac.webkit.org/changeset/64422 + https://bugs.webkit.org/show_bug.cgi?id=43304 + + Build fixes are needed for Snow Leopard and Windows. + (Requested by lca on #webkit). + + * WebCoreSupport/WebChromeClient.cpp: + * WebCoreSupport/WebChromeClient.h: + +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu + instances, concrete classes that inherit from ChromeClient needed to be changed to + implement the new methods. + + * WebCoreSupport/WebChromeClient.cpp: + (WebChromeClient::selectItemWritingDirectionIsNatural): + (WebChromeClient::createPopupMenu): + (WebChromeClient::createSearchPopupMenu): + * WebCoreSupport/WebChromeClient.h: + +2010-07-31 Daniel Bates <dbates@rim.com> + + Attempt to fix the Windows build after changeset 64409 <http://trac.webkit.org/changeset/64409>. + + * WebFrame.cpp: + (WebFrame::setPrinting): + +2010-07-30 Dan Bernstein <mitz@apple.com> + + Reviewed by Darin Adler. + + <rdar://problem/8257783> Short documents may print a second blank page + https://bugs.webkit.org/show_bug.cgi?id=43271 + + * WebFrame.cpp: + (WebFrame::setPrinting): Updated for changes to Frame::setPrinting(). Passing 0 for the + page height, which maintains existing behavior. + +2010-07-30 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by David Kilzer. + + Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas) + https://bugs.webkit.org/show_bug.cgi?id=40627 + + * WebCoreSupport/WebChromeClient.cpp: + (WebChromeClient::reachedApplicationCacheOriginQuota): + * WebCoreSupport/WebChromeClient.h: + 2010-07-26 Steve Block <steveblock@google.com> Reviewed by Jeremy Orlow. diff --git a/WebKit/win/WebCoreSupport/WebChromeClient.cpp b/WebKit/win/WebCoreSupport/WebChromeClient.cpp index 73532a6..08d4ee9 100644 --- a/WebKit/win/WebCoreSupport/WebChromeClient.cpp +++ b/WebKit/win/WebCoreSupport/WebChromeClient.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -55,6 +56,9 @@ #include <WebCore/LocalizedStrings.h> #include <WebCore/NotImplemented.h> #include <WebCore/Page.h> +#include <WebCore/SecurityOrigin.h> +#include <WebCore/PopupMenuWin.h> +#include <WebCore/SearchPopupMenuWin.h> #include <WebCore/WindowFeatures.h> #pragma warning(pop) @@ -617,6 +621,11 @@ void WebChromeClient::reachedMaxAppCacheSize(int64_t spaceNeeded) // FIXME: Free some space. notImplemented(); } + +void WebChromeClient::reachedApplicationCacheOriginQuota(SecurityOrigin*) +{ + notImplemented(); +} #endif void WebChromeClient::populateVisitedLinks() @@ -868,3 +877,18 @@ void WebChromeClient::exitFullscreenForNode(Node*) #endif +bool WebChromeClient::selectItemWritingDirectionIsNatural() +{ + return true; +} + +PassRefPtr<PopupMenu> WebChromeClient::createPopupMenu(PopupMenuClient* client) const +{ + return adoptRef(new PopupMenuWin(client)); +} + +PassRefPtr<SearchPopupMenu> WebChromeClient::createSearchPopupMenu(PopupMenuClient* client) const +{ + return adoptRef(new SearchPopupMenuWin(client)); +} + diff --git a/WebKit/win/WebCoreSupport/WebChromeClient.h b/WebKit/win/WebCoreSupport/WebChromeClient.h index e7845a9..cea11c7 100644 --- a/WebKit/win/WebCoreSupport/WebChromeClient.h +++ b/WebKit/win/WebCoreSupport/WebChromeClient.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -118,6 +119,7 @@ public: #if ENABLE(OFFLINE_WEB_APPLICATIONS) virtual void reachedMaxAppCacheSize(int64_t spaceNeeded); + virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*); #endif virtual void populateVisitedLinks(); @@ -165,6 +167,10 @@ public: virtual WebCore::NotificationPresenter* notificationPresenter() const { return reinterpret_cast<WebCore::NotificationPresenter*>(m_notificationsDelegate.get()); } #endif + virtual bool selectItemWritingDirectionIsNatural(); + virtual PassRefPtr<WebCore::PopupMenu> createPopupMenu(WebCore::PopupMenuClient*) const; + virtual PassRefPtr<WebCore::SearchPopupMenu> createSearchPopupMenu(WebCore::PopupMenuClient*) const; + private: COMPtr<IWebUIDelegate> uiDelegate(); diff --git a/WebKit/win/WebFrame.cpp b/WebKit/win/WebFrame.cpp index 5705f1e..f07821f 100644 --- a/WebKit/win/WebFrame.cpp +++ b/WebKit/win/WebFrame.cpp @@ -1939,7 +1939,7 @@ void WebFrame::setPrinting(bool printing, float minPageWidth, float maxPageWidth { Frame* coreFrame = core(this); ASSERT(coreFrame); - coreFrame->setPrinting(printing, minPageWidth, maxPageWidth, adjustViewSize); + coreFrame->setPrinting(printing, FloatSize(minPageWidth, 0), maxPageWidth / minPageWidth, adjustViewSize ? Frame::AdjustViewSize : Frame::DoNotAdjustViewSize); } HRESULT STDMETHODCALLTYPE WebFrame::setInPrintingMode( diff --git a/WebKit/win/WebKit.vcproj/WebKit.sln b/WebKit/win/WebKit.vcproj/WebKit.sln index b954436..251fa5f 100644 --- a/WebKit/win/WebKit.vcproj/WebKit.sln +++ b/WebKit/win/WebKit.vcproj/WebKit.sln @@ -118,7 +118,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WinLauncher", "..\..\..\Web {C59E5129-B453-49B7-A52B-1E104715F76E} = {C59E5129-B453-49B7-A52B-1E104715F76E}
EndProjectSection
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "InjectedBundle", "..\..\..\WebKitTools\WebKitTestRunner\InjectedBundle\win\InjectedBundle.vcproj", "{CBC3391C-F060-4BF5-A66E-81404168816B}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "InjectedBundle", "..\..\..\WebKitTools\WebKitTestRunner\win\InjectedBundle.vcproj", "{CBC3391C-F060-4BF5-A66E-81404168816B}"
ProjectSection(ProjectDependencies) = postProject
{4343BC0B-A2E0-4B48-8277-F33CFBFA83CD} = {4343BC0B-A2E0-4B48-8277-F33CFBFA83CD}
EndProjectSection
diff --git a/WebKit/win/WebView.cpp b/WebKit/win/WebView.cpp index 41ae079..8dfb7e7 100644 --- a/WebKit/win/WebView.cpp +++ b/WebKit/win/WebView.cpp @@ -110,6 +110,7 @@ #include <WebCore/PluginDatabase.h> #include <WebCore/PluginView.h> #include <WebCore/PopupMenu.h> +#include <WebCore/PopupMenuWin.h> #include <WebCore/ProgressTracker.h> #include <WebCore/RenderLayer.h> #include <WebCore/RenderTheme.h> @@ -1613,9 +1614,9 @@ bool WebView::mouseWheel(WPARAM wParam, LPARAM lParam, bool isMouseHWheel) TCHAR className[256]; // Make sure truncation won't affect the comparison. - ASSERT(ARRAYSIZE(className) > _tcslen(PopupMenu::popupClassName())); + ASSERT(ARRAYSIZE(className) > _tcslen(PopupMenuWin::popupClassName())); - if (GetClassName(focusedWindow, className, ARRAYSIZE(className)) && !_tcscmp(className, PopupMenu::popupClassName())) { + if (GetClassName(focusedWindow, className, ARRAYSIZE(className)) && !_tcscmp(className, PopupMenuWin::popupClassName())) { // We don't let the WebView scroll here for two reasons - 1) To match Firefox behavior, 2) If we do scroll, we lose the // focus ring around the select menu. SetFocus(m_viewWindow); diff --git a/WebKit/wx/ChangeLog b/WebKit/wx/ChangeLog index 2195112..362f6e5 100644 --- a/WebKit/wx/ChangeLog +++ b/WebKit/wx/ChangeLog @@ -1,3 +1,96 @@ +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu + instances, concrete classes that inherit from ChromeClient needed to be changed to + implement the new methods. + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::selectItemWritingDirectionIsNatural): + (WebCore::ChromeClientWx::createPopupMenu): + (WebCore::ChromeClientWx::createSearchPopupMenu): + * WebKitSupport/ChromeClientWx.h: + +2010-08-02 Jeremy Orlow <jorlow@chromium.org> + + Speculative revert of 64425 due to Chromium instability + https://bugs.webkit.org/show_bug.cgi?id=43347 + + * WebKitSupport/ChromeClientWx.cpp: + * WebKitSupport/ChromeClientWx.h: + +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu + instances, concrete classes that inherit from ChromeClient needed to be changed to + implement the new methods. + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::selectItemWritingDirectionIsNatural): + (WebCore::ChromeClientWx::createPopupMenu): + (WebCore::ChromeClientWx::createSearchPopupMenu): + * WebKitSupport/ChromeClientWx.h: + +2010-07-31 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r64422. + http://trac.webkit.org/changeset/64422 + https://bugs.webkit.org/show_bug.cgi?id=43304 + + Build fixes are needed for Snow Leopard and Windows. + (Requested by lca on #webkit). + + * WebKitSupport/ChromeClientWx.cpp: + * WebKitSupport/ChromeClientWx.h: + +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu + instances, concrete classes that inherit from ChromeClient needed to be changed to + implement the new methods. + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::selectItemWritingDirectionIsNatural): + (WebCore::ChromeClientWx::createPopupMenu): + (WebCore::ChromeClientWx::createSearchPopupMenu): + * WebKitSupport/ChromeClientWx.h: + +2010-07-30 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by David Kilzer. + + Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas) + https://bugs.webkit.org/show_bug.cgi?id=40627 + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::reachedApplicationCacheOriginQuota): + * WebKitSupport/ChromeClientWx.h: + +2010-07-29 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Build fix, add file missing from DOM bindings commit. + + * WebEdit.cpp: Added. + (WebCore::): + (wxWebEditCommand::wxWebEditCommand): + (wxWebEditCommand::~wxWebEditCommand): + (wxWebEditCommand::SetNodeAttribute): + (wxWebEditCommand::Apply): + 2010-07-28 Kevin Ollivier <kevino@theolliviers.com> [wx] wxPython build fix that was missed in last commit. diff --git a/WebKit/wx/WebEdit.cpp b/WebKit/wx/WebEdit.cpp new file mode 100644 index 0000000..ed2d0d4 --- /dev/null +++ b/WebKit/wx/WebEdit.cpp @@ -0,0 +1,65 @@ + + +#include "config.h" +#include "WebEdit.h" + +#include "AtomicString.h" +#include "CompositeEditCommand.h" +#include "Document.h" +#include "Frame.h" +#include "HTMLNames.h" +#include "QualifiedName.h" +#include "StringImpl.h" + +#include "WebFrame.h" +#include "WebDOMElement.h" + +namespace WebCore { + +class WebCoreEditCommand: public CompositeEditCommand +{ +public: + WebCoreEditCommand(WebCore::Document* document) + : CompositeEditCommand(document) + { } + + void setElementAttribute(PassRefPtr<Element> element, const QualifiedName& attribute, const AtomicString& value) + { + setNodeAttribute(element, attribute, value); + } + // composite commands are applied as they are added, so we don't + // need doApply to do anything. + virtual void doApply() {} +}; + +} + +wxWebEditCommand::wxWebEditCommand(wxWebFrame* webframe) +{ + if (webframe) { + WebCore::Frame* frame = webframe->GetFrame(); + if (frame && frame->document()) + m_impl = new WebCore::WebCoreEditCommand(frame->document()); + m_impl->ref(); + } +} + +wxWebEditCommand::~wxWebEditCommand() +{ + // the impl. is ref-counted, so don't delete it as it may be in an undo/redo stack + if (m_impl) + m_impl->deref(); + m_impl = 0; +} + +void wxWebEditCommand::SetNodeAttribute(WebDOMElement* element, const wxString& name, const wxString& value) +{ + if (m_impl) + m_impl->setElementAttribute(element->impl(), WebCore::QualifiedName(WebCore::nullAtom, WebCore::String(name), WebCore::nullAtom), WebCore::String(value)); +} + +void wxWebEditCommand::Apply() +{ + if (m_impl) + m_impl->apply(); +}
\ No newline at end of file diff --git a/WebKit/wx/WebKitSupport/ChromeClientWx.cpp b/WebKit/wx/WebKitSupport/ChromeClientWx.cpp index d81a20c..9c90596 100644 --- a/WebKit/wx/WebKitSupport/ChromeClientWx.cpp +++ b/WebKit/wx/WebKitSupport/ChromeClientWx.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.com> + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * All rights reserved. * @@ -38,6 +39,9 @@ #include "Icon.h" #include "NotImplemented.h" #include "PlatformString.h" +#include "SecurityOrigin.h" +#include "PopupMenuWx.h" +#include "SearchPopupMenuWx.h" #include "WindowFeatures.h" #include <stdio.h> @@ -429,6 +433,11 @@ void ChromeClientWx::reachedMaxAppCacheSize(int64_t spaceNeeded) { notImplemented(); } + +void ChromeClientWx::reachedApplicationCacheOriginQuota(SecurityOrigin*) +{ + notImplemented(); +} #endif void ChromeClientWx::scroll(const IntSize&, const IntRect&, const IntRect&) @@ -458,4 +467,19 @@ void ChromeClientWx::requestGeolocationPermissionForFrame(Frame*, Geolocation*) notImplemented(); } +bool ChromeClientWx::selectItemWritingDirectionIsNatural() +{ + return false; +} + +PassRefPtr<PopupMenu> ChromeClientWx::createPopupMenu(PopupMenuClient* client) const +{ + return adoptRef(new PopupMenuWx(client)); +} + +PassRefPtr<SearchPopupMenu> ChromeClientWx::createSearchPopupMenu(PopupMenuClient* client) const +{ + return adoptRef(new SearchPopupMenuWx(client)); +} + } diff --git a/WebKit/wx/WebKitSupport/ChromeClientWx.h b/WebKit/wx/WebKitSupport/ChromeClientWx.h index 4b156ed..5b60446 100644 --- a/WebKit/wx/WebKitSupport/ChromeClientWx.h +++ b/WebKit/wx/WebKitSupport/ChromeClientWx.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.com> + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * All rights reserved. * @@ -125,6 +126,7 @@ public: #if ENABLE(OFFLINE_WEB_APPLICATIONS) virtual void reachedMaxAppCacheSize(int64_t spaceNeeded); + virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*); #endif virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>); @@ -141,6 +143,10 @@ public: virtual void requestGeolocationPermissionForFrame(Frame*, Geolocation*); virtual void cancelGeolocationPermissionRequestForFrame(Frame*, Geolocation*) { } + virtual bool selectItemWritingDirectionIsNatural(); + virtual PassRefPtr<PopupMenu> createPopupMenu(PopupMenuClient*) const; + virtual PassRefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const; + private: wxWebView* m_webView; }; diff --git a/WebKitLibraries/ChangeLog b/WebKitLibraries/ChangeLog index 0cd5a9e..5f626fd 100644 --- a/WebKitLibraries/ChangeLog +++ b/WebKitLibraries/ChangeLog @@ -1,3 +1,24 @@ +2010-07-30 Adam Roben <aroben@apple.com> + + Roll our r64361 and r64363 + + We can't make these changes until QuartzCore.lib is included in + WebKitSupportLibrary. + +2010-07-30 Adam Roben <aroben@apple.com> + + Add WKCACFContext and related functions + + Also added some functions used by WKCAImageQueue. + + Fixes <http://webkit.org/b/43244>. + + Reviewed by Sam Weinig. + + * win/include/WebKitSystemInterface/WebKitSystemInterface.h: + * win/lib/WebKitSystemInterface.lib: + * win/lib/WebKitSystemInterface_debug.lib: + 2010-07-27 Kinuko Yasuda <kinuko@chromium.org> Reviewed by Ojan Vafai. diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog index 7aa3128..987fe7c 100644 --- a/WebKitTools/ChangeLog +++ b/WebKitTools/ChangeLog @@ -1,3 +1,842 @@ +2010-08-02 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Add alias for run-webkit-tests --webkit-test-runner (run-webkit-tests -2). + + * Scripts/old-run-webkit-tests: + +2010-08-02 Jon Honeycutt <jhoneycutt@apple.com> + + Restore the WebKitTestRunner.sln that was removed, and remove the + correct one. + + Rubber-stamped by Sam Weinig. + + * WebKitTestRunner/WebKitTestRunner.sln: Added. + * WebKitTestRunner/win/WebKitTestRunner.sln: Removed. + +2010-08-02 Jon Honeycutt <jhoneycutt@apple.com> + + Move InjectedBundle.vcproj to where the other WebKitTestRunner vcprojs live. + + Remove the unused WebKitTestRunner.sln. + + Reviewed by Sam Weinig. + + * WebKitTestRunner/Configurations/InjectedBundleCommon.vsprops: + * WebKitTestRunner/InjectedBundle/win/InjectedBundle.vcproj: Removed. + * WebKitTestRunner/WebKitTestRunner.sln: Removed. + * WebKitTestRunner/win/InjectedBundle.vcproj: Added. + * WebKitTestRunner/win/WebKitTestRunner.sln: + +2010-08-02 Sam Weinig <sam@webkit.org> + + Fix the windows build. + + * WebKitTestRunner/win/main.cpp: + +2010-07-29 Jon Honeycutt <jhoneycutt@apple.com> + + Add a Skipped list on Windows, and have run-webkit-tests respect it. + + Part of <rdar://problem/8233237> Fill WebKit2 Windows skipped list so + there are zero tests failing + https://bugs.webkit.org/show_bug.cgi?id=43374 + + Reviewed by Adam Roben. + + * Scripts/old-run-webkit-tests: + If using WebKitTestRunner and Apple Windows WebKit, set the platform to + win-wk2. When building the result hierarchy, if the platform is win-wk2, + add it first to the list of platforms. + +2010-08-02 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + WebKitTestRunner needs layoutTestController.setCanOpenWindows + https://bugs.webkit.org/show_bug.cgi?id=42321 + + WebKitTestRunner needs layoutTestController.setCloseRemainingWindowsWhenComplete + https://bugs.webkit.org/show_bug.cgi?id=42779 + + * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl: Added + setCanOpenWindows, setCloseRemainingWindowsWhenComplete, and windowCount + + * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: + (WTR::InjectedBundle::InjectedBundle): Initialize m_mainPage to 0 instead of + waiting for the first call to didCreatePage. + (WTR::InjectedBundle::didCreatePage): Set m_mainPage only when the first page + is created. Put other pages into a map. + (WTR::InjectedBundle::willDestroyPage): Added code to handle the destruction + of the main page. + (WTR::InjectedBundle::closeOtherPages): Added. Closes all the pages other than + the main page. + * WebKitTestRunner/InjectedBundle/InjectedBundle.h: Added pageCount and + closeOtherPages functions. + + * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: + (WTR::InjectedBundlePage::didFinishLoadForFrame): Don't let pages other than + the main page affect dumping. + (WTR::InjectedBundlePage::didFailLoadWithErrorForFrame): Ditto. + + * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp: + (WTR::LayoutTestController::LayoutTestController): Initialize the new + m_shouldCloseExtraWindows member. + (WTR::LayoutTestController::setCanOpenWindows): Added. Empty for now. + (WTR::LayoutTestController::windowCount): Added. + + * WebKitTestRunner/InjectedBundle/LayoutTestController.h: + Added setCanOpenWindows, setCloseRemainingWindowsWhenComplete, + windowCount, shouldCloseExtraWindowsAfterRunningTest, and + m_shouldCloseExtraWindows. + + * WebKitTestRunner/TestController.cpp: + (WTR::TestController::shared): Return a pointer to the shared copy, but + don't allocate and leak it. This seemed cleaner than adding an explicit + finalize call to go along with the explicit initialize call. + (WTR::TestController::TestController): Added calls to the initialize and + run function, which are now done automatically. + (WTR::TestController::~TestController): Added, since it's called now. + (WTR::closeOtherPage): Added. Used to close pages other than the main page. + (WTR::createOtherPage): Added. Used to create pages other than the main page. + (WTR::TestController::initialize): Added code to set up createOtherPage. + (WTR::TestController::run): Removed unused return value. + * WebKitTestRunner/TestController.h: Made constructor and destructor public, + and initialize and run private. Changed m_mainWebView to be an OwnPtr. + + * WebKitTestRunner/mac/PlatformWebViewMac.mm: + (WTR::PlatformWebView::PlatformWebView): Added a call to setReleasedWhenClosed + to avoid releasing the window twice. Another way to handle it would be to + remove the release, but this approach is slightly more robust because it works + even if some other code calls the close method an extra time. + + * WebKitTestRunner/mac/main.mm: + (main): Use a stack-allocated TestController object instead of calling + initalize and run on a globally allocated one. + +2010-08-02 Tony Chang <tony@chromium.org> + + Reviewed by David Levin. + + add myself to the reviewers list + https://bugs.webkit.org/show_bug.cgi?id=43366 + + * Scripts/webkitpy/common/config/committers.py: + +2010-08-02 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Cache JSNPObjects and fix bugs in the object map + https://bugs.webkit.org/show_bug.cgi?id=43368 + + Test that we correctly throw exceptions when trying to do things to a JSObject that used to + wrap an NPObject that came from a plug-in that is now destroyed. + + * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj: + * DumpRenderTree/TestNetscapePlugIn/PluginTest.h: + (PluginTest::Object::getProperty): + (PluginTest::Object::NP_GetProperty): + (PluginTest::Object::npClass): + * DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp: Added. + (NPRuntimeObjectFromDestroyedPlugin::NPRuntimeObjectFromDestroyedPlugin): + (NPRuntimeObjectFromDestroyedPlugin::ScriptableObject::hasProperty): + (NPRuntimeObjectFromDestroyedPlugin::ScriptableObject::getProperty): + (NPRuntimeObjectFromDestroyedPlugin::NPP_GetValue): + * DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj: + * DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro: + * GNUmakefile.am: + +2010-08-02 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Xan Lopez. + + [Gtk] DOM listeners get wrong keycodes for some keys + https://bugs.webkit.org/show_bug.cgi?id=35170 + + Add support to all event senders for simulating keypad insert + and print screen keys. + + * DumpRenderTree/chromium/EventSender.cpp: + (EventSender::keyDown): Add support for generating keypad insert and print screen. + * DumpRenderTree/gtk/EventSender.cpp: + (keyDownCallback): Ditto. + * DumpRenderTree/mac/EventSendingController.mm: + (-[EventSendingController keyDown:withModifiers:withLocation:]): Ditto. + * DumpRenderTree/qt/EventSenderQt.cpp: + (EventSender::keyDown): Ditto. + * DumpRenderTree/win/EventSender.cpp: + (keyDownCallback): Ditto. + +2010-08-02 Martin Robinson <mrobinson@igalia.com> + + Build fix for building against development versions of GTK+. GTK 2.22 + has not yet been released, so these function definitions must be conditionalized + on the development version. + + * DumpRenderTree/gtk/EventSender.cpp: Fix GTK+ 2.21 build. + +2010-08-02 Tony Chang <tony@chromium.org> + + Reviewed by Kent Tamura. + + [chromium] use ChromiumDriver on Linux when running webkit tests + https://bugs.webkit.org/show_bug.cgi?id=43273 + + * Scripts/webkitpy/layout_tests/port/chromium.py: + +2010-08-02 Kent Tamura <tkent@chromium.org> + + Reviewed by Dimitri Glazkov. + + [DRT/Chromium] Always initialize GTK + https://bugs.webkit.org/show_bug.cgi?id=43327 + + Call gtk_init() in order to fix plugin test crash. + + * DumpRenderTree/chromium/DumpRenderTree.cpp: + (main): Pass argc/argv to platformInit(). + * DumpRenderTree/chromium/TestShell.h: + * DumpRenderTree/chromium/TestShellGtk.cpp: + (platformInit): Update parameters, call gtk_init(). + * DumpRenderTree/chromium/TestShellMac.mm: + (platformInit): Update parameters. + * DumpRenderTree/chromium/TestShellWin.cpp: + (platformInit): Update parameters. + +2010-08-02 Balazs Kelemen <kb@inf.u-szeged.hu> + + Reviewed by Simon Hausmann. + + [Qt] Generate forwarding headers for WebKit2 + + https://bugs.webkit.org/show_bug.cgi?id=43336 + + * Scripts/webkitdirs.pm: Call make on WebKit2/Makefile.DerivedSources. + +2010-08-02 Fumitoshi Ukai <ukai@chromium.org> + + Reviewed by Kent Tamura. + + WebSocket server should start with SO_REUSEADDR + https://bugs.webkit.org/show_bug.cgi?id=43329 + + Pulls in pywebsocket-0.5.2. + pywebsocket-0.5.2 includes a small fix to start server with SO_REUSE_ADDR. + http://code.google.com/p/pywebsocket/source/detail?r=273 + + * Scripts/webkitpy/thirdparty/__init__.py: Bump pywebsocket version + +2010-08-01 Kent Tamura <tkent@chromium.org> + + Reviewed by Dimitri Glazkov. + + [DRT/Chromium] Remove string_util.h dependency + https://bugs.webkit.org/show_bug.cgi?id=43312 + + * DumpRenderTree/chromium/LayoutTestController.cpp: + (LayoutTestController::pathToLocalResource): + Use string::find() instead of StartsWithASCII(). + (LayoutTestController::cppVariantToInt32): + Use strtol() instead of StringToNumber(). + +2010-08-01 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Add ability to reset frame names for WebKitTestRunner + https://bugs.webkit.org/show_bug.cgi?id=43316 + + * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: + (WTR::InjectedBundle::reset): + * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: + (WTR::InjectedBundlePage::reset): + * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h: + +2010-08-01 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Implement NPN_RemoveProperty + https://bugs.webkit.org/show_bug.cgi?id=43315 + + * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj: + Add NPRuntimeRemoveProperty.cpp + + * DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp: + (PluginTest::NPN_GetStringIdentifier): + (PluginTest::NPN_GetIntIdentifier): + (PluginTest::NPN_RemoveProperty): + Add NPN_ helpers. + + * DumpRenderTree/TestNetscapePlugIn/PluginTest.h: + Support more NPClass functions. + + * DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeRemoveProperty.cpp: Added. + (NPRuntimeRemoveProperty::NPRuntimeRemoveProperty): + Test for NPN_RemoveProperty. + + (NPRuntimeRemoveProperty::TestObject::hasMethod): + (NPRuntimeRemoveProperty::TestObject::invoke): + Add a testRemoveProperty method. + + (NPRuntimeRemoveProperty::NPP_GetValue): + Return the test object. + + * DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj: + * DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro: + * GNUmakefile.am: + Add NPRuntimeRemoveProperty.cpp + +2010-07-30 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add an NPObject class template helper to TestNetscapePlugin + https://bugs.webkit.org/show_bug.cgi?id=43288 + + * DumpRenderTree/TestNetscapePlugIn/PluginTest.h: + Add some template magic to be able to figure out if a class has a member function of a given type. + + (PluginTest::Object::create): + Create an object. + + (PluginTest::Object::invokeDefault): + Add dummy function, this should never be called. + + (PluginTest::Object::Object): + Initialize m_pluginTest to 0. + + (PluginTest::Object::~Object): + Add virtual destructor. + + (PluginTest::Object::NP_Allocate): + Create a new object. + + (PluginTest::Object::NP_Deallocate): + Delete the object. + + (PluginTest::Object::NP_InvokeDefault): + Call invokeDefault. + + (PluginTest::Object::npClass): + Initialize the NPClass struct. + + * DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp: + (DocumentOpenInDestroyStream::NPP_DestroyStream): + Move this inline. + + * DumpRenderTree/TestNetscapePlugIn/Tests/PluginScriptableNPObjectInvokeDefault.cpp: + (PluginScriptableNPObjectInvokeDefault::NPObjectWithInvokeDefault::invokeDefault): + (PluginScriptableNPObjectInvokeDefault::NPP_GetValue): + Use the PluginTest::Object class template. + +2010-07-31 Sam Weinig <sam@webkit.org> + + Reviewed by Dan Bernstein. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=43305 + Add back WKBundleFrameCopyInnerText to fix ~50 test failures + due to SVGElements not having the innerText function. + + * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: + (WTR::dumpFrameText): + +2010-07-30 Sam Weinig <sam@webkit.org> + + Reviewed by Maciej Stachowiak. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=43290 + Add structured message passing from the injected bundle to UIProcess + + * MiniBrowser/mac/AppDelegate.m: + (didRecieveMessageFromInjectedBundle): + * MiniBrowser/mac/WebBundle/WebBundleMain.m: + (didClearWindowForFrame): + (didRecieveMessage): + * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: + (WTR::InjectedBundle::done): + (WTR::InjectedBundle::didReceiveMessage): + * WebKitTestRunner/TestController.cpp: + (WTR::TestController::initialize): + (WTR::TestController::didReceiveMessageFromInjectedBundle): + * WebKitTestRunner/TestController.h: + * WebKitTestRunner/TestInvocation.cpp: + (WTR::TestInvocation::didReceiveMessageFromInjectedBundle): + * WebKitTestRunner/TestInvocation.h: + * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj: + +2010-07-30 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=43275 + Make WKArrayRef more usable. + + Remove now unnecessary const_casts. + + * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: + (WTR::dumpDescendantFrameScrollPositions): + (WTR::dumpDescendantFramesText): + +2010-07-30 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=43274 + Add first pass of structured message passing. + + Update Minibrowser and WebKitTestRunner to work with the new post message + function. + + * MiniBrowser/mac/AppDelegate.m: + (didRecieveMessageFromInjectedBundle): + (-[BrowserAppDelegate init]): + * MiniBrowser/mac/MiniBrowser_Prefix.pch: + * MiniBrowser/mac/WebBundle/WebBundleMain.m: + (didStartProvisionalLoadForFrame): + (didReceiveServerRedirectForProvisionalLoadForFrame): + (didFailProvisionalLoadWithErrorForFrame): + (didCommitLoadForFrame): + (didFinishLoadForFrame): + (didFailLoadWithErrorForFrame): + (didReceiveTitleForFrame): + (didClearWindowForFrame): + (didCreatePage): + (willDestroyPage): + (didRecieveMessage): + (WKBundleInitialize): + * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: + (WTR::InjectedBundle::_didReceiveMessage): + (WTR::InjectedBundle::didReceiveMessage): + * WebKitTestRunner/InjectedBundle/InjectedBundle.h: + * WebKitTestRunner/TestInvocation.cpp: + (WTR::TestInvocation::invoke): + * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj: + +2010-07-30 Anders Carlsson <andersca@apple.com> + + Try to fix the layout test failures. + + * DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp: + (webkit_test_plugin_get_value): + +2010-07-29 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Replace plugins/npruntime/bindings-test.html with a more sophisticated test + https://bugs.webkit.org/show_bug.cgi?id=43232 + + * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj: + Add PluginScriptableNPObjectInvokeDefault.cpp. + + * DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp: + Remove invokeDefault callback function. + + * DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp: + (PluginTest::create): + Move this to the top of the file. + + (PluginTest::NPP_GetValue): + Add default implementation. + + (PluginTest::NPN_CreateObject): + Add NPN_ wrapper. + + * DumpRenderTree/TestNetscapePlugIn/PluginTest.h: + (PluginTest::identifier): + Add identifier getter. + + * DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp: + (DocumentOpenInDestroyStream::DocumentOpenInDestroyStream): + Add "using namespace std". + + * DumpRenderTree/TestNetscapePlugIn/main.cpp: + (NPP_GetValue): + Give PluginTest a chance to return a value. + + * DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj: + * DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro: + * GNUmakefile.am: + Add PluginScriptableNPObjectInvokeDefault.cpp. + + * DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp: + (webkit_test_plugin_get_value): + Give PluginTest a chance to return a value. + +2010-07-30 Steve Block <steveblock@google.com> + + Reviewed by Steve Block. + + Add LayoutTestController methods to test DeviceOrientation + https://bugs.webkit.org/show_bug.cgi?id=39589 + + * DumpRenderTree/LayoutTestController.cpp: + (setMockDeviceOrientationCallback): + (LayoutTestController::staticFunctions): + * DumpRenderTree/LayoutTestController.h: + * DumpRenderTree/chromium/LayoutTestController.cpp: + (LayoutTestController::LayoutTestController): + (LayoutTestController::setMockDeviceOrientation): + * DumpRenderTree/chromium/LayoutTestController.h: + * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp: + (LayoutTestController::setMockDeviceOrientation): + * DumpRenderTree/mac/LayoutTestControllerMac.mm: + (LayoutTestController::setMockDeviceOrientation): + * DumpRenderTree/qt/LayoutTestControllerQt.cpp: + (LayoutTestController::setMockDeviceOrientation): + * DumpRenderTree/qt/LayoutTestControllerQt.h: + * DumpRenderTree/win/LayoutTestControllerWin.cpp: + (LayoutTestController::setMockDeviceOrientation): + * DumpRenderTree/wx/LayoutTestControllerWx.cpp: + (LayoutTestController::setMockDeviceOrientation): + * Scripts/build-webkit: + +2010-07-29 Antonio Gomes <tonikitoo@webkit.org> + + Reviewed by Kenneth Christiansen. + + [Qt] QtTestBrowser: -resizes-to-contents command line parameter is broken + https://bugs.webkit.org/show_bug.cgi?id=43209 + + When -resizes-to-content was being passed as a command line parameter it was simply + not being set (although the corresponding menu item was marked as ON). + User had to toggle the menu OFF and then ON again for it to take place. + + Reason: LauncherWindow::applyPrefs method sets many user options passed in from + the command line, but not resizesToContents. Patch addresses that. + + * QtTestBrowser/launcherwindow.cpp: + (LauncherWindow::createChrome): + (LauncherWindow::applyPrefs): + (LauncherWindow::toggleResizesToContents): + * QtTestBrowser/webview.h: + (WebViewGraphicsBased::resizesToContents): + +2010-07-29 Antonio Gomes <tonikitoo@webkit.org> + + Rubber-stamped by Simon Fraser. + + [Qt] QtTestBrowser: more method grouping and clean ups. + + Moving blocks of code around. Basically grouping related methods close to each. + + * QtTestBrowser/launcherwindow.cpp: + (LauncherWindow::initializeView): + (LauncherWindow::createChrome): + (LauncherWindow::changeViewportUpdateMode): + (LauncherWindow::showFPS): + (LauncherWindow::newWindow): + (LauncherWindow::cloneWindow): + * QtTestBrowser/launcherwindow.h: + +2010-07-30 Mahesh Kulkarni <mahesh.kulkarni@nokia.com> + + Reviewed by Tor Arne Vestbø. + + [QT][Symbian] QtTestBrowser missing location capabilities + https://bugs.webkit.org/show_bug.cgi?id=43235 + + QtTestBrowser missing capabilities to use QtMobility::QLocation. + + * QtTestBrowser/QtTestBrowser.pro: + +2010-07-29 Anders Carlsson <andersca@apple.com> + + Add PluginTest.cpp + + * DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro: + +2010-07-29 Dirk Pranke <dpranke@chromium.org> + + Reviewed by Eric Seidel. + + Update download URLs for python irclib package; the old URLs + pointed at a specific mirror host and not the general sourceforge + URLs. + + https://bugs.webkit.org/show_bug.cgi?id=43228 + + * Scripts/webkitpy/thirdparty/__init__.py: + +2010-07-29 Anders Carlsson <andersca@apple.com> + + Fix typo. + + * DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro: + +2010-07-29 Anders Carlsson <andersca@apple.com> + + Another attempt at fixing the Qt and GTK+ build. + + * DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp: + (webkit_test_plugin_new_instance): + (webkit_test_plugin_destroy_stream): + +2010-07-29 Anders Carlsson <andersca@apple.com> + + Another build fix attempt. + + * DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp: + * DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro: + * DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp: + (webkit_test_plugin_new_instance): + * GNUmakefile.am: + +2010-07-29 Anders Carlsson <andersca@apple.com> + + Try to fix Windows and Unix builds. + + * DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj: + * DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp: + (webkit_test_plugin_new_instance): + (webkit_test_plugin_destroy_stream): + +2010-07-29 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Refactor TestNetscapePlugin so tests can be split in separate files + https://bugs.webkit.org/show_bug.cgi?id=43220 + + * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj: + Add PluginTest.cpp, PluginTest.h and Tests/DocumentOpenInDestroyStream.cpp. + + * DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp: + (pluginAllocate): + Initialize pluginTest to 0. Remove testDocumentOpenInDestroyStream. + + * DumpRenderTree/TestNetscapePlugIn/PluginObject.h: + * DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp: Added. + (PluginTest::PluginTest): + Initialize m_npp and the test identifier. + + (PluginTest::createTestFunctions): + Return the map from identifiers to createTest functions. + + (PluginTest::registerCreateTestFunction): + Insert the identifier and create function pair in the map. + + (PluginTest::create): + Look for a createTest function. If one is found, call it. Otherwise create a vanilla PluginTest object. + + * DumpRenderTree/TestNetscapePlugIn/PluginTest.h: Added. + (PluginTest::Register::Register): + Helper class template for registering plug-in tests. + + (PluginTest::Register::create): + Create a new test of the given type. + + * DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp: Added. + (DocumentOpenInDestroyStream::DocumentOpenInDestroyStream): + Add a test that calls testDocumentOpen from its NPP_DestroyStream callback. + + * DumpRenderTree/TestNetscapePlugIn/main.cpp: + (NPP_New): + Create a PluginTest given the identifier. Remove the check for "testdocumentopenindestroystream". + + (NPP_DestroyStream): + Call the plug-in test NPP_DestroyStream member function. + + * DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj: + Add PluginTest.cpp, PluginTest.h and Tests/DocumentOpenInDestroyStream.cpp. + +2010-07-29 Martin Robinson <mrobinson@igalia.com> + + Unreviewed build fix. + + Add missing second argument to assert_lint in new style checker tests. + + * Scripts/webkitpy/style/checkers/cpp_unittest.py: + +2010-07-29 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + check-webkit-style shouldn't complain about NPAPI functions + https://bugs.webkit.org/show_bug.cgi?id=43211 + + Allow underscores in functions that start with NPN_, NPP_ or NP_. + + * Scripts/webkitpy/style/checkers/cpp.py: + * Scripts/webkitpy/style/checkers/cpp_unittest.py: + +2010-07-29 Victor Wang <victorw@chromium.org> + + Unreviewed, rolling out r64270. + http://trac.webkit.org/changeset/64270 + https://bugs.webkit.org/show_bug.cgi?id=39589 + + The patch breaks chromium webkit unittest + + * DumpRenderTree/LayoutTestController.cpp: + (LayoutTestController::staticFunctions): + * DumpRenderTree/LayoutTestController.h: + * DumpRenderTree/chromium/LayoutTestController.cpp: + (LayoutTestController::LayoutTestController): + * DumpRenderTree/chromium/LayoutTestController.h: + * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp: + * DumpRenderTree/mac/LayoutTestControllerMac.mm: + * DumpRenderTree/qt/LayoutTestControllerQt.cpp: + * DumpRenderTree/qt/LayoutTestControllerQt.h: + * DumpRenderTree/win/LayoutTestControllerWin.cpp: + * DumpRenderTree/wx/LayoutTestControllerWx.cpp: + * Scripts/build-webkit: + +2010-07-29 Antonio Gomes <tonikitoo@webkit.org> + + Reviewed by Kenneth Christiansen. + + [Qt] QtTestBrowser: Move WebPage class methods definitions from main.cpp to webpage.cpp + https://bugs.webkit.org/show_bug.cgi?id=43199 + + There is no sense in keeping WebPage method definitions in main.cpp once + webpage.cpp already exists. + + No behavior change. + + * QtTestBrowser/main.cpp: + * QtTestBrowser/webpage.cpp: + (WebPage::createWindow): + (WebPage::createPlugin): + +2010-07-29 Antonio Gomes <tonikitoo@webkit.org> + + Reviewed by Kenneth Christiansen. + + [Qt] Factor out LauncherWindow class out of main.cpp (QtTestBrowser) + https://bugs.webkit.org/show_bug.cgi?id=43170 + + Moving LauncherWindow class out of main.cpp to its own .cpp and .h files: + launcherwindow.{cpp|h} + + No behavior change. + + Also changed all global static variables (named "gXXX") from main.cpp to + static public variables of the LauncherWindow class. + + * QtTestBrowser/QtTestBrowser.pro: + * QtTestBrowser/launcherwindow.cpp: Added. + * QtTestBrowser/launcherwindow.h: Added. + * QtTestBrowser/main.cpp: + (LauncherApplication::handleUserOptions): + (main): + +2010-07-29 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Xan Lopez. + + Build fix for building against GTK+ 3.x. GSEAL requires that we + access internals of the GdkDragContext via methods. For older versions + of GTK+, define those methods. + + * DumpRenderTree/gtk/EventSender.cpp: + (gdk_drag_context_get_selected_action): Added. + (gdk_drag_context_get_actions): Added. + (dispatchEvent): Use the two new accessor methods. + +2010-07-29 Adam Roben <aroben@apple.com> + + Always say "plugins directory" when referring to a directory + containing one or more plugins + + Fixes <http://webkit.org/b/43197> WebKit2 often says "plugin + directory" when it means "plugins directory" + + Reviewed by John Sullivan. + + * WebKitTestRunner/TestController.cpp: + (WTR::TestController::initialize): Updated for rename. + +2010-07-29 Adam Roben <aroben@apple.com> + + Always say "directory" when referring to a plugin directory + + Fixes <http://webkit.org/b/43195> WebKit2 often says "plugin path" + when it means "plugin directory" + + Reviewed by John Sullivan. + + * WebKitTestRunner/TestController.cpp: + (WTR::TestController::initialize): Updated for renames. + + * WebKitTestRunner/TestController.h: Renamed m_testPluginPath to + m_testPluginDirectory. + (WTR::TestController::testPluginDirectory): Renamed from + testPluginPath. + + * WebKitTestRunner/mac/TestControllerMac.mm: + (WTR::TestController::initializeTestPluginDirectory): + * WebKitTestRunner/win/TestControllerWin.cpp: + (WTR::TestController::initializeTestPluginDirectory): + Renamed from initializeTestPluginPath and updated for rename. + +2010-07-29 Csaba Osztrogonác <ossy@webkit.org> + + Reviewed by Antonio Gomes. + + Initialize all members of NPClass struct. + https://bugs.webkit.org/show_bug.cgi?id=43193 + + * DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp: + +2010-07-29 Csaba Osztrogonác <ossy@webkit.org> + + Reviewed by Antonio Gomes. + + Warning fix on platforms where XP_MACOSX is undefined. + https://bugs.webkit.org/show_bug.cgi?id=43192 + + * DumpRenderTree/TestNetscapePlugIn/PluginObject.h: + Use #if defined(XP_MACOSX) instead of #if XP_MACOSX . + +2010-07-29 Adam Roben <aroben@apple.com> + + Give find-included-framework-headers our standard license + + * Scripts/find-included-framework-headers: Used the license from + WebCore/LICENSE-APPLE. + +2010-07-29 Adam Roben <aroben@apple.com> + + Speed up find-included-framework-headers + + We only do one invocation of find now, no longer pipe to grep, and + replace uniq with sort -u. + + Also added a license header. + + * Scripts/find-included-framework-headers: + +2010-07-29 Steve Block <steveblock@google.com> + + Reviewed by Jeremy Orlow. + + Add LayoutTestController methods to test DeviceOrientation + https://bugs.webkit.org/show_bug.cgi?id=39589 + + * DumpRenderTree/LayoutTestController.cpp: + (setMockDeviceOrientationCallback): + (LayoutTestController::staticFunctions): + * DumpRenderTree/LayoutTestController.h: + * DumpRenderTree/chromium/LayoutTestController.cpp: + * DumpRenderTree/chromium/LayoutTestController.h: + * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp: + (LayoutTestController::setMockDeviceOrientation): + * DumpRenderTree/mac/LayoutTestControllerMac.mm: + (LayoutTestController::setMockDeviceOrientation): + * DumpRenderTree/qt/LayoutTestControllerQt.cpp: + (LayoutTestController::setMockDeviceOrientation): + * DumpRenderTree/qt/LayoutTestControllerQt.h: + * DumpRenderTree/win/LayoutTestControllerWin.cpp: + (LayoutTestController::setMockDeviceOrientation): + * DumpRenderTree/wx/LayoutTestControllerWx.cpp: + (LayoutTestController::setMockDeviceOrientation): + * Scripts/build-webkit: + 2010-07-28 Kenichi Ishibashi <bashi@google.com> Reviewed by Shinichiro Hamaji. diff --git a/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj b/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj index 2ed5daa..c92c704 100644 --- a/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj +++ b/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj @@ -32,10 +32,16 @@ 141BF439096A455900E0753C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AE8257EF08D22389000507AB /* Carbon.framework */; }; 141BF453096A45EB00E0753C /* PluginObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 141BF447096A45C800E0753C /* PluginObject.h */; }; 14770FE20A22ADF7009342EE /* GCController.h in Headers */ = {isa = PBXBuildFile; fileRef = 14770FE00A22ADF7009342EE /* GCController.h */; }; + 1A215A8111F2609C008AD0F5 /* PluginTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A215A7F11F2609C008AD0F5 /* PluginTest.cpp */; }; + 1A215A8211F2609C008AD0F5 /* PluginTest.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A215A8011F2609C008AD0F5 /* PluginTest.h */; }; + 1A215BE711F27658008AD0F5 /* DocumentOpenInDestroyStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A215A7511F26072008AD0F5 /* DocumentOpenInDestroyStream.cpp */; }; + 1A24BAA9120734EE00FBB059 /* NPRuntimeObjectFromDestroyedPlugin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A24BAA8120734EE00FBB059 /* NPRuntimeObjectFromDestroyedPlugin.cpp */; }; 1A8F02E80BB9B4EC008CFA34 /* TestObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A8F024C0BB9B056008CFA34 /* TestObject.h */; }; 1AC6C8490D07638600CD3161 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC6C77F0D07589B00CD3161 /* main.cpp */; }; 1AC6C84A0D07638600CD3161 /* PluginObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC6C7800D07589B00CD3161 /* PluginObject.cpp */; }; 1AC6C84B0D07638600CD3161 /* TestObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC6C7810D07589B00CD3161 /* TestObject.cpp */; }; + 1AC77DCF120605B6005C19EF /* NPRuntimeRemoveProperty.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC77DCE120605B6005C19EF /* NPRuntimeRemoveProperty.cpp */; }; + 1AD9D2FE12028409001A70D1 /* PluginScriptableNPObjectInvokeDefault.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AD9D2FD12028409001A70D1 /* PluginScriptableNPObjectInvokeDefault.cpp */; }; 23BCB8900EA57623003C6289 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 23BCB88F0EA57623003C6289 /* OpenGL.framework */; }; 3713EDE2115BE19300705720 /* ColorBits-A.png in Copy Font Files */ = {isa = PBXBuildFile; fileRef = 3713EDDF115BE16F00705720 /* ColorBits-A.png */; }; 3713EDE3115BE19300705720 /* ColorBits.ttf in Copy Font Files */ = {isa = PBXBuildFile; fileRef = 3713EDE0115BE16F00705720 /* ColorBits.ttf */; }; @@ -185,10 +191,16 @@ 141BF447096A45C800E0753C /* PluginObject.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PluginObject.h; sourceTree = "<group>"; }; 141BF448096A45C800E0753C /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; name = Info.plist; path = mac/Info.plist; sourceTree = "<group>"; }; 14770FE00A22ADF7009342EE /* GCController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GCController.h; sourceTree = "<group>"; }; + 1A215A7511F26072008AD0F5 /* DocumentOpenInDestroyStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentOpenInDestroyStream.cpp; sourceTree = "<group>"; }; + 1A215A7F11F2609C008AD0F5 /* PluginTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginTest.cpp; sourceTree = "<group>"; }; + 1A215A8011F2609C008AD0F5 /* PluginTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginTest.h; sourceTree = "<group>"; }; + 1A24BAA8120734EE00FBB059 /* NPRuntimeObjectFromDestroyedPlugin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPRuntimeObjectFromDestroyedPlugin.cpp; sourceTree = "<group>"; }; 1A8F024C0BB9B056008CFA34 /* TestObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestObject.h; sourceTree = "<group>"; }; 1AC6C77F0D07589B00CD3161 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; }; 1AC6C7800D07589B00CD3161 /* PluginObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginObject.cpp; sourceTree = "<group>"; }; 1AC6C7810D07589B00CD3161 /* TestObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestObject.cpp; sourceTree = "<group>"; }; + 1AC77DCE120605B6005C19EF /* NPRuntimeRemoveProperty.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPRuntimeRemoveProperty.cpp; sourceTree = "<group>"; }; + 1AD9D2FD12028409001A70D1 /* PluginScriptableNPObjectInvokeDefault.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginScriptableNPObjectInvokeDefault.cpp; sourceTree = "<group>"; }; 23BCB88F0EA57623003C6289 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; }; 32A70AAB03705E1F00C91783 /* DumpRenderTreePrefix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DumpRenderTreePrefix.h; sourceTree = "<group>"; }; 3713EDDF115BE16F00705720 /* ColorBits-A.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "ColorBits-A.png"; path = "fonts/ColorBits-A.png"; sourceTree = "<group>"; }; @@ -357,11 +369,14 @@ 141BF1F5096A439800E0753C /* TestNetscapePlugIn */ = { isa = PBXGroup; children = ( + 1A215A6E11F25FF1008AD0F5 /* Tests */, 141BF448096A45C800E0753C /* Info.plist */, 1AC6C77F0D07589B00CD3161 /* main.cpp */, 1AC6C7800D07589B00CD3161 /* PluginObject.cpp */, 0F37A4A611E6628700275F54 /* PluginObjectMac.mm */, 141BF447096A45C800E0753C /* PluginObject.h */, + 1A215A7F11F2609C008AD0F5 /* PluginTest.cpp */, + 1A215A8011F2609C008AD0F5 /* PluginTest.h */, 1AC6C7810D07589B00CD3161 /* TestObject.cpp */, 1A8F024C0BB9B056008CFA34 /* TestObject.h */, ); @@ -421,6 +436,17 @@ name = Delegates; sourceTree = "<group>"; }; + 1A215A6E11F25FF1008AD0F5 /* Tests */ = { + isa = PBXGroup; + children = ( + 1A215A7511F26072008AD0F5 /* DocumentOpenInDestroyStream.cpp */, + 1A24BAA8120734EE00FBB059 /* NPRuntimeObjectFromDestroyedPlugin.cpp */, + 1AC77DCE120605B6005C19EF /* NPRuntimeRemoveProperty.cpp */, + 1AD9D2FD12028409001A70D1 /* PluginScriptableNPObjectInvokeDefault.cpp */, + ); + path = Tests; + sourceTree = "<group>"; + }; 9340995508540CAF007F3BC8 /* Products */ = { isa = PBXGroup; children = ( @@ -521,6 +547,7 @@ files = ( 141BF453096A45EB00E0753C /* PluginObject.h in Headers */, 1A8F02E80BB9B4EC008CFA34 /* TestObject.h in Headers */, + 1A215A8211F2609C008AD0F5 /* PluginTest.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -684,6 +711,11 @@ 1AC6C84A0D07638600CD3161 /* PluginObject.cpp in Sources */, 1AC6C84B0D07638600CD3161 /* TestObject.cpp in Sources */, 0F37A4A711E6628700275F54 /* PluginObjectMac.mm in Sources */, + 1A215A8111F2609C008AD0F5 /* PluginTest.cpp in Sources */, + 1A215BE711F27658008AD0F5 /* DocumentOpenInDestroyStream.cpp in Sources */, + 1AD9D2FE12028409001A70D1 /* PluginScriptableNPObjectInvokeDefault.cpp in Sources */, + 1AC77DCF120605B6005C19EF /* NPRuntimeRemoveProperty.cpp in Sources */, + 1A24BAA9120734EE00FBB059 /* NPRuntimeObjectFromDestroyedPlugin.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.cpp b/WebKitTools/DumpRenderTree/LayoutTestController.cpp index 6a957c1..d98164b 100644 --- a/WebKitTools/DumpRenderTree/LayoutTestController.cpp +++ b/WebKitTools/DumpRenderTree/LayoutTestController.cpp @@ -970,6 +970,27 @@ static JSValueRef setDomainRelaxationForbiddenForURLSchemeCallback(JSContextRef return JSValueMakeUndefined(context); } +static JSValueRef setMockDeviceOrientationCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + if (argumentCount < 6) + return JSValueMakeUndefined(context); + + bool canProvideAlpha = JSValueToBoolean(context, arguments[0]); + double alpha = JSValueToNumber(context, arguments[1], exception); + ASSERT(!*exception); + bool canProvideBeta = JSValueToBoolean(context, arguments[2]); + double beta = JSValueToNumber(context, arguments[3], exception); + ASSERT(!*exception); + bool canProvideGamma = JSValueToBoolean(context, arguments[4]); + double gamma = JSValueToNumber(context, arguments[5], exception); + ASSERT(!*exception); + + LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); + controller->setMockDeviceOrientation(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma); + + return JSValueMakeUndefined(context); +} + static JSValueRef setMockGeolocationPositionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { if (argumentCount < 3) @@ -1824,6 +1845,7 @@ JSStaticFunction* LayoutTestController::staticFunctions() { "setIconDatabaseEnabled", setIconDatabaseEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setJavaScriptProfilingEnabled", setJavaScriptProfilingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setMainFrameIsFirstResponder", setMainFrameIsFirstResponderCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "setMockDeviceOrientation", setMockDeviceOrientationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setMockGeolocationError", setMockGeolocationErrorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setMockGeolocationPosition", setMockGeolocationPositionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setNewWindowsCopyBackForwardList", setNewWindowsCopyBackForwardListCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.h b/WebKitTools/DumpRenderTree/LayoutTestController.h index 30eb9bd..39cc3fb 100644 --- a/WebKitTools/DumpRenderTree/LayoutTestController.h +++ b/WebKitTools/DumpRenderTree/LayoutTestController.h @@ -88,6 +88,7 @@ public: void setJavaScriptProfilingEnabled(bool profilingEnabled); void setJavaScriptCanAccessClipboard(bool flag); void setMainFrameIsFirstResponder(bool flag); + void setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma); void setMockGeolocationError(int code, JSStringRef message); void setMockGeolocationPosition(double latitude, double longitude, double accuracy); void setPersistentUserStyleSheetLocation(JSStringRef path); diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp index 671069e..0d556b1 100644 --- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp +++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp @@ -99,7 +99,6 @@ static bool pluginHasMethod(NPObject*, NPIdentifier name); static bool pluginGetProperty(NPObject*, NPIdentifier name, NPVariant*); static bool pluginSetProperty(NPObject*, NPIdentifier name, const NPVariant*); static bool pluginInvoke(NPObject*, NPIdentifier name, const NPVariant* args, uint32_t argCount, NPVariant* result); -static bool pluginInvokeDefault(NPObject*, const NPVariant* args, uint32_t argCount, NPVariant* result); static NPObject* pluginAllocate(NPP npp, NPClass*); static void pluginDeallocate(NPObject*); @@ -112,10 +111,13 @@ static NPClass pluginClass = { pluginInvalidate, pluginHasMethod, pluginInvoke, - pluginInvokeDefault, + 0, // NPClass::invokeDefault, pluginHasProperty, pluginGetProperty, pluginSetProperty, + 0, // NPClass::removeProperty + 0, // NPClass::enumerate + 0 // NPClass::construct }; NPClass *getPluginClass(void) @@ -158,7 +160,6 @@ static const NPUTF8 *pluginPropertyIdentifierNames[NUM_PROPERTY_IDENTIFIERS] = { enum { ID_TEST_CALLBACK_METHOD = 0, ID_TEST_GETURL, - ID_REMOVE_DEFAULT_METHOD, ID_TEST_DOM_ACCESS, ID_TEST_GET_URL_NOTIFY, ID_TEST_INVOKE_DEFAULT, @@ -195,7 +196,6 @@ static NPIdentifier pluginMethodIdentifiers[NUM_METHOD_IDENTIFIERS]; static const NPUTF8 *pluginMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = { "testCallback", "getURL", - "removeDefaultMethod", "testDOMAccess", "getURLNotify", "testInvokeDefault", @@ -462,13 +462,6 @@ static bool getURL(PluginObject* obj, const NPVariant* args, uint32_t argCount, return false; } -static bool removeDefaultMethod(PluginObject*, const NPVariant* args, uint32_t argCount, NPVariant* result) -{ - pluginClass.invokeDefault = 0; - VOID_TO_NPVARIANT(*result); - return true; -} - static bool getURLNotify(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result) { if (argCount != 3 || !NPVARIANT_IS_STRING(args[0]) @@ -857,8 +850,6 @@ static bool pluginInvoke(NPObject* header, NPIdentifier name, const NPVariant* a return testCallback(plugin, args, argCount, result); else if (name == pluginMethodIdentifiers[ID_TEST_GETURL]) return getURL(plugin, args, argCount, result); - else if (name == pluginMethodIdentifiers[ID_REMOVE_DEFAULT_METHOD]) - return removeDefaultMethod(plugin, args, argCount, result); else if (name == pluginMethodIdentifiers[ID_TEST_DOM_ACCESS]) return testDOMAccess(plugin, args, argCount, result); else if (name == pluginMethodIdentifiers[ID_TEST_GET_URL_NOTIFY]) @@ -941,12 +932,6 @@ static bool pluginInvoke(NPObject* header, NPIdentifier name, const NPVariant* a return false; } -static bool pluginInvokeDefault(NPObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result) -{ - INT32_TO_NPVARIANT(1, *result); - return true; -} - static void pluginInvalidate(NPObject* header) { PluginObject* plugin = reinterpret_cast<PluginObject*>(header); @@ -963,6 +948,7 @@ static NPObject *pluginAllocate(NPP npp, NPClass *theClass) initializeIdentifiers(); } + newInstance->pluginTest = 0; newInstance->npp = npp; newInstance->testObject = browser->createobject(npp, getTestClass()); newInstance->rememberedObject = 0; @@ -984,7 +970,6 @@ static NPObject *pluginAllocate(NPP npp, NPClass *theClass) newInstance->lastHeaders = NULL; newInstance->testGetURLOnDestroy = FALSE; - newInstance->testDocumentOpenInDestroyStream = FALSE; newInstance->testWindowOpen = FALSE; newInstance->testKeyboardFocusForPlugins = FALSE; diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.h b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.h index 03befb0..2c1d325 100644 --- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.h +++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.h @@ -25,7 +25,7 @@ #include <WebKit/npfunctions.h> -#if XP_MACOSX +#if defined(XP_MACOSX) #if !defined(MAC_OS_X_VERSION_10_5) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5 #define BUILDING_ON_TIGER 1 #elif !defined(MAC_OS_X_VERSION_10_6) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 @@ -35,11 +35,15 @@ #endif #endif // XP_MACOSX +class PluginTest; + extern NPNetscapeFuncs *browser; typedef struct { NPObject header; + PluginTest* pluginTest; + NPP npp; NPBool eventLogging; NPBool logSetWindow; @@ -50,7 +54,6 @@ typedef struct { NPObject* testObject; NPObject* rememberedObject; NPStream* stream; - NPBool testDocumentOpenInDestroyStream; NPBool testGetURLOnDestroy; NPBool testWindowOpen; NPBool testKeyboardFocusForPlugins; @@ -66,7 +69,7 @@ typedef struct { #ifdef XP_MACOSX NPEventModel eventModel; #endif -#if XP_MACOSX && !defined(BUILDING_ON_TIGER) +#if defined(XP_MACOSX) && !defined(BUILDING_ON_TIGER) void* coreAnimationLayer; #endif NPWindow lastWindow; @@ -80,7 +83,7 @@ extern void pluginLog(NPP instance, const char* format, ...); extern bool testDocumentOpen(NPP npp); extern bool testWindowOpen(NPP npp); -#if XP_MACOSX && !defined(BUILDING_ON_TIGER) +#if defined(XP_MACOSX) && !defined(BUILDING_ON_TIGER) extern void* createCoreAnimationLayer(); #endif diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp new file mode 100644 index 0000000..0ff7029 --- /dev/null +++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2010 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. + */ + +#include "PluginTest.h" + +#include <assert.h> + +using namespace std; +extern NPNetscapeFuncs *browser; + +PluginTest* PluginTest::create(NPP npp, const string& identifier) +{ + CreateTestFunction createTestFunction = createTestFunctions()[identifier]; + if (createTestFunction) + return createTestFunction(npp, identifier); + + return new PluginTest(npp, identifier); +} + +PluginTest::PluginTest(NPP npp, const string& identifier) + : m_npp(npp) + , m_identifier(identifier) +{ +} + +PluginTest::~PluginTest() +{ +} + +NPError PluginTest::NPP_DestroyStream(NPStream *stream, NPReason reason) +{ + return NPERR_NO_ERROR; +} + +NPError PluginTest::NPP_GetValue(NPPVariable variable, void *value) +{ + // We don't know anything about plug-in values so just return NPERR_GENERIC_ERROR. + return NPERR_GENERIC_ERROR; +} + +NPIdentifier PluginTest::NPN_GetStringIdentifier(const NPUTF8 *name) +{ + return browser->getstringidentifier(name); +} + +NPIdentifier PluginTest::NPN_GetIntIdentifier(int32_t intid) +{ + return browser->getintidentifier(intid); +} + +NPObject* PluginTest::NPN_CreateObject(NPClass* npClass) +{ + return browser->createobject(m_npp, npClass); +} + +bool PluginTest::NPN_RemoveProperty(NPObject* npObject, NPIdentifier propertyName) +{ + return browser->removeproperty(m_npp, npObject, propertyName); +} + +void PluginTest::registerCreateTestFunction(const string& identifier, CreateTestFunction createTestFunction) +{ + assert(!createTestFunctions().count(identifier)); + + createTestFunctions()[identifier] = createTestFunction; +} + +std::map<std::string, PluginTest::CreateTestFunction>& PluginTest::createTestFunctions() +{ + static std::map<std::string, CreateTestFunction> testFunctions; + + return testFunctions; +} diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h new file mode 100644 index 0000000..ecc0185 --- /dev/null +++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h @@ -0,0 +1,212 @@ +/* + * Copyright (C) 2010 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 PluginTest_h +#define PluginTest_h + +#include <WebKit/npfunctions.h> +#include <assert.h> +#include <map> +#include <string> + +// Helper classes for implementing has_member +typedef char (&no_tag)[1]; +typedef char (&yes_tag)[2]; + +#define DEFINE_HAS_MEMBER_CHECK(member, returnType, argumentTypes) \ +template<typename T, returnType (T::*member) argumentTypes> struct pmf_##member##_helper {}; \ +template<typename T> no_tag has_member_##member##_helper(...); \ +template<typename T> yes_tag has_member_##member##_helper(pmf_##member##_helper<T, &T::member >*); \ +template<typename T> struct has_member_##member { \ +static const bool value = sizeof(has_member_##member##_helper<T>(0)) == sizeof(yes_tag); \ +}; + +DEFINE_HAS_MEMBER_CHECK(hasMethod, bool, (NPIdentifier methodName)); +DEFINE_HAS_MEMBER_CHECK(invoke, bool, (NPIdentifier methodName, const NPVariant*, uint32_t, NPVariant* result)); +DEFINE_HAS_MEMBER_CHECK(invokeDefault, bool, (const NPVariant*, uint32_t, NPVariant* result)); +DEFINE_HAS_MEMBER_CHECK(hasProperty, bool, (NPIdentifier propertyName)); +DEFINE_HAS_MEMBER_CHECK(getProperty, bool, (NPIdentifier propertyName, NPVariant* result)); + +class PluginTest { +public: + static PluginTest* create(NPP, const std::string& identifier); + virtual ~PluginTest(); + + // NPP functions. + virtual NPError NPP_DestroyStream(NPStream* stream, NPReason reason); + virtual NPError NPP_GetValue(NPPVariable, void* value); + + // NPN functions. + NPIdentifier NPN_GetStringIdentifier(const NPUTF8* name); + NPIdentifier NPN_GetIntIdentifier(int32_t intid); + NPObject* NPN_CreateObject(NPClass*); + bool NPN_RemoveProperty(NPObject*, NPIdentifier propertyName); + + template<typename TestClassTy> class Register { + public: + Register(const std::string& identifier) + { + registerCreateTestFunction(identifier, Register::create); + } + + private: + static PluginTest* create(NPP npp, const std::string& identifier) + { + return new TestClassTy(npp, identifier); + } + }; + +protected: + PluginTest(NPP npp, const std::string& identifier); + + // FIXME: A plug-in test shouldn't need to know about it's NPP. Make this private. + NPP m_npp; + + const std::string& identifier() const { return m_identifier; } + + // NPObject helper template. + template<typename T> struct Object : NPObject { + public: + static NPObject* create(PluginTest* pluginTest) + { + Object* object = static_cast<Object*>(pluginTest->NPN_CreateObject(npClass())); + + object->m_pluginTest = pluginTest; + return object; + } + + // These should never be called. + bool hasMethod(NPIdentifier methodName) + { + assert(false); + return false; + } + + bool invoke(NPIdentifier methodName, const NPVariant*, uint32_t, NPVariant* result) + { + assert(false); + return false; + } + + bool invokeDefault(const NPVariant*, uint32_t, NPVariant* result) + { + assert(false); + return false; + } + + bool hasProperty(NPIdentifier propertyName) + { + assert(false); + return false; + } + + bool getProperty(NPIdentifier propertyName, NPVariant* result) + { + assert(false); + return false; + } + + protected: + Object() + : m_pluginTest(0) + { + } + + virtual ~Object() + { + } + + PluginTest* pluginTest() const { return m_pluginTest; } + + private: + static NPObject* NP_Allocate(NPP npp, NPClass* aClass) + { + return new T; + } + + static void NP_Deallocate(NPObject* npObject) + { + delete static_cast<T*>(npObject); + } + + static bool NP_HasMethod(NPObject* npObject, NPIdentifier methodName) + { + return static_cast<T*>(npObject)->hasMethod(methodName); + } + + static bool NP_Invoke(NPObject* npObject, NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result) + { + return static_cast<T*>(npObject)->invoke(methodName, arguments, argumentCount, result); + } + + static bool NP_InvokeDefault(NPObject* npObject, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result) + { + return static_cast<T*>(npObject)->invokeDefault(arguments, argumentCount, result); + } + + static bool NP_HasProperty(NPObject* npObject, NPIdentifier propertyName) + { + return static_cast<T*>(npObject)->hasProperty(propertyName); + } + + static bool NP_GetProperty(NPObject* npObject, NPIdentifier propertyName, NPVariant* result) + { + return static_cast<T*>(npObject)->getProperty(propertyName, result); + } + + static NPClass* npClass() + { + static NPClass npClass = { + NP_CLASS_STRUCT_VERSION, + NP_Allocate, + NP_Deallocate, + 0, // NPClass::invalidate + has_member_hasMethod<T>::value ? NP_HasMethod : 0, + has_member_invoke<T>::value ? NP_Invoke : 0, + has_member_invokeDefault<T>::value ? NP_InvokeDefault : 0, + has_member_hasProperty<T>::value ? NP_HasProperty : 0, + has_member_getProperty<T>::value ? NP_GetProperty : 0, + 0, // NPClass::setProperty + 0, // NPClass::removeProperty + 0, // NPClass::enumerate + 0 // NPClass::construct + }; + + return &npClass; + }; + + PluginTest* m_pluginTest; + }; + +private: + typedef PluginTest* (*CreateTestFunction)(NPP, const std::string&); + + static void registerCreateTestFunction(const std::string&, CreateTestFunction); + static std::map<std::string, CreateTestFunction>& createTestFunctions(); + + std::string m_identifier; +}; + +#endif // PluginTest_h diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp new file mode 100644 index 0000000..69e706e --- /dev/null +++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2010 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. + */ + +#include "PluginTest.h" + +using namespace std; + +extern bool testDocumentOpen(NPP npp); + +// Call document.open from NPP_DestroyStream. + +class DocumentOpenInDestroyStream : public PluginTest { +public: + DocumentOpenInDestroyStream(NPP npp, const string& identifier) + : PluginTest(npp, identifier) + , m_shouldOpen(true) + { + } + +private: + virtual NPError NPP_DestroyStream(NPStream*, NPReason) + { + if (m_shouldOpen) { + testDocumentOpen(m_npp); + m_shouldOpen = false; + } + + return NPERR_NO_ERROR; + } + + bool m_shouldOpen; +}; + +static PluginTest::Register<DocumentOpenInDestroyStream> documentOpenInDestroyStream("document-open-in-destroy-stream"); diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp new file mode 100644 index 0000000..38236e3 --- /dev/null +++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2010 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. + */ + +#include "PluginTest.h" + +using namespace std; + +class NPRuntimeObjectFromDestroyedPlugin : public PluginTest { +public: + NPRuntimeObjectFromDestroyedPlugin(NPP npp, const string& identifier) + : PluginTest(npp, identifier) + { + } + +private: + // This is the test object. + class TestObject : public Object<TestObject> { }; + + // This is the scriptable object. It has a single "testObject" property. + class ScriptableObject : public Object<ScriptableObject> { + public: + bool hasProperty(NPIdentifier propertyName) + { + return propertyName == pluginTest()->NPN_GetStringIdentifier("testObject"); + } + + bool getProperty(NPIdentifier propertyName, NPVariant* result) + { + if (propertyName != pluginTest()->NPN_GetStringIdentifier("testObject")) + return false; + + NPObject* testObject = TestObject::create(pluginTest()); + OBJECT_TO_NPVARIANT(testObject, *result); + return true; + } + }; + + virtual NPError NPP_GetValue(NPPVariable variable, void *value) + { + if (variable != NPPVpluginScriptableNPObject) + return NPERR_GENERIC_ERROR; + + *(NPObject**)value = ScriptableObject::create(this); + + return NPERR_NO_ERROR; + } +}; + +static PluginTest::Register<NPRuntimeObjectFromDestroyedPlugin> npRuntimeObjectFromDestroyedPlugin("npruntime-object-from-destroyed-plugin"); + diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeRemoveProperty.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeRemoveProperty.cpp new file mode 100644 index 0000000..4d417d1 --- /dev/null +++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeRemoveProperty.cpp @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2010 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. + */ + +#include "PluginTest.h" + +using namespace std; + + +class NPRuntimeRemoveProperty : public PluginTest { +public: + NPRuntimeRemoveProperty(NPP npp, const string& identifier) + : PluginTest(npp, identifier) + { + } + +private: + struct TestObject : Object<TestObject> { + public: + bool hasMethod(NPIdentifier methodName) + { + return methodName == pluginTest()->NPN_GetStringIdentifier("testRemoveProperty"); + } + + bool invoke(NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result) + { + assert(methodName == pluginTest()->NPN_GetStringIdentifier("testRemoveProperty")); + + if (argumentCount != 2) + return false; + + if (!NPVARIANT_IS_OBJECT(arguments[0])) + return false; + + if (!NPVARIANT_IS_STRING(arguments[1]) && !NPVARIANT_IS_DOUBLE(arguments[1])) + return false; + + NPIdentifier propertyName; + if (NPVARIANT_IS_STRING(arguments[1])) { + string propertyNameString(arguments[1].value.stringValue.UTF8Characters, + arguments[1].value.stringValue.UTF8Length); + + propertyName = pluginTest()->NPN_GetStringIdentifier(propertyNameString.c_str()); + } else { + int32_t number = arguments[1].value.doubleValue; + propertyName = pluginTest()->NPN_GetIntIdentifier(number); + } + + pluginTest()->NPN_RemoveProperty(NPVARIANT_TO_OBJECT(arguments[0]), propertyName); + + VOID_TO_NPVARIANT(*result); + return true; + } + }; + + virtual NPError NPP_GetValue(NPPVariable variable, void *value) + { + if (variable != NPPVpluginScriptableNPObject) + return NPERR_GENERIC_ERROR; + + *(NPObject**)value = TestObject::create(this); + + return NPERR_NO_ERROR; + } + +}; + +static PluginTest::Register<NPRuntimeRemoveProperty> npRuntimeRemoveProperty("npruntime-remove-property"); diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/PluginScriptableNPObjectInvokeDefault.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/PluginScriptableNPObjectInvokeDefault.cpp new file mode 100644 index 0000000..959e182 --- /dev/null +++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/PluginScriptableNPObjectInvokeDefault.cpp @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2010 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. + */ + +#include "PluginTest.h" + +using namespace std; + +// A test where the plug-ins scriptable object either has or doesn't have an invokeDefault function. +class PluginScriptableNPObjectInvokeDefault : public PluginTest { +public: + PluginScriptableNPObjectInvokeDefault(NPP npp, const string& identifier) + : PluginTest(npp, identifier) + { + } + +private: + struct NPObjectWithoutInvokeDefault : Object<NPObjectWithoutInvokeDefault> { }; + + struct NPObjectWithInvokeDefault : Object<NPObjectWithInvokeDefault> { + public: + bool invokeDefault(const NPVariant*, uint32_t, NPVariant* result) + { + INT32_TO_NPVARIANT(1, *result); + return true; + } + }; + + virtual NPError NPP_GetValue(NPPVariable variable, void *value) + { + if (variable != NPPVpluginScriptableNPObject) + return NPERR_GENERIC_ERROR; + + NPObject* object; + if (identifier() == "plugin-scriptable-npobject-invoke-default") + object = NPObjectWithInvokeDefault::create(this); + else + object = NPObjectWithoutInvokeDefault::create(this); + + *(NPObject**)value = object; + + return NPERR_NO_ERROR; + } +}; + +static PluginTest::Register<PluginScriptableNPObjectInvokeDefault> pluginScriptableNPObjectInvokeDefault("plugin-scriptable-npobject-invoke-default"); +static PluginTest::Register<PluginScriptableNPObjectInvokeDefault> pluginScriptableNPObjectNoInvokeDefault("plugin-scriptable-npobject-no-invoke-default"); diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp index 82a6e3a..fcda50b 100644 --- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp +++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp @@ -25,6 +25,12 @@ #include "PluginObject.h" +#include "PluginTest.h" + +#include <string> + +using namespace std; + #if XP_WIN #define STDCALL __stdcall @@ -132,7 +138,11 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc #endif #endif // XP_MACOSX + string testIdentifier; + for (int i = 0; i < argc; i++) { + if (strcasecmp(argn[i], "test") == 0) + testIdentifier = argv[i]; if (strcasecmp(argn[i], "onstreamload") == 0 && !obj->onStreamLoad) obj->onStreamLoad = strdup(argv[i]); else if (strcasecmp(argn[i], "onStreamDestroy") == 0 && !obj->onStreamDestroy) @@ -158,8 +168,6 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc executeScript(obj, "document.body.innerHTML = ''"); else if (!strcasecmp(argn[i], "ondestroy")) obj->onDestroy = strdup(argv[i]); - else if (strcasecmp(argn[i], "testdocumentopenindestroystream") == 0) - obj->testDocumentOpenInDestroyStream = TRUE; else if (strcasecmp(argn[i], "testwindowopen") == 0) obj->testWindowOpen = TRUE; else if (strcasecmp(argn[i], "drawingmodel") == 0) { @@ -196,7 +204,9 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc #endif browser->getvalue(instance, NPNVprivateModeBool, (void *)&obj->cachedPrivateBrowsingMode); - + + obj->pluginTest = PluginTest::create(instance, testIdentifier); + return NPERR_NO_ERROR; } @@ -325,12 +335,7 @@ NPError NPP_DestroyStream(NPP instance, NPStream *stream, NPReason reason) } } - if (obj->testDocumentOpenInDestroyStream) { - testDocumentOpen(instance); - obj->testDocumentOpenInDestroyStream = FALSE; - } - - return NPERR_NO_ERROR; + return obj->pluginTest->NPP_DestroyStream(stream, reason); } int32_t NPP_WriteReady(NPP instance, NPStream *stream) @@ -524,6 +529,10 @@ NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value) { PluginObject* obj = static_cast<PluginObject*>(instance->pdata); + // First, check if the PluginTest object supports getting this value. + if (obj->pluginTest->NPP_GetValue(variable, value) == NPERR_NO_ERROR) + return NPERR_NO_ERROR; + if (variable == NPPVpluginScriptableNPObject) { void **v = (void **)value; // Return value is expected to be retained diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj index 34d2f08..c36666f 100644 --- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj +++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj @@ -39,7 +39,7 @@ />
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(ProjectDir)..\..\TestNetscapePlugin.subproj";"$(WebKitLibrariesDir)\include""
+ AdditionalIncludeDirectories=""$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(ProjectDir)..\..\TestNetscapePlugin";"$(WebKitLibrariesDir)\include""
PreprocessorDefinitions="_USRDLL;TESTNETSCAPEPLUGIN_EXPORTS;snprintf=_snprintf"
DisableSpecificWarnings="4819"
/>
@@ -109,7 +109,7 @@ />
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(ProjectDir)..\..\TestNetscapePlugin.subproj";"$(WebKitLibrariesDir)\include""
+ AdditionalIncludeDirectories=""$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(ProjectDir)..\..\TestNetscapePlugin";"$(WebKitLibrariesDir)\include""
PreprocessorDefinitions="_USRDLL;TESTNETSCAPEPLUGIN_EXPORTS;snprintf=_snprintf"
DisableSpecificWarnings="4819"
/>
@@ -178,7 +178,7 @@ />
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(ProjectDir)..\..\TestNetscapePlugin.subproj";"$(WebKitLibrariesDir)\include""
+ AdditionalIncludeDirectories=""$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(ProjectDir)..\..\TestNetscapePlugin";"$(WebKitLibrariesDir)\include""
PreprocessorDefinitions="_USRDLL;TESTNETSCAPEPLUGIN_EXPORTS;snprintf=_snprintf"
RuntimeLibrary="3"
DisableSpecificWarnings="4819"
@@ -248,7 +248,7 @@ />
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(ProjectDir)..\..\TestNetscapePlugin.subproj";"$(WebKitLibrariesDir)\include""
+ AdditionalIncludeDirectories=""$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(ProjectDir)..\..\TestNetscapePlugin";"$(WebKitLibrariesDir)\include""
PreprocessorDefinitions="_USRDLL;TESTNETSCAPEPLUGIN_EXPORTS;snprintf=_snprintf"
DisableSpecificWarnings="4819"
/>
@@ -317,7 +317,7 @@ />
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(ProjectDir)..\..\TestNetscapePlugin.subproj";"$(WebKitLibrariesDir)\include""
+ AdditionalIncludeDirectories=""$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(ProjectDir)..\..\TestNetscapePlugin";"$(WebKitLibrariesDir)\include""
PreprocessorDefinitions="_USRDLL;TESTNETSCAPEPLUGIN_EXPORTS;snprintf=_snprintf"
RuntimeLibrary="3"
DisableSpecificWarnings="4819"
@@ -425,6 +425,14 @@ >
</File>
<File
+ RelativePath="..\PluginTest.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\PluginTest.h"
+ >
+ </File>
+ <File
RelativePath=".\resource.h"
>
</File>
@@ -448,6 +456,26 @@ RelativePath="..\TestObject.h"
>
</File>
+ <Filter
+ Name="Tests"
+ >
+ <File
+ RelativePath="..\Tests\DocumentOpenInDestroyStream.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\Tests\NPRuntimeObjectFromDestroyedPlugin.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\Tests\NPRuntimeRemoveProperty.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\Tests\PluginScriptableNPObjectInvokeDefault.cpp"
+ >
+ </File>
+ </Filter>
</Files>
<Globals>
</Globals>
diff --git a/WebKitTools/DumpRenderTree/chromium/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/chromium/DumpRenderTree.cpp index 7194279..2885cf6 100644 --- a/WebKitTools/DumpRenderTree/chromium/DumpRenderTree.cpp +++ b/WebKitTools/DumpRenderTree/chromium/DumpRenderTree.cpp @@ -84,7 +84,7 @@ static void runTest(TestShell& shell, TestParams& params, const string& testName int main(int argc, char* argv[]) { webkit_support::SetUpTestEnvironment(); - platformInit(); + platformInit(&argc, &argv); TestParams params; Vector<string> tests; diff --git a/WebKitTools/DumpRenderTree/chromium/EventSender.cpp b/WebKitTools/DumpRenderTree/chromium/EventSender.cpp index fd7ba2d..4e84c96 100644 --- a/WebKitTools/DumpRenderTree/chromium/EventSender.cpp +++ b/WebKitTools/DumpRenderTree/chromium/EventSender.cpp @@ -541,6 +541,8 @@ void EventSender::keyDown(const CppArgumentList& arguments, CppVariant* result) code = base::VKEY_LEFT; else if ("upArrow" == codeStr) code = base::VKEY_UP; + else if ("insert" == codeStr) + code = base::VKEY_INSERT; else if ("delete" == codeStr) code = base::VKEY_DELETE; else if ("pageUp" == codeStr) @@ -551,6 +553,8 @@ void EventSender::keyDown(const CppArgumentList& arguments, CppVariant* result) code = base::VKEY_HOME; else if ("end" == codeStr) code = base::VKEY_END; + else if ("printScreen" == codeStr) + code = base::VKEY_SNAPSHOT; else { // Compare the input string with the function-key names defined by the // DOM spec (i.e. "F1",...,"F24"). If the input string is a function-key diff --git a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp index ea1fd01..cd27c18 100644 --- a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp +++ b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp @@ -35,7 +35,6 @@ #include "DRTDevToolsAgent.h" #include "TestShell.h" #include "WebViewHost.h" -#include "base/string_util.h" #include "public/WebAnimationController.h" #include "public/WebConsoleMessage.h" #include "public/WebDocument.h" @@ -51,6 +50,9 @@ #include "public/WebURL.h" #include "public/WebView.h" #include "webkit/support/webkit_support.h" +#include <algorithm> +#include <cstdlib> +#include <limits> #include <wtf/text/WTFString.h> #if OS(WINDOWS) @@ -164,6 +166,8 @@ LayoutTestController::LayoutTestController(TestShell* shell) bindMethod("forceRedSelectionColors", &LayoutTestController::forceRedSelectionColors); bindMethod("setEditingBehavior", &LayoutTestController::setEditingBehavior); + bindMethod("setMockDeviceOrientation", &LayoutTestController::setMockDeviceOrientation); + bindMethod("setGeolocationPermission", &LayoutTestController::setGeolocationPermission); bindMethod("setMockGeolocationPosition", &LayoutTestController::setMockGeolocationPosition); bindMethod("setMockGeolocationError", &LayoutTestController::setMockGeolocationError); @@ -702,7 +706,7 @@ void LayoutTestController::pathToLocalResource(const CppArgumentList& arguments, string url = arguments[0].toString(); #if OS(WINDOWS) - if (StartsWithASCII(url, "/tmp/", true)) { + if (!url.find("/tmp/")) { // We want a temp file. const unsigned tempPrefixLength = 5; size_t bufferSize = MAX_PATH; @@ -714,7 +718,7 @@ void LayoutTestController::pathToLocalResource(const CppArgumentList& arguments, tempLength = GetTempPathW(bufferSize, tempPath.get()); ASSERT(tempLength < bufferSize); } - std::string resultPath(WebString(tempPath.get(), tempLength).utf8()); + string resultPath(WebString(tempPath.get(), tempLength).utf8()); resultPath.append(url.substr(tempPrefixLength)); result->set(resultPath); return; @@ -723,8 +727,12 @@ void LayoutTestController::pathToLocalResource(const CppArgumentList& arguments, // Some layout tests use file://// which we resolve as a UNC path. Normalize // them to just file:///. - while (StartsWithASCII(url, "file:////", false)) + string lowerUrl = url; + transform(lowerUrl.begin(), lowerUrl.end(), lowerUrl.begin(), ::tolower); + while (!lowerUrl.find("file:////")) { url = url.substr(0, 8) + url.substr(9); + lowerUrl = lowerUrl.substr(0, 8) + lowerUrl.substr(9); + } result->set(webkit_support::RewriteLayoutTestsURL(url).spec()); } @@ -1022,9 +1030,12 @@ int32_t LayoutTestController::cppVariantToInt32(const CppVariant& value) if (value.isInt32()) return value.toInt32(); if (value.isString()) { - int number; - if (StringToInt(value.toString(), &number)) - return number; + string stringSource = value.toString(); + const char* source = stringSource.data(); + char* end; + long number = strtol(source, &end, 10); + if (end == source + stringSource.length() && number >= numeric_limits<int32_t>::min() && number <= numeric_limits<int32_t>::max()) + return static_cast<int32_t>(number); } logErrorToConsole("Invalid value for preference. Expected integer value."); return 0; @@ -1310,6 +1321,12 @@ void LayoutTestController::setEditingBehavior(const CppArgumentList& arguments, logErrorToConsole("Passed invalid editing behavior. Should be 'mac' or 'win'."); } +void LayoutTestController::setMockDeviceOrientation(const CppArgumentList& arguments, CppVariant* result) +{ + // FIXME: Implement for DeviceOrientation layout tests. + // See https://bugs.webkit.org/show_bug.cgi?id=30335. +} + void LayoutTestController::setGeolocationPermission(const CppArgumentList& arguments, CppVariant* result) { result->setNull(); diff --git a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h index 46a14de..6748352 100644 --- a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h +++ b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h @@ -282,6 +282,9 @@ public: void addUserScript(const CppArgumentList&, CppVariant*); void addUserStyleSheet(const CppArgumentList&, CppVariant*); + // DeviceOrientation related functions + void setMockDeviceOrientation(const CppArgumentList&, CppVariant*); + // Geolocation related functions. void setGeolocationPermission(const CppArgumentList&, CppVariant*); void setMockGeolocationPosition(const CppArgumentList&, CppVariant*); diff --git a/WebKitTools/DumpRenderTree/chromium/TestShell.h b/WebKitTools/DumpRenderTree/chromium/TestShell.h index 0f74ee1..0615552 100644 --- a/WebKitTools/DumpRenderTree/chromium/TestShell.h +++ b/WebKitTools/DumpRenderTree/chromium/TestShell.h @@ -184,6 +184,6 @@ private: #endif }; -void platformInit(); +void platformInit(int*, char***); #endif // TestShell_h diff --git a/WebKitTools/DumpRenderTree/chromium/TestShellGtk.cpp b/WebKitTools/DumpRenderTree/chromium/TestShellGtk.cpp index 4f3eefd..a9d374c 100644 --- a/WebKitTools/DumpRenderTree/chromium/TestShellGtk.cpp +++ b/WebKitTools/DumpRenderTree/chromium/TestShellGtk.cpp @@ -33,6 +33,7 @@ #include "webkit/support/webkit_support.h" #include <fontconfig/fontconfig.h> +#include <gtk/gtk.h> #include <signal.h> static void AlarmHandler(int signatl) @@ -185,7 +186,11 @@ void TestShell::waitTestFinished() signal(SIGALRM, SIG_DFL); } -void platformInit() +void platformInit(int* argc, char*** argv) { + // FIXME: It's better call gtk_init() only when we run plugin tests. + // See http://groups.google.com/a/chromium.org/group/chromium-dev/browse_thread/thread/633ea167cde196ca# + gtk_init(argc, argv); + setupFontconfig(); } diff --git a/WebKitTools/DumpRenderTree/chromium/TestShellMac.mm b/WebKitTools/DumpRenderTree/chromium/TestShellMac.mm index 218b6d0..19cfd07 100644 --- a/WebKitTools/DumpRenderTree/chromium/TestShellMac.mm +++ b/WebKitTools/DumpRenderTree/chromium/TestShellMac.mm @@ -124,6 +124,6 @@ void TestShell::waitTestFinished() [thread release]; } -void platformInit() +void platformInit(int*, char***) { } diff --git a/WebKitTools/DumpRenderTree/chromium/TestShellWin.cpp b/WebKitTools/DumpRenderTree/chromium/TestShellWin.cpp index a9ca6a9..72f800c 100644 --- a/WebKitTools/DumpRenderTree/chromium/TestShellWin.cpp +++ b/WebKitTools/DumpRenderTree/chromium/TestShellWin.cpp @@ -103,7 +103,7 @@ void TestShell::waitTestFinished() WaitForSingleObject(threadHandle, 1000); } -void platformInit() +void platformInit(int*, char***) { // Set stdout/stderr binary mode. _setmode(_fileno(stdout), _O_BINARY); diff --git a/WebKitTools/DumpRenderTree/gtk/EventSender.cpp b/WebKitTools/DumpRenderTree/gtk/EventSender.cpp index b95fec2..4f4246f 100644 --- a/WebKitTools/DumpRenderTree/gtk/EventSender.cpp +++ b/WebKitTools/DumpRenderTree/gtk/EventSender.cpp @@ -103,6 +103,20 @@ static GdkWindow* gtk_widget_get_window(GtkWidget* widget) } #endif +#if !GTK_CHECK_VERSION(2, 21, 2) +static GdkDragAction gdk_drag_context_get_selected_action(GdkDragContext* context) +{ + g_return_val_if_fail(GDK_IS_DRAG_CONTEXT(context), static_cast<GdkDragAction>(0)); + return context->action; +} + +static GdkDragAction gdk_drag_context_get_actions(GdkDragContext* context) +{ + g_return_val_if_fail(GDK_IS_DRAG_CONTEXT(context), GDK_ACTION_DEFAULT); + return context->actions; +} +#endif + static JSValueRef getDragModeCallback(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { return JSValueMakeBoolean(context, dragMode); @@ -371,10 +385,12 @@ static void dispatchEvent(GdkEvent event) // Simulate a drag motion on the top-level GDK window. GtkWidget* parentWidget = gtk_widget_get_parent(GTK_WIDGET(view)); - GdkWindow* parentWidgetWindow = parentWidget->window; + GdkWindow* parentWidgetWindow = gtk_widget_get_window(parentWidget); gdk_drag_motion(currentDragSourceContext, parentWidgetWindow, GDK_DRAG_PROTO_XDND, event.motion.x_root, event.motion.y_root, - currentDragSourceContext->action, currentDragSourceContext->actions, GDK_CURRENT_TIME); + gdk_drag_context_get_selected_action(currentDragSourceContext), + gdk_drag_context_get_actions(currentDragSourceContext), + GDK_CURRENT_TIME); } else if (currentDragSourceContext && event.type == GDK_BUTTON_RELEASE) { // We've released the mouse button, we should just be able to spin the @@ -456,9 +472,13 @@ static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JS gdkKeySym = GDK_KP_Home; else if (JSStringIsEqualToUTF8CString(character, "end")) gdkKeySym = GDK_KP_End; + else if (JSStringIsEqualToUTF8CString(character, "insert")) + gdkKeySym = GDK_KP_Insert; + else if (JSStringIsEqualToUTF8CString(character, "delete")) + gdkKeySym = GDK_KP_Delete; else - // Assume we only get arrow/pgUp/pgDn/home/end keys with - // location=NUMPAD for now. + // If we get some other key specified with the numpad location, + // crash here, so we add it sooner rather than later. g_assert_not_reached(); } else { if (JSStringIsEqualToUTF8CString(character, "leftArrow")) @@ -477,8 +497,12 @@ static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JS gdkKeySym = GDK_Home; else if (JSStringIsEqualToUTF8CString(character, "end")) gdkKeySym = GDK_End; + else if (JSStringIsEqualToUTF8CString(character, "insert")) + gdkKeySym = GDK_Insert; else if (JSStringIsEqualToUTF8CString(character, "delete")) gdkKeySym = GDK_Delete; + else if (JSStringIsEqualToUTF8CString(character, "printScreen")) + gdkKeySym = GDK_Print; else if (JSStringIsEqualToUTF8CString(character, "F1")) gdkKeySym = GDK_F1; else if (JSStringIsEqualToUTF8CString(character, "F2")) diff --git a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp index 5c942d3..2aece10 100644 --- a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp +++ b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp @@ -442,6 +442,12 @@ void LayoutTestController::disableImageLoading() // Also need to make sure image loading is re-enabled for each new test. } +void LayoutTestController::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma) +{ + // FIXME: Implement for DeviceOrientation layout tests. + // See https://bugs.webkit.org/show_bug.cgi?id=30335. +} + void LayoutTestController::setMockGeolocationPosition(double latitude, double longitude, double accuracy) { // FIXME: Implement for Geolocation layout tests. diff --git a/WebKitTools/DumpRenderTree/mac/EventSendingController.mm b/WebKitTools/DumpRenderTree/mac/EventSendingController.mm index 9d2fc75..77999bd 100644 --- a/WebKitTools/DumpRenderTree/mac/EventSendingController.mm +++ b/WebKitTools/DumpRenderTree/mac/EventSendingController.mm @@ -597,10 +597,18 @@ static int buildModifierFlags(const WebScriptObject* modifiers) const unichar ch = NSEndFunctionKey; eventCharacter = [NSString stringWithCharacters:&ch length:1]; keyCode = 0x77; + } else if ([character isEqualToString:@"insert"]) { + const unichar ch = NSInsertFunctionKey; + eventCharacter = [NSString stringWithCharacters:&ch length:1]; + keyCode = 0x72; } else if ([character isEqualToString:@"delete"]) { const unichar ch = NSDeleteFunctionKey; eventCharacter = [NSString stringWithCharacters:&ch length:1]; keyCode = 0x75; + } else if ([character isEqualToString:@"printScreen"]) { + const unichar ch = NSPrintScreenFunctionKey; + eventCharacter = [NSString stringWithCharacters:&ch length:1]; + keyCode = 0x0; // There is no known virtual key code for PrintScreen. } // Compare the input string with the function-key names defined by the DOM spec (i.e. "F1",...,"F24"). diff --git a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm index 6b921f0..7db7fff 100644 --- a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm +++ b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm @@ -320,6 +320,13 @@ void LayoutTestController::setDomainRelaxationForbiddenForURLScheme(bool forbidd [WebView _setDomainRelaxationForbidden:forbidden forURLScheme:(NSString *)schemeCFString.get()]; } +void LayoutTestController::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma) +{ + // FIXME: Implement for DeviceOrientation layout tests. + // See https://bugs.webkit.org/show_bug.cgi?id=30335. + +} + void LayoutTestController::setMockGeolocationPosition(double latitude, double longitude, double accuracy) { WebGeolocationPosition *position = [[WebGeolocationPosition alloc] initWithTimestamp:0 latitude:latitude longitude:longitude accuracy:accuracy]; diff --git a/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp b/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp index 1e495b1..63dbd2a 100644 --- a/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp +++ b/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp @@ -334,9 +334,15 @@ void EventSender::keyDown(const QString& string, const QStringList& modifiers, u } else if (string == QLatin1String("end")) { s = QString(); code = Qt::Key_End; + } else if (string == QLatin1String("insert")) { + s = QString(); + code = Qt::Key_Insert; } else if (string == QLatin1String("delete")) { s = QString(); code = Qt::Key_Delete; + } else if (string == QLatin1String("printScreen")) { + s = QString(); + code = Qt::Key_Print; } } QKeyEvent event(QEvent::KeyPress, code, modifs, s); diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp index 8ebdbae..ca51f1b 100644 --- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp +++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp @@ -683,6 +683,12 @@ void LayoutTestController::setEditingBehavior(const QString& editingBehavior) DumpRenderTreeSupportQt::setEditingBehavior(m_drt->webPage(), editingBehavior); } +void LayoutTestController::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma) +{ + // FIXME: Implement for DeviceOrientation layout tests. + // See https://bugs.webkit.org/show_bug.cgi?id=30335. +} + void LayoutTestController::setGeolocationPermission(bool allow) { m_isGeolocationPermissionSet = true; diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h index 4ebf99d..1dee6ce 100644 --- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h +++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h @@ -197,6 +197,8 @@ public slots: // which is a Mac-specific test. void addDisallowedURL(const QString&) {} + void setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma); + void setMockGeolocationError(int code, const QString& message); void setMockGeolocationPosition(double latitude, double longitude, double accuracy); void setGeolocationPermission(bool allow); diff --git a/WebKitTools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro b/WebKitTools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro index 6ab22fc..e48b035 100644 --- a/WebKitTools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro +++ b/WebKitTools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro @@ -26,7 +26,12 @@ INCLUDEPATH += ../../../../JavaScriptCore \ ../../TestNetscapePlugIn SOURCES = PluginObject.cpp \ - TestObject.cpp + PluginTest.cpp \ + TestObject.cpp \ + Tests/DocumentOpenInDestroyStream.cpp \ + Tests/NPRuntimeObjectFromDestroyedPlugin.cpp \ + Tests/NPRuntimeRemoveProperty.cpp \ + Tests/PluginScriptableNPObjectInvokeDefault.cpp mac { SOURCES += ../../TestNetscapePlugIn/main.cpp diff --git a/WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp b/WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp index ca868be..8216f7a 100644 --- a/WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp +++ b/WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp @@ -27,6 +27,7 @@ #include "config.h" #include "PluginObject.h" +#include "PluginTest.h" #include "npapi.h" #include "npruntime.h" @@ -37,7 +38,10 @@ #include <string.h> #include <stdlib.h> #include <X11/Xlib.h> +#include <string> +using namespace std; + extern "C" { NPError NP_Initialize (NPNetscapeFuncs *aMozillaVTable, NPPluginFuncs *aPluginVTable); NPError NP_Shutdown(void); @@ -60,8 +64,12 @@ webkit_test_plugin_new_instance(NPMIMEType /*mimetype*/, PluginObject* obj = (PluginObject*)browser->createobject(instance, getPluginClass()); instance->pdata = obj; + string testIdentifier; + for (int i = 0; i < argc; i++) { - if (strcasecmp(argn[i], "onstreamload") == 0 && !obj->onStreamLoad) + if (strcasecmp(argn[i], "test") == 0) + testIdentifier = argv[i]; + else if (strcasecmp(argn[i], "onstreamload") == 0 && !obj->onStreamLoad) obj->onStreamLoad = strdup(argv[i]); else if (strcasecmp(argn[i], "onStreamDestroy") == 0 && !obj->onStreamDestroy) obj->onStreamDestroy = strdup(argv[i]); @@ -82,8 +90,6 @@ webkit_test_plugin_new_instance(NPMIMEType /*mimetype*/, executeScript(obj, "document.body.innerHTML = ''"); else if (!strcasecmp(argn[i], "ondestroy")) obj->onDestroy = strdup(argv[i]); - else if (strcasecmp(argn[i], "testdocumentopenindestroystream") == 0) - obj->testDocumentOpenInDestroyStream = TRUE; else if (strcasecmp(argn[i], "testwindowopen") == 0) obj->testWindowOpen = TRUE; else if (strcasecmp(argn[i], "onSetWindow") == 0 && !obj->onSetWindow) @@ -91,6 +97,8 @@ webkit_test_plugin_new_instance(NPMIMEType /*mimetype*/, } browser->getvalue(instance, NPNVprivateModeBool, (void *)&obj->cachedPrivateBrowsingMode); + + obj->pluginTest = PluginTest::create(instance, testIdentifier); } return NPERR_NO_ERROR; @@ -190,7 +198,7 @@ webkit_test_plugin_new_stream(NPP instance, } static NPError -webkit_test_plugin_destroy_stream(NPP instance, NPStream* /*stream*/, NPError reason) +webkit_test_plugin_destroy_stream(NPP instance, NPStream* stream, NPError reason) { PluginObject* obj = (PluginObject*)instance->pdata; @@ -217,12 +225,7 @@ webkit_test_plugin_destroy_stream(NPP instance, NPStream* /*stream*/, NPError re } } - if (obj->testDocumentOpenInDestroyStream) { - testDocumentOpen(instance); - obj->testDocumentOpenInDestroyStream = FALSE; - } - - return NPERR_NO_ERROR; + return obj->pluginTest->NPP_DestroyStream(stream, reason); } static void @@ -283,6 +286,14 @@ webkit_test_plugin_url_notify(NPP instance, const char* url, NPReason reason, vo static NPError webkit_test_plugin_get_value(NPP instance, NPPVariable variable, void *value) { + PluginObject* obj = 0; + if (instance) + obj = static_cast<PluginObject*>(instance->pdata); + + // First, check if the PluginTest object supports getting this value. + if (obj && obj->pluginTest->NPP_GetValue(variable, value) == NPERR_NO_ERROR) + return NPERR_NO_ERROR; + NPError err = NPERR_NO_ERROR; switch (variable) { @@ -308,7 +319,6 @@ webkit_test_plugin_get_value(NPP instance, NPPVariable variable, void *value) if (variable == NPPVpluginScriptableNPObject) { void **v = (void **)value; - PluginObject* obj = static_cast<PluginObject*>(instance->pdata); browser->retainobject((NPObject *)obj); *v = obj; err = NPERR_NO_ERROR; diff --git a/WebKitTools/DumpRenderTree/win/EventSender.cpp b/WebKitTools/DumpRenderTree/win/EventSender.cpp index c9749e7..94f0945 100644 --- a/WebKitTools/DumpRenderTree/win/EventSender.cpp +++ b/WebKitTools/DumpRenderTree/win/EventSender.cpp @@ -467,8 +467,12 @@ static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JS virtualKeyCode = VK_HOME; else if (JSStringIsEqualToUTF8CString(character, "end")) virtualKeyCode = VK_END; + else if (JSStringIsEqualToUTF8CString(character, "insert")) + virtualKeyCode = VK_INSERT; else if (JSStringIsEqualToUTF8CString(character, "delete")) virtualKeyCode = VK_DELETE; + else if (JSStringIsEqualToUTF8CString(character, "printScreen")) + virtualKeyCode = VK_SNAPSHOT; else { charCode = JSStringGetCharactersPtr(character)[0]; virtualKeyCode = LOBYTE(VkKeyScan(charCode)); diff --git a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp index a29623e..6519a97 100644 --- a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp +++ b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp @@ -375,6 +375,12 @@ void LayoutTestController::setCustomPolicyDelegate(bool setDelegate, bool permis webView->setPolicyDelegate(0); } +void LayoutTestController::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma) +{ + // FIXME: Implement for DeviceOrientation layout tests. + // See https://bugs.webkit.org/show_bug.cgi?id=30335. +} + void LayoutTestController::setMockGeolocationPosition(double latitude, double longitude, double accuracy) { // FIXME: Implement for Geolocation layout tests. diff --git a/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp b/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp index 905463a..fd6b2d2 100644 --- a/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp +++ b/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp @@ -271,6 +271,12 @@ bool LayoutTestController::pauseTransitionAtTimeOnElementWithId(JSStringRef prop return false; } +void LayoutTestController::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma) +{ + // FIXME: Implement for DeviceOrientation layout tests. + // See https://bugs.webkit.org/show_bug.cgi?id=30335. +} + void LayoutTestController::setMockGeolocationPosition(double latitude, double longitude, double accuracy) { // FIXME: Implement for Geolocation layout tests. diff --git a/WebKitTools/GNUmakefile.am b/WebKitTools/GNUmakefile.am index ef0d735..33d4614 100644 --- a/WebKitTools/GNUmakefile.am +++ b/WebKitTools/GNUmakefile.am @@ -158,6 +158,12 @@ TestNetscapePlugin_libtestnetscapeplugin_la_SOURCES = \ WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/ForwardingHeaders/WebKit/npfunctions.h \ WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/ForwardingHeaders/WebKit/npruntime.h \ WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp \ + WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp \ + WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp \ + WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeRemoveProperty.cpp \ + WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/PluginScriptableNPObjectInvokeDefault.cpp \ + WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp \ + WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h \ WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp \ WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.h \ WebKitTools/DumpRenderTree/TestNetscapePlugIn/TestObject.cpp \ diff --git a/WebKitTools/MiniBrowser/mac/AppDelegate.m b/WebKitTools/MiniBrowser/mac/AppDelegate.m index ccbf176..ffb6363 100644 --- a/WebKitTools/MiniBrowser/mac/AppDelegate.m +++ b/WebKitTools/MiniBrowser/mac/AppDelegate.m @@ -36,15 +36,28 @@ static NSString *defaultURL = @"http://www.webkit.org/"; @implementation BrowserAppDelegate -void _didRecieveMessageFromInjectedBundle(WKContextRef context, WKStringRef message, const void *clientInfo) +void didRecieveMessageFromInjectedBundle(WKContextRef context, WKStringRef messageName, WKTypeRef messageBody, const void *clientInfo) { - CFStringRef cfMessage = WKStringCopyCFString(0, message); - LOG(@"ContextInjectedBundleClient - didRecieveMessage - message: %@", cfMessage); - CFRelease(cfMessage); + CFStringRef cfMessageName = WKStringCopyCFString(0, messageName); + + WKTypeID typeID = WKGetTypeID(messageBody); + if (typeID == WKStringGetTypeID()) { + CFStringRef cfMessageBody = WKStringCopyCFString(0, (WKStringRef)messageBody); + LOG(@"ContextInjectedBundleClient - didRecieveMessage - MessageName: %@ MessageBody %@", cfMessageName, cfMessageBody); + CFRelease(cfMessageBody); + } else { + LOG(@"ContextInjectedBundleClient - didRecieveMessage - MessageName: %@ (MessageBody Unhandeled)\n", cfMessageName); + } + + CFRelease(cfMessageName); - WKStringRef newMessage = WKStringCreateWithCFString(CFSTR("Roger that!")); - WKContextPostMessageToInjectedBundle(context, newMessage); - WKStringRelease(newMessage); + WKStringRef newMessageName = WKStringCreateWithCFString(CFSTR("Response")); + WKStringRef newMessageBody = WKStringCreateWithCFString(CFSTR("Roger that!")); + + WKContextPostMessageToInjectedBundle(context, newMessageName, newMessageBody); + + WKStringRelease(newMessageName); + WKStringRelease(newMessageBody); } #pragma mark History Client Callbacks @@ -128,7 +141,7 @@ static void populateVisitedLinks(WKContextRef context, const void *clientInfo) WKContextInjectedBundleClient bundleClient = { 0, /* version */ 0, /* clientInfo */ - _didRecieveMessageFromInjectedBundle + didRecieveMessageFromInjectedBundle }; WKContextSetInjectedBundleClient(processContext, &bundleClient); WKContextSetHistoryClient(processContext, &historyClient); diff --git a/WebKitTools/MiniBrowser/mac/MiniBrowser_Prefix.pch b/WebKitTools/MiniBrowser/mac/MiniBrowser_Prefix.pch index cb8ceae..0670cf4 100644 --- a/WebKitTools/MiniBrowser/mac/MiniBrowser_Prefix.pch +++ b/WebKitTools/MiniBrowser/mac/MiniBrowser_Prefix.pch @@ -29,6 +29,8 @@ #import <WebKit2/WebKit2.h> +#define ENABLE_LOGGING 1 + #if ENABLE_LOGGING #define LOG NSLog #else diff --git a/WebKitTools/MiniBrowser/mac/WebBundle/WebBundleMain.m b/WebKitTools/MiniBrowser/mac/WebBundle/WebBundleMain.m index cd5ee00..c4f4a68 100644 --- a/WebKitTools/MiniBrowser/mac/WebBundle/WebBundleMain.m +++ b/WebKitTools/MiniBrowser/mac/WebBundle/WebBundleMain.m @@ -37,80 +37,91 @@ static WKBundleRef globalBundle; // WKBundlePageClient -void _didStartProvisionalLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo) +void didStartProvisionalLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo) { } -void _didReceiveServerRedirectForProvisionalLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo) +void didReceiveServerRedirectForProvisionalLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo) { } -void _didFailProvisionalLoadWithErrorForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo) +void didFailProvisionalLoadWithErrorForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo) { } -void _didCommitLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo) +void didCommitLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo) { } -void _didFinishLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo) +void didFinishLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo) { } -void _didFailLoadWithErrorForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo) +void didFailLoadWithErrorForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo) { } -void _didReceiveTitleForFrame(WKBundlePageRef page, WKStringRef title, WKBundleFrameRef frame, const void *clientInfo) +void didReceiveTitleForFrame(WKBundlePageRef page, WKStringRef title, WKBundleFrameRef frame, const void *clientInfo) { } -void _didClearWindowForFrame(WKBundlePageRef page, WKBundleFrameRef frame, JSGlobalContextRef context, JSObjectRef window, const void *clientInfo) +void didClearWindowForFrame(WKBundlePageRef page, WKBundleFrameRef frame, JSGlobalContextRef context, JSObjectRef window, const void *clientInfo) { WKURLRef wkURL = WKBundleFrameCopyURL(WKBundlePageGetMainFrame(page)); CFURLRef cfURL = WKURLCopyCFURL(0, wkURL); WKURLRelease(wkURL); - LOG(@"WKBundlePageClient - _didClearWindowForFrame %@", [(NSURL *)cfURL absoluteString]); + LOG(@"WKBundlePageClient - didClearWindowForFrame %@", [(NSURL *)cfURL absoluteString]); CFRelease(cfURL); - WKStringRef message = WKStringCreateWithCFString(CFSTR("Window was cleared")); - WKBundlePostMessage(globalBundle, message); - WKStringRelease(message); + WKStringRef messageName = WKStringCreateWithCFString(CFSTR("Callback")); + WKStringRef messageBody = WKStringCreateWithCFString(CFSTR("Window was cleared")); + WKBundlePostMessage(globalBundle, messageName, messageBody); + WKStringRelease(messageName); + WKStringRelease(messageBody); } // WKBundleClient -void _didCreatePage(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo) +void didCreatePage(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo) { LOG(@"WKBundleClient - didCreatePage\n"); WKBundlePageLoaderClient client = { 0, 0, - _didStartProvisionalLoadForFrame, - _didReceiveServerRedirectForProvisionalLoadForFrame, - _didFailProvisionalLoadWithErrorForFrame, - _didCommitLoadForFrame, - _didFinishLoadForFrame, - _didFailLoadWithErrorForFrame, - _didReceiveTitleForFrame, - _didClearWindowForFrame + didStartProvisionalLoadForFrame, + didReceiveServerRedirectForProvisionalLoadForFrame, + didFailProvisionalLoadWithErrorForFrame, + didCommitLoadForFrame, + didFinishLoadForFrame, + didFailLoadWithErrorForFrame, + didReceiveTitleForFrame, + didClearWindowForFrame }; WKBundlePageSetLoaderClient(page, &client); } -void _willDestroyPage(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo) +void willDestroyPage(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo) { LOG(@"WKBundleClient - willDestroyPage\n"); } -void _didRecieveMessage(WKBundleRef bundle, WKStringRef message, const void *clientInfo) +void didRecieveMessage(WKBundleRef bundle, WKStringRef messageName, WKTypeRef messageBody, const void *clientInfo) { - CFStringRef cfMessage = WKStringCopyCFString(0, message); - LOG(@"WKBundleClient - didRecieveMessage %@\n", cfMessage); - CFRelease(cfMessage); + CFStringRef cfMessageName = WKStringCopyCFString(0, messageName); + + WKTypeID typeID = WKGetTypeID(messageBody); + if (typeID == WKStringGetTypeID()) { + CFStringRef cfMessageBody = WKStringCopyCFString(0, (WKStringRef)messageBody); + LOG(@"WKBundleClient - didRecieveMessage - MessageName: %@ MessageBody %@", cfMessageName, cfMessageBody); + CFRelease(cfMessageBody); + } else { + LOG(@"WKBundleClient - didRecieveMessage - MessageName: %@ (MessageBody Unhandeled)\n", cfMessageName); + } + + CFRelease(cfMessageName); } void WKBundleInitialize(WKBundleRef bundle) @@ -120,9 +131,9 @@ void WKBundleInitialize(WKBundleRef bundle) WKBundleClient client = { 0, 0, - _didCreatePage, - _willDestroyPage, - _didRecieveMessage + didCreatePage, + willDestroyPage, + didRecieveMessage }; WKBundleSetClient(bundle, &client); } diff --git a/WebKitTools/QtTestBrowser/QtTestBrowser.pro b/WebKitTools/QtTestBrowser/QtTestBrowser.pro index fa16c82..08e0fb8 100644 --- a/WebKitTools/QtTestBrowser/QtTestBrowser.pro +++ b/WebKitTools/QtTestBrowser/QtTestBrowser.pro @@ -2,6 +2,7 @@ TEMPLATE = app SOURCES += \ locationedit.cpp \ + launcherwindow.cpp \ main.cpp \ mainwindow.cpp \ urlloader.cpp \ @@ -12,6 +13,7 @@ SOURCES += \ HEADERS += \ locationedit.h \ + launcherwindow.h \ mainwindow.h \ urlloader.h \ utils.h \ @@ -46,7 +48,7 @@ linux-* { symbian { TARGET.UID3 = 0xA000E543 - TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices + TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices Location } contains(QT_CONFIG, opengl) { diff --git a/WebKitTools/QtTestBrowser/launcherwindow.cpp b/WebKitTools/QtTestBrowser/launcherwindow.cpp new file mode 100644 index 0000000..177adea --- /dev/null +++ b/WebKitTools/QtTestBrowser/launcherwindow.cpp @@ -0,0 +1,881 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2009 Girish Ramakrishnan <girish@forwardbias.in> + * Copyright (C) 2006 George Staikos <staikos@kde.org> + * Copyright (C) 2006 Dirk Mueller <mueller@kde.org> + * Copyright (C) 2006 Zack Rusin <zack@kde.org> + * Copyright (C) 2006 Simon Hausmann <hausmann@kde.org> + * + * 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 COMPUTER, 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 "launcherwindow.h" + +bool LauncherWindow::gUseGraphicsView = false; +bool LauncherWindow::gUseCompositing = true; +bool LauncherWindow::gCacheWebView = false; +bool LauncherWindow::gShowFrameRate = false; +bool LauncherWindow::gResizesToContents = false; +bool LauncherWindow::gUseTiledBackingStore = false; +QGraphicsView::ViewportUpdateMode LauncherWindow::gViewportUpdateMode = QGraphicsView::MinimalViewportUpdate; +QUrl LauncherWindow::gInspectorUrl; + +#if defined(Q_WS_MAEMO_5) || defined(Q_WS_S60) +bool LauncherWindow::gUseFrameFlattening = true; +#else +bool LauncherWindow::gUseFrameFlattening = false; +#endif + +#if defined(QT_CONFIGURED_WITH_OPENGL) +bool LauncherWindow::gUseQGLWidgetViewport = false; +#endif + +LauncherWindow::LauncherWindow(LauncherWindow* other, bool shareScene) + : MainWindow() + , m_currentZoom(100) + , m_view(0) + , m_inspector(0) + , m_formatMenuAction(0) + , m_flipAnimated(0) + , m_flipYAnimated(0) +#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + , m_zoomAnimation(0) +#endif +{ + if (other) { + init(other->isGraphicsBased()); + applyPrefs(other); + if (shareScene && other->isGraphicsBased()) { + QGraphicsView* otherView = static_cast<QGraphicsView*>(other->m_view); + static_cast<QGraphicsView*>(m_view)->setScene(otherView->scene()); + } + } else { + init(gUseGraphicsView); + applyPrefs(); + } + + createChrome(); +} + +LauncherWindow::~LauncherWindow() +{ + grabZoomKeys(false); +} + +void LauncherWindow::init(bool useGraphicsView) +{ + QSplitter* splitter = new QSplitter(Qt::Vertical, this); + setCentralWidget(splitter); + +#if defined(Q_WS_S60) + setWindowState(Qt::WindowMaximized); +#else + setWindowState(Qt::WindowNoState); + resize(800, 600); +#endif + + initializeView(useGraphicsView); + + connect(page(), SIGNAL(loadStarted()), this, SLOT(loadStarted())); + connect(page(), SIGNAL(loadFinished(bool)), this, SLOT(loadFinished())); + connect(page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)), + this, SLOT(showLinkHover(const QString&, const QString&))); + connect(this, SIGNAL(enteredFullScreenMode(bool)), this, SLOT(toggleFullScreenMode(bool))); + + m_inspector = new WebInspector(splitter); +#ifndef QT_NO_PROPERTIES + if (!gInspectorUrl.isEmpty()) + m_inspector->setProperty("_q_inspectorUrl", gInspectorUrl); +#endif + m_inspector->setPage(page()); + m_inspector->hide(); + connect(this, SIGNAL(destroyed()), m_inspector, SLOT(deleteLater())); + + // the zoom values are chosen to be like in Mozilla Firefox 3 + m_zoomLevels << 30 << 50 << 67 << 80 << 90; + m_zoomLevels << 100; + m_zoomLevels << 110 << 120 << 133 << 150 << 170 << 200 << 240 << 300; + + grabZoomKeys(true); +} + +void LauncherWindow::initializeView(bool useGraphicsView) +{ + delete m_view; + + QSplitter* splitter = static_cast<QSplitter*>(centralWidget()); + + if (!useGraphicsView) { + WebViewTraditional* view = new WebViewTraditional(splitter); + view->setPage(page()); + + view->installEventFilter(this); + + m_view = view; + } else { + WebViewGraphicsBased* view = new WebViewGraphicsBased(splitter); + view->setPage(page()); + + if (m_flipAnimated) + connect(m_flipAnimated, SIGNAL(triggered()), view, SLOT(animatedFlip())); + + if (m_flipYAnimated) + connect(m_flipYAnimated, SIGNAL(triggered()), view, SLOT(animatedYFlip())); + + connect(view, SIGNAL(currentFPSUpdated(int)), this, SLOT(updateFPS(int))); + + view->installEventFilter(this); + // The implementation of QAbstractScrollArea::eventFilter makes us need + // to install the event filter also on the viewport of a QGraphicsView. + view->viewport()->installEventFilter(this); + + m_view = view; + } + +#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + m_touchMocking = false; +#endif +} + +void LauncherWindow::createChrome() +{ + QMenu* fileMenu = menuBar()->addMenu("&File"); + fileMenu->addAction("New Window", this, SLOT(newWindow()), QKeySequence::New); + fileMenu->addAction(tr("Open File..."), this, SLOT(openFile()), QKeySequence::Open); + fileMenu->addAction(tr("Open Location..."), this, SLOT(openLocation()), QKeySequence(Qt::CTRL | Qt::Key_L)); + fileMenu->addAction("Close Window", this, SLOT(close()), QKeySequence::Close); + fileMenu->addSeparator(); + fileMenu->addAction("Take Screen Shot...", this, SLOT(screenshot())); + fileMenu->addAction(tr("Print..."), this, SLOT(print()), QKeySequence::Print); + fileMenu->addSeparator(); + fileMenu->addAction("Quit", QApplication::instance(), SLOT(closeAllWindows()), QKeySequence(Qt::CTRL | Qt::Key_Q)); + + QMenu* editMenu = menuBar()->addMenu("&Edit"); + editMenu->addAction(page()->action(QWebPage::Undo)); + editMenu->addAction(page()->action(QWebPage::Redo)); + editMenu->addSeparator(); + editMenu->addAction(page()->action(QWebPage::Cut)); + editMenu->addAction(page()->action(QWebPage::Copy)); + editMenu->addAction(page()->action(QWebPage::Paste)); + editMenu->addSeparator(); + QAction* setEditable = editMenu->addAction("Set Editable", this, SLOT(setEditable(bool))); + setEditable->setCheckable(true); + + QMenu* viewMenu = menuBar()->addMenu("&View"); + viewMenu->addAction(page()->action(QWebPage::Stop)); + viewMenu->addAction(page()->action(QWebPage::Reload)); + viewMenu->addSeparator(); + QAction* zoomIn = viewMenu->addAction("Zoom &In", this, SLOT(zoomIn())); + QAction* zoomOut = viewMenu->addAction("Zoom &Out", this, SLOT(zoomOut())); + QAction* resetZoom = viewMenu->addAction("Reset Zoom", this, SLOT(resetZoom())); + QAction* zoomTextOnly = viewMenu->addAction("Zoom Text Only", this, SLOT(toggleZoomTextOnly(bool))); + zoomTextOnly->setCheckable(true); + zoomTextOnly->setChecked(false); + viewMenu->addSeparator(); + viewMenu->addAction("Dump HTML", this, SLOT(dumpHtml())); + // viewMenu->addAction("Dump plugins", this, SLOT(dumpPlugins())); + + QMenu* formatMenu = new QMenu("F&ormat", this); + m_formatMenuAction = menuBar()->addMenu(formatMenu); + m_formatMenuAction->setVisible(false); + formatMenu->addAction(page()->action(QWebPage::ToggleBold)); + formatMenu->addAction(page()->action(QWebPage::ToggleItalic)); + formatMenu->addAction(page()->action(QWebPage::ToggleUnderline)); + QMenu* writingMenu = formatMenu->addMenu(tr("Writing Direction")); + writingMenu->addAction(page()->action(QWebPage::SetTextDirectionDefault)); + writingMenu->addAction(page()->action(QWebPage::SetTextDirectionLeftToRight)); + writingMenu->addAction(page()->action(QWebPage::SetTextDirectionRightToLeft)); + + zoomIn->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Plus)); + zoomOut->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Minus)); + resetZoom->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_0)); + + QMenu* windowMenu = menuBar()->addMenu("&Window"); + QAction* toggleFullScreen = windowMenu->addAction("Toggle FullScreen", this, SIGNAL(enteredFullScreenMode(bool))); + toggleFullScreen->setCheckable(true); + toggleFullScreen->setChecked(false); + + // when exit fullscreen mode by clicking on the exit area (bottom right corner) we must + // uncheck the Toggle FullScreen action + toggleFullScreen->connect(this, SIGNAL(enteredFullScreenMode(bool)), SLOT(setChecked(bool))); + + QMenu* toolsMenu = menuBar()->addMenu("&Develop"); + + QWebSettings* settings = page()->settings(); + + QMenu* graphicsViewMenu = toolsMenu->addMenu("QGraphicsView"); + QAction* toggleGraphicsView = graphicsViewMenu->addAction("Toggle use of QGraphicsView", this, SLOT(initializeView(bool))); + toggleGraphicsView->setCheckable(true); + toggleGraphicsView->setChecked(isGraphicsBased()); + + QAction* toggleWebGL = toolsMenu->addAction("Toggle WebGL", this, SLOT(toggleWebGL(bool))); + toggleWebGL->setCheckable(true); + toggleWebGL->setChecked(settings->testAttribute(QWebSettings::WebGLEnabled)); + + QAction* spatialNavigationAction = toolsMenu->addAction("Toggle Spatial Navigation", this, SLOT(toggleSpatialNavigation(bool))); + spatialNavigationAction->setCheckable(true); + spatialNavigationAction->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_S)); + + QAction* toggleFrameFlattening = toolsMenu->addAction("Toggle Frame Flattening", this, SLOT(toggleFrameFlattening(bool))); + toggleFrameFlattening->setCheckable(true); + toggleFrameFlattening->setChecked(settings->testAttribute(QWebSettings::FrameFlatteningEnabled)); + +#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + QAction* touchMockAction = toolsMenu->addAction("Toggle multitouch mocking", this, SLOT(setTouchMocking(bool))); + touchMockAction->setCheckable(true); + touchMockAction->setShortcut(QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_T)); +#endif + + toolsMenu->addSeparator(); + + QAction* toggleInterruptingJavaScripteEnabled = toolsMenu->addAction("Enable interrupting js scripts", this, SLOT(toggleInterruptingJavaScriptEnabled(bool))); + toggleInterruptingJavaScripteEnabled->setCheckable(true); + toggleInterruptingJavaScripteEnabled->setChecked(false); + + QAction* toggleJavascriptCanOpenWindows = toolsMenu->addAction("Enable js popup windows", this, SLOT(toggleJavascriptCanOpenWindows(bool))); + toggleJavascriptCanOpenWindows->setCheckable(true); + toggleJavascriptCanOpenWindows->setChecked(false); + + toolsMenu->addSeparator(); + + QAction* userAgentAction = toolsMenu->addAction("Change User Agent", this, SLOT(showUserAgentDialog())); + userAgentAction->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_U)); + + toolsMenu->addAction("Select Elements...", this, SLOT(selectElements())); + + QAction* showInspectorAction = toolsMenu->addAction("Show Web Inspector", m_inspector, SLOT(setVisible(bool)), QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_I)); + showInspectorAction->setCheckable(true); + showInspectorAction->connect(m_inspector, SIGNAL(visibleChanged(bool)), SLOT(setChecked(bool))); + + // GraphicsView sub menu. + QAction* toggleAcceleratedCompositing = graphicsViewMenu->addAction("Toggle Accelerated Compositing", this, SLOT(toggleAcceleratedCompositing(bool))); + toggleAcceleratedCompositing->setCheckable(true); + toggleAcceleratedCompositing->setChecked(settings->testAttribute(QWebSettings::AcceleratedCompositingEnabled)); + toggleAcceleratedCompositing->setEnabled(isGraphicsBased()); + toggleAcceleratedCompositing->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); + + QAction* toggleResizesToContents = graphicsViewMenu->addAction("Toggle Resizes To Contents Mode", this, SLOT(toggleResizesToContents(bool))); + toggleResizesToContents->setCheckable(true); + toggleResizesToContents->setChecked(gResizesToContents); + toggleResizesToContents->setEnabled(isGraphicsBased()); + toggleResizesToContents->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); + + QAction* toggleTiledBackingStore = graphicsViewMenu->addAction("Toggle Tiled Backing Store", this, SLOT(toggleTiledBackingStore(bool))); + toggleTiledBackingStore->setCheckable(true); + toggleTiledBackingStore->setChecked(false); + toggleTiledBackingStore->setEnabled(isGraphicsBased()); + toggleTiledBackingStore->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); + +#if defined(QT_CONFIGURED_WITH_OPENGL) + QAction* toggleQGLWidgetViewport = graphicsViewMenu->addAction("Toggle use of QGLWidget Viewport", this, SLOT(toggleQGLWidgetViewport(bool))); + toggleQGLWidgetViewport->setCheckable(true); + toggleQGLWidgetViewport->setChecked(gUseQGLWidgetViewport); + toggleQGLWidgetViewport->setEnabled(isGraphicsBased()); + toggleQGLWidgetViewport->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); +#endif + + QMenu* viewportUpdateMenu = graphicsViewMenu->addMenu("Change Viewport Update Mode"); + viewportUpdateMenu->setEnabled(isGraphicsBased()); + viewportUpdateMenu->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); + + QAction* fullUpdate = viewportUpdateMenu->addAction("FullViewportUpdate"); + fullUpdate->setCheckable(true); + fullUpdate->setChecked((gViewportUpdateMode == QGraphicsView::FullViewportUpdate) ? true : false); + + QAction* minimalUpdate = viewportUpdateMenu->addAction("MinimalViewportUpdate"); + minimalUpdate->setCheckable(true); + minimalUpdate->setChecked((gViewportUpdateMode == QGraphicsView::MinimalViewportUpdate) ? true : false); + + QAction* smartUpdate = viewportUpdateMenu->addAction("SmartViewportUpdate"); + smartUpdate->setCheckable(true); + smartUpdate->setChecked((gViewportUpdateMode == QGraphicsView::SmartViewportUpdate) ? true : false); + + QAction* boundingRectUpdate = viewportUpdateMenu->addAction("BoundingRectViewportUpdate"); + boundingRectUpdate->setCheckable(true); + boundingRectUpdate->setChecked((gViewportUpdateMode == QGraphicsView::BoundingRectViewportUpdate) ? true : false); + + QAction* noUpdate = viewportUpdateMenu->addAction("NoViewportUpdate"); + noUpdate->setCheckable(true); + noUpdate->setChecked((gViewportUpdateMode == QGraphicsView::NoViewportUpdate) ? true : false); + + QSignalMapper* signalMapper = new QSignalMapper(viewportUpdateMenu); + signalMapper->setMapping(fullUpdate, QGraphicsView::FullViewportUpdate); + signalMapper->setMapping(minimalUpdate, QGraphicsView::MinimalViewportUpdate); + signalMapper->setMapping(smartUpdate, QGraphicsView::SmartViewportUpdate); + signalMapper->setMapping(boundingRectUpdate, QGraphicsView::BoundingRectViewportUpdate); + signalMapper->setMapping(noUpdate, QGraphicsView::NoViewportUpdate); + + connect(fullUpdate, SIGNAL(triggered()), signalMapper, SLOT(map())); + connect(minimalUpdate, SIGNAL(triggered()), signalMapper, SLOT(map())); + connect(smartUpdate, SIGNAL(triggered()), signalMapper, SLOT(map())); + connect(boundingRectUpdate, SIGNAL(triggered()), signalMapper, SLOT(map())); + connect(noUpdate, SIGNAL(triggered()), signalMapper, SLOT(map())); + + connect(signalMapper, SIGNAL(mapped(int)), this, SLOT(changeViewportUpdateMode(int))); + + QActionGroup* viewportUpdateModeActions = new QActionGroup(viewportUpdateMenu); + viewportUpdateModeActions->addAction(fullUpdate); + viewportUpdateModeActions->addAction(minimalUpdate); + viewportUpdateModeActions->addAction(smartUpdate); + viewportUpdateModeActions->addAction(boundingRectUpdate); + viewportUpdateModeActions->addAction(noUpdate); + + graphicsViewMenu->addSeparator(); + + m_flipAnimated = graphicsViewMenu->addAction("Animated Flip"); + m_flipAnimated->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); + m_flipAnimated->setEnabled(isGraphicsBased()); + + m_flipYAnimated = graphicsViewMenu->addAction("Animated Y-Flip"); + m_flipYAnimated->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); + m_flipYAnimated->setEnabled(isGraphicsBased()); + + if (isGraphicsBased()) { + WebViewGraphicsBased* view = static_cast<WebViewGraphicsBased*>(m_view); + connect(m_flipAnimated, SIGNAL(triggered()), view, SLOT(animatedFlip())); + connect(m_flipYAnimated, SIGNAL(triggered()), view, SLOT(animatedYFlip())); + } + + QAction* cloneWindow = graphicsViewMenu->addAction("Clone Window", this, SLOT(cloneWindow())); + cloneWindow->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); + cloneWindow->setEnabled(isGraphicsBased()); + + graphicsViewMenu->addSeparator(); + + QAction* showFPS = graphicsViewMenu->addAction("Show FPS", this, SLOT(showFPS(bool))); + showFPS->setCheckable(true); + showFPS->setEnabled(isGraphicsBased()); + showFPS->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); + showFPS->setChecked(gShowFrameRate); +} + +bool LauncherWindow::isGraphicsBased() const +{ + return bool(qobject_cast<QGraphicsView*>(m_view)); +} + +inline void applySetting(QWebSettings::WebAttribute type, QWebSettings* settings, QWebSettings* other, bool defaultValue) +{ + settings->setAttribute(type, other ? other->testAttribute(type) : defaultValue); +} + +void LauncherWindow::applyPrefs(LauncherWindow* source) +{ + QWebSettings* other = source ? source->page()->settings() : 0; + QWebSettings* settings = page()->settings(); + + applySetting(QWebSettings::AcceleratedCompositingEnabled, settings, other, gUseCompositing); + applySetting(QWebSettings::TiledBackingStoreEnabled, settings, other, gUseTiledBackingStore); + applySetting(QWebSettings::WebGLEnabled, settings, other, false); + applySetting(QWebSettings::FrameFlatteningEnabled, settings, other, gUseFrameFlattening); + + if (!isGraphicsBased()) + return; + + WebViewGraphicsBased* view = static_cast<WebViewGraphicsBased*>(m_view); + WebViewGraphicsBased* otherView = source ? qobject_cast<WebViewGraphicsBased*>(source->m_view) : 0; + + view->setViewportUpdateMode(otherView ? otherView->viewportUpdateMode() : gViewportUpdateMode); + view->setFrameRateMeasurementEnabled(otherView ? otherView->frameRateMeasurementEnabled() : gShowFrameRate); + + if (otherView) { + view->setItemCacheMode(otherView->itemCacheMode()); + view->setResizesToContents(otherView->resizesToContents()); + } else { + view->setItemCacheMode(gCacheWebView ? QGraphicsItem::DeviceCoordinateCache : QGraphicsItem::NoCache); + view->setResizesToContents(gResizesToContents); + } +} + +void LauncherWindow::keyPressEvent(QKeyEvent* event) +{ +#ifdef Q_WS_MAEMO_5 + switch (event->key()) { + case Qt::Key_F7: + zoomIn(); + event->accept(); + break; + case Qt::Key_F8: + zoomOut(); + event->accept(); + break; + } +#endif + MainWindow::keyPressEvent(event); +} + +void LauncherWindow::grabZoomKeys(bool grab) +{ +#ifdef Q_WS_MAEMO_5 + if (!winId()) { + qWarning("Can't grab keys unless we have a window id"); + return; + } + + Atom atom = XInternAtom(QX11Info::display(), "_HILDON_ZOOM_KEY_ATOM", False); + if (!atom) { + qWarning("Unable to obtain _HILDON_ZOOM_KEY_ATOM"); + return; + } + + unsigned long val = (grab) ? 1 : 0; + XChangeProperty(QX11Info::display(), winId(), atom, XA_INTEGER, 32, PropModeReplace, reinterpret_cast<unsigned char*>(&val), 1); +#endif +} + +#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) +void LauncherWindow::sendTouchEvent() +{ + if (m_touchPoints.isEmpty()) + return; + + QEvent::Type type = QEvent::TouchUpdate; + if (m_touchPoints.size() == 1) { + if (m_touchPoints[0].state() == Qt::TouchPointReleased) + type = QEvent::TouchEnd; + else if (m_touchPoints[0].state() == Qt::TouchPointPressed) + type = QEvent::TouchBegin; + } + + QTouchEvent touchEv(type); + touchEv.setTouchPoints(m_touchPoints); + QCoreApplication::sendEvent(page(), &touchEv); + + // After sending the event, remove all touchpoints that were released + if (m_touchPoints[0].state() == Qt::TouchPointReleased) + m_touchPoints.removeAt(0); + if (m_touchPoints.size() > 1 && m_touchPoints[1].state() == Qt::TouchPointReleased) + m_touchPoints.removeAt(1); +} +#endif // QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + +bool LauncherWindow::eventFilter(QObject* obj, QEvent* event) +{ + // If click pos is the bottom right corner (square with size defined by gExitClickArea) + // and the window is on FullScreen, the window must return to its original state. + if (event->type() == QEvent::MouseButtonRelease) { + QMouseEvent* ev = static_cast<QMouseEvent*>(event); + if (windowState() == Qt::WindowFullScreen + && ev->pos().x() > (width() - gExitClickArea) + && ev->pos().y() > (height() - gExitClickArea)) { + + emit enteredFullScreenMode(false); + } + } + +#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + if (!m_touchMocking) + return QObject::eventFilter(obj, event); + + if (event->type() == QEvent::MouseButtonPress + || event->type() == QEvent::MouseButtonRelease + || event->type() == QEvent::MouseButtonDblClick + || event->type() == QEvent::MouseMove) { + + QMouseEvent* ev = static_cast<QMouseEvent*>(event); + if (ev->type() == QEvent::MouseMove + && !(ev->buttons() & Qt::LeftButton)) + return false; + + QTouchEvent::TouchPoint touchPoint; + touchPoint.setState(Qt::TouchPointMoved); + if ((ev->type() == QEvent::MouseButtonPress + || ev->type() == QEvent::MouseButtonDblClick)) + touchPoint.setState(Qt::TouchPointPressed); + else if (ev->type() == QEvent::MouseButtonRelease) + touchPoint.setState(Qt::TouchPointReleased); + + touchPoint.setId(0); + touchPoint.setScreenPos(ev->globalPos()); + touchPoint.setPos(ev->pos()); + touchPoint.setPressure(1); + + // If the point already exists, update it. Otherwise create it. + if (m_touchPoints.size() > 0 && !m_touchPoints[0].id()) + m_touchPoints[0] = touchPoint; + else if (m_touchPoints.size() > 1 && !m_touchPoints[1].id()) + m_touchPoints[1] = touchPoint; + else + m_touchPoints.append(touchPoint); + + sendTouchEvent(); + } else if (event->type() == QEvent::KeyPress + && static_cast<QKeyEvent*>(event)->key() == Qt::Key_F + && static_cast<QKeyEvent*>(event)->modifiers() == Qt::ControlModifier) { + + // If the keyboard point is already pressed, release it. + // Otherwise create it and append to m_touchPoints. + if (m_touchPoints.size() > 0 && m_touchPoints[0].id() == 1) { + m_touchPoints[0].setState(Qt::TouchPointReleased); + sendTouchEvent(); + } else if (m_touchPoints.size() > 1 && m_touchPoints[1].id() == 1) { + m_touchPoints[1].setState(Qt::TouchPointReleased); + sendTouchEvent(); + } else { + QTouchEvent::TouchPoint touchPoint; + touchPoint.setState(Qt::TouchPointPressed); + touchPoint.setId(1); + touchPoint.setScreenPos(QCursor::pos()); + touchPoint.setPos(m_view->mapFromGlobal(QCursor::pos())); + touchPoint.setPressure(1); + m_touchPoints.append(touchPoint); + sendTouchEvent(); + + // After sending the event, change the touchpoint state to stationary + m_touchPoints.last().setState(Qt::TouchPointStationary); + } + } +#endif // QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + + return false; +} + +void LauncherWindow::loadStarted() +{ + m_view->setFocus(Qt::OtherFocusReason); +} + +void LauncherWindow::loadFinished() +{ + QUrl url = page()->mainFrame()->url(); + setAddressUrl(url.toString(QUrl::RemoveUserInfo)); + addCompleterEntry(url); +} + +void LauncherWindow::showLinkHover(const QString &link, const QString &toolTip) +{ +#ifndef Q_WS_MAEMO_5 + statusBar()->showMessage(link); +#endif +#ifndef QT_NO_TOOLTIP + if (!toolTip.isEmpty()) + QToolTip::showText(QCursor::pos(), toolTip); +#endif +} + +void LauncherWindow::zoomAnimationFinished() +{ + if (!isGraphicsBased()) + return; + QGraphicsWebView* view = static_cast<WebViewGraphicsBased*>(m_view)->graphicsWebView(); + view->setTiledBackingStoreFrozen(false); +} + +void LauncherWindow::applyZoom() +{ +#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + if (isGraphicsBased() && page()->settings()->testAttribute(QWebSettings::TiledBackingStoreEnabled)) { + QGraphicsWebView* view = static_cast<WebViewGraphicsBased*>(m_view)->graphicsWebView(); + view->setTiledBackingStoreFrozen(true); + if (!m_zoomAnimation) { + m_zoomAnimation = new QPropertyAnimation(view, "scale"); + m_zoomAnimation->setStartValue(view->scale()); + connect(m_zoomAnimation, SIGNAL(finished()), this, SLOT(zoomAnimationFinished())); + } else { + m_zoomAnimation->stop(); + m_zoomAnimation->setStartValue(m_zoomAnimation->currentValue()); + } + + m_zoomAnimation->setDuration(300); + m_zoomAnimation->setEndValue(qreal(m_currentZoom) / 100.); + m_zoomAnimation->start(); + return; + } +#endif + page()->mainFrame()->setZoomFactor(qreal(m_currentZoom) / 100.0); +} + +void LauncherWindow::zoomIn() +{ + int i = m_zoomLevels.indexOf(m_currentZoom); + Q_ASSERT(i >= 0); + if (i < m_zoomLevels.count() - 1) + m_currentZoom = m_zoomLevels[i + 1]; + + applyZoom(); +} + +void LauncherWindow::zoomOut() +{ + int i = m_zoomLevels.indexOf(m_currentZoom); + Q_ASSERT(i >= 0); + if (i > 0) + m_currentZoom = m_zoomLevels[i - 1]; + + applyZoom(); +} + +void LauncherWindow::resetZoom() +{ + m_currentZoom = 100; + page()->mainFrame()->setZoomFactor(1.0); +} + +void LauncherWindow::toggleZoomTextOnly(bool b) +{ + page()->settings()->setAttribute(QWebSettings::ZoomTextOnly, b); +} + +void LauncherWindow::print() +{ +#if !defined(QT_NO_PRINTER) + QPrintPreviewDialog dlg(this); + connect(&dlg, SIGNAL(paintRequested(QPrinter*)), + page()->mainFrame(), SLOT(print(QPrinter*))); + dlg.exec(); +#endif +} + +void LauncherWindow::screenshot() +{ + QPixmap pixmap = QPixmap::grabWidget(m_view); + QLabel* label = new QLabel; + label->setAttribute(Qt::WA_DeleteOnClose); + label->setWindowTitle("Screenshot - Preview"); + label->setPixmap(pixmap); + label->show(); + + QString fileName = QFileDialog::getSaveFileName(label, "Screenshot"); + if (!fileName.isEmpty()) { + pixmap.save(fileName, "png"); + label->setWindowTitle(QString("Screenshot - Saved at %1").arg(fileName)); + } +} + +void LauncherWindow::setEditable(bool on) +{ + page()->setContentEditable(on); + m_formatMenuAction->setVisible(on); +} + +/* +void LauncherWindow::dumpPlugins() { + QList<QWebPluginInfo> plugins = QWebSettings::pluginDatabase()->plugins(); + foreach (const QWebPluginInfo plugin, plugins) { + qDebug() << "Plugin:" << plugin.name(); + foreach (const QWebPluginInfo::MimeType mime, plugin.mimeTypes()) { + qDebug() << " " << mime.name; + } + } +} +*/ + +void LauncherWindow::dumpHtml() +{ + qDebug() << "HTML: " << page()->mainFrame()->toHtml(); +} + +void LauncherWindow::selectElements() +{ + bool ok; + QString str = QInputDialog::getText(this, "Select elements", "Choose elements", + QLineEdit::Normal, "a", &ok); + + if (ok && !str.isEmpty()) { + QWebElementCollection result = page()->mainFrame()->findAllElements(str); + foreach (QWebElement e, result) + e.setStyleProperty("background-color", "yellow"); +#ifndef Q_WS_MAEMO_5 + statusBar()->showMessage(QString("%1 element(s) selected").arg(result.count()), 5000); +#endif + } +} + +void LauncherWindow::setTouchMocking(bool on) +{ +#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + m_touchMocking = on; +#endif +} + +void LauncherWindow::toggleAcceleratedCompositing(bool toggle) +{ + gUseCompositing = toggle; + page()->settings()->setAttribute(QWebSettings::AcceleratedCompositingEnabled, toggle); +} + +void LauncherWindow::toggleTiledBackingStore(bool toggle) +{ + page()->settings()->setAttribute(QWebSettings::TiledBackingStoreEnabled, toggle); +} + +void LauncherWindow::toggleResizesToContents(bool toggle) +{ + gResizesToContents = toggle; + static_cast<WebViewGraphicsBased*>(m_view)->setResizesToContents(toggle); +} + +void LauncherWindow::toggleWebGL(bool toggle) +{ + page()->settings()->setAttribute(QWebSettings::WebGLEnabled, toggle); +} + +void LauncherWindow::toggleSpatialNavigation(bool b) +{ + page()->settings()->setAttribute(QWebSettings::SpatialNavigationEnabled, b); +} + +void LauncherWindow::toggleFullScreenMode(bool enable) +{ + if (enable) + setWindowState(Qt::WindowFullScreen); + else { +#if defined(Q_WS_S60) + setWindowState(Qt::WindowMaximized); +#else + setWindowState(Qt::WindowNoState); +#endif + } +} + +void LauncherWindow::toggleFrameFlattening(bool toggle) +{ + gUseFrameFlattening = toggle; + page()->settings()->setAttribute(QWebSettings::FrameFlatteningEnabled, toggle); +} + +void LauncherWindow::toggleInterruptingJavaScriptEnabled(bool enable) +{ + page()->setInterruptingJavaScriptEnabled(enable); +} + +void LauncherWindow::toggleJavascriptCanOpenWindows(bool enable) +{ + page()->settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, enable); +} + +#if defined(QT_CONFIGURED_WITH_OPENGL) +void LauncherWindow::toggleQGLWidgetViewport(bool enable) +{ + if (!isGraphicsBased()) + return; + + gUseQGLWidgetViewport = enable; + WebViewGraphicsBased* view = static_cast<WebViewGraphicsBased*>(m_view); + + view->setViewport(enable ? new QGLWidget() : 0); +} +#endif + +void LauncherWindow::changeViewportUpdateMode(int mode) +{ + gViewportUpdateMode = QGraphicsView::ViewportUpdateMode(mode); + + if (!isGraphicsBased()) + return; + + WebViewGraphicsBased* view = static_cast<WebViewGraphicsBased*>(m_view); + view->setViewportUpdateMode(gViewportUpdateMode); +} + +void LauncherWindow::showFPS(bool enable) +{ + if (!isGraphicsBased()) + return; + + gShowFrameRate = enable; + WebViewGraphicsBased* view = static_cast<WebViewGraphicsBased*>(m_view); + view->setFrameRateMeasurementEnabled(enable); + + if (!enable) { +#if defined(Q_WS_MAEMO_5) && defined(Q_WS_S60) + setWindowTitle(""); +#else + statusBar()->clearMessage(); +#endif + } +} + +void LauncherWindow::showUserAgentDialog() +{ + QStringList items; + QFile file(":/useragentlist.txt"); + if (file.open(QIODevice::ReadOnly)) { + while (!file.atEnd()) + items << file.readLine().trimmed(); + file.close(); + } + + QSettings settings; + QString customUserAgent = settings.value("CustomUserAgent").toString(); + if (!items.contains(customUserAgent) && !customUserAgent.isEmpty()) + items << customUserAgent; + + QDialog* dialog = new QDialog(this); + dialog->resize(size().width() * 0.7, dialog->size().height()); + dialog->setMaximumHeight(dialog->size().height()); + dialog->setWindowTitle("Change User Agent"); + + QVBoxLayout* layout = new QVBoxLayout(dialog); + dialog->setLayout(layout); + + QComboBox* combo = new QComboBox(dialog); + combo->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength); + combo->setEditable(true); + combo->insertItems(0, items); + layout->addWidget(combo); + + int index = combo->findText(page()->userAgentForUrl(QUrl())); + combo->setCurrentIndex(index); + + QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok + | QDialogButtonBox::Cancel, Qt::Horizontal, dialog); + connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept())); + connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject())); + layout->addWidget(buttonBox); + + if (dialog->exec() && !combo->currentText().isEmpty()) { + page()->setUserAgent(combo->currentText()); + if (!items.contains(combo->currentText())) + settings.setValue("CustomUserAgent", combo->currentText()); + } + + delete dialog; +} + +void LauncherWindow::updateFPS(int fps) +{ + QString fpsStatusText = QString("Current FPS: %1").arg(fps); + +#if defined(Q_WS_MAEMO_5) && defined(Q_WS_S60) + setWindowTitle(fpsStatusText); +#else + statusBar()->showMessage(fpsStatusText); +#endif +} + +LauncherWindow* LauncherWindow::newWindow() +{ + LauncherWindow* mw = new LauncherWindow(this, false); + mw->show(); + return mw; +} + +LauncherWindow* LauncherWindow::cloneWindow() +{ + LauncherWindow* mw = new LauncherWindow(this, true); + mw->show(); + return mw; +} + diff --git a/WebKitTools/QtTestBrowser/launcherwindow.h b/WebKitTools/QtTestBrowser/launcherwindow.h new file mode 100644 index 0000000..f9f157d --- /dev/null +++ b/WebKitTools/QtTestBrowser/launcherwindow.h @@ -0,0 +1,185 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2009 Girish Ramakrishnan <girish@forwardbias.in> + * Copyright (C) 2006 George Staikos <staikos@kde.org> + * Copyright (C) 2006 Dirk Mueller <mueller@kde.org> + * Copyright (C) 2006 Zack Rusin <zack@kde.org> + * Copyright (C) 2006 Simon Hausmann <hausmann@kde.org> + * + * 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 COMPUTER, 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. + */ + +#ifndef launcherwindow_h +#define launcherwindow_h + +#include <QtGui> +#include <QtNetwork/QNetworkRequest> + +#if defined(QT_CONFIGURED_WITH_OPENGL) +#include <QtOpenGL/QGLWidget> +#endif + +#if !defined(QT_NO_PRINTER) +#include <QPrintPreviewDialog> +#endif + +#ifndef QT_NO_UITOOLS +#include <QtUiTools/QUiLoader> +#endif + +#include <QDebug> + +#include <cstdio> +#include <qevent.h> +#include <qwebelement.h> +#include <qwebframe.h> +#include <qwebinspector.h> +#include <qwebsettings.h> + +#ifdef Q_WS_MAEMO_5 +#include <qx11info_x11.h> +#endif + +#include "mainwindow.h" +#include "urlloader.h" +#include "utils.h" +#include "webinspector.h" +#include "webpage.h" +#include "webview.h" +#include "../../WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h" + +#ifdef Q_WS_MAEMO_5 +#include <X11/Xatom.h> +#include <X11/Xlib.h> +#undef KeyPress +#endif + +class LauncherWindow : public MainWindow { + Q_OBJECT + +public: + LauncherWindow(LauncherWindow* other = 0, bool shareScene = false); + virtual ~LauncherWindow(); + + virtual void keyPressEvent(QKeyEvent* event); + void grabZoomKeys(bool grab); + +#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + void sendTouchEvent(); +#endif + + bool eventFilter(QObject* obj, QEvent* event); + +public: + static const int gExitClickArea = 80; + static bool gUseGraphicsView; + static bool gUseCompositing; + static bool gCacheWebView; + static bool gShowFrameRate; + static bool gResizesToContents; + static bool gUseTiledBackingStore; + static bool gUseFrameFlattening; + static QGraphicsView::ViewportUpdateMode gViewportUpdateMode; + static QUrl gInspectorUrl; + +#if defined(QT_CONFIGURED_WITH_OPENGL) + static bool gUseQGLWidgetViewport; +#endif + +protected slots: + void loadStarted(); + void loadFinished(); + + void showLinkHover(const QString &link, const QString &toolTip); + + void zoomIn(); + void zoomOut(); + void resetZoom(); + void toggleZoomTextOnly(bool on); + void zoomAnimationFinished(); + + void print(); + void screenshot(); + + void setEditable(bool on); + + /* void dumpPlugins() */ + void dumpHtml(); + + void initializeView(bool useGraphicsView = false); + + void setTouchMocking(bool on); + void toggleAcceleratedCompositing(bool toggle); + void toggleTiledBackingStore(bool toggle); + void toggleResizesToContents(bool toggle); + void toggleWebGL(bool toggle); + void toggleSpatialNavigation(bool b); + void toggleFullScreenMode(bool enable); + void toggleFrameFlattening(bool toggle); + void toggleInterruptingJavaScriptEnabled(bool enable); + void toggleJavascriptCanOpenWindows(bool enable); + +#if defined(QT_CONFIGURED_WITH_OPENGL) + void toggleQGLWidgetViewport(bool enable); +#endif + + void changeViewportUpdateMode(int mode); + void selectElements(); + void showFPS(bool enable); + void showUserAgentDialog(); + +public slots: + LauncherWindow* newWindow(); + LauncherWindow* cloneWindow(); + void updateFPS(int fps); + +signals: + void enteredFullScreenMode(bool on); + +private: + void init(bool useGraphicsView = false); + bool isGraphicsBased() const; + void createChrome(); + void applyPrefs(LauncherWindow* other = 0); + void applyZoom(); + +private: + QVector<int> m_zoomLevels; + int m_currentZoom; + + QWidget* m_view; + WebInspector* m_inspector; + + QAction* m_formatMenuAction; + QAction* m_flipAnimated; + QAction* m_flipYAnimated; + +#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + QPropertyAnimation* m_zoomAnimation; + QList<QTouchEvent::TouchPoint> m_touchPoints; + bool m_touchMocking; +#endif +}; + +#endif diff --git a/WebKitTools/QtTestBrowser/main.cpp b/WebKitTools/QtTestBrowser/main.cpp index 288472c..33a6416 100644 --- a/WebKitTools/QtTestBrowser/main.cpp +++ b/WebKitTools/QtTestBrowser/main.cpp @@ -30,1011 +30,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <QtGui> -#include <QtNetwork/QNetworkRequest> - -#if defined(QT_CONFIGURED_WITH_OPENGL) -#include <QtOpenGL/QGLWidget> -#endif - -#if !defined(QT_NO_PRINTER) -#include <QPrintPreviewDialog> -#endif - -#ifndef QT_NO_UITOOLS -#include <QtUiTools/QUiLoader> -#endif - -#include <QDebug> - -#include <cstdio> -#include <qevent.h> -#include <qwebelement.h> -#include <qwebframe.h> -#include <qwebinspector.h> -#include <qwebsettings.h> - -#ifdef Q_WS_MAEMO_5 -#include <qx11info_x11.h> -#endif - -#include "mainwindow.h" +#include "launcherwindow.h" #include "urlloader.h" -#include "utils.h" -#include "webinspector.h" -#include "webpage.h" -#include "webview.h" -#include "../../WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h" - -#ifdef Q_WS_MAEMO_5 -#include <X11/Xatom.h> -#include <X11/Xlib.h> -#undef KeyPress -#endif - -static const int gExitClickArea = 80; -static bool gUseGraphicsView = false; -static bool gUseCompositing = true; -static bool gCacheWebView = false; -static bool gShowFrameRate = false; -static QGraphicsView::ViewportUpdateMode gViewportUpdateMode = QGraphicsView::MinimalViewportUpdate; -static QUrl gInspectorUrl; -static bool gResizesToContents = false; -static bool gUseTiledBackingStore = false; - -#if defined(Q_WS_MAEMO_5) || defined(Q_WS_S60) -static bool gUseFrameFlattening = true; -#else -static bool gUseFrameFlattening = false; -#endif - -#if defined(QT_CONFIGURED_WITH_OPENGL) -static bool gUseQGLWidgetViewport = false; -#endif - -class LauncherWindow : public MainWindow { - Q_OBJECT - -public: - LauncherWindow(LauncherWindow* other = 0, bool shareScene = false); - virtual ~LauncherWindow(); - - virtual void keyPressEvent(QKeyEvent* event); - void grabZoomKeys(bool grab); - -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) - void sendTouchEvent(); -#endif - - bool eventFilter(QObject* obj, QEvent* event); - -protected slots: - void loadStarted(); - void loadFinished(); - - void showLinkHover(const QString &link, const QString &toolTip); - - void zoomIn(); - void zoomOut(); - void resetZoom(); - void toggleZoomTextOnly(bool on); - void zoomAnimationFinished(); - - void print(); - void screenshot(); - - void setEditable(bool on); - - /* void dumpPlugins() */ - void dumpHtml(); - - void selectElements(); - - void setTouchMocking(bool on); - void toggleAcceleratedCompositing(bool toggle); - void toggleTiledBackingStore(bool toggle); - void toggleResizesToContents(bool toggle); - - void toggleWebGL(bool toggle); - void initializeView(bool useGraphicsView = false); - void toggleSpatialNavigation(bool b); - void toggleFullScreenMode(bool enable); - void showFPS(bool enable); - void changeViewportUpdateMode(int mode); - void toggleFrameFlattening(bool toggle); - void toggleInterruptingJavaScriptEnabled(bool enable); - void toggleJavascriptCanOpenWindows(bool enable); - -#if defined(QT_CONFIGURED_WITH_OPENGL) - void toggleQGLWidgetViewport(bool enable); -#endif - - void showUserAgentDialog(); - -public slots: - LauncherWindow* newWindow(); - LauncherWindow* cloneWindow(); - void updateFPS(int fps); - -signals: - void enteredFullScreenMode(bool on); - -private: - void createChrome(); - void applyZoom(); - -private: - QVector<int> m_zoomLevels; - int m_currentZoom; - - QWidget* m_view; - WebInspector* m_inspector; - - QAction* m_formatMenuAction; - QAction* m_flipAnimated; - QAction* m_flipYAnimated; - -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) - QPropertyAnimation* m_zoomAnimation; - QList<QTouchEvent::TouchPoint> m_touchPoints; - bool m_touchMocking; -#endif - - void init(bool useGraphicsView = false); - bool isGraphicsBased() const; - void applyPrefs(LauncherWindow* other = 0); -}; - -LauncherWindow::LauncherWindow(LauncherWindow* other, bool shareScene) - : MainWindow() - , m_currentZoom(100) - , m_view(0) - , m_inspector(0) - , m_formatMenuAction(0) - , m_flipAnimated(0) - , m_flipYAnimated(0) -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) - , m_zoomAnimation(0) -#endif -{ - if (other) { - init(other->isGraphicsBased()); - applyPrefs(other); - if (shareScene && other->isGraphicsBased()) { - QGraphicsView* otherView = static_cast<QGraphicsView*>(other->m_view); - static_cast<QGraphicsView*>(m_view)->setScene(otherView->scene()); - } - } else { - init(gUseGraphicsView); - applyPrefs(); - } - - createChrome(); -} - -LauncherWindow::~LauncherWindow() -{ - grabZoomKeys(false); -} - -void LauncherWindow::init(bool useGraphicsView) -{ - QSplitter* splitter = new QSplitter(Qt::Vertical, this); - setCentralWidget(splitter); - -#if defined(Q_WS_S60) - setWindowState(Qt::WindowMaximized); -#else - setWindowState(Qt::WindowNoState); - resize(800, 600); -#endif - - initializeView(useGraphicsView); - - connect(page(), SIGNAL(loadStarted()), this, SLOT(loadStarted())); - connect(page(), SIGNAL(loadFinished(bool)), this, SLOT(loadFinished())); - connect(page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)), - this, SLOT(showLinkHover(const QString&, const QString&))); - connect(this, SIGNAL(enteredFullScreenMode(bool)), this, SLOT(toggleFullScreenMode(bool))); - - m_inspector = new WebInspector(splitter); -#ifndef QT_NO_PROPERTIES - if (!gInspectorUrl.isEmpty()) - m_inspector->setProperty("_q_inspectorUrl", gInspectorUrl); -#endif - m_inspector->setPage(page()); - m_inspector->hide(); - connect(this, SIGNAL(destroyed()), m_inspector, SLOT(deleteLater())); - - // the zoom values are chosen to be like in Mozilla Firefox 3 - m_zoomLevels << 30 << 50 << 67 << 80 << 90; - m_zoomLevels << 100; - m_zoomLevels << 110 << 120 << 133 << 150 << 170 << 200 << 240 << 300; - - grabZoomKeys(true); -} - -bool LauncherWindow::isGraphicsBased() const -{ - return bool(qobject_cast<QGraphicsView*>(m_view)); -} - -inline void applySetting(QWebSettings::WebAttribute type, QWebSettings* settings, QWebSettings* other, bool defaultValue) -{ - settings->setAttribute(type, other ? other->testAttribute(type) : defaultValue); -} - -void LauncherWindow::applyPrefs(LauncherWindow* source) -{ - QWebSettings* other = source ? source->page()->settings() : 0; - QWebSettings* settings = page()->settings(); - - applySetting(QWebSettings::AcceleratedCompositingEnabled, settings, other, gUseCompositing); - applySetting(QWebSettings::TiledBackingStoreEnabled, settings, other, gUseTiledBackingStore); - applySetting(QWebSettings::WebGLEnabled, settings, other, false); - applySetting(QWebSettings::FrameFlatteningEnabled, settings, other, gUseFrameFlattening); - - if (!isGraphicsBased()) - return; - - WebViewGraphicsBased* view = static_cast<WebViewGraphicsBased*>(m_view); - WebViewGraphicsBased* otherView = source ? qobject_cast<WebViewGraphicsBased*>(source->m_view) : 0; - - view->setViewportUpdateMode(otherView ? otherView->viewportUpdateMode() : gViewportUpdateMode); - view->setFrameRateMeasurementEnabled(otherView ? otherView->frameRateMeasurementEnabled() : gShowFrameRate); - - if (otherView) - view->setItemCacheMode(otherView->itemCacheMode()); - else - view->setItemCacheMode(gCacheWebView ? QGraphicsItem::DeviceCoordinateCache : QGraphicsItem::NoCache); -} - -void LauncherWindow::keyPressEvent(QKeyEvent* event) -{ -#ifdef Q_WS_MAEMO_5 - switch (event->key()) { - case Qt::Key_F7: - zoomIn(); - event->accept(); - break; - case Qt::Key_F8: - zoomOut(); - event->accept(); - break; - } -#endif - MainWindow::keyPressEvent(event); -} - -void LauncherWindow::grabZoomKeys(bool grab) -{ -#ifdef Q_WS_MAEMO_5 - if (!winId()) { - qWarning("Can't grab keys unless we have a window id"); - return; - } - - Atom atom = XInternAtom(QX11Info::display(), "_HILDON_ZOOM_KEY_ATOM", False); - if (!atom) { - qWarning("Unable to obtain _HILDON_ZOOM_KEY_ATOM"); - return; - } - - unsigned long val = (grab) ? 1 : 0; - XChangeProperty(QX11Info::display(), winId(), atom, XA_INTEGER, 32, PropModeReplace, reinterpret_cast<unsigned char*>(&val), 1); -#endif -} - -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) -void LauncherWindow::sendTouchEvent() -{ - if (m_touchPoints.isEmpty()) - return; - - QEvent::Type type = QEvent::TouchUpdate; - if (m_touchPoints.size() == 1) { - if (m_touchPoints[0].state() == Qt::TouchPointReleased) - type = QEvent::TouchEnd; - else if (m_touchPoints[0].state() == Qt::TouchPointPressed) - type = QEvent::TouchBegin; - } - - QTouchEvent touchEv(type); - touchEv.setTouchPoints(m_touchPoints); - QCoreApplication::sendEvent(page(), &touchEv); - - // After sending the event, remove all touchpoints that were released - if (m_touchPoints[0].state() == Qt::TouchPointReleased) - m_touchPoints.removeAt(0); - if (m_touchPoints.size() > 1 && m_touchPoints[1].state() == Qt::TouchPointReleased) - m_touchPoints.removeAt(1); -} -#endif // QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) - -bool LauncherWindow::eventFilter(QObject* obj, QEvent* event) -{ - // If click pos is the bottom right corner (square with size defined by gExitClickArea) - // and the window is on FullScreen, the window must return to its original state. - if (event->type() == QEvent::MouseButtonRelease) { - QMouseEvent* ev = static_cast<QMouseEvent*>(event); - if (windowState() == Qt::WindowFullScreen - && ev->pos().x() > (width() - gExitClickArea) - && ev->pos().y() > (height() - gExitClickArea)) { - - emit enteredFullScreenMode(false); - } - } - -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) - if (!m_touchMocking) - return QObject::eventFilter(obj, event); - - if (event->type() == QEvent::MouseButtonPress - || event->type() == QEvent::MouseButtonRelease - || event->type() == QEvent::MouseButtonDblClick - || event->type() == QEvent::MouseMove) { - - QMouseEvent* ev = static_cast<QMouseEvent*>(event); - if (ev->type() == QEvent::MouseMove - && !(ev->buttons() & Qt::LeftButton)) - return false; - - QTouchEvent::TouchPoint touchPoint; - touchPoint.setState(Qt::TouchPointMoved); - if ((ev->type() == QEvent::MouseButtonPress - || ev->type() == QEvent::MouseButtonDblClick)) - touchPoint.setState(Qt::TouchPointPressed); - else if (ev->type() == QEvent::MouseButtonRelease) - touchPoint.setState(Qt::TouchPointReleased); - - touchPoint.setId(0); - touchPoint.setScreenPos(ev->globalPos()); - touchPoint.setPos(ev->pos()); - touchPoint.setPressure(1); - - // If the point already exists, update it. Otherwise create it. - if (m_touchPoints.size() > 0 && !m_touchPoints[0].id()) - m_touchPoints[0] = touchPoint; - else if (m_touchPoints.size() > 1 && !m_touchPoints[1].id()) - m_touchPoints[1] = touchPoint; - else - m_touchPoints.append(touchPoint); - - sendTouchEvent(); - } else if (event->type() == QEvent::KeyPress - && static_cast<QKeyEvent*>(event)->key() == Qt::Key_F - && static_cast<QKeyEvent*>(event)->modifiers() == Qt::ControlModifier) { - - // If the keyboard point is already pressed, release it. - // Otherwise create it and append to m_touchPoints. - if (m_touchPoints.size() > 0 && m_touchPoints[0].id() == 1) { - m_touchPoints[0].setState(Qt::TouchPointReleased); - sendTouchEvent(); - } else if (m_touchPoints.size() > 1 && m_touchPoints[1].id() == 1) { - m_touchPoints[1].setState(Qt::TouchPointReleased); - sendTouchEvent(); - } else { - QTouchEvent::TouchPoint touchPoint; - touchPoint.setState(Qt::TouchPointPressed); - touchPoint.setId(1); - touchPoint.setScreenPos(QCursor::pos()); - touchPoint.setPos(m_view->mapFromGlobal(QCursor::pos())); - touchPoint.setPressure(1); - m_touchPoints.append(touchPoint); - sendTouchEvent(); - - // After sending the event, change the touchpoint state to stationary - m_touchPoints.last().setState(Qt::TouchPointStationary); - } - } -#endif // QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) - - return false; -} - -void LauncherWindow::loadStarted() -{ - m_view->setFocus(Qt::OtherFocusReason); -} - -void LauncherWindow::loadFinished() -{ - QUrl url = page()->mainFrame()->url(); - setAddressUrl(url.toString(QUrl::RemoveUserInfo)); - addCompleterEntry(url); -} - -void LauncherWindow::showLinkHover(const QString &link, const QString &toolTip) -{ -#ifndef Q_WS_MAEMO_5 - statusBar()->showMessage(link); -#endif -#ifndef QT_NO_TOOLTIP - if (!toolTip.isEmpty()) - QToolTip::showText(QCursor::pos(), toolTip); -#endif -} - -void LauncherWindow::zoomAnimationFinished() -{ - if (!isGraphicsBased()) - return; - QGraphicsWebView* view = static_cast<WebViewGraphicsBased*>(m_view)->graphicsWebView(); - view->setTiledBackingStoreFrozen(false); -} - -void LauncherWindow::applyZoom() -{ -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) - if (isGraphicsBased() && page()->settings()->testAttribute(QWebSettings::TiledBackingStoreEnabled)) { - QGraphicsWebView* view = static_cast<WebViewGraphicsBased*>(m_view)->graphicsWebView(); - view->setTiledBackingStoreFrozen(true); - if (!m_zoomAnimation) { - m_zoomAnimation = new QPropertyAnimation(view, "scale"); - m_zoomAnimation->setStartValue(view->scale()); - connect(m_zoomAnimation, SIGNAL(finished()), this, SLOT(zoomAnimationFinished())); - } else { - m_zoomAnimation->stop(); - m_zoomAnimation->setStartValue(m_zoomAnimation->currentValue()); - } - - m_zoomAnimation->setDuration(300); - m_zoomAnimation->setEndValue(qreal(m_currentZoom) / 100.); - m_zoomAnimation->start(); - return; - } -#endif - page()->mainFrame()->setZoomFactor(qreal(m_currentZoom) / 100.0); -} - -void LauncherWindow::zoomIn() -{ - int i = m_zoomLevels.indexOf(m_currentZoom); - Q_ASSERT(i >= 0); - if (i < m_zoomLevels.count() - 1) - m_currentZoom = m_zoomLevels[i + 1]; - - applyZoom(); -} - -void LauncherWindow::zoomOut() -{ - int i = m_zoomLevels.indexOf(m_currentZoom); - Q_ASSERT(i >= 0); - if (i > 0) - m_currentZoom = m_zoomLevels[i - 1]; - - applyZoom(); -} - -void LauncherWindow::resetZoom() -{ - m_currentZoom = 100; - page()->mainFrame()->setZoomFactor(1.0); -} - -void LauncherWindow::toggleZoomTextOnly(bool b) -{ - page()->settings()->setAttribute(QWebSettings::ZoomTextOnly, b); -} - -void LauncherWindow::print() -{ -#if !defined(QT_NO_PRINTER) - QPrintPreviewDialog dlg(this); - connect(&dlg, SIGNAL(paintRequested(QPrinter*)), - page()->mainFrame(), SLOT(print(QPrinter*))); - dlg.exec(); -#endif -} - -void LauncherWindow::screenshot() -{ - QPixmap pixmap = QPixmap::grabWidget(m_view); - QLabel* label = new QLabel; - label->setAttribute(Qt::WA_DeleteOnClose); - label->setWindowTitle("Screenshot - Preview"); - label->setPixmap(pixmap); - label->show(); - - QString fileName = QFileDialog::getSaveFileName(label, "Screenshot"); - if (!fileName.isEmpty()) { - pixmap.save(fileName, "png"); - label->setWindowTitle(QString("Screenshot - Saved at %1").arg(fileName)); - } -} - -void LauncherWindow::setEditable(bool on) -{ - page()->setContentEditable(on); - m_formatMenuAction->setVisible(on); -} - -/* -void LauncherWindow::dumpPlugins() { - QList<QWebPluginInfo> plugins = QWebSettings::pluginDatabase()->plugins(); - foreach (const QWebPluginInfo plugin, plugins) { - qDebug() << "Plugin:" << plugin.name(); - foreach (const QWebPluginInfo::MimeType mime, plugin.mimeTypes()) { - qDebug() << " " << mime.name; - } - } -} -*/ - -void LauncherWindow::dumpHtml() -{ - qDebug() << "HTML: " << page()->mainFrame()->toHtml(); -} - -void LauncherWindow::selectElements() -{ - bool ok; - QString str = QInputDialog::getText(this, "Select elements", "Choose elements", - QLineEdit::Normal, "a", &ok); - - if (ok && !str.isEmpty()) { - QWebElementCollection result = page()->mainFrame()->findAllElements(str); - foreach (QWebElement e, result) - e.setStyleProperty("background-color", "yellow"); -#ifndef Q_WS_MAEMO_5 - statusBar()->showMessage(QString("%1 element(s) selected").arg(result.count()), 5000); -#endif - } -} - -void LauncherWindow::setTouchMocking(bool on) -{ -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) - m_touchMocking = on; -#endif -} - -void LauncherWindow::toggleAcceleratedCompositing(bool toggle) -{ - gUseCompositing = toggle; - page()->settings()->setAttribute(QWebSettings::AcceleratedCompositingEnabled, toggle); -} - -void LauncherWindow::toggleTiledBackingStore(bool toggle) -{ - page()->settings()->setAttribute(QWebSettings::TiledBackingStoreEnabled, toggle); -} - -void LauncherWindow::toggleResizesToContents(bool toggle) -{ - static_cast<WebViewGraphicsBased*>(m_view)->setResizesToContents(toggle); -} - -void LauncherWindow::toggleWebGL(bool toggle) -{ - page()->settings()->setAttribute(QWebSettings::WebGLEnabled, toggle); -} - -void LauncherWindow::initializeView(bool useGraphicsView) -{ - delete m_view; - - QSplitter* splitter = static_cast<QSplitter*>(centralWidget()); - - if (!useGraphicsView) { - WebViewTraditional* view = new WebViewTraditional(splitter); - view->setPage(page()); - - view->installEventFilter(this); - - m_view = view; - } else { - WebViewGraphicsBased* view = new WebViewGraphicsBased(splitter); - view->setPage(page()); - - if (m_flipAnimated) - connect(m_flipAnimated, SIGNAL(triggered()), view, SLOT(animatedFlip())); - - if (m_flipYAnimated) - connect(m_flipYAnimated, SIGNAL(triggered()), view, SLOT(animatedYFlip())); - - connect(view, SIGNAL(currentFPSUpdated(int)), this, SLOT(updateFPS(int))); - - view->installEventFilter(this); - // The implementation of QAbstractScrollArea::eventFilter makes us need - // to install the event filter also on the viewport of a QGraphicsView. - view->viewport()->installEventFilter(this); - - m_view = view; - } - -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) - m_touchMocking = false; -#endif -} - -void LauncherWindow::toggleSpatialNavigation(bool b) -{ - page()->settings()->setAttribute(QWebSettings::SpatialNavigationEnabled, b); -} - -void LauncherWindow::toggleFullScreenMode(bool enable) -{ - if (enable) - setWindowState(Qt::WindowFullScreen); - else { -#if defined(Q_WS_S60) - setWindowState(Qt::WindowMaximized); -#else - setWindowState(Qt::WindowNoState); -#endif - } -} - -void LauncherWindow::showFPS(bool enable) -{ - if (!isGraphicsBased()) - return; - - gShowFrameRate = enable; - WebViewGraphicsBased* view = static_cast<WebViewGraphicsBased*>(m_view); - view->setFrameRateMeasurementEnabled(enable); - - if (!enable) { -#if defined(Q_WS_MAEMO_5) && defined(Q_WS_S60) - setWindowTitle(""); -#else - statusBar()->clearMessage(); -#endif - } -} - -void LauncherWindow::changeViewportUpdateMode(int mode) -{ - gViewportUpdateMode = QGraphicsView::ViewportUpdateMode(mode); - - if (!isGraphicsBased()) - return; - - WebViewGraphicsBased* view = static_cast<WebViewGraphicsBased*>(m_view); - view->setViewportUpdateMode(gViewportUpdateMode); -} - -void LauncherWindow::toggleFrameFlattening(bool toggle) -{ - gUseFrameFlattening = toggle; - page()->settings()->setAttribute(QWebSettings::FrameFlatteningEnabled, toggle); -} - -void LauncherWindow::toggleInterruptingJavaScriptEnabled(bool enable) -{ - page()->setInterruptingJavaScriptEnabled(enable); -} - -void LauncherWindow::toggleJavascriptCanOpenWindows(bool enable) -{ - page()->settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, enable); -} - -#if defined(QT_CONFIGURED_WITH_OPENGL) -void LauncherWindow::toggleQGLWidgetViewport(bool enable) -{ - if (!isGraphicsBased()) - return; - - gUseQGLWidgetViewport = enable; - WebViewGraphicsBased* view = static_cast<WebViewGraphicsBased*>(m_view); - - view->setViewport(enable ? new QGLWidget() : 0); -} -#endif - -void LauncherWindow::showUserAgentDialog() -{ - QStringList items; - QFile file(":/useragentlist.txt"); - if (file.open(QIODevice::ReadOnly)) { - while (!file.atEnd()) - items << file.readLine().trimmed(); - file.close(); - } - - QSettings settings; - QString customUserAgent = settings.value("CustomUserAgent").toString(); - if (!items.contains(customUserAgent) && !customUserAgent.isEmpty()) - items << customUserAgent; - - QDialog* dialog = new QDialog(this); - dialog->resize(size().width() * 0.7, dialog->size().height()); - dialog->setMaximumHeight(dialog->size().height()); - dialog->setWindowTitle("Change User Agent"); - - QVBoxLayout* layout = new QVBoxLayout(dialog); - dialog->setLayout(layout); - - QComboBox* combo = new QComboBox(dialog); - combo->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength); - combo->setEditable(true); - combo->insertItems(0, items); - layout->addWidget(combo); - - int index = combo->findText(page()->userAgentForUrl(QUrl())); - combo->setCurrentIndex(index); - - QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok - | QDialogButtonBox::Cancel, Qt::Horizontal, dialog); - connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept())); - connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject())); - layout->addWidget(buttonBox); - - if (dialog->exec() && !combo->currentText().isEmpty()) { - page()->setUserAgent(combo->currentText()); - if (!items.contains(combo->currentText())) - settings.setValue("CustomUserAgent", combo->currentText()); - } - - delete dialog; -} - -LauncherWindow* LauncherWindow::newWindow() -{ - LauncherWindow* mw = new LauncherWindow(this, false); - mw->show(); - return mw; -} - -LauncherWindow* LauncherWindow::cloneWindow() -{ - LauncherWindow* mw = new LauncherWindow(this, true); - mw->show(); - return mw; -} - -void LauncherWindow::updateFPS(int fps) -{ - QString fpsStatusText = QString("Current FPS: %1").arg(fps); - -#if defined(Q_WS_MAEMO_5) && defined(Q_WS_S60) - setWindowTitle(fpsStatusText); -#else - statusBar()->showMessage(fpsStatusText); -#endif -} - -void LauncherWindow::createChrome() -{ - QMenu* fileMenu = menuBar()->addMenu("&File"); - fileMenu->addAction("New Window", this, SLOT(newWindow()), QKeySequence::New); - fileMenu->addAction(tr("Open File..."), this, SLOT(openFile()), QKeySequence::Open); - fileMenu->addAction(tr("Open Location..."), this, SLOT(openLocation()), QKeySequence(Qt::CTRL | Qt::Key_L)); - fileMenu->addAction("Close Window", this, SLOT(close()), QKeySequence::Close); - fileMenu->addSeparator(); - fileMenu->addAction("Take Screen Shot...", this, SLOT(screenshot())); - fileMenu->addAction(tr("Print..."), this, SLOT(print()), QKeySequence::Print); - fileMenu->addSeparator(); - fileMenu->addAction("Quit", QApplication::instance(), SLOT(closeAllWindows()), QKeySequence(Qt::CTRL | Qt::Key_Q)); - - QMenu* editMenu = menuBar()->addMenu("&Edit"); - editMenu->addAction(page()->action(QWebPage::Undo)); - editMenu->addAction(page()->action(QWebPage::Redo)); - editMenu->addSeparator(); - editMenu->addAction(page()->action(QWebPage::Cut)); - editMenu->addAction(page()->action(QWebPage::Copy)); - editMenu->addAction(page()->action(QWebPage::Paste)); - editMenu->addSeparator(); - QAction* setEditable = editMenu->addAction("Set Editable", this, SLOT(setEditable(bool))); - setEditable->setCheckable(true); - - QMenu* viewMenu = menuBar()->addMenu("&View"); - viewMenu->addAction(page()->action(QWebPage::Stop)); - viewMenu->addAction(page()->action(QWebPage::Reload)); - viewMenu->addSeparator(); - QAction* zoomIn = viewMenu->addAction("Zoom &In", this, SLOT(zoomIn())); - QAction* zoomOut = viewMenu->addAction("Zoom &Out", this, SLOT(zoomOut())); - QAction* resetZoom = viewMenu->addAction("Reset Zoom", this, SLOT(resetZoom())); - QAction* zoomTextOnly = viewMenu->addAction("Zoom Text Only", this, SLOT(toggleZoomTextOnly(bool))); - zoomTextOnly->setCheckable(true); - zoomTextOnly->setChecked(false); - viewMenu->addSeparator(); - viewMenu->addAction("Dump HTML", this, SLOT(dumpHtml())); - // viewMenu->addAction("Dump plugins", this, SLOT(dumpPlugins())); - - QMenu* formatMenu = new QMenu("F&ormat", this); - m_formatMenuAction = menuBar()->addMenu(formatMenu); - m_formatMenuAction->setVisible(false); - formatMenu->addAction(page()->action(QWebPage::ToggleBold)); - formatMenu->addAction(page()->action(QWebPage::ToggleItalic)); - formatMenu->addAction(page()->action(QWebPage::ToggleUnderline)); - QMenu* writingMenu = formatMenu->addMenu(tr("Writing Direction")); - writingMenu->addAction(page()->action(QWebPage::SetTextDirectionDefault)); - writingMenu->addAction(page()->action(QWebPage::SetTextDirectionLeftToRight)); - writingMenu->addAction(page()->action(QWebPage::SetTextDirectionRightToLeft)); - - zoomIn->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Plus)); - zoomOut->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Minus)); - resetZoom->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_0)); - - QMenu* windowMenu = menuBar()->addMenu("&Window"); - QAction* toggleFullScreen = windowMenu->addAction("Toggle FullScreen", this, SIGNAL(enteredFullScreenMode(bool))); - toggleFullScreen->setCheckable(true); - toggleFullScreen->setChecked(false); - - // when exit fullscreen mode by clicking on the exit area (bottom right corner) we must - // uncheck the Toggle FullScreen action - toggleFullScreen->connect(this, SIGNAL(enteredFullScreenMode(bool)), SLOT(setChecked(bool))); - - QMenu* toolsMenu = menuBar()->addMenu("&Develop"); - - QWebSettings* settings = page()->settings(); - - QMenu* graphicsViewMenu = toolsMenu->addMenu("QGraphicsView"); - QAction* toggleGraphicsView = graphicsViewMenu->addAction("Toggle use of QGraphicsView", this, SLOT(initializeView(bool))); - toggleGraphicsView->setCheckable(true); - toggleGraphicsView->setChecked(isGraphicsBased()); - - QAction* toggleWebGL = toolsMenu->addAction("Toggle WebGL", this, SLOT(toggleWebGL(bool))); - toggleWebGL->setCheckable(true); - toggleWebGL->setChecked(settings->testAttribute(QWebSettings::WebGLEnabled)); - - QAction* spatialNavigationAction = toolsMenu->addAction("Toggle Spatial Navigation", this, SLOT(toggleSpatialNavigation(bool))); - spatialNavigationAction->setCheckable(true); - spatialNavigationAction->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_S)); - - QAction* toggleFrameFlattening = toolsMenu->addAction("Toggle Frame Flattening", this, SLOT(toggleFrameFlattening(bool))); - toggleFrameFlattening->setCheckable(true); - toggleFrameFlattening->setChecked(settings->testAttribute(QWebSettings::FrameFlatteningEnabled)); - -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) - QAction* touchMockAction = toolsMenu->addAction("Toggle multitouch mocking", this, SLOT(setTouchMocking(bool))); - touchMockAction->setCheckable(true); - touchMockAction->setShortcut(QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_T)); -#endif - - toolsMenu->addSeparator(); - - QAction* toggleInterruptingJavaScripteEnabled = toolsMenu->addAction("Enable interrupting js scripts", this, SLOT(toggleInterruptingJavaScriptEnabled(bool))); - toggleInterruptingJavaScripteEnabled->setCheckable(true); - toggleInterruptingJavaScripteEnabled->setChecked(false); - - QAction* toggleJavascriptCanOpenWindows = toolsMenu->addAction("Enable js popup windows", this, SLOT(toggleJavascriptCanOpenWindows(bool))); - toggleJavascriptCanOpenWindows->setCheckable(true); - toggleJavascriptCanOpenWindows->setChecked(false); - - toolsMenu->addSeparator(); - - QAction* userAgentAction = toolsMenu->addAction("Change User Agent", this, SLOT(showUserAgentDialog())); - userAgentAction->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_U)); - - toolsMenu->addAction("Select Elements...", this, SLOT(selectElements())); - - QAction* showInspectorAction = toolsMenu->addAction("Show Web Inspector", m_inspector, SLOT(setVisible(bool)), QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_I)); - showInspectorAction->setCheckable(true); - showInspectorAction->connect(m_inspector, SIGNAL(visibleChanged(bool)), SLOT(setChecked(bool))); - - // GraphicsView sub menu. - QAction* toggleAcceleratedCompositing = graphicsViewMenu->addAction("Toggle Accelerated Compositing", this, SLOT(toggleAcceleratedCompositing(bool))); - toggleAcceleratedCompositing->setCheckable(true); - toggleAcceleratedCompositing->setChecked(settings->testAttribute(QWebSettings::AcceleratedCompositingEnabled)); - toggleAcceleratedCompositing->setEnabled(isGraphicsBased()); - toggleAcceleratedCompositing->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); - - QAction* toggleResizesToContents = graphicsViewMenu->addAction("Toggle Resizes To Contents Mode", this, SLOT(toggleResizesToContents(bool))); - toggleResizesToContents->setCheckable(true); - toggleResizesToContents->setChecked(false); - toggleResizesToContents->setEnabled(isGraphicsBased()); - toggleResizesToContents->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); - - QAction* toggleTiledBackingStore = graphicsViewMenu->addAction("Toggle Tiled Backing Store", this, SLOT(toggleTiledBackingStore(bool))); - toggleTiledBackingStore->setCheckable(true); - toggleTiledBackingStore->setChecked(false); - toggleTiledBackingStore->setEnabled(isGraphicsBased()); - toggleTiledBackingStore->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); - -#if defined(QT_CONFIGURED_WITH_OPENGL) - QAction* toggleQGLWidgetViewport = graphicsViewMenu->addAction("Toggle use of QGLWidget Viewport", this, SLOT(toggleQGLWidgetViewport(bool))); - toggleQGLWidgetViewport->setCheckable(true); - toggleQGLWidgetViewport->setChecked(gUseQGLWidgetViewport); - toggleQGLWidgetViewport->setEnabled(isGraphicsBased()); - toggleQGLWidgetViewport->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); -#endif - - QMenu* viewportUpdateMenu = graphicsViewMenu->addMenu("Change Viewport Update Mode"); - viewportUpdateMenu->setEnabled(isGraphicsBased()); - viewportUpdateMenu->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); - - QAction* fullUpdate = viewportUpdateMenu->addAction("FullViewportUpdate"); - fullUpdate->setCheckable(true); - fullUpdate->setChecked((gViewportUpdateMode == QGraphicsView::FullViewportUpdate) ? true : false); - - QAction* minimalUpdate = viewportUpdateMenu->addAction("MinimalViewportUpdate"); - minimalUpdate->setCheckable(true); - minimalUpdate->setChecked((gViewportUpdateMode == QGraphicsView::MinimalViewportUpdate) ? true : false); - - QAction* smartUpdate = viewportUpdateMenu->addAction("SmartViewportUpdate"); - smartUpdate->setCheckable(true); - smartUpdate->setChecked((gViewportUpdateMode == QGraphicsView::SmartViewportUpdate) ? true : false); - - QAction* boundingRectUpdate = viewportUpdateMenu->addAction("BoundingRectViewportUpdate"); - boundingRectUpdate->setCheckable(true); - boundingRectUpdate->setChecked((gViewportUpdateMode == QGraphicsView::BoundingRectViewportUpdate) ? true : false); - - QAction* noUpdate = viewportUpdateMenu->addAction("NoViewportUpdate"); - noUpdate->setCheckable(true); - noUpdate->setChecked((gViewportUpdateMode == QGraphicsView::NoViewportUpdate) ? true : false); - - QSignalMapper* signalMapper = new QSignalMapper(viewportUpdateMenu); - signalMapper->setMapping(fullUpdate, QGraphicsView::FullViewportUpdate); - signalMapper->setMapping(minimalUpdate, QGraphicsView::MinimalViewportUpdate); - signalMapper->setMapping(smartUpdate, QGraphicsView::SmartViewportUpdate); - signalMapper->setMapping(boundingRectUpdate, QGraphicsView::BoundingRectViewportUpdate); - signalMapper->setMapping(noUpdate, QGraphicsView::NoViewportUpdate); - - connect(fullUpdate, SIGNAL(triggered()), signalMapper, SLOT(map())); - connect(minimalUpdate, SIGNAL(triggered()), signalMapper, SLOT(map())); - connect(smartUpdate, SIGNAL(triggered()), signalMapper, SLOT(map())); - connect(boundingRectUpdate, SIGNAL(triggered()), signalMapper, SLOT(map())); - connect(noUpdate, SIGNAL(triggered()), signalMapper, SLOT(map())); - - connect(signalMapper, SIGNAL(mapped(int)), this, SLOT(changeViewportUpdateMode(int))); - - QActionGroup* viewportUpdateModeActions = new QActionGroup(viewportUpdateMenu); - viewportUpdateModeActions->addAction(fullUpdate); - viewportUpdateModeActions->addAction(minimalUpdate); - viewportUpdateModeActions->addAction(smartUpdate); - viewportUpdateModeActions->addAction(boundingRectUpdate); - viewportUpdateModeActions->addAction(noUpdate); - - graphicsViewMenu->addSeparator(); - - m_flipAnimated = graphicsViewMenu->addAction("Animated Flip"); - m_flipAnimated->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); - m_flipAnimated->setEnabled(isGraphicsBased()); - - m_flipYAnimated = graphicsViewMenu->addAction("Animated Y-Flip"); - m_flipYAnimated->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); - m_flipYAnimated->setEnabled(isGraphicsBased()); - - if (isGraphicsBased()) { - WebViewGraphicsBased* view = static_cast<WebViewGraphicsBased*>(m_view); - connect(m_flipAnimated, SIGNAL(triggered()), view, SLOT(animatedFlip())); - connect(m_flipYAnimated, SIGNAL(triggered()), view, SLOT(animatedYFlip())); - } - - QAction* cloneWindow = graphicsViewMenu->addAction("Clone Window", this, SLOT(cloneWindow())); - cloneWindow->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); - cloneWindow->setEnabled(isGraphicsBased()); - - graphicsViewMenu->addSeparator(); - - QAction* showFPS = graphicsViewMenu->addAction("Show FPS", this, SLOT(showFPS(bool))); - showFPS->setCheckable(true); - showFPS->setEnabled(isGraphicsBased()); - showFPS->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); - showFPS->setChecked(gShowFrameRate); -} - -QWebPage* WebPage::createWindow(QWebPage::WebWindowType type) -{ - LauncherWindow* mw = new LauncherWindow; - if (type == WebModalDialog) - mw->setWindowModality(Qt::ApplicationModal); - mw->show(); - return mw->page(); -} - -QObject* WebPage::createPlugin(const QString &classId, const QUrl&, const QStringList&, const QStringList&) -{ - if (classId == "alien_QLabel") { - QLabel* l = new QLabel; - l->winId(); - return l; - } - -#ifndef QT_NO_UITOOLS - QUiLoader loader; - return loader.createWidget(classId, view()); -#else - Q_UNUSED(classId); - return 0; -#endif -} - int launcherMain(const QApplication& app) { @@ -1092,7 +89,7 @@ LauncherApplication::LauncherApplication(int& argc, char** argv) static void requiresGraphicsView(const QString& option) { - if (gUseGraphicsView) + if (LauncherWindow::gUseGraphicsView) return; appQuit(1, QString("%1 only works in combination with the -graphicsbased option").arg(option)); } @@ -1124,31 +121,31 @@ void LauncherApplication::handleUserOptions() } if (args.contains("-graphicsbased")) - gUseGraphicsView = true; + LauncherWindow::gUseGraphicsView = true; if (args.contains("-no-compositing")) { requiresGraphicsView("-no-compositing"); - gUseCompositing = false; + LauncherWindow::gUseCompositing = false; } if (args.contains("-show-fps")) { requiresGraphicsView("-show-fps"); - gShowFrameRate = true; + LauncherWindow::gShowFrameRate = true; } if (args.contains("-cache-webview")) { requiresGraphicsView("-cache-webview"); - gCacheWebView = true; + LauncherWindow::gCacheWebView = true; } if (args.contains("-tiled-backing-store")) { requiresGraphicsView("-tiled-backing-store"); - gUseTiledBackingStore = true; + LauncherWindow::gUseTiledBackingStore = true; } if (args.contains("-resizes-to-contents")) { requiresGraphicsView("-resizes-to-contents"); - gResizesToContents = true; + LauncherWindow::gResizesToContents = true; } QString arg1("-viewport-update-mode"); @@ -1163,13 +160,13 @@ void LauncherApplication::handleUserOptions() if (idx == -1) appQuit(1, QString("%1 value has to be one of [%2]").arg(arg1).arg(formatKeys(updateModes))); - gViewportUpdateMode = static_cast<QGraphicsView::ViewportUpdateMode>(idx); + LauncherWindow::gViewportUpdateMode = static_cast<QGraphicsView::ViewportUpdateMode>(idx); } QString inspectorUrlArg("-inspector-url"); int inspectorUrlIndex = args.indexOf(inspectorUrlArg); if (inspectorUrlIndex != -1) - gInspectorUrl = takeOptionValue(&args, inspectorUrlIndex); + LauncherWindow::gInspectorUrl = takeOptionValue(&args, inspectorUrlIndex); int robotIndex = args.indexOf("-r"); if (robotIndex != -1) { diff --git a/WebKitTools/QtTestBrowser/webpage.cpp b/WebKitTools/QtTestBrowser/webpage.cpp index ee0232b..137c65c 100644 --- a/WebKitTools/QtTestBrowser/webpage.cpp +++ b/WebKitTools/QtTestBrowser/webpage.cpp @@ -32,6 +32,8 @@ #include "webpage.h" +#include "launcherwindow.h" + #include <QAuthenticator> #include <QDesktopServices> #include <QtGui> @@ -185,3 +187,30 @@ void WebPage::checkPermission(QWebFrame* frame, QWebPage::PermissionDomain domai void WebPage::cancelRequestsForPermission(QWebFrame*, QWebPage::PermissionDomain) { } + +QWebPage* WebPage::createWindow(QWebPage::WebWindowType type) +{ + LauncherWindow* mw = new LauncherWindow; + if (type == WebModalDialog) + mw->setWindowModality(Qt::ApplicationModal); + mw->show(); + return mw->page(); +} + +QObject* WebPage::createPlugin(const QString &classId, const QUrl&, const QStringList&, const QStringList&) +{ + if (classId == "alien_QLabel") { + QLabel* l = new QLabel; + l->winId(); + return l; + } + +#ifndef QT_NO_UITOOLS + QUiLoader loader; + return loader.createWidget(classId, view()); +#else + Q_UNUSED(classId); + return 0; +#endif +} + diff --git a/WebKitTools/QtTestBrowser/webview.h b/WebKitTools/QtTestBrowser/webview.h index 30161bb..9b533b3 100644 --- a/WebKitTools/QtTestBrowser/webview.h +++ b/WebKitTools/QtTestBrowser/webview.h @@ -82,6 +82,7 @@ public: virtual void paintEvent(QPaintEvent* event); void setResizesToContents(bool b); + bool resizesToContents() const { return m_resizesToContents; } void setYRotation(qreal angle) { diff --git a/WebKitTools/Scripts/build-webkit b/WebKitTools/Scripts/build-webkit index 21214cc..4639949 100755 --- a/WebKitTools/Scripts/build-webkit +++ b/WebKitTools/Scripts/build-webkit @@ -61,7 +61,7 @@ my ($linkPrefetchSupport, $threeDCanvasSupport, $threeDRenderingSupport, $channe $svgSupport, $svgAnimationSupport, $svgAsImageSupport, $svgDOMObjCBindingsSupport, $svgFontsSupport, $svgForeignObjectSupport, $svgUseSupport, $videoSupport, $webSocketsSupport, $webTimingSupport, $wmlSupport, $wcssSupport, $xhtmlmpSupport, $workersSupport, $xpathSupport, $xsltSupport, $coverageSupport, $notificationsSupport, $blobSliceSupport, $tiledBackingStoreSupport, - $fileReaderSupport, $fileWriterSupport, $fileSystemSupport, $directoryUploadSupport); + $fileReaderSupport, $fileWriterSupport, $fileSystemSupport, $directoryUploadSupport, $deviceOrientationSupport); my @features = ( { option => "link-prefetch", desc => "Toggle pre fetching support", @@ -204,6 +204,9 @@ my @features = ( { option => "file-system", desc => "Toggle FileSystem support", define => "ENABLE_FILE_SYSTEM", default => 0, value => \$fileSystemSupport }, + + { option => "device-orientation", desc => "Toggle DeviceOrientation support", + define => "ENABLE_DEVICE_ORIENTATION", default => 0, value => \$deviceOrientationSupport }, ); # Update defaults from Qt's project file diff --git a/WebKitTools/Scripts/find-included-framework-headers b/WebKitTools/Scripts/find-included-framework-headers index 3e7aaf6..759a60b 100755 --- a/WebKitTools/Scripts/find-included-framework-headers +++ b/WebKitTools/Scripts/find-included-framework-headers @@ -1,10 +1,30 @@ #!/bin/sh - -FILE_EXTENSIONS_TO_SEARCH="cpp h m mm" +# Copyright (C) 2007, 2008, 2009, 2010 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. +# +# A script to find headers included from the given frameworks by files in the +# current directory (and subdirectories). for framework in $*; do echo -e "\n$framework\n==================" - for ext in ${FILE_EXTENSIONS_TO_SEARCH}; do - find . -name "*.$ext" -exec grep $framework {} ';' | grep '\(include\|import\)' | sed -e 's|.*/\(.*\.h\).*|\1|' - done | sort | uniq + find . \( -name '*.cpp' -o -name '*.h' -o -name '*.m' -o -name '*.mm' \) -exec grep "<$framework/" {} ';' | sed -e 's|.*/\(.*\.h\).*|\1|' | sort -u done diff --git a/WebKitTools/Scripts/old-run-webkit-tests b/WebKitTools/Scripts/old-run-webkit-tests index af82545..b46c129 100755 --- a/WebKitTools/Scripts/old-run-webkit-tests +++ b/WebKitTools/Scripts/old-run-webkit-tests @@ -298,7 +298,7 @@ Usage: $programName [options] [testdir|testpath ...] -v|--verbose More verbose output (overrides --quiet) -m|--merge-leak-depth arg Merges leak callStacks and prints the number of unique leaks beneath a callstack depth of arg. Defaults to 5. --use-remote-links-to-tests Link to test files within the SVN repository in the results. - --webkit-test-runner Use WebKitTestRunner rather than DumpRenderTree. + -2|--webkit-test-runner Use WebKitTestRunner rather than DumpRenderTree. EOF setConfiguration(); @@ -342,7 +342,7 @@ my $getOptionsResult = GetOptions( 'use-remote-links-to-tests' => \$useRemoteLinksToTests, 'valgrind' => \$useValgrind, 'verbose|v' => \$verbose, - 'webkit-test-runner' => \$useWebKitTestRunner, + 'webkit-test-runner|2' => \$useWebKitTestRunner, ); if (!$getOptionsResult || $showHelp) { @@ -354,6 +354,9 @@ if ($useWebKitTestRunner) { if (isAppleMacWebKit()) { $realPlatform = $platform; $platform = "mac-wk2"; + } elsif (isAppleWinWebKit()) { + $realPlatform = $platform; + $platform = "win-wk2"; } } @@ -1895,8 +1898,8 @@ sub buildPlatformResultHierarchy() my $isWin = $platform =~ /^win/; if ($isMac || $isWin) { my $effectivePlatform = $platform; - if ($platform eq "mac-wk2") { - push @platforms, "mac-wk2"; + if ($platform eq "mac-wk2" || $platform eq "win-wk2") { + push @platforms, $platform; $effectivePlatform = $realPlatform; } diff --git a/WebKitTools/Scripts/webkitdirs.pm b/WebKitTools/Scripts/webkitdirs.pm index 745e808..028d63d 100644 --- a/WebKitTools/Scripts/webkitdirs.pm +++ b/WebKitTools/Scripts/webkitdirs.pm @@ -1418,6 +1418,8 @@ sub buildQMakeProject($@) print "Generating derived sources\n\n"; + push @buildArgs, "OUTPUT_DIR=" . baseProductDir() . "/$config"; + my @dsQmakeArgs = @buildArgs; push @dsQmakeArgs, "-r"; push @dsQmakeArgs, sourceDir() . "/DerivedSources.pro"; @@ -1431,7 +1433,12 @@ sub buildQMakeProject($@) my $dsMakefile = "Makefile.DerivedSources"; # Iterate over different source directories manually to workaround a problem with qmake+extraTargets+s60 - for my $subdir ("JavaScriptCore", "WebCore", "WebKit/qt/Api") { + my @subdirs = ("JavaScriptCore", "WebCore", "WebKit/qt/Api"); + if (grep { $_ eq "CONFIG+=webkit2"} @buildArgs) { + push @subdirs, "WebKit2"; + } + + for my $subdir (@subdirs) { print "Calling '$make $makeargs -f $dsMakefile generated_files' in " . $dir . "/$subdir\n\n"; if ($make eq "nmake") { my $subdirWindows = $subdir; @@ -1445,7 +1452,6 @@ sub buildQMakeProject($@) } } - push @buildArgs, "OUTPUT_DIR=" . baseProductDir() . "/$config"; push @buildArgs, sourceDir() . "/WebKit.pro"; if ($config =~ m/debug/i) { push @buildArgs, "CONFIG-=release"; diff --git a/WebKitTools/Scripts/webkitpy/common/config/committers.py b/WebKitTools/Scripts/webkitpy/common/config/committers.py index 0354981..25b1725 100644 --- a/WebKitTools/Scripts/webkitpy/common/config/committers.py +++ b/WebKitTools/Scripts/webkitpy/common/config/committers.py @@ -153,6 +153,7 @@ committers_unable_to_review = [ Committer("Mikhail Naganov", "mnaganov@chromium.org"), Committer("MORITA Hajime", "morrita@google.com", "morrita"), Committer("Nico Weber", ["thakis@chromium.org", "thakis@google.com"], "thakis"), + Committer("Noam Rosenthal", "noam.rosenthal@nokia.com", "noamr"), Committer("Pam Greene", "pam@chromium.org", "pamg"), Committer("Peter Kasting", ["pkasting@google.com", "pkasting@chromium.org"], "pkasting"), Committer("Philippe Normand", ["pnormand@igalia.com", "philn@webkit.org"], "philn-tp"), @@ -163,7 +164,6 @@ committers_unable_to_review = [ Committer("Ryosuke Niwa", "rniwa@webkit.org", "rniwa"), Committer("Scott Violet", "sky@chromium.org", "sky"), Committer("Stephen White", "senorblanco@chromium.org", "senorblanco"), - Committer("Tony Chang", "tony@chromium.org", "tony^work"), Committer("Tony Gentilcore", "tonyg@chromium.org", "tonyg-cr"), Committer("Trey Matteson", "trey@usa.net", "trey"), Committer("Tristan O'Tierney", ["tristan@otierney.net", "tristan@apple.com"]), @@ -259,6 +259,7 @@ reviewers_list = [ Reviewer("Steve Falkenburg", "sfalken@apple.com", "sfalken"), Reviewer("Tim Omernick", "timo@apple.com"), Reviewer("Timothy Hatcher", ["timothy@hatcher.name", "timothy@apple.com"], "xenon"), + Reviewer("Tony Chang", "tony@chromium.org", "tony^work"), Reviewer(u"Tor Arne Vestb\u00f8", ["vestbo@webkit.org", "tor.arne.vestbo@nokia.com"], "torarne"), Reviewer("Vicki Murley", "vicki@apple.com"), Reviewer("Xan Lopez", ["xan.lopez@gmail.com", "xan@gnome.org", "xan@webkit.org"], "xan"), diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py index f8b181c..6cfc0b8 100644 --- a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py +++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py @@ -47,8 +47,8 @@ import http_server from webkitpy.common.system.executive import Executive -# Chromium DRT on non-Windows uses WebKitDriver. -if sys.platform not in ('win32', 'cygwin'): +# Chromium DRT on OSX uses WebKitDriver. +if sys.platform == 'darwin': import webkit import websocket_server @@ -172,7 +172,7 @@ class ChromiumPort(base.Port): def create_driver(self, image_path, options): """Starts a new Driver and returns a handle to it.""" - if self._options.use_drt and sys.platform not in ('win32', 'cygwin'): + if self._options.use_drt and sys.platform == 'darwin': return webkit.WebKitDriver(self, image_path, options, executive=self._executive) if self._options.use_drt: options += ['--test-shell'] diff --git a/WebKitTools/Scripts/webkitpy/style/checkers/cpp.py b/WebKitTools/Scripts/webkitpy/style/checkers/cpp.py index 770ab40..9e4240c 100644 --- a/WebKitTools/Scripts/webkitpy/style/checkers/cpp.py +++ b/WebKitTools/Scripts/webkitpy/style/checkers/cpp.py @@ -2512,6 +2512,9 @@ def check_identifier_name_in_declaration(filename, line_number, line, error): if (not (filename.find('JavaScriptCore') >= 0 and modified_identifier.find('_op_') >= 0) and not modified_identifier.startswith('tst_') and not modified_identifier.startswith('webkit_dom_object_') + and not modified_identifier.startswith('NPN_') + and not modified_identifier.startswith('NPP_') + and not modified_identifier.startswith('NP_') and not modified_identifier.startswith('qt_') and not modified_identifier.find('::qt_') >= 0 and not modified_identifier == "const_iterator"): diff --git a/WebKitTools/Scripts/webkitpy/style/checkers/cpp_unittest.py b/WebKitTools/Scripts/webkitpy/style/checkers/cpp_unittest.py index ee829aa..c927db6 100644 --- a/WebKitTools/Scripts/webkitpy/style/checkers/cpp_unittest.py +++ b/WebKitTools/Scripts/webkitpy/style/checkers/cpp_unittest.py @@ -3703,6 +3703,11 @@ class WebKitStyleTest(CppStyleTestBase): self.assert_lint('void QTFrame::qt_drt_is_awesome(int var1, int var2)', '') self.assert_lint('void qt_drt_is_awesome(int var1, int var2);', '') + # NPAPI functions that start with NPN_, NPP_ or NP_ are allowed. + self.assert_lint('void NPN_Status(NPP, const char*)', '') + self.assert_lint('NPError NPP_SetWindow(NPP instance, NPWindow *window)', '') + self.assert_lint('NPObject* NP_Allocate(NPP, NPClass*)', '') + # const_iterator is allowed as well. self.assert_lint('typedef VectorType::const_iterator const_iterator;', '') diff --git a/WebKitTools/Scripts/webkitpy/thirdparty/__init__.py b/WebKitTools/Scripts/webkitpy/thirdparty/__init__.py index 1cb554a..704970d 100644 --- a/WebKitTools/Scripts/webkitpy/thirdparty/__init__.py +++ b/WebKitTools/Scripts/webkitpy/thirdparty/__init__.py @@ -88,15 +88,13 @@ installer.install(url="http://webkit-rietveld.googlecode.com/svn/trunk/static/up # organization purposes. irc_dir = os.path.join(autoinstalled_dir, "irc") installer = AutoInstaller(target_dir=irc_dir) -installer.install(url="http://surfnet.dl.sourceforge.net/project/python-irclib/python-irclib/0.4.8/python-irclib-0.4.8.zip", - url_subpath="irclib.py") -installer.install(url="http://surfnet.dl.sourceforge.net/project/python-irclib/python-irclib/0.4.8/python-irclib-0.4.8.zip", - url_subpath="ircbot.py") +installer.install(url="http://downloads.sourceforge.net/project/python-irclib/python-irclib/0.4.8/python-irclib-0.4.8.zip", url_subpath="irclib.py") +installer.install(url="http://downloads.sourceforge.net/project/python-irclib/python-irclib/0.4.8/python-irclib-0.4.8.zip", url_subpath="ircbot.py") pywebsocket_dir = os.path.join(autoinstalled_dir, "pywebsocket") installer = AutoInstaller(target_dir=pywebsocket_dir) -installer.install(url="http://pywebsocket.googlecode.com/files/mod_pywebsocket-0.5.1.tar.gz", - url_subpath="pywebsocket-0.5.1/src/mod_pywebsocket") +installer.install(url="http://pywebsocket.googlecode.com/files/mod_pywebsocket-0.5.2.tar.gz", + url_subpath="pywebsocket-0.5.2/src/mod_pywebsocket") readme_path = os.path.join(autoinstalled_dir, "README") if not os.path.exists(readme_path): diff --git a/WebKitTools/WebKitTestRunner/Configurations/InjectedBundleCommon.vsprops b/WebKitTools/WebKitTestRunner/Configurations/InjectedBundleCommon.vsprops index 20a4852..e90ddb1 100644 --- a/WebKitTools/WebKitTestRunner/Configurations/InjectedBundleCommon.vsprops +++ b/WebKitTools/WebKitTestRunner/Configurations/InjectedBundleCommon.vsprops @@ -6,7 +6,7 @@ >
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectDir)\..";"$(ProjectDir)\..\..";"$(ProjectDir)\..\Bindings";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\private";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\include";"$(WebKitOutputDir)\obj\InjectedBundle\DerivedSources\""
+ AdditionalIncludeDirectories=""$(ProjectDir)\..";"$(ProjectDir)\..\InjectedBundle\";"$(ProjectDir)\..\InjectedBundle\Bindings";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\private";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\include";"$(WebKitOutputDir)\obj\InjectedBundle\DerivedSources\""
ForcedIncludeFiles="WebKitTestRunnerPrefix.h"
/>
<Tool
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl b/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl index a0fbb85..2eca583 100644 --- a/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl +++ b/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl @@ -41,6 +41,9 @@ module WTR { // Special options. void keepWebHistory(); void setAcceptsEditing(in boolean value); + void setCanOpenWindows(in boolean value); + void setCloseRemainingWindowsWhenComplete(in boolean value); + unsigned long windowCount(); // Special DOM functions. object computedStyleIncludingVisitedInfo(in object element); diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp index 0e99dde..095bd9c 100644 --- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp +++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp @@ -27,13 +27,16 @@ #include "ActivateFonts.h" #include "InjectedBundlePage.h" -#include <WebKit2/WebKit2.h> #include <WebKit2/WKBundle.h> #include <WebKit2/WKBundlePage.h> +#include <WebKit2/WKBundlePagePrivate.h> #include <WebKit2/WKBundlePrivate.h> #include <WebKit2/WKRetainPtr.h> #include <WebKit2/WKStringCF.h> +#include <WebKit2/WebKit2.h> +#include <wtf/PassOwnPtr.h> #include <wtf/RetainPtr.h> +#include <wtf/Vector.h> namespace WTR { @@ -45,6 +48,7 @@ InjectedBundle& InjectedBundle::shared() InjectedBundle::InjectedBundle() : m_bundle(0) + , m_mainPage(0) { } @@ -58,9 +62,9 @@ void InjectedBundle::_willDestroyPage(WKBundleRef bundle, WKBundlePageRef page, static_cast<InjectedBundle*>(const_cast<void*>(clientInfo))->willDestroyPage(page); } -void InjectedBundle::_didReceiveMessage(WKBundleRef bundle, WKStringRef message, const void *clientInfo) +void InjectedBundle::_didReceiveMessage(WKBundleRef bundle, WKStringRef messageName, WKTypeRef messageBody, const void *clientInfo) { - static_cast<InjectedBundle*>(const_cast<void*>(clientInfo))->didReceiveMessage(message); + static_cast<InjectedBundle*>(const_cast<void*>(clientInfo))->didReceiveMessage(messageName, messageBody); } void InjectedBundle::initialize(WKBundleRef bundle) @@ -81,37 +85,48 @@ void InjectedBundle::initialize(WKBundleRef bundle) void InjectedBundle::done() { + WKRetainPtr<WKStringRef> doneMessageName(AdoptWK, WKStringCreateWithCFString(CFSTR("Done"))); + std::string output = m_outputStream.str(); RetainPtr<CFStringRef> outputCFString(AdoptCF, CFStringCreateWithCString(0, output.c_str(), kCFStringEncodingUTF8)); - WKRetainPtr<WKStringRef> doneMessage(AdoptWK, WKStringCreateWithCFString(outputCFString.get())); - WKBundlePostMessage(m_bundle, doneMessage.get()); + WKRetainPtr<WKStringRef> doneMessageBody(AdoptWK, WKStringCreateWithCFString(outputCFString.get())); + + WKBundlePostMessage(m_bundle, doneMessageName.get(), doneMessageBody.get()); } void InjectedBundle::didCreatePage(WKBundlePageRef page) { // FIXME: we really need the main page ref to be sent over from the ui process - m_mainPage = new InjectedBundlePage(page); - m_pages.add(page, m_mainPage); + OwnPtr<InjectedBundlePage> pageWrapper = adoptPtr(new InjectedBundlePage(page)); + if (!m_mainPage) + m_mainPage = pageWrapper.release(); + else + m_otherPages.add(page, pageWrapper.leakPtr()); } void InjectedBundle::willDestroyPage(WKBundlePageRef page) { - delete m_pages.take(page); + if (m_mainPage && m_mainPage->page() == page) + m_mainPage.clear(); + else + delete m_otherPages.take(page); } -void InjectedBundle::didReceiveMessage(WKStringRef message) +void InjectedBundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody) { - CFStringRef cfMessage = WKStringCopyCFString(0, message); + CFStringRef cfMessage = WKStringCopyCFString(0, messageName); if (CFEqual(cfMessage, CFSTR("BeginTest"))) { - WKRetainPtr<WKStringRef> ackMessage(AdoptWK, WKStringCreateWithCFString(CFSTR("BeginTestAck"))); - WKBundlePostMessage(m_bundle, ackMessage.get()); + WKRetainPtr<WKStringRef> ackMessageName(AdoptWK, WKStringCreateWithCFString(CFSTR("Ack"))); + WKRetainPtr<WKStringRef> ackMessageBody(AdoptWK, WKStringCreateWithCFString(CFSTR("BeginTest"))); + WKBundlePostMessage(m_bundle, ackMessageName.get(), ackMessageBody.get()); reset(); return; } - WKRetainPtr<WKStringRef> errorMessage(AdoptWK, WKStringCreateWithCFString(CFSTR("Error: Unknown."))); - WKBundlePostMessage(m_bundle, errorMessage.get()); + WKRetainPtr<WKStringRef> errorMessageName(AdoptWK, WKStringCreateWithCFString(CFSTR("Error"))); + WKRetainPtr<WKStringRef> errorMessageBody(AdoptWK, WKStringCreateWithCFString(CFSTR("Unknown"))); + WKBundlePostMessage(m_bundle, errorMessageName.get(), errorMessageBody.get()); } void InjectedBundle::reset() @@ -120,6 +135,7 @@ void InjectedBundle::reset() m_layoutTestController = LayoutTestController::create(); WKBundleSetShouldTrackVisitedLinks(m_bundle, false); WKBundleRemoveAllVisitedLinks(m_bundle); + m_mainPage->reset(); } void InjectedBundle::setShouldTrackVisitedLinks() @@ -127,4 +143,12 @@ void InjectedBundle::setShouldTrackVisitedLinks() WKBundleSetShouldTrackVisitedLinks(m_bundle, true); } +void InjectedBundle::closeOtherPages() +{ + Vector<WKBundlePageRef> pages; + copyKeysToVector(m_otherPages, pages); + for (size_t i = 0; i < pages.size(); ++i) + WKBundlePageClose(pages[i]); +} + } // namespace WTR diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h index 9bda922..42eb3a1 100644 --- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h +++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h @@ -30,6 +30,7 @@ #include <WebKit2/WKBase.h> #include <WebKit2/WKBundleBase.h> #include <wtf/HashMap.h> +#include <wtf/OwnPtr.h> #include <wtf/RefPtr.h> #include <sstream> @@ -48,7 +49,9 @@ public: void done(); LayoutTestController* layoutTestController() { return m_layoutTestController.get(); } - InjectedBundlePage* page() { return m_mainPage; } + InjectedBundlePage* page() { return m_mainPage.get(); } + size_t pageCount() { return !!m_mainPage + m_otherPages.size(); } + void closeOtherPages(); std::ostringstream& os() { return m_outputStream; } @@ -60,17 +63,17 @@ private: static void _didCreatePage(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo); static void _willDestroyPage(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo); - static void _didReceiveMessage(WKBundleRef bundle, WKStringRef message, const void *clientInfo); + static void _didReceiveMessage(WKBundleRef bundle, WKStringRef messageName, WKTypeRef messageBody, const void *clientInfo); void didCreatePage(WKBundlePageRef page); void willDestroyPage(WKBundlePageRef page); - void didReceiveMessage(WKStringRef message); + void didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody); void reset(); WKBundleRef m_bundle; - HashMap<WKBundlePageRef, InjectedBundlePage*> m_pages; - InjectedBundlePage* m_mainPage; + HashMap<WKBundlePageRef, InjectedBundlePage*> m_otherPages; + OwnPtr<InjectedBundlePage> m_mainPage; RefPtr<LayoutTestController> m_layoutTestController; diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp index 3632fb9..406787e 100644 --- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp +++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp @@ -29,6 +29,7 @@ #include <JavaScriptCore/JSRetainPtr.h> #include <WebKit2/WKArray.h> #include <WebKit2/WKBundleFrame.h> +#include <WebKit2/WKBundleFramePrivate.h> #include <WebKit2/WKBundleNode.h> #include <WebKit2/WKBundlePagePrivate.h> #include <WebKit2/WKRetainPtr.h> @@ -72,21 +73,6 @@ static ostream& operator<<(ostream& out, const WKRetainPtr<WKStringRef>& stringR return out << stringRef.get(); } -static ostream& operator<<(ostream& out, JSStringRef stringRef) -{ - if (!stringRef) - return out; - CFIndex bufferLength = JSStringGetMaximumUTF8CStringSize(stringRef) + 1; - Vector<char> buffer(bufferLength); - JSStringGetUTF8CString(stringRef, buffer.data(), bufferLength); - return out << buffer.data(); -} - -static ostream& operator<<(ostream& out, const JSRetainPtr<JSStringRef>& stringRef) -{ - return out << stringRef.get(); -} - static string dumpPath(WKBundleNodeRef node) { if (!node) @@ -169,6 +155,11 @@ InjectedBundlePage::~InjectedBundlePage() { } +void InjectedBundlePage::reset() +{ + WKBundlePageClearMainFrameName(m_page); +} + // Loader Client Callbacks void InjectedBundlePage::_didStartProvisionalLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo) @@ -238,23 +229,6 @@ static JSValueRef propertyValue(JSContextRef context, JSObjectRef object, const return JSObjectGetProperty(context, object, propertyNameString.get(), &exception); } -static JSObjectRef propertyObject(JSContextRef context, JSObjectRef object, const char* propertyName) -{ - JSValueRef value = propertyValue(context, object, propertyName); - if (!value || !JSValueIsObject(context, value)) - return 0; - return const_cast<JSObjectRef>(value); -} - -static JSRetainPtr<JSStringRef> propertyString(JSContextRef context, JSObjectRef object, const char* propertyName) -{ - JSValueRef value = propertyValue(context, object, propertyName); - if (!value) - return 0; - JSValueRef exception; - return JSRetainPtr<JSStringRef>(Adopt, JSValueToStringCopy(context, value, &exception)); -} - static double numericWindowPropertyValue(WKBundleFrameRef frame, const char* propertyName) { JSGlobalContextRef context = WKBundleFrameGetJavaScriptContext(frame); @@ -285,8 +259,7 @@ static void dumpDescendantFrameScrollPositions(WKBundleFrameRef frame) WKRetainPtr<WKArrayRef> childFrames(AdoptWK, WKBundleFrameCopyChildFrames(frame)); size_t size = WKArrayGetSize(childFrames.get()); for (size_t i = 0; i < size; ++i) { - // FIXME: I don't like that we have to const_cast here. Can we change WKArray? - WKBundleFrameRef subframe = static_cast<WKBundleFrameRef>(const_cast<void*>(WKArrayGetItemAtIndex(childFrames.get(), i))); + WKBundleFrameRef subframe = static_cast<WKBundleFrameRef>(WKArrayGetItemAtIndex(childFrames.get(), i)); dumpFrameScrollPosition(subframe, ShouldIncludeFrameName); dumpDescendantFrameScrollPositions(subframe); } @@ -301,10 +274,8 @@ void InjectedBundlePage::dumpAllFrameScrollPositions() static void dumpFrameText(WKBundleFrameRef frame) { - JSGlobalContextRef context = WKBundleFrameGetJavaScriptContext(frame); - JSObjectRef document = propertyObject(context, JSContextGetGlobalObject(context), "document"); - JSObjectRef documentElement = propertyObject(context, document, "documentElement"); - InjectedBundle::shared().os() << propertyString(context, documentElement, "innerText") << "\n"; + WKRetainPtr<WKStringRef> text(AdoptWK, WKBundleFrameCopyInnerText(frame)); + InjectedBundle::shared().os() << text << "\n"; } static void dumpDescendantFramesText(WKBundleFrameRef frame) @@ -312,8 +283,7 @@ static void dumpDescendantFramesText(WKBundleFrameRef frame) WKRetainPtr<WKArrayRef> childFrames(AdoptWK, WKBundleFrameCopyChildFrames(frame)); size_t size = WKArrayGetSize(childFrames.get()); for (size_t i = 0; i < size; ++i) { - // FIXME: I don't like that we have to const_cast here. Can we change WKArray? - WKBundleFrameRef subframe = static_cast<WKBundleFrameRef>(const_cast<void*>(WKArrayGetItemAtIndex(childFrames.get(), i))); + WKBundleFrameRef subframe = static_cast<WKBundleFrameRef>(WKArrayGetItemAtIndex(childFrames.get(), i)); WKRetainPtr<WKStringRef> subframeName(AdoptWK, WKBundleFrameCopyName(subframe)); InjectedBundle::shared().os() << "\n--------\nFrame: '" << subframeName << "'\n--------\n"; dumpFrameText(subframe); @@ -361,6 +331,9 @@ void InjectedBundlePage::didFinishLoadForFrame(WKBundleFrameRef frame) m_isLoading = false; + if (this != InjectedBundle::shared().page()) + return; + if (InjectedBundle::shared().layoutTestController()->waitToDump()) return; @@ -374,6 +347,9 @@ void InjectedBundlePage::didFailLoadWithErrorForFrame(WKBundleFrameRef frame) m_isLoading = false; + if (this != InjectedBundle::shared().page()) + return; + InjectedBundle::shared().done(); } diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h index 1b67af0..f7d64f9 100644 --- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h +++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h @@ -40,6 +40,8 @@ public: bool isLoading() { return m_isLoading; } + void reset(); + private: // Loader Client static void _didStartProvisionalLoadForFrame(WKBundlePageRef, WKBundleFrameRef, const void* clientInfo); diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp index 2f59eb1..8fda21e 100644 --- a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp +++ b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp @@ -116,6 +116,7 @@ LayoutTestController::LayoutTestController() : m_whatToDump(RenderTree) , m_shouldDumpAllFrameScrollPositions(false) , m_shouldAllowEditing(true) + , m_shouldCloseExtraWindows(false) , m_dumpEditingCallbacks(false) , m_dumpStatusCallbacks(false) , m_waitToDump(false) @@ -242,6 +243,17 @@ bool LayoutTestController::isCommandEnabled(JSStringRef name) return WKBundlePageIsEditingCommandEnabled(InjectedBundle::shared().page()->page(), toWK(name).get()); } +void LayoutTestController::setCanOpenWindows(bool) +{ + // It's not clear if or why any tests require opening windows be forbidden. + // For now, just ignore this setting, and if we find later it's needed we can add it. +} + +unsigned LayoutTestController::windowCount() +{ + return InjectedBundle::shared().pageCount(); +} + // Object Creation void LayoutTestController::makeWindowObject(JSContextRef context, JSObjectRef windowObject, JSValueRef* exception) diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h index 9f0641b..75aeb9e 100644 --- a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h +++ b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h @@ -60,6 +60,9 @@ public: // Special options. void keepWebHistory(); void setAcceptsEditing(bool value) { m_shouldAllowEditing = value; } + void setCanOpenWindows(bool); + void setCloseRemainingWindowsWhenComplete(bool value) { m_shouldCloseExtraWindows = value; } + unsigned windowCount(); // Special DOM functions. JSValueRef computedStyleIncludingVisitedInfo(JSValueRef element); @@ -92,12 +95,17 @@ public: bool shouldAllowEditing() const { return m_shouldAllowEditing; } + bool shouldCloseExtraWindowsAfterRunningTest() const { return m_shouldCloseExtraWindows; } + private: LayoutTestController(); WhatToDump m_whatToDump; bool m_shouldDumpAllFrameScrollPositions; + bool m_shouldAllowEditing; + bool m_shouldCloseExtraWindows; + bool m_dumpEditingCallbacks; bool m_dumpStatusCallbacks; bool m_waitToDump; // True if waitUntilDone() has been called, but notifyDone() has not yet been called. diff --git a/WebKitTools/WebKitTestRunner/TestController.cpp b/WebKitTools/WebKitTestRunner/TestController.cpp index 4f8cd6b..93857a7 100644 --- a/WebKitTools/WebKitTestRunner/TestController.cpp +++ b/WebKitTools/WebKitTestRunner/TestController.cpp @@ -28,21 +28,62 @@ #include "PlatformWebView.h" #include "TestInvocation.h" #include <WebKit2/WKContextPrivate.h> +#include <wtf/PassOwnPtr.h> namespace WTR { +static TestController* controller; + TestController& TestController::shared() { - static TestController& shared = *new TestController; - return shared; + ASSERT(controller); + return *controller; } -TestController::TestController() +TestController::TestController(int argc, const char* argv[]) : m_dumpPixels(false) , m_verbose(false) , m_printSeparators(false) , m_usingServerMode(false) { + initialize(argc, argv); + controller = this; + run(); + controller = 0; +} + +TestController::~TestController() +{ +} + +static void closeOtherPage(WKPageRef page, const void* clientInfo) +{ + WKPageClose(page); + const PlatformWebView* view = static_cast<const PlatformWebView*>(clientInfo); + delete view; +} + +static WKPageRef createOtherPage(WKPageRef oldPage, const void*) +{ + PlatformWebView* view = new PlatformWebView(WKPageGetPageNamespace(oldPage)); + WKPageRef newPage = view->page(); + + view->resizeTo(800, 600); + + WKPageUIClient otherPageUIClient = { + 0, + view, + createOtherPage, + 0, + closeOtherPage, + 0, + 0, + 0 + }; + WKPageSetPageUIClient(newPage, &otherPageUIClient); + + WKRetain(newPage); + return newPage; } void TestController::initialize(int argc, const char* argv[]) @@ -75,21 +116,33 @@ void TestController::initialize(int argc, const char* argv[]) m_printSeparators = m_paths.size() > 1; initializeInjectedBundlePath(); - initializeTestPluginPath(); + initializeTestPluginDirectory(); m_context.adopt(WKContextCreateWithInjectedBundlePath(injectedBundlePath())); - WKContextInjectedBundleClient injectedBundlePathClient = { + WKContextInjectedBundleClient injectedBundleClient = { 0, this, - _didReceiveMessageFromInjectedBundle + didReceiveMessageFromInjectedBundle }; - WKContextSetInjectedBundleClient(m_context.get(), &injectedBundlePathClient); + WKContextSetInjectedBundleClient(m_context.get(), &injectedBundleClient); - _WKContextSetAdditionalPluginPath(m_context.get(), testPluginPath()); + _WKContextSetAdditionalPluginsDirectory(m_context.get(), testPluginDirectory()); m_pageNamespace.adopt(WKPageNamespaceCreate(m_context.get())); - m_mainWebView = new PlatformWebView(m_pageNamespace.get()); + m_mainWebView = adoptPtr(new PlatformWebView(m_pageNamespace.get())); + + WKPageUIClient pageUIClient = { + 0, + this, + createOtherPage, + 0, + 0, + 0, + 0, + 0 + }; + WKPageSetPageUIClient(m_mainWebView->page(), &pageUIClient); } void TestController::runTest(const char* test) @@ -114,7 +167,7 @@ void TestController::runTestingServerLoop() } } -bool TestController::run() +void TestController::run() { if (m_usingServerMode) runTestingServerLoop(); @@ -122,18 +175,16 @@ bool TestController::run() for (size_t i = 0; i < m_paths.size(); ++i) runTest(m_paths[i].c_str()); } - - return true; } -void TestController::_didReceiveMessageFromInjectedBundle(WKContextRef context, WKStringRef message, const void *clientInfo) +void TestController::didReceiveMessageFromInjectedBundle(WKContextRef context, WKStringRef messageName, WKTypeRef messageBody, const void *clientInfo) { - static_cast<TestController*>(const_cast<void*>(clientInfo))->didReceiveMessageFromInjectedBundle(message); + static_cast<TestController*>(const_cast<void*>(clientInfo))->didReceiveMessageFromInjectedBundle(messageName, messageBody); } -void TestController::didReceiveMessageFromInjectedBundle(WKStringRef message) +void TestController::didReceiveMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody) { - m_currentInvocation->didReceiveMessageFromInjectedBundle(message); + m_currentInvocation->didReceiveMessageFromInjectedBundle(messageName, messageBody); } } // namespace WTR diff --git a/WebKitTools/WebKitTestRunner/TestController.h b/WebKitTools/WebKitTestRunner/TestController.h index bd073bf..5754728 100644 --- a/WebKitTools/WebKitTestRunner/TestController.h +++ b/WebKitTools/WebKitTestRunner/TestController.h @@ -36,39 +36,37 @@ namespace WTR { class TestInvocation; class PlatformWebView; +// FIXME: Rename this TestRunner? class TestController { public: static TestController& shared(); - // Initialize the TestController. - void initialize(int argc, const char *argv[]); - - // Returns true if all the tests passed, false otherwise. - bool run(); + TestController(int argc, const char* argv[]); + ~TestController(); bool verbose() const { return m_verbose; } WKStringRef injectedBundlePath() { return m_injectedBundlePath.get(); } - WKStringRef testPluginPath() { return m_testPluginPath.get(); } + WKStringRef testPluginDirectory() { return m_testPluginDirectory.get(); } - PlatformWebView* mainWebView() { return m_mainWebView; } + PlatformWebView* mainWebView() { return m_mainWebView.get(); } WKPageNamespaceRef pageNamespace() { return m_pageNamespace.get(); } WKContextRef context() { return m_context.get(); } private: - TestController(); - ~TestController(); + void initialize(int argc, const char* argv[]); + void run(); void runTestingServerLoop(); void runTest(const char* pathOrURL); void platformInitialize(); void initializeInjectedBundlePath(); - void initializeTestPluginPath(); + void initializeTestPluginDirectory(); // WKContextInjectedBundleClient - static void _didReceiveMessageFromInjectedBundle(WKContextRef context, WKStringRef message, const void*); - void didReceiveMessageFromInjectedBundle(WKStringRef message); + static void didReceiveMessageFromInjectedBundle(WKContextRef context, WKStringRef messageName, WKTypeRef messageBody, const void*); + void didReceiveMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody); OwnPtr<TestInvocation> m_currentInvocation; @@ -78,9 +76,9 @@ private: bool m_usingServerMode; std::vector<std::string> m_paths; WKRetainPtr<WKStringRef> m_injectedBundlePath; - WKRetainPtr<WKStringRef> m_testPluginPath; + WKRetainPtr<WKStringRef> m_testPluginDirectory; - PlatformWebView* m_mainWebView; + OwnPtr<PlatformWebView> m_mainWebView; WKRetainPtr<WKContextRef> m_context; WKRetainPtr<WKPageNamespaceRef> m_pageNamespace; }; diff --git a/WebKitTools/WebKitTestRunner/TestInvocation.cpp b/WebKitTools/WebKitTestRunner/TestInvocation.cpp index b6e950f..658911b 100644 --- a/WebKitTools/WebKitTestRunner/TestInvocation.cpp +++ b/WebKitTools/WebKitTestRunner/TestInvocation.cpp @@ -108,8 +108,9 @@ void TestInvocation::invoke() sizeWebViewForCurrentTest(m_pathOrURL); resetPreferencesToConsistentValues(); - WKRetainPtr<WKStringRef> message(AdoptWK, WKStringCreateWithCFString(CFSTR("BeginTest"))); - WKContextPostMessageToInjectedBundle(TestController::shared().context(), message.get()); + WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithCFString(CFSTR("BeginTest"))); + WKRetainPtr<WKStringRef> messageBody(AdoptWK, WKStringCreateWithCFString(CFSTR(""))); + WKContextPostMessageToInjectedBundle(TestController::shared().context(), messageName.get(), messageBody.get()); runUntil(m_gotInitialResponse); if (m_error) { @@ -139,11 +140,10 @@ void TestInvocation::dump(const char* stringToDump) fflush(stderr); } -void TestInvocation::didReceiveMessageFromInjectedBundle(WKStringRef message) +void TestInvocation::didReceiveMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody) { - RetainPtr<CFStringRef> cfMessage(AdoptCF, WKStringCopyCFString(0, message)); - - if (CFEqual(cfMessage.get(), CFSTR("Error"))) { + RetainPtr<CFStringRef> cfMessageName(AdoptCF, WKStringCopyCFString(0, messageName)); + if (CFEqual(cfMessageName.get(), CFSTR("Error"))) { // Set all states to true to stop spinning the runloop. m_gotInitialResponse = true; m_gotFinalMessage = true; @@ -151,15 +151,27 @@ void TestInvocation::didReceiveMessageFromInjectedBundle(WKStringRef message) return; } - if (CFEqual(cfMessage.get(), CFSTR("BeginTestAck"))) { - m_gotInitialResponse = true; - return; + if (CFEqual(cfMessageName.get(), CFSTR("Ack"))) { + ASSERT(WKGetTypeID(messageBody) == WKStringGetTypeID()); + RetainPtr<CFStringRef> cfMessageBody(AdoptCF, WKStringCopyCFString(0, static_cast<WKStringRef>(messageBody))); + + if (CFEqual(cfMessageBody.get(), CFSTR("BeginTest"))) { + m_gotInitialResponse = true; + return; + } + + ASSERT_NOT_REACHED(); } - OwnPtr<Vector<char> > utf8Message = WKStringToUTF8(message); + if (CFEqual(cfMessageName.get(), CFSTR("Done"))) { + ASSERT(WKGetTypeID(messageBody) == WKStringGetTypeID()); + OwnPtr<Vector<char> > utf8Message = WKStringToUTF8(static_cast<WKStringRef>(messageBody)); + dump(utf8Message->data()); + m_gotFinalMessage = true; + return; + } - dump(utf8Message->data()); - m_gotFinalMessage = true; + ASSERT_NOT_REACHED(); } } // namespace WTR diff --git a/WebKitTools/WebKitTestRunner/TestInvocation.h b/WebKitTools/WebKitTestRunner/TestInvocation.h index e064a8f..484e61d 100644 --- a/WebKitTools/WebKitTestRunner/TestInvocation.h +++ b/WebKitTools/WebKitTestRunner/TestInvocation.h @@ -37,7 +37,7 @@ public: ~TestInvocation(); void invoke(); - void didReceiveMessageFromInjectedBundle(WKStringRef message); + void didReceiveMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody); private: void dump(const char*); diff --git a/WebKitTools/WebKitTestRunner/WebKitTestRunner.sln b/WebKitTools/WebKitTestRunner/WebKitTestRunner.sln index e2435d3..670dd30 100644 --- a/WebKitTools/WebKitTestRunner/WebKitTestRunner.sln +++ b/WebKitTools/WebKitTestRunner/WebKitTestRunner.sln @@ -18,7 +18,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImageDiff", "..\DumpRenderT {DA31DA52-6675-48D4-89E0-333A7144397C} = {DA31DA52-6675-48D4-89E0-333A7144397C}
EndProjectSection
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "InjectedBundle", "InjectedBundle\win\InjectedBundle.vcproj", "{CBC3391C-F060-4BF5-A66E-81404168816B}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "InjectedBundle", "win\InjectedBundle.vcproj", "{CBC3391C-F060-4BF5-A66E-81404168816B}"
ProjectSection(ProjectDependencies) = postProject
{4343BC0B-A2E0-4B48-8277-F33CFBFA83CD} = {4343BC0B-A2E0-4B48-8277-F33CFBFA83CD}
EndProjectSection
diff --git a/WebKitTools/WebKitTestRunner/mac/PlatformWebViewMac.mm b/WebKitTools/WebKitTestRunner/mac/PlatformWebViewMac.mm index 21db2eb..4e2a60c 100644 --- a/WebKitTools/WebKitTestRunner/mac/PlatformWebViewMac.mm +++ b/WebKitTools/WebKitTestRunner/mac/PlatformWebViewMac.mm @@ -38,6 +38,7 @@ PlatformWebView::PlatformWebView(WKPageNamespaceRef namespaceRef) [[m_window contentView] addSubview:m_view]; [m_window orderBack:nil]; [m_window setAutodisplay:NO]; + [m_window setReleasedWhenClosed:NO]; } void PlatformWebView::resizeTo(unsigned width, unsigned height) diff --git a/WebKitTools/WebKitTestRunner/mac/TestControllerMac.mm b/WebKitTools/WebKitTestRunner/mac/TestControllerMac.mm index ae4cc2f..1a71b5d 100644 --- a/WebKitTools/WebKitTestRunner/mac/TestControllerMac.mm +++ b/WebKitTools/WebKitTestRunner/mac/TestControllerMac.mm @@ -40,9 +40,9 @@ void TestController::initializeInjectedBundlePath() m_injectedBundlePath.adopt(WKStringCreateWithCFString((CFStringRef)nsBundlePath)); } -void TestController::initializeTestPluginPath() +void TestController::initializeTestPluginDirectory() { - m_testPluginPath.adopt(WKStringCreateWithCFString((CFStringRef)[[NSBundle mainBundle] bundlePath])); + m_testPluginDirectory.adopt(WKStringCreateWithCFString((CFStringRef)[[NSBundle mainBundle] bundlePath])); } } // namespace WTR diff --git a/WebKitTools/WebKitTestRunner/mac/main.mm b/WebKitTools/WebKitTestRunner/mac/main.mm index 021c124..d2f26ab 100644 --- a/WebKitTools/WebKitTestRunner/mac/main.mm +++ b/WebKitTools/WebKitTestRunner/mac/main.mm @@ -28,13 +28,10 @@ int main(int argc, const char* argv[]) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - [NSApplication sharedApplication]; - - WTR::TestController::shared().initialize(argc, argv); - WTR::TestController::shared().run(); - + { + WTR::TestController controller(argc, argv); + } [pool drain]; - return 0; } diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/win/InjectedBundle.vcproj b/WebKitTools/WebKitTestRunner/win/InjectedBundle.vcproj index be20bab..d283083 100644 --- a/WebKitTools/WebKitTestRunner/InjectedBundle/win/InjectedBundle.vcproj +++ b/WebKitTools/WebKitTestRunner/win/InjectedBundle.vcproj @@ -18,7 +18,7 @@ <Configuration
Name="Debug|Win32"
ConfigurationType="2"
- InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug.vsprops;..\..\Configurations\InjectedBundleCommon.vsprops"
+ InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug.vsprops;..\Configurations\InjectedBundleCommon.vsprops"
CharacterSet="1"
>
<Tool
@@ -79,7 +79,7 @@ <Configuration
Name="Release|Win32"
ConfigurationType="2"
- InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\release.vsprops;..\..\Configurations\InjectedBundleCommon.vsprops"
+ InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\release.vsprops;..\Configurations\InjectedBundleCommon.vsprops"
CharacterSet="1"
WholeProgramOptimization="1"
>
@@ -141,7 +141,7 @@ <Configuration
Name="Debug_All|Win32"
ConfigurationType="2"
- InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug_internal.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug_all.vsprops;..\..\Configurations\InjectedBundleCommon.vsprops"
+ InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug_internal.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug_all.vsprops;..\Configurations\InjectedBundleCommon.vsprops"
CharacterSet="1"
>
<Tool
@@ -202,7 +202,7 @@ <Configuration
Name="Debug_Internal|Win32"
ConfigurationType="2"
- InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug_internal.vsprops;..\..\Configurations\InjectedBundleCommon.vsprops"
+ InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug_internal.vsprops;..\Configurations\InjectedBundleCommon.vsprops"
CharacterSet="1"
>
<Tool
@@ -268,19 +268,19 @@ Name="Bindings"
>
<File
- RelativePath="..\Bindings\CodeGeneratorTestRunner.pm"
+ RelativePath="..\InjectedBundle\Bindings\CodeGeneratorTestRunner.pm"
>
</File>
<File
- RelativePath="..\Bindings\JSWrappable.h"
+ RelativePath="..\InjectedBundle\Bindings\JSWrappable.h"
>
</File>
<File
- RelativePath="..\Bindings\JSWrapper.cpp"
+ RelativePath="..\InjectedBundle\Bindings\JSWrapper.cpp"
>
</File>
<File
- RelativePath="..\Bindings\JSWrapper.h"
+ RelativePath="..\InjectedBundle\Bindings\JSWrapper.h"
>
</File>
</Filter>
@@ -297,35 +297,35 @@ </File>
</Filter>
<File
- RelativePath="ActivateFonts.cpp"
+ RelativePath="..\InjectedBundle\win\ActivateFonts.cpp"
>
</File>
<File
- RelativePath="..\InjectedBundle.cpp"
+ RelativePath="..\InjectedBundle\InjectedBundle.cpp"
>
</File>
<File
- RelativePath="..\InjectedBundle.h"
+ RelativePath="..\InjectedBundle\InjectedBundle.h"
>
</File>
<File
- RelativePath="..\InjectedBundleMain.cpp"
+ RelativePath="..\InjectedBundle\InjectedBundleMain.cpp"
>
</File>
<File
- RelativePath="..\InjectedBundlePage.cpp"
+ RelativePath="..\InjectedBundle\InjectedBundlePage.cpp"
>
</File>
<File
- RelativePath="..\InjectedBundlePage.h"
+ RelativePath="..\InjectedBundle\InjectedBundlePage.h"
>
</File>
<File
- RelativePath="..\LayoutTestController.cpp"
+ RelativePath="..\InjectedBundle\LayoutTestController.cpp"
>
</File>
<File
- RelativePath="..\LayoutTestController.h"
+ RelativePath="..\InjectedBundle\LayoutTestController.h"
>
</File>
</Files>
diff --git a/WebKitTools/WebKitTestRunner/win/TestControllerWin.cpp b/WebKitTools/WebKitTestRunner/win/TestControllerWin.cpp index 987481a..9bec373 100644 --- a/WebKitTools/WebKitTestRunner/win/TestControllerWin.cpp +++ b/WebKitTools/WebKitTestRunner/win/TestControllerWin.cpp @@ -50,11 +50,11 @@ void TestController::initializeInjectedBundlePath() m_injectedBundlePath.adopt(WKStringCreateWithCFString(bundlePath)); } -void TestController::initializeTestPluginPath() +void TestController::initializeTestPluginDirectory() { CFStringRef exeContainerPath = CFURLCopyFileSystemPath(CFURLCreateCopyDeletingLastPathComponent(0, CFBundleCopyExecutableURL(CFBundleGetMainBundle())), kCFURLWindowsPathStyle); CFMutableStringRef bundlePath = CFStringCreateMutableCopy(0, 0, exeContainerPath); - m_testPluginPath.adopt(WKStringCreateWithCFString(bundlePath)); + m_testPluginDirectory.adopt(WKStringCreateWithCFString(bundlePath)); } } // namespace WTR diff --git a/WebKitTools/WebKitTestRunner/win/WebKitTestRunner.sln b/WebKitTools/WebKitTestRunner/win/WebKitTestRunner.sln deleted file mode 100644 index 757b7fb..0000000 --- a/WebKitTools/WebKitTestRunner/win/WebKitTestRunner.sln +++ /dev/null @@ -1,39 +0,0 @@ -
-Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual Studio 2005
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WebKitTestRunner", "WebKitTestRunner.vcproj", "{3B99669B-1817-443B-BCBE-835580146668}"
- ProjectSection(ProjectDependencies) = postProject
- {CBC3391C-F060-4BF5-A66E-81404168816B} = {CBC3391C-F060-4BF5-A66E-81404168816B}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "InjectedBundle", "..\InjectedBundle\win\InjectedBundle.vcproj", "{CBC3391C-F060-4BF5-A66E-81404168816B}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug_All|Win32 = Debug_All|Win32
- Debug_Internal|Win32 = Debug_Internal|Win32
- Debug|Win32 = Debug|Win32
- Release|Win32 = Release|Win32
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {3B99669B-1817-443B-BCBE-835580146668}.Debug_All|Win32.ActiveCfg = Debug_All|Win32
- {3B99669B-1817-443B-BCBE-835580146668}.Debug_All|Win32.Build.0 = Debug_All|Win32
- {3B99669B-1817-443B-BCBE-835580146668}.Debug_Internal|Win32.ActiveCfg = Debug_Internal|Win32
- {3B99669B-1817-443B-BCBE-835580146668}.Debug_Internal|Win32.Build.0 = Debug_Internal|Win32
- {3B99669B-1817-443B-BCBE-835580146668}.Debug|Win32.ActiveCfg = Debug|Win32
- {3B99669B-1817-443B-BCBE-835580146668}.Debug|Win32.Build.0 = Debug|Win32
- {3B99669B-1817-443B-BCBE-835580146668}.Release|Win32.ActiveCfg = Release|Win32
- {3B99669B-1817-443B-BCBE-835580146668}.Release|Win32.Build.0 = Release|Win32
- {CBC3391C-F060-4BF5-A66E-81404168816B}.Debug_All|Win32.ActiveCfg = Debug_All|Win32
- {CBC3391C-F060-4BF5-A66E-81404168816B}.Debug_All|Win32.Build.0 = Debug_All|Win32
- {CBC3391C-F060-4BF5-A66E-81404168816B}.Debug_Internal|Win32.ActiveCfg = Debug_Internal|Win32
- {CBC3391C-F060-4BF5-A66E-81404168816B}.Debug_Internal|Win32.Build.0 = Debug_Internal|Win32
- {CBC3391C-F060-4BF5-A66E-81404168816B}.Debug|Win32.ActiveCfg = Debug|Win32
- {CBC3391C-F060-4BF5-A66E-81404168816B}.Debug|Win32.Build.0 = Debug|Win32
- {CBC3391C-F060-4BF5-A66E-81404168816B}.Release|Win32.ActiveCfg = Release|Win32
- {CBC3391C-F060-4BF5-A66E-81404168816B}.Release|Win32.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/WebKitTools/WebKitTestRunner/win/main.cpp b/WebKitTools/WebKitTestRunner/win/main.cpp index 96e55b4..6ef0f66 100644 --- a/WebKitTools/WebKitTestRunner/win/main.cpp +++ b/WebKitTools/WebKitTestRunner/win/main.cpp @@ -27,8 +27,9 @@ int main(int argc, const char* argv[]) { - WTR::TestController::shared().initialize(argc, argv); - WTR::TestController::shared().run(); + { + WTR::TestController controller(argc, argv); + } return 0; } |