diff options
author | Jocelyn Turcotte <jocelyn.turcotte@nokia.com> | 2009-09-24 12:56:11 (GMT) |
---|---|---|
committer | Jocelyn Turcotte <jocelyn.turcotte@nokia.com> | 2009-09-24 12:56:11 (GMT) |
commit | 512d332d21860b1d08e86d6de96b80ce12d742bf (patch) | |
tree | 339a6f5962b587b198f2ed21bf9f64ac338b66eb /src/3rdparty | |
parent | cb89aab6b29fd5761f3b9d41354abcde11e103dc (diff) | |
download | Qt-512d332d21860b1d08e86d6de96b80ce12d742bf.zip Qt-512d332d21860b1d08e86d6de96b80ce12d742bf.tar.gz Qt-512d332d21860b1d08e86d6de96b80ce12d742bf.tar.bz2 |
Updated WebKit from /home/joce/dev/qtwebkit3/ to qtwebkit-4.6-snapshot-24092009 ( 75c44947a340d74a9e0098a3dfffabce0c9512ef )
Changes in WebKit/qt since the last update:
++ b/WebKit/qt/ChangeLog
2009-09-24 Martin Smith <msmith@trolltech.com>
Reviewed by Simon Hausmann.
qdoc: Added \brief texts to all the since 4.6 functions.
* Api/qwebhistory.cpp:
2009-09-23 J-P Nurmi <jpnurmi@gmail.com>
Reviewed by Simon Hausmann.
Prevent QWebPage::setView() from changing the viewport size on the fly
in case the view doesn't actually change. QWebPage::setView() is
called upon every QWebGraphicsItem::hoverMoveEvent(), which forced
the viewport size to be equal to the size of the whole graphics view.
https://bugs.webkit.org/show_bug.cgi?id=29676
* Api/qwebpage.cpp:
(QWebPage::setView):
2009-09-23 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
Reviewed by Simon Hausmann.
[Qt] Crash fix in QWebHistory back and forward methods.
QWebHistory::back() and QWebHistory::forward() were crashing on
ASSERT in WebCore::BackForwardList. The methods should check
canGoBack() and canGoForward() at the beginning.
https://bugs.webkit.org/show_bug.cgi?id=29675
* Api/qwebhistory.cpp:
(QWebHistory::back):
(QWebHistory::forward):
2009-09-23 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
Reviewed by Simon Hausmann.
[Qt] Bug fix. QWebHistory should call QWebPage::updateNavigationActions
In QWebHistory's methods that change item count or current item call
to QWebPage::updateNavigationActions should be executed.
QWebHistory::clear() and QWebHistory::restorState() were changed.
New helper method, QWebPagePrivate accesor, were created in
QWebHistoryPrivate class.
Two autotest were developed.
https://bugs.webkit.org/show_bug.cgi?id=29246
* Api/qwebhistory.cpp:
(QWebHistory::clear):
(QWebHistory::restoreState):
(QWebHistoryPrivate::page):
* Api/qwebhistory_p.h:
* tests/qwebhistory/tst_qwebhistory.cpp:
(tst_QWebHistory::saveAndRestore_1):
(tst_QWebHistory::clear):
2009-09-23 Norbert Leser <norbert.leser@nokia.com>
Reviewed by Tor Arne Vestbø.
Need to guard QX11Info include with Q_WS_X11.
That class may not be available (in QT 4.5 for Symbian, for instance).
Completes fixes in r48627 and r48604.
* Api/qwebgraphicsitem.cpp:
* Api/qwebview.cpp:
2009-09-22 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
Reviewed by Simon Hausmann.
[Qt] Add default timeout while waiting for signals in QWebPage auto
tests.
https://bugs.webkit.org/show_bug.cgi?id=29637
* tests/qwebpage/tst_qwebpage.cpp:
(waitForSignal):
2009-09-22 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
Reivewed by Simon Hausmann.
Fix the Qt/Mac build after r48604 (Implement new QWebPageClient class)
There's no QWidget::x11Info() on Mac, and setPlatformPluginWidget()
takes a QWidget*, not a QWebPageClient*
* Api/qwebgraphicsitem.cpp:
(QWebGraphicsItemPrivate::screenNumber):
* Api/qwebview.cpp:
(QWebViewPrivate::screenNumber):
2009-09-21 Kenneth Rohde Christiansen <kenneth@webkit.org>
Reviewed by Simon Hausmann.
For Qt, platformPageClient() will now return a class derived from
the QWebPageClient, so the patch adapts our Qt hooks to go though
this class and not depend on the QWebView.
* Api/qwebgraphicsitem.cpp:
(QWebGraphicsItemPrivate::scroll):
(QWebGraphicsItemPrivate::update):
(QWebGraphicsItemPrivate::cursor):
(QWebGraphicsItemPrivate::updateCursor):
(QWebGraphicsItemPrivate::screenNumber):
(QWebGraphicsItemPrivate::winId):
(QWebGraphicsItem::event):
(QWebGraphicsItem::setPage):
* Api/qwebgraphicsitem.h:
* Api/qwebpage.cpp:
(QWebPagePrivate::QWebPagePrivate):
* Api/qwebpage_p.h:
* Api/qwebview.cpp:
(QWebViewPrivate::scroll):
(QWebViewPrivate::update):
(QWebViewPrivate::cursor):
(QWebViewPrivate::updateCursor):
(QWebViewPrivate::screenNumber):
(QWebViewPrivate::winId):
(QWebView::setPage):
(QWebView::event):
* WebCoreSupport/ChromeClientQt.cpp:
(WebCore::ChromeClientQt::repaint):
(WebCore::ChromeClientQt::scroll):
(WebCore::ChromeClientQt::platformPageClient):
2009-09-21 Yael Aharon <yael.aharon@nokia.com>
Reviewed by Simon Hausmann.
https://bugs.webkit.org/show_bug.cgi?id=29609
Build fix for windows when using Qt 4.5.0.
* Api/qwebpage.cpp:
(QWebPage::userAgentForUrl):
2009-09-19 Benjamin Poulain <benjamin.poulain@nokia.com>
Reviewed by Simon Hausmann.
https://bugs.webkit.org/show_bug.cgi?id=29345
The tests of QWebFrame did not use QTRY_VERIFY for
tests involving the event loop.
* tests/qwebframe/tst_qwebframe.cpp:
* tests/util.h: Added. Copy of tests/shared/util.h of Qt
2009-09-19 Jakub Wieczorek <faw217@gmail.com>
Reviewed by Simon Hausmann.
[Qt] Add an autotest stub for QWebGraphicsItem.
It just calls all the functions and makes sure they don't crash.
* tests/qwebgraphicsitem/qwebgraphicsitem.pro: Added.
* tests/qwebgraphicsitem/tst_qwebgraphicsitem.cpp: Added.
(tst_QWebGraphicsItem::qwebgraphicsitem):
* tests/tests.pro:
2009-09-18 Norbert Leser <norbert.leser@nokia.com>
Reviewed by Eric Seidel.
Corrected the Symbian specific UID3 values to be assigned
from the "unprotected" pool that permits self-signing of
those test and demo executables. (Added new UID3 values
where they were missing for new components.)
* QGVLauncher/QGVLauncher.pro:
* QtLauncher/QtLauncher.pro:
* tests/benchmarks/loading/tst_loading.pro:
* tests/benchmarks/painting/tst_painting.pro:
* tests/qwebelement/qwebelement.pro:
* tests/qwebframe/qwebframe.pro:
* tests/qwebhistory/qwebhistory.pro:
* tests/qwebhistoryinterface/qwebhistoryinterface.pro:
* tests/qwebpage/qwebpage.pro:
* tests/qwebplugindatabase/qwebplugindatabase.pro:
* tests/qwebview/qwebview.pro:
2009-09-17 Kenneth Rohde Christiansen <kenneth@webkit.org>
Reviewed by Simon Hausmann.
Make PlatformWindow return something else than PlatformWidget
https://bugs.webkit.org/show_bug.cgi?id=29085
Reflect the rename of platformWindow and it's return type.
* WebCoreSupport/ChromeClientQt.cpp:
(WebCore::ChromeClientQt::platformPageClient):
* WebCoreSupport/ChromeClientQt.h:
2009-09-18 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
Reviewed by Simon Hausmann.
[Qt] Add persistence support for configuration options in the
inspector.
* Api/qwebinspector.cpp:
* QtLauncher/main.cpp:
(main):
* WebCoreSupport/InspectorClientQt.cpp:
(WebCore::InspectorClientQt::populateSetting):
(WebCore::InspectorClientQt::storeSetting):
(WebCore::variantToSetting):
(WebCore::settingToVariant):
2009-09-17 Kenneth Rohde Christiansen <kenneth@webkit.org>
Reviewed by Simon Hausmann.
Improve documentation for Page Cache.
* Api/qwebsettings.cpp:
2009-09-17 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
Reviewed by Simon Hausmann.
[Qt] Update QWebSettings::setUserStyleSheetUrl() docs and test
https://bugs.webkit.org/show_bug.cgi?id=29081
The documentation now specifies that the URL has to be a local file
or a a data-URL (with utf-8 and base64-encoded data), as these are the
only two schemes that the current code path accepts.
The auto-test has been updated to reflect this limitation.
At a later point we should concider adding API for the new way of
doing both user defined stylesheets and scripts.
* Api/qwebsettings.cpp:
* tests/qwebpage/tst_qwebpage.cpp:
Diffstat (limited to 'src/3rdparty')
486 files changed, 9572 insertions, 6489 deletions
diff --git a/src/3rdparty/webkit/ChangeLog b/src/3rdparty/webkit/ChangeLog index 4a08347..9065b3a 100644 --- a/src/3rdparty/webkit/ChangeLog +++ b/src/3rdparty/webkit/ChangeLog @@ -1,3 +1,84 @@ +2009-09-23 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + Do not add unneeded include paths for gir files, and add the + include paths for headers manually instead of relying on our own + pc file and installed headers, since that adds a circular + dependency. + + * GNUmakefile.am: + +2009-09-23 Jan Michael Alonzo <jmalonzo@webkit.org> + + Reviewed by Xan Lopez. + + Minor reorganization to the patch landed in + http://trac.webkit.org/changeset/48670. Also move JSCore-1.0.gir + in the gtk directory as that's only useful to the Gtk port at the + moment. + + * GNUmakefile.am: + * configure.ac: + +2009-09-23 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + [GTK] We should generate our own gir file for introspection + https://bugs.webkit.org/show_bug.cgi?id=29603 + + Generate gir and typelib files for WebKit and JSCore. The JSCore + gir file is handwritten (since it's only useful, for now, as a + dependency of the WebKit gir file), the WebKit one is + autogenerated from the headers. + + * GNUmakefile.am: + * JSCore-1.0.gir: Added. + * configure.ac: + +2009-09-22 Philippe Normand <pnormand@igalia.com> + + Reviewed by Xan Lopez. + + link errors due to wrong UNICODE_LIBS on Ubuntu Jaunty + https://bugs.webkit.org/show_bug.cgi?id=29638 + + Call icu-cconfig with ldflags-libsonly to prevent having a -L + statement that could override libs installed in another prefix. + + * autotools/webkit.m4: + +2009-09-21 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + Bump version for 1.1.15 release. + + * configure.ac: + +2009-09-18 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha and Jan Alonzo. + + [GTK] context menu overriding API is very limited + https://bugs.webkit.org/show_bug.cgi?id=27546 + + Add new tests to the build. + + * GNUmakefile.am: + +2009-09-18 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha and Jan Alonzo. + + [GTK] context menu overriding API is very limited + https://bugs.webkit.org/show_bug.cgi?id=27546 + + Add WebKitHitTestResult to the build. + + * GNUmakefile.am: + 2009-09-10 Laszlo Gombos <laszlo.1.gombos@nokia.com> Reviewed by Ariya Hidayat. diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSStringRef.h b/src/3rdparty/webkit/JavaScriptCore/API/JSStringRef.h index 8b17ee2..c58b958 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/JSStringRef.h +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSStringRef.h @@ -37,7 +37,7 @@ extern "C" { #endif -#if !defined(WIN32) && !defined(_WIN32) +#if !defined(WIN32) && !defined(_WIN32) && !defined(__WINSCW__) /*! @typedef JSChar @abstract A Unicode character. diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog index 8aa8c1d..4899919 100644 --- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog +++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog @@ -1,3 +1,532 @@ +2009-09-23 Geoffrey Garen <ggaren@apple.com> + + A piece of my last patch that I forgot. + + * wtf/HashCountedSet.h: + (WTF::::clear): Added HashCountedSet::clear. + +2009-09-24 Gabor Loki <loki@inf.u-szeged.hu> + + Reviewed by Gavin Barraclough. + + Avoid __clear_cache built-in function if DISABLE_BUILTIN_CLEAR_CACHE define is set + https://bugs.webkit.org/show_bug.cgi?id=28886 + + There are some GCC packages (for example GCC-2006q3 from CodeSourcery) + which contain __clear_cache built-in function only for C while the C++ + version of __clear_cache is missing on ARM architectures. + + Fixed a small bug in the inline assembly of cacheFlush function on + ARM_TRADITIONAL. + + * jit/ExecutableAllocator.h: + (JSC::ExecutableAllocator::cacheFlush): + +2009-09-23 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Sam Weinig. + + Added the ability to swap vectors with inline capacities, so you can + store a vector with inline capacity in a hash table. + + * wtf/Vector.h: + (WTF::swap): + (WTF::VectorBuffer::swap): + +2009-09-23 David Kilzer <ddkilzer@apple.com> + + Move definition of USE(PLUGIN_HOST_PROCESS) from WebKitPrefix.h to Platform.h + + Reviewed by Mark Rowe. + + * wtf/Platform.h: Define WTF_USE_PLUGIN_HOST_PROCESS to 1 when + building on 64-bit SnowLeopard. Define to 0 elsewhere. + +2009-09-22 Oliver Hunt <oliver@apple.com> + + Reviewed by Geoff Garen. + + Code sampling builds are broken. + https://bugs.webkit.org/show_bug.cgi?id=29662 + + Fix build. + + * bytecode/EvalCodeCache.h: + (JSC::EvalCodeCache::get): + * bytecode/SamplingTool.cpp: + (JSC::ScriptSampleRecord::sample): + (JSC::SamplingTool::doRun): + (JSC::SamplingTool::notifyOfScope): + (JSC::compareScriptSampleRecords): + (JSC::SamplingTool::dump): + * bytecode/SamplingTool.h: + (JSC::ScriptSampleRecord::ScriptSampleRecord): + (JSC::ScriptSampleRecord::~ScriptSampleRecord): + (JSC::SamplingTool::SamplingTool): + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::BytecodeGenerator): + (JSC::BytecodeGenerator::emitNewFunction): + (JSC::BytecodeGenerator::emitNewFunctionExpression): + * bytecompiler/BytecodeGenerator.h: + (JSC::BytecodeGenerator::makeFunction): + * debugger/Debugger.cpp: + (JSC::evaluateInGlobalCallFrame): + * debugger/DebuggerCallFrame.cpp: + (JSC::DebuggerCallFrame::evaluate): + * parser/Nodes.cpp: + (JSC::ScopeNode::ScopeNode): + * runtime/Completion.cpp: + (JSC::checkSyntax): + (JSC::evaluate): + * runtime/Executable.cpp: + (JSC::FunctionExecutable::fromGlobalCode): + * runtime/Executable.h: + (JSC::ScriptExecutable::ScriptExecutable): + (JSC::EvalExecutable::EvalExecutable): + (JSC::EvalExecutable::create): + (JSC::ProgramExecutable::ProgramExecutable): + (JSC::FunctionExecutable::create): + (JSC::FunctionExecutable::FunctionExecutable): + * runtime/JSGlobalObjectFunctions.cpp: + (JSC::globalFuncEval): + +2009-09-22 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + * wtf/Forward.h: Added PassOwnPtr. + +2009-09-22 Yaar Schnitman <yaar@chromium.org> + + Reviewed by David Levin. + + Ported chromium.org's javascriptcore.gyp for the webkit chromium port. + + https://bugs.webkit.org/show_bug.cgi?id=29617 + + * JavaScriptCore.gyp/JavaScriptCore.gyp: Added. + +2009-09-22 Thiago Macieira <thiago.macieira@nokia.com> + + Reviewed by Simon Hausmann. + + Fix compilation with WINSCW: no varargs macros + + Disable variadic arguments for WINSCW just like we do + for MSVC7. + + * wtf/Assertions.h: + +2009-09-22 Kent Hansen <khansen@trolltech.com> + + Reviewed by Simon Hausmann. + + Disable variadic macros on MSVC7. + + This was originally added in r26589 but not extended + when LOG_DISABLED/ASSERT_DISABLED was introduced. + + * wtf/Assertions.h: + +2009-09-22 Simon Hausmann <simon.hausmann@nokia.com> + + Unreviewed build fix for Windows CE < 5 + + Define WINCEBASIC to disable the IsDebuggerPresent() code in + wtf/Assertions.cpp. + + * JavaScriptCore.pri: + +2009-09-22 Joerg Bornemann <joerg.bornemann@nokia.com> + + Reviewed by Simon Hausmann. + + Fix major memory leak in JavaScriptCore RegisterFile on Windows CE + + https://bugs.webkit.org/show_bug.cgi?id=29367 + + On Widows CE we must decommit all committed pages before we release + them. See VirtualFree documentation. + Desktop Windows behaves much smoother in this situation. + + * interpreter/RegisterFile.cpp: + (JSC::RegisterFile::~RegisterFile): + +2009-09-21 Greg Bolsinga <bolsinga@apple.com> + + Reviewed by Simon Fraser & Sam Weinig. + + Add ENABLE(ORIENTATION_EVENTS) + https://bugs.webkit.org/show_bug.cgi?id=29508 + + * wtf/Platform.h: Also sort PLATFORM(IPHONE) #defines. + +2009-09-21 Jedrzej Nowacki <jedrzej.nowacki@nokia.com> + + Reviewed by Eric Seidel. + + [Fix] SourceCode's uninitialized member + + Potential source of crashes and bugs was fixed. Default constructor + didn't initialized m_provider member. + + https://bugs.webkit.org/show_bug.cgi?id=29364 + + * parser/SourceCode.h: + (JSC::SourceCode::SourceCode): + +2009-09-21 Oliver Hunt <oliver@apple.com> + + Reviewed by Geoff Garen. + + REGRESSION (r48582): Crash in StructureStubInfo::initPutByIdTransition when reloading trac.webkit.org + https://bugs.webkit.org/show_bug.cgi?id=29599 + + It is unsafe to attempt to cache new property transitions on + dictionaries of any type. + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::tryCachePutByID): + * jit/JITStubs.cpp: + (JSC::JITThunks::tryCachePutByID): + +2009-09-21 Oliver Hunt <oliver@apple.com> + + RS=Maciej Stachowiak. + + Re-land SNES fix with corrected assertion. + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::resolveGlobal): + (JSC::Interpreter::tryCachePutByID): + (JSC::Interpreter::tryCacheGetByID): + * jit/JITStubs.cpp: + (JSC::JITThunks::tryCachePutByID): + (JSC::JITThunks::tryCacheGetByID): + (JSC::DEFINE_STUB_FUNCTION): + * runtime/BatchedTransitionOptimizer.h: + (JSC::BatchedTransitionOptimizer::BatchedTransitionOptimizer): + * runtime/JSObject.cpp: + (JSC::JSObject::removeDirect): + * runtime/Structure.cpp: + (JSC::Structure::Structure): + (JSC::Structure::getEnumerablePropertyNames): + (JSC::Structure::despecifyDictionaryFunction): + (JSC::Structure::addPropertyTransitionToExistingStructure): + (JSC::Structure::addPropertyTransition): + (JSC::Structure::removePropertyTransition): + (JSC::Structure::toDictionaryTransition): + (JSC::Structure::toCacheableDictionaryTransition): + (JSC::Structure::toUncacheableDictionaryTransition): + (JSC::Structure::fromDictionaryTransition): + (JSC::Structure::removePropertyWithoutTransition): + * runtime/Structure.h: + (JSC::Structure::isDictionary): + (JSC::Structure::isUncacheableDictionary): + (JSC::Structure::): + * runtime/StructureChain.cpp: + (JSC::StructureChain::isCacheable): + +2009-09-21 Adam Roben <aroben@apple.com> + + Revert r48573, as it caused many assertion failures + + * interpreter/Interpreter.cpp: + * jit/JITStubs.cpp: + * runtime/BatchedTransitionOptimizer.h: + * runtime/JSObject.cpp: + * runtime/Structure.cpp: + * runtime/Structure.h: + * runtime/StructureChain.cpp: + +2009-09-21 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Unreviewed make dist build fix. Missing files. + + * GNUmakefile.am: + +2009-09-19 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Sam 'Cabin Boy' Weinig. + + Fix stack alignment with ARM THUMB2 JIT. + https://bugs.webkit.org/show_bug.cgi?id=29526 + + Stack is currently being decremented by 0x3c, bump this to 0x40 to make this a + multiple of 16 bytes. + + * jit/JITStubs.cpp: + (JSC::JITThunks::JITThunks): + * jit/JITStubs.h: + +2009-09-20 Oliver Hunt <oliver@apple.com> + + Reviewed by Maciej Stachowiak. + + SNES is too slow + https://bugs.webkit.org/show_bug.cgi?id=29534 + + The problem was that the emulator used multiple classes with + more properties than our dictionary cutoff allowed, this resulted + in more or less all critical logic inside the emulator requiring + uncached property access. + + Rather than simply bumping the dictionary cutoff, this patch + recognises that there are two ways to create a "dictionary" + structure. Either by adding a large number of properties, or + by removing a property. In the case of adding properties we + know all the existing properties will maintain their existing + offsets, so we could cache access to those properties, if we + know they won't be removed. + + To make this possible, this patch adds the logic required to + distinguish a dictionary created by addition from one created + by removal. With this logic in place we can now cache access + to objects with large numbers of properties. + + SNES performance improved by more than 6x. + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::resolveGlobal): + (JSC::Interpreter::tryCachePutByID): + (JSC::Interpreter::tryCacheGetByID): + * jit/JITStubs.cpp: + (JSC::JITThunks::tryCachePutByID): + (JSC::JITThunks::tryCacheGetByID): + (JSC::DEFINE_STUB_FUNCTION): + * runtime/BatchedTransitionOptimizer.h: + (JSC::BatchedTransitionOptimizer::BatchedTransitionOptimizer): + * runtime/JSObject.cpp: + (JSC::JSObject::removeDirect): + * runtime/Structure.cpp: + (JSC::Structure::Structure): + (JSC::Structure::getEnumerablePropertyNames): + (JSC::Structure::despecifyDictionaryFunction): + (JSC::Structure::addPropertyTransitionToExistingStructure): + (JSC::Structure::addPropertyTransition): + (JSC::Structure::removePropertyTransition): + (JSC::Structure::toDictionaryTransition): + (JSC::Structure::toCacheableDictionaryTransition): + (JSC::Structure::toUncacheableDictionaryTransition): + (JSC::Structure::fromDictionaryTransition): + (JSC::Structure::removePropertyWithoutTransition): + * runtime/Structure.h: + (JSC::Structure::isDictionary): + (JSC::Structure::isUncacheableDictionary): + (JSC::Structure::): + * runtime/StructureChain.cpp: + (JSC::StructureChain::isCacheable): + +2009-09-19 Oliver Hunt <oliver@apple.com> + + Reviewed by Maciej Stachowiak. + + Implement ES5 Object.create function + https://bugs.webkit.org/show_bug.cgi?id=29524 + + Implement Object.create. Very simple patch, effectively Object.defineProperties + only creating the target object itself. + + * runtime/CommonIdentifiers.h: + * runtime/ObjectConstructor.cpp: + (JSC::ObjectConstructor::ObjectConstructor): + (JSC::objectConstructorCreate): + +2009-09-19 Dan Bernstein <mitz@apple.com> + + Fix clean debug builds. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-09-19 Joerg Bornemann <joerg.bornemann@nokia.com> + + Reviewed by George Staikos. + + QtWebKit Windows CE compile fix + + https://bugs.webkit.org/show_bug.cgi?id=29379 + + There is no _aligned_alloc or _aligned_free on Windows CE. + We just use the Windows code that was there before and use VirtualAlloc. + But that also means that the BLOCK_SIZE must be 64K as this function + allocates on 64K boundaries. + + * runtime/Collector.cpp: + (JSC::Heap::allocateBlock): + (JSC::Heap::freeBlock): + * runtime/Collector.h: + +2009-09-19 Oliver Hunt <oliver@apple.com> + + Reviewed by Sam Weinig. + + Implement ES5 Object.defineProperties function + https://bugs.webkit.org/show_bug.cgi?id=29522 + + Implement Object.defineProperties. Fairly simple patch, simply makes use of + existing functionality used for defineProperty. + + * runtime/CommonIdentifiers.h: + * runtime/ObjectConstructor.cpp: + (JSC::ObjectConstructor::ObjectConstructor): + (JSC::defineProperties): + (JSC::objectConstructorDefineProperties): + +2009-09-19 Oliver Hunt <oliver@apple.com> + + Reviewed by NOBODY (Build fix). + + Windows build fix part2 + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-09-19 Oliver Hunt <oliver@apple.com> + + Reviewed by NOBODY (Buildfix). + + Windows build fix part 1. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-09-18 Oliver Hunt <oliver@apple.com> + + Reviewed by Geoff Garen. + + Implement ES5 Object.defineProperty function + https://bugs.webkit.org/show_bug.cgi?id=29503 + + Implement Object.defineProperty. This requires adding the API to + ObjectConstructor, along with a helper function that implements the + ES5 internal [[ToPropertyDescriptor]] function. It then adds + JSObject::defineOwnProperty that implements the appropriate ES5 semantics. + Currently defineOwnProperty uses a delete followed by a put to redefine + attributes of a property, clearly this is less efficient than it could be + but we can improve this if it needs to be possible in future. + + * JavaScriptCore.exp: + * debugger/DebuggerActivation.cpp: + (JSC::DebuggerActivation::defineGetter): + (JSC::DebuggerActivation::defineSetter): + * debugger/DebuggerActivation.h: + * interpreter/Interpreter.cpp: + (JSC::Interpreter::privateExecute): + * jit/JITStubs.cpp: + Update defineGetter/Setter calls + * runtime/CommonIdentifiers.h: + * runtime/JSArray.cpp: + (JSC::JSArray::getOwnPropertySlot): + * runtime/JSGlobalObject.cpp: + (JSC::JSGlobalObject::defineGetter): + (JSC::JSGlobalObject::defineSetter): + * runtime/JSGlobalObject.h: + * runtime/JSObject.cpp: + (JSC::JSObject::defineGetter): + (JSC::JSObject::defineSetter): + (JSC::putDescriptor): + (JSC::JSObject::defineOwnProperty): + * runtime/JSObject.h: + * runtime/ObjectConstructor.cpp: + (JSC::ObjectConstructor::ObjectConstructor): + (JSC::objectConstructorGetOwnPropertyDescriptor): + (JSC::toPropertyDescriptor): + (JSC::objectConstructorDefineProperty): + * runtime/ObjectPrototype.cpp: + (JSC::objectProtoFuncDefineGetter): + (JSC::objectProtoFuncDefineSetter): + * runtime/PropertyDescriptor.cpp: + (JSC::PropertyDescriptor::writable): + (JSC::PropertyDescriptor::enumerable): + (JSC::PropertyDescriptor::configurable): + (JSC::PropertyDescriptor::isDataDescriptor): + (JSC::PropertyDescriptor::isGenericDescriptor): + (JSC::PropertyDescriptor::isAccessorDescriptor): + (JSC::PropertyDescriptor::getter): + (JSC::PropertyDescriptor::setter): + (JSC::PropertyDescriptor::setDescriptor): + (JSC::PropertyDescriptor::setAccessorDescriptor): + (JSC::PropertyDescriptor::setWritable): + (JSC::PropertyDescriptor::setEnumerable): + (JSC::PropertyDescriptor::setConfigurable): + (JSC::PropertyDescriptor::setSetter): + (JSC::PropertyDescriptor::setGetter): + (JSC::PropertyDescriptor::equalTo): + (JSC::PropertyDescriptor::attributesEqual): + (JSC::PropertyDescriptor::attributesWithOverride): + * runtime/PropertyDescriptor.h: + (JSC::PropertyDescriptor::PropertyDescriptor): + (JSC::PropertyDescriptor::value): + (JSC::PropertyDescriptor::setValue): + (JSC::PropertyDescriptor::isEmpty): + (JSC::PropertyDescriptor::writablePresent): + (JSC::PropertyDescriptor::enumerablePresent): + (JSC::PropertyDescriptor::configurablePresent): + (JSC::PropertyDescriptor::setterPresent): + (JSC::PropertyDescriptor::getterPresent): + (JSC::PropertyDescriptor::operator==): + (JSC::PropertyDescriptor::): + +2009-09-18 Gabor Loki <loki@inf.u-szeged.hu> + + Reviewed by Gavin Barraclough. + + Build fix to enable ARM_THUMB2 on Linux + https://bugs.webkit.org/show_bug.cgi?id= + + * jit/ExecutableAllocator.h: + (JSC::ExecutableAllocator::cacheFlush): + * jit/JITStubs.cpp: + * wtf/Platform.h: + +2009-09-18 Gabor Loki <loki@inf.u-szeged.hu> + + Reviewed by Gavin Barraclough. + + Defines two pseudo-platforms for ARM and Thumb-2 instruction set. + https://bugs.webkit.org/show_bug.cgi?id=29122 + + Introduces WTF_PLATFORM_ARM_TRADITIONAL and WTF_PLATFORM_ARM_THUMB2 + macros on ARM platforms. The PLATFORM(ARM_THUMB2) should be used + when Thumb-2 instruction set is the required target. The + PLATFORM(ARM_TRADITIONAL) is for generic ARM instruction set. In + case where the code is common the PLATFORM(ARM) have to be used. + + * assembler/ARMAssembler.cpp: + * assembler/ARMAssembler.h: + * assembler/ARMv7Assembler.h: + * assembler/MacroAssembler.h: + * assembler/MacroAssemblerARM.cpp: + * assembler/MacroAssemblerARM.h: + * assembler/MacroAssemblerCodeRef.h: + (JSC::MacroAssemblerCodePtr::MacroAssemblerCodePtr): + * jit/ExecutableAllocator.h: + * jit/JIT.h: + * jit/JITInlineMethods.h: + (JSC::JIT::beginUninterruptedSequence): + (JSC::JIT::preserveReturnAddressAfterCall): + (JSC::JIT::restoreReturnAddressBeforeReturn): + (JSC::JIT::restoreArgumentReference): + (JSC::JIT::restoreArgumentReferenceForTrampoline): + * jit/JITOpcodes.cpp: + * jit/JITStubs.cpp: + (JSC::JITThunks::JITThunks): + * jit/JITStubs.h: + * wtf/Platform.h: + * yarr/RegexJIT.cpp: + (JSC::Yarr::RegexGenerator::generateEnter): + +2009-09-18 Joerg Bornemann <joerg.bornemann@nokia.com> + + Reviewed by Simon Hausmann. + + Fix the Qt/Windows CE build. + + * JavaScriptCore.pri: Build the ce_time.cpp functions from + within Qt externally. + * wtf/DateMath.cpp: Removed unnecessary Qt #ifdef, for the + Qt build these functions are no external, too. + 2009-09-17 Janne Koskinen <janne.p.koskinen@digia.com> Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri index bd80add..7a815e3 100644 --- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri +++ b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri @@ -50,10 +50,9 @@ win32-* { } } -win32-msvc*: INCLUDEPATH += $$PWD/os-win32 wince* { - INCLUDEPATH += $$PWD/os-win32 SOURCES += $$QT_SOURCE_TREE/src/3rdparty/ce-compat/ce_time.cpp + DEFINES += WINCEBASIC } include(pcre/pcre.pri) diff --git a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro new file mode 100644 index 0000000..0cd2e1a --- /dev/null +++ b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro @@ -0,0 +1,69 @@ +# JavaScriptCore - qmake build info +CONFIG += building-libs +include($$PWD/../WebKit.pri) + +TEMPLATE = lib +CONFIG += staticlib +TARGET = JavaScriptCore + +CONFIG += depend_includepath + +contains(QT_CONFIG, embedded):CONFIG += embedded + +CONFIG(QTDIR_build) { + GENERATED_SOURCES_DIR = $$PWD/generated + OLDDESTDIR = $$DESTDIR + include($$QT_SOURCE_TREE/src/qbase.pri) + INSTALLS = + DESTDIR = $$OLDDESTDIR + PRECOMPILED_HEADER = $$PWD/../WebKit/qt/WebKit_pch.h + DEFINES *= NDEBUG +} + +isEmpty(GENERATED_SOURCES_DIR):GENERATED_SOURCES_DIR = tmp +GENERATED_SOURCES_DIR_SLASH = $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP} + +INCLUDEPATH += $$GENERATED_SOURCES_DIR + +!CONFIG(QTDIR_build) { + CONFIG(debug, debug|release) { + OBJECTS_DIR = obj/debug + } else { # Release + OBJECTS_DIR = obj/release + } +} + +CONFIG(release):!CONFIG(QTDIR_build) { + contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols + unix:contains(QT_CONFIG, reduce_relocations):CONFIG += bsymbolic_functions +} + +linux-*: DEFINES += HAVE_STDINT_H +freebsd-*: DEFINES += HAVE_PTHREAD_NP_H + +DEFINES += BUILD_WEBKIT + +win32-*: DEFINES += _HAS_TR1=0 + +# Pick up 3rdparty libraries from INCLUDE/LIB just like with MSVC +win32-g++ { + TMPPATH = $$quote($$(INCLUDE)) + QMAKE_INCDIR_POST += $$split(TMPPATH,";") + TMPPATH = $$quote($$(LIB)) + QMAKE_LIBDIR_POST += $$split(TMPPATH,";") +} + +DEFINES += WTF_USE_JAVASCRIPTCORE_BINDINGS=1 + +DEFINES += WTF_CHANGES=1 + +include(JavaScriptCore.pri) + +QMAKE_EXTRA_TARGETS += generated_files + +lessThan(QT_MINOR_VERSION, 4) { + DEFINES += QT_BEGIN_NAMESPACE="" QT_END_NAMESPACE="" +} + +*-g++*:QMAKE_CXXFLAGS_RELEASE -= -O2 +*-g++*:QMAKE_CXXFLAGS_RELEASE += -O3 diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.cpp b/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.cpp index 77d7a53..1324586 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.cpp @@ -26,7 +26,7 @@ #include "config.h" -#if ENABLE(ASSEMBLER) && PLATFORM(ARM) +#if ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) #include "ARMAssembler.h" @@ -390,4 +390,4 @@ void* ARMAssembler::executableCopy(ExecutablePool* allocator) } // namespace JSC -#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM) +#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.h b/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.h index 0b04bb4..9f9a450 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.h @@ -29,7 +29,7 @@ #include <wtf/Platform.h> -#if ENABLE(ASSEMBLER) && PLATFORM(ARM) +#if ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) #include "AssemblerBufferWithConstantPool.h" #include <wtf/Assertions.h> @@ -764,6 +764,6 @@ namespace JSC { } // namespace JSC -#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM) +#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) #endif // ARMAssembler_h diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/ARMv7Assembler.h b/src/3rdparty/webkit/JavaScriptCore/assembler/ARMv7Assembler.h index e920255..078de44 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/ARMv7Assembler.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/ARMv7Assembler.h @@ -28,7 +28,7 @@ #include <wtf/Platform.h> -#if ENABLE(ASSEMBLER) && PLATFORM_ARM_ARCH(7) +#if ENABLE(ASSEMBLER) && PLATFORM(ARM_THUMB2) #include "AssemblerBuffer.h" #include <wtf/Assertions.h> @@ -1753,6 +1753,6 @@ private: } // namespace JSC -#endif // ENABLE(ASSEMBLER) && PLATFORM_ARM_ARCH(7) +#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM_THUMB2) #endif // ARMAssembler_h diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssembler.h b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssembler.h index 9e1c5d3..2743ab4 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssembler.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssembler.h @@ -30,11 +30,11 @@ #if ENABLE(ASSEMBLER) -#if PLATFORM_ARM_ARCH(7) +#if PLATFORM(ARM_THUMB2) #include "MacroAssemblerARMv7.h" namespace JSC { typedef MacroAssemblerARMv7 MacroAssemblerBase; }; -#elif PLATFORM(ARM) +#elif PLATFORM(ARM_TRADITIONAL) #include "MacroAssemblerARM.h" namespace JSC { typedef MacroAssemblerARM MacroAssemblerBase; }; diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.cpp b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.cpp index 33fac64..43648c4 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.cpp @@ -26,7 +26,7 @@ #include "config.h" -#if ENABLE(ASSEMBLER) && PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7) +#if ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) #include "MacroAssemblerARM.h" @@ -64,4 +64,4 @@ const bool MacroAssemblerARM::s_isVFPPresent = isVFPPresent(); } -#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7) +#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.h b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.h index 4a7c10a..0c696c9 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.h @@ -30,7 +30,7 @@ #include <wtf/Platform.h> -#if ENABLE(ASSEMBLER) && PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7) +#if ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) #include "ARMAssembler.h" #include "AbstractMacroAssembler.h" @@ -797,6 +797,6 @@ private: } -#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7) +#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) #endif // MacroAssemblerARM_h diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerCodeRef.h b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerCodeRef.h index 341a7ff..568260a 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerCodeRef.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerCodeRef.h @@ -37,7 +37,7 @@ // ASSERT_VALID_CODE_POINTER checks that ptr is a non-null pointer, and that it is a valid // instruction address on the platform (for example, check any alignment requirements). -#if PLATFORM_ARM_ARCH(7) +#if PLATFORM(ARM_THUMB2) // ARM/thumb instructions must be 16-bit aligned, but all code pointers to be loaded // into the processor are decorated with the bottom bit set, indicating that this is // thumb code (as oposed to 32-bit traditional ARM). The first test checks for both @@ -124,7 +124,7 @@ public: } explicit MacroAssemblerCodePtr(void* value) -#if PLATFORM_ARM_ARCH(7) +#if PLATFORM(ARM_THUMB2) // Decorate the pointer as a thumb code pointer. : m_value(reinterpret_cast<char*>(value) + 1) #else @@ -141,7 +141,7 @@ public: } void* executableAddress() const { return m_value; } -#if PLATFORM_ARM_ARCH(7) +#if PLATFORM(ARM_THUMB2) // To use this pointer as a data address remove the decoration. void* dataLocation() const { ASSERT_VALID_CODE_POINTER(m_value); return reinterpret_cast<char*>(m_value) - 1; } #else diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/EvalCodeCache.h b/src/3rdparty/webkit/JavaScriptCore/bytecode/EvalCodeCache.h index 0e1fb1e..05834fc 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecode/EvalCodeCache.h +++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/EvalCodeCache.h @@ -50,7 +50,7 @@ namespace JSC { evalExecutable = m_cacheMap.get(evalSource.rep()); if (!evalExecutable) { - evalExecutable = EvalExecutable::create(makeSource(evalSource)); + evalExecutable = EvalExecutable::create(exec, makeSource(evalSource)); exceptionValue = evalExecutable->compile(exec, scopeChain); if (exceptionValue) return 0; diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/SamplingTool.cpp b/src/3rdparty/webkit/JavaScriptCore/bytecode/SamplingTool.cpp index 8d0faa1..865c919 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecode/SamplingTool.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/SamplingTool.cpp @@ -157,7 +157,7 @@ void SamplingThread::stop() } -void ScopeSampleRecord::sample(CodeBlock* codeBlock, Instruction* vPC) +void ScriptSampleRecord::sample(CodeBlock* codeBlock, Instruction* vPC) { if (!m_samples) { m_size = codeBlock->instructions().size(); @@ -196,8 +196,8 @@ void SamplingTool::doRun() #if ENABLE(CODEBLOCK_SAMPLING) if (CodeBlock* codeBlock = sample.codeBlock()) { - MutexLocker locker(m_scopeSampleMapMutex); - ScopeSampleRecord* record = m_scopeSampleMap->get(codeBlock->ownerExecutable()); + MutexLocker locker(m_scriptSampleMapMutex); + ScriptSampleRecord* record = m_scopeSampleMap->get(codeBlock->ownerExecutable()); ASSERT(record); record->sample(codeBlock, sample.vPC()); } @@ -209,13 +209,13 @@ void SamplingTool::sample() s_samplingTool->doRun(); } -void SamplingTool::notifyOfScope(ScopeNode* scope) +void SamplingTool::notifyOfScope(ScriptExecutable* script) { #if ENABLE(CODEBLOCK_SAMPLING) - MutexLocker locker(m_scopeSampleMapMutex); - m_scopeSampleMap->set(scope, new ScopeSampleRecord(scope)); + MutexLocker locker(m_scriptSampleMapMutex); + m_scopeSampleMap->set(script, new ScriptSampleRecord(script)); #else - UNUSED_PARAM(scope); + UNUSED_PARAM(script); #endif } @@ -254,10 +254,10 @@ static int compareLineCountInfoSampling(const void* left, const void* right) return (leftLineCount->line > rightLineCount->line) ? 1 : (leftLineCount->line < rightLineCount->line) ? -1 : 0; } -static int compareScopeSampleRecords(const void* left, const void* right) +static int compareScriptSampleRecords(const void* left, const void* right) { - const ScopeSampleRecord* const leftValue = *static_cast<const ScopeSampleRecord* const *>(left); - const ScopeSampleRecord* const rightValue = *static_cast<const ScopeSampleRecord* const *>(right); + const ScriptSampleRecord* const leftValue = *static_cast<const ScriptSampleRecord* const *>(left); + const ScriptSampleRecord* const rightValue = *static_cast<const ScriptSampleRecord* const *>(right); return (leftValue->m_sampleCount < rightValue->m_sampleCount) ? 1 : (leftValue->m_sampleCount > rightValue->m_sampleCount) ? -1 : 0; } @@ -318,26 +318,26 @@ void SamplingTool::dump(ExecState* exec) // (3) Build and sort 'codeBlockSamples' array. int scopeCount = m_scopeSampleMap->size(); - Vector<ScopeSampleRecord*> codeBlockSamples(scopeCount); - ScopeSampleRecordMap::iterator iter = m_scopeSampleMap->begin(); + Vector<ScriptSampleRecord*> codeBlockSamples(scopeCount); + ScriptSampleRecordMap::iterator iter = m_scopeSampleMap->begin(); for (int i = 0; i < scopeCount; ++i, ++iter) codeBlockSamples[i] = iter->second; - qsort(codeBlockSamples.begin(), scopeCount, sizeof(ScopeSampleRecord*), compareScopeSampleRecords); + qsort(codeBlockSamples.begin(), scopeCount, sizeof(ScriptSampleRecord*), compareScriptSampleRecords); // (4) Print data from 'codeBlockSamples' array. printf("\nCodeBlock samples\n\n"); for (int i = 0; i < scopeCount; ++i) { - ScopeSampleRecord* record = codeBlockSamples[i]; + ScriptSampleRecord* record = codeBlockSamples[i]; CodeBlock* codeBlock = record->m_codeBlock; double blockPercent = (record->m_sampleCount * 100.0) / m_sampleCount; if (blockPercent >= 1) { //Instruction* code = codeBlock->instructions().begin(); - printf("#%d: %s:%d: %d / %lld (%.3f%%)\n", i + 1, record->m_scope->sourceURL().UTF8String().c_str(), codeBlock->lineNumberForBytecodeOffset(exec, 0), record->m_sampleCount, m_sampleCount, blockPercent); + printf("#%d: %s:%d: %d / %lld (%.3f%%)\n", i + 1, record->m_executable->sourceURL().UTF8String().c_str(), codeBlock->lineNumberForBytecodeOffset(exec, 0), record->m_sampleCount, m_sampleCount, blockPercent); if (i < 10) { HashMap<unsigned,unsigned> lineCounts; codeBlock->dump(exec); diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/SamplingTool.h b/src/3rdparty/webkit/JavaScriptCore/bytecode/SamplingTool.h index 1a3f7cf..711b086 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecode/SamplingTool.h +++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/SamplingTool.h @@ -38,6 +38,8 @@ namespace JSC { + class ScriptExecutable; + class SamplingFlags { friend class JIT; public: @@ -92,9 +94,9 @@ namespace JSC { class ScopeNode; struct Instruction; - struct ScopeSampleRecord { - ScopeSampleRecord(ScopeNode* scope) - : m_scope(scope) + struct ScriptSampleRecord { + ScriptSampleRecord(ScriptExecutable* executable) + : m_executable(executable) , m_codeBlock(0) , m_sampleCount(0) , m_opcodeSampleCount(0) @@ -103,7 +105,7 @@ namespace JSC { { } - ~ScopeSampleRecord() + ~ScriptSampleRecord() { if (m_samples) free(m_samples); @@ -111,7 +113,7 @@ namespace JSC { void sample(CodeBlock*, Instruction*); - RefPtr<ScopeNode> m_scope; + ScriptExecutable* m_executable; CodeBlock* m_codeBlock; int m_sampleCount; int m_opcodeSampleCount; @@ -119,7 +121,7 @@ namespace JSC { unsigned m_size; }; - typedef WTF::HashMap<ScopeNode*, ScopeSampleRecord*> ScopeSampleRecordMap; + typedef WTF::HashMap<ScriptExecutable*, ScriptSampleRecord*> ScriptSampleRecordMap; class SamplingThread { public: @@ -193,7 +195,7 @@ namespace JSC { , m_sampleCount(0) , m_opcodeSampleCount(0) #if ENABLE(CODEBLOCK_SAMPLING) - , m_scopeSampleMap(new ScopeSampleRecordMap()) + , m_scopeSampleMap(new ScriptSampleRecordMap()) #endif { memset(m_opcodeSamples, 0, sizeof(m_opcodeSamples)); @@ -210,7 +212,7 @@ namespace JSC { void setup(); void dump(ExecState*); - void notifyOfScope(ScopeNode* scope); + void notifyOfScope(ScriptExecutable* scope); void sample(CodeBlock* codeBlock, Instruction* vPC) { @@ -266,8 +268,8 @@ namespace JSC { unsigned m_opcodeSamplesInCTIFunctions[numOpcodeIDs]; #if ENABLE(CODEBLOCK_SAMPLING) - Mutex m_scopeSampleMapMutex; - OwnPtr<ScopeSampleRecordMap> m_scopeSampleMap; + Mutex m_scriptSampleMapMutex; + OwnPtr<ScriptSampleRecordMap> m_scopeSampleMap; #endif }; diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp index af8f784..8951ce3 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp @@ -273,7 +273,7 @@ BytecodeGenerator::BytecodeGenerator(ProgramNode* programNode, const Debugger* d } else { for (size_t i = 0; i < functionStack.size(); ++i) { FunctionBodyNode* function = functionStack[i]; - globalObject->putWithAttributes(exec, function->ident(), new (exec) JSFunction(exec, makeFunction(function), scopeChain.node()), DontDelete); + globalObject->putWithAttributes(exec, function->ident(), new (exec) JSFunction(exec, makeFunction(exec, function), scopeChain.node()), DontDelete); } for (size_t i = 0; i < varStack.size(); ++i) { if (globalObject->hasProperty(exec, *varStack[i].first)) @@ -399,7 +399,7 @@ BytecodeGenerator::BytecodeGenerator(EvalNode* evalNode, const Debugger* debugge const DeclarationStacks::FunctionStack& functionStack = evalNode->functionStack(); for (size_t i = 0; i < functionStack.size(); ++i) - m_codeBlock->addFunctionDecl(makeFunction(functionStack[i])); + m_codeBlock->addFunctionDecl(makeFunction(m_globalData, functionStack[i])); const DeclarationStacks::VarStack& varStack = evalNode->varStack(); unsigned numVariables = varStack.size(); @@ -1316,7 +1316,7 @@ RegisterID* BytecodeGenerator::emitNewArray(RegisterID* dst, ElementNode* elemen RegisterID* BytecodeGenerator::emitNewFunction(RegisterID* dst, FunctionBodyNode* function) { - unsigned index = m_codeBlock->addFunctionDecl(makeFunction(function)); + unsigned index = m_codeBlock->addFunctionDecl(makeFunction(m_globalData, function)); emitOpcode(op_new_func); instructions().append(dst->index()); @@ -1336,7 +1336,7 @@ RegisterID* BytecodeGenerator::emitNewRegExp(RegisterID* dst, RegExp* regExp) RegisterID* BytecodeGenerator::emitNewFunctionExpression(RegisterID* r0, FuncExprNode* n) { FunctionBodyNode* function = n->body(); - unsigned index = m_codeBlock->addFunctionExpr(makeFunction(function)); + unsigned index = m_codeBlock->addFunctionExpr(makeFunction(m_globalData, function)); emitOpcode(op_new_func_exp); instructions().append(r0->index()); diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.h b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.h index 650b362..1a83ce9 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.h +++ b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.h @@ -417,9 +417,14 @@ namespace JSC { RegisterID* addConstantValue(JSValue); unsigned addRegExp(RegExp*); - PassRefPtr<FunctionExecutable> makeFunction(FunctionBodyNode* body) + PassRefPtr<FunctionExecutable> makeFunction(ExecState* exec, FunctionBodyNode* body) { - return FunctionExecutable::create(body->ident(), body->source(), body->usesArguments(), body->parameters(), body->lineNo(), body->lastLine()); + return FunctionExecutable::create(exec, body->ident(), body->source(), body->usesArguments(), body->parameters(), body->lineNo(), body->lastLine()); + } + + PassRefPtr<FunctionExecutable> makeFunction(JSGlobalData* globalData, FunctionBodyNode* body) + { + return FunctionExecutable::create(globalData, body->ident(), body->source(), body->usesArguments(), body->parameters(), body->lineNo(), body->lastLine()); } Vector<Instruction>& instructions() { return m_codeBlock->instructions(); } diff --git a/src/3rdparty/webkit/JavaScriptCore/debugger/Debugger.cpp b/src/3rdparty/webkit/JavaScriptCore/debugger/Debugger.cpp index 61167d4..db02329 100644 --- a/src/3rdparty/webkit/JavaScriptCore/debugger/Debugger.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/debugger/Debugger.cpp @@ -100,7 +100,7 @@ JSValue evaluateInGlobalCallFrame(const UString& script, JSValue& exception, JSG { CallFrame* globalCallFrame = globalObject->globalExec(); - EvalExecutable eval(makeSource(script)); + EvalExecutable eval(globalCallFrame, makeSource(script)); JSObject* error = eval.compile(globalCallFrame, globalCallFrame->scopeChain()); if (error) return error; diff --git a/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.cpp b/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.cpp index 7a68d7d..5cc9a9f 100644 --- a/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.cpp @@ -81,14 +81,14 @@ bool DebuggerActivation::getPropertyAttributes(JSC::ExecState* exec, const Ident return m_activation->getPropertyAttributes(exec, propertyName, attributes); } -void DebuggerActivation::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunction) +void DebuggerActivation::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes) { - m_activation->defineGetter(exec, propertyName, getterFunction); + m_activation->defineGetter(exec, propertyName, getterFunction, attributes); } -void DebuggerActivation::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunction) +void DebuggerActivation::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes) { - m_activation->defineSetter(exec, propertyName, setterFunction); + m_activation->defineSetter(exec, propertyName, setterFunction, attributes); } JSValue DebuggerActivation::lookupGetter(ExecState* exec, const Identifier& propertyName) diff --git a/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.h b/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.h index 06aea5a..dd34265 100644 --- a/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.h +++ b/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.h @@ -44,8 +44,8 @@ namespace JSC { virtual bool deleteProperty(ExecState*, const Identifier& propertyName); virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&); virtual bool getPropertyAttributes(ExecState*, const Identifier& propertyName, unsigned& attributes) const; - virtual void defineGetter(ExecState*, const Identifier& propertyName, JSObject* getterFunction); - virtual void defineSetter(ExecState*, const Identifier& propertyName, JSObject* setterFunction); + virtual void defineGetter(ExecState*, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes); + virtual void defineSetter(ExecState*, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes); virtual JSValue lookupGetter(ExecState*, const Identifier& propertyName); virtual JSValue lookupSetter(ExecState*, const Identifier& propertyName); diff --git a/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerCallFrame.cpp b/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerCallFrame.cpp index 9c8ca2a..88b14e6 100644 --- a/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerCallFrame.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerCallFrame.cpp @@ -79,7 +79,7 @@ JSValue DebuggerCallFrame::evaluate(const UString& script, JSValue& exception) c if (!m_callFrame->codeBlock()) return JSValue(); - EvalExecutable eval(makeSource(script)); + EvalExecutable eval(m_callFrame, makeSource(script)); JSObject* error = eval.compile(m_callFrame, m_callFrame->scopeChain()); if (error) return error; diff --git a/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp b/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp index 4560db0..8a8fb3c 100644 --- a/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp @@ -169,7 +169,7 @@ NEVER_INLINE bool Interpreter::resolveGlobal(CallFrame* callFrame, Instruction* PropertySlot slot(globalObject); if (globalObject->getPropertySlot(callFrame, ident, slot)) { JSValue result = slot.getValue(callFrame, ident); - if (slot.isCacheable() && !globalObject->structure()->isDictionary() && slot.slotBase() == globalObject) { + if (slot.isCacheable() && !globalObject->structure()->isUncacheableDictionary() && slot.slotBase() == globalObject) { if (vPC[4].u.structure) vPC[4].u.structure->deref(); globalObject->structure()->ref(); @@ -953,7 +953,7 @@ NEVER_INLINE void Interpreter::tryCachePutByID(CallFrame* callFrame, CodeBlock* JSCell* baseCell = asCell(baseValue); Structure* structure = baseCell->structure(); - if (structure->isDictionary()) { + if (structure->isUncacheableDictionary()) { vPC[0] = getOpcode(op_put_by_id_generic); return; } @@ -988,6 +988,10 @@ NEVER_INLINE void Interpreter::tryCachePutByID(CallFrame* callFrame, CodeBlock* // Structure transition, cache transition info if (slot.type() == PutPropertySlot::NewProperty) { + if (structure->isDictionary()) { + vPC[0] = getOpcode(op_put_by_id_generic); + return; + } vPC[0] = getOpcode(op_put_by_id_transition); vPC[4] = structure->previousID(); vPC[5] = structure; @@ -1040,7 +1044,7 @@ NEVER_INLINE void Interpreter::tryCacheGetByID(CallFrame* callFrame, CodeBlock* Structure* structure = asCell(baseValue)->structure(); - if (structure->isDictionary()) { + if (structure->isUncacheableDictionary()) { vPC[0] = getOpcode(op_get_by_id_generic); return; } @@ -3731,7 +3735,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi JSObject* baseObj = asObject(callFrame->r(base).jsValue()); Identifier& ident = callFrame->codeBlock()->identifier(property); ASSERT(callFrame->r(function).jsValue().isObject()); - baseObj->defineSetter(callFrame, ident, asObject(callFrame->r(function).jsValue())); + baseObj->defineSetter(callFrame, ident, asObject(callFrame->r(function).jsValue()), 0); ++vPC; NEXT_INSTRUCTION(); diff --git a/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.cpp b/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.cpp index 06ddefc..5424199 100644 --- a/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.cpp @@ -36,6 +36,9 @@ RegisterFile::~RegisterFile() #if HAVE(MMAP) munmap(m_buffer, ((m_max - m_start) + m_maxGlobals) * sizeof(Register)); #elif HAVE(VIRTUALALLOC) +#if PLATFORM(WINCE) + VirtualFree(m_buffer, DWORD(m_commitEnd) - DWORD(m_buffer), MEM_DECOMMIT); +#endif VirtualFree(m_buffer, 0, MEM_RELEASE); #else fastFree(m_buffer); diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.h b/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.h index 51ada03..12e2a32 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.h +++ b/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.h @@ -180,7 +180,7 @@ public: static void cacheFlush(void*, size_t) { } -#elif PLATFORM_ARM_ARCH(7) && PLATFORM(IPHONE) +#elif PLATFORM(ARM_THUMB2) && PLATFORM(IPHONE) static void cacheFlush(void* code, size_t size) { sys_dcache_flush(code, size); @@ -191,24 +191,29 @@ public: { User::IMB_Range(code, static_cast<char*>(code) + size); } -#elif PLATFORM(ARM) +#elif PLATFORM(ARM) && COMPILER(GCC) && (GCC_VERSION >= 30406) && !defined(DISABLE_BUILTIN_CLEAR_CACHE) static void cacheFlush(void* code, size_t size) { - #if COMPILER(GCC) && (GCC_VERSION >= 30406) __clear_cache(reinterpret_cast<char*>(code), reinterpret_cast<char*>(code) + size); - #else - const int syscall = 0xf0002; - __asm __volatile ( - "mov r0, %0\n" - "mov r1, %1\n" - "mov r7, %2\n" - "mov r2, #0x0\n" - "swi 0x00000000\n" - : - : "r" (code), "r" (reinterpret_cast<char*>(code) + size), "r" (syscall) - : "r0", "r1", "r7"); - #endif // COMPILER(GCC) && (GCC_VERSION >= 30406) } +#elif PLATFORM(ARM_TRADITIONAL) && PLATFORM(LINUX) + static void cacheFlush(void* code, size_t size) + { + asm volatile ( + "push {r7}\n" + "mov r0, %0\n" + "mov r1, %1\n" + "mov r7, #0xf0000\n" + "add r7, r7, #0x2\n" + "mov r2, #0x0\n" + "svc 0x0\n" + "pop {r7}\n" + : + : "r" (code), "r" (reinterpret_cast<char*>(code) + size) + : "r0", "r1"); + } +#else + #error "The cacheFlush support is missing on this platform." #endif private: diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JIT.h b/src/3rdparty/webkit/JavaScriptCore/jit/JIT.h index f7ac20e..5c58e9d 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JIT.h +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JIT.h @@ -226,7 +226,7 @@ namespace JSC { static const FPRegisterID fpRegT0 = X86Registers::xmm0; static const FPRegisterID fpRegT1 = X86Registers::xmm1; static const FPRegisterID fpRegT2 = X86Registers::xmm2; -#elif PLATFORM_ARM_ARCH(7) +#elif PLATFORM(ARM_THUMB2) static const RegisterID returnValueRegister = ARMRegisters::r0; static const RegisterID cachedResultRegister = ARMRegisters::r0; static const RegisterID firstArgumentRegister = ARMRegisters::r0; @@ -242,7 +242,7 @@ namespace JSC { static const FPRegisterID fpRegT0 = ARMRegisters::d0; static const FPRegisterID fpRegT1 = ARMRegisters::d1; static const FPRegisterID fpRegT2 = ARMRegisters::d2; -#elif PLATFORM(ARM) +#elif PLATFORM(ARM_TRADITIONAL) static const RegisterID returnValueRegister = ARMRegisters::r0; static const RegisterID cachedResultRegister = ARMRegisters::r0; static const RegisterID firstArgumentRegister = ARMRegisters::r0; @@ -571,7 +571,7 @@ namespace JSC { static const int patchOffsetMethodCheckProtoObj = 11; static const int patchOffsetMethodCheckProtoStruct = 18; static const int patchOffsetMethodCheckPutFunction = 29; -#elif PLATFORM_ARM_ARCH(7) +#elif PLATFORM(ARM_THUMB2) // These architecture specific value are used to enable patching - see comment on op_put_by_id. static const int patchOffsetPutByIdStructure = 10; static const int patchOffsetPutByIdExternalLoad = 20; @@ -594,7 +594,7 @@ namespace JSC { static const int patchOffsetMethodCheckProtoObj = 18; static const int patchOffsetMethodCheckProtoStruct = 28; static const int patchOffsetMethodCheckPutFunction = 46; -#elif PLATFORM(ARM) +#elif PLATFORM(ARM_TRADITIONAL) // These architecture specific value are used to enable patching - see comment on op_put_by_id. static const int patchOffsetPutByIdStructure = 4; static const int patchOffsetPutByIdExternalLoad = 16; @@ -620,7 +620,7 @@ namespace JSC { #endif #endif // USE(JSVALUE32_64) -#if PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7) +#if PLATFORM(ARM_TRADITIONAL) // sequenceOpCall static const int sequenceOpCallInstructionSpace = 12; static const int sequenceOpCallConstantSpace = 2; diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITInlineMethods.h b/src/3rdparty/webkit/JavaScriptCore/jit/JITInlineMethods.h index 60c9658..e69e273 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITInlineMethods.h +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITInlineMethods.h @@ -110,7 +110,7 @@ ALWAYS_INLINE JIT::Call JIT::emitNakedCall(CodePtr function) ALWAYS_INLINE void JIT::beginUninterruptedSequence(int insnSpace, int constSpace) { -#if PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7) +#if PLATFORM(ARM_TRADITIONAL) #ifndef NDEBUG // Ensure the label after the sequence can also fit insnSpace += sizeof(ARMWord); @@ -139,38 +139,38 @@ ALWAYS_INLINE void JIT::endUninterruptedSequence(int insnSpace, int constSpace) #endif -#if PLATFORM(X86) || PLATFORM(X86_64) || (PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7)) +#if PLATFORM(ARM_THUMB2) ALWAYS_INLINE void JIT::preserveReturnAddressAfterCall(RegisterID reg) { - pop(reg); + move(linkRegister, reg); } ALWAYS_INLINE void JIT::restoreReturnAddressBeforeReturn(RegisterID reg) { - push(reg); + move(reg, linkRegister); } ALWAYS_INLINE void JIT::restoreReturnAddressBeforeReturn(Address address) { - push(address); + loadPtr(address, linkRegister); } -#elif PLATFORM_ARM_ARCH(7) +#else // PLATFORM(X86) || PLATFORM(X86_64) || PLATFORM(ARM_TRADITIONAL) ALWAYS_INLINE void JIT::preserveReturnAddressAfterCall(RegisterID reg) { - move(linkRegister, reg); + pop(reg); } ALWAYS_INLINE void JIT::restoreReturnAddressBeforeReturn(RegisterID reg) { - move(reg, linkRegister); + push(reg); } ALWAYS_INLINE void JIT::restoreReturnAddressBeforeReturn(Address address) { - loadPtr(address, linkRegister); + push(address); } #endif @@ -186,7 +186,7 @@ ALWAYS_INLINE void JIT::restoreArgumentReference() { move(stackPointerRegister, firstArgumentRegister); poke(callFrameRegister, OBJECT_OFFSETOF(struct JITStackFrame, callFrame) / sizeof (void*)); -#if PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7) +#if PLATFORM(ARM_TRADITIONAL) move(ctiReturnRegister, ARMRegisters::lr); #endif } @@ -195,7 +195,7 @@ ALWAYS_INLINE void JIT::restoreArgumentReferenceForTrampoline() #if PLATFORM(X86) // Within a trampoline the return address will be on the stack at this point. addPtr(Imm32(sizeof(void*)), stackPointerRegister, firstArgumentRegister); -#elif PLATFORM_ARM_ARCH(7) +#elif PLATFORM(ARM_THUMB2) move(stackPointerRegister, firstArgumentRegister); #endif // In the trampoline on x86-64, the first argument register is not overwritten. diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp index 1c9cd7e..28d630b 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp @@ -1681,7 +1681,7 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable // so pull them off now addPtr(Imm32(NativeCallFrameSize - sizeof(NativeFunctionCalleeSignature)), stackPointerRegister); -#elif PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7) +#elif PLATFORM(ARM_TRADITIONAL) emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT0); // Allocate stack space for our arglist diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp index 4ab58d5..055a536 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp @@ -69,6 +69,12 @@ namespace JSC { #define SYMBOL_STRING(name) #name #endif +#if PLATFORM(IPHONE) +#define THUMB_FUNC_PARAM(name) SYMBOL_STRING(name) +#else +#define THUMB_FUNC_PARAM(name) +#endif + #if USE(JSVALUE32_64) #if COMPILER(GCC) && PLATFORM(X86) @@ -193,7 +199,7 @@ SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" "ret" "\n" ); -#elif COMPILER(GCC) && PLATFORM_ARM_ARCH(7) +#elif COMPILER(GCC) && PLATFORM(ARM_THUMB2) #if USE(JIT_STUB_ARGUMENT_VA_LIST) #error "JIT_STUB_ARGUMENT_VA_LIST not supported on ARMv7." @@ -204,7 +210,7 @@ asm volatile ( ".align 2" "\n" ".globl " SYMBOL_STRING(ctiTrampoline) "\n" ".thumb" "\n" -".thumb_func " SYMBOL_STRING(ctiTrampoline) "\n" +".thumb_func " THUMB_FUNC_PARAM(ctiTrampoline) "\n" SYMBOL_STRING(ctiTrampoline) ":" "\n" "sub sp, sp, #0x3c" "\n" "str lr, [sp, #0x20]" "\n" @@ -230,7 +236,7 @@ asm volatile ( ".align 2" "\n" ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" ".thumb" "\n" -".thumb_func " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" +".thumb_func " THUMB_FUNC_PARAM(ctiVMThrowTrampoline) "\n" SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" "cpy r0, sp" "\n" "bl " SYMBOL_STRING(cti_vm_throw) "\n" @@ -247,7 +253,7 @@ asm volatile ( ".align 2" "\n" ".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" ".thumb" "\n" -".thumb_func " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" +".thumb_func " THUMB_FUNC_PARAM(ctiOpThrowNotCaught) "\n" SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" "ldr r6, [sp, #0x2c]" "\n" "ldr r5, [sp, #0x28]" "\n" @@ -452,7 +458,7 @@ SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" "ret" "\n" ); -#elif COMPILER(GCC) && PLATFORM_ARM_ARCH(7) +#elif COMPILER(GCC) && PLATFORM(ARM_THUMB2) #if USE(JIT_STUB_ARGUMENT_VA_LIST) #error "JIT_STUB_ARGUMENT_VA_LIST not supported on ARMv7." @@ -463,9 +469,9 @@ asm volatile ( ".align 2" "\n" ".globl " SYMBOL_STRING(ctiTrampoline) "\n" ".thumb" "\n" -".thumb_func " SYMBOL_STRING(ctiTrampoline) "\n" +".thumb_func " THUMB_FUNC_PARAM(ctiTrampoline) "\n" SYMBOL_STRING(ctiTrampoline) ":" "\n" - "sub sp, sp, #0x3c" "\n" + "sub sp, sp, #0x40" "\n" "str lr, [sp, #0x20]" "\n" "str r4, [sp, #0x24]" "\n" "str r5, [sp, #0x28]" "\n" @@ -480,7 +486,7 @@ SYMBOL_STRING(ctiTrampoline) ":" "\n" "ldr r5, [sp, #0x28]" "\n" "ldr r4, [sp, #0x24]" "\n" "ldr lr, [sp, #0x20]" "\n" - "add sp, sp, #0x3c" "\n" + "add sp, sp, #0x40" "\n" "bx lr" "\n" ); @@ -489,7 +495,7 @@ asm volatile ( ".align 2" "\n" ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" ".thumb" "\n" -".thumb_func " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" +".thumb_func " THUMB_FUNC_PARAM(ctiVMThrowTrampoline) "\n" SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" "cpy r0, sp" "\n" "bl " SYMBOL_STRING(cti_vm_throw) "\n" @@ -497,7 +503,7 @@ SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" "ldr r5, [sp, #0x28]" "\n" "ldr r4, [sp, #0x24]" "\n" "ldr lr, [sp, #0x20]" "\n" - "add sp, sp, #0x3c" "\n" + "add sp, sp, #0x40" "\n" "bx lr" "\n" ); @@ -506,7 +512,7 @@ asm volatile ( ".align 2" "\n" ".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" ".thumb" "\n" -".thumb_func " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" +".thumb_func " THUMB_FUNC_PARAM(ctiOpThrowNotCaught) "\n" SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" "ldr r6, [sp, #0x2c]" "\n" "ldr r5, [sp, #0x28]" "\n" @@ -516,7 +522,7 @@ SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" "bx lr" "\n" ); -#elif COMPILER(GCC) && PLATFORM(ARM) +#elif COMPILER(GCC) && PLATFORM(ARM_TRADITIONAL) asm volatile ( ".globl " SYMBOL_STRING(ctiTrampoline) "\n" @@ -636,7 +642,7 @@ JITThunks::JITThunks(JSGlobalData* globalData) { JIT::compileCTIMachineTrampolines(globalData, &m_executablePool, &m_ctiStringLengthTrampoline, &m_ctiVirtualCallLink, &m_ctiVirtualCall, &m_ctiNativeCallThunk); -#if PLATFORM_ARM_ARCH(7) +#if PLATFORM(ARM_THUMB2) // Unfortunate the arm compiler does not like the use of offsetof on JITStackFrame (since it contains non POD types), // and the OBJECT_OFFSETOF macro does not appear constantish enough for it to be happy with its use in COMPILE_ASSERT // macros. @@ -649,7 +655,7 @@ JITThunks::JITThunks(JSGlobalData* globalData) ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, callFrame) == 0x34); ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, exception) == 0x38); // The fifth argument is the first item already on the stack. - ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, enabledProfilerReference) == 0x3c); + ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, enabledProfilerReference) == 0x40); ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, thunkReturnAddress) == 0x1C); #endif @@ -673,7 +679,7 @@ NEVER_INLINE void JITThunks::tryCachePutByID(CallFrame* callFrame, CodeBlock* co JSCell* baseCell = asCell(baseValue); Structure* structure = baseCell->structure(); - if (structure->isDictionary()) { + if (structure->isUncacheableDictionary()) { ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(cti_op_put_by_id_generic)); return; } @@ -689,7 +695,7 @@ NEVER_INLINE void JITThunks::tryCachePutByID(CallFrame* callFrame, CodeBlock* co // Structure transition, cache transition info if (slot.type() == PutPropertySlot::NewProperty) { StructureChain* prototypeChain = structure->prototypeChain(callFrame); - if (!prototypeChain->isCacheable()) { + if (!prototypeChain->isCacheable() || structure->isDictionary()) { ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(cti_op_put_by_id_generic)); return; } @@ -737,7 +743,7 @@ NEVER_INLINE void JITThunks::tryCacheGetByID(CallFrame* callFrame, CodeBlock* co JSCell* baseCell = asCell(baseValue); Structure* structure = baseCell->structure(); - if (structure->isDictionary()) { + if (structure->isUncacheableDictionary()) { ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(cti_op_get_by_id_generic)); return; } @@ -876,7 +882,7 @@ static NEVER_INLINE void throwStackOverflowError(CallFrame* callFrame, JSGlobalD } \ } while (0) -#if PLATFORM_ARM_ARCH(7) +#if PLATFORM(ARM_THUMB2) #define DEFINE_STUB_FUNCTION(rtype, op) \ extern "C" { \ @@ -887,7 +893,7 @@ static NEVER_INLINE void throwStackOverflowError(CallFrame* callFrame, JSGlobalD ".align 2" "\n" \ ".globl " SYMBOL_STRING(cti_##op) "\n" \ ".thumb" "\n" \ - ".thumb_func " SYMBOL_STRING(cti_##op) "\n" \ + ".thumb_func " THUMB_FUNC_PARAM(cti_##op) "\n" \ SYMBOL_STRING(cti_##op) ":" "\n" \ "str lr, [sp, #0x1c]" "\n" \ "bl " SYMBOL_STRING(JITStubThunked_##op) "\n" \ @@ -1148,7 +1154,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_id_method_check) JSObject* slotBaseObject; if (baseValue.isCell() && slot.isCacheable() - && !(structure = asCell(baseValue)->structure())->isDictionary() + && !(structure = asCell(baseValue)->structure())->isUncacheableDictionary() && (slotBaseObject = asObject(slot.slotBase()))->getPropertySpecificValue(callFrame, ident, specific) && specific ) { @@ -1222,7 +1228,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_id_self_fail) if (baseValue.isCell() && slot.isCacheable() - && !asCell(baseValue)->structure()->isDictionary() + && !asCell(baseValue)->structure()->isUncacheableDictionary() && slot.slotBase() == baseValue) { CodeBlock* codeBlock = callFrame->codeBlock(); @@ -1293,7 +1299,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_id_proto_list) CHECK_FOR_EXCEPTION(); - if (!baseValue.isCell() || !slot.isCacheable() || asCell(baseValue)->structure()->isDictionary()) { + if (!baseValue.isCell() || !slot.isCacheable() || asCell(baseValue)->structure()->isUncacheableDictionary()) { ctiPatchCallByReturnAddress(callFrame->codeBlock(), STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_fail)); return JSValue::encode(result); } @@ -2182,7 +2188,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_resolve_global) PropertySlot slot(globalObject); if (globalObject->getPropertySlot(callFrame, ident, slot)) { JSValue result = slot.getValue(callFrame, ident); - if (slot.isCacheable() && !globalObject->structure()->isDictionary() && slot.slotBase() == globalObject) { + if (slot.isCacheable() && !globalObject->structure()->isUncacheableDictionary() && slot.slotBase() == globalObject) { GlobalResolveInfo& globalResolveInfo = callFrame->codeBlock()->globalResolveInfo(globalResolveInfoIndex); if (globalResolveInfo.structure) globalResolveInfo.structure->deref(); diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h index 1dbdeaa..46973ee 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h @@ -129,7 +129,7 @@ namespace JSC { #if COMPILER(MSVC) #pragma pack(pop) #endif // COMPILER(MSVC) -#elif PLATFORM_ARM_ARCH(7) +#elif PLATFORM(ARM_THUMB2) struct JITStackFrame { void* reserved; // Unused JITStubArg args[6]; @@ -149,13 +149,15 @@ namespace JSC { CallFrame* callFrame; JSValue* exception; + void* padding2; + // These arguments passed on the stack. Profiler** enabledProfilerReference; JSGlobalData* globalData; ReturnAddressPtr* returnAddressSlot() { return &thunkReturnAddress; } }; -#elif PLATFORM(ARM) +#elif PLATFORM(ARM_TRADITIONAL) struct JITStackFrame { JITStubArg padding; // Unused JITStubArg args[7]; diff --git a/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.cpp b/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.cpp index 14a398a..3bd318a 100644 --- a/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.cpp @@ -1886,10 +1886,6 @@ ScopeNode::ScopeNode(JSGlobalData* globalData) , ParserArenaRefCounted(globalData) , m_features(NoFeatures) { -#if ENABLE(CODEBLOCK_SAMPLING) - if (SamplingTool* sampler = globalData->interpreter->sampler()) - sampler->notifyOfScope(this); -#endif } ScopeNode::ScopeNode(JSGlobalData* globalData, const SourceCode& source, SourceElements* children, VarStack* varStack, FunctionStack* funcStack, CodeFeatures features, int numConstants) @@ -1899,10 +1895,6 @@ ScopeNode::ScopeNode(JSGlobalData* globalData, const SourceCode& source, SourceE , m_features(features) , m_source(source) { -#if ENABLE(CODEBLOCK_SAMPLING) - if (SamplingTool* sampler = globalData->interpreter->sampler()) - sampler->notifyOfScope(this); -#endif } inline void ScopeNode::emitStatementsBytecode(BytecodeGenerator& generator, RegisterID* dst) diff --git a/src/3rdparty/webkit/JavaScriptCore/parser/SourceCode.h b/src/3rdparty/webkit/JavaScriptCore/parser/SourceCode.h index 84360b8..9ba4da3 100644 --- a/src/3rdparty/webkit/JavaScriptCore/parser/SourceCode.h +++ b/src/3rdparty/webkit/JavaScriptCore/parser/SourceCode.h @@ -37,7 +37,8 @@ namespace JSC { class SourceCode { public: SourceCode() - : m_startChar(0) + : m_provider(0) + , m_startChar(0) , m_endChar(0) , m_firstLine(0) { diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/BatchedTransitionOptimizer.h b/src/3rdparty/webkit/JavaScriptCore/runtime/BatchedTransitionOptimizer.h index b9f738f..929a5e7 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/BatchedTransitionOptimizer.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/BatchedTransitionOptimizer.h @@ -38,7 +38,7 @@ namespace JSC { : m_object(object) { if (!m_object->structure()->isDictionary()) - m_object->setStructure(Structure::toDictionaryTransition(m_object->structure())); + m_object->setStructure(Structure::toCacheableDictionaryTransition(m_object->structure())); } ~BatchedTransitionOptimizer() diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/CommonIdentifiers.h b/src/3rdparty/webkit/JavaScriptCore/runtime/CommonIdentifiers.h index 8493d73..abe5038 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/CommonIdentifiers.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/CommonIdentifiers.h @@ -39,6 +39,9 @@ macro(compile) \ macro(configurable) \ macro(constructor) \ + macro(create) \ + macro(defineProperty) \ + macro(defineProperties) \ macro(enumerable) \ macro(eval) \ macro(exec) \ diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Completion.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/Completion.cpp index f36de54..ec3e000 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Completion.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Completion.cpp @@ -37,7 +37,7 @@ Completion checkSyntax(ExecState* exec, const SourceCode& source) { JSLock lock(exec); - ProgramExecutable program(source); + ProgramExecutable program(exec, source); JSObject* error = program.checkSyntax(exec); if (error) return Completion(Throw, error); @@ -49,7 +49,7 @@ Completion evaluate(ExecState* exec, ScopeChain& scopeChain, const SourceCode& s { JSLock lock(exec); - ProgramExecutable program(source); + ProgramExecutable program(exec, source); JSObject* error = program.compile(exec, scopeChain.node()); if (error) return Completion(Throw, error); diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Executable.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/Executable.cpp index 5e79794..7586746 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Executable.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Executable.cpp @@ -259,7 +259,7 @@ PassRefPtr<FunctionExecutable> FunctionExecutable::fromGlobalCode(const Identifi FunctionBodyNode* body = static_cast<FuncExprNode*>(funcExpr)->body(); ASSERT(body); - return FunctionExecutable::create(functionName, body->source(), body->usesArguments(), body->parameters(), body->lineNo(), body->lastLine()); + return FunctionExecutable::create(&exec->globalData(), functionName, body->source(), body->usesArguments(), body->parameters(), body->lineNo(), body->lastLine()); } UString FunctionExecutable::paramString() const diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Executable.h b/src/3rdparty/webkit/JavaScriptCore/runtime/Executable.h index d437d46..9728775 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Executable.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Executable.h @@ -27,7 +27,9 @@ #define Executable_h #include "JSFunction.h" +#include "Interpreter.h" #include "Nodes.h" +#include "SamplingTool.h" namespace JSC { @@ -102,11 +104,30 @@ namespace JSC { class ScriptExecutable : public ExecutableBase { public: - ScriptExecutable(const SourceCode& source) + ScriptExecutable(JSGlobalData* globalData, const SourceCode& source) : ExecutableBase(NUM_PARAMETERS_NOT_COMPILED) , m_source(source) , m_features(0) { +#if ENABLE(CODEBLOCK_SAMPLING) + if (SamplingTool* sampler = globalData->interpreter->sampler()) + sampler->notifyOfScope(this); +#else + UNUSED_PARAM(globalData); +#endif + } + + ScriptExecutable(ExecState* exec, const SourceCode& source) + : ExecutableBase(NUM_PARAMETERS_NOT_COMPILED) + , m_source(source) + , m_features(0) + { +#if ENABLE(CODEBLOCK_SAMPLING) + if (SamplingTool* sampler = exec->globalData().interpreter->sampler()) + sampler->notifyOfScope(this); +#else + UNUSED_PARAM(exec); +#endif } const SourceCode& source() { return m_source; } @@ -137,8 +158,8 @@ namespace JSC { class EvalExecutable : public ScriptExecutable { public: - EvalExecutable(const SourceCode& source) - : ScriptExecutable(source) + EvalExecutable(ExecState* exec, const SourceCode& source) + : ScriptExecutable(exec, source) , m_evalCodeBlock(0) { } @@ -157,7 +178,7 @@ namespace JSC { JSObject* compile(ExecState*, ScopeChainNode*); ExceptionInfo* reparseExceptionInfo(JSGlobalData*, ScopeChainNode*, CodeBlock*); - static PassRefPtr<EvalExecutable> create(const SourceCode& source) { return adoptRef(new EvalExecutable(source)); } + static PassRefPtr<EvalExecutable> create(ExecState* exec, const SourceCode& source) { return adoptRef(new EvalExecutable(exec, source)); } private: EvalCodeBlock* m_evalCodeBlock; @@ -178,8 +199,8 @@ namespace JSC { class ProgramExecutable : public ScriptExecutable { public: - ProgramExecutable(const SourceCode& source) - : ScriptExecutable(source) + ProgramExecutable(ExecState* exec, const SourceCode& source) + : ScriptExecutable(exec, source) , m_programCodeBlock(0) { } @@ -221,9 +242,14 @@ namespace JSC { class FunctionExecutable : public ScriptExecutable { friend class JIT; public: - static PassRefPtr<FunctionExecutable> create(const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine) + static PassRefPtr<FunctionExecutable> create(ExecState* exec, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine) + { + return adoptRef(new FunctionExecutable(exec, name, source, forceUsesArguments, parameters, firstLine, lastLine)); + } + + static PassRefPtr<FunctionExecutable> create(JSGlobalData* globalData, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine) { - return adoptRef(new FunctionExecutable(name, source, forceUsesArguments, parameters, firstLine, lastLine)); + return adoptRef(new FunctionExecutable(globalData, name, source, forceUsesArguments, parameters, firstLine, lastLine)); } ~FunctionExecutable(); @@ -263,8 +289,20 @@ namespace JSC { static PassRefPtr<FunctionExecutable> fromGlobalCode(const Identifier&, ExecState*, Debugger*, const SourceCode&, int* errLine = 0, UString* errMsg = 0); private: - FunctionExecutable(const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine) - : ScriptExecutable(source) + FunctionExecutable(JSGlobalData* globalData, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine) + : ScriptExecutable(globalData, source) + , m_forceUsesArguments(forceUsesArguments) + , m_parameters(parameters) + , m_codeBlock(0) + , m_name(name) + , m_numVariables(0) + { + m_firstLine = firstLine; + m_lastLine = lastLine; + } + + FunctionExecutable(ExecState* exec, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine) + : ScriptExecutable(exec, source) , m_forceUsesArguments(forceUsesArguments) , m_parameters(parameters) , m_codeBlock(0) diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSArray.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSArray.cpp index 1fcca81..101f543 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSArray.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSArray.cpp @@ -223,7 +223,7 @@ bool JSArray::getOwnPropertySlot(ExecState* exec, unsigned i, PropertySlot& slot } } - return false; + return JSObject::getOwnPropertySlot(exec, Identifier::from(exec, i), slot); } bool JSArray::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObject.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObject.cpp index 3a1909d..8d71ac3 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObject.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObject.cpp @@ -175,18 +175,18 @@ void JSGlobalObject::putWithAttributes(ExecState* exec, const Identifier& proper } } -void JSGlobalObject::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunc) +void JSGlobalObject::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunc, unsigned attributes) { PropertySlot slot; if (!symbolTableGet(propertyName, slot)) - JSVariableObject::defineGetter(exec, propertyName, getterFunc); + JSVariableObject::defineGetter(exec, propertyName, getterFunc, attributes); } -void JSGlobalObject::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunc) +void JSGlobalObject::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunc, unsigned attributes) { PropertySlot slot; if (!symbolTableGet(propertyName, slot)) - JSVariableObject::defineSetter(exec, propertyName, setterFunc); + JSVariableObject::defineSetter(exec, propertyName, setterFunc, attributes); } static inline JSObject* lastInPrototypeChain(JSObject* object) diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObject.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObject.h index d1150cc..5f7137f 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObject.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObject.h @@ -175,8 +175,8 @@ namespace JSC { virtual void put(ExecState*, const Identifier&, JSValue, PutPropertySlot&); virtual void putWithAttributes(ExecState*, const Identifier& propertyName, JSValue value, unsigned attributes); - virtual void defineGetter(ExecState*, const Identifier& propertyName, JSObject* getterFunc); - virtual void defineSetter(ExecState*, const Identifier& propertyName, JSObject* setterFunc); + virtual void defineGetter(ExecState*, const Identifier& propertyName, JSObject* getterFunc, unsigned attributes); + virtual void defineSetter(ExecState*, const Identifier& propertyName, JSObject* setterFunc, unsigned attributes); // Linked list of all global objects that use the same JSGlobalData. JSGlobalObject*& head() { return d()->globalData->head; } diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp index b11070f..5ded370 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp @@ -286,7 +286,7 @@ JSValue JSC_HOST_CALL globalFuncEval(ExecState* exec, JSObject* function, JSValu if (JSValue parsedObject = preparser.tryLiteralParse()) return parsedObject; - EvalExecutable eval(makeSource(s)); + EvalExecutable eval(exec, makeSource(s)); JSObject* error = eval.compile(exec, static_cast<JSGlobalObject*>(unwrappedObject)->globalScopeChain().node()); if (error) return throwError(exec, error); diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.cpp index f910603..74af4b1 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.cpp @@ -275,7 +275,7 @@ const HashEntry* JSObject::findPropertyHashEntry(ExecState* exec, const Identifi return 0; } -void JSObject::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunction) +void JSObject::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes) { JSValue object = getDirect(propertyName); if (object && object.isGetterSetter()) { @@ -286,7 +286,7 @@ void JSObject::defineGetter(ExecState* exec, const Identifier& propertyName, JSO PutPropertySlot slot; GetterSetter* getterSetter = new (exec) GetterSetter(exec); - putDirectInternal(exec->globalData(), propertyName, getterSetter, Getter, true, slot); + putDirectInternal(exec->globalData(), propertyName, getterSetter, attributes | Getter, true, slot); // putDirect will change our Structure if we add a new property. For // getters and setters, though, we also need to change our Structure @@ -302,7 +302,7 @@ void JSObject::defineGetter(ExecState* exec, const Identifier& propertyName, JSO getterSetter->setGetter(getterFunction); } -void JSObject::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunction) +void JSObject::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes) { JSValue object = getDirect(propertyName); if (object && object.isGetterSetter()) { @@ -313,7 +313,7 @@ void JSObject::defineSetter(ExecState* exec, const Identifier& propertyName, JSO PutPropertySlot slot; GetterSetter* getterSetter = new (exec) GetterSetter(exec); - putDirectInternal(exec->globalData(), propertyName, getterSetter, Setter, true, slot); + putDirectInternal(exec->globalData(), propertyName, getterSetter, attributes | Setter, true, slot); // putDirect will change our Structure if we add a new property. For // getters and setters, though, we also need to change our Structure @@ -471,7 +471,7 @@ JSObject* JSObject::unwrappedObject() void JSObject::removeDirect(const Identifier& propertyName) { size_t offset; - if (m_structure->isDictionary()) { + if (m_structure->isUncacheableDictionary()) { offset = m_structure->removePropertyWithoutTransition(propertyName); if (offset != WTF::notFound) putDirectOffset(offset, jsUndefined()); @@ -541,4 +541,131 @@ bool JSObject::getPropertyDescriptor(ExecState* exec, const Identifier& property object = asObject(prototype); } } + +static bool putDescriptor(ExecState* exec, JSObject* target, const Identifier& propertyName, PropertyDescriptor& descriptor, unsigned attributes, JSValue oldValue) +{ + if (descriptor.isGenericDescriptor() || descriptor.isDataDescriptor()) { + target->putWithAttributes(exec, propertyName, descriptor.value() ? descriptor.value() : oldValue, attributes & ~(Getter | Setter)); + return true; + } + attributes &= ~ReadOnly; + if (descriptor.getter() && descriptor.getter().isObject()) + target->defineGetter(exec, propertyName, asObject(descriptor.getter()), attributes); + if (exec->hadException()) + return false; + if (descriptor.setter() && descriptor.setter().isObject()) + target->defineSetter(exec, propertyName, asObject(descriptor.setter()), attributes); + return !exec->hadException(); +} + +bool JSObject::defineOwnProperty(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool throwException) +{ + // If we have a new property we can just put it on normally + PropertyDescriptor current; + if (!getOwnPropertyDescriptor(exec, propertyName, current)) + return putDescriptor(exec, this, propertyName, descriptor, descriptor.attributes(), jsUndefined()); + + if (descriptor.isEmpty()) + return true; + + if (current.equalTo(descriptor)) + return true; + + // Filter out invalid changes + if (!current.configurable()) { + if (descriptor.configurable()) { + if (throwException) + throwError(exec, TypeError, "Attempting to configurable attribute of unconfigurable property."); + return false; + } + if (descriptor.enumerablePresent() && descriptor.enumerable() != current.enumerable()) { + if (throwException) + throwError(exec, TypeError, "Attempting to change enumerable attribute of unconfigurable property."); + return false; + } + } + + // A generic descriptor is simply changing the attributes of an existing property + if (descriptor.isGenericDescriptor()) { + if (!current.attributesEqual(descriptor)) { + deleteProperty(exec, propertyName); + putDescriptor(exec, this, propertyName, descriptor, current.attributesWithOverride(descriptor), current.value()); + } + return true; + } + + // Changing between a normal property or an accessor property + if (descriptor.isDataDescriptor() != current.isDataDescriptor()) { + if (!current.configurable()) { + if (throwException) + throwError(exec, TypeError, "Attempting to change access mechanism for an unconfigurable property."); + return false; + } + deleteProperty(exec, propertyName); + return putDescriptor(exec, this, propertyName, descriptor, current.attributesWithOverride(descriptor), current.value() ? current.value() : jsUndefined()); + } + + // Changing the value and attributes of an existing property + if (descriptor.isDataDescriptor()) { + if (!current.configurable()) { + if (!current.writable() && descriptor.writable()) { + if (throwException) + throwError(exec, TypeError, "Attempting to change writable attribute of unconfigurable property."); + return false; + } + if (!current.writable()) { + if (descriptor.value() || !JSValue::strictEqual(current.value(), descriptor.value())) { + if (throwException) + throwError(exec, TypeError, "Attempting to change value of a readonly property."); + return false; + } + } + } else if (current.attributesEqual(descriptor)) { + if (!descriptor.value()) + return true; + PutPropertySlot slot; + put(exec, propertyName, descriptor.value(), slot); + if (exec->hadException()) + return false; + return true; + } + deleteProperty(exec, propertyName); + return putDescriptor(exec, this, propertyName, descriptor, current.attributesWithOverride(descriptor), current.value()); + } + + // Changing the accessor functions of an existing accessor property + ASSERT(descriptor.isAccessorDescriptor()); + if (!current.configurable()) { + if (descriptor.setterPresent() && !(current.setter() && JSValue::strictEqual(current.setter(), descriptor.setter()))) { + if (throwException) + throwError(exec, TypeError, "Attempting to change the setter of an unconfigurable property."); + return false; + } + if (descriptor.getterPresent() && !(current.getter() && JSValue::strictEqual(current.getter(), descriptor.getter()))) { + if (throwException) + throwError(exec, TypeError, "Attempting to change the getter of an unconfigurable property."); + return false; + } + } + JSValue accessor = getDirect(propertyName); + if (!accessor) + return false; + GetterSetter* getterSetter = asGetterSetter(accessor); + if (current.attributesEqual(descriptor)) { + if (descriptor.setter()) + getterSetter->setSetter(asObject(descriptor.setter())); + if (descriptor.getter()) + getterSetter->setGetter(asObject(descriptor.getter())); + return true; + } + deleteProperty(exec, propertyName); + unsigned attrs = current.attributesWithOverride(descriptor); + if (descriptor.setter()) + attrs |= Setter; + if (descriptor.getter()) + attrs |= Getter; + putDirect(propertyName, getterSetter, attrs); + return true; +} + } // namespace JSC diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.h index bdc949b..3fd1e3c 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.h @@ -186,10 +186,11 @@ namespace JSC { void fillGetterPropertySlot(PropertySlot&, JSValue* location); - virtual void defineGetter(ExecState*, const Identifier& propertyName, JSObject* getterFunction); - virtual void defineSetter(ExecState*, const Identifier& propertyName, JSObject* setterFunction); + virtual void defineGetter(ExecState*, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes = 0); + virtual void defineSetter(ExecState*, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes = 0); virtual JSValue lookupGetter(ExecState*, const Identifier& propertyName); virtual JSValue lookupSetter(ExecState*, const Identifier& propertyName); + virtual bool defineOwnProperty(ExecState*, const Identifier& propertyName, PropertyDescriptor&, bool shouldThrow); virtual bool isGlobalObject() const { return false; } virtual bool isVariableObject() const { return false; } diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStackPosix.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStackPosix.cpp index 8e78ff3..43f8b29 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStackPosix.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStackPosix.cpp @@ -29,22 +29,44 @@ #include "MarkStack.h" #include <unistd.h> +#if defined (__SYMBIAN32__) +#include "wtf/FastMalloc.h" +#include <e32base.h> +#include <e32std.h> +#include <e32hal.h> +#include <hal.h> +#else #include <sys/mman.h> +#endif namespace JSC { void MarkStack::initializePagesize() { +#if defined (__SYMBIAN32__) + TInt page_size; + UserHal::PageSizeInBytes(page_size); + MarkStack::s_pageSize = page_size; +#else MarkStack::s_pageSize = getpagesize(); +#endif } void* MarkStack::allocateStack(size_t size) { +#if defined (__SYMBIAN32__) + return fastMalloc(size); +#else return mmap(0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0); +#endif } void MarkStack::releaseStack(void* addr, size_t size) { +#if defined (__SYMBIAN32__) + fastFree(addr); +#else munmap(addr, size); +#endif } } diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/ObjectConstructor.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/ObjectConstructor.cpp index fd45c45..2992f1b 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/ObjectConstructor.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/ObjectConstructor.cpp @@ -37,6 +37,9 @@ ASSERT_CLASS_FITS_IN_CELL(ObjectConstructor); static JSValue JSC_HOST_CALL objectConstructorGetPrototypeOf(ExecState*, JSObject*, JSValue, const ArgList&); static JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState*, JSObject*, JSValue, const ArgList&); static JSValue JSC_HOST_CALL objectConstructorKeys(ExecState*, JSObject*, JSValue, const ArgList&); +static JSValue JSC_HOST_CALL objectConstructorDefineProperty(ExecState*, JSObject*, JSValue, const ArgList&); +static JSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState*, JSObject*, JSValue, const ArgList&); +static JSValue JSC_HOST_CALL objectConstructorCreate(ExecState*, JSObject*, JSValue, const ArgList&); ObjectConstructor::ObjectConstructor(ExecState* exec, PassRefPtr<Structure> structure, ObjectPrototype* objectPrototype, Structure* prototypeFunctionStructure) : InternalFunction(&exec->globalData(), structure, Identifier(exec, "Object")) @@ -50,6 +53,9 @@ ObjectConstructor::ObjectConstructor(ExecState* exec, PassRefPtr<Structure> stru putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().getPrototypeOf, objectConstructorGetPrototypeOf), DontEnum); putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 2, exec->propertyNames().getOwnPropertyDescriptor, objectConstructorGetOwnPropertyDescriptor), DontEnum); putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().keys, objectConstructorKeys), DontEnum); + putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 3, exec->propertyNames().defineProperty, objectConstructorDefineProperty), DontEnum); + putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 2, exec->propertyNames().defineProperties, objectConstructorDefineProperties), DontEnum); + putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 2, exec->propertyNames().create, objectConstructorCreate), DontEnum); } // ECMA 15.2.2 @@ -103,15 +109,14 @@ JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState* exec, return jsUndefined(); if (exec->hadException()) return jsUndefined(); - ASSERT(descriptor.isValid()); JSObject* description = constructEmptyObject(exec); - if (!descriptor.hasAccessors()) { - description->putDirect(exec->propertyNames().value, descriptor.value(), 0); + if (!descriptor.isAccessorDescriptor()) { + description->putDirect(exec->propertyNames().value, descriptor.value() ? descriptor.value() : jsUndefined(), 0); description->putDirect(exec->propertyNames().writable, jsBoolean(descriptor.writable()), 0); } else { - description->putDirect(exec->propertyNames().get, descriptor.getter(), 0); - description->putDirect(exec->propertyNames().set, descriptor.setter(), 0); + description->putDirect(exec->propertyNames().get, descriptor.getter() ? descriptor.getter() : jsUndefined(), 0); + description->putDirect(exec->propertyNames().set, descriptor.setter() ? descriptor.setter() : jsUndefined(), 0); } description->putDirect(exec->propertyNames().enumerable, jsBoolean(descriptor.enumerable()), 0); @@ -133,4 +138,163 @@ JSValue JSC_HOST_CALL objectConstructorKeys(ExecState* exec, JSObject*, JSValue, return keys; } +// ES5 8.10.5 ToPropertyDescriptor +static bool toPropertyDescriptor(ExecState* exec, JSValue in, PropertyDescriptor& desc) +{ + if (!in.isObject()) { + throwError(exec, TypeError, "Property description must be an object."); + return false; + } + JSObject* description = asObject(in); + + PropertySlot enumerableSlot; + if (description->getPropertySlot(exec, exec->propertyNames().enumerable, enumerableSlot)) { + desc.setEnumerable(enumerableSlot.getValue(exec, exec->propertyNames().enumerable).toBoolean(exec)); + if (exec->hadException()) + return false; + } + + PropertySlot configurableSlot; + if (description->getPropertySlot(exec, exec->propertyNames().configurable, configurableSlot)) { + desc.setConfigurable(configurableSlot.getValue(exec, exec->propertyNames().configurable).toBoolean(exec)); + if (exec->hadException()) + return false; + } + + JSValue value; + PropertySlot valueSlot; + if (description->getPropertySlot(exec, exec->propertyNames().value, valueSlot)) { + desc.setValue(valueSlot.getValue(exec, exec->propertyNames().value)); + if (exec->hadException()) + return false; + } + + PropertySlot writableSlot; + if (description->getPropertySlot(exec, exec->propertyNames().writable, writableSlot)) { + desc.setWritable(writableSlot.getValue(exec, exec->propertyNames().writable).toBoolean(exec)); + if (exec->hadException()) + return false; + } + + PropertySlot getSlot; + if (description->getPropertySlot(exec, exec->propertyNames().get, getSlot)) { + JSValue get = getSlot.getValue(exec, exec->propertyNames().get); + if (exec->hadException()) + return false; + if (!get.isUndefined()) { + CallData callData; + if (get.getCallData(callData) == CallTypeNone) { + throwError(exec, TypeError, "Getter must be a function."); + return false; + } + } else + get = JSValue(); + desc.setGetter(get); + } + + PropertySlot setSlot; + if (description->getPropertySlot(exec, exec->propertyNames().set, setSlot)) { + JSValue set = setSlot.getValue(exec, exec->propertyNames().set); + if (exec->hadException()) + return false; + if (!set.isUndefined()) { + CallData callData; + if (set.getCallData(callData) == CallTypeNone) { + throwError(exec, TypeError, "Setter must be a function."); + return false; + } + } else + set = JSValue(); + + desc.setSetter(set); + } + + if (!desc.isAccessorDescriptor()) + return true; + + if (desc.value()) { + throwError(exec, TypeError, "Invalid property. 'value' present on property with getter or setter."); + return false; + } + + if (desc.writablePresent()) { + throwError(exec, TypeError, "Invalid property. 'writable' present on property with getter or setter."); + return false; + } + return true; +} + +JSValue JSC_HOST_CALL objectConstructorDefineProperty(ExecState* exec, JSObject*, JSValue, const ArgList& args) +{ + if (!args.at(0).isObject()) + return throwError(exec, TypeError, "Properties can only be defined on Objects."); + JSObject* O = asObject(args.at(0)); + UString propertyName = args.at(1).toString(exec); + if (exec->hadException()) + return jsNull(); + PropertyDescriptor descriptor; + if (!toPropertyDescriptor(exec, args.at(2), descriptor)) + return jsNull(); + ASSERT((descriptor.attributes() & (Getter | Setter)) || (!descriptor.isAccessorDescriptor())); + ASSERT(!exec->hadException()); + O->defineOwnProperty(exec, Identifier(exec, propertyName), descriptor, true); + return O; +} + +static JSValue defineProperties(ExecState* exec, JSObject* object, JSObject* properties) +{ + PropertyNameArray propertyNames(exec); + asObject(properties)->getOwnPropertyNames(exec, propertyNames); + size_t numProperties = propertyNames.size(); + Vector<PropertyDescriptor> descriptors; + MarkedArgumentBuffer markBuffer; + for (size_t i = 0; i < numProperties; i++) { + PropertySlot slot; + JSValue prop = properties->get(exec, propertyNames[i]); + if (exec->hadException()) + return jsNull(); + PropertyDescriptor descriptor; + if (!toPropertyDescriptor(exec, prop, descriptor)) + return jsNull(); + descriptors.append(descriptor); + // Ensure we mark all the values that we're accumulating + if (descriptor.isDataDescriptor() && descriptor.value()) + markBuffer.append(descriptor.value()); + if (descriptor.isAccessorDescriptor()) { + if (descriptor.getter()) + markBuffer.append(descriptor.getter()); + if (descriptor.setter()) + markBuffer.append(descriptor.setter()); + } + } + for (size_t i = 0; i < numProperties; i++) { + object->defineOwnProperty(exec, propertyNames[i], descriptors[i], true); + if (exec->hadException()) + return jsNull(); + } + return object; +} + +JSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState* exec, JSObject*, JSValue, const ArgList& args) +{ + if (!args.at(0).isObject()) + return throwError(exec, TypeError, "Properties can only be defined on Objects."); + if (!args.at(1).isObject()) + return throwError(exec, TypeError, "Property descriptor list must be an Object."); + return defineProperties(exec, asObject(args.at(0)), asObject(args.at(1))); +} + +JSValue JSC_HOST_CALL objectConstructorCreate(ExecState* exec, JSObject*, JSValue, const ArgList& args) +{ + if (!args.at(0).isObject() && !args.at(0).isNull()) + return throwError(exec, TypeError, "Object prototype may only be an Object or null."); + JSObject* newObject = constructEmptyObject(exec); + newObject->setPrototype(args.at(0)); + if (args.at(1).isUndefined()) + return newObject; + if (!args.at(1).isObject()) + return throwError(exec, TypeError, "Property descriptor list must be an Object."); + return defineProperties(exec, newObject, asObject(args.at(1))); +} + } // namespace JSC diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyDescriptor.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyDescriptor.cpp index d892e0a..4db814f 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyDescriptor.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyDescriptor.cpp @@ -30,29 +30,40 @@ #include "GetterSetter.h" #include "JSObject.h" +#include "Operations.h" namespace JSC { +unsigned PropertyDescriptor::defaultAttributes = (DontDelete << 1) - 1; + bool PropertyDescriptor::writable() const { - ASSERT(!hasAccessors()); + ASSERT(!isAccessorDescriptor()); return !(m_attributes & ReadOnly); } bool PropertyDescriptor::enumerable() const { - ASSERT(isValid()); return !(m_attributes & DontEnum); } bool PropertyDescriptor::configurable() const { - ASSERT(isValid()); return !(m_attributes & DontDelete); } -bool PropertyDescriptor::hasAccessors() const +bool PropertyDescriptor::isDataDescriptor() const { - return !!(m_attributes & (Getter | Setter)); + return m_value || (m_seenAttributes & WritablePresent); +} + +bool PropertyDescriptor::isGenericDescriptor() const +{ + return !isAccessorDescriptor() && !isDataDescriptor(); +} + +bool PropertyDescriptor::isAccessorDescriptor() const +{ + return m_getter || m_setter; } void PropertyDescriptor::setUndefined() @@ -63,32 +74,31 @@ void PropertyDescriptor::setUndefined() JSValue PropertyDescriptor::getter() const { - ASSERT(hasAccessors()); - if (!m_getter) - return jsUndefined(); + ASSERT(isAccessorDescriptor()); return m_getter; } JSValue PropertyDescriptor::setter() const { - ASSERT(hasAccessors()); - if (!m_setter) - return jsUndefined(); + ASSERT(isAccessorDescriptor()); return m_setter; } void PropertyDescriptor::setDescriptor(JSValue value, unsigned attributes) { ASSERT(value); + m_attributes = attributes; if (attributes & (Getter | Setter)) { GetterSetter* accessor = asGetterSetter(value); m_getter = accessor->getter(); m_setter = accessor->setter(); ASSERT(m_getter || m_setter); + m_seenAttributes = EnumerablePresent | ConfigurablePresent; + m_attributes &= ~ReadOnly; } else { m_value = value; + m_seenAttributes = EnumerablePresent | ConfigurablePresent | WritablePresent; } - m_attributes = attributes; } void PropertyDescriptor::setAccessorDescriptor(JSValue getter, JSValue setter, unsigned attributes) @@ -98,6 +108,88 @@ void PropertyDescriptor::setAccessorDescriptor(JSValue getter, JSValue setter, u m_attributes = attributes; m_getter = getter; m_setter = setter; + m_attributes &= ~ReadOnly; + m_seenAttributes = EnumerablePresent | ConfigurablePresent; +} + +void PropertyDescriptor::setWritable(bool writable) +{ + if (writable) + m_attributes &= ~ReadOnly; + else + m_attributes |= ReadOnly; + m_seenAttributes |= WritablePresent; +} + +void PropertyDescriptor::setEnumerable(bool enumerable) +{ + if (enumerable) + m_attributes &= ~DontEnum; + else + m_attributes |= DontEnum; + m_seenAttributes |= EnumerablePresent; +} + +void PropertyDescriptor::setConfigurable(bool configurable) +{ + if (configurable) + m_attributes &= ~DontDelete; + else + m_attributes |= DontDelete; + m_seenAttributes |= ConfigurablePresent; +} + +void PropertyDescriptor::setSetter(JSValue setter) +{ + m_setter = setter; + m_attributes |= Setter; + m_attributes &= ~ReadOnly; +} + +void PropertyDescriptor::setGetter(JSValue getter) +{ + m_getter = getter; + m_attributes |= Getter; + m_attributes &= ~ReadOnly; +} + +bool PropertyDescriptor::equalTo(const PropertyDescriptor& other) const +{ + if (!other.m_value == m_value || + !other.m_getter == m_getter || + !other.m_setter == m_setter) + return false; + return (!m_value || JSValue::strictEqual(other.m_value, m_value)) && + (!m_getter || JSValue::strictEqual(other.m_getter, m_getter)) && + (!m_setter || JSValue::strictEqual(other.m_setter, m_setter)) && + attributesEqual(other); +} + +bool PropertyDescriptor::attributesEqual(const PropertyDescriptor& other) const +{ + unsigned mismatch = other.m_attributes ^ m_attributes; + unsigned sharedSeen = other.m_seenAttributes & m_seenAttributes; + if (sharedSeen & WritablePresent && mismatch & ReadOnly) + return false; + if (sharedSeen & ConfigurablePresent && mismatch & DontDelete) + return false; + if (sharedSeen & EnumerablePresent && mismatch & DontEnum) + return false; + return true; +} + +unsigned PropertyDescriptor::attributesWithOverride(const PropertyDescriptor& other) const +{ + unsigned mismatch = other.m_attributes ^ m_attributes; + unsigned sharedSeen = other.m_seenAttributes & m_seenAttributes; + unsigned newAttributes = m_attributes & defaultAttributes; + if (sharedSeen & WritablePresent && mismatch & ReadOnly) + newAttributes ^= ReadOnly; + if (sharedSeen & ConfigurablePresent && mismatch & DontDelete) + newAttributes ^= DontDelete; + if (sharedSeen & EnumerablePresent && mismatch & DontEnum) + newAttributes ^= DontEnum; + return newAttributes; } } diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyDescriptor.h b/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyDescriptor.h index ad7c056..40bec86 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyDescriptor.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyDescriptor.h @@ -32,29 +32,48 @@ namespace JSC { class PropertyDescriptor { public: PropertyDescriptor() - : m_attributes(0) + : m_attributes(defaultAttributes) + , m_seenAttributes(0) { } bool writable() const; bool enumerable() const; bool configurable() const; - bool hasAccessors() const; + bool isDataDescriptor() const; + bool isGenericDescriptor() const; + bool isAccessorDescriptor() const; unsigned attributes() const { return m_attributes; } -#ifndef NDEBUG - bool isValid() const { return m_value || ((m_getter || m_setter) && hasAccessors()); } -#endif - JSValue value() const { ASSERT(m_value); return m_value; } + JSValue value() const { return m_value; } JSValue getter() const; JSValue setter() const; void setUndefined(); void setDescriptor(JSValue value, unsigned attributes); void setAccessorDescriptor(JSValue getter, JSValue setter, unsigned attributes); + void setWritable(bool); + void setEnumerable(bool); + void setConfigurable(bool); + void setValue(JSValue value) { m_value = value; } + void setSetter(JSValue); + void setGetter(JSValue); + bool isEmpty() const { return !(m_value || m_getter || m_setter || m_seenAttributes); } + bool writablePresent() const { return m_seenAttributes & WritablePresent; } + bool enumerablePresent() const { return m_seenAttributes & EnumerablePresent; } + bool configurablePresent() const { return m_seenAttributes & ConfigurablePresent; } + bool setterPresent() const { return m_setter; } + bool getterPresent() const { return m_getter; } + bool equalTo(const PropertyDescriptor& other) const; + bool attributesEqual(const PropertyDescriptor& other) const; + unsigned attributesWithOverride(const PropertyDescriptor& other) const; private: + static unsigned defaultAttributes; + bool operator==(const PropertyDescriptor&){ return false; } + enum { WritablePresent = 1, EnumerablePresent = 2, ConfigurablePresent = 4}; // May be a getter/setter JSValue m_value; JSValue m_getter; JSValue m_setter; unsigned m_attributes; + unsigned m_seenAttributes; }; } diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp index 34c27b7..7209b5f 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp @@ -127,7 +127,7 @@ Structure::Structure(JSValue prototype, const TypeInfo& typeInfo) , m_propertyTable(0) , m_propertyStorageCapacity(JSObject::inlineStorageCapacity) , m_offset(noOffset) - , m_isDictionary(false) + , m_dictionaryKind(NoneDictionaryKind) , m_isPinnedPropertyTable(false) , m_hasGetterSetterProperties(false) , m_attributesInPrevious(0) @@ -290,7 +290,7 @@ void Structure::getOwnEnumerablePropertyNames(ExecState* exec, PropertyNameArray void Structure::getEnumerablePropertyNames(ExecState* exec, PropertyNameArray& propertyNames, JSObject* baseObject) { - bool shouldCache = propertyNames.shouldCache() && !(propertyNames.size() || m_isDictionary); + bool shouldCache = propertyNames.shouldCache() && !(propertyNames.size() || isDictionary()); if (shouldCache && m_cachedPropertyNameArrayData) { if (m_cachedPropertyNameArrayData->cachedPrototypeChain() == prototypeChain(exec)) { @@ -349,7 +349,7 @@ void Structure::despecifyDictionaryFunction(const Identifier& propertyName) materializePropertyMapIfNecessary(); - ASSERT(m_isDictionary); + ASSERT(isDictionary()); ASSERT(m_propertyTable); unsigned i = rep->computedHash(); @@ -391,7 +391,7 @@ void Structure::despecifyDictionaryFunction(const Identifier& propertyName) PassRefPtr<Structure> Structure::addPropertyTransitionToExistingStructure(Structure* structure, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset) { - ASSERT(!structure->m_isDictionary); + ASSERT(!structure->isDictionary()); ASSERT(structure->typeInfo().type() == ObjectType); if (Structure* existingTransition = structure->table.get(make_pair(propertyName.ustring().rep(), attributes), specificValue)) { @@ -405,12 +405,12 @@ PassRefPtr<Structure> Structure::addPropertyTransitionToExistingStructure(Struct PassRefPtr<Structure> Structure::addPropertyTransition(Structure* structure, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset) { - ASSERT(!structure->m_isDictionary); + ASSERT(!structure->isDictionary()); ASSERT(structure->typeInfo().type() == ObjectType); ASSERT(!Structure::addPropertyTransitionToExistingStructure(structure, propertyName, attributes, specificValue, offset)); if (structure->transitionCount() > s_maxTransitionLength) { - RefPtr<Structure> transition = toDictionaryTransition(structure); + RefPtr<Structure> transition = toCacheableDictionaryTransition(structure); ASSERT(structure != transition); offset = transition->put(propertyName, attributes, specificValue); if (transition->propertyStorageSize() > transition->propertyStorageCapacity()) @@ -454,9 +454,9 @@ PassRefPtr<Structure> Structure::addPropertyTransition(Structure* structure, con PassRefPtr<Structure> Structure::removePropertyTransition(Structure* structure, const Identifier& propertyName, size_t& offset) { - ASSERT(!structure->m_isDictionary); + ASSERT(!structure->isUncacheableDictionary()); - RefPtr<Structure> transition = toDictionaryTransition(structure); + RefPtr<Structure> transition = toUncacheableDictionaryTransition(structure); offset = transition->remove(propertyName); @@ -554,25 +554,35 @@ PassRefPtr<Structure> Structure::getterSetterTransition(Structure* structure) return transition.release(); } -PassRefPtr<Structure> Structure::toDictionaryTransition(Structure* structure) +PassRefPtr<Structure> Structure::toDictionaryTransition(Structure* structure, DictionaryKind kind) { - ASSERT(!structure->m_isDictionary); - + ASSERT(!structure->isUncacheableDictionary()); + RefPtr<Structure> transition = create(structure->m_prototype, structure->typeInfo()); - transition->m_isDictionary = true; + transition->m_dictionaryKind = kind; transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity; transition->m_hasGetterSetterProperties = structure->m_hasGetterSetterProperties; - + structure->materializePropertyMapIfNecessary(); transition->m_propertyTable = structure->copyPropertyTable(); transition->m_isPinnedPropertyTable = true; - + return transition.release(); } +PassRefPtr<Structure> Structure::toCacheableDictionaryTransition(Structure* structure) +{ + return toDictionaryTransition(structure, CachedDictionaryKind); +} + +PassRefPtr<Structure> Structure::toUncacheableDictionaryTransition(Structure* structure) +{ + return toDictionaryTransition(structure, UncachedDictionaryKind); +} + PassRefPtr<Structure> Structure::fromDictionaryTransition(Structure* structure) { - ASSERT(structure->m_isDictionary); + ASSERT(structure->isDictionary()); // Since dictionary Structures are not shared, and no opcodes specialize // for them, we don't need to allocate a new Structure when transitioning @@ -581,7 +591,7 @@ PassRefPtr<Structure> Structure::fromDictionaryTransition(Structure* structure) // FIMXE: We can make this more efficient by canonicalizing the Structure (draining the // deleted offsets vector) before transitioning from dictionary. if (!structure->m_propertyTable || !structure->m_propertyTable->deletedOffsets || structure->m_propertyTable->deletedOffsets->isEmpty()) - structure->m_isDictionary = false; + structure->m_dictionaryKind = NoneDictionaryKind; return structure; } @@ -600,7 +610,7 @@ size_t Structure::addPropertyWithoutTransition(const Identifier& propertyName, u size_t Structure::removePropertyWithoutTransition(const Identifier& propertyName) { - ASSERT(m_isDictionary); + ASSERT(isUncacheableDictionary()); materializePropertyMapIfNecessary(); diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h index f7cb04b..ed9f6e5 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h @@ -70,7 +70,8 @@ namespace JSC { static PassRefPtr<Structure> despecifyFunctionTransition(Structure*, const Identifier&); static PassRefPtr<Structure> addAnonymousSlotsTransition(Structure*, unsigned count); static PassRefPtr<Structure> getterSetterTransition(Structure*); - static PassRefPtr<Structure> toDictionaryTransition(Structure*); + static PassRefPtr<Structure> toCacheableDictionaryTransition(Structure*); + static PassRefPtr<Structure> toUncacheableDictionaryTransition(Structure*); static PassRefPtr<Structure> fromDictionaryTransition(Structure*); ~Structure(); @@ -81,8 +82,9 @@ namespace JSC { size_t addPropertyWithoutTransition(const Identifier& propertyName, unsigned attributes, JSCell* specificValue); size_t removePropertyWithoutTransition(const Identifier& propertyName); void setPrototypeWithoutTransition(JSValue prototype) { m_prototype = prototype; } - - bool isDictionary() const { return m_isDictionary; } + + bool isDictionary() const { return m_dictionaryKind != NoneDictionaryKind; } + bool isUncacheableDictionary() const { return m_dictionaryKind == UncachedDictionaryKind; } const TypeInfo& typeInfo() const { return m_typeInfo; } @@ -127,6 +129,13 @@ namespace JSC { private: Structure(JSValue prototype, const TypeInfo&); + + typedef enum { + NoneDictionaryKind = 0, + CachedDictionaryKind = 1, + UncachedDictionaryKind = 2 + } DictionaryKind; + static PassRefPtr<Structure> toDictionaryTransition(Structure*, DictionaryKind); size_t put(const Identifier& propertyName, unsigned attributes, JSCell* specificValue); size_t remove(const Identifier& propertyName); @@ -187,7 +196,7 @@ namespace JSC { size_t m_propertyStorageCapacity; signed char m_offset; - bool m_isDictionary : 1; + unsigned m_dictionaryKind : 2; bool m_isPinnedPropertyTable : 1; bool m_hasGetterSetterProperties : 1; #if COMPILER(WINSCW) diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.cpp index eb57a5ac..6e8a0ee 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.cpp @@ -51,6 +51,7 @@ bool StructureChain::isCacheable() const uint32_t i = 0; while (m_vector[i]) { + // Both classes of dictionary structure may change arbitrarily so we can't cache them if (m_vector[i]->isDictionary()) return false; if (!m_vector[i++]->typeInfo().hasDefaultGetPropertyNames()) diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.h index 59efd84..b68e70c 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.h @@ -144,7 +144,13 @@ void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChann #if ASSERT_DISABLED #define ASSERT(assertion) ((void)0) +#if COMPILER(MSVC7) +#define ASSERT_WITH_MESSAGE(assertion) ((void)0) +#elif PLATFORM(SYMBIAN) +#define ASSERT_WITH_MESSAGE(assertion...) ((void)0) +#else #define ASSERT_WITH_MESSAGE(assertion, ...) ((void)0) +#endif /* COMPILER(MSVC7) */ #define ASSERT_NOT_REACHED() ((void)0) #define ASSERT_UNUSED(variable, assertion) ((void)variable) @@ -158,6 +164,8 @@ void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChann while (0) #if COMPILER(MSVC7) #define ASSERT_WITH_MESSAGE(assertion) ((void)0) +#elif PLATFORM(SYMBIAN) +#define ASSERT_WITH_MESSAGE(assertion...) ((void)0) #else #define ASSERT_WITH_MESSAGE(assertion, ...) do \ if (!(assertion)) { \ @@ -199,10 +207,12 @@ while (0) /* FATAL */ -#if FATAL_DISABLED +#if FATAL_DISABLED && !COMPILER(MSVC7) && !PLATFORM(SYMBIAN) #define FATAL(...) ((void)0) #elif COMPILER(MSVC7) #define FATAL() ((void)0) +#elif PLATFORM(SYMBIAN) +#define FATAL(args...) ((void)0) #else #define FATAL(...) do { \ WTFReportFatalError(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, __VA_ARGS__); \ @@ -212,20 +222,24 @@ while (0) /* LOG_ERROR */ -#if ERROR_DISABLED +#if ERROR_DISABLED && !COMPILER(MSVC7) && !PLATFORM(SYMBIAN) #define LOG_ERROR(...) ((void)0) #elif COMPILER(MSVC7) #define LOG_ERROR() ((void)0) +#elif PLATFORM(SYMBIAN) +#define LOG_ERROR(args...) ((void)0) #else #define LOG_ERROR(...) WTFReportError(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, __VA_ARGS__) #endif /* LOG */ -#if LOG_DISABLED +#if LOG_DISABLED && !COMPILER(MSVC7) && !PLATFORM(SYMBIAN) #define LOG(channel, ...) ((void)0) #elif COMPILER(MSVC7) #define LOG() ((void)0) +#elif PLATFORM(SYMBIAN) +#define LOG(channel, args...) ((void)0) #else #define LOG(channel, ...) WTFLog(&JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, channel), __VA_ARGS__) #define JOIN_LOG_CHANNEL_WITH_PREFIX(prefix, channel) JOIN_LOG_CHANNEL_WITH_PREFIX_LEVEL_2(prefix, channel) @@ -234,10 +248,12 @@ while (0) /* LOG_VERBOSE */ -#if LOG_DISABLED +#if LOG_DISABLED && !COMPILER(MSVC7) && !PLATFORM(SYMBIAN) #define LOG_VERBOSE(channel, ...) ((void)0) #elif COMPILER(MSVC7) #define LOG_VERBOSE(channel) ((void)0) +#elif PLATFORM(SYMBIAN) +#define LOG_VERBOSE(channel, args...) ((void)0) #else #define LOG_VERBOSE(channel, ...) WTFLogVerbose(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, &JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, channel), __VA_ARGS__) #endif diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Forward.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Forward.h index 67dc3be..448de7d 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Forward.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Forward.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 2009 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 @@ -27,6 +27,7 @@ namespace WTF { template<typename T> class ListRefPtr; template<typename T> class OwnArrayPtr; template<typename T> class OwnPtr; + template<typename T> class PassOwnPtr; template<typename T> class PassRefPtr; template<typename T> class RefPtr; template<typename T, size_t inlineCapacity> class Vector; @@ -35,9 +36,9 @@ namespace WTF { using WTF::ListRefPtr; using WTF::OwnArrayPtr; using WTF::OwnPtr; +using WTF::PassOwnPtr; using WTF::PassRefPtr; using WTF::RefPtr; using WTF::Vector; #endif // WTF_Forward_h - diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/HashCountedSet.h b/src/3rdparty/webkit/JavaScriptCore/wtf/HashCountedSet.h index 1a422d8..1fda9c1 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/HashCountedSet.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/HashCountedSet.h @@ -64,8 +64,13 @@ namespace WTF { void remove(const ValueType& value); void remove(iterator it); - void clear(); - + // removes the value, regardless of its count + void clear(iterator it); + void clear(const ValueType& value); + + // clears the whole set + void clear(); + private: ImplType m_impl; }; @@ -166,6 +171,21 @@ namespace WTF { } template<typename Value, typename HashFunctions, typename Traits> + inline void HashCountedSet<Value, HashFunctions, Traits>::clear(const ValueType& value) + { + clear(find(value)); + } + + template<typename Value, typename HashFunctions, typename Traits> + inline void HashCountedSet<Value, HashFunctions, Traits>::clear(iterator it) + { + if (it == end()) + return; + + m_impl.remove(it); + } + + template<typename Value, typename HashFunctions, typename Traits> inline void HashCountedSet<Value, HashFunctions, Traits>::clear() { m_impl.clear(); diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/ListRefPtr.h b/src/3rdparty/webkit/JavaScriptCore/wtf/ListRefPtr.h index 9f9a354..d863226 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/ListRefPtr.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/ListRefPtr.h @@ -34,13 +34,8 @@ namespace WTF { ListRefPtr(const RefPtr<T>& o) : RefPtr<T>(o) {} // see comment in PassRefPtr.h for why this takes const reference template <typename U> ListRefPtr(const PassRefPtr<U>& o) : RefPtr<T>(o) {} - - ~ListRefPtr() - { - RefPtr<T> reaper = this->release(); - while (reaper && reaper->hasOneRef()) - reaper = reaper->releaseNext(); // implicitly protects reaper->next, then derefs reaper - } + + ~ListRefPtr(); ListRefPtr& operator=(T* optr) { RefPtr<T>::operator=(optr); return *this; } ListRefPtr& operator=(const RefPtr<T>& o) { RefPtr<T>::operator=(o); return *this; } @@ -49,6 +44,17 @@ namespace WTF { template <typename U> ListRefPtr& operator=(const PassRefPtr<U>& o) { RefPtr<T>::operator=(o); return *this; } }; + template <typename T> +#if !COMPILER(WINSCW) + inline +#endif + ListRefPtr<T>::~ListRefPtr() + { + RefPtr<T> reaper = this->release(); + while (reaper && reaper->hasOneRef()) + reaper = reaper->releaseNext(); // implicitly protects reaper->next, then derefs reaper + } + template <typename T> inline T* getPtr(const ListRefPtr<T>& p) { return p.get(); diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h index 2abf3d2..e508f77 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h @@ -226,8 +226,11 @@ #endif /* PLATFORM(ARM) */ +#define PLATFORM_ARM_ARCH(N) (PLATFORM(ARM) && ARM_ARCH_VERSION >= N) + #if defined(arm) \ - || defined(__arm__) + || defined(__arm__) \ + || defined(__MARM__) #define WTF_PLATFORM_ARM 1 #if defined(__ARMEB__) #define WTF_PLATFORM_BIG_ENDIAN 1 @@ -241,22 +244,35 @@ #endif #if defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) \ || defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) \ - || defined(__ARM_ARCH_5TEJ__) + || defined(__ARM_ARCH_5TEJ__) || defined(__MARM_ARMV5__) #undef ARM_ARCH_VERSION #define ARM_ARCH_VERSION 5 #endif #if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \ || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) \ - || defined(__ARM_ARCH_6ZK__) + || defined(__ARM_ARCH_6ZK__) || defined(__ARMV6__) #undef ARM_ARCH_VERSION #define ARM_ARCH_VERSION 6 #endif -#if defined(__ARM_ARCH_7A__) +#if defined(__ARM_ARCH_7A__) || defined(__ARMV7__) #undef ARM_ARCH_VERSION #define ARM_ARCH_VERSION 7 #endif +/* Defines two pseudo-platforms for ARM and Thumb-2 instruction set. */ +#if !defined(WTF_PLATFORM_ARM_TRADITIONAL) && !defined(WTF_PLATFORM_ARM_THUMB2) +# if defined(thumb2) || defined(__thumb2__) +# define WTF_PLATFORM_ARM_TRADITIONAL 0 +# define WTF_PLATFORM_ARM_THUMB2 1 +# elif PLATFORM_ARM_ARCH(4) || PLATFORM_ARM_ARCH(5) +# define WTF_PLATFORM_ARM_TRADITIONAL 1 +# define WTF_PLATFORM_ARM_THUMB2 0 +# else +# error "Not supported ARM architecture" +# endif +#elif PLATFORM(ARM_TRADITIONAL) && PLATFORM(ARM_THUMB2) /* Sanity Check */ +# error "Cannot use both of WTF_PLATFORM_ARM_TRADITIONAL and WTF_PLATFORM_ARM_THUMB2 platforms" +#endif // !defined(ARM_TRADITIONAL) && !defined(ARM_THUMB2) #endif /* ARM */ -#define PLATFORM_ARM_ARCH(N) (PLATFORM(ARM) && ARM_ARCH_VERSION >= N) /* PLATFORM(X86) */ #if defined(__i386__) \ @@ -392,6 +408,9 @@ #if PLATFORM(MAC) && !PLATFORM(IPHONE) #define WTF_PLATFORM_CF 1 #define WTF_USE_PTHREADS 1 +#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_TIGER) && defined(__x86_64__) +#define WTF_USE_PLUGIN_HOST_PROCESS 1 +#endif #if !defined(ENABLE_MAC_JAVA_BRIDGE) #define ENABLE_MAC_JAVA_BRIDGE 1 #endif @@ -400,7 +419,7 @@ #endif #define HAVE_READLINE 1 #define HAVE_RUNLOOP_TIMER 1 -#endif +#endif // PLATFORM(MAC) && !PLATFORM(IPHONE) #if PLATFORM(CHROMIUM) && PLATFORM(DARWIN) #define WTF_PLATFORM_CF 1 @@ -408,18 +427,19 @@ #endif #if PLATFORM(IPHONE) -#define WTF_PLATFORM_CF 1 -#define WTF_USE_PTHREADS 1 #define ENABLE_CONTEXT_MENUS 0 #define ENABLE_DRAG_SUPPORT 0 #define ENABLE_FTPDIR 1 +#define ENABLE_GEOLOCATION 1 +#define ENABLE_ICONDATABASE 0 #define ENABLE_INSPECTOR 0 #define ENABLE_MAC_JAVA_BRIDGE 0 -#define ENABLE_ICONDATABASE 0 -#define ENABLE_GEOLOCATION 1 #define ENABLE_NETSCAPE_PLUGIN_API 0 -#define HAVE_READLINE 1 +#define ENABLE_ORIENTATION_EVENTS 1 #define ENABLE_REPAINT_THROTTLING 1 +#define HAVE_READLINE 1 +#define WTF_PLATFORM_CF 1 +#define WTF_USE_PTHREADS 1 #endif #if PLATFORM(WIN) @@ -579,6 +599,14 @@ #define ENABLE_NETSCAPE_PLUGIN_API 1 #endif +#if !defined(WTF_USE_PLUGIN_HOST_PROCESS) +#define WTF_USE_PLUGIN_HOST_PROCESS 0 +#endif + +#if !defined(ENABLE_ORIENTATION_EVENTS) +#define ENABLE_ORIENTATION_EVENTS 0 +#endif + #if !defined(ENABLE_OPCODE_STATS) #define ENABLE_OPCODE_STATS 0 #endif @@ -637,7 +665,7 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */ #elif PLATFORM(X86) && PLATFORM(MAC) #define ENABLE_JIT 1 #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1 -#elif PLATFORM_ARM_ARCH(7) && PLATFORM(IPHONE) +#elif PLATFORM(ARM_THUMB2) && PLATFORM(IPHONE) /* Under development, temporarily disabled until 16Mb link range limit in assembler is fixed. */ #define ENABLE_JIT 0 #define ENABLE_JIT_OPTIMIZE_NATIVE_CALL 0 @@ -656,8 +684,11 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */ #elif PLATFORM(X86) && PLATFORM(LINUX) && GCC_VERSION >= 40100 #define ENABLE_JIT 1 #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1 -#elif PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7) && PLATFORM(LINUX) +#elif PLATFORM(ARM_TRADITIONAL) && PLATFORM(LINUX) #define ENABLE_JIT 1 + #if PLATFORM(ARM_THUMB2) + #define ENABLE_JIT_OPTIMIZE_NATIVE_CALL 0 + #endif #endif #endif /* PLATFORM(QT) */ @@ -703,7 +734,7 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */ #if (PLATFORM(X86) && PLATFORM(MAC)) \ || (PLATFORM(X86_64) && PLATFORM(MAC)) \ /* Under development, temporarily disabled until 16Mb link range limit in assembler is fixed. */ \ - || (PLATFORM_ARM_ARCH(7) && PLATFORM(IPHONE) && 0) \ + || (PLATFORM(ARM_THUMB2) && PLATFORM(IPHONE) && 0) \ || (PLATFORM(X86) && PLATFORM(WIN)) #define ENABLE_YARR 1 #define ENABLE_YARR_JIT 1 @@ -713,7 +744,7 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */ #if (PLATFORM(X86) && PLATFORM(WIN_OS) && COMPILER(MINGW) && GCC_VERSION >= 40100) \ || (PLATFORM(X86) && PLATFORM(WIN_OS) && COMPILER(MSVC)) \ || (PLATFORM(X86) && PLATFORM(LINUX) && GCC_VERSION >= 40100) \ - || (PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7) && PLATFORM(LINUX)) + || (PLATFORM(ARM_TRADITIONAL) && PLATFORM(LINUX)) #define ENABLE_YARR 1 #define ENABLE_YARR_JIT 1 #endif diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtr.h b/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtr.h index 77835ad..1a0b1fe 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtr.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtr.h @@ -50,7 +50,7 @@ namespace WTF { ~RefPtr() { T* ptr = m_ptr; derefIfNotNull(ptr); } - template <typename U> RefPtr(const RefPtr<U>& o) : m_ptr(o.get()) { if (T* ptr = m_ptr) ptr->ref(); } + template <typename U> RefPtr(const RefPtr<U>& o) : m_ptr(static_cast<T*>(o.get())) { if (T* ptr = static_cast<T*>(m_ptr)) ptr->ref(); } T* get() const { return m_ptr; } diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h index 7cba4e4..e1fc5b4 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h @@ -63,6 +63,13 @@ namespace WTF { template <size_t size> struct AlignedBuffer<size, 32> { WTF_ALIGNED(AlignedBufferChar, buffer[size], 32); }; template <size_t size> struct AlignedBuffer<size, 64> { WTF_ALIGNED(AlignedBufferChar, buffer[size], 64); }; + template <size_t size, size_t alignment> + void swap(AlignedBuffer<size, alignment>& a, AlignedBuffer<size, alignment>& b) + { + for (size_t i = 0; i < size; ++i) + std::swap(a.buffer[i], b.buffer[i]); + } + template <bool needsDestruction, typename T> class VectorDestructor; @@ -404,6 +411,27 @@ namespace WTF { Base::deallocateBuffer(bufferToDeallocate); } + void swap(VectorBuffer<T, inlineCapacity>& other) + { + if (buffer() == inlineBuffer() && other.buffer() == other.inlineBuffer()) { + WTF::swap(m_inlineBuffer, other.m_inlineBuffer); + std::swap(m_capacity, other.m_capacity); + } else if (buffer() == inlineBuffer()) { + m_buffer = other.m_buffer; + other.m_buffer = other.inlineBuffer(); + WTF::swap(m_inlineBuffer, other.m_inlineBuffer); + std::swap(m_capacity, other.m_capacity); + } else if (other.buffer() == other.inlineBuffer()) { + other.m_buffer = m_buffer; + m_buffer = inlineBuffer(); + WTF::swap(m_inlineBuffer, other.m_inlineBuffer); + std::swap(m_capacity, other.m_capacity); + } else { + std::swap(m_buffer, other.m_buffer); + std::swap(m_capacity, other.m_capacity); + } + } + void restoreInlineBufferIfNeeded() { if (m_buffer) diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/Unicode.h b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/Unicode.h index d59439d..7016a03 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/Unicode.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/Unicode.h @@ -26,7 +26,11 @@ #include <wtf/Assertions.h> #if USE(QT4_UNICODE) +#if COMPILER(WINSCW) || COMPILER(RVCT) +#include "wtf/unicode/qt4/UnicodeQt4.h" +#else #include "qt4/UnicodeQt4.h" +#endif #elif USE(ICU_UNICODE) #include <wtf/unicode/icu/UnicodeIcu.h> #elif USE(GLIB_UNICODE) diff --git a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.cpp b/src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.cpp index 16b1ecc..4390b5b 100644 --- a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.cpp @@ -1309,7 +1309,7 @@ class RegexGenerator : private MacroAssembler { loadPtr(Address(X86Registers::ebp, 2 * sizeof(void*)), output); #endif #elif PLATFORM(ARM) -#if !PLATFORM_ARM_ARCH(7) +#if PLATFORM(ARM_TRADITIONAL) push(ARMRegisters::lr); #endif push(ARMRegisters::r4); diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 16d854d..e13219b 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -4,8 +4,8 @@ This is a snapshot of the Qt port of WebKit from The commit imported was from the - origin/qtwebkit-4.6-staging branch/tag + qtwebkit-4.6-snapshot-24092009 branch/tag and has the sha1 checksum - f572f72dce91be9a4525941c87d1b0a8c383ba39 + 75c44947a340d74a9e0098a3dfffabce0c9512ef diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 8a278ce..5d83c7b 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,2660 @@ +2009-09-24 Oswald Buddenhagen <oswald.buddenhagen@nokia.com> + + Reviewed by Simon Hausmann. + + Fix QApp::translate() calls to provide the correct class name without + a trailing comma. + + * platform/qt/Localizations.cpp: + (WebCore::localizedMediaTimeDescription): + +2009-09-24 Geoffrey Garen <ggaren@apple.com> + + More build fix: Removed JSSharedWorkerContextCustom.cpp from project + files, since it no longer exists in the repository. + + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + +2009-09-24 Geoffrey Garen <ggaren@apple.com> + + Windows build fix: Declare set/unsetPendingActivity public, so + SharedWorkerScriptLoader can call them. + + * dom/ActiveDOMObject.h: + +2009-09-24 Geoffrey Garen <ggaren@apple.com> + + Fixed a bit of the Windows build. + + * workers/SharedWorker.idl: Declare a custom mark function. (I accidentally + removed this in my last patch.) + * WebCore.xcodeproj/project.pbxproj: Added JSSharedWorkerCustom.cpp back + to the build. (I accidentally removed this in my last patch.) + +2009-09-23 Geoffrey Garen <ggaren@apple.com> + + 32-bit build fix: restore previous cast that I thought was unnecessary. + + * xml/XMLHttpRequest.cpp: + (WebCore::XMLHttpRequest::didSendData): + (WebCore::XMLHttpRequest::didReceiveData): + +2009-09-23 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Sam Weinig. + + Bring a little sanity to this crazy EventTarget world of ours + https://bugs.webkit.org/show_bug.cgi?id=29701 + + Lots of EventTarget refactoring to achieve a single shared implementation + that fixes some of the performance and correctness bugs of the many individual + implementations, and makes reasoning about EventTargets and EventListeners + much easier. + + The basic design is this: + - EventTarget manages a set of EventListeners. + - onXXX EventListener attributes forward to standard EventTarget APIs. + - Since the onXXX code is repetitive, it is usually done with macros + of the form DEFINE_ATTRIBUTE_EVENT_LISTENER(attributeName). + - EventTarget provides a shared implementation of dispatchEvent, + which subclasses with special event dispatch rules, like Node, override. + - To support Node, which lazily instantiates its EventTarget data, + EventTarget has no data members, and instead makes a virtual call + to get its data from wherever its subclass chose to store it. + + Code that used to call dispatchEvent, passing an ExceptionCode paratmeter, + even though no exception could be thrown, has been changed not to do so, + to improve clarity and performance. + + Code that used to call a special dispatchXXXEvent function, which just + turned around and called dispatchEvent, has been changed to call + dispatchEvent, to improve clarity and performance. + + * WebCore.base.exp: + * WebCore.xcodeproj/project.pbxproj: Another day in the life of a WebKit + engineer. + + * bindings/js/JSDOMBinding.cpp: + (WebCore::isObservableThroughDOM): Updated for Node API change. Added + "is not in the document but is firing event listeners" as a condition + that makes a Node observable in the DOM, so that event listeners firing + on removed nodes are not destroyed midstream. (This was a long-standing + bug that was somewhat hidden by the old implementation's habit of + copying the RegisteredEventListener vector before firing events, which + would keep almost all the relevant objects from being destroyed.) + + * bindings/js/JSEventListener.cpp: + (WebCore::JSEventListener::handleEvent): Removed the isWindowEvent flag + because it was one of the most elaborately planned no-ops in the history + of software crime, and one of the reasons clients thought they needed more + than one dispatchEvent function even though they didn't. + * bindings/js/JSEventListener.h: + + * bindings/js/JSDOMWindowCustom.cpp: + (WebCore::JSDOMWindow::markChildren): + (WebCore::JSMessagePort::markChildren): + * bindings/js/JSNodeCustom.cpp: + (WebCore::JSNode::markChildren): + * bindings/js/JSAbstractWorkerCustom.cpp: + * bindings/js/JSDOMApplicationCacheCustom.cpp: + * bindings/js/JSDedicatedWorkerContextCustom.cpp: + * bindings/js/JSEventSourceCustom.cpp: + * bindings/js/JSMessagePortCustom.cpp: + * bindings/js/JSSharedWorkerContextCustom.cpp: Removed. + * bindings/js/JSWebSocketCustom.cpp: + * bindings/js/JSWorkerContextCustom.cpp: + (WebCore::JSWorkerContext::markChildren): + * bindings/js/JSWorkerCustom.cpp: + * bindings/js/JSXMLHttpRequestCustom.cpp: + (WebCore::JSXMLHttpRequest::markChildren): + * bindings/js/JSXMLHttpRequestUploadCustom.cpp: + (WebCore::JSXMLHttpRequestUpload::markChildren): EventListener marking is + now autogenerated. Classes that still have custom mark functions for other + reasons now call a shared EventTarget API to mark their EventListeners. + + * bindings/objc/ObjCEventListener.h: + * bindings/objc/ObjCEventListener.mm: + (WebCore::ObjCEventListener::handleEvent): Bye bye isWindowEvent. + + * bindings/scripts/CodeGeneratorJS.pm: Autogeneration support for + marking and invalidating event listeners. + + * dom/CharacterData.cpp: + (WebCore::CharacterData::dispatchModifiedEvent): + * dom/ContainerNode.cpp: + (WebCore::ContainerNode::insertBefore): + (WebCore::ContainerNode::replaceChild): + (WebCore::willRemoveChild): + (WebCore::ContainerNode::appendChild): + (WebCore::dispatchChildInsertionEvents): + (WebCore::dispatchChildRemovalEvents): + * dom/Document.cpp: + (WebCore::Document::removeAllEventListeners): + (WebCore::Document::implicitClose): + (WebCore::Document::setFocusedNode): + (WebCore::Document::dispatchWindowEvent): + (WebCore::Document::dispatchWindowLoadEvent): + (WebCore::Document::finishedParsing): + * dom/Document.h: Use dispatchEvent directly. + + * dom/Element.h: Moved a few event listener attributes down from Node, + since they don't apply to all Nodes, only Elements. + + * dom/EventListener.h: Removed isWindowEvent parameter. + + * dom/EventNames.h: Added the "display" event name, so it works correctly + with attribute macros, and for performance. + + * dom/EventTarget.cpp: + (WebCore::forbidEventDispatch): + (WebCore::allowEventDispatch): + (WebCore::eventDispatchForbidden): Made this code (embarrasingly) thread + safe, since it's now called on multiple threads. (Currently, we only forbid + event dispatch on the main thread. If we ever want to forbid event dispatch + on secondary threads, we can improve it then.) + + (WebCore::EventTarget::addEventListener): + (WebCore::EventTarget::removeEventListener): + (WebCore::EventTarget::setAttributeEventListener): + (WebCore::EventTarget::getAttributeEventListener): + (WebCore::EventTarget::clearAttributeEventListener): + (WebCore::EventTarget::dispatchEvent): + (WebCore::EventTarget::fireEventListeners): + (WebCore::EventTarget::getEventListeners): + (WebCore::EventTarget::removeAllEventListeners): + * dom/EventTarget.h: + (WebCore::FiringEventEndIterator::FiringEventEndIterator): + (WebCore::EventTarget::ref): + (WebCore::EventTarget::deref): + (WebCore::EventTarget::markEventListeners): + (WebCore::EventTarget::invalidateEventListeners): + (WebCore::EventTarget::isFiringEventListeners): + (WebCore::EventTarget::hasEventListeners): The ONE TRUE IMPLEMENTATION of + EventTarget APIs, crafted from an amalgam of all the different versions + we used to have. The most significant change here is that we no longer + make a copy of an EventListener vector before firing the events in the + vector -- instead, we use a reference to the original vector, along with + a notification mechanism for the unlikely case when an EventListener is + removed from the vector. This substantially reduces malloc, copying, and + refcount overhead, and complexity. + + * dom/InputElement.cpp: + (WebCore::InputElement::setValueFromRenderer): + * dom/MessageEvent.h: + (WebCore::MessageEvent::create): Use dispatchEvent directly. + + * dom/MessagePort.cpp: + (WebCore::MessagePort::dispatchMessages): + (WebCore::MessagePort::eventTargetData): + (WebCore::MessagePort::ensureEventTargetData): + * dom/MessagePort.h: + (WebCore::MessagePort::setOnmessage): + (WebCore::MessagePort::onmessage): + * dom/MessagePort.idl: Removed custom EventTarget implementation. + + * dom/MutationEvent.h: + (WebCore::MutationEvent::create): Added some default values so callers + can construct MutationEvents more easily, without calling a custom dispatch + function. + + * dom/Node.cpp: + (WebCore::Node::addEventListener): + (WebCore::Node::removeEventListener): + (WebCore::Node::eventTargetData): + (WebCore::Node::ensureEventTargetData): + (WebCore::Node::handleLocalEvents): + (WebCore::Node::dispatchEvent): + (WebCore::Node::dispatchGenericEvent): + (WebCore::Node::dispatchSubtreeModifiedEvent): + (WebCore::Node::dispatchUIEvent): + (WebCore::Node::dispatchKeyEvent): + (WebCore::Node::dispatchMouseEvent): + (WebCore::Node::dispatchWheelEvent): + (WebCore::Node::dispatchFocusEvent): + (WebCore::Node::dispatchBlurEvent): + * dom/Node.h: + (WebCore::Node::preDispatchEventHandler): + (WebCore::Node::postDispatchEventHandler): + * dom/Node.idl: + * dom/NodeRareData.h: + (WebCore::NodeRareData::eventTargetData): + (WebCore::NodeRareData::ensureEventTargetData): Use the shared EventTarget + interface, and call dispatchEvent directly instead of custom dispatchXXXEvent + functions that just forwarded to dispatchEvent. + + * dom/RegisteredEventListener.cpp: + * dom/RegisteredEventListener.h: + (WebCore::RegisteredEventListener::RegisteredEventListener): + (WebCore::operator==): This is just a simple struct now, since we no longer + do a complicated copy / refCount / isRemoved dance just to honor the rule + that an EventListener can be removed during event dispatch. + + * history/CachedFrame.cpp: + (WebCore::CachedFrameBase::restore): Removed another custom dispatchEvent. + + * html/HTMLBodyElement.cpp: + * html/HTMLBodyElement.h: Use the shared EventTarget API. + + * html/HTMLFormControlElement.cpp: + (WebCore::HTMLFormControlElement::dispatchFormControlChangeEvent): + (WebCore::HTMLFormControlElement::checkValidity): + * html/HTMLFormElement.cpp: + (WebCore::HTMLFormElement::handleLocalEvents): + (WebCore::HTMLFormElement::prepareSubmit): + (WebCore::HTMLFormElement::reset): + * html/HTMLFormElement.h: Use the standard dispatchEvent API. + + * html/HTMLFrameSetElement.cpp: + * html/HTMLFrameSetElement.h: Use the shared EventTarget API. + + * html/HTMLImageLoader.cpp: + (WebCore::HTMLImageLoader::dispatchLoadEvent): + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::onSearch): + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::loadInternal): + * html/HTMLScriptElement.cpp: + (WebCore::HTMLScriptElement::dispatchLoadEvent): + (WebCore::HTMLScriptElement::dispatchErrorEvent): + * html/HTMLSourceElement.cpp: + (WebCore::HTMLSourceElement::errorEventTimerFired): + * html/HTMLTokenizer.cpp: + (WebCore::HTMLTokenizer::notifyFinished): Use the standard dispatchEvent API. + + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::handleEvent): + * inspector/InspectorDOMAgent.h: + * inspector/InspectorDOMStorageResource.cpp: + (WebCore::InspectorDOMStorageResource::handleEvent): + * inspector/InspectorDOMStorageResource.h: + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::stopLoading): + (WebCore::FrameLoader::canCachePageContainingThisFrame): + (WebCore::FrameLoader::logCanCacheFrameDecision): + (WebCore::HashChangeEventTask::performTask): + (WebCore::FrameLoader::pageHidden): No more isWindowEvent. + + * loader/ImageDocument.cpp: + (WebCore::ImageEventListener::handleEvent): + * loader/appcache/ApplicationCacheGroup.cpp: + (WebCore::CallCacheListenerTask::performTask): + * loader/appcache/ApplicationCacheHost.cpp: + (WebCore::ApplicationCacheHost::notifyDOMApplicationCache): + * loader/appcache/ApplicationCacheHost.h: + * loader/appcache/DOMApplicationCache.cpp: + (WebCore::DOMApplicationCache::eventTargetData): + (WebCore::DOMApplicationCache::ensureEventTargetData): + * loader/appcache/DOMApplicationCache.h: + * loader/appcache/DOMApplicationCache.idl: Switched to the standard + EventTarget API. As a part of this, I switched this class from using a + custom internal event name enumeration to using the standard EventNames. + + * notifications/Notification.cpp: + (WebCore::Notification::eventTargetData): + (WebCore::Notification::ensureEventTargetData): + * notifications/Notification.h: + (WebCore::Notification::scriptExecutionContext): + * notifications/Notification.idl: Switched to the standard EventTarget API. + + * page/DOMWindow.cpp: + (WebCore::PostMessageTimer::event): + (WebCore::windowsWithUnloadEventListeners): + (WebCore::windowsWithBeforeUnloadEventListeners): + (WebCore::allowsBeforeUnloadListeners): + (WebCore::DOMWindow::dispatchAllPendingBeforeUnloadEvents): + (WebCore::DOMWindow::pendingUnloadEventListeners): + (WebCore::DOMWindow::dispatchAllPendingUnloadEvents): Changed the "pending" + unload / beforeunload listener tracker just to track which windows had + such listeners, instead of actually keeping a copy of the listeners. Now, + this code can use the standard EventTarget API. + + (WebCore::DOMWindow::~DOMWindow): + (WebCore::DOMWindow::postMessageTimerFired): + (WebCore::DOMWindow::addEventListener): + (WebCore::DOMWindow::removeEventListener): + (WebCore::DOMWindow::dispatchLoadEvent): + (WebCore::DOMWindow::dispatchEvent): + (WebCore::DOMWindow::removeAllEventListeners): + (WebCore::DOMWindow::captureEvents): + (WebCore::DOMWindow::releaseEvents): + (WebCore::DOMWindow::eventTargetData): + (WebCore::DOMWindow::ensureEventTargetData): + * page/DOMWindow.h: + * page/DOMWindow.idl: Use the standard EventTarget APIs. + + * page/EventHandler.cpp: + (WebCore::EventHandler::canMouseDownStartSelect): + (WebCore::EventHandler::canMouseDragExtendSelect): + (WebCore::EventHandler::sendResizeEvent): + (WebCore::EventHandler::sendScrollEvent): Use dispatchEvent directly. + + * page/EventSource.cpp: + (WebCore::EventSource::endRequest): + (WebCore::EventSource::didReceiveResponse): + (WebCore::EventSource::parseEventStreamLine): + (WebCore::EventSource::stop): + (WebCore::EventSource::createMessageEvent): + (WebCore::EventSource::eventTargetData): + (WebCore::EventSource::ensureEventTargetData): + * page/EventSource.h: + * page/EventSource.idl: Use the standard EventTarget APIs. + + * page/FocusController.cpp: + (WebCore::dispatchEventsOnWindowAndFocusedNode): + (WebCore::FocusController::setFocusedFrame): + * page/Frame.cpp: + (WebCore::Frame::shouldClose): + * page/Frame.h: + * page/Page.cpp: + (WebCore::networkStateChanged): + * page/animation/AnimationController.cpp: + (WebCore::AnimationControllerPrivate::updateStyleIfNeededDispatcherFired): + * rendering/RenderListBox.cpp: + (WebCore::RenderListBox::valueChanged): + * rendering/RenderTextControl.cpp: + (WebCore::RenderTextControl::selectionChanged): + * rendering/RenderTextControlMultiLine.cpp: + (WebCore::RenderTextControlMultiLine::subtreeHasChanged): Use dispatchEvent. + + * svg/SVGElement.cpp: + (WebCore::hasLoadListener): Rewritten for new EventTarget API. + + * svg/SVGElementInstance.cpp: + (WebCore::dummyEventTargetData): + (WebCore::SVGElementInstance::addEventListener): + (WebCore::SVGElementInstance::removeEventListener): + (WebCore::SVGElementInstance::removeAllEventListeners): + (WebCore::SVGElementInstance::dispatchEvent): + (WebCore::SVGElementInstance::eventTargetData): + (WebCore::SVGElementInstance::ensureEventTargetData): Use the EventTarget API. + + * svg/SVGElementInstance.h: + * svg/SVGImageLoader.cpp: + (WebCore::SVGImageLoader::dispatchLoadEvent): + * svg/SVGScriptElement.cpp: + (WebCore::SVGScriptElement::dispatchErrorEvent): Use dispatchEvent directly. + + * svg/SVGUseElement.cpp: + (WebCore::SVGUseElement::transferEventListenersToShadowTree): Updated for + new EventTarget API. + + * svg/animation/SVGSMILElement.cpp: + (WebCore::ConditionEventListener::handleEvent): No more isWindowEvent. + + * websockets/WebSocket.cpp: + (WebCore::ProcessWebSocketEventTask::create): + (WebCore::ProcessWebSocketEventTask::performTask): + (WebCore::ProcessWebSocketEventTask::ProcessWebSocketEventTask): + (WebCore::WebSocket::didConnect): + (WebCore::WebSocket::didReceiveMessage): + (WebCore::WebSocket::didClose): + (WebCore::WebSocket::eventTargetData): + (WebCore::WebSocket::ensureEventTargetData): + * websockets/WebSocket.h: + * websockets/WebSocket.idl: + * workers/AbstractWorker.cpp: + (WebCore::AbstractWorker::eventTargetData): + (WebCore::AbstractWorker::ensureEventTargetData): + * workers/AbstractWorker.h: + * workers/AbstractWorker.idl: + * workers/DedicatedWorkerContext.cpp: + * workers/DedicatedWorkerContext.h: + * workers/DedicatedWorkerContext.idl: + * workers/DefaultSharedWorkerRepository.cpp: + (WebCore::SharedWorkerConnectTask::performTask): + (WebCore::SharedWorkerScriptLoader::load): + (WebCore::SharedWorkerScriptLoader::notifyFinished): + * workers/SharedWorker.idl: + * workers/SharedWorkerContext.cpp: + (WebCore::createConnectEvent): + * workers/SharedWorkerContext.h: + * workers/SharedWorkerContext.idl: + * workers/Worker.cpp: + (WebCore::Worker::notifyFinished): + * workers/Worker.h: + * workers/Worker.idl: + * workers/WorkerContext.cpp: + (WebCore::WorkerContext::eventTargetData): + (WebCore::WorkerContext::ensureEventTargetData): + * workers/WorkerContext.h: + * workers/WorkerContext.idl: + * workers/WorkerMessagingProxy.cpp: + (WebCore::MessageWorkerContextTask::performTask): + (WebCore::MessageWorkerTask::performTask): + (WebCore::WorkerExceptionTask::performTask): + * xml/XMLHttpRequest.cpp: + (WebCore::XMLHttpRequest::callReadyStateChangeListener): + (WebCore::XMLHttpRequest::createRequest): + (WebCore::XMLHttpRequest::abort): + (WebCore::XMLHttpRequest::networkError): + (WebCore::XMLHttpRequest::abortError): + (WebCore::XMLHttpRequest::didSendData): + (WebCore::XMLHttpRequest::didReceiveData): + (WebCore::XMLHttpRequest::eventTargetData): + (WebCore::XMLHttpRequest::ensureEventTargetData): + * xml/XMLHttpRequest.h: + * xml/XMLHttpRequest.idl: + * xml/XMLHttpRequestProgressEvent.h: + (WebCore::XMLHttpRequestProgressEvent::create): + * xml/XMLHttpRequestUpload.cpp: + (WebCore::XMLHttpRequestUpload::eventTargetData): + (WebCore::XMLHttpRequestUpload::ensureEventTargetData): + * xml/XMLHttpRequestUpload.h: + * xml/XMLHttpRequestUpload.idl: Use new EventTarget API. + +2009-09-23 Kent Tamura <tkent@chromium.org> + + Reviewed by Darin Adler. + + - Support for maxLength of <textarea> + - Move numGraphemeClusters() and numCharactersInGraphemeClusters() from InputElement to String. + https://bugs.webkit.org/show_bug.cgi?id=29292 + + Test: fast/forms/textarea-maxlength.html + + * dom/InputElement.cpp: + (WebCore::InputElement::sanitizeUserInputValue): + (WebCore::InputElement::handleBeforeTextInsertedEvent): + * html/HTMLTextAreaElement.cpp: + (WebCore::HTMLTextAreaElement::defaultEventHandler): + (WebCore::HTMLTextAreaElement::handleBeforeTextInsertedEvent): + (WebCore::HTMLTextAreaElement::sanitizeUserInputValue): + (WebCore::HTMLTextAreaElement::maxLength): + (WebCore::HTMLTextAreaElement::setMaxLength): + * html/HTMLTextAreaElement.h: + * html/HTMLTextAreaElement.idl: + * platform/text/PlatformString.h: + * platform/text/String.cpp: + (WebCore::String::numGraphemeClusters): + (WebCore::String::numCharactersInGraphemeClusters): + +2009-09-23 Martin Robinson <martin.james.robinson@gmail.com> + + Reviewed by Xan Lopez. + + [GTK] REGRESSION: BitmapImage::getGdkPixbuf fails for non-square images + https://bugs.webkit.org/show_bug.cgi?id=29654 + + Give GDK_Backspace key events the proper text properties. + + Instead of adding new tests, this change removes existing tests + from Gtk's skipped list. + + * platform/gtk/KeyEventGtk.cpp: + (WebCore::keyIdentifierForGdkKeyCode): + (WebCore::singleCharacterString): + +2009-09-23 Sam Weinig <sam@webkit.org> + + Reviewed by Adam Barth. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=26989 + Should allow navigation of top-level openers + <rdar://problem/7034025> + + Allow navigation of cross-origin window.opener if it is top-level frame. + + Test: http/tests/security/frameNavigation/cross-origin-opener.html + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::shouldAllowNavigation): + +2009-09-23 Marshall Culpepper <mculpepper@appcelerator.com> + + Reviewed by Eric Seidel. + + Added $(WebKitLibrariesDir)/include/cairo so cairo.h is found by + default when the necessary dependencies are extracted into the + WebKitLibrariesDir. + https://bugs.webkit.org/show_bug.cgi?id=29661 + + * WebCore.vcproj/WebCoreCairo.vsprops: + +2009-09-23 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + Crash when website does a history.back() followed by an alert() + https://bugs.webkit.org/show_bug.cgi?id=29686 + rdar://problem/6984996 + + When loading is deferred, we need to defer timer-based loads + too, not just networking-driven loads. Otherwise we can get + syncronouse navigation while running a script, which leads to + crashes and other badness. + + This patch includes a manual test; an automated test may be + possible some time in the future. + + * dom/Document.cpp: + (WebCore::Document::processHttpEquiv): Use scheduleLocationChange + instead of scheduleHTTPRedirection to implement the navigation + needed for x-frame-options. + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::FrameLoader): Updated for data members with + new names and new data members. + (WebCore::FrameLoader::setDefersLoading): When turning deferral + off, call startRedirectionTimer and startCheckCompleteTimer, since + either of them might have been fired and ignored while defersLoading + was true. + (WebCore::FrameLoader::clear): Updated for replacement of the + m_checkCompletedTimer and m_checkLoadCompleteTimer timers. + (WebCore::FrameLoader::allAncestorsAreComplete): Added. + (WebCore::FrameLoader::checkCompleted): Added code to set + m_shouldCallCheckCompleted to false. Changed code that calls + startRedirectionTimer to call it unconditionally, since that + function now knows when to do work and doesn't expect callers + to handle that any more. + (WebCore::FrameLoader::checkTimerFired): Added. Replaces the old + timer fired callbacks. Calls checkCompleted and checkLoadComplete + as appropriate, but not when defersLoading is true. + (WebCore::FrameLoader::startCheckCompleteTimer): Added. Replaces + the two different calls to start timers before. Only starts the + timers if they are needed. + (WebCore::FrameLoader::scheduleCheckCompleted): Changed to call + startCheckCompleteTimer after setting boolean. + (WebCore::FrameLoader::scheduleCheckLoadComplete): Ditto. + (WebCore::FrameLoader::scheduleHistoryNavigation): Removed + canGoBackOrForward check. The logic works more naturally when + we don't do anything until the timer fires. + (WebCore::FrameLoader::redirectionTimerFired): Do nothing if + defersLoading is true. Also moved canGoBackOrForward check here. + (WebCore::FrameLoader::scheduleRedirection): Changed code that + calls startRedirectionTimer to do so unconditionally. That + function now handles the rules about when to start the timer + rather than expecting the caller to do so. + (WebCore::FrameLoader::startRedirectionTimer): Added code to + handle the case where there is no redirection scheduled, + where the timer is already active, or where this is a classic + redirection and there is an ancestor that has not yet completed + loading. + (WebCore::FrameLoader::completed): Call startRedirectionTimer + here directly instead of calling a cover named parentCompleted. + Hooray! One less function in the giant FrameLoader class! + (WebCore::FrameLoader::checkLoadComplete): Added code to set + m_shouldCallCheckLoadComplete to false. + + * loader/FrameLoader.h: Replaced the two functions + checkCompletedTimerFired and checkLoadCompleteTimerFired with + one function, checkTimerFired. Removed the parentCompleted + function. Added the startCheckCompleteTimer and + allAncestorsAreComplete functions. Replaced the + m_checkCompletedTimer and m_checkLoadCompleteTimer data + members with m_checkTimer, m_shouldCallCheckCompleted, and + m_shouldCallCheckLoadComplete. + + * manual-tests/go-back-after-alert.html: Added. + * manual-tests/resources/alert-and-go-back.html: Added. + +2009-09-23 David Kilzer <ddkilzer@apple.com> + + <http://webkit.org/b/29660> Move "Generate 64-bit Export File" build phase script into DerivedSources.make + + Reviewed by Mark Rowe. + + The "Generate 64-bit Export File" build phase script generated + the WebCore.LP64.exp export file used to link 64-bit WebCore. + Instead of having a separate build phase script, move its + generation into DerivedSources.make where WebCore.exp is + generated. + + * DerivedSources.make: Added a rule to make WebCore.LP64.exp. + Added code to append WebCore.PluginHostProcess.exp to + $(WEBCORE_EXPORT_DEPENDENCIES) when WTF_USE_PLUGIN_HOST_PROCESS + is set to 1. + * WebCore.PluginHostProcess.exp: Renamed from WebCore/WebCore.LP64.exp. + * WebCore.xcodeproj/project.pbxproj: Removed the "Generate + 64-bit Export File" build phase script. Renamed WebCore.LP64.exp + to WebCore.PluginHostProcess.exp. + +2009-09-23 Peter Kasting <pkasting@google.com> + + Reviewed by Dimitri Glazkov. + + https://bugs.webkit.org/show_bug.cgi?id=29694 + [Chromium] Eliminate dependency on gfx::Rect from ImageSkia. + + * platform/graphics/skia/ImageSkia.cpp: + (WebCore::drawResampledBitmap): + +2009-09-22 Timothy Hatcher <timothy@apple.com> + + Prevent scrolling multiple elements during latched wheel events. + + Reviewed by Anders Carlsson. + + * page/EventHandler.cpp: + (WebCore::scrollAndAcceptEvent): + (WebCore::EventHandler::clear): + (WebCore::EventHandler::handleWheelEvent): + * page/EventHandler.h: + * rendering/RenderBox.cpp: + (WebCore::RenderBox::scroll): + * rendering/RenderBox.h: + +2009-09-23 Daniel Bates <dbates@webkit.org> + + Reviewed by Adam Barth. + + https://bugs.webkit.org/show_bug.cgi?id=29523 + + Fixes an issue where a JavaScript URL that was URL-encoded twice can bypass the + XSSAuditor. + + The method FrameLoader::executeIfJavaScriptURL decodes the URL escape + sequences in a JavaScript URL before it is eventually passed to the XSSAuditor. + Because the XSSAuditor also decodes the URL escape sequences as part of its + canonicalization, the double decoding of a JavaScript URL would + not match the canonicalization of the input parameters. + + Tests: http/tests/security/xssAuditor/iframe-javascript-url-url-encoded.html + http/tests/security/xssAuditor/javascript-link-url-encoded.html + + * bindings/js/ScriptController.cpp: + (WebCore::ScriptController::evaluate): Moved call to + XSSAuditor::canEvaluateJavaScriptURL into FrameLoader::executeIfJavaScriptURL. + * bindings/v8/ScriptController.cpp: + (WebCore::ScriptController::evaluate): Ditto. + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::executeIfJavaScriptURL): Modified to call + XSSAuditor::canEvaluateJavaScriptURL on the JavaScript URL before it is + decoded. + +2009-09-22 Dave Hyatt <hyatt@apple.com> + + Reviewed by John Sullivan. + + https://bugs.webkit.org/show_bug.cgi?id=29657 + Columns don't break properly in positioned elements with a fixed height. Make sure that + a block is still considered to have columns even when the column count is 1 if the column + width is non-auto. + + Added fast/multicol/positioned-with-constrained-height.html + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::setDesiredColumnCountAndWidth): + +2009-09-23 Holger Hans Peter Freyther <zecke@selfish.org> + + Rubber-stamped by Simon Hausmann. + + Add a null check for the Document*. In the mirror benchmarking + application a crash from a call from JavaScript was observed. + + I was not able to come up with a test case for this issue. + + * platform/qt/CookieJarQt.cpp: + (WebCore::cookieJar): + +2009-09-23 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Tor Arne Vestbø. + + Fix the Qt/Windows build, after the introduction of + the page client. + + * plugins/win/PluginViewWin.cpp: + (windowHandleForPageClient): + (WebCore::PluginView::getValue): + (WebCore::PluginView::forceRedraw): + (WebCore::PluginView::platformStart): + +2009-09-23 Gustavo Noronha Silva <gns@gnome.org> + + Reviewed by Xan Lopez. + + [GTK] media tests failing after their rework + https://bugs.webkit.org/show_bug.cgi?id=29532 + + Correctly advertise the mime types used by the common formats used + in the tests. + + Tests that regressed, and will pass again: + + media/video-canvas-source.html + media/video-controls.html + media/video-currentTime-set2.html + media/video-dom-autoplay.html + media/video-dom-src.html + media/video-error-abort.html + media/video-load-networkState.html + media/video-load-readyState.html + media/video-muted.html + media/video-no-autoplay.html + media/video-pause-empty-events.html + media/video-play-empty-events.html + media/video-seekable.html + media/video-seeking.html + media/video-size.html + media/video-source-type-params.html + media/video-source-type.html + media/video-source.html + media/video-src-change.html + media/video-src-invalid-remove.html + media/video-src-remove.html + media/video-src-set.html + media/video-src-source.html + media/video-src.html + media/video-timeupdate-during-playback.html + media/video-volume.html + + * platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp: + (WebCore::mimeTypeCache): + +2009-09-22 Charles Wei <charles.wei@torchmobile.com.cn> + + Reviewed by Eric Seidel. + + Fix the crash problem with absolte positioned children in foreignobject + htts://bugs.webkit.org/show_bug.cgi?id=26342 + + Test: svg/custom/foreignobject-crash-with-absolute-positioned-children.svg + + * rendering/RenderForeignObject.h: + (WebCore::RenderForeignObject::isSVGForeignObject): + * rendering/RenderObject.cpp: + (WebCore::RenderObject::containingBlock): + * rendering/RenderObject.h: + (WebCore::RenderObject::isSVGForeignObject): + +2009-09-22 Drew Wilson <atwilson@google.com> + + Reviewed by David Levin. + + SharedWorkers "name" attribute is now optional. + https://bugs.webkit.org/show_bug.cgi?id=28897 + + Test: fast/workers/shared-worker-name.html + + * bindings/js/JSSharedWorkerConstructor.cpp: + (WebCore::constructSharedWorker): + Default 'name' attribute to empty string if it is not provided. + * bindings/v8/custom/V8SharedWorkerCustom.cpp: + (WebCore::CALLBACK_FUNC_DECL): + Default 'name' attribute to empty string if it is not provided. + * workers/DefaultSharedWorkerRepository.cpp: + (WebCore::SharedWorkerProxy::matches): + Now matches URLs if names are empty strings. + (WebCore::DefaultSharedWorkerRepository::getProxy): + Pass URL in to SharedWorkerProxy::matches(). + +2009-09-22 Dimitri Glazkov <dglazkov@chromium.org> + + Unreviewed, another build fix. + + [Chromium] Add another missing include. + https://bugs.webkit.org/show_bug.cgi?id=29536 + + * inspector/InspectorController.cpp: Added DOMWindow.h include. + +2009-09-22 Dimitri Glazkov <dglazkov@chromium.org> + + Unreviewed, build fix. + + [Chromium] Add missing include. + https://bugs.webkit.org/show_bug.cgi?id=29536 + + * inspector/InspectorDOMStorageResource.cpp: Added DOMWindow.h include. + +2009-09-22 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + Tighten up the ScheduledRedirection machinery to prepare for a bug fix + https://bugs.webkit.org/show_bug.cgi?id=29663 + + * loader/FrameLoader.cpp: + (WebCore::ScheduledRedirection::ScheduledRedirection): Added a boolean, + initialized to false, to keep track if the redirection has been + communicated to the client. + (WebCore::FrameLoader::stopLoading): Tweaked a comment. + (WebCore::FrameLoader::cancelRedirection): Removed code to clear + m_scheduledRedirection.clear since stopRedirectionTimer does that now. + (WebCore::FrameLoader::allChildrenAreComplete): Added. + (WebCore::FrameLoader::checkCompleted): Use allChildrenAreComplete + function for clarity. + (WebCore::FrameLoader::checkCallImplicitClose): Ditto. + (WebCore::FrameLoader::scheduleRedirection): Changed to take a PassOwnPtr. + (WebCore::FrameLoader::startRedirectionTimer): Added code to set the + toldClient flag and not call clientRedirected a second time if it is set. + (WebCore::FrameLoader::stopRedirectionTimer): Changed so this can be safely + called multiple times and it will call clientRedirectCancelledOrFinished + only once. + + * loader/FrameLoader.h: Changed scheduleRedirection to be a PassOwnPtr. + Added allChildrenAreComplete function. + +2009-09-22 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Timothy Hatcher. + + WebInspector: Migrate Databases tab to InjectedScript / + serialized interaction. + + DOMStorage interaction is now serialized into JSON messages + and doesn't require quarantined objects. + + https://bugs.webkit.org/show_bug.cgi?id=28873 + + * dom/EventListener.h: + (WebCore::EventListener::): + * inspector/InspectorBackend.cpp: + (WebCore::InspectorBackend::selectDOMStorage): + (WebCore::InspectorBackend::getDOMStorageEntries): + (WebCore::InspectorBackend::setDOMStorageItem): + (WebCore::InspectorBackend::removeDOMStorageItem): + * inspector/InspectorBackend.h: + * inspector/InspectorBackend.idl: + * inspector/InspectorController.cpp: + (WebCore::InspectorController::didCommitLoad): + (WebCore::InspectorController::selectDOMStorage): + (WebCore::InspectorController::getDOMStorageEntries): + (WebCore::InspectorController::setDOMStorageItem): + (WebCore::InspectorController::removeDOMStorageItem): + (WebCore::InspectorController::getDOMStorageResourceForId): + * inspector/InspectorController.h: + * inspector/InspectorDOMStorageResource.cpp: + (WebCore::InspectorDOMStorageResource::InspectorDOMStorageResource): + (WebCore::InspectorDOMStorageResource::bind): + (WebCore::InspectorDOMStorageResource::unbind): + (WebCore::InspectorDOMStorageResource::startReportingChangesToFrontend): + (WebCore::InspectorDOMStorageResource::handleEvent): + (WebCore::InspectorDOMStorageResource::operator==): + * inspector/InspectorDOMStorageResource.h: + (WebCore::InspectorDOMStorageResource::cast): + (WebCore::InspectorDOMStorageResource::id): + (WebCore::InspectorDOMStorageResource::domStorage): + * inspector/InspectorFrontend.cpp: + (WebCore::InspectorFrontend::selectDOMStorage): + (WebCore::InspectorFrontend::didGetDOMStorageEntries): + (WebCore::InspectorFrontend::didSetDOMStorageItem): + (WebCore::InspectorFrontend::didRemoveDOMStorageItem): + (WebCore::InspectorFrontend::updateDOMStorage): + * inspector/InspectorFrontend.h: + * inspector/front-end/DOMStorage.js: + (WebInspector.DOMStorage): + (WebInspector.DOMStorage.prototype.get id): + (WebInspector.DOMStorage.prototype.get domStorage): + (WebInspector.DOMStorage.prototype.get isLocalStorage): + (WebInspector.DOMStorage.prototype.getEntriesAsync): + (WebInspector.DOMStorage.prototype.setItemAsync): + (WebInspector.DOMStorage.prototype.removeItemAsync): + * inspector/front-end/DOMStorageDataGrid.js: + (WebInspector.DOMStorageDataGrid): + (WebInspector.DOMStorageDataGrid.prototype._startEditingColumnOfDataGridNode): + (WebInspector.DOMStorageDataGrid.prototype._startEditing): + (WebInspector.DOMStorageDataGrid.prototype._editingCommitted): + (WebInspector.DOMStorageDataGrid.prototype._editingCancelled): + (WebInspector.DOMStorageDataGrid.prototype.deleteSelectedRow): + * inspector/front-end/DOMStorageItemsView.js: + (WebInspector.DOMStorageItemsView.prototype.update): + (WebInspector.DOMStorageItemsView.prototype._showDOMStorageEntries): + (WebInspector.DOMStorageItemsView.prototype._dataGridForDOMStorageEntries): + * inspector/front-end/StoragePanel.js: + (WebInspector.StoragePanel.prototype.show): + (WebInspector.StoragePanel.prototype.reset): + (WebInspector.StoragePanel.prototype.selectDOMStorage): + (WebInspector.StoragePanel.prototype.updateDOMStorage): + (WebInspector.StoragePanel.prototype._domStorageForId): + * inspector/front-end/inspector.js: + (WebInspector.addDOMStorage): + (WebInspector.updateDOMStorage): + +2009-09-22 Sam Weinig <sam@webkit.org> + + Reviewed by Alexey Proskuryakov. + + Fix for XMLHttpRequest.abort() should destroy the response text. + https://bugs.webkit.org/show_bug.cgi?id=29658 + <rdar://problem/5301430> + + Clearing the response text after calling XMLHttpRequest.abort() is necessary + per spec and matches Firefox. It is also a potential memory win. + + Test: http/tests/xmlhttprequest/abort-should-destroy-responseText.html + + * xml/XMLHttpRequest.cpp: + (WebCore::XMLHttpRequest::abort): Clear the response text making sure to + keep the actual ResourceReponse around so that the response status and response + status text are kept around. + +2009-09-22 Dimitri Glazkov <dglazkov@chromium.org> + + No review, rolling out r48639. + http://trac.webkit.org/changeset/48639 + + * bindings/v8/V8GCController.cpp: + (WebCore::ObjectGrouperVisitor::visitDOMWrapper): + +2009-09-22 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by Dimitri Glazkov. + + Changing the transaction coordinator to (re-)allow multiple read + transactions on the same database to run concurrently (without + risking a deadlock this time). + + https://bugs.webkit.org/show_bug.cgi?id=29115 + + Tests: storage/read-and-write-transactions-dont-run-together.html + storage/read-transactions-running-concurrently.html + + * storage/SQLTransaction.h: + (WebCore::SQLTransaction::isReadOnly): Returns the type of the + transaction. + * storage/SQLTransactionCoordinator.cpp: + (WebCore::SQLTransactionCoordinator::acquireLock): Changed to + allow multiple read transactions on the same DB to run + concurrently. + (WebCore::SQLTransactionCoordinator::releaseLock): Changed to + allow multiple read transactions on the same DB to run + concurrently. + (WebCore::SQLTransactionCoordinator::shutdown): Renamed the map. + * storage/SQLTransactionCoordinator.h: + +2009-09-22 Peter Kasting <pkasting@google.com> + + Reviewed by David Levin. + + https://bugs.webkit.org/show_bug.cgi?id=29652 + Support true system colors for CSS system colors in Chromium/Win. + + * rendering/RenderThemeChromiumWin.cpp: + (WebCore::cssValueIdToSysColorIndex): + (WebCore::RenderThemeChromiumWin::systemColor): + * rendering/RenderThemeChromiumWin.h: + +2009-09-22 Beth Dakin <bdakin@apple.com> + + Reviewed by Dave Hyatt. + + Fix for <rdar://problem/6925121> SAP: Wrong width calculation in + table with fixed layout + -and corresponding- + https://bugs.webkit.org/show_bug.cgi?id=29501 + + New Tests: + * fast/table/fixed-table-with-percent-inside-percent-table.html: Added. + * fast/table/fixed-table-with-percent-width-inside-auto-table.html: Added. + * fast/table/fixed-table-with-percent-width-inside-div.html: Added. + * fast/table/fixed-table-with-percent-width-inside-extra-large-div.html: Added. + * fast/table/fixed-table-with-percent-width-inside-fixed-width-table.html: Added. + * fast/table/fixed-table-with-small-percent-width.html: Added. + + This new quirk is very similar to an existing one that was + implemented in revision 4316. + * rendering/FixedTableLayout.cpp: + (WebCore::FixedTableLayout::calcPrefWidths): + +2009-09-22 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Timothy Hatcher. + + List HTTP status code with response headers in resources tab of Web Inspector. + http://webkit.org/b/19945 + + This patch adds a new top level list in the resources tab, HTTP Information, that + for now, contains the Request Method (GET, POST, etc.) and the Status Code (200, 404, etc.). + Additionally, it adds a colored dot next to the requested URL to show the status + (green for success, orange for redirect, red for error). + + * English.lproj/localizedStrings.js: + * inspector/front-end/ImageView.js: + (WebInspector.ImageView): + * inspector/front-end/Images/errorRedDot.png: Added. + * inspector/front-end/Images/successGreenDot.png: Added. + * inspector/front-end/Images/warningOrangeDot.png: Added. + * inspector/front-end/Resource.js: + (WebInspector.Resource.StatusTextForCode): + * inspector/front-end/ResourceView.js: + (WebInspector.ResourceView): + (WebInspector.ResourceView.prototype._refreshURL): + (WebInspector.ResourceView.prototype._refreshHTTPInformation): + * inspector/front-end/inspector.css: + +2009-09-22 Brady Eidson <beidson@apple.com> + + Reviewed by Darin Adler. + + Back list isn't properly updated for fragment changes after a redirect. + <rdar://problem/6142803> and https://bugs.webkit.org/show_bug.cgi?id=20355 + + Test: fast/loader/fragment-after-redirect-gets-back-entry.html + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::loadURL): Properly reset the policy FrameLoadType before + consulting the policy delegate for fragment scrolling. + +2009-09-22 Darin Fisher <darin@chromium.org> + + Reviewed by Dimitri Glazkov. + + Drop down selects get stuck in the non-visible state and cannot be opened. + https://bugs.webkit.org/show_bug.cgi?id=29645 + + All paths that lead to hiding the popup menu must call popupDidHide on + the PopupMenuClient. This change makes it so by moving all of the + hiding logic to PopupListBox::hidePopup. + + * platform/chromium/PopupMenuChromium.cpp: + (WebCore::PopupContainer::hidePopup): + (WebCore::PopupListBox::hidePopup): + * platform/chromium/PopupMenuChromium.h: + +2009-09-22 Patrick Mueller <Patrick_Mueller@us.ibm.com> + + Reviewed by Timothy Hatcher. + + WebInspector.log() function not protected if console not yet created + https://bugs.webkit.org/show_bug.cgi?id=29336 + + No new tests. Only affects Web Inspector developers adding logging + to their code during development. + + * inspector/front-end/inspector.js: + (WebInspector.log.isLogAvailable): + (WebInspector.log.flushQueue): + (WebInspector.log.flushQueueIfAvailable): + (WebInspector.log.logMessage): + (WebInspector.log): + +2009-09-22 Yaar Schnitman <yaar@chromium.org> + + Reviewed by David Levin. + + Ported chromium.org's webcore.gyp for the webkit chromium port. + + https://bugs.webkit.org/show_bug.cgi?id=29617 + + * WebCore.gyp/WebCore.gyp: Added. + +2009-09-22 Christian Plesner Hansen <christian.plesner.hansen@gmail.com> + + Reviewed by Adam Barth. + + [v8] Don't keep clean wrappers artificially alive + We currently keep all DOM node wrappers alive, even when there are + no more references to them from JS, in case they have properties + that we need to keep around if new JS references are created. + This changes the policy to only keep wrappers artificially alive + if they have changed since they were created. Empty wrappers are + discarded and recreated as needed. + https://bugs.webkit.org/show_bug.cgi?id=29330 + + * bindings/v8/V8GCController.cpp: + (WebCore::ObjectGrouperVisitor::visitDOMWrapper): + +2009-09-22 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: console.count and console.timeEnd + crash when inspector is opened. + + https://bugs.webkit.org/show_bug.cgi?id=29632 + + * inspector/InspectorFrontend.cpp: + (WebCore::InspectorFrontend::addMessageToConsole): + +2009-09-22 Adam Barth <abarth@webkit.org> + + Unreviewed. + + Fix bogus build fix I did last night. + + * bindings/v8/custom/V8DOMWindowCustom.cpp: + (WebCore::V8Custom::WindowSetTimeoutImpl): + +2009-09-22 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + Reviewed by Simon Hausmann. + + NPAPI/Mac: Don't paint plugins if we don't have a CGContextRef + + * plugins/mac/PluginViewMac.cpp: + +2009-09-22 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + Reivewed by Simon Hausmann. + + Fix the Qt/Mac build after r48604 (Implement new QWebPageClient class) + + There's no QWidget::x11Info() on Mac, and setPlatformPluginWidget() + takes a QWidget*, not a QWebPageClient* + + * plugins/mac/PluginViewMac.cpp: + (WebCore::PluginView::platformStart): + +2009-09-21 Adam Barth <abarth@webkit.org> + + Attempted fix for the V8 build. + + * bindings/v8/custom/V8DOMWindowCustom.cpp: + (WebCore::V8Custom::WindowSetTimeoutImpl): + +2009-09-21 Adam Barth <abarth@webkit.org> + + Reviewed by Sam Weinig. + + Don't re-enter JavaScript after performing access checks + https://bugs.webkit.org/show_bug.cgi?id=29531 + + Moved the access check slightly later in this functions to avoid + re-entering the JavaScript interpreter (typically via toString) + after performing the access check. + + I can't really think of a meaningful test for this change. It's more + security hygiene. + + * bindings/js/JSDOMWindowCustom.cpp: + (WebCore::JSDOMWindow::setLocation): + (WebCore::JSDOMWindow::open): + (WebCore::JSDOMWindow::showModalDialog): + * bindings/js/JSLocationCustom.cpp: + (WebCore::JSLocation::setHref): + (WebCore::JSLocation::replace): + (WebCore::JSLocation::assign): + * bindings/v8/custom/V8DOMWindowCustom.cpp: + (WebCore::V8Custom::WindowSetTimeoutImpl): + (WebCore::if): + (CALLBACK_FUNC_DECL): + (V8Custom::WindowSetLocation): + (V8Custom::ClearTimeoutImpl): + * bindings/v8/custom/V8LocationCustom.cpp: + (WebCore::ACCESSOR_SETTER): + (WebCore::CALLBACK_FUNC_DECL): + +2009-09-21 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by Eric Seidel. + + Make all write transaction start with a BEGIN IMMEDIATE command + instead of BEGIN. + + We cannot test this change in a layout test, because in order to + test it we need to spawn two database threads and execute + transaction steps on these two threads in a very specific order, + which seems impossible to do when they share the same main thread + (as they would in a layout test). The SQLite docs and the case + described in the bug though should be enough proof that we do have + a problem here and that this patch will fix it. + + Relevant SQLite documentation: + http://www.sqlite.org/lang_transaction.html + http://www.sqlite.org/lockingv3.html#locking + + https://bugs.webkit.org/show_bug.cgi?id=29218 + + * platform/sql/SQLiteTransaction.cpp: + (WebCore::SQLiteTransaction::SQLiteTransaction): Added a readOnly + parameter. + (WebCore::SQLiteTransaction::begin): Changed to BEGIN IMMEDIATE + for write transactions. + * platform/sql/SQLiteTransaction.h: + * storage/SQLTransaction.cpp: + (WebCore::SQLTransaction::openTransactionAndPreflight): Passing + the read-only flag to the SQLiteTransaction instance. + +2009-09-21 Brady Eidson <beidson@apple.com> + + Rubberstamped by Mark Rowe. + + * DerivedSources.make: Fix the Xcode build on SnowLeopard. + +2009-09-15 John Abd-El-Malek <jam@chromium.org> + + Reviewed by Darin Fisher. + + Prevent sleeps in unload handlers. + https://bugs.webkit.org/show_bug.cgi?id=29193 + + Test: fast/dom/Window/slow_unload_handler.html + + * WebCore.gypi: + * bindings/v8/DateExtension.cpp: Added. + (WebCore::DateExtension::DateExtension): + (WebCore::DateExtension::get): + (WebCore::DateExtension::setAllowSleep): + (WebCore::DateExtension::GetNativeFunction): + (WebCore::DateExtension::weakCallback): + (WebCore::DateExtension::GiveEnableSleepDetectionFunction): + (WebCore::DateExtension::OnSleepDetected): + * bindings/v8/DateExtension.h: Added. + * bindings/v8/V8AbstractEventListener.cpp: + (WebCore::V8AbstractEventListener::invokeEventHandler): + * bindings/v8/V8Proxy.cpp: + (WebCore::V8Proxy::createNewContext): + (WebCore::V8Proxy::registerExtensionWithV8): + (WebCore::V8Proxy::registeredExtensionWithV8): + * bindings/v8/V8Proxy.h: + +2009-09-21 Jian Li <jianli@chromium.org> + + Reviewed by David Levin. + + [V8] Run-time exception in onmessage handler is not forwarded to the + worker object. + https://bugs.webkit.org/show_bug.cgi?id=28980 + + The previous fix was partially reverted due to a reliability build break + in chromium. The break happens when an exception is thrown without + setting a message. We need to check for this scenario and handle it. + + Tested by worker-close.html. + + * bindings/v8/V8AbstractEventListener.cpp: + (WebCore::V8AbstractEventListener::invokeEventHandler): + * bindings/v8/V8Utilities.cpp: + (WebCore::reportException): + +2009-09-21 Greg Bolsinga <bolsinga@apple.com> + + Reviewed by Simon Fraser & Sam Weinig. + + Add ENABLE(ORIENTATION_EVENTS) + https://bugs.webkit.org/show_bug.cgi?id=29508 + + See documentation here: + http://developer.apple.com/safari/library/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html#//apple_ref/doc/uid/TP40006511-SW16 + + * DerivedSources.make: Use new WebCore.OrientationEvents.exp file if ENABLE_ORIENTATION_EVENTS. + Add ENABLE_ORIENTATION_EVENTS to the new ADDITIONAL_IDL_DEFINES variable that is passed to the IDL + code generator. This is because ENABLE_ORIENTATION_EVENTS is not in FEATURE_DEFINES. + * WebCore.OrientationEvents.exp: Added. + * WebCore.xcodeproj/project.pbxproj: Add WebCore.OrientationEvents.exp. + * dom/EventNames.h: Add onorientationchange. + * html/HTMLAttributeNames.in: Ditto. + * html/HTMLBodyElement.cpp: Handle onorientationchange properly. + (WebCore::HTMLBodyElement::parseMappedAttribute): + (WebCore::HTMLBodyElement::onorientationchange): + (WebCore::HTMLBodyElement::setOnorientationchange): + * html/HTMLBodyElement.h: Ditto. + * html/HTMLBodyElement.idl: Ditto. + * html/HTMLFrameSetElement.cpp: Ditto. + (WebCore::HTMLFrameSetElement::parseMappedAttribute): + (WebCore::HTMLFrameSetElement::onorientationchange): + (WebCore::HTMLFrameSetElement::setOnorientationchange): + * html/HTMLFrameSetElement.h: Ditto. + * html/HTMLFrameSetElement.idl: Ditto. + * page/DOMWindow.cpp: Ditto. + (WebCore::DOMWindow::orientation): Calls up the to the Frame for the orientation value. + (WebCore::DOMWindow::onorientationchange): + (WebCore::DOMWindow::setOnorientationchange): + * page/DOMWindow.h: Handle onorientationchange properly. + * page/DOMWindow.idl: Ditto. + * page/Frame.cpp: Ditto. + (WebCore::Frame::Frame): + (WebCore::Frame::sendOrientationChangeEvent): + * page/Frame.h: Ditto. + (WebCore::Frame::orientation): + +2009-09-18 Anders Carlsson <andersca@apple.com> + + Try fixing the build again. + + * platform/win/PopupMenuWin.cpp: + (WebCore::PopupMenu::wndProc): + +2009-09-21 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: completions are always evaluated against + window (discarding call frames). + + https://bugs.webkit.org/show_bug.cgi?id=29616 + + * inspector/front-end/ConsoleView.js: + (WebInspector.ConsoleView.prototype.completions): + * inspector/front-end/InjectedScript.js: + (InjectedScript.getCompletions): + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel.prototype.selectedCallFrameId): + +2009-09-21 Brent Fulgham <bfulgham@webkit.org> + + Unreviewed build fix for Windows (Cairo) target. + + Add stubs for SocketStream classes added in @r47788, which + broke the WinCairo build. + + No new tests. (Build failure). + + * WebCore.vcproj/WebCore.vcproj: Add references to new files + to Cairo build, exclude from standard Apple build. + * platform/network/curl/SocketStreamError.h: Added. + * platform/network/curl/SocketStreamHandle.h: Added. + * platform/network/curl/SocketStreamHandleCurl.cpp: Added. + +2009-09-21 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: Expose InspectorResource fields. + + https://bugs.webkit.org/show_bug.cgi?id=29537 + + * inspector/InspectorResource.cpp: + (WebCore::InspectorResource::sourceString): + (WebCore::InspectorResource::resourceData): + * inspector/InspectorResource.h: + (WebCore::InspectorResource::requestHeaderFields): + (WebCore::InspectorResource::responseHeaderFields): + (WebCore::InspectorResource::responseStatusCode): + (WebCore::InspectorResource::requestMethod): + (WebCore::InspectorResource::requestFormData): + +2009-09-21 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: JS error drilling down childless node. + No need to dispatch double click twice - it is already handled + in TreeElement.treeElementDoubleClicked. + + https://bugs.webkit.org/show_bug.cgi?id=22144 + + * inspector/front-end/ElementsTreeOutline.js: + (WebInspector.ElementsTreeOutline): + +2009-09-21 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Simon Hausmann. + + Implement new QWebPageClient class and let our classes + QWebViewPrivate and QWebGraphicsItemPrivate inherit from it. + + For Qt, platformPageClient() will now return a class derived from + the QWebPageClient, so the patch adapts our Qt hooks to go though + this class and not depend on the QWebView. + + * WebCore.pro: + * platform/Widget.h: + * platform/qt/PlatformScreenQt.cpp: + (WebCore::screenDepth): + (WebCore::screenDepthPerComponent): + (WebCore::screenIsMonochrome): + (WebCore::screenRect): + (WebCore::screenAvailableRect): + * platform/qt/PopupMenuQt.cpp: + (WebCore::PopupMenu::show): + * platform/qt/QWebPageClient.h: Added. + * platform/qt/WidgetQt.cpp: + (WebCore::Widget::setCursor): + * plugins/qt/PluginViewQt.cpp: + (WebCore::PluginView::handleKeyboardEvent): + (WebCore::PluginView::getValue): + (WebCore::PluginView::platformStart): + +2009-09-21 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: Evaluating on call frame always returns "undefined". + + https://bugs.webkit.org/show_bug.cgi?id=29613 + + * inspector/front-end/InjectedScript.js: + (InjectedScript.evaluate): + (InjectedScript._evaluateAndWrap): + (InjectedScript._evaluateOn): + (InjectedScript.evaluateInCallFrame): + +2009-09-21 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: Exception formatting is broken in console. + + https://bugs.webkit.org/show_bug.cgi?id=29608 + + * inspector/front-end/ConsoleView.js: + (WebInspector.ConsoleCommandResult): + * inspector/front-end/InjectedScript.js: + (InjectedScript.evaluate): + (InjectedScript.createProxyObject): + +2009-09-21 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: Console object formatting is broken. + + https://bugs.webkit.org/show_bug.cgi?id=29607 + + * inspector/front-end/ConsoleView.js: + (WebInspector.ConsoleMessage.prototype._format): + * inspector/front-end/ObjectProxy.js: + (WebInspector.ObjectProxy.wrapPrimitiveValue): + +2009-09-21 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: Crash When Logging an Element Before Opening Inspector + + https://bugs.webkit.org/show_bug.cgi?id=29514 + + * inspector/InspectorController.cpp: + (WebCore::InspectorController::populateScriptObjects): + +2009-09-21 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dan Bernstein. + + Incorrect clipping with accelerated compositing content, and position:fixed + https://bugs.webkit.org/show_bug.cgi?id=29347 + + Fix the compositing clipping logic to behave correctly when position:fixed + elements clip, by using the new backgroundClipRect() method to determine + when we need to clip, and to compute the clipping layer position. + + Test: compositing/overflow/fixed-position-ancestor-clip.html + + * rendering/RenderLayerBacking.cpp: + (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry): + * rendering/RenderLayerCompositor.cpp: + (WebCore::RenderLayerCompositor::clippedByAncestor): + +2009-09-21 Nate Chapin <japhet@chromium.org> + + Reviewed by Adam Barth. + + Add back in a special case for window.top in the V8 bindings. + + https://bugs.webkit.org/show_bug.cgi?id=29605 + + Fixes LayoutTests/fast/dom/Window/window-property-shadowing.html in the Chromium port. + + * bindings/scripts/CodeGeneratorV8.pm: Ensure window.top is not marked as read only, as this breaks the shadowing disabling. + +2009-09-21 Eric Carlson <eric.carlson@apple.com> + + Reviewed by Brady Eidson. + + HTMLMediaElement: media file should not reload when page comes out of page cache + https://bugs.webkit.org/show_bug.cgi?id=29604 + + Test: media/restore-from-page-cache.html + + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::userCancelledLoad): Do nothing unless the element + is still loading. Only fire an 'emptied' event if the readyState is HAVE_NOTHING, + otherwise set the network state to NETWORK_IDLE. + +2009-09-21 Sam Weinig <sam@webkit.org> + + Reviewed by Geoffrey "Sean/Shawn/Shaun" Garen. + + Clarify two FIXMEs. + + * bindings/js/JSHTMLCollectionCustom.cpp: + (WebCore::getNamedItems): + * bindings/js/JSHTMLFormElementCustom.cpp: + (WebCore::JSHTMLFormElement::nameGetter): + +2009-09-21 Darin Fisher <darin@chromium.org> + + Reviewed by Dimitri Glazkov. + + Drop down selects fail to close when a value is selected + https://bugs.webkit.org/show_bug.cgi?id=29582 + + Implement PopupListBox::hidePopup, which was previously + declared but unimplemented. Removes the declaration of + showPopup since that method is not implemented. + + PopupListBox::hidePopup takes care of hiding the popup, + by invoking hidePopup on its parent PopupContainer, and + then informs the PopupMenuClient that popupDidHide. + This mimics the old behavior prior to r48370. + + * platform/chromium/PopupMenuChromium.cpp: + (WebCore::PopupListBox::handleKeyEvent): + (WebCore::PopupListBox::abandon): + (WebCore::PopupListBox::acceptIndex): + (WebCore::PopupListBox::hidePopup): + +2009-09-21 Csaba Osztrogonac <oszi@inf.u-szeged.hu> + + Rubber-stamped by Simon Hausmann. + + [Qt] Windows build fix. + https://bugs.webkit.org/show_bug.cgi?id=29535 + + * platform/network/qt/DnsPrefetchHelper.cpp: Missing #include "config.h" added. + +2009-09-21 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Unreviewed make dist build fix. Missing files. + + * GNUmakefile.am: + +2009-09-20 Adam Barth <abarth@webkit.org> + + Reviewed by Maciej Stachowiak. + + Crash when clicking link in unload handler + https://bugs.webkit.org/show_bug.cgi?id=29525 + + Test that the first navigation always wins when the page tries to start + a new navigation in an unload handler. + + Tests: fast/loader/unload-form-about-blank.html + fast/loader/unload-form-post-about-blank.html + fast/loader/unload-form-post.html + fast/loader/unload-form.html + fast/loader/unload-hyperlink.html + fast/loader/unload-javascript-url.html + fast/loader/unload-reload.html + fast/loader/unload-window-location.html + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::loadURL): + (WebCore::FrameLoader::loadWithDocumentLoader): + +2009-09-18 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Xan Lopez. + + [GTK] Sometimes crashes when a page is destroyed/loads another URL while playing video + https://bugs.webkit.org/show_bug.cgi?id=29496 + + Protect the video sink object, and destroy it in an idle callback + to hopefully avoid a race condition that leads to a crash. + + This is already tested by media/video-seekable.html + + * platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp: + (WebCore::idleUnref): + (WebCore::MediaPlayerPrivate::~MediaPlayerPrivate): + (WebCore::MediaPlayerPrivate::createGSTPlayBin): + +2009-09-19 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Unreviewed build fix for GTK+ and a blind one for Qt after r48566. + + * GNUmakefile.am: + * WebCore.pro: + +2009-09-19 Sam Weinig <sam@webkit.org> + + Reviewed by Oliver Hunt. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=29519 + Remove JSNameNodeCollection and just use StaticNodeList + + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * WebCoreSources.bkl: + * bindings/js/JSHTMLCollectionCustom.cpp: + (WebCore::getNamedItems): + * bindings/js/JSHTMLFormElementCustom.cpp: + (WebCore::JSHTMLFormElement::nameGetter): + * bindings/js/JSNamedNodesCollection.cpp: Removed. + * bindings/js/JSNamedNodesCollection.h: Removed. + +2009-09-19 Daniel Bates <dbates@webkit.org> + + Reviewed by Adam Barth. + + https://bugs.webkit.org/show_bug.cgi?id=29511 + + Fixes an issue where script code that contains non-ASCII characters may bypass the + XSSAuditor. + + Before performing a comparison between the script source code and input parameters, we + remove all non-ASCII characters, including non-printable ASCII characters from the + script source code and input parameters. + + Tests: http/tests/security/xssAuditor/img-onerror-non-ASCII-char.html + http/tests/security/xssAuditor/img-onerror-non-ASCII-char-default-encoding.html + http/tests/security/xssAuditor/img-onerror-non-ASCII-char2-default-encoding.html + http/tests/security/xssAuditor/img-onerror-non-ASCII-char2.html + + * page/XSSAuditor.cpp: + (WebCore::isNonCanonicalCharacter): Modified to remove all non-ASCII characters, + including non-printable ASCII characters. + +2009-09-19 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dan Bernstein. + + Incorrect animation with scale(0) transform (singular matrix) + https://bugs.webkit.org/show_bug.cgi?id=29465 + + Make accelerated scale() and translate() animations go through the component animation + path (rather than just matrix animation) to avoid problems with singular scale matrices, + and be slightly more efficient. + + Test: compositing/transitions/singular-scale-transition.html + + * platform/graphics/mac/GraphicsLayerCA.mm: + (WebCore::getTransformFunctionValue): + (WebCore::getValueFunctionNameForTransformOperation): + +2009-09-19 Alex Milowski <alex@milowski.com> + + Reviewed by Maciej Stachowiak. + + Adds CSS styling and basic DOM element support for MathML + + * DerivedSources.make: + Added user stylesheet and tag factory generation + + * WebCore.xcodeproj/project.pbxproj: + Added new DOM element code + + * css/CSSParser.cpp: + (WebCore::CSSParser::parseAttr): + Added check for document since stylesheet can be added before there is a document + + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::styleForElement): + Added check to add MathML user agent stylesheet + + * css/mathml.css: Added. + MathML user agent stylesheet + + * dom/Document.cpp: + (WebCore::Document::createElement): + Added support for creation of MathML DOM objects + + * dom/Node.h: + (WebCore::Node::isMathMLElement): + Added check method for whether the node is a MathML node + + * mathml: Added. + * mathml/MathMLElement.cpp: Added. + (WebCore::MathMLElement::MathMLElement): + (WebCore::MathMLElement::create): + (WebCore::MathMLElement::createRenderer): + * mathml/MathMLElement.h: Added. + (WebCore::MathMLElement::isMathMLElement): + MathML DOM base class + + + * mathml/MathMLInlineContainerElement.cpp: Added. + (WebCore::MathMLInlineContainerElement::MathMLInlineContainerElement): + (WebCore::MathMLInlineContainerElement::create): + (WebCore::MathMLInlineContainerElement::createRenderer): + * mathml/MathMLInlineContainerElement.h: Added. + Base class for non-text containers + + * mathml/MathMLMathElement.cpp: Added. + (WebCore::MathMLMathElement::MathMLMathElement): + (WebCore::MathMLMathElement::create): + * mathml/MathMLMathElement.h: Added. + Root Math element + + * mathml/mathtags.in: Added. + Element list mappings + + * page/Frame.cpp: + (WebCore::Frame::Frame): + Added MathML name initialization +2009-09-19 Adam Barth <abarth@webkit.org> + + Reviewed by Oliver Hunt. + + Canvas drawn with data URL image raises SECURITY_ERR when toDataUrl() called. + https://bugs.webkit.org/show_bug.cgi?id=29305 + + We need to special-case data URLs when tainting a canvas because we + treat data URLs has having no security origin, unlike other + browsers. The reason we do this is to help sites avoid XSS via data + URLs, but that consideration doesn't apply to canvas taint. + + Also, we were previously incorrectly taking document.domain state + into account when tainting canvas. + + Tests: http/tests/security/canvas-remote-read-data-url-image.html + http/tests/security/canvas-remote-read-data-url-svg-image.html + http/tests/security/canvas-remote-read-remote-image-document-domain.html + + * html/canvas/CanvasRenderingContext2D.cpp: + (WebCore::CanvasRenderingContext2D::checkOrigin): + (WebCore::CanvasRenderingContext2D::createPattern): + * page/SecurityOrigin.cpp: + (WebCore::SecurityOrigin::taintsCanvas): + * page/SecurityOrigin.h: + +2009-09-18 Simon Fraser <simon.fraser@apple.com> + + Fix stylistic issue raised in code review for previous commit. + + * rendering/RenderLayerBacking.cpp: + (WebCore::hasNonZeroTransformOrigin): + +2009-09-18 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dan Bernstein. + + Element is misplaced during opacity transition with certain configuration of transform-origin and clipping + https://bugs.webkit.org/show_bug.cgi?id=29495 + + If an element has zero size, but has a transform origin with absolute values, + then the transform origin would not be applied because it is implemented via + anchorPoint, which is expressed as a fraction of the layer size. + + Work around this by artificially inflating the size of the backing store when we need to. + + Test: compositing/geometry/transfrom-origin-on-zero-size-layer.html + + * rendering/RenderLayerBacking.h: + * rendering/RenderLayerBacking.cpp: + (WebCore::RenderLayerBacking::RenderLayerBacking): + Init m_artificiallyInflatedBounds to false. + + (WebCore::hasNonZeroTransformOrigin): + Utility function that describes whether the transform-origin contains non-percentage + x or y offsets. + + (WebCore::RenderLayerBacking::updateCompositedBounds): + New wrapper method around setCompositedBounds() that applies the size inflation + when necessary, setting the m_artificiallyInflatedBounds as appropriate. + + (WebCore::RenderLayerBacking::updateAfterLayout): Call updateCompositedBounds(). + (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry): Ditto + + * rendering/RenderLayerCompositor.cpp: + (WebCore::RenderLayerCompositor::rebuildCompositingLayerTree): Ditto + (WebCore::RenderLayerCompositor::updateCompositingDescendantGeometry): Ditto + +2009-09-18 Antti Koivisto <antti@apple.com> + + Reviewed by Maciej Stachowiak. + + https://bugs.webkit.org/show_bug.cgi?id=29512 + Don't recalculate style when restoring from the page cache + + FrameLoaderClient::forceLayout() also forces style recalc. Instead call FrameView::forceLayout() + directly to update the scrollbars while keeping the existing style. + + Makes back/forward really fast on complex pages (in cases where page cache works). + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::commitProvisionalLoad): + +2009-09-18 Oliver Hunt <oliver@apple.com> + + Reviewed by Geoff Garen. + + Implement ES5 Object.defineProperty function + https://bugs.webkit.org/show_bug.cgi?id=29503 + + Override defineOwnProperty on JSDOMWindowShell to forward appropriately, + and then override defineOwnProperty on JSDOMWindow to disallow cross origin + defineOwnProperty usage. We also override defineOwnProperty on QuarantinedObjectWrapper + to ensure correct wrapping semantics of quarantined objects. + + One major caveat in this patch is that it currently disallows the use + of Object.defineProperty on DOMObjects other than the window due to + the significant work involved in correctly propagating attributes and + ensuring correct semantics on dom objects. + + Tests: fast/js/Object-defineProperty.html + http/tests/security/xss-DENIED-defineProperty.html + + * bindings/js/JSDOMBinding.cpp: + (WebCore::DOMObject::defineOwnProperty): + * bindings/js/JSDOMBinding.h: + * bindings/js/JSDOMWindowCustom.cpp: + (WebCore::JSDOMWindow::defineGetter): + (WebCore::JSDOMWindow::defineSetter): + (WebCore::JSDOMWindow::defineOwnProperty): + * bindings/js/JSDOMWindowShell.cpp: + (WebCore::JSDOMWindowShell::defineOwnProperty): + (WebCore::JSDOMWindowShell::defineGetter): + (WebCore::JSDOMWindowShell::defineSetter): + * bindings/js/JSDOMWindowShell.h: + * bindings/js/JSLocationCustom.cpp: + (WebCore::JSLocation::defineGetter): + (WebCore::JSLocationPrototype::defineGetter): + * bindings/js/JSQuarantinedObjectWrapper.cpp: + (WebCore::JSQuarantinedObjectWrapper::getOwnPropertyDescriptor): + (WebCore::JSQuarantinedObjectWrapper::defineOwnProperty): + * bindings/js/JSQuarantinedObjectWrapper.h: + * bindings/scripts/CodeGeneratorJS.pm: + +2009-09-18 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=29510 + Active DOM objects should be suspended while a modal dialog is displayed + + * manual-tests/js-timers-beneath-modal-dialog.html: Added a test for JS timers. + + * page/PageGroupLoadDeferrer.cpp: + (WebCore::PageGroupLoadDeferrer::PageGroupLoadDeferrer): + (WebCore::PageGroupLoadDeferrer::~PageGroupLoadDeferrer): + Match other platforms, and make Mac also suspend active DOM objects. Since a page that + currently displays a modal dialog cannot go into page cache, there is no danger of suspending + an object twice. + +2009-09-18 Csaba Osztrogonac <oszi@inf.u-szeged.hu> + + Reviewed by Eric Seidel. + + [Qt] Buildfix caused by http://trac.webkit.org/changeset/48513 + https://bugs.webkit.org/show_bug.cgi?id=29351 + + * bridge/qt/qt_instance.h: createRuntimeObject method renamed to newRuntimeObject. + * bridge/runtime.h: Visibility of newRuntimeObject method modified to protected. + +2009-09-18 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Timothy Hatcher. + + Fix parameter substitutions in console.log(). + + https://bugs.webkit.org/show_bug.cgi?id=29366 + + * inspector/front-end/ConsoleView.js: + (WebInspector.ConsoleMessage.prototype._format): + * inspector/front-end/InjectedScript.js: + (InjectedScript.getPrototypes): + (InjectedScript.CallFrameProxy.prototype._wrapScopeChain): + * inspector/front-end/utilities.js: + (): + +2009-09-18 Sam Weinig <sam@webkit.org> + + Reviewed by Geoffrey Garen and Brady Eidson. + + Temporarily remove an assertion that was getting hit when going + back to a page in the page cache while a banner in Safari was visible. + We should re-enable this once that is fixed. See <rdar://problem/7218118> + + * page/FrameView.cpp: + (WebCore::FrameView::scheduleRelayout): + +2009-09-18 Anders Carlsson <andersca@apple.com> + + Try fixing the build again. + + * platform/win/PopupMenuWin.cpp: + (WebCore::PopupMenu::wndProc): + +2009-09-18 Anders Carlsson <andersca@apple.com> + + Fix windows build. + + * platform/win/PopupMenuWin.cpp: + +2009-09-18 Sam Weinig <sam@webkit.org> + + Reviewed by Gavin 'BearClaw' Barraclough. + + Convert another callback type object to store the global object + instead of the frame. + + * bindings/js/JSCustomXPathNSResolver.cpp: + (WebCore::JSCustomXPathNSResolver::create): + (WebCore::JSCustomXPathNSResolver::JSCustomXPathNSResolver): + (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI): + * bindings/js/JSCustomXPathNSResolver.h: + +2009-09-18 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=29332 + <rdar://problem/7231652> + REGRESSION (r48446): While a <select> popup menu is open, the + rest of the WebView doesn't respond to mouse move events. + + * platform/win/PopupMenuWin.cpp: + (WebCore::translatePoint): + New helper function that translates a point between HWND coordinates. + + (WebCore::PopupMenu::show): + Protect the PopupMenu if someone removes the <select> in response to a mouse + event. Handle WM_HOST_WINDOW_MOUSEMOVE events. + + (WebCore::PopupMenu::wndProc): + in the WM_MOUSEMOVE handler, if the mouse is not over the popup, post a + WM_HOST_WINDOW_MOUSEMOVE event so that the host window (the WebView) gets the + mouse move event. + +2009-09-18 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dave Hyatt. + + Compositing layers are incorrectly positioned after scrolling with position:fixed + https://bugs.webkit.org/show_bug.cgi?id=29262 + + When scrolling a page with compositing layers inside a position:fixed element, + we need to update the compositing layer positions when the scroll position changes. + + Test: compositing/geometry/fixed-position.html + + * WebCore.base.exp: + Export FrameView::scrollPositionChanged() + + * page/FrameView.h: + * page/FrameView.cpp: + (WebCore::FrameView::scrollPositionChanged): + New method that sends the scroll event, and updates compositing layers positions if necessary. + +2009-09-18 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dave Hyatt. + + Transformed elements inside position:fixed container are clipped incorrectly + https://bugs.webkit.org/show_bug.cgi?id=29346 + + Fix clipping and hit testing on transformed elements inside a position:fixed element. + Previously, the code used the overflowClipRect of the parent clip rects, but + this is not correct for fixed postion elements. Instead, share code that is + already present in calculateRects() to get the correct rect. + + Test: fast/overflow/position-fixed-transform-clipping.html + + * rendering/RenderLayer.h: + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::paintLayer): + (WebCore::RenderLayer::hitTestLayer): + Call the new backgroundClipRect() to get the correct clipRect. + + (WebCore::RenderLayer::backgroundClipRect): + New method, factored out of calculateRects(), that computes the clip rect, + doing the right thing for fixed position elements. + + (WebCore::RenderLayer::calculateRects): + Call the new backgroundClipRect() method. + +2009-09-18 Dan Bernstein <mitz@apple.com> + + Reviewed by Darin Adler. + + Fix <rdar://problem/7050773> REGRESSION (r40098) Crash at + WebCore::RenderBlock::layoutBlock() + https://bugs.webkit.org/show_bug.cgi?id=29498 + + Test: accessibility/nested-layout-crash.html + + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::updateBackingStore): Changed to + call Document::updateLayoutIgnorePendingStylesheets() instead of + calling RenderObject::layoutIfNeeded(). The latter requires that + there be no pending style recalc, which allows methods that call + Document::updateLayout() to be called during layout without risking + re-entry into layout. + * accessibility/mac/AccessibilityObjectWrapper.mm: + (-[AccessibilityObjectWrapper accessibilityActionNames]): Null-check + m_object after calling updateBackingStore(), since style recalc may + destroy the renderer, which destroys the accessibility object and + detaches it from the wrapper. + (-[AccessibilityObjectWrapper accessibilityAttributeNames]): Ditto. + (-[AccessibilityObjectWrapper accessibilityAttributeValue:]): Ditto. + (-[AccessibilityObjectWrapper accessibilityFocusedUIElement]): Ditto. + (-[AccessibilityObjectWrapper accessibilityHitTest:]): Ditto. + (-[AccessibilityObjectWrapper accessibilityIsAttributeSettable:]): + Ditto. + (-[AccessibilityObjectWrapper accessibilityIsIgnored]): Ditto. + (-[AccessibilityObjectWrapper accessibilityParameterizedAttributeNames]): + Ditto. + (-[AccessibilityObjectWrapper accessibilityPerformPressAction]): Ditto. + (-[AccessibilityObjectWrapper accessibilityPerformIncrementAction]): + Ditto. + (-[AccessibilityObjectWrapper accessibilityPerformDecrementAction]): + Ditto. + (-[AccessibilityObjectWrapper accessibilityPerformAction:]): Ditto. + (-[AccessibilityObjectWrapper accessibilitySetValue:forAttribute:]): + Ditto. + (-[AccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]): + Ditto. + (-[AccessibilityObjectWrapper accessibilityIndexOfChild:]): Ditto. + (-[AccessibilityObjectWrapper accessibilityArrayAttributeCount:]): + Ditto. + (-[AccessibilityObjectWrapper accessibilityArrayAttributeValues:index:maxCount:]): + Ditto. + +2009-09-18 Fumitoshi Ukai <ukai@chromium.org> + + Reviewed by Simon Hausmann. + + Update Qt build system for Web Socket. + https://bugs.webkit.org/show_bug.cgi?id=29270 + + * WebCore.pro: + * platform/network/qt/SocketStreamError.h: Added. + * platform/network/qt/SocketStreamHandle.h: Added. + * platform/network/qt/SocketStreamHandleSoup.cpp: Added. + +2009-09-18 Eric Carlson <eric.carlson@apple.com> + + Reviewed by Darin Adler. + + NULL check HTMLMediaElement::m_playedTimeRanges. + Fix for https://bugs.webkit.org/show_bug.cgi?id=29494 + + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::addPlayedRange): New. Create m_playedTimeRanges if + necessary, add range specified. + (WebCore::HTMLMediaElement::seek): Use addPlayedRange. + (WebCore::HTMLMediaElement::played): Use addPlayedRange. Change time comparison + to be more readable. + (WebCore::HTMLMediaElement::updatePlayState): Ditto. + * html/HTMLMediaElement.h: + +2009-09-18 Sam Weinig <sam@webkit.org> + + Reviewed by Adele Peterson. + + Follow up fix for https://bugs.webkit.org/show_bug.cgi?id=29276 + REGRESSION(r48334): WebKit crashes on file select by drag + + Don't use Document.elementFromPoint since it returns null if the point + is outside the viewport. Instead, just hit test ourselves. + + Test: fast/events/drag-file-crash.html + + * page/DragController.cpp: + (WebCore::elementUnderMouse): + (WebCore::DragController::tryDocumentDrag): + (WebCore::DragController::concludeEditDrag): + +2009-09-18 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + Each wrapped Objective-C object should use a single RuntimeObjectImp + https://bugs.webkit.org/show_bug.cgi?id=29351 + rdar://problem/7142294 + + * WebCore.base.exp: Added a newly-needed exported symbol. + + * bindings/objc/DOMInternal.h: Eliminated unused + createWrapperCacheWithIntegerKeys; it has not been needed since the + RGBColor wrappers were reworked. + * bindings/objc/DOMInternal.mm: Ditto. + + * bridge/objc/objc_instance.h: Made the create function non-inline. + * bridge/objc/objc_instance.mm: + (createInstanceWrapperCache): Added. Creates an appropriate map table. + (ObjcInstance::create): Moved here from header. Uses NSMapGet and + NSMapInsert to cache the instance in a map table. + (ObjcInstance::~ObjcInstance): Added a call to NSMapRemove to remove + the instance from the map table. + + * bridge/qt/qt_instance.cpp: + (JSC::Bindings::QtInstance::~QtInstance): Remove unneeded code to remove + the instance from cachedObjects, which no longer exists. + (JSC::Bindings::QtInstance::newRuntimeObject): Renamed to overload new + bottleneck. Caching is now handled by the base class. + + * bridge/runtime.cpp: + (JSC::Bindings::Instance::Instance): Initialize m_runtimeObject to 0. + (JSC::Bindings::Instance::~Instance): Assert m_runtimeObject is 0. + (JSC::Bindings::Instance::createRuntimeObject): Use m_runtimeObject + if it's already set. Set m_runtimeObject and call addRuntimeObject + if it's not. + (JSC::Bindings::Instance::newRuntimeObject): Added. Virtual function, + used only by createRuntimeObject. + (JSC::Bindings::Instance::willDestroyRuntimeObject): Added. + Calls removeRuntimeObject and then clears m_runtimeObject. + (JSC::Bindings::Instance::willInvalidateRuntimeObject): Added. + Clears m_runtimeObject. + + * bridge/runtime.h: Made createRuntimeObject non-virtual. Added + willDestroyRuntimeObject, willInvalidateRuntimeObject, + newRuntimeObject, and m_runtimeObject. + + * bridge/runtime_object.cpp: + (JSC::RuntimeObjectImp::RuntimeObjectImp): Removed addRuntimeObject + call, now handled by caller. + (JSC::RuntimeObjectImp::~RuntimeObjectImp): Replaced removeRuntimeObject + call with willDestroyRuntimeObject call; the latter nows calls + removeRuntimeObject. + (JSC::RuntimeObjectImp::invalidate): Added willInvalidateRuntimeObject + call. + + * bridge/runtime_object.h: Made invalidate non-virtual. + +2009-09-18 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Simon Hausmann. + + Make PlatformWindow return something else than PlatformWidget + https://bugs.webkit.org/show_bug.cgi?id=29085 + + Make platformWindow return a PlatformPageClient + (for now typedef'ed to PlatformWidget) + + Also, change the name of platformWindow to platformPageClient() + + * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: + (getPangoLayoutForAtk): + * accessibility/win/AXObjectCacheWin.cpp: + (WebCore::AXObjectCache::postPlatformNotification): + (WebCore::AXObjectCache::handleFocusedUIElementChanged): + * loader/EmptyClients.h: + (WebCore::EmptyChromeClient::platformPageClient): + * page/Chrome.cpp: + (WebCore::Chrome::platformPageClient): + * page/Chrome.h: + * page/ChromeClient.h: + * page/mac/EventHandlerMac.mm: + (WebCore::EventHandler::wheelEvent): + (WebCore::EventHandler::currentPlatformMouseEvent): + (WebCore::EventHandler::sendContextMenuEvent): + (WebCore::EventHandler::eventMayStartDrag): + * platform/HostWindow.h: + * platform/Widget.h: + * platform/gtk/PlatformScreenGtk.cpp: + (WebCore::getVisual): + (WebCore::screenRect): + (WebCore::screenAvailableRect): + * platform/gtk/PopupMenuGtk.cpp: + (WebCore::PopupMenu::show): + * platform/gtk/ScrollViewGtk.cpp: + (WebCore::ScrollView::platformAddChild): + (WebCore::ScrollView::platformRemoveChild): + (WebCore::ScrollView::visibleContentRect): + * platform/gtk/WidgetGtk.cpp: + (WebCore::Widget::setFocus): + (WebCore::Widget::setCursor): + * platform/qt/PlatformScreenQt.cpp: + (WebCore::screenDepth): + (WebCore::screenDepthPerComponent): + (WebCore::screenIsMonochrome): + (WebCore::screenRect): + (WebCore::screenAvailableRect): + * platform/qt/PopupMenuQt.cpp: + (WebCore::PopupMenu::show): + * platform/qt/WidgetQt.cpp: + (WebCore::Widget::setCursor): + * platform/win/PlatformScreenWin.cpp: + (WebCore::monitorInfoForWidget): + * platform/win/PopupMenuWin.cpp: + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::calculatePositionAndSize): + (WebCore::PopupMenu::wndProc): + * platform/wx/RenderThemeWx.cpp: + (WebCore::nativeWindowForRenderObject): + * platform/wx/ScrollbarThemeWx.cpp: + (WebCore::ScrollbarThemeWx::paint): + * plugins/gtk/PluginViewGtk.cpp: + (WebCore::PluginView::getValue): + (WebCore::PluginView::forceRedraw): + (WebCore::PluginView::platformStart): + * plugins/mac/PluginViewMac.cpp: + (WebCore::PluginView::platformStart): + * plugins/qt/PluginViewQt.cpp: + (WebCore::PluginView::handleKeyboardEvent): + (WebCore::PluginView::getValue): + (WebCore::PluginView::platformStart): + * plugins/win/PluginViewWin.cpp: + (WebCore::PluginView::getValue): + (WebCore::PluginView::forceRedraw): + (WebCore::PluginView::platformStart): + +2009-09-18 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Web inspector UI adjustments specific to the Qt platform: + - Hide the close button + - Hide the dock button + - Disable the draggable toolbar + + https://bugs.webkit.org/show_bug.cgi?id=29384 + + * inspector/front-end/inspector.css: + * inspector/front-end/inspector.js: + (WebInspector.toolbarDragStart): + +2009-09-18 Joerg Bornemann <joerg.bornemann@nokia.com> + + Reviewed by Simon Hausmann. + + QtWebKit Windows CE compile fixes + + Exclude certain pure-WINCE specific code paths from the Qt build. + + * platform/graphics/BitmapImage.h: + * platform/graphics/FontCache.h: + * platform/graphics/MediaPlayer.cpp: + * platform/text/TextEncodingRegistry.cpp: + (WebCore::buildBaseTextCodecMaps): + (WebCore::extendTextCodecMaps): + * plugins/PluginView.cpp: + (WebCore::PluginView::stop): Guard this code block with NETSCAPE_PLUGIN_API as + the corresponding PluginViewWndProc has the same guard in the header file. + +2009-09-18 Steve Block <steveblock@google.com> + + Reviewed by Dimitri Glazkov. + + Geolocation does not correctly handle Infinity for PositionOptions properties. + https://bugs.webkit.org/show_bug.cgi?id=29099 + + * bindings/js/JSGeolocationCustom.cpp: Modified. + (WebCore::createPositionOptions): Modified. If timeout or maximumAge is positive infinity, applies these values as a special case. + * page/PositionOptions.h: Modified. + (WebCore::PositionOptions::hasMaximumAge): Added. Determines whether the object has a maximum age. + (WebCore::PositionOptions::maximumAge): Modified. Asserts that the object has a maximum age. + (WebCore::PositionOptions::clearMaximumAge): Added. Clears the maximum age. + (WebCore::PositionOptions::setMaximumAge): Modified. Registers that the maximum age has been set. + (WebCore::PositionOptions::PositionOptions): Modified. Registers that the maximum age has been set. + +2009-09-17 Sam Weinig <sam@webkit.org> + + Reviewed by Adele Peterson. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=29276 + REGRESSION(r48334): WebKit crashes on file select by drag + + Document.elementFromPoint now takes point in client space, not page space. + + * page/DragController.cpp: + (WebCore::DragController::tryDocumentDrag): + (WebCore::DragController::concludeEditDrag): + +2009-09-17 Albert J. Wong <ajwong@chromium.org> + + Reviewed by David Levin. + + Reimplement default media UI for Mac Chromium to match the style + of the Windows and Linux versions. Also breaks the dependency + on the internal wk* functions that were previously used to + render the media controller widgets. + https://bugs.webkit.org/show_bug.cgi?id=29161 + + No media layout tests are currently enabled in Mac Chromium, so + nothing needs rebaselineing, etc. + + This is a recommit of r48438 with a compile fix and merges of + recent changes to the file. + + * css/mediaControlsChromium.css: + * rendering/RenderThemeChromiumMac.h: + * rendering/RenderThemeChromiumMac.mm: + (WebCore::mediaElementParent): + (WebCore::RenderThemeChromiumMac::extraMediaControlsStyleSheet): + (WebCore::mediaSliderThumbImage): + (WebCore::mediaVolumeSliderThumbImage): + (WebCore::RenderThemeChromiumMac::paintSliderTrack): + (WebCore::RenderThemeChromiumMac::adjustSliderThumbSize): + (WebCore::RenderThemeChromiumMac::paintMediaButtonInternal): + (WebCore::RenderThemeChromiumMac::paintMediaPlayButton): + (WebCore::RenderThemeChromiumMac::paintMediaMuteButton): + (WebCore::RenderThemeChromiumMac::paintMediaSliderTrack): + (WebCore::RenderThemeChromiumMac::paintMediaVolumeSliderTrack): + (WebCore::RenderThemeChromiumMac::paintMediaSliderThumb): + (WebCore::RenderThemeChromiumMac::paintMediaVolumeSliderThumb): + (WebCore::RenderThemeChromiumMac::paintMediaControlsBackground): + * rendering/RenderThemeChromiumSkia.cpp: + (WebCore::RenderThemeChromiumSkia::adjustSliderThumbSize): + +2009-09-17 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Timothy Hatcher. + + The Console scope bar should have a divider between All and the other possible + values (Errors, Warnings, Logs). It will look something like: + + All | Errors Warnings Logs. + + * inspector/front-end/ConsoleView.js: + (WebInspector.ConsoleView.createDividerElement): + (WebInspector.ConsoleView): + * inspector/front-end/inspector.css: + +2009-09-17 Sam Weinig <sam@webkit.org> + + Reviewed by Mark Rowe. + + Remove additional references to JSVoidCallback which no longer exists. + + * DerivedSources.cpp: + * WebCore.vcproj/WebCore.vcproj: + +2009-09-17 Sam Weinig <sam@webkit.org> + + Reviewed by Brady Eidson. + + Remove commented out onhashchange attribute now that it is implemented. + + * page/DOMWindow.idl: + +2009-09-17 Anders Carlsson <andersca@apple.com> + + Reviewed by Oliver Hunt. + + <rdar://problem/7007541> + CrashTracer: 4800+ crashes in Safari at com.apple.WebKit • WTF::HashTableIterator... + + Make RuntimeObjectImp more robust against m_instance being a null (which can happen if an OOP plug-in + crashes while we're calling into it). + + * bridge/runtime_object.cpp: + (JSC::RuntimeObjectImp::RuntimeObjectImp): + (JSC::RuntimeObjectImp::~RuntimeObjectImp): + (JSC::RuntimeObjectImp::invalidate): + (JSC::RuntimeObjectImp::fallbackObjectGetter): + (JSC::RuntimeObjectImp::fieldGetter): + (JSC::RuntimeObjectImp::methodGetter): + (JSC::RuntimeObjectImp::getOwnPropertySlot): + (JSC::RuntimeObjectImp::getOwnPropertyDescriptor): + (JSC::RuntimeObjectImp::put): + (JSC::RuntimeObjectImp::defaultValue): + (JSC::RuntimeObjectImp::getCallData): + (JSC::RuntimeObjectImp::getConstructData): + (JSC::RuntimeObjectImp::getPropertyNames): + * bridge/runtime_object.h: + (JSC::RuntimeObjectImp::getInternalInstance): + +2009-09-17 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Timothy Hatcher. + + Wrap primitive values (as objects) in InspectorController::wrap. + + https://bugs.webkit.org/show_bug.cgi?id=28983 + + * inspector/InspectorController.cpp: + (WebCore::InspectorController::wrapObject): objects of any type will be wrapped into proxies, + only object proxies will have objectId. + * inspector/front-end/ConsoleView.js: + (WebInspector.ConsoleView.prototype.completions): there is InjectedScript.getCompletionsi + that accepts an expression and returns possible completions. This way we don't need to wrap + and unwrap the completions result into a proxy object. + * inspector/front-end/InjectedScript.js: + (InjectedScript.getCompletions): + (InjectedScript.evaluate): + (InjectedScript._evaluateOn): + (InjectedScript.createProxyObject): + * inspector/front-end/InjectedScriptAccess.js: + +2009-09-17 Nate Chapin <japhet@chromium.org> + + Reviewed by Dimitri Glazkov. + + Wrap PageTransitionEvents properly for V8's use. + + https://bugs.webkit.org/show_bug.cgi?id=29340 + + Fixes Chromium's failures for LayoutTests/fast/events/pageshow-pagehide.html. + + * bindings/v8/V8DOMWrapper.cpp: + (WebCore::V8DOMWrapper::convertEventToV8Object): Wrap PageTransitionEvents properly. + +2009-09-17 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dave Hyatt. + + Hardware-accelerated opacity transition on inline asserts + https://bugs.webkit.org/show_bug.cgi?id=29342 + + Remove an erroneous toRenderBox() that could be called on a RenderInline; we can just + pass an empty size, because the box size is only required for transform animations. + + Test: compositing/transitions/opacity-on-inline.html + + * rendering/RenderLayerBacking.cpp: + (WebCore::RenderLayerBacking::startTransition): + +2009-09-17 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + [V8] OwnHandle might get a weak callback after destruction + https://bugs.webkit.org/show_bug.cgi?id=29172 + + Be sure to clear out weak reference so we don't get a weak callback + after we've destructed ourselves. Also, removed some tricky methods + that had no clients. + + * bindings/v8/OwnHandle.h: + (WebCore::OwnHandle::clear): + +2009-09-17 Dimitri Glazkov <dglazkov@chromium.org> + + Unreviewed, build fix. + + [V8] Partial roll out of http://trac.webkit.org/changeset/48455 to + fix crashes that started happening in V8Proxy::getEnteredContext(). + + * bindings/v8/ScheduledAction.cpp: + (WebCore::ScheduledAction::execute): + +2009-09-17 Chris Fleizach <cfleizach@apple.com> + + Reviewed by Beth Dakin. + + AX: labels of checkboxes should, when hit-tested, return the checkbox + https://bugs.webkit.org/show_bug.cgi?id=29335 + + When an accessibility hit test is done and it hits the label of a control element, + the control element should be returned instead of nothing, since the label + itself is usually ignored. + + Test: accessibility/label-for-control-hittest.html + + * accessibility/AccessibilityObject.h: + (WebCore::AccessibilityObject::correspondingControlForLabelElement): + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::accessibilityIsIgnored): + (WebCore::AccessibilityRenderObject::doAccessibilityHitTest): + (WebCore::AccessibilityRenderObject::correspondingControlForLabelElement): + * accessibility/AccessibilityRenderObject.h: + +2009-09-17 Avi Drissman <avi@chromium.org> + + Reviewed by Dimitri Glazkov, build fix. + + Change to make RenderThemeChromiumMac compile inside of non PLATFORM(MAC). + https://bugs.webkit.org/show_bug.cgi?id=29243 + + Covered by existing tests. + + * rendering/RenderThemeChromiumMac.mm: + (WebCore::RenderThemeChromiumMac::paintMediaSliderTrack): + +2009-09-17 Dimitri Glazkov <dglazkov@chromium.org> + + Reviewed by Eric Seidel. + + [V8] Accessing properties/methods of an object, created with document.implementation.createDocumentType + creates nodes that have no document (ScriptExecutionContext), which in turn produces NULL-ref crashes. + https://bugs.webkit.org/show_bug.cgi?id=26402 + + Test: fast/dom/DOMImplementation/detached-doctype.html + fast/dom/doctype-event-listener-crash.html + + * bindings/v8/V8DOMWrapper.cpp: + (WebCore::V8DOMWrapper::getEventListener): Added an extra NULL-check. + +2009-09-17 Dan Bernstein <mitz@apple.com> + + Reviewed by Simon Fraser. + + FontDescription.h includes RenderStyleConstants.h, which violates layering + https://bugs.webkit.org/show_bug.cgi?id=29327 + + * GNUmakefile.am: Added FontSmoothingMode.h. + * WebCore.gypi: Added FontSmoothingMode.h. + * WebCore.vcproj/WebCore.vcproj: Added FontSmoothingMode.h. + * WebCore.xcodeproj/project.pbxproj: Added FontSmoothingMode.h and made + it a private header. + * css/CSSComputedStyleDeclaration.cpp: + (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Get the + font smoothing mode via the font description. + * css/CSSPrimitiveValueMappings.h: Include FontSmoothingMode.h + (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Updated for the rename + of FontSmoothing to FontSmoothingMode. + (WebCore::CSSPrimitiveValue::operator FontSmoothingMode): Ditto. + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::applyProperty): Get the font smoothing mode + via the font description. + * platform/graphics/FontDescription.h: Do not include + RenderStyleConstants.h. + (WebCore::FontDescription::fontSmoothing): Updated for the rename of + FontSmoothing to FontSmoothingMode. + (WebCore::FontDescription::setFontSmoothing): Ditto. + * platform/graphics/FontSmoothingMode.h: Added. + (WebCore::FontSmoothingMode): Moved the FontSmoothing enum from + RenderStyleConstants here and renamed it to this. + * rendering/style/RenderStyle.h: + (WebCore::InheritedFlags::fontSmoothing): Removed this getter, since + this can be accessed via the font description. + * rendering/style/RenderStyleConstants.h: Moved the FontSmoothing enum + from here to FontSmoothingMode.h. + +2009-09-17 Kevin Ollivier <kevino@theolliviers.com> + + wx 2.9 build fix. + + * platform/wx/wxcode/gtk/scrollbar_render.cpp: + (wxGetGdkWindowForDC): + +2009-09-16 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dan Bernstein. + + Elements appear behind <video> when they should be in front sometimes + https://bugs.webkit.org/show_bug.cgi?id=29314 + + r45598 added logic that tests for overlap with <video> to determine when to throw + a layer into compositing mode. That logic was incorrect in some cases, and this patch + fixes it. When testing overlap, the layer needs to be composited iff some previous layer + is composited (which adds a rect to the overlay map), and there is overlap. + + Test: compositing/geometry/video-opacity-overlay.html + + * rendering/RenderLayerCompositor.cpp: + (WebCore::CompositingState::CompositingState): + (WebCore::RenderLayerCompositor::computeCompositingRequirements): + +2009-09-17 Avi Drissman <avi@google.com> + + Reviewed by Darin Fisher. + + Update the Chromium Mac theming files (RenderTheme and Theme) to be + up-to-date. + + https://bugs.webkit.org/show_bug.cgi?id=29243 + http://crbug.com/19604 + + Covered by existing tests. + + * WebCore.gypi: + * platform/chromium/ThemeChromiumMac.h: Added. + (WebCore::ThemeChromiumMac::ThemeChromiumMac): + (WebCore::ThemeChromiumMac::~ThemeChromiumMac): + (WebCore::ThemeChromiumMac::controlRequiresPreWhiteSpace): + * platform/chromium/ThemeChromiumMac.mm: Added. + (WebCore::): + (WebCore::platformTheme): + (WebCore::controlSizeForFont): + (WebCore::sizeFromFont): + (WebCore::setControlSize): + (WebCore::updateStates): + (WebCore::inflateRect): + (WebCore::checkboxSizes): + (WebCore::checkboxMargins): + (WebCore::checkboxSize): + (WebCore::checkbox): + (WebCore::paintCheckbox): + (WebCore::radioSizes): + (WebCore::radioMargins): + (WebCore::radioSize): + (WebCore::radio): + (WebCore::paintRadio): + (WebCore::buttonSizes): + (WebCore::buttonMargins): + (WebCore::button): + (WebCore::paintButton): + (WebCore::ThemeChromiumMac::baselinePositionAdjustment): + (WebCore::ThemeChromiumMac::controlFont): + (WebCore::ThemeChromiumMac::controlSize): + (WebCore::ThemeChromiumMac::minimumControlSize): + (WebCore::ThemeChromiumMac::controlBorder): + (WebCore::ThemeChromiumMac::controlPadding): + (WebCore::ThemeChromiumMac::inflateControlPaintRect): + (WebCore::ThemeChromiumMac::paint): + * platform/graphics/FloatPoint.h: + * platform/graphics/FloatRect.h: + * platform/graphics/FloatSize.h: + * platform/graphics/IntRect.h: + * rendering/RenderThemeChromiumMac.h: + (WebCore::RenderThemeChromiumMac::supportsControlTints): + (WebCore::RenderThemeChromiumMac::scrollbarControlSizeForPart): + (WebCore::RenderThemeChromiumMac::supportsSelectionForegroundColors): + * rendering/RenderThemeChromiumMac.mm: + (-[WebCoreRenderThemeNotificationObserver systemColorsDidChange:]): + (-[RTCMFlippedView isFlipped]): + (-[RTCMFlippedView currentEditor]): + (WebCore::): + (WebCore::FlippedView): + (WebCore::RenderTheme::themeForPage): + (WebCore::RenderThemeChromiumMac::platformActiveListBoxSelectionForegroundColor): + (WebCore::RenderThemeChromiumMac::platformInactiveListBoxSelectionForegroundColor): + (WebCore::RenderThemeChromiumMac::platformInactiveListBoxSelectionBackgroundColor): + (WebCore::RenderThemeChromiumMac::systemFont): + (WebCore::convertNSColorToColor): + (WebCore::menuBackgroundColor): + (WebCore::RenderThemeChromiumMac::systemColor): + (WebCore::RenderThemeChromiumMac::isControlStyled): + (WebCore::RenderThemeChromiumMac::adjustRepaintRect): + (WebCore::RenderThemeChromiumMac::inflateRect): + (WebCore::RenderThemeChromiumMac::convertToPaintingRect): + (WebCore::RenderThemeChromiumMac::setFontFromControlSize): + (WebCore::RenderThemeChromiumMac::paintTextField): + (WebCore::RenderThemeChromiumMac::paintCapsLockIndicator): + (WebCore::RenderThemeChromiumMac::paintTextArea): + (WebCore::RenderThemeChromiumMac::paintMenuList): + (WebCore::TopGradientInterpolate): + (WebCore::BottomGradientInterpolate): + (WebCore::MainGradientInterpolate): + (WebCore::TrackGradientInterpolate): + (WebCore::RenderThemeChromiumMac::paintMenuListButtonGradients): + (WebCore::RenderThemeChromiumMac::paintMenuListButton): + (WebCore::RenderThemeChromiumMac::popupInternalPaddingLeft): + (WebCore::RenderThemeChromiumMac::popupInternalPaddingRight): + (WebCore::RenderThemeChromiumMac::popupInternalPaddingTop): + (WebCore::RenderThemeChromiumMac::popupInternalPaddingBottom): + (WebCore::RenderThemeChromiumMac::adjustMenuListButtonStyle): + (WebCore::RenderThemeChromiumMac::adjustSliderTrackStyle): + (WebCore::RenderThemeChromiumMac::adjustSliderThumbStyle): + (WebCore::RenderThemeChromiumMac::paintSliderThumb): + (WebCore::RenderThemeChromiumMac::paintSearchField): + (WebCore::RenderThemeChromiumMac::setSearchCellState): + (WebCore::RenderThemeChromiumMac::adjustSearchFieldStyle): + (WebCore::RenderThemeChromiumMac::paintSearchFieldCancelButton): + (WebCore::RenderThemeChromiumMac::adjustSearchFieldCancelButtonStyle): + (WebCore::RenderThemeChromiumMac::adjustSearchFieldDecorationStyle): + (WebCore::RenderThemeChromiumMac::paintSearchFieldDecoration): + (WebCore::RenderThemeChromiumMac::adjustSearchFieldResultsDecorationStyle): + (WebCore::RenderThemeChromiumMac::paintSearchFieldResultsDecoration): + (WebCore::RenderThemeChromiumMac::adjustSearchFieldResultsButtonStyle): + (WebCore::RenderThemeChromiumMac::paintSearchFieldResultsButton): + (WebCore::mediaControllerTheme): + (WebCore::RenderThemeChromiumMac::adjustSliderThumbSize): + (WebCore::getMediaUIPartStateFlags): + (WebCore::getUnzoomedRectAndAdjustCurrentContext): + (WebCore::RenderThemeChromiumMac::paintMediaFullscreenButton): + (WebCore::RenderThemeChromiumMac::paintMediaMuteButton): + (WebCore::RenderThemeChromiumMac::paintMediaPlayButton): + (WebCore::RenderThemeChromiumMac::paintMediaSeekBackButton): + (WebCore::RenderThemeChromiumMac::paintMediaSeekForwardButton): + (WebCore::RenderThemeChromiumMac::paintMediaSliderTrack): + (WebCore::RenderThemeChromiumMac::paintMediaSliderThumb): + (WebCore::RenderThemeChromiumMac::paintMediaRewindButton): + (WebCore::RenderThemeChromiumMac::paintMediaReturnToRealtimeButton): + (WebCore::RenderThemeChromiumMac::paintMediaControlsBackground): + (WebCore::RenderThemeChromiumMac::paintMediaCurrentTime): + (WebCore::RenderThemeChromiumMac::paintMediaTimeRemaining): + (WebCore::RenderThemeChromiumMac::extraMediaControlsStyleSheet): + 2009-09-16 Daniel Bates <dbates@webkit.org> Reviewed by Darin Adler. diff --git a/src/3rdparty/webkit/WebCore/DerivedSources.cpp b/src/3rdparty/webkit/WebCore/DerivedSources.cpp index 408daba..2131793 100644 --- a/src/3rdparty/webkit/WebCore/DerivedSources.cpp +++ b/src/3rdparty/webkit/WebCore/DerivedSources.cpp @@ -333,7 +333,6 @@ #include "JSTreeWalker.cpp" #include "JSUIEvent.cpp" #include "JSValidityState.cpp" -#include "JSVoidCallback.cpp" #include "JSWebKitAnimationEvent.cpp" #include "JSWebKitCSSKeyframeRule.cpp" #include "JSWebKitCSSKeyframesRule.cpp" diff --git a/src/3rdparty/webkit/WebCore/WebCore.LP64.exp b/src/3rdparty/webkit/WebCore/WebCore.LP64.exp deleted file mode 100644 index cc04718..0000000 --- a/src/3rdparty/webkit/WebCore/WebCore.LP64.exp +++ /dev/null @@ -1,15 +0,0 @@ -# This file gets appended to WebCore.exp, only for 64-bit architectures. - -__ZN3JSC16RuntimeObjectImp6s_infoE -__ZN3JSC8Bindings10RootObjectD1Ev -__ZN3JSC8Bindings8Instance19createRuntimeObjectEPNS_9ExecStateE -__ZN3JSC8Bindings8InstanceC2EN3WTF10PassRefPtrINS0_10RootObjectEEE -__ZN3JSC8Bindings8InstanceD2Ev -__ZN7WebCore13IdentifierRep3getEi -__ZN7WebCore13IdentifierRep3getEPKc -__ZN7WebCore13IdentifierRep7isValidEPS0_ -__ZN7WebCore16ScriptController16createRootObjectEPv -__ZN7WebCore16ScriptController24jsObjectForPluginElementEPNS_17HTMLPlugInElementE -__ZN7WebCore16ScriptController9isEnabledEv -__ZN7WebCore6String26fromUTF8WithLatin1FallbackEPKcm -__ZN7WebCore6String8fromUTF8EPKcm diff --git a/src/3rdparty/webkit/WebCore/WebCore.gypi b/src/3rdparty/webkit/WebCore/WebCore.gypi index 3a5c73c..758d99d 100644 --- a/src/3rdparty/webkit/WebCore/WebCore.gypi +++ b/src/3rdparty/webkit/WebCore/WebCore.gypi @@ -532,7 +532,6 @@ 'bindings/js/JSRGBColor.h', 'bindings/js/JSSharedWorkerConstructor.cpp', 'bindings/js/JSSharedWorkerConstructor.h', - 'bindings/js/JSSharedWorkerContextCustom.cpp', 'bindings/js/JSSharedWorkerCustom.cpp', 'bindings/js/JSSQLResultSetRowListCustom.cpp', 'bindings/js/JSSQLTransactionCustom.cpp', @@ -690,6 +689,8 @@ 'bindings/v8/custom/V8XMLSerializerConstructor.cpp', 'bindings/v8/custom/V8XPathEvaluatorConstructor.cpp', 'bindings/v8/custom/V8XSLTProcessorCustom.cpp', + 'bindings/v8/DateExtension.cpp', + 'bindings/v8/DateExtension.h', 'bindings/v8/DOMData.cpp', 'bindings/v8/DOMData.h', 'bindings/v8/DOMDataStore.cpp', @@ -1771,6 +1772,8 @@ 'platform/chromium/SuddenTerminationChromium.cpp', 'platform/chromium/SystemTimeChromium.cpp', 'platform/chromium/TemporaryLinkStubs.cpp', + 'platform/chromium/ThemeChromiumMac.h', + 'platform/chromium/ThemeChromiumMac.mm', 'platform/chromium/WidgetChromium.cpp', 'platform/chromium/WindowsVersion.cpp', 'platform/chromium/WindowsVersion.h', @@ -2064,6 +2067,7 @@ 'platform/graphics/FontFastPath.cpp', 'platform/graphics/FontRenderingMode.h', 'platform/graphics/FontSelector.h', + 'platform/graphics/FontSmoothingMode.h', 'platform/graphics/FontTraitsMask.h', 'platform/graphics/GeneratedImage.cpp', 'platform/graphics/GeneratedImage.h', diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro index e614ffb..de3717d 100644 --- a/src/3rdparty/webkit/WebCore/WebCore.pro +++ b/src/3rdparty/webkit/WebCore/WebCore.pro @@ -169,8 +169,7 @@ contains(DEFINES, ENABLE_SINGLE_THREADED=1) { } # Web Socket support. -# FIXME: Enable once platform code is landed. -# !contains(DEFINES, ENABLE_WEB_SOCKETS=.): DEFINES += ENABLE_WEB_SOCKETS=1 +!contains(DEFINES, ENABLE_WEB_SOCKETS=.): DEFINES += ENABLE_WEB_SOCKETS=1 DEFINES += WTF_USE_JAVASCRIPTCORE_BINDINGS=1 WTF_CHANGES=1 @@ -714,7 +713,6 @@ SOURCES += \ bindings/js/JSInspectorCallbackWrapper.cpp \ bindings/js/JSLocationCustom.cpp \ bindings/js/JSNamedNodeMapCustom.cpp \ - bindings/js/JSNamedNodesCollection.cpp \ bindings/js/JSNavigatorCustom.cpp \ bindings/js/JSNodeCustom.cpp \ bindings/js/JSNodeFilterCondition.cpp \ @@ -1392,7 +1390,6 @@ HEADERS += \ bindings/js/JSLazyEventListener.h \ bindings/js/JSLocationCustom.h \ bindings/js/JSMessageChannelConstructor.h \ - bindings/js/JSNamedNodesCollection.h \ bindings/js/JSNodeFilterCondition.h \ bindings/js/JSOptionConstructor.h \ bindings/js/JSPluginElementFunctions.h \ @@ -1904,6 +1901,7 @@ HEADERS += \ platform/network/ResourceRequestBase.h \ platform/network/ResourceResponseBase.h \ platform/qt/ClipboardQt.h \ + platform/qt/QWebPageClient.h \ platform/qt/QWebPopup.h \ platform/qt/RenderThemeQt.h \ platform/qt/ScrollbarThemeQt.h \ @@ -2637,7 +2635,6 @@ contains(DEFINES, ENABLE_SHARED_WORKERS=1) { SOURCES += \ bindings/js/JSSharedWorkerConstructor.cpp \ - bindings/js/JSSharedWorkerContextCustom.cpp \ bindings/js/JSSharedWorkerCustom.cpp \ workers/DefaultSharedWorkerRepository.cpp \ workers/SharedWorker.cpp \ @@ -3105,6 +3102,20 @@ SOURCES += \ bindings/js/JSDOMApplicationCacheCustom.cpp } +contains(DEFINES, ENABLE_WEB_SOCKETS=1) { + FEATURE_DEFINES_JAVASCRIPT += ENABLE_WEB_SOCKETS=1 + +SOURCES += \ + websockets/WebSocket.cpp \ + websockets/WebSocketChannel.cpp \ + websockets/WebSocketHandshake.cpp \ + platform/network/SocketStreamErrorBase.cpp \ + platform/network/SocketStreamHandleBase.cpp \ + platform/network/qt/SocketStreamHandleSoup.cpp \ + bindings/js/JSWebSocketCustom.cpp \ + bindings/js/JSWebSocketConstructor.cpp +} + # GENERATOR 1: IDL compiler idl.output = $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}JS${QMAKE_FILE_BASE}.cpp idl.variable_out = GENERATED_SOURCES diff --git a/src/3rdparty/webkit/WebCore/accessibility/AccessibilityObject.h b/src/3rdparty/webkit/WebCore/accessibility/AccessibilityObject.h index 8762fd8..c5ba1ed 100644 --- a/src/3rdparty/webkit/WebCore/accessibility/AccessibilityObject.h +++ b/src/3rdparty/webkit/WebCore/accessibility/AccessibilityObject.h @@ -316,6 +316,7 @@ public: virtual void linkedUIElements(AccessibilityChildrenVector&) const { } virtual AccessibilityObject* titleUIElement() const { return 0; } virtual bool exposesTitleUIElement() const { return true; } + virtual AccessibilityObject* correspondingControlForLabelElement() const { return 0; } virtual AccessibilityRole ariaRoleAttribute() const { return UnknownRole; } virtual bool isPresentationalChildOfAriaRole() const { return false; } diff --git a/src/3rdparty/webkit/WebCore/accessibility/AccessibilityRenderObject.cpp b/src/3rdparty/webkit/WebCore/accessibility/AccessibilityRenderObject.cpp index b7dd601..834e931 100644 --- a/src/3rdparty/webkit/WebCore/accessibility/AccessibilityRenderObject.cpp +++ b/src/3rdparty/webkit/WebCore/accessibility/AccessibilityRenderObject.cpp @@ -1276,15 +1276,9 @@ bool AccessibilityRenderObject::accessibilityIsIgnored() const // find out if this element is inside of a label element. // if so, it may be ignored because it's the label for a checkbox or radio button - HTMLLabelElement* labelElement = labelElementContainer(); - if (labelElement) { - HTMLElement* correspondingControl = labelElement->correspondingControl(); - if (correspondingControl && correspondingControl->renderer()) { - AccessibilityObject* controlObject = axObjectCache()->getOrCreate(correspondingControl->renderer()); - if (!controlObject->exposesTitleUIElement()) - return true; - } - } + AccessibilityObject* controlObject = correspondingControlForLabelElement(); + if (controlObject && !controlObject->exposesTitleUIElement()) + return true; AccessibilityRole ariaRole = ariaRoleAttribute(); if (ariaRole == TextAreaRole || ariaRole == StaticTextRole) { @@ -2119,8 +2113,14 @@ AccessibilityObject* AccessibilityRenderObject::doAccessibilityHitTest(const Int if (obj->isListBox()) return static_cast<AccessibilityListBox*>(result)->doAccessibilityHitTest(point); - if (result->accessibilityIsIgnored()) + if (result->accessibilityIsIgnored()) { + // If this element is the label of a control, a hit test should return the control. + AccessibilityObject* controlObject = result->correspondingControlForLabelElement(); + if (controlObject && !controlObject->exposesTitleUIElement()) + return controlObject; + result = result->parentObjectUnignored(); + } return result; } @@ -2199,6 +2199,18 @@ void AccessibilityRenderObject::handleActiveDescendantChanged() doc->axObjectCache()->postNotification(activedescendant->renderer(), AXObjectCache::AXFocusedUIElementChanged, true); } +AccessibilityObject* AccessibilityRenderObject::correspondingControlForLabelElement() const +{ + HTMLLabelElement* labelElement = labelElementContainer(); + if (!labelElement) + return 0; + + HTMLElement* correspondingControl = labelElement->correspondingControl(); + if (!correspondingControl) + return 0; + + return axObjectCache()->getOrCreate(correspondingControl->renderer()); +} AccessibilityObject* AccessibilityRenderObject::observableObject() const { @@ -2664,7 +2676,9 @@ void AccessibilityRenderObject::updateBackingStore() { if (!m_renderer) return; - m_renderer->view()->layoutIfNeeded(); -} - + + // Updating layout may delete m_renderer and this object. + m_renderer->document()->updateLayoutIgnorePendingStylesheets(); +} + } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/accessibility/AccessibilityRenderObject.h b/src/3rdparty/webkit/WebCore/accessibility/AccessibilityRenderObject.h index e600b61..d82ca71 100644 --- a/src/3rdparty/webkit/WebCore/accessibility/AccessibilityRenderObject.h +++ b/src/3rdparty/webkit/WebCore/accessibility/AccessibilityRenderObject.h @@ -133,6 +133,8 @@ public: virtual void linkedUIElements(AccessibilityChildrenVector&) const; virtual bool exposesTitleUIElement() const; virtual AccessibilityObject* titleUIElement() const; + virtual AccessibilityObject* correspondingControlForLabelElement() const; + virtual AccessibilityRole ariaRoleAttribute() const; virtual bool isPresentationalChildOfAriaRole() const; virtual bool ariaRoleHasPresentationalChildren() const; diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSAbstractWorkerCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSAbstractWorkerCustom.cpp index 475b374..aac1c63 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSAbstractWorkerCustom.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSAbstractWorkerCustom.cpp @@ -44,21 +44,6 @@ using namespace JSC; namespace WebCore { -void JSAbstractWorker::markChildren(MarkStack& markStack) -{ - Base::markChildren(markStack); - - markIfNotNull(markStack, m_impl->onerror()); - - typedef AbstractWorker::EventListenersMap EventListenersMap; - typedef AbstractWorker::ListenerVector ListenerVector; - EventListenersMap& eventListeners = m_impl->eventListeners(); - for (EventListenersMap::iterator mapIter = eventListeners.begin(); mapIter != eventListeners.end(); ++mapIter) { - for (ListenerVector::iterator vecIter = mapIter->second.begin(); vecIter != mapIter->second.end(); ++vecIter) - (*vecIter)->markJSFunction(markStack); - } -} - JSValue JSAbstractWorker::addEventListener(ExecState* exec, const ArgList& args) { JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext()); diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSCustomXPathNSResolver.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSCustomXPathNSResolver.cpp index 4476be5..da4a53a 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSCustomXPathNSResolver.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSCustomXPathNSResolver.cpp @@ -49,13 +49,13 @@ PassRefPtr<JSCustomXPathNSResolver> JSCustomXPathNSResolver::create(JSC::ExecSta setDOMException(exec, TYPE_MISMATCH_ERR); return 0; } - - return adoptRef(new JSCustomXPathNSResolver(resolverObject, asJSDOMWindow(exec->dynamicGlobalObject())->impl()->frame())); + + return adoptRef(new JSCustomXPathNSResolver(resolverObject, asJSDOMWindow(exec->dynamicGlobalObject()))); } -JSCustomXPathNSResolver::JSCustomXPathNSResolver(JSObject* customResolver, Frame* frame) +JSCustomXPathNSResolver::JSCustomXPathNSResolver(JSObject* customResolver, JSDOMWindow* globalObject) : m_customResolver(customResolver) - , m_frame(frame) + , m_globalObject(globalObject) { } @@ -67,15 +67,9 @@ String JSCustomXPathNSResolver::lookupNamespaceURI(const String& prefix) { ASSERT(m_customResolver); - if (!m_frame) - return String(); - if (!m_frame->script()->isEnabled()) - return String(); - JSLock lock(SilenceAssertionsOnly); - JSGlobalObject* globalObject = m_frame->script()->globalObject(); - ExecState* exec = globalObject->globalExec(); + ExecState* exec = m_globalObject->globalExec(); JSValue function = m_customResolver->get(exec, Identifier(exec, "lookupNamespaceURI")); CallData callData; @@ -84,7 +78,7 @@ String JSCustomXPathNSResolver::lookupNamespaceURI(const String& prefix) callType = m_customResolver->getCallData(callData); if (callType == CallTypeNone) { // FIXME: Pass actual line number and source URL. - m_frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "XPathNSResolver does not have a lookupNamespaceURI method.", 0, String()); + m_globalObject->impl()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "XPathNSResolver does not have a lookupNamespaceURI method.", 0, String()); return String(); } function = m_customResolver; @@ -95,9 +89,9 @@ String JSCustomXPathNSResolver::lookupNamespaceURI(const String& prefix) MarkedArgumentBuffer args; args.append(jsString(exec, prefix)); - globalObject->globalData()->timeoutChecker.start(); + m_globalObject->globalData()->timeoutChecker.start(); JSValue retval = call(exec, function, callType, callData, m_customResolver, args); - globalObject->globalData()->timeoutChecker.stop(); + m_globalObject->globalData()->timeoutChecker.stop(); String result; if (exec->hadException()) diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSCustomXPathNSResolver.h b/src/3rdparty/webkit/WebCore/bindings/js/JSCustomXPathNSResolver.h index 44c44f9..7d66494 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSCustomXPathNSResolver.h +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSCustomXPathNSResolver.h @@ -41,6 +41,7 @@ namespace JSC { namespace WebCore { class Frame; + class JSDOMWindow; class JSCustomXPathNSResolver : public XPathNSResolver { public: @@ -51,10 +52,11 @@ namespace WebCore { virtual String lookupNamespaceURI(const String& prefix); private: - JSCustomXPathNSResolver(JSC::JSObject*, Frame*); + JSCustomXPathNSResolver(JSC::JSObject*, JSDOMWindow*); - JSC::JSObject* m_customResolver; // JSCustomXPathNSResolvers are always temporary, thus no need to GC protect the object. - RefPtr<Frame> m_frame; + // JSCustomXPathNSResolvers are always temporary, thus no need to GC protect the objects. + JSC::JSObject* m_customResolver; + JSDOMWindow* m_globalObject; }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp index b833e71..5855026 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp @@ -42,28 +42,6 @@ using namespace JSC; namespace WebCore { -void JSDOMApplicationCache::markChildren(MarkStack& markStack) -{ - Base::markChildren(markStack); - - markIfNotNull(markStack, m_impl->onchecking()); - markIfNotNull(markStack, m_impl->onerror()); - markIfNotNull(markStack, m_impl->onnoupdate()); - markIfNotNull(markStack, m_impl->ondownloading()); - markIfNotNull(markStack, m_impl->onprogress()); - markIfNotNull(markStack, m_impl->onupdateready()); - markIfNotNull(markStack, m_impl->oncached()); - markIfNotNull(markStack, m_impl->onobsolete()); - - typedef DOMApplicationCache::EventListenersMap EventListenersMap; - typedef DOMApplicationCache::ListenerVector ListenerVector; - EventListenersMap& eventListeners = m_impl->eventListeners(); - for (EventListenersMap::iterator mapIter = eventListeners.begin(); mapIter != eventListeners.end(); ++mapIter) { - for (ListenerVector::iterator vecIter = mapIter->second.begin(); vecIter != mapIter->second.end(); ++vecIter) - (*vecIter)->markJSFunction(markStack); - } -} - #if ENABLE(APPLICATION_CACHE_DYNAMIC_ENTRIES) JSValue JSDOMApplicationCache::hasItem(ExecState* exec, const ArgList& args) diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.cpp index df384ea..1899797 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.cpp @@ -275,7 +275,7 @@ static inline bool isObservableThroughDOM(JSNode* jsNode) // If a node is in the document, and has event listeners, its wrapper is // observable because its wrapper is responsible for marking those event listeners. - if (node->eventListeners().size()) + if (node->hasEventListeners()) return true; // Technically, we may overzealously mark a wrapper for a node that has only non-JS event listeners. Oh well. // If a node owns another object with a wrapper with custom properties, @@ -323,6 +323,11 @@ static inline bool isObservableThroughDOM(JSNode* jsNode) #endif } + // If a node is firing event listeners, its wrapper is observable because + // its wrapper is responsible for marking those event listeners. + if (node->isFiringEventListeners()) + return true; + return false; } @@ -648,4 +653,10 @@ JSC::JSObject* toJSSequence(ExecState* exec, JSValue value, unsigned& length) return object; } +bool DOMObject::defineOwnProperty(ExecState* exec, const Identifier&, PropertyDescriptor&, bool) +{ + throwError(exec, TypeError, "defineProperty is not supported on DOM Objects"); + return false; +} + } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.h b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.h index c3ab266..c46513c 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.h +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.h @@ -55,6 +55,8 @@ namespace WebCore { { } + virtual bool defineOwnProperty(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&, bool); + #ifndef NDEBUG virtual ~DOMObject(); #endif diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowCustom.cpp index 27e95fe..08c7144 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowCustom.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowCustom.cpp @@ -94,7 +94,7 @@ void JSDOMWindow::markChildren(MarkStack& markStack) { Base::markChildren(markStack); - markEventListeners(markStack, impl()->eventListeners()); + impl()->markEventListeners(markStack); JSGlobalData& globalData = *Heap::heap(this)->globalData(); @@ -488,7 +488,7 @@ bool JSDOMWindow::getPropertyAttributes(ExecState* exec, const Identifier& prope return Base::getPropertyAttributes(exec, propertyName, attributes); } -void JSDOMWindow::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunction) +void JSDOMWindow::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes) { // Only allow defining getters by frames in the same origin. if (!allowsAccessFrom(exec)) @@ -498,15 +498,23 @@ void JSDOMWindow::defineGetter(ExecState* exec, const Identifier& propertyName, if (propertyName == "location") return; - Base::defineGetter(exec, propertyName, getterFunction); + Base::defineGetter(exec, propertyName, getterFunction, attributes); } -void JSDOMWindow::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunction) +void JSDOMWindow::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes) { // Only allow defining setters by frames in the same origin. if (!allowsAccessFrom(exec)) return; - Base::defineSetter(exec, propertyName, setterFunction); + Base::defineSetter(exec, propertyName, setterFunction, attributes); +} + +bool JSDOMWindow::defineOwnProperty(JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::PropertyDescriptor& descriptor, bool shouldThrow) +{ + // Only allow defining properties in this way by frames in the same origin, as it allows setters to be introduced. + if (!allowsAccessFrom(exec)) + return false; + return Base::defineOwnProperty(exec, propertyName, descriptor, shouldThrow); } JSValue JSDOMWindow::lookupGetter(ExecState* exec, const Identifier& propertyName) @@ -572,13 +580,13 @@ void JSDOMWindow::setLocation(ExecState* exec, JSValue value) Frame* frame = impl()->frame(); ASSERT(frame); - if (!shouldAllowNavigation(exec, frame)) - return; - KURL url = completeURL(exec, value.toString(exec)); if (url.isNull()) return; + if (!shouldAllowNavigation(exec, frame)) + return; + if (!protocolIsJavaScript(url) || allowsAccessFrom(exec)) { // We want a new history item if this JS was called via a user gesture frame->loader()->scheduleLocationChange(url, lexicalFrame->loader()->outgoingReferrer(), !lexicalFrame->script()->anyPageIsProcessingUserGesture(), false, processingUserGesture(exec)); @@ -773,6 +781,10 @@ static Frame* createWindow(ExecState* exec, Frame* lexicalFrame, Frame* dynamicF JSValue JSDOMWindow::open(ExecState* exec, const ArgList& args) { + String urlString = valueToStringWithUndefinedOrNullCheck(exec, args.at(0)); + AtomicString frameName = args.at(1).isUndefinedOrNull() ? "_blank" : AtomicString(args.at(1).toString(exec)); + WindowFeatures windowFeatures(valueToStringWithUndefinedOrNullCheck(exec, args.at(2))); + Frame* frame = impl()->frame(); if (!frame) return jsUndefined(); @@ -785,9 +797,6 @@ JSValue JSDOMWindow::open(ExecState* exec, const ArgList& args) Page* page = frame->page(); - String urlString = valueToStringWithUndefinedOrNullCheck(exec, args.at(0)); - AtomicString frameName = args.at(1).isUndefinedOrNull() ? "_blank" : AtomicString(args.at(1).toString(exec)); - // Because FrameTree::find() returns true for empty strings, we must check for empty framenames. // Otherwise, illegitimate window.open() calls with no name will pass right through the popup blocker. if (!DOMWindow::allowPopUp(dynamicFrame) && (frameName.isEmpty() || !frame->tree()->find(frameName))) @@ -805,13 +814,13 @@ JSValue JSDOMWindow::open(ExecState* exec, const ArgList& args) topOrParent = true; } if (topOrParent) { - if (!shouldAllowNavigation(exec, frame)) - return jsUndefined(); - String completedURL; if (!urlString.isEmpty()) completedURL = completeURL(exec, urlString).string(); + if (!shouldAllowNavigation(exec, frame)) + return jsUndefined(); + const JSDOMWindow* targetedWindow = toJSDOMWindow(frame); if (!completedURL.isEmpty() && (!protocolIsJavaScript(completedURL) || (targetedWindow && targetedWindow->allowsAccessFrom(exec)))) { bool userGesture = processingUserGesture(exec); @@ -827,7 +836,6 @@ JSValue JSDOMWindow::open(ExecState* exec, const ArgList& args) } // In the case of a named frame or a new window, we'll use the createWindow() helper - WindowFeatures windowFeatures(valueToStringWithUndefinedOrNullCheck(exec, args.at(2))); FloatRect windowRect(windowFeatures.xSet ? windowFeatures.x : 0, windowFeatures.ySet ? windowFeatures.y : 0, windowFeatures.widthSet ? windowFeatures.width : 0, windowFeatures.heightSet ? windowFeatures.height : 0); DOMWindow::adjustWindowRect(screenAvailableRect(page ? page->mainFrame()->view() : 0), windowRect, windowRect); @@ -847,6 +855,10 @@ JSValue JSDOMWindow::open(ExecState* exec, const ArgList& args) JSValue JSDOMWindow::showModalDialog(ExecState* exec, const ArgList& args) { + String url = valueToStringWithUndefinedOrNullCheck(exec, args.at(0)); + JSValue dialogArgs = args.at(1); + String featureArgs = valueToStringWithUndefinedOrNullCheck(exec, args.at(2)); + Frame* frame = impl()->frame(); if (!frame) return jsUndefined(); @@ -860,10 +872,6 @@ JSValue JSDOMWindow::showModalDialog(ExecState* exec, const ArgList& args) if (!DOMWindow::canShowModalDialogNow(frame) || !DOMWindow::allowPopUp(dynamicFrame)) return jsUndefined(); - String url = valueToStringWithUndefinedOrNullCheck(exec, args.at(0)); - JSValue dialogArgs = args.at(1); - String featureArgs = valueToStringWithUndefinedOrNullCheck(exec, args.at(2)); - HashMap<String, String> features; DOMWindow::parseModalDialogFeatures(featureArgs, features); diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowShell.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowShell.cpp index f969dc1..3c3ff4c 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowShell.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowShell.cpp @@ -103,6 +103,11 @@ void JSDOMWindowShell::putWithAttributes(ExecState* exec, const Identifier& prop m_window->putWithAttributes(exec, propertyName, value, attributes); } +bool JSDOMWindowShell::defineOwnProperty(JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::PropertyDescriptor& descriptor, bool shouldThrow) +{ + return m_window->defineOwnProperty(exec, propertyName, descriptor, shouldThrow); +} + bool JSDOMWindowShell::deleteProperty(ExecState* exec, const Identifier& propertyName) { return m_window->deleteProperty(exec, propertyName); @@ -123,14 +128,14 @@ bool JSDOMWindowShell::getPropertyAttributes(JSC::ExecState* exec, const Identif return m_window->getPropertyAttributes(exec, propertyName, attributes); } -void JSDOMWindowShell::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunction) +void JSDOMWindowShell::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes) { - m_window->defineGetter(exec, propertyName, getterFunction); + m_window->defineGetter(exec, propertyName, getterFunction, attributes); } -void JSDOMWindowShell::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunction) +void JSDOMWindowShell::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes) { - m_window->defineSetter(exec, propertyName, setterFunction); + m_window->defineSetter(exec, propertyName, setterFunction, attributes); } JSValue JSDOMWindowShell::lookupGetter(ExecState* exec, const Identifier& propertyName) diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowShell.h b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowShell.h index a7c2c56..23af340 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowShell.h +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowShell.h @@ -74,8 +74,9 @@ namespace WebCore { virtual void getPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&); virtual void getOwnPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&); virtual bool getPropertyAttributes(JSC::ExecState*, const JSC::Identifier& propertyName, unsigned& attributes) const; - virtual void defineGetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction); - virtual void defineSetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* setterFunction); + virtual void defineGetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction, unsigned attributes); + virtual void defineSetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* setterFunction, unsigned attributes); + virtual bool defineOwnProperty(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&, bool shouldThrow); virtual JSC::JSValue lookupGetter(JSC::ExecState*, const JSC::Identifier& propertyName); virtual JSC::JSValue lookupSetter(JSC::ExecState*, const JSC::Identifier& propertyName); virtual JSC::JSObject* unwrappedObject(); diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDedicatedWorkerContextCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSDedicatedWorkerContextCustom.cpp index a633a42..fbee5ef 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSDedicatedWorkerContextCustom.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDedicatedWorkerContextCustom.cpp @@ -42,13 +42,6 @@ using namespace JSC; namespace WebCore { -void JSDedicatedWorkerContext::markChildren(MarkStack& markStack) -{ - Base::markChildren(markStack); - - markIfNotNull(markStack, impl()->onmessage()); -} - JSC::JSValue JSDedicatedWorkerContext::postMessage(JSC::ExecState* exec, const JSC::ArgList& args) { return handlePostMessage(exec, args, impl()); diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSEventListener.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSEventListener.cpp index d391073..48ae014 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSEventListener.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSEventListener.cpp @@ -56,7 +56,7 @@ void JSEventListener::markJSFunction(MarkStack& markStack) markStack.append(m_globalObject); } -void JSEventListener::handleEvent(Event* event, bool isWindowEvent) +void JSEventListener::handleEvent(Event* event) { JSLock lock(SilenceAssertionsOnly); @@ -106,19 +106,10 @@ void JSEventListener::handleEvent(Event* event, bool isWindowEvent) JSGlobalData* globalData = globalObject->globalData(); DynamicGlobalObjectScope globalObjectScope(exec, globalData->dynamicGlobalObject ? globalData->dynamicGlobalObject : globalObject); - JSValue retval; - if (handleEventFunction) { - globalData->timeoutChecker.start(); - retval = call(exec, handleEventFunction, callType, callData, jsFunction, args); - } else { - JSValue thisValue; - if (isWindowEvent) - thisValue = globalObject->toThisObject(exec); - else - thisValue = toJS(exec, globalObject, event->currentTarget()); - globalData->timeoutChecker.start(); - retval = call(exec, jsFunction, callType, callData, thisValue, args); - } + globalData->timeoutChecker.start(); + JSValue retval = handleEventFunction + ? call(exec, handleEventFunction, callType, callData, jsFunction, args) + : call(exec, jsFunction, callType, callData, toJS(exec, globalObject, event->currentTarget()), args); globalData->timeoutChecker.stop(); globalObject->setCurrentEvent(savedEvent); diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSEventListener.h b/src/3rdparty/webkit/WebCore/bindings/js/JSEventListener.h index 92f0c41..91ceff7 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSEventListener.h +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSEventListener.h @@ -53,7 +53,7 @@ namespace WebCore { private: virtual void markJSFunction(JSC::MarkStack&); - virtual void handleEvent(Event*, bool isWindowEvent); + virtual void handleEvent(Event*); virtual bool reportError(const String& message, const String& url, int lineNumber); virtual bool virtualisAttribute() const; void clearJSFunctionInline(); diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSEventSourceCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSEventSourceCustom.cpp index deebcb9..d757ef6 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSEventSourceCustom.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSEventSourceCustom.cpp @@ -43,23 +43,6 @@ using namespace JSC; namespace WebCore { -void JSEventSource::markChildren(MarkStack& markStack) -{ - DOMObject::markChildren(markStack); - - markIfNotNull(markStack, m_impl->onopen()); - markIfNotNull(markStack, m_impl->onmessage()); - markIfNotNull(markStack, m_impl->onerror()); - - typedef EventSource::EventListenersMap EventListenersMap; - typedef EventSource::ListenerVector ListenerVector; - EventListenersMap& eventListeners = m_impl->eventListeners(); - for (EventListenersMap::iterator mapIter = eventListeners.begin(); mapIter != eventListeners.end(); ++mapIter) { - for (ListenerVector::iterator vecIter = mapIter->second.begin(); vecIter != mapIter->second.end(); ++vecIter) - (*vecIter)->markJSFunction(markStack); - } -} - JSValue JSEventSource::addEventListener(ExecState* exec, const ArgList& args) { JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext()); diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSGeolocationCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSGeolocationCustom.cpp index 10f8bd5..530b89b 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSGeolocationCustom.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSGeolocationCustom.cpp @@ -100,20 +100,34 @@ static PassRefPtr<PositionOptions> createPositionOptions(ExecState* exec, JSValu if (exec->hadException()) return 0; if (!timeoutValue.isUndefined()) { - // Wrap to int32 and force non-negative to match behavior of window.setTimeout. - options->setTimeout(max(0, timeoutValue.toInt32(exec))); + double timeoutNumber = timeoutValue.toNumber(exec); if (exec->hadException()) return 0; + // If the value is positive infinity, there's nothing to do. + if (!(isinf(timeoutNumber) && (timeoutNumber > 0))) { + // Wrap to int32 and force non-negative to match behavior of window.setTimeout. + options->setTimeout(max(0, timeoutValue.toInt32(exec))); + if (exec->hadException()) + return 0; + } } JSValue maximumAgeValue = object->get(exec, Identifier(exec, "maximumAge")); if (exec->hadException()) return 0; if (!maximumAgeValue.isUndefined()) { - // Wrap to int32 and force non-negative to match behavior of window.setTimeout. - options->setMaximumAge(max(0, maximumAgeValue.toInt32(exec))); + double maximumAgeNumber = maximumAgeValue.toNumber(exec); if (exec->hadException()) return 0; + if (isinf(maximumAgeNumber) && (maximumAgeNumber > 0)) { + // If the value is positive infinity, clear maximumAge. + options->clearMaximumAge(); + } else { + // Wrap to int32 and force non-negative to match behavior of window.setTimeout. + options->setMaximumAge(max(0, maximumAgeValue.toInt32(exec))); + if (exec->hadException()) + return 0; + } } return options.release(); diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLCollectionCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLCollectionCustom.cpp index dd9af74..8ffddf7 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLCollectionCustom.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLCollectionCustom.cpp @@ -23,12 +23,13 @@ #include "AtomicString.h" #include "HTMLCollection.h" #include "HTMLOptionsCollection.h" +#include "JSDOMBinding.h" #include "JSHTMLAllCollection.h" #include "JSHTMLOptionsCollection.h" -#include "JSNamedNodesCollection.h" #include "JSNode.h" +#include "JSNodeList.h" #include "Node.h" -#include "JSDOMBinding.h" +#include "StaticNodeList.h" #include <wtf/Vector.h> using namespace JSC; @@ -42,11 +43,13 @@ static JSValue getNamedItems(ExecState* exec, JSHTMLCollection* collection, cons if (namedItems.isEmpty()) return jsUndefined(); - if (namedItems.size() == 1) return toJS(exec, collection->globalObject(), namedItems[0].get()); - return new (exec) JSNamedNodesCollection(exec, collection->globalObject(), namedItems); + // FIXME: HTML5 specifies that this should be a DynamicNodeList. + // FIXME: HTML5 specifies that non-HTMLOptionsCollection collections should return + // the first matching item instead of a NodeList. + return toJS(exec, collection->globalObject(), StaticNodeList::adopt(namedItems).get()); } // HTMLCollections are strange objects, they support both get and call, diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLFormElementCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLFormElementCustom.cpp index ffa2d57..de9ec4a 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLFormElementCustom.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLFormElementCustom.cpp @@ -30,7 +30,8 @@ #include "HTMLCollection.h" #include "HTMLFormElement.h" #include "JSDOMWindowCustom.h" -#include "JSNamedNodesCollection.h" +#include "JSNodeList.h" +#include "StaticNodeList.h" using namespace JSC; @@ -47,15 +48,17 @@ JSValue JSHTMLFormElement::nameGetter(ExecState* exec, const Identifier& propert { JSHTMLElement* jsForm = static_cast<JSHTMLFormElement*>(asObject(slot.slotBase())); HTMLFormElement* form = static_cast<HTMLFormElement*>(jsForm->impl()); - + Vector<RefPtr<Node> > namedItems; form->getNamedElements(propertyName, namedItems); + if (namedItems.isEmpty()) + return jsUndefined(); if (namedItems.size() == 1) return toJS(exec, namedItems[0].get()); - if (namedItems.size() > 1) - return new (exec) JSNamedNodesCollection(exec, jsForm->globalObject(), namedItems); - return jsUndefined(); + + // FIXME: HTML5 specifies that this should be a RadioNodeList. + return toJS(exec, jsForm->globalObject(), StaticNodeList::adopt(namedItems).get()); } JSValue JSHTMLFormElement::submit(ExecState* exec, const ArgList&) diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSLocationCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSLocationCustom.cpp index ef58349..aecec5e 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSLocationCustom.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSLocationCustom.cpp @@ -182,11 +182,11 @@ void JSLocation::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propert Base::getOwnPropertyNames(exec, propertyNames); } -void JSLocation::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunction) +void JSLocation::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes) { if (propertyName == exec->propertyNames().toString || propertyName == exec->propertyNames().valueOf) return; - Base::defineGetter(exec, propertyName, getterFunction); + Base::defineGetter(exec, propertyName, getterFunction, attributes); } static void navigateIfAllowed(ExecState* exec, Frame* frame, const KURL& url, bool lockHistory, bool lockBackForwardList) @@ -204,13 +204,13 @@ void JSLocation::setHref(ExecState* exec, JSValue value) Frame* frame = impl()->frame(); ASSERT(frame); - if (!shouldAllowNavigation(exec, frame)) - return; - KURL url = completeURL(exec, value.toString(exec)); if (url.isNull()) return; + if (!shouldAllowNavigation(exec, frame)) + return; + navigateIfAllowed(exec, frame, url, !frame->script()->anyPageIsProcessingUserGesture(), false); } @@ -308,13 +308,13 @@ JSValue JSLocation::replace(ExecState* exec, const ArgList& args) if (!frame) return jsUndefined(); - if (!shouldAllowNavigation(exec, frame)) - return jsUndefined(); - KURL url = completeURL(exec, args.at(0).toString(exec)); if (url.isNull()) return jsUndefined(); + if (!shouldAllowNavigation(exec, frame)) + return jsUndefined(); + navigateIfAllowed(exec, frame, url, true, true); return jsUndefined(); } @@ -336,13 +336,13 @@ JSValue JSLocation::assign(ExecState* exec, const ArgList& args) if (!frame) return jsUndefined(); - if (!shouldAllowNavigation(exec, frame)) - return jsUndefined(); - KURL url = completeURL(exec, args.at(0).toString(exec)); if (url.isNull()) return jsUndefined(); + if (!shouldAllowNavigation(exec, frame)) + return jsUndefined(); + // We want a new history item if this JS was called via a user gesture navigateIfAllowed(exec, frame, url, !frame->script()->anyPageIsProcessingUserGesture(), false); return jsUndefined(); @@ -362,11 +362,11 @@ bool JSLocationPrototype::putDelegate(ExecState* exec, const Identifier& propert return (propertyName == exec->propertyNames().toString || propertyName == exec->propertyNames().valueOf); } -void JSLocationPrototype::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunction) +void JSLocationPrototype::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes) { if (propertyName == exec->propertyNames().toString || propertyName == exec->propertyNames().valueOf) return; - Base::defineGetter(exec, propertyName, getterFunction); + Base::defineGetter(exec, propertyName, getterFunction, attributes); } } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSMessagePortCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSMessagePortCustom.cpp index 8202d1a..2084905 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSMessagePortCustom.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSMessagePortCustom.cpp @@ -45,8 +45,6 @@ void JSMessagePort::markChildren(MarkStack& markStack) { Base::markChildren(markStack); - markIfNotNull(markStack, m_impl->onmessage()); - // If we have a locally entangled port, we can directly mark it as reachable. Ports that are remotely entangled are marked in-use by markActiveObjectsForContext(). if (MessagePort* entangledPort = m_impl->locallyEntangledPort()) { DOMObject* wrapper = getCachedDOMObjectWrapper(*Heap::heap(this)->globalData(), entangledPort); @@ -54,13 +52,7 @@ void JSMessagePort::markChildren(MarkStack& markStack) markStack.append(wrapper); } - typedef MessagePort::EventListenersMap EventListenersMap; - typedef MessagePort::ListenerVector ListenerVector; - EventListenersMap& eventListeners = m_impl->eventListeners(); - for (EventListenersMap::iterator mapIter = eventListeners.begin(); mapIter != eventListeners.end(); ++mapIter) { - for (ListenerVector::iterator vecIter = mapIter->second.begin(); vecIter != mapIter->second.end(); ++vecIter) - (*vecIter)->markJSFunction(markStack); - } + m_impl->markEventListeners(markStack); } JSValue JSMessagePort::addEventListener(ExecState* exec, const ArgList& args) diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSNamedNodesCollection.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSNamedNodesCollection.cpp deleted file mode 100644 index a1cb202..0000000 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSNamedNodesCollection.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (C) 2007, 2008 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 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 "JSNamedNodesCollection.h" - -#include "AtomicString.h" -#include "Element.h" -#include "JSNode.h" -#include "NamedNodeMap.h" - -namespace WebCore { - -using namespace JSC; - -ASSERT_CLASS_FITS_IN_CELL(JSNamedNodesCollection); - -const ClassInfo JSNamedNodesCollection::s_info = { "Collection", 0, 0, 0 }; - -// Such a collection is usually very short-lived, it only exists -// for constructs like document.forms.<name>[1], -// so it shouldn't be a problem that it's storing all the nodes (with the same name). (David) -JSNamedNodesCollection::JSNamedNodesCollection(ExecState* exec, JSDOMGlobalObject* globalObject, const Vector<RefPtr<Node> >& nodes) - : DOMObjectWithGlobalPointer(getDOMStructure<JSNamedNodesCollection>(exec, globalObject), globalObject) - , m_nodes(new Vector<RefPtr<Node> >(nodes)) -{ -} - -JSValue JSNamedNodesCollection::lengthGetter(ExecState* exec, const Identifier&, const PropertySlot& slot) -{ - JSNamedNodesCollection* thisObj = static_cast<JSNamedNodesCollection*>(asObject(slot.slotBase())); - return jsNumber(exec, thisObj->m_nodes->size()); -} - -JSValue JSNamedNodesCollection::indexGetter(ExecState* exec, const Identifier&, const PropertySlot& slot) -{ - JSNamedNodesCollection *thisObj = static_cast<JSNamedNodesCollection*>(asObject(slot.slotBase())); - return toJS(exec, (*thisObj->m_nodes)[slot.index()].get()); -} - -bool JSNamedNodesCollection::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) -{ - if (propertyName == exec->propertyNames().length) { - slot.setCustom(this, lengthGetter); - return true; - } - - bool ok; - unsigned index = propertyName.toUInt32(&ok); - if (ok && index < m_nodes->size()) { - slot.setCustomIndex(this, index, indexGetter); - return true; - } - - // For IE compatibility, we need to be able to look up elements in a - // document.formName.name result by id as well as be index. - - AtomicString atomicPropertyName = propertyName; - for (unsigned i = 0; i < m_nodes->size(); i++) { - Node* node = (*m_nodes)[i].get(); - if (node->hasAttributes() && node->attributes()->id() == atomicPropertyName) { - slot.setCustomIndex(this, i, indexGetter); - return true; - } - } - - return DOMObjectWithGlobalPointer::getOwnPropertySlot(exec, propertyName, slot); -} - -bool JSNamedNodesCollection::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) -{ - if (propertyName == exec->propertyNames().length) { - descriptor.setDescriptor(jsNumber(exec, m_nodes->size()), ReadOnly | DontDelete | DontEnum); - return true; - } - - bool ok; - unsigned index = propertyName.toUInt32(&ok); - if (ok && index < m_nodes->size()) { - PropertySlot slot; - slot.setCustomIndex(this, index, indexGetter); - descriptor.setDescriptor(slot.getValue(exec, propertyName), ReadOnly | DontDelete); - return true; - } - - // For IE compatibility, we need to be able to look up elements in a - // document.formName.name result by id as well as be index. - - AtomicString atomicPropertyName = propertyName; - for (unsigned i = 0; i < m_nodes->size(); i++) { - Node* node = (*m_nodes)[i].get(); - if (node->hasAttributes() && node->attributes()->id() == atomicPropertyName) { - PropertySlot slot; - slot.setCustomIndex(this, i, indexGetter); - descriptor.setDescriptor(slot.getValue(exec, propertyName), ReadOnly | DontDelete); - return true; - } - } - - return DOMObjectWithGlobalPointer::getOwnPropertyDescriptor(exec, propertyName, descriptor); -} - -} // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSNamedNodesCollection.h b/src/3rdparty/webkit/WebCore/bindings/js/JSNamedNodesCollection.h deleted file mode 100644 index fc629d8..0000000 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSNamedNodesCollection.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2007, 2008 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 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 JSNamedNodesCollection_h -#define JSNamedNodesCollection_h - -#include "JSDOMBinding.h" -#include <wtf/Vector.h> - -namespace WebCore { - - class Node; - - // Internal class, used for the collection return by e.g. document.forms.myinput - // when multiple nodes have the same name. - class JSNamedNodesCollection : public DOMObjectWithGlobalPointer { - public: - JSNamedNodesCollection(JSC::ExecState*, JSDOMGlobalObject*, const Vector<RefPtr<Node> >&); - - virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); - virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); - - virtual const JSC::ClassInfo* classInfo() const { return &s_info; } - static const JSC::ClassInfo s_info; - - static JSC::ObjectPrototype* createPrototype(JSC::ExecState*, JSC::JSGlobalObject* globalObject) - { - return globalObject->objectPrototype(); - } - - static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) - { - return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType)); - } - - private: - static JSC::JSValue lengthGetter(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&); - static JSC::JSValue indexGetter(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&); - - OwnPtr<Vector<RefPtr<Node> > > m_nodes; - }; - -} // namespace WebCore - -#endif // JSNamedNodesCollection_h diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSNodeCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSNodeCustom.cpp index e88a9ec..025a8fa 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSNodeCustom.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSNodeCustom.cpp @@ -150,10 +150,10 @@ void JSNode::pushEventHandlerScope(ExecState*, ScopeChain&) const void JSNode::markChildren(MarkStack& markStack) { - Node* node = m_impl.get(); - Base::markChildren(markStack); - markEventListeners(markStack, node->eventListeners()); + + Node* node = m_impl.get(); + node->markEventListeners(markStack); // Nodes in the document are kept alive by JSDocument::mark, so, if we're in // the document, we need to mark the document, but we don't need to explicitly diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSQuarantinedObjectWrapper.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSQuarantinedObjectWrapper.cpp index a071a4e..30acf9b 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSQuarantinedObjectWrapper.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSQuarantinedObjectWrapper.cpp @@ -148,7 +148,7 @@ bool JSQuarantinedObjectWrapper::getOwnPropertyDescriptor(ExecState* exec, const PropertyDescriptor unwrappedDescriptor; bool result = m_unwrappedObject->getOwnPropertyDescriptor(unwrappedExecState(), identifier, unwrappedDescriptor); - if (unwrappedDescriptor.hasAccessors()) { + if (unwrappedDescriptor.isAccessorDescriptor()) { descriptor.setAccessorDescriptor(wrapOutgoingValue(unwrappedExecState(), unwrappedDescriptor.getter()), wrapOutgoingValue(unwrappedExecState(), unwrappedDescriptor.setter()), unwrappedDescriptor.attributes()); @@ -178,6 +178,33 @@ void JSQuarantinedObjectWrapper::put(ExecState* exec, unsigned identifier, JSVal transferExceptionToExecState(exec); } +bool JSQuarantinedObjectWrapper::defineOwnProperty(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool shouldThrow) +{ + if (!allowsSetProperty()) + return false; + + PropertyDescriptor wrappedDescriptor; + if (descriptor.isDataDescriptor()) { + wrappedDescriptor.setValue(prepareIncomingValue(exec, descriptor.value())); + if (wrappedDescriptor.writablePresent()) + wrappedDescriptor.setWritable(descriptor.writable()); + } else if (descriptor.isAccessorDescriptor()) { + if (descriptor.getter()) + wrappedDescriptor.setGetter(prepareIncomingValue(exec, descriptor.getter())); + if (descriptor.setter()) + wrappedDescriptor.setSetter(prepareIncomingValue(exec, descriptor.setter())); + } + if (wrappedDescriptor.enumerablePresent()) + wrappedDescriptor.setEnumerable(descriptor.enumerable()); + if (wrappedDescriptor.configurablePresent()) + wrappedDescriptor.setConfigurable(descriptor.configurable()); + + bool result = m_unwrappedObject->defineOwnProperty(unwrappedExecState(), propertyName, wrappedDescriptor, shouldThrow); + + transferExceptionToExecState(exec); + return result; +} + bool JSQuarantinedObjectWrapper::deleteProperty(ExecState* exec, const Identifier& identifier) { if (!allowsDeleteProperty()) diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSQuarantinedObjectWrapper.h b/src/3rdparty/webkit/WebCore/bindings/js/JSQuarantinedObjectWrapper.h index 37f2518..2bc6633 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSQuarantinedObjectWrapper.h +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSQuarantinedObjectWrapper.h @@ -62,6 +62,7 @@ namespace WebCore { virtual void put(JSC::ExecState*, const JSC::Identifier&, JSC::JSValue, JSC::PutPropertySlot&); virtual void put(JSC::ExecState*, unsigned, JSC::JSValue); + virtual bool defineOwnProperty(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&, bool shouldThrow); virtual bool deleteProperty(JSC::ExecState*, const JSC::Identifier&); virtual bool deleteProperty(JSC::ExecState*, unsigned); diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSSharedWorkerConstructor.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSSharedWorkerConstructor.cpp index 651805c..c05b3d2 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSSharedWorkerConstructor.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSSharedWorkerConstructor.cpp @@ -57,11 +57,14 @@ static JSObject* constructSharedWorker(ExecState* exec, JSObject* constructor, c { JSSharedWorkerConstructor* jsConstructor = static_cast<JSSharedWorkerConstructor*>(constructor); - if (args.size() < 2) + if (args.size() < 1) return throwError(exec, SyntaxError, "Not enough arguments"); UString scriptURL = args.at(0).toString(exec); - UString name = args.at(1).toString(exec); + UString name; + if (args.size() > 1) + name = args.at(1).toString(exec); + if (exec->hadException()) return 0; diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSWebSocketCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSWebSocketCustom.cpp index 401b33d..d305502 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSWebSocketCustom.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSWebSocketCustom.cpp @@ -44,14 +44,6 @@ using namespace JSC; namespace WebCore { -void JSWebSocket::markChildren(MarkStack& markStack) -{ - Base::markChildren(markStack); - if (m_impl->readyState() != WebSocket::CLOSED) - markIfNotNull(markStack, m_impl->onmessage()); - // FIXME: mark if EventListeners is registered. -} - // Custom functions JSValue JSWebSocket::send(ExecState* exec, const ArgList& args) { diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSWorkerContextCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSWorkerContextCustom.cpp index 9e54fa0..1b78264 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSWorkerContextCustom.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSWorkerContextCustom.cpp @@ -62,15 +62,7 @@ void JSWorkerContext::markChildren(MarkStack& markStack) markDOMObjectWrapper(markStack, globalData, impl()->optionalLocation()); markDOMObjectWrapper(markStack, globalData, impl()->optionalNavigator()); - markIfNotNull(markStack, impl()->onerror()); - - typedef WorkerContext::EventListenersMap EventListenersMap; - typedef WorkerContext::ListenerVector ListenerVector; - EventListenersMap& eventListeners = impl()->eventListeners(); - for (EventListenersMap::iterator mapIter = eventListeners.begin(); mapIter != eventListeners.end(); ++mapIter) { - for (ListenerVector::iterator vecIter = mapIter->second.begin(); vecIter != mapIter->second.end(); ++vecIter) - (*vecIter)->markJSFunction(markStack); - } + impl()->markEventListeners(markStack); } bool JSWorkerContext::getOwnPropertySlotDelegate(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSWorkerCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSWorkerCustom.cpp index a42a043..09b881a 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSWorkerCustom.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSWorkerCustom.cpp @@ -37,13 +37,6 @@ using namespace JSC; namespace WebCore { -void JSWorker::markChildren(MarkStack& markStack) -{ - Base::markChildren(markStack); - - markIfNotNull(markStack, static_cast<Worker*>(impl())->onmessage()); -} - JSC::JSValue JSWorker::postMessage(JSC::ExecState* exec, const JSC::ArgList& args) { return handlePostMessage(exec, args, impl()); diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp index c69f727..6d0ce57 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp @@ -59,20 +59,7 @@ void JSXMLHttpRequest::markChildren(MarkStack& markStack) markStack.append(wrapper); } - markIfNotNull(markStack, m_impl->onreadystatechange()); - markIfNotNull(markStack, m_impl->onabort()); - markIfNotNull(markStack, m_impl->onerror()); - markIfNotNull(markStack, m_impl->onload()); - markIfNotNull(markStack, m_impl->onloadstart()); - markIfNotNull(markStack, m_impl->onprogress()); - - typedef XMLHttpRequest::EventListenersMap EventListenersMap; - typedef XMLHttpRequest::ListenerVector ListenerVector; - EventListenersMap& eventListeners = m_impl->eventListeners(); - for (EventListenersMap::iterator mapIter = eventListeners.begin(); mapIter != eventListeners.end(); ++mapIter) { - for (ListenerVector::iterator vecIter = mapIter->second.begin(); vecIter != mapIter->second.end(); ++vecIter) - (*vecIter)->markJSFunction(markStack); - } + m_impl->markEventListeners(markStack); } // Custom functions diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSXMLHttpRequestUploadCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSXMLHttpRequestUploadCustom.cpp index 2f17542..c0f0c39 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSXMLHttpRequestUploadCustom.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSXMLHttpRequestUploadCustom.cpp @@ -51,19 +51,7 @@ void JSXMLHttpRequestUpload::markChildren(MarkStack& markStack) markStack.append(wrapper); } - markIfNotNull(markStack, m_impl->onabort()); - markIfNotNull(markStack, m_impl->onerror()); - markIfNotNull(markStack, m_impl->onload()); - markIfNotNull(markStack, m_impl->onloadstart()); - markIfNotNull(markStack, m_impl->onprogress()); - - typedef XMLHttpRequestUpload::EventListenersMap EventListenersMap; - typedef XMLHttpRequestUpload::ListenerVector ListenerVector; - EventListenersMap& eventListeners = m_impl->eventListeners(); - for (EventListenersMap::iterator mapIter = eventListeners.begin(); mapIter != eventListeners.end(); ++mapIter) { - for (ListenerVector::iterator vecIter = mapIter->second.begin(); vecIter != mapIter->second.end(); ++vecIter) - (*vecIter)->markJSFunction(markStack); - } + m_impl->markEventListeners(markStack); } JSValue JSXMLHttpRequestUpload::addEventListener(ExecState* exec, const ArgList& args) diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptController.cpp b/src/3rdparty/webkit/WebCore/bindings/js/ScriptController.cpp index 4b33069..dfa1602 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptController.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptController.cpp @@ -85,12 +85,7 @@ ScriptValue ScriptController::evaluate(const ScriptSourceCode& sourceCode) const SourceCode& jsSourceCode = sourceCode.jsSourceCode(); String sourceURL = jsSourceCode.provider()->url(); - if (sourceURL.isNull() && !m_XSSAuditor->canEvaluateJavaScriptURL(sourceCode.source())) { - // This JavaScript URL is not safe to be evaluated. - return JSValue(); - } - - if (!sourceURL.isNull() && !m_XSSAuditor->canEvaluate(sourceCode.source())) { + if (!m_XSSAuditor->canEvaluate(sourceCode.source())) { // This script is not safe to be evaluated. return JSValue(); } diff --git a/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorJS.pm b/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorJS.pm index 88f67f0..3523b43 100644 --- a/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorJS.pm +++ b/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorJS.pm @@ -476,7 +476,9 @@ sub GenerateHeader my $parentClassName = GetParentClassName($dataNode); my $conditional = $dataNode->extendedAttributes->{"Conditional"}; my $needsSVGContext = IsSVGTypeNeedingContextParameter($interfaceName); - + my $eventTarget = $dataNode->extendedAttributes->{"EventTarget"}; + my $needsMarkChildren = $dataNode->extendedAttributes->{"CustomMarkFunction"} || $dataNode->extendedAttributes->{"EventTarget"}; + # - Add default header template @headerContentHeader = split("\r", $headerTemplate); @@ -548,7 +550,7 @@ sub GenerateHeader } # Destructor - push(@headerContent, " virtual ~$className();\n") if (!$hasParent or $interfaceName eq "Document" or $interfaceName eq "DOMWindow"); + push(@headerContent, " virtual ~$className();\n") if (!$hasParent or $eventTarget or $interfaceName eq "Document" or $interfaceName eq "DOMWindow"); # Prototype push(@headerContent, " static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*);\n") unless ($dataNode->extendedAttributes->{"ExtendsDOMGlobalObject"}); @@ -613,8 +615,8 @@ sub GenerateHeader " }\n\n"); } - # Custom mark function - push(@headerContent, " virtual void markChildren(JSC::MarkStack&);\n\n") if $dataNode->extendedAttributes->{"CustomMarkFunction"}; + # markChildren function + push(@headerContent, " virtual void markChildren(JSC::MarkStack&);\n\n") if $needsMarkChildren; # Custom pushEventHandlerScope function push(@headerContent, " virtual void pushEventHandlerScope(JSC::ExecState*, JSC::ScopeChain&) const;\n\n") if $dataNode->extendedAttributes->{"CustomPushEventHandlerScope"}; @@ -627,6 +629,10 @@ sub GenerateHeader # Custom getPropertyNames function exists on DOMWindow push(@headerContent, " virtual void getPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&);\n") if $interfaceName eq "DOMWindow"; + + # Custom defineProperty function exists on DOMWindow + push(@headerContent, " virtual bool defineOwnProperty(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&, bool shouldThrow);\n") if $interfaceName eq "DOMWindow"; + # Custom getOwnPropertyNames function push(@headerContent, " virtual void getOwnPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&);\n") if ($dataNode->extendedAttributes->{"CustomGetPropertyNames"} || $dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasCustomIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}); @@ -634,10 +640,10 @@ sub GenerateHeader push(@headerContent, " virtual bool getPropertyAttributes(JSC::ExecState*, const JSC::Identifier&, unsigned& attributes) const;\n") if $dataNode->extendedAttributes->{"CustomGetPropertyAttributes"}; # Custom defineGetter function - push(@headerContent, " virtual void defineGetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction);\n") if $dataNode->extendedAttributes->{"CustomDefineGetter"}; + push(@headerContent, " virtual void defineGetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction, unsigned attributes);\n") if $dataNode->extendedAttributes->{"CustomDefineGetter"}; # Custom defineSetter function - push(@headerContent, " virtual void defineSetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* setterFunction);\n") if $dataNode->extendedAttributes->{"CustomDefineSetter"}; + push(@headerContent, " virtual void defineSetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* setterFunction, unsigned attributes);\n") if $dataNode->extendedAttributes->{"CustomDefineSetter"}; # Custom lookupGetter function push(@headerContent, " virtual JSC::JSValue lookupGetter(JSC::ExecState*, const JSC::Identifier& propertyName);\n") if $dataNode->extendedAttributes->{"CustomLookupGetter"}; @@ -785,7 +791,7 @@ sub GenerateHeader push(@headerContent, " static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)\n" . " {\n" . - " return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType" . ($dataNode->extendedAttributes->{"CustomMarkFunction"} ? "" : ", JSC::HasDefaultMark") . "));\n" . + " return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType" . ($needsMarkChildren ? "" : ", JSC::HasDefaultMark") . "));\n" . " }\n"); } elsif ($dataNode->extendedAttributes->{"CustomMarkFunction"}) { push(@headerContent, @@ -800,7 +806,7 @@ sub GenerateHeader } # Custom defineGetter function - push(@headerContent, " virtual void defineGetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction);\n") if $dataNode->extendedAttributes->{"CustomPrototypeDefineGetter"}; + push(@headerContent, " virtual void defineGetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction, unsigned attributes);\n") if $dataNode->extendedAttributes->{"CustomPrototypeDefineGetter"}; push(@headerContent, " ${className}Prototype(PassRefPtr<JSC::Structure> structure) : JSC::JSObject(structure) { }\n"); @@ -864,6 +870,8 @@ sub GenerateImplementation my $parentClassName = GetParentClassName($dataNode); my $conditional = $dataNode->extendedAttributes->{"Conditional"}; my $visibleClassName = GetVisibleClassName($interfaceName); + my $eventTarget = $dataNode->extendedAttributes->{"EventTarget"}; + my $needsMarkChildren = $dataNode->extendedAttributes->{"CustomMarkFunction"} || $dataNode->extendedAttributes->{"EventTarget"}; # - Add default header template @implContentHeader = split("\r", $headerTemplate); @@ -1149,17 +1157,17 @@ sub GenerateImplementation push(@implContent, "}\n\n"); # Destructor - if (!$hasParent || $interfaceName eq "DOMWindow") { + if (!$hasParent || $eventTarget) { push(@implContent, "${className}::~$className()\n"); push(@implContent, "{\n"); + if ($eventTarget) { + $implIncludes{"RegisteredEventListener.h"} = 1; + push(@implContent, " impl()->invalidateEventListeners();\n"); + } + if ($interfaceName eq "Node") { - $implIncludes{"RegisteredEventListener.h"} = 1; - push(@implContent, " invalidateEventListeners(m_impl->eventListeners());\n"); - push(@implContent, " forgetDOMNode(m_impl->document(), m_impl.get());\n"); - } elsif ($interfaceName eq "DOMWindow") { - $implIncludes{"RegisteredEventListener.h"} = 1; - push(@implContent, " invalidateEventListeners(impl()->eventListeners());\n"); + push(@implContent, " forgetDOMNode(impl()->document(), impl());\n"); } else { if ($podType) { my $animatedType = $implClassName; @@ -1170,7 +1178,7 @@ sub GenerateImplementation push(@implContent, " JSSVGDynamicPODTypeWrapperCache<$podType, $animatedType>::forgetWrapper(m_impl.get());\n"); } } - push(@implContent, " forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get());\n"); + push(@implContent, " forgetDOMObject(*Heap::heap(this)->globalData(), impl());\n"); } push(@implContent, "}\n\n"); @@ -1183,6 +1191,14 @@ sub GenerateImplementation push(@implContent, "{\n forgetDOMObject(*Heap::heap(this)->globalData(), static_cast<${implClassName}*>(impl()));\n}\n\n"); } + if ($needsMarkChildren && !$dataNode->extendedAttributes->{"CustomMarkFunction"}) { + push(@implContent, "void ${className}::markChildren(MarkStack& markStack)\n"); + push(@implContent, "{\n"); + push(@implContent, " Base::markChildren(markStack);\n"); + push(@implContent, " impl()->markEventListeners(markStack);\n"); + push(@implContent, "}\n\n"); + } + if (!$dataNode->extendedAttributes->{"ExtendsDOMGlobalObject"}) { push(@implContent, "JSObject* ${className}::createPrototype(ExecState* exec, JSGlobalObject* globalObject)\n"); push(@implContent, "{\n"); diff --git a/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorV8.pm b/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorV8.pm index b3307cd..a18de49 100644 --- a/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -1003,7 +1003,12 @@ sub GenerateBatchedAttributeData # Replaceable if ($attrExt->{"Replaceable"} && !$hasCustomSetter) { $setter = "0"; - $propAttr .= "|v8::ReadOnly"; + # Handle the special case of window.top being marked as Replaceable. + # FIXME: Investigate whether we could treat window.top as replaceable + # and allow shadowing without it being a security hole. + if (!($interfaceName eq "DOMWindow" and $attrName eq "top")) { + $propAttr .= "|v8::ReadOnly"; + } } # Read only attributes diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp index 58280e3..0546014 100644 --- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp @@ -43,16 +43,10 @@ namespace Bindings { typedef QMultiHash<void*, QtInstance*> QObjectInstanceMap; static QObjectInstanceMap cachedInstances; -// Cache JSObjects -typedef QHash<QtInstance*, JSObject*> InstanceJSObjectMap; -static InstanceJSObjectMap cachedObjects; - // Derived RuntimeObject class QtRuntimeObjectImp : public RuntimeObjectImp { public: QtRuntimeObjectImp(ExecState*, PassRefPtr<Instance>); - ~QtRuntimeObjectImp(); - virtual void invalidate(); static const ClassInfo s_info; @@ -64,9 +58,6 @@ public: instance->markAggregate(markStack); } -protected: - void removeFromCache(); - private: virtual const ClassInfo* classInfo() const { return &s_info; } }; @@ -78,25 +69,6 @@ QtRuntimeObjectImp::QtRuntimeObjectImp(ExecState* exec, PassRefPtr<Instance> ins { } -QtRuntimeObjectImp::~QtRuntimeObjectImp() -{ - removeFromCache(); -} - -void QtRuntimeObjectImp::invalidate() -{ - removeFromCache(); - RuntimeObjectImp::invalidate(); -} - -void QtRuntimeObjectImp::removeFromCache() -{ - JSLock lock(SilenceAssertionsOnly); - QtInstance* key = cachedObjects.key(this); - if (key) - cachedObjects.remove(key); -} - // QtInstance QtInstance::QtInstance(QObject* o, PassRefPtr<RootObject> rootObject, QScriptEngine::ValueOwnership ownership) : Instance(rootObject) @@ -112,7 +84,6 @@ QtInstance::~QtInstance() { JSLock lock(SilenceAssertionsOnly); - cachedObjects.remove(this); cachedInstances.remove(m_hashkey); // clean up (unprotect from gc) the JSValues we've created @@ -190,16 +161,10 @@ Class* QtInstance::getClass() const return m_class; } -RuntimeObjectImp* QtInstance::createRuntimeObject(ExecState* exec) +RuntimeObjectImp* QtInstance::newRuntimeObject(ExecState* exec) { JSLock lock(SilenceAssertionsOnly); - RuntimeObjectImp* ret = static_cast<RuntimeObjectImp*>(cachedObjects.value(this)); - if (!ret) { - ret = new (exec) QtRuntimeObjectImp(exec, this); - cachedObjects.insert(this, ret); - ret = static_cast<RuntimeObjectImp*>(cachedObjects.value(this)); - } - return ret; + return new (exec) QtRuntimeObjectImp(exec, this); } void QtInstance::markAggregate(MarkStack& markStack) diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.h b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.h index c276b29..00aaa5b 100644 --- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.h +++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.h @@ -40,7 +40,7 @@ public: ~QtInstance(); virtual Class* getClass() const; - virtual RuntimeObjectImp* createRuntimeObject(ExecState*); + virtual RuntimeObjectImp* newRuntimeObject(ExecState*); virtual void begin(); virtual void end(); diff --git a/src/3rdparty/webkit/WebCore/bridge/runtime.cpp b/src/3rdparty/webkit/WebCore/bridge/runtime.cpp index 6934406..eac8586 100644 --- a/src/3rdparty/webkit/WebCore/bridge/runtime.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/runtime.cpp @@ -48,12 +48,14 @@ Array::~Array() Instance::Instance(PassRefPtr<RootObject> rootObject) : _rootObject(rootObject) + , m_runtimeObject(0) { ASSERT(_rootObject); } Instance::~Instance() { + ASSERT(!m_runtimeObject); } static KJSDidExecuteFunctionPtr s_didExecuteFunction; @@ -80,11 +82,37 @@ void Instance::end() RuntimeObjectImp* Instance::createRuntimeObject(ExecState* exec) { + ASSERT(_rootObject); + ASSERT(_rootObject->isValid()); + if (m_runtimeObject) + return m_runtimeObject; + JSLock lock(SilenceAssertionsOnly); + m_runtimeObject = newRuntimeObject(exec); + _rootObject->addRuntimeObject(m_runtimeObject); + return m_runtimeObject; +} + +RuntimeObjectImp* Instance::newRuntimeObject(ExecState* exec) +{ JSLock lock(SilenceAssertionsOnly); - return new (exec) RuntimeObjectImp(exec, this); } +void Instance::willDestroyRuntimeObject() +{ + ASSERT(_rootObject); + ASSERT(_rootObject->isValid()); + ASSERT(m_runtimeObject); + _rootObject->removeRuntimeObject(m_runtimeObject); + m_runtimeObject = 0; +} + +void Instance::willInvalidateRuntimeObject() +{ + ASSERT(m_runtimeObject); + m_runtimeObject = 0; +} + RootObject* Instance::rootObject() const { return _rootObject && _rootObject->isValid() ? _rootObject.get() : 0; diff --git a/src/3rdparty/webkit/WebCore/bridge/runtime.h b/src/3rdparty/webkit/WebCore/bridge/runtime.h index e028020..6682a97 100644 --- a/src/3rdparty/webkit/WebCore/bridge/runtime.h +++ b/src/3rdparty/webkit/WebCore/bridge/runtime.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2003, 2008, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -86,8 +86,10 @@ public: void begin(); void end(); - virtual Class *getClass() const = 0; - virtual RuntimeObjectImp* createRuntimeObject(ExecState*); + virtual Class* getClass() const = 0; + RuntimeObjectImp* createRuntimeObject(ExecState*); + void willInvalidateRuntimeObject(); + void willDestroyRuntimeObject(); // Returns false if the value was not set successfully. virtual bool setValueOfUndefinedField(ExecState*, const Identifier&, JSValue) { return false; } @@ -117,8 +119,12 @@ public: protected: virtual void virtualBegin() { } virtual void virtualEnd() { } + virtual RuntimeObjectImp* newRuntimeObject(ExecState*); RefPtr<RootObject> _rootObject; + +private: + RuntimeObjectImp* m_runtimeObject; }; class Array : public Noncopyable { diff --git a/src/3rdparty/webkit/WebCore/bridge/runtime_object.cpp b/src/3rdparty/webkit/WebCore/bridge/runtime_object.cpp index 0282411..3fd8024 100644 --- a/src/3rdparty/webkit/WebCore/bridge/runtime_object.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/runtime_object.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2003, 2008, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -28,7 +28,6 @@ #include "JSDOMBinding.h" #include "runtime_method.h" -#include "runtime_root.h" #include <runtime/Error.h> #include <runtime/ObjectPrototype.h> @@ -40,38 +39,38 @@ using namespace Bindings; const ClassInfo RuntimeObjectImp::s_info = { "RuntimeObject", 0, 0, 0 }; -RuntimeObjectImp::RuntimeObjectImp(ExecState* exec, PassRefPtr<Instance> i) +RuntimeObjectImp::RuntimeObjectImp(ExecState* exec, PassRefPtr<Instance> instance) // FIXME: deprecatedGetDOMStructure uses the prototype off of the wrong global object // We need to pass in the right global object for "i". : JSObject(deprecatedGetDOMStructure<RuntimeObjectImp>(exec)) - , instance(i) + , m_instance(instance) { - instance->rootObject()->addRuntimeObject(this); } - -RuntimeObjectImp::RuntimeObjectImp(ExecState*, PassRefPtr<Structure> structure, PassRefPtr<Instance> i) + +RuntimeObjectImp::RuntimeObjectImp(ExecState*, PassRefPtr<Structure> structure, PassRefPtr<Instance> instance) : JSObject(structure) - , instance(i) + , m_instance(instance) { - instance->rootObject()->addRuntimeObject(this); } RuntimeObjectImp::~RuntimeObjectImp() { - if (instance) - instance->rootObject()->removeRuntimeObject(this); + if (m_instance) + m_instance->willDestroyRuntimeObject(); } void RuntimeObjectImp::invalidate() { - ASSERT(instance); - instance = 0; + ASSERT(m_instance); + if (m_instance) + m_instance->willInvalidateRuntimeObject(); + m_instance = 0; } JSValue RuntimeObjectImp::fallbackObjectGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot) { RuntimeObjectImp* thisObj = static_cast<RuntimeObjectImp*>(asObject(slot.slotBase())); - RefPtr<Instance> instance = thisObj->instance; + RefPtr<Instance> instance = thisObj->m_instance; if (!instance) return throwInvalidAccessError(exec); @@ -89,7 +88,7 @@ JSValue RuntimeObjectImp::fallbackObjectGetter(ExecState* exec, const Identifier JSValue RuntimeObjectImp::fieldGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot) { RuntimeObjectImp* thisObj = static_cast<RuntimeObjectImp*>(asObject(slot.slotBase())); - RefPtr<Instance> instance = thisObj->instance; + RefPtr<Instance> instance = thisObj->m_instance; if (!instance) return throwInvalidAccessError(exec); @@ -108,7 +107,7 @@ JSValue RuntimeObjectImp::fieldGetter(ExecState* exec, const Identifier& propert JSValue RuntimeObjectImp::methodGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot) { RuntimeObjectImp* thisObj = static_cast<RuntimeObjectImp*>(asObject(slot.slotBase())); - RefPtr<Instance> instance = thisObj->instance; + RefPtr<Instance> instance = thisObj->m_instance; if (!instance) return throwInvalidAccessError(exec); @@ -126,11 +125,13 @@ JSValue RuntimeObjectImp::methodGetter(ExecState* exec, const Identifier& proper bool RuntimeObjectImp::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot) { - if (!instance) { + if (!m_instance) { throwInvalidAccessError(exec); return false; } + RefPtr<Instance> instance = m_instance; + instance->begin(); Class *aClass = instance->getClass(); @@ -169,11 +170,12 @@ bool RuntimeObjectImp::getOwnPropertySlot(ExecState *exec, const Identifier& pro bool RuntimeObjectImp::getOwnPropertyDescriptor(ExecState *exec, const Identifier& propertyName, PropertyDescriptor& descriptor) { - if (!instance) { + if (!m_instance) { throwInvalidAccessError(exec); return false; } + RefPtr<Instance> instance = m_instance; instance->begin(); Class *aClass = instance->getClass(); @@ -217,12 +219,12 @@ bool RuntimeObjectImp::getOwnPropertyDescriptor(ExecState *exec, const Identifie void RuntimeObjectImp::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) { - if (!instance) { + if (!m_instance) { throwInvalidAccessError(exec); return; } - RefPtr<Instance> protector(instance); + RefPtr<Instance> instance = m_instance; instance->begin(); // Set the value of the property. @@ -243,10 +245,11 @@ bool RuntimeObjectImp::deleteProperty(ExecState*, const Identifier&) JSValue RuntimeObjectImp::defaultValue(ExecState* exec, PreferredPrimitiveType hint) const { - if (!instance) + if (!m_instance) return throwInvalidAccessError(exec); - RefPtr<Instance> protector(instance); + RefPtr<Instance> instance = m_instance; + instance->begin(); JSValue result = instance->defaultValue(exec, hint); instance->end(); @@ -264,8 +267,13 @@ static JSValue JSC_HOST_CALL callRuntimeObject(ExecState* exec, JSObject* functi CallType RuntimeObjectImp::getCallData(CallData& callData) { - if (!instance || !instance->supportsInvokeDefaultMethod()) + if (!m_instance) + return CallTypeNone; + + RefPtr<Instance> instance = m_instance; + if (!instance->supportsInvokeDefaultMethod()) return CallTypeNone; + callData.native.function = callRuntimeObject; return CallTypeHost; } @@ -283,19 +291,26 @@ static JSObject* callRuntimeConstructor(ExecState* exec, JSObject* constructor, ConstructType RuntimeObjectImp::getConstructData(ConstructData& constructData) { - if (!instance || !instance->supportsConstruct()) + if (!m_instance) + return ConstructTypeNone; + + RefPtr<Instance> instance = m_instance; + if (!instance->supportsConstruct()) return ConstructTypeNone; + constructData.native.function = callRuntimeConstructor; return ConstructTypeHost; } void RuntimeObjectImp::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames) { - if (!instance) { + if (!m_instance) { throwInvalidAccessError(exec); return; } + RefPtr<Instance> instance = m_instance; + instance->begin(); instance->getPropertyNames(exec, propertyNames); instance->end(); diff --git a/src/3rdparty/webkit/WebCore/bridge/runtime_object.h b/src/3rdparty/webkit/WebCore/bridge/runtime_object.h index 5e8f57e..5aa02ea 100644 --- a/src/3rdparty/webkit/WebCore/bridge/runtime_object.h +++ b/src/3rdparty/webkit/WebCore/bridge/runtime_object.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2003, 2008, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -34,13 +34,12 @@ namespace JSC { class RuntimeObjectImp : public JSObject { public: RuntimeObjectImp(ExecState*, PassRefPtr<Bindings::Instance>); - virtual ~RuntimeObjectImp(); virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&); virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier& propertyName, PropertyDescriptor&); virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); - virtual bool deleteProperty(ExecState* , const Identifier& propertyName); + virtual bool deleteProperty(ExecState*, const Identifier& propertyName); virtual JSValue defaultValue(ExecState*, PreferredPrimitiveType) const; virtual CallType getCallData(CallData&); virtual ConstructType getConstructData(ConstructData&); @@ -48,8 +47,9 @@ public: virtual void getPropertyNames(ExecState*, PropertyNameArray&); virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&); - virtual void invalidate(); - Bindings::Instance* getInternalInstance() const { return instance.get(); } + void invalidate(); + + Bindings::Instance* getInternalInstance() const { return m_instance.get(); } static JSObject* throwInvalidAccessError(ExecState*); @@ -75,7 +75,7 @@ private: static JSValue fieldGetter(ExecState*, const Identifier&, const PropertySlot&); static JSValue methodGetter(ExecState*, const Identifier&, const PropertySlot&); - RefPtr<Bindings::Instance> instance; + RefPtr<Bindings::Instance> m_instance; }; } // namespace diff --git a/src/3rdparty/webkit/WebCore/css/CSSComputedStyleDeclaration.cpp b/src/3rdparty/webkit/WebCore/css/CSSComputedStyleDeclaration.cpp index debd396..2935c31 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSComputedStyleDeclaration.cpp +++ b/src/3rdparty/webkit/WebCore/css/CSSComputedStyleDeclaration.cpp @@ -1122,7 +1122,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper case CSSPropertyResize: return CSSPrimitiveValue::create(style->resize()); case CSSPropertyWebkitFontSmoothing: - return CSSPrimitiveValue::create(style->fontSmoothing()); + return CSSPrimitiveValue::create(style->fontDescription().fontSmoothing()); case CSSPropertyZIndex: if (style->hasAutoZIndex()) return CSSPrimitiveValue::createIdentifier(CSSValueAuto); diff --git a/src/3rdparty/webkit/WebCore/css/CSSParser.cpp b/src/3rdparty/webkit/WebCore/css/CSSParser.cpp index aa2be59..c46bf36 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSParser.cpp +++ b/src/3rdparty/webkit/WebCore/css/CSSParser.cpp @@ -2150,7 +2150,7 @@ PassRefPtr<CSSValue> CSSParser::parseAttr(CSSParserValueList* args) if (attrName[0] == '-') return 0; - if (document()->isHTMLDocument()) + if (document() && document()->isHTMLDocument()) attrName = attrName.lower(); return CSSPrimitiveValue::create(attrName, CSSPrimitiveValue::CSS_ATTR); diff --git a/src/3rdparty/webkit/WebCore/css/CSSPrimitiveValueMappings.h b/src/3rdparty/webkit/WebCore/css/CSSPrimitiveValueMappings.h index 70b21c4..b46322d 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSPrimitiveValueMappings.h +++ b/src/3rdparty/webkit/WebCore/css/CSSPrimitiveValueMappings.h @@ -30,6 +30,7 @@ #include "CSSPrimitiveValue.h" #include "CSSValueKeywords.h" +#include "FontSmoothingMode.h" #include "GraphicsTypes.h" #include "Path.h" #include "RenderStyleConstants.h" @@ -1798,7 +1799,7 @@ template<> inline CSSPrimitiveValue::operator EPointerEvents() const } } -template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontSmoothing smoothing) +template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontSmoothingMode smoothing) : m_type(CSS_IDENT) { switch (smoothing) { @@ -1820,7 +1821,7 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontSmoothing smoothing) m_value.ident = CSSValueAuto; } -template<> inline CSSPrimitiveValue::operator FontSmoothing() const +template<> inline CSSPrimitiveValue::operator FontSmoothingMode() const { switch (m_value.ident) { case CSSValueAuto: diff --git a/src/3rdparty/webkit/WebCore/css/CSSStyleSelector.cpp b/src/3rdparty/webkit/WebCore/css/CSSStyleSelector.cpp index d6bcd39..dc9f2e5 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSStyleSelector.cpp +++ b/src/3rdparty/webkit/WebCore/css/CSSStyleSelector.cpp @@ -1139,6 +1139,17 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl } #endif +#if ENABLE(MATHML) + static bool loadedMathMLUserAgentSheet; + if (e->isMathMLElement() && !loadedMathMLUserAgentSheet) { + // MathML rules. + loadedMathMLUserAgentSheet = true; + CSSStyleSheet* mathMLSheet = parseUASheet(mathmlUserAgentStyleSheet, sizeof(mathmlUserAgentStyleSheet)); + defaultStyle->addRulesFromSheet(mathMLSheet, screenEval()); + defaultPrintStyle->addRulesFromSheet(mathMLSheet, printEval()); + } +#endif + #if ENABLE(WML) static bool loadedWMLUserAgentSheet; if (e->isWMLElement() && !loadedWMLUserAgentSheet) { @@ -3498,14 +3509,14 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) case CSSPropertyWebkitFontSmoothing: { FontDescription fontDescription = m_style->fontDescription(); if (isInherit) - fontDescription.setFontSmoothing(m_parentStyle->fontSmoothing()); + fontDescription.setFontSmoothing(m_parentStyle->fontDescription().fontSmoothing()); else if (isInitial) fontDescription.setFontSmoothing(AutoSmoothing); else { if (!primitiveValue) return; int id = primitiveValue->getIdent(); - FontSmoothing smoothing; + FontSmoothingMode smoothing; switch (id) { case CSSValueAuto: smoothing = AutoSmoothing; diff --git a/src/3rdparty/webkit/WebCore/css/mathml.css b/src/3rdparty/webkit/WebCore/css/mathml.css new file mode 100644 index 0000000..e725d8c --- /dev/null +++ b/src/3rdparty/webkit/WebCore/css/mathml.css @@ -0,0 +1,170 @@ +@namespace "http://www.w3.org/1998/Math/MathML"; + +/* approved */ +math { + font-family: Symbol, STIXGeneral, "Times New Roman"; + display: inline-block; + padding: 0px; + margin: 0px; + text-indent: 0; + font-size: 1.1em; + vertical-align: baseline; +} +math[display="block"] { + font-family: "New Times Roman" + display: block; + text-align: center; + page-break-inside: avoid; +} + +mfrac { + vertical-align: middle; +} + +msub, msup { + display: inline-block; +} + +msub > * + * { + vertical-align: sub; + font-size: 0.75em; + line-height: 0.75em; +} + +msup > * + * { + vertical-align: super; + font-size: 0.75em; + line-height: 0.75em; +} + +msubsup > * { + margin: 0px; + padding: 0px; + vertical-align: middle; +} + +msubsup > * + * { + font-size: 0.75em; + line-height: 0.75em; +} + +munderover { + vertical-align: middle; +} + +munderover > * + *, mover > * + *, munder > * + * { + font-size: 0.75em; + line-height: 0.5625em; +} + +mrow { + line-height: 1em; + white-space: nowrap; + vertical-align: middle; +} + +mfenced > * { + vertical-align: middle; +} + +mo, mn, mi { + line-height: 0.75em; + padding: 0px; + margin: 0px; +} + +mo[mathsize="small"], mn[mathsize="small"], mi[mathsize="small"] { + font-size: 0.75em; + line-height: 0.5625em; +} + +mo[mathsize="normal"],mn[mathsize="normal"],mi[mathsize="normal"] { + font-size: 1em; + line-height: 0.75em; +} + +mo[mathsize="big"], mn[mathsize="big"], mi[mathsize="big"] { + line-height: 1.2em; + font-size: 1.5em; +} + +annotation, annotation-xml { + display:none; +} + +mphantom { + visibility: hidden; +} +merror { + outline: solid thin red; +} + +msqrt { + padding-top: 0.2em; + padding-left: 0.75em; +} + +mroot { + padding-top: 0.2em; + padding-left: 0.2em; +} + +mroot > * + * { + font-size: 0.75em; + line-height: 0.75em; + vertical-align: top; + padding-right: 0.3em; +} + +mtable { + display: inline-table; + line-height: 1.5em; + text-align: center; + vertical-align: middle; +} +mtr { + display: table-row; +} +mtd { + display: table-cell; + padding: 0 0.5ex; +} + +mtable[columnalign="left"], mtr[columnalign="left"], mtd[columnalign="left"] { + text-align: left; +} + +mtable[columnalign="right"], mtr[columnalign="right"], mtd[columnalign="right"] { + text-align: right; +} +mtable[rowalign="top"] mtd, mtable mtr[rowalign="top"] mtd, mtable mtr mtd[rowalign="top"] { + vertical-align: top; +} +mtable[rowalign="bottom"] mtd, mtable mtr[rowalign="bottom"] mtd, mtable mtr mtd[rowalign="bottom"] { + vertical-align: bottom; +} +mtable[rowalign="center"] mtd, mtable mtr[rowalign="center"] mtd, mtable mtr mtd[rowalign="center"] { + vertical-align: middle; +} +mtable[frame="solid"] { + border: solid thin; +} +mtable[frame="dashed"] { + border: dashed thin; +} +mtable[rowlines="solid"], mtable[rowlines="dashed"], mtable[columnlines="solid"], mtable[columnlines="dashed"] { + border-collapse: collapse; +} +mtable[rowlines="solid"] > mtr + mtr { + border-top: solid thin; +} +mtable[rowlines="dashed"] > mtr + mtr { + border-top: dashed thin; +} +mtable[columnlines="solid"] > mtr > mtd + mtd { + border-left: solid thin; +} +mtable[columnlines="dashed"] > mtr > mtd + mtd { + border-left: dashed thin; +} + diff --git a/src/3rdparty/webkit/WebCore/css/mediaControlsChromium.css b/src/3rdparty/webkit/WebCore/css/mediaControlsChromium.css index 0c01da2..16ff0e4 100644 --- a/src/3rdparty/webkit/WebCore/css/mediaControlsChromium.css +++ b/src/3rdparty/webkit/WebCore/css/mediaControlsChromium.css @@ -147,6 +147,7 @@ audio::-webkit-media-controls-timeline, video::-webkit-media-controls-timeline { height: 16px; border-color: rgba(255, 255, 255, 0.2); + border-style: solid; border-width: 1px; border-radius: 2px; background-color: rgba(255, 255, 255, 0.08); diff --git a/src/3rdparty/webkit/WebCore/dom/ActiveDOMObject.h b/src/3rdparty/webkit/WebCore/dom/ActiveDOMObject.h index e58d3f9..73b52d5 100644 --- a/src/3rdparty/webkit/WebCore/dom/ActiveDOMObject.h +++ b/src/3rdparty/webkit/WebCore/dom/ActiveDOMObject.h @@ -53,9 +53,6 @@ namespace WebCore { virtual void resume(); virtual void stop(); - protected: - virtual ~ActiveDOMObject(); - template<class T> void setPendingActivity(T* thisObject) { ASSERT(thisObject == this); @@ -70,6 +67,9 @@ namespace WebCore { thisObject->deref(); } + protected: + virtual ~ActiveDOMObject(); + private: ScriptExecutionContext* m_scriptExecutionContext; unsigned m_pendingActivityCount; diff --git a/src/3rdparty/webkit/WebCore/dom/CharacterData.cpp b/src/3rdparty/webkit/WebCore/dom/CharacterData.cpp index 902b7ff..3c3dc37 100644 --- a/src/3rdparty/webkit/WebCore/dom/CharacterData.cpp +++ b/src/3rdparty/webkit/WebCore/dom/CharacterData.cpp @@ -187,10 +187,8 @@ void CharacterData::dispatchModifiedEvent(StringImpl* prevValue) { if (parentNode()) parentNode()->childrenChanged(); - if (document()->hasListenerType(Document::DOMCHARACTERDATAMODIFIED_LISTENER)) { - ExceptionCode ec; - dispatchMutationEvent(eventNames().DOMCharacterDataModifiedEvent, true, 0, prevValue, m_data, ec); - } + if (document()->hasListenerType(Document::DOMCHARACTERDATAMODIFIED_LISTENER)) + dispatchEvent(MutationEvent::create(eventNames().DOMCharacterDataModifiedEvent, true, 0, prevValue, m_data)); dispatchSubtreeModifiedEvent(); } diff --git a/src/3rdparty/webkit/WebCore/dom/ContainerNode.cpp b/src/3rdparty/webkit/WebCore/dom/ContainerNode.cpp index 1ec4eb3..7274b5d 100644 --- a/src/3rdparty/webkit/WebCore/dom/ContainerNode.cpp +++ b/src/3rdparty/webkit/WebCore/dom/ContainerNode.cpp @@ -41,8 +41,8 @@ namespace WebCore { -static void dispatchChildInsertionEvents(Node*, ExceptionCode&); -static void dispatchChildRemovalEvents(Node*, ExceptionCode&); +static void dispatchChildInsertionEvents(Node*); +static void dispatchChildRemovalEvents(Node*); typedef Vector<std::pair<NodeCallback, RefPtr<Node> > > NodeCallbackQueue; static NodeCallbackQueue* s_postAttachCallbackQueue; @@ -144,7 +144,7 @@ bool ContainerNode::insertBefore(PassRefPtr<Node> newChild, Node* refChild, Exce // Dispatch the mutation events. childrenChanged(false, refChildPreviousSibling.get(), next.get(), 1); - dispatchChildInsertionEvents(child.get(), ec); + dispatchChildInsertionEvents(child.get()); // Add child to the rendering tree. if (attached() && !child->attached() && child->parent() == this) { @@ -255,7 +255,7 @@ bool ContainerNode::replaceChild(PassRefPtr<Node> newChild, Node* oldChild, Exce allowEventDispatch(); // Dispatch the mutation events - dispatchChildInsertionEvents(child.get(), ec); + dispatchChildInsertionEvents(child.get()); // Add child to the rendering tree if (attached() && !child->attached() && child->parent() == this) { @@ -287,7 +287,7 @@ static ExceptionCode willRemoveChild(Node *child) ExceptionCode ec = 0; // fire removed from document mutation events. - dispatchChildRemovalEvents(child, ec); + dispatchChildRemovalEvents(child); if (ec) return ec; @@ -480,7 +480,7 @@ bool ContainerNode::appendChild(PassRefPtr<Node> newChild, ExceptionCode& ec, bo // Dispatch the mutation events childrenChanged(false, prev.get(), 0, 1); - dispatchChildInsertionEvents(child.get(), ec); + dispatchChildInsertionEvents(child.get()); // Add child to the rendering tree if (attached() && !child->attached() && child->parent() == this) { @@ -864,7 +864,7 @@ Node *ContainerNode::childNode(unsigned index) const return n; } -static void dispatchChildInsertionEvents(Node* child, ExceptionCode& ec) +static void dispatchChildInsertionEvents(Node* child) { ASSERT(!eventDispatchForbidden()); @@ -878,25 +878,17 @@ static void dispatchChildInsertionEvents(Node* child, ExceptionCode& ec) document->incDOMTreeVersion(); - if (c->parentNode() && document->hasListenerType(Document::DOMNODEINSERTED_LISTENER)) { - ec = 0; - c->dispatchMutationEvent(eventNames().DOMNodeInsertedEvent, true, c->parentNode(), String(), String(), ec); - if (ec) - return; - } + if (c->parentNode() && document->hasListenerType(Document::DOMNODEINSERTED_LISTENER)) + c->dispatchEvent(MutationEvent::create(eventNames().DOMNodeInsertedEvent, true, c->parentNode())); // dispatch the DOMNodeInsertedIntoDocument event to all descendants if (c->inDocument() && document->hasListenerType(Document::DOMNODEINSERTEDINTODOCUMENT_LISTENER)) { - for (; c; c = c->traverseNextNode(child)) { - ec = 0; - c->dispatchMutationEvent(eventNames().DOMNodeInsertedIntoDocumentEvent, false, 0, String(), String(), ec); - if (ec) - return; - } + for (; c; c = c->traverseNextNode(child)) + c->dispatchEvent(MutationEvent::create(eventNames().DOMNodeInsertedIntoDocumentEvent, false)); } } -static void dispatchChildRemovalEvents(Node* child, ExceptionCode& ec) +static void dispatchChildRemovalEvents(Node* child) { RefPtr<Node> c = child; RefPtr<Document> document = child->document(); @@ -907,21 +899,14 @@ static void dispatchChildRemovalEvents(Node* child, ExceptionCode& ec) document->incDOMTreeVersion(); // dispatch pre-removal mutation events - if (c->parentNode() && document->hasListenerType(Document::DOMNODEREMOVED_LISTENER)) { - ec = 0; - c->dispatchMutationEvent(eventNames().DOMNodeRemovedEvent, true, c->parentNode(), String(), String(), ec); - if (ec) - return; - } + if (c->parentNode() && document->hasListenerType(Document::DOMNODEREMOVED_LISTENER)) + c->dispatchEvent(MutationEvent::create(eventNames().DOMNodeRemovedEvent, true, c->parentNode())); // dispatch the DOMNodeRemovedFromDocument event to all descendants - if (c->inDocument() && document->hasListenerType(Document::DOMNODEREMOVEDFROMDOCUMENT_LISTENER)) - for (; c; c = c->traverseNextNode(child)) { - ec = 0; - c->dispatchMutationEvent(eventNames().DOMNodeRemovedFromDocumentEvent, false, 0, String(), String(), ec); - if (ec) - return; - } + if (c->inDocument() && document->hasListenerType(Document::DOMNODEREMOVEDFROMDOCUMENT_LISTENER)) { + for (; c; c = c->traverseNextNode(child)) + c->dispatchEvent(MutationEvent::create(eventNames().DOMNodeRemovedFromDocumentEvent, false)); + } } -} +} // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/dom/Document.cpp b/src/3rdparty/webkit/WebCore/dom/Document.cpp index 1b8afe7..5422bf0 100644 --- a/src/3rdparty/webkit/WebCore/dom/Document.cpp +++ b/src/3rdparty/webkit/WebCore/dom/Document.cpp @@ -174,6 +174,12 @@ #include "WMLNames.h" #endif +#if ENABLE(MATHML) +#include "MathMLElement.h" +#include "MathMLElementFactory.h" +#include "MathMLNames.h" +#endif + #if ENABLE(XHTMLMP) #include "HTMLNoScriptElement.h" #endif @@ -803,6 +809,10 @@ PassRefPtr<Element> Document::createElement(const QualifiedName& qName, bool cre else if (isWMLDocument()) e = WMLElementFactory::createWMLElement(QualifiedName(nullAtom, qName.localName(), WMLNames::wmlNamespaceURI), this, createdByParser); #endif +#if ENABLE(MATHML) + else if (qName.namespaceURI() == MathMLNames::mathmlNamespaceURI) + e = MathMLElementFactory::createMathMLElement(qName, this, createdByParser); +#endif if (!e) e = Element::create(qName, document()); @@ -1460,9 +1470,11 @@ void Document::detach() void Document::removeAllEventListeners() { + EventTarget::removeAllEventListeners(); + if (DOMWindow* domWindow = this->domWindow()) domWindow->removeAllEventListeners(); - for (Node* node = this; node; node = node->traverseNextNode()) + for (Node* node = firstChild(); node; node = node->traverseNextNode()) node->removeAllEventListeners(); } @@ -1705,8 +1717,8 @@ void Document::implicitClose() f->animation()->resumeAnimations(this); ImageLoader::dispatchPendingLoadEvents(); - dispatchLoadEvent(); - dispatchPageTransitionEvent(EventNames().pageshowEvent, false); + dispatchWindowLoadEvent(); + dispatchWindowEvent(PageTransitionEvent::create(eventNames().pageshowEvent, false), this); if (f) f->loader()->handledOnloadEvents(); #ifdef INSTRUMENT_LAYOUT_SCHEDULING @@ -2163,7 +2175,7 @@ void Document::processHttpEquiv(const String& equiv, const String& content) FrameLoader* frameLoader = frame->loader(); if (frameLoader->shouldInterruptLoadForXFrameOptions(content, url())) { frameLoader->stopAllLoaders(); - frameLoader->scheduleHTTPRedirection(0, blankURL()); + frameLoader->scheduleLocationChange(blankURL(), String()); } } } @@ -2636,7 +2648,7 @@ bool Document::setFocusedNode(PassRefPtr<Node> newFocusedNode) // Dispatch a change event for text fields or textareas that have been edited RenderObject* r = oldFocusedNode->renderer(); if (r && r->isTextControl() && toRenderTextControl(r)->isEdited()) { - oldFocusedNode->dispatchEvent(eventNames().changeEvent, true, false); + oldFocusedNode->dispatchEvent(Event::create(eventNames().changeEvent, true, false)); r = oldFocusedNode->renderer(); if (r && r->isTextControl()) toRenderTextControl(r)->setEdited(false); @@ -2863,26 +2875,16 @@ EventListener* Document::getWindowAttributeEventListener(const AtomicString& eve return domWindow->getAttributeEventListener(eventType); } -void Document::dispatchWindowEvent(PassRefPtr<Event> event) -{ - ASSERT(!eventDispatchForbidden()); - DOMWindow* domWindow = this->domWindow(); - if (!domWindow) - return; - ExceptionCode ec; - domWindow->dispatchEvent(event, ec); -} - -void Document::dispatchWindowEvent(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg) +void Document::dispatchWindowEvent(PassRefPtr<Event> event, PassRefPtr<EventTarget> target) { ASSERT(!eventDispatchForbidden()); DOMWindow* domWindow = this->domWindow(); if (!domWindow) return; - domWindow->dispatchEvent(eventType, canBubbleArg, cancelableArg); + domWindow->dispatchEvent(event, target); } -void Document::dispatchLoadEvent() +void Document::dispatchWindowLoadEvent() { ASSERT(!eventDispatchForbidden()); DOMWindow* domWindow = this->domWindow(); @@ -2891,15 +2893,6 @@ void Document::dispatchLoadEvent() domWindow->dispatchLoadEvent(); } -void Document::dispatchPageTransitionEvent(const AtomicString& eventType, bool persisted) -{ - ASSERT(!eventDispatchForbidden()); - DOMWindow* domWindow = this->domWindow(); - if (!domWindow) - return; - domWindow->dispatchPageTransitionEvent(eventType, persisted); -} - PassRefPtr<Event> Document::createEvent(const String& eventType, ExceptionCode& ec) { if (eventType == "Event" || eventType == "Events" || eventType == "HTMLEvents") @@ -4019,10 +4012,7 @@ CollectionCache* Document::nameCollectionInfo(CollectionType type, const AtomicS void Document::finishedParsing() { setParsing(false); - - ExceptionCode ec = 0; - dispatchEvent(Event::create(eventNames().DOMContentLoadedEvent, true, false), ec); - + dispatchEvent(Event::create(eventNames().DOMContentLoadedEvent, true, false)); if (Frame* f = frame()) f->loader()->finishedParsing(); } diff --git a/src/3rdparty/webkit/WebCore/dom/Document.h b/src/3rdparty/webkit/WebCore/dom/Document.h index bb247f3..454304b 100644 --- a/src/3rdparty/webkit/WebCore/dom/Document.h +++ b/src/3rdparty/webkit/WebCore/dom/Document.h @@ -200,6 +200,49 @@ public: // DOM methods & attributes for Document + DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); + DEFINE_ATTRIBUTE_EVENT_LISTENER(change); + DEFINE_ATTRIBUTE_EVENT_LISTENER(click); + DEFINE_ATTRIBUTE_EVENT_LISTENER(contextmenu); + DEFINE_ATTRIBUTE_EVENT_LISTENER(dblclick); + DEFINE_ATTRIBUTE_EVENT_LISTENER(dragenter); + DEFINE_ATTRIBUTE_EVENT_LISTENER(dragover); + DEFINE_ATTRIBUTE_EVENT_LISTENER(dragleave); + DEFINE_ATTRIBUTE_EVENT_LISTENER(drop); + DEFINE_ATTRIBUTE_EVENT_LISTENER(dragstart); + DEFINE_ATTRIBUTE_EVENT_LISTENER(drag); + DEFINE_ATTRIBUTE_EVENT_LISTENER(dragend); + DEFINE_ATTRIBUTE_EVENT_LISTENER(input); + DEFINE_ATTRIBUTE_EVENT_LISTENER(invalid); + DEFINE_ATTRIBUTE_EVENT_LISTENER(keydown); + DEFINE_ATTRIBUTE_EVENT_LISTENER(keypress); + DEFINE_ATTRIBUTE_EVENT_LISTENER(keyup); + DEFINE_ATTRIBUTE_EVENT_LISTENER(mousedown); + DEFINE_ATTRIBUTE_EVENT_LISTENER(mousemove); + DEFINE_ATTRIBUTE_EVENT_LISTENER(mouseout); + DEFINE_ATTRIBUTE_EVENT_LISTENER(mouseover); + DEFINE_ATTRIBUTE_EVENT_LISTENER(mouseup); + DEFINE_ATTRIBUTE_EVENT_LISTENER(mousewheel); + DEFINE_ATTRIBUTE_EVENT_LISTENER(scroll); + DEFINE_ATTRIBUTE_EVENT_LISTENER(select); + DEFINE_ATTRIBUTE_EVENT_LISTENER(submit); + + DEFINE_ATTRIBUTE_EVENT_LISTENER(blur); + DEFINE_ATTRIBUTE_EVENT_LISTENER(error); + DEFINE_ATTRIBUTE_EVENT_LISTENER(focus); + DEFINE_ATTRIBUTE_EVENT_LISTENER(load); + + // WebKit extensions + DEFINE_ATTRIBUTE_EVENT_LISTENER(beforecut); + DEFINE_ATTRIBUTE_EVENT_LISTENER(cut); + DEFINE_ATTRIBUTE_EVENT_LISTENER(beforecopy); + DEFINE_ATTRIBUTE_EVENT_LISTENER(copy); + DEFINE_ATTRIBUTE_EVENT_LISTENER(beforepaste); + DEFINE_ATTRIBUTE_EVENT_LISTENER(paste); + DEFINE_ATTRIBUTE_EVENT_LISTENER(reset); + DEFINE_ATTRIBUTE_EVENT_LISTENER(search); + DEFINE_ATTRIBUTE_EVENT_LISTENER(selectstart); + DocumentType* doctype() const { return m_docType.get(); } DOMImplementation* implementation() const; @@ -547,10 +590,8 @@ public: // Helper functions for forwarding DOMWindow event related tasks to the DOMWindow if it exists. void setWindowAttributeEventListener(const AtomicString& eventType, PassRefPtr<EventListener>); EventListener* getWindowAttributeEventListener(const AtomicString& eventType); - void dispatchWindowEvent(PassRefPtr<Event>); - void dispatchWindowEvent(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg); - void dispatchLoadEvent(); - void dispatchPageTransitionEvent(const AtomicString& eventType, bool persisted); + void dispatchWindowEvent(PassRefPtr<Event>, PassRefPtr<EventTarget> = 0); + void dispatchWindowLoadEvent(); PassRefPtr<Event> createEvent(const String& eventType, ExceptionCode&); @@ -812,7 +853,7 @@ public: void setDashboardRegions(const Vector<DashboardRegionValue>&); #endif - void removeAllEventListeners(); + virtual void removeAllEventListeners(); CheckedRadioButtons& checkedRadioButtons() { return m_checkedRadioButtons; } diff --git a/src/3rdparty/webkit/WebCore/dom/Element.h b/src/3rdparty/webkit/WebCore/dom/Element.h index e7a910c..4ecf932 100644 --- a/src/3rdparty/webkit/WebCore/dom/Element.h +++ b/src/3rdparty/webkit/WebCore/dom/Element.h @@ -44,6 +44,51 @@ public: static PassRefPtr<Element> create(const QualifiedName&, Document*); virtual ~Element(); + DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); + DEFINE_ATTRIBUTE_EVENT_LISTENER(change); + DEFINE_ATTRIBUTE_EVENT_LISTENER(click); + DEFINE_ATTRIBUTE_EVENT_LISTENER(contextmenu); + DEFINE_ATTRIBUTE_EVENT_LISTENER(dblclick); + DEFINE_ATTRIBUTE_EVENT_LISTENER(dragenter); + DEFINE_ATTRIBUTE_EVENT_LISTENER(dragover); + DEFINE_ATTRIBUTE_EVENT_LISTENER(dragleave); + DEFINE_ATTRIBUTE_EVENT_LISTENER(drop); + DEFINE_ATTRIBUTE_EVENT_LISTENER(dragstart); + DEFINE_ATTRIBUTE_EVENT_LISTENER(drag); + DEFINE_ATTRIBUTE_EVENT_LISTENER(dragend); + DEFINE_ATTRIBUTE_EVENT_LISTENER(input); + DEFINE_ATTRIBUTE_EVENT_LISTENER(invalid); + DEFINE_ATTRIBUTE_EVENT_LISTENER(keydown); + DEFINE_ATTRIBUTE_EVENT_LISTENER(keypress); + DEFINE_ATTRIBUTE_EVENT_LISTENER(keyup); + DEFINE_ATTRIBUTE_EVENT_LISTENER(mousedown); + DEFINE_ATTRIBUTE_EVENT_LISTENER(mousemove); + DEFINE_ATTRIBUTE_EVENT_LISTENER(mouseout); + DEFINE_ATTRIBUTE_EVENT_LISTENER(mouseover); + DEFINE_ATTRIBUTE_EVENT_LISTENER(mouseup); + DEFINE_ATTRIBUTE_EVENT_LISTENER(mousewheel); + DEFINE_ATTRIBUTE_EVENT_LISTENER(scroll); + DEFINE_ATTRIBUTE_EVENT_LISTENER(select); + DEFINE_ATTRIBUTE_EVENT_LISTENER(submit); + + // These 4 attribute event handler attributes are overrided by HTMLBodyElement + // and HTMLFrameSetElement to forward to the DOMWindow. + DEFINE_VIRTUAL_ATTRIBUTE_EVENT_LISTENER(blur); + DEFINE_VIRTUAL_ATTRIBUTE_EVENT_LISTENER(error); + DEFINE_VIRTUAL_ATTRIBUTE_EVENT_LISTENER(focus); + DEFINE_VIRTUAL_ATTRIBUTE_EVENT_LISTENER(load); + + // WebKit extensions + DEFINE_ATTRIBUTE_EVENT_LISTENER(beforecut); + DEFINE_ATTRIBUTE_EVENT_LISTENER(cut); + DEFINE_ATTRIBUTE_EVENT_LISTENER(beforecopy); + DEFINE_ATTRIBUTE_EVENT_LISTENER(copy); + DEFINE_ATTRIBUTE_EVENT_LISTENER(beforepaste); + DEFINE_ATTRIBUTE_EVENT_LISTENER(paste); + DEFINE_ATTRIBUTE_EVENT_LISTENER(reset); + DEFINE_ATTRIBUTE_EVENT_LISTENER(search); + DEFINE_ATTRIBUTE_EVENT_LISTENER(selectstart); + const AtomicString& getIDAttribute() const; bool hasAttribute(const QualifiedName&) const; const AtomicString& getAttribute(const QualifiedName&) const; diff --git a/src/3rdparty/webkit/WebCore/dom/EventListener.h b/src/3rdparty/webkit/WebCore/dom/EventListener.h index 501c61d..6862f06 100644 --- a/src/3rdparty/webkit/WebCore/dom/EventListener.h +++ b/src/3rdparty/webkit/WebCore/dom/EventListener.h @@ -37,13 +37,14 @@ namespace WebCore { public: enum Type { JSEventListenerType, ImageEventListenerType, - InspectorDOMAgentType, + InspectorDOMAgentType, + InspectorDOMStorageResourceType, ObjCEventListenerType, ConditionEventListenerType }; virtual ~EventListener() { } virtual bool operator==(const EventListener&) = 0; - virtual void handleEvent(Event*, bool isWindowEvent = false) = 0; + virtual void handleEvent(Event*) = 0; // Return true to indicate that the error is handled. virtual bool reportError(const String& /*message*/, const String& /*url*/, int /*lineNumber*/) { return false; } virtual bool wasCreatedFromMarkup() const { return false; } @@ -68,10 +69,6 @@ namespace WebCore { Type m_type; }; -#if USE(JSC) - inline void markIfNotNull(JSC::MarkStack& markStack, EventListener* listener) { if (listener) listener->markJSFunction(markStack); } -#endif - } #endif diff --git a/src/3rdparty/webkit/WebCore/dom/EventNames.h b/src/3rdparty/webkit/WebCore/dom/EventNames.h index 382bbf7..0eb98ec 100644 --- a/src/3rdparty/webkit/WebCore/dom/EventNames.h +++ b/src/3rdparty/webkit/WebCore/dom/EventNames.h @@ -45,6 +45,7 @@ namespace WebCore { macro(copy) \ macro(cut) \ macro(dblclick) \ + macro(display) \ macro(downloading) \ macro(drag) \ macro(dragend) \ @@ -136,6 +137,8 @@ namespace WebCore { \ macro(webkitTransitionEnd) \ \ + macro(orientationchange) \ + \ // end of DOM_EVENT_NAMES_FOR_EACH class EventNames { diff --git a/src/3rdparty/webkit/WebCore/dom/EventTarget.cpp b/src/3rdparty/webkit/WebCore/dom/EventTarget.cpp index 652644f..d3b3f55 100644 --- a/src/3rdparty/webkit/WebCore/dom/EventTarget.cpp +++ b/src/3rdparty/webkit/WebCore/dom/EventTarget.cpp @@ -34,11 +34,39 @@ #include "config.h" #include "EventTarget.h" +#include "Event.h" +#include "EventException.h" +#include <wtf/StdLibExtras.h> + +using namespace WTF; + namespace WebCore { #ifndef NDEBUG static int gEventDispatchForbidden = 0; -#endif + +void forbidEventDispatch() +{ + if (!isMainThread()) + return; + ++gEventDispatchForbidden; +} + +void allowEventDispatch() +{ + if (!isMainThread()) + return; + if (gEventDispatchForbidden > 0) + --gEventDispatchForbidden; +} + +bool eventDispatchForbidden() +{ + if (!isMainThread()) + return false; + return gEventDispatchForbidden > 0; +} +#endif // NDEBUG EventTarget::~EventTarget() { @@ -125,22 +153,153 @@ Notification* EventTarget::toNotification() } #endif -#ifndef NDEBUG -void forbidEventDispatch() +bool EventTarget::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture) { - ++gEventDispatchForbidden; + EventTargetData* d = ensureEventTargetData(); + + pair<EventListenerMap::iterator, bool> result = d->eventListenerMap.add(eventType, EventListenerVector()); + EventListenerVector& entry = result.first->second; + + RegisteredEventListener registeredListener(listener, useCapture); + if (!result.second) { // pre-existing entry + if (entry.find(registeredListener) != notFound) // duplicate listener + return false; + } + + entry.append(registeredListener); + return true; } -void allowEventDispatch() +bool EventTarget::removeEventListener(const AtomicString& eventType, EventListener* listener, bool useCapture) { - if (gEventDispatchForbidden > 0) - --gEventDispatchForbidden; + EventTargetData* d = eventTargetData(); + if (!d) + return false; + + EventListenerMap::iterator result = d->eventListenerMap.find(eventType); + if (result == d->eventListenerMap.end()) + return false; + EventListenerVector& entry = result->second; + + RegisteredEventListener registeredListener(listener, useCapture); + size_t index = entry.find(registeredListener); + if (index == notFound) + return false; + + entry.remove(index); + if (!entry.size()) + d->eventListenerMap.remove(result); + + // Notify firing events planning to invoke the listener at 'index' that + // they have one less listener to invoke. + for (size_t i = 0; i < d->firingEventEndIterators.size(); ++i) { + if (eventType == *d->firingEventEndIterators[i].eventType && index < *d->firingEventEndIterators[i].value) + --*d->firingEventEndIterators[i].value; + } + + return true; } -bool eventDispatchForbidden() +bool EventTarget::setAttributeEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener) { - return gEventDispatchForbidden > 0; + clearAttributeEventListener(eventType); + if (!listener) + return false; + return addEventListener(eventType, listener, false); +} + +EventListener* EventTarget::getAttributeEventListener(const AtomicString& eventType) +{ + const EventListenerVector& entry = getEventListeners(eventType); + for (size_t i = 0; i < entry.size(); ++i) { + if (entry[i].listener->isAttribute()) + return entry[i].listener.get(); + } + return 0; +} + +bool EventTarget::clearAttributeEventListener(const AtomicString& eventType) +{ + EventListener* listener = getAttributeEventListener(eventType); + if (!listener) + return false; + return removeEventListener(eventType, listener, false); +} + +bool EventTarget::dispatchEvent(PassRefPtr<Event> event, ExceptionCode& ec) +{ + if (!event || event->type().isEmpty()) { + ec = EventException::UNSPECIFIED_EVENT_TYPE_ERR; + return false; + } + return dispatchEvent(event); +} + +bool EventTarget::dispatchEvent(PassRefPtr<Event> event) +{ + event->setTarget(this); + event->setCurrentTarget(this); + event->setEventPhase(Event::AT_TARGET); + return fireEventListeners(event.get()); +} + +bool EventTarget::fireEventListeners(Event* event) +{ + ASSERT(!eventDispatchForbidden()); + ASSERT(event && !event->type().isEmpty()); + + EventTargetData* d = eventTargetData(); + if (!d) + return true; + + EventListenerMap::iterator result = d->eventListenerMap.find(event->type()); + if (result == d->eventListenerMap.end()) + return false; + EventListenerVector& entry = result->second; + + RefPtr<EventTarget> protect = this; + + size_t end = entry.size(); + d->firingEventEndIterators.append(FiringEventEndIterator(&event->type(), &end)); + for (size_t i = 0; i < end; ++i) { + RegisteredEventListener& registeredListener = entry[i]; + if (event->eventPhase() == Event::CAPTURING_PHASE && !registeredListener.useCapture) + continue; + if (event->eventPhase() == Event::BUBBLING_PHASE && registeredListener.useCapture) + continue; + // To match Mozilla, the AT_TARGET phase fires both capturing and bubbling + // event listeners, even though that violates some versions of the DOM spec. + registeredListener.listener->handleEvent(event); + } + d->firingEventEndIterators.removeLast(); + + return !event->defaultPrevented(); +} + +const EventListenerVector& EventTarget::getEventListeners(const AtomicString& eventType) +{ + DEFINE_STATIC_LOCAL(EventListenerVector, emptyVector, ()); + + EventTargetData* d = eventTargetData(); + if (!d) + return emptyVector; + EventListenerMap::iterator it = d->eventListenerMap.find(eventType); + if (it == d->eventListenerMap.end()) + return emptyVector; + return it->second; +} + +void EventTarget::removeAllEventListeners() +{ + EventTargetData* d = eventTargetData(); + if (!d) + return; + d->eventListenerMap.clear(); + + // Notify firing events planning to invoke the listener at 'index' that + // they have one less listener to invoke. + for (size_t i = 0; i < d->firingEventEndIterators.size(); ++i) + *d->firingEventEndIterators[i].value = 0; } -#endif // NDEBUG -} // end namespace +} // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/dom/EventTarget.h b/src/3rdparty/webkit/WebCore/dom/EventTarget.h index 6bcc3fb..4499328 100644 --- a/src/3rdparty/webkit/WebCore/dom/EventTarget.h +++ b/src/3rdparty/webkit/WebCore/dom/EventTarget.h @@ -32,6 +32,9 @@ #ifndef EventTarget_h #define EventTarget_h +#include "AtomicStringHash.h" +#include "EventNames.h" +#include "RegisteredEventListener.h" #include <wtf/Forward.h> namespace WebCore { @@ -58,8 +61,31 @@ namespace WebCore { typedef int ExceptionCode; + struct FiringEventEndIterator { + FiringEventEndIterator(const AtomicString* eventType, size_t* value) + : eventType(eventType) + , value(value) + { + } + + const AtomicString* eventType; + size_t* value; + }; + typedef Vector<FiringEventEndIterator, 1> FiringEventEndIteratorVector; + + typedef Vector<RegisteredEventListener, 1> EventListenerVector; + typedef HashMap<AtomicString, EventListenerVector> EventListenerMap; + + struct EventTargetData { + EventListenerMap eventListenerMap; + FiringEventEndIteratorVector firingEventEndIterators; + }; + class EventTarget { public: + void ref() { refEventTarget(); } + void deref() { derefEventTarget(); } + virtual EventSource* toEventSource(); virtual MessagePort* toMessagePort(); virtual Node* toNode(); @@ -90,36 +116,119 @@ namespace WebCore { virtual ScriptExecutionContext* scriptExecutionContext() const = 0; - virtual void addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture) = 0; - virtual void removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture) = 0; - virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&) = 0; + virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture); + virtual bool removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture); + virtual void removeAllEventListeners(); + virtual bool dispatchEvent(PassRefPtr<Event>); + bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&); // DOM API - void ref() { refEventTarget(); } - void deref() { derefEventTarget(); } + // Used for legacy "onEvent" attribute APIs. + bool setAttributeEventListener(const AtomicString& eventType, PassRefPtr<EventListener>); + bool clearAttributeEventListener(const AtomicString& eventType); + EventListener* getAttributeEventListener(const AtomicString& eventType); + + bool hasEventListeners(); + bool hasEventListeners(const AtomicString& eventType); + const EventListenerVector& getEventListeners(const AtomicString& eventType); - // Handlers to do/undo actions on the target node before an event is dispatched to it and after the event - // has been dispatched. The data pointer is handed back by the preDispatch and passed to postDispatch. - virtual void* preDispatchEventHandler(Event*) { return 0; } - virtual void postDispatchEventHandler(Event*, void* /*dataFromPreDispatch*/) { } + bool fireEventListeners(Event*); + bool isFiringEventListeners(); + +#if USE(JSC) + void markEventListeners(JSC::MarkStack&); + void invalidateEventListeners(); +#endif protected: virtual ~EventTarget(); + + virtual EventTargetData* eventTargetData() = 0; + virtual EventTargetData* ensureEventTargetData() = 0; private: virtual void refEventTarget() = 0; virtual void derefEventTarget() = 0; }; - void forbidEventDispatch(); - void allowEventDispatch(); + #define DEFINE_ATTRIBUTE_EVENT_LISTENER(attribute) \ + EventListener* on##attribute() { return getAttributeEventListener(eventNames().attribute##Event); } \ + void setOn##attribute(PassRefPtr<EventListener> listener) { setAttributeEventListener(eventNames().attribute##Event, listener); } \ + + #define DEFINE_VIRTUAL_ATTRIBUTE_EVENT_LISTENER(attribute) \ + virtual EventListener* on##attribute() { return getAttributeEventListener(eventNames().attribute##Event); } \ + virtual void setOn##attribute(PassRefPtr<EventListener> listener) { setAttributeEventListener(eventNames().attribute##Event, listener); } \ + + #define DEFINE_WINDOW_ATTRIBUTE_EVENT_LISTENER(attribute) \ + EventListener* on##attribute() { return document()->getWindowAttributeEventListener(eventNames().attribute##Event); } \ + void setOn##attribute(PassRefPtr<EventListener> listener) { document()->setWindowAttributeEventListener(eventNames().attribute##Event, listener); } \ + + #define DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(attribute, eventName) \ + EventListener* on##attribute() { return getAttributeEventListener(eventNames().eventName##Event); } \ + void setOn##attribute(PassRefPtr<EventListener> listener) { setAttributeEventListener(eventNames().eventName##Event, listener); } \ + + #define DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(recipient, attribute) \ + EventListener* on##attribute() { return recipient ? recipient->getAttributeEventListener(eventNames().attribute##Event) : 0; } \ + void setOn##attribute(PassRefPtr<EventListener> listener) { if (recipient) recipient->setAttributeEventListener(eventNames().attribute##Event, listener); } \ #ifndef NDEBUG + void forbidEventDispatch(); + void allowEventDispatch(); bool eventDispatchForbidden(); #else inline void forbidEventDispatch() { } inline void allowEventDispatch() { } #endif -} +#if USE(JSC) + inline void EventTarget::markEventListeners(JSC::MarkStack& markStack) + { + EventTargetData* d = eventTargetData(); + if (!d) + return; + + EventListenerMap::iterator end = d->eventListenerMap.end(); + for (EventListenerMap::iterator it = d->eventListenerMap.begin(); it != end; ++it) { + EventListenerVector& entry = it->second; + for (size_t i = 0; i < entry.size(); ++i) + entry[i].listener->markJSFunction(markStack); + } + } + + inline void EventTarget::invalidateEventListeners() + { + EventTargetData* d = eventTargetData(); + if (!d) + return; + + d->eventListenerMap.clear(); + } + + inline bool EventTarget::isFiringEventListeners() + { + EventTargetData* d = eventTargetData(); + if (!d) + return false; + return d->firingEventEndIterators.size() != 0; + } + + inline bool EventTarget::hasEventListeners() + { + EventTargetData* d = eventTargetData(); + if (!d) + return false; + return !d->eventListenerMap.isEmpty(); + } + + inline bool EventTarget::hasEventListeners(const AtomicString& eventType) + { + EventTargetData* d = eventTargetData(); + if (!d) + return false; + return d->eventListenerMap.contains(eventType); + } #endif + +} // namespace WebCore + +#endif // EventTarget_h diff --git a/src/3rdparty/webkit/WebCore/dom/InputElement.cpp b/src/3rdparty/webkit/WebCore/dom/InputElement.cpp index 97793e2..96e31f4 100644 --- a/src/3rdparty/webkit/WebCore/dom/InputElement.cpp +++ b/src/3rdparty/webkit/WebCore/dom/InputElement.cpp @@ -34,7 +34,6 @@ #include "RenderTextControlSingleLine.h" #include "SelectionController.h" #include "TextIterator.h" -#include "TextBreakIterator.h" #if ENABLE(WML) #include "WMLInputElement.h" @@ -154,28 +153,10 @@ void InputElement::setValueFromRenderer(InputElementData& data, InputElement* in element->setFormControlValueMatchesRenderer(true); - // Fire the "input" DOM event - element->dispatchEvent(eventNames().inputEvent, true, false); + element->dispatchEvent(Event::create(eventNames().inputEvent, true, false)); notifyFormStateChanged(element); } -static int numCharactersInGraphemeClusters(StringImpl* s, int numGraphemeClusters) -{ - if (!s) - return 0; - - TextBreakIterator* it = characterBreakIterator(s->characters(), s->length()); - if (!it) - return 0; - - for (int i = 0; i < numGraphemeClusters; ++i) { - if (textBreakNext(it) == TextBreakDone) - return s->length(); - } - - return textBreakCurrent(it); -} - String InputElement::sanitizeValue(const InputElement* inputElement, const String& proposedValue) { return InputElement::sanitizeUserInputValue(inputElement, proposedValue, s_maximumLength); @@ -191,36 +172,15 @@ String InputElement::sanitizeUserInputValue(const InputElement* inputElement, co string.replace('\r', ' '); string.replace('\n', ' '); - StringImpl* s = string.impl(); - int newLength = numCharactersInGraphemeClusters(s, maxLength); - for (int i = 0; i < newLength; ++i) { - const UChar& current = (*s)[i]; + unsigned newLength = string.numCharactersInGraphemeClusters(maxLength); + for (unsigned i = 0; i < newLength; ++i) { + const UChar current = string[i]; if (current < ' ' && current != '\t') { newLength = i; break; } } - - if (newLength < static_cast<int>(string.length())) - return string.left(newLength); - - return string; -} - -static int numGraphemeClusters(StringImpl* s) -{ - if (!s) - return 0; - - TextBreakIterator* it = characterBreakIterator(s->characters(), s->length()); - if (!it) - return 0; - - int num = 0; - while (textBreakNext(it) != TextBreakDone) - ++num; - - return num; + return string.left(newLength); } void InputElement::handleBeforeTextInsertedEvent(InputElementData& data, InputElement* inputElement, Element* element, Event* event) @@ -231,15 +191,16 @@ void InputElement::handleBeforeTextInsertedEvent(InputElementData& data, InputEl // We use RenderTextControlSingleLine::text() instead of InputElement::value() // because they can be mismatched by sanitizeValue() in // RenderTextControlSingleLine::subtreeHasChanged() in some cases. - int oldLength = numGraphemeClusters(toRenderTextControlSingleLine(element->renderer())->text().impl()); + unsigned oldLength = toRenderTextControlSingleLine(element->renderer())->text().numGraphemeClusters(); // selection() may be a pre-edit text. - int selectionLength = numGraphemeClusters(plainText(element->document()->frame()->selection()->selection().toNormalizedRange().get()).impl()); + unsigned selectionLength = plainText(element->document()->frame()->selection()->selection().toNormalizedRange().get()).numGraphemeClusters(); ASSERT(oldLength >= selectionLength); // Selected characters will be removed by the next text event. - int baseLength = oldLength - selectionLength; - int appendableLength = data.maxLength() - baseLength; + unsigned baseLength = oldLength - selectionLength; + unsigned maxLength = static_cast<unsigned>(data.maxLength()); // maxLength() can never be negative. + unsigned appendableLength = maxLength > baseLength ? maxLength - baseLength : 0; // Truncate the inserted text to avoid violating the maxLength and other constraints. BeforeTextInsertedEvent* textEvent = static_cast<BeforeTextInsertedEvent*>(event); diff --git a/src/3rdparty/webkit/WebCore/dom/MessageEvent.h b/src/3rdparty/webkit/WebCore/dom/MessageEvent.h index 7d94689..555ed47 100644 --- a/src/3rdparty/webkit/WebCore/dom/MessageEvent.h +++ b/src/3rdparty/webkit/WebCore/dom/MessageEvent.h @@ -42,7 +42,7 @@ namespace WebCore { { return adoptRef(new MessageEvent); } - static PassRefPtr<MessageEvent> create(const String& data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source, PassOwnPtr<MessagePortArray> ports) + static PassRefPtr<MessageEvent> create(PassOwnPtr<MessagePortArray> ports, const String& data = "", const String& origin = "", const String& lastEventId = "", PassRefPtr<DOMWindow> source = 0) { return adoptRef(new MessageEvent(data, origin, lastEventId, source, ports)); } diff --git a/src/3rdparty/webkit/WebCore/dom/MessagePort.cpp b/src/3rdparty/webkit/WebCore/dom/MessagePort.cpp index bfd7932..50a0106 100644 --- a/src/3rdparty/webkit/WebCore/dom/MessagePort.cpp +++ b/src/3rdparty/webkit/WebCore/dom/MessagePort.cpp @@ -169,13 +169,7 @@ void MessagePort::dispatchMessages() OwnPtr<MessagePortChannel::EventData> eventData; while (m_entangledChannel && m_entangledChannel->tryGetMessageFromRemote(eventData)) { OwnPtr<MessagePortArray> ports = MessagePort::entanglePorts(*m_scriptExecutionContext, eventData->channels()); - RefPtr<Event> evt = MessageEvent::create(eventData->message(), "", "", 0, ports.release()); - - if (m_onMessageListener) { - evt->setTarget(this); - evt->setCurrentTarget(this); - m_onMessageListener->handleEvent(evt.get(), false); - } + RefPtr<Event> evt = MessageEvent::create(ports.release(), eventData->message()); ExceptionCode ec = 0; dispatchEvent(evt.release(), ec); @@ -183,63 +177,6 @@ void MessagePort::dispatchMessages() } } -void MessagePort::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> eventListener, bool) -{ - EventListenersMap::iterator iter = m_eventListeners.find(eventType); - if (iter == m_eventListeners.end()) { - ListenerVector listeners; - listeners.append(eventListener); - m_eventListeners.add(eventType, listeners); - } else { - ListenerVector& listeners = iter->second; - for (ListenerVector::iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) { - if (**listenerIter == *eventListener) - return; - } - - listeners.append(eventListener); - m_eventListeners.add(eventType, listeners); - } -} - -void MessagePort::removeEventListener(const AtomicString& eventType, EventListener* eventListener, bool) -{ - EventListenersMap::iterator iter = m_eventListeners.find(eventType); - if (iter == m_eventListeners.end()) - return; - - ListenerVector& listeners = iter->second; - for (ListenerVector::const_iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) { - if (**listenerIter == *eventListener) { - listeners.remove(listenerIter - listeners.begin()); - return; - } - } -} - -bool MessagePort::dispatchEvent(PassRefPtr<Event> event, ExceptionCode& ec) -{ - if (!event || event->type().isEmpty()) { - ec = EventException::UNSPECIFIED_EVENT_TYPE_ERR; - return true; - } - - ListenerVector listenersCopy = m_eventListeners.get(event->type()); - for (ListenerVector::const_iterator listenerIter = listenersCopy.begin(); listenerIter != listenersCopy.end(); ++listenerIter) { - event->setTarget(this); - event->setCurrentTarget(this); - listenerIter->get()->handleEvent(event.get(), false); - } - - return !event->defaultPrevented(); -} - -void MessagePort::setOnmessage(PassRefPtr<EventListener> eventListener) -{ - m_onMessageListener = eventListener; - start(); -} - bool MessagePort::hasPendingActivity() { // The spec says that entangled message ports should always be treated as if they have a strong reference. @@ -294,4 +231,14 @@ PassOwnPtr<MessagePortArray> MessagePort::entanglePorts(ScriptExecutionContext& return portArray; } +EventTargetData* MessagePort::eventTargetData() +{ + return &m_eventTargetData; +} + +EventTargetData* MessagePort::ensureEventTargetData() +{ + return &m_eventTargetData; +} + } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/dom/MessagePort.h b/src/3rdparty/webkit/WebCore/dom/MessagePort.h index d042bc1..e649d5d 100644 --- a/src/3rdparty/webkit/WebCore/dom/MessagePort.h +++ b/src/3rdparty/webkit/WebCore/dom/MessagePort.h @@ -29,9 +29,9 @@ #include "AtomicStringHash.h" #include "EventListener.h" +#include "EventNames.h" #include "EventTarget.h" #include "MessagePortChannel.h" - #include <wtf/HashMap.h> #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> @@ -87,21 +87,17 @@ namespace WebCore { void dispatchMessages(); - virtual void addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture); - virtual void removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture); - virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&); - - typedef Vector<RefPtr<EventListener> > ListenerVector; - typedef HashMap<AtomicString, ListenerVector> EventListenersMap; - EventListenersMap& eventListeners() { return m_eventListeners; } - using RefCounted<MessagePort>::ref; using RefCounted<MessagePort>::deref; bool hasPendingActivity(); - void setOnmessage(PassRefPtr<EventListener>); - EventListener* onmessage() const { return m_onMessageListener.get(); } + void setOnmessage(PassRefPtr<EventListener> listener) + { + setAttributeEventListener(eventNames().messageEvent, listener); + start(); + } + EventListener* onmessage() { return getAttributeEventListener(eventNames().messageEvent); } // Returns null if there is no entangled port, or if the entangled port is run by a different thread. // Returns null otherwise. @@ -114,16 +110,15 @@ namespace WebCore { virtual void refEventTarget() { ref(); } virtual void derefEventTarget() { deref(); } + virtual EventTargetData* eventTargetData(); + virtual EventTargetData* ensureEventTargetData(); OwnPtr<MessagePortChannel> m_entangledChannel; bool m_started; ScriptExecutionContext* m_scriptExecutionContext; - - RefPtr<EventListener> m_onMessageListener; - - EventListenersMap m_eventListeners; + EventTargetData m_eventTargetData; }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/dom/MessagePort.idl b/src/3rdparty/webkit/WebCore/dom/MessagePort.idl index 11ab757..a9149ec 100644 --- a/src/3rdparty/webkit/WebCore/dom/MessagePort.idl +++ b/src/3rdparty/webkit/WebCore/dom/MessagePort.idl @@ -28,6 +28,7 @@ module events { interface [ CustomMarkFunction, + EventTarget, GenerateConstructor, NoStaticTables ] MessagePort { diff --git a/src/3rdparty/webkit/WebCore/dom/MutationEvent.h b/src/3rdparty/webkit/WebCore/dom/MutationEvent.h index c5f2d1d..29b978c 100644 --- a/src/3rdparty/webkit/WebCore/dom/MutationEvent.h +++ b/src/3rdparty/webkit/WebCore/dom/MutationEvent.h @@ -41,10 +41,11 @@ namespace WebCore { { return adoptRef(new MutationEvent); } - static PassRefPtr<MutationEvent> create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<Node> relatedNode, - const String& prevValue, const String& newValue, const String& attrName, unsigned short attrChange) + + static PassRefPtr<MutationEvent> create(const AtomicString& type, bool canBubble, PassRefPtr<Node> relatedNode = 0, + const String& prevValue = String(), const String& newValue = String(), const String& attrName = String(), unsigned short attrChange = 0) { - return adoptRef(new MutationEvent(type, canBubble, cancelable, relatedNode, prevValue, newValue, attrName, attrChange)); + return adoptRef(new MutationEvent(type, canBubble, false, relatedNode, prevValue, newValue, attrName, attrChange)); } void initMutationEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<Node> relatedNode, diff --git a/src/3rdparty/webkit/WebCore/dom/Node.cpp b/src/3rdparty/webkit/WebCore/dom/Node.cpp index a26dd04..2240dd8 100644 --- a/src/3rdparty/webkit/WebCore/dom/Node.cpp +++ b/src/3rdparty/webkit/WebCore/dom/Node.cpp @@ -2342,16 +2342,6 @@ ScriptExecutionContext* Node::scriptExecutionContext() const return document(); } -const RegisteredEventListenerVector& Node::eventListeners() const -{ - if (hasRareData()) { - if (RegisteredEventListenerVector* listeners = rareData()->listeners()) - return *listeners; - } - static const RegisteredEventListenerVector* emptyListenersVector = new RegisteredEventListenerVector; - return *emptyListenersVector; -} - void Node::insertedIntoDocument() { setInDocument(true); @@ -2399,69 +2389,45 @@ static inline void updateSVGElementInstancesAfterEventListenerChange(Node* refer #endif } -void Node::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture) +bool Node::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture) { + if (!EventTarget::addEventListener(eventType, listener, useCapture)) + return false; + if (Document* document = this->document()) document->addListenerTypeIfNeeded(eventType); - - RegisteredEventListenerVector& listeners = ensureRareData()->ensureListeners(); - - // Remove existing identical listener set with identical arguments. - // The DOM2 spec says that "duplicate instances are discarded" in this case. - removeEventListener(eventType, listener.get(), useCapture); - - listeners.append(RegisteredEventListener::create(eventType, listener, useCapture)); updateSVGElementInstancesAfterEventListenerChange(this); + return true; } -void Node::removeEventListener(const AtomicString& eventType, EventListener* listener, bool useCapture) +bool Node::removeEventListener(const AtomicString& eventType, EventListener* listener, bool useCapture) { - if (!hasRareData()) - return; - - RegisteredEventListenerVector* listeners = rareData()->listeners(); - if (!listeners) - return; - - size_t size = listeners->size(); - for (size_t i = 0; i < size; ++i) { - RegisteredEventListener& r = *listeners->at(i); - if (r.eventType() == eventType && r.useCapture() == useCapture && *r.listener() == *listener) { - r.setRemoved(true); - listeners->remove(i); + if (!EventTarget::removeEventListener(eventType, listener, useCapture)) + return false; - updateSVGElementInstancesAfterEventListenerChange(this); - return; - } - } + updateSVGElementInstancesAfterEventListenerChange(this); + return true; } -void Node::removeAllEventListenersSlowCase() +EventTargetData* Node::eventTargetData() { - ASSERT(hasRareData()); - - RegisteredEventListenerVector* listeners = rareData()->listeners(); - if (!listeners) - return; + return hasRareData() ? rareData()->eventTargetData() : 0; +} - size_t size = listeners->size(); - for (size_t i = 0; i < size; ++i) - listeners->at(i)->setRemoved(true); - listeners->clear(); +EventTargetData* Node::ensureEventTargetData() +{ + return ensureRareData()->ensureEventTargetData(); } -void Node::handleLocalEvents(Event* event, bool useCapture) +void Node::handleLocalEvents(Event* event) { + if (!hasRareData() || !rareData()->eventTargetData()) + return; + if (disabled() && event->isMouseEvent()) return; - RegisteredEventListenerVector listenersCopy = eventListeners(); - size_t size = listenersCopy.size(); - for (size_t i = 0; i < size; ++i) { - const RegisteredEventListener& r = *listenersCopy[i]; - if (r.eventType() == event->type() && r.useCapture() == useCapture && !r.removed()) - r.listener()->handleEvent(event, false); - } + fireEventListeners(event); } #if ENABLE(SVG) @@ -2502,19 +2468,15 @@ static inline EventTarget* eventTargetRespectingSVGTargetRules(Node* referenceNo return referenceNode; } -bool Node::dispatchEvent(PassRefPtr<Event> e, ExceptionCode& ec) +bool Node::dispatchEvent(PassRefPtr<Event> prpEvent) { - RefPtr<Event> evt(e); - ASSERT(!eventDispatchForbidden()); - if (!evt || evt->type().isEmpty()) { - ec = EventException::UNSPECIFIED_EVENT_TYPE_ERR; - return false; - } + RefPtr<EventTarget> protect = this; + RefPtr<Event> event = prpEvent; - evt->setTarget(eventTargetRespectingSVGTargetRules(this)); + event->setTarget(eventTargetRespectingSVGTargetRules(this)); RefPtr<FrameView> view = document()->view(); - return dispatchGenericEvent(evt.release()); + return dispatchGenericEvent(event.release()); } bool Node::dispatchGenericEvent(PassRefPtr<Event> prpEvent) @@ -2567,27 +2529,22 @@ bool Node::dispatchGenericEvent(PassRefPtr<Event> prpEvent) if (targetForWindowEvents) { event->setCurrentTarget(targetForWindowEvents); - targetForWindowEvents->handleEvent(event.get(), true); + targetForWindowEvents->fireEventListeners(event.get()); if (event->propagationStopped()) goto doneDispatching; } for (size_t i = ancestors.size(); i; --i) { ContainerNode* ancestor = ancestors[i - 1].get(); event->setCurrentTarget(eventTargetRespectingSVGTargetRules(ancestor)); - ancestor->handleLocalEvents(event.get(), true); + ancestor->handleLocalEvents(event.get()); if (event->propagationStopped()) goto doneDispatching; } event->setEventPhase(Event::AT_TARGET); - // We do want capturing event listeners to be invoked here, even though - // that violates some versions of the DOM specification; Mozilla does it. event->setCurrentTarget(eventTargetRespectingSVGTargetRules(this)); - handleLocalEvents(event.get(), true); - if (event->propagationStopped()) - goto doneDispatching; - handleLocalEvents(event.get(), false); + handleLocalEvents(event.get()); if (event->propagationStopped()) goto doneDispatching; @@ -2599,13 +2556,13 @@ bool Node::dispatchGenericEvent(PassRefPtr<Event> prpEvent) for (size_t i = 0; i < size; ++i) { ContainerNode* ancestor = ancestors[i].get(); event->setCurrentTarget(eventTargetRespectingSVGTargetRules(ancestor)); - ancestor->handleLocalEvents(event.get(), false); + ancestor->handleLocalEvents(event.get()); if (event->propagationStopped() || event->cancelBubble()) goto doneDispatching; } if (targetForWindowEvents) { event->setCurrentTarget(targetForWindowEvents); - targetForWindowEvents->handleEvent(event.get(), false); + targetForWindowEvents->fireEventListeners(event.get()); if (event->propagationStopped() || event->cancelBubble()) goto doneDispatching; } @@ -2663,8 +2620,7 @@ void Node::dispatchSubtreeModifiedEvent() if (!document()->hasListenerType(Document::DOMSUBTREEMODIFIED_LISTENER)) return; - ExceptionCode ec = 0; - dispatchMutationEvent(eventNames().DOMSubtreeModifiedEvent, true, 0, String(), String(), ec); + dispatchEvent(MutationEvent::create(eventNames().DOMSubtreeModifiedEvent, true)); } void Node::dispatchUIEvent(const AtomicString& eventType, int detail, PassRefPtr<Event> underlyingEvent) @@ -2674,18 +2630,15 @@ void Node::dispatchUIEvent(const AtomicString& eventType, int detail, PassRefPtr bool cancelable = eventType == eventNames().DOMActivateEvent; - ExceptionCode ec = 0; - RefPtr<UIEvent> evt = UIEvent::create(eventType, true, cancelable, document()->defaultView(), detail); - evt->setUnderlyingEvent(underlyingEvent); - dispatchEvent(evt.release(), ec); + RefPtr<UIEvent> event = UIEvent::create(eventType, true, cancelable, document()->defaultView(), detail); + event->setUnderlyingEvent(underlyingEvent); + dispatchEvent(event.release()); } bool Node::dispatchKeyEvent(const PlatformKeyboardEvent& key) { - ASSERT(!eventDispatchForbidden()); - ExceptionCode ec = 0; RefPtr<KeyboardEvent> keyboardEvent = KeyboardEvent::create(key, document()->defaultView()); - bool r = dispatchEvent(keyboardEvent, ec); + bool r = dispatchEvent(keyboardEvent); // we want to return false if default is prevented (already taken care of) // or if the element is default-handled by the DOM. Otherwise we let it just @@ -2779,8 +2732,6 @@ bool Node::dispatchMouseEvent(const AtomicString& eventType, int button, int det bool cancelable = eventType != eventNames().mousemoveEvent; - ExceptionCode ec = 0; - bool swallowEvent = false; // Attempting to dispatch with a non-EventTarget relatedTarget causes the relatedTarget to be silently ignored. @@ -2805,7 +2756,7 @@ bool Node::dispatchMouseEvent(const AtomicString& eventType, int button, int det mouseEvent->setUnderlyingEvent(underlyingEvent.get()); mouseEvent->setAbsoluteLocation(IntPoint(pageX, pageY)); - dispatchEvent(mouseEvent, ec); + dispatchEvent(mouseEvent); bool defaultHandled = mouseEvent->defaultHandled(); bool defaultPrevented = mouseEvent->defaultPrevented(); if (defaultHandled || defaultPrevented) @@ -2823,7 +2774,7 @@ bool Node::dispatchMouseEvent(const AtomicString& eventType, int button, int det doubleClickEvent->setUnderlyingEvent(underlyingEvent.get()); if (defaultHandled) doubleClickEvent->setDefaultHandled(); - dispatchEvent(doubleClickEvent, ec); + dispatchEvent(doubleClickEvent); if (doubleClickEvent->defaultHandled() || doubleClickEvent->defaultPrevented()) swallowEvent = true; } @@ -2860,98 +2811,18 @@ void Node::dispatchWheelEvent(PlatformWheelEvent& e) we->setAbsoluteLocation(IntPoint(pos.x(), pos.y())); - ExceptionCode ec = 0; - if (!dispatchEvent(we.release(), ec)) + if (!dispatchEvent(we.release())) e.accept(); } -void Node::dispatchWebKitAnimationEvent(const AtomicString& eventType, const String& animationName, double elapsedTime) -{ - ASSERT(!eventDispatchForbidden()); - - ExceptionCode ec = 0; - dispatchEvent(WebKitAnimationEvent::create(eventType, animationName, elapsedTime), ec); -} - -void Node::dispatchWebKitTransitionEvent(const AtomicString& eventType, const String& propertyName, double elapsedTime) -{ - ASSERT(!eventDispatchForbidden()); - - ExceptionCode ec = 0; - dispatchEvent(WebKitTransitionEvent::create(eventType, propertyName, elapsedTime), ec); -} - -void Node::dispatchMutationEvent(const AtomicString& eventType, bool canBubble, PassRefPtr<Node> relatedNode, const String& prevValue, const String& newValue, ExceptionCode& ec) -{ - ASSERT(!eventDispatchForbidden()); - - dispatchEvent(MutationEvent::create(eventType, canBubble, false, relatedNode, prevValue, newValue, String(), 0), ec); -} - void Node::dispatchFocusEvent() { - dispatchEvent(eventNames().focusEvent, false, false); + dispatchEvent(Event::create(eventNames().focusEvent, false, false)); } void Node::dispatchBlurEvent() { - dispatchEvent(eventNames().blurEvent, false, false); -} - -bool Node::dispatchEvent(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg) -{ - ASSERT(!eventDispatchForbidden()); - ExceptionCode ec = 0; - return dispatchEvent(Event::create(eventType, canBubbleArg, cancelableArg), ec); -} - -void Node::dispatchProgressEvent(const AtomicString &eventType, bool lengthComputableArg, unsigned loadedArg, unsigned totalArg) -{ - ASSERT(!eventDispatchForbidden()); - ExceptionCode ec = 0; - dispatchEvent(ProgressEvent::create(eventType, lengthComputableArg, loadedArg, totalArg), ec); -} - -void Node::clearAttributeEventListener(const AtomicString& eventType) -{ - if (!hasRareData()) - return; - - RegisteredEventListenerVector* listeners = rareData()->listeners(); - if (!listeners) - return; - - size_t size = listeners->size(); - for (size_t i = 0; i < size; ++i) { - RegisteredEventListener& r = *listeners->at(i); - if (r.eventType() != eventType || !r.listener()->isAttribute()) - continue; - - r.setRemoved(true); - listeners->remove(i); - - updateSVGElementInstancesAfterEventListenerChange(this); - return; - } -} - -void Node::setAttributeEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener) -{ - clearAttributeEventListener(eventType); - if (listener) - addEventListener(eventType, listener, false); -} - -EventListener* Node::getAttributeEventListener(const AtomicString& eventType) const -{ - const RegisteredEventListenerVector& listeners = eventListeners(); - size_t size = listeners.size(); - for (size_t i = 0; i < size; ++i) { - const RegisteredEventListener& r = *listeners[i]; - if (r.eventType() == eventType && r.listener()->isAttribute()) - return r.listener(); - } - return 0; + dispatchEvent(Event::create(eventNames().blurEvent, false, false)); } bool Node::disabled() const @@ -2984,396 +2855,6 @@ void Node::defaultEventHandler(Event* event) } } -EventListener* Node::onabort() const -{ - return getAttributeEventListener(eventNames().abortEvent); -} - -void Node::setOnabort(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().abortEvent, eventListener); -} - -EventListener* Node::onblur() const -{ - return getAttributeEventListener(eventNames().blurEvent); -} - -void Node::setOnblur(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().blurEvent, eventListener); -} - -EventListener* Node::onchange() const -{ - return getAttributeEventListener(eventNames().changeEvent); -} - -void Node::setOnchange(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().changeEvent, eventListener); -} - -EventListener* Node::onclick() const -{ - return getAttributeEventListener(eventNames().clickEvent); -} - -void Node::setOnclick(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().clickEvent, eventListener); -} - -EventListener* Node::oncontextmenu() const -{ - return getAttributeEventListener(eventNames().contextmenuEvent); -} - -void Node::setOncontextmenu(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().contextmenuEvent, eventListener); -} - -EventListener* Node::ondblclick() const -{ - return getAttributeEventListener(eventNames().dblclickEvent); -} - -void Node::setOndblclick(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().dblclickEvent, eventListener); -} - -EventListener* Node::onerror() const -{ - return getAttributeEventListener(eventNames().errorEvent); -} - -void Node::setOnerror(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().errorEvent, eventListener); -} - -EventListener* Node::onfocus() const -{ - return getAttributeEventListener(eventNames().focusEvent); -} - -void Node::setOnfocus(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().focusEvent, eventListener); -} - -EventListener* Node::oninput() const -{ - return getAttributeEventListener(eventNames().inputEvent); -} - -void Node::setOninput(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().inputEvent, eventListener); -} - -EventListener* Node::oninvalid() const -{ - return getAttributeEventListener(eventNames().invalidEvent); -} - -void Node::setOninvalid(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().invalidEvent, eventListener); -} - -EventListener* Node::onkeydown() const -{ - return getAttributeEventListener(eventNames().keydownEvent); -} - -void Node::setOnkeydown(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().keydownEvent, eventListener); -} - -EventListener* Node::onkeypress() const -{ - return getAttributeEventListener(eventNames().keypressEvent); -} - -void Node::setOnkeypress(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().keypressEvent, eventListener); -} - -EventListener* Node::onkeyup() const -{ - return getAttributeEventListener(eventNames().keyupEvent); -} - -void Node::setOnkeyup(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().keyupEvent, eventListener); -} - -EventListener* Node::onload() const -{ - return getAttributeEventListener(eventNames().loadEvent); -} - -void Node::setOnload(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().loadEvent, eventListener); -} - -EventListener* Node::onmousedown() const -{ - return getAttributeEventListener(eventNames().mousedownEvent); -} - -void Node::setOnmousedown(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().mousedownEvent, eventListener); -} - -EventListener* Node::onmousemove() const -{ - return getAttributeEventListener(eventNames().mousemoveEvent); -} - -void Node::setOnmousemove(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().mousemoveEvent, eventListener); -} - -EventListener* Node::onmouseout() const -{ - return getAttributeEventListener(eventNames().mouseoutEvent); -} - -void Node::setOnmouseout(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().mouseoutEvent, eventListener); -} - -EventListener* Node::onmouseover() const -{ - return getAttributeEventListener(eventNames().mouseoverEvent); -} - -void Node::setOnmouseover(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().mouseoverEvent, eventListener); -} - -EventListener* Node::onmouseup() const -{ - return getAttributeEventListener(eventNames().mouseupEvent); -} - -void Node::setOnmouseup(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().mouseupEvent, eventListener); -} - -EventListener* Node::onmousewheel() const -{ - return getAttributeEventListener(eventNames().mousewheelEvent); -} - -void Node::setOnmousewheel(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().mousewheelEvent, eventListener); -} - -EventListener* Node::ondragenter() const -{ - return getAttributeEventListener(eventNames().dragenterEvent); -} - -void Node::setOndragenter(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().dragenterEvent, eventListener); -} - -EventListener* Node::ondragover() const -{ - return getAttributeEventListener(eventNames().dragoverEvent); -} - -void Node::setOndragover(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().dragoverEvent, eventListener); -} - -EventListener* Node::ondragleave() const -{ - return getAttributeEventListener(eventNames().dragleaveEvent); -} - -void Node::setOndragleave(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().dragleaveEvent, eventListener); -} - -EventListener* Node::ondrop() const -{ - return getAttributeEventListener(eventNames().dropEvent); -} - -void Node::setOndrop(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().dropEvent, eventListener); -} - -EventListener* Node::ondragstart() const -{ - return getAttributeEventListener(eventNames().dragstartEvent); -} - -void Node::setOndragstart(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().dragstartEvent, eventListener); -} - -EventListener* Node::ondrag() const -{ - return getAttributeEventListener(eventNames().dragEvent); -} - -void Node::setOndrag(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().dragEvent, eventListener); -} - -EventListener* Node::ondragend() const -{ - return getAttributeEventListener(eventNames().dragendEvent); -} - -void Node::setOndragend(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().dragendEvent, eventListener); -} - -EventListener* Node::onscroll() const -{ - return getAttributeEventListener(eventNames().scrollEvent); -} - -void Node::setOnscroll(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().scrollEvent, eventListener); -} - -EventListener* Node::onselect() const -{ - return getAttributeEventListener(eventNames().selectEvent); -} - -void Node::setOnselect(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().selectEvent, eventListener); -} - -EventListener* Node::onsubmit() const -{ - return getAttributeEventListener(eventNames().submitEvent); -} - -void Node::setOnsubmit(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().submitEvent, eventListener); -} - -EventListener* Node::onbeforecut() const -{ - return getAttributeEventListener(eventNames().beforecutEvent); -} - -void Node::setOnbeforecut(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().beforecutEvent, eventListener); -} - -EventListener* Node::oncut() const -{ - return getAttributeEventListener(eventNames().cutEvent); -} - -void Node::setOncut(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().cutEvent, eventListener); -} - -EventListener* Node::onbeforecopy() const -{ - return getAttributeEventListener(eventNames().beforecopyEvent); -} - -void Node::setOnbeforecopy(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().beforecopyEvent, eventListener); -} - -EventListener* Node::oncopy() const -{ - return getAttributeEventListener(eventNames().copyEvent); -} - -void Node::setOncopy(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().copyEvent, eventListener); -} - -EventListener* Node::onbeforepaste() const -{ - return getAttributeEventListener(eventNames().beforepasteEvent); -} - -void Node::setOnbeforepaste(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().beforepasteEvent, eventListener); -} - -EventListener* Node::onpaste() const -{ - return getAttributeEventListener(eventNames().pasteEvent); -} - -void Node::setOnpaste(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().pasteEvent, eventListener); -} - -EventListener* Node::onreset() const -{ - return getAttributeEventListener(eventNames().resetEvent); -} - -void Node::setOnreset(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().resetEvent, eventListener); -} - -EventListener* Node::onsearch() const -{ - return getAttributeEventListener(eventNames().searchEvent); -} - -void Node::setOnsearch(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().searchEvent, eventListener); -} - -EventListener* Node::onselectstart() const -{ - return getAttributeEventListener(eventNames().selectstartEvent); -} - -void Node::setOnselectstart(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().selectstartEvent, eventListener); -} - } // namespace WebCore #ifndef NDEBUG diff --git a/src/3rdparty/webkit/WebCore/dom/Node.h b/src/3rdparty/webkit/WebCore/dom/Node.h index af1e73b..f3bebc6 100644 --- a/src/3rdparty/webkit/WebCore/dom/Node.h +++ b/src/3rdparty/webkit/WebCore/dom/Node.h @@ -183,6 +183,13 @@ public: static bool isWMLElement() { return false; } #endif +#if ENABLE(MATHML) + virtual bool isMathMLElement() const { return false; } +#else + static bool isMathMLElement() { return false; } +#endif + + virtual bool isMediaControlElement() const { return false; } virtual bool isStyledElement() const { return false; } virtual bool isFrameOwnerElement() const { return false; } @@ -505,19 +512,19 @@ public: virtual ScriptExecutionContext* scriptExecutionContext() const; - // Used for standard DOM addEventListener / removeEventListener APIs. - virtual void addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture); - virtual void removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture); + virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture); + virtual bool removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture); - // Used for legacy "onEvent" property APIs. - void setAttributeEventListener(const AtomicString& eventType, PassRefPtr<EventListener>); - void clearAttributeEventListener(const AtomicString& eventType); - EventListener* getAttributeEventListener(const AtomicString& eventType) const; + // Handlers to do/undo actions on the target node before an event is dispatched to it and after the event + // has been dispatched. The data pointer is handed back by the preDispatch and passed to postDispatch. + virtual void* preDispatchEventHandler(Event*) { return 0; } + virtual void postDispatchEventHandler(Event*, void* /*dataFromPreDispatch*/) { } - virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&); - bool dispatchEvent(const AtomicString& eventType, bool canBubble, bool cancelable); + using EventTarget::dispatchEvent; + virtual bool dispatchEvent(PassRefPtr<Event>); - void removeAllEventListeners() { if (hasRareData()) removeAllEventListenersSlowCase(); } + bool dispatchGenericEvent(PassRefPtr<Event>); + virtual void handleLocalEvents(Event*); void dispatchSubtreeModifiedEvent(); void dispatchUIEvent(const AtomicString& eventType, int detail, PassRefPtr<Event> underlyingEvent); @@ -531,14 +538,6 @@ public: bool isSimulated, Node* relatedTarget, PassRefPtr<Event> underlyingEvent); void dispatchSimulatedMouseEvent(const AtomicString& eventType, PassRefPtr<Event> underlyingEvent); void dispatchSimulatedClick(PassRefPtr<Event> underlyingEvent, bool sendMouseEvents = false, bool showPressedLook = true); - void dispatchProgressEvent(const AtomicString& eventType, bool lengthComputableArg, unsigned loadedArg, unsigned totalArg); - void dispatchWebKitAnimationEvent(const AtomicString& eventType, const String& animationName, double elapsedTime); - void dispatchWebKitTransitionEvent(const AtomicString& eventType, const String& propertyName, double elapsedTime); - void dispatchMutationEvent(const AtomicString& type, bool canBubble, PassRefPtr<Node> relatedNode, const String& prevValue, const String& newValue, ExceptionCode&); - - bool dispatchGenericEvent(PassRefPtr<Event>); - - virtual void handleLocalEvents(Event*, bool useCapture); virtual void dispatchFocusEvent(); virtual void dispatchBlurEvent(); @@ -554,95 +553,12 @@ public: */ virtual bool disabled() const; - const RegisteredEventListenerVector& eventListeners() const; - - // These 4 attribute event handler attributes are overrided by HTMLBodyElement - // and HTMLFrameSetElement to forward to the DOMWindow. - virtual EventListener* onblur() const; - virtual void setOnblur(PassRefPtr<EventListener>); - virtual EventListener* onerror() const; - virtual void setOnerror(PassRefPtr<EventListener>); - virtual EventListener* onfocus() const; - virtual void setOnfocus(PassRefPtr<EventListener>); - virtual EventListener* onload() const; - virtual void setOnload(PassRefPtr<EventListener>); - - EventListener* onabort() const; - void setOnabort(PassRefPtr<EventListener>); - EventListener* onchange() const; - void setOnchange(PassRefPtr<EventListener>); - EventListener* onclick() const; - void setOnclick(PassRefPtr<EventListener>); - EventListener* oncontextmenu() const; - void setOncontextmenu(PassRefPtr<EventListener>); - EventListener* ondblclick() const; - void setOndblclick(PassRefPtr<EventListener>); - EventListener* ondragenter() const; - void setOndragenter(PassRefPtr<EventListener>); - EventListener* ondragover() const; - void setOndragover(PassRefPtr<EventListener>); - EventListener* ondragleave() const; - void setOndragleave(PassRefPtr<EventListener>); - EventListener* ondrop() const; - void setOndrop(PassRefPtr<EventListener>); - EventListener* ondragstart() const; - void setOndragstart(PassRefPtr<EventListener>); - EventListener* ondrag() const; - void setOndrag(PassRefPtr<EventListener>); - EventListener* ondragend() const; - void setOndragend(PassRefPtr<EventListener>); - EventListener* oninput() const; - void setOninput(PassRefPtr<EventListener>); - EventListener* oninvalid() const; - void setOninvalid(PassRefPtr<EventListener>); - EventListener* onkeydown() const; - void setOnkeydown(PassRefPtr<EventListener>); - EventListener* onkeypress() const; - void setOnkeypress(PassRefPtr<EventListener>); - EventListener* onkeyup() const; - void setOnkeyup(PassRefPtr<EventListener>); - EventListener* onmousedown() const; - void setOnmousedown(PassRefPtr<EventListener>); - EventListener* onmousemove() const; - void setOnmousemove(PassRefPtr<EventListener>); - EventListener* onmouseout() const; - void setOnmouseout(PassRefPtr<EventListener>); - EventListener* onmouseover() const; - void setOnmouseover(PassRefPtr<EventListener>); - EventListener* onmouseup() const; - void setOnmouseup(PassRefPtr<EventListener>); - EventListener* onmousewheel() const; - void setOnmousewheel(PassRefPtr<EventListener>); - EventListener* onscroll() const; - void setOnscroll(PassRefPtr<EventListener>); - EventListener* onselect() const; - void setOnselect(PassRefPtr<EventListener>); - EventListener* onsubmit() const; - void setOnsubmit(PassRefPtr<EventListener>); - - // WebKit extensions - EventListener* onbeforecut() const; - void setOnbeforecut(PassRefPtr<EventListener>); - EventListener* oncut() const; - void setOncut(PassRefPtr<EventListener>); - EventListener* onbeforecopy() const; - void setOnbeforecopy(PassRefPtr<EventListener>); - EventListener* oncopy() const; - void setOncopy(PassRefPtr<EventListener>); - EventListener* onbeforepaste() const; - void setOnbeforepaste(PassRefPtr<EventListener>); - EventListener* onpaste() const; - void setOnpaste(PassRefPtr<EventListener>); - EventListener* onreset() const; - void setOnreset(PassRefPtr<EventListener>); - EventListener* onsearch() const; - void setOnsearch(PassRefPtr<EventListener>); - EventListener* onselectstart() const; - void setOnselectstart(PassRefPtr<EventListener>); - using TreeShared<Node>::ref; using TreeShared<Node>::deref; + virtual EventTargetData* eventTargetData(); + virtual EventTargetData* ensureEventTargetData(); + protected: // CreateElementZeroRefCount is deprecated and can be removed once we convert all element // classes to start with a reference count of 1. diff --git a/src/3rdparty/webkit/WebCore/dom/Node.idl b/src/3rdparty/webkit/WebCore/dom/Node.idl index 1e31aea..45ea132 100644 --- a/src/3rdparty/webkit/WebCore/dom/Node.idl +++ b/src/3rdparty/webkit/WebCore/dom/Node.idl @@ -24,6 +24,7 @@ module core { CustomMarkFunction, CustomPushEventHandlerScope, CustomToJS, + EventTarget, GenerateConstructor, GenerateNativeConverter, InlineGetOwnPropertySlot, diff --git a/src/3rdparty/webkit/WebCore/dom/NodeRareData.h b/src/3rdparty/webkit/WebCore/dom/NodeRareData.h index 7740344..8b9e1bf 100644 --- a/src/3rdparty/webkit/WebCore/dom/NodeRareData.h +++ b/src/3rdparty/webkit/WebCore/dom/NodeRareData.h @@ -93,12 +93,12 @@ public: void setTabIndexExplicitly(short index) { m_tabIndex = index; m_tabIndexWasSetExplicitly = true; } bool tabIndexSetExplicitly() const { return m_tabIndexWasSetExplicitly; } - RegisteredEventListenerVector* listeners() { return m_eventListeners.get(); } - RegisteredEventListenerVector& ensureListeners() + EventTargetData* eventTargetData() { return m_eventTargetData.get(); } + EventTargetData* ensureEventTargetData() { - if (!m_eventListeners) - m_eventListeners.set(new RegisteredEventListenerVector); - return *m_eventListeners; + if (!m_eventTargetData) + m_eventTargetData.set(new EventTargetData); + return m_eventTargetData.get(); } bool isFocused() const { return m_isFocused; } @@ -111,7 +111,7 @@ protected: private: OwnPtr<NodeListsNodeData> m_nodeLists; - OwnPtr<RegisteredEventListenerVector > m_eventListeners; + OwnPtr<EventTargetData> m_eventTargetData; short m_tabIndex; bool m_tabIndexWasSetExplicitly : 1; bool m_isFocused : 1; diff --git a/src/3rdparty/webkit/WebCore/dom/RegisteredEventListener.cpp b/src/3rdparty/webkit/WebCore/dom/RegisteredEventListener.cpp index f257e56..e8bc594 100644 --- a/src/3rdparty/webkit/WebCore/dom/RegisteredEventListener.cpp +++ b/src/3rdparty/webkit/WebCore/dom/RegisteredEventListener.cpp @@ -27,12 +27,4 @@ namespace WebCore { -RegisteredEventListener::RegisteredEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture) - : m_eventType(eventType) - , m_listener(listener) - , m_useCapture(useCapture) - , m_removed(false) -{ -} - } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/dom/RegisteredEventListener.h b/src/3rdparty/webkit/WebCore/dom/RegisteredEventListener.h index 034f6c3..88d2279 100644 --- a/src/3rdparty/webkit/WebCore/dom/RegisteredEventListener.h +++ b/src/3rdparty/webkit/WebCore/dom/RegisteredEventListener.h @@ -29,47 +29,21 @@ namespace WebCore { - class RegisteredEventListener : public RefCounted<RegisteredEventListener> { - public: - static PassRefPtr<RegisteredEventListener> create(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture) + struct RegisteredEventListener { + RegisteredEventListener(PassRefPtr<EventListener> listener, bool useCapture) + : listener(listener) + , useCapture(useCapture) { - return adoptRef(new RegisteredEventListener(eventType, listener, useCapture)); } - const AtomicString& eventType() const { return m_eventType; } - EventListener* listener() const { return m_listener.get(); } - bool useCapture() const { return m_useCapture; } - - bool removed() const { return m_removed; } - void setRemoved(bool removed) { m_removed = removed; } - - private: - RegisteredEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture); - - AtomicString m_eventType; - RefPtr<EventListener> m_listener; - bool m_useCapture; - bool m_removed; + RefPtr<EventListener> listener; + bool useCapture; }; - - typedef Vector<RefPtr<RegisteredEventListener> > RegisteredEventListenerVector; - -#if USE(JSC) - inline void markEventListeners(JSC::MarkStack& markStack, const RegisteredEventListenerVector& listeners) - { - for (size_t i = 0; i < listeners.size(); ++i) - listeners[i]->listener()->markJSFunction(markStack); - } - - inline void invalidateEventListeners(const RegisteredEventListenerVector& listeners) + + inline bool operator==(const RegisteredEventListener& a, const RegisteredEventListener& b) { - // For efficiency's sake, we just set the "removed" bit, instead of - // actually removing the event listener. The node that owns these - // listeners is about to be deleted, anyway. - for (size_t i = 0; i < listeners.size(); ++i) - listeners[i]->setRemoved(true); + return *a.listener == *b.listener && a.useCapture == b.useCapture; } -#endif } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/generated/HTMLNames.cpp b/src/3rdparty/webkit/WebCore/generated/HTMLNames.cpp index d259fc2..4e51f54 100644 --- a/src/3rdparty/webkit/WebCore/generated/HTMLNames.cpp +++ b/src/3rdparty/webkit/WebCore/generated/HTMLNames.cpp @@ -451,6 +451,7 @@ DEFINE_GLOBAL(QualifiedName, onmouseupAttr, nullAtom, "onmouseup", xhtmlNamespac DEFINE_GLOBAL(QualifiedName, onmousewheelAttr, nullAtom, "onmousewheel", xhtmlNamespaceURI); DEFINE_GLOBAL(QualifiedName, onofflineAttr, nullAtom, "onoffline", xhtmlNamespaceURI); DEFINE_GLOBAL(QualifiedName, ononlineAttr, nullAtom, "ononline", xhtmlNamespaceURI); +DEFINE_GLOBAL(QualifiedName, onorientationchangeAttr, nullAtom, "onorientationchange", xhtmlNamespaceURI); DEFINE_GLOBAL(QualifiedName, onpagehideAttr, nullAtom, "onpagehide", xhtmlNamespaceURI); DEFINE_GLOBAL(QualifiedName, onpageshowAttr, nullAtom, "onpageshow", xhtmlNamespaceURI); DEFINE_GLOBAL(QualifiedName, onpasteAttr, nullAtom, "onpaste", xhtmlNamespaceURI); @@ -702,6 +703,7 @@ WebCore::QualifiedName** getHTMLAttrs(size_t* size) (WebCore::QualifiedName*)&onmousewheelAttr, (WebCore::QualifiedName*)&onofflineAttr, (WebCore::QualifiedName*)&ononlineAttr, + (WebCore::QualifiedName*)&onorientationchangeAttr, (WebCore::QualifiedName*)&onpagehideAttr, (WebCore::QualifiedName*)&onpageshowAttr, (WebCore::QualifiedName*)&onpasteAttr, @@ -786,7 +788,7 @@ WebCore::QualifiedName** getHTMLAttrs(size_t* size) (WebCore::QualifiedName*)&widthAttr, (WebCore::QualifiedName*)&wrapAttr, }; - *size = 246; + *size = 247; return HTMLAttr; } @@ -1206,6 +1208,7 @@ void init() const char *onmousewheelAttrString = "onmousewheel"; const char *onofflineAttrString = "onoffline"; const char *ononlineAttrString = "ononline"; + const char *onorientationchangeAttrString = "onorientationchange"; const char *onpagehideAttrString = "onpagehide"; const char *onpageshowAttrString = "onpageshow"; const char *onpasteAttrString = "onpaste"; @@ -1452,6 +1455,7 @@ void init() new ((void*)&onmousewheelAttr) QualifiedName(nullAtom, onmousewheelAttrString, nullAtom); new ((void*)&onofflineAttr) QualifiedName(nullAtom, onofflineAttrString, nullAtom); new ((void*)&ononlineAttr) QualifiedName(nullAtom, ononlineAttrString, nullAtom); + new ((void*)&onorientationchangeAttr) QualifiedName(nullAtom, onorientationchangeAttrString, nullAtom); new ((void*)&onpagehideAttr) QualifiedName(nullAtom, onpagehideAttrString, nullAtom); new ((void*)&onpageshowAttr) QualifiedName(nullAtom, onpageshowAttrString, nullAtom); new ((void*)&onpasteAttr) QualifiedName(nullAtom, onpasteAttrString, nullAtom); diff --git a/src/3rdparty/webkit/WebCore/generated/HTMLNames.h b/src/3rdparty/webkit/WebCore/generated/HTMLNames.h index a7fb532..d7d327f 100644 --- a/src/3rdparty/webkit/WebCore/generated/HTMLNames.h +++ b/src/3rdparty/webkit/WebCore/generated/HTMLNames.h @@ -322,6 +322,7 @@ extern const WebCore::QualifiedName onmouseupAttr; extern const WebCore::QualifiedName onmousewheelAttr; extern const WebCore::QualifiedName onofflineAttr; extern const WebCore::QualifiedName ononlineAttr; +extern const WebCore::QualifiedName onorientationchangeAttr; extern const WebCore::QualifiedName onpagehideAttr; extern const WebCore::QualifiedName onpageshowAttr; extern const WebCore::QualifiedName onpasteAttr; diff --git a/src/3rdparty/webkit/WebCore/generated/JSAbstractWorker.cpp b/src/3rdparty/webkit/WebCore/generated/JSAbstractWorker.cpp index 7c6452d..28e127d 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSAbstractWorker.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSAbstractWorker.cpp @@ -31,6 +31,7 @@ #include "JSDOMGlobalObject.h" #include "JSEvent.h" #include "JSEventListener.h" +#include "RegisteredEventListener.h" #include <runtime/Error.h> #include <wtf/GetPtr.h> @@ -144,7 +145,14 @@ JSAbstractWorker::JSAbstractWorker(PassRefPtr<Structure> structure, JSDOMGlobalO JSAbstractWorker::~JSAbstractWorker() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + impl()->invalidateEventListeners(); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); +} + +void JSAbstractWorker::markChildren(MarkStack& markStack) +{ + Base::markChildren(markStack); + impl()->markEventListeners(markStack); } JSObject* JSAbstractWorker::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSBarInfo.cpp b/src/3rdparty/webkit/WebCore/generated/JSBarInfo.cpp index a01207f..6ebd59c 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSBarInfo.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSBarInfo.cpp @@ -76,7 +76,7 @@ JSBarInfo::JSBarInfo(PassRefPtr<Structure> structure, JSDOMGlobalObject* globalO JSBarInfo::~JSBarInfo() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSBarInfo::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSCSSRule.cpp b/src/3rdparty/webkit/WebCore/generated/JSCSSRule.cpp index 329c7d6..fe8476b 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSCSSRule.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSCSSRule.cpp @@ -159,7 +159,7 @@ JSCSSRule::JSCSSRule(PassRefPtr<Structure> structure, JSDOMGlobalObject* globalO JSCSSRule::~JSCSSRule() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSCSSRule::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSCSSRuleList.cpp b/src/3rdparty/webkit/WebCore/generated/JSCSSRuleList.cpp index 3a71cc3..7e62e27 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSCSSRuleList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSCSSRuleList.cpp @@ -137,7 +137,7 @@ JSCSSRuleList::JSCSSRuleList(PassRefPtr<Structure> structure, JSDOMGlobalObject* JSCSSRuleList::~JSCSSRuleList() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSCSSRuleList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSCSSStyleDeclaration.cpp b/src/3rdparty/webkit/WebCore/generated/JSCSSStyleDeclaration.cpp index d0ccb9b..1a6eeb9 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSCSSStyleDeclaration.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSCSSStyleDeclaration.cpp @@ -151,7 +151,7 @@ JSCSSStyleDeclaration::JSCSSStyleDeclaration(PassRefPtr<Structure> structure, JS JSCSSStyleDeclaration::~JSCSSStyleDeclaration() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSCSSStyleDeclaration::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSCSSValue.cpp b/src/3rdparty/webkit/WebCore/generated/JSCSSValue.cpp index 58c0990..b5152cb 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSCSSValue.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSCSSValue.cpp @@ -142,7 +142,7 @@ JSCSSValue::JSCSSValue(PassRefPtr<Structure> structure, JSDOMGlobalObject* globa JSCSSValue::~JSCSSValue() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSCSSValue::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSCSSVariablesDeclaration.cpp b/src/3rdparty/webkit/WebCore/generated/JSCSSVariablesDeclaration.cpp index 419ba7d..8e2ef47 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSCSSVariablesDeclaration.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSCSSVariablesDeclaration.cpp @@ -144,7 +144,7 @@ JSCSSVariablesDeclaration::JSCSSVariablesDeclaration(PassRefPtr<Structure> struc JSCSSVariablesDeclaration::~JSCSSVariablesDeclaration() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSCSSVariablesDeclaration::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSCanvasArray.cpp b/src/3rdparty/webkit/WebCore/generated/JSCanvasArray.cpp index 685bd6d..2331bba 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSCanvasArray.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSCanvasArray.cpp @@ -93,7 +93,7 @@ JSCanvasArray::JSCanvasArray(PassRefPtr<Structure> structure, JSDOMGlobalObject* JSCanvasArray::~JSCanvasArray() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSCanvasArray::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSCanvasArrayBuffer.cpp b/src/3rdparty/webkit/WebCore/generated/JSCanvasArrayBuffer.cpp index 644e3ed..b8a9406 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSCanvasArrayBuffer.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSCanvasArrayBuffer.cpp @@ -80,7 +80,7 @@ JSCanvasArrayBuffer::JSCanvasArrayBuffer(PassRefPtr<Structure> structure, JSDOMG JSCanvasArrayBuffer::~JSCanvasArrayBuffer() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSCanvasArrayBuffer::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSCanvasGradient.cpp b/src/3rdparty/webkit/WebCore/generated/JSCanvasGradient.cpp index 70f71bc..aec7049 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSCanvasGradient.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSCanvasGradient.cpp @@ -74,7 +74,7 @@ JSCanvasGradient::JSCanvasGradient(PassRefPtr<Structure> structure, JSDOMGlobalO JSCanvasGradient::~JSCanvasGradient() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSCanvasGradient::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSCanvasPattern.cpp b/src/3rdparty/webkit/WebCore/generated/JSCanvasPattern.cpp index c806e5d..27db344 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSCanvasPattern.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSCanvasPattern.cpp @@ -61,7 +61,7 @@ JSCanvasPattern::JSCanvasPattern(PassRefPtr<Structure> structure, JSDOMGlobalObj JSCanvasPattern::~JSCanvasPattern() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSCanvasPattern::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSCanvasRenderingContext.cpp b/src/3rdparty/webkit/WebCore/generated/JSCanvasRenderingContext.cpp index aedc360..9bbdff5 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSCanvasRenderingContext.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSCanvasRenderingContext.cpp @@ -123,7 +123,7 @@ JSCanvasRenderingContext::JSCanvasRenderingContext(PassRefPtr<Structure> structu JSCanvasRenderingContext::~JSCanvasRenderingContext() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSCanvasRenderingContext::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSClientRect.cpp b/src/3rdparty/webkit/WebCore/generated/JSClientRect.cpp index ea5d079..a7f4de1 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSClientRect.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSClientRect.cpp @@ -127,7 +127,7 @@ JSClientRect::JSClientRect(PassRefPtr<Structure> structure, JSDOMGlobalObject* g JSClientRect::~JSClientRect() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSClientRect::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSClientRectList.cpp b/src/3rdparty/webkit/WebCore/generated/JSClientRectList.cpp index e840f61..1373327 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSClientRectList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSClientRectList.cpp @@ -138,7 +138,7 @@ JSClientRectList::JSClientRectList(PassRefPtr<Structure> structure, JSDOMGlobalO JSClientRectList::~JSClientRectList() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSClientRectList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSClipboard.cpp b/src/3rdparty/webkit/WebCore/generated/JSClipboard.cpp index 708c546..08b4630 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSClipboard.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSClipboard.cpp @@ -142,7 +142,7 @@ JSClipboard::JSClipboard(PassRefPtr<Structure> structure, JSDOMGlobalObject* glo JSClipboard::~JSClipboard() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSClipboard::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSConsole.cpp b/src/3rdparty/webkit/WebCore/generated/JSConsole.cpp index 1f8c6d8..897401d 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSConsole.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSConsole.cpp @@ -104,7 +104,7 @@ JSConsole::JSConsole(PassRefPtr<Structure> structure, JSDOMGlobalObject* globalO JSConsole::~JSConsole() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSConsole::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSCoordinates.cpp b/src/3rdparty/webkit/WebCore/generated/JSCoordinates.cpp index 21efdc8..68636b7 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSCoordinates.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSCoordinates.cpp @@ -83,7 +83,7 @@ JSCoordinates::JSCoordinates(PassRefPtr<Structure> structure, JSDOMGlobalObject* JSCoordinates::~JSCoordinates() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSCoordinates::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSCounter.cpp b/src/3rdparty/webkit/WebCore/generated/JSCounter.cpp index d7bc5f1..edd7ead 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSCounter.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSCounter.cpp @@ -125,7 +125,7 @@ JSCounter::JSCounter(PassRefPtr<Structure> structure, JSDOMGlobalObject* globalO JSCounter::~JSCounter() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSCounter::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSDOMApplicationCache.cpp b/src/3rdparty/webkit/WebCore/generated/JSDOMApplicationCache.cpp index e28b6ec..d2b052b 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDOMApplicationCache.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSDOMApplicationCache.cpp @@ -31,6 +31,7 @@ #include "JSDOMGlobalObject.h" #include "JSEvent.h" #include "JSEventListener.h" +#include "RegisteredEventListener.h" #include <runtime/Error.h> #include <runtime/JSNumberCell.h> #include <wtf/GetPtr.h> @@ -116,7 +117,14 @@ JSDOMApplicationCache::JSDOMApplicationCache(PassRefPtr<Structure> structure, JS JSDOMApplicationCache::~JSDOMApplicationCache() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + impl()->invalidateEventListeners(); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); +} + +void JSDOMApplicationCache::markChildren(MarkStack& markStack) +{ + Base::markChildren(markStack); + impl()->markEventListeners(markStack); } JSObject* JSDOMApplicationCache::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSDOMCoreException.cpp b/src/3rdparty/webkit/WebCore/generated/JSDOMCoreException.cpp index 94df8dd..fbca8b2 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDOMCoreException.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSDOMCoreException.cpp @@ -182,7 +182,7 @@ JSDOMCoreException::JSDOMCoreException(PassRefPtr<Structure> structure, JSDOMGlo JSDOMCoreException::~JSDOMCoreException() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSDOMCoreException::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSDOMImplementation.cpp b/src/3rdparty/webkit/WebCore/generated/JSDOMImplementation.cpp index 27eb530..2e678bb 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDOMImplementation.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSDOMImplementation.cpp @@ -145,7 +145,7 @@ JSDOMImplementation::JSDOMImplementation(PassRefPtr<Structure> structure, JSDOMG JSDOMImplementation::~JSDOMImplementation() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSDOMImplementation::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSDOMParser.cpp b/src/3rdparty/webkit/WebCore/generated/JSDOMParser.cpp index 8ff4a03..1880607 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDOMParser.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSDOMParser.cpp @@ -144,7 +144,7 @@ JSDOMParser::JSDOMParser(PassRefPtr<Structure> structure, JSDOMGlobalObject* glo JSDOMParser::~JSDOMParser() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSDOMParser::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSDOMSelection.cpp b/src/3rdparty/webkit/WebCore/generated/JSDOMSelection.cpp index daf65df..88ddfc1 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDOMSelection.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSDOMSelection.cpp @@ -119,7 +119,7 @@ JSDOMSelection::JSDOMSelection(PassRefPtr<Structure> structure, JSDOMGlobalObjec JSDOMSelection::~JSDOMSelection() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSDOMSelection::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.cpp b/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.cpp index 414a1bb..8e85b60 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.cpp @@ -214,6 +214,7 @@ #include "JSWebKitCSSTransformValue.h" #include "JSWebKitPoint.h" #include "JSWebKitTransitionEvent.h" +#include "JSWebSocket.h" #include "JSWheelEvent.h" #include "JSWorker.h" #include "JSXMLHttpRequest.h" @@ -243,7 +244,7 @@ ASSERT_CLASS_FITS_IN_CELL(JSDOMWindow); /* Hash table */ -static const HashTableValue JSDOMWindowTableValues[293] = +static const HashTableValue JSDOMWindowTableValues[294] = { { "screen", DontDelete|ReadOnly, (intptr_t)jsDOMWindowScreen, (intptr_t)0 }, { "history", DontDelete|ReadOnly, (intptr_t)jsDOMWindowHistory, (intptr_t)0 }, @@ -531,6 +532,7 @@ static const HashTableValue JSDOMWindowTableValues[293] = { "MessageChannel", DontDelete, (intptr_t)jsDOMWindowMessageChannelConstructor, (intptr_t)setJSDOMWindowMessageChannelConstructor }, { "Worker", DontDelete, (intptr_t)jsDOMWindowWorkerConstructor, (intptr_t)setJSDOMWindowWorkerConstructor }, { "SharedWorker", DontDelete, (intptr_t)jsDOMWindowSharedWorkerConstructor, (intptr_t)setJSDOMWindowSharedWorkerConstructor }, + { "WebSocket", DontDelete, (intptr_t)jsDOMWindowWebSocketConstructor, (intptr_t)setJSDOMWindowWebSocketConstructor }, { "Plugin", DontDelete, (intptr_t)jsDOMWindowPluginConstructor, (intptr_t)setJSDOMWindowPluginConstructor }, { "PluginArray", DontDelete, (intptr_t)jsDOMWindowPluginArrayConstructor, (intptr_t)setJSDOMWindowPluginArrayConstructor }, { "MimeType", DontDelete, (intptr_t)jsDOMWindowMimeTypeConstructor, (intptr_t)setJSDOMWindowMimeTypeConstructor }, @@ -578,7 +580,7 @@ static JSC_CONST_HASHTABLE HashTable JSDOMWindowTable = #if ENABLE(PERFECT_HASH_SIZE) { 65535, JSDOMWindowTableValues, 0 }; #else - { 1067, 1023, JSDOMWindowTableValues, 0 }; + { 1068, 1023, JSDOMWindowTableValues, 0 }; #endif /* Hash table for prototype */ @@ -657,7 +659,8 @@ JSDOMWindow::JSDOMWindow(PassRefPtr<Structure> structure, PassRefPtr<DOMWindow> JSDOMWindow::~JSDOMWindow() { - invalidateEventListeners(impl()->eventListeners()); + impl()->invalidateEventListeners(); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSValue jsDOMWindowScreen(ExecState* exec, const Identifier&, const PropertySlot& slot) @@ -3239,6 +3242,14 @@ JSValue jsDOMWindowSharedWorkerConstructor(ExecState* exec, const Identifier&, c return castedThis->sharedWorker(exec); } +JSValue jsDOMWindowWebSocketConstructor(ExecState* exec, const Identifier&, const PropertySlot& slot) +{ + JSDOMWindow* castedThis = static_cast<JSDOMWindow*>(asObject(slot.slotBase())); + if (!castedThis->allowsAccessFrom(exec)) + return jsUndefined(); + return castedThis->webSocket(exec); +} + JSValue jsDOMWindowPluginConstructor(ExecState* exec, const Identifier&, const PropertySlot& slot) { JSDOMWindow* castedThis = static_cast<JSDOMWindow*>(asObject(slot.slotBase())); @@ -5610,6 +5621,14 @@ void setJSDOMWindowSharedWorkerConstructor(ExecState* exec, JSObject* thisObject static_cast<JSDOMWindow*>(thisObject)->putDirect(Identifier(exec, "SharedWorker"), value); } +void setJSDOMWindowWebSocketConstructor(ExecState* exec, JSObject* thisObject, JSValue value) +{ + if (!static_cast<JSDOMWindow*>(thisObject)->allowsAccessFrom(exec)) + return; + // Shadowing a built-in constructor + static_cast<JSDOMWindow*>(thisObject)->putDirect(Identifier(exec, "WebSocket"), value); +} + void setJSDOMWindowPluginConstructor(ExecState* exec, JSObject* thisObject, JSValue value) { if (!static_cast<JSDOMWindow*>(thisObject)->allowsAccessFrom(exec)) diff --git a/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.h b/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.h index 5b1b58e..5c723f1 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.h +++ b/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.h @@ -50,10 +50,11 @@ public: virtual bool deleteProperty(JSC::ExecState*, const JSC::Identifier&); virtual void getPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&); + virtual bool defineOwnProperty(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&, bool shouldThrow); virtual void getOwnPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&); virtual bool getPropertyAttributes(JSC::ExecState*, const JSC::Identifier&, unsigned& attributes) const; - virtual void defineGetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction); - virtual void defineSetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* setterFunction); + virtual void defineGetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction, unsigned attributes); + virtual void defineSetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* setterFunction, unsigned attributes); virtual JSC::JSValue lookupGetter(JSC::ExecState*, const JSC::Identifier& propertyName); virtual JSC::JSValue lookupSetter(JSC::ExecState*, const JSC::Identifier& propertyName); @@ -80,6 +81,7 @@ public: JSC::JSValue messageChannel(JSC::ExecState*) const; JSC::JSValue worker(JSC::ExecState*) const; JSC::JSValue sharedWorker(JSC::ExecState*) const; + JSC::JSValue webSocket(JSC::ExecState*) const; JSC::JSValue audio(JSC::ExecState*) const; // Custom functions @@ -666,6 +668,8 @@ JSC::JSValue jsDOMWindowWorkerConstructor(JSC::ExecState*, const JSC::Identifier void setJSDOMWindowWorkerConstructor(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsDOMWindowSharedWorkerConstructor(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&); void setJSDOMWindowSharedWorkerConstructor(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsDOMWindowWebSocketConstructor(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&); +void setJSDOMWindowWebSocketConstructor(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsDOMWindowPluginConstructor(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&); void setJSDOMWindowPluginConstructor(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsDOMWindowPluginArrayConstructor(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&); diff --git a/src/3rdparty/webkit/WebCore/generated/JSDataGridColumn.cpp b/src/3rdparty/webkit/WebCore/generated/JSDataGridColumn.cpp index 59eafb1..c0187fb 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDataGridColumn.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSDataGridColumn.cpp @@ -154,7 +154,7 @@ JSDataGridColumn::JSDataGridColumn(PassRefPtr<Structure> structure, JSDOMGlobalO JSDataGridColumn::~JSDataGridColumn() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSDataGridColumn::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSDataGridColumnList.cpp b/src/3rdparty/webkit/WebCore/generated/JSDataGridColumnList.cpp index 2ec302a..10c8813 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDataGridColumnList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSDataGridColumnList.cpp @@ -148,7 +148,7 @@ JSDataGridColumnList::JSDataGridColumnList(PassRefPtr<Structure> structure, JSDO JSDataGridColumnList::~JSDataGridColumnList() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSDataGridColumnList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSDatabase.cpp b/src/3rdparty/webkit/WebCore/generated/JSDatabase.cpp index 16b0888..cb2dc3f 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDatabase.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSDatabase.cpp @@ -95,7 +95,7 @@ JSDatabase::JSDatabase(PassRefPtr<Structure> structure, JSDOMGlobalObject* globa JSDatabase::~JSDatabase() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSDatabase::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSDedicatedWorkerContext.h b/src/3rdparty/webkit/WebCore/generated/JSDedicatedWorkerContext.h index d6caa8d..d513c8f 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDedicatedWorkerContext.h +++ b/src/3rdparty/webkit/WebCore/generated/JSDedicatedWorkerContext.h @@ -45,8 +45,6 @@ public: return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType)); } - virtual void markChildren(JSC::MarkStack&); - // Custom functions JSC::JSValue postMessage(JSC::ExecState*, const JSC::ArgList&); @@ -68,7 +66,7 @@ public: virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) { - return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType)); + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, JSC::HasDefaultMark)); } JSDedicatedWorkerContextPrototype(PassRefPtr<JSC::Structure> structure) : JSC::JSObject(structure) { } }; diff --git a/src/3rdparty/webkit/WebCore/generated/JSEvent.cpp b/src/3rdparty/webkit/WebCore/generated/JSEvent.cpp index 9d9b7f2..833b5a0 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSEvent.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSEvent.cpp @@ -196,7 +196,7 @@ JSEvent::JSEvent(PassRefPtr<Structure> structure, JSDOMGlobalObject* globalObjec JSEvent::~JSEvent() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSEvent::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSEventException.cpp b/src/3rdparty/webkit/WebCore/generated/JSEventException.cpp index df2cebc..9044090 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSEventException.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSEventException.cpp @@ -148,7 +148,7 @@ JSEventException::JSEventException(PassRefPtr<Structure> structure, JSDOMGlobalO JSEventException::~JSEventException() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSEventException::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSEventSource.cpp b/src/3rdparty/webkit/WebCore/generated/JSEventSource.cpp index 8fe292b..69471ee 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSEventSource.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSEventSource.cpp @@ -32,6 +32,7 @@ #include "JSEvent.h" #include "JSEventListener.h" #include "KURL.h" +#include "RegisteredEventListener.h" #include <runtime/Error.h> #include <runtime/JSNumberCell.h> #include <runtime/JSString.h> @@ -118,7 +119,14 @@ JSEventSource::JSEventSource(PassRefPtr<Structure> structure, JSDOMGlobalObject* JSEventSource::~JSEventSource() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + impl()->invalidateEventListeners(); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); +} + +void JSEventSource::markChildren(MarkStack& markStack) +{ + Base::markChildren(markStack); + impl()->markEventListeners(markStack); } JSObject* JSEventSource::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSFile.cpp b/src/3rdparty/webkit/WebCore/generated/JSFile.cpp index 5fa637e..a426abf 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSFile.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSFile.cpp @@ -125,7 +125,7 @@ JSFile::JSFile(PassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, JSFile::~JSFile() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSFile::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSFileList.cpp b/src/3rdparty/webkit/WebCore/generated/JSFileList.cpp index 5fb8b0c..da2ed09 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSFileList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSFileList.cpp @@ -138,7 +138,7 @@ JSFileList::JSFileList(PassRefPtr<Structure> structure, JSDOMGlobalObject* globa JSFileList::~JSFileList() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSFileList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSGeolocation.cpp b/src/3rdparty/webkit/WebCore/generated/JSGeolocation.cpp index 7a1e5f0..e5d4526 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSGeolocation.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSGeolocation.cpp @@ -92,7 +92,7 @@ JSGeolocation::JSGeolocation(PassRefPtr<Structure> structure, JSDOMGlobalObject* JSGeolocation::~JSGeolocation() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSGeolocation::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSGeoposition.cpp b/src/3rdparty/webkit/WebCore/generated/JSGeoposition.cpp index 400e0d4..8219fb2 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSGeoposition.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSGeoposition.cpp @@ -80,7 +80,7 @@ JSGeoposition::JSGeoposition(PassRefPtr<Structure> structure, JSDOMGlobalObject* JSGeoposition::~JSGeoposition() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSGeoposition::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLCollection.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLCollection.cpp index b93fb61..30defc0 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSHTMLCollection.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLCollection.cpp @@ -143,7 +143,7 @@ JSHTMLCollection::JSHTMLCollection(PassRefPtr<Structure> structure, JSDOMGlobalO JSHTMLCollection::~JSHTMLCollection() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSHTMLCollection::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLTextAreaElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLTextAreaElement.cpp index ffe9716..be123db 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSHTMLTextAreaElement.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLTextAreaElement.cpp @@ -41,7 +41,7 @@ ASSERT_CLASS_FITS_IN_CELL(JSHTMLTextAreaElement); /* Hash table */ -static const HashTableValue JSHTMLTextAreaElementTableValues[20] = +static const HashTableValue JSHTMLTextAreaElementTableValues[21] = { { "defaultValue", DontDelete, (intptr_t)jsHTMLTextAreaElementDefaultValue, (intptr_t)setJSHTMLTextAreaElementDefaultValue }, { "form", DontDelete|ReadOnly, (intptr_t)jsHTMLTextAreaElementForm, (intptr_t)0 }, @@ -50,6 +50,7 @@ static const HashTableValue JSHTMLTextAreaElementTableValues[20] = { "cols", DontDelete, (intptr_t)jsHTMLTextAreaElementCols, (intptr_t)setJSHTMLTextAreaElementCols }, { "disabled", DontDelete, (intptr_t)jsHTMLTextAreaElementDisabled, (intptr_t)setJSHTMLTextAreaElementDisabled }, { "autofocus", DontDelete, (intptr_t)jsHTMLTextAreaElementAutofocus, (intptr_t)setJSHTMLTextAreaElementAutofocus }, + { "maxLength", DontDelete, (intptr_t)jsHTMLTextAreaElementMaxLength, (intptr_t)setJSHTMLTextAreaElementMaxLength }, { "name", DontDelete, (intptr_t)jsHTMLTextAreaElementName, (intptr_t)setJSHTMLTextAreaElementName }, { "placeholder", DontDelete, (intptr_t)jsHTMLTextAreaElementPlaceholder, (intptr_t)setJSHTMLTextAreaElementPlaceholder }, { "readOnly", DontDelete, (intptr_t)jsHTMLTextAreaElementReadOnly, (intptr_t)setJSHTMLTextAreaElementReadOnly }, @@ -229,6 +230,14 @@ JSValue jsHTMLTextAreaElementAutofocus(ExecState* exec, const Identifier&, const return jsBoolean(imp->autofocus()); } +JSValue jsHTMLTextAreaElementMaxLength(ExecState* exec, const Identifier&, const PropertySlot& slot) +{ + JSHTMLTextAreaElement* castedThis = static_cast<JSHTMLTextAreaElement*>(asObject(slot.slotBase())); + UNUSED_PARAM(exec); + HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(castedThis->impl()); + return jsNumber(exec, imp->maxLength()); +} + JSValue jsHTMLTextAreaElementName(ExecState* exec, const Identifier&, const PropertySlot& slot) { JSHTMLTextAreaElement* castedThis = static_cast<JSHTMLTextAreaElement*>(asObject(slot.slotBase())); @@ -357,6 +366,12 @@ void setJSHTMLTextAreaElementAutofocus(ExecState* exec, JSObject* thisObject, JS imp->setAutofocus(value.toBoolean(exec)); } +void setJSHTMLTextAreaElementMaxLength(ExecState* exec, JSObject* thisObject, JSValue value) +{ + HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(static_cast<JSHTMLTextAreaElement*>(thisObject)->impl()); + imp->setMaxLength(value.toInt32(exec)); +} + void setJSHTMLTextAreaElementName(ExecState* exec, JSObject* thisObject, JSValue value) { HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(static_cast<JSHTMLTextAreaElement*>(thisObject)->impl()); diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLTextAreaElement.h b/src/3rdparty/webkit/WebCore/generated/JSHTMLTextAreaElement.h index 313af9f..0df320e 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSHTMLTextAreaElement.h +++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLTextAreaElement.h @@ -82,6 +82,8 @@ JSC::JSValue jsHTMLTextAreaElementDisabled(JSC::ExecState*, const JSC::Identifie void setJSHTMLTextAreaElementDisabled(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsHTMLTextAreaElementAutofocus(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&); void setJSHTMLTextAreaElementAutofocus(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsHTMLTextAreaElementMaxLength(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&); +void setJSHTMLTextAreaElementMaxLength(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsHTMLTextAreaElementName(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&); void setJSHTMLTextAreaElementName(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsHTMLTextAreaElementPlaceholder(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&); diff --git a/src/3rdparty/webkit/WebCore/generated/JSHistory.cpp b/src/3rdparty/webkit/WebCore/generated/JSHistory.cpp index d7c2b04..2d6e7d4 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSHistory.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSHistory.cpp @@ -92,7 +92,7 @@ JSHistory::JSHistory(PassRefPtr<Structure> structure, JSDOMGlobalObject* globalO JSHistory::~JSHistory() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSHistory::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSImageData.cpp b/src/3rdparty/webkit/WebCore/generated/JSImageData.cpp index b918220..796c592 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSImageData.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSImageData.cpp @@ -123,7 +123,7 @@ JSImageData::JSImageData(PassRefPtr<Structure> structure, JSDOMGlobalObject* glo JSImageData::~JSImageData() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSImageData::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSInspectorBackend.cpp b/src/3rdparty/webkit/WebCore/generated/JSInspectorBackend.cpp index c77185c..77b4b7c 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSInspectorBackend.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSInspectorBackend.cpp @@ -96,7 +96,7 @@ bool JSInspectorBackendConstructor::getOwnPropertyDescriptor(ExecState* exec, co /* Hash table for prototype */ -static const HashTableValue JSInspectorBackendPrototypeTableValues[66] = +static const HashTableValue JSInspectorBackendPrototypeTableValues[69] = { { "hideDOMNodeHighlight", DontDelete|Function, (intptr_t)jsInspectorBackendPrototypeFunctionHideDOMNodeHighlight, (intptr_t)0 }, { "highlightDOMNode", DontDelete|Function, (intptr_t)jsInspectorBackendPrototypeFunctionHighlightDOMNode, (intptr_t)1 }, @@ -163,6 +163,9 @@ static const HashTableValue JSInspectorBackendPrototypeTableValues[66] = { "addNodesToSearchResult", DontDelete|Function, (intptr_t)jsInspectorBackendPrototypeFunctionAddNodesToSearchResult, (intptr_t)1 }, { "selectDatabase", DontDelete|Function, (intptr_t)jsInspectorBackendPrototypeFunctionSelectDatabase, (intptr_t)1 }, { "selectDOMStorage", DontDelete|Function, (intptr_t)jsInspectorBackendPrototypeFunctionSelectDOMStorage, (intptr_t)1 }, + { "getDOMStorageEntries", DontDelete|Function, (intptr_t)jsInspectorBackendPrototypeFunctionGetDOMStorageEntries, (intptr_t)2 }, + { "setDOMStorageItem", DontDelete|Function, (intptr_t)jsInspectorBackendPrototypeFunctionSetDOMStorageItem, (intptr_t)4 }, + { "removeDOMStorageItem", DontDelete|Function, (intptr_t)jsInspectorBackendPrototypeFunctionRemoveDOMStorageItem, (intptr_t)3 }, { 0, 0, 0, 0 } }; @@ -200,7 +203,7 @@ JSInspectorBackend::JSInspectorBackend(PassRefPtr<Structure> structure, JSDOMGlo JSInspectorBackend::~JSInspectorBackend() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSInspectorBackend::createPrototype(ExecState* exec, JSGlobalObject* globalObject) @@ -1019,6 +1022,51 @@ JSValue JSC_HOST_CALL jsInspectorBackendPrototypeFunctionSelectDOMStorage(ExecSt return castedThisObj->selectDOMStorage(exec, args); } +JSValue JSC_HOST_CALL jsInspectorBackendPrototypeFunctionGetDOMStorageEntries(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +{ + UNUSED_PARAM(args); + if (!thisValue.inherits(&JSInspectorBackend::s_info)) + return throwError(exec, TypeError); + JSInspectorBackend* castedThisObj = static_cast<JSInspectorBackend*>(asObject(thisValue)); + InspectorBackend* imp = static_cast<InspectorBackend*>(castedThisObj->impl()); + int callId = args.at(0).toInt32(exec); + int storageId = args.at(1).toInt32(exec); + + imp->getDOMStorageEntries(callId, storageId); + return jsUndefined(); +} + +JSValue JSC_HOST_CALL jsInspectorBackendPrototypeFunctionSetDOMStorageItem(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +{ + UNUSED_PARAM(args); + if (!thisValue.inherits(&JSInspectorBackend::s_info)) + return throwError(exec, TypeError); + JSInspectorBackend* castedThisObj = static_cast<JSInspectorBackend*>(asObject(thisValue)); + InspectorBackend* imp = static_cast<InspectorBackend*>(castedThisObj->impl()); + int callId = args.at(0).toInt32(exec); + int storageId = args.at(1).toInt32(exec); + const UString& key = args.at(2).toString(exec); + const UString& value = args.at(3).toString(exec); + + imp->setDOMStorageItem(callId, storageId, key, value); + return jsUndefined(); +} + +JSValue JSC_HOST_CALL jsInspectorBackendPrototypeFunctionRemoveDOMStorageItem(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +{ + UNUSED_PARAM(args); + if (!thisValue.inherits(&JSInspectorBackend::s_info)) + return throwError(exec, TypeError); + JSInspectorBackend* castedThisObj = static_cast<JSInspectorBackend*>(asObject(thisValue)); + InspectorBackend* imp = static_cast<InspectorBackend*>(castedThisObj->impl()); + int callId = args.at(0).toInt32(exec); + int storageId = args.at(1).toInt32(exec); + const UString& key = args.at(2).toString(exec); + + imp->removeDOMStorageItem(callId, storageId, key); + return jsUndefined(); +} + JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, InspectorBackend* object) { return getDOMObjectWrapper<JSInspectorBackend>(exec, globalObject, object); diff --git a/src/3rdparty/webkit/WebCore/generated/JSInspectorBackend.h b/src/3rdparty/webkit/WebCore/generated/JSInspectorBackend.h index 102a5b4..fec9031 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSInspectorBackend.h +++ b/src/3rdparty/webkit/WebCore/generated/JSInspectorBackend.h @@ -155,6 +155,9 @@ JSC::JSValue JSC_HOST_CALL jsInspectorBackendPrototypeFunctionPushNodePathToFron JSC::JSValue JSC_HOST_CALL jsInspectorBackendPrototypeFunctionAddNodesToSearchResult(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); JSC::JSValue JSC_HOST_CALL jsInspectorBackendPrototypeFunctionSelectDatabase(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); JSC::JSValue JSC_HOST_CALL jsInspectorBackendPrototypeFunctionSelectDOMStorage(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); +JSC::JSValue JSC_HOST_CALL jsInspectorBackendPrototypeFunctionGetDOMStorageEntries(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); +JSC::JSValue JSC_HOST_CALL jsInspectorBackendPrototypeFunctionSetDOMStorageItem(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); +JSC::JSValue JSC_HOST_CALL jsInspectorBackendPrototypeFunctionRemoveDOMStorageItem(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); // Attributes JSC::JSValue jsInspectorBackendConstructor(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&); diff --git a/src/3rdparty/webkit/WebCore/generated/JSJavaScriptCallFrame.cpp b/src/3rdparty/webkit/WebCore/generated/JSJavaScriptCallFrame.cpp index 9ec80b0..212ed59 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSJavaScriptCallFrame.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSJavaScriptCallFrame.cpp @@ -101,7 +101,7 @@ JSJavaScriptCallFrame::JSJavaScriptCallFrame(PassRefPtr<Structure> structure, JS JSJavaScriptCallFrame::~JSJavaScriptCallFrame() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSJavaScriptCallFrame::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSLocation.cpp b/src/3rdparty/webkit/WebCore/generated/JSLocation.cpp index 9df3a4d..0889e16 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSLocation.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSLocation.cpp @@ -108,7 +108,7 @@ JSLocation::JSLocation(PassRefPtr<Structure> structure, JSDOMGlobalObject* globa JSLocation::~JSLocation() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSLocation::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSLocation.h b/src/3rdparty/webkit/WebCore/generated/JSLocation.h index 54b41ce..8db2969 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSLocation.h +++ b/src/3rdparty/webkit/WebCore/generated/JSLocation.h @@ -52,7 +52,7 @@ public: virtual bool deleteProperty(JSC::ExecState*, const JSC::Identifier&); virtual void getOwnPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&); - virtual void defineGetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction); + virtual void defineGetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction, unsigned attributes); // Custom attributes void setHref(JSC::ExecState*, JSC::JSValue); @@ -92,7 +92,7 @@ public: } virtual void put(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValue, JSC::PutPropertySlot&); bool putDelegate(JSC::ExecState*, const JSC::Identifier&, JSC::JSValue, JSC::PutPropertySlot&); - virtual void defineGetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction); + virtual void defineGetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction, unsigned attributes); JSLocationPrototype(PassRefPtr<JSC::Structure> structure) : JSC::JSObject(structure) { } }; diff --git a/src/3rdparty/webkit/WebCore/generated/JSMedia.cpp b/src/3rdparty/webkit/WebCore/generated/JSMedia.cpp index 26dffa8..8106ab4 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSMedia.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSMedia.cpp @@ -135,7 +135,7 @@ JSMedia::JSMedia(PassRefPtr<Structure> structure, JSDOMGlobalObject* globalObjec JSMedia::~JSMedia() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSMedia::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSMediaError.cpp b/src/3rdparty/webkit/WebCore/generated/JSMediaError.cpp index 5a906ae..43640f3 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSMediaError.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSMediaError.cpp @@ -143,7 +143,7 @@ JSMediaError::JSMediaError(PassRefPtr<Structure> structure, JSDOMGlobalObject* g JSMediaError::~JSMediaError() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSMediaError::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSMediaList.cpp b/src/3rdparty/webkit/WebCore/generated/JSMediaList.cpp index 8c5e097..04d30bb 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSMediaList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSMediaList.cpp @@ -139,7 +139,7 @@ JSMediaList::JSMediaList(PassRefPtr<Structure> structure, JSDOMGlobalObject* glo JSMediaList::~JSMediaList() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSMediaList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSMessageChannel.cpp b/src/3rdparty/webkit/WebCore/generated/JSMessageChannel.cpp index accf6e3..d851688 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSMessageChannel.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSMessageChannel.cpp @@ -87,7 +87,7 @@ JSMessageChannel::JSMessageChannel(PassRefPtr<Structure> structure, JSDOMGlobalO JSMessageChannel::~JSMessageChannel() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSMessageChannel::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSMessagePort.cpp b/src/3rdparty/webkit/WebCore/generated/JSMessagePort.cpp index 7cbcc88..a532d51 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSMessagePort.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSMessagePort.cpp @@ -29,6 +29,7 @@ #include "JSEventListener.h" #include "MessagePort.h" #include "PlatformString.h" +#include "RegisteredEventListener.h" #include <runtime/Error.h> #include <wtf/GetPtr.h> @@ -153,7 +154,8 @@ JSMessagePort::JSMessagePort(PassRefPtr<Structure> structure, JSDOMGlobalObject* JSMessagePort::~JSMessagePort() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + impl()->invalidateEventListeners(); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSMessagePort::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSMimeType.cpp b/src/3rdparty/webkit/WebCore/generated/JSMimeType.cpp index 0857400..458d7d7 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSMimeType.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSMimeType.cpp @@ -128,7 +128,7 @@ JSMimeType::JSMimeType(PassRefPtr<Structure> structure, JSDOMGlobalObject* globa JSMimeType::~JSMimeType() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSMimeType::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSMimeTypeArray.cpp b/src/3rdparty/webkit/WebCore/generated/JSMimeTypeArray.cpp index 5cc3fd4..79f7bce 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSMimeTypeArray.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSMimeTypeArray.cpp @@ -139,7 +139,7 @@ JSMimeTypeArray::JSMimeTypeArray(PassRefPtr<Structure> structure, JSDOMGlobalObj JSMimeTypeArray::~JSMimeTypeArray() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSMimeTypeArray::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSNamedNodeMap.cpp b/src/3rdparty/webkit/WebCore/generated/JSNamedNodeMap.cpp index 71d3cef..a9b9e44 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSNamedNodeMap.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSNamedNodeMap.cpp @@ -144,7 +144,7 @@ JSNamedNodeMap::JSNamedNodeMap(PassRefPtr<Structure> structure, JSDOMGlobalObjec JSNamedNodeMap::~JSNamedNodeMap() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSNamedNodeMap::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSNavigator.cpp b/src/3rdparty/webkit/WebCore/generated/JSNavigator.cpp index bf18b74..cdb2d38 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSNavigator.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSNavigator.cpp @@ -108,7 +108,7 @@ JSNavigator::JSNavigator(PassRefPtr<Structure> structure, JSDOMGlobalObject* glo JSNavigator::~JSNavigator() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSNavigator::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSNode.cpp b/src/3rdparty/webkit/WebCore/generated/JSNode.cpp index 59f6004..beb059e 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSNode.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSNode.cpp @@ -217,8 +217,8 @@ JSNode::JSNode(PassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, JSNode::~JSNode() { - invalidateEventListeners(m_impl->eventListeners()); - forgetDOMNode(m_impl->document(), m_impl.get()); + impl()->invalidateEventListeners(); + forgetDOMNode(impl()->document(), impl()); } JSObject* JSNode::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSNodeFilter.cpp b/src/3rdparty/webkit/WebCore/generated/JSNodeFilter.cpp index e4c50ba..37c4367 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSNodeFilter.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSNodeFilter.cpp @@ -164,7 +164,7 @@ JSNodeFilter::JSNodeFilter(PassRefPtr<Structure> structure, JSDOMGlobalObject* g JSNodeFilter::~JSNodeFilter() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSNodeFilter::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSNodeIterator.cpp b/src/3rdparty/webkit/WebCore/generated/JSNodeIterator.cpp index 0f4167d..324be0f 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSNodeIterator.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSNodeIterator.cpp @@ -145,7 +145,7 @@ JSNodeIterator::JSNodeIterator(PassRefPtr<Structure> structure, JSDOMGlobalObjec JSNodeIterator::~JSNodeIterator() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSNodeIterator::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSNodeList.cpp b/src/3rdparty/webkit/WebCore/generated/JSNodeList.cpp index 892ba5b..fe6f6ca 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSNodeList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSNodeList.cpp @@ -139,7 +139,7 @@ JSNodeList::JSNodeList(PassRefPtr<Structure> structure, JSDOMGlobalObject* globa JSNodeList::~JSNodeList() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSNodeList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSPlugin.cpp b/src/3rdparty/webkit/WebCore/generated/JSPlugin.cpp index e23dc5a..1416a74 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSPlugin.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSPlugin.cpp @@ -144,7 +144,7 @@ JSPlugin::JSPlugin(PassRefPtr<Structure> structure, JSDOMGlobalObject* globalObj JSPlugin::~JSPlugin() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSPlugin::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSPluginArray.cpp b/src/3rdparty/webkit/WebCore/generated/JSPluginArray.cpp index 9f46e08..436b924 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSPluginArray.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSPluginArray.cpp @@ -140,7 +140,7 @@ JSPluginArray::JSPluginArray(PassRefPtr<Structure> structure, JSDOMGlobalObject* JSPluginArray::~JSPluginArray() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSPluginArray::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSPositionError.cpp b/src/3rdparty/webkit/WebCore/generated/JSPositionError.cpp index 03c0ba3..234481f 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSPositionError.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSPositionError.cpp @@ -143,7 +143,7 @@ JSPositionError::JSPositionError(PassRefPtr<Structure> structure, JSDOMGlobalObj JSPositionError::~JSPositionError() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSPositionError::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSRGBColor.cpp b/src/3rdparty/webkit/WebCore/generated/JSRGBColor.cpp index f3b1a35..b0bf6b4 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSRGBColor.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSRGBColor.cpp @@ -125,7 +125,7 @@ JSRGBColor::JSRGBColor(PassRefPtr<Structure> structure, JSDOMGlobalObject* globa JSRGBColor::~JSRGBColor() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSRGBColor::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSRange.cpp b/src/3rdparty/webkit/WebCore/generated/JSRange.cpp index dffeb8a..9968a29 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSRange.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSRange.cpp @@ -185,7 +185,7 @@ JSRange::JSRange(PassRefPtr<Structure> structure, JSDOMGlobalObject* globalObjec JSRange::~JSRange() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSRange::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSRangeException.cpp b/src/3rdparty/webkit/WebCore/generated/JSRangeException.cpp index 1ef3ced..29db9c0 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSRangeException.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSRangeException.cpp @@ -142,7 +142,7 @@ JSRangeException::JSRangeException(PassRefPtr<Structure> structure, JSDOMGlobalO JSRangeException::~JSRangeException() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSRangeException::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSRect.cpp b/src/3rdparty/webkit/WebCore/generated/JSRect.cpp index b717102..df9089d 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSRect.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSRect.cpp @@ -126,7 +126,7 @@ JSRect::JSRect(PassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, JSRect::~JSRect() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSRect::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSQLError.cpp b/src/3rdparty/webkit/WebCore/generated/JSSQLError.cpp index a004498..acab07d 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSQLError.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSQLError.cpp @@ -83,7 +83,7 @@ JSSQLError::JSSQLError(PassRefPtr<Structure> structure, JSDOMGlobalObject* globa JSSQLError::~JSSQLError() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSSQLError::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSQLResultSet.cpp b/src/3rdparty/webkit/WebCore/generated/JSSQLResultSet.cpp index 7218490..d12399a 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSQLResultSet.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSQLResultSet.cpp @@ -84,7 +84,7 @@ JSSQLResultSet::JSSQLResultSet(PassRefPtr<Structure> structure, JSDOMGlobalObjec JSSQLResultSet::~JSSQLResultSet() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSSQLResultSet::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSQLResultSetRowList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSQLResultSetRowList.cpp index 7fa87e5..6253b97 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSQLResultSetRowList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSQLResultSetRowList.cpp @@ -92,7 +92,7 @@ JSSQLResultSetRowList::JSSQLResultSetRowList(PassRefPtr<Structure> structure, JS JSSQLResultSetRowList::~JSSQLResultSetRowList() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSSQLResultSetRowList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSQLTransaction.cpp b/src/3rdparty/webkit/WebCore/generated/JSSQLTransaction.cpp index 485cda6..00f5649 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSQLTransaction.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSQLTransaction.cpp @@ -76,7 +76,7 @@ JSSQLTransaction::JSSQLTransaction(PassRefPtr<Structure> structure, JSDOMGlobalO JSSQLTransaction::~JSSQLTransaction() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSSQLTransaction::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAngle.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAngle.cpp index 1551f8e..22d0740 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAngle.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAngle.cpp @@ -153,7 +153,7 @@ JSSVGAngle::JSSVGAngle(PassRefPtr<Structure> structure, JSDOMGlobalObject* globa JSSVGAngle::~JSSVGAngle() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSSVGAngle::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedAngle.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedAngle.cpp index 3375a94..f54fda9 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedAngle.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedAngle.cpp @@ -81,7 +81,7 @@ JSSVGAnimatedAngle::JSSVGAnimatedAngle(PassRefPtr<Structure> structure, JSDOMGlo JSSVGAnimatedAngle::~JSSVGAnimatedAngle() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSSVGAnimatedAngle::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedBoolean.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedBoolean.cpp index 29d0622..12c1822 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedBoolean.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedBoolean.cpp @@ -79,7 +79,7 @@ JSSVGAnimatedBoolean::JSSVGAnimatedBoolean(PassRefPtr<Structure> structure, JSDO JSSVGAnimatedBoolean::~JSSVGAnimatedBoolean() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSSVGAnimatedBoolean::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedEnumeration.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedEnumeration.cpp index c7b31ce..cabd34e 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedEnumeration.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedEnumeration.cpp @@ -80,7 +80,7 @@ JSSVGAnimatedEnumeration::JSSVGAnimatedEnumeration(PassRefPtr<Structure> structu JSSVGAnimatedEnumeration::~JSSVGAnimatedEnumeration() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSSVGAnimatedEnumeration::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedInteger.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedInteger.cpp index e49b71a..d19f136 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedInteger.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedInteger.cpp @@ -80,7 +80,7 @@ JSSVGAnimatedInteger::JSSVGAnimatedInteger(PassRefPtr<Structure> structure, JSDO JSSVGAnimatedInteger::~JSSVGAnimatedInteger() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSSVGAnimatedInteger::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLength.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLength.cpp index 7a5358d..851b70e 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLength.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLength.cpp @@ -80,7 +80,7 @@ JSSVGAnimatedLength::JSSVGAnimatedLength(PassRefPtr<Structure> structure, JSDOMG JSSVGAnimatedLength::~JSSVGAnimatedLength() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSSVGAnimatedLength::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLengthList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLengthList.cpp index e4d23bc..6d403e3 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLengthList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLengthList.cpp @@ -81,7 +81,7 @@ JSSVGAnimatedLengthList::JSSVGAnimatedLengthList(PassRefPtr<Structure> structure JSSVGAnimatedLengthList::~JSSVGAnimatedLengthList() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSSVGAnimatedLengthList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumber.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumber.cpp index cf3c932..0ccd0c9 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumber.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumber.cpp @@ -80,7 +80,7 @@ JSSVGAnimatedNumber::JSSVGAnimatedNumber(PassRefPtr<Structure> structure, JSDOMG JSSVGAnimatedNumber::~JSSVGAnimatedNumber() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSSVGAnimatedNumber::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumberList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumberList.cpp index 39857a1..756dd95 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumberList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumberList.cpp @@ -81,7 +81,7 @@ JSSVGAnimatedNumberList::JSSVGAnimatedNumberList(PassRefPtr<Structure> structure JSSVGAnimatedNumberList::~JSSVGAnimatedNumberList() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSSVGAnimatedNumberList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedPreserveAspectRatio.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedPreserveAspectRatio.cpp index 7196a26..c21644e 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedPreserveAspectRatio.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedPreserveAspectRatio.cpp @@ -81,7 +81,7 @@ JSSVGAnimatedPreserveAspectRatio::JSSVGAnimatedPreserveAspectRatio(PassRefPtr<St JSSVGAnimatedPreserveAspectRatio::~JSSVGAnimatedPreserveAspectRatio() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSSVGAnimatedPreserveAspectRatio::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedRect.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedRect.cpp index 483071b..f2d6c6c 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedRect.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedRect.cpp @@ -81,7 +81,7 @@ JSSVGAnimatedRect::JSSVGAnimatedRect(PassRefPtr<Structure> structure, JSDOMGloba JSSVGAnimatedRect::~JSSVGAnimatedRect() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSSVGAnimatedRect::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedString.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedString.cpp index 3346799..ff997f8 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedString.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedString.cpp @@ -82,7 +82,7 @@ JSSVGAnimatedString::JSSVGAnimatedString(PassRefPtr<Structure> structure, JSDOMG JSSVGAnimatedString::~JSSVGAnimatedString() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSSVGAnimatedString::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedTransformList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedTransformList.cpp index ec0dcd1..2ac0fea 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedTransformList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedTransformList.cpp @@ -81,7 +81,7 @@ JSSVGAnimatedTransformList::JSSVGAnimatedTransformList(PassRefPtr<Structure> str JSSVGAnimatedTransformList::~JSSVGAnimatedTransformList() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSSVGAnimatedTransformList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGElementInstance.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGElementInstance.cpp index e933025..3c611c3 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGElementInstance.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGElementInstance.cpp @@ -153,7 +153,7 @@ JSSVGElementInstance::JSSVGElementInstance(PassRefPtr<Structure> structure, JSDO JSSVGElementInstance::~JSSVGElementInstance() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSSVGElementInstance::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGElementInstanceList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGElementInstanceList.cpp index 27f8939..66619a0 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGElementInstanceList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGElementInstanceList.cpp @@ -94,7 +94,7 @@ JSSVGElementInstanceList::JSSVGElementInstanceList(PassRefPtr<Structure> structu JSSVGElementInstanceList::~JSSVGElementInstanceList() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSSVGElementInstanceList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGException.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGException.cpp index b863c54..38f4d0d 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGException.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGException.cpp @@ -147,7 +147,7 @@ JSSVGException::JSSVGException(PassRefPtr<Structure> structure, JSDOMGlobalObjec JSSVGException::~JSSVGException() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSSVGException::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGLength.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGLength.cpp index aa4d0bc..2182164 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGLength.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGLength.cpp @@ -166,7 +166,7 @@ JSSVGLength::JSSVGLength(PassRefPtr<Structure> structure, JSDOMGlobalObject* glo JSSVGLength::~JSSVGLength() { JSSVGDynamicPODTypeWrapperCache<SVGLength, SVGAnimatedLength>::forgetWrapper(m_impl.get()); - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSSVGLength::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGLengthList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGLengthList.cpp index 23b36a0..349aa59 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGLengthList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGLengthList.cpp @@ -100,7 +100,7 @@ JSSVGLengthList::JSSVGLengthList(PassRefPtr<Structure> structure, JSDOMGlobalObj JSSVGLengthList::~JSSVGLengthList() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSSVGLengthList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGMatrix.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGMatrix.cpp index 348aeb3..4f256da 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGMatrix.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGMatrix.cpp @@ -107,7 +107,7 @@ JSSVGMatrix::JSSVGMatrix(PassRefPtr<Structure> structure, JSDOMGlobalObject* glo JSSVGMatrix::~JSSVGMatrix() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSSVGMatrix::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGNumber.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGNumber.cpp index 0024f12..50137ef 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGNumber.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGNumber.cpp @@ -79,7 +79,7 @@ JSSVGNumber::JSSVGNumber(PassRefPtr<Structure> structure, JSDOMGlobalObject* glo JSSVGNumber::~JSSVGNumber() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSSVGNumber::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGNumberList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGNumberList.cpp index b5076f7..4e0629e 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGNumberList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGNumberList.cpp @@ -99,7 +99,7 @@ JSSVGNumberList::JSSVGNumberList(PassRefPtr<Structure> structure, JSDOMGlobalObj JSSVGNumberList::~JSSVGNumberList() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSSVGNumberList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSeg.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSeg.cpp index 978e494..611adf1 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSeg.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSeg.cpp @@ -178,7 +178,7 @@ JSSVGPathSeg::JSSVGPathSeg(PassRefPtr<Structure> structure, JSDOMGlobalObject* g JSSVGPathSeg::~JSSVGPathSeg() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSSVGPathSeg::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegList.cpp index 1c0c405..7251554 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegList.cpp @@ -99,7 +99,7 @@ JSSVGPathSegList::JSSVGPathSegList(PassRefPtr<Structure> structure, JSDOMGlobalO JSSVGPathSegList::~JSSVGPathSegList() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSSVGPathSegList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPoint.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPoint.cpp index 94faf9e..8719ece 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGPoint.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPoint.cpp @@ -94,7 +94,7 @@ JSSVGPoint::JSSVGPoint(PassRefPtr<Structure> structure, JSDOMGlobalObject* globa JSSVGPoint::~JSSVGPoint() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSSVGPoint::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPointList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPointList.cpp index 7953759..723b1ee 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGPointList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPointList.cpp @@ -98,7 +98,7 @@ JSSVGPointList::JSSVGPointList(PassRefPtr<Structure> structure, JSDOMGlobalObjec JSSVGPointList::~JSSVGPointList() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSSVGPointList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPreserveAspectRatio.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPreserveAspectRatio.cpp index 1ae7ea1..33b14ee 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGPreserveAspectRatio.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPreserveAspectRatio.cpp @@ -164,7 +164,7 @@ JSSVGPreserveAspectRatio::JSSVGPreserveAspectRatio(PassRefPtr<Structure> structu JSSVGPreserveAspectRatio::~JSSVGPreserveAspectRatio() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSSVGPreserveAspectRatio::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGRect.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGRect.cpp index fc762eb..321454a 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGRect.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGRect.cpp @@ -83,7 +83,7 @@ JSSVGRect::JSSVGRect(PassRefPtr<Structure> structure, JSDOMGlobalObject* globalO JSSVGRect::~JSSVGRect() { JSSVGDynamicPODTypeWrapperCache<FloatRect, SVGAnimatedRect>::forgetWrapper(m_impl.get()); - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSSVGRect::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGRenderingIntent.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGRenderingIntent.cpp index 730a7a0..90c9caa 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGRenderingIntent.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGRenderingIntent.cpp @@ -145,7 +145,7 @@ JSSVGRenderingIntent::JSSVGRenderingIntent(PassRefPtr<Structure> structure, JSDO JSSVGRenderingIntent::~JSSVGRenderingIntent() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSSVGRenderingIntent::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGStringList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGStringList.cpp index cddb511..4ad10bf 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGStringList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGStringList.cpp @@ -100,7 +100,7 @@ JSSVGStringList::JSSVGStringList(PassRefPtr<Structure> structure, JSDOMGlobalObj JSSVGStringList::~JSSVGStringList() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSSVGStringList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGTransform.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGTransform.cpp index 5478323..88d0c5f 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGTransform.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGTransform.cpp @@ -159,7 +159,7 @@ JSSVGTransform::JSSVGTransform(PassRefPtr<Structure> structure, JSDOMGlobalObjec JSSVGTransform::~JSSVGTransform() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSSVGTransform::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGTransformList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGTransformList.cpp index 61a430c..1414d84 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGTransformList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGTransformList.cpp @@ -103,7 +103,7 @@ JSSVGTransformList::JSSVGTransformList(PassRefPtr<Structure> structure, JSDOMGlo JSSVGTransformList::~JSSVGTransformList() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSSVGTransformList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGUnitTypes.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGUnitTypes.cpp index eefc9a8..fd563b8 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGUnitTypes.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGUnitTypes.cpp @@ -139,7 +139,7 @@ JSSVGUnitTypes::JSSVGUnitTypes(PassRefPtr<Structure> structure, JSDOMGlobalObjec JSSVGUnitTypes::~JSSVGUnitTypes() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSSVGUnitTypes::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSScreen.cpp b/src/3rdparty/webkit/WebCore/generated/JSScreen.cpp index daa84c4..d39c2ef 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSScreen.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSScreen.cpp @@ -84,7 +84,7 @@ JSScreen::JSScreen(PassRefPtr<Structure> structure, JSDOMGlobalObject* globalObj JSScreen::~JSScreen() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSScreen::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSharedWorkerContext.h b/src/3rdparty/webkit/WebCore/generated/JSSharedWorkerContext.h index 96ad865..092e13e 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSharedWorkerContext.h +++ b/src/3rdparty/webkit/WebCore/generated/JSSharedWorkerContext.h @@ -45,8 +45,6 @@ public: return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType)); } - virtual void markChildren(JSC::MarkStack&); - SharedWorkerContext* impl() const { return static_cast<SharedWorkerContext*>(Base::impl()); @@ -61,10 +59,6 @@ public: void* operator new(size_t, JSC::JSGlobalData*); virtual const JSC::ClassInfo* classInfo() const { return &s_info; } static const JSC::ClassInfo s_info; - static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) - { - return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType)); - } JSSharedWorkerContextPrototype(PassRefPtr<JSC::Structure> structure) : JSC::JSObject(structure) { } }; diff --git a/src/3rdparty/webkit/WebCore/generated/JSStorage.cpp b/src/3rdparty/webkit/WebCore/generated/JSStorage.cpp index ed5b9f8..b3a6d47 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSStorage.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSStorage.cpp @@ -144,7 +144,7 @@ JSStorage::JSStorage(PassRefPtr<Structure> structure, JSDOMGlobalObject* globalO JSStorage::~JSStorage() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSStorage::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSStyleSheet.cpp b/src/3rdparty/webkit/WebCore/generated/JSStyleSheet.cpp index 8b4c79b..6c2cef7 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSStyleSheet.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSStyleSheet.cpp @@ -133,7 +133,7 @@ JSStyleSheet::JSStyleSheet(PassRefPtr<Structure> structure, JSDOMGlobalObject* g JSStyleSheet::~JSStyleSheet() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSStyleSheet::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSStyleSheetList.cpp b/src/3rdparty/webkit/WebCore/generated/JSStyleSheetList.cpp index 0f24ff3..b832c90 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSStyleSheetList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSStyleSheetList.cpp @@ -138,7 +138,7 @@ JSStyleSheetList::JSStyleSheetList(PassRefPtr<Structure> structure, JSDOMGlobalO JSStyleSheetList::~JSStyleSheetList() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSStyleSheetList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSTextMetrics.cpp b/src/3rdparty/webkit/WebCore/generated/JSTextMetrics.cpp index 9b28792..ea39518 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSTextMetrics.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSTextMetrics.cpp @@ -122,7 +122,7 @@ JSTextMetrics::JSTextMetrics(PassRefPtr<Structure> structure, JSDOMGlobalObject* JSTextMetrics::~JSTextMetrics() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSTextMetrics::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSTimeRanges.cpp b/src/3rdparty/webkit/WebCore/generated/JSTimeRanges.cpp index 6dc04d2..25d7412 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSTimeRanges.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSTimeRanges.cpp @@ -93,7 +93,7 @@ JSTimeRanges::JSTimeRanges(PassRefPtr<Structure> structure, JSDOMGlobalObject* g JSTimeRanges::~JSTimeRanges() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSTimeRanges::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSTreeWalker.cpp b/src/3rdparty/webkit/WebCore/generated/JSTreeWalker.cpp index 290be89..b832247 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSTreeWalker.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSTreeWalker.cpp @@ -148,7 +148,7 @@ JSTreeWalker::JSTreeWalker(PassRefPtr<Structure> structure, JSDOMGlobalObject* g JSTreeWalker::~JSTreeWalker() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSTreeWalker::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSValidityState.cpp b/src/3rdparty/webkit/WebCore/generated/JSValidityState.cpp index 68fe415..f1df12e 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSValidityState.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSValidityState.cpp @@ -84,7 +84,7 @@ JSValidityState::JSValidityState(PassRefPtr<Structure> structure, JSDOMGlobalObj JSValidityState::~JSValidityState() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSValidityState::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSVoidCallback.cpp b/src/3rdparty/webkit/WebCore/generated/JSVoidCallback.cpp index 186a349..570e851 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSVoidCallback.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSVoidCallback.cpp @@ -73,7 +73,7 @@ JSVoidCallback::JSVoidCallback(PassRefPtr<Structure> structure, JSDOMGlobalObjec JSVoidCallback::~JSVoidCallback() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSVoidCallback::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSWebKitCSSMatrix.cpp b/src/3rdparty/webkit/WebCore/generated/JSWebKitCSSMatrix.cpp index 583c026..162b54c 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSWebKitCSSMatrix.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSWebKitCSSMatrix.cpp @@ -120,7 +120,7 @@ JSWebKitCSSMatrix::JSWebKitCSSMatrix(PassRefPtr<Structure> structure, JSDOMGloba JSWebKitCSSMatrix::~JSWebKitCSSMatrix() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSWebKitCSSMatrix::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSWebKitPoint.cpp b/src/3rdparty/webkit/WebCore/generated/JSWebKitPoint.cpp index 3cba2f7..8d995e5 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSWebKitPoint.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSWebKitPoint.cpp @@ -78,7 +78,7 @@ JSWebKitPoint::JSWebKitPoint(PassRefPtr<Structure> structure, JSDOMGlobalObject* JSWebKitPoint::~JSWebKitPoint() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSWebKitPoint::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSWebSocket.cpp b/src/3rdparty/webkit/WebCore/generated/JSWebSocket.cpp index 9e69c8c..ca27dab 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSWebSocket.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSWebSocket.cpp @@ -29,6 +29,7 @@ #include "JSDOMGlobalObject.h" #include "JSEventListener.h" #include "KURL.h" +#include "RegisteredEventListener.h" #include "WebSocket.h" #include <runtime/Error.h> #include <runtime/JSNumberCell.h> @@ -115,7 +116,14 @@ JSWebSocket::JSWebSocket(PassRefPtr<Structure> structure, JSDOMGlobalObject* glo JSWebSocket::~JSWebSocket() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + impl()->invalidateEventListeners(); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); +} + +void JSWebSocket::markChildren(MarkStack& markStack) +{ + Base::markChildren(markStack); + impl()->markEventListeners(markStack); } JSObject* JSWebSocket::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSWorker.h b/src/3rdparty/webkit/WebCore/generated/JSWorker.h index f33b791..6b122a2 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSWorker.h +++ b/src/3rdparty/webkit/WebCore/generated/JSWorker.h @@ -46,8 +46,6 @@ public: return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType)); } - virtual void markChildren(JSC::MarkStack&); - // Custom functions JSC::JSValue postMessage(JSC::ExecState*, const JSC::ArgList&); @@ -70,7 +68,7 @@ public: virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) { - return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType)); + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, JSC::HasDefaultMark)); } JSWorkerPrototype(PassRefPtr<JSC::Structure> structure) : JSC::JSObject(structure) { } }; diff --git a/src/3rdparty/webkit/WebCore/generated/JSWorkerContext.cpp b/src/3rdparty/webkit/WebCore/generated/JSWorkerContext.cpp index c5217d5..60fbc53 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSWorkerContext.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSWorkerContext.cpp @@ -35,6 +35,7 @@ #include "JSWorkerLocation.h" #include "JSWorkerNavigator.h" #include "JSXMLHttpRequest.h" +#include "RegisteredEventListener.h" #include "WorkerContext.h" #include "WorkerLocation.h" #include "WorkerNavigator.h" @@ -125,6 +126,12 @@ JSWorkerContext::JSWorkerContext(PassRefPtr<Structure> structure, PassRefPtr<Wor { } +JSWorkerContext::~JSWorkerContext() +{ + impl()->invalidateEventListeners(); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); +} + bool JSWorkerContext::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) { if (getOwnPropertySlotDelegate(exec, propertyName, slot)) diff --git a/src/3rdparty/webkit/WebCore/generated/JSWorkerContext.h b/src/3rdparty/webkit/WebCore/generated/JSWorkerContext.h index 1b4086e..4d112ad 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSWorkerContext.h +++ b/src/3rdparty/webkit/WebCore/generated/JSWorkerContext.h @@ -33,6 +33,7 @@ class JSWorkerContext : public JSWorkerContextBase { typedef JSWorkerContextBase Base; public: JSWorkerContext(PassRefPtr<JSC::Structure>, PassRefPtr<WorkerContext>); + virtual ~JSWorkerContext(); virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&); virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&); bool getOwnPropertySlotDelegate(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); diff --git a/src/3rdparty/webkit/WebCore/generated/JSWorkerLocation.cpp b/src/3rdparty/webkit/WebCore/generated/JSWorkerLocation.cpp index 343fd91..b550a69 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSWorkerLocation.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSWorkerLocation.cpp @@ -153,7 +153,7 @@ JSWorkerLocation::JSWorkerLocation(PassRefPtr<Structure> structure, JSDOMGlobalO JSWorkerLocation::~JSWorkerLocation() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSWorkerLocation::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSWorkerNavigator.cpp b/src/3rdparty/webkit/WebCore/generated/JSWorkerNavigator.cpp index 618fd6e..ec04560 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSWorkerNavigator.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSWorkerNavigator.cpp @@ -93,7 +93,7 @@ JSWorkerNavigator::JSWorkerNavigator(PassRefPtr<Structure> structure, JSDOMGloba JSWorkerNavigator::~JSWorkerNavigator() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSWorkerNavigator::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequest.cpp b/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequest.cpp index 0d5643e..a5cb5d0 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequest.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequest.cpp @@ -31,6 +31,7 @@ #include "JSEventListener.h" #include "JSXMLHttpRequestUpload.h" #include "KURL.h" +#include "RegisteredEventListener.h" #include "XMLHttpRequest.h" #include "XMLHttpRequestUpload.h" #include <runtime/Error.h> @@ -135,7 +136,8 @@ JSXMLHttpRequest::JSXMLHttpRequest(PassRefPtr<Structure> structure, JSDOMGlobalO JSXMLHttpRequest::~JSXMLHttpRequest() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + impl()->invalidateEventListeners(); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSXMLHttpRequest::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestException.cpp b/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestException.cpp index e0bb84c..68c6dc2 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestException.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestException.cpp @@ -150,7 +150,7 @@ JSXMLHttpRequestException::JSXMLHttpRequestException(PassRefPtr<Structure> struc JSXMLHttpRequestException::~JSXMLHttpRequestException() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSXMLHttpRequestException::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestUpload.cpp b/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestUpload.cpp index d806fd24..de57982 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestUpload.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestUpload.cpp @@ -27,6 +27,7 @@ #include "JSDOMGlobalObject.h" #include "JSEvent.h" #include "JSEventListener.h" +#include "RegisteredEventListener.h" #include "XMLHttpRequestUpload.h" #include <runtime/Error.h> #include <wtf/GetPtr.h> @@ -153,7 +154,8 @@ JSXMLHttpRequestUpload::JSXMLHttpRequestUpload(PassRefPtr<Structure> structure, JSXMLHttpRequestUpload::~JSXMLHttpRequestUpload() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + impl()->invalidateEventListeners(); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSXMLHttpRequestUpload::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSXMLSerializer.cpp b/src/3rdparty/webkit/WebCore/generated/JSXMLSerializer.cpp index c4aca93..1e42f0e 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSXMLSerializer.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSXMLSerializer.cpp @@ -144,7 +144,7 @@ JSXMLSerializer::JSXMLSerializer(PassRefPtr<Structure> structure, JSDOMGlobalObj JSXMLSerializer::~JSXMLSerializer() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSXMLSerializer::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSXPathEvaluator.cpp b/src/3rdparty/webkit/WebCore/generated/JSXPathEvaluator.cpp index 33e8643..1e6a324 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSXPathEvaluator.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSXPathEvaluator.cpp @@ -155,7 +155,7 @@ JSXPathEvaluator::JSXPathEvaluator(PassRefPtr<Structure> structure, JSDOMGlobalO JSXPathEvaluator::~JSXPathEvaluator() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSXPathEvaluator::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSXPathException.cpp b/src/3rdparty/webkit/WebCore/generated/JSXPathException.cpp index d822318..1da8e93 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSXPathException.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSXPathException.cpp @@ -145,7 +145,7 @@ JSXPathException::JSXPathException(PassRefPtr<Structure> structure, JSDOMGlobalO JSXPathException::~JSXPathException() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSXPathException::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSXPathExpression.cpp b/src/3rdparty/webkit/WebCore/generated/JSXPathExpression.cpp index a5f4ce3..eaf7e26 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSXPathExpression.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSXPathExpression.cpp @@ -138,7 +138,7 @@ JSXPathExpression::JSXPathExpression(PassRefPtr<Structure> structure, JSDOMGloba JSXPathExpression::~JSXPathExpression() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSXPathExpression::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSXPathNSResolver.cpp b/src/3rdparty/webkit/WebCore/generated/JSXPathNSResolver.cpp index e9dbaa0..fc7a3d2 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSXPathNSResolver.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSXPathNSResolver.cpp @@ -79,7 +79,7 @@ JSXPathNSResolver::JSXPathNSResolver(PassRefPtr<Structure> structure, JSDOMGloba JSXPathNSResolver::~JSXPathNSResolver() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSXPathNSResolver::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSXPathResult.cpp b/src/3rdparty/webkit/WebCore/generated/JSXPathResult.cpp index 44f7bdd..9908dad 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSXPathResult.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSXPathResult.cpp @@ -168,7 +168,7 @@ JSXPathResult::JSXPathResult(PassRefPtr<Structure> structure, JSDOMGlobalObject* JSXPathResult::~JSXPathResult() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSXPathResult::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSXSLTProcessor.cpp b/src/3rdparty/webkit/WebCore/generated/JSXSLTProcessor.cpp index 9e5ccd3..dec1fd4 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSXSLTProcessor.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSXSLTProcessor.cpp @@ -86,7 +86,7 @@ JSXSLTProcessor::JSXSLTProcessor(PassRefPtr<Structure> structure, JSDOMGlobalObj JSXSLTProcessor::~JSXSLTProcessor() { - forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); + forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSObject* JSXSLTProcessor::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/WebKitVersion.h b/src/3rdparty/webkit/WebCore/generated/WebKitVersion.h index e7d6127..5dede20 100644 --- a/src/3rdparty/webkit/WebCore/generated/WebKitVersion.h +++ b/src/3rdparty/webkit/WebCore/generated/WebKitVersion.h @@ -31,6 +31,6 @@ #define WebKitVersion_h #define WEBKIT_MAJOR_VERSION 532 -#define WEBKIT_MINOR_VERSION 0 +#define WEBKIT_MINOR_VERSION 1 #endif //WebKitVersion_h diff --git a/src/3rdparty/webkit/WebCore/history/CachedFrame.cpp b/src/3rdparty/webkit/WebCore/history/CachedFrame.cpp index d542554..16c7087 100644 --- a/src/3rdparty/webkit/WebCore/history/CachedFrame.cpp +++ b/src/3rdparty/webkit/WebCore/history/CachedFrame.cpp @@ -29,11 +29,13 @@ #include "CachedFramePlatformData.h" #include "CString.h" #include "DocumentLoader.h" +#include "ExceptionCode.h" #include "EventNames.h" #include "Frame.h" #include "FrameLoaderClient.h" #include "FrameView.h" #include "Logging.h" +#include "PageTransitionEvent.h" #include <wtf/RefCountedLeakCounter.h> #if ENABLE(SVG) @@ -97,7 +99,7 @@ void CachedFrameBase::restore() for (unsigned i = 0; i < m_childFrames.size(); ++i) m_childFrames[i]->open(); - m_document->dispatchPageTransitionEvent(EventNames().pageshowEvent, true); + m_document->dispatchWindowEvent(PageTransitionEvent::create(EventNames().pageshowEvent, true), m_document); } CachedFrame::CachedFrame(Frame* frame) diff --git a/src/3rdparty/webkit/WebCore/html/HTMLAttributeNames.in b/src/3rdparty/webkit/WebCore/html/HTMLAttributeNames.in index f258bd7..63a5c21 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLAttributeNames.in +++ b/src/3rdparty/webkit/WebCore/html/HTMLAttributeNames.in @@ -167,6 +167,7 @@ onmouseup onmousewheel ononline onoffline +onorientationchange onpagehide onpageshow onpaste diff --git a/src/3rdparty/webkit/WebCore/html/HTMLBodyElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLBodyElement.cpp index 3813177..a356bf3 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLBodyElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLBodyElement.cpp @@ -143,6 +143,10 @@ void HTMLBodyElement::parseMappedAttribute(MappedAttribute *attr) document()->setWindowAttributeEventListener(eventNames().blurEvent, createAttributeEventListener(document()->frame(), attr)); else if (attr->name() == onfocusAttr) document()->setWindowAttributeEventListener(eventNames().focusEvent, createAttributeEventListener(document()->frame(), attr)); +#if ENABLE(ORIENTATION_EVENTS) + else if (attr->name() == onorientationchangeAttr) + document()->setWindowAttributeEventListener(eventNames().orientationchangeEvent, createAttributeEventListener(document()->frame(), attr)); +#endif else if (attr->name() == onhashchangeAttr) document()->setWindowAttributeEventListener(eventNames().hashchangeEvent, createAttributeEventListener(document()->frame(), attr)); else if (attr->name() == onresizeAttr) @@ -322,124 +326,4 @@ void HTMLBodyElement::didMoveToNewOwnerDocument() HTMLElement::didMoveToNewOwnerDocument(); } -EventListener* HTMLBodyElement::onblur() const -{ - return document()->getWindowAttributeEventListener(eventNames().blurEvent); -} - -void HTMLBodyElement::setOnblur(PassRefPtr<EventListener> eventListener) -{ - document()->setWindowAttributeEventListener(eventNames().blurEvent, eventListener); -} - -EventListener* HTMLBodyElement::onerror() const -{ - return document()->getWindowAttributeEventListener(eventNames().errorEvent); -} - -void HTMLBodyElement::setOnerror(PassRefPtr<EventListener> eventListener) -{ - document()->setWindowAttributeEventListener(eventNames().errorEvent, eventListener); -} - -EventListener* HTMLBodyElement::onfocus() const -{ - return document()->getWindowAttributeEventListener(eventNames().focusEvent); -} - -void HTMLBodyElement::setOnfocus(PassRefPtr<EventListener> eventListener) -{ - document()->setWindowAttributeEventListener(eventNames().focusEvent, eventListener); -} - -EventListener* HTMLBodyElement::onload() const -{ - return document()->getWindowAttributeEventListener(eventNames().loadEvent); -} - -void HTMLBodyElement::setOnload(PassRefPtr<EventListener> eventListener) -{ - document()->setWindowAttributeEventListener(eventNames().loadEvent, eventListener); -} - -EventListener* HTMLBodyElement::onbeforeunload() const -{ - return document()->getWindowAttributeEventListener(eventNames().beforeunloadEvent); -} - -void HTMLBodyElement::setOnbeforeunload(PassRefPtr<EventListener> eventListener) -{ - document()->setWindowAttributeEventListener(eventNames().beforeunloadEvent, eventListener); -} - -EventListener* HTMLBodyElement::onhashchange() const -{ - return document()->getWindowAttributeEventListener(eventNames().hashchangeEvent); -} - -void HTMLBodyElement::setOnhashchange(PassRefPtr<EventListener> eventListener) -{ - document()->setWindowAttributeEventListener(eventNames().hashchangeEvent, eventListener); -} - -EventListener* HTMLBodyElement::onmessage() const -{ - return document()->getWindowAttributeEventListener(eventNames().messageEvent); -} - -void HTMLBodyElement::setOnmessage(PassRefPtr<EventListener> eventListener) -{ - document()->setWindowAttributeEventListener(eventNames().messageEvent, eventListener); -} - -EventListener* HTMLBodyElement::onoffline() const -{ - return document()->getWindowAttributeEventListener(eventNames().offlineEvent); -} - -void HTMLBodyElement::setOnoffline(PassRefPtr<EventListener> eventListener) -{ - document()->setWindowAttributeEventListener(eventNames().offlineEvent, eventListener); -} - -EventListener* HTMLBodyElement::ononline() const -{ - return document()->getWindowAttributeEventListener(eventNames().onlineEvent); -} - -void HTMLBodyElement::setOnonline(PassRefPtr<EventListener> eventListener) -{ - document()->setWindowAttributeEventListener(eventNames().onlineEvent, eventListener); -} - -EventListener* HTMLBodyElement::onresize() const -{ - return document()->getWindowAttributeEventListener(eventNames().resizeEvent); -} - -void HTMLBodyElement::setOnresize(PassRefPtr<EventListener> eventListener) -{ - document()->setWindowAttributeEventListener(eventNames().resizeEvent, eventListener); -} - -EventListener* HTMLBodyElement::onstorage() const -{ - return document()->getWindowAttributeEventListener(eventNames().storageEvent); -} - -void HTMLBodyElement::setOnstorage(PassRefPtr<EventListener> eventListener) -{ - document()->setWindowAttributeEventListener(eventNames().storageEvent, eventListener); -} - -EventListener* HTMLBodyElement::onunload() const -{ - return document()->getWindowAttributeEventListener(eventNames().unloadEvent); -} - -void HTMLBodyElement::setOnunload(PassRefPtr<EventListener> eventListener) -{ - document()->setWindowAttributeEventListener(eventNames().unloadEvent, eventListener); -} - } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/html/HTMLBodyElement.h b/src/3rdparty/webkit/WebCore/html/HTMLBodyElement.h index d5efab3..e898c88 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLBodyElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLBodyElement.h @@ -25,6 +25,7 @@ #define HTMLBodyElement_h #include "HTMLElement.h" +#include "Document.h" namespace WebCore { @@ -44,31 +45,23 @@ public: String vLink() const; void setVLink(const String&); - virtual EventListener* onblur() const; - virtual void setOnblur(PassRefPtr<EventListener>); - virtual EventListener* onerror() const; - virtual void setOnerror(PassRefPtr<EventListener>); - virtual EventListener* onfocus() const; - virtual void setOnfocus(PassRefPtr<EventListener>); - virtual EventListener* onload() const; - virtual void setOnload(PassRefPtr<EventListener>); + // Declared virtual in Element + DEFINE_WINDOW_ATTRIBUTE_EVENT_LISTENER(blur); + DEFINE_WINDOW_ATTRIBUTE_EVENT_LISTENER(error); + DEFINE_WINDOW_ATTRIBUTE_EVENT_LISTENER(focus); + DEFINE_WINDOW_ATTRIBUTE_EVENT_LISTENER(load); - EventListener* onbeforeunload() const; - void setOnbeforeunload(PassRefPtr<EventListener>); - EventListener* onmessage() const; - void setOnmessage(PassRefPtr<EventListener>); - EventListener* onhashchange() const; - void setOnhashchange(PassRefPtr<EventListener>); - EventListener* onoffline() const; - void setOnoffline(PassRefPtr<EventListener>); - EventListener* ononline() const; - void setOnonline(PassRefPtr<EventListener>); - EventListener* onresize() const; - void setOnresize(PassRefPtr<EventListener>); - EventListener* onstorage() const; - void setOnstorage(PassRefPtr<EventListener>); - EventListener* onunload() const; - void setOnunload(PassRefPtr<EventListener>); + DEFINE_WINDOW_ATTRIBUTE_EVENT_LISTENER(beforeunload); + DEFINE_WINDOW_ATTRIBUTE_EVENT_LISTENER(message); + DEFINE_WINDOW_ATTRIBUTE_EVENT_LISTENER(hashchange); + DEFINE_WINDOW_ATTRIBUTE_EVENT_LISTENER(offline); + DEFINE_WINDOW_ATTRIBUTE_EVENT_LISTENER(online); + DEFINE_WINDOW_ATTRIBUTE_EVENT_LISTENER(resize); + DEFINE_WINDOW_ATTRIBUTE_EVENT_LISTENER(storage); + DEFINE_WINDOW_ATTRIBUTE_EVENT_LISTENER(unload); +#if ENABLE(ORIENTATION_EVENTS) + DEFINE_WINDOW_ATTRIBUTE_EVENT_LISTENER(orientationchange); +#endif private: virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; } diff --git a/src/3rdparty/webkit/WebCore/html/HTMLBodyElement.idl b/src/3rdparty/webkit/WebCore/html/HTMLBodyElement.idl index 7be6803..2e93e2e 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLBodyElement.idl +++ b/src/3rdparty/webkit/WebCore/html/HTMLBodyElement.idl @@ -44,6 +44,10 @@ module html { attribute [DontEnum] EventListener onstorage; attribute [DontEnum] EventListener onunload; +#if defined(ENABLE_ORIENTATION_EVENTS) && ENABLE_ORIENTATION_EVENTS + attribute [DontEnum] EventListener onorientationchange; +#endif + // Overrides of Element attributes (left in for completeness). // attribute [DontEnum] EventListener onblur; // attribute [DontEnum] EventListener onerror; diff --git a/src/3rdparty/webkit/WebCore/html/HTMLFormControlElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLFormControlElement.cpp index 61e112c..bc74ecf 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLFormControlElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLFormControlElement.cpp @@ -27,6 +27,7 @@ #include "ChromeClient.h" #include "Document.h" +#include "Event.h" #include "EventHandler.h" #include "EventNames.h" #include "Frame.h" @@ -186,7 +187,7 @@ void HTMLFormControlElement::setName(const AtomicString &value) void HTMLFormControlElement::dispatchFormControlChangeEvent() { - dispatchEvent(eventNames().changeEvent, true, false); + dispatchEvent(Event::create(eventNames().changeEvent, true, false)); } bool HTMLFormControlElement::disabled() const @@ -282,7 +283,7 @@ bool HTMLFormControlElement::willValidate() const bool HTMLFormControlElement::checkValidity() { if (willValidate() && !isValidFormControlElement()) { - dispatchEvent(EventNames().invalidEvent, false, true); + dispatchEvent(Event::create(EventNames().invalidEvent, false, true)); return false; } diff --git a/src/3rdparty/webkit/WebCore/html/HTMLFormElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLFormElement.cpp index 9f2d7c2..ace0f2f 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLFormElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLFormElement.cpp @@ -150,14 +150,14 @@ void HTMLFormElement::removedFromDocument() HTMLElement::removedFromDocument(); } -void HTMLFormElement::handleLocalEvents(Event* event, bool useCapture) +void HTMLFormElement::handleLocalEvents(Event* event) { Node* targetNode = event->target()->toNode(); - if (!useCapture && targetNode && targetNode != this && (event->type() == eventNames().submitEvent || event->type() == eventNames().resetEvent)) { + if (event->eventPhase() != Event::CAPTURING_PHASE && targetNode && targetNode != this && (event->type() == eventNames().submitEvent || event->type() == eventNames().resetEvent)) { event->stopPropagation(); return; } - HTMLElement::handleLocalEvents(event, useCapture); + HTMLElement::handleLocalEvents(event); } unsigned HTMLFormElement::length() const @@ -296,7 +296,7 @@ bool HTMLFormElement::prepareSubmit(Event* event) m_insubmit = true; m_doingsubmit = false; - if (dispatchEvent(eventNames().submitEvent, true, true) && !m_doingsubmit) + if (dispatchEvent(Event::create(eventNames().submitEvent, true, true)) && !m_doingsubmit) m_doingsubmit = true; m_insubmit = false; @@ -416,7 +416,7 @@ void HTMLFormElement::reset() // ### DOM2 labels this event as not cancelable, however // common browsers( sick! ) allow it be cancelled. - if ( !dispatchEvent(eventNames().resetEvent, true, true) ) { + if (!dispatchEvent(Event::create(eventNames().resetEvent, true, true))) { m_inreset = false; return; } diff --git a/src/3rdparty/webkit/WebCore/html/HTMLFormElement.h b/src/3rdparty/webkit/WebCore/html/HTMLFormElement.h index af81fcc..a2e9585 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLFormElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLFormElement.h @@ -54,7 +54,7 @@ public: virtual void insertedIntoDocument(); virtual void removedFromDocument(); - virtual void handleLocalEvents(Event*, bool useCapture); + virtual void handleLocalEvents(Event*); PassRefPtr<HTMLCollection> elements(); void getNamedElements(const AtomicString&, Vector<RefPtr<Node> >&); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLFrameSetElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLFrameSetElement.cpp index 8dc3964..cbeba87 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLFrameSetElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLFrameSetElement.cpp @@ -135,6 +135,10 @@ void HTMLFrameSetElement::parseMappedAttribute(MappedAttribute *attr) document()->setWindowAttributeEventListener(eventNames().blurEvent, createAttributeEventListener(document()->frame(), attr)); else if (attr->name() == onfocusAttr) document()->setWindowAttributeEventListener(eventNames().focusEvent, createAttributeEventListener(document()->frame(), attr)); +#if ENABLE(ORIENTATION_EVENTS) + else if (attr->name() == onorientationchangeAttr) + document()->setWindowAttributeEventListener(eventNames().orientationchangeEvent, createAttributeEventListener(document()->frame(), attr)); +#endif else if (attr->name() == onhashchangeAttr) document()->setWindowAttributeEventListener(eventNames().hashchangeEvent, createAttributeEventListener(document()->frame(), attr)); else if (attr->name() == onresizeAttr) @@ -230,124 +234,4 @@ void HTMLFrameSetElement::setRows(const String &value) setAttribute(rowsAttr, value); } -EventListener* HTMLFrameSetElement::onblur() const -{ - return document()->getWindowAttributeEventListener(eventNames().blurEvent); -} - -void HTMLFrameSetElement::setOnblur(PassRefPtr<EventListener> eventListener) -{ - document()->setWindowAttributeEventListener(eventNames().blurEvent, eventListener); -} - -EventListener* HTMLFrameSetElement::onerror() const -{ - return document()->getWindowAttributeEventListener(eventNames().errorEvent); -} - -void HTMLFrameSetElement::setOnerror(PassRefPtr<EventListener> eventListener) -{ - document()->setWindowAttributeEventListener(eventNames().errorEvent, eventListener); -} - -EventListener* HTMLFrameSetElement::onfocus() const -{ - return document()->getWindowAttributeEventListener(eventNames().focusEvent); -} - -void HTMLFrameSetElement::setOnfocus(PassRefPtr<EventListener> eventListener) -{ - document()->setWindowAttributeEventListener(eventNames().focusEvent, eventListener); -} - -EventListener* HTMLFrameSetElement::onhashchange() const -{ - return document()->getWindowAttributeEventListener(eventNames().hashchangeEvent); -} - -void HTMLFrameSetElement::setOnhashchange(PassRefPtr<EventListener> eventListener) -{ - document()->setWindowAttributeEventListener(eventNames().hashchangeEvent, eventListener); -} - -EventListener* HTMLFrameSetElement::onload() const -{ - return document()->getWindowAttributeEventListener(eventNames().loadEvent); -} - -void HTMLFrameSetElement::setOnload(PassRefPtr<EventListener> eventListener) -{ - document()->setWindowAttributeEventListener(eventNames().loadEvent, eventListener); -} - -EventListener* HTMLFrameSetElement::onbeforeunload() const -{ - return document()->getWindowAttributeEventListener(eventNames().beforeunloadEvent); -} - -void HTMLFrameSetElement::setOnbeforeunload(PassRefPtr<EventListener> eventListener) -{ - document()->setWindowAttributeEventListener(eventNames().beforeunloadEvent, eventListener); -} - -EventListener* HTMLFrameSetElement::onmessage() const -{ - return document()->getWindowAttributeEventListener(eventNames().messageEvent); -} - -void HTMLFrameSetElement::setOnmessage(PassRefPtr<EventListener> eventListener) -{ - document()->setWindowAttributeEventListener(eventNames().messageEvent, eventListener); -} - -EventListener* HTMLFrameSetElement::onoffline() const -{ - return document()->getWindowAttributeEventListener(eventNames().offlineEvent); -} - -void HTMLFrameSetElement::setOnoffline(PassRefPtr<EventListener> eventListener) -{ - document()->setWindowAttributeEventListener(eventNames().offlineEvent, eventListener); -} - -EventListener* HTMLFrameSetElement::ononline() const -{ - return document()->getWindowAttributeEventListener(eventNames().onlineEvent); -} - -void HTMLFrameSetElement::setOnonline(PassRefPtr<EventListener> eventListener) -{ - document()->setWindowAttributeEventListener(eventNames().onlineEvent, eventListener); -} - -EventListener* HTMLFrameSetElement::onresize() const -{ - return document()->getWindowAttributeEventListener(eventNames().resizeEvent); -} - -void HTMLFrameSetElement::setOnresize(PassRefPtr<EventListener> eventListener) -{ - document()->setWindowAttributeEventListener(eventNames().resizeEvent, eventListener); -} - -EventListener* HTMLFrameSetElement::onstorage() const -{ - return document()->getWindowAttributeEventListener(eventNames().storageEvent); -} - -void HTMLFrameSetElement::setOnstorage(PassRefPtr<EventListener> eventListener) -{ - document()->setWindowAttributeEventListener(eventNames().storageEvent, eventListener); -} - -EventListener* HTMLFrameSetElement::onunload() const -{ - return document()->getWindowAttributeEventListener(eventNames().unloadEvent); -} - -void HTMLFrameSetElement::setOnunload(PassRefPtr<EventListener> eventListener) -{ - document()->setWindowAttributeEventListener(eventNames().unloadEvent, eventListener); -} - } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/html/HTMLFrameSetElement.h b/src/3rdparty/webkit/WebCore/html/HTMLFrameSetElement.h index b51e702..2b2d7ea 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLFrameSetElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLFrameSetElement.h @@ -24,8 +24,9 @@ #ifndef HTMLFrameSetElement_h #define HTMLFrameSetElement_h -#include "HTMLElement.h" #include "Color.h" +#include "Document.h" +#include "HTMLElement.h" namespace WebCore { @@ -67,32 +68,23 @@ public: const Length* rowLengths() const { return m_rows; } const Length* colLengths() const { return m_cols; } - // Event handler attributes - virtual EventListener* onblur() const; - virtual void setOnblur(PassRefPtr<EventListener>); - virtual EventListener* onerror() const; - virtual void setOnerror(PassRefPtr<EventListener>); - virtual EventListener* onfocus() const; - virtual void setOnfocus(PassRefPtr<EventListener>); - virtual EventListener* onload() const; - virtual void setOnload(PassRefPtr<EventListener>); - - EventListener* onbeforeunload() const; - void setOnbeforeunload(PassRefPtr<EventListener>); - EventListener* onhashchange() const; - void setOnhashchange(PassRefPtr<EventListener>); - EventListener* onmessage() const; - void setOnmessage(PassRefPtr<EventListener>); - EventListener* onoffline() const; - void setOnoffline(PassRefPtr<EventListener>); - EventListener* ononline() const; - void setOnonline(PassRefPtr<EventListener>); - EventListener* onresize() const; - void setOnresize(PassRefPtr<EventListener>); - EventListener* onstorage() const; - void setOnstorage(PassRefPtr<EventListener>); - EventListener* onunload() const; - void setOnunload(PassRefPtr<EventListener>); + // Declared virtual in Element + DEFINE_WINDOW_ATTRIBUTE_EVENT_LISTENER(blur); + DEFINE_WINDOW_ATTRIBUTE_EVENT_LISTENER(error); + DEFINE_WINDOW_ATTRIBUTE_EVENT_LISTENER(focus); + DEFINE_WINDOW_ATTRIBUTE_EVENT_LISTENER(load); + + DEFINE_WINDOW_ATTRIBUTE_EVENT_LISTENER(beforeunload); + DEFINE_WINDOW_ATTRIBUTE_EVENT_LISTENER(hashchange); + DEFINE_WINDOW_ATTRIBUTE_EVENT_LISTENER(message); + DEFINE_WINDOW_ATTRIBUTE_EVENT_LISTENER(offline); + DEFINE_WINDOW_ATTRIBUTE_EVENT_LISTENER(online); + DEFINE_WINDOW_ATTRIBUTE_EVENT_LISTENER(resize); + DEFINE_WINDOW_ATTRIBUTE_EVENT_LISTENER(storage); + DEFINE_WINDOW_ATTRIBUTE_EVENT_LISTENER(unload); +#if ENABLE(ORIENTATION_EVENTS) + DEFINE_WINDOW_ATTRIBUTE_EVENT_LISTENER(orientationchange); +#endif private: Length* m_rows; diff --git a/src/3rdparty/webkit/WebCore/html/HTMLFrameSetElement.idl b/src/3rdparty/webkit/WebCore/html/HTMLFrameSetElement.idl index 0375c0a..b44a071 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLFrameSetElement.idl +++ b/src/3rdparty/webkit/WebCore/html/HTMLFrameSetElement.idl @@ -41,6 +41,10 @@ module html { attribute [DontEnum] EventListener onstorage; attribute [DontEnum] EventListener onunload; +#if defined(ENABLE_ORIENTATION_EVENTS) && ENABLE_ORIENTATION_EVENTS + attribute [DontEnum] EventListener onorientationchange; +#endif + // Overrides of Element attributes (left in for completeness). // attribute [DontEnum] EventListener onblur; // attribute [DontEnum] EventListener onerror; diff --git a/src/3rdparty/webkit/WebCore/html/HTMLImageLoader.cpp b/src/3rdparty/webkit/WebCore/html/HTMLImageLoader.cpp index 2b9f09c..c6f49aa 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLImageLoader.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLImageLoader.cpp @@ -25,6 +25,7 @@ #include "CSSHelper.h" #include "CachedImage.h" #include "Element.h" +#include "Event.h" #include "EventNames.h" #include "HTMLNames.h" #include "HTMLObjectElement.h" @@ -45,7 +46,7 @@ void HTMLImageLoader::dispatchLoadEvent() bool errorOccurred = image()->errorOccurred(); if (!errorOccurred && image()->httpStatusCodeErrorOccurred()) errorOccurred = element()->hasTagName(HTMLNames::objectTag); // An <object> considers a 404 to be an error and should fire onerror. - element()->dispatchEvent(errorOccurred ? eventNames().errorEvent : eventNames().loadEvent, false, false); + element()->dispatchEvent(Event::create(errorOccurred ? eventNames().errorEvent : eventNames().loadEvent, false, false)); } String HTMLImageLoader::sourceURI(const AtomicString& attr) const diff --git a/src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp index 8b884cf..5ba780a 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp @@ -1742,7 +1742,7 @@ void HTMLInputElement::onSearch() ASSERT(isSearchField()); if (renderer()) toRenderTextControlSingleLine(renderer())->stopSearchEventTimer(); - dispatchEvent(eventNames().searchEvent, true, false); + dispatchEvent(Event::create(eventNames().searchEvent, true, false)); } VisibleSelection HTMLInputElement::selection() const diff --git a/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.cpp index 039d6f6..2409d37 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.cpp @@ -463,8 +463,8 @@ void HTMLMediaElement::loadInternal() bool totalKnown = m_player && m_player->totalBytesKnown(); unsigned loaded = m_player ? m_player->bytesLoaded() : 0; unsigned total = m_player ? m_player->totalBytes() : 0; - dispatchProgressEvent(eventNames().abortEvent, totalKnown, loaded, total); - dispatchProgressEvent(eventNames().loadendEvent, totalKnown, loaded, total); + dispatchEvent(ProgressEvent::create(eventNames().abortEvent, totalKnown, loaded, total)); + dispatchEvent(ProgressEvent::create(eventNames().loadendEvent, totalKnown, loaded, total)); } // 5 @@ -487,7 +487,7 @@ void HTMLMediaElement::loadInternal() m_playing = false; m_player->seek(0); } - dispatchEvent(eventNames().emptiedEvent, false, true); + dispatchEvent(Event::create(eventNames().emptiedEvent, false, true)); } selectMediaResource(); @@ -896,6 +896,13 @@ void HTMLMediaElement::returnToRealtime() setCurrentTime(maxTimeSeekable(), e); } +void HTMLMediaElement::addPlayedRange(float start, float end) +{ + if (!m_playedTimeRanges) + m_playedTimeRanges = TimeRanges::create(); + m_playedTimeRanges->add(start, end); +} + bool HTMLMediaElement::supportsSave() const { return m_player ? m_player->supportsSave() : false; @@ -931,7 +938,7 @@ void HTMLMediaElement::seek(float time, ExceptionCode& ec) // 5 if (m_playing) { if (m_lastSeekTime < now) - m_playedTimeRanges->add(m_lastSeekTime, now); + addPlayedRange(m_lastSeekTime, now); } m_lastSeekTime = time; @@ -1483,17 +1490,17 @@ PassRefPtr<TimeRanges> HTMLMediaElement::buffered() const return m_player->buffered(); } -PassRefPtr<TimeRanges> HTMLMediaElement::played() const +PassRefPtr<TimeRanges> HTMLMediaElement::played() { - if (!m_playedTimeRanges) { - // We are not yet loaded - return TimeRanges::create(); - } if (m_playing) { float time = currentTime(); - if (m_lastSeekTime < time) - m_playedTimeRanges->add(m_lastSeekTime, time); + if (time > m_lastSeekTime) + addPlayedRange(m_lastSeekTime, time); } + + if (!m_playedTimeRanges) + m_playedTimeRanges = TimeRanges::create(); + return m_playedTimeRanges->copy(); } @@ -1589,8 +1596,8 @@ void HTMLMediaElement::updatePlayState() m_playbackProgressTimer.stop(); m_playing = false; float time = currentTime(); - if (m_lastSeekTime < time) - m_playedTimeRanges->add(m_lastSeekTime, time); + if (time > m_lastSeekTime) + addPlayedRange(m_lastSeekTime, time); } if (renderer()) @@ -1611,43 +1618,44 @@ void HTMLMediaElement::stopPeriodicTimers() void HTMLMediaElement::userCancelledLoad() { - if (m_networkState != NETWORK_EMPTY) { + if (m_networkState == NETWORK_EMPTY || m_networkState >= NETWORK_LOADED) + return; - // If the media data fetching process is aborted by the user: + // If the media data fetching process is aborted by the user: - // 1 - The user agent should cancel the fetching process. + // 1 - The user agent should cancel the fetching process. #if !ENABLE(PLUGIN_PROXY_FOR_VIDEO) - m_player.clear(); + m_player.clear(); #endif - stopPeriodicTimers(); + stopPeriodicTimers(); - // 2 - Set the error attribute to a new MediaError object whose code attribute is set to MEDIA_ERR_ABORT. - m_error = MediaError::create(MediaError::MEDIA_ERR_ABORTED); + // 2 - Set the error attribute to a new MediaError object whose code attribute is set to MEDIA_ERR_ABORT. + m_error = MediaError::create(MediaError::MEDIA_ERR_ABORTED); - // 3 - Queue a task to fire a progress event called abort at the media element, in the context - // of the fetching process started by this instance of this algorithm. - scheduleProgressEvent(eventNames().abortEvent); - - // 4 - Queue a task to fire a progress event called loadend at the media element, in the context - // of the fetching process started by this instance of this algorithm. - scheduleProgressEvent(eventNames().loadendEvent); - - // 5 - If the media element's readyState attribute has a value equal to HAVE_NOTHING, set the - // element's networkState attribute to the NETWORK_EMPTY value and queue a task to fire a - // simple event called emptied at the element. Otherwise, set set the element's networkState - // attribute to the NETWORK_IDLE value. - if (m_networkState >= NETWORK_LOADING) { - m_networkState = NETWORK_EMPTY; - m_readyState = HAVE_NOTHING; - scheduleEvent(eventNames().emptiedEvent); - } + // 3 - Queue a task to fire a progress event called abort at the media element, in the context + // of the fetching process started by this instance of this algorithm. + scheduleProgressEvent(eventNames().abortEvent); - // 6 - Set the element's delaying-the-load-event flag to false. This stops delaying the load event. - m_delayingTheLoadEvent = false; + // 4 - Queue a task to fire a progress event called loadend at the media element, in the context + // of the fetching process started by this instance of this algorithm. + scheduleProgressEvent(eventNames().loadendEvent); - // 7 - Abort the overall resource selection algorithm. - m_currentSourceNode = 0; + // 5 - If the media element's readyState attribute has a value equal to HAVE_NOTHING, set the + // element's networkState attribute to the NETWORK_EMPTY value and queue a task to fire a + // simple event called emptied at the element. Otherwise, set set the element's networkState + // attribute to the NETWORK_IDLE value. + if (m_readyState == HAVE_NOTHING) { + m_networkState = NETWORK_EMPTY; + scheduleEvent(eventNames().emptiedEvent); } + else + m_networkState = NETWORK_IDLE; + + // 6 - Set the element's delaying-the-load-event flag to false. This stops delaying the load event. + m_delayingTheLoadEvent = false; + + // 7 - Abort the overall resource selection algorithm. + m_currentSourceNode = 0; } void HTMLMediaElement::documentWillBecomeInactive() diff --git a/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.h b/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.h index 3aeb653..aa8d5f7 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.h @@ -120,7 +120,7 @@ public: void setPlaybackRate(float); bool webkitPreservesPitch() const; void setWebkitPreservesPitch(bool); - PassRefPtr<TimeRanges> played() const; + PassRefPtr<TimeRanges> played(); PassRefPtr<TimeRanges> seekable() const; bool ended() const; bool autoplay() const; @@ -193,6 +193,7 @@ private: void seek(float time, ExceptionCode&); void finishSeek(); void checkIfSeekNeeded(); + void addPlayedRange(float start, float end); void scheduleTimeupdateEvent(bool periodicEvent); void scheduleProgressEvent(const AtomicString& eventName); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLScriptElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLScriptElement.cpp index 86cc3a2..ce7fee6 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLScriptElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLScriptElement.cpp @@ -24,6 +24,7 @@ #include "HTMLScriptElement.h" #include "Document.h" +#include "Event.h" #include "EventNames.h" #include "HTMLNames.h" #include "MappedAttribute.h" @@ -222,12 +223,12 @@ void HTMLScriptElement::dispatchLoadEvent() ASSERT(!m_data.haveFiredLoadEvent()); m_data.setHaveFiredLoadEvent(true); - dispatchEvent(eventNames().loadEvent, false, false); + dispatchEvent(Event::create(eventNames().loadEvent, false, false)); } void HTMLScriptElement::dispatchErrorEvent() { - dispatchEvent(eventNames().errorEvent, true, false); + dispatchEvent(Event::create(eventNames().errorEvent, true, false)); } } diff --git a/src/3rdparty/webkit/WebCore/html/HTMLSourceElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLSourceElement.cpp index 2f09997..4b9401d 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLSourceElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLSourceElement.cpp @@ -28,6 +28,7 @@ #if ENABLE(VIDEO) #include "HTMLSourceElement.h" +#include "Event.h" #include "EventNames.h" #include "HTMLDocument.h" #include "HTMLMediaElement.h" @@ -105,7 +106,7 @@ void HTMLSourceElement::cancelPendingErrorEvent() void HTMLSourceElement::errorEventTimerFired(Timer<HTMLSourceElement>*) { - dispatchEvent(eventNames().errorEvent, false, true); + dispatchEvent(Event::create(eventNames().errorEvent, false, true)); } } diff --git a/src/3rdparty/webkit/WebCore/html/HTMLTextAreaElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLTextAreaElement.cpp index d3fc897..3cf4852 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLTextAreaElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLTextAreaElement.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "HTMLTextAreaElement.h" +#include "BeforeTextInsertedEvent.h" #include "ChromeClient.h" #include "CSSValueKeywords.h" #include "Document.h" @@ -35,12 +36,14 @@ #include "FormDataList.h" #include "Frame.h" #include "HTMLNames.h" +#include "InputElement.h" #include "MappedAttribute.h" #include "Page.h" #include "RenderStyle.h" #include "RenderTextControlMultiLine.h" #include "ScriptEventListener.h" #include "Text.h" +#include "TextIterator.h" #include "VisibleSelection.h" #include <wtf/StdLibExtras.h> @@ -270,10 +273,34 @@ void HTMLTextAreaElement::defaultEventHandler(Event* event) { if (renderer() && (event->isMouseEvent() || event->isDragEvent() || event->isWheelEvent() || event->type() == eventNames().blurEvent)) toRenderTextControlMultiLine(renderer())->forwardEvent(event); + else if (renderer() && event->isBeforeTextInsertedEvent()) + handleBeforeTextInsertedEvent(static_cast<BeforeTextInsertedEvent*>(event)); HTMLFormControlElementWithState::defaultEventHandler(event); } +void HTMLTextAreaElement::handleBeforeTextInsertedEvent(BeforeTextInsertedEvent* event) const +{ + ASSERT(event); + ASSERT(renderer()); + bool ok; + unsigned maxLength = getAttribute(maxlengthAttr).string().toUInt(&ok); + if (!ok) + return; + + unsigned currentLength = toRenderTextControl(renderer())->text().numGraphemeClusters(); + unsigned selectionLength = plainText(document()->frame()->selection()->selection().toNormalizedRange().get()).numGraphemeClusters(); + ASSERT(currentLength >= selectionLength); + unsigned baseLength = currentLength - selectionLength; + unsigned appendableLength = maxLength > baseLength ? maxLength - baseLength : 0; + event->setText(sanitizeUserInputValue(event->text(), appendableLength)); +} + +String HTMLTextAreaElement::sanitizeUserInputValue(const String& proposedValue, unsigned maxLength) +{ + return proposedValue.left(proposedValue.numCharactersInGraphemeClusters(maxLength)); +} + void HTMLTextAreaElement::rendererWillBeDestroyed() { updateValue(); @@ -374,6 +401,16 @@ void HTMLTextAreaElement::setDefaultValue(const String& defaultValue) setValue(value); } +unsigned HTMLTextAreaElement::maxLength() const +{ + return getAttribute(maxlengthAttr).string().toUInt(); +} + +void HTMLTextAreaElement::setMaxLength(unsigned newValue) +{ + setAttribute(maxlengthAttr, String::number(newValue)); +} + void HTMLTextAreaElement::accessKeyAction(bool) { focus(); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLTextAreaElement.h b/src/3rdparty/webkit/WebCore/html/HTMLTextAreaElement.h index 1f5cb91..fbf519d 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLTextAreaElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLTextAreaElement.h @@ -28,6 +28,7 @@ namespace WebCore { +class BeforeTextInsertedEvent; class VisibleSelection; class HTMLTextAreaElement : public HTMLFormControlElementWithState { @@ -78,6 +79,8 @@ public: String defaultValue() const; void setDefaultValue(const String&); int textLength() const { return value().length(); } + unsigned maxLength() const; + void setMaxLength(unsigned); void rendererWillBeDestroyed(); @@ -99,6 +102,8 @@ public: private: enum WrapMethod { NoWrap, SoftWrap, HardWrap }; + void handleBeforeTextInsertedEvent(BeforeTextInsertedEvent*) const; + static String sanitizeUserInputValue(const String&, unsigned maxLength); void updateValue() const; void updatePlaceholderVisibility(bool placeholderValueChanged); virtual void dispatchFocusEvent(); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLTextAreaElement.idl b/src/3rdparty/webkit/WebCore/html/HTMLTextAreaElement.idl index 6d27f54..84583f5 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLTextAreaElement.idl +++ b/src/3rdparty/webkit/WebCore/html/HTMLTextAreaElement.idl @@ -34,6 +34,7 @@ module html { attribute long cols; attribute boolean disabled; attribute boolean autofocus; + attribute unsigned long maxLength; attribute [ConvertNullToNullString] DOMString name; attribute [ConvertNullToNullString, Reflect] DOMString placeholder; attribute boolean readOnly; diff --git a/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp b/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp index 71faac0..fa68151 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp @@ -33,6 +33,7 @@ #include "CachedScript.h" #include "DocLoader.h" #include "DocumentFragment.h" +#include "Event.h" #include "EventNames.h" #include "Frame.h" #include "FrameLoader.h" @@ -2029,7 +2030,7 @@ void HTMLTokenizer::notifyFinished(CachedResource*) #endif if (errorOccurred) - n->dispatchEvent(eventNames().errorEvent, true, false); + n->dispatchEvent(Event::create(eventNames().errorEvent, true, false)); else { if (static_cast<HTMLScriptElement*>(n.get())->shouldExecuteAsJavaScript()) m_state = scriptExecution(sourceCode, m_state); @@ -2037,7 +2038,7 @@ void HTMLTokenizer::notifyFinished(CachedResource*) else m_doc->setShouldProcessNoscriptElement(true); #endif - n->dispatchEvent(eventNames().loadEvent, false, false); + n->dispatchEvent(Event::create(eventNames().loadEvent, false, false)); } // The state of m_pendingScripts.isEmpty() can change inside the scriptExecution() diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.cpp index 1e3faa3..ed462fc 100644 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.cpp +++ b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.cpp @@ -935,16 +935,13 @@ static inline FloatRect normalizeRect(const FloatRect& rect) void CanvasRenderingContext2D::checkOrigin(const KURL& url) { - RefPtr<SecurityOrigin> origin = SecurityOrigin::create(url); - if (!m_canvas->document()->securityOrigin()->canAccess(origin.get())) + if (m_canvas->document()->securityOrigin()->taintsCanvas(url)) m_canvas->setOriginTainted(); } void CanvasRenderingContext2D::checkOrigin(const String& url) { - RefPtr<SecurityOrigin> origin = SecurityOrigin::createFromString(url); - if (!m_canvas->document()->securityOrigin()->canAccess(origin.get())) - m_canvas->setOriginTainted(); + checkOrigin(KURL(KURL(), url)); } void CanvasRenderingContext2D::drawImage(HTMLImageElement* image, float x, float y) @@ -1208,8 +1205,7 @@ PassRefPtr<CanvasPattern> CanvasRenderingContext2D::createPattern(HTMLImageEleme if (!cachedImage || !image->cachedImage()->image()) return CanvasPattern::create(Image::nullImage(), repeatX, repeatY, true); - RefPtr<SecurityOrigin> origin = SecurityOrigin::createFromString(cachedImage->url()); - bool originClean = m_canvas->document()->securityOrigin()->canAccess(origin.get()); + bool originClean = !m_canvas->document()->securityOrigin()->taintsCanvas(KURL(KURL(), cachedImage->url())); return CanvasPattern::create(cachedImage->image(), repeatX, repeatY, originClean); } diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorBackend.cpp b/src/3rdparty/webkit/WebCore/inspector/InspectorBackend.cpp index 25034fa..c140b13 100644 --- a/src/3rdparty/webkit/WebCore/inspector/InspectorBackend.cpp +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorBackend.cpp @@ -502,8 +502,26 @@ void InspectorBackend::selectDatabase(Database* database) #if ENABLE(DOM_STORAGE) void InspectorBackend::selectDOMStorage(Storage* storage) { - if (InspectorFrontend* frontend = inspectorFrontend()) - frontend->selectDOMStorage(storage); + if (m_inspectorController) + m_inspectorController->selectDOMStorage(storage); +} + +void InspectorBackend::getDOMStorageEntries(long callId, long storageId) +{ + if (m_inspectorController) + m_inspectorController->getDOMStorageEntries(callId, storageId); +} + +void InspectorBackend::setDOMStorageItem(long callId, long storageId, const String& key, const String& value) +{ + if (m_inspectorController) + m_inspectorController->setDOMStorageItem(callId, storageId, key, value); +} + +void InspectorBackend::removeDOMStorageItem(long callId, long storageId, const String& key) +{ + if (m_inspectorController) + m_inspectorController->removeDOMStorageItem(callId, storageId, key); } #endif diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorBackend.h b/src/3rdparty/webkit/WebCore/inspector/InspectorBackend.h index 22b46bf..038ae14 100644 --- a/src/3rdparty/webkit/WebCore/inspector/InspectorBackend.h +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorBackend.h @@ -151,6 +151,9 @@ public: #endif #if ENABLE(DOM_STORAGE) void selectDOMStorage(Storage* storage); + void getDOMStorageEntries(long callId, long storageId); + void setDOMStorageItem(long callId, long storageId, const String& key, const String& value); + void removeDOMStorageItem(long callId, long storageId, const String& key); #endif private: diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorBackend.idl b/src/3rdparty/webkit/WebCore/inspector/InspectorBackend.idl index 4540001..395e7fd 100644 --- a/src/3rdparty/webkit/WebCore/inspector/InspectorBackend.idl +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorBackend.idl @@ -121,6 +121,9 @@ module core { #endif #if defined(ENABLE_DOM_STORAGE) && ENABLE_DOM_STORAGE [Custom] void selectDOMStorage(in DOMObject storage); + void getDOMStorageEntries(in long callId, in long storageId); + void setDOMStorageItem(in long callId, in long storageId, in DOMString key, in DOMString value); + void removeDOMStorageItem(in long callId, in long storageId, in DOMString key); #endif }; } diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorController.cpp b/src/3rdparty/webkit/WebCore/inspector/InspectorController.cpp index 6498d84..69a7e60 100644 --- a/src/3rdparty/webkit/WebCore/inspector/InspectorController.cpp +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorController.cpp @@ -39,6 +39,7 @@ #include "CookieJar.h" #include "Document.h" #include "DocumentLoader.h" +#include "DOMWindow.h" #include "Element.h" #include "FloatConversion.h" #include "FloatQuad.h" @@ -643,6 +644,10 @@ void InspectorController::populateScriptObjects() if (!m_frontend) return; + // Initialize dom agent and reset injected script state first. + if (m_domAgent->setDocument(m_inspectedPage->mainFrame()->document())) + resetInjectedScript(); + ResourcesMap::iterator resourcesEnd = m_resources.end(); for (ResourcesMap::iterator it = m_resources.begin(); it != resourcesEnd; ++it) it->second->createScriptObject(m_frontend.get()); @@ -662,8 +667,6 @@ void InspectorController::populateScriptObjects() (*it)->bind(m_frontend.get()); #endif - if (m_domAgent->setDocument(m_inspectedPage->mainFrame()->document())) - resetInjectedScript(); m_frontend->populateInterface(); } @@ -731,6 +734,9 @@ void InspectorController::didCommitLoad(DocumentLoader* loader) m_currentUserInitiatedProfileNumber = 1; m_nextUserInitiatedProfileNumber = 1; #endif + // resetScriptObjects should be called before database and DOM storage + // resources are cleared so that it has a chance to unbind them. + resetScriptObjects(); #if ENABLE(DATABASE) m_databaseResources.clear(); #endif @@ -739,8 +745,6 @@ void InspectorController::didCommitLoad(DocumentLoader* loader) #endif if (m_frontend) { - resetScriptObjects(); - if (!loader->frameLoader()->isLoadingFromCachedPage()) { ASSERT(m_mainResource && m_mainResource->isSameLoader(loader)); // We don't add the main resource until its load is committed. This is @@ -1108,6 +1112,86 @@ void InspectorController::didUseDOMStorage(StorageArea* storageArea, bool isLoca if (m_frontend) resource->bind(m_frontend.get()); } + +void InspectorController::selectDOMStorage(Storage* storage) +{ + ASSERT(storage); + if (!m_frontend) + return; + + Frame* frame = storage->frame(); + bool isLocalStorage = (frame->domWindow()->localStorage() == storage); + int storageResourceId = 0; + DOMStorageResourcesSet::iterator domStorageEnd = m_domStorageResources.end(); + for (DOMStorageResourcesSet::iterator it = m_domStorageResources.begin(); it != domStorageEnd; ++it) { + if ((*it)->isSameHostAndType(frame, isLocalStorage)) { + storageResourceId = (*it)->id(); + break; + } + } + if (storageResourceId) + m_frontend->selectDOMStorage(storageResourceId); +} + +void InspectorController::getDOMStorageEntries(int callId, int storageId) +{ + if (!m_frontend) + return; + + ScriptArray jsonArray = m_frontend->newScriptArray(); + InspectorDOMStorageResource* storageResource = getDOMStorageResourceForId(storageId); + if (storageResource) { + storageResource->startReportingChangesToFrontend(); + Storage* domStorage = storageResource->domStorage(); + for (unsigned i = 0; i < domStorage->length(); ++i) { + String name(domStorage->key(i)); + String value(domStorage->getItem(name)); + ScriptArray entry = m_frontend->newScriptArray(); + entry.set(0, name); + entry.set(1, value); + jsonArray.set(i, entry); + } + } + m_frontend->didGetDOMStorageEntries(callId, jsonArray); +} + +void InspectorController::setDOMStorageItem(long callId, long storageId, const String& key, const String& value) +{ + if (!m_frontend) + return; + + bool success = false; + InspectorDOMStorageResource* storageResource = getDOMStorageResourceForId(storageId); + if (storageResource) { + ExceptionCode exception = 0; + storageResource->domStorage()->setItem(key, value, exception); + success = (exception == 0); + } + m_frontend->didSetDOMStorageItem(callId, success); +} + +void InspectorController::removeDOMStorageItem(long callId, long storageId, const String& key) +{ + if (!m_frontend) + return; + + bool success = false; + InspectorDOMStorageResource* storageResource = getDOMStorageResourceForId(storageId); + if (storageResource) { + storageResource->domStorage()->removeItem(key); + success = true; + } + m_frontend->didRemoveDOMStorageItem(callId, success); +} + +InspectorDOMStorageResource* InspectorController::getDOMStorageResourceForId(int storageId) +{ + DOMStorageResourcesSet::iterator domStorageEnd = m_domStorageResources.end(); + for (DOMStorageResourcesSet::iterator it = m_domStorageResources.begin(); it != domStorageEnd; ++it) + if ((*it)->id() == storageId) + return it->get(); + return 0; +} #endif void InspectorController::moveWindowBy(float x, float y) const @@ -1531,18 +1615,17 @@ InspectorController::SpecialPanels InspectorController::specialPanelForJSName(co ScriptValue InspectorController::wrapObject(const ScriptValue& quarantinedObject) { + ScriptFunctionCall function(m_scriptState, m_injectedScriptObj, "createProxyObject"); + function.appendArgument(quarantinedObject); if (quarantinedObject.isObject()) { long id = m_lastBoundObjectId++; String objectId = String::format("object#%ld", id); m_idToConsoleObject.set(objectId, quarantinedObject); - ScriptFunctionCall function(m_scriptState, m_injectedScriptObj, "createProxyObject"); - function.appendArgument(quarantinedObject); function.appendArgument(objectId); - ScriptValue wrapper = function.call(); - return wrapper; } - return quarantinedObject; + ScriptValue wrapper = function.call(); + return wrapper; } ScriptValue InspectorController::unwrapObject(const String& objectId) diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorController.h b/src/3rdparty/webkit/WebCore/inspector/InspectorController.h index f3e230e..20295aa 100644 --- a/src/3rdparty/webkit/WebCore/inspector/InspectorController.h +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorController.h @@ -74,6 +74,7 @@ class ResourceError; class ScriptCallStack; class ScriptString; class SharedBuffer; +class Storage; class StorageArea; class ConsoleMessage; @@ -232,6 +233,10 @@ public: #endif #if ENABLE(DOM_STORAGE) void didUseDOMStorage(StorageArea* storageArea, bool isLocalStorage, Frame* frame); + void selectDOMStorage(Storage* storage); + void getDOMStorageEntries(int callId, int storageId); + void setDOMStorageItem(long callId, long storageId, const String& key, const String& value); + void removeDOMStorageItem(long callId, long storageId, const String& key); #endif const ResourcesMap& resources() const { return m_resources; } @@ -301,6 +306,9 @@ private: void toggleRecordButton(bool); void enableDebuggerFromFrontend(bool always); #endif +#if ENABLE(DOM_STORAGE) + InspectorDOMStorageResource* getDOMStorageResourceForId(int storageId); +#endif void focusNode(); diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorDOMAgent.cpp b/src/3rdparty/webkit/WebCore/inspector/InspectorDOMAgent.cpp index c7299d6..4a4902d 100644 --- a/src/3rdparty/webkit/WebCore/inspector/InspectorDOMAgent.cpp +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorDOMAgent.cpp @@ -123,7 +123,7 @@ void InspectorDOMAgent::stopListening(Document* doc) m_documents.remove(doc); } -void InspectorDOMAgent::handleEvent(Event* event, bool) +void InspectorDOMAgent::handleEvent(Event* event) { AtomicString type = event->type(); Node* node = event->target()->toNode(); diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorDOMAgent.h b/src/3rdparty/webkit/WebCore/inspector/InspectorDOMAgent.h index 3f4eaf5..bd539a5 100644 --- a/src/3rdparty/webkit/WebCore/inspector/InspectorDOMAgent.h +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorDOMAgent.h @@ -85,7 +85,7 @@ namespace WebCore { void startListening(Document* document); void stopListening(Document* document); - virtual void handleEvent(Event* event, bool isWindowEvent); + virtual void handleEvent(Event* event); typedef HashMap<RefPtr<Node>, long> NodeToIdMap; long bind(Node* node, NodeToIdMap* nodesMap); diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorDOMStorageResource.cpp b/src/3rdparty/webkit/WebCore/inspector/InspectorDOMStorageResource.cpp index 2f4aa53..99a2dba 100644 --- a/src/3rdparty/webkit/WebCore/inspector/InspectorDOMStorageResource.cpp +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorDOMStorageResource.cpp @@ -35,21 +35,28 @@ #include "InspectorDOMStorageResource.h" #include "Document.h" +#include "DOMWindow.h" +#include "EventNames.h" #include "Frame.h" #include "InspectorFrontend.h" #include "ScriptObject.h" -#include "ScriptObjectQuarantine.h" #include "Storage.h" +#include "StorageEvent.h" using namespace JSC; namespace WebCore { +int InspectorDOMStorageResource::s_nextUnusedId = 1; + InspectorDOMStorageResource::InspectorDOMStorageResource(Storage* domStorage, bool isLocalStorage, Frame* frame) - : m_domStorage(domStorage) + : EventListener(InspectorDOMStorageResourceType) + , m_domStorage(domStorage) , m_isLocalStorage(isLocalStorage) , m_frame(frame) - , m_scriptObjectCreated(false) + , m_frontend(0) + , m_id(s_nextUnusedId++) + , m_reportingChangesToFrontend(false) { } @@ -60,23 +67,49 @@ bool InspectorDOMStorageResource::isSameHostAndType(Frame* frame, bool isLocalSt void InspectorDOMStorageResource::bind(InspectorFrontend* frontend) { - if (m_scriptObjectCreated) - return; + ASSERT(!m_frontend); + m_frontend = frontend; ScriptObject jsonObject = frontend->newScriptObject(); - ScriptObject domStorage; - if (!getQuarantinedScriptObject(m_domStorage.get(), domStorage)) - return; - jsonObject.set("domStorage", domStorage); jsonObject.set("host", m_frame->document()->securityOrigin()->host()); jsonObject.set("isLocalStorage", m_isLocalStorage); - if (frontend->addDOMStorage(jsonObject)) - m_scriptObjectCreated = true; + jsonObject.set("id", m_id); + frontend->addDOMStorage(jsonObject); } void InspectorDOMStorageResource::unbind() { - m_scriptObjectCreated = false; + ASSERT(m_frontend); + if (m_reportingChangesToFrontend) { + m_frame->domWindow()->removeEventListener(eventNames().storageEvent, this, true); + m_reportingChangesToFrontend = false; + } + m_frontend = 0; +} + +void InspectorDOMStorageResource::startReportingChangesToFrontend() +{ + ASSERT(m_frontend); + if (!m_reportingChangesToFrontend) { + m_frame->domWindow()->addEventListener(eventNames().storageEvent, this, true); + m_reportingChangesToFrontend = true; + } +} + +void InspectorDOMStorageResource::handleEvent(Event* event) +{ + ASSERT(m_frontend); + ASSERT(eventNames().storageEvent == event->type()); + StorageEvent* storageEvent = static_cast<StorageEvent*>(event); + Storage* storage = storageEvent->storageArea(); + bool isLocalStorage = storageEvent->source()->localStorage() == storage; + if (isSameHostAndType(storage->frame(), isLocalStorage)) + m_frontend->updateDOMStorage(m_id); +} + +bool InspectorDOMStorageResource::operator==(const EventListener& listener) +{ + return (this == InspectorDOMStorageResource::cast(&listener)); } } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorDOMStorageResource.h b/src/3rdparty/webkit/WebCore/inspector/InspectorDOMStorageResource.h index 3e05897..6f29d9d 100644 --- a/src/3rdparty/webkit/WebCore/inspector/InspectorDOMStorageResource.h +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorDOMStorageResource.h @@ -33,6 +33,7 @@ #if ENABLE(DOM_STORAGE) +#include "EventListener.h" #include "ScriptObject.h" #include "ScriptState.h" @@ -46,17 +47,27 @@ namespace WebCore { class Frame; class InspectorFrontend; - class InspectorDOMStorageResource : public RefCounted<InspectorDOMStorageResource> { + class InspectorDOMStorageResource : public EventListener { public: static PassRefPtr<InspectorDOMStorageResource> create(Storage* domStorage, bool isLocalStorage, Frame* frame) { return adoptRef(new InspectorDOMStorageResource(domStorage, isLocalStorage, frame)); } + static const InspectorDOMStorageResource* cast(const EventListener* listener) + { + return listener->type() == InspectorDOMStorageResourceType ? static_cast<const InspectorDOMStorageResource*>(listener) : 0; + } void bind(InspectorFrontend* frontend); void unbind(); + void startReportingChangesToFrontend(); + + virtual void handleEvent(Event*); + virtual bool operator==(const EventListener& listener); bool isSameHostAndType(Frame*, bool isLocalStorage) const; + long id() const { return m_id; } + Storage* domStorage() const { return m_domStorage.get(); } private: @@ -65,8 +76,11 @@ namespace WebCore { RefPtr<Storage> m_domStorage; bool m_isLocalStorage; RefPtr<Frame> m_frame; - bool m_scriptObjectCreated; + InspectorFrontend* m_frontend; + int m_id; + bool m_reportingChangesToFrontend; + static int s_nextUnusedId; }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorFrontend.cpp b/src/3rdparty/webkit/WebCore/inspector/InspectorFrontend.cpp index c8a2f5c..3bdfa97 100644 --- a/src/3rdparty/webkit/WebCore/inspector/InspectorFrontend.cpp +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorFrontend.cpp @@ -83,8 +83,13 @@ void InspectorFrontend::addMessageToConsole(const ScriptObject& messageObj, cons } else if (!wrappedArguments.isEmpty()) { for (unsigned i = 0; i < wrappedArguments.size(); ++i) function->appendArgument(m_inspectorController->wrapObject(wrappedArguments[i])); - } else - function->appendArgument(message); + } else { + // FIXME: avoid manual wrapping here. + ScriptObject textWrapper = ScriptObject::createNew(m_scriptState); + textWrapper.set("type", "string"); + textWrapper.set("description", message); + function->appendArgument(textWrapper); + } function->call(); } @@ -399,13 +404,41 @@ void InspectorFrontend::selectDatabase(Database* database) #endif #if ENABLE(DOM_STORAGE) -void InspectorFrontend::selectDOMStorage(Storage* storage) +void InspectorFrontend::selectDOMStorage(int storageId) { OwnPtr<ScriptFunctionCall> function(newFunctionCall("selectDOMStorage")); - ScriptObject quarantinedObject; - if (!getQuarantinedScriptObject(storage, quarantinedObject)) - return; - function->appendArgument(quarantinedObject); + function->appendArgument(storageId); + function->call(); +} + +void InspectorFrontend::didGetDOMStorageEntries(int callId, const ScriptArray& entries) +{ + OwnPtr<ScriptFunctionCall> function(newFunctionCall("didGetDOMStorageEntries")); + function->appendArgument(callId); + function->appendArgument(entries); + function->call(); +} + +void InspectorFrontend::didSetDOMStorageItem(int callId, bool success) +{ + OwnPtr<ScriptFunctionCall> function(newFunctionCall("didSetDOMStorageItem")); + function->appendArgument(callId); + function->appendArgument(success); + function->call(); +} + +void InspectorFrontend::didRemoveDOMStorageItem(int callId, bool success) +{ + OwnPtr<ScriptFunctionCall> function(newFunctionCall("didRemoveDOMStorageItem")); + function->appendArgument(callId); + function->appendArgument(success); + function->call(); +} + +void InspectorFrontend::updateDOMStorage(int storageId) +{ + OwnPtr<ScriptFunctionCall> function(newFunctionCall("updateDOMStorage")); + function->appendArgument(storageId); function->call(); } #endif diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorFrontend.h b/src/3rdparty/webkit/WebCore/inspector/InspectorFrontend.h index 42768e6..f9d3ba1 100644 --- a/src/3rdparty/webkit/WebCore/inspector/InspectorFrontend.h +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorFrontend.h @@ -99,7 +99,11 @@ namespace WebCore { #if ENABLE(DOM_STORAGE) bool addDOMStorage(const ScriptObject& domStorageObj); - void selectDOMStorage(Storage* storage); + void selectDOMStorage(int storageId); + void didGetDOMStorageEntries(int callId, const ScriptArray& entries); + void didSetDOMStorageItem(int callId, bool success); + void didRemoveDOMStorageItem(int callId, bool success); + void updateDOMStorage(int storageId); #endif void setDocument(const ScriptObject& root); diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorResource.cpp b/src/3rdparty/webkit/WebCore/inspector/InspectorResource.cpp index 54d9f92..484a0bd 100644 --- a/src/3rdparty/webkit/WebCore/inspector/InspectorResource.cpp +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorResource.cpp @@ -264,32 +264,8 @@ String InspectorResource::sourceString() const if (!m_xmlHttpResponseText.isNull()) return String(m_xmlHttpResponseText); - RefPtr<SharedBuffer> buffer; String textEncodingName; - - if (m_requestURL == m_loader->requestURL()) { - buffer = m_loader->mainResourceData(); - textEncodingName = m_frame->document()->inputEncoding(); - } else { - CachedResource* cachedResource = m_frame->document()->docLoader()->cachedResource(requestURL()); - if (!cachedResource) - return String(); - - if (cachedResource->isPurgeable()) { - // If the resource is purgeable then make it unpurgeable to get - // get its data. This might fail, in which case we return an - // empty String. - // FIXME: should we do something else in the case of a purged - // resource that informs the user why there is no data in the - // inspector? - if (!cachedResource->makePurgeable(false)) - return String(); - } - - buffer = cachedResource->data(); - textEncodingName = cachedResource->encoding(); - } - + RefPtr<SharedBuffer> buffer = resourceData(&textEncodingName); if (!buffer) return String(); @@ -299,6 +275,31 @@ String InspectorResource::sourceString() const return encoding.decode(buffer->data(), buffer->size()); } +PassRefPtr<SharedBuffer> InspectorResource::resourceData(String* textEncodingName) const { + if (m_requestURL == m_loader->requestURL()) { + *textEncodingName = m_frame->document()->inputEncoding(); + return m_loader->mainResourceData(); + } + + CachedResource* cachedResource = m_frame->document()->docLoader()->cachedResource(requestURL()); + if (!cachedResource) + return 0; + + if (cachedResource->isPurgeable()) { + // If the resource is purgeable then make it unpurgeable to get + // get its data. This might fail, in which case we return an + // empty String. + // FIXME: should we do something else in the case of a purged + // resource that informs the user why there is no data in the + // inspector? + if (!cachedResource->makePurgeable(false)) + return 0; + } + + *textEncodingName = cachedResource->encoding(); + return cachedResource->data(); +} + void InspectorResource::startTiming() { m_startTime = currentTime(); diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorResource.h b/src/3rdparty/webkit/WebCore/inspector/InspectorResource.h index 4c85315..5e37e41 100644 --- a/src/3rdparty/webkit/WebCore/inspector/InspectorResource.h +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorResource.h @@ -87,12 +87,20 @@ namespace WebCore { void setXMLHttpResponseText(const ScriptString& data); String sourceString() const; + PassRefPtr<SharedBuffer> resourceData(String* textEncodingName) const; + bool isSameLoader(DocumentLoader* loader) const { return loader == m_loader; } void markMainResource() { m_isMainResource = true; } long long identifier() const { return m_identifier; } String requestURL() const { return m_requestURL.string(); } Frame* frame() const { return m_frame.get(); } const String& mimeType() const { return m_mimeType; } + const HTTPHeaderMap& requestHeaderFields() const { return m_requestHeaderFields; } + const HTTPHeaderMap& responseHeaderFields() const { return m_responseHeaderFields; } + int responseStatusCode() const { return m_responseStatusCode; } + String requestMethod() const { return m_requestMethod; } + String requestFormData() const { return m_requestFormData; } + void startTiming(); void markResponseReceivedTime(); void endTiming(); diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/ConsoleView.js b/src/3rdparty/webkit/WebCore/inspector/front-end/ConsoleView.js index 41b14ef..575b13a 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/ConsoleView.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/ConsoleView.js @@ -61,6 +61,14 @@ WebInspector.ConsoleView = function(drawer) // Will hold the list of filter elements this.filterBarElement = document.getElementById("console-filter"); + function createDividerElement() { + var dividerElement = document.createElement("div"); + + dividerElement.addStyleClass("divider"); + + this.filterBarElement.appendChild(dividerElement); + } + function createFilterElement(category) { var categoryElement = document.createElement("li"); categoryElement.category = category; @@ -77,6 +85,9 @@ WebInspector.ConsoleView = function(drawer) } this.allElement = createFilterElement.call(this, "All"); + + createDividerElement.call(this); + this.errorElement = createFilterElement.call(this, "Errors"); this.warningElement = createFilterElement.call(this, "Warnings"); this.logElement = createFilterElement.call(this, "Logs"); @@ -291,24 +302,10 @@ WebInspector.ConsoleView.prototype = { } } - function parsingCallback(result, isException) - { - if (!isException) - result = JSON.parse(result); - reportCompletions(result, isException); - } - - this.evalInInspectedWindow( - "(function() {" + - "var props = {};" + - "for (var prop in (" + expressionString + ")) props[prop] = true;" + - ((!dotNotation && !bracketNotation) ? - "for (var prop in window._inspectorCommandLineAPI)" + - "if (prop.charAt(0) !== '_') props[prop] = true;" - : "") + - "return JSON.stringify(props);" + - "})()", - parsingCallback); + var includeInspectorCommandLineAPI = (!dotNotation && !bracketNotation); + if (WebInspector.panels.scripts && WebInspector.panels.scripts.paused) + var callFrameId = WebInspector.panels.scripts.selectedCallFrameId(); + InjectedScriptAccess.getCompletions(expressionString, includeInspectorCommandLineAPI, callFrameId, reportCompletions); }, _reportCompletions: function(bestMatchOnly, completionsReadyCallback, dotNotation, bracketNotation, prefix, result, isException) { @@ -611,7 +608,7 @@ WebInspector.ConsoleMessage.prototype = { this.formattedMessage = span; break; case WebInspector.ConsoleMessage.MessageType.Object: - this.formattedMessage = this._format(["%O", args[0]]); + this.formattedMessage = this._format([WebInspector.ObjectProxy.wrapPrimitiveValue("%O"), args[0]]); break; default: this.formattedMessage = this._format(args); @@ -644,7 +641,7 @@ WebInspector.ConsoleMessage.prototype = { return WebInspector.console._format(obj, true); } - if (typeof parameters[0] === "string") { + if (Object.proxyType(parameters[0]) === "string") { var formatters = {} for (var i in String.standardFormatters) formatters[i] = String.standardFormatters[i]; @@ -665,7 +662,7 @@ WebInspector.ConsoleMessage.prototype = { return a; } - var result = String.format(parameters[0], parameters.slice(1), formatters, formattedResult, append); + var result = String.format(parameters[0].description, parameters.slice(1), formatters, formattedResult, append); formattedResult = result.formattedResult; parameters = result.unusedSubstitutions; if (parameters.length) @@ -673,8 +670,8 @@ WebInspector.ConsoleMessage.prototype = { } for (var i = 0; i < parameters.length; ++i) { - if (typeof parameters[i] === "string") - formattedResult.appendChild(WebInspector.linkifyStringAsFragment(parameters[i])); + if (Object.proxyType(parameters[i]) === "string") + formattedResult.appendChild(WebInspector.linkifyStringAsFragment(parameters[i].description)); else formattedResult.appendChild(formatForConsole(parameters[i])); @@ -916,7 +913,7 @@ WebInspector.ConsoleTextMessage.prototype.__proto__ = WebInspector.ConsoleMessag WebInspector.ConsoleCommandResult = function(result, exception, originatingCommand) { var level = (exception ? WebInspector.ConsoleMessage.MessageLevel.Error : WebInspector.ConsoleMessage.MessageLevel.Log); - var message = (exception ? String(result) : result); + var message = result; var line = (exception ? result.line : -1); var url = (exception ? result.sourceURL : null); diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/DOMStorage.js b/src/3rdparty/webkit/WebCore/inspector/front-end/DOMStorage.js index 5207b69..03a10bf 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/DOMStorage.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/DOMStorage.js @@ -26,24 +26,22 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -WebInspector.DOMStorage = function(domStorage, domain, isLocalStorage) +WebInspector.DOMStorage = function(id, domain, isLocalStorage) { - this.domStorage = domStorage; - this.domain = domain; - this.isLocalStorage = isLocalStorage; + this._id = id; + this._domain = domain; + this._isLocalStorage = isLocalStorage; } WebInspector.DOMStorage.prototype = { - get domStorage() + get id() { - return this._domStorage; + return this._id; }, - set domStorage(x) + get domStorage() { - if (this._domStorage === x) - return; - this._domStorage = x; + return this._domStorage; }, get domain() @@ -51,22 +49,30 @@ WebInspector.DOMStorage.prototype = { return this._domain; }, - set domain(x) + get isLocalStorage() + { + return this._isLocalStorage; + }, + + getEntries: function(callback) { - if (this._domain === x) - return; - this._domain = x; + var callId = WebInspector.Callback.wrap(callback); + InspectorController.getDOMStorageEntries(callId, this._id); }, - get isLocalStorage() + setItem: function(key, value, callback) { - return this._isLocalStorage; + var callId = WebInspector.Callback.wrap(callback); + InspectorController.setDOMStorageItem(callId, this._id, key, value); }, - set isLocalStorage(x) + removeItem: function(key, callback) { - if (this._isLocalStorage === x) - return; - this._isLocalStorage = x; + var callId = WebInspector.Callback.wrap(callback); + InspectorController.removeDOMStorageItem(callId, this._id, key); } } + +WebInspector.didGetDOMStorageEntries = WebInspector.Callback.processCallback; +WebInspector.didSetDOMStorageItem = WebInspector.Callback.processCallback; +WebInspector.didRemoveDOMStorageItem = WebInspector.Callback.processCallback; diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/DOMStorageDataGrid.js b/src/3rdparty/webkit/WebCore/inspector/front-end/DOMStorageDataGrid.js index efdd090..45a9ba1 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/DOMStorageDataGrid.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/DOMStorageDataGrid.js @@ -23,10 +23,12 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -WebInspector.DOMStorageDataGrid = function(columns) +WebInspector.DOMStorageDataGrid = function(columns, domStorage, keys) { WebInspector.DataGrid.call(this, columns); this.dataTableBody.addEventListener("dblclick", this._ondblclick.bind(this), false); + this._domStorage = domStorage; + this._keys = keys; } WebInspector.DOMStorageDataGrid.prototype = { @@ -44,7 +46,6 @@ WebInspector.DOMStorageDataGrid.prototype = { this._editing = true; this._editingNode = node; this._editingNode.select(); - WebInspector.panels.storage._unregisterStorageEventListener(); var element = this._editingNode._element.children[column]; WebInspector.startEditing(element, this._editingCommitted.bind(this), this._editingCancelled.bind(this), element.textContent); @@ -69,7 +70,6 @@ WebInspector.DOMStorageDataGrid.prototype = { return this._startEditingColumnOfDataGridNode(this._editingNode, 0); this._editing = true; - WebInspector.panels.storage._unregisterStorageEventListener(); WebInspector.startEditing(element, this._editingCommitted.bind(this), this._editingCancelled.bind(this), element.textContent); window.getSelection().setBaseAndExtent(element, 0, element, 1); }, @@ -118,22 +118,20 @@ WebInspector.DOMStorageDataGrid.prototype = { return; } - var domStorage = WebInspector.panels.storage.visibleView.domStorage.domStorage; - if (domStorage) { - if (columnIdentifier == 0) { - if (domStorage.getItem(newText) != null) { - element.textContent = this._editingNode.data[0]; - this._editingCancelled(element); - moveToNextIfNeeded.call(this, false); - return; - } - domStorage.removeItem(this._editingNode.data[0]); - domStorage.setItem(newText, this._editingNode.data[1]); - this._editingNode.data[0] = newText; - } else { - domStorage.setItem(this._editingNode.data[0], newText); - this._editingNode.data[1] = newText; + var domStorage = this._domStorage; + if (columnIdentifier === 0) { + if (this._keys.indexOf(newText) !== -1) { + element.textContent = this._editingNode.data[0]; + this._editingCancelled(element); + moveToNextIfNeeded.call(this, false); + return; } + domStorage.removeItem(this._editingNode.data[0]); + domStorage.setItem(newText, this._editingNode.data[1]); + this._editingNode.data[0] = newText; + } else { + domStorage.setItem(this._editingNode.data[0], newText); + this._editingNode.data[1] = newText; } if (this._editingNode.isCreationNode) @@ -147,18 +145,16 @@ WebInspector.DOMStorageDataGrid.prototype = { { delete this._editing; this._editingNode = null; - WebInspector.panels.storage._registerStorageEventListener(); }, deleteSelectedRow: function() { var node = this.selectedNode; - if (this.selectedNode.isCreationNode) + if (!node || node.isCreationNode) return; - var domStorage = WebInspector.panels.storage.visibleView.domStorage.domStorage; - if (node && domStorage) - domStorage.removeItem(node.data[0]); + if (this._domStorage) + this._domStorage.removeItem(node.data[0]); } } diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/DOMStorageItemsView.js b/src/3rdparty/webkit/WebCore/inspector/front-end/DOMStorageItemsView.js index 8617d60..a7da370 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/DOMStorageItemsView.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/DOMStorageItemsView.js @@ -61,39 +61,88 @@ WebInspector.DOMStorageItemsView.prototype = { update: function() { this.element.removeChildren(); - var hasDOMStorage = this.domStorage; - if (hasDOMStorage) - hasDOMStorage = this.domStorage.domStorage; - - if (hasDOMStorage) { - var dataGrid = WebInspector.panels.storage.dataGridForDOMStorage(this.domStorage.domStorage); - if (!dataGrid) - hasDOMStorage = 0; - else { - this._dataGrid = dataGrid; - this.element.appendChild(dataGrid.element); - this._dataGrid.updateWidths(); - this.deleteButton.visible = true; - } - } + var callback = this._showDOMStorageEntries.bind(this); + this.domStorage.getEntries(callback); + }, - if (!hasDOMStorage) { + _showDOMStorageEntries: function(entries) + { + if (entries.length > 0) { + this._dataGrid = this._dataGridForDOMStorageEntries(entries); + this.element.appendChild(this._dataGrid.element); + this._dataGrid.updateWidths(); + this.deleteButton.visible = true; + } else { var emptyMsgElement = document.createElement("div"); emptyMsgElement.className = "storage-table-empty"; if (this.domStorage) - emptyMsgElement.textContent = WebInspector.UIString("This storage is empty."); + emptyMsgElement.textContent = WebInspector.UIString("This storage is empty."); this.element.appendChild(emptyMsgElement); this._dataGrid = null; this.deleteButton.visible = false; } }, - + resize: function() { if (this._dataGrid) this._dataGrid.updateWidths(); }, + _dataGridForDOMStorageEntries: function(entries) + { + var columns = {}; + columns[0] = {}; + columns[1] = {}; + columns[0].title = WebInspector.UIString("Key"); + columns[0].width = columns[0].title.length; + columns[1].title = WebInspector.UIString("Value"); + columns[1].width = columns[1].title.length; + + var nodes = []; + + var keys = []; + var length = entries.length; + for (var i = 0; i < entries.length; i++) { + var data = {}; + + var key = entries[i][0]; + data[0] = key; + if (key.length > columns[0].width) + columns[0].width = key.length; + + var value = entries[i][1]; + data[1] = value; + if (value.length > columns[1].width) + columns[1].width = value.length; + var node = new WebInspector.DataGridNode(data, false); + node.selectable = true; + nodes.push(node); + keys.push(key); + } + + var totalColumnWidths = columns[0].width + columns[1].width; + var width = Math.round((columns[0].width * 100) / totalColumnWidths); + const minimumPrecent = 10; + if (width < minimumPrecent) + width = minimumPrecent; + if (width > 100 - minimumPrecent) + width = 100 - minimumPrecent; + columns[0].width = width; + columns[1].width = 100 - width; + columns[0].width += "%"; + columns[1].width += "%"; + + var dataGrid = new WebInspector.DOMStorageDataGrid(columns, this.domStorage, keys); + var length = nodes.length; + for (var i = 0; i < length; ++i) + dataGrid.appendChild(nodes[i]); + dataGrid.addCreationNode(false); + if (length > 0) + nodes[0].selected = true; + return dataGrid; + }, + _deleteButtonClicked: function(event) { if (this._dataGrid) { diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/ElementsTreeOutline.js b/src/3rdparty/webkit/WebCore/inspector/front-end/ElementsTreeOutline.js index 08ba1c2..d8c4d89 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/ElementsTreeOutline.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/ElementsTreeOutline.js @@ -31,7 +31,6 @@ WebInspector.ElementsTreeOutline = function() { this.element = document.createElement("ol"); this.element.addEventListener("mousedown", this._onmousedown.bind(this), false); - this.element.addEventListener("dblclick", this._ondblclick.bind(this), false); this.element.addEventListener("mousemove", this._onmousemove.bind(this), false); this.element.addEventListener("mouseout", this._onmouseout.bind(this), false); @@ -186,16 +185,6 @@ WebInspector.ElementsTreeOutline.prototype = { return element; }, - _ondblclick: function(event) - { - var element = this._treeElementFromEvent(event); - - if (!element || !element.ondblclick) - return; - - element.ondblclick(element, event); - }, - _onmousedown: function(event) { var element = this._treeElementFromEvent(event); diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/ImageView.js b/src/3rdparty/webkit/WebCore/inspector/front-end/ImageView.js index 001ffdd..96e1a6e 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/ImageView.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/ImageView.js @@ -37,6 +37,7 @@ WebInspector.ImageView = function(resource) this.contentElement.appendChild(container); this.imagePreviewElement = document.createElement("img"); + this.imagePreviewElement.addStyleClass("resource-image-view"); this.imagePreviewElement.setAttribute("src", this.resource.url); container.appendChild(this.imagePreviewElement); diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/Images/errorRedDot.png b/src/3rdparty/webkit/WebCore/inspector/front-end/Images/errorRedDot.png Binary files differnew file mode 100644 index 0000000..6f0b164 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/Images/errorRedDot.png diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/Images/successGreenDot.png b/src/3rdparty/webkit/WebCore/inspector/front-end/Images/successGreenDot.png Binary files differnew file mode 100644 index 0000000..8b9319c --- /dev/null +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/Images/successGreenDot.png diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/Images/warningOrangeDot.png b/src/3rdparty/webkit/WebCore/inspector/front-end/Images/warningOrangeDot.png Binary files differnew file mode 100644 index 0000000..8c8b635 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/Images/warningOrangeDot.png diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/InjectedScript.js b/src/3rdparty/webkit/WebCore/inspector/front-end/InjectedScript.js index 003e694..726c7cc 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/InjectedScript.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/InjectedScript.js @@ -421,7 +421,7 @@ InjectedScript.getPrototypes = function(nodeId) var result = []; for (var prototype = node; prototype; prototype = prototype.__proto__) { - var title = Object.describe(prototype); + var title = Object.describe(prototype, true); if (title.match(/Prototype$/)) { title = title.replace(/Prototype$/, ""); } @@ -498,43 +498,69 @@ InjectedScript.setPropertyValue = function(objectProxy, propertyName, expression } } -InjectedScript.evaluate = function(expression) + +InjectedScript.getCompletions = function(expression, includeInspectorCommandLineAPI, callFrameId) { - return InjectedScript._evaluateOn(InjectedScript._window().eval, InjectedScript._window(), expression); + var props = {}; + try { + var expressionResult; + // Evaluate on call frame if call frame id is available. + if (typeof callFrameId === "number") { + var callFrame = InjectedScript._callFrameForId(callFrameId); + if (!callFrame) + return props; + expressionResult = InjectedScript._evaluateOn(callFrame.evaluate, callFrame, expression); + } else { + expressionResult = InjectedScript._evaluateOn(InjectedScript._window().eval, InjectedScript._window(), expression); + } + for (var prop in expressionResult) + props[prop] = true; + if (includeInspectorCommandLineAPI) + for (var prop in InjectedScript._window()._inspectorCommandLineAPI) + if (prop.charAt(0) !== '_') + props[prop] = true; + } catch(e) { + } + return props; } -InjectedScript._evaluateOn = function(evalFunction, object, expression) +InjectedScript.evaluate = function(expression) { - InjectedScript._ensureCommandLineAPIInstalled(); - // Surround the expression in with statements to inject our command line API so that - // the window object properties still take more precedent than our API functions. - expression = "with (window._inspectorCommandLineAPI) { with (window) { " + expression + " } }"; + return InjectedScript._evaluateAndWrap(InjectedScript._window().eval, InjectedScript._window(), expression); +} +InjectedScript._evaluateAndWrap = function(evalFunction, object, expression) +{ var result = {}; try { - var value = evalFunction.call(object, expression); - if (value === null) - return { value: null }; - if (Object.type(value) === "error") { - result.value = Object.describe(value); + result.value = InspectorController.wrapObject(InjectedScript._evaluateOn(evalFunction, object, expression)); + // Handle error that might have happened while describing result. + if (result.value.errorText) { + result.value = InspectorController.wrapObject(result.value.errorText); result.isException = true; - return result; - } - - var wrapper = InspectorController.wrapObject(value); - if (typeof wrapper === "object" && wrapper.exception) { - result.value = wrapper.exception; - result.isException = true; - } else { - result.value = wrapper; } } catch (e) { - result.value = e.toString(); + result.value = InspectorController.wrapObject(e.toString()); result.isException = true; } return result; } +InjectedScript._evaluateOn = function(evalFunction, object, expression) +{ + InjectedScript._ensureCommandLineAPIInstalled(); + // Surround the expression in with statements to inject our command line API so that + // the window object properties still take more precedent than our API functions. + expression = "with (window._inspectorCommandLineAPI) { with (window) { " + expression + " } }"; + var value = evalFunction.call(object, expression); + + // When evaluating on call frame error is not thrown, but returned as a value. + if (Object.type(value) === "error") + throw value.toString(); + + return value; +} + InjectedScript.addInspectedNode = function(nodeId) { var node = InjectedScript._nodeForId(nodeId); @@ -809,7 +835,7 @@ InjectedScript.evaluateInCallFrame = function(callFrameId, code) var callFrame = InjectedScript._callFrameForId(callFrameId); if (!callFrame) return false; - return InjectedScript._evaluateOn(callFrame.evaluate, callFrame, code); + return InjectedScript._evaluateAndWrap(callFrame.evaluate, callFrame, code); } InjectedScript._callFrameForId = function(id) @@ -950,7 +976,7 @@ InjectedScript.createProxyObject = function(object, objectId, abbreviate) result.type = Object.type(object); var type = typeof object; - if (type === "object" || type === "function") { + if ((type === "object" && object !== null) || type === "function") { for (var subPropertyName in object) { result.hasChildren = true; break; @@ -959,7 +985,7 @@ InjectedScript.createProxyObject = function(object, objectId, abbreviate) try { result.description = Object.describe(object, abbreviate); } catch (e) { - result.exception = e.toString(); + result.errorText = e.toString(); } return result; } @@ -982,11 +1008,11 @@ InjectedScript.CallFrameProxy.prototype = { var scopeChainProxy = []; for (var i = 0; i < scopeChain.length; ++i) { var scopeObject = scopeChain[i]; - var scopeObjectProxy = InjectedScript.createProxyObject(scopeObject, { callFrame: this.id, chainIndex: i }); + var scopeObjectProxy = InjectedScript.createProxyObject(scopeObject, { callFrame: this.id, chainIndex: i }, true); if (Object.prototype.toString.call(scopeObject) === "[object JSActivation]") { if (!foundLocalScope) - scopeObjectProxy.thisObject = InjectedScript.createProxyObject(callFrame.thisObject, { callFrame: this.id, thisObject: true }); + scopeObjectProxy.thisObject = InjectedScript.createProxyObject(callFrame.thisObject, { callFrame: this.id, thisObject: true }, true); else scopeObjectProxy.isClosure = true; foundLocalScope = true; @@ -1060,6 +1086,8 @@ Object.describe = function(obj, abbreviated) case "array": return "[" + obj.toString() + "]"; case "string": + if (!abbreviated) + return obj; if (obj.length > 100) return "\"" + obj.substring(0, 100) + "\u2026\""; return "\"" + obj + "\""; @@ -1072,6 +1100,10 @@ Object.describe = function(obj, abbreviated) return objectText; case "regexp": return String(obj).replace(/([\\\/])/g, "\\$1").replace(/\\(\/[gim]*)$/, "$1").substring(1); + case "boolean": + case "number": + case "null": + return obj; default: return String(obj); } diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/InjectedScriptAccess.js b/src/3rdparty/webkit/WebCore/inspector/front-end/InjectedScriptAccess.js index a5be2d8..da85d03 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/InjectedScriptAccess.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/InjectedScriptAccess.js @@ -63,6 +63,7 @@ InjectedScriptAccess._installHandler("setStyleProperty"); InjectedScriptAccess._installHandler("getPrototypes"); InjectedScriptAccess._installHandler("getProperties"); InjectedScriptAccess._installHandler("setPropertyValue"); +InjectedScriptAccess._installHandler("getCompletions"); InjectedScriptAccess._installHandler("evaluate"); InjectedScriptAccess._installHandler("addInspectedNode"); InjectedScriptAccess._installHandler("pushNodeToFrontend"); diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/ObjectProxy.js b/src/3rdparty/webkit/WebCore/inspector/front-end/ObjectProxy.js index 03d16ab..bb4afa5 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/ObjectProxy.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/ObjectProxy.js @@ -37,6 +37,14 @@ WebInspector.ObjectProxy = function(objectId, path, protoDepth, description, has this.hasChildren = hasChildren; } +WebInspector.ObjectProxy.wrapPrimitiveValue = function(value) +{ + var proxy = new WebInspector.ObjectProxy(); + proxy.type = typeof value; + proxy.description = value; + return proxy; +} + WebInspector.ObjectPropertyProxy = function(name, value) { this.name = name; diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/Resource.js b/src/3rdparty/webkit/WebCore/inspector/front-end/Resource.js index 4dac093..56696e3 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/Resource.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/Resource.js @@ -45,6 +45,64 @@ WebInspector.Resource = function(requestHeaders, url, domain, path, lastPathComp this.category = WebInspector.resourceCategories.other; } + +WebInspector.Resource.StatusText = { + 100: "Continue", + 101: "Switching Protocols", + 102: "Processing (WebDav)", + 200: "OK", + 201: "Created", + 202: "Accepted", + 203: "Non-Authoritative Information", + 204: "No Content", + 205: "Reset Content", + 206: "Partial Content", + 207: "Multi-Status (WebDav)", + 300: "Multiple Choices", + 301: "Moved Permanently", + 302: "Found", + 303: "See Other", + 304: "Not Modified", + 305: "Use Proxy", + 306: "Switch Proxy", + 307: "Temporary", + 400: "Bad Request", + 401: "Unauthorized", + 402: "Payment Required", + 403: "Forbidden", + 404: "Not Found", + 405: "Method Not Allowed", + 406: "Not Acceptable", + 407: "Proxy Authentication Required", + 408: "Request Timeout", + 409: "Conflict", + 410: "Gone", + 411: "Length Required", + 412: "Precondition Failed", + 413: "Request Entity Too Large", + 414: "Request-URI Too Long", + 415: "Unsupported Media Type", + 416: "Requested Range Not Satisfiable", + 417: "Expectation Failed", + 418: "I'm a teapot", + 422: "Unprocessable Entity (WebDav)", + 423: "Locked (WebDav)", + 424: "Failed Dependency (WebDav)", + 425: "Unordered Collection", + 426: "Upgrade Required", + 449: "Retry With", + 500: "Internal Server Error", + 501: "Not Implemented", + 502: "Bad Gateway", + 503: "Service Unavailable", + 504: "Gateway Timeout", + 505: "HTTP Version Not Supported", + 506: "Variant Also Negotiates", + 507: "Insufficient Storage (WebDav)", + 509: "Bandwidth Limit Exceeded", + 510: "Not Extended" +}; + // Keep these in sync with WebCore::InspectorResource::Type WebInspector.Resource.Type = { Document: 0, @@ -620,3 +678,8 @@ WebInspector.Resource.CompareBySize = function(a, b) return 1; return 0; } + +WebInspector.Resource.StatusTextForCode = function(code) +{ + return code ? code + " " + WebInspector.Resource.StatusText[code] : ""; +} diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/ResourceView.js b/src/3rdparty/webkit/WebCore/inspector/front-end/ResourceView.js index d745920..d915055 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/ResourceView.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/ResourceView.js @@ -54,6 +54,11 @@ WebInspector.ResourceView = function(resource) this.urlTreeElement.selectable = false; this.headersTreeOutline.appendChild(this.urlTreeElement); + this.httpInformationTreeElement = new TreeElement("", null, true); + this.httpInformationTreeElement.expanded = false; + this.httpInformationTreeElement.selectable = false; + this.headersTreeOutline.appendChild(this.httpInformationTreeElement); + this.requestHeadersTreeElement = new TreeElement("", null, true); this.requestHeadersTreeElement.expanded = false; this.requestHeadersTreeElement.selectable = false; @@ -90,10 +95,12 @@ WebInspector.ResourceView = function(resource) resource.addEventListener("url changed", this._refreshURL, this); resource.addEventListener("requestHeaders changed", this._refreshRequestHeaders, this); resource.addEventListener("responseHeaders changed", this._refreshResponseHeaders, this); + resource.addEventListener("finished", this._refreshHTTPInformation, this); this._refreshURL(); this._refreshRequestHeaders(); this._refreshResponseHeaders(); + this._refreshHTTPInformation(); } WebInspector.ResourceView.prototype = { @@ -127,7 +134,21 @@ WebInspector.ResourceView.prototype = { _refreshURL: function() { var url = this.resource.url; - this.urlTreeElement.title = this.resource.requestMethod + " " + url.escapeHTML(); + var statusCodeImage = ""; + if (this.resource.statusCode) { + var statusImageSource = ""; + + if (this.resource.statusCode < 300) + statusImageSource = "Images/successGreenDot.png"; + else if (this.resource.statusCode < 400) + statusImageSource = "Images/warningOrangeDot.png"; + else + statusImageSource = "Images/errorRedDot.png"; + + statusCodeImage = "<img class=\"resource-status-image\" src=\"" + statusImageSource + "\" title=\"" + WebInspector.Resource.StatusTextForCode(this.resource.statusCode) + "\">"; + } + + this.urlTreeElement.title = statusCodeImage + "<span class=\"resource-url\">" + url.escapeHTML() + "</span>"; this._refreshQueryString(); }, @@ -240,6 +261,33 @@ WebInspector.ResourceView.prototype = { this._refreshHeaders(WebInspector.UIString("Response Headers"), this.resource.sortedResponseHeaders, this.responseHeadersTreeElement); }, + _refreshHTTPInformation: function() + { + const listElements = 2; + + var headerElement = this.httpInformationTreeElement; + headerElement.removeChildren(); + headerElement.hidden = !this.resource.statusCode; + + if (this.resource.statusCode) { + headerElement.title = WebInspector.UIString("HTTP Information") + "<span class=\"header-count\">" + WebInspector.UIString(" (%d)", listElements) + "</span>"; + + var title = "<div class=\"header-name\">" + WebInspector.UIString("Request Method") + ":</div>"; + title += "<div class=\"header-value\">" + this.resource.requestMethod + "</div>" + + var headerTreeElement = new TreeElement(title, null, false); + headerTreeElement.selectable = false; + headerElement.appendChild(headerTreeElement); + + title = "<div class=\"header-name\">" + WebInspector.UIString("Status Code") + ":</div>"; + title += "<div class=\"header-value\">" + WebInspector.Resource.StatusTextForCode(this.resource.statusCode) + "</div>" + + headerTreeElement = new TreeElement(title, null, false); + headerTreeElement.selectable = false; + headerElement.appendChild(headerTreeElement); + } + }, + _refreshHeaders: function(title, headers, headersTreeElement) { headersTreeElement.removeChildren(); diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/ScriptsPanel.js b/src/3rdparty/webkit/WebCore/inspector/front-end/ScriptsPanel.js index 04f27bb..ae918d1 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/ScriptsPanel.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/ScriptsPanel.js @@ -351,6 +351,14 @@ WebInspector.ScriptsPanel.prototype = { sourceFrame.removeBreakpoint(breakpoint); }, + selectedCallFrameId: function() + { + var selectedCallFrame = this.sidebarPanes.callstack.selectedCallFrame; + if (!selectedCallFrame) + return null; + return selectedCallFrame.id; + }, + evaluateInSelectedCallFrame: function(code, updateInterface, callback) { var selectedCallFrame = this.sidebarPanes.callstack.selectedCallFrame; diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/StoragePanel.js b/src/3rdparty/webkit/WebCore/inspector/front-end/StoragePanel.js index aed0d06..01c657d 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/StoragePanel.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/StoragePanel.js @@ -93,7 +93,6 @@ WebInspector.StoragePanel.prototype = { { WebInspector.Panel.prototype.show.call(this); this._updateSidebarWidth(); - this._registerStorageEventListener(); }, reset: function() @@ -110,8 +109,6 @@ WebInspector.StoragePanel.prototype = { this._databases = []; - this._unregisterStorageEventListener(); - if (this._domStorage) { var domStorageLength = this._domStorage.length; for (var i = 0; i < domStorageLength; ++i) { @@ -174,16 +171,12 @@ WebInspector.StoragePanel.prototype = { } }, - selectDOMStorage: function(s) + selectDOMStorage: function(storageId) { - var isLocalStorage = (s === InspectorController.inspectedWindow().localStorage); - for (var i = 0, len = this._domStorage.length; i < len; ++i) { - var storage = this._domStorage[i]; - if ( isLocalStorage === storage.isLocalStorage ) { - this.showDOMStorage(storage); - storage._domStorageTreeElement.select(); - return; - } + var domStorage = this._domStorageForId(storageId); + if (domStorage) { + this.showDOMStorage(domStorage); + domStorage._domStorageTreeElement.select(); } }, @@ -383,61 +376,6 @@ WebInspector.StoragePanel.prototype = { return dataGrid; }, - dataGridForDOMStorage: function(domStorage) - { - if (!domStorage.length) - return null; - - var columns = {}; - columns[0] = {}; - columns[1] = {}; - columns[0].title = WebInspector.UIString("Key"); - columns[0].width = columns[0].title.length; - columns[1].title = WebInspector.UIString("Value"); - columns[1].width = columns[1].title.length; - - var nodes = []; - - var length = domStorage.length; - for (var index = 0; index < domStorage.length; index++) { - var data = {}; - - var key = String(domStorage.key(index)); - data[0] = key; - if (key.length > columns[0].width) - columns[0].width = key.length; - - var value = String(domStorage.getItem(key)); - data[1] = value; - if (value.length > columns[1].width) - columns[1].width = value.length; - var node = new WebInspector.DataGridNode(data, false); - node.selectable = true; - nodes.push(node); - } - - var totalColumnWidths = columns[0].width + columns[1].width; - var width = Math.round((columns[0].width * 100) / totalColumnWidths); - const minimumPrecent = 10; - if (width < minimumPrecent) - width = minimumPrecent; - if (width > 100 - minimumPrecent) - width = 100 - minimumPrecent; - columns[0].width = width; - columns[1].width = 100 - width; - columns[0].width += "%"; - columns[1].width += "%"; - - var dataGrid = new WebInspector.DOMStorageDataGrid(columns); - var length = nodes.length; - for (var i = 0; i < length; ++i) - dataGrid.appendChild(nodes[i]); - dataGrid.addCreationNode(false); - if (length > 0) - nodes[0].selected = true; - return dataGrid; - }, - resize: function() { var visibleView = this.visibleView; @@ -445,44 +383,28 @@ WebInspector.StoragePanel.prototype = { visibleView.resize(); }, - _registerStorageEventListener: function() + updateDOMStorage: function(storageId) { - var inspectedWindow = InspectorController.inspectedWindow(); - if (!inspectedWindow || !inspectedWindow.document) - return; - - this._storageEventListener = InspectorController.wrapCallback(this._storageEvent.bind(this)); - inspectedWindow.addEventListener("storage", this._storageEventListener, true); - }, - - _unregisterStorageEventListener: function() - { - if (!this._storageEventListener) - return; - - var inspectedWindow = InspectorController.inspectedWindow(); - if (!inspectedWindow || !inspectedWindow.document) + var domStorage = this._domStorageForId(storageId); + if (!domStorage) return; - inspectedWindow.removeEventListener("storage", this._storageEventListener, true); - delete this._storageEventListener; + var view = domStorage._domStorageView; + if (this.visibleView && view === this.visibleView) + domStorage._domStorageView.update(); }, - _storageEvent: function(event) + _domStorageForId: function(storageId) { if (!this._domStorage) - return; - - var isLocalStorage = (event.storageArea === InspectorController.inspectedWindow().localStorage); + return null; var domStorageLength = this._domStorage.length; for (var i = 0; i < domStorageLength; ++i) { var domStorage = this._domStorage[i]; - if (isLocalStorage === domStorage.isLocalStorage) { - var view = domStorage._domStorageView; - if (this.visibleView && view === this.visibleView) - domStorage._domStorageView.update(); - } + if (domStorage.id == storageId) + return domStorage; } + return null; }, _startSidebarDragging: function(event) diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.css b/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.css index ea6f661..2ae4aac 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.css +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.css @@ -94,6 +94,10 @@ body.attached #toolbar { padding-left: 0; } +body.attached.platform-qt #toolbar { + cursor: auto; +} + body.attached.inactive #toolbar { border-top: 1px solid rgb(64%, 64%, 64%); } @@ -229,6 +233,10 @@ body.detached .toolbar-item.close { display: none; } +body.attached.platform-qt .toolbar-item.close { + display: none; +} + #main { position: absolute; z-index: 1; @@ -372,6 +380,10 @@ body.detached #dock-status-bar-item .glyph { -webkit-mask-image: url(Images/dockButtonGlyph.png); } +body.platform-qt #dock-status-bar-item { + display: none +} + #console-status-bar-item .glyph { -webkit-mask-image: url(Images/consoleButtonGlyph.png); } @@ -842,7 +854,7 @@ body.drawer-visible #drawer { -webkit-user-select: text; } -.resource-view.image img { +.resource-view.image img.resource-image-view { max-width: 100%; max-height: 1000px; background-image: url(Images/checker.png); @@ -851,6 +863,14 @@ body.drawer-visible #drawer { -webkit-user-drag: auto; } +.resource-url { + vertical-align: middle; +} + +.resource-status-image { + vertical-align: middle; +} + .resource-view.image .title { text-align: center; font-size: 13px; @@ -2327,6 +2347,15 @@ button.enable-toggle-status-bar-item.toggled-on .glyph { text-shadow: rgba(255, 255, 255, 0.5) 1px 1px 0; } +#console-filter div.divider { + margin-left: 5px; + margin-right: 5px; + /* Only want a border-left here because border on both sides + made the divider too thick */ + border-left: 1px solid gray; + display: inline; +} + #resources-filter li.selected, #resources-filter li:hover, #resources-filter li:active, #console-filter li.selected, #console-filter li:hover, #console-filter li:active { color: white; diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.js b/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.js index 902dd94..921bb7a 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.js @@ -784,7 +784,7 @@ WebInspector.toggleAttach = function() WebInspector.toolbarDragStart = function(event) { - if (!WebInspector.attached && InspectorController.platform() !== "mac-leopard") + if ((!WebInspector.attached && InspectorController.platform() !== "mac-leopard") || InspectorController.platform() == "qt") return; var target = event.target; @@ -1016,12 +1016,17 @@ WebInspector.addDatabase = function(payload) WebInspector.addDOMStorage = function(payload) { var domStorage = new WebInspector.DOMStorage( - payload.domStorage, + payload.id, payload.host, payload.isLocalStorage); this.panels.storage.addDOMStorage(domStorage); } +WebInspector.updateDOMStorage = function(storageId) +{ + this.panels.storage.updateDOMStorage(storageId); +} + WebInspector.resourceTrackingWasEnabled = function() { this.panels.resources.resourceTrackingWasEnabled(); @@ -1128,16 +1133,86 @@ WebInspector.addMessageToConsole = function(payload) WebInspector.log = function(message) { - var msg = new WebInspector.ConsoleMessage( - WebInspector.ConsoleMessage.MessageSource.Other, - WebInspector.ConsoleMessage.MessageType.Log, - WebInspector.ConsoleMessage.MessageLevel.Debug, - -1, - null, - null, - 1, - message); - this.console.addMessage(msg); + // remember 'this' for setInterval() callback + var self = this; + + // return indication if we can actually log a message + function isLogAvailable() + { + return WebInspector.ConsoleMessage && WebInspector.ObjectProxy && self.console; + } + + // flush the queue of pending messages + function flushQueue() + { + var queued = WebInspector.log.queued; + if (!queued) + return; + + for (var i = 0; i < queued.length; ++i) + logMessage(queued[i]); + + delete WebInspector.log.queued; + } + + // flush the queue if it console is available + // - this function is run on an interval + function flushQueueIfAvailable() + { + if (!isLogAvailable()) + return; + + clearInterval(WebInspector.log.interval); + delete WebInspector.log.interval; + + flushQueue(); + } + + // actually log the message + function logMessage(message) + { + var repeatCount = 1; + if (message == WebInspector.log.lastMessage) + repeatCount = WebInspector.log.repeatCount + 1; + + WebInspector.log.lastMessage = message; + WebInspector.log.repeatCount = repeatCount; + + // ConsoleMessage expects a proxy object + message = new WebInspector.ObjectProxy(null, [], 0, message, false); + + // post the message + var msg = new WebInspector.ConsoleMessage( + WebInspector.ConsoleMessage.MessageSource.Other, + WebInspector.ConsoleMessage.MessageType.Log, + WebInspector.ConsoleMessage.MessageLevel.Debug, + -1, + null, + null, + repeatCount, + message); + + self.console.addMessage(msg); + } + + // if we can't log the message, queue it + if (!isLogAvailable()) { + if (!WebInspector.log.queued) + WebInspector.log.queued = []; + + WebInspector.log.queued.push(message); + + if (!WebInspector.log.interval) + WebInspector.log.interval = setInterval(flushQueueIfAvailable, 1000); + + return; + } + + // flush the pending queue if any + flushQueue(); + + // log the message + logMessage(message); } WebInspector.addProfile = function(profile) diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/utilities.js b/src/3rdparty/webkit/WebCore/inspector/front-end/utilities.js index e831abd..e83c7c0 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/utilities.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/utilities.js @@ -814,12 +814,16 @@ String.tokenizeFormatString = function(format) String.standardFormatters = { d: function(substitution) { + if (typeof substitution == "object" && Object.proxyType(substitution) === "number") + substitution = substitution.description; substitution = parseInt(substitution); return !isNaN(substitution) ? substitution : 0; }, f: function(substitution, token) { + if (typeof substitution == "object" && Object.proxyType(substitution) === "number") + substitution = substitution.description; substitution = parseFloat(substitution); if (substitution && token.precision > -1) substitution = substitution.toFixed(token.precision); @@ -828,6 +832,8 @@ String.standardFormatters = { s: function(substitution) { + if (typeof substitution == "object" && Object.proxyType(substitution) !== "null") + substitution = substitution.description; return substitution; }, }; diff --git a/src/3rdparty/webkit/WebCore/loader/CachedResourceHandle.h b/src/3rdparty/webkit/WebCore/loader/CachedResourceHandle.h index 13c03c7..feb59b9 100644 --- a/src/3rdparty/webkit/WebCore/loader/CachedResourceHandle.h +++ b/src/3rdparty/webkit/WebCore/loader/CachedResourceHandle.h @@ -38,7 +38,8 @@ namespace WebCore { bool operator!() const { return !m_resource; } // This conversion operator allows implicit conversion to bool but not to other integer types. - typedef CachedResource* CachedResourceHandleBase::*UnspecifiedBoolType; + // Parenthesis is needed for winscw compiler to resolve class qualifier in this case. + typedef CachedResource* (CachedResourceHandleBase::*UnspecifiedBoolType); operator UnspecifiedBoolType() const { return m_resource ? &CachedResourceHandleBase::m_resource : 0; } protected: @@ -59,7 +60,7 @@ namespace WebCore { template <class R> class CachedResourceHandle : public CachedResourceHandleBase { public: CachedResourceHandle() { } - CachedResourceHandle(R* res) : CachedResourceHandleBase(res) { } + CachedResourceHandle(R* res); CachedResourceHandle(const CachedResourceHandle<R>& o) : CachedResourceHandleBase(o) { } R* get() const { return reinterpret_cast<R*>(CachedResourceHandleBase::get()); } @@ -70,6 +71,16 @@ namespace WebCore { bool operator==(const CachedResourceHandleBase& o) const { return get() == o.get(); } bool operator!=(const CachedResourceHandleBase& o) const { return get() != o.get(); } }; + + // Don't inline for winscw compiler to prevent the compiler agressively resolving + // the base class of R* when CachedResourceHandler<T>(R*) is inlined. + template <class R> +#if !COMPILER(WINSCW) + inline +#endif + CachedResourceHandle<R>::CachedResourceHandle(R* res) : CachedResourceHandleBase(res) + { + } template <class R, class RR> bool operator==(const CachedResourceHandle<R>& h, const RR* res) { diff --git a/src/3rdparty/webkit/WebCore/loader/EmptyClients.h b/src/3rdparty/webkit/WebCore/loader/EmptyClients.h index 4172c06..41b6ebc 100644 --- a/src/3rdparty/webkit/WebCore/loader/EmptyClients.h +++ b/src/3rdparty/webkit/WebCore/loader/EmptyClients.h @@ -120,7 +120,7 @@ public: virtual void scroll(const IntSize&, const IntRect&, const IntRect&) { } virtual IntPoint screenToWindow(const IntPoint& p) const { return p; } virtual IntRect windowToScreen(const IntRect& r) const { return r; } - virtual PlatformWidget platformWindow() const { return 0; } + virtual PlatformPageClient platformPageClient() const { return 0; } virtual void contentsSizeChanged(Frame*, const IntSize&) const { } virtual void scrollbarsModeDidChange() const { } diff --git a/src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp b/src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp index 4321be0..807edef 100644 --- a/src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp +++ b/src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp @@ -71,6 +71,7 @@ #include "Page.h" #include "PageCache.h" #include "PageGroup.h" +#include "PageTransitionEvent.h" #include "PlaceholderDocument.h" #include "PluginData.h" #include "PluginDocument.h" @@ -138,6 +139,7 @@ struct ScheduledRedirection { const bool wasUserGesture; const bool wasRefresh; const bool wasDuringLoad; + bool toldClient; ScheduledRedirection(double delay, const String& url, bool lockHistory, bool lockBackForwardList, bool wasUserGesture, bool refresh) : type(redirection) @@ -149,6 +151,7 @@ struct ScheduledRedirection { , wasUserGesture(wasUserGesture) , wasRefresh(refresh) , wasDuringLoad(false) + , toldClient(false) { ASSERT(!url.isEmpty()); } @@ -164,6 +167,7 @@ struct ScheduledRedirection { , wasUserGesture(wasUserGesture) , wasRefresh(refresh) , wasDuringLoad(duringLoad) + , toldClient(false) { ASSERT(!url.isEmpty()); } @@ -177,6 +181,7 @@ struct ScheduledRedirection { , wasUserGesture(false) , wasRefresh(false) , wasDuringLoad(false) + , toldClient(false) { } @@ -194,6 +199,7 @@ struct ScheduledRedirection { , wasUserGesture(false) , wasRefresh(false) , wasDuringLoad(duringLoad) + , toldClient(false) { ASSERT(!frameRequest.isEmpty()); ASSERT(this->formState); @@ -267,8 +273,9 @@ FrameLoader::FrameLoader(Frame* frame, FrameLoaderClient* client) , m_encodingWasChosenByUser(false) , m_containsPlugIns(false) , m_redirectionTimer(this, &FrameLoader::redirectionTimerFired) - , m_checkCompletedTimer(this, &FrameLoader::checkCompletedTimerFired) - , m_checkLoadCompleteTimer(this, &FrameLoader::checkLoadCompleteTimerFired) + , m_checkTimer(this, &FrameLoader::checkTimerFired) + , m_shouldCallCheckCompleted(false) + , m_shouldCallCheckLoadComplete(false) , m_opener(0) , m_openedByDOM(false) , m_creatingInitialEmptyDocument(false) @@ -318,6 +325,11 @@ void FrameLoader::setDefersLoading(bool defers) m_provisionalDocumentLoader->setDefersLoading(defers); if (m_policyDocumentLoader) m_policyDocumentLoader->setDefersLoading(defers); + + if (!defers) { + startRedirectionTimer(); + startCheckCompleteTimer(); + } } Frame* FrameLoader::createWindow(FrameLoader* frameLoaderForFrameLookup, const FrameLoadRequest& request, const WindowFeatures& features, bool& created) @@ -581,9 +593,9 @@ void FrameLoader::stopLoading(UnloadEventPolicy unloadEventPolicy, DatabasePolic m_unloadEventBeingDispatched = true; if (m_frame->domWindow()) { if (unloadEventPolicy == UnloadEventPolicyUnloadAndPageHide) - m_frame->domWindow()->dispatchPageTransitionEvent(EventNames().pagehideEvent, m_frame->document()->inPageCache()); + m_frame->domWindow()->dispatchEvent(PageTransitionEvent::create(EventNames().pagehideEvent, m_frame->document()->inPageCache()), m_frame->document()); if (!m_frame->document()->inPageCache()) - m_frame->domWindow()->dispatchUnloadEvent(); + m_frame->domWindow()->dispatchEvent(Event::create(eventNames().unloadEvent, false, false), m_frame->domWindow()->document()); } m_unloadEventBeingDispatched = false; if (m_frame->document()) @@ -597,7 +609,7 @@ void FrameLoader::stopLoading(UnloadEventPolicy unloadEventPolicy, DatabasePolic m_frame->document()->removeAllEventListeners(); } - m_isComplete = true; // to avoid calling completed() in finishedParsing() (David) + m_isComplete = true; // to avoid calling completed() in finishedParsing() m_isLoadingMainResource = false; m_didCallImplicitClose = true; // don't want that one either @@ -656,8 +668,6 @@ void FrameLoader::cancelRedirection(bool cancelWithLoadInProgress) m_cancellingWithLoadInProgress = cancelWithLoadInProgress; stopRedirectionTimer(); - - m_scheduledRedirection.clear(); } KURL FrameLoader::iconURL() @@ -743,8 +753,10 @@ bool FrameLoader::executeIfJavaScriptURL(const KURL& url, bool userGesture, bool const int javascriptSchemeLength = sizeof("javascript:") - 1; - String script = decodeURLEscapeSequences(url.string().substring(javascriptSchemeLength)); - ScriptValue result = executeScript(script, userGesture); + String script = url.string().substring(javascriptSchemeLength); + ScriptValue result; + if (m_frame->script()->xssAuditor()->canEvaluateJavaScriptURL(script)) + result = executeScript(decodeURLEscapeSequences(script), userGesture); String scriptResult; if (!result.getString(scriptResult)) @@ -844,8 +856,9 @@ void FrameLoader::clear(bool clearWindowProperties, bool clearScriptObjects, boo m_redirectionTimer.stop(); m_scheduledRedirection.clear(); - m_checkCompletedTimer.stop(); - m_checkLoadCompleteTimer.stop(); + m_checkTimer.stop(); + m_shouldCallCheckCompleted = false; + m_shouldCallCheckLoadComplete = false; m_receivedData = false; m_isDisplayingInitialEmptyDocument = false; @@ -1238,15 +1251,34 @@ void FrameLoader::loadDone() checkCompleted(); } +bool FrameLoader::allChildrenAreComplete() const +{ + for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling()) { + if (!child->loader()->m_isComplete) + return false; + } + return true; +} + +bool FrameLoader::allAncestorsAreComplete() const +{ + for (Frame* ancestor = m_frame; ancestor; ancestor = ancestor->tree()->parent()) { + if (!ancestor->loader()->m_isComplete) + return false; + } + return true; +} + void FrameLoader::checkCompleted() { + m_shouldCallCheckCompleted = false; + if (m_frame->view()) m_frame->view()->checkStopDelayingDeferredRepaints(); // Any frame that hasn't completed yet? - for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling()) - if (!child->loader()->m_isComplete) - return; + if (!allChildrenAreComplete()) + return; // Have we completed before? if (m_isComplete) @@ -1266,38 +1298,44 @@ void FrameLoader::checkCompleted() RefPtr<Frame> protect(m_frame); checkCallImplicitClose(); // if we didn't do it before - // Do not start a redirection timer for subframes here. - // That is deferred until the parent is completed. - if (m_scheduledRedirection && !m_frame->tree()->parent()) - startRedirectionTimer(); + startRedirectionTimer(); completed(); if (m_frame->page()) checkLoadComplete(); } -void FrameLoader::checkCompletedTimerFired(Timer<FrameLoader>*) +void FrameLoader::checkTimerFired(Timer<FrameLoader>*) { - checkCompleted(); + if (Page* page = m_frame->page()) { + if (page->defersLoading()) + return; + } + if (m_shouldCallCheckCompleted) + checkCompleted(); + if (m_shouldCallCheckLoadComplete) + checkLoadComplete(); } -void FrameLoader::scheduleCheckCompleted() +void FrameLoader::startCheckCompleteTimer() { - if (!m_checkCompletedTimer.isActive()) - m_checkCompletedTimer.startOneShot(0); + if (!(m_shouldCallCheckCompleted || m_shouldCallCheckLoadComplete)) + return; + if (m_checkTimer.isActive()) + return; + m_checkTimer.startOneShot(0); } -void FrameLoader::checkLoadCompleteTimerFired(Timer<FrameLoader>*) +void FrameLoader::scheduleCheckCompleted() { - if (!m_frame->page()) - return; - checkLoadComplete(); + m_shouldCallCheckCompleted = true; + startCheckCompleteTimer(); } void FrameLoader::scheduleCheckLoadComplete() { - if (!m_checkLoadCompleteTimer.isActive()) - m_checkLoadCompleteTimer.startOneShot(0); + m_shouldCallCheckLoadComplete = true; + startCheckCompleteTimer(); } void FrameLoader::checkCallImplicitClose() @@ -1305,9 +1343,8 @@ void FrameLoader::checkCallImplicitClose() if (m_didCallImplicitClose || m_frame->document()->parsing()) return; - for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling()) - if (!child->loader()->m_isComplete) // still got a frame running -> too early - return; + if (!allChildrenAreComplete()) + return; // still got a frame running -> too early m_didCallImplicitClose = true; m_wasUnloadEventEmitted = false; @@ -1427,12 +1464,6 @@ void FrameLoader::scheduleHistoryNavigation(int steps) if (!m_frame->page()) return; - // navigation will always be allowed in the 0 steps case, which is OK because that's supposed to force a reload. - if (!canGoBackOrForward(steps)) { - cancelRedirection(); - return; - } - scheduleRedirection(new ScheduledRedirection(steps)); } @@ -1470,6 +1501,9 @@ void FrameLoader::redirectionTimerFired(Timer<FrameLoader>*) { ASSERT(m_frame->page()); + if (m_frame->page()->defersLoading()) + return; + OwnPtr<ScheduledRedirection> redirection(m_scheduledRedirection.release()); switch (redirection->type) { @@ -1486,7 +1520,8 @@ void FrameLoader::redirectionTimerFired(Timer<FrameLoader>*) } // go(i!=0) from a frame navigates into the history of the frame only, // in both IE and NS (but not in Mozilla). We can't easily do that. - goBackOrForward(redirection->historySteps); + if (canGoBackOrForward(redirection->historySteps)) + goBackOrForward(redirection->historySteps); return; case ScheduledRedirection::formSubmission: // The submitForm function will find a target frame before using the redirection timer. @@ -1710,12 +1745,6 @@ bool FrameLoader::loadPlugin(RenderPart* renderer, const KURL& url, const String return widget != 0; } -void FrameLoader::parentCompleted() -{ - if (m_scheduledRedirection && !m_redirectionTimer.isActive()) - startRedirectionTimer(); -} - String FrameLoader::outgoingReferrer() const { return m_outgoingReferrer; @@ -1854,7 +1883,7 @@ bool FrameLoader::canCachePageContainingThisFrame() && !m_containsPlugIns && !m_URL.protocolIs("https") #ifndef PAGE_CACHE_ACCEPTS_UNLOAD_HANDLERS - && (!m_frame->domWindow() || !m_frame->domWindow()->hasEventListener(eventNames().unloadEvent)) + && (!m_frame->domWindow() || !m_frame->domWindow()->hasEventListeners(eventNames().unloadEvent)) #endif #if ENABLE(DATABASE) && !m_frame->document()->hasOpenDatabases() @@ -2001,7 +2030,7 @@ bool FrameLoader::logCanCacheFrameDecision(int indentLevel) if (m_URL.protocolIs("https")) { PCLOG(" -Frame is HTTPS"); cannotCache = true; } #ifndef PAGE_CACHE_ACCEPTS_UNLOAD_HANDLERS - if (m_frame->domWindow() && m_frame->domWindow()->hasEventListener(eventNames().unloadEvent)) + if (m_frame->domWindow() && m_frame->domWindow()->hasEventListeners(eventNames().unloadEvent)) { PCLOG(" -Frame has an unload event listener"); cannotCache = true; } #endif #if ENABLE(DATABASE) @@ -2068,7 +2097,7 @@ public: virtual void performTask(ScriptExecutionContext* context) { ASSERT_UNUSED(context, context->isDocument()); - m_document->dispatchWindowEvent(eventNames().hashchangeEvent, false, false); + m_document->dispatchWindowEvent(Event::create(eventNames().hashchangeEvent, false, false)); } private: @@ -2110,7 +2139,7 @@ bool FrameLoader::isComplete() const return m_isComplete; } -void FrameLoader::scheduleRedirection(ScheduledRedirection* redirection) +void FrameLoader::scheduleRedirection(PassOwnPtr<ScheduledRedirection> redirection) { ASSERT(m_frame->page()); @@ -2124,24 +2153,33 @@ void FrameLoader::scheduleRedirection(ScheduledRedirection* redirection) } stopRedirectionTimer(); - m_scheduledRedirection.set(redirection); - if (!m_isComplete && redirection->type != ScheduledRedirection::redirection) + m_scheduledRedirection = redirection; + if (!m_isComplete && m_scheduledRedirection->type != ScheduledRedirection::redirection) completed(); - if (m_isComplete || redirection->type != ScheduledRedirection::redirection) - startRedirectionTimer(); + startRedirectionTimer(); } void FrameLoader::startRedirectionTimer() { + if (!m_scheduledRedirection) + return; + ASSERT(m_frame->page()); - ASSERT(m_scheduledRedirection); - m_redirectionTimer.stop(); + if (m_redirectionTimer.isActive()) + return; + + if (m_scheduledRedirection->type == ScheduledRedirection::redirection && !allAncestorsAreComplete()) + return; + m_redirectionTimer.startOneShot(m_scheduledRedirection->delay); switch (m_scheduledRedirection->type) { case ScheduledRedirection::locationChange: case ScheduledRedirection::redirection: + if (m_scheduledRedirection->toldClient) + return; + m_scheduledRedirection->toldClient = true; clientRedirected(KURL(ParsedURLString, m_scheduledRedirection->url), m_scheduledRedirection->delay, currentTime() + m_redirectionTimer.nextFireInterval(), @@ -2161,35 +2199,18 @@ void FrameLoader::startRedirectionTimer() void FrameLoader::stopRedirectionTimer() { - if (!m_redirectionTimer.isActive()) - return; - m_redirectionTimer.stop(); - if (m_scheduledRedirection) { - switch (m_scheduledRedirection->type) { - case ScheduledRedirection::locationChange: - case ScheduledRedirection::redirection: - clientRedirectCancelledOrFinished(m_cancellingWithLoadInProgress); - return; - case ScheduledRedirection::formSubmission: - // FIXME: It would make sense to report form submissions as client redirects too. - // But we didn't do that in the past when form submission used a separate delay - // mechanism, so doing it will be a behavior change. - return; - case ScheduledRedirection::historyNavigation: - // Don't report history navigations. - return; - } - ASSERT_NOT_REACHED(); - } + OwnPtr<ScheduledRedirection> redirection(m_scheduledRedirection.release()); + if (redirection && redirection->toldClient) + clientRedirectCancelledOrFinished(m_cancellingWithLoadInProgress); } void FrameLoader::completed() { RefPtr<Frame> protect(m_frame); for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling()) - child->loader()->parentCompleted(); + child->loader()->startRedirectionTimer(); if (Frame* parent = m_frame->tree()->parent()) parent->loader()->checkCompleted(); if (m_frame->view()) @@ -2291,6 +2312,9 @@ void FrameLoader::loadFrameRequest(const FrameLoadRequest& request, bool lockHis void FrameLoader::loadURL(const KURL& newURL, const String& referrer, const String& frameName, bool lockHistory, FrameLoadType newLoadType, PassRefPtr<Event> event, PassRefPtr<FormState> prpFormState) { + if (m_unloadEventBeingDispatched) + return; + RefPtr<FormState> formState = prpFormState; bool isFormSubmission = formState; @@ -2330,6 +2354,7 @@ void FrameLoader::loadURL(const KURL& newURL, const String& referrer, const Stri if (shouldScrollToAnchor(isFormSubmission, newLoadType, newURL)) { oldDocumentLoader->setTriggeringAction(action); stopPolicyCheck(); + m_policyLoadType = newLoadType; checkNavigationPolicy(request, oldDocumentLoader.get(), formState.release(), callContinueFragmentScrollAfterNavigationPolicy, this); } else { @@ -2434,6 +2459,9 @@ void FrameLoader::loadWithDocumentLoader(DocumentLoader* loader, FrameLoadType t ASSERT(m_frame->view()); + if (m_unloadEventBeingDispatched) + return; + m_policyLoadType = type; RefPtr<FormState> formState = prpFormState; bool isFormSubmission = formState; @@ -2670,7 +2698,8 @@ bool FrameLoader::shouldAllowNavigation(Frame* targetFrame) const // // Or the target frame is: // - a top-level frame in the frame hierarchy and the active frame can - // navigate the target frame's opener per above. + // navigate the target frame's opener per above or it is the opener of + // the target frame. if (!targetFrame) return true; @@ -2685,6 +2714,10 @@ bool FrameLoader::shouldAllowNavigation(Frame* targetFrame) const if (targetFrame == m_frame->tree()->top()) return true; + // Let a frame navigate its opener if the opener is a top-level window. + if (!targetFrame->tree()->parent() && m_frame->loader()->opener() == targetFrame) + return true; + Document* activeDocument = m_frame->document(); ASSERT(activeDocument); const SecurityOrigin* activeSecurityOrigin = activeDocument->securityOrigin(); @@ -2900,7 +2933,7 @@ void FrameLoader::commitProvisionalLoad(PassRefPtr<CachedPage> prpCachedPage) m_frame->document()->documentDidBecomeActive(); // Force a layout to update view size and thereby update scrollbars. - m_client->forceLayout(); + m_frame->view()->forceLayout(); const ResponseVector& responses = m_documentLoader->responses(); size_t count = responses.size(); @@ -3554,6 +3587,8 @@ void FrameLoader::checkLoadComplete() { ASSERT(m_client->hasWebView()); + m_shouldCallCheckLoadComplete = false; + // FIXME: Always traversing the entire frame tree is a bit inefficient, but // is currently needed in order to null out the previous history item for all frames. if (Page* page = m_frame->page()) @@ -4288,7 +4323,7 @@ void FrameLoader::pageHidden() { m_unloadEventBeingDispatched = true; if (m_frame->domWindow()) - m_frame->domWindow()->dispatchPageTransitionEvent(EventNames().pagehideEvent, true); + m_frame->domWindow()->dispatchEvent(PageTransitionEvent::create(EventNames().pagehideEvent, true), m_frame->document()); m_unloadEventBeingDispatched = false; // Send pagehide event for subframes as well diff --git a/src/3rdparty/webkit/WebCore/loader/FrameLoader.h b/src/3rdparty/webkit/WebCore/loader/FrameLoader.h index 26206e6..4b4959b 100644 --- a/src/3rdparty/webkit/WebCore/loader/FrameLoader.h +++ b/src/3rdparty/webkit/WebCore/loader/FrameLoader.h @@ -35,6 +35,7 @@ #include "ResourceRequest.h" #include "ThreadableLoader.h" #include "Timer.h" +#include <wtf/Forward.h> namespace WebCore { @@ -411,15 +412,13 @@ namespace WebCore { void updateHistoryForAnchorScroll(); void redirectionTimerFired(Timer<FrameLoader>*); - void checkCompletedTimerFired(Timer<FrameLoader>*); - void checkLoadCompleteTimerFired(Timer<FrameLoader>*); + void checkTimerFired(Timer<FrameLoader>*); void cancelRedirection(bool newLoadInProgress = false); void started(); void completed(); - void parentCompleted(); bool shouldUsePlugin(const KURL&, const String& mimeType, bool hasFallback, bool& useFallback); bool loadPlugin(RenderPart*, const KURL&, const String& mimeType, @@ -485,7 +484,7 @@ namespace WebCore { bool shouldReloadToHandleUnreachableURL(DocumentLoader*); void handleUnimplementablePolicy(const ResourceError&); - void scheduleRedirection(ScheduledRedirection*); + void scheduleRedirection(PassOwnPtr<ScheduledRedirection>); void startRedirectionTimer(); void stopRedirectionTimer(); @@ -538,6 +537,7 @@ namespace WebCore { void scheduleCheckCompleted(); void scheduleCheckLoadComplete(); + void startCheckCompleteTimer(); KURL originalRequestURL() const; @@ -545,6 +545,9 @@ namespace WebCore { void saveScrollPositionAndViewStateToItem(HistoryItem*); + bool allAncestorsAreComplete() const; // including this + bool allChildrenAreComplete() const; // immediate children, not all descendants + Frame* m_frame; FrameLoaderClient* m_client; @@ -609,8 +612,9 @@ namespace WebCore { KURL m_submittedFormURL; Timer<FrameLoader> m_redirectionTimer; - Timer<FrameLoader> m_checkCompletedTimer; - Timer<FrameLoader> m_checkLoadCompleteTimer; + Timer<FrameLoader> m_checkTimer; + bool m_shouldCallCheckCompleted; + bool m_shouldCallCheckLoadComplete; Frame* m_opener; HashSet<Frame*> m_openedFrames; diff --git a/src/3rdparty/webkit/WebCore/loader/ImageDocument.cpp b/src/3rdparty/webkit/WebCore/loader/ImageDocument.cpp index d2b1dd6..8078ccd 100644 --- a/src/3rdparty/webkit/WebCore/loader/ImageDocument.cpp +++ b/src/3rdparty/webkit/WebCore/loader/ImageDocument.cpp @@ -70,7 +70,7 @@ private: { } - virtual void handleEvent(Event*, bool isWindowEvent); + virtual void handleEvent(Event*); ImageDocument* m_doc; }; @@ -358,7 +358,7 @@ bool ImageDocument::shouldShrinkToFit() const // -------- -void ImageEventListener::handleEvent(Event* event, bool) +void ImageEventListener::handleEvent(Event* event) { if (event->type() == eventNames().resizeEvent) m_doc->windowSizeChanged(); diff --git a/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheGroup.cpp b/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheGroup.cpp index d18dcf2..ed27ba0 100644 --- a/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheGroup.cpp +++ b/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheGroup.cpp @@ -774,7 +774,7 @@ void ApplicationCacheGroup::checkIfLoadIsComplete() ASSERT(cacheStorage().isMaximumSizeReached() && m_calledReachedMaxAppCacheSize); } - RefPtr<ApplicationCache> oldNewestCache = (m_newestCache == m_cacheBeingUpdated) ? 0 : m_newestCache; + RefPtr<ApplicationCache> oldNewestCache = (m_newestCache == m_cacheBeingUpdated) ? RefPtr<ApplicationCache>(0) : m_newestCache; setNewestCache(m_cacheBeingUpdated.release()); if (cacheStorage().storeNewestCache(this)) { @@ -962,7 +962,7 @@ public: ASSERT(frame->loader()->documentLoader() == m_documentLoader.get()); - m_documentLoader->applicationCacheHost()->notifyEventListener(m_eventID); + m_documentLoader->applicationCacheHost()->notifyDOMApplicationCache(m_eventID); } private: diff --git a/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheHost.cpp b/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheHost.cpp index 992f9e9..751efc1 100644 --- a/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheHost.cpp +++ b/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheHost.cpp @@ -227,10 +227,13 @@ void ApplicationCacheHost::setDOMApplicationCache(DOMApplicationCache* domApplic m_domApplicationCache = domApplicationCache; } -void ApplicationCacheHost::notifyEventListener(EventID id) +void ApplicationCacheHost::notifyDOMApplicationCache(EventID id) { - if (m_domApplicationCache) - m_domApplicationCache->callEventListener(id); + if (m_domApplicationCache) { + ExceptionCode ec = 0; + m_domApplicationCache->dispatchEvent(Event::create(DOMApplicationCache::toEventType(id), false, false), ec); + ASSERT(!ec); + } } void ApplicationCacheHost::setCandidateApplicationCacheGroup(ApplicationCacheGroup* group) diff --git a/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheHost.h b/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheHost.h index cb68862..236013d 100644 --- a/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheHost.h +++ b/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheHost.h @@ -108,7 +108,7 @@ namespace WebCore { bool swapCache(); void setDOMApplicationCache(DOMApplicationCache* domApplicationCache); - void notifyEventListener(EventID id); + void notifyDOMApplicationCache(EventID id); private: bool isApplicationCacheEnabled(); diff --git a/src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.cpp b/src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.cpp index dd0aed9..29c1bd5 100644 --- a/src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.cpp +++ b/src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.cpp @@ -91,73 +91,6 @@ ScriptExecutionContext* DOMApplicationCache::scriptExecutionContext() const return m_frame->document(); } -void DOMApplicationCache::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> eventListener, bool) -{ - EventListenersMap::iterator iter = m_eventListeners.find(eventType); - if (iter == m_eventListeners.end()) { - ListenerVector listeners; - listeners.append(eventListener); - m_eventListeners.add(eventType, listeners); - } else { - ListenerVector& listeners = iter->second; - for (ListenerVector::iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) { - if (**listenerIter == *eventListener) - return; - } - - listeners.append(eventListener); - m_eventListeners.add(eventType, listeners); - } -} - -void DOMApplicationCache::removeEventListener(const AtomicString& eventType, EventListener* eventListener, bool) -{ - EventListenersMap::iterator iter = m_eventListeners.find(eventType); - if (iter == m_eventListeners.end()) - return; - - ListenerVector& listeners = iter->second; - for (ListenerVector::const_iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) { - if (**listenerIter == *eventListener) { - listeners.remove(listenerIter - listeners.begin()); - return; - } - } -} - -bool DOMApplicationCache::dispatchEvent(PassRefPtr<Event> event, ExceptionCode& ec) -{ - if (!event || event->type().isEmpty()) { - ec = EventException::UNSPECIFIED_EVENT_TYPE_ERR; - return true; - } - - ListenerVector listenersCopy = m_eventListeners.get(event->type()); - for (ListenerVector::const_iterator listenerIter = listenersCopy.begin(); listenerIter != listenersCopy.end(); ++listenerIter) { - event->setTarget(this); - event->setCurrentTarget(this); - listenerIter->get()->handleEvent(event.get(), false); - } - - return !event->defaultPrevented(); -} - -void DOMApplicationCache::callListener(const AtomicString& eventType, EventListener* listener) -{ - ASSERT(m_frame); - - RefPtr<Event> event = Event::create(eventType, false, false); - if (listener) { - event->setTarget(this); - event->setCurrentTarget(this); - listener->handleEvent(event.get(), false); - } - - ExceptionCode ec = 0; - dispatchEvent(event.release(), ec); - ASSERT(!ec); -} - const AtomicString& DOMApplicationCache::toEventType(ApplicationCacheHost::EventID id) { switch (id) { @@ -182,27 +115,14 @@ const AtomicString& DOMApplicationCache::toEventType(ApplicationCacheHost::Event return eventNames().errorEvent; } -ApplicationCacheHost::EventID DOMApplicationCache::toEventID(const AtomicString& eventType) +EventTargetData* DOMApplicationCache::eventTargetData() { - if (eventType == eventNames().checkingEvent) - return ApplicationCacheHost::CHECKING_EVENT; - if (eventType == eventNames().errorEvent) - return ApplicationCacheHost::ERROR_EVENT; - if (eventType == eventNames().noupdateEvent) - return ApplicationCacheHost::NOUPDATE_EVENT; - if (eventType == eventNames().downloadingEvent) - return ApplicationCacheHost::DOWNLOADING_EVENT; - if (eventType == eventNames().progressEvent) - return ApplicationCacheHost::PROGRESS_EVENT; - if (eventType == eventNames().updatereadyEvent) - return ApplicationCacheHost::UPDATEREADY_EVENT; - if (eventType == eventNames().cachedEvent) - return ApplicationCacheHost::CACHED_EVENT; - if (eventType == eventNames().obsoleteEvent) - return ApplicationCacheHost::OBSOLETE_EVENT; - - ASSERT_NOT_REACHED(); - return ApplicationCacheHost::ERROR_EVENT; + return &m_eventTargetData; +} + +EventTargetData* DOMApplicationCache::ensureEventTargetData() +{ + return &m_eventTargetData; } } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.h b/src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.h index 09e9a03..077cae0 100644 --- a/src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.h +++ b/src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.h @@ -30,8 +30,9 @@ #include "ApplicationCacheHost.h" #include "AtomicStringHash.h" -#include "EventTarget.h" #include "EventListener.h" +#include "EventNames.h" +#include "EventTarget.h" #include <wtf/HashMap.h> #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> @@ -55,72 +56,39 @@ public: void update(ExceptionCode&); void swapCache(ExceptionCode&); - // Event listener attributes by EventID - - void setAttributeEventListener(ApplicationCacheHost::EventID id, PassRefPtr<EventListener> eventListener) { m_attributeEventListeners[id] = eventListener; } - EventListener* getAttributeEventListener(ApplicationCacheHost::EventID id) const { return m_attributeEventListeners[id].get(); } - void clearAttributeEventListener(ApplicationCacheHost::EventID id) { m_attributeEventListeners[id] = 0; } - void callEventListener(ApplicationCacheHost::EventID id) { callListener(toEventType(id), getAttributeEventListener(id)); } - // EventTarget impl - virtual void addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture); - virtual void removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture); - virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&); - typedef Vector<RefPtr<EventListener> > ListenerVector; - typedef HashMap<AtomicString, ListenerVector> EventListenersMap; - EventListenersMap& eventListeners() { return m_eventListeners; } - using RefCounted<DOMApplicationCache>::ref; using RefCounted<DOMApplicationCache>::deref; // Explicitly named attribute event listener helpers - void setOnchecking(PassRefPtr<EventListener> listener) { setAttributeEventListener(ApplicationCacheHost::CHECKING_EVENT, listener); } - EventListener* onchecking() const { return getAttributeEventListener(ApplicationCacheHost::CHECKING_EVENT); } - - void setOnerror(PassRefPtr<EventListener> listener) { setAttributeEventListener(ApplicationCacheHost::ERROR_EVENT, listener);} - EventListener* onerror() const { return getAttributeEventListener(ApplicationCacheHost::ERROR_EVENT); } - - void setOnnoupdate(PassRefPtr<EventListener> listener) { setAttributeEventListener(ApplicationCacheHost::NOUPDATE_EVENT, listener); } - EventListener* onnoupdate() const { return getAttributeEventListener(ApplicationCacheHost::NOUPDATE_EVENT); } - - void setOndownloading(PassRefPtr<EventListener> listener) { setAttributeEventListener(ApplicationCacheHost::DOWNLOADING_EVENT, listener); } - EventListener* ondownloading() const { return getAttributeEventListener(ApplicationCacheHost::DOWNLOADING_EVENT); } - - void setOnprogress(PassRefPtr<EventListener> listener) { setAttributeEventListener(ApplicationCacheHost::PROGRESS_EVENT, listener); } - EventListener* onprogress() const { return getAttributeEventListener(ApplicationCacheHost::PROGRESS_EVENT); } - - void setOnupdateready(PassRefPtr<EventListener> listener) { setAttributeEventListener(ApplicationCacheHost::UPDATEREADY_EVENT, listener); } - EventListener* onupdateready() const { return getAttributeEventListener(ApplicationCacheHost::UPDATEREADY_EVENT); } - - void setOncached(PassRefPtr<EventListener> listener) { setAttributeEventListener(ApplicationCacheHost::CACHED_EVENT, listener); } - EventListener* oncached() const { return getAttributeEventListener(ApplicationCacheHost::CACHED_EVENT); } - - void setOnobsolete(PassRefPtr<EventListener> listener) { setAttributeEventListener(ApplicationCacheHost::OBSOLETE_EVENT, listener); } - EventListener* onobsolete() const { return getAttributeEventListener(ApplicationCacheHost::OBSOLETE_EVENT); } + DEFINE_ATTRIBUTE_EVENT_LISTENER(checking); + DEFINE_ATTRIBUTE_EVENT_LISTENER(error); + DEFINE_ATTRIBUTE_EVENT_LISTENER(noupdate); + DEFINE_ATTRIBUTE_EVENT_LISTENER(downloading); + DEFINE_ATTRIBUTE_EVENT_LISTENER(progress); + DEFINE_ATTRIBUTE_EVENT_LISTENER(updateready); + DEFINE_ATTRIBUTE_EVENT_LISTENER(cached); + DEFINE_ATTRIBUTE_EVENT_LISTENER(obsolete); virtual ScriptExecutionContext* scriptExecutionContext() const; DOMApplicationCache* toDOMApplicationCache() { return this; } static const AtomicString& toEventType(ApplicationCacheHost::EventID id); - static ApplicationCacheHost::EventID toEventID(const AtomicString& eventType); private: DOMApplicationCache(Frame*); - void callListener(const AtomicString& eventType, EventListener*); - virtual void refEventTarget() { ref(); } virtual void derefEventTarget() { deref(); } + virtual EventTargetData* eventTargetData(); + virtual EventTargetData* ensureEventTargetData(); ApplicationCacheHost* applicationCacheHost() const; - - RefPtr<EventListener> m_attributeEventListeners[ApplicationCacheHost::OBSOLETE_EVENT + 1]; - - EventListenersMap m_eventListeners; Frame* m_frame; + EventTargetData m_eventTargetData; }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.idl b/src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.idl index ebc1d19..dd5468a 100644 --- a/src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.idl +++ b/src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.idl @@ -27,7 +27,7 @@ module offline { interface [ Conditional=OFFLINE_WEB_APPLICATIONS, - CustomMarkFunction + EventTarget ] DOMApplicationCache { // update status const unsigned short UNCACHED = 0; diff --git a/src/3rdparty/webkit/WebCore/mathml/MathMLElement.cpp b/src/3rdparty/webkit/WebCore/mathml/MathMLElement.cpp new file mode 100644 index 0000000..14febe5 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/mathml/MathMLElement.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2009 Alex Milowski (alex@milowski.com). 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 + * 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; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include "config.h" + +#if ENABLE(MATHML) + +#include "MathMLElement.h" + +#include "MathMLNames.h" +#include "RenderObject.h" + +namespace WebCore { + +using namespace MathMLNames; + +MathMLElement::MathMLElement(const QualifiedName& tagName, Document* document) + : StyledElement(tagName, document, CreateElementZeroRefCount) +{ +} + +PassRefPtr<MathMLElement> MathMLElement::create(const QualifiedName& tagName, Document* document) +{ + return new MathMLElement(tagName, document); +} + +RenderObject* MathMLElement::createRenderer(RenderArena*, RenderStyle* style) +{ + return RenderObject::createObject(this, style); +} + + +} + +#endif // ENABLE(MATHML) diff --git a/src/3rdparty/webkit/WebCore/mathml/MathMLElement.h b/src/3rdparty/webkit/WebCore/mathml/MathMLElement.h new file mode 100644 index 0000000..b00af47 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/mathml/MathMLElement.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2009 Alex Milowski (alex@milowski.com). 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 + * 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; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef MathMLElement_h +#define MathMLElement_h + +#if ENABLE(MATHML) +#include "StyledElement.h" + +namespace WebCore { + +class MathMLElement : public StyledElement { +public: + static PassRefPtr<MathMLElement> create(const QualifiedName& tagName, Document*); + + virtual bool isMathMLElement() const { return true; } + + virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); + +protected: + MathMLElement(const QualifiedName& tagName, Document*); + +}; + +} + +#endif // ENABLE(MATHML) +#endif // MathMLElement_h diff --git a/src/3rdparty/webkit/WebCore/mathml/MathMLInlineContainerElement.cpp b/src/3rdparty/webkit/WebCore/mathml/MathMLInlineContainerElement.cpp new file mode 100644 index 0000000..2bb02f6 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/mathml/MathMLInlineContainerElement.cpp @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2009 Alex Milowski (alex@milowski.com). 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 + * 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; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include "config.h" + +#if ENABLE(MATHML) + +#include "MathMLInlineContainerElement.h" + +#include "MathMLNames.h" +#include "RenderObject.h" + +namespace WebCore { + +using namespace MathMLNames; + +MathMLInlineContainerElement::MathMLInlineContainerElement(const QualifiedName& tagName, Document* document) + : MathMLElement(tagName, document) +{ +} + +PassRefPtr<MathMLInlineContainerElement> MathMLInlineContainerElement::create(const QualifiedName& tagName, Document* document) +{ + return new MathMLInlineContainerElement(tagName, document); +} + +RenderObject* MathMLInlineContainerElement::createRenderer(RenderArena *, RenderStyle* style) +{ + // FIXME: This method will contain the specialized renderers based on element name + return RenderObject::createObject(this, style); +} + + +} + +#endif // ENABLE(MATHML) + diff --git a/src/3rdparty/webkit/WebCore/mathml/MathMLInlineContainerElement.h b/src/3rdparty/webkit/WebCore/mathml/MathMLInlineContainerElement.h new file mode 100644 index 0000000..4529d3b --- /dev/null +++ b/src/3rdparty/webkit/WebCore/mathml/MathMLInlineContainerElement.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2009 Alex Milowski (alex@milowski.com). 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 + * 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; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef MathMLInlineContainerElement_h +#define MathMLInlineContainerElement_h + +#if ENABLE(MATHML) +#include "MathMLElement.h" + +namespace WebCore { + +class MathMLInlineContainerElement : public MathMLElement { +public: + static PassRefPtr<MathMLInlineContainerElement> create(const QualifiedName& tagName, Document*); + + virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); + +protected: + MathMLInlineContainerElement(const QualifiedName& tagName, Document*); + +}; + +} + +#endif // ENABLE(MATHML) +#endif // MathMLInlineContainerElement_h diff --git a/src/3rdparty/webkit/WebCore/mathml/MathMLMathElement.cpp b/src/3rdparty/webkit/WebCore/mathml/MathMLMathElement.cpp new file mode 100644 index 0000000..8b083f4 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/mathml/MathMLMathElement.cpp @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2009 Alex Milowski (alex@milowski.com). 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 + * 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; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include "config.h" + +#if ENABLE(MATHML) + +#include "MathMLMathElement.h" + +#include "MathMLNames.h" +#include "RenderObject.h" + +namespace WebCore { + +using namespace MathMLNames; + +MathMLMathElement::MathMLMathElement(const QualifiedName& tagName, Document* document) + : MathMLInlineContainerElement(tagName, document) +{ +} + +PassRefPtr<MathMLMathElement> MathMLMathElement::create(const QualifiedName& tagName, Document* document) +{ + return new MathMLMathElement(tagName, document); +} + +} + +#endif // ENABLE(MATHML) diff --git a/src/3rdparty/webkit/WebCore/mathml/MathMLMathElement.h b/src/3rdparty/webkit/WebCore/mathml/MathMLMathElement.h new file mode 100644 index 0000000..f363cd2 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/mathml/MathMLMathElement.h @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2009 Alex Milowski (alex@milowski.com). 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 + * 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; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef MathMLMathElement_h +#define MathMLMathElement_h + +#if ENABLE(MATHML) +#include "MathMLInlineContainerElement.h" + +namespace WebCore { + +class MathMLMathElement : public MathMLInlineContainerElement { +public: + static PassRefPtr<MathMLMathElement> create(const QualifiedName& tagName, Document*); + +protected: + MathMLMathElement(const QualifiedName& tagName, Document*); + +}; + +} + +#endif // ENABLE(MATHML) +#endif // MathMLMathElement_h diff --git a/src/3rdparty/webkit/WebCore/mathml/mathtags.in b/src/3rdparty/webkit/WebCore/mathml/mathtags.in new file mode 100644 index 0000000..8704dbf --- /dev/null +++ b/src/3rdparty/webkit/WebCore/mathml/mathtags.in @@ -0,0 +1,21 @@ +namespace="MathML" +namespaceURI="http://www.w3.org/1998/Math/MathML" +guardFactoryWith="ENABLE(MATHML)" +exportStrings + +math +mfrac interfaceName=MathMLInlineContainerElement +mfenced interfaceName=MathMLInlineContainerElement +msubsup interfaceName=MathMLInlineContainerElement +mrow interfaceName=MathMLInlineContainerElement +mover interfaceName=MathMLInlineContainerElement +munder interfaceName=MathMLInlineContainerElement +munderover interfaceName=MathMLInlineContainerElement +msqrt interfaceName=MathMLInlineContainerElement +mroot interfaceName=MathMLInlineContainerElement +mi interfaceName=MathMLElement, createWithNew +mn interfaceName=MathMLElement, createWithNew +mo interfaceName=MathMLElement, createWithNew +msub interfaceName=MathMLElement, createWithNew +msup interfaceName=MathMLElement, createWithNew + diff --git a/src/3rdparty/webkit/WebCore/notifications/Notification.cpp b/src/3rdparty/webkit/WebCore/notifications/Notification.cpp index 61ad1f3..8dd168f 100644 --- a/src/3rdparty/webkit/WebCore/notifications/Notification.cpp +++ b/src/3rdparty/webkit/WebCore/notifications/Notification.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2009 Google Inc. All rights reserved. + * Copyright (C) 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -96,137 +97,14 @@ void Notification::cancel() m_presenter->cancel(this); } -EventListener* Notification::ondisplay() const +EventTargetData* Notification::eventTargetData() { - return getAttributeEventListener("display"); + return &m_eventTargetData; } -void Notification::setOndisplay(PassRefPtr<EventListener> eventListener) +EventTargetData* Notification::ensureEventTargetData() { - setAttributeEventListener("display", eventListener); -} - -EventListener* Notification::onerror() const -{ - return getAttributeEventListener(eventNames().errorEvent); -} - -void Notification::setOnerror(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().errorEvent, eventListener); -} - -EventListener* Notification::onclose() const -{ - return getAttributeEventListener(eventNames().closeEvent); -} - -void Notification::setOnclose(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().closeEvent, eventListener); -} - -EventListener* Notification::getAttributeEventListener(const AtomicString& eventType) const -{ - const RegisteredEventListenerVector& listeners = m_eventListeners; - size_t size = listeners.size(); - for (size_t i = 0; i < size; ++i) { - const RegisteredEventListener& r = *listeners[i]; - if (r.eventType() == eventType && r.listener()->isAttribute()) - return r.listener(); - } - return 0; -} - -void Notification::setAttributeEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener) -{ - clearAttributeEventListener(eventType); - if (listener) - addEventListener(eventType, listener, false); -} - -void Notification::clearAttributeEventListener(const AtomicString& eventType) -{ - RegisteredEventListenerVector* listeners = &m_eventListeners; - size_t size = listeners->size(); - for (size_t i = 0; i < size; ++i) { - RegisteredEventListener& r = *listeners->at(i); - if (r.eventType() != eventType || !r.listener()->isAttribute()) - continue; - - r.setRemoved(true); - listeners->remove(i); - return; - } -} - -void Notification::dispatchDisplayEvent() -{ - RefPtr<Event> event = Event::create("display", false, true); - ExceptionCode ec = 0; - dispatchEvent(event.release(), ec); - ASSERT(!ec); -} - -void Notification::dispatchErrorEvent() -{ - RefPtr<Event> event = Event::create(eventNames().errorEvent, false, true); - ExceptionCode ec = 0; - dispatchEvent(event.release(), ec); - ASSERT(!ec); -} - -void Notification::dispatchCloseEvent() -{ - RefPtr<Event> event = Event::create(eventNames().closeEvent, false, true); - ExceptionCode ec = 0; - dispatchEvent(event.release(), ec); - ASSERT(!ec); -} - -void Notification::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture) -{ - RefPtr<RegisteredEventListener> registeredListener = RegisteredEventListener::create(eventType, listener, useCapture); - m_eventListeners.append(registeredListener); -} - -void Notification::removeEventListener(const AtomicString& eventType, EventListener* listener, bool useCapture) -{ - size_t size = m_eventListeners.size(); - for (size_t i = 0; i < size; ++i) { - RegisteredEventListener& r = *m_eventListeners[i]; - if (r.eventType() == eventType && r.useCapture() == useCapture && *r.listener() == *listener) { - r.setRemoved(true); - m_eventListeners.remove(i); - return; - } - } -} - -void Notification::handleEvent(PassRefPtr<Event> event, bool useCapture) -{ - RegisteredEventListenerVector listenersCopy = m_eventListeners; - size_t size = listenersCopy.size(); - for (size_t i = 0; i < size; ++i) { - RegisteredEventListener& r = *listenersCopy[i]; - if (r.eventType() == event->type() && r.useCapture() == useCapture && !r.removed()) - r.listener()->handleEvent(event.get()); - } -} - -bool Notification::dispatchEvent(PassRefPtr<Event> inEvent, ExceptionCode&) -{ - RefPtr<Event> event(inEvent); - - event->setEventPhase(Event::AT_TARGET); - event->setCurrentTarget(this); - - handleEvent(event.get(), true); - if (!event->propagationStopped()) { - handleEvent(event.get(), false); - } - - return !event->defaultPrevented(); + return &m_eventTargetData; } } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/notifications/Notification.h b/src/3rdparty/webkit/WebCore/notifications/Notification.h index baae4ee..6545579 100644 --- a/src/3rdparty/webkit/WebCore/notifications/Notification.h +++ b/src/3rdparty/webkit/WebCore/notifications/Notification.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2009 Google Inc. All rights reserved. + * Copyright (C) 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -35,6 +36,7 @@ #include "AtomicStringHash.h" #include "Event.h" #include "EventListener.h" +#include "EventNames.h" #include "EventTarget.h" #include "ExceptionCode.h" #include "KURL.h" @@ -65,33 +67,17 @@ namespace WebCore { KURL url() { return m_notificationURL; } NotificationContents& contents() { return m_contents; } - EventListener* ondisplay() const; - void setOndisplay(PassRefPtr<EventListener> eventListener); - EventListener* onerror() const; - void setOnerror(PassRefPtr<EventListener> eventListener); - EventListener* onclose() const; - void setOnclose(PassRefPtr<EventListener> eventListener); + DEFINE_ATTRIBUTE_EVENT_LISTENER(display); + DEFINE_ATTRIBUTE_EVENT_LISTENER(error); + DEFINE_ATTRIBUTE_EVENT_LISTENER(close); using RefCounted<Notification>::ref; using RefCounted<Notification>::deref; - // Dispatching of events on the notification. The presenter should call these when events occur. - void dispatchDisplayEvent(); - void dispatchErrorEvent(); - void dispatchCloseEvent(); - // EventTarget interface virtual ScriptExecutionContext* scriptExecutionContext() const { return ActiveDOMObject::scriptExecutionContext(); } - virtual void addEventListener(const AtomicString&, PassRefPtr<EventListener>, bool); - virtual void removeEventListener(const AtomicString&, EventListener*, bool); - virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&); virtual Notification* toNotification() { return this; } - // These methods are for onEvent style listeners. - EventListener* getAttributeEventListener(const AtomicString&) const; - void setAttributeEventListener(const AtomicString&, PassRefPtr<EventListener>); - void clearAttributeEventListener(const AtomicString&); - private: Notification(const String& url, ScriptExecutionContext* context, ExceptionCode& ec, NotificationPresenter* provider); Notification(const NotificationContents& fields, ScriptExecutionContext* context, ExceptionCode& ec, NotificationPresenter* provider); @@ -99,8 +85,8 @@ namespace WebCore { // EventTarget interface virtual void refEventTarget() { ref(); } virtual void derefEventTarget() { deref(); } - - void handleEvent(PassRefPtr<Event> event, bool useCapture); + virtual EventTargetData* eventTargetData(); + virtual EventTargetData* ensureEventTargetData(); bool m_isHTML; KURL m_notificationURL; @@ -108,9 +94,9 @@ namespace WebCore { bool m_isShowing; - RegisteredEventListenerVector m_eventListeners; - NotificationPresenter* m_presenter; + + EventTargetData m_eventTargetData; }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/notifications/Notification.idl b/src/3rdparty/webkit/WebCore/notifications/Notification.idl index eca2eb4..ec6a9c8 100644 --- a/src/3rdparty/webkit/WebCore/notifications/Notification.idl +++ b/src/3rdparty/webkit/WebCore/notifications/Notification.idl @@ -31,7 +31,8 @@ module threads { interface [ - Conditional=NOTIFICATIONS + Conditional=NOTIFICATIONS, + EventTarget ] Notification { void show(); void cancel(); diff --git a/src/3rdparty/webkit/WebCore/page/Chrome.cpp b/src/3rdparty/webkit/WebCore/page/Chrome.cpp index a16db68..96f0fb7 100644 --- a/src/3rdparty/webkit/WebCore/page/Chrome.cpp +++ b/src/3rdparty/webkit/WebCore/page/Chrome.cpp @@ -87,9 +87,9 @@ IntRect Chrome::windowToScreen(const IntRect& rect) const return m_client->windowToScreen(rect); } -PlatformWidget Chrome::platformWindow() const +PlatformPageClient Chrome::platformPageClient() const { - return m_client->platformWindow(); + return m_client->platformPageClient(); } void Chrome::contentsSizeChanged(Frame* frame, const IntSize& size) const diff --git a/src/3rdparty/webkit/WebCore/page/Chrome.h b/src/3rdparty/webkit/WebCore/page/Chrome.h index 79d3eca..033311d 100644 --- a/src/3rdparty/webkit/WebCore/page/Chrome.h +++ b/src/3rdparty/webkit/WebCore/page/Chrome.h @@ -63,7 +63,7 @@ namespace WebCore { virtual void scroll(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect); virtual IntPoint screenToWindow(const IntPoint&) const; virtual IntRect windowToScreen(const IntRect&) const; - virtual PlatformWidget platformWindow() const; + virtual PlatformPageClient platformPageClient() const; virtual void scrollRectIntoView(const IntRect&, const ScrollView*) const; virtual void scrollbarsModeDidChange() const; diff --git a/src/3rdparty/webkit/WebCore/page/ChromeClient.h b/src/3rdparty/webkit/WebCore/page/ChromeClient.h index 2a1e991..2d11275 100644 --- a/src/3rdparty/webkit/WebCore/page/ChromeClient.h +++ b/src/3rdparty/webkit/WebCore/page/ChromeClient.h @@ -128,7 +128,7 @@ namespace WebCore { virtual void scroll(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect) = 0; virtual IntPoint screenToWindow(const IntPoint&) const = 0; virtual IntRect windowToScreen(const IntRect&) const = 0; - virtual PlatformWidget platformWindow() const = 0; + virtual PlatformPageClient platformPageClient() const = 0; virtual void contentsSizeChanged(Frame*, const IntSize&) const = 0; virtual void scrollRectIntoView(const IntRect&, const ScrollView*) const = 0; // Currently only Mac has a non empty implementation. // End methods used by HostWindow. diff --git a/src/3rdparty/webkit/WebCore/page/DOMWindow.cpp b/src/3rdparty/webkit/WebCore/page/DOMWindow.cpp index 783f93d..809d541 100644 --- a/src/3rdparty/webkit/WebCore/page/DOMWindow.cpp +++ b/src/3rdparty/webkit/WebCore/page/DOMWindow.cpp @@ -105,7 +105,7 @@ public: PassRefPtr<MessageEvent> event(ScriptExecutionContext* context) { OwnPtr<MessagePortArray> messagePorts = MessagePort::entanglePorts(*context, m_channels.release()); - return MessageEvent::create(m_message, m_origin, "", m_source, messagePorts.release()); + return MessageEvent::create(messagePorts.release(), m_message, m_origin, "", m_source); } SecurityOrigin* targetOrigin() const { return m_targetOrigin.get(); } @@ -123,83 +123,36 @@ private: RefPtr<SecurityOrigin> m_targetOrigin; }; -typedef HashMap<DOMWindow*, RegisteredEventListenerVector*> DOMWindowRegisteredEventListenerMap; +typedef HashCountedSet<DOMWindow*> DOMWindowSet; -static DOMWindowRegisteredEventListenerMap& pendingUnloadEventListenerMap() +static DOMWindowSet& windowsWithUnloadEventListeners() { - DEFINE_STATIC_LOCAL(DOMWindowRegisteredEventListenerMap, eventListenerMap, ()); - return eventListenerMap; + DEFINE_STATIC_LOCAL(DOMWindowSet, windowsWithUnloadEventListeners, ()); + return windowsWithUnloadEventListeners; } -static DOMWindowRegisteredEventListenerMap& pendingBeforeUnloadEventListenerMap() +static DOMWindowSet& windowsWithBeforeUnloadEventListeners() { - DEFINE_STATIC_LOCAL(DOMWindowRegisteredEventListenerMap, eventListenerMap, ()); - return eventListenerMap; + DEFINE_STATIC_LOCAL(DOMWindowSet, windowsWithBeforeUnloadEventListeners, ()); + return windowsWithBeforeUnloadEventListeners; } -static bool allowsPendingBeforeUnloadListeners(DOMWindow* window) +static bool allowsBeforeUnloadListeners(DOMWindow* window) { ASSERT_ARG(window, window); Frame* frame = window->frame(); + if (!frame) + return false; Page* page = frame->page(); - return page && frame == page->mainFrame(); -} - -static void addPendingEventListener(DOMWindowRegisteredEventListenerMap& map, DOMWindow* window, RegisteredEventListener* listener) -{ - ASSERT_ARG(window, window); - ASSERT_ARG(listener, listener); - - if (map.isEmpty()) - disableSuddenTermination(); - - pair<DOMWindowRegisteredEventListenerMap::iterator, bool> result = map.add(window, 0); - if (result.second) - result.first->second = new RegisteredEventListenerVector; - result.first->second->append(listener); -} - -static void removePendingEventListener(DOMWindowRegisteredEventListenerMap& map, DOMWindow* window, RegisteredEventListener* listener) -{ - ASSERT_ARG(window, window); - ASSERT_ARG(listener, listener); - - DOMWindowRegisteredEventListenerMap::iterator it = map.find(window); - ASSERT(it != map.end()); - - RegisteredEventListenerVector* listeners = it->second; - size_t index = listeners->find(listener); - ASSERT(index != WTF::notFound); - listeners->remove(index); - - if (!listeners->isEmpty()) - return; - - map.remove(it); - delete listeners; - - if (map.isEmpty()) - enableSuddenTermination(); -} - -static void removePendingEventListeners(DOMWindowRegisteredEventListenerMap& map, DOMWindow* window) -{ - ASSERT_ARG(window, window); - - RegisteredEventListenerVector* listeners = map.take(window); - if (!listeners) - return; - - delete listeners; - - if (map.isEmpty()) - enableSuddenTermination(); + if (!page) + return false; + return frame == page->mainFrame(); } bool DOMWindow::dispatchAllPendingBeforeUnloadEvents() { - DOMWindowRegisteredEventListenerMap& map = pendingBeforeUnloadEventListenerMap(); - if (map.isEmpty()) + DOMWindowSet& set = windowsWithBeforeUnloadEventListeners(); + if (set.isEmpty()) return true; static bool alreadyDispatched = false; @@ -208,20 +161,21 @@ bool DOMWindow::dispatchAllPendingBeforeUnloadEvents() return true; Vector<RefPtr<DOMWindow> > windows; - DOMWindowRegisteredEventListenerMap::iterator mapEnd = map.end(); - for (DOMWindowRegisteredEventListenerMap::iterator it = map.begin(); it != mapEnd; ++it) + DOMWindowSet::iterator end = set.end(); + for (DOMWindowSet::iterator it = set.begin(); it != end; ++it) windows.append(it->first); size_t size = windows.size(); for (size_t i = 0; i < size; ++i) { DOMWindow* window = windows[i].get(); - RegisteredEventListenerVector* listeners = map.get(window); - if (!listeners) + if (!set.contains(window)) continue; - RegisteredEventListenerVector listenersCopy = *listeners; Frame* frame = window->frame(); - if (!frame->shouldClose(&listenersCopy)) + if (!frame) + continue; + + if (!frame->shouldClose()) return false; } @@ -234,14 +188,13 @@ bool DOMWindow::dispatchAllPendingBeforeUnloadEvents() unsigned DOMWindow::pendingUnloadEventListeners() const { - RegisteredEventListenerVector* listeners = pendingUnloadEventListenerMap().get(const_cast<DOMWindow*>(this)); - return listeners ? listeners->size() : 0; + return windowsWithUnloadEventListeners().count(const_cast<DOMWindow*>(this)); } void DOMWindow::dispatchAllPendingUnloadEvents() { - DOMWindowRegisteredEventListenerMap& map = pendingUnloadEventListenerMap(); - if (map.isEmpty()) + DOMWindowSet& set = windowsWithBeforeUnloadEventListeners(); + if (set.isEmpty()) return; static bool alreadyDispatched = false; @@ -250,19 +203,18 @@ void DOMWindow::dispatchAllPendingUnloadEvents() return; Vector<RefPtr<DOMWindow> > windows; - DOMWindowRegisteredEventListenerMap::iterator mapEnd = map.end(); - for (DOMWindowRegisteredEventListenerMap::iterator it = map.begin(); it != mapEnd; ++it) + DOMWindowSet::iterator end = set.end(); + for (DOMWindowSet::iterator it = set.begin(); it != end; ++it) windows.append(it->first); size_t size = windows.size(); for (size_t i = 0; i < size; ++i) { DOMWindow* window = windows[i].get(); - RegisteredEventListenerVector* listeners = map.get(window); - if (!listeners) + if (!set.contains(window)) continue; - RegisteredEventListenerVector listenersCopy = *listeners; - window->dispatchPageTransitionEvent(EventNames().pagehideEvent, false); - window->dispatchUnloadEvent(&listenersCopy); + + window->dispatchEvent(PageTransitionEvent::create(EventNames().pagehideEvent, false), window->document()); + window->dispatchEvent(Event::create(eventNames().unloadEvent, false, false), window->document()); } enableSuddenTermination(); @@ -376,8 +328,8 @@ DOMWindow::~DOMWindow() if (m_frame) m_frame->clearFormerDOMWindow(this); - removePendingEventListeners(pendingUnloadEventListenerMap(), this); - removePendingEventListeners(pendingBeforeUnloadEventListenerMap(), this); + windowsWithUnloadEventListeners().clear(this); + windowsWithBeforeUnloadEventListeners().clear(this); } ScriptExecutionContext* DOMWindow::scriptExecutionContext() const @@ -462,6 +414,16 @@ void DOMWindow::clear() #endif } +#if ENABLE(ORIENTATION_EVENTS) +int DOMWindow::orientation() const +{ + if (!m_frame) + return 0; + + return m_frame->orientation(); +} +#endif + Screen* DOMWindow::screen() const { if (!m_screen) @@ -682,8 +644,7 @@ void DOMWindow::postMessageTimerFired(PostMessageTimer* t) } } - ExceptionCode ec = 0; - dispatchEvent(timer->event(document()), ec); + dispatchEvent(timer->event(document())); } DOMSelection* DOMWindow::getSelection() @@ -1245,104 +1206,38 @@ void DOMWindow::clearInterval(int timeoutId) DOMTimer::removeById(scriptExecutionContext(), timeoutId); } -void DOMWindow::handleEvent(Event* event, bool useCapture, RegisteredEventListenerVector* alternateListeners) +bool DOMWindow::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture) { - RegisteredEventListenerVector& listeners = (alternateListeners ? *alternateListeners : m_eventListeners); - if (listeners.isEmpty()) - return; - - // If any HTML event listeners are registered on the window, dispatch them here. - RegisteredEventListenerVector listenersCopy = listeners; - size_t size = listenersCopy.size(); - for (size_t i = 0; i < size; ++i) { - RegisteredEventListener& r = *listenersCopy[i]; - if (r.eventType() == event->type() && r.useCapture() == useCapture && !r.removed()) - r.listener()->handleEvent(event, true); - } -} + if (!EventTarget::addEventListener(eventType, listener, useCapture)) + return false; -void DOMWindow::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture) -{ - // Remove existing identical listener set with identical arguments. - // The DOM 2 spec says that "duplicate instances are discarded" in this case. - removeEventListener(eventType, listener.get(), useCapture); if (Document* document = this->document()) document->addListenerTypeIfNeeded(eventType); - RefPtr<RegisteredEventListener> registeredListener = RegisteredEventListener::create(eventType, listener, useCapture); - m_eventListeners.append(registeredListener); - if (eventType == eventNames().unloadEvent) - addPendingEventListener(pendingUnloadEventListenerMap(), this, registeredListener.get()); - else if (eventType == eventNames().beforeunloadEvent && allowsPendingBeforeUnloadListeners(this)) - addPendingEventListener(pendingBeforeUnloadEventListenerMap(), this, registeredListener.get()); -} - -void DOMWindow::removeEventListener(const AtomicString& eventType, EventListener* listener, bool useCapture) -{ - size_t size = m_eventListeners.size(); - for (size_t i = 0; i < size; ++i) { - RegisteredEventListener& r = *m_eventListeners[i]; - if (r.eventType() == eventType && r.useCapture() == useCapture && *r.listener() == *listener) { - if (eventType == eventNames().unloadEvent) - removePendingEventListener(pendingUnloadEventListenerMap(), this, &r); - else if (eventType == eventNames().beforeunloadEvent && allowsPendingBeforeUnloadListeners(this)) - removePendingEventListener(pendingBeforeUnloadEventListenerMap(), this, &r); - r.setRemoved(true); - m_eventListeners.remove(i); - return; - } - } -} - -bool DOMWindow::dispatchEvent(PassRefPtr<Event> e, ExceptionCode& ec) -{ - ASSERT(!eventDispatchForbidden()); - - RefPtr<Event> event = e; - if (!event || event->type().isEmpty()) { - ec = EventException::UNSPECIFIED_EVENT_TYPE_ERR; - return true; - } - - RefPtr<DOMWindow> protect(this); - - event->setTarget(this); - event->setCurrentTarget(this); + windowsWithUnloadEventListeners().add(this); + else if (eventType == eventNames().beforeunloadEvent && allowsBeforeUnloadListeners(this)) + windowsWithBeforeUnloadEventListeners().add(this); - handleEvent(event.get(), true); - handleEvent(event.get(), false); - - return !event->defaultPrevented(); -} - -void DOMWindow::dispatchEvent(const AtomicString& eventType, bool canBubble, bool cancelable) -{ - ASSERT(!eventDispatchForbidden()); - ExceptionCode ec = 0; - dispatchEvent(Event::create(eventType, canBubble, cancelable), ec); + return true; } -// This function accommodates the Firefox quirk of dispatching the load, unload and -// beforeunload events on the window, but setting event.target to be the Document. -inline void DOMWindow::dispatchEventWithDocumentAsTarget(PassRefPtr<Event> e, RegisteredEventListenerVector* alternateEventListeners) +bool DOMWindow::removeEventListener(const AtomicString& eventType, EventListener* listener, bool useCapture) { - ASSERT(!eventDispatchForbidden()); - - RefPtr<Event> event = e; - RefPtr<DOMWindow> protect(this); - RefPtr<Document> document = this->document(); + if (!EventTarget::removeEventListener(eventType, listener, useCapture)) + return false; - event->setTarget(document); - event->setCurrentTarget(this); + if (eventType == eventNames().unloadEvent) + windowsWithUnloadEventListeners().remove(this); + else if (eventType == eventNames().beforeunloadEvent && allowsBeforeUnloadListeners(this)) + windowsWithBeforeUnloadEventListeners().remove(this); - handleEvent(event.get(), true, alternateEventListeners); - handleEvent(event.get(), false, alternateEventListeners); + return true; } void DOMWindow::dispatchLoadEvent() { - dispatchEventWithDocumentAsTarget(Event::create(eventNames().loadEvent, false, false)); + dispatchEvent(Event::create(eventNames().loadEvent, false, false), document()); // For load events, send a separate load event to the enclosing frame only. // This is a DOM extension and is independent of bubbling/capturing rules of @@ -1355,747 +1250,44 @@ void DOMWindow::dispatchLoadEvent() } } -void DOMWindow::dispatchUnloadEvent(RegisteredEventListenerVector* alternateEventListeners) +bool DOMWindow::dispatchEvent(PassRefPtr<Event> prpEvent, PassRefPtr<EventTarget> prpTarget) { - dispatchEventWithDocumentAsTarget(Event::create(eventNames().unloadEvent, false, false), alternateEventListeners); -} + RefPtr<EventTarget> protect = this; + RefPtr<Event> event = prpEvent; -PassRefPtr<BeforeUnloadEvent> DOMWindow::dispatchBeforeUnloadEvent(RegisteredEventListenerVector* alternateEventListeners) -{ - RefPtr<BeforeUnloadEvent> beforeUnloadEvent = BeforeUnloadEvent::create(); - dispatchEventWithDocumentAsTarget(beforeUnloadEvent.get(), alternateEventListeners); - return beforeUnloadEvent.release(); -} + event->setTarget(prpTarget ? prpTarget : this); + event->setCurrentTarget(this); + event->setEventPhase(Event::AT_TARGET); -void DOMWindow::dispatchPageTransitionEvent(const AtomicString& eventType, bool persisted) -{ - dispatchEventWithDocumentAsTarget(PageTransitionEvent::create(eventType, persisted)); + return fireEventListeners(event.get()); } void DOMWindow::removeAllEventListeners() { - size_t size = m_eventListeners.size(); - for (size_t i = 0; i < size; ++i) - m_eventListeners[i]->setRemoved(true); - m_eventListeners.clear(); - - removePendingEventListeners(pendingUnloadEventListenerMap(), this); - removePendingEventListeners(pendingBeforeUnloadEventListenerMap(), this); -} - -bool DOMWindow::hasEventListener(const AtomicString& eventType) -{ - size_t size = m_eventListeners.size(); - for (size_t i = 0; i < size; ++i) { - if (m_eventListeners[i]->eventType() == eventType) - return true; - } - return false; -} - -void DOMWindow::setAttributeEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener) -{ - clearAttributeEventListener(eventType); - if (listener) - addEventListener(eventType, listener, false); -} - -void DOMWindow::clearAttributeEventListener(const AtomicString& eventType) -{ - size_t size = m_eventListeners.size(); - for (size_t i = 0; i < size; ++i) { - RegisteredEventListener& r = *m_eventListeners[i]; - if (r.eventType() == eventType && r.listener()->isAttribute()) { - if (eventType == eventNames().unloadEvent) - removePendingEventListener(pendingUnloadEventListenerMap(), this, &r); - else if (eventType == eventNames().beforeunloadEvent && allowsPendingBeforeUnloadListeners(this)) - removePendingEventListener(pendingBeforeUnloadEventListenerMap(), this, &r); - r.setRemoved(true); - m_eventListeners.remove(i); - return; - } - } -} - -EventListener* DOMWindow::getAttributeEventListener(const AtomicString& eventType) const -{ - size_t size = m_eventListeners.size(); - for (size_t i = 0; i < size; ++i) { - RegisteredEventListener& r = *m_eventListeners[i]; - if (r.eventType() == eventType && r.listener()->isAttribute()) - return r.listener(); - } - return 0; -} - -EventListener* DOMWindow::onabort() const -{ - return getAttributeEventListener(eventNames().abortEvent); -} - -void DOMWindow::setOnabort(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().abortEvent, eventListener); -} - -EventListener* DOMWindow::onblur() const -{ - return getAttributeEventListener(eventNames().blurEvent); -} - -void DOMWindow::setOnblur(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().blurEvent, eventListener); -} - -EventListener* DOMWindow::onchange() const -{ - return getAttributeEventListener(eventNames().changeEvent); -} - -void DOMWindow::setOnchange(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().changeEvent, eventListener); -} - -EventListener* DOMWindow::onclick() const -{ - return getAttributeEventListener(eventNames().clickEvent); -} - -void DOMWindow::setOnclick(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().clickEvent, eventListener); -} - -EventListener* DOMWindow::ondblclick() const -{ - return getAttributeEventListener(eventNames().dblclickEvent); -} - -void DOMWindow::setOndblclick(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().dblclickEvent, eventListener); -} - -EventListener* DOMWindow::ondrag() const -{ - return getAttributeEventListener(eventNames().dragEvent); -} - -void DOMWindow::setOndrag(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().dragEvent, eventListener); -} - -EventListener* DOMWindow::ondragend() const -{ - return getAttributeEventListener(eventNames().dragendEvent); -} - -void DOMWindow::setOndragend(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().dragendEvent, eventListener); -} - -EventListener* DOMWindow::ondragenter() const -{ - return getAttributeEventListener(eventNames().dragenterEvent); -} - -void DOMWindow::setOndragenter(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().dragenterEvent, eventListener); -} - -EventListener* DOMWindow::ondragleave() const -{ - return getAttributeEventListener(eventNames().dragleaveEvent); -} - -void DOMWindow::setOndragleave(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().dragleaveEvent, eventListener); -} - -EventListener* DOMWindow::ondragover() const -{ - return getAttributeEventListener(eventNames().dragoverEvent); -} - -void DOMWindow::setOndragover(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().dragoverEvent, eventListener); -} - -EventListener* DOMWindow::ondragstart() const -{ - return getAttributeEventListener(eventNames().dragstartEvent); -} - -void DOMWindow::setOndragstart(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().dragstartEvent, eventListener); -} - -EventListener* DOMWindow::ondrop() const -{ - return getAttributeEventListener(eventNames().dropEvent); -} - -void DOMWindow::setOndrop(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().dropEvent, eventListener); -} - -EventListener* DOMWindow::onerror() const -{ - return getAttributeEventListener(eventNames().errorEvent); -} - -void DOMWindow::setOnerror(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().errorEvent, eventListener); -} - -EventListener* DOMWindow::onfocus() const -{ - return getAttributeEventListener(eventNames().focusEvent); -} - -void DOMWindow::setOnfocus(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().focusEvent, eventListener); -} - -EventListener* DOMWindow::onhashchange() const -{ - return getAttributeEventListener(eventNames().hashchangeEvent); -} - -void DOMWindow::setOnhashchange(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().hashchangeEvent, eventListener); -} - -EventListener* DOMWindow::onkeydown() const -{ - return getAttributeEventListener(eventNames().keydownEvent); -} - -void DOMWindow::setOnkeydown(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().keydownEvent, eventListener); -} - -EventListener* DOMWindow::onkeypress() const -{ - return getAttributeEventListener(eventNames().keypressEvent); -} - -void DOMWindow::setOnkeypress(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().keypressEvent, eventListener); -} - -EventListener* DOMWindow::onkeyup() const -{ - return getAttributeEventListener(eventNames().keyupEvent); -} - -void DOMWindow::setOnkeyup(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().keyupEvent, eventListener); -} - -EventListener* DOMWindow::onload() const -{ - return getAttributeEventListener(eventNames().loadEvent); -} - -void DOMWindow::setOnload(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().loadEvent, eventListener); -} - -EventListener* DOMWindow::onmousedown() const -{ - return getAttributeEventListener(eventNames().mousedownEvent); -} - -void DOMWindow::setOnmousedown(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().mousedownEvent, eventListener); -} - -EventListener* DOMWindow::onmousemove() const -{ - return getAttributeEventListener(eventNames().mousemoveEvent); -} - -void DOMWindow::setOnmousemove(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().mousemoveEvent, eventListener); -} - -EventListener* DOMWindow::onmouseout() const -{ - return getAttributeEventListener(eventNames().mouseoutEvent); -} - -void DOMWindow::setOnmouseout(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().mouseoutEvent, eventListener); -} + EventTarget::removeAllEventListeners(); -EventListener* DOMWindow::onmouseover() const -{ - return getAttributeEventListener(eventNames().mouseoverEvent); + windowsWithUnloadEventListeners().clear(this); + windowsWithBeforeUnloadEventListeners().clear(this); } -void DOMWindow::setOnmouseover(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().mouseoverEvent, eventListener); -} - -EventListener* DOMWindow::onmouseup() const -{ - return getAttributeEventListener(eventNames().mouseupEvent); -} - -void DOMWindow::setOnmouseup(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().mouseupEvent, eventListener); -} - -EventListener* DOMWindow::onmousewheel() const -{ - return getAttributeEventListener(eventNames().mousewheelEvent); -} - -void DOMWindow::setOnmousewheel(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().mousewheelEvent, eventListener); -} - -EventListener* DOMWindow::onoffline() const -{ - return getAttributeEventListener(eventNames().offlineEvent); -} - -void DOMWindow::setOnoffline(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().offlineEvent, eventListener); -} - -EventListener* DOMWindow::ononline() const -{ - return getAttributeEventListener(eventNames().onlineEvent); -} - -void DOMWindow::setOnonline(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().onlineEvent, eventListener); -} - -EventListener* DOMWindow::onpagehide() const -{ - return getAttributeEventListener(eventNames().pagehideEvent); -} - -void DOMWindow::setOnpagehide(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().pagehideEvent, eventListener); -} - -EventListener* DOMWindow::onpageshow() const -{ - return getAttributeEventListener(eventNames().pageshowEvent); -} - -void DOMWindow::setOnpageshow(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().pageshowEvent, eventListener); -} - -EventListener* DOMWindow::onreset() const -{ - return getAttributeEventListener(eventNames().resetEvent); -} - -void DOMWindow::setOnreset(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().resetEvent, eventListener); -} - -EventListener* DOMWindow::onresize() const -{ - return getAttributeEventListener(eventNames().resizeEvent); -} - -void DOMWindow::setOnresize(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().resizeEvent, eventListener); -} - -EventListener* DOMWindow::onscroll() const -{ - return getAttributeEventListener(eventNames().scrollEvent); -} - -void DOMWindow::setOnscroll(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().scrollEvent, eventListener); -} - -EventListener* DOMWindow::onsearch() const -{ - return getAttributeEventListener(eventNames().searchEvent); -} - -void DOMWindow::setOnsearch(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().searchEvent, eventListener); -} - -EventListener* DOMWindow::onselect() const -{ - return getAttributeEventListener(eventNames().selectEvent); -} - -void DOMWindow::setOnselect(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().selectEvent, eventListener); -} - -EventListener* DOMWindow::onstorage() const -{ - return getAttributeEventListener(eventNames().storageEvent); -} - -void DOMWindow::setOnstorage(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().storageEvent, eventListener); -} - -EventListener* DOMWindow::onsubmit() const -{ - return getAttributeEventListener(eventNames().submitEvent); -} - -void DOMWindow::setOnsubmit(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().submitEvent, eventListener); -} - -EventListener* DOMWindow::onunload() const -{ - return getAttributeEventListener(eventNames().unloadEvent); -} - -void DOMWindow::setOnunload(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().unloadEvent, eventListener); -} - -EventListener* DOMWindow::onbeforeunload() const -{ - return getAttributeEventListener(eventNames().beforeunloadEvent); -} - -void DOMWindow::setOnbeforeunload(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().beforeunloadEvent, eventListener); -} - -EventListener* DOMWindow::onwebkitanimationstart() const -{ - return getAttributeEventListener(eventNames().webkitAnimationStartEvent); -} - -void DOMWindow::setOnwebkitanimationstart(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().webkitAnimationStartEvent, eventListener); -} - -EventListener* DOMWindow::onwebkitanimationiteration() const -{ - return getAttributeEventListener(eventNames().webkitAnimationIterationEvent); -} - -void DOMWindow::setOnwebkitanimationiteration(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().webkitAnimationIterationEvent, eventListener); -} - -EventListener* DOMWindow::onwebkitanimationend() const -{ - return getAttributeEventListener(eventNames().webkitAnimationEndEvent); -} - -void DOMWindow::setOnwebkitanimationend(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().webkitAnimationEndEvent, eventListener); -} - -EventListener* DOMWindow::onwebkittransitionend() const -{ - return getAttributeEventListener(eventNames().webkitTransitionEndEvent); -} - -void DOMWindow::setOnwebkittransitionend(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().webkitTransitionEndEvent, eventListener); -} - -EventListener* DOMWindow::oncanplay() const -{ - return getAttributeEventListener(eventNames().canplayEvent); -} - -void DOMWindow::setOncanplay(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().canplayEvent, eventListener); -} - -EventListener* DOMWindow::oncanplaythrough() const -{ - return getAttributeEventListener(eventNames().canplaythroughEvent); -} - -void DOMWindow::setOncanplaythrough(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().canplaythroughEvent, eventListener); -} - -EventListener* DOMWindow::ondurationchange() const -{ - return getAttributeEventListener(eventNames().durationchangeEvent); -} - -void DOMWindow::setOndurationchange(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().durationchangeEvent, eventListener); -} - -EventListener* DOMWindow::onemptied() const -{ - return getAttributeEventListener(eventNames().emptiedEvent); -} - -void DOMWindow::setOnemptied(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().emptiedEvent, eventListener); -} - -EventListener* DOMWindow::onended() const -{ - return getAttributeEventListener(eventNames().endedEvent); -} - -void DOMWindow::setOnended(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().endedEvent, eventListener); -} - -EventListener* DOMWindow::onloadeddata() const -{ - return getAttributeEventListener(eventNames().loadeddataEvent); -} - -void DOMWindow::setOnloadeddata(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().loadeddataEvent, eventListener); -} - -EventListener* DOMWindow::onloadedmetadata() const -{ - return getAttributeEventListener(eventNames().loadedmetadataEvent); -} - -void DOMWindow::setOnloadedmetadata(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().loadedmetadataEvent, eventListener); -} - -EventListener* DOMWindow::onpause() const -{ - return getAttributeEventListener(eventNames().pauseEvent); -} - -void DOMWindow::setOnpause(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().pauseEvent, eventListener); -} - -EventListener* DOMWindow::onplay() const -{ - return getAttributeEventListener(eventNames().playEvent); -} - -void DOMWindow::setOnplay(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().playEvent, eventListener); -} - -EventListener* DOMWindow::onplaying() const -{ - return getAttributeEventListener(eventNames().playingEvent); -} - -void DOMWindow::setOnplaying(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().playingEvent, eventListener); -} - -EventListener* DOMWindow::onratechange() const -{ - return getAttributeEventListener(eventNames().ratechangeEvent); -} - -void DOMWindow::setOnratechange(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().ratechangeEvent, eventListener); -} - -EventListener* DOMWindow::onseeked() const -{ - return getAttributeEventListener(eventNames().seekedEvent); -} - -void DOMWindow::setOnseeked(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().seekedEvent, eventListener); -} - -EventListener* DOMWindow::onseeking() const -{ - return getAttributeEventListener(eventNames().seekingEvent); -} - -void DOMWindow::setOnseeking(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().seekingEvent, eventListener); -} - -EventListener* DOMWindow::ontimeupdate() const -{ - return getAttributeEventListener(eventNames().timeupdateEvent); -} - -void DOMWindow::setOntimeupdate(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().timeupdateEvent, eventListener); -} - -EventListener* DOMWindow::onvolumechange() const -{ - return getAttributeEventListener(eventNames().volumechangeEvent); -} - -void DOMWindow::setOnvolumechange(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().volumechangeEvent, eventListener); -} - -EventListener* DOMWindow::onwaiting() const -{ - return getAttributeEventListener(eventNames().waitingEvent); -} - -void DOMWindow::setOnwaiting(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().waitingEvent, eventListener); -} - -EventListener* DOMWindow::onloadstart() const -{ - return getAttributeEventListener(eventNames().loadstartEvent); -} - -void DOMWindow::setOnloadstart(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().loadstartEvent, eventListener); -} - -EventListener* DOMWindow::onprogress() const -{ - return getAttributeEventListener(eventNames().progressEvent); -} - -void DOMWindow::setOnprogress(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().progressEvent, eventListener); -} - -EventListener* DOMWindow::onstalled() const -{ - return getAttributeEventListener(eventNames().stalledEvent); -} - -void DOMWindow::setOnstalled(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().stalledEvent, eventListener); -} - -EventListener* DOMWindow::onsuspend() const -{ - return getAttributeEventListener(eventNames().suspendEvent); -} - -void DOMWindow::setOnsuspend(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().suspendEvent, eventListener); -} - -EventListener* DOMWindow::oninput() const -{ - return getAttributeEventListener(eventNames().inputEvent); -} - -void DOMWindow::setOninput(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().inputEvent, eventListener); -} - -EventListener* DOMWindow::onmessage() const -{ - return getAttributeEventListener(eventNames().messageEvent); -} - -void DOMWindow::setOnmessage(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().messageEvent, eventListener); -} - -EventListener* DOMWindow::oncontextmenu() const -{ - return getAttributeEventListener(eventNames().contextmenuEvent); -} - -void DOMWindow::setOncontextmenu(PassRefPtr<EventListener> eventListener) -{ - setAttributeEventListener(eventNames().contextmenuEvent, eventListener); -} - -EventListener* DOMWindow::oninvalid() const +void DOMWindow::captureEvents() { - return getAttributeEventListener(eventNames().invalidEvent); + // Not implemented. } -void DOMWindow::setOninvalid(PassRefPtr<EventListener> eventListener) +void DOMWindow::releaseEvents() { - setAttributeEventListener(eventNames().invalidEvent, eventListener); + // Not implemented. } -void DOMWindow::captureEvents() +EventTargetData* DOMWindow::eventTargetData() { - // Not implemented. + return &m_eventTargetData; } -void DOMWindow::releaseEvents() +EventTargetData* DOMWindow::ensureEventTargetData() { - // Not implemented. + return &m_eventTargetData; } } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/page/DOMWindow.h b/src/3rdparty/webkit/WebCore/page/DOMWindow.h index db4edda..f2177ee 100644 --- a/src/3rdparty/webkit/WebCore/page/DOMWindow.h +++ b/src/3rdparty/webkit/WebCore/page/DOMWindow.h @@ -85,6 +85,13 @@ namespace WebCore { void clear(); +#if ENABLE(ORIENTATION_EVENTS) + // This is the interface orientation in degrees. Some examples are: + // 0 is straight up; -90 is when the device is rotated 90 clockwise; + // 90 is when rotated counter clockwise. + int orientation() const; +#endif + void setSecurityOrigin(SecurityOrigin* securityOrigin) { m_securityOrigin = securityOrigin; } SecurityOrigin* securityOrigin() const { return m_securityOrigin.get(); } @@ -230,159 +237,84 @@ namespace WebCore { // Events // EventTarget API - virtual void addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture); - virtual void removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture); - virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&); + virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture); + virtual bool removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture); + virtual void removeAllEventListeners(); - void handleEvent(Event*, bool useCapture, RegisteredEventListenerVector* = 0); - - void dispatchEvent(const AtomicString& eventType, bool canBubble, bool cancelable); + using EventTarget::dispatchEvent; + bool dispatchEvent(PassRefPtr<Event> prpEvent, PassRefPtr<EventTarget> prpTarget); void dispatchLoadEvent(); - void dispatchUnloadEvent(RegisteredEventListenerVector* = 0); - PassRefPtr<BeforeUnloadEvent> dispatchBeforeUnloadEvent(RegisteredEventListenerVector* = 0); - void dispatchPageTransitionEvent(const AtomicString& eventType, bool persisted); - - // Used for legacy "onEvent" property APIs. - void setAttributeEventListener(const AtomicString& eventType, PassRefPtr<EventListener>); - void clearAttributeEventListener(const AtomicString& eventType); - EventListener* getAttributeEventListener(const AtomicString& eventType) const; - - const RegisteredEventListenerVector& eventListeners() const { return m_eventListeners; } - bool hasEventListener(const AtomicString& eventType); - void removeAllEventListeners(); - - EventListener* onabort() const; - void setOnabort(PassRefPtr<EventListener>); - EventListener* onblur() const; - void setOnblur(PassRefPtr<EventListener>); - EventListener* onchange() const; - void setOnchange(PassRefPtr<EventListener>); - EventListener* onclick() const; - void setOnclick(PassRefPtr<EventListener>); - EventListener* ondblclick() const; - void setOndblclick(PassRefPtr<EventListener>); - EventListener* ondrag() const; - void setOndrag(PassRefPtr<EventListener>); - EventListener* ondragend() const; - void setOndragend(PassRefPtr<EventListener>); - EventListener* ondragenter() const; - void setOndragenter(PassRefPtr<EventListener>); - EventListener* ondragleave() const; - void setOndragleave(PassRefPtr<EventListener>); - EventListener* ondragover() const; - void setOndragover(PassRefPtr<EventListener>); - EventListener* ondragstart() const; - void setOndragstart(PassRefPtr<EventListener>); - EventListener* ondrop() const; - void setOndrop(PassRefPtr<EventListener>); - EventListener* onerror() const; - void setOnerror(PassRefPtr<EventListener>); - EventListener* onfocus() const; - void setOnfocus(PassRefPtr<EventListener>); - EventListener* onhashchange() const; - void setOnhashchange(PassRefPtr<EventListener>); - EventListener* onkeydown() const; - void setOnkeydown(PassRefPtr<EventListener>); - EventListener* onkeypress() const; - void setOnkeypress(PassRefPtr<EventListener>); - EventListener* onkeyup() const; - void setOnkeyup(PassRefPtr<EventListener>); - EventListener* onload() const; - void setOnload(PassRefPtr<EventListener>); - EventListener* onmousedown() const; - void setOnmousedown(PassRefPtr<EventListener>); - EventListener* onmousemove() const; - void setOnmousemove(PassRefPtr<EventListener>); - EventListener* onmouseout() const; - void setOnmouseout(PassRefPtr<EventListener>); - EventListener* onmouseover() const; - void setOnmouseover(PassRefPtr<EventListener>); - EventListener* onmouseup() const; - void setOnmouseup(PassRefPtr<EventListener>); - EventListener* onmousewheel() const; - void setOnmousewheel(PassRefPtr<EventListener>); - EventListener* onoffline() const; - void setOnoffline(PassRefPtr<EventListener>); - EventListener* ononline() const; - void setOnonline(PassRefPtr<EventListener>); - EventListener* onpagehide() const; - void setOnpagehide(PassRefPtr<EventListener>); - EventListener* onpageshow() const; - void setOnpageshow(PassRefPtr<EventListener>); - EventListener* onreset() const; - void setOnreset(PassRefPtr<EventListener>); - EventListener* onresize() const; - void setOnresize(PassRefPtr<EventListener>); - EventListener* onscroll() const; - void setOnscroll(PassRefPtr<EventListener>); - EventListener* onsearch() const; - void setOnsearch(PassRefPtr<EventListener>); - EventListener* onselect() const; - void setOnselect(PassRefPtr<EventListener>); - EventListener* onstorage() const; - void setOnstorage(PassRefPtr<EventListener>); - EventListener* onsubmit() const; - void setOnsubmit(PassRefPtr<EventListener>); - EventListener* onunload() const; - void setOnunload(PassRefPtr<EventListener>); - EventListener* onbeforeunload() const; - void setOnbeforeunload(PassRefPtr<EventListener>); - EventListener* onwebkitanimationstart() const; - void setOnwebkitanimationstart(PassRefPtr<EventListener>); - EventListener* onwebkitanimationiteration() const; - void setOnwebkitanimationiteration(PassRefPtr<EventListener>); - EventListener* onwebkitanimationend() const; - void setOnwebkitanimationend(PassRefPtr<EventListener>); - EventListener* onwebkittransitionend() const; - void setOnwebkittransitionend(PassRefPtr<EventListener>); - EventListener* oncanplay() const; - void setOncanplay(PassRefPtr<EventListener>); - EventListener* oncanplaythrough() const; - void setOncanplaythrough(PassRefPtr<EventListener>); - EventListener* ondurationchange() const; - void setOndurationchange(PassRefPtr<EventListener>); - EventListener* onemptied() const; - void setOnemptied(PassRefPtr<EventListener>); - EventListener* onended() const; - void setOnended(PassRefPtr<EventListener>); - EventListener* onloadeddata() const; - void setOnloadeddata(PassRefPtr<EventListener>); - EventListener* onloadedmetadata() const; - void setOnloadedmetadata(PassRefPtr<EventListener>); - EventListener* onpause() const; - void setOnpause(PassRefPtr<EventListener>); - EventListener* onplay() const; - void setOnplay(PassRefPtr<EventListener>); - EventListener* onplaying() const; - void setOnplaying(PassRefPtr<EventListener>); - EventListener* onratechange() const; - void setOnratechange(PassRefPtr<EventListener>); - EventListener* onseeked() const; - void setOnseeked(PassRefPtr<EventListener>); - EventListener* onseeking() const; - void setOnseeking(PassRefPtr<EventListener>); - EventListener* ontimeupdate() const; - void setOntimeupdate(PassRefPtr<EventListener>); - EventListener* onvolumechange() const; - void setOnvolumechange(PassRefPtr<EventListener>); - EventListener* onwaiting() const; - void setOnwaiting(PassRefPtr<EventListener>); - EventListener* onloadstart() const; - void setOnloadstart(PassRefPtr<EventListener>); - EventListener* onprogress() const; - void setOnprogress(PassRefPtr<EventListener>); - EventListener* onstalled() const; - void setOnstalled(PassRefPtr<EventListener>); - EventListener* onsuspend() const; - void setOnsuspend(PassRefPtr<EventListener>); - EventListener* oninput() const; - void setOninput(PassRefPtr<EventListener>); - EventListener* onmessage() const; - void setOnmessage(PassRefPtr<EventListener>); - EventListener* oncontextmenu() const; - void setOncontextmenu(PassRefPtr<EventListener>); - EventListener* oninvalid() const; - void setOninvalid(PassRefPtr<EventListener>); + + DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); + DEFINE_ATTRIBUTE_EVENT_LISTENER(blur); + DEFINE_ATTRIBUTE_EVENT_LISTENER(change); + DEFINE_ATTRIBUTE_EVENT_LISTENER(click); + DEFINE_ATTRIBUTE_EVENT_LISTENER(dblclick); + DEFINE_ATTRIBUTE_EVENT_LISTENER(drag); + DEFINE_ATTRIBUTE_EVENT_LISTENER(dragend); + DEFINE_ATTRIBUTE_EVENT_LISTENER(dragenter); + DEFINE_ATTRIBUTE_EVENT_LISTENER(dragleave); + DEFINE_ATTRIBUTE_EVENT_LISTENER(dragover); + DEFINE_ATTRIBUTE_EVENT_LISTENER(dragstart); + DEFINE_ATTRIBUTE_EVENT_LISTENER(drop); + DEFINE_ATTRIBUTE_EVENT_LISTENER(error); + DEFINE_ATTRIBUTE_EVENT_LISTENER(focus); + DEFINE_ATTRIBUTE_EVENT_LISTENER(hashchange); + DEFINE_ATTRIBUTE_EVENT_LISTENER(keydown); + DEFINE_ATTRIBUTE_EVENT_LISTENER(keypress); + DEFINE_ATTRIBUTE_EVENT_LISTENER(keyup); + DEFINE_ATTRIBUTE_EVENT_LISTENER(load); + DEFINE_ATTRIBUTE_EVENT_LISTENER(mousedown); + DEFINE_ATTRIBUTE_EVENT_LISTENER(mousemove); + DEFINE_ATTRIBUTE_EVENT_LISTENER(mouseout); + DEFINE_ATTRIBUTE_EVENT_LISTENER(mouseover); + DEFINE_ATTRIBUTE_EVENT_LISTENER(mouseup); + DEFINE_ATTRIBUTE_EVENT_LISTENER(mousewheel); + DEFINE_ATTRIBUTE_EVENT_LISTENER(offline); + DEFINE_ATTRIBUTE_EVENT_LISTENER(online); + DEFINE_ATTRIBUTE_EVENT_LISTENER(pagehide); + DEFINE_ATTRIBUTE_EVENT_LISTENER(pageshow); + DEFINE_ATTRIBUTE_EVENT_LISTENER(reset); + DEFINE_ATTRIBUTE_EVENT_LISTENER(resize); + DEFINE_ATTRIBUTE_EVENT_LISTENER(scroll); + DEFINE_ATTRIBUTE_EVENT_LISTENER(search); + DEFINE_ATTRIBUTE_EVENT_LISTENER(select); + DEFINE_ATTRIBUTE_EVENT_LISTENER(storage); + DEFINE_ATTRIBUTE_EVENT_LISTENER(submit); + DEFINE_ATTRIBUTE_EVENT_LISTENER(unload); + DEFINE_ATTRIBUTE_EVENT_LISTENER(beforeunload); + DEFINE_ATTRIBUTE_EVENT_LISTENER(canplay); + DEFINE_ATTRIBUTE_EVENT_LISTENER(canplaythrough); + DEFINE_ATTRIBUTE_EVENT_LISTENER(durationchange); + DEFINE_ATTRIBUTE_EVENT_LISTENER(emptied); + DEFINE_ATTRIBUTE_EVENT_LISTENER(ended); + DEFINE_ATTRIBUTE_EVENT_LISTENER(loadeddata); + DEFINE_ATTRIBUTE_EVENT_LISTENER(loadedmetadata); + DEFINE_ATTRIBUTE_EVENT_LISTENER(pause); + DEFINE_ATTRIBUTE_EVENT_LISTENER(play); + DEFINE_ATTRIBUTE_EVENT_LISTENER(playing); + DEFINE_ATTRIBUTE_EVENT_LISTENER(ratechange); + DEFINE_ATTRIBUTE_EVENT_LISTENER(seeked); + DEFINE_ATTRIBUTE_EVENT_LISTENER(seeking); + DEFINE_ATTRIBUTE_EVENT_LISTENER(timeupdate); + DEFINE_ATTRIBUTE_EVENT_LISTENER(volumechange); + DEFINE_ATTRIBUTE_EVENT_LISTENER(waiting); + DEFINE_ATTRIBUTE_EVENT_LISTENER(loadstart); + DEFINE_ATTRIBUTE_EVENT_LISTENER(progress); + DEFINE_ATTRIBUTE_EVENT_LISTENER(stalled); + DEFINE_ATTRIBUTE_EVENT_LISTENER(suspend); + DEFINE_ATTRIBUTE_EVENT_LISTENER(input); + DEFINE_ATTRIBUTE_EVENT_LISTENER(message); + DEFINE_ATTRIBUTE_EVENT_LISTENER(contextmenu); + DEFINE_ATTRIBUTE_EVENT_LISTENER(invalid); +#if ENABLE(ORIENTATION_EVENTS) + DEFINE_ATTRIBUTE_EVENT_LISTENER(orientationchange); +#endif + + DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationstart, webkitAnimationStart); + DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationiteration, webkitAnimationIteration); + DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationend, webkitAnimationEnd); + DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkittransitionend, webkitTransitionEnd); void captureEvents(); void releaseEvents(); @@ -417,8 +349,8 @@ namespace WebCore { virtual void refEventTarget() { ref(); } virtual void derefEventTarget() { deref(); } - - void dispatchEventWithDocumentAsTarget(PassRefPtr<Event>, RegisteredEventListenerVector* = 0); + virtual EventTargetData* eventTargetData(); + virtual EventTargetData* ensureEventTargetData(); RefPtr<SecurityOrigin> m_securityOrigin; KURL m_url; @@ -447,7 +379,7 @@ namespace WebCore { mutable RefPtr<NotificationCenter> m_notifications; #endif - RegisteredEventListenerVector m_eventListeners; + EventTargetData m_eventTargetData; }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/page/DOMWindow.idl b/src/3rdparty/webkit/WebCore/page/DOMWindow.idl index dcd83d9..f36175e 100644 --- a/src/3rdparty/webkit/WebCore/page/DOMWindow.idl +++ b/src/3rdparty/webkit/WebCore/page/DOMWindow.idl @@ -39,6 +39,7 @@ module window { CustomNativeConverter, CustomPutFunction, ExtendsDOMGlobalObject, + EventTarget, GenerateNativeConverter, LegacyParent=JSDOMWindowBase ] DOMWindow { @@ -170,6 +171,13 @@ module window { readonly attribute NotificationCenter webkitNotifications; #endif +#if defined(ENABLE_ORIENTATION_EVENTS) && ENABLE_ORIENTATION_EVENTS + // This is the interface orientation in degrees. Some examples are: + // 0 is straight up; -90 is when the device is rotated 90 clockwise; + // 90 is when rotated counter clockwise. + readonly attribute long orientation; +#endif + attribute [Replaceable] Console console; // cross-document messaging @@ -265,7 +273,6 @@ module window { // attribute EventListener onbeforeprint; // attribute EventListener onformchange; // attribute EventListener onforminput; - // attribute EventListener onhashchange; // attribute EventListener onpopstate; // attribute EventListener onreadystatechange; // attribute EventListener onredo; @@ -279,6 +286,9 @@ module window { attribute EventListener onwebkitanimationiteration; attribute EventListener onwebkitanimationstart; attribute EventListener onwebkittransitionend; +#if defined(ENABLE_ORIENTATION_EVENTS) && ENABLE_ORIENTATION_EVENTS + attribute EventListener onorientationchange; +#endif // EventTarget interface [Custom] void addEventListener(in DOMString type, diff --git a/src/3rdparty/webkit/WebCore/page/DragController.cpp b/src/3rdparty/webkit/WebCore/page/DragController.cpp index 676c6d9..ab3a653 100644 --- a/src/3rdparty/webkit/WebCore/page/DragController.cpp +++ b/src/3rdparty/webkit/WebCore/page/DragController.cpp @@ -47,6 +47,7 @@ #include "HTMLAnchorElement.h" #include "HTMLInputElement.h" #include "HTMLNames.h" +#include "HitTestRequest.h" #include "HitTestResult.h" #include "Image.h" #include "MoveSelectionCommand.h" @@ -54,6 +55,7 @@ #include "Page.h" #include "RenderFileUploadControl.h" #include "RenderImage.h" +#include "RenderView.h" #include "ReplaceSelectionCommand.h" #include "ResourceRequest.h" #include "SelectionController.h" @@ -254,6 +256,25 @@ static HTMLInputElement* asFileInput(Node* node) return 0; } +static Element* elementUnderMouse(Document* documentUnderMouse, const IntPoint& p) +{ + float zoomFactor = documentUnderMouse->frame()->pageZoomFactor(); + IntPoint point = roundedIntPoint(FloatPoint(p.x() * zoomFactor, p.y() * zoomFactor)); + + HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active); + HitTestResult result(point); + documentUnderMouse->renderView()->layer()->hitTest(request, result); + + Node* n = result.innerNode(); + while (n && !n->isElementNode()) + n = n->parentNode(); + if (n) + n = n->shadowAncestorNode(); + + ASSERT(n); + return static_cast<Element*>(n); +} + bool DragController::tryDocumentDrag(DragData* dragData, DragDestinationAction actionMask, DragOperation& operation) { ASSERT(dragData); @@ -288,10 +309,8 @@ bool DragController::tryDocumentDrag(DragData* dragData, DragDestinationAction a return true; } - IntPoint dragPos = dragData->clientPosition(); - IntPoint point = frameView->windowToContents(dragPos); - Element* element = m_documentUnderMouse->elementFromPoint(point.x(), point.y()); - ASSERT(element); + IntPoint point = frameView->windowToContents(dragData->clientPosition()); + Element* element = elementUnderMouse(m_documentUnderMouse, point); if (!asFileInput(element)) { VisibleSelection dragCaret = m_documentUnderMouse->frame()->visiblePositionForPoint(point); m_page->dragCaretController()->setSelection(dragCaret); @@ -341,8 +360,7 @@ bool DragController::concludeEditDrag(DragData* dragData) return false; IntPoint point = m_documentUnderMouse->view()->windowToContents(dragData->clientPosition()); - Element* element = m_documentUnderMouse->elementFromPoint(point.x(), point.y()); - ASSERT(element); + Element* element = elementUnderMouse(m_documentUnderMouse, point); Frame* innerFrame = element->ownerDocument()->frame(); ASSERT(innerFrame); diff --git a/src/3rdparty/webkit/WebCore/page/EventHandler.cpp b/src/3rdparty/webkit/WebCore/page/EventHandler.cpp index abe40c7..8d519ef 100644 --- a/src/3rdparty/webkit/WebCore/page/EventHandler.cpp +++ b/src/3rdparty/webkit/WebCore/page/EventHandler.cpp @@ -101,7 +101,7 @@ const double autoscrollInterval = 0.05; static Frame* subframeForHitTestResult(const MouseEventWithHitTestResults&); -static inline void scrollAndAcceptEvent(float delta, ScrollDirection positiveDirection, ScrollDirection negativeDirection, PlatformWheelEvent& e, Node* node) +static inline void scrollAndAcceptEvent(float delta, ScrollDirection positiveDirection, ScrollDirection negativeDirection, PlatformWheelEvent& e, Node* node, Node** stopNode) { if (!delta) return; @@ -110,12 +110,13 @@ static inline void scrollAndAcceptEvent(float delta, ScrollDirection positiveDir RenderBox* enclosingBox = node->renderer()->enclosingBox(); if (e.granularity() == ScrollByPageWheelEvent) { - if (enclosingBox->scroll(delta < 0 ? negativeDirection : positiveDirection, ScrollByPage, 1)) + if (enclosingBox->scroll(delta < 0 ? negativeDirection : positiveDirection, ScrollByPage, 1, stopNode)) e.accept(); return; - } + } + float pixelsToScroll = delta > 0 ? delta : -delta; - if (enclosingBox->scroll(delta < 0 ? negativeDirection : positiveDirection, ScrollByPixel, pixelsToScroll)) + if (enclosingBox->scroll(delta < 0 ? negativeDirection : positiveDirection, ScrollByPixel, pixelsToScroll, stopNode)) e.accept(); } @@ -205,6 +206,7 @@ void EventHandler::clear() m_capturesDragging = false; m_capturingMouseEventsNode = 0; m_latchedWheelEventNode = 0; + m_previousWheelScrolledNode = 0; } void EventHandler::selectClosestWordFromMouseEvent(const MouseEventWithHitTestResults& result) @@ -1774,7 +1776,7 @@ bool EventHandler::handleWheelEvent(PlatformWheelEvent& e) Node* node; bool isOverWidget; bool didSetLatchedNode = false; - + if (m_useLatchedWheelEventNode) { if (!m_latchedWheelEventNode) { HitTestRequest request(HitTestRequest::ReadOnly); @@ -1784,20 +1786,22 @@ bool EventHandler::handleWheelEvent(PlatformWheelEvent& e) m_widgetIsLatched = result.isOverWidget(); didSetLatchedNode = true; } - + node = m_latchedWheelEventNode.get(); isOverWidget = m_widgetIsLatched; } else { if (m_latchedWheelEventNode) m_latchedWheelEventNode = 0; - + if (m_previousWheelScrolledNode) + m_previousWheelScrolledNode = 0; + HitTestRequest request(HitTestRequest::ReadOnly); HitTestResult result(vPoint); doc->renderView()->layer()->hitTest(request, result); node = result.innerNode(); isOverWidget = result.isOverWidget(); } - + if (node) { // Figure out which view to send the event to. RenderObject* target = node->renderer(); @@ -1814,17 +1818,20 @@ bool EventHandler::handleWheelEvent(PlatformWheelEvent& e) node->dispatchWheelEvent(e); if (e.isAccepted()) return true; - + // If we don't have a renderer, send the wheel event to the first node we find with a renderer. // This is needed for <option> and <optgroup> elements so that <select>s get a wheel scroll. while (node && !node->renderer()) node = node->parent(); - + if (node && node->renderer()) { // Just break up into two scrolls if we need to. Diagonal movement on // a MacBook pro is an example of a 2-dimensional mouse wheel event (where both deltaX and deltaY can be set). - scrollAndAcceptEvent(e.deltaX(), ScrollLeft, ScrollRight, e, node); - scrollAndAcceptEvent(e.deltaY(), ScrollUp, ScrollDown, e, node); + Node* stopNode = m_previousWheelScrolledNode.get(); + scrollAndAcceptEvent(e.deltaX(), ScrollLeft, ScrollRight, e, node, &stopNode); + scrollAndAcceptEvent(e.deltaY(), ScrollUp, ScrollDown, e, node, &stopNode); + if (!m_useLatchedWheelEventNode) + m_previousWheelScrolledNode = stopNode; } } @@ -1890,7 +1897,7 @@ bool EventHandler::canMouseDownStartSelect(Node* node) for (RenderObject* curr = node->renderer(); curr; curr = curr->parent()) { if (Node* node = curr->node()) - return node->dispatchEvent(eventNames().selectstartEvent, true, true); + return node->dispatchEvent(Event::create(eventNames().selectstartEvent, true, true)); } return true; @@ -1904,7 +1911,7 @@ bool EventHandler::canMouseDragExtendSelect(Node* node) for (RenderObject* curr = node->renderer(); curr; curr = curr->parent()) { if (Node* node = curr->node()) - return node->dispatchEvent(eventNames().selectstartEvent, true, true); + return node->dispatchEvent(Event::create(eventNames().selectstartEvent, true, true)); } return true; @@ -2459,7 +2466,7 @@ void EventHandler::capsLockStateMayHaveChanged() void EventHandler::sendResizeEvent() { - m_frame->document()->dispatchWindowEvent(eventNames().resizeEvent, false, false); + m_frame->document()->dispatchWindowEvent(Event::create(eventNames().resizeEvent, false, false)); } void EventHandler::sendScrollEvent() @@ -2468,7 +2475,7 @@ void EventHandler::sendScrollEvent() if (!v) return; v->setWasScrolledByUser(true); - m_frame->document()->dispatchEvent(eventNames().scrollEvent, true, false); + m_frame->document()->dispatchEvent(Event::create(eventNames().scrollEvent, true, false)); } bool EventHandler::passMousePressEventToScrollbar(MouseEventWithHitTestResults& mev, Scrollbar* scrollbar) diff --git a/src/3rdparty/webkit/WebCore/page/EventHandler.h b/src/3rdparty/webkit/WebCore/page/EventHandler.h index b390457..7066252 100644 --- a/src/3rdparty/webkit/WebCore/page/EventHandler.h +++ b/src/3rdparty/webkit/WebCore/page/EventHandler.h @@ -378,7 +378,9 @@ private: bool m_useLatchedWheelEventNode; RefPtr<Node> m_latchedWheelEventNode; bool m_widgetIsLatched; - + + RefPtr<Node> m_previousWheelScrolledNode; + #if PLATFORM(MAC) NSView *m_mouseDownView; bool m_sendingEventToSubview; diff --git a/src/3rdparty/webkit/WebCore/page/EventSource.cpp b/src/3rdparty/webkit/WebCore/page/EventSource.cpp index afec20f..ae3c0c3 100644 --- a/src/3rdparty/webkit/WebCore/page/EventSource.cpp +++ b/src/3rdparty/webkit/WebCore/page/EventSource.cpp @@ -108,7 +108,7 @@ void EventSource::endRequest() m_requestInFlight = false; if (!m_failSilently) - dispatchGenericEvent(eventNames().errorEvent); + dispatchEvent(Event::create(eventNames().errorEvent, false, false)); if (!scriptExecutionContext()->isWorkerContext()) cache()->loader()->nonCacheRequestComplete(m_url); @@ -162,70 +162,12 @@ ScriptExecutionContext* EventSource::scriptExecutionContext() const return ActiveDOMObject::scriptExecutionContext(); } -void EventSource::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> eventListener, bool) -{ - EventListenersMap::iterator iter = m_eventListeners.find(eventType); - if (iter == m_eventListeners.end()) { - ListenerVector listeners; - listeners.append(eventListener); - m_eventListeners.add(eventType, listeners); - } else { - ListenerVector& listeners = iter->second; - for (ListenerVector::iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) { - if (**listenerIter == *eventListener) - return; - } - - listeners.append(eventListener); - m_eventListeners.add(eventType, listeners); - } -} - -void EventSource::removeEventListener(const AtomicString& eventType, EventListener* eventListener, bool) -{ - EventListenersMap::iterator iter = m_eventListeners.find(eventType); - if (iter == m_eventListeners.end()) - return; - - ListenerVector& listeners = iter->second; - for (ListenerVector::const_iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) { - if (**listenerIter == *eventListener) { - listeners.remove(listenerIter - listeners.begin()); - return; - } - } -} - -bool EventSource::dispatchEvent(PassRefPtr<Event> event, ExceptionCode& ec) -{ - if (!event || event->type().isEmpty()) { - ec = EventException::UNSPECIFIED_EVENT_TYPE_ERR; - return true; - } - - EventListener* attributeListener = m_attributeListeners.get(event->type()).get(); - if (attributeListener) { - event->setTarget(this); - event->setCurrentTarget(this); - attributeListener->handleEvent(event.get(), false); - } - - ListenerVector listenersCopy = m_eventListeners.get(event->type()); - for (ListenerVector::const_iterator listenerIter = listenersCopy.begin(); listenerIter != listenersCopy.end(); ++listenerIter) { - event->setTarget(this); - event->setCurrentTarget(this); - listenerIter->get()->handleEvent(event.get(), false); - } - - return !event->defaultPrevented(); -} - void EventSource::didReceiveResponse(const ResourceResponse& response) { int statusCode = response.httpStatusCode(); if (statusCode == 200 && response.httpHeaderField("Content-Type") == "text/event-stream") { m_state = OPEN; - dispatchGenericEvent(eventNames().openEvent); + dispatchEvent(Event::create(eventNames().openEvent, false, false)); } else { if (statusCode <= 200 || statusCode > 299) m_state = CLOSED; @@ -304,7 +246,7 @@ void EventSource::parseEventStreamLine(unsigned int bufPos, int fieldLength, int { if (!lineLength) { if (!m_data.isEmpty()) - dispatchMessageEvent(); + dispatchEvent(createMessageEvent()); if (!m_eventName.isEmpty()) m_eventName = ""; } else if (fieldLength) { @@ -344,27 +286,26 @@ void EventSource::parseEventStreamLine(unsigned int bufPos, int fieldLength, int } } -void EventSource::dispatchGenericEvent(const AtomicString& type) +void EventSource::stop() { - RefPtr<Event> evt = Event::create(type, false, false); - ExceptionCode ec = 0; - dispatchEvent(evt.release(), ec); - ASSERT(!ec); + close(); } -void EventSource::dispatchMessageEvent() +PassRefPtr<MessageEvent> EventSource::createMessageEvent() { - RefPtr<MessageEvent> evt = MessageEvent::create(); - String eventName = m_eventName.isEmpty() ? eventNames().messageEvent.string() : m_eventName; - evt->initMessageEvent(eventName, false, false, String::adopt(m_data), m_origin, m_lastEventId, 0, 0); - ExceptionCode ec = 0; - dispatchEvent(evt.release(), ec); - ASSERT(!ec); + RefPtr<MessageEvent> event = MessageEvent::create(); + event->initMessageEvent(m_eventName.isEmpty() ? eventNames().messageEvent : AtomicString(m_eventName), false, false, String::adopt(m_data), m_origin, m_lastEventId, 0, 0); + return event.release(); } -void EventSource::stop() +EventTargetData* EventSource::eventTargetData() { - close(); + return &m_eventTargetData; +} + +EventTargetData* EventSource::ensureEventTargetData() +{ + return &m_eventTargetData; } } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/page/EventSource.h b/src/3rdparty/webkit/WebCore/page/EventSource.h index df55694..5b037a4 100644 --- a/src/3rdparty/webkit/WebCore/page/EventSource.h +++ b/src/3rdparty/webkit/WebCore/page/EventSource.h @@ -50,6 +50,7 @@ namespace WebCore { + class MessageEvent; class ResourceResponse; class TextResourceDecoder; class ThreadableLoader; @@ -71,14 +72,9 @@ namespace WebCore { State readyState() const; - void setOnopen(PassRefPtr<EventListener> eventListener) { m_attributeListeners.set(eventNames().openEvent, eventListener); } - EventListener* onopen() const { return m_attributeListeners.get(eventNames().openEvent).get(); } - - void setOnmessage(PassRefPtr<EventListener> eventListener) { m_attributeListeners.set(eventNames().messageEvent, eventListener); } - EventListener* onmessage() const { return m_attributeListeners.get(eventNames().messageEvent).get(); } - - void setOnerror(PassRefPtr<EventListener> eventListener) { m_attributeListeners.set(eventNames().errorEvent, eventListener); } - EventListener* onerror() const { return m_attributeListeners.get(eventNames().errorEvent).get(); } + DEFINE_ATTRIBUTE_EVENT_LISTENER(open); + DEFINE_ATTRIBUTE_EVENT_LISTENER(message); + DEFINE_ATTRIBUTE_EVENT_LISTENER(error); void close(); @@ -88,14 +84,6 @@ namespace WebCore { virtual EventSource* toEventSource() { return this; } virtual ScriptExecutionContext* scriptExecutionContext() const; - typedef Vector<RefPtr<EventListener> > ListenerVector; - typedef HashMap<AtomicString, ListenerVector> EventListenersMap; - - virtual void addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture); - virtual void removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture); - virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&); - EventListenersMap& eventListeners() { return m_eventListeners; } - virtual void stop(); private: @@ -103,6 +91,8 @@ namespace WebCore { virtual void refEventTarget() { ref(); } virtual void derefEventTarget() { deref(); } + virtual EventTargetData* eventTargetData(); + virtual EventTargetData* ensureEventTargetData(); virtual void didReceiveResponse(const ResourceResponse& response); virtual void didReceiveData(const char* data, int length); @@ -116,15 +106,11 @@ namespace WebCore { void reconnectTimerFired(Timer<EventSource>*); void parseEventStream(); void parseEventStreamLine(unsigned int pos, int fieldLength, int lineLength); - void dispatchGenericEvent(const AtomicString& type); - void dispatchMessageEvent(); + PassRefPtr<MessageEvent> createMessageEvent(); KURL m_url; State m_state; - HashMap<AtomicString, RefPtr<EventListener> > m_attributeListeners; - EventListenersMap m_eventListeners; - RefPtr<TextResourceDecoder> m_decoder; RefPtr<ThreadableLoader> m_loader; Timer<EventSource> m_reconnectTimer; @@ -137,6 +123,8 @@ namespace WebCore { String m_lastEventId; unsigned long long m_reconnectDelay; String m_origin; + + EventTargetData m_eventTargetData; }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/page/EventSource.idl b/src/3rdparty/webkit/WebCore/page/EventSource.idl index c438e682..561bd68 100644 --- a/src/3rdparty/webkit/WebCore/page/EventSource.idl +++ b/src/3rdparty/webkit/WebCore/page/EventSource.idl @@ -33,7 +33,7 @@ module window { interface [ Conditional=EVENTSOURCE, - CustomMarkFunction, + EventTarget, NoStaticTables ] EventSource { diff --git a/src/3rdparty/webkit/WebCore/page/FocusController.cpp b/src/3rdparty/webkit/WebCore/page/FocusController.cpp index bc9e477..5e78c7d 100644 --- a/src/3rdparty/webkit/WebCore/page/FocusController.cpp +++ b/src/3rdparty/webkit/WebCore/page/FocusController.cpp @@ -36,6 +36,7 @@ #include "Event.h" #include "EventHandler.h" #include "EventNames.h" +#include "ExceptionCode.h" #include "Frame.h" #include "FrameView.h" #include "FrameTree.h" @@ -62,7 +63,7 @@ static inline void dispatchEventsOnWindowAndFocusedNode(Document* document, bool // https://bugs.webkit.org/show_bug.cgi?id=27105 if (!focused && document->focusedNode()) document->focusedNode()->dispatchBlurEvent(); - document->dispatchWindowEvent(focused ? eventNames().focusEvent : eventNames().blurEvent, false, false); + document->dispatchWindowEvent(Event::create(focused ? eventNames().focusEvent : eventNames().blurEvent, false, false)); if (focused && document->focusedNode()) document->focusedNode()->dispatchFocusEvent(); } @@ -87,12 +88,12 @@ void FocusController::setFocusedFrame(PassRefPtr<Frame> frame) // Now that the frame is updated, fire events and update the selection focused states of both frames. if (oldFrame && oldFrame->view()) { oldFrame->selection()->setFocused(false); - oldFrame->document()->dispatchWindowEvent(eventNames().blurEvent, false, false); + oldFrame->document()->dispatchWindowEvent(Event::create(eventNames().blurEvent, false, false)); } if (newFrame && newFrame->view() && isFocused()) { newFrame->selection()->setFocused(true); - newFrame->document()->dispatchWindowEvent(eventNames().focusEvent, false, false); + newFrame->document()->dispatchWindowEvent(Event::create(eventNames().focusEvent, false, false)); } } diff --git a/src/3rdparty/webkit/WebCore/page/Frame.cpp b/src/3rdparty/webkit/WebCore/page/Frame.cpp index 7a3ed27..28e6a9e 100644 --- a/src/3rdparty/webkit/WebCore/page/Frame.cpp +++ b/src/3rdparty/webkit/WebCore/page/Frame.cpp @@ -97,6 +97,10 @@ #include "WMLNames.h" #endif +#if ENABLE(MATHML) +#include "MathMLNames.h" +#endif + using namespace std; namespace WebCore { @@ -127,6 +131,9 @@ Frame::Frame(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient* , m_eventHandler(this) , m_animationController(this) , m_lifeSupportTimer(this, &Frame::lifeSupportTimerFired) +#if ENABLE(ORIENTATION_EVENTS) + , m_orientation(0) +#endif , m_caretVisible(false) , m_caretPaint(true) , m_highlightTextMatches(false) @@ -152,6 +159,10 @@ Frame::Frame(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient* WMLNames::init(); #endif +#if ENABLE(MATHML) + MathMLNames::init(); +#endif + XMLNames::init(); if (!ownerElement) @@ -268,6 +279,15 @@ void Frame::setDocument(PassRefPtr<Document> newDoc) m_script.updateDocument(); } +#if ENABLE(ORIENTATION_EVENTS) +void Frame::sendOrientationChangeEvent(int orientation) +{ + m_orientation = orientation; + if (Document* doc = document()) + doc->dispatchWindowEvent(eventNames().orientationchangeEvent, false, false); +} +#endif // ENABLE(ORIENTATION_EVENTS) + Settings* Frame::settings() const { return m_page ? m_page->settings() : 0; @@ -1645,7 +1665,7 @@ void Frame::unfocusWindow() page()->chrome()->unfocus(); } -bool Frame::shouldClose(RegisteredEventListenerVector* alternateEventListeners) +bool Frame::shouldClose() { Chrome* chrome = page() ? page()->chrome() : 0; if (!chrome || !chrome->canRunBeforeUnloadConfirmPanel()) @@ -1659,7 +1679,8 @@ bool Frame::shouldClose(RegisteredEventListenerVector* alternateEventListeners) if (!body) return true; - RefPtr<BeforeUnloadEvent> beforeUnloadEvent = m_domWindow->dispatchBeforeUnloadEvent(alternateEventListeners); + RefPtr<BeforeUnloadEvent> beforeUnloadEvent = BeforeUnloadEvent::create(); + m_domWindow->dispatchEvent(beforeUnloadEvent.get(), m_domWindow->document()); if (!beforeUnloadEvent->defaultPrevented()) doc->defaultEventHandler(beforeUnloadEvent.get()); diff --git a/src/3rdparty/webkit/WebCore/page/Frame.h b/src/3rdparty/webkit/WebCore/page/Frame.h index ef803f1..b98dbc4 100644 --- a/src/3rdparty/webkit/WebCore/page/Frame.h +++ b/src/3rdparty/webkit/WebCore/page/Frame.h @@ -153,6 +153,14 @@ namespace WebCore { void setDocument(PassRefPtr<Document>); +#if ENABLE(ORIENTATION_EVENTS) + // Orientation is the interface orientation in degrees. Some examples are: + // 0 is straight up; -90 is when the device is rotated 90 clockwise; + // 90 is when rotated counter clockwise. + void sendOrientationChangeEvent(int orientation); + int orientation() const { return m_orientation; } +#endif + void clearTimers(); static void clearTimers(FrameView*, Document*); @@ -190,7 +198,7 @@ namespace WebCore { public: void focusWindow(); void unfocusWindow(); - bool shouldClose(RegisteredEventListenerVector* alternateEventListeners = 0); + bool shouldClose(); void scheduleClose(); void setJSStatusBarText(const String&); @@ -354,6 +362,10 @@ namespace WebCore { Timer<Frame> m_lifeSupportTimer; +#if ENABLE(ORIENTATION_EVENTS) + int m_orientation; +#endif + bool m_caretVisible; bool m_caretPaint; diff --git a/src/3rdparty/webkit/WebCore/page/FrameView.cpp b/src/3rdparty/webkit/WebCore/page/FrameView.cpp index b358018..675cba1 100644 --- a/src/3rdparty/webkit/WebCore/page/FrameView.cpp +++ b/src/3rdparty/webkit/WebCore/page/FrameView.cpp @@ -803,6 +803,22 @@ void FrameView::setScrollPosition(const IntPoint& scrollPoint) m_inProgrammaticScroll = wasInProgrammaticScroll; } +void FrameView::scrollPositionChanged() +{ + frame()->eventHandler()->sendScrollEvent(); + +#if USE(ACCELERATED_COMPOSITING) + // We need to update layer positions after scrolling to account for position:fixed layers. + Document* document = m_frame->document(); + if (!document) + return; + + RenderLayer* layer = document->renderer() ? document->renderer()->enclosingLayer() : 0; + if (layer) + layer->updateLayerPositions(RenderLayer::UpdateCompositingLayers); +#endif +} + HostWindow* FrameView::hostWindow() const { Page* page = frame() ? frame()->page() : 0; @@ -971,7 +987,8 @@ void FrameView::layoutTimerFired(Timer<FrameView>*) void FrameView::scheduleRelayout() { - ASSERT(!m_frame->document()->inPageCache()); + // FIXME: We should assert the page is not in the page cache, but that is causing + // too many false assertions. See <rdar://problem/7218118>. ASSERT(m_frame->view() == this); if (m_layoutRoot) { diff --git a/src/3rdparty/webkit/WebCore/page/FrameView.h b/src/3rdparty/webkit/WebCore/page/FrameView.h index 617a8e9..4c900ae 100644 --- a/src/3rdparty/webkit/WebCore/page/FrameView.h +++ b/src/3rdparty/webkit/WebCore/page/FrameView.h @@ -131,6 +131,7 @@ public: virtual void scrollRectIntoViewRecursively(const IntRect&); virtual void setScrollPosition(const IntPoint&); + void scrollPositionChanged(); String mediaType() const; void setMediaType(const String&); diff --git a/src/3rdparty/webkit/WebCore/page/Page.cpp b/src/3rdparty/webkit/WebCore/page/Page.cpp index f6f6a81..182d22c 100644 --- a/src/3rdparty/webkit/WebCore/page/Page.cpp +++ b/src/3rdparty/webkit/WebCore/page/Page.cpp @@ -29,8 +29,10 @@ #include "ContextMenuController.h" #include "DOMWindow.h" #include "DragController.h" +#include "ExceptionCode.h" #include "EditorClient.h" #include "EventNames.h" +#include "Event.h" #include "FileSystem.h" #include "FocusController.h" #include "Frame.h" @@ -94,7 +96,7 @@ static void networkStateChanged() AtomicString eventName = networkStateNotifier().onLine() ? eventNames().onlineEvent : eventNames().offlineEvent; for (unsigned i = 0; i < frames.size(); i++) - frames[i]->document()->dispatchWindowEvent(eventName, false, false); + frames[i]->document()->dispatchWindowEvent(Event::create(eventName, false, false)); } Page::Page(ChromeClient* chromeClient, ContextMenuClient* contextMenuClient, EditorClient* editorClient, DragClient* dragClient, InspectorClient* inspectorClient) diff --git a/src/3rdparty/webkit/WebCore/page/PageGroupLoadDeferrer.cpp b/src/3rdparty/webkit/WebCore/page/PageGroupLoadDeferrer.cpp index f274de3..122658b 100644 --- a/src/3rdparty/webkit/WebCore/page/PageGroupLoadDeferrer.cpp +++ b/src/3rdparty/webkit/WebCore/page/PageGroupLoadDeferrer.cpp @@ -41,10 +41,10 @@ PageGroupLoadDeferrer::PageGroupLoadDeferrer(Page* page, bool deferSelf) if (!otherPage->defersLoading()) m_deferredFrames.append(otherPage->mainFrame()); -#if !PLATFORM(MAC) + // This code is not logically part of load deferring, but we do not want JS code executed beneath modal + // windows or sheets, which is exactly when PageGroupLoadDeferrer is used. for (Frame* frame = otherPage->mainFrame(); frame; frame = frame->tree()->traverseNext()) frame->document()->suspendActiveDOMObjects(); -#endif } } @@ -60,10 +60,8 @@ PageGroupLoadDeferrer::~PageGroupLoadDeferrer() if (Page* page = m_deferredFrames[i]->page()) { page->setDefersLoading(false); -#if !PLATFORM(MAC) for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) frame->document()->resumeActiveDOMObjects(); -#endif } } } diff --git a/src/3rdparty/webkit/WebCore/page/PositionOptions.h b/src/3rdparty/webkit/WebCore/page/PositionOptions.h index ed7074b..5cb66f7 100644 --- a/src/3rdparty/webkit/WebCore/page/PositionOptions.h +++ b/src/3rdparty/webkit/WebCore/page/PositionOptions.h @@ -49,10 +49,17 @@ public: m_hasTimeout = true; m_timeout = timeout; } - int maximumAge() const { return m_maximumAge; } + bool hasMaximumAge() const { return m_hasMaximumAge; } + int maximumAge() const + { + ASSERT(hasMaximumAge()); + return m_maximumAge; + } + void clearMaximumAge() { m_hasMaximumAge = false; } void setMaximumAge(int age) { ASSERT(age >= 0); + m_hasMaximumAge = true; m_maximumAge = age; } @@ -60,13 +67,14 @@ private: PositionOptions() : m_highAccuracy(false) , m_hasTimeout(false) - , m_maximumAge(0) { + setMaximumAge(0); } bool m_highAccuracy; bool m_hasTimeout; int m_timeout; + bool m_hasMaximumAge; int m_maximumAge; }; diff --git a/src/3rdparty/webkit/WebCore/page/SecurityOrigin.cpp b/src/3rdparty/webkit/WebCore/page/SecurityOrigin.cpp index 5076adf..b91c1f1 100644 --- a/src/3rdparty/webkit/WebCore/page/SecurityOrigin.cpp +++ b/src/3rdparty/webkit/WebCore/page/SecurityOrigin.cpp @@ -221,6 +221,22 @@ bool SecurityOrigin::canRequest(const KURL& url) const return false; } +bool SecurityOrigin::taintsCanvas(const KURL& url) const +{ + if (canRequest(url)) + return false; + + // This method exists because we treat data URLs as noAccess, contrary + // to the current (9/19/2009) draft of the HTML5 specification. We still + // want to let folks paint data URLs onto untainted canvases, so we special + // case data URLs below. If we change to match HTML5 w.r.t. data URL + // security, then we can remove this method in favor of !canRequest. + if (url.protocolIs("data")) + return false; + + return true; +} + void SecurityOrigin::grantLoadLocalResources() { // This method exists only to support backwards compatibility with older diff --git a/src/3rdparty/webkit/WebCore/page/SecurityOrigin.h b/src/3rdparty/webkit/WebCore/page/SecurityOrigin.h index c8086ac..732afa8 100644 --- a/src/3rdparty/webkit/WebCore/page/SecurityOrigin.h +++ b/src/3rdparty/webkit/WebCore/page/SecurityOrigin.h @@ -76,6 +76,11 @@ namespace WebCore { // XMLHttpRequests. bool canRequest(const KURL&) const; + // Returns true if drawing an image from this URL taints a canvas from + // this security origin. For example, call this function before + // drawing an image onto an HTML canvas element with the drawImage API. + bool taintsCanvas(const KURL&) const; + // Returns true if this SecurityOrigin can load local resources, such // as images, iframes, and style sheets, and can link to local URLs. // For example, call this function before creating an iframe to a diff --git a/src/3rdparty/webkit/WebCore/page/XSSAuditor.cpp b/src/3rdparty/webkit/WebCore/page/XSSAuditor.cpp index df627d3..4fcc53c 100644 --- a/src/3rdparty/webkit/WebCore/page/XSSAuditor.cpp +++ b/src/3rdparty/webkit/WebCore/page/XSSAuditor.cpp @@ -48,12 +48,14 @@ namespace WebCore { static bool isNonCanonicalCharacter(UChar c) { + // We remove all non-ASCII characters, including non-printable ASCII characters. + // // Note, we don't remove backslashes like PHP stripslashes(), which among other things converts "\\0" to the \0 character. // Instead, we remove backslashes and zeros (since the string "\\0" =(remove backslashes)=> "0"). However, this has the // adverse effect that we remove any legitimate zeros from a string. // // For instance: new String("http://localhost:8000") => new String("http://localhost:8"). - return (c == '\\' || c == '0' || c < ' ' || c == 127); + return (c == '\\' || c == '0' || c < ' ' || c >= 127); } String XSSAuditor::CachingURLCanonicalizer::canonicalizeURL(const String& url, const TextEncoding& encoding, bool decodeEntities) diff --git a/src/3rdparty/webkit/WebCore/page/animation/AnimationController.cpp b/src/3rdparty/webkit/WebCore/page/animation/AnimationController.cpp index 1d2ebe2..691932e 100644 --- a/src/3rdparty/webkit/WebCore/page/animation/AnimationController.cpp +++ b/src/3rdparty/webkit/WebCore/page/animation/AnimationController.cpp @@ -36,6 +36,8 @@ #include "EventNames.h" #include "Frame.h" #include "RenderView.h" +#include "WebKitAnimationEvent.h" +#include "WebKitTransitionEvent.h" #include <wtf/CurrentTime.h> #include <wtf/UnusedParam.h> @@ -136,9 +138,9 @@ void AnimationControllerPrivate::updateStyleIfNeededDispatcherFired(Timer<Animat Vector<EventToDispatch>::const_iterator eventsToDispatchEnd = m_eventsToDispatch.end(); for (Vector<EventToDispatch>::const_iterator it = m_eventsToDispatch.begin(); it != eventsToDispatchEnd; ++it) { if (it->eventType == eventNames().webkitTransitionEndEvent) - it->element->dispatchWebKitTransitionEvent(it->eventType, it->name, it->elapsedTime); + it->element->dispatchEvent(WebKitTransitionEvent::create(it->eventType, it->name, it->elapsedTime)); else - it->element->dispatchWebKitAnimationEvent(it->eventType, it->name, it->elapsedTime); + it->element->dispatchEvent(WebKitAnimationEvent::create(it->eventType, it->name, it->elapsedTime)); } m_eventsToDispatch.clear(); diff --git a/src/3rdparty/webkit/WebCore/platform/HostWindow.h b/src/3rdparty/webkit/WebCore/platform/HostWindow.h index 8c74d4f..80f6bdc 100644 --- a/src/3rdparty/webkit/WebCore/platform/HostWindow.h +++ b/src/3rdparty/webkit/WebCore/platform/HostWindow.h @@ -48,8 +48,8 @@ public: virtual IntPoint screenToWindow(const IntPoint&) const = 0; virtual IntRect windowToScreen(const IntRect&) const = 0; - // Method for retrieving the native window. - virtual PlatformWidget platformWindow() const = 0; + // Method for retrieving the native client of the page. + virtual PlatformPageClient platformPageClient() const = 0; // For scrolling a rect into view recursively. Useful in the cases where a WebView is embedded inside some containing // platform-specific ScrollView. diff --git a/src/3rdparty/webkit/WebCore/platform/StaticConstructors.h b/src/3rdparty/webkit/WebCore/platform/StaticConstructors.h index 5bc792c..f22383b 100644 --- a/src/3rdparty/webkit/WebCore/platform/StaticConstructors.h +++ b/src/3rdparty/webkit/WebCore/platform/StaticConstructors.h @@ -56,7 +56,7 @@ #if COMPILER(MSVC7) #define DEFINE_GLOBAL(type, name) \ const type name; -#elif COMPILER(WINSCW) +#elif PLATFORM(SYMBIAN) #define DEFINE_GLOBAL(type, name, arg...) \ const type name; #else @@ -70,7 +70,7 @@ #if COMPILER(MSVC7) #define DEFINE_GLOBAL(type, name) \ void * name[(sizeof(type) + sizeof(void *) - 1) / sizeof(void *)]; -#elif COMPILER(WINSCW) +#elif PLATFORM(SYMBIAN) #define DEFINE_GLOBAL(type, name, arg...) \ void * name[(sizeof(type) + sizeof(void *) - 1) / sizeof(void *)]; #else diff --git a/src/3rdparty/webkit/WebCore/platform/Widget.h b/src/3rdparty/webkit/WebCore/platform/Widget.h index a102b96..e2a7349 100644 --- a/src/3rdparty/webkit/WebCore/platform/Widget.h +++ b/src/3rdparty/webkit/WebCore/platform/Widget.h @@ -74,6 +74,13 @@ typedef BView* PlatformWidget; #include "PlatformWidget.h" #endif +#if PLATFORM(QT) +class QWebPageClient; +typedef QWebPageClient* PlatformPageClient; +#else +typedef PlatformWidget PlatformPageClient; +#endif + #include "IntPoint.h" #include "IntRect.h" #include "IntSize.h" diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/FloatPoint.h b/src/3rdparty/webkit/WebCore/platform/graphics/FloatPoint.h index d953b3b..45a1e83 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/FloatPoint.h +++ b/src/3rdparty/webkit/WebCore/platform/graphics/FloatPoint.h @@ -36,7 +36,7 @@ typedef struct CGPoint CGPoint; #endif -#if PLATFORM(MAC) +#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && PLATFORM(DARWIN)) #ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES typedef struct CGPoint NSPoint; #else @@ -84,7 +84,8 @@ public: operator CGPoint() const; #endif -#if PLATFORM(MAC) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES) +#if (PLATFORM(MAC) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)) \ + || (PLATFORM(CHROMIUM) && PLATFORM(DARWIN)) FloatPoint(const NSPoint&); operator NSPoint() const; #endif diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/FloatRect.h b/src/3rdparty/webkit/WebCore/platform/graphics/FloatRect.h index c6a86bc..073f135 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/FloatRect.h +++ b/src/3rdparty/webkit/WebCore/platform/graphics/FloatRect.h @@ -33,7 +33,7 @@ typedef struct CGRect CGRect; #endif -#if PLATFORM(MAC) +#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && PLATFORM(DARWIN)) #ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES typedef struct CGRect NSRect; #else @@ -127,7 +127,8 @@ public: operator CGRect() const; #endif -#if PLATFORM(MAC) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES) +#if (PLATFORM(MAC) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)) \ + || (PLATFORM(CHROMIUM) && PLATFORM(DARWIN)) FloatRect(const NSRect&); operator NSRect() const; #endif diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/FloatSize.h b/src/3rdparty/webkit/WebCore/platform/graphics/FloatSize.h index 6e792b6..5a84fd1 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/FloatSize.h +++ b/src/3rdparty/webkit/WebCore/platform/graphics/FloatSize.h @@ -34,7 +34,7 @@ typedef struct CGSize CGSize; #endif -#if PLATFORM(MAC) +#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && PLATFORM(DARWIN)) #ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES typedef struct CGSize NSSize; #else @@ -79,7 +79,8 @@ public: operator CGSize() const; #endif -#if PLATFORM(MAC) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES) +#if (PLATFORM(MAC) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)) \ + || (PLATFORM(CHROMIUM) && PLATFORM(DARWIN)) explicit FloatSize(const NSSize &); // don't do this implicitly since it's lossy operator NSSize() const; #endif diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/FontDescription.h b/src/3rdparty/webkit/WebCore/platform/graphics/FontDescription.h index 27b3a05..a60af29 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/FontDescription.h +++ b/src/3rdparty/webkit/WebCore/platform/graphics/FontDescription.h @@ -27,8 +27,8 @@ #include "FontFamily.h" #include "FontRenderingMode.h" +#include "FontSmoothingMode.h" #include "FontTraitsMask.h" -#include "RenderStyleConstants.h" namespace WebCore { @@ -86,7 +86,7 @@ public: bool useFixedDefaultSize() const { return genericFamily() == MonospaceFamily && !family().next() && family().family() == "-webkit-monospace"; } FontRenderingMode renderingMode() const { return static_cast<FontRenderingMode>(m_renderingMode); } unsigned keywordSize() const { return m_keywordSize; } - FontSmoothing fontSmoothing() const { return static_cast<FontSmoothing>(m_fontSmoothing); } + FontSmoothingMode fontSmoothing() const { return static_cast<FontSmoothingMode>(m_fontSmoothing); } FontTraitsMask traitsMask() const; @@ -101,7 +101,7 @@ public: void setUsePrinterFont(bool p) { m_usePrinterFont = p; } void setRenderingMode(FontRenderingMode mode) { m_renderingMode = mode; } void setKeywordSize(unsigned s) { m_keywordSize = s; } - void setFontSmoothing(FontSmoothing smoothing) { m_fontSmoothing = smoothing; } + void setFontSmoothing(FontSmoothingMode smoothing) { m_fontSmoothing = smoothing; } private: FontFamily m_familyList; // The list of font families to be used. @@ -124,7 +124,7 @@ private: // then we can accurately translate across different generic families to adjust for different preference settings // (e.g., 13px monospace vs. 16px everything else). Sizes are 1-8 (like the HTML size values for <font>). - unsigned m_fontSmoothing : 2; // FontSmoothing + unsigned m_fontSmoothing : 2; // FontSmoothingMode }; inline bool FontDescription::operator==(const FontDescription& other) const diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/FontSmoothingMode.h b/src/3rdparty/webkit/WebCore/platform/graphics/FontSmoothingMode.h new file mode 100644 index 0000000..7c23394 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/platform/graphics/FontSmoothingMode.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FontSmoothingMode_h +#define FontSmoothingMode_h + +namespace WebCore { + + enum FontSmoothingMode { AutoSmoothing, NoSmoothing, Antialiased, SubpixelAntialiased }; + +} // namespace WebCore + +#endif // FontSmoothingMode_h diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/IntRect.h b/src/3rdparty/webkit/WebCore/platform/graphics/IntRect.h index 7578e6b..97b21bc 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/IntRect.h +++ b/src/3rdparty/webkit/WebCore/platform/graphics/IntRect.h @@ -33,7 +33,7 @@ typedef struct CGRect CGRect; #endif -#if PLATFORM(MAC) +#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && PLATFORM(DARWIN)) #ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES typedef struct CGRect NSRect; #else @@ -161,7 +161,8 @@ public: operator SkIRect() const; #endif -#if PLATFORM(MAC) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES) +#if (PLATFORM(MAC) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)) \ + || (PLATFORM(CHROMIUM) && PLATFORM(DARWIN)) operator NSRect() const; #endif @@ -198,7 +199,8 @@ inline bool operator!=(const IntRect& a, const IntRect& b) IntRect enclosingIntRect(const CGRect&); #endif -#if PLATFORM(MAC) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES) +#if (PLATFORM(MAC) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)) \ + || (PLATFORM(CHROMIUM) && PLATFORM(DARWIN)) IntRect enclosingIntRect(const NSRect&); #endif diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp index be06c14..71c5cd4 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp @@ -38,6 +38,9 @@ #include <QUrl> #include <QEvent> +#if defined (__SYMBIAN32__) +#include <phonon/path.h> +#endif #include <audiooutput.h> #include <mediaobject.h> #include <videowidget.h> diff --git a/src/3rdparty/webkit/WebCore/platform/network/qt/DnsPrefetchHelper.cpp b/src/3rdparty/webkit/WebCore/platform/network/qt/DnsPrefetchHelper.cpp index 73da0a9..e687976 100644 --- a/src/3rdparty/webkit/WebCore/platform/network/qt/DnsPrefetchHelper.cpp +++ b/src/3rdparty/webkit/WebCore/platform/network/qt/DnsPrefetchHelper.cpp @@ -17,6 +17,7 @@ Boston, MA 02110-1301, USA. */ +#include "config.h" #include "DnsPrefetchHelper.h" #include "CString.h" diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSSharedWorkerContextCustom.cpp b/src/3rdparty/webkit/WebCore/platform/network/qt/SocketStreamError.h index dca3536..f9641ad 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSSharedWorkerContextCustom.cpp +++ b/src/3rdparty/webkit/WebCore/platform/network/qt/SocketStreamError.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Google Inc. All rights reserved. + * Copyright (C) 2009 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 @@ -28,23 +28,23 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config.h" +#ifndef SocketStreamError_h +#define SocketStreamError_h -#if ENABLE(SHARED_WORKERS) - -#include "JSSharedWorkerContext.h" - -using namespace JSC; +#include "SocketStreamErrorBase.h" namespace WebCore { -void JSSharedWorkerContext::markChildren(MarkStack& markStack) -{ - Base::markChildren(markStack); + class SocketStreamError : public SocketStreamErrorBase { + public: + SocketStreamError() { } + explicit SocketStreamError(int errorCode) + : SocketStreamErrorBase(errorCode) + { + } - markIfNotNull(markStack, impl()->onconnect()); -} + }; -} // namespace WebCore +} // namespace WebCore -#endif // ENABLE(SHARED_WORKERS) +#endif // SocketStreamError_h diff --git a/src/3rdparty/webkit/WebCore/platform/network/qt/SocketStreamHandle.h b/src/3rdparty/webkit/WebCore/platform/network/qt/SocketStreamHandle.h new file mode 100644 index 0000000..64139e5 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/platform/network/qt/SocketStreamHandle.h @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009 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 SocketStreamHandle_h +#define SocketStreamHandle_h + +#include "SocketStreamHandleBase.h" + +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace WebCore { + + class AuthenticationChallenge; + class Credential; + class SocketStreamHandleClient; + + class SocketStreamHandle : public RefCounted<SocketStreamHandle>, public SocketStreamHandleBase { + public: + static PassRefPtr<SocketStreamHandle> create(const KURL& url, SocketStreamHandleClient* client) { return adoptRef(new SocketStreamHandle(url, client)); } + + virtual ~SocketStreamHandle(); + + protected: + virtual int platformSend(const char* data, int length); + virtual void platformClose(); + + private: + SocketStreamHandle(const KURL&, SocketStreamHandleClient*); + + // No authentication for streams per se, but proxy may ask for credentials. + void didReceiveAuthenticationChallenge(const AuthenticationChallenge&); + void receivedCredential(const AuthenticationChallenge&, const Credential&); + void receivedRequestToContinueWithoutCredential(const AuthenticationChallenge&); + void receivedCancellation(const AuthenticationChallenge&); + }; + +} // namespace WebCore + +#endif // SocketStreamHandle_h diff --git a/src/3rdparty/webkit/WebCore/platform/network/qt/SocketStreamHandleSoup.cpp b/src/3rdparty/webkit/WebCore/platform/network/qt/SocketStreamHandleSoup.cpp new file mode 100644 index 0000000..6aa33fc --- /dev/null +++ b/src/3rdparty/webkit/WebCore/platform/network/qt/SocketStreamHandleSoup.cpp @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2009 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 "SocketStreamHandle.h" + +#include "KURL.h" +#include "Logging.h" +#include "NotImplemented.h" +#include "SocketStreamHandleClient.h" + +namespace WebCore { + +SocketStreamHandle::SocketStreamHandle(const KURL& url, SocketStreamHandleClient* client) + : SocketStreamHandleBase(url, client) +{ + LOG(Network, "SocketStreamHandle %p new client %p", this, m_client); + notImplemented(); +} + +SocketStreamHandle::~SocketStreamHandle() +{ + LOG(Network, "SocketStreamHandle %p delete", this); + setClient(0); + notImplemented(); +} + +int SocketStreamHandle::platformSend(const char*, int) +{ + LOG(Network, "SocketStreamHandle %p platformSend", this); + notImplemented(); + return 0; +} + +void SocketStreamHandle::platformClose() +{ + LOG(Network, "SocketStreamHandle %p platformClose", this); + notImplemented(); +} + +void SocketStreamHandle::didReceiveAuthenticationChallenge(const AuthenticationChallenge&) +{ + notImplemented(); +} + +void SocketStreamHandle::receivedCredential(const AuthenticationChallenge&, const Credential&) +{ + notImplemented(); +} + +void SocketStreamHandle::receivedRequestToContinueWithoutCredential(const AuthenticationChallenge&) +{ + notImplemented(); +} + +void SocketStreamHandle::receivedCancellation(const AuthenticationChallenge&) +{ + notImplemented(); +} + +} // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/platform/qt/CookieJarQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/CookieJarQt.cpp index 56d3372..a27a06e 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/CookieJarQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/CookieJarQt.cpp @@ -48,6 +48,8 @@ namespace WebCore { #if QT_VERSION >= 0x040400 static QNetworkCookieJar *cookieJar(const Document *document) { + if (!document) + return 0; Frame *frame = document->frame(); if (!frame) return 0; diff --git a/src/3rdparty/webkit/WebCore/platform/qt/PlatformScreenQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/PlatformScreenQt.cpp index 5dc0963..7ba8350 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/PlatformScreenQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/PlatformScreenQt.cpp @@ -36,42 +36,54 @@ #include "FrameView.h" #include "HostWindow.h" #include "Widget.h" +#include "QWebPageClient.h" #include <QApplication> #include <QDesktopWidget> namespace WebCore { +static int screenNumber(Widget* w) +{ + if (!w) + return 0; + + QWebPageClient* client = w->root()->hostWindow()->platformPageClient(); + return client ? client->screenNumber() : 0; +} + int screenDepth(Widget* w) { - QDesktopWidget* d = QApplication::desktop(); - QWidget *view = w ? w->root()->hostWindow()->platformWindow() : 0; - int screenNumber = view ? d->screenNumber(view) : 0; - return d->screen(screenNumber)->depth(); + return QApplication::desktop()->screen(screenNumber(w))->depth(); } int screenDepthPerComponent(Widget* w) { - QWidget *view = w ? w->root()->hostWindow()->platformWindow() : 0; - return view ? view->depth() : QApplication::desktop()->screen(0)->depth(); + if (w) { + QWebPageClient* client = w->root()->hostWindow()->platformPageClient(); + + if (client) { + QWidget* view = QWidget::find(client->winId()); + if (view) + return view->depth(); + } + } + return QApplication::desktop()->screen(0)->depth(); } bool screenIsMonochrome(Widget* w) { - QDesktopWidget* d = QApplication::desktop(); - QWidget *view = w ? w->root()->hostWindow()->platformWindow(): 0; - int screenNumber = view ? d->screenNumber(view) : 0; - return d->screen(screenNumber)->numColors() < 2; + return QApplication::desktop()->screen(screenNumber(w))->numColors() < 2; } FloatRect screenRect(Widget* w) { - QRect r = QApplication::desktop()->screenGeometry(w ? w->root()->hostWindow()->platformWindow(): 0); + QRect r = QApplication::desktop()->screenGeometry(screenNumber(w)); return FloatRect(r.x(), r.y(), r.width(), r.height()); } FloatRect screenAvailableRect(Widget* w) { - QRect r = QApplication::desktop()->availableGeometry(w ? w->root()->hostWindow()->platformWindow(): 0); + QRect r = QApplication::desktop()->availableGeometry(screenNumber(w)); return FloatRect(r.x(), r.y(), r.width(), r.height()); } diff --git a/src/3rdparty/webkit/WebCore/platform/qt/PopupMenuQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/PopupMenuQt.cpp index 11dfe41..9ce5838 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/PopupMenuQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/PopupMenuQt.cpp @@ -30,6 +30,7 @@ #include "FrameView.h" #include "HostWindow.h" #include "PopupMenuClient.h" +#include "QWebPageClient.h" #include "QWebPopup.h" #include <QAction> @@ -85,13 +86,13 @@ void PopupMenu::populate(const IntRect& r) void PopupMenu::show(const IntRect& r, FrameView* v, int index) { - QWidget* window = v->hostWindow()->platformWindow(); + QWebPageClient* client = v->hostWindow()->platformPageClient(); populate(r); QRect rect = r; rect.moveTopLeft(v->contentsToWindow(r.topLeft())); rect.setHeight(m_popup->sizeHint().height()); - m_popup->setParent(window); + m_popup->setParent(QWidget::find(client->winId())); m_popup->setGeometry(rect); m_popup->setCurrentIndex(index); m_popup->exec(); diff --git a/src/3rdparty/webkit/WebCore/platform/qt/QWebPageClient.h b/src/3rdparty/webkit/WebCore/platform/qt/QWebPageClient.h new file mode 100644 index 0000000..1fc29a0 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/platform/qt/QWebPageClient.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2009 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 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 QWebPageClient_h +#define QWebPageClient_h + +#include <QRect> + +class QWebPageClient { +public: + virtual void scroll(int dx, int dy, const QRect&) = 0; + virtual void update(const QRect&) = 0; + + inline void resetCursor() + { + if (!cursor().bitmap() && cursor().shape() == m_lastCursor.shape()) + return; + updateCursor(m_lastCursor); + } + + inline void setCursor(const QCursor& cursor) + { + m_lastCursor = cursor; + if (!cursor.bitmap() && cursor.shape() == this->cursor().shape()) + return; + updateCursor(cursor); + } + + virtual int screenNumber() const = 0; + virtual WId winId() const = 0; + +protected: + virtual QCursor cursor() const = 0; + virtual void updateCursor(const QCursor& cursor) = 0; + +private: + QCursor m_lastCursor; +}; + +#endif diff --git a/src/3rdparty/webkit/WebCore/platform/qt/WidgetQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/WidgetQt.cpp index abcd584..4e82080 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/WidgetQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/WidgetQt.cpp @@ -30,6 +30,7 @@ */ #include "config.h" +#include "Widget.h" #include "Cursor.h" #include "Font.h" @@ -37,8 +38,8 @@ #include "HostWindow.h" #include "IntRect.h" #include "ScrollView.h" -#include "Widget.h" #include "NotImplemented.h" +#include "QWebPageClient.h" #include "qwebframe.h" #include "qwebframe_p.h" @@ -81,15 +82,10 @@ void Widget::setFocus() void Widget::setCursor(const Cursor& cursor) { #ifndef QT_NO_CURSOR - QWidget* widget = root()->hostWindow()->platformWindow(); - - if (!widget) - return; - - if (!cursor.impl().bitmap() && widget->cursor().shape() == cursor.impl().shape()) - return; + QWebPageClient* pageClient = root()->hostWindow()->platformPageClient(); - widget->setProperty("WebCoreCursor", cursor.impl()); + if (pageClient) + pageClient->setCursor(cursor.impl()); #endif } diff --git a/src/3rdparty/webkit/WebCore/platform/sql/SQLiteTransaction.cpp b/src/3rdparty/webkit/WebCore/platform/sql/SQLiteTransaction.cpp index 0a236be..a4b2ac8 100644 --- a/src/3rdparty/webkit/WebCore/platform/sql/SQLiteTransaction.cpp +++ b/src/3rdparty/webkit/WebCore/platform/sql/SQLiteTransaction.cpp @@ -30,9 +30,10 @@ namespace WebCore { -SQLiteTransaction::SQLiteTransaction(SQLiteDatabase& db) +SQLiteTransaction::SQLiteTransaction(SQLiteDatabase& db, bool readOnly) : m_db(db) , m_inProgress(false) + , m_readOnly(readOnly) { } @@ -46,7 +47,17 @@ void SQLiteTransaction::begin() { if (!m_inProgress) { ASSERT(!m_db.m_transactionInProgress); - m_inProgress = m_db.executeCommand("BEGIN;"); + // Call BEGIN IMMEDIATE for a write transaction to acquire + // a RESERVED lock on the DB file. Otherwise, another write + // transaction (on another connection) could make changes + // to the same DB file before this transaction gets to execute + // any statements. If that happens, this transaction will fail. + // http://www.sqlite.org/lang_transaction.html + // http://www.sqlite.org/lockingv3.html#locking + if (m_readOnly) + m_inProgress = m_db.executeCommand("BEGIN;"); + else + m_inProgress = m_db.executeCommand("BEGIN IMMEDIATE;"); m_db.m_transactionInProgress = m_inProgress; } } diff --git a/src/3rdparty/webkit/WebCore/platform/sql/SQLiteTransaction.h b/src/3rdparty/webkit/WebCore/platform/sql/SQLiteTransaction.h index cf5a180..557d81cb 100644 --- a/src/3rdparty/webkit/WebCore/platform/sql/SQLiteTransaction.h +++ b/src/3rdparty/webkit/WebCore/platform/sql/SQLiteTransaction.h @@ -35,7 +35,7 @@ class SQLiteDatabase; class SQLiteTransaction : public Noncopyable { public: - SQLiteTransaction(SQLiteDatabase& db); + SQLiteTransaction(SQLiteDatabase& db, bool readOnly = false); ~SQLiteTransaction(); void begin(); @@ -47,10 +47,9 @@ public: private: SQLiteDatabase& m_db; bool m_inProgress; - + bool m_readOnly; }; } // namespace WebCore #endif // SQLiteTransation_H - diff --git a/src/3rdparty/webkit/WebCore/platform/text/PlatformString.h b/src/3rdparty/webkit/WebCore/platform/text/PlatformString.h index 258b28d..b9b4078 100644 --- a/src/3rdparty/webkit/WebCore/platform/text/PlatformString.h +++ b/src/3rdparty/webkit/WebCore/platform/text/PlatformString.h @@ -254,6 +254,14 @@ public: // Determines the writing direction using the Unicode Bidi Algorithm rules P2 and P3. WTF::Unicode::Direction defaultWritingDirection() const { return m_impl ? m_impl->defaultWritingDirection() : WTF::Unicode::LeftToRight; } + // Counts the number of grapheme clusters. A surrogate pair or a sequence + // of a non-combining character and following combining characters is + // counted as 1 grapheme cluster. + unsigned numGraphemeClusters() const; + // Returns the number of characters which will be less than or equal to + // the specified grapheme cluster length. + unsigned numCharactersInGraphemeClusters(unsigned) const; + private: RefPtr<StringImpl> m_impl; }; diff --git a/src/3rdparty/webkit/WebCore/platform/text/String.cpp b/src/3rdparty/webkit/WebCore/platform/text/String.cpp index 2730939..e892ef6 100644 --- a/src/3rdparty/webkit/WebCore/platform/text/String.cpp +++ b/src/3rdparty/webkit/WebCore/platform/text/String.cpp @@ -25,6 +25,7 @@ #include "CString.h" #include "FloatConversion.h" #include "StringBuffer.h" +#include "TextBreakIterator.h" #include "TextEncoding.h" #include <wtf/dtoa.h> #include <limits> @@ -921,6 +922,31 @@ PassRefPtr<SharedBuffer> utf8Buffer(const String& string) return SharedBuffer::adoptVector(buffer); } +unsigned String::numGraphemeClusters() const +{ + TextBreakIterator* it = characterBreakIterator(characters(), length()); + if (!it) + return length(); + + unsigned num = 0; + while (textBreakNext(it) != TextBreakDone) + ++num; + return num; +} + +unsigned String::numCharactersInGraphemeClusters(unsigned numGraphemeClusters) const +{ + TextBreakIterator* it = characterBreakIterator(characters(), length()); + if (!it) + return min(length(), numGraphemeClusters); + + for (unsigned i = 0; i < numGraphemeClusters; ++i) { + if (textBreakNext(it) == TextBreakDone) + return length(); + } + return textBreakCurrent(it); +} + } // namespace WebCore #ifndef NDEBUG diff --git a/src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.cpp b/src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.cpp index d0a3288..226aab6 100644 --- a/src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.cpp +++ b/src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.cpp @@ -75,6 +75,7 @@ using JSC::UString; #if PLATFORM(QT) #include <QWidget> #include <QKeyEvent> +#include "QWebPageClient.h" QT_BEGIN_NAMESPACE #if QT_VERSION < 0x040500 extern Q_GUI_EXPORT WindowPtr qt_mac_window_for(const QWidget* w); @@ -171,7 +172,13 @@ bool PluginView::platformStart() return false; } - setPlatformPluginWidget(m_parentFrame->view()->hostWindow()->platformWindow()); +#if PLATFORM(QT) + if (QWebPageClient* client = m_parentFrame->view()->hostWindow()->platformPageClient()) { + if (QWidget* window = QWidget::find(client->winId())) { + setPlatformPluginWidget(window); + } + } +#endif show(); @@ -421,6 +428,14 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect) setNPWindowIfNeeded(); + CGContextRef cgContext = m_npCgContext.context; + if (!cgContext) + return; + + CGContextSaveGState(cgContext); + IntPoint offset = frameRect().location(); + CGContextTranslateCTM(cgContext, offset.x(), offset.y()); + EventRecord event; event.what = updateEvt; event.message = (long unsigned int)m_npCgContext.window; @@ -429,15 +444,10 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect) event.where.v = 0; event.modifiers = GetCurrentKeyModifiers(); - CGContextRef cg = m_npCgContext.context; - CGContextSaveGState(cg); - IntPoint offset = frameRect().location(); - CGContextTranslateCTM(cg, offset.x(), offset.y()); - if (!dispatchNPEvent(event)) LOG(Events, "PluginView::paint(): Paint event not accepted"); - CGContextRestoreGState(cg); + CGContextRestoreGState(cgContext); } void PluginView::invalidateRect(const IntRect& rect) diff --git a/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp b/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp index fdeac2f..908e707 100644 --- a/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp +++ b/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp @@ -56,6 +56,7 @@ #include "npruntime_impl.h" #include "runtime.h" #include "runtime_root.h" +#include "QWebPageClient.h" #include <QKeyEvent> #include <QWidget> #include <QX11Info> @@ -212,7 +213,9 @@ void PluginView::handleKeyboardEvent(KeyboardEvent* event) XEvent npEvent; // On UNIX NPEvent is a typedef for XEvent. npEvent.type = (event->type() == "keydown") ? 2 : 3; // ints as Qt unsets KeyPress and KeyRelease - setSharedXEventFields(npEvent, m_parentFrame->view()->hostWindow()->platformWindow()); + QWebPageClient* client = m_parentFrame->view()->hostWindow()->platformPageClient(); + QWidget* window = QWidget::find(client->winId()); + setSharedXEventFields(npEvent, window); setXKeyEventSpecificFields(npEvent, event); if (!dispatchNPEvent(npEvent)) @@ -350,8 +353,11 @@ NPError PluginView::getValue(NPNVariable variable, void* value) case NPNVxDisplay: if (platformPluginWidget()) *(void **)value = platformPluginWidget()->x11Info().display(); - else - *(void **)value = m_parentFrame->view()->hostWindow()->platformWindow()->x11Info().display(); + else { + QWebPageClient* client = m_parentFrame->view()->hostWindow()->platformPageClient(); + QWidget* window = QWidget::find(client->winId()); + *(void **)value = window->x11Info().display(); + } return NPERR_NO_ERROR; case NPNVxtAppContext: @@ -396,7 +402,7 @@ NPError PluginView::getValue(NPNVariable variable, void* value) case NPNVnetscapeWindow: { void* w = reinterpret_cast<void*>(value); - *((XID *)w) = m_parentFrame->view()->hostWindow()->platformWindow()->winId(); + *((XID *)w) = m_parentFrame->view()->hostWindow()->platformPageClient()->winId(); return NPERR_NO_ERROR; } @@ -451,7 +457,8 @@ bool PluginView::platformStart() } if (m_needsXEmbed) { - setPlatformWidget(new PluginContainerQt(this, m_parentFrame->view()->hostWindow()->platformWindow())); + QWebPageClient* client = m_parentFrame->view()->hostWindow()->platformPageClient(); + setPlatformWidget(new PluginContainerQt(this, QWidget::find(client->winId()))); } else { notImplemented(); return false; diff --git a/src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp b/src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp index 9ee8ee6..21ac2a4 100644 --- a/src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp +++ b/src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp @@ -74,17 +74,17 @@ #endif #if PLATFORM(QT) -#include <QWidget.h> +#include "QWebPageClient.h" #endif -static inline HWND windowHandleForPlatformWidget(PlatformWidget widget) +static inline HWND windowHandleForPageClient(PlatformPageClient client) { #if PLATFORM(QT) - if (!widget) + if (!client) return 0; - return widget->winId(); + return client->winId(); #else - return widget; + return client; #endif } @@ -880,7 +880,7 @@ NPError PluginView::getValue(NPNVariable variable, void* value) case NPNVnetscapeWindow: { HWND* w = reinterpret_cast<HWND*>(value); - *w = windowHandleForPlatformWidget(parent() ? parent()->hostWindow()->platformWindow() : 0); + *w = windowHandleForPageClient(parent() ? parent()->hostWindow()->platformPageClient() : 0); return NPERR_NO_ERROR; } @@ -952,7 +952,7 @@ void PluginView::forceRedraw() if (m_isWindowed) ::UpdateWindow(platformPluginWidget()); else - ::UpdateWindow(windowHandleForPlatformWidget(parent() ? parent()->hostWindow()->platformWindow() : 0)); + ::UpdateWindow(windowHandleForPageClient(parent() ? parent()->hostWindow()->platformPageClient() : 0)); } bool PluginView::platformStart() @@ -970,7 +970,7 @@ bool PluginView::platformStart() if (isSelfVisible()) flags |= WS_VISIBLE; - HWND parentWindowHandle = windowHandleForPlatformWidget(m_parentFrame->view()->hostWindow()->platformWindow()); + HWND parentWindowHandle = windowHandleForPageClient(m_parentFrame->view()->hostWindow()->platformPageClient()); HWND window = ::CreateWindowEx(0, kWebPluginViewdowClassName, 0, flags, 0, 0, 0, 0, parentWindowHandle, 0, Page::instanceHandle(), 0); diff --git a/src/3rdparty/webkit/WebCore/rendering/FixedTableLayout.cpp b/src/3rdparty/webkit/WebCore/rendering/FixedTableLayout.cpp index ee3e75a..4852708 100644 --- a/src/3rdparty/webkit/WebCore/rendering/FixedTableLayout.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/FixedTableLayout.cpp @@ -188,6 +188,11 @@ int FixedTableLayout::calcWidthArray(int) return usedWidth; } +// Use a very large value (in effect infinite). But not too large! +// numeric_limits<int>::max() will too easily overflow widths. +// Keep this in synch with BLOCK_MAX_WIDTH in RenderBlock.cpp +#define TABLE_MAX_WIDTH 15000 + void FixedTableLayout::calcPrefWidths(int& minWidth, int& maxWidth) { // FIXME: This entire calculation is incorrect for both minwidth and maxwidth. @@ -206,6 +211,24 @@ void FixedTableLayout::calcPrefWidths(int& minWidth, int& maxWidth) minWidth = max(mw, tableWidth); maxWidth = minWidth; + + // This quirk is very similar to one that exists in RenderBlock::calcBlockPrefWidths(). + // Here's the example for this one: + /* + <table style="width:100%; background-color:red"><tr><td> + <table style="background-color:blue"><tr><td> + <table style="width:100%; background-color:green; table-layout:fixed"><tr><td> + Content + </td></tr></table> + </td></tr></table> + </td></tr></table> + */ + // In this example, the two inner tables should be as large as the outer table. + // We can achieve this effect by making the maxwidth of fixed tables with percentage + // widths be infinite. + if (m_table->style()->htmlHacks() && m_table->style()->width().isPercent() + && maxWidth < TABLE_MAX_WIDTH) + maxWidth = TABLE_MAX_WIDTH; } void FixedTableLayout::layout() diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderBlock.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderBlock.cpp index 7056bca..ae0d76d 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderBlock.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/RenderBlock.cpp @@ -3559,7 +3559,7 @@ void RenderBlock::calcColumnWidth() void RenderBlock::setDesiredColumnCountAndWidth(int count, int width) { - if (count == 1) { + if (count == 1 && style()->hasAutoColumnWidth()) { if (hasColumns()) { delete gColumnInfoMap->take(this); setHasColumns(false); diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderBox.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderBox.cpp index 8a38769..cea226e 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderBox.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/RenderBox.cpp @@ -400,14 +400,21 @@ int RenderBox::horizontalScrollbarHeight() const return includeHorizontalScrollbarSize() ? layer()->horizontalScrollbarHeight() : 0; } -bool RenderBox::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier) +bool RenderBox::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier, Node** stopNode) { RenderLayer* l = layer(); - if (l && l->scroll(direction, granularity, multiplier)) + if (l && l->scroll(direction, granularity, multiplier)) { + if (stopNode) + *stopNode = node(); return true; + } + + if (stopNode && *stopNode && *stopNode == node()) + return true; + RenderBlock* b = containingBlock(); if (b && !b->isRenderView()) - return b->scroll(direction, granularity, multiplier); + return b->scroll(direction, granularity, multiplier, stopNode); return false; } diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderBox.h b/src/3rdparty/webkit/WebCore/rendering/RenderBox.h index b493ae9..41c5622 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderBox.h +++ b/src/3rdparty/webkit/WebCore/rendering/RenderBox.h @@ -245,7 +245,7 @@ public: virtual int verticalScrollbarWidth() const; int horizontalScrollbarHeight() const; - virtual bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1.0f); + virtual bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1.0f, Node** stopNode = 0); bool canBeScrolledAndHasScrollableArea() const; virtual bool canBeProgramaticallyScrolled(bool) const; virtual void autoscroll(); diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderForeignObject.h b/src/3rdparty/webkit/WebCore/rendering/RenderForeignObject.h index 8fdb816..e014f22 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderForeignObject.h +++ b/src/3rdparty/webkit/WebCore/rendering/RenderForeignObject.h @@ -49,6 +49,7 @@ public: virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction); virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction); + virtual bool isSVGForeignObject() const { return true; } private: TransformationMatrix translationForAttributes() const; diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderLayer.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderLayer.cpp index 08f5f57..95db43a 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderLayer.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/RenderLayer.cpp @@ -2127,9 +2127,7 @@ void RenderLayer::paintLayer(RenderLayer* rootLayer, GraphicsContext* p, // Make sure the parent's clip rects have been calculated. IntRect clipRect = paintDirtyRect; if (parent()) { - ClipRects parentRects; - parentClipRects(rootLayer, parentRects, paintFlags & PaintLayerTemporaryClipRects); - clipRect = parentRects.overflowClipRect(); + clipRect = backgroundClipRect(rootLayer, paintFlags & PaintLayerTemporaryClipRects); clipRect.intersect(paintDirtyRect); } @@ -2434,9 +2432,7 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* cont if (transform() && !appliedTransform) { // Make sure the parent's clip rects have been calculated. if (parent()) { - ClipRects parentRects; - parentClipRects(rootLayer, parentRects, useTemporaryClipRects); - IntRect clipRect = parentRects.overflowClipRect(); + IntRect clipRect = backgroundClipRect(rootLayer, useTemporaryClipRects); // Go ahead and test the enclosing clip now. if (!clipRect.contains(hitTestPoint)) return 0; @@ -2734,10 +2730,10 @@ void RenderLayer::parentClipRects(const RenderLayer* rootLayer, ClipRects& clipR clipRects = *parent()->clipRects(); } -void RenderLayer::calculateRects(const RenderLayer* rootLayer, const IntRect& paintDirtyRect, IntRect& layerBounds, - IntRect& backgroundRect, IntRect& foregroundRect, IntRect& outlineRect, bool temporaryClipRects) const +IntRect RenderLayer::backgroundClipRect(const RenderLayer* rootLayer, bool temporaryClipRects) const { - if (rootLayer != this && parent()) { + IntRect backgroundRect; + if (parent()) { ClipRects parentRects; parentClipRects(rootLayer, parentRects, temporaryClipRects); backgroundRect = renderer()->style()->position() == FixedPosition ? parentRects.fixedClipRect() : @@ -2747,7 +2743,15 @@ void RenderLayer::calculateRects(const RenderLayer* rootLayer, const IntRect& pa ASSERT(view); if (view && parentRects.fixed() && rootLayer->renderer() == view) backgroundRect.move(view->frameView()->scrollX(), view->frameView()->scrollY()); + } + return backgroundRect; +} +void RenderLayer::calculateRects(const RenderLayer* rootLayer, const IntRect& paintDirtyRect, IntRect& layerBounds, + IntRect& backgroundRect, IntRect& foregroundRect, IntRect& outlineRect, bool temporaryClipRects) const +{ + if (rootLayer != this && parent()) { + backgroundRect = backgroundClipRect(rootLayer, temporaryClipRects); backgroundRect.intersect(paintDirtyRect); } else backgroundRect = paintDirtyRect; diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderLayer.h b/src/3rdparty/webkit/WebCore/rendering/RenderLayer.h index 16ad4d4..9d2212b 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderLayer.h +++ b/src/3rdparty/webkit/WebCore/rendering/RenderLayer.h @@ -516,6 +516,7 @@ private: void setPaintingInsideReflection(bool b) { m_paintingInsideReflection = b; } void parentClipRects(const RenderLayer* rootLayer, ClipRects&, bool temporaryClipRects = false) const; + IntRect backgroundClipRect(const RenderLayer* rootLayer, bool temporaryClipRects) const; RenderLayer* enclosingTransformedAncestor() const; diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderLayerBacking.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderLayerBacking.cpp index 69a8f7d..941817c 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderLayerBacking.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/RenderLayerBacking.cpp @@ -58,6 +58,7 @@ static bool hasBoxDecorationsWithBackgroundImage(const RenderStyle*); RenderLayerBacking::RenderLayerBacking(RenderLayer* layer) : m_owningLayer(layer) , m_hasDirectlyCompositedContent(false) + , m_artificiallyInflatedBounds(false) { createGraphicsLayer(); } @@ -123,6 +124,30 @@ void RenderLayerBacking::updateLayerTransform() m_graphicsLayer->setTransform(t); } +static bool hasNonZeroTransformOrigin(const RenderObject* renderer) +{ + RenderStyle* style = renderer->style(); + return (style->transformOriginX().type() == Fixed && style->transformOriginX().value()) + || (style->transformOriginY().type() == Fixed && style->transformOriginY().value()); +} + +void RenderLayerBacking::updateCompositedBounds() +{ + IntRect layerBounds = compositor()->calculateCompositedBounds(m_owningLayer, m_owningLayer); + + // If the element has a transform-origin that has fixed lengths, and the renderer has zero size, + // then we need to ensure that the compositing layer has non-zero size so that we can apply + // the transform-origin via the GraphicsLayer anchorPoint (which is expressed as a fractional value). + if (layerBounds.isEmpty() && hasNonZeroTransformOrigin(renderer())) { + layerBounds.setWidth(1); + layerBounds.setHeight(1); + m_artificiallyInflatedBounds = true; + } else + m_artificiallyInflatedBounds = false; + + setCompositedBounds(layerBounds); +} + void RenderLayerBacking::updateAfterLayout(UpdateDepth updateDepth) { RenderLayerCompositor* layerCompositor = compositor(); @@ -134,7 +159,7 @@ void RenderLayerBacking::updateAfterLayout(UpdateDepth updateDepth) // // The solution is to update compositing children of this layer here, // via updateCompositingChildrenGeometry(). - setCompositedBounds(layerCompositor->calculateCompositedBounds(m_owningLayer, m_owningLayer)); + updateCompositedBounds(); layerCompositor->updateCompositingDescendantGeometry(m_owningLayer, m_owningLayer, updateDepth); if (!m_owningLayer->parent()) { @@ -232,10 +257,7 @@ void RenderLayerBacking::updateGraphicsLayerGeometry() // Call calculateRects to get the backgroundRect which is what is used to clip the contents of this // layer. Note that we call it with temporaryClipRects = true because normally when computing clip rects // for a compositing layer, rootLayer is the layer itself. - ClipRects parentRects; - m_owningLayer->parentClipRects(compAncestor, parentRects, true); - IntRect parentClipRect = parentRects.overflowClipRect(); - + IntRect parentClipRect = m_owningLayer->backgroundClipRect(compAncestor, true); m_ancestorClippingLayer->setPosition(FloatPoint() + (parentClipRect.location() - graphicsLayerParentLocation)); m_ancestorClippingLayer->setSize(parentClipRect.size()); @@ -327,7 +349,7 @@ void RenderLayerBacking::updateGraphicsLayerGeometry() m_graphicsLayer->setContentsRect(contentsBox()); if (!m_hasDirectlyCompositedContent) - m_graphicsLayer->setDrawsContent(!isSimpleContainerCompositingLayer() && !paintingGoesToWindow()); + m_graphicsLayer->setDrawsContent(!isSimpleContainerCompositingLayer() && !paintingGoesToWindow() && !m_artificiallyInflatedBounds); } void RenderLayerBacking::updateInternalHierarchy() @@ -1059,7 +1081,8 @@ bool RenderLayerBacking::startTransition(double beginTime, int property, const R KeyframeValueList opacityVector(AnimatedPropertyOpacity); opacityVector.insert(new FloatAnimationValue(0, compositingOpacity(fromStyle->opacity()))); opacityVector.insert(new FloatAnimationValue(1, compositingOpacity(toStyle->opacity()))); - if (m_graphicsLayer->addAnimation(opacityVector, toRenderBox(renderer())->borderBoxRect().size(), opacityAnim, String(), beginTime)) + // The boxSize param is only used for transform animations (which can only run on RenderBoxes), so we pass an empty size here. + if (m_graphicsLayer->addAnimation(opacityVector, IntSize(), opacityAnim, String(), beginTime)) didAnimate = true; } } diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderLayerBacking.h b/src/3rdparty/webkit/WebCore/rendering/RenderLayerBacking.h index 731e741..e12aa58 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderLayerBacking.h +++ b/src/3rdparty/webkit/WebCore/rendering/RenderLayerBacking.h @@ -108,6 +108,7 @@ public: IntRect compositedBounds() const; void setCompositedBounds(const IntRect&); + void updateCompositedBounds(); FloatPoint graphicsLayerToContentsCoordinates(const GraphicsLayer*, const FloatPoint&); FloatPoint contentsToGraphicsLayerCoordinates(const GraphicsLayer*, const FloatPoint&); @@ -176,6 +177,7 @@ private: IntRect m_compositedBounds; bool m_hasDirectlyCompositedContent; + bool m_artificiallyInflatedBounds; // bounds had to be made non-zero to make transform-origin work }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderLayerCompositor.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderLayerCompositor.cpp index 65a9c4a..bcd1f08 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderLayerCompositor.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/RenderLayerCompositor.cpp @@ -431,11 +431,11 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, O bool haveComputedBounds = false; IntRect absBounds; - if (overlapMap && mustOverlapCompositedLayers) { + if (overlapMap && !overlapMap->isEmpty()) { // If we're testing for overlap, we only need to composite if we overlap something that is already composited. absBounds = layer->renderer()->localToAbsoluteQuad(FloatRect(layer->localBoundingBox())).enclosingBoundingBox(); haveComputedBounds = true; - mustOverlapCompositedLayers &= overlapsCompositedLayers(*overlapMap, absBounds); + mustOverlapCompositedLayers = overlapsCompositedLayers(*overlapMap, absBounds); } layer->setMustOverlapCompositedLayers(mustOverlapCompositedLayers); @@ -594,8 +594,7 @@ void RenderLayerCompositor::rebuildCompositingLayerTree(RenderLayer* layer, stru if (layerBacking) { // The compositing state of all our children has been updated already, so now // we can compute and cache the composited bounds for this layer. - layerBacking->setCompositedBounds(calculateCompositedBounds(layer, layer)); - + layerBacking->updateCompositedBounds(); layerBacking->updateGraphicsLayerConfiguration(); layerBacking->updateGraphicsLayerGeometry(); @@ -675,7 +674,7 @@ void RenderLayerCompositor::updateCompositingDescendantGeometry(RenderLayer* com { if (layer != compositingAncestor) { if (RenderLayerBacking* layerBacking = layer->backing()) { - layerBacking->setCompositedBounds(calculateCompositedBounds(layer, layer)); + layerBacking->updateCompositedBounds(); layerBacking->updateGraphicsLayerGeometry(); if (updateDepth == RenderLayerBacking::CompositingChildren) return; @@ -868,10 +867,8 @@ bool RenderLayerCompositor::clippedByAncestor(RenderLayer* layer) const if (!computeClipRoot || computeClipRoot == layer) return false; - ClipRects parentRects; - layer->parentClipRects(computeClipRoot, parentRects, true); - - return parentRects.overflowClipRect() != ClipRects::infiniteRect(); + IntRect backgroundRect = layer->backgroundClipRect(computeClipRoot, true); + return backgroundRect != ClipRects::infiniteRect(); } // Return true if the given layer is a stacking context and has compositing child diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderListBox.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderListBox.cpp index e6c28f7..f94f7ce 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderListBox.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/RenderListBox.cpp @@ -527,8 +527,7 @@ void RenderListBox::valueChanged(Scrollbar*) if (newOffset != m_indexOffset) { m_indexOffset = newOffset; repaint(); - // Fire the scroll DOM event. - node()->dispatchEvent(eventNames().scrollEvent, false, false); + node()->dispatchEvent(Event::create(eventNames().scrollEvent, false, false)); } } diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderObject.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderObject.cpp index 4cbc530..1d5ed0c 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderObject.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/RenderObject.cpp @@ -625,6 +625,11 @@ RenderBlock* RenderObject::containingBlock() const // inline directly. if (o->style()->position() == RelativePosition && o->isInline() && !o->isReplaced()) return o->containingBlock(); +#if ENABLE(SVG) + if (o->isSVGForeignObject()) //foreignObject is the containing block for contents inside it + break; +#endif + o = o->parent(); } } else { diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderObject.h b/src/3rdparty/webkit/WebCore/rendering/RenderObject.h index f361198..e5a0c16 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderObject.h +++ b/src/3rdparty/webkit/WebCore/rendering/RenderObject.h @@ -305,6 +305,7 @@ public: virtual bool isRenderPath() const { return false; } virtual bool isSVGText() const { return false; } virtual bool isSVGImage() const { return false; } + virtual bool isSVGForeignObject() const { return false; } // Per SVG 1.1 objectBoundingBox ignores clipping, masking, filter effects, opacity and stroke-width. // This is used for all computation of objectBoundingBox relative units and by SVGLocateable::getBBox(). diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderTextControl.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderTextControl.cpp index 4f4b570..cd90854 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderTextControl.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/RenderTextControl.cpp @@ -501,7 +501,7 @@ void RenderTextControl::selectionChanged(bool userTriggered) if (Frame* frame = document()->frame()) { if (frame->selection()->isRange() && userTriggered) - node()->dispatchEvent(eventNames().selectEvent, true, false); + node()->dispatchEvent(Event::create(eventNames().selectEvent, true, false)); } } diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderTextControlMultiLine.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderTextControlMultiLine.cpp index 8dfb858..3f0d041 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderTextControlMultiLine.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/RenderTextControlMultiLine.cpp @@ -22,6 +22,7 @@ #include "config.h" #include "RenderTextControlMultiLine.h" +#include "Event.h" #include "EventNames.h" #include "Frame.h" #include "HTMLNames.h" @@ -50,8 +51,7 @@ void RenderTextControlMultiLine::subtreeHasChanged() if (!node()->focused()) return; - // Fire the "input" DOM event - node()->dispatchEvent(eventNames().inputEvent, true, false); + node()->dispatchEvent(Event::create(eventNames().inputEvent, true, false)); if (Frame* frame = document()->frame()) frame->textDidChangeInTextArea(static_cast<Element*>(node())); diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumMac.h b/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumMac.h index 0c417a2..9f412a0 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumMac.h +++ b/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumMac.h @@ -3,7 +3,6 @@ * * Copyright (C) 2005 Apple Computer, Inc. * Copyright (C) 2008, 2009 Google, Inc. - * Copyright (C) 2009 Kenneth Rohde Christiansen * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -26,7 +25,6 @@ #define RenderThemeChromiumMac_h #import "RenderTheme.h" -#import <AppKit/AppKit.h> #import <wtf/HashMap.h> #import <wtf/RetainPtr.h> @@ -36,186 +34,165 @@ class WebCoreRenderThemeNotificationObserver; #endif +// This file (and its associated .mm file) is a clone of RenderThemeMac.h. See +// the .mm file for details. + namespace WebCore { - class RenderStyle; +class RenderStyle; + +class RenderThemeChromiumMac : public RenderTheme { +public: + static PassRefPtr<RenderTheme> create(); + + // A method asking if the control changes its tint when the window has focus or not. + virtual bool controlSupportsTints(const RenderObject*) const; + + // A general method asking if any control tinting is supported at all. + virtual bool supportsControlTints() const { return true; } + + virtual void adjustRepaintRect(const RenderObject*, IntRect&); + + virtual bool isControlStyled(const RenderStyle*, const BorderData&, + const FillLayer&, const Color& backgroundColor) const; + + virtual Color platformActiveSelectionBackgroundColor() const; + virtual Color platformInactiveSelectionBackgroundColor() const; + virtual Color platformActiveListBoxSelectionBackgroundColor() const; + virtual Color platformActiveListBoxSelectionForegroundColor() const; + virtual Color platformInactiveListBoxSelectionBackgroundColor() const; + virtual Color platformInactiveListBoxSelectionForegroundColor() const; + virtual Color platformFocusRingColor() const; - class RenderThemeChromiumMac : public RenderTheme { - public: - static PassRefPtr<RenderTheme> create(); + virtual ScrollbarControlSize scrollbarControlSizeForPart(ControlPart) { return SmallScrollbar; } + + virtual void platformColorsDidChange(); + + // System fonts. + virtual void systemFont(int cssValueId, FontDescription&) const; + + virtual int minimumMenuListSize(RenderStyle*) const; + + virtual void adjustSliderThumbSize(RenderObject*) const; + + virtual int popupInternalPaddingLeft(RenderStyle*) const; + virtual int popupInternalPaddingRight(RenderStyle*) const; + virtual int popupInternalPaddingTop(RenderStyle*) const; + virtual int popupInternalPaddingBottom(RenderStyle*) const; + + virtual bool paintCapsLockIndicator(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - // A method to obtain the baseline position for a "leaf" control. This will only be used if a baseline - // position cannot be determined by examining child content. Checkboxes and radio buttons are examples of - // controls that need to do this. - virtual int baselinePosition(const RenderObject*) const; + virtual Color systemColor(int cssValueId) const; - // A method asking if the control changes its tint when the window has focus or not. - virtual bool controlSupportsTints(const RenderObject*) const; +protected: + virtual bool supportsSelectionForegroundColors() const { return false; } - // A general method asking if any control tinting is supported at all. - virtual bool supportsControlTints() const { return true; } + virtual bool paintTextField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual void adjustTextFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual void adjustRepaintRect(const RenderObject*, IntRect&); + virtual bool paintTextArea(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual void adjustTextAreaStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool isControlStyled(const RenderStyle*, const BorderData&, - const FillLayer&, const Color& backgroundColor) const; + virtual bool paintMenuList(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual void adjustMenuListStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual Color platformActiveSelectionBackgroundColor() const; - virtual Color platformInactiveSelectionBackgroundColor() const; - virtual Color platformActiveListBoxSelectionBackgroundColor() const; + virtual bool paintMenuListButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual void adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual Color platformFocusRingColor() const; - - virtual void platformColorsDidChange(); + virtual bool paintSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual void adjustSliderTrackStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - // System fonts. - virtual void systemFont(int cssValueId, FontDescription&) const; + virtual bool paintSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual void adjustSliderThumbStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual int minimumMenuListSize(RenderStyle*) const; + virtual bool paintSearchField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual void adjustSearchFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual void adjustSliderThumbSize(RenderObject*) const; - - virtual int popupInternalPaddingLeft(RenderStyle*) const; - virtual int popupInternalPaddingRight(RenderStyle*) const; - virtual int popupInternalPaddingTop(RenderStyle*) const; - virtual int popupInternalPaddingBottom(RenderStyle*) const; - - virtual ScrollbarControlSize scrollbarControlSizeForPart(ControlPart) { return SmallScrollbar; } + virtual void adjustSearchFieldCancelButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; + virtual bool paintSearchFieldCancelButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + + virtual void adjustSearchFieldDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const; + virtual bool paintSearchFieldDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + + virtual void adjustSearchFieldResultsDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const; + virtual bool paintSearchFieldResultsDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + + virtual void adjustSearchFieldResultsButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; + virtual bool paintSearchFieldResultsButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + +#if ENABLE(VIDEO) + virtual bool paintMediaPlayButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintMediaMuteButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintMediaSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintMediaSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintMediaVolumeSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintMediaVolumeSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintMediaControlsBackground(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + + // Media controls + virtual String extraMediaControlsStyleSheet(); +#endif + +private: + RenderThemeChromiumMac(); + virtual ~RenderThemeChromiumMac(); + + IntRect inflateRect(const IntRect&, const IntSize&, const int* margins, float zoomLevel = 1.0f) const; + + FloatRect convertToPaintingRect(const RenderObject* inputRenderer, const RenderObject* partRenderer, const FloatRect& inputRect, const IntRect& r) const; - virtual bool paintCapsLockIndicator(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + // Get the control size based off the font. Used by some of the controls (like buttons). + NSControlSize controlSizeForFont(RenderStyle*) const; + NSControlSize controlSizeForSystemFont(RenderStyle*) const; + void setControlSize(NSCell*, const IntSize* sizes, const IntSize& minSize, float zoomLevel = 1.0f); + void setSizeFromFont(RenderStyle*, const IntSize* sizes) const; + IntSize sizeForFont(RenderStyle*, const IntSize* sizes) const; + IntSize sizeForSystemFont(RenderStyle*, const IntSize* sizes) const; + void setFontFromControlSize(CSSStyleSelector*, RenderStyle*, NSControlSize) const; + + void updateActiveState(NSCell*, const RenderObject*); + void updateCheckedState(NSCell*, const RenderObject*); + void updateEnabledState(NSCell*, const RenderObject*); + void updateFocusedState(NSCell*, const RenderObject*); + void updatePressedState(NSCell*, const RenderObject*); + + // Helpers for adjusting appearance and for painting + + void setPopupButtonCellState(const RenderObject*, const IntRect&); + const IntSize* popupButtonSizes() const; + const int* popupButtonMargins() const; + const int* popupButtonPadding(NSControlSize) const; + void paintMenuListButtonGradients(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + const IntSize* menuListSizes() const; + + const IntSize* searchFieldSizes() const; + const IntSize* cancelButtonSizes() const; + const IntSize* resultsButtonSizes() const; + void setSearchCellState(RenderObject*, const IntRect&); + void setSearchFieldSize(RenderStyle*) const; + + NSPopUpButtonCell* popupButton() const; + NSSearchFieldCell* search() const; + NSMenu* searchMenuTemplate() const; + NSSliderCell* sliderThumbHorizontal() const; + NSSliderCell* sliderThumbVertical() const; + +private: + mutable RetainPtr<NSPopUpButtonCell> m_popupButton; + mutable RetainPtr<NSSearchFieldCell> m_search; + mutable RetainPtr<NSMenu> m_searchMenuTemplate; + mutable RetainPtr<NSSliderCell> m_sliderThumbHorizontal; + mutable RetainPtr<NSSliderCell> m_sliderThumbVertical; - virtual Color systemColor(int cssValueId) const; + bool m_isSliderThumbHorizontalPressed; + bool m_isSliderThumbVerticalPressed; - protected: - virtual bool supportsSelectionForegroundColors() const { return false; } + mutable HashMap<int, RGBA32> m_systemColorCache; - // Methods for each appearance value. - virtual bool paintCheckbox(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual void setCheckboxSize(RenderStyle*) const; - - virtual bool paintRadio(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual void setRadioSize(RenderStyle*) const; - - virtual void adjustButtonStyle(CSSStyleSelector*, RenderStyle*, WebCore::Element*) const; - virtual bool paintButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual void setButtonSize(RenderStyle*) const; - - virtual bool paintTextField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual void adjustTextFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - - virtual bool paintTextArea(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual void adjustTextAreaStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - - virtual bool paintMenuList(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual void adjustMenuListStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - - virtual bool paintMenuListButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual void adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - - virtual bool paintSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual void adjustSliderTrackStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - - virtual bool paintSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual void adjustSliderThumbStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - - virtual bool paintSearchField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual void adjustSearchFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - - virtual void adjustSearchFieldCancelButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSearchFieldCancelButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - - virtual void adjustSearchFieldDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSearchFieldDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - - virtual void adjustSearchFieldResultsDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSearchFieldResultsDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - - virtual void adjustSearchFieldResultsButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSearchFieldResultsButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - - virtual bool paintMediaFullscreenButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaPlayButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaMuteButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaSeekBackButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaSeekForwardButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - - private: - RenderThemeChromiumMac(); - virtual ~RenderThemeChromiumMac(); - - IntRect inflateRect(const IntRect&, const IntSize&, const int* margins, float zoomLevel = 1.0f) const; - - // Get the control size based off the font. Used by some of the controls (like buttons). - NSControlSize controlSizeForFont(RenderStyle*) const; - NSControlSize controlSizeForSystemFont(RenderStyle*) const; - void setControlSize(NSCell*, const IntSize* sizes, const IntSize& minSize, float zoomLevel = 1.0f); - void setSizeFromFont(RenderStyle*, const IntSize* sizes) const; - IntSize sizeForFont(RenderStyle*, const IntSize* sizes) const; - IntSize sizeForSystemFont(RenderStyle*, const IntSize* sizes) const; - void setFontFromControlSize(CSSStyleSelector*, RenderStyle*, NSControlSize) const; - - void updateActiveState(NSCell*, const RenderObject*); - void updateCheckedState(NSCell*, const RenderObject*); - void updateEnabledState(NSCell*, const RenderObject*); - void updateFocusedState(NSCell*, const RenderObject*); - void updatePressedState(NSCell*, const RenderObject*); - - // Helpers for adjusting appearance and for painting - const IntSize* checkboxSizes() const; - const int* checkboxMargins() const; - void setCheckboxCellState(const RenderObject*, const IntRect&); - - const IntSize* radioSizes() const; - const int* radioMargins() const; - void setRadioCellState(const RenderObject*, const IntRect&); - - void setButtonPaddingFromControlSize(RenderStyle*, NSControlSize) const; - const IntSize* buttonSizes() const; - const int* buttonMargins() const; - void setButtonCellState(const RenderObject*, const IntRect&); - - void setPopupButtonCellState(const RenderObject*, const IntRect&); - const IntSize* popupButtonSizes() const; - const int* popupButtonMargins() const; - const int* popupButtonPadding(NSControlSize) const; - void paintMenuListButtonGradients(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - const IntSize* menuListSizes() const; - - const IntSize* searchFieldSizes() const; - const IntSize* cancelButtonSizes() const; - const IntSize* resultsButtonSizes() const; - void setSearchCellState(RenderObject*, const IntRect&); - void setSearchFieldSize(RenderStyle*) const; - - NSButtonCell* checkbox() const; - NSButtonCell* radio() const; - NSButtonCell* button() const; - NSPopUpButtonCell* popupButton() const; - NSSearchFieldCell* search() const; - NSMenu* searchMenuTemplate() const; - NSSliderCell* sliderThumbHorizontal() const; - NSSliderCell* sliderThumbVertical() const; - - private: - mutable RetainPtr<NSButtonCell> m_checkbox; - mutable RetainPtr<NSButtonCell> m_radio; - mutable RetainPtr<NSButtonCell> m_button; - mutable RetainPtr<NSPopUpButtonCell> m_popupButton; - mutable RetainPtr<NSSearchFieldCell> m_search; - mutable RetainPtr<NSMenu> m_searchMenuTemplate; - mutable RetainPtr<NSSliderCell> m_sliderThumbHorizontal; - mutable RetainPtr<NSSliderCell> m_sliderThumbVertical; - - bool m_isSliderThumbHorizontalPressed; - bool m_isSliderThumbVerticalPressed; - - mutable HashMap<int, RGBA32> m_systemColorCache; - - RetainPtr<WebCoreRenderThemeNotificationObserver> m_notificationObserver; - }; + RetainPtr<WebCoreRenderThemeNotificationObserver> m_notificationObserver; + bool paintMediaButtonInternal(GraphicsContext*, const IntRect&, Image*); +}; } // namespace WebCore -#endif +#endif // RenderThemeChromiumMac_h diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumMac.mm b/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumMac.mm index 659a0c6..695f9fa 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumMac.mm +++ b/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumMac.mm @@ -1,7 +1,6 @@ /* - * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. * Copyright (C) 2008, 2009 Google, Inc. - * Copyright (C) 2009 Kenneth Rohde Christiansen * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -19,26 +18,18 @@ * Boston, MA 02110-1301, USA. */ -// FIXME: we still need to figure out if passing a null view to the cell -// drawing routines will work. I expect not, and if that's the case we'll have -// to figure out something else. For now, at least leave the lines commented -// in, but the procurement of the view if 0'd. - #import "config.h" #import "RenderThemeChromiumMac.h" -#import <Carbon/Carbon.h> -#import <Cocoa/Cocoa.h> -#import <math.h> - #import "BitmapImage.h" #import "ChromiumBridge.h" #import "ColorMac.h" #import "CSSStyleSelector.h" #import "CSSValueKeywords.h" +#import "Document.h" #import "Element.h" -#import "FoundationExtras.h" #import "FrameView.h" +#import "Gradient.h" #import "GraphicsContext.h" #import "HTMLInputElement.h" #import "HTMLMediaElement.h" @@ -50,9 +41,14 @@ #import "RenderSlider.h" #import "RenderView.h" #import "SharedBuffer.h" -#import "TimeRanges.h" +#import "UserAgentStyleSheets.h" #import "WebCoreSystemInterface.h" +#import "UserAgentStyleSheets.h" +#import <Carbon/Carbon.h> +#import <Cocoa/Cocoa.h> #import <wtf/RetainPtr.h> +#import <wtf/StdLibExtras.h> +#import <math.h> #ifdef BUILDING_ON_TIGER typedef int NSInteger; @@ -61,6 +57,25 @@ typedef unsigned NSUInteger; using std::min; +// This file (and its associated .h file) is a clone of RenderThemeMac.mm. +// Because the original file is designed to run in-process inside a Cocoa view, +// we must maintain a fork. Please maintain this file by performing parallel +// changes to it. +// +// The only changes from RenderThemeMac should be: +// - The classname change from RenderThemeMac to RenderThemeChromiumMac. +// - The introduction of RTCMFlippedView and FlippedView() and its use as the +// parent view for cell rendering. +// - In platformFocusRingColor(), the use of ChromiumBridge to determine if +// we're in layout test mode. +// - updateActiveState() and its use to update the cells' visual appearance. +// - All the paintMedia*() functions and extraMediaControlsStyleSheet() +// are forked from RenderThemeChromiumSkia instead of RenderThemeMac. +// +// For all other differences, if it was introduced in this file, then the +// maintainer forgot to include it in the list; otherwise it is an update that +// should have been applied to this file but was not. + // The methods in this file are specific to the Mac OS X platform. // FIXME: The platform-independent code in this class should be factored out and merged with RenderThemeSafari. @@ -85,48 +100,66 @@ using std::min; return self; } -- (void)systemColorsDidChange:(NSNotification *)notification +- (void)systemColorsDidChange:(NSNotification *)unusedNotification { - ASSERT([[notification name] isEqualToString:NSSystemColorsDidChangeNotification]); + ASSERT_UNUSED(unusedNotification, [[unusedNotification name] isEqualToString:NSSystemColorsDidChangeNotification]); _theme->platformColorsDidChange(); } @end +@interface RTCMFlippedView : NSView +{} + +- (BOOL)isFlipped; +- (NSText *)currentEditor; + +@end + +@implementation RTCMFlippedView + +- (BOOL)isFlipped { + return [[NSGraphicsContext currentContext] isFlipped]; +} + +- (NSText *)currentEditor { + return nil; +} + +@end + namespace WebCore { using namespace HTMLNames; enum { - TopMargin, - RightMargin, - BottomMargin, - LeftMargin + topMargin, + rightMargin, + bottomMargin, + leftMargin }; enum { - TopPadding, - RightPadding, - BottomPadding, - LeftPadding + topPadding, + rightPadding, + bottomPadding, + leftPadding }; -// In our Mac port, we don't define PLATFORM(MAC) and thus don't pick up the -// |operator NSRect()| on WebCore::IntRect and FloatRect. This substitues for -// that missing conversion operator. -NSRect IntRectToNSRect(const IntRect & rect) +// In Snow Leopard, many cells only check to see if the view they're passed is +// flipped, and if a nil view is passed, neglect to check if the current +// graphics context is flipped. Thus we pass a sham view to them, one whose +// flipped state just reflects the state of the context. +NSView* FlippedView() { - return NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height()); + static NSView* view = [[RTCMFlippedView alloc] init]; + return view; } -NSRect FloatRectToNSRect(const FloatRect & rect) +PassRefPtr<RenderTheme> RenderTheme::themeForPage(Page*) { - return NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height()); -} - -IntRect NSRectToIntRect(const NSRect & rect) -{ - return IntRect(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height); + static RenderTheme* rt = RenderThemeChromiumMac::create().releaseRef(); + return rt; } PassRefPtr<RenderTheme> RenderThemeChromiumMac::create() @@ -134,12 +167,6 @@ PassRefPtr<RenderTheme> RenderThemeChromiumMac::create() return adoptRef(new RenderThemeChromiumMac); } -PassRefPtr<RenderTheme> RenderTheme::themeForPage(Page* page) -{ - static RenderTheme* rt = RenderThemeChromiumMac::create().releaseRef(); - return rt; -} - RenderThemeChromiumMac::RenderThemeChromiumMac() : m_isSliderThumbHorizontalPressed(false) , m_isSliderThumbVerticalPressed(false) @@ -174,6 +201,16 @@ Color RenderThemeChromiumMac::platformActiveListBoxSelectionBackgroundColor() co return Color(static_cast<int>(255.0 * [color redComponent]), static_cast<int>(255.0 * [color greenComponent]), static_cast<int>(255.0 * [color blueComponent])); } +Color RenderThemeChromiumMac::platformActiveListBoxSelectionForegroundColor() const +{ + return Color::white; +} + +Color RenderThemeChromiumMac::platformInactiveListBoxSelectionForegroundColor() const +{ + return Color::black; +} + Color RenderThemeChromiumMac::platformFocusRingColor() const { if (ChromiumBridge::layoutTestMode()) @@ -182,6 +219,11 @@ Color RenderThemeChromiumMac::platformFocusRingColor() const return systemColor(CSSValueWebkitFocusRingColor); } +Color RenderThemeChromiumMac::platformInactiveListBoxSelectionBackgroundColor() const +{ + return platformInactiveSelectionBackgroundColor(); +} + static FontWeight toFontWeight(NSInteger appKitFontWeight) { ASSERT(appKitFontWeight > 0 && appKitFontWeight < 15); @@ -211,51 +253,51 @@ static FontWeight toFontWeight(NSInteger appKitFontWeight) void RenderThemeChromiumMac::systemFont(int cssValueId, FontDescription& fontDescription) const { - static FontDescription systemFont; - static FontDescription smallSystemFont; - static FontDescription menuFont; - static FontDescription labelFont; - static FontDescription miniControlFont; - static FontDescription smallControlFont; - static FontDescription controlFont; + DEFINE_STATIC_LOCAL(FontDescription, systemFont, ()); + DEFINE_STATIC_LOCAL(FontDescription, smallSystemFont, ()); + DEFINE_STATIC_LOCAL(FontDescription, menuFont, ()); + DEFINE_STATIC_LOCAL(FontDescription, labelFont, ()); + DEFINE_STATIC_LOCAL(FontDescription, miniControlFont, ()); + DEFINE_STATIC_LOCAL(FontDescription, smallControlFont, ()); + DEFINE_STATIC_LOCAL(FontDescription, controlFont, ()); FontDescription* cachedDesc; NSFont* font = nil; switch (cssValueId) { - case CSSValueSmallCaption: - cachedDesc = &smallSystemFont; - if (!smallSystemFont.isAbsoluteSize()) - font = [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]; - break; - case CSSValueMenu: - cachedDesc = &menuFont; - if (!menuFont.isAbsoluteSize()) - font = [NSFont menuFontOfSize:[NSFont systemFontSize]]; - break; - case CSSValueStatusBar: - cachedDesc = &labelFont; - if (!labelFont.isAbsoluteSize()) - font = [NSFont labelFontOfSize:[NSFont labelFontSize]]; - break; - case CSSValueWebkitMiniControl: - cachedDesc = &miniControlFont; - if (!miniControlFont.isAbsoluteSize()) - font = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSMiniControlSize]]; - break; - case CSSValueWebkitSmallControl: - cachedDesc = &smallControlFont; - if (!smallControlFont.isAbsoluteSize()) - font = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSSmallControlSize]]; - break; - case CSSValueWebkitControl: - cachedDesc = &controlFont; - if (!controlFont.isAbsoluteSize()) - font = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSRegularControlSize]]; - break; - default: - cachedDesc = &systemFont; - if (!systemFont.isAbsoluteSize()) - font = [NSFont systemFontOfSize:[NSFont systemFontSize]]; + case CSSValueSmallCaption: + cachedDesc = &smallSystemFont; + if (!smallSystemFont.isAbsoluteSize()) + font = [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]; + break; + case CSSValueMenu: + cachedDesc = &menuFont; + if (!menuFont.isAbsoluteSize()) + font = [NSFont menuFontOfSize:[NSFont systemFontSize]]; + break; + case CSSValueStatusBar: + cachedDesc = &labelFont; + if (!labelFont.isAbsoluteSize()) + font = [NSFont labelFontOfSize:[NSFont labelFontSize]]; + break; + case CSSValueWebkitMiniControl: + cachedDesc = &miniControlFont; + if (!miniControlFont.isAbsoluteSize()) + font = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSMiniControlSize]]; + break; + case CSSValueWebkitSmallControl: + cachedDesc = &smallControlFont; + if (!smallControlFont.isAbsoluteSize()) + font = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSSmallControlSize]]; + break; + case CSSValueWebkitControl: + cachedDesc = &controlFont; + if (!controlFont.isAbsoluteSize()) + font = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSRegularControlSize]]; + break; + default: + cachedDesc = &systemFont; + if (!systemFont.isAbsoluteSize()) + font = [NSFont systemFontOfSize:[NSFont systemFontSize]]; } if (font) { @@ -272,7 +314,7 @@ void RenderThemeChromiumMac::systemFont(int cssValueId, FontDescription& fontDes static RGBA32 convertNSColorToColor(NSColor *color) { - NSColor *colorInColorSpace = [color colorUsingColorSpaceName:NSCalibratedRGBColorSpace]; + NSColor *colorInColorSpace = [color colorUsingColorSpaceName:NSDeviceRGBColorSpace]; if (colorInColorSpace) { static const double scaleFactor = nextafter(256.0, 0.0); return makeRGB(static_cast<int>(scaleFactor * [colorInColorSpace redComponent]), @@ -292,7 +334,7 @@ static RGBA32 convertNSColorToColor(NSColor *color) samplesPerPixel:4 hasAlpha:YES isPlanar:NO - colorSpaceName:NSCalibratedRGBColorSpace + colorSpaceName:NSDeviceRGBColorSpace bytesPerRow:4 bitsPerPixel:32]; @@ -319,7 +361,7 @@ static RGBA32 menuBackgroundColor() samplesPerPixel:4 hasAlpha:YES isPlanar:NO - colorSpaceName:NSCalibratedRGBColorSpace + colorSpaceName:NSDeviceRGBColorSpace bytesPerRow:4 bitsPerPixel:32]; @@ -351,101 +393,101 @@ Color RenderThemeChromiumMac::systemColor(int cssValueId) const Color color; switch (cssValueId) { - case CSSValueActiveborder: - color = convertNSColorToColor([NSColor keyboardFocusIndicatorColor]); - break; - case CSSValueActivecaption: - color = convertNSColorToColor([NSColor windowFrameTextColor]); - break; - case CSSValueAppworkspace: - color = convertNSColorToColor([NSColor headerColor]); - break; - case CSSValueBackground: - // Use theme independent default - break; - case CSSValueButtonface: - // We use this value instead of NSColor's controlColor to avoid website incompatibilities. - // We may want to change this to use the NSColor in future. - color = 0xFFC0C0C0; - break; - case CSSValueButtonhighlight: - color = convertNSColorToColor([NSColor controlHighlightColor]); - break; - case CSSValueButtonshadow: - color = convertNSColorToColor([NSColor controlShadowColor]); - break; - case CSSValueButtontext: - color = convertNSColorToColor([NSColor controlTextColor]); - break; - case CSSValueCaptiontext: - color = convertNSColorToColor([NSColor textColor]); - break; - case CSSValueGraytext: - color = convertNSColorToColor([NSColor disabledControlTextColor]); - break; - case CSSValueHighlight: - color = convertNSColorToColor([NSColor selectedTextBackgroundColor]); - break; - case CSSValueHighlighttext: - color = convertNSColorToColor([NSColor selectedTextColor]); - break; - case CSSValueInactiveborder: - color = convertNSColorToColor([NSColor controlBackgroundColor]); - break; - case CSSValueInactivecaption: - color = convertNSColorToColor([NSColor controlBackgroundColor]); - break; - case CSSValueInactivecaptiontext: - color = convertNSColorToColor([NSColor textColor]); - break; - case CSSValueInfobackground: - // There is no corresponding NSColor for this so we use a hard coded value. - color = 0xFFFBFCC5; - break; - case CSSValueInfotext: - color = convertNSColorToColor([NSColor textColor]); - break; - case CSSValueMenu: - color = menuBackgroundColor(); - break; - case CSSValueMenutext: - color = convertNSColorToColor([NSColor selectedMenuItemTextColor]); - break; - case CSSValueScrollbar: - color = convertNSColorToColor([NSColor scrollBarColor]); - break; - case CSSValueText: - color = convertNSColorToColor([NSColor textColor]); - break; - case CSSValueThreeddarkshadow: - color = convertNSColorToColor([NSColor controlDarkShadowColor]); - break; - case CSSValueThreedshadow: - color = convertNSColorToColor([NSColor shadowColor]); - break; - case CSSValueThreedface: - // We use this value instead of NSColor's controlColor to avoid website incompatibilities. - // We may want to change this to use the NSColor in future. - color = 0xFFC0C0C0; - break; - case CSSValueThreedhighlight: - color = convertNSColorToColor([NSColor highlightColor]); - break; - case CSSValueThreedlightshadow: - color = convertNSColorToColor([NSColor controlLightHighlightColor]); - break; - case CSSValueWebkitFocusRingColor: - color = convertNSColorToColor([NSColor keyboardFocusIndicatorColor]); - break; - case CSSValueWindow: - color = convertNSColorToColor([NSColor windowBackgroundColor]); - break; - case CSSValueWindowframe: - color = convertNSColorToColor([NSColor windowFrameColor]); - break; - case CSSValueWindowtext: - color = convertNSColorToColor([NSColor windowFrameTextColor]); - break; + case CSSValueActiveborder: + color = convertNSColorToColor([NSColor keyboardFocusIndicatorColor]); + break; + case CSSValueActivecaption: + color = convertNSColorToColor([NSColor windowFrameTextColor]); + break; + case CSSValueAppworkspace: + color = convertNSColorToColor([NSColor headerColor]); + break; + case CSSValueBackground: + // Use theme independent default + break; + case CSSValueButtonface: + // We use this value instead of NSColor's controlColor to avoid website incompatibilities. + // We may want to change this to use the NSColor in future. + color = 0xFFC0C0C0; + break; + case CSSValueButtonhighlight: + color = convertNSColorToColor([NSColor controlHighlightColor]); + break; + case CSSValueButtonshadow: + color = convertNSColorToColor([NSColor controlShadowColor]); + break; + case CSSValueButtontext: + color = convertNSColorToColor([NSColor controlTextColor]); + break; + case CSSValueCaptiontext: + color = convertNSColorToColor([NSColor textColor]); + break; + case CSSValueGraytext: + color = convertNSColorToColor([NSColor disabledControlTextColor]); + break; + case CSSValueHighlight: + color = convertNSColorToColor([NSColor selectedTextBackgroundColor]); + break; + case CSSValueHighlighttext: + color = convertNSColorToColor([NSColor selectedTextColor]); + break; + case CSSValueInactiveborder: + color = convertNSColorToColor([NSColor controlBackgroundColor]); + break; + case CSSValueInactivecaption: + color = convertNSColorToColor([NSColor controlBackgroundColor]); + break; + case CSSValueInactivecaptiontext: + color = convertNSColorToColor([NSColor textColor]); + break; + case CSSValueInfobackground: + // There is no corresponding NSColor for this so we use a hard coded value. + color = 0xFFFBFCC5; + break; + case CSSValueInfotext: + color = convertNSColorToColor([NSColor textColor]); + break; + case CSSValueMenu: + color = menuBackgroundColor(); + break; + case CSSValueMenutext: + color = convertNSColorToColor([NSColor selectedMenuItemTextColor]); + break; + case CSSValueScrollbar: + color = convertNSColorToColor([NSColor scrollBarColor]); + break; + case CSSValueText: + color = convertNSColorToColor([NSColor textColor]); + break; + case CSSValueThreeddarkshadow: + color = convertNSColorToColor([NSColor controlDarkShadowColor]); + break; + case CSSValueThreedshadow: + color = convertNSColorToColor([NSColor shadowColor]); + break; + case CSSValueThreedface: + // We use this value instead of NSColor's controlColor to avoid website incompatibilities. + // We may want to change this to use the NSColor in future. + color = 0xFFC0C0C0; + break; + case CSSValueThreedhighlight: + color = convertNSColorToColor([NSColor highlightColor]); + break; + case CSSValueThreedlightshadow: + color = convertNSColorToColor([NSColor controlLightHighlightColor]); + break; + case CSSValueWebkitFocusRingColor: + color = convertNSColorToColor([NSColor keyboardFocusIndicatorColor]); + break; + case CSSValueWindow: + color = convertNSColorToColor([NSColor windowBackgroundColor]); + break; + case CSSValueWindowframe: + color = convertNSColorToColor([NSColor windowFrameColor]); + break; + case CSSValueWindowtext: + color = convertNSColorToColor([NSColor windowFrameTextColor]); + break; } if (!color.isValid()) @@ -458,7 +500,7 @@ Color RenderThemeChromiumMac::systemColor(int cssValueId) const } bool RenderThemeChromiumMac::isControlStyled(const RenderStyle* style, const BorderData& border, - const FillLayer& background, const Color& backgroundColor) const + const FillLayer& background, const Color& backgroundColor) const { if (style->appearance() == TextFieldPart || style->appearance() == TextAreaPart || style->appearance() == ListboxPart) return style->border() != border; @@ -473,62 +515,32 @@ bool RenderThemeChromiumMac::isControlStyled(const RenderStyle* style, const Bor return RenderTheme::isControlStyled(style, border, background, backgroundColor); } -// FIXME: Use the code from the old upstream version, before it was converted to the new theme API in r37731. void RenderThemeChromiumMac::adjustRepaintRect(const RenderObject* o, IntRect& r) { - float zoomLevel = o->style()->effectiveZoom(); - - switch (o->style()->appearance()) { - case CheckboxPart: { - // Since we query the prototype cell, we need to update its state to match. - setCheckboxCellState(o, r); - - // We inflate the rect as needed to account for padding included in the cell to accommodate the checkbox - // shadow" and the check. We don't consider this part of the bounds of the control in WebKit. - IntSize size = checkboxSizes()[[checkbox() controlSize]]; - size.setHeight(size.height() * zoomLevel); - size.setWidth(size.width() * zoomLevel); - r = inflateRect(r, size, checkboxMargins(), zoomLevel); - break; + ControlPart part = o->style()->appearance(); + +#if USE(NEW_THEME) + switch (part) { + case CheckboxPart: + case RadioPart: + case PushButtonPart: + case SquareButtonPart: + case DefaultButtonPart: + case ButtonPart: + return RenderTheme::adjustRepaintRect(o, r); + default: + break; } - case RadioPart: { - // Since we query the prototype cell, we need to update its state to match. - setRadioCellState(o, r); +#endif - // We inflate the rect as needed to account for padding included in the cell to accommodate the checkbox - // shadow" and the check. We don't consider this part of the bounds of the control in WebKit. - IntSize size = radioSizes()[[radio() controlSize]]; - size.setHeight(size.height() * zoomLevel); - size.setWidth(size.width() * zoomLevel); - r = inflateRect(r, size, radioMargins(), zoomLevel); - break; - } - case PushButtonPart: - case DefaultButtonPart: - case ButtonPart: { - // Since we query the prototype cell, we need to update its state to match. - setButtonCellState(o, r); - - // We inflate the rect as needed to account for padding included in the cell to accommodate the checkbox - // shadow" and the check. We don't consider this part of the bounds of the control in WebKit. - if ([button() bezelStyle] == NSRoundedBezelStyle) { - IntSize size = buttonSizes()[[button() controlSize]]; - size.setHeight(size.height() * zoomLevel); - size.setWidth(r.width()); - r = inflateRect(r, size, buttonMargins(), zoomLevel); - } - break; - } - case MenulistPart: { + float zoomLevel = o->style()->effectiveZoom(); + + if (part == MenulistPart) { setPopupButtonCellState(o, r); IntSize size = popupButtonSizes()[[popupButton() controlSize]]; size.setHeight(size.height() * zoomLevel); size.setWidth(r.width()); r = inflateRect(r, size, popupButtonMargins(), zoomLevel); - break; - } - default: - break; } } @@ -536,20 +548,42 @@ IntRect RenderThemeChromiumMac::inflateRect(const IntRect& r, const IntSize& siz { // Only do the inflation if the available width/height are too small. Otherwise try to // fit the glow/check space into the available box's width/height. - int widthDelta = r.width() - (size.width() + margins[LeftMargin] * zoomLevel + margins[RightMargin] * zoomLevel); - int heightDelta = r.height() - (size.height() + margins[TopMargin] * zoomLevel + margins[BottomMargin] * zoomLevel); + int widthDelta = r.width() - (size.width() + margins[leftMargin] * zoomLevel + margins[rightMargin] * zoomLevel); + int heightDelta = r.height() - (size.height() + margins[topMargin] * zoomLevel + margins[bottomMargin] * zoomLevel); IntRect result(r); if (widthDelta < 0) { - result.setX(result.x() - margins[LeftMargin] * zoomLevel); + result.setX(result.x() - margins[leftMargin] * zoomLevel); result.setWidth(result.width() - widthDelta); } if (heightDelta < 0) { - result.setY(result.y() - margins[TopMargin] * zoomLevel); + result.setY(result.y() - margins[topMargin] * zoomLevel); result.setHeight(result.height() - heightDelta); } return result; } +FloatRect RenderThemeChromiumMac::convertToPaintingRect(const RenderObject* inputRenderer, const RenderObject* partRenderer, const FloatRect& inputRect, const IntRect& r) const +{ + FloatRect partRect(inputRect); + + // Compute an offset between the part renderer and the input renderer + FloatSize offsetFromInputRenderer; + const RenderObject* renderer = partRenderer; + while (renderer && renderer != inputRenderer) { + RenderObject* containingRenderer = renderer->container(); + offsetFromInputRenderer -= renderer->offsetFromContainer(containingRenderer); + renderer = containingRenderer; + } + // If the input renderer was not a container, something went wrong + ASSERT(renderer == inputRenderer); + // Move the rect into partRenderer's coords + partRect.move(offsetFromInputRenderer); + // Account for the local drawing offset (tx, ty) + partRect.move(r.x(), r.y()); + + return partRect; +} + // Updates the control tint (a.k.a. active state) of |cell| (from |o|). // In the Chromium port, the renderer runs as a background process and controls' // NSCell(s) lack a parent NSView. Therefore controls don't have their tint @@ -609,19 +643,6 @@ void RenderThemeChromiumMac::updatePressedState(NSCell* cell, const RenderObject [cell setHighlighted:pressed]; } -// FIXME: This used to be in the upstream version until it was converted to the new theme API in r37731. -int RenderThemeChromiumMac::baselinePosition(const RenderObject* o) const -{ - if (!o->isBox()) - return 0; - - if (o->style()->appearance() == CheckboxPart || o->style()->appearance() == RadioPart) { - const RenderBox* box = toRenderBox(o); - return box->marginTop() + box->height() - 2 * o->style()->effectiveZoom(); // The baseline is 2px up from the bottom of the checkbox/radio in AppKit. - } - return RenderTheme::baselinePosition(o); -} - bool RenderThemeChromiumMac::controlSupportsTints(const RenderObject* o) const { // An alternate way to implement this would be to get the appropriate cell object @@ -693,7 +714,7 @@ void RenderThemeChromiumMac::setSizeFromFont(RenderStyle* style, const IntSize* style->setHeight(Length(size.height(), Fixed)); } -void RenderThemeChromiumMac::setFontFromControlSize(CSSStyleSelector* selector, RenderStyle* style, NSControlSize controlSize) const +void RenderThemeChromiumMac::setFontFromControlSize(CSSStyleSelector*, RenderStyle* style, NSControlSize controlSize) const { FontDescription fontDescription; fontDescription.setIsAbsoluteSize(true); @@ -721,352 +742,10 @@ NSControlSize RenderThemeChromiumMac::controlSizeForSystemFont(RenderStyle* styl return NSMiniControlSize; } -// FIXME: This used to be in the upstream version until it was converted to the new theme API in r37731. -bool RenderThemeChromiumMac::paintCheckbox(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) -{ - LocalCurrentGraphicsContext localContext(paintInfo.context); - - // Determine the width and height needed for the control and prepare the cell for painting. - setCheckboxCellState(o, r); - - paintInfo.context->save(); - - float zoomLevel = o->style()->effectiveZoom(); - - // We inflate the rect as needed to account for padding included in the cell to accommodate the checkbox - // shadow" and the check. We don't consider this part of the bounds of the control in WebKit. - NSButtonCell* checkbox = this->checkbox(); - IntSize size = checkboxSizes()[[checkbox controlSize]]; - size.setWidth(size.width() * zoomLevel); - size.setHeight(size.height() * zoomLevel); - IntRect inflatedRect = inflateRect(r, size, checkboxMargins(), zoomLevel); - - if (zoomLevel != 1.0f) { - inflatedRect.setWidth(inflatedRect.width() / zoomLevel); - inflatedRect.setHeight(inflatedRect.height() / zoomLevel); - paintInfo.context->translate(inflatedRect.x(), inflatedRect.y()); - paintInfo.context->scale(FloatSize(zoomLevel, zoomLevel)); - paintInfo.context->translate(-inflatedRect.x(), -inflatedRect.y()); - } - - [checkbox drawWithFrame:NSRect(IntRectToNSRect(inflatedRect)) inView:nil]; - [checkbox setControlView:nil]; - - paintInfo.context->restore(); - - return false; -} - -// FIXME: This used to be in the upstream version until it was converted to the new theme API in r37731. -const IntSize* RenderThemeChromiumMac::checkboxSizes() const -{ - static const IntSize sizes[3] = { IntSize(14, 14), IntSize(12, 12), IntSize(10, 10) }; - return sizes; -} - -// FIXME: This used to be in the upstream version until it was converted to the new theme API in r37731. -const int* RenderThemeChromiumMac::checkboxMargins() const -{ - static const int margins[3][4] = - { - { 3, 4, 4, 2 }, - { 4, 3, 3, 3 }, - { 4, 3, 3, 3 }, - }; - return margins[[checkbox() controlSize]]; -} - -// FIXME: This used to be in the upstream version until it was converted to the new theme API in r37731. -void RenderThemeChromiumMac::setCheckboxCellState(const RenderObject* o, const IntRect& r) -{ - NSButtonCell* checkbox = this->checkbox(); - - // Set the control size based off the rectangle we're painting into. - setControlSize(checkbox, checkboxSizes(), r.size(), o->style()->effectiveZoom()); - - // Update the various states we respond to. - updateActiveState(checkbox, o); - updateCheckedState(checkbox, o); - updateEnabledState(checkbox, o); - updatePressedState(checkbox, o); - updateFocusedState(checkbox, o); -} - -// FIXME: This used to be in the upstream version until it was converted to the new theme API in r37731. -void RenderThemeChromiumMac::setCheckboxSize(RenderStyle* style) const -{ - // If the width and height are both specified, then we have nothing to do. - if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto()) - return; - - // Use the font size to determine the intrinsic width of the control. - setSizeFromFont(style, checkboxSizes()); -} - -// FIXME: This used to be in the upstream version until it was converted to the new theme API in r37731. -bool RenderThemeChromiumMac::paintRadio(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) -{ - LocalCurrentGraphicsContext localContext(paintInfo.context); - - // Determine the width and height needed for the control and prepare the cell for painting. - setRadioCellState(o, r); - - paintInfo.context->save(); - - float zoomLevel = o->style()->effectiveZoom(); - - // We inflate the rect as needed to account for padding included in the cell to accommodate the checkbox - // shadow" and the check. We don't consider this part of the bounds of the control in WebKit. - NSButtonCell* radio = this->radio(); - IntSize size = radioSizes()[[radio controlSize]]; - size.setWidth(size.width() * zoomLevel); - size.setHeight(size.height() * zoomLevel); - IntRect inflatedRect = inflateRect(r, size, radioMargins(), zoomLevel); - - if (zoomLevel != 1.0f) { - inflatedRect.setWidth(inflatedRect.width() / zoomLevel); - inflatedRect.setHeight(inflatedRect.height() / zoomLevel); - paintInfo.context->translate(inflatedRect.x(), inflatedRect.y()); - paintInfo.context->scale(FloatSize(zoomLevel, zoomLevel)); - paintInfo.context->translate(-inflatedRect.x(), -inflatedRect.y()); - } - - [radio drawWithFrame:NSRect(IntRectToNSRect(inflatedRect)) inView:nil]; - [radio setControlView:nil]; - - paintInfo.context->restore(); - - return false; -} - -// FIXME: This used to be in the upstream version until it was converted to the new theme API in r37731. -const IntSize* RenderThemeChromiumMac::radioSizes() const -{ - static const IntSize sizes[3] = { IntSize(14, 15), IntSize(12, 13), IntSize(10, 10) }; - return sizes; -} - -// FIXME: This used to be in the upstream version until it was converted to the new theme API in r37731. -const int* RenderThemeChromiumMac::radioMargins() const -{ - static const int margins[3][4] = - { - { 2, 2, 4, 2 }, - { 3, 2, 3, 2 }, - { 1, 0, 2, 0 }, - }; - return margins[[radio() controlSize]]; -} - -// FIXME: This used to be in the upstream version until it was converted to the new theme API in r37731. -void RenderThemeChromiumMac::setRadioCellState(const RenderObject* o, const IntRect& r) -{ - NSButtonCell* radio = this->radio(); - - // Set the control size based off the rectangle we're painting into. - setControlSize(radio, radioSizes(), r.size(), o->style()->effectiveZoom()); - - // Update the various states we respond to. - updateActiveState(radio, o); - updateCheckedState(radio, o); - updateEnabledState(radio, o); - updatePressedState(radio, o); - updateFocusedState(radio, o); -} - -// FIXME: This used to be in the upstream version until it was converted to the new theme API in r37731. -void RenderThemeChromiumMac::setRadioSize(RenderStyle* style) const -{ - // If the width and height are both specified, then we have nothing to do. - if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto()) - return; - - // Use the font size to determine the intrinsic width of the control. - setSizeFromFont(style, radioSizes()); -} - -// FIXME: This used to be in the upstream version until it was converted to the new theme API in r37731. -void RenderThemeChromiumMac::setButtonPaddingFromControlSize(RenderStyle* style, NSControlSize size) const -{ - // Just use 8px. AppKit wants to use 11px for mini buttons, but that padding is just too large - // for real-world Web sites (creating a huge necessary minimum width for buttons whose space is - // by definition constrained, since we select mini only for small cramped environments. - // This also guarantees the HTML4 <button> will match our rendering by default, since we're using a consistent - // padding. - const int padding = 8 * style->effectiveZoom(); - style->setPaddingLeft(Length(padding, Fixed)); - style->setPaddingRight(Length(padding, Fixed)); - style->setPaddingTop(Length(0, Fixed)); - style->setPaddingBottom(Length(0, Fixed)); -} - -// FIXME: This used to be in the upstream version until it was converted to the new theme API in r37731. -void RenderThemeChromiumMac::adjustButtonStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const -{ - // There are three appearance constants for buttons. - // (1) Push-button is the constant for the default Aqua system button. Push buttons will not scale vertically and will not allow - // custom fonts or colors. <input>s use this constant. This button will allow custom colors and font weights/variants but won't - // scale vertically. - // (2) square-button is the constant for the square button. This button will allow custom fonts and colors and will scale vertically. - // (3) Button is the constant that means "pick the best button as appropriate." <button>s use this constant. This button will - // also scale vertically and allow custom fonts and colors. It will attempt to use Aqua if possible and will make this determination - // solely on the rectangle of the control. - - // Determine our control size based off our font. - NSControlSize controlSize = controlSizeForFont(style); - - if (style->appearance() == PushButtonPart) { - // Ditch the border. - style->resetBorder(); - - // Height is locked to auto. - style->setHeight(Length(Auto)); - - // White-space is locked to pre - style->setWhiteSpace(PRE); - - // Set the button's vertical size. - setButtonSize(style); - - // Add in the padding that we'd like to use. - setButtonPaddingFromControlSize(style, controlSize); - - // Our font is locked to the appropriate system font size for the control. To clarify, we first use the CSS-specified font to figure out - // a reasonable control size, but once that control size is determined, we throw that font away and use the appropriate - // system font for the control size instead. - setFontFromControlSize(selector, style, controlSize); - } else { - // Set a min-height so that we can't get smaller than the mini button. - style->setMinHeight(Length(static_cast<int>(15 * style->effectiveZoom()), Fixed)); - - // Reset the top and bottom borders. - style->resetBorderTop(); - style->resetBorderBottom(); - } - - style->setBoxShadow(0); -} - -// FIXME: This used to be in the upstream version until it was converted to the new theme API in r37731. -const IntSize* RenderThemeChromiumMac::buttonSizes() const -{ - static const IntSize sizes[3] = { IntSize(0, 21), IntSize(0, 18), IntSize(0, 15) }; - return sizes; -} - -// FIXME: This used to be in the upstream version until it was converted to the new theme API in r37731. -const int* RenderThemeChromiumMac::buttonMargins() const -{ - static const int margins[3][4] = - { - { 4, 6, 7, 6 }, - { 4, 5, 6, 5 }, - { 0, 1, 1, 1 }, - }; - return margins[[button() controlSize]]; -} - -// FIXME: This used to be in the upstream version until it was converted to the new theme API in r37731. -void RenderThemeChromiumMac::setButtonSize(RenderStyle* style) const -{ - // If the width and height are both specified, then we have nothing to do. - if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto()) - return; - - // Use the font size to determine the intrinsic width of the control. - setSizeFromFont(style, buttonSizes()); -} - -// FIXME: This used to be in the upstream version until it was converted to the new theme API in r37731. -void RenderThemeChromiumMac::setButtonCellState(const RenderObject* o, const IntRect& r) -{ - NSButtonCell* button = this->button(); - - // Set the control size based off the rectangle we're painting into. - if (o->style()->appearance() == SquareButtonPart || - r.height() > buttonSizes()[NSRegularControlSize].height() * o->style()->effectiveZoom()) { - // Use the square button - if ([button bezelStyle] != NSShadowlessSquareBezelStyle) - [button setBezelStyle:NSShadowlessSquareBezelStyle]; - } else if ([button bezelStyle] != NSRoundedBezelStyle) - [button setBezelStyle:NSRoundedBezelStyle]; - - setControlSize(button, buttonSizes(), r.size(), o->style()->effectiveZoom()); - - NSWindow *window = [nil window]; - BOOL isDefaultButton = (isDefault(o) && [window isKeyWindow]); - [button setKeyEquivalent:(isDefaultButton ? @"\r" : @"")]; - - // Update the various states we respond to. - updateActiveState(button, o); - updateCheckedState(button, o); - updateEnabledState(button, o); - updatePressedState(button, o); - updateFocusedState(button, o); -} - -// FIXME: This used to be in the upstream version until it was converted to the new theme API in r37731. -bool RenderThemeChromiumMac::paintButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) -{ - NSButtonCell* button = this->button(); - LocalCurrentGraphicsContext localContext(paintInfo.context); - - // Determine the width and height needed for the control and prepare the cell for painting. - setButtonCellState(o, r); - - paintInfo.context->save(); - - // We inflate the rect as needed to account for padding included in the cell to accommodate the button - // shadow. We don't consider this part of the bounds of the control in WebKit. - float zoomLevel = o->style()->effectiveZoom(); - IntSize size = buttonSizes()[[button controlSize]]; - size.setWidth(r.width()); - size.setHeight(size.height() * zoomLevel); - IntRect inflatedRect = r; - if ([button bezelStyle] == NSRoundedBezelStyle) { - // Center the button within the available space. - if (inflatedRect.height() > size.height()) { - inflatedRect.setY(inflatedRect.y() + (inflatedRect.height() - size.height()) / 2); - inflatedRect.setHeight(size.height()); - } - - // Now inflate it to account for the shadow. - inflatedRect = inflateRect(inflatedRect, size, buttonMargins(), zoomLevel); - - if (zoomLevel != 1.0f) { - inflatedRect.setWidth(inflatedRect.width() / zoomLevel); - inflatedRect.setHeight(inflatedRect.height() / zoomLevel); - paintInfo.context->translate(inflatedRect.x(), inflatedRect.y()); - paintInfo.context->scale(FloatSize(zoomLevel, zoomLevel)); - paintInfo.context->translate(-inflatedRect.x(), -inflatedRect.y()); - } - } - - NSView *view = nil; - NSWindow *window = [view window]; - NSButtonCell *previousDefaultButtonCell = [window defaultButtonCell]; - - if (isDefault(o) && [window isKeyWindow]) { - [window setDefaultButtonCell:button]; - wkAdvanceDefaultButtonPulseAnimation(button); - } else if ([previousDefaultButtonCell isEqual:button]) - [window setDefaultButtonCell:nil]; - - [button drawWithFrame:NSRect(IntRectToNSRect(inflatedRect)) inView:view]; - [button setControlView:nil]; - - if (![previousDefaultButtonCell isEqual:button]) - [window setDefaultButtonCell:previousDefaultButtonCell]; - - paintInfo.context->restore(); - - return false; -} - bool RenderThemeChromiumMac::paintTextField(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) { LocalCurrentGraphicsContext localContext(paintInfo.context); - wkDrawBezeledTextFieldCell(IntRectToNSRect(r), isEnabled(o) && !isReadOnlyControl(o)); + wkDrawBezeledTextFieldCell(r, isEnabled(o) && !isReadOnlyControl(o)); return false; } @@ -1074,7 +753,7 @@ void RenderThemeChromiumMac::adjustTextFieldStyle(CSSStyleSelector*, RenderStyle { } -bool RenderThemeChromiumMac::paintCapsLockIndicator(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeChromiumMac::paintCapsLockIndicator(RenderObject*, const RenderObject::PaintInfo& paintInfo, const IntRect& r) { if (paintInfo.context->paintingDisabled()) return true; @@ -1088,7 +767,7 @@ bool RenderThemeChromiumMac::paintCapsLockIndicator(RenderObject* o, const Rende bool RenderThemeChromiumMac::paintTextArea(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) { LocalCurrentGraphicsContext localContext(paintInfo.context); - wkDrawBezeledTextArea(IntRectToNSRect(r), isEnabled(o) && !isReadOnlyControl(o)); + wkDrawBezeledTextArea(r, isEnabled(o) && !isReadOnlyControl(o)); return false; } @@ -1126,8 +805,6 @@ const int* RenderThemeChromiumMac::popupButtonPadding(NSControlSize size) const bool RenderThemeChromiumMac::paintMenuList(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) { - LocalCurrentGraphicsContext localContext(paintInfo.context); - setPopupButtonCellState(o, r); NSPopUpButtonCell* popupButton = this->popupButton(); @@ -1157,7 +834,7 @@ bool RenderThemeChromiumMac::paintMenuList(RenderObject* o, const RenderObject:: paintInfo.context->translate(-inflatedRect.x(), -inflatedRect.y()); } - [popupButton drawWithFrame:IntRectToNSRect(inflatedRect) inView:nil]; + [popupButton drawWithFrame:inflatedRect inView:FlippedView()]; [popupButton setControlView:nil]; paintInfo.context->restore(); @@ -1165,19 +842,19 @@ bool RenderThemeChromiumMac::paintMenuList(RenderObject* o, const RenderObject:: return false; } -static const float baseFontSize = 11.0f; -static const float baseArrowHeight = 4.0f; -static const float baseArrowWidth = 5.0f; -static const float baseSpaceBetweenArrows = 2.0f; -static const int arrowPaddingLeft = 6; -static const int arrowPaddingRight = 6; -static const int paddingBeforeSeparator = 4; -static const int baseBorderRadius = 5; -static const int styledPopupPaddingLeft = 8; -static const int styledPopupPaddingTop = 1; -static const int styledPopupPaddingBottom = 2; +const float baseFontSize = 11.0f; +const float baseArrowHeight = 4.0f; +const float baseArrowWidth = 5.0f; +const float baseSpaceBetweenArrows = 2.0f; +const int arrowPaddingLeft = 6; +const int arrowPaddingRight = 6; +const int paddingBeforeSeparator = 4; +const int baseBorderRadius = 5; +const int styledPopupPaddingLeft = 8; +const int styledPopupPaddingTop = 1; +const int styledPopupPaddingBottom = 2; -static void TopGradientInterpolate(void* info, const CGFloat* inData, CGFloat* outData) +static void TopGradientInterpolate(void*, const CGFloat* inData, CGFloat* outData) { static float dark[4] = { 1.0f, 1.0f, 1.0f, 0.4f }; static float light[4] = { 1.0f, 1.0f, 1.0f, 0.15f }; @@ -1187,7 +864,7 @@ static void TopGradientInterpolate(void* info, const CGFloat* inData, CGFloat* o outData[i] = (1.0f - a) * dark[i] + a * light[i]; } -static void BottomGradientInterpolate(void* info, const CGFloat* inData, CGFloat* outData) +static void BottomGradientInterpolate(void*, const CGFloat* inData, CGFloat* outData) { static float dark[4] = { 1.0f, 1.0f, 1.0f, 0.0f }; static float light[4] = { 1.0f, 1.0f, 1.0f, 0.3f }; @@ -1197,7 +874,7 @@ static void BottomGradientInterpolate(void* info, const CGFloat* inData, CGFloat outData[i] = (1.0f - a) * dark[i] + a * light[i]; } -static void MainGradientInterpolate(void* info, const CGFloat* inData, CGFloat* outData) +static void MainGradientInterpolate(void*, const CGFloat* inData, CGFloat* outData) { static float dark[4] = { 0.0f, 0.0f, 0.0f, 0.15f }; static float light[4] = { 0.0f, 0.0f, 0.0f, 0.0f }; @@ -1207,7 +884,7 @@ static void MainGradientInterpolate(void* info, const CGFloat* inData, CGFloat* outData[i] = (1.0f - a) * dark[i] + a * light[i]; } -static void TrackGradientInterpolate(void* info, const CGFloat* inData, CGFloat* outData) +static void TrackGradientInterpolate(void*, const CGFloat* inData, CGFloat* outData) { static float dark[4] = { 0.0f, 0.0f, 0.0f, 0.678f }; static float light[4] = { 0.0f, 0.0f, 0.0f, 0.13f }; @@ -1219,11 +896,21 @@ static void TrackGradientInterpolate(void* info, const CGFloat* inData, CGFloat* void RenderThemeChromiumMac::paintMenuListButtonGradients(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) { + if (r.isEmpty()) + return; + CGContextRef context = paintInfo.context->platformContext(); paintInfo.context->save(); - int radius = o->style()->borderTopLeftRadius().width(); + IntSize topLeftRadius; + IntSize topRightRadius; + IntSize bottomLeftRadius; + IntSize bottomRightRadius; + + o->style()->getBorderRadiiForRect(r, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius); + + int radius = topLeftRadius.width(); RetainPtr<CGColorSpaceRef> cspace(AdoptCF, CGColorSpaceCreateDeviceRGB()); @@ -1246,33 +933,27 @@ void RenderThemeChromiumMac::paintMenuListButtonGradients(RenderObject* o, const RetainPtr<CGShadingRef> rightShading(AdoptCF, CGShadingCreateAxial(cspace.get(), CGPointMake(r.right(), r.y()), CGPointMake(r.right() - radius, r.y()), mainFunction.get(), false, false)); paintInfo.context->save(); CGContextClipToRect(context, r); - paintInfo.context->addRoundedRectClip(r, - o->style()->borderTopLeftRadius(), o->style()->borderTopRightRadius(), - o->style()->borderBottomLeftRadius(), o->style()->borderBottomRightRadius()); + paintInfo.context->addRoundedRectClip(r, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius); CGContextDrawShading(context, mainShading.get()); paintInfo.context->restore(); paintInfo.context->save(); CGContextClipToRect(context, topGradient); - paintInfo.context->addRoundedRectClip(enclosingIntRect(topGradient), - o->style()->borderTopLeftRadius(), o->style()->borderTopRightRadius(), - IntSize(), IntSize()); + paintInfo.context->addRoundedRectClip(enclosingIntRect(topGradient), topLeftRadius, topRightRadius, IntSize(), IntSize()); CGContextDrawShading(context, topShading.get()); paintInfo.context->restore(); - paintInfo.context->save(); - CGContextClipToRect(context, bottomGradient); - paintInfo.context->addRoundedRectClip(enclosingIntRect(bottomGradient), - IntSize(), IntSize(), - o->style()->borderBottomLeftRadius(), o->style()->borderBottomRightRadius()); - CGContextDrawShading(context, bottomShading.get()); - paintInfo.context->restore(); + if (!bottomGradient.isEmpty()) { + paintInfo.context->save(); + CGContextClipToRect(context, bottomGradient); + paintInfo.context->addRoundedRectClip(enclosingIntRect(bottomGradient), IntSize(), IntSize(), bottomLeftRadius, bottomRightRadius); + CGContextDrawShading(context, bottomShading.get()); + paintInfo.context->restore(); + } paintInfo.context->save(); CGContextClipToRect(context, r); - paintInfo.context->addRoundedRectClip(r, - o->style()->borderTopLeftRadius(), o->style()->borderTopRightRadius(), - o->style()->borderBottomLeftRadius(), o->style()->borderBottomRightRadius()); + paintInfo.context->addRoundedRectClip(r, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius); CGContextDrawShading(context, leftShading.get()); CGContextDrawShading(context, rightShading.get()); paintInfo.context->restore(); @@ -1282,8 +963,6 @@ void RenderThemeChromiumMac::paintMenuListButtonGradients(RenderObject* o, const bool RenderThemeChromiumMac::paintMenuListButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) { - paintInfo.context->save(); - IntRect bounds = IntRect(r.x() + o->style()->borderLeftWidth(), r.y() + o->style()->borderTopWidth(), r.width() - o->style()->borderLeftWidth() - o->style()->borderRightWidth(), @@ -1302,6 +981,8 @@ bool RenderThemeChromiumMac::paintMenuListButton(RenderObject* o, const RenderOb if (bounds.width() < arrowWidth + arrowPaddingLeft * o->style()->effectiveZoom()) return false; + paintInfo.context->save(); + paintInfo.context->setFillColor(o->style()->color()); paintInfo.context->setStrokeStyle(NoStroke); @@ -1380,7 +1061,7 @@ void RenderThemeChromiumMac::adjustMenuListStyle(CSSStyleSelector* selector, Ren int RenderThemeChromiumMac::popupInternalPaddingLeft(RenderStyle* style) const { if (style->appearance() == MenulistPart) - return popupButtonPadding(controlSizeForFont(style))[LeftPadding] * style->effectiveZoom(); + return popupButtonPadding(controlSizeForFont(style))[leftPadding] * style->effectiveZoom(); if (style->appearance() == MenulistButtonPart) return styledPopupPaddingLeft * style->effectiveZoom(); return 0; @@ -1389,7 +1070,7 @@ int RenderThemeChromiumMac::popupInternalPaddingLeft(RenderStyle* style) const int RenderThemeChromiumMac::popupInternalPaddingRight(RenderStyle* style) const { if (style->appearance() == MenulistPart) - return popupButtonPadding(controlSizeForFont(style))[RightPadding] * style->effectiveZoom(); + return popupButtonPadding(controlSizeForFont(style))[rightPadding] * style->effectiveZoom(); if (style->appearance() == MenulistButtonPart) { float fontScale = style->fontSize() / baseFontSize; float arrowWidth = baseArrowWidth * fontScale; @@ -1401,7 +1082,7 @@ int RenderThemeChromiumMac::popupInternalPaddingRight(RenderStyle* style) const int RenderThemeChromiumMac::popupInternalPaddingTop(RenderStyle* style) const { if (style->appearance() == MenulistPart) - return popupButtonPadding(controlSizeForFont(style))[TopPadding] * style->effectiveZoom(); + return popupButtonPadding(controlSizeForFont(style))[topPadding] * style->effectiveZoom(); if (style->appearance() == MenulistButtonPart) return styledPopupPaddingTop * style->effectiveZoom(); return 0; @@ -1410,13 +1091,13 @@ int RenderThemeChromiumMac::popupInternalPaddingTop(RenderStyle* style) const int RenderThemeChromiumMac::popupInternalPaddingBottom(RenderStyle* style) const { if (style->appearance() == MenulistPart) - return popupButtonPadding(controlSizeForFont(style))[BottomPadding] * style->effectiveZoom(); + return popupButtonPadding(controlSizeForFont(style))[bottomPadding] * style->effectiveZoom(); if (style->appearance() == MenulistButtonPart) return styledPopupPaddingBottom * style->effectiveZoom(); return 0; } -void RenderThemeChromiumMac::adjustMenuListButtonStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const +void RenderThemeChromiumMac::adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle* style, Element*) const { float fontScale = style->fontSize() / baseFontSize; @@ -1455,16 +1136,16 @@ int RenderThemeChromiumMac::minimumMenuListSize(RenderStyle* style) const return sizeForSystemFont(style, menuListSizes()).width(); } -static const int trackWidth = 5; -static const int trackRadius = 2; - -void RenderThemeChromiumMac::adjustSliderTrackStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const +void RenderThemeChromiumMac::adjustSliderTrackStyle(CSSStyleSelector*, RenderStyle* style, Element*) const { style->setBoxShadow(0); } bool RenderThemeChromiumMac::paintSliderTrack(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) { + static const int trackWidth = 5; + static const int trackRadius = 2; + IntRect bounds = r; float zoomLevel = o->style()->effectiveZoom(); float zoomedTrackWidth = trackWidth * zoomLevel; @@ -1502,12 +1183,12 @@ bool RenderThemeChromiumMac::paintSliderTrack(RenderObject* o, const RenderObjec return false; } -void RenderThemeChromiumMac::adjustSliderThumbStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const +void RenderThemeChromiumMac::adjustSliderThumbStyle(CSSStyleSelector*, RenderStyle* style, Element*) const { style->setBoxShadow(0); } -static const float verticalSliderHeightPadding = 0.1f; +const float verticalSliderHeightPadding = 0.1f; bool RenderThemeChromiumMac::paintSliderThumb(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) { @@ -1562,7 +1243,7 @@ bool RenderThemeChromiumMac::paintSliderThumb(RenderObject* o, const RenderObjec paintInfo.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); } - [sliderThumbCell drawWithFrame:FloatRectToNSRect(unzoomedRect) inView:nil]; + [sliderThumbCell drawWithFrame:unzoomedRect inView:FlippedView()]; [sliderThumbCell setControlView:nil]; paintInfo.context->restore(); @@ -1570,21 +1251,43 @@ bool RenderThemeChromiumMac::paintSliderThumb(RenderObject* o, const RenderObjec return false; } -const int sliderThumbWidth = 15; -const int sliderThumbHeight = 15; -const int mediaSliderThumbWidth = 13; -const int mediaSliderThumbHeight = 14; +#if ENABLE(VIDEO) +static Image* mediaSliderThumbImage() +{ + static Image* mediaSliderThumb = Image::loadPlatformResource("mediaSliderThumb").releaseRef(); + return mediaSliderThumb; +} + +static Image* mediaVolumeSliderThumbImage() +{ + static Image* mediaVolumeSliderThumb = Image::loadPlatformResource("mediaVolumeSliderThumb").releaseRef(); + return mediaVolumeSliderThumb; +} +#endif void RenderThemeChromiumMac::adjustSliderThumbSize(RenderObject* o) const { + static const int sliderThumbWidth = 15; + static const int sliderThumbHeight = 15; + float zoomLevel = o->style()->effectiveZoom(); if (o->style()->appearance() == SliderThumbHorizontalPart || o->style()->appearance() == SliderThumbVerticalPart) { o->style()->setWidth(Length(static_cast<int>(sliderThumbWidth * zoomLevel), Fixed)); o->style()->setHeight(Length(static_cast<int>(sliderThumbHeight * zoomLevel), Fixed)); - } else if (o->style()->appearance() == MediaSliderThumbPart) { - o->style()->setWidth(Length(mediaSliderThumbWidth, Fixed)); - o->style()->setHeight(Length(mediaSliderThumbHeight, Fixed)); } + +#if ENABLE(VIDEO) + Image* thumbImage = 0; + if (o->style()->appearance() == MediaSliderThumbPart) + thumbImage = mediaSliderThumbImage(); + else if (o->style()->appearance() == MediaVolumeSliderThumbPart) + thumbImage = mediaVolumeSliderThumbImage(); + + if (thumbImage) { + o->style()->setWidth(Length(thumbImage->width(), Fixed)); + o->style()->setHeight(Length(thumbImage->height(), Fixed)); + } +#endif } bool RenderThemeChromiumMac::paintSearchField(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) @@ -1611,7 +1314,7 @@ bool RenderThemeChromiumMac::paintSearchField(RenderObject* o, const RenderObjec // Set the search button to nil before drawing. Then reset it so we can draw it later. [search setSearchButtonCell:nil]; - [search drawWithFrame:NSRect(IntRectToNSRect(unzoomedRect)) inView:nil]; + [search drawWithFrame:NSRect(unzoomedRect) inView:FlippedView()]; #ifdef BUILDING_ON_TIGER if ([search showsFirstResponder]) wkDrawTextFieldCellFocusRing(search, NSRect(unzoomedRect)); @@ -1625,7 +1328,7 @@ bool RenderThemeChromiumMac::paintSearchField(RenderObject* o, const RenderObjec return false; } -void RenderThemeChromiumMac::setSearchCellState(RenderObject* o, const IntRect& r) +void RenderThemeChromiumMac::setSearchCellState(RenderObject* o, const IntRect&) { NSSearchFieldCell* search = this->search(); @@ -1653,7 +1356,7 @@ void RenderThemeChromiumMac::setSearchFieldSize(RenderStyle* style) const setSizeFromFont(style, searchFieldSizes()); } -void RenderThemeChromiumMac::adjustSearchFieldStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const +void RenderThemeChromiumMac::adjustSearchFieldStyle(CSSStyleSelector* selector, RenderStyle* style, Element*) const { // Override border. style->resetBorder(); @@ -1686,9 +1389,10 @@ void RenderThemeChromiumMac::adjustSearchFieldStyle(CSSStyleSelector* selector, bool RenderThemeChromiumMac::paintSearchFieldCancelButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) { - LocalCurrentGraphicsContext localContext(paintInfo.context); - Node* input = o->node()->shadowAncestorNode(); + if (!input->renderer()->isBox()) + return false; + setSearchCellState(input->renderer(), r); NSSearchFieldCell* search = this->search(); @@ -1700,9 +1404,10 @@ bool RenderThemeChromiumMac::paintSearchFieldCancelButton(RenderObject* o, const float zoomLevel = o->style()->effectiveZoom(); - NSRect bounds = [search cancelButtonRectForBounds:NSRect(IntRectToNSRect(input->renderer()->absoluteBoundingBoxRect()))]; - - IntRect unzoomedRect(NSRectToIntRect(bounds)); + FloatRect localBounds = [search cancelButtonRectForBounds:NSRect(input->renderBox()->borderBoxRect())]; + localBounds = convertToPaintingRect(input->renderer(), o, localBounds, r); + + FloatRect unzoomedRect(localBounds); if (zoomLevel != 1.0f) { unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); @@ -1711,7 +1416,7 @@ bool RenderThemeChromiumMac::paintSearchFieldCancelButton(RenderObject* o, const paintInfo.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); } - [[search cancelButtonCell] drawWithFrame:IntRectToNSRect(unzoomedRect) inView:nil]; + [[search cancelButtonCell] drawWithFrame:unzoomedRect inView:FlippedView()]; [[search cancelButtonCell] setControlView:nil]; paintInfo.context->restore(); @@ -1724,7 +1429,7 @@ const IntSize* RenderThemeChromiumMac::cancelButtonSizes() const return sizes; } -void RenderThemeChromiumMac::adjustSearchFieldCancelButtonStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const +void RenderThemeChromiumMac::adjustSearchFieldCancelButtonStyle(CSSStyleSelector*, RenderStyle* style, Element*) const { IntSize size = sizeForSystemFont(style, cancelButtonSizes()); style->setWidth(Length(size.width(), Fixed)); @@ -1738,8 +1443,8 @@ const IntSize* RenderThemeChromiumMac::resultsButtonSizes() const return sizes; } -static const int emptyResultsOffset = 9; -void RenderThemeChromiumMac::adjustSearchFieldDecorationStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const +const int emptyResultsOffset = 9; +void RenderThemeChromiumMac::adjustSearchFieldDecorationStyle(CSSStyleSelector*, RenderStyle* style, Element*) const { IntSize size = sizeForSystemFont(style, resultsButtonSizes()); style->setWidth(Length(size.width() - emptyResultsOffset, Fixed)); @@ -1747,12 +1452,12 @@ void RenderThemeChromiumMac::adjustSearchFieldDecorationStyle(CSSStyleSelector* style->setBoxShadow(0); } -bool RenderThemeChromiumMac::paintSearchFieldDecoration(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeChromiumMac::paintSearchFieldDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return false; } -void RenderThemeChromiumMac::adjustSearchFieldResultsDecorationStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const +void RenderThemeChromiumMac::adjustSearchFieldResultsDecorationStyle(CSSStyleSelector*, RenderStyle* style, Element*) const { IntSize size = sizeForSystemFont(style, resultsButtonSizes()); style->setWidth(Length(size.width(), Fixed)); @@ -1762,9 +1467,10 @@ void RenderThemeChromiumMac::adjustSearchFieldResultsDecorationStyle(CSSStyleSel bool RenderThemeChromiumMac::paintSearchFieldResultsDecoration(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) { - LocalCurrentGraphicsContext localContext(paintInfo.context); - Node* input = o->node()->shadowAncestorNode(); + if (!input->renderer()->isBox()) + return false; + setSearchCellState(input->renderer(), r); NSSearchFieldCell* search = this->search(); @@ -1774,14 +1480,16 @@ bool RenderThemeChromiumMac::paintSearchFieldResultsDecoration(RenderObject* o, if ([search searchMenuTemplate] != nil) [search setSearchMenuTemplate:nil]; - NSRect bounds = [search searchButtonRectForBounds:NSRect(IntRectToNSRect(input->renderer()->absoluteBoundingBoxRect()))]; - [[search searchButtonCell] drawWithFrame:bounds inView:nil]; + FloatRect localBounds = [search searchButtonRectForBounds:NSRect(input->renderBox()->borderBoxRect())]; + localBounds = convertToPaintingRect(input->renderer(), o, localBounds, r); + + [[search searchButtonCell] drawWithFrame:localBounds inView:FlippedView()]; [[search searchButtonCell] setControlView:nil]; return false; } -static const int resultsArrowWidth = 5; -void RenderThemeChromiumMac::adjustSearchFieldResultsButtonStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const +const int resultsArrowWidth = 5; +void RenderThemeChromiumMac::adjustSearchFieldResultsButtonStyle(CSSStyleSelector*, RenderStyle* style, Element*) const { IntSize size = sizeForSystemFont(style, resultsButtonSizes()); style->setWidth(Length(size.width() + resultsArrowWidth, Fixed)); @@ -1791,9 +1499,10 @@ void RenderThemeChromiumMac::adjustSearchFieldResultsButtonStyle(CSSStyleSelecto bool RenderThemeChromiumMac::paintSearchFieldResultsButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) { - LocalCurrentGraphicsContext localContext(paintInfo.context); - Node* input = o->node()->shadowAncestorNode(); + if (!input->renderer()->isBox()) + return false; + setSearchCellState(input->renderer(), r); NSSearchFieldCell* search = this->search(); @@ -1807,9 +1516,10 @@ bool RenderThemeChromiumMac::paintSearchFieldResultsButton(RenderObject* o, cons float zoomLevel = o->style()->effectiveZoom(); - NSRect bounds = [search searchButtonRectForBounds:NSRect(IntRectToNSRect(input->renderer()->absoluteBoundingBoxRect()))]; + FloatRect localBounds = [search searchButtonRectForBounds:NSRect(input->renderBox()->borderBoxRect())]; + localBounds = convertToPaintingRect(input->renderer(), o, localBounds, r); - IntRect unzoomedRect(NSRectToIntRect(bounds)); + IntRect unzoomedRect(localBounds); if (zoomLevel != 1.0f) { unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); @@ -1818,7 +1528,7 @@ bool RenderThemeChromiumMac::paintSearchFieldResultsButton(RenderObject* o, cons paintInfo.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); } - [[search searchButtonCell] drawWithFrame:IntRectToNSRect(unzoomedRect) inView:nil]; + [[search searchButtonCell] drawWithFrame:unzoomedRect inView:FlippedView()]; [[search searchButtonCell] setControlView:nil]; paintInfo.context->restore(); @@ -1827,178 +1537,182 @@ bool RenderThemeChromiumMac::paintSearchFieldResultsButton(RenderObject* o, cons } #if ENABLE(VIDEO) -// FIXME: This enum is lifted from RenderThemeMac.mm We need to decide which theme to use for the default controls, or decide to avoid wkDrawMediaUIPart and render our own. -typedef enum { - MediaControllerThemeClassic = 1, - MediaControllerThemeQT = 2 -} MediaControllerThemeStyle; - -enum WKMediaControllerThemeState { - MediaUIPartDisabledFlag = 1 << 0, - MediaUIPartPressedFlag = 1 << 1, - MediaUIPartDrawEndCapsFlag = 1 << 3, -}; -#endif - -bool RenderThemeChromiumMac::paintMediaFullscreenButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +// Attempt to retrieve a HTMLMediaElement from a Node. Returns 0 if one cannot be found. +static HTMLMediaElement* mediaElementParent(Node* node) { -#if ENABLE(VIDEO) - Node* node = o->node(); if (!node) - return false; + return 0; + Node* mediaNode = node->shadowAncestorNode(); + if (!mediaNode || (!mediaNode->hasTagName(HTMLNames::videoTag) && !mediaNode->hasTagName(HTMLNames::audioTag))) + return 0; - LocalCurrentGraphicsContext localContext(paintInfo.context); - wkDrawMediaUIPart(MediaFullscreenButton, MediaControllerThemeClassic, paintInfo.context->platformContext(), r, - node->active() ? MediaUIPartPressedFlag : 0); -#endif - return false; + return static_cast<HTMLMediaElement*>(mediaNode); } -bool RenderThemeChromiumMac::paintMediaMuteButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeChromiumMac::paintMediaButtonInternal(GraphicsContext* context, const IntRect& rect, Image* image) { -#if ENABLE(VIDEO) - Node* node = o->node(); - Node* mediaNode = node ? node->shadowAncestorNode() : 0; - if (!mediaNode || (!mediaNode->hasTagName(videoTag) && !mediaNode->hasTagName(audioTag))) - return false; + // Create a destination rectangle for the image that is centered in the drawing rectangle, rounded left, and down. + IntRect imageRect = image->rect(); + imageRect.setY(rect.y() + (rect.height() - image->height() + 1) / 2); + imageRect.setX(rect.x() + (rect.width() - image->width() + 1) / 2); - HTMLMediaElement* mediaElement = static_cast<HTMLMediaElement*>(mediaNode); - if (!mediaElement) - return false; - - LocalCurrentGraphicsContext localContext(paintInfo.context); - wkDrawMediaUIPart(mediaElement->muted() ? MediaUnMuteButton : MediaMuteButton, MediaControllerThemeClassic, paintInfo.context->platformContext(), r, - node->active() ? MediaUIPartPressedFlag : 0); -#endif - return false; + context->drawImage(image, imageRect); + return true; } -bool RenderThemeChromiumMac::paintMediaPlayButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeChromiumMac::paintMediaPlayButton(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) { -#if ENABLE(VIDEO) - Node* node = o->node(); - Node* mediaNode = node ? node->shadowAncestorNode() : 0; - if (!mediaNode || (!mediaNode->hasTagName(videoTag) && !mediaNode->hasTagName(audioTag))) - return false; - - HTMLMediaElement* mediaElement = static_cast<HTMLMediaElement*>(mediaNode); + HTMLMediaElement* mediaElement = mediaElementParent(object->node()); if (!mediaElement) return false; - LocalCurrentGraphicsContext localContext(paintInfo.context); - wkDrawMediaUIPart(mediaElement->canPlay() ? MediaPlayButton : MediaPauseButton, MediaControllerThemeClassic, paintInfo.context->platformContext(), r, - node->active() ? MediaUIPartPressedFlag : 0); -#endif - return false; + static Image* mediaPlay = Image::loadPlatformResource("mediaPlay").releaseRef(); + static Image* mediaPause = Image::loadPlatformResource("mediaPause").releaseRef(); + static Image* mediaPlayDisabled = Image::loadPlatformResource("mediaPlayDisabled").releaseRef(); + + if (mediaElement->networkState() == HTMLMediaElement::NETWORK_NO_SOURCE) + return paintMediaButtonInternal(paintInfo.context, rect, mediaPlayDisabled); + + return paintMediaButtonInternal(paintInfo.context, rect, mediaElement->paused() ? mediaPlay : mediaPause); } -bool RenderThemeChromiumMac::paintMediaSeekBackButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeChromiumMac::paintMediaMuteButton(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) { -#if ENABLE(VIDEO) - Node* node = o->node(); - if (!node) + HTMLMediaElement* mediaElement = mediaElementParent(object->node()); + if (!mediaElement) return false; - LocalCurrentGraphicsContext localContext(paintInfo.context); - wkDrawMediaUIPart(MediaSeekBackButton, MediaControllerThemeClassic, paintInfo.context->platformContext(), r, - node->active() ? MediaUIPartPressedFlag : 0); -#endif - return false; + static Image* soundFull = Image::loadPlatformResource("mediaSoundFull").releaseRef(); + static Image* soundNone = Image::loadPlatformResource("mediaSoundNone").releaseRef(); + static Image* soundDisabled = Image::loadPlatformResource("mediaSoundDisabled").releaseRef(); + + if (mediaElement->networkState() == HTMLMediaElement::NETWORK_NO_SOURCE || !mediaElement->hasAudio()) + return paintMediaButtonInternal(paintInfo.context, rect, soundDisabled); + + return paintMediaButtonInternal(paintInfo.context, rect, mediaElement->muted() ? soundNone : soundFull); } -bool RenderThemeChromiumMac::paintMediaSeekForwardButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeChromiumMac::paintMediaSliderTrack(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) { -#if ENABLE(VIDEO) - Node* node = o->node(); - if (!node) + HTMLMediaElement* mediaElement = mediaElementParent(object->node()); + if (!mediaElement) return false; - LocalCurrentGraphicsContext localContext(paintInfo.context); - wkDrawMediaUIPart(MediaSeekForwardButton, MediaControllerThemeClassic, paintInfo.context->platformContext(), r, - node->active() ? MediaUIPartPressedFlag : 0); -#endif - return false; + RenderStyle* style = object->style(); + GraphicsContext* context = paintInfo.context; + context->save(); + + context->setShouldAntialias(true); + + IntSize topLeftRadius = style->borderTopLeftRadius(); + IntSize topRightRadius = style->borderTopRightRadius(); + IntSize bottomLeftRadius = style->borderBottomLeftRadius(); + IntSize bottomRightRadius = style->borderBottomRightRadius(); + float borderWidth = style->borderLeftWidth(); + + // Draw the border of the time bar. + context->setStrokeColor(style->borderLeftColor()); + context->setStrokeThickness(borderWidth); + context->setFillColor(style->backgroundColor()); + context->addPath(Path::createRoundedRectangle(rect, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius)); + context->drawPath(); + + // Draw the buffered ranges. + // FIXME: Draw multiple ranges if there are multiple buffered ranges. + FloatRect bufferedRect = rect; + bufferedRect.inflate(-1.0 - borderWidth); + bufferedRect.setWidth(bufferedRect.width() * mediaElement->percentLoaded()); + bufferedRect = context->roundToDevicePixels(bufferedRect); + + // Don't bother drawing an empty area. + if (bufferedRect.width() > 0 && bufferedRect.height() > 0) { + FloatPoint sliderTopLeft = bufferedRect.location(); + FloatPoint sliderTopRight = sliderTopLeft; + sliderTopRight.move(0.0f, bufferedRect.height()); + + RefPtr<Gradient> gradient = Gradient::create(sliderTopLeft, sliderTopRight); + Color startColor = object->style()->color(); + gradient->addColorStop(0.0, startColor); + gradient->addColorStop(1.0, Color(startColor.red() / 2, startColor.green() / 2, startColor.blue() / 2, startColor.alpha())); + + context->setFillGradient(gradient); + context->addPath(Path::createRoundedRectangle(bufferedRect, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius)); + context->fillPath(); + } + + context->restore(); + return true; } -bool RenderThemeChromiumMac::paintMediaSliderTrack(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeChromiumMac::paintMediaVolumeSliderTrack(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) { -#if ENABLE(VIDEO) - Node* node = o->node(); - Node* mediaNode = node ? node->shadowAncestorNode() : 0; - if (!mediaNode || (!mediaNode->hasTagName(videoTag) && !mediaNode->hasTagName(audioTag))) - return false; - - HTMLMediaElement* mediaElement = static_cast<HTMLMediaElement*>(mediaNode); + HTMLMediaElement* mediaElement = mediaElementParent(object->node()); if (!mediaElement) return false; - RefPtr<TimeRanges> timeRanges = mediaElement->buffered(); - ExceptionCode ignoredException; - float timeLoaded = timeRanges->length() ? timeRanges->end(0, ignoredException) : 0; - float currentTime = mediaElement->currentTime(); - float duration = mediaElement->duration(); - if (isnan(duration)) - duration = 0; + GraphicsContext* context = paintInfo.context; + Color originalColor = context->strokeColor(); + if (originalColor != Color::white) + context->setStrokeColor(Color::white); - bool shouldDrawEndCaps = !toRenderMedia(mediaElement->renderer())->shouldShowTimeDisplayControls(); - wkDrawMediaSliderTrack(MediaControllerThemeClassic, paintInfo.context->platformContext(), r, timeLoaded, currentTime, duration, shouldDrawEndCaps ? MediaUIPartDrawEndCapsFlag : 0); -#endif - return false; + int x = rect.x() + rect.width() / 2; + context->drawLine(IntPoint(x, rect.y()), IntPoint(x, rect.y() + rect.height())); + + if (originalColor != Color::white) + context->setStrokeColor(originalColor); + return true; } -bool RenderThemeChromiumMac::paintMediaSliderThumb(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeChromiumMac::paintMediaSliderThumb(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) { -#if ENABLE(VIDEO) - Node* node = o->node(); - if (!node) + if (!object->parent()->isSlider()) return false; - LocalCurrentGraphicsContext localContext(paintInfo.context); - wkDrawMediaUIPart(MediaSliderThumb, MediaControllerThemeClassic, paintInfo.context->platformContext(), r, - node->active() ? MediaUIPartPressedFlag : 0); -#endif - return false; + return paintMediaButtonInternal(paintInfo.context, rect, mediaSliderThumbImage()); } -// FIXME: This used to be in the upstream version until it was converted to the new theme API in r37731. -NSButtonCell* RenderThemeChromiumMac::checkbox() const +bool RenderThemeChromiumMac::paintMediaVolumeSliderThumb(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) { - if (!m_checkbox) { - m_checkbox.adoptNS([[NSButtonCell alloc] init]); - [m_checkbox.get() setButtonType:NSSwitchButton]; - [m_checkbox.get() setTitle:nil]; - [m_checkbox.get() setAllowsMixedState:YES]; - [m_checkbox.get() setFocusRingType:NSFocusRingTypeExterior]; - } - - return m_checkbox.get(); -} + if (!object->parent()->isSlider()) + return false; -// FIXME: This used to be in the upstream version until it was converted to the new theme API in r37731. -NSButtonCell* RenderThemeChromiumMac::radio() const -{ - if (!m_radio) { - m_radio.adoptNS([[NSButtonCell alloc] init]); - [m_radio.get() setButtonType:NSRadioButton]; - [m_radio.get() setTitle:nil]; - [m_radio.get() setFocusRingType:NSFocusRingTypeExterior]; - } - - return m_radio.get(); + return paintMediaButtonInternal(paintInfo.context, rect, mediaVolumeSliderThumbImage()); } -// FIXME: This used to be in the upstream version until it was converted to the new theme API in r37731. -NSButtonCell* RenderThemeChromiumMac::button() const +bool RenderThemeChromiumMac::paintMediaControlsBackground(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) { - if (!m_button) { - m_button.adoptNS([[NSButtonCell alloc] init]); - [m_button.get() setTitle:nil]; - [m_button.get() setButtonType:NSMomentaryPushInButton]; + HTMLMediaElement* mediaElement = mediaElementParent(object->node()); + if (!mediaElement) + return false; + + if (!rect.isEmpty()) + { + GraphicsContext* context = paintInfo.context; + Color originalColor = context->strokeColor(); + + // Draws the left border, it is always 1px wide. + context->setStrokeColor(object->style()->borderLeftColor()); + context->drawLine(IntPoint(rect.x() + 1, rect.y()), + IntPoint(rect.x() + 1, rect.y() + rect.height())); + + + // Draws the right border, it is always 1px wide. + context->setStrokeColor(object->style()->borderRightColor()); + context->drawLine(IntPoint(rect.x() + rect.width() - 1, rect.y()), + IntPoint(rect.x() + rect.width() - 1, rect.y() + rect.height())); + + context->setStrokeColor(originalColor); } + return true; +} - return m_button.get(); +String RenderThemeChromiumMac::extraMediaControlsStyleSheet() +{ + return String(mediaControlsChromiumUserAgentStyleSheet, sizeof(mediaControlsChromiumUserAgentStyleSheet)); } +#endif + NSPopUpButtonCell* RenderThemeChromiumMac::popupButton() const { if (!m_popupButton) { diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumSkia.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumSkia.cpp index e25eed3..82e633b 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumSkia.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumSkia.cpp @@ -640,9 +640,10 @@ void RenderThemeChromiumSkia::adjustSliderThumbSize(RenderObject* object) const else if (object->style()->appearance() == MediaVolumeSliderThumbPart) thumbImage = mediaVolumeSliderThumbImage(); - ASSERT(thumbImage); - object->style()->setWidth(Length(thumbImage->width(), Fixed)); - object->style()->setHeight(Length(thumbImage->height(), Fixed)); + if (thumbImage) { + object->style()->setWidth(Length(thumbImage->width(), Fixed)); + object->style()->setHeight(Length(thumbImage->height(), Fixed)); + } #else UNUSED_PARAM(object); #endif diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumWin.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumWin.cpp index 169bd02..20503f3 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumWin.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumWin.cpp @@ -311,6 +311,52 @@ void RenderThemeChromiumWin::systemFont(int propId, FontDescription& fontDescrip fontDescription = *cachedDesc; } +// Map a CSSValue* system color to an index understood by GetSysColor(). +static int cssValueIdToSysColorIndex(int cssValueId) +{ + switch (cssValueId) { + case CSSValueActiveborder: return COLOR_ACTIVEBORDER; + case CSSValueActivecaption: return COLOR_ACTIVECAPTION; + case CSSValueAppworkspace: return COLOR_APPWORKSPACE; + case CSSValueBackground: return COLOR_BACKGROUND; + case CSSValueButtonface: return COLOR_BTNFACE; + case CSSValueButtonhighlight: return COLOR_BTNHIGHLIGHT; + case CSSValueButtonshadow: return COLOR_BTNSHADOW; + case CSSValueButtontext: return COLOR_BTNTEXT; + case CSSValueCaptiontext: return COLOR_CAPTIONTEXT; + case CSSValueGraytext: return COLOR_GRAYTEXT; + case CSSValueHighlight: return COLOR_HIGHLIGHT; + case CSSValueHighlighttext: return COLOR_HIGHLIGHTTEXT; + case CSSValueInactiveborder: return COLOR_INACTIVEBORDER; + case CSSValueInactivecaption: return COLOR_INACTIVECAPTION; + case CSSValueInactivecaptiontext: return COLOR_INACTIVECAPTIONTEXT; + case CSSValueInfobackground: return COLOR_INFOBK; + case CSSValueInfotext: return COLOR_INFOTEXT; + case CSSValueMenu: return COLOR_MENU; + case CSSValueMenutext: return COLOR_MENUTEXT; + case CSSValueScrollbar: return COLOR_SCROLLBAR; + case CSSValueThreeddarkshadow: return COLOR_3DDKSHADOW; + case CSSValueThreedface: return COLOR_3DFACE; + case CSSValueThreedhighlight: return COLOR_3DHIGHLIGHT; + case CSSValueThreedlightshadow: return COLOR_3DLIGHT; + case CSSValueThreedshadow: return COLOR_3DSHADOW; + case CSSValueWindow: return COLOR_WINDOW; + case CSSValueWindowframe: return COLOR_WINDOWFRAME; + case CSSValueWindowtext: return COLOR_WINDOWTEXT; + default: return -1; // Unsupported CSSValue + } +} + +Color RenderThemeChromiumWin::systemColor(int cssValueId) const +{ + int sysColorIndex = cssValueIdToSysColorIndex(cssValueId); + if (ChromiumBridge::layoutTestMode() || (sysColorIndex == -1)) + return RenderTheme::systemColor(cssValueId); + + COLORREF color = GetSysColor(sysColorIndex); + return Color(GetRValue(color), GetGValue(color), GetBValue(color)); +} + void RenderThemeChromiumWin::adjustSliderThumbSize(RenderObject* o) const { // These sizes match what WinXP draws for various menus. diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumWin.h b/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumWin.h index 5e98c9b..bbc54a7 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumWin.h +++ b/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumWin.h @@ -59,6 +59,7 @@ namespace WebCore { // System fonts. virtual void systemFont(int propId, FontDescription&) const; + virtual Color systemColor(int cssValueId) const; virtual void adjustSliderThumbSize(RenderObject*) const; diff --git a/src/3rdparty/webkit/WebCore/rendering/style/RenderStyle.h b/src/3rdparty/webkit/WebCore/rendering/style/RenderStyle.h index 1a216fe..be5d1cf 100644 --- a/src/3rdparty/webkit/WebCore/rendering/style/RenderStyle.h +++ b/src/3rdparty/webkit/WebCore/rendering/style/RenderStyle.h @@ -87,7 +87,11 @@ #include "BindingURI.h" #endif +#ifdef __WINS__ +#define compareEqual(t, u) ((t) == (u)) +#else template<typename T, typename U> inline bool compareEqual(const T& t, const U& u) { return t == static_cast<T>(u); } +#endif #define SET_VAR(group, variable, value) \ if (!compareEqual(group->variable, value)) \ @@ -434,7 +438,6 @@ public: const Font& font() const { return inherited->font; } const FontDescription& fontDescription() const { return inherited->font.fontDescription(); } int fontSize() const { return inherited->font.pixelSize(); } - FontSmoothing fontSmoothing() const { return inherited->font.fontDescription().fontSmoothing(); } const Color& color() const { return inherited->color; } Length textIndent() const { return inherited->indent; } diff --git a/src/3rdparty/webkit/WebCore/rendering/style/RenderStyleConstants.h b/src/3rdparty/webkit/WebCore/rendering/style/RenderStyleConstants.h index 6a7277d..a47defb 100644 --- a/src/3rdparty/webkit/WebCore/rendering/style/RenderStyleConstants.h +++ b/src/3rdparty/webkit/WebCore/rendering/style/RenderStyleConstants.h @@ -321,10 +321,6 @@ enum EBackfaceVisibility { BackfaceVisibilityVisible, BackfaceVisibilityHidden }; -enum FontSmoothing { - AutoSmoothing, NoSmoothing, Antialiased, SubpixelAntialiased -}; - } // namespace WebCore #endif // RenderStyleConstants_h diff --git a/src/3rdparty/webkit/WebCore/storage/SQLTransaction.cpp b/src/3rdparty/webkit/WebCore/storage/SQLTransaction.cpp index 28940a7..dabbac2 100644 --- a/src/3rdparty/webkit/WebCore/storage/SQLTransaction.cpp +++ b/src/3rdparty/webkit/WebCore/storage/SQLTransaction.cpp @@ -207,7 +207,7 @@ void SQLTransaction::performPendingCallback() void SQLTransaction::acquireLock() { - m_database->transactionCoordinator()->acquireLock(this, m_readOnly); + m_database->transactionCoordinator()->acquireLock(this); } void SQLTransaction::lockAcquired() @@ -236,7 +236,7 @@ void SQLTransaction::openTransactionAndPreflight() m_database->m_sqliteDatabase.setMaximumSize(m_database->maximumSize()); ASSERT(!m_sqliteTransaction); - m_sqliteTransaction.set(new SQLiteTransaction(m_database->m_sqliteDatabase)); + m_sqliteTransaction.set(new SQLiteTransaction(m_database->m_sqliteDatabase, m_readOnly)); m_database->m_databaseAuthorizer->disable(); m_sqliteTransaction->begin(); diff --git a/src/3rdparty/webkit/WebCore/storage/SQLTransaction.h b/src/3rdparty/webkit/WebCore/storage/SQLTransaction.h index 0586cc5..6d6a8d7 100644 --- a/src/3rdparty/webkit/WebCore/storage/SQLTransaction.h +++ b/src/3rdparty/webkit/WebCore/storage/SQLTransaction.h @@ -79,6 +79,7 @@ public: void performPendingCallback(); Database* database() { return m_database.get(); } + bool isReadOnly() { return m_readOnly; } private: SQLTransaction(Database*, PassRefPtr<SQLTransactionCallback>, PassRefPtr<SQLTransactionErrorCallback>, diff --git a/src/3rdparty/webkit/WebCore/storage/SQLTransactionCoordinator.cpp b/src/3rdparty/webkit/WebCore/storage/SQLTransactionCoordinator.cpp index a42734f..30b0c4a 100644 --- a/src/3rdparty/webkit/WebCore/storage/SQLTransactionCoordinator.cpp +++ b/src/3rdparty/webkit/WebCore/storage/SQLTransactionCoordinator.cpp @@ -36,8 +36,8 @@ #include "SQLTransaction.h" #include <wtf/Deque.h> #include <wtf/HashMap.h> +#include <wtf/HashSet.h> #include <wtf/RefPtr.h> -#include <wtf/UnusedParam.h> namespace WebCore { @@ -48,58 +48,67 @@ static String getDatabaseIdentifier(SQLTransaction* transaction) return database->stringIdentifier(); } -void SQLTransactionCoordinator::acquireLock(SQLTransaction* transaction, bool readOnly) +void SQLTransactionCoordinator::processPendingTransactions(CoordinationInfo& info) { - UNUSED_PARAM(readOnly); + if (info.activeWriteTransaction || info.pendingTransactions.isEmpty()) + return; + RefPtr<SQLTransaction> firstPendingTransaction = info.pendingTransactions.first(); + if (firstPendingTransaction->isReadOnly()) { + do { + firstPendingTransaction = info.pendingTransactions.first(); + info.pendingTransactions.removeFirst(); + info.activeReadTransactions.add(firstPendingTransaction); + firstPendingTransaction->lockAcquired(); + } while (!info.pendingTransactions.isEmpty() && info.pendingTransactions.first()->isReadOnly()); + } else if (info.activeReadTransactions.isEmpty()) { + info.pendingTransactions.removeFirst(); + info.activeWriteTransaction = firstPendingTransaction; + firstPendingTransaction->lockAcquired(); + } +} + +void SQLTransactionCoordinator::acquireLock(SQLTransaction* transaction) +{ String dbIdentifier = getDatabaseIdentifier(transaction); - TransactionsHashMap::iterator it = m_pendingTransactions.find(dbIdentifier); - if (it == m_pendingTransactions.end()) { + CoordinationInfoMap::iterator coordinationInfoIterator = m_coordinationInfoMap.find(dbIdentifier); + if (coordinationInfoIterator == m_coordinationInfoMap.end()) { // No pending transactions for this DB - TransactionsQueue pendingTransactions; - pendingTransactions.append(transaction); - m_pendingTransactions.add(dbIdentifier, pendingTransactions); - - // Start the transaction - transaction->lockAcquired(); - } else { - // Another transaction is running on this DB; put this one in the queue - TransactionsQueue& pendingTransactions = it->second; - pendingTransactions.append(transaction); + coordinationInfoIterator = m_coordinationInfoMap.add(dbIdentifier, CoordinationInfo()).first; } + + CoordinationInfo& info = coordinationInfoIterator->second; + info.pendingTransactions.append(transaction); + processPendingTransactions(info); } void SQLTransactionCoordinator::releaseLock(SQLTransaction* transaction) { - if (m_pendingTransactions.isEmpty()) + if (m_coordinationInfoMap.isEmpty()) return; String dbIdentifier = getDatabaseIdentifier(transaction); - TransactionsHashMap::iterator it = m_pendingTransactions.find(dbIdentifier); - ASSERT(it != m_pendingTransactions.end()); - TransactionsQueue& pendingTransactions = it->second; - ASSERT(!pendingTransactions.isEmpty()); + CoordinationInfoMap::iterator coordinationInfoIterator = m_coordinationInfoMap.find(dbIdentifier); + ASSERT(coordinationInfoIterator != m_coordinationInfoMap.end()); + CoordinationInfo& info = coordinationInfoIterator->second; - // 'transaction' should always be the first transaction in this queue - ASSERT(pendingTransactions.first().get() == transaction); - - // Remove 'transaction' from the queue of pending transactions - pendingTransactions.removeFirst(); - if (pendingTransactions.isEmpty()) { - // No more pending transactions; delete dbIdentifier's queue - m_pendingTransactions.remove(it); + if (transaction->isReadOnly()) { + ASSERT(info.activeReadTransactions.contains(transaction)); + info.activeReadTransactions.remove(transaction); } else { - // We have more pending transactions; start the next one - pendingTransactions.first()->lockAcquired(); + ASSERT(info.activeWriteTransaction == transaction); + info.activeWriteTransaction = 0; } + + processPendingTransactions(info); } void SQLTransactionCoordinator::shutdown() { // Clean up all pending transactions for all databases - m_pendingTransactions.clear(); + m_coordinationInfoMap.clear(); } } diff --git a/src/3rdparty/webkit/WebCore/storage/SQLTransactionCoordinator.h b/src/3rdparty/webkit/WebCore/storage/SQLTransactionCoordinator.h index 08985cf..20cc863 100644 --- a/src/3rdparty/webkit/WebCore/storage/SQLTransactionCoordinator.h +++ b/src/3rdparty/webkit/WebCore/storage/SQLTransactionCoordinator.h @@ -35,6 +35,7 @@ #include "StringHash.h" #include <wtf/Deque.h> #include <wtf/HashMap.h> +#include <wtf/HashSet.h> #include <wtf/RefPtr.h> namespace WebCore { @@ -43,13 +44,21 @@ namespace WebCore { class SQLTransactionCoordinator { public: - void acquireLock(SQLTransaction*, bool readOnly); + void acquireLock(SQLTransaction*); void releaseLock(SQLTransaction*); void shutdown(); private: typedef Deque<RefPtr<SQLTransaction> > TransactionsQueue; - typedef HashMap<String, TransactionsQueue> TransactionsHashMap; - TransactionsHashMap m_pendingTransactions; + struct CoordinationInfo { + TransactionsQueue pendingTransactions; + HashSet<RefPtr<SQLTransaction> > activeReadTransactions; + RefPtr<SQLTransaction> activeWriteTransaction; + }; + // Maps database names to information about pending transactions + typedef HashMap<String, CoordinationInfo> CoordinationInfoMap; + CoordinationInfoMap m_coordinationInfoMap; + + void processPendingTransactions(CoordinationInfo& info); }; } diff --git a/src/3rdparty/webkit/WebCore/svg/SVGElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGElement.cpp index 5c5d609..2169dd6 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGElement.cpp @@ -190,18 +190,17 @@ bool SVGElement::haveLoadedRequiredResources() return true; } -static bool hasLoadListener(SVGElement* node) +static bool hasLoadListener(Node* node) { - Node* currentNode = node; - while (currentNode && currentNode->isElementNode()) { - const RegisteredEventListenerVector& listeners = static_cast<Element*>(currentNode)->eventListeners(); - size_t size = listeners.size(); - for (size_t i = 0; i < size; ++i) { - const RegisteredEventListener& r = *listeners[i]; - if (r.eventType() == eventNames().loadEvent && r.useCapture() || currentNode == node) + if (node->hasEventListeners(eventNames().loadEvent)) + return true; + + for (node = node->parentNode(); node && node->isElementNode(); node = node->parentNode()) { + const EventListenerVector& entry = node->getEventListeners(eventNames().loadEvent); + for (size_t i = 0; i < entry.size(); ++i) { + if (entry[i].useCapture) return true; } - currentNode = currentNode->parentNode(); } return false; @@ -219,7 +218,7 @@ void SVGElement::sendSVGLoadEventIfPossible(bool sendParentLoadEvents) event->setTarget(currentTarget); currentTarget->dispatchGenericEvent(event.release()); } - currentTarget = (parent && parent->isSVGElement()) ? static_pointer_cast<SVGElement>(parent) : 0; + currentTarget = (parent && parent->isSVGElement()) ? static_pointer_cast<SVGElement>(parent) : RefPtr<SVGElement> (0); } } diff --git a/src/3rdparty/webkit/WebCore/svg/SVGElementInstance.cpp b/src/3rdparty/webkit/WebCore/svg/SVGElementInstance.cpp index 3a82067..46e8221 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGElementInstance.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGElementInstance.cpp @@ -43,6 +43,13 @@ namespace WebCore { static WTF::RefCountedLeakCounter instanceCounter("WebCoreSVGElementInstance"); #endif +static EventTargetData& dummyEventTargetData() +{ + DEFINE_STATIC_LOCAL(EventTargetData, dummyEventTargetData, ()); + dummyEventTargetData.eventListenerMap.clear(); + return dummyEventTargetData; +} + SVGElementInstance::SVGElementInstance(SVGUseElement* useElement, PassRefPtr<SVGElement> originalElement) : m_needsUpdate(false) , m_useElement(useElement) @@ -137,438 +144,52 @@ ScriptExecutionContext* SVGElementInstance::scriptExecutionContext() const return 0; } -void SVGElementInstance::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture) -{ - if (SVGElement* element = correspondingElement()) - element->addEventListener(eventType, listener, useCapture); -} - -void SVGElementInstance::removeEventListener(const AtomicString& eventType, EventListener* listener, bool useCapture) -{ - if (SVGElement* element = correspondingElement()) - element->removeEventListener(eventType, listener, useCapture); -} - -bool SVGElementInstance::dispatchEvent(PassRefPtr<Event> e, ExceptionCode& ec) +bool SVGElementInstance::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture) { - RefPtr<Event> evt(e); - ASSERT(!eventDispatchForbidden()); - if (!evt || evt->type().isEmpty()) { - ec = EventException::UNSPECIFIED_EVENT_TYPE_ERR; - return false; - } - - // The event has to be dispatched to the shadowTreeElement(), not the correspondingElement()! - SVGElement* element = shadowTreeElement(); - if (!element) + if (!correspondingElement()) return false; - - evt->setTarget(this); - - RefPtr<FrameView> view = element->document()->view(); - return element->dispatchGenericEvent(evt.release()); -} - -EventListener* SVGElementInstance::onabort() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().abortEvent); -} - -void SVGElementInstance::setOnabort(PassRefPtr<EventListener> eventListener) -{ - correspondingElement()->setAttributeEventListener(eventNames().abortEvent, eventListener); -} - -EventListener* SVGElementInstance::onblur() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().blurEvent); -} - -void SVGElementInstance::setOnblur(PassRefPtr<EventListener> eventListener) -{ - correspondingElement()->setAttributeEventListener(eventNames().blurEvent, eventListener); -} - -EventListener* SVGElementInstance::onchange() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().changeEvent); -} - -void SVGElementInstance::setOnchange(PassRefPtr<EventListener> eventListener) -{ - correspondingElement()->setAttributeEventListener(eventNames().changeEvent, eventListener); -} - -EventListener* SVGElementInstance::onclick() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().clickEvent); -} - -void SVGElementInstance::setOnclick(PassRefPtr<EventListener> eventListener) -{ - correspondingElement()->setAttributeEventListener(eventNames().clickEvent, eventListener); -} - -EventListener* SVGElementInstance::oncontextmenu() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().contextmenuEvent); -} - -void SVGElementInstance::setOncontextmenu(PassRefPtr<EventListener> eventListener) -{ - correspondingElement()->setAttributeEventListener(eventNames().contextmenuEvent, eventListener); -} - -EventListener* SVGElementInstance::ondblclick() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().dblclickEvent); -} - -void SVGElementInstance::setOndblclick(PassRefPtr<EventListener> eventListener) -{ - correspondingElement()->setAttributeEventListener(eventNames().dblclickEvent, eventListener); -} - -EventListener* SVGElementInstance::onerror() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().errorEvent); -} - -void SVGElementInstance::setOnerror(PassRefPtr<EventListener> eventListener) -{ - correspondingElement()->setAttributeEventListener(eventNames().errorEvent, eventListener); -} - -EventListener* SVGElementInstance::onfocus() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().focusEvent); -} - -void SVGElementInstance::setOnfocus(PassRefPtr<EventListener> eventListener) -{ - correspondingElement()->setAttributeEventListener(eventNames().focusEvent, eventListener); -} - -EventListener* SVGElementInstance::oninput() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().inputEvent); -} - -void SVGElementInstance::setOninput(PassRefPtr<EventListener> eventListener) -{ - correspondingElement()->setAttributeEventListener(eventNames().inputEvent, eventListener); -} - -EventListener* SVGElementInstance::onkeydown() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().keydownEvent); -} - -void SVGElementInstance::setOnkeydown(PassRefPtr<EventListener> eventListener) -{ - correspondingElement()->setAttributeEventListener(eventNames().keydownEvent, eventListener); -} - -EventListener* SVGElementInstance::onkeypress() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().keypressEvent); -} - -void SVGElementInstance::setOnkeypress(PassRefPtr<EventListener> eventListener) -{ - correspondingElement()->setAttributeEventListener(eventNames().keypressEvent, eventListener); -} - -EventListener* SVGElementInstance::onkeyup() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().keyupEvent); -} - -void SVGElementInstance::setOnkeyup(PassRefPtr<EventListener> eventListener) -{ - correspondingElement()->setAttributeEventListener(eventNames().keyupEvent, eventListener); -} - -EventListener* SVGElementInstance::onload() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().loadEvent); + return correspondingElement()->addEventListener(eventType, listener, useCapture); } -void SVGElementInstance::setOnload(PassRefPtr<EventListener> eventListener) +bool SVGElementInstance::removeEventListener(const AtomicString& eventType, EventListener* listener, bool useCapture) { - correspondingElement()->setAttributeEventListener(eventNames().loadEvent, eventListener); -} - -EventListener* SVGElementInstance::onmousedown() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().mousedownEvent); -} - -void SVGElementInstance::setOnmousedown(PassRefPtr<EventListener> eventListener) -{ - correspondingElement()->setAttributeEventListener(eventNames().mousedownEvent, eventListener); -} - -EventListener* SVGElementInstance::onmousemove() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().mousemoveEvent); -} - -void SVGElementInstance::setOnmousemove(PassRefPtr<EventListener> eventListener) -{ - correspondingElement()->setAttributeEventListener(eventNames().mousemoveEvent, eventListener); -} - -EventListener* SVGElementInstance::onmouseout() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().mouseoutEvent); -} - -void SVGElementInstance::setOnmouseout(PassRefPtr<EventListener> eventListener) -{ - correspondingElement()->setAttributeEventListener(eventNames().mouseoutEvent, eventListener); -} - -EventListener* SVGElementInstance::onmouseover() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().mouseoverEvent); -} - -void SVGElementInstance::setOnmouseover(PassRefPtr<EventListener> eventListener) -{ - correspondingElement()->setAttributeEventListener(eventNames().mouseoverEvent, eventListener); -} - -EventListener* SVGElementInstance::onmouseup() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().mouseupEvent); -} - -void SVGElementInstance::setOnmouseup(PassRefPtr<EventListener> eventListener) -{ - correspondingElement()->setAttributeEventListener(eventNames().mouseupEvent, eventListener); -} - -EventListener* SVGElementInstance::onmousewheel() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().mousewheelEvent); -} - -void SVGElementInstance::setOnmousewheel(PassRefPtr<EventListener> eventListener) -{ - correspondingElement()->setAttributeEventListener(eventNames().mousewheelEvent, eventListener); -} - -EventListener* SVGElementInstance::onbeforecut() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().beforecutEvent); -} - -void SVGElementInstance::setOnbeforecut(PassRefPtr<EventListener> eventListener) -{ - correspondingElement()->setAttributeEventListener(eventNames().beforecutEvent, eventListener); -} - -EventListener* SVGElementInstance::oncut() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().cutEvent); -} - -void SVGElementInstance::setOncut(PassRefPtr<EventListener> eventListener) -{ - correspondingElement()->setAttributeEventListener(eventNames().cutEvent, eventListener); -} - -EventListener* SVGElementInstance::onbeforecopy() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().beforecopyEvent); -} - -void SVGElementInstance::setOnbeforecopy(PassRefPtr<EventListener> eventListener) -{ - correspondingElement()->setAttributeEventListener(eventNames().beforecopyEvent, eventListener); -} - -EventListener* SVGElementInstance::oncopy() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().copyEvent); -} - -void SVGElementInstance::setOncopy(PassRefPtr<EventListener> eventListener) -{ - correspondingElement()->setAttributeEventListener(eventNames().copyEvent, eventListener); -} - -EventListener* SVGElementInstance::onbeforepaste() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().beforepasteEvent); -} - -void SVGElementInstance::setOnbeforepaste(PassRefPtr<EventListener> eventListener) -{ - correspondingElement()->setAttributeEventListener(eventNames().beforepasteEvent, eventListener); -} - -EventListener* SVGElementInstance::onpaste() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().pasteEvent); -} - -void SVGElementInstance::setOnpaste(PassRefPtr<EventListener> eventListener) -{ - correspondingElement()->setAttributeEventListener(eventNames().pasteEvent, eventListener); -} - -EventListener* SVGElementInstance::ondragenter() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().dragenterEvent); -} - -void SVGElementInstance::setOndragenter(PassRefPtr<EventListener> eventListener) -{ - correspondingElement()->setAttributeEventListener(eventNames().dragenterEvent, eventListener); -} - -EventListener* SVGElementInstance::ondragover() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().dragoverEvent); -} - -void SVGElementInstance::setOndragover(PassRefPtr<EventListener> eventListener) -{ - correspondingElement()->setAttributeEventListener(eventNames().dragoverEvent, eventListener); -} - -EventListener* SVGElementInstance::ondragleave() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().dragleaveEvent); -} - -void SVGElementInstance::setOndragleave(PassRefPtr<EventListener> eventListener) -{ - correspondingElement()->setAttributeEventListener(eventNames().dragleaveEvent, eventListener); -} - -EventListener* SVGElementInstance::ondrop() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().dropEvent); -} - -void SVGElementInstance::setOndrop(PassRefPtr<EventListener> eventListener) -{ - correspondingElement()->setAttributeEventListener(eventNames().dropEvent, eventListener); -} - -EventListener* SVGElementInstance::ondragstart() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().dragstartEvent); -} - -void SVGElementInstance::setOndragstart(PassRefPtr<EventListener> eventListener) -{ - correspondingElement()->setAttributeEventListener(eventNames().dragstartEvent, eventListener); -} - -EventListener* SVGElementInstance::ondrag() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().dragEvent); -} - -void SVGElementInstance::setOndrag(PassRefPtr<EventListener> eventListener) -{ - correspondingElement()->setAttributeEventListener(eventNames().dragEvent, eventListener); -} - -EventListener* SVGElementInstance::ondragend() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().dragendEvent); -} - -void SVGElementInstance::setOndragend(PassRefPtr<EventListener> eventListener) -{ - correspondingElement()->setAttributeEventListener(eventNames().dragendEvent, eventListener); -} - -EventListener* SVGElementInstance::onreset() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().resetEvent); -} - -void SVGElementInstance::setOnreset(PassRefPtr<EventListener> eventListener) -{ - correspondingElement()->setAttributeEventListener(eventNames().resetEvent, eventListener); -} - -EventListener* SVGElementInstance::onresize() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().resizeEvent); -} - -void SVGElementInstance::setOnresize(PassRefPtr<EventListener> eventListener) -{ - correspondingElement()->setAttributeEventListener(eventNames().resizeEvent, eventListener); -} - -EventListener* SVGElementInstance::onscroll() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().scrollEvent); -} - -void SVGElementInstance::setOnscroll(PassRefPtr<EventListener> eventListener) -{ - correspondingElement()->setAttributeEventListener(eventNames().scrollEvent, eventListener); -} - -EventListener* SVGElementInstance::onsearch() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().searchEvent); -} - -void SVGElementInstance::setOnsearch(PassRefPtr<EventListener> eventListener) -{ - correspondingElement()->setAttributeEventListener(eventNames().searchEvent, eventListener); -} - -EventListener* SVGElementInstance::onselect() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().selectEvent); + if (!correspondingElement()) + return false; + return correspondingElement()->removeEventListener(eventType, listener, useCapture); } -void SVGElementInstance::setOnselect(PassRefPtr<EventListener> eventListener) +void SVGElementInstance::removeAllEventListeners() { - correspondingElement()->setAttributeEventListener(eventNames().selectEvent, eventListener); + if (!correspondingElement()) + return; + correspondingElement()->removeAllEventListeners(); } -EventListener* SVGElementInstance::onselectstart() const +bool SVGElementInstance::dispatchEvent(PassRefPtr<Event> prpEvent) { - return correspondingElement()->getAttributeEventListener(eventNames().selectstartEvent); -} + RefPtr<EventTarget> protect = this; + RefPtr<Event> event = prpEvent; -void SVGElementInstance::setOnselectstart(PassRefPtr<EventListener> eventListener) -{ - correspondingElement()->setAttributeEventListener(eventNames().selectstartEvent, eventListener); -} + event->setTarget(this); -EventListener* SVGElementInstance::onsubmit() const -{ - return correspondingElement()->getAttributeEventListener(eventNames().submitEvent); -} + SVGElement* element = shadowTreeElement(); + if (!element) + return false; -void SVGElementInstance::setOnsubmit(PassRefPtr<EventListener> eventListener) -{ - correspondingElement()->setAttributeEventListener(eventNames().submitEvent, eventListener); + RefPtr<FrameView> view = element->document()->view(); + return element->dispatchGenericEvent(event.release()); } -EventListener* SVGElementInstance::onunload() const +EventTargetData* SVGElementInstance::eventTargetData() { - return correspondingElement()->getAttributeEventListener(eventNames().unloadEvent); + return correspondingElement() ? correspondingElement()->eventTargetData() : 0; } -void SVGElementInstance::setOnunload(PassRefPtr<EventListener> eventListener) +EventTargetData* SVGElementInstance::ensureEventTargetData() { - correspondingElement()->setAttributeEventListener(eventNames().unloadEvent, eventListener); + return &dummyEventTargetData(); // return something, so we don't crash } -} +} // namespace WebCore #endif // ENABLE(SVG) diff --git a/src/3rdparty/webkit/WebCore/svg/SVGElementInstance.h b/src/3rdparty/webkit/WebCore/svg/SVGElementInstance.h index 048c66c..3cdc761 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGElementInstance.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGElementInstance.h @@ -51,10 +51,11 @@ namespace WebCore { virtual ScriptExecutionContext* scriptExecutionContext() const; - virtual void addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture); - virtual void removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture); - virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&); - const RegisteredEventListenerVector& eventListeners() const { return correspondingElement()->eventListeners(); } + virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture); + virtual bool removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture); + virtual void removeAllEventListeners(); + using EventTarget::dispatchEvent; + virtual bool dispatchEvent(PassRefPtr<Event>); SVGElement* correspondingElement() const { return m_element.get(); } SVGUseElement* correspondingUseElement() const { return m_useElement; } @@ -77,86 +78,46 @@ namespace WebCore { using TreeShared<SVGElementInstance>::deref; // EventTarget API - EventListener* onabort() const; - void setOnabort(PassRefPtr<EventListener>); - EventListener* onblur() const; - void setOnblur(PassRefPtr<EventListener>); - EventListener* onchange() const; - void setOnchange(PassRefPtr<EventListener>); - EventListener* onclick() const; - void setOnclick(PassRefPtr<EventListener>); - EventListener* oncontextmenu() const; - void setOncontextmenu(PassRefPtr<EventListener>); - EventListener* ondblclick() const; - void setOndblclick(PassRefPtr<EventListener>); - EventListener* onerror() const; - void setOnerror(PassRefPtr<EventListener>); - EventListener* onfocus() const; - void setOnfocus(PassRefPtr<EventListener>); - EventListener* oninput() const; - void setOninput(PassRefPtr<EventListener>); - EventListener* onkeydown() const; - void setOnkeydown(PassRefPtr<EventListener>); - EventListener* onkeypress() const; - void setOnkeypress(PassRefPtr<EventListener>); - EventListener* onkeyup() const; - void setOnkeyup(PassRefPtr<EventListener>); - EventListener* onload() const; - void setOnload(PassRefPtr<EventListener>); - EventListener* onmousedown() const; - void setOnmousedown(PassRefPtr<EventListener>); - EventListener* onmousemove() const; - void setOnmousemove(PassRefPtr<EventListener>); - EventListener* onmouseout() const; - void setOnmouseout(PassRefPtr<EventListener>); - EventListener* onmouseover() const; - void setOnmouseover(PassRefPtr<EventListener>); - EventListener* onmouseup() const; - void setOnmouseup(PassRefPtr<EventListener>); - EventListener* onmousewheel() const; - void setOnmousewheel(PassRefPtr<EventListener>); - EventListener* onbeforecut() const; - void setOnbeforecut(PassRefPtr<EventListener>); - EventListener* oncut() const; - void setOncut(PassRefPtr<EventListener>); - EventListener* onbeforecopy() const; - void setOnbeforecopy(PassRefPtr<EventListener>); - EventListener* oncopy() const; - void setOncopy(PassRefPtr<EventListener>); - EventListener* onbeforepaste() const; - void setOnbeforepaste(PassRefPtr<EventListener>); - EventListener* onpaste() const; - void setOnpaste(PassRefPtr<EventListener>); - EventListener* ondragenter() const; - void setOndragenter(PassRefPtr<EventListener>); - EventListener* ondragover() const; - void setOndragover(PassRefPtr<EventListener>); - EventListener* ondragleave() const; - void setOndragleave(PassRefPtr<EventListener>); - EventListener* ondrop() const; - void setOndrop(PassRefPtr<EventListener>); - EventListener* ondragstart() const; - void setOndragstart(PassRefPtr<EventListener>); - EventListener* ondrag() const; - void setOndrag(PassRefPtr<EventListener>); - EventListener* ondragend() const; - void setOndragend(PassRefPtr<EventListener>); - EventListener* onreset() const; - void setOnreset(PassRefPtr<EventListener>); - EventListener* onresize() const; - void setOnresize(PassRefPtr<EventListener>); - EventListener* onscroll() const; - void setOnscroll(PassRefPtr<EventListener>); - EventListener* onsearch() const; - void setOnsearch(PassRefPtr<EventListener>); - EventListener* onselect() const; - void setOnselect(PassRefPtr<EventListener>); - EventListener* onselectstart() const; - void setOnselectstart(PassRefPtr<EventListener>); - EventListener* onsubmit() const; - void setOnsubmit(PassRefPtr<EventListener>); - EventListener* onunload() const; - void setOnunload(PassRefPtr<EventListener>); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), abort); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), blur); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), change); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), click); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), contextmenu); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), dblclick); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), error); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), focus); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), input); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), keydown); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), keypress); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), keyup); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), load); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), mousedown); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), mousemove); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), mouseout); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), mouseover); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), mouseup); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), mousewheel); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), beforecut); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), cut); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), beforecopy); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), copy); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), beforepaste); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), paste); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), dragenter); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), dragover); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), dragleave); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), drop); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), dragstart); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), drag); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), dragend); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), reset); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), resize); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), scroll); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), search); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), select); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), selectstart); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), submit); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), unload); private: friend class SVGUseElement; @@ -189,6 +150,8 @@ namespace WebCore { virtual void refEventTarget() { ref(); } virtual void derefEventTarget() { deref(); } + virtual EventTargetData* eventTargetData(); + virtual EventTargetData* ensureEventTargetData(); bool m_needsUpdate : 1; diff --git a/src/3rdparty/webkit/WebCore/svg/SVGImageLoader.cpp b/src/3rdparty/webkit/WebCore/svg/SVGImageLoader.cpp index f8380f5..5d5d3bc 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGImageLoader.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGImageLoader.cpp @@ -25,6 +25,7 @@ #if ENABLE(SVG) #include "SVGImageLoader.h" +#include "Event.h" #include "EventNames.h" #include "SVGImageElement.h" #include "RenderImage.h" @@ -43,7 +44,7 @@ SVGImageLoader::~SVGImageLoader() void SVGImageLoader::dispatchLoadEvent() { if (image()->errorOccurred()) - element()->dispatchEvent(eventNames().errorEvent, false, false); + element()->dispatchEvent(Event::create(eventNames().errorEvent, false, false)); else { SVGImageElement* imageElement = static_cast<SVGImageElement*>(element()); if (imageElement->externalResourcesRequiredBaseValue()) diff --git a/src/3rdparty/webkit/WebCore/svg/SVGScriptElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGScriptElement.cpp index 2ecf912..587542c 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGScriptElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGScriptElement.cpp @@ -26,6 +26,7 @@ #include "SVGScriptElement.h" #include "Document.h" +#include "Event.h" #include "EventNames.h" #include "MappedAttribute.h" #include "SVGNames.h" @@ -209,7 +210,7 @@ void SVGScriptElement::dispatchLoadEvent() void SVGScriptElement::dispatchErrorEvent() { - dispatchEvent(eventNames().errorEvent, true, false); + dispatchEvent(Event::create(eventNames().errorEvent, true, false)); } } diff --git a/src/3rdparty/webkit/WebCore/svg/SVGUseElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGUseElement.cpp index 9cb3024..4b66e03 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGUseElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGUseElement.cpp @@ -768,18 +768,18 @@ void SVGUseElement::transferEventListenersToShadowTree(SVGElementInstance* targe ASSERT(originalElement); if (SVGElement* shadowTreeElement = target->shadowTreeElement()) { - const RegisteredEventListenerVector& listeners = originalElement->eventListeners(); - size_t size = listeners.size(); - for (size_t i = 0; i < size; ++i) { - const RegisteredEventListener& r = *listeners[i]; - EventListener* listener = r.listener(); - ASSERT(listener); - - // Event listeners created from markup have already been transfered to the shadow tree during cloning! - if (listener->wasCreatedFromMarkup()) - continue; - - shadowTreeElement->addEventListener(r.eventType(), listener, r.useCapture()); + if (EventTargetData* d = originalElement->eventTargetData()) { + EventListenerMap& map = d->eventListenerMap; + EventListenerMap::iterator end = map.end(); + for (EventListenerMap::iterator it = map.begin(); it != end; ++it) { + EventListenerVector& entry = it->second; + for (size_t i = 0; i < entry.size(); ++i) { + // Event listeners created from markup have already been transfered to the shadow tree during cloning. + if (entry[i].listener->wasCreatedFromMarkup()) + continue; + shadowTreeElement->addEventListener(it->first, entry[i].listener, entry[i].useCapture); + } + } } } diff --git a/src/3rdparty/webkit/WebCore/svg/animation/SVGSMILElement.cpp b/src/3rdparty/webkit/WebCore/svg/animation/SVGSMILElement.cpp index 982afd5..8ec9435 100644 --- a/src/3rdparty/webkit/WebCore/svg/animation/SVGSMILElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/animation/SVGSMILElement.cpp @@ -87,7 +87,7 @@ private: m_eventBase->addEventListener(m_condition->m_name, this, false); } - virtual void handleEvent(Event*, bool); + virtual void handleEvent(Event*); SVGSMILElement* m_animation; SVGSMILElement::Condition* m_condition; @@ -103,7 +103,7 @@ bool ConditionEventListener::operator==(const EventListener& listener) return false; } -void ConditionEventListener::handleEvent(Event* event, bool) +void ConditionEventListener::handleEvent(Event* event) { m_animation->handleConditionEvent(event, m_condition); } diff --git a/src/3rdparty/webkit/WebCore/websockets/WebSocket.cpp b/src/3rdparty/webkit/WebCore/websockets/WebSocket.cpp index 8f90b1c..dd89c14 100644 --- a/src/3rdparty/webkit/WebCore/websockets/WebSocket.cpp +++ b/src/3rdparty/webkit/WebCore/websockets/WebSocket.cpp @@ -52,23 +52,23 @@ namespace WebCore { class ProcessWebSocketEventTask : public ScriptExecutionContext::Task { public: typedef void (WebSocket::*Method)(Event*); - static PassRefPtr<ProcessWebSocketEventTask> create(PassRefPtr<WebSocket> webSocket, Method method, PassRefPtr<Event> event) + static PassRefPtr<ProcessWebSocketEventTask> create(PassRefPtr<WebSocket> webSocket, PassRefPtr<Event> event) { - return adoptRef(new ProcessWebSocketEventTask(webSocket, method, event)); + return adoptRef(new ProcessWebSocketEventTask(webSocket, event)); } virtual void performTask(ScriptExecutionContext*) { - (m_webSocket.get()->*m_method)(m_event.get()); + ExceptionCode ec = 0; + m_webSocket->dispatchEvent(m_event.get(), ec); + ASSERT(!ec); } private: - ProcessWebSocketEventTask(PassRefPtr<WebSocket> webSocket, Method method, PassRefPtr<Event> event) + ProcessWebSocketEventTask(PassRefPtr<WebSocket> webSocket, PassRefPtr<Event> event) : m_webSocket(webSocket) - , m_method(method) , m_event(event) { } RefPtr<WebSocket> m_webSocket; - Method m_method; RefPtr<Event> m_event; }; @@ -171,54 +171,6 @@ ScriptExecutionContext* WebSocket::scriptExecutionContext() const return ActiveDOMObject::scriptExecutionContext(); } -void WebSocket::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> eventListener, bool) -{ - EventListenersMap::iterator iter = m_eventListeners.find(eventType); - if (iter == m_eventListeners.end()) { - ListenerVector listeners; - listeners.append(eventListener); - m_eventListeners.add(eventType, listeners); - } else { - ListenerVector& listeners = iter->second; - for (ListenerVector::iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) - if (*listenerIter == eventListener) - return; - - listeners.append(eventListener); - m_eventListeners.add(eventType, listeners); - } -} - -void WebSocket::removeEventListener(const AtomicString& eventType, EventListener* eventListener, bool) -{ - EventListenersMap::iterator iter = m_eventListeners.find(eventType); - if (iter == m_eventListeners.end()) - return; - - ListenerVector& listeners = iter->second; - for (ListenerVector::const_iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) - if (*listenerIter == eventListener) { - listeners.remove(listenerIter - listeners.begin()); - return; - } -} - -bool WebSocket::dispatchEvent(PassRefPtr<Event> evt, ExceptionCode& ec) -{ - if (!evt || evt->type().isEmpty()) { - ec = EventException::UNSPECIFIED_EVENT_TYPE_ERR; - return true; - } - - ListenerVector listenersCopy = m_eventListeners.get(evt->type()); - for (ListenerVector::const_iterator listenerIter = listenersCopy.begin(); listenerIter != listenersCopy.end(); ++listenerIter) { - evt->setTarget(this); - evt->setCurrentTarget(this); - listenerIter->get()->handleEvent(evt.get(), false); - } - return !evt->defaultPrevented(); -} - void WebSocket::didConnect() { LOG(Network, "WebSocket %p didConnect", this); @@ -227,7 +179,7 @@ void WebSocket::didConnect() return; } m_state = OPEN; - scriptExecutionContext()->postTask(ProcessWebSocketEventTask::create(this, &WebSocket::dispatchOpenEvent, Event::create(eventNames().openEvent, false, false))); + scriptExecutionContext()->postTask(ProcessWebSocketEventTask::create(this, Event::create(eventNames().openEvent, false, false))); } void WebSocket::didReceiveMessage(const String& msg) @@ -238,53 +190,24 @@ void WebSocket::didReceiveMessage(const String& msg) RefPtr<MessageEvent> evt = MessageEvent::create(); // FIXME: origin, lastEventId, source, messagePort. evt->initMessageEvent(eventNames().messageEvent, false, false, msg, "", "", 0, 0); - scriptExecutionContext()->postTask(ProcessWebSocketEventTask::create(this, &WebSocket::dispatchMessageEvent, evt)); + scriptExecutionContext()->postTask(ProcessWebSocketEventTask::create(this, evt)); } void WebSocket::didClose() { LOG(Network, "WebSocket %p didClose", this); m_state = CLOSED; - scriptExecutionContext()->postTask(ProcessWebSocketEventTask::create(this, &WebSocket::dispatchCloseEvent, Event::create(eventNames().closeEvent, false, false))); + scriptExecutionContext()->postTask(ProcessWebSocketEventTask::create(this, Event::create(eventNames().closeEvent, false, false))); } -void WebSocket::dispatchOpenEvent(Event* evt) +EventTargetData* WebSocket::eventTargetData() { - if (m_onopen) { - evt->setTarget(this); - evt->setCurrentTarget(this); - m_onopen->handleEvent(evt, false); - } - - ExceptionCode ec = 0; - dispatchEvent(evt, ec); - ASSERT(!ec); + return &m_eventTargetData; } -void WebSocket::dispatchMessageEvent(Event* evt) +EventTargetData* WebSocket::ensureEventTargetData() { - if (m_onmessage) { - evt->setTarget(this); - evt->setCurrentTarget(this); - m_onmessage->handleEvent(evt, false); - } - - ExceptionCode ec = 0; - dispatchEvent(evt, ec); - ASSERT(!ec); -} - -void WebSocket::dispatchCloseEvent(Event* evt) -{ - if (m_onclose) { - evt->setTarget(this); - evt->setCurrentTarget(this); - m_onclose->handleEvent(evt, false); - } - - ExceptionCode ec = 0; - dispatchEvent(evt, ec); - ASSERT(!ec); + return &m_eventTargetData; } } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/websockets/WebSocket.h b/src/3rdparty/webkit/WebCore/websockets/WebSocket.h index 2be3445..c5b7ee7 100644 --- a/src/3rdparty/webkit/WebCore/websockets/WebSocket.h +++ b/src/3rdparty/webkit/WebCore/websockets/WebSocket.h @@ -36,6 +36,7 @@ #include "ActiveDOMObject.h" #include "AtomicStringHash.h" #include "EventListener.h" +#include "EventNames.h" #include "EventTarget.h" #include "KURL.h" #include "WebSocketChannelClient.h" @@ -69,26 +70,15 @@ namespace WebCore { State readyState() const; unsigned long bufferedAmount() const; - void setOnopen(PassRefPtr<EventListener> eventListener) { m_onopen = eventListener; } - EventListener* onopen() const { return m_onopen.get(); } - void setOnmessage(PassRefPtr<EventListener> eventListener) { m_onmessage = eventListener; } - EventListener* onmessage() const { return m_onmessage.get(); } - void setOnclose(PassRefPtr<EventListener> eventListener) { m_onclose = eventListener; } - EventListener* onclose() const { return m_onclose.get(); } + DEFINE_ATTRIBUTE_EVENT_LISTENER(open); + DEFINE_ATTRIBUTE_EVENT_LISTENER(message); + DEFINE_ATTRIBUTE_EVENT_LISTENER(close); // EventTarget virtual WebSocket* toWebSocket() { return this; } virtual ScriptExecutionContext* scriptExecutionContext() const; - typedef Vector<RefPtr<EventListener> > ListenerVector; - typedef HashMap<AtomicString, ListenerVector> EventListenersMap; - - virtual void addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture); - virtual void removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture); - virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&); - EventListenersMap& eventListeners() { return m_eventListeners; } - // ActiveDOMObject // virtual bool hasPendingActivity() const; // virtual void contextDestroyed(); @@ -110,6 +100,8 @@ namespace WebCore { virtual void refEventTarget() { ref(); } virtual void derefEventTarget() { deref(); } + virtual EventTargetData* eventTargetData(); + virtual EventTargetData* ensureEventTargetData(); void dispatchOpenEvent(Event*); void dispatchMessageEvent(Event*); @@ -117,14 +109,10 @@ namespace WebCore { RefPtr<WebSocketChannel> m_channel; - RefPtr<EventListener> m_onopen; - RefPtr<EventListener> m_onmessage; - RefPtr<EventListener> m_onclose; - EventListenersMap m_eventListeners; - State m_state; KURL m_url; String m_protocol; + EventTargetData m_eventTargetData; }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/websockets/WebSocket.idl b/src/3rdparty/webkit/WebCore/websockets/WebSocket.idl index cdb916f..04606fe 100644 --- a/src/3rdparty/webkit/WebCore/websockets/WebSocket.idl +++ b/src/3rdparty/webkit/WebCore/websockets/WebSocket.idl @@ -31,9 +31,9 @@ module websockets { interface [ - CustomMarkFunction, - NoStaticTables, - Conditional=WEB_SOCKETS + Conditional=WEB_SOCKETS, + EventTarget, + NoStaticTables ] WebSocket { readonly attribute DOMString URL; diff --git a/src/3rdparty/webkit/WebCore/workers/AbstractWorker.cpp b/src/3rdparty/webkit/WebCore/workers/AbstractWorker.cpp index d28b011..6ba8922 100644 --- a/src/3rdparty/webkit/WebCore/workers/AbstractWorker.cpp +++ b/src/3rdparty/webkit/WebCore/workers/AbstractWorker.cpp @@ -52,90 +52,6 @@ AbstractWorker::~AbstractWorker() { } -void AbstractWorker::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> eventListener, bool) -{ - EventListenersMap::iterator iter = m_eventListeners.find(eventType); - if (iter == m_eventListeners.end()) { - ListenerVector listeners; - listeners.append(eventListener); - m_eventListeners.add(eventType, listeners); - } else { - ListenerVector& listeners = iter->second; - for (ListenerVector::iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) { - if (**listenerIter == *eventListener) - return; - } - - listeners.append(eventListener); - m_eventListeners.add(eventType, listeners); - } -} - -void AbstractWorker::removeEventListener(const AtomicString& eventType, EventListener* eventListener, bool) -{ - EventListenersMap::iterator iter = m_eventListeners.find(eventType); - if (iter == m_eventListeners.end()) - return; - - ListenerVector& listeners = iter->second; - for (ListenerVector::const_iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) { - if (**listenerIter == *eventListener) { - listeners.remove(listenerIter - listeners.begin()); - return; - } - } -} - -bool AbstractWorker::dispatchEvent(PassRefPtr<Event> event, ExceptionCode& ec) -{ - if (!event || event->type().isEmpty()) { - ec = EventException::UNSPECIFIED_EVENT_TYPE_ERR; - return true; - } - - ListenerVector listenersCopy = m_eventListeners.get(event->type()); - for (ListenerVector::const_iterator listenerIter = listenersCopy.begin(); listenerIter != listenersCopy.end(); ++listenerIter) { - event->setTarget(this); - event->setCurrentTarget(this); - listenerIter->get()->handleEvent(event.get(), false); - } - - return !event->defaultPrevented(); -} - -void AbstractWorker::dispatchLoadErrorEvent() -{ - RefPtr<Event> evt = Event::create(eventNames().errorEvent, false, true); - if (m_onErrorListener) { - evt->setTarget(this); - evt->setCurrentTarget(this); - m_onErrorListener->handleEvent(evt.get(), true); - } - - ExceptionCode ec = 0; - dispatchEvent(evt.release(), ec); - ASSERT(!ec); -} - -bool AbstractWorker::dispatchScriptErrorEvent(const String& message, const String& sourceURL, int lineNumber) -{ - bool handled = false; - RefPtr<ErrorEvent> event = ErrorEvent::create(message, sourceURL, static_cast<unsigned>(lineNumber)); - if (m_onErrorListener) { - event->setTarget(this); - event->setCurrentTarget(this); - m_onErrorListener->handleEvent(event.get(), true); - if (event->defaultPrevented()) - handled = true; - } - - ExceptionCode ec = 0; - handled = !dispatchEvent(event.release(), ec); - ASSERT(!ec); - - return handled; -} - KURL AbstractWorker::resolveURL(const String& url, ExceptionCode& ec) { if (url.isEmpty()) { @@ -157,6 +73,16 @@ KURL AbstractWorker::resolveURL(const String& url, ExceptionCode& ec) return scriptURL; } +EventTargetData* AbstractWorker::eventTargetData() +{ + return &m_eventTargetData; +} + +EventTargetData* AbstractWorker::ensureEventTargetData() +{ + return &m_eventTargetData; +} + } // namespace WebCore #endif // ENABLE(WORKERS) diff --git a/src/3rdparty/webkit/WebCore/workers/AbstractWorker.h b/src/3rdparty/webkit/WebCore/workers/AbstractWorker.h index a882542..2209856 100644 --- a/src/3rdparty/webkit/WebCore/workers/AbstractWorker.h +++ b/src/3rdparty/webkit/WebCore/workers/AbstractWorker.h @@ -36,6 +36,7 @@ #include "ActiveDOMObject.h" #include "AtomicStringHash.h" #include "EventListener.h" +#include "EventNames.h" #include "EventTarget.h" #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> @@ -51,19 +52,7 @@ namespace WebCore { // EventTarget APIs virtual ScriptExecutionContext* scriptExecutionContext() const { return ActiveDOMObject::scriptExecutionContext(); } - virtual void addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture); - virtual void removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture); - virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&); - - // Utility routines to generate appropriate error events for loading and script exceptions. - void dispatchLoadErrorEvent(); - bool dispatchScriptErrorEvent(const String& errorMessage, const String& sourceURL, int); - - void setOnerror(PassRefPtr<EventListener> eventListener) { m_onErrorListener = eventListener; } - EventListener* onerror() const { return m_onErrorListener.get(); } - typedef Vector<RefPtr<EventListener> > ListenerVector; - typedef HashMap<AtomicString, ListenerVector> EventListenersMap; - EventListenersMap& eventListeners() { return m_eventListeners; } + DEFINE_ATTRIBUTE_EVENT_LISTENER(error); using RefCounted<AbstractWorker>::ref; using RefCounted<AbstractWorker>::deref; @@ -78,9 +67,10 @@ namespace WebCore { private: virtual void refEventTarget() { ref(); } virtual void derefEventTarget() { deref(); } - - RefPtr<EventListener> m_onErrorListener; - EventListenersMap m_eventListeners; + virtual EventTargetData* eventTargetData(); + virtual EventTargetData* ensureEventTargetData(); + + EventTargetData m_eventTargetData; }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/workers/AbstractWorker.idl b/src/3rdparty/webkit/WebCore/workers/AbstractWorker.idl index ae7ebc6..00b8fbb 100644 --- a/src/3rdparty/webkit/WebCore/workers/AbstractWorker.idl +++ b/src/3rdparty/webkit/WebCore/workers/AbstractWorker.idl @@ -32,8 +32,8 @@ module threads { interface [ Conditional=WORKERS, - CustomMarkFunction, CustomToJS, + EventTarget, GenerateConstructor ] AbstractWorker { diff --git a/src/3rdparty/webkit/WebCore/workers/DedicatedWorkerContext.cpp b/src/3rdparty/webkit/WebCore/workers/DedicatedWorkerContext.cpp index 8c5ee47..5206fd9 100644 --- a/src/3rdparty/webkit/WebCore/workers/DedicatedWorkerContext.cpp +++ b/src/3rdparty/webkit/WebCore/workers/DedicatedWorkerContext.cpp @@ -71,23 +71,6 @@ void DedicatedWorkerContext::postMessage(const String& message, const MessagePor thread()->workerObjectProxy().postMessageToWorkerObject(message, channels.release()); } -void DedicatedWorkerContext::dispatchMessage(const String& message, PassOwnPtr<MessagePortArray> ports) -{ - // Since close() stops the thread event loop, this should not ever get called while closing. - ASSERT(!isClosing()); - RefPtr<Event> evt = MessageEvent::create(message, "", "", 0, ports); - - if (m_onmessageListener.get()) { - evt->setTarget(this); - evt->setCurrentTarget(this); - m_onmessageListener->handleEvent(evt.get(), false); - } - - ExceptionCode ec = 0; - dispatchEvent(evt.release(), ec); - ASSERT(!ec); -} - void DedicatedWorkerContext::importScripts(const Vector<String>& urls, const String& callerURL, int callerLine, ExceptionCode& ec) { Base::importScripts(urls, callerURL, callerLine, ec); diff --git a/src/3rdparty/webkit/WebCore/workers/DedicatedWorkerContext.h b/src/3rdparty/webkit/WebCore/workers/DedicatedWorkerContext.h index 3bc4aee..7609fcd 100644 --- a/src/3rdparty/webkit/WebCore/workers/DedicatedWorkerContext.h +++ b/src/3rdparty/webkit/WebCore/workers/DedicatedWorkerContext.h @@ -59,15 +59,12 @@ namespace WebCore { void postMessage(const String&, const MessagePortArray*, ExceptionCode&); // FIXME: remove this when we update the ObjC bindings (bug #28774). void postMessage(const String&, MessagePort*, ExceptionCode&); - void setOnmessage(PassRefPtr<EventListener> eventListener) { m_onmessageListener = eventListener; } - EventListener* onmessage() const { return m_onmessageListener.get(); } - void dispatchMessage(const String&, PassOwnPtr<MessagePortArray>); + DEFINE_ATTRIBUTE_EVENT_LISTENER(message); DedicatedWorkerThread* thread(); private: DedicatedWorkerContext(const KURL&, const String&, DedicatedWorkerThread*); - RefPtr<EventListener> m_onmessageListener; }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/workers/DedicatedWorkerContext.idl b/src/3rdparty/webkit/WebCore/workers/DedicatedWorkerContext.idl index ef3ebfe..899bbae 100644 --- a/src/3rdparty/webkit/WebCore/workers/DedicatedWorkerContext.idl +++ b/src/3rdparty/webkit/WebCore/workers/DedicatedWorkerContext.idl @@ -32,7 +32,6 @@ module threads { interface [ Conditional=WORKERS, - CustomMarkFunction, ExtendsDOMGlobalObject, IsWorkerContext, GenerateNativeConverter, diff --git a/src/3rdparty/webkit/WebCore/workers/DefaultSharedWorkerRepository.cpp b/src/3rdparty/webkit/WebCore/workers/DefaultSharedWorkerRepository.cpp index e955f24..11106ee 100644 --- a/src/3rdparty/webkit/WebCore/workers/DefaultSharedWorkerRepository.cpp +++ b/src/3rdparty/webkit/WebCore/workers/DefaultSharedWorkerRepository.cpp @@ -37,6 +37,7 @@ #include "ActiveDOMObject.h" #include "Document.h" #include "GenericWorkerTask.h" +#include "MessageEvent.h" #include "MessagePort.h" #include "NotImplemented.h" #include "PlatformString.h" @@ -64,7 +65,7 @@ public: bool isClosing() const { return m_closing; } KURL url() const { return m_url.copy(); } String name() const { return m_name.copy(); } - bool matches(const String& name, PassRefPtr<SecurityOrigin> origin) const { return name == m_name && origin->equal(m_origin.get()); } + bool matches(const String& name, PassRefPtr<SecurityOrigin> origin, const KURL& urlToMatch) const; // WorkerLoaderProxy virtual void postTaskToLoader(PassRefPtr<ScriptExecutionContext::Task>); @@ -109,6 +110,19 @@ SharedWorkerProxy::SharedWorkerProxy(const String& name, const KURL& url, PassRe ASSERT(m_origin->hasOneRef()); } +bool SharedWorkerProxy::matches(const String& name, PassRefPtr<SecurityOrigin> origin, const KURL& urlToMatch) const +{ + // If the origins don't match, or the names don't match, then this is not the proxy we are looking for. + if (!origin->equal(m_origin.get())) + return false; + + // If the names are both empty, compares the URLs instead per the Web Workers spec. + if (name.isEmpty() && m_name.isEmpty()) + return urlToMatch == url(); + + return name == m_name; +} + void SharedWorkerProxy::postTaskToLoader(PassRefPtr<ScriptExecutionContext::Task> task) { MutexLocker lock(m_workerDocumentsLock); @@ -219,8 +233,10 @@ private: port->entangle(m_channel.release()); ASSERT(scriptContext->isWorkerContext()); WorkerContext* workerContext = static_cast<WorkerContext*>(scriptContext); + // Since close() stops the thread event loop, this should not ever get called while closing. + ASSERT(!workerContext->isClosing()); ASSERT(workerContext->isSharedWorkerContext()); - workerContext->toSharedWorkerContext()->dispatchConnect(port); + workerContext->toSharedWorkerContext()->dispatchEvent(createConnectEvent(port)); } OwnPtr<MessagePortChannel> m_channel; @@ -259,18 +275,19 @@ void SharedWorkerScriptLoader::load(const KURL& url) // Stay alive until the load finishes. setPendingActivity(this); + m_worker->setPendingActivity(m_worker.get()); } void SharedWorkerScriptLoader::notifyFinished() { // Hand off the just-loaded code to the repository to start up the worker thread. if (m_scriptLoader->failed()) - m_worker->dispatchLoadErrorEvent(); + m_worker->dispatchEvent(Event::create(eventNames().errorEvent, false, true)); else DefaultSharedWorkerRepository::instance().workerScriptLoaded(*m_proxy, scriptExecutionContext()->userAgent(m_scriptLoader->url()), m_scriptLoader->script(), m_port.release()); - // This frees this object - must be the last action in this function. - unsetPendingActivity(this); + m_worker->unsetPendingActivity(m_worker.get()); + unsetPendingActivity(this); // This frees this object - must be the last action in this function. } DefaultSharedWorkerRepository& DefaultSharedWorkerRepository::instance() @@ -365,7 +382,7 @@ PassRefPtr<SharedWorkerProxy> DefaultSharedWorkerRepository::getProxy(const Stri // Items in the cache are freed on another thread, so copy the URL before creating the origin, to make sure no references to external strings linger. RefPtr<SecurityOrigin> origin = SecurityOrigin::create(url.copy()); for (unsigned i = 0; i < m_proxies.size(); i++) { - if (!m_proxies[i]->isClosing() && m_proxies[i]->matches(name, origin)) + if (!m_proxies[i]->isClosing() && m_proxies[i]->matches(name, origin, url)) return m_proxies[i]; } // Proxy is not in the repository currently - create a new one. diff --git a/src/3rdparty/webkit/WebCore/workers/SharedWorkerContext.cpp b/src/3rdparty/webkit/WebCore/workers/SharedWorkerContext.cpp index bebcc73..cd76e3b 100644 --- a/src/3rdparty/webkit/WebCore/workers/SharedWorkerContext.cpp +++ b/src/3rdparty/webkit/WebCore/workers/SharedWorkerContext.cpp @@ -42,6 +42,13 @@ namespace WebCore { +PassRefPtr<MessageEvent> createConnectEvent(PassRefPtr<MessagePort> port) +{ + RefPtr<MessageEvent> event = MessageEvent::create(new MessagePortArray(1, port)); + event->initEvent(eventNames().connectEvent, false, false); + return event; +} + SharedWorkerContext::SharedWorkerContext(const String& name, const KURL& url, const String& userAgent, SharedWorkerThread* thread) : WorkerContext(url, userAgent, thread) , m_name(name) @@ -52,27 +59,6 @@ SharedWorkerContext::~SharedWorkerContext() { } -void SharedWorkerContext::dispatchConnect(PassRefPtr<MessagePort> port) -{ - // Since close() stops the thread event loop, this should not ever get called while closing. - ASSERT(!isClosing()); - // The connect event uses the MessageEvent interface, but has the name "connect". - OwnPtr<MessagePortArray> portArray(new MessagePortArray()); - portArray->append(port); - RefPtr<Event> event = MessageEvent::create("", "", "", 0, portArray.release()); - event->initEvent(eventNames().connectEvent, false, false); - - if (m_onconnectListener.get()) { - event->setTarget(this); - event->setCurrentTarget(this); - m_onconnectListener->handleEvent(event.get(), false); - } - - ExceptionCode ec = 0; - dispatchEvent(event.release(), ec); - ASSERT(!ec); -} - SharedWorkerThread* SharedWorkerContext::thread() { return static_cast<SharedWorkerThread*>(Base::thread()); diff --git a/src/3rdparty/webkit/WebCore/workers/SharedWorkerContext.h b/src/3rdparty/webkit/WebCore/workers/SharedWorkerContext.h index d6956cd..59a7605 100644 --- a/src/3rdparty/webkit/WebCore/workers/SharedWorkerContext.h +++ b/src/3rdparty/webkit/WebCore/workers/SharedWorkerContext.h @@ -37,6 +37,7 @@ namespace WebCore { + class MessageEvent; class SharedWorkerThread; class SharedWorkerContext : public WorkerContext { @@ -54,19 +55,17 @@ namespace WebCore { virtual SharedWorkerContext* toSharedWorkerContext() { return this; } // Setters/Getters for attributes in SharedWorkerContext.idl - void setOnconnect(PassRefPtr<EventListener> eventListener) { m_onconnectListener = eventListener; } - EventListener* onconnect() const { return m_onconnectListener.get(); } + DEFINE_ATTRIBUTE_EVENT_LISTENER(connect); String name() const { return m_name; } - void dispatchConnect(PassRefPtr<MessagePort>); - SharedWorkerThread* thread(); private: SharedWorkerContext(const String& name, const KURL&, const String&, SharedWorkerThread*); - RefPtr<EventListener> m_onconnectListener; String m_name; }; + PassRefPtr<MessageEvent> createConnectEvent(PassRefPtr<MessagePort>); + } // namespace WebCore #endif // ENABLE(SHARED_WORKERS) diff --git a/src/3rdparty/webkit/WebCore/workers/SharedWorkerContext.idl b/src/3rdparty/webkit/WebCore/workers/SharedWorkerContext.idl index 8e450e0..a48e5bd 100644 --- a/src/3rdparty/webkit/WebCore/workers/SharedWorkerContext.idl +++ b/src/3rdparty/webkit/WebCore/workers/SharedWorkerContext.idl @@ -32,7 +32,6 @@ module threads { interface [ Conditional=SHARED_WORKERS, - CustomMarkFunction, ExtendsDOMGlobalObject, IsWorkerContext, GenerateNativeConverter, diff --git a/src/3rdparty/webkit/WebCore/workers/Worker.cpp b/src/3rdparty/webkit/WebCore/workers/Worker.cpp index 922cd33..c2c25c1 100644 --- a/src/3rdparty/webkit/WebCore/workers/Worker.cpp +++ b/src/3rdparty/webkit/WebCore/workers/Worker.cpp @@ -116,7 +116,7 @@ bool Worker::hasPendingActivity() const void Worker::notifyFinished() { if (m_scriptLoader->failed()) - dispatchLoadErrorEvent(); + dispatchEvent(Event::create(eventNames().errorEvent, false, true)); else m_contextProxy->startWorkerContext(m_scriptLoader->url(), scriptExecutionContext()->userAgent(m_scriptLoader->url()), m_scriptLoader->script()); @@ -125,21 +125,6 @@ void Worker::notifyFinished() unsetPendingActivity(this); } -void Worker::dispatchMessage(const String& message, PassOwnPtr<MessagePortArray> ports) -{ - RefPtr<Event> evt = MessageEvent::create(message, "", "", 0, ports); - - if (m_onMessageListener.get()) { - evt->setTarget(this); - evt->setCurrentTarget(this); - m_onMessageListener->handleEvent(evt.get(), false); - } - - ExceptionCode ec = 0; - dispatchEvent(evt.release(), ec); - ASSERT(!ec); -} - } // namespace WebCore #endif // ENABLE(WORKERS) diff --git a/src/3rdparty/webkit/WebCore/workers/Worker.h b/src/3rdparty/webkit/WebCore/workers/Worker.h index 6bc00c1..41d39a2 100644 --- a/src/3rdparty/webkit/WebCore/workers/Worker.h +++ b/src/3rdparty/webkit/WebCore/workers/Worker.h @@ -33,6 +33,7 @@ #include "ActiveDOMObject.h" #include "AtomicStringHash.h" #include "EventListener.h" +#include "EventNames.h" #include "EventTarget.h" #include "MessagePort.h" #include "WorkerScriptLoaderClient.h" @@ -64,15 +65,11 @@ namespace WebCore { void terminate(); - void dispatchMessage(const String&, PassOwnPtr<MessagePortArray>); - void dispatchErrorEvent(); - virtual bool canSuspend() const; virtual void stop(); virtual bool hasPendingActivity() const; - - void setOnmessage(PassRefPtr<EventListener> eventListener) { m_onMessageListener = eventListener; } - EventListener* onmessage() const { return m_onMessageListener.get(); } + + DEFINE_ATTRIBUTE_EVENT_LISTENER(message); private: Worker(const String&, ScriptExecutionContext*, ExceptionCode&); @@ -83,10 +80,7 @@ namespace WebCore { virtual void derefEventTarget() { deref(); } OwnPtr<WorkerScriptLoader> m_scriptLoader; - WorkerContextProxy* m_contextProxy; // The proxy outlives the worker to perform thread shutdown. - - RefPtr<EventListener> m_onMessageListener; }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/workers/Worker.idl b/src/3rdparty/webkit/WebCore/workers/Worker.idl index 3b4a3ff..9c9342b 100644 --- a/src/3rdparty/webkit/WebCore/workers/Worker.idl +++ b/src/3rdparty/webkit/WebCore/workers/Worker.idl @@ -28,7 +28,6 @@ module threads { interface [ Conditional=WORKERS, - CustomMarkFunction, GenerateNativeConverter, GenerateToJS ] Worker : AbstractWorker { diff --git a/src/3rdparty/webkit/WebCore/workers/WorkerContext.cpp b/src/3rdparty/webkit/WebCore/workers/WorkerContext.cpp index 12620f4..22e5b56 100644 --- a/src/3rdparty/webkit/WebCore/workers/WorkerContext.cpp +++ b/src/3rdparty/webkit/WebCore/workers/WorkerContext.cpp @@ -161,57 +161,6 @@ void WorkerContext::scriptImported(unsigned long, const String&) notImplemented(); } -void WorkerContext::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> eventListener, bool) -{ - EventListenersMap::iterator iter = m_eventListeners.find(eventType); - if (iter == m_eventListeners.end()) { - ListenerVector listeners; - listeners.append(eventListener); - m_eventListeners.add(eventType, listeners); - } else { - ListenerVector& listeners = iter->second; - for (ListenerVector::iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) { - if (**listenerIter == *eventListener) - return; - } - - listeners.append(eventListener); - m_eventListeners.add(eventType, listeners); - } -} - -void WorkerContext::removeEventListener(const AtomicString& eventType, EventListener* eventListener, bool) -{ - EventListenersMap::iterator iter = m_eventListeners.find(eventType); - if (iter == m_eventListeners.end()) - return; - - ListenerVector& listeners = iter->second; - for (ListenerVector::const_iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) { - if (**listenerIter == *eventListener) { - listeners.remove(listenerIter - listeners.begin()); - return; - } - } -} - -bool WorkerContext::dispatchEvent(PassRefPtr<Event> event, ExceptionCode& ec) -{ - if (!event || event->type().isEmpty()) { - ec = EventException::UNSPECIFIED_EVENT_TYPE_ERR; - return true; - } - - ListenerVector listenersCopy = m_eventListeners.get(event->type()); - for (ListenerVector::const_iterator listenerIter = listenersCopy.begin(); listenerIter != listenersCopy.end(); ++listenerIter) { - event->setTarget(this); - event->setCurrentTarget(this); - listenerIter->get()->handleEvent(event.get(), false); - } - - return !event->defaultPrevented(); -} - void WorkerContext::postTask(PassRefPtr<Task> task) { thread()->runLoop().postTask(task); @@ -304,6 +253,16 @@ NotificationCenter* WorkerContext::webkitNotifications() const } #endif +EventTargetData* WorkerContext::eventTargetData() +{ + return &m_eventTargetData; +} + +EventTargetData* WorkerContext::ensureEventTargetData() +{ + return &m_eventTargetData; +} + } // namespace WebCore #endif // ENABLE(WORKERS) diff --git a/src/3rdparty/webkit/WebCore/workers/WorkerContext.h b/src/3rdparty/webkit/WebCore/workers/WorkerContext.h index a3c3820..9725cf7 100644 --- a/src/3rdparty/webkit/WebCore/workers/WorkerContext.h +++ b/src/3rdparty/webkit/WebCore/workers/WorkerContext.h @@ -31,6 +31,7 @@ #include "AtomicStringHash.h" #include "EventListener.h" +#include "EventNames.h" #include "EventTarget.h" #include "ScriptExecutionContext.h" #include "WorkerScriptController.h" @@ -79,8 +80,8 @@ namespace WebCore { WorkerContext* self() { return this; } WorkerLocation* location() const; void close(); - void setOnerror(PassRefPtr<EventListener> eventListener) { m_onerrorListener = eventListener; } - EventListener* onerror() const { return m_onerrorListener.get(); } + + DEFINE_ATTRIBUTE_EVENT_LISTENER(error); // WorkerUtils virtual void importScripts(const Vector<String>& urls, const String& callerURL, int callerLine, ExceptionCode&); @@ -92,15 +93,6 @@ namespace WebCore { int setInterval(ScheduledAction*, int timeout); void clearInterval(int timeoutId); - // EventTarget - virtual void addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture); - virtual void removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture); - virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&); - - typedef Vector<RefPtr<EventListener> > ListenerVector; - typedef HashMap<AtomicString, ListenerVector> EventListenersMap; - EventListenersMap& eventListeners() { return m_eventListeners; } - // ScriptExecutionContext virtual void reportException(const String& errorMessage, int lineNumber, const String& sourceURL); virtual void addMessage(MessageDestination, MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL); @@ -125,8 +117,11 @@ namespace WebCore { private: virtual void refScriptExecutionContext() { ref(); } virtual void derefScriptExecutionContext() { deref(); } + virtual void refEventTarget() { ref(); } virtual void derefEventTarget() { deref(); } + virtual EventTargetData* eventTargetData(); + virtual EventTargetData* ensureEventTargetData(); virtual const KURL& virtualURL() const; virtual KURL virtualCompleteURL(const String&) const; @@ -140,13 +135,11 @@ namespace WebCore { OwnPtr<WorkerScriptController> m_script; WorkerThread* m_thread; - RefPtr<EventListener> m_onerrorListener; - EventListenersMap m_eventListeners; - #if ENABLE_NOTIFICATIONS mutable RefPtr<NotificationCenter> m_notifications; #endif bool m_closing; + EventTargetData m_eventTargetData; }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/workers/WorkerContext.idl b/src/3rdparty/webkit/WebCore/workers/WorkerContext.idl index 6a4a7fa..17bee55 100644 --- a/src/3rdparty/webkit/WebCore/workers/WorkerContext.idl +++ b/src/3rdparty/webkit/WebCore/workers/WorkerContext.idl @@ -30,6 +30,7 @@ module threads { Conditional=WORKERS, CustomMarkFunction, DelegatingGetOwnPropertySlot, + EventTarget, ExtendsDOMGlobalObject, IsWorkerContext, LegacyParent=JSWorkerContextBase, diff --git a/src/3rdparty/webkit/WebCore/workers/WorkerMessagingProxy.cpp b/src/3rdparty/webkit/WebCore/workers/WorkerMessagingProxy.cpp index 49c88c0..3d28f9e 100644 --- a/src/3rdparty/webkit/WebCore/workers/WorkerMessagingProxy.cpp +++ b/src/3rdparty/webkit/WebCore/workers/WorkerMessagingProxy.cpp @@ -35,6 +35,8 @@ #include "DedicatedWorkerThread.h" #include "DOMWindow.h" #include "Document.h" +#include "ErrorEvent.h" +#include "ExceptionCode.h" #include "GenericWorkerTask.h" #include "MessageEvent.h" #include "ScriptExecutionContext.h" @@ -61,7 +63,7 @@ private: ASSERT(scriptContext->isWorkerContext()); DedicatedWorkerContext* context = static_cast<DedicatedWorkerContext*>(scriptContext); OwnPtr<MessagePortArray> ports = MessagePort::entanglePorts(*scriptContext, m_channels.release()); - context->dispatchMessage(m_message, ports.release()); + context->dispatchEvent(MessageEvent::create(ports.release(), m_message)); context->thread()->workerObjectProxy().confirmMessageFromWorkerObject(context->hasPendingActivity()); } @@ -92,7 +94,7 @@ private: return; OwnPtr<MessagePortArray> ports = MessagePort::entanglePorts(*scriptContext, m_channels.release()); - workerObject->dispatchMessage(m_message, ports.release()); + workerObject->dispatchEvent(MessageEvent::create(ports.release(), m_message)); } private: @@ -126,8 +128,7 @@ private: // We don't bother checking the askedToTerminate() flag here, because exceptions should *always* be reported even if the thread is terminated. // This is intentionally different than the behavior in MessageWorkerTask, because terminated workers no longer deliver messages (section 4.6 of the WebWorker spec), but they do report exceptions. - bool errorHandled = workerObject->dispatchScriptErrorEvent(m_errorMessage, m_sourceURL, m_lineNumber); - + bool errorHandled = !workerObject->dispatchEvent(ErrorEvent::create(m_errorMessage, m_sourceURL, m_lineNumber)); if (!errorHandled) context->reportException(m_errorMessage, m_lineNumber, m_sourceURL); } diff --git a/src/3rdparty/webkit/WebCore/workers/WorkerRunLoop.cpp b/src/3rdparty/webkit/WebCore/workers/WorkerRunLoop.cpp index 52d650f..449dd78 100644 --- a/src/3rdparty/webkit/WebCore/workers/WorkerRunLoop.cpp +++ b/src/3rdparty/webkit/WebCore/workers/WorkerRunLoop.cpp @@ -64,7 +64,7 @@ private: double m_nextFireTime; }; -class WorkerRunLoop::Task : public RefCounted<Task> { +class WorkerRunLoop::Task : public RefCounted<WorkerRunLoop::Task> { public: static PassRefPtr<Task> create(PassRefPtr<ScriptExecutionContext::Task> task, const String& mode) { diff --git a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.cpp b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.cpp index e8df36d..798ae00 100644 --- a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.cpp +++ b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.cpp @@ -235,56 +235,6 @@ XMLHttpRequestUpload* XMLHttpRequest::upload() return m_upload.get(); } -void XMLHttpRequest::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> eventListener, bool) -{ - EventListenersMap::iterator iter = m_eventListeners.find(eventType); - if (iter == m_eventListeners.end()) { - ListenerVector listeners; - listeners.append(eventListener); - m_eventListeners.add(eventType, listeners); - } else { - ListenerVector& listeners = iter->second; - for (ListenerVector::iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) - if (**listenerIter == *eventListener) - return; - - listeners.append(eventListener); - m_eventListeners.add(eventType, listeners); - } -} - -void XMLHttpRequest::removeEventListener(const AtomicString& eventType, EventListener* eventListener, bool) -{ - EventListenersMap::iterator iter = m_eventListeners.find(eventType); - if (iter == m_eventListeners.end()) - return; - - ListenerVector& listeners = iter->second; - for (ListenerVector::const_iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) - if (**listenerIter == *eventListener) { - listeners.remove(listenerIter - listeners.begin()); - return; - } -} - -bool XMLHttpRequest::dispatchEvent(PassRefPtr<Event> evt, ExceptionCode& ec) -{ - // FIXME: check for other error conditions enumerated in the spec. - if (!evt || evt->type().isEmpty()) { - ec = EventException::UNSPECIFIED_EVENT_TYPE_ERR; - return true; - } - - ListenerVector listenersCopy = m_eventListeners.get(evt->type()); - for (ListenerVector::const_iterator listenerIter = listenersCopy.begin(); listenerIter != listenersCopy.end(); ++listenerIter) { - evt->setTarget(this); - evt->setCurrentTarget(this); - listenerIter->get()->handleEvent(evt.get(), false); - } - - return !evt->defaultPrevented(); -} - void XMLHttpRequest::changeState(State newState) { if (m_state != newState) { @@ -298,10 +248,10 @@ void XMLHttpRequest::callReadyStateChangeListener() if (!scriptExecutionContext()) return; - dispatchReadyStateChangeEvent(); + dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().readystatechangeEvent)); if (m_state == DONE && !m_error) - dispatchLoadEvent(); + dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadEvent)); } void XMLHttpRequest::setWithCredentials(bool value, ExceptionCode& ec) @@ -479,10 +429,10 @@ void XMLHttpRequest::createRequest(ExceptionCode& ec) // Also, only async requests support upload progress events. bool forcePreflight = false; if (m_async) { - dispatchLoadStartEvent(); + dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadstartEvent)); if (m_requestEntityBody && m_upload) { - forcePreflight = m_upload->hasListeners(); - m_upload->dispatchLoadStartEvent(); + forcePreflight = m_upload->hasEventListeners(); + m_upload->dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadstartEvent)); } } @@ -556,6 +506,10 @@ void XMLHttpRequest::abort() internalAbort(); + m_responseText = ""; + m_createdDocument = false; + m_responseXML = 0; + // Clear headers as required by the spec m_requestHeaders.clear(); @@ -567,11 +521,11 @@ void XMLHttpRequest::abort() m_state = UNSENT; } - dispatchAbortEvent(); + dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().abortEvent)); if (!m_uploadComplete) { m_uploadComplete = true; if (m_upload && m_uploadEventsAllowed) - m_upload->dispatchAbortEvent(); + m_upload->dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().abortEvent)); } } @@ -621,11 +575,11 @@ void XMLHttpRequest::genericError() void XMLHttpRequest::networkError() { genericError(); - dispatchErrorEvent(); + dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().errorEvent)); if (!m_uploadComplete) { m_uploadComplete = true; if (m_upload && m_uploadEventsAllowed) - m_upload->dispatchErrorEvent(); + m_upload->dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().errorEvent)); } internalAbort(); } @@ -633,11 +587,11 @@ void XMLHttpRequest::networkError() void XMLHttpRequest::abortError() { genericError(); - dispatchAbortEvent(); + dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().abortEvent)); if (!m_uploadComplete) { m_uploadComplete = true; if (m_upload && m_uploadEventsAllowed) - m_upload->dispatchAbortEvent(); + m_upload->dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().abortEvent)); } } @@ -885,12 +839,12 @@ void XMLHttpRequest::didSendData(unsigned long long bytesSent, unsigned long lon return; if (m_uploadEventsAllowed) - m_upload->dispatchProgressEvent(bytesSent, totalBytesToBeSent); + m_upload->dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().progressEvent, true, static_cast<unsigned>(bytesSent), static_cast<unsigned>(totalBytesToBeSent))); if (bytesSent == totalBytesToBeSent && !m_uploadComplete) { m_uploadComplete = true; if (m_uploadEventsAllowed) - m_upload->dispatchLoadEvent(); + m_upload->dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadEvent)); } } @@ -938,7 +892,12 @@ void XMLHttpRequest::didReceiveData(const char* data, int len) m_responseText += m_decoder->decode(data, len); if (!m_error) { - updateAndDispatchOnProgress(len); + long long expectedLength = m_response.expectedContentLength(); + m_receivedLength += len; + + // FIXME: the spec requires that we dispatch the event according to the least + // frequent method between every 350ms (+/-200ms) and for every byte received. + dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().progressEvent, expectedLength && m_receivedLength <= expectedLength, static_cast<unsigned>(m_receivedLength), static_cast<unsigned>(expectedLength))); if (m_state != LOADING) changeState(LOADING); @@ -948,70 +907,6 @@ void XMLHttpRequest::didReceiveData(const char* data, int len) } } -void XMLHttpRequest::updateAndDispatchOnProgress(unsigned int len) -{ - long long expectedLength = m_response.expectedContentLength(); - m_receivedLength += len; - - // FIXME: the spec requires that we dispatch the event according to the least - // frequent method between every 350ms (+/-200ms) and for every byte received. - dispatchProgressEvent(expectedLength); -} - -void XMLHttpRequest::dispatchReadyStateChangeEvent() -{ - RefPtr<Event> evt = Event::create(eventNames().readystatechangeEvent, false, false); - if (m_onReadyStateChangeListener) { - evt->setTarget(this); - evt->setCurrentTarget(this); - m_onReadyStateChangeListener->handleEvent(evt.get(), false); - } - - ExceptionCode ec = 0; - dispatchEvent(evt.release(), ec); - ASSERT(!ec); -} - -void XMLHttpRequest::dispatchXMLHttpRequestProgressEvent(EventListener* listener, const AtomicString& type, bool lengthComputable, unsigned loaded, unsigned total) -{ - RefPtr<XMLHttpRequestProgressEvent> evt = XMLHttpRequestProgressEvent::create(type, lengthComputable, loaded, total); - if (listener) { - evt->setTarget(this); - evt->setCurrentTarget(this); - listener->handleEvent(evt.get(), false); - } - - ExceptionCode ec = 0; - dispatchEvent(evt.release(), ec); - ASSERT(!ec); -} - -void XMLHttpRequest::dispatchAbortEvent() -{ - dispatchXMLHttpRequestProgressEvent(m_onAbortListener.get(), eventNames().abortEvent, false, 0, 0); -} - -void XMLHttpRequest::dispatchErrorEvent() -{ - dispatchXMLHttpRequestProgressEvent(m_onErrorListener.get(), eventNames().errorEvent, false, 0, 0); -} - -void XMLHttpRequest::dispatchLoadEvent() -{ - dispatchXMLHttpRequestProgressEvent(m_onLoadListener.get(), eventNames().loadEvent, false, 0, 0); -} - -void XMLHttpRequest::dispatchLoadStartEvent() -{ - dispatchXMLHttpRequestProgressEvent(m_onLoadStartListener.get(), eventNames().loadstartEvent, false, 0, 0); -} - -void XMLHttpRequest::dispatchProgressEvent(long long expectedLength) -{ - dispatchXMLHttpRequestProgressEvent(m_onProgressListener.get(), eventNames().progressEvent, expectedLength && m_receivedLength <= expectedLength, - static_cast<unsigned>(m_receivedLength), static_cast<unsigned>(expectedLength)); -} - bool XMLHttpRequest::canSuspend() const { return !m_loader; @@ -1033,4 +928,14 @@ ScriptExecutionContext* XMLHttpRequest::scriptExecutionContext() const return ActiveDOMObject::scriptExecutionContext(); } +EventTargetData* XMLHttpRequest::eventTargetData() +{ + return &m_eventTargetData; +} + +EventTargetData* XMLHttpRequest::ensureEventTargetData() +{ + return &m_eventTargetData; +} + } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.h b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.h index aa33b8b..30744a0 100644 --- a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.h +++ b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.h @@ -23,6 +23,7 @@ #include "ActiveDOMObject.h" #include "AtomicStringHash.h" #include "EventListener.h" +#include "EventNames.h" #include "EventTarget.h" #include "FormData.h" #include "ResourceResponse.h" @@ -85,32 +86,12 @@ public: XMLHttpRequestUpload* upload(); XMLHttpRequestUpload* optionalUpload() const { return m_upload.get(); } - void setOnreadystatechange(PassRefPtr<EventListener> eventListener) { m_onReadyStateChangeListener = eventListener; } - EventListener* onreadystatechange() const { return m_onReadyStateChangeListener.get(); } - - void setOnabort(PassRefPtr<EventListener> eventListener) { m_onAbortListener = eventListener; } - EventListener* onabort() const { return m_onAbortListener.get(); } - - void setOnerror(PassRefPtr<EventListener> eventListener) { m_onErrorListener = eventListener; } - EventListener* onerror() const { return m_onErrorListener.get(); } - - void setOnload(PassRefPtr<EventListener> eventListener) { m_onLoadListener = eventListener; } - EventListener* onload() const { return m_onLoadListener.get(); } - - void setOnloadstart(PassRefPtr<EventListener> eventListener) { m_onLoadStartListener = eventListener; } - EventListener* onloadstart() const { return m_onLoadStartListener.get(); } - - void setOnprogress(PassRefPtr<EventListener> eventListener) { m_onProgressListener = eventListener; } - EventListener* onprogress() const { return m_onProgressListener.get(); } - - typedef Vector<RefPtr<EventListener> > ListenerVector; - typedef HashMap<AtomicString, ListenerVector> EventListenersMap; - - // useCapture is not used, even for add/remove pairing (for Firefox compatibility). - virtual void addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture); - virtual void removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture); - virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&); - EventListenersMap& eventListeners() { return m_eventListeners; } + DEFINE_ATTRIBUTE_EVENT_LISTENER(readystatechange); + DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); + DEFINE_ATTRIBUTE_EVENT_LISTENER(error); + DEFINE_ATTRIBUTE_EVENT_LISTENER(load); + DEFINE_ATTRIBUTE_EVENT_LISTENER(loadstart); + DEFINE_ATTRIBUTE_EVENT_LISTENER(progress); using RefCounted<XMLHttpRequest>::ref; using RefCounted<XMLHttpRequest>::deref; @@ -120,6 +101,8 @@ private: virtual void refEventTarget() { ref(); } virtual void derefEventTarget() { deref(); } + virtual EventTargetData* eventTargetData(); + virtual EventTargetData* ensureEventTargetData(); Document* document() const; @@ -135,8 +118,6 @@ private: virtual void didFailRedirectCheck(); virtual void didReceiveAuthenticationCancellation(const ResourceResponse&); - void updateAndDispatchOnProgress(unsigned int len); - String responseMIMEType() const; bool responseIsXML() const; @@ -159,22 +140,6 @@ private: void networkError(); void abortError(); - void dispatchReadyStateChangeEvent(); - void dispatchXMLHttpRequestProgressEvent(EventListener* listener, const AtomicString& type, bool lengthComputable, unsigned loaded, unsigned total); - void dispatchAbortEvent(); - void dispatchErrorEvent(); - void dispatchLoadEvent(); - void dispatchLoadStartEvent(); - void dispatchProgressEvent(long long expectedLength); - - RefPtr<EventListener> m_onReadyStateChangeListener; - RefPtr<EventListener> m_onAbortListener; - RefPtr<EventListener> m_onErrorListener; - RefPtr<EventListener> m_onLoadListener; - RefPtr<EventListener> m_onLoadStartListener; - RefPtr<EventListener> m_onProgressListener; - EventListenersMap m_eventListeners; - RefPtr<XMLHttpRequestUpload> m_upload; KURL m_url; @@ -217,6 +182,8 @@ private: unsigned m_lastSendLineNumber; String m_lastSendURL; ExceptionCode m_exceptionCode; + + EventTargetData m_eventTargetData; }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.idl b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.idl index 79005e2..89d9c7f 100644 --- a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.idl +++ b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.idl @@ -30,6 +30,7 @@ module xml { interface [ CustomMarkFunction, + EventTarget, NoStaticTables ] XMLHttpRequest { // From XMLHttpRequestEventTarget diff --git a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequestProgressEvent.h b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequestProgressEvent.h index 02bfdea..27f3b8c 100644 --- a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequestProgressEvent.h +++ b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequestProgressEvent.h @@ -37,7 +37,7 @@ namespace WebCore { { return adoptRef(new XMLHttpRequestProgressEvent); } - static PassRefPtr<XMLHttpRequestProgressEvent> create(const AtomicString& type, bool lengthComputable, unsigned loaded, unsigned total) + static PassRefPtr<XMLHttpRequestProgressEvent> create(const AtomicString& type, bool lengthComputable = false, unsigned loaded = 0, unsigned total = 0) { return adoptRef(new XMLHttpRequestProgressEvent(type, lengthComputable, loaded, total)); } diff --git a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequestUpload.cpp b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequestUpload.cpp index 0fe329d..9d0fafc 100644 --- a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequestUpload.cpp +++ b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequestUpload.cpp @@ -41,11 +41,6 @@ XMLHttpRequestUpload::XMLHttpRequestUpload(XMLHttpRequest* xmlHttpRequest) { } -bool XMLHttpRequestUpload::hasListeners() const -{ - return m_onAbortListener || m_onErrorListener || m_onLoadListener || m_onLoadStartListener || m_onProgressListener || !m_eventListeners.isEmpty(); -} - ScriptExecutionContext* XMLHttpRequestUpload::scriptExecutionContext() const { XMLHttpRequest* xmlHttpRequest = associatedXMLHttpRequest(); @@ -54,95 +49,14 @@ ScriptExecutionContext* XMLHttpRequestUpload::scriptExecutionContext() const return xmlHttpRequest->scriptExecutionContext(); } -void XMLHttpRequestUpload::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> eventListener, bool) -{ - EventListenersMap::iterator iter = m_eventListeners.find(eventType); - if (iter == m_eventListeners.end()) { - ListenerVector listeners; - listeners.append(eventListener); - m_eventListeners.add(eventType, listeners); - } else { - ListenerVector& listeners = iter->second; - for (ListenerVector::iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) { - if (**listenerIter == *eventListener) - return; - } - - listeners.append(eventListener); - m_eventListeners.add(eventType, listeners); - } -} - -void XMLHttpRequestUpload::removeEventListener(const AtomicString& eventType, EventListener* eventListener, bool) -{ - EventListenersMap::iterator iter = m_eventListeners.find(eventType); - if (iter == m_eventListeners.end()) - return; - - ListenerVector& listeners = iter->second; - for (ListenerVector::const_iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) { - if (**listenerIter == *eventListener) { - listeners.remove(listenerIter - listeners.begin()); - return; - } - } -} - -bool XMLHttpRequestUpload::dispatchEvent(PassRefPtr<Event> evt, ExceptionCode& ec) -{ - // FIXME: check for other error conditions enumerated in the spec. - if (!evt || evt->type().isEmpty()) { - ec = EventException::UNSPECIFIED_EVENT_TYPE_ERR; - return true; - } - - ListenerVector listenersCopy = m_eventListeners.get(evt->type()); - for (ListenerVector::const_iterator listenerIter = listenersCopy.begin(); listenerIter != listenersCopy.end(); ++listenerIter) { - evt->setTarget(this); - evt->setCurrentTarget(this); - listenerIter->get()->handleEvent(evt.get(), false); - } - - return !evt->defaultPrevented(); -} - -void XMLHttpRequestUpload::dispatchXMLHttpRequestProgressEvent(EventListener* listener, const AtomicString& type, bool lengthComputable, unsigned loaded, unsigned total) -{ - RefPtr<XMLHttpRequestProgressEvent> evt = XMLHttpRequestProgressEvent::create(type, lengthComputable, loaded, total); - if (listener) { - evt->setTarget(this); - evt->setCurrentTarget(this); - listener->handleEvent(evt.get(), false); - } - - ExceptionCode ec = 0; - dispatchEvent(evt.release(), ec); - ASSERT(!ec); -} - -void XMLHttpRequestUpload::dispatchAbortEvent() -{ - dispatchXMLHttpRequestProgressEvent(m_onAbortListener.get(), eventNames().abortEvent, false, 0, 0); -} - -void XMLHttpRequestUpload::dispatchErrorEvent() -{ - dispatchXMLHttpRequestProgressEvent(m_onErrorListener.get(), eventNames().errorEvent, false, 0, 0); -} - -void XMLHttpRequestUpload::dispatchLoadEvent() -{ - dispatchXMLHttpRequestProgressEvent(m_onLoadListener.get(), eventNames().loadEvent, false, 0, 0); -} - -void XMLHttpRequestUpload::dispatchLoadStartEvent() +EventTargetData* XMLHttpRequestUpload::eventTargetData() { - dispatchXMLHttpRequestProgressEvent(m_onLoadStartListener.get(), eventNames().loadstartEvent, false, 0, 0); + return &m_eventTargetData; } -void XMLHttpRequestUpload::dispatchProgressEvent(long long bytesSent, long long totalBytesToBeSent) +EventTargetData* XMLHttpRequestUpload::ensureEventTargetData() { - dispatchXMLHttpRequestProgressEvent(m_onProgressListener.get(), eventNames().progressEvent, true, static_cast<unsigned>(bytesSent), static_cast<unsigned>(totalBytesToBeSent)); + return &m_eventTargetData; } } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequestUpload.h b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequestUpload.h index b4f40e0..7640643 100644 --- a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequestUpload.h +++ b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequestUpload.h @@ -28,6 +28,7 @@ #include "AtomicStringHash.h" #include "EventListener.h" +#include "EventNames.h" #include "EventTarget.h" #include <wtf/HashMap.h> #include <wtf/RefCounted.h> @@ -48,8 +49,6 @@ namespace WebCore { return adoptRef(new XMLHttpRequestUpload(xmlHttpRequest)); } - bool hasListeners() const; - virtual XMLHttpRequestUpload* toXMLHttpRequestUpload() { return this; } XMLHttpRequest* associatedXMLHttpRequest() const { return m_xmlHttpRequest; } @@ -57,34 +56,11 @@ namespace WebCore { ScriptExecutionContext* scriptExecutionContext() const; - void dispatchAbortEvent(); - void dispatchErrorEvent(); - void dispatchLoadEvent(); - void dispatchLoadStartEvent(); - void dispatchProgressEvent(long long bytesSent, long long totalBytesToBeSent); - - void setOnabort(PassRefPtr<EventListener> eventListener) { m_onAbortListener = eventListener; } - EventListener* onabort() const { return m_onAbortListener.get(); } - - void setOnerror(PassRefPtr<EventListener> eventListener) { m_onErrorListener = eventListener; } - EventListener* onerror() const { return m_onErrorListener.get(); } - - void setOnload(PassRefPtr<EventListener> eventListener) { m_onLoadListener = eventListener; } - EventListener* onload() const { return m_onLoadListener.get(); } - - void setOnloadstart(PassRefPtr<EventListener> eventListener) { m_onLoadStartListener = eventListener; } - EventListener* onloadstart() const { return m_onLoadStartListener.get(); } - - void setOnprogress(PassRefPtr<EventListener> eventListener) { m_onProgressListener = eventListener; } - EventListener* onprogress() const { return m_onProgressListener.get(); } - - typedef Vector<RefPtr<EventListener> > ListenerVector; - typedef HashMap<AtomicString, ListenerVector> EventListenersMap; - - virtual void addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture); - virtual void removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture); - virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&); - EventListenersMap& eventListeners() { return m_eventListeners; } + DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); + DEFINE_ATTRIBUTE_EVENT_LISTENER(error); + DEFINE_ATTRIBUTE_EVENT_LISTENER(load); + DEFINE_ATTRIBUTE_EVENT_LISTENER(loadstart); + DEFINE_ATTRIBUTE_EVENT_LISTENER(progress); using RefCounted<XMLHttpRequestUpload>::ref; using RefCounted<XMLHttpRequestUpload>::deref; @@ -92,19 +68,13 @@ namespace WebCore { private: XMLHttpRequestUpload(XMLHttpRequest*); - void dispatchXMLHttpRequestProgressEvent(EventListener*, const AtomicString& type, bool lengthComputable, unsigned loaded, unsigned total); - virtual void refEventTarget() { ref(); } virtual void derefEventTarget() { deref(); } - - RefPtr<EventListener> m_onAbortListener; - RefPtr<EventListener> m_onErrorListener; - RefPtr<EventListener> m_onLoadListener; - RefPtr<EventListener> m_onLoadStartListener; - RefPtr<EventListener> m_onProgressListener; - EventListenersMap m_eventListeners; + virtual EventTargetData* eventTargetData(); + virtual EventTargetData* ensureEventTargetData(); XMLHttpRequest* m_xmlHttpRequest; + EventTargetData m_eventTargetData; }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequestUpload.idl b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequestUpload.idl index 3172f68..901b47c 100644 --- a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequestUpload.idl +++ b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequestUpload.idl @@ -29,8 +29,9 @@ module xml { interface [ - GenerateConstructor, CustomMarkFunction, + EventTarget, + GenerateConstructor, NoStaticTables ] XMLHttpRequestUpload { // From XMLHttpRequestEventTarget diff --git a/src/3rdparty/webkit/WebCore/xml/XPathValue.cpp b/src/3rdparty/webkit/WebCore/xml/XPathValue.cpp index 29e211e..f5acb38 100644 --- a/src/3rdparty/webkit/WebCore/xml/XPathValue.cpp +++ b/src/3rdparty/webkit/WebCore/xml/XPathValue.cpp @@ -68,7 +68,12 @@ NodeSet& Value::modifiableNodeSet() return m_data->m_nodeSet; } +#if COMPILER(WINSCW) +// FIXME --nl-- Symbian WINSCW compiler complains with 'ambiguous access to overloaded function' (double, unsigned long, unsigned int) +unsigned int Value::toBoolean() const +#else bool Value::toBoolean() const +#endif { switch (m_type) { case NodeSetValue: diff --git a/src/3rdparty/webkit/WebCore/xml/XPathValue.h b/src/3rdparty/webkit/WebCore/xml/XPathValue.h index a0cd24d..bd44c91 100644 --- a/src/3rdparty/webkit/WebCore/xml/XPathValue.h +++ b/src/3rdparty/webkit/WebCore/xml/XPathValue.h @@ -66,8 +66,11 @@ namespace WebCore { Value(Node* value) : m_type(NodeSetValue), m_bool(false), m_number(0), m_data(ValueData::create()) { m_data->m_nodeSet.append(value); } // This is needed to safely implement constructing from bool - with normal function overloading, any pointer type would match. +#if COMPILER(WINSCW) + Value(bool); +#else template<typename T> Value(T); - +#endif static const struct AdoptTag {} adopt; Value(NodeSet& value, const AdoptTag&) : m_type(NodeSetValue), m_bool(false), m_number(0), m_data(ValueData::create()) { value.swap(m_data->m_nodeSet); } @@ -80,7 +83,12 @@ namespace WebCore { const NodeSet& toNodeSet() const; NodeSet& modifiableNodeSet(); +#if COMPILER(WINSCW) + // FIXME --nl-- Symbian WINSCW compiler complains with 'ambiguous access to overloaded function' (double, unsigned long, unsigned int) + unsigned int toBoolean() const; +#else bool toBoolean() const; +#endif double toNumber() const; String toString() const; @@ -90,8 +98,9 @@ namespace WebCore { double m_number; RefPtr<ValueData> m_data; }; - +#if !COMPILER(WINSCW) template<> +#endif inline Value::Value(bool value) : m_type(BooleanValue) , m_bool(value) diff --git a/src/3rdparty/webkit/WebKit/ChangeLog b/src/3rdparty/webkit/WebKit/ChangeLog index a870e74..b317193 100644 --- a/src/3rdparty/webkit/WebKit/ChangeLog +++ b/src/3rdparty/webkit/WebKit/ChangeLog @@ -1,3 +1,26 @@ +2009-09-22 Yaar Schnitman <yaar@chromium.org> + + Reviewed by David Levin. + + Create chromium directory and ported chromium.org's features.gypi for + the webkit chromium port. + + https://bugs.webkit.org/show_bug.cgi?id=29617 + + * chromium/features.gypi: Added. + +2009-09-21 Dan Bernstein <mitz@apple.com> + + Reviewed by Anders Carlsson. + + <rdar://problem/4137135> iFrame with PDF not being handled correctly on + usps.com + https://bugs.webkit.org/show_bug.cgi?id=4151 + + * WebKit.xcodeproj/project.pbxproj: Added WebPDFDocumentExtras.{h,mm} + and WebJSPDFDoc.{h,mm} and changed WebPDFRepresentation to + Objective-C++. + 2009-09-07 Steve Block <steveblock@google.com> Reviewed by Adam Barth. diff --git a/src/3rdparty/webkit/WebKit/mac/Configurations/Version.xcconfig b/src/3rdparty/webkit/WebKit/mac/Configurations/Version.xcconfig index d07d57f..3229ab5 100644 --- a/src/3rdparty/webkit/WebKit/mac/Configurations/Version.xcconfig +++ b/src/3rdparty/webkit/WebKit/mac/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 532; -MINOR_VERSION = 0; +MINOR_VERSION = 1; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebgraphicsitem.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebgraphicsitem.cpp index 1e491c9..196f0b8 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebgraphicsitem.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebgraphicsitem.cpp @@ -23,13 +23,17 @@ #include "qwebframe.h" #include "qwebpage.h" #include "qwebpage_p.h" +#include "QWebPageClient.h" #include <QtGui/QGraphicsScene> #include <QtGui/QGraphicsView> #include <QtGui/qapplication.h> #include <QtGui/qgraphicssceneevent.h> #include <QtGui/qstyleoption.h> +#if defined(Q_WS_X11) +#include <QX11Info> +#endif -class QWebGraphicsItemPrivate { +class QWebGraphicsItemPrivate : public QWebPageClient { public: QWebGraphicsItemPrivate(QWebGraphicsItem* parent) : q(parent) @@ -38,10 +42,17 @@ public: , progress(1.0) {} - void _q_doScroll(int dx, int dy, const QRect&); + virtual void scroll(int dx, int dy, const QRect&); + virtual void update(const QRect& dirtyRect); + + virtual QCursor cursor() const; + virtual void updateCursor(const QCursor& cursor); + + virtual int screenNumber() const; + virtual WId winId() const; + void _q_doLoadProgress(int progress); void _q_doLoadFinished(bool success); - void _q_doUpdate(const QRect& dirtyRect); void _q_setStatusBarMessage(const QString& message); QWebGraphicsItem* q; @@ -74,16 +85,48 @@ void QWebGraphicsItemPrivate::_q_doLoadFinished(bool success) emit q->loadFailed(); } -void QWebGraphicsItemPrivate::_q_doScroll(int dx, int dy, const QRect& rectToScroll) +void QWebGraphicsItemPrivate::scroll(int dx, int dy, const QRect& rectToScroll) { q->scroll(qreal(dx), qreal(dy), QRectF(rectToScroll)); } -void QWebGraphicsItemPrivate::_q_doUpdate(const QRect & dirtyRect) +void QWebGraphicsItemPrivate::update(const QRect & dirtyRect) { q->update(QRectF(dirtyRect)); } +QCursor QWebGraphicsItemPrivate::cursor() const +{ + return q->cursor(); +} + +void QWebGraphicsItemPrivate::updateCursor(const QCursor& cursor) +{ + q->setCursor(cursor); +} + +int QWebGraphicsItemPrivate::screenNumber() const +{ +#if defined(Q_WS_X11) + const QList<QGraphicsView*> views = q->scene()->views(); + + if (!views.isEmpty()) + return views.at(0)->x11Info().screen(); +#endif + + return 0; +} + +WId QWebGraphicsItemPrivate::winId() const +{ + const QList<QGraphicsView*> views = q->scene()->views(); + + if (!views.isEmpty()) + return views.at(0)->winId(); + + return 0; +} + void QWebGraphicsItemPrivate::_q_setStatusBarMessage(const QString& s) { statusBarMessage = s; @@ -175,6 +218,24 @@ bool QWebGraphicsItem::sceneEvent(QEvent* event) bool QWebGraphicsItem::event(QEvent* event) { // Re-implemented in order to allows fixing event-related bugs in patch releases. + + if (d->page) { +#ifndef QT_NO_CURSOR +#if QT_VERSION >= 0x040400 + } else if (event->type() == QEvent::CursorChange) { + // An unsetCursor will set the cursor to Qt::ArrowCursor. + // Thus this cursor change might be a QWidget::unsetCursor() + // If this is not the case and it came from WebCore, the + // QWebPageClient already has set its cursor internally + // to Qt::ArrowCursor, so updating the cursor is always + // right, as it falls back to the last cursor set by + // WebCore. + // FIXME: Add a QEvent::CursorUnset or similar to Qt. + if (cursor().shape() == Qt::ArrowCursor) + d->resetCursor(); +#endif +#endif + } return QGraphicsWidget::event(event); } @@ -193,6 +254,7 @@ void QWebGraphicsItem::setPage(QWebPage* page) return; if (d->page) { + d->page->d->client = 0; // unset the page client if (d->page->parent() == this) delete d->page; else @@ -202,6 +264,7 @@ void QWebGraphicsItem::setPage(QWebPage* page) d->page = page; if (!d->page) return; + d->page->d->client = d; // set the page client QSize size = geometry().size().toSize(); page->setViewportSize(size); @@ -220,10 +283,6 @@ void QWebGraphicsItem::setPage(QWebPage* page) this, SLOT(_q_doLoadProgress(int))); connect(d->page, SIGNAL(loadFinished(bool)), this, SLOT(_q_doLoadFinished(bool))); - connect(d->page, SIGNAL(repaintRequested(QRect)), - this, SLOT(_q_doUpdate(const QRect&))); - connect(d->page, SIGNAL(scrollRequested(int, int, const QRect&)), - this, SLOT(_q_doScroll(int, int, const QRect&))); connect(d->page, SIGNAL(statusBarMessage(const QString&)), this, SLOT(_q_setStatusBarMessage(const QString&))); } diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebgraphicsitem.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebgraphicsitem.h index 223ac42..2c6817a 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebgraphicsitem.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebgraphicsitem.h @@ -133,10 +133,8 @@ protected: virtual bool sceneEvent(QEvent*); private: - Q_PRIVATE_SLOT(d, void _q_doScroll(int dx, int dy, const QRect&)) Q_PRIVATE_SLOT(d, void _q_doLoadProgress(int progress)) Q_PRIVATE_SLOT(d, void _q_doLoadFinished(bool success)) - Q_PRIVATE_SLOT(d, void _q_doUpdate(const QRect& dirtyRect)) Q_PRIVATE_SLOT(d, void _q_setStatusBarMessage(const QString& message)) QWebGraphicsItemPrivate* const d; diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory.cpp index 7923275..5752d66 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory.cpp @@ -20,6 +20,7 @@ #include "config.h" #include "qwebhistory.h" #include "qwebhistory_p.h" +#include "qwebframe_p.h" #include "PlatformString.h" #include "Image.h" @@ -267,6 +268,8 @@ void QWebHistory::clear() lst->setCapacity(capacity); //revert capacity lst->addItem(current.get()); //insert old current item lst->goToItem(current.get()); //and set it as current again + + d->page()->updateNavigationActions(); } /*! @@ -353,9 +356,11 @@ bool QWebHistory::canGoForward() const */ void QWebHistory::back() { - d->lst->goBack(); - WebCore::Page* page = d->lst->page(); - page->goToItem(currentItem().d->item, WebCore::FrameLoadTypeIndexedBackForward); + if (canGoBack()) { + d->lst->goBack(); + WebCore::Page* page = d->lst->page(); + page->goToItem(currentItem().d->item, WebCore::FrameLoadTypeIndexedBackForward); + } } /*! @@ -366,9 +371,11 @@ void QWebHistory::back() */ void QWebHistory::forward() { - d->lst->goForward(); - WebCore::Page* page = d->lst->page(); - page->goToItem(currentItem().d->item, WebCore::FrameLoadTypeIndexedBackForward); + if (canGoForward()) { + d->lst->goForward(); + WebCore::Page* page = d->lst->page(); + page->goToItem(currentItem().d->item, WebCore::FrameLoadTypeIndexedBackForward); + } } /*! @@ -516,6 +523,8 @@ bool QWebHistory::restoreState(const QByteArray& buffer) default: {} // result is false; } + d->page()->updateNavigationActions(); + return result; }; @@ -597,4 +606,7 @@ QDataStream& operator>>(QDataStream& stream, QWebHistory& history) return stream; } - +QWebPagePrivate* QWebHistoryPrivate::page() +{ + return QWebFramePrivate::kit(lst->page()->mainFrame())->page()->handle(); +} diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory_p.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory_p.h index 809d405..a6682cd 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory_p.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory_p.h @@ -25,6 +25,8 @@ #include <QtCore/qglobal.h> #include <QtCore/qshareddata.h> +class QWebPagePrivate; + class Q_AUTOTEST_EXPORT QWebHistoryItemPrivate : public QSharedData { public: static QExplicitlySharedDataPointer<QWebHistoryItemPrivate> get(QWebHistoryItem* q) @@ -57,6 +59,9 @@ public: { lst->deref(); } + + QWebPagePrivate* page(); + WebCore::BackForwardList* lst; }; diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp index 5a66cc6..4578dc9 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp @@ -28,8 +28,6 @@ #include <QResizeEvent> -// TODO: handle the "Always enable" commands with QWebSettings - /*! \class QWebInspector \since 4.6 @@ -44,6 +42,14 @@ \snippet webkitsnippets/qtwebkit_qwebinspector_snippet.cpp 0 + \note A QWebInspector will display a blank widget if either: + \list + \o page() is null + \o QWebSettings::DeveloperExtrasEnabled is false + \endlist + + \section1 Resources + Most of the resources needed by the inspector are owned by the associated QWebPage and are allocated the first time that: \list @@ -56,13 +62,16 @@ the first emission of QWebPage::webInspectorTriggered() to save additional resources. - \note A QWebInspector will display a blank widget if either: - \list - \o page() is null - \o QWebSettings::DeveloperExtrasEnabled is false - \endlist + \section1 Inspector configuration persistence + + The inspector allows the user to configure some options through its + interface (e.g. the resource tracking "Always enable" option). + These settings are persisted automatically by QtWebKit using QSettings. - \sa QWebPage::webInspectorTriggered() + However since the QSettings object is instantiated using the empty + constructor, QCoreApplication::setOrganizationName() and + QCoreApplication::setApplicationName() must be called within your + application to enable the persistence of these options. */ /*! diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp index 98c0770..a6942a4 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp @@ -256,6 +256,7 @@ static inline Qt::DropAction dragOpToDropAction(unsigned actions) QWebPagePrivate::QWebPagePrivate(QWebPage *qq) : q(qq) + , client(0) , view(0) , inspectorFrontend(0) , inspector(0) @@ -1554,8 +1555,10 @@ QWebHistory *QWebPage::history() const */ void QWebPage::setView(QWidget *view) { - d->view = view; - setViewportSize(view ? view->size() : QSize(0, 0)); + if (d->view != view) { + d->view = view; + setViewportSize(view ? view->size() : QSize(0, 0)); + } } /*! @@ -2909,9 +2912,11 @@ QString QWebPage::userAgentForUrl(const QUrl& url) const case QSysInfo::WV_VISTA: ver = "Windows NT 6.0"; break; +#if QT_VERSION > 0x040500 case QSysInfo::WV_WINDOWS7: ver = "Windows NT 6.1"; break; +#endif case QSysInfo::WV_CE: ver = "Windows CE"; break; diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h index f765f98..9f4216a 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h @@ -56,6 +56,7 @@ class QBitArray; QT_END_NAMESPACE class QWebInspector; +class QWebPageClient; class QWebPagePrivate { public: @@ -129,10 +130,11 @@ public: QPointer<QWebFrame> mainFrame; QWebPage *q; + QWebPageClient* client; #ifndef QT_NO_UNDOSTACK QUndoStack *undoStack; #endif - QWidget *view; + QWidget* view; bool insideOpenCall; quint64 m_totalBytes; diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp index e99ebbf..5f74f36 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp @@ -440,7 +440,10 @@ void QWebSettings::resetFontSize(FontSize type) /*! Specifies the location of a user stylesheet to load with every web page. - The \a location can be a URL or a path on the local filesystem. + The \a location must be either a path on the local filesystem, or a data URL + with UTF-8 and Base64 encoded data, such as: + + "data:text/css;charset=utf-8;base64,cCB7IGJhY2tncm91bmQtY29sb3I6IHJlZCB9Ow==;" \sa userStyleSheetUrl() */ @@ -635,7 +638,15 @@ void QWebSettings::clearMemoryCaches() } /*! - Sets the maximum number of pages to hold in the memory cache to \a pages. + Sets the maximum number of pages to hold in the memory page cache to \a pages. + + The Page Cache allows for a nicer user experience when navigating forth or back + to pages in the forward/back history, by pausing and resuming up to \a pages + per page group. + + For more information about the feature, please refer to: + + http://webkit.org/blog/427/webkit-page-cache-i-the-basics/ */ void QWebSettings::setMaximumPagesInCache(int pages) { diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp index d12de94..c7515ab 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp @@ -20,6 +20,8 @@ #include "config.h" #include "qwebview.h" + +#include "QWebPageClient.h" #include "qwebframe.h" #include "qwebpage_p.h" @@ -29,14 +31,28 @@ #include "qprinter.h" #include "qdir.h" #include "qfile.h" +#if defined(Q_WS_X11) +#include <QX11Info> +#endif -class QWebViewPrivate { +class QWebViewPrivate : public QWebPageClient { public: QWebViewPrivate(QWebView *view) : view(view) , page(0) , renderHints(QPainter::TextAntialiasing) - {} + { + Q_ASSERT(view); + } + + virtual void scroll(int dx, int dy, const QRect&); + virtual void update(const QRect& dirtyRect); + + virtual QCursor cursor() const; + virtual void updateCursor(const QCursor& cursor); + + virtual int screenNumber() const; + virtual WId winId() const; void _q_pageDestroyed(); @@ -46,6 +62,44 @@ public: QPainter::RenderHints renderHints; }; +void QWebViewPrivate::scroll(int dx, int dy, const QRect& rectToScroll) +{ + view->scroll(qreal(dx), qreal(dy), rectToScroll); +} + +void QWebViewPrivate::update(const QRect & dirtyRect) +{ + view->update(dirtyRect); +} + +QCursor QWebViewPrivate::cursor() const +{ + return view->cursor(); +} + +void QWebViewPrivate::updateCursor(const QCursor& cursor) +{ + view->setCursor(cursor); +} + +int QWebViewPrivate::screenNumber() const +{ +#if defined(Q_WS_X11) + if (view) + return view->x11Info().screen(); +#endif + + return 0; +} + +WId QWebViewPrivate::winId() const +{ + if (view) + return view->winId(); + + return 0; +} + void QWebViewPrivate::_q_pageDestroyed() { page = 0; @@ -195,6 +249,7 @@ void QWebView::setPage(QWebPage* page) if (d->page == page) return; if (d->page) { + d->page->d->client = 0; // unset the page client if (d->page->parent() == this) delete d->page; else @@ -203,6 +258,7 @@ void QWebView::setPage(QWebPage* page) d->page = page; if (d->page) { d->page->setView(this); + d->page->d->client = d; // set the page client d->page->setPalette(palette()); // #### connect signals QWebFrame *mainFrame = d->page->mainFrame(); @@ -682,24 +738,16 @@ bool QWebView::event(QEvent *e) #ifndef QT_NO_CURSOR #if QT_VERSION >= 0x040400 } else if (e->type() == QEvent::CursorChange) { - // might be a QWidget::unsetCursor() - if (cursor().shape() == Qt::ArrowCursor) { - QVariant prop = property("WebCoreCursor"); - if (prop.isValid()) { - QCursor webCoreCursor = qvariant_cast<QCursor>(prop); - if (webCoreCursor.shape() != Qt::ArrowCursor) - setCursor(webCoreCursor); - } - } - } else if (e->type() == QEvent::DynamicPropertyChange) { - const QByteArray& propName = static_cast<QDynamicPropertyChangeEvent *>(e)->propertyName(); - if (!qstrcmp(propName, "WebCoreCursor")) { - QVariant prop = property("WebCoreCursor"); - if (prop.isValid()) { - QCursor webCoreCursor = qvariant_cast<QCursor>(prop); - setCursor(webCoreCursor); - } - } + // An unsetCursor will set the cursor to Qt::ArrowCursor. + // Thus this cursor change might be a QWidget::unsetCursor() + // If this is not the case and it came from WebCore, the + // QWebPageClient already has set its cursor internally + // to Qt::ArrowCursor, so updating the cursor is always + // right, as it falls back to the last cursor set by + // WebCore. + // FIXME: Add a QEvent::CursorUnset or similar to Qt. + if (cursor().shape() == Qt::ArrowCursor) + d->resetCursor(); #endif #endif } else if (e->type() == QEvent::Leave) diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index c4c9523..7020ec0 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,220 @@ +2009-09-24 Martin Smith <msmith@trolltech.com> + + Reviewed by Simon Hausmann. + + qdoc: Added \brief texts to all the since 4.6 functions. + + * Api/qwebhistory.cpp: + +2009-09-23 J-P Nurmi <jpnurmi@gmail.com> + + Reviewed by Simon Hausmann. + + Prevent QWebPage::setView() from changing the viewport size on the fly + in case the view doesn't actually change. QWebPage::setView() is + called upon every QWebGraphicsItem::hoverMoveEvent(), which forced + the viewport size to be equal to the size of the whole graphics view. + + https://bugs.webkit.org/show_bug.cgi?id=29676 + + * Api/qwebpage.cpp: + (QWebPage::setView): + +2009-09-23 Jedrzej Nowacki <jedrzej.nowacki@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Crash fix in QWebHistory back and forward methods. + + QWebHistory::back() and QWebHistory::forward() were crashing on + ASSERT in WebCore::BackForwardList. The methods should check + canGoBack() and canGoForward() at the beginning. + + https://bugs.webkit.org/show_bug.cgi?id=29675 + + * Api/qwebhistory.cpp: + (QWebHistory::back): + (QWebHistory::forward): + +2009-09-23 Jedrzej Nowacki <jedrzej.nowacki@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Bug fix. QWebHistory should call QWebPage::updateNavigationActions + + In QWebHistory's methods that change item count or current item call + to QWebPage::updateNavigationActions should be executed. + QWebHistory::clear() and QWebHistory::restorState() were changed. + New helper method, QWebPagePrivate accesor, were created in + QWebHistoryPrivate class. + Two autotest were developed. + + https://bugs.webkit.org/show_bug.cgi?id=29246 + + * Api/qwebhistory.cpp: + (QWebHistory::clear): + (QWebHistory::restoreState): + (QWebHistoryPrivate::page): + * Api/qwebhistory_p.h: + * tests/qwebhistory/tst_qwebhistory.cpp: + (tst_QWebHistory::saveAndRestore_1): + (tst_QWebHistory::clear): + +2009-09-23 Norbert Leser <norbert.leser@nokia.com> + + Reviewed by Tor Arne Vestbø. + + Need to guard QX11Info include with Q_WS_X11. + That class may not be available (in QT 4.5 for Symbian, for instance). + Completes fixes in r48627 and r48604. + + * Api/qwebgraphicsitem.cpp: + * Api/qwebview.cpp: + +2009-09-22 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Add default timeout while waiting for signals in QWebPage auto + tests. + https://bugs.webkit.org/show_bug.cgi?id=29637 + + * tests/qwebpage/tst_qwebpage.cpp: + (waitForSignal): + +2009-09-22 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + Reivewed by Simon Hausmann. + + Fix the Qt/Mac build after r48604 (Implement new QWebPageClient class) + + There's no QWidget::x11Info() on Mac, and setPlatformPluginWidget() + takes a QWidget*, not a QWebPageClient* + + * Api/qwebgraphicsitem.cpp: + (QWebGraphicsItemPrivate::screenNumber): + * Api/qwebview.cpp: + (QWebViewPrivate::screenNumber): + +2009-09-21 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Simon Hausmann. + + For Qt, platformPageClient() will now return a class derived from + the QWebPageClient, so the patch adapts our Qt hooks to go though + this class and not depend on the QWebView. + + * Api/qwebgraphicsitem.cpp: + (QWebGraphicsItemPrivate::scroll): + (QWebGraphicsItemPrivate::update): + (QWebGraphicsItemPrivate::cursor): + (QWebGraphicsItemPrivate::updateCursor): + (QWebGraphicsItemPrivate::screenNumber): + (QWebGraphicsItemPrivate::winId): + (QWebGraphicsItem::event): + (QWebGraphicsItem::setPage): + * Api/qwebgraphicsitem.h: + * Api/qwebpage.cpp: + (QWebPagePrivate::QWebPagePrivate): + * Api/qwebpage_p.h: + * Api/qwebview.cpp: + (QWebViewPrivate::scroll): + (QWebViewPrivate::update): + (QWebViewPrivate::cursor): + (QWebViewPrivate::updateCursor): + (QWebViewPrivate::screenNumber): + (QWebViewPrivate::winId): + (QWebView::setPage): + (QWebView::event): + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::repaint): + (WebCore::ChromeClientQt::scroll): + (WebCore::ChromeClientQt::platformPageClient): + +2009-09-21 Yael Aharon <yael.aharon@nokia.com> + + Reviewed by Simon Hausmann. + + https://bugs.webkit.org/show_bug.cgi?id=29609 + Build fix for windows when using Qt 4.5.0. + + * Api/qwebpage.cpp: + (QWebPage::userAgentForUrl): + +2009-09-19 Benjamin Poulain <benjamin.poulain@nokia.com> + + Reviewed by Simon Hausmann. + + https://bugs.webkit.org/show_bug.cgi?id=29345 + The tests of QWebFrame did not use QTRY_VERIFY for + tests involving the event loop. + + * tests/qwebframe/tst_qwebframe.cpp: + * tests/util.h: Added. Copy of tests/shared/util.h of Qt + +2009-09-19 Jakub Wieczorek <faw217@gmail.com> + + Reviewed by Simon Hausmann. + + [Qt] Add an autotest stub for QWebGraphicsItem. + + It just calls all the functions and makes sure they don't crash. + + * tests/qwebgraphicsitem/qwebgraphicsitem.pro: Added. + * tests/qwebgraphicsitem/tst_qwebgraphicsitem.cpp: Added. + (tst_QWebGraphicsItem::qwebgraphicsitem): + * tests/tests.pro: + +2009-09-18 Norbert Leser <norbert.leser@nokia.com> + + Reviewed by Eric Seidel. + + Corrected the Symbian specific UID3 values to be assigned + from the "unprotected" pool that permits self-signing of + those test and demo executables. (Added new UID3 values + where they were missing for new components.) + + * QGVLauncher/QGVLauncher.pro: + * QtLauncher/QtLauncher.pro: + * tests/benchmarks/loading/tst_loading.pro: + * tests/benchmarks/painting/tst_painting.pro: + * tests/qwebelement/qwebelement.pro: + * tests/qwebframe/qwebframe.pro: + * tests/qwebhistory/qwebhistory.pro: + * tests/qwebhistoryinterface/qwebhistoryinterface.pro: + * tests/qwebpage/qwebpage.pro: + * tests/qwebplugindatabase/qwebplugindatabase.pro: + * tests/qwebview/qwebview.pro: + +2009-09-17 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Simon Hausmann. + + Make PlatformWindow return something else than PlatformWidget + https://bugs.webkit.org/show_bug.cgi?id=29085 + + Reflect the rename of platformWindow and it's return type. + + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::platformPageClient): + * WebCoreSupport/ChromeClientQt.h: + +2009-09-18 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Add persistence support for configuration options in the + inspector. + + * Api/qwebinspector.cpp: + * QtLauncher/main.cpp: + (main): + * WebCoreSupport/InspectorClientQt.cpp: + (WebCore::InspectorClientQt::populateSetting): + (WebCore::InspectorClientQt::storeSetting): + (WebCore::variantToSetting): + (WebCore::settingToVariant): + 2009-09-18 Simon Hausmann <simon.hausmann@nokia.com> Reviewed by Ariya Hidayat. @@ -20,6 +237,34 @@ (ConsolePage::javaScriptConsoleMessage): (tst_QWebPage::consoleOutput): +2009-09-17 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Simon Hausmann. + + Improve documentation for Page Cache. + + * Api/qwebsettings.cpp: + +2009-09-17 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Update QWebSettings::setUserStyleSheetUrl() docs and test + + https://bugs.webkit.org/show_bug.cgi?id=29081 + + The documentation now specifies that the URL has to be a local file + or a a data-URL (with utf-8 and base64-encoded data), as these are the + only two schemes that the current code path accepts. + + The auto-test has been updated to reflect this limitation. + + At a later point we should concider adding API for the new way of + doing both user defined stylesheets and scripts. + + * Api/qwebsettings.cpp: + * tests/qwebpage/tst_qwebpage.cpp: + 2009-09-17 Janne Koskinen <janne.p.koskinen@digia.com> Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/WebKit/qt/QGVLauncher/QGVLauncher.pro b/src/3rdparty/webkit/WebKit/qt/QGVLauncher/QGVLauncher.pro index b883b52..dec1c9b 100644 --- a/src/3rdparty/webkit/WebKit/qt/QGVLauncher/QGVLauncher.pro +++ b/src/3rdparty/webkit/WebKit/qt/QGVLauncher/QGVLauncher.pro @@ -10,4 +10,4 @@ QT += network macx:QT+=xml QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -symbian:TARGET.UID3 = 0x200267D0 +symbian:TARGET.UID3 = 0xA000E544 diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp index 9a63e85..5c65112 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp @@ -39,6 +39,7 @@ #include "WindowFeatures.h" #include "DatabaseTracker.h" #include "SecurityOrigin.h" +#include "QWebPageClient.h" #include "qwebpage.h" #include "qwebpage_p.h" @@ -308,12 +309,11 @@ void ChromeClientQt::repaint(const IntRect& windowRect, bool contentChanged, boo { // No double buffer, so only update the QWidget if content changed. if (contentChanged) { - // Only do implicit paints for QWebView's - if (QWebView* view = qobject_cast<QWebView*>(m_webPage->view())) { + if (platformPageClient()) { QRect rect(windowRect); rect = rect.intersected(QRect(QPoint(0, 0), m_webPage->viewportSize())); if (!rect.isEmpty()) - view->update(rect); + platformPageClient()->update(rect); } emit m_webPage->repaintRequested(windowRect); } @@ -324,9 +324,8 @@ void ChromeClientQt::repaint(const IntRect& windowRect, bool contentChanged, boo void ChromeClientQt::scroll(const IntSize& delta, const IntRect& scrollViewRect, const IntRect&) { - // Only do implicit paints for QWebView's - if (QWebView* view = qobject_cast<QWebView*>(m_webPage->view())) - view->scroll(delta.width(), delta.height(), scrollViewRect); + if (platformPageClient()) + platformPageClient()->scroll(delta.width(), delta.height(), scrollViewRect); emit m_webPage->scrollRequested(delta.width(), delta.height(), scrollViewRect); } @@ -342,9 +341,9 @@ IntPoint ChromeClientQt::screenToWindow(const IntPoint& point) const return point; } -PlatformWidget ChromeClientQt::platformWindow() const +PlatformPageClient ChromeClientQt::platformPageClient() const { - return m_webPage->view(); + return m_webPage->d->client; } void ChromeClientQt::contentsSizeChanged(Frame* frame, const IntSize& size) const diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.h b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.h index 7ea6a70..196c4fc 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.h +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.h @@ -105,7 +105,7 @@ namespace WebCore { virtual void scroll(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect); virtual IntPoint screenToWindow(const IntPoint&) const; virtual IntRect windowToScreen(const IntRect&) const; - virtual PlatformWidget platformWindow() const; + virtual PlatformPageClient platformPageClient() const; virtual void contentsSizeChanged(Frame*, const IntSize&) const; virtual void scrollbarsModeDidChange() const { } diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp index ce08d42..340325e 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp @@ -37,6 +37,7 @@ #include "qwebpage_p.h" #include "qwebview.h" +#include <QtCore/QSettings> #include <QtCore/QCoreApplication> #include "InspectorController.h" @@ -46,6 +47,12 @@ namespace WebCore { +static const QLatin1String settingStoragePrefix("Qt/QtWebKit/QWebInspector/"); +static const QLatin1String settingStorageTypeSuffix(".type"); + +static InspectorController::Setting variantToSetting(const QVariant& qvariant); +static QVariant settingToVariant(const InspectorController::Setting& icSetting); + class InspectorClientWebPage : public QWebPage { Q_OBJECT friend class InspectorClientQt; @@ -66,7 +73,6 @@ public: } }; - InspectorClientQt::InspectorClientQt(QWebPage* page) : m_inspectedWebPage(page) {} @@ -169,12 +175,34 @@ void InspectorClientQt::updateWindowTitle() void InspectorClientQt::populateSetting(const String& key, InspectorController::Setting& setting) { - notImplemented(); + QSettings qsettings; + if (qsettings.status() == QSettings::AccessError) { + // QCoreApplication::setOrganizationName and QCoreApplication::setApplicationName haven't been called + qWarning("QWebInspector: QSettings couldn't read configuration setting [%s].", + qPrintable(static_cast<QString>(key))); + return; + } + + QString settingKey(settingStoragePrefix + key); + QString storedValueType = qsettings.value(settingKey + settingStorageTypeSuffix).toString(); + QVariant storedValue = qsettings.value(settingKey); + storedValue.convert(QVariant::nameToType(storedValueType.toAscii().data())); + setting = variantToSetting(storedValue); } void InspectorClientQt::storeSetting(const String& key, const InspectorController::Setting& setting) { - notImplemented(); + QSettings qsettings; + if (qsettings.status() == QSettings::AccessError) { + qWarning("QWebInspector: QSettings couldn't persist configuration setting [%s].", + qPrintable(static_cast<QString>(key))); + return; + } + + QVariant valueToStore = settingToVariant(setting); + QString settingKey(settingStoragePrefix + key); + qsettings.setValue(settingKey, valueToStore); + qsettings.setValue(settingKey + settingStorageTypeSuffix, QVariant::typeToName(valueToStore.type())); } void InspectorClientQt::removeSetting(const String& key) @@ -182,6 +210,68 @@ void InspectorClientQt::removeSetting(const String& key) notImplemented(); } +static InspectorController::Setting variantToSetting(const QVariant& qvariant) +{ + InspectorController::Setting retVal; + + switch (qvariant.type()) { + case QVariant::Bool: + retVal.set(qvariant.toBool()); + break; + case QVariant::Double: + retVal.set(qvariant.toDouble()); + break; + case QVariant::Int: + retVal.set((long)qvariant.toInt()); + break; + case QVariant::String: + retVal.set(qvariant.toString()); + break; + case QVariant::StringList: { + QStringList qsList = qvariant.toStringList(); + int listCount = qsList.count(); + Vector<String> vector(listCount); + for (int i = 0; i < listCount; ++i) + vector[i] = qsList[i]; + retVal.set(vector); + break; + } + } + + return retVal; +} + +static QVariant settingToVariant(const InspectorController::Setting& icSetting) +{ + QVariant retVal; + + switch (icSetting.type()) { + case InspectorController::Setting::StringType: + retVal.setValue(static_cast<QString>(icSetting.string())); + break; + case InspectorController::Setting::StringVectorType: { + const Vector<String>& vector = icSetting.stringVector(); + Vector<String>::const_iterator iter; + QStringList qsList; + for (iter = vector.begin(); iter != vector.end(); ++iter) + qsList << *iter; + retVal.setValue(qsList); + break; + } + case InspectorController::Setting::DoubleType: + retVal.setValue(icSetting.doubleValue()); + break; + case InspectorController::Setting::IntegerType: + retVal.setValue((int)icSetting.integerValue()); + break; + case InspectorController::Setting::BooleanType: + retVal.setValue(icSetting.booleanValue()); + break; + } + + return retVal; +} + } #include "InspectorClientQt.moc" diff --git a/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/loading/tst_loading.pro b/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/loading/tst_loading.pro index af0387e..80717c2 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/loading/tst_loading.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/loading/tst_loading.pro @@ -4,3 +4,5 @@ include(../../../../../WebKit.pri) SOURCES += tst_loading.cpp QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR + +symbian:TARGET.UID3 = 0xA000E541 diff --git a/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/painting/tst_painting.pro b/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/painting/tst_painting.pro index 496210e..f45d804 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/painting/tst_painting.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/painting/tst_painting.pro @@ -4,3 +4,5 @@ include(../../../../../WebKit.pri) SOURCES += tst_painting.cpp QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR + +symbian:TARGET.UID3 = 0xA000E542 diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/qwebelement.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/qwebelement.pro index ea2bc79..0a140ad 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/qwebelement.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/qwebelement.pro @@ -6,4 +6,4 @@ RESOURCES += qwebelement.qrc QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -symbian:TARGET.UID3 = 0x200267C3 +symbian:TARGET.UID3 = 0xA000E53A diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro index a3e099b..81037c3 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro @@ -6,4 +6,4 @@ RESOURCES += qwebframe.qrc QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -symbian:TARGET.UID3 = 0x200267C6 +symbian:TARGET.UID3 = 0xA000E53D diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp index 561087f..729b971 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -34,6 +34,7 @@ #include <QNetworkRequest> #include <QNetworkReply> #include <qsslerror.h> +#include "../util.h" //TESTED_CLASS= //TESTED_FILES= @@ -2446,23 +2447,17 @@ void tst_QWebFrame::popupFocus() view.resize(400, 100); view.show(); view.setFocus(); - QTest::qWait(200); - QVERIFY2(view.hasFocus(), - "The WebView should be created"); + QTRY_VERIFY(view.hasFocus()); // open the popup by clicking. check if focus is on the popup QTest::mouseClick(&view, Qt::LeftButton, 0, QPoint(25, 25)); QObject* webpopup = firstChildByClassName(&view, "WebCore::QWebPopup"); QComboBox* combo = qobject_cast<QComboBox*>(webpopup); - QTest::qWait(500); - QVERIFY2(!view.hasFocus() && combo->view()->hasFocus(), - "Focus sould be on the Popup"); + QTRY_VERIFY(!view.hasFocus() && combo->view()->hasFocus()); // Focus should be on the popup // hide the popup and check if focus is on the page combo->hidePopup(); - QTest::qWait(500); - QVERIFY2(view.hasFocus() && !combo->view()->hasFocus(), - "Focus sould be back on the WebView"); + QTRY_VERIFY(view.hasFocus() && !combo->view()->hasFocus()); // Focus should be back on the WebView // triple the flashing time, should at least blink twice already int delay = qApp->cursorFlashTime() * 3; @@ -2630,16 +2625,16 @@ void tst_QWebFrame::hasSetFocus() QCOMPARE(loadSpy.size(), 2); m_page->mainFrame()->setFocus(); - QVERIFY(m_page->mainFrame()->hasFocus()); + QTRY_VERIFY(m_page->mainFrame()->hasFocus()); for (int i = 0; i < children.size(); ++i) { children.at(i)->setFocus(); - QVERIFY(children.at(i)->hasFocus()); + QTRY_VERIFY(children.at(i)->hasFocus()); QVERIFY(!m_page->mainFrame()->hasFocus()); } m_page->mainFrame()->setFocus(); - QVERIFY(m_page->mainFrame()->hasFocus()); + QTRY_VERIFY(m_page->mainFrame()->hasFocus()); } void tst_QWebFrame::render() diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebgraphicsitem/qwebgraphicsitem.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebgraphicsitem/qwebgraphicsitem.pro new file mode 100644 index 0000000..39e90e7 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebgraphicsitem/qwebgraphicsitem.pro @@ -0,0 +1,6 @@ +TEMPLATE = app +TARGET = tst_qwebgraphicsitem +include(../../../../WebKit.pri) +SOURCES += tst_qwebgraphicsitem.cpp +QT += testlib network +QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebgraphicsitem/tst_qwebgraphicsitem.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebgraphicsitem/tst_qwebgraphicsitem.cpp new file mode 100644 index 0000000..731e342 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebgraphicsitem/tst_qwebgraphicsitem.cpp @@ -0,0 +1,58 @@ +/* + Copyright (C) 2009 Jakub Wieczorek <faw217@gmail.com> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include <QtTest/QtTest> + +#include <qwebgraphicsitem.h> + +class tst_QWebGraphicsItem : public QObject +{ + Q_OBJECT + +private slots: + void qwebgraphicsitem(); +}; + +void tst_QWebGraphicsItem::qwebgraphicsitem() +{ + QWebGraphicsItem item; + item.url(); + item.title(); + item.icon(); + item.zoomFactor(); + item.isInteractive(); + item.progress(); + item.toHtml(); + item.history(); + item.settings(); + item.status(); + item.page(); + item.setPage(0); + item.page(); + item.setUrl(QUrl()); + item.setZoomFactor(0); + item.setInteractive(true); + item.load(QUrl()); + item.setHtml(QString()); + item.setContent(QByteArray()); +} + +QTEST_MAIN(tst_QWebGraphicsItem) + +#include "tst_qwebgraphicsitem.moc" diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/qwebhistory.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/qwebhistory.pro index 55ed414..8ee63cc 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/qwebhistory.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/qwebhistory.pro @@ -6,4 +6,4 @@ RESOURCES += tst_qwebhistory.qrc QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -symbian:TARGET.UID3 = 0x200267C4 +symbian:TARGET.UID3 = 0xA000E53B diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp index ec7a040..4f4d3c4 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp @@ -18,6 +18,7 @@ */ #include <QtTest/QtTest> +#include <QAction> #include "qwebpage.h" #include "qwebview.h" @@ -296,10 +297,13 @@ void tst_QWebHistory::serialize_3() /** Simple checks should be a bit redundant to streaming operators */ void tst_QWebHistory::saveAndRestore_1() { + QAction* actionBack = page->action(QWebPage::Back); hist->back(); waitForLoadFinished.exec(); + QVERIFY(actionBack->isEnabled()); QByteArray buffer(hist->saveState()); hist->clear(); + QVERIFY(!actionBack->isEnabled()); QVERIFY(hist->count() == 1); hist->restoreState(buffer); @@ -310,6 +314,7 @@ void tst_QWebHistory::saveAndRestore_1() QCOMPARE(hist->currentItemIndex(), histsize - 2); QCOMPARE(hist->itemAt(0).title(), QString("page1")); QCOMPARE(hist->itemAt(histsize - 1).title(), QString("page") + QString::number(histsize)); + QVERIFY(actionBack->isEnabled()); } /** Check returns value if there are bad parameters. Actually, result @@ -376,16 +381,20 @@ void tst_QWebHistory::saveAndRestore_crash_3() /** ::clear */ void tst_QWebHistory::clear() { + QAction* actionBack = page->action(QWebPage::Back); + QVERIFY(actionBack->isEnabled()); hist->saveState(); QVERIFY(hist->count() > 1); hist->clear(); - QVERIFY(hist->count() == 1); //leave current item + QVERIFY(hist->count() == 1); // Leave current item. + QVERIFY(!actionBack->isEnabled()); + QWebPage* page2 = new QWebPage(this); QWebHistory* hist2 = page2->history(); QVERIFY(hist2->count() == 0); hist2->clear(); - QVERIFY(hist2->count() == 0); //do not change anything + QVERIFY(hist2->count() == 0); // Do not change anything. delete page2; } diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro index 011869d..53e1afe 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro @@ -5,4 +5,4 @@ SOURCES += tst_qwebhistoryinterface.cpp QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -symbian:TARGET.UID3 = 0x200267C5 +symbian:TARGET.UID3 = 0xA000E53C diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro index e4b11c2..82ffac6 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro @@ -6,4 +6,4 @@ RESOURCES += tst_qwebpage.qrc QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -symbian:TARGET.UID3 = 0x200267C7 +symbian:TARGET.UID3 = 0xA000E53E diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index 47a1426..0fb05b8 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -59,7 +59,7 @@ * \return \p true if the requested signal was received * \p false on timeout */ -static bool waitForSignal(QObject* obj, const char* signal, int timeout = 0) +static bool waitForSignal(QObject* obj, const char* signal, int timeout = 10000) { QEventLoop loop; QObject::connect(obj, signal, &loop, SLOT(quit())); @@ -208,7 +208,7 @@ public: public slots: bool shouldInterruptJavaScript() { - return true; + return true; } }; @@ -346,13 +346,13 @@ void tst_QWebPage::userStyleSheet() m_page->setNetworkAccessManager(networkManager); networkManager->requestedUrls.clear(); - m_page->settings()->setUserStyleSheetUrl(QUrl("data:text/css,p { background-image: url('http://does.not/exist.png');}")); + m_page->settings()->setUserStyleSheetUrl(QUrl("data:text/css;charset=utf-8;base64," + + QByteArray("p { background-image: url('http://does.not/exist.png');}").toBase64())); m_view->setHtml("<p>hello world</p>"); - QVERIFY(::waitForSignal(m_view, SIGNAL(loadFinished(bool)), 1000)); + QVERIFY(::waitForSignal(m_view, SIGNAL(loadFinished(bool)))); - QVERIFY(networkManager->requestedUrls.count() >= 2); - QCOMPARE(networkManager->requestedUrls.at(0), QUrl("data:text/css,p { background-image: url('http://does.not/exist.png');}")); - QCOMPARE(networkManager->requestedUrls.at(1), QUrl("http://does.not/exist.png")); + QVERIFY(networkManager->requestedUrls.count() >= 1); + QCOMPARE(networkManager->requestedUrls.at(0), QUrl("http://does.not/exist.png")); } void tst_QWebPage::modified() @@ -674,7 +674,7 @@ void tst_QWebPage::multiplePageGroupsAndLocalStorage() view1.page()->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true); view1.page()->settings()->setLocalStoragePath(QDir::toNativeSeparators(QDir::currentPath() + "/path1")); qt_webpage_setGroupName(view1.page(), "group1"); - view2.page()->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true); + view2.page()->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true); view2.page()->settings()->setLocalStoragePath(QDir::toNativeSeparators(QDir::currentPath() + "/path2")); qt_webpage_setGroupName(view2.page(), "group2"); QCOMPARE(qt_webpage_groupName(view1.page()), QString("group1")); @@ -945,7 +945,7 @@ void tst_QWebPage::textSelection() QVERIFY(page->action(QWebPage::SelectStartOfDocument) != 0); QVERIFY(page->action(QWebPage::SelectEndOfDocument) != 0); - // right now they are disabled because contentEditable is false and + // right now they are disabled because contentEditable is false and // there isn't an existing selection to modify QCOMPARE(page->action(QWebPage::SelectNextChar)->isEnabled(), false); QCOMPARE(page->action(QWebPage::SelectPreviousChar)->isEnabled(), false); @@ -1114,14 +1114,14 @@ void tst_QWebPage::textEditing() QCOMPARE(page->action(QWebPage::AlignJustified)->isEnabled(), true); QCOMPARE(page->action(QWebPage::AlignLeft)->isEnabled(), true); QCOMPARE(page->action(QWebPage::AlignRight)->isEnabled(), true); - + // make sure these are disabled since there isn't a selection QCOMPARE(page->action(QWebPage::Cut)->isEnabled(), false); QCOMPARE(page->action(QWebPage::RemoveFormat)->isEnabled(), false); - + // make sure everything is selected page->triggerAction(QWebPage::SelectAll); - + // this is only true if there is an editable selection QCOMPARE(page->action(QWebPage::Cut)->isEnabled(), true); QCOMPARE(page->action(QWebPage::RemoveFormat)->isEnabled(), true); diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro index 5d10993..1376ca5 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro @@ -4,3 +4,5 @@ include(../../../../WebKit.pri) SOURCES += tst_qwebplugindatabase.cpp QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR + +symbian:TARGET.UID3 = 0xA000E540 diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro index b7e0fb1..d9d122c 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro @@ -5,4 +5,4 @@ SOURCES += tst_qwebview.cpp QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -symbian:TARGET.UID3 = 0x200267C8 +symbian:TARGET.UID3 = 0xA000E53F diff --git a/src/3rdparty/webkit/WebKit/qt/tests/tests.pro b/src/3rdparty/webkit/WebKit/qt/tests/tests.pro index b5f66ee..ec496e3 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/tests.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/tests.pro @@ -1,4 +1,4 @@ TEMPLATE = subdirs -SUBDIRS = qwebframe qwebpage qwebelement qwebhistoryinterface qwebplugindatabase qwebview qwebhistory +SUBDIRS = qwebframe qwebpage qwebelement qwebgraphicsitem qwebhistoryinterface qwebplugindatabase qwebview qwebhistory greaterThan(QT_MINOR_VERSION, 4): SUBDIRS += benchmarks/painting/tst_painting.pro benchmarks/loading/tst_loading.pro diff --git a/src/3rdparty/webkit/WebKit/qt/tests/util.h b/src/3rdparty/webkit/WebKit/qt/tests/util.h new file mode 100644 index 0000000..7f7e613 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/util.h @@ -0,0 +1,48 @@ +/* + Copyright (C) 2009 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. +*/ +// Functions and macros that really need to be in QTestLib + +// Will try to wait for the condition while allowing event processing +#define QTRY_VERIFY(__expr) \ + do { \ + const int __step = 50; \ + const int __timeout = 5000; \ + if (!(__expr)) { \ + QTest::qWait(0); \ + } \ + for (int __i = 0; __i < __timeout && !(__expr); __i+=__step) { \ + QTest::qWait(__step); \ + } \ + QVERIFY(__expr); \ + } while(0) + +// Will try to wait for the condition while allowing event processing +#define QTRY_COMPARE(__expr, __expected) \ + do { \ + const int __step = 50; \ + const int __timeout = 5000; \ + if ((__expr) != (__expected)) { \ + QTest::qWait(0); \ + } \ + for (int __i = 0; __i < __timeout && ((__expr) != (__expected)); __i+=__step) { \ + QTest::qWait(__step); \ + } \ + QCOMPARE(__expr, __expected); \ + } while(0) + |