diff options
author | Iain Merrick <husky@google.com> | 2010-08-19 17:55:56 +0100 |
---|---|---|
committer | Iain Merrick <husky@google.com> | 2010-08-23 11:05:40 +0100 |
commit | f486d19d62f1bc33246748b14b14a9dfa617b57f (patch) | |
tree | 195485454c93125455a30e553a73981c3816144d /WebKit/chromium | |
parent | 6ba0b43722d16bc295606bec39f396f596e4fef1 (diff) | |
download | external_webkit-f486d19d62f1bc33246748b14b14a9dfa617b57f.zip external_webkit-f486d19d62f1bc33246748b14b14a9dfa617b57f.tar.gz external_webkit-f486d19d62f1bc33246748b14b14a9dfa617b57f.tar.bz2 |
Merge WebKit at r65615 : Initial merge by git.
Change-Id: Ifbf384f4531e3b58475a662e38195c2d9152ae79
Diffstat (limited to 'WebKit/chromium')
56 files changed, 2129 insertions, 1199 deletions
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog index 1486694..0a07733 100644 --- a/WebKit/chromium/ChangeLog +++ b/WebKit/chromium/ChangeLog @@ -1,3 +1,651 @@ +2010-08-17 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: replace hand written InspectorBackendStub.js with generated one. + https://bugs.webkit.org/show_bug.cgi?id=43791 + + * WebKit.gyp: + +2010-08-18 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r65238. + http://trac.webkit.org/changeset/65238 + https://bugs.webkit.org/show_bug.cgi?id=44168 + + Check if clobbering chromium bot fixes the layout test + failures (Requested by hamaji on #webkit). + + * public/WebFrameClient.h: + (WebKit::WebFrameClient::frameDetached): + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::detachedFromParent3): + +2010-08-18 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r65595. + http://trac.webkit.org/changeset/65595 + https://bugs.webkit.org/show_bug.cgi?id=44161 + + qt build failed (Requested by loislo on #webkit). + + * WebKit.gyp: + +2010-08-17 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: replace hand written InspectorBackendStub.js by generated one. + https://bugs.webkit.org/show_bug.cgi?id=43791 + + * WebKit.gyp: + +2010-08-17 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Chromium DevTools: Support runtime property name/value pairs + instead of feature names as navigation state. + https://bugs.webkit.org/show_bug.cgi?id=44054 + + * public/WebDevToolsAgent.h: + * public/WebDevToolsAgentClient.h: + (WebKit::WebDevToolsAgentClient::runtimePropertyChanged): + * src/WebDevToolsAgentImpl.cpp: + (WebKit::WebDevToolsAgentImpl::setRuntimeProperty): + (WebKit::WebDevToolsAgentImpl::setApuAgentEnabled): + * src/WebDevToolsAgentImpl.h: + +2010-08-17 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> + + Reviewed by Darin Adler. + + Add NetworkingContext to avoid layer violations + https://bugs.webkit.org/show_bug.cgi?id=42292 + + Preparation: Just add the files to the build system. + + * WebKit.gyp: Added new files. + * src/FrameNetworkingContextImpl.h: Added. + Placeholder with tentative code that might be changed when landing + the rest of it. + +2010-08-17 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r65516. + http://trac.webkit.org/changeset/65516 + https://bugs.webkit.org/show_bug.cgi?id=44126 + + broke chromium unit tests on mac and linux (Requested by + johnny_g on #webkit). + + * WebKit.gyp: + * src/WebFrameImpl.cpp: + (WebKit::frameContentAsPlainText): + * tests/RunAllTests.cpp: + (main): + * tests/WebFrameTest.cpp: Removed. + +2010-08-17 Jay Civelli <jcivelli@chromium.org> + + Reviewed by Darin Fisher. + + Made WebFrame not report the text from hidden frames. + (some pages contain hidden frames with garbage text that + should not be indexed or used to detect the page's language). + https://bugs.webkit.org/show_bug.cgi?id=39456 + + * WebKit.gyp: + * public/WebCString.h: + (WebKit::operator<): + * public/WebURL.h: + (WebKit::operator<): + * src/WebCString.cpp: + (WebKit::WebCString::compare): + * src/WebFrameImpl.cpp: + (WebKit::frameContentAsPlainText): + * tests/RunAllTests.cpp: + (main): + * tests/WebFrameTest.cpp: Added. + +2010-08-17 Kelly Norton <knorton@google.com> + + Reviewed by Pavel Feldman. + + Web Inspector: Fixes a crash in addTimelineRecord when InspectorTimelineAgent + is enabled through WebDevToolsAgentImpl::setApuEnabled. + https://bugs.webkit.org/show_bug.cgi?id=44105 + + * src/WebDevToolsAgentImpl.cpp: + (WebKit::WebDevToolsAgentImpl::setApuAgentEnabled): + +2010-08-17 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: upstream Chromium debugger step tests + https://bugs.webkit.org/show_bug.cgi?id=44106 + + * src/js/Tests.js: + +2010-08-17 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r65500. + http://trac.webkit.org/changeset/65500 + https://bugs.webkit.org/show_bug.cgi?id=44108 + + Qt bots failed to compile. (Requested by loislo on #webkit). + + * WebKit.gyp: + +2010-08-17 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: replace hand written InspectorBackendStub.js by generated one. + https://bugs.webkit.org/show_bug.cgi?id=43791 + + * WebKit.gyp: + +2010-08-17 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: upstream Chromium console tests and remove a couple + of tests that have already been covered with layout tests. + https://bugs.webkit.org/show_bug.cgi?id=44057 + + * src/js/Tests.js: + (.TestSuite.prototype.testConsoleEval): + (.TestSuite.prototype.testConsoleLog): + (.TestSuite.prototype.testEvalGlobal): + +2010-08-16 Kinuko Yasuda <kinuko@chromium.org> + + Unreviewed; attempt to fix Chromium Windows build. + + * public/WebFileUtilities.h: + +2010-08-16 Kinuko Yasuda <kinuko@chromium.org> + + Reviewed by Jian Li. + + [chromium] Prepare to rename WebFileSystem interface to WebFileUtilities + https://bugs.webkit.org/show_bug.cgi?id=44077 + + We are going to have an implementation for HTML5 FileSystem API and + it would probably be less confusing to use the name "WebFileSystem" + for an WebKit API for the HTML5 API. + + This patch adds WebFileUtilities interface that is meant to replace + the existing WebFileSystem. + + * WebKit.gyp: + * public/WebFileSystem.h: + * public/WebFileUtilities.h: Added. + * public/WebKitClient.h: + (WebKit::WebKitClient::fileUtilities): Added. + * src/ChromiumBridge.cpp: + (WebCore::ChromiumBridge::fileExists): + (WebCore::ChromiumBridge::deleteFile): + (WebCore::ChromiumBridge::deleteEmptyDirectory): + (WebCore::ChromiumBridge::getFileSize): + (WebCore::ChromiumBridge::getFileModificationTime): + (WebCore::ChromiumBridge::directoryName): + (WebCore::ChromiumBridge::pathByAppendingComponent): + (WebCore::ChromiumBridge::makeAllDirectories): + (WebCore::ChromiumBridge::getAbsolutePath): + (WebCore::ChromiumBridge::isDirectory): + (WebCore::ChromiumBridge::filePathToURL): + (WebCore::ChromiumBridge::openFile): + (WebCore::ChromiumBridge::closeFile): + (WebCore::ChromiumBridge::seekFile): + (WebCore::ChromiumBridge::truncateFile): + (WebCore::ChromiumBridge::readFromFile): + (WebCore::ChromiumBridge::writeToFile): + +2010-08-16 Nate Chapin <japhet@chromium.org> + + Unreviewed, build fix. + + Don't include TilingDataTest.cpp, since it doesn't + compile on mac. + + * WebKit.gyp: + +2010-08-16 James Robinson <jamesr@chromium.org> + + Compile fix. Fix up paintsIntoCanvasBuffer impl. + + * src/GraphicsContext3D.cpp: + (WebCore::GraphicsContext3D::paintsIntoCanvasBuffer): + +2010-08-16 Vincent Scheib <scheib@chromium.org> + + Reviewed by Dimitri Glazkov. + + Canvas2D does not support images larger than system's GPU max texture size + https://bugs.webkit.org/show_bug.cgi?id=43864 + + Unit tests for TilingData class. + + * WebKit.gyp: + * tests/TilingDataTest.cpp: Added. + (WebCore::TEST): + +2010-08-16 Alex Milowski <alex@milowski.com> + + Reviewed by David Levin. + + Added the ENABLE_MATHML=1 to the feature_defines. + + * features.gypi: + +2010-08-16 Marcus Bulach <bulach@chromium.org> + + Reviewed by Jeremy Orlow. + + Implements IDBKeyPath extractor. + https://bugs.webkit.org/show_bug.cgi?id=43276 + + Unit-test IDBKeyPathExtractorTest.cpp. + LayoutTests will arrive as IndexedDB infrastructure is fleshed out. + + + * WebKit.gyp: + * public/WebIDBKey.h: + * public/WebIDBKeyPath.h: Added. + (WebKit::WebIDBKeyPath::WebIDBKeyPath): + (WebKit::WebIDBKeyPath::~WebIDBKeyPath): + * public/WebPrivateOwnPtr.h: Added. + (WebKit::WebPrivateOwnPtr::WebPrivateOwnPtr): + (WebKit::WebPrivateOwnPtr::~WebPrivateOwnPtr): + (WebKit::WebPrivateOwnPtr::reset): + (WebKit::WebPrivateOwnPtr::get): + (WebKit::WebPrivateOwnPtr::operator->): + * src/WebIDBKey.cpp: + (WebKit::WebIDBKey::createFromValueAndKeyPath): + * src/WebIDBKeyPath.cpp: Added. + (WebKit::WebIDBKeyPath::create): + (WebKit::WebIDBKeyPath::WebIDBKeyPath): + (WebKit::WebIDBKeyPath::parseError): + (WebKit::WebIDBKeyPath::assign): + (WebKit::WebIDBKeyPath::reset): + (WebKit::WebIDBKeyPath::operator const WTF::Vector<WebCore::IDBKeyPathElement, 0>&): + * tests/IDBBindingUtilitiesTest.cpp: Added. + (WebCore::LocalContext::LocalContext): + (WebCore::LocalContext::~LocalContext): + (WebCore::checkKeyFromValueAndKeyPathInternal): + (WebCore::checkKeyPathNullValue): + (WebCore::checkKeyPathStringValue): + (WebCore::checkKeyPathNumberValue): + (WebCore::TEST): + +2010-07-28 Marcus Bulach <bulach@chromium.org> + + Reviewed by Adam Barth. + + Implement IDBKeyPath parser. + https://bugs.webkit.org/show_bug.cgi?id=42976 + + IDBKeyPath is an internal class, exposed only for unit tests for now. + It'll allow indexed database implementation to traverse a given key path and obtain the corresponding properties + from a SerializedScriptValue. + + * WebKit.gyp: + * tests/IDBKeyPathTest.cpp: Added. + (WebCore::ExpectedToken::ExpectedToken): + (WebCore::checkKeyPath): + (WebCore::TEST): + +2010-08-16 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Joseph Pecoraro. + + Web Inspector: upstream frontend-side WebSocket transport. + https://bugs.webkit.org/show_bug.cgi?id=43970 + + Chromium already has an alternate WebSocket-based communication channel with + the backend. Upstreaming it in this change. We will agree on the URI + of the remote service as the protocol matures. + + * src/WebDevToolsFrontendImpl.cpp: + (WebKit::WebDevToolsFrontendImpl::dispatchOnInspectorFrontend): + * src/js/DevTools.js: + (WebInspector.loaded): + (devtools.domContentLoaded): + +2010-08-16 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: remove utility context related code from debugger agent + https://bugs.webkit.org/show_bug.cgi?id=44049 + + * src/DebuggerAgentManager.cpp: + (WebKit::DebuggerAgentManager::onV8DebugMessage): + (WebKit::DebuggerAgentManager::pauseScript): + * src/DebuggerAgentManager.h: + +2010-08-16 Yuta Kitamura <yutak@chromium.org> + + Reviewed by Shinichiro Hamaji. + + Attempt to fix Chromium's test_shell_tests. + + Port Chromium's WebEntities to HTMLEntityTable + https://bugs.webkit.org/show_bug.cgi?id=44036 + + * src/WebEntities.cpp: + (WebKit::): + +2010-08-15 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Port Chromium's WebEntities to HTMLEntityTable + https://bugs.webkit.org/show_bug.cgi?id=44036 + + This code is wrong and needs to be removed. However, at least after + this patch, it will compile. + + * src/WebEntities.cpp: + (WebKit::): + (WebKit::WebEntities::WebEntities): + * src/WebEntities.h: + +2010-08-13 Satish Sampath <satish@chromium.org> + + Reviewed by Jeremy Orlow. + + Support for multiple speech enabled elements in same page. + https://bugs.webkit.org/show_bug.cgi?id=43922 + + * public/WebSpeechInputController.h: Bubbles up the requestId given by webcore to the embedder. + (WebKit::WebSpeechInputController::startRecognition): + (WebKit::WebSpeechInputController::cancelRecognition): + (WebKit::WebSpeechInputController::stopRecording): + * public/WebSpeechInputListener.h: Passes down the requestId given by embedder to webcore. + (WebKit::WebSpeechInputListener::didCompleteRecording): + (WebKit::WebSpeechInputListener::setRecognitionResult): + (WebKit::WebSpeechInputListener::didCompleteRecognition): + * src/SpeechInputClientImpl.cpp: + (WebKit::SpeechInputClientImpl::setListener): + (WebKit::SpeechInputClientImpl::startRecognition): + (WebKit::SpeechInputClientImpl::stopRecording): + (WebKit::SpeechInputClientImpl::cancelRecognition): + (WebKit::SpeechInputClientImpl::didCompleteRecording): + (WebKit::SpeechInputClientImpl::didCompleteRecognition): + (WebKit::SpeechInputClientImpl::setRecognitionResult): + * src/SpeechInputClientImpl.h: + * src/WebSpeechInputControllerMockImpl.cpp: + (WebKit::WebSpeechInputControllerMockImpl::WebSpeechInputControllerMockImpl): + (WebKit::WebSpeechInputControllerMockImpl::~WebSpeechInputControllerMockImpl): + (WebKit::WebSpeechInputControllerMockImpl::didCompleteRecording): + (WebKit::WebSpeechInputControllerMockImpl::didCompleteRecognition): + (WebKit::WebSpeechInputControllerMockImpl::setRecognitionResult): + (WebKit::WebSpeechInputControllerMockImpl::startRecognition): + (WebKit::WebSpeechInputControllerMockImpl::cancelRecognition): + (WebKit::WebSpeechInputControllerMockImpl::stopRecording): + * src/WebSpeechInputControllerMockImpl.h: + +2010-08-12 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: allow interrupting long running JS to execute inspector command + https://bugs.webkit.org/show_bug.cgi?id=43900 + + * public/WebDevToolsAgent.h: + (WebKit::WebDevToolsAgent::MessageDescriptor::~MessageDescriptor): + * src/WebDevToolsAgentImpl.cpp: + (WebKit::WebDevToolsAgent::interruptAndDispatch): + (WebKit::WebDevToolsAgent::shouldInterruptForMessage): + (WebKit::WebDevToolsAgent::processPendingMessages): + * src/WebDevToolsFrontendImpl.cpp: + (WebKit::WebDevToolsFrontendImpl::WebDevToolsFrontendImpl): + * src/WebDevToolsFrontendImpl.h: + * src/js/DevTools.js: + +2010-08-12 Aaron Boodman <aa@chromium.org> + + Reviewed by David Hyatt. + + Make the cascade level of "user" styles configurable + https://bugs.webkit.org/show_bug.cgi?id=43457 + + * src/WebViewImpl.cpp: + (WebKit::WebView::addUserStyleSheet): + +2010-08-12 John Gregg <johnnyg@google.com> + + Reviewed by Kent Tamura. + + [chromium] Add Notification::detachPresenter to the WebKit API. + https://bugs.webkit.org/show_bug.cgi?id=43659 + + * public/WebNotification.h: + * src/WebNotification.cpp: + (WebKit::WebNotification::detachPresenter): + +2010-08-11 Stephen White <senorblanco@chromium.org> + + Reviewed by David Levin. + + Add support for BGRA pixel format to GraphicsContext3D. + https://bugs.webkit.org/show_bug.cgi?id=43858 + + Although this has been standard in desktop GL since 1.2, it's an + extension in GL ES 2.0, so a query function is provided to check + for support. The DefaultImpl returns false, since it does not yet + implement the TexImage2D internalFormat quirks. + + * public/WebGraphicsContext3D.h: + (WebKit::WebGraphicsContext3D::supportsBGRA): + * src/GraphicsContext3D.cpp: + * src/WebGraphicsContext3DDefaultImpl.cpp: + (WebKit::WebGraphicsContext3DDefaultImpl::supportsBGRA): + * src/WebGraphicsContext3DDefaultImpl.h: + +2010-08-12 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r65181. + http://trac.webkit.org/changeset/65181 + https://bugs.webkit.org/show_bug.cgi?id=43909 + + It broke 35 layout tests fail on chromium-win (Requested by + hamaji on #webkit). + + * public/WebFrameClient.h: + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::detachedFromParent3): + +2010-08-12 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r65221. + http://trac.webkit.org/changeset/65221 + https://bugs.webkit.org/show_bug.cgi?id=43896 + + Broke snow leopard build. (Requested by dave_levin on + #webkit). + + * public/WebGraphicsContext3D.h: + * src/GraphicsContext3D.cpp: + * src/WebGraphicsContext3DDefaultImpl.cpp: + * src/WebGraphicsContext3DDefaultImpl.h: + +2010-08-11 Stephen White <senorblanco@chromium.org> + + Reviewed by David Levin. + + Add support for BGRA pixel format to GraphicsContext3D. + https://bugs.webkit.org/show_bug.cgi?id=43858 + + Although this has been standard in desktop GL since 1.2, it's an + extension in GL ES 2.0, so a query function is provided to check + for support. The DefaultImpl returns false, since it does not yet + implement the TexImage2D internalFormat quirks. + + * public/WebGraphicsContext3D.h: + (WebKit::WebGraphicsContext3D::supportsBGRA): + * src/GraphicsContext3D.cpp: + * src/WebGraphicsContext3DDefaultImpl.cpp: + (WebKit::WebGraphicsContext3DDefaultImpl::supportsBGRA): + * src/WebGraphicsContext3DDefaultImpl.h: + +2010-08-11 James Hawkins <jhawkins@chromium.org> + + Reviewed by Dmitry Titov. + + [Chromium] Notify the WebFrameClient when the frame is detached from + the view. This is used to clear the cached frame in the FormManager. + Eventually this will be removed once handling forms is moved into + WebCore. + https://bugs.webkit.org/show_bug.cgi?id=43648 + + * public/WebFrameClient.h: + (WebKit::WebFrameClient::frameDetached): + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::detachedFromParent3): + +2010-08-11 Dimitri Glazkov <dglazkov@chromium.org> + + Build fix, turn off yet-unbaked DEVICE_ORIENTATION stuff. + + * features.gypi: Turned it off. + +2010-08-11 Evan Stade <estade@chromium.org> + + Reviewed by David Levin. + + [chromium] linux chromium sends double clicks too often + https://bugs.webkit.org/show_bug.cgi?id=43096 + + * WebKit.gyp: add the test + * src/gtk/WebInputEventFactory.cpp: + (WebKit::WebInputEventFactory::mouseEvent): check the x/y coordinates of the + potential double click event + * tests/WebInputEventFactoryTestGtk.cpp: Added. + +2010-08-11 John Abd-El-Malek <jam@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Inform a plugin about the zoom level when it's created + https://bugs.webkit.org/show_bug.cgi?id=42268 + + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::createPlugin): + +2010-08-11 Yury Semikhatsky <yurys@chromium.org> + + Unreviewed. Fix Chromium compilation. + + * DEPS: + +2010-08-11 Yury Semikhatsky <yurys@chromium.org> + + Unreviewed. Chromium build fix. + + * DEPS: bump up Chromium revision. + +2010-08-11 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: remove InjectDispatch.js + https://bugs.webkit.org/show_bug.cgi?id=43835 + + * WebKit.grd: + * src/js/InjectDispatch.js: Removed. + +2010-08-10 Kent Tamura <tkent@chromium.org> + + Unreviewed, build fix. + + Chromium build fix for r65107. + + * src/WebAnimationControllerImpl.cpp: + (WebKit::WebAnimationControllerImpl::suspendAnimations): + (WebKit::WebAnimationControllerImpl::resumeAnimations): + +2010-08-10 Kenneth Russell <kbr@google.com> + + Reviewed by Dimitri Glazkov. + + Roll forward Chromium DEPS to r55584 + https://bugs.webkit.org/show_bug.cgi?id=43811 + + * DEPS: + +2010-08-10 Kavita Kanetkar <kkanetkar@chromium.org> + + Reviewed by Joseph Pecoraro. + + Web Inspector: Support appcache status change for Chrome + https://bugs.webkit.org/show_bug.cgi?id=43531 + + * src/ApplicationCacheHost.cpp: + (WebCore::ApplicationCacheHost::notifyDOMApplicationCache): + +2010-08-10 Kenneth Russell <kbr@google.com> + + Reviewed by Dimitri Glazkov. + + Use Chromium OpenGL bindings rather than GLEW in WebGraphicsContextDefaultImpl + https://bugs.webkit.org/show_bug.cgi?id=43754 + + Deleted per-platform OpenGL context management code, now + abstracted via GLContext. Built and tested in Chromium with + --in-process-webgl flag. + + * WebKit.gyp: + * src/GraphicsContext3D.cpp: + * src/WebGraphicsContext3DDefaultImpl.cpp: + (WebKit::WebGraphicsContext3DDefaultImpl::WebGraphicsContext3DDefaultImpl): + (WebKit::WebGraphicsContext3DDefaultImpl::~WebGraphicsContext3DDefaultImpl): + (WebKit::WebGraphicsContext3DDefaultImpl::initialize): + (WebKit::WebGraphicsContext3DDefaultImpl::validateAttributes): + (WebKit::WebGraphicsContext3DDefaultImpl::makeContextCurrent): + (WebKit::WebGraphicsContext3DDefaultImpl::reshape): + (WebKit::WebGraphicsContext3DDefaultImpl::readBackFramebuffer): + (WebKit::WebGraphicsContext3DDefaultImpl::copyTexImage2D): + (WebKit::WebGraphicsContext3DDefaultImpl::copyTexSubImage2D): + (WebKit::WebGraphicsContext3DDefaultImpl::readPixels): + (WebKit::WebGraphicsContext3DDefaultImpl::createBuffer): + (WebKit::WebGraphicsContext3DDefaultImpl::deleteBuffer): + * src/WebGraphicsContext3DDefaultImpl.h: + +2010-08-10 Jian Li <jianli@chromium.org> + + Another chromium build fix. + + * src/AssertMatchingEnums.cpp: + +2010-08-10 Gavin Barraclough <barraclough@apple.com> + + Rubber stamped by Sam Weinig. + + Bug 43786 - Move AtomicStringHash from WebCore to WTF + Also remove deprecated string headers from WebCore/platform/text. + + * src/WebKit.cpp: + * src/WebPageSerializerImpl.h: + * src/WebString.cpp: + +2010-08-10 James Robinson <jamesr@chromium.org> + + Reviewed by Dimitri Glazkov. + + [chromium] Feature defines are out of sync between features.gypi and downstream feature_overrides.gypi + https://bugs.webkit.org/show_bug.cgi?id=43756 + + This synchronizes the feature defines to what's currently downstream (at r55468). + The difference between the build.webkit.org bots and the chromium bots has + caused strange compilation failures lately. + + * features.gypi: + 2010-08-10 Yury Semikhatsky <yurys@chromium.org> Reviewed by Pavel Feldman. diff --git a/WebKit/chromium/DEPS b/WebKit/chromium/DEPS index d7afc77..b517e28 100644 --- a/WebKit/chromium/DEPS +++ b/WebKit/chromium/DEPS @@ -32,7 +32,7 @@ vars = { 'chromium_svn': 'http://src.chromium.org/svn/trunk/src', - 'chromium_rev': '54723', + 'chromium_rev': '55695', } deps = { diff --git a/WebKit/chromium/WebKit.grd b/WebKit/chromium/WebKit.grd index 1f80034..92ee008 100644 --- a/WebKit/chromium/WebKit.grd +++ b/WebKit/chromium/WebKit.grd @@ -10,7 +10,6 @@ <release seq="1"> <includes> <include name="IDR_DEVTOOLS_DEBUGGER_SCRIPT_JS" file="src\js\DebuggerScript.js" type="BINDATA"/> - <include name="IDR_DEVTOOLS_INJECT_DISPATCH_JS" file="src\js\InjectDispatch.js" type="BINDATA"/> <include name="IDR_DEVTOOLS_INJECT_WEBKIT_JS" file="..\..\WebCore\inspector\front-end\InjectedScript.js" type="BINDATA"/> </includes> </release> diff --git a/WebKit/chromium/WebKit.gyp b/WebKit/chromium/WebKit.gyp index eb5abbe..d12bee7 100644 --- a/WebKit/chromium/WebKit.gyp +++ b/WebKit/chromium/WebKit.gyp @@ -87,6 +87,7 @@ 'msvs_guid': '5ECEC9E5-8F23-47B6-93E0-C3B328B3BE65', 'dependencies': [ '../../WebCore/WebCore.gyp/WebCore.gyp:webcore', + '<(chromium_src_dir)/app/app.gyp:app_base', # For GLContext '<(chromium_src_dir)/skia/skia.gyp:skia', '<(chromium_src_dir)/third_party/npapi/npapi.gyp:npapi', ], @@ -157,6 +158,7 @@ 'public/WebFileChooserParams.h', 'public/WebFileInfo.h', 'public/WebFileSystem.h', + 'public/WebFileUtilities.h', 'public/WebFindOptions.h', 'public/WebFloatPoint.h', 'public/WebFloatRect.h', @@ -185,6 +187,7 @@ 'public/WebIDBKeyRange.h', 'public/WebIDBIndex.h', 'public/WebIDBKey.h', + 'public/WebIDBKeyPath.h', 'public/WebIDBObjectStore.h', 'public/WebInputElement.h', 'public/WebInputEvent.h', @@ -224,6 +227,7 @@ 'public/WebPopupMenuInfo.h', 'public/WebPopupType.h', 'public/WebPrivatePtr.h', + 'public/WebPrivateOwnPtr.h', 'public/WebRange.h', 'public/WebRect.h', 'public/WebRegularExpression.h', @@ -314,9 +318,11 @@ 'src/EventListenerWrapper.h', 'src/FrameLoaderClientImpl.cpp', 'src/FrameLoaderClientImpl.h', + 'src/FrameNetworkingContextImpl.h', 'src/GLES2Context.cpp', 'src/GLES2ContextInternal.cpp', 'src/GLES2ContextInternal.h', + 'src/GraphicsContext3D.cpp', 'src/gtk/WebFontInfo.cpp', 'src/gtk/WebFontInfo.h', 'src/gtk/WebInputEventFactory.cpp', @@ -428,6 +434,7 @@ 'src/WebIDBIndexImpl.cpp', 'src/WebIDBIndexImpl.h', 'src/WebIDBKey.cpp', + 'src/WebIDBKeyPath.cpp', 'src/WebIDBKeyRange.cpp', 'src/WebIDBObjectStoreImpl.cpp', 'src/WebIDBObjectStoreImpl.h', @@ -592,18 +599,6 @@ 'sources/': [['exclude', '/win/']], }], ['"ENABLE_3D_CANVAS=1" in feature_defines', { - # Conditionally compile in GLEW and our GraphicsContext3D implementation. - 'sources+': [ - 'src/GraphicsContext3D.cpp', - '<(chromium_src_dir)/third_party/glew/src/glew.c' - ], - 'include_dirs+': [ - '<(chromium_src_dir)/third_party/glew/include' - ], - 'defines+': [ - 'GLEW_STATIC=1', - 'GLEW_NO_GLU=1', - ], 'conditions': [ ['OS=="mac"', { 'link_settings': { @@ -620,7 +615,10 @@ { 'target_name': 'inspector_resources', 'type': 'none', - 'dependencies': ['devtools_html'], + 'dependencies': [ + 'devtools_html', + '../../WebCore/WebCore.gyp/WebCore.gyp:inspector_protocol_sources', + ], 'conditions': [ ['debug_devtools==0', { 'dependencies': ['concatenated_devtools_js'], @@ -632,6 +630,7 @@ 'files': [ '<@(devtools_files)', '<@(webinspector_files)', + '<(SHARED_INTERMEDIATE_DIR)/webcore/InspectorBackendStub.js', ], 'conditions': [ ['debug_devtools==0', { @@ -678,10 +677,12 @@ '<@(_input_page)', '<@(webinspector_files)', '<@(devtools_files)', + '<(SHARED_INTERMEDIATE_DIR)/webcore/InspectorBackendStub.js', ], 'search_path': [ '../../WebCore/inspector/front-end', 'src/js', + '<(SHARED_INTERMEDIATE_DIR)/webcore', '<(chromium_src_dir)/v8/tools', ], 'outputs': ['<(PRODUCT_DIR)/resources/inspector/DevTools.js'], @@ -713,9 +714,13 @@ ], 'sources': [ 'tests/DragImageTest.cpp', + 'tests/IDBBindingUtilitiesTest.cpp', + 'tests/IDBKeyPathTest.cpp', 'tests/KeyboardTest.cpp', 'tests/KURLTest.cpp', 'tests/RunAllTests.cpp', + # FIXME: This test is compile failing on mac. + # 'tests/TilingDataTest.cpp', ], 'conditions': [ ['OS=="win"', { @@ -732,6 +737,14 @@ 'tests/DragImageTest.cpp', ], }], + ['OS=="linux"', { + 'sources': [ + 'tests/WebInputEventFactoryTestGtk.cpp', + ], + 'include_dirs': [ + 'public/gtk', + ], + }], ], }], ], diff --git a/WebKit/chromium/features.gypi b/WebKit/chromium/features.gypi index 9b758f9..e3092b3 100644 --- a/WebKit/chromium/features.gypi +++ b/WebKit/chromium/features.gypi @@ -38,27 +38,28 @@ # WARNING: build/features_override.gypi which is included in a full # chromium build, overrides this list with its own values. See # features_override.gypi inline documentation for more details. - 'feature_defines%': [ + 'feature_defines': [ 'ENABLE_3D_CANVAS=1', 'ENABLE_BLOB=1', + 'ENABLE_BLOB_SLICE=1', 'ENABLE_CHANNEL_MESSAGING=1', 'ENABLE_DASHBOARD_SUPPORT=0', 'ENABLE_DATABASE=1', 'ENABLE_DATAGRID=0', - 'ENABLE_DEVICE_ORIENTATION=1', + 'ENABLE_DEVICE_ORIENTATION=0', 'ENABLE_DIRECTORY_UPLOAD=1', 'ENABLE_DOM_STORAGE=1', 'ENABLE_EVENTSOURCE=1', - 'ENABLE_FILE_WRITER=1', - 'ENABLE_FILE_SYSTEM=1', + 'ENABLE_FILE_READER=1', 'ENABLE_FILTERS=1', 'ENABLE_GEOLOCATION=1', 'ENABLE_ICONDATABASE=0', - 'ENABLE_IMAGE_RESIZER=0', 'ENABLE_INDEXED_DATABASE=1', 'ENABLE_INPUT_SPEECH=1', 'ENABLE_JAVASCRIPT_DEBUGGER=1', 'ENABLE_JSC_MULTIPLE_THREADS=0', + 'ENABLE_LINK_PREFETCH=1', + 'ENABLE_MATHML=0', 'ENABLE_METER_TAG=1', 'ENABLE_NOTIFICATIONS=1', 'ENABLE_OFFLINE_WEB_APPLICATIONS=1', @@ -75,16 +76,24 @@ 'ENABLE_SVG_FOREIGN_OBJECT=1', 'ENABLE_SVG_USE=1', 'ENABLE_TOUCH_EVENTS=1', + 'ENABLE_V8_SCRIPT_DEBUG_SERVER=1', 'ENABLE_VIDEO=1', 'ENABLE_WEB_SOCKETS=1', 'ENABLE_WEB_TIMING=1', 'ENABLE_WORKERS=1', - 'ENABLE_XHTMLMP=0', 'ENABLE_XPATH=1', 'ENABLE_XSLT=1', - 'WTF_USE_ACCELERATED_COMPOSITING=0', ], - + + 'conditions': [ + ['OS=="win" or OS=="linux"', { + 'feature_defines': [ + 'WTF_USE_ACCELERATED_COMPOSITING=1', + 'ENABLE_3D_RENDERING=1', + ], + }], + ], + 'use_accelerated_compositing%': 0, 'enable_svg%': 1, }, diff --git a/WebKit/chromium/public/WebAnimationController.h b/WebKit/chromium/public/WebAnimationController.h index d727d70..0d3fcf5 100644 --- a/WebKit/chromium/public/WebAnimationController.h +++ b/WebKit/chromium/public/WebAnimationController.h @@ -51,6 +51,8 @@ public: double time) = 0; WEBKIT_API virtual unsigned numberOfActiveAnimations() const = 0; + WEBKIT_API virtual void suspendAnimations() const = 0; + WEBKIT_API virtual void resumeAnimations() const = 0; protected: ~WebAnimationController() { } }; diff --git a/WebKit/chromium/public/WebDevToolsAgent.h b/WebKit/chromium/public/WebDevToolsAgent.h index 4fd1cbd..a355a0f 100644 --- a/WebKit/chromium/public/WebDevToolsAgent.h +++ b/WebKit/chromium/public/WebDevToolsAgent.h @@ -60,6 +60,7 @@ public: virtual void inspectElementAt(const WebPoint&) = 0; virtual void setRuntimeFeatureEnabled(const WebString& feature, bool enabled) = 0; + virtual void setRuntimeProperty(const WebString& name, const WebString& value) = 0; // Exposed for LayoutTestController. virtual void evaluateInWebInspector(long callId, const WebString& script) = 0; @@ -73,6 +74,17 @@ public: // Asynchronously request debugger to pause immediately. WEBKIT_API static void debuggerPauseScript(); + class MessageDescriptor { + public: + virtual ~MessageDescriptor() { } + virtual WebDevToolsAgent* agent() = 0; + virtual WebString message() = 0; + }; + // Asynchronously request debugger to pause immediately and run the command. + WEBKIT_API static void interruptAndDispatch(MessageDescriptor*); + WEBKIT_API static bool shouldInterruptForMessage(const WebString&); + WEBKIT_API static void processPendingMessages(); + typedef void (*MessageLoopDispatchHandler)(); // Installs dispatch handle that is going to be called periodically diff --git a/WebKit/chromium/public/WebDevToolsAgentClient.h b/WebKit/chromium/public/WebDevToolsAgentClient.h index ec013ac..386bd08 100644 --- a/WebKit/chromium/public/WebDevToolsAgentClient.h +++ b/WebKit/chromium/public/WebDevToolsAgentClient.h @@ -51,7 +51,7 @@ public: virtual int hostIdentifier() { return -1; } // Notifies host upon runtime feature being enabled/disabled. - virtual void runtimeFeatureStateChanged(const WebString& feature, bool enabled) { } + virtual void runtimePropertyChanged(const WebString& name, const WebString& value) { } virtual WebCString injectedScriptSource() { return WebCString(); } virtual WebCString debuggerScriptSource() { return WebCString(); } diff --git a/WebKit/chromium/public/WebFileSystem.h b/WebKit/chromium/public/WebFileSystem.h index fc6e6dd..a91106e 100644 --- a/WebKit/chromium/public/WebFileSystem.h +++ b/WebKit/chromium/public/WebFileSystem.h @@ -31,41 +31,12 @@ #ifndef WebFileSystem_h #define WebFileSystem_h -#include "WebCommon.h" -#include "WebString.h" -#include "WebURL.h" +#include "WebFileUtilities.h" namespace WebKit { -class WebFileSystem { -public: -#ifdef WIN32 - typedef HANDLE FileHandle; -#else - typedef int FileHandle; -#endif - - virtual bool fileExists(const WebString& path) { return false; } - virtual bool deleteFile(const WebString& path) { return false; } - virtual bool deleteEmptyDirectory(const WebString& path) { return false; } - virtual bool getFileSize(const WebString& path, long long& result) { return false; } - virtual bool getFileModificationTime(const WebString& path, double& result) { return false; } - virtual WebString directoryName(const WebString& path) { return WebString(); } - virtual WebString pathByAppendingComponent(const WebString& path, const WebString& component) { return WebString(); } - virtual bool makeAllDirectories(const WebString& path) { return false; } - virtual WebString getAbsolutePath(const WebString& path) { return WebString(); } - virtual bool isDirectory(const WebString& path) { return false; } - virtual WebURL filePathToURL(const WebString& path) { return WebURL(); } - virtual FileHandle openFile(const WebString& path, int mode) { return FileHandle(); } - // Should set the FileHandle to a invalid value if the file is closed successfully. - virtual void closeFile(FileHandle&) { } - virtual long long seekFile(FileHandle, long long offset, int origin) { return 0; } - virtual bool truncateFile(FileHandle, long long offset) { return false; } - virtual int readFromFile(FileHandle, char* data, int length) { return 0; } - virtual int writeToFile(FileHandle, const char* data, int length) { return 0; } - -protected: - ~WebFileSystem() {} +// FIXME: Clean up this class once the renaming to WebFileUtilities is done. +class WebFileSystem : public WebFileUtilities { }; } // namespace WebKit diff --git a/WebKit/chromium/public/WebFileUtilities.h b/WebKit/chromium/public/WebFileUtilities.h new file mode 100644 index 0000000..456ba69 --- /dev/null +++ b/WebKit/chromium/public/WebFileUtilities.h @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebFileUtilities_h +#define WebFileUtilities_h + +#include "WebCommon.h" +#include "WebString.h" +#include "WebURL.h" + +#ifdef WIN32 +typedef void *HANDLE; +#endif + +namespace WebKit { + +class WebFileUtilities { +public: +#ifdef WIN32 + typedef HANDLE FileHandle; +#else + typedef int FileHandle; +#endif + + virtual bool fileExists(const WebString& path) { return false; } + virtual bool deleteFile(const WebString& path) { return false; } + virtual bool deleteEmptyDirectory(const WebString& path) { return false; } + virtual bool getFileSize(const WebString& path, long long& result) { return false; } + virtual bool getFileModificationTime(const WebString& path, double& result) { return false; } + virtual WebString directoryName(const WebString& path) { return WebString(); } + virtual WebString pathByAppendingComponent(const WebString& path, const WebString& component) { return WebString(); } + virtual bool makeAllDirectories(const WebString& path) { return false; } + virtual WebString getAbsolutePath(const WebString& path) { return WebString(); } + virtual bool isDirectory(const WebString& path) { return false; } + virtual WebURL filePathToURL(const WebString& path) { return WebURL(); } + virtual FileHandle openFile(const WebString& path, int mode) { return FileHandle(); } + // Should set the FileHandle to a invalid value if the file is closed successfully. + virtual void closeFile(FileHandle&) { } + virtual long long seekFile(FileHandle, long long offset, int origin) { return 0; } + virtual bool truncateFile(FileHandle, long long offset) { return false; } + virtual int readFromFile(FileHandle, char* data, int length) { return 0; } + virtual int writeToFile(FileHandle, const char* data, int length) { return 0; } + +protected: + ~WebFileUtilities() {} +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebFrameClient.h b/WebKit/chromium/public/WebFrameClient.h index 2b7ee0d..91f0e38 100644 --- a/WebKit/chromium/public/WebFrameClient.h +++ b/WebKit/chromium/public/WebFrameClient.h @@ -90,6 +90,12 @@ public: // General notifications ----------------------------------------------- + // This frame has been detached from the view. + // + // FIXME: Do not use this in new code. Currently this is used by code in + // Chromium that errantly caches WebKit objects. + virtual void frameDetached(WebFrame*) { } + // This frame is about to be closed. virtual void willClose(WebFrame*) { } diff --git a/WebKit/chromium/public/WebGraphicsContext3D.h b/WebKit/chromium/public/WebGraphicsContext3D.h index 4378afb..4c18076 100644 --- a/WebKit/chromium/public/WebGraphicsContext3D.h +++ b/WebKit/chromium/public/WebGraphicsContext3D.h @@ -129,6 +129,8 @@ public: // getError in the order they were added. virtual void synthesizeGLError(unsigned long error) = 0; + virtual bool supportsBGRA() = 0; + // The entry points below map directly to the OpenGL ES 2.0 API. // See: http://www.khronos.org/registry/gles/ // and: http://www.khronos.org/opengles/sdk/docs/man/ diff --git a/WebKit/chromium/public/WebIDBKey.h b/WebKit/chromium/public/WebIDBKey.h index 1cf336d..32caa10 100644 --- a/WebKit/chromium/public/WebIDBKey.h +++ b/WebKit/chromium/public/WebIDBKey.h @@ -34,12 +34,16 @@ namespace WebCore { class IDBKey; } namespace WebKit { +class WebIDBKeyPath; +class WebSerializedScriptValue; + class WebIDBKey { public: ~WebIDBKey() { reset(); } WEBKIT_API static WebIDBKey createNull(); WEBKIT_API static WebIDBKey createInvalid(); + WEBKIT_API static WebIDBKey createFromValueAndKeyPath(const WebSerializedScriptValue&, const WebIDBKeyPath&); WebIDBKey(const WebString& string) { assign(string); } WebIDBKey(int32_t number) { assign(number); } diff --git a/WebKit/chromium/public/WebIDBKeyPath.h b/WebKit/chromium/public/WebIDBKeyPath.h new file mode 100644 index 0000000..d08ec63 --- /dev/null +++ b/WebKit/chromium/public/WebIDBKeyPath.h @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebIDBKeyPath_h +#define WebIDBKeyPath_h + +#include "WebCommon.h" +#include "WebPrivateOwnPtr.h" +#include "WebVector.h" + +namespace WebCore { struct IDBKeyPathElement; } + +namespace WTF { template<typename T, size_t inlineCapacity> class Vector; } + +namespace WebKit { + +class WebString; + +class WebIDBKeyPath { +public: + static WebIDBKeyPath create(const WebString&); + WebIDBKeyPath(const WebIDBKeyPath& keyPath) { assign(keyPath); } + ~WebIDBKeyPath() { reset(); } + + WEBKIT_API int parseError() const; + WEBKIT_API void assign(const WebIDBKeyPath&); + WEBKIT_API void reset(); + +#if WEBKIT_IMPLEMENTATION + operator const WTF::Vector<WebCore::IDBKeyPathElement, 0>& () const; +#endif + +private: + WebIDBKeyPath(); + +#if WEBKIT_IMPLEMENTATION + WebIDBKeyPath(const WTF::Vector<WebCore::IDBKeyPathElement, 0>&, int parseError); +#endif + + WebPrivateOwnPtr<WTF::Vector<WebCore::IDBKeyPathElement, 0> > m_private; + int m_parseError; +}; + +} // namespace WebKit + +#endif // WebIDBKeyPath_h diff --git a/WebKit/chromium/public/WebKitClient.h b/WebKit/chromium/public/WebKitClient.h index 5959a1c..4104175 100644 --- a/WebKit/chromium/public/WebKitClient.h +++ b/WebKit/chromium/public/WebKitClient.h @@ -33,6 +33,7 @@ #include "WebCommon.h" #include "WebData.h" +#include "WebFileSystem.h" #include "WebLocalizedString.h" #include "WebString.h" #include "WebURL.h" @@ -49,7 +50,7 @@ class WebApplicationCacheHost; class WebApplicationCacheHostClient; class WebClipboard; class WebCookieJar; -class WebFileSystem; +class WebFileUtilities; class WebGLES2Context; class WebGraphicsContext3D; class WebIDBFactory; @@ -72,8 +73,13 @@ public: virtual WebMimeRegistry* mimeRegistry() { return 0; } // Must return non-null. + // FIXME: Clean up this one once the renaming to WebFileUtilities is done. virtual WebFileSystem* fileSystem() { return 0; } + // Must return non-null. + // FIXME: Clean up this one once the renaming from WebFileSystem is done. + virtual WebFileUtilities* fileUtilities() { return fileSystem(); } + // May return null if sandbox support is not necessary virtual WebSandboxSupport* sandboxSupport() { return 0; } diff --git a/WebKit/chromium/public/WebNotification.h b/WebKit/chromium/public/WebNotification.h index f872111..89dff7a 100644 --- a/WebKit/chromium/public/WebNotification.h +++ b/WebKit/chromium/public/WebNotification.h @@ -83,6 +83,9 @@ public: WEBKIT_API WebString replaceId() const; + // Called if the presenter goes out of scope before the notification does. + WEBKIT_API void detachPresenter(); + // Called to indicate the notification has been displayed. WEBKIT_API void dispatchDisplayEvent(); diff --git a/WebKit/chromium/public/WebPrivateOwnPtr.h b/WebKit/chromium/public/WebPrivateOwnPtr.h new file mode 100644 index 0000000..4bcabcf --- /dev/null +++ b/WebKit/chromium/public/WebPrivateOwnPtr.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebPrivateOwnPtr_h +#define WebPrivateOwnPtr_h + +#include "WebCommon.h" + +namespace WebKit { + +// This class is an implementation detail of the WebKit API. It exists +// to help simplify the implementation of WebKit interfaces that merely +// wrap a pointer to a WebCore class. It's similar to WebPrivatePtr, but it +// wraps a naked pointer rather than a reference counted. +// Note: you must call reset(0) on the implementation side in order to delete +// the WebCore pointer. +template <typename T> +class WebPrivateOwnPtr { +public: + WebPrivateOwnPtr() : m_ptr(0) {} + ~WebPrivateOwnPtr() { WEBKIT_ASSERT(!m_ptr); } + +#if WEBKIT_IMPLEMENTATION + explicit WebPrivateOwnPtr(T* ptr) + : m_ptr(ptr) + { + } + + void reset(T* ptr) + { + delete m_ptr; + m_ptr = ptr; + } + + T* get() const { return m_ptr; } + + T* operator->() const + { + WEBKIT_ASSERT(m_ptr); + return m_ptr; + } +#endif // WEBKIT_IMPLEMENTATION + +private: + T* m_ptr; + + WebPrivateOwnPtr(const WebPrivateOwnPtr&); + void operator=(const WebPrivateOwnPtr&); +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebSpeechInputController.h b/WebKit/chromium/public/WebSpeechInputController.h index 3dba5fb..b85fde6 100644 --- a/WebKit/chromium/public/WebSpeechInputController.h +++ b/WebKit/chromium/public/WebSpeechInputController.h @@ -41,14 +41,21 @@ public: // Starts speech recognition. Speech will get recorded until the endpointer detects silence, // runs to the limit or stopRecording is called. Progress indications and the recognized // text are returned via the listener interface. + virtual bool startRecognition(int) + { + return startRecognition(); + } + // FIXME: Remove this once chromium has picked up this change. virtual bool startRecognition() { - WEBKIT_ASSERT_NOT_REACHED(); - return false; + WEBKIT_ASSERT_NOT_REACHED(); + return false; } // Cancels an ongoing recognition and discards any audio recorded so far. No partial // recognition results are returned to the listener. + virtual void cancelRecognition(int) { cancelRecognition(); } + // FIXME: Remove this once chromium has picked up this change. virtual void cancelRecognition() { WEBKIT_ASSERT_NOT_REACHED(); } // Stops audio recording and performs recognition with the audio recorded until now @@ -56,6 +63,8 @@ public: // wants to stop recording audio as soon as they finished speaking. Otherwise, the speech // recording 'endpointer' should detect silence in the input and stop recording automatically. // Call startRecognition() to record audio and recognize speech again. + virtual void stopRecording(int) { stopRecording(); } + // FIXME: Remove this once chromium has picked up this change. virtual void stopRecording() { WEBKIT_ASSERT_NOT_REACHED(); } protected: diff --git a/WebKit/chromium/public/WebSpeechInputListener.h b/WebKit/chromium/public/WebSpeechInputListener.h index f1756af..e779c3a 100644 --- a/WebKit/chromium/public/WebSpeechInputListener.h +++ b/WebKit/chromium/public/WebSpeechInputListener.h @@ -47,19 +47,34 @@ public: // WebSpeechInputController::stopRecording() was called. // Typically after this call the listener would update the UI to reflect that recognition is // in progress. - virtual void didCompleteRecording() = 0; + virtual void didCompleteRecording(int) = 0; + // FIXME: Remove this once chromium has picked up this change. + virtual void didCompleteRecording() + { + didCompleteRecording(1); + } // Gives results from speech recognition, either partial or the final results. // This method can potentially get called multiple times if there are partial results // available as the user keeps speaking. If the speech could not be recognized properly // or if there was any other errors in the process, this method may never be called. - virtual void setRecognitionResult(const WebString&) = 0; + virtual void setRecognitionResult(int, const WebString&) = 0; + // FIXME: Remove this once chromium has picked up this change. + virtual void setRecognitionResult(const WebString& result) + { + setRecognitionResult(1, result); + } // Informs that speech recognition has completed. This gets invoked irrespective of whether // recognition was succesful or not, whether setRecognitionResult() was invoked or not. The // handler typically frees up any temporary resources allocated and waits for the next speech // recognition request. - virtual void didCompleteRecognition() = 0; + virtual void didCompleteRecognition(int) = 0; + // FIXME: Remove this once chromium has picked up this change. + virtual void didCompleteRecognition() + { + didCompleteRecognition(1); + } protected: ~WebSpeechInputListener() { } diff --git a/WebKit/chromium/src/ApplicationCacheHost.cpp b/WebKit/chromium/src/ApplicationCacheHost.cpp index dfd4754..3bfcfe2 100644 --- a/WebKit/chromium/src/ApplicationCacheHost.cpp +++ b/WebKit/chromium/src/ApplicationCacheHost.cpp @@ -202,6 +202,15 @@ void ApplicationCacheHost::setDOMApplicationCache(DOMApplicationCache* domApplic void ApplicationCacheHost::notifyDOMApplicationCache(EventID id, int total, int done) { +#if ENABLE(INSPECTOR) + // If host's frame is main frame and inspector frontend is connected, update appcache status. + if (id != PROGRESS_EVENT && m_documentLoader->frame()) { + Page* page = m_documentLoader->frame()->page(); + if (page && page->inspectorController()->applicationCacheAgent() && page->mainFrame() == m_documentLoader->frame()) + page->inspectorController()->applicationCacheAgent()->updateApplicationCacheStatus(status()); + } +#endif + if (m_defersEvents) { // Event dispatching is deferred until document.onload has fired. m_deferredEvents.append(DeferredEvent(id, total, done)); diff --git a/WebKit/chromium/src/AssertMatchingEnums.cpp b/WebKit/chromium/src/AssertMatchingEnums.cpp index bcd7931..b93d4bb 100644 --- a/WebKit/chromium/src/AssertMatchingEnums.cpp +++ b/WebKit/chromium/src/AssertMatchingEnums.cpp @@ -45,7 +45,6 @@ #include "PasteboardPrivate.h" #include "PlatformCursor.h" #include "Settings.h" -#include "StringImpl.h" #include "TextAffinity.h" #include "UserContentTypes.h" #include "UserScriptTypes.h" @@ -65,6 +64,7 @@ #include "WebTextCaseSensitivity.h" #include "WebView.h" #include <wtf/Assertions.h> +#include <wtf/text/StringImpl.h> #define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, webcore_name) \ COMPILE_ASSERT(int(WebKit::webkit_name) == int(WebCore::webcore_name), mismatching_enums) diff --git a/WebKit/chromium/src/ChromiumBridge.cpp b/WebKit/chromium/src/ChromiumBridge.cpp index a43109c..5b18e82 100644 --- a/WebKit/chromium/src/ChromiumBridge.cpp +++ b/WebKit/chromium/src/ChromiumBridge.cpp @@ -41,7 +41,7 @@ #include "WebCursorInfo.h" #include "WebData.h" #include "WebDragData.h" -#include "WebFileSystem.h" +#include "WebFileUtilities.h" #include "WebFrameClient.h" #include "WebFrameImpl.h" #include "WebImage.h" @@ -320,28 +320,28 @@ void ChromiumBridge::prefetchDNS(const String& hostname) bool ChromiumBridge::fileExists(const String& path) { - return webKitClient()->fileSystem()->fileExists(path); + return webKitClient()->fileUtilities()->fileExists(path); } bool ChromiumBridge::deleteFile(const String& path) { - return webKitClient()->fileSystem()->deleteFile(path); + return webKitClient()->fileUtilities()->deleteFile(path); } bool ChromiumBridge::deleteEmptyDirectory(const String& path) { - return webKitClient()->fileSystem()->deleteEmptyDirectory(path); + return webKitClient()->fileUtilities()->deleteEmptyDirectory(path); } bool ChromiumBridge::getFileSize(const String& path, long long& result) { - return webKitClient()->fileSystem()->getFileSize(path, result); + return webKitClient()->fileUtilities()->getFileSize(path, result); } bool ChromiumBridge::getFileModificationTime(const String& path, time_t& result) { double modificationTime; - if (!webKitClient()->fileSystem()->getFileModificationTime(path, modificationTime)) + if (!webKitClient()->fileUtilities()->getFileModificationTime(path, modificationTime)) return false; result = static_cast<time_t>(modificationTime); return true; @@ -349,62 +349,62 @@ bool ChromiumBridge::getFileModificationTime(const String& path, time_t& result) String ChromiumBridge::directoryName(const String& path) { - return webKitClient()->fileSystem()->directoryName(path); + return webKitClient()->fileUtilities()->directoryName(path); } String ChromiumBridge::pathByAppendingComponent(const String& path, const String& component) { - return webKitClient()->fileSystem()->pathByAppendingComponent(path, component); + return webKitClient()->fileUtilities()->pathByAppendingComponent(path, component); } bool ChromiumBridge::makeAllDirectories(const String& path) { - return webKitClient()->fileSystem()->makeAllDirectories(path); + return webKitClient()->fileUtilities()->makeAllDirectories(path); } String ChromiumBridge::getAbsolutePath(const String& path) { - return webKitClient()->fileSystem()->getAbsolutePath(path); + return webKitClient()->fileUtilities()->getAbsolutePath(path); } bool ChromiumBridge::isDirectory(const String& path) { - return webKitClient()->fileSystem()->isDirectory(path); + return webKitClient()->fileUtilities()->isDirectory(path); } KURL ChromiumBridge::filePathToURL(const String& path) { - return webKitClient()->fileSystem()->filePathToURL(path); + return webKitClient()->fileUtilities()->filePathToURL(path); } PlatformFileHandle ChromiumBridge::openFile(const String& path, FileOpenMode mode) { - return webKitClient()->fileSystem()->openFile(path, mode); + return webKitClient()->fileUtilities()->openFile(path, mode); } void ChromiumBridge::closeFile(PlatformFileHandle& handle) { - webKitClient()->fileSystem()->closeFile(handle); + webKitClient()->fileUtilities()->closeFile(handle); } long long ChromiumBridge::seekFile(PlatformFileHandle handle, long long offset, FileSeekOrigin origin) { - return webKitClient()->fileSystem()->seekFile(handle, offset, origin); + return webKitClient()->fileUtilities()->seekFile(handle, offset, origin); } bool ChromiumBridge::truncateFile(PlatformFileHandle handle, long long offset) { - return webKitClient()->fileSystem()->truncateFile(handle, offset); + return webKitClient()->fileUtilities()->truncateFile(handle, offset); } int ChromiumBridge::readFromFile(PlatformFileHandle handle, char* data, int length) { - return webKitClient()->fileSystem()->readFromFile(handle, data, length); + return webKitClient()->fileUtilities()->readFromFile(handle, data, length); } int ChromiumBridge::writeToFile(PlatformFileHandle handle, const char* data, int length) { - return webKitClient()->fileSystem()->writeToFile(handle, data, length); + return webKitClient()->fileUtilities()->writeToFile(handle, data, length); } // Font ----------------------------------------------------------------------- diff --git a/WebKit/chromium/src/DebuggerAgentManager.cpp b/WebKit/chromium/src/DebuggerAgentManager.cpp index 1df7172..dfc186c 100644 --- a/WebKit/chromium/src/DebuggerAgentManager.cpp +++ b/WebKit/chromium/src/DebuggerAgentManager.cpp @@ -50,10 +50,6 @@ bool DebuggerAgentManager::s_inHostDispatchHandler = false; DebuggerAgentManager::DeferrersMap DebuggerAgentManager::s_pageDeferrers; -bool DebuggerAgentManager::s_inUtilityContext = false; - -bool DebuggerAgentManager::s_debugBreakDelayed = false; - bool DebuggerAgentManager::s_exposeV8DebuggerProtocol = false; namespace { @@ -208,28 +204,20 @@ void DebuggerAgentManager::onV8DebugMessage(const v8::Debug::Message& message) return; } - if (s_inUtilityContext && message.GetEvent() == v8::Break) { - // This may happen when two tabs are being debugged in the same process. - // Suppose that first debugger is pauesed on an exception. It will run - // nested MessageLoop which may process Break request from the second - // debugger. - s_debugBreakDelayed = true; - } else { - // If the context is from one of the inpected tabs or injected extension - // scripts it must have hostId in the data field. - int hostId = WebCore::V8Proxy::contextDebugId(context); - if (hostId != -1) { - DebuggerAgentImpl* agent = debuggerAgentForHostId(hostId); - if (agent) { - if (agent->autoContinueOnException() - && message.GetEvent() == v8::Exception) { - sendContinueCommandToV8(); - return; - } - - agent->debuggerOutput(out); + // If the context is from one of the inpected tabs or injected extension + // scripts it must have hostId in the data field. + int hostId = WebCore::V8Proxy::contextDebugId(context); + if (hostId != -1) { + DebuggerAgentImpl* agent = debuggerAgentForHostId(hostId); + if (agent) { + if (agent->autoContinueOnException() + && message.GetEvent() == v8::Exception) { + sendContinueCommandToV8(); return; } + + agent->debuggerOutput(out); + return; } } @@ -242,10 +230,7 @@ void DebuggerAgentManager::onV8DebugMessage(const v8::Debug::Message& message) void DebuggerAgentManager::pauseScript() { - if (s_inUtilityContext) - s_debugBreakDelayed = true; - else - v8::Debug::DebugBreak(); + v8::Debug::DebugBreak(); } void DebuggerAgentManager::executeDebuggerCommand(const WTF::String& command, int callerId) diff --git a/WebKit/chromium/src/DebuggerAgentManager.h b/WebKit/chromium/src/DebuggerAgentManager.h index 300cada..66bd714 100644 --- a/WebKit/chromium/src/DebuggerAgentManager.h +++ b/WebKit/chromium/src/DebuggerAgentManager.h @@ -80,23 +80,6 @@ public: static void onNavigate(); - class UtilityContextScope : public Noncopyable { - public: - UtilityContextScope() - { - ASSERT(!s_inUtilityContext); - s_inUtilityContext = true; - } - ~UtilityContextScope() - { - if (s_debugBreakDelayed) { - v8::Debug::DebugBreak(); - s_debugBreakDelayed = false; - } - s_inUtilityContext = false; - } - }; - private: DebuggerAgentManager(); ~DebuggerAgentManager(); @@ -118,8 +101,6 @@ private: typedef HashMap<WebViewImpl*, WebCore::PageGroupLoadDeferrer*> DeferrersMap; static DeferrersMap s_pageDeferrers; - static bool s_inUtilityContext; - static bool s_debugBreakDelayed; static bool s_exposeV8DebuggerProtocol; }; diff --git a/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/WebKit/chromium/src/FrameLoaderClientImpl.cpp index b416e35..74186bf 100644 --- a/WebKit/chromium/src/FrameLoaderClientImpl.cpp +++ b/WebKit/chromium/src/FrameLoaderClientImpl.cpp @@ -37,6 +37,7 @@ #include "FormState.h" #include "FrameLoader.h" #include "FrameLoadRequest.h" +#include "FrameView.h" #include "HTTPParsers.h" #include "HistoryItem.h" #include "HitTestResult.h" @@ -49,6 +50,7 @@ #include "PlatformString.h" #include "PluginData.h" #include "PluginDataChromium.h" +#include "Settings.h" #include "StringExtras.h" #include "WebDataSourceImpl.h" #include "WebDevToolsAgentPrivate.h" @@ -246,7 +248,12 @@ void FrameLoaderClientImpl::detachedFromParent3() // go to a page and then navigate to a new page without getting any asserts // or crashes. m_webFrame->frame()->script()->proxy()->clearForClose(); - + + // Alert the client that the frame is being detached. This is the last + // chance we have to communicate with the client. + if (m_webFrame->client()) + m_webFrame->client()->frameDetached(m_webFrame); + // Stop communicating with the WebFrameClient at this point since we are no // longer associated with the Page. m_webFrame->setClient(0); @@ -1390,6 +1397,14 @@ PassRefPtr<Widget> FrameLoaderClientImpl::createPlugin( if (!webPlugin->initialize(container.get())) return 0; + if (m_webFrame->frame()->view()->zoomFactor() != 1) { + // There's a saved zoom level, so tell the plugin about it since + // WebViewImpl::setZoomLevel was called before the plugin was created. + webPlugin->setZoomFactor( + m_webFrame->frame()->view()->zoomFactor(), + m_webFrame->frame()->page()->settings()->zoomMode() == ZoomTextOnly); + } + // The element might have been removed during plugin initialization! if (!element->renderer()) return 0; diff --git a/WebKit/chromium/src/FrameNetworkingContextImpl.h b/WebKit/chromium/src/FrameNetworkingContextImpl.h new file mode 100644 index 0000000..8670506 --- /dev/null +++ b/WebKit/chromium/src/FrameNetworkingContextImpl.h @@ -0,0 +1,43 @@ +/* + Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef FrameNetworkingContextImpl_h +#define FrameNetworkingContextImpl_h + +#include "FrameNetworkingContext.h" + +namespace WebKit { + +class FrameNetworkingContextImpl : public WebCore::FrameNetworkingContext { +public: + static PassRefPtr<FrameNetworkingContextImpl> create(WebCore::Frame* frame) + { + return adoptRef(new FrameNetworkingContextImpl(frame)); + } + +private: + FrameNetworkingContextImpl(WebCore::Frame* frame) + : WebCore::FrameNetworkingContext(frame) + { + } +}; + +} + +#endif diff --git a/WebKit/chromium/src/GraphicsContext3D.cpp b/WebKit/chromium/src/GraphicsContext3D.cpp index 5b5afef..0f672a3 100644 --- a/WebKit/chromium/src/GraphicsContext3D.cpp +++ b/WebKit/chromium/src/GraphicsContext3D.cpp @@ -85,9 +85,6 @@ namespace WebCore { //---------------------------------------------------------------------- // GraphicsContext3DInternal -// Uncomment this to render to a separate window for debugging -// #define RENDER_TO_DEBUGGING_WINDOW - class GraphicsContext3DInternal { public: GraphicsContext3DInternal(); @@ -105,8 +102,7 @@ public: void reshape(int width, int height); void paintRenderingResultsToCanvas(CanvasRenderingContext* context); - void beginPaint(CanvasRenderingContext* context); - void endPaint(); + bool paintsIntoCanvasBuffer() const; void prepareTexture(); @@ -300,6 +296,7 @@ public: void deleteTexture(unsigned); void synthesizeGLError(unsigned long error); + bool supportsBGRA(); private: OwnPtr<WebKit::WebGraphicsContext3D> m_impl; @@ -452,17 +449,10 @@ void GraphicsContext3DInternal::paintRenderingResultsToCanvas(CanvasRenderingCon #endif } -void GraphicsContext3DInternal::beginPaint(CanvasRenderingContext* context) +bool GraphicsContext3DInternal::paintsIntoCanvasBuffer() const { // If the gpu compositor is on then skip the readback and software rendering path. - if (m_webViewImpl->isAcceleratedCompositingActive()) - return; - - paintRenderingResultsToCanvas(context); -} - -void GraphicsContext3DInternal::endPaint() -{ + return !m_webViewImpl->isAcceleratedCompositingActive(); } void GraphicsContext3DInternal::reshape(int width, int height) @@ -910,6 +900,7 @@ DELEGATE_TO_IMPL_1(deleteShader, unsigned) DELEGATE_TO_IMPL_1(deleteTexture, unsigned) DELEGATE_TO_IMPL_1(synthesizeGLError, unsigned long) +DELEGATE_TO_IMPL_R(supportsBGRA, bool) //---------------------------------------------------------------------- // GraphicsContext3D @@ -1226,8 +1217,11 @@ DELEGATE_TO_INTERNAL_6(vertexAttribPointer, unsigned long, int, int, bool, unsig DELEGATE_TO_INTERNAL_4(viewport, long, long, unsigned long, unsigned long) DELEGATE_TO_INTERNAL_1(paintRenderingResultsToCanvas, CanvasRenderingContext*) -DELEGATE_TO_INTERNAL_1(beginPaint, CanvasRenderingContext*) -DELEGATE_TO_INTERNAL(endPaint) + +bool GraphicsContext3D::paintsIntoCanvasBuffer() const +{ + return m_internal->paintsIntoCanvasBuffer(); +} DELEGATE_TO_INTERNAL_R(createBuffer, unsigned) DELEGATE_TO_INTERNAL_R(createFramebuffer, unsigned) @@ -1244,6 +1238,7 @@ DELEGATE_TO_INTERNAL_1(deleteShader, unsigned) DELEGATE_TO_INTERNAL_1(deleteTexture, unsigned) DELEGATE_TO_INTERNAL_1(synthesizeGLError, unsigned long) +DELEGATE_TO_INTERNAL_R(supportsBGRA, bool) bool GraphicsContext3D::isGLES2Compliant() const { diff --git a/WebKit/chromium/src/SpeechInputClientImpl.cpp b/WebKit/chromium/src/SpeechInputClientImpl.cpp index 66525e3..9c59bae 100644 --- a/WebKit/chromium/src/SpeechInputClientImpl.cpp +++ b/WebKit/chromium/src/SpeechInputClientImpl.cpp @@ -51,41 +51,45 @@ SpeechInputClientImpl::~SpeechInputClientImpl() { } -bool SpeechInputClientImpl::startRecognition(WebCore::SpeechInputListener* listener) +void SpeechInputClientImpl::setListener(WebCore::SpeechInputListener* listener) { m_listener = listener; - return m_controller->startRecognition(); } -void SpeechInputClientImpl::stopRecording() +bool SpeechInputClientImpl::startRecognition(int requestId) { ASSERT(m_listener); - m_controller->stopRecording(); + return m_controller->startRecognition(requestId); } -void SpeechInputClientImpl::cancelRecognition() +void SpeechInputClientImpl::stopRecording(int requestId) { ASSERT(m_listener); - m_controller->cancelRecognition(); + m_controller->stopRecording(requestId); } -void SpeechInputClientImpl::didCompleteRecording() +void SpeechInputClientImpl::cancelRecognition(int requestId) { ASSERT(m_listener); - m_listener->didCompleteRecording(); + m_controller->cancelRecognition(requestId); } -void SpeechInputClientImpl::didCompleteRecognition() +void SpeechInputClientImpl::didCompleteRecording(int requestId) { ASSERT(m_listener); - m_listener->didCompleteRecognition(); - m_listener = 0; + m_listener->didCompleteRecording(requestId); } -void SpeechInputClientImpl::setRecognitionResult(const WebString& result) +void SpeechInputClientImpl::didCompleteRecognition(int requestId) { ASSERT(m_listener); - m_listener->setRecognitionResult(result); + m_listener->didCompleteRecognition(requestId); +} + +void SpeechInputClientImpl::setRecognitionResult(int requestId, const WebString& result) +{ + ASSERT(m_listener); + m_listener->setRecognitionResult(requestId, result); } } // namespace WebKit diff --git a/WebKit/chromium/src/SpeechInputClientImpl.h b/WebKit/chromium/src/SpeechInputClientImpl.h index 5762da8..0ab54c1 100644 --- a/WebKit/chromium/src/SpeechInputClientImpl.h +++ b/WebKit/chromium/src/SpeechInputClientImpl.h @@ -53,18 +53,19 @@ public: virtual ~SpeechInputClientImpl(); // SpeechInputClient methods. - bool startRecognition(WebCore::SpeechInputListener*); - void stopRecording(); - void cancelRecognition(); + void setListener(WebCore::SpeechInputListener*); + bool startRecognition(int); + void stopRecording(int); + void cancelRecognition(int); // WebSpeechInputListener methods. - void didCompleteRecording(); - void setRecognitionResult(const WebString&); - void didCompleteRecognition(); + void didCompleteRecording(int); + void setRecognitionResult(int, const WebString&); + void didCompleteRecognition(int); private: WebSpeechInputController* m_controller; // To call into the embedder. - WebCore::SpeechInputListener* m_listener; // Valid when recognition is in progress. + WebCore::SpeechInputListener* m_listener; }; } // namespace WebKit diff --git a/WebKit/chromium/src/WebAnimationControllerImpl.cpp b/WebKit/chromium/src/WebAnimationControllerImpl.cpp index 32a7a61..15df140 100644 --- a/WebKit/chromium/src/WebAnimationControllerImpl.cpp +++ b/WebKit/chromium/src/WebAnimationControllerImpl.cpp @@ -87,4 +87,24 @@ unsigned WebAnimationControllerImpl::numberOfActiveAnimations() const return controller->numberOfActiveAnimations(); } +void WebAnimationControllerImpl::suspendAnimations() const +{ + AnimationController* controller = animationController(); + if (!controller) + return; + if (!m_frameImpl->frame()) + return; + controller->suspendAnimations(m_frameImpl->frame()->document()); +} + +void WebAnimationControllerImpl::resumeAnimations() const +{ + AnimationController* controller = animationController(); + if (!controller) + return; + if (!m_frameImpl->frame()) + return; + controller->resumeAnimations(m_frameImpl->frame()->document()); +} + } // namespace WebKit diff --git a/WebKit/chromium/src/WebAnimationControllerImpl.h b/WebKit/chromium/src/WebAnimationControllerImpl.h index 66dfe98..62b89f0 100644 --- a/WebKit/chromium/src/WebAnimationControllerImpl.h +++ b/WebKit/chromium/src/WebAnimationControllerImpl.h @@ -52,6 +52,8 @@ public: const WebString& propertyName, double time); virtual unsigned numberOfActiveAnimations() const; + virtual void suspendAnimations() const; + virtual void resumeAnimations() const; private: WebFrameImpl* m_frameImpl; WebCore::AnimationController* animationController() const; diff --git a/WebKit/chromium/src/WebDevToolsAgentImpl.cpp b/WebKit/chromium/src/WebDevToolsAgentImpl.cpp index 4de5624..f4b1a86 100644 --- a/WebKit/chromium/src/WebDevToolsAgentImpl.cpp +++ b/WebKit/chromium/src/WebDevToolsAgentImpl.cpp @@ -36,6 +36,7 @@ #include "InjectedScriptHost.h" #include "InspectorBackendDispatcher.h" #include "InspectorController.h" +#include "InspectorValues.h" #include "Page.h" #include "PageGroup.h" #include "PlatformString.h" @@ -63,7 +64,11 @@ using WebCore::DocumentLoader; using WebCore::FrameLoader; using WebCore::InjectedScriptHost; +using WebCore::InspectorArray; +using WebCore::InspectorBackendDispatcher; using WebCore::InspectorController; +using WebCore::InspectorObject; +using WebCore::InspectorValue; using WebCore::Node; using WebCore::Page; using WebCore::ResourceError; @@ -232,7 +237,7 @@ void WebDevToolsAgentImpl::detach() void WebDevToolsAgentImpl::frontendLoaded() { inspectorController()->connectFrontend(); - m_client->runtimeFeatureStateChanged(kFrontendConnectedFeatureName, true); + m_client->runtimePropertyChanged(kFrontendConnectedFeatureName, "true"); } void WebDevToolsAgentImpl::didNavigate() @@ -263,17 +268,22 @@ void WebDevToolsAgentImpl::inspectElementAt(const WebPoint& point) void WebDevToolsAgentImpl::setRuntimeFeatureEnabled(const WebString& feature, bool enabled) { - if (feature == kApuAgentFeatureName) - setApuAgentEnabled(enabled); - else if (feature == kTimelineFeatureName) - setTimelineProfilingEnabled(enabled); - else if (feature == kResourceTrackingFeatureName) { + setRuntimeProperty(feature, enabled ? String("true") : String("false")); +} + +void WebDevToolsAgentImpl::setRuntimeProperty(const WebString& name, const WebString& value) +{ + if (name == kApuAgentFeatureName) + setApuAgentEnabled(value == "true"); + else if (name == kTimelineFeatureName) + setTimelineProfilingEnabled(value == "true"); + else if (name == kResourceTrackingFeatureName) { InspectorController* ic = inspectorController(); - if (enabled) + if (value == "true") ic->enableResourceTracking(false /* not sticky */, false /* no reload */); else ic->disableResourceTracking(false /* not sticky */); - } else if (feature == kFrontendConnectedFeatureName && enabled && !inspectorController()->hasFrontend()) + } else if (name == kFrontendConnectedFeatureName && value == "true" && !inspectorController()->hasFrontend()) frontendLoaded(); } @@ -282,6 +292,8 @@ void WebDevToolsAgentImpl::setApuAgentEnabled(bool enabled) m_apuAgentEnabled = enabled; InspectorController* ic = inspectorController(); if (enabled) { + if (!ic->hasFrontend()) + frontendLoaded(); m_resourceTrackingWasEnabled = ic->resourceTrackingEnabled(); ic->startTimelineProfiler(); if (!m_resourceTrackingWasEnabled) { @@ -296,9 +308,9 @@ void WebDevToolsAgentImpl::setApuAgentEnabled(bool enabled) ic->disableResourceTracking(false); m_resourceTrackingWasEnabled = false; } - m_client->runtimeFeatureStateChanged( + m_client->runtimePropertyChanged( kApuAgentFeatureName, - enabled); + enabled ? String("true") : String("false")); } WebCore::InspectorController* WebDevToolsAgentImpl::inspectorController() @@ -412,22 +424,22 @@ bool WebDevToolsAgentImpl::sendMessageToFrontend(const WTF::String& message) void WebDevToolsAgentImpl::resourceTrackingWasEnabled() { - m_client->runtimeFeatureStateChanged(kResourceTrackingFeatureName, true); + m_client->runtimePropertyChanged(kResourceTrackingFeatureName, "true"); } void WebDevToolsAgentImpl::resourceTrackingWasDisabled() { - m_client->runtimeFeatureStateChanged(kResourceTrackingFeatureName, false); + m_client->runtimePropertyChanged(kResourceTrackingFeatureName, "false"); } void WebDevToolsAgentImpl::timelineProfilerWasStarted() { - m_client->runtimeFeatureStateChanged(kTimelineFeatureName, true); + m_client->runtimePropertyChanged(kTimelineFeatureName, "true"); } void WebDevToolsAgentImpl::timelineProfilerWasStopped() { - m_client->runtimeFeatureStateChanged(kTimelineFeatureName, false); + m_client->runtimePropertyChanged(kTimelineFeatureName, "false"); } void WebDevToolsAgentImpl::evaluateInWebInspector(long callId, const WebString& script) @@ -455,6 +467,43 @@ void WebDevToolsAgent::debuggerPauseScript() DebuggerAgentManager::pauseScript(); } +void WebDevToolsAgent::interruptAndDispatch(MessageDescriptor* d) +{ + class DebuggerTask : public WebCore::ScriptDebugServer::Task { + public: + DebuggerTask(WebDevToolsAgent::MessageDescriptor* descriptor) : m_descriptor(descriptor) { } + virtual ~DebuggerTask() { } + virtual void run() + { + if (WebDevToolsAgent* webagent = m_descriptor->agent()) + webagent->dispatchOnInspectorBackend(m_descriptor->message()); + } + private: + OwnPtr<WebDevToolsAgent::MessageDescriptor> m_descriptor; + }; + WebCore::ScriptDebugServer::interruptAndRun(new DebuggerTask(d)); +} + +bool WebDevToolsAgent::shouldInterruptForMessage(const WebString& message) +{ + String commandName; + if (!InspectorBackendDispatcher::getCommandName(message, &commandName)) + return false; + return commandName == InspectorBackendDispatcher::pauseCmd + || commandName == InspectorBackendDispatcher::setBreakpointCmd + || commandName == InspectorBackendDispatcher::removeBreakpointCmd + || commandName == InspectorBackendDispatcher::activateBreakpointsCmd + || commandName == InspectorBackendDispatcher::deactivateBreakpointsCmd + || commandName == InspectorBackendDispatcher::startProfilingCmd + || commandName == InspectorBackendDispatcher::stopProfilingCmd + || commandName == InspectorBackendDispatcher::getProfileCmd; +} + +void WebDevToolsAgent::processPendingMessages() +{ + WebCore::ScriptDebugServer::shared().runPendingTasks(); +} + void WebDevToolsAgent::setMessageLoopDispatchHandler(MessageLoopDispatchHandler handler) { DebuggerAgentManager::setMessageLoopDispatchHandler(handler); diff --git a/WebKit/chromium/src/WebDevToolsAgentImpl.h b/WebKit/chromium/src/WebDevToolsAgentImpl.h index a0d2647..73b8a1e 100644 --- a/WebKit/chromium/src/WebDevToolsAgentImpl.h +++ b/WebKit/chromium/src/WebDevToolsAgentImpl.h @@ -77,6 +77,7 @@ public: virtual void inspectElementAt(const WebPoint& point); virtual void evaluateInWebInspector(long callId, const WebString& script); virtual void setRuntimeFeatureEnabled(const WebString& feature, bool enabled); + virtual void setRuntimeProperty(const WebString& name, const WebString& value); virtual void setTimelineProfilingEnabled(bool enable); virtual void identifierForInitialRequest(unsigned long, WebFrame*, const WebURLRequest&); diff --git a/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp b/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp index c1b09c4..905bc6d 100644 --- a/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp +++ b/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp @@ -100,17 +100,6 @@ WebDevToolsFrontendImpl::WebDevToolsFrontendImpl( // Put each DevTools frontend Page into its own (single page) group so that it's not // deferred along with the inspected page. m_webViewImpl->page()->setGroupName(String()); - - WebFrameImpl* frame = m_webViewImpl->mainFrameImpl(); - v8::HandleScope scope; - v8::Handle<v8::Context> frameContext = V8Proxy::context(frame->frame()); - - // Debugger commands should be sent using special method. - BoundObject debuggerCommandExecutorObj(frameContext, this, "RemoteDebuggerCommandExecutor"); - debuggerCommandExecutorObj.addProtoFunction( - "DebuggerPauseScript", - WebDevToolsFrontendImpl::jsDebuggerPauseScript); - debuggerCommandExecutorObj.build(); } WebDevToolsFrontendImpl::~WebDevToolsFrontendImpl() @@ -123,7 +112,7 @@ void WebDevToolsFrontendImpl::dispatchOnInspectorFrontend(const WebString& messa v8::HandleScope scope; v8::Handle<v8::Context> frameContext = V8Proxy::context(frame->frame()); v8::Context::Scope contextScope(frameContext); - v8::Handle<v8::Value> dispatchFunction = frameContext->Global()->Get(v8::String::New("devtools$$dispatch")); + v8::Handle<v8::Value> dispatchFunction = frameContext->Global()->Get(v8::String::New("WebInspector_syncDispatch")); ASSERT(dispatchFunction->IsFunction()); v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(dispatchFunction); Vector< v8::Handle<v8::Value> > args; @@ -138,11 +127,4 @@ void WebDevToolsFrontendImpl::frontendLoaded() m_client->sendFrontendLoaded(); } -v8::Handle<v8::Value> WebDevToolsFrontendImpl::jsDebuggerPauseScript(const v8::Arguments& args) -{ - WebDevToolsFrontendImpl* frontend = static_cast<WebDevToolsFrontendImpl*>(v8::External::Cast(*args.Data())->Value()); - frontend->m_client->sendDebuggerPauseScript(); - return v8::Undefined(); -} - } // namespace WebKit diff --git a/WebKit/chromium/src/WebDevToolsFrontendImpl.h b/WebKit/chromium/src/WebDevToolsFrontendImpl.h index e4f22fe..bde906f 100644 --- a/WebKit/chromium/src/WebDevToolsFrontendImpl.h +++ b/WebKit/chromium/src/WebDevToolsFrontendImpl.h @@ -70,8 +70,6 @@ public: void frontendLoaded(); private: - static v8::Handle<v8::Value> jsDebuggerPauseScript(const v8::Arguments& args); - WebKit::WebViewImpl* m_webViewImpl; WebKit::WebDevToolsFrontendClient* m_client; String m_applicationLocale; diff --git a/WebKit/chromium/src/WebEntities.cpp b/WebKit/chromium/src/WebEntities.cpp index 30b619b..2e05d52 100644 --- a/WebKit/chromium/src/WebEntities.cpp +++ b/WebKit/chromium/src/WebEntities.cpp @@ -33,6 +33,7 @@ #include <string.h> +#include "HTMLEntityTable.h" #include "PlatformString.h" #include "StringBuilder.h" #include <wtf/HashMap.h> @@ -41,59 +42,51 @@ using namespace WebCore; +namespace WebKit { + namespace { -// Note that this file is also included by LegacyHTMLDocumentParser.cpp so we are getting -// two copies of the data in memory. We can fix this by changing the script -// that generated the array to create a static const that is its length, but -// this is low priority since the data is less than 4K. We use anonymous -// namespace to prevent name collisions. -#include "HTMLEntityNames.cpp" // NOLINT -} -namespace WebKit { +void populateMapFromXMLEntities(WTF::HashMap<int, WTF::String>& map) +{ + ASSERT(map.isEmpty()); + map.set(0x003c, "lt"); + map.set(0x003e, "gt"); + map.set(0x0026, "amp"); + map.set(0x0027, "apos"); + map.set(0x0022, "quot"); +} -void populateMap(WTF::HashMap<int, WTF::String>& map, - const Entity* entities, - size_t entitiesCount, - bool standardHTML) +void populateMapFromHTMLEntityTable(WTF::HashMap<int, WTF::String>& map) { ASSERT(map.isEmpty()); - const Entity* entity = &entities[0]; - for (size_t i = 0; i < entitiesCount; i++, entity++) { - int code = entity->code; - String name = entity->name; - // For consistency, use the lowe case for entities that have both. - if (map.contains(code) && map.get(code) == name.lower()) + const HTMLEntityTableEntry* entry = HTMLEntityTable::firstEntry(); + const HTMLEntityTableEntry* end = HTMLEntityTable::lastEntry() + 1; + for (; entry != end; ++entry) { + String entity = entry->entity; + int value = entry->value; + ASSERT(value && !entity.isEmpty()); + if (entity[entity.length() - 1] != ';') + continue; // We want the canonical version that ends in ; + // For consistency, use the lower case for entities that have both. + if (map.contains(value) && map.get(value) == entity.lower()) continue; - // Don't register %, ⊅ and &supl;. - if (standardHTML && (code == '%' || code == 0x2285 || code == 0x00b9)) + // Don't register %, ⊅ and &supl; for some unknown reason. + if (value == '%' || value == 0x2285 || value == 0x00b9) continue; - map.set(code, name); + map.set(value, entity); } - if (standardHTML) - map.set(static_cast<int>(0x0027), String("#39")); + // We add #39 for some unknown reason. + map.set(0x0027, String("#39")); } -static const Entity xmlBuiltInEntityCodes[] = { - { "lt", 0x003c }, - { "gt", 0x003e }, - { "amp", 0x0026 }, - { "apos", 0x0027 }, - { "quot", 0x0022 } -}; +} WebEntities::WebEntities(bool xmlEntities) { if (xmlEntities) - populateMap(m_entitiesMap, - xmlBuiltInEntityCodes, - sizeof(xmlBuiltInEntityCodes) / sizeof(Entity), - false); + populateMapFromXMLEntities(m_entitiesMap); else - populateMap(m_entitiesMap, - wordlist, - sizeof(wordlist) / sizeof(Entity), - true); + populateMapFromHTMLEntityTable(m_entitiesMap); } String WebEntities::entityNameByCode(int code) const diff --git a/WebKit/chromium/src/WebEntities.h b/WebKit/chromium/src/WebEntities.h index a01cc5d..f210566 100644 --- a/WebKit/chromium/src/WebEntities.h +++ b/WebKit/chromium/src/WebEntities.h @@ -36,6 +36,7 @@ namespace WebKit { +// FIXME: This class is wrong and needs to be removed. class WebEntities { public: // ', %, ⊅, &supl; are not defined by the HTML standards. diff --git a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp index 410ac3b..a863862 100644 --- a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp +++ b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp @@ -34,81 +34,16 @@ #include "WebGraphicsContext3DDefaultImpl.h" +#include "app/gfx/gl/gl_bindings.h" +#include "app/gfx/gl/gl_context.h" #include "NotImplemented.h" +#include <wtf/PassOwnPtr.h> #include <stdio.h> #include <string.h> -#if OS(LINUX) -#include <dlfcn.h> -#endif - namespace WebKit { -// Uncomment this to render to a separate window for debugging -// #define RENDER_TO_DEBUGGING_WINDOW - -#if OS(DARWIN) -#define USE_TEXTURE_RECTANGLE_FOR_FRAMEBUFFER -#endif - -bool WebGraphicsContext3DDefaultImpl::s_initializedGLEW = false; - -#if OS(LINUX) -WebGraphicsContext3DDefaultImpl::GLConnection* WebGraphicsContext3DDefaultImpl::s_gl = 0; - -WebGraphicsContext3DDefaultImpl::GLConnection* WebGraphicsContext3DDefaultImpl::GLConnection::create() -{ - Display* dpy = XOpenDisplay(0); - if (!dpy) { - printf("GraphicsContext3D: error opening X display\n"); - return 0; - } - - // We use RTLD_GLOBAL semantics so that GLEW initialization works; - // GLEW expects to be able to open the current process's handle - // and do dlsym's of GL entry points from there. - void* libGL = dlopen("libGL.so.1", RTLD_LAZY | RTLD_GLOBAL); - if (!libGL) { - XCloseDisplay(dpy); - printf("GraphicsContext3D: error opening libGL.so.1: %s\n", dlerror()); - return 0; - } - - PFNGLXCHOOSEFBCONFIGPROC chooseFBConfig = (PFNGLXCHOOSEFBCONFIGPROC) dlsym(libGL, "glXChooseFBConfig"); - PFNGLXCREATENEWCONTEXTPROC createNewContext = (PFNGLXCREATENEWCONTEXTPROC) dlsym(libGL, "glXCreateNewContext"); - PFNGLXCREATEPBUFFERPROC createPbuffer = (PFNGLXCREATEPBUFFERPROC) dlsym(libGL, "glXCreatePbuffer"); - PFNGLXDESTROYPBUFFERPROC destroyPbuffer = (PFNGLXDESTROYPBUFFERPROC) dlsym(libGL, "glXDestroyPbuffer"); - PFNGLXMAKECURRENTPROC makeCurrent = (PFNGLXMAKECURRENTPROC) dlsym(libGL, "glXMakeCurrent"); - PFNGLXDESTROYCONTEXTPROC destroyContext = (PFNGLXDESTROYCONTEXTPROC) dlsym(libGL, "glXDestroyContext"); - PFNGLXGETCURRENTCONTEXTPROC getCurrentContext = (PFNGLXGETCURRENTCONTEXTPROC) dlsym(libGL, "glXGetCurrentContext"); - if (!chooseFBConfig || !createNewContext || !createPbuffer - || !destroyPbuffer || !makeCurrent || !destroyContext - || !getCurrentContext) { - XCloseDisplay(dpy); - dlclose(libGL); - printf("GraphicsContext3D: error looking up bootstrapping entry points\n"); - return 0; - } - return new GLConnection(dpy, - libGL, - chooseFBConfig, - createNewContext, - createPbuffer, - destroyPbuffer, - makeCurrent, - destroyContext, - getCurrentContext); -} - -WebGraphicsContext3DDefaultImpl::GLConnection::~GLConnection() -{ - XCloseDisplay(m_display); - dlclose(m_libGL); -} - -#endif // OS(LINUX) - WebGraphicsContext3DDefaultImpl::VertexAttribPointerState::VertexAttribPointerState() : enabled(false) , buffer(0) @@ -134,20 +69,6 @@ WebGraphicsContext3DDefaultImpl::WebGraphicsContext3DDefaultImpl() , m_scanline(0) #endif , m_boundArrayBuffer(0) -#if OS(WINDOWS) - , m_canvasWindow(0) - , m_canvasDC(0) - , m_contextObj(0) -#elif PLATFORM(CG) - , m_pbuffer(0) - , m_contextObj(0) - , m_renderOutput(0) -#elif OS(LINUX) - , m_contextObj(0) - , m_pbuffer(0) -#else -#error Must port to your platform -#endif { } @@ -155,7 +76,7 @@ WebGraphicsContext3DDefaultImpl::~WebGraphicsContext3DDefaultImpl() { if (m_initialized) { makeContextCurrent(); -#ifndef RENDER_TO_DEBUGGING_WINDOW + if (m_attributes.antialias) { glDeleteRenderbuffersEXT(1, &m_multisampleColorBuffer); if (m_attributes.depth || m_attributes.stencil) @@ -171,220 +92,19 @@ WebGraphicsContext3DDefaultImpl::~WebGraphicsContext3DDefaultImpl() delete[] m_scanline; #endif glDeleteFramebuffersEXT(1, &m_fbo); -#endif // !RENDER_TO_DEBUGGING_WINDOW -#if OS(WINDOWS) - wglewMakeCurrent(0, 0); - wglewDeleteContext(m_contextObj); - ReleaseDC(m_canvasWindow, m_canvasDC); - DestroyWindow(m_canvasWindow); -#elif PLATFORM(CG) - CGLSetCurrentContext(0); - CGLDestroyContext(m_contextObj); - CGLDestroyPBuffer(m_pbuffer); - if (m_renderOutput) - delete[] m_renderOutput; -#elif OS(LINUX) - s_gl->makeCurrent(0, 0); - s_gl->destroyContext(m_contextObj); - s_gl->destroyPbuffer(m_pbuffer); -#else -#error Must port to your platform -#endif - m_contextObj = 0; + + m_glContext->Destroy(); } } bool WebGraphicsContext3DDefaultImpl::initialize(WebGraphicsContext3D::Attributes attributes, WebView* webView) { -#if OS(WINDOWS) - if (!s_initializedGLEW) { - // Do this only the first time through. - if (!wglewInit()) { - printf("WebGraphicsContext3DDefaultImpl: wglewInit failed\n"); - return false; - } - } - - WNDCLASS wc; - if (!GetClassInfo(GetModuleHandle(0), L"CANVASGL", &wc)) { - ZeroMemory(&wc, sizeof(WNDCLASS)); - wc.style = CS_OWNDC; - wc.hInstance = GetModuleHandle(0); - wc.lpfnWndProc = DefWindowProc; - wc.lpszClassName = L"CANVASGL"; - - if (!RegisterClass(&wc)) { - printf("WebGraphicsContext3DDefaultImpl: RegisterClass failed\n"); - return false; - } - } - - m_canvasWindow = CreateWindow(L"CANVASGL", L"CANVASGL", - WS_CAPTION, - CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, 0, 0, GetModuleHandle(0), 0); - if (!m_canvasWindow) { - printf("WebGraphicsContext3DDefaultImpl: CreateWindow failed\n"); - return false; - } - - // get the device context - m_canvasDC = GetDC(m_canvasWindow); - if (!m_canvasDC) { - printf("WebGraphicsContext3DDefaultImpl: GetDC failed\n"); - return false; - } - - // find default pixel format - PIXELFORMATDESCRIPTOR pfd; - ZeroMemory(&pfd, sizeof(PIXELFORMATDESCRIPTOR)); - pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR); - pfd.nVersion = 1; -#ifdef RENDER_TO_DEBUGGING_WINDOW - pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; -#else - pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL; -#endif - int pixelformat = ChoosePixelFormat(m_canvasDC, &pfd); - - // set the pixel format for the dc - if (!SetPixelFormat(m_canvasDC, pixelformat, &pfd)) { - printf("WebGraphicsContext3DDefaultImpl: SetPixelFormat failed\n"); - return false; - } - - // create rendering context - m_contextObj = wglewCreateContext(m_canvasDC); - if (!m_contextObj) { - printf("WebGraphicsContext3DDefaultImpl: wglCreateContext failed\n"); - return false; - } - - if (!wglewMakeCurrent(m_canvasDC, m_contextObj)) { - printf("WebGraphicsContext3DDefaultImpl: wglMakeCurrent failed\n"); - return false; - } - -#ifdef RENDER_TO_DEBUGGING_WINDOW - typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval); - PFNWGLSWAPINTERVALEXTPROC setSwapInterval = 0; - setSwapInterval = (PFNWGLSWAPINTERVALEXTPROC) wglewGetProcAddress("wglSwapIntervalEXT"); - if (setSwapInterval) - setSwapInterval(1); -#endif // RENDER_TO_DEBUGGING_WINDOW - -#elif PLATFORM(CG) - // Create a 1x1 pbuffer and associated context to bootstrap things - CGLPixelFormatAttribute attribs[] = { - (CGLPixelFormatAttribute) kCGLPFAPBuffer, - (CGLPixelFormatAttribute) 0 - }; - CGLPixelFormatObj pixelFormat; - GLint numPixelFormats; - if (CGLChoosePixelFormat(attribs, &pixelFormat, &numPixelFormats) != kCGLNoError) { - printf("WebGraphicsContext3DDefaultImpl: error choosing pixel format\n"); - return false; - } - if (!pixelFormat) { - printf("WebGraphicsContext3DDefaultImpl: no pixel format selected\n"); - return false; - } - CGLContextObj context; - CGLError res = CGLCreateContext(pixelFormat, 0, &context); - CGLDestroyPixelFormat(pixelFormat); - if (res != kCGLNoError) { - printf("WebGraphicsContext3DDefaultImpl: error creating context\n"); + if (!gfx::GLContext::InitializeOneOff()) return false; - } - CGLPBufferObj pbuffer; - if (CGLCreatePBuffer(1, 1, GL_TEXTURE_2D, GL_RGBA, 0, &pbuffer) != kCGLNoError) { - CGLDestroyContext(context); - printf("WebGraphicsContext3DDefaultImpl: error creating pbuffer\n"); - return false; - } - if (CGLSetPBuffer(context, pbuffer, 0, 0, 0) != kCGLNoError) { - CGLDestroyContext(context); - CGLDestroyPBuffer(pbuffer); - printf("WebGraphicsContext3DDefaultImpl: error attaching pbuffer to context\n"); - return false; - } - if (CGLSetCurrentContext(context) != kCGLNoError) { - CGLDestroyContext(context); - CGLDestroyPBuffer(pbuffer); - printf("WebGraphicsContext3DDefaultImpl: error making context current\n"); - return false; - } - m_pbuffer = pbuffer; - m_contextObj = context; -#elif OS(LINUX) - if (!s_gl) { - s_gl = GLConnection::create(); - if (!s_gl) - return false; - } - - int configAttrs[] = { - GLX_DRAWABLE_TYPE, - GLX_PBUFFER_BIT, - GLX_RENDER_TYPE, - GLX_RGBA_BIT, - GLX_DOUBLEBUFFER, - 0, - 0 - }; - int nelements = 0; - GLXFBConfig* config = s_gl->chooseFBConfig(0, configAttrs, &nelements); - if (!config) { - printf("WebGraphicsContext3DDefaultImpl: glXChooseFBConfig failed\n"); - return false; - } - if (!nelements) { - printf("WebGraphicsContext3DDefaultImpl: glXChooseFBConfig returned 0 elements\n"); - XFree(config); - return false; - } - GLXContext context = s_gl->createNewContext(config[0], GLX_RGBA_TYPE, 0, True); - if (!context) { - printf("WebGraphicsContext3DDefaultImpl: glXCreateNewContext failed\n"); - XFree(config); - return false; - } - int pbufferAttrs[] = { - GLX_PBUFFER_WIDTH, - 1, - GLX_PBUFFER_HEIGHT, - 1, - 0 - }; - GLXPbuffer pbuffer = s_gl->createPbuffer(config[0], pbufferAttrs); - XFree(config); - if (!pbuffer) { - printf("WebGraphicsContext3DDefaultImpl: glxCreatePbuffer failed\n"); + + m_glContext = WTF::adoptPtr(gfx::GLContext::CreateOffscreenGLContext(0)); + if (!m_glContext) return false; - } - if (!s_gl->makeCurrent(pbuffer, context)) { - printf("WebGraphicsContext3DDefaultImpl: glXMakeCurrent failed\n"); - return false; - } - m_contextObj = context; - m_pbuffer = pbuffer; -#else -#error Must port to your platform -#endif - - if (!s_initializedGLEW) { - // Initialize GLEW and check for GL 2.0 support by the drivers. - GLenum glewInitResult = glewInit(); - if (glewInitResult != GLEW_OK) { - printf("WebGraphicsContext3DDefaultImpl: GLEW initialization failed\n"); - return false; - } - if (!glewIsSupported("GL_VERSION_2_0")) { - printf("WebGraphicsContext3DDefaultImpl: OpenGL 2.0 not supported\n"); - return false; - } - s_initializedGLEW = true; - } m_attributes = attributes; validateAttributes(); @@ -423,22 +143,7 @@ void WebGraphicsContext3DDefaultImpl::validateAttributes() bool WebGraphicsContext3DDefaultImpl::makeContextCurrent() { -#if OS(WINDOWS) - if (wglewGetCurrentContext() != m_contextObj) - if (wglewMakeCurrent(m_canvasDC, m_contextObj)) - return true; -#elif PLATFORM(CG) - if (CGLGetCurrentContext() != m_contextObj) - if (CGLSetCurrentContext(m_contextObj) == kCGLNoError) - return true; -#elif OS(LINUX) - if (s_gl->getCurrentContext() != m_contextObj) - if (s_gl->makeCurrent(m_pbuffer, m_contextObj)) - return true; -#else -#error Must port to your platform -#endif - return false; + return m_glContext->MakeCurrent(); } int WebGraphicsContext3DDefaultImpl::width() @@ -500,23 +205,12 @@ static int createTextureObject(GLenum target) void WebGraphicsContext3DDefaultImpl::reshape(int width, int height) { -#ifdef RENDER_TO_DEBUGGING_WINDOW - SetWindowPos(m_canvasWindow, HWND_TOP, 0, 0, width, height, - SWP_NOMOVE); - ShowWindow(m_canvasWindow, SW_SHOW); -#endif - m_cachedWidth = width; m_cachedHeight = height; makeContextCurrent(); -#ifndef RENDER_TO_DEBUGGING_WINDOW -#ifdef USE_TEXTURE_RECTANGLE_FOR_FRAMEBUFFER - // GL_TEXTURE_RECTANGLE_ARB is the best supported render target on Mac OS X - GLenum target = GL_TEXTURE_RECTANGLE_ARB; -#else GLenum target = GL_TEXTURE_2D; -#endif + if (!m_texture) { // Generate the texture object m_texture = createTextureObject(target); @@ -658,7 +352,6 @@ void WebGraphicsContext3DDefaultImpl::reshape(int width, int height) if (mustRestoreFBO) glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_boundFBO); -#endif // RENDER_TO_DEBUGGING_WINDOW #ifdef FLIP_FRAMEBUFFER_VERTICALLY if (m_scanline) { @@ -700,9 +393,6 @@ bool WebGraphicsContext3DDefaultImpl::readBackFramebuffer(unsigned char* pixels, makeContextCurrent(); -#ifdef RENDER_TO_DEBUGGING_WINDOW - SwapBuffers(m_canvasDC); -#else // Earlier versions of this code used the GPU to flip the // framebuffer vertically before reading it back for compositing // via software. This code was quite complicated, used a lot of @@ -732,13 +422,9 @@ bool WebGraphicsContext3DDefaultImpl::readBackFramebuffer(unsigned char* pixels, mustRestorePackAlignment = true; } -#if PLATFORM(SKIA) + // FIXME: OpenGL ES 2 does not support GL_BGRA so this fails when + // using that backend. glReadPixels(0, 0, m_cachedWidth, m_cachedHeight, GL_BGRA, GL_UNSIGNED_BYTE, pixels); -#elif PLATFORM(CG) - glReadPixels(0, 0, m_cachedWidth, m_cachedHeight, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, pixels); -#else -#error Must port to your platform -#endif if (mustRestorePackAlignment) glPixelStorei(GL_PACK_ALIGNMENT, packAlignment); @@ -751,7 +437,6 @@ bool WebGraphicsContext3DDefaultImpl::readBackFramebuffer(unsigned char* pixels, flipVertically(pixels, m_cachedWidth, m_cachedHeight); #endif -#endif // RENDER_TO_DEBUGGING_WINDOW return true; } @@ -760,6 +445,14 @@ void WebGraphicsContext3DDefaultImpl::synthesizeGLError(unsigned long error) m_syntheticErrors.add(error); } +bool WebGraphicsContext3DDefaultImpl::supportsBGRA() +{ + // Supported since OpenGL 1.2. However, glTexImage2D() must be modified + // to translate the internalFormat from GL_BGRA to GL_RGBA, since the + // former is not accepted by desktop GL. Return false until this is done. + return false; +} + // Helper macros to reduce the amount of code. #define DELEGATE_TO_GL(name, glname) \ @@ -916,38 +609,36 @@ void WebGraphicsContext3DDefaultImpl::copyTexImage2D(unsigned long target, long long x, long y, unsigned long width, unsigned long height, long border) { makeContextCurrent(); -#ifndef RENDER_TO_DEBUGGING_WINDOW + if (m_attributes.antialias && m_boundFBO == m_multisampleFBO) { glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, m_multisampleFBO); glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, m_fbo); glBlitFramebufferEXT(x, y, x + width, y + height, x, y, x + width, y + height, GL_COLOR_BUFFER_BIT, GL_LINEAR); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo); } -#endif + glCopyTexImage2D(target, level, internalformat, x, y, width, height, border); -#ifndef RENDER_TO_DEBUGGING_WINDOW + if (m_attributes.antialias && m_boundFBO == m_multisampleFBO) glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_boundFBO); -#endif } void WebGraphicsContext3DDefaultImpl::copyTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, long x, long y, unsigned long width, unsigned long height) { makeContextCurrent(); -#ifndef RENDER_TO_DEBUGGING_WINDOW + if (m_attributes.antialias && m_boundFBO == m_multisampleFBO) { glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, m_multisampleFBO); glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, m_fbo); glBlitFramebufferEXT(x, y, x + width, y + height, x, y, x + width, y + height, GL_COLOR_BUFFER_BIT, GL_LINEAR); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo); } -#endif + glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); -#ifndef RENDER_TO_DEBUGGING_WINDOW + if (m_attributes.antialias && m_boundFBO == m_multisampleFBO) glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_boundFBO); -#endif } DELEGATE_TO_GL_1(cullFace, CullFace, unsigned long) @@ -1242,11 +933,11 @@ DELEGATE_TO_GL_1R(isBuffer, IsBuffer, WebGLId, bool) DELEGATE_TO_GL_1R(isEnabled, IsEnabled, unsigned long, bool) -DELEGATE_TO_GL_1R(isFramebuffer, IsFramebuffer, WebGLId, bool) +DELEGATE_TO_GL_1R(isFramebuffer, IsFramebufferEXT, WebGLId, bool) DELEGATE_TO_GL_1R(isProgram, IsProgram, WebGLId, bool) -DELEGATE_TO_GL_1R(isRenderbuffer, IsRenderbuffer, WebGLId, bool) +DELEGATE_TO_GL_1R(isRenderbuffer, IsRenderbufferEXT, WebGLId, bool) DELEGATE_TO_GL_1R(isShader, IsShader, WebGLId, bool) @@ -1266,7 +957,6 @@ void WebGraphicsContext3DDefaultImpl::readPixels(long x, long y, unsigned long w // FIXME: remove the two glFlush calls when the driver bug is fixed, i.e., // all previous rendering calls should be done before reading pixels. glFlush(); -#ifndef RENDER_TO_DEBUGGING_WINDOW if (m_attributes.antialias && m_boundFBO == m_multisampleFBO) { glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, m_multisampleFBO); glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, m_fbo); @@ -1274,12 +964,11 @@ void WebGraphicsContext3DDefaultImpl::readPixels(long x, long y, unsigned long w glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo); glFlush(); } -#endif + glReadPixels(x, y, width, height, format, type, pixels); -#ifndef RENDER_TO_DEBUGGING_WINDOW + if (m_attributes.antialias && m_boundFBO == m_multisampleFBO) glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_boundFBO); -#endif } void WebGraphicsContext3DDefaultImpl::releaseShaderCompiler() @@ -1431,7 +1120,7 @@ unsigned WebGraphicsContext3DDefaultImpl::createBuffer() { makeContextCurrent(); GLuint o; - glGenBuffers(1, &o); + glGenBuffersARB(1, &o); return o; } @@ -1470,7 +1159,7 @@ unsigned WebGraphicsContext3DDefaultImpl::createTexture() void WebGraphicsContext3DDefaultImpl::deleteBuffer(unsigned buffer) { makeContextCurrent(); - glDeleteBuffers(1, &buffer); + glDeleteBuffersARB(1, &buffer); } void WebGraphicsContext3DDefaultImpl::deleteFramebuffer(unsigned framebuffer) diff --git a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h index 8223a1c..cf5f5b4 100644 --- a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h +++ b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h @@ -36,25 +36,14 @@ #include "WebGraphicsContext3D.h" #include <wtf/ListHashSet.h> +#include <wtf/OwnPtr.h> -#if OS(WINDOWS) -#include <windows.h> -#endif - -#include "GL/glew.h" -#if OS(WINDOWS) -#include "GL/wglew.h" -#endif - -#if PLATFORM(CG) -#include <OpenGL/OpenGL.h> -#else +#if !PLATFORM(CG) #define FLIP_FRAMEBUFFER_VERTICALLY #endif - -#if OS(LINUX) -#include "GL/glxew.h" -#endif +namespace gfx { +class GLContext; +} namespace WebKit { @@ -88,6 +77,7 @@ public: virtual void prepareTexture(); virtual void synthesizeGLError(unsigned long error); + virtual bool supportsBGRA(); virtual void activeTexture(unsigned long texture); virtual void attachShader(WebGLId program, WebGLId shader); @@ -323,103 +313,7 @@ private: // Errors raised by synthesizeGLError(). ListHashSet<unsigned long> m_syntheticErrors; - static bool s_initializedGLEW; -#if OS(WINDOWS) - HWND m_canvasWindow; - HDC m_canvasDC; - HGLRC m_contextObj; -#elif PLATFORM(CG) - CGLPBufferObj m_pbuffer; - CGLContextObj m_contextObj; - unsigned char* m_renderOutput; -#elif OS(LINUX) - GLXContext m_contextObj; - GLXPbuffer m_pbuffer; - - // In order to avoid problems caused by linking against libGL, we - // dynamically look up all the symbols we need. - // http://code.google.com/p/chromium/issues/detail?id=16800 - class GLConnection { - public: - ~GLConnection(); - - static GLConnection* create(); - - GLXFBConfig* chooseFBConfig(int screen, const int *attrib_list, int *nelements) - { - return m_glXChooseFBConfig(m_display, screen, attrib_list, nelements); - } - - GLXContext createNewContext(GLXFBConfig config, int renderType, GLXContext shareList, Bool direct) - { - return m_glXCreateNewContext(m_display, config, renderType, shareList, direct); - } - - GLXPbuffer createPbuffer(GLXFBConfig config, const int *attribList) - { - return m_glXCreatePbuffer(m_display, config, attribList); - } - - void destroyPbuffer(GLXPbuffer pbuf) - { - m_glXDestroyPbuffer(m_display, pbuf); - } - - Bool makeCurrent(GLXDrawable drawable, GLXContext ctx) - { - return m_glXMakeCurrent(m_display, drawable, ctx); - } - - void destroyContext(GLXContext ctx) - { - m_glXDestroyContext(m_display, ctx); - } - - GLXContext getCurrentContext() - { - return m_glXGetCurrentContext(); - } - - private: - Display* m_display; - void* m_libGL; - PFNGLXCHOOSEFBCONFIGPROC m_glXChooseFBConfig; - PFNGLXCREATENEWCONTEXTPROC m_glXCreateNewContext; - PFNGLXCREATEPBUFFERPROC m_glXCreatePbuffer; - PFNGLXDESTROYPBUFFERPROC m_glXDestroyPbuffer; - typedef Bool (* PFNGLXMAKECURRENTPROC)(Display* dpy, GLXDrawable drawable, GLXContext ctx); - PFNGLXMAKECURRENTPROC m_glXMakeCurrent; - typedef void (* PFNGLXDESTROYCONTEXTPROC)(Display* dpy, GLXContext ctx); - PFNGLXDESTROYCONTEXTPROC m_glXDestroyContext; - typedef GLXContext (* PFNGLXGETCURRENTCONTEXTPROC)(void); - PFNGLXGETCURRENTCONTEXTPROC m_glXGetCurrentContext; - - GLConnection(Display* display, - void* libGL, - PFNGLXCHOOSEFBCONFIGPROC chooseFBConfig, - PFNGLXCREATENEWCONTEXTPROC createNewContext, - PFNGLXCREATEPBUFFERPROC createPbuffer, - PFNGLXDESTROYPBUFFERPROC destroyPbuffer, - PFNGLXMAKECURRENTPROC makeCurrent, - PFNGLXDESTROYCONTEXTPROC destroyContext, - PFNGLXGETCURRENTCONTEXTPROC getCurrentContext) - : m_libGL(libGL) - , m_display(display) - , m_glXChooseFBConfig(chooseFBConfig) - , m_glXCreateNewContext(createNewContext) - , m_glXCreatePbuffer(createPbuffer) - , m_glXDestroyPbuffer(destroyPbuffer) - , m_glXMakeCurrent(makeCurrent) - , m_glXDestroyContext(destroyContext) - , m_glXGetCurrentContext(getCurrentContext) - { - } - }; - - static GLConnection* s_gl; -#else - #error Must port WebGraphicsContext3DDefaultImpl to your platform -#endif + OwnPtr<gfx::GLContext> m_glContext; }; } // namespace WebKit diff --git a/WebKit/chromium/src/WebIDBKey.cpp b/WebKit/chromium/src/WebIDBKey.cpp index 1c4c685..413a9e6 100644 --- a/WebKit/chromium/src/WebIDBKey.cpp +++ b/WebKit/chromium/src/WebIDBKey.cpp @@ -30,7 +30,12 @@ #if ENABLE(INDEXED_DATABASE) +#include "IDBBindingUtilities.h" #include "IDBKey.h" +#include "IDBKeyPath.h" +#include "SerializedScriptValue.h" +#include "WebIDBKeyPath.h" +#include "WebSerializedScriptValue.h" using namespace WebCore; @@ -50,6 +55,13 @@ WebIDBKey WebIDBKey::createInvalid() return key; } +WebIDBKey WebIDBKey::createFromValueAndKeyPath(const WebSerializedScriptValue& serializedScriptValue, const WebIDBKeyPath& idbKeyPath) +{ + if (serializedScriptValue.isNull()) + return WebIDBKey::createInvalid(); + return WebCore::createIDBKeyFromSerializedValueAndKeyPath(serializedScriptValue, idbKeyPath); +} + void WebIDBKey::assign(const WebIDBKey& value) { m_private = value.m_private; diff --git a/WebKit/chromium/src/WebIDBKeyPath.cpp b/WebKit/chromium/src/WebIDBKeyPath.cpp new file mode 100644 index 0000000..9eb33d6 --- /dev/null +++ b/WebKit/chromium/src/WebIDBKeyPath.cpp @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebIDBKeyPath.h" + +#if ENABLE(INDEXED_DATABASE) + +#include "IDBKeyPath.h" +#include "WebString.h" +#include "WebVector.h" +#include <wtf/Vector.h> + +using namespace WebCore; + +namespace WebKit { + +WebIDBKeyPath WebIDBKeyPath::create(const WebString& keyPath) +{ + WTF::Vector<IDBKeyPathElement> idbElements; + IDBKeyPathParseError idbError; + IDBParseKeyPath(keyPath, idbElements, idbError); + return WebIDBKeyPath(idbElements, static_cast<int>(idbError)); +} + +WebIDBKeyPath::WebIDBKeyPath(const WTF::Vector<IDBKeyPathElement>& elements, int parseError) + : m_private(new WTF::Vector<IDBKeyPathElement>(elements)) + , m_parseError(parseError) +{ +} + +int WebIDBKeyPath::parseError() const +{ + return m_parseError; +} + +void WebIDBKeyPath::assign(const WebIDBKeyPath& keyPath) +{ + m_parseError = keyPath.m_parseError; + m_private.reset(new WTF::Vector<IDBKeyPathElement>(keyPath)); +} + +void WebIDBKeyPath::reset() +{ + m_private.reset(0); +} + +WebIDBKeyPath::operator const WTF::Vector<WebCore::IDBKeyPathElement, 0>&() const +{ + return *m_private.get(); +} + +} // namespace WebKit + +#endif // ENABLE(INDEXED_DATABASE) diff --git a/WebKit/chromium/src/WebKit.cpp b/WebKit/chromium/src/WebKit.cpp index 1d717ea..786d573 100644 --- a/WebKit/chromium/src/WebKit.cpp +++ b/WebKit/chromium/src/WebKit.cpp @@ -31,7 +31,6 @@ #include "config.h" #include "WebKit.h" -#include "AtomicString.h" #include "DOMTimer.h" #include "Logging.h" #include "Page.h" @@ -43,6 +42,7 @@ #include <wtf/Assertions.h> #include <wtf/Threading.h> +#include <wtf/text/AtomicString.h> namespace WebKit { diff --git a/WebKit/chromium/src/WebNotification.cpp b/WebKit/chromium/src/WebNotification.cpp index 38d91df..6aa8439 100644 --- a/WebKit/chromium/src/WebNotification.cpp +++ b/WebKit/chromium/src/WebNotification.cpp @@ -113,6 +113,11 @@ WebString WebNotification::replaceId() const return m_private->replaceId(); } +void WebNotification::detachPresenter() +{ + m_private->detachPresenter(); +} + void WebNotification::dispatchDisplayEvent() { RefPtr<Event> event = Event::create("display", false, true); diff --git a/WebKit/chromium/src/WebPageSerializerImpl.h b/WebKit/chromium/src/WebPageSerializerImpl.h index 03f0a3b..a7f2fb4 100644 --- a/WebKit/chromium/src/WebPageSerializerImpl.h +++ b/WebKit/chromium/src/WebPageSerializerImpl.h @@ -32,10 +32,10 @@ #define WebPageSerializerImpl_h #include "PlatformString.h" -#include "StringHash.h" #include <wtf/Forward.h> #include <wtf/HashMap.h> #include <wtf/Vector.h> +#include <wtf/text/StringHash.h> #include "StringBuilder.h" #include "WebEntities.h" diff --git a/WebKit/chromium/src/WebSpeechInputControllerMockImpl.cpp b/WebKit/chromium/src/WebSpeechInputControllerMockImpl.cpp index 6b04320..57e3635 100644 --- a/WebKit/chromium/src/WebSpeechInputControllerMockImpl.cpp +++ b/WebKit/chromium/src/WebSpeechInputControllerMockImpl.cpp @@ -46,6 +46,12 @@ WebSpeechInputControllerMockImpl::WebSpeechInputControllerMockImpl( : m_webcoreMock(new WebCore::SpeechInputClientMock()) , m_listener(listener) { + m_webcoreMock->setListener(this); +} + +WebSpeechInputControllerMockImpl::~WebSpeechInputControllerMockImpl() +{ + m_webcoreMock->setListener(0); } void WebSpeechInputControllerMockImpl::setMockRecognitionResult(const WebString& result) @@ -53,34 +59,34 @@ void WebSpeechInputControllerMockImpl::setMockRecognitionResult(const WebString& m_webcoreMock->setRecognitionResult(result); } -void WebSpeechInputControllerMockImpl::didCompleteRecording() +void WebSpeechInputControllerMockImpl::didCompleteRecording(int requestId) { - m_listener->didCompleteRecording(); + m_listener->didCompleteRecording(requestId); } -void WebSpeechInputControllerMockImpl::didCompleteRecognition() +void WebSpeechInputControllerMockImpl::didCompleteRecognition(int requestId) { - m_listener->didCompleteRecognition(); + m_listener->didCompleteRecognition(requestId); } -void WebSpeechInputControllerMockImpl::setRecognitionResult(const WTF::String& result) +void WebSpeechInputControllerMockImpl::setRecognitionResult(int requestId, const WTF::String& result) { - m_listener->setRecognitionResult(result); + m_listener->setRecognitionResult(requestId, result); } -bool WebSpeechInputControllerMockImpl::startRecognition() +bool WebSpeechInputControllerMockImpl::startRecognition(int requestId) { - return m_webcoreMock->startRecognition(this); + return m_webcoreMock->startRecognition(requestId); } -void WebSpeechInputControllerMockImpl::cancelRecognition() +void WebSpeechInputControllerMockImpl::cancelRecognition(int requestId) { - m_webcoreMock->cancelRecognition(); + m_webcoreMock->cancelRecognition(requestId); } -void WebSpeechInputControllerMockImpl::stopRecording() +void WebSpeechInputControllerMockImpl::stopRecording(int requestId) { - m_webcoreMock->stopRecording(); + m_webcoreMock->stopRecording(requestId); } } // namespace WebKit diff --git a/WebKit/chromium/src/WebSpeechInputControllerMockImpl.h b/WebKit/chromium/src/WebSpeechInputControllerMockImpl.h index 046abf3..38a15df 100644 --- a/WebKit/chromium/src/WebSpeechInputControllerMockImpl.h +++ b/WebKit/chromium/src/WebSpeechInputControllerMockImpl.h @@ -47,16 +47,17 @@ class WebSpeechInputControllerMockImpl : public WebCore::SpeechInputListener , public WebSpeechInputControllerMock { public: WebSpeechInputControllerMockImpl(WebSpeechInputListener*); + virtual ~WebSpeechInputControllerMockImpl(); // WebCore::SpeechInputListener methods. - void didCompleteRecording(); - void didCompleteRecognition(); - void setRecognitionResult(const WTF::String& result); + void didCompleteRecording(int requestId); + void didCompleteRecognition(int requestId); + void setRecognitionResult(int requestId, const WTF::String& result); // WebSpeechInputController methods. - bool startRecognition(); - void cancelRecognition(); - void stopRecording(); + bool startRecognition(int requestId); + void cancelRecognition(int requestId); + void stopRecording(int requestId); // WebSpeechInputControllerMock methods. void setMockRecognitionResult(const WebString& result); diff --git a/WebKit/chromium/src/WebString.cpp b/WebKit/chromium/src/WebString.cpp index bbbe9ce..a091ef4 100644 --- a/WebKit/chromium/src/WebString.cpp +++ b/WebKit/chromium/src/WebString.cpp @@ -31,9 +31,9 @@ #include "config.h" #include "WebString.h" -#include "AtomicString.h" #include "PlatformString.h" #include <wtf/text/CString.h> +#include <wtf/text/AtomicString.h> #include "WebCString.h" diff --git a/WebKit/chromium/src/WebViewImpl.cpp b/WebKit/chromium/src/WebViewImpl.cpp index 8733a2a..62b20d5 100644 --- a/WebKit/chromium/src/WebViewImpl.cpp +++ b/WebKit/chromium/src/WebViewImpl.cpp @@ -1949,8 +1949,14 @@ void WebView::addUserStyleSheet(const WebString& sourceCode, PageGroup* pageGroup = PageGroup::pageGroup(pageGroupName); RefPtr<DOMWrapperWorld> world(DOMWrapperWorld::create()); + + // FIXME: Current callers always want the level to be "author". It probably makes sense to let + // callers specify this though, since in other cases the caller will probably want "user" level. + // + // FIXME: It would be nice to populate the URL correctly, instead of passing an empty URL. pageGroup->addUserStyleSheetToWorld(world.get(), sourceCode, WebURL(), patterns.release(), 0, - static_cast<UserContentInjectedFrames>(injectIn)); + static_cast<UserContentInjectedFrames>(injectIn), + UserStyleSheet::AuthorLevel); } void WebView::removeAllUserContent() diff --git a/WebKit/chromium/src/gtk/WebInputEventFactory.cpp b/WebKit/chromium/src/gtk/WebInputEventFactory.cpp index dc46b07..f8a1386 100644 --- a/WebKit/chromium/src/gtk/WebInputEventFactory.cpp +++ b/WebKit/chromium/src/gtk/WebInputEventFactory.cpp @@ -45,12 +45,15 @@ namespace { -gint getDoubleClickTime() +bool countsAsDoubleClick(gint timeDiff, gint xDiff, gint yDiff) { static GtkSettings* settings = gtk_settings_get_default(); gint doubleClickTime = 250; - g_object_get(G_OBJECT(settings), "gtk-double-click-time", &doubleClickTime, NULL); - return doubleClickTime; + gint doubleClickDistance = 5; + g_object_get(G_OBJECT(settings), + "gtk-double-click-time", &doubleClickTime, + "gtk-double-click-distance", &doubleClickDistance, 0); + return timeDiff <= doubleClickTime && abs(xDiff) <= doubleClickDistance && abs(yDiff) <= doubleClickDistance; } } // namespace @@ -404,9 +407,13 @@ WebMouseEvent WebInputEventFactory::mouseEvent(const GdkEventButton* event) static int numClicks = 0; static GdkWindow* eventWindow = 0; static gint lastLeftClickTime = 0; + static gint lastLeftClickX = 0; + static gint lastLeftClickY = 0; - gint time_diff = event->time - lastLeftClickTime; - if (eventWindow == event->window && time_diff < getDoubleClickTime()) + gint timeDiff = event->time - lastLeftClickTime; + gint xDiff = event->x - lastLeftClickX; + gint yDiff = event->y - lastLeftClickY; + if (eventWindow == event->window && countsAsDoubleClick(timeDiff, xDiff, yDiff)) numClicks++; else numClicks = 1; @@ -414,6 +421,8 @@ WebMouseEvent WebInputEventFactory::mouseEvent(const GdkEventButton* event) result.clickCount = numClicks; eventWindow = event->window; lastLeftClickTime = event->time; + lastLeftClickX = event->x; + lastLeftClickY = event->y; } result.button = WebMouseEvent::ButtonNone; diff --git a/WebKit/chromium/src/js/DevTools.js b/WebKit/chromium/src/js/DevTools.js index 895c68b..0fd66c9 100644 --- a/WebKit/chromium/src/js/DevTools.js +++ b/WebKit/chromium/src/js/DevTools.js @@ -34,22 +34,6 @@ * DevTools frontend together. It is also responsible for overriding existing * WebInspector functionality while it is getting upstreamed into WebCore. */ - -/** - * Dispatches raw message from the host. - * @param {string} remoteName - * @prama {string} methodName - * @param {string} param1, param2, param3 Arguments to dispatch. - */ -devtools$$dispatch = function(message) -{ - var args = typeof message === "string" ? JSON.parse(message) : message; - var methodName = args[0]; - var parameters = args.slice(1); - WebInspector[methodName].apply(WebInspector, parameters); -}; - - devtools.ToolsAgent = function() { this.profilerAgent_ = new devtools.ProfilerAgent(); @@ -75,30 +59,6 @@ devtools.tools = null; var context = {}; // Used by WebCore's inspector routines. -(function() { - WebInspector._paramsObject = {}; - - var queryParams = window.location.search; - if (queryParams) { - var params = queryParams.substring(1).split("&"); - for (var i = 0; i < params.length; ++i) { - var pair = params[i].split("="); - WebInspector._paramsObject[pair[0]] = pair[1]; - } - } - if ("page" in WebInspector._paramsObject) { - WebInspector.socket = new WebSocket("ws://" + window.location.host + "/devtools/page/" + WebInspector._paramsObject.page); - WebInspector.socket.onmessage = function(message) { devtools$$dispatch(message.data); } - WebInspector.socket.onerror = function(error) { console.err(error); } - WebInspector.socket.onopen = function() { - WebInspector.socketOpened = true; - if (WebInspector.loadedDone) - WebInspector.doLoadedDone(); - }; - InspectorFrontendHost.sendMessageToBackend = WebInspector.socket.send.bind(WebInspector.socket); - InspectorFrontendHost.loaded = WebInspector.socket.send.bind(WebInspector.socket, "loaded"); - } -})(); /////////////////////////////////////////////////////////////////////////////// // Here and below are overrides to existing WebInspector methods only. // TODO(pfeldman): Patch WebCore and upstream changes. @@ -114,24 +74,15 @@ WebInspector.loaded = function() Preferences.profilerAlwaysEnabled = true; Preferences.canEditScriptSource = true; Preferences.onlineDetectionEnabled = false; - if ("page" in WebInspector._paramsObject) { - WebInspector.loadedDone = true; - if (WebInspector.socketOpened) - WebInspector.doLoadedDone(); - return; - } - WebInspector.doLoadedDone(); -} -WebInspector.doLoadedDone = function() { - oldLoaded.call(this); + oldLoaded.call(WebInspector); } devtools.domContentLoaded = function() { - WebInspector.setAttachedWindow(WebInspector._paramsObject.docked === "true"); - if (WebInspector._paramsObject.toolbar_color && WebInspector._paramsObject.text_color) - WebInspector.setToolbarColors(WebInspector._paramsObject.toolbar_color, WebInspector._paramsObject.text_color); + WebInspector.setAttachedWindow(WebInspector.queryParamsObject.docked === "true"); + if (WebInspector.queryParamsObject.toolbar_color && WebInspector.queryParamsObject.text_color) + WebInspector.setToolbarColors(WebInspector.queryParamsObject.toolbar_color, WebInspector.queryParamsObject.text_color); } document.addEventListener("DOMContentLoaded", devtools.domContentLoaded, false); @@ -243,10 +194,3 @@ WebInspector.resetToolbarColors = function() if (window.RemoteDebuggerAgent) { RemoteDebuggerAgent.setContextId = function() {}; } - - -// Support for pause while renderer is busy (is dispatched on IO thread). -InspectorBackend.pause = function() -{ - RemoteDebuggerCommandExecutor.DebuggerPauseScript(); -}; diff --git a/WebKit/chromium/src/js/InjectDispatch.js b/WebKit/chromium/src/js/InjectDispatch.js deleted file mode 100644 index cda84e5..0000000 --- a/WebKit/chromium/src/js/InjectDispatch.js +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * 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. - */ - -/** - * @fileoverview Injects "injected" object into the inspectable page. - */ - - -var InspectorControllerDispatcher = {}; - -/** - * Main dispatch method, all calls from the host to InspectorController go - * through this one. - * @param {string} functionName Function to call - * @param {string} json_args JSON-serialized call parameters. - * @return {string} JSON-serialized result of the dispatched call. - */ -InspectorControllerDispatcher.dispatch = function(functionName, json_args) -{ - var params = JSON.parse(json_args); - InspectorBackend[functionName].apply(InspectorBackend, params); -}; - -/** - * This is called by the InspectorFrontend for serialization. - * We serialize the call and send it to the client over the IPC - * using dispatchOut bound method. - */ -function dispatch(method, var_args) { - var args = Array.prototype.slice.call(arguments); - var call = JSON.stringify(args); - DevToolsAgentHost.dispatch(call, method); -}; - -function close() { - // This method is called when InspectorFrontend closes in layout tests. -} - -function inspectedPageDestroyed() { -} diff --git a/WebKit/chromium/src/js/Tests.js b/WebKit/chromium/src/js/Tests.js index 764f624..41574b4 100644 --- a/WebKit/chromium/src/js/Tests.js +++ b/WebKit/chromium/src/js/Tests.js @@ -1069,25 +1069,6 @@ TestSuite.prototype._checkSourceFrameWhenLoaded = function(expectations, callbac /** - * Performs sequence of steps. - * @param {Array.<Object|Function>} Array [expectations1,action1,expectations2, - * action2,...,actionN]. - */ -TestSuite.prototype._performSteps = function(actions) -{ - var test = this; - var i = 0; - function doNextAction() { - if (i > 0) - actions[i++](); - if (i < actions.length - 1) - test._waitForScriptPause(actions[i++], doNextAction); - } - doNextAction(); -}; - - -/** * Waits until all the scripts are parsed and asynchronously executes the code * in the inspected page. */ @@ -1128,131 +1109,6 @@ TestSuite.prototype._waitUntilScriptsAreParsed = function(expectedScripts, callb /** - * Waits until all debugger scripts are parsed and executes "a()" in the - * inspected page. - */ -TestSuite.prototype._executeFunctionForStepTest = function() -{ - this._executeCodeWhenScriptsAreParsed("a()", ["debugger_step.html", "debugger_step.js"]); -}; - - -/** - * Tests step over in the debugger. - */ -TestSuite.prototype.testStepOver = function() -{ - this.showPanel("scripts"); - var test = this; - - this._executeFunctionForStepTest(); - - this._performSteps([ - { - functionsOnStack: ["d","a",""], - lineNumber: 3, - lineText: " debugger;" - }, - function() { - document.getElementById("scripts-step-over").click(); - }, - { - functionsOnStack: ["d","a",""], - lineNumber: 5, - lineText: " var y = fact(10);" - }, - function() { - document.getElementById("scripts-step-over").click(); - }, - { - functionsOnStack: ["d","a",""], - lineNumber: 6, - lineText: " return y;" - }, - function() { - test.releaseControl(); - } - ]); - - test.takeControl(); -}; - - -/** - * Tests step out in the debugger. - */ -TestSuite.prototype.testStepOut = function() -{ - this.showPanel("scripts"); - var test = this; - - this._executeFunctionForStepTest(); - - this._performSteps([ - { - functionsOnStack: ["d","a",""], - lineNumber: 3, - lineText: " debugger;" - }, - function() { - document.getElementById("scripts-step-out").click(); - }, - { - functionsOnStack: ["a",""], - lineNumber: 8, - lineText: " printResult(result);" - }, - function() { - test.releaseControl(); - } - ]); - - test.takeControl(); -}; - - -/** - * Tests step in in the debugger. - */ -TestSuite.prototype.testStepIn = function() -{ - this.showPanel("scripts"); - var test = this; - - this._executeFunctionForStepTest(); - - this._performSteps([ - { - functionsOnStack: ["d","a",""], - lineNumber: 3, - lineText: " debugger;" - }, - function() { - document.getElementById("scripts-step-over").click(); - }, - { - functionsOnStack: ["d","a",""], - lineNumber: 5, - lineText: " var y = fact(10);" - }, - function() { - document.getElementById("scripts-step-into").click(); - }, - { - functionsOnStack: ["fact","d","a",""], - lineNumber: 10, - lineText: " var r = 1;" - }, - function() { - test.releaseControl(); - } - ]); - - test.takeControl(); -}; - - -/** * Gets a XPathResult matching given xpath. * @param {string} xpath * @param {number} resultType @@ -1503,116 +1359,6 @@ TestSuite.prototype._hookGetPropertiesCallback = function(hook, code) /** - * Tests that all elements in prototype chain of an object have expected - * intrinic proprties(__proto__, constructor, prototype). - */ -TestSuite.prototype.testDebugIntrinsicProperties = function() -{ - this.showPanel("scripts"); - var test = this; - - this._executeCodeWhenScriptsAreParsed("handleClick()", ["debugger_intrinsic_properties.html"]); - - this._waitForScriptPause( - { - functionsOnStack: ["callDebugger", "handleClick", ""], - lineNumber: 29, - lineText: " debugger;" - }, - expandLocalScope); - - var localScopeSection = null; - function expandLocalScope() { - test._expandScopeSections(function(sections, i) { - if (i === 0) { - test.assertTrue(sections[i].object.isLocal, "Scope #0 is not Local."); - localScopeSection = sections[i]; - return true; - } - return false; - }, - examineLocalScope); - } - - function examineLocalScope() { - var scopeExpectations = [ - "a", "Child", [ - "__proto__", "Child", [ - "__proto__", "Parent", [ - "__proto__", "Object", null, - "constructor", "function Parent(n) {", [ - "name", '"Parent"', null, - "prototype", 'Parent', [ - "parentProtoField", "11", null, - ] - ], - "parentProtoField", "11", null, - ], - "constructor", "function Child(n) {", null, - "childProtoField", "21", null, - ], - - "parentField", "10", null, - "childField", "20", null, - ] - ]; - checkProperty(localScopeSection.propertiesTreeOutline, "<Local Scope>", scopeExpectations); - } - - var propQueue = []; - var index = 0; - var expectedFinalIndex = 5; - - function expandAndCheckNextProperty() { - if (index === propQueue.length) { - test.assertEquals(expectedFinalIndex, index, "Unexpected number of expanded objects."); - test.releaseControl(); - return; - } - - // Read next property data from the queue. - var treeElement = propQueue[index].treeElement; - var path = propQueue[index].path; - var expectations = propQueue[index].expectations; - index++; - - // Expand the property. - test._hookGetPropertiesCallback(function() { - checkProperty(treeElement, path, expectations); - }, - function() { - treeElement.expand(); - }); - } - - function checkProperty(treeElement, path, expectations) { - for (var i = 0; i < expectations.length; i += 3) { - var name = expectations[i]; - var description = expectations[i+1]; - var value = expectations[i+2]; - - var propertyPath = path + "." + name; - var propertyTreeElement = test._findChildProperty(treeElement, name, path); - test.assertTrue(propertyTreeElement, 'Property "' + propertyPath + '" not found.'); - test.assertEquals(description, propertyTreeElement.property.value.description, 'Unexpected "' + propertyPath + '" description.'); - if (value) { - // Schedule property content check. - propQueue.push({ - treeElement: propertyTreeElement, - path: propertyPath, - expectations: value, - }); - } - } - // Check next property in the queue. - expandAndCheckNextProperty(); - } - - test.takeControl(); -}; - - -/** * Tests "Pause" button will pause debugger when a snippet is evaluated. */ TestSuite.prototype.testPauseInEval = function() @@ -1647,101 +1393,6 @@ TestSuite.createKeyEvent = function(keyIdentifier) /** - * Tests console eval. - */ -TestSuite.prototype.testConsoleEval = function() -{ - var test = this; - this.evaluateInConsole_("123", - function(resultText) { - test.assertEquals("123", resultText); - test.releaseControl(); - }); - - this.takeControl(); -}; - - -/** - * Tests console log. - */ -TestSuite.prototype.testConsoleLog = function() -{ - WebInspector.showConsole(); - var messages = WebInspector.console.messages; - var index = 0; - - var test = this; - var assertNext = function(line, message, opt_class, opt_count, opt_substr) { - var elem = messages[index++].toMessageElement(); - var clazz = elem.getAttribute("class"); - var expectation = (opt_count || '') + 'console_test_page.html:' + line + message; - if (opt_substr) - test.assertContains(elem.textContent, expectation); - else - test.assertEquals(expectation, elem.textContent); - if (opt_class) - test.assertContains(clazz, "console-" + opt_class); - }; - - assertNext("5", "log", "log-level"); - assertNext("7", "debug", "log-level"); - assertNext("9", "info", "log-level"); - assertNext("11", "warn", "warning-level"); - assertNext("13", "error", "error-level"); - assertNext("15", "Message format number 1, 2 and 3.5"); - assertNext("17", "Message format for string"); - assertNext("19", "Object Object"); - assertNext("22", "repeated", "log-level", 5); - assertNext("26", "count: 1"); - assertNext("26", "count: 2"); - assertNext("29", "group", "group-title"); - index++; - assertNext("33", "timer:", "log-level", "", true); - assertNext("35", "1 2 3", "log-level"); - assertNext("37", "HTMLDocument", "log-level"); - assertNext("39", "<html>", "log-level", "", true); -}; - - -/** - * Tests eval of global objects. - */ -TestSuite.prototype.testEvalGlobal = function() -{ - WebInspector.showConsole(); - - var inputs = ["foo", "foobar"]; - var expectations = ["foo", "fooValue", "foobar", "ReferenceError: foobar is not defined"]; - - // Do not change code below - simply add inputs and expectations above. - var initEval = function(input) { - WebInspector.console.prompt.text = input; - WebInspector.console.promptElement.dispatchEvent( TestSuite.createKeyEvent("Enter")); - }; - var test = this; - var messagesCount = 0; - var inputIndex = 0; - this.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", - function(commandResult) { - messagesCount++; - if (messagesCount === expectations.length) { - var messages = WebInspector.console.messages; - for (var i = 0; i < expectations; ++i) { - var elem = messages[i++].toMessageElement(); - test.assertEquals(elem.textContent, expectations[i]); - } - test.releaseControl(); - } else if (messagesCount % 2 === 0) - initEval(inputs[inputIndex++]); - }, true); - - initEval(inputs[inputIndex++]); - this.takeControl(); -}; - - -/** * Tests the message loop re-entrancy. */ TestSuite.prototype.testMessageLoopReentrant = function() diff --git a/WebKit/chromium/tests/IDBBindingUtilitiesTest.cpp b/WebKit/chromium/tests/IDBBindingUtilitiesTest.cpp new file mode 100644 index 0000000..1b7f156 --- /dev/null +++ b/WebKit/chromium/tests/IDBBindingUtilitiesTest.cpp @@ -0,0 +1,165 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "IDBBindingUtilities.h" +#include "IDBKey.h" +#include "IDBKeyPath.h" +#include "SerializedScriptValue.h" + +#include <gtest/gtest.h> +#include <wtf/Vector.h> + +#if ENABLE(INDEXED_DATABASE) + +using namespace WebCore; + +namespace { + +class LocalContext { +public: + LocalContext() + : m_context(v8::Context::New()) + { + m_context->Enter(); + } + + virtual ~LocalContext() + { + m_context->Exit(); + m_context.Dispose(); + } + +private: + v8::Locker m_locker; + v8::HandleScope m_scope; + v8::Persistent<v8::Context> m_context; +}; + +PassRefPtr<IDBKey> checkKeyFromValueAndKeyPathInternal(SerializedScriptValue* value, const String& keyPath) +{ + Vector<IDBKeyPathElement> idbKeyPath; + IDBKeyPathParseError parseError; + IDBParseKeyPath(keyPath, idbKeyPath, parseError); + EXPECT_EQ(IDBKeyPathParseErrorNone, parseError); + return createIDBKeyFromSerializedValueAndKeyPath(value, idbKeyPath); +} + +void checkKeyPathNullValue(SerializedScriptValue* value, const String& keyPath) +{ + RefPtr<IDBKey> idbKey = checkKeyFromValueAndKeyPathInternal(value, keyPath); + ASSERT_FALSE(idbKey.get()); +} + +void checkKeyPathStringValue(SerializedScriptValue* value, const String& keyPath, const String& expected) +{ + RefPtr<IDBKey> idbKey = checkKeyFromValueAndKeyPathInternal(value, keyPath); + ASSERT_TRUE(idbKey.get()); + ASSERT_EQ(IDBKey::StringType, idbKey->type()); + ASSERT_TRUE(expected == idbKey->string()); +} + +void checkKeyPathNumberValue(SerializedScriptValue* value, const String& keyPath, int expected) +{ + RefPtr<IDBKey> idbKey = checkKeyFromValueAndKeyPathInternal(value, keyPath); + ASSERT_TRUE(idbKey.get()); + ASSERT_EQ(IDBKey::NumberType, idbKey->type()); + ASSERT_TRUE(expected == idbKey->number()); +} + +TEST(IDBKeyFromValueAndKeyPathTest, TopLevelPropertyStringValue) +{ + LocalContext v8context; + v8::Local<v8::Object> object = v8::Object::New(); + object->Set(v8::String::New("foo"), v8::String::New("zoo")); + + RefPtr<SerializedScriptValue> serializedScriptValue = SerializedScriptValue::create(object); + + checkKeyPathStringValue(serializedScriptValue.get(), "foo", "zoo"); + checkKeyPathNullValue(serializedScriptValue.get(), "bar"); + checkKeyPathNullValue(serializedScriptValue.get(), "[3]"); +} + +TEST(IDBKeyFromValueAndKeyPathTest, TopLevelPropertyNumberValue) +{ + LocalContext v8context; + v8::Local<v8::Object> object = v8::Object::New(); + object->Set(v8::String::New("foo"), v8::Number::New(456)); + + RefPtr<SerializedScriptValue> serializedScriptValue = SerializedScriptValue::create(object); + + checkKeyPathNumberValue(serializedScriptValue.get(), "foo", 456); + checkKeyPathNullValue(serializedScriptValue.get(), "bar"); + checkKeyPathNullValue(serializedScriptValue.get(), "[3]"); +} + +TEST(IDBKeyFromValueAndKeyPathTest, TopLevelArrayElement) +{ + LocalContext v8context; + v8::Local<v8::Array> array = v8::Array::New(); + array->Set(3, v8::String::New("zoo")); + + RefPtr<SerializedScriptValue> serializedScriptValue = SerializedScriptValue::create(array); + + checkKeyPathStringValue(serializedScriptValue.get(), "[3]", "zoo"); + checkKeyPathNullValue(serializedScriptValue.get(), "foo"); + checkKeyPathNullValue(serializedScriptValue.get(), "bar"); +} + +TEST(IDBKeyFromValueAndKeyPathTest, SubProperty) +{ + LocalContext v8context; + v8::Local<v8::Object> object = v8::Object::New(); + v8::Local<v8::Object> subProperty = v8::Object::New(); + subProperty->Set(v8::String::New("bar"), v8::String::New("zee")); + object->Set(v8::String::New("foo"), subProperty); + + RefPtr<SerializedScriptValue> serializedScriptValue = SerializedScriptValue::create(object); + + checkKeyPathStringValue(serializedScriptValue.get(), "foo.bar", "zee"); + checkKeyPathNullValue(serializedScriptValue.get(), "bar"); + checkKeyPathNullValue(serializedScriptValue.get(), "[3]"); +} + +TEST(IDBKeyFromValueAndKeyPathTest, Array2D) +{ + LocalContext v8context; + v8::Local<v8::Object> object = v8::Object::New(); + v8::Local<v8::Array> array = v8::Array::New(); + v8::Local<v8::Array> subArray = v8::Array::New(); + subArray->Set(7, v8::String::New("zee")); + array->Set(3, subArray); + object->Set(v8::String::New("foo"), array); + + RefPtr<SerializedScriptValue> serializedScriptValue = SerializedScriptValue::create(object); + + checkKeyPathStringValue(serializedScriptValue.get(), "foo[3][7]", "zee"); + checkKeyPathNullValue(serializedScriptValue.get(), "bar"); + checkKeyPathNullValue(serializedScriptValue.get(), "[4]"); +} + +} // namespace + +#endif // ENABLE(INDEXED_DATABASE) diff --git a/WebKit/chromium/tests/IDBKeyPathTest.cpp b/WebKit/chromium/tests/IDBKeyPathTest.cpp new file mode 100644 index 0000000..ac10f4f --- /dev/null +++ b/WebKit/chromium/tests/IDBKeyPathTest.cpp @@ -0,0 +1,205 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "IDBKeyPath.h" + +#include <gtest/gtest.h> +#include <wtf/Vector.h> + +#if ENABLE(INDEXED_DATABASE) + +using namespace WebCore; + +namespace { + +IDBKeyPathElement ExpectedToken(const String& identifier, bool isIndexed, int index) +{ + IDBKeyPathElement expected; + if (isIndexed) { + expected.type = IDBKeyPathElement::IsIndexed; + expected.index = index; + } else { + expected.type = IDBKeyPathElement::IsNamed; + expected.identifier = identifier; + } + return expected; +} + +void checkKeyPath(const String& keyPath, const Vector<IDBKeyPathElement>& expected, int parserError) +{ + + IDBKeyPathParseError error; + Vector<IDBKeyPathElement> idbKeyPathElements; + IDBParseKeyPath(keyPath, idbKeyPathElements, error); + ASSERT_EQ(parserError, error); + if (error != IDBKeyPathParseErrorNone) + return; + ASSERT_EQ(expected.size(), idbKeyPathElements.size()); + for (int i = 0; i < expected.size(); ++i) { + ASSERT_TRUE(expected[i].type == idbKeyPathElements[i].type) << i; + if (expected[i].type == IDBKeyPathElement::IsIndexed) + ASSERT_EQ(expected[i].index, idbKeyPathElements[i].index) << i; + else if (expected[i].type == IDBKeyPathElement::IsNamed) + ASSERT_TRUE(expected[i].identifier == idbKeyPathElements[i].identifier) << i; + else + ASSERT_TRUE(false) << "Invalid IDBKeyPathElement type"; + } +} + +TEST(IDBKeyPathTest, ValidKeyPath0) +{ + Vector<IDBKeyPathElement> expected; + String keyPath("foo.bar.zoo"); + expected.append(ExpectedToken("foo", false, 0)); + expected.append(ExpectedToken("bar", false, 0)); + expected.append(ExpectedToken("zoo", false, 0)); + checkKeyPath(keyPath, expected, 0); +} + +TEST(IDBKeyPathTest, ValidKeyPath1) +{ + Vector<IDBKeyPathElement> expected; + String keyPath("a[34][20].foo[2].bar"); + expected.append(ExpectedToken("a", false, 0)); + expected.append(ExpectedToken(String(), true, 34)); + expected.append(ExpectedToken(String(), true, 20)); + expected.append(ExpectedToken("foo", false, 0)); + expected.append(ExpectedToken(String(), true, 2)); + expected.append(ExpectedToken("bar", false, 0)); + checkKeyPath(keyPath, expected, 0); +} + +TEST(IDBKeyPathTest, ValidKeyPath2) +{ + Vector<IDBKeyPathElement> expected; + String keyPath("foo[ 34 ].Zoo_[00023]\t._c"); + expected.append(ExpectedToken("foo", false, 0)); + expected.append(ExpectedToken(String(), true, 34)); + expected.append(ExpectedToken("Zoo_", false, 0)); + expected.append(ExpectedToken(String(), true, 23)); + expected.append(ExpectedToken("_c", false, 0)); + checkKeyPath(keyPath, expected, 0); +} + +TEST(IDBKeyPathTest, ValidKeyPath3) +{ + Vector<IDBKeyPathElement> expected; + String keyPath("foo[ 34 ]"); + expected.append(ExpectedToken("foo", false, 0)); + expected.append(ExpectedToken(String(), true, 34)); + checkKeyPath(keyPath, expected, 0); +} + +TEST(IDBKeyPathTest, ValidKeyPath4) +{ + Vector<IDBKeyPathElement> expected; + String keyPath("[ 34 ]"); + expected.append(ExpectedToken(String(), true, 34)); + checkKeyPath(keyPath, expected, 0); +} + +TEST(IDBKeyPathTest, InvalidKeyPath2) +{ + Vector<IDBKeyPathElement> expected; + String keyPath("a[[34]].b[2].c"); + expected.append(ExpectedToken("a", false, 0)); + checkKeyPath(keyPath, expected, 3); +} + +TEST(IDBKeyPathTest, InvalidKeyPath3) +{ + Vector<IDBKeyPathElement> expected; + String keyPath("a[[34].b[2].c"); + expected.append(ExpectedToken("a", false, 0)); + checkKeyPath(keyPath, expected, 3); +} + +TEST(IDBKeyPathTest, InvalidKeyPath5) +{ + Vector<IDBKeyPathElement> expected; + String keyPath("a[[34.b[2].c"); + expected.append(ExpectedToken("a", false, 0)); + checkKeyPath(keyPath, expected, 3); +} + +TEST(IDBKeyPathTest, InvalidKeyPath6) +{ + Vector<IDBKeyPathElement> expected; + String keyPath("+a[34].b[2].c"); + checkKeyPath(keyPath, expected, 1); +} + +TEST(IDBKeyPathTest, InvalidKeyPath7) +{ + Vector<IDBKeyPathElement> expected; + String keyPath("%a[34].b[2].c"); + checkKeyPath(keyPath, expected, 1); +} + +TEST(IDBKeyPathTest, InvalidKeyPath8) +{ + Vector<IDBKeyPathElement> expected; + String keyPath("a{[34]}.b[2].c"); + expected.append(ExpectedToken("a", false, 0)); + checkKeyPath(keyPath, expected, 2); +} + +TEST(IDBKeyPathTest, InvalidKeyPath9) +{ + Vector<IDBKeyPathElement> expected; + String keyPath("a..b[2].c"); + expected.append(ExpectedToken("a", false, 0)); + checkKeyPath(keyPath, expected, 5); +} + +TEST(IDBKeyPathTest, InvalidKeyPath10) +{ + Vector<IDBKeyPathElement> expected; + String keyPath("a[34]b.foo[2].bar"); + expected.append(ExpectedToken("a", false, 0)); + expected.append(ExpectedToken(String(), true, 34)); + checkKeyPath(keyPath, expected, 4); +} + +TEST(IDBKeyPathTest, InvalidKeyPath11) +{ + Vector<IDBKeyPathElement> expected; + String keyPath("a[-1]"); + expected.append(ExpectedToken("a", false, 0)); + checkKeyPath(keyPath, expected, 3); +} + +TEST(IDBKeyPathTest, InvalidKeyPath12) +{ + Vector<IDBKeyPathElement> expected; + String keyPath("a[9999999999999999999999999999999999]"); + expected.append(ExpectedToken("a", false, 0)); + checkKeyPath(keyPath, expected, 3); +} + +} // namespace + +#endif // ENABLE(INDEXED_DATABASE) diff --git a/WebKit/chromium/tests/TilingDataTest.cpp b/WebKit/chromium/tests/TilingDataTest.cpp new file mode 100755 index 0000000..463542b --- /dev/null +++ b/WebKit/chromium/tests/TilingDataTest.cpp @@ -0,0 +1,223 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#include "GLES2Texture.h" +#include <gtest/gtest.h> + +using namespace WebCore; + +namespace { + +TEST(TilingDataTest, numTiles_NoTiling) +{ + EXPECT_EQ(1, TilingData(16, 16, 16, false).numTiles()); + EXPECT_EQ(1, TilingData(16, 15, 15, true).numTiles()); + EXPECT_EQ(1, TilingData(16, 16, 16, true).numTiles()); + EXPECT_EQ(1, TilingData(16, 1, 16, false).numTiles()); + EXPECT_EQ(1, TilingData(15, 15, 15, true).numTiles()); +} + +TEST(TilingDataTest, numTiles_TilingNoBorders) +{ + EXPECT_EQ(1, TilingData(4, 1, 4, false).numTiles()); + EXPECT_EQ(1, TilingData(4, 2, 4, false).numTiles()); + EXPECT_EQ(1, TilingData(4, 3, 4, false).numTiles()); + EXPECT_EQ(1, TilingData(4, 4, 4, false).numTiles()); + EXPECT_EQ(2, TilingData(4, 5, 4, false).numTiles()); + EXPECT_EQ(2, TilingData(4, 6, 4, false).numTiles()); + EXPECT_EQ(2, TilingData(4, 7, 4, false).numTiles()); + EXPECT_EQ(2, TilingData(4, 8, 4, false).numTiles()); + EXPECT_EQ(3, TilingData(4, 9, 4, false).numTiles()); + EXPECT_EQ(3, TilingData(4, 10, 4, false).numTiles()); + EXPECT_EQ(3, TilingData(4, 11, 4, false).numTiles()); + + EXPECT_EQ(1, TilingData(5, 1, 5, false).numTiles()); + EXPECT_EQ(1, TilingData(5, 2, 5, false).numTiles()); + EXPECT_EQ(1, TilingData(5, 3, 5, false).numTiles()); + EXPECT_EQ(1, TilingData(5, 4, 5, false).numTiles()); + EXPECT_EQ(1, TilingData(5, 5, 5, false).numTiles()); + EXPECT_EQ(2, TilingData(5, 6, 5, false).numTiles()); + EXPECT_EQ(2, TilingData(5, 7, 5, false).numTiles()); + EXPECT_EQ(2, TilingData(5, 8, 5, false).numTiles()); + EXPECT_EQ(2, TilingData(5, 9, 5, false).numTiles()); + EXPECT_EQ(2, TilingData(5, 10, 5, false).numTiles()); + EXPECT_EQ(3, TilingData(5, 11, 5, false).numTiles()); + + EXPECT_EQ(1, TilingData(16, 16, 16, false).numTiles()); + EXPECT_EQ(1, TilingData(17, 16, 16, false).numTiles()); + EXPECT_EQ(4, TilingData(15, 16, 16, false).numTiles()); + EXPECT_EQ(4, TilingData(8, 16, 16, false).numTiles()); + EXPECT_EQ(6, TilingData(8, 17, 16, false).numTiles()); +} + +TEST(TilingDataTest, numTiles_TilingWithBorders) +{ + EXPECT_EQ(1, TilingData(3, 1, 3, true).numTiles()); + EXPECT_EQ(1, TilingData(3, 2, 3, true).numTiles()); + EXPECT_EQ(1, TilingData(3, 3, 3, true).numTiles()); + EXPECT_EQ(2, TilingData(3, 4, 3, true).numTiles()); + EXPECT_EQ(3, TilingData(3, 5, 3, true).numTiles()); + EXPECT_EQ(4, TilingData(3, 6, 3, true).numTiles()); + EXPECT_EQ(5, TilingData(3, 7, 3, true).numTiles()); + + EXPECT_EQ(1, TilingData(4, 1, 4, true).numTiles()); + EXPECT_EQ(1, TilingData(4, 2, 4, true).numTiles()); + EXPECT_EQ(1, TilingData(4, 3, 4, true).numTiles()); + EXPECT_EQ(1, TilingData(4, 4, 4, true).numTiles()); + EXPECT_EQ(2, TilingData(4, 5, 4, true).numTiles()); + EXPECT_EQ(2, TilingData(4, 6, 4, true).numTiles()); + EXPECT_EQ(3, TilingData(4, 7, 4, true).numTiles()); + EXPECT_EQ(3, TilingData(4, 8, 4, true).numTiles()); + EXPECT_EQ(4, TilingData(4, 9, 4, true).numTiles()); + EXPECT_EQ(4, TilingData(4, 10, 4, true).numTiles()); + EXPECT_EQ(5, TilingData(4, 11, 4, true).numTiles()); + + EXPECT_EQ(1, TilingData(5, 1, 5, true).numTiles()); + EXPECT_EQ(1, TilingData(5, 2, 5, true).numTiles()); + EXPECT_EQ(1, TilingData(5, 3, 5, true).numTiles()); + EXPECT_EQ(1, TilingData(5, 4, 5, true).numTiles()); + EXPECT_EQ(1, TilingData(5, 5, 5, true).numTiles()); + EXPECT_EQ(2, TilingData(5, 6, 5, true).numTiles()); + EXPECT_EQ(2, TilingData(5, 7, 5, true).numTiles()); + EXPECT_EQ(2, TilingData(5, 8, 5, true).numTiles()); + EXPECT_EQ(3, TilingData(5, 9, 5, true).numTiles()); + EXPECT_EQ(3, TilingData(5, 10, 5, true).numTiles()); + EXPECT_EQ(3, TilingData(5, 11, 5, true).numTiles()); +} + +TEST(TilingDataTest, tileXIndexFromSrcCoord) +{ + EXPECT_EQ(0, TilingData(3, 10, 10, false).tileXIndexFromSrcCoord(0)); + EXPECT_EQ(0, TilingData(3, 10, 10, false).tileXIndexFromSrcCoord(1)); + EXPECT_EQ(0, TilingData(3, 10, 10, false).tileXIndexFromSrcCoord(2)); + EXPECT_EQ(1, TilingData(3, 10, 10, false).tileXIndexFromSrcCoord(3)); + EXPECT_EQ(1, TilingData(3, 10, 10, false).tileXIndexFromSrcCoord(4)); + EXPECT_EQ(1, TilingData(3, 10, 10, false).tileXIndexFromSrcCoord(5)); + EXPECT_EQ(2, TilingData(3, 10, 10, false).tileXIndexFromSrcCoord(6)); + EXPECT_EQ(2, TilingData(3, 10, 10, false).tileXIndexFromSrcCoord(7)); + EXPECT_EQ(2, TilingData(3, 10, 10, false).tileXIndexFromSrcCoord(8)); + EXPECT_EQ(3, TilingData(3, 10, 10, false).tileXIndexFromSrcCoord(9)); + EXPECT_EQ(3, TilingData(3, 10, 10, false).tileXIndexFromSrcCoord(10)); + EXPECT_EQ(3, TilingData(3, 10, 10, false).tileXIndexFromSrcCoord(11)); + + EXPECT_EQ(0, TilingData(3, 10, 10, true).tileXIndexFromSrcCoord(0)); + EXPECT_EQ(0, TilingData(3, 10, 10, true).tileXIndexFromSrcCoord(1)); + EXPECT_EQ(1, TilingData(3, 10, 10, true).tileXIndexFromSrcCoord(2)); + EXPECT_EQ(2, TilingData(3, 10, 10, true).tileXIndexFromSrcCoord(3)); + EXPECT_EQ(3, TilingData(3, 10, 10, true).tileXIndexFromSrcCoord(4)); + EXPECT_EQ(4, TilingData(3, 10, 10, true).tileXIndexFromSrcCoord(5)); + EXPECT_EQ(5, TilingData(3, 10, 10, true).tileXIndexFromSrcCoord(6)); + EXPECT_EQ(6, TilingData(3, 10, 10, true).tileXIndexFromSrcCoord(7)); + EXPECT_EQ(7, TilingData(3, 10, 10, true).tileXIndexFromSrcCoord(8)); + EXPECT_EQ(7, TilingData(3, 10, 10, true).tileXIndexFromSrcCoord(9)); + EXPECT_EQ(7, TilingData(3, 10, 10, true).tileXIndexFromSrcCoord(10)); + EXPECT_EQ(7, TilingData(3, 10, 10, true).tileXIndexFromSrcCoord(11)); +} +TEST(TilingDataTest, tileYIndexFromSrcCoord) +{ + EXPECT_EQ(0, TilingData(3, 10, 10, false).tileYIndexFromSrcCoord(0)); + EXPECT_EQ(0, TilingData(3, 10, 10, false).tileYIndexFromSrcCoord(1)); + EXPECT_EQ(0, TilingData(3, 10, 10, false).tileYIndexFromSrcCoord(2)); + EXPECT_EQ(1, TilingData(3, 10, 10, false).tileYIndexFromSrcCoord(3)); + EXPECT_EQ(1, TilingData(3, 10, 10, false).tileYIndexFromSrcCoord(4)); + EXPECT_EQ(1, TilingData(3, 10, 10, false).tileYIndexFromSrcCoord(5)); + EXPECT_EQ(2, TilingData(3, 10, 10, false).tileYIndexFromSrcCoord(6)); + EXPECT_EQ(2, TilingData(3, 10, 10, false).tileYIndexFromSrcCoord(7)); + EXPECT_EQ(2, TilingData(3, 10, 10, false).tileYIndexFromSrcCoord(8)); + EXPECT_EQ(3, TilingData(3, 10, 10, false).tileYIndexFromSrcCoord(9)); + EXPECT_EQ(3, TilingData(3, 10, 10, false).tileYIndexFromSrcCoord(10)); + EXPECT_EQ(3, TilingData(3, 10, 10, false).tileYIndexFromSrcCoord(11)); + + EXPECT_EQ(0, TilingData(3, 10, 10, true).tileYIndexFromSrcCoord(0)); + EXPECT_EQ(0, TilingData(3, 10, 10, true).tileYIndexFromSrcCoord(1)); + EXPECT_EQ(1, TilingData(3, 10, 10, true).tileYIndexFromSrcCoord(2)); + EXPECT_EQ(2, TilingData(3, 10, 10, true).tileYIndexFromSrcCoord(3)); + EXPECT_EQ(3, TilingData(3, 10, 10, true).tileYIndexFromSrcCoord(4)); + EXPECT_EQ(4, TilingData(3, 10, 10, true).tileYIndexFromSrcCoord(5)); + EXPECT_EQ(5, TilingData(3, 10, 10, true).tileYIndexFromSrcCoord(6)); + EXPECT_EQ(6, TilingData(3, 10, 10, true).tileYIndexFromSrcCoord(7)); + EXPECT_EQ(7, TilingData(3, 10, 10, true).tileYIndexFromSrcCoord(8)); + EXPECT_EQ(7, TilingData(3, 10, 10, true).tileYIndexFromSrcCoord(9)); + EXPECT_EQ(7, TilingData(3, 10, 10, true).tileYIndexFromSrcCoord(10)); + EXPECT_EQ(7, TilingData(3, 10, 10, true).tileYIndexFromSrcCoord(11)); +} + +TEST(TilingDataTest, tileSizeX) +{ + EXPECT_EQ(5, TilingData(5, 5, 5, false).tileSizeX(0)); + EXPECT_EQ(5, TilingData(5, 5, 5, true).tileSizeX(0)); + + EXPECT_EQ(5, TilingData(5, 6, 6, false).tileSizeX(0)); + EXPECT_EQ(1, TilingData(5, 6, 6, false).tileSizeX(1)); + EXPECT_EQ(4, TilingData(5, 6, 6, true).tileSizeX(0)); + EXPECT_EQ(2, TilingData(5, 6, 6, true).tileSizeX(1)); + + EXPECT_EQ(5, TilingData(5, 8, 8, false).tileSizeX(0)); + EXPECT_EQ(3, TilingData(5, 8, 8, false).tileSizeX(1)); + EXPECT_EQ(4, TilingData(5, 8, 8, true).tileSizeX(0)); + EXPECT_EQ(4, TilingData(5, 8, 8, true).tileSizeX(1)); + + EXPECT_EQ(5, TilingData(5, 10, 10, false).tileSizeX(0)); + EXPECT_EQ(5, TilingData(5, 10, 10, false).tileSizeX(1)); + EXPECT_EQ(4, TilingData(5, 10, 10, true).tileSizeX(0)); + EXPECT_EQ(3, TilingData(5, 10, 10, true).tileSizeX(1)); + EXPECT_EQ(3, TilingData(5, 10, 10, true).tileSizeX(2)); + + EXPECT_EQ(4, TilingData(5, 11, 11, true).tileSizeX(2)); + EXPECT_EQ(3, TilingData(5, 12, 12, true).tileSizeX(2)); +} +TEST(TilingDataTest, tileSizeY) +{ + EXPECT_EQ(5, TilingData(5, 5, 5, false).tileSizeY(0)); + EXPECT_EQ(5, TilingData(5, 5, 5, true).tileSizeY(0)); + + EXPECT_EQ(5, TilingData(5, 6, 6, false).tileSizeY(0)); + EXPECT_EQ(1, TilingData(5, 6, 6, false).tileSizeY(1)); + EXPECT_EQ(4, TilingData(5, 6, 6, true).tileSizeY(0)); + EXPECT_EQ(2, TilingData(5, 6, 6, true).tileSizeY(1)); + + EXPECT_EQ(5, TilingData(5, 8, 8, false).tileSizeY(0)); + EXPECT_EQ(3, TilingData(5, 8, 8, false).tileSizeY(1)); + EXPECT_EQ(4, TilingData(5, 8, 8, true).tileSizeY(0)); + EXPECT_EQ(4, TilingData(5, 8, 8, true).tileSizeY(1)); + + EXPECT_EQ(5, TilingData(5, 10, 10, false).tileSizeY(0)); + EXPECT_EQ(5, TilingData(5, 10, 10, false).tileSizeY(1)); + EXPECT_EQ(4, TilingData(5, 10, 10, true).tileSizeY(0)); + EXPECT_EQ(3, TilingData(5, 10, 10, true).tileSizeY(1)); + EXPECT_EQ(3, TilingData(5, 10, 10, true).tileSizeY(2)); + + EXPECT_EQ(4, TilingData(5, 11, 11, true).tileSizeY(2)); + EXPECT_EQ(3, TilingData(5, 12, 12, true).tileSizeY(2)); +} + +} // namespace diff --git a/WebKit/chromium/tests/WebInputEventFactoryTestGtk.cpp b/WebKit/chromium/tests/WebInputEventFactoryTestGtk.cpp new file mode 100644 index 0000000..7cd4837 --- /dev/null +++ b/WebKit/chromium/tests/WebInputEventFactoryTestGtk.cpp @@ -0,0 +1,112 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#include <gdk/gdk.h> +#include <gtest/gtest.h> + +#include "WebInputEvent.h" +#include "WebInputEventFactory.h" + +using WebKit::WebMouseEvent; +using WebKit::WebInputEventFactory; + +namespace { + +TEST(WebInputEventFactoryTest, DoubleClick) +{ + GdkEventButton firstClick; + firstClick.type = GDK_BUTTON_PRESS; + firstClick.window = static_cast<GdkWindow*>(GINT_TO_POINTER(1)); + firstClick.x = firstClick.y = firstClick.x_root = firstClick.y_root = 100; + firstClick.state = 0; + firstClick.time = 0; + firstClick.button = 1; + + // Single click works. + WebMouseEvent firstClickEvent = WebInputEventFactory::mouseEvent(&firstClick); + EXPECT_EQ(1, firstClickEvent.clickCount); + + // Make sure double click works. + GdkEventButton secondClick = firstClick; + secondClick.time = firstClick.time + 100; + WebMouseEvent secondClickEvent = WebInputEventFactory::mouseEvent(&secondClick); + EXPECT_EQ(2, secondClickEvent.clickCount); + + // Reset the click count. + firstClick.time += 10000; + firstClickEvent = WebInputEventFactory::mouseEvent(&firstClick); + EXPECT_EQ(1, firstClickEvent.clickCount); + + // Two clicks with a long gap in between aren't counted as a double click. + secondClick = firstClick; + secondClick.time = firstClick.time + 1000; + secondClickEvent = WebInputEventFactory::mouseEvent(&secondClick); + EXPECT_EQ(1, secondClickEvent.clickCount); + + // Reset the click count. + firstClick.time += 10000; + firstClickEvent = WebInputEventFactory::mouseEvent(&firstClick); + EXPECT_EQ(1, firstClickEvent.clickCount); + + // Two clicks far apart (horizontally) aren't counted as a double click. + secondClick = firstClick; + secondClick.time = firstClick.time + 1; + secondClick.x = firstClick.x + 100; + secondClickEvent = WebInputEventFactory::mouseEvent(&secondClick); + EXPECT_EQ(1, secondClickEvent.clickCount); + + // Reset the click count. + firstClick.time += 10000; + firstClickEvent = WebInputEventFactory::mouseEvent(&firstClick); + EXPECT_EQ(1, firstClickEvent.clickCount); + + // Two clicks far apart (vertically) aren't counted as a double click. + secondClick = firstClick; + secondClick.time = firstClick.time + 1; + secondClick.x = firstClick.y + 100; + secondClickEvent = WebInputEventFactory::mouseEvent(&secondClick); + EXPECT_EQ(1, secondClickEvent.clickCount); + + // Reset the click count. + firstClick.time += 10000; + firstClickEvent = WebInputEventFactory::mouseEvent(&firstClick); + EXPECT_EQ(1, firstClickEvent.clickCount); + + // Two clicks on different windows aren't a double click. + secondClick = firstClick; + secondClick.time = firstClick.time + 1; + secondClick.window = static_cast<GdkWindow*>(GINT_TO_POINTER(2)); + secondClickEvent = WebInputEventFactory::mouseEvent(&secondClick); + EXPECT_EQ(1, secondClickEvent.clickCount); +} + +} // anonymous namespace |