diff options
Diffstat (limited to 'WebKit/chromium')
384 files changed, 36374 insertions, 9786 deletions
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog index 9cd3644..6b0b3fa 100644 --- a/WebKit/chromium/ChangeLog +++ b/WebKit/chromium/ChangeLog @@ -1,3 +1,12854 @@ +2010-08-25 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r66074. + http://trac.webkit.org/changeset/66074 + https://bugs.webkit.org/show_bug.cgi?id=44660 + + Chromium canary turned red (Requested by yuzo on #webkit). + + * features.gypi: + * public/WebRuntimeFeatures.h: + * src/WebRuntimeFeatures.cpp: + +2010-08-25 Michael Nordman <michaeln@google.com> + + Reviewed by David Levin. + + https://bugs.webkit.org/show_bug.cgi?id=44133 + WebKitAPI to allow runtime enablement of XmlHttpRequest.responseBlob. + + * features.gypi: Define ENABLE_XHR_RESPONSE_BLOB. + * public/WebRuntimeFeatures.h: + * src/WebRuntimeFeatures.cpp: + (WebKit::WebRuntimeFeatures::enableXHRResponseBlob): + (WebKit::WebRuntimeFeatures::isXHRResponseBlobEnabled): + +2010-08-24 Victoria Kirst <vrk@google.com> + + Reviewed by Darin Fisher. + + Adding a way to communicate video frames between Chromium and WebKit. + The WebKit side acts as a middleman between Chromium and WebCore. + The VideoFrameChromiumImpl is not being used by WebCore yet, as there + still needs to be an implementation of WebVideoFrame in Chromium + -- coming soon in a subsequent patch. + + API changes for Video Frame sharing between WebKit and Chromium + https://bugs.webkit.org/show_bug.cgi?id=44539 + + * WebKit.gyp: + * public/WebMediaPlayer.h: + (WebKit::WebMediaPlayer::getCurrentFrame): + (WebKit::WebMediaPlayer::putCurrentFrame): + * public/WebVideoFrame.h: Added. + * src/VideoFrameChromiumImpl.cpp: Added. + (WebKit::VideoFrameChromiumImpl::toWebVideoFrame): + (WebKit::VideoFrameChromiumImpl::VideoFrameChromiumImpl): + (WebKit::VideoFrameChromiumImpl::type): + (WebKit::VideoFrameChromiumImpl::format): + (WebKit::VideoFrameChromiumImpl::width): + (WebKit::VideoFrameChromiumImpl::height): + (WebKit::VideoFrameChromiumImpl::planes): + (WebKit::VideoFrameChromiumImpl::stride): + (WebKit::VideoFrameChromiumImpl::data): + * src/VideoFrameChromiumImpl.h: Added. + * src/WebMediaPlayerClientImpl.cpp: + (WebKit::WebMediaPlayerClientImpl::getCurrentFrame): + (WebKit::WebMediaPlayerClientImpl::putCurrentFrame): + (WebKit::WebMediaPlayerClientImpl::create): + * src/WebMediaPlayerClientImpl.h: + +2010-08-25 Eric Seidel <eric@webkit.org> + + Unreviewed. Build fix. + + Make Chromiums Broken WebPageSerializerImpl compile again + https://bugs.webkit.org/show_bug.cgi?id=44652 + + Make it compile again. This code is still horribly wrong. + + * src/WebPageSerializerImpl.cpp: + (WebKit::WebPageSerializerImpl::endTagToString): + +2010-08-20 Zhenyao Mo <zmo@google.com> + + Reviewed by Kenneth Russell. + + WebGL must enforce restrictions even if running on OpenGL ES 2.0 + https://bugs.webkit.org/show_bug.cgi?id=42908 + + * public/WebGraphicsContext3D.h: Add two new flags. + * src/GraphicsContext3D.cpp: Ditto. + (WebCore::GraphicsContext3DInternal::isGLES2NPOTStrict): + (WebCore::GraphicsContext3DInternal::isErrorGeneratedOnOutOfBoundsAccesses): + (WebCore::GraphicsContext3D::isGLES2NPOTStrict): + (WebCore::GraphicsContext3D::isErrorGeneratedOnOutOfBoundsAccesses): + * src/WebGraphicsContext3DDefaultImpl.cpp: Ditto. + (WebKit::WebGraphicsContext3DDefaultImpl::isGLES2NPOTStrict): + (WebKit::WebGraphicsContext3DDefaultImpl::isErrorGeneratedOnOutOfBoundsAccesses): + * src/WebGraphicsContext3DDefaultImpl.h: Ditto. + +2010-08-24 Zhenyao Mo <zmo@google.com> + + Reviewed by Kenneth Russell. + + Passing premultiplyAlpha=false to tex{Sub}Image2D loses information (skia) + https://bugs.webkit.org/show_bug.cgi?id=38282 + + * src/WebImageDecoder.cpp: + (WebKit::WebImageDecoder::init): Add premultiplyAlpha flag. + +2010-08-25 Satish Sampath <satish@chromium.org> + + Reviewed by Jeremy Orlow. + + Pass the element's bounds to embedder during speech recognition. + https://bugs.webkit.org/show_bug.cgi?id=44427 + + * public/WebSpeechInputController.h: + (WebKit::WebSpeechInputController::startRecognition): + (WebKit::WebSpeechInputController::cancelRecognition): + (WebKit::WebSpeechInputController::stopRecording): + * src/SpeechInputClientImpl.cpp: + (WebKit::SpeechInputClientImpl::startRecognition): + * src/SpeechInputClientImpl.h: + * src/WebSpeechInputControllerMockImpl.cpp: + (WebKit::WebSpeechInputControllerMockImpl::startRecognition): + * src/WebSpeechInputControllerMockImpl.h: + +2010-08-25 Pawel Hajdan <phajdan.jr@chromium.org> + + Reviewed by Darin Fisher. + + Add an assertion to prevent re-initializing WebKit. + https://bugs.webkit.org/show_bug.cgi?id=44545 + + This will help prevent crashes like: + - http://code.google.com/p/chromium/issues/detail?id=52731 + - http://code.google.com/p/chromium/issues/detail?id=52643 + + * src/WebKit.cpp: + (WebKit::initialize): + +2010-08-25 Jay Civelli <jcivelli@chromium.org> + + Reviewed by Dimitri Glazkov. + + Adding missing test files and reenabling the WebFrame unit-test. + https://bugs.webkit.org/show_bug.cgi?id=44492 + + * tests/WebFrameTest.cpp: + (WebKit::TEST_F): + * tests/data/iframes_test.html: Added. + * tests/data/invisible_iframe.html: Added. + * tests/data/visible_iframe.html: Added. + * tests/data/zero_sized_iframe.html: Added. + +2010-08-25 Kent Tamura <tkent@chromium.org> + + Unreviewed, build fix. + + * DEPS: Roll Chromium revision to 57298 to fix upstream build. + +2010-08-24 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by Adam Barth. + + Build fix: Remove setHTML5ParserEnabled(), it's no longer used. + + * public/WebSettings.h: + * src/WebSettingsImpl.cpp: + * src/WebSettingsImpl.h: + +2010-08-24 Jian Li <jianli@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] WebBlobRegistry cleanup. + https://bugs.webkit.org/show_bug.cgi?id=44571 + + Remove unneeded method from WebBlobRegistry interface. + Also remove unneeded WebBlobRegistryImpl.* files. They're already + excluded from gyp files. + + * public/WebBlobRegistry.h: + * src/WebBlobRegistryImpl.cpp: Removed. + * src/WebBlobRegistryImpl.h: Removed. + +2010-08-24 Adam Barth <abarth@webkit.org> + + Reviewed by Dimitri Glazkov. + + [Chromium] Hulu popups are blocked + https://bugs.webkit.org/show_bug.cgi?id=44572 + + We were blocking popups created by Flash Player because we were never + setting the UserGestureIndicator for events. Most WebKit ports handle + events through EventHandler, but Chromium is special (for some unknown + reason) and dispatches events directly. That means Chromium misses out + on some of the work done by EventHandler, including setting the + UserGestureIndicator. + + I suspect this is covered by an existing LayoutTest, but I don't have + the ability to run the Chromium LayoutTests on this machine. :( + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::handleInputEvent): + +2010-08-24 Jian Li <jianli@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Update WebBlobData. + https://bugs.webkit.org/show_bug.cgi?id=44481 + + Some changes to WebBlobData to match with chromium implementation. + 1) Change to use WebCString for data, instead of WebData. + 2) Separate path from URL. + + * public/WebBlobData.h: + * src/WebBlobData.cpp: + (WebKit::WebBlobData::itemAt): + (WebKit::WebBlobData::appendData): + (WebKit::WebBlobData::appendBlob): + * src/WebBlobStorageData.cpp: + (WebKit::WebBlobStorageData::itemAt): + +2010-08-24 Marcus Bulach <bulach@chromium.org> + + Reviewed by Jeremy Orlow. + + Hooks IDBKeyPath with IDBObjectStorage::put. + https://bugs.webkit.org/show_bug.cgi?id=44275 + + Adds a mechanism to extract an IDBKey from SerializedScriptValue using IDBKeyPath + during IDBObjectStorage::put. + + * public/WebIDBKey.h: + (WebKit::WebIDBKey::WebIDBKey): + * public/WebKitClient.h: + (WebKit::WebKitClient::createIDBKeysFromSerializedValuesAndKeyPath): + * src/ChromiumBridge.cpp: + (WebCore::ChromiumBridge::createIDBKeysFromSerializedValuesAndKeyPath): + +2010-08-24 Kent Tamura <tkent@chromium.org> + + Reviewed by Jeremy Orlow. + + [DRT/Chromium] Support for IndexedDB tests + https://bugs.webkit.org/show_bug.cgi?id=44490 + + * DEPS: Roll Chromium to r57145 to have a webkit_support change. + +2010-08-24 Roland Steiner <rolandsteiner@chromium.org> + + Unreviewed build fix. + + put the "DISABLED_" in front of the right identifier. + + * tests/WebFrameTest.cpp: + (WebKit::TEST_F): + +2010-08-23 Roland Steiner <rolandsteiner@chromium.org> + + Reviewed by Tamura Kent. + + Disable failing test + https://bugs.webkit.org/show_bug.cgi?id=44492 + + * tests/WebFrameTest.cpp: + (WebKit::TEST_F): + +2010-08-23 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-23 Kent Tamura <tkent@chromium.org> + + Unreviewed, build fix for r65852. + + * src/WebNode.cpp: + (WebKit::WebNode::parentNode): + +2010-08-23 Kenneth Russell <kbr@google.com> + + Reviewed by Dimitri Glazkov. + + Remove references to ArrayBuffer and ArrayBufferView from GraphicsContext3D + https://bugs.webkit.org/show_bug.cgi?id=44455 + + Updated Safari, Qt and Chromium WebGL ports to avoid referencing + ArrayBuffer and ArrayBufferView types from GraphicsContext3D. + + Ran all WebGL layout tests; no new regressions. Built and tested + WebKit on Mac OS X; built Chromium on Mac OS X and Linux. + + * src/GraphicsContext3D.cpp: + (WebCore::GraphicsContext3DInternal::bufferData): + (WebCore::GraphicsContext3DInternal::bufferSubData): + +2010-08-23 Jian Li <jianli@chromium.org> + + Reviewed by David Levin. + + Remove unneeded BlobRegistryImpl.* and WebBlobRegistryImpl.* from + chromium project files. + https://bugs.webkit.org/show_bug.cgi?id=44442 + + * WebKit.gyp: + +2010-08-23 Satish Sampath <satish@chromium.org> + + Reviewed by Jeremy Orlow. + + Remove obsolete public/API methods in chromium port + https://bugs.webkit.org/show_bug.cgi?id=44421 + + * public/WebSpeechInputController.h: + (WebKit::WebSpeechInputController::startRecognition): + (WebKit::WebSpeechInputController::cancelRecognition): + (WebKit::WebSpeechInputController::stopRecording): + * public/WebSpeechInputListener.h: + +2010-08-22 Daniel Bates <dbates@rim.com> + + Reviewed by Eric Seidel. + + Encapsulate document marker management into DocumentMarkerController + https://bugs.webkit.org/show_bug.cgi?id=44383 + + Modify call sites in the Chromium port to use DocumentMarkerController. + + No functionality was changed, so no new tests. + + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::stopFinding): + (WebKit::WebFrameImpl::addMarker): + (WebKit::WebFrameImpl::setMarkerActive): + +2010-08-22 Jian Li <jianli@chromium.org> + + Reviewed by Darin Fisher. + + Add the blob URL member to FormData. + https://bugs.webkit.org/show_bug.cgi?id=44387 + + As the result of adding the blob URL member to the FormData, we need + to update the corresponding WebKit API for chromium. + + * public/WebHTTPBody.h: + (WebKit::WebHTTPBody::Element::): + * src/WebHTTPBody.cpp: + (WebKit::WebHTTPBody::elementAt): + (WebKit::WebHTTPBody::appendBlob): + +2010-08-20 Kinuko Yasuda <kinuko@chromium.org> + + Unreviewed; build fix for chromium (and remove duplicated ChangeLog entry). + +2010-08-20 James Robinson <jamesr@chromium.org> + + Synchronize default of use_accelerated_compositing gyp variable with downstream. Unreviewed. + + * features.gypi: + +2010-08-20 Kinuko Yasuda <kinuko@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Add chromium-side callback implementation for FileSystem API + https://bugs.webkit.org/show_bug.cgi?id=44350 + + Add WebFileSystemCallbacks that calls back the WebCore's implementation. + + * WebKit.gyp: + * src/WebFileSystemCallbacksImpl.cpp: Added. + * src/WebFileSystemCallbacksImpl.h: Added. + +2010-08-20 Tony Chang <tony@chromium.org> + + Reviewed by Kent Tamura. + + [chromium] fix a null pointer crash when dispatching JS keyboard events + https://bugs.webkit.org/show_bug.cgi?id=44313 + + * src/WebInputEventConversion.cpp: + (WebKit::WebKeyboardEventBuilder::WebKeyboardEventBuilder): + +2010-08-20 Jay Civelli <jcivelli@chromium.org> + + Reviewed by Darin Fisher. + + Removing the deprecated class WebEvent and friends. + https://bugs.webkit.org/show_bug.cgi?id=44296 + + * WebKit.gyp: + * public/WebEvent.h: Removed. + * public/WebEventListener.h: Removed. + * public/WebMutationEvent.h: Removed. + * public/WebNode.h: + * src/EventListenerWrapper.cpp: + (WebKit::EventListenerWrapper::webDOMEventListenerDeleted): + * src/EventListenerWrapper.h: + * src/WebEvent.cpp: Removed. + * src/WebEventListener.cpp: Removed. + * src/WebEventListenerPrivate.cpp: Removed. + * src/WebEventListenerPrivate.h: Removed. + * src/WebNode.cpp: + (WebKit::WebNode::removeEventListener): + +2010-08-19 Zhenyao Mo <zmo@google.com> + + Reviewed by Kenneth Russell. + + Fix failing WebGL tests in Chromium in-process-webgl port + https://bugs.webkit.org/show_bug.cgi?id=44305 + + * src/WebGraphicsContext3DDefaultImpl.cpp: + (WebKit::WebGraphicsContext3DDefaultImpl::getVertexAttribOffset): Add implementation. + +2010-08-19 Pavel Podivilov <podivilov@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: enable DOM breakpoints for chromium + https://bugs.webkit.org/show_bug.cgi?id=42886 + + * src/js/DevTools.js: + (WebInspector.loaded): + +2010-08-19 Vincent Scheib <scheib@chromium.org> + + Reviewed by David Levin. + + [chromium] TilingData::tilePositionY has typo of X where Y should be used + https://bugs.webkit.org/show_bug.cgi?id=44195 + + Unit tests added for tileSize and tilePosition. + + * tests/TilingDataTest.cpp: + (WebCore::TEST): + +2010-08-19 Kinuko Yasuda <kinuko@chromium.org> + + Reviewed by Darin Fisher. + + Add WebKit API for FileSystem API + https://bugs.webkit.org/show_bug.cgi?id=43151 + + Add asynchronous FileSystem interface to WebKit API for + FileSystem API. + http://dev.w3.org/2009/dap/file-system/file-dir-sys.html + + * WebKit.gyp: + * public/WebFileError.h: Added. + * public/WebFileSystem.h: Added. + * public/WebFileSystemEntry.h: Added. + * public/WebFileSystemCallbacks.h: Added. + * public/WebKitClient.h: + (WebKit::WebKitClient::fileSystem): + * public/WebFrameClient.h: + (WebKit::WebFrameClient::openFileSystem): + +2010-08-19 Kinuko Yasuda <kinuko@chromium.org> + + Reviewed by Jian Li. + + [Chromium] Rolls Chromium DEPS forward to 56564 + https://bugs.webkit.org/show_bug.cgi?id=44281 + + Roll Chromium DEPS forward to 56564 to include WebFileSystem + implementation changes. + + * DEPS: + +2010-08-19 Vincent Scheib <scheib@chromium.org> + + Reviewed by David Levin. + + Fixing previous Mac only build breakage with TilingDataTest.cpp + https://bugs.webkit.org/show_bug.cgi?id=44223 + + TilingDataTest.cpp included the wrong header, which had a compile + option around the definition of the WebCore namespace. Without the + namespace defined, error. Fixed by correctly including TilingData.h, + which has no conditional compilation. + + * WebKit.gyp: + * tests/TilingDataTest.cpp: + +2010-08-19 Jochen Eisinger <jochen@chromium.org> + + Reviewed by Pavel Feldman. + + concatenated_devtools_js should depend on inspector_protocol_sources + https://bugs.webkit.org/show_bug.cgi?id=44255 + + * WebKit.gyp: + +2010-08-19 Pavel Podivilov <podivilov@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: activate/deactivate breakpoints using v8 debugger flag. + https://bugs.webkit.org/show_bug.cgi?id=44112 + + * src/js/DebuggerScript.js: + (): + +2010-08-19 Andrei Popescu <andreip@google.com> + + Reviewed by Jeremy Orlow. + + [IndexedDB] Abort idle IDBTransactions when the JS context they were created in finishes execution. + https://bugs.webkit.org/show_bug.cgi?id=44101 + + * WebKit.gyp: + * public/WebIDBDatabase.h: + (WebKit::WebIDBDatabase::transaction): + * public/WebIDBFactory.h: + (WebKit::WebIDBFactory::abortPendingTransactions): + * public/WebIDBTransaction.h: Added. + (WebKit::WebIDBTransaction::~WebIDBTransaction): + (WebKit::WebIDBTransaction::mode): + (WebKit::WebIDBTransaction::objectStore): + (WebKit::WebIDBTransaction::abort): + (WebKit::WebIDBTransaction::id): + (WebKit::WebIDBTransaction::setCallbacks): + * public/WebIDBTransactionCallbacks.h: Added. + (WebKit::WebIDBTransactionCallbacks::~WebIDBTransactionCallbacks): + (WebKit::WebIDBTransactionCallbacks::onAbort): + (WebKit::WebIDBTransactionCallbacks::id): + * src/IDBDatabaseProxy.cpp: + (WebCore::IDBDatabaseProxy::transaction): + * src/IDBFactoryBackendProxy.cpp: + (WebCore::IDBFactoryBackendProxy::abortPendingTransactions): + * src/IDBFactoryBackendProxy.h: + * src/IDBTransactionBackendProxy.cpp: Added. + (WebCore::IDBTransactionBackendProxy::create): + (WebCore::IDBTransactionBackendProxy::IDBTransactionBackendProxy): + (WebCore::IDBTransactionBackendProxy::~IDBTransactionBackendProxy): + (WebCore::IDBTransactionBackendProxy::objectStore): + (WebCore::IDBTransactionBackendProxy::mode): + (WebCore::IDBTransactionBackendProxy::abort): + (WebCore::IDBTransactionBackendProxy::scheduleTask): + (WebCore::IDBTransactionBackendProxy::sqliteDatabase): + (WebCore::IDBTransactionBackendProxy::id): + (WebCore::IDBTransactionBackendProxy::setCallbacks): + * src/IDBTransactionBackendProxy.h: Added. + * src/IDBTransactionCallbacksProxy.cpp: Added. + (WebCore::IDBTransactionCallbacksProxy::create): + (WebCore::IDBTransactionCallbacksProxy::IDBTransactionCallbacksProxy): + (WebCore::IDBTransactionCallbacksProxy::~IDBTransactionCallbacksProxy): + (WebCore::IDBTransactionCallbacksProxy::onAbort): + (WebCore::IDBTransactionCallbacksProxy::id): + * src/IDBTransactionCallbacksProxy.h: Added. + * src/WebDOMStringList.cpp: + (WebKit::WebDOMStringList::length): + * src/WebIDBDatabaseImpl.cpp: + (WebKit::WebIDBDatabaseImpl::transaction): + * src/WebIDBDatabaseImpl.h: + * src/WebIDBFactoryImpl.cpp: + (WebKit::WebIDBFactoryImpl::abortPendingTransactions): + * src/WebIDBFactoryImpl.h: + * src/WebIDBTransactionCallbacksImpl.cpp: Added. + (WebCore::WebIDBTransactionCallbacksImpl::WebIDBTransactionCallbacksImpl): + (WebCore::WebIDBTransactionCallbacksImpl::~WebIDBTransactionCallbacksImpl): + (WebCore::WebIDBTransactionCallbacksImpl::onAbort): + (WebCore::WebIDBTransactionCallbacksImpl::id): + * src/WebIDBTransactionCallbacksImpl.h: Added. + * src/WebIDBTransactionImpl.cpp: Added. + (WebKit::WebIDBTransactionImpl::WebIDBTransactionImpl): + (WebKit::WebIDBTransactionImpl::~WebIDBTransactionImpl): + (WebKit::WebIDBTransactionImpl::mode): + (WebKit::WebIDBTransactionImpl::objectStore): + (WebKit::WebIDBTransactionImpl::abort): + (WebKit::WebIDBTransactionImpl::id): + (WebKit::WebIDBTransactionImpl::setCallbacks): + * src/WebIDBTransactionImpl.h: Added. + (WebKit::): + +2010-08-19 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Chromium DevTools: There is no need in resource-based InjectedScript.js source. + Now that we populate front-end after its onload handler, I don't think we need + to install injected script early. + https://bugs.webkit.org/show_bug.cgi?id=44029 + + * public/WebDevToolsAgentClient.h: + * src/WebDevToolsAgentImpl.cpp: + (WebKit::): + (WebKit::WebDevToolsAgentImpl::attach): + (WebKit::WebDevToolsAgentImpl::frontendLoaded): + +2010-08-19 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Chromium DevTools: remove setRuntimeFeatureEnabled API method that + is no longer used. + https://bugs.webkit.org/show_bug.cgi?id=44237 + + * public/WebDevToolsAgent.h: + * src/WebDevToolsAgentImpl.cpp: + * src/WebDevToolsAgentImpl.h: + +2010-08-18 Jian Li <jianli@chromium.org> + + Fix layout test crashes in chromium. + + * src/BlobRegistryProxy.cpp: + (WebCore::BlobRegistryProxy::registerBlobURL): + (WebCore::BlobRegistryProxy::unregisterBlobURL): + +2010-08-18 Jian Li <jianli@chromium.org> + + Fix chromium build break. + + * src/WebBlobStorageData.cpp: + (WebKit::WebBlobStorageData::itemAt): + +2010-08-18 Jian Li <jianli@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Chromium side implementation of blob data and blob registry. + https://bugs.webkit.org/show_bug.cgi?id=43871 + + * WebKit.gyp: + * public/WebBlobData.h: Added. + * public/WebBlobRegistry.h: Added. + * public/WebBlobStorageData.h: Added. + * public/WebKitClient.h: + (WebKit::WebKitClient::blobRegistry): + * src/BlobRegistryProxy.cpp: Added. + * src/BlobRegistryProxy.h: Added. + * src/WebBlobData.cpp: Added. + * src/WebBlobRegistryImpl.cpp: Added. + * src/WebBlobRegistryImpl.h: Added. + * src/WebBlobStorageData.cpp: Added. + +2010-08-18 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by Darin Fisher. + + Propagate the m_downloadFilePath correctly. + https://bugs.webkit.org/show_bug.cgi?id=44198 + + * src/WebURLRequest.cpp: + (WebKit::WebURLRequestPrivateImpl::WebURLRequestPrivateImpl): + * src/WebURLResponse.cpp: + (WebKit::WebURLResponsePrivateImpl::WebURLResponsePrivateImpl): + +2010-08-18 Victor Wang <victorw@chromium.org> + + Unreviewed. Fix chromium multi dll build. + + * public/WebIDBKeyPath.h: + +2010-08-18 Jay Civelli <jcivelli@chromium.org> + + Reviewed by Darin Fisher. + + Renaming the WebEvent to WebDOMEvent and adding a new event class + for mouse events so that the event listener API can be used to listen + to them. The renaming is needed as there already is a WebMouseEvent class. + https://bugs.webkit.org/show_bug.cgi?id=43453 + + * WebKit.gyp: + * public/WebDOMEvent.h: Added. + * public/WebDOMEventListener.h: Added. + * public/WebDOMMouseEvent.h: Added. + * public/WebDOMMutationEvent.h: Added. + * public/WebNode.h: + * src/EventListenerWrapper.cpp: + * src/EventListenerWrapper.h: + * src/WebDOMEvent.cpp: Added. + * src/WebDOMEventListener.cpp: Added. + * src/WebDOMEventListenerPrivate.cpp: Added. + * src/WebDOMEventListenerPrivate.h: Added. + * src/WebDOMMouseEvent.cpp: Added. + * src/WebDOMMutationEvent.cpp: Added. + * src/WebNode.cpp: + (WebKit::WebNode::isElementNode): + (WebKit::WebNode::addDOMEventListener): + (WebKit::WebNode::removeDOMEventListener): + +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. + + Web Inspector: get rid of utility context + https://bugs.webkit.org/show_bug.cgi?id=43787 + + * public/WebDevToolsAgentClient.h: + * src/DebuggerAgentImpl.cpp: + * src/DebuggerAgentImpl.h: + * src/WebDevToolsAgentImpl.cpp: + (WebKit::): + (WebKit::WebDevToolsAgentImpl::~WebDevToolsAgentImpl): + (WebKit::WebDevToolsAgentImpl::attach): + (WebKit::WebDevToolsAgentImpl::detach): + (WebKit::WebDevToolsAgentImpl::frontendLoaded): + (WebKit::WebDevToolsAgentImpl::setRuntimeFeatureEnabled): + (WebKit::WebDevToolsAgentImpl::setApuAgentEnabled): + * src/WebDevToolsAgentImpl.h: + +2010-08-10 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector, Chromium: reloading of inspected page hits assert in InspectorController::enableDebuggerFromFrontend() + https://bugs.webkit.org/show_bug.cgi?id=43780 + + * src/WebDevToolsAgentImpl.cpp: + (WebKit::WebDevToolsAgentImpl::setRuntimeFeatureEnabled): + +2010-08-10 Hans Wennborg <hans@chromium.org> + + Reviewed by Jeremy Orlow. + + Implement chromium WebDeviceOrientationClient wrapper and have WebViewImpl get it from WebViewClient. + https://bugs.webkit.org/show_bug.cgi?id=43258 + + Provide a DeviceOrientationClient to Page by means of a + DeviceOrientationClientProxy that proxies calls to + a WebDeviceOrientationClient, an interface that can be implemented + in the WebKit or Chromium layer. An implementation to be used for + layout tests, wrapping DeviceOrientationClientMock, is provided. + + + * WebKit.gyp: + * public/WebDeviceOrientation.h: Added. + (WebKit::WebDeviceOrientation::WebDeviceOrientation): + * public/WebDeviceOrientationClient.h: Added. + (WebKit::WebDeviceOrientationClient::~WebDeviceOrientationClient): + * public/WebDeviceOrientationClientMock.h: Added. + (WebKit::WebDeviceOrientationClientMock::WebDeviceOrientationClientMock): + (WebKit::WebDeviceOrientationClientMock::~WebDeviceOrientationClientMock): + * public/WebDeviceOrientationController.h: Added. + (WebKit::WebDeviceOrientationController::WebDeviceOrientationController): + * public/WebViewClient.h: + (WebKit::WebViewClient::deviceOrientationClient): + * src/DeviceOrientationClientProxy.cpp: Added. + (WebKit::DeviceOrientationClientProxy::setController): + (WebKit::DeviceOrientationClientProxy::startUpdating): + (WebKit::DeviceOrientationClientProxy::stopUpdating): + (WebKit::DeviceOrientationClientProxy::lastOrientation): + * src/DeviceOrientationClientProxy.h: Added. + (WebKit::DeviceOrientationClientProxy::DeviceOrientationClientProxy): + * src/WebDeviceOrientation.cpp: Added. + (WebKit::WebDeviceOrientation::WebDeviceOrientation): + (WebKit::WebDeviceOrientation::operator=): + (WebKit::WebDeviceOrientation::operator PassRefPtr<WebCore::DeviceOrientation>): + * src/WebDeviceOrientationClientMock.cpp: Added. + (WebKit::WebDeviceOrientationClientMock::setController): + (WebKit::WebDeviceOrientationClientMock::startUpdating): + (WebKit::WebDeviceOrientationClientMock::stopUpdating): + (WebKit::WebDeviceOrientationClientMock::lastOrientation): + (WebKit::WebDeviceOrientationClientMock::setOrientation): + (WebKit::WebDeviceOrientationClientMock::initialize): + (WebKit::WebDeviceOrientationClientMock::reset): + * src/WebDeviceOrientationController.cpp: Added. + (WebKit::WebDeviceOrientationController::didChangeDeviceOrientation): + (WebKit::WebDeviceOrientationController::controller): + * src/WebViewImpl.cpp: + (WebKit::WebView::create): + (WebKit::WebViewImpl::WebViewImpl): + * src/WebViewImpl.h: + +2010-08-10 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r64988. + http://trac.webkit.org/changeset/64988 + https://bugs.webkit.org/show_bug.cgi?id=43775 + + "It seems to break chromium's ui_tests" (Requested by hamaji + on #webkit). + + * public/WebFrameClient.h: + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::detachedFromParent3): + +2010-08-10 Yury Semikhatsky <yurys@chromium.org> + + Unreviewed. Remove references to deleted header InspectorFrontend.h + + * src/WebDevToolsAgentImpl.cpp: + +2010-08-10 Yury Semikhatsky <yurys@chromium.org> + + Unreviewed. Fix Chromium compilation. + + * src/WebDevToolsAgentImpl.cpp: + (WebKit::WebDevToolsAgentImpl::frontendLoaded): + +2010-08-09 Gavin Barraclough <barraclough@apple.com> + + Speculative chromium build fix V. + + * tests/KURLTest.cpp: + (ComponentCase::TEST): + +2010-08-09 Gavin Barraclough <barraclough@apple.com> + + Speculative chromium build fix IV. + + * src/WebPageSerializerImpl.h: + +2010-08-09 Gavin Barraclough <barraclough@apple.com> + + Speculative chromium build fix II. + + * src/AssertMatchingEnums.cpp: + +2010-08-09 Gavin Barraclough <barraclough@apple.com> + + Speculative chromium build fix. + + * public/WebCString.h: + +2010-08-06 Gavin Barraclough <barraclough@apple.com> + + Rubber stamped by Sam Weinig + + Bug 43594 - Add string forwards to Forward.h + This allows us to remove forward declarations for these classes from + WebCore/WebKit (a step in moving these class from WebCore:: to WTF::). + + * public/WebCString.h: + * public/WebString.h: + * src/DOMUtilitiesPrivate.h: + * src/DebuggerAgentImpl.h: + * src/DebuggerAgentManager.h: + * src/WebDevToolsAgentImpl.h: + * src/WebDevToolsFrontendImpl.h: + * src/WebPageSerializerImpl.h: + +2010-08-09 Vangelis Kokkevis <vangelis@chromium.org> + + Reviewed by Dimitri Glazkov. + + Skip the slow software rendering path of GraphicsContext3D if accelerated + compositing is active. This fixes an issue with WebGL and the compositor + in which the software rendering of WebGL would cause the current GL context + to change while the compositor was processing layers. Tested by running + several WebGL samples both with the compositor enabled and disabled. + https://bugs.webkit.org/show_bug.cgi?id=43644 + + * src/GraphicsContext3D.cpp: + (WebCore::GraphicsContext3DInternal::GraphicsContext3DInternal): + (WebCore::GraphicsContext3DInternal::initialize): + (WebCore::GraphicsContext3DInternal::beginPaint): + +2010-08-06 James Hawkins <jhawkins@chromium.org> + + Reviewed by Dimitri Glazkov. + + [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-09 Pavel Feldman <pfeldman@chromium.org> + + Not reviewed: Chromium tests fix. + + Chromium: provisional interactive ui tests fix. + + * src/js/Tests.js: + (.TestSuite.prototype.testShowStoragePanel.this): + (.TestSuite.prototype.testShowStoragePanel): + +2010-08-09 Pavel Feldman <pfeldman@chromium.org> + + Not reviewed. Chromium tests fix. + + Disable runtime switch for device motion in chromium. + https://bugs.webkit.org/show_bug.cgi?id=43717 + + * src/WebViewImpl.cpp: + (WebKit::WebView::create): + +2010-08-09 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Chromium: Remove temporary device motion fix. + + https://bugs.webkit.org/show_bug.cgi?id=43713 + + * src/WebRuntimeFeatures.cpp: + (WebKit::WebRuntimeFeatures::enableDeviceOrientation): + +2010-08-07 Jay Civelli <jcivelli@chromium.org> + + Reviewed by Eric Seidel. + + Removed unecessary focus code. + https://bugs.webkit.org/show_bug.cgi?id=43542 + + * src/ChromiumBridge.cpp: + +2010-08-06 Victor Wang <victorw@chromium.org> + + Reviewed by Kent Tamura. + + [Chromium] Add dllimport/dllexport to WebSpeechInputControllerMock::create + so it works for windows dll build. + + https://bugs.webkit.org/show_bug.cgi?id=43627 + + * public/WebSpeechInputControllerMock.h: + +2010-08-06 James Robinson <jamesr@chromium.org> + + Reviewed by Simon Fraser. + + Composited canvas should be treated the same by the compositor and not be WebGL specific + https://bugs.webkit.org/show_bug.cgi?id=43589 + + Initializes the platformLayer as a CanvasLayerChromium, not a WebGLLayerChromium. + The layer itself isn't WebGL-specific. + + * src/GraphicsContext3D.cpp: + (WebCore::GraphicsContext3DInternal::initialize): + (WebCore::GraphicsContext3DInternal::platformLayer): + (WebCore::GraphicsContext3D::platformLayer): + +2010-08-06 Jessie Berlin <jberlin@apple.com> + + Roll out http://trac.webkit.org/changeset/64801, which broke the Safari Windows Build. + Unreviewed. + + * public/WebCString.h: + * public/WebString.h: + * src/DOMUtilitiesPrivate.h: + * src/DebuggerAgentImpl.h: + * src/DebuggerAgentManager.h: + * src/WebDevToolsAgentImpl.h: + * src/WebDevToolsFrontendImpl.h: + * src/WebPageSerializerImpl.h: + +2010-08-06 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Chromium: disable device motion by default. + + https://bugs.webkit.org/show_bug.cgi?id=43623 + + * public/WebRuntimeFeatures.h: + * src/WebRuntimeFeatures.cpp: + (WebKit::WebRuntimeFeatures::enableDeviceMotion): + (WebKit::WebRuntimeFeatures::isDeviceMotionEnabled): + (WebKit::WebRuntimeFeatures::enableDeviceOrientation): + +2010-08-06 Kavita Kanetkar <kkanetkar@chromium.org> + + Reviewed by Joseph Pecoraro. + + Web Inspector: Remove "Online/Offline" icon for Chrome's appcache devtools UI. + https://bugs.webkit.org/show_bug.cgi?id=43450 + + * src/js/DevTools.js: + (WebInspector.loaded): + +2010-08-05 Marcus Bulach <bulach@chromium.org> + + Reviewed by Jeremy Orlow. + + Initial bindings and plumbing for IDBCursor. + https://bugs.webkit.org/show_bug.cgi?id=41888 + + Test: storage/indexeddb/idb-opencursor.html + + * WebKit.gyp: + * public/WebIDBCallbacks.h: + (WebKit::WebIDBCallbacks::onSuccess): + * public/WebIDBCursor.h: Added. + (WebKit::WebIDBCursor::~WebIDBCursor): + (WebKit::WebIDBCursor::direction): + (WebKit::WebIDBCursor::key): + (WebKit::WebIDBCursor::value): + (WebKit::WebIDBCursor::update): + (WebKit::WebIDBCursor::continueFunction): + (WebKit::WebIDBCursor::remove): + * public/WebIDBKeyRange.h: Added. + (WebKit::WebIDBKeyRange::~WebIDBKeyRange): + (WebKit::WebIDBKeyRange::WebIDBKeyRange): + * public/WebIDBObjectStore.h: + (WebKit::WebIDBObjectStore::openCursor): + * src/IDBCallbacksProxy.cpp: + (WebCore::IDBCallbacksProxy::onSuccess): + * src/IDBCallbacksProxy.h: + * src/IDBCursorBackendProxy.cpp: Added. + (WebCore::IDBCursorBackendProxy::create): + (WebCore::IDBCursorBackendProxy::IDBCursorBackendProxy): + (WebCore::IDBCursorBackendProxy::~IDBCursorBackendProxy): + (WebCore::IDBCursorBackendProxy::direction): + (WebCore::IDBCursorBackendProxy::key): + (WebCore::IDBCursorBackendProxy::value): + (WebCore::IDBCursorBackendProxy::update): + (WebCore::IDBCursorBackendProxy::continueFunction): + (WebCore::IDBCursorBackendProxy::remove): + * src/IDBCursorBackendProxy.h: Added. + * src/IDBObjectStoreProxy.cpp: + (WebCore::IDBObjectStoreProxy::openCursor): + * src/IDBObjectStoreProxy.h: + * src/WebIDBCallbacksImpl.cpp: + (WebCore::WebIDBCallbacksImpl::onSuccess): + * src/WebIDBCallbacksImpl.h: + * src/WebIDBCursorImpl.cpp: Added. + (WebKit::WebIDBCursorImpl::WebIDBCursorImpl): + (WebKit::WebIDBCursorImpl::~WebIDBCursorImpl): + (WebKit::WebIDBCursorImpl::direction): + (WebKit::WebIDBCursorImpl::key): + (WebKit::WebIDBCursorImpl::value): + (WebKit::WebIDBCursorImpl::update): + (WebKit::WebIDBCursorImpl::continueFunction): + (WebKit::WebIDBCursorImpl::remove): + * src/WebIDBCursorImpl.h: Added. + * src/WebIDBKeyRange.cpp: Added. + (WebKit::WebIDBKeyRange::WebIDBKeyRange): + (WebKit::WebIDBKeyRange::assign): + (WebKit::WebIDBKeyRange::reset): + (WebKit::WebIDBKeyRange::left): + (WebKit::WebIDBKeyRange::right): + (WebKit::WebIDBKeyRange::flags): + * src/WebIDBObjectStoreImpl.cpp: + (WebKit::WebIDBObjectStoreImpl::openCursor): + * src/WebIDBObjectStoreImpl.h: + +2010-08-05 Andrei Popescu <andreip@dhcp-172-16-14-12.lon.corp.google.com> + + Reviewed by Jeremy Orlow. + + [IndexedDB] IndexedDB is missing the Transaction interface. + https://bugs.webkit.org/show_bug.cgi?id=42970 + + Add IDBTransaction boilerplate. + + * src/IDBDatabaseProxy.cpp: + (WebCore::IDBDatabaseProxy::transaction): + * src/IDBDatabaseProxy.h: + +2010-08-05 Gavin Barraclough <barraclough@apple.com> + + Rubber stamped by Sam Weinig + + Bug 43594 - Add string forwards to Forward.h + This allows us to remove forward declarations for these classes from + WebCore/WebKit (a step in moving these class from WebCore:: to WTF::). + + * public/WebCString.h: + * public/WebString.h: + * src/DOMUtilitiesPrivate.h: + * src/DebuggerAgentImpl.h: + * src/DebuggerAgentManager.h: + * src/WebDevToolsAgentImpl.h: + * src/WebDevToolsFrontendImpl.h: + * src/WebPageSerializerImpl.h: + +2010-08-05 Brett Wilson <brettw@chromium.org> + + Reviewed by Nate Chapin. + + Make the webkit unit tests depend on test_support_base + https://bugs.webkit.org/show_bug.cgi?id=43584 + + * WebKit.gyp: + +2010-08-04 Kenneth Russell <kbr@google.com> + + Reviewed by Dimitri Glazkov. + + Style cleanups in WebGL + https://bugs.webkit.org/show_bug.cgi?id=38761 + + Cleaned up all style violations in WebGL-related files reported by + check-webkit-style. No logic or other changes. Built WebKit and + Chromium and ran WebGL layout tests. + + * src/GraphicsContext3D.cpp: + (WebCore::GraphicsContext3DInternal::paintRenderingResultsToCanvas): + * src/WebGraphicsContext3DDefaultImpl.cpp: + * src/WebGraphicsContext3DDefaultImpl.h: + +2010-08-05 Jian Li <jianli@chromium.org> + + Reviewed by David Levin. + + Unify blob related feature defines to ENABLE(BLOB). + https://bugs.webkit.org/show_bug.cgi?id=43081 + + * features.gypi: + * src/WebHTTPBody.cpp: + (WebKit::WebHTTPBody::elementAt): + (WebKit::WebHTTPBody::appendFileRange): + +2010-08-05 Nico Weber <thakis@chromium.org> + + Reviewed by Jeremy Orlow. + + Remove useless const on return-by-value (fixes a clang warning) + https://bugs.webkit.org/show_bug.cgi?id=43491 + + * src/WebInputEventConversion.cpp: + (WebKit::toPlatformKeyboardEventType): + +2010-08-05 Satish Sampath <satish@chromium.org> + + Reviewed by Jeremy Orlow. + + Add speech input controller mock in WebKit and a layout test. + https://bugs.webkit.org/show_bug.cgi?id=43477 + + * WebKit.gyp: + * public/WebSpeechInputControllerMock.h: Added WebKit speech input controller mock interface. + * src/WebSpeechInputControllerMockImpl.cpp: Added implementation of the above mock. + (WebKit::WebSpeechInputControllerMockImpl::WebSpeechInputControllerMockImpl): + (WebKit::WebSpeechInputControllerMockImpl::setMockRecognitionResult): + (WebKit::WebSpeechInputControllerMockImpl::didCompleteRecording): + (WebKit::WebSpeechInputControllerMockImpl::didCompleteRecognition): + (WebKit::WebSpeechInputControllerMockImpl::setRecognitionResult): + (WebKit::WebSpeechInputControllerMockImpl::startRecognition): + (WebKit::WebSpeechInputControllerMockImpl::cancelRecognition): + (WebKit::WebSpeechInputControllerMockImpl::stopRecording): + (WebKit::WebSpeechInputControllerMock::create): + +2010-08-05 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Chromium DevTools: [REGRESSION] Frame navigation is not handled in devtools. + + https://bugs.webkit.org/show_bug.cgi?id=43556 + + * src/WebDevToolsAgentImpl.cpp: + (WebKit::): + (WebKit::WebDevToolsAgentImpl::detach): + (WebKit::WebDevToolsAgentImpl::frontendLoaded): + (WebKit::WebDevToolsAgentImpl::setRuntimeFeatureEnabled): + +2010-08-05 John Gregg <johnnyg@google.com> + + Reviewed by Darin Fisher. + + [chromium] WebFileChooserParams should have default constructor + https://bugs.webkit.org/show_bug.cgi?id=43435 + + * public/WebFileChooserParams.h: + (WebKit::WebFileChooserParams::WebFileChooserParams): + +2010-08-05 Victoria Kirst <vrk@google.com> + + Reviewed by David Levin. + + Added a repaint request so that VideoLayerChromium does not have + a flickering problem when playing video. + https://bugs.webkit.org/show_bug.cgi?id=43101 + + * src/WebMediaPlayerClientImpl.cpp: + (WebKit::WebMediaPlayerClientImpl::repaint): + +2010-08-05 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + DevTools: get rid of delayed command dispatching on front-end side. + + https://bugs.webkit.org/show_bug.cgi?id=43479 + + * public/WebDevToolsFrontendClient.h: + (WebKit::WebDevToolsFrontendClient::sendFrontendLoaded): + * src/WebDevToolsAgentImpl.cpp: + (WebKit::WebDevToolsAgentImpl::attach): + (WebKit::WebDevToolsAgentImpl::frontendLoaded): + * src/WebDevToolsAgentImpl.h: + * src/WebDevToolsFrontendImpl.cpp: + (WebKit::WebDevToolsFrontendImpl::dispatchOnInspectorFrontend): + (WebKit::WebDevToolsFrontendImpl::frontendLoaded): + * src/WebDevToolsFrontendImpl.h: + * src/js/DevTools.js: + (WebInspector.doLoadedDone): + * src/js/Tests.js: + (.uiTests.runTest): + (.): + +2010-08-02 Kenneth Russell <kbr@google.com> + + Reviewed by Dimitri Glazkov. + + Port Chromium's accelerated compositing to Mac OS X + https://bugs.webkit.org/show_bug.cgi?id=43398 + + * public/WebGLES2Context.h: + - Added resizeOnscreenContent, needed on Mac OS X to report + window size changes. + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::resize): + - Send resize notification to the WebGLES2Context. + (WebKit::WebViewImpl::updateRootLayerContents): + - Ported to Core Graphics. + (WebKit::WebViewImpl::gles2Context): + - Added initial size notification upon context creation. + +2010-08-04 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + DevTools: get rid of delayed command dispatching on front-end side. + + https://bugs.webkit.org/show_bug.cgi?id=43479 + + * public/WebDevToolsAgent.h: + * src/WebDevToolsAgentImpl.cpp: + (WebKit::WebDevToolsAgentImpl::frontendLoaded): + * src/WebDevToolsAgentImpl.h: + +2010-08-03 James Robinson <jamesr@chromium.org> + + Reviewed by Darin Fisher. + + Move WebGL-specific code out of GraphicsContext3D so that G3D can be used as a generic accelerated drawing API + https://bugs.webkit.org/show_bug.cgi?id=43221 + + Implements functions in term of Platform3DObjects instead of WebGL types. + + * src/GraphicsContext3D.cpp: + (WebCore::GraphicsContext3DInternal::paintRenderingResultsToCanvas): + (WebCore::GraphicsContext3DInternal::beginPaint): + (WebCore::GraphicsContext3DInternal::bindAttribLocation): + (WebCore::GraphicsContext3DInternal::getActiveAttrib): + (WebCore::GraphicsContext3DInternal::getActiveUniform): + (WebCore::GraphicsContext3DInternal::getAttribLocation): + (WebCore::GraphicsContext3DInternal::getProgramInfoLog): + (WebCore::GraphicsContext3DInternal::getShaderInfoLog): + (WebCore::GraphicsContext3DInternal::getShaderSource): + (WebCore::GraphicsContext3DInternal::getUniformLocation): + (WebCore::GraphicsContext3DInternal::shaderSource): + +2010-08-03 Dimitri Glazkov <dglazkov@chromium.org> + + Unreviewed, build fix. + + Roll chromium to 54723 to unbreak the builds. + + * DEPS: + +2010-08-03 Andrei Popescu <andreip@google.com> + + Reviewed by Jeremy Orlow. + + [IndexedDB] IDBObjectStoreRequest should be called IDBObjectStore + https://bugs.webkit.org/show_bug.cgi?id=43420 + + * src/IDBCallbacksProxy.cpp: + (WebCore::IDBCallbacksProxy::onSuccess): + * src/IDBCallbacksProxy.h: + * src/IDBDatabaseProxy.cpp: + (WebCore::IDBDatabaseProxy::objectStore): + * src/IDBDatabaseProxy.h: + * src/IDBObjectStoreProxy.cpp: + (WebCore::IDBObjectStoreProxy::create): + * src/IDBObjectStoreProxy.h: + * src/WebIDBObjectStoreImpl.cpp: + (WebKit::WebIDBObjectStoreImpl::WebIDBObjectStoreImpl): + * src/WebIDBObjectStoreImpl.h: + +2010-08-03 Yury Semikhatsky <yurys@chromium.org> + + Unreviewed. Fix Chromium interactive UI tests. + + * src/js/Tests.js: + (.TestSuite.prototype.testResourceHeaders): + +2010-07-30 Andrei Popescu <andreip@dhcp-172-16-14-12.lon.corp.google.com> + + Reviewed by Jeremy Orlow. + + Rename IDBDatabaseRequest to IDBDatabase + https://bugs.webkit.org/show_bug.cgi?id=43250 + + * src/IDBCallbacksProxy.cpp: + (WebCore::IDBCallbacksProxy::onSuccess): + * src/IDBCallbacksProxy.h: + * src/IDBDatabaseProxy.cpp: + (WebCore::IDBDatabaseProxy::create): + * src/IDBDatabaseProxy.h: + * src/WebIDBDatabaseImpl.cpp: + (WebKit::WebIDBDatabaseImpl::WebIDBDatabaseImpl): + (WebKit::WebIDBDatabaseImpl::name): + (WebKit::WebIDBDatabaseImpl::description): + (WebKit::WebIDBDatabaseImpl::version): + (WebKit::WebIDBDatabaseImpl::objectStores): + (WebKit::WebIDBDatabaseImpl::createObjectStore): + (WebKit::WebIDBDatabaseImpl::objectStore): + (WebKit::WebIDBDatabaseImpl::removeObjectStore): + * src/WebIDBDatabaseImpl.h: + +2010-08-02 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Chromium DevTools: Get rid of DevTools RPC. + + https://bugs.webkit.org/show_bug.cgi?id=43335 + + * WebKit.gyp: + * public/WebDevToolsAgent.h: + * public/WebDevToolsAgentClient.h: + (WebKit::WebDevToolsAgentClient::sendMessageToInspectorFrontend): + (WebKit::WebDevToolsAgentClient::sendDebuggerOutput): + (WebKit::WebDevToolsAgentClient::sendDispatchToAPU): + * public/WebDevToolsFrontend.h: + * public/WebDevToolsFrontendClient.h: + (WebKit::WebDevToolsFrontendClient::sendMessageToBackend): + * public/WebDevToolsMessageData.h: Removed. + * public/WebDevToolsMessageTransport.h: Removed. + * src/APUAgentDelegate.h: Removed. + * src/DebuggerAgent.h: Removed. + * src/DebuggerAgentImpl.cpp: + (WebKit::DebuggerAgentImpl::DebuggerAgentImpl): + (WebKit::DebuggerAgentImpl::debuggerOutput): + * src/DebuggerAgentImpl.h: + * src/DebuggerAgentManager.cpp: + (WebKit::DebuggerAgentManager::debugDetach): + (WebKit::DebuggerAgentManager::onV8DebugMessage): + (WebKit::DebuggerAgentManager::executeDebuggerCommand): + (WebKit::DebuggerAgentManager::sendCommandToV8): + (WebKit::DebuggerAgentManager::sendContinueCommandToV8): + * src/DevToolsRPC.h: Removed. + * src/DevToolsRPCJS.h: Removed. + * src/InspectorClientImpl.cpp: + * src/InspectorFrontendClientImpl.cpp: + (WebKit::InspectorFrontendClientImpl::sendMessageToBackend): + * src/ProfilerAgent.h: Removed. + * src/ProfilerAgentImpl.cpp: Removed. + * src/ProfilerAgentImpl.h: Removed. + * src/ToolsAgent.h: Removed. + * src/WebDevToolsAgentImpl.cpp: + (WebKit::): + (WebKit::WebDevToolsAgentImpl::WebDevToolsAgentImpl): + (WebKit::WebDevToolsAgentImpl::attach): + (WebKit::WebDevToolsAgentImpl::didClearWindowObject): + (WebKit::WebDevToolsAgentImpl::dispatchOnInspectorBackend): + (WebKit::WebDevToolsAgentImpl::jsDispatchOnClient): + (WebKit::WebDevToolsAgentImpl::sendMessageToFrontend): + * src/WebDevToolsAgentImpl.h: + * src/WebDevToolsFrontendImpl.cpp: + (WebKit::WebDevToolsFrontendImpl::WebDevToolsFrontendImpl): + (WebKit::WebDevToolsFrontendImpl::dispatchOnInspectorFrontend): + (WebKit::WebDevToolsFrontendImpl::frontendLoaded): + (WebKit::WebDevToolsFrontendImpl::executeScript): + * src/WebDevToolsFrontendImpl.h: + * src/js/DevTools.js: + (devtools.dispatch): + (devtools.ToolsAgent): + * src/js/DevToolsHostStub.js: + * src/js/ProfilerAgent.js: + (devtools.ProfilerAgent): + (devtools.ProfilerAgent.prototype._getNextLogLines.else.delayedRequest): + (devtools.ProfilerAgent.prototype._getNextLogLines): + (devtools.ProfilerAgent.prototype._didGetProfilerLogLines): + * src/js/ProfilerProcessor.js: + (devtools.profiler.Processor.prototype.printError): + +2010-08-02 Kent Tamura <tkent@chromium.org> + + Reviewed by Dimitri Glazkov. + + [DRT/Chromium] Remove dependencies to some Chromium headers + https://bugs.webkit.org/show_bug.cgi?id=43396 + + * DEPS: Update Chromium revision to 54649 in order to have a + webkit_support change (r54646) + +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu + instances, concrete classes that inherit from ChromeClient needed to be changed to + implement the new methods. + + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::selectItemWritingDirectionIsNatural): + (WebKit::ChromeClientImpl::createPopupMenu): + (WebKit::ChromeClientImpl::createSearchPopupMenu): + * src/ChromeClientImpl.h: + +2010-08-02 Kent Tamura <tkent@chromium.org> + + Reviewed by Dimitri Glazkov. + + [DRT/Chromium] Always initialize GTK + https://bugs.webkit.org/show_bug.cgi?id=43327 + + * WebKit.gyp: Add GTK dependency for DRT. + +2010-08-02 Jeremy Orlow <jorlow@chromium.org> + + Speculative revert of 64425 due to Chromium instability + https://bugs.webkit.org/show_bug.cgi?id=43347 + + * src/ChromeClientImpl.cpp: + * src/ChromeClientImpl.h: + * tests/PopupMenuTest.cpp: + (WebKit::SelectPopupMenuTest::SetUp): + +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu + instances, concrete classes that inherit from ChromeClient needed to be changed to + implement the new methods. + + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::selectItemWritingDirectionIsNatural): + (WebKit::ChromeClientImpl::createPopupMenu): + (WebKit::ChromeClientImpl::createSearchPopupMenu): + * src/ChromeClientImpl.h: + +2010-07-31 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r64422. + http://trac.webkit.org/changeset/64422 + https://bugs.webkit.org/show_bug.cgi?id=43304 + + Build fixes are needed for Snow Leopard and Windows. + (Requested by lca on #webkit). + + * src/ChromeClientImpl.cpp: + * src/ChromeClientImpl.h: + +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu + instances, concrete classes that inherit from ChromeClient needed to be changed to + implement the new methods. + + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::selectItemWritingDirectionIsNatural): + (WebKit::ChromeClientImpl::createPopupMenu): + (WebKit::ChromeClientImpl::createSearchPopupMenu): + * src/ChromeClientImpl.h: + +2010-07-30 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by David Kilzer. + + Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas) + https://bugs.webkit.org/show_bug.cgi?id=40627 + + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::reachedApplicationCacheOriginQuota): + * src/ChromeClientImpl.h: + +2010-07-30 James Robinson <jamesr@chromium.org> + + Compile fix. Put GLES2 functions behind USE(GLES2_RENDERING) instead of + USE(ACCELERATED_COMPOSITING) to match WebCore. Fixes the compile when + USE(GLES2_RENDERING) is true and USE(ACCELERATED_COMPOSITING) is false. + + * src/ChromeClientImpl.cpp: + * src/ChromeClientImpl.h: + +2010-07-27 Darin Fisher <darin@chromium.org> + + Reviewed by Brady Eidson. + + History.pushState() + navigation operates on top frame when called from + nested context + https://bugs.webkit.org/show_bug.cgi?id=43080 + + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::pluginLoadObserver): The WebDataSource + can be null if the Frame has already been detached from the Page. This + happens if a popstate event handler removes the frame. + +2010-07-29 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Steve Block. + + Rename all the IDBIndex classses to match the latest conventions + https://bugs.webkit.org/show_bug.cgi?id=43190 + + Fix up stuff in WebKit layer to handle the renamings in WebCore. + + * WebKit.gyp: + * src/IDBCallbacksProxy.cpp: + (WebCore::IDBCallbacksProxy::onSuccess): + * src/IDBCallbacksProxy.h: + * src/IDBIndexBackendProxy.cpp: Added. + (WebCore::IDBIndexBackendProxy::create): + (WebCore::IDBIndexBackendProxy::IDBIndexBackendProxy): + (WebCore::IDBIndexBackendProxy::~IDBIndexBackendProxy): + (WebCore::IDBIndexBackendProxy::name): + (WebCore::IDBIndexBackendProxy::keyPath): + (WebCore::IDBIndexBackendProxy::unique): + * src/IDBIndexBackendProxy.h: Added. + * src/IDBIndexProxy.cpp: Removed. + * src/IDBIndexProxy.h: Removed. + * src/IDBObjectStoreProxy.cpp: + (WebCore::IDBObjectStoreProxy::index): + * src/IDBObjectStoreProxy.h: + * src/WebIDBCallbacksImpl.cpp: + (WebCore::WebIDBCallbacksImpl::onSuccess): + * src/WebIDBIndexImpl.cpp: + (WebKit::WebIDBIndexImpl::WebIDBIndexImpl): + (WebKit::WebIDBIndexImpl::name): + (WebKit::WebIDBIndexImpl::keyPath): + (WebKit::WebIDBIndexImpl::unique): + * src/WebIDBIndexImpl.h: + * src/WebIDBObjectStoreImpl.cpp: + (WebKit::WebIDBObjectStoreImpl::index): + +2010-07-30 Satish Sampath <satish@chromium.org> + + Reviewed by Jeremy Orlow. + + Add a check for WebViewClient being null. + https://bugs.webkit.org/show_bug.cgi?id=43240 + + * src/SpeechInputClientImpl.cpp: + (WebKit::SpeechInputClientImpl::SpeechInputClientImpl): + +2010-07-30 Hans Wennborg <hans@chromium.org> + + Reviewed by Steve Block. + + Disable runtime switch for device orientation in chromium + https://bugs.webkit.org/show_bug.cgi?id=43237 + + Explicitly set the runtime switch for device orientation + in WebView::create until we implement the feature. + If the flag is accidentally on while no DeviceOrientationClient + is provided, the program will crash. + + * src/WebViewImpl.cpp: + (WebKit::WebView::create): + +2010-07-26 Andrei Popescu <andreip@google.com> + + Reviewed by Jeremy Orlow. + + [IndexedDB] IndexedDatabase should be called IDBFactory. + https://bugs.webkit.org/show_bug.cgi?id=42967 + + * WebKit.gyp: + * public/WebIDBFactory.h: Added. + (WebKit::WebIDBFactory::~WebIDBFactory): + (WebKit::WebIDBFactory::databases): + (WebKit::WebIDBFactory::open): + * public/WebIndexedDatabase.h: Removed. + * public/WebKitClient.h: + (WebKit::WebKitClient::idbFactory): + * src/ChromiumBridge.cpp: + (WebCore::ChromiumBridge::idbFactory): + * src/IDBFactoryBackendProxy.cpp: Added. + (WebCore::IDBFactoryBackendProxy::create): + (WebCore::IDBFactoryBackendProxy::IDBFactoryBackendProxy): + (WebCore::IDBFactoryBackendProxy::~IDBFactoryBackendProxy): + (WebCore::IDBFactoryBackendProxy::open): + * src/IDBFactoryBackendProxy.h: Added. + * src/IndexedDatabaseProxy.cpp: Removed. + * src/IndexedDatabaseProxy.h: Removed. + * src/WebIDBFactoryImpl.cpp: Added. + (WebKit::WebIDBFactory::create): + (WebKit::WebIDBFactoryImpl::WebIDBFactoryImpl): + (WebKit::WebIDBFactoryImpl::~WebIDBFactoryImpl): + (WebKit::WebIDBFactoryImpl::open): + * src/WebIDBFactoryImpl.h: Added. + * src/WebIndexedDatabaseImpl.cpp: Removed. + * src/WebIndexedDatabaseImpl.h: Removed. + +2010-07-29 Andrei Popescu <andreip@google.com> + + Reviewed by Jeremy Orlow. + + [IndexedDB] WebDOMStringList ctor is not exported and causes link errors for the multi-dll chromium build + https://bugs.webkit.org/show_bug.cgi?id=43186 + + Add WEBKIT_API to WebDOMStringList default ctor. + + * public/WebDOMStringList.h: + +2010-07-29 Satish Sampath <satish@chromium.org> + + Reviewed by Steve Block. + + Runtime feature switch for speech input + https://bugs.webkit.org/show_bug.cgi?id=43146 + + Add a runtime feature switch that decides whether speech input attributes are available or not. + Defaults to true. + + * public/WebRuntimeFeatures.h: + * src/SpeechInputClientImpl.cpp: + (WebKit::SpeechInputClientImpl::SpeechInputClientImpl): + * src/WebRuntimeFeatures.cpp: + (WebKit::WebRuntimeFeatures::enableSpeechInput): + (WebKit::WebRuntimeFeatures::isSpeechInputEnabled): + +2010-07-28 Kavita Kanetkar <kkanetkar@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: Enable UI for chromium's appcache inspection. + https://bugs.webkit.org/show_bug.cgi?id=43098 + + * src/js/DevTools.js: + (WebInspector.loaded): + +2010-07-28 Dominic Mazzoni <dmazzoni@google.com> + + Reviewed by Dimitri Glazkov. + + Add access to the computed style display to WebAccessibilityObject. + https://bugs.webkit.org/show_bug.cgi?id=43044 + + * public/WebAccessibilityObject.h: + * src/WebAccessibilityObject.cpp: + (WebKit::WebAccessibilityObject::hasComputedStyle): + (WebKit::WebAccessibilityObject::computedStyleDisplay): + +2010-07-28 Hans Wennborg <hans@chromium.org> + + Reviewed by Jeremy Orlow. + + Set ENABLE_DEVICE_ORIENTATION=1 in features.gypi for chromium + https://bugs.webkit.org/show_bug.cgi?id=43122 + + Enable the compile-time switch for device orientation. + The switch was already enabled in features_override.gypi in the Chromium + repository (in revision 53317), and should be set here as well. + + The feature is being implemented behind a run-time flag which + defaults to off in Chromium. + + * features.gypi: Set ENABLE_DEVICE_ORIENTATION=1. + +2010-07-28 Gene Gutnik <gene@google.com> + + Reviewed by Darin Fisher. + + Fix mouse coordinate conversion. WindowX,Y is an absolute + mouse coordinates within browser window, x,y - are coordinates + relative to the plugin. + https://bugs.webkit.org/show_bug.cgi?id=42987 + + * src/WebInputEventConversion.cpp: + (WebKit::WebMouseEventBuilder::WebMouseEventBuilder): + (WebKit::WebMouseWheelEventBuilder::WebMouseWheelEventBuilder): + * src/WebInputEventConversion.h: + * src/WebPluginContainerImpl.cpp: + (WebKit::WebPluginContainerImpl::handleMouseEvent): + (WebKit::WebPluginContainerImpl::handleWheelEvent): + +2010-07-28 James Robinson <jamesr@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Add a bool to Settings to control accelerated 2d canvas + https://bugs.webkit.org/show_bug.cgi?id=43094 + + * public/WebSettings.h: + * src/WebSettingsImpl.cpp: + (WebKit::WebSettingsImpl::setAccelerated2dCanvasEnabled): + * src/WebSettingsImpl.h: + +2010-07-28 Brett Wilson <brettw@chromium.org> + + Reviewed by Darin Fisher. + + Fix forward declares to be struct instead of class. + https://bugs.webkit.org/show_bug.cgi?id=43127 + + * public/WebFont.h: + +2010-07-28 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Dimitri Glazkov. + + Chromium DevTools: [REGRESSION] sourceURL is not respected. + + https://bugs.webkit.org/show_bug.cgi?id=43124 + + * src/js/DebuggerScript.js: + +2010-07-28 Andrei Popescu <andreip@google.com> + + Reviewed by Jeremy Orlow. + + [IndexedDB] WebDOMStringList default ctor does not initialize its m_private member + variable so any attempt to append strings to a WebDOMStringList instance results in a crash. + https://bugs.webkit.org/show_bug.cgi?id=43120 + + Makes the default WebKit::WebDOMStringList ctor actually create its wrapped + WebCore::DOMStringList instance. + + * public/WebDOMStringList.h: + * src/WebDOMStringList.cpp: + (WebKit::WebDOMStringList::WebDOMStringList): + +2010-07-26 Steve Block <steveblock@google.com> + + Reviewed by Jeremy Orlow. + + Page clients should be passed to Page constructor via structure of pointers + https://bugs.webkit.org/show_bug.cgi?id=42834 + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::WebViewImpl): + +2010-07-28 Pavel Feldman <pfeldman@chromium.org> + + Not reviewed: chromium tests fix. + Chromium Dev Tools: [REGRESSION] Pause is not working. + + https://bugs.webkit.org/show_bug.cgi?id=43118 + + * src/js/DevTools.js: + (InspectorBackend.pause): + +2010-07-27 Kinuko Yasuda <kinuko@chromium.org> + + Reviewed by Ojan Vafai. + + Add FILE_SYSTEM build flag for FileSystem API + https://bugs.webkit.org/show_bug.cgi?id=42915 + + * features.gypi: + +2010-07-27 James Hawkins <jhawkins@chromium.org> + + Unreviewed Build Fix. + + Add a missing itemIcon() method to TestPopupMenuClient. + + * tests/PopupMenuTest.cpp: + (WebKit::TestPopupMenuClient::itemIcon): + +2010-07-27 James Hawkins <jhawkins@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Add the ability to show right-aligned icons in the AutoFill popup. + https://bugs.webkit.org/show_bug.cgi?id=43076 + + * public/WebView.h: + * src/AutoFillPopupMenuClient.cpp: + (WebKit::AutoFillPopupMenuClient::getIcon): + (WebKit::AutoFillPopupMenuClient::removeSuggestionAtIndex): + (WebKit::AutoFillPopupMenuClient::itemIcon): + (WebKit::AutoFillPopupMenuClient::initialize): + (WebKit::AutoFillPopupMenuClient::setSuggestions): + * src/AutoFillPopupMenuClient.h: + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::applyAutoFillSuggestions): + (WebKit::WebViewImpl::applyAutocompleteSuggestions): + * src/WebViewImpl.h: + +2010-07-27 Brett Wilson <brettw@chromium.org> + + Reviewed by Darin Fisher. + + Add the ability to select fonts and do basic text drawing to the + Chromium WebKit API. + https://bugs.webkit.org/show_bug.cgi?id=42999 + + * WebKit.gyp: + * public/WebFloatPoint.h: Added. + (WebKit::WebFloatPoint::WebFloatPoint): + (WebKit::WebFloatPoint::operator=): + (WebKit::WebFloatPoint::operator WebCore::FloatPoint): + (WebKit::operator==): + (WebKit::operator!=): + * public/WebFloatRect.h: Added. + (WebKit::WebFloatRect::isEmpty): + (WebKit::WebFloatRect::WebFloatRect): + (WebKit::WebFloatRect::operator=): + (WebKit::WebFloatRect::operator WebCore::FloatRect): + (WebKit::operator==): + (WebKit::operator!=): + * public/WebFont.h: Added. + * public/WebFontDescription.h: Added. + (WebKit::WebFontDescription::): + (WebKit::WebFontDescription::WebFontDescription): + * public/WebTextRun.h: Added. + (WebKit::WebTextRun::WebTextRun): + * src/AssertMatchingEnums.cpp: + * src/WebFontDescription.cpp: Added. + (WebKit::WebFontDescription::WebFontDescription): + (WebKit::WebFontDescription::operator WebCore::FontDescription): + * src/WebFontImpl.cpp: Added. + (WebKit::WebFont::Create): + (WebKit::WebFontImpl::WebFontImpl): + (WebKit::WebFontImpl::fontDescription): + (WebKit::WebFontImpl::ascent): + (WebKit::WebFontImpl::descent): + (WebKit::WebFontImpl::height): + (WebKit::WebFontImpl::lineSpacing): + (WebKit::WebFontImpl::xHeight): + (WebKit::WebFontImpl::drawText): + (WebKit::WebFontImpl::width): + (WebKit::WebFontImpl::offsetForPosition): + (WebKit::WebFontImpl::selectionRectForText): + * src/WebFontImpl.h: Added. + * src/WebTextRun.cpp: Added. + (WebKit::WebTextRun::operator WebCore::TextRun): + +2010-07-27 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by David Levin. + + Move all WebSQLDatabases-specific code behind #if ENABLE(DATABASE). + https://bugs.webkit.org/show_bug.cgi?id=43035 + + Make Chromium compile with ENABLE_DATABASE=0. + + * src/ChromiumBridge.cpp: + (WebCore::ChromiumBridge::databaseGetFileSize): + * src/DatabaseObserver.cpp: + * src/WebDatabase.cpp: + (WebCore::AbstractDatabase::stringIdentifier): + (WebCore::AbstractDatabase::displayName): + (WebCore::AbstractDatabase::estimatedSize): + (WebCore::AbstractDatabase::securityOrigin): + (WebKit::WebDatabase::updateDatabaseSize): + (WebKit::WebDatabase::closeDatabaseImmediately): + +2010-07-27 Pavel Podivilov <podivilov@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: if breakpoints were deactivated, add new breakpoints as disabled. + https://bugs.webkit.org/show_bug.cgi?id=41461 + + * src/js/DebuggerScript.js: + (): + +2010-07-27 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Pavel Feldman. + + WebInspector: Current implementation of message based inspector + transport generated by CodeGeneratorInspector should be upstreamed + from WebKit/chromium to WebCore. + https://bugs.webkit.org/show_bug.cgi?id=42983 + + * WebKit.gypi: + * src/InspectorFrontendClientImpl.cpp: + (WebKit::InspectorFrontendClientImpl::sendMessageToBackend): + * src/InspectorFrontendClientImpl.h: + * src/ToolsAgent.h: + * src/WebDevToolsAgentImpl.cpp: + (WebKit::WebDevToolsAgentImpl::dispatchOnInspectorController): + (WebKit::WebDevToolsAgentImpl::initDevToolsAgentHost): + * src/WebDevToolsAgentImpl.h: + * src/js/InspectorControllerImpl.js: Removed. + +2010-07-27 Dominic Mazzoni <dmazzoni@google.com> + + Reviewed by Chris Fleizach. + + Add accessors for node and document to WebAccessibilityObject, + needed to support some Windows screenreader functionality. + + https://bugs.webkit.org/show_bug.cgi?id=43001 + + * public/WebAccessibilityObject.h: + * src/WebAccessibilityObject.cpp: + (WebKit::WebAccessibilityObject::node): + (WebKit::WebAccessibilityObject::document): + +2010-07-27 Dominic Mazzoni <dmazzoni@google.com> + + Reviewed by Chris Fleizach. + + For Windows accessibility, have WebElement provide access + to its attributes. + + https://bugs.webkit.org/show_bug.cgi?id=43004 + + * WebKit.gyp: + * public/WebAttribute.h: Added. + (WebKit::WebAttribute::~WebAttribute): + (WebKit::WebAttribute::WebAttribute): + (WebKit::WebAttribute::operator=): + * public/WebElement.h: + * public/WebNamedNodeMap.h: Added. + (WebKit::WebNamedNodeMap::~WebNamedNodeMap): + (WebKit::WebNamedNodeMap::WebNamedNodeMap): + (WebKit::WebNamedNodeMap::operator=): + * src/WebAttribute.cpp: Added. + (WebKit::WebAttribute::reset): + (WebKit::WebAttribute::assign): + (WebKit::WebAttribute::WebAttribute): + (WebKit::WebAttribute::localName): + (WebKit::WebAttribute::value): + * src/WebElement.cpp: + (WebKit::WebElement::attributes): + * src/WebNamedNodeMap.cpp: Added. + (WebKit::WebNamedNodeMap::reset): + (WebKit::WebNamedNodeMap::assign): + (WebKit::WebNamedNodeMap::WebNamedNodeMap): + (WebKit::WebNamedNodeMap::length): + (WebKit::WebNamedNodeMap::attributeItem): + +2010-07-27 Satish Sampath <satish@chromium.org> + + Reviewed by Kent Tamura. + + Simplify speech input plumbing in webcore and webkit + https://bugs.webkit.org/show_bug.cgi?id=43008 + + * src/SpeechInputClientImpl.cpp: Move functionality to WebCore::SpeechInput and make this a dummy proxy. + (WebKit::SpeechInputClientImpl::startRecognition): + (WebKit::SpeechInputClientImpl::cancelRecognition): + (WebKit::SpeechInputClientImpl::didCompleteRecording): + (WebKit::SpeechInputClientImpl::didCompleteRecognition): + (WebKit::SpeechInputClientImpl::setRecognitionResult): + * src/SpeechInputClientImpl.h: + +2010-07-26 Dominic Mazzoni <dmazzoni@google.com> + + Reviewed by Chris Fleizach. + + Add accessor to get the doctype of a WebDocument, needed to + implement Windows accessibility. + + https://bugs.webkit.org/show_bug.cgi?id=43003 + + * WebKit.gyp: + * public/WebDocument.h: + * public/WebDocumentType.h: Added. + (WebKit::WebDocumentType::WebDocumentType): + (WebKit::WebDocumentType::operator=): + (WebKit::WebDocumentType::assign): + * src/WebDocument.cpp: + (WebKit::WebDocument::doctype): + * src/WebDocumentType.cpp: Added. + (WebKit::WebDocumentType::name): + (WebKit::WebDocumentType::WebDocumentType): + (WebKit::WebDocumentType::operator=): + (WebKit::WebDocumentType::operator PassRefPtr<DocumentType>): + +2010-07-26 Satish Sampath <satish@chromium.org> + + Reviewed by Steve Block. + + Add WebKit plumbing to connect speech requests and callbacks between WebCore and the embedder. + https://bugs.webkit.org/show_bug.cgi?id=42367 + + No new tests, the relevant LayoutTestController bindings and tests will be added in the next patch. + + * public/WebSpeechInputController.h: Added new interface, implemented by embedder and called by WebKit + (WebKit::WebSpeechInputController::~WebSpeechInputController): + * public/WebSpeechInputListener.h: Added new interface, implemented by WebKit and called by embedder. + (WebKit::WebSpeechInputListener::~WebSpeechInputListener): + * public/WebViewClient.h: + (WebKit::WebViewClient::createSpeechInputClient): New method to get the embedder's speech input client interface. + * src/SpeechInputClientImpl.cpp: Added new class, implementation of a two way connector between WebCore + and the embedder for requests and responses. + (WebKit::SpeechInputClientImpl::SpeechInputClientImpl): + (WebKit::SpeechInputClientImpl::~SpeechInputClientImpl): + (WebKit::SpeechInputClientImpl::startRecognition): + (WebKit::SpeechInputClientImpl::stopRecording): + (WebKit::SpeechInputClientImpl::didCompleteRecording): + (WebKit::SpeechInputClientImpl::setRecognitionResult): + (WebKit::SpeechInputClientImpl::didCompleteRecognition): + * src/SpeechInputClientImpl.h: Added. + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::WebViewImpl): Pass on the above mentioned speech input connector to WebCore. + * src/WebViewImpl.h: + +2010-07-26 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Pavel Feldman. + + Chromium DevTools: refactor query params, add basic + support for WebSocket-based backend. + + https://bugs.webkit.org/show_bug.cgi?id=42893 + + * src/js/DevTools.js: + (devtools.ToolsAgent.prototype.dispatchOnClient_): + (WebInspector.loaded): + (WebInspector.doLoadedDone): + (devtools.domContentLoaded): + * src/js/InspectorControllerImpl.js: + +2010-07-24 Pavel Feldman <pfeldman@chromium.org> + + Not reviewed: chromium build fix. + + * src/ApplicationCacheHost.cpp: + (WebCore::ApplicationCacheHost::fillResourceList): + +2010-07-23 Kavita Kanetkar <kkanetkar@chromium.org> + + Reviewed by Joseph Pecoraro. + + Implement remaining Inspector support for chrome's appcache + https://bugs.webkit.org/show_bug.cgi?id=42426 + + * src/ApplicationCacheHost.cpp: Plugging in chrome's appcache info. + (WebCore::ApplicationCacheHost::applicationCacheInfo): + (WebCore::ApplicationCacheHost::fillResourceList): + * src/js/InspectorControllerImpl.js: + (devtools.InspectorBackendImpl): + +2010-07-23 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Reviewed by Yury Semikhatsky. + + Chromium DevTools: migrate from utility context-based injected + script dispatch to upstream schema. + + https://bugs.webkit.org/show_bug.cgi?id=42883 + + * src/ToolsAgent.h: + * src/WebDevToolsAgentImpl.cpp: + * src/WebDevToolsAgentImpl.h: + * src/js/DevToolsHostStub.js: + * src/js/InspectorControllerImpl.js: + (devtools.InspectorBackendImpl): + +2010-07-23 Pavel Feldman <pfeldman@chromium.org> + + Not reviewed: rolling out r63963. + + * src/ToolsAgent.h: + * src/WebDevToolsAgentImpl.cpp: + (WebKit::WebDevToolsAgentImpl::dispatchOnInjectedScript): + * src/WebDevToolsAgentImpl.h: + * src/js/DevToolsHostStub.js: + (.window.dispatchOnInjectedScript): + * src/js/InspectorControllerImpl.js: + (devtools.InspectorBackendImpl): + (devtools.InspectorBackendImpl.prototype.dispatchOnInjectedScript): + +2010-07-23 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Reviewed by Yury Semikhatsky. + + Chromium DevTools: migrate from utility context-based injected + script dispatch to upstream schema. + + https://bugs.webkit.org/show_bug.cgi?id=42883 + + * src/ToolsAgent.h: + * src/WebDevToolsAgentImpl.cpp: + * src/WebDevToolsAgentImpl.h: + * src/js/DevToolsHostStub.js: + * src/js/InspectorControllerImpl.js: + (devtools.InspectorBackendImpl): + +2010-07-23 Kent Tamura <tkent@chromium.org> + + Reviewed by Shinichiro Hamaji. + + Roll Chromium revision + https://bugs.webkit.org/show_bug.cgi?id=42876 + + * DEPS: Roll Chromium revision to r53434 in order to have the + logger initialization change (r53303) + +2010-07-22 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Yury Semikhatsky. + + WebInspector: CodeGeneratorInspector was extended and now it can + generate InspectorBackedDispatcher's code. This dispatcher will + validate and dispatch incoming inspector commands only by native + code without using javaScript. That is necessary step for + RemoteDebugging support. + https://bugs.webkit.org/show_bug.cgi?id=42588 + + * src/ToolsAgent.h: + * src/WebDevToolsAgentImpl.cpp: + (WebKit::WebDevToolsAgentImpl::dispatchOnInspectorController): + * src/WebDevToolsAgentImpl.h: + * src/js/InspectorControllerImpl.js: + (devtools.InspectorBackendImpl.prototype.callInspectorController_): + +2010-07-22 Darin Fisher <darin@chromium.org> + + Reviewed by David Levin. + + [Chromium] Propagate return value of EventHandler::handleMouseWheelEvent + to caller of WebViewImpl::handleInputEvent. + + https://bugs.webkit.org/show_bug.cgi?id=42835 + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::mouseWheel): + (WebKit::WebViewImpl::handleInputEvent): + * src/WebViewImpl.h: + +2010-07-22 Darin Fisher <darin@chromium.org> + + Reviewed by Kent Tamura. + + https://bugs.webkit.org/show_bug.cgi?id=42808 + Pass context menu events through WebInputEvent to WebPlugin::handleInputEvent. + + The DOM treats a context menu event as a type of mouse event. We therefore + do the same here, and reuse the WebMouseEvent subclass. This makes sense + since a context menu event has (x,y)-coordinates. + + * public/WebInputEvent.h: + (WebKit::WebInputEvent::): + (WebKit::WebInputEvent::isMouseEventType): + * src/WebInputEventConversion.cpp: + (WebKit::WebMouseEventBuilder::WebMouseEventBuilder): + +2010-07-22 Andrey Kosyakov <caseq@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: Stop granting universal access to inspector front-end page. + https://bugs.webkit.org/show_bug.cgi?id=42817 + + * src/WebDevToolsFrontendImpl.cpp: + (WebKit::WebDevToolsFrontendImpl::frontendLoaded): + +2010-07-22 Alexander Pavlov <apavlov@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: Rename method for CSS rule source range retrieval and fix return object format + https://bugs.webkit.org/show_bug.cgi?id=42379 + + * src/js/InspectorControllerImpl.js: + (devtools.InspectorBackendImpl): + +2010-07-21 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Chromium Dev Tools: Separators are missing in the context menu. + + https://bugs.webkit.org/show_bug.cgi?id=42761 + + * src/ContextMenuClientImpl.cpp: + (WebKit::ContextMenuClientImpl::populateCustomMenuItems): + +2010-07-21 Kent Tamura <tkent@chromium.org> + + Reviewed by Dimitri Glazkov. + + [DRT/Chromium] Copy the test plugin into DumpRenderTree.app/ + https://bugs.webkit.org/show_bug.cgi?id=42733 + + This was dropped in plugin copy refactoring. + + * WebKit.gyp: + +2010-07-21 Brady Eidson <beidson@apple.com> + + Reviewed by Geoffrey Garen. + + Break out "scheme registration" functionality from SecurityOrigin to a SchemeRegistry + https://bugs.webkit.org/show_bug.cgi?id=42783 + + * src/WebSecurityPolicy.cpp: + (WebKit::WebSecurityPolicy::registerURLSchemeAsLocal): + (WebKit::WebSecurityPolicy::registerURLSchemeAsNoAccess): + (WebKit::WebSecurityPolicy::registerURLSchemeAsSecure): + +2010-07-21 Bo Liu <boliu@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Add chromium WebMediaPlayer to PlatformMedia + https://bugs.webkit.org/show_bug.cgi?id=41295 + + * WebKit.gyp: + * public/WebMediaElement.h: Added. + * src/WebMediaElement.cpp: Added. + (WebKit::WebMediaElement::player): + (WebKit::WebMediaElement::WebMediaElement): + (WebKit::WebMediaElement::operator=): + (WebKit::WebMediaElement::operator PassRefPtr<HTMLMediaElement>): + * src/WebMediaPlayerClientImpl.cpp: + (WebKit::WebMediaPlayerClientImpl::fromMediaElement): + (WebKit::WebMediaPlayerClientImpl::mediaPlayer): + (WebKit::WebMediaPlayerClientImpl::platformLayer): + (WebKit::WebMediaPlayerClientImpl::platformMedia): + * src/WebMediaPlayerClientImpl.h: + +2010-07-21 Finnur Thorarinsson <finnur.webkit@gmail.com> + + Reviewed by Dimitri Glazkov. + + Avoid crashing during find-in-page when |view| is NULL. + https://bugs.webkit.org/show_bug.cgi?id=42760 + + There are no layout tests because we don't have a repro case + to work with, so this is a speculative fix based on crash dump + diagnosis. See bug for details. + + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::shouldScopeMatches): + +2010-07-21 Hans Wennborg <hans@chromium.org> + + Reviewed by Steve Block. + + Runtime feature switch for device orientation + https://bugs.webkit.org/show_bug.cgi?id=42265 + + Add a runtime feature switch that decides whether device orientation + events are available or not. Defaults to true. + + * public/WebRuntimeFeatures.h: + * src/WebRuntimeFeatures.cpp: + (WebKit::WebRuntimeFeatures::enableDeviceOrientation): + (WebKit::WebRuntimeFeatures::isDeviceOrientationEnabled): + +2010-07-21 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: should be possible to debug inspector + https://bugs.webkit.org/show_bug.cgi?id=42730 + + * src/WebDevToolsFrontendImpl.cpp: + (WebKit::WebDevToolsFrontendImpl::WebDevToolsFrontendImpl): + +2010-07-16 James Hawkins <jhawkins@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Implement WebFormElement::wasUserSubmitted(). This is used to + verify that the user submitted the form instead of JS when saving form + data in AutoFill. + https://bugs.webkit.org/show_bug.cgi?id=42479 + + * public/WebFormElement.h: + * src/WebFormElement.cpp: + (WebKit::WebFormElement::wasUserSubmitted): + +2010-07-20 Daniel Erat <derat@chromium.org> + + Reviewed by Ojan Vafai. + + Subpixel rendering always disabled for Chromium Linux + https://bugs.webkit.org/show_bug.cgi?id=42220 + + Honor Fontconfig subpixel rendering setting on Chromium Linux. + + * src/gtk/WebFontInfo.cpp: + (WebKit::WebFontInfo::renderStyleForStrike): + +2010-07-20 Darin Fisher <darin@chromium.org> + + Fix Chromium build bustage. + + * src/ResourceHandle.cpp: + (WebCore::ResourceHandle::hasAuthenticationChallenge): Add + implementation of this method that always returns false. + +2010-07-20 Darin Fisher <darin@chromium.org> + + Reviewed by Jian Li. + + [Chromium] Add interface for downloading to a file. This can be used + in the future to support XMLHttpRequest.responseBlob, but it also + serves a use case in Chromium. + + https://bugs.webkit.org/show_bug.cgi?id=42657 + + * public/WebURLLoaderClient.h: + (WebKit::WebURLLoaderClient::willSendRequest): + (WebKit::WebURLLoaderClient::didSendData): + (WebKit::WebURLLoaderClient::didReceiveResponse): + (WebKit::WebURLLoaderClient::didDownloadData): + (WebKit::WebURLLoaderClient::didReceiveData): + (WebKit::WebURLLoaderClient::didFinishLoading): + (WebKit::WebURLLoaderClient::didFail): + * public/WebURLRequest.h: + * public/WebURLResponse.h: + * src/WebURLRequest.cpp: + (WebKit::WebURLRequest::downloadToFile): + (WebKit::WebURLRequest::setDownloadToFile): + * src/WebURLRequestPrivate.h: + (WebKit::WebURLRequestPrivate::WebURLRequestPrivate): + * src/WebURLResponse.cpp: + (WebKit::WebURLResponse::downloadFilePath): + (WebKit::WebURLResponse::setDownloadFilePath): + * src/WebURLResponsePrivate.h: + +2010-07-20 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r63750. + http://trac.webkit.org/changeset/63750 + https://bugs.webkit.org/show_bug.cgi?id=42648 + + This revision breaks the windows builds (Requested by + hwennborg on #webkit). + + * public/WebRuntimeFeatures.h: + * src/WebRuntimeFeatures.cpp: + +2010-07-19 Victor Wang <victorw@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Add webkit api reset to WebIDBDatabaseError and WebIDBKey + and refactor their destructors for chromium multi dll build. + + https://bugs.webkit.org/show_bug.cgi?id=42574 + + * public/WebIDBDatabaseError.h: + (WebKit::WebIDBDatabaseError::~WebIDBDatabaseError): + * public/WebIDBKey.h: + (WebKit::WebIDBKey::~WebIDBKey): + * src/WebIDBDatabaseError.cpp: + (WebKit::WebIDBDatabaseError::reset): + * src/WebIDBKey.cpp: + (WebKit::WebIDBKey::reset): + +2010-07-20 Hans Wennborg <hans@chromium.org> + + Reviewed by Steve Block. + + Runtime feature switch for device orientation + https://bugs.webkit.org/show_bug.cgi?id=42265 + + Add a runtime feature switch that decides whether device orientation + events are available or not. Defaults to true. + + * public/WebRuntimeFeatures.h: + * src/WebRuntimeFeatures.cpp: + (WebKit::WebRuntimeFeatures::enableDeviceOrientation): + (WebKit::WebRuntimeFeatures::isDeviceOrientationEnabled): + +2010-07-19 Victoria Kirst <vrk@google.com> + + Reviewed by David Levin. + + Updated WebMediaPlayer to support accelerated rendering and to + create and return a VideoChromiumLayer as its platform layer. + https://bugs.webkit.org/show_bug.cgi?id=42234 + + * src/WebMediaPlayerClientImpl.cpp: + (WebKit::WebMediaPlayerClientImpl::platformLayer): + (WebKit::WebMediaPlayerClientImpl::create): + * src/WebMediaPlayerClientImpl.h: + (WebKit::WebMediaPlayerClientImpl::supportsAcceleratedRendering): + +2010-07-19 Kenneth Russell <kbr@google.com> + + Reviewed by Nate Chapin. + + WebGL rendering results must be made available to Canvas.toDataURL and 2D drawImage + https://bugs.webkit.org/show_bug.cgi?id=34719 + + Fixed compiler warning introduced by original patch. + + * src/WebGraphicsContext3DDefaultImpl.cpp: + (WebKit::WebGraphicsContext3DDefaultImpl::readBackFramebuffer): + +2010-07-19 Tony Chang <tony@chromium.org> + + Reviewed by Kent Tamura. + + [chromium] refactor npapi plugin copy step + https://bugs.webkit.org/show_bug.cgi?id=42493 + + This is to avoid duplicate copy rules in the Linux make build. + + * WebKit.gyp: + * DEPS: 52483:52869 + +2010-07-19 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: Live edit is not working in chromium. + https://bugs.webkit.org/show_bug.cgi?id=42572 + + * src/js/DebuggerScript.js: + +2010-07-16 Pavel Podivilov <podivilov@chromium.org> + + Reviewed by Pavel Feldman. + + [V8] Web Inspector: get actual breakpoint location from v8 and pass it + to ScripDebugServer. + https://bugs.webkit.org/show_bug.cgi?id=42452 + + * src/js/DebuggerScript.js: + +2010-07-17 John Gregg <johnnyg@google.com> + + Reviewed by Kent Tamura. + + [chromium] directory upload: pass the attribute up to the chrome client + https://bugs.webkit.org/show_bug.cgi?id=42475 + + This allows chromium to display the native system directory picker when + the directory attribute is present on the input element. + + * public/WebFileChooserParams.h: + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::runOpenPanel): + +2010-07-16 Zhe Su <suzhe@chromium.org> + + Reviewed by Darin Adler. + + REGRESSION(r61484): Broke focus behaviour on Qt and probably other platforms + https://bugs.webkit.org/show_bug.cgi?id=42253 + + Implement EditorClient::willSetInputMethodState which replaces + setInputMethodState method. + + * src/EditorClientImpl.cpp: + (WebKit::EditorClientImpl::willSetInputMethodState): + (WebKit::EditorClientImpl::setInputMethodState): + * src/EditorClientImpl.h: + +2010-07-16 Kent Tamura <tkent@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] <input type=number> UI implementation for Windows + https://bugs.webkit.org/show_bug.cgi?id=42259 + + * public/WebThemeEngine.h: + (WebKit::WebThemeEngine::paintSpinButton): Added. + * src/ChromiumBridge.cpp: + (WebCore::ChromiumBridge::paintSpinButton): + Added. It calls WebThemeEngine::paintSpinButton(). + +2010-07-16 James Robinson <jamesr@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Avoid crashing if offscreen GLES2 context creation fails + https://bugs.webkit.org/show_bug.cgi?id=42469 + + If creating or initializing an offscreen GLES2Context fails we should return null + rather than crashing or returning an invalid context. + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::getOffscreenGLES2Context): + +2010-07-15 Tony Gentilcore <tonyg@chromium.org> + + Reviewed by Darin Fisher. + + Enable window.webkitPerformance (Web Timing) for chromium + https://bugs.webkit.org/show_bug.cgi?id=42313 + + * features.gypi: + +2010-07-16 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r63551. + http://trac.webkit.org/changeset/63551 + https://bugs.webkit.org/show_bug.cgi?id=42460 + + "Problems with gyp" (Requested by yurys on #webkit). + + * DEPS: + +2010-07-16 Yury Semikhatsky <yurys@chromium.org> + + Unreviewed. Bump up Chromium revision. + + * DEPS: + +2010-07-16 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: disable AppCache in chromium. + + https://bugs.webkit.org/show_bug.cgi?id=41858 + + * src/js/DevTools.js: + (WebInspector.loaded): + +2010-07-16 Alexander Pavlov <apavlov@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: [Chromium] A non-existent resource is referenced from devTools.css + + The erroneous rule has been removed. + https://bugs.webkit.org/show_bug.cgi?id=42454 + + * src/js/devTools.css: + +2010-07-16 Andrey Kosyakov <caseq@chromium.org> + + Reviewed by Pavel Feldman. + + Check that end node of a range has a valid renderer in WebViewImpl::caretOrSelectionBounds() + to avoid crash in Position::getInlineBoxAndOffset() when start node has renderer but end one doesn't. + https://bugs.webkit.org/show_bug.cgi?id=42449 + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::caretOrSelectionBounds): + +2010-07-16 Mikhail Naganov <mnaganov@chromium.org> + + Reviewed by Pavel Feldman. + + Make JS memory stats available via 'Performance' object (Web Timing). + This statistics is populated only if 'WebKitMemoryInfoEnabled' + preference is set. + + 'console.memory' is kept until Web Timing object becomes visible by + default (currently it is hidden under compile-time flag). These stats + are guarded with the same preference. + + https://bugs.webkit.org/show_bug.cgi?id=41617 + + * public/WebSettings.h: + * src/WebSettingsImpl.cpp: + (WebKit::WebSettingsImpl::setMemoryInfoEnabled): + * src/WebSettingsImpl.h: + +2010-07-15 Victor Wang <victorw@chromium.org> + + Reviewed by David Levin. + + [Chromium] Chromium webkit dll updates: + -. Fix WEBKIT_IMPLEMENTATION in WebCommon so + dllimport works as expected. + -. Update webkit.gyp so targets that depend on webkit + has correct macros defined. + + https://bugs.webkit.org/show_bug.cgi?id=42177 + + * WebKit.gyp: + * public/WebCommon.h: + +2010-07-13 Zhenyao Mo <zmo@google.com> + + Reviewed by Nate Chapin. + + WebGL rendering results must be made available to Canvas.toDataURL and 2D drawImage + https://bugs.webkit.org/show_bug.cgi?id=34719 + + * src/GraphicsContext3D.cpp: + (WebCore::GraphicsContext3DInternal::paintRenderingResultsToCanvas): Implement paintRenderingResultsToCanvas(). + (WebCore::GraphicsContext3DInternal::beginPaint): Just use paintRenderingResultsToCanvas(). + +2010-07-15 Victor Wang <victorw@chromium.org> + + Reviewed by David Levin. + + Roll Chromium DEPS forward to r52483. + https://bugs.webkit.org/show_bug.cgi?id=42386 + + * DEPS: + +2010-07-15 Scott Violet <sky@chromium.org> + + Reviewed by David Levin. + + [chromium] WebViewClient::removeAutofillSuggestions is not passed the correct name + https://bugs.webkit.org/show_bug.cgi?id=42385 + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::autocompleteHandleKeyEvent): Use WebInputElement::nameForAutofill() instead of name. + +2010-07-15 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r63446. + http://trac.webkit.org/changeset/63446 + https://bugs.webkit.org/show_bug.cgi?id=42412 + + It broke the Chromium Windows bot due to missing dependencies + there. (Requested by dave_levin on #webkit). + + * DEPS: + +2010-07-15 Victor Wang <victorw@chromium.org> + + Reviewed by David Levin. + + Roll Chromium DEPS forward to r52483. + https://bugs.webkit.org/show_bug.cgi?id=42386 + + * DEPS: + +2010-07-15 Michael Nordman <michaeln@google.com> + + Reviewed by Darin Fisher. + + WebKitAPI additions to support inspecting application caches. + https://bugs.webkit.org/show_bug.cgi?id=41993 + + * public/WebApplicationCacheHost.h: + (WebKit::WebApplicationCacheHost::CacheInfo::CacheInfo): + (WebKit::WebApplicationCacheHost::ResourceInfo::ResourceInfo): + (WebKit::WebApplicationCacheHost::getAssociatedCacheInfo): + (WebKit::WebApplicationCacheHost::getResourceList): + (WebKit::WebApplicationCacheHost::deleteAssociatedCacheGroup): + * public/WebApplicationCacheHostClient.h: + (WebKit::WebApplicationCacheHostClient::didChangeCacheAssociation): + * src/ApplicationCacheHostInternal.h: + (WebCore::ApplicationCacheHostInternal::didChangeCacheAssociation): + +2010-07-15 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: differentiate between blocking and connecting timers. + + https://bugs.webkit.org/show_bug.cgi?id=42372 + + * public/WebURLResponse.h: + * src/WebURLResponse.cpp: + (WebKit::WebURLResponse::connectionReused): + (WebKit::WebURLResponse::setConnectionReused): + +2010-07-15 Pavel Podivilov <podivilov@chromium.org> + + Reviewed by Yury Semikhatsky. + + Fix mac compilation failure + https://bugs.webkit.org/show_bug.cgi?id=42344 + + * src/AutoFillPopupMenuClient.cpp: + (WebKit::AutoFillPopupMenuClient::removeSuggestionAtIndex): + (WebKit::AutoFillPopupMenuClient::canRemoveSuggestionAtIndex): + +2010-07-14 George Yakovlev <georgey@chromium.org> + + Reviewed by Darin Fisher. + + Allow Chromium access to Select control choices + https://bugs.webkit.org/show_bug.cgi?id=41384 + + * WebKit.gyp: + * public/WebOptionElement.h: Added. + (WebKit::WebOptionElement::WebOptionElement): + (WebKit::WebOptionElement::operator=): + (WebKit::WebOptionElement::assign): + * public/WebSelectElement.h: + * src/WebOptionElement.cpp: Added. + (WebKit::WebOptionElement::setValue): + (WebKit::WebOptionElement::value): + (WebKit::WebOptionElement::index): + (WebKit::WebOptionElement::text): + (WebKit::WebOptionElement::defaultSelected): + (WebKit::WebOptionElement::setDefaultSelected): + (WebKit::WebOptionElement::label): + (WebKit::WebOptionElement::disabled): + (WebKit::WebOptionElement::WebOptionElement): + (WebKit::WebOptionElement::operator=): + (WebKit::WebOptionElement::operator PassRefPtr<HTMLOptionElement>): + * src/WebSelectElement.cpp: + (WebKit::WebSelectElement::listItems): + +2010-07-14 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r63389. + http://trac.webkit.org/changeset/63389 + https://bugs.webkit.org/show_bug.cgi?id=42311 + + It broke the Chromium Linux build. (Requested by dave_levin on + #webkit). + + * DEPS: + * WebKit.gyp: + * public/WebCommon.h: + +2010-07-14 Scott Violet <sky@chromium.org> + + Reviewed by David Levin. + + [chromium] Autofill menu shows seperator at the wrong place when an entry is deleted + https://bugs.webkit.org/show_bug.cgi?id=42210 + + * src/AutoFillPopupMenuClient.cpp: + (WebKit::AutoFillPopupMenuClient::removeSuggestionAtIndex): Updates internal data appropriately. + (WebKit::AutoFillPopupMenuClient::canRemoveSuggestionAtIndex): Now called before removal to see if can remove. + * src/AutoFillPopupMenuClient.h: Fixed whitespace and added method. + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::autocompleteHandleKeyEvent): Added call to canRemoveSuggestionAtIndex. + +2010-07-14 James Robinson <jamesr@chromium.org> + + Unreviewed. Compile fix, initialization/declaration order mismatch. + + * src/GLES2ContextInternal.h: + +2010-07-14 Jay Civelli <jcivelli@chromium.org> + + Reviewed by David Levin. + + [chromium] don't restrict the width of the autofill popup. + https://bugs.webkit.org/show_bug.cgi?id=42206 + + * src/WebViewImpl.cpp: + +2010-07-14 Victor Wang <victorw@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Chromium webkit dll updates: + -. Fix WEBKIT_IMPLEMENTATION in WebCommon so + dllimport works as expected. + -. Update webkit.gyp so targets that depend on webkit + has correct macros defined. + -. Roll forward chromium deps to r52273. + + https://bugs.webkit.org/show_bug.cgi?id=42177 + + * DEPS: + * WebKit.gyp: + * public/WebCommon.h: + +2010-07-14 James Hawkins <jhawkins@chromium.org> + + UNREVIEWED Build Fix. + + Fix a typo. + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::applyAutoFillSuggestions): + +2010-07-14 James Robinson <jamesr@chromium.org> + + Reviewed by Darin Fisher. + + Breaks all dependencies on Page from platform/ and cleans up GLES2Context lifetime + https://bugs.webkit.org/show_bug.cgi?id=42203 + + Rather than constructing a GLES2Context from a Page, pass the LayerRendererChromium + a GLES2Context in from the constructor. This way the platform/ directory can remain + ignorant of Page and friends. Also adds functions on ChromeClientChromium to request + onscreen and offscreen GLES2Contexts for callers in WebCore that need them. + + * WebKit.gyp: + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::getOnscreenGLES2Context): + (WebKit::ChromeClientImpl::getOffscreenGLES2Context): + * src/ChromeClientImpl.h: + * src/GLES2Context.cpp: + (WebCore::GLES2ContextInternal::create): + (WebCore::GLES2Context::create): + (WebCore::GLES2Context::GLES2Context): + * src/GLES2ContextInternal.cpp: Added. + (WebCore::GLES2ContextInternal::~GLES2ContextInternal): + * src/GLES2ContextInternal.h: Added. + (WebCore::GLES2ContextInternal::getWebGLES2Context): + (WebCore::GLES2ContextInternal::GLES2ContextInternal): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::setIsAcceleratedCompositingActive): + (WebKit::WebViewImpl::getOnscreenGLES2Context): + (WebKit::WebViewImpl::getOffscreenGLES2Context): + * src/WebViewImpl.h: + +2010-07-14 James Hawkins <jhawkins@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Use the unique ID instead of the profile label to identify + the accepted AutoFill suggestion. + https://bugs.webkit.org/show_bug.cgi?id=42301 + + * public/WebView.h: + * public/WebViewClient.h: + (WebKit::WebViewClient::didAcceptAutoFillSuggestion): + (WebKit::WebViewClient::didSelectAutoFillSuggestion): + * src/AutoFillPopupMenuClient.cpp: + (WebKit::AutoFillPopupMenuClient::valueChanged): + (WebKit::AutoFillPopupMenuClient::selectionChanged): + (WebKit::AutoFillPopupMenuClient::initialize): + (WebKit::AutoFillPopupMenuClient::setSuggestions): + (WebKit::AutoFillPopupMenuClient::textFieldStyle): + * src/AutoFillPopupMenuClient.h: + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::applyAutoFillSuggestions): + (WebKit::WebViewImpl::applyAutocompleteSuggestions): + * src/WebViewImpl.h: + +2010-07-14 Jay Civelli <jcivelli@chromium.org> + + Reviewed by David Levin. + + Don't notify the WebView that the popup has been closed when the + selection is cleared, as the popup is not gone and would linger + as a ghost popup. + https://bugs.webkit.org/show_bug.cgi?id=42180 + + * src/AutoFillPopupMenuClient.cpp: + (WebKit::AutoFillPopupMenuClient::selectionCleared): + +2010-07-14 Sam Weinig <sam@webkit.org> + + Fix the chromium mac build. + + * src/WebPopupMenuImpl.cpp: + (WebKit::WebPopupMenuImpl::setCursor): + +2010-07-14 Sam Weinig <sam@webkit.org> + + Reviewed by Darin Adler. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=42232 + Make changing Cursors work in WebKit2. + + * src/ChromeClientImpl.h: + (WebKit::ChromeClientImpl::setCursor): + Change prototype to match new one. + + * src/WebPopupMenuImpl.cpp: + (WebKit::WebPopupMenuImpl::setCursor): + * src/WebPopupMenuImpl.h: + Add empty setCursor function to satisfy the HostWindow interface. + +2010-07-13 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=42201 + Use ResourceHandle object for synchronous loading + + * src/ResourceHandle.cpp: + (WebCore::ResourceHandle::request): + This method is no longer const in cross-platform code, and is called firstRequest. + +2010-07-14 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r63305. + http://trac.webkit.org/changeset/63305 + https://bugs.webkit.org/show_bug.cgi?id=42256 + + "debugger-breakpoints-not-activated-on-reload.html fails on + GTK" (Requested by yurys on #webkit). + + * src/js/DebuggerScript.js: + (): + +2010-07-14 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: remove v8 debugger code that doesn't use ScriptDebugServer + https://bugs.webkit.org/show_bug.cgi?id=42164 + + * WebKit.gypi: + * src/DebuggerAgentManager.cpp: + (WebKit::DebuggerAgentManager::debugAttach): + (WebKit::DebuggerAgentManager::debugDetach): + * src/InspectorFrontendClientImpl.cpp: + (WebKit::InspectorFrontendClientImpl::windowObjectCleared): + * src/WebDevToolsAgentImpl.cpp: + (WebKit::WebDevToolsAgentImpl::~WebDevToolsAgentImpl): + (WebKit::WebDevToolsAgentImpl::attach): + (WebKit::WebDevToolsAgentImpl::didNavigate): + (WebKit::WebDevToolsAgentImpl::createInspectorFrontendProxy): + * src/js/DebuggerAgent.js: Removed. + * src/js/DevTools.js: + (devtools.ToolsAgent): + (WebInspector.loaded): + * src/js/DevToolsHostStub.js: + * src/js/InspectorControllerImpl.js: + (devtools.InspectorBackendImpl): + * src/js/Tests.js: + (.TestSuite.prototype.testAutoContinueOnSyntaxError): + (.TestSuite.prototype.testExpandScope.examineScopes): + (.TestSuite.prototype.testExpandScope): + (.TestSuite.prototype.testDebugIntrinsicProperties): + +2010-07-14 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Yury Semikhatsky. + + WebInspector: Clean-up InspectorBackend code. In the next changes + InspectorBackend content will be generated by scripts. As far as + generator is very simple thing all nontrivial function should be + moved to InspectorController and DOMAgent. + https://bugs.webkit.org/show_bug.cgi?id=42171 + + * src/js/InspectorControllerImpl.js: + (devtools.InspectorBackendImpl): + (.devtools.InspectorBackendImpl.prototype.pause): + (.devtools.InspectorBackendImpl.prototype.resume): + (.devtools.InspectorBackendImpl.prototype.stepIntoStatement): + (.devtools.InspectorBackendImpl.prototype.stepOutOfFunction): + (.devtools.InspectorBackendImpl.prototype.stepOverStatement): + (else.devtools.InspectorBackendImpl.prototype.pause): + +2010-07-14 Pavel Podivilov <podivilov@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: if breakpoints were deactivated, add new breakpoints as disabled. + https://bugs.webkit.org/show_bug.cgi?id=41461 + + * src/js/DebuggerScript.js: + (): + +2010-07-14 Kent Tamura <tkent@chromium.org> + + Unreviewed, 2nd attempt to fix build on 'Webkit.org Reliability Builder'. + + * WebKit.gyp: + +2010-07-14 Kent Tamura <tkent@chromium.org> + + Unreviewed, attempt to fix build on 'Webkit.org Reliability Builder'. + + * WebKit.gyp: + +2010-07-14 Kent Tamura <tkent@chromium.org> + + Reviewed by David Levin. + + [Chromium] Upstreaming inspector_resources target + https://bugs.webkit.org/show_bug.cgi?id=41669 + + 'inspector_resource' is currently in src/webkit/webkit.gyp of + Chromium tree. We move it to WebKit tree because: + - DumpRenderTree in WebKit tree needs it, and + - It's hard to refer to WebKit.gypi and WebCore.gypi from + webkit_support in both cases of Chromium-tree build and + WebKit-tree build. + + * WebKit.gyp: + +2010-07-13 Kent Tamura <tkent@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Linux implementation of <input type=number> UI + https://bugs.webkit.org/show_bug.cgi?id=41925 + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::setScrollbarColors): + Call PlatformThemeChromiumGtk::setScrollbarColors() instead of + RenderThemeChromiumLinux::setScrollbarColors(). + +2010-07-13 Chris Guillory <chris.guillory@google.com> + + Reviewed by David Levin. + + Fix adoptRef usage violation in WebAccessibilityCacheImpl.cpp. + https://bugs.webkit.org/show_bug.cgi?id=42092 + + * src/WebAccessibilityCacheImpl.cpp: + (WebKit::WebAccessibilityCacheImpl::WeakHandle::create): + (WebKit::WebAccessibilityCacheImpl::WeakHandle::WeakHandle): + +2010-07-13 Albert J. Wong <ajwong@chromium.org> + + Unreviewed, build fix. + + [chromium] The comparision between signed/unsigned breaks the chromium + mac build. + + * src/AutoFillPopupMenuClient.cpp: + (WebKit::AutoFillPopupMenuClient::getSuggestion): + (WebKit::AutoFillPopupMenuClient::getLabel): + +2010-07-10 Zhenyao Mo <zmo@google.com> + + Reviewed by Darin Fisher. + + Implement bufferData and bufferSubData with ArrayBuffer as input + https://bugs.webkit.org/show_bug.cgi?id=41884 + + * src/GraphicsContext3D.cpp: Implement bufferData and bufferSubData with ArrayBuffer as input. + (WebCore::GraphicsContext3DInternal::bufferData): + (WebCore::GraphicsContext3DInternal::bufferSubData): + +2010-07-10 Zhenyao Mo <zmo@google.com> + + Reviewed by Darin Fisher. + + Need to emulate MAX_VARYING_VECTORS/MAX_FRAGMENT_UNIFORM_VECTORs/MAX_VERTEX_UNIFORM_VECTORS for glGet + https://bugs.webkit.org/show_bug.cgi?id=42032 + + * src/WebGraphicsContext3DDefaultImpl.cpp: + (WebKit::WebGraphicsContext3DDefaultImpl::getIntegerv): Emulate the enums. + +2010-07-13 Andrey Kosyakov <caseq@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: catch and log JS exceptions resulting from executing a + script on inspector front-end to prevent renderer from crashing. + https://bugs.webkit.org/show_bug.cgi?id=42157 + + * src/WebDevToolsFrontendImpl.cpp: + (WebKit::WebDevToolsFrontendImpl::executeScript): + +2010-07-13 Kent Tamura <tkent@chromium.org> + + Unreviewed, build fix. + + Fix a build error by r63179 for Chromium. + + * tests/PopupMenuTest.cpp: + (WebKit::TestPopupMenuClient::itemLabel): Added. + +2010-07-12 Jay Civelli <jcivelli@chromium.org> + + Reviewed by Kent Tamura. + + Making the autofill popup use labels to show the label + associated with an item. + https://bugs.webkit.org/show_bug.cgi?id=41964 + + * src/AutoFillPopupMenuClient.cpp: + (WebKit::AutoFillPopupMenuClient::getSuggestion): + (WebKit::AutoFillPopupMenuClient::getLabel): + (WebKit::AutoFillPopupMenuClient::itemLabel): + (WebKit::AutoFillPopupMenuClient::setSuggestions): + (WebKit::AutoFillPopupMenuClient::convertListIndexToInternalIndex): + * src/AutoFillPopupMenuClient.h: + +2010-07-12 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r63171. + http://trac.webkit.org/changeset/63171 + https://bugs.webkit.org/show_bug.cgi?id=42144 + + Broke Chromium canary (Requested by tkent on #webkit). + + * WebKit.gyp: + +2010-07-12 Kent Tamura <tkent@chromium.org> + + Reviewed by David Levin. + + [Chromium] Upstreaming inspector_resources target + https://bugs.webkit.org/show_bug.cgi?id=41669 + + 'inspector_resource' is currently in src/webkit/webkit.gyp of + Chromium tree. We move it to WebKit tree because: + - DumpRenderTree in WebKit tree needs it, and + - It's hard to refer to WebKit.gypi and WebCore.gypi from + webkit_support in both cases of Chromium-tree build and + WebKit-tree build. + + * WebKit.gyp: + +2010-07-12 Viet-Trung Luu <viettrungluu@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Pass key down events on to plugins. + https://bugs.webkit.org/show_bug.cgi?id=42113 + + * src/WebPluginContainerImpl.cpp: + (WebKit::WebPluginContainerImpl::handleKeyboardEvent): + +2010-07-12 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Joseph Pecoraro. + + Web Inspector: provide starts and ends for network phases instead of duration. + + https://bugs.webkit.org/show_bug.cgi?id=42091 + + * public/WebURLLoadTiming.h: + * public/WebURLResponse.h: + * src/WebURLLoadTiming.cpp: + (WebKit::WebURLLoadTiming::proxyStart): + (WebKit::WebURLLoadTiming::setProxyStart): + (WebKit::WebURLLoadTiming::proxyEnd): + (WebKit::WebURLLoadTiming::setProxyEnd): + (WebKit::WebURLLoadTiming::dnsStart): + (WebKit::WebURLLoadTiming::setDNSStart): + (WebKit::WebURLLoadTiming::dnsEnd): + (WebKit::WebURLLoadTiming::setDNSEnd): + (WebKit::WebURLLoadTiming::connectStart): + (WebKit::WebURLLoadTiming::setConnectStart): + (WebKit::WebURLLoadTiming::connectEnd): + (WebKit::WebURLLoadTiming::setConnectEnd): + (WebKit::WebURLLoadTiming::sendStart): + (WebKit::WebURLLoadTiming::setSendStart): + (WebKit::WebURLLoadTiming::sendEnd): + (WebKit::WebURLLoadTiming::setSendEnd): + (WebKit::WebURLLoadTiming::receiveHeadersStart): + (WebKit::WebURLLoadTiming::setReceiveHeadersStart): + (WebKit::WebURLLoadTiming::receiveHeadersEnd): + (WebKit::WebURLLoadTiming::setReceiveHeadersEnd): + (WebKit::WebURLLoadTiming::sslStart): + (WebKit::WebURLLoadTiming::setSSLStart): + (WebKit::WebURLLoadTiming::sslEnd): + (WebKit::WebURLLoadTiming::setSSLEnd): + * src/WebURLResponse.cpp: + (WebKit::WebURLResponse::wasCached): + (WebKit::WebURLResponse::setWasCached): + +2010-07-12 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r63156. + http://trac.webkit.org/changeset/63156 + https://bugs.webkit.org/show_bug.cgi?id=42129 + + broke chromium compile (Requested by jamesr on #webkit). + + * WebKit.gyp: + * public/WebAccessibilityObject.h: + * public/WebAttribute.h: Removed. + * public/WebDocumentType.h: Removed. + * public/WebElement.h: + * public/WebNamedNodeMap.h: Removed. + * public/WebNode.h: + * public/WebRenderStyle.h: Removed. + * src/WebAccessibilityObject.cpp: + * src/WebAttribute.cpp: Removed. + * src/WebDocumentType.cpp: Removed. + * src/WebElement.cpp: + * src/WebNamedNodeMap.cpp: Removed. + * src/WebNode.cpp: + * src/WebRenderStyle.cpp: Removed. + +2010-07-12 Dominic Mazzoni <dmazzoni@google.com> + + Reviewed by Darin Fisher. + + Add methods to WebAccessibilityObject to access the Node and + Document, and then add methods to access some document, node, + and element properties needed for Windows accessibility. + + https://bugs.webkit.org/show_bug.cgi?id=41569 + + * WebKit.gyp: + * public/WebAccessibilityObject.h: + * public/WebAttribute.h: Added. + (WebKit::WebAttribute::~WebAttribute): + (WebKit::WebAttribute::WebAttribute): + (WebKit::WebAttribute::operator=): + * public/WebDocumentType.h: Added. + (WebKit::WebDocumentType::WebDocumentType): + (WebKit::WebDocumentType::operator=): + (WebKit::WebDocumentType::assign): + * public/WebElement.h: + * public/WebNamedNodeMap.h: Added. + (WebKit::WebNamedNodeMap::~WebNamedNodeMap): + (WebKit::WebNamedNodeMap::WebNamedNodeMap): + (WebKit::WebNamedNodeMap::operator=): + * public/WebNode.h: + * public/WebRenderStyle.h: Added. + (WebKit::WebRenderStyle::~WebRenderStyle): + (WebKit::WebRenderStyle::WebRenderStyle): + (WebKit::WebRenderStyle::operator=): + * src/WebAccessibilityObject.cpp: + (WebKit::WebAccessibilityObject::node): + (WebKit::WebAccessibilityObject::document): + * src/WebAttribute.cpp: Added. + (WebKit::WebAttribute::reset): + (WebKit::WebAttribute::assign): + (WebKit::WebAttribute::WebAttribute): + (WebKit::WebAttribute::localName): + (WebKit::WebAttribute::value): + * src/WebDocumentType.cpp: Added. + (WebKit::WebDocumentType::name): + (WebKit::WebDocumentType::WebDocumentType): + (WebKit::WebDocumentType::operator=): + (WebKit::WebDocumentType::operator PassRefPtr<DocumentType>): + * src/WebElement.cpp: + (WebKit::WebElement::attributes): + * src/WebNamedNodeMap.cpp: Added. + (WebKit::WebNamedNodeMap::reset): + (WebKit::WebNamedNodeMap::assign): + (WebKit::WebNamedNodeMap::WebNamedNodeMap): + (WebKit::WebNamedNodeMap::length): + (WebKit::WebNamedNodeMap::attributeItem): + * src/WebNode.cpp: + (WebKit::WebNode::element): + (WebKit::WebNode::hasComputedStyle): + (WebKit::WebNode::computedStyle): + * src/WebRenderStyle.cpp: Added. + (WebKit::WebRenderStyle::reset): + (WebKit::WebRenderStyle::assign): + (WebKit::WebRenderStyle::WebRenderStyle): + (WebKit::WebRenderStyle::display): + +2010-07-12 Alexander Pavlov <apavlov@chromium.org> + + Reviewed by Yury Semikhatsky. + + [Chromium] Crash when stepping on a breakpoint while debugging Web Inspector + https://bugs.webkit.org/show_bug.cgi?id=41958 + + * src/WebViewImpl.cpp: + (WebKit::WebView::willEnterModalLoop): + (WebKit::WebView::didExitModalLoop): + +2010-07-12 Jeremy Orlow <jorlow@chromium.org> + + Speculative fix for visual studio retardedness. + + * public/WebCommon.h: + +2010-07-12 Jeremy Orlow <jorlow@chromium.org> + + Build fix. Add an include. + + * public/WebCommon.h: + +2010-06-27 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Dumitru Daniliuc. + + Implement IDBObjectStore.get/set/remove + https://bugs.webkit.org/show_bug.cgi?id=41250 + + Plumbing for new features, IDBKey, and added support + for both invalid (i.e. not serializable) and null + (i.e. the RefPtr was 0) to SerializedScriptValue. + + * WebKit.gyp: + * public/WebIDBCallbacks.h: + (WebKit::WebIDBCallbacks::onSuccess): + * public/WebIDBKey.h: Added. + (WebKit::WebIDBKey::WebIDBKey): + (WebKit::WebIDBKey::operator=): + (WebKit::WebIDBKey::): + * public/WebIDBObjectStore.h: + (WebKit::WebIDBObjectStore::get): + (WebKit::WebIDBObjectStore::set): + (WebKit::WebIDBObjectStore::remove): + (WebKit::WebIDBObjectStore::createIndex): + (WebKit::WebIDBObjectStore::index): + (WebKit::WebIDBObjectStore::removeIndex): + * public/WebSerializedScriptValue.h: + * src/IDBCallbacksProxy.cpp: + (WebCore::IDBCallbacksProxy::onSuccess): + * src/IDBCallbacksProxy.h: + * src/IDBObjectStoreProxy.cpp: + (WebCore::IDBObjectStoreProxy::get): + (WebCore::IDBObjectStoreProxy::set): + (WebCore::IDBObjectStoreProxy::remove): + * src/IDBObjectStoreProxy.h: + * src/WebIDBCallbacksImpl.cpp: + (WebCore::WebIDBCallbacksImpl::onSuccess): + * src/WebIDBCallbacksImpl.h: + * src/WebIDBKey.cpp: Added. + (WebKit::WebIDBKey::~WebIDBKey): + (WebKit::WebIDBKey::createNull): + (WebKit::WebIDBKey::createInvalid): + (WebKit::WebIDBKey::assign): + (WebKit::WebIDBKey::assignNull): + (WebKit::WebIDBKey::assignInvalid): + (WebKit::WebIDBKey::type): + (WebKit::WebIDBKey::string): + (WebKit::WebIDBKey::number): + (WebKit::WebIDBKey::WebIDBKey): + (WebKit::WebIDBKey::operator=): + (WebKit::WebIDBKey::operator PassRefPtr<IDBKey>): + * src/WebIDBObjectStoreImpl.cpp: + (WebKit::WebIDBObjectStoreImpl::get): + (WebKit::WebIDBObjectStoreImpl::set): + (WebKit::WebIDBObjectStoreImpl::remove): + * src/WebIDBObjectStoreImpl.h: + * src/WebSerializedScriptValue.cpp: + (WebKit::WebSerializedScriptValue::createInvalid): + +2010-07-09 John Abd-El-Malek <jam@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Take out WebPlugin::supportsFind since we can accomplish the same thing by having a return value on startFind + https://bugs.webkit.org/show_bug.cgi?id=42011 + + * public/WebPlugin.h: + (WebKit::WebPlugin::startFind): + +2010-07-09 Leon Clarke <leonclarke@google.com> + + Reviewed by Adam Barth. + + add support for link prefetching + https://bugs.webkit.org/show_bug.cgi?id=3652 + + * public/WebURLRequest.h: + (WebKit::WebURLRequest::): + +2010-07-09 Michael Nordman <michaeln@google.com> + + Reviewed by Dumitru Daniliuc. + + Use class ProgressEvent when raising appcache related progress events and + set the 'total', 'loaded', and 'lengthComputable' attributes. + Also raise the final progress event with the 'total' and 'loaded' attribute + values are equal to one another to keep pace with the spec for this feature. + https://bugs.webkit.org/show_bug.cgi?id=37602 + + * src/ApplicationCacheHost.cpp: + (WebCore::ApplicationCacheHost::notifyDOMApplicationCache): + (WebCore::ApplicationCacheHost::stopDeferringEvents): + (WebCore::ApplicationCacheHost::dispatchDOMEvent): + * src/ApplicationCacheHostInternal.h: + (WebCore::ApplicationCacheHostInternal::notifyEventListener): + (WebCore::ApplicationCacheHostInternal::notifyProgressEventListener): + +2010-07-09 David Holloway <dhollowa@chromium.org> + + Reviewed by Dimitri Glazkov. + + Roll Chromium DEPS forward to r51736. + https://bugs.webkit.org/show_bug.cgi?id=41867 + + * DEPS: + +2010-07-09 Pavel Feldman <pfeldman@chromium.org> + + Not reviewed: chromium build fix. + + * public/WebGLES2Context.h: + +2010-07-09 Yael Aharon <yael.aharon@nokia.com> + + Reviewed by Laszlo Gombos. + + NotificationPresenter needs a cancelRequestPermission API + https://bugs.webkit.org/show_bug.cgi?id=41783 + + Updated the NotificationPresenter API. + + * src/NotificationPresenterImpl.cpp: + (WebKit::NotificationPresenterImpl::checkPermission): + (WebKit::NotificationPresenterImpl::requestPermission): + * src/NotificationPresenterImpl.h: + (WebKit::NotificationPresenterImpl::cancelRequestsForPermission): + +2010-07-08 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: Provide detailed network info in the resources panel. + + https://bugs.webkit.org/show_bug.cgi?id=40227 + + * WebKit.gyp: + * public/WebDevToolsAgent.h: + * public/WebURLLoadTiming.h: Added. + (WebKit::WebURLLoadTiming::~WebURLLoadTiming): + (WebKit::WebURLLoadTiming::WebURLLoadTiming): + (WebKit::WebURLLoadTiming::operator=): + (WebKit::WebURLLoadTiming::isNull): + * public/WebURLRequest.h: + * public/WebURLResponse.h: + * src/WebDevToolsAgentImpl.cpp: + (WebKit::WebDevToolsAgentImpl::willSendRequest): + * src/WebDevToolsAgentImpl.h: + * src/WebURLLoadTiming.cpp: Added. + (WebKit::WebURLLoadTiming::initialize): + (WebKit::WebURLLoadTiming::reset): + (WebKit::WebURLLoadTiming::assign): + (WebKit::WebURLLoadTiming::setDomainLookupTimes): + (WebKit::WebURLLoadTiming::setConnectStartTime): + (WebKit::WebURLLoadTiming::setRequestTimes): + (WebKit::WebURLLoadTiming::setHeadersAvailableTime): + (WebKit::WebURLLoadTiming::WebURLLoadTiming): + (WebKit::WebURLLoadTiming::operator=): + (WebKit::WebURLLoadTiming::operator PassRefPtr<ResourceLoadTiming>): + * src/WebURLRequest.cpp: + (WebKit::WebURLRequest::reportLoadTiming): + (WebKit::WebURLRequest::setReportLoadTiming): + * src/WebURLResponse.cpp: + (WebKit::WebURLResponse::setConnectionID): + (WebKit::WebURLResponse::setLoadTiming): + +2010-07-08 Jay Civelli <jcivelli@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Exposing the EditorClient text field related methods + to the WebViewClient. Also adding some more accessors methods + to the WebNode and WebInputElement. + This is needed to move the password autocomplete out of the + Chromium WebKit API to the Chromium code. + https://bugs.webkit.org/show_bug.cgi?id=41286 + + * public/WebInputElement.h: + * public/WebNode.h: + (WebKit::operator!=): + (WebKit::operator<): + * public/WebViewClient.h: + (WebKit::WebViewClient::textFieldDidBeginEditing): + (WebKit::WebViewClient::textFieldDidEndEditing): + (WebKit::WebViewClient::textDidChangeInTextField): + (WebKit::WebViewClient::textFieldHandlingKeyDown): + (WebKit::WebViewClient::didAcceptAutocompleteSuggestion): + * src/EditorClientImpl.cpp: + (WebKit::EditorClientImpl::textFieldDidBeginEditing): + (WebKit::EditorClientImpl::textFieldDidEndEditing): + (WebKit::EditorClientImpl::textDidChangeInTextField): + (WebKit::EditorClientImpl::onAutocompleteSuggestionAccepted): + (WebKit::EditorClientImpl::doTextFieldCommandFromEvent): + * src/WebInputElement.cpp: + (WebKit::WebInputElement::readOnly): + (WebKit::WebInputElement::setSelectionRange): + (WebKit::WebInputElement::selectionStart): + (WebKit::WebInputElement::selectionEnd): + * src/WebNode.cpp: + (WebKit::WebNode::lessThan): + +2010-07-08 Aaron Boodman <aa@chromium.org> + + Reviewed by Timothy Hatcher. + + Add the ability for user scripts and user styles to affect just the top frame. + + https://bugs.webkit.org/show_bug.cgi?id=41529 + + * public/WebView.h: + (WebKit::WebView::): + (WebKit::WebView::addUserScript): + (WebKit::WebView::addUserStyleSheet): + * src/AssertMatchingEnums.cpp: + * src/WebViewImpl.cpp: + (WebKit::WebView::addUserScript): + (WebKit::WebView::addUserStyleSheet): + +2010-07-08 James Robinson <jamesr@google.com> + + Reviewed by Darin Fisher. + + Allow resizing and getting the texture ID from an offscreen GLES2Context + https://bugs.webkit.org/show_bug.cgi?id=41828 + + When using an offscreen GLES2Context the caller needs to be able to resize the backing store + managed by the embedder and get access to a texture id to pass to the compositor. WebGL + does these actions in an indirect way, it will be refactored to use this path. + + * public/WebGLES2Context.h: + * src/GLES2Context.cpp: + (WebCore::GLES2Context::resizeOffscreenContent): + (WebCore::GLES2Context::getOffscreenContentParentTextureId): + +2010-07-08 Vitaly Repeshko <vitalyr@chromium.org> + + Reviewed by Pavel Feldman. + + [chromium] Fix deletion has begun assert in TestWebPopupMenuImpl. + https://bugs.webkit.org/show_bug.cgi?id=41899 + + * tests/PopupMenuTest.cpp: + (WebKit::TestWebPopupMenuImpl::create): + (WebKit::TestWebViewClient::TestWebViewClient): + (WebKit::TestWebViewClient::createPopupMenu): + +2010-07-08 Vitaly Repeshko <vitalyr@chromium.org> + + Reviewed by Pavel Feldman. + + [chromium] Fix deletion has begun assertion in TestImage destructor. + https://bugs.webkit.org/show_bug.cgi?id=41883 + + * tests/DragImageTest.cpp: + (WebCore::TestImage::create): + (WebCore::TEST): + +2010-07-08 Vitaly Repeshko <vitalyr@chromium.org> + + Reviewed by Pavel Feldman. + + Fix adoptRef usage violations (mostly in chromium) + https://bugs.webkit.org/show_bug.cgi?id=41863 + + * src/IDBCallbacksProxy.cpp: + (WebCore::IDBCallbacksProxy::create): + * src/WebPopupMenuImpl.cpp: + (WebKit::WebPopupMenu::create): + * src/WebViewImpl.cpp: + (WebKit::WebView::create): + +2010-07-07 Alexander Pavlov <apavlov@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Crash when re-entering message loop + + Allow re-entrancy of the message loop by tracking all suspended pages + through a PageGroupLoadDeferrer stack. + https://bugs.webkit.org/show_bug.cgi?id=41697 + + * src/WebViewImpl.cpp: + (WebKit::WebView::willEnterModalLoop): + (WebKit::WebView::didExitModalLoop): + * src/js/Tests.js: + (.TestSuite.prototype.evaluateInConsole_): + (.TestSuite.prototype.testCompletionOnPause): + (.TestSuite.prototype.testMessageLoopReentrant.this): + +2010-07-08 David Holloway <dhollowa@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Exposes WebNode::unwrap() and WebNode::constUnwrap() for + use by other code in WebKit/chromium/src. + + Specific use of these methods is made in WebFrameImpl.cpp. This is + preferred to the cast operator call that was happening prior to this + change. + + https://bugs.webkit.org/show_bug.cgi?id=41477 + + * public/WebNode.h: + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::registerPasswordListener): + (WebKit::WebFrameImpl::notifiyPasswordListenerOfAutocomplete): + (WebKit::WebFrameImpl::getPasswordListener): + * src/WebFrameImpl.h: + +2010-07-07 Pavel Podivilov <podivilov@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: convert script offset to webkit format + https://bugs.webkit.org/show_bug.cgi?id=41755 + + * src/js/DebuggerScript.js: + (): + +2010-07-07 Kent Tamura <tkent@chromium.org> + + Reviewed by Adam Barth. + + [DRT/Chromium] DumpRenderTree should depend on ImageDiff + https://bugs.webkit.org/show_bug.cgi?id=41749 + + We usually use DumpRenderTree with ImageDiff. So ImageDiff should + be built with DumpRenderTree. Without this change, ImageDiff is not + built in a case of Chromium tree build. + test_shell in Chromium tree also depends on image_diff. + + * WebKit.gyp: + +2010-07-07 John Abd-El-Malek <jam@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Add a few more methods to WebPlugin so that Pepper v2 plugins can support copy/zoom/find + https://bugs.webkit.org/show_bug.cgi?id=41649 + + * public/WebPlugin.h: + (WebKit::WebPlugin::hasSelection): + (WebKit::WebPlugin::selectionAsText): + (WebKit::WebPlugin::selectionAsMarkup): + (WebKit::WebPlugin::setZoomFactor): + (WebKit::WebPlugin::supportsFind): + (WebKit::WebPlugin::startFind): + (WebKit::WebPlugin::selectFindResult): + (WebKit::WebPlugin::stopFind): + * src/ContextMenuClientImpl.cpp: + (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems): + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::pluginContainerFromFrame): + (WebKit::ChromePluginPrintContext::end): + (WebKit::ChromePluginPrintContext::computePageRects): + (WebKit::ChromePluginPrintContext::spoolPage): + (WebKit::WebFrameImpl::executeCommand): + * src/WebFrameImpl.h: + * src/WebPluginContainerImpl.cpp: + (WebKit::WebPluginContainerImpl::copy): + (WebKit::WebPluginContainerImpl::handleKeyboardEvent): + * src/WebPluginContainerImpl.h: + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::setZoomLevel): + +2010-07-07 James Hawkins <jhawkins@chromium.org> + + Reviewed by Dimitri Glazkov. + + [Chromium] Add setSuggestedValue to WebInputElement + https://bugs.webkit.org/show_bug.cgi?id=41785 + + * public/WebInputElement.h: + * src/WebInputElement.cpp: + (WebKit::WebInputElement::setSuggestedValue): + (WebKit::WebInputElement::suggestedValue): + +2010-07-07 James Robinson <jamesr@chromium.org> and Vincent Scheib <schieb@chromium.org> + + Reviewed by Dimitri Glazkov. + + WebCore::GLES2Context should allow creating onscreen and offscreen contexts + https://bugs.webkit.org/show_bug.cgi?id=41492 + + You should be able to create a GLES2Context for rendering both on screen + and off screen (to a texture). Currently WebGL does the latter by side + stepping the WebCore::GLES2Context API completely. Longer term it should + move over to using this. + + * src/GLES2Context.cpp: + (WebCore::GLES2ContextInternal::initializeOnscreen): + (WebCore::GLES2ContextInternal::initializeOffscreen): + (WebCore::GLES2Context::createOnscreen): + (WebCore::GLES2Context::createOffscreen): + +2010-07-07 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=41772 + Add basic piping for BackForwardControllerClient. + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::WebViewImpl): + +2010-07-07 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r62645. + http://trac.webkit.org/changeset/62645 + https://bugs.webkit.org/show_bug.cgi?id=41757 + + "Broken inspector tests on several platforms" (Requested by + eseidel on #webkit). + + * src/js/DebuggerScript.js: + (): + +2010-07-07 Pavel Podivilov <podivilov@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: if breakpoints were deactivated, add new breakpoints as disabled. + https://bugs.webkit.org/show_bug.cgi?id=41461 + + * src/js/DebuggerScript.js: + (): + +2010-07-06 Darin Adler <darin@apple.com> + + Try to fix build. + + Why do the Chromium bots stop after the first error they encounter? + + * src/WebWorkerImpl.cpp: + (WebKit::WebWorkerImpl::postMessageToWorkerContextTask): Removed + unneeded release called on a PassOwnPtr to pass it as an argument of + type PassOwnPtr. + +2010-07-06 Darin Adler <darin@apple.com> + + Try to fix build. + + * src/WebWorkerBase.cpp: + (WebKit::WebWorkerBase::dispatchTaskToMainThread): Use leakPtr instead + of release. + * src/WebWorkerClientImpl.cpp: + (WebKit::WebWorkerClientImpl::postMessageToWorkerObjectTask): Removed + unneeded release called on a PassOwnPtr to pass it as an argument of + type PassOwnPtr. + +2010-07-06 Darin Adler <darin@apple.com> + + Try to fix build. + + * src/WebSharedWorkerImpl.cpp: + (WebKit::WebSharedWorkerImpl::connectTask): Removed unneeded release + called on a PassOwnPtr to pass it as an argument of type PassOwnPtr. + +2010-07-06 Darin Adler <darin@apple.com> + + Try to fix build. + + * src/WebDataSourceImpl.cpp: + (WebKit::WebDataSourceImpl::setNextPluginLoadObserver): Call leakPtr + here instead of release. Comment makes it really unclear why it's OK! + +2010-07-06 Darin Adler <darin@apple.com> + + Try to fix build. + + * src/SharedWorkerRepository.cpp: + (WebCore::SharedWorkerRepository::connect): Removed unneeded release + called on a PassOwnPtr to pass it as an argument of type PassOwnPtr. + +2010-07-05 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + [v8] Web Inspector: remove v8-specific code dealing with getOwnPropertyNames from InjectedScript.js + https://bugs.webkit.org/show_bug.cgi?id=41595 + + * src/js/DebuggerScript.js: + +2010-07-03 Erik Arvidsson <arv@chromium.org> + + Reviewed by Ojan Vafai. + + Fix issue where a contextmenu event was reporting the wrong target + if the context menu was shown due to pressing the context menu key + (or Shift+F10). + + https://bugs.webkit.org/show_bug.cgi?id=38129 + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::sendContextMenuEvent): + +2010-07-02 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + [v8] Web Inspector: inspected page crashes on attempt to change iframe's src attribute + https://bugs.webkit.org/show_bug.cgi?id=41511 + + * src/WebBindings.cpp: + (WebKit::getEvent): + +2010-07-01 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r62349. + http://trac.webkit.org/changeset/62349 + https://bugs.webkit.org/show_bug.cgi?id=41499 + + It broke the chromium Linux build. (Requested by dave_levin on + #webkit). + + * public/WebNode.h: + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::registerPasswordListener): + (WebKit::WebFrameImpl::notifiyPasswordListenerOfAutocomplete): + +2010-07-01 David Holloway <dhollowa@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Exposes WebNode::unwrap() and WebNode::constUnwrap() for + use by other code in WebKit/chromium/src. + + Specific use of these methods is made in WebFrameImpl.cpp. This is + preferred to the cast operator call that was happening prior to this + change. + + https://bugs.webkit.org/show_bug.cgi?id=41477 + + * public/WebNode.h: + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::registerPasswordListener): + (WebKit::WebFrameImpl::notifiyPasswordListenerOfAutocomplete): + +2010-07-01 Kenneth Russell <kbr@google.com> + + Reviewed by Dimitri Glazkov. + + Stop linking against opengl32.lib in Windows Chromium port + https://bugs.webkit.org/show_bug.cgi?id=41424 + + * WebKit.gyp: + * src/WebGraphicsContext3DDefaultImpl.cpp: + (WebKit::WebGraphicsContext3DDefaultImpl::~WebGraphicsContext3DDefaultImpl): + (WebKit::WebGraphicsContext3DDefaultImpl::initialize): + (WebKit::WebGraphicsContext3DDefaultImpl::makeContextCurrent): + * src/WebGraphicsContext3DDefaultImpl.h: + +2010-07-01 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r62246. + http://trac.webkit.org/changeset/62246 + https://bugs.webkit.org/show_bug.cgi?id=41470 + + "Worker tests are broken in Chromium" (Requested by yurys on + #webkit). + + * src/WebBindings.cpp: + (WebKit::getEvent): + +2010-07-01 David Holloway <dhollowa@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Consolidates AutoFill and Autocomplete popup menus into a single popup menu. + + This change combines SuggestionsPopupMenuClient, AutoFillPopupMenuClient, and + AutocompletePopupMenuClient classes into a single consolidated AutoFillPopupMenuClient class. + Prior to this change the contents of the AutoFill popup menu only included AutoFill + suggestions and similarly the Autocomplete popup menu only included Autocomplete + suggestions. With this consolidation, both AutoFill and Autocomplete suggestions can + now be displayed in a single menu. + + https://bugs.webkit.org/show_bug.cgi?id=41236 + + * WebKit.gyp: + * public/WebFrame.h: + * public/WebView.h: + * src/AutoFillPopupMenuClient.cpp: + (WebKit::AutoFillPopupMenuClient::AutoFillPopupMenuClient): + (WebKit::AutoFillPopupMenuClient::~AutoFillPopupMenuClient): + (WebKit::AutoFillPopupMenuClient::valueChanged): + (WebKit::AutoFillPopupMenuClient::selectionCleared): + (WebKit::AutoFillPopupMenuClient::itemText): + (WebKit::AutoFillPopupMenuClient::itemStyle): + (WebKit::AutoFillPopupMenuClient::menuStyle): + (WebKit::AutoFillPopupMenuClient::clientPaddingLeft): + (WebKit::AutoFillPopupMenuClient::clientPaddingRight): + (WebKit::AutoFillPopupMenuClient::popupDidHide): + (WebKit::AutoFillPopupMenuClient::setTextFromItem): + (WebKit::AutoFillPopupMenuClient::fontSelector): + (WebKit::AutoFillPopupMenuClient::hostWindow): + (WebKit::AutoFillPopupMenuClient::createScrollbar): + (WebKit::AutoFillPopupMenuClient::initialize): + (WebKit::AutoFillPopupMenuClient::getWebView): + (WebKit::AutoFillPopupMenuClient::textFieldStyle): + * src/AutoFillPopupMenuClient.h: + (WebKit::AutoFillPopupMenuClient::itemToolTip): + (WebKit::AutoFillPopupMenuClient::itemAccessibilityText): + (WebKit::AutoFillPopupMenuClient::itemIsEnabled): + (WebKit::AutoFillPopupMenuClient::clientInsetLeft): + (WebKit::AutoFillPopupMenuClient::clientInsetRight): + (WebKit::AutoFillPopupMenuClient::listSize): + (WebKit::AutoFillPopupMenuClient::selectedIndex): + (WebKit::AutoFillPopupMenuClient::itemIsLabel): + (WebKit::AutoFillPopupMenuClient::itemIsSelected): + (WebKit::AutoFillPopupMenuClient::shouldPopOver): + (WebKit::AutoFillPopupMenuClient::valueShouldChangeOnHotTrack): + (WebKit::AutoFillPopupMenuClient::setAutocompleteMode): + (WebKit::AutoFillPopupMenuClient::getTextField): + (WebKit::AutoFillPopupMenuClient::getSelectedIndex): + (WebKit::AutoFillPopupMenuClient::setSelectedIndex): + * src/AutocompletePopupMenuClient.cpp: Removed. + * src/AutocompletePopupMenuClient.h: Removed. + * src/EditorClientImpl.cpp: + (WebKit::EditorClientImpl::textFieldDidEndEditing): + (WebKit::EditorClientImpl::doAutofill): + (WebKit::EditorClientImpl::onAutocompleteSuggestionAccepted): + * src/SuggestionsPopupMenuClient.cpp: Removed. + * src/SuggestionsPopupMenuClient.h: Removed. + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::currentHistoryItem): + (WebKit::WebFrameImpl::notifiyPasswordListenerOfAutocomplete): + * src/WebFrameImpl.h: + * src/WebViewImpl.cpp: + (WebKit::): + (WebKit::WebViewImpl::WebViewImpl): + (WebKit::WebViewImpl::mouseDown): + (WebKit::WebViewImpl::mouseUp): + (WebKit::WebViewImpl::selectPopupHandleKeyEvent): + (WebKit::WebViewImpl::autocompleteHandleKeyEvent): + (WebKit::WebViewImpl::hideAutoFillPopup): + (WebKit::WebViewImpl::setFocus): + (WebKit::WebViewImpl::applyAutoFillSuggestions): + (WebKit::WebViewImpl::applyAutocompleteSuggestions): + (WebKit::WebViewImpl::hidePopups): + (WebKit::WebViewImpl::refreshAutoFillPopup): + * src/WebViewImpl.h: + (WebKit::WebViewImpl::autoFillPopupDidHide): + +2010-07-01 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Adam Barth. + + [v8] Web Inspector: inspected page crashes on attempt to change iframe's src attribute + https://bugs.webkit.org/show_bug.cgi?id=41350 + + * src/WebBindings.cpp: + (WebKit::getEvent): + +2010-07-01 Aaron Boodman <aa@chromium.org> + + Reviewed by Darin Fisher. + + Make the user script API static. This makes it more convenient to use + if you don't have a WebView instance yet. + + Added static versions of the three methods and re-route current ones + temporarily through the static versions. Will remove the non-static + versions once Chromium has been updated. + + Also, expose the URLPattern configuration for user stylesheets, since + they were not before. + + https://bugs.webkit.org/show_bug.cgi?id=41385 + + * public/WebView.h: + (WebKit::WebView::addUserScript): + (WebKit::WebView::addUserStyleSheet): + * src/WebViewImpl.cpp: + (WebKit::WebView::addUserScript): + (WebKit::WebView::addUserStyleSheet): + (WebKit::WebView::removeAllUserContent): + +2010-06-30 Kenneth Russell <kbr@google.com> + + Reviewed by Dimitri Glazkov. + + Roll forward Chromium DEPS to r51287 + https://bugs.webkit.org/show_bug.cgi?id=41430 + + * DEPS: + +2010-06-25 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Chrome DevTools: Finalize migration to new WebView constructor + (devtools agent is now created within WebViewImpl only). + + https://bugs.webkit.org/show_bug.cgi?id=41212 + + * public/WebDevToolsAgent.h: + * public/WebView.h: + * src/WebDevToolsAgentImpl.cpp: + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::WebViewImpl): + * src/WebViewImpl.h: + * src/WebWorkerBase.cpp: + (WebKit::WebWorkerBase::initializeLoader): + * tests/PopupMenuTest.cpp: + (WebKit::SelectPopupMenuTest::SetUp): + +2010-06-29 Zhenyao Mo <zmo@google.com> + + Reviewed by Dimitri Glazkov. + + Implement getAttachedShaders + https://bugs.webkit.org/show_bug.cgi?id=31172 + + * public/WebGraphicsContext3D.h: Declaration of getAttachedShaders(). + * src/GraphicsContext3D.cpp: Implementation of getAttachedShaders(). + * src/WebGraphicsContext3DDefaultImpl.cpp: Ditto. + * src/WebGraphicsContext3DDefaultImpl.h: Declaration of getAttachedShaders(). + +2010-06-29 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by Darin Fisher. + + Simplify the WebDatabase interface. + https://bugs.webkit.org/show_bug.cgi?id=40607 + + Do not ref()/deref() the private AbstractDatabase member. This + allows us to use WebDatabase in the destructors of the DB + classes. + + * public/WebDatabase.h: + (WebKit::WebDatabase::WebDatabase): + * src/WebDatabase.cpp: + (WebKit::WebDatabase::name): + (WebKit::WebDatabase::displayName): + (WebKit::WebDatabase::estimatedSize): + (WebKit::WebDatabase::securityOrigin): + (WebKit::WebDatabase::WebDatabase): + +2010-06-29 Zhe Su <suzhe@chromium.org> + + Reviewed by Darin Fisher. + + A crash caused by the patch of bug 40608. + https://bugs.webkit.org/show_bug.cgi?id=41334 + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::caretOrSelectionBounds): + +2010-06-29 Victor Wang <victorw@chromium.org> + + Reviewed by Darin Fisher. + + [chromium]: Update webkit for chromium multi dll build. + + 1. Export more webkit APIs for chromium multi dll build. + 2. Update DumpRenderTree sources so it can build with webkit.dll + 3. Temp disable webkit unit tests for chromium multi dll build. + + https://bugs.webkit.org/show_bug.cgi?id=41231 + + * WebKit.gyp: + * public/WebAccessibilityCache.h: + * public/WebAccessibilityObject.h: + * public/WebEventListener.h: + * public/WebGeolocationServiceMock.h: + * public/WebGraphicsContext3D.h: + * public/WebIDBDatabaseError.h: + (WebKit::WebIDBDatabaseError::WebIDBDatabaseError): + (WebKit::WebIDBDatabaseError::operator=): + * public/WebNotification.h: + * public/WebPasswordFormData.h: + * public/WebSearchableFormData.h: + * public/WebStorageEventDispatcher.h: + * public/WebString.h: + (WebKit::WebString::WebString): + (WebKit::WebString::operator=): + +2010-06-29 Vangelis Kokkevis <vangelis@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Hooking up GraphicsContext3D to the gpu compositor. + GraphicsContext3DInternal is now initialized with a pointer to the HostWindow + that corresponds to the WebView containing the context. The initializer + forces a WebGLES2Context to be created for the WebView (if one doesn't already + exist) and uses the view's GL context as a parent to the GL context created + for WebGL. This allows the compositor to read the texture associated with + WebGL's frame buffer. We also plumb though GraphicsContext3D's prepareTexture + and platformLayer methods which are required by the compositor code. + https://bugs.webkit.org/show_bug.cgi?id=41243 + + * public/WebGraphicsContext3D.h: + * public/WebView.h: + Made gles2Context() a virtual method on WebView instead of WebViewImpl + to allow access to it from GraphicsContext3DInternal::initialize(). + * src/GraphicsContext3D.cpp: + (WebCore::GraphicsContext3DInternal::initialize): + (WebCore::GraphicsContext3DInternal::platformGraphicsContext3D): + (WebCore::GraphicsContext3DInternal::platformTexture): + (WebCore::GraphicsContext3DInternal::prepareTexture): + (WebCore::GraphicsContext3DInternal::platformLayer): + (WebCore::GraphicsContext3D::create): + (WebCore::GraphicsContext3D::prepareTexture): + (WebCore::GraphicsContext3D::platformLayer): + * src/WebGraphicsContext3DDefaultImpl.cpp: + (WebKit::WebGraphicsContext3DDefaultImpl::initialize): + (WebKit::WebGraphicsContext3DDefaultImpl::getPlatformTextureId): + (WebKit::WebGraphicsContext3DDefaultImpl::prepareTexture): + * src/WebGraphicsContext3DDefaultImpl.h: + * src/WebViewImpl.h: + +2010-06-29 Pavel Podivilov <podivilov@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: return line number where breakpoint was actually set by v8 from setBreakpoint function. + https://bugs.webkit.org/show_bug.cgi?id=40781 + + * src/js/DebuggerScript.js: + (): + +2010-06-23 John Gregg <johnnyg@google.com> + + Reviewed by Kent Tamura. + + add ENABLE_DIRECTORY_UPLOAD build support + https://bugs.webkit.org/show_bug.cgi?id=41100 + + * features.gypi: + +2010-06-28 Zhe Su <suzhe@chromium.org> + + Reviewed by Jian Li. + + [chromium]Remove deprecated code related to input method. + https://bugs.webkit.org/show_bug.cgi?id=41244 + + Also update TestWebWidget in tests/PopupMenuTest.cpp to add missing implementations. + + * WebKit.gyp: + * public/WebCompositionCommand.h: Removed. + * public/WebViewClient.h: + * public/WebWidget.h: + * src/EditorClientImpl.cpp: + (WebKit::EditorClientImpl::setInputMethodState): + * src/WebPopupMenuImpl.cpp: + * src/WebPopupMenuImpl.h: + * src/WebViewImpl.cpp: + * src/WebViewImpl.h: + * tests/PopupMenuTest.cpp: + (WebKit::TestWebWidget::setComposition): + (WebKit::TestWebWidget::confirmComposition): + (WebKit::TestWebWidget::textInputType): + (WebKit::TestWebWidget::caretOrSelectionBounds): + +2010-06-27 John Abd-El-Malek <jam@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Get the selected text from plugins for right click menu + https://bugs.webkit.org/show_bug.cgi?id=41242 + + * public/WebContextMenuData.h: + (WebKit::WebContextMenuData::): + * public/WebPlugin.h: + (WebKit::WebPlugin::selectedText): + * src/ContextMenuClientImpl.cpp: + (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems): + * src/WebPluginContainerImpl.cpp: + (WebKit::WebPluginContainerImpl::selectedText): + * src/WebPluginContainerImpl.h: + +2010-06-28 Yury Semikhatsky <yurys@chromium.org> + + Unreviewed. Fix Chromium debugger tests. + + * src/js/Tests.js: + (.TestSuite.prototype.testDebugIntrinsicProperties): + +2010-06-25 Yuzo Fujishima <yuzo@google.com> + + Reviewed by Shinichiro Hamaji. + + Improve default value handling for page format properties. + https://bugs.webkit.org/show_bug.cgi?id=41150 + + * public/WebFrame.h: + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::pageSizeAndMarginsInPixels): + * src/WebFrameImpl.h: + +2010-06-26 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r61943. + http://trac.webkit.org/changeset/61943 + https://bugs.webkit.org/show_bug.cgi?id=41251 + + Totally breaks webkit_unit_tests on Chromium linux and mac + (Requested by mnaganov on #webkit). + + * WebKit.gyp: + * src/WebFrameImpl.cpp: + (WebKit::frameContentAsPlainText): + * tests/RunAllTests.cpp: + (main): + * tests/WebFrameTest.cpp: Removed. + * tests/data/iframes_test.html: Removed. + * tests/data/invisible_iframe.html: Removed. + * tests/data/visible_iframe.html: Removed. + * tests/data/zero_sized_iframe.html: Removed. + +2010-06-26 Tony Gentilcore <tonyg@chromium.org> + + Reviewed by Dimitri Glazkov. + + Disable Web Timing support by default for chromium port. + https://bugs.webkit.org/show_bug.cgi?id=38924 + + * features.gypi: + +2010-06-25 Jay Civelli <jcivelli@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] 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 + + * DEPS: + * WebKit.gyp: + * src/WebFrameImpl.cpp: + (WebKit::frameContentAsPlainText): + * tests/RunAllTests.cpp: + (main): + * tests/WebFrameTest.cpp: Added. + * tests/data: Added. + * tests/data/iframes_test.html: Added. + * tests/data/invisible_iframe.html: Added. + * tests/data/visible_iframe.html: Added. + * tests/data/zero_sized_iframe.html: Added. + +2010-06-25 Bernhard Bauer <bauerb@chromium.org> + + Reviewed by Darin Fisher. + + Add plugin accessors to WebPluginContainer. + https://bugs.webkit.org/show_bug.cgi?id=41145 + + * public/WebPluginContainer.h: + * src/WebPluginContainerImpl.h: + (WebKit::WebPluginContainerImpl::setPlugin): + +2010-06-25 Sterling Swigart <sswigart@google.com> + + Reviewed by David Levin. + + Resetting ENABLE_IMAGE_RESIZER to 0. Image.webkitGetImage needs to be developed under + a 0 value, at least until both the JSC and V8 bindings are in place. + https://bugs.webkit.org/show_bug.cgi?id=41116 + + * features.gypi: ENABLE_IMAGE_RESIZER=0 + +2010-06-25 Victor Wang <victorw@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Update chromium webkit gyp so it has + option to be built as DLL. + + Chromium webkit is built as webkit.dll on windows + if it is inside chromium build and variable component + is set to shared_library. + + https://bugs.webkit.org/show_bug.cgi?id=41161 + + * WebKit.gyp: + +2010-06-25 John Abd-El-Malek <jam@chromium.org> + + Reviewed by David Levin. + + [chromium] Send unhandled events to Node's default handler + https://bugs.webkit.org/show_bug.cgi?id=41223 + + * src/WebPluginContainerImpl.cpp: + (WebKit::WebPluginContainerImpl::handleEvent): + +2010-06-25 Daniel Cheng <dcheng@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Add new stubs for querying platform drag-and-drop and copy-and-paste data. + + This change adds new stubs for querying for data in a clipboard or drag operation. This is + so adding support for more data types in clipboard/drag operations doesn't become + increasingly expensive, since we currently copy all the drag data we need every time a new + web drop target is entered. It also adds a new mechanism to write back to the system + clipboard that isn't tied to one data type. + + https://bugs.webkit.org/show_bug.cgi?id=40540 + + * public/WebClipboard.h: + (WebKit::WebClipboard::): + (WebKit::WebClipboard::isFormatAvailable): + (WebKit::WebClipboard::readPlainText): + (WebKit::WebClipboard::readHTML): + (WebKit::WebClipboard::writePlainText): + (WebKit::WebClipboard::writeHTML): + (WebKit::WebClipboard::writeURL): + (WebKit::WebClipboard::writeImage): + (WebKit::WebClipboard::writeData): + (WebKit::WebClipboard::readAvailableTypes): + (WebKit::WebClipboard::readData): + (WebKit::WebClipboard::readFilenames): + * public/WebKitClient.h: + * src/AssertMatchingEnums.cpp: + * src/ChromiumBridge.cpp: + (WebCore::ChromiumBridge::clipboardWriteData): + (WebCore::ChromiumBridge::clipboardReadAvailableTypes): + (WebCore::ChromiumBridge::clipboardReadData): + (WebCore::ChromiumBridge::clipboardReadFilenames): + +2010-06-25 Lei Zheng <lzheng@chromium.org> + + Reviewed by Dimitri Glazkov. + + [Chromium] Add a flag to the ResourceResponse for tracking if a request was fetched + when Alternate-Protocol is available. + + https://bugs.webkit.org/show_bug.cgi?id=41001 + + * public/WebURLResponse.h: + * src/WebURLResponse.cpp: + (WebKit::WebURLResponse::wasAlternateProtocolAvailable): + (WebKit::WebURLResponse::setWasAlternateProtocolAvailable): + +2010-06-25 Michael Nordman <michaeln@google.com> + + Reviewed by Dumitru Daniliuc. + + Additional API to pass additional info needed for AppCache progress events. + https://bugs.webkit.org/show_bug.cgi?id=37602 + + Also, delete an obsolete method from the worker API. + + * public/WebApplicationCacheHostClient.h: define a new method + * public/WebSharedWorker.h: remove an obsolte method + * src/ApplicationCacheHostInternal.h: implement the new method + (WebCore::ApplicationCacheHostInternal::notifyProgressEventListener): + +2010-06-25 John Gregg <johnnyg@google.com> + + Reviewed by Darin Fisher. + + Notification should expose ltr/rtl as TextDirection, not String + https://bugs.webkit.org/show_bug.cgi?id=40871 + + * public/WebNotification.h: + * src/WebNotification.cpp: + (WebKit::WebNotification::direction): + +2010-06-24 Eric Seidel <eric@webkit.org> + + Reviewed by Adam Barth. + + Clean up and document DocumentWriter::replaceDocument code path + https://bugs.webkit.org/show_bug.cgi?id=41182 + + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::loadJavaScriptURL): + - Make Chromium use DocumentWriter like it should. + +2010-06-24 Vangelis Kokkevis <vangelis@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] A WebView can now own a GLES2Context which gets created on + demand. This context will typically be created for the gpu compositor + and used as a parent context for any elements on the page that use the + gpu for rendering (e.g. WebGL) and need to pass their backbuffer directly + to the compositor. + https://bugs.webkit.org/show_bug.cgi?id=41010 + + * public/WebGLES2Context.h: + * src/GLES2Context.cpp: + (WebCore::GLES2ContextInternal::getWebGLES2Context): + (WebCore::GLES2ContextInternal::initialize): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::WebViewImpl): + (WebKit::WebViewImpl::gles2Context): + * src/WebViewImpl.h: + +2010-06-24 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: Inspector cleanup + better DevTools alignment with Inspector. + + https://bugs.webkit.org/show_bug.cgi?id=41094 + + - Merged InspectorClient implementation into WebDevToolsAgent + - Changed the way WebDevToolsAgent is initialized (will break chromium bot, needs coordinated landing) + - Removed a lot of legacy code from WebDevToolsAgentImpl + - Removed a lot of overrides from DevTools.js + - Simplified devtools stubs + - Got rid of all logic from within InjectDispatch.js + + * public/WebView.h: + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::dispatchDidCommitLoad): + * src/InspectorClientImpl.cpp: + (WebKit::InspectorClientImpl::inspectorDestroyed): + (WebKit::InspectorClientImpl::openInspectorFrontend): + (WebKit::InspectorClientImpl::highlight): + (WebKit::InspectorClientImpl::hideHighlight): + (WebKit::InspectorClientImpl::populateSetting): + (WebKit::InspectorClientImpl::storeSetting): + (WebKit::InspectorClientImpl::sendMessageToFrontend): + (WebKit::InspectorClientImpl::resourceTrackingWasEnabled): + (WebKit::InspectorClientImpl::resourceTrackingWasDisabled): + (WebKit::InspectorClientImpl::timelineProfilerWasStarted): + (WebKit::InspectorClientImpl::timelineProfilerWasStopped): + (WebKit::InspectorClientImpl::devToolsAgent): + * src/InspectorClientImpl.h: + * src/InspectorFrontendClientImpl.cpp: + (WebKit::InspectorFrontendClientImpl::inspectedURLChanged): + * src/ToolsAgent.h: + * src/WebDevToolsAgentImpl.cpp: + (WebKit::): + (WebKit::WebDevToolsAgentImpl::initDevToolsAgentHost): + (WebKit::WebDevToolsAgentImpl::setApuAgentEnabled): + (WebKit::WebDevToolsAgentImpl::jsDispatchOnClient): + (WebKit::WebDevToolsAgentImpl::inspectorDestroyed): + (WebKit::WebDevToolsAgentImpl::openInspectorFrontend): + (WebKit::WebDevToolsAgentImpl::highlight): + (WebKit::WebDevToolsAgentImpl::hideHighlight): + (WebKit::WebDevToolsAgentImpl::populateSetting): + (WebKit::WebDevToolsAgentImpl::storeSetting): + (WebKit::WebDevToolsAgentImpl::sendMessageToFrontend): + (WebKit::WebDevToolsAgentImpl::resourceTrackingWasEnabled): + (WebKit::WebDevToolsAgentImpl::resourceTrackingWasDisabled): + (WebKit::WebDevToolsAgentImpl::timelineProfilerWasStarted): + (WebKit::WebDevToolsAgentImpl::timelineProfilerWasStopped): + * src/WebDevToolsAgentImpl.h: + * src/WebDevToolsAgentPrivate.h: + * src/WebViewImpl.cpp: + (WebKit::WebView::create): + (WebKit::WebViewImpl::WebViewImpl): + * src/WebViewImpl.h: + * src/js/DevTools.js: + (devtools.ToolsAgent): + (): + (devtools): + * src/js/DevToolsHostStub.js: + (.window.setDebuggerScriptSource): + (.window.dispatchOnInjectedScript): + * src/js/InjectDispatch.js: + (dispatch): + * src/js/InspectorControllerImpl.js: + +2010-06-24 Pavel Feldman <pfeldman@chromium.org> + + Not reviewed: revert 61766. + + * WebKit.gyp: + * public/WebView.h: + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::dispatchDidCommitLoad): + * src/InspectorClientImpl.cpp: Added. + (WebKit::InspectorClientImpl::InspectorClientImpl): + (WebKit::InspectorClientImpl::~InspectorClientImpl): + (WebKit::InspectorClientImpl::inspectorDestroyed): + (WebKit::InspectorClientImpl::openInspectorFrontend): + (WebKit::invalidateNodeBoundingRect): + (WebKit::InspectorClientImpl::highlight): + (WebKit::InspectorClientImpl::hideHighlight): + (WebKit::InspectorClientImpl::populateSetting): + (WebKit::InspectorClientImpl::storeSetting): + (WebKit::InspectorClientImpl::sendMessageToFrontend): + * src/InspectorClientImpl.h: Added. + * src/InspectorFrontendClientImpl.cpp: + (WebKit::InspectorFrontendClientImpl::inspectedURLChanged): + * src/ToolsAgent.h: + * src/WebDevToolsAgentImpl.cpp: + (WebKit::): + (WebKit::WebDevToolsAgentImpl::didCommitProvisionalLoad): + (WebKit::WebDevToolsAgentImpl::initDevToolsAgentHost): + (WebKit::WebDevToolsAgentImpl::setApuAgentEnabled): + (WebKit::WebDevToolsAgentImpl::jsDispatchOnClient): + (WebKit::WebDevToolsAgentImpl::jsDispatchToApu): + (WebKit::WebDevToolsAgentImpl::jsEvaluateOnSelf): + (WebKit::WebDevToolsAgentImpl::jsOnRuntimeFeatureStateChanged): + * src/WebDevToolsAgentImpl.h: + * src/WebDevToolsAgentPrivate.h: + * src/WebViewImpl.cpp: + (WebKit::WebView::create): + (WebKit::WebViewImpl::WebViewImpl): + (WebKit::WebViewImpl::setDevToolsAgent): + * src/WebViewImpl.h: + * src/WebWorkerBase.cpp: + (WebKit::WebWorkerBase::initializeLoader): + * src/js/DevTools.js: + (devtools.ToolsAgent): + (devtools.ToolsAgent.prototype.frameNavigate_): + (): + * src/js/DevToolsHostStub.js: + (.RemoteDebuggerAgentStub): + (.RemoteDebuggerAgentStub.prototype.getContextId): + (.RemoteDebuggerAgentStub.prototype.processDebugCommands): + (.RemoteProfilerAgentStub): + (.RemoteProfilerAgentStub.prototype.getActiveProfilerModules): + (.RemoteProfilerAgentStub.prototype.getLogLines): + (.RemoteToolsAgentStub): + (.RemoteToolsAgentStub.prototype.dispatchOnInjectedScript): + (.RemoteToolsAgentStub.prototype.dispatchOnInspectorController): + (.ProfilerStubHelper): + (.ProfilerStubHelper.GetInstance): + (.ProfilerStubHelper.prototype.StopProfiling): + (.ProfilerStubHelper.prototype.StartProfiling): + (.ProfilerStubHelper.prototype.getActiveProfilerModules): + (.ProfilerStubHelper.prototype.getLogLines): + (.RemoteDebuggerCommandExecutorStub): + (.RemoteDebuggerCommandExecutorStub.prototype.DebuggerCommand): + (.RemoteDebuggerCommandExecutorStub.prototype.DebuggerPauseScript): + (.RemoteDebuggerCommandExecutorStub.prototype.sendResponse_): + (.DevToolsHostStub): + (.DevToolsHostStub.prototype.reset): + (.DevToolsHostStub.prototype.setting): + (.DevToolsHostStub.prototype.setSetting): + * src/js/InjectDispatch.js: + (ApuAgentDispatcher.dispatchToApu): + (dispatch): + * src/js/InspectorControllerImpl.js: + (devtools.InspectorBackendImpl.prototype.debuggerEnabled): + (devtools.InspectorBackendImpl.prototype.profilerEnabled): + +2010-06-23 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: Inspector cleanup + better DevTools alignment with Inspector. + + https://bugs.webkit.org/show_bug.cgi?id=41094 + + - Merged InspectorClient implementation into WebDevToolsAgent + - Changed the way WebDevToolsAgent is initialized (will break chromium bot, needs coordinated landing) + - Removed a lot of legacy code from WebDevToolsAgentImpl + - Removed a lot of overrides from DevTools.js + - Simplified devtools stubs + - Got rid of all logic from within InjectDispatch.js + + * WebKit.gyp: + * public/WebDevToolsAgent.h: + * public/WebView.h: + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::dispatchDidCommitLoad): + * src/InspectorFrontendClientImpl.cpp: + (WebKit::InspectorFrontendClientImpl::inspectedURLChanged): + * src/ToolsAgent.h: + * src/WebDevToolsAgentImpl.cpp: + (WebKit::): + (WebKit::WebDevToolsAgentImpl::initDevToolsAgentHost): + (WebKit::WebDevToolsAgentImpl::setApuAgentEnabled): + (WebKit::WebDevToolsAgentImpl::jsDispatchOnClient): + (WebKit::WebDevToolsAgentImpl::inspectorDestroyed): + (WebKit::WebDevToolsAgentImpl::openInspectorFrontend): + (WebKit::WebDevToolsAgentImpl::highlight): + (WebKit::WebDevToolsAgentImpl::hideHighlight): + (WebKit::WebDevToolsAgentImpl::populateSetting): + (WebKit::WebDevToolsAgentImpl::storeSetting): + (WebKit::WebDevToolsAgentImpl::sendMessageToFrontend): + (WebKit::WebDevToolsAgentImpl::resourceTrackingWasEnabled): + (WebKit::WebDevToolsAgentImpl::resourceTrackingWasDisabled): + (WebKit::WebDevToolsAgentImpl::timelineProfilerWasStarted): + (WebKit::WebDevToolsAgentImpl::timelineProfilerWasStopped): + * src/WebDevToolsAgentImpl.h: + * src/WebDevToolsAgentPrivate.h: + * src/WebViewImpl.cpp: + (WebKit::WebView::create): + (WebKit::WebViewImpl::WebViewImpl): + * src/WebViewImpl.h: + * src/WebWorkerBase.cpp: + (WebKit::WebWorkerBase::initializeLoader): + * src/js/DevTools.js: + (devtools.ToolsAgent): + (): + (devtools): + * src/js/DevToolsHostStub.js: + (.window.setDebuggerScriptSource): + (.window.dispatchOnInjectedScript): + * src/js/InjectDispatch.js: + (dispatch): + * src/js/InspectorControllerImpl.js: + +2010-06-24 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: implement layout tests for debugger + https://bugs.webkit.org/show_bug.cgi?id=40774 + + * src/WebDevToolsFrontendImpl.cpp: + (WebKit::WebDevToolsFrontendImpl::WebDevToolsFrontendImpl): + +2010-06-23 Tony Chang <tony@chromium.org> + + Reviewed by Darin Fisher. + + layout test for a crash in chromium multipart request handling + https://bugs.webkit.org/show_bug.cgi?id=41050 + + Also roll DEPS to pick up the crash fix. + + * DEPS: + +2010-06-23 Yuzo Fujishima <yuzo@google.com> + + Reviewed by Shinichiro Hamaji. + + Make page format data methods accessible from Chromium + https://bugs.webkit.org/show_bug.cgi?id=41056 + + * public/WebFrame.h: + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::isPageBoxVisible): + (WebKit::WebFrameImpl::pageAreaRectInPixels): + (WebKit::WebFrameImpl::preferredPageSizeInPixels): + * src/WebFrameImpl.h: + +2010-06-22 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Rename HTMLDocumentParser to LegacyHTMLDocumentParser + https://bugs.webkit.org/show_bug.cgi?id=41043 + + * src/WebEntities.cpp: + +2010-06-22 Pavel Feldman <pfeldman@chromium.org> + + Not reviewed: follow up to r61655 to make Chromium tests happy. + + * src/js/InspectorControllerImpl.js: + (devtools.InspectorBackendImpl): + +2010-06-22 Mikhail Naganov <mnaganov@chromium.org> + + Reviewed by Pavel Feldman. + + [Chromium] Clean up after removal of static WebDevToolsAgentClient::sendMessageToFrontendOnIOThread. + + https://bugs.webkit.org/show_bug.cgi?id=40914 + + * public/WebDevToolsAgentClient.h: + +2010-06-22 Mikhail Naganov <mnaganov@chromium.org> + + Reviewed by Pavel Feldman. + + [Chromium] Add a sanity test for heap profiler. + + https://bugs.webkit.org/show_bug.cgi?id=40917 + + * src/js/Tests.js: + (.TestSuite.prototype.testHeapProfiler.findDisplayedNode): + (.TestSuite.prototype.testHeapProfiler.findVisibleView): + (.TestSuite.prototype.testHeapProfiler): + +2010-06-21 MORITA Hajime <morrita@google.com> + + Reviewed by Darin Fisher. + + [Chromium] Dragging outside the frame immediately causes page to scroll + http://webkit.org/b/40461 + + This is regression that was introduced at http://webkit.org/b/39725. + + There are 2 problems: + 1. It starts auto-scrolling immediately. We should have some delay. + 2. The scroll continues even after a mouse cursor goes outside a frame. + The scroll should be stopped when the curosr has left. + + This change introduced DragScrollTimer to handle 1. + At the same time, it fixed DragScrollTimer::scrollDistanceFor() to + handle 2, We now stop scrolling when the cursor gone. + + * WebKit.gyp: + * src/DragScrollTimer.cpp: Added. + (WebKit::distanceToRect): + (WebKit::DragScrollTimer::DragScrollTimer): + (WebKit::DragScrollTimer::~DragScrollTimer): + (WebKit::DragScrollTimer::stop): + (WebKit::DragScrollTimer::scroll): + (WebKit::DragScrollTimer::update): + (WebKit::DragScrollTimer::triggerScroll): + (WebKit::DragScrollTimer::scrollDistanceFor): + * src/DragScrollTimer.h: Added. + (WebKit::DragScrollTimer::fired): + (WebKit::DragScrollTimer::shouldScroll): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::WebViewImpl): + (WebKit::WebViewImpl::dragSourceEndedAt): + (WebKit::WebViewImpl::dragSourceMovedTo): + (WebKit::WebViewImpl::dragTargetDrop): + (WebKit::WebViewImpl::dragTargetDragEnterOrOver): + * src/WebViewImpl.h: + +2010-06-21 Kent Tamura <tkent@chromium.org> + + Reviewed by Dimitri Glazkov. + + [Chromium] Enable EVENTSOURCE, FILE_WRITER, and IMAGE_RESIZER + https://bugs.webkit.org/show_bug.cgi?id=40905 + + EVENTSOURCE: It is already enabled in Chromium browser. This fixes + some tests with Chromium DRT. + + FILE_WRITER and IMAGE_RESIZER: Enable experimental features in + order to test them before enabling them in Chromium browser. + + * features.gypi: + +2010-06-21 Satish Sampath <satish@chromium.org> + + Reviewed by Steve Block. + + Speech Input Patch 0: Added compilation argument to conditionally compile pending patches. + https://bugs.webkit.org/show_bug.cgi?id=40878 + + * features.gypi: + +2010-06-21 Mikhail Naganov <mnaganov@chromium.org> + + Reviewed by Yury Semikhatsky. + + [Chromium] Remove usage of static WebDevToolsAgentClient::sendMessageToFrontendOnIOThread. + + Also, move WebDevToolsMessageTransport to its own header file. + + https://bugs.webkit.org/show_bug.cgi?id=40913 + + * DEPS: + * WebKit.gyp: + * public/WebDevToolsAgent.h: + * public/WebDevToolsAgentClient.h: + * public/WebDevToolsMessageTransport.h: Added. + (WebKit::WebDevToolsMessageTransport::~WebDevToolsMessageTransport): + * src/WebDevToolsAgentImpl.cpp: + (WebKit::): + +2010-06-20 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + [v8] Web Inspector: don't add ScriptDebugServer as v8 listener if browser exposes + v8 debugging protocol. + + * src/DebuggerAgentManager.cpp: + (WebKit::DebuggerAgentManager::setExposeV8DebuggerProtocol): + +2010-06-19 Jay Civelli <jcivelli@chromium.org> + + Reviewed by David Levin. + + Adding a < operator to WebURLs so they can be used in std::maps. + https://bugs.webkit.org/show_bug.cgi?id=40632 + + * public/WebCString.h: + (WebKit::operator<): + * public/WebURL.h: + (WebKit::operator<): + * src/WebCString.cpp: + (WebKit::WebCString::compare): + +2010-06-19 Kent Tamura <tkent@chromium.org> + + Unreviewed. Build fix for r61488. + + * features.gypi: Define use_accelerated_compositing. + +2010-06-19 Thomas Van Lenten <thomasvl@chromium.org> + + Reviewed by David Levin. + + Warnings from -Wextra in a Chromium Mac build + 1. checks of unsigned >= 0 + 2. enumeral and non-enumeral type in conditional expression + 3. copy ctors that don't call the super copy ctor or ctor + + https://bugs.webkit.org/show_bug.cgi?id=40791 + + * src/AutoFillPopupMenuClient.cpp: + (WebKit::AutoFillPopupMenuClient::getSuggestion): + (WebKit::AutoFillPopupMenuClient::removeSuggestionAtIndex): + (WebKit::AutoFillPopupMenuClient::valueChanged): + (WebKit::AutoFillPopupMenuClient::selectionChanged): + * src/AutocompletePopupMenuClient.cpp: + (WebKit::AutocompletePopupMenuClient::getSuggestion): + (WebKit::AutocompletePopupMenuClient::removeSuggestionAtIndex): + +2010-06-19 Zhe Su <suzhe@chromium.org> + + Reviewed by Darin Fisher. + + [chromium]Refactor input method related APIs. + https://bugs.webkit.org/show_bug.cgi?id=40608 + + * WebKit.gyp: + * public/WebCompositionCommand.h: + * public/WebCompositionUnderline.h: Added. + (WebKit::WebCompositionUnderline::WebCompositionUnderline): + * public/WebTextInputType.h: Added. + (WebKit::): + * public/WebViewClient.h: + * public/WebWidget.h: + * public/WebWidgetClient.h: + (WebKit::WebWidgetClient::resetInputMethod): + * src/CompositionUnderlineBuilder.h: Added. + (WebKit::CompositionUnderlineBuilder::CompositionUnderlineBuilder): + * src/CompositionUnderlineVectorBuilder.cpp: Added. + (WebKit::CompositionUnderlineVectorBuilder::CompositionUnderlineVectorBuilder): + * src/CompositionUnderlineVectorBuilder.h: Added. + * src/EditorClientImpl.cpp: + (WebKit::EditorClientImpl::setInputMethodState): + * src/WebPopupMenuImpl.cpp: + (WebKit::WebPopupMenuImpl::setComposition): + (WebKit::WebPopupMenuImpl::confirmComposition): + (WebKit::WebPopupMenuImpl::textInputType): + (WebKit::WebPopupMenuImpl::caretOrSelectionBounds): + * src/WebPopupMenuImpl.h: + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::handleCompositionEvent): + (WebKit::WebViewImpl::setComposition): + (WebKit::WebViewImpl::confirmComposition): + (WebKit::WebViewImpl::textInputType): + (WebKit::WebViewImpl::caretOrSelectionBounds): + * src/WebViewImpl.h: + +2010-06-19 Victoria Kirst <vrk@google.com> + + Reviewed by David Levin. + + Modifying the WebMediaPlayer interface to be compatible with + a change in chrome. + This is a part 2 of 3 one-sided changes to chrome and WebKit. Chrome + has been updated, so this commit should NOT break chromium anymore, + nor should it cause any test failures. + https://bugs.webkit.org/show_bug.cgi?id=39445 + + * public/WebMediaPlayer.h: Changed buffered() to be non-const. + +2010-06-19 Zhenyao Mo <zmo@google.com> + + Reviewed by Dimitri Glazkov. + + fast/canvas/webgl/get-active-test.html failed in Chrome Mac + https://bugs.webkit.org/show_bug.cgi?id=40496 + + * src/WebGraphicsContext3DDefaultImpl.cpp: Call makeContextCurrent(). + (WebKit::WebGraphicsContext3DDefaultImpl::getActiveAttrib): + (WebKit::WebGraphicsContext3DDefaultImpl::getActiveUniform): + (WebKit::WebGraphicsContext3DDefaultImpl::readPixels): + +2010-06-18 Aaron Boodman <aa@chromium.org> + + Remove WebKit::WebDocument::isXHTMLDocument. + https://bugs.webkit.org/show_bug.cgi?id=40815 + + * public/WebDocument.h: Remove isXHTMLDocument(). + * src/WebDocument.cpp: Ditto. + +2010-06-19 Aaron Boodman <aa@chromium.org> + + Unreviewed, rolling out r61466. + http://trac.webkit.org/changeset/61466 + https://bugs.webkit.org/show_bug.cgi?id=40816 + + Landed wrong change + + * src/WebKit.cpp: + (WebKit::shutdown): + +2010-06-18 Aaron Boodman <aa@chromium.org> + + WebKit API: Undo static hooks into V8 when WebKit is shut downm + https://bugs.webkit.org/show_bug.cgi?id=40816 + + * src/WebKit.cpp: + (WebKit::shutdown): Call new WebCore::V8DOMWindowShell::uninitializeV8IfNeeded(). + +2010-06-18 Drew Wilson <atwilson@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Plumbing for top-level frame names + https://bugs.webkit.org/show_bug.cgi?id=40430 + + * public/WebFrame.h: + Removed obsolete clearName() API and added better documentation for + setName(). + * src/WebFrameImpl.cpp: + Removed clearName() API. + * src/WebFrameImpl.h: + Removed clearName() API. + +2010-06-18 Drew Wilson <atwilson@chromium.org> + + Reviewed by Dumitru Daniliuc. + + Roll chromium DEPS 50089:50171 + https://bugs.webkit.org/show_bug.cgi?id=40842 + + * DEPS: + Update chromium_rev to r50171 to remove downstream reference to WebFrame::clearName(). + +2010-06-18 Mikhail Naganov <mnaganov@chromium.org> + + Reviewed by Yury Semikhatsky. + + Implement 'takeHeapSnapshot' in InspectorController. + + https://bugs.webkit.org/show_bug.cgi?id=40834 + + * src/js/HeapProfilerPanel.js: + (WebInspector.HeapSnapshotProfileType.prototype.buttonClicked): + * src/js/InspectorControllerImpl.js: + (devtools.InspectorBackendImpl): + * src/js/ProfilerAgent.js: + (devtools.ProfilerAgent.prototype.startProfiling): + +2010-06-18 Anton Muhin <antonm@chromium.org> + + Reviewed by Dimitri Glazkov. + + [v8] Finish migration to new named property query API + https://bugs.webkit.org/show_bug.cgi?id=40771 + Remove definition which allowed gradual transition to new API. + See https://bugs.webkit.org/show_bug.cgi?id=40303 for first phase. + Requires V8 roll. + + * DEPS: + +2010-06-17 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: bring XHR console records back. + - adds "Enable XHR Monitor" / "Disable XHR Monitor" actions to the console's context menu + - make the chosen option persist in the settings. + + https://bugs.webkit.org/show_bug.cgi?id=40799 + + * src/js/InspectorControllerImpl.js: + (devtools.InspectorBackendImpl): + +2010-06-15 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by Adam Barth. + + Move isAvailable()/setIsAvailable() from Database/DatabaseSync to AbstractDatabase. + https://bugs.webkit.org/show_bug.cgi?id=39041 + + * src/WebRuntimeFeatures.cpp: + (WebKit::WebRuntimeFeatures::enableDatabase): + (WebKit::WebRuntimeFeatures::isDatabaseEnabled): + +2010-06-17 Tony Chang <tony@chromium.org> + + Reviewed by Kent Tamura. + + [chromium] cleanup redundant DEPS value and remove buildbot cleanup code + https://bugs.webkit.org/show_bug.cgi?id=40615 + + * DEPS: tools/data_pack was listed twice for linux (harmless, but unnecessary) + +2010-06-17 Jeremy Moskovich <jeremy@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium API] Implement WebSandboxSupport on OS X and add stubs to allow + OOP loading of fonts. + + https://bugs.webkit.org/show_bug.cgi?id=40544 + + * WebKit.gyp: Add mac WebSandboxSupport.h + * public/mac/WebSandboxSupport.h: Added. + * src/ChromiumBridge.cpp: + (WebCore::ChromiumBridge::loadFont): + +2010-06-17 Pavel Feldman <pfeldman@chromium.org> + + Unreviewed: chromium tests fix. Added InspectorBackend delegates for new inspector methods. + + * src/js/InspectorControllerImpl.js: + (devtools.InspectorBackendImpl): + +2010-06-17 Mikhail Naganov <mnaganov@chromium.org> + + Reviewed by Pavel Feldman. + + [Chromium] Prepare to making WebDevToolsAgentClient::sendMessageToFrontendOnIOThread virtual + + https://bugs.webkit.org/show_bug.cgi?id=39302 + + * public/WebDevToolsAgent.h: + * public/WebDevToolsAgentClient.h: + (WebKit::WebDevToolsMessageTransport::~WebDevToolsMessageTransport): + * src/WebDevToolsAgentImpl.cpp: + (WebKit::): + (WebKit::WebDevToolsAgent::dispatchMessageFromFrontendOnIOThread): + +2010-06-17 John Gregg <johnnyg@google.com> + + Reviewed by David Levin. + + Undo the build fix with the correct patch: Chromium NotificationPresenter + is now informed of the destruction before it actually happens, so this + use of the Notification object is correct. + https://bugs.webkit.org/show_bug.cgi?id=40097 + + * src/NotificationPresenterImpl.cpp: + (WebKit::NotificationPresenterImpl::notificationObjectDestroyed): + +2010-06-16 Kent Tamura <tkent@chromium.org> + + Reviewed by Dimitri Glazkov. + + [DRT/Chromium] Set current working directory for each of tests + https://bugs.webkit.org/show_bug.cgi?id=40668 + + * DEPS: Update Chromium to r49915 to have + webkit_support::SetCurrentDirectoryForFileURL(). + +2010-06-16 Drew Wilson <atwilson@chromium.org> + + Reviewed by Kent Tamura. + + Added plumbing to Chromium WebKit API to allow setting/getting the name + of top level frames. + + https://bugs.webkit.org/show_bug.cgi?id=40430 + * public/WebFrame.h: + Added setName() API. + * public/WebViewClient.h: + (WebKit::WebViewClient::createView): + Now takes a "name" parameter. + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::createWindow): + Passes a name parameter. + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::setName): + Allows setting the frame name by calling through to the WebCore API. + * src/WebFrameImpl.h: + +2010-06-15 Darin Adler <darin@apple.com> + + Reviewed by Adam Barth. + + Move functions out of Frame class that were marked "move to Chrome" + https://bugs.webkit.org/show_bug.cgi?id=39636 + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::dispatchBeforeUnloadEvent): Call shouldClose + on FrameLoader instead of going through Frame. + +2010-06-11 Darin Fisher <darin@chromium.org> + + Reviewed by Brady Eidson. + + Expose WebHistoryItem::itemSequenceNumber. + + https://bugs.webkit.org/show_bug.cgi?id=40451 + + * public/WebHistoryItem.h: + * src/WebHistoryItem.cpp: + (WebKit::WebHistoryItem::itemSequenceNumber): + (WebKit::WebHistoryItem::setItemSequenceNumber): + +2010-06-15 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + [v8] Web Inspector: make ui tests pass when ScriptDebugServer is used + https://bugs.webkit.org/show_bug.cgi?id=40623 + + * src/js/DebuggerAgent.js: + (devtools.DebuggerAgent.prototype.formatCallFrame_): return empty function name for anonymous functions. + * src/js/DebuggerScript.js: + * src/js/Tests.js: + (.TestSuite.prototype.testProfilerTab.findVisibleView): + (.TestSuite.prototype.testProfilerTab): + (.TestSuite.prototype.testScriptsTabIsPopulatedOnInspectedPageRefresh.waitUntilScriptIsParsed): + (.TestSuite.prototype.testSetBreakpoint.this): + (.TestSuite.prototype.testSetBreakpoint): + (.TestSuite.prototype.testEvalOnCallFrame.waitForBreakpointHit): + (.TestSuite.prototype._executeCodeWhenScriptsAreParsed.executeFunctionInInspectedPage): + (.TestSuite.prototype.testExpandScope.examineScopes): + (.TestSuite.prototype.testExpandScope): + (.TestSuite.prototype.testDebugIntrinsicProperties): + +2010-06-14 Anders Carlsson <andersca@apple.com> + + Fix Chromium build. + + * src/WebPluginListBuilderImpl.cpp: + (WebKit::WebPluginListBuilderImpl::addFileExtensionToLastMediaType): + +2010-06-14 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by Adam Barth. + + Get DatabaseTracker ready for sync DBs. + https://bugs.webkit.org/show_bug.cgi?id=39041 + + * public/WebDatabase.h: + * src/DatabaseObserver.cpp: + (WebCore::DatabaseObserver::databaseOpened): + (WebCore::DatabaseObserver::databaseModified): + (WebCore::DatabaseObserver::databaseClosed): + * src/WebDatabase.cpp: + (WebKit::WebDatabase::closeDatabaseImmediately): + (WebKit::WebDatabase::WebDatabase): + (WebKit::WebDatabase::operator=): + (WebKit::WebDatabase::operator WTF::PassRefPtr<AbstractDatabase>): + +2010-06-14 Chris Fleizach <cfleizach@apple.com> + + Reviewed by Darin Adler. + + AX: need ListItemRole and PresentationalRole + https://bugs.webkit.org/show_bug.cgi?id=40133 + + * public/WebAccessibilityRole.h: + * src/AssertMatchingEnums.cpp: + +2010-06-14 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Remove pluginIndex from MimeClassInfo + https://bugs.webkit.org/show_bug.cgi?id=40588 + + * src/WebPluginListBuilderImpl.cpp: + (WebKit::WebPluginListBuilderImpl::addMediaTypeToLastPlugin): + +2010-06-14 Jeremy Orlow <jorlow@chromium.org> + + Build fix. + + * src/IDBCallbacksProxy.h: + +2010-06-14 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Pavel Feldman. + + WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc + data from inspected page to WebInspector as JSON string via http. The native + serialization to JSON string is supported by InspectorValue's classes. This patch + has the implementation of sendMessageToFrontend function. WebKit version of it still + uses ScriptFunctionCall and will be switched to another transport a little bit later. + https://bugs.webkit.org/show_bug.cgi?id=40134 + + * src/InspectorClientImpl.cpp: + (WebKit::InspectorClientImpl::sendMessageToFrontend): + * src/InspectorClientImpl.h: + * src/WebDevToolsAgentImpl.cpp: + (WebKit::WebDevToolsAgentImpl::setInspectorFrontendProxyToInspectorController): + +2010-06-13 Tony Chang <tony@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] checkout chromium third_party directly + https://bugs.webkit.org/show_bug.cgi?id=40556 + + * DEPS: + +2010-06-13 Tony Chang <tony@chromium.org> + + Build fix, not reviewed. + + fix chromium compile after r61094 (id attribute refactor) + https://bugs.webkit.org/show_bug.cgi?id=40553 + + * src/ChromeClientImpl.cpp: + * src/WebFormControlElement.cpp: + (WebKit::WebFormControlElement::nameForAutofill): + +2010-06-13 Andras Becsi <abecsi@inf.u-szeged.hu> + + Reviewed by Darin Adler. + + Centralize the gperf code generation commands into make-hash-tools.pl + to avoid redundancy across multiple build systems. + Do this in preparation of refactoring the usage of these generated + sources to fix the debug linking error on Linux with gcc >= 4.4.0. + + webkit.org/b/29244 + + * src/WebEntities.cpp: + +2010-06-11 Eric Seidel <eric@webkit.org> + + Reviewed by Adam Barth. + + Rename the rest of the *Tokenizer classes to *DocumentParser + https://bugs.webkit.org/show_bug.cgi?id=40507 + + * src/WebEntities.cpp: + - Fix a comment to match new class names. + +2010-06-12 Evan Stade <estade@chromium.org> + + Reviewed by Eric Seidel. + + [chromium] Menu key should act on current selection even if it is not editable + https://bugs.webkit.org/show_bug.cgi?id=40348 + + Allow the menu key to act on non-editable selections. + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::sendContextMenuEvent): + +2010-06-11 James Hawkins <jhawkins@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Notify the WebView when the AutoFill popup hides. + + https://bugs.webkit.org/show_bug.cgi?id=40459 + + * src/AutoFillPopupMenuClient.cpp: + (WebKit::AutoFillPopupMenuClient::selectionCleared): + +2010-06-11 Tony Gentilcore <tonyg@chromium.org> + + Reviewed by Dimitri Glazkov. + + Roll chromium DEPS 49376:49521 + https://bugs.webkit.org/show_bug.cgi?id=40488 + + * DEPS: + +2010-06-10 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Steve Block. + + Implement more of IndexedDB's Indexes and ObjectStores + https://bugs.webkit.org/show_bug.cgi?id=40424 + + Add plumbing for both of these classes. + + * public/WebIDBDatabase.h: + (WebKit::WebIDBDatabase::name): + (WebKit::WebIDBDatabase::description): + (WebKit::WebIDBDatabase::version): + (WebKit::WebIDBDatabase::objectStores): + (WebKit::WebIDBDatabase::objectStore): + (WebKit::WebIDBDatabase::removeObjectStore): + * public/WebIDBObjectStore.h: + (WebKit::WebIDBObjectStore::indexNames): + (WebKit::WebIDBObjectStore::createIndex): + (WebKit::WebIDBObjectStore::index): + (WebKit::WebIDBObjectStore::removeIndex): + * src/IDBDatabaseProxy.cpp: + (WebCore::IDBDatabaseProxy::name): + (WebCore::IDBDatabaseProxy::description): + (WebCore::IDBDatabaseProxy::version): + (WebCore::IDBDatabaseProxy::objectStores): + (WebCore::IDBDatabaseProxy::objectStore): + (WebCore::IDBDatabaseProxy::removeObjectStore): + * src/IDBDatabaseProxy.h: + * src/IDBObjectStoreProxy.cpp: + (WebCore::IDBObjectStoreProxy::indexNames): + (WebCore::IDBObjectStoreProxy::createIndex): + (WebCore::IDBObjectStoreProxy::index): + (WebCore::IDBObjectStoreProxy::removeIndex): + * src/IDBObjectStoreProxy.h: + * src/WebIDBDatabaseImpl.cpp: + (WebKit::WebIDBDatabaseImpl::WebIDBDatabaseImpl): + (WebKit::WebIDBDatabaseImpl::name): + (WebKit::WebIDBDatabaseImpl::description): + (WebKit::WebIDBDatabaseImpl::version): + (WebKit::WebIDBDatabaseImpl::objectStores): + (WebKit::WebIDBDatabaseImpl::createObjectStore): + (WebKit::WebIDBDatabaseImpl::objectStore): + (WebKit::WebIDBDatabaseImpl::removeObjectStore): + * src/WebIDBDatabaseImpl.h: + * src/WebIDBObjectStoreImpl.cpp: + (WebKit::WebIDBObjectStoreImpl::WebIDBObjectStoreImpl): + (WebKit::WebIDBObjectStoreImpl::name): + (WebKit::WebIDBObjectStoreImpl::keyPath): + (WebKit::WebIDBObjectStoreImpl::indexNames): + (WebKit::WebIDBObjectStoreImpl::createIndex): + (WebKit::WebIDBObjectStoreImpl::index): + (WebKit::WebIDBObjectStoreImpl::removeIndex): + * src/WebIDBObjectStoreImpl.h: + +2010-06-11 Alexander Pavlov <apavlov@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: Enable serialization/deserialization of the frontend state + https://bugs.webkit.org/show_bug.cgi?id=40228 + + * src/js/InspectorControllerImpl.js: + (devtools.InspectorBackendImpl): + +2010-06-10 Søren Gjesse <sgjesse@chromium.org> + + Reviewed by Pavel Feldman. + + V8: Chromium test expectations not matching improved V8 JavaScript stepping + https://bugs.webkit.org/show_bug.cgi?id=40419 + + Update test expetations to match chaged V8 break locations. + + * src/js/Tests.js: + +2010-06-10 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: Port performSearch from InjectedScript to InspectorDOMAgent. + + https://bugs.webkit.org/show_bug.cgi?id=40422 + + * src/js/InspectorControllerImpl.js: + (devtools.InspectorBackendImpl): + +2010-06-11 Vangelis Kokkevis <vangelis@chromium.org> + + Reviewed by David Levin. + + [chromium] Adding a build dependency to the gles2 C library to the webkit_unit_tests + project to allow it to link when WebCore is compiled with the ACCELERATED_COMPOSITING + flag. + https://bugs.webkit.org/show_bug.cgi?id=40341 + + * WebKit.gyp: + +2010-06-10 Kent Tamura <tkent@chromium.org> + + Reviewed by Dimitri Glazkov. + + [DRT/Chromium] Support plugin tests + https://bugs.webkit.org/show_bug.cgi?id=40413 + + * DEPS: + Bump the Chromium revision to r49376 to have a npapi_layout_test_plugin + change and Linux <progress> resources. + Add third_party/mesa because app/ depends on them + since r49332. + * WebKit.gyp: + Copy a plugin binary for DRT to recognize it. + +2010-06-10 James Hawkins <jhawkins@chromium.org> + + Not reviwed. + + Build fix for Chromium Mac Release. + + * src/AutoFillPopupMenuClient.cpp: + (WebKit::AutoFillPopupMenuClient::getSuggestion): + (WebKit::AutoFillPopupMenuClient::valueChanged): + (WebKit::AutoFillPopupMenuClient::selectionChanged): + (WebKit::AutoFillPopupMenuClient::itemIsSeparator): + +2010-06-09 James Hawkins <jhawkins@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Add the ability to specify a separator in + AutoFillPopupMenuClient. + + https://bugs.webkit.org/show_bug.cgi?id=40397 + + * public/WebViewClient.h: + (WebKit::WebViewClient::didAcceptAutoFillSuggestion): + * src/AutoFillPopupMenuClient.cpp: + (WebKit::AutoFillPopupMenuClient::getSuggestionsCount): + (WebKit::AutoFillPopupMenuClient::getSuggestion): + (WebKit::AutoFillPopupMenuClient::valueChanged): + (WebKit::AutoFillPopupMenuClient::selectionChanged): + (WebKit::AutoFillPopupMenuClient::itemIsSeparator): + (WebKit::AutoFillPopupMenuClient::initialize): + (WebKit::AutoFillPopupMenuClient::setSuggestions): + * src/AutoFillPopupMenuClient.h: + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::applyAutoFillSuggestions): + * src/WebViewImpl.h: + +2010-06-10 Dmitry Titov <dimich@chromium.org> + + Not reviewed, Chromium build fix from Abhishek Arya. + + * src/WebImageCG.cpp: + (WebKit::WebImage::WebImage): + (WebKit::WebImage::operator=): + +2010-06-10 Abhishek Arya <inferno@chromium.org> + + Reviewed by Dimitri Glazkov. + + Add null pointer checks for nativeImageForCurrentFrame + function calls. + https://bugs.webkit.org/show_bug.cgi?id=39797 + + * src/WebImageCG.cpp: + (WebKit::WebImage::WebImage): + (WebKit::WebImage::operator=): + +2010-06-10 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: to reduce the front end start up time don't push script + sources to frontend if debugger is always enabled, instead request + script content lazily at the moment it should be displyed. It is critical for + always enabled debugger because in that case lots of script may have + already been parsed when the front end is opening and pushing all + of them at once may slow things down(even though the script sources will never + be used if scripts panel isn't open). + https://bugs.webkit.org/show_bug.cgi?id=40364 + + * src/js/DevTools.js: + * src/js/InspectorControllerImpl.js: + (devtools.InspectorBackendImpl): + (.devtools.InspectorBackendImpl.prototype.getScriptSource): + +2010-06-10 Mike Belshe <mbelshe@google.com> + + Reviewed by David Levin + + Track whether a resource is loaded via a proxy. + + https://bugs.webkit.org/show_bug.cgi?id=40312 + + * public/WebURLResponse.h: + * src/WebURLResponse.cpp: + (WebKit::WebURLResponse::wasFetchedViaProxy): + (WebKit::WebURLResponse::setWasFetchedViaProxy): + +2010-06-10 Vangelis Kokkevis <vangelis@chromium.org> + + Reviewed by Dimitri Glazkov. + + [chromium] Adding the ANGLE project to the DEPS file as it's required + by the gpu-accelerated compositor. + https://bugs.webkit.org/show_bug.cgi?id=40379 + + * DEPS: + +2010-06-09 Bo Liu <boliu@chromium.org> + + Reviewed by David Levin. + + [Chromium] Pass <video> full screen calls to Chromium port client + https://bugs.webkit.org/show_bug.cgi?id=40317 + + * public/WebViewClient.h: + (WebKit::WebViewClient::supportsFullscreen): + (WebKit::WebViewClient::enterFullscreenForNode): + (WebKit::WebViewClient::exitFullscreenForNode): + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::supportsFullscreenForNode): + (WebKit::ChromeClientImpl::enterFullscreenForNode): + (WebKit::ChromeClientImpl::exitFullscreenForNode): + * src/ChromeClientImpl.h: + +2010-06-09 Kenneth Russell <kbr@google.com> + + Reviewed by Dimitri Glazkov. + + Rename FloatArray to Float32Array + https://bugs.webkit.org/show_bug.cgi?id=40323 + + Used do-webcore-rename to perform renaming. Manually undid + incorrect changes to WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp, + WebCore/manual-tests/resources/ArrayParameterTestApplet.java and + ArrayParameterTestApplet.class. Updated LayoutTests. Built and ran + all layout tests on Safari; built Chromium and ran selected WebGL + tests. + + * src/GraphicsContext3D.cpp: + +2010-06-09 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r60889. + http://trac.webkit.org/changeset/60889 + https://bugs.webkit.org/show_bug.cgi?id=40365 + + gtk bot has some kind of memory corruption (Requested by + loislo on #webkit). + + * src/InspectorClientImpl.cpp: + * src/InspectorClientImpl.h: + * src/WebDevToolsAgentImpl.cpp: + (WebKit::WebDevToolsAgentImpl::setInspectorFrontendProxyToInspectorController): + +2010-06-09 Pavel Podivilov <podivilov@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: retreive debugger script source synchronously when + frontend is attached. We need this to be able to stop on top-level + breakpoints. + https://bugs.webkit.org/show_bug.cgi?id=40289 + + * WebKit.gypi: + * src/DebuggerAgent.h: + * src/DebuggerAgentImpl.cpp: + * src/DebuggerAgentImpl.h: + * src/WebDevToolsAgentImpl.cpp: + (WebKit::WebDevToolsAgentImpl::createInspectorFrontendProxy): + * src/js/DebuggerScript.js: + * src/js/DevTools.js: + (WebInspector.loaded): + * src/js/DevToolsHostStub.js: + +2010-06-07 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Pavel Feldman. + + WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc + data from inspected page to WebInspector as JSON string via http. The native + serialization to JSON string is supported by InspectorValue's classes. This patch + has the implementation of sendMessageToFrontend function. WebKit version of it still + uses ScriptFunctionCall and will be switched to another transport a little bit later. + https://bugs.webkit.org/show_bug.cgi?id=40134 + + * src/InspectorClientImpl.cpp: + (WebKit::InspectorClientImpl::sendMessageToFrontend): + * src/InspectorClientImpl.h: + * src/WebDevToolsAgentImpl.cpp: + (WebKit::WebDevToolsAgentImpl::setInspectorFrontendProxyToInspectorController): + +2010-06-09 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: update stack trace after script source editing + https://bugs.webkit.org/show_bug.cgi?id=40357 + + * src/js/DebuggerAgent.js: + (devtools.DebuggerAgent.prototype.editScriptSource.this.requestSeqToCallback_.cmd.getSequenceNumber): + (devtools.DebuggerAgent.prototype.editScriptSource.requestBacktrace): + (devtools.DebuggerAgent.prototype.editScriptSource.handleBacktraceResponse): + (devtools.DebuggerAgent.prototype.editScriptSource.reportDidCommitEditing): + (devtools.DebuggerAgent.prototype.editScriptSource): + (devtools.DebuggerAgent.prototype.requestBacktrace_): + (devtools.DebuggerAgent.prototype.handleDebuggerOutput_): + (devtools.DebuggerAgent.prototype.doHandleBacktraceResponse_): + (devtools.DebuggerAgent.prototype.updateCallFramesFromBacktraceResponse_): + * src/js/InspectorControllerImpl.js: + (.devtools.InspectorBackendImpl.prototype.editScriptSource): + +2010-06-08 Tony Chang <tony@chromium.org> + + Reviewed by David Levin. + + [chromium] compile linux chromium in WebKit/out instead of WebKit/WebKit/chromium/out + https://bugs.webkit.org/show_bug.cgi?id=40285 + + Take 2 at landing this patch, this time rolling DEPS just a bit + further to pick up some chromium fixes. + + * DEPS + * gyp_webkit: + +2010-06-08 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r60878. + http://trac.webkit.org/changeset/60878 + https://bugs.webkit.org/show_bug.cgi?id=40349 + + broke linux build (Requested by tony^work on #webkit). + + * DEPS: + * gyp_webkit: + +2010-06-08 Tony Chang <tony@chromium.org> + + Reviewed by David Levin. + + [chromium] compile linux chromium in WebKit/out instead of WebKit/WebKit/chromium/out + https://bugs.webkit.org/show_bug.cgi?id=40285 + + * gyp_webkit: + +2010-06-08 Tony Chang <tony@chromium.org> + + Not reviewed, build fix. + + [chromium] fix linux compile + https://bugs.webkit.org/show_bug.cgi?id=40343 + + * DEPS: + +2010-06-08 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: extend ScriptDebugServer to support script source editing + https://bugs.webkit.org/show_bug.cgi?id=40297 + + * src/js/DebuggerAgent.js: + (devtools.ScriptInfo.prototype.worldType): + * src/js/DebuggerScript.js: + (debuggerScriptConstructor.DebuggerScript.editScriptSource): + * src/js/DevTools.js: + (WebInspector.loaded): + * src/js/InspectorControllerImpl.js: + (devtools.InspectorBackendImpl): + +2010-06-08 Antonio Gomes <tonikitoo@webkit.org> + + Reviewed by Ojan Vafai and Darin Adler. + + Refactor platform dependent editing behavior code out of Settings + https://bugs.webkit.org/show_bug.cgi?id=39854 + + EditingBehavior enum was renamed to EditingBehaviorTypes and moved out from Settings.h to + EditingBehaviorTypes.h . Call sites in WebKit/ adjusted accordingly. + + * src/WebSettingsImpl.cpp: + (WebKit::WebSettingsImpl::setEditingBehavior): +2010-06-07 Tony Chang <tony@chromium.org> + + Reviewed by Kent Tamura. + + [chromium] roll chromium DEPS + https://bugs.webkit.org/show_bug.cgi?id=40277 + + * DEPS: + +2010-06-07 Kinuko Yasuda <kinuko@chromium.org> + + Reviewed by Jian Li. + + Refactor FormData and Blob for better support of Blobs synthesized by BlobBuilder. + https://bugs.webkit.org/show_bug.cgi?id=39083 + + Replace FormDataList::Item list with BlobItemList to get it compiled + with the refactoring in FormDataList. + + * src/WebSearchableFormData.cpp: + (WebCore::HasSuitableTextElement): + +2010-06-07 Andrei Popescu <andreip@google.com> + + Reviewed by Jeremy Orlow. + + [indexedDB] It is impossible to create object stores + https://bugs.webkit.org/show_bug.cgi?id=40054 + + * WebKit.gyp: + * public/WebIDBCallbacks.h: + (WebKit::WebIDBCallbacks::onSuccess): + * public/WebIDBDatabase.h: + (WebKit::WebIDBDatabase::createObjectStore): + * public/WebIDBObjectStore.h: Added. + (WebKit::WebIDBObjectStore::~WebIDBObjectStore): + (WebKit::WebIDBObjectStore::name): + (WebKit::WebIDBObjectStore::keyPath): + * src/IDBCallbacksProxy.cpp: + (WebCore::IDBCallbacksProxy::onSuccess): + * src/IDBCallbacksProxy.h: + * src/IDBDatabaseProxy.cpp: + (WebCore::IDBDatabaseProxy::createObjectStore): + * src/IDBDatabaseProxy.h: + * src/IDBObjectStoreProxy.cpp: Added. + (WebCore::IDBObjectStoreProxy::create): + (WebCore::IDBObjectStoreProxy::IDBObjectStoreProxy): + (WebCore::IDBObjectStoreProxy::~IDBObjectStoreProxy): + (WebCore::IDBObjectStoreProxy::name): + (WebCore::IDBObjectStoreProxy::keyPath): + (WebCore::IDBObjectStoreProxy::indexNames): + (WebCore::IDBObjectStoreProxy::createIndex): + (WebCore::IDBObjectStoreProxy::index): + (WebCore::IDBObjectStoreProxy::removeIndex): + * src/IDBObjectStoreProxy.h: Added. + * src/IndexedDatabaseProxy.cpp: + (WebCore::IndexedDatabaseProxy::open): + * src/WebIDBCallbacksImpl.cpp: + (WebCore::WebIDBCallbacksImpl::onSuccess): + * src/WebIDBCallbacksImpl.h: + * src/WebIDBDatabaseImpl.cpp: + (WebKit::WebIDBDatabaseImpl::createObjectStore): + * src/WebIDBDatabaseImpl.h: + * src/WebIDBObjectStoreImpl.cpp: Added. + (WebKit::WebIDBObjectStoreImpl::WebIDBObjectStoreImpl): + (WebKit::WebIDBObjectStoreImpl::~WebIDBObjectStoreImpl): + (WebKit::WebIDBObjectStoreImpl::name): + (WebKit::WebIDBObjectStoreImpl::keyPath): + * src/WebIDBObjectStoreImpl.h: Added. + * src/WebIndexedDatabaseImpl.cpp: + (WebKit::WebIndexedDatabaseImpl::open): + +2010-06-07 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: should be possible to distinguish extension scripts from main world scripts + https://bugs.webkit.org/show_bug.cgi?id=40220 + + * src/js/DebuggerAgent.js: + (devtools.DebuggerAgent.prototype.initUI): + (devtools.DebuggerAgent.prototype.addScriptInfo_): + (devtools.DebuggerAgent.prototype.formatCallFrame_): + (devtools.ScriptInfo.prototype.worldType): + * src/js/DebuggerScript.js: + (debuggerScriptConstructor.DebuggerScript.getScripts): use only context id without context type + when filtering scripts so that extension scripts are also included. + (debuggerScriptConstructor.DebuggerScript._formatScript): + * src/js/devTools.css: + +2010-06-04 Jay Civelli <jcivelli@chromium.org> + + Reviewed by Dimitri Glazkov. + + Accessibility focus change notifications are now sent from + ChromeClientImpl::focusedNodeChanged(). + https://bugs.webkit.org/show_bug.cgi?id=39792 + + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::focus): + (WebKit::ChromeClientImpl::focusedNodeChanged): + +2010-06-04 Jay Civelli <jcivelli@chromium.org> + + Reviewed by David Levin. + + [chromium] Adding support for the left and right Windows keys to the + NativeWebKeyboardEvent. + https://bugs.webkit.org/show_bug.cgi?id=39752 + + * src/gtk/WebInputEventFactory.cpp: + (WebKit::gdkEventToWindowsKeyCode): + +2010-06-04 Pavel Podivilov <podivilov@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: Create resource for DebuggerScript.js. + https://bugs.webkit.org/show_bug.cgi?id=40122 + + * WebKit.grd: + * public/WebDevToolsAgentClient.h: + (WebKit::WebDevToolsAgentClient::debuggerScriptSource): + +2010-05-26 MORITA Hajime <morrita@google.com> + + Reviewed by Jian Li. + + [Chromium] Dragging over an element with scrollbars should scroll the element when dragging near edges + https://bugs.webkit.org/show_bug.cgi?id=39725 + + Added WebViewImpl::scrollForDragging() to handle scroll-on-drag. + Note that this change handes both source and destination cases. + + * public/WebView.h: + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::dragSourceMovedTo): + (WebKit::WebViewImpl::dragTargetDragEnterOrOver): + (WebKit::WebViewImpl::scrollForDragging): + * src/WebViewImpl.h: + +2010-06-03 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + [v8] Web Inspector: show "Object" as description for values with anonymous constructor + https://bugs.webkit.org/show_bug.cgi?id=40121 + + * src/js/DevTools.js: don't call DebuggerAgent methods if ScriptDebugServer is used. + +2010-06-03 Kent Tamura <tkent@chromium.org> + + Reviewed by Dimitri Glazkov. + + [DRT/Chromium] Checking out lighttpd + https://bugs.webkit.org/show_bug.cgi?id=39948 + + - Add lighttpd only on Windows. It is used by new-run-webkit-tests. + - Add libvpx. + - Remove pthreads-win32 from DEPS. + It has not been used since Chromium r28642. + - Update Chromium revision to use Windows resource query code and + webkit_glue dependency fix. + + * DEPS: + +2010-06-02 Tony Chang <tony@chromium.org> + + Reviewed by Kent Tamura. + + [chromium] refactor WebKit.gyp's DRT section so the conditions are less messy + https://bugs.webkit.org/show_bug.cgi?id=40104 + + * WebKit.gyp: + +2010-06-02 Tony Chang <tony@chromium.org> + + Not reviewed, build fix in downstream chromium. + + Fix the path to repack.py so it works in a chromium checkout too. + + * WebKit.gyp: + +2010-06-02 Tony Chang <tony@chromium.org> + + Reviewed by Kent Tamura. + + [chromium] generate DumpRenderTree.pak on DRT linux + https://bugs.webkit.org/show_bug.cgi?id=40098 + + * WebKit.gyp: + +2010-06-02 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r60592. + http://trac.webkit.org/changeset/60592 + https://bugs.webkit.org/show_bug.cgi?id=40099 + + broke the build, need to coordiate updating DEPS (Requested by + tony^work on #webkit). + + * DEPS: + * public/WebMediaPlayer.h: + +2010-06-02 Victoria Kirst <vrk@google.com> + + Reviewed by David Levin. + + Modifying the WebMediaPlayer interface to be compatible with + a change in chrome. + This is a part 2 of 3 one-sided changes to chrome and WebKit. Chrome + has been updated, so this commit should NOT break chromium anymore. + https://bugs.webkit.org/show_bug.cgi?id=39445 + + * DEPS: Updated to a newer chrome revision number. + * public/WebMediaPlayer.h: Changed buffered() to be non-const. + +2010-06-02 Peter Kasting <pkasting@google.com> + + Unreviewed, emergency fix for test crashes (verbal r+ beforehand from + John Gregg). + + Temporarily make notificationObjectDestroyed() a no-op to avoid an + ASSERT failure. + + https://bugs.webkit.org/show_bug.cgi?id=40097 + + * src/NotificationPresenterImpl.cpp: + (WebKit::NotificationPresenterImpl::notificationObjectDestroyed): + +2010-06-02 Sterling Swigart <sswigart@google.com> + + Reviewed by David Levin. + + Image Resizer Patch 0: Added compilation argument to conditionally compile pending patches. + https://bugs.webkit.org/show_bug.cgi?id=39906 + + * features.gypi: + +2010-06-01 James Hawkins <jhawkins@chromium.org> + + UNREVIEWED: build fix. + + Implement the added virtual methods from PopupMenuClient to + TestPopupMenuClient. + + * tests/PopupMenuTest.cpp: + (WebKit::TestPopupMenuClient::selectionChanged): + (WebKit::TestPopupMenuClient::selectionCleared): + +2010-05-24 James Hawkins <jhawkins@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Implement new PopupMenuClient methods selectionChanged() + and selectionCleared(). Expose placeHolder methods and isAutoFilled() + in WebInputElement. + + https://bugs.webkit.org/show_bug.cgi?id=39639 + + * public/WebInputElement.h: + * public/WebViewClient.h: + (WebKit::WebViewClient::didSelectAutoFillSuggestion): + (WebKit::WebViewClient::didClearAutoFillSelection): + * src/AutoFillPopupMenuClient.cpp: + (WebKit::AutoFillPopupMenuClient::selectionChanged): + (WebKit::AutoFillPopupMenuClient::selectionCleared): + (WebKit::AutoFillPopupMenuClient::popupDidHide): + * src/AutoFillPopupMenuClient.h: + * src/SuggestionsPopupMenuClient.h: + (WebKit::SuggestionsPopupMenuClient::selectionChanged): + (WebKit::SuggestionsPopupMenuClient::selectionCleared): + * src/WebInputElement.cpp: + (WebKit::WebInputElement::setPlaceholder): + (WebKit::WebInputElement::placeholder): + (WebKit::WebInputElement::isAutofilled): + +2010-06-01 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r60483. + http://trac.webkit.org/changeset/60483 + https://bugs.webkit.org/show_bug.cgi?id=40013 + + Breaks Mac and Linux builds (Requested by antonm on #webkit). + + * DEPS: + +2010-06-01 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Darin Fisher. + + IndexedDB cleanup + https://bugs.webkit.org/show_bug.cgi?id=40007 + + Remove the exception code paramter (that hasn't been used for a while). + Add asserts to default implementations. + + * public/WebIDBDatabase.h: + (WebKit::WebIDBDatabase::name): + (WebKit::WebIDBDatabase::description): + (WebKit::WebIDBDatabase::version): + (WebKit::WebIDBDatabase::objectStores): + * public/WebIndexedDatabase.h: + (WebKit::WebIndexedDatabase::open): + * src/WebIndexedDatabaseImpl.cpp: + (WebKit::WebIndexedDatabaseImpl::open): + * src/WebIndexedDatabaseImpl.h: + +2010-06-01 Anton Muhin <antonm@chromium.org> + + Reviewed by Dimitri Glazkov. + + Rolling Chromium revision to bring recent changes to V8. + + * DEPS: + +2010-06-01 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r60470. + http://trac.webkit.org/changeset/60470 + https://bugs.webkit.org/show_bug.cgi?id=39990 + + Need to rollout until bot can be updated (Requested by jorlow + on #webkit). + + * DEPS: + +2010-05-31 Pavel Podivilov <podivilov@chromium.org> + + Reviewed by Pavel Feldman. + + Chromium: save inspector settings as dictionary, not as string. + https://bugs.webkit.org/show_bug.cgi?id=32118 + + * public/WebView.h: + * public/WebViewClient.h: + (WebKit::WebViewClient::didUpdateInspectorSetting): + * src/InspectorClientImpl.cpp: + (WebKit::InspectorClientImpl::populateSetting): + (WebKit::InspectorClientImpl::storeSetting): + * src/InspectorClientImpl.h: + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::WebViewImpl): + (WebKit::WebViewImpl::inspectorSetting): + (WebKit::WebViewImpl::setInspectorSetting): + * src/WebViewImpl.h: + +2010-05-31 James Robinson <jamesr@chromium.org> + + Reviewed by Darin Fisher. + + Expose html5 parser enabled flag in WebSettings + https://bugs.webkit.org/show_bug.cgi?id=39913 + + * public/WebSettings.h: + * src/WebSettingsImpl.cpp: + (WebKit::WebSettingsImpl::setHTML5ParserEnabled): + * src/WebSettingsImpl.h: + +2010-05-31 Lyon Chen <liachen@rim.com> + + Reviewed by Kent Tamura. + + Enum value FORWARD, BACKWARD, RIGHT, LEFT are causing macro conflicts. + https://bugs.webkit.org/show_bug.cgi?id=35530 + + Change enum EAlteration from { MOVE, EXTEND } to { AlterationMove, AlterationExtend } and enum EDirection { FORWARD, BACKWARD, RIGHT, LEFT} to { DirectionForward, DirectionBackward, DirectionRight, DirectionLeft } to avoid macro conflict, and also better coding style conformance. + + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::executeCommand): + +2010-05-31 Roland Steiner <rolandsteiner@chromium.org> + + Bug 39977 - Missing Chromium bindings for InspectorController methods introduced in r60443 + https://bugs.webkit.org/show_bug.cgi?id=39977 + + add missing InspectorController JS bindings: + - getStyleSheet + - getRuleRangesForStyleSheetId + + Tests: inspector/styles-source-offsets.html + + * src/js/InspectorControllerImpl.js: + (devtools.InspectorBackendImpl): + +2010-05-31 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r60456. + http://trac.webkit.org/changeset/60456 + https://bugs.webkit.org/show_bug.cgi?id=39974 + + Broke Chromium Linux/Max build (Requested by tkent on + #webkit). + + * DEPS: + +2010-05-31 Kent Tamura <tkent@chromium.org> + + Reviewed by Dimitri Glazkov. + + [DRT/Chromium] Checking out lighttpd + https://bugs.webkit.org/show_bug.cgi?id=39948 + + - Checking out lighttpd only on Windows. It is used by new-run-webkit-tests. + - Update Chromium revision to use Windows resource query code + + * DEPS: + +2010-05-31 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: allow hiding Scripts panel from Chromium code. This + is needed to support v8 debugging protocol which has an implementation + that conflicts with debugger provided by the inspector. + https://bugs.webkit.org/show_bug.cgi?id=39952 + + * public/WebDevToolsAgentClient.h: + (WebKit::WebDevToolsAgentClient::exposeV8DebuggerProtocol): + * public/WebDevToolsFrontendClient.h: + (WebKit::WebDevToolsFrontendClient::WebDevToolsFrontendClient): + (WebKit::WebDevToolsFrontendClient::sendMessageToAgent): + (WebKit::WebDevToolsFrontendClient::sendDebuggerCommandToAgent): + (WebKit::WebDevToolsFrontendClient::sendDebuggerPauseScript): + (WebKit::WebDevToolsFrontendClient::activateWindow): + (WebKit::WebDevToolsFrontendClient::closeWindow): + (WebKit::WebDevToolsFrontendClient::requestDockWindow): + (WebKit::WebDevToolsFrontendClient::requestUndockWindow): + (WebKit::WebDevToolsFrontendClient::hideScriptsPanel): + * src/DebuggerAgentManager.cpp: + (WebKit::DebuggerAgentManager::debugAttach): + (WebKit::DebuggerAgentManager::debugDetach): + (WebKit::DebuggerAgentManager::setExposeV8DebuggerProtocol): + * src/DebuggerAgentManager.h: + * src/InspectorFrontendClientImpl.cpp: + (WebKit::InspectorFrontendClientImpl::hiddenPanels): + * src/WebDevToolsAgentImpl.cpp: + (WebKit::WebDevToolsAgentImpl::WebDevToolsAgentImpl): + (WebKit::WebDevToolsAgentImpl::attach): + +2010-05-30 Lyon Chen <liachen@rim.com> + + Reviewed by Kent Tamura. + + This is a coding style cleanup before fixing to bug 35530. + + Enum value FORWARD, BACKWARD, RIGHT, LEFT are causing macro conflicts. + https://bugs.webkit.org/show_bug.cgi?id=35530 + + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::find): + (WebKit::WebFrameImpl::scopeStringMatches): + (WebKit::WebFrameImpl::createChildFrame): + (WebKit::WebFrameImpl::shouldScopeMatches): + +2010-05-30 Daniel Bates <dbates@rim.com> + + Unreviewed, attempt to fix the build after http://trac.webkit.org/changeset/60418. + + I missed a few call sites in the Chromium source when I + landed http://trac.webkit.org/changeset/60419. + + Credit to Chris Jerdonek for looking over both this patch and the patch + committed in r60419. + + * src/WebSearchableFormData.cpp: + (WebCore::GetButtonToActivate): + (WebCore::HasSuitableTextElement): + +2010-05-30 Daniel Bates <dbates@rim.com> + + Unreviewed, attempt to fix the build after http://trac.webkit.org/changeset/60418. + + * src/EditorClientImpl.cpp: + (WebKit::EditorClientImpl::autofill): + * src/WebFormControlElement.cpp: + (WebKit::WebFormControlElement::formControlName): + (WebKit::WebFormControlElement::formControlType): + * src/WebFormElement.cpp: + (WebKit::WebFormElement::getFormControlElements): + * src/WebPasswordFormUtils.cpp: + (WebKit::findPasswordFormFields): + +2010-05-30 Jessie Berlin <jberlin@webkit.org> + + Reviewed by Pavel Feldman. + + https://bugs.webkit.org/show_bug.cgi?id=39224 + Bug 39224 - Web Inspector: There should be a way to clean up profiles + + * src/js/InspectorControllerImpl.js: + (devtools.InspectorBackendImpl): + +2010-05-29 Vangelis Kokkevis <vangelis@chromium.org> + + Reviewed by Darin Fisher. + + Adding support for a runtime flag to enable accelerated + compositing in chromium. + https://bugs.webkit.org/show_bug.cgi?id=39917 + + * public/WebSettings.h: + * src/WebSettingsImpl.cpp: + (WebKit::WebSettingsImpl::setAcceleratedCompositingEnabled): + * src/WebSettingsImpl.h: + +2010-05-28 Aaron Boodman <aa@chromium.org> + + Reviewed by Darin Fisher. + + Add isXHTMLDocument() to WebDocument. + + https://bugs.webkit.org/show_bug.cgi?id=39887 + + * public/WebDocument.h: Add isXHTMLDocument(). + * src/WebDocument.cpp: ditto. + (WebKit::WebDocument::isXHTMLDocument): dittorama. + +2010-05-27 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Steve Block. + + Add IndexedDB's IDBIndex + https://bugs.webkit.org/show_bug.cgi?id=39850 + + Add WebKit layer for IDBIndex. + + * WebKit.gyp: + * public/WebCommon.h: + * public/WebIDBCallbacks.h: + (WebKit::WebIDBCallbacks::onError): + (WebKit::WebIDBCallbacks::onSuccess): + * public/WebIDBDatabase.h: + * public/WebIDBIndex.h: Added. + (WebKit::WebIDBIndex::~WebIDBIndex): + (WebKit::WebIDBIndex::name): + (WebKit::WebIDBIndex::keyPath): + (WebKit::WebIDBIndex::unique): + * src/IDBCallbacksProxy.cpp: + (WebCore::IDBCallbacksProxy::onSuccess): + * src/IDBCallbacksProxy.h: + * src/IDBDatabaseProxy.cpp: + * src/IDBDatabaseProxy.h: + * src/IDBIndexProxy.cpp: Added. + (WebCore::IDBIndexProxy::create): + (WebCore::IDBIndexProxy::IDBIndexProxy): + (WebCore::IDBIndexProxy::~IDBIndexProxy): + (WebCore::IDBIndexProxy::name): + (WebCore::IDBIndexProxy::keyPath): + (WebCore::IDBIndexProxy::unique): + * src/IDBIndexProxy.h: Added. + * src/WebIDBCallbacksImpl.cpp: + (WebCore::WebIDBCallbacksImpl::onSuccess): + * src/WebIDBCallbacksImpl.h: + * src/WebIDBDatabaseImpl.cpp: + * src/WebIDBDatabaseImpl.h: + * src/WebIDBIndexImpl.cpp: Added. + (WebKit::WebIDBIndexImpl::WebIDBIndexImpl): + (WebKit::WebIDBIndexImpl::~WebIDBIndexImpl): + (WebKit::WebIDBIndexImpl::name): + (WebKit::WebIDBIndexImpl::keyPath): + (WebKit::WebIDBIndexImpl::unique): + * src/WebIDBIndexImpl.h: Added. + +2010-05-28 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: check that ClientMessageLoopAdapter is not 0 before + accessing its fileds from inspectedViewClosed method. It may be 0 + if inspector frontend has not been open. + https://bugs.webkit.org/show_bug.cgi?id=39876 + + * src/WebDevToolsAgentImpl.cpp: + (WebKit::): + +2010-05-27 Eric Uhrhane <ericu@chromium.org> + + Reviewed by Adam Barth. + + Add v8 bindings for async DB API in workers + https://bugs.webkit.org/show_bug.cgi?id=39145 + + * src/DatabaseObserver.cpp: + We should check that we're on the context thread now, not the main + thread. + (WebCore::DatabaseObserver::databaseOpened): + (WebCore::DatabaseObserver::databaseModified): + (WebCore::DatabaseObserver::databaseClosed): + +2010-05-27 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Resume script execution if user tries to navigate to another URL + https://bugs.webkit.org/show_bug.cgi?id=39842 + + * src/WebDevToolsAgentImpl.cpp: + (WebKit::): + (WebKit::WebDevToolsAgentImpl::didNavigate): + +2010-05-27 Zhenyao Mo <zmo@google.com> + + Reviewed by Dimitri Glazkov. + + Implement lazy clearing of renderbuffers + https://bugs.webkit.org/show_bug.cgi?id=36248 + + * src/WebGraphicsContext3DDefaultImpl.cpp: + (WebKit::WebGraphicsContext3DDefaultImpl::reshape): Clear WebGL internal buffers. + +2010-05-26 Roland Steiner <rolandsteiner@chromium.org> + + Reviewed by NOBODY (layout test crashing fix). + + Bug 39811 - WebPluginListBuilderImpl::addMediaTypeToLastPlugin does not initialize pluginIndex + https://bugs.webkit.org/show_bug.cgi?id=39811 + + Initialize the pluginIndex field (quick fix). + + Tests: covered by fast/dom/prototype-inheritance-2.html + (crashed under Chromium Linux and Windows) + + * src/WebPluginListBuilderImpl.cpp: + (WebKit::WebPluginListBuilderImpl::addMediaTypeToLastPlugin): + +2010-05-26 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + Clean up MimeClassInfo and PluginInfo + https://bugs.webkit.org/show_bug.cgi?id=39700 + + Update for WebCore changes. + + * src/WebPluginListBuilderImpl.cpp: + (WebKit::WebPluginListBuilderImpl::addPlugin): + (WebKit::WebPluginListBuilderImpl::addMediaTypeToLastPlugin): + (WebKit::WebPluginListBuilderImpl::addFileExtensionToLastMediaType): + * src/WebPluginListBuilderImpl.h: + (WebKit::WebPluginListBuilderImpl::WebPluginListBuilderImpl): + +2010-05-26 Jeremy Orlow <jorlow@chromium.org> + + Unreviewed chromium build fix + https://bugs.webkit.org/show_bug.cgi?id=39739 + + The backwards compat function needs to take in a WebSecurityOrigin + instead of a WebString. + + * public/WebIndexedDatabase.h: + (WebKit::WebIndexedDatabase::open): + +2010-05-26 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Darin Fisher. + + Implement WebDOMStorageList and make WebIDBDatabase use it + https://bugs.webkit.org/show_bug.cgi?id=39731 + + * WebKit.gyp: + * public/WebDOMStringList.h: Added. + (WebKit::WebDOMStringList::~WebDOMStringList): + (WebKit::WebDOMStringList::WebDOMStringList): + (WebKit::WebDOMStringList::operator=): + * public/WebIDBDatabase.h: + (WebKit::WebIDBDatabase::objectStores): + * src/IDBDatabaseProxy.cpp: + (WebCore::IDBDatabaseProxy::objectStores): + * src/WebDOMStringList.cpp: Added. + (WebKit::WebDOMStringList::reset): + (WebKit::WebDOMStringList::assign): + (WebKit::WebDOMStringList::append): + (WebKit::WebDOMStringList::length): + (WebKit::WebDOMStringList::item): + (WebKit::WebDOMStringList::WebDOMStringList): + (WebKit::WebDOMStringList::operator=): + (WebKit::WebDOMStringList::operator WTF::PassRefPtr<WebCore::DOMStringList>): + * src/WebIDBDatabaseImpl.cpp: + (WebKit::WebIDBDatabaseImpl::objectStores): + * src/WebIDBDatabaseImpl.h: + +2010-05-24 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Steve Block. + + Add IDBDatabase's attributes + https://bugs.webkit.org/show_bug.cgi?id=39602 + + Plumbing to hook up the synchronous attribute requests + on IDBDatabase. + + * public/WebIDBDatabase.h: + (WebKit::WebIDBDatabase::name): + (WebKit::WebIDBDatabase::description): + (WebKit::WebIDBDatabase::version): + (WebKit::WebIDBDatabase::objectStores): + * src/IDBDatabaseProxy.cpp: + (WebCore::IDBDatabaseProxy::name): + (WebCore::IDBDatabaseProxy::description): + (WebCore::IDBDatabaseProxy::version): + (WebCore::IDBDatabaseProxy::objectStores): + * src/IDBDatabaseProxy.h: + * src/WebIDBDatabaseImpl.cpp: + (WebKit::WebIDBDatabaseImpl::WebIDBDatabaseImpl): + (WebKit::WebIDBDatabaseImpl::name): + (WebKit::WebIDBDatabaseImpl::description): + (WebKit::WebIDBDatabaseImpl::version): + (WebKit::WebIDBDatabaseImpl::objectStores): + * src/WebIDBDatabaseImpl.h: + +2010-05-24 Dirk Pranke <dpranke@chromium.org> + + Reviewed by Dimitri Glazkov. + + Re-commit r58765 - it had been rolled out to see if it was causing + a perf regression (in r59787 and r59789), but that does not seem to + have been the case. + + * public/WebNotification.h: + * src/WebNotification.cpp: + (WebKit::WebNotification::dir): + (WebKit::WebNotification::replaceId): + +2010-05-25 Brett Wilson <brettw@chromium.org> + + Reviewed by Darin Fisher. + + Remove obsolete code for Mac & Windows plugin creation in the Chromium + port. This non-Windows code was to prevent a crash which we no longer + seem to have, and it is preventing other types of plugins from working. + https://bugs.webkit.org/show_bug.cgi?id=39684 + + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::createPlugin): + +2010-05-25 Kent Tamura <tkent@chromium.org> + + Reviewed by Dimitri Glazkov. + + [DRT/Chromium] Enable 3D_CANVAS, FILTERS, METER_TAG and PROGRESS_TAG + https://bugs.webkit.org/show_bug.cgi?id=39652 + + 3D_CANVAS and FILTERS have been enabled for Chromium tree + build. They fix dozens of unexpected test results in a case of + upstreaming build. + Enable METER_TAG and PROGRESS_TAG too because they will be enabled + in Chromium tree in the near future. + + * features.gypi: + +2010-05-25 Vangelis Kokkevis <vangelis@chromium.org> + + Reviewed by Darin Fisher. + + The GraphicsContext that serves as a backing store for the root layer + updates when doing accelerated compositing is now stored in LayerRendererChromium + instead of the Layer itself. Updating code in WebViewImpl to reflect + that change. + https://bugs.webkit.org/show_bug.cgi?id=39640 + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::updateRootLayerContents): + +2010-05-24 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + ScriptDebugServer is now implemented as DebugEventListener which means it doesn't + depend on v8 debugging protocol, instead it uses ExecState to collect debugging + info and pass it to the listeners. + + New implementation of ScriptDebugServer uses methods provided by client to dispatch + its messages while JS is paused(previously the messages was dispatched in a callback + passed to v8 along with DebugEventHandler). + + Pause command is dispatched on IO thread. + + https://bugs.webkit.org/show_bug.cgi?id=39594 + + * public/WebDevToolsAgentClient.h: + (WebKit::WebDevToolsAgentClient::ClientMessageLoop::~ClientMessageLoop): + (WebKit::WebDevToolsAgentClient::createClientMessageLoop): Returns an object that allows to run + nested client message loop while script execution is paused on a breakpoint. + * src/DebuggerAgentManager.cpp: + (WebKit::DebuggerAgentManager::setMessageLoopDispatchHandler): + * src/DebuggerAgentManager.h: + * src/WebDevToolsAgentImpl.cpp: + (WebKit::): + (WebKit::WebDevToolsAgentImpl::~WebDevToolsAgentImpl): + (WebKit::WebDevToolsAgentImpl::attach): + * src/js/DebuggerScript.js: + (debuggerScriptConstructor.DebuggerScript.getAfterCompileScript): + (debuggerScriptConstructor.DebuggerScript.stepIntoStatement): + (debuggerScriptConstructor.DebuggerScript.stepOverStatement): + (debuggerScriptConstructor.DebuggerScript.stepOutOfFunction): + * src/js/InspectorControllerImpl.js: + (devtools.InspectorBackendImpl): + (else.devtools.InspectorBackendImpl.prototype.pauseInDebugger): Pause command should be handled on IO + thread so that script can be paused even if it's in an infinite loop. + +2010-05-25 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Add memory graph to Timeline overview pane. + + https://bugs.webkit.org/show_bug.cgi?id=37879 + + * src/js/devTools.css: + (.timeline-category-statusbar-item input): + +2010-05-24 Tony Chang <tony@chromium.org> + + Reviewed by David Levin. + + [chromium] Fix zoom tests after r60104 + https://bugs.webkit.org/show_bug.cgi?id=39645 + + m_zoomFactor moved from Frame to FrameView. FrameView has separate + notions of page zoom and text zoom. In my hurried compile fix, I + assumed that m_zoomFactor was for page zoom, but it's not always. + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::setZoomLevel): + +2010-05-24 Kent Tamura <tkent@chromium.org> + + Unreviewed. Sort features. + + * features.gypi: + +2010-05-24 Kent Tamura <tkent@chromium.org> + + Reviewed by Dimitri Glazkov. + + [DRT/Chromium] Import layout_test_helper for Windows + https://bugs.webkit.org/show_bug.cgi?id=39581 + + * WebKit.gyp: Add a build rule for LayoutTestHelper.exe for Windows. + +2010-05-24 Marcus Bulach <bulach@chromium.org> + + Reviewed by Kent Tamura. + + [chromium] Adds WebGeolocationServiceMockImpl to remove public dependency on wtf/HashMap.h + https://bugs.webkit.org/show_bug.cgi?id=39587 + + * public/WebGeolocationServiceMock.h: + * src/WebGeolocationServiceMock.cpp: + (WebKit::WebGeolocationServiceMockImpl::~WebGeolocationServiceMockImpl): + (WebKit::WebGeolocationServiceMock::createWebGeolocationServiceMock): + (WebKit::WebGeolocationServiceMockImpl::requestPermissionForFrame): + (WebKit::WebGeolocationServiceMockImpl::attachBridge): + (WebKit::WebGeolocationServiceMockImpl::detachBridge): + +2010-05-24 Tony Chang <tony@chromium.org> + + Reviewed by Kent Tamura. + + [chromium] setup fonts on chromium linux DRT + https://bugs.webkit.org/show_bug.cgi?id=39644 + + * WebKit.gyp: + +2010-05-24 Tony Chang <tony@chromium.org> + + Not reviewed, build fix. + + Fix the chromium compile due to pageZoomFactor refactoring. + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::setZoomLevel): + +2010-05-24 Darin Adler <darin@apple.com> + + Reviewed by Eric Seidel. + + Move view-related functions from Frame to FrameView + https://bugs.webkit.org/show_bug.cgi?id=39366 + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::setZoomLevel): Call setZoomLevel on FrameView. + +2010-05-24 Anders Carlsson <andersca@apple.com> + + Attempt to fix the Chromium build. + + * src/WebViewImpl.cpp: + +2010-05-21 Tony Chang <tony@chromium.org> + + Reviewed by Ojan Vafai. + + [chromium] if keydown is prevented, don't update the IME and clear the IME state + https://bugs.webkit.org/show_bug.cgi?id=39475 + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::handleCompositionEvent): + +2010-05-23 Roman Gershman <romange@google.com> + + Reviewed by Darin Fisher. + + [Chromium] Suggestion popup is not closed when the view is scrolled. + https://bugs.webkit.org/show_bug.cgi?id=38640 + + This bug appears on both Windows and Linux platforms. + Mac OS, however handles window messages differently and + closes popup menu in RenderWidgetHostViewMac::Destroy(). + + No tests were added because test_shell does not support suggestion + popup. + + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::invalidateContentsForSlowScroll): + (WebKit::ChromeClientImpl::scroll): + +2010-05-23 Marcus Bulach <bulach@chromium.org> + + Reviewed by Kent Tamura. + + [chromium] Adds Geolocation support to DumpRenderTree. + https://bugs.webkit.org/show_bug.cgi?id=39440 + + Existing LayoutTests/fast/dom/Geolocation/* should pass. + + * public/WebGeolocationServiceMock.h: + * src/WebGeolocationServiceMock.cpp: + (WebKit::WebGeolocationServiceMock::setMockGeolocationPermission): + (WebKit::WebGeolocationServiceMock::requestPermissionForFrame): + (WebKit::WebGeolocationServiceMock::attachBridge): + (WebKit::WebGeolocationServiceMock::detachBridge): + +2010-05-22 Kent Tamura <tkent@chromium.org> + + Reviewed by Dimitri Glazkov. + + [DRT/Chromium] Link resources and load Ahem font for Windows + https://bugs.webkit.org/show_bug.cgi?id=39473 + + * WebKit.gyp: + Add net and webkit resources for Windows. + Copy AHEM____.TTF to DumpRenderTree.exe directory. + +2010-05-21 Steve Block <steveblock@google.com> + + Reviewed by Jeremy Orlow. + + Add DeviceOrientation and DeviceOrientationClient + https://bugs.webkit.org/show_bug.cgi?id=39479 + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::WebViewImpl): + +2010-05-20 Viet-Trung Luu <viettrungluu@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Don't rely on focused node to route mouse events to plugins. + https://bugs.webkit.org/show_bug.cgi?id=39375 + http://crbug.com/43935 + + On mouse down, do a hit test and check if a plugin was hit. If so, then + save the node for future mouse events (until mouse up or capture lost). + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::WebViewImpl): + (WebKit::WebViewImpl::mouseDown): + (WebKit::WebViewImpl::handleInputEvent): + (WebKit::WebViewImpl::mouseCaptureLost): + * src/WebViewImpl.h: Remove m_haveMouseCapture; add m_mouseCaptureNode. + +2010-05-20 Dominic Mazzoni <dmazzoni@chromium.org> + + Reviewed by Darin Fisher. + + Add headingLevel and setFocused methods. + + https://bugs.webkit.org/show_bug.cgi?id=39238 + + * public/WebAccessibilityObject.h: + * src/WebAccessibilityObject.cpp: + (WebKit::WebAccessibilityObject::headingLevel): + (WebKit::WebAccessibilityObject::setFocused): + +2010-05-20 Zhenyao Mo <zmo@google.com> + + Reviewed by Dimitri Glazkov. + + Map RGBA4/RGB5_A1 to RGBA and RGB565 to RGB in RenderbufferStorage + https://bugs.webkit.org/show_bug.cgi?id=39077 + + * src/WebGraphicsContext3DDefaultImpl.cpp: + (WebKit::WebGraphicsContext3DDefaultImpl::renderbufferStorage): Mapping the enums. + +2010-05-20 Abhishek Arya <inferno@chromium.org> + + Reviewed by Adam Barth. + + Added method to WebSecurityOrigin for invoking + SecurityOrigin::canAccessPasswordManager. + https://bugs.webkit.org/show_bug.cgi?id=38916 + + * public/WebSecurityOrigin.h: + * src/WebSecurityOrigin.cpp: + (WebKit::WebSecurityOrigin::canAccessPasswordManager): + +2010-05-20 Darin Fisher <darin@chromium.org> + + Reviewed by Nate Chapin. + + [chromium] Provide a way to catch exceptions thrown while interacting + with a NPObject via WebBindings methods. + https://bugs.webkit.org/show_bug.cgi?id=39378 + + * public/WebBindings.h: + * src/WebBindings.cpp: + (WebKit::WebBindings::pushExceptionHandler): + (WebKit::WebBindings::popExceptionHandler): + +2010-05-20 Jian Li <jianli@chromium.org> + + Reviewed by David Levin. + + Rename GenericWorkerTask.h to CrossThreadTask.h and move it to dom directory. + https://bugs.webkit.org/show_bug.cgi?id=39135 + + * src/WebSharedWorkerImpl.cpp: + * src/WebWorkerBase.cpp: + * src/WebWorkerClientImpl.cpp: + * src/WebWorkerImpl.cpp: + +2010-05-20 Martin Robinson <mrobinson@webkit.org> + + Reviewed by Ojan Vafai. + + Expose the editing behavior setting in DRT to test all editing code paths + https://bugs.webkit.org/show_bug.cgi?id=38603 + + * public/WebSettings.h: + (WebKit::WebSettings::): Added an enum for EditingBehavior types. + * src/WebSettingsImpl.cpp: + (WebKit::WebSettingsImpl::setEditingBehavior): Added. + * src/WebSettingsImpl.h: + +2010-05-19 Vangelis Kokkevis <vangelis@chromium.org> + + Reviewed by Darin Fisher. + + Modifying WebViewImpl to support new hardware compositing for + LayerChromium layers. + https://bugs.webkit.org/show_bug.cgi?id=38783 + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::paint): + (WebKit::WebViewImpl::setIsAcceleratedCompositingActive): + (WebKit::WebViewImpl::updateRootLayerContents): + (WebKit::WebViewImpl::setRootLayerNeedsDisplay): + +2010-05-19 Tony Chang <tony@chromium.org> + + Reviewed by Kent Tamura. + + [chromium] disable spelling suggestions if spellcheck=false + https://bugs.webkit.org/show_bug.cgi?id=39402 + + This is the Chromium fix for bug 25639 that was fixed in the + other ports in r59585. + + * src/ContextMenuClientImpl.cpp: + (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems): + +2010-05-19 Darin Fisher <darin@chromium.org> + + Revert r59790 due to failing Chromium npruntime tests. + + * public/WebBindings.h: + * src/WebBindings.cpp: + +2010-05-19 Darin Fisher <darin@chromium.org> + + Reviewed by Nate Chapin. + + [chromium] Provide a way to catch exceptions thrown while interacting + with a NPObject via WebBindings methods. + https://bugs.webkit.org/show_bug.cgi?id=39378 + + * public/WebBindings.h: + * src/WebBindings.cpp: + (WebKit::WebBindings::pushExceptionHandler): + (WebKit::WebBindings::popExceptionHandler): + +2010-05-19 Dirk Pranke <dpranke@chromium.org> + + Try again to roll out r58765. + + * public/WebNotification.h: + * src/WebNotification.cpp: + +2010-05-19 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r59782. + http://trac.webkit.org/changeset/59782 + https://bugs.webkit.org/show_bug.cgi?id=39379 + + broke DRT build (Requested by dpranke on #webkit). + + * public/WebNotification.h: + * src/WebNotification.cpp: + (WebKit::WebNotification::dir): + (WebKit::WebNotification::replaceId): + +2010-05-19 Jian Li <jianli@chromium.org> + + Reviewed by Darin Fisher. + + Remove obsolete ChromiumBridge code that routes FileSystem calls to WebKitClient. + https://bugs.webkit.org/show_bug.cgi?id=39332 + + * public/WebKitClient.h: + * 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): + +2010-05-19 Marcus Bulach <bulach@chromium.org> + + Reviewed by Steve Block. + + [chromium] Adds supports for layout tests using GeolocationServiceMock. + https://bugs.webkit.org/show_bug.cgi?id=39081 + + Allows injection of GeolocationServiceMock factory. + Tests: existing fast/dom/Geolocation/* + + * WebKit.gyp: + * public/WebGeolocationServiceMock.h: Added. + * src/WebGeolocationServiceMock.cpp: Added. + (WebCore::GeolocationServiceChromiumMock::create): + (WebCore::GeolocationServiceChromiumMock::GeolocationServiceChromiumMock): + (WebCore::GeolocationServiceChromiumMock::startUpdating): + (WebCore::GeolocationServiceChromiumMock::stopUpdating): + (WebCore::GeolocationServiceChromiumMock::lastPosition): + (WebCore::GeolocationServiceChromiumMock::lastError): + (WebCore::GeolocationServiceChromiumMock::geolocationServicePositionChanged): + (WebCore::GeolocationServiceChromiumMock::geolocationServiceErrorOccurred): + (WebKit::WebGeolocationServiceMock::setMockGeolocationPosition): + (WebKit::WebGeolocationServiceMock::setMockGeolocationError): + +2010-05-17 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Darin Fisher. + + Hook Chromium's WebIndexedDatabaseImpl up to IndexedDatabaseImpl + https://bugs.webkit.org/show_bug.cgi?id=39216 + + Web____Impl is for re-entering the WebKit layer from the browser layer. + Thus the previous IDBCallbacksProxy was mis-named (and should have been + WebIDBCallbacksImpl). This patch renames it and then implements the + proper proxy (which is for going from WebCore to WebKit). + + Also change using security origin strings to using WebSecurityOrigin + objects. + + This patch also implements the glue between WebIndexedDatabaseImpl and + IndexedDatabaseImpl. + + * WebKit.gyp: + * src/IDBCallbacksProxy.cpp: + (WebCore::IDBCallbacksProxy::create): + (WebCore::IDBCallbacksProxy::IDBCallbacksProxy): + (WebCore::IDBCallbacksProxy::onError): + (WebCore::IDBCallbacksProxy::onSuccess): + * src/IDBCallbacksProxy.h: + * src/IndexedDatabaseProxy.cpp: + (WebCore::IndexedDatabaseProxy::open): + * src/IndexedDatabaseProxy.h: + * src/WebIDBCallbacksImpl.cpp: Added. + (WebCore::WebIDBCallbacksImpl::WebIDBCallbacksImpl): + (WebCore::WebIDBCallbacksImpl::~WebIDBCallbacksImpl): + (WebCore::WebIDBCallbacksImpl::onError): + (WebCore::WebIDBCallbacksImpl::onSuccess): + * src/WebIDBCallbacksImpl.h: Added. + * src/WebIDBDatabaseImpl.cpp: Added. + (WebKit::WebIDBDatabaseImpl::WebIDBDatabaseImpl): + (WebKit::WebIDBDatabaseImpl::~WebIDBDatabaseImpl): + * src/WebIDBDatabaseImpl.h: Added. + * src/WebIndexedDatabaseImpl.cpp: + (WebKit::WebIndexedDatabaseImpl::WebIndexedDatabaseImpl): + (WebKit::WebIndexedDatabaseImpl::open): + * src/WebIndexedDatabaseImpl.h: + +2010-05-18 Kent Tamura <tkent@chromium.org> + + Reviewed by Dimitri Glazkov. + + [DRT/Chromium] Fix a repaint issue and textarea tests + https://bugs.webkit.org/show_bug.cgi?id=39054 + + * DEPS: Update to Chromium r47248 to use a fix for CommandLine assertion + and textAreaResizeCorner.png + * WebKit.gyp: Add textAreaResizeCorner.png as a Mac resource + +2010-05-18 Tony Chang <tony@chromium.org> + + Reviewed by Ojan Vafai. + + [chromium] ignore IME events if the keydown event was prevented + https://bugs.webkit.org/show_bug.cgi?id=37692 + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::handleCompositionEvent): + +2010-05-18 MORITA Hajime <morrita@google.com> + + Reviewed by Kent Tamura. + + [Chromium] Windows: Determinate progress bar should have glossy overlay + https://bugs.webkit.org/show_bug.cgi?id=39269 + + Changed WebThemeEngine::drawProgressBar() signature to delegate + theme implementation detail to the engine. + Chromium side will come to http://crbug.com/44430. + + No new tests, animation effect can be confirmed only manually. + + * public/WebThemeEngine.h: + (WebKit::WebThemeEngine::paintProgressBar): + * src/ChromiumBridge.cpp: + (WebCore::ChromiumBridge::paintProgressBar): + +2010-05-16 Mike Belshe <mbelshe@chromium.org> + + Reviewed by Dimitri Glazkov. + + Add a flag to the ResourceResponse for tracking if a request was + fetched via the TLS/Next-Protocol-Negotiation mechanism. + + Also cleaned up the style in ResourceResponse to group the flags + together (and alphabetically) and hopefully improve readability of + the file. + + https://bugs.webkit.org/show_bug.cgi?id=39078 + + * public/WebURLResponse.h: + * src/WebURLResponse.cpp: + (WebKit::WebURLResponse::wasNpnNegotiated): + (WebKit::WebURLResponse::setWasNpnNegotiated): + +2010-05-16 Eric Seidel <eric@webkit.org> + + Unreviewed, rolling out r59571. + http://trac.webkit.org/changeset/59571 + https://bugs.webkit.org/show_bug.cgi?id=39054 + + Broke Cr Win, but we didn't notice immediately due to + https://bugs.webkit.org/show_bug.cgi?id=38926. It's possible + that this didn't actually break Cr Win, but rather that bug + 38926 necessitates a clean compile after this and sucessive + checkins only produced a partial recompile and thus failed to + build. + + * DEPS: + * WebKit.gyp: + * features.gypi: + +2010-05-16 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r59574. + http://trac.webkit.org/changeset/59574 + https://bugs.webkit.org/show_bug.cgi?id=39176 + + Supposedly broke cr-win, but the errors seems somewhat + unrelated (Requested by abarth on #webkit). + + * public/WebURLResponse.h: + * src/WebURLResponse.cpp: + +2010-05-16 Mike Belshe <mbelshe@chromium.org> + + Reviewed by Dimitri Glazkov. + + Add a flag to the ResourceResponse for tracking if a request was + fetched via the TLS/Next-Protocol-Negotiation mechanism. + + Also cleaned up the style in ResourceResponse to group the flags + together (and alphabetically) and hopefully improve readability of + the file. + + https://bugs.webkit.org/show_bug.cgi?id=39078 + + * public/WebURLResponse.h: + * src/WebURLResponse.cpp: + (WebKit::WebURLResponse::wasNpnNegotiated): + (WebKit::WebURLResponse::setWasNpnNegotiated): + +2010-05-16 Kent Tamura <tkent@chromium.org> + + Reviewed by Dimitri Glazkov. + + [DRT/Chromium] Fix repaint, WebGL, textarea tests + https://bugs.webkit.org/show_bug.cgi?id=39054 + + * DEPS: Update to Chromium r47248 to use a fix for CommandLine assertion + and textAreaResizeCorner.png + * WebKit.gyp: Add textAreaResizeCorner.png as a Mac resource + * features.gypi: Enable ENABLE_3D_CANVAS. + +2010-05-15 Darin Fisher <darin@chromium.org> + + Reviewed by Adam Barth. + + [chromium] Expose element accessor on WebPluginContainer + https://bugs.webkit.org/show_bug.cgi?id=39152 + + * public/WebPluginContainer.h: + * src/WebPluginContainerImpl.cpp: + (WebKit::WebPluginContainerImpl::element): + * src/WebPluginContainerImpl.h: + +2010-05-15 Jochen Eisinger <jochen@chromium.org> + + Reviewed by Dmitry Titov. + + Implement canEstablishDatabase call for workers. + https://bugs.webkit.org/show_bug.cgi?id=38742 + + * public/WebCommonWorkerClient.h: + * src/DatabaseObserver.cpp: + (WebCore::DatabaseObserver::canEstablishDatabase): + * src/WebWorkerBase.cpp: + (WebKit::WebWorkerBase::allowDatabase): + (WebKit::WebWorkerBase::allowDatabaseTask): + (WebKit::WebWorkerBase::AllowDatabaseMainThreadBridge::AllowDatabaseMainThreadBridge): + (WebKit::WebWorkerBase::AllowDatabaseMainThreadBridge::cancel): + (WebKit::WebWorkerBase::AllowDatabaseMainThreadBridge::result): + (WebKit::WebWorkerBase::AllowDatabaseMainThreadBridge::signalCompleted): + (WebKit::WebWorkerBase::AllowDatabaseMainThreadBridge::didComplete): + * src/WebWorkerBase.h: + * src/WebWorkerClientImpl.h: + (WebKit::WebWorkerClientImpl::allowDatabase): + +2010-05-15 Jay Civelli <jcivelli@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Adding a notification on WebViewClient when a new + node gets focused. + https://bugs.webkit.org/show_bug.cgi?id=38508 + + * public/WebViewClient.h: + (WebKit::WebViewClient::focusedNodeChanged): + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::focusedNodeChanged): + +2010-05-15 Evan Stade <estade@chromium.org> + + Reviewed by Adam Barth. + + [chromium] "Check spelling in this field" context menu item always checked + https://bugs.webkit.org/show_bug.cgi?id=39018 + + Initialize all POD members of WebContextMenuData in a default + constructor. + + No tests because this code would need some major refactoring to unit + test, and AFAICT it's not testable via layout tests. See note at top + of getCustomMenuFromDefaultItems. + + * public/WebContextMenuData.h: + (WebKit::WebContextMenuData::WebContextMenuData): + * src/ContextMenuClientImpl.cpp: + (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems): + +2010-05-14 Darin Fisher <darin@chromium.org> + + Reviewed by Dimitri Glazkov. + + [chromium] Remove temporary relative include paths + https://bugs.webkit.org/show_bug.cgi?id=38776 + + * public/WebPasswordAutocompleteListener.h: + * src/FrameLoaderClientImpl.h: + * src/PlatformMessagePortChannel.h: + * src/WebAnimationControllerImpl.h: + * src/WebBindings.cpp: + * src/WebDataSourceImpl.h: + * src/WebDevToolsAgentPrivate.h: + * src/WebFileChooserCompletionImpl.h: + * src/WebFrameImpl.h: + * src/WebInputEventConversion.h: + * src/WebPluginContainerImpl.h: + * src/WebPluginLoadObserver.h: + * src/WebPopupMenuImpl.h: + * src/WebSettingsImpl.h: + * src/WebViewImpl.h: + * src/WebWorkerClientImpl.h: + * src/WrappedResourceRequest.h: + * src/WrappedResourceResponse.h: + +2010-05-14 Anton Muhin <antonm@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Consider implementing addOriginAccessWhitelistEntry method + https://bugs.webkit.org/show_bug.cgi?id=37578 + + Remove deprecated methods. + + * public/WebSecurityPolicy.h: + * src/WebSecurityPolicy.cpp: + +2010-05-14 Kenneth Russell <kbr@google.com> + + Reviewed by Darin Adler. + + Rename WebGLArray types to TypedArray types + https://bugs.webkit.org/show_bug.cgi?id=39091 + + Extended functionality of do-webcore-rename script and used it to + rename the WebGLArray types to the TypedArray naming convention. + The only source files which were touched by hand, and which are + being manually reviewed, are: + WebCore/page/DOMWindow.idl + WebCore/bindings/generic/RuntimeEnabledFeatures.h (script's changes undone) + WebKit/WebCore/bindings/js/JSDOMWindowCustom.cpp + WebKit/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp + These only needed to be touched to update the aliases between the + WebGLArray and TypedArray names introduced in bug 39036. (It was + not feasible to have do-webcore-rename handle this as it would + introduce circular renamings.) These aliases will be removed in + roughly a month once existing WebGL content has been updated. + + No new tests; covered under existing WebGL tests. Updated + constructed-objects-prototypes and prototype-inheritance-2 tests. + Ran all layout tests in Safari and all WebGL tests in Chromium. + + * src/GraphicsContext3D.cpp: + (WebCore::GraphicsContext3DInternal::bufferData): + (WebCore::GraphicsContext3DInternal::bufferSubData): + +2010-05-14 Jochen Eisinger <jochen@chromium.org> + + Reviewed by Eric Seidel. + + Make ImageDiff depend on webkit (again). + https://bugs.webkit.org/show_bug.cgi?id=39000 + + * WebKit.gyp: + +2010-05-14 James Simonsen <simonjam+webkit@google.com> + + Reviewed by Darin Fisher. + + [chromium] Expose volume through WebMediaPlayerClient + https://bugs.webkit.org/show_bug.cgi?id=38947 + + * public/WebMediaPlayerClient.h: + * src/WebMediaPlayerClientImpl.cpp: + (WebKit::WebMediaPlayerClientImpl::volume): + * src/WebMediaPlayerClientImpl.h: + +2010-05-14 Tony Gentilcore <tonyg@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Update chromium port to send/receive cached metadata + https://bugs.webkit.org/show_bug.cgi?id=38665 + + * public/WebKitClient.h: + (WebKit::WebKitClient::cacheMetadata): + * public/WebURLLoaderClient.h: + (WebKit::WebURLLoaderClient::didReceiveCachedMetadata): + * public/WebURLResponse.h: + * src/ChromiumBridge.cpp: + (WebCore::ChromiumBridge::cacheMetadata): + * src/ResourceHandle.cpp: + (WebCore::ResourceHandleInternal::didReceiveCachedMetadata): + (WebCore::ResourceHandle::cacheMetadata): + * src/WebURLResponse.cpp: + (WebKit::WebURLResponse::responseTime): + (WebKit::WebURLResponse::setResponseTime): + +2010-05-13 Tony Chang <tony@chromium.org> + + Reviewed by Kent Tamura. + + [chromium] enable DRT build in chromium (for the last time) + https://bugs.webkit.org/show_bug.cgi?id=39109 + + * WebKit.gyp: + +2010-05-13 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: main inspector toolbar takes noticeable time to expand. + + https://bugs.webkit.org/show_bug.cgi?id=39013 + + * src/js/DevTools.js: + (devtools.domContentLoaded): + +2010-05-12 Hans Wennborg <hans@chromium.org> + + Reviewed by Jeremy Orlow. + + [Chromium] Remove transitional functions from WebStorageNamespace and WebViewClient. + https://bugs.webkit.org/show_bug.cgi?id=38985 + + These functions are no longer called as of Chromium revision 47020. + This is part of resolving http://crbug.com/42740 + + * public/WebStorageNamespace.h: + * public/WebViewClient.h: + (WebKit::WebViewClient::createSessionStorageNamespace): + +2010-05-12 Tony Chang <tony@chromium.org> + + Reviewed by Kent Tamura. + + [chromium] disable DRT in chromium again + https://bugs.webkit.org/show_bug.cgi?id=39049 + + * WebKit.gyp: + +2010-05-12 John Abd-El-Malek <jam@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Disable WebScrollbarImpl's scrollbar if it's not needed + https://bugs.webkit.org/show_bug.cgi?id=39025 + + * src/WebScrollbarImpl.cpp: + (WebKit::WebScrollbarImpl::setLocation): + (WebKit::WebScrollbarImpl::setDocumentSize): + +2010-05-12 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by Dimitri Glazkov. + + Removing the unnecessary dirfd parameter. + https://bugs.webkit.org/show_bug.cgi?id=38869 + + * public/WebKitClient.h: + (WebKit::WebKitClient::databaseOpenFile): + * src/ChromiumBridge.cpp: + (WebCore::ChromiumBridge::databaseOpenFile): + +2010-05-12 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Steve Block. + + [Chromium] Pass the origin parameter for WebIndexedDatabase::open + https://bugs.webkit.org/show_bug.cgi?id=38983 + + * public/WebIndexedDatabase.h: + * src/IndexedDatabaseProxy.cpp: + (WebCore::IndexedDatabaseProxy::open): + * src/WebIndexedDatabaseImpl.cpp: + (WebKit::WebIndexedDatabaseImpl::open): + * src/WebIndexedDatabaseImpl.h: + +2010-05-10 yael aharon <yael.aharon@nokia.com> + + Reviewed by Darin Adler. + + Support control attribute of HTMLLabelElement + https://bugs.webkit.org/show_bug.cgi?id=38688 + + Renamed HTMLLabelElement::correspondingControl to HTMLLabelElement::control + + * src/WebLabelElement.cpp: + (WebKit::WebLabelElement::correspondingControl): + +2010-05-12 MORITA Hajime <morrita@google.com> + + Reviewed by Kent Tamura. + + [Chromium] Support HTML5 <progress> element on Windows. + https://bugs.webkit.org/show_bug.cgi?id=37308 + + Extended ChromiumBridge to handle progress bar painting, + and added delegations to it. + + No new tests. Test cases should be shared with existing ones for + progress element. Expectaions will be added after PROGRESS_TAG is + enabled on Chromium tree. + + * public/WebThemeEngine.h: + (WebKit::WebThemeEngine::paintProgressBar): + * src/ChromiumBridge.cpp: + (WebCore::ChromiumBridge::paintProgressBar): + +2010-05-12 Marcus Bulach <bulach@chromium.org> + + Reviewed by Steve Block. + + Attaches the geolocation bridge later on startUpdating(). + This prevents a page requesting permission when it has just accessed navigator.geolocation (without calling navigator.geolocation.getCurrentPosition/watchPosition). + Note: when Geolocation::haveSuitableCachedPosition(), WebGeolocationServiceBridgeImpl::startUpdating() is not called, + so we attach the bridge if needed at requestGeolocationPermissionForFrame(). + https://bugs.webkit.org/show_bug.cgi?id=38323 + http://crbug.com/42789 + + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::requestGeolocationPermissionForFrame): + * src/WebGeolocationServiceBridgeImpl.cpp: + (WebKit::WebGeolocationServiceBridgeImpl::attachBridgeIfNeeded): + (WebKit::WebGeolocationServiceBridgeImpl::setLastPosition): + +2010-05-12 Tony Chang <tony@chromium.org> + + Reviewed by Kent Tamura. + + [chromium] add DRT back to the chromium build + https://bugs.webkit.org/show_bug.cgi?id=38978 + + * WebKit.gyp: + +2010-05-11 Kent Tamura <tkent@chromium.org> + + Reviewed by Dimitri Glazkov. + + [DRT/Chromium] Apply recent changes of test_shell to DRT + https://bugs.webkit.org/show_bug.cgi?id=38895 + + * DEPS: Update Chromium revision to use the recent webkit_support change. + * WebKit.gyp: Add JavaScriptCore/wtf to 'include' section. + * src/WebGraphicsContext3D.cpp: + Remove ENABLE(3D_CANVAS) to provide an empty implementation of + WebGraphicsContext3D::createDefault(). + +2010-05-11 Avi Drissman <avi@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Pipe RTL info into WebPopupMenuInfo + https://bugs.webkit.org/show_bug.cgi?id=38749 + + * public/WebPopupMenuInfo.h: + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::getPopupMenuInfo): + +2010-05-11 David Holloway <dhollowa@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Add size method to WebInputElement class, providing same data + as HTMLInputElement::size(). During form AutoFill Chromium needs to + access the input element's size attribute in aid of form matching and + filling heuristics. + + https://bugs.webkit.org/show_bug.cgi?id=38825 + + * public/WebInputElement.h: + * src/WebInputElement.cpp: + (WebKit::WebInputElement::size): + +2010-05-11 Nate Chapin <japhet@chromium.org> + + Reviewed by Adam Barth. + + Crash fix in WebPageSerializerImpl::serialize(). + + https://bugs.webkit.org/show_bug.cgi?id=38543 + + The relevant test is a test_shell_test in src.chromium.org, because neither + DRT nor the Chromium webkit unit tests can currently cover the serializer + functionality. + + * src/WebPageSerializerImpl.cpp: + (WebKit::WebPageSerializerImpl::serialize): Check each frame's url before using it, + since they are not guaranteed to be valid (e.g., if the frame was treated as a download). + +2010-05-11 Jian Li <jianli@chromium.org> + + Reviewed by Dmitry Titov. + + Expose FileReader interface. + https://bugs.webkit.org/show_bug.cgi?id=38609 + + * features.gypi: turn on building FileReader for Chromium. + +2010-05-10 Tony Chang <tony@chromium.org> + + Reviewed by Kent Tamura. + + [chromium] don't build DRT in chromium checkouts due to a circular gyp dependency + https://bugs.webkit.org/show_bug.cgi?id=38889 + + * WebKit.gyp: + +2010-05-10 John Abd-El-Malek <jam@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Add WebKitScrollbar interface to allow Chromium code to reuse the scrollbar code + https://bugs.webkit.org/show_bug.cgi?id=38854 + + * public/WebScrollbar.h: Added. + (WebKit::WebScrollbar::): + (WebKit::WebScrollbar::~WebScrollbar): + * public/WebScrollbarClient.h: Added. + * public/WebThemeEngine.h: + * src/AssertMatchingEnums.cpp: + * src/WebScrollbarImpl.cpp: Added. + (WebKit::WebScrollbar::create): + (WebKit::WebScrollbar::defaultThickness): + (WebKit::WebScrollbarImpl::WebScrollbarImpl): + (WebKit::WebScrollbarImpl::~WebScrollbarImpl): + (WebKit::WebScrollbarImpl::setLocation): + (WebKit::WebScrollbarImpl::value): + (WebKit::WebScrollbarImpl::setValue): + (WebKit::WebScrollbarImpl::setDocumentSize): + (WebKit::WebScrollbarImpl::scroll): + (WebKit::WebScrollbarImpl::paint): + (WebKit::WebScrollbarImpl::handleInputEvent): + (WebKit::WebScrollbarImpl::onMouseDown): + (WebKit::WebScrollbarImpl::onMouseUp): + (WebKit::WebScrollbarImpl::onMouseMove): + (WebKit::WebScrollbarImpl::onMouseLeave): + (WebKit::WebScrollbarImpl::onMouseWheel): + (WebKit::WebScrollbarImpl::onKeyDown): + (WebKit::WebScrollbarImpl::valueChanged): + (WebKit::WebScrollbarImpl::invalidateScrollbarRect): + (WebKit::WebScrollbarImpl::isActive): + (WebKit::WebScrollbarImpl::scrollbarCornerPresent): + (WebKit::WebScrollbarImpl::getTickmarks): + * src/WebScrollbarImpl.h: Added. + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::scrollViewWithKeyboard): + (WebKit::WebViewImpl::mapKeyCodeForScroll): + * src/WebViewImpl.h: + +2010-05-10 Tony Gentilcore <tonyg@chromium.org> + + Reviewed by Adam Barth. + + Provide mechanism to cache metadata for a resource + https://bugs.webkit.org/show_bug.cgi?id=37874 + + * src/ResourceHandle.cpp: + (WebCore::ResourceHandle::cacheMetadata): + +2010-05-10 Hans Wennborg <hans@chromium.org> + + Reviewed by Jeremy Orlow. + + [Chromium] Add quota parameter to WebViewClient::createSessionStorageNamespace() + https://bugs.webkit.org/show_bug.cgi?id=38750 + + Put a per-origin quota on session storage since it is using memory in + the browser process, and should not be allowed to grow arbitrarily + large. See also http://trac.webkit.org/changeset/58828. + + * public/WebStorageNamespace.h: + * public/WebViewClient.h: + (WebKit::WebViewClient::createSessionStorageNamespace): + * src/StorageNamespaceProxy.cpp: + (WebCore::StorageNamespace::sessionStorageNamespace): + + +2010-05-10 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Nate Chapin. + + Change IndexedDB to use events instead of callbacks + https://bugs.webkit.org/show_bug.cgi?id=38594 + + Change the glue here to match the changes I made in WebCore. + + * WebKit.gyp: + * public/WebIDBCallbacks.h: + * public/WebIndexedDatabase.h: + * src/IDBCallbacksProxy.cpp: Added. + (WebCore::IDBCallbacksProxy::IDBCallbacksProxy): + (WebCore::IDBCallbacksProxy::~IDBCallbacksProxy): + (WebCore::IDBCallbacksProxy::onError): + (WebCore::IDBCallbacksProxy::onSuccess): + * src/IDBCallbacksProxy.h: + * src/IndexedDatabaseProxy.cpp: + (WebCore::IndexedDatabaseProxy::open): + * src/IndexedDatabaseProxy.h: + * src/WebIndexedDatabaseImpl.cpp: + (WebKit::WebIndexedDatabaseImpl::open): + * src/WebIndexedDatabaseImpl.h: + +2010-05-08 Jens Alfke <snej@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] WebFrame::registerPasswordListener shouldn't assert on duplicate listener. + https://bugs.webkit.org/show_bug.cgi?id=38765 + + * public/WebFrame.h: + (WebKit::WebFrameImpl::registerPasswordListener): Changed return type to bool. Updated comment. + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::registerPasswordListener): Return false instead of asserting. + * src/WebFrameImpl.h: + (WebKit::WebFrameImpl::registerPasswordListener): Changed return type to bool. + +2010-05-08 Michael Nordman <michaeln@google.com> + + Reviewed by Dmitry Titov. + + Add an additional parameter to the WebSharedWorker::startWorkerContext method + to indicate which appcache the shared worker script resource was loaded from, + and provide that value when calling out to chrome via this interface. + https://bugs.webkit.org/show_bug.cgi?id=38605 + + I'm keeping the old method around until patches can land in both repositories + that make the old method obsolete and unneeded. There's a FIXME for that. + + Also somewhat related but independent change to propagate the runtime enabled + flag thru to the page settings instance used by the 'shadow page'. + + * public/WebSharedWorker.h: Add the new param (but keep the old interface around for now too) + (WebKit::WebSharedWorker::startWorkerContext): + * src/SharedWorkerRepository.cpp: Provide the value when calling out to chrome. + (WebCore::SharedWorkerScriptLoader::notifyFinished): + * src/WebSharedWorkerImpl.cpp: + (WebKit::WebSharedWorkerImpl::startWorkerContext): + * src/WebSharedWorkerImpl.h: + * src/WebWorkerBase.cpp: Propagate runtime enabled flag thru to the page settings. + (WebKit::WebWorkerBase::initializeLoader): + +2010-05-07 Darin Fisher <darin@chromium.org> + + Fix build bustage. Update to Chromium code that avoids a bad + dependency from net/ on chrome/. + + * DEPS: + +2010-05-07 Darin Fisher <darin@chromium.org> + + Fix build bustage. Update to Chromium code that no longer uses + deprecated methods. + + * DEPS: + +2010-05-07 Darin Fisher <darin@chromium.org> + + Reviewed by Dimitri Glazkov. + + [chromium] clear out more deprecated methods that are no longer used + https://bugs.webkit.org/show_bug.cgi?id=38702 + + * public/WebFrame.h: + * public/WebNode.h: + * src/WebFrameImpl.cpp: + * src/WebFrameImpl.h: + * src/WebNode.cpp: + +2010-05-07 Finnur Thorarinsson <finnur.webkit@gmail.com> + + Reviewed by Dimitri Glazkov. + + [chromium]: Fixing Find in page crash on sites.google.com + https://bugs.webkit.org/show_bug.cgi?id=38591 + + setMarkerActive should not try to set a collapsed marker as + active. This can happen when you Edit a Sites page after doing + a Find operation and then you press FindNext. + + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::setMarkerActive): + +2010-05-06 Kent Tamura <tkent@chromium.org> + + Reviewed by Dimitri Glazkov. + + [DRT/Chromium] Add support for resources on Mac + https://bugs.webkit.org/show_bug.cgi?id=38637 + + * DEPS: Check out tools/data_pack. + +2010-05-06 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Chromium Dev Tools: Large toolbar icons flash when dev + tools is opened in docked mode. + + https://bugs.webkit.org/show_bug.cgi?id=38631 + + * src/js/DevTools.js: + (devtools.domContentLoaded): + +2010-05-06 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + drop support for sessionStorage in sandbox iframes + https://bugs.webkit.org/show_bug.cgi?id=38151 + + Update client of sessionStorage to handle exceptions. + + * src/StorageAreaProxy.cpp: + (WebCore::StorageAreaProxy::storageEvent): + +2010-05-05 Darin Fisher <darin@chromium.org> + + Reviewed by Dimitri Glazkov. + + [chromium] clear out deprecated methods that are no longer used + https://bugs.webkit.org/show_bug.cgi?id=38610 + + * public/WebFormElement.h: + * public/WebInputElement.h: + * public/WebKitClient.h: + * public/WebView.h: + * public/WebViewClient.h: + (WebKit::WebViewClient::createPopupMenu): + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::popupOpened): + * src/WebFormElement.cpp: + * src/WebInputElement.cpp: + (WebKit::WebInputElement::setSelectionRange): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::hideSuggestionsPopup): + * src/WebViewImpl.h: + +2010-05-05 Hans Wennborg <hans@chromium.org> + + Reviewed by Jeremy Orlow. + + [chromium] Add quota parameter to WebStorageNamespace::createSessionStorageNamespace + https://bugs.webkit.org/show_bug.cgi?id=38589 + + * public/WebStorageNamespace.h: + (WebKit::WebStorageNamespace::createSessionStorageNamespace): + * src/WebStorageNamespaceImpl.cpp: + (WebKit::WebStorageNamespace::createSessionStorageNamespace): + +2010-05-05 Stuart Morgan <stuartmorgan@chromium.org> + + Reviewed by Darin Fisher. + + Update the plugin container's setFocus implementation to pass the new + boolean argument to the next layer. + + https://bugs.webkit.org/show_bug.cgi?id=37961 + + * src/WebPluginContainerImpl.cpp: + (WebKit::WebPluginContainerImpl::setFocus): + * src/WebPluginContainerImpl.h: + +2010-05-04 Vangelis Kokkevis <vangelis@chromium.org> + + Reviewed by Darin Fisher. + + Provide an API for querying whether a WebWidget is using gpu accelerated compositing. + Also changed: isAcceleratedCompositing to: isAcceleratedCompositingActive. + https://bugs.webkit.org/show_bug.cgi?id=38220 + + * public/WebWidget.h: + * src/WebPopupMenuImpl.h: + (WebKit::WebPopupMenuImpl::isAcceleratedCompositingActive): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::WebViewImpl): + (WebKit::WebViewImpl::paint): + (WebKit::WebViewImpl::isAcceleratedCompositingActive): + (WebKit::WebViewImpl::setRootGraphicsLayer): + (WebKit::WebViewImpl::setIsAcceleratedCompositingActive): + (WebKit::WebViewImpl::updateRootLayerContents): + * src/WebViewImpl.h: + +2010-04-29 John Gregg <johnnyg@google.com> + + Reviewed by Dmitry Titov. + + notifications should have dir and replaceId attributes + https://bugs.webkit.org/show_bug.cgi?id=38336 + + * public/WebNotification.h: + * src/WebNotification.cpp: + (WebKit::WebNotification::dir): + (WebKit::WebNotification::replaceId): + +2010-05-04 Jay Civelli <jcivelli@chromium.org> + + Reviewed by David Levin. + + [chromium] Make the select popup not close on right/middle clicks. + https://bugs.webkit.org/show_bug.cgi?id=38473 + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::mouseDown): + +2010-05-03 Abhishek Arya <inferno@chromium.org> + + Reviewed by Adam Barth. + + Add support for controlling clipboard access from javascript. + Clipboard access from javascript is disabled by default. + https://bugs.webkit.org/show_bug.cgi?id=27751 + + * public/WebSettings.h: + * src/WebSettingsImpl.cpp: + (WebKit::WebSettingsImpl::setJavaScriptCanAccessClipboard): + * src/WebSettingsImpl.h: + +2010-05-03 Jens Alfke <snej@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Add "willSendSubmitEvent" hook to WebFrameClient and FrameLoaderClient + https://bugs.webkit.org/show_bug.cgi?id=38397 + + No tests (functionality is exposed only through native WebKit API.) + + * public/WebFrameClient.h: + (WebKit::WebFrameClient::willSendSubmitEvent): New empty method + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::dispatchWillSendSubmitEvent): Delegate to client + * src/FrameLoaderClientImpl.h: + +2010-05-02 Michael Nordman <michaeln@google.com> + + Reviewed by Dmitry Titov. + + Define two new ResourceRequestBase TargetTypes for worker and shared worker + main resources. Use the new target types where appropiate. Add logic to marshal + the target type specified by requests initiated on a background worker thread. + + https://bugs.webkit.org/show_bug.cgi?id=38295 + + * src/SharedWorkerRepository.cpp: use TargetIsSharedWorker + (WebCore::SharedWorkerScriptLoader::SharedWorkerScriptLoader): + +2010-05-02 Rafael Weinstein <rafaelw@chromium.org> + + Reviewed by Darin Fisher. + + Include WebWindowFeatures in call to WebViewClient::createView. + https://bugs.webkit.org/show_bug.cgi?id=38301 + + * public/WebViewClient.h: + (WebKit::WebViewClient::createView): + * public/WebWindowFeatures.h: + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::createWindow): + +2010-05-01 Evan Stade <estade@chromium.org> + + Reviewed by David Levin + + [chromium] Skia needs to fade DragImages + https://bugs.webkit.org/show_bug.cgi?id=38008 + + * tests/DragImageTest.cpp: + (DragImageTest.CreateDragImage): test that the drag image is a deep copy + +2010-04-30 Jian Li <jianli@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Add WebFileSystem interface and hook up with all FileSystem methods. + https://bugs.webkit.org/show_bug.cgi?id=38228 + + * WebKit.gyp: + * public/WebFileSystem.h: Added. + * public/WebKitClient.h: + (WebKit::WebKitClient::fileSystem): + * 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-04-29 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Darin Fisher. + + Change StorageEvent.uri to StorageEvent.url to match the spec + https://bugs.webkit.org/show_bug.cgi?id=38331 + + Get rid of a stale FIXME and combine 2 lines that needn't be split. + + * src/StorageEventDispatcherImpl.cpp: + (WebCore::StorageEventDispatcherImpl::dispatchStorageEvent): + +2010-04-29 Anton Muhin <antonm@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Consider implementing addOriginAccessWhitelistEntry method + http://trac.webkit.org/changeset/57537 introduced a new method + to manage whitelisting of origins. + Expose this method in Chromium's bridge. + https://bugs.webkit.org/show_bug.cgi?id=37578 + + * public/WebSecurityPolicy.h: Start renaming (keep old function names) and add new removeOriginAccessWhitelistEntry method + * src/WebSecurityPolicy.cpp: Start renaming (keep old function names) and add new removeOriginAccessWhitelistEntry method + +2010-04-29 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r58498. + http://trac.webkit.org/changeset/58498 + https://bugs.webkit.org/show_bug.cgi?id=38332 + + "Broke a bunch of tests on Chromium canaries" (Requested by + dglazkov on #webkit). + + * public/WebViewClient.h: + (WebKit::WebViewClient::createView): + * public/WebWindowFeatures.h: + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::createWindow): + +2010-04-29 Adam Langley <agl@chromium.org> + + Unreviewed, DEPS roll. + + WebKit's r58517 needs OTS's r30 which was rolled into Chromium in + r45932. + + * DEPS: + Use Chromium r45932. + +2010-04-29 Rafael Weinstein <rafaelw@chromium.org> + + Reviewed by Darin Fisher. + + Include WindowFeatures in call to WebViewClient::createView. + + https://bugs.webkit.org/show_bug.cgi?id=38301 + + * public/WebViewClient.h: + (WebKit::WebViewClient::createView): + * public/WebWindowFeatures.h: + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::createWindow): + +2010-04-29 Garret Kelly <gdk@chromium.org> + + Reviewed by Darin Fisher. + + Expose the RuntimeFeature for touch events through the + WebRuntimeFeatures mechanism. + https://bugs.webkit.org/show_bug.cgi?id=37486 + + * public/WebRuntimeFeatures.h: + * src/WebRuntimeFeatures.cpp: + (WebKit::WebRuntimeFeatures::enableTouch): + (WebKit::WebRuntimeFeatures::isTouchEnabled): + +2010-04-29 Zhenyao Mo <zmo@google.com> + + Reviewed by Dimitri Glazkov. + + Remove the unnecessary texImage2D function with Image as input in GraphicsContext3D + https://bugs.webkit.org/show_bug.cgi?id=38235 + + * src/GraphicsContext3D.cpp: Remove tex*image implementation with Image input. + +2010-04-28 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: Allow editing script resources when resource tracking is enabled. + + http://bugs.webkit.org/show_bug.cgi?id=38269 + + * src/js/DebuggerAgent.js: + * src/js/InspectorControllerImpl.js: + (.devtools.InspectorBackendImpl.prototype.setBreakpoint): + (.devtools.InspectorBackendImpl.prototype.editScriptSource): + +2010-04-28 Darin Fisher <darin@chromium.org> + + Reviewed by David Levin. + + [Chromium] callOnMainThread should equate to MessageLoop::PostTask + https://bugs.webkit.org/show_bug.cgi?id=38276 + + * public/WebKitClient.h: + (WebKit::WebKitClient::callOnMainThread): + * src/ChromiumThreading.cpp: + (WTF::ChromiumThreading::callOnMainThread): + +2010-04-27 John Abd-El-Malek <jam@chromium.org> + + Reviewed by Darin Fisher. + + Make WebThemeEngine::paint take a const ref of ExtraParams + https://bugs.webkit.org/show_bug.cgi?id=38242 + + * public/WebThemeEngine.h: + (WebKit::WebThemeEngine::paint): + +2010-04-28 Andrey Kosyakov <caseq@chromium.org> + + Reviewed by Pavel Feldman. + + Fixed passing breakpoints to V8. + https://bugs.webkit.org/show_bug.cgi?id=38266 + + * src/js/InspectorControllerImpl.js: + (.devtools.InspectorBackendImpl.prototype.setBreakpoint): + +2010-04-28 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Support pause on exceptions in v8 implementation of ScriptDebugServer. + + https://bugs.webkit.org/show_bug.cgi?id=38205 + + * src/js/DebuggerScript.js: + (debuggerScriptConstructor.DebuggerScript.getScripts): + (debuggerScriptConstructor.DebuggerScript.pauseOnExceptionsState): + (debuggerScriptConstructor.DebuggerScript.setPauseOnExceptionsState): + (debuggerScriptConstructor.DebuggerScript._v8ToWebkitLineNumber): + (debuggerScriptConstructor): + +2010-04-27 Jens Alfke <snej@chromium.org> + + Reviewed by Eric Seidel. + + [chromium] Fix bug that prevents autosave of forms without action attribute + https://bugs.webkit.org/show_bug.cgi?id=38014 + Change is in the Chromium WebKit API so it can't be tested with a JS-based layout test. + It needs a native unit test, which would go in the Chromium repo, not WebKit. + + * src/WebPasswordFormData.cpp: + (WebKit::WebPasswordFormData::WebPasswordFormData): Set correct URL if action is NULL + +2010-04-27 Michael Nordman <michaeln@google.com> + + Reviewed by Dmitry Titov. + + [Chromium] Add two things to the webkit API to support appcaches in workers. + 1) WebURLRequest TargetTypes for worker and shared worker main resources. + 2) Factory method on class WebCommonWorkerClient to + createApplicationCacheHost() for the associated worker. + + https://bugs.webkit.org/show_bug.cgi?id=38147 + + * public/WebCommonWorkerClient.h: add the factory method + * public/WebURLRequest.h: add the TargetTypes + * src/WebWorkerBase.cpp: call the embedder's factory when needed + (WebKit::WebWorkerBase::didCreateDataSource) + (WebKit::WebWorkerBase::createApplicationCacheHost) + * src/WebWorkerBase.h: ditto + * src/WebWorkerClientImpl.h: add a stub impl of the factory method + (WebKit::WebWorkerClientImpl::createApplicationCacheHost): + +2010-04-27 Kent Tamura <tkent@chromium.org> + + Reviewed by Shinichiro Hamaji. + + [DRT/Chromium] Enable Windows project generation + https://bugs.webkit.org/show_bug.cgi?id=38103 + + - Avoid platform.system(), which causes a crash with python.exe in + depot_tools. Use sys.platform instead. + - Process DumpRenderTree.gyp on all platforms. + + * gyp_webkit: + +2010-04-27 Jay Civelli <jcivelli@chromium.org> + + Reviewed by Darin Fisher. + + Makes clicking a select element close its associated popup if + it is open. + https://bugs.webkit.org/show_bug.cgi?id=38105 + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::mouseDown): + +2010-04-27 Jay Civelli <jcivelli@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Merged the WebView public method to close suggestion popups + into a single method to close all popups (select and suggestions). + That ensures select popups are closed when the browser window is moved + or resized. + https://bugs.webkit.org/show_bug.cgi?id=37837 + + * public/WebView.h: + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::hidePopups): + (WebKit::WebViewImpl::hideSuggestionsPopup): + * src/WebViewImpl.h: + +2010-04-27 John Abd-El-Malek <jam@chromium.org> + + Reviewed by Darin Adler. + + Remove unnecessary header now that Chrome is updated + https://bugs.webkit.org/show_bug.cgi?id=38211 + + * public/win/WebThemeEngine.h: Removed. + +2010-04-27 Jens Alfke <snej@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Add some notifications and an accessor to WebKit API + https://bugs.webkit.org/show_bug.cgi?id=37625 + + * public/WebFrameClient.h: + (WebKit::WebFrameClient::didFirstLayout): + (WebKit::WebFrameClient::didFirstVisuallyNonEmptyLayout): + * public/WebNode.h: + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::dispatchDidFirstLayout): + (WebKit::FrameLoaderClientImpl::dispatchDidFirstVisuallyNonEmptyLayout): + * src/WebElement.cpp: + * src/WebNode.cpp: + (WebKit::WebNode::hasNonEmptyBoundingBox): + +2010-04-27 Darin Fisher <darin@chromium.org> + + Reviewed by Dimitri Glazkov. + + [Chromium] Remove deprecated form of didChangeLocationWithinPage + https://bugs.webkit.org/show_bug.cgi?id=38178 + + * public/WebFrameClient.h: + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::dispatchDidNavigateWithinPage): + +2010-04-27 Evan Martin <evan@chromium.org> + + Reviewed by David Levin. + + [chromium] bold bengali text not rendered properly on Linux + Roll forward Chrome DEPS so we get new Skia API. + + * DEPS: update Chrome to r45696. + +2010-04-27 Andrey Kosyakov <caseq@chromium.org> + + Reviewed by Pavel Feldman. + + Restore breakpoints associated with script's URL once + script is parsed. + https://bugs.webkit.org/show_bug.cgi?id=38132 + + * src/js/DebuggerAgent.js: + (devtools.DebuggerAgent.prototype.initUI): + (devtools.DebuggerAgent.prototype.addBreakpoint): + (devtools.DebuggerAgent.prototype.addScriptInfo_): + (devtools.DebuggerAgent.prototype.restoreBreakpoints_): + (devtools.BreakpointInfo): + (devtools.BreakpointInfo.prototype.enabled): + (devtools.BreakpointInfo.prototype.condition): + +2010-04-27 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Chrome Dev Tools: Further beautify themes. + + https://bugs.webkit.org/show_bug.cgi?id=38187 + + * src/js/DevTools.js: + (WebInspector.setToolbarColors): + * src/js/devTools.css: + (body.platform-windows #toolbar, body.platform-windows.inactive #toolbar): + +2010-04-26 John Abd-El-Malek <jam@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Prepare to making WebThemeEngine cross-platform + https://bugs.webkit.org/show_bug.cgi?id=38077 + + * WebKit.gyp: + * public/WebThemeEngine.h: Added. + * public/win/WebThemeEngine.h: + +2010-04-26 Darin Fisher <darin@chromium.org> + + Reviewed by Adam Barth. + + [Chromium] Crash after calling window.print() on a window object that has been closed. + https://bugs.webkit.org/show_bug.cgi?id=38148 + + It is unfortunately not possible to write a layout test for this as the + crash occurs in an API that is only called by Chrome while showing a + print dialog. + + * src/WebViewImpl.cpp: + (WebKit::WebView::willEnterModalLoop): + (WebKit::WebView::didExitModalLoop): + +2010-04-25 Sam Weinig <sam@webkit.org> + + Reviewed by Maciej Stachowiak. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=38097 + Disentangle initializing the main thread from initializing threading + + * src/WebKit.cpp: + (WebKit::initialize): Add call to initializeMainThread. + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::WebViewImpl): Ditto. + +2010-04-26 Roman Gershman <romange@google.com> + + Reviewed by Adam Barth. + + [Chromium] Font size in suggestions popup menu should be correlated with the font size of its text field. + + https://bugs.webkit.org/show_bug.cgi?id=37977 + + * src/SuggestionsPopupMenuClient.cpp: + (WebKit::SuggestionsPopupMenuClient::initialize): + +2010-04-26 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Chromium Dev Tools: brush up images. + + https://bugs.webkit.org/show_bug.cgi?id=38124 + + * WebKit.gypi: + * src/js/DevTools.js: + (WebInspector.setToolbarColors): + * src/js/Images/segmentChromium.png: + * src/js/Images/segmentChromium2.png: Removed. + * src/js/Images/segmentHoverChromium2.png: Removed. + * src/js/Images/segmentSelectedChromium2.png: Removed. + * src/js/Images/statusbarBackgroundChromium.png: + * src/js/Images/statusbarBackgroundChromium2.png: Removed. + * src/js/Images/statusbarBottomBackgroundChromium.png: + * src/js/Images/statusbarButtonsChromium.png: + * src/js/Images/statusbarMenuButtonChromium.png: + * src/js/Images/statusbarMenuButtonChromium2.png: Removed. + * src/js/devTools.css: + (.section > .header): + (.console-group-messages .section > .header): + (#resources-filter): + (.crumbs .crumb): + (.crumbs .crumb.end): + (.crumbs .crumb.selected): + (.crumbs .crumb.selected:hover): + (.crumbs .crumb.selected.end, .crumbs .crumb.selected.end:hover): + (.crumbs .crumb:hover): + (.crumbs .crumb.dimmed:hover): + (.crumbs .crumb.end:hover): + (body.drawer-visible #main-status-bar): + (.status-bar): + (button.status-bar-item): + (select.status-bar-item:active): + (#drawer): + (select.status-bar-item): + +2010-04-23 Zhenyao Mo <zmo@google.com> + + Reviewed by Darin Fisher. + + Add isGLES2Compliant to GraphicsContext3D: make the method const. + https://bugs.webkit.org/show_bug.cgi?id=37872 + + * src/GraphicsContext3D.cpp: Make isGLES2Compliant() const. + (WebCore::GraphicsContext3DInternal::isGLES2Compliant): + (WebCore::GraphicsContext3D::isGLES2Compliant): + +2010-04-23 Rafael Weinstein <rafaelw@grafaelw.sfo.corp.google.com> + + Reviewed by Darin Fisher. + + This patch adds a WebWindowFeatures binding struct for the + chromium client in anticipation of a follow-on patch which will + pass it to WebViewClient::createWindow. + + https://bugs.webkit.org/show_bug.cgi?id=38013 + + * public/WebViewClient.h: + (WebKit::WebViewClient::createView): + * public/WebWindowFeatures.h: Added. + (WebKit::WebWindowFeatures::WebWindowFeatures): + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::createWindow): + +2010-04-22 Zhenyao Mo <zmo@google.com> + + Reviewed by Darin Fisher. + + Add isGLES2Compliant to GraphicsContext3D + https://bugs.webkit.org/show_bug.cgi?id=37872 + + * public/WebGraphicsContext3D.h: Add isGLES2Compliant(). + * src/GraphicsContext3D.cpp: Ditto. + * src/WebGraphicsContext3DDefaultImpl.cpp: Ditto. + (WebKit::WebGraphicsContext3DDefaultImpl::isGLES2Compliant): + * src/WebGraphicsContext3DDefaultImpl.h: Ditto. + +2010-04-22 Dave Moore <davemoore@chromium.org> + + Reviewed by Dimitri Glazkov. + + Added notification when the favicons for a page are changed + from a script. + The Document object will notify the frame loader, which will + notify the client. Implementations of FrameLoaderClient will + have to add one method; dispatchDidChangeIcons(). + + https://bugs.webkit.org/show_bug.cgi?id=33812 + + * public/WebFrameClient.h: + (WebKit::WebFrameClient::didChangeIcons): + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::dispatchDidChangeIcons): + * src/FrameLoaderClientImpl.h: + +2010-04-22 Zhenyao Mo <zmo@google.com> + + Reviewed by Dimitri Glazkov. + + Emulate GL_IMPLEMENTATION_COLOR_READ_FORMAT/TYPE for glGet + https://bugs.webkit.org/show_bug.cgi?id=37281 + + * src/WebGraphicsContext3DDefaultImpl.cpp: + (WebKit::WebGraphicsContext3DDefaultImpl::getIntegerv): Emulate two enums. + +2010-04-22 Adam Barth <abarth@webkit.org> + + Unreviewed, rolling out r58069. + http://trac.webkit.org/changeset/58069 + https://bugs.webkit.org/show_bug.cgi?id=27751 + + Broke compile on Windows. + + * public/WebSettings.h: + * src/WebSettingsImpl.cpp: + * src/WebSettingsImpl.h: + +2010-04-22 Tony Chang <tony@chromium.org> + + Reviewed by Shinichiro Hamaji. + + [chromium] roll chromium deps to pick up some windows build fixes + https://bugs.webkit.org/show_bug.cgi?id=37972 + + * DEPS: + +2010-04-22 Abhishek Arya <inferno@chromium.org> + + Reviewed by Adam Barth. + + Add support for controlling clipboard access from javascript. + Clipboard access from javascript is disabled by default. + https://bugs.webkit.org/show_bug.cgi?id=27751 + + * public/WebSettings.h: + * src/WebSettingsImpl.cpp: + (WebKit::WebSettingsImpl::setJavaScriptCanAccessClipboard): + * src/WebSettingsImpl.h: + +2010-04-21 Tony Chang <tony@chromium.org> + + Reviewed by Shinichiro Hamaji. + + [chromium] gyp_webkit should be executable + https://bugs.webkit.org/show_bug.cgi?id=37971 + + * gyp_webkit: Added property svn:executable. + +2010-04-21 Jay Civelli <jcivelli@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Don't notify the WebView that a popup was + opened when the popup is handled externally, as the popup + is in that case transparent to the WebView. + The notification was causing an ASSERT on Mac (where + the popup is handled externally) as there would be no + notification that the popup was closed. + https://bugs.webkit.org/show_bug.cgi?id=37825 + + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::popupOpened): + +2010-04-21 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r58028. + http://trac.webkit.org/changeset/58028 + https://bugs.webkit.org/show_bug.cgi?id=37962 + + broke the chromium build (Requested by tony^work on #webkit). + + * DEPS: + +2010-04-21 Evan Martin <evan@chromium.org> + + Unreviewed, just a dependency change. + + [chromium] roll skia forward to r538 + https://bugs.webkit.org/show_bug.cgi?id=37960 + + This will cause a bunch of pixel tests to fail due to bulleted + lists rendering slightly differently. I will grab new baselines + from the bots and check them in in a followup. + + * DEPS: + +2010-04-21 Evan Stade <estade@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Web page serializer saves tag names in upper case + https://bugs.webkit.org/show_bug.cgi?id=37940 + + Simply convert all tags to lower case. + + This is tested by chrome tests: + - save page browser tests + - encoding ui tests + - web page serializer test shell tests + + * src/WebPageSerializer.cpp: + (WebKit::WebPageSerializer::generateMetaCharsetDeclaration): + (WebKit::WebPageSerializer::generateBaseTagDeclaration): + * src/WebPageSerializerImpl.cpp: + (WebKit::WebPageSerializerImpl::openTagToString): + (WebKit::WebPageSerializerImpl::endTagToString): + +2010-04-20 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Factor DocumentWriter out of FrameLoader + https://bugs.webkit.org/show_bug.cgi?id=37175 + + Update these callsites because the method moved to DocumentWriter. + + * src/ContextMenuClientImpl.cpp: + (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems): + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::finishedLoading): + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::encoding): + (WebKit::WebFrameImpl::commitDocumentData): + * src/WebPageSerializerImpl.cpp: + (WebKit::WebPageSerializerImpl::preActionBeforeSerializeOpenTag): + (WebKit::WebPageSerializerImpl::serialize): + * src/WebSearchableFormData.cpp: + (WebCore::GetFormEncoding): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::pageEncoding): + +2010-04-20 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: add basic script editing capabilities to the front-end. + + https://bugs.webkit.org/show_bug.cgi?id=37875 + + * src/js/DebuggerAgent.js: + (devtools.DebuggerAgent.prototype.resolveScriptSource.this.requestSeqToCallback_.cmd.getSequenceNumber): + (devtools.DebuggerAgent.prototype.resolveScriptSource): + (devtools.DebuggerAgent.prototype.editScriptLine.this.requestSeqToCallback_.cmd.getSequenceNumber): + (devtools.DebuggerAgent.prototype.editScriptLine): + (devtools.DebuggerAgent.prototype.handleDebuggerOutput_): + * src/js/DevTools.js: + * src/js/InspectorControllerImpl.js: + (.devtools.InspectorBackendImpl.prototype.editScriptLine): + +2010-04-20 Kent Tamura <tkent@chromium.org> + + Reviewed by Darin Adler. + + Change a parameter type of chooseIconForFiles() + https://bugs.webkit.org/show_bug.cgi?id=37504 + + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::chooseIconForFiles): + * src/ChromeClientImpl.h: + +2010-04-20 Jay Civelli <jcivelli@chromium.org> + + Reviewed by Dimitri Glazkov. + + [chromium] Tests that pressing tab now closes the select popup. + https://bugs.webkit.org/show_bug.cgi?id=37721 + + * tests/PopupMenuTest.cpp: + (WebKit::TEST_F): + +2010-04-20 Evan Stade <estade@chromium.org> + + Reviewed by David Levin. + + [chromium] crash when dragging images + https://bugs.webkit.org/show_bug.cgi?id=37715 + + Added unit tests for DragImageChromiumSkia. + + * WebKit.gyp: + * tests/DragImageTest.cpp: Added. + (WebCore::TestImage::TestImage): + (WebCore::TestImage::~TestImage): + (WebCore::TestImage::size): + (WebCore::TestImage::nativeImageForCurrentFrame): + (WebCore::TestImage::destroyDecodedData): + (WebCore::TestImage::decodedSize): + (WebCore::TestImage::draw): + (WebCore::TEST): + +2010-04-20 Stuart Morgan <stuartmorgan@chromium.org> + + Reviewed by David Levin. + + Remove a workaround in plugin cursor setting that was obsoleted by + the change in https://bugs.webkit.org/show_bug.cgi?id=35132 + https://bugs.webkit.org/show_bug.cgi?id=37811 + + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::ChromeClientImpl): + (WebKit::ChromeClientImpl::setCursor): + (WebKit::ChromeClientImpl::setCursorForPlugin): + * src/ChromeClientImpl.h: + +2010-04-19 Ada Chan <adachan@apple.com> + + Reviewed by Jeremy Orlow. + + https://bugs.webkit.org/show_bug.cgi?id=37717 + Changes needed now that StorageNamespaceImpl::sessionStorageNamespace() and + StorageNamespace::sessionStorageNamespace() take in a quota parameter. + + * src/StorageNamespaceProxy.cpp: + (WebCore::StorageNamespace::sessionStorageNamespace): + * src/WebStorageNamespaceImpl.cpp: + (WebKit::WebStorageNamespace::createSessionStorageNamespace): + +2010-04-17 Vangelis Kokkevis <vangelis@chromium.org> + + Reviewed by Dimitri Glazkov. + + Adding the implementation of GLES2Context class which provides WebCore access to a GL ES context. + https://bugs.webkit.org/show_bug.cgi?id=37541 + + * WebKit.gyp: + * public/WebGLES2Context.h: Added. + (WebKit::WebGLES2Context::~WebGLES2Context): + * src/GLES2Context.cpp: Added. + (WebCore::GLES2ContextInternal::GLES2ContextInternal): + (WebCore::GLES2ContextInternal::~GLES2ContextInternal): + (WebCore::GLES2ContextInternal::getWebGLES2Context): + (WebCore::GLES2ContextInternal::initialize): + (WebCore::GLES2Context::create): + (WebCore::GLES2Context::~GLES2Context): + (WebCore::GLES2Context::initialize): + (WebCore::GLES2Context::makeCurrent): + (WebCore::GLES2Context::destroy): + (WebCore::GLES2Context::swapBuffers): + +2010-04-16 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by Eric Seidel. + + Get rid of the UNUSED_PARAM macro in GraphicsContext3D.cpp. + https://bugs.webkit.org/show_bug.cgi?id=37733 + + * src/GraphicsContext3D.cpp: + (WebCore::GraphicsContext3D::GraphicsContext3D): + +2010-04-16 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by Jeremy Orlow. + + Changing the return type of WebSecurityOrigin::createFromDatabaseIdentifier(). + https://bugs.webkit.org/show_bug.cgi?id=34466 + + Changing the return type of + WebSecurityOrigin::createFromDatabaseIdentifier() from + WebSecurityOrigin* to WebSecurityOrigin, to make it more + consistent with the other WebSecurityOrigin methods. + + * public/WebSecurityOrigin.h: + * src/WebDatabase.cpp: + (WebKit::WebDatabase::closeDatabaseImmediately): + * src/WebSecurityOrigin.cpp: + (WebKit::WebSecurityOrigin::createFromDatabaseIdentifier): + +2010-04-16 Dmitry Titov <dimich@chromium.org> + + Reviewed by Yury Semikhatsky. + + [v8] In Workers, script errors right after close() are not delivered to the Worker.onerror + https://bugs.webkit.org/show_bug.cgi?id=37691 + + * src/WebWorkerClientImpl.cpp: + (WebKit::WebWorkerClientImpl::createWorkerContextProxy): Don't need to pull V8 proxy to retrieve current WorkerContext. + +2010-04-16 Albert J. Wong <ajwong@chromium.org> + + Not reviewed. Build fix. + + [chromium] Compile fix. Missing include header, and missing type conversion. + + * src/GraphicsContext3D.cpp: + (WebCore::GraphicsContext3DInternal::beginPaint): + +2010-04-16 Jarkko Sakkinen <jarkko.j.sakkinen@gmail.com> + + Reviewed by Simon Hausmann. + + [Qt] WebGL is not visible when QGLWidget viewport is used + https://bugs.webkit.org/show_bug.cgi?id=37070 + + Added HostWindow parameter to the constructor of GraphicsContext3D. + Shared OpenGL context is initialized with parent QGLWidget. + + * src/GraphicsContext3D.cpp: + (WebCore::GraphicsContext3D::GraphicsContext3D): + +2010-04-16 Fumitoshi Ukai <ukai@chromium.org> + + Reviewed by Jian Li. + + [chromium] WebKit::WebURLResponse::addHTTPHeaderField will crash if response is invalid UTF-8 + https://bugs.webkit.org/show_bug.cgi?id=37687 + + * src/WebURLResponse.cpp: + (WebKit::WebURLResponse::addHTTPHeaderField): ignore if name or value is null string. + +2010-04-16 Jay Civelli <jcivelli@chromium.org> + + Reviewed by Dimitri Glazkov. + + [chromium] Select popups would assert when destroyed. + Also adding unit-tests for the select popup code. + https://bugs.webkit.org/show_bug.cgi?id=37436 + + * WebKit.gyp: + * src/WebViewImpl.h: + (WebKit::WebViewImpl::selectPopup): + * tests/PopupMenuTest.cpp: Added. + +2010-04-16 Tony Chang <tony@chromium.org> + + Reviewed by Dimitri Glazkov. + + [chromium] build DRT on Linux + https://bugs.webkit.org/show_bug.cgi?id=37690 + + * DEPS: Need to roll deps to remove a dependency on src/chrome + * gyp_webkit: generate makefiles for DRT.gyp on Linux + +2010-04-15 Tony Chang <tony@chromium.org> + + Reviewed by Dimitri Glazkov. + + build DRT on chromium mac + https://bugs.webkit.org/show_bug.cgi?id=37639 + + * gyp_webkit: generate build files for DRT on mac + +2010-04-15 Yury Semikhatsky <yurys@google.com> + + Reviewed by Pavel Feldman. + + Support basic debugging capabilities including step in/over/out in v8 + implementation of ScriptDebugServer. + + https://bugs.webkit.org/show_bug.cgi?id=37604 + + * WebKit.gypi: + * src/DebuggerAgent.h: + * src/DebuggerAgentImpl.cpp: + (WebKit::DebuggerAgentImpl::setDebuggerScriptSource): + * src/DebuggerAgentImpl.h: + * src/DebuggerAgentManager.cpp: + (WebKit::DebuggerAgentManager::hostDispatchHandler): + (WebKit::DebuggerAgentManager::debugAttach): + (WebKit::DebuggerAgentManager::debugDetach): + (WebKit::DebuggerAgentManager::setMessageLoopDispatchHandler): + * src/DebuggerAgentManager.h: + * src/InspectorFrontendClientImpl.cpp: + (WebKit::InspectorFrontendClientImpl::windowObjectCleared): + * src/js/DebuggerScript.js: Added. + (debuggerScriptConstructor.DebuggerScript.getAfterCompileScript): + (debuggerScriptConstructor.DebuggerScript.getScripts): + (debuggerScriptConstructor.DebuggerScript._formatScript): + (debuggerScriptConstructor.DebuggerScript.setBreakpoint): + (debuggerScriptConstructor.DebuggerScript.removeBreakpoint): + (debuggerScriptConstructor.DebuggerScript.currentCallFrame): + (debuggerScriptConstructor.DebuggerScript.stepIntoStatement): + (debuggerScriptConstructor.DebuggerScript.stepOverStatement): + (debuggerScriptConstructor.DebuggerScript.stepOutOfFunction): + (debuggerScriptConstructor.DebuggerScript.clearBreakpoints): + (debuggerScriptConstructor.DebuggerScript.setBreakpointsActivated): + (debuggerScriptConstructor.DebuggerScript._frameMirrorToJSCallFrame): + (debuggerScriptConstructor.DebuggerScript._webkitToV8LineNumber): + (debuggerScriptConstructor.DebuggerScript._v8ToWwebkitLineNumber): + (debuggerScriptConstructor): + * src/js/DevTools.js: + (WebInspector.loaded): + (.): + (): + * src/js/DevToolsHostStub.js: + (.RemoteDebuggerAgentStub.prototype.setDebuggerScriptSource): + * src/js/InspectorControllerImpl.js: + (devtools.InspectorBackendImpl): + +2010-04-15 Matt Perry <mpcomplete@chromium.org> + + Reviewed by Dimitri Glazkov. + + Implement layoutTestController's addUserStyleSheet and + setAuthorAndUserStylesEnabled on Chromium port. + https://bugs.webkit.org/show_bug.cgi?id=37595 + + * public/WebSettings.h: + * public/WebView.h: + * src/WebSettingsImpl.cpp: + (WebKit::WebSettingsImpl::setAuthorAndUserStylesEnabled): + * src/WebSettingsImpl.h: + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::addUserStyleSheet): + * src/WebViewImpl.h: + +2010-04-15 Zhenyao Mo <zmo@google.com> + + Reviewed by Dimitri Glazkov. + + Must enable GL_VERTEX_PROGRAM_POINT_SIZE during initialization + https://bugs.webkit.org/show_bug.cgi?id=37178 + + * src/WebGraphicsContext3DDefaultImpl.cpp: Enable GL_VERTEX_PROGRAM_POINT_SIZE during initialization. + (WebKit::WebGraphicsContext3DDefaultImpl::initialize): + +2010-04-15 Albert J. Wong <ajwong@chromium.org> + + Unreviewed, rolling out r57660. + http://trac.webkit.org/changeset/57660 + https://bugs.webkit.org/show_bug.cgi?id=37604 + + Broke a large number of inspector layout tests in chromium. + + * WebKit.gypi: + * src/DebuggerAgent.h: + * src/DebuggerAgentImpl.cpp: + * src/DebuggerAgentImpl.h: + * src/DebuggerAgentManager.cpp: + (WebKit::DebuggerAgentManager::debugAttach): + (WebKit::DebuggerAgentManager::debugDetach): + (WebKit::DebuggerAgentManager::setMessageLoopDispatchHandler): + * src/DebuggerAgentManager.h: + * src/InspectorFrontendClientImpl.cpp: + (WebKit::InspectorFrontendClientImpl::windowObjectCleared): + * src/js/DebuggerScript.js: Removed. + * src/js/DevTools.js: + (WebInspector.loaded): + (WebInspector.UnresolvedPropertyValue): + (): + * src/js/DevToolsHostStub.js: + * src/js/InspectorControllerImpl.js: + (devtools.InspectorBackendImpl): + +2010-04-15 Yury Semikhatsky <yurys@google.com> + + Reviewed by Pavel Feldman. + + Support basic debugging capabilities including step in/over/out in v8 + implementation of ScriptDebugServer. + + https://bugs.webkit.org/show_bug.cgi?id=37604 + + * WebKit.gypi: + * src/DebuggerAgent.h: + * src/DebuggerAgentImpl.cpp: + (WebKit::DebuggerAgentImpl::setDebuggerScriptSource): + * src/DebuggerAgentImpl.h: + * src/DebuggerAgentManager.cpp: + (WebKit::DebuggerAgentManager::hostDispatchHandler): + (WebKit::DebuggerAgentManager::debugAttach): + (WebKit::DebuggerAgentManager::debugDetach): + (WebKit::DebuggerAgentManager::setMessageLoopDispatchHandler): + * src/DebuggerAgentManager.h: + * src/InspectorFrontendClientImpl.cpp: + (WebKit::InspectorFrontendClientImpl::windowObjectCleared): + * src/js/DebuggerScript.js: Added. + (debuggerScriptConstructor.DebuggerScript.getAfterCompileScript): + (debuggerScriptConstructor.DebuggerScript.getScripts): + (debuggerScriptConstructor.DebuggerScript._formatScript): + (debuggerScriptConstructor.DebuggerScript.setBreakpoint): + (debuggerScriptConstructor.DebuggerScript.removeBreakpoint): + (debuggerScriptConstructor.DebuggerScript.currentCallFrame): + (debuggerScriptConstructor.DebuggerScript.stepIntoStatement): + (debuggerScriptConstructor.DebuggerScript.stepOverStatement): + (debuggerScriptConstructor.DebuggerScript.stepOutOfFunction): + (debuggerScriptConstructor.DebuggerScript.clearBreakpoints): + (debuggerScriptConstructor.DebuggerScript.setBreakpointsActivated): + (debuggerScriptConstructor.DebuggerScript._frameMirrorToJSCallFrame): + (debuggerScriptConstructor.DebuggerScript._webkitToV8LineNumber): + (debuggerScriptConstructor.DebuggerScript._v8ToWwebkitLineNumber): + (debuggerScriptConstructor): + * src/js/DevTools.js: + (WebInspector.loaded): + (.): + (): + * src/js/DevToolsHostStub.js: + (.RemoteDebuggerAgentStub.prototype.setDebuggerScriptSource): + * src/js/InspectorControllerImpl.js: + (devtools.InspectorBackendImpl): + +2010-04-15 Ben Murdoch <benm@google.com> + + Unreviewed, rolling out r57652. + http://trac.webkit.org/changeset/57652 + https://bugs.webkit.org/show_bug.cgi?id=37609 + + Caused a build break on Chromium Mac and Layout Test fail on + Qt + + * src/WebInputEventConversion.cpp: + (WebKit::toPlatformTouchPointState): + +2010-04-14 Ben Murdoch <benm@google.com> + + Reviewed by Kenneth Rohde Christiansen. + + The TouchStationary state of WebCore::PlatformTouchPoint is not + handled inside the touch event handler. + https://bugs.webkit.org/show_bug.cgi?id=37609 + + After discussions at the WebKit contributors meeting, we decided that + this is a currently unused state without a good future use case in the + Touch API and thus decided to remove it. This patch actions that decision. + + * src/WebInputEventConversion.cpp: + (WebKit::toPlatformTouchPointState): Remove TouchStationary. + +2010-04-12 Tony Chang <tony@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] update chromium DEPS for upstream compile + https://bugs.webkit.org/show_bug.cgi?id=36578 + + * DEPS: Pull sub deps from chromium's DEPS file + +2010-04-14 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r57599. + http://trac.webkit.org/changeset/57599 + https://bugs.webkit.org/show_bug.cgi?id=37605 + + "Broke Chromium build" (Requested by dglazkov on #webkit). + + * WebKit.gyp: + * src/WebViewImpl.h: + * tests/PopupMenuTest.cpp: Removed. + +2010-04-14 Aaron Boodman <aa@chromium.org> + + Reviewed by David Levin. + + Support relative URLs for notifications on Chromium. They weren't working previously because WebCore was inserting + the relative URL into a KURL instance, but when KURL is backed by GURL as it is on Chromium, relative URLs are + unsupported. Fixed by resolving the relative URL first. + + https://bugs.webkit.org/show_bug.cgi?id=36623 + + Adding tests for this is difficult because we don't currently have DRT support for notifications on Mac, only Windows. + + * public/WebNotification.h: Remove deprecated icon() method. + * src/WebNotification.cpp: Ditto. + +2010-04-14 Jay Civelli <jcivelli@chromium.org> + + Reviewed by Dimitri Glazkov. + + [chromium] Select popups would assert when destroyed. + Also adding unit-tests for the select popup code. + https://bugs.webkit.org/show_bug.cgi?id=37436 + + * WebKit.gyp: + * src/WebViewImpl.h: + (WebKit::WebViewImpl::selectPopup): + * tests/PopupMenuTest.cpp: Added. + +2010-04-14 Zhenyao Mo <zmo@google.com> + + Reviewed by Dimitri Glazkov. + + readPixels must take PACK_ALIGNMENT into account + https://bugs.webkit.org/show_bug.cgi?id=34718 + + * src/GraphicsContext3D.cpp: Refactor readPixels. + * src/WebGraphicsContext3DDefaultImpl.cpp: + (WebKit::WebGraphicsContext3DDefaultImpl::readBackFramebuffer): Temporarily disable pack alignment for glReadPixels. + (WebKit::WebGraphicsContext3DDefaultImpl::readPixels): Move array allocation and alpha fix to WebGLRenderingContext; flush before read pixels. + +2010-04-14 Mikhail Naganov <mnaganov@chromium.org> + + Reviewed by Pavel Feldman. + + Re-write testProfilerTab to match the new implementation. + + https://bugs.webkit.org/show_bug.cgi?id=37516 + + * src/js/Tests.js: + (.TestSuite.prototype.testProfilerTab.findDisplayedNode): + (.TestSuite.prototype.testProfilerTab.findVisibleView): + (.TestSuite.prototype.testProfilerTab): + +2010-04-13 Timothy Hatcher <timothy@apple.com> + + Rename SecurityOrigin::whiteListAccessFromOrigin to addOriginAccessWhitelistEntry. + And SecurityOrigin::resetOriginAccessWhiteLists to resetOriginAccessWhitelists. + + SecurityOrigin needs a way to remove individual OriginAccessEntries + https://bugs.webkit.org/show_bug.cgi?id=37449 + + Reviewed by Dave Hyatt. + + * src/WebSecurityPolicy.cpp: + (WebKit::WebSecurityPolicy::whiteListAccessFromOrigin): + (WebKit::WebSecurityPolicy::resetOriginAccessWhiteLists): + +2010-04-13 Mikhail Naganov <mnaganov@chromium.org> + + Reviewed by Pavel Feldman. + + Fix search behavior in Heap profiles. + + https://bugs.webkit.org/show_bug.cgi?id=37498 + + * src/js/HeapProfilerPanel.js: + +2010-04-13 Jeremy Moskovich <jeremy@chromium.org> + + Reviewed by David Levin. + + Add some diagnostics to try to track down cause of crash in ArchiveFactory::isArchiveMimeType(). + + https://bugs.webkit.org/show_bug.cgi?id=36426 + + * src/ResourceHandle.cpp: Track state across ResourceHandle invocations. + (WebCore::ResourceHandleInternal::ResourceHandleInternal): + (WebCore::ResourceHandleInternal::): + (WebCore::ResourceHandleInternal::start): + (WebCore::ResourceHandleInternal::cancel): + (WebCore::ResourceHandleInternal::didReceiveResponse): + (WebCore::ResourceHandleInternal::didReceiveData): + (WebCore::ResourceHandleInternal::didFinishLoading): + (WebCore::ResourceHandleInternal::didFail): + +2010-04-13 Mikhail Naganov <mnaganov@chromium.org> + + Unreviewed Chromium build fix: pin to a newer V8 revision (4386). + + * DEPS: + +2010-04-12 Mikhail Naganov <mnaganov@chromium.org> + + Reviewed by Yury Semikhatsky. + + Replace hand-written JavaScriptProfile* bindings with idl-based, and + in Chromium port, bind them to the new V8's profiler API that is + aligned with JSC. + + https://bugs.webkit.org/show_bug.cgi?id=37448 + + * src/js/InspectorControllerImpl.js: + (devtools.InspectorBackendImpl): + * src/js/ProfilerAgent.js: + (devtools.ProfilerAgent): + (devtools.ProfilerAgent.prototype.initializeProfiling): + (devtools.ProfilerAgent.prototype._didGetActiveProfilerModules): + (devtools.ProfilerAgent.prototype._didGetLogLines): + * src/js/Tests.js: + +2010-04-11 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r57468. + http://trac.webkit.org/changeset/57468 + https://bugs.webkit.org/show_bug.cgi?id=37433 + + Broke the world... Must have applied the patch wrong + (Requested by abarth on #webkit). + + * src/ContextMenuClientImpl.cpp: + (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems): + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::finishedLoading): + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::encoding): + (WebKit::WebFrameImpl::commitDocumentData): + * src/WebPageSerializerImpl.cpp: + (WebKit::WebPageSerializerImpl::preActionBeforeSerializeOpenTag): + (WebKit::WebPageSerializerImpl::serialize): + * src/WebSearchableFormData.cpp: + (WebCore::GetFormEncoding): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::pageEncoding): + +2010-04-11 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Factor DocumentWriter out of FrameLoader + https://bugs.webkit.org/show_bug.cgi?id=37175 + + Update these callsites because the method moved to DocumentWriter. + + * src/ContextMenuClientImpl.cpp: + (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems): + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::finishedLoading): + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::encoding): + (WebKit::WebFrameImpl::commitDocumentData): + * src/WebPageSerializerImpl.cpp: + (WebKit::WebPageSerializerImpl::preActionBeforeSerializeOpenTag): + (WebKit::WebPageSerializerImpl::serialize): + * src/WebSearchableFormData.cpp: + (WebCore::GetFormEncoding): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::pageEncoding): + +2010-04-11 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r57460. + http://trac.webkit.org/changeset/57460 + https://bugs.webkit.org/show_bug.cgi?id=37424 + + broke chromium builders (Requested by tony^work on #webkit). + + * DEPS: + * gyp_webkit: + +2010-04-11 Tony Chang <tony@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] update chromium DEPS for upstream compile + https://bugs.webkit.org/show_bug.cgi?id=36578 + + * DEPS: + * gyp_webkit: Add DumpRenderTree.gyp so we generate xcode projects for DRT. + +2010-04-10 Vangelis Kokkevis <vangelis@chromium.org> + + Reviewed by Dimitri Glazkov. + + Include file change as a result of renaming LayerRenderSkia.h to LayerRenderChromium.h + https://bugs.webkit.org/show_bug.cgi?id=37231 + + * src/WebViewImpl.h: + +2010-04-10 Rafael Weinstein <rafaelw@chromium.org> + + Reviewed by Eric Seidel. + + Cleanup after chromium breakage. All interface methods are + returned to being abstract. + + * public/WebNotificationPresenter.h: + +2010-04-09 Evan Stade <estade@chromium.org> + + Reviewed by Eric Seidel. + + [chromium] Linux: respect the scale factor during printing + https://bugs.webkit.org/show_bug.cgi?id=37168 + + Chromium doesn't support testing .pdfs from printing at the moment, so + this change is not covered by any tests. + + * src/WebFrameImpl.cpp: + (WebKit::ChromePrintContext::spoolPage): + +2010-04-09 Aaron Boodman <aa@chromium.org> + + Reviewed by Eric Seidel. + + Remove applicationID() from WebDocument as it is Chromium-specific. + https://bugs.webkit.org/show_bug.cgi?id=37350 + + * public/WebDocument.h: + * src/WebDocument.cpp: + +2010-04-09 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Darin Adler. + + Move the IDB::open ExceptionCode paramter to be last + https://bugs.webkit.org/show_bug.cgi?id=37277 + + Move the ExceptionCode paramter to the last position in + IndexedDatabaseRequest::open and friends. It should definitely + go after the callbacks to keep the parameters that come directly + from javascript together. And having output parameters appear + last is done often in the code base, so it makes sense to push + it past the Frame* param as well. + + * public/WebIndexedDatabase.h: + * src/IndexedDatabaseProxy.cpp: + (WebCore::IndexedDatabaseProxy::open): + * src/IndexedDatabaseProxy.h: + * src/WebIndexedDatabaseImpl.cpp: + (WebKit::WebIndexedDatabaseImpl::open): + * src/WebIndexedDatabaseImpl.h: + +2010-04-09 Jochen Eisinger <jochen@chromium.org> + + Reviewed by Darin Fisher. + + Complete move of createApplicationCacheHost from WebKitClient to WebFrameClient. + https://bugs.webkit.org/show_bug.cgi?id=37330 + + * public/WebApplicationCacheHost.h: + * public/WebKitClient.h: + * src/ApplicationCacheHostInternal.h: + (WebCore::ApplicationCacheHostInternal::ApplicationCacheHostInternal): + +2010-04-09 Marcus Bulach <bulach@chromium.org> + + Reviewed by Jeremy Orlow. + + Crash on WebKit::WebGeolocationServiceBridgeImpl::stopUpdating() during frame disconnection + Should not try to access WebViewClient if the frame has already been disconnected. + https://bugs.webkit.org/show_bug.cgi?id=37318 + + * src/WebGeolocationServiceBridgeImpl.cpp: + (WebKit::WebGeolocationServiceBridgeImpl::stopUpdating): + +2010-04-09 Jochen Eisinger <jochen@chromium.org> + + Reviewed by Adam Barth. + + Expose SecurityOrigin::canRequest in WebSecurityOrigin. + https://bugs.webkit.org/show_bug.cgi?id=37271 + + * public/WebSecurityOrigin.h: + * src/WebSecurityOrigin.cpp: + (WebKit::WebSecurityOrigin::canRequest): + +2010-04-09 Zhenyao Mo <zmo@google.com> + + Reviewed by Dimitri Glazkov. + + Must resolve multisampled back buffer during copyTexImage2D and copyTexSubImage2D + https://bugs.webkit.org/show_bug.cgi?id=37174 + + Test: fast/canvas/webgl/copy-tex-image-and-sub-image-2d.html + + * src/WebGraphicsContext3DDefaultImpl.cpp: Resolve multisampled back buffer during copyTexImage2D and copyTexSubImage2D. + (WebKit::WebGraphicsContext3DDefaultImpl::copyTexImage2D): + (WebKit::WebGraphicsContext3DDefaultImpl::copyTexSubImage2D): + +2010-04-07 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Chromium: support themes in devtools window. + + https://bugs.webkit.org/attachment.cgi?bugid=37216 + + * WebKit.gypi: + * src/js/DevTools.js: + (WebInspector.setToolbarColors): + (WebInspector.resetToolbarColors): + * src/js/Images/segmentChromium2.png: Added. + * src/js/Images/segmentHoverChromium2.png: Added. + * src/js/Images/segmentSelectedChromium2.png: Added. + * src/js/Images/statusbarBackgroundChromium2.png: Added. + * src/js/Images/statusbarMenuButtonChromium2.png: Added. + +2010-04-07 Andrey Kosyakov <caseq@chromium.org> + + Reviewed by Yury Semikhatsky. + + Removed inspector methods from ScriptExecutionContext and derived classes. + Removed MessageDestination parameter from console-related calls (we now always + log to the same destination(s)). + Removed redundant FrameLoaderClient::dispatchDidLoadResourceByXMLHttpRequest() + https://bugs.webkit.org/show_bug.cgi?id=36949 + + * public/WebCommonWorkerClient.h: + (WebKit::WebCommonWorkerClient::postConsoleMessageToWorkerObject): + * src/FrameLoaderClientImpl.cpp: + * src/FrameLoaderClientImpl.h: + * src/WebWorkerBase.cpp: + (WebKit::WebWorkerBase::postConsoleMessageToWorkerObject): + (WebKit::WebWorkerBase::postConsoleMessageTask): + * src/WebWorkerBase.h: + * src/WebWorkerClientImpl.cpp: + (WebKit::WebWorkerClientImpl::postConsoleMessageToWorkerObject): + (WebKit::WebWorkerClientImpl::postConsoleMessageToWorkerObjectTask): + * src/WebWorkerClientImpl.h: + +2010-04-07 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] WebIDBDatabaseError::assign doesn't work correctly + https://bugs.webkit.org/show_bug.cgi?id=37209 + + * src/WebIDBDatabaseError.cpp: + (WebKit::WebIDBDatabaseError::assign): + +2010-04-07 Dawit Alemayehu <adawit@kde.org> + + Reviewed by Simon Hausmann. + + https://bugs.webkit.org/show_bug.cgi?id=36827 + + Updated the WebCore::shouldTreatAsAttachement function call with the + new more generic replacement WebCore::contentDispositionType. + + See comments 39-42 in https://bugs.webkit.org/show_bug.cgi?id=36395 + + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::dispatchDecidePolicyForMIMEType): + +2010-04-07 Jochen Eisinger <jochen@chromium.org> + + Reviewed by Darin Fisher. + + Add createApplicationCacheHost to WebFrameClient so + the ApplicationCacheHost has access to its frame. + + https://bugs.webkit.org/show_bug.cgi?id=36882 + + * public/WebFrameClient.h: + (WebKit::WebFrameClient::createApplicationCacheHost): + * src/ApplicationCacheHostInternal.h: + (WebCore::ApplicationCacheHostInternal::ApplicationCacheHostInternal): + +2010-04-06 Nicolas Weber <thakis@chromium.org> + + Reviewed by Dimitri Glazkov. + + Use drag images on OS X as well. + https://bugs.webkit.org/show_bug.cgi?id=37069 + + * src/DragClientImpl.cpp: + (WebKit::DragClientImpl::startDrag): + +2010-04-06 Vangelis Kokkevis <vangelis@chromium.org> + + Reviewed by Dimitri Glazkov. + + Changing references to Graphics Layer related classes from *Skia to *Chromium. + https://bugs.webkit.org/show_bug.cgi?id=37116 + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::paint): + (WebKit::WebViewImpl::setAcceleratedCompositing): + (WebKit::WebViewImpl::updateRootLayerContents): + * src/WebViewImpl.h: + +2010-04-06 James Hawkins <jhawkins@chromium.org> + + Reviewed by Adam Barth. + + [Chromium] Implement WebInputElement::maxLength. + https://bugs.webkit.org/show_bug.cgi?id=37172 + + * public/WebInputElement.h: + * src/WebInputElement.cpp: + (WebKit::WebInputElement::maxLength): + +2010-04-06 Evan Stade <estade@chromium.org> + + Reviewed by Dimitri Glazkov. + + [chromium] need DragImage implementation + https://bugs.webkit.org/show_bug.cgi?id=35811 + + Basic implementation using SkBitmap. Transformations are not supported + yet. No implementation for mac. + + This was previously committed but rolled back for breaking layout + tests. + + * public/WebViewClient.h: + (WebKit::WebViewClient::startDragging): + * src/DragClientImpl.cpp: + (WebKit::DragClientImpl::startDrag): new: check for null dragImage. + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::startDragging): + * src/WebViewImpl.h: + +2010-04-06 James Hawkins <jhawkins@chromium.org> + + Reviewed by Dimitri Glazkov. + + [Chromium] Move the getElementsByTagName from WebDocument to WebNode. + https://bugs.webkit.org/show_bug.cgi?id=37161 + + * public/WebDocument.h: + * public/WebNode.h: + * src/WebDocument.cpp: + * src/WebNode.cpp: + (WebKit::WebNode::getElementsByTagName): + +2010-04-06 Ilya Tikhonovsky <loislo@chromium.org> + + Unreviewed build fix for Chromium DEPS. + + * DEPS: + +2010-04-06 Ilya Tikhonovsky <loislo@chromium.org> + + Unreviewed: build fix. + + * DEPS: + +2010-04-06 Mattias Nissler <mnissler@chromium.org> + + Reviewed by Pavel Feldman. + + Handle docking requests from the developer tools and forward them to + WebDevToolsFrontendClient. + https://bugs.webkit.org/show_bug.cgi?id=36944 + + * public/WebDevToolsFrontendClient.h: + (WebKit::WebDevToolsFrontendClient::requestDockWindow): + * src/WebDevToolsFrontendImpl.cpp: + (WebKit::WebDevToolsFrontendImpl::WebDevToolsFrontendImpl): + (WebKit::WebDevToolsFrontendImpl::jsRequestAttachWindow): + * src/WebDevToolsFrontendImpl.h: + +2010-04-06 Andrey Kosyakov <caseq@chromium.org> + + Reviewed by Yury Semikhatsky. + + Fixed logging of unhndled worker exceptions. + https://bugs.webkit.org/show_bug.cgi?id=37143 + + * src/WebWorkerClientImpl.cpp: + (WebKit::WebWorkerClientImpl::postExceptionToWorkerObject): + +2010-04-05 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=37111 + <rdar://problem/7790327> Draw replacement text when plug-in host crashes + + * src/LocalizedStrings.cpp: (WebCore::crashedPluginText): Added a stub string for plug-in + failure. + +2010-04-04 Pavel Feldman <pfeldman@chromium.org> + + Not reviewed. Rolling out chromium changes r57028 and r57032 + for breaking chromium layout tests. + + * public/WebViewClient.h: + (WebKit::WebViewClient::startDragging): + * src/DragClientImpl.cpp: + (WebKit::DragClientImpl::startDrag): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::startDragging): + * src/WebViewImpl.h: + +2010-04-03 Darin Fisher <darin@chromium.org> + + Add default implementations of WebNotificationPresenter methods to + repair the downstream Chromium build. + + * public/WebNotificationPresenter.h: + (WebKit::WebNotificationPresenter::show): + (WebKit::WebNotificationPresenter::cancel): + (WebKit::WebNotificationPresenter::objectDestroyed): + (WebKit::WebNotificationPresenter::checkPermission): + (WebKit::WebNotificationPresenter::requestPermission): + +2010-04-02 Michael Nordman <michaeln@google.com> + + Reviewed by Nate Chapin. + + Set the close policy used by the DatabaseCloseTask at this callsite to + RemoveDatabaseFromContext. This restores its behavior to what it was prior to + r56293. + https://bugs.webkit.org/show_bug.cgi?id=37037 + + * src/WebDatabase.cpp: + (WebKit::WebDatabase::closeDatabaseImmediately): + +2010-04-02 Evan Stade <estade@chromium.org> + + Reviewed by Eric Seidel. + + [chromium] need DragImage implementation + https://bugs.webkit.org/show_bug.cgi?id=35811 + + Use the DragImageRef that the DragController passes to us. + + * public/WebViewClient.h: + (WebKit::WebViewClient::startDragging): + * src/DragClientImpl.cpp: + (WebKit::DragClientImpl::startDrag): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::startDragging): + * src/WebViewImpl.h: + +2010-04-02 Rafael Weinstein <rafaelw@chromium.org> + + Reviewed by Adam Barth. + + Clean up unused calls after changes to checkPermission and requestPermission argument lists. + + * public/WebNotificationPresenter.h: + * src/NotificationPresenterImpl.cpp: + (WebKit::NotificationPresenterImpl::checkPermission): + (WebKit::NotificationPresenterImpl::requestPermission): + +2010-04-02 Zhenyao Mo <zmo@google.com> + + Reviewed by Eric Seidel. + + Implement and test new framebuffer object attachment behavior. + https://bugs.webkit.org/show_bug.cgi?id=35611 + + Test: fast/canvas/webgl/framebuffer-object-attachment.html + + * src/WebGraphicsContext3DDefaultImpl.cpp: Map to correct DEPTH_STENCIL format. + (WebKit::WebGraphicsContext3DDefaultImpl::framebufferRenderbuffer): + (WebKit::WebGraphicsContext3DDefaultImpl::getFramebufferAttachmentParameteriv): + (WebKit::WebGraphicsContext3DDefaultImpl::renderbufferStorage): + +2010-04-02 Jay Civelli <jcivelli@chromium.org> + + Reviewed by Darin Fisher. + + The popup type (select or suggestion) is now passed to the + WebClient::createPopupMenu() method. This is required for + Chromium on Linux to make the select popups work correctly. + https://bugs.webkit.org/show_bug.cgi?id=37013 + + * WebKit.gyp: + * public/WebPopupType.h: Added. + (WebKit::): + * public/WebViewClient.h: + (WebKit::WebViewClient::createPopupMenu): + * src/ChromeClientImpl.cpp: + (WebCore::convertPopupType): + (WebKit::ChromeClientImpl::popupOpened): + +2010-04-02 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Implement InspectorFrontendClient in Chromium and remove all custom bindings for the host methods from WebDevToolsFrontendImpl. + + https://bugs.webkit.org/show_bug.cgi?id=36817 + + * WebKit.gyp: + * src/InspectorFrontendClientImpl.cpp: Added. + (WebKit::InspectorFrontendClientImpl::InspectorFrontendClientImpl): + (WebKit::InspectorFrontendClientImpl::~InspectorFrontendClientImpl): + (WebKit::InspectorFrontendClientImpl::windowObjectCleared): + (WebKit::InspectorFrontendClientImpl::frontendLoaded): + (WebKit::InspectorFrontendClientImpl::moveWindowBy): + (WebKit::InspectorFrontendClientImpl::localizedStringsURL): + (WebKit::InspectorFrontendClientImpl::hiddenPanels): + (WebKit::InspectorFrontendClientImpl::bringToFront): + (WebKit::InspectorFrontendClientImpl::closeWindow): + (WebKit::InspectorFrontendClientImpl::canAttachWindow): + (WebKit::InspectorFrontendClientImpl::attachWindow): + (WebKit::InspectorFrontendClientImpl::detachWindow): + (WebKit::InspectorFrontendClientImpl::changeAttachedWindowHeight): + (WebKit::InspectorFrontendClientImpl::inspectedURLChanged): + * src/InspectorFrontendClientImpl.h: Added. + * src/WebDevToolsFrontendImpl.cpp: + (WebKit::WebDevToolsFrontendImpl::WebDevToolsFrontendImpl): + (WebKit::WebDevToolsFrontendImpl::~WebDevToolsFrontendImpl): + (WebKit::WebDevToolsFrontendImpl::frontendLoaded): + * src/WebDevToolsFrontendImpl.h: + * src/js/DebuggerAgent.js: + (devtools.DebuggerAgent.prototype.doHandleBacktraceResponse_): + * src/js/DevTools.js: + (): + +2010-04-01 Jay Civelli <jcivelli@google.com> + + Reviewed by David Levin. + + Adds a method to WebFrame to execute JavaScript and get the value + it evaluates to. + https://bugs.webkit.org/show_bug.cgi?id=36907 + + * public/WebFrame.h: + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::executeScriptAndReturnValue): + * src/WebFrameImpl.h: + +2010-04-01 Kinuko Yasuda <kinuko@chromium.org> + + Reviewed by Dmitry Titov. + + Add FileThread for async file operation support in FileReader and FileWriter + https://bugs.webkit.org/show_bug.cgi?id=36896 + + Add ENABLE_FILE_READER and ENABLE_FILE_WRITER flags. + + * features.gypi: + +2010-04-01 Finnur Thorarinsson <finnur.webkit@gmail.com> + + Reviewed by Eric Seidel. + + [chromium] FindInPage on multi-frame pages wasn't always updating + tickmarks on scrollbars for the subframes. It was calling invalidateRect + on the View and specifying a rect that's in window coordinates, whereas + the invalidateRect expects frame coordinates. + + https://bugs.webkit.org/show_bug.cgi?id=36982 + + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::invalidateArea): + +2010-04-01 Finnur Thorarinsson <finnur.webkit@gmail.com> + + Reviewed by Dimitri Glazkov. + + [chromium] FindInPage should clear the focused node when a match has + been found. This is because WebFrameImpl::setFocus will try to refocus + editable elements if it thinks they have focus, causing the page to + scroll. + + https://bugs.webkit.org/show_bug.cgi?id=36923 + + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::find): + +2010-04-01 Marcus Bulach <bulach@chromium.org> + + Reviewed by Jeremy Orlow. + + As a follow up on https://bugs.webkit.org/show_bug.cgi?id=36535, remove: + GeolocationServiceBridgeChromium.h + dettachBridge() + getGeolocationService() + https://bugs.webkit.org/show_bug.cgi?id=36895 + + * WebKit.gyp: + * public/GeolocationServiceBridgeChromium.h: Removed. + * public/WebGeolocationService.h: + (WebKit::WebGeolocationService::detachBridge): + * public/WebViewClient.h: + (WebKit::WebViewClient::geolocationService): + +2010-03-31 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Nate Chapin. + + Misc IndexedDatabase cleanup + https://bugs.webkit.org/show_bug.cgi?id=36889 + + Plumb the Frame* so Chromium knows where the request originated from. + + * public/WebIndexedDatabase.h: + * src/IndexedDatabaseProxy.cpp: + (WebCore::IndexedDatabaseProxy::open): + * src/IndexedDatabaseProxy.h: + * src/WebIndexedDatabaseImpl.cpp: + (WebKit::WebIndexedDatabaseImpl::open): + * src/WebIndexedDatabaseImpl.h: + +2010-03-31 Alpha Lam <hclam@chromium.org> + + Not reviewed. Build fix. + + Fixing a build break caused by 56872. One of the Chromium bots doesn't + like std::strstr(). Includes string.h and use strstr() instead. + + * src/WebGraphicsContext3DDefaultImpl.cpp: + (WebKit::WebGraphicsContext3DDefaultImpl::validateAttributes): + Includes string.h and use strstr(). + +2010-03-31 Zhenyao Mo <zmo@google.com> + + Reviewed by Darin Fisher. + + Hook up WebGLContextAttributes to OpenGL context creation code + https://bugs.webkit.org/show_bug.cgi?id=33416 + + * src/WebGraphicsContext3DDefaultImpl.cpp: Hook up WebGLContextAttributes to OpenGL context creation code for Chrome. + (WebKit::WebGraphicsContext3DDefaultImpl::WebGraphicsContext3DDefaultImpl): + (WebKit::WebGraphicsContext3DDefaultImpl::~WebGraphicsContext3DDefaultImpl): + (WebKit::WebGraphicsContext3DDefaultImpl::initialize): + (WebKit::WebGraphicsContext3DDefaultImpl::validateAttributes): + (WebKit::WebGraphicsContext3DDefaultImpl::reshape): + (WebKit::WebGraphicsContext3DDefaultImpl::readBackFramebuffer): + (WebKit::WebGraphicsContext3DDefaultImpl::bindFramebuffer): + (WebKit::WebGraphicsContext3DDefaultImpl::readPixels): Deal with wrong returned alpha values in Mac. + * src/WebGraphicsContext3DDefaultImpl.h: Add a function. + +2010-03-31 Darin Fisher <darin@chromium.org> + + Reviewed by David Levin. + + [chromium] including WebKit.gyp:webkit should automatically add Skia + and NPAPI include paths + + https://bugs.webkit.org/show_bug.cgi?id=36887 + + * WebKit.gyp: + +2010-03-31 Marcus Bulach <bulach@chromium.org> + + Reviewed by Jeremy Orlow. + + Implements cancelGeolocationPermissionRequestForFrame. + https://bugs.webkit.org/show_bug.cgi?id=35031 + + * public/WebGeolocationService.h: + (WebKit::WebGeolocationService::cancelPermissionRequestForFrame): + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::cancelGeolocationPermissionRequestForFrame): + * src/ChromeClientImpl.h: + +2010-03-31 Pavel Feldman <pfeldman@chromium.org> + + Not reviewed. Rolling out r56829 since it broke chromium layout tests. + + [REGRESSION] Inspector tests started crashing since r56829 + https://bugs.webkit.org/show_bug.cgi?id=36888 + + * public/WebFrameClient.h: + * src/FrameLoaderClientImpl.cpp: + * src/FrameLoaderClientImpl.h: + +2010-03-31 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Add stubs for moveWindowBy and setAttachedWindowHeight. + + https://bugs.webkit.org/show_bug.cgi?id=36842 + + * src/WebDevToolsFrontendImpl.cpp: + (WebKit::WebDevToolsFrontendImpl::WebDevToolsFrontendImpl): + (WebKit::WebDevToolsFrontendImpl::jsSetAttachedWindowHeight): + (WebKit::WebDevToolsFrontendImpl::jsMoveWindowBy): + * src/WebDevToolsFrontendImpl.h: + +2010-03-31 John Gregg <johnnyg@google.com> + + Reviewed by Darin Fisher. + + [chromium] add logging of cross-frame property accesses for site isolation + https://bugs.webkit.org/show_bug.cgi?id=35773 + + * public/WebFrameClient.h: + (WebKit::WebFrameClient::logCrossFramePropertyAccess): + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::logCrossFramePropertyAccess): + * src/FrameLoaderClientImpl.h: + +2010-03-30 Gavin Barraclough <barraclough@apple.com> + + Rubber stamped by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=36866 + Move CString to WTF + + * public/WebCString.h: + * src/FrameLoaderClientImpl.cpp: + * src/GraphicsContext3D.cpp: + * src/WebCString.cpp: + (WebKit::WebCString::assign): + (WebKit::WebCString::WebCString): + (WebKit::WebCString::operator=): + (WebKit::WebCString::operator WTF::CString): + * src/WebMediaPlayerClientImpl.cpp: + * src/WebString.cpp: + * src/WebURLError.cpp: + +2010-03-30 Marcus Bulach <bulach@chromium.org> + + Reviewed by Darin Fisher. + + Rename / tidy up Geolocation bridge: + Rename GeolocationServiceBridgeChromium.cpp to WebGeolocationServiceBridgeImpl.cpp + Uses a temporary compatibility layer in GeolocationServiceBridgeChromium.h. + + https://bugs.webkit.org/show_bug.cgi?id=36535 + + * WebKit.gyp: + * public/GeolocationServiceBridgeChromium.h: + * public/WebGeolocationService.h: Copied from WebKit/chromium/public/GeolocationServiceBridgeChromium.h. + (WebKit::WebGeolocationService::detachBridge): + * public/WebGeolocationServiceBridge.h: Copied from WebKit/chromium/public/GeolocationServiceBridgeChromium.h. + * public/WebViewClient.h: + (WebKit::WebViewClient::geolocationService): + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::requestGeolocationPermissionForFrame): + * src/ChromiumBridge.cpp: + * src/GeolocationServiceBridgeChromium.cpp: Removed. + * src/WebGeolocationServiceBridgeImpl.cpp: Copied from WebKit/chromium/src/GeolocationServiceBridgeChromium.cpp. + (WebKit::createGeolocationServiceBridgeImpl): + (WebKit::WebGeolocationServiceBridgeImpl::WebGeolocationServiceBridgeImpl): + (WebKit::WebGeolocationServiceBridgeImpl::~WebGeolocationServiceBridgeImpl): + (WebKit::WebGeolocationServiceBridgeImpl::startUpdating): + (WebKit::WebGeolocationServiceBridgeImpl::stopUpdating): + (WebKit::WebGeolocationServiceBridgeImpl::suspend): + (WebKit::WebGeolocationServiceBridgeImpl::resume): + (WebKit::WebGeolocationServiceBridgeImpl::getBridgeId): + (WebKit::WebGeolocationServiceBridgeImpl::setIsAllowed): + (WebKit::WebGeolocationServiceBridgeImpl::setLastPosition): + (WebKit::WebGeolocationServiceBridgeImpl::setLastError): + (WebKit::WebGeolocationServiceBridgeImpl::getWebViewClient): + * src/WebGeolocationServiceBridgeImpl.h: Copied from WebKit/chromium/public/GeolocationServiceBridgeChromium.h. + +2010-03-30 Jochen Eisinger <jochen@chromium.org> + + Reviewed by Jeremy Orlow. + + Remove dysfunctional implementation of canEstablishDatabase for + Workers. I postpone this implementation until Workers can actually + access Web Databases. + + https://bugs.webkit.org/show_bug.cgi?id=36795 + + * src/DatabaseObserver.cpp: + (WebCore::DatabaseObserver::canEstablishDatabase): + * src/WebWorkerBase.h: + +2010-03-29 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Darin Fisher. + + More IndexedDB work + https://bugs.webkit.org/show_bug.cgi?id=36770 + + Start the implementation of WebIndexedDatabase (for entrance back into WebKit). + + * WebKit.gyp: + * public/WebIndexedDatabase.h: + * src/WebIndexedDatabaseImpl.cpp: Added. + (WebKit::WebIndexedDatabase::create): + (WebKit::WebIndexedDatabaseImpl::~WebIndexedDatabaseImpl): + (WebKit::WebIndexedDatabaseImpl::open): + * src/WebIndexedDatabaseImpl.h: Added. + +2010-03-29 Rafael Weinstein <rafaelw@chromium.org> + + Reviewed by Adam Barth. + + Change NotificationPresenter::checkPermission() to take the source frames full KURL, + rather than its SecurityOrigin. This will aid chromium in having more fine grained + permissions to control notification spam. + + * public/WebNotificationPresenter.h: + (WebKit::WebNotificationPresenter::checkPermission): + * src/NotificationPresenterImpl.cpp: + (WebKit::NotificationPresenterImpl::checkPermission): + * src/NotificationPresenterImpl.h: + +2010-03-29 Dawit Alemayehu <adawit@kde.org> + + Reviewed by Simon Hausmann. + + Factored out the 'ShouldTreatAsAttachment' function to HTTPParsers.* + and replacted local version with the factored out version. + + The code was factored out to make possible its use in other implementations + such as QtWebKit. + + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::dispatchDecidePolicyForMIMEType): + +2010-03-29 Jochen Eisinger <jochen@chromium.org> + + Reviewed by Darin Fisher. + + Pass a WebFrame to WebFrameClient::allowDatabase instead of a WebSecurityOrigin + https://bugs.webkit.org/show_bug.cgi?id=36743 + + * public/WebFrameClient.h: + (WebKit::WebFrameClient::allowDatabase): + * src/DatabaseObserver.cpp: + (WebCore::DatabaseObserver::canEstablishDatabase): + +2010-03-24 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Darin Fisher. + + More IndexedDB plumbing + https://bugs.webkit.org/show_bug.cgi?id=36546 + + Plumbing work towards the goal of making IndexedDatabase::open work. + + * WebKit.gyp: + * public/WebIDBCallbacks.h: Added. + (WebKit::WebIDBCallbacks::~WebIDBCallbacks): + * public/WebIDBDatabase.h: Added. + (WebKit::WebIDBDatabase::~WebIDBDatabase): + * public/WebIDBDatabaseError.h: Added. + (WebKit::WebIDBDatabaseError::WebIDBDatabaseError): + (WebKit::WebIDBDatabaseError::operator=): + * public/WebIndexedDatabase.h: + * public/WebKitClient.h: + (WebKit::WebKitClient::indexedDatabase): + * public/WebSerializedScriptValue.h: + * src/IDBCallbacksProxy.h: Added. + (WebCore::IDBCallbacksProxy::IDBCallbacksProxy): + (WebCore::IDBCallbacksProxy::~IDBCallbacksProxy): + (WebCore::IDBCallbacksProxy::onSuccess): + (WebCore::IDBCallbacksProxy::onError): + * src/IDBDatabaseProxy.cpp: Added. + (WebCore::IDBDatabaseProxy::create): + (WebCore::IDBDatabaseProxy::IDBDatabaseProxy): + (WebCore::IDBDatabaseProxy::~IDBDatabaseProxy): + * src/IDBDatabaseProxy.h: Added. + * src/IndexedDatabaseProxy.cpp: + (WebCore::IndexedDatabaseProxy::IndexedDatabaseProxy): + (WebCore::IndexedDatabaseProxy::open): + * src/IndexedDatabaseProxy.h: + * src/WebIDBDatabaseError.cpp: Added. + (WebKit::WebIDBDatabaseError::~WebIDBDatabaseError): + (WebKit::WebIDBDatabaseError::WebIDBDatabaseError): + (WebKit::WebIDBDatabaseError::assign): + (WebKit::WebIDBDatabaseError::code): + (WebKit::WebIDBDatabaseError::message): + (WebKit::WebIDBDatabaseError::operator=): + (WebKit::WebIDBDatabaseError::operator PassRefPtr<IDBDatabaseError>): + +2010-03-29 Mikhail Naganov <mnaganov@chromium.org> + + Reviewed by Pavel Feldman. + + Remove a possibility of confusion from Profiles panel Welcome screen + by turning buttons into non-clickable glyphs. Also, span instructions + alongside panel width. + + https://bugs.webkit.org/show_bug.cgi?id=34319 + + * src/js/HeapProfilerPanel.js: + (WebInspector.HeapSnapshotProfileType.prototype.get welcomeMessage): + +2010-03-28 Alexey Proskuryakov <ap@apple.com> + + Build fix. Removed extraneous includes of KeyboardCodesWin.h and KeyboardCodesPosix.h - + these no longer exist, but they weren't needed even before reshuffling KeyboardCodes headers. + + * src/WebViewImpl.cpp: + +2010-03-27 Kenneth Russell <kbr@google.com> + + Reviewed by Darin Fisher. + + Use WebKitClient to instantiate WebGraphicsContext3D + https://bugs.webkit.org/show_bug.cgi?id=36669 + + * src/GraphicsContext3D.cpp: + (WebCore::GraphicsContext3DInternal::initialize): + +2010-03-24 James Hawkins <jhawkins@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Implement WebFormControlElement and WebSelectElement. Add + a getFormControlElements method to WebFormElement. + + https://bugs.webkit.org/show_bug.cgi?id=36562 + + * WebKit.gyp: + * public/WebElement.h: + * public/WebFormControlElement.h: Added. + * public/WebFormElement.h: + * public/WebInputElement.h: + (WebKit::WebInputElement::WebInputElement): + (WebKit::WebInputElement::operator=): + (WebKit::WebInputElement::assign): + * public/WebSelectElement.h: Added. + * src/WebElement.cpp: + (WebKit::WebElement::isFormControlElement): + * src/WebFormControlElement.cpp: Added. + * src/WebFormElement.cpp: + (WebKit::WebFormElement::getFormControlElements): + * src/WebInputElement.cpp: + (WebKit::WebInputElement::WebInputElement): + * src/WebSelectElement.cpp: Added. + +2010-03-26 Andrey Kosyakov <caseq@chromium.org> + + Reviewed by Pavel Feldman. + + Send worker resource content to inspector to enable display of web + workers in inspector's resource tab. + https://bugs.webkit.org/show_bug.cgi?id=36658 + + * src/SharedWorkerRepository.cpp: + (WebCore::SharedWorkerScriptLoader::notifyFinished): + +2010-03-25 Tony Chang <tony@chromium.org> + + Reviewed by David Levin. + + [chromium] correctly handle move drag operations + https://bugs.webkit.org/show_bug.cgi?id=36484 + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::dragTargetDragEnter): + (WebKit::WebViewImpl::dragTargetDragOver): + (WebKit::WebViewImpl::dragTargetDragEnterOrOver): Combine common code into a helper method + and properly mask against the drag effect. + (WebKit::WebViewImpl::createUniqueIdentifierForRequest): + * src/WebViewImpl.h: + +2010-03-25 Drew Wilson <atwilson@chromium.org> + + Reviewed by Nate Chapin. + + [v8] Error in getScriptExecutionContext() when worker context is terminating + https://bugs.webkit.org/show_bug.cgi?id=36565 + + Test: Existing worker tests suffice. + + * src/WebWorkerClientImpl.cpp: + (WebKit::WebWorkerClientImpl::createWorkerContextProxy): + Changed to use WorkerScriptController::controllerForContext() instead of WorkerScriptExecutionProxy::retrieve(). + +2010-03-25 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Add an ASSERT macro to the Chromium WebKit API + https://bugs.webkit.org/show_bug.cgi?id=36545 + + * WebKit.gyp: Add WebCommon.cpp + * public/WebCommon.h: Add the Macro. + * public/WebPrivatePtr.h: + (WebKit::WebPrivatePtr::~WebPrivatePtr): Verify the pointer is now 0. + * src/WebCommon.cpp: Added. + (WebKit::failedAssertion): Calls the WTF assert function and then crashes. + +2010-03-25 Jochen Eisinger <jochen@chromium.org> + + Reviewed by Jeremy Orlow. + + Remove ASSERT(isMainThread()) which is violated for workers and not necessary at this point. + https://bugs.webkit.org/show_bug.cgi?id=36614 + + * src/DatabaseObserver.cpp: + (WebCore::DatabaseObserver::canEstablishDatabase): + +2010-03-25 Jochen Eisinger <jochen@chromium.org> + + Reviewed by Jeremy Orlow. + + Forward DatabaseTracker::canEstablishDatabase to chromium layer. + https://bugs.webkit.org/show_bug.cgi?id=36595 + + * public/WebFrameClient.h: + (WebKit::WebFrameClient::allowDatabase): + * src/DatabaseObserver.cpp: + (WebCore::DatabaseObserver::canEstablishDatabase): + * src/WebWorkerBase.h: + (WebKit::WebWorkerBase::allowDatabase): + +2010-03-10 John Abd-El-Malek <jam@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Fix up WebMouseWheelEventBuilder to properly calculate the units + https://bugs.webkit.org/show_bug.cgi?id=35989 + + * src/WebInputEventConversion.cpp: + +2010-03-24 Vangelis Kokkevis <vangelis@chromium.org> + + Reviewed by Dimitri Glazkov. + + Eliminate unecessary redraws of GraphicsLayer contents when doing accelerated compositing: + https://bugs.webkit.org/show_bug.cgi?id=36470 + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::paint): + Remove call that forced redrawing the contents of the entire layer hierarchy. + +2010-03-24 Dmitry Titov <dimich@chromium.org> + + No review, rolling out r56453. + http://trac.webkit.org/changeset/56453 + https://bugs.webkit.org/show_bug.cgi?id=36426 + + In Chromium port, it broke invalid-image-data-standalone.html + invalid-image-data.html multipart-wait-before-boundary.html + stop-crash.html win-boundary-crash.html + + * src/ResourceHandle.cpp: + (WebCore::ResourceHandleInternal::ResourceHandleInternal): + (WebCore::ResourceHandleInternal::start): + (WebCore::ResourceHandleInternal::cancel): + (WebCore::ResourceHandleInternal::didReceiveResponse): + (WebCore::ResourceHandleInternal::didReceiveData): + (WebCore::ResourceHandleInternal::didFinishLoading): + (WebCore::ResourceHandleInternal::didFail): + +2010-03-24 John Abd-El-Malek <jam@chromium.org> + + Reviewed by Darin Fisher. + + [chromium]WebKit side of adding search support to Pepper. + https://bugs.webkit.org/show_bug.cgi?id=36434 + + * WebKit.gyp: + * public/WebDocument.h: + * public/WebNode.h: + (WebKit::WebNode::to): + (WebKit::WebNode::toConst): + * public/WebPluginDocument.h: Added. + (WebKit::WebPluginDocument::WebPluginDocument): + (WebKit::WebPluginDocument::operator=): + (WebKit::WebPluginDocument::assign): + * src/WebDocument.cpp: + (WebKit::WebDocument::isPluginDocument): + * src/WebPluginDocument.cpp: Added. + (WebKit::WebPluginDocument::plugin): + (WebKit::WebPluginDocument::WebPluginDocument): + (WebKit::WebPluginDocument::operator=): + (WebKit::WebPluginDocument::operator PassRefPtr<PluginDocument>): + +2010-03-24 Jeremy Moskovich <jeremy@chromium.org> + + Reviewed by Jeremy Orlow. + + Add some diagnostics to try to track down cause of crash in ArchiveFactory::isArchiveMimeType(). + + https://bugs.webkit.org/show_bug.cgi?id=36426 + + * src/ResourceHandle.cpp: Track state across ResourceHandle invocations. + (WebCore::ResourceHandleInternal::ResourceHandleInternal): + (WebCore::ResourceHandleInternal::): + (WebCore::ResourceHandleInternal::start): + (WebCore::ResourceHandleInternal::cancel): + (WebCore::ResourceHandleInternal::didReceiveResponse): + (WebCore::ResourceHandleInternal::didReceiveData): + (WebCore::ResourceHandleInternal::didFinishLoading): + (WebCore::ResourceHandleInternal::didFail): + +2010-03-24 Jay Campan <jcampan@google.com> + + Reviewed by Darin Fisher. + + Making Chromium select popups not steal activation from the browser. + Select popups are now like autocomplete popups, shown in non-activated + windows. + https://bugs.webkit.org/show_bug.cgi?id=36062 + + * public/WebViewClient.h: + (WebKit::WebViewClient::createPopupMenu): + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::popupOpened): + (WebKit::ChromeClientImpl::popupClosed): + * src/ChromeClientImpl.h: + * src/WebViewImpl.cpp: + (WebKit::): + (WebKit::WebViewImpl::mouseDown): + (WebKit::WebViewImpl::keyEvent): + (WebKit::WebViewImpl::selectPopupHandleKeyEvent): + (WebKit::WebViewImpl::hideSelectPopup): + (WebKit::WebViewImpl::popupOpened): + (WebKit::WebViewImpl::popupClosed): + (WebKit::WebViewImpl::setFocus): + (WebKit::WebViewImpl::applyAutoFillSuggestions): + (WebKit::WebViewImpl::applyAutocompleteSuggestions): + * src/WebViewImpl.h: + +2010-03-24 Alexander Pavlov <apavlov@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: [Chromium] Audits never complete + https://bugs.webkit.org/show_bug.cgi?id=36544 + + * src/js/InspectorControllerImpl.js: + (devtools.InspectorBackendImpl): + +2010-03-24 Alexander Pavlov <apavlov@chromium.org> + + Reviewed by Pavel Feldman. + + [Chromium] Fix VKEY_F10, VKEY_F11 translation in WebInputEvent.cpp + https://bugs.webkit.org/show_bug.cgi?id=36524 + + * src/WebInputEvent.cpp: + (WebKit::staticKeyIdentifiers): + +2010-03-24 Kent Tamura <tkent@chromium.org> + + Reviewed by Darin Adler. + + Make Icon::createIconForFiles() optional. + https://bugs.webkit.org/show_bug.cgi?id=35072 + + - Rename iconForFiles() to chooseIconForFiles(). + - Call Icon::createIconForFiles() from chooseIconForFiles(). + + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::chooseIconForFiles): + * src/ChromeClientImpl.h: + +2010-03-23 Kenneth Russell <kbr@google.com> + + Unreviewed build fix. + + Add #include <stdio.h> to fix Chromium Linux build. + + * src/WebGraphicsContext3DDefaultImpl.cpp: + +2010-03-23 Nate Chapin <japhet@chromium.org> + + Unreviewed, revert r56376. + + This revision introduced a crash in a couple of layout tests + on Chromium Linux. + + * public/WebViewClient.h: + (WebKit::WebViewClient::createPopupMenu): + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::popupOpened): + * src/ChromeClientImpl.h: + * src/WebViewImpl.cpp: + (WebKit::): + (WebKit::WebViewImpl::mouseDown): + (WebKit::WebViewImpl::keyEvent): + (WebKit::WebViewImpl::setFocus): + (WebKit::WebViewImpl::applyAutoFillSuggestions): + (WebKit::WebViewImpl::applyAutocompleteSuggestions): + * src/WebViewImpl.h: + +2010-03-23 Sergey Ulanov <sergeyu@chromium.org> + + Reviewed by Dmitry Titov. + + Changes needed to implement Show/Hide Controls command for <video> in + chrome: (1) added Controls action in WebMediaPlayerAction that toggles + controls for media player, (2) added MediaHasVideo in + WebContextMenuData so that controls can be made toggleable only for + video player but not for audio. + https://bugs.webkit.org/show_bug.cgi?id=36460 + + * public/WebContextMenuData.h: + (WebKit::WebContextMenuData::): + * public/WebMediaPlayerAction.h: + (WebKit::WebMediaPlayerAction::): + * src/ContextMenuClientImpl.cpp: + (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::performMediaPlayerAction): + +2010-03-23 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + When uncaught exception happens reveal Scripts panel only if reporting uncaught exceptions is on. + + https://bugs.webkit.org/show_bug.cgi?id=36498 + + * src/js/DebuggerAgent.js: + (devtools.DebuggerAgent.prototype.handleExceptionEvent_): + +2010-03-23 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: TimelinePanel stays in the recording state after reopening WebInspector. + https://bugs.webkit.org/show_bug.cgi?id=36503 + + * src/WebDevToolsAgentImpl.cpp: + (WebKit::WebDevToolsAgentImpl::detach): + +2010-03-22 Kenneth Russell <kbr@google.com> + + Reviewed by Darin Fisher. + + Add GraphicsContext3D abstraction to WebKit API + https://bugs.webkit.org/show_bug.cgi?id=36262 + + Added WebGraphicsContext3D to the WebKit API and refactored Chromium's + GraphicsContext3D implementation to use it. All of the OpenGL calls have + been moved out of WebKit/chromium/src/GraphicsContext3D.cpp and into the + WebGraphicsContext3D implementation. GraphicsContext3D is still + responsible for the transfer of rendered output from the + WebGraphicsContext3D to the HTMLCanvasElement. + + The GraphicsContext3DInternal class, which is a data member of + GraphicsContext3D for the Chromium port, remains. It is possible to + eliminate this class and thereby one level of delegation, but this is + being deferred. + + The needed entry point for a Chrome implementation of + WebGraphicsContext3D has been added to WebKitClient, but it is not being + called yet by GraphicsContext3D. It will be once this patch lands and + Chromium is rolled forward to support this entry point. + + This is a large patch, but the transformation is almost entirely + mechanical and there is no change in functionality. Nearly all of + GraphicsContext3D and GraphicsContext3DInternal has been moved to + WebGraphicsContext3DDefaultImpl. The only area where the splitting of + logic is less than mechanical is GraphicsContext3D::beginPaint() and its + callees. + + Ran all WebGL layout tests and demos from Khronos site in Chromium + on Mac and Windows. + + * WebKit.gyp: + * public/WebGraphicsContext3D.h: Added. + (WebKit::WebGraphicsContext3D::Attributes::Attributes): + (WebKit::WebGraphicsContext3D::~WebGraphicsContext3D): + * public/WebKitClient.h: + (WebKit::WebKitClient::createGraphicsContext3D): + * src/GraphicsContext3D.cpp: + (WebCore::GraphicsContext3DInternal::GraphicsContext3DInternal): + (WebCore::GraphicsContext3DInternal::~GraphicsContext3DInternal): + (WebCore::GraphicsContext3DInternal::initialize): + (WebCore::GraphicsContext3DInternal::platformGraphicsContext3D): + (WebCore::GraphicsContext3DInternal::platformTexture): + (WebCore::GraphicsContext3DInternal::beginPaint): + (WebCore::GraphicsContext3DInternal::endPaint): + (WebCore::GraphicsContext3DInternal::reshape): + (WebCore::GraphicsContext3DInternal::bindAttribLocation): + (WebCore::GraphicsContext3DInternal::bindTexture): + (WebCore::GraphicsContext3DInternal::bufferData): + (WebCore::GraphicsContext3DInternal::bufferSubData): + (WebCore::GraphicsContext3DInternal::getActiveAttrib): + (WebCore::GraphicsContext3DInternal::getActiveUniform): + (WebCore::GraphicsContext3DInternal::getAttribLocation): + (WebCore::GraphicsContext3DInternal::getContextAttributes): + (WebCore::GraphicsContext3DInternal::getProgramInfoLog): + (WebCore::GraphicsContext3DInternal::getShaderInfoLog): + (WebCore::GraphicsContext3DInternal::getShaderSource): + (WebCore::GraphicsContext3DInternal::getString): + (WebCore::GraphicsContext3DInternal::getUniformLocation): + (WebCore::GraphicsContext3DInternal::readPixels): + (WebCore::GraphicsContext3DInternal::shaderSource): + (WebCore::GraphicsContext3DInternal::texImage2D): + (WebCore::GraphicsContext3DInternal::texSubImage2D): + (WebCore::GraphicsContext3DInternal::uniform1fv): + (WebCore::GraphicsContext3DInternal::uniform1iv): + (WebCore::GraphicsContext3DInternal::uniform2fv): + (WebCore::GraphicsContext3DInternal::uniform2iv): + (WebCore::GraphicsContext3DInternal::uniform3fv): + (WebCore::GraphicsContext3DInternal::uniform3iv): + (WebCore::GraphicsContext3DInternal::uniform4fv): + (WebCore::GraphicsContext3DInternal::uniform4iv): + (WebCore::GraphicsContext3DInternal::uniformMatrix2fv): + (WebCore::GraphicsContext3DInternal::uniformMatrix3fv): + (WebCore::GraphicsContext3DInternal::uniformMatrix4fv): + (WebCore::GraphicsContext3D::GraphicsContext3D): + (WebCore::GraphicsContext3D::~GraphicsContext3D): + (WebCore::GraphicsContext3D::create): + (WebCore::GraphicsContext3D::platformGraphicsContext3D): + (WebCore::GraphicsContext3D::platformTexture): + (WebCore::GraphicsContext3D::texImage2D): + (WebCore::GraphicsContext3D::texSubImage2D): + * src/WebGraphicsContext3D.cpp: Added. + (WebKit::WebGraphicsContext3D::createDefault): + * src/WebGraphicsContext3DDefaultImpl.cpp: Added. + (WebKit::WebGraphicsContext3DDefaultImpl::GLConnection::create): + (WebKit::WebGraphicsContext3DDefaultImpl::GLConnection::~GLConnection): + (WebKit::WebGraphicsContext3DDefaultImpl::VertexAttribPointerState::VertexAttribPointerState): + (WebKit::WebGraphicsContext3DDefaultImpl::WebGraphicsContext3DDefaultImpl): + (WebKit::WebGraphicsContext3DDefaultImpl::~WebGraphicsContext3DDefaultImpl): + (WebKit::WebGraphicsContext3DDefaultImpl::initialize): + (WebKit::WebGraphicsContext3DDefaultImpl::makeContextCurrent): + (WebKit::WebGraphicsContext3DDefaultImpl::width): + (WebKit::WebGraphicsContext3DDefaultImpl::height): + (WebKit::WebGraphicsContext3DDefaultImpl::sizeInBytes): + (WebKit::createTextureObject): + (WebKit::WebGraphicsContext3DDefaultImpl::reshape): + (WebKit::WebGraphicsContext3DDefaultImpl::flipVertically): + (WebKit::WebGraphicsContext3DDefaultImpl::readBackFramebuffer): + (WebKit::WebGraphicsContext3DDefaultImpl::activeTexture): + (WebKit::WebGraphicsContext3DDefaultImpl::bindBuffer): + (WebKit::WebGraphicsContext3DDefaultImpl::bindFramebuffer): + (WebKit::WebGraphicsContext3DDefaultImpl::disableVertexAttribArray): + (WebKit::WebGraphicsContext3DDefaultImpl::drawElements): + (WebKit::WebGraphicsContext3DDefaultImpl::enableVertexAttribArray): + (WebKit::WebGraphicsContext3DDefaultImpl::generateMipmap): + (WebKit::WebGraphicsContext3DDefaultImpl::getActiveAttrib): + (WebKit::WebGraphicsContext3DDefaultImpl::getActiveUniform): + (WebKit::WebGraphicsContext3DDefaultImpl::getContextAttributes): + (WebKit::WebGraphicsContext3DDefaultImpl::getError): + (WebKit::WebGraphicsContext3DDefaultImpl::getProgramInfoLog): + (WebKit::WebGraphicsContext3DDefaultImpl::getShaderInfoLog): + (WebKit::WebGraphicsContext3DDefaultImpl::getShaderSource): + (WebKit::WebGraphicsContext3DDefaultImpl::getString): + (WebKit::WebGraphicsContext3DDefaultImpl::getVertexAttribOffset): + (WebKit::WebGraphicsContext3DDefaultImpl::releaseShaderCompiler): + (WebKit::WebGraphicsContext3DDefaultImpl::shaderSource): + (WebKit::WebGraphicsContext3DDefaultImpl::vertexAttribPointer): + (WebKit::WebGraphicsContext3DDefaultImpl::createBuffer): + (WebKit::WebGraphicsContext3DDefaultImpl::createFramebuffer): + (WebKit::WebGraphicsContext3DDefaultImpl::createProgram): + (WebKit::WebGraphicsContext3DDefaultImpl::createRenderbuffer): + (WebKit::WebGraphicsContext3DDefaultImpl::createTexture): + (WebKit::WebGraphicsContext3DDefaultImpl::deleteBuffer): + (WebKit::WebGraphicsContext3DDefaultImpl::deleteFramebuffer): + (WebKit::WebGraphicsContext3DDefaultImpl::deleteProgram): + (WebKit::WebGraphicsContext3DDefaultImpl::deleteRenderbuffer): + (WebKit::WebGraphicsContext3DDefaultImpl::deleteShader): + (WebKit::WebGraphicsContext3DDefaultImpl::deleteTexture): + (WebKit::WebGraphicsContext3DDefaultImpl::synthesizeGLError): + * src/WebGraphicsContext3DDefaultImpl.h: Added. + (WebKit::WebGraphicsContext3DDefaultImpl::): + (WebKit::WebGraphicsContext3DDefaultImpl::GLConnection::chooseFBConfig): + (WebKit::WebGraphicsContext3DDefaultImpl::GLConnection::createNewContext): + (WebKit::WebGraphicsContext3DDefaultImpl::GLConnection::createPbuffer): + (WebKit::WebGraphicsContext3DDefaultImpl::GLConnection::destroyPbuffer): + (WebKit::WebGraphicsContext3DDefaultImpl::GLConnection::makeCurrent): + (WebKit::WebGraphicsContext3DDefaultImpl::GLConnection::destroyContext): + (WebKit::WebGraphicsContext3DDefaultImpl::GLConnection::getCurrentContext): + (WebKit::WebGraphicsContext3DDefaultImpl::GLConnection::GLConnection): + +2010-03-22 Jay Campan <jcampan@google.com> + + Reviewed by Darin Fisher. + + Making Chromium select popups not steal activation from the browser. + Select popups are now like autocomplete popups, shown in non-activated + windows. + https://bugs.webkit.org/show_bug.cgi?id=36062 + + * public/WebViewClient.h: + (WebKit::WebViewClient::createPopupMenu): + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::popupOpened): + (WebKit::ChromeClientImpl::popupClosed): + * src/ChromeClientImpl.h: + * src/WebViewImpl.cpp: + (WebKit::): + (WebKit::WebViewImpl::mouseDown): + (WebKit::WebViewImpl::keyEvent): + (WebKit::WebViewImpl::selectPopupHandleKeyEvent): + (WebKit::WebViewImpl::hideSelectPopup): + (WebKit::WebViewImpl::popupOpened): + (WebKit::WebViewImpl::popupClosed): + (WebKit::WebViewImpl::setFocus): + (WebKit::WebViewImpl::applyAutoFillSuggestions): + (WebKit::WebViewImpl::applyAutocompleteSuggestions): + * src/WebViewImpl.h: + +2010-03-22 Darin Fisher <darin@chromium.org> + + Reviewed by Nate Chapin. + + [chromium] Renderer crashes when navigating to a reference fragment in + a frame that has no current HistoryItem. + + https://bugs.webkit.org/show_bug.cgi?id=36443 + + Test: fast/loader/crash-replacing-location-before-load.html + + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::dispatchDidNavigateWithinPage): + +2010-03-22 Kevin Decker <kdecker@apple.com> + + Reviewed by John Sullivan. + + https://bugs.webkit.org/show_bug.cgi?id=36328 + + * src/LocalizedStrings.cpp: + (WebCore::missingPluginText): Added + +2010-03-22 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Fix inspected Page crash in destructor when Web Inspector is open. + + https://bugs.webkit.org/show_bug.cgi?id=36441 + + * src/js/InjectDispatch.js: + (inspectedPageDestroyed): Added stub for missing method. + +2010-03-22 Jochen Eisinger <jochen@chromium.org> + + Reviewed by Jeremy Orlow. + + Added methods to WebSecurityOrigin for invoking + SecurityOrigin::canAccess and SecurityOrigin::Create + https://bugs.webkit.org/show_bug.cgi?id=36356 + + * public/WebSecurityOrigin.h: + * src/WebSecurityOrigin.cpp: + (WebKit::WebSecurityOrigin::create): + (WebKit::WebSecurityOrigin::canAccess): + +2010-03-20 Dimitri Glazkov <dglazkov@chromium.org> + + No review, rolling out r56294. + http://trac.webkit.org/changeset/56294 + https://bugs.webkit.org/show_bug.cgi?id=36262 + + Broke compile on Chromium canaries. + + * WebKit.gyp: + * public/WebGraphicsContext3D.h: Removed. + * public/WebKitClient.h: + * src/GraphicsContext3D.cpp: + (WebCore::GraphicsContext3DInternal::): + (WebCore::GraphicsContext3DInternal::GLConnection::chooseFBConfig): + (WebCore::GraphicsContext3DInternal::GLConnection::createNewContext): + (WebCore::GraphicsContext3DInternal::GLConnection::createPbuffer): + (WebCore::GraphicsContext3DInternal::GLConnection::destroyPbuffer): + (WebCore::GraphicsContext3DInternal::GLConnection::makeCurrent): + (WebCore::GraphicsContext3DInternal::GLConnection::destroyContext): + (WebCore::GraphicsContext3DInternal::GLConnection::getCurrentContext): + (WebCore::GraphicsContext3DInternal::GLConnection::GLConnection): + (WebCore::GraphicsContext3DInternal::GLConnection::create): + (WebCore::GraphicsContext3DInternal::GLConnection::~GLConnection): + (WebCore::GraphicsContext3DInternal::VertexAttribPointerState::VertexAttribPointerState): + (WebCore::GraphicsContext3DInternal::GraphicsContext3DInternal): + (WebCore::GraphicsContext3DInternal::~GraphicsContext3DInternal): + (WebCore::GraphicsContext3DInternal::makeContextCurrent): + (WebCore::GraphicsContext3DInternal::platformGraphicsContext3D): + (WebCore::GraphicsContext3DInternal::platformTexture): + (WebCore::createTextureObject): + (WebCore::GraphicsContext3DInternal::reshape): + (WebCore::GraphicsContext3DInternal::flipVertically): + (WebCore::GraphicsContext3DInternal::beginPaint): + (WebCore::GraphicsContext3DInternal::activeTexture): + (WebCore::GraphicsContext3DInternal::bindBuffer): + (WebCore::GraphicsContext3DInternal::bindFramebuffer): + (WebCore::GraphicsContext3DInternal::bindTexture): + (WebCore::GraphicsContext3DInternal::bufferDataImpl): + (WebCore::GraphicsContext3DInternal::disableVertexAttribArray): + (WebCore::GraphicsContext3DInternal::enableVertexAttribArray): + (WebCore::GraphicsContext3DInternal::getError): + (WebCore::GraphicsContext3DInternal::getContextAttributes): + (WebCore::GraphicsContext3DInternal::vertexAttribPointer): + (WebCore::GraphicsContext3DInternal::viewportImpl): + (WebCore::GraphicsContext3DInternal::synthesizeGLError): + (WebCore::GraphicsContext3D::create): + (WebCore::GraphicsContext3D::GraphicsContext3D): + (WebCore::GraphicsContext3D::~GraphicsContext3D): + (WebCore::GraphicsContext3D::platformGraphicsContext3D): + (WebCore::GraphicsContext3D::platformTexture): + (WebCore::GraphicsContext3D::makeContextCurrent): + (WebCore::GraphicsContext3D::reshape): + (WebCore::GraphicsContext3D::beginPaint): + (WebCore::GraphicsContext3D::endPaint): + (WebCore::GraphicsContext3D::sizeInBytes): + (WebCore::GraphicsContext3D::createBuffer): + (WebCore::GraphicsContext3D::createFramebuffer): + (WebCore::GraphicsContext3D::createProgram): + (WebCore::GraphicsContext3D::createRenderbuffer): + (WebCore::GraphicsContext3D::createShader): + (WebCore::GraphicsContext3D::createTexture): + (WebCore::GraphicsContext3D::deleteBuffer): + (WebCore::GraphicsContext3D::deleteFramebuffer): + (WebCore::GraphicsContext3D::deleteProgram): + (WebCore::GraphicsContext3D::deleteRenderbuffer): + (WebCore::GraphicsContext3D::deleteShader): + (WebCore::GraphicsContext3D::deleteTexture): + (WebCore::GraphicsContext3D::activeTexture): + (WebCore::GraphicsContext3D::bindAttribLocation): + (WebCore::GraphicsContext3D::bindBuffer): + (WebCore::GraphicsContext3D::bindFramebuffer): + (WebCore::GraphicsContext3D::bindTexture): + (WebCore::GraphicsContext3D::bufferData): + (WebCore::GraphicsContext3D::bufferSubData): + (WebCore::GraphicsContext3D::checkFramebufferStatus): + (WebCore::GraphicsContext3D::detachShader): + (WebCore::GraphicsContext3D::disableVertexAttribArray): + (WebCore::GraphicsContext3D::drawArrays): + (WebCore::GraphicsContext3D::drawElements): + (WebCore::GraphicsContext3D::enableVertexAttribArray): + (WebCore::GraphicsContext3D::generateMipmap): + (WebCore::GraphicsContext3D::getActiveAttrib): + (WebCore::GraphicsContext3D::getActiveUniform): + (WebCore::GraphicsContext3D::getAttribLocation): + (WebCore::GraphicsContext3D::getBooleanv): + (WebCore::GraphicsContext3D::getBufferParameteriv): + (WebCore::GraphicsContext3D::getContextAttributes): + (WebCore::GraphicsContext3D::getError): + (WebCore::GraphicsContext3D::getFloatv): + (WebCore::GraphicsContext3D::getFramebufferAttachmentParameteriv): + (WebCore::GraphicsContext3D::getIntegerv): + (WebCore::GraphicsContext3D::getProgramiv): + (WebCore::GraphicsContext3D::getProgramInfoLog): + (WebCore::GraphicsContext3D::getRenderbufferParameteriv): + (WebCore::GraphicsContext3D::getShaderiv): + (WebCore::GraphicsContext3D::getShaderInfoLog): + (WebCore::GraphicsContext3D::getShaderSource): + (WebCore::GraphicsContext3D::getString): + (WebCore::GraphicsContext3D::getTexParameterfv): + (WebCore::GraphicsContext3D::getTexParameteriv): + (WebCore::GraphicsContext3D::getUniformfv): + (WebCore::GraphicsContext3D::getUniformiv): + (WebCore::GraphicsContext3D::getUniformLocation): + (WebCore::GraphicsContext3D::getVertexAttribfv): + (WebCore::GraphicsContext3D::getVertexAttribiv): + (WebCore::GraphicsContext3D::getVertexAttribOffset): + (WebCore::GraphicsContext3D::isBuffer): + (WebCore::GraphicsContext3D::isEnabled): + (WebCore::GraphicsContext3D::isFramebuffer): + (WebCore::GraphicsContext3D::isProgram): + (WebCore::GraphicsContext3D::isRenderbuffer): + (WebCore::GraphicsContext3D::isShader): + (WebCore::GraphicsContext3D::isTexture): + (WebCore::GraphicsContext3D::pixelStorei): + (WebCore::GraphicsContext3D::readPixels): + (WebCore::GraphicsContext3D::releaseShaderCompiler): + (WebCore::GraphicsContext3D::shaderSource): + (WebCore::GraphicsContext3D::synthesizeGLError): + (WebCore::GraphicsContext3D::texImage2D): + (WebCore::GraphicsContext3D::texSubImage2D): + (WebCore::GraphicsContext3D::uniform1fv): + (WebCore::GraphicsContext3D::uniform1iv): + (WebCore::GraphicsContext3D::uniform2fv): + (WebCore::GraphicsContext3D::uniform2iv): + (WebCore::GraphicsContext3D::uniform3fv): + (WebCore::GraphicsContext3D::uniform3iv): + (WebCore::GraphicsContext3D::uniform4fv): + (WebCore::GraphicsContext3D::uniform4iv): + (WebCore::GraphicsContext3D::uniformMatrix2fv): + (WebCore::GraphicsContext3D::uniformMatrix3fv): + (WebCore::GraphicsContext3D::uniformMatrix4fv): + (WebCore::GraphicsContext3D::vertexAttrib1fv): + (WebCore::GraphicsContext3D::vertexAttrib2fv): + (WebCore::GraphicsContext3D::vertexAttrib3fv): + (WebCore::GraphicsContext3D::vertexAttrib4fv): + (WebCore::GraphicsContext3D::vertexAttribPointer): + (WebCore::GraphicsContext3D::viewport): + * src/WebGraphicsContext3D.cpp: Removed. + * src/WebGraphicsContext3DDefaultImpl.cpp: Removed. + * src/WebGraphicsContext3DDefaultImpl.h: Removed. + +2010-03-19 Kenneth Russell <kbr@google.com> + + Reviewed by Darin Fisher. + + Add GraphicsContext3D abstraction to WebKit API + https://bugs.webkit.org/show_bug.cgi?id=36262 + + Added WebGraphicsContext3D to the WebKit API and refactored Chromium's + GraphicsContext3D implementation to use it. All of the OpenGL calls have + been moved out of WebKit/chromium/src/GraphicsContext3D.cpp and into the + WebGraphicsContext3D implementation. GraphicsContext3D is still + responsible for the transfer of rendered output from the + WebGraphicsContext3D to the HTMLCanvasElement. + + The GraphicsContext3DInternal class, which is a data member of + GraphicsContext3D for the Chromium port, remains. It is possible to + eliminate this class and thereby one level of delegation, but this is + being deferred. + + The needed entry point for a Chrome implementation of + WebGraphicsContext3D has been added to WebKitClient, but it is not being + called yet by GraphicsContext3D. It will be once this patch lands and + Chromium is rolled forward to support this entry point. + + This is a large patch, but the transformation is almost entirely + mechanical and there is no change in functionality. Nearly all of + GraphicsContext3D and GraphicsContext3DInternal has been moved to + WebGraphicsContext3DDefaultImpl. The only area where the splitting of + logic is less than mechanical is GraphicsContext3D::beginPaint() and its + callees. + + Ran all WebGL layout tests and demos from Khronos site in Chromium. + + * WebKit.gyp: + * public/WebGraphicsContext3D.h: Added. + (WebKit::WebGraphicsContext3D::Attributes::Attributes): + (WebKit::WebGraphicsContext3D::~WebGraphicsContext3D): + * public/WebKitClient.h: + (WebKit::WebKitClient::createGraphicsContext3D): + * src/GraphicsContext3D.cpp: + (WebCore::GraphicsContext3DInternal::GraphicsContext3DInternal): + (WebCore::GraphicsContext3DInternal::~GraphicsContext3DInternal): + (WebCore::GraphicsContext3DInternal::initialize): + (WebCore::GraphicsContext3DInternal::platformGraphicsContext3D): + (WebCore::GraphicsContext3DInternal::platformTexture): + (WebCore::GraphicsContext3DInternal::beginPaint): + (WebCore::GraphicsContext3DInternal::endPaint): + (WebCore::GraphicsContext3DInternal::reshape): + (WebCore::GraphicsContext3DInternal::bindAttribLocation): + (WebCore::GraphicsContext3DInternal::bindTexture): + (WebCore::GraphicsContext3DInternal::bufferData): + (WebCore::GraphicsContext3DInternal::bufferSubData): + (WebCore::GraphicsContext3DInternal::getActiveAttrib): + (WebCore::GraphicsContext3DInternal::getActiveUniform): + (WebCore::GraphicsContext3DInternal::getAttribLocation): + (WebCore::GraphicsContext3DInternal::getContextAttributes): + (WebCore::GraphicsContext3DInternal::getProgramInfoLog): + (WebCore::GraphicsContext3DInternal::getShaderInfoLog): + (WebCore::GraphicsContext3DInternal::getShaderSource): + (WebCore::GraphicsContext3DInternal::getString): + (WebCore::GraphicsContext3DInternal::getUniformLocation): + (WebCore::GraphicsContext3DInternal::readPixels): + (WebCore::GraphicsContext3DInternal::shaderSource): + (WebCore::GraphicsContext3DInternal::texImage2D): + (WebCore::GraphicsContext3DInternal::texSubImage2D): + (WebCore::GraphicsContext3DInternal::uniform1fv): + (WebCore::GraphicsContext3DInternal::uniform1iv): + (WebCore::GraphicsContext3DInternal::uniform2fv): + (WebCore::GraphicsContext3DInternal::uniform2iv): + (WebCore::GraphicsContext3DInternal::uniform3fv): + (WebCore::GraphicsContext3DInternal::uniform3iv): + (WebCore::GraphicsContext3DInternal::uniform4fv): + (WebCore::GraphicsContext3DInternal::uniform4iv): + (WebCore::GraphicsContext3DInternal::uniformMatrix2fv): + (WebCore::GraphicsContext3DInternal::uniformMatrix3fv): + (WebCore::GraphicsContext3DInternal::uniformMatrix4fv): + (WebCore::GraphicsContext3D::GraphicsContext3D): + (WebCore::GraphicsContext3D::~GraphicsContext3D): + (WebCore::GraphicsContext3D::create): + (WebCore::GraphicsContext3D::platformGraphicsContext3D): + (WebCore::GraphicsContext3D::platformTexture): + (WebCore::GraphicsContext3D::texImage2D): + (WebCore::GraphicsContext3D::texSubImage2D): + * src/WebGraphicsContext3D.cpp: Added. + (WebKit::WebGraphicsContext3D::createDefault): + * src/WebGraphicsContext3DDefaultImpl.cpp: Added. + (WebKit::WebGraphicsContext3DDefaultImpl::GLConnection::create): + (WebKit::WebGraphicsContext3DDefaultImpl::GLConnection::~GLConnection): + (WebKit::WebGraphicsContext3DDefaultImpl::VertexAttribPointerState::VertexAttribPointerState): + (WebKit::WebGraphicsContext3DDefaultImpl::WebGraphicsContext3DDefaultImpl): + (WebKit::WebGraphicsContext3DDefaultImpl::~WebGraphicsContext3DDefaultImpl): + (WebKit::WebGraphicsContext3DDefaultImpl::initialize): + (WebKit::WebGraphicsContext3DDefaultImpl::makeContextCurrent): + (WebKit::WebGraphicsContext3DDefaultImpl::width): + (WebKit::WebGraphicsContext3DDefaultImpl::height): + (WebKit::WebGraphicsContext3DDefaultImpl::sizeInBytes): + (WebKit::createTextureObject): + (WebKit::WebGraphicsContext3DDefaultImpl::reshape): + (WebKit::WebGraphicsContext3DDefaultImpl::flipVertically): + (WebKit::WebGraphicsContext3DDefaultImpl::readBackFramebuffer): + (WebKit::WebGraphicsContext3DDefaultImpl::activeTexture): + (WebKit::WebGraphicsContext3DDefaultImpl::bindBuffer): + (WebKit::WebGraphicsContext3DDefaultImpl::bindFramebuffer): + (WebKit::WebGraphicsContext3DDefaultImpl::disableVertexAttribArray): + (WebKit::WebGraphicsContext3DDefaultImpl::drawElements): + (WebKit::WebGraphicsContext3DDefaultImpl::enableVertexAttribArray): + (WebKit::WebGraphicsContext3DDefaultImpl::generateMipmap): + (WebKit::WebGraphicsContext3DDefaultImpl::getActiveAttrib): + (WebKit::WebGraphicsContext3DDefaultImpl::getActiveUniform): + (WebKit::WebGraphicsContext3DDefaultImpl::getContextAttributes): + (WebKit::WebGraphicsContext3DDefaultImpl::getError): + (WebKit::WebGraphicsContext3DDefaultImpl::getProgramInfoLog): + (WebKit::WebGraphicsContext3DDefaultImpl::getShaderInfoLog): + (WebKit::WebGraphicsContext3DDefaultImpl::getShaderSource): + (WebKit::WebGraphicsContext3DDefaultImpl::getString): + (WebKit::WebGraphicsContext3DDefaultImpl::getVertexAttribOffset): + (WebKit::WebGraphicsContext3DDefaultImpl::releaseShaderCompiler): + (WebKit::WebGraphicsContext3DDefaultImpl::shaderSource): + (WebKit::WebGraphicsContext3DDefaultImpl::vertexAttribPointer): + (WebKit::WebGraphicsContext3DDefaultImpl::createBuffer): + (WebKit::WebGraphicsContext3DDefaultImpl::createFramebuffer): + (WebKit::WebGraphicsContext3DDefaultImpl::createProgram): + (WebKit::WebGraphicsContext3DDefaultImpl::createRenderbuffer): + (WebKit::WebGraphicsContext3DDefaultImpl::createTexture): + (WebKit::WebGraphicsContext3DDefaultImpl::deleteBuffer): + (WebKit::WebGraphicsContext3DDefaultImpl::deleteFramebuffer): + (WebKit::WebGraphicsContext3DDefaultImpl::deleteProgram): + (WebKit::WebGraphicsContext3DDefaultImpl::deleteRenderbuffer): + (WebKit::WebGraphicsContext3DDefaultImpl::deleteShader): + (WebKit::WebGraphicsContext3DDefaultImpl::deleteTexture): + (WebKit::WebGraphicsContext3DDefaultImpl::synthesizeGLError): + * src/WebGraphicsContext3DDefaultImpl.h: Added. + (WebKit::WebGraphicsContext3DDefaultImpl::): + (WebKit::WebGraphicsContext3DDefaultImpl::GLConnection::chooseFBConfig): + (WebKit::WebGraphicsContext3DDefaultImpl::GLConnection::createNewContext): + (WebKit::WebGraphicsContext3DDefaultImpl::GLConnection::createPbuffer): + (WebKit::WebGraphicsContext3DDefaultImpl::GLConnection::destroyPbuffer): + (WebKit::WebGraphicsContext3DDefaultImpl::GLConnection::makeCurrent): + (WebKit::WebGraphicsContext3DDefaultImpl::GLConnection::destroyContext): + (WebKit::WebGraphicsContext3DDefaultImpl::GLConnection::getCurrentContext): + (WebKit::WebGraphicsContext3DDefaultImpl::GLConnection::GLConnection): + +2010-03-19 Dimitri Glazkov <dglazkov@chromium.org> + + Unreviewed, build fix. + + Rename enqueueStorageEvent to enqueueEvent to match changes in + http://trac.webkit.org/changeset/56249. + + * src/StorageAreaProxy.cpp: + (WebCore::StorageAreaProxy::storageEvent): Renamed. + +2010-03-19 Darin Fisher <darin@chromium.org> + + Reviewed by Dimitri Glazkov. + + [chromium] querying the current history item during a back/forward + navigation should not clobber the scroll offset, etc. + https://bugs.webkit.org/show_bug.cgi?id=36347 + + We should only allow the current history item to be modified if we are + no longer loading or if the load is a new navigation (i.e., not a + back/forward/reload variant). + + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::currentHistoryItem): + +2010-03-18 Vangelis Kokkevis <vangelis@chromium.org> + + Reviewed by Adam Barth. + + Adding support for the ACCELERATED_COMPOSITING render path to Chromium. + https://bugs.webkit.org/show_bug.cgi?id=35557 + Currently compositing of layers is performed via s/w compositor which relies on Skia. This is an initial check-in + and it's only been tested on Windows. Compiling the code requires seting "use_accelerated_compositing=1" + to GYP_DEFINES. The update of layer contents and compositing is fairly inefficient but this will be fixed in + subsequent check-ins. + + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::attachRootGraphicsLayer): + (WebKit::ChromeClientImpl::scheduleCompositingLayerSync): + * src/ChromeClientImpl.h: + (WebKit::ChromeClientImpl::setNeedsOneShotDrawingSynchronization): + Added methods required by the RenderLayerCompositor + + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::paintWithContext): + (WebKit::WebFrameImpl::paint): + * src/WebFrameImpl.h: + Split WebFrameImpl::paint() into two methods to make it possible to call the paint + routine with an existing GraphicsContext, which is necessary for painting the root layer into + its own backing surface. + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::WebViewImpl): + (WebKit::WebViewImpl::paint): + Modified method to handle the accelerated compositing path. Now, when doing accelerated compositing, + paint() results in repainting the contents of the root layer and then doing a composite operation. + (WebKit::WebViewImpl::setRootGraphicsLayer): + (WebKit::WebViewImpl::setAcceleratedCompositing): + (WebKit::WebViewImpl::updateRootLayerContents): + (WebKit::WebViewImpl::setRootLayerNeedsDisplay): + * src/WebViewImpl.h: + (WebKit::WebViewImpl::isAcceleratedCompositing): + +2010-03-18 Jian Li <jianli@chromium.org> + + Reviewed by Darin Fisher. + + Chromium interface change to support Blob.slice. + https://bugs.webkit.org/show_bug.cgi?id=35318 + + * features.gypi: + * public/WebHTTPBody.h: + * public/WebKitClient.h: + (WebKit::WebKitClient::getFileModificationTime): + * src/ChromiumBridge.cpp: + (WebCore::ChromiumBridge::getFileModificationTime): + * src/WebHTTPBody.cpp: + (WebKit::WebHTTPBody::elementAt): + (WebKit::WebHTTPBody::appendFile): + (WebKit::WebHTTPBody::appendFileRange): + +2010-03-12 Ojan Vafai <ojan@chromium.org> + + Reviewed by David Levin. + + smartdelete should only occur after double-click + https://bugs.webkit.org/show_bug.cgi?id=35314 + + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::selectWordAroundPosition): + +2010-03-18 Nate Chapin <japhet@chromium.org> + + Unreviewed, build fix. + + Left a parentheses unclosed somehow. + + * src/WebDevToolsFrontendImpl.cpp: + (WebKit::WebDevToolsFrontendImpl::jsShowContextMenu): + +2010-03-18 Nate Chapin <japhet@chromium.org> + + Reviewed by Dimitri Glazkov. + + Remove all references to V8Index.h and V8ClassIndex. + + https://bugs.webkit.org/show_bug.cgi?id=33477 + + * src/WebBindings.cpp: + (WebKit::getRangeImpl): + * src/WebDevToolsAgentImpl.cpp: + * src/WebDevToolsFrontendImpl.cpp: + (WebKit::WebDevToolsFrontendImpl::jsShowContextMenu): + +2010-03-17 Garret Kelly <gdk@chromium.org> + + Reviewed by Darin Fisher. + + PlatformTouchEventBuilder should not be resizing the touch point + array before appending touch points to it. + https://bugs.webkit.org/show_bug.cgi?id=36231 + + * src/WebInputEventConversion.cpp: + (WebKit::PlatformTouchEventBuilder::PlatformTouchEventBuilder): + +2010-03-17 Dmitry Titov <dimich@chromium.org> + + Reviewed by Dimitri Glazkov. + + [chromium] Roll Chromium builder's DEPS to current revs. + https://bugs.webkit.org/show_bug.cgi?id=36241 + + * DEPS: + +2010-03-17 Kenneth Russell <kbr@google.com> + + Reviewed by Darin Fisher. + + Revert WebGL context attributes changes 33416 / r56074 and 36200 / r56093 + https://bugs.webkit.org/show_bug.cgi?id=36233 + + The patch for bug 33416, which added multisampling support to the + WebGL back buffer, uncovered some OpenGL driver bugs on the build + bots which need further investigation to determine the appropriate + workaround. Reverting this change, the minor build fix in 36189, + and the skipping of the affected tests in bug 36200. + + Built and tested WebKit and Chromium and ran all WebGL layout + tests in both. + + * src/GraphicsContext3D.cpp: + (WebCore::GraphicsContext3DInternal::GraphicsContext3DInternal): + (WebCore::GraphicsContext3DInternal::~GraphicsContext3DInternal): + (WebCore::GraphicsContext3DInternal::reshape): + (WebCore::GraphicsContext3DInternal::beginPaint): + (WebCore::GraphicsContext3DInternal::bindFramebuffer): + (WebCore::GraphicsContext3D::readPixels): + +2010-03-16 James Hawkins <jhawkins@chromium.org> + + Reviewed by David Levin. + + [Chromium] Size the WebVector of forms after determining how many + forms are valid and will be returned. + + https://bugs.webkit.org/show_bug.cgi?id=36204 + + No new tests, as this is only triggered by Chromium's use of the + WebFormElement API. + + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::forms): + +2010-03-16 Kenneth Russell <kbr@google.com> + + Reviewed by Darin Fisher. + + Build breakage from 33416 + https://bugs.webkit.org/show_bug.cgi?id=36189 + + No new tests. Built release Chromium. + + * src/GraphicsContext3D.cpp: + (WebCore::GraphicsContext3DInternal::reshape): + +2010-03-16 Zhenyao Mo <zmo@google.com> + + Reviewed by Darin Fisher. + + Hook up WebGLContextAttributes to OpenGL context creation code + https://bugs.webkit.org/show_bug.cgi?id=33416 + + Test: fast/canvas/webgl/context-attributes-alpha-depth-stencil-antialias.html + + * src/GraphicsContext3D.cpp: Hook up WebGLContextAttributes to OpenGL context creation code for Windows. + +2010-03-16 Yury Semikhatsky <yurys@chromium.org> + + Unreviewed. + + Fix Chromium Mac build: remove unused code. + + * src/WebDevToolsAgentImpl.cpp: + (WebKit::WebDevToolsAgentImpl::createInspectorFrontendProxy): + +2010-03-16 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Introduce InspectorFrontendClient that provides InspectorFrontend with an interface to the embedder. InspectorClient now serves as a delegate for InspectorController and does not contain methods for managing inspector frontend window. That allows to create remote InspectorFrontendHost. + + Introduce InspectorFrontendClient that would provide InspectorFrontend with an interface to the embedder + https://bugs.webkit.org/show_bug.cgi?id=35036 + + * src/InspectorClientImpl.cpp: + (WebKit::InspectorClientImpl::openInspectorFrontend): + * src/InspectorClientImpl.h: + * src/WebDevToolsAgentImpl.cpp: + (WebKit::WebDevToolsAgentImpl::attach): + (WebKit::WebDevToolsAgentImpl::didCommitProvisionalLoad): + (WebKit::WebDevToolsAgentImpl::createInspectorFrontendProxy): + (WebKit::WebDevToolsAgentImpl::setInspectorFrontendProxyToInspectorController): + * src/WebDevToolsAgentImpl.h: + * src/WebDevToolsFrontendImpl.cpp: + (WebKit::WebDevToolsFrontendImpl::WebDevToolsFrontendImpl): + (WebKit::WebDevToolsFrontendImpl::jsBringToFront): + (WebKit::WebDevToolsFrontendImpl::jsInspectedURLChanged): + * src/WebDevToolsFrontendImpl.h: + * src/js/InjectDispatch.js: + (close): + +2010-03-16 Pavel Feldman <pfeldman@chromium.org> + + Not reviewed: chromium tests fix. + + * src/js/InspectorControllerImpl.js: + (devtools.InspectorBackendImpl): + +2010-03-16 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: migrate to native styles inspector in order to inspect styles from foreighn domains. + + https://bugs.webkit.org/show_bug.cgi?id=36117 + + * src/js/InspectorControllerImpl.js: + (devtools.InspectorBackendImpl): + +2010-03-15 John Gregg <johnnyg@google.com> + + Reviewed by David Levin. + + Notification object should expose absolute URL of icon + https://bugs.webkit.org/show_bug.cgi?id=35800 + + * public/WebNotification.h: + * src/WebNotification.cpp: + (WebKit::WebNotification::iconURL): + +2010-03-15 Darin Fisher <darin@chromium.org> + + Reviewed by Adam Barth. + + https://bugs.webkit.org/show_bug.cgi?id=36152 + [chromium] Add support for history.pushState and history.replaceState + + * public/WebFrameClient.h: + (WebKit::WebFrameClient::didNavigateWithinPage): Move implementation of + didChangeLocationWithinPage to here. Only add to the redirect chain if + we are performing a simple hash change (i.e., no state object on the + history item). Call the old didChangeLocationWithinPage for backwards + compat with Chromium. This will be removed in a subsequent patch. + + (WebKit::WebFrameClient::didChangeLocationWithinPage): + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::dispatchDidNavigateWithinPage): + (WebKit::FrameLoaderClientImpl::dispatchDidChangeLocationWithinPage): + Call the new version of didChangeLocationWithinPage without the + parameter to indicate whether this is a new navigation or not. We only + need this method on WebFrameClient to support TestShell / DRT. + + (WebKit::FrameLoaderClientImpl::dispatchDidPushStateWithinPage): + Call dispatchDidNavigateWithinPage since pushState is just a type of + in-page navigation. This is an in-page navigation that adds another + entry to session history. + + (WebKit::FrameLoaderClientImpl::dispatchDidReplaceStateWithinPage): + Call dispatchDidNavigateWithinPage since replaceState is just a type of + in-page navigation. This is an in-page navigation that replaces the + current session history entry. + + (WebKit::FrameLoaderClientImpl::dispatchDidPopStateWithinPage): Do + nothing since dispatchDidNavigateWithinPage is called in this case by + the FrameLoader. + + (WebKit::FrameLoaderClientImpl::dispatchDecidePolicyForNavigationAction): + (WebKit::FrameLoaderClientImpl::shouldGoToHistoryItem): Move the code + for handling the dummy chrome-back-forward://go/ URLs from + dispatchDecidePolicyForNavigationAction to shouldGoToHistoryItem, which + prevents the URLs from leaking into session history. + shouldGoToHistoryItem is called before any work is done by history + traversal, so this is a better place for this hack. Ultimately, this + code should be eliminatd in favor of better integration with + FrameLoader or HistoryController. + + * src/FrameLoaderClientImpl.h: + +2010-03-15 Darin Fisher <darin@chromium.org> + + Fix build bustage. We also need to pull down "third_party/tcmalloc" + + * DEPS: + +2010-03-15 Darin Fisher <darin@chromium.org> + + Fix build bustage. We also need to pull down "gfx" + + * DEPS: + +2010-03-15 Darin Fisher <darin@chromium.org> + + Reviewed by David Levin. + + https://bugs.webkit.org/show_bug.cgi?id=36131 + Update include paths for chromium Rect, Point, and Size types. + + Update DEPS to pull latest chromium code that reflects the + new location of these headers. + + * DEPS: + * public/WebPoint.h: + * public/WebRect.h: + * public/WebSize.h: + +2010-03-15 Marcus Bulach <bulach@chromium.org> + + Reviewed by Jeremy Orlow. + + Send the frame URL on GeolocationServiceBridgeImpl::startUpdating. + https://bugs.webkit.org/show_bug.cgi?id=36012 + + * public/GeolocationServiceBridgeChromium.h: + * src/GeolocationServiceBridgeChromium.cpp: + (WebKit::GeolocationServiceBridgeImpl::startUpdating): + +2010-03-15 Patrik Persson <patrik.j.persson@ericsson.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=32369 + + Revise iframe sandbox behavior to match the updated HTML5 spec. + + - Enables window.sessionStorage in sandboxed iframes. + + - Raises SECURITY_ERR exceptions when window.localStorage or + window.openDatabase() is blocked by iframe sandboxing. + + Note: window.sessionStorage does not raise exceptions. + + WebKit would previously return null references in these cases. The + new behavior is in accordance with HTML5: + + http://dev.w3.org/html5/webstorage/ (sections 4.2 and 4.3) + http://dev.w3.org/html5/webdatabase/ (section 4.1) + http://www.mail-archive.com/whatwg@lists.whatwg.org/msg19786.html + + * src/StorageAreaProxy.cpp: + (WebCore::StorageAreaProxy::storageEvent): exception handling + * src/StorageEventDispatcherImpl.cpp: + (WebCore::StorageEventDispatcherImpl::dispatchStorageEvent): exception handling + +2010-03-15 Tony Chang <tony@chromium.org> + + Reviewed by Darin Adler. + + option-pageup/down should move cursor on chromium mac + https://bugs.webkit.org/show_bug.cgi?id=36108 + + * src/EditorClientImpl.cpp: + (WebKit::): + +2010-03-13 Eric Roman <eroman@chromium.org> + + Reviewed by Adam Barth. + + Add a firstPartyForCookies() property to WebDocument. + https://bugs.webkit.org/show_bug.cgi?id=35592 + + * public/WebDocument.h: + * src/WebDocument.cpp: + (WebKit::WebDocument::firstPartyForCookies): + +2010-03-12 Garret Kelly <gdk@chromium.org> + + Unreiviewed. + + Fix Chromium Mac build. Last patch did not apply properly. + (Garret assures me this patch will actually work.) + + * src/WebInputEventConversion.cpp: + (WebKit::toPlatformTouchEventType): + (WebKit::toPlatformTouchPointState): + +2010-03-12 Garret Kelly <gdk@chromium.org> + + Unreviewed. + + Fix Chromium Mac build. This time, with actual fixing goodness. + + * src/WebInputEventConversion.cpp: + (WebKit::toPlatformTouchEventType): + (WebKit::toPlatformTouchPointState): + +2010-03-12 Garret Kelly <gdk@chromium.org> + + Unreviewed. + + Fix Chromium Mac build. + + * src/WebInputEventConversion.cpp: + (WebKit::toPlatformTouchEventType): + (WebKit::toPlatformTouchPointState): + +2010-03-12 Garret Kelly <gdk@chromium.org> + + Reviewed by Eric Seidel. + + Enable touch events in Chromium features gypi file. + https://bugs.webkit.org/show_bug.cgi?id=35994 + + * features.gypi: + +2010-03-12 Darin Fisher <darin@chromium.org> + + Fix Chromium build bustage. + + Wrap usage of WebPrivatePtr from WebNode.h in a #if + WEBKIT_IMPLEMENTATION guard. + + * public/WebNode.h: + +2010-03-12 Nicolas Weber <thakis@chromium.org> + + Reviewed by David Levin. + + [Chromium] Cmd-clicking submit buttons should submit in new tab + https://bugs.webkit.org/show_bug.cgi?id=36023 + + Take modifiers into account when clicking form buttons. E.g. + cmd-clicking a submit button will submit in a new background tab, + cmd-shift-clicking in a new foreground tab, shift-clicking in a new + window. (On windows/linux, it's ctrl instead of cmd.) + + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::actionSpecifiesNavigationPolicy): + +2010-03-12 Kavita Kanetkar <kkanetkar@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Fix memory leak in WebImageDecoder API + https://bugs.webkit.org/show_bug.cgi?id=35946 + + * src/WebImageDecoder.cpp: + (WebKit::WebImageDecoder::setData): + (WebKit::WebImageDecoder::getFrameAtIndex): + +2010-03-11 Aaron Boodman <aa@chromium.org> + + Kill WebDocument::applicationID() (part 1). + + Modify interface to WebCore::NotificationPresenter::checkPermission() + and remove implementation of WebDocument::applicationID(). Breaking + API changes will be in a subsequent change. + https://bugs.webkit.org/show_bug.cgi?id=35846 + + * public/WebNotificationPresenter.h: + * src/NotificationPresenterImpl.cpp: + (WebKit::NotificationPresenterImpl::checkPermission): + * src/NotificationPresenterImpl.h: + * src/WebDocument.cpp: + (WebKit::WebDocument::applicationID): + +2010-03-11 Stuart Morgan <stuartmorgan@chromium.org> + + Reviewed by Darin Fisher. + + Fix the screen coordinate conversion of Chromium Mac mouse events for + multiple-moniter setups. Also changes the global coordinate values + to be computed from the event, rather than the instantaneous mouse + location, and reduces code duplication for location conversion. + + Dual-sided patch with http://codereview.chromium.org/751002 + + https://bugs.webkit.org/show_bug.cgi?id=35950 + + * src/mac/WebInputEventFactory.mm: + (WebKit::setWebEventLocationFromEventInView): + (WebKit::WebInputEventFactory::mouseEvent): + (WebKit::WebInputEventFactory::mouseWheelEvent): + +2010-03-11 Anders Carlsson <andersca@apple.com> + + Reviewed by David Hyatt. + + Remove invalidateContents, it isn't used and it never makes sense to only invalidate the contents. + + * src/ChromeClientImpl.cpp: + * src/ChromeClientImpl.h: + +2010-03-10 Darin Fisher <darin@chromium.org> + + Reviewed by Jeremy Orlow. + + Use WebPrivatePtr for WebNode + https://bugs.webkit.org/show_bug.cgi?id=36005 + + * public/WebElement.h: + * public/WebFormElement.h: + * public/WebInputElement.h: + * public/WebLabelElement.h: + * public/WebNode.h: + (WebKit::WebNode::WebNode): + (WebKit::WebNode::isNull): + (WebKit::WebNode::unwrap): + (WebKit::WebNode::constUnwrap): + * public/WebPrivatePtr.h: + (WebKit::WebPrivatePtr::assign): + * src/WebDocument.cpp: + (WebKit::WebDocument::WebDocument): + (WebKit::WebDocument::operator=): + (WebKit::WebDocument::operator PassRefPtr<Document>): + * src/WebElement.cpp: + (WebKit::WebElement::hasTagName): + (WebKit::WebElement::WebElement): + (WebKit::WebElement::operator=): + (WebKit::WebElement::operator PassRefPtr<Element>): + * src/WebFormElement.cpp: + (WebKit::WebFormElement::WebFormElement): + (WebKit::WebFormElement::operator=): + (WebKit::WebFormElement::operator PassRefPtr<HTMLFormElement>): + * src/WebInputElement.cpp: + (WebKit::WebInputElement::WebInputElement): + (WebKit::WebInputElement::operator=): + (WebKit::WebInputElement::operator PassRefPtr<HTMLInputElement>): + * src/WebLabelElement.cpp: + (WebKit::WebLabelElement::correspondingControl): + (WebKit::WebLabelElement::operator=): + (WebKit::WebLabelElement::operator PassRefPtr<HTMLLabelElement>): + * src/WebNode.cpp: + (WebKit::WebNode::reset): + (WebKit::WebNode::assign): + (WebKit::WebNode::equals): + (WebKit::WebNode::parentNode): + (WebKit::WebNode::createMarkup): + (WebKit::WebNode::addEventListener): + (WebKit::WebNode::removeEventListener): + (WebKit::WebNode::simulateClick): + (WebKit::WebNode::WebNode): + (WebKit::WebNode::operator=): + (WebKit::WebNode::operator PassRefPtr<Node>): + +2010-03-10 Darin Fisher <darin@chromium.org> + + Reviewed by Jeremy Orlow. + + Add API wrapper for WebCore::SerializedScriptValue + https://bugs.webkit.org/show_bug.cgi?id=35988 + + WebSerializedScriptValue is a wrapper around SerializedScriptValue. + + WebPrivatePtr is used to simplify wrapping reference counted WebCore + types. This class is used to cleanup WebHistoryItem, and will be used + to clean up other classes in the WebKit API in a follow-up patch. + + * WebKit.gyp: + * public/WebHistoryItem.h: + * public/WebPrivatePtr.h: Added. + * public/WebSerializedScriptValue.h: Added. + * src/WebHistoryItem.cpp: + * src/WebSerializedScriptValue.cpp: Added. + +2010-03-10 Sanjeev Radhakrishnan <sanjeevr@chromium.org> + + Reviewed by Darin Fisher. + + Allow a plugin to participate in the browser's print workflow. + https://bugs.webkit.org/show_bug.cgi?id=35550 + + * public/WebFrame.h: + * public/WebPlugin.h: + * src/WebFrameImpl.cpp: + * src/WebFrameImpl.h: + * src/WebPluginContainerImpl.cpp: + * src/WebPluginContainerImpl.h: + +2010-03-10 John Abd-El-Malek <jam@chromium.org> + + Reviewed by Nate Chapin. + + [chromium]: Fix regression in mouse capture on Mac/Linux + https://bugs.webkit.org/show_bug.cgi?id=35987 + + * src/WebViewImpl.cpp: + +2010-03-10 Evan Stade <estade@chromium.org> + + Reviewed by David Levin. + + [chromium] add functionality to activate the focused node in a WebView + https://bugs.webkit.org/show_bug.cgi?id=35407 + + * public/WebDocument.h: + * public/WebNode.h: + * src/WebDocument.cpp: + (WebKit::WebDocument::focusedNode): Added + * src/WebNode.cpp: + (WebKit::WebNode::simulateClick): Added + +2010-03-10 John Abd-El-Malek <jam@chromium.org> + + Reviewed by Darin Fisher. + + https://bugs.webkit.org/show_bug.cgi?id=35952 + Propagate mouse wheel events to Pepper plugins. + + * src/WebInputEventConversion.cpp: + (WebKit::WebMouseWheelEventBuilder::WebMouseWheelEventBuilder): + * src/WebInputEventConversion.h: + * src/WebPluginContainerImpl.cpp: + (WebKit::WebPluginContainerImpl::handleEvent): + (WebKit::WebPluginContainerImpl::handleMouseEvent): + (WebKit::WebPluginContainerImpl::handleWheelEvent): + (WebKit::WebPluginContainerImpl::handleKeyboardEvent): + * src/WebPluginContainerImpl.h: + +2010-03-10 Garret Kelly <gdk@chromium.org> + + Reviewed by Darin Fisher. + + Add support for converting WebTouchEvents to PlatformTouchEvents and + routing them into the EventHandler for the frame in which they + originate. + https://bugs.webkit.org/show_bug.cgi?id=35874 + + * src/ChromeClientImpl.h: + (WebKit::ChromeClientImpl::needTouchEvents): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::touchEvent): Handle incoming WebTouchEvents, + converting them to PlatformTouchEvents and sending them to the + EventHandler. + (WebKit::WebViewImpl::handleInputEvent): Now routes WebTouchEvents to + the touchEvent handler. + * src/WebViewImpl.h: + +2010-03-10 Nate Chapin <japhet@chromium.org> + + Reviewed by Dimitri Glazkov. + + Wrap and unwrap v8 objects with WrapperTypeInfo instead of V8ClassIndex::V8WrapperType. + + https://bugs.webkit.org/show_bug.cgi?id=35941 + + * src/WebBindings.cpp: + (WebKit::getRangeImpl): + * src/WebDevToolsAgentImpl.cpp: + (WebKit::WebDevToolsAgentImpl::createInspectorBackendV8Wrapper): + * src/WebDevToolsFrontendImpl.cpp: + (WebKit::WebDevToolsFrontendImpl::jsShowContextMenu): + +2010-03-10 Garret Kelly <gdk@chromium.org> + + Reviewed by Darin Fisher. + + Fixing build warning caused by using 0 instead of NULL as the sentiel + in a varargs call. + https://bugs.webkit.org/show_bug.cgi?id=35898 + + * src/gtk/WebInputEventFactory.cpp: + +2010-03-10 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Darin Fisher. + + Add IndexedDatabase class and hook it up. + https://bugs.webkit.org/show_bug.cgi?id=35927 + + This change is mostly just adding the plumbing necessary for + the IndexedDatabaseRequest and IndexedDatabaseSync (not written + yet). + + * WebKit.gyp: + * public/WebIndexedDatabase.h: Added. + (WebKit::WebIndexedDatabase::~WebIndexedDatabase): + * public/WebKitClient.h: + (WebKit::WebKitClient::getIndexedDatabase): + * src/ChromiumBridge.cpp: + (WebCore::ChromiumBridge::getIndexedDatabase): + * src/IndexedDatabaseProxy.cpp: Added. + (WebCore::IndexedDatabaseProxy::create): + (WebCore::IndexedDatabaseProxy::IndexedDatabaseProxy): + (WebCore::IndexedDatabaseProxy::~IndexedDatabaseProxy): + (WebCore::IndexedDatabaseProxy::open): + * src/IndexedDatabaseProxy.h: Added. + +2010-03-10 Andrey Kosyakov <caseq@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: display list of active workers & support debugging + with fake workers + https://bugs.webkit.org/show_bug.cgi?id=35568 + + * src/js/InspectorControllerImpl.js: + (devtools.InspectorBackendImpl): + +2010-03-10 Tony Chang <tony@chromium.org> + + Reviewed by Darin Fisher. + + https://bugs.webkit.org/show_bug.cgi?id=35956 + Create a grd file upstream for resources that chromium uses + that are pulled directly from the upstream repository. + + * WebKit.grd: Added. + +2010-03-10 Roland Steiner <rolandsteiner@chromium.org> + + Reviewed by David Levin. + + Bug 28293 - [Chromium] event.datatransfer.getdata("text/uri-list") is treated the same as getdata("URL") + https://bugs.webkit.org/show_bug.cgi?id=28293 + + Change ChromiumDataObject such that it treats types "URL" and "text/uri-list" + correctly for event.dataTransfer.getData/setData. Currently both are treated + as synonyms, but for "URL", getData is supposed to only return the first valid URL + contained within the data for "text/uri-list" (see HTML5 spec). + + Tests: editing/pasteboard/dataTransfer-setData-getData.html + + * src/WebDragData.cpp: + (WebKit::WebDragData::url): + (WebKit::WebDragData::setURL): + +2010-03-08 John Abd-El-Malek <jam@chromium.org> + + Reviewed by Darin Fisher. + + Need to send mouse events to plugin when it has mouse capture + https://bugs.webkit.org/show_bug.cgi?id=35900 + + * public/WebInputEvent.h: + (WebKit::WebInputEvent::isMouseEventType): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::WebViewImpl): + (WebKit::WebViewImpl::mouseDown): + (WebKit::WebViewImpl::mouseUp): + (WebKit::WebViewImpl::handleInputEvent): + * src/WebViewImpl.h: + +2010-03-09 Anton Muhin <antonm@chromium.org> + + Reviewed by Darin Fisher. + + Accept and bailout NULL widgets in ChromiumBridge + https://bugs.webkit.org/show_bug.cgi?id=35796 + + * src/ChromiumBridge.cpp: + (WebCore::toChromeClientImpl): + +2010-03-09 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Use clean global object for devtools utility context instead of + trying to simulate inspected context. + + https://bugs.webkit.org/show_bug.cgi?id=35923 + + * src/DebuggerAgentImpl.cpp: + * src/DebuggerAgentImpl.h: + * src/WebDevToolsAgentImpl.cpp: + (WebKit::WebDevToolsAgentImpl::resetInspectorFrontendProxy): + +2010-03-08 Alexey Proskuryakov <ap@apple.com> + + Chromium build fix. + + Updated for the removal of "mightDownloadFromHandle". + + * src/ResourceHandle.cpp: + (WebCore::ResourceHandle::ResourceHandle): + (WebCore::ResourceHandle::create): + +2010-03-08 Dimitri Glazkov <dglazkov@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Reset multiple form submission protection on mouse events. + https://bugs.webkit.org/show_bug.cgi?id=35128 + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::mouseDown): + +2010-03-08 Michael Nordman <michaeln@google.com> + + Reviewed by Darin Fisher. + + Quick fix for a chromium unit test failures around r55675 (repaint refactoring). + This change restores the tests for empty rects that were deleted. + + https://bugs.webkit.org/show_bug.cgi?id=35878 + + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::invalidateContentsAndWindow): + * src/WebPopupMenuImpl.cpp: + (WebKit::WebPopupMenuImpl::invalidateContentsAndWindow): + +2010-03-02 Adam Treat <atreat@rim.com> + + Reviewed by Dave Hyatt. + + Adapt the chromium port to the refactoring of repaint methods. + + https://bugs.webkit.org/show_bug.cgi?id=34214 + + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::invalidateContents): + (WebKit::ChromeClientImpl::invalidateWindow): + (WebKit::ChromeClientImpl::invalidateContentsAndWindow): + (WebKit::ChromeClient::invalidateContentsForSlowScroll): + * src/ChromeClientImpl.h: + +2010-03-08 Jian Li <jianli@chromium.org> + + Reviewed by Dmitry Titov. + + Blob.slice support. + https://bugs.webkit.org/show_bug.cgi?id=32993 + + Add ENABLE_BLOB_SLICE feature define. + + * features.gypi: + +2010-03-08 Eric Uhrhane <ericu@chromium.org> + + Reviewed by David Levin. + + Remove the now-redundant Settings fields for the Database + https://bugs.webkit.org/show_bug.cgi?id=35763 + + No new tests; this code isn't called. + + * public/WebSettings.h: + * src/WebSettingsImpl.cpp: + * src/WebSettingsImpl.h: + +2010-03-08 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Darin Fisher. + + Pass the WebFrame into WebStorageArea::setItem so we can figure out the routing ID + https://bugs.webkit.org/show_bug.cgi?id=35758 + + This is necessary since setItem is sometimes blocked and the embedder might need + to display some piece of UI associated with such an event. + + * public/WebStorageArea.h: + (WebKit::WebStorageArea::setItem): + * src/StorageAreaProxy.cpp: + (WebCore::StorageAreaProxy::setItem): + * src/WebStorageAreaImpl.cpp: + (WebKit::WebStorageAreaImpl::setItem): + * src/WebStorageAreaImpl.h: + +2010-03-07 Mark Rowe <mrowe@apple.com> + + Chromium build fix. + + * src/ChromiumBridge.cpp: Include SharedBuffer.h since WebCore::SharedBuffer is being used. + +2010-03-07 Mark Rowe <mrowe@apple.com> + + Chromium build fix. + + * src/ResourceHandle.cpp: Include SharedBuffer.h since WebCore::SharedBuffer is being used. + +2010-03-06 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Chromium: Restore devtools window activate upon node search complete. + + https://bugs.webkit.org/show_bug.cgi?id=35832 + + * src/js/DevTools.js: + +2010-03-06 Darin Fisher <darin@chromium.org> + + Reviewed by David Levin. + + [Chromium] Embedder initiated loads should not always stop existing loads + https://bugs.webkit.org/show_bug.cgi?id=33862 + + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::reload): + (WebKit::WebFrameImpl::loadRequest): + (WebKit::WebFrameImpl::loadHistoryItem): + (WebKit::WebFrameImpl::loadData): + +2010-03-06 Darin Fisher <darin@chromium.org> + + Reviewed by David Levin. + + [Chromium] spurious WebViewClient::didStopLoading if changing + location.hash while a subframe is still loading + + https://bugs.webkit.org/show_bug.cgi?id=33884 + + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::dispatchDidChangeLocationWithinPage): + Call isLoadingInAPISense, which checks subframes. + +2010-03-06 Hironori Bono <hbono@chromium.org> + + Reviewed by Eric Seidel. + + [Chromium] Typing into Flash with wmode = opaque|transparent and + non-latin language active outputs as if US keyboard layout active + + https://bugs.webkit.org/show_bug.cgi?id=34936 + + This change is a WebKit-side change for this issue. It dispatches + Char events to plug-ins so plug-ins can receive non-ASCII characters + as well as ASCII characters. + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::keyEvent): + +2010-03-06 Kavita Kanetkar <kkanetkar@chromium.org> + + Reviewed by Darin Fisher. + + Create WebKit API for WebCore::ImageDecoder + https://bugs.webkit.org/show_bug.cgi?id=35415 + + * WebKit.gyp: + * public/WebImageDecoder.h: Added. + * src/WebImageDecoder.cpp: Added. + +2010-03-05 John Abd-El-Malek <jam@chromium.org> + + Reviewed by Darin Fisher. + + Take out code hack that flips the result of NPP_HandleEvent. This needs to move to + the NPAPI code so that Pepper plugins don't hit it. + https://bugs.webkit.org/show_bug.cgi?id=35779 + + * public/WebPluginContainer.h: + * src/WebPluginContainerImpl.cpp: + (WebKit::WebPluginContainerImpl::handleMouseEvent): + (WebKit::WebPluginContainerImpl::handleKeyboardEvent): + +2010-03-05 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: Do not show link helper in popovers and/or for external resources. + + https://bugs.webkit.org/show_bug.cgi?id=35785 + + * src/js/DebuggerAgent.js: + (devtools.DebuggerAgent.prototype.initUI): + (devtools.DebuggerAgent.prototype.addScriptInfo_): + +2010-03-04 Garret Kelly <gdk@chromium.org> + + Reviewed by Darin Fisher. + + Adding PlatformTouchEventBuilder and PlatformTouchPointBuilder for + converting Chromium WebTouchEvent and WebTouchPoint types to + corresponding WebCore types. + https://bugs.webkit.org/show_bug.cgi?id=35760 + + * src/WebInputEventConversion.cpp: + (WebKit::toPlatformTouchEventType): + (WebKit::toPlatformTouchPointState): + (WebKit::PlatformTouchPointBuilder::PlatformTouchPointBuilder): + (WebKit::PlatformTouchEventBuilder::PlatformTouchEventBuilder): + * src/WebInputEventConversion.h: + +2010-03-04 John Gregg <johnnyg@google.com> + + Reviewed by Darin Fisher. + + [chromium] WebDocument:applicationID() crashes on <meta> tag with no http-equiv attribute + https://bugs.webkit.org/show_bug.cgi?id=35771 + + * src/WebDocument.cpp: + (WebKit::WebDocument::applicationID): + check for presence of http-equiv attribute before lower()ing it. + +2010-03-04 Darin Fisher <darin@chromium.org> + + Reviewed by Dmitry Titov. + + [chromium] make history.{push,replace}State enabled at runtime + https://bugs.webkit.org/show_bug.cgi?id=35753 + + * public/WebRuntimeFeatures.h: + * src/WebRuntimeFeatures.cpp: + (WebKit::WebRuntimeFeatures::enablePushState): + (WebKit::WebRuntimeFeatures::isPushStateEnabled): + +2010-03-04 Pavel Feldman <pfeldman@chromium.org> + + Not reviewed: chromium tests fix. + + * src/js/Tests.js: + +2010-03-03 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: Remove two last synchronous calls from front-end to InspectorBackend. + + https://bugs.webkit.org/show_bug.cgi?id=35720 + + * src/js/InspectorControllerImpl.js: + (devtools.InspectorBackendImpl): + (devtools.InspectorBackendImpl.prototype.setPauseOnExceptionsState): + +2010-03-03 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: Remove sync access to resourceTrackingEnabled. + + https://bugs.webkit.org/show_bug.cgi?id=35693 + + * src/js/DevTools.js: + +2010-03-04 Darin Fisher <darin@chromium.org> + + Reviewed by Pavel Feldman. + + Fix failing DevToolsSanityTest.TestResourceContentLength + https://bugs.webkit.org/show_bug.cgi?id=35725 + + http://trac.webkit.org/changeset/55466 missed one more spot + where contentLength needed to be renamed resourceSize. + + * src/js/Tests.js: + +2010-03-03 Garret Kelly <gdk@chromium.org> + + Reviewed by Darin Fisher. + + Adding touch event type and point type. Tested against the try bots. + https://bugs.webkit.org/show_bug.cgi?id=35691 + + * public/WebInputEvent.h: + (WebKit::WebInputEvent::): + (WebKit::WebInputEvent::isTouchEventType): + (WebKit::WebTouchEvent::WebTouchEvent): + * public/WebTouchPoint.h: Added. + (WebKit::WebTouchPoint::WebTouchPoint): + (WebKit::WebTouchPoint::): + +2010-03-02 Tony Chang <tony@chromium.org> + + Reviewed by Darin Fisher. + + add a flag to WebURLResponse so we can identify multipart content + https://bugs.webkit.org/show_bug.cgi?id=35628 + + * public/WebURLResponse.h: + * src/WebURLResponse.cpp: + (WebKit::WebURLResponse::isMultipartPayload): + (WebKit::WebURLResponse::setIsMultipartPayload): + +2010-03-02 Adam Barth <abarth@webkit.org> + + Reviewed by Darin Fisher. + + Google Analytics triggers "blocked plugin" UI + https://bugs.webkit.org/show_bug.cgi?id=35565 + + Plumb didNotAllowPlugins to the client. + + * public/WebFrameClient.h: + (WebKit::WebFrameClient::didNotAllowPlugins): + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::didNotAllowPlugins): + * src/FrameLoaderClientImpl.h: + +2010-03-02 Chris Fleizach <cfleizach@apple.com> + + Reviewed by Beth Dakin. + + aria-label isn't respected on option elements + https://bugs.webkit.org/show_bug.cgi?id=35400 + + * src/SuggestionsPopupMenuClient.h: + (WebKit::SuggestionsPopupMenuClient::itemAccessibilityText): + +2010-03-02 Mads Ager <ager@chromium.org> + + Reviewed by Adam Barth. + + [V8] V8 should be notified of context disposals + https://bugs.webkit.org/show_bug.cgi?id=35526 + + Update V8 DEPS in order to get V8 API changes needed for context + disposal notifications. + + * DEPS: + +2010-03-02 Kenneth Russell <kbr@google.com> + + Reviewed by Darin Fisher. + + Add EnabledAtRuntime attribute to WebGLArray constructors + https://bugs.webkit.org/show_bug.cgi?id=35558 + + * public/WebRuntimeFeatures.h: + * src/WebRuntimeFeatures.cpp: + (WebKit::WebRuntimeFeatures::enableWebGL): + (WebKit::WebRuntimeFeatures::isWebGLEnabled): + +2010-03-02 James Hawkins <jhawkins@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Implement WebNode::equals and add inline operators for == + and !=. + + https://bugs.webkit.org/show_bug.cgi?id=35543 + + * public/WebNode.h: + (WebKit::operator==): + (WebKit::operator!=): + * src/WebNode.cpp: + (WebKit::WebNode::equals): + +2010-03-01 Jakob Petsovits <jpetsovits@rim.com> + + Reviewed by Adam Barth. + + Adapt to the new ZoomMode enum. + https://bugs.webkit.org/show_bug.cgi?id=35347 + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::setZoomLevel): + +2010-03-01 Thatcher Ulrich <tulrich@google.com> + + Reviewed by Darin Fisher. + + Fix chromium iframe shims. Add another test case to the + iframes-shims test. After r53637, the plugin widget doesn't get + moved every paint. This used to hide the bug that if an iframe + gets added, the plugin's cutout rectangles don't get updated until + a layout happens. + https://bugs.webkit.org/show_bug.cgi?id=35184 + + * src/WebPluginContainerImpl.cpp: + (WebKit::WebPluginContainerImpl::widgetPositionsUpdated): do reportGeometry() to ensure that + the plugin is aware of the positions of cutouts on the page (for iframe shim behavior). + * src/WebPluginContainerImpl.h: + +2010-02-27 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Chromium: remove DevTools part that has been upstreamed. + + * src/js/DevTools.js: + +2010-02-26 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: reload inspected page on Cmd+R / Ctrl+R / F5 key event in inspector. + + * src/WebDevToolsFrontendImpl.cpp: + (WebKit::WebDevToolsFrontendImpl::WebDevToolsFrontendImpl): + (WebKit::WebDevToolsFrontendImpl::jsCanAttachWindow): + * src/WebDevToolsFrontendImpl.h: + * src/js/InspectorControllerImpl.js: + (devtools.InspectorBackendImpl): + (devtools.InspectorBackendImpl.prototype.toggleNodeSearch): + +2010-02-26 James Hawkins <jhawkins@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Verify that the Nodes being enumerated are HTML elements. + + https://bugs.webkit.org/show_bug.cgi?id=35463 + + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::forms): + +2010-02-26 Adam Barth <abarth@webkit.org> + + Reviewed by Darin Fisher. + + Expose an API for ports to add schemes to the mixed content whitelist + https://bugs.webkit.org/show_bug.cgi?id=35438 + + Expose registerURLSchemeAsSecure via the WebKit API. + + * public/WebSecurityPolicy.h: + * src/WebSecurityPolicy.cpp: + (WebKit::WebSecurityPolicy::registerURLSchemeAsSecure): + +2010-02-26 Brett Wilson <brettw@chromium.org> + + Fix chromium build. This test's expectation became obsolete with + recent changes to KURL which my previous change brings Chromium's + port in compliance with. + + * tests/KURLTest.cpp: + (ComponentCase::TEST): + +2010-02-26 Yaar Schnitman <yaar@chromium.org> + + Chromium build fix. + + * features.gypi: Added missing new variable enable_svg. + +2010-02-26 Yaar Schnitman <yaar@chromium.org> + + Reviewed by Dimitri Glazkov. + + [V8] Auto-generate and split DerivedSourcesAllInOne.cpp + https://bugs.webkit.org/show_bug.cgi?id=33048 + + * DEPS: Incremented gyp revision. + +2010-02-26 Darin Fisher <darin@chromium.org> + + Fix mac warning (that gets treated as an error in the chromium build). + + * src/ChromiumBridge.cpp: + (WebCore::ChromiumBridge::cookiesEnabled): + +2010-02-25 Darin Fisher <darin@chromium.org> + + Reviewed by David Levin. + + Remove deprecated cookie methods. + https://bugs.webkit.org/show_bug.cgi?id=35420 + + * public/WebFrameClient.h: + * public/WebKitClient.h: + * src/ChromiumBridge.cpp: + (WebCore::ChromiumBridge::setCookies): + (WebCore::ChromiumBridge::cookies): + (WebCore::ChromiumBridge::cookieRequestHeaderFieldValue): + (WebCore::ChromiumBridge::rawCookies): + (WebCore::ChromiumBridge::deleteCookie): + (WebCore::ChromiumBridge::cookiesEnabled): + +2010-02-25 James Hawkins <jhawkins@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Implement WebLabelElement. + + https://bugs.webkit.org/show_bug.cgi?id=35317 + + * WebKit.gyp: + * public/WebLabelElement.h: Added. + * src/WebLabelElement.cpp: Added. + +2010-02-25 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Dimitri Glazkov. + + Web Inspector: make script lines count calculation lazy. + + https://bugs.webkit.org/show_bug.cgi?id=35392 + + * src/js/Tests.js: + (.TestSuite.prototype.testScriptsTabIsPopulatedOnInspectedPageRefresh.waitUntilScriptIsParsed): + (.TestSuite.prototype.testScriptsTabIsPopulatedOnInspectedPageRefresh.checkScriptsPanel): + (.TestSuite.prototype.testScriptsTabIsPopulatedOnInspectedPageRefresh): + (.TestSuite.prototype.testNoScriptDuplicatesOnPanelSwitch.checkScriptsPanel): + (.TestSuite.prototype.testAutoContinueOnSyntaxError.checkScriptsList): + (.TestSuite.prototype._executeFunctionForStepTest): + +2010-02-24 Darin Fisher <darin@chromium.org> + + Reviewed by David Levin. + + Add a missing WebString.h include. + https://bugs.webkit.org/show_bug.cgi?id=35360 + + This is required since some of the methods have implementations that + return a WebString. + + * public/WebCookieJar.h: + +2010-02-24 Jay Campan <jcampan@google.com> + + Reviewed by David Levin. + + Don't show the autofill popup when the input text is disabled or read only. + + https://bugs.webkit.org/show_bug.cgi?id=35129 + + * src/EditorClientImpl.cpp: + (WebKit::EditorClientImpl::autofill): + +2010-02-24 Adam Barth <abarth@webkit.org> + + Reviewed by Darin Fisher. + + [Chromium API] Disambiguate allowJavaScript from didNotAllowScript + https://bugs.webkit.org/show_bug.cgi?id=35205 + + Plumb didNotAllowScript through Chromium's WebKit API. + + * public/WebFrameClient.h: + (WebKit::WebFrameClient::didNotAllowScript): + * src/DebuggerAgentImpl.cpp: + (WebKit::DebuggerAgentImpl::createUtilityContext): + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::didNotAllowScript): + * src/FrameLoaderClientImpl.h: + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::bindToWindowObject): + +2010-02-23 James Hawkins <jhawkins@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Implement WebDocument::getElementsByTagName. + + https://bugs.webkit.org/show_bug.cgi?id=35272 + + * public/WebDocument.h: + * src/WebDocument.cpp: + (WebKit::WebDocument::getElementsByTagName): + +2010-02-23 Steve Block <steveblock@google.com> + + Reviewed by Jeremy Orlow. + + Removes redundant Settings::setGeolocationEnabled and Settings::geolocationEnabled + https://bugs.webkit.org/show_bug.cgi?id=35242 + + This removes Chromium's WebSettings::setGeolocationEnabled + + * public/WebSettings.h: + * src/WebSettingsImpl.cpp: + * src/WebSettingsImpl.h: + +2010-02-23 Dmitriy Belenko <dbelenko@google.com> + + Reviewed by Darin Fisher. + + Chromium: Need to be able to get the bounds of selection + rectangle(s) + https://bugs.webkit.org/show_bug.cgi?id=34915 + + This change will enable about 30 test cases to pass in Chromium. + All of these test cases are related to selection rect boundaries. + This change will enable the test cases to retrieve the selection + rect boundary rectangle for the current selection. + + * public/WebFrame.h: + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::selectionBoundsRect): + * src/WebFrameImpl.h: + +2010-02-23 Steve Block <steveblock@google.com> + + Reviewed by Darin Adler. + + Adds ChromeClient::cancelGeolocationPermissionRequestForFrame + https://bugs.webkit.org/show_bug.cgi?id=34962 + + This method is required so that a Geolocation object can cancel an + asynchronous permission request. This allows the chrome client to cancel + any UI it is showing for the permission request. + + * src/ChromeClientImpl.h: + (WebKit::ChromeClientImpl::cancelGeolocationPermissionRequestForFrame): + +2009-02-22 Adam Langley <agl@google.com> + + Reviewed by Darin Fisher. + + fontconfig on Linux can change the render preferences on a per strike + basis (a strike a combination of face and size). Because of this, we + need to query fontconfig each time a new FontPlatformData is created + for a new size. + + This patch adds support for querying this via ChromiumBridge. + + https://bugs.webkit.org/show_bug.cgi?id=33065 + + * WebKit.gyp: + * public/gtk/WebFontInfo.h: + * public/linux/WebSandboxSupport.h: + * src/ChromiumBridge.cpp: + (WebCore::ChromiumBridge::getRenderStyleForStrike): + * src/gtk/WebFontInfo.cpp: + (WebKit::WebFontInfo::renderStyleForStrike): + +2010-02-22 Alexander Pavlov <apavlov@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: there should be a way to "deactivate" or "skip" all breakpoints while debugging. + https://bugs.webkit.org/show_bug.cgi?id=33217 + + * src/js/DebuggerAgent.js: + (devtools.DebuggerAgent): + (devtools.DebuggerAgent.prototype.setBreakpointsActivated): + (devtools.DebuggerAgent.prototype.handleBreakEvent_): + (devtools.DebuggerAgent.prototype.handleExceptionEvent_): + * src/js/InspectorControllerImpl.js: + (devtools.InspectorBackendImpl.prototype.activateBreakpoints): + (devtools.InspectorBackendImpl.prototype.deactivateBreakpoints): + +2010-02-21 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Chromium DevTools: kepp debugger API in sync with inspector. + + https://bugs.webkit.org/show_bug.cgi?id=28799 + + * src/js/DebuggerAgent.js: + * src/js/InspectorControllerImpl.js: + (devtools.InspectorBackendImpl.prototype.setBreakpoint): + +2010-02-19 Maciej Stachowiak <mjs@apple.com> + + Reviewed by David Levin. + + Add an ENABLE flag for sandboxed iframes to make it possible to disable it in releases + https://bugs.webkit.org/show_bug.cgi?id=35147 + + * features.gypi: + +2010-02-19 James Hawkins <jhawkins@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Call WebViewClient::didAcceptAutoFillSuggestion when the + user selects a suggestion from the AutoFill suggestions popup. + + https://bugs.webkit.org/show_bug.cgi?id=35174 + + * public/WebViewClient.h: + (WebKit::WebViewClient::didAcceptAutoFillSuggestion): + * src/AutoFillPopupMenuClient.cpp: + (WebKit::AutoFillPopupMenuClient::valueChanged): + * src/AutoFillPopupMenuClient.h: + +2010-02-19 James Hawkins <jhawkins@chromium.org> + + Reviewed by Eric Seidel. + + [Chromium] Use the m_suggestionsPopupClient pointer to refer to the + popup client, as the Autocomplete popup might not be the current + popup. + + https://bugs.webkit.org/show_bug.cgi?id=35172 + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::autocompleteHandleKeyEvent): + (WebKit::WebViewImpl::refreshSuggestionsPopup): + +2010-02-19 James Hawkins <jhawkins@chromium.org> + + Reviewed by Eric Seidel. + + [Chromium] Rename EditorClientImpl::onAutofillSuggestionAccepted to + onAutocompleteSuggestionAccepted to better match the purpose of the + function. + + https://bugs.webkit.org/show_bug.cgi?id=35171 + + * src/EditorClientImpl.cpp: + (WebKit::EditorClientImpl::onAutocompleteSuggestionAccepted): + * src/EditorClientImpl.h: + * src/SuggestionsPopupMenuClient.cpp: + (WebKit::SuggestionsPopupMenuClient::valueChanged): + +2010-02-18 Peter Kasting <pkasting@google.com> + + Reviewed by Darin Fisher. + + Add an isImageBlocked bool to the WebContextMenuData struct. + https://bugs.webkit.org/show_bug.cgi?id=35136 + + This lets us properly enable/disable the "Copy Image" context menu entry + (and, in the future, maybe add a "Load Image" function). + + * public/WebContextMenuData.h: + * src/ContextMenuClientImpl.cpp: + (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems): + +2010-02-19 Marcus Bulach <bulach@chromium.org> + + Reviewed by Jeremy Orlow. + + Fixes GeolocationServiceBridgeImpl::stopUpdating (it can be called multiple times). + + * src/GeolocationServiceBridgeChromium.cpp: + (WebKit::GeolocationServiceBridgeImpl::stopUpdating): + +2010-02-19 Pavel Feldman <pfeldman@chromium.org> + + Not reviewed. Chromium build fix: reverting r54997 and r54998. + + * DEPS: + +2010-02-19 Pavel Feldman <pfeldman@chromium.org> + + Not reviewed. Chromium tests fix: update devtools code to match new + web inspector object proxy format. + + * src/js/DebuggerAgent.js: + (devtools.DebuggerAgent.prototype.formatCallFrame_): + (devtools.DebuggerAgent.formatObjectProxy_): + +2010-02-12 Kent Tamura <tkent@chromium.org> + + Unreviewed. Fix Chromium build. + + * DEPS: Bump Google URL revision to 123. + +2010-02-18 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Don't truncate long lines when evaluating expressions on a breakpoint. + + https://bugs.webkit.org/show_bug.cgi?id=35102 + + * src/js/DebuggerAgent.js: + +2010-02-18 Jay Campan <jcampan@google.com> + + Reviewed by Adam Barth. + + Exposing the title in WebDocument. + + https://bugs.webkit.org/show_bug.cgi?id=35058 + + * public/WebDocument.h: + * src/WebDocument.cpp: + (WebKit::WebDocument::title): + +2010-02-17 Dmitry Titov <dimich@chromium.org> + + Reviewed by David Levin, Darin Fisher, Simon Hausmann. + + When a live iframe element is moved between pages, it still depends on the old page. + https://bugs.webkit.org/show_bug.cgi?id=34382 + + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::detachedFromParent3): + (WebKit::FrameLoaderClientImpl::didTransferChildFrameToNewDocument): + Since Chromium's WebFrameClient is destroyed once a window is closed, + if Frame moves between Pages, the client of corresponding WebFrame + should be replaced as well. + + * src/FrameLoaderClientImpl.h: + * src/WebFrameImpl.h: + (WebKit::WebFrameImpl::setClient): + +2010-02-17 Evan Martin <evan@chromium.org> + + Reviewed by Eric Seidel. + + [chromium] expose cache-bypass flag in reload() API + https://bugs.webkit.org/show_bug.cgi?id=34969 + + This flag is used to force a reload to ignore caches. + (Aka "shift-reload".) + + * public/WebFrame.h: + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::reload): + * src/WebFrameImpl.h: + +2010-02-17 Kent Tamura <tkent@chromium.org> + + Reviewed by Eric Seidel. + + Introduces new Icon loading interface in order to support + asynchronous loading. + https://bugs.webkit.org/show_bug.cgi?id=32054 + + Add an empty implementation of ChromeClient::iconForFiles(). + + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::iconForFiles): + * src/ChromeClientImpl.h: + +2010-02-17 Kenneth Russell <kbr@google.com> + + Reviewed by Oliver Hunt. + + Refactor texImage2D and texSubImage2D taking Image to use common code + https://bugs.webkit.org/show_bug.cgi?id=34458 + + Merged the Safari and Chromium code which extracts the data from + Image objects into common entry points on GraphicsContext3D. This + immediately fixes the following three problems: + - Chromium not implementing texSubImage2D taking Image. + - Safari not obeying the flipY parameter to texImage2D or + texSubImage2D taking Image. + - Safari not obeying the premultipyAlpha parameter to texImage2D + or texSubImage2D taking Image. + Added new test verifying the behavior of texImage2D and + texSubImage2D and the flipY parameter. The premultiplyAlpha + parameter can not be tested yet as the implementation is not yet + spec compliant. This will be fixed in a follow-on bug. + + Ran all WebGL demos in demo repository on Safari and Chromium; + textures are now the right way up in both browsers, and + transparent textures in Particles demo now look correct in Safari. + + * src/GraphicsContext3D.cpp: + (WebCore::GraphicsContext3D::texImage2D): + (WebCore::GraphicsContext3D::texSubImage2D): + +2010-02-17 Alok Priyadarshi <alokp@chromium.org> + + Reviewed by Ariya Hidayat. + + Bug 34900: Implement accelerated compositing for chromium. + https://bugs.webkit.org/show_bug.cgi?id=34900 + + * features.gypi: Added WTF_USE_ACCELERATED_COMPOSITING flag. + +2010-02-17 Jian Li <jianli@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Remove the obsolete chromium interface for handling DownloadURL. + https://bugs.webkit.org/show_bug.cgi?id=34982 + + * public/WebDragData.h: + * src/WebDragData.cpp: + +2010-02-16 James Hawkins <jhawkins@chromium.org> + + Reviewed by Eric Seidel. + + [Chromium] Remove calls to releaseRef when passing PassRefPtrs to base + classes. releaseRef releases the original pointer without decreasing + the reference count, and the base class constructor increases the + reference count, leading to a leak. + + https://bugs.webkit.org/show_bug.cgi?id=35000 + + * src/WebDocument.cpp: + (WebKit::WebDocument::WebDocument): + * src/WebElement.cpp: + (WebKit::WebElement::WebElement): + * src/WebFormElement.cpp: + (WebKit::WebFormElement::WebFormElement): + * src/WebInputElement.cpp: + (WebKit::WebInputElement::WebInputElement): + +2010-02-15 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Fix StorageNamespaceProxy::copy() for test shell + https://bugs.webkit.org/show_bug.cgi?id=34949 + + Chromium passes back NULL when you call WebStorageNamespace::proxy() + but TestShell returns a valid object. Both need to work via + the WebStorageNamespace. + + * src/StorageNamespaceProxy.cpp: + (WebCore::StorageNamespaceProxy::copy): + +2010-02-14 Vangelis Kokkevis <vangelis@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Add support for the showDebugBorders setting to Chromium. + + https://bugs.webkit.org/show_bug.cgi?id=34906 + + * public/WebSettings.h: Add declaration for setShowDebugBorders + * src/WebSettingsImpl.cpp: + (WebKit::WebSettingsImpl::setShowDebugBorders): Add method implementation + * src/WebSettingsImpl.h: Added declaration for setShowDebugBorders + +2010-02-11 Darin Fisher <darin@chromium.org> + + Reviewed by Jeremy Orlow. + + Introduce WebCookieJar, and provide for a frame specific cookie jar. + + https://bugs.webkit.org/show_bug.cgi?id=34878 + + * WebKit.gyp: + * public/WebCookieJar.h: Added. + * public/WebFrameClient.h: + (WebKit::WebFrameClient::cookieJar): + * public/WebKitClient.h: + (WebKit::WebKitClient::cookieJar): + (WebKit::WebKitClient::setCookies): + (WebKit::WebKitClient::cookies): + (WebKit::WebKitClient::rawCookies): + (WebKit::WebKitClient::deleteCookie): + (WebKit::WebKitClient::cookiesEnabled): + * src/ChromiumBridge.cpp: + (WebCore::getCookieJar): + (WebCore::ChromiumBridge::setCookies): + (WebCore::ChromiumBridge::cookies): + (WebCore::ChromiumBridge::rawCookies): + (WebCore::ChromiumBridge::deleteCookie): + (WebCore::ChromiumBridge::cookiesEnabled): + +2010-02-12 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by David Levin. + + Chromium: provide theme overrides for Chromium devtools on Mac. + + https://bugs.webkit.org/show_bug.cgi?id=34856 + + * src/js/devTools.css: + 2010-02-12 Jeremy Orlow <jorlow@chromium.org> Reviewed by Darin Fisher. @@ -2599,7 +15450,6 @@ (WebKit::AutocompletePopupMenuClient::resetLastFieldValue): * src/AutocompletePopupMenuClient.h: - 2009-12-28 Kinuko Yasuda <kinuko@chromium.org> Reviewed by Maciej Stachowiak. diff --git a/WebKit/chromium/DEPS b/WebKit/chromium/DEPS index 9c45b83..c189f59 100644 --- a/WebKit/chromium/DEPS +++ b/WebKit/chromium/DEPS @@ -32,55 +32,43 @@ vars = { 'chromium_svn': 'http://src.chromium.org/svn/trunk/src', - 'chromium_deps_svn': 'http://src.chromium.org/svn/trunk/deps/third_party', - - # Dependencies' revisions to use: - 'chromium_rev': '38580', - 'google-url_rev': '121', - 'gtest_rev': '359', - 'gyp_rev': '781', - 'icu_rev': '37341', - 'openvcdiff_rev': '28', - 'ots_rev': '26', - 'skia_rev': '490', - 'v8_rev': '3781', - - # Windows: - 'cygwin_rev': '11984', - 'ffmpeg_ia32_rev': '34297', - 'pthreads-win32_rev': '26716', - 'python_24_rev': '22967', - 'nss_rev': '36871', + 'chromium_rev': '57298', } deps = { + 'chromium_deps': + File(Var('chromium_svn')+'/DEPS@'+Var('chromium_rev')), + # build tools 'build': Var('chromium_svn')+'/build@'+Var('chromium_rev'), + 'tools/data_pack': + Var('chromium_svn')+'/tools/data_pack@'+Var('chromium_rev'), 'tools/gyp': - 'http://gyp.googlecode.com/svn/trunk@'+Var('gyp_rev'), + From('chromium_deps', 'src/tools/gyp'), # Basic tools 'base': Var('chromium_svn')+'/base@'+Var('chromium_rev'), + 'gfx': + Var('chromium_svn')+'/gfx@'+Var('chromium_rev'), # skia dependencies 'skia': Var('chromium_svn')+'/skia@'+Var('chromium_rev'), - 'third_party/skia': - 'http://skia.googlecode.com/svn/trunk@'+Var('skia_rev'), + 'third_party/skia/src': + From('chromium_deps', 'src/third_party/skia/src'), + 'third_party/skia/include': + From('chromium_deps', 'src/third_party/skia/include'), # testing 'testing': Var('chromium_svn')+'/testing@'+Var('chromium_rev'), 'testing/gtest': - 'http://googletest.googlecode.com/svn/trunk@'+Var('gtest_rev'), + From('chromium_deps', 'src/testing/gtest'), # v8 javascript engine - 'v8': - 'http://v8.googlecode.com/svn/trunk@'+Var('v8_rev'), - 'testing/gtest': - 'http://googletest.googlecode.com/svn/trunk@'+Var('gtest_rev'), + 'v8': From('chromium_deps', 'src/v8'), # net dependencies 'net': @@ -88,73 +76,71 @@ deps = { 'sdch': Var('chromium_svn')+'/sdch@'+Var('chromium_rev'), 'sdch/open-vcdiff': - 'http://open-vcdiff.googlecode.com/svn/trunk@'+Var('openvcdiff_rev'), + From('chromium_deps', 'src/sdch/open-vcdiff'), 'googleurl': - 'http://google-url.googlecode.com/svn/trunk@'+Var('google-url_rev'), + From('chromium_deps', 'src/googleurl'), + + # webkit dependencies + 'webkit': Var('chromium_svn')+'/webkit@'+Var('chromium_rev'), + + 'app': + Var('chromium_svn')+'/app@'+Var('chromium_rev'), # needed by appcache + 'gpu': + Var('chromium_svn')+'/gpu@'+Var('chromium_rev'), + 'media': + Var('chromium_svn')+'/media@'+Var('chromium_rev'), + 'printing': + Var('chromium_svn')+'/printing@'+Var('chromium_rev'), + 'third_party/angle': # needed by the gpu process + From('chromium_deps', 'src/third_party/angle'), + 'third_party/ffmpeg': # needed by webkit/media + From('chromium_deps', 'src/third_party/ffmpeg'), + 'third_party/libvpx/include': + From('chromium_deps', 'src/third_party/libvpx/include'), + 'third_party/libvpx/lib': + From('chromium_deps', 'src/third_party/libvpx/lib'), + 'tools/grit': + Var('chromium_svn')+'/tools/grit@'+Var('chromium_rev'), + 'tools/generate_stubs': + Var('chromium_svn')+'/tools/generate_stubs@'+Var('chromium_rev'), # other third party + 'third_party': + Var('chromium_svn')+'/third_party@'+Var('chromium_rev'), 'third_party/icu': - Var('chromium_deps_svn')+'/icu42@'+Var('icu_rev'), - - 'third_party/bzip2': - Var('chromium_svn')+'/third_party/bzip2@'+Var('chromium_rev'), - - 'third_party/libevent': - Var('chromium_svn')+'/third_party/libevent@'+Var('chromium_rev'), - - 'third_party/libjpeg': - Var('chromium_svn')+'/third_party/libjpeg@'+Var('chromium_rev'), - - 'third_party/libpng': - Var('chromium_svn')+'/third_party/libpng@'+Var('chromium_rev'), - - 'third_party/libxml': - Var('chromium_svn')+'/third_party/libxml@'+Var('chromium_rev'), - - 'third_party/libxslt': - Var('chromium_svn')+'/third_party/libxslt@'+Var('chromium_rev'), - - 'third_party/modp_b64': - Var('chromium_svn')+'/third_party/modp_b64@'+Var('chromium_rev'), - - 'third_party/npapi': - Var('chromium_svn')+'/third_party/npapi@'+Var('chromium_rev'), - + From('chromium_deps', 'src/third_party/icu'), + 'third_party/ppapi': + From('chromium_deps', 'src/third_party/ppapi'), 'third_party/ots': - 'http://ots.googlecode.com/svn/trunk@'+Var('ots_rev'), - - 'third_party/sqlite': - Var('chromium_svn')+'/third_party/sqlite@'+Var('chromium_rev'), - - 'third_party/zlib': - Var('chromium_svn')+'/third_party/zlib@'+Var('chromium_rev'), + From('chromium_deps', 'src/third_party/ots'), } deps_os = { 'win': { 'third_party/cygwin': - Var('chromium_deps_svn')+'/cygwin@'+Var('cygwin_rev'), - + From('chromium_deps', 'src/third_party/cygwin'), 'third_party/python_24': - Var('chromium_deps_svn')+'/python_24@'+Var('python_24_rev'), - + From('chromium_deps', 'src/third_party/python_24'), 'third_party/ffmpeg/binaries/chromium/win/ia32': - Var('chromium_deps_svn')+'/ffmpeg/binaries/win@'+Var('ffmpeg_ia32_rev'), - - 'third_party/pthreads-win32': - Var('chromium_deps_svn')+'/pthreads-win32@'+Var('pthreads-win32_rev'), - - # base.gypi depends on nss on Windows - 'third_party/nss': - Var('chromium_deps_svn')+'/nss@'+Var('nss_rev'), + From('chromium_deps', 'src/third_party/ffmpeg/binaries/chromium/win/ia32'), + 'third_party/lighttpd': + From('chromium_deps', 'src/third_party/lighttpd'), + 'third_party/nss': + From('chromium_deps', 'src/third_party/nss'), + }, + 'mac': { + # needed by ffmpeg + 'third_party/yasm/source/patched-yasm': + From('chromium_deps', 'src/third_party/yasm/source/patched-yasm'), + 'third_party/nss': + From('chromium_deps', 'src/third_party/nss'), }, 'unix': { # Linux, actually. - 'third_party/harfbuzz': - Var('chromium_svn')+'/third_party/harfbuzz@'+Var('chromium_rev'), - 'tools/xdisplaycheck': Var('chromium_svn')+'/tools/xdisplaycheck@'+Var('chromium_rev'), + 'third_party/yasm/source/patched-yasm': + From('chromium_deps', 'src/third_party/yasm/source/patched-yasm'), }, } diff --git a/WebKit/chromium/WebKit.grd b/WebKit/chromium/WebKit.grd new file mode 100644 index 0000000..92ee008 --- /dev/null +++ b/WebKit/chromium/WebKit.grd @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<grit latest_public_release="0" current_release="1"> + <outputs> + <output filename="grit/webkit_chromium_resources.h" type="rc_header"> + <emit emit_type='prepend'></emit> + </output> + <output filename="webkit_chromium_resources.rc" type="rc_all" /> + <output filename="webkit_chromium_resources.pak" type="data_package" /> + </outputs> + <release seq="1"> + <includes> + <include name="IDR_DEVTOOLS_DEBUGGER_SCRIPT_JS" file="src\js\DebuggerScript.js" type="BINDATA"/> + <include name="IDR_DEVTOOLS_INJECT_WEBKIT_JS" file="..\..\WebCore\inspector\front-end\InjectedScript.js" type="BINDATA"/> + </includes> + </release> +</grit> diff --git a/WebKit/chromium/WebKit.gyp b/WebKit/chromium/WebKit.gyp index 4b0ad2b..9443d8e 100644 --- a/WebKit/chromium/WebKit.gyp +++ b/WebKit/chromium/WebKit.gyp @@ -1,5 +1,5 @@ # -# Copyright (C) 2009 Google Inc. All rights reserved. +# 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 @@ -30,6 +30,9 @@ { 'includes': [ + '../../WebCore/WebCore.gypi', + '../../WebKitTools/DumpRenderTree/DumpRenderTree.gypi', + 'WebKit.gypi', 'features.gypi', ], 'variables': { @@ -41,38 +44,72 @@ # Webkit is being built outside of the full chromium project. # e.g. via build-webkit --chromium 'chromium_src_dir': '../../WebKit/chromium', + + # List of DevTools source files, ordered by dependencies. It is used both + # for copying them to resource dir, and for generating 'devtools.html' file. + 'devtools_files': [ + '<@(devtools_css_files)', + '../../WebKit/chromium/v8/tools/codemap.js', + '../../WebKit/chromium/v8/tools/consarray.js', + '../../WebKit/chromium/v8/tools/csvparser.js', + '../../WebKit/chromium/v8/tools/logreader.js', + '../../WebKit/chromium/v8/tools/profile.js', + '../../WebKit/chromium/v8/tools/profile_view.js', + '../../WebKit/chromium/v8/tools/splaytree.js', + '<@(devtools_js_files)', + ], },{ # WebKit is checked out in src/chromium/third_party/WebKit 'chromium_src_dir': '../../../..', - }], - # We can't turn on warnings on Windows and Linux until we upstream the - # WebKit API. - ['OS=="mac"', { - 'chromium_code': 1, + + 'devtools_files': [ + '<@(devtools_css_files)', + '../../../../v8/tools/codemap.js', + '../../../../v8/tools/consarray.js', + '../../../../v8/tools/csvparser.js', + '../../../../v8/tools/logreader.js', + '../../../../v8/tools/profile.js', + '../../../../v8/tools/profile_view.js', + '../../../../v8/tools/splaytree.js', + '<@(devtools_js_files)', + ], }], ], + 'ahem_path': '../../WebKitTools/DumpRenderTree/qt/fonts/AHEM____.TTF', + + # If debug_devtools is set to 1, JavaScript files for DevTools are + # stored as is. Otherwise, a concatenated file is stored. + 'debug_devtools%': 0, }, 'targets': [ { 'target_name': 'webkit', - 'type': '<(webkit_target_type)', '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', + ], + 'export_dependent_settings': [ + '<(chromium_src_dir)/skia/skia.gyp:skia', + '<(chromium_src_dir)/third_party/npapi/npapi.gyp:npapi', ], 'include_dirs': [ 'public', 'src', ], 'defines': [ - 'WEBKIT_IMPLEMENTATION', + 'WEBKIT_IMPLEMENTATION=1', ], 'sources': [ 'public/gtk/WebInputEventFactory.h', 'public/linux/WebFontRendering.h', + 'public/linux/WebFontRenderStyle.h', 'public/linux/WebRenderTheme.h', 'public/x11/WebScreenInfoFactory.h', 'public/mac/WebInputEventFactory.h', + 'public/mac/WebSandboxSupport.h', 'public/mac/WebScreenInfoFactory.h', 'public/WebAccessibilityCache.h', 'public/WebAccessibilityObject.h', @@ -80,7 +117,11 @@ 'public/WebAnimationController.h', 'public/WebApplicationCacheHost.h', 'public/WebApplicationCacheHostClient.h', + 'public/WebAttribute.h', 'public/WebBindings.h', + 'public/WebBlobData.h', + 'public/WebBlobRegistry.h', + 'public/WebBlobStorageData.h', 'public/WebCache.h', 'public/WebCanvas.h', 'public/WebClipboard.h', @@ -88,13 +129,19 @@ 'public/WebColorName.h', 'public/WebCommon.h', 'public/WebCommonWorkerClient.h', - 'public/WebCompositionCommand.h', + 'public/WebCompositionUnderline.h', 'public/WebConsoleMessage.h', 'public/WebContextMenuData.h', 'public/WebCookie.h', + 'public/WebCookieJar.h', 'public/WebCrossOriginPreflightResultCache.h', 'public/WebCString.h', 'public/WebCursorInfo.h', + 'public/WebDOMEvent.h', + 'public/WebDOMEventListener.h', + 'public/WebDOMMouseEvent.h', + 'public/WebDOMMutationEvent.h', + 'public/WebDOMStringList.h', 'public/WebData.h', 'public/WebDatabase.h', 'public/WebDatabaseObserver.h', @@ -103,30 +150,62 @@ 'public/WebDevToolsAgentClient.h', 'public/WebDevToolsFrontend.h', 'public/WebDevToolsFrontendClient.h', - 'public/WebDevToolsMessageData.h', + 'public/WebDeviceOrientation.h', + 'public/WebDeviceOrientationClient.h', + 'public/WebDeviceOrientationClientMock.h', + 'public/WebDeviceOrientationController.h', 'public/WebDocument.h', + 'public/WebDocumentType.h', 'public/WebDragData.h', 'public/WebEditingAction.h', 'public/WebElement.h', - 'public/WebEvent.h', - 'public/WebEventListener.h', 'public/WebFileChooserCompletion.h', 'public/WebFileChooserParams.h', + 'public/WebFileError.h', 'public/WebFileInfo.h', + 'public/WebFileSystem.h', + 'public/WebFileSystemCallbacks.h', + 'public/WebFileSystemEntry.h', + 'public/WebFileUtilities.h', 'public/WebFindOptions.h', + 'public/WebFloatPoint.h', + 'public/WebFloatRect.h', + 'public/WebFont.h', + 'public/WebFontDescription.h', 'public/WebFrame.h', 'public/WebFrameClient.h', 'public/WebFontCache.h', + 'public/WebFormControlElement.h', 'public/WebFormElement.h', + 'public/WebGeolocationService.h', + 'public/WebGeolocationServiceBridge.h', + 'public/WebGeolocationServiceMock.h', 'public/WebGlyphCache.h', + 'public/WebGLES2Context.h', + 'public/WebGraphicsContext3D.h', 'public/WebHistoryItem.h', 'public/WebHTTPBody.h', 'public/WebImage.h', + 'public/WebImageDecoder.h', + 'public/WebIDBCallbacks.h', + 'public/WebIDBCursor.h', + 'public/WebIDBDatabase.h', + 'public/WebIDBDatabaseError.h', + 'public/WebIDBFactory.h', + 'public/WebIDBKeyRange.h', + 'public/WebIDBIndex.h', + 'public/WebIDBKey.h', + 'public/WebIDBKeyPath.h', + 'public/WebIDBObjectStore.h', + 'public/WebIDBTransaction.h', + 'public/WebIDBTransactionCallbacks.h', 'public/WebInputElement.h', 'public/WebInputEvent.h', 'public/WebKit.h', 'public/WebKitClient.h', + 'public/WebLabelElement.h', 'public/WebLocalizedString.h', + 'public/WebMediaElement.h', 'public/WebMediaPlayer.h', 'public/WebMediaPlayerAction.h', 'public/WebMediaPlayerClient.h', @@ -134,7 +213,7 @@ 'public/WebMessagePortChannel.h', 'public/WebMessagePortChannelClient.h', 'public/WebMimeRegistry.h', - 'public/WebMutationEvent.h', + 'public/WebNamedNodeMap.h', 'public/WebNavigationType.h', 'public/WebNode.h', 'public/WebNodeCollection.h', @@ -143,26 +222,35 @@ 'public/WebNotification.h', 'public/WebNotificationPresenter.h', 'public/WebNotificationPermissionCallback.h', + 'public/WebOptionElement.h', 'public/WebPageSerializer.h', 'public/WebPageSerializerClient.h', 'public/WebPasswordAutocompleteListener.h', 'public/WebPasswordFormData.h', 'public/WebPlugin.h', 'public/WebPluginContainer.h', + 'public/WebPluginDocument.h', 'public/WebPluginListBuilder.h', 'public/WebPoint.h', 'public/WebPopupMenu.h', 'public/WebPopupMenuInfo.h', + 'public/WebPopupType.h', + 'public/WebPrivatePtr.h', + 'public/WebPrivateOwnPtr.h', 'public/WebRange.h', 'public/WebRect.h', 'public/WebRegularExpression.h', 'public/WebRuntimeFeatures.h', + 'public/WebScrollbar.h', + 'public/WebScrollbarClient.h', 'public/WebScreenInfo.h', 'public/WebScriptController.h', 'public/WebScriptSource.h', 'public/WebSearchableFormData.h', 'public/WebSecurityOrigin.h', 'public/WebSecurityPolicy.h', + 'public/WebSelectElement.h', + 'public/WebSerializedScriptValue.h', 'public/WebSettings.h', 'public/WebSharedWorker.h', 'public/WebSharedWorkerRepository.h', @@ -170,6 +258,9 @@ 'public/WebSocketStreamError.h', 'public/WebSocketStreamHandle.h', 'public/WebSocketStreamHandleClient.h', + 'public/WebSpeechInputController.h', + 'public/WebSpeechInputControllerMock.h', + 'public/WebSpeechInputListener.h', 'public/WebStorageArea.h', 'public/WebStorageEventDispatcher.h', 'public/WebStorageNamespace.h', @@ -177,9 +268,13 @@ 'public/WebTextAffinity.h', 'public/WebTextCaseSensitivity.h', 'public/WebTextDirection.h', + 'public/WebTextInputType.h', + 'public/WebTextRun.h', + 'public/WebThemeEngine.h', 'public/WebURL.h', 'public/WebURLError.h', 'public/WebURLLoader.h', + 'public/WebURLLoadTiming.h', 'public/WebURLLoaderClient.h', 'public/WebURLRequest.h', 'public/WebURLResponse.h', @@ -194,16 +289,15 @@ 'public/win/WebSandboxSupport.h', 'public/win/WebScreenInfoFactory.h', 'public/win/WebScreenInfoFactory.h', - 'src/APUAgentDelegate.h', 'src/ApplicationCacheHost.cpp', 'src/ApplicationCacheHostInternal.h', 'src/AssertMatchingEnums.cpp', - 'src/AutocompletePopupMenuClient.cpp', - 'src/AutocompletePopupMenuClient.h', 'src/AutoFillPopupMenuClient.cpp', 'src/AutoFillPopupMenuClient.h', 'src/BackForwardListClientImpl.cpp', 'src/BackForwardListClientImpl.h', + 'src/BlobRegistryProxy.cpp', + 'src/BlobRegistryProxy.h', 'src/BoundObject.cpp', 'src/BoundObject.h', 'src/ChromeClientImpl.cpp', @@ -211,32 +305,60 @@ 'src/ChromiumBridge.cpp', 'src/ChromiumCurrentTime.cpp', 'src/ChromiumThreading.cpp', + 'src/CompositionUnderlineBuilder.h', + 'src/CompositionUnderlineVectorBuilder.cpp', + 'src/CompositionUnderlineVectorBuilder.h', 'src/ContextMenuClientImpl.cpp', 'src/ContextMenuClientImpl.h', 'src/DatabaseObserver.cpp', - 'src/DebuggerAgent.h', 'src/DebuggerAgentImpl.cpp', 'src/DebuggerAgentImpl.h', 'src/DebuggerAgentManager.cpp', 'src/DebuggerAgentManager.h', - 'src/DevToolsRPC.h', - 'src/DevToolsRPCJS.h', + 'src/DeviceOrientationClientProxy.cpp', + 'src/DeviceOrientationClientProxy.h', 'src/DOMUtilitiesPrivate.cpp', 'src/DOMUtilitiesPrivate.h', 'src/DragClientImpl.cpp', 'src/DragClientImpl.h', + 'src/DragScrollTimer.cpp', + 'src/DragScrollTimer.h', 'src/EditorClientImpl.cpp', 'src/EditorClientImpl.h', 'src/EventListenerWrapper.cpp', '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', + 'src/IDBCallbacksProxy.cpp', + 'src/IDBCallbacksProxy.h', + 'src/IDBCursorBackendProxy.cpp', + 'src/IDBCursorBackendProxy.h', + 'src/IDBDatabaseProxy.cpp', + 'src/IDBDatabaseProxy.h', + 'src/IDBFactoryBackendProxy.cpp', + 'src/IDBFactoryBackendProxy.h', + 'src/IDBIndexBackendProxy.cpp', + 'src/IDBIndexBackendProxy.h', + 'src/IDBObjectStoreProxy.cpp', + 'src/IDBObjectStoreProxy.h', + 'src/IDBTransactionBackendProxy.cpp', + 'src/IDBTransactionBackendProxy.h', + 'src/IDBTransactionCallbacksProxy.cpp', + 'src/IDBTransactionCallbacksProxy.h', 'src/InspectorClientImpl.cpp', 'src/InspectorClientImpl.h', + 'src/InspectorFrontendClientImpl.cpp', + 'src/InspectorFrontendClientImpl.h', 'src/linux/WebFontRendering.cpp', + 'src/linux/WebFontRenderStyle.cpp', 'src/linux/WebRenderTheme.cpp', 'src/x11/WebScreenInfoFactory.cpp', 'src/mac/WebInputEventFactory.mm', @@ -247,12 +369,11 @@ 'src/NotificationPresenterImpl.cpp', 'src/PlatformMessagePortChannel.cpp', 'src/PlatformMessagePortChannel.h', - 'src/ProfilerAgent.h', - 'src/ProfilerAgentImpl.cpp', - 'src/ProfilerAgentImpl.h', 'src/ResourceHandle.cpp', 'src/SharedWorkerRepository.cpp', 'src/SocketStreamHandle.cpp', + 'src/SpeechInputClientImpl.cpp', + 'src/SpeechInputClientImpl.h', 'src/StorageAreaProxy.cpp', 'src/StorageAreaProxy.h', 'src/StorageEventDispatcherChromium.cpp', @@ -260,22 +381,32 @@ 'src/StorageEventDispatcherImpl.h', 'src/StorageNamespaceProxy.cpp', 'src/StorageNamespaceProxy.h', - 'src/SuggestionsPopupMenuClient.cpp', - 'src/SuggestionsPopupMenuClient.h', 'src/TemporaryGlue.h', - 'src/ToolsAgent.h', + 'src/VideoFrameChromiumImpl.cpp', + 'src/VideoFrameChromiumImpl.h', 'src/WebAccessibilityCache.cpp', 'src/WebAccessibilityCacheImpl.cpp', 'src/WebAccessibilityCacheImpl.h', 'src/WebAccessibilityObject.cpp', 'src/WebAnimationControllerImpl.cpp', 'src/WebAnimationControllerImpl.h', + 'src/WebAttribute.cpp', 'src/WebBindings.cpp', + 'src/WebBlobData.cpp', + 'src/WebBlobStorageData.cpp', 'src/WebCache.cpp', 'src/WebColor.cpp', + 'src/WebCommon.cpp', 'src/WebCrossOriginPreflightResultCache.cpp', 'src/WebCString.cpp', 'src/WebCursorInfo.cpp', + 'src/WebDOMEvent.cpp', + 'src/WebDOMEventListener.cpp', + 'src/WebDOMEventListenerPrivate.cpp', + 'src/WebDOMEventListenerPrivate.h', + 'src/WebDOMMouseEvent.cpp', + 'src/WebDOMMutationEvent.cpp', + 'src/WebDOMStringList.cpp', 'src/WebData.cpp', 'src/WebDatabase.cpp', 'src/WebDataSourceImpl.cpp', @@ -284,38 +415,74 @@ 'src/WebDevToolsAgentImpl.h', 'src/WebDevToolsFrontendImpl.cpp', 'src/WebDevToolsFrontendImpl.h', + 'src/WebDeviceOrientation.cpp', + 'src/WebDeviceOrientationClientMock.cpp', + 'src/WebDeviceOrientationController.cpp', 'src/WebDocument.cpp', + 'src/WebDocumentType.cpp', 'src/WebDragData.cpp', 'src/WebElement.cpp', 'src/WebEntities.cpp', 'src/WebEntities.h', - 'src/WebEvent.cpp', - 'src/WebEventListener.cpp', - 'src/WebEventListenerPrivate.cpp', - 'src/WebEventListenerPrivate.h', 'src/WebFileChooserCompletionImpl.cpp', 'src/WebFileChooserCompletionImpl.h', + 'src/WebFileSystemCallbacksImpl.cpp', + 'src/WebFileSystemCallbacksImpl.h', 'src/WebFontCache.cpp', + 'src/WebFontDescription.cpp', + 'src/WebFontImpl.cpp', + 'src/WebFontImpl.h', + 'src/WebFormControlElement.cpp', 'src/WebFormElement.cpp', 'src/WebFrameImpl.cpp', 'src/WebFrameImpl.h', + 'src/WebGeolocationServiceBridgeImpl.cpp', + 'src/WebGeolocationServiceBridgeImpl.h', + 'src/WebGeolocationServiceMock.cpp', 'src/WebGlyphCache.cpp', + 'src/WebGraphicsContext3D.cpp', + 'src/WebGraphicsContext3DDefaultImpl.cpp', + 'src/WebGraphicsContext3DDefaultImpl.h', 'src/WebHistoryItem.cpp', 'src/WebHTTPBody.cpp', + 'src/WebIDBCallbacksImpl.cpp', + 'src/WebIDBCallbacksImpl.h', + 'src/WebIDBCursorImpl.cpp', + 'src/WebIDBCursorImpl.h', + 'src/WebIDBDatabaseError.cpp', + 'src/WebIDBDatabaseImpl.cpp', + 'src/WebIDBDatabaseImpl.h', + 'src/WebIDBFactoryImpl.cpp', + 'src/WebIDBFactoryImpl.h', + 'src/WebIDBIndexImpl.cpp', + 'src/WebIDBIndexImpl.h', + 'src/WebIDBKey.cpp', + 'src/WebIDBKeyPath.cpp', + 'src/WebIDBKeyRange.cpp', + 'src/WebIDBObjectStoreImpl.cpp', + 'src/WebIDBObjectStoreImpl.h', + 'src/WebIDBTransactionImpl.cpp', + 'src/WebIDBTransactionImpl.h', + 'src/WebIDBTransactionCallbacksImpl.cpp', + 'src/WebIDBTransactionCallbacksImpl.h', 'src/WebImageCG.cpp', + 'src/WebImageDecoder.cpp', 'src/WebImageSkia.cpp', 'src/WebInputElement.cpp', 'src/WebInputEvent.cpp', 'src/WebInputEventConversion.cpp', 'src/WebInputEventConversion.h', 'src/WebKit.cpp', + 'src/WebLabelElement.cpp', + 'src/WebMediaElement.cpp', 'src/WebMediaPlayerClientImpl.cpp', 'src/WebMediaPlayerClientImpl.h', - 'src/WebMutationEvent.cpp', + 'src/WebNamedNodeMap.cpp', 'src/WebNode.cpp', 'src/WebNodeCollection.cpp', 'src/WebNodeList.cpp', 'src/WebNotification.cpp', + 'src/WebOptionElement.cpp', 'src/WebPageSerializer.cpp', 'src/WebPageSerializerImpl.cpp', 'src/WebPageSerializerImpl.h', @@ -324,6 +491,7 @@ 'src/WebPasswordFormUtils.h', 'src/WebPluginContainerImpl.h', 'src/WebPluginContainerImpl.cpp', + 'src/WebPluginDocument.cpp', 'src/WebPluginListBuilderImpl.cpp', 'src/WebPluginListBuilderImpl.h', 'src/WebPluginLoadObserver.cpp', @@ -334,13 +502,19 @@ 'src/WebRegularExpression.cpp', 'src/WebRuntimeFeatures.cpp', 'src/WebScriptController.cpp', + 'src/WebScrollbarImpl.cpp', + 'src/WebScrollbarImpl.h', 'src/WebSearchableFormData.cpp', 'src/WebSecurityOrigin.cpp', 'src/WebSecurityPolicy.cpp', + 'src/WebSelectElement.cpp', + 'src/WebSerializedScriptValue.cpp', 'src/WebSettingsImpl.cpp', 'src/WebSettingsImpl.h', 'src/WebSharedWorkerImpl.cpp', 'src/WebSharedWorkerImpl.h', + 'src/WebSpeechInputControllerMockImpl.cpp', + 'src/WebSpeechInputControllerMockImpl.h', 'src/WebStorageAreaImpl.cpp', 'src/WebStorageAreaImpl.h', 'src/WebStorageEventDispatcherImpl.cpp', @@ -348,7 +522,9 @@ 'src/WebStorageNamespaceImpl.cpp', 'src/WebStorageNamespaceImpl.h', 'src/WebString.cpp', + 'src/WebTextRun.cpp', 'src/WebURL.cpp', + 'src/WebURLLoadTiming.cpp', 'src/WebURLRequest.cpp', 'src/WebURLRequestPrivate.h', 'src/WebURLResponse.cpp', @@ -368,6 +544,43 @@ 'src/win/WebScreenInfoFactory.cpp', ], 'conditions': [ + ['inside_chromium_build==1 and OS=="win"', { + 'type': '<(component)', + + 'conditions': [ + ['component=="shared_library"', { + 'defines': [ + 'WEBKIT_DLL', + ], + 'dependencies': [ + '../../WebCore/WebCore.gyp/WebCore.gyp:webcore_bindings', + '<(chromium_src_dir)/build/temp_gyp/googleurl.gyp:googleurl', + '<(chromium_src_dir)/gpu/gpu.gyp:gles2_c_lib', + '<(chromium_src_dir)/third_party/icu/icu.gyp:*', + '<(chromium_src_dir)/third_party/libjpeg/libjpeg.gyp:libjpeg', + '<(chromium_src_dir)/third_party/libpng/libpng.gyp:libpng', + '<(chromium_src_dir)/third_party/libxml/libxml.gyp:libxml', + '<(chromium_src_dir)/third_party/libxslt/libxslt.gyp:libxslt', + '<(chromium_src_dir)/third_party/modp_b64/modp_b64.gyp:modp_b64', + '<(chromium_src_dir)/third_party/nss/nss.gyp:*', + '<(chromium_src_dir)/third_party/ots/ots.gyp:ots', + '<(chromium_src_dir)/third_party/zlib/zlib.gyp:zlib', + '<(chromium_src_dir)/v8/tools/gyp/v8.gyp:v8', + ], + 'direct_dependent_settings': { + 'defines': [ + 'WEBKIT_DLL', + ], + }, + 'export_dependent_settings': [ + '<(chromium_src_dir)/build/temp_gyp/googleurl.gyp:googleurl', + '<(chromium_src_dir)/v8/tools/gyp/v8.gyp:v8', + ], + }], + ], + }, { + 'type': '<(webkit_target_type)' + }], ['OS=="linux" or OS=="freebsd"', { 'dependencies': [ '<(chromium_src_dir)/build/linux/system.gyp:fontconfig', @@ -393,6 +606,11 @@ 'sources/': [ ['exclude', 'Skia\\.cpp$'], ], + 'variables': { + # FIXME: Turn on warnings on other platforms and for + # other targets. + 'chromium_code': 1, + } }, { # else: OS!="mac" 'sources/': [ ['exclude', '/mac/'], @@ -407,26 +625,7 @@ '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=="win"', { - 'link_settings': { - 'libraries': [ - '-lopengl32.lib', - ], - }, - }], ['OS=="mac"', { 'link_settings': { 'libraries': [ @@ -438,36 +637,322 @@ }], ], }, + + { + 'target_name': 'inspector_resources', + 'type': 'none', + 'dependencies': [ + 'devtools_html', + '../../WebCore/WebCore.gyp/WebCore.gyp:inspector_protocol_sources', + ], + 'conditions': [ + ['debug_devtools==0', { + 'dependencies': ['concatenated_devtools_js'], + }], + ], + 'copies': [ + { + 'destination': '<(PRODUCT_DIR)/resources/inspector', + 'files': [ + '<@(devtools_files)', + '<@(webinspector_files)', + '<(SHARED_INTERMEDIATE_DIR)/webcore/InspectorBackendStub.js', + ], + 'conditions': [ + ['debug_devtools==0', { + 'files/': [['exclude', '\\.js$']], + }], + ], + }, + { + 'destination': '<(PRODUCT_DIR)/resources/inspector/Images', + 'files': [ + '<@(webinspector_image_files)', + '<@(devtools_image_files)', + ], + }, + ], + }, + { + 'target_name': 'devtools_html', + 'type': 'none', + 'sources': ['<(PRODUCT_DIR)/resources/inspector/devtools.html'], + 'actions': [{ + 'action_name': 'devtools_html', + 'inputs': [ + '<(chromium_src_dir)/webkit/build/generate_devtools_html.py', + # See issue 29695: WebKit.gypi is a source file for devtools.html. + 'WebKit.gypi', + '../../WebCore/inspector/front-end/inspector.html', + ], + 'outputs': ['<(PRODUCT_DIR)/resources/inspector/devtools.html'], + 'action': ['python', '<@(_inputs)', '<@(_outputs)', '<@(devtools_files)'], + }], + }, + { + 'target_name': 'concatenated_devtools_js', + 'type': 'none', + 'dependencies': [ + 'devtools_html', + '../../WebCore/WebCore.gyp/WebCore.gyp:inspector_protocol_sources' + ], + 'sources': ['<(PRODUCT_DIR)/resources/inspector/DevTools.js'], + 'actions': [{ + 'action_name': 'concatenate_devtools_js', + 'script_name': '<(chromium_src_dir)/webkit/build/concatenate_js_files.py', + 'input_page': '<(PRODUCT_DIR)/resources/inspector/devtools.html', + 'inputs': [ + '<@(_script_name)', + '<@(_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'], + 'action': ['python', '<@(_script_name)', '<@(_input_page)', '<@(_search_path)', '<@(_outputs)'], + }], + }, + { 'target_name': 'webkit_unit_tests', + 'conditions': [ + # FIXME: make webkit unit tests working for multi dll build. + ['inside_chromium_build==1 and OS=="win" and component=="shared_library"', { + 'type': 'none', + }, { + 'type': 'executable', + 'msvs_guid': '7CEFE800-8403-418A-AD6A-2D52C6FC3EAD', + 'dependencies': [ + 'webkit', + '../../WebCore/WebCore.gyp/WebCore.gyp:webcore', + '<(chromium_src_dir)/testing/gtest.gyp:gtest', + '<(chromium_src_dir)/base/base.gyp:base', + '<(chromium_src_dir)/base/base.gyp:base_i18n', + '<(chromium_src_dir)/base/base.gyp:test_support_base', + '<(chromium_src_dir)/gpu/gpu.gyp:gles2_c_lib', + '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_support', + ], + 'include_dirs': [ + 'public', + 'src', + ], + 'sources': [ + 'tests/DragImageTest.cpp', + 'tests/IDBBindingUtilitiesTest.cpp', + 'tests/IDBKeyPathTest.cpp', + 'tests/KeyboardTest.cpp', + 'tests/KURLTest.cpp', + 'tests/RunAllTests.cpp', + 'tests/TilingDataTest.cpp', + ], + 'conditions': [ + ['OS=="win"', { + 'sources': [ + # FIXME: Port PopupMenuTest and WebFrameTest to Linux and Mac. + 'tests/PopupMenuTest.cpp', + 'tests/TransparencyWinTest.cpp', + 'tests/UniscribeHelperTest.cpp', + 'tests/WebFrameTest.cpp', + ], + }], + ['OS=="mac"', { + 'sources!': [ + # FIXME: Port DragImageTest to Mac. + 'tests/DragImageTest.cpp', + ], + }], + ['OS=="linux"', { + 'sources': [ + 'tests/WebInputEventFactoryTestGtk.cpp', + ], + 'include_dirs': [ + 'public/gtk', + ], + }], + ], + }], + ], + }, + { + 'target_name': 'ImageDiff', 'type': 'executable', - 'msvs_guid': '7CEFE800-8403-418A-AD6A-2D52C6FC3EAD', 'dependencies': [ 'webkit', - '../../WebCore/WebCore.gyp/WebCore.gyp:webcore', - '<(chromium_src_dir)/testing/gtest.gyp:gtest', - '<(chromium_src_dir)/base/base.gyp:base', - '<(chromium_src_dir)/base/base.gyp:base_i18n', + '../../JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:wtf', + '<(chromium_src_dir)/gfx/gfx.gyp:gfx', ], 'include_dirs': [ - 'public', - 'src', + '../../JavaScriptCore', + '<(DEPTH)', ], 'sources': [ - 'tests/KeyboardTest.cpp', - 'tests/KURLTest.cpp', - 'tests/RunAllTests.cpp', + '../../WebKitTools/DumpRenderTree/chromium/ImageDiff.cpp', + ], + }, + { + 'target_name': 'DumpRenderTree', + 'type': 'executable', + 'mac_bundle': 1, + 'dependencies': [ + 'ImageDiff', + 'inspector_resources', + 'webkit', + '../../JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:wtf_config', + '<(chromium_src_dir)/third_party/icu/icu.gyp:icuuc', + '<(chromium_src_dir)/webkit/support/webkit_support.gyp:copy_npapi_layout_test_plugin', + '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_support', + '<(chromium_src_dir)/gpu/gpu.gyp:gles2_c_lib' + ], + 'include_dirs': [ + '.', + '../../JavaScriptCore', + '../../JavaScriptCore/wtf', # wtf/text/*.h refers headers in wtf/ without wtf/. + '<(DEPTH)', + ], + 'defines': [ + # Technically not a unit test but require functions available only to + # unit tests. + 'UNIT_TEST', + ], + 'sources': [ + '<@(drt_files)', ], 'conditions': [ ['OS=="win"', { + 'dependencies': ['LayoutTestHelper'], + + 'resource_include_dirs': ['<(SHARED_INTERMEDIATE_DIR)/webkit'], 'sources': [ - 'tests/TransparencyWinTest.cpp', - 'tests/UniscribeHelperTest.cpp', + '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.rc', + '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.rc', + '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_resources.rc', + '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_en-US.rc', + ], + 'conditions': [ + ['inside_chromium_build==1 and component=="shared_library"', { + 'sources': [ + 'src/ChromiumCurrentTime.cpp', + 'src/ChromiumThreading.cpp', + ], + 'include_dirs': [ + 'public', + ], + 'dependencies': [ + '../../JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:wtf', + ], + }], + ], + 'copies': [{ + 'destination': '<(PRODUCT_DIR)', + 'files': ['<(ahem_path)'], + }], + },{ # OS!="win" + 'sources/': [ + ['exclude', 'Win\\.cpp$'], + ], + 'actions': [ + { + 'action_name': 'repack_locale', + 'variables': { + 'repack_path': '<(chromium_src_dir)/tools/data_pack/repack.py', + 'pak_inputs': [ + '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.pak', + '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.pak', + '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_en-US.pak', + '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_resources.pak', + ]}, + 'inputs': [ + '<(repack_path)', + '<@(pak_inputs)', + ], + 'outputs': [ + '<(INTERMEDIATE_DIR)/repack/DumpRenderTree.pak', + ], + 'action': ['python', '<(repack_path)', '<@(_outputs)', '<@(pak_inputs)'], + 'process_outputs_as_mac_bundle_resources': 1, + }, + ], # actions + }], + ['OS=="mac"', { + 'dependencies': ['LayoutTestHelper'], + + 'mac_bundle_resources': [ + '<(ahem_path)', + '../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher100.ttf', + '../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher200.ttf', + '../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher300.ttf', + '../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher400.ttf', + '../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher500.ttf', + '../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher600.ttf', + '../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher700.ttf', + '../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher800.ttf', + '../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher900.ttf', + '<(SHARED_INTERMEDIATE_DIR)/webkit/textAreaResizeCorner.png', ], + # Workaround for http://code.google.com/p/gyp/issues/detail?id=160 + 'copies': [{ + 'destination': '<(PRODUCT_DIR)/DumpRenderTree.app/Contents/PlugIns/', + 'files': ['<(PRODUCT_DIR)/TestNetscapePlugIn.plugin/'], + }], + },{ # OS!="mac" + 'sources/': [ + # .mm is already excluded by common.gypi + ['exclude', 'Mac\\.cpp$'], + ] + }], + ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', { + 'dependencies': [ + '<(chromium_src_dir)/build/linux/system.gyp:fontconfig', + '<(chromium_src_dir)/build/linux/system.gyp:gtk', + ], + 'include_dirs': [ + 'public/gtk', + ], + 'copies': [{ + 'destination': '<(PRODUCT_DIR)', + 'files': [ + '<(ahem_path)', + '../../WebKitTools/DumpRenderTree/chromium/fonts.conf', + '<(INTERMEDIATE_DIR)/repack/DumpRenderTree.pak', + ] + }], + },{ # OS!="linux" and OS!="freebsd" and OS!="openbsd" and OS!="solaris" + 'sources/': [ + ['exclude', '(Gtk|Linux)\\.cpp$'] + ] }], ], }, ], # targets + 'conditions': [ + ['OS=="win"', { + 'targets': [{ + 'target_name': 'LayoutTestHelper', + 'type': 'executable', + 'sources': ['../../WebKitTools/DumpRenderTree/chromium/LayoutTestHelperWin.cpp'], + }], + }], + ['OS=="mac"', { + 'targets': [ + { + 'target_name': 'LayoutTestHelper', + 'type': 'executable', + 'sources': ['../../WebKitTools/DumpRenderTree/chromium/LayoutTestHelper.mm'], + 'link_settings': { + 'libraries': [ + '$(SDKROOT)/System/Library/Frameworks/AppKit.framework', + ], + }, + }, + ], + }], + ], # conditions } # Local Variables: diff --git a/WebKit/chromium/WebKit.gypi b/WebKit/chromium/WebKit.gypi index 69b1479..b45e3e7 100644 --- a/WebKit/chromium/WebKit.gypi +++ b/WebKit/chromium/WebKit.gypi @@ -33,8 +33,6 @@ # List of DevTools source files, ordered by dependencies. It is used both # for copying them to resource dir, and for generating 'devtools.html' file. 'devtools_js_files': [ - 'src/js/InspectorControllerImpl.js', - 'src/js/DebuggerAgent.js', 'src/js/ProfilerAgent.js', 'src/js/ProfilerProcessor.js', 'src/js/HeapProfilerPanel.js', diff --git a/WebKit/chromium/features.gypi b/WebKit/chromium/features.gypi index 6091b8f..61e5806 100644 --- a/WebKit/chromium/features.gypi +++ b/WebKit/chromium/features.gypi @@ -38,38 +38,68 @@ # 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%': [ - 'ENABLE_3D_CANVAS=0', + '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_OFFLINE_WEB_APPLICATIONS=1', - 'ENABLE_DASHBOARD_SUPPORT=0', + 'ENABLE_DEVICE_ORIENTATION=0', + 'ENABLE_DIRECTORY_UPLOAD=1', 'ENABLE_DOM_STORAGE=1', + 'ENABLE_EVENTSOURCE=1', + 'ENABLE_FILE_READER=1', + 'ENABLE_FILTERS=1', 'ENABLE_GEOLOCATION=1', - 'ENABLE_JAVASCRIPT_DEBUGGER=1', - 'ENABLE_JSC_MULTIPLE_THREADS=0', 'ENABLE_ICONDATABASE=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', 'ENABLE_OPENTYPE_SANITIZER=1', 'ENABLE_ORIENTATION_EVENTS=0', + 'ENABLE_PROGRESS_TAG=1', 'ENABLE_RUBY=1', - 'ENABLE_XHTMLMP=0', - 'ENABLE_XSLT=1', - 'ENABLE_XPATH=1', + 'ENABLE_SANDBOX=1', 'ENABLE_SHARED_WORKERS=1', 'ENABLE_SVG=1', 'ENABLE_SVG_ANIMATION=1', 'ENABLE_SVG_AS_IMAGE=1', - 'ENABLE_SVG_USE=1', - 'ENABLE_SVG_FOREIGN_OBJECT=1', 'ENABLE_SVG_FONTS=1', + '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_XPATH=1', + 'ENABLE_XSLT=1', + ], + + 'conditions': [ + ['OS=="win" or OS=="linux"', { + 'feature_defines': [ + 'WTF_USE_ACCELERATED_COMPOSITING=1', + 'ENABLE_3D_RENDERING=1', + ], + }], ], + + 'use_accelerated_compositing%': 1, + 'enable_svg%': 1, }, + 'feature_defines%': '<(feature_defines)', + 'use_accelerated_compositing%': '<(use_accelerated_compositing)', + 'enable_svg%': '<(enable_svg)', }, } diff --git a/WebKit/chromium/gyp_webkit b/WebKit/chromium/gyp_webkit index ef18239..b7d2308 100644..100755 --- a/WebKit/chromium/gyp_webkit +++ b/WebKit/chromium/gyp_webkit @@ -1,4 +1,4 @@ -# +#!/usr/bin/env python # Copyright (C) 2009 Google Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -32,7 +32,6 @@ import glob import os -import platform import shlex import sys @@ -78,8 +77,12 @@ if __name__ == '__main__': args.extend(['-I' + i for i in additional_include_files(args)]) # On linux, we want gyp to output a makefile (default is scons). - if (platform.system() == 'Linux'): - args.extend(['-fmake']) + if sys.platform == 'linux2': + args.extend(['-fmake', + '--suffix=.chromium', + '--toplevel-dir=../..', + # auto_regeneration doesn't work with toplevel-dir + '-Gauto_regeneration=0']) # Other command args: args.extend([ diff --git a/WebKit/chromium/public/WebAccessibilityCache.h b/WebKit/chromium/public/WebAccessibilityCache.h index 94704a0..52e438c 100644 --- a/WebKit/chromium/public/WebAccessibilityCache.h +++ b/WebKit/chromium/public/WebAccessibilityCache.h @@ -43,8 +43,8 @@ public: WebAccessibilityCache() {} virtual ~WebAccessibilityCache() {} - static WebAccessibilityCache* create(); - static void enableAccessibility(); + WEBKIT_API static WebAccessibilityCache* create(); + WEBKIT_API static void enableAccessibility(); virtual void initialize(WebView* view) = 0; virtual bool isInitialized() const = 0; diff --git a/WebKit/chromium/public/WebAccessibilityObject.h b/WebKit/chromium/public/WebAccessibilityObject.h index f46c0d8..ddb9bda 100644 --- a/WebKit/chromium/public/WebAccessibilityObject.h +++ b/WebKit/chromium/public/WebAccessibilityObject.h @@ -42,6 +42,8 @@ namespace WTF { template <typename T> class PassRefPtr; } namespace WebKit { class WebAccessibilityObjectPrivate; +class WebNode; +class WebDocument; class WebString; struct WebPoint; struct WebRect; @@ -64,42 +66,49 @@ public: bool isNull() const { return !m_private; } - WebString accessibilityDescription() const; - WebString actionVerb() const; - bool canSetFocusAttribute() const; - bool canSetValueAttribute() const; - - unsigned childCount() const; - - WebAccessibilityObject childAt(unsigned) const; - WebAccessibilityObject firstChild() const; - WebAccessibilityObject focusedChild() const; - WebAccessibilityObject lastChild() const; - WebAccessibilityObject nextSibling() const; - WebAccessibilityObject parentObject() const; - WebAccessibilityObject previousSibling() const; - - bool isAnchor() const; - bool isChecked() const; - bool isFocused() const; - bool isEnabled() const; - bool isHovered() const; - bool isIndeterminate() const; - bool isMultiSelectable() const; - bool isOffScreen() const; - bool isPasswordField() const; - bool isPressed() const; - bool isReadOnly() const; - bool isVisited() const; - - WebRect boundingBoxRect() const; - WebString helpText() const; - WebAccessibilityObject hitTest(const WebPoint&) const; - WebString keyboardShortcut() const; - bool performDefaultAction() const; - WebAccessibilityRole roleValue() const; - WebString stringValue() const; - WebString title() const; + WEBKIT_API WebString accessibilityDescription() const; + WEBKIT_API WebString actionVerb() const; + WEBKIT_API bool canSetFocusAttribute() const; + WEBKIT_API bool canSetValueAttribute() const; + + WEBKIT_API unsigned childCount() const; + + WEBKIT_API WebAccessibilityObject childAt(unsigned) const; + WEBKIT_API WebAccessibilityObject firstChild() const; + WEBKIT_API WebAccessibilityObject focusedChild() const; + WEBKIT_API WebAccessibilityObject lastChild() const; + WEBKIT_API WebAccessibilityObject nextSibling() const; + WEBKIT_API WebAccessibilityObject parentObject() const; + WEBKIT_API WebAccessibilityObject previousSibling() const; + + WEBKIT_API bool isAnchor() const; + WEBKIT_API bool isChecked() const; + WEBKIT_API bool isFocused() const; + WEBKIT_API bool isEnabled() const; + WEBKIT_API bool isHovered() const; + WEBKIT_API bool isIndeterminate() const; + WEBKIT_API bool isMultiSelectable() const; + WEBKIT_API bool isOffScreen() const; + WEBKIT_API bool isPasswordField() const; + WEBKIT_API bool isPressed() const; + WEBKIT_API bool isReadOnly() const; + WEBKIT_API bool isVisited() const; + + WEBKIT_API WebRect boundingBoxRect() const; + WEBKIT_API WebString helpText() const; + WEBKIT_API int headingLevel() const; + WEBKIT_API WebAccessibilityObject hitTest(const WebPoint&) const; + WEBKIT_API WebString keyboardShortcut() const; + WEBKIT_API bool performDefaultAction() const; + WEBKIT_API WebAccessibilityRole roleValue() const; + WEBKIT_API void setFocused(bool) const; + WEBKIT_API WebString stringValue() const; + WEBKIT_API WebString title() const; + + WEBKIT_API WebNode node() const; + WEBKIT_API WebDocument document() const; + WEBKIT_API bool hasComputedStyle() const; + WEBKIT_API WebString computedStyleDisplay() const; #if WEBKIT_IMPLEMENTATION WebAccessibilityObject(const WTF::PassRefPtr<WebCore::AccessibilityObject>&); diff --git a/WebKit/chromium/public/WebAccessibilityRole.h b/WebKit/chromium/public/WebAccessibilityRole.h index ec041e0..b0748a7 100644 --- a/WebKit/chromium/public/WebAccessibilityRole.h +++ b/WebKit/chromium/public/WebAccessibilityRole.h @@ -102,6 +102,7 @@ enum WebAccessibilityRole { WebAccessibilityRoleAnnotation, WebAccessibilityRoleSliderThumb, WebAccessibilityRoleIgnored, + WebAccessibilityRolePresentational, WebAccessibilityRoleTab, WebAccessibilityRoleTabList, WebAccessibilityRoleTabPanel, 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/WebApplicationCacheHost.h b/WebKit/chromium/public/WebApplicationCacheHost.h index 7c5dafe..acbc106 100644 --- a/WebKit/chromium/public/WebApplicationCacheHost.h +++ b/WebKit/chromium/public/WebApplicationCacheHost.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Google Inc. All rights reserved. + * 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 @@ -32,6 +32,8 @@ #define WebApplicationCacheHost_h #include "WebCommon.h" +#include "WebURL.h" +#include "WebVector.h" namespace WebKit { @@ -42,7 +44,7 @@ class WebURLResponse; struct WebURLError; // This interface is used by webkit to call out to the embedder. Webkit uses -// the WebKitClient::createApplicationCacheHost method to create instances, +// the WebFrameClient::createApplicationCacheHost method to create instances, // and calls delete when the instance is no longer needed. class WebApplicationCacheHost { public: @@ -71,24 +73,46 @@ public: virtual ~WebApplicationCacheHost() { } // Called for every request made within the context. - virtual void willStartMainResourceRequest(WebURLRequest&) = 0; - virtual void willStartSubResourceRequest(WebURLRequest&) = 0; + virtual void willStartMainResourceRequest(WebURLRequest&) { } + virtual void willStartSubResourceRequest(WebURLRequest&) { } // One or the other selectCache methods is called after having parsed the <html> tag. // The latter returns false if the current document has been identified as a "foreign" // entry, in which case the frame navigation will be restarted by webkit. - virtual void selectCacheWithoutManifest() = 0; - virtual bool selectCacheWithManifest(const WebURL& manifestURL) = 0; + virtual void selectCacheWithoutManifest() { } + virtual bool selectCacheWithManifest(const WebURL& manifestURL) { return true; } // Called as the main resource is retrieved. - virtual void didReceiveResponseForMainResource(const WebURLResponse&) = 0; - virtual void didReceiveDataForMainResource(const char* data, int len) = 0; - virtual void didFinishLoadingMainResource(bool success) = 0; + virtual void didReceiveResponseForMainResource(const WebURLResponse&) { } + virtual void didReceiveDataForMainResource(const char* data, int len) { } + virtual void didFinishLoadingMainResource(bool success) { } // Called on behalf of the scriptable interface. - virtual Status status() = 0; - virtual bool startUpdate() = 0; - virtual bool swapCache() = 0; + virtual Status status() { return Uncached; } + virtual bool startUpdate() { return false; } + virtual bool swapCache() { return false; } + + // Structures and methods to support inspecting Application Caches. + struct CacheInfo { + WebURL manifestURL; // Empty if there is no associated cache. + double creationTime; + double updateTime; + long long totalSize; + CacheInfo() : creationTime(0), updateTime(0), totalSize(0) { } + }; + struct ResourceInfo { + WebURL url; + long long size; + bool isMaster; + bool isManifest; + bool isExplicit; + bool isForeign; + bool isFallback; + ResourceInfo() : size(0), isMaster(false), isManifest(false), isExplicit(false), isForeign(false), isFallback(false) { } + }; + virtual void getAssociatedCacheInfo(CacheInfo*) { } + virtual void getResourceList(WebVector<ResourceInfo>*) { } + virtual void deleteAssociatedCacheGroup() { } }; } // namespace WebKit diff --git a/WebKit/chromium/public/WebApplicationCacheHostClient.h b/WebKit/chromium/public/WebApplicationCacheHostClient.h index 4e830e3..3f84c51 100644 --- a/WebKit/chromium/public/WebApplicationCacheHostClient.h +++ b/WebKit/chromium/public/WebApplicationCacheHostClient.h @@ -39,8 +39,12 @@ namespace WebKit { // This interface is used by the embedder to call into webkit. class WebApplicationCacheHostClient { public: - // Called to fire the event in the scriptable interface. + // Called when a different cache, including possibly no cache, is associated with the host. + virtual void didChangeCacheAssociation() = 0; + + // Called to fire events in the scriptable interface. virtual void notifyEventListener(WebApplicationCacheHost::EventID) = 0; + virtual void notifyProgressEventListener(const WebURL&, int num_total, int num_complete) = 0; protected: // Should not be deleted by the embedder. diff --git a/WebKit/chromium/public/WebAttribute.h b/WebKit/chromium/public/WebAttribute.h new file mode 100644 index 0000000..56e140b --- /dev/null +++ b/WebKit/chromium/public/WebAttribute.h @@ -0,0 +1,74 @@ +/* + * 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 WebAttribute_h +#define WebAttribute_h + +#include "WebCommon.h" +#include "WebPrivatePtr.h" + +namespace WebCore { class Attribute; } +#if WEBKIT_IMPLEMENTATION +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { +class WebString; + +// Provides readonly access to some properties of a DOM attribute. +class WebAttribute { +public: + ~WebAttribute() { reset(); } + + WebAttribute() { } + WebAttribute(const WebAttribute& n) { assign(n); } + WebAttribute& operator=(const WebAttribute& n) + { + assign(n); + return *this; + } + + WEBKIT_API void reset(); + WEBKIT_API void assign(const WebAttribute&); + + WEBKIT_API WebString localName() const; + WEBKIT_API WebString value() const; + +#if WEBKIT_IMPLEMENTATION + WebAttribute(const WTF::PassRefPtr<WebCore::Attribute>&); +#endif + +private: + WebPrivatePtr<WebCore::Attribute> m_private; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebBindings.h b/WebKit/chromium/public/WebBindings.h index 4e66a8f..0fa3bfd 100644 --- a/WebKit/chromium/public/WebBindings.h +++ b/WebKit/chromium/public/WebBindings.h @@ -117,7 +117,7 @@ public: // NPN_UTF8FromIdentifier WEBKIT_API static NPUTF8* utf8FromIdentifier(NPIdentifier); - // Miscellaneous utility functions ------------------------------------ + // Miscellaneous utility functions ---------------------------------------- // Complement to NPN_Get___Identifier functions. Extracts data from the NPIdentifier data // structure. If isString is true upon return, string will be set but number's value is @@ -138,6 +138,15 @@ public: // Return true (success) if the given npobj is a range object. // If so, return that range as a WebRange object. WEBKIT_API static bool getRange(NPObject* range, WebRange*); + + // Exceptions ------------------------------------------------------------- + + typedef void (ExceptionHandler)(void* data, const NPUTF8* message); + + // The exception handler will be notified of any exceptions thrown while + // operating on a NPObject. + WEBKIT_API static void pushExceptionHandler(ExceptionHandler, void* data); + WEBKIT_API static void popExceptionHandler(); }; } // namespace WebKit diff --git a/WebKit/chromium/public/WebBlobData.h b/WebKit/chromium/public/WebBlobData.h new file mode 100644 index 0000000..8c0e1aa --- /dev/null +++ b/WebKit/chromium/public/WebBlobData.h @@ -0,0 +1,102 @@ +/* + * 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 WebBlobData_h +#define WebBlobData_h + +#include "WebCString.h" +#include "WebString.h" +#include "WebURL.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class BlobData; } +namespace WTF { template <typename T> class PassOwnPtr; } +#endif + +namespace WebKit { + +class WebBlobDataPrivate; + +class WebBlobData { +public: + struct Item { + enum { TypeData, TypeFile, TypeBlob } type; + WebCString data; + WebString filePath; + WebURL blobURL; + long long offset; + long long length; // -1 means go to the end of the file/blob. + double expectedModificationTime; // 0.0 means that the time is not set. + }; + + ~WebBlobData() { reset(); } + + WebBlobData() : m_private(0) { } + + WEBKIT_API void initialize(); + WEBKIT_API void reset(); + + bool isNull() const { return !m_private; } + + // Returns the number of items. + WEBKIT_API size_t itemCount() const; + + // Retrieves the values of the item at the given index. Returns false if + // index is out of bounds. + WEBKIT_API bool itemAt(size_t index, Item& result) const; + + // Appends to the list of items. + WEBKIT_API void appendData(const WebCString&); + WEBKIT_API void appendFile(const WebString& filePath); + WEBKIT_API void appendFile(const WebString& filePath, long long offset, long long length, double expectedModificationTime); + WEBKIT_API void appendBlob(const WebURL& blobURL, long long offset, long long length); + + WEBKIT_API WebString contentType() const; + WEBKIT_API void setContentType(const WebString&); + + WEBKIT_API WebString contentDisposition() const; + WEBKIT_API void setContentDisposition(const WebString&); + +#if WEBKIT_IMPLEMENTATION + WebBlobData(const WTF::PassOwnPtr<WebCore::BlobData>&); + WebBlobData& operator=(const WTF::PassOwnPtr<WebCore::BlobData>&); + operator WTF::PassOwnPtr<WebCore::BlobData>(); +#endif + +private: +#if WEBKIT_IMPLEMENTATION + void assign(const WTF::PassOwnPtr<WebCore::BlobData>&); +#endif + WebBlobDataPrivate* m_private; +}; + +} // namespace WebKit + +#endif // WebBlobData_h diff --git a/WebKit/chromium/public/WebBlobRegistry.h b/WebKit/chromium/public/WebBlobRegistry.h new file mode 100644 index 0000000..cbd9a99 --- /dev/null +++ b/WebKit/chromium/public/WebBlobRegistry.h @@ -0,0 +1,58 @@ +/* + * 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 WebBlobRegistry_h +#define WebBlobRegistry_h + +#include "WebBlobStorageData.h" + +namespace WebKit { + +class WebBlobData; +class WebURL; + +class WebBlobRegistry { +public: + WEBKIT_API static WebBlobRegistry* create(); + + virtual ~WebBlobRegistry() { } + + // Registers a blob URL referring to the specified blob data. + virtual void registerBlobURL(const WebURL&, WebBlobData&) = 0; + + // Registers a blob URL referring to the blob data identified by the specified srcURL. + virtual void registerBlobURL(const WebURL&, const WebURL& srcURL) = 0; + + virtual void unregisterBlobURL(const WebURL&) = 0; +}; + +} // namespace WebKit + +#endif // WebBlobRegistry_h diff --git a/WebKit/chromium/public/WebBlobStorageData.h b/WebKit/chromium/public/WebBlobStorageData.h new file mode 100644 index 0000000..a9c0c8b --- /dev/null +++ b/WebKit/chromium/public/WebBlobStorageData.h @@ -0,0 +1,83 @@ +/* + * 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 WebBlobStorageData_h +#define WebBlobStorageData_h + +#include "WebBlobData.h" +#include "WebData.h" +#include "WebFileInfo.h" +#include "WebString.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class BlobStorageData; } +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { + +class WebBlobStorageDataPrivate; + +class WebBlobStorageData { +public: + ~WebBlobStorageData() { reset(); } + + WebBlobStorageData() : m_private(0) { } + + WEBKIT_API void reset(); + + bool isNull() const { return !m_private; } + + // Returns the number of items. + WEBKIT_API size_t itemCount() const; + + // Retrieves the values of the item at the given index. Returns false if + // index is out of bounds. + WEBKIT_API bool itemAt(size_t index, WebBlobData::Item& result) const; + + WEBKIT_API WebString contentType() const; + WEBKIT_API WebString contentDisposition() const; + +#if WEBKIT_IMPLEMENTATION + WebBlobStorageData(const WTF::PassRefPtr<WebCore::BlobStorageData>&); + WebBlobStorageData& operator=(const WTF::PassRefPtr<WebCore::BlobStorageData>&); + operator WTF::PassRefPtr<WebCore::BlobStorageData>() const; +#endif + +private: +#if WEBKIT_IMPLEMENTATION + void assign(const WTF::PassRefPtr<WebCore::BlobStorageData>&); +#endif + WebBlobStorageDataPrivate* m_private; +}; + +} // namespace WebKit + +#endif // WebBlobStorageData_h diff --git a/WebKit/chromium/public/WebCString.h b/WebKit/chromium/public/WebCString.h index 434cb06..0320eb6 100644 --- a/WebKit/chromium/public/WebCString.h +++ b/WebKit/chromium/public/WebCString.h @@ -34,11 +34,15 @@ #include "WebCommon.h" #if WEBKIT_IMPLEMENTATION -namespace WebCore { class CString; } +#include <wtf/Forward.h> #else #include <string> #endif +namespace WTF { +class CString; +} + namespace WebKit { class WebCStringPrivate; @@ -68,6 +72,11 @@ public: return *this; } + // Returns 0 if both strings are equals, a value greater than zero if the + // first character that does not match has a greater value in this string + // than in |other|, or a value less than zero to indicate the opposite. + WEBKIT_API int compare(const WebCString& other) const; + WEBKIT_API void reset(); WEBKIT_API void assign(const WebCString&); WEBKIT_API void assign(const char* data, size_t len); @@ -84,9 +93,9 @@ public: WEBKIT_API static WebCString fromUTF16(const WebUChar* data); #if WEBKIT_IMPLEMENTATION - WebCString(const WebCore::CString&); - WebCString& operator=(const WebCore::CString&); - operator WebCore::CString() const; + WebCString(const WTF::CString&); + WebCString& operator=(const WTF::CString&); + operator WTF::CString() const; #else WebCString(const std::string& s) : m_private(0) { @@ -117,6 +126,11 @@ private: WebCStringPrivate* m_private; }; +inline bool operator<(const WebCString& a, const WebCString& b) +{ + return a.compare(b) < 0; +} + } // namespace WebKit #endif diff --git a/WebKit/chromium/public/WebClipboard.h b/WebKit/chromium/public/WebClipboard.h index 68e22b5..6755d96 100644 --- a/WebKit/chromium/public/WebClipboard.h +++ b/WebKit/chromium/public/WebClipboard.h @@ -32,11 +32,13 @@ #define WebClipboard_h #include "WebCommon.h" +#include "WebString.h" +#include "WebVector.h" namespace WebKit { +class WebDragData; class WebImage; -class WebString; class WebURL; class WebClipboard { @@ -51,22 +53,35 @@ public: BufferStandard, // Used on platforms like the X Window System that treat selection // as a type of clipboard. - BufferSelection + BufferSelection, + // Read-only buffer corresponding to the current drag operation, if any. + BufferDrag, }; - virtual bool isFormatAvailable(Format, Buffer) = 0; + virtual bool isFormatAvailable(Format, Buffer) { return false; } - virtual WebString readPlainText(Buffer) = 0; - virtual WebString readHTML(Buffer, WebURL*) = 0; + virtual WebString readPlainText(Buffer) { return WebString(); } + virtual WebString readHTML(Buffer, WebURL*) { return WebString(); } - virtual void writePlainText(const WebString&) = 0; + virtual void writePlainText(const WebString&) { } virtual void writeHTML( const WebString& htmlText, const WebURL&, - const WebString& plainText, bool writeSmartPaste) = 0; + const WebString& plainText, bool writeSmartPaste) { } virtual void writeURL( - const WebURL&, const WebString& title) = 0; + const WebURL&, const WebString& title) { } virtual void writeImage( - const WebImage&, const WebURL&, const WebString& title) = 0; + const WebImage&, const WebURL&, const WebString& title) { } + virtual void writeData(const WebDragData&) { } + + // The following functions are used for reading platform data for copy and + // paste, drag and drop, and selection copy (on X). + virtual WebVector<WebString> readAvailableTypes( + Buffer, bool* containsFilenames) { return WebVector<WebString>(); } + // Returns true if the requested type was successfully read from the buffer. + virtual bool readData( + Buffer, const WebString& type, WebString* data, + WebString* metadata) { return false; } + virtual WebVector<WebString> readFilenames(Buffer) { return WebVector<WebString>(); } protected: ~WebClipboard() {} diff --git a/WebKit/chromium/public/WebCommon.h b/WebKit/chromium/public/WebCommon.h index d347ea6..2bfa17d 100644 --- a/WebKit/chromium/public/WebCommon.h +++ b/WebKit/chromium/public/WebCommon.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Google Inc. All rights reserved. + * 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 @@ -66,7 +66,7 @@ // Exported symbols need to be annotated with WEBKIT_API #if defined(WIN32) && defined(WEBKIT_DLL) - #if defined(WEBKIT_IMPLEMENTATION) + #if WEBKIT_IMPLEMENTATION #define WEBKIT_API __declspec(dllexport) #else #define WEBKIT_API __declspec(dllimport) @@ -80,15 +80,40 @@ #include <stddef.h> // For size_t +#if defined(WIN32) +// Visual Studio doesn't have stdint.h. +typedef short int16_t; +typedef unsigned short uint16_t; +typedef int int32_t; +typedef unsigned int uint32_t; +#endif + namespace WebKit { - // UTF-16 character type +// UTF-16 character type #if defined(WIN32) typedef wchar_t WebUChar; #else typedef unsigned short WebUChar; #endif +// ----------------------------------------------------------------------------- +// Assertions + +WEBKIT_API void failedAssertion(const char* file, int line, const char* function, const char* assertion); + } // namespace WebKit +// Ideally, only use inside the public directory but outside of WEBKIT_IMPLEMENTATION blocks. (Otherwise use WTF's ASSERT.) +#if defined(NDEBUG) +#define WEBKIT_ASSERT(assertion) ((void)0) +#else +#define WEBKIT_ASSERT(assertion) do { \ + if (!(assertion)) \ + failedAssertion(__FILE__, __LINE__, __FUNCTION__, #assertion); \ +} while (0) +#endif + +#define WEBKIT_ASSERT_NOT_REACHED() WEBKIT_ASSERT(0) + #endif diff --git a/WebKit/chromium/public/WebCommonWorkerClient.h b/WebKit/chromium/public/WebCommonWorkerClient.h index 771ffff..cea6471 100644 --- a/WebKit/chromium/public/WebCommonWorkerClient.h +++ b/WebKit/chromium/public/WebCommonWorkerClient.h @@ -33,6 +33,9 @@ namespace WebKit { +class WebApplicationCacheHost; +class WebApplicationCacheHostClient; +class WebFrame; class WebNotificationPresenter; class WebString; class WebWorker; @@ -49,14 +52,18 @@ public: const WebString& errorString, int lineNumber, const WebString& sourceURL) = 0; - virtual void postConsoleMessageToWorkerObject( - int destinationIdentifier, - int sourceIdentifier, - int messageType, - int messageLevel, - const WebString& message, - int lineNumber, - const WebString& sourceURL) = 0; + // FIXME: the below is for compatibility only and should be + // removed once Chromium is updated to remove message + // destination parameter <http://webkit.org/b/37155>. + virtual void postConsoleMessageToWorkerObject(int, int sourceIdentifier, int messageType, int messageLevel, + const WebString& message, int lineNumber, const WebString& sourceURL) = 0; + + virtual void postConsoleMessageToWorkerObject(int sourceIdentifier, int messageType, int messageLevel, + const WebString& message, int lineNumber, const WebString& sourceURL) + { + postConsoleMessageToWorkerObject(0, sourceIdentifier, messageType, messageLevel, + message, lineNumber, sourceURL); + } virtual void workerContextClosed() = 0; virtual void workerContextDestroyed() = 0; @@ -70,6 +77,12 @@ public: // they are created via the WebSharedWorkerRepository. virtual WebWorker* createWorker(WebWorkerClient* client) = 0; + // Called on the main webkit thread in the worker process during initialization. + virtual WebApplicationCacheHost* createApplicationCacheHost(WebApplicationCacheHostClient*) = 0; + + // Called on the main webkit thread before opening a web database. + virtual bool allowDatabase(WebFrame*, const WebString& name, const WebString& displayName, unsigned long estimatedSize) = 0; + protected: ~WebCommonWorkerClient() { } }; diff --git a/WebKit/chromium/public/WebCompositionUnderline.h b/WebKit/chromium/public/WebCompositionUnderline.h new file mode 100644 index 0000000..d8b0d63 --- /dev/null +++ b/WebKit/chromium/public/WebCompositionUnderline.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebCompositionUnderline_h +#define WebCompositionUnderline_h + +#include "WebColor.h" + +namespace WebKit { + +// Class WebCompositionUnderline is intended to be used with WebWidget's +// setComposition() method. +struct WebCompositionUnderline { + WebCompositionUnderline() + : startOffset(0) + , endOffset(0) + , color(0) + , thick(false) { } + + WebCompositionUnderline(unsigned s, unsigned e, WebColor c, bool t) + : startOffset(s) + , endOffset(e) + , color(c) + , thick(t) { } + + unsigned startOffset; + unsigned endOffset; + WebColor color; + bool thick; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebContextMenuData.h b/WebKit/chromium/public/WebContextMenuData.h index 5d67046..e3aee4e 100644 --- a/WebKit/chromium/public/WebContextMenuData.h +++ b/WebKit/chromium/public/WebContextMenuData.h @@ -63,6 +63,9 @@ struct WebContextMenuData { // The absolute URL of the image/video/audio that is in context. WebURL srcURL; + // Whether the image in context has been blocked. + bool isImageBlocked; + // The absolute URL of the page in context. WebURL pageURL; @@ -80,6 +83,8 @@ struct WebContextMenuData { MediaLoop = 0x8, MediaCanSave = 0x10, MediaHasAudio = 0x20, + MediaHasVideo = 0x40, + MediaControls = 0x80, }; // Extra attributes describing media elements. @@ -119,6 +124,7 @@ struct WebContextMenuData { CanPaste = 0x10, CanDelete = 0x20, CanSelectAll = 0x40, + CanTranslate = 0x80, }; // Which edit operations are available in the context. @@ -129,6 +135,17 @@ struct WebContextMenuData { // Custom context menu items provided by the WebCore internals. WebVector<WebMenuItemInfo> customItems; + + WebContextMenuData() + : mediaType(MediaTypeNone) + , isImageBlocked(false) + , mediaFlags(MediaNone) + , isSpellCheckingEnabled(false) + , isEditable(false) + , writingDirectionDefault(CheckableMenuItemDisabled) + , writingDirectionLeftToRight(CheckableMenuItemEnabled) + , writingDirectionRightToLeft(CheckableMenuItemEnabled) + , editFlags(0) { } }; } // namespace WebKit diff --git a/WebKit/chromium/src/AutocompletePopupMenuClient.h b/WebKit/chromium/public/WebCookieJar.h index 16a3771..6daba6b 100644 --- a/WebKit/chromium/src/AutocompletePopupMenuClient.h +++ b/WebKit/chromium/public/WebCookieJar.h @@ -28,36 +28,27 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef AutocompletePopupMenuClient_h -#define AutocompletePopupMenuClient_h - -#include "SuggestionsPopupMenuClient.h" +#ifndef WebCookieJar_h +#define WebCookieJar_h -namespace WebCore { -class HTMLInputElement; -} +#include "WebString.h" namespace WebKit { -class WebString; +class WebURL; +struct WebCookie; template <typename T> class WebVector; -// The Autocomplete suggestions popup menu client, used to display a list of -// autocomplete suggestions. -class AutocompletePopupMenuClient : public SuggestionsPopupMenuClient { +class WebCookieJar { public: - // SuggestionsPopupMenuClient implementation: - virtual unsigned getSuggestionsCount() const; - virtual WebString getSuggestion(unsigned listIndex) const; - virtual void removeSuggestionAtIndex(unsigned listIndex); - - void initialize(WebCore::HTMLInputElement*, - const WebVector<WebString>& suggestions, - int defaultSuggestionIndex); - - void setSuggestions(const WebVector<WebString>&); - -private: - Vector<WebCore::String> m_suggestions; + virtual void setCookie(const WebURL&, const WebURL& firstPartyForCookies, const WebString& cookie) { } + virtual WebString cookies(const WebURL&, const WebURL& firstPartyForCookies) { return WebString(); } + virtual WebString cookieRequestHeaderFieldValue(const WebURL&, const WebURL& firstPartyForCookies) { return WebString(); } + virtual void rawCookies(const WebURL&, const WebURL& firstPartyForCookies, WebVector<WebCookie>&) { } + virtual void deleteCookie(const WebURL&, const WebString& cookieName) { } + virtual bool cookiesEnabled(const WebURL&, const WebURL& firstPartyForCookies) { return true; } + +protected: + ~WebCookieJar() { } }; } // namespace WebKit diff --git a/WebKit/chromium/public/WebEvent.h b/WebKit/chromium/public/WebDOMEvent.h index b0964d1..d34c8d4 100644 --- a/WebKit/chromium/public/WebEvent.h +++ b/WebKit/chromium/public/WebDOMEvent.h @@ -28,8 +28,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebEvent_h -#define WebEvent_h +#ifndef WebDOMEvent_h +#define WebDOMEvent_h #include "WebCommon.h" #include "WebNode.h" @@ -42,7 +42,7 @@ namespace WTF { template <typename T> class PassRefPtr; } namespace WebKit { -class WebEvent { +class WebDOMEvent { public: enum PhaseType { CapturingPhase = 1, @@ -50,16 +50,16 @@ public: BubblingPhase = 3 }; - WebEvent() : m_private(0) { } - WebEvent(const WebEvent& e) : m_private(0) { assign(e); } - WebEvent& operator=(const WebEvent& e) + WebDOMEvent() : m_private(0) { } + WebDOMEvent(const WebDOMEvent& e) : m_private(0) { assign(e); } + WebDOMEvent& operator=(const WebDOMEvent& e) { assign(e); return *this; } WEBKIT_API void reset(); - WEBKIT_API void assign(const WebEvent&); + WEBKIT_API void assign(const WebDOMEvent&); bool isNull() const { return !m_private; } @@ -92,13 +92,27 @@ public: WEBKIT_API bool isBeforeLoadEvent() const; #if WEBKIT_IMPLEMENTATION - WebEvent(const WTF::PassRefPtr<WebCore::Event>&); + WebDOMEvent(const WTF::PassRefPtr<WebCore::Event>&); #endif + template<typename T> T to() + { + T res; + res.WebDOMEvent::assign(*this); + return res; + } + + template<typename T> const T toConst() const + { + T res; + res.WebDOMEvent::assign(*this); + return res; + } + protected: - typedef WebCore::Event WebEventPrivate; - void assign(WebEventPrivate*); - WebEventPrivate* m_private; + typedef WebCore::Event WebDOMEventPrivate; + void assign(WebDOMEventPrivate*); + WebDOMEventPrivate* m_private; template<typename T> T* unwrap() { diff --git a/WebKit/chromium/public/WebEventListener.h b/WebKit/chromium/public/WebDOMEventListener.h index 52de1cd..4b32b93 100644 --- a/WebKit/chromium/public/WebEventListener.h +++ b/WebKit/chromium/public/WebDOMEventListener.h @@ -28,8 +28,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebEventListener_h -#define WebEventListener_h +#ifndef WebDOMEventListener_h +#define WebDOMEventListener_h + +#include "WebCommon.h" #if WEBKIT_IMPLEMENTATION namespace WebCore { class Node; } @@ -38,18 +40,18 @@ namespace WebCore { class Node; } namespace WebKit { class EventListenerWrapper; -class WebEvent; -class WebEventListenerPrivate; +class WebDOMEvent; +class WebDOMEventListenerPrivate; class WebNode; class WebString; -class WebEventListener { +class WebDOMEventListener { public: - WebEventListener(); - virtual ~WebEventListener(); + WEBKIT_API WebDOMEventListener(); + WEBKIT_API virtual ~WebDOMEventListener(); // Called when an event is received. - virtual void handleEvent(const WebEvent&) = 0; + virtual void handleEvent(const WebDOMEvent&) = 0; #if WEBKIT_IMPLEMENTATION void notifyEventListenerDeleted(EventListenerWrapper*); @@ -58,7 +60,7 @@ public: #endif private: - WebEventListenerPrivate* m_private; + WebDOMEventListenerPrivate* m_private; }; } // namespace WebKit diff --git a/WebKit/chromium/public/WebDOMMouseEvent.h b/WebKit/chromium/public/WebDOMMouseEvent.h new file mode 100644 index 0000000..4c38b56 --- /dev/null +++ b/WebKit/chromium/public/WebDOMMouseEvent.h @@ -0,0 +1,62 @@ +/* + * 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 WebDOMMouseEvent_h +#define WebDOMMouseEvent_h + +#include "WebDOMEvent.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class Event; } +#endif + +namespace WebKit { + +class WebDOMMouseEvent : public WebDOMEvent { +public: + WEBKIT_API int screenX() const; + WEBKIT_API int screenY() const; + WEBKIT_API int clientX() const; + WEBKIT_API int clientY() const; + WEBKIT_API int layerX() const; + WEBKIT_API int layerY() const; + WEBKIT_API int offsetX() const; + WEBKIT_API int offsetY() const; + WEBKIT_API int pageX() const; + WEBKIT_API int pageY() const; + WEBKIT_API int x() const; + WEBKIT_API int y() const; + + WEBKIT_API int button() const; + WEBKIT_API bool buttonDown() const; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebMutationEvent.h b/WebKit/chromium/public/WebDOMMutationEvent.h index 75eb9c4..471331f 100644 --- a/WebKit/chromium/public/WebMutationEvent.h +++ b/WebKit/chromium/public/WebDOMMutationEvent.h @@ -27,10 +27,10 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebMutationEvent_h -#define WebMutationEvent_h +#ifndef WebDOMMutationEvent_h +#define WebDOMMutationEvent_h -#include "WebEvent.h" +#include "WebDOMEvent.h" #if WEBKIT_IMPLEMENTATION namespace WebCore { class Event; } @@ -38,7 +38,7 @@ namespace WebCore { class Event; } namespace WebKit { -class WebMutationEvent : public WebEvent { +class WebDOMMutationEvent : public WebDOMEvent { public: enum AttrChangeType { Modification = 1, diff --git a/WebKit/chromium/public/WebDOMStringList.h b/WebKit/chromium/public/WebDOMStringList.h new file mode 100644 index 0000000..dabf1b7 --- /dev/null +++ b/WebKit/chromium/public/WebDOMStringList.h @@ -0,0 +1,76 @@ +/* + * 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 WebDOMStringList_h +#define WebDOMStringList_h + +#include "WebCommon.h" +#include "WebPrivatePtr.h" +#include "WebString.h" + +namespace WebCore { class DOMStringList; } +#if WEBKIT_IMPLEMENTATION +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { + +class WebDOMStringList { +public: + ~WebDOMStringList() { reset(); } + + WEBKIT_API WebDOMStringList(); + WebDOMStringList(const WebDOMStringList& l) { assign(l); } + WebDOMStringList& operator=(const WebDOMStringList& l) + { + assign(l); + return *this; + } + + WEBKIT_API void reset(); + WEBKIT_API void assign(const WebDOMStringList&); + + WEBKIT_API void append(const WebString&); + WEBKIT_API unsigned length() const; + WEBKIT_API WebString item(unsigned) const; + +#if WEBKIT_IMPLEMENTATION + WebDOMStringList(const WTF::PassRefPtr<WebCore::DOMStringList>&); + WebDOMStringList& operator=(const WTF::PassRefPtr<WebCore::DOMStringList>&); + operator WTF::PassRefPtr<WebCore::DOMStringList>() const; +#endif + +private: + WebPrivatePtr<WebCore::DOMStringList> m_private; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebDatabase.h b/WebKit/chromium/public/WebDatabase.h index 108201d..0a5d4f8 100644 --- a/WebKit/chromium/public/WebDatabase.h +++ b/WebKit/chromium/public/WebDatabase.h @@ -34,33 +34,15 @@ #include "WebCommon.h" #include "WebSecurityOrigin.h" -#if WEBKIT_IMPLEMENTATION -namespace WebCore { class Database; } -namespace WTF { template <typename T> class PassRefPtr; } -#endif +namespace WebCore { class AbstractDatabase; } namespace WebKit { class WebDatabaseObserver; -class WebDatabasePrivate; class WebString; class WebDatabase { public: - WebDatabase() : m_private(0) { } - WebDatabase(const WebDatabase& d) : m_private(0) { assign(d); } - ~WebDatabase() { reset(); } - - WebDatabase& operator=(const WebDatabase& d) - { - assign(d); - return *this; - } - - WEBKIT_API void reset(); - WEBKIT_API void assign(const WebDatabase&); - bool isNull() const { return !m_private; } - WEBKIT_API WebString name() const; WEBKIT_API WebString displayName() const; WEBKIT_API unsigned long estimatedSize() const; @@ -76,15 +58,12 @@ public: const WebString& originIdentifier, const WebString& databaseName); #if WEBKIT_IMPLEMENTATION - WebDatabase(const WTF::PassRefPtr<WebCore::Database>&); - WebDatabase& operator=(const WTF::PassRefPtr<WebCore::Database>&); - operator WTF::PassRefPtr<WebCore::Database>() const; + WebDatabase(const WebCore::AbstractDatabase*); #endif private: - void assign(WebDatabasePrivate*); - - WebDatabasePrivate* m_private; + WebDatabase() { } + const WebCore::AbstractDatabase* m_database; }; } // namespace WebKit diff --git a/WebKit/chromium/public/WebDevToolsAgent.h b/WebKit/chromium/public/WebDevToolsAgent.h index e3b5186..6b4d237 100644 --- a/WebKit/chromium/public/WebDevToolsAgent.h +++ b/WebKit/chromium/public/WebDevToolsAgent.h @@ -35,6 +35,7 @@ namespace WebKit { class WebDevToolsAgentClient; +class WebDevToolsMessageTransport; class WebFrame; class WebString; class WebURLRequest; @@ -46,20 +47,19 @@ struct WebURLError; class WebDevToolsAgent { public: - WEBKIT_API static WebDevToolsAgent* create(WebView*, WebDevToolsAgentClient*); - virtual ~WebDevToolsAgent() {} virtual void attach() = 0; virtual void detach() = 0; + virtual void frontendLoaded() = 0; virtual void didNavigate() = 0; - virtual void dispatchMessageFromFrontend(const WebDevToolsMessageData&) = 0; + virtual void dispatchOnInspectorBackend(const WebString& message) = 0; 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,7 +73,16 @@ public: // Asynchronously request debugger to pause immediately. WEBKIT_API static void debuggerPauseScript(); - WEBKIT_API static bool dispatchMessageFromFrontendOnIOThread(const WebDevToolsMessageData&); + 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)(); @@ -82,7 +91,7 @@ public: WEBKIT_API static void setMessageLoopDispatchHandler(MessageLoopDispatchHandler); virtual void identifierForInitialRequest(unsigned long resourceId, WebFrame*, const WebURLRequest&) = 0; - virtual void willSendRequest(unsigned long resourceId, const WebURLRequest&) = 0; + virtual void willSendRequest(unsigned long resourceId, WebURLRequest&) = 0; virtual void didReceiveData(unsigned long resourceId, int length) = 0; virtual void didReceiveResponse(unsigned long resourceId, const WebURLResponse&) = 0; virtual void didFinishLoading(unsigned long resourceId) = 0; diff --git a/WebKit/chromium/public/WebDevToolsAgentClient.h b/WebKit/chromium/public/WebDevToolsAgentClient.h index d78a6f1..087ac0b 100644 --- a/WebKit/chromium/public/WebDevToolsAgentClient.h +++ b/WebKit/chromium/public/WebDevToolsAgentClient.h @@ -40,7 +40,9 @@ struct WebDevToolsMessageData; class WebDevToolsAgentClient { public: - virtual void sendMessageToFrontend(const WebDevToolsMessageData&) { } + virtual void sendMessageToInspectorFrontend(const WebString&) { } + virtual void sendDebuggerOutput(const WebString&) { } + virtual void sendDispatchToAPU(const WebString&) { } // Invalidates widget which leads to the repaint. virtual void forceRepaint() { } @@ -49,12 +51,19 @@ 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) { } - WEBKIT_API static void sendMessageToFrontendOnIOThread(const WebDevToolsMessageData&); + virtual WebCString debuggerScriptSource() { return WebCString(); } - virtual WebCString injectedScriptSource() { return WebCString(); } - virtual WebCString injectedScriptDispatcherSource() { return WebCString(); } + class WebKitClientMessageLoop { + public: + virtual ~WebKitClientMessageLoop() { } + virtual void run() = 0; + virtual void quitNow() = 0; + }; + virtual WebKitClientMessageLoop* createClientMessageLoop() { return 0; } + + virtual bool exposeV8DebuggerProtocol() { return false; } protected: ~WebDevToolsAgentClient() { } diff --git a/WebKit/chromium/public/WebDevToolsFrontend.h b/WebKit/chromium/public/WebDevToolsFrontend.h index d95f35a..0325f92 100644 --- a/WebKit/chromium/public/WebDevToolsFrontend.h +++ b/WebKit/chromium/public/WebDevToolsFrontend.h @@ -38,7 +38,6 @@ namespace WebKit { class WebDevToolsFrontendClient; class WebString; class WebView; -struct WebDevToolsMessageData; // WebDevToolsFrontend represents DevTools client sitting in the Glue. It provides // direct and delegate Apis to the host. @@ -50,7 +49,7 @@ public: virtual ~WebDevToolsFrontend() {} - virtual void dispatchMessageFromAgent(const WebDevToolsMessageData&) = 0; + virtual void dispatchOnInspectorFrontend(const WebString&) = 0; }; } // namespace WebKit diff --git a/WebKit/chromium/public/WebDevToolsFrontendClient.h b/WebKit/chromium/public/WebDevToolsFrontendClient.h index 6200709..df34dc5 100644 --- a/WebKit/chromium/public/WebDevToolsFrontendClient.h +++ b/WebKit/chromium/public/WebDevToolsFrontendClient.h @@ -38,16 +38,19 @@ struct WebDevToolsMessageData; class WebDevToolsFrontendClient { public: - WebDevToolsFrontendClient() {} + WebDevToolsFrontendClient() { } - virtual void sendMessageToAgent(const WebDevToolsMessageData&) {}; - virtual void sendDebuggerCommandToAgent(const WebString& command) {}; - virtual void sendDebuggerPauseScript() {} + virtual void sendFrontendLoaded() { } + virtual void sendMessageToBackend(const WebString&) { } + virtual void sendDebuggerCommandToAgent(const WebString& command) { } + virtual void sendDebuggerPauseScript() { } - virtual void activateWindow() {}; - virtual void closeWindow() {}; - virtual void dockWindow() {}; - virtual void undockWindow() {}; + virtual void activateWindow() { } + virtual void closeWindow() { } + virtual void requestDockWindow() { } + virtual void requestUndockWindow() { } + + virtual bool shouldHideScriptsPanel() { return false; } protected: virtual ~WebDevToolsFrontendClient() {} diff --git a/WebKit/chromium/public/WebDeviceOrientation.h b/WebKit/chromium/public/WebDeviceOrientation.h new file mode 100644 index 0000000..7e8aa72 --- /dev/null +++ b/WebKit/chromium/public/WebDeviceOrientation.h @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 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 WebDeviceOrientation_h +#define WebDeviceOrientation_h + +#if WEBKIT_IMPLEMENTATION +namespace WTF { template <typename T> class PassRefPtr; } +namespace WebCore { class DeviceOrientation; } +#endif + +namespace WebKit { + +class WebDeviceOrientation { +public: + WebDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma) + : m_isNull(false), + m_canProvideAlpha(canProvideAlpha), + m_alpha(alpha), + m_canProvideBeta(canProvideBeta), + m_beta(beta), + m_canProvideGamma(canProvideGamma), + m_gamma(gamma) + { + } + + static WebDeviceOrientation nullOrientation() { return WebDeviceOrientation(); } + + bool isNull() { return m_isNull; } + bool canProvideAlpha() { return m_canProvideAlpha; } + double alpha() { return m_alpha; } + bool canProvideBeta() { return m_canProvideBeta; } + double beta() { return m_beta; } + bool canProvideGamma() { return m_canProvideGamma; } + double gamma() { return m_gamma; } + +#if WEBKIT_IMPLEMENTATION + WebDeviceOrientation(const WTF::PassRefPtr<WebCore::DeviceOrientation>&); + WebDeviceOrientation& operator=(const WTF::PassRefPtr<WebCore::DeviceOrientation>&); + operator WTF::PassRefPtr<WebCore::DeviceOrientation>() const; +#endif + +private: + WebDeviceOrientation() + : m_isNull(true), + m_canProvideAlpha(false), + m_alpha(0), + m_canProvideBeta(false), + m_beta(0), + m_canProvideGamma(false), + m_gamma(0) + { + } + + bool m_isNull; + bool m_canProvideAlpha; + double m_alpha; + bool m_canProvideBeta; + double m_beta; + bool m_canProvideGamma; + double m_gamma; +}; + +} // namespace WebKit + +#endif // WebDeviceOrientation_h diff --git a/WebKit/chromium/public/WebDeviceOrientationClient.h b/WebKit/chromium/public/WebDeviceOrientationClient.h new file mode 100644 index 0000000..4df8665 --- /dev/null +++ b/WebKit/chromium/public/WebDeviceOrientationClient.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 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 WebDeviceOrientationClient_h +#define WebDeviceOrientationClient_h + +namespace WebKit { + +class WebDeviceOrientation; +class WebDeviceOrientationController; + +class WebDeviceOrientationClient { +public: + virtual ~WebDeviceOrientationClient() {} + + virtual void setController(WebDeviceOrientationController*) = 0; + virtual void startUpdating() = 0; + virtual void stopUpdating() = 0; + + virtual WebDeviceOrientation lastOrientation() const = 0; +}; + +} // namespace WebKit + +#endif // WebDeviceOrientationClient_h diff --git a/WebKit/chromium/public/WebDeviceOrientationClientMock.h b/WebKit/chromium/public/WebDeviceOrientationClientMock.h new file mode 100644 index 0000000..fce964b --- /dev/null +++ b/WebKit/chromium/public/WebDeviceOrientationClientMock.h @@ -0,0 +1,57 @@ +/* + * 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 WebDeviceOrientationClientMock_h +#define WebDeviceOrientationClientMock_h + +#include "WebCommon.h" +#include "WebDeviceOrientationClient.h" + +namespace WebCore { class DeviceOrientationClientMock; } + +namespace WebKit { + +class WebDeviceOrientationClientMock : public WebDeviceOrientationClient { +public: + WebDeviceOrientationClientMock() { initialize(); } + ~WebDeviceOrientationClientMock() { reset(); } + + virtual void setController(WebDeviceOrientationController*); + virtual void startUpdating(); + virtual void stopUpdating(); + virtual WebDeviceOrientation lastOrientation() const; + + WEBKIT_API void setOrientation(WebDeviceOrientation&); + +private: + WEBKIT_API void initialize(); + WEBKIT_API void reset(); + + WebCore::DeviceOrientationClientMock* m_clientMock; +}; + +} // namespace WebKit + +#endif // WebDeviceOrientationClientMock_h diff --git a/WebKit/chromium/public/WebDeviceOrientationController.h b/WebKit/chromium/public/WebDeviceOrientationController.h new file mode 100644 index 0000000..ef843ee --- /dev/null +++ b/WebKit/chromium/public/WebDeviceOrientationController.h @@ -0,0 +1,56 @@ +/* + * 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 WebDeviceOrientationController_h +#define WebDeviceOrientationController_h + +#include "WebCommon.h" + +namespace WebCore { class DeviceOrientationController; } + +namespace WebKit { + +class WebDeviceOrientation; + +class WebDeviceOrientationController { +public: + WebDeviceOrientationController(WebCore::DeviceOrientationController* c) + : m_controller(c) + { + } + + WEBKIT_API void didChangeDeviceOrientation(const WebDeviceOrientation&); + +#if WEBKIT_IMPLEMENTATION + WebCore::DeviceOrientationController* controller() const; +#endif + +private: + WebCore::DeviceOrientationController* m_controller; +}; + +} // namespace WebKit + +#endif // WebDeviceOrientationController_h diff --git a/WebKit/chromium/public/WebDocument.h b/WebKit/chromium/public/WebDocument.h index e158c41..d9f7386 100644 --- a/WebKit/chromium/public/WebDocument.h +++ b/WebKit/chromium/public/WebDocument.h @@ -34,14 +34,19 @@ #include "WebNode.h" #if WEBKIT_IMPLEMENTATION -namespace WebCore { class Document; } +namespace WebCore { +class Document; +class DocumentType; +} namespace WTF { template <typename T> class PassRefPtr; } #endif namespace WebKit { +class WebDocumentType; class WebElement; class WebFrame; class WebNodeCollection; +class WebNodeList; class WebString; class WebURL; @@ -61,14 +66,19 @@ public: // Returns the frame the document belongs to or 0 if the document is frameless. WEBKIT_API WebFrame* frame() const; WEBKIT_API bool isHTMLDocument() const; + WEBKIT_API bool isXHTMLDocument() const; + WEBKIT_API bool isPluginDocument() const; WEBKIT_API WebURL baseURL() const; + WEBKIT_API WebURL firstPartyForCookies() const; WEBKIT_API WebElement documentElement() const; WEBKIT_API WebElement body() const; WEBKIT_API WebElement head(); + WEBKIT_API WebString title() const; WEBKIT_API WebNodeCollection all(); WEBKIT_API WebURL completeURL(const WebString&) const; - WEBKIT_API WebElement getElementById(const WebString& id) const; - WEBKIT_API WebString applicationID() const; + WEBKIT_API WebElement getElementById(const WebString&) const; + WEBKIT_API WebNode focusedNode() const; + WEBKIT_API WebDocumentType doctype() const; #if WEBKIT_IMPLEMENTATION WebDocument(const WTF::PassRefPtr<WebCore::Document>&); diff --git a/WebKit/chromium/public/WebDocumentType.h b/WebKit/chromium/public/WebDocumentType.h new file mode 100644 index 0000000..b339320 --- /dev/null +++ b/WebKit/chromium/public/WebDocumentType.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: + * + * * 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 WebDocumentType_h +#define WebDocumentType_h + +#include "WebNode.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class DocumentType; } +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { +class WebString; + +// Provides readonly access to some properties of a DOM document type. +class WebDocumentType : public WebNode { +public: + WebDocumentType() { } + WebDocumentType(const WebDocumentType& e) : WebNode(e) { } + + WebDocumentType& operator=(const WebDocumentType& e) + { + WebNode::assign(e); + return *this; + } + void assign(const WebDocumentType& e) { WebNode::assign(e); } + + WEBKIT_API WebString name() const; + +#if WEBKIT_IMPLEMENTATION + WebDocumentType(const WTF::PassRefPtr<WebCore::DocumentType>&); + WebDocumentType& operator=(const WTF::PassRefPtr<WebCore::DocumentType>&); + operator WTF::PassRefPtr<WebCore::DocumentType>() const; +#endif +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebDragData.h b/WebKit/chromium/public/WebDragData.h index 0b861c8..2979519 100644 --- a/WebKit/chromium/public/WebDragData.h +++ b/WebKit/chromium/public/WebDragData.h @@ -72,8 +72,6 @@ public: WEBKIT_API WebString urlTitle() const; WEBKIT_API void setURLTitle(const WebString&); - WEBKIT_API WebURL downloadURL() const; - WEBKIT_API void setDownloadURL(const WebURL&); WEBKIT_API WebString downloadMetadata() const; WEBKIT_API void setDownloadMetadata(const WebString&); diff --git a/WebKit/chromium/public/WebElement.h b/WebKit/chromium/public/WebElement.h index 20f6c9a..16a82d8 100644 --- a/WebKit/chromium/public/WebElement.h +++ b/WebKit/chromium/public/WebElement.h @@ -35,10 +35,11 @@ #if WEBKIT_IMPLEMENTATION namespace WebCore { class Element; } -namespace WTF { template <typename T> class PassRefPtr; } #endif namespace WebKit { +class WebNamedNodeMap; + // Provides access to some properties of a DOM element node. class WebElement : public WebNode { public: @@ -48,11 +49,13 @@ namespace WebKit { WebElement& operator=(const WebElement& e) { WebNode::assign(e); return *this; } void assign(const WebElement& e) { WebNode::assign(e); } + WEBKIT_API bool isFormControlElement() const; WEBKIT_API WebString tagName() const; WEBKIT_API bool hasTagName(const WebString&) const; WEBKIT_API bool hasAttribute(const WebString&) const; WEBKIT_API WebString getAttribute(const WebString&) const; WEBKIT_API bool setAttribute(const WebString& name, const WebString& value); + WEBKIT_API WebNamedNodeMap attributes() const; WEBKIT_API WebString innerText() const; #if WEBKIT_IMPLEMENTATION diff --git a/WebKit/chromium/public/WebFileChooserParams.h b/WebKit/chromium/public/WebFileChooserParams.h index 6359f14..8e56d70 100644 --- a/WebKit/chromium/public/WebFileChooserParams.h +++ b/WebKit/chromium/public/WebFileChooserParams.h @@ -40,6 +40,8 @@ namespace WebKit { struct WebFileChooserParams { // If |multiSelect| is true, the dialog allow to select multiple files. bool multiSelect; + // If |directory| is true, the dialog allows the user to select a directory. + bool directory; // |title| is a title of a file chooser dialog. It can be an empty string. WebString title; // |initialValue| is a filename which the dialog should select by default. @@ -57,6 +59,12 @@ struct WebFileChooserParams { // - replacing with other files // before opening a file chooser dialog. WebVector<WebString> selectedFiles; + + WebFileChooserParams() + : multiSelect(false) + , directory(false) + { + } }; } // namespace WebKit diff --git a/WebKit/chromium/public/WebFileError.h b/WebKit/chromium/public/WebFileError.h new file mode 100644 index 0000000..cfe8882 --- /dev/null +++ b/WebKit/chromium/public/WebFileError.h @@ -0,0 +1,50 @@ +/* + * 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 WebFileError_h +#define WebFileError_h + +namespace WebKit { + +// File-related error code defined in HTML5 File API. +enum WebFileError { + WebFileErrorNoModificationAllowed = 7, + WebFileErrorNotFound = 8, + WebFileErrorInvalidState = 11, + WebFileErrorInvalidModification = 13, + WebFileErrorSecurity = 18, + WebFileErrorAbort = 20, + WebFileErrorQuotaExceeded = 22, + WebFileErrorNotReadable = 24, + WebFileErrorEncoding = 26, +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebFileSystem.h b/WebKit/chromium/public/WebFileSystem.h new file mode 100644 index 0000000..641c169 --- /dev/null +++ b/WebKit/chromium/public/WebFileSystem.h @@ -0,0 +1,109 @@ +/* + * 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 WebFileSystem_h +#define WebFileSystem_h + +#include "WebCommon.h" +#include "WebString.h" + +namespace WebKit { + +class WebFileSystemCallbacks; + +class WebFileSystem { +public: + enum Type { + TypeTemporary, + TypePersistent, + }; + + // Moves a file or directory at |srcPath| to |destPath|. + // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. + // WebFileSystemCallbacks::didFail() must be called otherwise. + virtual void move(const WebString& srcPath, const WebString& destPath, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + + // Copies a file or directory at |srcPath| to |destPath|. + // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. + // WebFileSystemCallbacks::didFail() must be called otherwise. + virtual void copy(const WebString& srcPath, const WebString& destPath, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + + // Deletes a file or directory at a given |path|. + // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. + // WebFileSystemCallbacks::didFail() must be called otherwise. + virtual void remove(const WebString& path, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + + // Retrieves the metadata information of the file or directory at the given |path|. + // WebFileSystemCallbacks::didReadMetadata() must be called with a valid metadata when the retrieval is completed successfully. + // WebFileSystemCallbacks::didFail() must be called otherwise. + virtual void readMetadata(const WebString& path, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + + // Creates a file at given |path|. + // If the |path| doesn't exist, it creates a new file at |path|. + // If |exclusive| is true, it fails if the |path| already exists. + // If |exclusive| is false, it succeeds if the |path| already exists or + // it has successfully created a new file at |path|. + // + // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. + // WebFileSystemCallbacks::didFail() must be called otherwise. + virtual void createFile(const WebString& path, bool exclusive, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + + // Creates a directory at a given |path|. + // If the |path| doesn't exist, it creates a new directory at |path|. + // If |exclusive| is true, it fails if the |path| already exists. + // If |exclusive| is false, it succeeds if the |path| already exists or it has successfully created a new directory at |path|. + // + // WebFileSystemCallbacks::didSucceed() must be called when + // the operation is completed successfully. + // WebFileSystemCallbacks::didFail() must be called otherwise. + virtual void createDirectory(const WebString& path, bool exclusive, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + + // Checks if a file exists at a given |path|. + // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. + // WebFileSystemCallbacks::didFail() must be called otherwise. + virtual void fileExists(const WebString& path, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + + // Checks if a directory exists at a given |path|. + // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. + // WebFileSystemCallbacks::didFail() must be called otherwise. + virtual void directoryExists(const WebString& path, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + + // Reads directory entries of a given directory at |path|. + // WebFileSystemCallbacks::didReadDirectory() must be called when the operation is completed successfully. + // WebFileSystemCallbacks::didFail() must be called otherwise. + virtual void readDirectory(const WebString& path, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + +protected: + virtual ~WebFileSystem() { } +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebFileSystemCallbacks.h b/WebKit/chromium/public/WebFileSystemCallbacks.h new file mode 100644 index 0000000..fa7ebbe --- /dev/null +++ b/WebKit/chromium/public/WebFileSystemCallbacks.h @@ -0,0 +1,73 @@ +/* + * 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 WebFileSystemCallbacks_h +#define WebFileSystemCallbacks_h + +#include "WebFileError.h" +#include "WebFileSystemEntry.h" +#include "WebVector.h" + +namespace WebKit { + +class WebString; +struct WebFileInfo; + +class WebFileSystemCallbacks { +public: + // Callback for WebFileSystem's various operations that don't require + // return values. + virtual void didSucceed() = 0; + + // Callback for WebFileSystem::readMetadata. Called with the file metadata + // for the requested path. + virtual void didReadMetadata(const WebFileInfo&) = 0; + + // Callback for WebFileSystem::readDirectory. Called with a vector of + // file entries in the requested directory. This callback might be called + // multiple times if the directory has many entries. |hasMore| must be + // true when there are more entries. + virtual void didReadDirectory(const WebVector<WebFileSystemEntry>&, bool hasMore) = 0; + + // Callback for WebFrameClient::openFileSystem. Called with a name and + // root path for the FileSystem when the request is accepted. + virtual void didOpenFileSystem(const WebString& name, const WebString& rootPath) = 0; + + // Called with an error code when a requested operation hasn't been + // completed. + virtual void didFail(WebFileError) = 0; + +protected: + virtual ~WebFileSystemCallbacks() {} +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebFileSystemEntry.h b/WebKit/chromium/public/WebFileSystemEntry.h new file mode 100644 index 0000000..00a5e38 --- /dev/null +++ b/WebKit/chromium/public/WebFileSystemEntry.h @@ -0,0 +1,50 @@ +/* + * 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 WebFileSystemEntry_h +#define WebFileSystemEntry_h + +#include "WebString.h" + +namespace WebKit { + +struct WebFileSystemEntry { + WebFileSystemEntry() : isDirectory(false) { } + + // The name of the entry. + WebString name; + + // This flag indicates if the entry is directory or not. + bool isDirectory; +}; + +} // namespace WebKit + +#endif // WebFileSystemEntry_h 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/WebFloatPoint.h b/WebKit/chromium/public/WebFloatPoint.h new file mode 100644 index 0000000..c053ed6 --- /dev/null +++ b/WebKit/chromium/public/WebFloatPoint.h @@ -0,0 +1,91 @@ +/* + * 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 WebFloatPoint_h +#define WebFloatPoint_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +#include "IntPoint.h" +#endif + +namespace WebKit { + +struct WebFloatPoint { + float x; + float y; + + WebFloatPoint() + : x(0.0f) + , y(0.0f) + { + } + + WebFloatPoint(float x, float y) + : x(x) + , y(y) + { + } + +#if WEBKIT_IMPLEMENTATION + WebFloatPoint(const WebCore::FloatPoint& p) + : x(p.x()) + , y(p.y()) + { + } + + WebFloatPoint& operator=(const WebCore::FloatPoint& p) + { + x = p.x(); + y = p.y(); + return *this; + } + + operator WebCore::FloatPoint() const + { + return WebCore::FloatPoint(x, y); + } +#endif +}; + +inline bool operator==(const WebFloatPoint& a, const WebFloatPoint& b) +{ + return a.x == b.x && a.y == b.y; +} + +inline bool operator!=(const WebFloatPoint& a, const WebFloatPoint& b) +{ + return !(a == b); +} + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebFloatRect.h b/WebKit/chromium/public/WebFloatRect.h new file mode 100644 index 0000000..a883513 --- /dev/null +++ b/WebKit/chromium/public/WebFloatRect.h @@ -0,0 +1,103 @@ +/* + * 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 WebFloatRect_h +#define WebFloatRect_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +#include "FloatRect.h" +#endif + +namespace WebKit { + +struct WebFloatRect { + float x; + float y; + float width; + float height; + + bool isEmpty() const { return width <= 0 || height <= 0; } + + WebFloatRect() + : x(0.0f) + , y(0.0f) + , width(0.0f) + , height(0.0f) + { + } + + WebFloatRect(float x, float y, float width, float height) + : x(x) + , y(y) + , width(width) + , height(height) + { + } + +#if WEBKIT_IMPLEMENTATION + WebFloatRect(const WebCore::FloatRect& r) + : x(r.x()) + , y(r.y()) + , width(r.width()) + , height(r.height()) + { + } + + WebFloatRect& operator=(const WebCore::FloatRect& r) + { + x = r.x(); + y = r.y(); + width = r.width(); + height = r.height(); + return *this; + } + + operator WebCore::FloatRect() const + { + return WebCore::FloatRect(x, y, width, height); + } +#endif +}; + +inline bool operator==(const WebFloatRect& a, const WebFloatRect& b) +{ + return a.x == b.x && a.y == b.y && a.width == b.width && a.height == b.height; +} + +inline bool operator!=(const WebFloatRect& a, const WebFloatRect& b) +{ + return !(a == b); +} + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebFont.h b/WebKit/chromium/public/WebFont.h new file mode 100644 index 0000000..a20d52f --- /dev/null +++ b/WebKit/chromium/public/WebFont.h @@ -0,0 +1,100 @@ +/* + * 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 WebFont_h +#define WebFont_h + +#include "WebCanvas.h" +#include "WebColor.h" +#include "WebCommon.h" + +namespace WebKit { + +struct WebFontDescription; +struct WebFloatPoint; +struct WebFloatRect; +struct WebPoint; +struct WebRect; +struct WebTextRun; + +class WebFont { +public: + virtual ~WebFont() { } + + WEBKIT_API static WebFont* create(const WebFontDescription&); + + virtual WebFontDescription fontDescription() const = 0; + + virtual int ascent() const = 0; + virtual int descent() const = 0; + virtual int height() const = 0; + virtual int lineSpacing() const = 0; + virtual float xHeight() const = 0; + + // Draws the text run to the given canvas. The text is positioned at the + // given left-hand point at the baseline. + // + // The text will be clipped to the given clip rect. |canvasIsOpaque| is + // used to control whether subpixel antialiasing is possible. If there is a + // possibility the area drawn could be semi-transparent, subpixel + // antialiasing will be disabled. + // + // |from| and |to| allow the caller to specify a subrange of the given text + // run to draw. If |to| is -1, the entire run will be drawn. + virtual void drawText(WebCanvas*, const WebTextRun&, const WebFloatPoint& leftBaseline, WebColor, + const WebRect& clip, bool canvasIsOpaque, + int from = 0, int to = -1) const = 0; + + // Measures the width in pixels of the given text run. + virtual int calculateWidth(const WebTextRun&) const = 0; + + // Returns the character offset corresponding to the given horizontal pixel + // position as measured from from the left of the run. + virtual int offsetForPosition(const WebTextRun&, float position) const = 0; + + // Returns the rectangle representing the selection rect for the subrange + // |from| -> |to| of the given text run. You can use -1 for |to| to specify + // the entire run (this will do something similar to calling width()). + // + // The rect will be positioned as if the text was drawn at the given + // |leftBaseline| position. |height| indicates the height of the selection + // rect you want, typically this will just be the height() of this font. + // + // To get the pixel offset of some character (the opposite of + // offsetForPosition()), pass in a |leftBaseline| = (0, 0), |from| = 0, and + // |to| = the character you want. The right edge of the resulting selection + // rect will tell you the right side of the character. + virtual WebFloatRect selectionRectForText(const WebTextRun&, const WebFloatPoint& leftBaseline, + int height, int from = 0, int to = -1) const = 0; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebFontDescription.h b/WebKit/chromium/public/WebFontDescription.h new file mode 100644 index 0000000..d4bb07e --- /dev/null +++ b/WebKit/chromium/public/WebFontDescription.h @@ -0,0 +1,106 @@ +/* + * 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 WebFontDescription_h +#define WebFontDescription_h + +#include "WebString.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class FontDescription; } +#endif + +namespace WebKit { + +struct WebFontDescription { + enum GenericFamily { + GenericFamilyNone, + GenericFamilyStandard, + GenericFamilySerif, + GenericFamilySansSerif, + GenericFamilyMonospace, + GenericFamilyCursive, + GenericFamilyFantasy + }; + + enum Smoothing { + SmoothingAuto, + SmoothingNone, + SmoothingGrayscale, + SmoothingSubpixel + }; + + enum Weight { + Weight100, + Weight200, + Weight300, + Weight400, + Weight500, + Weight600, + Weight700, + Weight800, + Weight900, + WeightNormal = Weight400, + WeightBold = Weight700 + }; + + WebFontDescription() + : genericFamily(GenericFamilyNone) + , size(0) + , italic(false) + , smallCaps(false) + , weight(WeightNormal) + , smoothing(SmoothingAuto) + , letterSpacing(0) + , wordSpacing(0) + { + } + + WebString family; + GenericFamily genericFamily; + float size; + bool italic; + bool smallCaps; + Weight weight; + Smoothing smoothing; + + short letterSpacing; + short wordSpacing; + +#if WEBKIT_IMPLEMENTATION + WebFontDescription(const WebCore::FontDescription&, short fontLetterSpacing, short fontWordSpacing); + + operator WebCore::FontDescription() const; +#endif +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebFormControlElement.h b/WebKit/chromium/public/WebFormControlElement.h new file mode 100644 index 0000000..ee0783d --- /dev/null +++ b/WebKit/chromium/public/WebFormControlElement.h @@ -0,0 +1,74 @@ +/* + * 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 WebFormControlElement_h +#define WebFormControlElement_h + +#include "WebElement.h" +#include "WebString.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class HTMLFormControlElement; } +#endif + +namespace WebKit { + +// Provides readonly access to some properties of a DOM form control element node. +class WebFormControlElement : public WebElement { +public: + WebFormControlElement() : WebElement() { } + WebFormControlElement(const WebFormControlElement& e) : WebElement(e) { } + + WebFormControlElement& operator=(const WebFormControlElement& e) + { + WebElement::assign(e); + return *this; + } + WEBKIT_API void assign(const WebFormControlElement& e) { WebElement::assign(e); } + + WEBKIT_API bool isEnabled() const; + WEBKIT_API WebString formControlName() const; + WEBKIT_API WebString formControlType() const; + + // Returns the name that should be used for the specified |element| when + // storing autofill data. This is either the field name or its id, an empty + // string if it has no name and no id. + WEBKIT_API WebString nameForAutofill() const; + +#if WEBKIT_IMPLEMENTATION + WebFormControlElement(const WTF::PassRefPtr<WebCore::HTMLFormControlElement>&); + WebFormControlElement& operator=(const WTF::PassRefPtr<WebCore::HTMLFormControlElement>&); + operator WTF::PassRefPtr<WebCore::HTMLFormControlElement>() const; +#endif +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebFormElement.h b/WebKit/chromium/public/WebFormElement.h index b07bff9..2b4ee53 100644 --- a/WebKit/chromium/public/WebFormElement.h +++ b/WebKit/chromium/public/WebFormElement.h @@ -32,15 +32,17 @@ #define WebFormElement_h #include "WebElement.h" -#include "WebInputElement.h" #include "WebVector.h" #if WEBKIT_IMPLEMENTATION namespace WebCore { class HTMLFormElement; } -namespace WTF { template <typename T> class PassRefPtr; } #endif namespace WebKit { + + class WebInputElement; + class WebFormControlElement; + // A container for passing around a reference to a form element. Provides // some information about the form. class WebFormElement : public WebElement { @@ -57,20 +59,21 @@ namespace WebKit { } WEBKIT_API void assign(const WebFormElement& e) { WebElement::assign(e); } -#if WEBKIT_IMPLEMENTATION - WebFormElement(const WTF::PassRefPtr<WebCore::HTMLFormElement>&); - WebFormElement& operator=(const WTF::PassRefPtr<WebCore::HTMLFormElement>&); - operator WTF::PassRefPtr<WebCore::HTMLFormElement>() const; -#endif - WEBKIT_API bool autoComplete() const; WEBKIT_API WebString action() const; WEBKIT_API WebString name() const; WEBKIT_API WebString method() const; + WEBKIT_API bool wasUserSubmitted() const; WEBKIT_API void submit(); // FIXME: Deprecate and replace with WebVector<WebElement>. WEBKIT_API void getNamedElements(const WebString&, WebVector<WebNode>&); - WEBKIT_API void getInputElements(WebVector<WebInputElement>&) const; + WEBKIT_API void getFormControlElements(WebVector<WebFormControlElement>&) const; + +#if WEBKIT_IMPLEMENTATION + WebFormElement(const WTF::PassRefPtr<WebCore::HTMLFormElement>&); + WebFormElement& operator=(const WTF::PassRefPtr<WebCore::HTMLFormElement>&); + operator WTF::PassRefPtr<WebCore::HTMLFormElement>() const; +#endif }; } // namespace WebKit diff --git a/WebKit/chromium/public/WebFrame.h b/WebKit/chromium/public/WebFrame.h index a56e6cb..c4fa7ae 100644 --- a/WebKit/chromium/public/WebFrame.h +++ b/WebKit/chromium/public/WebFrame.h @@ -39,6 +39,8 @@ struct NPObject; #if WEBKIT_USING_V8 namespace v8 { class Context; +class Value; +template <class T> class Handle; template <class T> class Local; } #endif @@ -100,7 +102,11 @@ public: // The name of this frame. virtual WebString name() const = 0; - virtual void clearName() = 0; + + // Sets the name of this frame. For child frames (frames that are not a + // top-most frame) the actual name may have a suffix appended to make the + // frame name unique within the hierarchy. + virtual void setName(const WebString&) = 0; // The url of the document loaded in this frame. This is equivalent to // dataSource()->request().url(). @@ -123,6 +129,9 @@ public: // NOTE: These routines do not force page layout so their results may // not be accurate if the page layout is out-of-date. + // If set to false, do not draw scrollbars on this frame's view. + virtual void setCanHaveScrollbars(bool) = 0; + // The scroll offset from the top-left corner of the frame in pixels. virtual WebSize scrollOffset() const = 0; @@ -222,6 +231,11 @@ public: virtual void collectGarbage() = 0; #if WEBKIT_USING_V8 + // Executes script in the context of the current page and returns the value + // that the script evaluated to. + virtual v8::Handle<v8::Value> executeScriptAndReturnValue( + const WebScriptSource&) = 0; + // Returns the V8 context for this frame, or an empty handle if there // is none. virtual v8::Local<v8::Context> mainWorldScriptContext() const = 0; @@ -241,7 +255,9 @@ public: // Navigation ---------------------------------------------------------- // Reload the current document. - virtual void reload() = 0; + // True |ignoreCache| explicitly bypasses caches. + // False |ignoreCache| revalidates any existing cache entries. + virtual void reload(bool ignoreCache = false) = 0; // Load the given URL. virtual void loadRequest(const WebURLRequest&) = 0; @@ -365,10 +381,14 @@ public: // Printing ------------------------------------------------------------ - // Reformats the WebFrame for printing. pageSize is the page size in - // pixels. Returns the number of pages that can be printed at the - // given page size. - virtual int printBegin(const WebSize& pageSize) = 0; + // Reformats the WebFrame for printing. pageSize is the page size in + // points (a point in 1/72 of an inch). printerDPI is the user selected, + // DPI for the printer. Returns the number of pages that + // can be printed at the given page size. The out param useBrowserOverlays + // specifies whether the browser process should use its overlays (header, + // footer, margins etc) or whether the renderer controls this. + virtual int printBegin(const WebSize& pageSize, int printerDPI = 72, + bool* useBrowserOverlays = 0) = 0; // Returns the page shrinking factor calculated by webkit (usually // between 1/1.25 and 1/2). Returns 0 if the page number is invalid or @@ -383,6 +403,21 @@ public: // Reformats the WebFrame for screen display. virtual void printEnd() = 0; + // CSS3 Paged Media ---------------------------------------------------- + + // Returns true if page box (margin boxes and page borders) is visible. + virtual bool isPageBoxVisible(int pageIndex) = 0; + + // Returns the preferred page size and margins in pixels, assuming 96 + // pixels per inch. pageSize, marginTop, marginRight, marginBottom, + // marginLeft must be initialized to the default values that are used if + // auto is specified. + virtual void pageSizeAndMarginsInPixels(int pageIndex, + WebSize& pageSize, + int& marginTop, + int& marginRight, + int& marginBottom, + int& marginLeft) = 0; // Find-in-page -------------------------------------------------------- @@ -446,20 +481,20 @@ public: // Registers a listener for the specified user name input element. The // listener will receive notifications for blur and when autocomplete // should be triggered. - // The WebFrame becomes the owner of the passed listener. - virtual void registerPasswordListener( + // An element can have only one listener. If a listener already exists, + // this method returns false and does not add the new one. + // Either way, the WebFrame becomes the owner of the passed listener. + virtual bool registerPasswordListener( WebInputElement, WebPasswordAutocompleteListener*) = 0; + // Dispatches an Autocompletion notification to registered listener if one + // exists that is registered against the WebInputElement specified. + virtual void notifiyPasswordListenerOfAutocomplete( + const WebInputElement&) = 0; - // Utility ------------------------------------------------------------- - // Given a relative URL, returns an absolute URL by resolving the URL - // relative to the base URL of the frame's document. This uses the - // same algorithm that WebKit uses to resolve hyperlinks found in a - // HTML document. - // Deprecated. Use document().completeURL() instead. - virtual WebURL completeURL(const WebString&) const = 0; + // Utility ------------------------------------------------------------- // Returns the contents of this frame as a string. If the text is // longer than maxChars, it will be clipped to that length. WARNING: @@ -490,6 +525,12 @@ public: float pageWidthInPixels, float pageHeightInPixels) const = 0; + // Returns the bounds rect for current selection. If selection is performed + // on transformed text, the rect will still bound the selection but will + // not be transformed itself. If no selection is present, the rect will be + // empty ((0,0), (0,0)). + virtual WebRect selectionBoundsRect() const = 0; + protected: ~WebFrame() { } }; diff --git a/WebKit/chromium/public/WebFrameClient.h b/WebKit/chromium/public/WebFrameClient.h index 4078151..699325d 100644 --- a/WebKit/chromium/public/WebFrameClient.h +++ b/WebKit/chromium/public/WebFrameClient.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Google Inc. All rights reserved. + * 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 @@ -32,12 +32,16 @@ #define WebFrameClient_h #include "WebCommon.h" +#include "WebFileSystem.h" #include "WebNavigationPolicy.h" #include "WebNavigationType.h" #include "WebURLError.h" namespace WebKit { +class WebApplicationCacheHost; +class WebApplicationCacheHostClient; +class WebCookieJar; class WebDataSource; class WebFormElement; class WebFrame; @@ -74,15 +78,34 @@ public: // May return null. virtual WebMediaPlayer* createMediaPlayer(WebFrame*, WebMediaPlayerClient*) { return 0; } + // May return null. + virtual WebApplicationCacheHost* createApplicationCacheHost(WebFrame*, WebApplicationCacheHostClient*) { return 0; } + + + // Services ------------------------------------------------------------ + + // A frame specific cookie jar. May return null, in which case + // WebKitClient::cookieJar() will be called to access cookies. + virtual WebCookieJar* cookieJar() { return 0; } + // 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*) { } // Controls whether plugins are allowed for this frame. virtual bool allowPlugins(WebFrame*, bool enabledPerSettings) { return enabledPerSettings; } + // Notifies the client that the frame would have instantiated a plug-in if plug-ins were enabled. + virtual void didNotAllowPlugins(WebFrame*) { } + // Controls whether images are allowed for this frame. virtual bool allowImages(WebFrame*, bool enabledPerSettings) { return enabledPerSettings; } @@ -122,6 +145,10 @@ public: // Navigational notifications ------------------------------------------ + // A form submission has been requested, but the page's submit event handler + // hasn't yet had a chance to run (and possibly alter/interrupt the submit.) + virtual void willSendSubmitEvent(WebFrame*, const WebFormElement&) { } + // A form submission is about to occur. virtual void willSubmitForm(WebFrame*, const WebFormElement&) { } @@ -176,6 +203,9 @@ public: // The page title is available. virtual void didReceiveTitle(WebFrame*, const WebString& title) { } + // The icons for the page have changed. + virtual void didChangeIcons(WebFrame*) { } + // The frame's document finished loading. virtual void didFinishDocumentLoad(WebFrame*) { } @@ -188,9 +218,14 @@ public: // The frame's document and all of its subresources succeeded to load. virtual void didFinishLoad(WebFrame*) { } + // The navigation resulted in no change to the documents within the page. + // For example, the navigation may have just resulted in scrolling to a + // named anchor or a PopState event may have been dispatched. + virtual void didNavigateWithinPage(WebFrame*, bool isNewNavigation) { } + // The navigation resulted in scrolling the page to a named anchor instead // of downloading a new document. - virtual void didChangeLocationWithinPage(WebFrame*, bool isNewNavigation) { } + virtual void didChangeLocationWithinPage(WebFrame*) { } // Called upon update to scroll position, document state, and other // non-navigational events related to the data held by WebHistoryItem. @@ -245,6 +280,12 @@ public: // Controls whether scripts are allowed to execute for this frame. virtual bool allowScript(WebFrame*, bool enabledPerSettings) { return enabledPerSettings; } + // Controls whether access to Web Databases is allowed for this frame. + virtual bool allowDatabase(WebFrame*, const WebString& name, const WebString& displayName, unsigned long estimatedSize) { return true; } + + // Notifies the client that the frame would have executed script if script were enabled. + virtual void didNotAllowScript(WebFrame*) { } + // Script in the page tried to allocate too much memory. virtual void didExhaustMemoryAvailableForScript(WebFrame*) { } @@ -263,6 +304,12 @@ public: // Geometry notifications ---------------------------------------------- + // The frame's document finished the initial layout of a page. + virtual void didFirstLayout(WebFrame*) { } + + // The frame's document finished the initial non-empty layout of a page. + virtual void didFirstVisuallyNonEmptyLayout(WebFrame*) { } + // The size of the content area changed. virtual void didChangeContentsSize(WebFrame*, const WebSize&) { } @@ -287,6 +334,19 @@ public: virtual void reportFindInPageSelection( int identifier, int activeMatchOrdinal, const WebRect& selection) { } + // FileSystem ---------------------------------------------------- + + // Requests to open a FileSystem. + // |size| indicates how much storage space (in bytes) the caller expects + // to need. + // WebFileSystemCallbacks::didOpenFileSystem() must be called with + // a name and root path for the requested FileSystem when the operation + // is completed successfully. WebFileSystemCallbacks::didFail() must be + // called otherwise. + virtual void openFileSystem( + WebFrame*, WebFileSystem::Type, long long size, + WebFileSystemCallbacks*) { } + protected: ~WebFrameClient() { } }; diff --git a/WebKit/chromium/public/WebGLES2Context.h b/WebKit/chromium/public/WebGLES2Context.h new file mode 100644 index 0000000..45184aa --- /dev/null +++ b/WebKit/chromium/public/WebGLES2Context.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * 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 WebGLES2Context_h +#define WebGLES2Context_h + +#include "WebCommon.h" +#include "WebNonCopyable.h" + +namespace WebKit { + +struct WebSize; +class WebView; + +// This interface abstracts the creation and management of an +// OpenGL ES 2.0 context. + +class WebGLES2Context : public WebNonCopyable { +public: + virtual ~WebGLES2Context() {} + + virtual bool initialize(WebView*, WebGLES2Context* parent) = 0; + virtual bool makeCurrent() = 0; + virtual bool destroy() = 0; + virtual bool swapBuffers() = 0; + + // The follow two functions are for managing a context that renders offscreen. + + // Resizes the backing store used for offscreen rendering. + virtual void resizeOffscreenContent(const WebSize&) = 0; + + // Returns the ID of the texture used for offscreen rendering in the context of the parent. + virtual unsigned getOffscreenContentParentTextureId() = 0; + + // The following function is used only on Mac OS X and is needed + // in order to report window size changes. +#if defined(__APPLE__) + virtual void resizeOnscreenContent(const WebSize&) = 0; +#endif +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebGeolocationService.h b/WebKit/chromium/public/WebGeolocationService.h new file mode 100644 index 0000000..ed8c4e8 --- /dev/null +++ b/WebKit/chromium/public/WebGeolocationService.h @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2010, Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebGeolocationService_h +#define WebGeolocationService_h + +#include "WebGeolocationServiceBridge.h" + +namespace WebKit { + +class WebString; +class WebURL; + +// Provides an embedder API called by WebKit. +class WebGeolocationService { +public: + virtual void requestPermissionForFrame(int bridgeId, const WebURL& url) { } + virtual void cancelPermissionRequestForFrame(int bridgeId, const WebURL&) { } + virtual void startUpdating(int bridgeId, const WebURL& url, bool enableHighAccuracy) { } + virtual void stopUpdating(int bridgeId) { } + virtual void suspend(int bridgeId) { } + virtual void resume(int bridgeId) { } + + // Attaches the WebGeolocationServiceBridge to the embedder and returns its + // id, which should be used on subsequent calls for the methods above. + virtual int attachBridge(WebGeolocationServiceBridge*) { return 0; } + + // Detaches the WebGeolocationServiceBridge from the embedder. + virtual void detachBridge(int bridgeId) { } +}; + +} // namespace WebKit + +#endif // WebGeolocationService_h diff --git a/WebKit/chromium/public/WebGeolocationServiceBridge.h b/WebKit/chromium/public/WebGeolocationServiceBridge.h new file mode 100644 index 0000000..9f0ffd4 --- /dev/null +++ b/WebKit/chromium/public/WebGeolocationServiceBridge.h @@ -0,0 +1,54 @@ +/* + * 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 WebGeolocationServiceBridge_h +#define WebGeolocationServiceBridge_h + +namespace WebCore { +class GeolocationServiceBridge; +class GeolocationServiceChromium; +} + +namespace WebKit { + +class WebString; +class WebURL; + +// Provides a WebKit API called by the embedder. +class WebGeolocationServiceBridge { +public: + virtual void setIsAllowed(bool allowed) = 0; + virtual void setLastPosition(double latitude, double longitude, bool providesAltitude, double altitude, double accuracy, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed, long long timestamp) = 0; + virtual void setLastError(int errorCode, const WebString& message) = 0; +}; + +} // namespace WebKit + +#endif // WebGeolocationServiceBridge_h diff --git a/WebKit/chromium/public/WebGeolocationServiceMock.h b/WebKit/chromium/public/WebGeolocationServiceMock.h new file mode 100644 index 0000000..407fe9d --- /dev/null +++ b/WebKit/chromium/public/WebGeolocationServiceMock.h @@ -0,0 +1,54 @@ +/* + * 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 WebGeolocationServiceMock_h +#define WebGeolocationServiceMock_h + +#include "WebCommon.h" +#include "WebGeolocationService.h" + +namespace WebKit { + +class WebString; + +class WebGeolocationServiceMock : public WebGeolocationService { +public: + WEBKIT_API static WebGeolocationServiceMock* createWebGeolocationServiceMock(); + WEBKIT_API static void setMockGeolocationPermission(bool allowed); + WEBKIT_API static void setMockGeolocationPosition(double latitude, double longitude, double accuracy); + WEBKIT_API static void setMockGeolocationError(int errorCode, const WebString& message); + +protected: + static bool s_mockGeolocationPermission; +}; + +} // namespace WebKit + +#endif // WebGeolocationServiceMock_h diff --git a/WebKit/chromium/public/WebGraphicsContext3D.h b/WebKit/chromium/public/WebGraphicsContext3D.h new file mode 100644 index 0000000..44a0498 --- /dev/null +++ b/WebKit/chromium/public/WebGraphicsContext3D.h @@ -0,0 +1,325 @@ +/* + * 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 WebGraphicsContext3D_h +#define WebGraphicsContext3D_h + +#include "WebCommon.h" +#include "WebNonCopyable.h" +#include "WebString.h" + +namespace WebKit { + +// Typedef for server-side objects like OpenGL textures and program objects. +typedef unsigned int WebGLId; + +class WebView; + +// This interface abstracts the operations performed by the +// GraphicsContext3D in order to implement WebGL. Nearly all of the +// methods exposed on this interface map directly to entry points in +// the OpenGL ES 2.0 API. + +class WebGraphicsContext3D : public WebNonCopyable { +public: + // Return value from getActiveUniform and getActiveAttrib. + struct ActiveInfo { + WebString name; + unsigned type; + int size; + }; + + // Context creation attributes. + struct Attributes { + Attributes() + : alpha(true) + , depth(true) + , stencil(true) + , antialias(true) + , premultipliedAlpha(true) + { + } + + bool alpha; + bool depth; + bool stencil; + bool antialias; + bool premultipliedAlpha; + }; + + // This destructor needs to be public so that using classes can destroy instances if initialization fails. + virtual ~WebGraphicsContext3D() {} + + // Creates a "default" implementation of WebGraphicsContext3D which calls + // OpenGL directly. + WEBKIT_API static WebGraphicsContext3D* createDefault(); + + // Initializes the graphics context; should be the first operation performed + // on newly-constructed instances. Returns true on success. + virtual bool initialize(Attributes, WebView*) = 0; + + // Makes the OpenGL context current on the current thread. Returns true on + // success. + virtual bool makeContextCurrent() = 0; + + // The size of the region into which this WebGraphicsContext3D is rendering. + // Returns the last values passed to reshape(). + virtual int width() = 0; + virtual int height() = 0; + + // Helper to return the size in bytes of OpenGL data types + // like GL_FLOAT, GL_INT, etc. + virtual int sizeInBytes(int type) = 0; + + // Resizes the region into which this WebGraphicsContext3D is drawing. + virtual void reshape(int width, int height) = 0; + + // Query whether it is built on top of compliant GLES2 implementation. + virtual bool isGLES2Compliant() = 0; + // Query whether it is built on top of GLES2 NPOT strict implementation. + virtual bool isGLES2NPOTStrict() = 0; + // Query whether it is built on top of implementation that generates errors + // on out-of-bounds buffer accesses. + virtual bool isErrorGeneratedOnOutOfBoundsAccesses() = 0; + + // Helper for software compositing path. Reads back the frame buffer into + // the memory region pointed to by "pixels" with size "bufferSize". It is + // expected that the storage for "pixels" covers (4 * width * height) bytes. + // Returns true on success. + virtual bool readBackFramebuffer(unsigned char* pixels, size_t bufferSize) = 0; + + // Returns the id of the texture which is used for storing the contents of + // the framebuffer associated with this context. This texture is accessible + // by the gpu-based page compositor. + virtual unsigned getPlatformTextureId() = 0; + + // Copies the contents of the off-screen render target used by the WebGL + // context to the corresponding texture used by the compositor. + virtual void prepareTexture() = 0; + + // Synthesizes an OpenGL error which will be returned from a + // later call to getError. This is used to emulate OpenGL ES + // 2.0 behavior on the desktop and to enforce additional error + // checking mandated by WebGL. + // + // Per the behavior of glGetError, this stores at most one + // instance of any given error, and returns them from calls to + // 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/ + virtual void activeTexture(unsigned long texture) = 0; + virtual void attachShader(WebGLId program, WebGLId shader) = 0; + virtual void bindAttribLocation(WebGLId program, unsigned long index, const char* name) = 0; + virtual void bindBuffer(unsigned long target, WebGLId buffer) = 0; + virtual void bindFramebuffer(unsigned long target, WebGLId framebuffer) = 0; + virtual void bindRenderbuffer(unsigned long target, WebGLId renderbuffer) = 0; + virtual void bindTexture(unsigned long target, WebGLId texture) = 0; + virtual void blendColor(double red, double green, double blue, double alpha) = 0; + virtual void blendEquation(unsigned long mode) = 0; + virtual void blendEquationSeparate(unsigned long modeRGB, unsigned long modeAlpha) = 0; + virtual void blendFunc(unsigned long sfactor, unsigned long dfactor) = 0; + virtual void blendFuncSeparate(unsigned long srcRGB, unsigned long dstRGB, unsigned long srcAlpha, unsigned long dstAlpha) = 0; + + virtual void bufferData(unsigned long target, int size, const void* data, unsigned long usage) = 0; + virtual void bufferSubData(unsigned long target, long offset, int size, const void* data) = 0; + + virtual unsigned long checkFramebufferStatus(unsigned long target) = 0; + virtual void clear(unsigned long mask) = 0; + virtual void clearColor(double red, double green, double blue, double alpha) = 0; + virtual void clearDepth(double depth) = 0; + virtual void clearStencil(long s) = 0; + virtual void colorMask(bool red, bool green, bool blue, bool alpha) = 0; + virtual void compileShader(WebGLId shader) = 0; + + virtual void copyTexImage2D(unsigned long target, long level, unsigned long internalformat, long x, long y, unsigned long width, unsigned long height, long border) = 0; + virtual void copyTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, long x, long y, unsigned long width, unsigned long height) = 0; + virtual void cullFace(unsigned long mode) = 0; + virtual void depthFunc(unsigned long func) = 0; + virtual void depthMask(bool flag) = 0; + virtual void depthRange(double zNear, double zFar) = 0; + virtual void detachShader(WebGLId program, WebGLId shader) = 0; + virtual void disable(unsigned long cap) = 0; + virtual void disableVertexAttribArray(unsigned long index) = 0; + virtual void drawArrays(unsigned long mode, long first, long count) = 0; + virtual void drawElements(unsigned long mode, unsigned long count, unsigned long type, long offset) = 0; + + virtual void enable(unsigned long cap) = 0; + virtual void enableVertexAttribArray(unsigned long index) = 0; + virtual void finish() = 0; + virtual void flush() = 0; + virtual void framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, WebGLId renderbuffer) = 0; + virtual void framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, WebGLId texture, long level) = 0; + virtual void frontFace(unsigned long mode) = 0; + virtual void generateMipmap(unsigned long target) = 0; + + virtual bool getActiveAttrib(WebGLId program, unsigned long index, ActiveInfo&) = 0; + virtual bool getActiveUniform(WebGLId program, unsigned long index, ActiveInfo&) = 0; + + virtual void getAttachedShaders(WebGLId program, int maxCount, int* count, unsigned int* shaders) = 0; + + virtual int getAttribLocation(WebGLId program, const char* name) = 0; + + virtual void getBooleanv(unsigned long pname, unsigned char* value) = 0; + + virtual void getBufferParameteriv(unsigned long target, unsigned long pname, int* value) = 0; + + virtual Attributes getContextAttributes() = 0; + + virtual unsigned long getError() = 0; + + virtual void getFloatv(unsigned long pname, float* value) = 0; + + virtual void getFramebufferAttachmentParameteriv(unsigned long target, unsigned long attachment, unsigned long pname, int* value) = 0; + + virtual void getIntegerv(unsigned long pname, int* value) = 0; + + virtual void getProgramiv(WebGLId program, unsigned long pname, int* value) = 0; + + virtual WebString getProgramInfoLog(WebGLId program) = 0; + + virtual void getRenderbufferParameteriv(unsigned long target, unsigned long pname, int* value) = 0; + + virtual void getShaderiv(WebGLId shader, unsigned long pname, int* value) = 0; + + virtual WebString getShaderInfoLog(WebGLId shader) = 0; + + // TBD + // void glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); + + virtual WebString getShaderSource(WebGLId shader) = 0; + virtual WebString getString(unsigned long name) = 0; + + virtual void getTexParameterfv(unsigned long target, unsigned long pname, float* value) = 0; + virtual void getTexParameteriv(unsigned long target, unsigned long pname, int* value) = 0; + + virtual void getUniformfv(WebGLId program, long location, float* value) = 0; + virtual void getUniformiv(WebGLId program, long location, int* value) = 0; + + virtual long getUniformLocation(WebGLId program, const char* name) = 0; + + virtual void getVertexAttribfv(unsigned long index, unsigned long pname, float* value) = 0; + virtual void getVertexAttribiv(unsigned long index, unsigned long pname, int* value) = 0; + + virtual long getVertexAttribOffset(unsigned long index, unsigned long pname) = 0; + + virtual void hint(unsigned long target, unsigned long mode) = 0; + virtual bool isBuffer(WebGLId buffer) = 0; + virtual bool isEnabled(unsigned long cap) = 0; + virtual bool isFramebuffer(WebGLId framebuffer) = 0; + virtual bool isProgram(WebGLId program) = 0; + virtual bool isRenderbuffer(WebGLId renderbuffer) = 0; + virtual bool isShader(WebGLId shader) = 0; + virtual bool isTexture(WebGLId texture) = 0; + virtual void lineWidth(double) = 0; + virtual void linkProgram(WebGLId program) = 0; + virtual void pixelStorei(unsigned long pname, long param) = 0; + virtual void polygonOffset(double factor, double units) = 0; + + virtual void readPixels(long x, long y, unsigned long width, unsigned long height, unsigned long format, unsigned long type, void* pixels) = 0; + + virtual void releaseShaderCompiler() = 0; + virtual void renderbufferStorage(unsigned long target, unsigned long internalformat, unsigned long width, unsigned long height) = 0; + virtual void sampleCoverage(double value, bool invert) = 0; + virtual void scissor(long x, long y, unsigned long width, unsigned long height) = 0; + virtual void shaderSource(WebGLId shader, const char* string) = 0; + virtual void stencilFunc(unsigned long func, long ref, unsigned long mask) = 0; + virtual void stencilFuncSeparate(unsigned long face, unsigned long func, long ref, unsigned long mask) = 0; + virtual void stencilMask(unsigned long mask) = 0; + virtual void stencilMaskSeparate(unsigned long face, unsigned long mask) = 0; + virtual void stencilOp(unsigned long fail, unsigned long zfail, unsigned long zpass) = 0; + virtual void stencilOpSeparate(unsigned long face, unsigned long fail, unsigned long zfail, unsigned long zpass) = 0; + + virtual void texImage2D(unsigned target, unsigned level, unsigned internalformat, unsigned width, unsigned height, unsigned border, unsigned format, unsigned type, const void* pixels) = 0; + + virtual void texParameterf(unsigned target, unsigned pname, float param) = 0; + virtual void texParameteri(unsigned target, unsigned pname, int param) = 0; + + virtual void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, unsigned width, unsigned height, unsigned format, unsigned type, const void* pixels) = 0; + + virtual void uniform1f(long location, float x) = 0; + virtual void uniform1fv(long location, int count, float* v) = 0; + virtual void uniform1i(long location, int x) = 0; + virtual void uniform1iv(long location, int count, int* v) = 0; + virtual void uniform2f(long location, float x, float y) = 0; + virtual void uniform2fv(long location, int count, float* v) = 0; + virtual void uniform2i(long location, int x, int y) = 0; + virtual void uniform2iv(long location, int count, int* v) = 0; + virtual void uniform3f(long location, float x, float y, float z) = 0; + virtual void uniform3fv(long location, int count, float* v) = 0; + virtual void uniform3i(long location, int x, int y, int z) = 0; + virtual void uniform3iv(long location, int count, int* v) = 0; + virtual void uniform4f(long location, float x, float y, float z, float w) = 0; + virtual void uniform4fv(long location, int count, float* v) = 0; + virtual void uniform4i(long location, int x, int y, int z, int w) = 0; + virtual void uniform4iv(long location, int count, int* v) = 0; + virtual void uniformMatrix2fv(long location, int count, bool transpose, const float* value) = 0; + virtual void uniformMatrix3fv(long location, int count, bool transpose, const float* value) = 0; + virtual void uniformMatrix4fv(long location, int count, bool transpose, const float* value) = 0; + + virtual void useProgram(WebGLId program) = 0; + virtual void validateProgram(WebGLId program) = 0; + + virtual void vertexAttrib1f(unsigned long indx, float x) = 0; + virtual void vertexAttrib1fv(unsigned long indx, const float* values) = 0; + virtual void vertexAttrib2f(unsigned long indx, float x, float y) = 0; + virtual void vertexAttrib2fv(unsigned long indx, const float* values) = 0; + virtual void vertexAttrib3f(unsigned long indx, float x, float y, float z) = 0; + virtual void vertexAttrib3fv(unsigned long indx, const float* values) = 0; + virtual void vertexAttrib4f(unsigned long indx, float x, float y, float z, float w) = 0; + virtual void vertexAttrib4fv(unsigned long indx, const float* values) = 0; + virtual void vertexAttribPointer(unsigned long indx, int size, int type, bool normalized, + unsigned long stride, unsigned long offset) = 0; + + virtual void viewport(long x, long y, unsigned long width, unsigned long height) = 0; + + // Support for buffer creation and deletion. + virtual unsigned createBuffer() = 0; + virtual unsigned createFramebuffer() = 0; + virtual unsigned createProgram() = 0; + virtual unsigned createRenderbuffer() = 0; + virtual unsigned createShader(unsigned long) = 0; + virtual unsigned createTexture() = 0; + + virtual void deleteBuffer(unsigned) = 0; + virtual void deleteFramebuffer(unsigned) = 0; + virtual void deleteProgram(unsigned) = 0; + virtual void deleteRenderbuffer(unsigned) = 0; + virtual void deleteShader(unsigned) = 0; + virtual void deleteTexture(unsigned) = 0; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebHTTPBody.h b/WebKit/chromium/public/WebHTTPBody.h index fcc44ff..a2bb5cd 100644 --- a/WebKit/chromium/public/WebHTTPBody.h +++ b/WebKit/chromium/public/WebHTTPBody.h @@ -35,6 +35,7 @@ #include "WebFileInfo.h" #include "WebNonCopyable.h" #include "WebString.h" +#include "WebURL.h" #if WEBKIT_IMPLEMENTATION namespace WebCore { class FormData; } @@ -48,12 +49,13 @@ class WebHTTPBodyPrivate; class WebHTTPBody { public: struct Element { - enum { TypeData, TypeFile } type; + enum { TypeData, TypeFile, TypeBlob } type; WebData data; WebString filePath; long long fileStart; long long fileLength; // -1 means to the end of the file. WebFileInfo fileInfo; + WebURL blobURL; }; ~WebHTTPBody() { reset(); } @@ -81,9 +83,10 @@ public: // Append to the list of elements. WEBKIT_API void appendData(const WebData&); - WEBKIT_API void appendFile(const WebString&); // FIXME: to be removed. + WEBKIT_API void appendFile(const WebString&); // Passing -1 to fileLength means to the end of the file. - WEBKIT_API void appendFile(const WebString&, long long fileStart, long long fileLength, const WebFileInfo&); + WEBKIT_API void appendFileRange(const WebString&, long long fileStart, long long fileLength, const WebFileInfo&); + WEBKIT_API void appendBlob(const WebURL&); // Identifies a particular form submission instance. A value of 0 is // used to indicate an unspecified identifier. diff --git a/WebKit/chromium/public/WebHistoryItem.h b/WebKit/chromium/public/WebHistoryItem.h index e248a61..1b4863e 100644 --- a/WebKit/chromium/public/WebHistoryItem.h +++ b/WebKit/chromium/public/WebHistoryItem.h @@ -32,17 +32,17 @@ #define WebHistoryItem_h #include "WebCommon.h" +#include "WebPrivatePtr.h" + +// FIXME: Remove this once Chromium starts using itemSequenceNumber. +#define WEBKIT_BUG_40451_IS_FIXED -#if WEBKIT_IMPLEMENTATION namespace WebCore { class HistoryItem; } -namespace WTF { template <typename T> class PassRefPtr; } -#endif namespace WebKit { - -class WebHistoryItemPrivate; class WebHTTPBody; class WebString; +class WebSerializedScriptValue; struct WebPoint; template <typename T> class WebVector; @@ -55,8 +55,8 @@ class WebHistoryItem { public: ~WebHistoryItem() { reset(); } - WebHistoryItem() : m_private(0) { } - WebHistoryItem(const WebHistoryItem& h) : m_private(0) { assign(h); } + WebHistoryItem() { } + WebHistoryItem(const WebHistoryItem& h) { assign(h); } WebHistoryItem& operator=(const WebHistoryItem& h) { assign(h); @@ -67,7 +67,7 @@ public: WEBKIT_API void reset(); WEBKIT_API void assign(const WebHistoryItem&); - bool isNull() const { return !m_private; } + bool isNull() const { return m_private.isNull(); } WEBKIT_API WebString urlString() const; WEBKIT_API void setURLString(const WebString&); @@ -105,9 +105,15 @@ public: WEBKIT_API WebVector<WebString> documentState() const; WEBKIT_API void setDocumentState(const WebVector<WebString>&); + WEBKIT_API long long itemSequenceNumber() const; + WEBKIT_API void setItemSequenceNumber(long long); + WEBKIT_API long long documentSequenceNumber() const; WEBKIT_API void setDocumentSequenceNumber(long long); + WEBKIT_API WebSerializedScriptValue stateObject() const; + WEBKIT_API void setStateObject(const WebSerializedScriptValue&); + WEBKIT_API WebString httpContentType() const; WEBKIT_API void setHTTPContentType(const WebString&); @@ -125,9 +131,8 @@ public: #endif private: - void assign(WebHistoryItemPrivate*); void ensureMutable(); - WebHistoryItemPrivate* m_private; + WebPrivatePtr<WebCore::HistoryItem> m_private; }; } // namespace WebKit diff --git a/WebKit/chromium/public/WebIDBCallbacks.h b/WebKit/chromium/public/WebIDBCallbacks.h new file mode 100644 index 0000000..2e2c4d2 --- /dev/null +++ b/WebKit/chromium/public/WebIDBCallbacks.h @@ -0,0 +1,59 @@ +/* + * 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 WebIDBCallbacks_h +#define WebIDBCallbacks_h + +#include "WebCommon.h" + +namespace WebKit { + +class WebIDBCursor; +class WebIDBDatabase; +class WebIDBDatabaseError; +class WebIDBKey; +class WebIDBIndex; +class WebIDBObjectStore; +class WebSerializedScriptValue; + +class WebIDBCallbacks { +public: + virtual ~WebIDBCallbacks() { } + + // For classes that follow the PImpl pattern, pass a const reference. + // For the rest, pass ownership to the callee via a pointer. + virtual void onError(const WebIDBDatabaseError&) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void onSuccess() { WEBKIT_ASSERT_NOT_REACHED(); } // For "null". + virtual void onSuccess(WebIDBCursor*) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void onSuccess(WebIDBDatabase*) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void onSuccess(const WebIDBKey&) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void onSuccess(WebIDBIndex*) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void onSuccess(WebIDBObjectStore*) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void onSuccess(const WebSerializedScriptValue&) { WEBKIT_ASSERT_NOT_REACHED(); } +}; + +} // namespace WebKit + +#endif // WebIDBCallbacks_h diff --git a/WebKit/chromium/public/WebIDBCursor.h b/WebKit/chromium/public/WebIDBCursor.h new file mode 100644 index 0000000..27eb924 --- /dev/null +++ b/WebKit/chromium/public/WebIDBCursor.h @@ -0,0 +1,78 @@ +/* + * 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 WebIDBCursor_h +#define WebIDBCursor_h + +#include "WebCommon.h" +#include "WebIDBCallbacks.h" +#include "WebIDBKey.h" +#include "WebSerializedScriptValue.h" +#include "WebString.h" + +namespace WebKit { + +// See comment in WebIndexedDatabase for a high level overview these classes. +class WebIDBCursor { +public: + virtual ~WebIDBCursor() { } + + virtual unsigned short direction() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return 0; + } + + virtual WebIDBKey key() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebIDBKey(""); + } + + virtual WebSerializedScriptValue value() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebSerializedScriptValue(); + } + + virtual void update(const WebSerializedScriptValue&, WebIDBCallbacks*) + { + WEBKIT_ASSERT_NOT_REACHED(); + } + + virtual void continueFunction(const WebIDBKey&, WebIDBCallbacks*) + { + WEBKIT_ASSERT_NOT_REACHED(); + } + + virtual void remove(WebIDBCallbacks*) + { + WEBKIT_ASSERT_NOT_REACHED(); + } +}; + +} // namespace WebKit + +#endif // WebIDBCursor_h diff --git a/WebKit/chromium/public/WebIDBDatabase.h b/WebKit/chromium/public/WebIDBDatabase.h new file mode 100644 index 0000000..6e494ce --- /dev/null +++ b/WebKit/chromium/public/WebIDBDatabase.h @@ -0,0 +1,89 @@ +/* + * 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 WebIDBDatabase_h +#define WebIDBDatabase_h + +#include "WebCommon.h" +#include "WebDOMStringList.h" + +namespace WebKit { + +class WebFrame; +class WebIDBCallbacks; +class WebIDBObjectStore; +class WebIDBTransaction; + +// See comment in WebIndexedDatabase for a high level overview of these classes. +class WebIDBDatabase { +public: + virtual ~WebIDBDatabase() { } + + virtual WebString name() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebString(); + } + virtual WebString description() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebString(); + } + virtual WebString version() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebString(); + } + virtual WebDOMStringList objectStores() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebDOMStringList(); + } + virtual void createObjectStore(const WebString& name, const WebString& keyPath, bool autoIncrement, WebIDBCallbacks*) + { + WEBKIT_ASSERT_NOT_REACHED(); + } + // Transfers ownership of the WebIDBObjectStore to the caller. + virtual WebIDBObjectStore* objectStore(const WebString& name, unsigned short mode) + { + WEBKIT_ASSERT_NOT_REACHED(); + return 0; + } + virtual void removeObjectStore(const WebString& name, WebIDBCallbacks* callbacks) + { + WEBKIT_ASSERT_NOT_REACHED(); + } + // Transfers ownership of the WebIDBTransaction to the caller. + virtual WebIDBTransaction* transaction(const WebDOMStringList& names, unsigned short mode, unsigned long timeout) + { + WEBKIT_ASSERT_NOT_REACHED(); + return 0; + } + +}; + +} // namespace WebKit + +#endif // WebIDBDatabase_h diff --git a/WebKit/chromium/public/WebIDBDatabaseError.h b/WebKit/chromium/public/WebIDBDatabaseError.h new file mode 100644 index 0000000..a237d5f --- /dev/null +++ b/WebKit/chromium/public/WebIDBDatabaseError.h @@ -0,0 +1,73 @@ +/* + * 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebIDBDatabaseError_h +#define WebIDBDatabaseError_h + +#include "WebCommon.h" +#include "WebPrivatePtr.h" +#include "WebString.h" + +namespace WebCore { class IDBDatabaseError; } + +namespace WebKit { + +// See comment in WebIndexedDatabase for a high level overview these classes. +class WebIDBDatabaseError { +public: + ~WebIDBDatabaseError() { reset(); } + + WEBKIT_API WebIDBDatabaseError(unsigned short code, const WebString& message) { assign(code, message); } + WEBKIT_API WebIDBDatabaseError(const WebIDBDatabaseError& e) { assign(e); } + WEBKIT_API WebIDBDatabaseError& operator=(const WebIDBDatabaseError& e) + { + assign(e); + return *this; + } + + WEBKIT_API void assign(const WebIDBDatabaseError&); + WEBKIT_API void reset(); + + WEBKIT_API unsigned short code() const; + WEBKIT_API WebString message() const; + +#if WEBKIT_IMPLEMENTATION + WebIDBDatabaseError(const WTF::PassRefPtr<WebCore::IDBDatabaseError>&); + WebIDBDatabaseError& operator=(const WTF::PassRefPtr<WebCore::IDBDatabaseError>&); + operator WTF::PassRefPtr<WebCore::IDBDatabaseError>() const; +#endif + +private: + WEBKIT_API void assign(unsigned short code, const WebString& message); + + WebPrivatePtr<WebCore::IDBDatabaseError> m_private; +}; + +} // namespace WebKit + +#endif // WebIDBDatabaseError_h diff --git a/WebKit/chromium/public/WebIDBFactory.h b/WebKit/chromium/public/WebIDBFactory.h new file mode 100755 index 0000000..7c070a2 --- /dev/null +++ b/WebKit/chromium/public/WebIDBFactory.h @@ -0,0 +1,72 @@ +/* + * 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebIDBFactory_h +#define WebIDBFactory_h + +#include "WebCommon.h" +#include "WebDOMStringList.h" +#include "WebIDBCallbacks.h" +#include "WebSecurityOrigin.h" +#include "WebString.h" +#include "WebVector.h" + +namespace WebKit { + +class WebFrame; +class WebIDBDatabase; +class WebSecurityOrigin; + +// The entry point into the IndexedDatabase API. These classes match their Foo and +// FooSync counterparts in the spec, but operate only in an async manner. +// http://dev.w3.org/2006/webapi/WebSimpleDB/ +class WebIDBFactory { +public: + WEBKIT_API static WebIDBFactory* create(); + + virtual ~WebIDBFactory() { } + + // The WebKit implementation of open ignores the WebFrame* parameter. + virtual void open(const WebString& name, const WebString& description, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame* webFrame) + { + int exceptionCode; + open(name, description, callbacks, origin, webFrame, exceptionCode); + } + // FIXME: Delete soon. Compatability hack. + virtual void open(const WebString& name, const WebString& description, + WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame* webFrame, int& exceptionCode) + { + open(name, description, callbacks, origin, webFrame); + } + + virtual void abortPendingTransactions(const WebVector<int>& pendingIDs) { WEBKIT_ASSERT_NOT_REACHED(); } +}; + +} // namespace WebKit + +#endif // WebIDBFactory_h diff --git a/WebKit/chromium/public/WebIDBIndex.h b/WebKit/chromium/public/WebIDBIndex.h new file mode 100644 index 0000000..dafea0e --- /dev/null +++ b/WebKit/chromium/public/WebIDBIndex.h @@ -0,0 +1,57 @@ +/* + * 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 WebIDBIndex_h +#define WebIDBIndex_h + +#include "WebString.h" + +namespace WebKit { + +// See comment in WebIndexedDatabase for a high level overview of these classes. +class WebIDBIndex { +public: + virtual ~WebIDBIndex() { } + + virtual WebString name() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebString(); + } + virtual WebString keyPath() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebString(); + } + virtual bool unique() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return false; + } +}; + +} // namespace WebKit + +#endif // WebIDBIndex_h diff --git a/WebKit/chromium/public/WebIDBKey.h b/WebKit/chromium/public/WebIDBKey.h new file mode 100644 index 0000000..6aef332 --- /dev/null +++ b/WebKit/chromium/public/WebIDBKey.h @@ -0,0 +1,91 @@ +/* + * 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 WebIDBKey_h +#define WebIDBKey_h + +#include "WebCommon.h" +#include "WebPrivatePtr.h" +#include "WebString.h" + +namespace WebCore { class IDBKey; } + +namespace WebKit { + +class WebIDBKeyPath; +class WebSerializedScriptValue; + +class WebIDBKey { +public: + // Please use one of the factory methods. This is public only to allow WebVector. + WebIDBKey() { } + ~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); } + WebIDBKey(const WebIDBKey& e) { assign(e); } + WebIDBKey& operator=(const WebIDBKey& e) + { + assign(e); + return *this; + } + + WEBKIT_API void assign(const WebIDBKey&); + WEBKIT_API void assignNull(); + WEBKIT_API void assign(const WebString&); + WEBKIT_API void assign(int32_t); + WEBKIT_API void assignInvalid(); + WEBKIT_API void reset(); + + enum Type { + NullType = 0, + StringType, + NumberType, + // Types not in WebCore::IDBKey: + InvalidType + }; + + WEBKIT_API Type type() const; + WEBKIT_API WebString string() const; // Only valid for StringType. + WEBKIT_API int32_t number() const; // Only valid for numberType. + +#if WEBKIT_IMPLEMENTATION + WebIDBKey(const WTF::PassRefPtr<WebCore::IDBKey>&); + WebIDBKey& operator=(const WTF::PassRefPtr<WebCore::IDBKey>&); + operator WTF::PassRefPtr<WebCore::IDBKey>() const; +#endif + +private: + + WebPrivatePtr<WebCore::IDBKey> m_private; +}; + +} // namespace WebKit + +#endif // WebIDBKey_h diff --git a/WebKit/chromium/public/WebIDBKeyPath.h b/WebKit/chromium/public/WebIDBKeyPath.h new file mode 100644 index 0000000..db6c363 --- /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: + WEBKIT_API 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/WebIDBKeyRange.h b/WebKit/chromium/public/WebIDBKeyRange.h new file mode 100644 index 0000000..82953ce --- /dev/null +++ b/WebKit/chromium/public/WebIDBKeyRange.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 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 WebIDBKeyRange_h +#define WebIDBKeyRange_h + +#include "WebCommon.h" +#include "WebPrivatePtr.h" + +namespace WebCore { class IDBKeyRange; } + +namespace WebKit { + +class WebIDBKey; +class WebString; + +class WebIDBKeyRange { +public: + ~WebIDBKeyRange() { reset(); } + + WebIDBKeyRange(const WebIDBKeyRange& keyRange) { assign(keyRange); } + WebIDBKeyRange(const WebIDBKey& left, const WebIDBKey& right, unsigned short flags) { assign(left, right, flags); } + + WEBKIT_API WebIDBKey left() const; + WEBKIT_API WebIDBKey right() const; + WEBKIT_API unsigned short flags() const; + + WEBKIT_API void assign(const WebIDBKeyRange&); + WEBKIT_API void assign(const WebIDBKey& left, const WebIDBKey& right, unsigned short flags); + WEBKIT_API void reset(); + +#if WEBKIT_IMPLEMENTATION + WebIDBKeyRange(const WTF::PassRefPtr<WebCore::IDBKeyRange>&); + WebIDBKeyRange& operator=(const WTF::PassRefPtr<WebCore::IDBKeyRange>&); + operator WTF::PassRefPtr<WebCore::IDBKeyRange>() const; +#endif + +private: + WebPrivatePtr<WebCore::IDBKeyRange> m_private; +}; + +} // namespace WebKit + +#endif // WebIDBKeyRange_h diff --git a/WebKit/chromium/public/WebIDBObjectStore.h b/WebKit/chromium/public/WebIDBObjectStore.h new file mode 100755 index 0000000..7452be9 --- /dev/null +++ b/WebKit/chromium/public/WebIDBObjectStore.h @@ -0,0 +1,93 @@ +/* + * 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 WebIDBObjectStore_h +#define WebIDBObjectStore_h + +#include "WebCommon.h" +#include "WebDOMStringList.h" +#include "WebIDBCallbacks.h" +#include "WebString.h" + +namespace WebKit { + +class WebIDBKeyRange; + +// See comment in WebIndexedDatabase for a high level overview these classes. +class WebIDBObjectStore { +public: + virtual ~WebIDBObjectStore() { } + + virtual WebString name() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebString(); + } + virtual WebString keyPath() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebString(); + } + virtual WebDOMStringList indexNames() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebDOMStringList(); + } + virtual void get(const WebIDBKey& key, WebIDBCallbacks*) + { + WEBKIT_ASSERT_NOT_REACHED(); + } + virtual void put(const WebSerializedScriptValue& value, const WebIDBKey& key, bool addOnly, WebIDBCallbacks*) + { + WEBKIT_ASSERT_NOT_REACHED(); + } + virtual void remove(const WebIDBKey& key, WebIDBCallbacks*) + { + WEBKIT_ASSERT_NOT_REACHED(); + } + virtual void createIndex(const WebString& name, const WebString& keyPath, bool unique, WebIDBCallbacks*) + { + WEBKIT_ASSERT_NOT_REACHED(); + } + // Transfers ownership of the WebIDBIndex to the caller. + virtual WebIDBIndex* index(const WebString& name) + { + WEBKIT_ASSERT_NOT_REACHED(); + return 0; + } + virtual void removeIndex(const WebString& name, WebIDBCallbacks*) + { + WEBKIT_ASSERT_NOT_REACHED(); + } + virtual void openCursor(const WebIDBKeyRange&, unsigned short direction, WebIDBCallbacks*) + { + WEBKIT_ASSERT_NOT_REACHED(); + } + // FIXME: finish. +}; + +} // namespace WebKit + +#endif // WebIDBObjectStore_h diff --git a/WebKit/chromium/public/WebIDBTransaction.h b/WebKit/chromium/public/WebIDBTransaction.h new file mode 100644 index 0000000..0369b89 --- /dev/null +++ b/WebKit/chromium/public/WebIDBTransaction.h @@ -0,0 +1,62 @@ +/* + * 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 WebIDBTransaction_h +#define WebIDBTransaction_h + +#include "WebString.h" + +namespace WebKit { + +class WebIDBObjectStore; +class WebIDBTransactionCallbacks; + +// See comment in WebIndexedDatabase for a high level overview of these classes. +class WebIDBTransaction { +public: + virtual ~WebIDBTransaction() { } + + virtual int mode() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return 0; + } + virtual WebIDBObjectStore* objectStore(const WebString& name) + { + WEBKIT_ASSERT_NOT_REACHED(); + return 0; + } + virtual void abort() { WEBKIT_ASSERT_NOT_REACHED(); } + virtual int id() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return 0; + } + virtual void setCallbacks(WebIDBTransactionCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } +}; + +} // namespace WebKit + +#endif // WebIDBTransaction_h diff --git a/WebKit/chromium/public/WebIDBTransactionCallbacks.h b/WebKit/chromium/public/WebIDBTransactionCallbacks.h new file mode 100644 index 0000000..4b92217 --- /dev/null +++ b/WebKit/chromium/public/WebIDBTransactionCallbacks.h @@ -0,0 +1,46 @@ +/* + * 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 WebIDBTransactionCallbacks_h +#define WebIDBTransactionCallbacks_h + +#include "WebCommon.h" + +namespace WebKit { +class WebIDBTransactionCallbacks { +public: + virtual ~WebIDBTransactionCallbacks() { } + + virtual void onAbort() { WEBKIT_ASSERT_NOT_REACHED(); } + virtual int id() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return 0; + } +}; + +} // namespace WebKit + +#endif // WebIDBTransactionCallbacks_h diff --git a/WebKit/chromium/public/WebImageDecoder.h b/WebKit/chromium/public/WebImageDecoder.h new file mode 100644 index 0000000..22db709 --- /dev/null +++ b/WebKit/chromium/public/WebImageDecoder.h @@ -0,0 +1,90 @@ +/* + * 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 WebImageDecoder_h +#define WebImageDecoder_h + +#include "WebCommon.h" +#include "WebImage.h" +#include "WebNonCopyable.h" + +namespace WebCore { class ImageDecoder; } + +namespace WebKit { + +typedef WebCore::ImageDecoder WebImageDecoderPrivate; +class WebData; + +class WebImageDecoder : public WebNonCopyable { +public: + enum Type { + TypeBMP, + TypeICO + }; + + ~WebImageDecoder() { reset(); } + + explicit WebImageDecoder(Type type) { init(type); } + + // Sets data contents for underlying decoder. All the API methods + // require that setData() is called prior to their use. + WEBKIT_API void setData(const WebData& data, bool allDataReceived); + + // Deletes owned decoder. + WEBKIT_API void reset(); + + // Returns true if image decoding failed. + WEBKIT_API bool isFailed() const; + + // Returns true if size information is available for the decoder. + WEBKIT_API bool isSizeAvailable() const; + + // Returns the size of the image. + WEBKIT_API WebSize size() const; + + // Gives frame count for the image. For multiple frames, decoder scans the image data for the count. + WEBKIT_API size_t frameCount() const; + + // Returns if the frame at given index is completely decoded. + WEBKIT_API bool isFrameCompleteAtIndex(int index) const; + + // Creates and returns WebImage from buffer at the index. + WEBKIT_API WebImage getFrameAtIndex(int index) const; + +private: + // Creates type-specific decoder. + WEBKIT_API void init(Type type); + + WebImageDecoderPrivate* m_private; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebInputElement.h b/WebKit/chromium/public/WebInputElement.h index 59643d1..d8c8ce7 100644 --- a/WebKit/chromium/public/WebInputElement.h +++ b/WebKit/chromium/public/WebInputElement.h @@ -31,29 +31,26 @@ #ifndef WebInputElement_h #define WebInputElement_h -#include "WebElement.h" +#include "WebFormControlElement.h" #if WEBKIT_IMPLEMENTATION namespace WebCore { class HTMLInputElement; } -namespace WTF { template <typename T> class PassRefPtr; } #endif namespace WebKit { // Provides readonly access to some properties of a DOM input element node. - class WebInputElement : public WebElement { + class WebInputElement : public WebFormControlElement { public: - WebInputElement() : WebElement() { } - WebInputElement(const WebInputElement& n) : WebElement(n) { } + WebInputElement() : WebFormControlElement() { } + WebInputElement(const WebInputElement& e) : WebFormControlElement(e) { } - WebInputElement& operator=(const WebInputElement& n) { WebElement::assign(n); return *this; } - WEBKIT_API void assign(const WebInputElement& n) { WebElement::assign(n); } - -#if WEBKIT_IMPLEMENTATION - WebInputElement(const WTF::PassRefPtr<WebCore::HTMLInputElement>&); - WebInputElement& operator=(const WTF::PassRefPtr<WebCore::HTMLInputElement>&); - operator WTF::PassRefPtr<WebCore::HTMLInputElement>() const; -#endif + WebInputElement& operator=(const WebInputElement& e) + { + WebFormControlElement::assign(e); + return *this; + } + WEBKIT_API void assign(const WebInputElement& e) { WebFormControlElement::assign(e); } enum InputType { Text = 0, @@ -83,21 +80,31 @@ namespace WebKit { }; WEBKIT_API bool autoComplete() const; + WEBKIT_API bool isReadOnly() const; WEBKIT_API bool isEnabledFormControl() const; WEBKIT_API InputType inputType() const; - WEBKIT_API WebString formControlType() const; + WEBKIT_API int maxLength() const; WEBKIT_API bool isActivatedSubmit() const; WEBKIT_API void setActivatedSubmit(bool); - WEBKIT_API void setValue(const WebString& value); + WEBKIT_API int size() const; + WEBKIT_API void setValue(const WebString&); WEBKIT_API WebString value() const; + WEBKIT_API void setSuggestedValue(const WebString&); + WEBKIT_API WebString suggestedValue() const; + WEBKIT_API void setPlaceholder(const WebString&); + WEBKIT_API WebString placeholder() const; + WEBKIT_API bool isAutofilled() const; WEBKIT_API void setAutofilled(bool); WEBKIT_API void dispatchFormControlChangeEvent(); WEBKIT_API void setSelectionRange(int, int); - WEBKIT_API WebString name() const; - // Returns the name that should be used for the specified |element| when - // storing autofill data. This is either the field name or its id, an empty - // string if it has no name and no id. - WEBKIT_API WebString nameForAutofill() const; + WEBKIT_API int selectionStart(); + WEBKIT_API int selectionEnd(); + +#if WEBKIT_IMPLEMENTATION + WebInputElement(const WTF::PassRefPtr<WebCore::HTMLInputElement>&); + WebInputElement& operator=(const WTF::PassRefPtr<WebCore::HTMLInputElement>&); + operator WTF::PassRefPtr<WebCore::HTMLInputElement>() const; +#endif }; } // namespace WebKit diff --git a/WebKit/chromium/public/WebInputEvent.h b/WebKit/chromium/public/WebInputEvent.h index 983aa2a..f8b057b 100644 --- a/WebKit/chromium/public/WebInputEvent.h +++ b/WebKit/chromium/public/WebInputEvent.h @@ -32,6 +32,7 @@ #define WebInputEvent_h #include "WebCommon.h" +#include "WebTouchPoint.h" #include <string.h> @@ -88,6 +89,7 @@ public: MouseMove, MouseEnter, MouseLeave, + ContextMenu, // WebMouseWheelEvent MouseWheel, @@ -96,7 +98,13 @@ public: RawKeyDown, KeyDown, KeyUp, - Char + Char, + + // WebTouchEvent + TouchStart, + TouchMove, + TouchEnd, + TouchCancel, }; enum Modifiers { @@ -121,6 +129,17 @@ public: int modifiers; double timeStampSeconds; // Seconds since epoch. + // Returns true if the WebInputEvent |type| is a mouse event. + static bool isMouseEventType(int type) + { + return type == MouseDown + || type == MouseUp + || type == MouseMove + || type == MouseEnter + || type == MouseLeave + || type == ContextMenu; + } + // Returns true if the WebInputEvent |type| is a keyboard event. static bool isKeyboardEventType(int type) { @@ -129,6 +148,15 @@ public: || type == KeyUp || type == Char; } + + // Returns true if the WebInputEvent |type| is a touch event. + static bool isTouchEventType(int type) + { + return type == TouchStart + || type == TouchMove + || type == TouchEnd + || type == TouchCancel; + } }; // WebKeyboardEvent ----------------------------------------------------------- @@ -255,6 +283,22 @@ public: } }; +// WebTouchEvent -------------------------------------------------------------- + +class WebTouchEvent : public WebInputEvent { +public: + static const int touchPointsLengthCap = 4; + + int touchPointsLength; + WebTouchPoint touchPoints[touchPointsLengthCap]; + + WebTouchEvent(unsigned sizeParam = sizeof(WebTouchEvent)) + : WebInputEvent(sizeParam) + , touchPointsLength(0) + { + } +}; + } // namespace WebKit #endif diff --git a/WebKit/chromium/public/WebKitClient.h b/WebKit/chromium/public/WebKitClient.h index fbaa218..9c0b4c2 100644 --- a/WebKit/chromium/public/WebKitClient.h +++ b/WebKit/chromium/public/WebKitClient.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Google Inc. All rights reserved. + * 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 @@ -35,8 +35,8 @@ #include "WebData.h" #include "WebLocalizedString.h" #include "WebString.h" -#include "WebURL.h" #include "WebVector.h" +#include "WebURL.h" #include <time.h> @@ -48,18 +48,25 @@ namespace WebKit { class WebApplicationCacheHost; class WebApplicationCacheHostClient; +class WebBlobRegistry; class WebClipboard; +class WebCookieJar; +class WebFileSystem; +class WebFileUtilities; +class WebGLES2Context; +class WebGraphicsContext3D; +class WebIDBFactory; +class WebIDBKey; class WebMessagePortChannel; class WebMimeRegistry; class WebPluginListBuilder; class WebSandboxSupport; +class WebSerializedScriptValue; class WebSharedWorkerRepository; class WebSocketStreamHandle; class WebStorageNamespace; class WebThemeEngine; class WebURLLoader; -struct WebCookie; -template <typename T> class WebVector; class WebKitClient { public: @@ -69,51 +76,34 @@ public: // Must return non-null. virtual WebMimeRegistry* mimeRegistry() { return 0; } + // Must return non-null. + virtual WebFileUtilities* fileUtilities() { return 0; } + // May return null if sandbox support is not necessary virtual WebSandboxSupport* sandboxSupport() { return 0; } // May return null on some platforms. virtual WebThemeEngine* themeEngine() { return 0; } + // May return null. + virtual WebCookieJar* cookieJar() { return 0; } - // Application Cache -------------------------------------------- - - // May return null if the process type doesn't involve appcaching. - virtual WebApplicationCacheHost* createApplicationCacheHost(WebApplicationCacheHostClient*) { return 0; } + // Blob ---------------------------------------------------------------- + // Must return non-null. + virtual WebBlobRegistry* blobRegistry() { return 0; } // DOM Storage -------------------------------------------------- // Return a LocalStorage namespace that corresponds to the following path. virtual WebStorageNamespace* createLocalStorageNamespace(const WebString& path, unsigned quota) { return 0; } - // Return a new SessionStorage namespace. - // THIS IS DEPRECATED. WebViewClient::getSessionStorageNamespace() is the new way to access this. - virtual WebStorageNamespace* createSessionStorageNamespace() { return 0; } - // Called when storage events fire. virtual void dispatchStorageEvent(const WebString& key, const WebString& oldValue, const WebString& newValue, const WebString& origin, const WebURL& url, bool isLocalStorage) { } - // File ---------------------------------------------------------------- - - // Various file/directory related functions. These map 1:1 with - // functions in WebCore's FileSystem.h. - 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, time_t& 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(); } - - // History ------------------------------------------------------------- // Returns the hash for the given canonicalized URL for use in visited @@ -126,7 +116,7 @@ public: virtual bool isLinkVisited(unsigned long long linkHash) { return false; } - // Database ------------------------------------------------------------ + // HTML5 Database ------------------------------------------------------ #ifdef WIN32 typedef HANDLE FileHandle; @@ -137,7 +127,7 @@ public: // Opens a database file; dirHandle should be 0 if the caller does not need // a handle to the directory containing this file virtual FileHandle databaseOpenFile( - const WebString& vfsFileName, int desiredFlags, FileHandle* dirHandle) { return FileHandle(); } + const WebString& vfsFileName, int desiredFlags) { return FileHandle(); } // Deletes a database file and returns the error code virtual int databaseDeleteFile(const WebString& vfsFileName, bool syncDir) { return 0; } @@ -149,6 +139,12 @@ public: virtual long long databaseGetFileSize(const WebString& vfsFileName) { return 0; } + // Indexed Database ---------------------------------------------------- + + virtual WebIDBFactory* idbFactory() { return 0; } + virtual void createIDBKeysFromSerializedValuesAndKeyPath(const WebVector<WebSerializedScriptValue>& values, const WebString& keyPath, WebVector<WebIDBKey>& keys) { } + + // Keygen -------------------------------------------------------------- // Handle the <keygen> tag for generating client certificates @@ -177,13 +173,6 @@ public: // Network ------------------------------------------------------------- - virtual void setCookies( - const WebURL& url, const WebURL& firstPartyForCookies, const WebString& cookies) { } - virtual WebString cookies(const WebURL& url, const WebURL& firstPartyForCookies) { return WebString(); } - virtual bool rawCookies(const WebURL& url, const WebURL& firstPartyForCookies, WebVector<WebCookie>*) { return false; } - virtual void deleteCookie(const WebURL& url, const WebString& cookieName) { } - virtual bool cookiesEnabled(const WebURL& url, const WebURL& firstPartyForCookies) { return true; } - // A suggestion to prefetch IP information for the given hostname. virtual void prefetchHostName(const WebString&) { } @@ -196,6 +185,9 @@ public: // Returns the User-Agent string that should be used for the given URL. virtual WebString userAgent(const WebURL&) { return WebString(); } + // A suggestion to cache this metadata in association with this URL. + virtual void cacheMetadata(const WebURL&, double responseTime, const char* data, size_t dataSize) { } + // Plugins ------------------------------------------------------------- @@ -267,7 +259,24 @@ public: virtual void stopSharedTimer() { } // Callable from a background WebKit thread. - virtual void callOnMainThread(void (*func)()) { } + virtual void callOnMainThread(void (*func)(void*), void* context) { } + + // WebGL -------------------------------------------------------------- + + // May return null if WebGL is not supported. + // Returns newly allocated WebGraphicsContext3D instance. + virtual WebGraphicsContext3D* createGraphicsContext3D() { return 0; } + + // GLES2 -------------------------------------------------------------- + + // Returns newly allocated WebGLES2Context instance. + // May return null if it fails to create the context. + virtual WebGLES2Context* createGLES2Context() { return 0; } + + // FileSystem ---------------------------------------------------------- + + // Must return non-null. + virtual WebFileSystem* fileSystem() { return 0; } protected: ~WebKitClient() { } diff --git a/WebKit/chromium/public/WebLabelElement.h b/WebKit/chromium/public/WebLabelElement.h new file mode 100644 index 0000000..3e97c39 --- /dev/null +++ b/WebKit/chromium/public/WebLabelElement.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: + * + * * 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 WebLabelElement_h +#define WebLabelElement_h + +#include "WebElement.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class HTMLLabelElement; } +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { + +// Provides readonly access to some properties of a DOM label element node. +class WebLabelElement : public WebElement { +public: + WebLabelElement() : WebElement() { } + WebLabelElement(const WebLabelElement& e) : WebElement(e) { } + + WebLabelElement& operator=(const WebLabelElement& e) + { + WebElement::assign(e); + return *this; + } + + WEBKIT_API void assign(const WebLabelElement& e) { WebElement::assign(e); } + + WEBKIT_API WebElement correspondingControl(); + +#if WEBKIT_IMPLEMENTATION + WebLabelElement(const WTF::PassRefPtr<WebCore::HTMLLabelElement>&); + WebLabelElement& operator=(const WTF::PassRefPtr<WebCore::HTMLLabelElement>&); + operator WTF::PassRefPtr<WebCore::HTMLLabelElement>() const; +#endif +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebMediaElement.h b/WebKit/chromium/public/WebMediaElement.h new file mode 100644 index 0000000..94837a5 --- /dev/null +++ b/WebKit/chromium/public/WebMediaElement.h @@ -0,0 +1,56 @@ +/* + * 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 WebMediaElement_h +#define WebMediaElement_h + +#include "WebElement.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class HTMLMediaElement; } +#endif + +namespace WebKit { + +class WebMediaPlayer; + +class WebMediaElement : public WebElement { +public: + WEBKIT_API WebMediaPlayer* player() const; + +#if WEBKIT_IMPLEMENTATION + WebMediaElement(const WTF::PassRefPtr<WebCore::HTMLMediaElement>&); + WebMediaElement& operator=(const WTF::PassRefPtr<WebCore::HTMLMediaElement>&); + operator WTF::PassRefPtr<WebCore::HTMLMediaElement>() const; +#endif +}; +} // namespace WebKit + +#endif // WebMediaElement_h diff --git a/WebKit/chromium/public/WebMediaPlayer.h b/WebKit/chromium/public/WebMediaPlayer.h index 0b658f9..6cec0f5 100644 --- a/WebKit/chromium/public/WebMediaPlayer.h +++ b/WebKit/chromium/public/WebMediaPlayer.h @@ -33,6 +33,7 @@ #include "WebCanvas.h" #include "WebVector.h" +#include "WebVideoFrame.h" namespace WebKit { @@ -95,7 +96,7 @@ public: virtual void setVisible(bool) = 0; virtual bool setAutoBuffer(bool) = 0; virtual bool totalBytesKnown() = 0; - virtual const WebTimeRanges& buffered() const = 0; + virtual const WebTimeRanges& buffered() = 0; virtual float maxTimeSeekable() const = 0; virtual void setSize(const WebSize&) = 0; @@ -127,6 +128,18 @@ public: virtual bool hasSingleSecurityOrigin() const = 0; virtual MovieLoadType movieLoadType() const = 0; + + // This function returns a pointer to a WebVideoFrame, which is + // a WebKit wrapper for a video frame in chromium. This places a lock + // on the frame in chromium, and calls to this method should always be + // followed with a call to putCurrentFrame(). The ownership of this object + // is not transferred to the caller, and the caller should not free the + // returned object. + virtual WebVideoFrame* getCurrentFrame() { return 0; } + // This function releases the lock on the current video frame in Chromium. + // It should always be called after getCurrentFrame(). Frame passed to this + // method should no longer be referenced after the call is made. + virtual void putCurrentFrame(WebVideoFrame*) { } }; } // namespace WebKit diff --git a/WebKit/chromium/public/WebMediaPlayerAction.h b/WebKit/chromium/public/WebMediaPlayerAction.h index 3aede25..192704f 100644 --- a/WebKit/chromium/public/WebMediaPlayerAction.h +++ b/WebKit/chromium/public/WebMediaPlayerAction.h @@ -38,7 +38,8 @@ struct WebMediaPlayerAction { Unknown, Play, Mute, - Loop + Loop, + Controls }; Type type; diff --git a/WebKit/chromium/public/WebMediaPlayerClient.h b/WebKit/chromium/public/WebMediaPlayerClient.h index 47ce64e..7e5dd68 100644 --- a/WebKit/chromium/public/WebMediaPlayerClient.h +++ b/WebKit/chromium/public/WebMediaPlayerClient.h @@ -48,6 +48,7 @@ public: virtual void rateChanged() = 0; virtual void sizeChanged() = 0; virtual void sawUnsupportedTracks() = 0; + virtual float volume() const = 0; protected: ~WebMediaPlayerClient() { } diff --git a/WebKit/chromium/public/WebNamedNodeMap.h b/WebKit/chromium/public/WebNamedNodeMap.h new file mode 100644 index 0000000..0b7e296 --- /dev/null +++ b/WebKit/chromium/public/WebNamedNodeMap.h @@ -0,0 +1,74 @@ +/* + * 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 WebNamedNodeMap_h +#define WebNamedNodeMap_h + +#include "WebCommon.h" +#include "WebPrivatePtr.h" + +namespace WebCore { class NamedNodeMap; } +#if WEBKIT_IMPLEMENTATION +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { +class WebAttribute; + +// Provides readonly access to some properties of a DOM attribute map. +class WebNamedNodeMap { +public: + ~WebNamedNodeMap() { reset(); } + + WebNamedNodeMap() { } + WebNamedNodeMap(const WebNamedNodeMap& n) { assign(n); } + WebNamedNodeMap& operator=(const WebNamedNodeMap& n) + { + assign(n); + return *this; + } + + WEBKIT_API void reset(); + WEBKIT_API void assign(const WebNamedNodeMap&); + + WEBKIT_API unsigned length() const; + WEBKIT_API WebAttribute attributeItem(unsigned) const; + +#if WEBKIT_IMPLEMENTATION + WebNamedNodeMap(const WTF::PassRefPtr<WebCore::NamedNodeMap>&); +#endif + +private: + WebPrivatePtr<WebCore::NamedNodeMap> m_private; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebNode.h b/WebKit/chromium/public/WebNode.h index 4d2a0e9..f54ff04 100644 --- a/WebKit/chromium/public/WebNode.h +++ b/WebKit/chromium/public/WebNode.h @@ -32,17 +32,15 @@ #define WebNode_h #include "WebCommon.h" +#include "WebPrivatePtr.h" #include "WebString.h" namespace WebCore { class Node; } -#if WEBKIT_IMPLEMENTATION -namespace WTF { template <typename T> class PassRefPtr; } -#endif namespace WebKit { +class WebDOMEventListener; +class WebDOMEventListenerPrivate; class WebDocument; -class WebEventListener; -class WebEventListenerPrivate; class WebFrame; class WebNodeList; @@ -51,8 +49,8 @@ class WebNode { public: virtual ~WebNode() { reset(); } - WebNode() : m_private(0) { } - WebNode(const WebNode& n) : m_private(0) { assign(n); } + WebNode() { } + WebNode(const WebNode& n) { assign(n); } WebNode& operator=(const WebNode& n) { assign(n); @@ -62,13 +60,12 @@ public: WEBKIT_API void reset(); WEBKIT_API void assign(const WebNode&); - bool isNull() const { return !m_private; } - -#if WEBKIT_IMPLEMENTATION - WebNode(const WTF::PassRefPtr<WebCore::Node>&); - WebNode& operator=(const WTF::PassRefPtr<WebCore::Node>&); - operator WTF::PassRefPtr<WebCore::Node>() const; -#endif + WEBKIT_API bool equals(const WebNode&) const; + // Required for using WebNodes in std maps. Note the order used is + // arbitrary and should not be expected to have any specific meaning. + WEBKIT_API bool lessThan(const WebNode&) const; + + bool isNull() const { return m_private.isNull(); } enum NodeType { ElementNode = 1, @@ -90,8 +87,6 @@ public: WEBKIT_API WebString nodeName() const; WEBKIT_API WebString nodeValue() const; WEBKIT_API bool setNodeValue(const WebString&); - // Deprecated. Use document().frame() instead. - WEBKIT_API WebFrame* frame() const; WEBKIT_API WebDocument document() const; WEBKIT_API WebNode firstChild() const; WEBKIT_API WebNode lastChild() const; @@ -102,39 +97,67 @@ public: WEBKIT_API WebString createMarkup() const; WEBKIT_API bool isTextNode() const; WEBKIT_API bool isElementNode() const; - WEBKIT_API void addEventListener(const WebString& eventType, WebEventListener* listener, bool useCapture); - WEBKIT_API void removeEventListener(const WebString& eventType, WebEventListener* listener, bool useCapture); + WEBKIT_API void addEventListener(const WebString& eventType, WebDOMEventListener* listener, bool useCapture); + WEBKIT_API void removeEventListener(const WebString& eventType, WebDOMEventListener* listener, bool useCapture); + WEBKIT_API void simulateClick(); + WEBKIT_API WebNodeList getElementsByTagName(const WebString&) const; + + // Returns true if the node has a non-empty bounding box in layout. + // This does not 100% guarantee the user can see it, but is pretty close. + // Note: This method only works properly after layout has occurred. + WEBKIT_API bool hasNonEmptyBoundingBox() const; - template<typename T> T toElement() + template<typename T> T to() { T res; res.WebNode::assign(*this); return res; } - template<typename T> const T toConstElement() const + template<typename T> const T toConst() const { T res; res.WebNode::assign(*this); return res; } -protected: - typedef WebCore::Node WebNodePrivate; - void assign(WebNodePrivate*); - WebNodePrivate* m_private; - +#if WEBKIT_IMPLEMENTATION + WebNode(const WTF::PassRefPtr<WebCore::Node>&); + WebNode& operator=(const WTF::PassRefPtr<WebCore::Node>&); + operator WTF::PassRefPtr<WebCore::Node>() const; +#endif + +#if WEBKIT_IMPLEMENTATION template<typename T> T* unwrap() { - return static_cast<T*>(m_private); + return static_cast<T*>(m_private.get()); } template<typename T> const T* constUnwrap() const { - return static_cast<const T*>(m_private); + return static_cast<const T*>(m_private.get()); } +#endif + +protected: + WebPrivatePtr<WebCore::Node> m_private; }; +inline bool operator==(const WebNode& a, const WebNode& b) +{ + return a.equals(b); +} + +inline bool operator!=(const WebNode& a, const WebNode& b) +{ + return !(a == b); +} + +inline bool operator<(const WebNode& a, const WebNode& b) +{ + return a.lessThan(b); +} + } // namespace WebKit #endif diff --git a/WebKit/chromium/public/WebNotification.h b/WebKit/chromium/public/WebNotification.h index 1a41252..89dff7a 100644 --- a/WebKit/chromium/public/WebNotification.h +++ b/WebKit/chromium/public/WebNotification.h @@ -32,6 +32,7 @@ #define WebNotification_h #include "WebCommon.h" +#include "WebTextDirection.h" #if WEBKIT_IMPLEMENTATION namespace WebCore { class Notification; } @@ -63,7 +64,7 @@ public: // Operators required to put WebNotification in an ordered map. bool equals(const WebNotification& other) const { return m_private == other.m_private; } - bool lessThan(const WebNotification& other) const; + WEBKIT_API bool lessThan(const WebNotification& other) const; // Is the notification HTML vs. icon-title-text? WEBKIT_API bool isHTML() const; @@ -71,11 +72,20 @@ public: // If HTML, the URL which contains the contents of the notification. WEBKIT_API WebURL url() const; - // If not HTML, the parameters for the icon-title-text notification. - WEBKIT_API WebString icon() const; + WEBKIT_API WebURL iconURL() const; WEBKIT_API WebString title() const; WEBKIT_API WebString body() const; + // FIXME: Remove dir() when no longer referenced. + // dir() is deprecated; use direction(). + WEBKIT_API WebString dir() const; + WEBKIT_API WebTextDirection direction() const; + + 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/WebNotificationPresenter.h b/WebKit/chromium/public/WebNotificationPresenter.h index a3764aa..9fb7e6e 100644 --- a/WebKit/chromium/public/WebNotificationPresenter.h +++ b/WebKit/chromium/public/WebNotificationPresenter.h @@ -31,13 +31,14 @@ #ifndef WebNotificationPresenter_h #define WebNotificationPresenter_h +#include "WebNotificationPermissionCallback.h" +#include "WebSecurityOrigin.h" #include "WebString.h" namespace WebKit { class WebDocument; class WebNotification; -class WebNotificationPermissionCallback; class WebURL; // Provides the services to show desktop notifications to the user. @@ -59,14 +60,13 @@ public: // being destroyed. Does _not_ remove the notification if being shown, but detaches it from receiving events. virtual void objectDestroyed(const WebNotification&) = 0; - // Checks the permission level for the given URL. If the URL is being displayed in a document - // (as opposed to a worker or other ScriptExecutionContext), |document| will also be provided. - virtual Permission checkPermission(const WebURL& url, WebDocument* document) = 0; + // Checks the permission level for the given origin. + virtual Permission checkPermission(const WebURL&) = 0; // Requests permission for a given origin. This operation is asynchronous and the callback provided // will be invoked when the permission decision is made. Callback pointer must remain // valid until called. - virtual void requestPermission(const WebString& origin, WebNotificationPermissionCallback* callback) = 0; + virtual void requestPermission(const WebSecurityOrigin&, WebNotificationPermissionCallback*) = 0; }; } // namespace WebKit diff --git a/WebKit/chromium/public/WebOptionElement.h b/WebKit/chromium/public/WebOptionElement.h new file mode 100644 index 0000000..1689a57 --- /dev/null +++ b/WebKit/chromium/public/WebOptionElement.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: + * + * * 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 WebOptionElement_h +#define WebOptionElement_h + +#include "WebFormControlElement.h" +#include "WebVector.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class HTMLOptionElement; } +#endif + +namespace WebKit { + +// Provides readonly access to some properties of a DOM option element node. +class WebOptionElement : public WebFormControlElement { +public: + WebOptionElement() : WebFormControlElement() { } + WebOptionElement(const WebOptionElement& e) : WebFormControlElement(e) { } + + WebOptionElement& operator=(const WebOptionElement& e) + { + WebFormControlElement::assign(e); + return *this; + } + WEBKIT_API void assign(const WebOptionElement& e) { WebFormControlElement::assign(e); } + + WEBKIT_API void setValue(const WebString&); + WEBKIT_API WebString value() const; + + WEBKIT_API int index() const; + WEBKIT_API WebString text() const; + WEBKIT_API bool defaultSelected() const; + WEBKIT_API void setDefaultSelected(bool); + WEBKIT_API WebString label() const; + WEBKIT_API bool isEnabled() const; + +#if WEBKIT_IMPLEMENTATION + WebOptionElement(const WTF::PassRefPtr<WebCore::HTMLOptionElement>&); + WebOptionElement& operator=(const WTF::PassRefPtr<WebCore::HTMLOptionElement>&); + operator WTF::PassRefPtr<WebCore::HTMLOptionElement>() const; +#endif +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebPasswordAutocompleteListener.h b/WebKit/chromium/public/WebPasswordAutocompleteListener.h index db6589d..fdc8476 100644 --- a/WebKit/chromium/public/WebPasswordAutocompleteListener.h +++ b/WebKit/chromium/public/WebPasswordAutocompleteListener.h @@ -49,5 +49,4 @@ public: } // namespace WebKit - #endif diff --git a/WebKit/chromium/public/WebPasswordFormData.h b/WebKit/chromium/public/WebPasswordFormData.h index e1804d1..30ce5ca 100644 --- a/WebKit/chromium/public/WebPasswordFormData.h +++ b/WebKit/chromium/public/WebPasswordFormData.h @@ -40,7 +40,7 @@ namespace WebKit { struct WebPasswordFormData { // If the provided form is suitable for password completion, isValid() will // return true; - WebPasswordFormData(const WebFormElement&); + WEBKIT_API WebPasswordFormData(const WebFormElement&); // If creation failed, return false. bool isValid() const { return action.isValid(); } diff --git a/WebKit/chromium/public/WebPlugin.h b/WebKit/chromium/public/WebPlugin.h index 5097265..816d38b 100644 --- a/WebKit/chromium/public/WebPlugin.h +++ b/WebKit/chromium/public/WebPlugin.h @@ -32,6 +32,7 @@ #define WebPlugin_h #include "WebCanvas.h" +#include "WebString.h" struct NPObject; @@ -80,6 +81,37 @@ public: virtual void didFailLoadingFrameRequest( const WebURL&, void* notifyData, const WebURLError&) = 0; + // Printing interface. + // Whether the plugin supports its own paginated print. The other print + // interface methods are called only if this method returns true. + virtual bool supportsPaginatedPrint() { return false; } + // Sets up printing at the given print rect and printer DPI. printableArea + // is in points (a point is 1/72 of an inch).Returns the number of pages to + // be printed at these settings. + virtual int printBegin(const WebRect& printableArea, int printerDPI) { return 0; } + // Prints the page specified by pageNumber (0-based index) into the supplied canvas. + virtual bool printPage(int pageNumber, WebCanvas* canvas) { return false; } + // Ends the print operation. + virtual void printEnd() { } + + virtual bool hasSelection() const { return false; } + virtual WebString selectionAsText() const { return WebString(); } + virtual WebString selectionAsMarkup() const { return WebString(); } + + // Used for zooming of full page plugins. + virtual void setZoomFactor(float scale, bool textOnly) { } + + // Find interface. + // Start a new search. The plugin should search for a little bit at a time so that it + // doesn't block the thread in case of a large document. The results, along with the + // find's identifier, should be sent asynchronously to WebFrameClient's reportFindInPage* methods. + // Returns true if the search started, or false if the plugin doesn't support search. + virtual bool startFind(const WebString& searchText, bool caseSensitive, int identifier) { return false; } + // Tells the plugin to jump forward or backward in the list of find results. + virtual void selectFindResult(bool forward) { } + // Tells the plugin that the user has stopped the find operation. + virtual void stopFind() { } + protected: ~WebPlugin() { } }; diff --git a/WebKit/chromium/public/WebPluginContainer.h b/WebKit/chromium/public/WebPluginContainer.h index 41e304e..66ef9ab 100644 --- a/WebKit/chromium/public/WebPluginContainer.h +++ b/WebKit/chromium/public/WebPluginContainer.h @@ -35,6 +35,8 @@ struct NPObject; namespace WebKit { +class WebElement; +class WebPlugin; class WebString; class WebURL; class WebURLRequest; @@ -42,6 +44,9 @@ struct WebRect; class WebPluginContainer { public: + // Returns the element containing this plugin. + virtual WebElement element() = 0; + virtual void invalidate() = 0; virtual void invalidateRect(const WebRect&) = 0; @@ -73,6 +78,9 @@ public: virtual void loadFrameRequest( const WebURLRequest&, const WebString& target, bool notifyNeeded, void* notifyData) = 0; + virtual WebPlugin* plugin() = 0; + virtual void setPlugin(WebPlugin*) = 0; + protected: ~WebPluginContainer() { } }; diff --git a/WebKit/chromium/public/WebPluginDocument.h b/WebKit/chromium/public/WebPluginDocument.h new file mode 100644 index 0000000..b772cf7 --- /dev/null +++ b/WebKit/chromium/public/WebPluginDocument.h @@ -0,0 +1,67 @@ +/* + * 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 WebPluginDocument_h +#define WebPluginDocument_h + +#include "WebDocument.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class PluginDocument; } +#endif + +namespace WebKit { +class WebPlugin; + +// Wraps a WebDocument for full page plugins. +class WebPluginDocument : public WebDocument { +public: + WebPluginDocument() { } + WebPluginDocument(const WebPluginDocument& e) : WebDocument(e) { } + + WebPluginDocument& operator=(const WebPluginDocument& e) + { + WebNode::assign(e); + return *this; + } + void assign(const WebPluginDocument& d) { WebNode::assign(d); } + + WEBKIT_API WebPlugin* plugin(); + +#if WEBKIT_IMPLEMENTATION + WebPluginDocument(const WTF::PassRefPtr<WebCore::PluginDocument>&); + WebPluginDocument& operator=(const WTF::PassRefPtr<WebCore::PluginDocument>&); + operator WTF::PassRefPtr<WebCore::PluginDocument>() const; +#endif +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebPoint.h b/WebKit/chromium/public/WebPoint.h index d1abe02..20c52c2 100644 --- a/WebKit/chromium/public/WebPoint.h +++ b/WebKit/chromium/public/WebPoint.h @@ -36,7 +36,7 @@ #if WEBKIT_IMPLEMENTATION #include "IntPoint.h" #else -#include <base/gfx/rect.h> +#include <gfx/point.h> #endif namespace WebKit { diff --git a/WebKit/chromium/public/WebPopupMenuInfo.h b/WebKit/chromium/public/WebPopupMenuInfo.h index 876842d..7cf1b63 100644 --- a/WebKit/chromium/public/WebPopupMenuInfo.h +++ b/WebKit/chromium/public/WebPopupMenuInfo.h @@ -41,8 +41,10 @@ struct WebPopupMenuInfo { // FIXME: migrate clients to WebMenuItemInfo and remove this temporary Item typedef. typedef WebMenuItemInfo Item; int itemHeight; + int itemFontSize; int selectedIndex; WebVector<WebMenuItemInfo> items; + bool rightAligned; }; } // namespace WebKit diff --git a/WebKit/chromium/src/APUAgentDelegate.h b/WebKit/chromium/public/WebPopupType.h index 70be702..8a546ba 100644 --- a/WebKit/chromium/src/APUAgentDelegate.h +++ b/WebKit/chromium/public/WebPopupType.h @@ -28,18 +28,16 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef APUAgentDelegate_h -#define APUAgentDelegate_h - -#include "DevToolsRPC.h" +#ifndef WebPopupType_h +#define WebPopupType_h namespace WebKit { -#define APU_AGENT_DELEGATE_STRUCT(METHOD0, METHOD1, METHOD2, METHOD3, MEHTOD4, METHOD5) \ - /* Sends a json object to apu. */ \ - METHOD1(dispatchToApu, String /* data */) - -DEFINE_RPC_CLASS(ApuAgentDelegate, APU_AGENT_DELEGATE_STRUCT) +enum WebPopupType { + WebPopupTypeNone, // Not a popup. + WebPopupTypeSelect, // A HTML select (combo-box) popup. + WebPopupTypeSuggestion, // An autofill/autocomplete popup. +}; } // namespace WebKit 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/WebPrivatePtr.h b/WebKit/chromium/public/WebPrivatePtr.h new file mode 100644 index 0000000..48ad7f2 --- /dev/null +++ b/WebKit/chromium/public/WebPrivatePtr.h @@ -0,0 +1,105 @@ +/* + * 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 WebPrivatePtr_h +#define WebPrivatePtr_h + +#if WEBKIT_IMPLEMENTATION +#include <wtf/PassRefPtr.h> +#endif + +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 reference counted WebCore class. +template <typename T> +class WebPrivatePtr { +public: + WebPrivatePtr() : m_ptr(0) { } + ~WebPrivatePtr() { WEBKIT_ASSERT(!m_ptr); } + + bool isNull() const { return !m_ptr; } + +#if WEBKIT_IMPLEMENTATION + WebPrivatePtr(const PassRefPtr<T>& prp) + : m_ptr(prp.releaseRef()) + { + } + + void reset() + { + assign(0); + } + + WebPrivatePtr<T>& operator=(const WebPrivatePtr<T>& other) + { + T* p = other.m_ptr; + if (p) + p->ref(); + assign(p); + return *this; + } + + WebPrivatePtr<T>& operator=(const PassRefPtr<T>& prp) + { + assign(prp.releaseRef()); + return *this; + } + + T* get() const + { + return m_ptr; + } + + T* operator->() const + { + ASSERT(m_ptr); + return m_ptr; + } +#endif + +private: +#if WEBKIT_IMPLEMENTATION + void assign(T* p) + { + // p is already ref'd for us by the caller + if (m_ptr) + m_ptr->deref(); + m_ptr = p; + } +#endif + + T* m_ptr; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebRect.h b/WebKit/chromium/public/WebRect.h index ed5a7d1..30381d7 100644 --- a/WebKit/chromium/public/WebRect.h +++ b/WebKit/chromium/public/WebRect.h @@ -36,7 +36,7 @@ #if WEBKIT_IMPLEMENTATION #include "IntRect.h" #else -#include <base/gfx/rect.h> +#include <gfx/rect.h> #endif namespace WebKit { diff --git a/WebKit/chromium/public/WebRuntimeFeatures.h b/WebKit/chromium/public/WebRuntimeFeatures.h index 04f88c9..9aa1f4f 100644 --- a/WebKit/chromium/public/WebRuntimeFeatures.h +++ b/WebKit/chromium/public/WebRuntimeFeatures.h @@ -68,6 +68,24 @@ public: WEBKIT_API static void enableIndexedDatabase(bool); WEBKIT_API static bool isIndexedDatabaseEnabled(); + WEBKIT_API static void enableWebGL(bool); + WEBKIT_API static bool isWebGLEnabled(); + + WEBKIT_API static void enablePushState(bool); + WEBKIT_API static bool isPushStateEnabled(bool); + + WEBKIT_API static void enableTouch(bool); + WEBKIT_API static bool isTouchEnabled(); + + WEBKIT_API static void enableDeviceMotion(bool); + WEBKIT_API static bool isDeviceMotionEnabled(); + + WEBKIT_API static void enableDeviceOrientation(bool); + WEBKIT_API static bool isDeviceOrientationEnabled(); + + WEBKIT_API static void enableSpeechInput(bool); + WEBKIT_API static bool isSpeechInputEnabled(); + private: WebRuntimeFeatures(); }; diff --git a/WebKit/chromium/public/WebScrollbar.h b/WebKit/chromium/public/WebScrollbar.h new file mode 100644 index 0000000..6941f4d --- /dev/null +++ b/WebKit/chromium/public/WebScrollbar.h @@ -0,0 +1,98 @@ +/* + * 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 WebScrollbar_h +#define WebScrollbar_h + +#include "WebCanvas.h" +#include "WebCommon.h" + +namespace WebKit { + +class WebInputEvent; +class WebScrollbarClient; +struct WebRect; + +class WebScrollbar { +public: + enum Orientation { + Horizontal, + Vertical + }; + + enum ScrollDirection { + ScrollBackward, + ScrollForward + }; + + enum ScrollGranularity { + ScrollByLine, + ScrollByPage, + ScrollByDocument, + ScrollByPixel + }; + + // Creates a WebScrollbar. + WEBKIT_API static WebScrollbar* create(WebScrollbarClient*, Orientation); + + virtual ~WebScrollbar() {} + + // Gets the thickness of the scrollbar in pixels. + WEBKIT_API static int defaultThickness(); + + // Sets the rectangle of the scrollbar. + virtual void setLocation(const WebRect&) = 0; + + // Gets the current value (i.e. position inside the region). + virtual int value() const = 0; + + // Sets the current value. + virtual void setValue(int position) = 0; + + // Sets the size of the scrollable region in pixels. i.e. if a document is + // 800x10000 pixels and the viewport is 1000x1000 pixels, then setLocation + // for the vertical scrollbar would have passed in a rectangle like: + // (800 - defaultThickness(), 0) (defaultThickness() x 10000) + // and setDocumentSize(10000) + virtual void setDocumentSize(int size) = 0; + + // Scroll back or forward with the given granularity. + virtual void scroll(ScrollDirection, ScrollGranularity, float multiplier) = 0; + + // Paint the given rectangle. + virtual void paint(WebCanvas*, const WebRect&) = 0; + + // Returns true iff the given event was used. + virtual bool handleInputEvent(const WebInputEvent&) = 0; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebScrollbarClient.h b/WebKit/chromium/public/WebScrollbarClient.h new file mode 100644 index 0000000..d1825c8 --- /dev/null +++ b/WebKit/chromium/public/WebScrollbarClient.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * 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 WebScrollbarClient_h +#define WebScrollbarClient_h + +namespace WebKit { + +class WebScrollbar; +struct WebRect; +template <typename T> class WebVector; + +class WebScrollbarClient { +public: + virtual void valueChanged(WebScrollbar*) = 0; + virtual void invalidateScrollbarRect(WebScrollbar*, const WebRect&) = 0; + virtual void getTickmarks(WebScrollbar*, WebVector<WebRect>*) const = 0; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebSearchableFormData.h b/WebKit/chromium/public/WebSearchableFormData.h index e453387..5cd1d9b 100644 --- a/WebKit/chromium/public/WebSearchableFormData.h +++ b/WebKit/chromium/public/WebSearchableFormData.h @@ -43,7 +43,7 @@ class WebSearchableFormData { public: // If the provided form is suitable for automated searching, isValid() // will return false. - WebSearchableFormData(const WebFormElement&); + WEBKIT_API WebSearchableFormData(const WebFormElement&); bool isValid() { return m_url.isValid(); } diff --git a/WebKit/chromium/public/WebSecurityOrigin.h b/WebKit/chromium/public/WebSecurityOrigin.h index 1285b10..efcb2e9 100644 --- a/WebKit/chromium/public/WebSecurityOrigin.h +++ b/WebKit/chromium/public/WebSecurityOrigin.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Google Inc. All rights reserved. + * 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 @@ -42,6 +42,7 @@ namespace WebKit { class WebSecurityOriginPrivate; class WebString; +class WebURL; class WebSecurityOrigin { public: @@ -55,9 +56,9 @@ public: return *this; } - // FIXME: This should return a WebSecurityOrigin, not a pointer to one. - WEBKIT_API static WebSecurityOrigin* createFromDatabaseIdentifier(const WebString& databaseIdentifier); + WEBKIT_API static WebSecurityOrigin createFromDatabaseIdentifier(const WebString& databaseIdentifier); WEBKIT_API static WebSecurityOrigin createFromString(const WebString&); + WEBKIT_API static WebSecurityOrigin create(const WebURL&); WEBKIT_API void reset(); WEBKIT_API void assign(const WebSecurityOrigin&); @@ -71,6 +72,17 @@ public: // The empty WebSecurityOrigin is the least privileged WebSecurityOrigin. WEBKIT_API bool isEmpty() const; + // Returns true if this WebSecurityOrigin can script objects in the given + // SecurityOrigin. For example, call this function before allowing + // script from one security origin to read or write objects from + // another SecurityOrigin. + WEBKIT_API bool canAccess(const WebSecurityOrigin&) const; + + // Returns true if this WebSecurityOrigin can read content retrieved from + // the given URL. For example, call this function before allowing script + // from a given security origin to receive contents from a given URL. + WEBKIT_API bool canRequest(const WebURL&) const; + // Returns a string representation of the WebSecurityOrigin. The empty // WebSecurityOrigin is represented by "null". The representation of a // non-empty WebSecurityOrigin resembles a standard URL. @@ -78,7 +90,11 @@ public: // Returns a string representation of this WebSecurityOrigin that can // be used as a file. Should be used in storage APIs only. - WEBKIT_API WebString databaseIdentifier(); + WEBKIT_API WebString databaseIdentifier() const; + + // Returns true if this WebSecurityOrigin can access usernames and + // passwords stored in password manager. + WEBKIT_API bool canAccessPasswordManager() const; #if WEBKIT_IMPLEMENTATION WebSecurityOrigin(const WTF::PassRefPtr<WebCore::SecurityOrigin>&); diff --git a/WebKit/chromium/public/WebSecurityPolicy.h b/WebKit/chromium/public/WebSecurityPolicy.h index 8e1ee52..f15dd75 100644 --- a/WebKit/chromium/public/WebSecurityPolicy.h +++ b/WebKit/chromium/public/WebSecurityPolicy.h @@ -50,11 +50,18 @@ public: // any other URL scheme. WEBKIT_API static void registerURLSchemeAsNoAccess(const WebString&); + // Registers a URL scheme to not generate mixed content warnings when + // included by an HTTPS page. + WEBKIT_API static void registerURLSchemeAsSecure(const WebString&); + // Support for whitelisting access to origins beyond the same-origin policy. - WEBKIT_API static void whiteListAccessFromOrigin( + WEBKIT_API static void addOriginAccessWhitelistEntry( + const WebURL& sourceOrigin, const WebString& destinationProtocol, + const WebString& destinationHost, bool allowDestinationSubdomains); + WEBKIT_API static void removeOriginAccessWhitelistEntry( const WebURL& sourceOrigin, const WebString& destinationProtocol, const WebString& destinationHost, bool allowDestinationSubdomains); - WEBKIT_API static void resetOriginAccessWhiteLists(); + WEBKIT_API static void resetOriginAccessWhitelists(); // Returns whether the url should be allowed to see the referrer // based on their respective protocols. diff --git a/WebKit/chromium/public/WebSelectElement.h b/WebKit/chromium/public/WebSelectElement.h new file mode 100644 index 0000000..3e7f5e2 --- /dev/null +++ b/WebKit/chromium/public/WebSelectElement.h @@ -0,0 +1,70 @@ +/* + * 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 WebSelectElement_h +#define WebSelectElement_h + +#include "WebFormControlElement.h" +#include "WebOptionElement.h" +#include "WebVector.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class HTMLSelectElement; } +#endif + +namespace WebKit { + +// Provides readonly access to some properties of a DOM select element node. +class WebSelectElement : public WebFormControlElement { +public: + WebSelectElement() : WebFormControlElement() { } + WebSelectElement(const WebSelectElement& e) : WebFormControlElement(e) { } + + WebSelectElement& operator=(const WebSelectElement& e) + { + WebFormControlElement::assign(e); + return *this; + } + WEBKIT_API void assign(const WebSelectElement& e) { WebFormControlElement::assign(e); } + + WEBKIT_API void setValue(const WebString&); + WEBKIT_API WebString value(); + WEBKIT_API WebVector<WebElement> listItems(); + +#if WEBKIT_IMPLEMENTATION + WebSelectElement(const WTF::PassRefPtr<WebCore::HTMLSelectElement>&); + WebSelectElement& operator=(const WTF::PassRefPtr<WebCore::HTMLSelectElement>&); + operator WTF::PassRefPtr<WebCore::HTMLSelectElement>() const; +#endif +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebSerializedScriptValue.h b/WebKit/chromium/public/WebSerializedScriptValue.h new file mode 100644 index 0000000..96e6d5b --- /dev/null +++ b/WebKit/chromium/public/WebSerializedScriptValue.h @@ -0,0 +1,79 @@ +/* + * 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 WebSerializedScriptValue_h +#define WebSerializedScriptValue_h + +#include "WebCommon.h" +#include "WebPrivatePtr.h" + +namespace WebCore { class SerializedScriptValue; } + +namespace WebKit { +class WebString; + +class WebSerializedScriptValue { +public: + ~WebSerializedScriptValue() { reset(); } + + WebSerializedScriptValue() { } + WebSerializedScriptValue(const WebSerializedScriptValue& d) { assign(d); } + WebSerializedScriptValue& operator=(const WebSerializedScriptValue& d) + { + assign(d); + return *this; + } + + WEBKIT_API static WebSerializedScriptValue fromString(const WebString&); + + // Create a WebSerializedScriptValue that represents a serialization error. + WEBKIT_API static WebSerializedScriptValue createInvalid(); + + WEBKIT_API void reset(); + WEBKIT_API void assign(const WebSerializedScriptValue&); + + bool isNull() const { return m_private.isNull(); } + + // Returns a string representation of the WebSerializedScriptValue. + WEBKIT_API WebString toString() const; + +#if WEBKIT_IMPLEMENTATION + WebSerializedScriptValue(const WTF::PassRefPtr<WebCore::SerializedScriptValue>&); + WebSerializedScriptValue& operator=(const WTF::PassRefPtr<WebCore::SerializedScriptValue>&); + operator WTF::PassRefPtr<WebCore::SerializedScriptValue>() const; +#endif + +private: + WebPrivatePtr<WebCore::SerializedScriptValue> m_private; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebSettings.h b/WebKit/chromium/public/WebSettings.h index d75ccde..0bef045 100644 --- a/WebKit/chromium/public/WebSettings.h +++ b/WebKit/chromium/public/WebSettings.h @@ -43,6 +43,11 @@ class WebURL; // these functions have a 1:1 mapping with the methods in WebCore/page/settings.h. class WebSettings { public: + enum EditingBehavior { + EditingBehaviorMac, + EditingBehaviorWin + }; + virtual void setStandardFontFamily(const WebString&) = 0; virtual void setFixedFontFamily(const WebString&) = 0; virtual void setSerifFontFamily(const WebString&) = 0; @@ -69,19 +74,25 @@ public: virtual void setJavaEnabled(bool) = 0; virtual void setAllowScriptsToCloseWindows(bool) = 0; virtual void setUserStyleSheetLocation(const WebURL&) = 0; + virtual void setAuthorAndUserStylesEnabled(bool) = 0; virtual void setUsesPageCache(bool) = 0; virtual void setDownloadableBinaryFontsEnabled(bool) = 0; + virtual void setJavaScriptCanAccessClipboard(bool) = 0; virtual void setXSSAuditorEnabled(bool) = 0; virtual void setLocalStorageEnabled(bool) = 0; virtual void setEditableLinkBehaviorNeverLive() = 0; virtual void setFontRenderingModeNormal() = 0; virtual void setShouldPaintCustomScrollbars(bool) = 0; - virtual void setDatabasesEnabled(bool) = 0; virtual void setAllowUniversalAccessFromFileURLs(bool) = 0; + virtual void setAllowFileAccessFromFileURLs(bool) = 0; virtual void setTextDirectionSubmenuInclusionBehaviorNeverIncluded() = 0; virtual void setOfflineWebApplicationCacheEnabled(bool) = 0; virtual void setExperimentalWebGLEnabled(bool) = 0; - virtual void setGeolocationEnabled(bool) = 0; + virtual void setShowDebugBorders(bool) = 0; + virtual void setEditingBehavior(EditingBehavior) = 0; + virtual void setAcceleratedCompositingEnabled(bool) = 0; + virtual void setAccelerated2dCanvasEnabled(bool) = 0; + virtual void setMemoryInfoEnabled(bool) = 0; protected: ~WebSettings() { } diff --git a/WebKit/chromium/public/WebSharedWorker.h b/WebKit/chromium/public/WebSharedWorker.h index 4ac7639..9492a4f 100644 --- a/WebKit/chromium/public/WebSharedWorker.h +++ b/WebKit/chromium/public/WebSharedWorker.h @@ -60,7 +60,9 @@ public: virtual void startWorkerContext(const WebURL& scriptURL, const WebString& name, const WebString& userAgent, - const WebString& sourceCode) = 0; + const WebString& sourceCode, + long long scriptResourceAppCacheID) = 0; + class ConnectListener { public: // Invoked once the connect event has been sent so the caller can free this object. diff --git a/WebKit/chromium/public/WebSize.h b/WebKit/chromium/public/WebSize.h index bb88633..a7159b2 100644 --- a/WebKit/chromium/public/WebSize.h +++ b/WebKit/chromium/public/WebSize.h @@ -36,7 +36,7 @@ #if WEBKIT_IMPLEMENTATION #include "IntSize.h" #else -#include <base/gfx/rect.h> +#include <gfx/size.h> #endif namespace WebKit { diff --git a/WebKit/chromium/public/WebSpeechInputController.h b/WebKit/chromium/public/WebSpeechInputController.h new file mode 100644 index 0000000..0315722 --- /dev/null +++ b/WebKit/chromium/public/WebSpeechInputController.h @@ -0,0 +1,74 @@ +/* + * 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 WebSpeechInputController_h +#define WebSpeechInputController_h + +#include "WebCommon.h" + +namespace WebKit { + +struct WebRect; + +// Provides an embedder API called by WebKit. +class WebSpeechInputController { +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 requestId, const WebRect&) + { + return startRecognition(requestId); + } + // FIXME: Remove this once chromium has picked up this change. + virtual bool startRecognition(int) + { + 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) { WEBKIT_ASSERT_NOT_REACHED(); } + + // Stops audio recording and performs recognition with the audio recorded until now + // (does not discard audio). This is an optional call and is typically invoked if the user + // 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) { WEBKIT_ASSERT_NOT_REACHED(); } + +protected: + virtual ~WebSpeechInputController() { } +}; + +} // namespace WebKit + +#endif // WebSpeechInputController_h diff --git a/WebKit/chromium/src/ProfilerAgentImpl.h b/WebKit/chromium/public/WebSpeechInputControllerMock.h index d38f57c..9a26235 100644 --- a/WebKit/chromium/src/ProfilerAgentImpl.h +++ b/WebKit/chromium/public/WebSpeechInputControllerMock.h @@ -28,28 +28,23 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef ProfilerAgentImpl_h -#define ProfilerAgentImpl_h +#ifndef WebSpeechInputControllerMock_h +#define WebSpeechInputControllerMock_h -#include "ProfilerAgent.h" +#include "WebSpeechInputController.h" namespace WebKit { -class ProfilerAgentImpl : public ProfilerAgent { -public: - ProfilerAgentImpl(ProfilerAgentDelegate* delegate) : m_delegate(delegate) { } - virtual ~ProfilerAgentImpl() { } - - // ProfilerAgent implementation. +class WebString; +class WebSpeechInputListener; - // This method is called on IO thread. - virtual void getActiveProfilerModules(); - - // This method is called on IO thread. - virtual void getLogLines(int position); +class WebSpeechInputControllerMock : public WebSpeechInputController { +public: + WEBKIT_API static WebSpeechInputControllerMock* create( + WebSpeechInputListener* listener); + virtual ~WebSpeechInputControllerMock() { } -private: - ProfilerAgentDelegate* m_delegate; + virtual void setMockRecognitionResult(const WebString& result) = 0; }; } // namespace WebKit diff --git a/WebKit/chromium/public/WebSpeechInputListener.h b/WebKit/chromium/public/WebSpeechInputListener.h new file mode 100644 index 0000000..6dc3d49 --- /dev/null +++ b/WebKit/chromium/public/WebSpeechInputListener.h @@ -0,0 +1,70 @@ +/* + * 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 WebSpeechInputListener_h +#define WebSpeechInputListener_h + +namespace WebKit { + +class WebString; + +// Provides a WebKit API called by the embedder. +// A typical sequence of calls to the listener would be +// 1 call to didCompleteRecording +// 0 or more calls to setRecognitionResult +// 1 call to didCompleteRecognition +class WebSpeechInputListener { +public: + // Informs that audio recording has completed and recognition is underway. This gets invoked + // irrespective of whether recording was stopped automatically by the 'endpointer' or if + // WebSpeechInputController::stopRecording() was called. + // Typically after this call the listener would update the UI to reflect that recognition is + // in progress. + virtual void didCompleteRecording(int) = 0; + + // 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(int, const WebString&) = 0; + + // 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(int) = 0; + +protected: + ~WebSpeechInputListener() { } +}; + +} // namespace WebKit + +#endif // WebSpeechInputListener_h diff --git a/WebKit/chromium/public/WebStorageArea.h b/WebKit/chromium/public/WebStorageArea.h index 5e2c11c..86f708c 100644 --- a/WebKit/chromium/public/WebStorageArea.h +++ b/WebKit/chromium/public/WebStorageArea.h @@ -36,6 +36,7 @@ namespace WebKit { +class WebFrame; class WebURL; // In WebCore, there's one distinct StorageArea per origin per StorageNamespace. This @@ -66,18 +67,14 @@ public: // Set the value that corresponds to a specific key. Result will either be ResultOK // or some particular error. The value is NOT set when there's an error. url is the // url that should be used if a storage event fires. - virtual void setItem(const WebString& key, const WebString& newValue, const WebURL& url, Result& result, WebString& oldValue) + virtual void setItem(const WebString& key, const WebString& newValue, const WebURL& url, Result& result, WebString& oldValue, WebFrame*) { - bool quotaException = false; - setItem(key, newValue, url, quotaException, oldValue); - result = quotaException ? ResultBlockedByQuota : ResultOK; + setItem(key, newValue, url, result, oldValue); } // FIXME: Remove soon (once Chrome has rolled past this revision). - virtual void setItem(const WebString& key, const WebString& newValue, const WebURL& url, bool& quotaException, WebString& oldValue) + virtual void setItem(const WebString& key, const WebString& newValue, const WebURL& url, Result& result, WebString& oldValue) { - Result result; - setItem(key, newValue, url, result, oldValue); - quotaException = result != ResultOK; + setItem(key, newValue, url, result, oldValue, 0); } // Remove the value associated with a particular key. url is the url that should be used diff --git a/WebKit/chromium/public/WebStorageEventDispatcher.h b/WebKit/chromium/public/WebStorageEventDispatcher.h index 57750e8..37ceb7c 100644 --- a/WebKit/chromium/public/WebStorageEventDispatcher.h +++ b/WebKit/chromium/public/WebStorageEventDispatcher.h @@ -41,7 +41,7 @@ class WebURL; // FIXME: Make this (or something) work for SessionStorage! class WebStorageEventDispatcher { public: - static WebStorageEventDispatcher* create(); + WEBKIT_API static WebStorageEventDispatcher* create(); virtual ~WebStorageEventDispatcher() { } diff --git a/WebKit/chromium/public/WebStorageNamespace.h b/WebKit/chromium/public/WebStorageNamespace.h index da92a77..51d4e0b 100644 --- a/WebKit/chromium/public/WebStorageNamespace.h +++ b/WebKit/chromium/public/WebStorageNamespace.h @@ -48,7 +48,15 @@ public: // If path is empty, data will not persist. You should call delete on the returned // object when you're finished. WEBKIT_API static WebStorageNamespace* createLocalStorageNamespace(const WebString& backingDirectoryPath, unsigned quota); - WEBKIT_API static WebStorageNamespace* createSessionStorageNamespace(); + WEBKIT_API static WebStorageNamespace* createSessionStorageNamespace(unsigned quota); + + // The quota for each storage area. Suggested by the spec. + static const unsigned m_localStorageQuota = 5 * 1024 * 1024; + + // Since SessionStorage memory is allocated in the browser process, we place a + // per-origin quota on it. Like LocalStorage there are known attacks against + // this, so it's more of a sanity check than a real security measure. + static const unsigned m_sessionStorageQuota = 5 * 1024 * 1024; static const unsigned noQuota = UINT_MAX; diff --git a/WebKit/chromium/public/WebString.h b/WebKit/chromium/public/WebString.h index d2cf9ea..4d5e502 100644 --- a/WebKit/chromium/public/WebString.h +++ b/WebKit/chromium/public/WebString.h @@ -34,10 +34,7 @@ #include "WebCommon.h" #if WEBKIT_IMPLEMENTATION -namespace WebCore { -class String; -class AtomicString; -} +#include <wtf/Forward.h> #else #include <base/nullable_string16.h> #include <base/string16.h> @@ -102,13 +99,13 @@ public: } #if WEBKIT_IMPLEMENTATION - WebString(const WebCore::String&); - WebString& operator=(const WebCore::String&); - operator WebCore::String() const; + WebString(const WTF::String&); + WebString& operator=(const WTF::String&); + operator WTF::String() const; - WebString(const WebCore::AtomicString&); - WebString& operator=(const WebCore::AtomicString&); - operator WebCore::AtomicString() const; + WebString(const WTF::AtomicString&); + WebString& operator=(const WTF::AtomicString&); + operator WTF::AtomicString() const; #else WebString(const string16& s) : m_private(0) @@ -131,7 +128,7 @@ public: WebString(const NullableString16& s) : m_private(0) { if (s.is_null()) - assign(0); + reset(); else assign(s.string().data(), s.string().length()); } @@ -139,7 +136,7 @@ public: WebString& operator=(const NullableString16& s) { if (s.is_null()) - assign(0); + reset(); else assign(s.string().data(), s.string().length()); return *this; diff --git a/WebKit/chromium/public/WebTextInputType.h b/WebKit/chromium/public/WebTextInputType.h new file mode 100644 index 0000000..2592f6f --- /dev/null +++ b/WebKit/chromium/public/WebTextInputType.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebTextInputType_h +#define WebTextInputType_h + +namespace WebKit { + +enum WebTextInputType { + // Input caret is not in an editable node, no input method shall be used. + WebTextInputTypeNone, + + // Input caret is in a normal editable node, any input method can be used. + WebTextInputTypeText, + + // Input caret is in a password box, an input method may be used only if + // it's suitable for password input. + WebTextInputTypePassword, + + // FIXME: Add more text input types when necessary, eg. Number, + // Date, Email, URL, etc. +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebTextRun.h b/WebKit/chromium/public/WebTextRun.h new file mode 100644 index 0000000..cb1373a --- /dev/null +++ b/WebKit/chromium/public/WebTextRun.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: + * + * * 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 WebTextRun_h +#define WebTextRun_h + +#include "WebString.h" + +#ifdef WEBKIT_IMPLEMENTATION +namespace WebCore { class TextRun; } +#endif + +namespace WebKit { + +struct WebTextRun { + WebTextRun(const WebString& t, bool isRTL, bool hasDirectionalOverride) + : text(t) + , rtl(isRTL) + , directionalOverride(hasDirectionalOverride) + { + } + WebTextRun() + : rtl(false) + , directionalOverride(false) + { + } + + WebString text; + bool rtl; + bool directionalOverride; + +#ifdef WEBKIT_IMPLEMENTATION + // The resulting WebCore::TextRun will refer to the text in this + // struct, so "this" must outlive the WebCore text run. + operator WebCore::TextRun() const; +#endif +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/win/WebThemeEngine.h b/WebKit/chromium/public/WebThemeEngine.h index b563608..ab59fa2 100644 --- a/WebKit/chromium/public/win/WebThemeEngine.h +++ b/WebKit/chromium/public/WebThemeEngine.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Google Inc. All rights reserved. + * 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 @@ -31,21 +31,23 @@ #ifndef WebThemeEngine_h #define WebThemeEngine_h -#include "../WebCanvas.h" -#include "../WebColor.h" +#include "WebCanvas.h" +#include "WebColor.h" namespace WebKit { struct WebRect; +struct WebSize; +class WebThemeEngine { +public: +#ifdef WIN32 // The part and state parameters correspond to values defined by the // Windows Theme API (see // http://msdn.microsoft.com/en-us/library/bb773187(VS.85).aspx ). // The classicState parameter corresponds to the uState // parameter of the Windows DrawFrameControl() function. // See the definitions in <vsstyle.h> and <winuser.h>. -class WebThemeEngine { -public: virtual void paintButton( WebCanvas*, int part, int state, int classicState, const WebRect&) = 0; @@ -66,6 +68,10 @@ public: WebCanvas*, int part, int state, int classicState, const WebRect&, const WebRect& alignRect) = 0; + virtual void paintSpinButton( + WebCanvas*, int part, int state, int classicState, + const WebRect&) {} + virtual void paintTextField( WebCanvas*, int part, int state, int classicState, const WebRect&, WebColor, bool fillContentArea, bool drawEdges) = 0; @@ -73,6 +79,12 @@ public: virtual void paintTrackbar( WebCanvas*, int part, int state, int classicState, const WebRect&) = 0; + + virtual void paintProgressBar( + WebCanvas*, const WebRect& barRect, const WebRect& valueRect, + bool determinate, double animatedSeconds) {} + +#endif }; } // namespace WebKit diff --git a/WebKit/chromium/public/WebTouchPoint.h b/WebKit/chromium/public/WebTouchPoint.h new file mode 100644 index 0000000..ddfa26f --- /dev/null +++ b/WebKit/chromium/public/WebTouchPoint.h @@ -0,0 +1,62 @@ +/* + * 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 WebTouchPoint_h +#define WebTouchPoint_h + +#include "WebCommon.h" +#include "WebPoint.h" + +namespace WebKit { + +class WebTouchPoint { +public: + WebTouchPoint() + : id(0) + , state(StateUndefined) { } + + enum State { + StateUndefined, + StateReleased, + StatePressed, + StateMoved, + StateStationary, + StateCancelled, + }; + + int id; + State state; + WebPoint screenPosition; + WebPoint position; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebURL.h b/WebKit/chromium/public/WebURL.h index 78a16a8..bb90e32 100644 --- a/WebKit/chromium/public/WebURL.h +++ b/WebKit/chromium/public/WebURL.h @@ -138,6 +138,11 @@ private: bool m_isValid; }; +inline bool operator<(const WebURL& a, const WebURL& b) +{ + return a.spec() < b.spec(); +} + } // namespace WebKit #endif diff --git a/WebKit/chromium/public/WebURLLoadTiming.h b/WebKit/chromium/public/WebURLLoadTiming.h new file mode 100644 index 0000000..9412d14 --- /dev/null +++ b/WebKit/chromium/public/WebURLLoadTiming.h @@ -0,0 +1,108 @@ +/* + * 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 WebURLLoadTiming_h +#define WebURLLoadTiming_h + +#include "WebCommon.h" +#include "WebPrivatePtr.h" + +namespace WebCore { class ResourceLoadTiming; } + +namespace WebKit { +class WebString; + +class WebURLLoadTiming { +public: + ~WebURLLoadTiming() { reset(); } + + WebURLLoadTiming() { } + WebURLLoadTiming(const WebURLLoadTiming& d) { assign(d); } + WebURLLoadTiming& operator=(const WebURLLoadTiming& d) + { + assign(d); + return *this; + } + + WEBKIT_API void initialize(); + WEBKIT_API void reset(); + WEBKIT_API void assign(const WebURLLoadTiming&); + + bool isNull() const { return m_private.isNull(); } + + WEBKIT_API double requestTime() const; + WEBKIT_API void setRequestTime(double time); + + WEBKIT_API int proxyStart() const; + WEBKIT_API void setProxyStart(int start); + + WEBKIT_API int proxyEnd() const; + WEBKIT_API void setProxyEnd(int end); + + WEBKIT_API int dnsStart() const; + WEBKIT_API void setDNSStart(int start); + + WEBKIT_API int dnsEnd() const; + WEBKIT_API void setDNSEnd(int end); + + WEBKIT_API int connectStart() const; + WEBKIT_API void setConnectStart(int start); + + WEBKIT_API int connectEnd() const; + WEBKIT_API void setConnectEnd(int end); + + WEBKIT_API int sendStart() const; + WEBKIT_API void setSendStart(int start); + + WEBKIT_API int sendEnd() const; + WEBKIT_API void setSendEnd(int end); + + WEBKIT_API int receiveHeadersEnd() const; + WEBKIT_API void setReceiveHeadersEnd(int end); + + WEBKIT_API int sslStart() const; + WEBKIT_API void setSSLStart(int start); + + WEBKIT_API int sslEnd() const; + WEBKIT_API void setSSLEnd(int end); + +#if WEBKIT_IMPLEMENTATION + WebURLLoadTiming(const WTF::PassRefPtr<WebCore::ResourceLoadTiming>&); + WebURLLoadTiming& operator=(const WTF::PassRefPtr<WebCore::ResourceLoadTiming>&); + operator WTF::PassRefPtr<WebCore::ResourceLoadTiming>() const; +#endif + +private: + WebPrivatePtr<WebCore::ResourceLoadTiming> m_private; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebURLLoaderClient.h b/WebKit/chromium/public/WebURLLoaderClient.h index 03b2c54..c716e5d 100644 --- a/WebKit/chromium/public/WebURLLoaderClient.h +++ b/WebKit/chromium/public/WebURLLoaderClient.h @@ -43,24 +43,31 @@ public: // Called when following a redirect. |newRequest| contains the request // generated by the redirect. The client may modify |newRequest|. virtual void willSendRequest( - WebURLLoader*, WebURLRequest& newRequest, const WebURLResponse& redirectResponse) = 0; + WebURLLoader*, WebURLRequest& newRequest, const WebURLResponse& redirectResponse) { } // Called to report upload progress. The bytes reported correspond to // the HTTP message body. virtual void didSendData( - WebURLLoader*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent) = 0; + WebURLLoader*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent) { } // Called when response headers are received. - virtual void didReceiveResponse(WebURLLoader*, const WebURLResponse&) = 0; + virtual void didReceiveResponse(WebURLLoader*, const WebURLResponse&) { } + + // Called when a chunk of response data is downloaded. This is only called + // if WebURLRequest's downloadToFile flag was set to true. + virtual void didDownloadData(WebURLLoader*, int dataLength) { } // Called when a chunk of response data is received. - virtual void didReceiveData(WebURLLoader*, const char* data, int dataLength) = 0; + virtual void didReceiveData(WebURLLoader*, const char* data, int dataLength) { } + + // Called when a chunk of renderer-generated metadata is received from the cache. + virtual void didReceiveCachedMetadata(WebURLLoader*, const char* data, int dataLength) { } // Called when the load completes successfully. - virtual void didFinishLoading(WebURLLoader*) = 0; + virtual void didFinishLoading(WebURLLoader*) { } // Called when the load completes with an error. - virtual void didFail(WebURLLoader*, const WebURLError&) = 0; + virtual void didFail(WebURLLoader*, const WebURLError&) { } protected: ~WebURLLoaderClient() { } diff --git a/WebKit/chromium/public/WebURLRequest.h b/WebKit/chromium/public/WebURLRequest.h index 41443b4..36d6791 100644 --- a/WebKit/chromium/public/WebURLRequest.h +++ b/WebKit/chromium/public/WebURLRequest.h @@ -67,7 +67,10 @@ public: TargetIsFontResource = 5, TargetIsImage = 6, TargetIsObject = 7, - TargetIsMedia = 8 + TargetIsMedia = 8, + TargetIsWorker = 9, + TargetIsSharedWorker = 10, + TargetIsPrefetch = 11, }; ~WebURLRequest() { reset(); } @@ -127,6 +130,10 @@ public: WEBKIT_API bool reportUploadProgress() const; WEBKIT_API void setReportUploadProgress(bool); + // Controls whether load timing info is collected for the request. + WEBKIT_API bool reportLoadTiming() const; + WEBKIT_API void setReportLoadTiming(bool); + WEBKIT_API TargetType targetType() const; WEBKIT_API void setTargetType(TargetType); @@ -144,6 +151,11 @@ public: WEBKIT_API int appCacheHostID() const; WEBKIT_API void setAppCacheHostID(int id); + // If true, the response body will be downloaded to a file managed by the + // WebURLLoader. See WebURLResponse::downloadedFilePath. + WEBKIT_API bool downloadToFile() const; + WEBKIT_API void setDownloadToFile(bool); + #if defined(WEBKIT_IMPLEMENTATION) WebCore::ResourceRequest& toMutableResourceRequest(); const WebCore::ResourceRequest& toResourceRequest() const; diff --git a/WebKit/chromium/public/WebURLResponse.h b/WebKit/chromium/public/WebURLResponse.h index 1dac069..ac75d4c 100644 --- a/WebKit/chromium/public/WebURLResponse.h +++ b/WebKit/chromium/public/WebURLResponse.h @@ -43,6 +43,7 @@ class WebCString; class WebHTTPHeaderVisitor; class WebString; class WebURL; +class WebURLLoadTiming; class WebURLResponsePrivate; class WebURLResponse { @@ -72,6 +73,18 @@ public: WEBKIT_API WebURL url() const; WEBKIT_API void setURL(const WebURL&); + WEBKIT_API unsigned connectionID() const; + WEBKIT_API void setConnectionID(unsigned); + + WEBKIT_API bool connectionReused() const; + WEBKIT_API void setConnectionReused(bool); + + WEBKIT_API WebURLLoadTiming loadTiming(); + WEBKIT_API void setLoadTiming(const WebURLLoadTiming&); + + WEBKIT_API double responseTime() const; + WEBKIT_API void setResponseTime(double); + WEBKIT_API WebString mimeType() const; WEBKIT_API void setMIMEType(const WebString&); @@ -118,11 +131,39 @@ public: const WebCore::ResourceResponse& toResourceResponse() const; #endif + // Flag whether this request was served from the disk cache entry. + WEBKIT_API bool wasCached() const; + WEBKIT_API void setWasCached(bool); + // Flag whether this request was loaded via the SPDY protocol or not. // SPDY is an experimental web protocol, see http://dev.chromium.org/spdy WEBKIT_API bool wasFetchedViaSPDY() const; WEBKIT_API void setWasFetchedViaSPDY(bool); + // Flag whether this request was loaded after the TLS/Next-Protocol-Negotiation was used. + // This is related to SPDY. + WEBKIT_API bool wasNpnNegotiated() const; + WEBKIT_API void setWasNpnNegotiated(bool); + + // Flag whether this request was made when "Alternate-Protocol: xxx" + // is present in server's response. + WEBKIT_API bool wasAlternateProtocolAvailable() const; + WEBKIT_API void setWasAlternateProtocolAvailable(bool); + + // Flag whether this request was loaded via an explicit proxy (HTTP, SOCKS, etc). + WEBKIT_API bool wasFetchedViaProxy() const; + WEBKIT_API void setWasFetchedViaProxy(bool); + + // Flag whether this request is part of a multipart response. + WEBKIT_API bool isMultipartPayload() const; + WEBKIT_API void setIsMultipartPayload(bool); + + // This indicates the location of a downloaded response if the + // WebURLRequest had the downloadToFile flag set to true. This file path + // remains valid for the lifetime of the WebURLLoader used to create it. + WEBKIT_API WebString downloadFilePath() const; + WEBKIT_API void setDownloadFilePath(const WebString&); + protected: void assign(WebURLResponsePrivate*); diff --git a/WebKit/chromium/public/WebVideoFrame.h b/WebKit/chromium/public/WebVideoFrame.h new file mode 100644 index 0000000..5e34f2a --- /dev/null +++ b/WebKit/chromium/public/WebVideoFrame.h @@ -0,0 +1,73 @@ +/* + * 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 WebVideoFrame_h +#define WebVideoFrame_h + +namespace WebKit { + +// A proxy video frame interface to communicate frame data between chromium +// and WebKit. +class WebVideoFrame { +public: + enum Format { + FormatInvalid, + FormatRGB555, + FormatRGB565, + FormatRGB24, + FormatRGB32, + FormatRGBA, + FormatYV12, + FormatYV16, + FormatNV12, + FormatEmpty, + FormatASCII, + }; + + enum SurfaceType { + SurfaceTypeSystemMemory, + SurfaceTypeOMXBufferHead, + SurfaceTypeEGLImage, + SurfaceTypeMFBuffer, + SurfaceTypeDirect3DSurface + }; + + virtual SurfaceType surfaceType() const = 0; + virtual Format format() const = 0; + virtual unsigned width() const = 0; + virtual unsigned height() const = 0; + virtual unsigned planes() const = 0; + virtual int stride(unsigned plane) const = 0; + virtual const void* data(unsigned plane) const = 0; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebView.h b/WebKit/chromium/public/WebView.h index 99125d4..1b94da2 100644 --- a/WebKit/chromium/public/WebView.h +++ b/WebKit/chromium/public/WebView.h @@ -32,31 +32,46 @@ #define WebView_h #include "WebDragOperation.h" +#include "WebString.h" +#include "WebVector.h" #include "WebWidget.h" namespace WebKit { class WebAccessibilityObject; class WebDevToolsAgent; +class WebDevToolsAgentClient; class WebDragData; class WebFrame; class WebFrameClient; +class WebGLES2Context; class WebNode; class WebSettings; class WebString; class WebViewClient; struct WebMediaPlayerAction; struct WebPoint; -template <typename T> class WebVector; class WebView : public WebWidget { public: + // Controls the time that user scripts injected into the document run. + enum UserScriptInjectAt { + UserScriptInjectAtDocumentStart, + UserScriptInjectAtDocumentEnd + }; + + // Controls which frames user content is injected into. + enum UserContentInjectIn { + UserContentInjectInAllFrames, + UserContentInjectInTopFrameOnly + }; + // Initialization ------------------------------------------------------ // Creates a WebView that is NOT yet initialized. You will need to // call initializeMainFrame to finish the initialization. It is valid - // to pass a null WebViewClient pointer. - WEBKIT_API static WebView* create(WebViewClient*); + // to pass null WebViewClient and WebDevToolsAgentClient pointers. + WEBKIT_API static WebView* create(WebViewClient*, WebDevToolsAgentClient*); // After creating a WebView, you should immediately call this method. // You can optionally modify the settings before calling this method. @@ -169,6 +184,11 @@ public: const WebPoint& clientPoint, const WebPoint& screenPoint, WebDragOperation operation) = 0; + // Notifies the WebView that a drag is going on. + virtual void dragSourceMovedTo( + const WebPoint& clientPoint, const WebPoint& screenPoint, + WebDragOperation operation) = 0; + // Notfies the WebView that the system drag and drop operation has ended. virtual void dragSourceSystemDragEnded() = 0; @@ -210,11 +230,14 @@ public: // Settings used by the inspector. virtual WebString inspectorSettings() const = 0; virtual void setInspectorSettings(const WebString&) = 0; + virtual bool inspectorSetting(const WebString& key, + WebString* value) const = 0; + virtual void setInspectorSetting(const WebString& key, + const WebString& value) = 0; // The embedder may optionally engage a WebDevToolsAgent. This may only // be set once per WebView. virtual WebDevToolsAgent* devToolsAgent() = 0; - virtual void setDevToolsAgent(WebDevToolsAgent*) = 0; // Accessibility ------------------------------------------------------- @@ -223,34 +246,37 @@ public: virtual WebAccessibilityObject accessibilityObject() = 0; - // AutoFill / Autocomplete --------------------------------------------- + // AutoFill ----------------------------------------------------------- - // DEPRECATED: WebView::applyAutocompleteSuggestions is the new way to - // access this. - virtual void applyAutofillSuggestions( + // DEPRECATED. + virtual void applyAutoFillSuggestions( const WebNode&, - const WebVector<WebString>& suggestions, - int defaultSuggestionIndex) = 0; + const WebVector<WebString>& names, + const WebVector<WebString>& labels, + const WebVector<int>& uniqueIDs, + int separatorIndex) = 0; // Notifies the WebView that AutoFill suggestions are available for a node. + // |uniqueIDs| is a vector of IDs that represent the unique ID of each + // AutoFill profile in the suggestions popup. virtual void applyAutoFillSuggestions( const WebNode&, const WebVector<WebString>& names, const WebVector<WebString>& labels, - int defaultSuggestionIndex) = 0; + const WebVector<WebString>& icons, + const WebVector<int>& uniqueIDs, + int separatorIndex) = 0; // Notifies the WebView that Autocomplete suggestions are available for a // node. + // DEPRECATED: merging with applyAutoFillSuggestions. virtual void applyAutocompleteSuggestions( const WebNode&, const WebVector<WebString>& suggestions, int defaultSuggestionIndex) = 0; - // DEPRECATED: WebView::hideSuggestionsPopup is the new way to access this. - virtual void hideAutofillPopup() = 0; - - // Hides the suggestions popup if any are showing. - virtual void hideSuggestionsPopup() = 0; + // Hides any popup (suggestions, selects...) that might be showing. + virtual void hidePopups() = 0; // Context menu -------------------------------------------------------- @@ -281,9 +307,26 @@ public: unsigned inactiveForegroundColor) = 0; // User scripts -------------------------------------------------------- - virtual void addUserScript(const WebString& sourceCode, - bool runAtStart) = 0; - virtual void removeAllUserContent() = 0; + // FIXME: These two methods are DEPRECATED. Remove once Chromium has been rolled. + virtual void addUserScript(const WebString& sourceCode, bool runAtStart) + { + addUserScript(sourceCode, WebVector<WebString>(), + runAtStart ? UserScriptInjectAtDocumentStart : UserScriptInjectAtDocumentEnd, + UserContentInjectInAllFrames); + } + virtual void addUserStyleSheet(const WebString& sourceCode) + { + addUserStyleSheet(sourceCode, WebVector<WebString>(), UserContentInjectInAllFrames); + } + + WEBKIT_API static void addUserScript(const WebString& sourceCode, + const WebVector<WebString>& patterns, + UserScriptInjectAt injectAt, + UserContentInjectIn injectIn); + WEBKIT_API static void addUserStyleSheet(const WebString& sourceCode, + const WebVector<WebString>& patterns, + UserContentInjectIn injectIn); + WEBKIT_API static void removeAllUserContent(); // Modal dialog support ------------------------------------------------ @@ -292,6 +335,12 @@ public: WEBKIT_API static void willEnterModalLoop(); WEBKIT_API static void didExitModalLoop(); + // GPU acceleration support -------------------------------------------- + + // Returns the GLES2Context associated with this WebView. One will be + // created if it doesn't already exist. + virtual WebGLES2Context* gles2Context() = 0; + protected: ~WebView() {} }; diff --git a/WebKit/chromium/public/WebViewClient.h b/WebKit/chromium/public/WebViewClient.h index 4d272bb..c64418b 100644 --- a/WebKit/chromium/public/WebViewClient.h +++ b/WebKit/chromium/public/WebViewClient.h @@ -35,6 +35,7 @@ #include "WebEditingAction.h" #include "WebFileChooserCompletion.h" #include "WebFileChooserParams.h" +#include "WebPopupType.h" #include "WebString.h" #include "WebTextAffinity.h" #include "WebTextDirection.h" @@ -43,12 +44,20 @@ namespace WebKit { class WebAccessibilityObject; +class WebDeviceOrientationClient; class WebDragData; +class WebElement; class WebFileChooserCompletion; class WebFrame; +class WebGeolocationService; +class WebImage; +class WebInputElement; +class WebKeyboardEvent; class WebNode; class WebNotificationPresenter; class WebRange; +class WebSpeechInputController; +class WebSpeechInputListener; class WebStorageNamespace; class WebURL; class WebView; @@ -57,6 +66,7 @@ struct WebConsoleMessage; struct WebContextMenuData; struct WebPoint; struct WebPopupMenuInfo; +struct WebWindowFeatures; // Since a WebView is a WebWidget, a WebViewClient is a WebWidgetClient. // Virtual inheritance allows an implementation of WebWidgetClient to be @@ -68,15 +78,17 @@ public: // Create a new related WebView. This method must clone its session storage // so any subsequent calls to createSessionStorageNamespace conform to the // WebStorage specification. - virtual WebView* createView(WebFrame* creator) { return 0; } + virtual WebView* createView(WebFrame* creator, + const WebWindowFeatures& features, + const WebString& name) { return 0; } // Create a new WebPopupMenu. In the second form, the client is // responsible for rendering the contents of the popup menu. - virtual WebWidget* createPopupMenu(bool activatable) { return 0; } + virtual WebWidget* createPopupMenu(WebPopupType) { return 0; } virtual WebWidget* createPopupMenu(const WebPopupMenuInfo&) { return 0; } // Create a session storage namespace object associated with this WebView. - virtual WebStorageNamespace* createSessionStorageNamespace() { return 0; } + virtual WebStorageNamespace* createSessionStorageNamespace(unsigned quota) { return 0; } // Misc ---------------------------------------------------------------- @@ -119,7 +131,6 @@ public: virtual bool isSmartInsertDeleteEnabled() { return true; } virtual bool isSelectTrailingWhitespaceEnabled() { return true; } - virtual void setInputMethodEnabled(bool enabled) { } virtual void didBeginEditing() { } virtual void didChangeSelection(bool isSelectionEmpty) { } @@ -127,6 +138,12 @@ public: virtual void didExecuteCommand(const WebString& commandName) { } virtual void didEndEditing() { } + // These methods are called when the users edits a text-field. + virtual void textFieldDidBeginEditing(const WebInputElement&) { } + virtual void textFieldDidEndEditing(const WebInputElement&) { } + virtual void textFieldDidChange(const WebInputElement&) { } + virtual void textFieldDidReceiveKeyDown(const WebInputElement&, const WebKeyboardEvent&) { } + // This method is called in response to WebView's handleInputEvent() // when the default action for the current keyboard event is not // suppressed by the page, to give the embedder a chance to handle @@ -197,6 +214,9 @@ public: virtual bool runModalBeforeUnloadDialog( WebFrame*, const WebString& message) { return true; } + virtual bool supportsFullscreen() { return false; } + virtual void enterFullscreenForNode(const WebNode&) { } + virtual void exitFullscreenForNode(const WebNode&) { } // UI ------------------------------------------------------------------ @@ -218,7 +238,7 @@ public: // Called when a drag-n-drop operation should begin. virtual void startDragging( - const WebPoint& from, const WebDragData&, WebDragOperationsMask) { } + const WebDragData&, WebDragOperationsMask, const WebImage&, const WebPoint&) { } // Called to determine if drag-n-drop operations may initiate a page // navigation. @@ -229,6 +249,9 @@ public: virtual void focusNext() { } virtual void focusPrevious() { } + // Called when a new node gets focused. + virtual void focusedNodeChanged(const WebNode&) { } + // Session history ----------------------------------------------------- @@ -262,8 +285,10 @@ public: // changed and should be saved. See WebView::inspectorSettings. virtual void didUpdateInspectorSettings() { } + virtual void didUpdateInspectorSetting(const WebString& key, const WebString& value) { } - // Autofill ------------------------------------------------------------ + + // AutoFill ------------------------------------------------------------ // Queries the browser for suggestions to be shown for the form text // field named |name|. |value| is the text entered by the user so @@ -272,11 +297,56 @@ public: const WebString& name, const WebString& value) { } - // Instructs the browser to remove the autofill entry specified from + // Instructs the browser to remove the Autocomplete entry specified from // its DB. + // FIXME: This method should be named removeAutocompleteSugestion. virtual void removeAutofillSuggestions(const WebString& name, const WebString& value) { } + // Informs the browser that the user has accepted an AutoFill suggestion for + // a WebNode. |name| and |label| form a key into the set of AutoFill + // profiles. |index| is an index of the selected suggestion in the list of + // suggestions provided by the client + virtual void didAcceptAutoFillSuggestion(const WebNode&, + const WebString& name, + const WebString& label, + int uniqueID, + unsigned index) { } + + // Informs the browser that the user has selected an AutoFill suggestion for + // a WebNode. This happens when the user hovers over a suggestion or uses + // the arrow keys to navigate to a suggestion. + virtual void didSelectAutoFillSuggestion(const WebNode&, + const WebString& name, + const WebString& label, + int uniqueID) { } + + // Informs the browser that the user has cleared the selection from the + // AutoFill suggestions popup. This happens when a user uses the arrow + // keys to navigate outside the range of possible selections. + virtual void didClearAutoFillSelection(const WebNode&) { } + + // Informs the browser that the user has selected an autocomplete (password + // or field) suggestion from the drop-down. The input element text has + // already been set to the selected suggestion. + virtual void didAcceptAutocompleteSuggestion(const WebInputElement&) { } + + // Geolocation --------------------------------------------------------- + + // Access the embedder API for geolocation services. + virtual WebGeolocationService* geolocationService() { return 0; } + + // Speech -------------------------------------------------------------- + + // Access the embedder API for speech input services. + virtual WebSpeechInputController* speechInputController( + WebSpeechInputListener*) { return 0; } + + // Device Orientation -------------------------------------------------- + + // Access the embedder API for device orientation services. + virtual WebDeviceOrientationClient* deviceOrientationClient() { return 0; } + protected: ~WebViewClient() { } }; diff --git a/WebKit/chromium/public/WebWidget.h b/WebKit/chromium/public/WebWidget.h index 9dfeefc..5c9f54e 100644 --- a/WebKit/chromium/public/WebWidget.h +++ b/WebKit/chromium/public/WebWidget.h @@ -33,7 +33,8 @@ #include "WebCanvas.h" #include "WebCommon.h" -#include "WebCompositionCommand.h" +#include "WebCompositionUnderline.h" +#include "WebTextInputType.h" #include "WebTextDirection.h" namespace WebKit { @@ -42,6 +43,7 @@ class WebInputEvent; class WebString; struct WebRect; struct WebSize; +template <typename T> class WebVector; class WebWidget { public: @@ -76,20 +78,35 @@ public: // Called to inform the WebWidget that it has gained or lost keyboard focus. virtual void setFocus(bool) = 0; - // Called to inform the WebWidget of a composition event. - virtual bool handleCompositionEvent(WebCompositionCommand command, - int cursorPosition, - int targetStart, - int targetEnd, - const WebString& text) = 0; + // Called to inform the WebWidget of a new composition text. + // If selectionStart and selectionEnd has the same value, then it indicates + // the input caret position. If the text is empty, then the existing + // composition text will be cancelled. + // Returns true if the composition text was set successfully. + virtual bool setComposition( + const WebString& text, + const WebVector<WebCompositionUnderline>& underlines, + int selectionStart, + int selectionEnd) = 0; - // Retrieve the status of this WebWidget required by IME APIs. Upon - // success enabled and caretBounds are set. - virtual bool queryCompositionStatus(bool* enabled, WebRect* caretBounds) = 0; + // Called to inform the WebWidget to confirm an ongoing composition. + // Returns true if there is an ongoing composition. + virtual bool confirmComposition() = 0; + + // Returns the current text input type of this WebWidget. + virtual WebTextInputType textInputType() = 0; + + // Returns the current caret bounds of this WebWidget. The selection bounds + // will be returned if a selection range is available. + virtual WebRect caretOrSelectionBounds() = 0; // Changes the text direction of the selected input node. virtual void setTextDirection(WebTextDirection) = 0; + // Returns true if the WebWidget uses GPU accelerated compositing + // to render its contents. + virtual bool isAcceleratedCompositingActive() const = 0; + protected: ~WebWidget() { } }; diff --git a/WebKit/chromium/public/WebWidgetClient.h b/WebKit/chromium/public/WebWidgetClient.h index 06d9eba..bd7bd6a 100644 --- a/WebKit/chromium/public/WebWidgetClient.h +++ b/WebKit/chromium/public/WebWidgetClient.h @@ -83,6 +83,10 @@ public: // displayed. virtual WebScreenInfo screenInfo() { return WebScreenInfo(); } + // When this method gets called, WebWidgetClient implementation should + // reset the input method by cancelling any ongoing composition. + virtual void resetInputMethod() { } + protected: ~WebWidgetClient() { } }; diff --git a/WebKit/chromium/public/WebWindowFeatures.h b/WebKit/chromium/public/WebWindowFeatures.h new file mode 100644 index 0000000..2e7278a --- /dev/null +++ b/WebKit/chromium/public/WebWindowFeatures.h @@ -0,0 +1,104 @@ +/* + * 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 WebWindowFeatures_h +#define WebWindowFeatures_h + +#include "WebCommon.h" +#include "WebString.h" +#include "WebVector.h" + +#if WEBKIT_IMPLEMENTATION +#include "WindowFeatures.h" +#endif + +namespace WebKit { + +struct WebWindowFeatures { + float x; + bool xSet; + float y; + bool ySet; + float width; + bool widthSet; + float height; + bool heightSet; + + bool menuBarVisible; + bool statusBarVisible; + bool toolBarVisible; + bool locationBarVisible; + bool scrollbarsVisible; + bool resizable; + + bool fullscreen; + bool dialog; + WebVector<WebString> additionalFeatures; + + WebWindowFeatures() + : xSet(false) + , ySet(false) + , widthSet(false) + , heightSet(false) + , menuBarVisible(true) + , statusBarVisible(true) + , toolBarVisible(true) + , locationBarVisible(true) + , scrollbarsVisible(true) + , resizable(true) + , fullscreen(false) + , dialog(false) + { + } + + +#if WEBKIT_IMPLEMENTATION + WebWindowFeatures(const WebCore::WindowFeatures& f) + : xSet(f.xSet) + , ySet(f.ySet) + , widthSet(f.widthSet) + , heightSet(f.heightSet) + , menuBarVisible(f.menuBarVisible) + , statusBarVisible(f.statusBarVisible) + , toolBarVisible(f.toolBarVisible) + , locationBarVisible(f.locationBarVisible) + , scrollbarsVisible(f.scrollbarsVisible) + , resizable(f.resizable) + , fullscreen(f.fullscreen) + , dialog(f.dialog) + , additionalFeatures(f.additionalFeatures) + { + } +#endif +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/gtk/WebFontInfo.h b/WebKit/chromium/public/gtk/WebFontInfo.h index ad37680..fae792d 100644 --- a/WebKit/chromium/public/gtk/WebFontInfo.h +++ b/WebKit/chromium/public/gtk/WebFontInfo.h @@ -32,6 +32,7 @@ #define WebFontInfo_h #include "../WebCString.h" +#include "../linux/WebFontRenderStyle.h" #include <string.h> #include <unistd.h> @@ -48,6 +49,19 @@ public: // Returns: the font family or an empty string if the request could not be // satisfied. WEBKIT_API static WebCString familyForChars(const WebUChar* characters, size_t numCharacters); + + // Fill out the given WebFontRenderStyle with the user's preferences for + // rendering the given font at the given size. + // family: i.e. "Times New Roman" + // sizeAndStyle: + // 3322222222221111111111 + // 10987654321098765432109876543210 + // +--------------------------------+ + // |..............Size............IB| + // +--------------------------------+ + // I: italic flag + // B: bold flag + WEBKIT_API static void renderStyleForStrike(const char* family, int sizeAndStyle, WebFontRenderStyle* result); }; } // namespace WebKit diff --git a/WebKit/chromium/public/linux/WebFontRenderStyle.h b/WebKit/chromium/public/linux/WebFontRenderStyle.h new file mode 100644 index 0000000..a3b180f --- /dev/null +++ b/WebKit/chromium/public/linux/WebFontRenderStyle.h @@ -0,0 +1,62 @@ +/* + * 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 WebFontRenderStyle_h +#define WebFontRenderStyle_h + +#include "../WebCommon.h" + +namespace WebCore { struct FontRenderStyle; } + +namespace WebKit { + +struct WebFontRenderStyle { + // Each of the use* members below can take one of three values: + // 0: off + // 1: on + // 2: no preference expressed + char useBitmaps; // use embedded bitmap strike if possible + char useAutoHint; // use 'auto' hinting (FreeType specific) + char useHinting; // hint glyphs to the pixel grid + char hintStyle; // level of hinting, 0..3 + char useAntiAlias; // antialias glyph shapes + char useSubpixel; // use subpixel antialias + +#ifdef WEBKIT_IMPLEMENTATION + // Translates the members of this struct to a FontRenderStyle + void toFontRenderStyle(WebCore::FontRenderStyle*); +#endif + + void setDefaults(); +}; + +} // namespace WebKit + +#endif // WebFontRenderStyle_h diff --git a/WebKit/chromium/public/linux/WebSandboxSupport.h b/WebKit/chromium/public/linux/WebSandboxSupport.h index 5edceb2..6990abe 100644 --- a/WebKit/chromium/public/linux/WebSandboxSupport.h +++ b/WebKit/chromium/public/linux/WebSandboxSupport.h @@ -36,6 +36,8 @@ namespace WebKit { +struct WebFontRenderStyle; + // Put methods here that are required due to sandbox restrictions. class WebSandboxSupport { public: @@ -49,6 +51,7 @@ public: // Returns a string with the font family on an empty string if the // request cannot be satisfied. virtual WebString getFontFamilyForCharacters(const WebUChar* characters, size_t numCharacters) = 0; + virtual void getRenderStyleForStrike(const char* family, int sizeAndStyle, WebFontRenderStyle* style) = 0; }; } // namespace WebKit diff --git a/WebKit/chromium/public/mac/WebSandboxSupport.h b/WebKit/chromium/public/mac/WebSandboxSupport.h new file mode 100644 index 0000000..57d48aa --- /dev/null +++ b/WebKit/chromium/public/mac/WebSandboxSupport.h @@ -0,0 +1,63 @@ +/* + * 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 WebSandboxSupport_h +#define WebSandboxSupport_h + +typedef uintptr_t ATSFontContainerRef; + +#ifdef __OBJC__ +@class NSFont; +#else +class NSFont; +#endif + +namespace WebKit { + +// Put methods here that are required due to sandbox restrictions. +class WebSandboxSupport { +public: + // Given an input font - |srcFont| [which can't be loaded due to sandbox + // restrictions]. Return a font container belonging to an equivalent + // font file that can be used to access the font. + // + // Note that a font container may contain multiple fonts, the caller is + // responsible for retreiving the appropriate font from the container. + // + // If this function succeeds, the caller assumes ownership of the |out| + // parameter and must call ATSFontDeactivate() to unload it when done. + // + // Returns: true on success, false on error. + virtual bool loadFont(NSFont* srcFont, ATSFontContainerRef* out) = 0; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/src/ApplicationCacheHost.cpp b/WebKit/chromium/src/ApplicationCacheHost.cpp index 5fa4a66..3bfcfe2 100644 --- a/WebKit/chromium/src/ApplicationCacheHost.cpp +++ b/WebKit/chromium/src/ApplicationCacheHost.cpp @@ -37,10 +37,15 @@ #include "DocumentLoader.h" #include "DOMApplicationCache.h" #include "Frame.h" +#include "InspectorApplicationCacheAgent.h" +#include "InspectorController.h" +#include "Page.h" +#include "ProgressEvent.h" #include "Settings.h" #include "WebURL.h" #include "WebURLError.h" #include "WebURLResponse.h" +#include "WebVector.h" #include "WrappedResourceRequest.h" #include "WrappedResourceResponse.h" @@ -195,34 +200,77 @@ void ApplicationCacheHost::setDOMApplicationCache(DOMApplicationCache* domApplic m_domApplicationCache = domApplicationCache; } -void ApplicationCacheHost::notifyDOMApplicationCache(EventID id) +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) { - m_deferredEvents.append(id); + // Event dispatching is deferred until document.onload has fired. + m_deferredEvents.append(DeferredEvent(id, total, done)); return; } - if (m_domApplicationCache) { - ExceptionCode ec = 0; - m_domApplicationCache->dispatchEvent(Event::create(DOMApplicationCache::toEventType(id), false, false), ec); - ASSERT(!ec); + dispatchDOMEvent(id, total, done); +} + +#if ENABLE(INSPECTOR) +ApplicationCacheHost::CacheInfo ApplicationCacheHost::applicationCacheInfo() +{ + if (!m_internal) + return CacheInfo(KURL(), 0, 0, 0); + + WebKit::WebApplicationCacheHost::CacheInfo webInfo; + m_internal->m_outerHost->getAssociatedCacheInfo(&webInfo); + return CacheInfo(webInfo.manifestURL, webInfo.creationTime, webInfo.updateTime, webInfo.totalSize); +} + +void ApplicationCacheHost::fillResourceList(ResourceInfoList* resources) +{ + if (!m_internal) + return; + + WebKit::WebVector<WebKit::WebApplicationCacheHost::ResourceInfo> webResources; + m_internal->m_outerHost->getResourceList(&webResources); + for (size_t i = 0; i < webResources.size(); ++i) { + resources->append(ResourceInfo( + webResources[i].url, webResources[i].isMaster, webResources[i].isManifest, webResources[i].isFallback, + webResources[i].isForeign, webResources[i].isExplicit, webResources[i].size)); } } +#endif void ApplicationCacheHost::stopDeferringEvents() { RefPtr<DocumentLoader> protect(documentLoader()); for (unsigned i = 0; i < m_deferredEvents.size(); ++i) { - EventID id = m_deferredEvents[i]; - if (m_domApplicationCache) { - ExceptionCode ec = 0; - m_domApplicationCache->dispatchEvent(Event::create(DOMApplicationCache::toEventType(id), false, false), ec); - ASSERT(!ec); - } + const DeferredEvent& deferred = m_deferredEvents[i]; + dispatchDOMEvent(deferred.eventID, deferred.progressTotal, deferred.progressDone); } m_deferredEvents.clear(); m_defersEvents = false; } +void ApplicationCacheHost::dispatchDOMEvent(EventID id, int total, int done) +{ + if (m_domApplicationCache) { + const AtomicString& eventType = DOMApplicationCache::toEventType(id); + ExceptionCode ec = 0; + RefPtr<Event> event; + if (id == PROGRESS_EVENT) + event = ProgressEvent::create(eventType, true, done, total); + else + event = Event::create(eventType, false, false); + m_domApplicationCache->dispatchEvent(event, ec); + ASSERT(!ec); + } +} + ApplicationCacheHost::Status ApplicationCacheHost::status() const { return m_internal ? static_cast<Status>(m_internal->m_outerHost->status()) : UNCACHED; diff --git a/WebKit/chromium/src/ApplicationCacheHostInternal.h b/WebKit/chromium/src/ApplicationCacheHostInternal.h index 3e52c1b..c88420b 100644 --- a/WebKit/chromium/src/ApplicationCacheHostInternal.h +++ b/WebKit/chromium/src/ApplicationCacheHostInternal.h @@ -33,9 +33,13 @@ #if ENABLE(OFFLINE_WEB_APPLICATIONS) +#include "DocumentLoader.h" #include "WebApplicationCacheHostClient.h" +#include "WebFrameClient.h" +#include "WebFrameImpl.h" #include "WebKit.h" #include "WebKitClient.h" +#include "WebURL.h" namespace WebCore { @@ -44,12 +48,24 @@ public: ApplicationCacheHostInternal(ApplicationCacheHost* host) : m_innerHost(host) { - m_outerHost.set(WebKit::webKitClient()->createApplicationCacheHost(this)); + WebKit::WebFrameImpl* webFrame = WebKit::WebFrameImpl::fromFrame(host->m_documentLoader->frame()); + ASSERT(webFrame); + m_outerHost.set(webFrame->client()->createApplicationCacheHost(webFrame, this)); + } + + virtual void didChangeCacheAssociation() + { + // FIXME: Prod the inspector to update it's notion of what cache the page is using. } virtual void notifyEventListener(WebKit::WebApplicationCacheHost::EventID eventID) { - m_innerHost->notifyDOMApplicationCache(static_cast<ApplicationCacheHost::EventID>(eventID)); + m_innerHost->notifyDOMApplicationCache(static_cast<ApplicationCacheHost::EventID>(eventID), 0, 0); + } + + virtual void notifyProgressEventListener(const WebKit::WebURL&, int progressTotal, int progressDone) + { + m_innerHost->notifyDOMApplicationCache(ApplicationCacheHost::PROGRESS_EVENT, progressTotal, progressDone); } static WebKit::WebApplicationCacheHost* toWebApplicationCacheHost(ApplicationCacheHost* innerHost) diff --git a/WebKit/chromium/src/AssertMatchingEnums.cpp b/WebKit/chromium/src/AssertMatchingEnums.cpp index 1d2948f..a117fc2 100644 --- a/WebKit/chromium/src/AssertMatchingEnums.cpp +++ b/WebKit/chromium/src/AssertMatchingEnums.cpp @@ -36,28 +36,47 @@ #include "AccessibilityObject.h" #include "ApplicationCacheHost.h" #include "EditorInsertAction.h" +#include "FontDescription.h" +#include "FontSmoothingMode.h" #include "HTMLInputElement.h" +#include "IDBKey.h" #include "MediaPlayer.h" #include "NotificationPresenter.h" #include "PasteboardPrivate.h" #include "PlatformCursor.h" -#include "StringImpl.h" +#include "Settings.h" #include "TextAffinity.h" +#include "UserContentTypes.h" +#include "UserScriptTypes.h" +#include "VideoFrameChromium.h" #include "WebAccessibilityObject.h" #include "WebApplicationCacheHost.h" #include "WebClipboard.h" #include "WebCursorInfo.h" #include "WebEditingAction.h" +#include "WebFontDescription.h" +#include "WebIDBKey.h" #include "WebInputElement.h" #include "WebMediaPlayer.h" #include "WebNotificationPresenter.h" +#include "WebScrollbar.h" +#include "WebSettings.h" #include "WebTextAffinity.h" #include "WebTextCaseSensitivity.h" +#include "WebVideoFrame.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) +// These constants are in WTF, bring them into WebCore so the ASSERT still works for them! +namespace WebCore { + using WTF::TextCaseSensitive; + using WTF::TextCaseInsensitive; +}; + COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleUnknown, UnknownRole); COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleButton, ButtonRole); COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleRadioButton, RadioButtonRole); @@ -124,6 +143,7 @@ COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleDefinitionListDefinition, Defin COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleAnnotation, AnnotationRole); COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleSliderThumb, SliderThumbRole); COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleIgnored, IgnoredRole); +COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRolePresentational, PresentationalRole); COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleTab, TabRole); COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleTabList, TabListRole); COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleTabPanel, TabPanelRole); @@ -177,6 +197,7 @@ COMPILE_ASSERT_MATCHING_ENUM(WebClipboard::FormatSmartPaste, PasteboardPrivate:: COMPILE_ASSERT_MATCHING_ENUM(WebClipboard::BufferStandard, PasteboardPrivate::StandardBuffer); COMPILE_ASSERT_MATCHING_ENUM(WebClipboard::BufferSelection, PasteboardPrivate::SelectionBuffer); +COMPILE_ASSERT_MATCHING_ENUM(WebClipboard::BufferDrag, PasteboardPrivate::DragBuffer); COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypePointer, PlatformCursor::TypePointer); COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeCross, PlatformCursor::TypeCross); @@ -225,6 +246,31 @@ COMPILE_ASSERT_MATCHING_ENUM(WebEditingActionTyped, EditorInsertActionTyped); COMPILE_ASSERT_MATCHING_ENUM(WebEditingActionPasted, EditorInsertActionPasted); COMPILE_ASSERT_MATCHING_ENUM(WebEditingActionDropped, EditorInsertActionDropped); +COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::GenericFamilyNone, FontDescription::NoFamily); +COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::GenericFamilyStandard, FontDescription::StandardFamily); +COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::GenericFamilySerif, FontDescription::SerifFamily); +COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::GenericFamilySansSerif, FontDescription::SansSerifFamily); +COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::GenericFamilyMonospace, FontDescription::MonospaceFamily); +COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::GenericFamilyCursive, FontDescription::CursiveFamily); +COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::GenericFamilyFantasy, FontDescription::FantasyFamily); + +COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::SmoothingAuto, AutoSmoothing); +COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::SmoothingNone, NoSmoothing); +COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::SmoothingGrayscale, Antialiased); +COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::SmoothingSubpixel, SubpixelAntialiased); + +COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::Weight100, FontWeight100); +COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::Weight200, FontWeight200); +COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::Weight300, FontWeight300); +COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::Weight400, FontWeight400); +COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::Weight500, FontWeight500); +COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::Weight600, FontWeight600); +COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::Weight700, FontWeight700); +COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::Weight800, FontWeight800); +COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::Weight900, FontWeight900); +COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::WeightNormal, FontWeightNormal); +COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::WeightBold, FontWeightBold); + COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Text, HTMLInputElement::TEXT); COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Password, HTMLInputElement::PASSWORD); COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::IsIndex, HTMLInputElement::ISINDEX); @@ -283,6 +329,24 @@ COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::Unknown, MediaPlayer::Unknown); COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::Download, MediaPlayer::Download); COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::StoredStream, MediaPlayer::StoredStream); COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::LiveStream, MediaPlayer::LiveStream); + +COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatInvalid, VideoFrameChromium::Invalid); +COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatRGB555, VideoFrameChromium::RGB555); +COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatRGB565, VideoFrameChromium::RGB565); +COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatRGB24, VideoFrameChromium::RGB24); +COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatRGB32, VideoFrameChromium::RGB32); +COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatRGBA, VideoFrameChromium::RGBA); +COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatYV12, VideoFrameChromium::YV12); +COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatYV16, VideoFrameChromium::YV16); +COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatNV12, VideoFrameChromium::NV12); +COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatEmpty, VideoFrameChromium::Empty); +COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatASCII, VideoFrameChromium::ASCII); + +COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::SurfaceTypeSystemMemory, VideoFrameChromium::TypeSystemMemory); +COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::SurfaceTypeOMXBufferHead, VideoFrameChromium::TypeOMXBufferHead); +COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::SurfaceTypeEGLImage, VideoFrameChromium::TypeEGLImage); +COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::SurfaceTypeMFBuffer, VideoFrameChromium::TypeMFBuffer); +COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::SurfaceTypeDirect3DSurface, VideoFrameChromium::TypeDirect3DSurface); #endif #if ENABLE(NOTIFICATIONS) @@ -291,8 +355,28 @@ COMPILE_ASSERT_MATCHING_ENUM(WebNotificationPresenter::PermissionNotAllowed, Not COMPILE_ASSERT_MATCHING_ENUM(WebNotificationPresenter::PermissionDenied, NotificationPresenter::PermissionDenied); #endif +COMPILE_ASSERT_MATCHING_ENUM(WebScrollbar::Horizontal, HorizontalScrollbar); +COMPILE_ASSERT_MATCHING_ENUM(WebScrollbar::Vertical, VerticalScrollbar); + +COMPILE_ASSERT_MATCHING_ENUM(WebScrollbar::ScrollByLine, ScrollByLine); +COMPILE_ASSERT_MATCHING_ENUM(WebScrollbar::ScrollByPage, ScrollByPage); +COMPILE_ASSERT_MATCHING_ENUM(WebScrollbar::ScrollByDocument, ScrollByDocument); +COMPILE_ASSERT_MATCHING_ENUM(WebScrollbar::ScrollByPixel, ScrollByPixel); + +COMPILE_ASSERT_MATCHING_ENUM(WebSettings::EditingBehaviorMac, EditingMacBehavior); +COMPILE_ASSERT_MATCHING_ENUM(WebSettings::EditingBehaviorWin, EditingWindowsBehavior); + COMPILE_ASSERT_MATCHING_ENUM(WebTextAffinityUpstream, UPSTREAM); COMPILE_ASSERT_MATCHING_ENUM(WebTextAffinityDownstream, DOWNSTREAM); COMPILE_ASSERT_MATCHING_ENUM(WebTextCaseSensitive, TextCaseSensitive); COMPILE_ASSERT_MATCHING_ENUM(WebTextCaseInsensitive, TextCaseInsensitive); + +COMPILE_ASSERT_MATCHING_ENUM(WebView::UserScriptInjectAtDocumentStart, InjectAtDocumentStart); +COMPILE_ASSERT_MATCHING_ENUM(WebView::UserScriptInjectAtDocumentEnd, InjectAtDocumentEnd); +COMPILE_ASSERT_MATCHING_ENUM(WebView::UserContentInjectInAllFrames, InjectInAllFrames); +COMPILE_ASSERT_MATCHING_ENUM(WebView::UserContentInjectInTopFrameOnly, InjectInTopFrameOnly); + +COMPILE_ASSERT_MATCHING_ENUM(WebIDBKey::NullType, IDBKey::NullType); +COMPILE_ASSERT_MATCHING_ENUM(WebIDBKey::StringType, IDBKey::StringType); +COMPILE_ASSERT_MATCHING_ENUM(WebIDBKey::NumberType, IDBKey::NumberType); diff --git a/WebKit/chromium/src/AutoFillPopupMenuClient.cpp b/WebKit/chromium/src/AutoFillPopupMenuClient.cpp index 8e6cab4..b14840c 100644 --- a/WebKit/chromium/src/AutoFillPopupMenuClient.cpp +++ b/WebKit/chromium/src/AutoFillPopupMenuClient.cpp @@ -31,65 +31,335 @@ #include "config.h" #include "AutoFillPopupMenuClient.h" +#include "CSSStyleSelector.h" +#include "CSSValueKeywords.h" +#include "Chrome.h" +#include "FrameView.h" #include "HTMLInputElement.h" +#include "RenderTheme.h" +#include "WebNode.h" #include "WebString.h" #include "WebVector.h" +#include "WebViewClient.h" +#include "WebViewImpl.h" using namespace WebCore; namespace WebKit { +AutoFillPopupMenuClient::AutoFillPopupMenuClient() + : m_separatorIndex(-1) + , m_selectedIndex(-1) + , m_textField(0) + , m_AutocompleteModeEnabled(false) +{ +} + +AutoFillPopupMenuClient::~AutoFillPopupMenuClient() +{ +} + unsigned AutoFillPopupMenuClient::getSuggestionsCount() const { - return m_names.size(); + return m_names.size() + ((m_separatorIndex == -1) ? 0 : 1); } WebString AutoFillPopupMenuClient::getSuggestion(unsigned listIndex) const { - // FIXME: Modify the PopupMenu to add the label in gray right-justified. - ASSERT(listIndex >= 0 && listIndex < m_names.size()); - return m_names[listIndex] + String(" (") + m_labels[listIndex] + String(")"); + int index = convertListIndexToInternalIndex(listIndex); + if (index == -1) + return WebString(); + + ASSERT(index >= 0 && static_cast<size_t>(index) < m_names.size()); + return m_names[index]; +} + +WebString AutoFillPopupMenuClient::getLabel(unsigned listIndex) const +{ + int index = convertListIndexToInternalIndex(listIndex); + if (index == -1) + return WebString(); + + ASSERT(index >= 0 && static_cast<size_t>(index) < m_labels.size()); + return m_labels[index]; +} + +WebString AutoFillPopupMenuClient::getIcon(unsigned listIndex) const +{ + int index = convertListIndexToInternalIndex(listIndex); + if (index == -1) + return WebString(); + + ASSERT(index >= 0 && static_cast<size_t>(index) < m_icons.size()); + return m_icons[index]; } void AutoFillPopupMenuClient::removeSuggestionAtIndex(unsigned listIndex) { - // FIXME: Do we want to remove AutoFill suggestions? - ASSERT(listIndex >= 0 && listIndex < m_names.size()); - m_names.remove(listIndex); - m_labels.remove(listIndex); + if (!canRemoveSuggestionAtIndex(listIndex)) + return; + + int index = convertListIndexToInternalIndex(listIndex); + + ASSERT(static_cast<unsigned>(index) < m_names.size()); + + m_names.remove(index); + m_labels.remove(index); + m_icons.remove(index); + m_uniqueIDs.remove(index); + + // Shift the separator index if necessary. + if (m_separatorIndex != -1) + m_separatorIndex--; +} + +bool AutoFillPopupMenuClient::canRemoveSuggestionAtIndex(unsigned listIndex) +{ + // Only allow deletion of items before the separator and those that don't + // have a label (autocomplete). + int index = convertListIndexToInternalIndex(listIndex); + return m_labels[index].isEmpty() && (m_separatorIndex == -1 || listIndex < static_cast<unsigned>(m_separatorIndex)); +} + +void AutoFillPopupMenuClient::valueChanged(unsigned listIndex, bool fireEvents) +{ + // DEPRECATED: Will be removed once AutoFill and Autocomplete merge is + // completed. + if (m_AutocompleteModeEnabled) { + m_textField->setValue(getSuggestion(listIndex)); + + WebViewImpl* webView = getWebView(); + if (!webView) + return; + + EditorClientImpl* editor = + static_cast<EditorClientImpl*>(webView->page()->editorClient()); + ASSERT(editor); + editor->onAutocompleteSuggestionAccepted( + static_cast<HTMLInputElement*>(m_textField.get())); + } else { + WebViewImpl* webView = getWebView(); + if (!webView) + return; + + if (m_separatorIndex != -1 && listIndex > static_cast<unsigned>(m_separatorIndex)) + --listIndex; + + ASSERT(listIndex < m_names.size()); + + webView->client()->didAcceptAutoFillSuggestion(WebNode(getTextField()), + m_names[listIndex], + m_labels[listIndex], + m_uniqueIDs[listIndex], + listIndex); + } +} + +void AutoFillPopupMenuClient::selectionChanged(unsigned listIndex, bool fireEvents) +{ + WebViewImpl* webView = getWebView(); + if (!webView) + return; + + if (m_separatorIndex != -1 && listIndex > static_cast<unsigned>(m_separatorIndex)) + --listIndex; + + ASSERT(listIndex < m_names.size()); + + webView->client()->didSelectAutoFillSuggestion(WebNode(getTextField()), + m_names[listIndex], + m_labels[listIndex], + m_uniqueIDs[listIndex]); +} + +void AutoFillPopupMenuClient::selectionCleared() +{ + WebViewImpl* webView = getWebView(); + if (webView) + webView->client()->didClearAutoFillSelection(WebNode(getTextField())); +} + +String AutoFillPopupMenuClient::itemText(unsigned listIndex) const +{ + return getSuggestion(listIndex); +} + +String AutoFillPopupMenuClient::itemLabel(unsigned listIndex) const +{ + return getLabel(listIndex); +} + +String AutoFillPopupMenuClient::itemIcon(unsigned listIndex) const +{ + return getIcon(listIndex); +} + +PopupMenuStyle AutoFillPopupMenuClient::itemStyle(unsigned listIndex) const +{ + return *m_style; +} + +PopupMenuStyle AutoFillPopupMenuClient::menuStyle() const +{ + return *m_style; +} + +int AutoFillPopupMenuClient::clientPaddingLeft() const +{ + // Bug http://crbug.com/7708 seems to indicate the style can be 0. + RenderStyle* style = textFieldStyle(); + if (!style) + return 0; + + return RenderTheme::defaultTheme()->popupInternalPaddingLeft(style); +} + +int AutoFillPopupMenuClient::clientPaddingRight() const +{ + // Bug http://crbug.com/7708 seems to indicate the style can be 0. + RenderStyle* style = textFieldStyle(); + if (!style) + return 0; + + return RenderTheme::defaultTheme()->popupInternalPaddingRight(style); +} + +void AutoFillPopupMenuClient::popupDidHide() +{ + WebViewImpl* webView = getWebView(); + if (!webView) + return; + + webView->autoFillPopupDidHide(); + webView->client()->didClearAutoFillSelection(WebNode(getTextField())); +} + +bool AutoFillPopupMenuClient::itemIsSeparator(unsigned listIndex) const +{ + return (m_separatorIndex != -1 && static_cast<unsigned>(m_separatorIndex) == listIndex); +} + +void AutoFillPopupMenuClient::setTextFromItem(unsigned listIndex) +{ + m_textField->setValue(getSuggestion(listIndex)); +} + +FontSelector* AutoFillPopupMenuClient::fontSelector() const +{ + return m_textField->document()->styleSelector()->fontSelector(); +} + +HostWindow* AutoFillPopupMenuClient::hostWindow() const +{ + return m_textField->document()->view()->hostWindow(); +} + +PassRefPtr<Scrollbar> AutoFillPopupMenuClient::createScrollbar( + ScrollbarClient* client, + ScrollbarOrientation orientation, + ScrollbarControlSize size) +{ + return Scrollbar::createNativeScrollbar(client, orientation, size); } void AutoFillPopupMenuClient::initialize( HTMLInputElement* textField, const WebVector<WebString>& names, const WebVector<WebString>& labels, - int defaultSuggestionIndex) + const WebVector<WebString>& icons, + const WebVector<int>& uniqueIDs, + int separatorIndex) { ASSERT(names.size() == labels.size()); - ASSERT(defaultSuggestionIndex < static_cast<int>(names.size())); + ASSERT(names.size() == icons.size()); + ASSERT(names.size() == uniqueIDs.size()); + ASSERT(separatorIndex < static_cast<int>(names.size())); + + m_selectedIndex = -1; + m_textField = textField; // The suggestions must be set before initializing the - // SuggestionsPopupMenuClient. - setSuggestions(names, labels); + // AutoFillPopupMenuClient. + setSuggestions(names, labels, icons, uniqueIDs, separatorIndex); - SuggestionsPopupMenuClient::initialize(textField, defaultSuggestionIndex); + FontDescription fontDescription; + RenderTheme::defaultTheme()->systemFont(CSSValueWebkitControl, + fontDescription); + RenderStyle* style = m_textField->computedStyle(); + fontDescription.setComputedSize(style->fontDescription().computedSize()); + + Font font(fontDescription, 0, 0); + font.update(textField->document()->styleSelector()->fontSelector()); + // The direction of text in popup menu is set the same as the direction of + // the input element: textField. + m_style.set(new PopupMenuStyle(Color::black, Color::white, font, true, + Length(WebCore::Fixed), + textField->renderer()->style()->direction())); } void AutoFillPopupMenuClient::setSuggestions(const WebVector<WebString>& names, - const WebVector<WebString>& labels) + const WebVector<WebString>& labels, + const WebVector<WebString>& icons, + const WebVector<int>& uniqueIDs, + int separatorIndex) { ASSERT(names.size() == labels.size()); + ASSERT(names.size() == icons.size()); + ASSERT(names.size() == uniqueIDs.size()); + ASSERT(separatorIndex < static_cast<int>(names.size())); m_names.clear(); m_labels.clear(); + m_icons.clear(); + m_uniqueIDs.clear(); for (size_t i = 0; i < names.size(); ++i) { m_names.append(names[i]); m_labels.append(labels[i]); + m_icons.append(icons[i]); + m_uniqueIDs.append(uniqueIDs[i]); } + m_separatorIndex = separatorIndex; + // Try to preserve selection if possible. if (getSelectedIndex() >= static_cast<int>(names.size())) setSelectedIndex(-1); } +int AutoFillPopupMenuClient::convertListIndexToInternalIndex(unsigned listIndex) const +{ + if (listIndex == static_cast<unsigned>(m_separatorIndex)) + return -1; + + if (m_separatorIndex == -1 || listIndex < static_cast<unsigned>(m_separatorIndex)) + return listIndex; + return listIndex - 1; +} + +WebViewImpl* AutoFillPopupMenuClient::getWebView() const +{ + Frame* frame = m_textField->document()->frame(); + if (!frame) + return 0; + + Page* page = frame->page(); + if (!page) + return 0; + + return static_cast<ChromeClientImpl*>(page->chrome()->client())->webView(); +} + +RenderStyle* AutoFillPopupMenuClient::textFieldStyle() const +{ + RenderStyle* style = m_textField->computedStyle(); + if (!style) { + // It seems we can only have a 0 style in a TextField if the + // node is detached, in which case we the popup should not be + // showing. Please report this in http://crbug.com/7708 and + // include the page you were visiting. + ASSERT_NOT_REACHED(); + } + return style; +} + } // namespace WebKit diff --git a/WebKit/chromium/src/AutoFillPopupMenuClient.h b/WebKit/chromium/src/AutoFillPopupMenuClient.h index 1912fa3..a946e34 100644 --- a/WebKit/chromium/src/AutoFillPopupMenuClient.h +++ b/WebKit/chromium/src/AutoFillPopupMenuClient.h @@ -31,36 +31,123 @@ #ifndef AutoFillPopupMenuClient_h #define AutoFillPopupMenuClient_h -#include "SuggestionsPopupMenuClient.h" +#include "PopupMenuClient.h" namespace WebCore { class HTMLInputElement; +class PopupMenuStyle; +class RenderStyle; } namespace WebKit { class WebString; +class WebViewImpl; template <typename T> class WebVector; // The AutoFill suggestions popup menu client, used to display name suggestions // with right-justified labels. -class AutoFillPopupMenuClient : public SuggestionsPopupMenuClient { +class AutoFillPopupMenuClient : public WebCore::PopupMenuClient { public: - // SuggestionsPopupMenuClient implementation: + AutoFillPopupMenuClient(); + virtual ~AutoFillPopupMenuClient(); + + // Returns the number of suggestions available. virtual unsigned getSuggestionsCount() const; + + // Returns the suggestion at |listIndex|. virtual WebString getSuggestion(unsigned listIndex) const; + + // Returns the label at |listIndex|. + virtual WebString getLabel(unsigned listIndex) const; + + // Returns the icon at |listIndex|. + virtual WebString getIcon(unsigned listIndex) const; + + // Removes the suggestion at |listIndex| from the list of suggestions. virtual void removeSuggestionAtIndex(unsigned listIndex); + // Returns true if the suggestion at |listIndex| can be removed. + bool canRemoveSuggestionAtIndex(unsigned listIndex); + + // WebCore::PopupMenuClient methods: + virtual void valueChanged(unsigned listIndex, bool fireEvents = true); + virtual void selectionChanged(unsigned, bool); + virtual void selectionCleared(); + virtual WTF::String itemText(unsigned listIndex) const; + virtual WTF::String itemLabel(unsigned listIndex) const; + virtual WTF::String itemIcon(unsigned listIndex) const; + virtual WTF::String itemToolTip(unsigned lastIndex) const { return WTF::String(); } + virtual WTF::String itemAccessibilityText(unsigned lastIndex) const { return WTF::String(); } + virtual bool itemIsEnabled(unsigned listIndex) const { return true; } + virtual WebCore::PopupMenuStyle itemStyle(unsigned listIndex) const; + virtual WebCore::PopupMenuStyle menuStyle() const; + virtual int clientInsetLeft() const { return 0; } + virtual int clientInsetRight() const { return 0; } + virtual int clientPaddingLeft() const; + virtual int clientPaddingRight() const; + virtual int listSize() const { return getSuggestionsCount(); } + virtual int selectedIndex() const { return m_selectedIndex; } + virtual void popupDidHide(); + virtual bool itemIsSeparator(unsigned listIndex) const; + virtual bool itemIsLabel(unsigned listIndex) const { return false; } + virtual bool itemIsSelected(unsigned listIndex) const { return false; } + virtual bool shouldPopOver() const { return false; } + virtual bool valueShouldChangeOnHotTrack() const { return false; } + virtual void setTextFromItem(unsigned listIndex); + virtual WebCore::FontSelector* fontSelector() const; + virtual WebCore::HostWindow* hostWindow() const; + virtual PassRefPtr<WebCore::Scrollbar> createScrollbar( + WebCore::ScrollbarClient* client, + WebCore::ScrollbarOrientation orientation, + WebCore::ScrollbarControlSize size); + void initialize(WebCore::HTMLInputElement*, const WebVector<WebString>& names, const WebVector<WebString>& labels, - int defaultSuggestionIndex); + const WebVector<WebString>& icons, + const WebVector<int>& uniqueIDs, + int separatorIndex); void setSuggestions(const WebVector<WebString>& names, - const WebVector<WebString>& labels); + const WebVector<WebString>& labels, + const WebVector<WebString>& icons, + const WebVector<int>& uniqueIDs, + int separatorIndex); + + // DEPRECATED: Will be removed once Autocomplete and AutoFill merge is + // complete. + void setAutocompleteMode(bool enabled) { m_AutocompleteModeEnabled = enabled; } private: - Vector<WebCore::String> m_names; - Vector<WebCore::String> m_labels; + // Convert the specified index from an index into the visible list (which might + // include a separator entry) to an index to |m_names| and |m_labels|. + // Returns -1 if the given index points to the separator. + int convertListIndexToInternalIndex(unsigned) const; + WebViewImpl* getWebView() const; + WebCore::HTMLInputElement* getTextField() const { return m_textField.get(); } + WebCore::RenderStyle* textFieldStyle() const; + + int getSelectedIndex() const { return m_selectedIndex; } + void setSelectedIndex(int index) { m_selectedIndex = index; } + + // The names, labels and icons that make up the contents of the menu items. + Vector<WTF::String> m_names; + Vector<WTF::String> m_labels; + Vector<WTF::String> m_icons; + Vector<int> m_uniqueIDs; + + // The index of the separator. -1 if there is no separator. + int m_separatorIndex; + + // The index of the selected item. -1 if there is no selected item. + int m_selectedIndex; + + RefPtr<WebCore::HTMLInputElement> m_textField; + OwnPtr<WebCore::PopupMenuStyle> m_style; + + // DEPRECATED: Will be removed once Autocomplete and AutoFill merge is + // complete. + bool m_AutocompleteModeEnabled; }; } // namespace WebKit diff --git a/WebKit/chromium/src/BlobRegistryProxy.cpp b/WebKit/chromium/src/BlobRegistryProxy.cpp new file mode 100644 index 0000000..84fcb4d --- /dev/null +++ b/WebKit/chromium/src/BlobRegistryProxy.cpp @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(BLOB) + +#include "BlobRegistryProxy.h" + +#include "BlobData.h" +#include "KURL.h" +#include "ResourceHandle.h" +#include "WebBlobData.h" +#include "WebBlobRegistry.h" +#include "WebKit.h" +#include "WebKitClient.h" +#include "WebURL.h" +#include <wtf/MainThread.h> +#include <wtf/StdLibExtras.h> + +// We are part of the WebKit implementation. +using namespace WebKit; + +namespace WebCore { + +BlobRegistry& blobRegistry() +{ + ASSERT(isMainThread()); + DEFINE_STATIC_LOCAL(BlobRegistryProxy, instance, ()); + return instance; +} + +BlobRegistryProxy::BlobRegistryProxy() + : m_webBlobRegistry(WebKit::webKitClient()->blobRegistry()) +{ +} + +void BlobRegistryProxy::registerBlobURL(const KURL& url, PassOwnPtr<BlobData> blobData) +{ + if (m_webBlobRegistry) { + WebBlobData webBlobData(blobData); + m_webBlobRegistry->registerBlobURL(url, webBlobData); + } +} + +void BlobRegistryProxy::registerBlobURL(const KURL& url, const KURL& srcURL) +{ + if (m_webBlobRegistry) + m_webBlobRegistry->registerBlobURL(url, srcURL); +} + +void BlobRegistryProxy::unregisterBlobURL(const KURL& url) +{ + if (m_webBlobRegistry) + m_webBlobRegistry->unregisterBlobURL(url); +} + +} // namespace WebCore + +#endif diff --git a/WebKit/chromium/src/BlobRegistryProxy.h b/WebKit/chromium/src/BlobRegistryProxy.h new file mode 100644 index 0000000..6f2ebb2 --- /dev/null +++ b/WebKit/chromium/src/BlobRegistryProxy.h @@ -0,0 +1,63 @@ +/* + * 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 BlobRegistryProxy_h +#define BlobRegistryProxy_h + +#if ENABLE(BLOB) + +#include "BlobRegistry.h" + +namespace WebKit { class WebBlobRegistry; } + +namespace WebCore { + +class BlobRegistryProxy : public BlobRegistry { +public: + BlobRegistryProxy(); + + virtual void registerBlobURL(const KURL&, PassOwnPtr<BlobData>); + virtual void registerBlobURL(const KURL&, const KURL& srcURL); + virtual void unregisterBlobURL(const KURL&); + + virtual PassRefPtr<ResourceHandle> createResourceHandle(const ResourceRequest&, ResourceHandleClient*) { return 0; } + virtual bool loadResourceSynchronously(const ResourceRequest&, ResourceError&, ResourceResponse&, Vector<char>& data) { return false; } + +private: + virtual ~BlobRegistryProxy() { } + + WebKit::WebBlobRegistry* m_webBlobRegistry; +}; + +} // namespace WebCore + +#endif // ENABLE(BLOB) + +#endif // BlobRegistryProxy_h diff --git a/WebKit/chromium/src/ChromeClientImpl.cpp b/WebKit/chromium/src/ChromeClientImpl.cpp index ce2f00c..405fbf6 100644 --- a/WebKit/chromium/src/ChromeClientImpl.cpp +++ b/WebKit/chromium/src/ChromeClientImpl.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2009 Google Inc. All rights reserved. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -31,8 +32,8 @@ #include "config.h" #include "ChromeClientImpl.h" -#include "AccessibilityObject.h" #include "AXObjectCache.h" +#include "AccessibilityObject.h" #include "CharacterNames.h" #include "Console.h" #include "Cursor.h" @@ -43,13 +44,22 @@ #include "FloatRect.h" #include "FrameLoadRequest.h" #include "FrameView.h" +#include "GLES2Context.h" +#include "Geolocation.h" +#include "GeolocationService.h" +#include "GeolocationServiceChromium.h" +#include "GraphicsLayer.h" +#include "HTMLNames.h" #include "HitTestResult.h" #include "IntRect.h" #include "Node.h" #include "NotificationPresenterImpl.h" #include "Page.h" #include "PopupMenuChromium.h" +#include "SearchPopupMenuChromium.h" #include "ScriptController.h" +#include "SecurityOrigin.h" +#include "WebGeolocationService.h" #if USE(V8) #include "V8Proxy.h" #endif @@ -61,13 +71,16 @@ #include "WebFrameImpl.h" #include "WebInputEvent.h" #include "WebKit.h" +#include "WebNode.h" #include "WebPopupMenuImpl.h" #include "WebPopupMenuInfo.h" +#include "WebPopupType.h" #include "WebRect.h" #include "WebTextDirection.h" #include "WebURLRequest.h" #include "WebViewClient.h" #include "WebViewImpl.h" +#include "WebWindowFeatures.h" #include "WindowFeatures.h" #include "WrappedResourceRequest.h" @@ -75,6 +88,20 @@ using namespace WebCore; namespace WebKit { +// Converts a WebCore::PopupContainerType to a WebKit::WebPopupType. +static WebPopupType convertPopupType(PopupContainer::PopupType type) +{ + switch (type) { + case PopupContainer::Select: + return WebPopupTypeSelect; + case PopupContainer::Suggestion: + return WebPopupTypeSuggestion; + default: + ASSERT_NOT_REACHED(); + return WebPopupTypeNone; + } +} + ChromeClientImpl::ChromeClientImpl(WebViewImpl* webView) : m_webView(webView) , m_toolbarsVisible(true) @@ -82,7 +109,6 @@ ChromeClientImpl::ChromeClientImpl(WebViewImpl* webView) , m_scrollbarsVisible(true) , m_menubarVisible(true) , m_resizable(true) - , m_ignoreNextSetCursor(false) { } @@ -138,35 +164,8 @@ float ChromeClientImpl::scaleFactor() void ChromeClientImpl::focus() { - if (!m_webView->client()) - return; - - m_webView->client()->didFocus(); - - // If accessibility is enabled, we should notify assistive technology that - // the active AccessibilityObject changed. - const Frame* frame = m_webView->focusedWebCoreFrame(); - if (!frame) - return; - - Document* doc = frame->document(); - - if (doc && doc->axObjectCache()->accessibilityEnabled()) { - Node* focusedNode = m_webView->focusedWebCoreNode(); - - if (!focusedNode) { - // Could not retrieve focused Node. - return; - } - - // Retrieve the focused AccessibilityObject. - AccessibilityObject* focusedAccObj = - doc->axObjectCache()->getOrCreate(focusedNode->renderer()); - - // Alert assistive technology that focus changed. - if (focusedAccObj) - m_webView->client()->focusAccessibilityObject(WebAccessibilityObject(focusedAccObj)); - } + if (m_webView->client()) + m_webView->client()->didFocus(); } void ChromeClientImpl::unfocus() @@ -194,17 +193,39 @@ void ChromeClientImpl::takeFocus(FocusDirection direction) void ChromeClientImpl::focusedNodeChanged(Node* node) { - WebURL focus_url; + m_webView->client()->focusedNodeChanged(WebNode(node)); + + WebURL focusURL; if (node && node->isLink()) { // This HitTestResult hack is the easiest way to get a link URL out of a // WebCore::Node. - HitTestResult hit_test(IntPoint(0, 0)); + HitTestResult hitTest(IntPoint(0, 0)); // This cast must be valid because of the isLink() check. - hit_test.setURLElement(reinterpret_cast<Element*>(node)); - if (hit_test.isLiveLink()) - focus_url = hit_test.absoluteLinkURL(); + hitTest.setURLElement(static_cast<Element*>(node)); + if (hitTest.isLiveLink()) + focusURL = hitTest.absoluteLinkURL(); + } + m_webView->client()->setKeyboardFocusURL(focusURL); + + if (!node) + return; + + // If accessibility is enabled, we should notify assistive technology that + // the active AccessibilityObject changed. + Document* document = node->document(); + if (!document) { + ASSERT_NOT_REACHED(); + return; + } + if (document && document->axObjectCache()->accessibilityEnabled()) { + // Retrieve the focused AccessibilityObject. + AccessibilityObject* focusedAccObj = + document->axObjectCache()->getOrCreate(node->renderer()); + + // Alert assistive technology that focus changed. + if (focusedAccObj) + m_webView->client()->focusAccessibilityObject(WebAccessibilityObject(focusedAccObj)); } - m_webView->client()->setKeyboardFocusURL(focus_url); } Page* ChromeClientImpl::createWindow( @@ -214,7 +235,7 @@ Page* ChromeClientImpl::createWindow( return 0; WebViewImpl* newView = static_cast<WebViewImpl*>( - m_webView->client()->createView(WebFrameImpl::fromFrame(frame))); + m_webView->client()->createView(WebFrameImpl::fromFrame(frame), features, r.frameName())); if (!newView) return 0; @@ -323,7 +344,7 @@ void ChromeClientImpl::setScrollbarsVisible(bool value) m_scrollbarsVisible = value; WebFrameImpl* web_frame = static_cast<WebFrameImpl*>(m_webView->mainFrame()); if (web_frame) - web_frame->setAllowsScrolling(value); + web_frame->setCanHaveScrollbars(value); } bool ChromeClientImpl::scrollbarsVisible() @@ -462,21 +483,30 @@ IntRect ChromeClientImpl::windowResizerRect() const return result; } -void ChromeClientImpl::repaint( - const IntRect& paintRect, bool contentChanged, bool immediate, - bool repaintContentOnly) +void ChromeClientImpl::invalidateWindow(const IntRect&, bool) { - // Ignore spurious calls. - if (!contentChanged || paintRect.isEmpty()) + notImplemented(); +} + +void ChromeClientImpl::invalidateContentsAndWindow(const IntRect& updateRect, bool /*immediate*/) +{ + if (updateRect.isEmpty()) return; if (m_webView->client()) - m_webView->client()->didInvalidateRect(paintRect); + m_webView->client()->didInvalidateRect(updateRect); +} + +void ChromeClientImpl::invalidateContentsForSlowScroll(const IntRect& updateRect, bool immediate) +{ + m_webView->hidePopups(); + invalidateContentsAndWindow(updateRect, immediate); } void ChromeClientImpl::scroll( const IntSize& scrollDelta, const IntRect& scrollRect, const IntRect& clipRect) { + m_webView->hidePopups(); if (m_webView->client()) { int dx = scrollDelta.width(); int dy = scrollDelta.height(); @@ -552,6 +582,11 @@ void ChromeClientImpl::reachedMaxAppCacheSize(int64_t spaceNeeded) { ASSERT_NOT_REACHED(); } + +void ChromeClientImpl::reachedApplicationCacheOriginQuota(SecurityOrigin*) +{ + ASSERT_NOT_REACHED(); +} #endif void ChromeClientImpl::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> fileChooser) @@ -562,6 +597,11 @@ void ChromeClientImpl::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> fileCh WebFileChooserParams params; params.multiSelect = fileChooser->allowsMultipleFiles(); +#if ENABLE(DIRECTORY_UPLOAD) + params.directory = fileChooser->allowsDirectoryUpload(); +#else + params.directory = false; +#endif params.acceptTypes = fileChooser->acceptTypes(); params.selectedFiles = fileChooser->filenames(); if (params.selectedFiles.size() > 0) @@ -576,9 +616,13 @@ void ChromeClientImpl::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> fileCh chooserCompletion->didChooseFile(WebVector<WebString>()); } +void ChromeClientImpl::chooseIconForFiles(const Vector<WTF::String>&, WebCore::FileChooser*) +{ + notImplemented(); +} + void ChromeClientImpl::popupOpened(PopupContainer* popupContainer, const IntRect& bounds, - bool activatable, bool handleExternally) { if (!m_webView->client()) @@ -589,19 +633,24 @@ void ChromeClientImpl::popupOpened(PopupContainer* popupContainer, WebPopupMenuInfo popupInfo; getPopupMenuInfo(popupContainer, &popupInfo); webwidget = m_webView->client()->createPopupMenu(popupInfo); - } else - webwidget = m_webView->client()->createPopupMenu(activatable); - + } else { + webwidget = m_webView->client()->createPopupMenu( + convertPopupType(popupContainer->popupType())); + // We only notify when the WebView has to handle the popup, as when + // the popup is handled externally, the fact that a popup is showing is + // transparent to the WebView. + m_webView->popupOpened(popupContainer); + } static_cast<WebPopupMenuImpl*>(webwidget)->Init(popupContainer, bounds); } -void ChromeClientImpl::setCursor(const WebCursorInfo& cursor) +void ChromeClientImpl::popupClosed(WebCore::PopupContainer* popupContainer) { - if (m_ignoreNextSetCursor) { - m_ignoreNextSetCursor = false; - return; - } + m_webView->popupClosed(popupContainer); +} +void ChromeClientImpl::setCursor(const WebCursorInfo& cursor) +{ if (m_webView->client()) m_webView->client()->didChangeCursor(cursor); } @@ -609,11 +658,6 @@ void ChromeClientImpl::setCursor(const WebCursorInfo& cursor) void ChromeClientImpl::setCursorForPlugin(const WebCursorInfo& cursor) { setCursor(cursor); - - // Currently, Widget::setCursor is always called after this function in - // EventHandler.cpp and since we don't want that we set a flag indicating - // that the next SetCursor call is to be ignored. - m_ignoreNextSetCursor = true; } void ChromeClientImpl::formStateDidChange(const Node* node) @@ -655,8 +699,10 @@ void ChromeClientImpl::getPopupMenuInfo(PopupContainer* popupContainer, } info->itemHeight = popupContainer->menuItemHeight(); + info->itemFontSize = popupContainer->menuItemFontSize(); info->selectedIndex = popupContainer->selectedIndex(); info->items.swap(outputItems); + info->rightAligned = popupContainer->menuStyle().textDirection() == RTL; } void ChromeClientImpl::didChangeAccessibilityObjectState(AccessibilityObject* obj) @@ -666,7 +712,6 @@ void ChromeClientImpl::didChangeAccessibilityObjectState(AccessibilityObject* ob m_webView->client()->didChangeAccessibilityObjectState(WebAccessibilityObject(obj)); } - #if ENABLE(NOTIFICATIONS) NotificationPresenter* ChromeClientImpl::notificationPresenter() const { @@ -674,4 +719,75 @@ NotificationPresenter* ChromeClientImpl::notificationPresenter() const } #endif +void ChromeClientImpl::requestGeolocationPermissionForFrame(Frame* frame, Geolocation* geolocation) +{ + GeolocationServiceChromium* geolocationService = static_cast<GeolocationServiceChromium*>(geolocation->getGeolocationService()); + geolocationService->geolocationServiceBridge()->attachBridgeIfNeeded(); + m_webView->client()->geolocationService()->requestPermissionForFrame(geolocationService->geolocationServiceBridge()->getBridgeId(), frame->document()->url()); +} + +void ChromeClientImpl::cancelGeolocationPermissionRequestForFrame(Frame* frame, Geolocation* geolocation) +{ + GeolocationServiceChromium* geolocationService = static_cast<GeolocationServiceChromium*>(geolocation->getGeolocationService()); + m_webView->client()->geolocationService()->cancelPermissionRequestForFrame(geolocationService->geolocationServiceBridge()->getBridgeId(), frame->document()->url()); +} + +#if USE(ACCELERATED_COMPOSITING) +void ChromeClientImpl::attachRootGraphicsLayer(Frame* frame, GraphicsLayer* graphicsLayer) +{ + m_webView->setRootGraphicsLayer(graphicsLayer ? graphicsLayer->platformLayer() : 0); +} + +void ChromeClientImpl::scheduleCompositingLayerSync() +{ + m_webView->setRootLayerNeedsDisplay(); +} +#endif + +#if USE(GLES2_RENDERING) +PassOwnPtr<GLES2Context> ChromeClientImpl::getOnscreenGLES2Context() +{ + return m_webView->getOnscreenGLES2Context(); +} + +PassOwnPtr<GLES2Context> ChromeClientImpl::getOffscreenGLES2Context() +{ + return m_webView->getOffscreenGLES2Context(); +} +#endif + +bool ChromeClientImpl::supportsFullscreenForNode(const WebCore::Node* node) +{ + if (m_webView->client() && node->hasTagName(WebCore::HTMLNames::videoTag)) + return m_webView->client()->supportsFullscreen(); + return false; +} + +void ChromeClientImpl::enterFullscreenForNode(WebCore::Node* node) +{ + if (m_webView->client()) + m_webView->client()->enterFullscreenForNode(WebNode(node)); +} + +void ChromeClientImpl::exitFullscreenForNode(WebCore::Node* node) +{ + if (m_webView->client()) + m_webView->client()->exitFullscreenForNode(WebNode(node)); +} + +bool ChromeClientImpl::selectItemWritingDirectionIsNatural() +{ + return false; +} + +PassRefPtr<PopupMenu> ChromeClientImpl::createPopupMenu(PopupMenuClient* client) const +{ + return adoptRef(new PopupMenuChromium(client)); +} + +PassRefPtr<SearchPopupMenu> ChromeClientImpl::createSearchPopupMenu(PopupMenuClient* client) const +{ + return adoptRef(new SearchPopupMenuChromium(client)); +} + } // namespace WebKit diff --git a/WebKit/chromium/src/ChromeClientImpl.h b/WebKit/chromium/src/ChromeClientImpl.h index 9e8c2e3..8763def 100644 --- a/WebKit/chromium/src/ChromeClientImpl.h +++ b/WebKit/chromium/src/ChromeClientImpl.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2009 Google Inc. All rights reserved. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -32,11 +33,15 @@ #define ChromeClientImpl_h #include "ChromeClientChromium.h" +#include "PopupMenu.h" +#include "SearchPopupMenu.h" namespace WebCore { class AccessibilityObject; +class FileChooser; class HTMLParserQuirks; class PopupContainer; +class PopupMenuClient; class SecurityOrigin; struct WindowFeatures; } @@ -81,24 +86,24 @@ public: virtual void setResizable(bool); virtual void addMessageToConsole( WebCore::MessageSource, WebCore::MessageType, WebCore::MessageLevel, - const WebCore::String& message, unsigned lineNumber, - const WebCore::String& sourceID); + const WTF::String& message, unsigned lineNumber, + const WTF::String& sourceID); virtual bool canRunBeforeUnloadConfirmPanel(); virtual bool runBeforeUnloadConfirmPanel( - const WebCore::String& message, WebCore::Frame*); + const WTF::String& message, WebCore::Frame*); virtual void closeWindowSoon(); - virtual void runJavaScriptAlert(WebCore::Frame*, const WebCore::String&); - virtual bool runJavaScriptConfirm(WebCore::Frame*, const WebCore::String&); + virtual void runJavaScriptAlert(WebCore::Frame*, const WTF::String&); + virtual bool runJavaScriptConfirm(WebCore::Frame*, const WTF::String&); virtual bool runJavaScriptPrompt( - WebCore::Frame*, const WebCore::String& message, - const WebCore::String& defaultValue, WebCore::String& result); - virtual void setStatusbarText(const WebCore::String& message); + WebCore::Frame*, const WTF::String& message, + const WTF::String& defaultValue, WTF::String& result); + virtual void setStatusbarText(const WTF::String& message); virtual bool shouldInterruptJavaScript(); virtual bool tabsToLinks() const; virtual WebCore::IntRect windowResizerRect() const; - virtual void repaint( - const WebCore::IntRect&, bool contentChanged, bool immediate = false, - bool repaintContentOnly = false); + virtual void invalidateWindow(const WebCore::IntRect&, bool); + virtual void invalidateContentsAndWindow(const WebCore::IntRect&, bool); + virtual void invalidateContentsForSlowScroll(const WebCore::IntRect&, bool); virtual void scroll( const WebCore::IntSize& scrollDelta, const WebCore::IntRect& rectToScroll, const WebCore::IntRect& clipRect); @@ -111,34 +116,66 @@ public: virtual void scrollbarsModeDidChange() const; virtual void mouseDidMoveOverElement( const WebCore::HitTestResult& result, unsigned modifierFlags); - virtual void setToolTip(const WebCore::String& tooltipText, WebCore::TextDirection); + virtual void setToolTip(const WTF::String& tooltipText, WebCore::TextDirection); virtual void print(WebCore::Frame*); virtual void exceededDatabaseQuota( - WebCore::Frame*, const WebCore::String& databaseName); + WebCore::Frame*, const WTF::String& databaseName); #if ENABLE(OFFLINE_WEB_APPLICATIONS) virtual void reachedMaxAppCacheSize(int64_t spaceNeeded); + virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*); #endif #if ENABLE(NOTIFICATIONS) virtual WebCore::NotificationPresenter* notificationPresenter() const; #endif - virtual void requestGeolocationPermissionForFrame( - WebCore::Frame*, WebCore::Geolocation*) { } + virtual void requestGeolocationPermissionForFrame(WebCore::Frame*, WebCore::Geolocation*); + virtual void cancelGeolocationPermissionRequestForFrame(WebCore::Frame*, WebCore::Geolocation*); virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>); - virtual bool setCursor(WebCore::PlatformCursorHandle) { return false; } + virtual void chooseIconForFiles(const Vector<WTF::String>&, WebCore::FileChooser*); + virtual void setCursor(const WebCore::Cursor&) { } virtual void formStateDidChange(const WebCore::Node*); virtual PassOwnPtr<WebCore::HTMLParserQuirks> createHTMLParserQuirks() { return 0; } +#if ENABLE(TOUCH_EVENTS) + // FIXME: All touch events are forwarded regardless of whether or not they are needed. + virtual void needTouchEvents(bool needTouchEvents) { } +#endif + +#if USE(ACCELERATED_COMPOSITING) + // Pass 0 as the GraphicsLayer to detatch the root layer. + virtual void attachRootGraphicsLayer(WebCore::Frame*, WebCore::GraphicsLayer*); + + // Sets a flag to specify that the next time content is drawn to the window, + // the changes appear on the screen in synchrony with updates to GraphicsLayers. + virtual void setNeedsOneShotDrawingSynchronization() { } + + // Sets a flag to specify that the view needs to be updated, so we need + // to do an eager layout before the drawing. + virtual void scheduleCompositingLayerSync(); +#endif + +#if USE(GLES2_RENDERING) + virtual PassOwnPtr<WebCore::GLES2Context> getOnscreenGLES2Context(); + virtual PassOwnPtr<WebCore::GLES2Context> getOffscreenGLES2Context(); +#endif + + virtual bool supportsFullscreenForNode(const WebCore::Node*); + virtual void enterFullscreenForNode(WebCore::Node*); + virtual void exitFullscreenForNode(WebCore::Node*); // ChromeClientChromium methods: virtual void popupOpened(WebCore::PopupContainer* popupContainer, const WebCore::IntRect& bounds, - bool activatable, bool handleExternally); + virtual void popupClosed(WebCore::PopupContainer* popupContainer); virtual void didChangeAccessibilityObjectState(WebCore::AccessibilityObject*); // ChromeClientImpl: void setCursor(const WebCursorInfo& cursor); void setCursorForPlugin(const WebCursorInfo& cursor); + virtual bool selectItemWritingDirectionIsNatural(); + virtual PassRefPtr<WebCore::PopupMenu> createPopupMenu(WebCore::PopupMenuClient*) const; + virtual PassRefPtr<WebCore::SearchPopupMenu> createSearchPopupMenu(WebCore::PopupMenuClient*) const; + private: void getPopupMenuInfo(WebCore::PopupContainer*, WebPopupMenuInfo*); @@ -148,8 +185,6 @@ private: bool m_scrollbarsVisible; bool m_menubarVisible; bool m_resizable; - // Set to true if the next SetCursor is to be ignored. - bool m_ignoreNextSetCursor; }; } // namespace WebKit diff --git a/WebKit/chromium/src/ChromiumBridge.cpp b/WebKit/chromium/src/ChromiumBridge.cpp index 0fd0825..33f405d 100644 --- a/WebKit/chromium/src/ChromiumBridge.cpp +++ b/WebKit/chromium/src/ChromiumBridge.cpp @@ -37,16 +37,22 @@ #include "ChromeClientImpl.h" #include "WebClipboard.h" #include "WebCookie.h" +#include "WebCookieJar.h" #include "WebCursorInfo.h" #include "WebData.h" +#include "WebDragData.h" +#include "WebFileUtilities.h" #include "WebFrameClient.h" #include "WebFrameImpl.h" +#include "WebIDBKey.h" #include "WebImage.h" #include "WebKit.h" #include "WebKitClient.h" #include "WebMimeRegistry.h" #include "WebPluginContainerImpl.h" #include "WebPluginListBuilderImpl.h" +#include "WebSandboxSupport.h" +#include "WebSerializedScriptValue.h" #include "WebScreenInfo.h" #include "WebString.h" #include "WebURL.h" @@ -57,13 +63,12 @@ #if OS(WINDOWS) #include "WebRect.h" -#include "WebSandboxSupport.h" #include "WebThemeEngine.h" #endif #if OS(LINUX) -#include "WebSandboxSupport.h" #include "WebFontInfo.h" +#include "WebFontRenderStyle.h" #endif #if WEBKIT_USING_SKIA @@ -74,10 +79,13 @@ #include "Cookie.h" #include "FrameView.h" #include "GraphicsContext.h" +#include "IDBFactoryBackendProxy.h" #include "KURL.h" #include "NotImplemented.h" #include "PlatformContextSkia.h" #include "PluginData.h" +#include "SharedBuffer.h" +#include "WebGeolocationServiceBridgeImpl.h" #include "Worker.h" #include "WorkerContextProxy.h" #include <wtf/Assertions.h> @@ -89,6 +97,9 @@ namespace WebCore { static ChromeClientImpl* toChromeClientImpl(Widget* widget) { + if (!widget) + return 0; + FrameView* view; if (widget->isFrameView()) view = static_cast<FrameView*>(widget); @@ -112,6 +123,24 @@ static WebWidgetClient* toWebWidgetClient(Widget* widget) return chromeClientImpl->webView()->client(); } +static WebCookieJar* getCookieJar(const Document* document) +{ + WebFrameImpl* frameImpl = WebFrameImpl::fromFrame(document->frame()); + if (!frameImpl || !frameImpl->client()) + return 0; + WebCookieJar* cookieJar = frameImpl->client()->cookieJar(); + if (!cookieJar) + cookieJar = webKitClient()->cookieJar(); + return cookieJar; +} + +// Cache ---------------------------------------------------------------------- + +void ChromiumBridge::cacheMetadata(const KURL& url, double responseTime, const Vector<char>& data) +{ + webKitClient()->cacheMetadata(url, responseTime, data.data(), data.size()); +} + // Clipboard ------------------------------------------------------------------ bool ChromiumBridge::clipboardIsFormatAvailable( @@ -171,27 +200,85 @@ void ChromiumBridge::clipboardWriteImage(NativeImagePtr image, webKitClient()->clipboard()->writeImage(webImage, sourceURL, title); } +void ChromiumBridge::clipboardWriteData(ClipboardData* data) +{ + notImplemented(); + WebDragData dragData; // FIXME: Define the conversion from ClipboardData to WebDragData. + webKitClient()->clipboard()->writeData(dragData); +} + +HashSet<String> ChromiumBridge::clipboardReadAvailableTypes( + PasteboardPrivate::ClipboardBuffer buffer, bool* containsFilenames) +{ + WebVector<WebString> result = webKitClient()->clipboard()->readAvailableTypes( + static_cast<WebClipboard::Buffer>(buffer), containsFilenames); + HashSet<String> types; + for (size_t i = 0; i < result.size(); ++i) + types.add(result[i]); + return types; +} + +bool ChromiumBridge::clipboardReadData(PasteboardPrivate::ClipboardBuffer buffer, + const String& type, String& data, String& metadata) +{ + WebString resultData; + WebString resultMetadata; + bool succeeded = webKitClient()->clipboard()->readData( + static_cast<WebClipboard::Buffer>(buffer), type, &resultData, &resultMetadata); + if (succeeded) { + data = resultData; + metadata = resultMetadata; + } + return succeeded; +} + +Vector<String> ChromiumBridge::clipboardReadFilenames(PasteboardPrivate::ClipboardBuffer buffer) +{ + WebVector<WebString> result = webKitClient()->clipboard()->readFilenames( + static_cast<WebClipboard::Buffer>(buffer)); + Vector<String> convertedResult; + for (size_t i = 0; i < result.size(); ++i) + convertedResult.append(result[i]); + return convertedResult; +} + // Cookies -------------------------------------------------------------------- -void ChromiumBridge::setCookies(const KURL& url, - const KURL& firstPartyForCookies, - const String& cookie) +void ChromiumBridge::setCookies(const Document* document, const KURL& url, + const String& value) +{ + WebCookieJar* cookieJar = getCookieJar(document); + if (cookieJar) + cookieJar->setCookie(url, document->firstPartyForCookies(), value); +} + +String ChromiumBridge::cookies(const Document* document, const KURL& url) { - webKitClient()->setCookies(url, firstPartyForCookies, cookie); + String result; + WebCookieJar* cookieJar = getCookieJar(document); + if (cookieJar) + result = cookieJar->cookies(url, document->firstPartyForCookies()); + return result; } -String ChromiumBridge::cookies(const KURL& url, - const KURL& firstPartyForCookies) +String ChromiumBridge::cookieRequestHeaderFieldValue(const Document* document, + const KURL& url) { - return webKitClient()->cookies(url, firstPartyForCookies); + String result; + WebCookieJar* cookieJar = getCookieJar(document); + if (cookieJar) + result = cookieJar->cookieRequestHeaderFieldValue(url, document->firstPartyForCookies()); + return result; } -bool ChromiumBridge::rawCookies(const KURL& url, const KURL& firstPartyForCookies, Vector<Cookie>* rawCookies) +bool ChromiumBridge::rawCookies(const Document* document, const KURL& url, Vector<Cookie>& rawCookies) { - rawCookies->clear(); + rawCookies.clear(); WebVector<WebCookie> webCookies; - if (!webKitClient()->rawCookies(url, firstPartyForCookies, &webCookies)) - return false; + + WebCookieJar* cookieJar = getCookieJar(document); + if (cookieJar) + cookieJar->rawCookies(url, document->firstPartyForCookies(), webCookies); for (unsigned i = 0; i < webCookies.size(); ++i) { const WebCookie& webCookie = webCookies[i]; @@ -203,20 +290,25 @@ bool ChromiumBridge::rawCookies(const KURL& url, const KURL& firstPartyForCookie webCookie.httpOnly, webCookie.secure, webCookie.session); - rawCookies->append(cookie); + rawCookies.append(cookie); } return true; } -void ChromiumBridge::deleteCookie(const KURL& url, const String& cookieName) +void ChromiumBridge::deleteCookie(const Document* document, const KURL& url, const String& cookieName) { - webKitClient()->deleteCookie(url, cookieName); + WebCookieJar* cookieJar = getCookieJar(document); + if (cookieJar) + cookieJar->deleteCookie(url, cookieName); } -bool ChromiumBridge::cookiesEnabled(const KURL& url, - const KURL& firstPartyForCookies) +bool ChromiumBridge::cookiesEnabled(const Document* document) { - return webKitClient()->cookiesEnabled(url, firstPartyForCookies); + bool result = false; + WebCookieJar* cookieJar = getCookieJar(document); + if (cookieJar) + result = cookieJar->cookiesEnabled(document->cookieURL(), document->firstPartyForCookies()); + return result; } // DNS ------------------------------------------------------------------------ @@ -230,57 +322,91 @@ void ChromiumBridge::prefetchDNS(const String& hostname) bool ChromiumBridge::fileExists(const String& path) { - return webKitClient()->fileExists(path); + return webKitClient()->fileUtilities()->fileExists(path); } bool ChromiumBridge::deleteFile(const String& path) { - return webKitClient()->deleteFile(path); + return webKitClient()->fileUtilities()->deleteFile(path); } bool ChromiumBridge::deleteEmptyDirectory(const String& path) { - return webKitClient()->deleteEmptyDirectory(path); + return webKitClient()->fileUtilities()->deleteEmptyDirectory(path); } bool ChromiumBridge::getFileSize(const String& path, long long& result) { - return webKitClient()->getFileSize(path, result); + return webKitClient()->fileUtilities()->getFileSize(path, result); } bool ChromiumBridge::getFileModificationTime(const String& path, time_t& result) { - return webKitClient()->getFileModificationTime(path, result); + double modificationTime; + if (!webKitClient()->fileUtilities()->getFileModificationTime(path, modificationTime)) + return false; + result = static_cast<time_t>(modificationTime); + return true; } String ChromiumBridge::directoryName(const String& path) { - return webKitClient()->directoryName(path); + return webKitClient()->fileUtilities()->directoryName(path); } String ChromiumBridge::pathByAppendingComponent(const String& path, const String& component) { - return webKitClient()->pathByAppendingComponent(path, component); + return webKitClient()->fileUtilities()->pathByAppendingComponent(path, component); } bool ChromiumBridge::makeAllDirectories(const String& path) { - return webKitClient()->makeAllDirectories(path); + return webKitClient()->fileUtilities()->makeAllDirectories(path); } String ChromiumBridge::getAbsolutePath(const String& path) { - return webKitClient()->getAbsolutePath(path); + return webKitClient()->fileUtilities()->getAbsolutePath(path); } bool ChromiumBridge::isDirectory(const String& path) { - return webKitClient()->isDirectory(path); + return webKitClient()->fileUtilities()->isDirectory(path); } KURL ChromiumBridge::filePathToURL(const String& path) { - return webKitClient()->filePathToURL(path); + return webKitClient()->fileUtilities()->filePathToURL(path); +} + +PlatformFileHandle ChromiumBridge::openFile(const String& path, FileOpenMode mode) +{ + return webKitClient()->fileUtilities()->openFile(path, mode); +} + +void ChromiumBridge::closeFile(PlatformFileHandle& handle) +{ + webKitClient()->fileUtilities()->closeFile(handle); +} + +long long ChromiumBridge::seekFile(PlatformFileHandle handle, long long offset, FileSeekOrigin origin) +{ + return webKitClient()->fileUtilities()->seekFile(handle, offset, origin); +} + +bool ChromiumBridge::truncateFile(PlatformFileHandle handle, long long offset) +{ + return webKitClient()->fileUtilities()->truncateFile(handle, offset); +} + +int ChromiumBridge::readFromFile(PlatformFileHandle handle, char* data, int length) +{ + return webKitClient()->fileUtilities()->readFromFile(handle, data, length); +} + +int ChromiumBridge::writeToFile(PlatformFileHandle handle, const char* data, int length) +{ + return webKitClient()->fileUtilities()->writeToFile(handle, data, length); } // Font ----------------------------------------------------------------------- @@ -308,14 +434,48 @@ String ChromiumBridge::getFontFamilyForCharacters(const UChar* characters, size_ return WebString(); } + +void ChromiumBridge::getRenderStyleForStrike(const char* font, int sizeAndStyle, FontRenderStyle* result) +{ + WebFontRenderStyle style; + + if (webKitClient()->sandboxSupport()) + webKitClient()->sandboxSupport()->getRenderStyleForStrike(font, sizeAndStyle, &style); + else + WebFontInfo::renderStyleForStrike(font, sizeAndStyle, &style); + + style.toFontRenderStyle(result); +} #endif -// HTML5 DB ------------------------------------------------------------------- +#if OS(DARWIN) +bool ChromiumBridge::loadFont(NSFont* srcFont, ATSFontContainerRef* out) +{ + WebSandboxSupport* ss = webKitClient()->sandboxSupport(); + if (ss) + return ss->loadFont(srcFont, out); + + // This function should only be called in response to an error loading a + // font due to being blocked by the sandbox. + // This by definition shouldn't happen if there is no sandbox support. + ASSERT_NOT_REACHED(); + *out = 0; + return false; +} +#endif + +// Geolocation ---------------------------------------------------------------- + +GeolocationServiceBridge* ChromiumBridge::createGeolocationServiceBridge(GeolocationServiceChromium* geolocationServiceChromium) +{ + return createGeolocationServiceBridgeImpl(geolocationServiceChromium); +} + +// Databases ------------------------------------------------------------------ -#if ENABLE(DATABASE) -PlatformFileHandle ChromiumBridge::databaseOpenFile(const String& vfsFileName, int desiredFlags, PlatformFileHandle* dirHandle) +PlatformFileHandle ChromiumBridge::databaseOpenFile(const String& vfsFileName, int desiredFlags) { - return webKitClient()->databaseOpenFile(WebString(vfsFileName), desiredFlags, dirHandle); + return webKitClient()->databaseOpenFile(WebString(vfsFileName), desiredFlags); } int ChromiumBridge::databaseDeleteFile(const String& vfsFileName, bool syncDir) @@ -332,7 +492,27 @@ long long ChromiumBridge::databaseGetFileSize(const String& vfsFileName) { return webKitClient()->databaseGetFileSize(WebString(vfsFileName)); } -#endif + +// Indexed Database ----------------------------------------------------------- + +PassRefPtr<IDBFactoryBackendInterface> ChromiumBridge::idbFactory() +{ + // There's no reason why we need to allocate a new proxy each time, but + // there's also no strong reason not to. + return IDBFactoryBackendProxy::create(); +} + +void ChromiumBridge::createIDBKeysFromSerializedValuesAndKeyPath(const Vector<RefPtr<SerializedScriptValue> >& values, const String& keyPath, Vector<RefPtr<IDBKey> >& keys) +{ + WebVector<WebSerializedScriptValue> webValues = values; + WebVector<WebIDBKey> webKeys; + webKitClient()->createIDBKeysFromSerializedValuesAndKeyPath(webValues, WebString(keyPath), webKeys); + + size_t webKeysSize = webKeys.size(); + keys.reserveCapacity(webKeysSize); + for (size_t i = 0; i < webKeysSize; ++i) + keys.append(PassRefPtr<IDBKey>(webKeys[i])); +} // Keygen --------------------------------------------------------------------- @@ -395,7 +575,7 @@ String ChromiumBridge::preferredExtensionForMIMEType(const String& mimeType) // Plugin --------------------------------------------------------------------- -bool ChromiumBridge::plugins(bool refresh, Vector<PluginInfo*>* results) +bool ChromiumBridge::plugins(bool refresh, Vector<PluginInfo>* results) { WebPluginListBuilderImpl builder(results); webKitClient()->getPluginList(refresh, &builder); @@ -523,6 +703,14 @@ void ChromiumBridge::paintScrollbarTrack( alignRect); } +void ChromiumBridge::paintSpinButton( + GraphicsContext* gc, int part, int state, int classicState, + const IntRect& rect) +{ + webKitClient()->themeEngine()->paintSpinButton( + gc->platformContext()->canvas(), part, state, classicState, rect); +} + void ChromiumBridge::paintTextField( GraphicsContext* gc, int part, int state, int classicState, const IntRect& rect, const Color& color, bool fillContentArea, @@ -544,6 +732,13 @@ void ChromiumBridge::paintTrackbar( gc->platformContext()->canvas(), part, state, classicState, rect); } +void ChromiumBridge::paintProgressBar( + GraphicsContext* gc, const IntRect& barRect, const IntRect& valueRect, bool determinate, double animatedSeconds) +{ + webKitClient()->themeEngine()->paintProgressBar( + gc->platformContext()->canvas(), barRect, valueRect, determinate, animatedSeconds); +} + #endif // Trace Event ---------------------------------------------------------------- @@ -681,13 +876,6 @@ void ChromiumBridge::widgetSetCursor(Widget* widget, const Cursor& cursor) client->setCursor(WebCursorInfo(cursor)); } -void ChromiumBridge::widgetSetFocus(Widget* widget) -{ - ChromeClientImpl* client = toChromeClientImpl(widget); - if (client) - client->focus(); -} - WorkerContextProxy* WorkerContextProxy::create(Worker* worker) { return WebWorkerClientImpl::createWorkerContextProxy(worker); diff --git a/WebKit/chromium/src/ChromiumThreading.cpp b/WebKit/chromium/src/ChromiumThreading.cpp index 902a433..c6fefac 100644 --- a/WebKit/chromium/src/ChromiumThreading.cpp +++ b/WebKit/chromium/src/ChromiumThreading.cpp @@ -38,13 +38,9 @@ namespace WTF { -void ChromiumThreading::initializeMainThread() +void ChromiumThreading::callOnMainThread(void (*func)(void*), void* context) { -} - -void ChromiumThreading::scheduleDispatchFunctionsOnMainThread() -{ - WebKit::webKitClient()->callOnMainThread(&WTF::dispatchFunctionsFromMainThread); + WebKit::webKitClient()->callOnMainThread(func, context); } } // namespace WTF diff --git a/WebKit/chromium/src/CompositionUnderlineBuilder.h b/WebKit/chromium/src/CompositionUnderlineBuilder.h new file mode 100644 index 0000000..ce62474 --- /dev/null +++ b/WebKit/chromium/src/CompositionUnderlineBuilder.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef CompositionUnderlineBuilder_h +#define CompositionUnderlineBuilder_h + +#include "Editor.h" +#include "Vector.h" +#include "WebCompositionUnderline.h" +#include "WebVector.h" + +namespace WebKit { + +// This class is used for converting from WebCompositionUnderline to +// WebCore::CompositionUnderline. + +class CompositionUnderlineBuilder : public WebCore::CompositionUnderline { +public: + CompositionUnderlineBuilder(const WebCompositionUnderline& u) + : WebCore::CompositionUnderline(u.startOffset, u.endOffset, + WebCore::Color(u.color), u.thick) { } +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/src/ProfilerAgentImpl.cpp b/WebKit/chromium/src/CompositionUnderlineVectorBuilder.cpp index 07570df..55dca85 100644 --- a/WebKit/chromium/src/ProfilerAgentImpl.cpp +++ b/WebKit/chromium/src/CompositionUnderlineVectorBuilder.cpp @@ -29,24 +29,21 @@ */ #include "config.h" -#include "ProfilerAgentImpl.h" +#include "CompositionUnderlineVectorBuilder.h" -#include <v8.h> +#include "CompositionUnderlineBuilder.h" -namespace WebKit { +using namespace WebCore; -void ProfilerAgentImpl::getActiveProfilerModules() -{ - m_delegate->didGetActiveProfilerModules(v8::V8::GetActiveProfilerModules()); -} +namespace WebKit { -void ProfilerAgentImpl::getLogLines(int position) +CompositionUnderlineVectorBuilder::CompositionUnderlineVectorBuilder( + const WebVector<WebCompositionUnderline>& underlines) { - static char buffer[65536]; - const int readSize = v8::V8::GetLogLines(position, buffer, sizeof(buffer) - 1); - buffer[readSize] = '\0'; - position += readSize; - m_delegate->didGetLogLines(position, buffer); + size_t size = underlines.size(); + reserveCapacity(size); + for (size_t i = 0; i < size; ++i) + append(CompositionUnderlineBuilder(underlines[i])); } } // namespace WebKit diff --git a/WebKit/chromium/src/CompositionUnderlineVectorBuilder.h b/WebKit/chromium/src/CompositionUnderlineVectorBuilder.h new file mode 100644 index 0000000..8050f02 --- /dev/null +++ b/WebKit/chromium/src/CompositionUnderlineVectorBuilder.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef CompositionUnderlineVectorBuilder_h +#define CompositionUnderlineVectorBuilder_h + +#include "Editor.h" +#include "Vector.h" +#include "WebCompositionUnderline.h" +#include "WebVector.h" + +namespace WebKit { + +// This classes are used for converting from std::vector<WebCompositionUnderline> +// to Vector<WebCore::CompositionUnderline>. + +class CompositionUnderlineVectorBuilder : + public Vector<WebCore::CompositionUnderline> { +public: + CompositionUnderlineVectorBuilder( + const WebVector<WebCompositionUnderline>&); +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/src/ContextMenuClientImpl.cpp b/WebKit/chromium/src/ContextMenuClientImpl.cpp index 8472082..1dc2ee7 100644 --- a/WebKit/chromium/src/ContextMenuClientImpl.cpp +++ b/WebKit/chromium/src/ContextMenuClientImpl.cpp @@ -46,6 +46,7 @@ #include "KURL.h" #include "MediaError.h" #include "PlatformString.h" +#include "RenderWidget.h" #include "TextBreakIterator.h" #include "Widget.h" @@ -53,6 +54,8 @@ #include "WebDataSourceImpl.h" #include "WebFrameImpl.h" #include "WebMenuItemInfo.h" +#include "WebPlugin.h" +#include "WebPluginContainerImpl.h" #include "WebPoint.h" #include "WebString.h" #include "WebURL.h" @@ -147,13 +150,28 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems( WebContextMenuData data; data.mousePosition = selectedFrame->view()->contentsToWindow(r.point()); + // Compute edit flags. + data.editFlags = WebContextMenuData::CanDoNone; + if (m_webView->focusedWebCoreFrame()->editor()->canUndo()) + data.editFlags |= WebContextMenuData::CanUndo; + if (m_webView->focusedWebCoreFrame()->editor()->canRedo()) + data.editFlags |= WebContextMenuData::CanRedo; + if (m_webView->focusedWebCoreFrame()->editor()->canCut()) + data.editFlags |= WebContextMenuData::CanCut; + if (m_webView->focusedWebCoreFrame()->editor()->canCopy()) + data.editFlags |= WebContextMenuData::CanCopy; + if (m_webView->focusedWebCoreFrame()->editor()->canPaste()) + data.editFlags |= WebContextMenuData::CanPaste; + if (m_webView->focusedWebCoreFrame()->editor()->canDelete()) + data.editFlags |= WebContextMenuData::CanDelete; + // We can always select all... + data.editFlags |= WebContextMenuData::CanSelectAll; + data.editFlags |= WebContextMenuData::CanTranslate; + // Links, Images, Media tags, and Image/Media-Links take preference over // all else. data.linkURL = r.absoluteLinkURL(); - data.mediaType = WebContextMenuData::MediaTypeNone; - data.mediaFlags = WebContextMenuData::MediaNone; - if (!r.absoluteImageURL().isEmpty()) { data.srcURL = r.absoluteImageURL(); data.mediaType = WebContextMenuData::MediaTypeImage; @@ -181,10 +199,33 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems( data.mediaFlags |= WebContextMenuData::MediaCanSave; if (mediaElement->hasAudio()) data.mediaFlags |= WebContextMenuData::MediaHasAudio; + if (mediaElement->hasVideo()) + data.mediaFlags |= WebContextMenuData::MediaHasVideo; + if (mediaElement->controls()) + data.mediaFlags |= WebContextMenuData::MediaControls; + } else if (r.innerNonSharedNode()->hasTagName(HTMLNames::objectTag) + || r.innerNonSharedNode()->hasTagName(HTMLNames::embedTag)) { + RenderObject* object = r.innerNonSharedNode()->renderer(); + if (object && object->isWidget()) { + Widget* widget = toRenderWidget(object)->widget(); + if (widget) { + WebPluginContainerImpl* plugin = static_cast<WebPluginContainerImpl*>(widget); + WebString text = plugin->plugin()->selectionAsText(); + if (!text.isEmpty()) { + data.selectedText = text; + data.editFlags |= WebContextMenuData::CanCopy; + } + data.editFlags &= ~WebContextMenuData::CanTranslate; + } + } } + + data.isImageBlocked = + (data.mediaType == WebContextMenuData::MediaTypeImage) && !r.image(); + // If it's not a link, an image, a media element, or an image/media link, // show a selection menu or a more generic page menu. - data.frameEncoding = selectedFrame->loader()->encoding(); + data.frameEncoding = selectedFrame->loader()->writer()->encoding(); // Send the frame and page URLs in any case. data.pageURL = urlFromFrame(m_webView->mainFrameImpl()->frame()); @@ -194,21 +235,17 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems( if (r.isSelected()) data.selectedText = selectedFrame->selectedText().stripWhiteSpace(); - data.isEditable = false; if (r.isContentEditable()) { data.isEditable = true; if (m_webView->focusedWebCoreFrame()->editor()->isContinuousSpellCheckingEnabled()) { data.isSpellCheckingEnabled = true; - data.misspelledWord = selectMisspelledWord(defaultMenu, selectedFrame); + // Spellchecking might be enabled for the field, but could be disabled on the node. + if (m_webView->focusedWebCoreFrame()->editor()->spellCheckingEnabledInFocusedNode()) + data.misspelledWord = selectMisspelledWord(defaultMenu, selectedFrame); } } #if OS(DARWIN) - // Writing direction context menu. - data.writingDirectionDefault = WebContextMenuData::CheckableMenuItemDisabled; - data.writingDirectionLeftToRight = WebContextMenuData::CheckableMenuItemEnabled; - data.writingDirectionRightToLeft = WebContextMenuData::CheckableMenuItemEnabled; - ExceptionCode ec = 0; RefPtr<CSSStyleDeclaration> style = selectedFrame->document()->createCSSStyleDeclaration(); style->setProperty(CSSPropertyDirection, "ltr", false, ec); @@ -225,23 +262,6 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems( if (ds) data.securityInfo = ds->response().securityInfo(); - // Compute edit flags. - data.editFlags = WebContextMenuData::CanDoNone; - if (m_webView->focusedWebCoreFrame()->editor()->canUndo()) - data.editFlags |= WebContextMenuData::CanUndo; - if (m_webView->focusedWebCoreFrame()->editor()->canRedo()) - data.editFlags |= WebContextMenuData::CanRedo; - if (m_webView->focusedWebCoreFrame()->editor()->canCut()) - data.editFlags |= WebContextMenuData::CanCut; - if (m_webView->focusedWebCoreFrame()->editor()->canCopy()) - data.editFlags |= WebContextMenuData::CanCopy; - if (m_webView->focusedWebCoreFrame()->editor()->canPaste()) - data.editFlags |= WebContextMenuData::CanPaste; - if (m_webView->focusedWebCoreFrame()->editor()->canDelete()) - data.editFlags |= WebContextMenuData::CanDelete; - // We can always select all... - data.editFlags |= WebContextMenuData::CanSelectAll; - // Filter out custom menu elements and add them into the data. populateCustomMenuItems(defaultMenu, &data); @@ -257,7 +277,7 @@ void ContextMenuClientImpl::populateCustomMenuItems(WebCore::ContextMenu* defaul Vector<WebMenuItemInfo> customItems; for (size_t i = 0; i < defaultMenu->itemCount(); ++i) { ContextMenuItem* inputItem = defaultMenu->itemAtIndex(i, defaultMenu->platformDescription()); - if (inputItem->action() < ContextMenuItemBaseCustomTag || inputItem->action() >= ContextMenuItemBaseApplicationTag) + if (inputItem->action() < ContextMenuItemBaseCustomTag || inputItem->action() > ContextMenuItemLastCustomTag) continue; WebMenuItemInfo outputItem; diff --git a/WebKit/chromium/src/ContextMenuClientImpl.h b/WebKit/chromium/src/ContextMenuClientImpl.h index 4191fad..97ea967 100644 --- a/WebKit/chromium/src/ContextMenuClientImpl.h +++ b/WebKit/chromium/src/ContextMenuClientImpl.h @@ -51,7 +51,7 @@ public: virtual void lookUpInDictionary(WebCore::Frame*) {} virtual void searchWithGoogle(const WebCore::Frame*) {} virtual bool shouldIncludeInspectElementItem() { return false; } - virtual void speak(const WebCore::String&) {} + virtual void speak(const WTF::String&) {} virtual void stopSpeaking() {} private: void populateCustomMenuItems(WebCore::ContextMenu*, WebContextMenuData*); diff --git a/WebKit/chromium/src/DOMUtilitiesPrivate.h b/WebKit/chromium/src/DOMUtilitiesPrivate.h index 253ab3f..f5d03a5 100644 --- a/WebKit/chromium/src/DOMUtilitiesPrivate.h +++ b/WebKit/chromium/src/DOMUtilitiesPrivate.h @@ -31,6 +31,8 @@ #ifndef DOMUtilitiesPrivate_h #define DOMUtilitiesPrivate_h +#include <wtf/Forward.h> + namespace WebCore { class Element; class HTMLInputElement; @@ -39,7 +41,6 @@ class HTMLMetaElement; class HTMLOptionElement; class Node; class QualifiedName; -class String; } // This file is an aggregate of useful WebCore operations. @@ -53,7 +54,7 @@ WebCore::HTMLMetaElement* toHTMLMetaElement(WebCore::Node*); WebCore::HTMLOptionElement* toHTMLOptionElement(WebCore::Node*); // FIXME: Deprecate. Use WebInputElement::nameForAutofill instead. -WebCore::String nameOfInputElement(WebCore::HTMLInputElement*); +WTF::String nameOfInputElement(WebCore::HTMLInputElement*); // For img, script, iframe, frame element, when attribute name is src, // for link, a, area element, when attribute name is href, diff --git a/WebKit/chromium/src/DatabaseObserver.cpp b/WebKit/chromium/src/DatabaseObserver.cpp index 54e93e1..f43c9bd 100644 --- a/WebKit/chromium/src/DatabaseObserver.cpp +++ b/WebKit/chromium/src/DatabaseObserver.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Google Inc. All rights reserved. + * 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 @@ -31,30 +31,60 @@ #include "config.h" #include "DatabaseObserver.h" -#include "Database.h" +#if ENABLE(DATABASE) + +#include "AbstractDatabase.h" +#include "Document.h" +#include "ScriptExecutionContext.h" #include "WebDatabase.h" #include "WebDatabaseObserver.h" +#include "WebFrameClient.h" +#include "WebFrameImpl.h" +#include "WebSecurityOrigin.h" +#include "WebWorkerImpl.h" +#include "WorkerContext.h" +#include "WorkerThread.h" using namespace WebKit; namespace WebCore { -void DatabaseObserver::databaseOpened(Database* database) +bool DatabaseObserver::canEstablishDatabase(ScriptExecutionContext* scriptExecutionContext, const String& name, const String& displayName, unsigned long estimatedSize) +{ + ASSERT(scriptExecutionContext->isContextThread()); + ASSERT(scriptExecutionContext->isDocument() || scriptExecutionContext->isWorkerContext()); + if (scriptExecutionContext->isDocument()) { + Document* document = static_cast<Document*>(scriptExecutionContext); + WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame()); + return webFrame->client()->allowDatabase(webFrame, name, displayName, estimatedSize); + } else { + WorkerContext* workerContext = static_cast<WorkerContext*>(scriptExecutionContext); + WorkerLoaderProxy* workerLoaderProxy = &workerContext->thread()->workerLoaderProxy(); + WebWorkerBase* webWorker = static_cast<WebWorkerBase*>(workerLoaderProxy); + return webWorker->allowDatabase(0, name, displayName, estimatedSize); + } + + return true; +} + +void DatabaseObserver::databaseOpened(AbstractDatabase* database) { - ASSERT(isMainThread()); + ASSERT(database->scriptExecutionContext()->isContextThread()); WebDatabase::observer()->databaseOpened(WebDatabase(database)); } -void DatabaseObserver::databaseModified(Database* database) +void DatabaseObserver::databaseModified(AbstractDatabase* database) { - ASSERT(isMainThread()); + ASSERT(database->scriptExecutionContext()->isContextThread()); WebDatabase::observer()->databaseModified(WebDatabase(database)); } -void DatabaseObserver::databaseClosed(Database* database) +void DatabaseObserver::databaseClosed(AbstractDatabase* database) { - ASSERT(isMainThread()); + ASSERT(database->scriptExecutionContext()->isContextThread()); WebDatabase::observer()->databaseClosed(WebDatabase(database)); } } // namespace WebCore + +#endif // ENABLE(DATABASE) diff --git a/WebKit/chromium/src/DebuggerAgentImpl.cpp b/WebKit/chromium/src/DebuggerAgentImpl.cpp index d592710..46c6e7c 100644 --- a/WebKit/chromium/src/DebuggerAgentImpl.cpp +++ b/WebKit/chromium/src/DebuggerAgentImpl.cpp @@ -32,38 +32,21 @@ #include "DebuggerAgentImpl.h" #include "DebuggerAgentManager.h" -#include "Document.h" -#include "Frame.h" -#include "Page.h" -#include "V8Binding.h" -#include "V8DOMWindow.h" -#include "V8Index.h" -#include "V8Proxy.h" +#include "WebDevToolsAgentClient.h" #include "WebDevToolsAgentImpl.h" #include "WebViewImpl.h" -#include <wtf/HashSet.h> -#include <wtf/RefPtr.h> -#include <wtf/Vector.h> -using WebCore::DOMWindow; -using WebCore::Document; -using WebCore::Frame; -using WebCore::Page; -using WebCore::String; -using WebCore::V8ClassIndex; -using WebCore::V8DOMWindow; -using WebCore::V8DOMWrapper; -using WebCore::V8Proxy; +using WTF::String; namespace WebKit { DebuggerAgentImpl::DebuggerAgentImpl( WebViewImpl* webViewImpl, - DebuggerAgentDelegate* delegate, - WebDevToolsAgentImpl* webdevtoolsAgent) + WebDevToolsAgentImpl* webdevtoolsAgent, + WebDevToolsAgentClient* webdevtoolsAgentClient) : m_webViewImpl(webViewImpl) - , m_delegate(delegate) , m_webdevtoolsAgent(webdevtoolsAgent) + , m_webdevtoolsAgentClient(webdevtoolsAgentClient) , m_autoContinueOnException(false) { DebuggerAgentManager::debugAttach(this); @@ -74,127 +57,12 @@ DebuggerAgentImpl::~DebuggerAgentImpl() DebuggerAgentManager::debugDetach(this); } -void DebuggerAgentImpl::getContextId() -{ - m_delegate->setContextId(m_webdevtoolsAgent->hostId()); -} - -void DebuggerAgentImpl::processDebugCommands() -{ - DebuggerAgentManager::UtilityContextScope utilityScope; - v8::Debug::ProcessDebugMessages(); -} - void DebuggerAgentImpl::debuggerOutput(const String& command) { - m_delegate->debuggerOutput(command); + m_webdevtoolsAgentClient->sendDebuggerOutput(command); m_webdevtoolsAgent->forceRepaint(); } -// static -void DebuggerAgentImpl::createUtilityContext(Frame* frame, v8::Persistent<v8::Context>* context) -{ - v8::HandleScope scope; - bool canExecuteScripts = frame->script()->canExecuteScripts(); - - // Set up the DOM window as the prototype of the new global object. - v8::Handle<v8::Context> windowContext = V8Proxy::context(frame); - v8::Handle<v8::Object> windowGlobal; - v8::Handle<v8::Object> windowWrapper; - if (canExecuteScripts) { - // FIXME: This check prevents renderer from crashing, while providing limited capabilities for - // DOM inspection, Resources tracking, no scripts support, some timeline profiling. Console will - // result in exceptions for each evaluation. There is still some work that needs to be done in - // order to polish the script-less experience. - windowGlobal = windowContext->Global(); - windowWrapper = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), windowGlobal); - ASSERT(V8DOMWindow::toNative(windowWrapper) == frame->domWindow()); - } - - v8::Handle<v8::ObjectTemplate> globalTemplate = v8::ObjectTemplate::New(); - - // TODO(yurys): provide a function in v8 bindings that would make the - // utility context more like main world context of the inspected frame, - // otherwise we need to manually make it satisfy various invariants - // that V8Proxy::getEntered and some other V8Proxy methods expect to find - // on v8 contexts on the contexts stack. - // See V8Proxy::createNewContext. - // - // Install a security handler with V8. - globalTemplate->SetAccessCheckCallbacks( - V8DOMWindow::namedSecurityCheck, - V8DOMWindow::indexedSecurityCheck, - v8::Integer::New(V8ClassIndex::DOMWINDOW)); - // We set number of internal fields to match that in V8DOMWindow wrapper. - // See http://crbug.com/28961 - globalTemplate->SetInternalFieldCount(V8DOMWindow::internalFieldCount); - - *context = v8::Context::New(0 /* no extensions */, globalTemplate, v8::Handle<v8::Object>()); - v8::Context::Scope contextScope(*context); - v8::Handle<v8::Object> global = (*context)->Global(); - - v8::Handle<v8::String> implicitProtoString = v8::String::New("__proto__"); - if (canExecuteScripts) - global->Set(implicitProtoString, windowWrapper); - - // Give the code running in the new context a way to get access to the - // original context. - if (canExecuteScripts) - global->Set(v8::String::New("contentWindow"), windowGlobal); -} - -String DebuggerAgentImpl::executeUtilityFunction( - v8::Handle<v8::Context> context, - int callId, - const char* object, - const String &functionName, - const String& jsonArgs, - bool async, - String* exception) -{ - v8::HandleScope scope; - ASSERT(!context.IsEmpty()); - if (context.IsEmpty()) { - *exception = "No window context."; - return ""; - } - v8::Context::Scope contextScope(context); - - DebuggerAgentManager::UtilityContextScope utilityScope; - - v8::Handle<v8::Object> dispatchObject = v8::Handle<v8::Object>::Cast( - context->Global()->Get(v8::String::New(object))); - - v8::Handle<v8::Value> dispatchFunction = dispatchObject->Get(v8::String::New("dispatch")); - ASSERT(dispatchFunction->IsFunction()); - v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(dispatchFunction); - - v8::Handle<v8::String> functionNameWrapper = v8::Handle<v8::String>( - v8::String::New(functionName.utf8().data())); - v8::Handle<v8::String> jsonArgsWrapper = v8::Handle<v8::String>( - v8::String::New(jsonArgs.utf8().data())); - v8::Handle<v8::Number> callIdWrapper = v8::Handle<v8::Number>( - v8::Number::New(async ? callId : 0)); - - v8::Handle<v8::Value> args[] = { - functionNameWrapper, - jsonArgsWrapper, - callIdWrapper - }; - - v8::TryCatch tryCatch; - v8::Handle<v8::Value> resObj = function->Call(context->Global(), 3, args); - if (tryCatch.HasCaught()) { - v8::Local<v8::Message> message = tryCatch.Message(); - if (message.IsEmpty()) - *exception = "Unknown exception"; - else - *exception = WebCore::toWebCoreString(message->Get()); - return ""; - } - return WebCore::toWebCoreStringWithNullCheck(resObj); -} - WebCore::Page* DebuggerAgentImpl::page() { return m_webViewImpl->page(); diff --git a/WebKit/chromium/src/DebuggerAgentImpl.h b/WebKit/chromium/src/DebuggerAgentImpl.h index 6eaf576..a8fcc4e 100644 --- a/WebKit/chromium/src/DebuggerAgentImpl.h +++ b/WebKit/chromium/src/DebuggerAgentImpl.h @@ -31,58 +31,31 @@ #ifndef DebuggerAgentImpl_h #define DebuggerAgentImpl_h -#include "DebuggerAgent.h" - -#include <v8.h> -#include <wtf/HashSet.h> -#include <wtf/Noncopyable.h> +#include <wtf/Forward.h> namespace WebCore { -class Document; -class Frame; -class Node; class Page; -class String; } namespace WebKit { +class WebDevToolsAgentClient; class WebDevToolsAgentImpl; class WebViewImpl; -class DebuggerAgentImpl : public DebuggerAgent { +class DebuggerAgentImpl { public: - // Creates utility context with injected js agent. - static void createUtilityContext(WebCore::Frame* frame, v8::Persistent<v8::Context>* context); - DebuggerAgentImpl(WebKit::WebViewImpl* webViewImpl, - DebuggerAgentDelegate* delegate, - WebDevToolsAgentImpl* webdevtoolsAgent); + WebDevToolsAgentImpl* webdevtoolsAgent, + WebDevToolsAgentClient* webdevtoolsAgentClient); virtual ~DebuggerAgentImpl(); - // DebuggerAgent implementation. - virtual void getContextId(); - virtual void processDebugCommands(); - - void debuggerOutput(const WebCore::String& out); + void debuggerOutput(const WTF::String& out); void setAutoContinueOnException(bool autoContinue) { m_autoContinueOnException = autoContinue; } bool autoContinueOnException() { return m_autoContinueOnException; } - // Executes function with the given name in the utility context. Passes node - // and json args as parameters. Note that the function called must be - // implemented in the inject_dispatch.js file. - WebCore::String executeUtilityFunction( - v8::Handle<v8::Context> context, - int callId, - const char* object, - const WebCore::String& functionName, - const WebCore::String& jsonArgs, - bool async, - WebCore::String* exception); - - WebCore::Page* page(); WebDevToolsAgentImpl* webdevtoolsAgent() { return m_webdevtoolsAgent; } @@ -90,8 +63,8 @@ public: private: WebKit::WebViewImpl* m_webViewImpl; - DebuggerAgentDelegate* m_delegate; WebDevToolsAgentImpl* m_webdevtoolsAgent; + WebDevToolsAgentClient* m_webdevtoolsAgentClient; bool m_autoContinueOnException; }; diff --git a/WebKit/chromium/src/DebuggerAgentManager.cpp b/WebKit/chromium/src/DebuggerAgentManager.cpp index faafaff..dfc186c 100644 --- a/WebKit/chromium/src/DebuggerAgentManager.cpp +++ b/WebKit/chromium/src/DebuggerAgentManager.cpp @@ -34,6 +34,7 @@ #include "DebuggerAgentImpl.h" #include "Frame.h" #include "PageGroupLoadDeferrer.h" +#include "ScriptDebugServer.h" #include "V8Proxy.h" #include "WebDevToolsAgentImpl.h" #include "WebFrameImpl.h" @@ -49,9 +50,7 @@ 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 { @@ -116,6 +115,8 @@ DebuggerAgentManager::AttachedAgentsMap* DebuggerAgentManager::s_attachedAgentsM void DebuggerAgentManager::debugAttach(DebuggerAgentImpl* debuggerAgent) { + if (!s_exposeV8DebuggerProtocol) + return; if (!s_attachedAgentsMap) { s_attachedAgentsMap = new AttachedAgentsMap(); v8::Debug::SetMessageHandler2(&DebuggerAgentManager::onV8DebugMessage); @@ -128,6 +129,8 @@ void DebuggerAgentManager::debugAttach(DebuggerAgentImpl* debuggerAgent) void DebuggerAgentManager::debugDetach(DebuggerAgentImpl* debuggerAgent) { + if (!s_exposeV8DebuggerProtocol) + return; if (!s_attachedAgentsMap) { ASSERT_NOT_REACHED(); return; @@ -150,7 +153,7 @@ void DebuggerAgentManager::debugDetach(DebuggerAgentImpl* debuggerAgent) } } else { // Remove all breakpoints set by the agent. - String clearBreakpointGroupCmd = String::format( + WTF::String clearBreakpointGroupCmd = WTF::String::format( "{\"seq\":1,\"type\":\"request\",\"command\":\"clearbreakpointgroup\"," "\"arguments\":{\"groupId\":%d}}", hostId); @@ -169,7 +172,7 @@ void DebuggerAgentManager::onV8DebugMessage(const v8::Debug::Message& message) { v8::HandleScope scope; v8::String::Value value(message.GetJSON()); - String out(reinterpret_cast<const UChar*>(*value), value.length()); + WTF::String out(reinterpret_cast<const UChar*>(*value), value.length()); // If callerData is not 0 the message is a response to a debugger command. if (v8::Debug::ClientData* callerData = message.GetClientData()) { @@ -201,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; } } @@ -235,13 +230,10 @@ 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 String& command, int callerId) +void DebuggerAgentManager::executeDebuggerCommand(const WTF::String& command, int callerId) { sendCommandToV8(command, new CallerIdWrapper(callerId)); } @@ -251,6 +243,12 @@ void DebuggerAgentManager::setMessageLoopDispatchHandler(WebDevToolsAgent::Messa s_messageLoopDispatchHandler = handler; } +void DebuggerAgentManager::setExposeV8DebuggerProtocol(bool value) +{ + s_exposeV8DebuggerProtocol = value; + WebCore::ScriptDebugServer::shared().setEnabled(!s_exposeV8DebuggerProtocol); +} + void DebuggerAgentManager::setHostId(WebFrameImpl* webframe, int hostId) { ASSERT(hostId > 0); @@ -273,14 +271,14 @@ void DebuggerAgentManager::onNavigate() DebuggerAgentManager::sendContinueCommandToV8(); } -void DebuggerAgentManager::sendCommandToV8(const String& cmd, v8::Debug::ClientData* data) +void DebuggerAgentManager::sendCommandToV8(const WTF::String& cmd, v8::Debug::ClientData* data) { v8::Debug::SendCommand(reinterpret_cast<const uint16_t*>(cmd.characters()), cmd.length(), data); } void DebuggerAgentManager::sendContinueCommandToV8() { - String continueCmd("{\"seq\":1,\"type\":\"request\",\"command\":\"continue\"}"); + WTF::String continueCmd("{\"seq\":1,\"type\":\"request\",\"command\":\"continue\"}"); sendCommandToV8(continueCmd, new CallerIdWrapper()); } diff --git a/WebKit/chromium/src/DebuggerAgentManager.h b/WebKit/chromium/src/DebuggerAgentManager.h index a2e9030..66bd714 100644 --- a/WebKit/chromium/src/DebuggerAgentManager.h +++ b/WebKit/chromium/src/DebuggerAgentManager.h @@ -31,14 +31,17 @@ #ifndef DebuggerAgentManager_h #define DebuggerAgentManager_h +#include "WebCString.h" #include "WebDevToolsAgent.h" #include <v8-debug.h> +#include <wtf/Forward.h> #include <wtf/HashMap.h> #include <wtf/Noncopyable.h> +#include <wtf/Vector.h> namespace WebCore { +class Page; class PageGroupLoadDeferrer; -class String; } namespace WebKit { @@ -65,8 +68,9 @@ public: static void debugAttach(DebuggerAgentImpl* debuggerAgent); static void debugDetach(DebuggerAgentImpl* debuggerAgent); static void pauseScript(); - static void executeDebuggerCommand(const WebCore::String& command, int callerId); + static void executeDebuggerCommand(const WTF::String& command, int callerId); static void setMessageLoopDispatchHandler(WebDevToolsAgent::MessageLoopDispatchHandler handler); + static void setExposeV8DebuggerProtocol(bool); // Sets |hostId| as the frame context data. This id is used to filter scripts // related to the inspected page. @@ -76,30 +80,13 @@ 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(); static void debugHostDispatchHandler(); static void onV8DebugMessage(const v8::Debug::Message& message); - static void sendCommandToV8(const WebCore::String& cmd, + static void sendCommandToV8(const WTF::String& cmd, v8::Debug::ClientData* data); static void sendContinueCommandToV8(); @@ -114,8 +101,7 @@ private: typedef HashMap<WebViewImpl*, WebCore::PageGroupLoadDeferrer*> DeferrersMap; static DeferrersMap s_pageDeferrers; - static bool s_inUtilityContext; - static bool s_debugBreakDelayed; + static bool s_exposeV8DebuggerProtocol; }; } // namespace WebKit diff --git a/WebKit/chromium/src/DevToolsRPC.h b/WebKit/chromium/src/DevToolsRPC.h deleted file mode 100644 index 7176821..0000000 --- a/WebKit/chromium/src/DevToolsRPC.h +++ /dev/null @@ -1,396 +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. - */ - -// DevTools RPC subsystem is a simple string serialization-based rpc -// implementation. The client is responsible for defining the Rpc-enabled -// interface in terms of its macros: -// -// #define MYAPI_STRUCT(METHOD0, METHOD1, METHOD2, METHOD3) -// METHOD0(Method1) -// METHOD1(Method3, int) -// (snippet above should be multiline macro, add trailing backslashes) -// -// DEFINE_RPC_CLASS(MyApi, MYAPI_STRUCT) -// -// The snippet above will generate three classes: MyApi, MyApiStub and -// MyApiDispatch. -// -// 1. For each method defined in the marco MyApi will have a -// pure virtual function generated, so that MyApi would look like: -// -// class MyApi { -// private: -// MyApi() { } -// ~MyApi() { } -// virtual void method1() = 0; -// virtual void method2( -// int param1, -// const String& param2, -// const Value& param3) = 0; -// virtual void method3(int param1) = 0; -// }; -// -// 2. MyApiStub will implement MyApi interface and would serialize all calls -// into the string-based calls of the underlying transport: -// -// DevToolsRPC::Delegate* transport; -// myApi = new MyApiStub(transport); -// myApi->method1(); -// myApi->method3(2); -// -// 3. MyApiDelegate is capable of dispatching the calls and convert them to the -// calls to the underlying MyApi methods: -// -// MyApi* realObject; -// MyApiDispatch::dispatch(realObject, rawStringCallGeneratedByStub); -// -// will make corresponding calls to the real object. - -#ifndef DevToolsRPC_h -#define DevToolsRPC_h - -#include "PlatformString.h" -#include "Vector.h" -#include "WebDevToolsMessageData.h" - -#include <wtf/Noncopyable.h> - -namespace WebCore { -class String; -} - -using WebCore::String; -using WTF::Vector; - -namespace WebKit { - -/////////////////////////////////////////////////////// -// RPC dispatch macro - -template<typename T> -struct RpcTypeTrait { - typedef T ApiType; -}; - -template<> -struct RpcTypeTrait<bool> { - typedef bool ApiType; - static bool parse(const WebCore::String& t) - { - return t == "true"; - } - static WebCore::String toString(bool b) - { - return b ? "true" : "false"; - } -}; - -template<> -struct RpcTypeTrait<int> { - typedef int ApiType; - static int parse(const WebCore::String& t) - { - bool success; - int i = t.toIntStrict(&success); - ASSERT(success); - return i; - } - static WebCore::String toString(int i) - { - return WebCore::String::number(i); - } -}; - -template<> -struct RpcTypeTrait<String> { - typedef const String& ApiType; - static String parse(const WebCore::String& t) - { - return t; - } - static WebCore::String toString(const String& t) - { - return t; - } -}; - -/////////////////////////////////////////////////////// -// RPC Api method declarations - -#define TOOLS_RPC_API_METHOD0(Method) \ - virtual void Method() = 0; - -#define TOOLS_RPC_API_METHOD1(Method, T1) \ - virtual void Method(RpcTypeTrait<T1>::ApiType t1) = 0; - -#define TOOLS_RPC_API_METHOD2(Method, T1, T2) \ - virtual void Method(RpcTypeTrait<T1>::ApiType t1, \ - RpcTypeTrait<T2>::ApiType t2) = 0; - -#define TOOLS_RPC_API_METHOD3(Method, T1, T2, T3) \ - virtual void Method(RpcTypeTrait<T1>::ApiType t1, \ - RpcTypeTrait<T2>::ApiType t2, \ - RpcTypeTrait<T3>::ApiType t3) = 0; - -#define TOOLS_RPC_API_METHOD4(Method, T1, T2, T3, T4) \ - virtual void Method(RpcTypeTrait<T1>::ApiType t1, \ - RpcTypeTrait<T2>::ApiType t2, \ - RpcTypeTrait<T3>::ApiType t3, \ - RpcTypeTrait<T4>::ApiType t4) = 0; - -#define TOOLS_RPC_API_METHOD5(Method, T1, T2, T3, T4, T5) \ - virtual void Method(RpcTypeTrait<T1>::ApiType t1, \ - RpcTypeTrait<T2>::ApiType t2, \ - RpcTypeTrait<T3>::ApiType t3, \ - RpcTypeTrait<T4>::ApiType t4, \ - RpcTypeTrait<T5>::ApiType t5) = 0; - -/////////////////////////////////////////////////////// -// RPC stub method implementations - -#define TOOLS_RPC_STUB_METHOD0(Method) \ - virtual void Method() { \ - Vector<String> args; \ - this->sendRpcMessage(m_className, #Method, args); \ - } - -#define TOOLS_RPC_STUB_METHOD1(Method, T1) \ - virtual void Method(RpcTypeTrait<T1>::ApiType t1) { \ - Vector<String> args(1); \ - args[0] = RpcTypeTrait<T1>::toString(t1); \ - this->sendRpcMessage(m_className, #Method, args); \ - } - -#define TOOLS_RPC_STUB_METHOD2(Method, T1, T2) \ - virtual void Method(RpcTypeTrait<T1>::ApiType t1, \ - RpcTypeTrait<T2>::ApiType t2) { \ - Vector<String> args(2); \ - args[0] = RpcTypeTrait<T1>::toString(t1); \ - args[1] = RpcTypeTrait<T2>::toString(t2); \ - this->sendRpcMessage(m_className, #Method, args); \ - } - -#define TOOLS_RPC_STUB_METHOD3(Method, T1, T2, T3) \ - virtual void Method(RpcTypeTrait<T1>::ApiType t1, \ - RpcTypeTrait<T2>::ApiType t2, \ - RpcTypeTrait<T3>::ApiType t3) { \ - Vector<String> args(3); \ - args[0] = RpcTypeTrait<T1>::toString(t1); \ - args[1] = RpcTypeTrait<T2>::toString(t2); \ - args[2] = RpcTypeTrait<T3>::toString(t3); \ - this->sendRpcMessage(m_className, #Method, args); \ - } - -#define TOOLS_RPC_STUB_METHOD4(Method, T1, T2, T3, T4) \ - virtual void Method(RpcTypeTrait<T1>::ApiType t1, \ - RpcTypeTrait<T2>::ApiType t2, \ - RpcTypeTrait<T3>::ApiType t3, \ - RpcTypeTrait<T4>::ApiType t4) { \ - Vector<String> args(4); \ - args[0] = RpcTypeTrait<T1>::toString(t1); \ - args[1] = RpcTypeTrait<T2>::toString(t2); \ - args[2] = RpcTypeTrait<T3>::toString(t3); \ - args[3] = RpcTypeTrait<T4>::toString(t4); \ - this->sendRpcMessage(m_className, #Method, args); \ - } - -#define TOOLS_RPC_STUB_METHOD5(Method, T1, T2, T3, T4, T5) \ - virtual void Method(RpcTypeTrait<T1>::ApiType t1, \ - RpcTypeTrait<T2>::ApiType t2, \ - RpcTypeTrait<T3>::ApiType t3, \ - RpcTypeTrait<T4>::ApiType t4, \ - RpcTypeTrait<T5>::ApiType t5) { \ - Vector<String> args(5); \ - args[0] = RpcTypeTrait<T1>::toString(t1); \ - args[1] = RpcTypeTrait<T2>::toString(t2); \ - args[2] = RpcTypeTrait<T3>::toString(t3); \ - args[3] = RpcTypeTrait<T4>::toString(t4); \ - args[4] = RpcTypeTrait<T5>::toString(t5); \ - this->sendRpcMessage(m_className, #Method, args); \ - } - -/////////////////////////////////////////////////////// -// RPC dispatch method implementations - -#define TOOLS_RPC_DISPATCH0(Method) \ -if (methodName == #Method) { \ - delegate->Method(); \ - return true; \ -} - -#define TOOLS_RPC_DISPATCH1(Method, T1) \ -if (methodName == #Method) { \ - delegate->Method(RpcTypeTrait<T1>::parse(args[0])); \ - return true; \ -} - -#define TOOLS_RPC_DISPATCH2(Method, T1, T2) \ -if (methodName == #Method) { \ - delegate->Method( \ - RpcTypeTrait<T1>::parse(args[0]), \ - RpcTypeTrait<T2>::parse(args[1]) \ - ); \ - return true; \ -} - -#define TOOLS_RPC_DISPATCH3(Method, T1, T2, T3) \ -if (methodName == #Method) { \ - delegate->Method( \ - RpcTypeTrait<T1>::parse(args[0]), \ - RpcTypeTrait<T2>::parse(args[1]), \ - RpcTypeTrait<T3>::parse(args[2]) \ - ); \ - return true; \ -} - -#define TOOLS_RPC_DISPATCH4(Method, T1, T2, T3, T4) \ -if (methodName == #Method) { \ - delegate->Method( \ - RpcTypeTrait<T1>::parse(args[0]), \ - RpcTypeTrait<T2>::parse(args[1]), \ - RpcTypeTrait<T3>::parse(args[2]), \ - RpcTypeTrait<T4>::parse(args[3]) \ - ); \ - return true; \ -} - -#define TOOLS_RPC_DISPATCH5(Method, T1, T2, T3, T4, T5) \ -if (methodName == #Method) { \ - delegate->Method( \ - RpcTypeTrait<T1>::parse(args[0]), \ - RpcTypeTrait<T2>::parse(args[1]), \ - RpcTypeTrait<T3>::parse(args[2]), \ - RpcTypeTrait<T4>::parse(args[3]), \ - RpcTypeTrait<T5>::parse(args[4]) \ - ); \ - return true; \ -} - -#define TOOLS_END_RPC_DISPATCH() \ -} - -// This macro defines three classes: Class with the Api, ClassStub that is -// serializing method calls and ClassDispatch that is capable of dispatching -// the serialized message into its delegate. -#define DEFINE_RPC_CLASS(Class, STRUCT) \ -class Class : public Noncopyable {\ -public: \ - Class() \ - { \ - m_className = #Class; \ - } \ - virtual ~Class() { } \ - \ - STRUCT( \ - TOOLS_RPC_API_METHOD0, \ - TOOLS_RPC_API_METHOD1, \ - TOOLS_RPC_API_METHOD2, \ - TOOLS_RPC_API_METHOD3, \ - TOOLS_RPC_API_METHOD4, \ - TOOLS_RPC_API_METHOD5) \ - WebCore::String m_className; \ -}; \ -\ -class Class##Stub \ - : public Class \ - , public DevToolsRPC { \ -public: \ - explicit Class##Stub(Delegate* delegate) : DevToolsRPC(delegate) { } \ - virtual ~Class##Stub() { } \ - typedef Class CLASS; \ - STRUCT( \ - TOOLS_RPC_STUB_METHOD0, \ - TOOLS_RPC_STUB_METHOD1, \ - TOOLS_RPC_STUB_METHOD2, \ - TOOLS_RPC_STUB_METHOD3, \ - TOOLS_RPC_STUB_METHOD4, \ - TOOLS_RPC_STUB_METHOD5) \ -}; \ -\ -class Class##Dispatch : public Noncopyable { \ -public: \ - Class##Dispatch() { } \ - virtual ~Class##Dispatch() { } \ - \ - static bool dispatch(Class* delegate, \ - const WebKit::WebDevToolsMessageData& data) { \ - String className = data.className; \ - if (className != #Class) \ - return false; \ - String methodName = data.methodName; \ - Vector<String> args; \ - for (size_t i = 0; i < data.arguments.size(); i++) \ - args.append(data.arguments[i]); \ - typedef Class CLASS; \ - STRUCT( \ - TOOLS_RPC_DISPATCH0, \ - TOOLS_RPC_DISPATCH1, \ - TOOLS_RPC_DISPATCH2, \ - TOOLS_RPC_DISPATCH3, \ - TOOLS_RPC_DISPATCH4, \ - TOOLS_RPC_DISPATCH5) \ - return false; \ - } \ -}; - -/////////////////////////////////////////////////////// -// RPC base class -class DevToolsRPC { -public: - class Delegate { - public: - Delegate() { } - virtual ~Delegate() { } - virtual void sendRpcMessage(const WebKit::WebDevToolsMessageData& data) = 0; - }; - - explicit DevToolsRPC(Delegate* delegate) : m_delegate(delegate) { } - virtual ~DevToolsRPC() { }; - -protected: - void sendRpcMessage(const String& className, - const String& methodName, - const Vector<String>& args) { - WebKit::WebVector<WebKit::WebString> webArgs(args.size()); - for (size_t i = 0; i < args.size(); i++) - webArgs[i] = args[i]; - WebKit::WebDevToolsMessageData data; - data.className = className; - data.methodName = methodName; - data.arguments.swap(webArgs); - this->m_delegate->sendRpcMessage(data); - } - - Delegate* m_delegate; -}; - -} // namespace WebKit - -#endif diff --git a/WebKit/chromium/src/DevToolsRPCJS.h b/WebKit/chromium/src/DevToolsRPCJS.h deleted file mode 100644 index 8ae279f..0000000 --- a/WebKit/chromium/src/DevToolsRPCJS.h +++ /dev/null @@ -1,147 +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. - */ - -// Additional set of macros for the JS RPC. - -#ifndef DevToolsRPCJS_h -#define DevToolsRPCJS_h - -// Do not remove this one although it is not used. -#include "BoundObject.h" -#include "DevToolsRPC.h" -#include "WebFrame.h" -#include <wtf/Noncopyable.h> -#include <wtf/OwnPtr.h> - -namespace WebKit { - -/////////////////////////////////////////////////////// -// JS RPC binds and stubs - -#define TOOLS_RPC_JS_BIND_METHOD0(Method) \ - boundObj.addProtoFunction(#Method, OCLASS::js##Method); - -#define TOOLS_RPC_JS_BIND_METHOD1(Method, T1) \ - boundObj.addProtoFunction(#Method, OCLASS::js##Method); - -#define TOOLS_RPC_JS_BIND_METHOD2(Method, T1, T2) \ - boundObj.addProtoFunction(#Method, OCLASS::js##Method); - -#define TOOLS_RPC_JS_BIND_METHOD3(Method, T1, T2, T3) \ - boundObj.addProtoFunction(#Method, OCLASS::js##Method); - -#define TOOLS_RPC_JS_BIND_METHOD4(Method, T1, T2, T3, T4) \ - boundObj.addProtoFunction(#Method, OCLASS::js##Method); - -#define TOOLS_RPC_JS_BIND_METHOD5(Method, T1, T2, T3, T4, T5) \ - boundObj.addProtoFunction(#Method, OCLASS::js##Method); - -#define TOOLS_RPC_JS_STUB_METHOD0(Method) \ - static v8::Handle<v8::Value> js##Method(const v8::Arguments& args) { \ - sendRpcMessageFromJS(#Method, args, 0); \ - return v8::Undefined(); \ - } - -#define TOOLS_RPC_JS_STUB_METHOD1(Method, T1) \ - static v8::Handle<v8::Value> js##Method(const v8::Arguments& args) { \ - sendRpcMessageFromJS(#Method, args, 1); \ - return v8::Undefined(); \ - } - -#define TOOLS_RPC_JS_STUB_METHOD2(Method, T1, T2) \ - static v8::Handle<v8::Value> js##Method(const v8::Arguments& args) { \ - sendRpcMessageFromJS(#Method, args, 2); \ - return v8::Undefined(); \ - } - -#define TOOLS_RPC_JS_STUB_METHOD3(Method, T1, T2, T3) \ - static v8::Handle<v8::Value> js##Method(const v8::Arguments& args) { \ - sendRpcMessageFromJS(#Method, args, 3); \ - return v8::Undefined(); \ - } - -#define TOOLS_RPC_JS_STUB_METHOD4(Method, T1, T2, T3, T4) \ - static v8::Handle<v8::Value> js##Method(const v8::Arguments& args) { \ - sendRpcMessageFromJS(#Method, args, 4); \ - return v8::Undefined(); \ - } - -#define TOOLS_RPC_JS_STUB_METHOD5(Method, T1, T2, T3, T4, T5) \ - static v8::Handle<v8::Value> js##Method(const v8::Arguments& args) { \ - sendRpcMessageFromJS(#Method, args, 5); \ - return v8::Undefined(); \ - } - -/////////////////////////////////////////////////////// -// JS RPC main obj macro - -#define DEFINE_RPC_JS_BOUND_OBJ(Class, STRUCT, DClass, DELEGATE_STRUCT) \ -class JS##Class##BoundObj : public Class##Stub { \ -public: \ - JS##Class##BoundObj(Delegate* rpcDelegate, \ - v8::Handle<v8::Context> context, \ - const char* classname) \ - : Class##Stub(rpcDelegate) { \ - BoundObject boundObj(context, this, classname); \ - STRUCT( \ - TOOLS_RPC_JS_BIND_METHOD0, \ - TOOLS_RPC_JS_BIND_METHOD1, \ - TOOLS_RPC_JS_BIND_METHOD2, \ - TOOLS_RPC_JS_BIND_METHOD3, \ - TOOLS_RPC_JS_BIND_METHOD4, \ - TOOLS_RPC_JS_BIND_METHOD5) \ - boundObj.build(); \ - } \ - virtual ~JS##Class##BoundObj() { } \ - typedef JS##Class##BoundObj OCLASS; \ - STRUCT( \ - TOOLS_RPC_JS_STUB_METHOD0, \ - TOOLS_RPC_JS_STUB_METHOD1, \ - TOOLS_RPC_JS_STUB_METHOD2, \ - TOOLS_RPC_JS_STUB_METHOD3, \ - TOOLS_RPC_JS_STUB_METHOD4, \ - TOOLS_RPC_JS_STUB_METHOD5) \ -private: \ - static void sendRpcMessageFromJS(const char* method, \ - const v8::Arguments& jsArguments, \ - size_t argsCount) \ - { \ - Vector<String> args(argsCount); \ - for (size_t i = 0; i < argsCount; i++) \ - args[i] = WebCore::toWebCoreStringWithNullCheck(jsArguments[i]); \ - void* selfPtr = v8::External::Cast(*jsArguments.Data())->Value(); \ - JS##Class##BoundObj* self = static_cast<JS##Class##BoundObj*>(selfPtr); \ - self->sendRpcMessage(#Class, method, args); \ - } \ -}; - -} // namespace WebKit - -#endif diff --git a/WebKit/chromium/src/DeviceOrientationClientProxy.cpp b/WebKit/chromium/src/DeviceOrientationClientProxy.cpp new file mode 100644 index 0000000..f4a0dd9 --- /dev/null +++ b/WebKit/chromium/src/DeviceOrientationClientProxy.cpp @@ -0,0 +1,74 @@ +/* + * 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 "DeviceOrientationClientProxy.h" + +#include "DeviceOrientation.h" +#include "WebDeviceOrientation.h" +#include "WebDeviceOrientationController.h" +#include <wtf/OwnPtr.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebCore { +class DeviceOrientationController; +} + +namespace WebKit { + +void DeviceOrientationClientProxy::setController(WebCore::DeviceOrientationController* c) +{ + if (!m_client) // FIXME: Get rid of these null checks once device orientation is enabled by default. + return; + m_client->setController(new WebDeviceOrientationController(c)); +} + +void DeviceOrientationClientProxy::startUpdating() +{ + if (!m_client) + return; + m_client->startUpdating(); +} + +void DeviceOrientationClientProxy::stopUpdating() +{ + if (!m_client) + return; + m_client->stopUpdating(); +} + +WebCore::DeviceOrientation* DeviceOrientationClientProxy::lastOrientation() const +{ + if (!m_client) + return 0; + + // Cache the DeviceOrientation pointer so its reference count does not drop to zero upon return. + m_lastOrientation = m_client->lastOrientation(); + + return m_lastOrientation.get(); +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/DeviceOrientationClientProxy.h b/WebKit/chromium/src/DeviceOrientationClientProxy.h new file mode 100644 index 0000000..2d3a7dc --- /dev/null +++ b/WebKit/chromium/src/DeviceOrientationClientProxy.h @@ -0,0 +1,59 @@ +/* + * 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 DeviceOrientationClientProxy_h +#define DeviceOrientationClientProxy_h + +#include "DeviceOrientation.h" +#include "DeviceOrientationClient.h" +#include "WebDeviceOrientationClient.h" +#include <wtf/RefPtr.h> + +namespace WebCore { +class DeviceOrientationController; +} + +namespace WebKit { + +class DeviceOrientationClientProxy : public WebCore::DeviceOrientationClient { +public: + DeviceOrientationClientProxy(WebDeviceOrientationClient* client) + : m_client(client) + { + } + + void setController(WebCore::DeviceOrientationController*); + void startUpdating(); + void stopUpdating(); + WebCore::DeviceOrientation* lastOrientation() const; + +private: + WebDeviceOrientationClient* m_client; + mutable RefPtr<WebCore::DeviceOrientation> m_lastOrientation; +}; + +} // namespace WebKit + +#endif // DeviceOrientationClientProxy_h diff --git a/WebKit/chromium/src/DragClientImpl.cpp b/WebKit/chromium/src/DragClientImpl.cpp index 671e7ca..9874401 100644 --- a/WebKit/chromium/src/DragClientImpl.cpp +++ b/WebKit/chromium/src/DragClientImpl.cpp @@ -30,11 +30,14 @@ #include "config.h" #include "DragClientImpl.h" - +#include "DragImageRef.h" #include "ChromiumDataObject.h" #include "ClipboardChromium.h" #include "Frame.h" +#include "NativeImageSkia.h" +#include "WebCommon.h" #include "WebDragData.h" +#include "WebImage.h" #include "WebViewClient.h" #include "WebViewImpl.h" @@ -81,8 +84,16 @@ void DragClientImpl::startDrag(DragImageRef dragImage, DragOperation dragOperationMask = clipboard->sourceOperation(); + IntSize offsetSize(eventPos - dragImageOrigin); + WebPoint offsetPoint(offsetSize.width(), offsetSize.height()); m_webView->startDragging( - eventPos, dragData, static_cast<WebDragOperationsMask>(dragOperationMask)); + dragData, static_cast<WebDragOperationsMask>(dragOperationMask), +#if WEBKIT_USING_SKIA + dragImage ? WebImage(*dragImage) : WebImage(), +#else + dragImage ? WebImage(dragImage) : WebImage(), +#endif + offsetPoint); } DragImageRef DragClientImpl::createDragImageForLink(KURL&, const String& label, Frame*) diff --git a/WebKit/chromium/src/DragClientImpl.h b/WebKit/chromium/src/DragClientImpl.h index fc4c608..dac7acd 100644 --- a/WebKit/chromium/src/DragClientImpl.h +++ b/WebKit/chromium/src/DragClientImpl.h @@ -63,7 +63,7 @@ public: WebCore::Frame* frame, bool isLinkDrag = false); virtual WebCore::DragImageRef createDragImageForLink( - WebCore::KURL&, const WebCore::String& label, WebCore::Frame*); + WebCore::KURL&, const WTF::String& label, WebCore::Frame*); virtual void dragControllerDestroyed(); private: diff --git a/WebKit/chromium/src/DragScrollTimer.cpp b/WebKit/chromium/src/DragScrollTimer.cpp new file mode 100644 index 0000000..83b81b7 --- /dev/null +++ b/WebKit/chromium/src/DragScrollTimer.cpp @@ -0,0 +1,126 @@ +/* + * 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 "DragScrollTimer.h" + +#include "FrameView.h" + +using namespace WebCore; + +namespace WebKit { + +// Computes the distance from a point outside a rect to the nearest edge of the rect. +static IntSize distanceToRect(const IntPoint& point, const IntRect& rect) +{ + int dx = 0, dy = 0; + if (point.x() < rect.x()) + dx = point.x() - rect.x(); + else if (rect.right() < point.x()) + dx = point.x() - rect.right(); + if (point.y() < rect.y()) + dy = point.y() - rect.y(); + else if (rect.bottom() < point.y()) + dy = point.y() - rect.bottom(); + return IntSize(dx, dy); +} + +DragScrollTimer::DragScrollTimer() + : m_timer(this, &DragScrollTimer::fired) + , m_view(0) + , m_scrolling(false) +{ +} + +DragScrollTimer::~DragScrollTimer() +{ + // We do this for detecting dead object earlier + stop(); +} + +void DragScrollTimer::stop() +{ + m_timer.stop(); + m_view = 0; + m_scrolling = false; +} + +void DragScrollTimer::scroll() +{ + m_view->scrollBy(m_lastDistance); + m_scrolling = true; +} + +void DragScrollTimer::update() +{ + if (shouldScroll()) + scroll(); + else + stop(); +} + +void DragScrollTimer::triggerScroll(FrameView* view, const WebPoint& location) +{ + if (!view) + return; + + // Approximates Safari + static const double scrollStartDelay = 0.2; + + m_view = view; + m_lastDistance = scrollDistanceFor(view, location); + + if (m_scrolling) + update(); + else if (shouldScroll() && !m_timer.isActive()) + m_timer.startOneShot(scrollStartDelay); +} + +IntSize DragScrollTimer::scrollDistanceFor(FrameView* view, const WebPoint& location) const +{ + static const int scrollMargin = 30; + + IntRect bounds(0, 0, view->visibleWidth(), view->visibleHeight()); + if (!bounds.contains(location)) + return IntSize(0, 0); // The location is outside the border belt. + + bounds.setY(bounds.y() + scrollMargin); + bounds.setHeight(bounds.height() - scrollMargin * 2); + bounds.setX(bounds.x() + scrollMargin); + bounds.setWidth(bounds.width() - scrollMargin * 2); + + if (bounds.contains(location)) + return IntSize(0, 0); // The location is inside the border belt. + + // The location is over the border belt. + return distanceToRect(location, bounds); +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/DebuggerAgent.h b/WebKit/chromium/src/DragScrollTimer.h index 17cde11..a4090e0 100644 --- a/WebKit/chromium/src/DebuggerAgent.h +++ b/WebKit/chromium/src/DragScrollTimer.h @@ -28,29 +28,41 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef DebuggerAgent_h -#define DebuggerAgent_h +#ifndef DragScrollTimer_h +#define DragScrollTimer_h -#include "DevToolsRPC.h" +#include "IntSize.h" +#include "Timer.h" +#include "WebPoint.h" + +namespace WebCore { class FrameView; } namespace WebKit { -#define DEBUGGER_AGENT_STRUCT(METHOD0, METHOD1, METHOD2, METHOD3, METHOD4, METHOD5) \ - /* Requests global context id of the inspected tab. */ \ - METHOD0(getContextId) \ - \ - /* Request v8 to process all debug commands in the queue. */ \ - METHOD0(processDebugCommands) +// +// Encapsulating a timer and associated state management for +// scroll-on-drag behaviour. +// +class DragScrollTimer { +public: + DragScrollTimer(); + ~DragScrollTimer(); -DEFINE_RPC_CLASS(DebuggerAgent, DEBUGGER_AGENT_STRUCT) + void fired(WebCore::Timer<DragScrollTimer>*) { update(); } + void triggerScroll(WebCore::FrameView*, const WebPoint&); + void stop(); -#define DEBUGGER_AGENT_DELEGATE_STRUCT(METHOD0, METHOD1, METHOD2, METHOD3, METHOD4, METHOD5) \ - METHOD1(debuggerOutput, String /* output text */) \ - \ - /* Pushes debugger context id into the client. */ \ - METHOD1(setContextId, int /* context id */) +private: + void scroll(); + void update(); + WebCore::IntSize scrollDistanceFor(WebCore::FrameView*, const WebPoint&) const; + bool shouldScroll() const { return !m_lastDistance.isZero(); } -DEFINE_RPC_CLASS(DebuggerAgentDelegate, DEBUGGER_AGENT_DELEGATE_STRUCT) + WebCore::Timer<DragScrollTimer> m_timer; + WebCore::FrameView* m_view; + WebCore::IntSize m_lastDistance; + bool m_scrolling; +}; } // namespace WebKit diff --git a/WebKit/chromium/src/EditorClientImpl.cpp b/WebKit/chromium/src/EditorClientImpl.cpp index d5bddc5..11977b6 100644 --- a/WebKit/chromium/src/EditorClientImpl.cpp +++ b/WebKit/chromium/src/EditorClientImpl.cpp @@ -43,9 +43,11 @@ #include "DOMUtilitiesPrivate.h" #include "WebEditingAction.h" +#include "WebElement.h" #include "WebFrameImpl.h" #include "WebKit.h" #include "WebInputElement.h" +#include "WebInputEventConversion.h" #include "WebNode.h" #include "WebPasswordAutocompleteListener.h" #include "WebRange.h" @@ -90,7 +92,7 @@ bool EditorClientImpl::shouldShowDeleteInterface(HTMLElement* elem) // Normally, we don't care to show WebCore's deletion UI, so we only enable // it if in testing mode and the test specifically requests it by using this // magic class name. - return WebKit::layoutTestMode() + return layoutTestMode() && elem->getAttribute(HTMLNames::classAttr) == "needsDeletionUI"; } @@ -413,8 +415,10 @@ static const KeyDownEntry keyDownEntries[] = { { VKEY_DOWN, 0, "MoveDown" }, { VKEY_DOWN, ShiftKey, "MoveDownAndModifySelection" }, { VKEY_NEXT, ShiftKey, "MovePageDownAndModifySelection" }, +#if !OS(DARWIN) { VKEY_PRIOR, 0, "MovePageUp" }, { VKEY_NEXT, 0, "MovePageDown" }, +#endif { VKEY_HOME, 0, "MoveToBeginningOfLine" }, { VKEY_HOME, ShiftKey, "MoveToBeginningOfLineAndModifySelection" }, @@ -422,6 +426,8 @@ static const KeyDownEntry keyDownEntries[] = { { VKEY_LEFT, CommandKey, "MoveToBeginningOfLine" }, { VKEY_LEFT, CommandKey | ShiftKey, "MoveToBeginningOfLineAndModifySelection" }, + { VKEY_PRIOR, OptionKey, "MovePageUp" }, + { VKEY_NEXT, OptionKey, "MovePageDown" }, #endif #if OS(DARWIN) { VKEY_UP, CommandKey, "MoveToBeginningOfDocument" }, @@ -640,12 +646,19 @@ void EditorClientImpl::handleInputMethodKeydown(KeyboardEvent* keyEvent) // We handle IME within chrome. } -void EditorClientImpl::textFieldDidBeginEditing(Element*) +void EditorClientImpl::textFieldDidBeginEditing(Element* element) { + HTMLInputElement* inputElement = toHTMLInputElement(element); + if (m_webView->client() && inputElement) + m_webView->client()->textFieldDidBeginEditing(WebInputElement(inputElement)); } void EditorClientImpl::textFieldDidEndEditing(Element* element) { + HTMLInputElement* inputElement = toHTMLInputElement(element); + if (m_webView->client() && inputElement) + m_webView->client()->textFieldDidEndEditing(WebInputElement(inputElement)); + // Notification that focus was lost. Be careful with this, it's also sent // when the page is being closed. @@ -654,13 +667,12 @@ void EditorClientImpl::textFieldDidEndEditing(Element* element) m_autofillTimer.stop(); // Hide any showing popup. - m_webView->hideSuggestionsPopup(); + m_webView->hideAutoFillPopup(); if (!m_webView->client()) return; // The page is getting closed, don't fill the password. // Notify any password-listener of the focus change. - HTMLInputElement* inputElement = WebKit::toHTMLInputElement(element); if (!inputElement) return; @@ -678,15 +690,18 @@ void EditorClientImpl::textFieldDidEndEditing(Element* element) void EditorClientImpl::textDidChangeInTextField(Element* element) { ASSERT(element->hasLocalName(HTMLNames::inputTag)); + HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(element); + if (m_webView->client()) + m_webView->client()->textFieldDidChange(WebInputElement(inputElement)); + // Note that we only show the autofill popup in this case if the caret is at // the end. This matches FireFox and Safari but not IE. - autofill(static_cast<HTMLInputElement*>(element), false, false, - true); + autofill(inputElement, false, false, true); } bool EditorClientImpl::showFormAutofillForNode(Node* node) { - HTMLInputElement* inputElement = WebKit::toHTMLInputElement(node); + HTMLInputElement* inputElement = toHTMLInputElement(node); if (inputElement) return autofill(inputElement, true, true, false); return false; @@ -701,10 +716,12 @@ bool EditorClientImpl::autofill(HTMLInputElement* inputElement, m_autofillArgs.clear(); m_autofillTimer.stop(); + // FIXME: Remove the extraneous isEnabledFormControl call below. // Let's try to trigger autofill for that field, if applicable. if (!inputElement->isEnabledFormControl() || !inputElement->isTextField() - || inputElement->isPasswordField() - || !inputElement->autoComplete()) + || inputElement->isPasswordField() || !inputElement->autoComplete() + || !inputElement->isEnabledFormControl() + || inputElement->isReadOnlyFormControl()) return false; WebString name = WebInputElement(inputElement).nameForAutofill(); @@ -748,7 +765,7 @@ void EditorClientImpl::doAutofill(Timer<EditorClientImpl>* timer) && inputElement->selectionEnd() == static_cast<int>(value.length()); if ((!args->autofillOnEmptyValue && value.isEmpty()) || !isCaretAtEnd) { - m_webView->hideSuggestionsPopup(); + m_webView->hideAutoFillPopup(); return; } @@ -784,22 +801,27 @@ void EditorClientImpl::cancelPendingAutofill() m_autofillTimer.stop(); } -void EditorClientImpl::onAutofillSuggestionAccepted(HTMLInputElement* textField) +void EditorClientImpl::onAutocompleteSuggestionAccepted(HTMLInputElement* textField) { + if (m_webView->client()) + m_webView->client()->didAcceptAutocompleteSuggestion(WebInputElement(textField)); + WebFrameImpl* webframe = WebFrameImpl::fromFrame(textField->document()->frame()); if (!webframe) return; - WebPasswordAutocompleteListener* listener = webframe->getPasswordListener(textField); - // Password listeners need to autocomplete other fields that depend on the - // input element with autofill suggestions. - if (listener) - listener->performInlineAutocomplete(textField->value(), false, false); + webframe->notifiyPasswordListenerOfAutocomplete(WebInputElement(textField)); } bool EditorClientImpl::doTextFieldCommandFromEvent(Element* element, KeyboardEvent* event) { + HTMLInputElement* inputElement = toHTMLInputElement(element); + if (m_webView->client() && inputElement) { + m_webView->client()->textFieldDidReceiveKeyDown(WebInputElement(inputElement), + WebKeyboardEventBuilder(*event)); + } + // Remember if backspace was pressed for the autofill. It is not clear how to // find if backspace was pressed from textFieldDidBeginEditing and // textDidChangeInTextField as when these methods are called the value of the @@ -913,10 +935,14 @@ void EditorClientImpl::getGuessesForWord(const String&, notImplemented(); } -void EditorClientImpl::setInputMethodState(bool enabled) +void EditorClientImpl::willSetInputMethodState() { if (m_webView->client()) - m_webView->client()->setInputMethodEnabled(enabled); + m_webView->client()->resetInputMethod(); +} + +void EditorClientImpl::setInputMethodState(bool) +{ } } // namesace WebKit diff --git a/WebKit/chromium/src/EditorClientImpl.h b/WebKit/chromium/src/EditorClientImpl.h index fd08b4d..b05a592 100644 --- a/WebKit/chromium/src/EditorClientImpl.h +++ b/WebKit/chromium/src/EditorClientImpl.h @@ -61,7 +61,7 @@ public: virtual bool shouldBeginEditing(WebCore::Range*); virtual bool shouldEndEditing(WebCore::Range*); virtual bool shouldInsertNode(WebCore::Node*, WebCore::Range*, WebCore::EditorInsertAction); - virtual bool shouldInsertText(const WebCore::String&, WebCore::Range*, WebCore::EditorInsertAction); + virtual bool shouldInsertText(const WTF::String&, WebCore::Range*, WebCore::EditorInsertAction); virtual bool shouldDeleteRange(WebCore::Range*); virtual bool shouldChangeSelectedRange(WebCore::Range* fromRange, WebCore::Range* toRange, @@ -92,8 +92,8 @@ public: virtual bool doTextFieldCommandFromEvent(WebCore::Element*, WebCore::KeyboardEvent*); virtual void textWillBeDeletedInTextField(WebCore::Element*); virtual void textDidChangeInTextArea(WebCore::Element*); - virtual void ignoreWordInSpellDocument(const WebCore::String&); - virtual void learnWord(const WebCore::String&); + virtual void ignoreWordInSpellDocument(const WTF::String&); + virtual void learnWord(const WTF::String&); virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength); @@ -101,13 +101,14 @@ public: WTF::Vector<WebCore::GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength); - virtual WebCore::String getAutoCorrectSuggestionForMisspelledWord(const WebCore::String&); - virtual void updateSpellingUIWithGrammarString(const WebCore::String&, const WebCore::GrammarDetail&); - virtual void updateSpellingUIWithMisspelledWord(const WebCore::String&); + virtual WTF::String getAutoCorrectSuggestionForMisspelledWord(const WTF::String&); + virtual void updateSpellingUIWithGrammarString(const WTF::String&, const WebCore::GrammarDetail&); + virtual void updateSpellingUIWithMisspelledWord(const WTF::String&); virtual void showSpellingUI(bool show); virtual bool spellingUIIsShowing(); - virtual void getGuessesForWord(const WebCore::String& word, - WTF::Vector<WebCore::String>& guesses); + virtual void getGuessesForWord(const WTF::String& word, + WTF::Vector<WTF::String>& guesses); + virtual void willSetInputMethodState(); virtual void setInputMethodState(bool enabled); // Shows the form autofill popup for |node| if it is an HTMLInputElement and @@ -118,10 +119,10 @@ public: virtual bool showFormAutofillForNode(WebCore::Node*); // Notification that the text changed due to acceptance of a suggestion - // provided by an autofill popup. Having a separate callback in this case - // is a simple way to break the cycle that would otherwise occur if + // provided by an Autocomplete popup. Having a separate callback in this + // case is a simple way to break the cycle that would otherwise occur if // textDidChangeInTextField was called. - virtual void onAutofillSuggestionAccepted(WebCore::HTMLInputElement*); + virtual void onAutocompleteSuggestionAccepted(WebCore::HTMLInputElement*); private: void modifySelection(WebCore::Frame*, WebCore::KeyboardEvent*); diff --git a/WebKit/chromium/src/EventListenerWrapper.cpp b/WebKit/chromium/src/EventListenerWrapper.cpp index f2d2979..706ba21 100644 --- a/WebKit/chromium/src/EventListenerWrapper.cpp +++ b/WebKit/chromium/src/EventListenerWrapper.cpp @@ -1,72 +1,72 @@ -/*
- * 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 "EventListenerWrapper.h"
-
-#include "Event.h"
-#include "EventListener.h"
-
-#include "WebEvent.h"
-#include "WebEventListener.h"
-
-namespace WebKit {
-
-EventListenerWrapper::EventListenerWrapper(WebEventListener* webEventListener)
- : EventListener(EventListener::JSEventListenerType)
- , m_webEventListener(webEventListener)
-{
-}
-
-EventListenerWrapper::~EventListenerWrapper()
-{
- if (m_webEventListener)
- m_webEventListener->notifyEventListenerDeleted(this);
-}
-
-bool EventListenerWrapper::operator==(const EventListener& listener)
-{
- return this == &listener;
-}
-
-void EventListenerWrapper::handleEvent(ScriptExecutionContext* context, Event* event)
-{
- if (!m_webEventListener)
- return;
- WebEvent webEvent(event);
- m_webEventListener->handleEvent(webEvent);
-}
-
-void EventListenerWrapper::webEventListenerDeleted()
-{
- m_webEventListener = 0;
-}
-
-} // namespace WebKit
+/* + * 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 "EventListenerWrapper.h" + +#include "Event.h" +#include "EventListener.h" + +#include "WebDOMEvent.h" +#include "WebDOMEventListener.h" + +namespace WebKit { + +EventListenerWrapper::EventListenerWrapper(WebDOMEventListener* webDOMEventListener) + : EventListener(EventListener::JSEventListenerType) + , m_webDOMEventListener(webDOMEventListener) +{ +} + +EventListenerWrapper::~EventListenerWrapper() +{ + if (m_webDOMEventListener) + m_webDOMEventListener->notifyEventListenerDeleted(this); +} + +bool EventListenerWrapper::operator==(const EventListener& listener) +{ + return this == &listener; +} + +void EventListenerWrapper::handleEvent(ScriptExecutionContext* context, Event* event) +{ + if (!m_webDOMEventListener) + return; + WebDOMEvent webDOMEvent(event); + m_webDOMEventListener->handleEvent(webDOMEvent); +} + +void EventListenerWrapper::webDOMEventListenerDeleted() +{ + m_webDOMEventListener = 0; +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/EventListenerWrapper.h b/WebKit/chromium/src/EventListenerWrapper.h index 2a0cbbb..75b6a95 100644 --- a/WebKit/chromium/src/EventListenerWrapper.h +++ b/WebKit/chromium/src/EventListenerWrapper.h @@ -1,62 +1,64 @@ -/*
- * 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 EventListenerWrapper_h
-#define EventListenerWrapper_h
-
-#include "EventListener.h"
-
-namespace WebCore {
-class ScriptExecutionContext;
-}
-
-using namespace WebCore;
-
-namespace WebKit {
-
-class WebEventListener;
-
-class EventListenerWrapper : public EventListener {
-public:
- EventListenerWrapper(WebEventListener*);
- ~EventListenerWrapper();
-
- virtual bool operator==(const EventListener&);
- virtual void handleEvent(ScriptExecutionContext*, Event*);
-
- void webEventListenerDeleted();
-
-private:
- WebEventListener* m_webEventListener;
-};
-
-} // namespace WebKit
-
-#endif
+/* + * 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 EventListenerWrapper_h +#define EventListenerWrapper_h + +#include "EventListener.h" + +namespace WebCore { +class ScriptExecutionContext; +} + +using namespace WebCore; + +namespace WebKit { + +class WebDOMEventListener; + +// FIXME: Remove the DeprecatedEventListenerWrapper class below once Chromium +// switched to using WebDOMEvent. +class EventListenerWrapper : public EventListener { +public: + EventListenerWrapper(WebDOMEventListener*); + ~EventListenerWrapper(); + + virtual bool operator==(const EventListener&); + virtual void handleEvent(ScriptExecutionContext*, Event*); + + void webDOMEventListenerDeleted(); + +private: + WebDOMEventListener* m_webDOMEventListener; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/WebKit/chromium/src/FrameLoaderClientImpl.cpp index b984308..74186bf 100644 --- a/WebKit/chromium/src/FrameLoaderClientImpl.cpp +++ b/WebKit/chromium/src/FrameLoaderClientImpl.cpp @@ -32,12 +32,14 @@ #include "FrameLoaderClientImpl.h" #include "Chrome.h" -#include "CString.h" #include "Document.h" #include "DocumentLoader.h" #include "FormState.h" #include "FrameLoader.h" #include "FrameLoadRequest.h" +#include "FrameView.h" +#include "HTTPParsers.h" +#include "HistoryItem.h" #include "HitTestResult.h" #include "HTMLAppletElement.h" #include "HTMLFormElement.h" // needed by FormState.h @@ -48,6 +50,7 @@ #include "PlatformString.h" #include "PluginData.h" #include "PluginDataChromium.h" +#include "Settings.h" #include "StringExtras.h" #include "WebDataSourceImpl.h" #include "WebDevToolsAgentPrivate.h" @@ -71,6 +74,7 @@ #include "WindowFeatures.h" #include "WrappedResourceRequest.h" #include "WrappedResourceResponse.h" +#include <wtf/text/CString.h> using namespace WebCore; @@ -180,6 +184,18 @@ bool FrameLoaderClientImpl::allowImages(bool enabledPerSettings) return enabledPerSettings; } +void FrameLoaderClientImpl::didNotAllowScript() +{ + if (m_webFrame->client()) + m_webFrame->client()->didNotAllowScript(m_webFrame); +} + +void FrameLoaderClientImpl::didNotAllowPlugins() +{ + if (m_webFrame->client()) + m_webFrame->client()->didNotAllowPlugins(m_webFrame); +} + bool FrameLoaderClientImpl::hasWebView() const { return m_webFrame->viewImpl(); @@ -232,10 +248,15 @@ 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->dropClient(); + m_webFrame->setClient(0); } // This function is responsible for associating the |identifier| with a given @@ -392,12 +413,6 @@ bool FrameLoaderClientImpl::dispatchDidLoadResourceFromMemoryCache( return false; // Do not suppress remaining notifications } -void FrameLoaderClientImpl::dispatchDidLoadResourceByXMLHttpRequest( - unsigned long identifier, - const ScriptString& source) -{ -} - void FrameLoaderClientImpl::dispatchDidHandleOnloadEvents() { if (m_webFrame->client()) @@ -556,7 +571,7 @@ void FrameLoaderClientImpl::dispatchWillPerformClientRedirect( } } -void FrameLoaderClientImpl::dispatchDidChangeLocationWithinPage() +void FrameLoaderClientImpl::dispatchDidNavigateWithinPage() { // Anchor fragment navigations are not normal loads, so we need to synthesize // some events for our delegate. @@ -567,12 +582,17 @@ void FrameLoaderClientImpl::dispatchDidChangeLocationWithinPage() // them for fragment redirection that happens in window.onload handler. // See https://bugs.webkit.org/show_bug.cgi?id=31838 bool loaderCompleted = - !m_webFrame->frame()->page()->mainFrame()->loader()->isLoading(); + !webView->page()->mainFrame()->loader()->activeDocumentLoader()->isLoadingInAPISense(); // Generate didStartLoading if loader is completed. if (webView->client() && loaderCompleted) webView->client()->didStartLoading(); + // We need to classify some hash changes as client redirects. + // FIXME: It seems wrong that the currentItem can sometimes be null. + HistoryItem* currentItem = m_webFrame->frame()->loader()->history()->currentItem(); + bool isHashChange = !currentItem || !currentItem->stateObject(); + WebDataSourceImpl* ds = m_webFrame->dataSourceImpl(); ASSERT(ds); // Should not be null when navigating to a reference fragment! if (ds) { @@ -583,27 +603,29 @@ void FrameLoaderClientImpl::dispatchDidChangeLocationWithinPage() ds->clearRedirectChain(); } - // Figure out if this location change is because of a JS-initiated - // client redirect (e.g onload/setTimeout document.location.href=). - // FIXME: (bugs 1085325, 1046841) We don't get proper redirect - // performed/cancelled notifications across anchor navigations, so the - // other redirect-tracking code in this class (see - // dispatch*ClientRedirect() and dispatchDidStartProvisionalLoad) is - // insufficient to catch and properly flag these transitions. Once a - // proper fix for this bug is identified and applied the following - // block may no longer be required. - bool wasClientRedirect = - (url == m_expectedClientRedirectDest && chainEnd == m_expectedClientRedirectSrc) - || !m_webFrame->isProcessingUserGesture(); - - if (wasClientRedirect) { - if (m_webFrame->client()) - m_webFrame->client()->didCompleteClientRedirect(m_webFrame, chainEnd); - ds->appendRedirect(chainEnd); - // Make sure we clear the expected redirect since we just effectively - // completed it. - m_expectedClientRedirectSrc = KURL(); - m_expectedClientRedirectDest = KURL(); + if (isHashChange) { + // Figure out if this location change is because of a JS-initiated + // client redirect (e.g onload/setTimeout document.location.href=). + // FIXME: (b/1085325, b/1046841) We don't get proper redirect + // performed/cancelled notifications across anchor navigations, so the + // other redirect-tracking code in this class (see + // dispatch*ClientRedirect() and dispatchDidStartProvisionalLoad) is + // insufficient to catch and properly flag these transitions. Once a + // proper fix for this bug is identified and applied the following + // block may no longer be required. + bool wasClientRedirect = + (url == m_expectedClientRedirectDest && chainEnd == m_expectedClientRedirectSrc) + || !m_webFrame->isProcessingUserGesture(); + + if (wasClientRedirect) { + if (m_webFrame->client()) + m_webFrame->client()->didCompleteClientRedirect(m_webFrame, chainEnd); + ds->appendRedirect(chainEnd); + // Make sure we clear the expected redirect since we just effectively + // completed it. + m_expectedClientRedirectSrc = KURL(); + m_expectedClientRedirectDest = KURL(); + } } // Regardless of how we got here, we are navigating to a URL so we need to @@ -614,26 +636,32 @@ void FrameLoaderClientImpl::dispatchDidChangeLocationWithinPage() bool isNewNavigation; webView->didCommitLoad(&isNewNavigation); if (m_webFrame->client()) - m_webFrame->client()->didChangeLocationWithinPage(m_webFrame, isNewNavigation); + m_webFrame->client()->didNavigateWithinPage(m_webFrame, isNewNavigation); // Generate didStopLoading if loader is completed. if (webView->client() && loaderCompleted) webView->client()->didStopLoading(); } +void FrameLoaderClientImpl::dispatchDidChangeLocationWithinPage() +{ + if (m_webFrame) + m_webFrame->client()->didChangeLocationWithinPage(m_webFrame); +} + void FrameLoaderClientImpl::dispatchDidPushStateWithinPage() { - // FIXME + dispatchDidNavigateWithinPage(); } void FrameLoaderClientImpl::dispatchDidReplaceStateWithinPage() { - // FIXME + dispatchDidNavigateWithinPage(); } void FrameLoaderClientImpl::dispatchDidPopStateWithinPage() { - // FIXME + // Ignored since dispatchDidNavigateWithinPage was already called. } void FrameLoaderClientImpl::dispatchWillClose() @@ -700,6 +728,12 @@ void FrameLoaderClientImpl::dispatchDidReceiveTitle(const String& title) m_webFrame->client()->didReceiveTitle(m_webFrame, title); } +void FrameLoaderClientImpl::dispatchDidChangeIcons() +{ + if (m_webFrame->client()) + m_webFrame->client()->didChangeIcons(m_webFrame); +} + void FrameLoaderClientImpl::dispatchDidCommitLoad() { WebViewImpl* webview = m_webFrame->viewImpl(); @@ -708,9 +742,6 @@ void FrameLoaderClientImpl::dispatchDidCommitLoad() if (m_webFrame->client()) m_webFrame->client()->didCommitProvisionalLoad(m_webFrame, isNewNavigation); - - if (webview->devToolsAgentPrivate()) - webview->devToolsAgentPrivate()->didCommitProvisionalLoad(m_webFrame, isNewNavigation); } void FrameLoaderClientImpl::dispatchDidFailProvisionalLoad( @@ -762,12 +793,14 @@ void FrameLoaderClientImpl::dispatchDidFinishLoad() void FrameLoaderClientImpl::dispatchDidFirstLayout() { + if (m_webFrame->client()) + m_webFrame->client()->didFirstLayout(m_webFrame); } void FrameLoaderClientImpl::dispatchDidFirstVisuallyNonEmptyLayout() { - // FIXME: called when webkit finished layout of a page that was visually non-empty. - // All resources have not necessarily finished loading. + if (m_webFrame->client()) + m_webFrame->client()->didFirstVisuallyNonEmptyLayout(m_webFrame); } Frame* FrameLoaderClientImpl::dispatchCreatePage() @@ -797,38 +830,6 @@ void FrameLoaderClientImpl::dispatchShow() webView->client()->show(webView->initialNavigationPolicy()); } -static bool shouldTreatAsAttachment(const ResourceResponse& response) -{ - const String& contentDisposition = - response.httpHeaderField("Content-Disposition"); - if (contentDisposition.isEmpty()) - return false; - - // Some broken sites just send - // Content-Disposition: ; filename="file" - // screen those out here. - if (contentDisposition.startsWith(";")) - return false; - - if (contentDisposition.startsWith("inline", false)) - return false; - - // Some broken sites just send - // Content-Disposition: filename="file" - // without a disposition token... screen those out. - if (contentDisposition.startsWith("filename", false)) - return false; - - // Also in use is Content-Disposition: name="file" - if (contentDisposition.startsWith("name", false)) - return false; - - // We have a content-disposition of "attachment" or unknown. - // RFC 2183, section 2.8 says that an unknown disposition - // value should be treated as "attachment" - return true; -} - void FrameLoaderClientImpl::dispatchDecidePolicyForMIMEType( FramePolicyFunction function, const String& mimeType, @@ -843,7 +844,7 @@ void FrameLoaderClientImpl::dispatchDecidePolicyForMIMEType( if (statusCode == 204 || statusCode == 205) { // The server does not want us to replace the page contents. action = PolicyIgnore; - } else if (shouldTreatAsAttachment(response)) { + } else if (WebCore::contentDispositionType(response.httpHeaderField("Content-Disposition")) == WebCore::ContentDispositionAttachment) { // The server wants us to download instead of replacing the page contents. // Downloading is handled by the embedder, but we still get the initial // response so that we can ignore it and clean up properly. @@ -898,51 +899,48 @@ void FrameLoaderClientImpl::dispatchDecidePolicyForNavigationAction( // The null check here is to fix a crash that seems strange // (see - https://bugs.webkit.org/show_bug.cgi?id=23554). if (m_webFrame->client() && !request.url().isNull()) { - WebNavigationPolicy navigationPolicy = WebNavigationPolicyCurrentTab; - actionSpecifiesNavigationPolicy(action, &navigationPolicy); - - // Give the delegate a chance to change the navigation policy. - const WebDataSourceImpl* ds = m_webFrame->provisionalDataSourceImpl(); - if (ds) { - KURL url = ds->request().url(); - if (url.protocolIs(backForwardNavigationScheme)) { - handleBackForwardNavigation(url); - navigationPolicy = WebNavigationPolicyIgnore; - } else { - bool isRedirect = ds->hasRedirectChain(); - - WebNavigationType webnavType = - WebDataSourceImpl::toWebNavigationType(action.type()); - - RefPtr<Node> node; - for (const Event* event = action.event(); event; event = event->underlyingEvent()) { - if (event->isMouseEvent()) { - const MouseEvent* mouseEvent = - static_cast<const MouseEvent*>(event); - node = m_webFrame->frame()->eventHandler()->hitTestResultAtPoint( - mouseEvent->absoluteLocation(), false).innerNonSharedNode(); - break; - } - } - WebNode originatingNode(node); - - navigationPolicy = m_webFrame->client()->decidePolicyForNavigation( - m_webFrame, ds->request(), webnavType, originatingNode, - navigationPolicy, isRedirect); - } - } - - if (navigationPolicy == WebNavigationPolicyCurrentTab) - policyAction = PolicyUse; - else if (navigationPolicy == WebNavigationPolicyDownload) - policyAction = PolicyDownload; - else { - if (navigationPolicy != WebNavigationPolicyIgnore) { - WrappedResourceRequest webreq(request); - m_webFrame->client()->loadURLExternally(m_webFrame, webreq, navigationPolicy); - } - policyAction = PolicyIgnore; - } + WebNavigationPolicy navigationPolicy = WebNavigationPolicyCurrentTab; + actionSpecifiesNavigationPolicy(action, &navigationPolicy); + + // Give the delegate a chance to change the navigation policy. + const WebDataSourceImpl* ds = m_webFrame->provisionalDataSourceImpl(); + if (ds) { + KURL url = ds->request().url(); + ASSERT(!url.protocolIs(backForwardNavigationScheme)); + + bool isRedirect = ds->hasRedirectChain(); + + WebNavigationType webnavType = + WebDataSourceImpl::toWebNavigationType(action.type()); + + RefPtr<Node> node; + for (const Event* event = action.event(); event; event = event->underlyingEvent()) { + if (event->isMouseEvent()) { + const MouseEvent* mouseEvent = + static_cast<const MouseEvent*>(event); + node = m_webFrame->frame()->eventHandler()->hitTestResultAtPoint( + mouseEvent->absoluteLocation(), false).innerNonSharedNode(); + break; + } + } + WebNode originatingNode(node); + + navigationPolicy = m_webFrame->client()->decidePolicyForNavigation( + m_webFrame, ds->request(), webnavType, originatingNode, + navigationPolicy, isRedirect); + } + + if (navigationPolicy == WebNavigationPolicyCurrentTab) + policyAction = PolicyUse; + else if (navigationPolicy == WebNavigationPolicyDownload) + policyAction = PolicyDownload; + else { + if (navigationPolicy != WebNavigationPolicyIgnore) { + WrappedResourceRequest webreq(request); + m_webFrame->client()->loadURLExternally(m_webFrame, webreq, navigationPolicy); + } + policyAction = PolicyIgnore; + } } (m_webFrame->frame()->loader()->policyChecker()->*function)(policyAction); @@ -958,6 +956,12 @@ void FrameLoaderClientImpl::dispatchUnableToImplementPolicy(const ResourceError& m_webFrame->client()->unableToImplementPolicyWithError(m_webFrame, error); } +void FrameLoaderClientImpl::dispatchWillSendSubmitEvent(HTMLFormElement* form) +{ + if (m_webFrame->client()) + m_webFrame->client()->willSendSubmitEvent(m_webFrame, WebFormElement(form)); +} + void FrameLoaderClientImpl::dispatchWillSubmitForm(FramePolicyFunction function, PassRefPtr<FormState> formState) { @@ -1075,7 +1079,7 @@ void FrameLoaderClientImpl::finishedLoading(DocumentLoader* dl) // However, we only want to do this if makeRepresentation has been called, to // match the behavior on the Mac. if (m_hasRepresentation) - dl->frameLoader()->setEncoding("", false); + dl->frameLoader()->writer()->setEncoding("", false); } } @@ -1087,10 +1091,28 @@ void FrameLoaderClientImpl::updateGlobalHistoryRedirectLinks() { } -bool FrameLoaderClientImpl::shouldGoToHistoryItem(HistoryItem*) const +bool FrameLoaderClientImpl::shouldGoToHistoryItem(HistoryItem* item) const { - // FIXME - return true; + const KURL& url = item->url(); + if (!url.protocolIs(backForwardNavigationScheme)) + return true; + + // Else, we'll punt this history navigation to the embedder. It is + // necessary that we intercept this here, well before the FrameLoader + // has made any state changes for this history traversal. + + bool ok; + int offset = url.lastPathComponent().toIntStrict(&ok); + if (!ok) { + ASSERT_NOT_REACHED(); + return false; + } + + WebViewImpl* webview = m_webFrame->viewImpl(); + if (webview->client()) + webview->client()->navigateBackForwardSoon(offset); + + return false; } void FrameLoaderClientImpl::dispatchDidAddBackForwardItem(HistoryItem*) const @@ -1332,6 +1354,19 @@ PassRefPtr<Frame> FrameLoaderClientImpl::createFrame( return m_webFrame->createChildFrame(frameRequest, ownerElement); } +void FrameLoaderClientImpl::didTransferChildFrameToNewDocument() +{ + ASSERT(m_webFrame->frame()->ownerElement()); + + WebFrameImpl* newParent = static_cast<WebFrameImpl*>(m_webFrame->parent()); + if (!newParent || !newParent->client()) + return; + + // Replace the client since the old client may be destroyed when the + // previous page is closed. + m_webFrame->setClient(newParent->client()); +} + PassRefPtr<Widget> FrameLoaderClientImpl::createPlugin( const IntSize& size, // FIXME: how do we use this? HTMLPlugInElement* element, @@ -1341,20 +1376,6 @@ PassRefPtr<Widget> FrameLoaderClientImpl::createPlugin( const String& mimeType, bool loadManually) { -#if !OS(WINDOWS) - // WebCore asks us to make a plugin even if we don't have a - // registered handler, with a comment saying it's so we can display - // the broken plugin icon. In Chromium, we normally register a - // fallback plugin handler that allows you to install a missing - // plugin. Since we don't yet have a default plugin handler, we - // need to return null here rather than going through all the - // plugin-creation IPCs only to discover we don't have a plugin - // registered, which causes a crash. - // FIXME: remove me once we have a default plugin. - if (objectContentType(url, mimeType) != ObjectContentNetscapePlugin) - return 0; -#endif - if (!m_webFrame->client()) return 0; @@ -1376,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; @@ -1452,33 +1481,34 @@ bool FrameLoaderClientImpl::actionSpecifiesNavigationPolicy( const NavigationAction& action, WebNavigationPolicy* policy) { - if ((action.type() != NavigationTypeLinkClicked) || !action.event()->isMouseEvent()) + const MouseEvent* event = 0; + if (action.type() == NavigationTypeLinkClicked + && action.event()->isMouseEvent()) + event = static_cast<const MouseEvent*>(action.event()); + else if (action.type() == NavigationTypeFormSubmitted + && action.event() + && action.event()->underlyingEvent() + && action.event()->underlyingEvent()->isMouseEvent()) + event = static_cast<const MouseEvent*>(action.event()->underlyingEvent()); + + if (!event) return false; - const MouseEvent* event = static_cast<const MouseEvent*>(action.event()); return WebViewImpl::navigationPolicyFromMouseEvent( event->button(), event->ctrlKey(), event->shiftKey(), event->altKey(), event->metaKey(), policy); } -void FrameLoaderClientImpl::handleBackForwardNavigation(const KURL& url) -{ - ASSERT(url.protocolIs(backForwardNavigationScheme)); - - bool ok; - int offset = url.lastPathComponent().toIntStrict(&ok); - if (!ok) - return; - - WebViewImpl* webview = m_webFrame->viewImpl(); - if (webview->client()) - webview->client()->navigateBackForwardSoon(offset); -} - PassOwnPtr<WebPluginLoadObserver> FrameLoaderClientImpl::pluginLoadObserver() { WebDataSourceImpl* ds = WebDataSourceImpl::fromDocumentLoader( m_webFrame->frame()->loader()->activeDocumentLoader()); + if (!ds) { + // We can arrive here if a popstate event handler detaches this frame. + // FIXME: Remove this code once http://webkit.org/b/36202 is fixed. + ASSERT(!m_webFrame->frame()->page()); + return 0; + } return ds->releasePluginLoadObserver(); } diff --git a/WebKit/chromium/src/FrameLoaderClientImpl.h b/WebKit/chromium/src/FrameLoaderClientImpl.h index 901600c..3a8a714 100644 --- a/WebKit/chromium/src/FrameLoaderClientImpl.h +++ b/WebKit/chromium/src/FrameLoaderClientImpl.h @@ -31,14 +31,12 @@ #ifndef FrameLoaderClientImpl_h #define FrameLoaderClientImpl_h -// FIXME: remove this relative path once consumers from glue are removed. -#include "../public/WebNavigationPolicy.h" #include "FrameLoaderClient.h" #include "KURL.h" +#include "WebNavigationPolicy.h" #include <wtf/PassOwnPtr.h> #include <wtf/RefPtr.h> - namespace WebKit { class WebFrameImpl; @@ -89,11 +87,11 @@ public: virtual void dispatchDidFinishLoading(WebCore::DocumentLoader*, unsigned long identifier); virtual void dispatchDidFailLoading(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceError&); virtual bool dispatchDidLoadResourceFromMemoryCache(WebCore::DocumentLoader*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, int length); - virtual void dispatchDidLoadResourceByXMLHttpRequest(unsigned long identifier, const WebCore::ScriptString&); virtual void dispatchDidHandleOnloadEvents(); virtual void dispatchDidReceiveServerRedirectForProvisionalLoad(); virtual void dispatchDidCancelClientRedirect(); virtual void dispatchWillPerformClientRedirect(const WebCore::KURL&, double interval, double fireDate); + virtual void dispatchDidNavigateWithinPage(); virtual void dispatchDidChangeLocationWithinPage(); virtual void dispatchDidPushStateWithinPage(); virtual void dispatchDidReplaceStateWithinPage(); @@ -101,7 +99,8 @@ public: virtual void dispatchWillClose(); virtual void dispatchDidReceiveIcon(); virtual void dispatchDidStartProvisionalLoad(); - virtual void dispatchDidReceiveTitle(const WebCore::String& title); + virtual void dispatchDidReceiveTitle(const WTF::String& title); + virtual void dispatchDidChangeIcons(); virtual void dispatchDidCommitLoad(); virtual void dispatchDidFailProvisionalLoad(const WebCore::ResourceError&); virtual void dispatchDidFailLoad(const WebCore::ResourceError&); @@ -111,11 +110,12 @@ public: virtual void dispatchDidFirstVisuallyNonEmptyLayout(); virtual WebCore::Frame* dispatchCreatePage(); virtual void dispatchShow(); - virtual void dispatchDecidePolicyForMIMEType(WebCore::FramePolicyFunction function, const WebCore::String& mime_type, const WebCore::ResourceRequest&); - virtual void dispatchDecidePolicyForNewWindowAction(WebCore::FramePolicyFunction function, const WebCore::NavigationAction& action, const WebCore::ResourceRequest& request, PassRefPtr<WebCore::FormState> form_state, const WebCore::String& frame_name); + virtual void dispatchDecidePolicyForMIMEType(WebCore::FramePolicyFunction function, const WTF::String& mime_type, const WebCore::ResourceRequest&); + virtual void dispatchDecidePolicyForNewWindowAction(WebCore::FramePolicyFunction function, const WebCore::NavigationAction& action, const WebCore::ResourceRequest& request, PassRefPtr<WebCore::FormState> form_state, const WTF::String& frame_name); virtual void dispatchDecidePolicyForNavigationAction(WebCore::FramePolicyFunction function, const WebCore::NavigationAction& action, const WebCore::ResourceRequest& request, PassRefPtr<WebCore::FormState> form_state); virtual void cancelPolicyCheck(); virtual void dispatchUnableToImplementPolicy(const WebCore::ResourceError&); + virtual void dispatchWillSendSubmitEvent(WebCore::HTMLFormElement*); virtual void dispatchWillSubmitForm(WebCore::FramePolicyFunction, PassRefPtr<WebCore::FormState>); virtual void dispatchDidLoadMainResource(WebCore::DocumentLoader*); virtual void revertToProvisionalState(WebCore::DocumentLoader*); @@ -148,9 +148,9 @@ public: virtual WebCore::ResourceError pluginWillHandleLoadError(const WebCore::ResourceResponse&); virtual bool shouldFallBack(const WebCore::ResourceError&); virtual bool canHandleRequest(const WebCore::ResourceRequest&) const; - virtual bool canShowMIMEType(const WebCore::String& MIMEType) const; - virtual bool representationExistsForURLScheme(const WebCore::String& URLScheme) const; - virtual WebCore::String generatedMIMETypeForURLScheme(const WebCore::String& URLScheme) const; + virtual bool canShowMIMEType(const WTF::String& MIMEType) const; + virtual bool representationExistsForURLScheme(const WTF::String& URLScheme) const; + virtual WTF::String generatedMIMETypeForURLScheme(const WTF::String& URLScheme) const; virtual void frameLoadCompleted(); virtual void saveViewStateToItem(WebCore::HistoryItem*); virtual void restoreViewState(); @@ -159,8 +159,8 @@ public: virtual void prepareForDataSourceReplacement(); virtual PassRefPtr<WebCore::DocumentLoader> createDocumentLoader( const WebCore::ResourceRequest&, const WebCore::SubstituteData&); - virtual void setTitle(const WebCore::String& title, const WebCore::KURL&); - virtual WebCore::String userAgent(const WebCore::KURL&); + virtual void setTitle(const WTF::String& title, const WebCore::KURL&); + virtual WTF::String userAgent(const WebCore::KURL&); virtual void savePlatformDataToCachedFrame(WebCore::CachedFrame*); virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*); virtual void transitionToCommittedForNewPage(); @@ -170,30 +170,33 @@ public: const WebCore::ResourceRequest& initialRequest, const WebCore::ResourceResponse&); virtual PassRefPtr<WebCore::Frame> createFrame( - const WebCore::KURL& url, const WebCore::String& name, + const WebCore::KURL& url, const WTF::String& name, WebCore::HTMLFrameOwnerElement* ownerElement, - const WebCore::String& referrer, bool allowsScrolling, + const WTF::String& referrer, bool allowsScrolling, int marginWidth, int marginHeight); + virtual void didTransferChildFrameToNewDocument(); virtual PassRefPtr<WebCore::Widget> createPlugin( const WebCore::IntSize&, WebCore::HTMLPlugInElement*, const WebCore::KURL&, - const Vector<WebCore::String>&, const Vector<WebCore::String>&, - const WebCore::String&, bool loadManually); + const Vector<WTF::String>&, const Vector<WTF::String>&, + const WTF::String&, bool loadManually); virtual void redirectDataToPlugin(WebCore::Widget* pluginWidget); virtual PassRefPtr<WebCore::Widget> createJavaAppletWidget( const WebCore::IntSize&, WebCore::HTMLAppletElement*, const WebCore::KURL& /* base_url */, - const Vector<WebCore::String>& paramNames, - const Vector<WebCore::String>& paramValues); + const Vector<WTF::String>& paramNames, + const Vector<WTF::String>& paramValues); virtual WebCore::ObjectContentType objectContentType( - const WebCore::KURL& url, const WebCore::String& mimeType); - virtual WebCore::String overrideMediaType() const; + const WebCore::KURL& url, const WTF::String& mimeType); + virtual WTF::String overrideMediaType() const; virtual void didPerformFirstNavigation() const; virtual void registerForIconNotification(bool listen = true); virtual void didChangeScrollOffset(); virtual bool allowJavaScript(bool enabledPerSettings); virtual bool allowPlugins(bool enabledPerSettings); virtual bool allowImages(bool enabledPerSettings); + virtual void didNotAllowScript(); + virtual void didNotAllowPlugins(); private: void makeDocumentView(); @@ -203,9 +206,6 @@ private: static bool actionSpecifiesNavigationPolicy( const WebCore::NavigationAction& action, WebNavigationPolicy* policy); - // Called when a dummy back-forward navigation is intercepted. - void handleBackForwardNavigation(const WebCore::KURL&); - PassOwnPtr<WebPluginLoadObserver> pluginLoadObserver(); // The WebFrame that owns this object and manages its lifetime. Therefore, 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/GLES2Context.cpp b/WebKit/chromium/src/GLES2Context.cpp new file mode 100644 index 0000000..b4b4bb2 --- /dev/null +++ b/WebKit/chromium/src/GLES2Context.cpp @@ -0,0 +1,115 @@ +/* + * 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 "GLES2Context.h" +#include "GLES2ContextInternal.h" +#include "IntSize.h" +#include "WebGLES2Context.h" +#include "WebKit.h" +#include "WebKitClient.h" +#include "WebViewImpl.h" +#include <wtf/OwnPtr.h> + +// There are two levels of delegation in this file: +// +// 1. GLES2Context delegates to GLES2ContextInternal. This is done +// so that we have some place to store data members common among +// implementations. +// +// 2. GLES2ContextInternal delegates to an implementation of +// WebGLES2Context. This is done so we have a place to inject an +// implementation which creates the GL ES context. + +using namespace WebKit; + +namespace WebCore { + +PassOwnPtr<GLES2ContextInternal> GLES2ContextInternal::create(WebGLES2Context* impl, bool owns) +{ + PassOwnPtr<GLES2ContextInternal> result = new GLES2ContextInternal(impl, owns); + return result; +} + +PassOwnPtr<GLES2Context> GLES2Context::create(PassOwnPtr<GLES2ContextInternal> internal) +{ + PassOwnPtr<GLES2Context> result = new GLES2Context(); + result->m_internal = internal; + return result; +} + +GLES2Context::GLES2Context() +{ +} + +GLES2Context::~GLES2Context() +{ +} + +bool GLES2Context::makeCurrent() +{ + WebGLES2Context* webContext = m_internal->getWebGLES2Context(); + if (!webContext) + return false; + return webContext->makeCurrent(); +} + +bool GLES2Context::destroy() +{ + WebGLES2Context* webContext = m_internal->getWebGLES2Context(); + if (!webContext) + return false; + return webContext->destroy(); +} + +bool GLES2Context::swapBuffers() +{ + WebGLES2Context* webContext = m_internal->getWebGLES2Context(); + if (!webContext) + return false; + return webContext->swapBuffers(); +} + +void GLES2Context::resizeOffscreenContent(const IntSize& size) +{ + WebGLES2Context* webContext = m_internal->getWebGLES2Context(); + ASSERT(webContext); + webContext->resizeOffscreenContent(size); +} + +unsigned GLES2Context::getOffscreenContentParentTextureId() +{ + WebGLES2Context* webContext = m_internal->getWebGLES2Context(); + ASSERT(webContext); + return webContext->getOffscreenContentParentTextureId(); +} + +} // namespace WebCore diff --git a/WebKit/chromium/src/GLES2ContextInternal.cpp b/WebKit/chromium/src/GLES2ContextInternal.cpp new file mode 100644 index 0000000..33eb602 --- /dev/null +++ b/WebKit/chromium/src/GLES2ContextInternal.cpp @@ -0,0 +1,52 @@ +/* + * 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 "GLES2ContextInternal.h" + +#include "WebGLES2Context.h" + +namespace WebCore { + +GLES2ContextInternal::GLES2ContextInternal(WebKit::WebGLES2Context* impl, bool owns) + : m_impl(impl) + , m_owns(owns) +{ +} + +GLES2ContextInternal::~GLES2ContextInternal() +{ + if (m_owns) + delete m_impl; +} + +} // namespace WebCore + diff --git a/WebKit/chromium/src/GLES2ContextInternal.h b/WebKit/chromium/src/GLES2ContextInternal.h new file mode 100644 index 0000000..4668311 --- /dev/null +++ b/WebKit/chromium/src/GLES2ContextInternal.h @@ -0,0 +1,55 @@ +/* + * 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 <wtf/PassOwnPtr.h> + +namespace WebKit { +class WebGLES2Context; +} + +namespace WebCore { + +class GLES2ContextInternal { +public: + // If 'owns' is set to true, this GLES2ContextInternal takes ownership of the passed in WebKit::WebGLES2Context. + static PassOwnPtr<GLES2ContextInternal> create(WebKit::WebGLES2Context* impl, bool owns); + + WebKit::WebGLES2Context* getWebGLES2Context() { return m_impl; } + + ~GLES2ContextInternal(); + +private: + GLES2ContextInternal(WebKit::WebGLES2Context* impl, bool owns); + + WebKit::WebGLES2Context* m_impl; + bool m_owns; +}; + +} diff --git a/WebKit/chromium/src/GraphicsContext3D.cpp b/WebKit/chromium/src/GraphicsContext3D.cpp index 83574da..6bc5ffe 100644 --- a/WebKit/chromium/src/GraphicsContext3D.cpp +++ b/WebKit/chromium/src/GraphicsContext3D.cpp @@ -35,2184 +35,1220 @@ #include "GraphicsContext3D.h" #include "CachedImage.h" -#include "CString.h" +#include "CanvasLayerChromium.h" +#include "CanvasRenderingContext.h" +#include "Chrome.h" +#include "ChromeClientImpl.h" #include "HTMLCanvasElement.h" #include "HTMLImageElement.h" #include "ImageBuffer.h" #include "ImageData.h" -#include "NotImplemented.h" -#include "WebGLBuffer.h" -#include "WebGLByteArray.h" -#include "WebGLFloatArray.h" -#include "WebGLFramebuffer.h" -#include "WebGLIntArray.h" -#include "WebGLProgram.h" -#include "WebGLRenderbuffer.h" -#include "WebGLRenderingContext.h" -#include "WebGLShader.h" -#include "WebGLTexture.h" -#include "WebGLUnsignedByteArray.h" +#include "WebGraphicsContext3D.h" +#include "WebGraphicsContext3DDefaultImpl.h" +#include "WebKit.h" +#include "WebKitClient.h" +#include "WebViewImpl.h" #include <stdio.h> #include <wtf/FastMalloc.h> - -#if OS(WINDOWS) -#include <windows.h> -#endif - -#include "GL/glew.h" +#include <wtf/text/CString.h> #if PLATFORM(CG) #include "GraphicsContext.h" #include <CoreGraphics/CGContext.h> -#include <CoreGraphics/CGBitmapContext.h> #include <CoreGraphics/CGImage.h> -#include <OpenGL/OpenGL.h> -#else -#define FLIP_FRAMEBUFFER_VERTICALLY #endif -#if PLATFORM(SKIA) -#include "NativeImageSkia.h" -#endif - -#if OS(DARWIN) -#define USE_TEXTURE_RECTANGLE_FOR_FRAMEBUFFER -#endif - -#if OS(LINUX) -#include <dlfcn.h> -#include "GL/glxew.h" -#endif - -using namespace std; +// using namespace std; + +// There are two levels of delegation in this file: +// +// 1. GraphicsContext3D delegates to GraphicsContext3DInternal. This is done +// so that we have some place to store data members common among +// implementations; GraphicsContext3D only provides us the m_internal +// pointer. We always delegate to the GraphicsContext3DInternal. While we +// could sidestep it and go directly to the WebGraphicsContext3D in some +// cases, it is better for consistency to always delegate through it. +// +// 2. GraphicsContext3DInternal delegates to an implementation of +// WebGraphicsContext3D. This is done so we have a place to inject an +// implementation which remotes the OpenGL calls across processes. +// +// The legacy, in-process, implementation uses WebGraphicsContext3DDefaultImpl. namespace WebCore { -// GraphicsContext3DInternal ----------------------------------------------------- - -// Uncomment this to render to a separate window for debugging -// #define RENDER_TO_DEBUGGING_WINDOW - -#define EXTRACT(val) (!val ? 0 : val->object()) +//---------------------------------------------------------------------- +// GraphicsContext3DInternal class GraphicsContext3DInternal { public: - GraphicsContext3DInternal(GraphicsContext3D::Attributes attrs); + GraphicsContext3DInternal(); ~GraphicsContext3DInternal(); - bool makeContextCurrent(); + bool initialize(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow); PlatformGraphicsContext3D platformGraphicsContext3D() const; Platform3DObject platformTexture() const; + bool makeContextCurrent(); + + int sizeInBytes(int type); + void reshape(int width, int height); - void beginPaint(WebGLRenderingContext* context); + void paintRenderingResultsToCanvas(CanvasRenderingContext* context); + bool paintsIntoCanvasBuffer() const; - bool validateTextureTarget(int target); - bool validateTextureParameter(int param); + void prepareTexture(); + +#if USE(ACCELERATED_COMPOSITING) + CanvasLayerChromium* platformLayer() const; +#endif + bool isGLES2Compliant() const; + bool isGLES2NPOTStrict() const; + bool isErrorGeneratedOnOutOfBoundsAccesses() const; + //---------------------------------------------------------------------- + // Entry points for WebGL. + // void activeTexture(unsigned long texture); - void bindBuffer(unsigned long target, - WebGLBuffer* buffer); - void bindFramebuffer(unsigned long target, - WebGLFramebuffer* framebuffer); - void bindTexture(unsigned long target, - WebGLTexture* texture); - void bufferDataImpl(unsigned long target, int size, const void* data, unsigned long usage); + void attachShader(Platform3DObject program, Platform3DObject shader); + void bindAttribLocation(Platform3DObject, unsigned long index, const String& name); + void bindBuffer(unsigned long target, Platform3DObject); + void bindFramebuffer(unsigned long target, Platform3DObject); + void bindRenderbuffer(unsigned long target, Platform3DObject); + void bindTexture(unsigned long target, Platform3DObject texture); + void blendColor(double red, double green, double blue, double alpha); + void blendEquation(unsigned long mode); + void blendEquationSeparate(unsigned long modeRGB, unsigned long modeAlpha); + void blendFunc(unsigned long sfactor, unsigned long dfactor); + void blendFuncSeparate(unsigned long srcRGB, unsigned long dstRGB, unsigned long srcAlpha, unsigned long dstAlpha); + + void bufferData(unsigned long target, int size, unsigned long usage); + void bufferData(unsigned long target, int size, const void* data, unsigned long usage); + void bufferSubData(unsigned long target, long offset, int size, const void* data); + + unsigned long checkFramebufferStatus(unsigned long target); + void clear(unsigned long mask); + void clearColor(double red, double green, double blue, double alpha); + void clearDepth(double depth); + void clearStencil(long s); + void colorMask(bool red, bool green, bool blue, bool alpha); + void compileShader(Platform3DObject); + + void copyTexImage2D(unsigned long target, long level, unsigned long internalformat, long x, long y, unsigned long width, unsigned long height, long border); + void copyTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, long x, long y, unsigned long width, unsigned long height); + void cullFace(unsigned long mode); + void depthFunc(unsigned long func); + void depthMask(bool flag); + void depthRange(double zNear, double zFar); + void detachShader(Platform3DObject, Platform3DObject); + void disable(unsigned long cap); void disableVertexAttribArray(unsigned long index); + void drawArrays(unsigned long mode, long first, long count); + void drawElements(unsigned long mode, unsigned long count, unsigned long type, long offset); + + void enable(unsigned long cap); void enableVertexAttribArray(unsigned long index); - unsigned long getError(); + void finish(); + void flush(); + void framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, Platform3DObject); + void framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, Platform3DObject, long level); + void frontFace(unsigned long mode); + void generateMipmap(unsigned long target); + + bool getActiveAttrib(Platform3DObject program, unsigned long index, ActiveInfo&); + bool getActiveUniform(Platform3DObject program, unsigned long index, ActiveInfo&); + + void getAttachedShaders(Platform3DObject program, int maxCount, int* count, unsigned int* shaders); + + int getAttribLocation(Platform3DObject, const String& name); + + void getBooleanv(unsigned long pname, unsigned char* value); + + void getBufferParameteriv(unsigned long target, unsigned long pname, int* value); + GraphicsContext3D::Attributes getContextAttributes(); + + unsigned long getError(); + + void getFloatv(unsigned long pname, float* value); + + void getFramebufferAttachmentParameteriv(unsigned long target, unsigned long attachment, unsigned long pname, int* value); + + void getIntegerv(unsigned long pname, int* value); + + void getProgramiv(Platform3DObject program, unsigned long pname, int* value); + + String getProgramInfoLog(Platform3DObject); + + void getRenderbufferParameteriv(unsigned long target, unsigned long pname, int* value); + + void getShaderiv(Platform3DObject, unsigned long pname, int* value); + + String getShaderInfoLog(Platform3DObject); + + String getShaderSource(Platform3DObject); + String getString(unsigned long name); + + void getTexParameterfv(unsigned long target, unsigned long pname, float* value); + void getTexParameteriv(unsigned long target, unsigned long pname, int* value); + + void getUniformfv(Platform3DObject program, long location, float* value); + void getUniformiv(Platform3DObject program, long location, int* value); + + long getUniformLocation(Platform3DObject, const String& name); + + void getVertexAttribfv(unsigned long index, unsigned long pname, float* value); + void getVertexAttribiv(unsigned long index, unsigned long pname, int* value); + + long getVertexAttribOffset(unsigned long index, unsigned long pname); + + void hint(unsigned long target, unsigned long mode); + bool isBuffer(Platform3DObject); + bool isEnabled(unsigned long cap); + bool isFramebuffer(Platform3DObject); + bool isProgram(Platform3DObject); + bool isRenderbuffer(Platform3DObject); + bool isShader(Platform3DObject); + bool isTexture(Platform3DObject); + void lineWidth(double); + void linkProgram(Platform3DObject); + void pixelStorei(unsigned long pname, long param); + void polygonOffset(double factor, double units); + + void readPixels(long x, long y, unsigned long width, unsigned long height, unsigned long format, unsigned long type, void* data); + + void releaseShaderCompiler(); + void renderbufferStorage(unsigned long target, unsigned long internalformat, unsigned long width, unsigned long height); + void sampleCoverage(double value, bool invert); + void scissor(long x, long y, unsigned long width, unsigned long height); + void shaderSource(Platform3DObject, const String& string); + void stencilFunc(unsigned long func, long ref, unsigned long mask); + void stencilFuncSeparate(unsigned long face, unsigned long func, long ref, unsigned long mask); + void stencilMask(unsigned long mask); + void stencilMaskSeparate(unsigned long face, unsigned long mask); + void stencilOp(unsigned long fail, unsigned long zfail, unsigned long zpass); + void stencilOpSeparate(unsigned long face, unsigned long fail, unsigned long zfail, unsigned long zpass); + + // These next several functions return an error code (0 if no errors) rather than using an ExceptionCode. + // Currently they return -1 on any error. + int texImage2D(unsigned target, unsigned level, unsigned internalformat, unsigned width, unsigned height, unsigned border, unsigned format, unsigned type, void* pixels); + + void texParameterf(unsigned target, unsigned pname, float param); + void texParameteri(unsigned target, unsigned pname, int param); + + int texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, unsigned width, unsigned height, unsigned format, unsigned type, void* pixels); + + void uniform1f(long location, float x); + void uniform1fv(long location, float* v, int size); + void uniform1i(long location, int x); + void uniform1iv(long location, int* v, int size); + void uniform2f(long location, float x, float y); + void uniform2fv(long location, float* v, int size); + void uniform2i(long location, int x, int y); + void uniform2iv(long location, int* v, int size); + void uniform3f(long location, float x, float y, float z); + void uniform3fv(long location, float* v, int size); + void uniform3i(long location, int x, int y, int z); + void uniform3iv(long location, int* v, int size); + void uniform4f(long location, float x, float y, float z, float w); + void uniform4fv(long location, float* v, int size); + void uniform4i(long location, int x, int y, int z, int w); + void uniform4iv(long location, int* v, int size); + void uniformMatrix2fv(long location, bool transpose, float* value, int size); + void uniformMatrix3fv(long location, bool transpose, float* value, int size); + void uniformMatrix4fv(long location, bool transpose, float* value, int size); + + void useProgram(Platform3DObject); + void validateProgram(Platform3DObject); + + void vertexAttrib1f(unsigned long indx, float x); + void vertexAttrib1fv(unsigned long indx, float* values); + void vertexAttrib2f(unsigned long indx, float x, float y); + void vertexAttrib2fv(unsigned long indx, float* values); + void vertexAttrib3f(unsigned long indx, float x, float y, float z); + void vertexAttrib3fv(unsigned long indx, float* values); + void vertexAttrib4f(unsigned long indx, float x, float y, float z, float w); + void vertexAttrib4fv(unsigned long indx, float* values); void vertexAttribPointer(unsigned long indx, int size, int type, bool normalized, unsigned long stride, unsigned long offset); - void viewportImpl(long x, long y, unsigned long width, unsigned long height); - void synthesizeGLError(unsigned long error); + void viewport(long x, long y, unsigned long width, unsigned long height); -private: - GraphicsContext3D::Attributes m_attrs; + unsigned createBuffer(); + unsigned createFramebuffer(); + unsigned createProgram(); + unsigned createRenderbuffer(); + unsigned createShader(unsigned long); + unsigned createTexture(); - unsigned int m_texture; - unsigned int m_fbo; - unsigned int m_depthBuffer; - unsigned int m_cachedWidth, m_cachedHeight; + void deleteBuffer(unsigned); + void deleteFramebuffer(unsigned); + void deleteProgram(unsigned); + void deleteRenderbuffer(unsigned); + void deleteShader(unsigned); + void deleteTexture(unsigned); - // For tracking which FBO is bound - unsigned int m_boundFBO; + void synthesizeGLError(unsigned long error); + bool supportsBGRA(); -#ifdef FLIP_FRAMEBUFFER_VERTICALLY - unsigned char* m_scanline; - void flipVertically(unsigned char* framebuffer, - unsigned int width, - unsigned int height); +private: + OwnPtr<WebKit::WebGraphicsContext3D> m_impl; + WebKit::WebViewImpl* m_webViewImpl; +#if USE(ACCELERATED_COMPOSITING) + RefPtr<CanvasLayerChromium> m_compositingLayer; #endif - - // Note: we aren't currently using this information, but we will - // need to in order to verify that all enabled vertex arrays have - // a valid buffer bound -- to avoid crashes on certain cards. - unsigned int m_boundArrayBuffer; - class VertexAttribPointerState { - public: - VertexAttribPointerState(); - - bool enabled; - unsigned long buffer; - unsigned long indx; - int size; - int type; - bool normalized; - unsigned long stride; - unsigned long offset; - }; - - enum { - NumTrackedPointerStates = 2 - }; - VertexAttribPointerState m_vertexAttribPointerState[NumTrackedPointerStates]; - - // Errors raised by synthesizeGLError(). - ListHashSet<unsigned long> m_syntheticErrors; - #if PLATFORM(SKIA) // If the width and height of the Canvas's backing store don't // match those that we were given in the most recent call to // reshape(), then we need an intermediate bitmap to read back the // frame buffer into. This seems to happen when CSS styles are // used to resize the Canvas. - SkBitmap* m_resizingBitmap; + SkBitmap m_resizingBitmap; #endif - 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; +#if PLATFORM(CG) 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 GraphicsContext3D to your platform #endif }; -bool GraphicsContext3DInternal::s_initializedGLEW = false; - -#if OS(LINUX) -GraphicsContext3DInternal::GLConnection* GraphicsContext3DInternal::s_gl = 0; - -GraphicsContext3DInternal::GLConnection* GraphicsContext3DInternal::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); -} - -GraphicsContext3DInternal::GLConnection::~GLConnection() -{ - XCloseDisplay(m_display); - dlclose(m_libGL); -} - -#endif // OS(LINUX) - -GraphicsContext3DInternal::VertexAttribPointerState::VertexAttribPointerState() - : enabled(false) - , buffer(0) - , indx(0) - , size(0) - , type(0) - , normalized(false) - , stride(0) - , offset(0) -{ -} - -GraphicsContext3DInternal::GraphicsContext3DInternal(GraphicsContext3D::Attributes attrs) - : m_attrs(attrs) - , m_texture(0) - , m_fbo(0) - , m_depthBuffer(0) - , m_boundFBO(0) -#ifdef FLIP_FRAMEBUFFER_VERTICALLY - , m_scanline(0) -#endif - , m_boundArrayBuffer(0) +GraphicsContext3DInternal::GraphicsContext3DInternal() + : m_webViewImpl(0) #if PLATFORM(SKIA) - , m_resizingBitmap(0) -#endif -#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 { - // FIXME: we need to take into account the user's requested - // context creation attributes, in particular stencil and - // antialias, and determine which could and could not be honored - // based on the capabilities of the OpenGL implementation. - m_attrs.alpha = true; - m_attrs.depth = true; - m_attrs.stencil = false; - m_attrs.antialias = false; - m_attrs.premultipliedAlpha = true; - -#if OS(WINDOWS) - 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("GraphicsContext3D: RegisterClass failed\n"); - return; - } - } - - 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("GraphicsContext3DInternal: CreateWindow failed\n"); - return; - } - - // get the device context - m_canvasDC = GetDC(m_canvasWindow); - if (!m_canvasDC) { - printf("GraphicsContext3DInternal: GetDC failed\n"); - return; - } - - // find default pixel format - PIXELFORMATDESCRIPTOR pfd; - ZeroMemory(&pfd, sizeof(PIXELFORMATDESCRIPTOR)); - pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR); - pfd.nVersion = 1; - pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL -#ifdef RENDER_TO_DEBUGGING_WINDOW - | PFD_DOUBLEBUFFER -#endif // RENDER_TO_DEBUGGING_WINDOW - ; - int pixelformat = ChoosePixelFormat(m_canvasDC, &pfd); - - // set the pixel format for the dc - if (!SetPixelFormat(m_canvasDC, pixelformat, &pfd)) { - printf("GraphicsContext3D: SetPixelFormat failed\n"); - return; - } - - // create rendering context - m_contextObj = wglCreateContext(m_canvasDC); - if (!m_contextObj) { - printf("GraphicsContext3D: wglCreateContext failed\n"); - return; - } - - if (!wglMakeCurrent(m_canvasDC, m_contextObj)) { - printf("GraphicsContext3D: wglMakeCurrent failed\n"); - return; - } - -#ifdef RENDER_TO_DEBUGGING_WINDOW - typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval); - PFNWGLSWAPINTERVALEXTPROC setSwapInterval = 0; - setSwapInterval = (PFNWGLSWAPINTERVALEXTPROC) wglGetProcAddress("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("GraphicsContext3D: error choosing pixel format\n"); - return; - } - if (!pixelFormat) { - printf("GraphicsContext3D: no pixel format selected\n"); - return; - } - CGLContextObj context; - CGLError res = CGLCreateContext(pixelFormat, 0, &context); - CGLDestroyPixelFormat(pixelFormat); - if (res != kCGLNoError) { - printf("GraphicsContext3D: error creating context\n"); - return; - } - CGLPBufferObj pbuffer; - if (CGLCreatePBuffer(1, 1, GL_TEXTURE_2D, GL_RGBA, 0, &pbuffer) != kCGLNoError) { - CGLDestroyContext(context); - printf("GraphicsContext3D: error creating pbuffer\n"); - return; - } - if (CGLSetPBuffer(context, pbuffer, 0, 0, 0) != kCGLNoError) { - CGLDestroyContext(context); - CGLDestroyPBuffer(pbuffer); - printf("GraphicsContext3D: error attaching pbuffer to context\n"); - return; - } - if (CGLSetCurrentContext(context) != kCGLNoError) { - CGLDestroyContext(context); - CGLDestroyPBuffer(pbuffer); - printf("GraphicsContext3D: error making context current\n"); - return; - } - m_pbuffer = pbuffer; - m_contextObj = context; -#elif OS(LINUX) - if (!s_gl) { - s_gl = GLConnection::create(); - if (!s_gl) - return; - } - - 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("GraphicsContext3D: glXChooseFBConfig failed\n"); - return; - } - if (!nelements) { - printf("GraphicsContext3D: glXChooseFBConfig returned 0 elements\n"); - XFree(config); - return; - } - GLXContext context = s_gl->createNewContext(config[0], GLX_RGBA_TYPE, 0, True); - if (!context) { - printf("GraphicsContext3D: glXCreateNewContext failed\n"); - XFree(config); - return; - } - int pbufferAttrs[] = { - GLX_PBUFFER_WIDTH, - 1, - GLX_PBUFFER_HEIGHT, - 1, - 0 - }; - GLXPbuffer pbuffer = s_gl->createPbuffer(config[0], pbufferAttrs); - XFree(config); - if (!pbuffer) { - printf("GraphicsContext3D: glxCreatePbuffer failed\n"); - return; - } - if (!s_gl->makeCurrent(pbuffer, context)) { - printf("GraphicsContext3D: glXMakeCurrent failed\n"); - return; - } - 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("GraphicsContext3D: GLEW initialization failed\n"); - return; - } - if (!glewIsSupported("GL_VERSION_2_0")) { - printf("GraphicsContext3D: OpenGL 2.0 not supported\n"); - return; - } - s_initializedGLEW = true; - } } GraphicsContext3DInternal::~GraphicsContext3DInternal() { - makeContextCurrent(); -#ifndef RENDER_TO_DEBUGGING_WINDOW - glDeleteRenderbuffersEXT(1, &m_depthBuffer); - glDeleteTextures(1, &m_texture); -#ifdef FLIP_FRAMEBUFFER_VERTICALLY - if (m_scanline) - delete[] m_scanline; -#endif - glDeleteFramebuffersEXT(1, &m_fbo); -#endif // !RENDER_TO_DEBUGGING_WINDOW -#if PLATFORM(SKIA) - if (m_resizingBitmap) - delete m_resizingBitmap; -#endif -#if OS(WINDOWS) - wglMakeCurrent(0, 0); - wglDeleteContext(m_contextObj); - ReleaseDC(m_canvasWindow, m_canvasDC); - DestroyWindow(m_canvasWindow); -#elif PLATFORM(CG) - CGLSetCurrentContext(0); - CGLDestroyContext(m_contextObj); - CGLDestroyPBuffer(m_pbuffer); +#if PLATFORM(CG) 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; } -bool GraphicsContext3DInternal::makeContextCurrent() +bool GraphicsContext3DInternal::initialize(GraphicsContext3D::Attributes attrs, + HostWindow* hostWindow) { -#if OS(WINDOWS) - if (wglGetCurrentContext() != m_contextObj) - if (wglMakeCurrent(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 + WebKit::WebGraphicsContext3D::Attributes webAttributes; + webAttributes.alpha = attrs.alpha; + webAttributes.depth = attrs.depth; + webAttributes.stencil = attrs.stencil; + webAttributes.antialias = attrs.antialias; + webAttributes.premultipliedAlpha = attrs.premultipliedAlpha; + WebKit::WebGraphicsContext3D* webContext = WebKit::webKitClient()->createGraphicsContext3D(); + if (!webContext) + return false; + + Chrome* chrome = static_cast<Chrome*>(hostWindow); + WebKit::ChromeClientImpl* chromeClientImpl = static_cast<WebKit::ChromeClientImpl*>(chrome->client()); + + m_webViewImpl = chromeClientImpl->webView(); + + if (!m_webViewImpl) + return false; + if (!webContext->initialize(webAttributes, m_webViewImpl)) { + delete webContext; + return false; + } + m_impl.set(webContext); + +#if USE(ACCELERATED_COMPOSITING) + m_compositingLayer = CanvasLayerChromium::create(0); #endif - return false; + return true; } PlatformGraphicsContext3D GraphicsContext3DInternal::platformGraphicsContext3D() const { - return m_contextObj; + return m_impl.get(); } Platform3DObject GraphicsContext3DInternal::platformTexture() const { - return m_texture; + return m_impl->getPlatformTextureId(); } -static int createTextureObject(GLenum target) +void GraphicsContext3DInternal::prepareTexture() { - GLuint texture = 0; - glGenTextures(1, &texture); - glBindTexture(target, texture); - glTexParameterf(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterf(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - return texture; + m_impl->prepareTexture(); } -void GraphicsContext3DInternal::reshape(int width, int height) +#if USE(ACCELERATED_COMPOSITING) +CanvasLayerChromium* GraphicsContext3DInternal::platformLayer() const { -#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); - // Generate the framebuffer object - glGenFramebuffersEXT(1, &m_fbo); - // Generate the depth buffer - glGenRenderbuffersEXT(1, &m_depthBuffer); - } - - // Reallocate the color and depth buffers - glBindTexture(target, m_texture); - glTexImage2D(target, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); - glBindTexture(target, 0); - - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo); - m_boundFBO = m_fbo; - glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, m_depthBuffer); - glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, width, height); - glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0); - - glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, target, m_texture, 0); - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, m_depthBuffer); - GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); - if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { - printf("GraphicsContext3D: framebuffer was incomplete\n"); - - // FIXME: cleanup. - notImplemented(); - } -#endif // RENDER_TO_DEBUGGING_WINDOW - -#ifdef FLIP_FRAMEBUFFER_VERTICALLY - if (m_scanline) { - delete[] m_scanline; - m_scanline = 0; - } - m_scanline = new unsigned char[width * 4]; -#endif // FLIP_FRAMEBUFFER_VERTICALLY - - glClear(GL_COLOR_BUFFER_BIT); - -#if PLATFORM(CG) - // Need to reallocate the client-side backing store. - // FIXME: make this more efficient. - if (m_renderOutput) { - delete[] m_renderOutput; - m_renderOutput = 0; - } - int rowBytes = width * 4; - m_renderOutput = new unsigned char[height * rowBytes]; -#endif // PLATFORM(CG) -} - -#ifdef FLIP_FRAMEBUFFER_VERTICALLY -void GraphicsContext3DInternal::flipVertically(unsigned char* framebuffer, - unsigned int width, - unsigned int height) -{ - unsigned char* scanline = m_scanline; - if (!scanline) - return; - unsigned int rowBytes = width * 4; - unsigned int count = height / 2; - for (unsigned int i = 0; i < count; i++) { - unsigned char* rowA = framebuffer + i * rowBytes; - unsigned char* rowB = framebuffer + (height - i - 1) * rowBytes; - // FIXME: this is where the multiplication of the alpha - // channel into the color buffer will need to occur if the - // user specifies the "premultiplyAlpha" flag in the context - // creation attributes. - memcpy(scanline, rowB, rowBytes); - memcpy(rowB, rowA, rowBytes); - memcpy(rowA, scanline, rowBytes); - } + return m_compositingLayer.get(); } #endif -void GraphicsContext3DInternal::beginPaint(WebGLRenderingContext* context) +void GraphicsContext3DInternal::paintRenderingResultsToCanvas(CanvasRenderingContext* context) { - 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 - // GPU memory, and didn't provide an obvious speedup. Since this - // vertical flip is only a temporary solution anyway until Chrome - // is fully GPU composited, it wasn't worth the complexity. - HTMLCanvasElement* canvas = context->canvas(); ImageBuffer* imageBuffer = canvas->buffer(); unsigned char* pixels = 0; - bool mustRestoreFBO = (m_boundFBO != m_fbo); - if (mustRestoreFBO) - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo); #if PLATFORM(SKIA) const SkBitmap* canvasBitmap = imageBuffer->context()->platformContext()->bitmap(); const SkBitmap* readbackBitmap = 0; ASSERT(canvasBitmap->config() == SkBitmap::kARGB_8888_Config); - if (canvasBitmap->width() == m_cachedWidth && canvasBitmap->height() == m_cachedHeight) { + if (canvasBitmap->width() == m_impl->width() && canvasBitmap->height() == m_impl->height()) { // This is the fastest and most common case. We read back // directly into the canvas's backing store. readbackBitmap = canvasBitmap; - if (m_resizingBitmap) { - delete m_resizingBitmap; - m_resizingBitmap = 0; - } + m_resizingBitmap.reset(); } else { // We need to allocate a temporary bitmap for reading back the // pixel data. We will then use Skia to rescale this bitmap to // the size of the canvas's backing store. - if (m_resizingBitmap && (m_resizingBitmap->width() != m_cachedWidth || m_resizingBitmap->height() != m_cachedHeight)) { - delete m_resizingBitmap; - m_resizingBitmap = 0; - } - if (!m_resizingBitmap) { - m_resizingBitmap = new SkBitmap(); - m_resizingBitmap->setConfig(SkBitmap::kARGB_8888_Config, - m_cachedWidth, - m_cachedHeight); - if (!m_resizingBitmap->allocPixels()) { - delete m_resizingBitmap; - m_resizingBitmap = 0; + if (m_resizingBitmap.width() != m_impl->width() || m_resizingBitmap.height() != m_impl->height()) { + m_resizingBitmap.setConfig(SkBitmap::kARGB_8888_Config, + m_impl->width(), + m_impl->height()); + if (!m_resizingBitmap.allocPixels()) return; - } } - readbackBitmap = m_resizingBitmap; + readbackBitmap = &m_resizingBitmap; } // Read back the frame buffer. SkAutoLockPixels bitmapLock(*readbackBitmap); pixels = static_cast<unsigned char*>(readbackBitmap->getPixels()); - glReadPixels(0, 0, m_cachedWidth, m_cachedHeight, GL_BGRA, GL_UNSIGNED_BYTE, pixels); #elif PLATFORM(CG) - if (m_renderOutput) { + if (m_renderOutput) pixels = m_renderOutput; - 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 (mustRestoreFBO) - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_boundFBO); - -#ifdef FLIP_FRAMEBUFFER_VERTICALLY - if (pixels) - flipVertically(pixels, m_cachedWidth, m_cachedHeight); -#endif + m_impl->readBackFramebuffer(pixels, 4 * m_impl->width() * m_impl->height()); #if PLATFORM(SKIA) - if (m_resizingBitmap) { + if (m_resizingBitmap.readyToDraw()) { // We need to draw the resizing bitmap into the canvas's backing store. SkCanvas canvas(*canvasBitmap); SkRect dst; - dst.set(0, 0, canvasBitmap->width(), canvasBitmap->height()); - canvas.drawBitmapRect(*m_resizingBitmap, 0, dst); + dst.set(SkIntToScalar(0), SkIntToScalar(0), canvasBitmap->width(), canvasBitmap->height()); + canvas.drawBitmapRect(m_resizingBitmap, 0, dst); } #elif PLATFORM(CG) - if (m_renderOutput) { - int rowBytes = m_cachedWidth * 4; - CGDataProviderRef dataProvider = CGDataProviderCreateWithData(0, m_renderOutput, rowBytes * m_cachedHeight, 0); - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); - CGImageRef cgImage = CGImageCreate(m_cachedWidth, - m_cachedHeight, - 8, - 32, - rowBytes, - colorSpace, - kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host, - dataProvider, - 0, - false, - kCGRenderingIntentDefault); - // CSS styling may cause the canvas's content to be resized on - // the page. Go back to the Canvas to figure out the correct - // width and height to draw. - CGRect rect = CGRectMake(0, 0, - context->canvas()->width(), - context->canvas()->height()); - // We want to completely overwrite the previous frame's - // rendering results. - CGContextSetBlendMode(imageBuffer->context()->platformContext(), - kCGBlendModeCopy); - CGContextSetInterpolationQuality(imageBuffer->context()->platformContext(), - kCGInterpolationNone); - CGContextDrawImage(imageBuffer->context()->platformContext(), - rect, cgImage); - CGImageRelease(cgImage); - CGColorSpaceRelease(colorSpace); - CGDataProviderRelease(dataProvider); - } + if (m_renderOutput) + context->graphicsContext3D()->paintToCanvas(m_renderOutput, m_impl->width(), m_impl->height(), + canvas->width(), canvas->height(), + imageBuffer->context()->platformContext()); #else #error Must port to your platform #endif - -#endif // RENDER_TO_DEBUGGING_WINDOW -} - -void GraphicsContext3DInternal::activeTexture(unsigned long texture) -{ - // FIXME: query number of textures available. - if (texture < GL_TEXTURE0 || texture > GL_TEXTURE0+32) - // FIXME: raise exception. - return; - - makeContextCurrent(); - glActiveTexture(texture); -} - -void GraphicsContext3DInternal::bindBuffer(unsigned long target, - WebGLBuffer* buffer) -{ - makeContextCurrent(); - GLuint bufID = EXTRACT(buffer); - if (target == GL_ARRAY_BUFFER) - m_boundArrayBuffer = bufID; - glBindBuffer(target, bufID); } -void GraphicsContext3DInternal::bindFramebuffer(unsigned long target, - WebGLFramebuffer* framebuffer) +bool GraphicsContext3DInternal::paintsIntoCanvasBuffer() const { - makeContextCurrent(); - GLuint id = EXTRACT(framebuffer); - if (!id) - id = m_fbo; - glBindFramebufferEXT(target, id); - m_boundFBO = id; -} - -// If we didn't have to hack GL_TEXTURE_WRAP_R for cube maps, -// we could just use: -// GL_SAME_METHOD_2_X2(BindTexture, bindTexture, unsigned long, WebGLTexture*) -void GraphicsContext3DInternal::bindTexture(unsigned long target, - WebGLTexture* texture) -{ - makeContextCurrent(); - unsigned int textureObject = EXTRACT(texture); - - glBindTexture(target, textureObject); - - // FIXME: GL_TEXTURE_WRAP_R isn't exposed in the OpenGL ES 2.0 - // API. On desktop OpenGL implementations it seems necessary to - // set this wrap mode to GL_CLAMP_TO_EDGE to get correct behavior - // of cube maps. - if (texture) { - if (target == GL_TEXTURE_CUBE_MAP) { - if (!texture->isCubeMapRWrapModeInitialized()) { - glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); - texture->setCubeMapRWrapModeInitialized(true); - } - } else - texture->setCubeMapRWrapModeInitialized(false); - } + // If the gpu compositor is on then skip the readback and software rendering path. + return !m_webViewImpl->isAcceleratedCompositingActive(); } -void GraphicsContext3DInternal::bufferDataImpl(unsigned long target, int size, const void* data, unsigned long usage) +void GraphicsContext3DInternal::reshape(int width, int height) { - makeContextCurrent(); - // FIXME: make this verification more efficient. - GLint binding = 0; - GLenum binding_target = GL_ARRAY_BUFFER_BINDING; - if (target == GL_ELEMENT_ARRAY_BUFFER) - binding_target = GL_ELEMENT_ARRAY_BUFFER_BINDING; - glGetIntegerv(binding_target, &binding); - if (binding <= 0) { - // FIXME: raise exception. - // LogMessagef(("bufferData: no buffer bound")); + if (width == m_impl->width() && height == m_impl->height()) return; - } - - glBufferData(target, - size, - data, - usage); -} -void GraphicsContext3DInternal::disableVertexAttribArray(unsigned long index) -{ - makeContextCurrent(); - if (index < NumTrackedPointerStates) - m_vertexAttribPointerState[index].enabled = false; - glDisableVertexAttribArray(index); -} + m_impl->reshape(width, height); -void GraphicsContext3DInternal::enableVertexAttribArray(unsigned long index) -{ - makeContextCurrent(); - if (index < NumTrackedPointerStates) - m_vertexAttribPointerState[index].enabled = true; - glEnableVertexAttribArray(index); -} - -unsigned long GraphicsContext3DInternal::getError() -{ - if (m_syntheticErrors.size() > 0) { - ListHashSet<unsigned long>::iterator iter = m_syntheticErrors.begin(); - unsigned long err = *iter; - m_syntheticErrors.remove(iter); - return err; +#if PLATFORM(CG) + // Need to reallocate the client-side backing store. + // FIXME: make this more efficient. + if (m_renderOutput) { + delete[] m_renderOutput; + m_renderOutput = 0; } - - makeContextCurrent(); - return glGetError(); -} - -GraphicsContext3D::Attributes GraphicsContext3DInternal::getContextAttributes() -{ - return m_attrs; + int rowBytes = width * 4; + m_renderOutput = new unsigned char[height * rowBytes]; +#endif // PLATFORM(CG) } -void GraphicsContext3DInternal::vertexAttribPointer(unsigned long indx, int size, int type, bool normalized, - unsigned long stride, unsigned long offset) -{ - makeContextCurrent(); - - if (m_boundArrayBuffer <= 0) { - // FIXME: raise exception. - // LogMessagef(("bufferData: no buffer bound")); - return; - } - - if (indx < NumTrackedPointerStates) { - VertexAttribPointerState& state = m_vertexAttribPointerState[indx]; - state.buffer = m_boundArrayBuffer; - state.indx = indx; - state.size = size; - state.type = type; - state.normalized = normalized; - state.stride = stride; - state.offset = offset; - } - - glVertexAttribPointer(indx, size, type, normalized, stride, - reinterpret_cast<void*>(static_cast<intptr_t>(offset))); -} +// Macros to assist in delegating from GraphicsContext3DInternal to +// WebGraphicsContext3D. -void GraphicsContext3DInternal::viewportImpl(long x, long y, unsigned long width, unsigned long height) -{ - glViewport(x, y, width, height); +#define DELEGATE_TO_IMPL(name) \ +void GraphicsContext3DInternal::name() \ +{ \ + m_impl->name(); \ } -void GraphicsContext3DInternal::synthesizeGLError(unsigned long error) -{ - m_syntheticErrors.add(error); +#define DELEGATE_TO_IMPL_R(name, rt) \ +rt GraphicsContext3DInternal::name() \ +{ \ + return m_impl->name(); \ } -// GraphicsContext3D ----------------------------------------------------- - -/* Helper macros for when we're just wrapping a gl method, so that - * we can avoid having to type this 500 times. Note that these MUST - * NOT BE USED if we need to check any of the parameters. - */ - -#define GL_SAME_METHOD_0(glname, name) \ -void GraphicsContext3D::name() \ -{ \ - makeContextCurrent(); \ - gl##glname(); \ +#define DELEGATE_TO_IMPL_1(name, t1) \ +void GraphicsContext3DInternal::name(t1 a1) \ +{ \ + m_impl->name(a1); \ } -#define GL_SAME_METHOD_1(glname, name, t1) \ -void GraphicsContext3D::name(t1 a1) \ -{ \ - makeContextCurrent(); \ - gl##glname(a1); \ +#define DELEGATE_TO_IMPL_1R(name, t1, rt) \ +rt GraphicsContext3DInternal::name(t1 a1) \ +{ \ + return m_impl->name(a1); \ } -#define GL_SAME_METHOD_1_X(glname, name, t1) \ -void GraphicsContext3D::name(t1 a1) \ -{ \ - makeContextCurrent(); \ - gl##glname(EXTRACT(a1)); \ +#define DELEGATE_TO_IMPL_2(name, t1, t2) \ +void GraphicsContext3DInternal::name(t1 a1, t2 a2) \ +{ \ + m_impl->name(a1, a2); \ } -#define GL_SAME_METHOD_2(glname, name, t1, t2) \ -void GraphicsContext3D::name(t1 a1, t2 a2) \ -{ \ - makeContextCurrent(); \ - gl##glname(a1, a2); \ +#define DELEGATE_TO_IMPL_2R(name, t1, t2, rt) \ +rt GraphicsContext3DInternal::name(t1 a1, t2 a2) \ +{ \ + return m_impl->name(a1, a2); \ } -#define GL_SAME_METHOD_2_X12(glname, name, t1, t2) \ -void GraphicsContext3D::name(t1 a1, t2 a2) \ -{ \ - makeContextCurrent(); \ - gl##glname(EXTRACT(a1), EXTRACT(a2)); \ +#define DELEGATE_TO_IMPL_3(name, t1, t2, t3) \ +void GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3) \ +{ \ + m_impl->name(a1, a2, a3); \ } -#define GL_SAME_METHOD_2_X2(glname, name, t1, t2) \ -void GraphicsContext3D::name(t1 a1, t2 a2) \ -{ \ - makeContextCurrent(); \ - gl##glname(a1, EXTRACT(a2)); \ +#define DELEGATE_TO_IMPL_3R(name, t1, t2, t3, rt) \ +rt GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3) \ +{ \ + return m_impl->name(a1, a2, a3); \ } -#define GL_SAME_METHOD_3(glname, name, t1, t2, t3) \ -void GraphicsContext3D::name(t1 a1, t2 a2, t3 a3) \ -{ \ - makeContextCurrent(); \ - gl##glname(a1, a2, a3); \ +#define DELEGATE_TO_IMPL_4(name, t1, t2, t3, t4) \ +void GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3, t4 a4) \ +{ \ + m_impl->name(a1, a2, a3, a4); \ } -#define GL_SAME_METHOD_3_X12(glname, name, t1, t2, t3) \ -void GraphicsContext3D::name(t1 a1, t2 a2, t3 a3) \ -{ \ - makeContextCurrent(); \ - gl##glname(EXTRACT(a1), EXTRACT(a2), a3); \ +#define DELEGATE_TO_IMPL_5(name, t1, t2, t3, t4, t5) \ +void GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5) \ +{ \ + m_impl->name(a1, a2, a3, a4, a5); \ } -#define GL_SAME_METHOD_3_X2(glname, name, t1, t2, t3) \ -void GraphicsContext3D::name(t1 a1, t2 a2, t3 a3) \ -{ \ - makeContextCurrent(); \ - gl##glname(a1, EXTRACT(a2), a3); \ +#define DELEGATE_TO_IMPL_5R(name, t1, t2, t3, t4, t5, rt) \ +rt GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5) \ +{ \ + return m_impl->name(a1, a2, a3, a4, a5); \ } -#define GL_SAME_METHOD_4(glname, name, t1, t2, t3, t4) \ -void GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4) \ -{ \ - makeContextCurrent(); \ - gl##glname(a1, a2, a3, a4); \ +#define DELEGATE_TO_IMPL_6(name, t1, t2, t3, t4, t5, t6) \ +void GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6) \ +{ \ + m_impl->name(a1, a2, a3, a4, a5, a6); \ } -#define GL_SAME_METHOD_4_X4(glname, name, t1, t2, t3, t4) \ -void GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4) \ -{ \ - makeContextCurrent(); \ - gl##glname(a1, a2, a3, EXTRACT(a4)); \ +#define DELEGATE_TO_IMPL_6R(name, t1, t2, t3, t4, t5, t6, rt) \ +rt GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6) \ +{ \ + return m_impl->name(a1, a2, a3, a4, a5, a6); \ } -#define GL_SAME_METHOD_5(glname, name, t1, t2, t3, t4, t5) \ -void GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5) \ -{ \ - makeContextCurrent(); \ - gl##glname(a1, a2, a3, a4, a5); \ +#define DELEGATE_TO_IMPL_7(name, t1, t2, t3, t4, t5, t6, t7) \ +void GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6, t7 a7) \ +{ \ + m_impl->name(a1, a2, a3, a4, a5, a6, a7); \ } -#define GL_SAME_METHOD_5_X4(glname, name, t1, t2, t3, t4, t5) \ -void GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5) \ -{ \ - makeContextCurrent(); \ - gl##glname(a1, a2, a3, EXTRACT(a4), a5); \ +#define DELEGATE_TO_IMPL_7R(name, t1, t2, t3, t4, t5, t6, t7, rt) \ +rt GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6, t7 a7) \ +{ \ + return m_impl->name(a1, a2, a3, a4, a5, a6, a7); \ } -#define GL_SAME_METHOD_6(glname, name, t1, t2, t3, t4, t5, t6) \ -void GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6) \ -{ \ - makeContextCurrent(); \ - gl##glname(a1, a2, a3, a4, a5, a6); \ +#define DELEGATE_TO_IMPL_8(name, t1, t2, t3, t4, t5, t6, t7, t8) \ +void GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6, t7 a7, t8 a8) \ +{ \ + m_impl->name(a1, a2, a3, a4, a5, a6, a7, a8); \ } -#define GL_SAME_METHOD_8(glname, name, t1, t2, t3, t4, t5, t6, t7, t8) \ -void GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6, t7 a7, t8 a8) \ -{ \ - makeContextCurrent(); \ - gl##glname(a1, a2, a3, a4, a5, a6, a7, a8); \ +#define DELEGATE_TO_IMPL_9R(name, t1, t2, t3, t4, t5, t6, t7, t8, t9, rt) \ +rt GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6, t7 a7, t8 a8, t9 a9) \ +{ \ + return m_impl->name(a1, a2, a3, a4, a5, a6, a7, a8, a9); \ } -PassOwnPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attributes attrs) -{ - PassOwnPtr<GraphicsContext3D> context = new GraphicsContext3D(attrs); - // FIXME: add error checking - return context; -} +DELEGATE_TO_IMPL_R(makeContextCurrent, bool) +DELEGATE_TO_IMPL_1R(sizeInBytes, int, int) -GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attrs) - : m_currentWidth(0) - , m_currentHeight(0) - , m_internal(new GraphicsContext3DInternal(attrs)) +bool GraphicsContext3DInternal::isGLES2Compliant() const { + return m_impl->isGLES2Compliant(); } -GraphicsContext3D::~GraphicsContext3D() +bool GraphicsContext3DInternal::isGLES2NPOTStrict() const { + return m_impl->isGLES2NPOTStrict(); } -PlatformGraphicsContext3D GraphicsContext3D::platformGraphicsContext3D() const +bool GraphicsContext3DInternal::isErrorGeneratedOnOutOfBoundsAccesses() const { - return m_internal->platformGraphicsContext3D(); + return m_impl->isErrorGeneratedOnOutOfBoundsAccesses(); } -Platform3DObject GraphicsContext3D::platformTexture() const -{ - return m_internal->platformTexture(); -} +DELEGATE_TO_IMPL_1(activeTexture, unsigned long) +DELEGATE_TO_IMPL_2(attachShader, Platform3DObject, Platform3DObject) -void GraphicsContext3D::makeContextCurrent() +void GraphicsContext3DInternal::bindAttribLocation(Platform3DObject program, unsigned long index, const String& name) { - m_internal->makeContextCurrent(); + m_impl->bindAttribLocation(program, index, name.utf8().data()); } -void GraphicsContext3D::reshape(int width, int height) -{ - if (width == m_currentWidth && height == m_currentHeight) - return; - - m_currentWidth = width; - m_currentHeight = height; - - m_internal->reshape(width, height); -} +DELEGATE_TO_IMPL_2(bindBuffer, unsigned long, Platform3DObject) +DELEGATE_TO_IMPL_2(bindFramebuffer, unsigned long, Platform3DObject) +DELEGATE_TO_IMPL_2(bindRenderbuffer, unsigned long, Platform3DObject) +DELEGATE_TO_IMPL_2(bindTexture, unsigned long, Platform3DObject) +DELEGATE_TO_IMPL_4(blendColor, double, double, double, double) +DELEGATE_TO_IMPL_1(blendEquation, unsigned long) +DELEGATE_TO_IMPL_2(blendEquationSeparate, unsigned long, unsigned long) +DELEGATE_TO_IMPL_2(blendFunc, unsigned long, unsigned long) +DELEGATE_TO_IMPL_4(blendFuncSeparate, unsigned long, unsigned long, unsigned long, unsigned long) -void GraphicsContext3D::beginPaint(WebGLRenderingContext* context) +void GraphicsContext3DInternal::bufferData(unsigned long target, int size, unsigned long usage) { - m_internal->beginPaint(context); + m_impl->bufferData(target, size, 0, usage); } -void GraphicsContext3D::endPaint() +void GraphicsContext3DInternal::bufferData(unsigned long target, int size, const void* data, unsigned long usage) { + m_impl->bufferData(target, size, data, usage); } -int GraphicsContext3D::sizeInBytes(int type) +void GraphicsContext3DInternal::bufferSubData(unsigned long target, long offset, int size, const void* data) { - switch (type) { - case GL_BYTE: - return sizeof(GLbyte); - case GL_UNSIGNED_BYTE: - return sizeof(GLubyte); - case GL_SHORT: - return sizeof(GLshort); - case GL_UNSIGNED_SHORT: - return sizeof(GLushort); - case GL_INT: - return sizeof(GLint); - case GL_UNSIGNED_INT: - return sizeof(GLuint); - case GL_FLOAT: - return sizeof(GLfloat); - default: // FIXME: default cases are discouraged in WebKit. - return 0; - } + m_impl->bufferSubData(target, offset, size, data); } -unsigned GraphicsContext3D::createBuffer() -{ - makeContextCurrent(); - GLuint o; - glGenBuffers(1, &o); - return o; -} +DELEGATE_TO_IMPL_1R(checkFramebufferStatus, unsigned long, unsigned long) +DELEGATE_TO_IMPL_1(clear, unsigned long) +DELEGATE_TO_IMPL_4(clearColor, double, double, double, double) +DELEGATE_TO_IMPL_1(clearDepth, double) +DELEGATE_TO_IMPL_1(clearStencil, long) +DELEGATE_TO_IMPL_4(colorMask, bool, bool, bool, bool) +DELEGATE_TO_IMPL_1(compileShader, Platform3DObject) -unsigned GraphicsContext3D::createFramebuffer() -{ - makeContextCurrent(); - GLuint o = 0; - glGenFramebuffersEXT(1, &o); - return o; -} +DELEGATE_TO_IMPL_8(copyTexImage2D, unsigned long, long, unsigned long, long, long, unsigned long, unsigned long, long) +DELEGATE_TO_IMPL_8(copyTexSubImage2D, unsigned long, long, long, long, long, long, unsigned long, unsigned long) +DELEGATE_TO_IMPL_1(cullFace, unsigned long) +DELEGATE_TO_IMPL_1(depthFunc, unsigned long) +DELEGATE_TO_IMPL_1(depthMask, bool) +DELEGATE_TO_IMPL_2(depthRange, double, double) +DELEGATE_TO_IMPL_2(detachShader, Platform3DObject, Platform3DObject) +DELEGATE_TO_IMPL_1(disable, unsigned long) +DELEGATE_TO_IMPL_1(disableVertexAttribArray, unsigned long) +DELEGATE_TO_IMPL_3(drawArrays, unsigned long, long, long) +DELEGATE_TO_IMPL_4(drawElements, unsigned long, unsigned long, unsigned long, long) -unsigned GraphicsContext3D::createProgram() -{ - makeContextCurrent(); - return glCreateProgram(); -} +DELEGATE_TO_IMPL_1(enable, unsigned long) +DELEGATE_TO_IMPL_1(enableVertexAttribArray, unsigned long) +DELEGATE_TO_IMPL(finish) +DELEGATE_TO_IMPL(flush) +DELEGATE_TO_IMPL_4(framebufferRenderbuffer, unsigned long, unsigned long, unsigned long, Platform3DObject) +DELEGATE_TO_IMPL_5(framebufferTexture2D, unsigned long, unsigned long, unsigned long, Platform3DObject, long) +DELEGATE_TO_IMPL_1(frontFace, unsigned long) +DELEGATE_TO_IMPL_1(generateMipmap, unsigned long) -unsigned GraphicsContext3D::createRenderbuffer() +bool GraphicsContext3DInternal::getActiveAttrib(Platform3DObject program, unsigned long index, ActiveInfo& info) { - makeContextCurrent(); - GLuint o; - glGenRenderbuffersEXT(1, &o); - return o; + WebKit::WebGraphicsContext3D::ActiveInfo webInfo; + if (!m_impl->getActiveAttrib(program, index, webInfo)) + return false; + info.name = webInfo.name; + info.type = webInfo.type; + info.size = webInfo.size; + return true; } -unsigned GraphicsContext3D::createShader(unsigned long type) +bool GraphicsContext3DInternal::getActiveUniform(Platform3DObject program, unsigned long index, ActiveInfo& info) { - makeContextCurrent(); - return glCreateShader((type == FRAGMENT_SHADER) ? GL_FRAGMENT_SHADER : GL_VERTEX_SHADER); + WebKit::WebGraphicsContext3D::ActiveInfo webInfo; + if (!m_impl->getActiveUniform(program, index, webInfo)) + return false; + info.name = webInfo.name; + info.type = webInfo.type; + info.size = webInfo.size; + return true; } -unsigned GraphicsContext3D::createTexture() -{ - makeContextCurrent(); - GLuint o; - glGenTextures(1, &o); - return o; -} +DELEGATE_TO_IMPL_4(getAttachedShaders, Platform3DObject, int, int*, unsigned int*) -void GraphicsContext3D::deleteBuffer(unsigned buffer) +int GraphicsContext3DInternal::getAttribLocation(Platform3DObject program, const String& name) { - makeContextCurrent(); - glDeleteBuffers(1, &buffer); + return m_impl->getAttribLocation(program, name.utf8().data()); } -void GraphicsContext3D::deleteFramebuffer(unsigned framebuffer) -{ - makeContextCurrent(); - glDeleteFramebuffersEXT(1, &framebuffer); -} +DELEGATE_TO_IMPL_2(getBooleanv, unsigned long, unsigned char*) -void GraphicsContext3D::deleteProgram(unsigned program) -{ - makeContextCurrent(); - glDeleteProgram(program); -} +DELEGATE_TO_IMPL_3(getBufferParameteriv, unsigned long, unsigned long, int*) -void GraphicsContext3D::deleteRenderbuffer(unsigned renderbuffer) +GraphicsContext3D::Attributes GraphicsContext3DInternal::getContextAttributes() { - makeContextCurrent(); - glDeleteRenderbuffersEXT(1, &renderbuffer); + WebKit::WebGraphicsContext3D::Attributes webAttributes = m_impl->getContextAttributes(); + GraphicsContext3D::Attributes attributes; + attributes.alpha = webAttributes.alpha; + attributes.depth = webAttributes.depth; + attributes.stencil = webAttributes.stencil; + attributes.antialias = webAttributes.antialias; + attributes.premultipliedAlpha = webAttributes.premultipliedAlpha; + return attributes; } -void GraphicsContext3D::deleteShader(unsigned shader) -{ - makeContextCurrent(); - glDeleteShader(shader); -} +DELEGATE_TO_IMPL_R(getError, unsigned long) -void GraphicsContext3D::deleteTexture(unsigned texture) -{ - makeContextCurrent(); - glDeleteTextures(1, &texture); -} +DELEGATE_TO_IMPL_2(getFloatv, unsigned long, float*) -void GraphicsContext3D::activeTexture(unsigned long texture) -{ - m_internal->activeTexture(texture); -} +DELEGATE_TO_IMPL_4(getFramebufferAttachmentParameteriv, unsigned long, unsigned long, unsigned long, int*) -GL_SAME_METHOD_2_X12(AttachShader, attachShader, WebGLProgram*, WebGLShader*) +DELEGATE_TO_IMPL_2(getIntegerv, unsigned long, int*) -void GraphicsContext3D::bindAttribLocation(WebGLProgram* program, - unsigned long index, - const String& name) -{ - if (!program) - return; - makeContextCurrent(); - glBindAttribLocation(EXTRACT(program), index, name.utf8().data()); -} +DELEGATE_TO_IMPL_3(getProgramiv, Platform3DObject, unsigned long, int*) -void GraphicsContext3D::bindBuffer(unsigned long target, - WebGLBuffer* buffer) +String GraphicsContext3DInternal::getProgramInfoLog(Platform3DObject program) { - m_internal->bindBuffer(target, buffer); + return m_impl->getProgramInfoLog(program); } -void GraphicsContext3D::bindFramebuffer(unsigned long target, WebGLFramebuffer* framebuffer) -{ - m_internal->bindFramebuffer(target, framebuffer); -} +DELEGATE_TO_IMPL_3(getRenderbufferParameteriv, unsigned long, unsigned long, int*) -GL_SAME_METHOD_2_X2(BindRenderbufferEXT, bindRenderbuffer, unsigned long, WebGLRenderbuffer*) +DELEGATE_TO_IMPL_3(getShaderiv, Platform3DObject, unsigned long, int*) -// If we didn't have to hack GL_TEXTURE_WRAP_R for cube maps, -// we could just use: -// GL_SAME_METHOD_2_X2(BindTexture, bindTexture, unsigned long, WebGLTexture*) -void GraphicsContext3D::bindTexture(unsigned long target, - WebGLTexture* texture) +String GraphicsContext3DInternal::getShaderInfoLog(Platform3DObject shader) { - m_internal->bindTexture(target, texture); + return m_impl->getShaderInfoLog(shader); } -GL_SAME_METHOD_4(BlendColor, blendColor, double, double, double, double) - -GL_SAME_METHOD_1(BlendEquation, blendEquation, unsigned long) - -GL_SAME_METHOD_2(BlendEquationSeparate, blendEquationSeparate, unsigned long, unsigned long) - -GL_SAME_METHOD_2(BlendFunc, blendFunc, unsigned long, unsigned long) - -GL_SAME_METHOD_4(BlendFuncSeparate, blendFuncSeparate, unsigned long, unsigned long, unsigned long, unsigned long) - -void GraphicsContext3D::bufferData(unsigned long target, int size, unsigned long usage) +String GraphicsContext3DInternal::getShaderSource(Platform3DObject shader) { - m_internal->bufferDataImpl(target, size, 0, usage); + return m_impl->getShaderSource(shader); } -void GraphicsContext3D::bufferData(unsigned long target, WebGLArray* array, unsigned long usage) +String GraphicsContext3DInternal::getString(unsigned long name) { - m_internal->bufferDataImpl(target, array->byteLength(), array->baseAddress(), usage); + return m_impl->getString(name); } -void GraphicsContext3D::bufferSubData(unsigned long target, long offset, WebGLArray* array) -{ - if (!array || !array->length()) - return; +DELEGATE_TO_IMPL_3(getTexParameterfv, unsigned long, unsigned long, float*) +DELEGATE_TO_IMPL_3(getTexParameteriv, unsigned long, unsigned long, int*) - makeContextCurrent(); - // FIXME: make this verification more efficient. - GLint binding = 0; - GLenum binding_target = GL_ARRAY_BUFFER_BINDING; - if (target == GL_ELEMENT_ARRAY_BUFFER) - binding_target = GL_ELEMENT_ARRAY_BUFFER_BINDING; - glGetIntegerv(binding_target, &binding); - if (binding <= 0) { - // FIXME: raise exception. - // LogMessagef(("bufferSubData: no buffer bound")); - return; - } - glBufferSubData(target, offset, array->byteLength(), array->baseAddress()); -} +DELEGATE_TO_IMPL_3(getUniformfv, Platform3DObject, long, float*) +DELEGATE_TO_IMPL_3(getUniformiv, Platform3DObject, long, int*) -unsigned long GraphicsContext3D::checkFramebufferStatus(unsigned long target) +long GraphicsContext3DInternal::getUniformLocation(Platform3DObject program, const String& name) { - makeContextCurrent(); - return glCheckFramebufferStatusEXT(target); + return m_impl->getUniformLocation(program, name.utf8().data()); } -GL_SAME_METHOD_1(Clear, clear, unsigned long) - -GL_SAME_METHOD_4(ClearColor, clearColor, double, double, double, double) - -GL_SAME_METHOD_1(ClearDepth, clearDepth, double) - -GL_SAME_METHOD_1(ClearStencil, clearStencil, long) - -GL_SAME_METHOD_4(ColorMask, colorMask, bool, bool, bool, bool) - -GL_SAME_METHOD_1_X(CompileShader, compileShader, WebGLShader*) - -GL_SAME_METHOD_8(CopyTexImage2D, copyTexImage2D, unsigned long, long, unsigned long, long, long, unsigned long, unsigned long, long) +DELEGATE_TO_IMPL_3(getVertexAttribfv, unsigned long, unsigned long, float*) +DELEGATE_TO_IMPL_3(getVertexAttribiv, unsigned long, unsigned long, int*) -GL_SAME_METHOD_8(CopyTexSubImage2D, copyTexSubImage2D, unsigned long, long, long, long, long, long, unsigned long, unsigned long) +DELEGATE_TO_IMPL_2R(getVertexAttribOffset, unsigned long, unsigned long, long) -GL_SAME_METHOD_1(CullFace, cullFace, unsigned long) +DELEGATE_TO_IMPL_2(hint, unsigned long, unsigned long) +DELEGATE_TO_IMPL_1R(isBuffer, Platform3DObject, bool) +DELEGATE_TO_IMPL_1R(isEnabled, unsigned long, bool) +DELEGATE_TO_IMPL_1R(isFramebuffer, Platform3DObject, bool) +DELEGATE_TO_IMPL_1R(isProgram, Platform3DObject, bool) +DELEGATE_TO_IMPL_1R(isRenderbuffer, Platform3DObject, bool) +DELEGATE_TO_IMPL_1R(isShader, Platform3DObject, bool) +DELEGATE_TO_IMPL_1R(isTexture, Platform3DObject, bool) +DELEGATE_TO_IMPL_1(lineWidth, double) +DELEGATE_TO_IMPL_1(linkProgram, Platform3DObject) +DELEGATE_TO_IMPL_2(pixelStorei, unsigned long, long) +DELEGATE_TO_IMPL_2(polygonOffset, double, double) +DELEGATE_TO_IMPL_7(readPixels, long, long, unsigned long, unsigned long, unsigned long, unsigned long, void*) +DELEGATE_TO_IMPL(releaseShaderCompiler) +DELEGATE_TO_IMPL_4(renderbufferStorage, unsigned long, unsigned long, unsigned long, unsigned long) +DELEGATE_TO_IMPL_2(sampleCoverage, double, bool) +DELEGATE_TO_IMPL_4(scissor, long, long, unsigned long, unsigned long) -GL_SAME_METHOD_1(DepthFunc, depthFunc, unsigned long) - -GL_SAME_METHOD_1(DepthMask, depthMask, bool) - -GL_SAME_METHOD_2(DepthRange, depthRange, double, double) - -void GraphicsContext3D::detachShader(WebGLProgram* program, WebGLShader* shader) +void GraphicsContext3DInternal::shaderSource(Platform3DObject shader, const String& string) { - if (!program || !shader) - return; - - makeContextCurrent(); - glDetachShader(EXTRACT(program), EXTRACT(shader)); + m_impl->shaderSource(shader, string.utf8().data()); } -GL_SAME_METHOD_1(Disable, disable, unsigned long) +DELEGATE_TO_IMPL_3(stencilFunc, unsigned long, long, unsigned long) +DELEGATE_TO_IMPL_4(stencilFuncSeparate, unsigned long, unsigned long, long, unsigned long) +DELEGATE_TO_IMPL_1(stencilMask, unsigned long) +DELEGATE_TO_IMPL_2(stencilMaskSeparate, unsigned long, unsigned long) +DELEGATE_TO_IMPL_3(stencilOp, unsigned long, unsigned long, unsigned long) +DELEGATE_TO_IMPL_4(stencilOpSeparate, unsigned long, unsigned long, unsigned long, unsigned long) -void GraphicsContext3D::disableVertexAttribArray(unsigned long index) +int GraphicsContext3DInternal::texImage2D(unsigned target, unsigned level, unsigned internalformat, unsigned width, unsigned height, unsigned border, unsigned format, unsigned type, void* pixels) { - m_internal->disableVertexAttribArray(index); + m_impl->texImage2D(target, level, internalformat, width, height, border, format, type, pixels); + return 0; } -void GraphicsContext3D::drawArrays(unsigned long mode, long first, long count) -{ - switch (mode) { - case GL_TRIANGLES: - case GL_TRIANGLE_STRIP: - case GL_TRIANGLE_FAN: - case GL_POINTS: - case GL_LINE_STRIP: - case GL_LINE_LOOP: - case GL_LINES: - break; - default: // FIXME: default cases are discouraged in WebKit. - // FIXME: output log message, raise exception. - // LogMessage(NS_LITERAL_CSTRING("drawArrays: invalid mode")); - // return NS_ERROR_DOM_SYNTAX_ERR; - return; - } - - if (first+count < first || first+count < count) { - // FIXME: output log message, raise exception. - // LogMessage(NS_LITERAL_CSTRING("drawArrays: overflow in first+count")); - // return NS_ERROR_INVALID_ARG; - return; - } - - // FIXME: validate against currently bound buffer. - // if (!ValidateBuffers(first+count)) - // return NS_ERROR_INVALID_ARG; - - makeContextCurrent(); - glDrawArrays(mode, first, count); -} +DELEGATE_TO_IMPL_3(texParameterf, unsigned, unsigned, float) +DELEGATE_TO_IMPL_3(texParameteri, unsigned, unsigned, int) -void GraphicsContext3D::drawElements(unsigned long mode, unsigned long count, unsigned long type, long offset) +int GraphicsContext3DInternal::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, unsigned width, unsigned height, unsigned format, unsigned type, void* pixels) { - makeContextCurrent(); - // FIXME: make this verification more efficient. - GLint binding = 0; - GLenum binding_target = GL_ELEMENT_ARRAY_BUFFER_BINDING; - glGetIntegerv(binding_target, &binding); - if (binding <= 0) { - // FIXME: raise exception. - // LogMessagef(("bufferData: no buffer bound")); - return; - } - glDrawElements(mode, count, type, - reinterpret_cast<void*>(static_cast<intptr_t>(offset))); + m_impl->texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); + return 0; } -GL_SAME_METHOD_1(Enable, enable, unsigned long) +DELEGATE_TO_IMPL_2(uniform1f, long, float) -void GraphicsContext3D::enableVertexAttribArray(unsigned long index) +void GraphicsContext3DInternal::uniform1fv(long location, float* v, int size) { - m_internal->enableVertexAttribArray(index); + m_impl->uniform1fv(location, size, v); } -GL_SAME_METHOD_0(Finish, finish) - -GL_SAME_METHOD_0(Flush, flush) - -GL_SAME_METHOD_4_X4(FramebufferRenderbufferEXT, framebufferRenderbuffer, unsigned long, unsigned long, unsigned long, WebGLRenderbuffer*) - -GL_SAME_METHOD_5_X4(FramebufferTexture2DEXT, framebufferTexture2D, unsigned long, unsigned long, unsigned long, WebGLTexture*, long) +DELEGATE_TO_IMPL_2(uniform1i, long, int) -GL_SAME_METHOD_1(FrontFace, frontFace, unsigned long) - -void GraphicsContext3D::generateMipmap(unsigned long target) +void GraphicsContext3DInternal::uniform1iv(long location, int* v, int size) { - makeContextCurrent(); - if (glGenerateMipmapEXT) - glGenerateMipmapEXT(target); - // FIXME: provide alternative code path? This will be unpleasant - // to implement if glGenerateMipmapEXT is not available -- it will - // require a texture readback and re-upload. + m_impl->uniform1iv(location, size, v); } -bool GraphicsContext3D::getActiveAttrib(WebGLProgram* program, unsigned long index, ActiveInfo& info) -{ - if (!program) { - synthesizeGLError(INVALID_VALUE); - return false; - } - GLint maxNameLength = -1; - glGetProgramiv(EXTRACT(program), GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &maxNameLength); - if (maxNameLength < 0) - return false; - GLchar* name = 0; - if (!tryFastMalloc(maxNameLength * sizeof(GLchar)).getValue(name)) { - synthesizeGLError(OUT_OF_MEMORY); - return false; - } - GLsizei length = 0; - GLint size = -1; - GLenum type = 0; - glGetActiveAttrib(EXTRACT(program), index, maxNameLength, - &length, &size, &type, name); - if (size < 0) { - fastFree(name); - return false; - } - info.name = String(name, length); - info.type = type; - info.size = size; - fastFree(name); - return true; -} +DELEGATE_TO_IMPL_3(uniform2f, long, float, float) -bool GraphicsContext3D::getActiveUniform(WebGLProgram* program, unsigned long index, ActiveInfo& info) +void GraphicsContext3DInternal::uniform2fv(long location, float* v, int size) { - if (!program) { - synthesizeGLError(INVALID_VALUE); - return false; - } - GLint maxNameLength = -1; - glGetProgramiv(EXTRACT(program), GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxNameLength); - if (maxNameLength < 0) - return false; - GLchar* name = 0; - if (!tryFastMalloc(maxNameLength * sizeof(GLchar)).getValue(name)) { - synthesizeGLError(OUT_OF_MEMORY); - return false; - } - GLsizei length = 0; - GLint size = -1; - GLenum type = 0; - glGetActiveUniform(EXTRACT(program), index, maxNameLength, - &length, &size, &type, name); - if (size < 0) { - fastFree(name); - return false; - } - info.name = String(name, length); - info.type = type; - info.size = size; - fastFree(name); - return true; + m_impl->uniform2fv(location, size, v); } -int GraphicsContext3D::getAttribLocation(WebGLProgram* program, const String& name) -{ - if (!program) - return -1; - - makeContextCurrent(); - return glGetAttribLocation(EXTRACT(program), name.utf8().data()); -} +DELEGATE_TO_IMPL_3(uniform2i, long, int, int) -void GraphicsContext3D::getBooleanv(unsigned long pname, unsigned char* value) +void GraphicsContext3DInternal::uniform2iv(long location, int* v, int size) { - makeContextCurrent(); - glGetBooleanv(pname, value); + m_impl->uniform2iv(location, size, v); } -void GraphicsContext3D::getBufferParameteriv(unsigned long target, unsigned long pname, int* value) -{ - makeContextCurrent(); - glGetBufferParameteriv(target, pname, value); -} +DELEGATE_TO_IMPL_4(uniform3f, long, float, float, float) -GraphicsContext3D::Attributes GraphicsContext3D::getContextAttributes() +void GraphicsContext3DInternal::uniform3fv(long location, float* v, int size) { - return m_internal->getContextAttributes(); + m_impl->uniform3fv(location, size, v); } -unsigned long GraphicsContext3D::getError() -{ - return m_internal->getError(); -} +DELEGATE_TO_IMPL_4(uniform3i, long, int, int, int) -void GraphicsContext3D::getFloatv(unsigned long pname, float* value) +void GraphicsContext3DInternal::uniform3iv(long location, int* v, int size) { - makeContextCurrent(); - glGetFloatv(pname, value); + m_impl->uniform3iv(location, size, v); } -void GraphicsContext3D::getFramebufferAttachmentParameteriv(unsigned long target, - unsigned long attachment, - unsigned long pname, - int* value) -{ - makeContextCurrent(); - glGetFramebufferAttachmentParameterivEXT(target, attachment, pname, value); -} +DELEGATE_TO_IMPL_5(uniform4f, long, float, float, float, float) -void GraphicsContext3D::getIntegerv(unsigned long pname, int* value) +void GraphicsContext3DInternal::uniform4fv(long location, float* v, int size) { - makeContextCurrent(); - glGetIntegerv(pname, value); + m_impl->uniform4fv(location, size, v); } -void GraphicsContext3D::getProgramiv(WebGLProgram* program, - unsigned long pname, - int* value) -{ - makeContextCurrent(); - glGetProgramiv(EXTRACT(program), pname, value); -} +DELEGATE_TO_IMPL_5(uniform4i, long, int, int, int, int) -String GraphicsContext3D::getProgramInfoLog(WebGLProgram* program) +void GraphicsContext3DInternal::uniform4iv(long location, int* v, int size) { - makeContextCurrent(); - GLuint programID = EXTRACT(program); - GLint logLength; - glGetProgramiv(programID, GL_INFO_LOG_LENGTH, &logLength); - if (!logLength) - return String(); - GLchar* log = 0; - if (!tryFastMalloc(logLength * sizeof(GLchar)).getValue(log)) - return String(); - GLsizei returnedLogLength; - glGetProgramInfoLog(programID, logLength, &returnedLogLength, log); - ASSERT(logLength == returnedLogLength + 1); - String res = String(log, returnedLogLength); - fastFree(log); - return res; -} - -void GraphicsContext3D::getRenderbufferParameteriv(unsigned long target, - unsigned long pname, - int* value) -{ - makeContextCurrent(); - glGetRenderbufferParameterivEXT(target, pname, value); + m_impl->uniform4iv(location, size, v); } -void GraphicsContext3D::getShaderiv(WebGLShader* shader, - unsigned long pname, - int* value) +void GraphicsContext3DInternal::uniformMatrix2fv(long location, bool transpose, float* value, int size) { - makeContextCurrent(); - glGetShaderiv(EXTRACT(shader), pname, value); + m_impl->uniformMatrix2fv(location, size, transpose, value); } -String GraphicsContext3D::getShaderInfoLog(WebGLShader* shader) -{ - makeContextCurrent(); - GLuint shaderID = EXTRACT(shader); - GLint logLength; - glGetShaderiv(shaderID, GL_INFO_LOG_LENGTH, &logLength); - if (!logLength) - return String(); - GLchar* log = 0; - if (!tryFastMalloc(logLength * sizeof(GLchar)).getValue(log)) - return String(); - GLsizei returnedLogLength; - glGetShaderInfoLog(shaderID, logLength, &returnedLogLength, log); - ASSERT(logLength == returnedLogLength + 1); - String res = String(log, returnedLogLength); - fastFree(log); - return res; -} - -String GraphicsContext3D::getShaderSource(WebGLShader* shader) +void GraphicsContext3DInternal::uniformMatrix3fv(long location, bool transpose, float* value, int size) { - makeContextCurrent(); - GLuint shaderID = EXTRACT(shader); - GLint logLength; - glGetShaderiv(shaderID, GL_SHADER_SOURCE_LENGTH, &logLength); - if (!logLength) - return String(); - GLchar* log = 0; - if (!tryFastMalloc(logLength * sizeof(GLchar)).getValue(log)) - return String(); - GLsizei returnedLogLength; - glGetShaderSource(shaderID, logLength, &returnedLogLength, log); - ASSERT(logLength == returnedLogLength + 1); - String res = String(log, returnedLogLength); - fastFree(log); - return res; -} - -String GraphicsContext3D::getString(unsigned long name) -{ - makeContextCurrent(); - return String(reinterpret_cast<const char*>(glGetString(name))); + m_impl->uniformMatrix3fv(location, size, transpose, value); } -void GraphicsContext3D::getTexParameterfv(unsigned long target, unsigned long pname, float* value) +void GraphicsContext3DInternal::uniformMatrix4fv(long location, bool transpose, float* value, int size) { - makeContextCurrent(); - glGetTexParameterfv(target, pname, value); + m_impl->uniformMatrix4fv(location, size, transpose, value); } -void GraphicsContext3D::getTexParameteriv(unsigned long target, unsigned long pname, int* value) -{ - makeContextCurrent(); - glGetTexParameteriv(target, pname, value); -} +DELEGATE_TO_IMPL_1(useProgram, Platform3DObject) +DELEGATE_TO_IMPL_1(validateProgram, Platform3DObject) -void GraphicsContext3D::getUniformfv(WebGLProgram* program, long location, float* value) -{ - makeContextCurrent(); - glGetUniformfv(EXTRACT(program), location, value); -} +DELEGATE_TO_IMPL_2(vertexAttrib1f, unsigned long, float) +DELEGATE_TO_IMPL_2(vertexAttrib1fv, unsigned long, float*) +DELEGATE_TO_IMPL_3(vertexAttrib2f, unsigned long, float, float) +DELEGATE_TO_IMPL_2(vertexAttrib2fv, unsigned long, float*) +DELEGATE_TO_IMPL_4(vertexAttrib3f, unsigned long, float, float, float) +DELEGATE_TO_IMPL_2(vertexAttrib3fv, unsigned long, float*) +DELEGATE_TO_IMPL_5(vertexAttrib4f, unsigned long, float, float, float, float) +DELEGATE_TO_IMPL_2(vertexAttrib4fv, unsigned long, float*) +DELEGATE_TO_IMPL_6(vertexAttribPointer, unsigned long, int, int, bool, unsigned long, unsigned long) -void GraphicsContext3D::getUniformiv(WebGLProgram* program, long location, int* value) -{ - makeContextCurrent(); - glGetUniformiv(EXTRACT(program), location, value); -} +DELEGATE_TO_IMPL_4(viewport, long, long, unsigned long, unsigned long) -long GraphicsContext3D::getUniformLocation(WebGLProgram* program, const String& name) -{ - if (!program) - return -1; +DELEGATE_TO_IMPL_R(createBuffer, unsigned) +DELEGATE_TO_IMPL_R(createFramebuffer, unsigned) +DELEGATE_TO_IMPL_R(createProgram, unsigned) +DELEGATE_TO_IMPL_R(createRenderbuffer, unsigned) +DELEGATE_TO_IMPL_1R(createShader, unsigned long, unsigned) +DELEGATE_TO_IMPL_R(createTexture, unsigned) - makeContextCurrent(); - return glGetUniformLocation(EXTRACT(program), name.utf8().data()); -} +DELEGATE_TO_IMPL_1(deleteBuffer, unsigned) +DELEGATE_TO_IMPL_1(deleteFramebuffer, unsigned) +DELEGATE_TO_IMPL_1(deleteProgram, unsigned) +DELEGATE_TO_IMPL_1(deleteRenderbuffer, unsigned) +DELEGATE_TO_IMPL_1(deleteShader, unsigned) +DELEGATE_TO_IMPL_1(deleteTexture, unsigned) -void GraphicsContext3D::getVertexAttribfv(unsigned long index, - unsigned long pname, - float* value) -{ - makeContextCurrent(); - glGetVertexAttribfv(index, pname, value); -} +DELEGATE_TO_IMPL_1(synthesizeGLError, unsigned long) +DELEGATE_TO_IMPL_R(supportsBGRA, bool) -void GraphicsContext3D::getVertexAttribiv(unsigned long index, - unsigned long pname, - int* value) -{ - makeContextCurrent(); - glGetVertexAttribiv(index, pname, value); -} +//---------------------------------------------------------------------- +// GraphicsContext3D +// -long GraphicsContext3D::getVertexAttribOffset(unsigned long index, unsigned long pname) -{ - // FIXME: implement. - notImplemented(); - return 0; -} - -GL_SAME_METHOD_2(Hint, hint, unsigned long, unsigned long); +// Macros to assist in delegating from GraphicsContext3D to +// GraphicsContext3DInternal. -bool GraphicsContext3D::isBuffer(WebGLBuffer* buffer) -{ - makeContextCurrent(); - return glIsBuffer(EXTRACT(buffer)); +#define DELEGATE_TO_INTERNAL(name) \ +void GraphicsContext3D::name() \ +{ \ + m_internal->name(); \ } -bool GraphicsContext3D::isEnabled(unsigned long cap) -{ - makeContextCurrent(); - return glIsEnabled(cap); +#define DELEGATE_TO_INTERNAL_R(name, rt) \ +rt GraphicsContext3D::name() \ +{ \ + return m_internal->name(); \ } -bool GraphicsContext3D::isFramebuffer(WebGLFramebuffer* framebuffer) -{ - makeContextCurrent(); - return glIsFramebufferEXT(EXTRACT(framebuffer)); +#define DELEGATE_TO_INTERNAL_1(name, t1) \ +void GraphicsContext3D::name(t1 a1) \ +{ \ + m_internal->name(a1); \ } -bool GraphicsContext3D::isProgram(WebGLProgram* program) -{ - makeContextCurrent(); - return glIsProgram(EXTRACT(program)); +#define DELEGATE_TO_INTERNAL_1R(name, t1, rt) \ +rt GraphicsContext3D::name(t1 a1) \ +{ \ + return m_internal->name(a1); \ } -bool GraphicsContext3D::isRenderbuffer(WebGLRenderbuffer* renderbuffer) -{ - makeContextCurrent(); - return glIsRenderbufferEXT(EXTRACT(renderbuffer)); +#define DELEGATE_TO_INTERNAL_2(name, t1, t2) \ +void GraphicsContext3D::name(t1 a1, t2 a2) \ +{ \ + m_internal->name(a1, a2); \ } -bool GraphicsContext3D::isShader(WebGLShader* shader) -{ - makeContextCurrent(); - return glIsShader(EXTRACT(shader)); +#define DELEGATE_TO_INTERNAL_2R(name, t1, t2, rt) \ +rt GraphicsContext3D::name(t1 a1, t2 a2) \ +{ \ + return m_internal->name(a1, a2); \ } -bool GraphicsContext3D::isTexture(WebGLTexture* texture) -{ - makeContextCurrent(); - return glIsTexture(EXTRACT(texture)); +#define DELEGATE_TO_INTERNAL_3(name, t1, t2, t3) \ +void GraphicsContext3D::name(t1 a1, t2 a2, t3 a3) \ +{ \ + m_internal->name(a1, a2, a3); \ } -GL_SAME_METHOD_1(LineWidth, lineWidth, double) - -GL_SAME_METHOD_1_X(LinkProgram, linkProgram, WebGLProgram*) - -void GraphicsContext3D::pixelStorei(unsigned long pname, long param) -{ - if (pname != GL_PACK_ALIGNMENT && pname != GL_UNPACK_ALIGNMENT) { - // FIXME: Create a fake GL error and throw an exception. - return; - } - - makeContextCurrent(); - glPixelStorei(pname, param); +#define DELEGATE_TO_INTERNAL_3R(name, t1, t2, t3, rt) \ +rt GraphicsContext3D::name(t1 a1, t2 a2, t3 a3) \ +{ \ + return m_internal->name(a1, a2, a3); \ } -GL_SAME_METHOD_2(PolygonOffset, polygonOffset, double, double) - -PassRefPtr<WebGLArray> GraphicsContext3D::readPixels(long x, long y, - unsigned long width, unsigned long height, - unsigned long format, unsigned long type) { - // FIXME: support more pixel formats and types. - if (!((format == GL_RGBA) && (type == GL_UNSIGNED_BYTE))) - return 0; - - // FIXME: take into account pack alignment. - RefPtr<WebGLUnsignedByteArray> array = WebGLUnsignedByteArray::create(width * height * 4); - glReadPixels(x, y, width, height, format, type, array->baseAddress()); - return array; +#define DELEGATE_TO_INTERNAL_4(name, t1, t2, t3, t4) \ +void GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4) \ +{ \ + m_internal->name(a1, a2, a3, a4); \ } -void GraphicsContext3D::releaseShaderCompiler() -{ +#define DELEGATE_TO_INTERNAL_5(name, t1, t2, t3, t4, t5) \ +void GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5) \ +{ \ + m_internal->name(a1, a2, a3, a4, a5); \ } -GL_SAME_METHOD_4(RenderbufferStorageEXT, renderbufferStorage, unsigned long, unsigned long, unsigned long, unsigned long) - -GL_SAME_METHOD_2(SampleCoverage, sampleCoverage, double, bool) - -GL_SAME_METHOD_4(Scissor, scissor, long, long, unsigned long, unsigned long) - -void GraphicsContext3D::shaderSource(WebGLShader* shader, const String& source) -{ - makeContextCurrent(); - CString str = source.utf8(); - const char* data = str.data(); - GLint length = str.length(); - glShaderSource(EXTRACT(shader), 1, &data, &length); +#define DELEGATE_TO_INTERNAL_6(name, t1, t2, t3, t4, t5, t6) \ +void GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6) \ +{ \ + m_internal->name(a1, a2, a3, a4, a5, a6); \ } -GL_SAME_METHOD_3(StencilFunc, stencilFunc, unsigned long, long, unsigned long) - -GL_SAME_METHOD_4(StencilFuncSeparate, stencilFuncSeparate, unsigned long, unsigned long, long, unsigned long) - -GL_SAME_METHOD_1(StencilMask, stencilMask, unsigned long) - -GL_SAME_METHOD_2(StencilMaskSeparate, stencilMaskSeparate, unsigned long, unsigned long) - -GL_SAME_METHOD_3(StencilOp, stencilOp, unsigned long, unsigned long, unsigned long) - -GL_SAME_METHOD_4(StencilOpSeparate, stencilOpSeparate, unsigned long, unsigned long, unsigned long, unsigned long) - -void GraphicsContext3D::synthesizeGLError(unsigned long error) -{ - m_internal->synthesizeGLError(error); -} - -int GraphicsContext3D::texImage2D(unsigned target, - unsigned level, - unsigned internalformat, - unsigned width, - unsigned height, - unsigned border, - unsigned format, - unsigned type, - void* pixels) -{ - // FIXME: must do validation similar to JOGL's to ensure that - // the incoming array is of the appropriate length. - glTexImage2D(target, - level, - internalformat, - width, - height, - border, - format, - type, - pixels); - return 0; +#define DELEGATE_TO_INTERNAL_6R(name, t1, t2, t3, t4, t5, t6, rt) \ +rt GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6) \ +{ \ + return m_internal->name(a1, a2, a3, a4, a5, a6); \ } -// Remove premultiplied alpha from color channels. -// FIXME: this is lossy. Must retrieve original values from HTMLImageElement. -static void unmultiplyAlpha(unsigned char* rgbaData, int numPixels) -{ - for (int j = 0; j < numPixels; j++) { - float b = rgbaData[4*j+0] / 255.0f; - float g = rgbaData[4*j+1] / 255.0f; - float r = rgbaData[4*j+2] / 255.0f; - float a = rgbaData[4*j+3] / 255.0f; - if (a > 0.0f) { - b /= a; - g /= a; - r /= a; - b = (b > 1.0f) ? 1.0f : b; - g = (g > 1.0f) ? 1.0f : g; - r = (r > 1.0f) ? 1.0f : r; - rgbaData[4*j+0] = (unsigned char) (b * 255.0f); - rgbaData[4*j+1] = (unsigned char) (g * 255.0f); - rgbaData[4*j+2] = (unsigned char) (r * 255.0f); - } - } +#define DELEGATE_TO_INTERNAL_7(name, t1, t2, t3, t4, t5, t6, t7) \ +void GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6, t7 a7) \ +{ \ + m_internal->name(a1, a2, a3, a4, a5, a6, a7); \ } -// FIXME: this must be changed to refer to the original image data -// rather than unmultiplying the alpha channel. -static int texImage2DHelper(unsigned target, unsigned level, - int width, int height, - int rowBytes, - bool flipY, - bool premultiplyAlpha, - GLenum format, - bool skipAlpha, - unsigned char* pixels) -{ - ASSERT(format == GL_RGBA || format == GL_BGRA); - GLint internalFormat = GL_RGBA8; - if (skipAlpha) { - internalFormat = GL_RGB8; - // Ignore the alpha channel - premultiplyAlpha = true; - } - if (flipY) { - // Need to flip images vertically. To avoid making a copy of - // the entire image, we perform a ton of glTexSubImage2D - // calls. FIXME: should rethink this strategy for efficiency. - glTexImage2D(target, level, internalFormat, - width, - height, - 0, - format, - GL_UNSIGNED_BYTE, - 0); - unsigned char* row = 0; - bool allocatedRow = false; - if (!premultiplyAlpha) { - row = new unsigned char[rowBytes]; - allocatedRow = true; - } - for (int i = 0; i < height; i++) { - if (premultiplyAlpha) - row = pixels + (rowBytes * i); - else { - memcpy(row, pixels + (rowBytes * i), rowBytes); - unmultiplyAlpha(row, width); - } - glTexSubImage2D(target, level, 0, height - i - 1, - width, 1, - format, - GL_UNSIGNED_BYTE, - row); - } - if (allocatedRow) - delete[] row; - } else { - // The pixels of cube maps' faces are defined with a top-down - // scanline ordering, unlike GL_TEXTURE_2D, so when uploading - // these, the above vertical flip is the wrong thing to do. - if (premultiplyAlpha) - glTexImage2D(target, level, internalFormat, - width, - height, - 0, - format, - GL_UNSIGNED_BYTE, - pixels); - else { - glTexImage2D(target, level, internalFormat, - width, - height, - 0, - format, - GL_UNSIGNED_BYTE, - 0); - unsigned char* row = new unsigned char[rowBytes]; - for (int i = 0; i < height; i++) { - memcpy(row, pixels + (rowBytes * i), rowBytes); - unmultiplyAlpha(row, width); - glTexSubImage2D(target, level, 0, i, - width, 1, - format, - GL_UNSIGNED_BYTE, - row); - } - delete[] row; - } - } - return 0; +#define DELEGATE_TO_INTERNAL_7R(name, t1, t2, t3, t4, t5, t6, t7, rt) \ +rt GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6, t7 a7) \ +{ \ + return m_internal->name(a1, a2, a3, a4, a5, a6, a7); \ } -int GraphicsContext3D::texImage2D(unsigned target, unsigned level, Image* image, - bool flipY, bool premultiplyAlpha) -{ - ASSERT(image); - - int res = -1; -#if PLATFORM(SKIA) - NativeImageSkia* skiaImage = image->nativeImageForCurrentFrame(); - if (!skiaImage) { - ASSERT_NOT_REACHED(); - return -1; - } - SkBitmap::Config skiaConfig = skiaImage->config(); - // FIXME: must support more image configurations. - if (skiaConfig != SkBitmap::kARGB_8888_Config) { - ASSERT_NOT_REACHED(); - return -1; - } - SkBitmap& skiaImageRef = *skiaImage; - SkAutoLockPixels lock(skiaImageRef); - int width = skiaImage->width(); - int height = skiaImage->height(); - unsigned char* pixels = - reinterpret_cast<unsigned char*>(skiaImage->getPixels()); - int rowBytes = skiaImage->rowBytes(); - res = texImage2DHelper(target, level, - width, height, - rowBytes, - flipY, premultiplyAlpha, - GL_BGRA, - false, - pixels); -#elif PLATFORM(CG) - CGImageRef cgImage = image->nativeImageForCurrentFrame(); - if (!cgImage) { - ASSERT_NOT_REACHED(); - return -1; - } - int width = CGImageGetWidth(cgImage); - int height = CGImageGetHeight(cgImage); - int rowBytes = width * 4; - CGImageAlphaInfo info = CGImageGetAlphaInfo(cgImage); - bool skipAlpha = (info == kCGImageAlphaNone - || info == kCGImageAlphaNoneSkipLast - || info == kCGImageAlphaNoneSkipFirst); - unsigned char* imageData = new unsigned char[height * rowBytes]; - CGColorSpaceRef colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); - CGContextRef tmpContext = CGBitmapContextCreate(imageData, width, height, 8, rowBytes, - colorSpace, - kCGImageAlphaPremultipliedLast); - CGColorSpaceRelease(colorSpace); - CGContextSetBlendMode(tmpContext, kCGBlendModeCopy); - CGContextDrawImage(tmpContext, - CGRectMake(0, 0, static_cast<CGFloat>(width), static_cast<CGFloat>(height)), - cgImage); - CGContextRelease(tmpContext); - res = texImage2DHelper(target, level, width, height, rowBytes, - flipY, premultiplyAlpha, GL_RGBA, skipAlpha, imageData); - delete[] imageData; -#else -#error Must port to your platform -#endif - return res; +#define DELEGATE_TO_INTERNAL_8(name, t1, t2, t3, t4, t5, t6, t7, t8) \ +void GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6, t7 a7, t8 a8) \ +{ \ + m_internal->name(a1, a2, a3, a4, a5, a6, a7, a8); \ } -GL_SAME_METHOD_3(TexParameterf, texParameterf, unsigned, unsigned, float); - -GL_SAME_METHOD_3(TexParameteri, texParameteri, unsigned, unsigned, int); - -int GraphicsContext3D::texSubImage2D(unsigned target, - unsigned level, - unsigned xoffset, - unsigned yoffset, - unsigned width, - unsigned height, - unsigned format, - unsigned type, - void* pixels) -{ - glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); - return 0; +#define DELEGATE_TO_INTERNAL_9R(name, t1, t2, t3, t4, t5, t6, t7, t8, t9, rt) \ +rt GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6, t7 a7, t8 a8, t9 a9) \ +{ \ + return m_internal->name(a1, a2, a3, a4, a5, a6, a7, a8, a9); \ } -int GraphicsContext3D::texSubImage2D(unsigned target, - unsigned level, - unsigned xoffset, - unsigned yoffset, - Image* image, - bool flipY, - bool premultiplyAlpha) +GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes, HostWindow*) { - // FIXME: implement. - notImplemented(); - return -1; } -GL_SAME_METHOD_2(Uniform1f, uniform1f, long, float) - -void GraphicsContext3D::uniform1fv(long location, float* v, int size) +GraphicsContext3D::~GraphicsContext3D() { - makeContextCurrent(); - glUniform1fv(location, size, v); } -GL_SAME_METHOD_2(Uniform1i, uniform1i, long, int) - -void GraphicsContext3D::uniform1iv(long location, int* v, int size) +PassOwnPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow) { - makeContextCurrent(); - glUniform1iv(location, size, v); + GraphicsContext3DInternal* internal = new GraphicsContext3DInternal(); + if (!internal->initialize(attrs, hostWindow)) { + delete internal; + return 0; + } + PassOwnPtr<GraphicsContext3D> result = new GraphicsContext3D(attrs, hostWindow); + result->m_internal.set(internal); + return result; } -GL_SAME_METHOD_3(Uniform2f, uniform2f, long, float, float) - -void GraphicsContext3D::uniform2fv(long location, float* v, int size) +PlatformGraphicsContext3D GraphicsContext3D::platformGraphicsContext3D() const { - makeContextCurrent(); - glUniform2fv(location, size, v); + return m_internal->platformGraphicsContext3D(); } -GL_SAME_METHOD_3(Uniform2i, uniform2i, long, int, int) - -void GraphicsContext3D::uniform2iv(long location, int* v, int size) +Platform3DObject GraphicsContext3D::platformTexture() const { - makeContextCurrent(); - glUniform2iv(location, size, v); + return m_internal->platformTexture(); } -GL_SAME_METHOD_4(Uniform3f, uniform3f, long, float, float, float) - -void GraphicsContext3D::uniform3fv(long location, float* v, int size) +void GraphicsContext3D::prepareTexture() { - makeContextCurrent(); - glUniform3fv(location, size, v); + return m_internal->prepareTexture(); } -GL_SAME_METHOD_4(Uniform3i, uniform3i, long, int, int, int) - -void GraphicsContext3D::uniform3iv(long location, int* v, int size) +#if USE(ACCELERATED_COMPOSITING) +PlatformLayer* GraphicsContext3D::platformLayer() const { - makeContextCurrent(); - glUniform3iv(location, size, v); + CanvasLayerChromium* canvasLayer = m_internal->platformLayer(); + canvasLayer->setContext(this); + return canvasLayer; } +#endif -GL_SAME_METHOD_5(Uniform4f, uniform4f, long, float, float, float, float) - -void GraphicsContext3D::uniform4fv(long location, float* v, int size) -{ - makeContextCurrent(); - glUniform4fv(location, size, v); -} +DELEGATE_TO_INTERNAL(makeContextCurrent) +DELEGATE_TO_INTERNAL_1R(sizeInBytes, int, int) +DELEGATE_TO_INTERNAL_2(reshape, int, int) -GL_SAME_METHOD_5(Uniform4i, uniform4i, long, int, int, int, int) +DELEGATE_TO_INTERNAL_1(activeTexture, unsigned long) +DELEGATE_TO_INTERNAL_2(attachShader, Platform3DObject, Platform3DObject) +DELEGATE_TO_INTERNAL_3(bindAttribLocation, Platform3DObject, unsigned long, const String&) -void GraphicsContext3D::uniform4iv(long location, int* v, int size) -{ - makeContextCurrent(); - glUniform4iv(location, size, v); -} +DELEGATE_TO_INTERNAL_2(bindBuffer, unsigned long, Platform3DObject) +DELEGATE_TO_INTERNAL_2(bindFramebuffer, unsigned long, Platform3DObject) +DELEGATE_TO_INTERNAL_2(bindRenderbuffer, unsigned long, Platform3DObject) +DELEGATE_TO_INTERNAL_2(bindTexture, unsigned long, Platform3DObject) +DELEGATE_TO_INTERNAL_4(blendColor, double, double, double, double) +DELEGATE_TO_INTERNAL_1(blendEquation, unsigned long) +DELEGATE_TO_INTERNAL_2(blendEquationSeparate, unsigned long, unsigned long) +DELEGATE_TO_INTERNAL_2(blendFunc, unsigned long, unsigned long) +DELEGATE_TO_INTERNAL_4(blendFuncSeparate, unsigned long, unsigned long, unsigned long, unsigned long) -void GraphicsContext3D::uniformMatrix2fv(long location, bool transpose, float* value, int size) -{ - makeContextCurrent(); - glUniformMatrix2fv(location, size, transpose, value); -} +DELEGATE_TO_INTERNAL_3(bufferData, unsigned long, int, unsigned long) +DELEGATE_TO_INTERNAL_4(bufferData, unsigned long, int, const void*, unsigned long) +DELEGATE_TO_INTERNAL_4(bufferSubData, unsigned long, long, int, const void*) -void GraphicsContext3D::uniformMatrix3fv(long location, bool transpose, float* value, int size) -{ - makeContextCurrent(); - glUniformMatrix3fv(location, size, transpose, value); -} +DELEGATE_TO_INTERNAL_1R(checkFramebufferStatus, unsigned long, unsigned long) +DELEGATE_TO_INTERNAL_1(clear, unsigned long) +DELEGATE_TO_INTERNAL_4(clearColor, double, double, double, double) +DELEGATE_TO_INTERNAL_1(clearDepth, double) +DELEGATE_TO_INTERNAL_1(clearStencil, long) +DELEGATE_TO_INTERNAL_4(colorMask, bool, bool, bool, bool) +DELEGATE_TO_INTERNAL_1(compileShader, Platform3DObject) -void GraphicsContext3D::uniformMatrix4fv(long location, bool transpose, float* value, int size) -{ - makeContextCurrent(); - glUniformMatrix4fv(location, size, transpose, value); -} +DELEGATE_TO_INTERNAL_8(copyTexImage2D, unsigned long, long, unsigned long, long, long, unsigned long, unsigned long, long) +DELEGATE_TO_INTERNAL_8(copyTexSubImage2D, unsigned long, long, long, long, long, long, unsigned long, unsigned long) +DELEGATE_TO_INTERNAL_1(cullFace, unsigned long) +DELEGATE_TO_INTERNAL_1(depthFunc, unsigned long) +DELEGATE_TO_INTERNAL_1(depthMask, bool) +DELEGATE_TO_INTERNAL_2(depthRange, double, double) +DELEGATE_TO_INTERNAL_2(detachShader, Platform3DObject, Platform3DObject) +DELEGATE_TO_INTERNAL_1(disable, unsigned long) +DELEGATE_TO_INTERNAL_1(disableVertexAttribArray, unsigned long) +DELEGATE_TO_INTERNAL_3(drawArrays, unsigned long, long, long) +DELEGATE_TO_INTERNAL_4(drawElements, unsigned long, unsigned long, unsigned long, long) + +DELEGATE_TO_INTERNAL_1(enable, unsigned long) +DELEGATE_TO_INTERNAL_1(enableVertexAttribArray, unsigned long) +DELEGATE_TO_INTERNAL(finish) +DELEGATE_TO_INTERNAL(flush) +DELEGATE_TO_INTERNAL_4(framebufferRenderbuffer, unsigned long, unsigned long, unsigned long, Platform3DObject) +DELEGATE_TO_INTERNAL_5(framebufferTexture2D, unsigned long, unsigned long, unsigned long, Platform3DObject, long) +DELEGATE_TO_INTERNAL_1(frontFace, unsigned long) +DELEGATE_TO_INTERNAL_1(generateMipmap, unsigned long) + +DELEGATE_TO_INTERNAL_3R(getActiveAttrib, Platform3DObject, unsigned long, ActiveInfo&, bool) +DELEGATE_TO_INTERNAL_3R(getActiveUniform, Platform3DObject, unsigned long, ActiveInfo&, bool) + +DELEGATE_TO_INTERNAL_4(getAttachedShaders, Platform3DObject, int, int*, unsigned int*) + +DELEGATE_TO_INTERNAL_2R(getAttribLocation, Platform3DObject, const String&, int) + +DELEGATE_TO_INTERNAL_2(getBooleanv, unsigned long, unsigned char*) + +DELEGATE_TO_INTERNAL_3(getBufferParameteriv, unsigned long, unsigned long, int*) + +DELEGATE_TO_INTERNAL_R(getContextAttributes, GraphicsContext3D::Attributes) + +DELEGATE_TO_INTERNAL_R(getError, unsigned long) + +DELEGATE_TO_INTERNAL_2(getFloatv, unsigned long, float*) + +DELEGATE_TO_INTERNAL_4(getFramebufferAttachmentParameteriv, unsigned long, unsigned long, unsigned long, int*) + +DELEGATE_TO_INTERNAL_2(getIntegerv, unsigned long, int*) + +DELEGATE_TO_INTERNAL_3(getProgramiv, Platform3DObject, unsigned long, int*) + +DELEGATE_TO_INTERNAL_1R(getProgramInfoLog, Platform3DObject, String) + +DELEGATE_TO_INTERNAL_3(getRenderbufferParameteriv, unsigned long, unsigned long, int*) + +DELEGATE_TO_INTERNAL_3(getShaderiv, Platform3DObject, unsigned long, int*) + +DELEGATE_TO_INTERNAL_1R(getShaderInfoLog, Platform3DObject, String) + +DELEGATE_TO_INTERNAL_1R(getShaderSource, Platform3DObject, String) +DELEGATE_TO_INTERNAL_1R(getString, unsigned long, String) + +DELEGATE_TO_INTERNAL_3(getTexParameterfv, unsigned long, unsigned long, float*) +DELEGATE_TO_INTERNAL_3(getTexParameteriv, unsigned long, unsigned long, int*) + +DELEGATE_TO_INTERNAL_3(getUniformfv, Platform3DObject, long, float*) +DELEGATE_TO_INTERNAL_3(getUniformiv, Platform3DObject, long, int*) + +DELEGATE_TO_INTERNAL_2R(getUniformLocation, Platform3DObject, const String&, long) + +DELEGATE_TO_INTERNAL_3(getVertexAttribfv, unsigned long, unsigned long, float*) +DELEGATE_TO_INTERNAL_3(getVertexAttribiv, unsigned long, unsigned long, int*) + +DELEGATE_TO_INTERNAL_2R(getVertexAttribOffset, unsigned long, unsigned long, long) -GL_SAME_METHOD_1_X(UseProgram, useProgram, WebGLProgram*) +DELEGATE_TO_INTERNAL_2(hint, unsigned long, unsigned long) +DELEGATE_TO_INTERNAL_1R(isBuffer, Platform3DObject, bool) +DELEGATE_TO_INTERNAL_1R(isEnabled, unsigned long, bool) +DELEGATE_TO_INTERNAL_1R(isFramebuffer, Platform3DObject, bool) +DELEGATE_TO_INTERNAL_1R(isProgram, Platform3DObject, bool) +DELEGATE_TO_INTERNAL_1R(isRenderbuffer, Platform3DObject, bool) +DELEGATE_TO_INTERNAL_1R(isShader, Platform3DObject, bool) +DELEGATE_TO_INTERNAL_1R(isTexture, Platform3DObject, bool) +DELEGATE_TO_INTERNAL_1(lineWidth, double) +DELEGATE_TO_INTERNAL_1(linkProgram, Platform3DObject) +DELEGATE_TO_INTERNAL_2(pixelStorei, unsigned long, long) +DELEGATE_TO_INTERNAL_2(polygonOffset, double, double) -GL_SAME_METHOD_1_X(ValidateProgram, validateProgram, WebGLProgram*) +DELEGATE_TO_INTERNAL_7(readPixels, long, long, unsigned long, unsigned long, unsigned long, unsigned long, void*) -GL_SAME_METHOD_2(VertexAttrib1f, vertexAttrib1f, unsigned long, float) +DELEGATE_TO_INTERNAL(releaseShaderCompiler) +DELEGATE_TO_INTERNAL_4(renderbufferStorage, unsigned long, unsigned long, unsigned long, unsigned long) +DELEGATE_TO_INTERNAL_2(sampleCoverage, double, bool) +DELEGATE_TO_INTERNAL_4(scissor, long, long, unsigned long, unsigned long) +DELEGATE_TO_INTERNAL_2(shaderSource, Platform3DObject, const String&) +DELEGATE_TO_INTERNAL_3(stencilFunc, unsigned long, long, unsigned long) +DELEGATE_TO_INTERNAL_4(stencilFuncSeparate, unsigned long, unsigned long, long, unsigned long) +DELEGATE_TO_INTERNAL_1(stencilMask, unsigned long) +DELEGATE_TO_INTERNAL_2(stencilMaskSeparate, unsigned long, unsigned long) +DELEGATE_TO_INTERNAL_3(stencilOp, unsigned long, unsigned long, unsigned long) +DELEGATE_TO_INTERNAL_4(stencilOpSeparate, unsigned long, unsigned long, unsigned long, unsigned long) -void GraphicsContext3D::vertexAttrib1fv(unsigned long indx, float* values) -{ - makeContextCurrent(); - glVertexAttrib1fv(indx, values); -} +DELEGATE_TO_INTERNAL_9R(texImage2D, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned, void*, int) +DELEGATE_TO_INTERNAL_3(texParameterf, unsigned, unsigned, float) +DELEGATE_TO_INTERNAL_3(texParameteri, unsigned, unsigned, int) +DELEGATE_TO_INTERNAL_9R(texSubImage2D, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned, void*, int) -GL_SAME_METHOD_3(VertexAttrib2f, vertexAttrib2f, unsigned long, float, float) +DELEGATE_TO_INTERNAL_2(uniform1f, long, float) +DELEGATE_TO_INTERNAL_3(uniform1fv, long, float*, int) +DELEGATE_TO_INTERNAL_2(uniform1i, long, int) +DELEGATE_TO_INTERNAL_3(uniform1iv, long, int*, int) +DELEGATE_TO_INTERNAL_3(uniform2f, long, float, float) +DELEGATE_TO_INTERNAL_3(uniform2fv, long, float*, int) +DELEGATE_TO_INTERNAL_3(uniform2i, long, int, int) +DELEGATE_TO_INTERNAL_3(uniform2iv, long, int*, int) +DELEGATE_TO_INTERNAL_4(uniform3f, long, float, float, float) +DELEGATE_TO_INTERNAL_3(uniform3fv, long, float*, int) +DELEGATE_TO_INTERNAL_4(uniform3i, long, int, int, int) +DELEGATE_TO_INTERNAL_3(uniform3iv, long, int*, int) +DELEGATE_TO_INTERNAL_5(uniform4f, long, float, float, float, float) +DELEGATE_TO_INTERNAL_3(uniform4fv, long, float*, int) +DELEGATE_TO_INTERNAL_5(uniform4i, long, int, int, int, int) +DELEGATE_TO_INTERNAL_3(uniform4iv, long, int*, int) +DELEGATE_TO_INTERNAL_4(uniformMatrix2fv, long, bool, float*, int) +DELEGATE_TO_INTERNAL_4(uniformMatrix3fv, long, bool, float*, int) +DELEGATE_TO_INTERNAL_4(uniformMatrix4fv, long, bool, float*, int) -void GraphicsContext3D::vertexAttrib2fv(unsigned long indx, float* values) -{ - makeContextCurrent(); - glVertexAttrib2fv(indx, values); -} +DELEGATE_TO_INTERNAL_1(useProgram, Platform3DObject) +DELEGATE_TO_INTERNAL_1(validateProgram, Platform3DObject) -GL_SAME_METHOD_4(VertexAttrib3f, vertexAttrib3f, unsigned long, float, float, float) +DELEGATE_TO_INTERNAL_2(vertexAttrib1f, unsigned long, float) +DELEGATE_TO_INTERNAL_2(vertexAttrib1fv, unsigned long, float*) +DELEGATE_TO_INTERNAL_3(vertexAttrib2f, unsigned long, float, float) +DELEGATE_TO_INTERNAL_2(vertexAttrib2fv, unsigned long, float*) +DELEGATE_TO_INTERNAL_4(vertexAttrib3f, unsigned long, float, float, float) +DELEGATE_TO_INTERNAL_2(vertexAttrib3fv, unsigned long, float*) +DELEGATE_TO_INTERNAL_5(vertexAttrib4f, unsigned long, float, float, float, float) +DELEGATE_TO_INTERNAL_2(vertexAttrib4fv, unsigned long, float*) +DELEGATE_TO_INTERNAL_6(vertexAttribPointer, unsigned long, int, int, bool, unsigned long, unsigned long) -void GraphicsContext3D::vertexAttrib3fv(unsigned long indx, float* values) -{ - makeContextCurrent(); - glVertexAttrib3fv(indx, values); -} +DELEGATE_TO_INTERNAL_4(viewport, long, long, unsigned long, unsigned long) -GL_SAME_METHOD_5(VertexAttrib4f, vertexAttrib4f, unsigned long, float, float, float, float) +DELEGATE_TO_INTERNAL_1(paintRenderingResultsToCanvas, CanvasRenderingContext*) -void GraphicsContext3D::vertexAttrib4fv(unsigned long indx, float* values) +bool GraphicsContext3D::paintsIntoCanvasBuffer() const { - makeContextCurrent(); - glVertexAttrib4fv(indx, values); + return m_internal->paintsIntoCanvasBuffer(); } -void GraphicsContext3D::vertexAttribPointer(unsigned long indx, int size, int type, bool normalized, - unsigned long stride, unsigned long offset) -{ - m_internal->vertexAttribPointer(indx, size, type, normalized, stride, offset); -} +DELEGATE_TO_INTERNAL_R(createBuffer, unsigned) +DELEGATE_TO_INTERNAL_R(createFramebuffer, unsigned) +DELEGATE_TO_INTERNAL_R(createProgram, unsigned) +DELEGATE_TO_INTERNAL_R(createRenderbuffer, unsigned) +DELEGATE_TO_INTERNAL_1R(createShader, unsigned long, unsigned) +DELEGATE_TO_INTERNAL_R(createTexture, unsigned) -void GraphicsContext3D::viewport(long x, long y, unsigned long width, unsigned long height) +DELEGATE_TO_INTERNAL_1(deleteBuffer, unsigned) +DELEGATE_TO_INTERNAL_1(deleteFramebuffer, unsigned) +DELEGATE_TO_INTERNAL_1(deleteProgram, unsigned) +DELEGATE_TO_INTERNAL_1(deleteRenderbuffer, unsigned) +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 { - makeContextCurrent(); - m_internal->viewportImpl(x, y, width, height); -} - -} + return m_internal->isGLES2Compliant(); +} + +bool GraphicsContext3D::isGLES2NPOTStrict() const +{ + return m_internal->isGLES2NPOTStrict(); +} + +bool GraphicsContext3D::isErrorGeneratedOnOutOfBoundsAccesses() const +{ + return m_internal->isErrorGeneratedOnOutOfBoundsAccesses(); +} + +} // namespace WebCore #endif // ENABLE(3D_CANVAS) diff --git a/WebKit/chromium/src/IDBCallbacksProxy.cpp b/WebKit/chromium/src/IDBCallbacksProxy.cpp new file mode 100644 index 0000000..3eab622 --- /dev/null +++ b/WebKit/chromium/src/IDBCallbacksProxy.cpp @@ -0,0 +1,111 @@ +/* + * 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "IDBCallbacksProxy.h" + +#include "IDBDatabaseError.h" +#include "IDBDatabaseProxy.h" +#include "WebIDBCallbacks.h" +#include "WebIDBCursorImpl.h" +#include "WebIDBDatabaseImpl.h" +#include "WebIDBDatabaseError.h" +#include "WebIDBIndexImpl.h" +#include "WebIDBKey.h" +#include "WebIDBObjectStoreImpl.h" +#include "WebSerializedScriptValue.h" + +#if ENABLE(INDEXED_DATABASE) + +namespace WebCore { + +PassRefPtr<IDBCallbacksProxy> IDBCallbacksProxy::create(PassOwnPtr<WebKit::WebIDBCallbacks> callbacks) +{ + return adoptRef(new IDBCallbacksProxy(callbacks)); +} + +IDBCallbacksProxy::IDBCallbacksProxy(PassOwnPtr<WebKit::WebIDBCallbacks> callbacks) + : m_callbacks(callbacks) +{ +} + +IDBCallbacksProxy::~IDBCallbacksProxy() +{ +} + +void IDBCallbacksProxy::onError(PassRefPtr<IDBDatabaseError> idbDatabaseError) +{ + m_callbacks->onError(WebKit::WebIDBDatabaseError(idbDatabaseError)); + m_callbacks.clear(); +} + +void IDBCallbacksProxy::onSuccess() +{ + m_callbacks->onSuccess(); + m_callbacks.clear(); +} + +void IDBCallbacksProxy::onSuccess(PassRefPtr<IDBCursorBackendInterface> idbCursorBackend) +{ + m_callbacks->onSuccess(new WebKit::WebIDBCursorImpl(idbCursorBackend)); + m_callbacks.clear(); +} + +void IDBCallbacksProxy::onSuccess(PassRefPtr<IDBDatabaseBackendInterface> backend) +{ + m_callbacks->onSuccess(new WebKit::WebIDBDatabaseImpl(backend)); + m_callbacks.clear(); +} + +void IDBCallbacksProxy::onSuccess(PassRefPtr<IDBIndexBackendInterface> backend) +{ + m_callbacks->onSuccess(new WebKit::WebIDBIndexImpl(backend)); + m_callbacks.clear(); +} + +void IDBCallbacksProxy::onSuccess(PassRefPtr<IDBKey> idbKey) +{ + m_callbacks->onSuccess(WebKit::WebIDBKey(idbKey)); + m_callbacks.clear(); +} + +void IDBCallbacksProxy::onSuccess(PassRefPtr<IDBObjectStoreBackendInterface> backend) +{ + m_callbacks->onSuccess(new WebKit::WebIDBObjectStoreImpl(backend)); + m_callbacks.clear(); +} + +void IDBCallbacksProxy::onSuccess(PassRefPtr<SerializedScriptValue> serializedScriptValue) +{ + m_callbacks->onSuccess(WebKit::WebSerializedScriptValue(serializedScriptValue)); + m_callbacks.clear(); +} + +} // namespace WebCore + +#endif // ENABLE(INDEXED_DATABASE) diff --git a/WebKit/chromium/src/IDBCallbacksProxy.h b/WebKit/chromium/src/IDBCallbacksProxy.h new file mode 100644 index 0000000..506dbb0 --- /dev/null +++ b/WebKit/chromium/src/IDBCallbacksProxy.h @@ -0,0 +1,70 @@ +/* + * 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef IDBCallbacksProxy_h +#define IDBCallbacksProxy_h + +#include "IDBCallbacks.h" +#include <wtf/PassOwnPtr.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +#if ENABLE(INDEXED_DATABASE) + +namespace WebKit { +class WebIDBCallbacks; +} + +namespace WebCore { + +class IDBCallbacksProxy : public IDBCallbacks { +public: + static PassRefPtr<IDBCallbacksProxy> create(PassOwnPtr<WebKit::WebIDBCallbacks>); + virtual ~IDBCallbacksProxy(); + + virtual void onError(PassRefPtr<IDBDatabaseError>); + virtual void onSuccess(); // For "null". + virtual void onSuccess(PassRefPtr<IDBCursorBackendInterface>); + virtual void onSuccess(PassRefPtr<IDBDatabaseBackendInterface>); + virtual void onSuccess(PassRefPtr<IDBIndexBackendInterface>); + virtual void onSuccess(PassRefPtr<IDBKey>); + virtual void onSuccess(PassRefPtr<IDBObjectStoreBackendInterface>); + virtual void onSuccess(PassRefPtr<SerializedScriptValue>); + +private: + IDBCallbacksProxy(PassOwnPtr<WebKit::WebIDBCallbacks>); + + OwnPtr<WebKit::WebIDBCallbacks> m_callbacks; +}; + + +} // namespace WebCore + +#endif + +#endif // IDBCallbacksProxy_h diff --git a/WebKit/chromium/src/IDBCursorBackendProxy.cpp b/WebKit/chromium/src/IDBCursorBackendProxy.cpp new file mode 100644 index 0000000..fff00b7 --- /dev/null +++ b/WebKit/chromium/src/IDBCursorBackendProxy.cpp @@ -0,0 +1,86 @@ +/* + * 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 "IDBCursorBackendProxy.h" + +#if ENABLE(INDEXED_DATABASE) + +#include "IDBAny.h" +#include "IDBCallbacks.h" +#include "SerializedScriptValue.h" +#include "WebIDBCallbacksImpl.h" +#include "WebIDBKey.h" + +namespace WebCore { + +PassRefPtr<IDBCursorBackendInterface> IDBCursorBackendProxy::create(PassOwnPtr<WebKit::WebIDBCursor> idbCursor) +{ + return adoptRef(new IDBCursorBackendProxy(idbCursor)); +} + +IDBCursorBackendProxy::IDBCursorBackendProxy(PassOwnPtr<WebKit::WebIDBCursor> idbCursor) + : m_idbCursor(idbCursor) +{ +} + +IDBCursorBackendProxy::~IDBCursorBackendProxy() +{ +} + +unsigned short IDBCursorBackendProxy::direction() const +{ + return m_idbCursor->direction(); +} + +PassRefPtr<IDBKey> IDBCursorBackendProxy::key() const +{ + return m_idbCursor->key(); +} + +PassRefPtr<IDBAny> IDBCursorBackendProxy::value() const +{ + RefPtr<SerializedScriptValue> value = PassRefPtr<SerializedScriptValue>(m_idbCursor->value()); + return IDBAny::create(value.get()); +} + +void IDBCursorBackendProxy::update(PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBCallbacks> callbacks) +{ + m_idbCursor->update(value, new WebIDBCallbacksImpl(callbacks)); +} + +void IDBCursorBackendProxy::continueFunction(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks) +{ + m_idbCursor->continueFunction(key, new WebIDBCallbacksImpl(callbacks)); +} + +void IDBCursorBackendProxy::remove(PassRefPtr<IDBCallbacks> callbacks) +{ + m_idbCursor->remove(new WebIDBCallbacksImpl(callbacks)); +} + +} // namespace WebCore + +#endif // ENABLE(INDEXED_DATABASE) diff --git a/WebKit/chromium/src/IDBCursorBackendProxy.h b/WebKit/chromium/src/IDBCursorBackendProxy.h new file mode 100644 index 0000000..d8b621a --- /dev/null +++ b/WebKit/chromium/src/IDBCursorBackendProxy.h @@ -0,0 +1,62 @@ +/* + * 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 IDBCursorBackendProxy_h +#define IDBCursorBackendProxy_h + +#if ENABLE(INDEXED_DATABASE) + +#include "IDBCursorBackendInterface.h" +#include "WebIDBCursor.h" +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebCore { + +class IDBCursorBackendProxy : public IDBCursorBackendInterface { +public: + static PassRefPtr<IDBCursorBackendInterface> create(PassOwnPtr<WebKit::WebIDBCursor>); + virtual ~IDBCursorBackendProxy(); + + virtual unsigned short direction() const; + virtual PassRefPtr<IDBKey> key() const; + virtual PassRefPtr<IDBAny> value() const; + virtual void update(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBCallbacks>); + virtual void continueFunction(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>); + virtual void remove(PassRefPtr<IDBCallbacks>); + +private: + IDBCursorBackendProxy(PassOwnPtr<WebKit::WebIDBCursor>); + + OwnPtr<WebKit::WebIDBCursor> m_idbCursor; +}; + +} // namespace WebCore + +#endif + +#endif // IDBCursorBackendProxy_h diff --git a/WebKit/chromium/src/IDBDatabaseProxy.cpp b/WebKit/chromium/src/IDBDatabaseProxy.cpp new file mode 100644 index 0000000..9aa2977 --- /dev/null +++ b/WebKit/chromium/src/IDBDatabaseProxy.cpp @@ -0,0 +1,106 @@ +/* + * 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 "IDBDatabaseProxy.h" + +#include "DOMStringList.h" +#include "IDBCallbacks.h" +#include "IDBObjectStoreProxy.h" +#include "IDBTransactionBackendProxy.h" +#include "WebDOMStringList.h" +#include "WebFrameImpl.h" +#include "WebIDBCallbacksImpl.h" +#include "WebIDBDatabase.h" +#include "WebIDBDatabaseError.h" +#include "WebIDBObjectStore.h" +#include "WebIDBTransaction.h" + +#if ENABLE(INDEXED_DATABASE) + +namespace WebCore { + +PassRefPtr<IDBDatabaseBackendInterface> IDBDatabaseProxy::create(PassOwnPtr<WebKit::WebIDBDatabase> database) +{ + return adoptRef(new IDBDatabaseProxy(database)); +} + +IDBDatabaseProxy::IDBDatabaseProxy(PassOwnPtr<WebKit::WebIDBDatabase> database) + : m_webIDBDatabase(database) +{ +} + +IDBDatabaseProxy::~IDBDatabaseProxy() +{ +} + +String IDBDatabaseProxy::name() const +{ + return m_webIDBDatabase->name(); +} + +String IDBDatabaseProxy::description() const +{ + return m_webIDBDatabase->description(); +} + +String IDBDatabaseProxy::version() const +{ + return m_webIDBDatabase->version(); +} + +PassRefPtr<DOMStringList> IDBDatabaseProxy::objectStores() const +{ + return m_webIDBDatabase->objectStores(); +} + +void IDBDatabaseProxy::createObjectStore(const String& name, const String& keyPath, bool autoIncrement, PassRefPtr<IDBCallbacks> callbacks) +{ + m_webIDBDatabase->createObjectStore(name, keyPath, autoIncrement, new WebIDBCallbacksImpl(callbacks)); +} + +PassRefPtr<IDBObjectStoreBackendInterface> IDBDatabaseProxy::objectStore(const String& name, unsigned short mode) +{ + WebKit::WebIDBObjectStore* objectStore = m_webIDBDatabase->objectStore(name, mode); + if (!objectStore) + return 0; + return IDBObjectStoreProxy::create(objectStore); +} + +void IDBDatabaseProxy::removeObjectStore(const String& name, PassRefPtr<IDBCallbacks> callbacks) +{ + m_webIDBDatabase->removeObjectStore(name, new WebIDBCallbacksImpl(callbacks)); +} + +PassRefPtr<IDBTransactionBackendInterface> IDBDatabaseProxy::transaction(DOMStringList* storeNames, unsigned short mode, unsigned long timeout) +{ + WebKit::WebDOMStringList names(storeNames); + WebKit::WebIDBTransaction* transaction = m_webIDBDatabase->transaction(names, mode, timeout); + return IDBTransactionBackendProxy::create(transaction); +} + +} // namespace WebCore + +#endif // ENABLE(INDEXED_DATABASE) diff --git a/WebKit/chromium/src/IDBDatabaseProxy.h b/WebKit/chromium/src/IDBDatabaseProxy.h new file mode 100644 index 0000000..ed2016a --- /dev/null +++ b/WebKit/chromium/src/IDBDatabaseProxy.h @@ -0,0 +1,67 @@ +/* + * 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 IDBDatabaseProxy_h +#define IDBDatabaseProxy_h + +#include "IDBDatabaseBackendInterface.h" +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/PassRefPtr.h> + +#if ENABLE(INDEXED_DATABASE) + +namespace WebKit { class WebIDBDatabase; } + +namespace WebCore { + +class IDBDatabaseProxy : public IDBDatabaseBackendInterface { +public: + static PassRefPtr<IDBDatabaseBackendInterface> create(PassOwnPtr<WebKit::WebIDBDatabase>); + virtual ~IDBDatabaseProxy(); + + virtual String name() const; + virtual String description() const; + virtual String version() const; + virtual PassRefPtr<DOMStringList> objectStores() const; + + // FIXME: Add transaction and setVersion. + + virtual void createObjectStore(const String& name, const String& keyPath, bool autoIncrement, PassRefPtr<IDBCallbacks>); + virtual PassRefPtr<IDBObjectStoreBackendInterface> objectStore(const String& name, unsigned short mode); + virtual void removeObjectStore(const String& name, PassRefPtr<IDBCallbacks>); + virtual PassRefPtr<IDBTransactionBackendInterface> transaction(DOMStringList* storeNames, unsigned short mode, unsigned long timeout); + +private: + IDBDatabaseProxy(PassOwnPtr<WebKit::WebIDBDatabase>); + + OwnPtr<WebKit::WebIDBDatabase> m_webIDBDatabase; +}; + +} // namespace WebCore + +#endif + +#endif // IDBDatabaseProxy_h diff --git a/WebKit/chromium/src/IDBFactoryBackendProxy.cpp b/WebKit/chromium/src/IDBFactoryBackendProxy.cpp new file mode 100755 index 0000000..114e7e1 --- /dev/null +++ b/WebKit/chromium/src/IDBFactoryBackendProxy.cpp @@ -0,0 +1,79 @@ +/* + * 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "IDBFactoryBackendProxy.h" + +#include "DOMStringList.h" +#include "IDBDatabaseError.h" +#include "IDBDatabaseProxy.h" +#include "WebFrameImpl.h" +#include "WebIDBCallbacksImpl.h" +#include "WebIDBDatabase.h" +#include "WebIDBDatabaseError.h" +#include "WebIDBFactory.h" +#include "WebKit.h" +#include "WebKitClient.h" +#include "WebVector.h" + +#if ENABLE(INDEXED_DATABASE) + +namespace WebCore { + +PassRefPtr<IDBFactoryBackendInterface> IDBFactoryBackendProxy::create() +{ + return adoptRef(new IDBFactoryBackendProxy()); +} + +IDBFactoryBackendProxy::IDBFactoryBackendProxy() + : m_webIDBFactory(WebKit::webKitClient()->idbFactory()) +{ +} + +IDBFactoryBackendProxy::~IDBFactoryBackendProxy() +{ +} + +void IDBFactoryBackendProxy::open(const String& name, const String& description, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin> origin, Frame* frame) +{ + WebKit::WebFrame* webFrame = WebKit::WebFrameImpl::fromFrame(frame); + m_webIDBFactory->open(name, description, new WebIDBCallbacksImpl(callbacks), origin, webFrame); +} + +void IDBFactoryBackendProxy::abortPendingTransactions(const Vector<int>& pendingIDs) +{ + ASSERT(pendingIDs.size()); + WebKit::WebVector<int> ids = pendingIDs; + + m_webIDBFactory->abortPendingTransactions(ids); +} + +} // namespace WebCore + +#endif // ENABLE(INDEXED_DATABASE) + diff --git a/WebKit/chromium/src/IDBFactoryBackendProxy.h b/WebKit/chromium/src/IDBFactoryBackendProxy.h new file mode 100755 index 0000000..9efc7af --- /dev/null +++ b/WebKit/chromium/src/IDBFactoryBackendProxy.h @@ -0,0 +1,63 @@ +/* + * 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef IDBFactoryBackendProxy_h +#define IDBFactoryBackendProxy_h + +#include "IDBFactoryBackendInterface.h" + +#if ENABLE(INDEXED_DATABASE) + +namespace WebKit { class WebIDBFactory; } + +namespace WebCore { + +class DOMStringList; + +class IDBFactoryBackendProxy : public IDBFactoryBackendInterface { +public: + static PassRefPtr<IDBFactoryBackendInterface> create(); + virtual ~IDBFactoryBackendProxy(); + + PassRefPtr<DOMStringList> databases(void) const; + virtual void open(const String& name, const String& description, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*); + virtual void abortPendingTransactions(const Vector<int>& pendingIDs); + +private: + IDBFactoryBackendProxy(); + + // We don't own this pointer (unlike all the other proxy classes which do). + WebKit::WebIDBFactory* m_webIDBFactory; +}; + +} // namespace WebCore + +#endif + +#endif // IDBFactoryBackendProxy_h + diff --git a/WebKit/chromium/src/IDBIndexBackendProxy.cpp b/WebKit/chromium/src/IDBIndexBackendProxy.cpp new file mode 100644 index 0000000..5f1b9d9 --- /dev/null +++ b/WebKit/chromium/src/IDBIndexBackendProxy.cpp @@ -0,0 +1,67 @@ +/* + * 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 "IDBIndexBackendProxy.h" + +#include "WebIDBDatabaseError.h" +#include "WebIDBIndex.h" + +#if ENABLE(INDEXED_DATABASE) + +namespace WebCore { + +PassRefPtr<IDBIndexBackendInterface> IDBIndexBackendProxy::create(PassOwnPtr<WebKit::WebIDBIndex> index) +{ + return adoptRef(new IDBIndexBackendProxy(index)); +} + +IDBIndexBackendProxy::IDBIndexBackendProxy(PassOwnPtr<WebKit::WebIDBIndex> index) + : m_webIDBIndex(index) +{ +} + +IDBIndexBackendProxy::~IDBIndexBackendProxy() +{ +} + +String IDBIndexBackendProxy::name() +{ + return m_webIDBIndex->name(); +} + +String IDBIndexBackendProxy::keyPath() +{ + return m_webIDBIndex->keyPath(); +} + +bool IDBIndexBackendProxy::unique() +{ + return m_webIDBIndex->unique(); +} + +} // namespace WebCore + +#endif // ENABLE(INDEXED_DATABASE) diff --git a/WebKit/chromium/src/IDBIndexBackendProxy.h b/WebKit/chromium/src/IDBIndexBackendProxy.h new file mode 100644 index 0000000..1b378dd --- /dev/null +++ b/WebKit/chromium/src/IDBIndexBackendProxy.h @@ -0,0 +1,60 @@ +/* + * 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 IDBIndexBackendProxy_h +#define IDBIndexBackendProxy_h + +#include "IDBIndexBackendInterface.h" +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> + +#if ENABLE(INDEXED_DATABASE) + +namespace WebKit { class WebIDBIndex; } + +namespace WebCore { + +class IDBIndexBackendProxy : public IDBIndexBackendInterface { +public: + static PassRefPtr<IDBIndexBackendInterface> create(PassOwnPtr<WebKit::WebIDBIndex>); + virtual ~IDBIndexBackendProxy(); + + virtual String name(); + virtual String keyPath(); + virtual bool unique(); + + // FIXME: Add other methods. + +private: + IDBIndexBackendProxy(PassOwnPtr<WebKit::WebIDBIndex>); + + OwnPtr<WebKit::WebIDBIndex> m_webIDBIndex; +}; + +} // namespace WebCore + +#endif + +#endif // IDBIndexBackendProxy_h diff --git a/WebKit/chromium/src/IDBObjectStoreProxy.cpp b/WebKit/chromium/src/IDBObjectStoreProxy.cpp new file mode 100755 index 0000000..ad27fa3 --- /dev/null +++ b/WebKit/chromium/src/IDBObjectStoreProxy.cpp @@ -0,0 +1,113 @@ +/* + * 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 "IDBObjectStoreProxy.h" + +#include "DOMStringList.h" +#include "IDBCallbacks.h" +#include "IDBIndexBackendProxy.h" +#include "IDBKeyRange.h" +#include "WebIDBCallbacksImpl.h" +#include "WebIDBKeyRange.h" +#include "WebIDBIndex.h" +#include "WebIDBKey.h" +#include "WebIDBObjectStore.h" +#include "WebSerializedScriptValue.h" + +#if ENABLE(INDEXED_DATABASE) + +namespace WebCore { + +PassRefPtr<IDBObjectStoreBackendInterface> IDBObjectStoreProxy::create(PassOwnPtr<WebKit::WebIDBObjectStore> objectStore) +{ + return adoptRef(new IDBObjectStoreProxy(objectStore)); +} + +IDBObjectStoreProxy::IDBObjectStoreProxy(PassOwnPtr<WebKit::WebIDBObjectStore> objectStore) + : m_webIDBObjectStore(objectStore) +{ +} + +IDBObjectStoreProxy::~IDBObjectStoreProxy() +{ +} + +String IDBObjectStoreProxy::name() const +{ + return m_webIDBObjectStore->name(); +} + +String IDBObjectStoreProxy::keyPath() const +{ + return m_webIDBObjectStore->keyPath(); +} + +PassRefPtr<DOMStringList> IDBObjectStoreProxy::indexNames() const +{ + return m_webIDBObjectStore->indexNames(); +} + +void IDBObjectStoreProxy::get(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks) +{ + m_webIDBObjectStore->get(key, new WebIDBCallbacksImpl(callbacks)); +} + +void IDBObjectStoreProxy::put(PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key, bool addOnly, PassRefPtr<IDBCallbacks> callbacks) +{ + m_webIDBObjectStore->put(value, key, addOnly, new WebIDBCallbacksImpl(callbacks)); +} + +void IDBObjectStoreProxy::remove(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks) +{ + m_webIDBObjectStore->remove(key, new WebIDBCallbacksImpl(callbacks)); +} + +void IDBObjectStoreProxy::createIndex(const String& name, const String& keyPath, bool unique, PassRefPtr<IDBCallbacks> callbacks) +{ + m_webIDBObjectStore->createIndex(name, keyPath, unique, new WebIDBCallbacksImpl(callbacks)); +} + +PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreProxy::index(const String& name) +{ + WebKit::WebIDBIndex* index = m_webIDBObjectStore->index(name); + if (!index) + return 0; + return IDBIndexBackendProxy::create(index); +} + +void IDBObjectStoreProxy::removeIndex(const String& name, PassRefPtr<IDBCallbacks> callbacks) +{ + m_webIDBObjectStore->removeIndex(name, new WebIDBCallbacksImpl(callbacks)); +} + +void IDBObjectStoreProxy::openCursor(PassRefPtr<IDBKeyRange> range, unsigned short direction, PassRefPtr<IDBCallbacks> callbacks) +{ + m_webIDBObjectStore->openCursor(range, direction, new WebIDBCallbacksImpl(callbacks)); +} + +} // namespace WebCore + +#endif // ENABLE(INDEXED_DATABASE) diff --git a/WebKit/chromium/src/IDBObjectStoreProxy.h b/WebKit/chromium/src/IDBObjectStoreProxy.h new file mode 100755 index 0000000..a334572 --- /dev/null +++ b/WebKit/chromium/src/IDBObjectStoreProxy.h @@ -0,0 +1,70 @@ +/* + * 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 IDBObjectStoreProxy_h +#define IDBObjectStoreProxy_h + +#include "IDBObjectStoreBackendInterface.h" +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/PassRefPtr.h> + +#if ENABLE(INDEXED_DATABASE) + +namespace WebKit { class WebIDBObjectStore; } + +namespace WebCore { + +class IDBObjectStoreProxy : public IDBObjectStoreBackendInterface { +public: + static PassRefPtr<IDBObjectStoreBackendInterface> create(PassOwnPtr<WebKit::WebIDBObjectStore>); + ~IDBObjectStoreProxy(); + + String name() const; + String keyPath() const; + PassRefPtr<DOMStringList> indexNames() const; + + void get(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks>); + void put(PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key, bool addOnly, PassRefPtr<IDBCallbacks>); + void remove(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks>); + + void createIndex(const String& name, const String& keyPath, bool unique, PassRefPtr<IDBCallbacks>); + PassRefPtr<IDBIndexBackendInterface> index(const String& name); + void removeIndex(const String& name, PassRefPtr<IDBCallbacks>); + + virtual void openCursor(PassRefPtr<IDBKeyRange> range, unsigned short direction, PassRefPtr<IDBCallbacks>); + +private: + IDBObjectStoreProxy(PassOwnPtr<WebKit::WebIDBObjectStore>); + + OwnPtr<WebKit::WebIDBObjectStore> m_webIDBObjectStore; +}; + +} // namespace WebCore + +#endif + +#endif // IDBObjectStoreProxy_h + diff --git a/WebKit/chromium/src/IDBTransactionBackendProxy.cpp b/WebKit/chromium/src/IDBTransactionBackendProxy.cpp new file mode 100644 index 0000000..be6b058 --- /dev/null +++ b/WebKit/chromium/src/IDBTransactionBackendProxy.cpp @@ -0,0 +1,91 @@ +/* + * 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 "IDBTransactionBackendProxy.h" + +#if ENABLE(INDEXED_DATABASE) + +#include "IDBObjectStoreProxy.h" +#include "IDBTransactionCallbacks.h" +#include "WebIDBDatabaseError.h" +#include "WebIDBObjectStore.h" +#include "WebIDBTransaction.h" +#include "WebIDBTransactionCallbacksImpl.h" + +namespace WebCore { + +PassRefPtr<IDBTransactionBackendInterface> IDBTransactionBackendProxy::create(PassOwnPtr<WebKit::WebIDBTransaction> transaction) +{ + return adoptRef(new IDBTransactionBackendProxy(transaction)); +} + +IDBTransactionBackendProxy::IDBTransactionBackendProxy(PassOwnPtr<WebKit::WebIDBTransaction> transaction) + : m_webIDBTransaction(transaction) +{ +} + +IDBTransactionBackendProxy::~IDBTransactionBackendProxy() +{ +} + +PassRefPtr<IDBObjectStoreBackendInterface> IDBTransactionBackendProxy::objectStore(const String& name) +{ + WebKit::WebIDBObjectStore* objectStore = m_webIDBTransaction->objectStore(name); + if (!objectStore) + return 0; + return IDBObjectStoreProxy::create(objectStore); +} + +unsigned short IDBTransactionBackendProxy::mode() const +{ + return m_webIDBTransaction->mode(); +} + +void IDBTransactionBackendProxy::abort() +{ + m_webIDBTransaction->abort(); +} + +void IDBTransactionBackendProxy::scheduleTask(PassOwnPtr<ScriptExecutionContext::Task>) +{ + // This should never be reached as it's the impl objects who get to + // execute tasks in the browser process. + ASSERT_NOT_REACHED(); +} + +int IDBTransactionBackendProxy::id() const +{ + return m_webIDBTransaction->id(); +} + +void IDBTransactionBackendProxy::setCallbacks(IDBTransactionCallbacks* callbacks) +{ + m_webIDBTransaction->setCallbacks(new WebIDBTransactionCallbacksImpl(callbacks)); +} + +} // namespace WebCore + +#endif // ENABLE(INDEXED_DATABASE) diff --git a/WebKit/chromium/src/IDBTransactionBackendProxy.h b/WebKit/chromium/src/IDBTransactionBackendProxy.h new file mode 100644 index 0000000..d62b8ff --- /dev/null +++ b/WebKit/chromium/src/IDBTransactionBackendProxy.h @@ -0,0 +1,62 @@ +/* + * 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 IDBTransactionBackendProxy_h +#define IDBTransactionBackendProxy_h + +#include "IDBTransactionBackendInterface.h" + +#if ENABLE(INDEXED_DATABASE) + +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> + +namespace WebKit { class WebIDBTransaction; } + +namespace WebCore { + +class IDBTransactionBackendProxy : public IDBTransactionBackendInterface { +public: + static PassRefPtr<IDBTransactionBackendInterface> create(PassOwnPtr<WebKit::WebIDBTransaction>); + virtual ~IDBTransactionBackendProxy(); + + virtual PassRefPtr<IDBObjectStoreBackendInterface> objectStore(const String& name); + virtual unsigned short mode() const; + virtual void abort(); + virtual void scheduleTask(PassOwnPtr<ScriptExecutionContext::Task>); + virtual int id() const; + virtual void setCallbacks(IDBTransactionCallbacks*); + +private: + IDBTransactionBackendProxy(PassOwnPtr<WebKit::WebIDBTransaction>); + + OwnPtr<WebKit::WebIDBTransaction> m_webIDBTransaction; +}; + +} // namespace WebCore + +#endif + +#endif // IDBTransactionBackendProxy_h diff --git a/WebKit/chromium/src/IDBTransactionCallbacksProxy.cpp b/WebKit/chromium/src/IDBTransactionCallbacksProxy.cpp new file mode 100644 index 0000000..be7d44f --- /dev/null +++ b/WebKit/chromium/src/IDBTransactionCallbacksProxy.cpp @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "IDBTransactionCallbacksProxy.h" + +#include "WebIDBTransactionCallbacks.h" + +#if ENABLE(INDEXED_DATABASE) + +namespace WebCore { + +PassRefPtr<IDBTransactionCallbacksProxy> IDBTransactionCallbacksProxy::create(PassOwnPtr<WebKit::WebIDBTransactionCallbacks> callbacks) +{ + return adoptRef(new IDBTransactionCallbacksProxy(callbacks)); +} + +IDBTransactionCallbacksProxy::IDBTransactionCallbacksProxy(PassOwnPtr<WebKit::WebIDBTransactionCallbacks> callbacks) + : m_callbacks(callbacks) +{ +} + +IDBTransactionCallbacksProxy::~IDBTransactionCallbacksProxy() +{ +} + +void IDBTransactionCallbacksProxy::onAbort() +{ + m_callbacks->onAbort(); + m_callbacks.clear(); +} + +int IDBTransactionCallbacksProxy::id() const +{ + return m_callbacks->id(); +} + +} // namespace WebCore + +#endif // ENABLE(INDEXED_DATABASE) diff --git a/WebKit/chromium/src/IDBTransactionCallbacksProxy.h b/WebKit/chromium/src/IDBTransactionCallbacksProxy.h new file mode 100644 index 0000000..821eff4 --- /dev/null +++ b/WebKit/chromium/src/IDBTransactionCallbacksProxy.h @@ -0,0 +1,63 @@ +/* + * 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef IDBTransactionCallbacksProxy_h +#define IDBTransactionCallbacksProxy_h + +#include "IDBTransactionCallbacks.h" + +#if ENABLE(INDEXED_DATABASE) + +#include <wtf/PassOwnPtr.h> +#include <wtf/PassRefPtr.h> + +namespace WebKit { class WebIDBTransactionCallbacks; } + +namespace WebCore { + +class IDBTransactionCallbacksProxy : public IDBTransactionCallbacks { +public: + static PassRefPtr<IDBTransactionCallbacksProxy> create(PassOwnPtr<WebKit::WebIDBTransactionCallbacks>); + virtual ~IDBTransactionCallbacksProxy(); + + virtual void onAbort(); + virtual int id() const; + // FIXME: implement onComplete(). + +private: + IDBTransactionCallbacksProxy(PassOwnPtr<WebKit::WebIDBTransactionCallbacks>); + + OwnPtr<WebKit::WebIDBTransactionCallbacks> m_callbacks; +}; + + +} // namespace WebCore + +#endif + +#endif // IDBTransactionCallbacksProxy_h diff --git a/WebKit/chromium/src/InspectorClientImpl.cpp b/WebKit/chromium/src/InspectorClientImpl.cpp index 54550d1..76acbb2 100644 --- a/WebKit/chromium/src/InspectorClientImpl.cpp +++ b/WebKit/chromium/src/InspectorClientImpl.cpp @@ -33,10 +33,9 @@ #include "DOMWindow.h" #include "FloatRect.h" -#include "InspectorController.h" #include "NotImplemented.h" #include "Page.h" -#include "Settings.h" +#include "WebDevToolsAgentImpl.h" #include "WebRect.h" #include "WebURL.h" #include "WebURLRequest.h" @@ -60,159 +59,74 @@ InspectorClientImpl::~InspectorClientImpl() void InspectorClientImpl::inspectorDestroyed() { - // Our lifetime is bound to the WebViewImpl. + if (WebDevToolsAgentImpl* agent = devToolsAgent()) + agent->inspectorDestroyed(); } -Page* InspectorClientImpl::createPage() +void InspectorClientImpl::openInspectorFrontend(InspectorController* controller) { - // This method should never be called in Chrome as inspector front-end lives - // in a separate process. - ASSERT_NOT_REACHED(); - return 0; -} - -void InspectorClientImpl::showWindow() -{ - ASSERT(m_inspectedWebView->devToolsAgentPrivate()); - m_inspectedWebView->page()->inspectorController()->setWindowVisible(true); -} - -void InspectorClientImpl::closeWindow() -{ - if (m_inspectedWebView->page()) - m_inspectedWebView->page()->inspectorController()->setWindowVisible(false); -} - -bool InspectorClientImpl::windowVisible() -{ - ASSERT(m_inspectedWebView->devToolsAgentPrivate()); - return false; -} - -void InspectorClientImpl::attachWindow() -{ - // FIXME: Implement this -} - -void InspectorClientImpl::detachWindow() -{ - // FIXME: Implement this -} - -void InspectorClientImpl::setAttachedWindowHeight(unsigned int height) -{ - // FIXME: Implement this - notImplemented(); -} - -static void invalidateNodeBoundingRect(WebViewImpl* webView) -{ - // FIXME: Is it important to just invalidate the rect of the node region - // given that this is not on a critical codepath? In order to do so, we'd - // have to take scrolling into account. - const WebSize& size = webView->size(); - WebRect damagedRect(0, 0, size.width, size.height); - if (webView->client()) - webView->client()->didInvalidateRect(damagedRect); + if (WebDevToolsAgentImpl* agent = devToolsAgent()) + agent->openInspectorFrontend(controller); } void InspectorClientImpl::highlight(Node* node) { - // InspectorController does the actually tracking of the highlighted node - // and the drawing of the highlight. Here we just make sure to invalidate - // the rects of the old and new nodes. - hideHighlight(); + if (WebDevToolsAgentImpl* agent = devToolsAgent()) + agent->highlight(node); } void InspectorClientImpl::hideHighlight() { - // FIXME: able to invalidate a smaller rect. - invalidateNodeBoundingRect(m_inspectedWebView); + if (WebDevToolsAgentImpl* agent = devToolsAgent()) + agent->hideHighlight(); } -void InspectorClientImpl::inspectedURLChanged(const String& newURL) +void InspectorClientImpl::populateSetting(const String& key, String* value) { - // FIXME: Implement this + if (WebDevToolsAgentImpl* agent = devToolsAgent()) + agent->populateSetting(key, value); } -String InspectorClientImpl::localizedStringsURL() +void InspectorClientImpl::storeSetting(const String& key, const String& value) { - notImplemented(); - return String(); + if (WebDevToolsAgentImpl* agent = devToolsAgent()) + agent->storeSetting(key, value); } -String InspectorClientImpl::hiddenPanels() +bool InspectorClientImpl::sendMessageToFrontend(const WTF::String& message) { - notImplemented(); - return ""; + if (WebDevToolsAgentImpl* agent = devToolsAgent()) + return agent->sendMessageToFrontend(message); + return false; } -void InspectorClientImpl::populateSetting(const String& key, String* value) +void InspectorClientImpl::resourceTrackingWasEnabled() { - loadSettings(); - if (m_settings->contains(key)) - *value = m_settings->get(key); + if (WebDevToolsAgentImpl* agent = devToolsAgent()) + agent->resourceTrackingWasEnabled(); } -void InspectorClientImpl::storeSetting(const String& key, const String& value) +void InspectorClientImpl::resourceTrackingWasDisabled() { - loadSettings(); - m_settings->set(key, value); - saveSettings(); + if (WebDevToolsAgentImpl* agent = devToolsAgent()) + agent->resourceTrackingWasDisabled(); } -void InspectorClientImpl::inspectorWindowObjectCleared() +void InspectorClientImpl::timelineProfilerWasStarted() { - notImplemented(); + if (WebDevToolsAgentImpl* agent = devToolsAgent()) + agent->timelineProfilerWasStarted(); } -void InspectorClientImpl::loadSettings() +void InspectorClientImpl::timelineProfilerWasStopped() { - if (m_settings) - return; - - m_settings.set(new SettingsMap); - String data = m_inspectedWebView->inspectorSettings(); - if (data.isEmpty()) - return; - - Vector<String> entries; - data.split("\n", entries); - for (Vector<String>::iterator it = entries.begin(); it != entries.end(); ++it) { - Vector<String> tokens; - it->split(":", tokens); - if (tokens.size() < 3) - continue; - - String name = decodeURLEscapeSequences(tokens[0]); - String type = tokens[1]; - String value = tokens[2]; - for (size_t i = 3; i < tokens.size(); ++i) - value += ":" + tokens[i]; - - if (type == "string") - value = decodeURLEscapeSequences(value); - - m_settings->set(name, value); - } + if (WebDevToolsAgentImpl* agent = devToolsAgent()) + agent->timelineProfilerWasStopped(); } -void InspectorClientImpl::saveSettings() +WebDevToolsAgentImpl* InspectorClientImpl::devToolsAgent() { - String data; - for (SettingsMap::iterator it = m_settings->begin(); it != m_settings->end(); ++it) { - String name = encodeWithURLEscapeSequences(it->first); - String value = it->second; - String entry = String::format( - "%s:string:%s", - name.utf8().data(), - encodeWithURLEscapeSequences(value).utf8().data()); - data.append(entry); - data.append("\n"); - } - m_inspectedWebView->setInspectorSettings(data); - if (m_inspectedWebView->client()) - m_inspectedWebView->client()->didUpdateInspectorSettings(); + return static_cast<WebDevToolsAgentImpl*>(m_inspectedWebView->devToolsAgent()); } } // namespace WebKit diff --git a/WebKit/chromium/src/InspectorClientImpl.h b/WebKit/chromium/src/InspectorClientImpl.h index 6f7f8b1..34fcdc3 100644 --- a/WebKit/chromium/src/InspectorClientImpl.h +++ b/WebKit/chromium/src/InspectorClientImpl.h @@ -36,6 +36,9 @@ #include <wtf/OwnPtr.h> namespace WebKit { + +class WebDevToolsAgentClient; +class WebDevToolsAgentImpl; class WebViewImpl; class InspectorClientImpl : public WebCore::InspectorClient { @@ -45,35 +48,25 @@ public: // InspectorClient methods: virtual void inspectorDestroyed(); - virtual WebCore::Page* createPage(); - virtual WebCore::String localizedStringsURL(); - virtual WebCore::String hiddenPanels(); - virtual void showWindow(); - virtual void closeWindow(); - virtual bool windowVisible(); - virtual void attachWindow(); - virtual void detachWindow(); - virtual void setAttachedWindowHeight(unsigned height); + virtual void openInspectorFrontend(WebCore::InspectorController*); + virtual void highlight(WebCore::Node*); virtual void hideHighlight(); - virtual void inspectedURLChanged(const WebCore::String& newURL); - virtual void populateSetting( - const WebCore::String& key, - WebCore::String* value); - virtual void storeSetting( - const WebCore::String& key, - const WebCore::String& value); - virtual void inspectorWindowObjectCleared(); + virtual void populateSetting(const WTF::String& key, WTF::String* value); + virtual void storeSetting(const WTF::String& key, const WTF::String& value); + + virtual bool sendMessageToFrontend(const WTF::String&); + + virtual void resourceTrackingWasEnabled(); + virtual void resourceTrackingWasDisabled(); + virtual void timelineProfilerWasStarted(); + virtual void timelineProfilerWasStopped(); private: - void loadSettings(); - void saveSettings(); + WebDevToolsAgentImpl* devToolsAgent(); // The WebViewImpl of the page being inspected; gets passed to the constructor WebViewImpl* m_inspectedWebView; - - typedef HashMap<WebCore::String, WebCore::String> SettingsMap; - OwnPtr<SettingsMap> m_settings; }; } // namespace WebKit diff --git a/WebKit/chromium/src/InspectorFrontendClientImpl.cpp b/WebKit/chromium/src/InspectorFrontendClientImpl.cpp new file mode 100644 index 0000000..46f2cb6 --- /dev/null +++ b/WebKit/chromium/src/InspectorFrontendClientImpl.cpp @@ -0,0 +1,133 @@ +/* + * 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 "InspectorFrontendClientImpl.h" + +#include "Document.h" +#include "Frame.h" +#include "InspectorFrontendHost.h" +#include "Page.h" +#include "PlatformString.h" +#include "V8InspectorFrontendHost.h" +#include "V8Proxy.h" +#include "WebDevToolsFrontendClient.h" +#include "WebDevToolsFrontendImpl.h" +#include "WebString.h" + +using namespace WebCore; + +namespace WebKit { + +InspectorFrontendClientImpl::InspectorFrontendClientImpl(Page* frontendPage, WebDevToolsFrontendClient* client, WebDevToolsFrontendImpl* frontend) + : m_frontendPage(frontendPage) + , m_client(client) + , m_frontend(frontend) +{ +} + +InspectorFrontendClientImpl::~InspectorFrontendClientImpl() +{ + if (m_frontendHost) + m_frontendHost->disconnectClient(); + m_client = 0; +} + +void InspectorFrontendClientImpl::windowObjectCleared() +{ + v8::HandleScope handleScope; + v8::Handle<v8::Context> frameContext = V8Proxy::context(m_frontendPage->mainFrame()); + v8::Context::Scope contextScope(frameContext); + + ASSERT(!m_frontendHost); + m_frontendHost = InspectorFrontendHost::create(this, m_frontendPage); + v8::Handle<v8::Value> frontendHostObj = toV8(m_frontendHost.get()); + v8::Handle<v8::Object> global = frameContext->Global(); + + global->Set(v8::String::New("InspectorFrontendHost"), frontendHostObj); +} + +void InspectorFrontendClientImpl::frontendLoaded() +{ + m_frontend->frontendLoaded(); +} + +void InspectorFrontendClientImpl::moveWindowBy(float x, float y) +{ +} + +String InspectorFrontendClientImpl::localizedStringsURL() +{ + return ""; +} + +String InspectorFrontendClientImpl::hiddenPanels() +{ + if (m_client->shouldHideScriptsPanel()) + return "scripts"; + return ""; +} + +void InspectorFrontendClientImpl::bringToFront() +{ + m_client->activateWindow(); +} + +void InspectorFrontendClientImpl::closeWindow() +{ + m_client->closeWindow(); +} + +void InspectorFrontendClientImpl::requestAttachWindow() +{ + m_client->requestDockWindow(); +} + +void InspectorFrontendClientImpl::requestDetachWindow() +{ + m_client->requestUndockWindow(); +} + +void InspectorFrontendClientImpl::changeAttachedWindowHeight(unsigned) +{ + // Do nothing; +} + +void InspectorFrontendClientImpl::inspectedURLChanged(const String& url) +{ + m_frontendPage->mainFrame()->document()->setTitle("Developer Tools - " + url); +} + +void InspectorFrontendClientImpl::sendMessageToBackend(const String& message) +{ + m_client->sendMessageToBackend(message); +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/InspectorFrontendClientImpl.h b/WebKit/chromium/src/InspectorFrontendClientImpl.h new file mode 100644 index 0000000..1507bf2 --- /dev/null +++ b/WebKit/chromium/src/InspectorFrontendClientImpl.h @@ -0,0 +1,81 @@ +/* + * 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 InspectorFrontendClientImpl_h +#define InspectorFrontendClientImpl_h + +#include "InspectorFrontendClient.h" +#include <wtf/Noncopyable.h> + +namespace WebCore { +class InspectorFrontendHost; +class Page; +} + +namespace WebKit { + +class WebDevToolsFrontendClient; +class WebDevToolsFrontendImpl; + +class InspectorFrontendClientImpl : public WebCore::InspectorFrontendClient + , public Noncopyable { +public: + InspectorFrontendClientImpl(WebCore::Page*, WebDevToolsFrontendClient*, WebDevToolsFrontendImpl*); + virtual ~InspectorFrontendClientImpl(); + + // InspectorFrontendClient methods: + virtual void windowObjectCleared(); + virtual void frontendLoaded(); + + virtual void moveWindowBy(float x, float y); + + virtual WTF::String localizedStringsURL(); + virtual WTF::String hiddenPanels(); + + virtual void bringToFront(); + virtual void closeWindow(); + + virtual void requestAttachWindow(); + virtual void requestDetachWindow(); + virtual void changeAttachedWindowHeight(unsigned); + + virtual void inspectedURLChanged(const WTF::String&); + + virtual void sendMessageToBackend(const WTF::String&); +private: + WebCore::Page* m_frontendPage; + WebDevToolsFrontendClient* m_client; + WebDevToolsFrontendImpl* m_frontend; + RefPtr<WebCore::InspectorFrontendHost> m_frontendHost; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/src/LocalizedStrings.cpp b/WebKit/chromium/src/LocalizedStrings.cpp index 4e01848..74ff699 100644 --- a/WebKit/chromium/src/LocalizedStrings.cpp +++ b/WebKit/chromium/src/LocalizedStrings.cpp @@ -174,6 +174,18 @@ String AXMenuListActionVerb() { return String(); } + +String missingPluginText() +{ + notImplemented(); + return String("Missing Plug-in"); +} + +String crashedPluginText() +{ + notImplemented(); + return String("Plug-in Failure"); +} String multipleFileUploadText(unsigned numberOfFiles) { diff --git a/WebKit/chromium/src/NotificationPresenterImpl.cpp b/WebKit/chromium/src/NotificationPresenterImpl.cpp index a38b8b5..1931465 100644 --- a/WebKit/chromium/src/NotificationPresenterImpl.cpp +++ b/WebKit/chromium/src/NotificationPresenterImpl.cpp @@ -33,11 +33,11 @@ #if ENABLE(NOTIFICATIONS) -#include "Document.h" +#include "KURL.h" #include "Notification.h" +#include "ScriptExecutionContext.h" #include "SecurityOrigin.h" -#include "WebDocument.h" #include "WebNotification.h" #include "WebNotificationPermissionCallback.h" #include "WebNotificationPresenter.h" @@ -92,19 +92,15 @@ void NotificationPresenterImpl::notificationObjectDestroyed(Notification* notifi m_presenter->objectDestroyed(PassRefPtr<Notification>(notification)); } -NotificationPresenter::Permission NotificationPresenterImpl::checkPermission(const KURL& url, Document* document) +NotificationPresenter::Permission NotificationPresenterImpl::checkPermission(ScriptExecutionContext* context) { - WebDocument webDocument; - if (document) - webDocument = document; - - int result = m_presenter->checkPermission(url, document ? &webDocument : 0); + int result = m_presenter->checkPermission(context->url()); return static_cast<NotificationPresenter::Permission>(result); } -void NotificationPresenterImpl::requestPermission(SecurityOrigin* origin, PassRefPtr<VoidCallback> callback) +void NotificationPresenterImpl::requestPermission(ScriptExecutionContext* context, PassRefPtr<VoidCallback> callback) { - m_presenter->requestPermission(origin->toString(), new VoidCallbackClient(callback)); + m_presenter->requestPermission(WebSecurityOrigin(context->securityOrigin()), new VoidCallbackClient(callback)); } } // namespace WebKit diff --git a/WebKit/chromium/src/NotificationPresenterImpl.h b/WebKit/chromium/src/NotificationPresenterImpl.h index 8e3799c..bb156dd 100644 --- a/WebKit/chromium/src/NotificationPresenterImpl.h +++ b/WebKit/chromium/src/NotificationPresenterImpl.h @@ -54,8 +54,9 @@ public: virtual bool show(WebCore::Notification* object); virtual void cancel(WebCore::Notification* object); virtual void notificationObjectDestroyed(WebCore::Notification* object); - virtual WebCore::NotificationPresenter::Permission checkPermission(const WebCore::KURL& url, WebCore::Document* document); - virtual void requestPermission(WebCore::SecurityOrigin* origin, WTF::PassRefPtr<WebCore::VoidCallback> callback); + virtual WebCore::NotificationPresenter::Permission checkPermission(WebCore::ScriptExecutionContext*); + virtual void requestPermission(WebCore::ScriptExecutionContext* , WTF::PassRefPtr<WebCore::VoidCallback> callback); + virtual void cancelRequestsForPermission(WebCore::ScriptExecutionContext*) {} private: // WebNotificationPresenter that this object delegates to. diff --git a/WebKit/chromium/src/PlatformMessagePortChannel.h b/WebKit/chromium/src/PlatformMessagePortChannel.h index 05e8397..5416145 100644 --- a/WebKit/chromium/src/PlatformMessagePortChannel.h +++ b/WebKit/chromium/src/PlatformMessagePortChannel.h @@ -31,12 +31,9 @@ #ifndef PlatformMessagePortChannel_h #define PlatformMessagePortChannel_h -// FIXME: This relative path is a temporary hack to support using this -// header from webkit/glue. -#include "../public/WebMessagePortChannelClient.h" +#include "WebMessagePortChannelClient.h" #include "MessagePortChannel.h" - #include <wtf/PassRefPtr.h> #include <wtf/Threading.h> diff --git a/WebKit/chromium/src/ResourceHandle.cpp b/WebKit/chromium/src/ResourceHandle.cpp index bf6910f..88f7f39 100644 --- a/WebKit/chromium/src/ResourceHandle.cpp +++ b/WebKit/chromium/src/ResourceHandle.cpp @@ -31,8 +31,10 @@ #include "config.h" #include "ResourceHandle.h" +#include "ChromiumBridge.h" #include "ResourceHandleClient.h" #include "ResourceRequest.h" +#include "SharedBuffer.h" #include "WebKit.h" #include "WebKitClient.h" @@ -56,6 +58,7 @@ public: : m_request(request) , m_owner(0) , m_client(client) + , m_state(ConnectionStateNew) { } @@ -70,17 +73,36 @@ public: WebURLLoader*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent); virtual void didReceiveResponse(WebURLLoader*, const WebURLResponse&); virtual void didReceiveData(WebURLLoader*, const char* data, int dataLength); + virtual void didReceiveCachedMetadata(WebURLLoader*, const char* data, int dataLength); virtual void didFinishLoading(WebURLLoader*); virtual void didFail(WebURLLoader*, const WebURLError&); + enum ConnectionState { + ConnectionStateNew, + ConnectionStateStarted, + ConnectionStateReceivedResponse, + ConnectionStateReceivingData, + ConnectionStateFinishedLoading, + ConnectionStateCanceled, + ConnectionStateFailed, + }; + ResourceRequest m_request; ResourceHandle* m_owner; ResourceHandleClient* m_client; OwnPtr<WebURLLoader> m_loader; + + // Used for sanity checking to make sure we don't experience illegal state + // transitions. + ConnectionState m_state; }; void ResourceHandleInternal::start() { + if (m_state != ConnectionStateNew) + CRASH(); + m_state = ConnectionStateStarted; + m_loader.set(webKitClient()->createURLLoader()); ASSERT(m_loader.get()); @@ -91,6 +113,7 @@ void ResourceHandleInternal::start() void ResourceHandleInternal::cancel() { + m_state = ConnectionStateCanceled; m_loader->cancel(); // Do not make any further calls to the client. @@ -127,6 +150,12 @@ void ResourceHandleInternal::didReceiveResponse(WebURLLoader*, const WebURLRespo { ASSERT(m_client); ASSERT(!response.isNull()); + bool isMultipart = response.isMultipartPayload(); + bool isValidStateTransition = (m_state == ConnectionStateStarted || m_state == ConnectionStateReceivedResponse); + // In the case of multipart loads, calls to didReceiveData & didReceiveResponse can be interleaved. + if (!isMultipart && !isValidStateTransition) + CRASH(); + m_state = ConnectionStateReceivedResponse; m_client->didReceiveResponse(m_owner, response.toResourceResponse()); } @@ -134,6 +163,9 @@ void ResourceHandleInternal::didReceiveData( WebURLLoader*, const char* data, int dataLength) { ASSERT(m_client); + if (m_state != ConnectionStateReceivedResponse && m_state != ConnectionStateReceivingData) + CRASH(); + m_state = ConnectionStateReceivingData; // FIXME(yurys): it looks like lengthReceived is always the same as // dataLength and that the latter parameter can be eliminated. @@ -141,15 +173,28 @@ void ResourceHandleInternal::didReceiveData( m_client->didReceiveData(m_owner, data, dataLength, dataLength); } +void ResourceHandleInternal::didReceiveCachedMetadata(WebURLLoader*, const char* data, int dataLength) +{ + ASSERT(m_client); + if (m_state != ConnectionStateReceivedResponse && m_state != ConnectionStateReceivingData) + CRASH(); + + m_client->didReceiveCachedMetadata(m_owner, data, dataLength); +} + void ResourceHandleInternal::didFinishLoading(WebURLLoader*) { ASSERT(m_client); + if (m_state != ConnectionStateReceivedResponse && m_state != ConnectionStateReceivingData) + CRASH(); + m_state = ConnectionStateFinishedLoading; m_client->didFinishLoading(m_owner); } void ResourceHandleInternal::didFail(WebURLLoader*, const WebURLError& error) { ASSERT(m_client); + m_state = ConnectionStateFailed; m_client->didFail(m_owner, error); } @@ -158,8 +203,7 @@ void ResourceHandleInternal::didFail(WebURLLoader*, const WebURLError& error) ResourceHandle::ResourceHandle(const ResourceRequest& request, ResourceHandleClient* client, bool defersLoading, - bool shouldContentSniff, - bool mightDownloadFromHandle) + bool shouldContentSniff) : d(new ResourceHandleInternal(request, client)) { d->m_owner = this; @@ -171,11 +215,10 @@ PassRefPtr<ResourceHandle> ResourceHandle::create(const ResourceRequest& request ResourceHandleClient* client, Frame* deprecated, bool defersLoading, - bool shouldContentSniff, - bool mightDownloadFromHandle) + bool shouldContentSniff) { RefPtr<ResourceHandle> newHandle = adoptRef(new ResourceHandle( - request, client, defersLoading, shouldContentSniff, mightDownloadFromHandle)); + request, client, defersLoading, shouldContentSniff)); if (newHandle->start(deprecated)) return newHandle.release(); @@ -183,7 +226,7 @@ PassRefPtr<ResourceHandle> ResourceHandle::create(const ResourceRequest& request return 0; } -const ResourceRequest& ResourceHandle::request() const +ResourceRequest& ResourceHandle::firstRequest() { return d->m_request; } @@ -209,6 +252,11 @@ bool ResourceHandle::start(Frame* deprecated) return true; } +bool ResourceHandle::hasAuthenticationChallenge() const +{ + return false; +} + void ResourceHandle::clearAuthentication() { } @@ -279,4 +327,10 @@ bool ResourceHandle::willLoadFromCache(ResourceRequest& request, Frame*) return true; } +// static +void ResourceHandle::cacheMetadata(const ResourceResponse& response, const Vector<char>& data) +{ + ChromiumBridge::cacheMetadata(response.url(), response.responseTime(), data); +} + } // namespace WebCore diff --git a/WebKit/chromium/src/SharedWorkerRepository.cpp b/WebKit/chromium/src/SharedWorkerRepository.cpp index c803aac..88d3ec5 100644 --- a/WebKit/chromium/src/SharedWorkerRepository.cpp +++ b/WebKit/chromium/src/SharedWorkerRepository.cpp @@ -36,6 +36,7 @@ #include "Event.h" #include "EventNames.h" +#include "InspectorController.h" #include "MessagePortChannel.h" #include "PlatformMessagePortChannel.h" #include "ScriptExecutionContext.h" @@ -69,7 +70,9 @@ public: , m_name(name) , m_webWorker(webWorker) , m_port(port) + , m_scriptLoader(ResourceRequestBase::TargetIsSharedWorker) , m_loading(false) + , m_responseAppCacheID(0) { } @@ -79,6 +82,7 @@ public: private: // WorkerScriptLoaderClient callback + virtual void didReceiveResponse(const ResourceResponse&); virtual void notifyFinished(); virtual void connected(); @@ -94,6 +98,7 @@ private: OwnPtr<MessagePortChannel> m_port; WorkerScriptLoader m_scriptLoader; bool m_loading; + long long m_responseAppCacheID; }; static Vector<SharedWorkerScriptLoader*>& pendingLoaders() @@ -146,14 +151,23 @@ static WebMessagePortChannel* getWebPort(PassOwnPtr<MessagePortChannel> port) return webPort; } +void SharedWorkerScriptLoader::didReceiveResponse(const ResourceResponse& response) +{ + m_responseAppCacheID = response.appCacheID(); +} + void SharedWorkerScriptLoader::notifyFinished() { if (m_scriptLoader.failed()) { m_worker->dispatchEvent(Event::create(eventNames().errorEvent, false, true)); delete this; } else { +#if ENABLE(INSPECTOR) + if (InspectorController* inspector = m_worker->scriptExecutionContext()->inspectorController()) + inspector->scriptImported(m_scriptLoader.identifier(), m_scriptLoader.script()); +#endif // Pass the script off to the worker, then send a connect event. - m_webWorker->startWorkerContext(m_url, m_name, m_worker->scriptExecutionContext()->userAgent(m_url), m_scriptLoader.script()); + m_webWorker->startWorkerContext(m_url, m_name, m_worker->scriptExecutionContext()->userAgent(m_url), m_scriptLoader.script(), m_responseAppCacheID); sendConnect(); } } @@ -206,7 +220,7 @@ void SharedWorkerRepository::connect(PassRefPtr<SharedWorker> worker, PassOwnPtr // The loader object manages its own lifecycle (and the lifecycles of the two worker objects). // It will free itself once loading is completed. - SharedWorkerScriptLoader* loader = new SharedWorkerScriptLoader(worker, url, name, port.release(), webWorker.release()); + SharedWorkerScriptLoader* loader = new SharedWorkerScriptLoader(worker, url, name, port, webWorker.release()); loader->load(); } diff --git a/WebKit/chromium/src/ProfilerAgent.h b/WebKit/chromium/src/SpeechInputClientImpl.cpp index 52337b8..963d440 100644 --- a/WebKit/chromium/src/ProfilerAgent.h +++ b/WebKit/chromium/src/SpeechInputClientImpl.cpp @@ -28,34 +28,70 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef ProfilerAgent_h -#define ProfilerAgent_h +#include "config.h" +#include "SpeechInputClientImpl.h" -#include "DevToolsRPC.h" +#include "PlatformString.h" +#include "WebSpeechInputController.h" +#include "WebString.h" +#include "WebViewClient.h" +#include "page/SpeechInputListener.h" + +#if ENABLE(INPUT_SPEECH) namespace WebKit { -// Profiler agent provides API for retrieving profiler data. -// These methods are handled on the IO thread, so profiler can -// operate while a script on a page performs heavy work. -#define PROFILER_AGENT_STRUCT(METHOD0, METHOD1, METHOD2, METHOD3, METHOD4, METHOD5) \ - /* Requests current profiler state. */ \ - METHOD0(getActiveProfilerModules) \ - \ - /* Retrieves portion of profiler log. */ \ - METHOD1(getLogLines, int /* position */) +SpeechInputClientImpl::SpeechInputClientImpl(WebViewClient* web_view_client) + : m_controller(web_view_client ? web_view_client->speechInputController(this) : 0) + , m_listener(0) +{ +} + +SpeechInputClientImpl::~SpeechInputClientImpl() +{ +} + +void SpeechInputClientImpl::setListener(WebCore::SpeechInputListener* listener) +{ + m_listener = listener; +} + +bool SpeechInputClientImpl::startRecognition(int requestId, const WebCore::IntRect& elementRect) +{ + ASSERT(m_listener); + return m_controller->startRecognition(requestId, elementRect); +} + +void SpeechInputClientImpl::stopRecording(int requestId) +{ + ASSERT(m_listener); + m_controller->stopRecording(requestId); +} + +void SpeechInputClientImpl::cancelRecognition(int requestId) +{ + ASSERT(m_listener); + m_controller->cancelRecognition(requestId); +} -DEFINE_RPC_CLASS(ProfilerAgent, PROFILER_AGENT_STRUCT) +void SpeechInputClientImpl::didCompleteRecording(int requestId) +{ + ASSERT(m_listener); + m_listener->didCompleteRecording(requestId); +} -#define PROFILER_AGENT_DELEGATE_STRUCT(METHOD0, METHOD1, METHOD2, METHOD3, METHOD4, METHOD5) \ - /* Response to getActiveProfilerModules. */ \ - METHOD1(didGetActiveProfilerModules, int /* flags */) \ - \ - /* Response to getLogLines. */ \ - METHOD2(didGetLogLines, int /* position */, String /* log */) +void SpeechInputClientImpl::didCompleteRecognition(int requestId) +{ + ASSERT(m_listener); + m_listener->didCompleteRecognition(requestId); +} -DEFINE_RPC_CLASS(ProfilerAgentDelegate, PROFILER_AGENT_DELEGATE_STRUCT) +void SpeechInputClientImpl::setRecognitionResult(int requestId, const WebString& result) +{ + ASSERT(m_listener); + m_listener->setRecognitionResult(requestId, result); +} } // namespace WebKit -#endif +#endif // ENABLE(INPUT_SPEECH) diff --git a/WebKit/chromium/src/SpeechInputClientImpl.h b/WebKit/chromium/src/SpeechInputClientImpl.h new file mode 100644 index 0000000..817b32b --- /dev/null +++ b/WebKit/chromium/src/SpeechInputClientImpl.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: + * + * 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 SpeechInputClientImpl_h +#define SpeechInputClientImpl_h + +#if ENABLE(INPUT_SPEECH) + +#include "WebSpeechInputListener.h" +#include "page/SpeechInputClient.h" + +namespace WebCore { +class SpeechInputListener; +} + +namespace WebKit { + +class WebSpeechInputController; +class WebViewClient; + +class SpeechInputClientImpl + : public WebCore::SpeechInputClient, + public WebSpeechInputListener { +public: + SpeechInputClientImpl(WebViewClient*); + virtual ~SpeechInputClientImpl(); + + // SpeechInputClient methods. + void setListener(WebCore::SpeechInputListener*); + bool startRecognition(int, const WebCore::IntRect&); + void stopRecording(int); + void cancelRecognition(int); + + // WebSpeechInputListener methods. + void didCompleteRecording(int); + void setRecognitionResult(int, const WebString&); + void didCompleteRecognition(int); + +private: + WebSpeechInputController* m_controller; // To call into the embedder. + WebCore::SpeechInputListener* m_listener; +}; + +} // namespace WebKit + +#endif // ENABLE(INPUT_SPEECH) + +#endif // SpeechInputClientImpl_h diff --git a/WebKit/chromium/src/StorageAreaProxy.cpp b/WebKit/chromium/src/StorageAreaProxy.cpp index c9185fe..5311b65 100644 --- a/WebKit/chromium/src/StorageAreaProxy.cpp +++ b/WebKit/chromium/src/StorageAreaProxy.cpp @@ -40,6 +40,7 @@ #include "StorageAreaImpl.h" #include "StorageEvent.h" +#include "WebFrameImpl.h" #include "WebStorageArea.h" #include "WebString.h" #include "WebURL.h" @@ -73,12 +74,13 @@ String StorageAreaProxy::getItem(const String& key) const String StorageAreaProxy::setItem(const String& key, const String& value, ExceptionCode& ec, Frame* frame) { - bool quotaException = false; + WebKit::WebStorageArea::Result result = WebKit::WebStorageArea::ResultOK; WebKit::WebString oldValue; - m_storageArea->setItem(key, value, frame->document()->url(), quotaException, oldValue); - ec = quotaException ? QUOTA_EXCEEDED_ERR : 0; + WebKit::WebFrame* webFrame = WebKit::WebFrameImpl::fromFrame(frame); + m_storageArea->setItem(key, value, frame->document()->url(), result, oldValue, webFrame); + ec = (result == WebKit::WebStorageArea::ResultOK) ? 0 : QUOTA_EXCEEDED_ERR; String oldValueString = oldValue; - if (oldValueString != value) + if (oldValueString != value && result == WebKit::WebStorageArea::ResultOK) storageEvent(key, oldValue, value, m_storageType, frame->document()->securityOrigin(), frame); return oldValue; } @@ -123,8 +125,12 @@ void StorageAreaProxy::storageEvent(const String& key, const String& oldValue, c frames.append(frame); } - for (unsigned i = 0; i < frames.size(); ++i) - frames[i]->document()->enqueueStorageEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), frames[i]->domWindow()->sessionStorage())); + for (unsigned i = 0; i < frames.size(); ++i) { + ExceptionCode ec = 0; + Storage* storage = frames[i]->domWindow()->sessionStorage(ec); + if (!ec) + frames[i]->document()->enqueueEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), storage)); + } } else { // Send events to every page. const HashSet<Page*>& pages = page->group().pages(); @@ -136,8 +142,12 @@ void StorageAreaProxy::storageEvent(const String& key, const String& oldValue, c } } - for (unsigned i = 0; i < frames.size(); ++i) - frames[i]->document()->enqueueStorageEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), frames[i]->domWindow()->localStorage())); + for (unsigned i = 0; i < frames.size(); ++i) { + ExceptionCode ec = 0; + Storage* storage = frames[i]->domWindow()->localStorage(ec); + if (!ec) + frames[i]->document()->enqueueEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), storage)); + } } } diff --git a/WebKit/chromium/src/StorageEventDispatcherImpl.cpp b/WebKit/chromium/src/StorageEventDispatcherImpl.cpp index 3518796..631753b 100644 --- a/WebKit/chromium/src/StorageEventDispatcherImpl.cpp +++ b/WebKit/chromium/src/StorageEventDispatcherImpl.cpp @@ -71,10 +71,11 @@ void StorageEventDispatcherImpl::dispatchStorageEvent(const String& key, const S } } - // FIXME: Figure out how to pass in the document URI. for (unsigned i = 0; i < frames.size(); ++i) { - frames[i]->document()->dispatchWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, - url, frames[i]->domWindow()->localStorage())); + ExceptionCode ec = 0; + Storage* storage = frames[i]->domWindow()->localStorage(ec); + if (!ec) + frames[i]->document()->dispatchWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, url, storage)); } } diff --git a/WebKit/chromium/src/StorageNamespaceProxy.cpp b/WebKit/chromium/src/StorageNamespaceProxy.cpp index 1be1967..ec0dbce 100644 --- a/WebKit/chromium/src/StorageNamespaceProxy.cpp +++ b/WebKit/chromium/src/StorageNamespaceProxy.cpp @@ -47,11 +47,11 @@ PassRefPtr<StorageNamespace> StorageNamespace::localStorageNamespace(const Strin return adoptRef(new StorageNamespaceProxy(WebKit::webKitClient()->createLocalStorageNamespace(path, quota), LocalStorage)); } -PassRefPtr<StorageNamespace> StorageNamespace::sessionStorageNamespace(Page* page) +PassRefPtr<StorageNamespace> StorageNamespace::sessionStorageNamespace(Page* page, unsigned quota) { WebKit::ChromeClientImpl* chromeClientImpl = static_cast<WebKit::ChromeClientImpl*>(page->chrome()->client()); WebKit::WebViewClient* webViewClient = chromeClientImpl->webView()->client(); - return adoptRef(new StorageNamespaceProxy(webViewClient->createSessionStorageNamespace(), SessionStorage)); + return adoptRef(new StorageNamespaceProxy(webViewClient->createSessionStorageNamespace(quota), SessionStorage)); } StorageNamespaceProxy::StorageNamespaceProxy(WebKit::WebStorageNamespace* storageNamespace, StorageType storageType) @@ -67,13 +67,14 @@ StorageNamespaceProxy::~StorageNamespaceProxy() PassRefPtr<StorageNamespace> StorageNamespaceProxy::copy() { ASSERT(m_storageType == SessionStorage); - // The WebViewClient knows what its session storage namespace id is but we - // do not. Returning 0 here causes it to be fetched (via the WebViewClient) - // on its next use. Note that it is WebViewClient::createView's - // responsibility to clone the session storage namespace id and that the - // only time copy() is called is directly after the createView call...which - // is why all of this is safe. - return 0; + WebKit::WebStorageNamespace* newNamespace = m_storageNamespace->copy(); + // Some embedders hook into WebViewClient::createView to make the copy of + // session storage and then return the object lazily. Other embedders + // choose to make the copy now and return a pointer immediately. So handle + // both cases. + if (!newNamespace) + return 0; + return adoptRef(new StorageNamespaceProxy(newNamespace, m_storageType)); } PassRefPtr<StorageArea> StorageNamespaceProxy::storageArea(PassRefPtr<SecurityOrigin> origin) diff --git a/WebKit/chromium/src/SuggestionsPopupMenuClient.cpp b/WebKit/chromium/src/SuggestionsPopupMenuClient.cpp deleted file mode 100644 index b4a77a3..0000000 --- a/WebKit/chromium/src/SuggestionsPopupMenuClient.cpp +++ /dev/null @@ -1,186 +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. - */ - -#include "config.h" -#include "SuggestionsPopupMenuClient.h" - -#include "CSSStyleSelector.h" -#include "CSSValueKeywords.h" -#include "Chrome.h" -#include "FrameView.h" -#include "HTMLInputElement.h" -#include "RenderTheme.h" -#include "WebViewImpl.h" - -using namespace WebCore; - -namespace WebKit { - -SuggestionsPopupMenuClient::SuggestionsPopupMenuClient() - : m_textField(0) - , m_selectedIndex(0) -{ -} - -SuggestionsPopupMenuClient::~SuggestionsPopupMenuClient() -{ -} - -// FIXME: Implement this per-derived class? -void SuggestionsPopupMenuClient::valueChanged(unsigned listIndex, bool fireEvents) -{ - m_textField->setValue(getSuggestion(listIndex)); - - WebViewImpl* webView = getWebView(); - if (!webView) - return; - - EditorClientImpl* editor = - static_cast<EditorClientImpl*>(webView->page()->editorClient()); - ASSERT(editor); - editor->onAutofillSuggestionAccepted( - static_cast<HTMLInputElement*>(m_textField.get())); -} - -String SuggestionsPopupMenuClient::itemText(unsigned listIndex) const -{ - return getSuggestion(listIndex); -} - -PopupMenuStyle SuggestionsPopupMenuClient::itemStyle(unsigned listIndex) const -{ - return *m_style; -} - -PopupMenuStyle SuggestionsPopupMenuClient::menuStyle() const -{ - return *m_style; -} - -int SuggestionsPopupMenuClient::clientPaddingLeft() const -{ - // Bug http://crbug.com/7708 seems to indicate the style can be 0. - RenderStyle* style = textFieldStyle(); - if (!style) - return 0; - - return RenderTheme::defaultTheme()->popupInternalPaddingLeft(style); -} - -int SuggestionsPopupMenuClient::clientPaddingRight() const -{ - // Bug http://crbug.com/7708 seems to indicate the style can be 0. - RenderStyle* style = textFieldStyle(); - if (!style) - return 0; - - return RenderTheme::defaultTheme()->popupInternalPaddingRight(style); -} - -void SuggestionsPopupMenuClient::popupDidHide() -{ - WebViewImpl* webView = getWebView(); - if (webView) - webView->suggestionsPopupDidHide(); -} - -void SuggestionsPopupMenuClient::setTextFromItem(unsigned listIndex) -{ - m_textField->setValue(getSuggestion(listIndex)); -} - -FontSelector* SuggestionsPopupMenuClient::fontSelector() const -{ - return m_textField->document()->styleSelector()->fontSelector(); -} - -HostWindow* SuggestionsPopupMenuClient::hostWindow() const -{ - return m_textField->document()->view()->hostWindow(); -} - -PassRefPtr<Scrollbar> SuggestionsPopupMenuClient::createScrollbar( - ScrollbarClient* client, - ScrollbarOrientation orientation, - ScrollbarControlSize size) -{ - return Scrollbar::createNativeScrollbar(client, orientation, size); -} - -RenderStyle* SuggestionsPopupMenuClient::textFieldStyle() const -{ - RenderStyle* style = m_textField->computedStyle(); - if (!style) { - // It seems we can only have a 0 style in a TextField if the - // node is detached, in which case we the popup shoud not be - // showing. Please report this in http://crbug.com/7708 and - // include the page you were visiting. - ASSERT_NOT_REACHED(); - } - return style; -} - -void SuggestionsPopupMenuClient::initialize(HTMLInputElement* textField, - int defaultSuggestionIndex) -{ - m_textField = textField; - m_selectedIndex = defaultSuggestionIndex; - - FontDescription fontDescription; - RenderTheme::defaultTheme()->systemFont(CSSValueWebkitControl, - fontDescription); - - // Use a smaller font size to match IE/Firefox. - // FIXME: http://crbug.com/7376 use the system size instead of a - // fixed font size value. - fontDescription.setComputedSize(12.0); - Font font(fontDescription, 0, 0); - font.update(textField->document()->styleSelector()->fontSelector()); - // The direction of text in popup menu is set the same as the direction of - // the input element: textField. - m_style.set(new PopupMenuStyle(Color::black, Color::white, font, true, - Length(WebCore::Fixed), - textField->renderer()->style()->direction())); -} - -WebViewImpl* SuggestionsPopupMenuClient::getWebView() const -{ - Frame* frame = m_textField->document()->frame(); - if (!frame) - return 0; - - Page* page = frame->page(); - if (!page) - return 0; - - return static_cast<ChromeClientImpl*>(page->chrome()->client())->webView(); -} - -} // namespace WebKit diff --git a/WebKit/chromium/src/SuggestionsPopupMenuClient.h b/WebKit/chromium/src/SuggestionsPopupMenuClient.h deleted file mode 100644 index edc4c09..0000000 --- a/WebKit/chromium/src/SuggestionsPopupMenuClient.h +++ /dev/null @@ -1,109 +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. - */ - -#include "PopupMenuClient.h" - -#ifndef SuggestionsPopupMenuClient_h -#define SuggestionsPopupMenuClient_h - -namespace WebCore { -class HTMLInputElement; -class PopupMenuStyle; -class RenderStyle; -} - -namespace WebKit { -class WebString; -class WebViewImpl; -template <typename T> class WebVector; - -// The Suggestions popup menu client, used to display a list of suggestions. -class SuggestionsPopupMenuClient : public WebCore::PopupMenuClient { -public: - SuggestionsPopupMenuClient(); - virtual ~SuggestionsPopupMenuClient(); - - // Returns the number of suggestions available. - virtual unsigned getSuggestionsCount() const = 0; - - // Returns the suggestion at |listIndex|. - virtual WebString getSuggestion(unsigned listIndex) const = 0; - - // Removes the suggestion at |listIndex| from the list of suggestions. - virtual void removeSuggestionAtIndex(unsigned listIndex) = 0; - - // WebCore::PopupMenuClient methods: - virtual void valueChanged(unsigned listIndex, bool fireEvents = true); - virtual WebCore::String itemText(unsigned listIndex) const; - virtual WebCore::String itemToolTip(unsigned lastIndex) const { return WebCore::String(); } - virtual bool itemIsEnabled(unsigned listIndex) const { return true; } - virtual WebCore::PopupMenuStyle itemStyle(unsigned listIndex) const; - virtual WebCore::PopupMenuStyle menuStyle() const; - virtual int clientInsetLeft() const { return 0; } - virtual int clientInsetRight() const { return 0; } - virtual int clientPaddingLeft() const; - virtual int clientPaddingRight() const; - virtual int listSize() const { return getSuggestionsCount(); } - virtual int selectedIndex() const { return m_selectedIndex; } - virtual void popupDidHide(); - virtual bool itemIsSeparator(unsigned listIndex) const { return false; } - virtual bool itemIsLabel(unsigned listIndex) const { return false; } - virtual bool itemIsSelected(unsigned listIndex) const { return false; } - virtual bool shouldPopOver() const { return false; } - virtual bool valueShouldChangeOnHotTrack() const { return false; } - virtual void setTextFromItem(unsigned listIndex); - virtual WebCore::FontSelector* fontSelector() const; - virtual WebCore::HostWindow* hostWindow() const; - virtual PassRefPtr<WebCore::Scrollbar> createScrollbar( - WebCore::ScrollbarClient* client, - WebCore::ScrollbarOrientation orientation, - WebCore::ScrollbarControlSize size); - -protected: - void initialize(WebCore::HTMLInputElement* textField, - int defaultSuggestionIndex); - - int getSelectedIndex() const { return m_selectedIndex; } - void setSelectedIndex(int index) { m_selectedIndex = index; } - - WebViewImpl* getWebView() const; - WebCore::HTMLInputElement* getTextField() const { return m_textField.get(); } - -private: - WebCore::RenderStyle* textFieldStyle() const; - - RefPtr<WebCore::HTMLInputElement> m_textField; - int m_selectedIndex; - OwnPtr<WebCore::PopupMenuStyle> m_style; -}; - -} // namespace WebKit - -#endif diff --git a/WebKit/chromium/src/ToolsAgent.h b/WebKit/chromium/src/ToolsAgent.h deleted file mode 100644 index ab48153..0000000 --- a/WebKit/chromium/src/ToolsAgent.h +++ /dev/null @@ -1,66 +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. - */ - -#ifndef ToolsAgent_h -#define ToolsAgent_h - -#include "DevToolsRPC.h" - -namespace WebKit { - -// Tools agent provides API for enabling / disabling other agents as well as -// API for auxiliary UI functions such as dom elements highlighting. -#define TOOLS_AGENT_STRUCT(METHOD0, METHOD1, METHOD2, METHOD3, METHOD4, METHOD5) \ - /* Dispatches given function on the InspectorController object */ \ - METHOD3(dispatchOnInspectorController, int /* call_id */, \ - String /* function_name */, String /* json_args */) \ - \ - /* Dispatches given function on the InjectedScript object */ \ - METHOD5(dispatchOnInjectedScript, int /* call_id */, \ - int /* injected_script_id */, String /* function_name */, \ - String /* json_args */, bool /* async */) - -DEFINE_RPC_CLASS(ToolsAgent, TOOLS_AGENT_STRUCT) - -#define TOOLS_AGENT_DELEGATE_STRUCT(METHOD0, METHOD1, METHOD2, METHOD3, METHOD4, METHOD5) \ - /* Updates focused node on the client. */ \ - METHOD1(frameNavigate, String /* url */) \ - \ - /* Response to the DispatchOn*. */ \ - METHOD3(didDispatchOn, int /* call_id */, String /* result */, String /* exception */) \ - \ - /* Sends InspectorFrontend message to be dispatched on client. */ \ - METHOD1(dispatchOnClient, String /* data */) - -DEFINE_RPC_CLASS(ToolsAgentDelegate, TOOLS_AGENT_DELEGATE_STRUCT) - -} // namespace WebKit - -#endif diff --git a/WebKit/chromium/src/VideoFrameChromiumImpl.cpp b/WebKit/chromium/src/VideoFrameChromiumImpl.cpp new file mode 100644 index 0000000..2b98320 --- /dev/null +++ b/WebKit/chromium/src/VideoFrameChromiumImpl.cpp @@ -0,0 +1,111 @@ +/* + * 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 "VideoFrameChromiumImpl.h" + +#include "VideoFrameChromium.h" +#include "WebVideoFrame.h" + +using namespace WebCore; + +namespace WebKit { + +const unsigned cMaxPlanes = 3; +const unsigned cNumRGBPlanes = 1; +const unsigned cRGBPlane = 0; +const unsigned cNumYUVPlanes = 3; +const unsigned cYPlane = 0; +const unsigned cUPlane = 1; +const unsigned cVPlane = 2; + +WebVideoFrame* VideoFrameChromiumImpl::toWebVideoFrame(VideoFrameChromium* videoFrame) +{ + VideoFrameChromiumImpl* wrappedFrame = static_cast<VideoFrameChromiumImpl*>(videoFrame); + if (wrappedFrame) + return wrappedFrame->m_webVideoFrame; + return 0; +} + +VideoFrameChromiumImpl::VideoFrameChromiumImpl(WebVideoFrame* webVideoFrame) + : m_webVideoFrame(webVideoFrame) +{ +} + +VideoFrameChromium::SurfaceType VideoFrameChromiumImpl::surfaceType() const +{ + if (m_webVideoFrame) + return static_cast<VideoFrameChromium::SurfaceType>(m_webVideoFrame->surfaceType()); + return TypeSystemMemory; +} + +VideoFrameChromium::Format VideoFrameChromiumImpl::format() const +{ + if (m_webVideoFrame) + return static_cast<VideoFrameChromium::Format>(m_webVideoFrame->format()); + return Invalid; +} + +unsigned VideoFrameChromiumImpl::width() const +{ + if (m_webVideoFrame) + return m_webVideoFrame->width(); + return 0; +} + +unsigned VideoFrameChromiumImpl::height() const +{ + if (m_webVideoFrame) + return m_webVideoFrame->height(); + return 0; +} + +unsigned VideoFrameChromiumImpl::planes() const +{ + if (m_webVideoFrame) + return m_webVideoFrame->planes(); + return 0; +} + +int VideoFrameChromiumImpl::stride(unsigned plane) const +{ + if (m_webVideoFrame) + return m_webVideoFrame->stride(plane); + return 0; +} + +const void* VideoFrameChromiumImpl::data(unsigned plane) const +{ + if (m_webVideoFrame) + return m_webVideoFrame->data(plane); + return 0; +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/VideoFrameChromiumImpl.h b/WebKit/chromium/src/VideoFrameChromiumImpl.h new file mode 100644 index 0000000..3ad424c --- /dev/null +++ b/WebKit/chromium/src/VideoFrameChromiumImpl.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef VideoFrameChromiumImpl_h +#define VideoFrameChromiumImpl_h + +#include "VideoFrameChromium.h" +#include "WebVideoFrame.h" + +using namespace WebCore; + +namespace WebKit { + +// A wrapper class for WebKit::WebVideoFrame. Objects can be created in WebKit +// and used in WebCore because of the VideoFrameChromium interface. +class VideoFrameChromiumImpl : public VideoFrameChromium { +public: + // Converts a WebCore::VideoFrameChromium to a WebKit::WebVideoFrame. + static WebVideoFrame* toWebVideoFrame(VideoFrameChromium*); + + // Creates a VideoFrameChromiumImpl object to wrap the given WebVideoFrame. + // The VideoFrameChromiumImpl does not take ownership of the WebVideoFrame + // and should not free the frame's memory. + VideoFrameChromiumImpl(WebVideoFrame*); + virtual SurfaceType surfaceType() const; + virtual Format format() const; + virtual unsigned width() const; + virtual unsigned height() const; + virtual unsigned planes() const; + virtual int stride(unsigned plane) const; + virtual const void* data(unsigned plane) const; + +private: + WebVideoFrame* m_webVideoFrame; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/src/WebAccessibilityCacheImpl.cpp b/WebKit/chromium/src/WebAccessibilityCacheImpl.cpp index 03e5f46..abb63cc 100644 --- a/WebKit/chromium/src/WebAccessibilityCacheImpl.cpp +++ b/WebKit/chromium/src/WebAccessibilityCacheImpl.cpp @@ -64,14 +64,15 @@ WebAccessibilityCache* WebAccessibilityCache::create() PassRefPtr<WebAccessibilityCacheImpl::WeakHandle> WebAccessibilityCacheImpl::WeakHandle::create(AccessibilityObject* object) { // FIXME: Remove resetting ref-count from AccessibilityObjectWrapper - // and convert to use adoptRef. - return new WebAccessibilityCacheImpl::WeakHandle(object); + RefPtr<WebAccessibilityCacheImpl::WeakHandle> weakHandle = adoptRef(new WebAccessibilityCacheImpl::WeakHandle(object)); + weakHandle->m_object->setWrapper(weakHandle.get()); + + return weakHandle.release(); } WebAccessibilityCacheImpl::WeakHandle::WeakHandle(AccessibilityObject* object) : AccessibilityObjectWrapper(object) { - m_object->setWrapper(this); } // WebAccessibilityCacheImpl ---------------------------------------- diff --git a/WebKit/chromium/src/WebAccessibilityObject.cpp b/WebKit/chromium/src/WebAccessibilityObject.cpp index c386d44..4263e8b 100644 --- a/WebKit/chromium/src/WebAccessibilityObject.cpp +++ b/WebKit/chromium/src/WebAccessibilityObject.cpp @@ -32,9 +32,15 @@ #include "WebAccessibilityObject.h" #include "AccessibilityObject.h" +#include "CSSPrimitiveValueMappings.h" +#include "Document.h" #include "EventHandler.h" #include "FrameView.h" +#include "Node.h" #include "PlatformKeyboardEvent.h" +#include "RenderStyle.h" +#include "WebDocument.h" +#include "WebNode.h" #include "WebPoint.h" #include "WebRect.h" #include "WebString.h" @@ -303,6 +309,15 @@ WebString WebAccessibilityObject::helpText() const return m_private->helpText(); } +int WebAccessibilityObject::headingLevel() const +{ + if (!m_private) + return 0; + + m_private->updateBackingStore(); + return m_private->headingLevel(); +} + WebAccessibilityObject WebAccessibilityObject::hitTest(const WebPoint& point) const { if (!m_private) @@ -368,6 +383,12 @@ WebAccessibilityRole WebAccessibilityObject::roleValue() const return static_cast<WebAccessibilityRole>(m_private->roleValue()); } +void WebAccessibilityObject::setFocused(bool on) const +{ + if (m_private) + m_private->setFocused(on); +} + WebString WebAccessibilityObject::stringValue() const { if (!m_private) @@ -386,6 +407,65 @@ WebString WebAccessibilityObject::title() const return m_private->title(); } + +WebNode WebAccessibilityObject::node() const +{ + if (!m_private) + return WebNode(); + + m_private->updateBackingStore(); + + Node* node = m_private->node(); + if (!node) + return WebNode(); + + return WebNode(node); +} + +WebDocument WebAccessibilityObject::document() const +{ + if (!m_private) + return WebDocument(); + + m_private->updateBackingStore(); + + Document* document = m_private->document(); + if (!document) + return WebDocument(); + + return WebDocument(document); +} + +bool WebAccessibilityObject::hasComputedStyle() const +{ + Document* document = m_private->document(); + if (document) + document->updateStyleIfNeeded(); + + Node* node = m_private->node(); + if (!node) + return false; + + return node->computedStyle(); +} + +WebString WebAccessibilityObject::computedStyleDisplay() const +{ + Document* document = m_private->document(); + if (document) + document->updateStyleIfNeeded(); + + Node* node = m_private->node(); + if (!node) + return WebString(); + + RenderStyle* renderStyle = node->computedStyle(); + if (!renderStyle) + return WebString(); + + return WebString(CSSPrimitiveValue::create(renderStyle->display())->getStringValue()); +} + WebAccessibilityObject::WebAccessibilityObject(const WTF::PassRefPtr<WebCore::AccessibilityObject>& object) : m_private(static_cast<WebAccessibilityObjectPrivate*>(object.releaseRef())) { 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 8b0676e..62b89f0 100644 --- a/WebKit/chromium/src/WebAnimationControllerImpl.h +++ b/WebKit/chromium/src/WebAnimationControllerImpl.h @@ -31,9 +31,7 @@ #ifndef WebAnimationControllerImpl_h #define WebAnimationControllerImpl_h -// FIXME: This relative path is a temporary hack to support using this -// header from webkit/glue. -#include "../public/WebAnimationController.h" +#include "WebAnimationController.h" namespace WebCore { class AnimationController; @@ -54,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/WebAttribute.cpp b/WebKit/chromium/src/WebAttribute.cpp new file mode 100644 index 0000000..0bc3b91 --- /dev/null +++ b/WebKit/chromium/src/WebAttribute.cpp @@ -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: + * + * * 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 "WebAttribute.h" + +#include "Attribute.h" +#include <wtf/PassRefPtr.h> + +#include "WebString.h" + +using namespace WebCore; + +namespace WebKit { + +void WebAttribute::reset() +{ + m_private.reset(); +} + +void WebAttribute::assign(const WebAttribute& other) +{ + m_private = other.m_private; +} + +WebAttribute::WebAttribute(const PassRefPtr<Attribute>& other) + : m_private(other) +{ +} + +WebString WebAttribute::localName() const +{ + return WebString(m_private->localName()); +} + +WebString WebAttribute::value() const +{ + return WebString(m_private->value()); +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/WebBindings.cpp b/WebKit/chromium/src/WebBindings.cpp index 04f2f85..3aaebfd 100644 --- a/WebKit/chromium/src/WebBindings.cpp +++ b/WebKit/chromium/src/WebBindings.cpp @@ -34,9 +34,6 @@ #include "npruntime_impl.h" #include "npruntime_priv.h" -#include "../public/WebDragData.h" -#include "../public/WebRange.h" - #if USE(V8) #include "ChromiumDataObject.h" #include "ClipboardChromium.h" @@ -48,11 +45,15 @@ #include "V8DOMWrapper.h" #include "V8Event.h" #include "V8Helpers.h" +#include "V8HiddenPropertyName.h" +#include "V8NPUtils.h" #include "V8Proxy.h" #include "V8Range.h" #elif USE(JSC) #include "bridge/c/c_utility.h" #endif +#include "WebDragData.h" +#include "WebRange.h" #if USE(JAVASCRIPTCORE_BINDINGS) using JSC::Bindings::PrivateIdentifier; @@ -208,8 +209,7 @@ void WebBindings::extractIdentifierData(const NPIdentifier& identifier, const NP static v8::Local<v8::Value> getEvent(const v8::Handle<v8::Context>& context) { - static v8::Persistent<v8::String> eventSymbol(v8::Persistent<v8::String>::New(v8::String::NewSymbol("event"))); - return context->Global()->GetHiddenValue(eventSymbol); + return context->Global()->GetHiddenValue(V8HiddenPropertyName::event()); } static bool getDragDataImpl(NPObject* npobj, int* eventId, WebDragData* data) @@ -284,7 +284,7 @@ static bool getRangeImpl(NPObject* npobj, WebRange* range) { V8NPObject* v8npobject = reinterpret_cast<V8NPObject*>(npobj); v8::Handle<v8::Object> v8object(v8npobject->v8Object); - if (V8ClassIndex::RANGE != V8DOMWrapper::domWrapperType(v8object)) + if (!V8Range::info.equals(V8DOMWrapper::domWrapperType(v8object))) return false; Range* native = V8Range::toNative(v8object); @@ -323,4 +323,14 @@ bool WebBindings::getRange(NPObject* range, WebRange* webrange) #endif } +void WebBindings::pushExceptionHandler(ExceptionHandler handler, void* data) +{ + WebCore::pushExceptionHandler(handler, data); +} + +void WebBindings::popExceptionHandler() +{ + WebCore::popExceptionHandler(); +} + } // namespace WebKit diff --git a/WebKit/chromium/src/WebBlobData.cpp b/WebKit/chromium/src/WebBlobData.cpp new file mode 100644 index 0000000..4cd1d67 --- /dev/null +++ b/WebKit/chromium/src/WebBlobData.cpp @@ -0,0 +1,166 @@ +/* + * 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 "WebBlobData.h" + +#include "BlobData.h" + +using namespace WebCore; + +namespace WebKit { + +class WebBlobDataPrivate : public BlobData { +}; + +void WebBlobData::initialize() +{ + assign(BlobData::create()); +} + +void WebBlobData::reset() +{ + assign(0); +} + +size_t WebBlobData::itemCount() const +{ + ASSERT(!isNull()); + return m_private->items().size(); +} + +bool WebBlobData::itemAt(size_t index, Item& result) const +{ + ASSERT(!isNull()); + + if (index >= m_private->items().size()) + return false; + + const BlobDataItem& item = m_private->items()[index]; + result.data.reset(); + result.filePath.reset(); + result.blobURL = KURL(); + result.offset = item.offset; + result.length = item.length; + result.expectedModificationTime = item.expectedModificationTime; + + switch (item.type) { + case BlobDataItem::Data: + result.type = Item::TypeData; + result.data = item.data; + return true; + case BlobDataItem::File: + result.type = Item::TypeFile; + result.filePath = item.path; + return true; + case BlobDataItem::Blob: + result.type = Item::TypeBlob; + result.blobURL = item.url; + return true; + } + ASSERT_NOT_REACHED(); + return false; +} + +void WebBlobData::appendData(const WebCString& data) +{ + ASSERT(!isNull()); + m_private->appendData(data); +} + +void WebBlobData::appendFile(const WebString& filePath) +{ + ASSERT(!isNull()); + m_private->appendFile(filePath); +} + +void WebBlobData::appendFile(const WebString& filePath, long long offset, long long length, double expectedModificationTime) +{ + ASSERT(!isNull()); + m_private->appendFile(filePath, offset, length, expectedModificationTime); +} + +void WebBlobData::appendBlob(const WebURL& blobURL, long long offset, long long length) +{ + ASSERT(!isNull()); + m_private->appendBlob(blobURL, offset, length); +} + +WebString WebBlobData::contentType() const +{ + ASSERT(!isNull()); + return m_private->contentType(); +} + +void WebBlobData::setContentType(const WebString& contentType) +{ + ASSERT(!isNull()); + m_private->setContentType(contentType); +} + +WebString WebBlobData::contentDisposition() const +{ + ASSERT(!isNull()); + return m_private->contentDisposition(); +} + +void WebBlobData::setContentDisposition(const WebString& contentDisposition) +{ + ASSERT(!isNull()); + m_private->setContentDisposition(contentDisposition); +} + +WebBlobData::WebBlobData(const PassOwnPtr<BlobData>& data) + : m_private(0) +{ + assign(data); +} + +WebBlobData& WebBlobData::operator=(const PassOwnPtr<BlobData>& data) +{ + assign(data); + return *this; +} + +WebBlobData::operator PassOwnPtr<BlobData>() +{ + WebBlobDataPrivate* temp = m_private; + m_private = 0; + return adoptPtr(temp); +} + +void WebBlobData::assign(const PassOwnPtr<BlobData>& data) +{ + if (m_private) + delete m_private; + m_private = static_cast<WebBlobDataPrivate*>(data.leakPtr()); +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/WebBlobStorageData.cpp b/WebKit/chromium/src/WebBlobStorageData.cpp new file mode 100644 index 0000000..38a25fe --- /dev/null +++ b/WebKit/chromium/src/WebBlobStorageData.cpp @@ -0,0 +1,113 @@ +/* + * 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 "WebBlobStorageData.h" + +#include "BlobStorageData.h" + +using namespace WebCore; + +namespace WebKit { + +class WebBlobStorageDataPrivate : public BlobStorageData { +}; + +void WebBlobStorageData::reset() +{ + assign(0); +} + +size_t WebBlobStorageData::itemCount() const +{ + ASSERT(!isNull()); + return m_private->items().size(); +} + +bool WebBlobStorageData::itemAt(size_t index, WebBlobData::Item& result) const +{ + ASSERT(!isNull()); + + if (index >= m_private->items().size()) + return false; + + const BlobDataItem& item = m_private->items()[index]; + result.offset = item.offset; + result.length = item.length; + result.expectedModificationTime = item.expectedModificationTime; + if (item.type == BlobDataItem::Data) { + result.type = WebBlobData::Item::TypeData; + result.data.assign(item.data.data(), static_cast<size_t>(item.data.length())); + return true; + } else { + ASSERT(item.type == BlobDataItem::File); + result.type = WebBlobData::Item::TypeFile; + result.filePath = item.path; + return true; + } +} + +WebString WebBlobStorageData::contentType() const +{ + ASSERT(!isNull()); + return m_private->contentType(); +} + +WebString WebBlobStorageData::contentDisposition() const +{ + ASSERT(!isNull()); + return m_private->contentDisposition(); +} + +WebBlobStorageData::WebBlobStorageData(const PassRefPtr<BlobStorageData>& data) + : m_private(0) +{ + assign(data); +} + +WebBlobStorageData& WebBlobStorageData::operator=(const PassRefPtr<BlobStorageData>& data) +{ + assign(data); + return *this; +} + +WebBlobStorageData::operator PassRefPtr<BlobStorageData>() const +{ + return m_private; +} + +void WebBlobStorageData::assign(const PassRefPtr<BlobStorageData>& data) +{ + if (m_private) + m_private->deref(); + m_private = static_cast<WebBlobStorageDataPrivate*>(data.leakRef()); +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/WebCString.cpp b/WebKit/chromium/src/WebCString.cpp index 82fbac0..f81d7f4 100644 --- a/WebKit/chromium/src/WebCString.cpp +++ b/WebKit/chromium/src/WebCString.cpp @@ -31,16 +31,28 @@ #include "config.h" #include "WebCString.h" -#include "CString.h" #include "TextEncoding.h" +#include <wtf/text/CString.h> #include "WebString.h" namespace WebKit { -class WebCStringPrivate : public WebCore::CStringBuffer { +class WebCStringPrivate : public WTF::CStringBuffer { }; +int WebCString::compare(const WebCString& other) const +{ + // A null string is always less than a non null one. + if (isNull() != other.isNull()) + return isNull() ? -1 : 1; + + if (isNull()) + return 0; // Both WebStrings are null. + + return strcmp(m_private->data(), other.m_private->data()); +} + void WebCString::reset() { if (m_private) { @@ -57,8 +69,8 @@ void WebCString::assign(const WebCString& other) void WebCString::assign(const char* data, size_t length) { char* newData; - RefPtr<WebCore::CStringBuffer> buffer = - WebCore::CString::newUninitialized(length, newData).buffer(); + RefPtr<WTF::CStringBuffer> buffer = + WTF::CString::newUninitialized(length, newData).buffer(); memcpy(newData, data, length); assign(static_cast<WebCStringPrivate*>(buffer.get())); } @@ -97,20 +109,20 @@ WebCString WebCString::fromUTF16(const WebUChar* data) return fromUTF16(data, len); } -WebCString::WebCString(const WebCore::CString& s) +WebCString::WebCString(const WTF::CString& s) : m_private(static_cast<WebCStringPrivate*>(s.buffer())) { if (m_private) m_private->ref(); } -WebCString& WebCString::operator=(const WebCore::CString& s) +WebCString& WebCString::operator=(const WTF::CString& s) { assign(static_cast<WebCStringPrivate*>(s.buffer())); return *this; } -WebCString::operator WebCore::CString() const +WebCString::operator WTF::CString() const { return m_private; } diff --git a/WebKit/chromium/public/WebDevToolsMessageData.h b/WebKit/chromium/src/WebCommon.cpp index 9bf9acd..f9457fb 100644 --- a/WebKit/chromium/public/WebDevToolsMessageData.h +++ b/WebKit/chromium/src/WebCommon.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Google Inc. All rights reserved. + * 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 @@ -28,21 +28,17 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebDevToolsMessageData_h -#define WebDevToolsMessageData_h - +#include "config.h" #include "WebCommon.h" -#include "WebString.h" -#include "WebVector.h" + +#include <wtf/Assertions.h> namespace WebKit { -struct WebDevToolsMessageData { - WebString className; - WebString methodName; - WebVector<WebString> arguments; -}; +void failedAssertion(const char* file, int line, const char* function, const char* assertion) +{ + WTFReportAssertionFailure(file, line, function, assertion); + CRASH(); +} } // namespace WebKit - -#endif diff --git a/WebKit/chromium/src/WebEvent.cpp b/WebKit/chromium/src/WebDOMEvent.cpp index 8c68959..48e5268 100644 --- a/WebKit/chromium/src/WebEvent.cpp +++ b/WebKit/chromium/src/WebDOMEvent.cpp @@ -29,7 +29,7 @@ */ #include "config.h" -#include "WebEvent.h" +#include "WebDOMEvent.h" #include "Event.h" #include "Node.h" @@ -37,23 +37,23 @@ namespace WebKit { -class WebEventPrivate : public WebCore::Event { +class WebDOMEventPrivate : public WebCore::Event { }; -void WebEvent::reset() +void WebDOMEvent::reset() { assign(0); } -void WebEvent::assign(const WebEvent& other) +void WebDOMEvent::assign(const WebDOMEvent& other) { - WebEventPrivate* p = const_cast<WebEventPrivate*>(other.m_private); + WebDOMEventPrivate* p = const_cast<WebDOMEventPrivate*>(other.m_private); if (p) p->ref(); assign(p); } -void WebEvent::assign(WebEventPrivate* p) +void WebDOMEvent::assign(WebDOMEventPrivate* p) { // p is already ref'd for us by the caller if (m_private) @@ -61,156 +61,156 @@ void WebEvent::assign(WebEventPrivate* p) m_private = p; } -WebEvent::WebEvent(const WTF::PassRefPtr<WebCore::Event>& event) - : m_private(static_cast<WebEventPrivate*>(event.releaseRef())) +WebDOMEvent::WebDOMEvent(const WTF::PassRefPtr<WebCore::Event>& event) + : m_private(static_cast<WebDOMEventPrivate*>(event.releaseRef())) { } -WebString WebEvent::type() const +WebString WebDOMEvent::type() const { ASSERT(m_private); return m_private->type(); } -WebNode WebEvent::target() const +WebNode WebDOMEvent::target() const { ASSERT(m_private); return WebNode(m_private->target()->toNode()); } -WebNode WebEvent::currentTarget() const +WebNode WebDOMEvent::currentTarget() const { ASSERT(m_private); return WebNode(m_private->currentTarget()->toNode()); } -WebEvent::PhaseType WebEvent::eventPhase() const +WebDOMEvent::PhaseType WebDOMEvent::eventPhase() const { ASSERT(m_private); - return static_cast<WebEvent::PhaseType>(m_private->eventPhase()); + return static_cast<WebDOMEvent::PhaseType>(m_private->eventPhase()); } -bool WebEvent::bubbles() const +bool WebDOMEvent::bubbles() const { ASSERT(m_private); return m_private->bubbles(); } -bool WebEvent::cancelable() const +bool WebDOMEvent::cancelable() const { ASSERT(m_private); return m_private->cancelable(); } -bool WebEvent::isUIEvent() const +bool WebDOMEvent::isUIEvent() const { ASSERT(m_private); return m_private->isUIEvent(); } -bool WebEvent::isMouseEvent() const +bool WebDOMEvent::isMouseEvent() const { ASSERT(m_private); return m_private->isMouseEvent(); } -bool WebEvent::isMutationEvent() const +bool WebDOMEvent::isMutationEvent() const { ASSERT(m_private); return m_private->isMutationEvent(); } -bool WebEvent::isKeyboardEvent() const +bool WebDOMEvent::isKeyboardEvent() const { ASSERT(m_private); return m_private->isKeyboardEvent(); } -bool WebEvent::isTextEvent() const +bool WebDOMEvent::isTextEvent() const { ASSERT(m_private); return m_private->isTextEvent(); } -bool WebEvent::isCompositionEvent() const +bool WebDOMEvent::isCompositionEvent() const { ASSERT(m_private); return m_private->isCompositionEvent(); } -bool WebEvent::isDragEvent() const +bool WebDOMEvent::isDragEvent() const { ASSERT(m_private); return m_private->isDragEvent(); } -bool WebEvent::isClipboardEvent() const +bool WebDOMEvent::isClipboardEvent() const { ASSERT(m_private); return m_private->isClipboardEvent(); } -bool WebEvent::isMessageEvent() const +bool WebDOMEvent::isMessageEvent() const { ASSERT(m_private); return m_private->isMessageEvent(); } -bool WebEvent::isWheelEvent() const +bool WebDOMEvent::isWheelEvent() const { ASSERT(m_private); return m_private->isWheelEvent(); } -bool WebEvent::isBeforeTextInsertedEvent() const +bool WebDOMEvent::isBeforeTextInsertedEvent() const { ASSERT(m_private); return m_private->isBeforeTextInsertedEvent(); } -bool WebEvent::isOverflowEvent() const +bool WebDOMEvent::isOverflowEvent() const { ASSERT(m_private); return m_private->isOverflowEvent(); } -bool WebEvent::isPageTransitionEvent() const +bool WebDOMEvent::isPageTransitionEvent() const { ASSERT(m_private); return m_private->isPageTransitionEvent(); } -bool WebEvent::isPopStateEvent() const +bool WebDOMEvent::isPopStateEvent() const { ASSERT(m_private); return m_private->isPopStateEvent(); } -bool WebEvent::isProgressEvent() const +bool WebDOMEvent::isProgressEvent() const { ASSERT(m_private); return m_private->isProgressEvent(); } -bool WebEvent::isXMLHttpRequestProgressEvent() const +bool WebDOMEvent::isXMLHttpRequestProgressEvent() const { ASSERT(m_private); return m_private->isXMLHttpRequestProgressEvent(); } -bool WebEvent::isWebKitAnimationEvent() const +bool WebDOMEvent::isWebKitAnimationEvent() const { ASSERT(m_private); return m_private->isWebKitAnimationEvent(); } -bool WebEvent::isWebKitTransitionEvent() const +bool WebDOMEvent::isWebKitTransitionEvent() const { ASSERT(m_private); return m_private->isWebKitTransitionEvent(); } -bool WebEvent::isBeforeLoadEvent() const +bool WebDOMEvent::isBeforeLoadEvent() const { ASSERT(m_private); return m_private->isBeforeLoadEvent(); diff --git a/WebKit/chromium/src/WebEventListener.cpp b/WebKit/chromium/src/WebDOMEventListener.cpp index 8d9a887..93c1640 100644 --- a/WebKit/chromium/src/WebEventListener.cpp +++ b/WebKit/chromium/src/WebDOMEventListener.cpp @@ -1,64 +1,64 @@ -/*
- * 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 "WebEventListener.h"
-
-#include "WebEventListenerPrivate.h"
-
-namespace WebKit {
-
-WebEventListener::WebEventListener()
- : m_private(new WebEventListenerPrivate(this))
-{
-}
-
-WebEventListener::~WebEventListener()
-{
- m_private->webEventListenerDeleted();
- delete m_private;
-}
-
-void WebEventListener::notifyEventListenerDeleted(EventListenerWrapper* wrapper)
-{
- m_private->eventListenerDeleted(wrapper);
-}
-
-EventListenerWrapper* WebEventListener::createEventListenerWrapper(const WebString& eventType, bool useCapture, Node* node)
-{
- return m_private->createEventListenerWrapper(eventType, useCapture, node);
-}
-
-EventListenerWrapper* WebEventListener::getEventListenerWrapper(const WebString& eventType, bool useCapture, Node* node)
-{
- return m_private->getEventListenerWrapper(eventType, useCapture, node);
-}
-
-} // namespace WebKit
+/* + * 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 "WebDOMEventListener.h" + +#include "WebDOMEventListenerPrivate.h" + +namespace WebKit { + +WebDOMEventListener::WebDOMEventListener() + : m_private(new WebDOMEventListenerPrivate(this)) +{ +} + +WebDOMEventListener::~WebDOMEventListener() +{ + m_private->webDOMEventListenerDeleted(); + delete m_private; +} + +void WebDOMEventListener::notifyEventListenerDeleted(EventListenerWrapper* wrapper) +{ + m_private->eventListenerDeleted(wrapper); +} + +EventListenerWrapper* WebDOMEventListener::createEventListenerWrapper(const WebString& eventType, bool useCapture, Node* node) +{ + return m_private->createEventListenerWrapper(eventType, useCapture, node); +} + +EventListenerWrapper* WebDOMEventListener::getEventListenerWrapper(const WebString& eventType, bool useCapture, Node* node) +{ + return m_private->getEventListenerWrapper(eventType, useCapture, node); +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/WebEventListenerPrivate.cpp b/WebKit/chromium/src/WebDOMEventListenerPrivate.cpp index bd14baf..4edbeef 100644 --- a/WebKit/chromium/src/WebEventListenerPrivate.cpp +++ b/WebKit/chromium/src/WebDOMEventListenerPrivate.cpp @@ -1,87 +1,87 @@ -/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "WebEventListenerPrivate.h"
-
-#include "EventListenerWrapper.h"
-#include "WebEventListener.h"
-
-namespace WebKit {
-
-WebEventListenerPrivate::WebEventListenerPrivate(WebEventListener* webEventListener)
- : m_webEventListener(webEventListener)
-{
-}
-
-WebEventListenerPrivate::~WebEventListenerPrivate()
-{
-}
-
-EventListenerWrapper* WebEventListenerPrivate::createEventListenerWrapper(const WebString& eventType, bool useCapture, Node* node)
-{
- EventListenerWrapper* listenerWrapper = new EventListenerWrapper(m_webEventListener);
- WebEventListenerPrivate::ListenerInfo listenerInfo(eventType, useCapture, listenerWrapper, node);
- m_listenerWrappers.append(listenerInfo);
- return listenerWrapper;
-}
-
-EventListenerWrapper* WebEventListenerPrivate::getEventListenerWrapper(const WebString& eventType, bool useCapture, Node* node)
-{
- Vector<WebEventListenerPrivate::ListenerInfo>::const_iterator iter;
- for (iter = m_listenerWrappers.begin(); iter != m_listenerWrappers.end(); ++iter) {
- if (iter->node == node)
- return iter->eventListenerWrapper;
- }
- ASSERT_NOT_REACHED();
- return 0;
-}
-
-void WebEventListenerPrivate::webEventListenerDeleted()
-{
- // Notifies all WebEventListenerWrappers that we are going away so they can
- // invalidate their pointer to us.
- Vector<WebEventListenerPrivate::ListenerInfo>::const_iterator iter;
- for (iter = m_listenerWrappers.begin(); iter != m_listenerWrappers.end(); ++iter)
- iter->eventListenerWrapper->webEventListenerDeleted();
-}
-
-void WebEventListenerPrivate::eventListenerDeleted(EventListenerWrapper* eventListener)
-{
- for (size_t i = 0; i < m_listenerWrappers.size(); ++i) {
- if (m_listenerWrappers[i].eventListenerWrapper == eventListener) {
- m_listenerWrappers.remove(i);
- return;
- }
- }
- ASSERT_NOT_REACHED();
-}
-
-} // namespace WebKit
+/* + * 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 "WebDOMEventListenerPrivate.h" + +#include "EventListenerWrapper.h" +#include "WebDOMEventListener.h" + +namespace WebKit { + +WebDOMEventListenerPrivate::WebDOMEventListenerPrivate(WebDOMEventListener* webDOMEventListener) + : m_webDOMEventListener(webDOMEventListener) +{ +} + +WebDOMEventListenerPrivate::~WebDOMEventListenerPrivate() +{ +} + +EventListenerWrapper* WebDOMEventListenerPrivate::createEventListenerWrapper(const WebString& eventType, bool useCapture, Node* node) +{ + EventListenerWrapper* listenerWrapper = new EventListenerWrapper(m_webDOMEventListener); + WebDOMEventListenerPrivate::ListenerInfo listenerInfo(eventType, useCapture, listenerWrapper, node); + m_listenerWrappers.append(listenerInfo); + return listenerWrapper; +} + +EventListenerWrapper* WebDOMEventListenerPrivate::getEventListenerWrapper(const WebString& eventType, bool useCapture, Node* node) +{ + Vector<WebDOMEventListenerPrivate::ListenerInfo>::const_iterator iter; + for (iter = m_listenerWrappers.begin(); iter != m_listenerWrappers.end(); ++iter) { + if (iter->node == node) + return iter->eventListenerWrapper; + } + ASSERT_NOT_REACHED(); + return 0; +} + +void WebDOMEventListenerPrivate::webDOMEventListenerDeleted() +{ + // Notifies all WebDOMEventListenerWrappers that we are going away so they can + // invalidate their pointer to us. + Vector<WebDOMEventListenerPrivate::ListenerInfo>::const_iterator iter; + for (iter = m_listenerWrappers.begin(); iter != m_listenerWrappers.end(); ++iter) + iter->eventListenerWrapper->webDOMEventListenerDeleted(); +} + +void WebDOMEventListenerPrivate::eventListenerDeleted(EventListenerWrapper* eventListener) +{ + for (size_t i = 0; i < m_listenerWrappers.size(); ++i) { + if (m_listenerWrappers[i].eventListenerWrapper == eventListener) { + m_listenerWrappers.remove(i); + return; + } + } + ASSERT_NOT_REACHED(); +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/WebEventListenerPrivate.h b/WebKit/chromium/src/WebDOMEventListenerPrivate.h index 0ba2b5d..c86f427 100644 --- a/WebKit/chromium/src/WebEventListenerPrivate.h +++ b/WebKit/chromium/src/WebDOMEventListenerPrivate.h @@ -1,95 +1,95 @@ -/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef WebEventListenerPrivate_h
-#define WebEventListenerPrivate_h
-
-#include "WebString.h"
-
-#include <wtf/Vector.h>
-
-namespace WebCore {
-class Node;
-}
-
-using namespace WebCore;
-
-namespace WebKit {
-
-class EventListenerWrapper;
-class WebEventListener;
-
-class WebEventListenerPrivate {
-public:
- WebEventListenerPrivate(WebEventListener* webEventListener);
- ~WebEventListenerPrivate();
-
- EventListenerWrapper* createEventListenerWrapper(
- const WebString& eventType, bool useCapture, Node* node);
-
- // Gets the ListenerEventWrapper for a specific node.
- // Used by WebNode::removeEventListener().
- EventListenerWrapper* getEventListenerWrapper(
- const WebString& eventType, bool useCapture, Node* node);
-
- // Called by the WebEventListener when it is about to be deleted.
- void webEventListenerDeleted();
-
- // Called by the EventListenerWrapper when it is about to be deleted.
- void eventListenerDeleted(EventListenerWrapper* eventListener);
-
- struct ListenerInfo {
- ListenerInfo(const WebString& eventType, bool useCapture,
- EventListenerWrapper* eventListenerWrapper,
- Node* node)
- : eventType(eventType)
- , useCapture(useCapture)
- , eventListenerWrapper(eventListenerWrapper)
- , node(node)
- {
- }
-
- WebString eventType;
- bool useCapture;
- EventListenerWrapper* eventListenerWrapper;
- Node* node;
- };
-
-private:
- WebEventListener* m_webEventListener;
-
- // We keep a list of the wrapper for the WebKit EventListener, it is needed
- // to implement WebNode::removeEventListener().
- Vector<ListenerInfo> m_listenerWrappers;
-};
-
-} // namespace WebKit
-
-#endif
+/* + * 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 WebDOMEventListenerPrivate_h +#define WebDOMEventListenerPrivate_h + +#include "WebString.h" + +#include <wtf/Vector.h> + +namespace WebCore { +class Node; +} + +using namespace WebCore; + +namespace WebKit { + +class EventListenerWrapper; +class WebDOMEventListener; + +class WebDOMEventListenerPrivate { +public: + WebDOMEventListenerPrivate(WebDOMEventListener* webDOMEventListener); + ~WebDOMEventListenerPrivate(); + + EventListenerWrapper* createEventListenerWrapper( + const WebString& eventType, bool useCapture, Node* node); + + // Gets the ListenerEventWrapper for a specific node. + // Used by WebNode::removeDOMEventListener(). + EventListenerWrapper* getEventListenerWrapper( + const WebString& eventType, bool useCapture, Node* node); + + // Called by the WebDOMEventListener when it is about to be deleted. + void webDOMEventListenerDeleted(); + + // Called by the EventListenerWrapper when it is about to be deleted. + void eventListenerDeleted(EventListenerWrapper* eventListener); + + struct ListenerInfo { + ListenerInfo(const WebString& eventType, bool useCapture, + EventListenerWrapper* eventListenerWrapper, + Node* node) + : eventType(eventType) + , useCapture(useCapture) + , eventListenerWrapper(eventListenerWrapper) + , node(node) + { + } + + WebString eventType; + bool useCapture; + EventListenerWrapper* eventListenerWrapper; + Node* node; + }; + +private: + WebDOMEventListener* m_webDOMEventListener; + + // We keep a list of the wrapper for the WebKit EventListener, it is needed + // to implement WebNode::removeEventListener(). + Vector<ListenerInfo> m_listenerWrappers; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/src/WebDOMMouseEvent.cpp b/WebKit/chromium/src/WebDOMMouseEvent.cpp new file mode 100644 index 0000000..bfeae37 --- /dev/null +++ b/WebKit/chromium/src/WebDOMMouseEvent.cpp @@ -0,0 +1,110 @@ +/* + * 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 "WebDOMMouseEvent.h" + +#include "MouseEvent.h" + +using namespace WebCore; + +namespace WebKit { + +int WebDOMMouseEvent::screenX() const +{ + return constUnwrap<MouseEvent>()->screenX(); +} + +int WebDOMMouseEvent::screenY() const +{ + return constUnwrap<MouseEvent>()->screenY(); +} + +int WebDOMMouseEvent::clientX() const +{ + return constUnwrap<MouseEvent>()->clientX(); +} + +int WebDOMMouseEvent::clientY() const +{ + return constUnwrap<MouseEvent>()->clientY(); +} + +int WebDOMMouseEvent::layerX() const +{ + return constUnwrap<MouseEvent>()->layerX(); +} + +int WebDOMMouseEvent::layerY() const +{ + return constUnwrap<MouseEvent>()->layerY(); +} + +int WebDOMMouseEvent::offsetX() const +{ + return constUnwrap<MouseEvent>()->offsetX(); +} + +int WebDOMMouseEvent::offsetY() const +{ + return constUnwrap<MouseEvent>()->offsetY(); +} + +int WebDOMMouseEvent::pageX() const +{ + return constUnwrap<MouseEvent>()->pageX(); +} + +int WebDOMMouseEvent::pageY() const +{ + return constUnwrap<MouseEvent>()->pageY(); +} + +int WebDOMMouseEvent::x() const +{ + return constUnwrap<MouseEvent>()->x(); +} + +int WebDOMMouseEvent::y() const +{ + return constUnwrap<MouseEvent>()->y(); +} + +int WebDOMMouseEvent::button() const +{ + return constUnwrap<MouseEvent>()->button(); +} + +bool WebDOMMouseEvent::buttonDown() const +{ + return constUnwrap<MouseEvent>()->buttonDown(); +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/WebDOMMutationEvent.cpp b/WebKit/chromium/src/WebDOMMutationEvent.cpp new file mode 100644 index 0000000..8a6e592 --- /dev/null +++ b/WebKit/chromium/src/WebDOMMutationEvent.cpp @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebDOMMutationEvent.h" + +#include "MutationEvent.h" + +using namespace WebCore; + +namespace WebKit { + +WebNode WebDOMMutationEvent::relatedNode() const +{ + return WebNode(constUnwrap<MutationEvent>()->relatedNode()); +} + +WebString WebDOMMutationEvent::prevValue() const +{ + return WebString(constUnwrap<MutationEvent>()->prevValue()); +} + +WebString WebDOMMutationEvent::newValue() const +{ + return WebString(constUnwrap<MutationEvent>()->newValue()); +} + +WebString WebDOMMutationEvent::attrName() const +{ + return WebString(constUnwrap<MutationEvent>()->attrName()); +} + +WebDOMMutationEvent::AttrChangeType WebDOMMutationEvent::attrChange() const +{ + return static_cast<AttrChangeType>(constUnwrap<MutationEvent>()->attrChange()); +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/WebDOMStringList.cpp b/WebKit/chromium/src/WebDOMStringList.cpp new file mode 100644 index 0000000..dc82331 --- /dev/null +++ b/WebKit/chromium/src/WebDOMStringList.cpp @@ -0,0 +1,89 @@ +/* + * 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 "WebDOMStringList.h" + +#include "DOMStringList.h" +#include "WebString.h" + +using namespace WebCore; + +namespace WebKit { + +WebDOMStringList::WebDOMStringList() +{ + m_private = WebCore::DOMStringList::create(); +} + +void WebDOMStringList::reset() +{ + m_private.reset(); +} + +void WebDOMStringList::assign(const WebDOMStringList& other) +{ + m_private = other.m_private; +} + +void WebDOMStringList::append(const WebString& string) +{ + m_private->append(string); +} + +unsigned WebDOMStringList::length() const +{ + if (m_private.isNull()) + return 0; + return m_private->length(); +} + +WebString WebDOMStringList::item(unsigned index) const +{ + return m_private->item(index); +} + +WebDOMStringList::WebDOMStringList(const WTF::PassRefPtr<WebCore::DOMStringList>& item) + : m_private(item) +{ +} + +WebDOMStringList& WebDOMStringList::operator=(const WTF::PassRefPtr<WebCore::DOMStringList>& item) +{ + m_private = item; + return *this; +} + +WebDOMStringList::operator WTF::PassRefPtr<WebCore::DOMStringList>() const +{ + return m_private.get(); +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/WebDataSourceImpl.cpp b/WebKit/chromium/src/WebDataSourceImpl.cpp index 5a315cf..ac2a02d 100644 --- a/WebKit/chromium/src/WebDataSourceImpl.cpp +++ b/WebKit/chromium/src/WebDataSourceImpl.cpp @@ -156,7 +156,7 @@ void WebDataSourceImpl::setNextPluginLoadObserver(PassOwnPtr<WebPluginLoadObserv { // This call should always be followed up with the creation of a // WebDataSourceImpl, so we should never leak this object. - m_nextPluginLoadObserver = observer.release(); + m_nextPluginLoadObserver = observer.leakPtr(); } WebDataSourceImpl::WebDataSourceImpl(const ResourceRequest& request, const SubstituteData& data) diff --git a/WebKit/chromium/src/WebDataSourceImpl.h b/WebKit/chromium/src/WebDataSourceImpl.h index f868e95..be32217 100644 --- a/WebKit/chromium/src/WebDataSourceImpl.h +++ b/WebKit/chromium/src/WebDataSourceImpl.h @@ -31,17 +31,12 @@ #ifndef WebDataSourceImpl_h #define WebDataSourceImpl_h -// FIXME: This relative path is a temporary hack to support using this -// header from webkit/glue. -#include "../public/WebDataSource.h" - #include "DocumentLoader.h" #include "KURL.h" - +#include "WebDataSource.h" #include "WebPluginLoadObserver.h" #include "WrappedResourceRequest.h" #include "WrappedResourceResponse.h" - #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> #include <wtf/Vector.h> diff --git a/WebKit/chromium/src/WebDatabase.cpp b/WebKit/chromium/src/WebDatabase.cpp index 50b9220..561d7c4 100644 --- a/WebKit/chromium/src/WebDatabase.cpp +++ b/WebKit/chromium/src/WebDatabase.cpp @@ -31,12 +31,8 @@ #include "config.h" #include "WebDatabase.h" -#include "Database.h" -#include "DatabaseTask.h" -#include "DatabaseThread.h" +#include "AbstractDatabase.h" #include "DatabaseTracker.h" -#include "Document.h" -#include "KURL.h" #include "QuotaTracker.h" #include "SecurityOrigin.h" #include "WebDatabaseObserver.h" @@ -44,50 +40,46 @@ #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> +#if !ENABLE(DATABASE) +namespace WebCore { +class AbstractDatabase { +public: + String stringIdentifier() const { return String(); } + String displayName() const { return String(); } + unsigned long long estimatedSize() const { return 0; } + SecurityOrigin* securityOrigin() const { return 0; } +}; +} +#endif // !ENABLE(DATABASE) + using namespace WebCore; namespace WebKit { static WebDatabaseObserver* databaseObserver = 0; -class WebDatabasePrivate : public Database { -}; - -void WebDatabase::reset() -{ - assign(0); -} - -void WebDatabase::assign(const WebDatabase& other) -{ - WebDatabasePrivate* d = const_cast<WebDatabasePrivate*>(other.m_private); - if (d) - d->ref(); - assign(d); -} - WebString WebDatabase::name() const { - ASSERT(m_private); - return m_private->stringIdentifier(); + ASSERT(m_database); + return m_database->stringIdentifier(); } WebString WebDatabase::displayName() const { - ASSERT(m_private); - return m_private->displayName(); + ASSERT(m_database); + return m_database->displayName(); } unsigned long WebDatabase::estimatedSize() const { - ASSERT(m_private); - return m_private->estimatedSize(); + ASSERT(m_database); + return m_database->estimatedSize(); } WebSecurityOrigin WebDatabase::securityOrigin() const { - ASSERT(m_private); - return WebSecurityOrigin(m_private->securityOrigin()); + ASSERT(m_database); + return WebSecurityOrigin(m_database->securityOrigin()); } void WebDatabase::setObserver(WebDatabaseObserver* observer) @@ -104,48 +96,26 @@ void WebDatabase::updateDatabaseSize( const WebString& originIdentifier, const WebString& databaseName, unsigned long long databaseSize, unsigned long long spaceAvailable) { +#if ENABLE(DATABASE) WebCore::QuotaTracker::instance().updateDatabaseSizeAndSpaceAvailableToOrigin( originIdentifier, databaseName, databaseSize, spaceAvailable); +#endif // ENABLE(DATABASE) } void WebDatabase::closeDatabaseImmediately(const WebString& originIdentifier, const WebString& databaseName) { - HashSet<RefPtr<Database> > databaseHandles; - PassRefPtr<SecurityOrigin> originPrp(*WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifier)); - RefPtr<SecurityOrigin> origin = originPrp; +#if ENABLE(DATABASE) + HashSet<RefPtr<AbstractDatabase> > databaseHandles; + RefPtr<SecurityOrigin> origin = SecurityOrigin::createFromDatabaseIdentifier(originIdentifier); DatabaseTracker::tracker().getOpenDatabases(origin.get(), databaseName, &databaseHandles); - for (HashSet<RefPtr<Database> >::iterator it = databaseHandles.begin(); it != databaseHandles.end(); ++it) { - Database* database = it->get(); - DatabaseThread* databaseThread = database->scriptExecutionContext()->databaseThread(); - if (databaseThread && !databaseThread->terminationRequested()) { - database->stop(); - databaseThread->scheduleTask(DatabaseCloseTask::create(database, 0)); - } - } -} - -WebDatabase::WebDatabase(const WTF::PassRefPtr<Database>& database) - : m_private(static_cast<WebDatabasePrivate*>(database.releaseRef())) -{ -} - -WebDatabase& WebDatabase::operator=(const WTF::PassRefPtr<Database>& database) -{ - assign(static_cast<WebDatabasePrivate*>(database.releaseRef())); - return *this; -} - -WebDatabase::operator WTF::PassRefPtr<Database>() const -{ - return PassRefPtr<Database>(const_cast<WebDatabasePrivate*>(m_private)); + for (HashSet<RefPtr<AbstractDatabase> >::iterator it = databaseHandles.begin(); it != databaseHandles.end(); ++it) + it->get()->closeImmediately(); +#endif // ENABLE(DATABASE) } -void WebDatabase::assign(WebDatabasePrivate* d) +WebDatabase::WebDatabase(const AbstractDatabase* database) + : m_database(database) { - // d is already ref'd for us by the caller - if (m_private) - m_private->deref(); - m_private = d; } } // namespace WebKit diff --git a/WebKit/chromium/src/WebDevToolsAgentImpl.cpp b/WebKit/chromium/src/WebDevToolsAgentImpl.cpp index 9ce35b4..fbb06f8 100644 --- a/WebKit/chromium/src/WebDevToolsAgentImpl.cpp +++ b/WebKit/chromium/src/WebDevToolsAgentImpl.cpp @@ -31,105 +31,146 @@ #include "config.h" #include "WebDevToolsAgentImpl.h" -#include "BoundObject.h" #include "DebuggerAgentImpl.h" #include "DebuggerAgentManager.h" -#include "Document.h" -#include "EventListener.h" #include "InjectedScriptHost.h" -#include "InspectorBackend.h" +#include "InspectorBackendDispatcher.h" #include "InspectorController.h" -#include "InspectorFrontend.h" -#include "InspectorResource.h" -#include "Node.h" +#include "InspectorValues.h" #include "Page.h" +#include "PageGroup.h" #include "PlatformString.h" -#include "ProfilerAgentImpl.h" #include "ResourceError.h" #include "ResourceRequest.h" #include "ResourceResponse.h" -#include "ScriptObject.h" -#include "ScriptState.h" -#include "ScriptValue.h" +#include "ScriptDebugServer.h" #include "V8Binding.h" -#include "V8InspectorBackend.h" #include "V8Proxy.h" #include "V8Utilities.h" #include "WebDataSource.h" #include "WebDevToolsAgentClient.h" -#include "WebDevToolsMessageData.h" #include "WebFrameImpl.h" +#include "WebRect.h" #include "WebString.h" #include "WebURL.h" #include "WebURLError.h" #include "WebURLRequest.h" #include "WebURLResponse.h" +#include "WebViewClient.h" #include "WebViewImpl.h" #include <wtf/Noncopyable.h> #include <wtf/OwnPtr.h> -using WebCore::Document; using WebCore::DocumentLoader; using WebCore::FrameLoader; using WebCore::InjectedScriptHost; -using WebCore::InspectorBackend; +using WebCore::InspectorArray; +using WebCore::InspectorBackendDispatcher; using WebCore::InspectorController; -using WebCore::InspectorFrontend; -using WebCore::InspectorResource; +using WebCore::InspectorObject; +using WebCore::InspectorValue; using WebCore::Node; using WebCore::Page; using WebCore::ResourceError; using WebCore::ResourceRequest; using WebCore::ResourceResponse; -using WebCore::SafeAllocation; -using WebCore::ScriptObject; -using WebCore::ScriptState; -using WebCore::ScriptValue; -using WebCore::String; -using WebCore::V8ClassIndex; +using WTF::String; using WebCore::V8DOMWrapper; -using WebCore::V8InspectorBackend; using WebCore::V8Proxy; namespace WebKit { namespace { -void InspectorBackendWeakReferenceCallback(v8::Persistent<v8::Value> object, void* parameter) -{ - InspectorBackend* backend = static_cast<InspectorBackend*>(parameter); - backend->deref(); - object.Dispose(); -} +static const char kFrontendConnectedFeatureName[] = "frontend-connected"; +static const char kResourceTrackingFeatureName[] = "resource-tracking"; +static const char kTimelineFeatureName[] = "timeline-profiler"; +static const char kApuAgentFeatureName[] = "apu-agent"; -void SetApuAgentEnabledInUtilityContext(v8::Handle<v8::Context> context, bool enabled) -{ - v8::HandleScope handleScope; - v8::Context::Scope contextScope(context); - v8::Handle<v8::Object> dispatcher = v8::Local<v8::Object>::Cast( - context->Global()->Get(v8::String::New("ApuAgentDispatcher"))); - if (dispatcher.IsEmpty()) - return; - dispatcher->Set(v8::String::New("enabled"), v8::Boolean::New(enabled)); -} +class ClientMessageLoopAdapter : public WebCore::ScriptDebugServer::ClientMessageLoop { +public: + static void ensureClientMessageLoopCreated(WebDevToolsAgentClient* client) + { + if (s_instance) + return; + s_instance = new ClientMessageLoopAdapter(client->createClientMessageLoop()); + WebCore::ScriptDebugServer::shared().setClientMessageLoop(s_instance); + } -// TODO(pfeldman): Make this public in WebDevToolsAgent API. -static const char kApuAgentFeatureName[] = "apu-agent"; + static void inspectedViewClosed(WebViewImpl* view) + { + if (s_instance) + s_instance->m_frozenViews.remove(view); + } -// Keep these in sync with the ones in inject_dispatch.js. -static const char kTimelineFeatureName[] = "timeline-profiler"; -static const char kResourceTrackingFeatureName[] = "resource-tracking"; + static void didNavigate() + { + // Release render thread if necessary. + if (s_instance && s_instance->m_running) + WebCore::ScriptDebugServer::shared().continueProgram(); + } -class IORPCDelegate : public DevToolsRPC::Delegate, public Noncopyable { -public: - IORPCDelegate() { } - virtual ~IORPCDelegate() { } - virtual void sendRpcMessage(const WebDevToolsMessageData& data) +private: + ClientMessageLoopAdapter(PassOwnPtr<WebKit::WebDevToolsAgentClient::WebKitClientMessageLoop> messageLoop) + : m_running(false) + , m_messageLoop(messageLoop) { } + + + virtual void run(Page* page) + { + if (m_running) + return; + m_running = true; + + Vector<WebViewImpl*> views; + + // 1. Disable input events. + HashSet<Page*>::const_iterator end = page->group().pages().end(); + for (HashSet<Page*>::const_iterator it = page->group().pages().begin(); it != end; ++it) { + WebViewImpl* view = WebViewImpl::fromPage(*it); + m_frozenViews.add(view); + views.append(view); + view->setIgnoreInputEvents(true); + } + + // 2. Disable active objects + WebView::willEnterModalLoop(); + + // 3. Process messages until quitNow is called. + m_messageLoop->run(); + + // 4. Resume active objects + WebView::didExitModalLoop(); + + // 5. Resume input events. + for (Vector<WebViewImpl*>::iterator it = views.begin(); it != views.end(); ++it) { + if (m_frozenViews.contains(*it)) { + // The view was not closed during the dispatch. + (*it)->setIgnoreInputEvents(false); + } + } + + // 6. All views have been resumed, clear the set. + m_frozenViews.clear(); + + m_running = false; + } + + virtual void quitNow() { - WebDevToolsAgentClient::sendMessageToFrontendOnIOThread(data); + m_messageLoop->quitNow(); } + + bool m_running; + OwnPtr<WebKit::WebDevToolsAgentClient::WebKitClientMessageLoop> m_messageLoop; + typedef HashSet<WebViewImpl*> FrozenViewsSet; + FrozenViewsSet m_frozenViews; + static ClientMessageLoopAdapter* s_instance; + }; +ClientMessageLoopAdapter* ClientMessageLoopAdapter::s_instance = 0; + } // namespace WebDevToolsAgentImpl::WebDevToolsAgentImpl( @@ -142,103 +183,60 @@ WebDevToolsAgentImpl::WebDevToolsAgentImpl( , m_resourceTrackingWasEnabled(false) , m_attached(false) { - m_debuggerAgentDelegateStub.set(new DebuggerAgentDelegateStub(this)); - m_toolsAgentDelegateStub.set(new ToolsAgentDelegateStub(this)); - m_apuAgentDelegateStub.set(new ApuAgentDelegateStub(this)); + DebuggerAgentManager::setExposeV8DebuggerProtocol( + client->exposeV8DebuggerProtocol()); } WebDevToolsAgentImpl::~WebDevToolsAgentImpl() { DebuggerAgentManager::onWebViewClosed(m_webViewImpl); - disposeUtilityContext(); -} - -void WebDevToolsAgentImpl::disposeUtilityContext() -{ - if (!m_utilityContext.IsEmpty()) { - m_utilityContext.Dispose(); - m_utilityContext.Clear(); - } -} - -void WebDevToolsAgentImpl::unhideResourcesPanelIfNecessary() -{ - InspectorController* ic = m_webViewImpl->page()->inspectorController(); - ic->ensureResourceTrackingSettingsLoaded(); - String command = String::format("[\"setResourcesPanelEnabled\", %s]", - ic->resourceTrackingEnabled() ? "true" : "false"); - m_toolsAgentDelegateStub->dispatchOnClient(command); + ClientMessageLoopAdapter::inspectedViewClosed(m_webViewImpl); } void WebDevToolsAgentImpl::attach() { if (m_attached) return; - m_debuggerAgentImpl.set( - new DebuggerAgentImpl(m_webViewImpl, - m_debuggerAgentDelegateStub.get(), - this)); - resetInspectorFrontendProxy(); - unhideResourcesPanelIfNecessary(); - // Allow controller to send messages to the frontend. - InspectorController* ic = inspectorController(); - { // TODO(yurys): the source should have already been pushed by the frontend. - v8::HandleScope scope; - v8::Context::Scope contextScope(m_utilityContext); - v8::Handle<v8::Value> constructorValue = m_utilityContext->Global()->Get( - v8::String::New("injectedScriptConstructor")); - if (constructorValue->IsFunction()) { - String source = WebCore::toWebCoreString(constructorValue); - ic->injectedScriptHost()->setInjectedScriptSource("(" + source + ")"); - } - } + if (!m_client->exposeV8DebuggerProtocol()) + ClientMessageLoopAdapter::ensureClientMessageLoopCreated(m_client); - ic->setWindowVisible(true, false); + m_debuggerAgentImpl.set( + new DebuggerAgentImpl(m_webViewImpl, this, m_client)); + WebCString debuggerScriptJs = m_client->debuggerScriptSource(); + WebCore::ScriptDebugServer::shared().setDebuggerScriptSource( + WTF::String(debuggerScriptJs.data(), debuggerScriptJs.length())); m_attached = true; } void WebDevToolsAgentImpl::detach() { // Prevent controller from sending messages to the frontend. - InspectorController* ic = m_webViewImpl->page()->inspectorController(); + InspectorController* ic = inspectorController(); + ic->disconnectFrontend(); ic->hideHighlight(); ic->close(); - disposeUtilityContext(); m_debuggerAgentImpl.set(0); m_attached = false; m_apuAgentEnabled = false; } -void WebDevToolsAgentImpl::didNavigate() +void WebDevToolsAgentImpl::frontendLoaded() { - DebuggerAgentManager::onNavigate(); + inspectorController()->connectFrontend(); + // We know that by this time injected script has already been pushed to the backend. + m_client->runtimePropertyChanged(kFrontendConnectedFeatureName, inspectorController()->injectedScriptHost()->injectedScriptSource()); } -void WebDevToolsAgentImpl::didCommitProvisionalLoad(WebFrameImpl* webframe, bool isNewNavigation) +void WebDevToolsAgentImpl::didNavigate() { - if (!m_attached) - return; - WebDataSource* ds = webframe->dataSource(); - const WebURLRequest& request = ds->request(); - WebURL url = ds->hasUnreachableURL() ? - ds->unreachableURL() : - request.url(); - if (!webframe->parent()) { - resetInspectorFrontendProxy(); - m_toolsAgentDelegateStub->frameNavigate(WebCore::KURL(url).string()); - SetApuAgentEnabledInUtilityContext(m_utilityContext, m_apuAgentEnabled); - unhideResourcesPanelIfNecessary(); - } + ClientMessageLoopAdapter::didNavigate(); + DebuggerAgentManager::onNavigate(); } void WebDevToolsAgentImpl::didClearWindowObject(WebFrameImpl* webframe) { DebuggerAgentManager::setHostId(webframe, m_hostId); - if (m_attached) { - // Push context id into the client if it is already attached. - m_debuggerAgentDelegateStub->setContextId(m_hostId); - } } void WebDevToolsAgentImpl::forceRepaint() @@ -246,35 +244,9 @@ void WebDevToolsAgentImpl::forceRepaint() m_client->forceRepaint(); } -void WebDevToolsAgentImpl::dispatchOnInspectorController(int callId, const String& functionName, const String& jsonArgs) +void WebDevToolsAgentImpl::dispatchOnInspectorBackend(const WebString& message) { - String result; - String exception; - result = m_debuggerAgentImpl->executeUtilityFunction(m_utilityContext, callId, - "InspectorControllerDispatcher", functionName, jsonArgs, false /* is sync */, &exception); - m_toolsAgentDelegateStub->didDispatchOn(callId, result, exception); -} - -void WebDevToolsAgentImpl::dispatchOnInjectedScript(int callId, int injectedScriptId, const String& functionName, const String& jsonArgs, bool async) -{ - inspectorController()->inspectorBackend()->dispatchOnInjectedScript( - callId, - injectedScriptId, - functionName, - jsonArgs, - async); -} - -void WebDevToolsAgentImpl::dispatchMessageFromFrontend(const WebDevToolsMessageData& data) -{ - if (ToolsAgentDispatch::dispatch(this, data)) - return; - - if (!m_attached) - return; - - if (m_debuggerAgentImpl.get() && DebuggerAgentDispatch::dispatch(m_debuggerAgentImpl.get(), data)) - return; + inspectorController()->inspectorBackendDispatcher()->dispatch(message); } void WebDevToolsAgentImpl::inspectElementAt(const WebPoint& point) @@ -282,113 +254,31 @@ void WebDevToolsAgentImpl::inspectElementAt(const WebPoint& point) m_webViewImpl->inspectElementAt(point); } -void WebDevToolsAgentImpl::setRuntimeFeatureEnabled(const WebString& feature, bool enabled) +void WebDevToolsAgentImpl::setRuntimeProperty(const WebString& name, const WebString& value) { - if (feature == kApuAgentFeatureName) - setApuAgentEnabled(enabled); - else if (feature == kTimelineFeatureName) - setTimelineProfilingEnabled(enabled); - else if (feature == kResourceTrackingFeatureName) { - InspectorController* ic = m_webViewImpl->page()->inspectorController(); - if (enabled) + if (name == kApuAgentFeatureName) + setApuAgentEnabled(value == "true"); + else if (name == kTimelineFeatureName) + setTimelineProfilingEnabled(value == "true"); + else if (name == kResourceTrackingFeatureName) { + InspectorController* ic = inspectorController(); + if (value == "true") ic->enableResourceTracking(false /* not sticky */, false /* no reload */); else ic->disableResourceTracking(false /* not sticky */); + } else if (name == kFrontendConnectedFeatureName && !inspectorController()->hasFrontend()) { + inspectorController()->injectedScriptHost()->setInjectedScriptSource(value); + frontendLoaded(); } } -void WebDevToolsAgentImpl::sendRpcMessage(const WebDevToolsMessageData& data) -{ - m_client->sendMessageToFrontend(data); -} - -void WebDevToolsAgentImpl::compileUtilityScripts() -{ - v8::HandleScope handleScope; - v8::Context::Scope contextScope(m_utilityContext); - // Inject javascript into the context. - WebCString injectedScriptJs = m_client->injectedScriptSource(); - v8::Script::Compile(v8::String::New( - injectedScriptJs.data(), - injectedScriptJs.length()))->Run(); - WebCString injectDispatchJs = m_client->injectedScriptDispatcherSource(); - v8::Script::Compile(v8::String::New( - injectDispatchJs.data(), - injectDispatchJs.length()))->Run(); -} - -void WebDevToolsAgentImpl::initDevToolsAgentHost() -{ - BoundObject devtoolsAgentHost(m_utilityContext, this, "DevToolsAgentHost"); - devtoolsAgentHost.addProtoFunction( - "dispatch", - WebDevToolsAgentImpl::jsDispatchOnClient); - devtoolsAgentHost.addProtoFunction( - "dispatchToApu", - WebDevToolsAgentImpl::jsDispatchToApu); - devtoolsAgentHost.addProtoFunction( - "evaluateOnSelf", - WebDevToolsAgentImpl::jsEvaluateOnSelf); - devtoolsAgentHost.addProtoFunction( - "runtimeFeatureStateChanged", - WebDevToolsAgentImpl::jsOnRuntimeFeatureStateChanged); - devtoolsAgentHost.build(); - - v8::HandleScope scope; - v8::Context::Scope utilityScope(m_utilityContext); - // Call custom code to create inspector backend wrapper in the utility context - // instead of calling V8DOMWrapper::convertToV8Object that would create the - // wrapper in the Page main frame context. - v8::Handle<v8::Object> backendWrapper = createInspectorBackendV8Wrapper(); - if (backendWrapper.IsEmpty()) - return; - m_utilityContext->Global()->Set(v8::String::New("InspectorBackend"), backendWrapper); -} - -v8::Local<v8::Object> WebDevToolsAgentImpl::createInspectorBackendV8Wrapper() -{ - V8ClassIndex::V8WrapperType descriptorType = V8ClassIndex::INSPECTORBACKEND; - v8::Handle<v8::Function> function = V8InspectorBackend::GetTemplate()->GetFunction(); - if (function.IsEmpty()) { - // Return if allocation failed. - return v8::Local<v8::Object>(); - } - v8::Local<v8::Object> instance = SafeAllocation::newInstance(function); - if (instance.IsEmpty()) { - // Avoid setting the wrapper if allocation failed. - return v8::Local<v8::Object>(); - } - InspectorBackend* backend = m_webViewImpl->page()->inspectorController()->inspectorBackend(); - V8DOMWrapper::setDOMWrapper(instance, V8ClassIndex::ToInt(descriptorType), backend); - // Create a weak reference to the v8 wrapper of InspectorBackend to deref - // InspectorBackend when the wrapper is garbage collected. - backend->ref(); - v8::Persistent<v8::Object> weakHandle = v8::Persistent<v8::Object>::New(instance); - weakHandle.MakeWeak(backend, &InspectorBackendWeakReferenceCallback); - return instance; -} - -void WebDevToolsAgentImpl::resetInspectorFrontendProxy() -{ - disposeUtilityContext(); - m_debuggerAgentImpl->createUtilityContext(m_webViewImpl->page()->mainFrame(), &m_utilityContext); - compileUtilityScripts(); - initDevToolsAgentHost(); - - v8::HandleScope scope; - v8::Context::Scope contextScope(m_utilityContext); - ScriptState* state = ScriptState::forContext( - v8::Local<v8::Context>::New(m_utilityContext)); - InspectorController* ic = inspectorController(); - ic->setFrontendProxyObject(state, ScriptObject(state, m_utilityContext->Global())); -} - void WebDevToolsAgentImpl::setApuAgentEnabled(bool enabled) { m_apuAgentEnabled = enabled; - SetApuAgentEnabledInUtilityContext(m_utilityContext, enabled); - InspectorController* ic = m_webViewImpl->page()->inspectorController(); + InspectorController* ic = inspectorController(); if (enabled) { + if (!ic->hasFrontend()) + frontendLoaded(); m_resourceTrackingWasEnabled = ic->resourceTrackingEnabled(); ic->startTimelineProfiler(); if (!m_resourceTrackingWasEnabled) { @@ -403,67 +293,11 @@ void WebDevToolsAgentImpl::setApuAgentEnabled(bool enabled) ic->disableResourceTracking(false); m_resourceTrackingWasEnabled = false; } - m_client->runtimeFeatureStateChanged( + m_client->runtimePropertyChanged( kApuAgentFeatureName, - enabled); -} - -// static -v8::Handle<v8::Value> WebDevToolsAgentImpl::jsDispatchOnClient(const v8::Arguments& args) -{ - v8::TryCatch exceptionCatcher; - String message = WebCore::toWebCoreStringWithNullCheck(args[0]); - if (message.isEmpty() || exceptionCatcher.HasCaught()) - return v8::Undefined(); - WebDevToolsAgentImpl* agent = static_cast<WebDevToolsAgentImpl*>(v8::External::Cast(*args.Data())->Value()); - agent->m_toolsAgentDelegateStub->dispatchOnClient(message); - return v8::Undefined(); -} - -// static -v8::Handle<v8::Value> WebDevToolsAgentImpl::jsDispatchToApu(const v8::Arguments& args) -{ - v8::TryCatch exceptionCatcher; - String message = WebCore::toWebCoreStringWithNullCheck(args[0]); - if (message.isEmpty() || exceptionCatcher.HasCaught()) - return v8::Undefined(); - WebDevToolsAgentImpl* agent = static_cast<WebDevToolsAgentImpl*>( - v8::External::Cast(*args.Data())->Value()); - agent->m_apuAgentDelegateStub->dispatchToApu(message); - return v8::Undefined(); + enabled ? String("true") : String("false")); } -// static -v8::Handle<v8::Value> WebDevToolsAgentImpl::jsEvaluateOnSelf(const v8::Arguments& args) -{ - String code; - { - v8::TryCatch exceptionCatcher; - code = WebCore::toWebCoreStringWithNullCheck(args[0]); - if (code.isEmpty() || exceptionCatcher.HasCaught()) - return v8::Undefined(); - } - WebDevToolsAgentImpl* agent = static_cast<WebDevToolsAgentImpl*>(v8::External::Cast(*args.Data())->Value()); - v8::Context::Scope(agent->m_utilityContext); - V8Proxy* proxy = V8Proxy::retrieve(agent->m_webViewImpl->page()->mainFrame()); - v8::Local<v8::Value> result = proxy->runScript(v8::Script::Compile(v8::String::New(code.utf8().data())), true); - return result; -} - -// static -v8::Handle<v8::Value> WebDevToolsAgentImpl::jsOnRuntimeFeatureStateChanged(const v8::Arguments& args) -{ - v8::TryCatch exceptionCatcher; - String feature = WebCore::toWebCoreStringWithNullCheck(args[0]); - bool enabled = args[1]->ToBoolean()->Value(); - if (feature.isEmpty() || exceptionCatcher.HasCaught()) - return v8::Undefined(); - WebDevToolsAgentImpl* agent = static_cast<WebDevToolsAgentImpl*>(v8::External::Cast(*args.Data())->Value()); - agent->m_client->runtimeFeatureStateChanged(feature, enabled); - return v8::Undefined(); -} - - WebCore::InspectorController* WebDevToolsAgentImpl::inspectorController() { if (Page* page = m_webViewImpl->page()) @@ -486,10 +320,10 @@ void WebDevToolsAgentImpl::identifierForInitialRequest( } } -void WebDevToolsAgentImpl::willSendRequest(unsigned long resourceId, const WebURLRequest& request) +void WebDevToolsAgentImpl::willSendRequest(unsigned long resourceId, WebURLRequest& request) { if (InspectorController* ic = inspectorController()) - ic->willSendRequest(resourceId, request.toResourceRequest(), ResourceResponse()); + ic->willSendRequest(resourceId, request.toMutableResourceRequest(), ResourceResponse()); } void WebDevToolsAgentImpl::didReceiveData(unsigned long resourceId, int length) @@ -517,6 +351,82 @@ void WebDevToolsAgentImpl::didFailLoading(unsigned long resourceId, const WebURL ic->didFailLoading(resourceId, resourceError); } +void WebDevToolsAgentImpl::inspectorDestroyed() +{ + // Our lifetime is bound to the WebViewImpl. +} + +void WebDevToolsAgentImpl::openInspectorFrontend(InspectorController*) +{ +} + +void WebDevToolsAgentImpl::highlight(Node* node) +{ + // InspectorController does the actuall tracking of the highlighted node + // and the drawing of the highlight. Here we just make sure to invalidate + // the rects of the old and new nodes. + hideHighlight(); +} + +void WebDevToolsAgentImpl::hideHighlight() +{ + // FIXME: able to invalidate a smaller rect. + // FIXME: Is it important to just invalidate the rect of the node region + // given that this is not on a critical codepath? In order to do so, we'd + // have to take scrolling into account. + const WebSize& size = m_webViewImpl->size(); + WebRect damagedRect(0, 0, size.width, size.height); + if (m_webViewImpl->client()) + m_webViewImpl->client()->didInvalidateRect(damagedRect); +} + +void WebDevToolsAgentImpl::populateSetting(const String& key, String* value) +{ + WebString string; + m_webViewImpl->inspectorSetting(key, &string); + *value = string; +} + +void WebDevToolsAgentImpl::storeSetting(const String& key, const String& value) +{ + m_webViewImpl->setInspectorSetting(key, value); +} + +bool WebDevToolsAgentImpl::sendMessageToFrontend(const WTF::String& message) +{ + WebDevToolsAgentImpl* devToolsAgent = static_cast<WebDevToolsAgentImpl*>(m_webViewImpl->devToolsAgent()); + if (!devToolsAgent) + return false; + + if (devToolsAgent->m_apuAgentEnabled) { + m_client->sendDispatchToAPU(message); + return true; + } + + m_client->sendMessageToInspectorFrontend(message); + return true; +} + +void WebDevToolsAgentImpl::resourceTrackingWasEnabled() +{ + m_client->runtimePropertyChanged(kResourceTrackingFeatureName, "true"); +} + +void WebDevToolsAgentImpl::resourceTrackingWasDisabled() +{ + m_client->runtimePropertyChanged(kResourceTrackingFeatureName, "false"); +} + +void WebDevToolsAgentImpl::timelineProfilerWasStarted() +{ + m_client->runtimePropertyChanged(kTimelineFeatureName, "true"); +} + +void WebDevToolsAgentImpl::timelineProfilerWasStopped() +{ + m_client->runtimePropertyChanged(kTimelineFeatureName, "false"); +} + void WebDevToolsAgentImpl::evaluateInWebInspector(long callId, const WebString& script) { InspectorController* ic = inspectorController(); @@ -532,11 +442,6 @@ void WebDevToolsAgentImpl::setTimelineProfilingEnabled(bool enabled) ic->stopTimelineProfiler(); } -WebDevToolsAgent* WebDevToolsAgent::create(WebView* webview, WebDevToolsAgentClient* client) -{ - return new WebDevToolsAgentImpl(static_cast<WebViewImpl*>(webview), client); -} - void WebDevToolsAgent::executeDebuggerCommand(const WebString& command, int callerId) { DebuggerAgentManager::executeDebuggerCommand(command, callerId); @@ -547,17 +452,46 @@ void WebDevToolsAgent::debuggerPauseScript() DebuggerAgentManager::pauseScript(); } -void WebDevToolsAgent::setMessageLoopDispatchHandler(MessageLoopDispatchHandler handler) +void WebDevToolsAgent::interruptAndDispatch(MessageDescriptor* d) { - DebuggerAgentManager::setMessageLoopDispatchHandler(handler); + 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::dispatchMessageFromFrontendOnIOThread(const WebDevToolsMessageData& data) +bool WebDevToolsAgent::shouldInterruptForMessage(const WebString& message) { - IORPCDelegate transport; - ProfilerAgentDelegateStub stub(&transport); - ProfilerAgentImpl agent(&stub); - return ProfilerAgentDispatch::dispatch(&agent, data); + 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); } } // namespace WebKit diff --git a/WebKit/chromium/src/WebDevToolsAgentImpl.h b/WebKit/chromium/src/WebDevToolsAgentImpl.h index 1f81c6d..da584fb 100644 --- a/WebKit/chromium/src/WebDevToolsAgentImpl.h +++ b/WebKit/chromium/src/WebDevToolsAgentImpl.h @@ -31,24 +31,23 @@ #ifndef WebDevToolsAgentImpl_h #define WebDevToolsAgentImpl_h -#include "APUAgentDelegate.h" -#include "DevToolsRPC.h" -#include "ToolsAgent.h" +#include "InspectorClient.h" + #include "WebDevToolsAgentPrivate.h" #include <v8.h> +#include <wtf/Forward.h> #include <wtf/OwnPtr.h> namespace WebCore { class Document; +class InspectorClient; class InspectorController; class Node; -class String; } namespace WebKit { -class DebuggerAgentDelegateStub; class DebuggerAgentImpl; class WebDevToolsAgentClient; class WebFrame; @@ -61,79 +60,61 @@ struct WebURLError; struct WebDevToolsMessageData; class WebDevToolsAgentImpl : public WebDevToolsAgentPrivate, - public ToolsAgent, - public DevToolsRPC::Delegate { + public WebCore::InspectorClient { public: WebDevToolsAgentImpl(WebViewImpl* webViewImpl, WebDevToolsAgentClient* client); virtual ~WebDevToolsAgentImpl(); - // ToolsAgent implementation. - virtual void dispatchOnInspectorController(int callId, const WebCore::String& functionName, const WebCore::String& jsonArgs); - virtual void dispatchOnInjectedScript(int callId, int injectedScriptId, const WebCore::String& functionName, const WebCore::String& jsonArgs, bool async); - // WebDevToolsAgentPrivate implementation. virtual void didClearWindowObject(WebFrameImpl* frame); - virtual void didCommitProvisionalLoad(WebFrameImpl* frame, bool isNewNavigation); // WebDevToolsAgent implementation. virtual void attach(); virtual void detach(); + virtual void frontendLoaded(); virtual void didNavigate(); - virtual void dispatchMessageFromFrontend(const WebDevToolsMessageData& data); + virtual void dispatchOnInspectorBackend(const WebString& message); 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&); - virtual void willSendRequest(unsigned long, const WebURLRequest&); + virtual void willSendRequest(unsigned long, WebURLRequest&); virtual void didReceiveData(unsigned long, int length); virtual void didReceiveResponse(unsigned long, const WebURLResponse&); virtual void didFinishLoading(unsigned long); virtual void didFailLoading(unsigned long, const WebURLError&); - // DevToolsRPC::Delegate implementation. - virtual void sendRpcMessage(const WebDevToolsMessageData& data); + // InspectorClient implementation. + virtual void inspectorDestroyed(); + virtual void openInspectorFrontend(WebCore::InspectorController*); + virtual void highlight(WebCore::Node*); + virtual void hideHighlight(); + virtual void populateSetting(const WTF::String& key, WTF::String* value); + virtual void storeSetting(const WTF::String& key, const WTF::String& value); + virtual void resourceTrackingWasEnabled(); + virtual void resourceTrackingWasDisabled(); + virtual void timelineProfilerWasStarted(); + virtual void timelineProfilerWasStopped(); + virtual bool sendMessageToFrontend(const WTF::String&); void forceRepaint(); int hostId() { return m_hostId; } private: - static v8::Handle<v8::Value> jsDispatchOnClient(const v8::Arguments& args); - static v8::Handle<v8::Value> jsDispatchToApu(const v8::Arguments& args); - static v8::Handle<v8::Value> jsEvaluateOnSelf(const v8::Arguments& args); - static v8::Handle<v8::Value> jsOnRuntimeFeatureStateChanged(const v8::Arguments& args); - - void disposeUtilityContext(); - void unhideResourcesPanelIfNecessary(); - - void compileUtilityScripts(); - void initDevToolsAgentHost(); - void resetInspectorFrontendProxy(); void setApuAgentEnabled(bool enabled); WebCore::InspectorController* inspectorController(); - // Creates InspectorBackend v8 wrapper in the utility context so that it's - // methods prototype is Function.protoype object from the utility context. - // Otherwise some useful methods defined on Function.prototype(such as bind) - // are missing for InspectorController native methods. - v8::Local<v8::Object> createInspectorBackendV8Wrapper(); - int m_hostId; WebDevToolsAgentClient* m_client; WebViewImpl* m_webViewImpl; - OwnPtr<DebuggerAgentDelegateStub> m_debuggerAgentDelegateStub; - OwnPtr<ToolsAgentDelegateStub> m_toolsAgentDelegateStub; OwnPtr<DebuggerAgentImpl> m_debuggerAgentImpl; - OwnPtr<ApuAgentDelegateStub> m_apuAgentDelegateStub; bool m_apuAgentEnabled; bool m_resourceTrackingWasEnabled; bool m_attached; - // TODO(pfeldman): This should not be needed once GC styles issue is fixed - // for matching rules. - v8::Persistent<v8::Context> m_utilityContext; }; } // namespace WebKit diff --git a/WebKit/chromium/src/WebDevToolsAgentPrivate.h b/WebKit/chromium/src/WebDevToolsAgentPrivate.h index 0c1c67e..7038a5e 100644 --- a/WebKit/chromium/src/WebDevToolsAgentPrivate.h +++ b/WebKit/chromium/src/WebDevToolsAgentPrivate.h @@ -31,9 +31,7 @@ #ifndef WebDevToolsAgentPrivate_h #define WebDevToolsAgentPrivate_h -// FIXME: This relative path is a temporary hack to support using this -// header from webkit/glue. -#include "../public/WebDevToolsAgent.h" +#include "WebDevToolsAgent.h" namespace WebKit { class WebFrameImpl; @@ -45,11 +43,6 @@ public: // The window object for the frame has been cleared of any extra properties // that may have been set by script from the previously loaded document. virtual void didClearWindowObject(WebFrameImpl*) = 0; - - // The provisional datasource is now committed. The first part of the - // response body has been received, and the encoding of the response body - // is known. - virtual void didCommitProvisionalLoad(WebFrameImpl*, bool isNewNavigation) = 0; }; } // namespace WebKit diff --git a/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp b/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp index 89fa6e7..905bc6d 100644 --- a/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp +++ b/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp @@ -35,25 +35,23 @@ #include "ContextMenuController.h" #include "ContextMenuItem.h" #include "DOMWindow.h" -#include "DebuggerAgent.h" -#include "DevToolsRPCJS.h" #include "Document.h" #include "Event.h" #include "Frame.h" #include "InspectorBackend.h" #include "InspectorController.h" +#include "InspectorFrontendClientImpl.h" #include "InspectorFrontendHost.h" #include "Node.h" #include "Page.h" #include "Pasteboard.h" #include "PlatformString.h" -#include "ProfilerAgent.h" #include "SecurityOrigin.h" #include "Settings.h" -#include "ToolsAgent.h" #include "V8Binding.h" #include "V8DOMWrapper.h" #include "V8InspectorFrontendHost.h" +#include "V8MouseEvent.h" #include "V8Node.h" #include "V8Proxy.h" #include "V8Utilities.h" @@ -76,10 +74,6 @@ static v8::Local<v8::String> ToV8String(const String& s) return v8::String::New(reinterpret_cast<const uint16_t*>(s.characters()), s.length()); } -DEFINE_RPC_JS_BOUND_OBJ(DebuggerAgent, DEBUGGER_AGENT_STRUCT, DebuggerAgentDelegate, DEBUGGER_AGENT_DELEGATE_STRUCT) -DEFINE_RPC_JS_BOUND_OBJ(ProfilerAgent, PROFILER_AGENT_STRUCT, ProfilerAgentDelegate, PROFILER_AGENT_DELEGATE_STRUCT) -DEFINE_RPC_JS_BOUND_OBJ(ToolsAgent, TOOLS_AGENT_STRUCT, ToolsAgentDelegate, TOOLS_AGENT_DELEGATE_STRUCT) - WebDevToolsFrontend* WebDevToolsFrontend::create( WebView* view, WebDevToolsFrontendClient* client, @@ -100,296 +94,37 @@ WebDevToolsFrontendImpl::WebDevToolsFrontendImpl( , m_applicationLocale(applicationLocale) , m_loaded(false) { - WebFrameImpl* frame = m_webViewImpl->mainFrameImpl(); - v8::HandleScope scope; - v8::Handle<v8::Context> frameContext = V8Proxy::context(frame->frame()); - - m_debuggerAgentObj.set(new JSDebuggerAgentBoundObj(this, frameContext, "RemoteDebuggerAgent")); - m_profilerAgentObj.set(new JSProfilerAgentBoundObj(this, frameContext, "RemoteProfilerAgent")); - m_toolsAgentObj.set(new JSToolsAgentBoundObj(this, frameContext, "RemoteToolsAgent")); - - // Debugger commands should be sent using special method. - BoundObject debuggerCommandExecutorObj(frameContext, this, "RemoteDebuggerCommandExecutor"); - debuggerCommandExecutorObj.addProtoFunction( - "DebuggerCommand", - WebDevToolsFrontendImpl::jsDebuggerCommand); - debuggerCommandExecutorObj.addProtoFunction( - "DebuggerPauseScript", - WebDevToolsFrontendImpl::jsDebuggerPauseScript); - debuggerCommandExecutorObj.build(); + InspectorController* ic = m_webViewImpl->page()->inspectorController(); + ic->setInspectorFrontendClient(new InspectorFrontendClientImpl(m_webViewImpl->page(), m_client, this)); - BoundObject devToolsHost(frameContext, this, "InspectorFrontendHost"); - devToolsHost.addProtoFunction( - "loaded", - WebDevToolsFrontendImpl::jsLoaded); - devToolsHost.addProtoFunction( - "platform", - WebDevToolsFrontendImpl::jsPlatform); - devToolsHost.addProtoFunction( - "port", - WebDevToolsFrontendImpl::jsPort); - devToolsHost.addProtoFunction( - "copyText", - WebDevToolsFrontendImpl::jsCopyText); - devToolsHost.addProtoFunction( - "activateWindow", - WebDevToolsFrontendImpl::jsActivateWindow); - devToolsHost.addProtoFunction( - "closeWindow", - WebDevToolsFrontendImpl::jsCloseWindow); - devToolsHost.addProtoFunction( - "attach", - WebDevToolsFrontendImpl::jsDockWindow); - devToolsHost.addProtoFunction( - "detach", - WebDevToolsFrontendImpl::jsUndockWindow); - devToolsHost.addProtoFunction( - "localizedStringsURL", - WebDevToolsFrontendImpl::jsLocalizedStringsURL); - devToolsHost.addProtoFunction( - "hiddenPanels", - WebDevToolsFrontendImpl::jsHiddenPanels); - devToolsHost.addProtoFunction( - "setting", - WebDevToolsFrontendImpl::jsSetting); - devToolsHost.addProtoFunction( - "setSetting", - WebDevToolsFrontendImpl::jsSetSetting); - devToolsHost.addProtoFunction( - "windowUnloading", - WebDevToolsFrontendImpl::jsWindowUnloading); - devToolsHost.addProtoFunction( - "showContextMenu", - WebDevToolsFrontendImpl::jsShowContextMenu); - devToolsHost.build(); + // 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()); } WebDevToolsFrontendImpl::~WebDevToolsFrontendImpl() { - if (m_menuProvider) - m_menuProvider->disconnect(); } -void WebDevToolsFrontendImpl::dispatchMessageFromAgent(const WebDevToolsMessageData& data) -{ - Vector<String> v; - v.append(data.className); - v.append(data.methodName); - for (size_t i = 0; i < data.arguments.size(); i++) - v.append(data.arguments[i]); - if (!m_loaded) { - m_pendingIncomingMessages.append(v); - return; - } - executeScript(v); -} - -void WebDevToolsFrontendImpl::executeScript(const Vector<String>& v) +void WebDevToolsFrontendImpl::dispatchOnInspectorFrontend(const WebString& message) { WebFrameImpl* frame = m_webViewImpl->mainFrameImpl(); 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; - for (size_t i = 0; i < v.size(); i++) - args.append(ToV8String(v.at(i))); + args.append(ToV8String(message)); + v8::TryCatch tryCatch; + tryCatch.SetVerbose(true); function->Call(frameContext->Global(), args.size(), args.data()); } -void WebDevToolsFrontendImpl::dispatchOnWebInspector(const String& methodName, const String& param) -{ - WebFrameImpl* frame = m_webViewImpl->mainFrameImpl(); - v8::HandleScope scope; - v8::Handle<v8::Context> frameContext = V8Proxy::context(frame->frame()); - v8::Context::Scope contextScope(frameContext); - - v8::Handle<v8::Value> webInspector = frameContext->Global()->Get(v8::String::New("WebInspector")); - ASSERT(webInspector->IsObject()); - v8::Handle<v8::Object> webInspectorObj = v8::Handle<v8::Object>::Cast(webInspector); - - v8::Handle<v8::Value> method = webInspectorObj->Get(ToV8String(methodName)); - ASSERT(method->IsFunction()); - v8::Handle<v8::Function> methodFunc = v8::Handle<v8::Function>::Cast(method); - v8::Handle<v8::Value> args[] = { - ToV8String(param) - }; - methodFunc->Call(frameContext->Global(), 1, args); -} - -void WebDevToolsFrontendImpl::sendRpcMessage(const WebDevToolsMessageData& data) -{ - m_client->sendMessageToAgent(data); -} - -void WebDevToolsFrontendImpl::contextMenuItemSelected(ContextMenuItem* item) -{ - int itemNumber = item->action() - ContextMenuItemBaseCustomTag; - dispatchOnWebInspector("contextMenuItemSelected", String::number(itemNumber)); -} - -void WebDevToolsFrontendImpl::contextMenuCleared() -{ - dispatchOnWebInspector("contextMenuCleared", ""); -} - -v8::Handle<v8::Value> WebDevToolsFrontendImpl::jsLoaded(const v8::Arguments& args) -{ - WebDevToolsFrontendImpl* frontend = static_cast<WebDevToolsFrontendImpl*>(v8::External::Cast(*args.Data())->Value()); - frontend->m_loaded = true; - - // Grant the devtools page the ability to have source view iframes. - Page* page = V8Proxy::retrieveFrameForEnteredContext()->page(); - SecurityOrigin* origin = page->mainFrame()->domWindow()->securityOrigin(); - origin->grantUniversalAccess(); - - for (Vector<Vector<String> >::iterator it = frontend->m_pendingIncomingMessages.begin(); - it != frontend->m_pendingIncomingMessages.end(); - ++it) { - frontend->executeScript(*it); - } - frontend->m_pendingIncomingMessages.clear(); - return v8::Undefined(); -} - -// static -v8::Handle<v8::Value> WebDevToolsFrontendImpl::jsPlatform(const v8::Arguments& args) -{ -#if defined(OS_MACOSX) - return v8String("mac"); -#elif defined(OS_LINUX) - return v8String("linux"); -#elif defined(OS_WIN) - return v8String("windows"); -#else - return v8String("unknown"); -#endif -} - -v8::Handle<v8::Value> WebDevToolsFrontendImpl::jsPort(const v8::Arguments& args) -{ - return v8::Undefined(); -} - -v8::Handle<v8::Value> WebDevToolsFrontendImpl::jsCopyText(const v8::Arguments& args) -{ - String text = WebCore::toWebCoreStringWithNullCheck(args[0]); - Pasteboard::generalPasteboard()->writePlainText(text); - return v8::Undefined(); -} - -v8::Handle<v8::Value> WebDevToolsFrontendImpl::jsActivateWindow(const v8::Arguments& args) +void WebDevToolsFrontendImpl::frontendLoaded() { - WebDevToolsFrontendImpl* frontend = static_cast<WebDevToolsFrontendImpl*>(v8::External::Cast(*args.Data())->Value()); - frontend->m_client->activateWindow(); - return v8::Undefined(); -} - -v8::Handle<v8::Value> WebDevToolsFrontendImpl::jsCloseWindow(const v8::Arguments& args) -{ - WebDevToolsFrontendImpl* frontend = static_cast<WebDevToolsFrontendImpl*>(v8::External::Cast(*args.Data())->Value()); - frontend->m_client->closeWindow(); - return v8::Undefined(); -} - -v8::Handle<v8::Value> WebDevToolsFrontendImpl::jsDockWindow(const v8::Arguments& args) -{ - WebDevToolsFrontendImpl* frontend = static_cast<WebDevToolsFrontendImpl*>(v8::External::Cast(*args.Data())->Value()); - frontend->m_client->dockWindow(); - return v8::Undefined(); -} - -v8::Handle<v8::Value> WebDevToolsFrontendImpl::jsUndockWindow(const v8::Arguments& args) -{ - WebDevToolsFrontendImpl* frontend = static_cast<WebDevToolsFrontendImpl*>(v8::External::Cast(*args.Data())->Value()); - frontend->m_client->undockWindow(); - return v8::Undefined(); -} - -v8::Handle<v8::Value> WebDevToolsFrontendImpl::jsLocalizedStringsURL(const v8::Arguments& args) -{ - return v8::Undefined(); -} - -v8::Handle<v8::Value> WebDevToolsFrontendImpl::jsHiddenPanels(const v8::Arguments& args) -{ - return v8String(""); -} - -v8::Handle<v8::Value> WebDevToolsFrontendImpl::jsDebuggerCommand(const v8::Arguments& args) -{ - WebDevToolsFrontendImpl* frontend = static_cast<WebDevToolsFrontendImpl*>(v8::External::Cast(*args.Data())->Value()); - WebString command = WebCore::toWebCoreStringWithNullCheck(args[0]); - frontend->m_client->sendDebuggerCommandToAgent(command); - return v8::Undefined(); -} - -v8::Handle<v8::Value> WebDevToolsFrontendImpl::jsSetting(const v8::Arguments& args) -{ - return v8::Undefined(); -} - -v8::Handle<v8::Value> WebDevToolsFrontendImpl::jsSetSetting(const v8::Arguments& args) -{ - return v8::Undefined(); -} - -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(); -} - -v8::Handle<v8::Value> WebDevToolsFrontendImpl::jsWindowUnloading(const v8::Arguments& args) -{ - // TODO(pfeldman): Implement this. - return v8::Undefined(); -} - -v8::Handle<v8::Value> WebDevToolsFrontendImpl::jsShowContextMenu(const v8::Arguments& args) -{ - if (args.Length() < 2) - return v8::Undefined(); - - v8::Local<v8::Object> eventWrapper = v8::Local<v8::Object>::Cast(args[0]); - if (V8DOMWrapper::domWrapperType(eventWrapper) != V8ClassIndex::MOUSEEVENT) - return v8::Undefined(); - - Event* event = V8Event::toNative(eventWrapper); - if (!args[1]->IsArray()) - return v8::Undefined(); - - v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(args[1]); - Vector<ContextMenuItem*> items; - - for (size_t i = 0; i < array->Length(); ++i) { - v8::Local<v8::Object> item = v8::Local<v8::Object>::Cast(array->Get(v8::Integer::New(i))); - v8::Local<v8::Value> label = item->Get(v8::String::New("label")); - v8::Local<v8::Value> id = item->Get(v8::String::New("id")); - if (label->IsUndefined() || id->IsUndefined()) { - items.append(new ContextMenuItem(SeparatorType, - ContextMenuItemTagNoAction, - String())); - } else { - ContextMenuAction typedId = static_cast<ContextMenuAction>( - ContextMenuItemBaseCustomTag + id->ToInt32()->Value()); - items.append(new ContextMenuItem(ActionType, - typedId, - toWebCoreStringWithNullCheck(label))); - } - } - - WebDevToolsFrontendImpl* frontend = static_cast<WebDevToolsFrontendImpl*>(v8::External::Cast(*args.Data())->Value()); - - frontend->m_menuProvider = MenuProvider::create(frontend, items); - - ContextMenuController* menuController = frontend->m_webViewImpl->page()->contextMenuController(); - menuController->showContextMenu(event, frontend->m_menuProvider); - - return v8::Undefined(); + m_client->sendFrontendLoaded(); } } // namespace WebKit diff --git a/WebKit/chromium/src/WebDevToolsFrontendImpl.h b/WebKit/chromium/src/WebDevToolsFrontendImpl.h index 62b34da..bde906f 100644 --- a/WebKit/chromium/src/WebDevToolsFrontendImpl.h +++ b/WebKit/chromium/src/WebDevToolsFrontendImpl.h @@ -31,11 +31,10 @@ #ifndef WebDevToolsFrontendImpl_h #define WebDevToolsFrontendImpl_h -#include "ContextMenu.h" -#include "ContextMenuProvider.h" -#include "DevToolsRPC.h" +#include "PlatformString.h" #include "WebDevToolsFrontend.h" #include <v8.h> +#include <wtf/Forward.h> #include <wtf/HashMap.h> #include <wtf/Noncopyable.h> #include <wtf/OwnPtr.h> @@ -46,20 +45,17 @@ namespace WebCore { class ContextMenuItem; class Node; class Page; -class String; } namespace WebKit { -class JSDebuggerAgentBoundObj; -class JSProfilerAgentBoundObj; -class JSToolsAgentBoundObj; class WebDevToolsClientDelegate; class WebViewImpl; struct WebDevToolsMessageData; +using WTF::String; + class WebDevToolsFrontendImpl : public WebKit::WebDevToolsFrontend - , public DevToolsRPC::Delegate , public Noncopyable { public: WebDevToolsFrontendImpl( @@ -68,92 +64,16 @@ public: const String& applicationLocale); virtual ~WebDevToolsFrontendImpl(); - // DevToolsRPC::Delegate implementation. - virtual void sendRpcMessage(const WebKit::WebDevToolsMessageData& data); - // WebDevToolsFrontend implementation. - virtual void dispatchMessageFromAgent(const WebKit::WebDevToolsMessageData& data); - -private: - class MenuProvider : public WebCore::ContextMenuProvider { - public: - static PassRefPtr<MenuProvider> create(WebDevToolsFrontendImpl* frontendHost, const Vector<WebCore::ContextMenuItem*>& items) - { - return adoptRef(new MenuProvider(frontendHost, items)); - } - - virtual ~MenuProvider() - { - contextMenuCleared(); - } - - void disconnect() - { - m_frontendHost = 0; - } - - virtual void populateContextMenu(WebCore::ContextMenu* menu) - { - for (size_t i = 0; i < m_items.size(); ++i) - menu->appendItem(*m_items[i]); - } + virtual void dispatchOnInspectorFrontend(const WebString& message); - virtual void contextMenuItemSelected(WebCore::ContextMenuItem* item) - { - if (m_frontendHost) - m_frontendHost->contextMenuItemSelected(item); - } - - virtual void contextMenuCleared() - { - if (m_frontendHost) - m_frontendHost->contextMenuCleared(); - deleteAllValues(m_items); - m_items.clear(); - } - - private: - MenuProvider(WebDevToolsFrontendImpl* frontendHost, const Vector<WebCore::ContextMenuItem*>& items) - : m_frontendHost(frontendHost) - , m_items(items) { } - WebDevToolsFrontendImpl* m_frontendHost; - Vector<WebCore::ContextMenuItem*> m_items; - }; - - void executeScript(const Vector<String>& v); - void dispatchOnWebInspector(const String& method, const String& param); - - // friend class MenuSelectionHandler; - void contextMenuItemSelected(WebCore::ContextMenuItem* menuItem); - void contextMenuCleared(); - - static v8::Handle<v8::Value> jsLoaded(const v8::Arguments& args); - static v8::Handle<v8::Value> jsPlatform(const v8::Arguments& args); - static v8::Handle<v8::Value> jsPort(const v8::Arguments& args); - static v8::Handle<v8::Value> jsCopyText(const v8::Arguments& args); - - static v8::Handle<v8::Value> jsActivateWindow(const v8::Arguments& args); - static v8::Handle<v8::Value> jsCloseWindow(const v8::Arguments& args); - static v8::Handle<v8::Value> jsDockWindow(const v8::Arguments& args); - static v8::Handle<v8::Value> jsUndockWindow(const v8::Arguments& args); - static v8::Handle<v8::Value> jsLocalizedStringsURL(const v8::Arguments& args); - static v8::Handle<v8::Value> jsHiddenPanels(const v8::Arguments& args); - static v8::Handle<v8::Value> jsDebuggerCommand(const v8::Arguments& args); - static v8::Handle<v8::Value> jsSetting(const v8::Arguments& args); - static v8::Handle<v8::Value> jsSetSetting(const v8::Arguments& args); - static v8::Handle<v8::Value> jsDebuggerPauseScript(const v8::Arguments& args); - static v8::Handle<v8::Value> jsWindowUnloading(const v8::Arguments& args); - static v8::Handle<v8::Value> jsShowContextMenu(const v8::Arguments& args); + void frontendLoaded(); +private: WebKit::WebViewImpl* m_webViewImpl; WebKit::WebDevToolsFrontendClient* m_client; String m_applicationLocale; - OwnPtr<JSDebuggerAgentBoundObj> m_debuggerAgentObj; - OwnPtr<JSProfilerAgentBoundObj> m_profilerAgentObj; - OwnPtr<JSToolsAgentBoundObj> m_toolsAgentObj; bool m_loaded; - Vector<Vector<String> > m_pendingIncomingMessages; - RefPtr<MenuProvider> m_menuProvider; }; } // namespace WebKit diff --git a/WebKit/chromium/src/WebDeviceOrientation.cpp b/WebKit/chromium/src/WebDeviceOrientation.cpp new file mode 100644 index 0000000..47f6bd1 --- /dev/null +++ b/WebKit/chromium/src/WebDeviceOrientation.cpp @@ -0,0 +1,86 @@ +/* + * 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 "WebDeviceOrientation.h" + +#include "DeviceOrientation.h" +#include <wtf/PassRefPtr.h> + +namespace WebKit { + +WebDeviceOrientation::WebDeviceOrientation(const PassRefPtr<WebCore::DeviceOrientation>& orientation) +{ + if (!orientation) { + m_isNull = true; + m_canProvideAlpha = false; + m_alpha = 0; + m_canProvideBeta = false; + m_beta = 0; + m_canProvideGamma = false; + m_gamma = 0; + return; + } + + m_isNull = false; + m_canProvideAlpha = orientation->canProvideAlpha(); + m_alpha = orientation->alpha(); + m_canProvideBeta = orientation->canProvideBeta(); + m_beta = orientation->beta(); + m_canProvideGamma = orientation->canProvideGamma(); + m_gamma = orientation->gamma(); +} + +WebDeviceOrientation& WebDeviceOrientation::operator=(const PassRefPtr<WebCore::DeviceOrientation>& orientation) +{ + if (!orientation) { + m_isNull = true; + m_canProvideAlpha = false; + m_alpha = 0; + m_canProvideBeta = false; + m_beta = 0; + m_canProvideGamma = false; + m_gamma = 0; + return *this; + } + + m_isNull = false; + m_canProvideAlpha = orientation->canProvideAlpha(); + m_alpha = orientation->alpha(); + m_canProvideBeta = orientation->canProvideBeta(); + m_beta = orientation->beta(); + m_canProvideGamma = orientation->canProvideGamma(); + m_gamma = orientation->gamma(); + return *this; +} + +WebDeviceOrientation::operator PassRefPtr<WebCore::DeviceOrientation>() const +{ + if (m_isNull) + return 0; + return WebCore::DeviceOrientation::create(m_canProvideAlpha, m_alpha, m_canProvideBeta, m_beta, m_canProvideGamma, m_gamma); +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/WebDeviceOrientationClientMock.cpp b/WebKit/chromium/src/WebDeviceOrientationClientMock.cpp new file mode 100644 index 0000000..4011d12 --- /dev/null +++ b/WebKit/chromium/src/WebDeviceOrientationClientMock.cpp @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 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 "WebDeviceOrientationClientMock.h" + +#include "DeviceOrientationClientMock.h" +#include "WebDeviceOrientation.h" +#include "WebDeviceOrientationController.h" + +namespace WebKit { + +void WebDeviceOrientationClientMock::setController(WebDeviceOrientationController* controller) +{ + m_clientMock->setController(controller->controller()); +} + +void WebDeviceOrientationClientMock::startUpdating() +{ + m_clientMock->startUpdating(); +} + +void WebDeviceOrientationClientMock::stopUpdating() +{ + m_clientMock->stopUpdating(); +} + +WebDeviceOrientation WebDeviceOrientationClientMock::lastOrientation() const +{ + return WebDeviceOrientation(m_clientMock->lastOrientation()); +} + +void WebDeviceOrientationClientMock::setOrientation(WebDeviceOrientation& orientation) +{ + m_clientMock->setOrientation(orientation); +} + +void WebDeviceOrientationClientMock::initialize() +{ + m_clientMock = new WebCore::DeviceOrientationClientMock(); +} + +void WebDeviceOrientationClientMock::reset() +{ + delete m_clientMock; + m_clientMock = 0; +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/WebDeviceOrientationController.cpp b/WebKit/chromium/src/WebDeviceOrientationController.cpp new file mode 100644 index 0000000..aa9249f --- /dev/null +++ b/WebKit/chromium/src/WebDeviceOrientationController.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 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 "WebDeviceOrientationController.h" + +#include "DeviceOrientation.h" +#include "DeviceOrientationController.h" +#include "WebDeviceOrientation.h" +#include <wtf/PassRefPtr.h> + +namespace WebKit { + +void WebDeviceOrientationController::didChangeDeviceOrientation(const WebDeviceOrientation& orientation) +{ + PassRefPtr<WebCore::DeviceOrientation> deviceOrientation(orientation); + m_controller->didChangeDeviceOrientation(deviceOrientation.get()); +} + +WebCore::DeviceOrientationController* WebDeviceOrientationController::controller() const +{ + return m_controller; +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/WebDocument.cpp b/WebKit/chromium/src/WebDocument.cpp index 84f3004..a983bf7 100644 --- a/WebKit/chromium/src/WebDocument.cpp +++ b/WebKit/chromium/src/WebDocument.cpp @@ -32,7 +32,7 @@ #include "WebDocument.h" #include "Document.h" -#include "DocumentLoader.h" +#include "DocumentType.h" #include "Element.h" #include "HTMLAllCollection.h" #include "HTMLBodyElement.h" @@ -41,9 +41,11 @@ #include "HTMLHeadElement.h" #include "NodeList.h" +#include "WebDocumentType.h" #include "WebElement.h" #include "WebFrameImpl.h" #include "WebNodeCollection.h" +#include "WebNodeList.h" #include "WebURL.h" #include <wtf/PassRefPtr.h> @@ -52,30 +54,24 @@ using namespace WebCore; namespace WebKit { -WebDocument::WebDocument(const PassRefPtr<Document>& elem) - : WebNode(elem.releaseRef()) -{ -} - -WebDocument& WebDocument::operator=(const PassRefPtr<Document>& elem) +WebFrame* WebDocument::frame() const { - WebNode::assign(elem.releaseRef()); - return *this; + return WebFrameImpl::fromFrame(constUnwrap<Document>()->frame()); } -WebDocument::operator PassRefPtr<Document>() const -{ - return PassRefPtr<Document>(static_cast<Document*>(m_private)); +bool WebDocument::isHTMLDocument() const +{ + return constUnwrap<Document>()->isHTMLDocument(); } -WebFrame* WebDocument::frame() const +bool WebDocument::isXHTMLDocument() const { - return WebFrameImpl::fromFrame(constUnwrap<Document>()->frame()); + return constUnwrap<Document>()->isXHTMLDocument(); } -bool WebDocument::isHTMLDocument() const +bool WebDocument::isPluginDocument() const { - return constUnwrap<Document>()->isHTMLDocument(); + return constUnwrap<Document>()->isPluginDocument(); } WebURL WebDocument::baseURL() const @@ -83,6 +79,11 @@ WebURL WebDocument::baseURL() const return constUnwrap<Document>()->baseURL(); } +WebURL WebDocument::firstPartyForCookies() const +{ + return constUnwrap<Document>()->firstPartyForCookies(); +} + WebElement WebDocument::documentElement() const { return WebElement(constUnwrap<Document>()->documentElement()); @@ -98,6 +99,11 @@ WebElement WebDocument::head() return WebElement(unwrap<Document>()->head()); } +WebString WebDocument::title() const +{ + return WebString(constUnwrap<Document>()->title()); +} + WebNodeCollection WebDocument::all() { return WebNodeCollection(unwrap<Document>()->all()); @@ -113,38 +119,30 @@ WebElement WebDocument::getElementById(const WebString& id) const return WebElement(constUnwrap<Document>()->getElementById(id)); } -WebString WebDocument::applicationID() const +WebNode WebDocument::focusedNode() const { - const char* kChromeApplicationHeader = "x-chrome-application"; - - // First check if the document's response included a header indicating the - // application it should go with. - const Document* document = constUnwrap<Document>(); - Frame* frame = document->frame(); - if (!frame) - return WebString(); + return WebNode(constUnwrap<Document>()->focusedNode()); +} - DocumentLoader* loader = frame->loader()->documentLoader(); - if (!loader) - return WebString(); +WebDocumentType WebDocument::doctype() const +{ + return WebDocumentType(constUnwrap<Document>()->doctype()); +} - WebString headerValue = - loader->response().httpHeaderField(kChromeApplicationHeader); - if (!headerValue.isEmpty()) - return headerValue; +WebDocument::WebDocument(const PassRefPtr<Document>& elem) + : WebNode(elem) +{ +} - // Otherwise, fall back to looking for the meta tag. - RefPtr<NodeList> metaTags = - const_cast<Document*>(document)->getElementsByTagName("meta"); - for (unsigned i = 0; i < metaTags->length(); ++i) { - Element* element = static_cast<Element*>(metaTags->item(i)); - if (element->getAttribute("http-equiv").lower() == - kChromeApplicationHeader) { - return element->getAttribute("value"); - } - } +WebDocument& WebDocument::operator=(const PassRefPtr<Document>& elem) +{ + m_private = elem; + return *this; +} - return WebString(); +WebDocument::operator PassRefPtr<Document>() const +{ + return static_cast<Document*>(m_private.get()); } } // namespace WebKit diff --git a/WebKit/chromium/src/WebDocumentType.cpp b/WebKit/chromium/src/WebDocumentType.cpp new file mode 100644 index 0000000..bbf28e7 --- /dev/null +++ b/WebKit/chromium/src/WebDocumentType.cpp @@ -0,0 +1,64 @@ +/* + * 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 "WebDocumentType.h" + +#include "DocumentType.h" +#include "WebString.h" + +#include <wtf/PassRefPtr.h> + +using namespace WebCore; + +namespace WebKit { + +WebString WebDocumentType::name() const +{ + return WebString(constUnwrap<DocumentType>()->name()); +} + +WebDocumentType::WebDocumentType(const PassRefPtr<DocumentType>& elem) + : WebNode(elem) +{ +} + +WebDocumentType& WebDocumentType::operator=(const PassRefPtr<DocumentType>& elem) +{ + m_private = elem; + return *this; +} + +WebDocumentType::operator PassRefPtr<DocumentType>() const +{ + return static_cast<DocumentType*>(m_private.get()); +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/WebDragData.cpp b/WebKit/chromium/src/WebDragData.cpp index b18ab1b..643c35d 100644 --- a/WebKit/chromium/src/WebDragData.cpp +++ b/WebKit/chromium/src/WebDragData.cpp @@ -67,13 +67,13 @@ void WebDragData::assign(const WebDragData& other) WebURL WebDragData::url() const { ASSERT(!isNull()); - return m_private->url; + return m_private->getURL(); } void WebDragData::setURL(const WebURL& url) { ensureMutable(); - m_private->url = url; + m_private->setURL(url); } WebString WebDragData::urlTitle() const @@ -88,18 +88,6 @@ void WebDragData::setURLTitle(const WebString& urlTitle) m_private->urlTitle = urlTitle; } -WebURL WebDragData::downloadURL() const -{ - ASSERT(!isNull()); - return m_private->downloadURL; -} - -void WebDragData::setDownloadURL(const WebURL& downloadURL) -{ - ensureMutable(); - m_private->downloadURL = downloadURL; -} - WebString WebDragData::downloadMetadata() const { ASSERT(!isNull()); diff --git a/WebKit/chromium/src/WebElement.cpp b/WebKit/chromium/src/WebElement.cpp index d0a0862..f45cba9 100644 --- a/WebKit/chromium/src/WebElement.cpp +++ b/WebKit/chromium/src/WebElement.cpp @@ -32,26 +32,19 @@ #include "WebElement.h" #include "Element.h" +#include "RenderBoxModelObject.h" +#include "RenderObject.h" #include <wtf/PassRefPtr.h> +#include "WebNamedNodeMap.h" + using namespace WebCore; namespace WebKit { -WebElement::WebElement(const WTF::PassRefPtr<WebCore::Element>& elem) - : WebNode(elem.releaseRef()) -{ -} - -WebElement& WebElement::operator=(const WTF::PassRefPtr<WebCore::Element>& elem) +bool WebElement::isFormControlElement() const { - WebNode::assign(elem.releaseRef()); - return *this; -} - -WebElement::operator WTF::PassRefPtr<Element>() const -{ - return PassRefPtr<Element>(static_cast<Element*>(m_private)); + return constUnwrap<Element>()->isFormControlElement(); } WebString WebElement::tagName() const @@ -62,7 +55,7 @@ WebString WebElement::tagName() const bool WebElement::hasTagName(const WebString& tagName) const { return equalIgnoringCase(constUnwrap<Element>()->tagName(), - tagName.operator WebCore::String()); + tagName.operator String()); } bool WebElement::hasAttribute(const WebString& attrName) const @@ -82,10 +75,30 @@ bool WebElement::setAttribute(const WebString& attrName, const WebString& attrVa return !exceptionCode; } +WebNamedNodeMap WebElement::attributes() const +{ + return WebNamedNodeMap(m_private->attributes()); +} + WebString WebElement::innerText() const { return constUnwrap<Element>()->innerText(); } -} // namespace WebKit +WebElement::WebElement(const PassRefPtr<Element>& elem) + : WebNode(elem) +{ +} +WebElement& WebElement::operator=(const PassRefPtr<Element>& elem) +{ + m_private = elem; + return *this; +} + +WebElement::operator PassRefPtr<Element>() const +{ + return static_cast<Element*>(m_private.get()); +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/WebEntities.cpp b/WebKit/chromium/src/WebEntities.cpp index b9143d9..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 HTMLTokenizer.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.c" // 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, WebCore::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 ad3c310..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. @@ -59,12 +60,12 @@ public: // entity name. If yes, return the entity notation. If not, returns an // empty string. Parameter isHTML indicates check the code in html entity // map or in xml entity map. - WebCore::String entityNameByCode(int code) const; + WTF::String entityNameByCode(int code) const; // Returns a new string with corresponding entity names replaced. - WebCore::String convertEntitiesInString(const WebCore::String&) const; + WTF::String convertEntitiesInString(const WTF::String&) const; private: - typedef HashMap<int, WebCore::String> EntitiesMapType; + typedef HashMap<int, WTF::String> EntitiesMapType; // An internal object that maps the Unicode character to corresponding // entity notation. EntitiesMapType m_entitiesMap; diff --git a/WebKit/chromium/src/WebFileChooserCompletionImpl.cpp b/WebKit/chromium/src/WebFileChooserCompletionImpl.cpp index 4152dc5..ef2409c 100644 --- a/WebKit/chromium/src/WebFileChooserCompletionImpl.cpp +++ b/WebKit/chromium/src/WebFileChooserCompletionImpl.cpp @@ -48,7 +48,7 @@ void WebFileChooserCompletionImpl::didChooseFile(const WebVector<WebString>& fil m_fileChooser->chooseFile(fileNames[0]); else { // This clause handles a case of file_names.size()==0 too. - Vector<WebCore::String> paths; + Vector<WTF::String> paths; for (size_t i = 0; i < fileNames.size(); ++i) paths.append(fileNames[i]); m_fileChooser->chooseFiles(paths); diff --git a/WebKit/chromium/src/WebFileChooserCompletionImpl.h b/WebKit/chromium/src/WebFileChooserCompletionImpl.h index fe759e0..147d1f7 100644 --- a/WebKit/chromium/src/WebFileChooserCompletionImpl.h +++ b/WebKit/chromium/src/WebFileChooserCompletionImpl.h @@ -31,14 +31,11 @@ #ifndef WebFileChooserCompletionImpl_h #define WebFileChooserCompletionImpl_h -// FIXME: These relative paths are a temporary hack to support using this -// header from webkit/glue. -#include "../public/WebFileChooserCompletion.h" -#include "../public/WebString.h" -#include "../public/WebVector.h" +#include "WebFileChooserCompletion.h" +#include "WebString.h" +#include "WebVector.h" #include "FileChooser.h" - #include <wtf/PassRefPtr.h> using WebKit::WebFileChooserCompletion; diff --git a/WebKit/chromium/src/WebFileSystemCallbacksImpl.cpp b/WebKit/chromium/src/WebFileSystemCallbacksImpl.cpp new file mode 100644 index 0000000..d29f86d --- /dev/null +++ b/WebKit/chromium/src/WebFileSystemCallbacksImpl.cpp @@ -0,0 +1,94 @@ +/* + * 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 "WebFileSystemCallbacksImpl.h" + +#if ENABLE(FILE_SYSTEM) + +#include "ExceptionCode.h" +#include "FileSystemCallbacks.h" +#include "WebFileSystemEntry.h" +#include "WebFileInfo.h" +#include "WebString.h" +#include <wtf/Vector.h> + +using namespace WebCore; + +namespace WebKit { + +WebFileSystemCallbacksImpl::WebFileSystemCallbacksImpl(PassOwnPtr<FileSystemCallbacksBase> callbacks) + : m_callbacks(callbacks) +{ +} + +WebFileSystemCallbacksImpl::~WebFileSystemCallbacksImpl() +{ +} + +void WebFileSystemCallbacksImpl::didSucceed() +{ + ASSERT(m_callbacks); + m_callbacks->didSucceed(); + delete this; +} + +void WebFileSystemCallbacksImpl::didReadMetadata(const WebFileInfo& info) +{ + ASSERT(m_callbacks); + m_callbacks->didReadMetadata(info.modificationTime); + delete this; +} + +void WebFileSystemCallbacksImpl::didReadDirectory(const WebVector<WebFileSystemEntry>& entries, bool hasMore) +{ + ASSERT(m_callbacks); + for (size_t i = 0; i < entries.size(); ++i) + m_callbacks->didReadDirectoryEntry(entries[i].name, entries[i].isDirectory); + m_callbacks->didReadDirectoryChunkDone(hasMore); + if (!hasMore) + delete this; +} + +void WebFileSystemCallbacksImpl::didOpenFileSystem(const WebString& name, const WebString& path) +{ + m_callbacks->didOpenFileSystem(name, path); + delete this; +} + +void WebFileSystemCallbacksImpl::didFail(WebFileError error) +{ + ASSERT(m_callbacks); + m_callbacks->didFail(error); + delete this; +} + +} // namespace WebKit + +#endif // ENABLE(FILE_SYSTEM) diff --git a/WebKit/chromium/src/WebFileSystemCallbacksImpl.h b/WebKit/chromium/src/WebFileSystemCallbacksImpl.h new file mode 100644 index 0000000..f3c6bc3 --- /dev/null +++ b/WebKit/chromium/src/WebFileSystemCallbacksImpl.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebFileSystemCallbacksImpl_h +#define WebFileSystemCallbacksImpl_h + +#include "WebFileSystemCallbacks.h" +#include "WebVector.h" +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> + +namespace WebCore { +class FileSystemCallbacksBase; +} + +namespace WebKit { + +struct WebFileInfo; +class WebFileSystemEntry; +class WebString; + +class WebFileSystemCallbacksImpl : public WebFileSystemCallbacks { +public: + WebFileSystemCallbacksImpl(PassOwnPtr<WebCore::FileSystemCallbacksBase>); + virtual ~WebFileSystemCallbacksImpl(); + + virtual void didSucceed(); + virtual void didReadMetadata(const WebFileInfo& info); + virtual void didReadDirectory(const WebVector<WebFileSystemEntry>& entries, bool hasMore); + virtual void didOpenFileSystem(const WebString& name, const WebString& rootPath); + virtual void didFail(WebFileError error); + +private: + OwnPtr<WebCore::FileSystemCallbacksBase> m_callbacks; +}; + +} // namespace WebKit + +#endif // WebFileSystemCallbacksImpl_h diff --git a/WebKit/chromium/src/WebFontDescription.cpp b/WebKit/chromium/src/WebFontDescription.cpp new file mode 100644 index 0000000..18f6830 --- /dev/null +++ b/WebKit/chromium/src/WebFontDescription.cpp @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * 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 "WebFontDescription.h" + +#include "FontDescription.h" + +using namespace WebCore; + +namespace WebKit { + +WebFontDescription::WebFontDescription(const FontDescription& desc, + short fontLetterSpacing, short fontWordSpacing) +{ + family = desc.family().family(); + genericFamily = static_cast<GenericFamily>(desc.genericFamily()); + size = desc.specifiedSize(); + italic = desc.italic(); + smallCaps = desc.smallCaps(); + weight = static_cast<Weight>(desc.weight()); + smoothing = static_cast<Smoothing>(desc.fontSmoothing()); + letterSpacing = fontLetterSpacing; + wordSpacing = fontWordSpacing; +} + +WebFontDescription::operator WebCore::FontDescription() const +{ + FontFamily fontFamily; + fontFamily.setFamily(family); + + FontDescription desc; + desc.setFamily(fontFamily); + desc.setGenericFamily(static_cast<FontDescription::GenericFamilyType>(genericFamily)); + desc.setSpecifiedSize(size); + desc.setComputedSize(size); + desc.setItalic(italic); + desc.setSmallCaps(smallCaps); + desc.setWeight(static_cast<FontWeight>(weight)); + desc.setFontSmoothing(static_cast<FontSmoothingMode>(smoothing)); + return desc; +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/WebFontImpl.cpp b/WebKit/chromium/src/WebFontImpl.cpp new file mode 100644 index 0000000..6fa5494 --- /dev/null +++ b/WebKit/chromium/src/WebFontImpl.cpp @@ -0,0 +1,126 @@ +/* + * 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 "WebFontImpl.h" + +#include "Font.h" +#include "FontDescription.h" +#include "GraphicsContext.h" +#include "PlatformContextSkia.h" +#include "WebFloatPoint.h" +#include "WebFloatRect.h" +#include "WebFontDescription.h" +#include "WebRect.h" +#include "WebTextRun.h" + +using namespace WebCore; + +namespace WebKit { + +WebFont* WebFont::create(const WebFontDescription& desc) +{ + return new WebFontImpl(desc, desc.letterSpacing, desc.wordSpacing); +} + +WebFontImpl::WebFontImpl(const FontDescription& desc, short letterSpacing, short wordSpacing) + : m_font(desc, letterSpacing, wordSpacing) +{ + m_font.update(0); +} + +WebFontDescription WebFontImpl::fontDescription() const +{ + return WebFontDescription(m_font.fontDescription(), m_font.letterSpacing(), m_font.wordSpacing()); +} + +int WebFontImpl::ascent() const +{ + return m_font.ascent(); +} + +int WebFontImpl::descent() const +{ + return m_font.descent(); +} + +int WebFontImpl::height() const +{ + return m_font.height(); +} + +int WebFontImpl::lineSpacing() const +{ + return m_font.lineSpacing(); +} + +float WebFontImpl::xHeight() const +{ + return m_font.xHeight(); +} + +void WebFontImpl::drawText(WebCanvas* canvas, const WebTextRun& run, const WebFloatPoint& leftBaseline, + WebColor color, const WebRect& clip, bool canvasIsOpaque, + int from, int to) const +{ + // FIXME hook canvasIsOpaque up to the platform-specific indicators for + // whether subpixel AA can be used for this draw. On Windows, this is + // PlatformContextSkia::setDrawingToImageBuffer. +#if WEBKIT_USING_CG + GraphicsContext gc(canvas); +#elif WEBKIT_USING_SKIA + PlatformContextSkia context(canvas); + // PlatformGraphicsContext is actually a pointer to PlatformContextSkia. + GraphicsContext gc(reinterpret_cast<PlatformGraphicsContext*>(&context)); +#else + notImplemented(); +#endif + + gc.setFillColor(color, DeviceColorSpace); + gc.clip(WebCore::FloatRect(clip)); + m_font.drawText(&gc, run, leftBaseline, from, to); +} + +int WebFontImpl::calculateWidth(const WebTextRun& run) const +{ + return m_font.width(run, 0); +} + +int WebFontImpl::offsetForPosition(const WebTextRun& run, float position) const +{ + return m_font.offsetForPosition(run, position, true); +} + +WebFloatRect WebFontImpl::selectionRectForText(const WebTextRun& run, const WebFloatPoint& leftBaseline, int height, int from, int to) const +{ + return m_font.selectionRectForText(run, leftBaseline, height, from, to); +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/WebFontImpl.h b/WebKit/chromium/src/WebFontImpl.h new file mode 100644 index 0000000..3ac9031 --- /dev/null +++ b/WebKit/chromium/src/WebFontImpl.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebFontImpl_h +#define WebFontImpl_h + +#include "Font.h" +#include "WebFont.h" + +namespace WebCore { class FontDescription; } + +namespace WebKit { + +class WebFontImpl : public WebFont { +public: + WebFontImpl(const WebCore::FontDescription&, short letterSpacing, short wordSpacing); + + virtual WebFontDescription fontDescription() const; + + virtual int ascent() const; + virtual int descent() const; + virtual int height() const; + virtual int lineSpacing() const; + virtual float xHeight() const; + + virtual void drawText(WebCanvas*, const WebTextRun&, const WebFloatPoint& leftBaseline, WebColor, + const WebRect& clip, bool canvasIsOpaque, int from = 0, int to = -1) const; + virtual int calculateWidth(const WebTextRun&) const; + virtual int offsetForPosition(const WebTextRun&, float position) const; + virtual WebFloatRect selectionRectForText(const WebTextRun&, const WebFloatPoint& leftBaseline, + int height, int from = 0, int to = -1) const; + +private: + WebCore::Font m_font; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/src/WebFormControlElement.cpp b/WebKit/chromium/src/WebFormControlElement.cpp new file mode 100644 index 0000000..a75fe5c --- /dev/null +++ b/WebKit/chromium/src/WebFormControlElement.cpp @@ -0,0 +1,85 @@ +/* + * 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 "WebFormControlElement.h" + +#include "HTMLFormControlElement.h" +#include <wtf/PassRefPtr.h> + +using namespace WebCore; + +namespace WebKit { + +bool WebFormControlElement::isEnabled() const +{ + return constUnwrap<HTMLFormControlElement>()->isEnabledFormControl(); +} + +WebString WebFormControlElement::formControlName() const +{ + return constUnwrap<HTMLFormControlElement>()->name(); +} + +WebString WebFormControlElement::formControlType() const +{ + return constUnwrap<HTMLFormControlElement>()->type(); +} + +WebString WebFormControlElement::nameForAutofill() const +{ + String name = constUnwrap<HTMLFormControlElement>()->name(); + String trimmedName = name.stripWhiteSpace(); + if (!trimmedName.isEmpty()) + return trimmedName; + name = constUnwrap<HTMLFormControlElement>()->getIdAttribute(); + trimmedName = name.stripWhiteSpace(); + if (!trimmedName.isEmpty()) + return trimmedName; + return String(); +} + +WebFormControlElement::WebFormControlElement(const PassRefPtr<HTMLFormControlElement>& elem) + : WebElement(elem) +{ +} + +WebFormControlElement& WebFormControlElement::operator=(const PassRefPtr<HTMLFormControlElement>& elem) +{ + m_private = elem; + return *this; +} + +WebFormControlElement::operator PassRefPtr<HTMLFormControlElement>() const +{ + return static_cast<HTMLFormControlElement*>(m_private.get()); +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/WebFormElement.cpp b/WebKit/chromium/src/WebFormElement.cpp index 5471608..9c77732 100644 --- a/WebKit/chromium/src/WebFormElement.cpp +++ b/WebKit/chromium/src/WebFormElement.cpp @@ -31,10 +31,13 @@ #include "config.h" #include "WebFormElement.h" +#include "FormState.h" #include "HTMLFormControlElement.h" #include "HTMLFormElement.h" #include "HTMLInputElement.h" #include "HTMLNames.h" +#include "WebFormControlElement.h" +#include "WebInputElement.h" #include "WebString.h" #include "WebURL.h" #include <wtf/PassRefPtr.h> @@ -43,25 +46,6 @@ using namespace WebCore; namespace WebKit { -class WebFormPrivate : public HTMLFormElement { -}; - -WebFormElement::WebFormElement(const WTF::PassRefPtr<HTMLFormElement>& e) - : WebElement(e.releaseRef()) -{ -} - -WebFormElement& WebFormElement::operator=(const WTF::PassRefPtr<HTMLFormElement>& e) -{ - WebNode::assign(e.releaseRef()); - return *this; -} - -WebFormElement::operator WTF::PassRefPtr<WebCore::HTMLFormElement>() const -{ - return PassRefPtr<HTMLFormElement>(static_cast<HTMLFormElement*>(m_private)); -} - bool WebFormElement::autoComplete() const { return constUnwrap<HTMLFormElement>()->autoComplete(); @@ -72,16 +56,21 @@ WebString WebFormElement::action() const return constUnwrap<HTMLFormElement>()->action(); } -WebString WebFormElement::name() const +WebString WebFormElement::name() const { return constUnwrap<HTMLFormElement>()->name(); } -WebString WebFormElement::method() const +WebString WebFormElement::method() const { return constUnwrap<HTMLFormElement>()->method(); } - + +bool WebFormElement::wasUserSubmitted() const +{ + return constUnwrap<HTMLFormElement>()->submissionTrigger() == NotSubmittedByJavaScript; +} + void WebFormElement::submit() { unwrap<HTMLFormElement>()->submit(); @@ -94,17 +83,36 @@ void WebFormElement::getNamedElements(const WebString& name, unwrap<HTMLFormElement>()->getNamedElements(name, tempVector); result.assign(tempVector); } - -void WebFormElement::getInputElements(WebVector<WebInputElement>& result) const + +void WebFormElement::getFormControlElements(WebVector<WebFormControlElement>& result) const { const HTMLFormElement* form = constUnwrap<HTMLFormElement>(); - Vector<RefPtr<HTMLInputElement> > tempVector; - for (size_t i = 0; i < form->formElements.size(); i++) { - if (form->formElements[i]->hasLocalName(HTMLNames::inputTag)) - tempVector.append(static_cast<HTMLInputElement*>( - form->formElements[i])); + Vector<RefPtr<HTMLFormControlElement> > tempVector; + // FIXME: We should move the for-loop condition into a variable instead of + // re-evaluating size each time. Also, consider refactoring this code so that + // we don't call form->associatedElements() multiple times. + for (size_t i = 0; i < form->associatedElements().size(); i++) { + if (form->associatedElements()[i]->hasLocalName(HTMLNames::inputTag) + || form->associatedElements()[i]->hasLocalName(HTMLNames::selectTag)) + tempVector.append(form->associatedElements()[i]); } result.assign(tempVector); } +WebFormElement::WebFormElement(const PassRefPtr<HTMLFormElement>& e) + : WebElement(e) +{ +} + +WebFormElement& WebFormElement::operator=(const PassRefPtr<HTMLFormElement>& e) +{ + m_private = e; + return *this; +} + +WebFormElement::operator PassRefPtr<HTMLFormElement>() const +{ + return static_cast<HTMLFormElement*>(m_private.get()); +} + } // namespace WebKit diff --git a/WebKit/chromium/src/WebFrameImpl.cpp b/WebKit/chromium/src/WebFrameImpl.cpp index 2f911f1..4375e73 100644 --- a/WebKit/chromium/src/WebFrameImpl.cpp +++ b/WebKit/chromium/src/WebFrameImpl.cpp @@ -75,21 +75,20 @@ #include "ChromiumBridge.h" #include "ClipboardUtilitiesChromium.h" #include "Console.h" +#include "DOMUtilitiesPrivate.h" +#include "DOMWindow.h" #include "Document.h" #include "DocumentFragment.h" // Only needed for ReplaceSelectionCommand.h :( #include "DocumentLoader.h" #include "DocumentMarker.h" -#include "DOMUtilitiesPrivate.h" -#include "DOMWindow.h" #include "Editor.h" #include "EventHandler.h" #include "FormState.h" -#include "FrameLoader.h" #include "FrameLoadRequest.h" +#include "FrameLoader.h" #include "FrameTree.h" #include "FrameView.h" #include "GraphicsContext.h" -#include "HistoryItem.h" #include "HTMLCollection.h" #include "HTMLFormElement.h" #include "HTMLFrameOwnerElement.h" @@ -97,10 +96,11 @@ #include "HTMLInputElement.h" #include "HTMLLinkElement.h" #include "HTMLNames.h" +#include "HistoryItem.h" #include "InspectorController.h" -#include "markup.h" #include "Page.h" #include "PlatformContextSkia.h" +#include "PluginDocument.h" #include "PrintContext.h" #include "RenderFrame.h" #include "RenderTreeAsText.h" @@ -112,8 +112,8 @@ #include "ScriptController.h" #include "ScriptSourceCode.h" #include "ScriptValue.h" -#include "ScrollbarTheme.h" #include "ScrollTypes.h" +#include "ScrollbarTheme.h" #include "SelectionController.h" #include "Settings.h" #include "SkiaUtils.h" @@ -130,6 +130,8 @@ #include "WebHistoryItem.h" #include "WebInputElement.h" #include "WebPasswordAutocompleteListener.h" +#include "WebPlugin.h" +#include "WebPluginContainerImpl.h" #include "WebRange.h" #include "WebRect.h" #include "WebScriptSource.h" @@ -139,6 +141,7 @@ #include "WebVector.h" #include "WebViewImpl.h" #include "XPathResult.h" +#include "markup.h" #include <algorithm> #include <wtf/CurrentTime.h> @@ -231,6 +234,15 @@ static void frameContentAsPlainText(size_t maxChars, Frame* frame, // Recursively walk the children. FrameTree* frameTree = frame->tree(); for (Frame* curChild = frameTree->firstChild(); curChild; curChild = curChild->tree()->nextSibling()) { + // Ignore the text of non-visible frames. + RenderView* contentRenderer = curChild->contentRenderer(); + RenderPart* ownerRenderer = curChild->ownerRenderer(); + if (!contentRenderer || !contentRenderer->width() || !contentRenderer->height() + || (contentRenderer->x() + contentRenderer->width() <= 0) || (contentRenderer->y() + contentRenderer->height() <= 0) + || (ownerRenderer && ownerRenderer->style() && ownerRenderer->style()->visibility() != VISIBLE)) { + continue; + } + // Make sure the frame separator won't fill up the buffer, and give up if // it will. The danger is if the separator will make the buffer longer than // maxChars. This will cause the computation above: @@ -246,7 +258,18 @@ static void frameContentAsPlainText(size_t maxChars, Frame* frame, } } -// Simple class to override some of PrintContext behavior. +WebPluginContainerImpl* WebFrameImpl::pluginContainerFromFrame(Frame* frame) +{ + if (!frame) + return 0; + if (!frame->document() || !frame->document()->isPluginDocument()) + return 0; + PluginDocument* pluginDocument = static_cast<PluginDocument*>(frame->document()); + return static_cast<WebPluginContainerImpl *>(pluginDocument->pluginWidget()); +} + +// Simple class to override some of PrintContext behavior. Some of the methods +// made virtual so that they can be overriden by ChromePluginPrintContext. class ChromePrintContext : public PrintContext, public Noncopyable { public: ChromePrintContext(Frame* frame) @@ -255,28 +278,38 @@ public: { } - void begin(float width) + virtual void begin(float width) { ASSERT(!m_printedPageWidth); m_printedPageWidth = width; PrintContext::begin(m_printedPageWidth); } - float getPageShrink(int pageNumber) const + virtual void end() + { + PrintContext::end(); + } + + virtual float getPageShrink(int pageNumber) const { IntRect pageRect = m_pageRects[pageNumber]; return m_printedPageWidth / pageRect.width(); } - // Spools the printed page, a subrect of m_frame. Skip the scale step. + // Spools the printed page, a subrect of m_frame. Skip the scale step. // NativeTheme doesn't play well with scaling. Scaling is done browser side - // instead. Returns the scale to be applied. - float spoolPage(GraphicsContext& ctx, int pageNumber) + // instead. Returns the scale to be applied. + // On Linux, we don't have the problem with NativeTheme, hence we let WebKit + // do the scaling and ignore the return value. + virtual float spoolPage(GraphicsContext& ctx, int pageNumber) { IntRect pageRect = m_pageRects[pageNumber]; float scale = m_printedPageWidth / pageRect.width(); ctx.save(); +#if OS(LINUX) + ctx.scale(WebCore::FloatSize(scale, scale)); +#endif ctx.translate(static_cast<float>(-pageRect.x()), static_cast<float>(-pageRect.y())); ctx.clip(pageRect); @@ -285,11 +318,95 @@ public: return scale; } + virtual void computePageRects(const FloatRect& printRect, float headerHeight, float footerHeight, float userScaleFactor, float& outPageHeight) + { + return PrintContext::computePageRects(printRect, headerHeight, footerHeight, userScaleFactor, outPageHeight); + } + + virtual int pageCount() const + { + return PrintContext::pageCount(); + } + + virtual bool shouldUseBrowserOverlays() const + { + return true; + } + private: // Set when printing. float m_printedPageWidth; }; +// Simple class to override some of PrintContext behavior. This is used when +// the frame hosts a plugin that supports custom printing. In this case, we +// want to delegate all printing related calls to the plugin. +class ChromePluginPrintContext : public ChromePrintContext { +public: + ChromePluginPrintContext(Frame* frame, int printerDPI) + : ChromePrintContext(frame), m_pageCount(0), m_printerDPI(printerDPI) + { + // This HAS to be a frame hosting a full-mode plugin + ASSERT(frame->document()->isPluginDocument()); + } + + virtual void begin(float width) + { + } + + virtual void end() + { + WebPluginContainerImpl* pluginContainer = WebFrameImpl::pluginContainerFromFrame(m_frame); + if (pluginContainer && pluginContainer->supportsPaginatedPrint()) + pluginContainer->printEnd(); + else + ASSERT_NOT_REACHED(); + } + + virtual float getPageShrink(int pageNumber) const + { + // We don't shrink the page (maybe we should ask the widget ??) + return 1.0; + } + + virtual void computePageRects(const FloatRect& printRect, float headerHeight, float footerHeight, float userScaleFactor, float& outPageHeight) + { + WebPluginContainerImpl* pluginContainer = WebFrameImpl::pluginContainerFromFrame(m_frame); + if (pluginContainer && pluginContainer->supportsPaginatedPrint()) + m_pageCount = pluginContainer->printBegin(IntRect(printRect), m_printerDPI); + else + ASSERT_NOT_REACHED(); + } + + virtual int pageCount() const + { + return m_pageCount; + } + + // Spools the printed page, a subrect of m_frame. Skip the scale step. + // NativeTheme doesn't play well with scaling. Scaling is done browser side + // instead. Returns the scale to be applied. + virtual float spoolPage(GraphicsContext& ctx, int pageNumber) + { + WebPluginContainerImpl* pluginContainer = WebFrameImpl::pluginContainerFromFrame(m_frame); + if (pluginContainer && pluginContainer->supportsPaginatedPrint()) + pluginContainer->printPage(pageNumber, &ctx); + else + ASSERT_NOT_REACHED(); + return 1.0; + } + + virtual bool shouldUseBrowserOverlays() const + { + return false; + } + +private: + // Set when printing. + int m_pageCount; + int m_printerDPI; +}; + static WebDataSource* DataSourceForDocLoader(DocumentLoader* loader) { return loader ? WebDataSourceImpl::fromDocumentLoader(loader) : 0; @@ -363,9 +480,9 @@ WebString WebFrameImpl::name() const return m_frame->tree()->name(); } -void WebFrameImpl::clearName() +void WebFrameImpl::setName(const WebString& name) { - m_frame->tree()->clearName(); + m_frame->tree()->setName(name); } WebURL WebFrameImpl::url() const @@ -413,7 +530,7 @@ WebURL WebFrameImpl::openSearchDescriptionURL() const WebString WebFrameImpl::encoding() const { - return frame()->loader()->encoding(); + return frame()->loader()->writer()->encoding(); } WebSize WebFrameImpl::scrollOffset() const @@ -553,13 +670,18 @@ void WebFrameImpl::forms(WebVector<WebFormElement>& results) const return; RefPtr<HTMLCollection> forms = m_frame->document()->forms(); - size_t formCount = forms->length(); + size_t formCount = 0; + for (size_t i = 0; i < forms->length(); ++i) { + Node* node = forms->item(i); + if (node && node->isHTMLElement()) + ++formCount; + } WebVector<WebFormElement> temp(formCount); for (size_t i = 0; i < formCount; ++i) { Node* node = forms->item(i); // Strange but true, sometimes item can be 0. - if (node) + if (node && node->isHTMLElement()) temp[i] = static_cast<HTMLFormElement*>(node); } results.swap(temp); @@ -596,7 +718,7 @@ NPObject* WebFrameImpl::windowObject() const void WebFrameImpl::bindToWindowObject(const WebString& name, NPObject* object) { ASSERT(m_frame); - if (!m_frame || !m_frame->script()->canExecuteScripts()) + if (!m_frame || !m_frame->script()->canExecuteScripts(NotAboutToExecuteScript)) return; String key = name; @@ -670,6 +792,13 @@ void WebFrameImpl::collectGarbage() } #if USE(V8) +v8::Handle<v8::Value> WebFrameImpl::executeScriptAndReturnValue( + const WebScriptSource& source) +{ + return m_frame->script()->executeScript( + ScriptSourceCode(source.code, source.url, source.startLine)).v8Value(); +} + // Returns the V8 context for this frame, or an empty handle if there is none. v8::Local<v8::Context> WebFrameImpl::mainWorldScriptContext() const { @@ -713,12 +842,10 @@ bool WebFrameImpl::insertStyleText( return success; } -void WebFrameImpl::reload() +void WebFrameImpl::reload(bool ignoreCache) { m_frame->loader()->history()->saveDocumentAndScrollState(); - - stopLoading(); // Make sure existing activity stops. - m_frame->loader()->reload(); + m_frame->loader()->reload(ignoreCache); } void WebFrameImpl::loadRequest(const WebURLRequest& request) @@ -731,7 +858,6 @@ void WebFrameImpl::loadRequest(const WebURLRequest& request) return; } - stopLoading(); // Make sure existing activity stops. m_frame->loader()->load(resourceRequest, false); } @@ -740,8 +866,6 @@ void WebFrameImpl::loadHistoryItem(const WebHistoryItem& item) RefPtr<HistoryItem> historyItem = PassRefPtr<HistoryItem>(item); ASSERT(historyItem.get()); - stopLoading(); // Make sure existing activity stops. - // If there is no currentItem, which happens when we are navigating in // session history after a crash, we need to manufacture one otherwise WebKit // hoarks. This is probably the wrong thing to do, but it seems to work. @@ -778,8 +902,6 @@ void WebFrameImpl::loadData(const WebData& data, request = m_frame->loader()->originalRequest(); request.setURL(baseURL); - stopLoading(); // Make sure existing activity stops. - m_frame->loader()->load(request, substData, false); if (replace) { // Do this to force WebKit to treat the load as replacing the currently @@ -847,7 +969,12 @@ WebHistoryItem WebFrameImpl::previousHistoryItem() const WebHistoryItem WebFrameImpl::currentHistoryItem() const { - m_frame->loader()->history()->saveDocumentAndScrollState(); + // If we are still loading, then we don't want to clobber the current + // history item as this could cause us to lose the scroll position and + // document state. However, it is OK for new navigations. + if (m_frame->loader()->loadType() == FrameLoadTypeStandard + || !m_frame->loader()->activeDocumentLoader()->isLoadingInAPISense()) + m_frame->loader()->history()->saveDocumentAndScrollState(); return WebHistoryItem(m_frame->page()->backForwardList()->currentItem()); } @@ -897,7 +1024,7 @@ void WebFrameImpl::commitDocumentData(const char* data, size_t dataLen) userChosen = false; encoding = documentLoader->response().textEncodingName(); } - m_frame->loader()->setEncoding(encoding, userChosen); + m_frame->loader()->writer()->setEncoding(encoding, userChosen); // NOTE: mac only does this if there is a document m_frame->loader()->addData(data, dataLen); @@ -975,17 +1102,25 @@ bool WebFrameImpl::executeCommand(const WebString& name) if (command[command.length() - 1] == UChar(':')) command = command.substring(0, command.length() - 1); + if (command == "Copy") { + WebPluginContainerImpl* pluginContainer = pluginContainerFromFrame(frame()); + if (pluginContainer) { + pluginContainer->copy(); + return true; + } + } + bool rv = true; // Specially handling commands that Editor::execCommand does not directly // support. if (command == "DeleteToEndOfParagraph") { Editor* editor = frame()->editor(); - if (!editor->deleteWithDirection(SelectionController::FORWARD, + if (!editor->deleteWithDirection(SelectionController::DirectionForward, ParagraphBoundary, true, false)) { - editor->deleteWithDirection(SelectionController::FORWARD, + editor->deleteWithDirection(SelectionController::DirectionForward, CharacterGranularity, true, false); @@ -1045,6 +1180,10 @@ bool WebFrameImpl::isContinuousSpellCheckingEnabled() const bool WebFrameImpl::hasSelection() const { + WebPluginContainerImpl* pluginContainer = pluginContainerFromFrame(frame()); + if (pluginContainer) + return pluginContainer->plugin()->hasSelection(); + // frame()->selection()->isNone() never returns true. return (frame()->selection()->start() != frame()->selection()->end()); } @@ -1056,6 +1195,10 @@ WebRange WebFrameImpl::selectionRange() const WebString WebFrameImpl::selectionAsText() const { + WebPluginContainerImpl* pluginContainer = pluginContainerFromFrame(frame()); + if (pluginContainer) + return pluginContainer->plugin()->selectionAsText(); + RefPtr<Range> range = frame()->selection()->toNormalizedRange(); if (!range.get()) return WebString(); @@ -1070,6 +1213,10 @@ WebString WebFrameImpl::selectionAsText() const WebString WebFrameImpl::selectionAsMarkup() const { + WebPluginContainerImpl* pluginContainer = pluginContainerFromFrame(frame()); + if (pluginContainer) + return pluginContainer->plugin()->selectionAsMarkup(); + RefPtr<Range> range = frame()->selection()->toNormalizedRange(); if (!range.get()) return WebString(); @@ -1082,11 +1229,10 @@ void WebFrameImpl::selectWordAroundPosition(Frame* frame, VisiblePosition pos) VisibleSelection selection(pos); selection.expandUsingGranularity(WordGranularity); - if (selection.isRange()) - frame->setSelectionGranularity(WordGranularity); - - if (frame->shouldChangeSelection(selection)) - frame->selection()->setSelection(selection); + if (frame->shouldChangeSelection(selection)) { + TextGranularity granularity = selection.isRange() ? WordGranularity : CharacterGranularity; + frame->selection()->setSelection(selection, granularity); + } } bool WebFrameImpl::selectWordAroundCaret() @@ -1099,11 +1245,17 @@ bool WebFrameImpl::selectWordAroundCaret() return true; } -int WebFrameImpl::printBegin(const WebSize& pageSize) +int WebFrameImpl::printBegin(const WebSize& pageSize, int printerDPI, bool *useBrowserOverlays) { ASSERT(!frame()->document()->isFrameSet()); + // If this is a plugin document, check if the plugin supports its own + // printing. If it does, we will delegate all printing to that. + WebPluginContainerImpl* pluginContainer = pluginContainerFromFrame(frame()); + if (pluginContainer && pluginContainer->supportsPaginatedPrint()) + m_printContext.set(new ChromePluginPrintContext(frame(), printerDPI)); + else + m_printContext.set(new ChromePrintContext(frame())); - m_printContext.set(new ChromePrintContext(frame())); FloatRect rect(0, 0, static_cast<float>(pageSize.width), static_cast<float>(pageSize.height)); m_printContext->begin(rect.width()); @@ -1111,6 +1263,9 @@ int WebFrameImpl::printBegin(const WebSize& pageSize) // We ignore the overlays calculation for now since they are generated in the // browser. pageHeight is actually an output parameter. m_printContext->computePageRects(rect, 0, 0, 1.0, pageHeight); + if (useBrowserOverlays) + *useBrowserOverlays = m_printContext->shouldUseBrowserOverlays(); + return m_printContext->pageCount(); } @@ -1133,7 +1288,7 @@ float WebFrameImpl::printPage(int page, WebCanvas* canvas) return 0; } -#if OS(WINDOWS) || OS(LINUX) || OS(FREEBSD) +#if OS(WINDOWS) || OS(LINUX) || OS(FREEBSD) || OS(SOLARIS) PlatformContextSkia context(canvas); GraphicsContext spool(&context); #elif OS(DARWIN) @@ -1152,6 +1307,28 @@ void WebFrameImpl::printEnd() m_printContext.clear(); } +bool WebFrameImpl::isPageBoxVisible(int pageIndex) +{ + return frame()->document()->isPageBoxVisible(pageIndex); +} + +void WebFrameImpl::pageSizeAndMarginsInPixels(int pageIndex, + WebSize& pageSize, + int& marginTop, + int& marginRight, + int& marginBottom, + int& marginLeft) +{ + IntSize size(pageSize.width, pageSize.height); + frame()->document()->pageSizeAndMarginsInPixels(pageIndex, + size, + marginTop, + marginRight, + marginBottom, + marginLeft); + pageSize = size; +} + bool WebFrameImpl::find(int identifier, const WebString& searchText, const WebFindOptions& options, @@ -1163,7 +1340,7 @@ bool WebFrameImpl::find(int identifier, if (!options.findNext) frame()->page()->unmarkAllTextMatches(); else - setMarkerActive(m_activeMatch.get(), false); // Active match is changing. + setMarkerActive(m_activeMatch.get(), false); // Active match is changing. // Starts the search from the current selection. bool startInSelection = true; @@ -1203,11 +1380,14 @@ bool WebFrameImpl::find(int identifier, else { m_activeMatch = newSelection.toNormalizedRange(); currSelectionRect = m_activeMatch->boundingBox(); - setMarkerActive(m_activeMatch.get(), true); // Active. + setMarkerActive(m_activeMatch.get(), true); // Active. // WebKit draws the highlighting for all matches. executeCommand(WebString::fromUTF8("Unselect")); } + // Make sure no node is focused. See http://crbug.com/38700. + frame()->document()->setFocusedNode(0); + if (!options.findNext || activeSelection) { // This is either a Find operation or a Find-next from a new start point // due to a selection, so we set the flag to ask the scoping effort @@ -1258,7 +1438,7 @@ void WebFrameImpl::stopFinding(bool clearSelection) cancelPendingScopingEffort(); // Remove all markers for matches found and turn off the highlighting. - frame()->document()->removeMarkers(DocumentMarker::TextMatch); + frame()->document()->markers()->removeMarkers(DocumentMarker::TextMatch); frame()->setMarkedTextMatchesAreHighlighted(false); // Let the frame know that we don't want tickmarks or highlighting anymore. @@ -1295,7 +1475,7 @@ void WebFrameImpl::scopeStringMatches(int identifier, identifier, searchText, options, - false); // false=we just reset, so don't do it again. + false); // false=we just reset, so don't do it again. return; } @@ -1309,7 +1489,7 @@ void WebFrameImpl::scopeStringMatches(int identifier, m_resumeScopingFromRange->startOffset(ec2) + 1, ec); if (ec || ec2) { - if (ec2) // A non-zero |ec| happens when navigating during search. + if (ec2) // A non-zero |ec| happens when navigating during search. ASSERT_NOT_REACHED(); return; } @@ -1318,7 +1498,7 @@ void WebFrameImpl::scopeStringMatches(int identifier, // This timeout controls how long we scope before releasing control. This // value does not prevent us from running for longer than this, but it is // periodically checked to see if we have exceeded our allocated time. - const double maxScopingDuration = 0.1; // seconds + const double maxScopingDuration = 0.1; // seconds int matchCount = 0; bool timedOut = false; @@ -1425,8 +1605,8 @@ void WebFrameImpl::scopeStringMatches(int identifier, identifier, searchText, options, - false); // don't reset. - return; // Done for now, resume work later. + false); // don't reset. + return; // Done for now, resume work later. } // This frame has no further scoping left, so it is done. Other frames might, @@ -1478,14 +1658,6 @@ void WebFrameImpl::resetMatchCount() m_framesScopingCount = 0; } -WebURL WebFrameImpl::completeURL(const WebString& url) const -{ - if (!m_frame || !m_frame->document()) - return WebURL(); - - return m_frame->document()->completeURL(url); -} - WebString WebFrameImpl::contentAsText(size_t maxChars) const { if (!m_frame) @@ -1533,6 +1705,14 @@ int WebFrameImpl::pageNumberForElementById(const WebString& id, return PrintContext::pageNumberForElement(element, pageSize); } +WebRect WebFrameImpl::selectionBoundsRect() const +{ + if (hasSelection()) + return IntRect(frame()->selectionBounds(false)); + + return WebRect(); +} + // WebFrameImpl public --------------------------------------------------------- PassRefPtr<WebFrameImpl> WebFrameImpl::create(WebFrameClient* client) @@ -1608,7 +1788,7 @@ PassRefPtr<Frame> WebFrameImpl::createChildFrame( // it is necessary to check the value after calling init() and // return without loading URL. // (b:791612) - childFrame->init(); // create an empty document + childFrame->init(); // create an empty document if (!childFrame->tree()->parent()) return 0; @@ -1634,11 +1814,23 @@ void WebFrameImpl::layout() view->layoutIfNeededRecursive(); } +void WebFrameImpl::paintWithContext(GraphicsContext& gc, const WebRect& rect) +{ + IntRect dirtyRect(rect); + gc.save(); + if (m_frame->document() && frameView()) { + gc.clip(dirtyRect); + frameView()->paint(&gc, dirtyRect); + m_frame->page()->inspectorController()->drawNodeHighlight(gc); + } else + gc.fillRect(dirtyRect, Color::white, DeviceColorSpace); + gc.restore(); +} + void WebFrameImpl::paint(WebCanvas* canvas, const WebRect& rect) { if (rect.isEmpty()) return; - IntRect dirtyRect(rect); #if WEBKIT_USING_CG GraphicsContext gc(canvas); LocalCurrentGraphicsContext localContext(&gc); @@ -1650,14 +1842,7 @@ void WebFrameImpl::paint(WebCanvas* canvas, const WebRect& rect) #else notImplemented(); #endif - gc.save(); - if (m_frame->document() && frameView()) { - gc.clip(dirtyRect); - frameView()->paint(&gc, dirtyRect); - m_frame->page()->inspectorController()->drawNodeHighlight(gc); - } else - gc.fillRect(dirtyRect, Color::white, DeviceColorSpace); - gc.restore(); + paintWithContext(gc, rect); } void WebFrameImpl::createFrameView() @@ -1719,7 +1904,7 @@ WebFrameImpl* WebFrameImpl::fromFrameOwnerElement(Element* element) static_cast<HTMLFrameOwnerElement*>(element); return fromFrame(frameElement->contentFrame()); } - + WebViewImpl* WebFrameImpl::viewImpl() const { if (!m_frame) @@ -1794,24 +1979,38 @@ void WebFrameImpl::didFail(const ResourceError& error, bool wasProvisional) client()->didFailLoad(this, webError); } -void WebFrameImpl::setAllowsScrolling(bool flag) +void WebFrameImpl::setCanHaveScrollbars(bool canHaveScrollbars) { - m_frame->view()->setCanHaveScrollbars(flag); + m_frame->view()->setCanHaveScrollbars(canHaveScrollbars); } -void WebFrameImpl::registerPasswordListener( +bool WebFrameImpl::registerPasswordListener( WebInputElement inputElement, WebPasswordAutocompleteListener* listener) { - RefPtr<HTMLInputElement> element = inputElement.operator PassRefPtr<HTMLInputElement>(); - ASSERT(m_passwordListeners.find(element) == m_passwordListeners.end()); - m_passwordListeners.set(element, listener); + RefPtr<HTMLInputElement> element(inputElement.unwrap<HTMLInputElement>()); + if (!m_passwordListeners.add(element, listener).second) { + delete listener; + return false; + } + return true; +} + +void WebFrameImpl::notifiyPasswordListenerOfAutocomplete( + const WebInputElement& inputElement) +{ + const HTMLInputElement* element = inputElement.constUnwrap<HTMLInputElement>(); + WebPasswordAutocompleteListener* listener = getPasswordListener(element); + // Password listeners need to autocomplete other fields that depend on the + // input element with autofill suggestions. + if (listener) + listener->performInlineAutocomplete(element->value(), false, false); } WebPasswordAutocompleteListener* WebFrameImpl::getPasswordListener( - HTMLInputElement* inputElement) + const HTMLInputElement* inputElement) { - return m_passwordListeners.get(RefPtr<HTMLInputElement>(inputElement)); + return m_passwordListeners.get(RefPtr<HTMLInputElement>(const_cast<HTMLInputElement*>(inputElement))); } // WebFrameImpl private -------------------------------------------------------- @@ -1832,6 +2031,8 @@ void WebFrameImpl::invalidateArea(AreaToInvalidate area) if ((area & InvalidateContentArea) == InvalidateContentArea) { IntRect contentArea( view->x(), view->y(), view->visibleWidth(), view->visibleHeight()); + IntRect frameRect = view->frameRect(); + contentArea.move(-frameRect.topLeft().x(), -frameRect.topLeft().y()); view->invalidateRect(contentArea); } @@ -1841,6 +2042,8 @@ void WebFrameImpl::invalidateArea(AreaToInvalidate area) view->x() + view->visibleWidth(), view->y(), ScrollbarTheme::nativeTheme()->scrollbarThickness(), view->visibleHeight()); + IntRect frameRect = view->frameRect(); + scrollBarVert.move(-frameRect.topLeft().x(), -frameRect.topLeft().y()); view->invalidateRect(scrollBarVert); } } @@ -1866,14 +2069,14 @@ void WebFrameImpl::addMarker(Range* range, bool activeMatch) if (marker.endOffset > marker.startOffset) { // Find the node to add a marker to and add it. Node* node = textPiece->startContainer(exception); - frame()->document()->addMarker(node, marker); + frame()->document()->markers()->addMarker(node, marker); // Rendered rects for markers in WebKit are not populated until each time // the markers are painted. However, we need it to happen sooner, because // the whole purpose of tickmarks on the scrollbar is to show where // matches off-screen are (that haven't been painted yet). - Vector<DocumentMarker> markers = frame()->document()->markersForNode(node); - frame()->document()->setRenderedRectForMarker( + Vector<DocumentMarker> markers = frame()->document()->markers()->markersForNode(node); + frame()->document()->markers()->setRenderedRectForMarker( textPiece->startContainer(exception), markers[markers.size() - 1], range->boundingBox()); @@ -1883,10 +2086,11 @@ void WebFrameImpl::addMarker(Range* range, bool activeMatch) void WebFrameImpl::setMarkerActive(Range* range, bool active) { - if (!range) + WebCore::ExceptionCode ec; + if (!range || range->collapsed(ec)) return; - frame()->document()->setMarkersActive(range, active); + frame()->document()->markers()->setMarkersActive(range, active); } int WebFrameImpl::ordinalOfFirstMatchForFrame(WebFrameImpl* frame) const @@ -1906,9 +2110,9 @@ int WebFrameImpl::ordinalOfFirstMatchForFrame(WebFrameImpl* frame) const bool WebFrameImpl::shouldScopeMatches(const String& searchText) { - // Don't scope if we can't find a frame or if the frame is not visible. + // Don't scope if we can't find a frame or a view or if the frame is not visible. // The user may have closed the tab/application, so abort. - if (!frame() || !hasVisibleContent()) + if (!frame() || !frame()->view() || !hasVisibleContent()) return false; ASSERT(frame()->document() && frame()->view()); @@ -1922,7 +2126,7 @@ bool WebFrameImpl::shouldScopeMatches(const String& searchText) searchText.substring(0, m_lastSearchString.length()); if (previousSearchPrefix == m_lastSearchString) - return false; // Don't search this frame, it will be fruitless. + return false; // Don't search this frame, it will be fruitless. } return true; @@ -1974,12 +2178,13 @@ void WebFrameImpl::clearPasswordListeners() void WebFrameImpl::loadJavaScriptURL(const KURL& url) { - // This is copied from FrameLoader::executeIfJavaScriptURL. Unfortunately, - // we cannot just use that method since it is private, and it also doesn't - // quite behave as we require it to for bookmarklets. The key difference is - // that we need to suppress loading the string result from evaluating the JS - // URL if executing the JS URL resulted in a location change. We also allow - // a JS URL to be loaded even if scripts on the page are otherwise disabled. + // This is copied from ScriptController::executeIfJavaScriptURL. + // Unfortunately, we cannot just use that method since it is private, and + // it also doesn't quite behave as we require it to for bookmarklets. The + // key difference is that we need to suppress loading the string result + // from evaluating the JS URL if executing the JS URL resulted in a + // location change. We also allow a JS URL to be loaded even if scripts on + // the page are otherwise disabled. if (!m_frame->document() || !m_frame->page()) return; @@ -1991,14 +2196,8 @@ void WebFrameImpl::loadJavaScriptURL(const KURL& url) if (!result.getString(scriptResult)) return; - SecurityOrigin* securityOrigin = m_frame->document()->securityOrigin(); - - if (!m_frame->redirectScheduler()->locationChangePending()) { - m_frame->loader()->stopAllLoaders(); - m_frame->loader()->begin(m_frame->loader()->url(), true, securityOrigin); - m_frame->loader()->write(scriptResult); - m_frame->loader()->end(); - } + if (!m_frame->redirectScheduler()->locationChangePending()) + m_frame->loader()->writer()->replaceDocument(scriptResult); } } // namespace WebKit diff --git a/WebKit/chromium/src/WebFrameImpl.h b/WebKit/chromium/src/WebFrameImpl.h index ccba6d4..00e8ecb 100644 --- a/WebKit/chromium/src/WebFrameImpl.h +++ b/WebKit/chromium/src/WebFrameImpl.h @@ -31,17 +31,17 @@ #ifndef WebFrameImpl_h #define WebFrameImpl_h -// FIXME: remove this relative path once consumers from glue are removed. -#include "../public/WebFrame.h" +#include "WebAnimationControllerImpl.h" +#include "WebFrame.h" + #include "Frame.h" #include "FrameLoaderClientImpl.h" #include "PlatformString.h" #include <wtf/OwnPtr.h> #include <wtf/RefCounted.h> -#include "WebAnimationControllerImpl.h" - namespace WebCore { +class GraphicsContext; class HistoryItem; class KURL; class Node; @@ -56,6 +56,7 @@ class WebDataSourceImpl; class WebInputElement; class WebFrameClient; class WebPasswordAutocompleteListener; +class WebPluginContainerImpl; class WebView; class WebViewImpl; @@ -64,7 +65,7 @@ class WebFrameImpl : public WebFrame, public RefCounted<WebFrameImpl> { public: // WebFrame methods: virtual WebString name() const; - virtual void clearName(); + virtual void setName(const WebString&); virtual WebURL url() const; virtual WebURL favIconURL() const; virtual WebURL openSearchDescriptionURL() const; @@ -88,7 +89,7 @@ public: virtual WebFrame* findChildByExpression(const WebString&) const; virtual WebDocument document() const; virtual void forms(WebVector<WebFormElement>&) const; - virtual WebAnimationController* animationController(); + virtual WebAnimationController* animationController(); virtual WebSecurityOrigin securityOrigin() const; virtual void grantUniversalAccess(); virtual NPObject* windowObject() const; @@ -100,10 +101,12 @@ public: virtual void addMessageToConsole(const WebConsoleMessage&); virtual void collectGarbage(); #if WEBKIT_USING_V8 + virtual v8::Handle<v8::Value> executeScriptAndReturnValue( + const WebScriptSource&); virtual v8::Local<v8::Context> mainWorldScriptContext() const; #endif virtual bool insertStyleText(const WebString& css, const WebString& id); - virtual void reload(); + virtual void reload(bool ignoreCache); virtual void loadRequest(const WebURLRequest&); virtual void loadHistoryItem(const WebHistoryItem&); virtual void loadData( @@ -142,10 +145,18 @@ public: virtual WebString selectionAsText() const; virtual WebString selectionAsMarkup() const; virtual bool selectWordAroundCaret(); - virtual int printBegin(const WebSize& pageSize); + virtual int printBegin(const WebSize& pageSize, int printerDPI, + bool* useBrowserOverlays); virtual float printPage(int pageToPrint, WebCanvas*); virtual float getPrintPageShrink(int page); virtual void printEnd(); + virtual bool isPageBoxVisible(int pageIndex); + virtual void pageSizeAndMarginsInPixels(int pageIndex, + WebSize& pageSize, + int& marginTop, + int& marginRight, + int& marginBottom, + int& marginLeft); virtual bool find( int identifier, const WebString& searchText, const WebFindOptions&, bool wrapWithinFrame, WebRect* selectionRect); @@ -156,10 +167,11 @@ public: virtual void cancelPendingScopingEffort(); virtual void increaseMatchCount(int count, int identifier); virtual void resetMatchCount(); - virtual void registerPasswordListener( + virtual bool registerPasswordListener( WebInputElement, WebPasswordAutocompleteListener*); + virtual void notifiyPasswordListenerOfAutocomplete( + const WebInputElement&); - virtual WebURL completeURL(const WebString& url) const; virtual WebString contentAsText(size_t maxChars) const; virtual WebString contentAsMarkup() const; virtual WebString renderTreeAsText() const; @@ -167,6 +179,7 @@ public: virtual int pageNumberForElementById(const WebString& id, float pageWidthInPixels, float pageHeightInPixels) const; + virtual WebRect selectionBoundsRect() const; static PassRefPtr<WebFrameImpl> create(WebFrameClient* client); ~WebFrameImpl(); @@ -179,11 +192,16 @@ public: void layout(); void paint(WebCanvas*, const WebRect&); + void paintWithContext(WebCore::GraphicsContext&, const WebRect&); void createFrameView(); static WebFrameImpl* fromFrame(WebCore::Frame* frame); static WebFrameImpl* fromFrameOwnerElement(WebCore::Element* element); + // If the frame hosts a PluginDocument, this method returns the WebPluginContainerImpl + // that hosts the plugin. + static WebPluginContainerImpl* pluginContainerFromFrame(WebCore::Frame*); + WebViewImpl* viewImpl() const; WebCore::Frame* frame() const { return m_frame; } @@ -212,16 +230,16 @@ public: // Sets whether the WebFrameImpl allows its document to be scrolled. // If the parameter is true, allow the document to be scrolled. // Otherwise, disallow scrolling. - void setAllowsScrolling(bool); + void setCanHaveScrollbars(bool); // Returns the password autocomplete listener associated with the passed // user name input element, or 0 if none available. // Note that the returned listener is owner by the WebFrameImpl and should not // be kept around as it is deleted when the page goes away. - WebPasswordAutocompleteListener* getPasswordListener(WebCore::HTMLInputElement*); + WebPasswordAutocompleteListener* getPasswordListener(const WebCore::HTMLInputElement*); WebFrameClient* client() const { return m_client; } - void dropClient() { m_client = 0; } + void setClient(WebFrameClient* client) { m_client = client; } static void selectWordAroundPosition(WebCore::Frame*, WebCore::VisiblePosition); @@ -267,7 +285,7 @@ private: // It is not necessary if the frame is invisible, for example, or if this // is a repeat search that already returned nothing last time the same prefix // was searched. - bool shouldScopeMatches(const WebCore::String& searchText); + bool shouldScopeMatches(const WTF::String& searchText); // Queue up a deferred call to scopeStringMatches. void scopeStringMatchesSoon( @@ -318,7 +336,7 @@ private: // short-circuiting searches in the following scenarios: When a frame has // been searched and returned 0 results, we don't need to search that frame // again if the user is just adding to the search (making it more specific). - WebCore::String m_lastSearchString; + WTF::String m_lastSearchString; // Keeps track of how many matches this frame has found so far, so that we // don't loose count between scoping efforts, and is also used (in conjunction diff --git a/WebKit/chromium/src/WebGeolocationServiceBridgeImpl.cpp b/WebKit/chromium/src/WebGeolocationServiceBridgeImpl.cpp new file mode 100644 index 0000000..3c3a1db --- /dev/null +++ b/WebKit/chromium/src/WebGeolocationServiceBridgeImpl.cpp @@ -0,0 +1,181 @@ +/* + * 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 "WebGeolocationServiceBridgeImpl.h" + +#include "Chrome.h" +#include "ChromeClientImpl.h" +#include "Frame.h" +#include "Geolocation.h" +#include "GeolocationServiceChromium.h" +#include "Geoposition.h" +#include "Page.h" +#include "PositionError.h" +#include "PositionOptions.h" +#include "WebFrame.h" +#include "WebFrameImpl.h" +#include "WebGeolocationService.h" +#include "WebGeolocationServiceBridge.h" +#include "WebViewClient.h" +#include "WebViewImpl.h" + +#if ENABLE(GEOLOCATION) + +using WebCore::Coordinates; +using WebCore::Frame; +using WebCore::Geolocation; +using WebCore::GeolocationServiceBridge; +using WebCore::GeolocationServiceChromium; +using WebCore::GeolocationServiceClient; +using WebCore::Geoposition; +using WebCore::PositionError; +using WebCore::PositionOptions; +using WTF::String; + +namespace WebKit { + +class WebGeolocationServiceBridgeImpl : public GeolocationServiceBridge, public WebGeolocationServiceBridge { +public: + explicit WebGeolocationServiceBridgeImpl(GeolocationServiceChromium*); + virtual ~WebGeolocationServiceBridgeImpl(); + + // GeolocationServiceBridge + virtual bool startUpdating(PositionOptions*); + virtual void stopUpdating(); + virtual void suspend(); + virtual void resume(); + virtual int getBridgeId() const; + virtual void attachBridgeIfNeeded(); + + // WebGeolocationServiceBridge + virtual void setIsAllowed(bool allowed); + virtual void setLastPosition(double latitude, double longitude, bool providesAltitude, double altitude, double accuracy, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed, long long timestamp); + virtual void setLastError(int errorCode, const WebString& message); + +private: + WebViewClient* getWebViewClient(); + + // GeolocationServiceChromium owns us, we only have a pointer back to it. + GeolocationServiceChromium* m_GeolocationServiceChromium; + int m_bridgeId; +}; + +GeolocationServiceBridge* createGeolocationServiceBridgeImpl(GeolocationServiceChromium* geolocationServiceChromium) +{ + return new WebGeolocationServiceBridgeImpl(geolocationServiceChromium); +} + +WebGeolocationServiceBridgeImpl::WebGeolocationServiceBridgeImpl(GeolocationServiceChromium* geolocationServiceChromium) + : m_GeolocationServiceChromium(geolocationServiceChromium) + , m_bridgeId(0) +{ +} + +WebGeolocationServiceBridgeImpl::~WebGeolocationServiceBridgeImpl() +{ + WebKit::WebViewClient* webViewClient = getWebViewClient(); + // Geolocation has an OwnPtr to us, and it's destroyed after the frame has + // been potentially disconnected. In this case, it calls stopUpdating() + // has been called and we have already detached ourselves. + if (!webViewClient) + ASSERT(!m_bridgeId); + else if (m_bridgeId) + webViewClient->geolocationService()->detachBridge(m_bridgeId); +} + +bool WebGeolocationServiceBridgeImpl::startUpdating(PositionOptions* positionOptions) +{ + attachBridgeIfNeeded(); + getWebViewClient()->geolocationService()->startUpdating(m_bridgeId, m_GeolocationServiceChromium->frame()->document()->url(), positionOptions->enableHighAccuracy()); + return true; +} + +void WebGeolocationServiceBridgeImpl::stopUpdating() +{ + WebViewClient* webViewClient = getWebViewClient(); + if (m_bridgeId && webViewClient) { + WebGeolocationService* geolocationService = webViewClient->geolocationService(); + geolocationService->stopUpdating(m_bridgeId); + geolocationService->detachBridge(m_bridgeId); + } + m_bridgeId = 0; +} + +void WebGeolocationServiceBridgeImpl::suspend() +{ + getWebViewClient()->geolocationService()->suspend(m_bridgeId); +} + +void WebGeolocationServiceBridgeImpl::resume() +{ + getWebViewClient()->geolocationService()->resume(m_bridgeId); +} + +int WebGeolocationServiceBridgeImpl::getBridgeId() const +{ + return m_bridgeId; +} + +void WebGeolocationServiceBridgeImpl::attachBridgeIfNeeded() +{ + if (!m_bridgeId) + m_bridgeId = getWebViewClient()->geolocationService()->attachBridge(this); +} + +void WebGeolocationServiceBridgeImpl::setIsAllowed(bool allowed) +{ + m_GeolocationServiceChromium->setIsAllowed(allowed); +} + +void WebGeolocationServiceBridgeImpl::setLastPosition(double latitude, double longitude, bool providesAltitude, double altitude, double accuracy, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed, long long timestamp) +{ + RefPtr<Geoposition> geoposition = Geoposition::create(Coordinates::create(latitude, longitude, providesAltitude, altitude, accuracy, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed), timestamp); + m_GeolocationServiceChromium->setLastPosition(geoposition); +} + +void WebGeolocationServiceBridgeImpl::setLastError(int errorCode, const WebString& message) +{ + m_GeolocationServiceChromium->setLastError(errorCode, message); +} + +WebViewClient* WebGeolocationServiceBridgeImpl::getWebViewClient() +{ + Frame* frame = m_GeolocationServiceChromium->frame(); + if (!frame || !frame->page()) + return 0; + WebKit::ChromeClientImpl* chromeClientImpl = static_cast<WebKit::ChromeClientImpl*>(frame->page()->chrome()->client()); + WebKit::WebViewClient* webViewClient = chromeClientImpl->webView()->client(); + return webViewClient; +} + +} // namespace WebKit + +#endif // ENABLE(GEOLOCATION) diff --git a/WebKit/chromium/src/WebGeolocationServiceBridgeImpl.h b/WebKit/chromium/src/WebGeolocationServiceBridgeImpl.h new file mode 100644 index 0000000..2c37bcb --- /dev/null +++ b/WebKit/chromium/src/WebGeolocationServiceBridgeImpl.h @@ -0,0 +1,43 @@ +/* + * 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 WebGeolocationServiceBridgeImpl_h +#define WebGeolocationServiceBridgeImpl_h + +namespace WebCore { +class GeolocationServiceBridge; +class GeolocationServiceChromium; +} + +namespace WebKit { +WebCore::GeolocationServiceBridge* createGeolocationServiceBridgeImpl(WebCore::GeolocationServiceChromium*); +} // namespace WebKit + +#endif // WebGeolocationServiceBridgeImpl_h diff --git a/WebKit/chromium/src/WebGeolocationServiceMock.cpp b/WebKit/chromium/src/WebGeolocationServiceMock.cpp new file mode 100644 index 0000000..2a10c96 --- /dev/null +++ b/WebKit/chromium/src/WebGeolocationServiceMock.cpp @@ -0,0 +1,188 @@ +/* + * 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 "WebGeolocationServiceMock.h" + +#include "GeolocationService.h" +#include "GeolocationServiceChromium.h" +#include "GeolocationServiceMock.h" +#include "WebString.h" +#include <wtf/CurrentTime.h> +#include <wtf/HashMap.h> + +#if ENABLE(GEOLOCATION) + +using WebCore::Coordinates; +using WebCore::Frame; +using WebCore::Geolocation; +using WebCore::GeolocationServiceBridge; +using WebCore::GeolocationServiceChromium; +using WebCore::GeolocationServiceClient; +using WebCore::GeolocationServiceMock; +using WebCore::Geoposition; +using WebCore::PositionError; +using WebCore::PositionOptions; +using WTF::String; + +namespace WebCore { +class GeolocationServiceChromiumMock : public GeolocationServiceChromium, public GeolocationServiceClient { +public: + static GeolocationService* create(GeolocationServiceClient*); + virtual bool startUpdating(PositionOptions*); + virtual void stopUpdating(); + virtual Geoposition* lastPosition() const; + virtual PositionError* lastError() const; + + virtual void geolocationServicePositionChanged(GeolocationService*); + virtual void geolocationServiceErrorOccurred(GeolocationService*); + +private: + explicit GeolocationServiceChromiumMock(GeolocationServiceClient*); + + GeolocationServiceClient* m_geolocationServiceClient; + OwnPtr<GeolocationService> m_geolocationServiceMock; +}; + +GeolocationService* GeolocationServiceChromiumMock::create(GeolocationServiceClient* geolocationServiceClient) +{ + return new GeolocationServiceChromiumMock(geolocationServiceClient); +} + +GeolocationServiceChromiumMock::GeolocationServiceChromiumMock(GeolocationServiceClient* geolocationServiceClient) + : GeolocationServiceChromium(geolocationServiceClient), + m_geolocationServiceClient(geolocationServiceClient) +{ + m_geolocationServiceMock.set(GeolocationServiceMock::create(this)); +} + +bool GeolocationServiceChromiumMock::startUpdating(PositionOptions* positionOptions) +{ + GeolocationServiceChromium::startUpdating(positionOptions); + return m_geolocationServiceMock->startUpdating(positionOptions); +} + +void GeolocationServiceChromiumMock::stopUpdating() +{ + GeolocationServiceChromium::stopUpdating(); + m_geolocationServiceMock->stopUpdating(); +} + +Geoposition* GeolocationServiceChromiumMock::lastPosition() const +{ + return m_geolocationServiceMock->lastPosition(); +} + +PositionError* GeolocationServiceChromiumMock::lastError() const +{ + return m_geolocationServiceMock->lastError(); +} + +void GeolocationServiceChromiumMock::geolocationServicePositionChanged(GeolocationService* geolocationService) +{ + ASSERT_UNUSED(geolocationService, geolocationService == m_geolocationServiceMock); + m_geolocationServiceClient->geolocationServicePositionChanged(this); + +} + +void GeolocationServiceChromiumMock::geolocationServiceErrorOccurred(GeolocationService* geolocationService) +{ + ASSERT_UNUSED(geolocationService, geolocationService == m_geolocationServiceMock); + m_geolocationServiceClient->geolocationServiceErrorOccurred(this); +} + +} // namespace WebCore + +namespace WebKit { + +class WebGeolocationServiceMockImpl : public WebGeolocationServiceMock { +public: + virtual ~WebGeolocationServiceMockImpl() { } + virtual void requestPermissionForFrame(int bridgeId, const WebURL& url); + virtual int attachBridge(WebGeolocationServiceBridge*); + virtual void detachBridge(int bridgeId); + +private: + typedef HashMap<int, WebGeolocationServiceBridge*> IdToBridgeMap; + IdToBridgeMap m_idToBridgeMap; +}; + +bool WebGeolocationServiceMock::s_mockGeolocationPermission = false; + +WebGeolocationServiceMock* WebGeolocationServiceMock::createWebGeolocationServiceMock() +{ + return new WebGeolocationServiceMockImpl; +} + +void WebGeolocationServiceMock::setMockGeolocationPermission(bool allowed) +{ + s_mockGeolocationPermission = allowed; +} + +void WebGeolocationServiceMock::setMockGeolocationPosition(double latitude, double longitude, double accuracy) +{ + WebCore::GeolocationService::setCustomMockFactory(&WebCore::GeolocationServiceChromiumMock::create); + RefPtr<Geoposition> geoposition = Geoposition::create(Coordinates::create(latitude, longitude, false, 0, accuracy, true, 0, false, 0, false, 0), currentTime() * 1000.0); + GeolocationServiceMock::setPosition(geoposition); +} + +void WebGeolocationServiceMock::setMockGeolocationError(int errorCode, const WebString& message) +{ + WebCore::GeolocationService::setCustomMockFactory(&WebCore::GeolocationServiceChromiumMock::create); + RefPtr<PositionError> positionError = PositionError::create(static_cast<PositionError::ErrorCode>(errorCode), message); + GeolocationServiceMock::setError(positionError); +} + +void WebGeolocationServiceMockImpl::requestPermissionForFrame(int bridgeId, const WebURL& url) +{ + IdToBridgeMap::iterator iter = m_idToBridgeMap.find(bridgeId); + if (iter == m_idToBridgeMap.end()) + return; + iter->second->setIsAllowed(s_mockGeolocationPermission); +} + +int WebGeolocationServiceMockImpl::attachBridge(WebGeolocationServiceBridge* bridge) +{ + static int nextAvailableWatchId = 1; + // In case of overflow, make sure the ID remains positive, but reuse the ID values. + if (nextAvailableWatchId < 1) + nextAvailableWatchId = 1; + m_idToBridgeMap.set(nextAvailableWatchId, bridge); + return nextAvailableWatchId++; +} + +void WebGeolocationServiceMockImpl::detachBridge(int bridgeId) +{ + m_idToBridgeMap.remove(bridgeId); +} + +} // namespace WebKit + +#endif // ENABLE(GEOLOCATION) diff --git a/WebKit/chromium/src/WebGraphicsContext3D.cpp b/WebKit/chromium/src/WebGraphicsContext3D.cpp new file mode 100644 index 0000000..ce6f55d --- /dev/null +++ b/WebKit/chromium/src/WebGraphicsContext3D.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebGraphicsContext3D.h" + +#include "WebGraphicsContext3DDefaultImpl.h" + +namespace WebKit { + +WebGraphicsContext3D* WebGraphicsContext3D::createDefault() +{ +#if ENABLE(3D_CANVAS) + return new WebGraphicsContext3DDefaultImpl(); +#else + return 0; +#endif +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp new file mode 100644 index 0000000..6e1adca --- /dev/null +++ b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp @@ -0,0 +1,1208 @@ +/* + * 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" + +#if ENABLE(3D_CANVAS) + +#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> + +namespace WebKit { + +WebGraphicsContext3DDefaultImpl::VertexAttribPointerState::VertexAttribPointerState() + : enabled(false) + , buffer(0) + , indx(0) + , size(0) + , type(0) + , normalized(false) + , stride(0) + , offset(0) +{ +} + +WebGraphicsContext3DDefaultImpl::WebGraphicsContext3DDefaultImpl() + : m_initialized(false) + , m_texture(0) + , m_fbo(0) + , m_depthStencilBuffer(0) + , m_multisampleFBO(0) + , m_multisampleDepthStencilBuffer(0) + , m_multisampleColorBuffer(0) + , m_boundFBO(0) +#ifdef FLIP_FRAMEBUFFER_VERTICALLY + , m_scanline(0) +#endif + , m_boundArrayBuffer(0) +{ +} + +WebGraphicsContext3DDefaultImpl::~WebGraphicsContext3DDefaultImpl() +{ + if (m_initialized) { + makeContextCurrent(); + + if (m_attributes.antialias) { + glDeleteRenderbuffersEXT(1, &m_multisampleColorBuffer); + if (m_attributes.depth || m_attributes.stencil) + glDeleteRenderbuffersEXT(1, &m_multisampleDepthStencilBuffer); + glDeleteFramebuffersEXT(1, &m_multisampleFBO); + } else { + if (m_attributes.depth || m_attributes.stencil) + glDeleteRenderbuffersEXT(1, &m_depthStencilBuffer); + } + glDeleteTextures(1, &m_texture); +#ifdef FLIP_FRAMEBUFFER_VERTICALLY + if (m_scanline) + delete[] m_scanline; +#endif + glDeleteFramebuffersEXT(1, &m_fbo); + + m_glContext->Destroy(); + } +} + +bool WebGraphicsContext3DDefaultImpl::initialize(WebGraphicsContext3D::Attributes attributes, WebView* webView) +{ + if (!gfx::GLContext::InitializeOneOff()) + return false; + + m_glContext = WTF::adoptPtr(gfx::GLContext::CreateOffscreenGLContext(0)); + if (!m_glContext) + return false; + + m_attributes = attributes; + validateAttributes(); + + glEnable(GL_VERTEX_PROGRAM_POINT_SIZE); + m_initialized = true; + return true; +} + +void WebGraphicsContext3DDefaultImpl::validateAttributes() +{ + const char* extensions = reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS)); + + if (m_attributes.stencil) { + if (strstr(extensions, "GL_EXT_packed_depth_stencil")) { + if (!m_attributes.depth) + m_attributes.depth = true; + } else + m_attributes.stencil = false; + } + if (m_attributes.antialias) { + bool isValidVendor = true; +#if PLATFORM(CG) + // Currently in Mac we only turn on antialias if vendor is NVIDIA. + const char* vendor = reinterpret_cast<const char*>(glGetString(GL_VENDOR)); + if (!strstr(vendor, "NVIDIA")) + isValidVendor = false; +#endif + if (!isValidVendor || !strstr(extensions, "GL_EXT_framebuffer_multisample")) + m_attributes.antialias = false; + } + // FIXME: instead of enforcing premultipliedAlpha = true, implement the + // correct behavior when premultipliedAlpha = false is requested. + m_attributes.premultipliedAlpha = true; +} + +bool WebGraphicsContext3DDefaultImpl::makeContextCurrent() +{ + return m_glContext->MakeCurrent(); +} + +int WebGraphicsContext3DDefaultImpl::width() +{ + return m_cachedWidth; +} + +int WebGraphicsContext3DDefaultImpl::height() +{ + return m_cachedHeight; +} + +int WebGraphicsContext3DDefaultImpl::sizeInBytes(int type) +{ + switch (type) { + case GL_BYTE: + return sizeof(GLbyte); + case GL_UNSIGNED_BYTE: + return sizeof(GLubyte); + case GL_SHORT: + return sizeof(GLshort); + case GL_UNSIGNED_SHORT: + return sizeof(GLushort); + case GL_INT: + return sizeof(GLint); + case GL_UNSIGNED_INT: + return sizeof(GLuint); + case GL_FLOAT: + return sizeof(GLfloat); + } + return 0; +} + +bool WebGraphicsContext3DDefaultImpl::isGLES2Compliant() +{ + return false; +} + +bool WebGraphicsContext3DDefaultImpl::isGLES2NPOTStrict() +{ + return false; +} + +bool WebGraphicsContext3DDefaultImpl::isErrorGeneratedOnOutOfBoundsAccesses() +{ + return false; +} + +unsigned int WebGraphicsContext3DDefaultImpl::getPlatformTextureId() +{ + ASSERT_NOT_REACHED(); + return 0; +} + +void WebGraphicsContext3DDefaultImpl::prepareTexture() +{ + ASSERT_NOT_REACHED(); +} + +static int createTextureObject(GLenum target) +{ + GLuint texture = 0; + glGenTextures(1, &texture); + glBindTexture(target, texture); + glTexParameterf(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameterf(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + return texture; +} + +void WebGraphicsContext3DDefaultImpl::reshape(int width, int height) +{ + m_cachedWidth = width; + m_cachedHeight = height; + makeContextCurrent(); + + GLenum target = GL_TEXTURE_2D; + + if (!m_texture) { + // Generate the texture object + m_texture = createTextureObject(target); + // Generate the framebuffer object + glGenFramebuffersEXT(1, &m_fbo); + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo); + m_boundFBO = m_fbo; + if (m_attributes.depth || m_attributes.stencil) + glGenRenderbuffersEXT(1, &m_depthStencilBuffer); + // Generate the multisample framebuffer object + if (m_attributes.antialias) { + glGenFramebuffersEXT(1, &m_multisampleFBO); + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_multisampleFBO); + m_boundFBO = m_multisampleFBO; + glGenRenderbuffersEXT(1, &m_multisampleColorBuffer); + if (m_attributes.depth || m_attributes.stencil) + glGenRenderbuffersEXT(1, &m_multisampleDepthStencilBuffer); + } + } + + GLint internalColorFormat, colorFormat, internalDepthStencilFormat = 0; + if (m_attributes.alpha) { + internalColorFormat = GL_RGBA8; + colorFormat = GL_RGBA; + } else { + internalColorFormat = GL_RGB8; + colorFormat = GL_RGB; + } + if (m_attributes.stencil || m_attributes.depth) { + // We don't allow the logic where stencil is required and depth is not. + // See GraphicsContext3DInternal constructor. + if (m_attributes.stencil && m_attributes.depth) + internalDepthStencilFormat = GL_DEPTH24_STENCIL8_EXT; + else + internalDepthStencilFormat = GL_DEPTH_COMPONENT; + } + + bool mustRestoreFBO = false; + + // Resize multisampling FBO + if (m_attributes.antialias) { + GLint maxSampleCount; + glGetIntegerv(GL_MAX_SAMPLES_EXT, &maxSampleCount); + GLint sampleCount = std::min(8, maxSampleCount); + if (m_boundFBO != m_multisampleFBO) { + mustRestoreFBO = true; + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_multisampleFBO); + } + glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, m_multisampleColorBuffer); + glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, sampleCount, internalColorFormat, width, height); + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_EXT, m_multisampleColorBuffer); + if (m_attributes.stencil || m_attributes.depth) { + glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, m_multisampleDepthStencilBuffer); + glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, sampleCount, internalDepthStencilFormat, width, height); + if (m_attributes.stencil) + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, m_multisampleDepthStencilBuffer); + if (m_attributes.depth) + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, m_multisampleDepthStencilBuffer); + } + glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0); + GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); + if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { + printf("GraphicsContext3D: multisampling framebuffer was incomplete\n"); + + // FIXME: cleanup. + notImplemented(); + } + } + + // Resize regular FBO + if (m_boundFBO != m_fbo) { + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo); + mustRestoreFBO = true; + } + glBindTexture(target, m_texture); + glTexImage2D(target, 0, internalColorFormat, width, height, 0, colorFormat, GL_UNSIGNED_BYTE, 0); + glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, target, m_texture, 0); + glBindTexture(target, 0); + if (!m_attributes.antialias && (m_attributes.stencil || m_attributes.depth)) { + glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, m_depthStencilBuffer); + glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, internalDepthStencilFormat, width, height); + if (m_attributes.stencil) + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, m_depthStencilBuffer); + if (m_attributes.depth) + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, m_depthStencilBuffer); + glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0); + } + GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); + if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { + printf("WebGraphicsContext3DDefaultImpl: framebuffer was incomplete\n"); + + // FIXME: cleanup. + notImplemented(); + } + + if (m_attributes.antialias) { + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_multisampleFBO); + if (m_boundFBO == m_multisampleFBO) + mustRestoreFBO = false; + } + + // Initialize renderbuffers to 0. + GLboolean colorMask[] = {GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE}, depthMask = GL_TRUE, stencilMask = GL_TRUE; + GLboolean isScissorEnabled = GL_FALSE; + GLboolean isDitherEnabled = GL_FALSE; + GLbitfield clearMask = GL_COLOR_BUFFER_BIT; + glGetBooleanv(GL_COLOR_WRITEMASK, colorMask); + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + if (m_attributes.depth) { + glGetBooleanv(GL_DEPTH_WRITEMASK, &depthMask); + glDepthMask(GL_TRUE); + clearMask |= GL_DEPTH_BUFFER_BIT; + } + if (m_attributes.stencil) { + glGetBooleanv(GL_STENCIL_WRITEMASK, &stencilMask); + glStencilMask(GL_TRUE); + clearMask |= GL_STENCIL_BUFFER_BIT; + } + isScissorEnabled = glIsEnabled(GL_SCISSOR_TEST); + glDisable(GL_SCISSOR_TEST); + isDitherEnabled = glIsEnabled(GL_DITHER); + glDisable(GL_DITHER); + + glClear(clearMask); + + glColorMask(colorMask[0], colorMask[1], colorMask[2], colorMask[3]); + if (m_attributes.depth) + glDepthMask(depthMask); + if (m_attributes.stencil) + glStencilMask(stencilMask); + if (isScissorEnabled) + glEnable(GL_SCISSOR_TEST); + else + glDisable(GL_SCISSOR_TEST); + if (isDitherEnabled) + glEnable(GL_DITHER); + else + glDisable(GL_DITHER); + + if (mustRestoreFBO) + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_boundFBO); + +#ifdef FLIP_FRAMEBUFFER_VERTICALLY + if (m_scanline) { + delete[] m_scanline; + m_scanline = 0; + } + m_scanline = new unsigned char[width * 4]; +#endif // FLIP_FRAMEBUFFER_VERTICALLY +} + +#ifdef FLIP_FRAMEBUFFER_VERTICALLY +void WebGraphicsContext3DDefaultImpl::flipVertically(unsigned char* framebuffer, + unsigned int width, + unsigned int height) +{ + unsigned char* scanline = m_scanline; + if (!scanline) + return; + unsigned int rowBytes = width * 4; + unsigned int count = height / 2; + for (unsigned int i = 0; i < count; i++) { + unsigned char* rowA = framebuffer + i * rowBytes; + unsigned char* rowB = framebuffer + (height - i - 1) * rowBytes; + // FIXME: this is where the multiplication of the alpha + // channel into the color buffer will need to occur if the + // user specifies the "premultiplyAlpha" flag in the context + // creation attributes. + memcpy(scanline, rowB, rowBytes); + memcpy(rowB, rowA, rowBytes); + memcpy(rowA, scanline, rowBytes); + } +} +#endif + +bool WebGraphicsContext3DDefaultImpl::readBackFramebuffer(unsigned char* pixels, size_t bufferSize) +{ + if (bufferSize != static_cast<size_t>(4 * width() * height())) + return false; + + makeContextCurrent(); + + // 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 + // GPU memory, and didn't provide an obvious speedup. Since this + // vertical flip is only a temporary solution anyway until Chrome + // is fully GPU composited, it wasn't worth the complexity. + + bool mustRestoreFBO = false; + if (m_attributes.antialias) { + glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, m_multisampleFBO); + glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, m_fbo); + glBlitFramebufferEXT(0, 0, m_cachedWidth, m_cachedHeight, 0, 0, m_cachedWidth, m_cachedHeight, GL_COLOR_BUFFER_BIT, GL_LINEAR); + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo); + mustRestoreFBO = true; + } else { + if (m_boundFBO != m_fbo) { + mustRestoreFBO = true; + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo); + } + } + + GLint packAlignment = 4; + bool mustRestorePackAlignment = false; + glGetIntegerv(GL_PACK_ALIGNMENT, &packAlignment); + if (packAlignment > 4) { + glPixelStorei(GL_PACK_ALIGNMENT, 4); + mustRestorePackAlignment = true; + } + + // 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); + + if (mustRestorePackAlignment) + glPixelStorei(GL_PACK_ALIGNMENT, packAlignment); + + if (mustRestoreFBO) + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_boundFBO); + +#ifdef FLIP_FRAMEBUFFER_VERTICALLY + if (pixels) + flipVertically(pixels, m_cachedWidth, m_cachedHeight); +#endif + + return true; +} + +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) \ +void WebGraphicsContext3DDefaultImpl::name() \ +{ \ + makeContextCurrent(); \ + gl##glname(); \ +} + +#define DELEGATE_TO_GL_1(name, glname, t1) \ +void WebGraphicsContext3DDefaultImpl::name(t1 a1) \ +{ \ + makeContextCurrent(); \ + gl##glname(a1); \ +} + +#define DELEGATE_TO_GL_1R(name, glname, t1, rt) \ +rt WebGraphicsContext3DDefaultImpl::name(t1 a1) \ +{ \ + makeContextCurrent(); \ + return gl##glname(a1); \ +} + +#define DELEGATE_TO_GL_2(name, glname, t1, t2) \ +void WebGraphicsContext3DDefaultImpl::name(t1 a1, t2 a2) \ +{ \ + makeContextCurrent(); \ + gl##glname(a1, a2); \ +} + +#define DELEGATE_TO_GL_2R(name, glname, t1, t2, rt) \ +rt WebGraphicsContext3DDefaultImpl::name(t1 a1, t2 a2) \ +{ \ + makeContextCurrent(); \ + return gl##glname(a1, a2); \ +} + +#define DELEGATE_TO_GL_3(name, glname, t1, t2, t3) \ +void WebGraphicsContext3DDefaultImpl::name(t1 a1, t2 a2, t3 a3) \ +{ \ + makeContextCurrent(); \ + gl##glname(a1, a2, a3); \ +} + +#define DELEGATE_TO_GL_4(name, glname, t1, t2, t3, t4) \ +void WebGraphicsContext3DDefaultImpl::name(t1 a1, t2 a2, t3 a3, t4 a4) \ +{ \ + makeContextCurrent(); \ + gl##glname(a1, a2, a3, a4); \ +} + +#define DELEGATE_TO_GL_5(name, glname, t1, t2, t3, t4, t5) \ +void WebGraphicsContext3DDefaultImpl::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5) \ +{ \ + makeContextCurrent(); \ + gl##glname(a1, a2, a3, a4, a5); \ +} + +#define DELEGATE_TO_GL_6(name, glname, t1, t2, t3, t4, t5, t6) \ +void WebGraphicsContext3DDefaultImpl::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6) \ +{ \ + makeContextCurrent(); \ + gl##glname(a1, a2, a3, a4, a5, a6); \ +} + +#define DELEGATE_TO_GL_7(name, glname, t1, t2, t3, t4, t5, t6, t7) \ +void WebGraphicsContext3DDefaultImpl::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6, t7 a7) \ +{ \ + makeContextCurrent(); \ + gl##glname(a1, a2, a3, a4, a5, a6, a7); \ +} + +#define DELEGATE_TO_GL_8(name, glname, t1, t2, t3, t4, t5, t6, t7, t8) \ +void WebGraphicsContext3DDefaultImpl::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6, t7 a7, t8 a8) \ +{ \ + makeContextCurrent(); \ + gl##glname(a1, a2, a3, a4, a5, a6, a7, a8); \ +} + +#define DELEGATE_TO_GL_9(name, glname, t1, t2, t3, t4, t5, t6, t7, t8, t9) \ +void WebGraphicsContext3DDefaultImpl::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6, t7 a7, t8 a8, t9 a9) \ +{ \ + makeContextCurrent(); \ + gl##glname(a1, a2, a3, a4, a5, a6, a7, a8, a9); \ +} + +void WebGraphicsContext3DDefaultImpl::activeTexture(unsigned long texture) +{ + // FIXME: query number of textures available. + if (texture < GL_TEXTURE0 || texture > GL_TEXTURE0+32) + // FIXME: raise exception. + return; + + makeContextCurrent(); + glActiveTexture(texture); +} + +DELEGATE_TO_GL_2(attachShader, AttachShader, WebGLId, WebGLId) + +DELEGATE_TO_GL_3(bindAttribLocation, BindAttribLocation, WebGLId, unsigned long, const char*) + +void WebGraphicsContext3DDefaultImpl::bindBuffer(unsigned long target, WebGLId buffer) +{ + makeContextCurrent(); + if (target == GL_ARRAY_BUFFER) + m_boundArrayBuffer = buffer; + glBindBuffer(target, buffer); +} + +void WebGraphicsContext3DDefaultImpl::bindFramebuffer(unsigned long target, WebGLId framebuffer) +{ + makeContextCurrent(); + if (!framebuffer) + framebuffer = (m_attributes.antialias ? m_multisampleFBO : m_fbo); + if (framebuffer != m_boundFBO) { + glBindFramebufferEXT(target, framebuffer); + m_boundFBO = framebuffer; + } +} + +DELEGATE_TO_GL_2(bindRenderbuffer, BindRenderbufferEXT, unsigned long, WebGLId) + +DELEGATE_TO_GL_2(bindTexture, BindTexture, unsigned long, WebGLId) + +DELEGATE_TO_GL_4(blendColor, BlendColor, double, double, double, double) + +DELEGATE_TO_GL_1(blendEquation, BlendEquation, unsigned long) + +DELEGATE_TO_GL_2(blendEquationSeparate, BlendEquationSeparate, unsigned long, unsigned long) + +DELEGATE_TO_GL_2(blendFunc, BlendFunc, unsigned long, unsigned long) + +DELEGATE_TO_GL_4(blendFuncSeparate, BlendFuncSeparate, unsigned long, unsigned long, unsigned long, unsigned long) + +DELEGATE_TO_GL_4(bufferData, BufferData, unsigned long, int, const void*, unsigned long) + +DELEGATE_TO_GL_4(bufferSubData, BufferSubData, unsigned long, long, int, const void*) + +DELEGATE_TO_GL_1R(checkFramebufferStatus, CheckFramebufferStatusEXT, unsigned long, unsigned long) + +DELEGATE_TO_GL_1(clear, Clear, unsigned long) + +DELEGATE_TO_GL_4(clearColor, ClearColor, double, double, double, double) + +DELEGATE_TO_GL_1(clearDepth, ClearDepth, double) + +DELEGATE_TO_GL_1(clearStencil, ClearStencil, long) + +DELEGATE_TO_GL_4(colorMask, ColorMask, bool, bool, bool, bool) + +DELEGATE_TO_GL_1(compileShader, CompileShader, WebGLId) + +void WebGraphicsContext3DDefaultImpl::copyTexImage2D(unsigned long target, long level, unsigned long internalformat, + long x, long y, unsigned long width, unsigned long height, long border) +{ + makeContextCurrent(); + + 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); + } + + glCopyTexImage2D(target, level, internalformat, x, y, width, height, border); + + if (m_attributes.antialias && m_boundFBO == m_multisampleFBO) + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_boundFBO); +} + +void WebGraphicsContext3DDefaultImpl::copyTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, + long x, long y, unsigned long width, unsigned long height) +{ + makeContextCurrent(); + + 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); + } + + glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); + + if (m_attributes.antialias && m_boundFBO == m_multisampleFBO) + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_boundFBO); +} + +DELEGATE_TO_GL_1(cullFace, CullFace, unsigned long) + +DELEGATE_TO_GL_1(depthFunc, DepthFunc, unsigned long) + +DELEGATE_TO_GL_1(depthMask, DepthMask, bool) + +DELEGATE_TO_GL_2(depthRange, DepthRange, double, double) + +DELEGATE_TO_GL_2(detachShader, DetachShader, WebGLId, WebGLId) + +DELEGATE_TO_GL_1(disable, Disable, unsigned long) + +void WebGraphicsContext3DDefaultImpl::disableVertexAttribArray(unsigned long index) +{ + makeContextCurrent(); + if (index < NumTrackedPointerStates) + m_vertexAttribPointerState[index].enabled = false; + glDisableVertexAttribArray(index); +} + +DELEGATE_TO_GL_3(drawArrays, DrawArrays, unsigned long, long, long) + +void WebGraphicsContext3DDefaultImpl::drawElements(unsigned long mode, unsigned long count, unsigned long type, long offset) +{ + makeContextCurrent(); + glDrawElements(mode, count, type, + reinterpret_cast<void*>(static_cast<intptr_t>(offset))); +} + +DELEGATE_TO_GL_1(enable, Enable, unsigned long) + +void WebGraphicsContext3DDefaultImpl::enableVertexAttribArray(unsigned long index) +{ + makeContextCurrent(); + if (index < NumTrackedPointerStates) + m_vertexAttribPointerState[index].enabled = true; + glEnableVertexAttribArray(index); +} + +DELEGATE_TO_GL(finish, Finish) + +DELEGATE_TO_GL(flush, Flush) + +void WebGraphicsContext3DDefaultImpl::framebufferRenderbuffer(unsigned long target, unsigned long attachment, + unsigned long renderbuffertarget, WebGLId buffer) +{ + makeContextCurrent(); + if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) { + glFramebufferRenderbufferEXT(target, GL_DEPTH_ATTACHMENT, renderbuffertarget, buffer); + glFramebufferRenderbufferEXT(target, GL_STENCIL_ATTACHMENT, renderbuffertarget, buffer); + } else + glFramebufferRenderbufferEXT(target, attachment, renderbuffertarget, buffer); +} + +DELEGATE_TO_GL_5(framebufferTexture2D, FramebufferTexture2DEXT, unsigned long, unsigned long, unsigned long, WebGLId, long) + +DELEGATE_TO_GL_1(frontFace, FrontFace, unsigned long) + +void WebGraphicsContext3DDefaultImpl::generateMipmap(unsigned long target) +{ + makeContextCurrent(); + if (glGenerateMipmapEXT) + glGenerateMipmapEXT(target); + // FIXME: provide alternative code path? This will be unpleasant + // to implement if glGenerateMipmapEXT is not available -- it will + // require a texture readback and re-upload. +} + +bool WebGraphicsContext3DDefaultImpl::getActiveAttrib(WebGLId program, unsigned long index, ActiveInfo& info) +{ + makeContextCurrent(); + if (!program) { + synthesizeGLError(GL_INVALID_VALUE); + return false; + } + GLint maxNameLength = -1; + glGetProgramiv(program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &maxNameLength); + if (maxNameLength < 0) + return false; + GLchar* name = 0; + if (!tryFastMalloc(maxNameLength * sizeof(GLchar)).getValue(name)) { + synthesizeGLError(GL_OUT_OF_MEMORY); + return false; + } + GLsizei length = 0; + GLint size = -1; + GLenum type = 0; + glGetActiveAttrib(program, index, maxNameLength, + &length, &size, &type, name); + if (size < 0) { + fastFree(name); + return false; + } + info.name = WebString::fromUTF8(name, length); + info.type = type; + info.size = size; + fastFree(name); + return true; +} + +bool WebGraphicsContext3DDefaultImpl::getActiveUniform(WebGLId program, unsigned long index, ActiveInfo& info) +{ + makeContextCurrent(); + GLint maxNameLength = -1; + glGetProgramiv(program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxNameLength); + if (maxNameLength < 0) + return false; + GLchar* name = 0; + if (!tryFastMalloc(maxNameLength * sizeof(GLchar)).getValue(name)) { + synthesizeGLError(GL_OUT_OF_MEMORY); + return false; + } + GLsizei length = 0; + GLint size = -1; + GLenum type = 0; + glGetActiveUniform(program, index, maxNameLength, + &length, &size, &type, name); + if (size < 0) { + fastFree(name); + return false; + } + info.name = WebString::fromUTF8(name, length); + info.type = type; + info.size = size; + fastFree(name); + return true; +} + +DELEGATE_TO_GL_4(getAttachedShaders, GetAttachedShaders, WebGLId, int, int*, unsigned int*) + +DELEGATE_TO_GL_2R(getAttribLocation, GetAttribLocation, WebGLId, const char*, int) + +DELEGATE_TO_GL_2(getBooleanv, GetBooleanv, unsigned long, unsigned char*) + +DELEGATE_TO_GL_3(getBufferParameteriv, GetBufferParameteriv, unsigned long, unsigned long, int*) + +WebGraphicsContext3D::Attributes WebGraphicsContext3DDefaultImpl::getContextAttributes() +{ + return m_attributes; +} + +unsigned long WebGraphicsContext3DDefaultImpl::getError() +{ + if (m_syntheticErrors.size() > 0) { + ListHashSet<unsigned long>::iterator iter = m_syntheticErrors.begin(); + unsigned long err = *iter; + m_syntheticErrors.remove(iter); + return err; + } + + makeContextCurrent(); + return glGetError(); +} + +DELEGATE_TO_GL_2(getFloatv, GetFloatv, unsigned long, float*) + +void WebGraphicsContext3DDefaultImpl::getFramebufferAttachmentParameteriv(unsigned long target, unsigned long attachment, + unsigned long pname, int* value) +{ + makeContextCurrent(); + if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) + attachment = GL_DEPTH_ATTACHMENT; // Or GL_STENCIL_ATTACHMENT, either works. + glGetFramebufferAttachmentParameterivEXT(target, attachment, pname, value); +} + +void WebGraphicsContext3DDefaultImpl::getIntegerv(unsigned long pname, int* value) +{ + // Need to emulate IMPLEMENTATION_COLOR_READ_FORMAT/TYPE for GL. Any valid + // combination should work, but GL_RGB/GL_UNSIGNED_BYTE might be the most + // useful for desktop WebGL users. + // Need to emulate MAX_FRAGMENT/VERTEX_UNIFORM_VECTORS and MAX_VARYING_VECTORS + // because desktop GL's corresponding queries return the number of components + // whereas GLES2 return the number of vectors (each vector has 4 components). + // Therefore, the value returned by desktop GL needs to be divided by 4. + makeContextCurrent(); + switch (pname) { + case 0x8B9B: // IMPLEMENTATION_COLOR_READ_FORMAT + *value = GL_RGB; + break; + case 0x8B9A: // IMPLEMENTATION_COLOR_READ_TYPE + *value = GL_UNSIGNED_BYTE; + break; + case 0x8DFD: // MAX_FRAGMENT_UNIFORM_VECTORS + glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, value); + *value /= 4; + break; + case 0x8DFB: // MAX_VERTEX_UNIFORM_VECTORS + glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS, value); + *value /= 4; + break; + case 0x8DFC: // MAX_VARYING_VECTORS + glGetIntegerv(GL_MAX_VARYING_FLOATS, value); + *value /= 4; + break; + default: + glGetIntegerv(pname, value); + } +} + +DELEGATE_TO_GL_3(getProgramiv, GetProgramiv, WebGLId, unsigned long, int*) + +WebString WebGraphicsContext3DDefaultImpl::getProgramInfoLog(WebGLId program) +{ + makeContextCurrent(); + GLint logLength; + glGetProgramiv(program, GL_INFO_LOG_LENGTH, &logLength); + if (!logLength) + return WebString(); + GLchar* log = 0; + if (!tryFastMalloc(logLength * sizeof(GLchar)).getValue(log)) + return WebString(); + GLsizei returnedLogLength; + glGetProgramInfoLog(program, logLength, &returnedLogLength, log); + ASSERT(logLength == returnedLogLength + 1); + WebString res = WebString::fromUTF8(log, returnedLogLength); + fastFree(log); + return res; +} + +DELEGATE_TO_GL_3(getRenderbufferParameteriv, GetRenderbufferParameterivEXT, unsigned long, unsigned long, int*) + +DELEGATE_TO_GL_3(getShaderiv, GetShaderiv, WebGLId, unsigned long, int*) + +WebString WebGraphicsContext3DDefaultImpl::getShaderInfoLog(WebGLId shader) +{ + makeContextCurrent(); + GLint logLength; + glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &logLength); + if (!logLength) + return WebString(); + GLchar* log = 0; + if (!tryFastMalloc(logLength * sizeof(GLchar)).getValue(log)) + return WebString(); + GLsizei returnedLogLength; + glGetShaderInfoLog(shader, logLength, &returnedLogLength, log); + ASSERT(logLength == returnedLogLength + 1); + WebString res = WebString::fromUTF8(log, returnedLogLength); + fastFree(log); + return res; +} + +WebString WebGraphicsContext3DDefaultImpl::getShaderSource(WebGLId shader) +{ + makeContextCurrent(); + GLint logLength; + glGetShaderiv(shader, GL_SHADER_SOURCE_LENGTH, &logLength); + if (!logLength) + return WebString(); + GLchar* log = 0; + if (!tryFastMalloc(logLength * sizeof(GLchar)).getValue(log)) + return WebString(); + GLsizei returnedLogLength; + glGetShaderSource(shader, logLength, &returnedLogLength, log); + ASSERT(logLength == returnedLogLength + 1); + WebString res = WebString::fromUTF8(log, returnedLogLength); + fastFree(log); + return res; +} + +WebString WebGraphicsContext3DDefaultImpl::getString(unsigned long name) +{ + makeContextCurrent(); + return WebString::fromUTF8(reinterpret_cast<const char*>(glGetString(name))); +} + +DELEGATE_TO_GL_3(getTexParameterfv, GetTexParameterfv, unsigned long, unsigned long, float*) + +DELEGATE_TO_GL_3(getTexParameteriv, GetTexParameteriv, unsigned long, unsigned long, int*) + +DELEGATE_TO_GL_3(getUniformfv, GetUniformfv, WebGLId, long, float*) + +DELEGATE_TO_GL_3(getUniformiv, GetUniformiv, WebGLId, long, int*) + +DELEGATE_TO_GL_2R(getUniformLocation, GetUniformLocation, WebGLId, const char*, long) + +DELEGATE_TO_GL_3(getVertexAttribfv, GetVertexAttribfv, unsigned long, unsigned long, float*) + +DELEGATE_TO_GL_3(getVertexAttribiv, GetVertexAttribiv, unsigned long, unsigned long, int*) + +long WebGraphicsContext3DDefaultImpl::getVertexAttribOffset(unsigned long index, unsigned long pname) +{ + makeContextCurrent(); + void* pointer; + glGetVertexAttribPointerv(index, pname, &pointer); + return reinterpret_cast<long>(pointer); +} + +DELEGATE_TO_GL_2(hint, Hint, unsigned long, unsigned long) + +DELEGATE_TO_GL_1R(isBuffer, IsBuffer, WebGLId, bool) + +DELEGATE_TO_GL_1R(isEnabled, IsEnabled, unsigned long, bool) + +DELEGATE_TO_GL_1R(isFramebuffer, IsFramebufferEXT, WebGLId, bool) + +DELEGATE_TO_GL_1R(isProgram, IsProgram, WebGLId, bool) + +DELEGATE_TO_GL_1R(isRenderbuffer, IsRenderbufferEXT, WebGLId, bool) + +DELEGATE_TO_GL_1R(isShader, IsShader, WebGLId, bool) + +DELEGATE_TO_GL_1R(isTexture, IsTexture, WebGLId, bool) + +DELEGATE_TO_GL_1(lineWidth, LineWidth, double) + +DELEGATE_TO_GL_1(linkProgram, LinkProgram, WebGLId) + +DELEGATE_TO_GL_2(pixelStorei, PixelStorei, unsigned long, long) + +DELEGATE_TO_GL_2(polygonOffset, PolygonOffset, double, double) + +void WebGraphicsContext3DDefaultImpl::readPixels(long x, long y, unsigned long width, unsigned long height, unsigned long format, unsigned long type, void* pixels) +{ + makeContextCurrent(); + // 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(); + 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); + glFlush(); + } + + glReadPixels(x, y, width, height, format, type, pixels); + + if (m_attributes.antialias && m_boundFBO == m_multisampleFBO) + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_boundFBO); +} + +void WebGraphicsContext3DDefaultImpl::releaseShaderCompiler() +{ +} + +void WebGraphicsContext3DDefaultImpl::renderbufferStorage(unsigned long target, + unsigned long internalformat, + unsigned long width, + unsigned long height) +{ + makeContextCurrent(); + switch (internalformat) { + case GL_DEPTH_STENCIL: + internalformat = GL_DEPTH24_STENCIL8_EXT; + break; + case GL_DEPTH_COMPONENT16: + internalformat = GL_DEPTH_COMPONENT; + break; + case GL_RGBA4: + case GL_RGB5_A1: + internalformat = GL_RGBA; + break; + case 0x8D62: // GL_RGB565 + internalformat = GL_RGB; + break; + } + glRenderbufferStorageEXT(target, internalformat, width, height); +} + +DELEGATE_TO_GL_2(sampleCoverage, SampleCoverage, double, bool) + +DELEGATE_TO_GL_4(scissor, Scissor, long, long, unsigned long, unsigned long) + +void WebGraphicsContext3DDefaultImpl::shaderSource(WebGLId shader, const char* string) +{ + makeContextCurrent(); + GLint length = strlen(string); + glShaderSource(shader, 1, &string, &length); +} + +DELEGATE_TO_GL_3(stencilFunc, StencilFunc, unsigned long, long, unsigned long) + +DELEGATE_TO_GL_4(stencilFuncSeparate, StencilFuncSeparate, unsigned long, unsigned long, long, unsigned long) + +DELEGATE_TO_GL_1(stencilMask, StencilMask, unsigned long) + +DELEGATE_TO_GL_2(stencilMaskSeparate, StencilMaskSeparate, unsigned long, unsigned long) + +DELEGATE_TO_GL_3(stencilOp, StencilOp, unsigned long, unsigned long, unsigned long) + +DELEGATE_TO_GL_4(stencilOpSeparate, StencilOpSeparate, unsigned long, unsigned long, unsigned long, unsigned long) + +DELEGATE_TO_GL_9(texImage2D, TexImage2D, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned, const void*) + +DELEGATE_TO_GL_3(texParameterf, TexParameterf, unsigned, unsigned, float); + +DELEGATE_TO_GL_3(texParameteri, TexParameteri, unsigned, unsigned, int); + +DELEGATE_TO_GL_9(texSubImage2D, TexSubImage2D, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned, const void*) + +DELEGATE_TO_GL_2(uniform1f, Uniform1f, long, float) + +DELEGATE_TO_GL_3(uniform1fv, Uniform1fv, long, int, float*) + +DELEGATE_TO_GL_2(uniform1i, Uniform1i, long, int) + +DELEGATE_TO_GL_3(uniform1iv, Uniform1iv, long, int, int*) + +DELEGATE_TO_GL_3(uniform2f, Uniform2f, long, float, float) + +DELEGATE_TO_GL_3(uniform2fv, Uniform2fv, long, int, float*) + +DELEGATE_TO_GL_3(uniform2i, Uniform2i, long, int, int) + +DELEGATE_TO_GL_3(uniform2iv, Uniform2iv, long, int, int*) + +DELEGATE_TO_GL_4(uniform3f, Uniform3f, long, float, float, float) + +DELEGATE_TO_GL_3(uniform3fv, Uniform3fv, long, int, float*) + +DELEGATE_TO_GL_4(uniform3i, Uniform3i, long, int, int, int) + +DELEGATE_TO_GL_3(uniform3iv, Uniform3iv, long, int, int*) + +DELEGATE_TO_GL_5(uniform4f, Uniform4f, long, float, float, float, float) + +DELEGATE_TO_GL_3(uniform4fv, Uniform4fv, long, int, float*) + +DELEGATE_TO_GL_5(uniform4i, Uniform4i, long, int, int, int, int) + +DELEGATE_TO_GL_3(uniform4iv, Uniform4iv, long, int, int*) + +DELEGATE_TO_GL_4(uniformMatrix2fv, UniformMatrix2fv, long, int, bool, const float*) + +DELEGATE_TO_GL_4(uniformMatrix3fv, UniformMatrix3fv, long, int, bool, const float*) + +DELEGATE_TO_GL_4(uniformMatrix4fv, UniformMatrix4fv, long, int, bool, const float*) + +DELEGATE_TO_GL_1(useProgram, UseProgram, WebGLId) + +DELEGATE_TO_GL_1(validateProgram, ValidateProgram, WebGLId) + +DELEGATE_TO_GL_2(vertexAttrib1f, VertexAttrib1f, unsigned long, float) + +DELEGATE_TO_GL_2(vertexAttrib1fv, VertexAttrib1fv, unsigned long, const float*) + +DELEGATE_TO_GL_3(vertexAttrib2f, VertexAttrib2f, unsigned long, float, float) + +DELEGATE_TO_GL_2(vertexAttrib2fv, VertexAttrib2fv, unsigned long, const float*) + +DELEGATE_TO_GL_4(vertexAttrib3f, VertexAttrib3f, unsigned long, float, float, float) + +DELEGATE_TO_GL_2(vertexAttrib3fv, VertexAttrib3fv, unsigned long, const float*) + +DELEGATE_TO_GL_5(vertexAttrib4f, VertexAttrib4f, unsigned long, float, float, float, float) + +DELEGATE_TO_GL_2(vertexAttrib4fv, VertexAttrib4fv, unsigned long, const float*) + +void WebGraphicsContext3DDefaultImpl::vertexAttribPointer(unsigned long indx, int size, int type, bool normalized, + unsigned long stride, unsigned long offset) +{ + makeContextCurrent(); + + if (m_boundArrayBuffer <= 0) { + // FIXME: raise exception. + // LogMessagef(("bufferData: no buffer bound")); + return; + } + + if (indx < NumTrackedPointerStates) { + VertexAttribPointerState& state = m_vertexAttribPointerState[indx]; + state.buffer = m_boundArrayBuffer; + state.indx = indx; + state.size = size; + state.type = type; + state.normalized = normalized; + state.stride = stride; + state.offset = offset; + } + + glVertexAttribPointer(indx, size, type, normalized, stride, + reinterpret_cast<void*>(static_cast<intptr_t>(offset))); +} + +DELEGATE_TO_GL_4(viewport, Viewport, long, long, unsigned long, unsigned long) + +unsigned WebGraphicsContext3DDefaultImpl::createBuffer() +{ + makeContextCurrent(); + GLuint o; + glGenBuffersARB(1, &o); + return o; +} + +unsigned WebGraphicsContext3DDefaultImpl::createFramebuffer() +{ + makeContextCurrent(); + GLuint o = 0; + glGenFramebuffersEXT(1, &o); + return o; +} + +unsigned WebGraphicsContext3DDefaultImpl::createProgram() +{ + makeContextCurrent(); + return glCreateProgram(); +} + +unsigned WebGraphicsContext3DDefaultImpl::createRenderbuffer() +{ + makeContextCurrent(); + GLuint o; + glGenRenderbuffersEXT(1, &o); + return o; +} + +DELEGATE_TO_GL_1R(createShader, CreateShader, unsigned long, unsigned); + +unsigned WebGraphicsContext3DDefaultImpl::createTexture() +{ + makeContextCurrent(); + GLuint o; + glGenTextures(1, &o); + return o; +} + +void WebGraphicsContext3DDefaultImpl::deleteBuffer(unsigned buffer) +{ + makeContextCurrent(); + glDeleteBuffersARB(1, &buffer); +} + +void WebGraphicsContext3DDefaultImpl::deleteFramebuffer(unsigned framebuffer) +{ + makeContextCurrent(); + glDeleteFramebuffersEXT(1, &framebuffer); +} + +void WebGraphicsContext3DDefaultImpl::deleteProgram(unsigned program) +{ + makeContextCurrent(); + glDeleteProgram(program); +} + +void WebGraphicsContext3DDefaultImpl::deleteRenderbuffer(unsigned renderbuffer) +{ + makeContextCurrent(); + glDeleteRenderbuffersEXT(1, &renderbuffer); +} + +void WebGraphicsContext3DDefaultImpl::deleteShader(unsigned shader) +{ + makeContextCurrent(); + glDeleteShader(shader); +} + +void WebGraphicsContext3DDefaultImpl::deleteTexture(unsigned texture) +{ + makeContextCurrent(); + glDeleteTextures(1, &texture); +} + +} // namespace WebKit + +#endif // ENABLE(3D_CANVAS) diff --git a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h new file mode 100644 index 0000000..a4c5b4b --- /dev/null +++ b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h @@ -0,0 +1,325 @@ +/* + * 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 WebGraphicsContext3DDefaultImpl_h +#define WebGraphicsContext3DDefaultImpl_h + +#if ENABLE(3D_CANVAS) + +#include "WebGraphicsContext3D.h" + +#include <wtf/ListHashSet.h> +#include <wtf/OwnPtr.h> + +#if !PLATFORM(CG) +#define FLIP_FRAMEBUFFER_VERTICALLY +#endif +namespace gfx { +class GLContext; +} + +namespace WebKit { + +// The default implementation of WebGL. In Chromium, using this class +// requires the sandbox to be disabled, which is strongly discouraged. +// It is provided for support of test_shell and any Chromium ports +// where an in-renderer WebGL implementation would be helpful. + +class WebGraphicsContext3DDefaultImpl : public WebGraphicsContext3D { +public: + WebGraphicsContext3DDefaultImpl(); + virtual ~WebGraphicsContext3DDefaultImpl(); + + //---------------------------------------------------------------------- + // WebGraphicsContext3D methods + virtual bool initialize(WebGraphicsContext3D::Attributes attributes, WebView*); + virtual bool makeContextCurrent(); + + virtual int width(); + virtual int height(); + + virtual int sizeInBytes(int type); + + virtual bool isGLES2Compliant(); + virtual bool isGLES2NPOTStrict(); + virtual bool isErrorGeneratedOnOutOfBoundsAccesses(); + + virtual void reshape(int width, int height); + + virtual bool readBackFramebuffer(unsigned char* pixels, size_t bufferSize); + + virtual unsigned int getPlatformTextureId(); + 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); + virtual void bindAttribLocation(WebGLId program, unsigned long index, const char* name); + virtual void bindBuffer(unsigned long target, WebGLId buffer); + virtual void bindFramebuffer(unsigned long target, WebGLId framebuffer); + virtual void bindRenderbuffer(unsigned long target, WebGLId renderbuffer); + virtual void bindTexture(unsigned long target, WebGLId texture); + virtual void blendColor(double red, double green, double blue, double alpha); + virtual void blendEquation(unsigned long mode); + virtual void blendEquationSeparate(unsigned long modeRGB, unsigned long modeAlpha); + virtual void blendFunc(unsigned long sfactor, unsigned long dfactor); + virtual void blendFuncSeparate(unsigned long srcRGB, unsigned long dstRGB, unsigned long srcAlpha, unsigned long dstAlpha); + + virtual void bufferData(unsigned long target, int size, const void* data, unsigned long usage); + virtual void bufferSubData(unsigned long target, long offset, int size, const void* data); + + virtual unsigned long checkFramebufferStatus(unsigned long target); + virtual void clear(unsigned long mask); + virtual void clearColor(double red, double green, double blue, double alpha); + virtual void clearDepth(double depth); + virtual void clearStencil(long s); + virtual void colorMask(bool red, bool green, bool blue, bool alpha); + virtual void compileShader(WebGLId shader); + + virtual void copyTexImage2D(unsigned long target, long level, unsigned long internalformat, long x, long y, unsigned long width, unsigned long height, long border); + virtual void copyTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, long x, long y, unsigned long width, unsigned long height); + virtual void cullFace(unsigned long mode); + virtual void depthFunc(unsigned long func); + virtual void depthMask(bool flag); + virtual void depthRange(double zNear, double zFar); + virtual void detachShader(WebGLId program, WebGLId shader); + virtual void disable(unsigned long cap); + virtual void disableVertexAttribArray(unsigned long index); + virtual void drawArrays(unsigned long mode, long first, long count); + virtual void drawElements(unsigned long mode, unsigned long count, unsigned long type, long offset); + + virtual void enable(unsigned long cap); + virtual void enableVertexAttribArray(unsigned long index); + virtual void finish(); + virtual void flush(); + virtual void framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, WebGLId renderbuffer); + virtual void framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, WebGLId texture, long level); + virtual void frontFace(unsigned long mode); + virtual void generateMipmap(unsigned long target); + + virtual bool getActiveAttrib(WebGLId program, unsigned long index, ActiveInfo&); + virtual bool getActiveUniform(WebGLId program, unsigned long index, ActiveInfo&); + + virtual void getAttachedShaders(WebGLId program, int maxCount, int* count, unsigned int* shaders); + + virtual int getAttribLocation(WebGLId program, const char* name); + + virtual void getBooleanv(unsigned long pname, unsigned char* value); + + virtual void getBufferParameteriv(unsigned long target, unsigned long pname, int* value); + + virtual Attributes getContextAttributes(); + + virtual unsigned long getError(); + + virtual void getFloatv(unsigned long pname, float* value); + + virtual void getFramebufferAttachmentParameteriv(unsigned long target, unsigned long attachment, unsigned long pname, int* value); + + virtual void getIntegerv(unsigned long pname, int* value); + + virtual void getProgramiv(WebGLId program, unsigned long pname, int* value); + + virtual WebString getProgramInfoLog(WebGLId program); + + virtual void getRenderbufferParameteriv(unsigned long target, unsigned long pname, int* value); + + virtual void getShaderiv(WebGLId shader, unsigned long pname, int* value); + + virtual WebString getShaderInfoLog(WebGLId shader); + + // TBD + // void glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); + + virtual WebString getShaderSource(WebGLId shader); + virtual WebString getString(unsigned long name); + + virtual void getTexParameterfv(unsigned long target, unsigned long pname, float* value); + virtual void getTexParameteriv(unsigned long target, unsigned long pname, int* value); + + virtual void getUniformfv(WebGLId program, long location, float* value); + virtual void getUniformiv(WebGLId program, long location, int* value); + + virtual long getUniformLocation(WebGLId program, const char* name); + + virtual void getVertexAttribfv(unsigned long index, unsigned long pname, float* value); + virtual void getVertexAttribiv(unsigned long index, unsigned long pname, int* value); + + virtual long getVertexAttribOffset(unsigned long index, unsigned long pname); + + virtual void hint(unsigned long target, unsigned long mode); + virtual bool isBuffer(WebGLId buffer); + virtual bool isEnabled(unsigned long cap); + virtual bool isFramebuffer(WebGLId framebuffer); + virtual bool isProgram(WebGLId program); + virtual bool isRenderbuffer(WebGLId renderbuffer); + virtual bool isShader(WebGLId shader); + virtual bool isTexture(WebGLId texture); + virtual void lineWidth(double); + virtual void linkProgram(WebGLId program); + virtual void pixelStorei(unsigned long pname, long param); + virtual void polygonOffset(double factor, double units); + + virtual void readPixels(long x, long y, unsigned long width, unsigned long height, unsigned long format, unsigned long type, void* pixels); + + virtual void releaseShaderCompiler(); + virtual void renderbufferStorage(unsigned long target, unsigned long internalformat, unsigned long width, unsigned long height); + virtual void sampleCoverage(double value, bool invert); + virtual void scissor(long x, long y, unsigned long width, unsigned long height); + virtual void shaderSource(WebGLId shader, const char* string); + virtual void stencilFunc(unsigned long func, long ref, unsigned long mask); + virtual void stencilFuncSeparate(unsigned long face, unsigned long func, long ref, unsigned long mask); + virtual void stencilMask(unsigned long mask); + virtual void stencilMaskSeparate(unsigned long face, unsigned long mask); + virtual void stencilOp(unsigned long fail, unsigned long zfail, unsigned long zpass); + virtual void stencilOpSeparate(unsigned long face, unsigned long fail, unsigned long zfail, unsigned long zpass); + + virtual void texImage2D(unsigned target, unsigned level, unsigned internalformat, unsigned width, unsigned height, unsigned border, unsigned format, unsigned type, const void* pixels); + + virtual void texParameterf(unsigned target, unsigned pname, float param); + virtual void texParameteri(unsigned target, unsigned pname, int param); + + virtual void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, unsigned width, unsigned height, unsigned format, unsigned type, const void* pixels); + + virtual void uniform1f(long location, float x); + virtual void uniform1fv(long location, int count, float* v); + virtual void uniform1i(long location, int x); + virtual void uniform1iv(long location, int count, int* v); + virtual void uniform2f(long location, float x, float y); + virtual void uniform2fv(long location, int count, float* v); + virtual void uniform2i(long location, int x, int y); + virtual void uniform2iv(long location, int count, int* v); + virtual void uniform3f(long location, float x, float y, float z); + virtual void uniform3fv(long location, int count, float* v); + virtual void uniform3i(long location, int x, int y, int z); + virtual void uniform3iv(long location, int count, int* v); + virtual void uniform4f(long location, float x, float y, float z, float w); + virtual void uniform4fv(long location, int count, float* v); + virtual void uniform4i(long location, int x, int y, int z, int w); + virtual void uniform4iv(long location, int count, int* v); + virtual void uniformMatrix2fv(long location, int count, bool transpose, const float* value); + virtual void uniformMatrix3fv(long location, int count, bool transpose, const float* value); + virtual void uniformMatrix4fv(long location, int count, bool transpose, const float* value); + + virtual void useProgram(WebGLId program); + virtual void validateProgram(WebGLId program); + + virtual void vertexAttrib1f(unsigned long indx, float x); + virtual void vertexAttrib1fv(unsigned long indx, const float* values); + virtual void vertexAttrib2f(unsigned long indx, float x, float y); + virtual void vertexAttrib2fv(unsigned long indx, const float* values); + virtual void vertexAttrib3f(unsigned long indx, float x, float y, float z); + virtual void vertexAttrib3fv(unsigned long indx, const float* values); + virtual void vertexAttrib4f(unsigned long indx, float x, float y, float z, float w); + virtual void vertexAttrib4fv(unsigned long indx, const float* values); + virtual void vertexAttribPointer(unsigned long indx, int size, int type, bool normalized, + unsigned long stride, unsigned long offset); + + virtual void viewport(long x, long y, unsigned long width, unsigned long height); + + // Support for buffer creation and deletion + virtual unsigned createBuffer(); + virtual unsigned createFramebuffer(); + virtual unsigned createProgram(); + virtual unsigned createRenderbuffer(); + virtual unsigned createShader(unsigned long); + virtual unsigned createTexture(); + + virtual void deleteBuffer(unsigned); + virtual void deleteFramebuffer(unsigned); + virtual void deleteProgram(unsigned); + virtual void deleteRenderbuffer(unsigned); + virtual void deleteShader(unsigned); + virtual void deleteTexture(unsigned); + +private: + WebGraphicsContext3D::Attributes m_attributes; + bool m_initialized; + unsigned int m_texture; + unsigned int m_fbo; + unsigned int m_depthStencilBuffer; + unsigned int m_cachedWidth, m_cachedHeight; + + // For multisampling + unsigned int m_multisampleFBO; + unsigned int m_multisampleDepthStencilBuffer; + unsigned int m_multisampleColorBuffer; + + // For tracking which FBO is bound + unsigned int m_boundFBO; + +#ifdef FLIP_FRAMEBUFFER_VERTICALLY + unsigned char* m_scanline; + void flipVertically(unsigned char* framebuffer, + unsigned int width, + unsigned int height); +#endif + + // Take into account the user's requested context creation attributes, in + // particular stencil and antialias, and determine which could or could + // not be honored based on the capabilities of the OpenGL implementation. + void validateAttributes(); + + // Note: we aren't currently using this information, but we will + // need to in order to verify that all enabled vertex arrays have + // a valid buffer bound -- to avoid crashes on certain cards. + unsigned int m_boundArrayBuffer; + class VertexAttribPointerState { + public: + VertexAttribPointerState(); + + bool enabled; + unsigned long buffer; + unsigned long indx; + int size; + int type; + bool normalized; + unsigned long stride; + unsigned long offset; + }; + + enum { + NumTrackedPointerStates = 2 + }; + VertexAttribPointerState m_vertexAttribPointerState[NumTrackedPointerStates]; + + // Errors raised by synthesizeGLError(). + ListHashSet<unsigned long> m_syntheticErrors; + + OwnPtr<gfx::GLContext> m_glContext; +}; + +} // namespace WebKit + +#endif // ENABLE(3D_CANVAS) + +#endif diff --git a/WebKit/chromium/src/WebHTTPBody.cpp b/WebKit/chromium/src/WebHTTPBody.cpp index 3d40869..e54b4e5 100644 --- a/WebKit/chromium/src/WebHTTPBody.cpp +++ b/WebKit/chromium/src/WebHTTPBody.cpp @@ -74,23 +74,33 @@ bool WebHTTPBody::elementAt(size_t index, Element& result) const const FormDataElement& element = m_private->elements()[index]; + result.data.reset(); + result.filePath.reset(); + result.fileStart = 0; + result.fileLength = 0; + result.fileInfo.modificationTime = 0.0; + result.blobURL = KURL(); + switch (element.m_type) { case FormDataElement::data: result.type = Element::TypeData; result.data.assign(element.m_data.data(), element.m_data.size()); - result.filePath.reset(); - result.fileStart = 0; - result.fileLength = 0; - result.fileInfo.modificationTime = 0.0; break; case FormDataElement::encodedFile: result.type = Element::TypeFile; - result.data.reset(); result.filePath = element.m_filename; - result.fileStart = 0; // FIXME: to be set from FormData. - result.fileLength = -1; // FIXME: to be set from FormData. - result.fileInfo.modificationTime = 0.0; // FIXME: to be set from FormData. +#if ENABLE(BLOB) + result.fileStart = element.m_fileStart; + result.fileLength = element.m_fileLength; + result.fileInfo.modificationTime = element.m_expectedFileModificationTime; +#endif + break; +#if ENABLE(BLOB) + case FormDataElement::encodedBlob: + result.type = Element::TypeBlob; + result.blobURL = element.m_blobURL; break; +#endif default: ASSERT_NOT_REACHED(); return false; @@ -113,9 +123,20 @@ void WebHTTPBody::appendFile(const WebString& filePath) m_private->appendFile(filePath); } -void WebHTTPBody::appendFile(const WebString& filePath, long long fileStart, long long fileLength, const WebFileInfo& fileInfo) +void WebHTTPBody::appendFileRange(const WebString& filePath, long long fileStart, long long fileLength, const WebFileInfo& fileInfo) { - // FIXME: to be implemented. +#if ENABLE(BLOB) + ensureMutable(); + m_private->appendFileRange(filePath, fileStart, fileLength, fileInfo.modificationTime); +#endif +} + +void WebHTTPBody::appendBlob(const WebURL& blobURL) +{ +#if ENABLE(BLOB) + ensureMutable(); + m_private->appendBlob(blobURL); +#endif } long long WebHTTPBody::identifier() const diff --git a/WebKit/chromium/src/WebHistoryItem.cpp b/WebKit/chromium/src/WebHistoryItem.cpp index 4ca8cc7..99ebce8 100644 --- a/WebKit/chromium/src/WebHistoryItem.cpp +++ b/WebKit/chromium/src/WebHistoryItem.cpp @@ -37,6 +37,7 @@ #include "WebHTTPBody.h" #include "WebPoint.h" +#include "WebSerializedScriptValue.h" #include "WebString.h" #include "WebVector.h" @@ -44,30 +45,23 @@ using namespace WebCore; namespace WebKit { -class WebHistoryItemPrivate : public HistoryItem { -}; - void WebHistoryItem::initialize() { - assign(static_cast<WebHistoryItemPrivate*>(HistoryItem::create().releaseRef())); + m_private = HistoryItem::create(); } void WebHistoryItem::reset() { - assign(0); + m_private.reset(); } void WebHistoryItem::assign(const WebHistoryItem& other) { - WebHistoryItemPrivate* p = const_cast<WebHistoryItemPrivate*>(other.m_private); - if (p) - p->ref(); - assign(p); + m_private = other.m_private; } WebString WebHistoryItem::urlString() const { - ASSERT(!isNull()); return m_private->urlString(); } @@ -79,7 +73,6 @@ void WebHistoryItem::setURLString(const WebString& url) WebString WebHistoryItem::originalURLString() const { - ASSERT(!isNull()); return m_private->originalURLString(); } @@ -91,7 +84,6 @@ void WebHistoryItem::setOriginalURLString(const WebString& originalURLString) WebString WebHistoryItem::referrer() const { - ASSERT(!isNull()); return m_private->referrer(); } @@ -103,7 +95,6 @@ void WebHistoryItem::setReferrer(const WebString& referrer) WebString WebHistoryItem::target() const { - ASSERT(!isNull()); return m_private->target(); } @@ -115,7 +106,6 @@ void WebHistoryItem::setTarget(const WebString& target) WebString WebHistoryItem::parent() const { - ASSERT(!isNull()); return m_private->parent(); } @@ -127,7 +117,6 @@ void WebHistoryItem::setParent(const WebString& parent) WebString WebHistoryItem::title() const { - ASSERT(!isNull()); return m_private->title(); } @@ -139,7 +128,6 @@ void WebHistoryItem::setTitle(const WebString& title) WebString WebHistoryItem::alternateTitle() const { - ASSERT(!isNull()); return m_private->alternateTitle(); } @@ -151,7 +139,6 @@ void WebHistoryItem::setAlternateTitle(const WebString& alternateTitle) double WebHistoryItem::lastVisitedTime() const { - ASSERT(!isNull()); return m_private->lastVisitedTime(); } @@ -168,7 +155,6 @@ void WebHistoryItem::setLastVisitedTime(double lastVisitedTime) WebPoint WebHistoryItem::scrollOffset() const { - ASSERT(!isNull()); return m_private->scrollPoint(); } @@ -180,7 +166,6 @@ void WebHistoryItem::setScrollOffset(const WebPoint& scrollOffset) bool WebHistoryItem::isTargetItem() const { - ASSERT(!isNull()); return m_private->isTargetItem(); } @@ -192,7 +177,6 @@ void WebHistoryItem::setIsTargetItem(bool isTargetItem) int WebHistoryItem::visitCount() const { - ASSERT(!isNull()); return m_private->visitCount(); } @@ -204,7 +188,6 @@ void WebHistoryItem::setVisitCount(int count) WebVector<WebString> WebHistoryItem::documentState() const { - ASSERT(!isNull()); return m_private->documentState(); } @@ -218,9 +201,19 @@ void WebHistoryItem::setDocumentState(const WebVector<WebString>& state) m_private->setDocumentState(ds); } +long long WebHistoryItem::itemSequenceNumber() const +{ + return m_private->itemSequenceNumber(); +} + +void WebHistoryItem::setItemSequenceNumber(long long itemSequenceNumber) +{ + ensureMutable(); + m_private->setItemSequenceNumber(itemSequenceNumber); +} + long long WebHistoryItem::documentSequenceNumber() const { - ASSERT(!isNull()); return m_private->documentSequenceNumber(); } @@ -230,9 +223,19 @@ void WebHistoryItem::setDocumentSequenceNumber(long long documentSequenceNumber) m_private->setDocumentSequenceNumber(documentSequenceNumber); } +WebSerializedScriptValue WebHistoryItem::stateObject() const +{ + return WebSerializedScriptValue(m_private->stateObject()); +} + +void WebHistoryItem::setStateObject(const WebSerializedScriptValue& object) +{ + ensureMutable(); + m_private->setStateObject(object); +} + WebString WebHistoryItem::httpContentType() const { - ASSERT(!isNull()); return m_private->formContentType(); } @@ -244,7 +247,6 @@ void WebHistoryItem::setHTTPContentType(const WebString& httpContentType) WebHTTPBody WebHistoryItem::httpBody() const { - ASSERT(!isNull()); return WebHTTPBody(m_private->formData()); } @@ -256,7 +258,6 @@ void WebHistoryItem::setHTTPBody(const WebHTTPBody& httpBody) WebVector<WebHistoryItem> WebHistoryItem::children() const { - ASSERT(!isNull()); return m_private->children(); } @@ -275,34 +276,25 @@ void WebHistoryItem::appendToChildren(const WebHistoryItem& item) } WebHistoryItem::WebHistoryItem(const PassRefPtr<HistoryItem>& item) - : m_private(static_cast<WebHistoryItemPrivate*>(item.releaseRef())) + : m_private(item) { } WebHistoryItem& WebHistoryItem::operator=(const PassRefPtr<HistoryItem>& item) { - assign(static_cast<WebHistoryItemPrivate*>(item.releaseRef())); + m_private = item; return *this; } WebHistoryItem::operator PassRefPtr<HistoryItem>() const { - return m_private; -} - -void WebHistoryItem::assign(WebHistoryItemPrivate* p) -{ - // p is already ref'd for us by the caller - if (m_private) - m_private->deref(); - m_private = p; + return m_private.get(); } void WebHistoryItem::ensureMutable() { - ASSERT(!isNull()); if (!m_private->hasOneRef()) - assign(static_cast<WebHistoryItemPrivate*>(m_private->copy().releaseRef())); + m_private = m_private->copy(); } } // namespace WebKit diff --git a/WebKit/chromium/src/WebIDBCallbacksImpl.cpp b/WebKit/chromium/src/WebIDBCallbacksImpl.cpp new file mode 100644 index 0000000..e543123 --- /dev/null +++ b/WebKit/chromium/src/WebIDBCallbacksImpl.cpp @@ -0,0 +1,107 @@ +/* + * 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 "WebIDBCallbacksImpl.h" + +#include "IDBCallbacks.h" +#include "IDBCursorBackendProxy.h" +#include "IDBDatabaseError.h" +#include "IDBDatabaseProxy.h" +#include "IDBIndexBackendProxy.h" +#include "IDBKey.h" +#include "IDBObjectStoreProxy.h" +#include "WebIDBCallbacks.h" +#include "WebIDBDatabase.h" +#include "WebIDBDatabaseError.h" +#include "WebIDBIndex.h" +#include "WebIDBKey.h" +#include "WebIDBObjectStore.h" +#include "WebSerializedScriptValue.h" + +#if ENABLE(INDEXED_DATABASE) + +namespace WebCore { + +WebIDBCallbacksImpl::WebIDBCallbacksImpl(PassRefPtr<IDBCallbacks> callbacks) + : m_callbacks(callbacks) +{ +} + +WebIDBCallbacksImpl::~WebIDBCallbacksImpl() +{ +} + +void WebIDBCallbacksImpl::onError(const WebKit::WebIDBDatabaseError& error) +{ + m_callbacks->onError(error); + m_callbacks.clear(); +} + +void WebIDBCallbacksImpl::onSuccess() +{ + m_callbacks->onSuccess(); + m_callbacks.clear(); +} + +void WebIDBCallbacksImpl::onSuccess(WebKit::WebIDBCursor* cursor) +{ + m_callbacks->onSuccess(IDBCursorBackendProxy::create(cursor)); + m_callbacks.clear(); +} + +void WebIDBCallbacksImpl::onSuccess(WebKit::WebIDBDatabase* webKitInstance) +{ + m_callbacks->onSuccess(IDBDatabaseProxy::create(webKitInstance)); + m_callbacks.clear(); +} + +void WebIDBCallbacksImpl::onSuccess(const WebKit::WebIDBKey& key) +{ + m_callbacks->onSuccess(key); + m_callbacks.clear(); +} + +void WebIDBCallbacksImpl::onSuccess(WebKit::WebIDBIndex* webKitInstance) +{ + m_callbacks->onSuccess(IDBIndexBackendProxy::create(webKitInstance)); + m_callbacks.clear(); +} + +void WebIDBCallbacksImpl::onSuccess(WebKit::WebIDBObjectStore* webKitInstance) +{ + m_callbacks->onSuccess(IDBObjectStoreProxy::create(webKitInstance)); + m_callbacks.clear(); +} + +void WebIDBCallbacksImpl::onSuccess(const WebKit::WebSerializedScriptValue& serializedScriptValue) +{ + m_callbacks->onSuccess(serializedScriptValue); + m_callbacks.clear(); +} + +} // namespace WebCore + +#endif // ENABLE(INDEXED_DATABASE) diff --git a/WebKit/chromium/src/WebIDBCallbacksImpl.h b/WebKit/chromium/src/WebIDBCallbacksImpl.h new file mode 100644 index 0000000..1835c60 --- /dev/null +++ b/WebKit/chromium/src/WebIDBCallbacksImpl.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 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 WebIDBCallbacksImpl_h +#define WebIDBCallbacksImpl_h + +#include "WebIDBCallbacks.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +#if ENABLE(INDEXED_DATABASE) + +namespace WebCore { + +class IDBCallbacks; + +class WebIDBCallbacksImpl : public WebKit::WebIDBCallbacks { +public: + WebIDBCallbacksImpl(PassRefPtr<IDBCallbacks>); + virtual ~WebIDBCallbacksImpl(); + + virtual void onError(const WebKit::WebIDBDatabaseError&); + virtual void onSuccess(); // For "null". + virtual void onSuccess(WebKit::WebIDBCursor*); + virtual void onSuccess(WebKit::WebIDBDatabase*); + virtual void onSuccess(const WebKit::WebIDBKey&); + virtual void onSuccess(WebKit::WebIDBIndex*); + virtual void onSuccess(WebKit::WebIDBObjectStore*); + virtual void onSuccess(const WebKit::WebSerializedScriptValue&); + +private: + RefPtr<IDBCallbacks> m_callbacks; +}; + +} // namespace WebCore + +#endif + +#endif // WebIDBCallbacksImpl_h diff --git a/WebKit/chromium/src/WebIDBCursorImpl.cpp b/WebKit/chromium/src/WebIDBCursorImpl.cpp new file mode 100644 index 0000000..1ade687 --- /dev/null +++ b/WebKit/chromium/src/WebIDBCursorImpl.cpp @@ -0,0 +1,78 @@ +/* + * 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 "WebIDBCursorImpl.h" + +#include "IDBAny.h" +#include "IDBCallbacksProxy.h" +#include "IDBCursorBackendInterface.h" +#include "IDBKey.h" +#include "WebIDBKey.h" + +using namespace WebCore; + +namespace WebKit { + +WebIDBCursorImpl::WebIDBCursorImpl(PassRefPtr<IDBCursorBackendInterface> idbCursorBackend) + : m_idbCursorBackend(idbCursorBackend) +{ +} + +WebIDBCursorImpl::~WebIDBCursorImpl() +{ +} + +unsigned short WebIDBCursorImpl::direction() const +{ + return m_idbCursorBackend->direction(); +} + +WebIDBKey WebIDBCursorImpl::key() const +{ + return WebIDBKey(m_idbCursorBackend->key()); +} + +WebSerializedScriptValue WebIDBCursorImpl::value() const +{ + return m_idbCursorBackend->value()->serializedScriptValue(); +} + +void WebIDBCursorImpl::update(const WebSerializedScriptValue& value, WebIDBCallbacks* callbacks) +{ + m_idbCursorBackend->update(value, IDBCallbacksProxy::create(callbacks)); +} + +void WebIDBCursorImpl::continueFunction(const WebIDBKey& key, WebIDBCallbacks* callbacks) +{ + m_idbCursorBackend->continueFunction(key, IDBCallbacksProxy::create(callbacks)); +} + +void WebIDBCursorImpl::remove(WebIDBCallbacks* callbacks) +{ + m_idbCursorBackend->remove(IDBCallbacksProxy::create(callbacks)); +} + +} // namespace WebCore diff --git a/WebKit/chromium/src/WebIDBCursorImpl.h b/WebKit/chromium/src/WebIDBCursorImpl.h new file mode 100644 index 0000000..565e86a --- /dev/null +++ b/WebKit/chromium/src/WebIDBCursorImpl.h @@ -0,0 +1,57 @@ +/* + * 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 WebIDBCursorImpl_h +#define WebIDBCursorImpl_h + +#include "WebCommon.h" +#include "WebIDBCursor.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebCore { class IDBCursorBackendInterface; } + +namespace WebKit { + +// See comment in WebIndexedObjectStore for a high level overview these classes. +class WebIDBCursorImpl : public WebIDBCursor { +public: + WebIDBCursorImpl(WTF::PassRefPtr<WebCore::IDBCursorBackendInterface>); + virtual ~WebIDBCursorImpl(); + + virtual unsigned short direction() const; + virtual WebIDBKey key() const; + virtual WebSerializedScriptValue value() const; + virtual void update(const WebSerializedScriptValue&, WebIDBCallbacks*); + virtual void continueFunction(const WebIDBKey&, WebIDBCallbacks*); + virtual void remove(WebIDBCallbacks*); + + private: + WTF::RefPtr<WebCore::IDBCursorBackendInterface> m_idbCursorBackend; +}; + +} // namespace WebKit + +#endif // WebIDBCursorImpl_h diff --git a/WebKit/chromium/src/WebIDBDatabaseError.cpp b/WebKit/chromium/src/WebIDBDatabaseError.cpp new file mode 100644 index 0000000..cbbe14a --- /dev/null +++ b/WebKit/chromium/src/WebIDBDatabaseError.cpp @@ -0,0 +1,86 @@ +/* + * 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 "WebIDBDatabaseError.h" + +#include "IDBDatabaseError.h" +#include "WebString.h" + +#if ENABLE(INDEXED_DATABASE) + +using namespace WebCore; + +namespace WebKit { + +void WebIDBDatabaseError::assign(const WebIDBDatabaseError& value) +{ + m_private = value.m_private; +} + +void WebIDBDatabaseError::assign(unsigned short code, const WebString& message) +{ + m_private = IDBDatabaseError::create(code, message); +} + +void WebIDBDatabaseError::reset() +{ + m_private.reset(); +} + +unsigned short WebIDBDatabaseError::code() const +{ + return m_private->code(); +} + +WebString WebIDBDatabaseError::message() const +{ + return m_private->message(); +} + +WebIDBDatabaseError::WebIDBDatabaseError(const PassRefPtr<IDBDatabaseError>& value) + : m_private(value) +{ +} + +WebIDBDatabaseError& WebIDBDatabaseError::operator=(const PassRefPtr<IDBDatabaseError>& value) +{ + m_private = value; + return *this; +} + +WebIDBDatabaseError::operator PassRefPtr<IDBDatabaseError>() const +{ + return m_private.get(); +} + +} // namespace WebKit + +#endif // ENABLE(INDEXED_DATABASE) diff --git a/WebKit/chromium/src/WebIDBDatabaseImpl.cpp b/WebKit/chromium/src/WebIDBDatabaseImpl.cpp new file mode 100644 index 0000000..bd3600f --- /dev/null +++ b/WebKit/chromium/src/WebIDBDatabaseImpl.cpp @@ -0,0 +1,101 @@ +/* + * 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 "WebIDBDatabaseImpl.h" + +#include "DOMStringList.h" +#include "IDBCallbacksProxy.h" +#include "IDBDatabaseBackendInterface.h" +#include "IDBTransactionBackendInterface.h" +#include "WebIDBCallbacks.h" +#include "WebIDBObjectStoreImpl.h" +#include "WebIDBTransactionImpl.h" + +#if ENABLE(INDEXED_DATABASE) + +using namespace WebCore; + +namespace WebKit { + +WebIDBDatabaseImpl::WebIDBDatabaseImpl(PassRefPtr<IDBDatabaseBackendInterface> databaseBackend) + : m_databaseBackend(databaseBackend) +{ +} + +WebIDBDatabaseImpl::~WebIDBDatabaseImpl() +{ +} + +WebString WebIDBDatabaseImpl::name() const +{ + return m_databaseBackend->name(); +} + +WebString WebIDBDatabaseImpl::description() const +{ + return m_databaseBackend->description(); +} + +WebString WebIDBDatabaseImpl::version() const +{ + return m_databaseBackend->version(); +} + +WebDOMStringList WebIDBDatabaseImpl::objectStores() const +{ + return m_databaseBackend->objectStores(); +} + +void WebIDBDatabaseImpl::createObjectStore(const WebString& name, const WebString& keyPath, bool autoIncrement, WebIDBCallbacks* callbacks) +{ + m_databaseBackend->createObjectStore(name, keyPath, autoIncrement, IDBCallbacksProxy::create(callbacks)); +} + +WebIDBObjectStore* WebIDBDatabaseImpl::objectStore(const WebString& name, unsigned short mode) +{ + RefPtr<IDBObjectStoreBackendInterface> objectStore = m_databaseBackend->objectStore(name, mode); + if (!objectStore) + return 0; + return new WebIDBObjectStoreImpl(objectStore); +} + +void WebIDBDatabaseImpl::removeObjectStore(const WebString& name, WebIDBCallbacks* callbacks) +{ + m_databaseBackend->removeObjectStore(name, IDBCallbacksProxy::create(callbacks)); +} + +WebIDBTransaction* WebIDBDatabaseImpl::transaction(const WebDOMStringList& names, unsigned short mode, unsigned long timeout) +{ + RefPtr<DOMStringList> nameList = PassRefPtr<DOMStringList>(names); + RefPtr<IDBTransactionBackendInterface> transaction = m_databaseBackend->transaction(nameList.get(), mode, timeout); + if (!transaction) + return 0; + return new WebIDBTransactionImpl(transaction); +} + +} // namespace WebCore + +#endif // ENABLE(INDEXED_DATABASE) diff --git a/WebKit/chromium/src/WebIDBDatabaseImpl.h b/WebKit/chromium/src/WebIDBDatabaseImpl.h new file mode 100644 index 0000000..9ae74e0 --- /dev/null +++ b/WebKit/chromium/src/WebIDBDatabaseImpl.h @@ -0,0 +1,63 @@ +/* + * 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 WebIDBDatabaseImpl_h +#define WebIDBDatabaseImpl_h + +#include "WebCommon.h" +#include "WebIDBDatabase.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebCore { class IDBDatabaseBackendInterface; } + +namespace WebKit { + +class WebIDBObjectStore; +class WebIDBTransaction; + +// See comment in WebIndexedDatabase for a high level overview these classes. +class WebIDBDatabaseImpl : public WebIDBDatabase { +public: + WebIDBDatabaseImpl(WTF::PassRefPtr<WebCore::IDBDatabaseBackendInterface>); + virtual ~WebIDBDatabaseImpl(); + + virtual WebString name() const; + virtual WebString description() const; + virtual WebString version() const; + virtual WebDOMStringList objectStores() const; + + virtual void createObjectStore(const WebString& name, const WebString& keyPath, bool autoIncrement, WebIDBCallbacks* callbacks); + virtual WebIDBObjectStore* objectStore(const WebString& name, unsigned short mode); + virtual void removeObjectStore(const WebString& name, WebIDBCallbacks* callbacks); + virtual WebIDBTransaction* transaction(const WebDOMStringList& names, unsigned short mode, unsigned long timeout); + +private: + WTF::RefPtr<WebCore::IDBDatabaseBackendInterface> m_databaseBackend; +}; + +} // namespace WebKit + +#endif // WebIDBDatabaseImpl_h diff --git a/WebKit/chromium/src/WebIDBFactoryImpl.cpp b/WebKit/chromium/src/WebIDBFactoryImpl.cpp new file mode 100755 index 0000000..564be36 --- /dev/null +++ b/WebKit/chromium/src/WebIDBFactoryImpl.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: + * + * * 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 "WebIDBFactoryImpl.h" + +#include "DOMStringList.h" +#include "IDBCallbacksProxy.h" +#include "IDBFactoryBackendImpl.h" +#include "SecurityOrigin.h" +#include "WebIDBDatabaseError.h" +#include <wtf/OwnPtr.h> + +#if ENABLE(INDEXED_DATABASE) + +using namespace WebCore; + +namespace WebKit { + +WebIDBFactory* WebIDBFactory::create() +{ + return new WebIDBFactoryImpl(); +} + +WebIDBFactoryImpl::WebIDBFactoryImpl() + : m_idbFactoryBackend(WebCore::IDBFactoryBackendImpl::create()) +{ +} + +WebIDBFactoryImpl::~WebIDBFactoryImpl() +{ +} + +void WebIDBFactoryImpl::open(const WebString& name, const WebString& description, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame*) +{ + m_idbFactoryBackend->open(name, description, IDBCallbacksProxy::create(callbacks), origin, 0); +} + +void WebIDBFactoryImpl::abortPendingTransactions(const WebVector<int>& pendingIDs) +{ + WTF::Vector<int> ids(pendingIDs.size()); + for (size_t i = 0; i < pendingIDs.size(); ++i) + ids[i] = pendingIDs[i]; + + m_idbFactoryBackend->abortPendingTransactions(ids); +} + +} // namespace WebKit + +#endif // ENABLE(INDEXED_DATABASE) diff --git a/WebKit/chromium/src/WebIDBFactoryImpl.h b/WebKit/chromium/src/WebIDBFactoryImpl.h new file mode 100755 index 0000000..aeab478 --- /dev/null +++ b/WebKit/chromium/src/WebIDBFactoryImpl.h @@ -0,0 +1,54 @@ +/* + * 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebIDBFactoryImpl_h +#define WebIDBFactoryImpl_h + +#include "WebDOMStringList.h" +#include "WebIDBFactory.h" +#include <wtf/RefPtr.h> + +namespace WebCore { class IDBFactoryBackendInterface; } + +namespace WebKit { + +class WebIDBFactoryImpl : public WebIDBFactory { +public: + WebIDBFactoryImpl(); + virtual ~WebIDBFactoryImpl(); + + virtual void open(const WebString& name, const WebString& description, WebIDBCallbacks*, const WebSecurityOrigin&, WebFrame*); + virtual void abortPendingTransactions(const WebVector<int>& pendingIDs); + +private: + WTF::RefPtr<WebCore::IDBFactoryBackendInterface> m_idbFactoryBackend; +}; + +} // namespace WebKit + +#endif // WebIDBFactoryImpl_h diff --git a/WebKit/chromium/src/WebIDBIndexImpl.cpp b/WebKit/chromium/src/WebIDBIndexImpl.cpp new file mode 100644 index 0000000..777ec32 --- /dev/null +++ b/WebKit/chromium/src/WebIDBIndexImpl.cpp @@ -0,0 +1,63 @@ +/* + * 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 "WebIDBIndexImpl.h" + +#include "IDBIndex.h" + +#if ENABLE(INDEXED_DATABASE) + +using namespace WebCore; + +namespace WebKit { + +WebIDBIndexImpl::WebIDBIndexImpl(PassRefPtr<IDBIndexBackendInterface> backend) + : m_backend(backend) +{ +} + +WebIDBIndexImpl::~WebIDBIndexImpl() +{ +} + +WebString WebIDBIndexImpl::name() const +{ + return m_backend->name(); +} + +WebString WebIDBIndexImpl::keyPath() const +{ + return m_backend->keyPath(); +} + +bool WebIDBIndexImpl::unique() const +{ + return m_backend->unique(); +} + +} // namespace WebCore + +#endif // ENABLE(INDEXED_DATABASE) diff --git a/WebKit/chromium/src/WebIDBIndexImpl.h b/WebKit/chromium/src/WebIDBIndexImpl.h new file mode 100644 index 0000000..73f3819 --- /dev/null +++ b/WebKit/chromium/src/WebIDBIndexImpl.h @@ -0,0 +1,54 @@ +/* + * 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 WebIDBIndexImpl_h +#define WebIDBIndexImpl_h + +#include "WebCommon.h" +#include "WebIDBIndex.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebCore { class IDBIndexBackendInterface; } + +namespace WebKit { + +// See comment in WebIndexedDatabase for a high level overview these classes. +class WebIDBIndexImpl : public WebIDBIndex { +public: + WebIDBIndexImpl(WTF::PassRefPtr<WebCore::IDBIndexBackendInterface>); + virtual ~WebIDBIndexImpl(); + + virtual WebString name() const; + virtual WebString keyPath() const; + virtual bool unique() const; + +private: + WTF::RefPtr<WebCore::IDBIndexBackendInterface> m_backend; +}; + +} // namespace WebKit + +#endif // WebIDBIndexImpl_h diff --git a/WebKit/chromium/src/WebIDBKey.cpp b/WebKit/chromium/src/WebIDBKey.cpp new file mode 100644 index 0000000..413a9e6 --- /dev/null +++ b/WebKit/chromium/src/WebIDBKey.cpp @@ -0,0 +1,130 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 "WebIDBKey.h" + +#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; + +namespace WebKit { + +WebIDBKey WebIDBKey::createNull() +{ + WebIDBKey key; + key.assignNull(); + return key; +} + +WebIDBKey WebIDBKey::createInvalid() +{ + WebIDBKey key; + key.assignInvalid(); + 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; +} + +void WebIDBKey::assignNull() +{ + m_private = IDBKey::create(); +} + +void WebIDBKey::assign(const WebString& string) +{ + m_private = IDBKey::create(string); +} + +void WebIDBKey::assign(int32_t number) +{ + m_private = IDBKey::create(number); +} + +void WebIDBKey::assignInvalid() +{ + m_private = 0; +} + +void WebIDBKey::reset() +{ + m_private.reset(); +} + +WebIDBKey::Type WebIDBKey::type() const +{ + if (!m_private.get()) + return InvalidType; + return Type(m_private->type()); +} + +WebString WebIDBKey::string() const +{ + return m_private->string(); +} + +int32_t WebIDBKey::number() const +{ + return m_private->number(); +} + +WebIDBKey::WebIDBKey(const PassRefPtr<IDBKey>& value) + : m_private(value) +{ +} + +WebIDBKey& WebIDBKey::operator=(const PassRefPtr<IDBKey>& value) +{ + m_private = value; + return *this; +} + +WebIDBKey::operator PassRefPtr<IDBKey>() const +{ + return m_private.get(); +} + +} // namespace WebKit + +#endif // ENABLE(INDEXED_DATABASE) 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/WebIDBKeyRange.cpp b/WebKit/chromium/src/WebIDBKeyRange.cpp new file mode 100644 index 0000000..4ce9452 --- /dev/null +++ b/WebKit/chromium/src/WebIDBKeyRange.cpp @@ -0,0 +1,83 @@ +/* + * 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 "WebIDBKeyRange.h" + +#include "IDBKey.h" +#include "IDBKeyRange.h" +#include "WebIDBKey.h" + +using WebCore::IDBKeyRange; + +namespace WebKit { + +void WebIDBKeyRange::assign(const WebIDBKeyRange& other) +{ + m_private = other.m_private; +} + +void WebIDBKeyRange::assign(const WebIDBKey& left, const WebIDBKey& right, unsigned short flags) +{ + m_private = IDBKeyRange::create(left, right, flags); +} + +void WebIDBKeyRange::reset() +{ + m_private.reset(); +} + +WebIDBKey WebIDBKeyRange::left() const +{ + return m_private->left(); +} + +WebIDBKey WebIDBKeyRange::right() const +{ + return m_private->right(); +} + +unsigned short WebIDBKeyRange::flags() const +{ + return m_private->flags(); +} + +WebIDBKeyRange::WebIDBKeyRange(const PassRefPtr<IDBKeyRange>& value) + : m_private(value) +{ +} + +WebIDBKeyRange& WebIDBKeyRange::operator=(const PassRefPtr<IDBKeyRange>& value) +{ + m_private = value; + return *this; +} + +WebIDBKeyRange::operator PassRefPtr<IDBKeyRange>() const +{ + return m_private.get(); +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp b/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp new file mode 100755 index 0000000..1ad1d9f --- /dev/null +++ b/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp @@ -0,0 +1,108 @@ +/* + * 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 "WebIDBObjectStoreImpl.h" + +#include "DOMStringList.h" +#include "IDBCallbacksProxy.h" +#include "IDBKeyRange.h" +#include "IDBObjectStoreBackendInterface.h" +#include "WebIDBIndexImpl.h" +#include "WebIDBKey.h" +#include "WebIDBKeyRange.h" +#include "WebSerializedScriptValue.h" + +#if ENABLE(INDEXED_DATABASE) + +using namespace WebCore; + +namespace WebKit { + +WebIDBObjectStoreImpl::WebIDBObjectStoreImpl(PassRefPtr<IDBObjectStoreBackendInterface> objectStore) + : m_objectStore(objectStore) +{ +} + +WebIDBObjectStoreImpl::~WebIDBObjectStoreImpl() +{ +} + +WebString WebIDBObjectStoreImpl::name() const +{ + return m_objectStore->name(); +} + +WebString WebIDBObjectStoreImpl::keyPath() const +{ + return m_objectStore->keyPath(); +} + +WebDOMStringList WebIDBObjectStoreImpl::indexNames() const +{ + return m_objectStore->indexNames(); +} + +void WebIDBObjectStoreImpl::get(const WebIDBKey& key, WebIDBCallbacks* callbacks) +{ + m_objectStore->get(key, IDBCallbacksProxy::create(callbacks)); +} + +void WebIDBObjectStoreImpl::put(const WebSerializedScriptValue& value, const WebIDBKey& key, bool addOnly, WebIDBCallbacks* callbacks) +{ + m_objectStore->put(value, key, addOnly, IDBCallbacksProxy::create(callbacks)); +} + +void WebIDBObjectStoreImpl::remove(const WebIDBKey& key, WebIDBCallbacks* callbacks) +{ + m_objectStore->remove(key, IDBCallbacksProxy::create(callbacks)); +} + +void WebIDBObjectStoreImpl::createIndex(const WebString& name, const WebString& keyPath, bool unique, WebIDBCallbacks* callbacks) +{ + m_objectStore->createIndex(name, keyPath, unique, IDBCallbacksProxy::create(callbacks)); +} + +WebIDBIndex* WebIDBObjectStoreImpl::index(const WebString& name) +{ + RefPtr<IDBIndexBackendInterface> index = m_objectStore->index(name); + if (!index) + return 0; + return new WebIDBIndexImpl(index); +} + +void WebIDBObjectStoreImpl::removeIndex(const WebString& name, WebIDBCallbacks* callbacks) +{ + m_objectStore->removeIndex(name, IDBCallbacksProxy::create(callbacks)); +} + +void WebIDBObjectStoreImpl::openCursor(const WebIDBKeyRange& keyRange, unsigned short direction, WebIDBCallbacks* callbacks) +{ + m_objectStore->openCursor(IDBKeyRange::create(keyRange.left(), keyRange.right(), keyRange.flags()), direction, IDBCallbacksProxy::create(callbacks)); +} + +} // namespace WebCore + +#endif // ENABLE(INDEXED_DATABASE) diff --git a/WebKit/chromium/src/WebIDBObjectStoreImpl.h b/WebKit/chromium/src/WebIDBObjectStoreImpl.h new file mode 100755 index 0000000..9f31369 --- /dev/null +++ b/WebKit/chromium/src/WebIDBObjectStoreImpl.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 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 WebIDBObjectStoreImpl_h +#define WebIDBObjectStoreImpl_h + +#include "WebCommon.h" +#include "WebIDBObjectStore.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebCore { class IDBObjectStoreBackendInterface; } + +namespace WebKit { + +class WebIDBIndex; + +// See comment in WebIndexedObjectStore for a high level overview these classes. +class WebIDBObjectStoreImpl : public WebIDBObjectStore { +public: + WebIDBObjectStoreImpl(WTF::PassRefPtr<WebCore::IDBObjectStoreBackendInterface>); + ~WebIDBObjectStoreImpl(); + + WebString name() const; + WebString keyPath() const; + WebDOMStringList indexNames() const; + + void get(const WebIDBKey& key, WebIDBCallbacks*); + void put(const WebSerializedScriptValue& value, const WebIDBKey& key, bool addOnly, WebIDBCallbacks*); + void remove(const WebIDBKey& key, WebIDBCallbacks*); + + void createIndex(const WebString& name, const WebString& keyPath, bool unique, WebIDBCallbacks* callbacks); + WebIDBIndex* index(const WebString& name); + void removeIndex(const WebString& name, WebIDBCallbacks* callbacks); + + void openCursor(const WebIDBKeyRange&, unsigned short direction, WebIDBCallbacks*); + + private: + WTF::RefPtr<WebCore::IDBObjectStoreBackendInterface> m_objectStore; +}; + +} // namespace WebKit + +#endif // WebIDBObjectStoreImpl_h diff --git a/WebKit/chromium/src/WebIDBTransactionCallbacksImpl.cpp b/WebKit/chromium/src/WebIDBTransactionCallbacksImpl.cpp new file mode 100644 index 0000000..264ddc5 --- /dev/null +++ b/WebKit/chromium/src/WebIDBTransactionCallbacksImpl.cpp @@ -0,0 +1,56 @@ +/* + * 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 "WebIDBTransactionCallbacksImpl.h" + +#if ENABLE(INDEXED_DATABASE) + +#include "IDBTransactionCallbacks.h" + +namespace WebCore { + +WebIDBTransactionCallbacksImpl::WebIDBTransactionCallbacksImpl(PassRefPtr<IDBTransactionCallbacks> callbacks) + : m_callbacks(callbacks) +{ +} + +WebIDBTransactionCallbacksImpl::~WebIDBTransactionCallbacksImpl() +{ +} + +void WebIDBTransactionCallbacksImpl::onAbort() +{ + m_callbacks->onAbort(); +} + +int WebIDBTransactionCallbacksImpl::id() const +{ + return m_callbacks->id(); +} + +} // namespace WebCore + +#endif // ENABLE(INDEXED_DATABASE) diff --git a/WebKit/chromium/src/WebIDBTransactionCallbacksImpl.h b/WebKit/chromium/src/WebIDBTransactionCallbacksImpl.h new file mode 100644 index 0000000..398a679a --- /dev/null +++ b/WebKit/chromium/src/WebIDBTransactionCallbacksImpl.h @@ -0,0 +1,55 @@ +/* + * 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 WebIDBTransactionCallbacksImpl_h +#define WebIDBTransactionCallbacksImpl_h + +#if ENABLE(INDEXED_DATABASE) + +#include "WebIDBTransactionCallbacks.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebCore { + +class IDBTransactionCallbacks; + +class WebIDBTransactionCallbacksImpl : public WebKit::WebIDBTransactionCallbacks { +public: + WebIDBTransactionCallbacksImpl(PassRefPtr<IDBTransactionCallbacks>); + virtual ~WebIDBTransactionCallbacksImpl(); + + virtual void onAbort(); + virtual int id() const; + +private: + RefPtr<IDBTransactionCallbacks> m_callbacks; +}; + +} // namespace WebCore + +#endif + +#endif // WebIDBTransactionCallbacksImpl_h diff --git a/WebKit/chromium/src/WebIDBTransactionImpl.cpp b/WebKit/chromium/src/WebIDBTransactionImpl.cpp new file mode 100644 index 0000000..0dc9702 --- /dev/null +++ b/WebKit/chromium/src/WebIDBTransactionImpl.cpp @@ -0,0 +1,80 @@ +/* + * 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 "WebIDBTransactionImpl.h" + +#if ENABLE(INDEXED_DATABASE) + +#include "IDBTransaction.h" +#include "IDBTransactionCallbacksProxy.h" +#include "WebIDBObjectStoreImpl.h" +#include "WebIDBTransactionCallbacks.h" + +using namespace WebCore; + +namespace WebKit { + +WebIDBTransactionImpl::WebIDBTransactionImpl(PassRefPtr<IDBTransactionBackendInterface> backend) + : m_backend(backend) +{ +} + +WebIDBTransactionImpl::~WebIDBTransactionImpl() +{ +} + +int WebIDBTransactionImpl::mode() const +{ + return m_backend->mode(); +} + +WebIDBObjectStore* WebIDBTransactionImpl::objectStore(const WebString& name) +{ + RefPtr<IDBObjectStoreBackendInterface> objectStore = m_backend->objectStore(name); + if (!objectStore) + return 0; + return new WebIDBObjectStoreImpl(objectStore); +} + +void WebIDBTransactionImpl::abort() +{ + m_backend->abort(); +} + +int WebIDBTransactionImpl::id() const +{ + return m_backend->id(); +} + +void WebIDBTransactionImpl::setCallbacks(WebIDBTransactionCallbacks* callbacks) +{ + RefPtr<IDBTransactionCallbacks> idbCallbacks = IDBTransactionCallbacksProxy::create(callbacks); + m_backend->setCallbacks(idbCallbacks.get()); +} + +} // namespace WebKit + +#endif // ENABLE(INDEXED_DATABASE) diff --git a/WebKit/chromium/src/WebIDBTransactionImpl.h b/WebKit/chromium/src/WebIDBTransactionImpl.h new file mode 100644 index 0000000..a9bde68 --- /dev/null +++ b/WebKit/chromium/src/WebIDBTransactionImpl.h @@ -0,0 +1,60 @@ +/* + * 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 WebIDBTransactionImpl_h +#define WebIDBTransactionImpl_h + +#if ENABLE(INDEXED_DATABASE) + +#include "WebCommon.h" +#include "WebIDBTransaction.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebCore { class IDBTransactionBackendInterface; } + +namespace WebKit { + +// See comment in WebIndexedDatabase for a high level overview these classes. +class WebIDBTransactionImpl: public WebIDBTransaction { +public: + WebIDBTransactionImpl(WTF::PassRefPtr<WebCore::IDBTransactionBackendInterface>); + virtual ~WebIDBTransactionImpl(); + + virtual int mode() const; + virtual WebIDBObjectStore* objectStore(const WebString& name); + virtual void abort(); + virtual int id() const; + virtual void setCallbacks(WebIDBTransactionCallbacks*); + +private: + WTF::RefPtr<WebCore::IDBTransactionBackendInterface> m_backend; +}; + +} // namespace WebKit + +#endif // ENABLE(INDEXED_DATABASE) + +#endif // WebIDBTransactionImpl_h diff --git a/WebKit/chromium/src/WebImageCG.cpp b/WebKit/chromium/src/WebImageCG.cpp index 60b2449..045c8be 100644 --- a/WebKit/chromium/src/WebImageCG.cpp +++ b/WebKit/chromium/src/WebImageCG.cpp @@ -89,14 +89,16 @@ WebSize WebImage::size() const WebImage::WebImage(const PassRefPtr<Image>& image) : m_imageRef(0) { - if (image.get()) - assign(image->nativeImageForCurrentFrame()); + NativeImagePtr p; + if (image.get() && (p = image->nativeImageForCurrentFrame())) + assign(p); } WebImage& WebImage::operator=(const PassRefPtr<Image>& image) { - if (image.get()) - assign(image->nativeImageForCurrentFrame()); + NativeImagePtr p; + if (image.get() && (p = image->nativeImageForCurrentFrame())) + assign(p); else reset(); return *this; diff --git a/WebKit/chromium/src/WebImageDecoder.cpp b/WebKit/chromium/src/WebImageDecoder.cpp new file mode 100644 index 0000000..160deee --- /dev/null +++ b/WebKit/chromium/src/WebImageDecoder.cpp @@ -0,0 +1,121 @@ +/* + * 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 "WebImageDecoder.h" + +#include "BMPImageDecoder.h" +#include "ICOImageDecoder.h" +#include "SharedBuffer.h" +#include "WebData.h" +#include "WebImage.h" +#include "WebSize.h" + +#if WEBKIT_USING_SKIA +#include <wtf/OwnPtr.h> +#include <wtf/PassRefPtr.h> +#endif + +using namespace WebCore; + +namespace WebKit { + +void WebImageDecoder::reset() +{ + delete m_private; +} + +void WebImageDecoder::init(Type type) +{ + switch (type) { + case TypeBMP: + m_private = new BMPImageDecoder(true); + break; + case TypeICO: + m_private = new ICOImageDecoder(true); + break; + } +} + +void WebImageDecoder::setData(const WebData& data, bool allDataReceived) +{ + ASSERT(m_private); + m_private->setData(PassRefPtr<SharedBuffer>(data).get(), allDataReceived); +} + +bool WebImageDecoder::isFailed() const +{ + ASSERT(m_private); + return m_private->failed(); +} + +bool WebImageDecoder::isSizeAvailable() const +{ + ASSERT(m_private); + return m_private->isSizeAvailable(); +} + +WebSize WebImageDecoder::size() const +{ + ASSERT(m_private); + return m_private->size(); +} + +size_t WebImageDecoder::frameCount() const +{ + ASSERT(m_private); + return m_private->frameCount(); +} + +bool WebImageDecoder::isFrameCompleteAtIndex(int index) const +{ + ASSERT(m_private); + RGBA32Buffer* const frameBuffer = m_private->frameBufferAtIndex(index); + if (!frameBuffer) + return false; + return (frameBuffer->status() == RGBA32Buffer::FrameComplete); +} + +WebImage WebImageDecoder::getFrameAtIndex(int index = 0) const +{ + ASSERT(m_private); + RGBA32Buffer* const frameBuffer = m_private->frameBufferAtIndex(index); + if (!frameBuffer) + return WebImage(); +#if WEBKIT_USING_SKIA + OwnPtr<NativeImageSkia>image(frameBuffer->asNewNativeImage()); + return WebImage(*image); +#elif WEBKIT_USING_CG + // FIXME: Implement CG side of this. + return WebImage(frameBuffer->asNewNativeImage()); +#endif +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/WebInputElement.cpp b/WebKit/chromium/src/WebInputElement.cpp index 9fd317f..3b88335 100644 --- a/WebKit/chromium/src/WebInputElement.cpp +++ b/WebKit/chromium/src/WebInputElement.cpp @@ -40,25 +40,14 @@ using namespace WebCore; namespace WebKit { -WebInputElement::WebInputElement(const WTF::PassRefPtr<HTMLInputElement>& elem) - : WebElement(elem.releaseRef()) -{ -} - -WebInputElement& WebInputElement::operator=(const WTF::PassRefPtr<HTMLInputElement>& elem) -{ - WebNode::assign(elem.releaseRef()); - return *this; -} - -WebInputElement::operator WTF::PassRefPtr<HTMLInputElement>() const +bool WebInputElement::autoComplete() const { - return PassRefPtr<HTMLInputElement>(static_cast<HTMLInputElement*>(m_private)); + return constUnwrap<HTMLInputElement>()->autoComplete(); } -bool WebInputElement::autoComplete() const +bool WebInputElement::isReadOnly() const { - return constUnwrap<HTMLInputElement>()->autoComplete(); + return constUnwrap<HTMLInputElement>()->readOnly(); } bool WebInputElement::isEnabledFormControl() const @@ -71,9 +60,9 @@ WebInputElement::InputType WebInputElement::inputType() const return static_cast<InputType>(constUnwrap<HTMLInputElement>()->inputType()); } -WebString WebInputElement::formControlType() const +int WebInputElement::maxLength() const { - return constUnwrap<HTMLInputElement>()->formControlType(); + return constUnwrap<HTMLInputElement>()->maxLength(); } bool WebInputElement::isActivatedSubmit() const @@ -86,6 +75,11 @@ void WebInputElement::setActivatedSubmit(bool activated) unwrap<HTMLInputElement>()->setActivatedSubmit(activated); } +int WebInputElement::size() const +{ + return constUnwrap<HTMLInputElement>()->size(); +} + void WebInputElement::setValue(const WebString& value) { unwrap<HTMLInputElement>()->setValue(value); @@ -96,6 +90,31 @@ WebString WebInputElement::value() const return constUnwrap<HTMLInputElement>()->value(); } +void WebInputElement::setSuggestedValue(const WebString& value) +{ + unwrap<HTMLInputElement>()->setSuggestedValue(value); +} + +WebString WebInputElement::suggestedValue() const +{ + return constUnwrap<HTMLInputElement>()->suggestedValue(); +} + +void WebInputElement::setPlaceholder(const WebString& value) +{ + unwrap<HTMLInputElement>()->setPlaceholder(value); +} + +WebString WebInputElement::placeholder() const +{ + return constUnwrap<HTMLInputElement>()->placeholder(); +} + +bool WebInputElement::isAutofilled() const +{ + return constUnwrap<HTMLInputElement>()->isAutofilled(); +} + void WebInputElement::setAutofilled(bool autoFilled) { unwrap<HTMLInputElement>()->setAutofilled(autoFilled); @@ -110,23 +129,31 @@ void WebInputElement::setSelectionRange(int start, int end) { unwrap<HTMLInputElement>()->setSelectionRange(start, end); } - -WebString WebInputElement::name() const + +int WebInputElement::selectionStart() +{ + return unwrap<HTMLInputElement>()->selectionStart(); +} + +int WebInputElement::selectionEnd() +{ + return unwrap<HTMLInputElement>()->selectionEnd(); +} + +WebInputElement::WebInputElement(const PassRefPtr<HTMLInputElement>& elem) + : WebFormControlElement(elem) +{ +} + +WebInputElement& WebInputElement::operator=(const PassRefPtr<HTMLInputElement>& elem) { - return constUnwrap<HTMLInputElement>()->name(); + m_private = elem; + return *this; } - -WebString WebInputElement::nameForAutofill() const + +WebInputElement::operator PassRefPtr<HTMLInputElement>() const { - String name = constUnwrap<HTMLInputElement>()->name(); - String trimmedName = name.stripWhiteSpace(); - if (!trimmedName.isEmpty()) - return trimmedName; - name = constUnwrap<HTMLInputElement>()->getAttribute(HTMLNames::idAttr); - trimmedName = name.stripWhiteSpace(); - if (!trimmedName.isEmpty()) - return trimmedName; - return String(); + return static_cast<HTMLInputElement*>(m_private.get()); } } // namespace WebKit diff --git a/WebKit/chromium/src/WebInputEvent.cpp b/WebKit/chromium/src/WebInputEvent.cpp index b5c56fa..c00200e 100644 --- a/WebKit/chromium/src/WebInputEvent.cpp +++ b/WebKit/chromium/src/WebInputEvent.cpp @@ -86,6 +86,8 @@ static const char* staticKeyIdentifiers(unsigned short keyCode) case VKEY_F9: return "F9"; case VKEY_F10: + return "F10"; + case VKEY_F11: return "F11"; case VKEY_F12: return "F12"; diff --git a/WebKit/chromium/src/WebInputEventConversion.cpp b/WebKit/chromium/src/WebInputEventConversion.cpp index 147f88b..24eb372 100644 --- a/WebKit/chromium/src/WebInputEventConversion.cpp +++ b/WebKit/chromium/src/WebInputEventConversion.cpp @@ -40,6 +40,7 @@ #include "PlatformWheelEvent.h" #include "ScrollView.h" #include "WebInputEvent.h" +#include "WheelEvent.h" #include "Widget.h" using namespace WebCore; @@ -103,7 +104,7 @@ PlatformWheelEventBuilder::PlatformWheelEventBuilder(Widget* widget, const WebMo // MakePlatformKeyboardEvent -------------------------------------------------- -static inline const PlatformKeyboardEvent::Type toPlatformKeyboardEventType(WebInputEvent::Type type) +static inline PlatformKeyboardEvent::Type toPlatformKeyboardEventType(WebInputEvent::Type type) { switch (type) { case WebInputEvent::KeyUp: @@ -168,6 +169,64 @@ bool PlatformKeyboardEventBuilder::isCharacterKey() const return true; } +#if ENABLE(TOUCH_EVENTS) +static inline TouchEventType toPlatformTouchEventType(const WebInputEvent::Type type) +{ + switch (type) { + case WebInputEvent::TouchStart: + return TouchStart; + case WebInputEvent::TouchMove: + return TouchMove; + case WebInputEvent::TouchEnd: + return TouchEnd; + case WebInputEvent::TouchCancel: + return TouchCancel; + default: + ASSERT_NOT_REACHED(); + } + return TouchStart; +} + +static inline PlatformTouchPoint::State toPlatformTouchPointState(const WebTouchPoint::State state) +{ + switch (state) { + case WebTouchPoint::StateReleased: + return PlatformTouchPoint::TouchReleased; + case WebTouchPoint::StatePressed: + return PlatformTouchPoint::TouchPressed; + case WebTouchPoint::StateMoved: + return PlatformTouchPoint::TouchMoved; + case WebTouchPoint::StateStationary: + return PlatformTouchPoint::TouchStationary; + case WebTouchPoint::StateCancelled: + return PlatformTouchPoint::TouchCancelled; + case WebTouchPoint::StateUndefined: + ASSERT_NOT_REACHED(); + } + return PlatformTouchPoint::TouchReleased; +} + +PlatformTouchPointBuilder::PlatformTouchPointBuilder(Widget* widget, const WebTouchPoint& point) +{ + m_id = point.id; + m_state = toPlatformTouchPointState(point.state); + m_pos = widget->convertFromContainingWindow(point.position); + m_screenPos = point.screenPosition; +} + +PlatformTouchEventBuilder::PlatformTouchEventBuilder(Widget* widget, const WebTouchEvent& event) +{ + m_type = toPlatformTouchEventType(event.type); + m_ctrlKey = event.modifiers & WebInputEvent::ControlKey; + m_altKey = event.modifiers & WebInputEvent::AltKey; + m_shiftKey = event.modifiers & WebInputEvent::ShiftKey; + m_metaKey = event.modifiers & WebInputEvent::MetaKey; + + for (int i = 0; i < event.touchPointsLength; ++i) + m_touchPoints.append(PlatformTouchPointBuilder(widget, event.touchPoints[i])); +} +#endif + static int getWebInputModifiers(const UIEventWithKeyState& event) { int modifiers = 0; @@ -182,7 +241,7 @@ static int getWebInputModifiers(const UIEventWithKeyState& event) return modifiers; } -WebMouseEventBuilder::WebMouseEventBuilder(const ScrollView* view, const MouseEvent& event) +WebMouseEventBuilder::WebMouseEventBuilder(const Widget* widget, const MouseEvent& event) { if (event.type() == eventNames().mousemoveEvent) type = WebInputEvent::MouseMove; @@ -194,6 +253,8 @@ WebMouseEventBuilder::WebMouseEventBuilder(const ScrollView* view, const MouseEv type = WebInputEvent::MouseDown; else if (event.type() == eventNames().mouseupEvent) type = WebInputEvent::MouseUp; + else if (event.type() == eventNames().contextmenuEvent) + type = WebInputEvent::ContextMenu; else return; // Skip all other mouse events. timeStampSeconds = event.timeStamp() * 1.0e-3; @@ -222,16 +283,42 @@ WebMouseEventBuilder::WebMouseEventBuilder(const ScrollView* view, const MouseEv break; } } - IntPoint p = view->contentsToWindow(IntPoint(event.pageX(), event.pageY())); + ScrollView* view = widget->parent(); + IntPoint p = view->contentsToWindow( + IntPoint(event.absoluteLocation().x(), event.absoluteLocation().y())); globalX = event.screenX(); globalY = event.screenY(); windowX = p.x(); windowY = p.y(); - x = event.offsetX(); - y = event.offsetY(); + x = event.absoluteLocation().x() - widget->pos().x(); + y = event.absoluteLocation().y() - widget->pos().y(); clickCount = event.detail(); } +WebMouseWheelEventBuilder::WebMouseWheelEventBuilder(const Widget* widget, const WheelEvent& event) +{ + if (event.type() != eventNames().mousewheelEvent) + return; + type = WebInputEvent::MouseWheel; + timeStampSeconds = event.timeStamp() * 1.0e-3; + modifiers = getWebInputModifiers(event); + ScrollView* view = widget->parent(); + IntPoint p = view->contentsToWindow( + IntPoint(event.absoluteLocation().x(), event.absoluteLocation().y())); + globalX = event.screenX(); + globalY = event.screenY(); + windowX = p.x(); + windowY = p.y(); + x = event.absoluteLocation().x() - widget->pos().x(); + y = event.absoluteLocation().y() - widget->pos().y(); + deltaX = static_cast<float>(event.rawDeltaX()); + deltaY = static_cast<float>(event.rawDeltaY()); + // The 120 is from WheelEvent::initWheelEvent(). + wheelTicksX = static_cast<float>(event.wheelDeltaX()) / 120; + wheelTicksY = static_cast<float>(event.wheelDeltaY()) / 120; + scrollByPage = event.granularity() == WheelEvent::Page; +} + WebKeyboardEventBuilder::WebKeyboardEventBuilder(const KeyboardEvent& event) { if (event.type() == eventNames().keydownEvent) @@ -245,6 +332,11 @@ WebKeyboardEventBuilder::WebKeyboardEventBuilder(const KeyboardEvent& event) modifiers = getWebInputModifiers(event); timeStampSeconds = event.timeStamp() * 1.0e-3; windowsKeyCode = event.keyCode(); + + // The platform keyevent does not exist if the event was created using + // initKeyboardEvent. + if (!event.keyEvent()) + return; nativeKeyCode = event.keyEvent()->nativeVirtualKeyCode(); unsigned int numChars = std::min(event.keyEvent()->text().length(), static_cast<unsigned int>(WebKeyboardEvent::textLengthCap)); diff --git a/WebKit/chromium/src/WebInputEventConversion.h b/WebKit/chromium/src/WebInputEventConversion.h index 4c9cf82..63991a9 100644 --- a/WebKit/chromium/src/WebInputEventConversion.h +++ b/WebKit/chromium/src/WebInputEventConversion.h @@ -31,18 +31,18 @@ #ifndef WebInputEventConversion_h #define WebInputEventConversion_h -// FIXME: This relative path is a temporary hack to support using this -// header from webkit/glue. -#include "../public/WebInputEvent.h" +#include "WebInputEvent.h" #include "PlatformKeyboardEvent.h" #include "PlatformMouseEvent.h" +#include "PlatformTouchEvent.h" #include "PlatformWheelEvent.h" namespace WebCore { class KeyboardEvent; class MouseEvent; class ScrollView; +class WheelEvent; class Widget; } @@ -72,20 +72,38 @@ public: bool isCharacterKey() const; }; +#if ENABLE(TOUCH_EVENTS) +class PlatformTouchPointBuilder : public WebCore::PlatformTouchPoint { +public: + PlatformTouchPointBuilder(WebCore::Widget*, const WebTouchPoint&); +}; + +class PlatformTouchEventBuilder : public WebCore::PlatformTouchEvent { +public: + PlatformTouchEventBuilder(WebCore::Widget*, const WebTouchEvent&); +}; +#endif + // Converts a WebCore::MouseEvent to a corresponding WebMouseEvent. view is -// the ScrollView corresponding to the event. Returns true if successful. +// the ScrollView corresponding to the event. // NOTE: This is only implemented for mousemove, mouseover, mouseout, // mousedown and mouseup. If the event mapping fails, the event type will // be set to Undefined. class WebMouseEventBuilder : public WebMouseEvent { public: - WebMouseEventBuilder(const WebCore::ScrollView*, const WebCore::MouseEvent&); + WebMouseEventBuilder(const WebCore::Widget*, const WebCore::MouseEvent&); +}; + +// Converts a WebCore::WheelEvent to a corresponding WebMouseWheelEvent. +// If the event mapping fails, the event type will be set to Undefined. +class WebMouseWheelEventBuilder : public WebMouseWheelEvent { +public: + WebMouseWheelEventBuilder(const WebCore::Widget*, const WebCore::WheelEvent&); }; // Converts a WebCore::KeyboardEvent to a corresponding WebKeyboardEvent. -// Returns true if successful. NOTE: This is only implemented for keydown -// and keyup. If the event mapping fails, the event type will be set to -// Undefined. +// NOTE: This is only implemented for keydown and keyup. If the event mapping +// fails, the event type will be set to Undefined. class WebKeyboardEventBuilder : public WebKeyboardEvent { public: WebKeyboardEventBuilder(const WebCore::KeyboardEvent&); diff --git a/WebKit/chromium/src/WebKit.cpp b/WebKit/chromium/src/WebKit.cpp index a8e1851..cadcb6c 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,20 +42,29 @@ #include <wtf/Assertions.h> #include <wtf/Threading.h> +#include <wtf/text/AtomicString.h> namespace WebKit { +// Make sure we are not re-initialized in the same address space. +// Doing so may cause hard to reproduce crashes. +static bool s_webKitInitialized = false; + static WebKitClient* s_webKitClient = 0; static bool s_layoutTestMode = false; void initialize(WebKitClient* webKitClient) { + ASSERT(!s_webKitInitialized); + s_webKitInitialized = true; + ASSERT(webKitClient); ASSERT(!s_webKitClient); s_webKitClient = webKitClient; WTF::initializeThreading(); - WebCore::AtomicString::init(); + WTF::initializeMainThread(); + WTF::AtomicString::init(); // Chromium sets the minimum interval timeout to 4ms, overriding the // default of 10ms. We'd like to go lower, however there are poorly diff --git a/WebKit/chromium/src/WebLabelElement.cpp b/WebKit/chromium/src/WebLabelElement.cpp new file mode 100644 index 0000000..ef2c698 --- /dev/null +++ b/WebKit/chromium/src/WebLabelElement.cpp @@ -0,0 +1,64 @@ +/* + * 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 "WebLabelElement.h" + +#include "HTMLLabelElement.h" +#include "HTMLNames.h" +#include "WebString.h" +#include <wtf/PassRefPtr.h> + +using namespace WebCore; + +namespace WebKit { + +WebElement WebLabelElement::correspondingControl() +{ + return WebElement(unwrap<HTMLLabelElement>()->control()); +} + +WebLabelElement::WebLabelElement(const PassRefPtr<HTMLLabelElement>& elem) + : WebElement(elem) +{ +} + +WebLabelElement& WebLabelElement::operator=(const PassRefPtr<HTMLLabelElement>& elem) +{ + m_private = elem; + return *this; +} + +WebLabelElement::operator PassRefPtr<HTMLLabelElement>() const +{ + return static_cast<HTMLLabelElement*>(m_private.get()); +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/WebMediaElement.cpp b/WebKit/chromium/src/WebMediaElement.cpp new file mode 100644 index 0000000..4adda1e --- /dev/null +++ b/WebKit/chromium/src/WebMediaElement.cpp @@ -0,0 +1,64 @@ +/* + * 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 "WebMediaElement.h" + +#include "HTMLMediaElement.h" +#include "MediaPlayer.h" +#include "WebMediaPlayer.h" +#include "WebMediaPlayerClientImpl.h" +#include <wtf/PassRefPtr.h> + +using namespace WebCore; + +namespace WebKit { + +WebMediaPlayer* WebMediaElement::player() const +{ + return WebMediaPlayerClientImpl::fromMediaElement(this)->mediaPlayer(); +} + +WebMediaElement::WebMediaElement(const PassRefPtr<HTMLMediaElement>& elem) + : WebElement(elem) +{ +} + +WebMediaElement& WebMediaElement::operator=(const PassRefPtr<HTMLMediaElement>& elem) +{ + m_private = elem; + return *this; +} + +WebMediaElement::operator PassRefPtr<HTMLMediaElement>() const +{ + return static_cast<HTMLMediaElement*>(m_private.get()); +} +} // namespace WebKit diff --git a/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp b/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp index b1f1f03..f0ece0d 100644 --- a/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp +++ b/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp @@ -7,7 +7,6 @@ #if ENABLE(VIDEO) -#include "CString.h" #include "Frame.h" #include "GraphicsContext.h" #include "HTMLMediaElement.h" @@ -15,20 +14,30 @@ #include "KURL.h" #include "MediaPlayer.h" #include "NotImplemented.h" +#include "RenderView.h" #include "TimeRanges.h" +#include "VideoLayerChromium.h" +#if USE(ACCELERATED_COMPOSITING) +#include "RenderLayerCompositor.h" +#endif + +#include "VideoFrameChromium.h" +#include "VideoFrameChromiumImpl.h" #include "WebCanvas.h" #include "WebCString.h" #include "WebFrameClient.h" #include "WebFrameImpl.h" #include "WebKit.h" #include "WebKitClient.h" +#include "WebMediaElement.h" #include "WebMediaPlayer.h" #include "WebMimeRegistry.h" #include "WebRect.h" #include "WebSize.h" #include "WebString.h" #include "WebURL.h" +#include "WebViewImpl.h" // WebCommon.h defines WEBKIT_USING_SKIA so this has to be included last. #if WEBKIT_USING_SKIA @@ -36,6 +45,7 @@ #endif #include <wtf/Assertions.h> +#include <wtf/text/CString.h> using namespace WebCore; @@ -45,6 +55,7 @@ static WebMediaPlayer* createWebMediaPlayer( WebMediaPlayerClient* client, Frame* frame) { WebFrameImpl* webFrame = WebFrameImpl::fromFrame(frame); + if (!webFrame->client()) return 0; return webFrame->client()->createMediaPlayer(webFrame, client); @@ -71,6 +82,17 @@ void WebMediaPlayerClientImpl::registerSelf(MediaEngineRegistrar registrar) } } +WebMediaPlayerClientImpl* WebMediaPlayerClientImpl::fromMediaElement(const WebMediaElement* element) +{ + PlatformMedia pm = element->constUnwrap<HTMLMediaElement>()->platformMedia(); + return static_cast<WebMediaPlayerClientImpl*>(pm.media.chromiumMediaPlayer); +} + +WebMediaPlayer* WebMediaPlayerClientImpl::mediaPlayer() const +{ + return m_webMediaPlayer.get(); +} + // WebMediaPlayerClient -------------------------------------------------------- void WebMediaPlayerClientImpl::networkStateChanged() @@ -106,6 +128,10 @@ void WebMediaPlayerClientImpl::timeChanged() void WebMediaPlayerClientImpl::repaint() { ASSERT(m_mediaPlayer); +#if USE(ACCELERATED_COMPOSITING) + if (m_videoLayer.get() && supportsAcceleratedRendering()) + m_videoLayer->setNeedsDisplay(FloatRect(0, 0, m_videoLayer->bounds().width(), m_videoLayer->bounds().height())); +#endif m_mediaPlayer->repaint(); } @@ -133,12 +159,20 @@ void WebMediaPlayerClientImpl::sawUnsupportedTracks() m_mediaPlayer->mediaPlayerClient()->mediaPlayerSawUnsupportedTracks(m_mediaPlayer); } +float WebMediaPlayerClientImpl::volume() const +{ + if (m_mediaPlayer) + return m_mediaPlayer->volume(); + return 0.0f; +} + // MediaPlayerPrivateInterface ------------------------------------------------- void WebMediaPlayerClientImpl::load(const String& url) { Frame* frame = static_cast<HTMLMediaElement*>( m_mediaPlayer->mediaPlayerClient())->document()->frame(); + m_webMediaPlayer.set(createWebMediaPlayer(this, frame)); if (m_webMediaPlayer.get()) m_webMediaPlayer->load(KURL(ParsedURLString, url)); @@ -150,6 +184,22 @@ void WebMediaPlayerClientImpl::cancelLoad() m_webMediaPlayer->cancelLoad(); } +#if USE(ACCELERATED_COMPOSITING) +PlatformLayer* WebMediaPlayerClientImpl::platformLayer() const +{ + ASSERT(m_supportsAcceleratedCompositing); + return m_videoLayer.get(); +} +#endif + +PlatformMedia WebMediaPlayerClientImpl::platformMedia() const +{ + PlatformMedia pm; + pm.type = PlatformMedia::ChromiumMediaPlayerType; + pm.media.chromiumMediaPlayer = const_cast<WebMediaPlayerClientImpl*>(this); + return pm; +} + void WebMediaPlayerClientImpl::play() { if (m_webMediaPlayer.get()) @@ -353,6 +403,13 @@ bool WebMediaPlayerClientImpl::hasSingleSecurityOrigin() const return false; } +#if USE(ACCELERATED_COMPOSITING) +bool WebMediaPlayerClientImpl::supportsAcceleratedRendering() const +{ + return m_supportsAcceleratedCompositing; +} +#endif + MediaPlayer::MovieLoadType WebMediaPlayerClientImpl::movieLoadType() const { if (m_webMediaPlayer.get()) @@ -361,10 +418,48 @@ MediaPlayer::MovieLoadType WebMediaPlayerClientImpl::movieLoadType() const return MediaPlayer::Unknown; } +VideoFrameChromium* WebMediaPlayerClientImpl::getCurrentFrame() +{ + VideoFrameChromium* videoFrame = 0; + if (m_webMediaPlayer.get()) { + WebVideoFrame* webkitVideoFrame = m_webMediaPlayer->getCurrentFrame(); + if (webkitVideoFrame) + videoFrame = new VideoFrameChromiumImpl(webkitVideoFrame); + } + return videoFrame; +} + +void WebMediaPlayerClientImpl::putCurrentFrame(VideoFrameChromium* videoFrame) +{ + if (videoFrame) { + if (m_webMediaPlayer.get()) { + m_webMediaPlayer->putCurrentFrame( + VideoFrameChromiumImpl::toWebVideoFrame(videoFrame)); + } + delete videoFrame; + } +} + MediaPlayerPrivateInterface* WebMediaPlayerClientImpl::create(MediaPlayer* player) { WebMediaPlayerClientImpl* client = new WebMediaPlayerClientImpl(); client->m_mediaPlayer = player; + +#if USE(ACCELERATED_COMPOSITING) + Frame* frame = static_cast<HTMLMediaElement*>( + client->m_mediaPlayer->mediaPlayerClient())->document()->frame(); + + // This does not actually check whether the hardware can support accelerated + // compositing, but only if the flag is set. However, this is checked lazily + // in WebViewImpl::setIsAcceleratedCompositingActive() and will fail there + // if necessary. + client->m_supportsAcceleratedCompositing = + frame->contentRenderer()->compositor()->hasAcceleratedCompositing(); + + if (client->m_supportsAcceleratedCompositing) + client->m_videoLayer = VideoLayerChromium::create(0, client); +#endif + return client; } @@ -395,6 +490,10 @@ MediaPlayer::SupportsType WebMediaPlayerClientImpl::supportsType(const String& t WebMediaPlayerClientImpl::WebMediaPlayerClientImpl() : m_mediaPlayer(0) +#if USE(ACCELERATED_COMPOSITING) + , m_videoLayer(0) + , m_supportsAcceleratedCompositing(false) +#endif { } diff --git a/WebKit/chromium/src/WebMediaPlayerClientImpl.h b/WebKit/chromium/src/WebMediaPlayerClientImpl.h index 4adbed2..e014871 100644 --- a/WebKit/chromium/src/WebMediaPlayerClientImpl.h +++ b/WebKit/chromium/src/WebMediaPlayerClientImpl.h @@ -34,22 +34,32 @@ #if ENABLE(VIDEO) #include "MediaPlayerPrivate.h" +#include "VideoFrameChromium.h" +#include "VideoFrameProvider.h" #include "WebMediaPlayerClient.h" #include <wtf/OwnPtr.h> namespace WebKit { +class WebMediaElement; class WebMediaPlayer; // This class serves as a bridge between WebCore::MediaPlayer and // WebKit::WebMediaPlayer. -class WebMediaPlayerClientImpl : public WebMediaPlayerClient - , public WebCore::MediaPlayerPrivateInterface { +class WebMediaPlayerClientImpl : public WebCore::MediaPlayerPrivateInterface + , public WebCore::VideoFrameProvider + , public WebMediaPlayerClient { + public: static bool isEnabled(); static void setIsEnabled(bool); static void registerSelf(WebCore::MediaEngineRegistrar); + static WebMediaPlayerClientImpl* fromMediaElement(const WebMediaElement* element); + + // Returns the encapsulated WebKit::WebMediaPlayer. + WebMediaPlayer* mediaPlayer() const; + // WebMediaPlayerClient methods: virtual void networkStateChanged(); virtual void readyStateChanged(); @@ -61,10 +71,15 @@ public: virtual void rateChanged(); virtual void sizeChanged(); virtual void sawUnsupportedTracks(); + virtual float volume() const; // MediaPlayerPrivateInterface methods: - virtual void load(const WebCore::String& url); + virtual void load(const WTF::String& url); virtual void cancelLoad(); +#if USE(ACCELERATED_COMPOSITING) + virtual WebCore::PlatformLayer* platformLayer() const; +#endif + virtual WebCore::PlatformMedia platformMedia() const; virtual void play(); virtual void pause(); virtual bool supportsFullscreen() const; @@ -93,18 +108,30 @@ public: virtual void setSize(const WebCore::IntSize&); virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect&); virtual bool hasSingleSecurityOrigin() const; +#if USE(ACCELERATED_COMPOSITING) + virtual bool supportsAcceleratedRendering() const; +#endif + virtual WebCore::MediaPlayer::MovieLoadType movieLoadType() const; + // VideoFrameProvider methods: + virtual WebCore::VideoFrameChromium* getCurrentFrame(); + virtual void putCurrentFrame(WebCore::VideoFrameChromium*); + private: WebMediaPlayerClientImpl(); static WebCore::MediaPlayerPrivateInterface* create(WebCore::MediaPlayer*); - static void getSupportedTypes(WTF::HashSet<WebCore::String>&); + static void getSupportedTypes(WTF::HashSet<WTF::String>&); static WebCore::MediaPlayer::SupportsType supportsType( - const WebCore::String& type, const WebCore::String& codecs); + const WTF::String& type, const WTF::String& codecs); WebCore::MediaPlayer* m_mediaPlayer; OwnPtr<WebMediaPlayer> m_webMediaPlayer; +#if USE(ACCELERATED_COMPOSITING) + RefPtr<WebCore::PlatformLayer> m_videoLayer; + bool m_supportsAcceleratedCompositing; +#endif static bool m_isEnabled; }; diff --git a/WebKit/chromium/src/WebNamedNodeMap.cpp b/WebKit/chromium/src/WebNamedNodeMap.cpp new file mode 100644 index 0000000..e2455e6 --- /dev/null +++ b/WebKit/chromium/src/WebNamedNodeMap.cpp @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebNamedNodeMap.h" + +#include "NamedNodeMap.h" +#include "Node.h" +#include "WebAttribute.h" +#include "WebNode.h" +#include <wtf/PassRefPtr.h> + +using namespace WebCore; + +namespace WebKit { + +void WebNamedNodeMap::reset() +{ + m_private.reset(); +} + +void WebNamedNodeMap::assign(const WebNamedNodeMap& other) +{ + m_private = other.m_private; +} + +WebNamedNodeMap::WebNamedNodeMap(const PassRefPtr<NamedNodeMap>& other) + : m_private(other) +{ +} + +unsigned WebNamedNodeMap::length() const +{ + return m_private->length(); +} + +WebAttribute WebNamedNodeMap::attributeItem(unsigned index) const +{ + return WebAttribute(m_private->attributeItem(index)); +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/WebNode.cpp b/WebKit/chromium/src/WebNode.cpp index 9fbf573..caea589 100644 --- a/WebKit/chromium/src/WebNode.cpp +++ b/WebKit/chromium/src/WebNode.cpp @@ -38,9 +38,9 @@ #include "NodeList.h" #include "EventListenerWrapper.h" +#include "WebDOMEvent.h" +#include "WebDOMEventListener.h" #include "WebDocument.h" -#include "WebEvent.h" -#include "WebEventListener.h" #include "WebFrameImpl.h" #include "WebNodeList.h" #include "WebString.h" @@ -48,26 +48,28 @@ #include "markup.h" -#include <wtf/PassRefPtr.h> - using namespace WebCore; namespace WebKit { -class WebNodePrivate : public Node { -}; - void WebNode::reset() { - assign(0); + m_private.reset(); } void WebNode::assign(const WebNode& other) { - WebNodePrivate* p = const_cast<WebNodePrivate*>(other.m_private); - if (p) - p->ref(); - assign(p); + m_private = other.m_private; +} + +bool WebNode::equals(const WebNode& n) const +{ + return (m_private.get() == n.m_private.get()); +} + +bool WebNode::lessThan(const WebNode& n) const +{ + return (m_private.get() < n.m_private.get()); } WebNode::NodeType WebNode::nodeType() const @@ -77,7 +79,7 @@ WebNode::NodeType WebNode::nodeType() const WebNode WebNode::parentNode() const { - return PassRefPtr<Node>(const_cast<Node*>(m_private->parentNode())); + return WebNode(const_cast<ContainerNode*>(m_private->parentNode())); } WebString WebNode::nodeName() const @@ -97,35 +99,6 @@ bool WebNode::setNodeValue(const WebString& value) return !exceptionCode; } -WebNode::WebNode(const PassRefPtr<Node>& node) - : m_private(static_cast<WebNodePrivate*>(node.releaseRef())) -{ -} - -WebNode& WebNode::operator=(const PassRefPtr<Node>& node) -{ - assign(static_cast<WebNodePrivate*>(node.releaseRef())); - return *this; -} - -WebNode::operator PassRefPtr<Node>() const -{ - return PassRefPtr<Node>(const_cast<WebNodePrivate*>(m_private)); -} - -void WebNode::assign(WebNodePrivate* p) -{ - // p is already ref'd for us by the caller - if (m_private) - m_private->deref(); - m_private = p; -} - -WebFrame* WebNode::frame() const -{ - return WebFrameImpl::fromFrame(m_private->document()->frame()); -} - WebDocument WebNode::document() const { return WebDocument(m_private->document()); @@ -163,7 +136,7 @@ WebNodeList WebNode::childNodes() WebString WebNode::createMarkup() const { - return WebCore::createMarkup(m_private); + return WebCore::createMarkup(m_private.get()); } bool WebNode::isTextNode() const @@ -176,22 +149,54 @@ bool WebNode::isElementNode() const return m_private->isElementNode(); } -void WebNode::addEventListener(const WebString& eventType, WebEventListener* listener, bool useCapture) +void WebNode::addEventListener(const WebString& eventType, WebDOMEventListener* listener, bool useCapture) { EventListenerWrapper* listenerWrapper = - listener->createEventListenerWrapper(eventType, useCapture, m_private); + listener->createEventListenerWrapper(eventType, useCapture, m_private.get()); // The listenerWrapper is only referenced by the actual Node. Once it goes // away, the wrapper notifies the WebEventListener so it can clear its // pointer to it. m_private->addEventListener(eventType, adoptRef(listenerWrapper), useCapture); } -void WebNode::removeEventListener(const WebString& eventType, WebEventListener* listener, bool useCapture) +void WebNode::removeEventListener(const WebString& eventType, WebDOMEventListener* listener, bool useCapture) { EventListenerWrapper* listenerWrapper = - listener->getEventListenerWrapper(eventType, useCapture, m_private); + listener->getEventListenerWrapper(eventType, useCapture, m_private.get()); m_private->removeEventListener(eventType, listenerWrapper, useCapture); // listenerWrapper is now deleted. } +void WebNode::simulateClick() +{ + RefPtr<Event> noEvent; + m_private->dispatchSimulatedClick(noEvent); +} + +WebNodeList WebNode::getElementsByTagName(const WebString& tag) const +{ + return WebNodeList(m_private->getElementsByTagName(tag)); +} + +bool WebNode::hasNonEmptyBoundingBox() const +{ + return m_private->hasNonEmptyBoundingBox(); +} + +WebNode::WebNode(const PassRefPtr<Node>& node) + : m_private(node) +{ +} + +WebNode& WebNode::operator=(const PassRefPtr<Node>& node) +{ + m_private = node; + return *this; +} + +WebNode::operator PassRefPtr<Node>() const +{ + return m_private.get(); +} + } // namespace WebKit diff --git a/WebKit/chromium/src/WebNotification.cpp b/WebKit/chromium/src/WebNotification.cpp index 1f6916e..6aa8439 100644 --- a/WebKit/chromium/src/WebNotification.cpp +++ b/WebKit/chromium/src/WebNotification.cpp @@ -36,6 +36,7 @@ #include "Notification.h" #include "WebString.h" +#include "WebTextDirection.h" #include "WebURL.h" #include <wtf/PassRefPtr.h> @@ -76,10 +77,10 @@ WebURL WebNotification::url() const return m_private->url(); } -WebString WebNotification::icon() const +WebURL WebNotification::iconURL() const { ASSERT(!isHTML()); - return m_private->contents().icon(); + return m_private->iconURL(); } WebString WebNotification::title() const @@ -94,6 +95,29 @@ WebString WebNotification::body() const return m_private->contents().body(); } +// FIXME: remove dir() when unreferenced. Being replaced by direction(). +WebString WebNotification::dir() const +{ + return m_private->dir(); +} + +WebTextDirection WebNotification::direction() const +{ + return (m_private->direction() == RTL) ? + WebTextDirectionRightToLeft : + WebTextDirectionLeftToRight; +} + +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/AutocompletePopupMenuClient.cpp b/WebKit/chromium/src/WebOptionElement.cpp index 9620ffc..49bff3b 100644 --- a/WebKit/chromium/src/AutocompletePopupMenuClient.cpp +++ b/WebKit/chromium/src/WebOptionElement.cpp @@ -29,56 +29,72 @@ */ #include "config.h" -#include "AutocompletePopupMenuClient.h" +#include "WebOptionElement.h" -#include "HTMLInputElement.h" +#include "HTMLNames.h" +#include "HTMLOptionElement.h" +#include "HTMLSelectElement.h" #include "WebString.h" -#include "WebVector.h" +#include <wtf/PassRefPtr.h> using namespace WebCore; namespace WebKit { -unsigned AutocompletePopupMenuClient::getSuggestionsCount() const +void WebOptionElement::setValue(const WebString& newValue) { - return m_suggestions.size(); + return unwrap<HTMLOptionElement>()->setValue(newValue); } -WebString AutocompletePopupMenuClient::getSuggestion(unsigned listIndex) const +WebString WebOptionElement::value() const { - ASSERT(listIndex >= 0 && listIndex < m_suggestions.size()); - return m_suggestions[listIndex]; + return constUnwrap<HTMLOptionElement>()->value(); } -void AutocompletePopupMenuClient::removeSuggestionAtIndex(unsigned listIndex) +int WebOptionElement::index() const { - ASSERT(listIndex >= 0 && listIndex < m_suggestions.size()); - m_suggestions.remove(listIndex); + return constUnwrap<HTMLOptionElement>()->index(); } -void AutocompletePopupMenuClient::initialize( - HTMLInputElement* textField, - const WebVector<WebString>& suggestions, - int defaultSuggestionIndex) +WebString WebOptionElement::text() const { - ASSERT(defaultSuggestionIndex < static_cast<int>(suggestions.size())); + return constUnwrap<HTMLOptionElement>()->text(); +} + +bool WebOptionElement::defaultSelected() const +{ + return constUnwrap<HTMLOptionElement>()->defaultSelected(); +} - // The suggestions must be set before initializing the - // SuggestionsPopupMenuClient. - setSuggestions(suggestions); +void WebOptionElement::setDefaultSelected(bool newSelected) +{ + return unwrap<HTMLOptionElement>()->setDefaultSelected(newSelected); +} - SuggestionsPopupMenuClient::initialize(textField, defaultSuggestionIndex); +WebString WebOptionElement::label() const +{ + return constUnwrap<HTMLOptionElement>()->label(); } -void AutocompletePopupMenuClient::setSuggestions(const WebVector<WebString>& suggestions) +bool WebOptionElement::isEnabled() const { - m_suggestions.clear(); - for (size_t i = 0; i < suggestions.size(); ++i) - m_suggestions.append(suggestions[i]); + return !(constUnwrap<HTMLOptionElement>()->disabled()); +} - // Try to preserve selection if possible. - if (getSelectedIndex() >= static_cast<int>(suggestions.size())) - setSelectedIndex(-1); +WebOptionElement::WebOptionElement(const PassRefPtr<HTMLOptionElement>& elem) + : WebFormControlElement(elem) +{ +} + +WebOptionElement& WebOptionElement::operator=(const PassRefPtr<HTMLOptionElement>& elem) +{ + m_private = elem; + return *this; +} + +WebOptionElement::operator PassRefPtr<HTMLOptionElement>() const +{ + return static_cast<HTMLOptionElement*>(m_private.get()); } } // namespace WebKit diff --git a/WebKit/chromium/src/WebPageSerializer.cpp b/WebKit/chromium/src/WebPageSerializer.cpp index 1010285..4f93702 100644 --- a/WebKit/chromium/src/WebPageSerializer.cpp +++ b/WebKit/chromium/src/WebPageSerializer.cpp @@ -59,7 +59,7 @@ bool WebPageSerializer::serialize(WebFrame* frame, WebString WebPageSerializer::generateMetaCharsetDeclaration(const WebString& charset) { - return String::format("<META http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">", + return String::format("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">", charset.utf8().data()); } @@ -75,7 +75,7 @@ WebString WebPageSerializer::generateBaseTagDeclaration(const WebString& baseTar String targetDeclaration; if (!baseTarget.isEmpty()) targetDeclaration = String::format(" target=\"%s\"", baseTarget.utf8().data()); - return String::format("<BASE href=\".\"%s>", targetDeclaration.utf8().data()); + return String::format("<base href=\".\"%s>", targetDeclaration.utf8().data()); } } // namespace WebKit diff --git a/WebKit/chromium/src/WebPageSerializerImpl.cpp b/WebKit/chromium/src/WebPageSerializerImpl.cpp index d5b2b7f..885ee25 100644 --- a/WebKit/chromium/src/WebPageSerializerImpl.cpp +++ b/WebKit/chromium/src/WebPageSerializerImpl.cpp @@ -170,7 +170,7 @@ String WebPageSerializerImpl::preActionBeforeSerializeOpenTag( // Get encoding info. String xmlEncoding = param->doc->xmlEncoding(); if (xmlEncoding.isEmpty()) - xmlEncoding = param->doc->frame()->loader()->encoding(); + xmlEncoding = param->doc->frame()->loader()->writer()->encoding(); if (xmlEncoding.isEmpty()) xmlEncoding = UTF8Encoding().name(); result.append("<?xml version=\""); @@ -306,7 +306,7 @@ void WebPageSerializerImpl::openTagToString(const Element* element, if (needSkip) return; // Add open tag - result += "<" + element->nodeName(); + result += "<" + element->nodeName().lower(); // Go through all attributes and serialize them. const NamedNodeMap *attrMap = element->attributes(true); if (attrMap) { @@ -374,18 +374,17 @@ void WebPageSerializerImpl::endTagToString(const Element* element, // Write end tag when element has child/children. if (element->hasChildNodes() || param->hasAddedContentsBeforeEnd) { result += "</"; - result += element->nodeName(); + result += element->nodeName().lower(); result += ">"; } else { // Check whether we have to write end tag for empty element. if (param->isHTMLDocument) { result += ">"; - const HTMLElement* htmlElement = - static_cast<const HTMLElement*>(element); - if (htmlElement->endTagRequirement() == TagStatusRequired) { + // FIXME: This code is horribly wrong. WebPageSerializerImpl must die. + if (!static_cast<const HTMLElement*>(element)->ieForbidsInsertHTML()) { // We need to write end tag when it is required. result += "</"; - result += element->nodeName(); + result += element->nodeName().lower(); result += ">"; } } else { @@ -510,11 +509,11 @@ bool WebPageSerializerImpl::serialize() const KURL& currentFrameURL = currentFrame->frame()->loader()->url(); // Check whether we have done this document. - if (m_localLinks.contains(currentFrameURL.string())) { + if (currentFrameURL.isValid() && m_localLinks.contains(currentFrameURL.string())) { // A new document, we will serialize it. didSerialization = true; // Get target encoding for current document. - String encoding = currentFrame->frame()->loader()->encoding(); + String encoding = currentFrame->frame()->loader()->writer()->encoding(); // Create the text encoding object with target encoding. TextEncoding textEncoding(encoding); // Construct serialize parameter for late processing document. diff --git a/WebKit/chromium/src/WebPageSerializerImpl.h b/WebKit/chromium/src/WebPageSerializerImpl.h index 8f6a99f..a7f2fb4 100644 --- a/WebKit/chromium/src/WebPageSerializerImpl.h +++ b/WebKit/chromium/src/WebPageSerializerImpl.h @@ -32,10 +32,11 @@ #define WebPageSerializerImpl_h #include "PlatformString.h" -#include "StringBuilder.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" #include "WebPageSerializer.h" @@ -47,7 +48,6 @@ namespace WebCore { class Document; class Element; class Node; -class String; class TextEncoding; } @@ -93,7 +93,7 @@ private: WebPageSerializerClient* m_client; // This hash map is used to map resource URL of original link to its local // file path. - typedef HashMap<WebCore::String, WebCore::String> LinkLocalPathMap; + typedef HashMap<WTF::String, WTF::String> LinkLocalPathMap; // local_links_ include all pair of local resource path and corresponding // original link. LinkLocalPathMap m_localLinks; @@ -107,7 +107,7 @@ private: // serialized or not; bool m_framesCollected; // Local directory name of all local resource files. - WebCore::String m_localDirectoryName; + WTF::String m_localDirectoryName; // Vector for saving all frames which need to be serialized. Vector<WebFrameImpl*> m_frames; @@ -124,7 +124,7 @@ private: // Document object of current frame. WebCore::Document* doc; // Local directory name of all local resource files. - const WebCore::String& directoryName; + const WTF::String& directoryName; // Flag indicates current doc is html document or not. It's a cache value // of Document.isHTMLDocument(). @@ -151,31 +151,31 @@ private: SerializeDomParam(const WebCore::KURL& currentFrameURL, const WebCore::TextEncoding& textEncoding, WebCore::Document* doc, - const WebCore::String& directoryName); + const WTF::String& directoryName); }; // Collect all target frames which need to be serialized. void collectTargetFrames(); // Before we begin serializing open tag of a element, we give the target // element a chance to do some work prior to add some additional data. - WebCore::String preActionBeforeSerializeOpenTag(const WebCore::Element* element, + WTF::String preActionBeforeSerializeOpenTag(const WebCore::Element* element, SerializeDomParam* param, bool* needSkip); // After we finish serializing open tag of a element, we give the target // element a chance to do some post work to add some additional data. - WebCore::String postActionAfterSerializeOpenTag(const WebCore::Element* element, + WTF::String postActionAfterSerializeOpenTag(const WebCore::Element* element, SerializeDomParam* param); // Before we begin serializing end tag of a element, we give the target // element a chance to do some work prior to add some additional data. - WebCore::String preActionBeforeSerializeEndTag(const WebCore::Element* element, + WTF::String preActionBeforeSerializeEndTag(const WebCore::Element* element, SerializeDomParam* param, bool* needSkip); // After we finish serializing end tag of a element, we give the target // element a chance to do some post work to add some additional data. - WebCore::String postActionAfterSerializeEndTag(const WebCore::Element* element, + WTF::String postActionAfterSerializeEndTag(const WebCore::Element* element, SerializeDomParam* param); // Save generated html content to data buffer. - void saveHTMLContentToBuffer(const WebCore::String& content, + void saveHTMLContentToBuffer(const WTF::String& content, SerializeDomParam* param); // Flushes the content buffer by encoding and sending the content to the // WebPageSerializerClient. Content is not flushed if the buffer is not full diff --git a/WebKit/chromium/src/WebPasswordFormData.cpp b/WebKit/chromium/src/WebPasswordFormData.cpp index 64b1754..eb230d5 100644 --- a/WebKit/chromium/src/WebPasswordFormData.cpp +++ b/WebKit/chromium/src/WebPasswordFormData.cpp @@ -162,7 +162,10 @@ WebPasswordFormData::WebPasswordFormData(const WebFormElement& webForm) KURL fullOrigin(ParsedURLString, form->document()->documentURI()); // Calculate the canonical action URL - KURL fullAction = frame->loader()->completeURL(form->action()); + String action = form->action(); + if (action.isNull()) + action = ""; // missing 'action' attribute implies current URL + KURL fullAction = frame->loader()->completeURL(action); if (!fullAction.isValid()) return; diff --git a/WebKit/chromium/src/WebPasswordFormUtils.cpp b/WebKit/chromium/src/WebPasswordFormUtils.cpp index 766dc63..e5d5411 100644 --- a/WebKit/chromium/src/WebPasswordFormUtils.cpp +++ b/WebKit/chromium/src/WebPasswordFormUtils.cpp @@ -65,7 +65,7 @@ void findPasswordFormFields(HTMLFormElement* form, PasswordFormFields* fields) int firstPasswordIndex = 0; // First, find the password fields and activated submit button - const Vector<HTMLFormControlElement*>& formElements = form->formElements; + const Vector<HTMLFormControlElement*>& formElements = form->associatedElements(); for (size_t i = 0; i < formElements.size(); i++) { HTMLFormControlElement* formElement = formElements[i]; if (formElement->isActivatedSubmit()) diff --git a/WebKit/chromium/src/WebPluginContainerImpl.cpp b/WebKit/chromium/src/WebPluginContainerImpl.cpp index 86cac26..7f74db2 100644 --- a/WebKit/chromium/src/WebPluginContainerImpl.cpp +++ b/WebKit/chromium/src/WebPluginContainerImpl.cpp @@ -33,13 +33,18 @@ #include "Chrome.h" #include "ChromeClientImpl.h" +#include "WebClipboard.h" #include "WebCursorInfo.h" #include "WebDataSourceImpl.h" +#include "WebElement.h" #include "WebInputEvent.h" #include "WebInputEventConversion.h" #include "WebKit.h" +#include "WebKitClient.h" #include "WebPlugin.h" #include "WebRect.h" +#include "WebString.h" +#include "WebURL.h" #include "WebURLError.h" #include "WebURLRequest.h" #include "WebVector.h" @@ -56,10 +61,13 @@ #include "HTMLFormElement.h" #include "HTMLNames.h" #include "HTMLPlugInElement.h" +#include "KeyboardCodes.h" #include "KeyboardEvent.h" #include "MouseEvent.h" #include "Page.h" +#include "RenderBox.h" #include "ScrollView.h" +#include "WheelEvent.h" #if WEBKIT_USING_SKIA #include "PlatformContextSkia.h" @@ -124,13 +132,13 @@ void WebPluginContainerImpl::invalidateRect(const IntRect& rect) IntRect clipRect = parent()->windowClipRect(); damageRect.intersect(clipRect); - parent()->hostWindow()->repaint(damageRect, true); + parent()->hostWindow()->invalidateContentsAndWindow(damageRect, false /*immediate*/); } -void WebPluginContainerImpl::setFocus() +void WebPluginContainerImpl::setFocus(bool focused) { - Widget::setFocus(); - m_webPlugin->updateFocus(true); + Widget::setFocus(focused); + m_webPlugin->updateFocus(focused); } void WebPluginContainerImpl::show() @@ -160,8 +168,15 @@ void WebPluginContainerImpl::handleEvent(Event* event) // where mozilla behaves differently than the spec. if (event->isMouseEvent()) handleMouseEvent(static_cast<MouseEvent*>(event)); + else if (event->isWheelEvent()) + handleWheelEvent(static_cast<WheelEvent*>(event)); else if (event->isKeyboardEvent()) handleKeyboardEvent(static_cast<KeyboardEvent*>(event)); + + // FIXME: it would be cleaner if Widget::handleEvent returned true/false and + // HTMLPluginElement called setDefaultHandled or defaultEventHandler. + if (!event->defaultHandled()) + m_element->Node::defaultEventHandler(event); } void WebPluginContainerImpl::frameRectsChanged() @@ -170,6 +185,12 @@ void WebPluginContainerImpl::frameRectsChanged() reportGeometry(); } +void WebPluginContainerImpl::widgetPositionsUpdated() +{ + Widget::widgetPositionsUpdated(); + reportGeometry(); +} + void WebPluginContainerImpl::setParentVisible(bool parentVisible) { // We override this function to make sure that geometry updates are sent @@ -200,6 +221,49 @@ void WebPluginContainerImpl::setParent(ScrollView* view) reportGeometry(); } +bool WebPluginContainerImpl::supportsPaginatedPrint() const +{ + return m_webPlugin->supportsPaginatedPrint(); +} + +int WebPluginContainerImpl::printBegin(const IntRect& printableArea, + int printerDPI) const +{ + return m_webPlugin->printBegin(printableArea, printerDPI); +} + +bool WebPluginContainerImpl::printPage(int pageNumber, + WebCore::GraphicsContext* gc) +{ + gc->save(); +#if WEBKIT_USING_SKIA + WebCanvas* canvas = gc->platformContext()->canvas(); +#elif WEBKIT_USING_CG + WebCanvas* canvas = gc->platformContext(); +#endif + bool ret = m_webPlugin->printPage(pageNumber, canvas); + gc->restore(); + return ret; +} + +void WebPluginContainerImpl::printEnd() +{ + return m_webPlugin->printEnd(); +} + +void WebPluginContainerImpl::copy() +{ + if (!plugin()->hasSelection()) + return; + + webKitClient()->clipboard()->writeHTML(plugin()->selectionAsMarkup(), WebURL(), plugin()->selectionAsText(), false); +} + +WebElement WebPluginContainerImpl::element() +{ + return WebElement(m_element); +} + void WebPluginContainerImpl::invalidate() { Widget::invalidate(); @@ -339,7 +403,7 @@ void WebPluginContainerImpl::handleMouseEvent(MouseEvent* event) // in the call to HandleEvent. See http://b/issue?id=1362948 FrameView* parentView = static_cast<FrameView*>(parent()); - WebMouseEventBuilder webEvent(parentView, *event); + WebMouseEventBuilder webEvent(this, *event); if (webEvent.type == WebInputEvent::Undefined) return; @@ -353,22 +417,7 @@ void WebPluginContainerImpl::handleMouseEvent(MouseEvent* event) } WebCursorInfo cursorInfo; - bool handled = m_webPlugin->handleInputEvent(webEvent, cursorInfo); -#if !OS(DARWIN) - // TODO(pkasting): http://b/1119691 This conditional seems exactly - // backwards, but if I reverse it, giving focus to a transparent - // (windowless) plugin fails. - handled = !handled; - // TODO(awalker): oddly, the above is not true in Mac builds. Looking - // at Apple's corresponding code for Mac and Windows (PluginViewMac and - // PluginViewWin), setDefaultHandled() gets called when handleInputEvent() - // returns true, which then indicates to WebCore that the plugin wants to - // swallow the event--which is what we want. Calling setDefaultHandled() - // fixes several Mac Chromium bugs, but does indeed prevent windowless plugins - // from getting focus in Windows builds, as pkasting notes above. So for - // now, we only do so in Mac builds. -#endif - if (handled) + if (m_webPlugin->handleInputEvent(webEvent, cursorInfo)) event->setDefaultHandled(); // A windowless plugin can change the cursor in response to a mouse move @@ -382,19 +431,38 @@ void WebPluginContainerImpl::handleMouseEvent(MouseEvent* event) chromeClient->setCursorForPlugin(cursorInfo); } +void WebPluginContainerImpl::handleWheelEvent(WheelEvent* event) +{ + WebMouseWheelEventBuilder webEvent(this, *event); + if (webEvent.type == WebInputEvent::Undefined) + return; + + WebCursorInfo cursorInfo; + if (m_webPlugin->handleInputEvent(webEvent, cursorInfo)) + event->setDefaultHandled(); +} + void WebPluginContainerImpl::handleKeyboardEvent(KeyboardEvent* event) { WebKeyboardEventBuilder webEvent(*event); if (webEvent.type == WebInputEvent::Undefined) return; - WebCursorInfo cursor_info; - bool handled = m_webPlugin->handleInputEvent(webEvent, cursor_info); -#if !OS(DARWIN) - // TODO(pkasting): http://b/1119691 See above. - handled = !handled; + if (webEvent.type == WebInputEvent::KeyDown) { +#if defined(OS_MACOSX) + if (webEvent.modifiers == WebInputEvent::MetaKey +#else + if (webEvent.modifiers == WebInputEvent::ControlKey #endif - if (handled) + && webEvent.windowsKeyCode == VKEY_C) { + copy(); + event->setDefaultHandled(); + return; + } + } + + WebCursorInfo cursorInfo; + if (m_webPlugin->handleInputEvent(webEvent, cursorInfo)) event->setDefaultHandled(); } diff --git a/WebKit/chromium/src/WebPluginContainerImpl.h b/WebKit/chromium/src/WebPluginContainerImpl.h index 00450bb..2a46e00 100644 --- a/WebKit/chromium/src/WebPluginContainerImpl.h +++ b/WebKit/chromium/src/WebPluginContainerImpl.h @@ -31,9 +31,7 @@ #ifndef WebPluginContainerImpl_h #define WebPluginContainerImpl_h -// FIXME: This relative path is a temporary hack to support using this -// header from webkit/glue. -#include "../public/WebPluginContainer.h" +#include "WebPluginContainer.h" #include "Widget.h" #include <wtf/PassRefPtr.h> @@ -48,6 +46,7 @@ class KeyboardEvent; class MouseEvent; class ResourceError; class ResourceResponse; +class WheelEvent; } namespace WebKit { @@ -66,15 +65,17 @@ public: virtual void setFrameRect(const WebCore::IntRect&); virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect&); virtual void invalidateRect(const WebCore::IntRect&); - virtual void setFocus(); + virtual void setFocus(bool); virtual void show(); virtual void hide(); virtual void handleEvent(WebCore::Event*); virtual void frameRectsChanged(); virtual void setParentVisible(bool); virtual void setParent(WebCore::ScrollView*); + virtual void widgetPositionsUpdated(); // WebPluginContainer methods + virtual WebElement element(); virtual void invalidate(); virtual void invalidateRect(const WebRect&); virtual void reportGeometry(); @@ -83,6 +84,27 @@ public: virtual WebString executeScriptURL(const WebURL&, bool popupsAllowed); virtual void loadFrameRequest(const WebURLRequest&, const WebString& target, bool notifyNeeded, void* notifyData); + // This cannot be null. + WebPlugin* plugin() { return m_webPlugin; } + void setPlugin(WebPlugin* plugin) { m_webPlugin = plugin; } + + // Printing interface. The plugin can support custom printing + // (which means it controls the layout, number of pages etc). + // Whether the plugin supports its own paginated print. The other print + // interface methods are called only if this method returns true. + bool supportsPaginatedPrint() const; + // Sets up printing at the given print rect and printer DPI. printableArea + // is in points (a point is 1/72 of an inch).Returns the number of pages to + // be printed at these settings. + int printBegin(const WebCore::IntRect& printableArea, int printerDPI) const; + // Prints the page specified by pageNumber (0-based index) into the supplied canvas. + bool printPage(int pageNumber, WebCore::GraphicsContext* gc); + // Ends the print operation. + void printEnd(); + + // Copy the selected text. + void copy(); + // Resource load events for the plugin's source data: void didReceiveResponse(const WebCore::ResourceResponse&); void didReceiveData(const char *data, int dataLength); @@ -91,9 +113,6 @@ public: NPObject* scriptableObject(); - // This cannot be null. - WebPlugin* plugin() { return m_webPlugin; } - void willDestroyPluginLoadObserver(WebPluginLoadObserver*); private: @@ -103,6 +122,7 @@ private: ~WebPluginContainerImpl(); void handleMouseEvent(WebCore::MouseEvent*); + void handleWheelEvent(WebCore::WheelEvent*); void handleKeyboardEvent(WebCore::KeyboardEvent*); void calculateGeometry(const WebCore::IntRect& frameRect, diff --git a/WebKit/chromium/src/WebPluginDocument.cpp b/WebKit/chromium/src/WebPluginDocument.cpp new file mode 100644 index 0000000..8f794ad --- /dev/null +++ b/WebKit/chromium/src/WebPluginDocument.cpp @@ -0,0 +1,72 @@ +/* + * 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 "WebPluginDocument.h" + +#include "Document.h" +#include "PluginDocument.h" + +#include "WebPluginContainerImpl.h" + +#include <wtf/PassRefPtr.h> + +using namespace WebCore; + +namespace WebKit { + + +WebPlugin* WebPluginDocument::plugin() +{ + if (!isPluginDocument()) + return 0; + PluginDocument* doc = unwrap<PluginDocument>(); + WebPluginContainerImpl* container = static_cast<WebPluginContainerImpl*>(static_cast<PluginDocument*>(doc)->pluginWidget()); + return container->plugin(); +} + + +WebPluginDocument::WebPluginDocument(const PassRefPtr<PluginDocument>& elem) + : WebDocument(elem) +{ +} + +WebPluginDocument& WebPluginDocument::operator=(const PassRefPtr<PluginDocument>& elem) +{ + m_private = elem; + return *this; +} + +WebPluginDocument::operator PassRefPtr<PluginDocument>() const +{ + return static_cast<PluginDocument*>(m_private.get()); +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/WebPluginListBuilderImpl.cpp b/WebKit/chromium/src/WebPluginListBuilderImpl.cpp index 6926a2d..d0f7324 100644 --- a/WebKit/chromium/src/WebPluginListBuilderImpl.cpp +++ b/WebKit/chromium/src/WebPluginListBuilderImpl.cpp @@ -41,27 +41,25 @@ namespace WebKit { void WebPluginListBuilderImpl::addPlugin(const WebString& name, const WebString& description, const WebString& fileName) { - PluginInfo* info = new PluginInfo(); - info->name = name; - info->desc = description; - info->file = fileName; + PluginInfo info; + info.name = name; + info.desc = description; + info.file = fileName; m_results->append(info); } void WebPluginListBuilderImpl::addMediaTypeToLastPlugin(const WebString& name, const WebString& description) { - MimeClassInfo* info = new MimeClassInfo(); - info->type = name; - info->desc = description; - m_results->last()->mimes.append(info); + MimeClassInfo info; + info.type = name; + info.desc = description; + m_results->last().mimes.append(info); } void WebPluginListBuilderImpl::addFileExtensionToLastMediaType(const WebString& extension) { - MimeClassInfo* info = m_results->last()->mimes.last(); - if (!info->suffixes.isEmpty()) - info->suffixes.append(','); - info->suffixes.append(extension); + MimeClassInfo& info = m_results->last().mimes.last(); + info.extensions.append(extension); } } // namespace WebKit diff --git a/WebKit/chromium/src/WebPluginListBuilderImpl.h b/WebKit/chromium/src/WebPluginListBuilderImpl.h index 7a8a497..3d7977a 100644 --- a/WebKit/chromium/src/WebPluginListBuilderImpl.h +++ b/WebKit/chromium/src/WebPluginListBuilderImpl.h @@ -40,7 +40,7 @@ namespace WebKit { class WebPluginListBuilderImpl : public WebPluginListBuilder { public: - WebPluginListBuilderImpl(Vector<WebCore::PluginInfo*>* results) : m_results(results) { } + WebPluginListBuilderImpl(Vector<WebCore::PluginInfo>* results) : m_results(results) { } // WebPluginListBuilder methods: virtual void addPlugin(const WebString& name, const WebString& description, const WebString& fileName); @@ -48,7 +48,7 @@ public: virtual void addFileExtensionToLastMediaType(const WebString& extension); private: - Vector<WebCore::PluginInfo*>* m_results; + Vector<WebCore::PluginInfo>* m_results; }; } // namespace WebKit diff --git a/WebKit/chromium/src/WebPluginLoadObserver.h b/WebKit/chromium/src/WebPluginLoadObserver.h index 097d08d..7bd06eb 100644 --- a/WebKit/chromium/src/WebPluginLoadObserver.h +++ b/WebKit/chromium/src/WebPluginLoadObserver.h @@ -31,7 +31,7 @@ #ifndef WebPluginLoadObserver_h #define WebPluginLoadObserver_h -#include "../public/WebURL.h" +#include "WebURL.h" namespace WebKit { diff --git a/WebKit/chromium/src/WebPopupMenuImpl.cpp b/WebKit/chromium/src/WebPopupMenuImpl.cpp index f6d360e..75d6cc1 100644 --- a/WebKit/chromium/src/WebPopupMenuImpl.cpp +++ b/WebKit/chromium/src/WebPopupMenuImpl.cpp @@ -56,7 +56,8 @@ namespace WebKit { WebPopupMenu* WebPopupMenu::create(WebWidgetClient* client) { - return new WebPopupMenuImpl(client); + // Pass the WebPopupMenuImpl's self-reference to the caller. + return adoptRef(new WebPopupMenuImpl(client)).leakRef(); } // WebWidget ------------------------------------------------------------------ @@ -230,18 +231,28 @@ void WebPopupMenuImpl::setFocus(bool enable) { } -bool WebPopupMenuImpl::handleCompositionEvent( - WebCompositionCommand command, int cursorPosition, int targetStart, - int targetEnd, const WebString& imeString) +bool WebPopupMenuImpl::setComposition( + const WebString& text, const WebVector<WebCompositionUnderline>& underlines, + int selectionStart, int selectionEnd) { return false; } -bool WebPopupMenuImpl::queryCompositionStatus(bool* enabled, WebRect* caretRect) +bool WebPopupMenuImpl::confirmComposition() { return false; } +WebTextInputType WebPopupMenuImpl::textInputType() +{ + return WebTextInputTypeNone; +} + +WebRect WebPopupMenuImpl::caretOrSelectionBounds() +{ + return WebRect(); +} + void WebPopupMenuImpl::setTextDirection(WebTextDirection direction) { } @@ -250,18 +261,29 @@ void WebPopupMenuImpl::setTextDirection(WebTextDirection direction) //----------------------------------------------------------------------------- // WebCore::HostWindow -void WebPopupMenuImpl::repaint(const IntRect& paintRect, - bool contentChanged, - bool immediate, - bool repaintContentOnly) +void WebPopupMenuImpl::invalidateContents(const IntRect&, bool) +{ + notImplemented(); +} + +void WebPopupMenuImpl::invalidateWindow(const IntRect&, bool) { - // Ignore spurious calls. - if (!contentChanged || paintRect.isEmpty()) + notImplemented(); +} + +void WebPopupMenuImpl::invalidateContentsAndWindow(const IntRect& paintRect, bool /*immediate*/) +{ + if (paintRect.isEmpty()) return; if (m_client) m_client->didInvalidateRect(paintRect); } +void WebPopupMenuImpl::invalidateContentsForSlowScroll(const IntRect& updateRect, bool immediate) +{ + invalidateContentsAndWindow(updateRect, immediate); +} + void WebPopupMenuImpl::scroll(const IntSize& scrollDelta, const IntRect& scrollRect, const IntRect& clipRect) @@ -296,6 +318,10 @@ void WebPopupMenuImpl::scrollbarsModeDidChange() const // Nothing to be done since we have no concept of different scrollbar modes. } +void WebPopupMenuImpl::setCursor(const WebCore::Cursor&) +{ +} + //----------------------------------------------------------------------------- // WebCore::FramelessScrollViewClient diff --git a/WebKit/chromium/src/WebPopupMenuImpl.h b/WebKit/chromium/src/WebPopupMenuImpl.h index 13eb674..edbb4ab 100644 --- a/WebKit/chromium/src/WebPopupMenuImpl.h +++ b/WebKit/chromium/src/WebPopupMenuImpl.h @@ -31,14 +31,10 @@ #ifndef WebPopupMenuImpl_h #define WebPopupMenuImpl_h -// FIXME: Add this to FramelessScrollViewClient.h -namespace WebCore { class FramelessScrollView; } - #include "FramelessScrollViewClient.h" -// FIXME: remove the relative paths once glue/ consumers are removed. -#include "../public/WebPoint.h" -#include "../public/WebPopupMenu.h" -#include "../public/WebSize.h" +#include "WebPoint.h" +#include "WebPopupMenu.h" +#include "WebSize.h" #include <wtf/RefCounted.h> namespace WebCore { @@ -70,11 +66,15 @@ public: virtual bool handleInputEvent(const WebInputEvent&); virtual void mouseCaptureLost(); virtual void setFocus(bool enable); - virtual bool handleCompositionEvent( - WebCompositionCommand command, int cursorPosition, - int targetStart, int targetEnd, const WebString& text); - virtual bool queryCompositionStatus(bool* enabled, WebRect* caretRect); + virtual bool setComposition( + const WebString& text, + const WebVector<WebCompositionUnderline>& underlines, + int selectionStart, int selectionEnd); + virtual bool confirmComposition(); + virtual WebTextInputType textInputType(); + virtual WebRect caretOrSelectionBounds(); virtual void setTextDirection(WebTextDirection direction); + virtual bool isAcceleratedCompositingActive() const { return false; } // WebPopupMenuImpl void Init(WebCore::FramelessScrollView* widget, @@ -98,9 +98,10 @@ public: ~WebPopupMenuImpl(); // WebCore::HostWindow methods: - virtual void repaint( - const WebCore::IntRect&, bool contentChanged, bool immediate = false, - bool repaintContentOnly = false); + virtual void invalidateContents(const WebCore::IntRect&, bool); + virtual void invalidateWindow(const WebCore::IntRect&, bool); + virtual void invalidateContentsAndWindow(const WebCore::IntRect&, bool); + virtual void invalidateContentsForSlowScroll(const WebCore::IntRect&, bool); virtual void scroll( const WebCore::IntSize& scrollDelta, const WebCore::IntRect& scrollRect, const WebCore::IntRect& clipRect); @@ -109,6 +110,7 @@ public: virtual PlatformPageClient platformPageClient() const { return 0; } virtual void scrollRectIntoView(const WebCore::IntRect&, const WebCore::ScrollView*) const; virtual void scrollbarsModeDidChange() const; + virtual void setCursor(const WebCore::Cursor&); // WebCore::FramelessScrollViewClient methods: virtual void popupClosed(WebCore::FramelessScrollView*); diff --git a/WebKit/chromium/src/WebRuntimeFeatures.cpp b/WebKit/chromium/src/WebRuntimeFeatures.cpp index ad84764..9e21d58 100644 --- a/WebKit/chromium/src/WebRuntimeFeatures.cpp +++ b/WebKit/chromium/src/WebRuntimeFeatures.cpp @@ -31,7 +31,7 @@ #include "config.h" #include "WebRuntimeFeatures.h" -#include "Database.h" +#include "AbstractDatabase.h" #include "RuntimeEnabledFeatures.h" #include "WebMediaPlayerClientImpl.h" #include "WebSocket.h" @@ -43,14 +43,14 @@ namespace WebKit { void WebRuntimeFeatures::enableDatabase(bool enable) { #if ENABLE(DATABASE) - Database::setIsAvailable(enable); + AbstractDatabase::setIsAvailable(enable); #endif } bool WebRuntimeFeatures::isDatabaseEnabled() { #if ENABLE(DATABASE) - return Database::isAvailable(); + return AbstractDatabase::isAvailable(); #else return false; #endif @@ -184,4 +184,76 @@ bool WebRuntimeFeatures::isIndexedDatabaseEnabled() #endif } +void WebRuntimeFeatures::enableWebGL(bool enable) +{ +#if ENABLE(3D_CANVAS) + RuntimeEnabledFeatures::setWebGLEnabled(enable); +#endif +} + +bool WebRuntimeFeatures::isWebGLEnabled() +{ +#if ENABLE(3D_CANVAS) + return RuntimeEnabledFeatures::webGLRenderingContextEnabled(); +#else + return false; +#endif +} + +void WebRuntimeFeatures::enablePushState(bool enable) +{ + RuntimeEnabledFeatures::setPushStateEnabled(enable); +} + +bool WebRuntimeFeatures::isPushStateEnabled(bool enable) +{ + return RuntimeEnabledFeatures::pushStateEnabled(); +} + +void WebRuntimeFeatures::enableTouch(bool enable) +{ +#if ENABLE(TOUCH_EVENTS) + RuntimeEnabledFeatures::setTouchEnabled(enable); +#endif +} + +bool WebRuntimeFeatures::isTouchEnabled() +{ +#if ENABLE(TOUCH_EVENTS) + return RuntimeEnabledFeatures::touchEnabled(); +#else + return false; +#endif +} + +void WebRuntimeFeatures::enableDeviceMotion(bool enable) +{ + RuntimeEnabledFeatures::setDeviceMotionEnabled(enable); +} + +bool WebRuntimeFeatures::isDeviceMotionEnabled() +{ + return RuntimeEnabledFeatures::deviceMotionEnabled(); +} + +void WebRuntimeFeatures::enableDeviceOrientation(bool enable) +{ + RuntimeEnabledFeatures::setDeviceOrientationEnabled(enable); +} + +bool WebRuntimeFeatures::isDeviceOrientationEnabled() +{ + return RuntimeEnabledFeatures::deviceOrientationEnabled(); +} + +void WebRuntimeFeatures::enableSpeechInput(bool enable) +{ + RuntimeEnabledFeatures::setSpeechInputEnabled(enable); +} + +bool WebRuntimeFeatures::isSpeechInputEnabled() +{ + return RuntimeEnabledFeatures::speechInputEnabled(); +} + } // namespace WebKit diff --git a/WebKit/chromium/src/WebScrollbarImpl.cpp b/WebKit/chromium/src/WebScrollbarImpl.cpp new file mode 100644 index 0000000..8bf5340 --- /dev/null +++ b/WebKit/chromium/src/WebScrollbarImpl.cpp @@ -0,0 +1,297 @@ +/* + * 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 "WebScrollbarImpl.h" + +#include "GraphicsContext.h" +#include "KeyboardCodes.h" +#include "PlatformContextSkia.h" +#include "Scrollbar.h" +#include "ScrollbarTheme.h" +#include "ScrollTypes.h" +#include "WebCanvas.h" +#include "WebInputEvent.h" +#include "WebInputEventConversion.h" +#include "WebRect.h" +#include "WebScrollbarClient.h" +#include "WebVector.h" +#include "WebViewImpl.h" + +using namespace std; +using namespace WebCore; + +namespace WebKit { + +WebScrollbar* WebScrollbar::create(WebScrollbarClient* client, Orientation orientation) +{ + return new WebScrollbarImpl(client, orientation); +} + +int WebScrollbar::defaultThickness() +{ + return ScrollbarTheme::nativeTheme()->scrollbarThickness(); +} + +WebScrollbarImpl::WebScrollbarImpl(WebScrollbarClient* client, Orientation orientation) + : m_client(client) +{ + m_scrollbar = Scrollbar::createNativeScrollbar( + static_cast<ScrollbarClient*>(this), + static_cast<ScrollbarOrientation>(orientation), + RegularScrollbar); +} + +WebScrollbarImpl::~WebScrollbarImpl() +{ +} + +void WebScrollbarImpl::setLocation(const WebRect& rect) +{ + WebCore::IntRect oldRect = m_scrollbar->frameRect(); + m_scrollbar->setFrameRect(rect); + if (WebRect(oldRect) != rect) + m_scrollbar->invalidate(); + + int length = m_scrollbar->orientation() == HorizontalScrollbar ? m_scrollbar->width() : m_scrollbar->height(); + int pageStep = max(max<int>(length * Scrollbar::minFractionToStepWhenPaging(), length - Scrollbar::maxOverlapBetweenPages()), 1); + m_scrollbar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep); + m_scrollbar->setEnabled(m_scrollbar->totalSize() > length); + m_scrollbar->setProportion(length, m_scrollbar->totalSize()); +} + +int WebScrollbarImpl::value() const +{ + return m_scrollbar->value(); +} + +void WebScrollbarImpl::setValue(int position) +{ + m_scrollbar->setValue(position); +} + +void WebScrollbarImpl::setDocumentSize(int size) +{ + int length = m_scrollbar->orientation() == HorizontalScrollbar ? m_scrollbar->width() : m_scrollbar->height(); + m_scrollbar->setEnabled(size > length); + m_scrollbar->setProportion(length, size); +} + +void WebScrollbarImpl::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier) +{ + WebCore::ScrollDirection dir; + bool horizontal = m_scrollbar->orientation() == HorizontalScrollbar; + if (direction == ScrollForward) + dir = horizontal ? ScrollRight : ScrollDown; + else + dir = horizontal ? ScrollLeft : ScrollUp; + m_scrollbar->scroll(dir, static_cast<WebCore::ScrollGranularity>(granularity), multiplier); +} + +void WebScrollbarImpl::paint(WebCanvas* canvas, const WebRect& rect) +{ +#if WEBKIT_USING_CG + GraphicsContext gc(canvas); +#elif WEBKIT_USING_SKIA + PlatformContextSkia context(canvas); + + // PlatformGraphicsContext is actually a pointer to PlatformContextSkia + GraphicsContext gc(reinterpret_cast<PlatformGraphicsContext*>(&context)); +#else + notImplemented(); +#endif + + m_scrollbar->paint(&gc, rect); +} + +bool WebScrollbarImpl::handleInputEvent(const WebInputEvent& event) +{ + switch (event.type) { + case WebInputEvent::MouseDown: + return onMouseDown(event); + case WebInputEvent::MouseUp: + return onMouseUp(event); + case WebInputEvent::MouseMove: + return onMouseMove(event); + case WebInputEvent::MouseLeave: + return onMouseLeave(event); + case WebInputEvent::MouseWheel: + return onMouseWheel(event); + case WebInputEvent::KeyDown: + return onKeyDown(event); + case WebInputEvent::Undefined: + case WebInputEvent::MouseEnter: + case WebInputEvent::RawKeyDown: + case WebInputEvent::KeyUp: + case WebInputEvent::Char: + case WebInputEvent::TouchStart: + case WebInputEvent::TouchMove: + case WebInputEvent::TouchEnd: + case WebInputEvent::TouchCancel: + default: + break; + } + return false; +} + +bool WebScrollbarImpl::onMouseDown(const WebInputEvent& event) +{ + WebMouseEvent mousedown = *static_cast<const WebMouseEvent*>(&event); + if (!m_scrollbar->frameRect().contains(mousedown.x, mousedown.y)) + return false; + + mousedown.x -= m_scrollbar->x(); + mousedown.y -= m_scrollbar->y(); + m_scrollbar->mouseDown(PlatformMouseEventBuilder(m_scrollbar.get(), mousedown)); + return true; + } + +bool WebScrollbarImpl::onMouseUp(const WebInputEvent& event) +{ + if (m_scrollbar->pressedPart() == NoPart) + return false; + + return m_scrollbar->mouseUp(); +} + +bool WebScrollbarImpl::onMouseMove(const WebInputEvent& event) +{ + WebMouseEvent mousemove = *static_cast<const WebMouseEvent*>(&event); + if (m_scrollbar->frameRect().contains(mousemove.x, mousemove.y) + || m_scrollbar->pressedPart() != NoPart) { + mousemove.x -= m_scrollbar->x(); + mousemove.y -= m_scrollbar->y(); + return m_scrollbar->mouseMoved(PlatformMouseEventBuilder(m_scrollbar.get(), mousemove)); + } + + if (m_scrollbar->hoveredPart() != NoPart) + m_scrollbar->mouseExited(); + return false; +} + +bool WebScrollbarImpl::onMouseLeave(const WebInputEvent& event) +{ + if (m_scrollbar->hoveredPart() == NoPart) + return false; + + return m_scrollbar->mouseExited(); +} + +bool WebScrollbarImpl::onMouseWheel(const WebInputEvent& event) +{ + // Same logic as in Scrollview.cpp. If we can move at all, we'll accept the event. + WebMouseWheelEvent mousewheel = *static_cast<const WebMouseWheelEvent*>(&event); + int maxScrollDelta = m_scrollbar->maximum() - m_scrollbar->value(); + float delta = m_scrollbar->orientation() == HorizontalScrollbar ? mousewheel.deltaX : mousewheel.deltaY; + if ((delta < 0 && maxScrollDelta > 0) || (delta > 0 && m_scrollbar->value() > 0)) { + if (mousewheel.scrollByPage) { + ASSERT(m_scrollbar->orientation() == VerticalScrollbar); + bool negative = delta < 0; + delta = max(max<int>(m_scrollbar->visibleSize() * Scrollbar::minFractionToStepWhenPaging(), m_scrollbar->visibleSize() - Scrollbar::maxOverlapBetweenPages()), 1); + if (negative) + delta *= -1; + } + m_scrollbar->setValue(m_scrollbar->value() - delta); + return true; + } + + return false; + } + +bool WebScrollbarImpl::onKeyDown(const WebInputEvent& event) +{ + WebKeyboardEvent keyboard = *static_cast<const WebKeyboardEvent*>(&event); + int keyCode; + // We have to duplicate this logic from WebViewImpl because there it uses + // Char and RawKeyDown events, which don't exist at this point. + if (keyboard.windowsKeyCode == VKEY_SPACE) + keyCode = ((keyboard.modifiers & WebInputEvent::ShiftKey) ? VKEY_PRIOR : VKEY_NEXT); + else { + if (keyboard.modifiers == WebInputEvent::ControlKey) { + // Match FF behavior in the sense that Ctrl+home/end are the only Ctrl + // key combinations which affect scrolling. Safari is buggy in the + // sense that it scrolls the page for all Ctrl+scrolling key + // combinations. For e.g. Ctrl+pgup/pgdn/up/down, etc. + switch (keyboard.windowsKeyCode) { + case VKEY_HOME: + case VKEY_END: + break; + default: + return false; + } + } + + if (keyboard.isSystemKey || (keyboard.modifiers & WebInputEvent::ShiftKey)) + return false; + + keyCode = keyboard.windowsKeyCode; + } + WebCore::ScrollDirection scrollDirection; + WebCore::ScrollGranularity scrollGranularity; + if (WebViewImpl::mapKeyCodeForScroll(keyCode, &scrollDirection, &scrollGranularity)) { + // Will return false if scroll direction wasn't compatible with this scrollbar. + return m_scrollbar->scroll(scrollDirection, scrollGranularity); + } + return false; +} + +void WebScrollbarImpl::valueChanged(WebCore::Scrollbar*) +{ + m_client->valueChanged(this); +} + +void WebScrollbarImpl::invalidateScrollbarRect(WebCore::Scrollbar*, const WebCore::IntRect& rect) +{ + WebRect webrect(rect); + webrect.x += m_scrollbar->x(); + webrect.y += m_scrollbar->y(); + m_client->invalidateScrollbarRect(this, webrect); +} + +bool WebScrollbarImpl::isActive() const +{ + return true; +} + +bool WebScrollbarImpl::scrollbarCornerPresent() const +{ + return false; +} + +void WebScrollbarImpl::getTickmarks(Vector<WebCore::IntRect>& tickmarks) const +{ + WebVector<WebRect> ticks; + m_client->getTickmarks(const_cast<WebScrollbarImpl*>(this), &ticks); + tickmarks.resize(ticks.size()); + for (size_t i = 0; i < ticks.size(); ++i) + tickmarks[i] = ticks[i]; +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/WebScrollbarImpl.h b/WebKit/chromium/src/WebScrollbarImpl.h new file mode 100644 index 0000000..a041ccc --- /dev/null +++ b/WebKit/chromium/src/WebScrollbarImpl.h @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebScrollbarImpl_h +#define WebScrollbarImpl_h + +#include "ScrollbarClient.h" +#include "WebScrollbar.h" + +#include <wtf/RefPtr.h> + +namespace WebCore { +class Scrollbar; +} + +namespace WebKit { + +class WebScrollbarImpl : public WebScrollbar, + public WebCore::ScrollbarClient { +public: + WebScrollbarImpl(WebScrollbarClient*, Orientation orientation); + ~WebScrollbarImpl(); + + // WebKit::WebScrollbar methods + virtual void setLocation(const WebRect&); + virtual int value() const; + virtual void setValue(int position); + virtual void setDocumentSize(int size); + virtual void scroll(ScrollDirection, ScrollGranularity, float multiplier); + virtual void paint(WebCanvas*, const WebRect&); + virtual bool handleInputEvent(const WebInputEvent&); + + // WebCore::ScrollbarClient methods + virtual void valueChanged(WebCore::Scrollbar*); + virtual void invalidateScrollbarRect(WebCore::Scrollbar*, const WebCore::IntRect&); + virtual bool isActive() const; + virtual bool scrollbarCornerPresent() const; + virtual void getTickmarks(Vector<WebCore::IntRect>&) const; + +private: + bool onMouseDown(const WebInputEvent& event); + bool onMouseUp(const WebInputEvent& event); + bool onMouseMove(const WebInputEvent& event); + bool onMouseLeave(const WebInputEvent& event); + bool onMouseWheel(const WebInputEvent& event); + bool onKeyDown(const WebInputEvent& event); + + WebScrollbarClient* m_client; + + RefPtr<WebCore::Scrollbar> m_scrollbar; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/src/WebSearchableFormData.cpp b/WebKit/chromium/src/WebSearchableFormData.cpp index eddaffe..14ece13 100644 --- a/WebKit/chromium/src/WebSearchableFormData.cpp +++ b/WebKit/chromium/src/WebSearchableFormData.cpp @@ -62,7 +62,7 @@ void GetFormEncoding(const HTMLFormElement* form, TextEncoding* encoding) return; } const Frame* frame = form->document()->frame(); - *encoding = frame ? TextEncoding(frame->loader()->encoding()) : Latin1Encoding(); + *encoding = frame ? TextEncoding(frame->loader()->writer()->encoding()) : Latin1Encoding(); } // Returns true if the submit request results in an HTTP URL. @@ -77,7 +77,8 @@ bool IsHTTPFormSubmit(const HTMLFormElement* form) HTMLFormControlElement* GetButtonToActivate(HTMLFormElement* form) { HTMLFormControlElement* firstSubmitButton = 0; - for (Vector<HTMLFormControlElement*>::const_iterator i(form->formElements.begin()); i != form->formElements.end(); ++i) { + // FIXME: Consider refactoring this code so that we don't call form->associatedElements() twice. + for (Vector<HTMLFormControlElement*>::const_iterator i(form->associatedElements().begin()); i != form->associatedElements().end(); ++i) { HTMLFormControlElement* formElement = *i; if (formElement->isActivatedSubmit()) // There's a button that is already activated for submit, return 0. @@ -154,7 +155,8 @@ bool HasSuitableTextElement(const HTMLFormElement* form, Vector<char>* encodedSt *encodingName = encoding.name(); HTMLInputElement* textElement = 0; - for (Vector<HTMLFormControlElement*>::const_iterator i(form->formElements.begin()); i != form->formElements.end(); ++i) { + // FIXME: Consider refactoring this code so that we don't call form->associatedElements() twice. + for (Vector<HTMLFormControlElement*>::const_iterator i(form->associatedElements().begin()); i != form->associatedElements().end(); ++i) { HTMLFormControlElement* formElement = *i; if (formElement->disabled() || formElement->name().isNull()) continue; @@ -185,8 +187,8 @@ bool HasSuitableTextElement(const HTMLFormElement* form, Vector<char>* encodedSt if (!formElement->appendFormData(dataList, false)) continue; - const Vector<FormDataList::Item>& itemList = dataList.list(); - if (isTextElement && !itemList.isEmpty()) { + const BlobItemList& items = dataList.items(); + if (isTextElement && !items.isEmpty()) { if (textElement) { // The auto-complete bar only knows how to fill in one value. // This form has multiple fields; don't treat it as searchable. @@ -194,20 +196,22 @@ bool HasSuitableTextElement(const HTMLFormElement* form, Vector<char>* encodedSt } textElement = static_cast<HTMLInputElement*>(formElement); } - for (Vector<FormDataList::Item>::const_iterator j(itemList.begin()); j != itemList.end(); ++j) { + for (BlobItemList::const_iterator j(items.begin()); j != items.end(); ++j) { + const StringBlobItem* item = (*j)->toStringBlobItem(); + ASSERT(item); // Handle ISINDEX / <input name=isindex> specially, but only if it's // the first entry. - if (!encodedString->isEmpty() || j->data() != "isindex") { + if (!encodedString->isEmpty() || item->cstr() != "isindex") { if (!encodedString->isEmpty()) encodedString->append('&'); - FormDataBuilder::encodeStringAsFormData(*encodedString, j->data()); + FormDataBuilder::encodeStringAsFormData(*encodedString, item->cstr()); encodedString->append('='); } ++j; if (formElement == textElement) encodedString->append("{searchTerms}", 13); else - FormDataBuilder::encodeStringAsFormData(*encodedString, j->data()); + FormDataBuilder::encodeStringAsFormData(*encodedString, item->cstr()); } } diff --git a/WebKit/chromium/src/WebSecurityOrigin.cpp b/WebKit/chromium/src/WebSecurityOrigin.cpp index 81546da..8685738 100644 --- a/WebKit/chromium/src/WebSecurityOrigin.cpp +++ b/WebKit/chromium/src/WebSecurityOrigin.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Google Inc. All rights reserved. + * 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 @@ -31,8 +31,10 @@ #include "config.h" #include "WebSecurityOrigin.h" +#include "KURL.h" #include "SecurityOrigin.h" #include "WebString.h" +#include "WebURL.h" #include <wtf/PassRefPtr.h> using namespace WebCore; @@ -42,9 +44,9 @@ namespace WebKit { class WebSecurityOriginPrivate : public SecurityOrigin { }; -WebSecurityOrigin* WebSecurityOrigin::createFromDatabaseIdentifier(const WebString& databaseIdentifier) +WebSecurityOrigin WebSecurityOrigin::createFromDatabaseIdentifier(const WebString& databaseIdentifier) { - return new WebSecurityOrigin(SecurityOrigin::createFromDatabaseIdentifier(databaseIdentifier)); + return WebSecurityOrigin(SecurityOrigin::createFromDatabaseIdentifier(databaseIdentifier)); } WebSecurityOrigin WebSecurityOrigin::createFromString(const WebString& origin) @@ -52,6 +54,11 @@ WebSecurityOrigin WebSecurityOrigin::createFromString(const WebString& origin) return WebSecurityOrigin(SecurityOrigin::createFromString(origin)); } +WebSecurityOrigin WebSecurityOrigin::create(const WebURL& url) +{ + return WebSecurityOrigin(SecurityOrigin::create(url)); +} + void WebSecurityOrigin::reset() { assign(0); @@ -89,18 +96,37 @@ bool WebSecurityOrigin::isEmpty() const return m_private->isEmpty(); } +bool WebSecurityOrigin::canAccess(const WebSecurityOrigin& other) const +{ + ASSERT(m_private); + ASSERT(other.m_private); + return m_private->canAccess(other.m_private); +} + +bool WebSecurityOrigin::canRequest(const WebURL& url) const +{ + ASSERT(m_private); + return m_private->canRequest(url); +} + WebString WebSecurityOrigin::toString() const { ASSERT(m_private); return m_private->toString(); } -WebString WebSecurityOrigin::databaseIdentifier() +WebString WebSecurityOrigin::databaseIdentifier() const { ASSERT(m_private); return m_private->databaseIdentifier(); } +bool WebSecurityOrigin::canAccessPasswordManager() const +{ + ASSERT(m_private); + return m_private->canAccessPasswordManager(); +} + WebSecurityOrigin::WebSecurityOrigin(const WTF::PassRefPtr<WebCore::SecurityOrigin>& origin) : m_private(static_cast<WebSecurityOriginPrivate*>(origin.releaseRef())) { diff --git a/WebKit/chromium/src/WebSecurityPolicy.cpp b/WebKit/chromium/src/WebSecurityPolicy.cpp index 48b445c..58d0893 100644 --- a/WebKit/chromium/src/WebSecurityPolicy.cpp +++ b/WebKit/chromium/src/WebSecurityPolicy.cpp @@ -32,6 +32,7 @@ #include "WebSecurityPolicy.h" #include "FrameLoader.h" +#include "SchemeRegistry.h" #include "SecurityOrigin.h" #include "WebString.h" @@ -43,27 +44,44 @@ namespace WebKit { void WebSecurityPolicy::registerURLSchemeAsLocal(const WebString& scheme) { - SecurityOrigin::registerURLSchemeAsLocal(scheme); + SchemeRegistry::registerURLSchemeAsLocal(scheme); } void WebSecurityPolicy::registerURLSchemeAsNoAccess(const WebString& scheme) { - SecurityOrigin::registerURLSchemeAsNoAccess(scheme); + SchemeRegistry::registerURLSchemeAsNoAccess(scheme); } -void WebSecurityPolicy::whiteListAccessFromOrigin(const WebURL& sourceOrigin, +void WebSecurityPolicy::registerURLSchemeAsSecure(const WebString& scheme) +{ + SchemeRegistry::registerURLSchemeAsSecure(scheme); +} + +void WebSecurityPolicy::addOriginAccessWhitelistEntry( + const WebURL& sourceOrigin, + const WebString& destinationProtocol, + const WebString& destinationHost, + bool allowDestinationSubdomains) +{ + SecurityOrigin::addOriginAccessWhitelistEntry( + *SecurityOrigin::create(sourceOrigin), destinationProtocol, + destinationHost, allowDestinationSubdomains); +} + +void WebSecurityPolicy::removeOriginAccessWhitelistEntry( + const WebURL& sourceOrigin, const WebString& destinationProtocol, const WebString& destinationHost, bool allowDestinationSubdomains) { - SecurityOrigin::whiteListAccessFromOrigin( + SecurityOrigin::removeOriginAccessWhitelistEntry( *SecurityOrigin::create(sourceOrigin), destinationProtocol, destinationHost, allowDestinationSubdomains); } -void WebSecurityPolicy::resetOriginAccessWhiteLists() +void WebSecurityPolicy::resetOriginAccessWhitelists() { - SecurityOrigin::resetOriginAccessWhiteLists(); + SecurityOrigin::resetOriginAccessWhitelists(); } bool WebSecurityPolicy::shouldHideReferrer(const WebURL& url, const WebString& referrer) diff --git a/WebKit/chromium/src/WebSelectElement.cpp b/WebKit/chromium/src/WebSelectElement.cpp new file mode 100644 index 0000000..79a4d85 --- /dev/null +++ b/WebKit/chromium/src/WebSelectElement.cpp @@ -0,0 +1,80 @@ +/* + * 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 "WebSelectElement.h" + +#include "HTMLNames.h" +#include "HTMLOptionElement.h" +#include "HTMLSelectElement.h" +#include "WebString.h" +#include <wtf/PassRefPtr.h> + +using namespace WebCore; + +namespace WebKit { + +void WebSelectElement::setValue(const WebString& value) +{ + unwrap<HTMLSelectElement>()->setValue(value); +} + +WebString WebSelectElement::value() +{ + return unwrap<HTMLSelectElement>()->value(); +} + +WebVector<WebElement> WebSelectElement::listItems() +{ + const Vector<Element*>& sourceItems = unwrap<HTMLSelectElement>()->listItems(); + WebVector<WebElement> items(sourceItems.size()); + for (size_t i = 0; i < sourceItems.size(); ++i) + items[i] = WebElement(static_cast<HTMLElement*>(sourceItems[i])); + + return items; +} + +WebSelectElement::WebSelectElement(const PassRefPtr<HTMLSelectElement>& elem) + : WebFormControlElement(elem) +{ +} + +WebSelectElement& WebSelectElement::operator=(const PassRefPtr<HTMLSelectElement>& elem) +{ + m_private = elem; + return *this; +} + +WebSelectElement::operator PassRefPtr<HTMLSelectElement>() const +{ + return static_cast<HTMLSelectElement*>(m_private.get()); +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/WebSerializedScriptValue.cpp b/WebKit/chromium/src/WebSerializedScriptValue.cpp new file mode 100644 index 0000000..7149a4d --- /dev/null +++ b/WebKit/chromium/src/WebSerializedScriptValue.cpp @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebSerializedScriptValue.h" + +#include "SerializedScriptValue.h" +#include "WebString.h" + +using namespace WebCore; + +namespace WebKit { + +WebSerializedScriptValue WebSerializedScriptValue::fromString(const WebString& s) +{ + return SerializedScriptValue::createFromWire(s); +} + +WebSerializedScriptValue WebSerializedScriptValue::createInvalid() +{ + return SerializedScriptValue::create(); +} + +void WebSerializedScriptValue::reset() +{ + m_private.reset(); +} + +void WebSerializedScriptValue::assign(const WebSerializedScriptValue& other) +{ + m_private = other.m_private; +} + +WebString WebSerializedScriptValue::toString() const +{ + return m_private->toWireString(); +} + +WebSerializedScriptValue::WebSerializedScriptValue(const PassRefPtr<SerializedScriptValue>& value) + : m_private(value) +{ +} + +WebSerializedScriptValue& WebSerializedScriptValue::operator=(const PassRefPtr<SerializedScriptValue>& value) +{ + m_private = value; + return *this; +} + +WebSerializedScriptValue::operator PassRefPtr<SerializedScriptValue>() const +{ + return m_private.get(); +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/WebSettingsImpl.cpp b/WebKit/chromium/src/WebSettingsImpl.cpp index 5cfbd4f..329027c 100644 --- a/WebKit/chromium/src/WebSettingsImpl.cpp +++ b/WebKit/chromium/src/WebSettingsImpl.cpp @@ -185,6 +185,11 @@ void WebSettingsImpl::setUserStyleSheetLocation(const WebURL& location) m_settings->setUserStyleSheetLocation(location); } +void WebSettingsImpl::setAuthorAndUserStylesEnabled(bool enabled) +{ + m_settings->setAuthorAndUserStylesEnabled(enabled); +} + void WebSettingsImpl::setUsesPageCache(bool usesPageCache) { m_settings->setUsesPageCache(usesPageCache); @@ -195,6 +200,11 @@ void WebSettingsImpl::setDownloadableBinaryFontsEnabled(bool enabled) m_settings->setDownloadableBinaryFontsEnabled(enabled); } +void WebSettingsImpl::setJavaScriptCanAccessClipboard(bool enabled) +{ + m_settings->setJavaScriptCanAccessClipboard(enabled); +} + void WebSettingsImpl::setXSSAuditorEnabled(bool enabled) { m_settings->setXSSAuditorEnabled(enabled); @@ -226,14 +236,14 @@ void WebSettingsImpl::setShouldPaintCustomScrollbars(bool enabled) m_settings->setShouldPaintCustomScrollbars(enabled); } -void WebSettingsImpl::setDatabasesEnabled(bool enabled) +void WebSettingsImpl::setAllowUniversalAccessFromFileURLs(bool allow) { - m_settings->setDatabasesEnabled(enabled); + m_settings->setAllowUniversalAccessFromFileURLs(allow); } -void WebSettingsImpl::setAllowUniversalAccessFromFileURLs(bool allow) +void WebSettingsImpl::setAllowFileAccessFromFileURLs(bool allow) { - m_settings->setAllowUniversalAccessFromFileURLs(allow); + m_settings->setAllowFileAccessFromFileURLs(allow); } void WebSettingsImpl::setTextDirectionSubmenuInclusionBehaviorNeverIncluded() @@ -254,9 +264,29 @@ void WebSettingsImpl::setExperimentalWebGLEnabled(bool enabled) m_settings->setWebGLEnabled(enabled); } -void WebSettingsImpl::setGeolocationEnabled(bool enabled) +void WebSettingsImpl::setShowDebugBorders(bool show) +{ + m_settings->setShowDebugBorders(show); +} + +void WebSettingsImpl::setEditingBehavior(EditingBehavior behavior) +{ + m_settings->setEditingBehaviorType(static_cast<WebCore::EditingBehaviorType>(behavior)); +} + +void WebSettingsImpl::setAcceleratedCompositingEnabled(bool enabled) +{ + m_settings->setAcceleratedCompositingEnabled(enabled); +} + +void WebSettingsImpl::setAccelerated2dCanvasEnabled(bool enabled) +{ + m_settings->setAccelerated2dCanvasEnabled(enabled); +} + +void WebSettingsImpl::setMemoryInfoEnabled(bool enabled) { - m_settings->setGeolocationEnabled(enabled); + m_settings->setMemoryInfoEnabled(enabled); } } // namespace WebKit diff --git a/WebKit/chromium/src/WebSettingsImpl.h b/WebKit/chromium/src/WebSettingsImpl.h index 3b69fe6..0120dbc 100644 --- a/WebKit/chromium/src/WebSettingsImpl.h +++ b/WebKit/chromium/src/WebSettingsImpl.h @@ -31,8 +31,7 @@ #ifndef WebSettingsImpl_h #define WebSettingsImpl_h -// TODO(jorlow): Remove this hack once WebView is free of glue. -#include "../public/WebSettings.h" +#include "WebSettings.h" namespace WebCore { class Settings; @@ -71,19 +70,25 @@ public: virtual void setJavaEnabled(bool); virtual void setAllowScriptsToCloseWindows(bool); virtual void setUserStyleSheetLocation(const WebURL&); + virtual void setAuthorAndUserStylesEnabled(bool); virtual void setUsesPageCache(bool); virtual void setDownloadableBinaryFontsEnabled(bool); + virtual void setJavaScriptCanAccessClipboard(bool); virtual void setXSSAuditorEnabled(bool); virtual void setLocalStorageEnabled(bool); virtual void setEditableLinkBehaviorNeverLive(); virtual void setFontRenderingModeNormal(); virtual void setShouldPaintCustomScrollbars(bool); - virtual void setDatabasesEnabled(bool); virtual void setAllowUniversalAccessFromFileURLs(bool); + virtual void setAllowFileAccessFromFileURLs(bool); virtual void setTextDirectionSubmenuInclusionBehaviorNeverIncluded(); virtual void setOfflineWebApplicationCacheEnabled(bool); virtual void setExperimentalWebGLEnabled(bool); - virtual void setGeolocationEnabled(bool); + virtual void setShowDebugBorders(bool); + virtual void setEditingBehavior(EditingBehavior); + virtual void setAcceleratedCompositingEnabled(bool); + virtual void setAccelerated2dCanvasEnabled(bool); + virtual void setMemoryInfoEnabled(bool); private: WebCore::Settings* m_settings; diff --git a/WebKit/chromium/src/WebSharedWorkerImpl.cpp b/WebKit/chromium/src/WebSharedWorkerImpl.cpp index 4547336..e73c0f4 100644 --- a/WebKit/chromium/src/WebSharedWorkerImpl.cpp +++ b/WebKit/chromium/src/WebSharedWorkerImpl.cpp @@ -31,7 +31,7 @@ #include "config.h" #include "WebSharedWorkerImpl.h" -#include "GenericWorkerTask.h" +#include "CrossThreadTask.h" #include "KURL.h" #include "MessageEvent.h" #include "MessagePortChannel.h" @@ -85,14 +85,14 @@ void WebSharedWorkerImpl::connectTask(ScriptExecutionContext* context, WebShared { // Wrap the passed-in channel in a MessagePort, and send it off via a connect event. RefPtr<MessagePort> port = MessagePort::create(*context); - port->entangle(channel.release()); + port->entangle(channel); ASSERT(context->isWorkerContext()); WorkerContext* workerContext = static_cast<WorkerContext*>(context); ASSERT(workerContext->isSharedWorkerContext()); workerContext->toSharedWorkerContext()->dispatchEvent(createConnectEvent(port)); } -void WebSharedWorkerImpl::startWorkerContext(const WebURL& url, const WebString& name, const WebString& userAgent, const WebString& sourceCode) +void WebSharedWorkerImpl::startWorkerContext(const WebURL& url, const WebString& name, const WebString& userAgent, const WebString& sourceCode, long long) { initializeLoader(url); setWorkerThread(SharedWorkerThread::create(name, url, userAgent, sourceCode, *this, *this)); diff --git a/WebKit/chromium/src/WebSharedWorkerImpl.h b/WebKit/chromium/src/WebSharedWorkerImpl.h index 7c10d76..b591c7b 100644 --- a/WebKit/chromium/src/WebSharedWorkerImpl.h +++ b/WebKit/chromium/src/WebSharedWorkerImpl.h @@ -51,7 +51,7 @@ public: // WebSharedWorker methods: virtual bool isStarted(); - virtual void startWorkerContext(const WebURL&, const WebString& name, const WebString& userAgent, const WebString& sourceCode); + virtual void startWorkerContext(const WebURL&, const WebString& name, const WebString& userAgent, const WebString& sourceCode, long long); virtual void connect(WebMessagePortChannel*, ConnectListener*); virtual void terminateWorkerContext(); virtual void clientDestroyed(); diff --git a/WebKit/chromium/src/WebSpeechInputControllerMockImpl.cpp b/WebKit/chromium/src/WebSpeechInputControllerMockImpl.cpp new file mode 100644 index 0000000..60c4fed --- /dev/null +++ b/WebKit/chromium/src/WebSpeechInputControllerMockImpl.cpp @@ -0,0 +1,93 @@ +/* + * 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 "WebSpeechInputControllerMockImpl.h" + +#include "PlatformString.h" +#include "SpeechInputClientMock.h" +#include "WebRect.h" + +namespace WebKit { + +WebSpeechInputControllerMock* WebSpeechInputControllerMock::create(WebSpeechInputListener* listener) +{ + return new WebSpeechInputControllerMockImpl(listener); +} + +WebSpeechInputControllerMockImpl::WebSpeechInputControllerMockImpl( + WebSpeechInputListener* listener) + : m_webcoreMock(new WebCore::SpeechInputClientMock()) + , m_listener(listener) +{ + m_webcoreMock->setListener(this); +} + +WebSpeechInputControllerMockImpl::~WebSpeechInputControllerMockImpl() +{ + m_webcoreMock->setListener(0); +} + +void WebSpeechInputControllerMockImpl::setMockRecognitionResult(const WebString& result) +{ + m_webcoreMock->setRecognitionResult(result); +} + +void WebSpeechInputControllerMockImpl::didCompleteRecording(int requestId) +{ + m_listener->didCompleteRecording(requestId); +} + +void WebSpeechInputControllerMockImpl::didCompleteRecognition(int requestId) +{ + m_listener->didCompleteRecognition(requestId); +} + +void WebSpeechInputControllerMockImpl::setRecognitionResult(int requestId, const WTF::String& result) +{ + m_listener->setRecognitionResult(requestId, result); +} + +bool WebSpeechInputControllerMockImpl::startRecognition(int requestId, const WebRect& elementRect) +{ + return m_webcoreMock->startRecognition(requestId, elementRect); +} + +void WebSpeechInputControllerMockImpl::cancelRecognition(int requestId) +{ + m_webcoreMock->cancelRecognition(requestId); +} + +void WebSpeechInputControllerMockImpl::stopRecording(int requestId) +{ + m_webcoreMock->stopRecording(requestId); +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/WebSpeechInputControllerMockImpl.h b/WebKit/chromium/src/WebSpeechInputControllerMockImpl.h new file mode 100644 index 0000000..edbfca3 --- /dev/null +++ b/WebKit/chromium/src/WebSpeechInputControllerMockImpl.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: + * + * * 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 WebSpeechInputControllerMockImpl_h +#define WebSpeechInputControllerMockImpl_h + +#include "SpeechInputListener.h" +#include "WebSpeechInputControllerMock.h" +#include "WebSpeechInputListener.h" +#include "WebString.h" +#include <wtf/OwnPtr.h> + +namespace WebCore { +class SpeechInputClientMock; +} + +namespace WebKit { + +struct WebRect; + +class WebSpeechInputControllerMockImpl : public WebCore::SpeechInputListener + , public WebSpeechInputControllerMock { +public: + WebSpeechInputControllerMockImpl(WebSpeechInputListener*); + virtual ~WebSpeechInputControllerMockImpl(); + + // WebCore::SpeechInputListener methods. + void didCompleteRecording(int requestId); + void didCompleteRecognition(int requestId); + void setRecognitionResult(int requestId, const WTF::String& result); + + // WebSpeechInputController methods. + bool startRecognition(int requestId, const WebRect& elementRect); + void cancelRecognition(int requestId); + void stopRecording(int requestId); + + // WebSpeechInputControllerMock methods. + void setMockRecognitionResult(const WebString& result); + +private: + OwnPtr<WebCore::SpeechInputClientMock> m_webcoreMock; + WebSpeechInputListener* m_listener; +}; + +} // namespace WebKit + +#endif // WebSpeechInputControllerMockImpl_h + diff --git a/WebKit/chromium/src/WebStorageAreaImpl.cpp b/WebKit/chromium/src/WebStorageAreaImpl.cpp index 9a7fd5c..2cecfe9 100644 --- a/WebKit/chromium/src/WebStorageAreaImpl.cpp +++ b/WebKit/chromium/src/WebStorageAreaImpl.cpp @@ -66,7 +66,7 @@ WebString WebStorageAreaImpl::getItem(const WebString& key) return m_storageArea->getItem(key); } -void WebStorageAreaImpl::setItem(const WebString& key, const WebString& value, const WebURL& url, Result& result, WebString& oldValue) +void WebStorageAreaImpl::setItem(const WebString& key, const WebString& value, const WebURL& url, Result& result, WebString& oldValue, WebFrame*) { int exceptionCode = 0; diff --git a/WebKit/chromium/src/WebStorageAreaImpl.h b/WebKit/chromium/src/WebStorageAreaImpl.h index e9a11c2..2869fc9 100644 --- a/WebKit/chromium/src/WebStorageAreaImpl.h +++ b/WebKit/chromium/src/WebStorageAreaImpl.h @@ -45,7 +45,7 @@ public: virtual unsigned length(); virtual WebString key(unsigned index); virtual WebString getItem(const WebString& key); - virtual void setItem(const WebString& key, const WebString& value, const WebURL& url, Result& result, WebString& oldValue); + virtual void setItem(const WebString& key, const WebString& value, const WebURL& url, Result& result, WebString& oldValue, WebFrame*); virtual void removeItem(const WebString& key, const WebURL& url, WebString& oldValue); virtual void clear(const WebURL& url, bool& somethingCleared); diff --git a/WebKit/chromium/src/WebStorageNamespaceImpl.cpp b/WebKit/chromium/src/WebStorageNamespaceImpl.cpp index e6f6548..53b4a75 100644 --- a/WebKit/chromium/src/WebStorageNamespaceImpl.cpp +++ b/WebKit/chromium/src/WebStorageNamespaceImpl.cpp @@ -45,9 +45,9 @@ WebStorageNamespace* WebStorageNamespace::createLocalStorageNamespace(const WebS return new WebStorageNamespaceImpl(WebCore::StorageNamespaceImpl::localStorageNamespace(path, quota)); } -WebStorageNamespace* WebStorageNamespace::createSessionStorageNamespace() +WebStorageNamespace* WebStorageNamespace::createSessionStorageNamespace(unsigned quota) { - return new WebStorageNamespaceImpl(WebCore::StorageNamespaceImpl::sessionStorageNamespace()); + return new WebStorageNamespaceImpl(WebCore::StorageNamespaceImpl::sessionStorageNamespace(quota)); } WebStorageNamespaceImpl::WebStorageNamespaceImpl(PassRefPtr<WebCore::StorageNamespace> storageNamespace) @@ -61,7 +61,7 @@ WebStorageNamespaceImpl::~WebStorageNamespaceImpl() WebStorageArea* WebStorageNamespaceImpl::createStorageArea(const WebString& originString) { - WebCore::String originWebCoreString = originString; + WTF::String originWebCoreString = originString; if (originWebCoreString == "file://") { // FIXME: We should really be passing around WebSecurityOrigin objects // to represent security origins instead of strings. One issue diff --git a/WebKit/chromium/src/WebString.cpp b/WebKit/chromium/src/WebString.cpp index 36d5f86..a091ef4 100644 --- a/WebKit/chromium/src/WebString.cpp +++ b/WebKit/chromium/src/WebString.cpp @@ -31,15 +31,15 @@ #include "config.h" #include "WebString.h" -#include "AtomicString.h" -#include "CString.h" #include "PlatformString.h" +#include <wtf/text/CString.h> +#include <wtf/text/AtomicString.h> #include "WebCString.h" namespace WebKit { -class WebStringPrivate : public WebCore::StringImpl { +class WebStringPrivate : public WTF::StringImpl { }; void WebString::reset() @@ -58,7 +58,7 @@ void WebString::assign(const WebString& other) void WebString::assign(const WebUChar* data, size_t length) { assign(static_cast<WebStringPrivate*>( - WebCore::StringImpl::create(data, length).get())); + WTF::StringImpl::create(data, length).get())); } size_t WebString::length() const @@ -73,17 +73,17 @@ const WebUChar* WebString::data() const WebCString WebString::utf8() const { - return WebCore::String(m_private).utf8(); + return WTF::String(m_private).utf8(); } WebString WebString::fromUTF8(const char* data, size_t length) { - return WebCore::String::fromUTF8(data, length); + return WTF::String::fromUTF8(data, length); } WebString WebString::fromUTF8(const char* data) { - return WebCore::String::fromUTF8(data); + return WTF::String::fromUTF8(data); } bool WebString::equals(const WebString& s) const @@ -91,39 +91,39 @@ bool WebString::equals(const WebString& s) const return equal(m_private, s.m_private); } -WebString::WebString(const WebCore::String& s) +WebString::WebString(const WTF::String& s) : m_private(static_cast<WebStringPrivate*>(s.impl())) { if (m_private) m_private->ref(); } -WebString& WebString::operator=(const WebCore::String& s) +WebString& WebString::operator=(const WTF::String& s) { assign(static_cast<WebStringPrivate*>(s.impl())); return *this; } -WebString::operator WebCore::String() const +WebString::operator WTF::String() const { return m_private; } -WebString::WebString(const WebCore::AtomicString& s) +WebString::WebString(const WTF::AtomicString& s) : m_private(0) { assign(s.string()); } -WebString& WebString::operator=(const WebCore::AtomicString& s) +WebString& WebString::operator=(const WTF::AtomicString& s) { assign(s.string()); return *this; } -WebString::operator WebCore::AtomicString() const +WebString::operator WTF::AtomicString() const { - return WebCore::AtomicString(static_cast<WebCore::StringImpl *>(m_private)); + return WTF::AtomicString(static_cast<WTF::StringImpl *>(m_private)); } void WebString::assign(WebStringPrivate* p) diff --git a/WebKit/chromium/public/WebCompositionCommand.h b/WebKit/chromium/src/WebTextRun.cpp index fa89529..58d9fac 100644 --- a/WebKit/chromium/public/WebCompositionCommand.h +++ b/WebKit/chromium/src/WebTextRun.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Google Inc. All rights reserved. + * 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 @@ -28,17 +28,18 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebCompositionCommand_h -#define WebCompositionCommand_h +#include "config.h" +#include "WebTextRun.h" + +#include "TextRun.h" + +using namespace WebCore; namespace WebKit { -enum WebCompositionCommand { - WebCompositionCommandDiscard, - WebCompositionCommandSet, - WebCompositionCommandConfirm, -}; +WebTextRun::operator WebCore::TextRun() const +{ + return TextRun(text, false, 0, 0, rtl, directionalOverride); +} } // namespace WebKit - -#endif diff --git a/WebKit/chromium/src/WebURLError.cpp b/WebKit/chromium/src/WebURLError.cpp index a038aee..ef32b5c 100644 --- a/WebKit/chromium/src/WebURLError.cpp +++ b/WebKit/chromium/src/WebURLError.cpp @@ -31,9 +31,9 @@ #include "config.h" #include "WebURLError.h" -#include "CString.h" #include "KURL.h" #include "ResourceError.h" +#include <wtf/text/CString.h> using namespace WebCore; diff --git a/WebKit/chromium/src/WebURLLoadTiming.cpp b/WebKit/chromium/src/WebURLLoadTiming.cpp new file mode 100644 index 0000000..27ed362 --- /dev/null +++ b/WebKit/chromium/src/WebURLLoadTiming.cpp @@ -0,0 +1,192 @@ +/* + * 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 "WebURLLoadTiming.h" + +#include "ResourceLoadTiming.h" +#include "WebString.h" + +using namespace WebCore; + +namespace WebKit { + +void WebURLLoadTiming::initialize() +{ + m_private = ResourceLoadTiming::create(); +} + +void WebURLLoadTiming::reset() +{ + m_private.reset(); +} + +void WebURLLoadTiming::assign(const WebURLLoadTiming& other) +{ + m_private = other.m_private; +} + +double WebURLLoadTiming::requestTime() const +{ + return m_private->requestTime; +} + +void WebURLLoadTiming::setRequestTime(double time) +{ + m_private->requestTime = time; +} + +int WebURLLoadTiming::proxyStart() const +{ + return m_private->proxyStart; +} + +void WebURLLoadTiming::setProxyStart(int start) +{ + m_private->proxyStart = start; +} + +int WebURLLoadTiming::proxyEnd() const +{ + return m_private->proxyEnd; +} + +void WebURLLoadTiming::setProxyEnd(int end) +{ + m_private->proxyEnd = end; +} + +int WebURLLoadTiming::dnsStart() const +{ + return m_private->dnsStart; +} + +void WebURLLoadTiming::setDNSStart(int start) +{ + m_private->dnsStart = start; +} + +int WebURLLoadTiming::dnsEnd() const +{ + return m_private->dnsEnd; +} + +void WebURLLoadTiming::setDNSEnd(int end) +{ + m_private->dnsEnd = end; +} + +int WebURLLoadTiming::connectStart() const +{ + return m_private->connectStart; +} + +void WebURLLoadTiming::setConnectStart(int start) +{ + m_private->connectStart = start; +} + +int WebURLLoadTiming::connectEnd() const +{ + return m_private->connectEnd; +} + +void WebURLLoadTiming::setConnectEnd(int end) +{ + m_private->connectEnd = end; +} + +int WebURLLoadTiming::sendStart() const +{ + return m_private->sendStart; +} + +void WebURLLoadTiming::setSendStart(int start) +{ + m_private->sendStart = start; +} + +int WebURLLoadTiming::sendEnd() const +{ + return m_private->sendEnd; +} + +void WebURLLoadTiming::setSendEnd(int end) +{ + m_private->sendEnd = end; +} + +int WebURLLoadTiming::receiveHeadersEnd() const +{ + return m_private->receiveHeadersEnd; +} + +void WebURLLoadTiming::setReceiveHeadersEnd(int end) +{ + m_private->receiveHeadersEnd = end; +} + +int WebURLLoadTiming::sslStart() const +{ + return m_private->sslStart; +} + +void WebURLLoadTiming::setSSLStart(int start) +{ + m_private->sslStart = start; +} + +int WebURLLoadTiming::sslEnd() const +{ + return m_private->sslEnd; +} + +void WebURLLoadTiming::setSSLEnd(int end) +{ + m_private->sslEnd = end; +} + +WebURLLoadTiming::WebURLLoadTiming(const PassRefPtr<ResourceLoadTiming>& value) + : m_private(value) +{ +} + +WebURLLoadTiming& WebURLLoadTiming::operator=(const PassRefPtr<ResourceLoadTiming>& value) +{ + m_private = value; + return *this; +} + +WebURLLoadTiming::operator PassRefPtr<ResourceLoadTiming>() const +{ + return m_private.get(); +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/WebURLRequest.cpp b/WebKit/chromium/src/WebURLRequest.cpp index 46fa842..2950076 100644 --- a/WebKit/chromium/src/WebURLRequest.cpp +++ b/WebKit/chromium/src/WebURLRequest.cpp @@ -55,6 +55,8 @@ public: : m_resourceRequestAllocation(*p->m_resourceRequest) { m_resourceRequest = &m_resourceRequestAllocation; + m_allowStoredCredentials = p->m_allowStoredCredentials; + m_downloadToFile = p->m_downloadToFile; } virtual void dispose() { delete this; } @@ -194,6 +196,16 @@ void WebURLRequest::setReportUploadProgress(bool reportUploadProgress) m_private->m_resourceRequest->setReportUploadProgress(reportUploadProgress); } +bool WebURLRequest::reportLoadTiming() const +{ + return m_private->m_resourceRequest->reportLoadTiming(); +} + +void WebURLRequest::setReportLoadTiming(bool reportLoadTiming) +{ + m_private->m_resourceRequest->setReportLoadTiming(reportLoadTiming); +} + WebURLRequest::TargetType WebURLRequest::targetType() const { return static_cast<TargetType>(m_private->m_resourceRequest->targetType()); @@ -235,6 +247,16 @@ void WebURLRequest::setAppCacheHostID(int appCacheHostID) m_private->m_resourceRequest->setAppCacheHostID(appCacheHostID); } +bool WebURLRequest::downloadToFile() const +{ + return m_private->m_downloadToFile; +} + +void WebURLRequest::setDownloadToFile(bool downloadToFile) +{ + m_private->m_downloadToFile = downloadToFile; +} + ResourceRequest& WebURLRequest::toMutableResourceRequest() { ASSERT(m_private); diff --git a/WebKit/chromium/src/WebURLRequestPrivate.h b/WebKit/chromium/src/WebURLRequestPrivate.h index 2f7c25f..79f6451 100644 --- a/WebKit/chromium/src/WebURLRequestPrivate.h +++ b/WebKit/chromium/src/WebURLRequestPrivate.h @@ -37,13 +37,19 @@ namespace WebKit { class WebURLRequestPrivate { public: - WebURLRequestPrivate() : m_resourceRequest(0), m_allowStoredCredentials(true) { } + WebURLRequestPrivate() + : m_resourceRequest(0) + , m_allowStoredCredentials(true) + , m_downloadToFile(false) { } // Called by WebURLRequest when it no longer needs this object. virtual void dispose() = 0; WebCore::ResourceRequest* m_resourceRequest; bool m_allowStoredCredentials; + + // FIXME: Move this to ResourceRequest once we have an internal consumer. + bool m_downloadToFile; }; } // namespace WebKit diff --git a/WebKit/chromium/src/WebURLResponse.cpp b/WebKit/chromium/src/WebURLResponse.cpp index 95e0be2..aae413c 100644 --- a/WebKit/chromium/src/WebURLResponse.cpp +++ b/WebKit/chromium/src/WebURLResponse.cpp @@ -32,12 +32,16 @@ #include "WebURLResponse.h" #include "ResourceResponse.h" +#include "ResourceLoadTiming.h" #include "WebHTTPHeaderVisitor.h" #include "WebString.h" #include "WebURL.h" +#include "WebURLLoadTiming.h" #include "WebURLResponsePrivate.h" +#include <wtf/RefPtr.h> + using namespace WebCore; namespace WebKit { @@ -55,6 +59,7 @@ public: : m_resourceResponseAllocation(*p->m_resourceResponse) { m_resourceResponse = &m_resourceResponseAllocation; + m_downloadFilePath = p->m_downloadFilePath; } virtual void dispose() { delete this; } @@ -93,6 +98,47 @@ void WebURLResponse::setURL(const WebURL& url) m_private->m_resourceResponse->setURL(url); } +unsigned WebURLResponse::connectionID() const +{ + return m_private->m_resourceResponse->connectionID(); +} + +void WebURLResponse::setConnectionID(unsigned connectionID) +{ + m_private->m_resourceResponse->setConnectionID(connectionID); +} + +bool WebURLResponse::connectionReused() const +{ + return m_private->m_resourceResponse->connectionReused(); +} + +void WebURLResponse::setConnectionReused(bool connectionReused) +{ + m_private->m_resourceResponse->setConnectionReused(connectionReused); +} + +WebURLLoadTiming WebURLResponse::loadTiming() +{ + return WebURLLoadTiming(m_private->m_resourceResponse->resourceLoadTiming()); +} + +void WebURLResponse::setLoadTiming(const WebURLLoadTiming& timing) +{ + RefPtr<ResourceLoadTiming> loadTiming = PassRefPtr<ResourceLoadTiming>(timing); + m_private->m_resourceResponse->setResourceLoadTiming(loadTiming.release()); +} + +double WebURLResponse::responseTime() const +{ + return m_private->m_resourceResponse->responseTime(); +} + +void WebURLResponse::setResponseTime(double responseTime) +{ + m_private->m_resourceResponse->setResponseTime(responseTime); +} + WebString WebURLResponse::mimeType() const { return m_private->m_resourceResponse->mimeType(); @@ -165,6 +211,8 @@ void WebURLResponse::setHTTPHeaderField(const WebString& name, const WebString& void WebURLResponse::addHTTPHeaderField(const WebString& name, const WebString& value) { + if (name.isNull() || value.isNull()) + return; // FIXME: Add an addHTTPHeaderField method to ResourceResponse. const HTTPHeaderMap& map = m_private->m_resourceResponse->httpHeaderFields(); String valueStr(value); @@ -255,6 +303,16 @@ const ResourceResponse& WebURLResponse::toResourceResponse() const return *m_private->m_resourceResponse; } +bool WebURLResponse::wasCached() const +{ + return m_private->m_resourceResponse->wasCached(); +} + +void WebURLResponse::setWasCached(bool value) +{ + m_private->m_resourceResponse->setWasCached(value); +} + bool WebURLResponse::wasFetchedViaSPDY() const { return m_private->m_resourceResponse->wasFetchedViaSPDY(); @@ -265,6 +323,56 @@ void WebURLResponse::setWasFetchedViaSPDY(bool value) m_private->m_resourceResponse->setWasFetchedViaSPDY(value); } +bool WebURLResponse::wasNpnNegotiated() const +{ + return m_private->m_resourceResponse->wasNpnNegotiated(); +} + +void WebURLResponse::setWasNpnNegotiated(bool value) +{ + m_private->m_resourceResponse->setWasNpnNegotiated(value); +} + +bool WebURLResponse::wasAlternateProtocolAvailable() const +{ + return m_private->m_resourceResponse->wasAlternateProtocolAvailable(); +} + +void WebURLResponse::setWasAlternateProtocolAvailable(bool value) +{ + m_private->m_resourceResponse->setWasAlternateProtocolAvailable(value); +} + +bool WebURLResponse::wasFetchedViaProxy() const +{ + return m_private->m_resourceResponse->wasFetchedViaProxy(); +} + +void WebURLResponse::setWasFetchedViaProxy(bool value) +{ + m_private->m_resourceResponse->setWasFetchedViaProxy(value); +} + +bool WebURLResponse::isMultipartPayload() const +{ + return m_private->m_resourceResponse->isMultipartPayload(); +} + +void WebURLResponse::setIsMultipartPayload(bool value) +{ + m_private->m_resourceResponse->setIsMultipartPayload(value); +} + +WebString WebURLResponse::downloadFilePath() const +{ + return m_private->m_downloadFilePath; +} + +void WebURLResponse::setDownloadFilePath(const WebString& downloadFilePath) +{ + m_private->m_downloadFilePath = downloadFilePath; +} + void WebURLResponse::assign(WebURLResponsePrivate* p) { // Subclasses may call this directly so a self-assignment check is needed diff --git a/WebKit/chromium/src/WebURLResponsePrivate.h b/WebKit/chromium/src/WebURLResponsePrivate.h index 716c8db..dc5ce22 100644 --- a/WebKit/chromium/src/WebURLResponsePrivate.h +++ b/WebKit/chromium/src/WebURLResponsePrivate.h @@ -31,6 +31,8 @@ #ifndef WebURLResponsePrivate_h #define WebURLResponsePrivate_h +#include "WebString.h" + namespace WebCore { class ResourceResponse; } namespace WebKit { @@ -43,6 +45,9 @@ public: virtual void dispose() = 0; WebCore::ResourceResponse* m_resourceResponse; + + // FIXME: Move this to ResourceResponse once we have an internal consumer. + WebString m_downloadFilePath; }; } // namespace WebKit diff --git a/WebKit/chromium/src/WebViewImpl.cpp b/WebKit/chromium/src/WebViewImpl.cpp index ce03523..383b716 100644 --- a/WebKit/chromium/src/WebViewImpl.cpp +++ b/WebKit/chromium/src/WebViewImpl.cpp @@ -32,19 +32,21 @@ #include "WebViewImpl.h" #include "AutoFillPopupMenuClient.h" -#include "AutocompletePopupMenuClient.h" #include "AXObjectCache.h" #include "Chrome.h" +#include "CompositionUnderlineVectorBuilder.h" #include "ContextMenu.h" #include "ContextMenuController.h" #include "ContextMenuItem.h" #include "CSSStyleSelector.h" #include "CSSValueKeywords.h" #include "Cursor.h" +#include "DeviceOrientationClientProxy.h" #include "Document.h" #include "DocumentLoader.h" #include "DOMUtilitiesPrivate.h" #include "DragController.h" +#include "DragScrollTimer.h" #include "DragData.h" #include "Editor.h" #include "EventHandler.h" @@ -53,10 +55,12 @@ #include "FrameLoader.h" #include "FrameTree.h" #include "FrameView.h" +#include "GLES2Context.h" +#include "GLES2ContextInternal.h" #include "GraphicsContext.h" -#include "HitTestResult.h" #include "HTMLInputElement.h" #include "HTMLMediaElement.h" +#include "HitTestResult.h" #include "HTMLNames.h" #include "Image.h" #include "InspectorController.h" @@ -72,8 +76,8 @@ #include "PlatformContextSkia.h" #include "PlatformKeyboardEvent.h" #include "PlatformMouseEvent.h" +#include "PlatformThemeChromiumGtk.h" #include "PlatformWheelEvent.h" -#include "PluginInfoStore.h" #include "PopupMenuChromium.h" #include "PopupMenuClient.h" #include "ProgressTracker.h" @@ -82,31 +86,41 @@ #include "SecurityOrigin.h" #include "SelectionController.h" #include "Settings.h" +#include "Timer.h" #include "TypingCommand.h" +#include "UserGestureIndicator.h" +#include "Vector.h" #include "WebAccessibilityObject.h" #include "WebDevToolsAgentPrivate.h" +#include "WebDevToolsAgentImpl.h" #include "WebDragData.h" #include "WebFrameImpl.h" +#include "WebImage.h" +#include "WebInputElement.h" #include "WebInputEvent.h" #include "WebInputEventConversion.h" +#include "WebKit.h" +#include "WebKitClient.h" #include "WebMediaPlayerAction.h" #include "WebNode.h" +#include "WebPlugin.h" +#include "WebPluginContainerImpl.h" #include "WebPoint.h" #include "WebPopupMenuImpl.h" #include "WebRect.h" +#include "WebRuntimeFeatures.h" #include "WebSettingsImpl.h" #include "WebString.h" #include "WebVector.h" #include "WebViewClient.h" +#include "wtf/OwnPtr.h" #if OS(WINDOWS) -#include "KeyboardCodesWin.h" #include "RenderThemeChromiumWin.h" #else #if OS(LINUX) #include "RenderThemeChromiumLinux.h" #endif -#include "KeyboardCodesPosix.h" #include "RenderTheme.h" #endif @@ -133,8 +147,8 @@ static const double maxTextSizeMultiplier = 3.0; const char* pageGroupName = "default"; // Used to defer all page activity in cases where the embedder wishes to run -// a nested event loop. -static PageGroupLoadDeferrer* pageGroupLoadDeferrer; +// a nested event loop. Using a stack enables nesting of message loop invocations. +static Vector<PageGroupLoadDeferrer*> pageGroupLoadDeferrerStack; // Ensure that the WebDragOperation enum values stay in sync with the original // DragOperation constants. @@ -149,15 +163,12 @@ COMPILE_ASSERT_MATCHING_ENUM(DragOperationMove); COMPILE_ASSERT_MATCHING_ENUM(DragOperationDelete); COMPILE_ASSERT_MATCHING_ENUM(DragOperationEvery); -// Note that focusOnShow is false so that the suggestions popup is shown not -// activated. We need the page to still have focus so the user can keep typing -// while the popup is showing. -static const PopupContainerSettings suggestionsPopupSettings = { - false, // focusOnShow - false, // setTextOnIndexChange - false, // acceptOnAbandon - true, // loopSelectionNavigation - true, // restrictWidthOfListBox. Same as other browser (Fx, IE, and safari) +static const PopupContainerSettings autoFillPopupSettings = { + false, // setTextOnIndexChange + false, // acceptOnAbandon + true, // loopSelectionNavigation + false, // restrictWidthOfListBox (For security reasons show the entire entry + // so the user doesn't enter information it did not intend to.) // For suggestions, we use the direction of the input field as the direction // of the popup items. The main reason is to keep the display of items in // drop-down the same as the items in the input field. @@ -166,9 +177,13 @@ static const PopupContainerSettings suggestionsPopupSettings = { // WebView ---------------------------------------------------------------- -WebView* WebView::create(WebViewClient* client) +WebView* WebView::create(WebViewClient* client, WebDevToolsAgentClient* devToolsClient) { - return new WebViewImpl(client); + // Keep runtime flag for device motion turned off until it's implemented. + WebRuntimeFeatures::enableDeviceMotion(false); + + // Pass the WebViewImpl's self-reference to the caller. + return adoptRef(new WebViewImpl(client, devToolsClient)).leakRef(); } void WebView::updateVisitedLinkState(unsigned long long linkHash) @@ -183,24 +198,23 @@ void WebView::resetVisitedLinkState() void WebView::willEnterModalLoop() { - // It is not valid to nest more than once. - ASSERT(!pageGroupLoadDeferrer); - PageGroup* pageGroup = PageGroup::pageGroup(pageGroupName); ASSERT(pageGroup); - ASSERT(!pageGroup->pages().isEmpty()); - // Pick any page in the page group since we are deferring all pages. - pageGroupLoadDeferrer = new PageGroupLoadDeferrer(*pageGroup->pages().begin(), true); + if (pageGroup->pages().isEmpty()) + pageGroupLoadDeferrerStack.append(static_cast<PageGroupLoadDeferrer*>(0)); + else { + // Pick any page in the page group since we are deferring all pages. + pageGroupLoadDeferrerStack.append(new PageGroupLoadDeferrer(*pageGroup->pages().begin(), true)); + } } void WebView::didExitModalLoop() { - // The embedder must have called willEnterNestedEventLoop. - ASSERT(pageGroupLoadDeferrer); + ASSERT(pageGroupLoadDeferrerStack.size()); - delete pageGroupLoadDeferrer; - pageGroupLoadDeferrer = 0; + delete pageGroupLoadDeferrerStack.last(); + pageGroupLoadDeferrerStack.removeLast(); } void WebViewImpl::initializeMainFrame(WebFrameClient* frameClient) @@ -216,7 +230,7 @@ void WebViewImpl::initializeMainFrame(WebFrameClient* frameClient) SecurityOrigin::setLocalLoadPolicy(SecurityOrigin::AllowLocalLoadsForLocalOnly); } -WebViewImpl::WebViewImpl(WebViewClient* client) +WebViewImpl::WebViewImpl(WebViewClient* client, WebDevToolsAgentClient* devToolsClient) : m_client(client) , m_backForwardListClientImpl(this) , m_chromeClientImpl(this) @@ -240,31 +254,51 @@ WebViewImpl::WebViewImpl(WebViewClient* client) , m_dropEffect(DropEffectDefault) , m_operationsAllowed(WebDragOperationNone) , m_dragOperation(WebDragOperationNone) - , m_suggestionsPopupShowing(false) - , m_suggestionsPopupClient(0) - , m_suggestionsPopup(0) + , m_autoFillPopupShowing(false) + , m_autoFillPopupClient(0) + , m_autoFillPopup(0) , m_isTransparent(false) , m_tabsToLinks(false) + , m_dragScrollTimer(new DragScrollTimer()) +#if USE(ACCELERATED_COMPOSITING) + , m_layerRenderer(0) + , m_isAcceleratedCompositingActive(false) +#endif +#if ENABLE(INPUT_SPEECH) + , m_speechInputClient(client) +#endif + , m_gles2Context(0) + , m_deviceOrientationClientProxy(new DeviceOrientationClientProxy(client ? client->deviceOrientationClient() : 0)) { // WebKit/win/WebView.cpp does the same thing, except they call the // KJS specific wrapper around this method. We need to have threading // initialized because CollatorICU requires it. WTF::initializeThreading(); + WTF::initializeMainThread(); // set to impossible point so we always get the first mouse pos m_lastMousePosition = WebPoint(-1, -1); - // the page will take ownership of the various clients - m_page.set(new Page(&m_chromeClientImpl, - &m_contextMenuClientImpl, - &m_editorClientImpl, - &m_dragClientImpl, - &m_inspectorClientImpl, - 0, - 0)); + if (devToolsClient) + m_devToolsAgent = new WebDevToolsAgentImpl(this, devToolsClient); + + Page::PageClients pageClients; + pageClients.chromeClient = &m_chromeClientImpl; + pageClients.contextMenuClient = &m_contextMenuClientImpl; + pageClients.editorClient = &m_editorClientImpl; + pageClients.dragClient = &m_dragClientImpl; + pageClients.inspectorClient = &m_inspectorClientImpl; +#if ENABLE(INPUT_SPEECH) + pageClients.speechInputClient = &m_speechInputClient; +#endif + pageClients.deviceOrientationClient = m_deviceOrientationClientProxy.get(); + + m_page.set(new Page(pageClients)); m_page->backForwardList()->setClient(&m_backForwardListClientImpl); m_page->setGroupName(pageGroupName); + + m_inspectorSettingsMap.set(new SettingsMap); } WebViewImpl::~WebViewImpl() @@ -326,19 +360,34 @@ void WebViewImpl::mouseDown(const WebMouseEvent& event) if (!mainFrameImpl() || !mainFrameImpl()->frameView()) return; + // If there is a select popup open, close it as the user is clicking on + // the page (outside of the popup). We also save it so we can prevent a + // click on the select element from immediately reopening the popup. + RefPtr<WebCore::PopupContainer> selectPopup; + if (event.button == WebMouseEvent::ButtonLeft) { + selectPopup = m_selectPopup; + hideSelectPopup(); + ASSERT(!m_selectPopup); + } + m_lastMouseDownPoint = WebPoint(event.x, event.y); - // If a text field that has focus is clicked again, we should display the - // suggestions popup. RefPtr<Node> clickedNode; if (event.button == WebMouseEvent::ButtonLeft) { + IntPoint point(event.x, event.y); + point = m_page->mainFrame()->view()->windowToContents(point); + HitTestResult result(m_page->mainFrame()->eventHandler()->hitTestResultAtPoint(point, false)); + Node* hitNode = result.innerNonSharedNode(); + + // Take capture on a mouse down on a plugin so we can send it mouse events. + if (hitNode && hitNode->renderer() && hitNode->renderer()->isEmbeddedObject()) + m_mouseCaptureNode = hitNode; + + // If a text field that has focus is clicked again, we should display the + // AutoFill popup. RefPtr<Node> focusedNode = focusedWebCoreNode(); if (focusedNode.get() && toHTMLInputElement(focusedNode.get())) { - IntPoint point(event.x, event.y); - point = m_page->mainFrame()->view()->windowToContents(point); - HitTestResult result(point); - result = m_page->mainFrame()->eventHandler()->hitTestResultAtPoint(point, false); - if (result.innerNonSharedNode() == focusedNode) { + if (hitNode == focusedNode) { // Already focused text field was clicked, let's remember this. If // focus has not changed after the mouse event is processed, we'll // trigger the autocomplete. @@ -347,14 +396,23 @@ void WebViewImpl::mouseDown(const WebMouseEvent& event) } } + mainFrameImpl()->frame()->loader()->resetMultipleFormSubmissionProtection(); + mainFrameImpl()->frame()->eventHandler()->handleMousePressEvent( PlatformMouseEventBuilder(mainFrameImpl()->frameView(), event)); if (clickedNode.get() && clickedNode == focusedWebCoreNode()) { - // Focus has not changed, show the suggestions popup. + // Focus has not changed, show the AutoFill popup. static_cast<EditorClientImpl*>(m_page->editorClient())-> showFormAutofillForNode(clickedNode.get()); } + if (m_selectPopup && m_selectPopup == selectPopup) { + // That click triggered a select popup which is the same as the one that + // was showing before the click. It means the user clicked the select + // while the popup was showing, and as a result we first closed then + // immediately reopened the select popup. It needs to be closed. + hideSelectPopup(); + } // Dispatch the contextmenu event regardless of if the click was swallowed. // On Windows, we handle it on mouse up, not down. @@ -426,7 +484,7 @@ void WebViewImpl::mouseUp(const WebMouseEvent& event) IntPoint contentPoint = view->windowToContents(clickPoint); HitTestResult hitTestResult = focused->eventHandler()->hitTestResultAtPoint(contentPoint, false, false, ShouldHitTestScrollbars); // We don't want to send a paste when middle clicking a scroll bar or a - // link (which will navigate later in the code). The main scrollbars + // link (which will navigate later in the code). The main scrollbars // have to be handled separately. if (!hitTestResult.scrollbar() && !hitTestResult.isLiveLink() && focused && !view->scrollbarAtPoint(clickPoint)) { Editor* editor = focused->editor(); @@ -439,7 +497,6 @@ void WebViewImpl::mouseUp(const WebMouseEvent& event) } #endif - mouseCaptureLost(); mainFrameImpl()->frame()->eventHandler()->handleMouseReleaseEvent( PlatformMouseEventBuilder(mainFrameImpl()->frameView(), event)); @@ -451,10 +508,10 @@ void WebViewImpl::mouseUp(const WebMouseEvent& event) #endif } -void WebViewImpl::mouseWheel(const WebMouseWheelEvent& event) +bool WebViewImpl::mouseWheel(const WebMouseWheelEvent& event) { PlatformWheelEventBuilder platformEvent(mainFrameImpl()->frameView(), event); - mainFrameImpl()->frame()->eventHandler()->handleWheelEvent(platformEvent); + return mainFrameImpl()->frame()->eventHandler()->handleWheelEvent(platformEvent); } bool WebViewImpl::keyEvent(const WebKeyboardEvent& event) @@ -471,6 +528,10 @@ bool WebViewImpl::keyEvent(const WebKeyboardEvent& event) // event. m_suppressNextKeypressEvent = false; + // Give any select popup a chance at consuming the key event. + if (selectPopupHandleKeyEvent(event)) + return true; + // Give Autocomplete a chance to consume the key events it is interested in. if (autocompleteHandleKeyEvent(event)) return true; @@ -507,17 +568,30 @@ bool WebViewImpl::keyEvent(const WebKeyboardEvent& event) PlatformKeyboardEventBuilder evt(event); if (handler->keyEvent(evt)) { - if (WebInputEvent::RawKeyDown == event.type) - m_suppressNextKeypressEvent = true; + if (WebInputEvent::RawKeyDown == event.type) { + // Suppress the next keypress event unless the focused node is a plug-in node. + // (Flash needs these keypress events to handle non-US keyboards.) + Node* node = frame->document()->focusedNode(); + if (!node || !node->renderer() || !node->renderer()->isEmbeddedObject()) + m_suppressNextKeypressEvent = true; + } return true; } return keyEventDefault(event); } +bool WebViewImpl::selectPopupHandleKeyEvent(const WebKeyboardEvent& event) +{ + if (!m_selectPopup) + return false; + + return m_selectPopup->handleKeyEvent(PlatformKeyboardEventBuilder(event)); +} + bool WebViewImpl::autocompleteHandleKeyEvent(const WebKeyboardEvent& event) { - if (!m_suggestionsPopupShowing + if (!m_autoFillPopupShowing // Home and End should be left to the text field to process. || event.windowsKeyCode == VKEY_HOME || event.windowsKeyCode == VKEY_END) @@ -525,7 +599,7 @@ bool WebViewImpl::autocompleteHandleKeyEvent(const WebKeyboardEvent& event) // Pressing delete triggers the removal of the selected suggestion from the DB. if (event.windowsKeyCode == VKEY_DELETE - && m_suggestionsPopup->selectedIndex() != -1) { + && m_autoFillPopup->selectedIndex() != -1) { Node* node = focusedWebCoreNode(); if (!node || (node->nodeType() != Node::ELEMENT_NODE)) { ASSERT_NOT_REACHED(); @@ -537,22 +611,25 @@ bool WebViewImpl::autocompleteHandleKeyEvent(const WebKeyboardEvent& event) return false; } - int selectedIndex = m_suggestionsPopup->selectedIndex(); - HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(element); - WebString name = inputElement->name(); - WebString value = m_autocompletePopupClient->itemText(selectedIndex); + int selectedIndex = m_autoFillPopup->selectedIndex(); + + if (!m_autoFillPopupClient->canRemoveSuggestionAtIndex(selectedIndex)) + return false; + + WebString name = WebInputElement(static_cast<HTMLInputElement*>(element)).nameForAutofill(); + WebString value = m_autoFillPopupClient->itemText(selectedIndex); m_client->removeAutofillSuggestions(name, value); // Update the entries in the currently showing popup to reflect the // deletion. - m_autocompletePopupClient->removeSuggestionAtIndex(selectedIndex); - refreshSuggestionsPopup(); + m_autoFillPopupClient->removeSuggestionAtIndex(selectedIndex); + refreshAutoFillPopup(); return false; } - if (!m_suggestionsPopup->isInterestedInEventForKey(event.windowsKeyCode)) + if (!m_autoFillPopup->isInterestedInEventForKey(event.windowsKeyCode)) return false; - if (m_suggestionsPopup->handleKeyEvent(PlatformKeyboardEventBuilder(event))) { + if (m_autoFillPopup->handleKeyEvent(PlatformKeyboardEventBuilder(event))) { // We need to ignore the next Char event after this otherwise pressing // enter when selecting an item in the menu will go to the page. if (WebInputEvent::RawKeyDown == event.type) @@ -604,62 +681,21 @@ bool WebViewImpl::charEvent(const WebKeyboardEvent& event) return true; } -// The WebViewImpl::SendContextMenuEvent function is based on the Webkit -// function -// bool WebView::handleContextMenuEvent(WPARAM wParam, LPARAM lParam) in -// webkit\webkit\win\WebView.cpp. The only significant change in this -// function is the code to convert from a Keyboard event to the Right -// Mouse button up event. -// -// This function is an ugly copy/paste and should be cleaned up when the -// WebKitWin version is cleaned: https://bugs.webkit.org/show_bug.cgi?id=20438 -#if OS(WINDOWS) || OS(LINUX) -// FIXME: implement on Mac -bool WebViewImpl::sendContextMenuEvent(const WebKeyboardEvent& event) +#if ENABLE(TOUCH_EVENTS) +bool WebViewImpl::touchEvent(const WebTouchEvent& event) { - static const int kContextMenuMargin = 1; - Frame* mainFrameImpl = page()->mainFrame(); - FrameView* view = mainFrameImpl->view(); - if (!view) + if (!mainFrameImpl() || !mainFrameImpl()->frameView()) return false; - IntPoint coords(-1, -1); -#if OS(WINDOWS) - int rightAligned = ::GetSystemMetrics(SM_MENUDROPALIGNMENT); -#else - int rightAligned = 0; + PlatformTouchEventBuilder touchEventBuilder(mainFrameImpl()->frameView(), event); + return mainFrameImpl()->frame()->eventHandler()->handleTouchEvent(touchEventBuilder); +} #endif - IntPoint location; - - - Frame* focusedFrame = page()->focusController()->focusedOrMainFrame(); - Node* focusedNode = focusedFrame->document()->focusedNode(); - Position start = mainFrameImpl->selection()->selection().start(); - - if (focusedFrame->editor() && focusedFrame->editor()->canEdit() && start.node()) { - RenderObject* renderer = start.node()->renderer(); - if (!renderer) - return false; - - RefPtr<Range> selection = mainFrameImpl->selection()->toNormalizedRange(); - IntRect firstRect = mainFrameImpl->firstRectForRange(selection.get()); - - int x = rightAligned ? firstRect.right() : firstRect.x(); - location = IntPoint(x, firstRect.bottom()); - } else if (focusedNode) - location = focusedNode->getRect().bottomLeft(); - else { - location = IntPoint( - rightAligned ? view->contentsWidth() - kContextMenuMargin : kContextMenuMargin, - kContextMenuMargin); - } - - location = view->contentsToWindow(location); - // FIXME: The IntSize(0, -1) is a hack to get the hit-testing to result in - // the selected element. Ideally we'd have the position of a context menu - // event be separate from its target node. - coords = location + IntSize(0, -1); +#if OS(WINDOWS) || OS(LINUX) +// Mac has no way to open a context menu based on a keyboard event. +bool WebViewImpl::sendContextMenuEvent(const WebKeyboardEvent& event) +{ // The contextMenuController() holds onto the last context menu that was // popped up on the page until a new one is created. We need to clear // this menu before propagating the event through the DOM so that we can @@ -668,17 +704,9 @@ bool WebViewImpl::sendContextMenuEvent(const WebKeyboardEvent& event) // not run. page()->contextMenuController()->clearContextMenu(); - focusedFrame->view()->setCursor(pointerCursor()); - WebMouseEvent mouseEvent; - mouseEvent.button = WebMouseEvent::ButtonRight; - mouseEvent.x = coords.x(); - mouseEvent.y = coords.y(); - mouseEvent.type = WebInputEvent::MouseUp; - - PlatformMouseEventBuilder platformEvent(view, mouseEvent); - m_contextMenuAllowed = true; - bool handled = focusedFrame->eventHandler()->sendContextMenuEvent(platformEvent); + Frame* focusedFrame = page()->focusController()->focusedOrMainFrame(); + bool handled = focusedFrame->eventHandler()->sendContextMenuEventForKey(); m_contextMenuAllowed = false; return handled; } @@ -733,45 +761,59 @@ bool WebViewImpl::scrollViewWithKeyboard(int keyCode, int modifiers) { ScrollDirection scrollDirection; ScrollGranularity scrollGranularity; + if (!mapKeyCodeForScroll(keyCode, &scrollDirection, &scrollGranularity)) + return false; + return propagateScroll(scrollDirection, scrollGranularity); +} +bool WebViewImpl::mapKeyCodeForScroll(int keyCode, + WebCore::ScrollDirection* scrollDirection, + WebCore::ScrollGranularity* scrollGranularity) +{ switch (keyCode) { case VKEY_LEFT: - scrollDirection = ScrollLeft; - scrollGranularity = ScrollByLine; + *scrollDirection = ScrollLeft; + *scrollGranularity = ScrollByLine; break; case VKEY_RIGHT: - scrollDirection = ScrollRight; - scrollGranularity = ScrollByLine; + *scrollDirection = ScrollRight; + *scrollGranularity = ScrollByLine; break; case VKEY_UP: - scrollDirection = ScrollUp; - scrollGranularity = ScrollByLine; + *scrollDirection = ScrollUp; + *scrollGranularity = ScrollByLine; break; case VKEY_DOWN: - scrollDirection = ScrollDown; - scrollGranularity = ScrollByLine; + *scrollDirection = ScrollDown; + *scrollGranularity = ScrollByLine; break; case VKEY_HOME: - scrollDirection = ScrollUp; - scrollGranularity = ScrollByDocument; + *scrollDirection = ScrollUp; + *scrollGranularity = ScrollByDocument; break; case VKEY_END: - scrollDirection = ScrollDown; - scrollGranularity = ScrollByDocument; + *scrollDirection = ScrollDown; + *scrollGranularity = ScrollByDocument; break; case VKEY_PRIOR: // page up - scrollDirection = ScrollUp; - scrollGranularity = ScrollByPage; + *scrollDirection = ScrollUp; + *scrollGranularity = ScrollByPage; break; case VKEY_NEXT: // page down - scrollDirection = ScrollDown; - scrollGranularity = ScrollByPage; + *scrollDirection = ScrollDown; + *scrollGranularity = ScrollByPage; break; default: return false; } - return propagateScroll(scrollDirection, scrollGranularity); + return true; +} + +void WebViewImpl::hideSelectPopup() +{ + if (m_selectPopup.get()) + m_selectPopup->hidePopup(); } bool WebViewImpl::propagateScroll(ScrollDirection scrollDirection, @@ -793,6 +835,30 @@ bool WebViewImpl::propagateScroll(ScrollDirection scrollDirection, return scrollHandled; } +void WebViewImpl::popupOpened(WebCore::PopupContainer* popupContainer) +{ + if (popupContainer->popupType() == WebCore::PopupContainer::Select) { + ASSERT(!m_selectPopup); + m_selectPopup = popupContainer; + } +} + +void WebViewImpl::popupClosed(WebCore::PopupContainer* popupContainer) +{ + if (popupContainer->popupType() == WebCore::PopupContainer::Select) { + ASSERT(m_selectPopup.get()); + m_selectPopup = 0; + } +} + +void WebViewImpl::hideAutoFillPopup() +{ + if (m_autoFillPopupShowing) { + m_autoFillPopup->hidePopup(); + m_autoFillPopupShowing = false; + } +} + Frame* WebViewImpl::focusedWebCoreFrame() { return m_page.get() ? m_page->focusController()->focusedOrMainFrame() : 0; @@ -848,6 +914,13 @@ void WebViewImpl::resize(const WebSize& newSize) WebRect damagedRect(0, 0, m_size.width, m_size.height); m_client->didInvalidateRect(damagedRect); } + +#if OS(DARWIN) + if (m_gles2Context) { + m_gles2Context->resizeOnscreenContent(WebSize(std::max(1, m_size.width), + std::max(1, m_size.height))); + } +#endif } void WebViewImpl::layout() @@ -873,9 +946,33 @@ void WebViewImpl::layout() void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect) { - WebFrameImpl* webframe = mainFrameImpl(); - if (webframe) - webframe->paint(canvas, rect); + +#if USE(ACCELERATED_COMPOSITING) + if (!isAcceleratedCompositingActive()) { +#endif + WebFrameImpl* webframe = mainFrameImpl(); + if (webframe) + webframe->paint(canvas, rect); +#if USE(ACCELERATED_COMPOSITING) + } else { + // Draw the contents of the root layer. + updateRootLayerContents(rect); + + WebFrameImpl* webframe = mainFrameImpl(); + if (!webframe) + return; + FrameView* view = webframe->frameView(); + if (!view) + return; + + // The visibleRect includes scrollbars whereas the contentRect doesn't. + IntRect visibleRect = view->visibleContentRect(true); + IntRect contentRect = view->visibleContentRect(false); + + // Ask the layer compositor to redraw all the layers. + m_layerRenderer->drawLayers(rect, visibleRect, contentRect, IntPoint(view->scrollX(), view->scrollY())); + } +#endif } // FIXME: m_currentInputEvent should be removed once ChromeClient::show() can @@ -884,6 +981,8 @@ const WebInputEvent* WebViewImpl::m_currentInputEvent = 0; bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent) { + UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); + // If we've started a drag and drop operation, ignore input events until // we're done. if (m_doingDragAndDrop) @@ -892,6 +991,38 @@ bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent) if (m_ignoreInputEvents) return true; + if (m_mouseCaptureNode.get() && WebInputEvent::isMouseEventType(inputEvent.type)) { + // Save m_mouseCaptureNode since mouseCaptureLost() will clear it. + RefPtr<Node> node = m_mouseCaptureNode; + + // Not all platforms call mouseCaptureLost() directly. + if (inputEvent.type == WebInputEvent::MouseUp) + mouseCaptureLost(); + + AtomicString eventType; + switch (inputEvent.type) { + case WebInputEvent::MouseMove: + eventType = eventNames().mousemoveEvent; + break; + case WebInputEvent::MouseLeave: + eventType = eventNames().mouseoutEvent; + break; + case WebInputEvent::MouseDown: + eventType = eventNames().mousedownEvent; + break; + case WebInputEvent::MouseUp: + eventType = eventNames().mouseupEvent; + break; + default: + ASSERT_NOT_REACHED(); + } + + node->dispatchMouseEvent( + PlatformMouseEventBuilder(mainFrameImpl()->frameView(), *static_cast<const WebMouseEvent*>(&inputEvent)), + eventType); + return true; + } + // FIXME: Remove m_currentInputEvent. // This only exists to allow ChromeClient::show() to know which mouse button // triggered a window.open event. @@ -915,7 +1046,7 @@ bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent) break; case WebInputEvent::MouseWheel: - mouseWheel(*static_cast<const WebMouseWheelEvent*>(&inputEvent)); + handled = mouseWheel(*static_cast<const WebMouseWheelEvent*>(&inputEvent)); break; case WebInputEvent::MouseDown: @@ -936,6 +1067,15 @@ bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent) handled = charEvent(*static_cast<const WebKeyboardEvent*>(&inputEvent)); break; +#if ENABLE(TOUCH_EVENTS) + case WebInputEvent::TouchStart: + case WebInputEvent::TouchMove: + case WebInputEvent::TouchEnd: + case WebInputEvent::TouchCancel: + handled = touchEvent(*static_cast<const WebTouchEvent*>(&inputEvent)); + break; +#endif + default: handled = false; } @@ -947,6 +1087,7 @@ bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent) void WebViewImpl::mouseCaptureLost() { + m_mouseCaptureNode = 0; } void WebViewImpl::setFocus(bool enable) @@ -981,7 +1122,8 @@ void WebViewImpl::setFocus(bool enable) } m_imeAcceptEvents = true; } else { - hideSuggestionsPopup(); + hideAutoFillPopup(); + hideSelectPopup(); // Clear focus on the currently focused frame if any. if (!m_page.get()) @@ -1002,11 +1144,11 @@ void WebViewImpl::setFocus(bool enable) } } -bool WebViewImpl::handleCompositionEvent(WebCompositionCommand command, - int cursorPosition, - int targetStart, - int targetEnd, - const WebString& imeString) +bool WebViewImpl::setComposition( + const WebString& text, + const WebVector<WebCompositionUnderline>& underlines, + int selectionStart, + int selectionEnd) { Frame* focused = focusedWebCoreFrame(); if (!focused || !m_imeAcceptEvents) @@ -1014,13 +1156,12 @@ bool WebViewImpl::handleCompositionEvent(WebCompositionCommand command, Editor* editor = focused->editor(); if (!editor) return false; - if (!editor->canEdit()) { - // The input focus has been moved to another WebWidget object. - // We should use this |editor| object only to complete the ongoing - // composition. - if (!editor->hasComposition()) - return false; - } + + // The input focus has been moved to another WebWidget object. + // We should use this |editor| object only to complete the ongoing + // composition. + if (!editor->canEdit() && !editor->hasComposition()) + return false; // We should verify the parent node of this IME composition node are // editable because JavaScript may delete a parent node of the composition @@ -1033,7 +1174,9 @@ bool WebViewImpl::handleCompositionEvent(WebCompositionCommand command, return false; } - if (command == WebCompositionCommandDiscard) { + // If we're not going to fire a keypress event, then the keydown event was + // canceled. In that case, cancel any existing composition. + if (text.isEmpty() || m_suppressNextKeypressEvent) { // A browser process sent an IPC message which does not contain a valid // string, which means an ongoing composition has been canceled. // If the ongoing composition has been canceled, replace the ongoing @@ -1041,81 +1184,102 @@ bool WebViewImpl::handleCompositionEvent(WebCompositionCommand command, String emptyString; Vector<CompositionUnderline> emptyUnderlines; editor->setComposition(emptyString, emptyUnderlines, 0, 0); - } else { - // A browser process sent an IPC message which contains a string to be - // displayed in this Editor object. - // To display the given string, set the given string to the - // m_compositionNode member of this Editor object and display it. - if (targetStart < 0) - targetStart = 0; - if (targetEnd < 0) - targetEnd = static_cast<int>(imeString.length()); - String compositionString(imeString); - // Create custom underlines. - // To emphasize the selection, the selected region uses a solid black - // for its underline while other regions uses a pale gray for theirs. - Vector<CompositionUnderline> underlines(3); - underlines[0].startOffset = 0; - underlines[0].endOffset = targetStart; - underlines[0].thick = true; - underlines[0].color.setRGB(0xd3, 0xd3, 0xd3); - underlines[1].startOffset = targetStart; - underlines[1].endOffset = targetEnd; - underlines[1].thick = true; - underlines[1].color.setRGB(0x00, 0x00, 0x00); - underlines[2].startOffset = targetEnd; - underlines[2].endOffset = static_cast<int>(imeString.length()); - underlines[2].thick = true; - underlines[2].color.setRGB(0xd3, 0xd3, 0xd3); - // When we use custom underlines, WebKit ("InlineTextBox.cpp" Line 282) - // prevents from writing a text in between 'selectionStart' and - // 'selectionEnd' somehow. - // Therefore, we use the 'cursorPosition' for these arguments so that - // there are not any characters in the above region. - editor->setComposition(compositionString, underlines, - cursorPosition, cursorPosition); - // The given string is a result string, which means the ongoing - // composition has been completed. I have to call the - // Editor::confirmCompletion() and complete this composition. - if (command == WebCompositionCommandConfirm) - editor->confirmComposition(); + return text.isEmpty(); } + // When the range of composition underlines overlap with the range between + // selectionStart and selectionEnd, WebKit somehow won't paint the selection + // at all (see InlineTextBox::paint() function in InlineTextBox.cpp). + // But the selection range actually takes effect. + editor->setComposition(String(text), + CompositionUnderlineVectorBuilder(underlines), + selectionStart, selectionEnd); + return editor->hasComposition(); } -bool WebViewImpl::queryCompositionStatus(bool* enableIME, WebRect* caretRect) +bool WebViewImpl::confirmComposition() +{ + Frame* focused = focusedWebCoreFrame(); + if (!focused || !m_imeAcceptEvents) + return false; + Editor* editor = focused->editor(); + if (!editor || !editor->hasComposition()) + return false; + + // We should verify the parent node of this IME composition node are + // editable because JavaScript may delete a parent node of the composition + // node. In this case, WebKit crashes while deleting texts from the parent + // node, which doesn't exist any longer. + PassRefPtr<Range> range = editor->compositionRange(); + if (range) { + const Node* node = range->startPosition().node(); + if (!node || !node->isContentEditable()) + return false; + } + + editor->confirmComposition(); + return true; +} + +WebTextInputType WebViewImpl::textInputType() { - // Store whether the selected node needs IME and the caret rectangle. - // This process consists of the following four steps: - // 1. Retrieve the selection controller of the focused frame; - // 2. Retrieve the caret rectangle from the controller; - // 3. Convert the rectangle, which is relative to the parent view, to the - // one relative to the client window, and; - // 4. Store the converted rectangle. + WebTextInputType type = WebTextInputTypeNone; const Frame* focused = focusedWebCoreFrame(); if (!focused) - return false; + return type; const Editor* editor = focused->editor(); if (!editor || !editor->canEdit()) - return false; + return type; SelectionController* controller = focused->selection(); if (!controller) - return false; + return type; const Node* node = controller->start().node(); if (!node) - return false; + return type; + + // FIXME: Support more text input types when necessary, eg. Number, + // Date, Email, URL, etc. + if (controller->isInPasswordField()) + type = WebTextInputTypePassword; + else if (node->shouldUseInputMethod()) + type = WebTextInputTypeText; - *enableIME = node->shouldUseInputMethod() && !controller->isInPasswordField(); - const FrameView* view = node->document()->view(); + return type; +} + +WebRect WebViewImpl::caretOrSelectionBounds() +{ + WebRect rect; + const Frame* focused = focusedWebCoreFrame(); + if (!focused) + return rect; + + SelectionController* controller = focused->selection(); + if (!controller) + return rect; + + const FrameView* view = focused->view(); if (!view) - return false; + return rect; - *caretRect = view->contentsToWindow(controller->absoluteCaretBounds()); - return true; + const Node* node = controller->start().node(); + if (!node || !node->renderer()) + return rect; + + if (controller->isCaret()) + rect = view->contentsToWindow(controller->absoluteCaretBounds()); + else if (controller->isRange()) { + node = controller->end().node(); + if (!node || !node->renderer()) + return rect; + RefPtr<Range> range = controller->toNormalizedRange(); + rect = view->contentsToWindow(focused->firstRectForRange(range.get())); + } + return rect; } void WebViewImpl::setTextDirection(WebTextDirection direction) @@ -1151,6 +1315,15 @@ void WebViewImpl::setTextDirection(WebTextDirection direction) } } +bool WebViewImpl::isAcceleratedCompositingActive() const +{ +#if USE(ACCELERATED_COMPOSITING) + return m_isAcceleratedCompositingActive; +#else + return false; +#endif +} + // WebView -------------------------------------------------------------------- WebSettings* WebViewImpl::settings() @@ -1166,7 +1339,7 @@ WebString WebViewImpl::pageEncoding() const if (!m_page.get()) return WebString(); - return m_page->mainFrame()->loader()->encoding(); + return m_page->mainFrame()->loader()->writer()->encoding(); } void WebViewImpl::setPageEncoding(const WebString& encodingName) @@ -1191,7 +1364,7 @@ bool WebViewImpl::dispatchBeforeUnloadEvent() if (!frame) return true; - return frame->shouldClose(); + return frame->loader()->shouldClose(); } void WebViewImpl::dispatchUnloadEvent() @@ -1300,9 +1473,15 @@ int WebViewImpl::setZoomLevel(bool textOnly, int zoomLevel) maxTextSizeMultiplier), minTextSizeMultiplier)); Frame* frame = mainFrameImpl()->frame(); - if (zoomFactor != frame->zoomFactor()) { + FrameView* view = frame->view(); + if (!view) + return m_zoomLevel; + if (zoomFactor != view->zoomFactor()) { + view->setZoomFactor(zoomFactor, textOnly ? ZoomTextOnly : ZoomPage); + WebPluginContainerImpl* pluginContainer = WebFrameImpl::pluginContainerFromFrame(frame); + if (pluginContainer) + pluginContainer->plugin()->setZoomFactor(zoomFactor, textOnly); m_zoomLevel = zoomLevel; - frame->setZoomFactor(zoomFactor, textOnly); } return m_zoomLevel; } @@ -1331,6 +1510,9 @@ void WebViewImpl::performMediaPlayerAction(const WebMediaPlayerAction& action, case WebMediaPlayerAction::Loop: mediaElement->setLoop(action.enable); break; + case WebMediaPlayerAction::Controls: + mediaElement->setControls(action.enable); + break; default: ASSERT_NOT_REACHED(); } @@ -1368,6 +1550,15 @@ void WebViewImpl::dragSourceEndedAt( false, 0); m_page->mainFrame()->eventHandler()->dragSourceEndedAt(pme, static_cast<DragOperation>(operation)); + m_dragScrollTimer->stop(); +} + +void WebViewImpl::dragSourceMovedTo( + const WebPoint& clientPoint, + const WebPoint& screenPoint, + WebDragOperation operation) +{ + m_dragScrollTimer->triggerScroll(mainFrameImpl()->frameView(), clientPoint); } void WebViewImpl::dragSourceSystemDragEnded() @@ -1392,26 +1583,7 @@ WebDragOperation WebViewImpl::dragTargetDragEnter( m_dragIdentity = identity; m_operationsAllowed = operationsAllowed; - DragData dragData( - m_currentDragData.get(), - clientPoint, - screenPoint, - static_cast<DragOperation>(operationsAllowed)); - - m_dropEffect = DropEffectDefault; - m_dragTargetDispatch = true; - DragOperation effect = m_page->dragController()->dragEntered(&dragData); - // Mask the operation against the drag source's allowed operations. - if ((effect & dragData.draggingSourceOperationMask()) != effect) - effect = DragOperationNone; - m_dragTargetDispatch = false; - - if (m_dropEffect != DropEffectDefault) { - m_dragOperation = (m_dropEffect != DropEffectNone) ? WebDragOperationCopy - : WebDragOperationNone; - } else - m_dragOperation = static_cast<WebDragOperation>(effect); - return m_dragOperation; + return dragTargetDragEnterOrOver(clientPoint, screenPoint, DragEnter); } WebDragOperation WebViewImpl::dragTargetDragOver( @@ -1419,29 +1591,9 @@ WebDragOperation WebViewImpl::dragTargetDragOver( const WebPoint& screenPoint, WebDragOperationsMask operationsAllowed) { - ASSERT(m_currentDragData.get()); - m_operationsAllowed = operationsAllowed; - DragData dragData( - m_currentDragData.get(), - clientPoint, - screenPoint, - static_cast<DragOperation>(operationsAllowed)); - m_dropEffect = DropEffectDefault; - m_dragTargetDispatch = true; - DragOperation effect = m_page->dragController()->dragUpdated(&dragData); - // Mask the operation against the drag source's allowed operations. - if ((effect & dragData.draggingSourceOperationMask()) != effect) - effect = DragOperationNone; - m_dragTargetDispatch = false; - - if (m_dropEffect != DropEffectDefault) { - m_dragOperation = (m_dropEffect != DropEffectNone) ? WebDragOperationCopy - : WebDragOperationNone; - } else - m_dragOperation = static_cast<WebDragOperation>(effect); - return m_dragOperation; + return dragTargetDragEnterOrOver(clientPoint, screenPoint, DragOver); } void WebViewImpl::dragTargetDragLeave() @@ -1495,6 +1647,7 @@ void WebViewImpl::dragTargetDrop(const WebPoint& clientPoint, m_dropEffect = DropEffectDefault; m_dragOperation = WebDragOperationNone; m_dragIdentity = 0; + m_dragScrollTimer->stop(); } int WebViewImpl::dragIdentity() @@ -1504,7 +1657,42 @@ int WebViewImpl::dragIdentity() return 0; } -unsigned long WebViewImpl::createUniqueIdentifierForRequest() { +WebDragOperation WebViewImpl::dragTargetDragEnterOrOver(const WebPoint& clientPoint, const WebPoint& screenPoint, DragAction dragAction) +{ + ASSERT(m_currentDragData.get()); + + DragData dragData( + m_currentDragData.get(), + clientPoint, + screenPoint, + static_cast<DragOperation>(m_operationsAllowed)); + + m_dropEffect = DropEffectDefault; + m_dragTargetDispatch = true; + DragOperation effect = dragAction == DragEnter ? m_page->dragController()->dragEntered(&dragData) + : m_page->dragController()->dragUpdated(&dragData); + // Mask the operation against the drag source's allowed operations. + if (!(effect & dragData.draggingSourceOperationMask())) + effect = DragOperationNone; + m_dragTargetDispatch = false; + + if (m_dropEffect != DropEffectDefault) { + m_dragOperation = (m_dropEffect != DropEffectNone) ? WebDragOperationCopy + : WebDragOperationNone; + } else + m_dragOperation = static_cast<WebDragOperation>(effect); + + if (dragAction == DragOver) + m_dragScrollTimer->triggerScroll(mainFrameImpl()->frameView(), clientPoint); + else + m_dragScrollTimer->stop(); + + + return m_dragOperation; +} + +unsigned long WebViewImpl::createUniqueIdentifierForRequest() +{ if (m_page) return m_page->progress()->createUniqueIdentifier(); return 0; @@ -1537,15 +1725,24 @@ void WebViewImpl::setInspectorSettings(const WebString& settings) m_inspectorSettings = settings; } -WebDevToolsAgent* WebViewImpl::devToolsAgent() +bool WebViewImpl::inspectorSetting(const WebString& key, WebString* value) const { - return m_devToolsAgent.get(); + if (!m_inspectorSettingsMap->contains(key)) + return false; + *value = m_inspectorSettingsMap->get(key); + return true; +} + +void WebViewImpl::setInspectorSetting(const WebString& key, + const WebString& value) +{ + m_inspectorSettingsMap->set(key, value); + client()->didUpdateInspectorSetting(key, value); } -void WebViewImpl::setDevToolsAgent(WebDevToolsAgent* devToolsAgent) +WebDevToolsAgent* WebViewImpl::devToolsAgent() { - ASSERT(!m_devToolsAgent.get()); // May only set once! - m_devToolsAgent.set(static_cast<WebDevToolsAgentPrivate*>(devToolsAgent)); + return m_devToolsAgent.get(); } WebAccessibilityObject WebViewImpl::accessibilityObject() @@ -1558,25 +1755,31 @@ WebAccessibilityObject WebViewImpl::accessibilityObject() document->axObjectCache()->getOrCreate(document->renderer())); } -void WebViewImpl::applyAutofillSuggestions( +void WebViewImpl::applyAutoFillSuggestions( const WebNode& node, - const WebVector<WebString>& suggestions, - int defaultSuggestionIndex) + const WebVector<WebString>& names, + const WebVector<WebString>& labels, + const WebVector<int>& uniqueIDs, + int separatorIndex) { - applyAutocompleteSuggestions(node, suggestions, defaultSuggestionIndex); + WebVector<WebString> icons(names.size()); + applyAutoFillSuggestions(node, names, labels, icons, uniqueIDs, separatorIndex); } void WebViewImpl::applyAutoFillSuggestions( const WebNode& node, const WebVector<WebString>& names, const WebVector<WebString>& labels, - int defaultSuggestionIndex) + const WebVector<WebString>& icons, + const WebVector<int>& uniqueIDs, + int separatorIndex) { ASSERT(names.size() == labels.size()); - ASSERT(defaultSuggestionIndex < static_cast<int>(names.size())); + ASSERT(names.size() == uniqueIDs.size()); + ASSERT(separatorIndex < static_cast<int>(names.size())); if (names.isEmpty()) { - hideSuggestionsPopup(); + hideAutoFillPopup(); return; } @@ -1585,7 +1788,7 @@ void WebViewImpl::applyAutoFillSuggestions( // focused node, then we have nothing to do. FIXME: also check the // caret is at the end and that the text has not changed. if (!focusedNode || focusedNode != PassRefPtr<Node>(node)) { - hideSuggestionsPopup(); + hideAutoFillPopup(); return; } @@ -1597,98 +1800,54 @@ void WebViewImpl::applyAutoFillSuggestions( if (!m_autoFillPopupClient.get()) m_autoFillPopupClient.set(new AutoFillPopupMenuClient); - m_autoFillPopupClient->initialize(inputElem, names, labels, - defaultSuggestionIndex); - - if (m_suggestionsPopupClient != m_autoFillPopupClient.get()) { - hideSuggestionsPopup(); - m_suggestionsPopupClient = m_autoFillPopupClient.get(); - } + m_autoFillPopupClient->initialize( + inputElem, names, labels, icons, uniqueIDs, separatorIndex); if (!m_autoFillPopup.get()) { - m_autoFillPopup = PopupContainer::create(m_suggestionsPopupClient, - suggestionsPopupSettings); + m_autoFillPopup = PopupContainer::create(m_autoFillPopupClient.get(), + PopupContainer::Suggestion, + autoFillPopupSettings); } - if (m_suggestionsPopup != m_autoFillPopup.get()) - m_suggestionsPopup = m_autoFillPopup.get(); - - if (m_suggestionsPopupShowing) { - m_autoFillPopupClient->setSuggestions(names, labels); - refreshSuggestionsPopup(); + if (m_autoFillPopupShowing) { + m_autoFillPopupClient->setSuggestions( + names, labels, icons, uniqueIDs, separatorIndex); + refreshAutoFillPopup(); } else { - m_suggestionsPopup->show(focusedNode->getRect(), + m_autoFillPopup->show(focusedNode->getRect(), focusedNode->ownerDocument()->view(), 0); - m_suggestionsPopupShowing = true; + m_autoFillPopupShowing = true; } + + // DEPRECATED: This special mode will go away once AutoFill and Autocomplete + // merge is complete. + if (m_autoFillPopupClient) + m_autoFillPopupClient->setAutocompleteMode(false); } +// DEPRECATED: replacing with applyAutoFillSuggestions. void WebViewImpl::applyAutocompleteSuggestions( const WebNode& node, const WebVector<WebString>& suggestions, int defaultSuggestionIndex) { - ASSERT(defaultSuggestionIndex < static_cast<int>(suggestions.size())); + WebVector<WebString> names(suggestions.size()); + WebVector<WebString> labels(suggestions.size()); + WebVector<WebString> icons(suggestions.size()); + WebVector<int> uniqueIDs(suggestions.size()); - if (!m_page.get() || suggestions.isEmpty()) { - hideSuggestionsPopup(); - return; - } - - RefPtr<Node> focusedNode = focusedWebCoreNode(); - // If the node for which we queried the Autocomplete suggestions is not the - // focused node, then we have nothing to do. FIXME: also check the - // caret is at the end and that the text has not changed. - if (!focusedNode || focusedNode != PassRefPtr<Node>(node)) { - hideSuggestionsPopup(); - return; - } - - HTMLInputElement* inputElem = - static_cast<HTMLInputElement*>(focusedNode.get()); + for (size_t i = 0; i < suggestions.size(); ++i) + names[i] = suggestions[i]; - // The first time the Autocomplete is shown we'll create the client and the - // popup. - if (!m_autocompletePopupClient.get()) - m_autocompletePopupClient.set(new AutocompletePopupMenuClient); - - m_autocompletePopupClient->initialize(inputElem, suggestions, - defaultSuggestionIndex); - - if (m_suggestionsPopupClient != m_autocompletePopupClient.get()) { - hideSuggestionsPopup(); - m_suggestionsPopupClient = m_autocompletePopupClient.get(); - } - - if (!m_autocompletePopup.get()) { - m_autocompletePopup = PopupContainer::create(m_suggestionsPopupClient, - suggestionsPopupSettings); - } - - if (m_suggestionsPopup != m_autocompletePopup.get()) - m_suggestionsPopup = m_autocompletePopup.get(); - - if (m_suggestionsPopupShowing) { - m_autocompletePopupClient->setSuggestions(suggestions); - refreshSuggestionsPopup(); - } else { - m_suggestionsPopup->show(focusedNode->getRect(), - focusedNode->ownerDocument()->view(), 0); - m_suggestionsPopupShowing = true; - } + applyAutoFillSuggestions(node, names, labels, icons, uniqueIDs, -1); + if (m_autoFillPopupClient) + m_autoFillPopupClient->setAutocompleteMode(true); } -void WebViewImpl::hideAutofillPopup() +void WebViewImpl::hidePopups() { - hideSuggestionsPopup(); -} - -void WebViewImpl::hideSuggestionsPopup() -{ - if (m_suggestionsPopupShowing) { - m_suggestionsPopup->hidePopup(); - m_suggestionsPopupShowing = false; - } + hideSelectPopup(); + hideAutoFillPopup(); } void WebViewImpl::performCustomContextMenuAction(unsigned action) @@ -1748,7 +1907,7 @@ void WebViewImpl::setScrollbarColors(unsigned inactiveColor, unsigned activeColor, unsigned trackColor) { #if OS(LINUX) - RenderThemeChromiumLinux::setScrollbarColors(inactiveColor, + PlatformThemeChromiumGtk::setScrollbarColors(inactiveColor, activeColor, trackColor); #endif @@ -1767,15 +1926,43 @@ void WebViewImpl::setSelectionColors(unsigned activeBackgroundColor, #endif } -void WebViewImpl::addUserScript(const WebString& sourceCode, bool runAtStart) +void WebView::addUserScript(const WebString& sourceCode, + const WebVector<WebString>& patternsIn, + WebView::UserScriptInjectAt injectAt, + WebView::UserContentInjectIn injectIn) +{ + OwnPtr<Vector<String> > patterns(new Vector<String>); + for (size_t i = 0; i < patternsIn.size(); ++i) + patterns->append(patternsIn[i]); + + PageGroup* pageGroup = PageGroup::pageGroup(pageGroupName); + RefPtr<DOMWrapperWorld> world(DOMWrapperWorld::create()); + pageGroup->addUserScriptToWorld(world.get(), sourceCode, WebURL(), patterns.release(), 0, + static_cast<UserScriptInjectionTime>(injectAt), + static_cast<UserContentInjectedFrames>(injectIn)); +} + +void WebView::addUserStyleSheet(const WebString& sourceCode, + const WebVector<WebString>& patternsIn, + WebView::UserContentInjectIn injectIn) { + OwnPtr<Vector<String> > patterns(new Vector<String>); + for (size_t i = 0; i < patternsIn.size(); ++i) + patterns->append(patternsIn[i]); + PageGroup* pageGroup = PageGroup::pageGroup(pageGroupName); RefPtr<DOMWrapperWorld> world(DOMWrapperWorld::create()); - pageGroup->addUserScriptToWorld(world.get(), sourceCode, WebURL(), 0, 0, - runAtStart ? InjectAtDocumentStart : InjectAtDocumentEnd); + + // 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), + UserStyleSheet::AuthorLevel); } -void WebViewImpl::removeAllUserContent() +void WebView::removeAllUserContent() { PageGroup* pageGroup = PageGroup::pageGroup(pageGroupName); pageGroup->removeAllUserContent(); @@ -1799,7 +1986,7 @@ bool WebViewImpl::navigationPolicyFromMouseEvent(unsigned short button, bool alt, bool meta, WebNavigationPolicy* policy) { -#if OS(WINDOWS) || OS(LINUX) || OS(FREEBSD) +#if OS(WINDOWS) || OS(LINUX) || OS(FREEBSD) || OS(SOLARIS) const bool newTabModifier = (button == 1) || ctrl; #elif OS(DARWIN) const bool newTabModifier = (button == 1) || meta; @@ -1822,15 +2009,16 @@ bool WebViewImpl::navigationPolicyFromMouseEvent(unsigned short button, return true; } -void WebViewImpl::startDragging(const WebPoint& eventPos, - const WebDragData& dragData, - WebDragOperationsMask mask) +void WebViewImpl::startDragging(const WebDragData& dragData, + WebDragOperationsMask mask, + const WebImage& dragImage, + const WebPoint& dragImageOffset) { if (!m_client) return; ASSERT(!m_doingDragAndDrop); m_doingDragAndDrop = true; - m_client->startDragging(eventPos, dragData, mask); + m_client->startDragging(dragData, mask, dragImage, dragImageOffset); } void WebViewImpl::setCurrentHistoryItem(HistoryItem* item) @@ -1866,24 +2054,25 @@ NotificationPresenterImpl* WebViewImpl::notificationPresenterImpl() } #endif -void WebViewImpl::refreshSuggestionsPopup() +void WebViewImpl::refreshAutoFillPopup() { - ASSERT(m_suggestionsPopupShowing); + ASSERT(m_autoFillPopupShowing); // Hide the popup if it has become empty. - if (!m_autocompletePopupClient->listSize()) { - hideSuggestionsPopup(); + if (!m_autoFillPopupClient->listSize()) { + hideAutoFillPopup(); return; } - IntRect oldBounds = m_suggestionsPopup->boundsRect(); - m_suggestionsPopup->refresh(); - IntRect newBounds = m_suggestionsPopup->boundsRect(); + IntRect oldBounds = m_autoFillPopup->boundsRect(); + m_autoFillPopup->refresh(); + IntRect newBounds = m_autoFillPopup->boundsRect(); // Let's resize the backing window if necessary. if (oldBounds != newBounds) { WebPopupMenuImpl* popupMenu = - static_cast<WebPopupMenuImpl*>(m_suggestionsPopup->client()); - popupMenu->client()->setWindowRect(newBounds); + static_cast<WebPopupMenuImpl*>(m_autoFillPopup->client()); + if (popupMenu) + popupMenu->client()->setWindowRect(newBounds); } } @@ -1916,4 +2105,145 @@ bool WebViewImpl::tabsToLinks() const return m_tabsToLinks; } +#if USE(ACCELERATED_COMPOSITING) +void WebViewImpl::setRootGraphicsLayer(WebCore::PlatformLayer* layer) +{ + setIsAcceleratedCompositingActive(layer ? true : false); + if (m_layerRenderer) + m_layerRenderer->setRootLayer(layer); +} + +void WebViewImpl::setIsAcceleratedCompositingActive(bool active) +{ + if (m_isAcceleratedCompositingActive == active) + return; + + if (active) { + m_layerRenderer = LayerRendererChromium::create(getOnscreenGLES2Context()); + if (m_layerRenderer->hardwareCompositing()) + m_isAcceleratedCompositingActive = true; + else { + m_layerRenderer.clear(); + m_isAcceleratedCompositingActive = false; + } + } else { + m_layerRenderer = 0; + m_isAcceleratedCompositingActive = false; + } +} + +void WebViewImpl::updateRootLayerContents(const WebRect& rect) +{ + if (!isAcceleratedCompositingActive()) + return; + + // FIXME: The accelerated compositing path invalidates a 1x1 rect at (0, 0) + // in order to get the renderer to ask the compositor to redraw. This is only + // temporary until we get the compositor to render directly from its own thread. + if (!rect.x && !rect.y && rect.width == 1 && rect.height == 1) + return; + + WebFrameImpl* webframe = mainFrameImpl(); + if (!webframe) + return; + FrameView* view = webframe->frameView(); + if (!view) + return; + + LayerChromium* rootLayer = m_layerRenderer->rootLayer(); + if (rootLayer) { + IntRect visibleRect = view->visibleContentRect(true); + + m_layerRenderer->setRootLayerCanvasSize(IntSize(rect.width, rect.height)); + GraphicsContext* rootLayerContext = m_layerRenderer->rootLayerGraphicsContext(); + +#if PLATFORM(SKIA) + PlatformContextSkia* skiaContext = rootLayerContext->platformContext(); + skia::PlatformCanvas* platformCanvas = skiaContext->canvas(); + + platformCanvas->save(); + + // Bring the canvas into the coordinate system of the paint rect. + platformCanvas->translate(static_cast<SkScalar>(-rect.x), static_cast<SkScalar>(-rect.y)); + + rootLayerContext->save(); + + webframe->paintWithContext(*rootLayerContext, rect); + rootLayerContext->restore(); + + platformCanvas->restore(); +#elif PLATFORM(CG) + CGContextRef cgContext = rootLayerContext->platformContext(); + + CGContextSaveGState(cgContext); + + // Bring the CoreGraphics context into the coordinate system of the paint rect. + CGContextTranslateCTM(cgContext, -rect.x, -rect.y); + + rootLayerContext->save(); + + webframe->paintWithContext(*rootLayerContext, rect); + rootLayerContext->restore(); + + CGContextRestoreGState(cgContext); +#else +#error Must port to your platform +#endif + } +} + +void WebViewImpl::setRootLayerNeedsDisplay() +{ + // FIXME: For now we're posting a repaint event for the entire page which is an overkill. + if (WebFrameImpl* webframe = mainFrameImpl()) { + if (FrameView* view = webframe->frameView()) { + // FIXME: Temporary hack to invalidate part of the page so that we get called to render + // again. + IntRect visibleRect = view->visibleContentRect(true); + m_client->didInvalidateRect(IntRect(0, 0, 1, 1)); + } + } + + if (m_layerRenderer) + m_layerRenderer->setNeedsDisplay(); +} +#endif // USE(ACCELERATED_COMPOSITING) + +PassOwnPtr<GLES2Context> WebViewImpl::getOnscreenGLES2Context() +{ + return GLES2Context::create(GLES2ContextInternal::create(gles2Context(), false)); +} + +PassOwnPtr<GLES2Context> WebViewImpl::getOffscreenGLES2Context() +{ + WebGLES2Context* context = webKitClient()->createGLES2Context(); + if (!context) + return 0; + if (!context->initialize(0, gles2Context())) + return 0; + return GLES2Context::create(GLES2ContextInternal::create(context, true)); +} + +// Returns the GLES2 context associated with this View. If one doesn't exist +// it will get created first. +WebGLES2Context* WebViewImpl::gles2Context() +{ + if (!m_gles2Context) { + m_gles2Context = webKitClient()->createGLES2Context(); + if (!m_gles2Context) + return 0; + + if (!m_gles2Context->initialize(this, 0)) { + m_gles2Context.clear(); + return 0; + } + +#if OS(DARWIN) + m_gles2Context->resizeOnscreenContent(WebSize(std::max(1, m_size.width), + std::max(1, m_size.height))); +#endif + } + return m_gles2Context.get(); +} + } // namespace WebKit diff --git a/WebKit/chromium/src/WebViewImpl.h b/WebKit/chromium/src/WebViewImpl.h index 286ac43..c296121 100644 --- a/WebKit/chromium/src/WebViewImpl.h +++ b/WebKit/chromium/src/WebViewImpl.h @@ -31,27 +31,30 @@ #ifndef WebViewImpl_h #define WebViewImpl_h -// FIXME: Remove these relative paths once consumers from glue are removed. -#include "../public/WebNavigationPolicy.h" -#include "../public/WebPoint.h" -#include "../public/WebSize.h" -#include "../public/WebString.h" -#include "../public/WebView.h" +#include "WebGLES2Context.h" +#include "WebNavigationPolicy.h" +#include "WebPoint.h" +#include "WebSize.h" +#include "WebString.h" +#include "WebView.h" #include "BackForwardListClientImpl.h" #include "ChromeClientImpl.h" #include "ContextMenuClientImpl.h" #include "DragClientImpl.h" #include "EditorClientImpl.h" +#include "GraphicsLayer.h" #include "InspectorClientImpl.h" +#include "LayerRendererChromium.h" #include "NotificationPresenterImpl.h" - +#include "SpeechInputClientImpl.h" #include <wtf/OwnPtr.h> #include <wtf/RefCounted.h> namespace WebCore { class ChromiumDataObject; class Frame; +class GLES2Context; class HistoryItem; class HitTestResult; class KeyboardEvent; @@ -68,14 +71,18 @@ namespace WebKit { class AutocompletePopupMenuClient; class AutoFillPopupMenuClient; class ContextMenuClientImpl; -class SuggestionsPopupMenuClient; +class DeviceOrientationClientProxy; +class DragScrollTimer; class WebAccessibilityObject; +class WebDevToolsAgentClient; class WebDevToolsAgentPrivate; class WebFrameImpl; +class WebImage; class WebKeyboardEvent; class WebMouseEvent; class WebMouseWheelEvent; class WebSettingsImpl; +class WebTouchEvent; class WebViewImpl : public WebView, public RefCounted<WebViewImpl> { public: @@ -88,14 +95,16 @@ public: virtual bool handleInputEvent(const WebInputEvent&); virtual void mouseCaptureLost(); virtual void setFocus(bool enable); - virtual bool handleCompositionEvent(WebCompositionCommand command, - int cursorPosition, - int targetStart, - int targetEnd, - const WebString& text); - virtual bool queryCompositionStatus(bool* enabled, - WebRect* caretRect); + virtual bool setComposition( + const WebString& text, + const WebVector<WebCompositionUnderline>& underlines, + int selectionStart, + int selectionEnd); + virtual bool confirmComposition(); + virtual WebTextInputType textInputType(); + virtual WebRect caretOrSelectionBounds(); virtual void setTextDirection(WebTextDirection direction); + virtual bool isAcceleratedCompositingActive() const; // WebView methods: virtual void initializeMainFrame(WebFrameClient*); @@ -129,6 +138,10 @@ public: const WebPoint& clientPoint, const WebPoint& screenPoint, WebDragOperation operation); + virtual void dragSourceMovedTo( + const WebPoint& clientPoint, + const WebPoint& screenPoint, + WebDragOperation operation); virtual void dragSourceSystemDragEnded(); virtual WebDragOperation dragTargetDragEnter( const WebDragData& dragData, int identity, @@ -149,24 +162,31 @@ public: virtual void inspectElementAt(const WebPoint& point); virtual WebString inspectorSettings() const; virtual void setInspectorSettings(const WebString& settings); + virtual bool inspectorSetting(const WebString& key, WebString* value) const; + virtual void setInspectorSetting(const WebString& key, + const WebString& value); virtual WebDevToolsAgent* devToolsAgent(); - virtual void setDevToolsAgent(WebDevToolsAgent*); virtual WebAccessibilityObject accessibilityObject(); - virtual void applyAutofillSuggestions( + // DEPRECATED. + virtual void applyAutoFillSuggestions( const WebNode&, - const WebVector<WebString>& suggestions, - int defaultSuggestionIndex); + const WebVector<WebString>& names, + const WebVector<WebString>& labels, + const WebVector<int>& uniqueIDs, + int separatorIndex); virtual void applyAutoFillSuggestions( const WebNode&, const WebVector<WebString>& names, const WebVector<WebString>& labels, - int defaultSuggestionIndex); + const WebVector<WebString>& icons, + const WebVector<int>& uniqueIDs, + int separatorIndex); + // DEPRECATED: replacing with applyAutoFillSuggestions. virtual void applyAutocompleteSuggestions( const WebNode&, const WebVector<WebString>& suggestions, int defaultSuggestionIndex); - virtual void hideAutofillPopup(); - virtual void hideSuggestionsPopup(); + virtual void hidePopups(); virtual void setScrollbarColors(unsigned inactiveColor, unsigned activeColor, unsigned trackColor); @@ -175,9 +195,6 @@ public: unsigned inactiveBackgroundColor, unsigned inactiveForegroundColor); virtual void performCustomContextMenuAction(unsigned action); - virtual void addUserScript(const WebString& sourceCode, - bool runAtStart); - virtual void removeAllUserContent(); // WebViewImpl @@ -201,7 +218,7 @@ public: return m_client; } - // Returns the page object associated with this view. This may be null when + // Returns the page object associated with this view. This may be null when // the page is shutting down, but will be valid at all other times. WebCore::Page* page() const { @@ -210,7 +227,7 @@ public: WebCore::RenderTheme* theme() const; - // Returns the main frame associated with this view. This may be null when + // Returns the main frame associated with this view. This may be null when // the page is shutting down, but will be valid at all other times. WebFrameImpl* mainFrameImpl(); @@ -226,19 +243,20 @@ public: void mouseUp(const WebMouseEvent&); void mouseContextMenu(const WebMouseEvent&); void mouseDoubleClick(const WebMouseEvent&); - void mouseWheel(const WebMouseWheelEvent&); + bool mouseWheel(const WebMouseWheelEvent&); bool keyEvent(const WebKeyboardEvent&); bool charEvent(const WebKeyboardEvent&); + bool touchEvent(const WebTouchEvent&); // Handles context menu events orignated via the the keyboard. These - // include the VK_APPS virtual key and the Shift+F10 combine. Code is + // include the VK_APPS virtual key and the Shift+F10 combine. Code is // based on the Webkit function bool WebView::handleContextMenuEvent(WPARAM // wParam, LPARAM lParam) in webkit\webkit\win\WebView.cpp. The only // significant change in this function is the code to convert from a // Keyboard event to the Right Mouse button down event. bool sendContextMenuEvent(const WebKeyboardEvent&); - // Notifies the WebView that a load has been committed. isNewNavigation + // Notifies the WebView that a load has been committed. isNewNavigation // will be true if a new session history item should be created for that // load. void didCommitLoad(bool* isNewNavigation); @@ -270,13 +288,14 @@ public: // Start a system drag and drop operation. void startDragging( - const WebPoint& eventPos, const WebDragData& dragData, - WebDragOperationsMask dragSourceOperationMask); + WebDragOperationsMask mask, + const WebImage& dragImage, + const WebPoint& dragImageOffset); - void suggestionsPopupDidHide() + void autoFillPopupDidHide() { - m_suggestionsPopupShowing = false; + m_autoFillPopupShowing = false; } #if ENABLE(NOTIFICATIONS) @@ -288,6 +307,12 @@ public: // was scrolled. bool propagateScroll(WebCore::ScrollDirection, WebCore::ScrollGranularity); + // Notification that a popup was opened/closed. + void popupOpened(WebCore::PopupContainer* popupContainer); + void popupClosed(WebCore::PopupContainer* popupContainer); + + void hideAutoFillPopup(); + // HACK: currentInputEvent() is for ChromeClientImpl::show(), until we can // fix WebKit to pass enough information up into ChromeClient::show() so we // can decide if the window.open event was caused by a middle-mouse click @@ -296,31 +321,73 @@ public: return m_currentInputEvent; } +#if USE(ACCELERATED_COMPOSITING) + void setRootLayerNeedsDisplay(); + void setRootGraphicsLayer(WebCore::PlatformLayer*); +#endif + // Onscreen contexts display to the screen associated with this view. + // Offscreen contexts render offscreen but can share resources with the + // onscreen context and thus can be composited. + PassOwnPtr<WebCore::GLES2Context> getOnscreenGLES2Context(); + PassOwnPtr<WebCore::GLES2Context> getOffscreenGLES2Context(); + + // Returns an onscreen context + virtual WebGLES2Context* gles2Context(); + + WebCore::PopupContainer* selectPopup() const { return m_selectPopup.get(); } + + // Returns true if the event leads to scrolling. + static bool mapKeyCodeForScroll(int keyCode, + WebCore::ScrollDirection* scrollDirection, + WebCore::ScrollGranularity* scrollGranularity); + private: friend class WebView; // So WebView::Create can call our constructor friend class WTF::RefCounted<WebViewImpl>; - WebViewImpl(WebViewClient* client); + enum DragAction { + DragEnter, + DragOver + }; + + WebViewImpl(WebViewClient* client, WebDevToolsAgentClient* devToolsClient); ~WebViewImpl(); // Returns true if the event was actually processed. bool keyEventDefault(const WebKeyboardEvent&); + // Returns true if the select popup has consumed the event. + bool selectPopupHandleKeyEvent(const WebKeyboardEvent&); + // Returns true if the autocomple has consumed the event. bool autocompleteHandleKeyEvent(const WebKeyboardEvent&); - // Repaints the suggestions popup. Should be called when the suggestions - // have changed. Note that this should only be called when the suggestions + // Repaints the AutoFill popup. Should be called when the suggestions + // have changed. Note that this should only be called when the AutoFill // popup is showing. - void refreshSuggestionsPopup(); + void refreshAutoFillPopup(); // Returns true if the view was scrolled. bool scrollViewWithKeyboard(int keyCode, int modifiers); + void hideSelectPopup(); + // Converts |pos| from window coordinates to contents coordinates and gets // the HitTestResult for it. WebCore::HitTestResult hitTestResultForWindowPos(const WebCore::IntPoint&); + // Consolidate some common code between starting a drag over a target and + // updating a drag over a target. If we're starting a drag, |isEntering| + // should be true. + WebDragOperation dragTargetDragEnterOrOver(const WebPoint& clientPoint, + const WebPoint& screenPoint, + DragAction); + +#if USE(ACCELERATED_COMPOSITING) + void setIsAcceleratedCompositingActive(bool); + void updateRootLayerContents(const WebRect&); +#endif + WebViewClient* m_client; BackForwardListClientImpl m_backForwardListClientImpl; @@ -335,7 +402,7 @@ private: WebPoint m_lastMousePosition; OwnPtr<WebCore::Page> m_page; - // This flag is set when a new navigation is detected. It is used to satisfy + // This flag is set when a new navigation is detected. It is used to satisfy // the corresponding argument to WebFrameClient::didCommitProvisionalLoad. bool m_observedNewNavigation; #ifndef NDEBUG @@ -345,7 +412,7 @@ private: #endif // An object that can be used to manipulate m_page->settings() without linking - // against WebCore. This is lazily allocated the first time GetWebSettings() + // against WebCore. This is lazily allocated the first time GetWebSettings() // is called. OwnPtr<WebSettingsImpl> m_webSettings; @@ -361,7 +428,7 @@ private: // dragged by the time a drag is initiated. WebPoint m_lastMouseDownPoint; - // Keeps track of the current zoom level. 0 means no zoom, positive numbers + // Keeps track of the current zoom level. 0 means no zoom, positive numbers // mean zoom in, negative numbers mean zoom out. int m_zoomLevel; @@ -391,7 +458,7 @@ private: // copied from the WebDropData object sent from the browser process. int m_dragIdentity; - // Valid when m_dragTargetDispatch is true. Used to override the default + // Valid when m_dragTargetDispatch is true. Used to override the default // browser drop effect with the effects "none" or "copy". enum DragTargetDropEffect { DropEffectDefault = -1, @@ -407,28 +474,17 @@ private: // current drop target in this WebView (the drop target can accept the drop). WebDragOperation m_dragOperation; - // Whether a suggestions popup is currently showing. - bool m_suggestionsPopupShowing; - - // A pointer to the current suggestions popup menu client. This can be - // either an AutoFillPopupMenuClient or an AutocompletePopupMenuClient. We - // do not own this pointer. - SuggestionsPopupMenuClient* m_suggestionsPopupClient; + // Whether an AutoFill popup is currently showing. + bool m_autoFillPopupShowing; // The AutoFill popup client. OwnPtr<AutoFillPopupMenuClient> m_autoFillPopupClient; - // The Autocomplete popup client. - OwnPtr<AutocompletePopupMenuClient> m_autocompletePopupClient; - - // A pointer to the current suggestions popup. We do not own this pointer. - WebCore::PopupContainer* m_suggestionsPopup; - - // The AutoFill suggestions popup. + // The AutoFill popup. RefPtr<WebCore::PopupContainer> m_autoFillPopup; - // The AutoComplete suggestions popup. - RefPtr<WebCore::PopupContainer> m_autocompletePopup; + // The popup associated with a select element. + RefPtr<WebCore::PopupContainer> m_selectPopup; OwnPtr<WebDevToolsAgentPrivate> m_devToolsAgent; @@ -441,12 +497,31 @@ private: // Inspector settings. WebString m_inspectorSettings; + typedef HashMap<WTF::String, WTF::String> SettingsMap; + OwnPtr<SettingsMap> m_inspectorSettingsMap; + OwnPtr<DragScrollTimer> m_dragScrollTimer; + #if ENABLE(NOTIFICATIONS) // The provider of desktop notifications; NotificationPresenterImpl m_notificationPresenter; #endif + // If set, the (plugin) node which has mouse capture. + RefPtr<WebCore::Node> m_mouseCaptureNode; + +#if USE(ACCELERATED_COMPOSITING) + OwnPtr<WebCore::LayerRendererChromium> m_layerRenderer; + bool m_isAcceleratedCompositingActive; +#endif static const WebInputEvent* m_currentInputEvent; + +#if ENABLE(INPUT_SPEECH) + SpeechInputClientImpl m_speechInputClient; +#endif + + OwnPtr<WebGLES2Context> m_gles2Context; + + OwnPtr<DeviceOrientationClientProxy> m_deviceOrientationClientProxy; }; } // namespace WebKit diff --git a/WebKit/chromium/src/WebWorkerBase.cpp b/WebKit/chromium/src/WebWorkerBase.cpp index 40019e8..42f41d2 100644 --- a/WebKit/chromium/src/WebWorkerBase.cpp +++ b/WebKit/chromium/src/WebWorkerBase.cpp @@ -31,7 +31,8 @@ #include "config.h" #include "WebWorkerBase.h" -#include "GenericWorkerTask.h" +#include "CrossThreadTask.h" +#include "DatabaseTask.h" #include "MessagePortChannel.h" #include "PlatformMessagePortChannel.h" @@ -39,9 +40,12 @@ #include "WebFrameClient.h" #include "WebFrameImpl.h" #include "WebMessagePortChannel.h" +#include "WebRuntimeFeatures.h" +#include "WebSettings.h" #include "WebView.h" #include "WebWorkerClient.h" +#include "WorkerScriptController.h" #include "WorkerThread.h" #include <wtf/MainThread.h> @@ -51,29 +55,66 @@ namespace WebKit { #if ENABLE(WORKERS) -// Dummy WebViewDelegate - we only need it in Worker process to load a -// 'shadow page' which will initialize WebCore loader. -class WorkerWebFrameClient : public WebFrameClient { +static const char allowDatabaseMode[] = "allowDatabaseMode"; + +namespace { + +// This class is used to route the result of the WebWorkerBase::allowDatabase +// call back to the worker context. +class AllowDatabaseMainThreadBridge : public ThreadSafeShared<AllowDatabaseMainThreadBridge> { public: - // Tell the loader to load the data into the 'shadow page' synchronously, - // so we can grab the resulting Document right after load. - virtual void didCreateDataSource(WebFrame* frame, WebDataSource* ds) + static PassRefPtr<AllowDatabaseMainThreadBridge> create(WebWorkerBase* worker, const WTF::String& mode, WebCommonWorkerClient* commonClient, WebFrame* frame, const WTF::String& name, const WTF::String& displayName, unsigned long estimatedSize) + { + return adoptRef(new AllowDatabaseMainThreadBridge(worker, mode, commonClient, frame, name, displayName, estimatedSize)); + } + + // These methods are invoked on the worker context. + void cancel() + { + MutexLocker locker(m_mutex); + m_worker = 0; + } + + bool result() { - static_cast<WebDataSourceImpl*>(ds)->setDeferMainResourceDataLoad(false); + return m_result; } - // Lazy allocate and leak this instance. - static WorkerWebFrameClient* sharedInstance() + // This method is invoked on the main thread. + void signalCompleted(bool result) { - static WorkerWebFrameClient client; - return &client; + MutexLocker locker(m_mutex); + if (m_worker) + m_worker->postTaskForModeToWorkerContext(createCallbackTask(&didComplete, this, result), m_mode); } private: - WorkerWebFrameClient() + AllowDatabaseMainThreadBridge(WebWorkerBase* worker, const WTF::String& mode, WebCommonWorkerClient* commonClient, WebFrame* frame, const WTF::String& name, const WTF::String& displayName, unsigned long estimatedSize) + : m_worker(worker) + , m_mode(mode) { + worker->dispatchTaskToMainThread(createCallbackTask(&allowDatabaseTask, commonClient, frame, String(name), String(displayName), estimatedSize, this)); } + + static void allowDatabaseTask(WebCore::ScriptExecutionContext* context, WebCommonWorkerClient* commonClient, WebFrame* frame, const WTF::String name, const WTF::String displayName, unsigned long estimatedSize, PassRefPtr<AllowDatabaseMainThreadBridge> bridge) + { + if (!commonClient) + bridge->signalCompleted(false); + else + bridge->signalCompleted(commonClient->allowDatabase(frame, name, displayName, estimatedSize)); + } + + static void didComplete(WebCore::ScriptExecutionContext* context, PassRefPtr<AllowDatabaseMainThreadBridge> bridge, bool result) + { + bridge->m_result = result; + } + + bool m_result; + Mutex m_mutex; + WebWorkerBase* m_worker; + WTF::String m_mode; }; +} // This function is called on the main thread to force to initialize some static // values used in WebKit before any worker thread is started. This is because in @@ -103,6 +144,9 @@ WebWorkerBase::WebWorkerBase() WebWorkerBase::~WebWorkerBase() { ASSERT(m_webView); + WebFrameImpl* webFrame = static_cast<WebFrameImpl*>(m_webView->mainFrame()); + if (webFrame) + webFrame->setClient(0); m_webView->close(); } @@ -121,8 +165,9 @@ void WebWorkerBase::initializeLoader(const WebURL& url) // loading requests from the worker context to the rest of WebKit and Chromium // infrastructure. ASSERT(!m_webView); - m_webView = WebView::create(0); - m_webView->initializeMainFrame(WorkerWebFrameClient::sharedInstance()); + m_webView = WebView::create(0, 0); + m_webView->settings()->setOfflineWebApplicationCacheEnabled(WebRuntimeFeatures::isApplicationCacheEnabled()); + m_webView->initializeMainFrame(this); WebFrameImpl* webFrame = static_cast<WebFrameImpl*>(m_webView->mainFrame()); @@ -140,7 +185,7 @@ void WebWorkerBase::initializeLoader(const WebURL& url) void WebWorkerBase::dispatchTaskToMainThread(PassOwnPtr<ScriptExecutionContext::Task> task) { - return callOnMainThread(invokeTaskMethod, task.release()); + callOnMainThread(invokeTaskMethod, task.leakPtr()); } void WebWorkerBase::invokeTaskMethod(void* param) @@ -151,6 +196,41 @@ void WebWorkerBase::invokeTaskMethod(void* param) delete task; } +void WebWorkerBase::didCreateDataSource(WebFrame*, WebDataSource* ds) +{ + // Tell the loader to load the data into the 'shadow page' synchronously, + // so we can grab the resulting Document right after load. + static_cast<WebDataSourceImpl*>(ds)->setDeferMainResourceDataLoad(false); +} + +WebApplicationCacheHost* WebWorkerBase::createApplicationCacheHost(WebFrame*, WebApplicationCacheHostClient* appcacheHostClient) +{ + if (commonClient()) + return commonClient()->createApplicationCacheHost(appcacheHostClient); + return 0; +} + +bool WebWorkerBase::allowDatabase(WebFrame*, const WebString& name, const WebString& displayName, unsigned long estimatedSize) +{ + WorkerRunLoop& runLoop = m_workerThread->runLoop(); + WorkerScriptController* controller = WorkerScriptController::controllerForContext(); + WorkerContext* workerContext = controller->workerContext(); + + // Create a unique mode just for this synchronous call. + String mode = allowDatabaseMode; + mode.append(String::number(runLoop.createUniqueId())); + + RefPtr<AllowDatabaseMainThreadBridge> bridge = AllowDatabaseMainThreadBridge::create(this, mode, commonClient(), m_webView->mainFrame(), String(name), String(displayName), estimatedSize); + + // Either the bridge returns, or the queue gets terminated. + if (runLoop.runInMode(workerContext, mode) == MessageQueueTerminated) { + bridge->cancel(); + return false; + } + + return bridge->result(); +} + // WorkerObjectProxy ----------------------------------------------------------- void WebWorkerBase::postMessageToWorkerObject(PassRefPtr<SerializedScriptValue> message, @@ -199,8 +279,7 @@ void WebWorkerBase::postExceptionTask(ScriptExecutionContext* context, sourceURL); } -void WebWorkerBase::postConsoleMessageToWorkerObject(MessageDestination destination, - MessageSource source, +void WebWorkerBase::postConsoleMessageToWorkerObject(MessageSource source, MessageType type, MessageLevel level, const String& message, @@ -208,16 +287,13 @@ void WebWorkerBase::postConsoleMessageToWorkerObject(MessageDestination destinat const String& sourceURL) { dispatchTaskToMainThread(createCallbackTask(&postConsoleMessageTask, this, - static_cast<int>(destination), - static_cast<int>(source), - static_cast<int>(type), - static_cast<int>(level), + source, type, level, message, lineNumber, sourceURL)); } void WebWorkerBase::postConsoleMessageTask(ScriptExecutionContext* context, WebWorkerBase* thisPtr, - int destination, int source, + int source, int type, int level, const String& message, int lineNumber, @@ -225,7 +301,7 @@ void WebWorkerBase::postConsoleMessageTask(ScriptExecutionContext* context, { if (!thisPtr->commonClient()) return; - thisPtr->commonClient()->postConsoleMessageToWorkerObject(destination, source, + thisPtr->commonClient()->postConsoleMessageToWorkerObject(source, type, level, message, lineNumber, sourceURL); } diff --git a/WebKit/chromium/src/WebWorkerBase.h b/WebKit/chromium/src/WebWorkerBase.h index 0217401..22711f9 100644 --- a/WebKit/chromium/src/WebWorkerBase.h +++ b/WebKit/chromium/src/WebWorkerBase.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Google Inc. All rights reserved. + * 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 @@ -34,6 +34,7 @@ #if ENABLE(WORKERS) #include "ScriptExecutionContext.h" +#include "WebFrameClient.h" #include "WorkerLoaderProxy.h" #include "WorkerObjectProxy.h" #include <wtf/PassOwnPtr.h> @@ -44,16 +45,22 @@ class WorkerThread; } namespace WebKit { +class WebApplicationCacheHost; +class WebApplicationCacheHostClient; class WebCommonWorkerClient; +class WebSecurityOrigin; +class WebString; class WebURL; class WebView; +class WebWorker; class WebWorkerClient; // Base class for WebSharedWorkerImpl and WebWorkerImpl. It contains common // code used by both implementation classes, including implementations of the // WorkerObjectProxy and WorkerLoaderProxy interfaces. class WebWorkerBase : public WebCore::WorkerObjectProxy - , public WebCore::WorkerLoaderProxy { + , public WebCore::WorkerLoaderProxy + , public WebFrameClient { public: WebWorkerBase(); virtual ~WebWorkerBase(); @@ -63,10 +70,10 @@ public: PassRefPtr<WebCore::SerializedScriptValue>, PassOwnPtr<WebCore::MessagePortChannelArray>); virtual void postExceptionToWorkerObject( - const WebCore::String&, int, const WebCore::String&); + const WTF::String&, int, const WTF::String&); virtual void postConsoleMessageToWorkerObject( - WebCore::MessageDestination, WebCore::MessageSource, WebCore::MessageType, - WebCore::MessageLevel, const WebCore::String&, int, const WebCore::String&); + WebCore::MessageSource, WebCore::MessageType, + WebCore::MessageLevel, const WTF::String&, int, const WTF::String&); virtual void confirmMessageFromWorkerObject(bool); virtual void reportPendingActivity(bool); virtual void workerContextClosed(); @@ -75,7 +82,14 @@ public: // WebCore::WorkerLoaderProxy methods: virtual void postTaskToLoader(PassOwnPtr<WebCore::ScriptExecutionContext::Task>); virtual void postTaskForModeToWorkerContext( - PassOwnPtr<WebCore::ScriptExecutionContext::Task>, const WebCore::String& mode); + PassOwnPtr<WebCore::ScriptExecutionContext::Task>, const WTF::String& mode); + + // WebFrameClient methods to support resource loading thru the 'shadow page'. + virtual void didCreateDataSource(WebFrame*, WebDataSource*); + virtual WebApplicationCacheHost* createApplicationCacheHost(WebFrame*, WebApplicationCacheHostClient*); + + // Controls whether access to Web Databases is allowed for this worker. + virtual bool allowDatabase(WebFrame*, const WebString& name, const WebString& displayName, unsigned long estimatedSize); // Executes the given task on the main thread. static void dispatchTaskToMainThread(PassOwnPtr<WebCore::ScriptExecutionContext::Task>); @@ -101,24 +115,23 @@ private: static void postMessageTask( WebCore::ScriptExecutionContext* context, WebWorkerBase* thisPtr, - WebCore::String message, + WTF::String message, PassOwnPtr<WebCore::MessagePortChannelArray> channels); static void postExceptionTask( WebCore::ScriptExecutionContext* context, WebWorkerBase* thisPtr, - const WebCore::String& message, + const WTF::String& message, int lineNumber, - const WebCore::String& sourceURL); + const WTF::String& sourceURL); static void postConsoleMessageTask( WebCore::ScriptExecutionContext* context, WebWorkerBase* thisPtr, - int destination, int source, int type, int level, - const WebCore::String& message, + const WTF::String& message, int lineNumber, - const WebCore::String& sourceURL); + const WTF::String& sourceURL); static void confirmMessageTask( WebCore::ScriptExecutionContext* context, WebWorkerBase* thisPtr, diff --git a/WebKit/chromium/src/WebWorkerClientImpl.cpp b/WebKit/chromium/src/WebWorkerClientImpl.cpp index 598a078..18282e3 100644 --- a/WebKit/chromium/src/WebWorkerClientImpl.cpp +++ b/WebKit/chromium/src/WebWorkerClientImpl.cpp @@ -33,11 +33,11 @@ #if ENABLE(WORKERS) +#include "CrossThreadTask.h" #include "DedicatedWorkerThread.h" #include "ErrorEvent.h" #include "Frame.h" #include "FrameLoaderClient.h" -#include "GenericWorkerTask.h" #include "MessageEvent.h" #include "MessagePort.h" #include "MessagePortChannel.h" @@ -45,6 +45,7 @@ #include "Worker.h" #include "WorkerContext.h" #include "WorkerContextExecutionProxy.h" +#include "WorkerScriptController.h" #include "WorkerMessagingProxy.h" #include <wtf/Threading.h> @@ -94,15 +95,13 @@ WorkerContextProxy* WebWorkerClientImpl::createWorkerContextProxy(Worker* worker WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame()); webWorker = webFrame->client()->createWorker(webFrame, proxy); } else { - WorkerContextExecutionProxy* currentContext = - WorkerContextExecutionProxy::retrieve(); - if (!currentContext) { + WorkerScriptController* controller = WorkerScriptController::controllerForContext(); + if (!controller) { ASSERT_NOT_REACHED(); return 0; } - DedicatedWorkerThread* thread = - static_cast<DedicatedWorkerThread*>(currentContext->workerContext()->thread()); + DedicatedWorkerThread* thread = static_cast<DedicatedWorkerThread*>(controller->workerContext()->thread()); WorkerObjectProxy* workerObjectProxy = &thread->workerObjectProxy(); WebWorkerImpl* impl = reinterpret_cast<WebWorkerImpl*>(workerObjectProxy); webWorker = impl->client()->createWorker(proxy); @@ -244,15 +243,14 @@ void WebWorkerClientImpl::postExceptionToWorkerObject(const WebString& errorMess return; } - bool handled = false; - handled = m_worker->dispatchEvent(ErrorEvent::create(errorMessage, - sourceURL, - lineNumber)); - if (!handled) + bool unhandled = m_worker->dispatchEvent(ErrorEvent::create(errorMessage, + sourceURL, + lineNumber)); + if (unhandled) m_scriptExecutionContext->reportException(errorMessage, lineNumber, sourceURL); } -void WebWorkerClientImpl::postConsoleMessageToWorkerObject(int destinationId, +void WebWorkerClientImpl::postConsoleMessageToWorkerObject(int destination, int sourceId, int messageType, int messageLevel, @@ -263,7 +261,6 @@ void WebWorkerClientImpl::postConsoleMessageToWorkerObject(int destinationId, if (currentThread() != m_workerThreadId) { m_scriptExecutionContext->postTask(createCallbackTask(&postConsoleMessageToWorkerObjectTask, this, - destinationId, sourceId, messageType, messageLevel, @@ -273,14 +270,23 @@ void WebWorkerClientImpl::postConsoleMessageToWorkerObject(int destinationId, return; } - m_scriptExecutionContext->addMessage(static_cast<MessageDestination>(destinationId), - static_cast<MessageSource>(sourceId), + m_scriptExecutionContext->addMessage(static_cast<MessageSource>(sourceId), static_cast<MessageType>(messageType), static_cast<MessageLevel>(messageLevel), String(message), lineNumber, String(sourceURL)); } +void WebWorkerClientImpl::postConsoleMessageToWorkerObject(int sourceId, + int messageType, + int messageLevel, + const WebString& message, + int lineNumber, + const WebString& sourceURL) +{ + postConsoleMessageToWorkerObject(0, sourceId, messageType, messageLevel, message, lineNumber, sourceURL); +} + void WebWorkerClientImpl::confirmMessageFromWorkerObject(bool hasPendingActivity) { // unconfirmed_message_count_ can only be updated on the thread where it's @@ -354,7 +360,7 @@ void WebWorkerClientImpl::postMessageToWorkerObjectTask( if (thisPtr->m_worker) { OwnPtr<MessagePortArray> ports = - MessagePort::entanglePorts(*context, channels.release()); + MessagePort::entanglePorts(*context, channels); RefPtr<SerializedScriptValue> serializedMessage = SerializedScriptValue::createFromWire(message); thisPtr->m_worker->dispatchEvent(MessageEvent::create(ports.release(), @@ -382,7 +388,6 @@ void WebWorkerClientImpl::postExceptionToWorkerObjectTask( void WebWorkerClientImpl::postConsoleMessageToWorkerObjectTask(ScriptExecutionContext* context, WebWorkerClientImpl* thisPtr, - int destinationId, int sourceId, int messageType, int messageLevel, @@ -390,8 +395,7 @@ void WebWorkerClientImpl::postConsoleMessageToWorkerObjectTask(ScriptExecutionCo int lineNumber, const String& sourceURL) { - thisPtr->m_scriptExecutionContext->addMessage(static_cast<MessageDestination>(destinationId), - static_cast<MessageSource>(sourceId), + thisPtr->m_scriptExecutionContext->addMessage(static_cast<MessageSource>(sourceId), static_cast<MessageType>(messageType), static_cast<MessageLevel>(messageLevel), message, lineNumber, diff --git a/WebKit/chromium/src/WebWorkerClientImpl.h b/WebKit/chromium/src/WebWorkerClientImpl.h index 63acebc..741d606 100644 --- a/WebKit/chromium/src/WebWorkerClientImpl.h +++ b/WebKit/chromium/src/WebWorkerClientImpl.h @@ -33,8 +33,7 @@ #if ENABLE(WORKERS) -// FIXME: fix to just "WebWorkerClient.h" once nobody in glue depends on us. -#include "../public/WebWorkerClient.h" +#include "WebWorkerClient.h" #include "WorkerContextProxy.h" #include <wtf/PassOwnPtr.h> @@ -65,8 +64,8 @@ public: // process, this will be the main WebKit thread. In the worker process, this // will be the thread of the executing worker (not the main WebKit thread). virtual void startWorkerContext(const WebCore::KURL&, - const WebCore::String&, - const WebCore::String&); + const WTF::String&, + const WTF::String&); virtual void terminateWorkerContext(); virtual void postMessageToWorkerContext( PassRefPtr<WebCore::SerializedScriptValue> message, @@ -78,8 +77,12 @@ public: // These are called on the main WebKit thread. virtual void postMessageToWorkerObject(const WebString&, const WebMessagePortChannelArray&); virtual void postExceptionToWorkerObject(const WebString&, int, const WebString&); - virtual void postConsoleMessageToWorkerObject(int, int, int, int, const WebString&, - int, const WebString&); + + // FIXME: the below is for compatibility only and should be + // removed once Chromium is updated to remove message + // destination parameter <http://webkit.org/b/37155>. + virtual void postConsoleMessageToWorkerObject(int, int, int, int, const WebString&, int, const WebString&); + virtual void postConsoleMessageToWorkerObject(int, int, int, const WebString&, int, const WebString&); virtual void confirmMessageFromWorkerObject(bool); virtual void reportPendingActivity(bool); virtual void workerContextClosed(); @@ -90,6 +93,12 @@ public: // FIXME: Notifications not yet supported in workers. return 0; } + virtual WebApplicationCacheHost* createApplicationCacheHost(WebApplicationCacheHostClient*) { return 0; } + virtual bool allowDatabase(WebFrame*, const WebString& name, const WebString& displayName, unsigned long estimatedSize) + { + ASSERT_NOT_REACHED(); + return true; + } private: virtual ~WebWorkerClientImpl(); @@ -99,14 +108,14 @@ private: // These tasks are dispatched on the WebKit thread. static void startWorkerContextTask(WebCore::ScriptExecutionContext* context, WebWorkerClientImpl* thisPtr, - const WebCore::String& scriptURL, - const WebCore::String& userAgent, - const WebCore::String& sourceCode); + const WTF::String& scriptURL, + const WTF::String& userAgent, + const WTF::String& sourceCode); static void terminateWorkerContextTask(WebCore::ScriptExecutionContext* context, WebWorkerClientImpl* thisPtr); static void postMessageToWorkerContextTask(WebCore::ScriptExecutionContext* context, WebWorkerClientImpl* thisPtr, - const WebCore::String& message, + const WTF::String& message, PassOwnPtr<WebCore::MessagePortChannelArray> channels); static void workerObjectDestroyedTask(WebCore::ScriptExecutionContext* context, WebWorkerClientImpl* thisPtr); @@ -116,22 +125,21 @@ private: // worker process). static void postMessageToWorkerObjectTask(WebCore::ScriptExecutionContext* context, WebWorkerClientImpl* thisPtr, - const WebCore::String& message, + const WTF::String& message, PassOwnPtr<WebCore::MessagePortChannelArray> channels); static void postExceptionToWorkerObjectTask(WebCore::ScriptExecutionContext* context, WebWorkerClientImpl* thisPtr, - const WebCore::String& message, + const WTF::String& message, int lineNumber, - const WebCore::String& sourceURL); + const WTF::String& sourceURL); static void postConsoleMessageToWorkerObjectTask(WebCore::ScriptExecutionContext* context, WebWorkerClientImpl* thisPtr, - int destinationId, int sourceId, int messageType, int messageLevel, - const WebCore::String& message, + const WTF::String& message, int lineNumber, - const WebCore::String& sourceURL); + const WTF::String& sourceURL); static void confirmMessageFromWorkerObjectTask(WebCore::ScriptExecutionContext* context, WebWorkerClientImpl* thisPtr); static void reportPendingActivityTask(WebCore::ScriptExecutionContext* context, diff --git a/WebKit/chromium/src/WebWorkerImpl.cpp b/WebKit/chromium/src/WebWorkerImpl.cpp index 5b5e053..165af68 100644 --- a/WebKit/chromium/src/WebWorkerImpl.cpp +++ b/WebKit/chromium/src/WebWorkerImpl.cpp @@ -31,9 +31,9 @@ #include "config.h" #include "WebWorkerImpl.h" +#include "CrossThreadTask.h" #include "DedicatedWorkerContext.h" #include "DedicatedWorkerThread.h" -#include "GenericWorkerTask.h" #include "KURL.h" #include "MessageEvent.h" #include "MessagePort.h" @@ -86,7 +86,7 @@ void WebWorkerImpl::postMessageToWorkerContextTask(WebCore::ScriptExecutionConte static_cast<DedicatedWorkerContext*>(context); OwnPtr<MessagePortArray> ports = - MessagePort::entanglePorts(*context, channels.release()); + MessagePort::entanglePorts(*context, channels); RefPtr<SerializedScriptValue> serializedMessage = SerializedScriptValue::createFromWire(message); workerContext->dispatchEvent(MessageEvent::create( diff --git a/WebKit/chromium/src/WebWorkerImpl.h b/WebKit/chromium/src/WebWorkerImpl.h index bec96cd..d2fd016 100644 --- a/WebKit/chromium/src/WebWorkerImpl.h +++ b/WebKit/chromium/src/WebWorkerImpl.h @@ -69,7 +69,7 @@ private: static void postMessageToWorkerContextTask( WebCore::ScriptExecutionContext* context, WebWorkerImpl* thisPtr, - const WebCore::String& message, + const WTF::String& message, PassOwnPtr<WebCore::MessagePortChannelArray> channels); WebWorkerClient* m_client; diff --git a/WebKit/chromium/src/WrappedResourceRequest.h b/WebKit/chromium/src/WrappedResourceRequest.h index 97311db..3057387 100644 --- a/WebKit/chromium/src/WrappedResourceRequest.h +++ b/WebKit/chromium/src/WrappedResourceRequest.h @@ -31,9 +31,7 @@ #ifndef WrappedResourceRequest_h #define WrappedResourceRequest_h -// FIXME: This relative path is a temporary hack to support using this -// header from webkit/glue. -#include "../public/WebURLRequest.h" +#include "WebURLRequest.h" #include "WebURLRequestPrivate.h" namespace WebKit { diff --git a/WebKit/chromium/src/WrappedResourceResponse.h b/WebKit/chromium/src/WrappedResourceResponse.h index af4f88f..927582d 100644 --- a/WebKit/chromium/src/WrappedResourceResponse.h +++ b/WebKit/chromium/src/WrappedResourceResponse.h @@ -31,9 +31,7 @@ #ifndef WrappedResourceResponse_h #define WrappedResourceResponse_h -// FIXME: This relative path is a temporary hack to support using this -// header from webkit/glue. -#include "../public/WebURLResponse.h" +#include "WebURLResponse.h" #include "WebURLResponsePrivate.h" namespace WebKit { diff --git a/WebKit/chromium/src/gtk/WebFontInfo.cpp b/WebKit/chromium/src/gtk/WebFontInfo.cpp index 76ed618..dd25eb1 100644 --- a/WebKit/chromium/src/gtk/WebFontInfo.cpp +++ b/WebKit/chromium/src/gtk/WebFontInfo.cpp @@ -30,6 +30,7 @@ #include "config.h" #include "WebFontInfo.h" +#include "WebFontRenderStyle.h" #include <fontconfig/fontconfig.h> #include <string.h> @@ -55,11 +56,11 @@ WebCString WebFontInfo::familyForChars(const WebUChar* characters, size_t numCha FcValue fcvalue; fcvalue.type = FcTypeCharSet; fcvalue.u.c = cset; - FcPatternAdd(pattern, FC_CHARSET, fcvalue, 0); + FcPatternAdd(pattern, FC_CHARSET, fcvalue, FcFalse); fcvalue.type = FcTypeBool; fcvalue.u.b = FcTrue; - FcPatternAdd(pattern, FC_SCALABLE, fcvalue, 0); + FcPatternAdd(pattern, FC_SCALABLE, fcvalue, FcFalse); FcConfigSubstitute(0, pattern, FcMatchPattern); FcDefaultSubstitute(pattern); @@ -104,4 +105,85 @@ WebCString WebFontInfo::familyForChars(const WebUChar* characters, size_t numCha return WebCString(); } +void WebFontInfo::renderStyleForStrike(const char* family, int sizeAndStyle, WebFontRenderStyle* out) +{ + bool isBold = sizeAndStyle & 1; + bool isItalic = sizeAndStyle & 2; + int pixelSize = sizeAndStyle >> 2; + + FcPattern* pattern = FcPatternCreate(); + FcValue fcvalue; + + fcvalue.type = FcTypeString; + fcvalue.u.s = reinterpret_cast<const FcChar8 *>(family); + FcPatternAdd(pattern, FC_FAMILY, fcvalue, FcFalse); + + fcvalue.type = FcTypeInteger; + fcvalue.u.i = isBold ? FC_WEIGHT_BOLD : FC_WEIGHT_NORMAL; + FcPatternAdd(pattern, FC_WEIGHT, fcvalue, FcFalse); + + fcvalue.type = FcTypeInteger; + fcvalue.u.i = isItalic ? FC_SLANT_ITALIC : FC_SLANT_ROMAN; + FcPatternAdd(pattern, FC_SLANT, fcvalue, FcFalse); + + fcvalue.type = FcTypeBool; + fcvalue.u.b = FcTrue; + FcPatternAdd(pattern, FC_SCALABLE, fcvalue, FcFalse); + + fcvalue.type = FcTypeDouble; + fcvalue.u.d = pixelSize; + FcPatternAdd(pattern, FC_SIZE, fcvalue, FcFalse); + + FcConfigSubstitute(0, pattern, FcMatchPattern); + FcDefaultSubstitute(pattern); + + FcResult result; + // Some versions of fontconfig don't actually write a value into result. + // However, it's not clear from the documentation if result should be a + // non-0 pointer: future versions might expect to be able to write to + // it. So we pass in a valid pointer and ignore it. + FcPattern* match = FcFontMatch(0, pattern, &result); + FcPatternDestroy(pattern); + + out->setDefaults(); + + if (!match) { + FcPatternDestroy(match); + return; + } + + FcBool b; + int i; + + if (FcPatternGetBool(match, FC_ANTIALIAS, 0, &b) == FcResultMatch) + out->useAntiAlias = b; + if (FcPatternGetBool(match, FC_EMBEDDED_BITMAP, 0, &b) == FcResultMatch) + out->useBitmaps = b; + if (FcPatternGetBool(match, FC_AUTOHINT, 0, &b) == FcResultMatch) + out->useAutoHint = b; + if (FcPatternGetBool(match, FC_HINTING, 0, &b) == FcResultMatch) + out->useHinting = b; + if (FcPatternGetInteger(match, FC_HINT_STYLE, 0, &i) == FcResultMatch) + out->hintStyle = i; + if (FcPatternGetInteger(match, FC_RGBA, 0, &i) == FcResultMatch) { + switch (i) { + case FC_RGBA_NONE: + out->useSubpixel = 0; + break; + case FC_RGBA_RGB: + case FC_RGBA_BGR: + case FC_RGBA_VRGB: + case FC_RGBA_VBGR: + out->useSubpixel = 1; + break; + default: + // This includes FC_RGBA_UNKNOWN. + out->useSubpixel = 2; + break; + } + } + + FcPatternDestroy(match); +} + } // namespace WebKit diff --git a/WebKit/chromium/src/gtk/WebInputEventFactory.cpp b/WebKit/chromium/src/gtk/WebInputEventFactory.cpp index 7125a16..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, 0); - 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 @@ -151,6 +154,60 @@ static int gdkEventToWindowsKeyCode(const GdkEventKey* event) GDK_period, // 0x3C: GDK_period GDK_slash, // 0x3D: GDK_slash 0, // 0x3E: GDK_Shift_R + 0, // 0x3F: + 0, // 0x40: + 0, // 0x41: + 0, // 0x42: + 0, // 0x43: + 0, // 0x44: + 0, // 0x45: + 0, // 0x46: + 0, // 0x47: + 0, // 0x48: + 0, // 0x49: + 0, // 0x4A: + 0, // 0x4B: + 0, // 0x4C: + 0, // 0x4D: + 0, // 0x4E: + 0, // 0x4F: + 0, // 0x50: + 0, // 0x51: + 0, // 0x52: + 0, // 0x53: + 0, // 0x54: + 0, // 0x55: + 0, // 0x56: + 0, // 0x57: + 0, // 0x58: + 0, // 0x59: + 0, // 0x5A: + 0, // 0x5B: + 0, // 0x5C: + 0, // 0x5D: + 0, // 0x5E: + 0, // 0x5F: + 0, // 0x60: + 0, // 0x61: + 0, // 0x62: + 0, // 0x63: + 0, // 0x64: + 0, // 0x65: + 0, // 0x66: + 0, // 0x67: + 0, // 0x68: + 0, // 0x69: + 0, // 0x6A: + 0, // 0x6B: + 0, // 0x6C: + 0, // 0x6D: + 0, // 0x6E: + 0, // 0x6F: + 0, // 0x70: + 0, // 0x71: + 0, // 0x72: + GDK_Super_L, // 0x73: GDK_Super_L + GDK_Super_R, // 0x74: GDK_Super_R }; // |windowsKeyCode| has to include a valid virtual-key code even when we @@ -350,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; @@ -360,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/DebuggerAgent.js b/WebKit/chromium/src/js/DebuggerAgent.js deleted file mode 100644 index 301620a..0000000 --- a/WebKit/chromium/src/js/DebuggerAgent.js +++ /dev/null @@ -1,1528 +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 Provides communication interface to remote v8 debugger. See - * protocol decription at http://code.google.com/p/v8/wiki/DebuggerProtocol - */ - -/** - * FIXME: change field naming style to use trailing underscore. - * @constructor - */ -devtools.DebuggerAgent = function() -{ - RemoteDebuggerAgent.debuggerOutput = this.handleDebuggerOutput_.bind(this); - RemoteDebuggerAgent.setContextId = this.setContextId_.bind(this); - - /** - * Id of the inspected page global context. It is used for filtering scripts. - * @type {number} - */ - this.contextId_ = null; - - /** - * Mapping from script id to script info. - * @type {Object} - */ - this.parsedScripts_ = null; - - /** - * Mapping from the request id to the devtools.BreakpointInfo for the - * breakpoints whose v8 ids are not set yet. These breakpoints are waiting for - * "setbreakpoint" responses to learn their ids in the v8 debugger. - * @see #handleSetBreakpointResponse_ - * @type {Object} - */ - this.requestNumberToBreakpointInfo_ = null; - - /** - * Information on current stack frames. - * @type {Array.<devtools.CallFrame>} - */ - this.callFrames_ = []; - - /** - * Whether to stop in the debugger on the exceptions. - * @type {boolean} - */ - this.pauseOnExceptions_ = false; - - /** - * Mapping: request sequence number->callback. - * @type {Object} - */ - this.requestSeqToCallback_ = null; - - /** - * Whether the scripts panel has been shown and initialilzed. - * @type {boolean} - */ - this.scriptsPanelInitialized_ = false; - - /** - * Whether the scripts list should be requested next time when context id is - * set. - * @type {boolean} - */ - this.requestScriptsWhenContextIdSet_ = false; - - /** - * Whether the agent is waiting for initial scripts response. - * @type {boolean} - */ - this.waitingForInitialScriptsResponse_ = false; - - /** - * If backtrace response is received when initial scripts response - * is not yet processed the backtrace handling will be postponed until - * after the scripts response processing. The handler bound to its arguments - * and this agent will be stored in this field then. - * @type {?function()} - */ - this.pendingBacktraceResponseHandler_ = null; - - /** - * Container of all breakpoints set using resource URL. These breakpoints - * survive page reload. Breakpoints set by script id(for scripts that don't - * have URLs) are stored in ScriptInfo objects. - * @type {Object} - */ - this.urlToBreakpoints_ = {}; - - - /** - * Exception message that is shown to user while on exception break. - * @type {WebInspector.ConsoleMessage} - */ - this.currentExceptionMessage_ = null; -}; - - -/** - * A copy of the scope types from v8/src/mirror-delay.js - * @enum {number} - */ -devtools.DebuggerAgent.ScopeType = { - Global: 0, - Local: 1, - With: 2, - Closure: 3, - Catch: 4 -}; - - -/** - * Resets debugger agent to its initial state. - */ -devtools.DebuggerAgent.prototype.reset = function() -{ - this.contextId_ = null; - // No need to request scripts since they all will be pushed in AfterCompile - // events. - this.requestScriptsWhenContextIdSet_ = false; - this.waitingForInitialScriptsResponse_ = false; - - this.parsedScripts_ = {}; - this.requestNumberToBreakpointInfo_ = {}; - this.callFrames_ = []; - this.requestSeqToCallback_ = {}; -}; - - -/** - * Initializes scripts UI. This method is called every time Scripts panel - * is shown. It will send request for context id if it's not set yet. - */ -devtools.DebuggerAgent.prototype.initUI = function() -{ - // Initialize scripts cache when Scripts panel is shown first time. - if (this.scriptsPanelInitialized_) - return; - this.scriptsPanelInitialized_ = true; - if (this.contextId_) { - // We already have context id. This means that we are here from the - // very beginning of the page load cycle and hence will get all scripts - // via after-compile events. No need to request scripts for this session. - // - // There can be a number of scripts from after-compile events that are - // pending addition into the UI. - for (var scriptId in this.parsedScripts_) { - var script = this.parsedScripts_[scriptId]; - WebInspector.parsedScriptSource(scriptId, script.getUrl(), undefined /* script source */, script.getLineOffset()); - } - return; - } - this.waitingForInitialScriptsResponse_ = true; - // Script list should be requested only when current context id is known. - RemoteDebuggerAgent.getContextId(); - this.requestScriptsWhenContextIdSet_ = true; -}; - - -/** - * Asynchronously requests the debugger for the script source. - * @param {number} scriptId Id of the script whose source should be resolved. - * @param {function(source:?string):void} callback Function that will be called - * when the source resolution is completed. "source" parameter will be null - * if the resolution fails. - */ -devtools.DebuggerAgent.prototype.resolveScriptSource = function(scriptId, callback) -{ - var script = this.parsedScripts_[scriptId]; - if (!script || script.isUnresolved()) { - callback(null); - return; - } - - var cmd = new devtools.DebugCommand("scripts", { - "ids": [scriptId], - "includeSource": true - }); - devtools.DebuggerAgent.sendCommand_(cmd); - // Force v8 execution so that it gets to processing the requested command. - RemoteDebuggerAgent.processDebugCommands(); - - this.requestSeqToCallback_[cmd.getSequenceNumber()] = function(msg) { - if (msg.isSuccess()) { - var scriptJson = msg.getBody()[0]; - if (scriptJson) - callback(scriptJson.source); - else - callback(null); - } else - callback(null); - }; -}; - - -/** - * Tells the v8 debugger to stop on as soon as possible. - */ -devtools.DebuggerAgent.prototype.pauseExecution = function() -{ - RemoteDebuggerCommandExecutor.DebuggerPauseScript(); -}; - - -/** - * @param {number} sourceId Id of the script fot the breakpoint. - * @param {number} line Number of the line for the breakpoint. - * @param {?string} condition The breakpoint condition. - */ -devtools.DebuggerAgent.prototype.addBreakpoint = function(sourceId, line, condition) -{ - var script = this.parsedScripts_[sourceId]; - if (!script) - return; - - line = devtools.DebuggerAgent.webkitToV8LineNumber_(line); - - var commandArguments; - if (script.getUrl()) { - var breakpoints = this.urlToBreakpoints_[script.getUrl()]; - if (breakpoints && breakpoints[line]) - return; - if (!breakpoints) { - breakpoints = {}; - this.urlToBreakpoints_[script.getUrl()] = breakpoints; - } - - var breakpointInfo = new devtools.BreakpointInfo(line); - breakpoints[line] = breakpointInfo; - - commandArguments = { - "groupId": this.contextId_, - "type": "script", - "target": script.getUrl(), - "line": line, - "condition": condition - }; - } else { - var breakpointInfo = script.getBreakpointInfo(line); - if (breakpointInfo) - return; - - breakpointInfo = new devtools.BreakpointInfo(line); - script.addBreakpointInfo(breakpointInfo); - - commandArguments = { - "groupId": this.contextId_, - "type": "scriptId", - "target": sourceId, - "line": line, - "condition": condition - }; - } - - var cmd = new devtools.DebugCommand("setbreakpoint", commandArguments); - - this.requestNumberToBreakpointInfo_[cmd.getSequenceNumber()] = breakpointInfo; - - devtools.DebuggerAgent.sendCommand_(cmd); - // Force v8 execution so that it gets to processing the requested command. - // It is necessary for being able to change a breakpoint just after it - // has been created (since we need an existing breakpoint id for that). - RemoteDebuggerAgent.processDebugCommands(); -}; - - -/** - * @param {number} sourceId Id of the script for the breakpoint. - * @param {number} line Number of the line for the breakpoint. - */ -devtools.DebuggerAgent.prototype.removeBreakpoint = function(sourceId, line) -{ - var script = this.parsedScripts_[sourceId]; - if (!script) - return; - - line = devtools.DebuggerAgent.webkitToV8LineNumber_(line); - - var breakpointInfo; - if (script.getUrl()) { - var breakpoints = this.urlToBreakpoints_[script.getUrl()]; - breakpointInfo = breakpoints[line]; - delete breakpoints[line]; - } else { - breakpointInfo = script.getBreakpointInfo(line); - if (breakpointInfo) - script.removeBreakpointInfo(breakpointInfo); - } - - if (!breakpointInfo) - return; - - breakpointInfo.markAsRemoved(); - - var id = breakpointInfo.getV8Id(); - - // If we don't know id of this breakpoint in the v8 debugger we cannot send - // "clearbreakpoint" request. In that case it will be removed in - // "setbreakpoint" response handler when we learn the id. - if (id !== -1) { - this.requestClearBreakpoint_(id); - } -}; - - -/** - * @param {number} sourceId Id of the script for the breakpoint. - * @param {number} line Number of the line for the breakpoint. - * @param {?string} condition New breakpoint condition. - */ -devtools.DebuggerAgent.prototype.updateBreakpoint = function(sourceId, line, condition) -{ - var script = this.parsedScripts_[sourceId]; - if (!script) - return; - - line = devtools.DebuggerAgent.webkitToV8LineNumber_(line); - - var breakpointInfo; - if (script.getUrl()) { - var breakpoints = this.urlToBreakpoints_[script.getUrl()]; - breakpointInfo = breakpoints[line]; - } else - breakpointInfo = script.getBreakpointInfo(line); - - var id = breakpointInfo.getV8Id(); - - // If we don't know id of this breakpoint in the v8 debugger we cannot send - // the "changebreakpoint" request. - if (id !== -1) { - // TODO(apavlov): make use of the real values for "enabled" and - // "ignoreCount" when appropriate. - this.requestChangeBreakpoint_(id, true, condition, null); - } -}; - - -/** - * Tells the v8 debugger to step into the next statement. - */ -devtools.DebuggerAgent.prototype.stepIntoStatement = function() -{ - this.stepCommand_("in"); -}; - - -/** - * Tells the v8 debugger to step out of current function. - */ -devtools.DebuggerAgent.prototype.stepOutOfFunction = function() -{ - this.stepCommand_("out"); -}; - - -/** - * Tells the v8 debugger to step over the next statement. - */ -devtools.DebuggerAgent.prototype.stepOverStatement = function() -{ - this.stepCommand_("next"); -}; - - -/** - * Tells the v8 debugger to continue execution after it has been stopped on a - * breakpoint or an exception. - */ -devtools.DebuggerAgent.prototype.resumeExecution = function() -{ - this.clearExceptionMessage_(); - var cmd = new devtools.DebugCommand("continue"); - devtools.DebuggerAgent.sendCommand_(cmd); -}; - - -/** - * Creates exception message and schedules it for addition to the resource upon - * backtrace availability. - * @param {string} url Resource url. - * @param {number} line Resource line number. - * @param {string} message Exception text. - */ -devtools.DebuggerAgent.prototype.createExceptionMessage_ = function(url, line, message) -{ - this.currentExceptionMessage_ = new WebInspector.ConsoleMessage( - WebInspector.ConsoleMessage.MessageSource.JS, - WebInspector.ConsoleMessage.MessageType.Log, - WebInspector.ConsoleMessage.MessageLevel.Error, - line, - url, - 0 /* group level */, - 1 /* repeat count */, - "[Exception] " + message); -}; - - -/** - * Shows pending exception message that is created with createExceptionMessage_ - * earlier. - */ -devtools.DebuggerAgent.prototype.showPendingExceptionMessage_ = function() -{ - if (!this.currentExceptionMessage_) - return; - var msg = this.currentExceptionMessage_; - var resource = WebInspector.resourceURLMap[msg.url]; - if (resource) { - msg.resource = resource; - WebInspector.panels.resources.addMessageToResource(resource, msg); - } else - this.currentExceptionMessage_ = null; -}; - - -/** - * Clears exception message from the resource. - */ -devtools.DebuggerAgent.prototype.clearExceptionMessage_ = function() -{ - if (this.currentExceptionMessage_) { - var messageElement = this.currentExceptionMessage_._resourceMessageLineElement; - var bubble = messageElement.parentElement; - bubble.removeChild(messageElement); - if (!bubble.firstChild) { - // Last message in bubble removed. - bubble.parentElement.removeChild(bubble); - } - this.currentExceptionMessage_ = null; - } -}; - - -/** - * @return {boolean} True iff the debugger will pause execution on the - * exceptions. - */ -devtools.DebuggerAgent.prototype.pauseOnExceptions = function() -{ - return this.pauseOnExceptions_; -}; - - -/** - * Tells whether to pause in the debugger on the exceptions or not. - * @param {boolean} value True iff execution should be stopped in the debugger - * on the exceptions. - */ -devtools.DebuggerAgent.prototype.setPauseOnExceptions = function(value) -{ - this.pauseOnExceptions_ = value; -}; - - -/** - * Sends "evaluate" request to the debugger. - * @param {Object} arguments Request arguments map. - * @param {function(devtools.DebuggerMessage)} callback Callback to be called - * when response is received. - */ -devtools.DebuggerAgent.prototype.requestEvaluate = function(arguments, callback) -{ - var cmd = new devtools.DebugCommand("evaluate", arguments); - devtools.DebuggerAgent.sendCommand_(cmd); - this.requestSeqToCallback_[cmd.getSequenceNumber()] = callback; -}; - - -/** - * Sends "lookup" request for each unresolved property of the object. When - * response is received the properties will be changed with their resolved - * values. - * @param {Object} object Object whose properties should be resolved. - * @param {function(devtools.DebuggerMessage)} Callback to be called when all - * children are resolved. - * @param {boolean} noIntrinsic Whether intrinsic properties should be included. - */ -devtools.DebuggerAgent.prototype.resolveChildren = function(object, callback, noIntrinsic) -{ - if ("handle" in object) { - var result = []; - devtools.DebuggerAgent.formatObjectProperties_(object, result, noIntrinsic); - callback(result); - } else { - this.requestLookup_([object.ref], function(msg) { - var result = []; - if (msg.isSuccess()) { - var handleToObject = msg.getBody(); - var resolved = handleToObject[object.ref]; - devtools.DebuggerAgent.formatObjectProperties_(resolved, result, noIntrinsic); - callback(result); - } else - callback([]); - }); - } -}; - - -/** - * Sends "scope" request for the scope object to resolve its variables. - * @param {Object} scope Scope to be resolved. - * @param {function(Array.<WebInspector.ObjectPropertyProxy>)} callback - * Callback to be called when all scope variables are resolved. - */ -devtools.DebuggerAgent.prototype.resolveScope = function(scope, callback) -{ - var cmd = new devtools.DebugCommand("scope", { - "frameNumber": scope.frameNumber, - "number": scope.index, - "compactFormat": true - }); - devtools.DebuggerAgent.sendCommand_(cmd); - this.requestSeqToCallback_[cmd.getSequenceNumber()] = function(msg) { - var result = []; - if (msg.isSuccess()) { - var scopeObjectJson = msg.getBody().object; - devtools.DebuggerAgent.formatObjectProperties_(scopeObjectJson, result, true /* no intrinsic */); - } - callback(result); - }; -}; - - -/** - * Sends "scopes" request for the frame object to resolve all variables - * available in the frame. - * @param {number} callFrameId Id of call frame whose variables need to - * be resolved. - * @param {function(Object)} callback Callback to be called when all frame - * variables are resolved. - */ -devtools.DebuggerAgent.prototype.resolveFrameVariables_ = function(callFrameId, callback) -{ - var result = {}; - - var frame = this.callFrames_[callFrameId]; - if (!frame) { - callback(result); - return; - } - - var waitingResponses = 0; - function scopeResponseHandler(msg) { - waitingResponses--; - - if (msg.isSuccess()) { - var properties = msg.getBody().object.properties; - for (var j = 0; j < properties.length; j++) - result[properties[j].name] = true; - } - - // When all scopes are resolved invoke the callback. - if (waitingResponses === 0) - callback(result); - }; - - for (var i = 0; i < frame.scopeChain.length; i++) { - var scope = frame.scopeChain[i].objectId; - if (scope.type === devtools.DebuggerAgent.ScopeType.Global) { - // Do not resolve global scope since it takes for too long. - // TODO(yurys): allow to send only property names in the response. - continue; - } - var cmd = new devtools.DebugCommand("scope", { - "frameNumber": scope.frameNumber, - "number": scope.index, - "compactFormat": true - }); - devtools.DebuggerAgent.sendCommand_(cmd); - this.requestSeqToCallback_[cmd.getSequenceNumber()] = scopeResponseHandler; - waitingResponses++; - } -}; - -/** - * Evaluates the expressionString to an object in the call frame and reports - * all its properties. - * @param{string} expressionString Expression whose properties should be - * collected. - * @param{number} callFrameId The frame id. - * @param{function(Object result,bool isException)} reportCompletions Callback - * function. - */ -devtools.DebuggerAgent.prototype.resolveCompletionsOnFrame = function(expressionString, callFrameId, reportCompletions) -{ - if (expressionString) { - expressionString = "var obj = " + expressionString + - "; var names = {}; for (var n in obj) { names[n] = true; };" + - "names;"; - this.evaluateInCallFrame( - callFrameId, - expressionString, - function(result) { - var names = {}; - if (!result.isException) { - var props = result.value.objectId.properties; - // Put all object properties into the map. - for (var i = 0; i < props.length; i++) - names[props[i].name] = true; - } - reportCompletions(names, result.isException); - }); - } else { - this.resolveFrameVariables_(callFrameId, - function(result) { - reportCompletions(result, false /* isException */); - }); - } -}; - - -/** - * @param{number} scriptId - * @return {string} Type of the context of the script with specified id. - */ -devtools.DebuggerAgent.prototype.getScriptContextType = function(scriptId) -{ - return this.parsedScripts_[scriptId].getContextType(); -}; - - -/** - * Removes specified breakpoint from the v8 debugger. - * @param {number} breakpointId Id of the breakpoint in the v8 debugger. - */ -devtools.DebuggerAgent.prototype.requestClearBreakpoint_ = function(breakpointId) -{ - var cmd = new devtools.DebugCommand("clearbreakpoint", { - "breakpoint": breakpointId - }); - devtools.DebuggerAgent.sendCommand_(cmd); -}; - - -/** - * Changes breakpoint parameters in the v8 debugger. - * @param {number} breakpointId Id of the breakpoint in the v8 debugger. - * @param {boolean} enabled Whether to enable the breakpoint. - * @param {?string} condition New breakpoint condition. - * @param {number} ignoreCount New ignore count for the breakpoint. - */ -devtools.DebuggerAgent.prototype.requestChangeBreakpoint_ = function(breakpointId, enabled, condition, ignoreCount) -{ - var cmd = new devtools.DebugCommand("changebreakpoint", { - "breakpoint": breakpointId, - "enabled": enabled, - "condition": condition, - "ignoreCount": ignoreCount - }); - devtools.DebuggerAgent.sendCommand_(cmd); -}; - - -/** - * Sends "backtrace" request to v8. - */ -devtools.DebuggerAgent.prototype.requestBacktrace_ = function() -{ - var cmd = new devtools.DebugCommand("backtrace", { - "compactFormat":true - }); - devtools.DebuggerAgent.sendCommand_(cmd); -}; - - -/** - * Sends command to v8 debugger. - * @param {devtools.DebugCommand} cmd Command to execute. - */ -devtools.DebuggerAgent.sendCommand_ = function(cmd) -{ - RemoteDebuggerCommandExecutor.DebuggerCommand(cmd.toJSONProtocol()); -}; - - -/** - * Tells the v8 debugger to make the next execution step. - * @param {string} action "in", "out" or "next" action. - */ -devtools.DebuggerAgent.prototype.stepCommand_ = function(action) -{ - this.clearExceptionMessage_(); - var cmd = new devtools.DebugCommand("continue", { - "stepaction": action, - "stepcount": 1 - }); - devtools.DebuggerAgent.sendCommand_(cmd); -}; - - -/** - * Sends "lookup" request to v8. - * @param {number} handle Handle to the object to lookup. - */ -devtools.DebuggerAgent.prototype.requestLookup_ = function(handles, callback) -{ - var cmd = new devtools.DebugCommand("lookup", { - "compactFormat":true, - "handles": handles - }); - devtools.DebuggerAgent.sendCommand_(cmd); - this.requestSeqToCallback_[cmd.getSequenceNumber()] = callback; -}; - - -/** - * Sets debugger context id for scripts filtering. - * @param {number} contextId Id of the inspected page global context. - */ -devtools.DebuggerAgent.prototype.setContextId_ = function(contextId) -{ - this.contextId_ = contextId; - - // If it's the first time context id is set request scripts list. - if (this.requestScriptsWhenContextIdSet_) { - this.requestScriptsWhenContextIdSet_ = false; - var cmd = new devtools.DebugCommand("scripts", { - "includeSource": false - }); - devtools.DebuggerAgent.sendCommand_(cmd); - // Force v8 execution so that it gets to processing the requested command. - RemoteDebuggerAgent.processDebugCommands(); - - var debuggerAgent = this; - this.requestSeqToCallback_[cmd.getSequenceNumber()] = function(msg) { - // Handle the response iff the context id hasn't changed since the request - // was issued. Otherwise if the context id did change all up-to-date - // scripts will be pushed in after compile events and there is no need to - // handle the response. - if (contextId === debuggerAgent.contextId_) - debuggerAgent.handleScriptsResponse_(msg); - - // We received initial scripts response so flush the flag and - // see if there is an unhandled backtrace response. - debuggerAgent.waitingForInitialScriptsResponse_ = false; - if (debuggerAgent.pendingBacktraceResponseHandler_) { - debuggerAgent.pendingBacktraceResponseHandler_(); - debuggerAgent.pendingBacktraceResponseHandler_ = null; - } - }; - } -}; - - -/** - * Handles output sent by v8 debugger. The output is either asynchronous event - * or response to a previously sent request. See protocol definitioun for more - * details on the output format. - * @param {string} output - */ -devtools.DebuggerAgent.prototype.handleDebuggerOutput_ = function(output) -{ - var msg; - try { - msg = new devtools.DebuggerMessage(output); - } catch(e) { - debugPrint("Failed to handle debugger response:\n" + e); - throw e; - } - - if (msg.getType() === "event") { - if (msg.getEvent() === "break") - this.handleBreakEvent_(msg); - else if (msg.getEvent() === "exception") - this.handleExceptionEvent_(msg); - else if (msg.getEvent() === "afterCompile") - this.handleAfterCompileEvent_(msg); - } else if (msg.getType() === "response") { - if (msg.getCommand() === "scripts") - this.invokeCallbackForResponse_(msg); - else if (msg.getCommand() === "setbreakpoint") - this.handleSetBreakpointResponse_(msg); - else if (msg.getCommand() === "clearbreakpoint") - this.handleClearBreakpointResponse_(msg); - else if (msg.getCommand() === "backtrace") - this.handleBacktraceResponse_(msg); - else if (msg.getCommand() === "lookup") - this.invokeCallbackForResponse_(msg); - else if (msg.getCommand() === "evaluate") - this.invokeCallbackForResponse_(msg); - else if (msg.getCommand() === "scope") - this.invokeCallbackForResponse_(msg); - } -}; - - -/** - * @param {devtools.DebuggerMessage} msg - */ -devtools.DebuggerAgent.prototype.handleBreakEvent_ = function(msg) -{ - // Force scrips panel to be shown first. - WebInspector.currentPanel = WebInspector.panels.scripts; - - var body = msg.getBody(); - - var line = devtools.DebuggerAgent.v8ToWwebkitLineNumber_(body.sourceLine); - this.requestBacktrace_(); -}; - - -/** - * @param {devtools.DebuggerMessage} msg - */ -devtools.DebuggerAgent.prototype.handleExceptionEvent_ = function(msg) -{ - // Force scrips panel to be shown first. - WebInspector.currentPanel = WebInspector.panels.scripts; - - var body = msg.getBody(); - // No script field in the body means that v8 failed to parse the script. We - // resume execution on parser errors automatically. - if (this.pauseOnExceptions_ && body.script) { - var line = devtools.DebuggerAgent.v8ToWwebkitLineNumber_(body.sourceLine); - this.createExceptionMessage_(body.script.name, line, body.exception.text); - this.requestBacktrace_(); - } else - this.resumeExecution(); -}; - - -/** - * @param {devtools.DebuggerMessage} msg - */ -devtools.DebuggerAgent.prototype.handleScriptsResponse_ = function(msg) -{ - var scripts = msg.getBody(); - for (var i = 0; i < scripts.length; i++) { - var script = scripts[i]; - - // Skip scripts from other tabs. - if (!this.isScriptFromInspectedContext_(script, msg)) - continue; - - // We may already have received the info in an afterCompile event. - if (script.id in this.parsedScripts_) - continue; - this.addScriptInfo_(script, msg); - } -}; - - -/** - * @param {Object} script Json object representing script. - * @param {devtools.DebuggerMessage} msg Debugger response. - */ -devtools.DebuggerAgent.prototype.isScriptFromInspectedContext_ = function(script, msg) -{ - if (!script.context) { - // Always ignore scripts from the utility context. - return false; - } - var context = msg.lookup(script.context.ref); - var scriptContextId = context.data; - if (typeof scriptContextId === "undefined") - return false; // Always ignore scripts from the utility context. - if (this.contextId_ === null) - return true; - // Find the id from context data. The context data has the format "type,id". - var comma = context.data.indexOf(","); - if (comma < 0) - return false; - return (context.data.substring(comma + 1) == this.contextId_); -}; - - -/** - * @param {devtools.DebuggerMessage} msg - */ -devtools.DebuggerAgent.prototype.handleSetBreakpointResponse_ = function(msg) -{ - var requestSeq = msg.getRequestSeq(); - var breakpointInfo = this.requestNumberToBreakpointInfo_[requestSeq]; - if (!breakpointInfo) { - // TODO(yurys): handle this case - return; - } - delete this.requestNumberToBreakpointInfo_[requestSeq]; - if (!msg.isSuccess()) { - // TODO(yurys): handle this case - return; - } - var idInV8 = msg.getBody().breakpoint; - breakpointInfo.setV8Id(idInV8); - - if (breakpointInfo.isRemoved()) - this.requestClearBreakpoint_(idInV8); -}; - - -/** - * @param {devtools.DebuggerMessage} msg - */ -devtools.DebuggerAgent.prototype.handleAfterCompileEvent_ = function(msg) -{ - if (!this.contextId_) { - // Ignore scripts delta if main request has not been issued yet. - return; - } - var script = msg.getBody().script; - - // Ignore scripts from other tabs. - if (!this.isScriptFromInspectedContext_(script, msg)) - return; - this.addScriptInfo_(script, msg); -}; - - -/** - * Adds the script info to the local cache. This method assumes that the script - * is not in the cache yet. - * @param {Object} script Script json object from the debugger message. - * @param {devtools.DebuggerMessage} msg Debugger message containing the script - * data. - */ -devtools.DebuggerAgent.prototype.addScriptInfo_ = function(script, msg) -{ - var context = msg.lookup(script.context.ref); - var contextType; - // Find the type from context data. The context data has the format - // "type,id". - var comma = context.data.indexOf(","); - if (comma < 0) - return - contextType = context.data.substring(0, comma); - this.parsedScripts_[script.id] = new devtools.ScriptInfo(script.id, script.name, script.lineOffset, contextType); - if (this.scriptsPanelInitialized_) { - // Only report script as parsed after scripts panel has been shown. - WebInspector.parsedScriptSource(script.id, script.name, script.source, script.lineOffset); - } -}; - - -/** - * @param {devtools.DebuggerMessage} msg - */ -devtools.DebuggerAgent.prototype.handleClearBreakpointResponse_ = function(msg) -{ - // Do nothing. -}; - - -/** - * Handles response to "backtrace" command. - * @param {devtools.DebuggerMessage} msg - */ -devtools.DebuggerAgent.prototype.handleBacktraceResponse_ = function(msg) -{ - if (this.waitingForInitialScriptsResponse_) - this.pendingBacktraceResponseHandler_ = this.doHandleBacktraceResponse_.bind(this, msg); - else - this.doHandleBacktraceResponse_(msg); -}; - - -/** - * @param {devtools.DebuggerMessage} msg - */ -devtools.DebuggerAgent.prototype.doHandleBacktraceResponse_ = function(msg) -{ - var frames = msg.getBody().frames; - this.callFrames_ = []; - for (var i = 0; i < frames.length; ++i) - this.callFrames_.push(this.formatCallFrame_(frames[i])); - WebInspector.pausedScript(this.callFrames_); - this.showPendingExceptionMessage_(); - InspectorFrontendHost.activateWindow(); -}; - - -/** - * Evaluates code on given callframe. - */ -devtools.DebuggerAgent.prototype.evaluateInCallFrame = function(callFrameId, code, callback) -{ - var callFrame = this.callFrames_[callFrameId]; - callFrame.evaluate_(code, callback); -}; - - -/** - * Handles response to a command by invoking its callback (if any). - * @param {devtools.DebuggerMessage} msg - * @return {boolean} Whether a callback for the given message was found and - * excuted. - */ -devtools.DebuggerAgent.prototype.invokeCallbackForResponse_ = function(msg) -{ - var callback = this.requestSeqToCallback_[msg.getRequestSeq()]; - if (!callback) { - // It may happend if reset was called. - return false; - } - delete this.requestSeqToCallback_[msg.getRequestSeq()]; - callback(msg); - return true; -}; - - -/** - * @param {Object} stackFrame Frame json object from "backtrace" response. - * @return {!devtools.CallFrame} Object containing information related to the - * call frame in the format expected by ScriptsPanel and its panes. - */ -devtools.DebuggerAgent.prototype.formatCallFrame_ = function(stackFrame) -{ - var func = stackFrame.func; - var sourceId = func.scriptId; - - // Add service script if it does not exist. - var existingScript = this.parsedScripts_[sourceId]; - if (!existingScript) { - this.parsedScripts_[sourceId] = new devtools.ScriptInfo(sourceId, null /* name */, 0 /* line */, "unknown" /* type */, true /* unresolved */); - WebInspector.parsedScriptSource(sourceId, null, null, 0); - } - - var funcName = func.name || func.inferredName || "(anonymous function)"; - var line = devtools.DebuggerAgent.v8ToWwebkitLineNumber_(stackFrame.line); - - // Add basic scope chain info with scope variables. - var scopeChain = []; - var ScopeType = devtools.DebuggerAgent.ScopeType; - for (var i = 0; i < stackFrame.scopes.length; i++) { - var scope = stackFrame.scopes[i]; - scope.frameNumber = stackFrame.index; - var scopeObjectProxy = new WebInspector.ObjectProxy(0, scope, [], 0, "", true); - scopeObjectProxy.isScope = true; - switch(scope.type) { - case ScopeType.Global: - scopeObjectProxy.isDocument = true; - break; - case ScopeType.Local: - scopeObjectProxy.isLocal = true; - scopeObjectProxy.thisObject = devtools.DebuggerAgent.formatObjectProxy_(stackFrame.receiver); - break; - case ScopeType.With: - // Catch scope is treated as a regular with scope by WebKit so we - // also treat it this way. - case ScopeType.Catch: - scopeObjectProxy.isWithBlock = true; - break; - case ScopeType.Closure: - scopeObjectProxy.isClosure = true; - break; - } - scopeChain.push(scopeObjectProxy); - } - return new devtools.CallFrame(stackFrame.index, "function", funcName, sourceId, line, scopeChain); -}; - - -/** - * Collects properties for an object from the debugger response. - * @param {Object} object An object from the debugger protocol response. - * @param {Array.<WebInspector.ObjectPropertyProxy>} result An array to put the - * properties into. - * @param {boolean} noIntrinsic Whether intrinsic properties should be - * included. - */ -devtools.DebuggerAgent.formatObjectProperties_ = function(object, result, noIntrinsic) -{ - devtools.DebuggerAgent.propertiesToProxies_(object.properties, result); - if (noIntrinsic) - return; - - result.push(new WebInspector.ObjectPropertyProxy("__proto__", devtools.DebuggerAgent.formatObjectProxy_(object.protoObject))); - result.push(new WebInspector.ObjectPropertyProxy("constructor", devtools.DebuggerAgent.formatObjectProxy_(object.constructorFunction))); - // Don't add 'prototype' property since it is one of the regualar properties. -}; - - -/** - * For each property in "properties" creates its proxy representative. - * @param {Array.<Object>} properties Receiver properties or locals array from - * "backtrace" response. - * @param {Array.<WebInspector.ObjectPropertyProxy>} Results holder. - */ -devtools.DebuggerAgent.propertiesToProxies_ = function(properties, result) -{ - var map = {}; - for (var i = 0; i < properties.length; ++i) { - var property = properties[i]; - var name = String(property.name); - if (name in map) - continue; - map[name] = true; - var value = devtools.DebuggerAgent.formatObjectProxy_(property.value); - var propertyProxy = new WebInspector.ObjectPropertyProxy(name, value); - result.push(propertyProxy); - } -}; - - -/** - * @param {Object} v An object reference from the debugger response. - * @return {*} The value representation expected by ScriptsPanel. - */ -devtools.DebuggerAgent.formatObjectProxy_ = function(v) -{ - var description; - var hasChildren = false; - if (v.type === "object") { - description = v.className; - hasChildren = true; - } else if (v.type === "function") { - if (v.source) - description = v.source; - else - description = "function " + v.name + "()"; - hasChildren = true; - } else if (v.type === "undefined") - description = "undefined"; - else if (v.type === "null") - description = "null"; - else if (typeof v.value !== "undefined") { - // Check for undefined and null types before checking the value, otherwise - // null/undefined may have blank value. - description = v.value; - } else - description = "<unresolved ref: " + v.ref + ", type: " + v.type + ">"; - - var proxy = new WebInspector.ObjectProxy(0, v, [], 0, description, hasChildren); - proxy.type = v.type; - proxy.isV8Ref = true; - return proxy; -}; - - -/** - * Converts line number from Web Inspector UI(1-based) to v8(0-based). - * @param {number} line Resource line number in Web Inspector UI. - * @return {number} The line number in v8. - */ -devtools.DebuggerAgent.webkitToV8LineNumber_ = function(line) -{ - return line - 1; -}; - - -/** - * Converts line number from v8(0-based) to Web Inspector UI(1-based). - * @param {number} line Resource line number in v8. - * @return {number} The line number in Web Inspector. - */ -devtools.DebuggerAgent.v8ToWwebkitLineNumber_ = function(line) -{ - return line + 1; -}; - - -/** - * @param {number} scriptId Id of the script. - * @param {?string} url Script resource URL if any. - * @param {number} lineOffset First line 0-based offset in the containing - * document. - * @param {string} contextType Type of the script's context: - * "page" - regular script from html page - * "injected" - extension content script - * @param {bool} opt_isUnresolved If true, script will not be resolved. - * @constructor - */ -devtools.ScriptInfo = function(scriptId, url, lineOffset, contextType, opt_isUnresolved) -{ - this.scriptId_ = scriptId; - this.lineOffset_ = lineOffset; - this.contextType_ = contextType; - this.url_ = url; - this.isUnresolved_ = opt_isUnresolved; - - this.lineToBreakpointInfo_ = {}; -}; - - -/** - * @return {number} - */ -devtools.ScriptInfo.prototype.getLineOffset = function() -{ - return this.lineOffset_; -}; - - -/** - * @return {string} - */ -devtools.ScriptInfo.prototype.getContextType = function() -{ - return this.contextType_; -}; - - -/** - * @return {?string} - */ -devtools.ScriptInfo.prototype.getUrl = function() -{ - return this.url_; -}; - - -/** - * @return {?bool} - */ -devtools.ScriptInfo.prototype.isUnresolved = function() -{ - return this.isUnresolved_; -}; - - -/** - * @param {number} line 0-based line number in the script. - * @return {?devtools.BreakpointInfo} Information on a breakpoint at the - * specified line in the script or undefined if there is no breakpoint at - * that line. - */ -devtools.ScriptInfo.prototype.getBreakpointInfo = function(line) -{ - return this.lineToBreakpointInfo_[line]; -}; - - -/** - * Adds breakpoint info to the script. - * @param {devtools.BreakpointInfo} breakpoint - */ -devtools.ScriptInfo.prototype.addBreakpointInfo = function(breakpoint) -{ - this.lineToBreakpointInfo_[breakpoint.getLine()] = breakpoint; -}; - - -/** - * @param {devtools.BreakpointInfo} breakpoint Breakpoint info to be removed. - */ -devtools.ScriptInfo.prototype.removeBreakpointInfo = function(breakpoint) -{ - var line = breakpoint.getLine(); - delete this.lineToBreakpointInfo_[line]; -}; - - - -/** - * @param {number} line Breakpoint 0-based line number in the containing script. - * @constructor - */ -devtools.BreakpointInfo = function(line) -{ - this.line_ = line; - this.v8id_ = -1; - this.removed_ = false; -}; - - -/** - * @return {number} - */ -devtools.BreakpointInfo.prototype.getLine = function(n) -{ - return this.line_; -}; - - -/** - * @return {number} Unique identifier of this breakpoint in the v8 debugger. - */ -devtools.BreakpointInfo.prototype.getV8Id = function(n) -{ - return this.v8id_; -}; - - -/** - * Sets id of this breakpoint in the v8 debugger. - * @param {number} id - */ -devtools.BreakpointInfo.prototype.setV8Id = function(id) -{ - this.v8id_ = id; -}; - - -/** - * Marks this breakpoint as removed from the front-end. - */ -devtools.BreakpointInfo.prototype.markAsRemoved = function() -{ - this.removed_ = true; -}; - - -/** - * @return {boolean} Whether this breakpoint has been removed from the - * front-end. - */ -devtools.BreakpointInfo.prototype.isRemoved = function() -{ - return this.removed_; -}; - - -/** - * Call stack frame data. - * @param {string} id CallFrame id. - * @param {string} type CallFrame type. - * @param {string} functionName CallFrame type. - * @param {string} sourceID Source id. - * @param {number} line Source line. - * @param {Array.<Object>} scopeChain Array of scoped objects. - * @construnctor - */ -devtools.CallFrame = function(id, type, functionName, sourceID, line, scopeChain) -{ - this.id = id; - this.type = type; - this.functionName = functionName; - this.sourceID = sourceID; - this.line = line; - this.scopeChain = scopeChain; -}; - - -/** - * This method issues asynchronous evaluate request, reports result to the - * callback. - * @param {string} expression An expression to be evaluated in the context of - * this call frame. - * @param {function(Object):undefined} callback Callback to report result to. - */ -devtools.CallFrame.prototype.evaluate_ = function(expression, callback) -{ - devtools.tools.getDebuggerAgent().requestEvaluate({ - "expression": expression, - "frame": this.id, - "global": false, - "disable_break": false, - "compactFormat": true - }, - function(response) { - var result = {}; - if (response.isSuccess()) - result.value = devtools.DebuggerAgent.formatObjectProxy_(response.getBody()); - else { - result.value = response.getMessage(); - result.isException = true; - } - callback(result); - }); -}; - - -/** - * JSON based commands sent to v8 debugger. - * @param {string} command Name of the command to execute. - * @param {Object} opt_arguments Command-specific arguments map. - * @constructor - */ -devtools.DebugCommand = function(command, opt_arguments) -{ - this.command_ = command; - this.type_ = "request"; - this.seq_ = ++devtools.DebugCommand.nextSeq_; - if (opt_arguments) - this.arguments_ = opt_arguments; -}; - - -/** - * Next unique number to be used as debugger request sequence number. - * @type {number} - */ -devtools.DebugCommand.nextSeq_ = 1; - - -/** - * @return {number} - */ -devtools.DebugCommand.prototype.getSequenceNumber = function() -{ - return this.seq_; -}; - - -/** - * @return {string} - */ -devtools.DebugCommand.prototype.toJSONProtocol = function() -{ - var json = { - "seq": this.seq_, - "type": this.type_, - "command": this.command_ - } - if (this.arguments_) - json.arguments = this.arguments_; - return JSON.stringify(json); -}; - - -/** - * JSON messages sent from v8 debugger. See protocol definition for more - * details: http://code.google.com/p/v8/wiki/DebuggerProtocol - * @param {string} msg Raw protocol packet as JSON string. - * @constructor - */ -devtools.DebuggerMessage = function(msg) -{ - this.packet_ = JSON.parse(msg); - this.refs_ = []; - if (this.packet_.refs) { - for (var i = 0; i < this.packet_.refs.length; i++) - this.refs_[this.packet_.refs[i].handle] = this.packet_.refs[i]; - } -}; - - -/** - * @return {string} The packet type. - */ -devtools.DebuggerMessage.prototype.getType = function() -{ - return this.packet_.type; -}; - - -/** - * @return {?string} The packet event if the message is an event. - */ -devtools.DebuggerMessage.prototype.getEvent = function() -{ - return this.packet_.event; -}; - - -/** - * @return {?string} The packet command if the message is a response to a - * command. - */ -devtools.DebuggerMessage.prototype.getCommand = function() -{ - return this.packet_.command; -}; - - -/** - * @return {number} The packet request sequence. - */ -devtools.DebuggerMessage.prototype.getRequestSeq = function() -{ - return this.packet_.request_seq; -}; - - -/** - * @return {number} Whether the v8 is running after processing the request. - */ -devtools.DebuggerMessage.prototype.isRunning = function() -{ - return this.packet_.running ? true : false; -}; - - -/** - * @return {boolean} Whether the request succeeded. - */ -devtools.DebuggerMessage.prototype.isSuccess = function() -{ - return this.packet_.success ? true : false; -}; - - -/** - * @return {string} - */ -devtools.DebuggerMessage.prototype.getMessage = function() -{ - return this.packet_.message; -}; - - -/** - * @return {Object} Parsed message body json. - */ -devtools.DebuggerMessage.prototype.getBody = function() -{ - return this.packet_.body; -}; - - -/** - * @param {number} handle Object handle. - * @return {?Object} Returns the object with the handle if it was sent in this - * message(some objects referenced by handles may be missing in the message). - */ -devtools.DebuggerMessage.prototype.lookup = function(handle) -{ - return this.refs_[handle]; -}; diff --git a/WebKit/chromium/src/js/DebuggerScript.js b/WebKit/chromium/src/js/DebuggerScript.js new file mode 100644 index 0000000..5a8a7bf --- /dev/null +++ b/WebKit/chromium/src/js/DebuggerScript.js @@ -0,0 +1,271 @@ +/* + * 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. + */ + +(function () { + +var DebuggerScript = {}; +DebuggerScript._breakpoints = {}; + +DebuggerScript.PauseOnExceptionsState = { + DontPauseOnExceptions : 0, + PauseOnAllExceptions : 1, + PauseOnUncaughtExceptions: 2 +}; + +DebuggerScript.ScriptWorldType = { + MainWorld : 0, + ExtensionsWorld : 1 +}; + +DebuggerScript._pauseOnExceptionsState = DebuggerScript.PauseOnExceptionsState.DontPauseOnExceptions; +Debug.clearBreakOnException(); +Debug.clearBreakOnUncaughtException(); + +DebuggerScript.getAfterCompileScript = function(eventData) +{ + return DebuggerScript._formatScript(eventData.script_.script_); +} + +DebuggerScript.getScripts = function(contextData) +{ + var result = []; + + if (!contextData) + return result; + var comma = contextData.indexOf(","); + if (comma === -1) + return result; + // Context data is a string in the following format: + // ("page"|"injected")","<page id> + var idSuffix = contextData.substring(comma); // including the comma + + var scripts = Debug.scripts(); + for (var i = 0; i < scripts.length; ++i) { + var script = scripts[i]; + if (script.context_data && script.context_data.lastIndexOf(idSuffix) != -1) + result.push(DebuggerScript._formatScript(script)); + } + return result; +} + +DebuggerScript._formatScript = function(script) +{ + var scriptWorldType = DebuggerScript.ScriptWorldType.MainWorld; + if (script.context_data && script.context_data.indexOf("injected") == 0) + scriptWorldType = DebuggerScript.ScriptWorldType.ExtensionsWorld; + return { + id: script.id, + name: script.nameOrSourceURL(), + source: script.source, + lineOffset: DebuggerScript._v8ToWebkitLineNumber(script.line_offset), + lineCount: script.lineCount(), + scriptWorldType: scriptWorldType + }; +} + +DebuggerScript.setBreakpoint = function(execState, args) +{ + args.lineNumber = DebuggerScript._webkitToV8LineNumber(args.lineNumber); + var breakId = Debug.setScriptBreakPointById(args.scriptId, args.lineNumber, 0 /* column */, args.condition); + if (!args.enabled) + Debug.disableScriptBreakPoint(breakId); + + var locations = Debug.findBreakPointActualLocations(breakId); + var actualLineNumber = locations.length ? locations[0].line : args.lineNumber; + + var key = args.scriptId + ":" + actualLineNumber; + if (key in DebuggerScript._breakpoints) { + // Remove old breakpoint. + Debug.findBreakPoint(DebuggerScript._breakpoints[key], true); + } + DebuggerScript._breakpoints[key] = breakId; + return DebuggerScript._v8ToWebkitLineNumber(actualLineNumber); +} + +DebuggerScript.removeBreakpoint = function(execState, args) +{ + args.lineNumber = DebuggerScript._webkitToV8LineNumber(args.lineNumber); + var key = args.scriptId + ":" + args.lineNumber; + var breakId = DebuggerScript._breakpoints[key]; + if (breakId) + Debug.findBreakPoint(breakId, true); + delete DebuggerScript._breakpoints[key]; +} + +DebuggerScript.pauseOnExceptionsState = function() +{ + return DebuggerScript._pauseOnExceptionsState; +} + +DebuggerScript.setPauseOnExceptionsState = function(newState) +{ + DebuggerScript._pauseOnExceptionsState = newState; + + if (DebuggerScript.PauseOnExceptionsState.PauseOnAllExceptions === newState) + Debug.setBreakOnException(); + else + Debug.clearBreakOnException(); + + if (DebuggerScript.PauseOnExceptionsState.PauseOnUncaughtExceptions === newState) + Debug.setBreakOnUncaughtException(); + else + Debug.clearBreakOnUncaughtException(); +} + +DebuggerScript.currentCallFrame = function(execState, args) +{ + var frameCount = execState.frameCount(); + if (frameCount === 0) + return undefined; + + var topFrame; + for (var i = frameCount - 1; i >= 0; i--) { + var frameMirror = execState.frame(i); + topFrame = DebuggerScript._frameMirrorToJSCallFrame(frameMirror, topFrame); + } + return topFrame; +} + +DebuggerScript.stepIntoStatement = function(execState) +{ + execState.prepareStep(Debug.StepAction.StepIn, 1); +} + +DebuggerScript.stepOverStatement = function(execState) +{ + execState.prepareStep(Debug.StepAction.StepNext, 1); +} + +DebuggerScript.stepOutOfFunction = function(execState) +{ + execState.prepareStep(Debug.StepAction.StepOut, 1); +} + +DebuggerScript.editScriptSource = function(scriptId, newSource) +{ + var scripts = Debug.scripts(); + var scriptToEdit = null; + for (var i = 0; i < scripts.length; i++) { + if (scripts[i].id == scriptId) { + scriptToEdit = scripts[i]; + break; + } + } + if (!scriptToEdit) + throw("Script not found"); + + var changeLog = []; + Debug.LiveEdit.SetScriptSource(scriptToEdit, newSource, false, changeLog); + return scriptToEdit.source; +} + +DebuggerScript.clearBreakpoints = function(execState, args) +{ + for (var key in DebuggerScript._breakpoints) { + var breakId = DebuggerScript._breakpoints[key]; + Debug.findBreakPoint(breakId, true); + } + DebuggerScript._breakpoints = {}; +} + +DebuggerScript.setBreakpointsActivated = function(execState, args) +{ + Debug.debuggerFlags().breakPointsActive.setValue(args.enabled); +} + +DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror, callerFrame) +{ + // Get function name. + var func; + try { + func = frameMirror.func(); + } catch(e) { + } + var functionName; + if (func) + functionName = func.name() || func.inferredName(); + + // Get script ID. + var script = func.script(); + var sourceID = script && script.id(); + + // Get line number. + var line = DebuggerScript._v8ToWebkitLineNumber(frameMirror.sourceLine()); + + // Get this object. + var thisObject = frameMirror.details_.receiver(); + + // Get scope chain array in format: [<scope type>, <scope object>, <scope type>, <scope object>,...] + var scopeChain = []; + var scopeType = []; + for (var i = 0; i < frameMirror.scopeCount(); i++) { + var scopeMirror = frameMirror.scope(i); + var scopeObjectMirror = scopeMirror.scopeObject(); + var properties = scopeObjectMirror.properties(); + var scopeObject = {}; + for (var j = 0; j < properties.length; j++) + scopeObject[properties[j].name()] = properties[j].value_; + // Reset scope object prototype to null so that the proto properties + // don't appear in th local scope section. + scopeObject.__proto__ = null; + scopeType.push(scopeMirror.scopeType()); + scopeChain.push(scopeObject); + } + + function evaluate(expression) { + return frameMirror.evaluate(expression, false).value(); + } + + return { + "sourceID": sourceID, + "line": line, + "functionName": functionName, + "type": "function", + "thisObject": thisObject, + "scopeChain": scopeChain, + "scopeType": scopeType, + "evaluate": evaluate, + "caller": callerFrame + }; +} + +DebuggerScript._webkitToV8LineNumber = function(line) +{ + return line - 1; +}; + +DebuggerScript._v8ToWebkitLineNumber = function(line) +{ + return line + 1; +}; + +return DebuggerScript; + +})(); diff --git a/WebKit/chromium/src/js/DevTools.js b/WebKit/chromium/src/js/DevTools.js index dcb181b..e3e0204 100644 --- a/WebKit/chromium/src/js/DevTools.js +++ b/WebKit/chromium/src/js/DevTools.js @@ -34,71 +34,13 @@ * 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(remoteName, methodName, param1, param2, param3) -{ - remoteName = "Remote" + remoteName.substring(0, remoteName.length - 8); - var agent = window[remoteName]; - if (!agent) { - debugPrint("No remote agent '" + remoteName + "' found."); - return; - } - var method = agent[methodName]; - if (!method) { - debugPrint("No method '" + remoteName + "." + methodName + "' found."); - return; - } - method.call(this, param1, param2, param3); -}; - - devtools.ToolsAgent = function() { - RemoteToolsAgent.didDispatchOn = WebInspector.Callback.processCallback; - RemoteToolsAgent.frameNavigate = this.frameNavigate_.bind(this); - RemoteToolsAgent.dispatchOnClient = this.dispatchOnClient_.bind(this); - this.debuggerAgent_ = new devtools.DebuggerAgent(); this.profilerAgent_ = new devtools.ProfilerAgent(); }; /** - * Resets tools agent to its initial state. - */ -devtools.ToolsAgent.prototype.reset = function() -{ - this.debuggerAgent_.reset(); -}; - - -/** - * @param {string} script Script exression to be evaluated in the context of the - * inspected page. - * @param {function(Object|string, boolean):undefined} opt_callback Function to - * call with the result. - */ -devtools.ToolsAgent.prototype.evaluateJavaScript = function(script, opt_callback) -{ - InspectorBackend.evaluate(script, opt_callback || function() {}); -}; - - -/** - * @return {devtools.DebuggerAgent} Debugger agent instance. - */ -devtools.ToolsAgent.prototype.getDebuggerAgent = function() -{ - return this.debuggerAgent_; -}; - - -/** * @return {devtools.ProfilerAgent} Profiler agent instance. */ devtools.ToolsAgent.prototype.getProfilerAgent = function() @@ -107,77 +49,6 @@ devtools.ToolsAgent.prototype.getProfilerAgent = function() }; -/** - * @param {string} url Url frame navigated to. - * @see tools_agent.h - * @private - */ -devtools.ToolsAgent.prototype.frameNavigate_ = function(url) -{ - this.reset(); - // Do not reset Profiles panel. - var profiles = null; - if ("profiles" in WebInspector.panels) { - profiles = WebInspector.panels["profiles"]; - delete WebInspector.panels["profiles"]; - } - WebInspector.reset(); - if (profiles !== null) - WebInspector.panels["profiles"] = profiles; -}; - - -/** - * @param {string} message Serialized call to be dispatched on WebInspector. - * @private - */ -devtools.ToolsAgent.prototype.dispatchOnClient_ = function(message) -{ - var args = JSON.parse(message); - var methodName = args[0]; - var parameters = args.slice(1); - WebInspector[methodName].apply(WebInspector, parameters); -}; - - -/** - * Evaluates js expression. - * @param {string} expr - */ -devtools.ToolsAgent.prototype.evaluate = function(expr) -{ - RemoteToolsAgent.evaluate(expr); -}; - - -/** - * Enables / disables resources panel in the ui. - * @param {boolean} enabled New panel status. - */ -WebInspector.setResourcesPanelEnabled = function(enabled) -{ - InspectorBackend._resourceTrackingEnabled = enabled; - WebInspector.panels.resources.reset(); -}; - - -/** - * Prints string to the inspector console or shows alert if the console doesn't - * exist. - * @param {string} text - */ -function debugPrint(text) { - var console = WebInspector.console; - if (console) { - console.addMessage(new WebInspector.ConsoleMessage( - WebInspector.ConsoleMessage.MessageSource.JS, - WebInspector.ConsoleMessage.MessageType.Log, - WebInspector.ConsoleMessage.MessageLevel.Log, - 1, "chrome://devtools/<internal>", undefined, -1, text)); - } else - alert(text); -} - /** * Global instance of the tools agent. @@ -195,118 +66,26 @@ var oldLoaded = WebInspector.loaded; WebInspector.loaded = function() { devtools.tools = new devtools.ToolsAgent(); - devtools.tools.reset(); Preferences.ignoreWhitespace = false; Preferences.samplingCPUProfiler = true; Preferences.heapProfilerPresent = true; - oldLoaded.call(this); - - InspectorFrontendHost.loaded(); -}; - - -(function() -{ - - /** - * Handles an F3 keydown event to focus the Inspector search box. - * @param {KeyboardEvent} event Event to optionally handle - * @return {boolean} whether the event has been handled - */ - function handleF3Keydown(event) { - if (event.keyIdentifier === "F3" && !event.altKey && !event.ctrlKey && !event.shiftKey && !event.metaKey) { - var searchField = document.getElementById("search"); - searchField.focus(); - searchField.select(); - event.preventDefault(); - return true; - } - return false; - } - - - var oldKeyDown = WebInspector.documentKeyDown; - /** - * This override allows to intercept keydown events we want to handle in a - * custom way. Some nested documents (iframes) delegate keydown handling to - * WebInspector.documentKeyDown (e.g. SourceFrame). - * @param {KeyboardEvent} event - * @override - */ - WebInspector.documentKeyDown = function(event) { - var isHandled = handleF3Keydown(event); - if (!isHandled) { - // Mute refresh action. - if (event.keyIdentifier === "F5") - event.preventDefault(); - else if (event.keyIdentifier === "U+0052" /* "R" */ && (event.ctrlKey || event.metaKey)) - event.preventDefault(); - else - oldKeyDown.call(this, event); - } - }; -})(); - - -/** - * This override is necessary for adding script source asynchronously. - * @override - */ -WebInspector.ScriptView.prototype.setupSourceFrameIfNeeded = function() -{ - if (!this._frameNeedsSetup) - return; - - this.attach(); - - if (this.script.source) - this.didResolveScriptSource_(); - else { - var self = this; - devtools.tools.getDebuggerAgent().resolveScriptSource( - this.script.sourceID, - function(source) { - self.script.source = source || WebInspector.UIString("<source is not available>"); - self.didResolveScriptSource_(); - }); - } -}; - - -/** - * Performs source frame setup when script source is aready resolved. - */ -WebInspector.ScriptView.prototype.didResolveScriptSource_ = function() -{ - this.sourceFrame.setContent("text/javascript", this.script.source); - this._sourceFrameSetup = true; - delete this._frameNeedsSetup; -}; - - -/** - * @param {string} type Type of the the property value("object" or "function"). - * @param {string} className Class name of the property value. - * @constructor - */ -WebInspector.UnresolvedPropertyValue = function(type, className) -{ - this.type = type; - this.className = className; -}; + Preferences.debuggerAlwaysEnabled = true; + Preferences.profilerAlwaysEnabled = true; + Preferences.canEditScriptSource = true; + Preferences.onlineDetectionEnabled = false; + Preferences.domBreakpointsEnabled = true; + oldLoaded.call(WebInspector); +} -(function() +devtools.domContentLoaded = function() { - var oldShow = WebInspector.ScriptsPanel.prototype.show; - WebInspector.ScriptsPanel.prototype.show = function() - { - devtools.tools.getDebuggerAgent().initUI(); - this.enableToggleButton.visible = false; - oldShow.call(this); - }; -})(); + 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); (function InterceptProfilesPanelEvents() @@ -334,36 +113,6 @@ WebInspector.UIString = function(string) }; -// There is no clear way of setting frame title yet. So sniffing main resource -// load. -(function OverrideUpdateResource() { - var originalUpdateResource = WebInspector.updateResource; - WebInspector.updateResource = function(identifier, payload) - { - originalUpdateResource.call(this, identifier, payload); - var resource = this.resources[identifier]; - if (resource && resource.mainResource && resource.finished) - document.title = WebInspector.UIString("Developer Tools - %s", resource.url); - }; -})(); - - -// Highlight extension content scripts in the scripts list. -(function () { - var original = WebInspector.ScriptsPanel.prototype._addScriptToFilesMenu; - WebInspector.ScriptsPanel.prototype._addScriptToFilesMenu = function(script) - { - var result = original.apply(this, arguments); - var debuggerAgent = devtools.tools.getDebuggerAgent(); - var type = debuggerAgent.getScriptContextType(script.sourceID); - var option = script.filesSelectOption; - if (type === "injected" && option) - option.addStyleClass("injected"); - return result; - }; -})(); - - /** Pending WebKit upstream by apavlov). Fixes iframe vs drag problem. */ (function() { @@ -392,84 +141,10 @@ WebInspector.UIString = function(string) })(); -(function () { -var orig = InjectedScriptAccess.prototype.getProperties; -InjectedScriptAccess.prototype.getProperties = function(objectProxy, ignoreHasOwnProperty, abbreviate, callback) -{ - if (objectProxy.isScope) - devtools.tools.getDebuggerAgent().resolveScope(objectProxy.objectId, callback); - else if (objectProxy.isV8Ref) - devtools.tools.getDebuggerAgent().resolveChildren(objectProxy.objectId, callback, false); - else - orig.apply(this, arguments); -}; -})(); - - -(function() -{ -InjectedScriptAccess.prototype.evaluateInCallFrame = function(callFrameId, code, objectGroup, callback) -{ - //TODO(pfeldman): remove once 49084 is rolled. - if (!callback) - callback = objectGroup; - devtools.tools.getDebuggerAgent().evaluateInCallFrame(callFrameId, code, callback); -}; -})(); - - -WebInspector.resourceTrackingWasEnabled = function() -{ - InspectorBackend._resourceTrackingEnabled = true; - this.panels.resources.resourceTrackingWasEnabled(); -}; - -WebInspector.resourceTrackingWasDisabled = function() -{ - InspectorBackend._resourceTrackingEnabled = false; - this.panels.resources.resourceTrackingWasDisabled(); -}; - -(function() -{ -var orig = WebInspector.ConsoleMessage.prototype.setMessageBody; -WebInspector.ConsoleMessage.prototype.setMessageBody = function(args) -{ - for (var i = 0; i < args.length; ++i) { - if (typeof args[i] === "string") - args[i] = WebInspector.ObjectProxy.wrapPrimitiveValue(args[i]); - } - orig.call(this, args); -}; -})(); - - -(function() -{ -var orig = InjectedScriptAccess.prototype.getCompletions; -InjectedScriptAccess.prototype.getCompletions = function(expressionString, includeInspectorCommandLineAPI, callFrameId, reportCompletions) -{ - if (typeof callFrameId === "number") - devtools.tools.getDebuggerAgent().resolveCompletionsOnFrame(expressionString, callFrameId, reportCompletions); - else - return orig.apply(this, arguments); -}; -})(); - -(function() -{ -WebInspector.ElementsPanel.prototype._nodeSearchButtonClicked = function( event) -{ - InspectorBackend.toggleNodeSearch(); - this.nodeSearchButton.toggled = !this.nodeSearchButton.toggled; -}; -})(); - - -// We need to have a place for postponed tasks -// which should be executed when all the messages between agent and frontend -// are processed. +/////////////////////////////////////////// +// Chromium layout test harness support. // +/////////////////////////////////////////// WebInspector.runAfterPendingDispatchesQueue = []; @@ -486,19 +161,37 @@ WebInspector.queuesAreEmpty = function() copy[i].call(this); }; -(function() -{ -var originalAddToFrame = InspectorFrontendHost.addResourceSourceToFrame; -InspectorFrontendHost.addResourceSourceToFrame = function(identifier, element) + +///////////////////////////// +// Chromium theme support. // +///////////////////////////// + +WebInspector.setToolbarColors = function(backgroundColor, color) { - var resource = WebInspector.resources[identifier]; - if (!resource) - return; - originalAddToFrame.call(this, identifier, resource.mimeType, element); -}; -})(); + if (!WebInspector._themeStyleElement) { + WebInspector._themeStyleElement = document.createElement("style"); + document.head.appendChild(WebInspector._themeStyleElement); + } + WebInspector._themeStyleElement.textContent = + "#toolbar {\ + background-image: none !important;\ + background-color: " + backgroundColor + " !important;\ + }\ + \ + .toolbar-label {\ + color: " + color + " !important;\ + text-shadow: none;\ + }"; +} -WebInspector.pausedScript = function(callFrames) +WebInspector.resetToolbarColors = function() { - this.panels.scripts.debuggerPaused(callFrames); -}; + if (WebInspector._themeStyleElement) + WebInspector._themeStyleElement.textContent = ""; + +} + +// TODO(yurys): should be removed when eclipse debugger stops using it. +if (window.RemoteDebuggerAgent) { + RemoteDebuggerAgent.setContextId = function() {}; +} diff --git a/WebKit/chromium/src/js/DevToolsHostStub.js b/WebKit/chromium/src/js/DevToolsHostStub.js index 8b2f46b..d3333e2 100644 --- a/WebKit/chromium/src/js/DevToolsHostStub.js +++ b/WebKit/chromium/src/js/DevToolsHostStub.js @@ -33,277 +33,6 @@ * DevTools frontend to function as a standalone web app. */ -if (!window["RemoteDebuggerAgent"]) { - -/** - * FIXME: change field naming style to use trailing underscore. - * @constructor - */ -RemoteDebuggerAgentStub = function() -{ -}; - - -RemoteDebuggerAgentStub.prototype.getContextId = function() -{ - RemoteDebuggerAgent.setContextId(3); -}; - - -RemoteDebuggerAgentStub.prototype.processDebugCommands = function() -{ -}; - - -/** - * @constructor - */ -RemoteProfilerAgentStub = function() -{ -}; - - -RemoteProfilerAgentStub.prototype.getActiveProfilerModules = function() -{ - ProfilerStubHelper.GetInstance().getActiveProfilerModules(); -}; - - -RemoteProfilerAgentStub.prototype.getLogLines = function(pos) -{ - ProfilerStubHelper.GetInstance().getLogLines(pos); -}; - - -/** - * @constructor - */ -RemoteToolsAgentStub = function() -{ -}; - - -RemoteToolsAgentStub.prototype.dispatchOnInjectedScript = function() -{ -}; - - -RemoteToolsAgentStub.prototype.dispatchOnInspectorController = function() -{ -}; - - -/** - * @constructor - */ -ProfilerStubHelper = function() -{ - this.activeProfilerModules_ = devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_NONE; - this.heapProfSample_ = 0; - this.log_ = ''; -}; - - -ProfilerStubHelper.GetInstance = function() -{ - if (!ProfilerStubHelper.instance_) - ProfilerStubHelper.instance_ = new ProfilerStubHelper(); - return ProfilerStubHelper.instance_; -}; - - -ProfilerStubHelper.prototype.StopProfiling = function(modules) -{ - this.activeProfilerModules_ &= ~modules; -}; - - -ProfilerStubHelper.prototype.StartProfiling = function(modules) -{ - var profModules = devtools.ProfilerAgent.ProfilerModules; - if (modules & profModules.PROFILER_MODULE_HEAP_SNAPSHOT) { - if (modules & profModules.PROFILER_MODULE_HEAP_STATS) { - this.log_ += - 'heap-sample-begin,"Heap","allocated",' + - (new Date()).getTime() + '\n' + - 'heap-sample-stats,"Heap","allocated",10000,1000\n'; - this.log_ += - 'heap-sample-item,STRING_TYPE,100,1000\n' + - 'heap-sample-item,CODE_TYPE,10,200\n' + - 'heap-sample-item,MAP_TYPE,20,350\n'; - this.log_ += ProfilerStubHelper.HeapSamples[this.heapProfSample_++]; - this.heapProfSample_ %= ProfilerStubHelper.HeapSamples.length; - this.log_ += 'heap-sample-end,"Heap","allocated"\n'; - } - } else { - if (modules & profModules.PROFILER_MODULE_CPU) - this.log_ += ProfilerStubHelper.ProfilerLogBuffer; - this.activeProfilerModules_ |= modules; - } -}; - - -ProfilerStubHelper.prototype.getActiveProfilerModules = function() -{ - var self = this; - setTimeout(function() { - RemoteProfilerAgent.didGetActiveProfilerModules(self.activeProfilerModules_); - }, 100); -}; - - -ProfilerStubHelper.prototype.getLogLines = function(pos) -{ - var profModules = devtools.ProfilerAgent.ProfilerModules; - var logLines = this.log_.substr(pos); - setTimeout(function() { - RemoteProfilerAgent.didGetLogLines(pos + logLines.length, logLines); - }, 100); -}; - - -ProfilerStubHelper.ProfilerLogBuffer = - 'profiler,begin,1\n' + - 'profiler,resume\n' + - 'code-creation,LazyCompile,0x1000,256,"test1 http://aaa.js:1"\n' + - 'code-creation,LazyCompile,0x2000,256,"test2 http://bbb.js:2"\n' + - 'code-creation,LazyCompile,0x3000,256,"test3 http://ccc.js:3"\n' + - 'tick,0x1010,0x0,3\n' + - 'tick,0x2020,0x0,3,0x1010\n' + - 'tick,0x2020,0x0,3,0x1010\n' + - 'tick,0x3010,0x0,3,0x2020, 0x1010\n' + - 'tick,0x2020,0x0,3,0x1010\n' + - 'tick,0x2030,0x0,3,0x2020, 0x1010\n' + - 'tick,0x2020,0x0,3,0x1010\n' + - 'tick,0x1010,0x0,3\n' + - 'profiler,pause\n'; - - -ProfilerStubHelper.HeapSamples = [ - 'heap-js-cons-item,foo,1,100\n' + - 'heap-js-cons-item,bar,20,2000\n' + - 'heap-js-cons-item,Object,5,100\n' + - 'heap-js-ret-item,foo,bar;3\n' + - 'heap-js-ret-item,bar,foo;5\n' + - 'heap-js-ret-item,Object:0x1234,(roots);1\n', - - 'heap-js-cons-item,foo,2000,200000\n' + - 'heap-js-cons-item,bar,10,1000\n' + - 'heap-js-cons-item,Object,6,120\n' + - 'heap-js-ret-item,foo,bar;7,Object:0x1234;10\n' + - 'heap-js-ret-item,bar,foo;10,Object:0x1234;10\n' + - 'heap-js-ret-item,Object:0x1234,(roots);1\n', - - 'heap-js-cons-item,foo,15,1500\n' + - 'heap-js-cons-item,bar,15,1500\n' + - 'heap-js-cons-item,Object,5,100\n' + - 'heap-js-cons-item,Array,3,1000\n' + - 'heap-js-ret-item,foo,bar;3,Array:0x5678;1\n' + - 'heap-js-ret-item,bar,foo;5,Object:0x1234;8,Object:0x5678;2\n' + - 'heap-js-ret-item,Object:0x1234,(roots);1,Object:0x5678;2\n' + - 'heap-js-ret-item,Object:0x5678,(global property);3,Object:0x1234;5\n' + - 'heap-js-ret-item,Array:0x5678,(global property);3,Array:0x5678;2\n', - - 'heap-js-cons-item,bar,20,2000\n' + - 'heap-js-cons-item,Object,6,120\n' + - 'heap-js-ret-item,bar,foo;5,Object:0x1234;1,Object:0x1235;3\n' + - 'heap-js-ret-item,Object:0x1234,(global property);3\n' + - 'heap-js-ret-item,Object:0x1235,(global property);5\n', - - 'heap-js-cons-item,foo,15,1500\n' + - 'heap-js-cons-item,bar,15,1500\n' + - 'heap-js-cons-item,Array,10,1000\n' + - 'heap-js-ret-item,foo,bar;1,Array:0x5678;1\n' + - 'heap-js-ret-item,bar,foo;5\n' + - 'heap-js-ret-item,Array:0x5678,(roots);3\n', - - 'heap-js-cons-item,bar,20,2000\n' + - 'heap-js-cons-item,baz,15,1500\n' + - 'heap-js-ret-item,bar,baz;3\n' + - 'heap-js-ret-item,baz,bar;3\n' -]; - - -/** - * @constructor - */ -RemoteDebuggerCommandExecutorStub = function() -{ -}; - - -RemoteDebuggerCommandExecutorStub.prototype.DebuggerCommand = function(cmd) -{ - if ('{"seq":2,"type":"request","command":"scripts","arguments":{"includeSource":false}}' === cmd) { - var response1 = - '{"seq":5,"request_seq":2,"type":"response","command":"scripts","' + - 'success":true,"body":[{"handle":61,"type":"script","name":"' + - 'http://www/~test/t.js","id":59,"lineOffset":0,"columnOffset":0,' + - '"lineCount":1,"sourceStart":"function fib(n) {","sourceLength":300,' + - '"scriptType":2,"compilationType":0,"context":{"ref":60}}],"refs":[{' + - '"handle":60,"type":"context","data":"page,3"}],"running":false}'; - this.sendResponse_(response1); - } else if ('{"seq":3,"type":"request","command":"scripts","arguments":{"ids":[59],"includeSource":true}}' === cmd) { - this.sendResponse_( - '{"seq":8,"request_seq":3,"type":"response","command":"scripts",' + - '"success":true,"body":[{"handle":1,"type":"script","name":' + - '"http://www/~test/t.js","id":59,"lineOffset":0,"columnOffset":0,' + - '"lineCount":1,"source":"function fib(n) {return n+1;}",' + - '"sourceLength":244,"scriptType":2,"compilationType":0,"context":{' + - '"ref":0}}],"refs":[{"handle":0,"type":"context","data":"page,3}],"' + - '"running":false}'); - } else if (cmd.indexOf('"command":"profile"') !== -1) { - var cmdObj = JSON.parse(cmd); - if (cmdObj.arguments.command === "resume") - ProfilerStubHelper.GetInstance().StartProfiling(parseInt(cmdObj.arguments.modules)); - else if (cmdObj.arguments.command === "pause") - ProfilerStubHelper.GetInstance().StopProfiling(parseInt(cmdObj.arguments.modules)); - else - debugPrint("Unexpected profile command: " + cmdObj.arguments.command); - } else - debugPrint("Unexpected command: " + cmd); -}; - - -RemoteDebuggerCommandExecutorStub.prototype.DebuggerPauseScript = function() -{ -}; - - -RemoteDebuggerCommandExecutorStub.prototype.sendResponse_ = function(response) -{ - setTimeout(function() { - RemoteDebuggerAgent.debuggerOutput(response); - }, 0); -}; - - -DevToolsHostStub = function() -{ - this.isStub = true; -}; -DevToolsHostStub.prototype.__proto__ = WebInspector.InspectorFrontendHostStub.prototype; - - -DevToolsHostStub.prototype.reset = function() -{ -}; - - -DevToolsHostStub.prototype.setting = function() -{ -}; - - -DevToolsHostStub.prototype.setSetting = function() -{ -}; - - -window["RemoteDebuggerAgent"] = new RemoteDebuggerAgentStub(); -window["RemoteDebuggerCommandExecutor"] = new RemoteDebuggerCommandExecutorStub(); -window["RemoteProfilerAgent"] = new RemoteProfilerAgentStub(); -window["RemoteToolsAgent"] = new RemoteToolsAgentStub(); -InspectorFrontendHost = new DevToolsHostStub(); - +if (!window["RemoteDebuggerCommandExecutor"]) { + window["RemoteDebuggerCommandExecutor"] = {}; } diff --git a/WebKit/chromium/src/js/HeapProfilerPanel.js b/WebKit/chromium/src/js/HeapProfilerPanel.js index abbf580..bcb008f 100644 --- a/WebKit/chromium/src/js/HeapProfilerPanel.js +++ b/WebKit/chromium/src/js/HeapProfilerPanel.js @@ -205,7 +205,7 @@ WebInspector.HeapSnapshotView.prototype = { // Call searchCanceled since it will reset everything we need before doing a new search. this.searchCanceled(); - query = query.trimWhitespace(); + query = query.trim(); if (!query.length) return; @@ -932,12 +932,12 @@ WebInspector.HeapSnapshotProfileType.prototype = { buttonClicked: function() { - InspectorBackend.takeHeapSnapshot(); + devtools.tools.getProfilerAgent().startProfiling(devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_HEAP_SNAPSHOT); }, get welcomeMessage() { - return WebInspector.UIString("Get a heap snapshot by pressing<br>the %s button on the status bar."); + return WebInspector.UIString("Get a heap snapshot by pressing the %s button on the status bar."); }, createSidebarTreeElementForProfile: function(profile) diff --git a/WebKit/chromium/src/js/Images/segmentChromium.png b/WebKit/chromium/src/js/Images/segmentChromium.png Binary files differindex 607559b..f4248e1 100755 --- a/WebKit/chromium/src/js/Images/segmentChromium.png +++ b/WebKit/chromium/src/js/Images/segmentChromium.png diff --git a/WebKit/chromium/src/js/Images/statusbarBackgroundChromium.png b/WebKit/chromium/src/js/Images/statusbarBackgroundChromium.png Binary files differindex 9d326ac..7a760c1 100755 --- a/WebKit/chromium/src/js/Images/statusbarBackgroundChromium.png +++ b/WebKit/chromium/src/js/Images/statusbarBackgroundChromium.png diff --git a/WebKit/chromium/src/js/Images/statusbarBottomBackgroundChromium.png b/WebKit/chromium/src/js/Images/statusbarBottomBackgroundChromium.png Binary files differindex 7c7db0a..e3bc944 100755 --- a/WebKit/chromium/src/js/Images/statusbarBottomBackgroundChromium.png +++ b/WebKit/chromium/src/js/Images/statusbarBottomBackgroundChromium.png diff --git a/WebKit/chromium/src/js/Images/statusbarButtonsChromium.png b/WebKit/chromium/src/js/Images/statusbarButtonsChromium.png Binary files differindex 0c6635d..136d5a8 100755 --- a/WebKit/chromium/src/js/Images/statusbarButtonsChromium.png +++ b/WebKit/chromium/src/js/Images/statusbarButtonsChromium.png diff --git a/WebKit/chromium/src/js/Images/statusbarMenuButtonChromium.png b/WebKit/chromium/src/js/Images/statusbarMenuButtonChromium.png Binary files differindex bf26684..5ff61d9 100755 --- a/WebKit/chromium/src/js/Images/statusbarMenuButtonChromium.png +++ b/WebKit/chromium/src/js/Images/statusbarMenuButtonChromium.png diff --git a/WebKit/chromium/src/js/InjectDispatch.js b/WebKit/chromium/src/js/InjectDispatch.js deleted file mode 100644 index e070c42..0000000 --- a/WebKit/chromium/src/js/InjectDispatch.js +++ /dev/null @@ -1,106 +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); -}; - -/** - * Special controller object for APU related messages. Outgoing messages - * are sent to this object if the ApuAgentDispatcher is enabled. - **/ -var ApuAgentDispatcher = { enabled : false }; - -/** - * Dispatches messages to APU. This filters and transforms - * outgoing messages that are used by APU. - * @param {string} method name of the dispatch method. - **/ -ApuAgentDispatcher.dispatchToApu = function(method, args) -{ - if (method !== "addRecordToTimeline" && method !== "updateResource" && method !== "addResource") - return; - // TODO(knorton): Transform args so they can be used - // by APU. - DevToolsAgentHost.dispatchToApu(JSON.stringify(args)); -}; - -/** - * 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) { - // Handle all messages with non-primitieve arguments here. - var args = Array.prototype.slice.call(arguments); - - if (method === "inspectedWindowCleared" || method === "reset" || method === "setAttachedWindow") { - // Filter out messages we don't need here. - // We do it on the sender side since they may have non-serializable - // parameters. - return; - } - - // Sniff some inspector controller state changes in order to support - // cross-navigation instrumentation. Keep names in sync with - // webdevtoolsagent_impl. - if (method === "timelineProfilerWasStarted") - DevToolsAgentHost.runtimeFeatureStateChanged("timeline-profiler", true); - else if (method === "timelineProfilerWasStopped") - DevToolsAgentHost.runtimeFeatureStateChanged("timeline-profiler", false); - else if (method === "resourceTrackingWasEnabled") - DevToolsAgentHost.runtimeFeatureStateChanged("resource-tracking", true); - else if (method === "resourceTrackingWasDisabled") - DevToolsAgentHost.runtimeFeatureStateChanged("resource-tracking", false); - - if (ApuAgentDispatcher.enabled) { - ApuAgentDispatcher.dispatchToApu(method, args); - return; - } - - var call = JSON.stringify(args); - DevToolsAgentHost.dispatch(call); -}; diff --git a/WebKit/chromium/src/js/InspectorControllerImpl.js b/WebKit/chromium/src/js/InspectorControllerImpl.js deleted file mode 100644 index c92a94c..0000000 --- a/WebKit/chromium/src/js/InspectorControllerImpl.js +++ /dev/null @@ -1,279 +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 DevTools' implementation of the InspectorController API. - */ - -if (!this.devtools) - devtools = {}; - -devtools.InspectorBackendImpl = function() -{ - WebInspector.InspectorBackendStub.call(this); - this.installInspectorControllerDelegate_("clearMessages"); - this.installInspectorControllerDelegate_("copyNode"); - this.installInspectorControllerDelegate_("deleteCookie"); - this.installInspectorControllerDelegate_("didEvaluateForTestInFrontend"); - this.installInspectorControllerDelegate_("disableResourceTracking"); - this.installInspectorControllerDelegate_("disableTimeline"); - this.installInspectorControllerDelegate_("enableResourceTracking"); - this.installInspectorControllerDelegate_("enableTimeline"); - this.installInspectorControllerDelegate_("getChildNodes"); - this.installInspectorControllerDelegate_("getCookies"); - this.installInspectorControllerDelegate_("getDatabaseTableNames"); - this.installInspectorControllerDelegate_("getDOMStorageEntries"); - this.installInspectorControllerDelegate_("getEventListenersForNode"); - this.installInspectorControllerDelegate_("getResourceContent"); - this.installInspectorControllerDelegate_("highlightDOMNode"); - this.installInspectorControllerDelegate_("hideDOMNodeHighlight"); - this.installInspectorControllerDelegate_("releaseWrapperObjectGroup"); - this.installInspectorControllerDelegate_("removeAttribute"); - this.installInspectorControllerDelegate_("removeDOMStorageItem"); - this.installInspectorControllerDelegate_("removeNode"); - this.installInspectorControllerDelegate_("saveFrontendSettings"); - this.installInspectorControllerDelegate_("setAttribute"); - this.installInspectorControllerDelegate_("setDOMStorageItem"); - this.installInspectorControllerDelegate_("setInjectedScriptSource"); - this.installInspectorControllerDelegate_("setTextNodeValue"); - this.installInspectorControllerDelegate_("startTimelineProfiler"); - this.installInspectorControllerDelegate_("stopTimelineProfiler"); - this.installInspectorControllerDelegate_("storeLastActivePanel"); -}; -devtools.InspectorBackendImpl.prototype.__proto__ = WebInspector.InspectorBackendStub.prototype; - - -/** - * {@inheritDoc}. - */ -devtools.InspectorBackendImpl.prototype.toggleNodeSearch = function() -{ - WebInspector.InspectorBackendStub.prototype.toggleNodeSearch.call(this); - this.callInspectorController_.call(this, "toggleNodeSearch"); - if (!this.searchingForNode()) { - // This is called from ElementsPanel treeOutline's focusNodeChanged(). - DevToolsHost.activateWindow(); - } -}; - - -/** - * @override - */ -devtools.InspectorBackendImpl.prototype.debuggerEnabled = function() -{ - return true; -}; - - -/** - * @override - */ -devtools.InspectorBackendImpl.prototype.profilerEnabled = function() -{ - return true; -}; - - -devtools.InspectorBackendImpl.prototype.addBreakpoint = function(sourceID, line, condition) -{ - devtools.tools.getDebuggerAgent().addBreakpoint(sourceID, line, condition); -}; - - -devtools.InspectorBackendImpl.prototype.removeBreakpoint = function(sourceID, line) -{ - devtools.tools.getDebuggerAgent().removeBreakpoint(sourceID, line); -}; - -devtools.InspectorBackendImpl.prototype.updateBreakpoint = function(sourceID, line, condition) -{ - devtools.tools.getDebuggerAgent().updateBreakpoint(sourceID, line, condition); -}; - -devtools.InspectorBackendImpl.prototype.pauseInDebugger = function() -{ - devtools.tools.getDebuggerAgent().pauseExecution(); -}; - - -devtools.InspectorBackendImpl.prototype.resumeDebugger = function() -{ - devtools.tools.getDebuggerAgent().resumeExecution(); -}; - - -devtools.InspectorBackendImpl.prototype.stepIntoStatementInDebugger = function() -{ - devtools.tools.getDebuggerAgent().stepIntoStatement(); -}; - - -devtools.InspectorBackendImpl.prototype.stepOutOfFunctionInDebugger = function() -{ - devtools.tools.getDebuggerAgent().stepOutOfFunction(); -}; - - -devtools.InspectorBackendImpl.prototype.stepOverStatementInDebugger = function() -{ - devtools.tools.getDebuggerAgent().stepOverStatement(); -}; - -/** - * @override - */ -devtools.InspectorBackendImpl.prototype.setPauseOnExceptionsState = function(state) -{ - this._setPauseOnExceptionsState = state; - // TODO(yurys): support all three states. See http://crbug.com/32877 - var enabled = (state !== WebInspector.ScriptsPanel.PauseOnExceptionsState.DontPauseOnExceptions); - return devtools.tools.getDebuggerAgent().setPauseOnExceptions(enabled); -}; - -/** - * @override - */ -devtools.InspectorBackendImpl.prototype.pauseOnExceptionsState = function() -{ - return (this._setPauseOnExceptionsState || WebInspector.ScriptsPanel.PauseOnExceptionsState.DontPauseOnExceptions); -}; - -/** - * @override - */ -devtools.InspectorBackendImpl.prototype.pauseOnExceptions = function() -{ - return devtools.tools.getDebuggerAgent().pauseOnExceptions(); -}; - - -/** - * @override - */ -devtools.InspectorBackendImpl.prototype.setPauseOnExceptions = function(value) -{ - return devtools.tools.getDebuggerAgent().setPauseOnExceptions(value); -}; - - -/** - * @override - */ -devtools.InspectorBackendImpl.prototype.startProfiling = function() -{ - devtools.tools.getProfilerAgent().startProfiling(devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_CPU); -}; - - -/** - * @override - */ -devtools.InspectorBackendImpl.prototype.stopProfiling = function() -{ - devtools.tools.getProfilerAgent().stopProfiling( devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_CPU); -}; - - -/** - * @override - */ -devtools.InspectorBackendImpl.prototype.getProfileHeaders = function(callId) -{ - WebInspector.didGetProfileHeaders(callId, []); -}; - - -/** - * Emulate WebKit InspectorController behavior. It stores profiles on renderer side, - * and is able to retrieve them by uid using "getProfile". - */ -devtools.InspectorBackendImpl.prototype.addFullProfile = function(profile) -{ - WebInspector.__fullProfiles = WebInspector.__fullProfiles || {}; - WebInspector.__fullProfiles[profile.uid] = profile; -}; - - -/** - * @override - */ -devtools.InspectorBackendImpl.prototype.getProfile = function(callId, uid) -{ - if (WebInspector.__fullProfiles && (uid in WebInspector.__fullProfiles)) - WebInspector.didGetProfile(callId, WebInspector.__fullProfiles[uid]); -}; - - -/** - * @override - */ -devtools.InspectorBackendImpl.prototype.takeHeapSnapshot = function() -{ - devtools.tools.getProfilerAgent().startProfiling(devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_HEAP_SNAPSHOT - | devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_HEAP_STATS - | devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_JS_CONSTRUCTORS); -}; - - -/** - * @override - */ -devtools.InspectorBackendImpl.prototype.dispatchOnInjectedScript = function(callId, injectedScriptId, methodName, argsString, async) -{ - // Encode injectedScriptId into callId - if (typeof injectedScriptId !== "number") - injectedScriptId = 0; - RemoteToolsAgent.dispatchOnInjectedScript(callId, injectedScriptId, methodName, argsString, async); -}; - - -/** - * Installs delegating handler into the inspector controller. - * @param {string} methodName Method to install delegating handler for. - */ -devtools.InspectorBackendImpl.prototype.installInspectorControllerDelegate_ = function(methodName) -{ - this[methodName] = this.callInspectorController_.bind(this, methodName); -}; - - -/** - * Bound function with the installInjectedScriptDelegate_ actual - * implementation. - */ -devtools.InspectorBackendImpl.prototype.callInspectorController_ = function(methodName, var_arg) -{ - var args = Array.prototype.slice.call(arguments, 1); - RemoteToolsAgent.dispatchOnInspectorController(WebInspector.Callback.wrap(function(){}), methodName, JSON.stringify(args)); -}; - - -InspectorBackend = new devtools.InspectorBackendImpl(); diff --git a/WebKit/chromium/src/js/ProfilerAgent.js b/WebKit/chromium/src/js/ProfilerAgent.js index e08c5d2..7f74595 100644 --- a/WebKit/chromium/src/js/ProfilerAgent.js +++ b/WebKit/chromium/src/js/ProfilerAgent.js @@ -37,20 +37,6 @@ */ devtools.ProfilerAgent = function() { - RemoteProfilerAgent.didGetActiveProfilerModules = this._didGetActiveProfilerModules.bind(this); - RemoteProfilerAgent.didGetLogLines = this._didGetLogLines.bind(this); - - /** - * Active profiler modules flags. - * @type {number} - */ - this._activeProfilerModules = devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_NONE; - - /** - * Interval for polling profiler state. - * @type {number} - */ - this._getActiveProfilerModulesInterval = null; /** * Profiler log position. @@ -65,12 +51,6 @@ devtools.ProfilerAgent = function() this._lastRequestedLogPosition = -1; /** - * Whether log contents retrieval must be forced next time. - * @type {boolean} - */ - this._forceGetLogLines = false; - - /** * Profiler processor instance. * @type {devtools.profiler.Processor} */ @@ -92,50 +72,11 @@ devtools.ProfilerAgent.ProfilerModules = { /** - * Sets up callbacks that deal with profiles processing. - */ -devtools.ProfilerAgent.prototype.setupProfilerProcessorCallbacks = function() -{ - // A temporary icon indicating that the profile is being processed. - var processingIcon = new WebInspector.SidebarTreeElement( - "profile-sidebar-tree-item", - WebInspector.UIString("Processing..."), - '', null, false); - var profilesSidebar = WebInspector.panels.profiles.getProfileType(WebInspector.CPUProfileType.TypeId).treeElement; - - this._profilerProcessor.setCallbacks( - function onProfileProcessingStarted() { - // Set visually empty string. Subtitle hiding is done via styles - // manipulation which doesn't play well with dynamic append / removal. - processingIcon.subtitle = " "; - profilesSidebar.appendChild(processingIcon); - }, - function onProfileProcessingStatus(ticksCount) { - processingIcon.subtitle = WebInspector.UIString("%d ticks processed", ticksCount); - }, - function onProfileProcessingFinished(profile) { - profilesSidebar.removeChild(processingIcon); - profile.typeId = WebInspector.CPUProfileType.TypeId; - InspectorBackend.addFullProfile(profile); - WebInspector.addProfileHeader(profile); - // If no profile is currently shown, show the new one. - var profilesPanel = WebInspector.panels.profiles; - if (!profilesPanel.visibleView) { - profilesPanel.showProfile(profile); - } - } - ); -}; - - -/** * Initializes profiling state. */ devtools.ProfilerAgent.prototype.initializeProfiling = function() { - this.setupProfilerProcessorCallbacks(); - this._forceGetLogLines = true; - this._getActiveProfilerModulesInterval = setInterval(function() { RemoteProfilerAgent.getActiveProfilerModules(); }, 1000); + this._getNextLogLines(false); }; @@ -149,10 +90,17 @@ devtools.ProfilerAgent.prototype._getNextLogLines = function(immediately) if (this._lastRequestedLogPosition == this._logPosition) return; var pos = this._lastRequestedLogPosition = this._logPosition; + + var callId = WebInspector.Callback.wrap(this._didGetProfilerLogLines.bind(this)); if (immediately) - RemoteProfilerAgent.getLogLines(pos); - else - setTimeout(function() { RemoteProfilerAgent.getLogLines(pos); }, 500); + InspectorBackend.getProfilerLogLines(callId, pos); + else { + function delayedRequest() + { + InspectorBackend.getProfilerLogLines(callId, pos); + } + setTimeout(delayedRequest, 500); + } }; @@ -162,12 +110,8 @@ devtools.ProfilerAgent.prototype._getNextLogLines = function(immediately) */ devtools.ProfilerAgent.prototype.startProfiling = function(modules) { - var cmd = new devtools.DebugCommand("profile", { - "modules": modules, - "command": "resume"}); - devtools.DebuggerAgent.sendCommand_(cmd); - RemoteDebuggerAgent.processDebugCommands(); if (modules & devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_HEAP_SNAPSHOT) { + InspectorBackend.takeHeapSnapshot(); // Active modules will not change, instead, a snapshot will be logged. this._getNextLogLines(); } @@ -175,53 +119,20 @@ devtools.ProfilerAgent.prototype.startProfiling = function(modules) /** - * Stops profiling. - */ -devtools.ProfilerAgent.prototype.stopProfiling = function(modules) -{ - var cmd = new devtools.DebugCommand("profile", { - "modules": modules, - "command": "pause"}); - devtools.DebuggerAgent.sendCommand_(cmd); - RemoteDebuggerAgent.processDebugCommands(); -}; - - -/** - * Handles current profiler status. - * @param {number} modules List of active (started) modules. - */ -devtools.ProfilerAgent.prototype._didGetActiveProfilerModules = function(modules) -{ - var profModules = devtools.ProfilerAgent.ProfilerModules; - var profModuleNone = profModules.PROFILER_MODULE_NONE; - if (this._forceGetLogLines || (modules !== profModuleNone && this._activeProfilerModules === profModuleNone)) { - this._forceGetLogLines = false; - // Start to query log data. - this._getNextLogLines(true); - } - this._activeProfilerModules = modules; - // Update buttons. - WebInspector.setRecordingProfile(modules & profModules.PROFILER_MODULE_CPU); -}; - - -/** * Handles a portion of a profiler log retrieved by getLogLines call. * @param {number} pos Current position in log. * @param {string} log A portion of profiler log. */ -devtools.ProfilerAgent.prototype._didGetLogLines = function(pos, log) +devtools.ProfilerAgent.prototype._didGetProfilerLogLines = function(pos, log) { this._logPosition = pos; - if (log.length > 0) + if (log.length > 0) { this._profilerProcessor.processLogChunk(log); - else { + this._getNextLogLines(); + } else { // Allow re-reading from the last position. this._lastRequestedLogPosition = this._logPosition - 1; - if (this._activeProfilerModules === devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_NONE) - // No new data and profiling is stopped---suspend log reading. - return; } - this._getNextLogLines(); }; + +WebInspector.didGetProfilerLogLines = WebInspector.Callback.processCallback; diff --git a/WebKit/chromium/src/js/ProfilerProcessor.js b/WebKit/chromium/src/js/ProfilerProcessor.js index f678d2c..61714e8 100644 --- a/WebKit/chromium/src/js/ProfilerProcessor.js +++ b/WebKit/chromium/src/js/ProfilerProcessor.js @@ -281,7 +281,7 @@ devtools.profiler.Processor.prototype.__proto__ = devtools.profiler.LogReader.pr */ devtools.profiler.Processor.prototype.printError = function(str) { - debugPrint(str); + WebInspector.log(str); }; diff --git a/WebKit/chromium/src/js/Tests.js b/WebKit/chromium/src/js/Tests.js index fa0c99f..41574b4 100644 --- a/WebKit/chromium/src/js/Tests.js +++ b/WebKit/chromium/src/js/Tests.js @@ -261,10 +261,10 @@ TestSuite.prototype.testEnableResourcesTab = function() var test = this; this.addSniffer(WebInspector, "updateResource", - function(identifier, payload) { + function(payload) { test.assertEquals("simple_page.html", payload.lastPathComponent); WebInspector.panels.resources.refresh(); - WebInspector.panels.resources.revealAndSelectItem(WebInspector.resources[identifier]); + WebInspector.panels.resources.revealAndSelectItem(WebInspector.resources[payload.id]); test.releaseControl(); }); @@ -289,25 +289,25 @@ TestSuite.prototype.testResourceContentLength = function() var png = false; var html = false; this.addSniffer(WebInspector, "updateResource", - function(identifier, payload) { + function(payload) { if (!payload.didLengthChange) return; - var resource = WebInspector.resources[identifier]; + var resource = WebInspector.resources[payload.id]; if (!resource || !resource.url) return; - if (resource.url.search("image.html$") !== -1) { + if (resource.url.search("image.html") !== -1) { var expectedLength = 87; test.assertTrue( - resource.contentLength <= expectedLength, + resource.resourceSize <= expectedLength, "image.html content length is greater thatn expected."); - if (expectedLength === resource.contentLength) + if (expectedLength === resource.resourceSize) html = true; } else if (resource.url.search("image.png") !== -1) { var expectedLength = 257796; test.assertTrue( - resource.contentLength <= expectedLength, + resource.resourceSize <= expectedLength, "image.png content length is greater than expected."); - if (expectedLength === resource.contentLength) + if (expectedLength === resource.resourceSize) png = true; } if (html && png) { @@ -346,8 +346,8 @@ TestSuite.prototype.testResourceHeaders = function() var timingOk = false; this.addSniffer(WebInspector, "updateResource", - function(identifier, payload) { - var resource = this.resources[identifier]; + function(payload) { + var resource = this.resources[payload.id]; if (!resource || resource.mainResource) { // We are only interested in secondary resources in this test. return; @@ -393,8 +393,8 @@ TestSuite.prototype.testCachedResourceMimeType = function() var hasReloaded = false; this.addSniffer(WebInspector, "updateResource", - function(identifier, payload) { - var resource = this.resources[identifier]; + function(payload) { + var resource = this.resources[payload.id]; if (!resource || resource.mainResource) { // We are only interested in secondary resources in this test. return; @@ -425,39 +425,83 @@ TestSuite.prototype.testProfilerTab = function() { this.showPanel("profiles"); + var panel = WebInspector.panels.profiles; var test = this; - this.addSniffer(WebInspector.panels.profiles, "addProfileHeader", - function(typeOrProfile, profile) { - if (!profile) - profile = typeOrProfile; - var panel = WebInspector.panels.profiles; - panel.showProfile(profile); - var node = panel.visibleView.profileDataGridTree.children[0]; - // Iterate over displayed functions and search for a function - // that is called "fib" or "eternal_fib". If found, it will mean - // that we actually have profiled page's code. - while (node) { - if (node.functionName.indexOf("fib") !== -1) - test.releaseControl(); - node = node.traverseNextNode(true, null, true); - } - test.fail(); - }); - var ticksCount = 0; - var tickRecord = "\nt,"; - this.addSniffer(RemoteProfilerAgent, "didGetLogLines", - function(posIgnored, log) { - var pos = 0; - while ((pos = log.indexOf(tickRecord, pos)) !== -1) { - pos += tickRecord.length; - ticksCount++; + function findDisplayedNode() { + var node = panel.visibleView.profileDataGridTree.children[0]; + if (!node) { + // Profile hadn't been queried yet, re-schedule. + window.setTimeout(findDisplayedNode, 100); + return; + } + + // Iterate over displayed functions and search for a function + // that is called "fib" or "eternal_fib". If found, this will mean + // that we actually have profiled page's code. + while (node) { + if (node.functionName.indexOf("fib") !== -1) + test.releaseControl(); + node = node.traverseNextNode(true, null, true); + } + + test.fail(); + } + + function findVisibleView() { + if (!panel.visibleView) { + setTimeout(findVisibleView, 0); + return; + } + setTimeout(findDisplayedNode, 0); + } + + findVisibleView(); + this.takeControl(); +}; + + +/** + * Tests that heap profiler works. + */ +TestSuite.prototype.testHeapProfiler = function() +{ + this.showPanel("profiles"); + + var panel = WebInspector.panels.profiles; + var test = this; + + function findDisplayedNode() { + var node = panel.visibleView.dataGrid.children[0]; + if (!node) { + // Profile hadn't been queried yet, re-schedule. + window.setTimeout(findDisplayedNode, 100); + return; + } + + // Iterate over displayed functions and find node called "A" + // If found, this will mean that we actually have taken heap snapshot. + while (node) { + if (node.constructorName.indexOf("A") !== -1) { + test.releaseControl(); + return; } - if (ticksCount > 100) - InspectorBackend.stopProfiling(); - }, true); + node = node.traverseNextNode(false, null, true); + } + + test.fail(); + } - InspectorBackend.startProfiling(); + function findVisibleView() { + if (!panel.visibleView) { + setTimeout(findVisibleView, 0); + return; + } + setTimeout(findDisplayedNode, 0); + } + + WebInspector.HeapSnapshotProfileType.prototype.buttonClicked(); + findVisibleView(); this.takeControl(); }; @@ -470,7 +514,7 @@ TestSuite.prototype.testShowScriptsTab = function() this.showPanel("scripts"); var test = this; // There should be at least main page script. - this._waitUntilScriptsAreParsed(["debugger_test_page.html$"], + this._waitUntilScriptsAreParsed(["debugger_test_page.html"], function() { test.releaseControl(); }); @@ -489,31 +533,19 @@ TestSuite.prototype.testScriptsTabIsPopulatedOnInspectedPageRefresh = function() var test = this; this.assertEquals(WebInspector.panels.elements, WebInspector.currentPanel, "Elements panel should be current one."); - this.addSniffer(devtools.DebuggerAgent.prototype, "reset", waitUntilScriptIsParsed); + this.addSniffer(WebInspector.panels.scripts, "reset", waitUntilScriptIsParsed); // Reload inspected page. It will reset the debugger agent. test.evaluateInConsole_( "window.location.reload(true);", - function(resultText) { - test.assertEquals("undefined", resultText, "Unexpected result of reload()."); - }); + function(resultText) {}); function waitUntilScriptIsParsed() { - var parsed = devtools.tools.getDebuggerAgent().parsedScripts_; - for (var id in parsed) { - var url = parsed[id].getUrl(); - if (url && url.search("debugger_test_page.html$") !== -1) { - checkScriptsPanel(); - return; - } - } - test.addSniffer(devtools.DebuggerAgent.prototype, "addScriptInfo_", waitUntilScriptIsParsed); - } - - function checkScriptsPanel() { test.showPanel("scripts"); - test.assertTrue(test._scriptsAreParsed(["debugger_test_page.html$"]), "Inspected script not found in the scripts list"); - test.releaseControl(); + test._waitUntilScriptsAreParsed(["debugger_test_page.html"], + function() { + test.releaseControl(); + }); } // Wait until all scripts are added to the debugger. @@ -530,7 +562,7 @@ TestSuite.prototype.testContentScriptIsPresent = function() var test = this; test._waitUntilScriptsAreParsed( - ["page_with_content_script.html$", "simple_content_script.js$"], + ["page_with_content_script.html", "simple_content_script.js"], function() { test.releaseControl(); }); @@ -568,7 +600,7 @@ TestSuite.prototype.testNoScriptDuplicatesOnPanelSwitch = function() function checkScriptsPanel() { test.assertTrue(!!WebInspector.panels.scripts.visibleView, "No visible script view."); - test.assertTrue(test._scriptsAreParsed(["debugger_test_page.html$"]), "Some scripts are missing."); + test.assertTrue(test._scriptsAreParsed(["debugger_test_page.html"]), "Some scripts are missing."); checkNoDuplicates(); test.releaseControl(); } @@ -584,7 +616,7 @@ TestSuite.prototype.testNoScriptDuplicatesOnPanelSwitch = function() } test._waitUntilScriptsAreParsed( - ["debugger_test_page.html$"], + ["debugger_test_page.html"], function() { checkNoDuplicates(); setTimeout(switchToElementsTab, 0); @@ -604,7 +636,7 @@ TestSuite.prototype.testSetBreakpoint = function() var test = this; this.showPanel("scripts"); - var breakpointLine = 12; + var breakpointLine = 16 this._waitUntilScriptsAreParsed(["debugger_test_page.html"], function() { @@ -612,15 +644,25 @@ TestSuite.prototype.testSetBreakpoint = function() "debugger_test_page.html", function(view, url) { view._addBreakpoint(breakpointLine); - // Force v8 execution. - RemoteDebuggerAgent.processDebugCommands(); - test.waitForSetBreakpointResponse_(url, breakpointLine, - function() { - test.releaseControl(); + + test.evaluateInConsole_( + 'setTimeout("calculate()" , 0)', + function(resultText) { + test.assertTrue(!isNaN(resultText), "Failed to get timer id: " + resultText); }); }); }); + this._waitForScriptPause( + { + functionsOnStack: ["calculate", ""], + lineNumber: breakpointLine, + lineText: " result = fib(lastVal++);" + }, + function() { + test.releaseControl(); + }); + this.takeControl(); }; @@ -633,21 +675,13 @@ TestSuite.prototype.testPauseOnException = function() this.showPanel("scripts"); var test = this; - // TODO(yurys): remove else branch once the states are supported. - if (WebInspector.ScriptsPanel.PauseOnExceptionsState) { - while (WebInspector.currentPanel.pauseOnExceptionButton.state !== WebInspector.ScriptsPanel.PauseOnExceptionsState.PauseOnUncaughtExceptions) - WebInspector.currentPanel.pauseOnExceptionButton.element.click(); - } else { - // Make sure pause on exceptions is on. - if (!WebInspector.currentPanel.pauseOnExceptionButton.toggled) - WebInspector.currentPanel.pauseOnExceptionButton.element.click(); - } + InspectorBackend.setPauseOnExceptionsState(WebInspector.ScriptsPanel.PauseOnExceptionsState.PauseOnUncaughtExceptions); - this._executeCodeWhenScriptsAreParsed("handleClick()", ["pause_on_exception.html$"]); + this._executeCodeWhenScriptsAreParsed("handleClick()", ["pause_on_exception.html"]); this._waitForScriptPause( { - functionsOnStack: ["throwAnException", "handleClick", "(anonymous function)"], + functionsOnStack: ["throwAnException", "handleClick", ""], lineNumber: 6, lineText: " return unknown_var;" }, @@ -729,7 +763,7 @@ TestSuite.prototype.testPauseWhenScriptIsRunning = function() test._waitForScriptPause( { - functionsOnStack: ["handleClick", "(anonymous function)"], + functionsOnStack: ["handleClick", ""], lineNumber: 5, lineText: " while(true) {" }, @@ -818,7 +852,7 @@ TestSuite.prototype.showMainPageScriptSource_ = function(scriptName, callback) */ TestSuite.prototype.evaluateInConsole_ = function(code, callback) { - WebInspector.console.visible = true; + WebInspector.showConsole(); WebInspector.console.prompt.text = code; WebInspector.console.promptElement.dispatchEvent( TestSuite.createKeyEvent("Enter")); @@ -829,29 +863,6 @@ TestSuite.prototype.evaluateInConsole_ = function(code, callback) }; -/* - * Waits for "setbreakpoint" response, checks that corresponding breakpoint - * was successfully set and invokes the callback if it was. - * @param {string} scriptUrl - * @param {number} breakpointLine - * @param {function()} callback - */ -TestSuite.prototype.waitForSetBreakpointResponse_ = function(scriptUrl, breakpointLine, callback) -{ - var test = this; - test.addSniffer( - devtools.DebuggerAgent.prototype, - "handleSetBreakpointResponse_", - function(msg) { - var bps = this.urlToBreakpoints_[scriptUrl]; - test.assertTrue(!!bps, "No breakpoints for line " + breakpointLine); - var line = devtools.DebuggerAgent.webkitToV8LineNumber_(breakpointLine); - test.assertTrue(!!bps[line].getV8Id(), "Breakpoint id was not assigned."); - callback(); - }); -}; - - /** * Tests eval on call frame. */ @@ -862,36 +873,30 @@ TestSuite.prototype.testEvalOnCallFrame = function() var breakpointLine = 16; var test = this; - this.addSniffer(devtools.DebuggerAgent.prototype, "handleScriptsResponse_", - function(msg) { + this._waitUntilScriptsAreParsed(["debugger_test_page.html"], + function() { test.showMainPageScriptSource_( "debugger_test_page.html", function(view, url) { view._addBreakpoint(breakpointLine); - // Force v8 execution. - RemoteDebuggerAgent.processDebugCommands(); - test.waitForSetBreakpointResponse_(url, breakpointLine, setBreakpointCallback); + + // Since breakpoints are ignored in evals' calculate() function is + // execute after zero-timeout so that the breakpoint is hit. + test.evaluateInConsole_( + 'setTimeout("calculate(123)" , 0)', + function(resultText) { + test.assertTrue(!isNaN(resultText), "Failed to get timer id: " + resultText); + waitForBreakpointHit(); + }); }); }); - function setBreakpointCallback() { - // Since breakpoints are ignored in evals' calculate() function is - // execute after zero-timeout so that the breakpoint is hit. - test.evaluateInConsole_( - 'setTimeout("calculate(123)" , 0)', - function(resultText) { - test.assertTrue(!isNaN(resultText), "Failed to get timer id: " + resultText); - waitForBreakpointHit(); - }); - } - function waitForBreakpointHit() { - test.addSniffer( - devtools.DebuggerAgent.prototype, - "handleBacktraceResponse_", - function(msg) { - test.assertEquals(2, this.callFrames_.length, "Unexpected stack depth on the breakpoint. " + JSON.stringify(msg)); - test.assertEquals("calculate", this.callFrames_[0].functionName, "Unexpected top frame function."); + test.addSniffer(WebInspector, + "pausedScript", + function(callFrames) { + test.assertEquals(2, callFrames.length, "Unexpected stack depth on the breakpoint. " + JSON.stringify(callFrames, null, 4)); + test.assertEquals("calculate", callFrames[0].functionName, "Unexpected top frame function."); // Evaluate "e+1" where "e" is an argument of "calculate" function. test.evaluateInConsole_( "e+1", @@ -913,19 +918,23 @@ TestSuite.prototype.testCompletionOnPause = function() { this.showPanel("scripts"); var test = this; - this._executeCodeWhenScriptsAreParsed("handleClick()", ["completion_on_pause.html$"]); + this._executeCodeWhenScriptsAreParsed("handleClick()", ["completion_on_pause.html"]); this._waitForScriptPause( { - functionsOnStack: ["innerFunction", "handleClick", "(anonymous function)"], + functionsOnStack: ["innerFunction", "handleClick", ""], lineNumber: 9, lineText: " debugger;" }, showConsole); function showConsole() { - test.addSniffer(WebInspector.console, "afterShow", testLocalsCompletion); - WebInspector.showConsole(); + if (WebInspector.currentFocusElement === WebInspector.console.promptElement) + testLocalsCompletion(); + else { + test.addSniffer(WebInspector.console, "afterShow", testLocalsCompletion); + WebInspector.showConsole(); + } } function testLocalsCompletion() { @@ -964,56 +973,7 @@ TestSuite.prototype.testCompletionOnPause = function() */ TestSuite.prototype.testAutoContinueOnSyntaxError = function() { - this.showPanel("scripts"); - var test = this; - - function checkScriptsList() { - var scriptSelect = document.getElementById("scripts-files"); - var options = scriptSelect.options; - // There should be only console API source (see - // InjectedScript._ensureCommandLineAPIInstalled) since the page script - // contains a syntax error. - for (var i = 0 ; i < options.length; i++) { - if (options[i].text.search("script_syntax_error.html$") !== -1) - test.fail("Script with syntax error should not be in the list of parsed scripts."); - } - } - - this.addSniffer(devtools.DebuggerAgent.prototype, "handleScriptsResponse_", - function(msg) { - checkScriptsList(); - - // Reload inspected page. - test.evaluateInConsole_( - "window.location.reload(true);", - function(resultText) { - test.assertEquals("undefined", resultText, "Unexpected result of reload()."); - waitForExceptionEvent(); - }); - }); - - function waitForExceptionEvent() { - var exceptionCount = 0; - test.addSniffer( - devtools.DebuggerAgent.prototype, - "handleExceptionEvent_", - function(msg) { - exceptionCount++; - test.assertEquals(1, exceptionCount, "Too many exceptions."); - test.assertEquals(undefined, msg.getBody().script, "Unexpected exception: " + JSON.stringify(msg)); - test.releaseControl(); - }); - - // Check that the script is not paused on parse error. - test.addSniffer( - WebInspector, - "pausedScript", - function(callFrames) { - test.fail("Script execution should not pause on syntax error."); - }); - } - - this.takeControl(); + // TODO(yurys): provide an implementation that works with ScriptDebugServer. }; @@ -1109,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. */ @@ -1141,7 +1082,7 @@ TestSuite.prototype._executeCodeWhenScriptsAreParsed = function(code, expectedSc test.evaluateInConsole_( 'setTimeout("' + code + '" , 0)', function(resultText) { - test.assertTrue(!isNaN(resultText), "Failed to get timer id: " + resultText); + test.assertTrue(!isNaN(resultText), "Failed to get timer id: " + resultText + ". Code: " + code); }); } @@ -1168,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","(anonymous function)"], - lineNumber: 3, - lineText: " debugger;" - }, - function() { - document.getElementById("scripts-step-over").click(); - }, - { - functionsOnStack: ["d","a","(anonymous function)"], - lineNumber: 5, - lineText: " var y = fact(10);" - }, - function() { - document.getElementById("scripts-step-over").click(); - }, - { - functionsOnStack: ["d","a","(anonymous function)"], - 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","(anonymous function)"], - lineNumber: 3, - lineText: " debugger;" - }, - function() { - document.getElementById("scripts-step-out").click(); - }, - { - functionsOnStack: ["a","(anonymous function)"], - 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","(anonymous function)"], - lineNumber: 3, - lineText: " debugger;" - }, - function() { - document.getElementById("scripts-step-over").click(); - }, - { - functionsOnStack: ["d","a","(anonymous function)"], - lineNumber: 5, - lineText: " var y = fact(10);" - }, - function() { - document.getElementById("scripts-step-into").click(); - }, - { - functionsOnStack: ["fact","d","a","(anonymous function)"], - lineNumber: 15, - lineText: " return r;" - }, - function() { - test.releaseControl(); - } - ]); - - test.takeControl(); -}; - - -/** * Gets a XPathResult matching given xpath. * @param {string} xpath * @param {number} resultType @@ -1437,11 +1253,11 @@ TestSuite.prototype.testExpandScope = function() this.showPanel("scripts"); var test = this; - this._executeCodeWhenScriptsAreParsed("handleClick()", ["debugger_closure.html$"]); + this._executeCodeWhenScriptsAreParsed("handleClick()", ["debugger_closure.html"]); this._waitForScriptPause( { - functionsOnStack: ["innerFunction", "handleClick", "(anonymous function)"], + functionsOnStack: ["innerFunction", "handleClick", ""], lineNumber: 8, lineText: " debugger;" }, @@ -1464,14 +1280,14 @@ TestSuite.prototype.testExpandScope = function() properties: { x:"2009", innerFunctionLocalVar:"2011", - "this": "global", + "this": "DOMWindow", } }, { title: "Closure", properties: { - n:"TextParam", - makeClosureLocalVar:"local.TextParam", + n: '"TextParam"', + makeClosureLocalVar: '"local.TextParam"', } }, { @@ -1543,128 +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", "(anonymous function)"], - 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", "Object", [ - "constructor", "function Child()", [ - "constructor", "function Function()", null, - "name", "Child", null, - "prototype", "Object", [ - "childProtoField", 21, null - ] - ], - - "__proto__", "Object", [ - "__proto__", "Object", [ - "__proto__", "Object", [ - "__proto__", "null", null, - "constructor", "function Object()", null, - ], - "constructor", "function Parent()", [ - "name", "Parent", null, - "prototype", "Object", [ - "parentProtoField", 11, null, - ] - ], - "parentProtoField", 11, null, - ], - "constructor", "function Child()", null, - "childProtoField", 21, null, - ], - - "parentField", 10, null, - "childField", 20, null, - ] - ]; - - checkProperty(localScopeSection.propertiesTreeOutline, "<Local Scope>", scopeExpectations); - } - - var propQueue = []; - var index = 0; - var expectedFinalIndex = 8; - - 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() @@ -1699,96 +1393,43 @@ TestSuite.createKeyEvent = function(keyIdentifier) /** - * Tests console eval. + * Tests the message loop re-entrancy. */ -TestSuite.prototype.testConsoleEval = function() +TestSuite.prototype.testMessageLoopReentrant = 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.console.visible = true; - var messages = WebInspector.console.messages; - var index = 0; + this.showPanel("scripts"); - 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); - }; + var breakpointLine = 16; - 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); -}; + WebInspector.showConsole(); + this._waitUntilScriptsAreParsed(["debugger_test_page.html"], + function() { + test.showMainPageScriptSource_( + "debugger_test_page.html", + function(view, url) { + view._addBreakpoint(breakpointLine); -/** - * Tests eval of global objects. - */ -TestSuite.prototype.testEvalGlobal = function() -{ - WebInspector.console.visible = true; + test.evaluateInConsole_( + 'setTimeout("calculate()", 0)', + function(resultText) { + test.assertTrue(!isNaN(resultText), "Failed to get timer id: " + resultText); + }); - 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); + // Wait until script is paused. + this.addSniffer( + WebInspector, + "pausedScript", + function(callFrames) { + test.evaluateInConsole_( + 'document.cookie', + test.releaseControl.bind(test)); // This callback will be invoked only if the test succeeds (i.e. no crash). + }); - initEval(inputs[inputIndex++]); this.takeControl(); }; @@ -1855,8 +1496,37 @@ uiTests.runAllTests = function() */ uiTests.runTest = function(name) { - new TestSuite().runTest(name); + if (uiTests._populatedInterface) + new TestSuite().runTest(name); + else + uiTests._pendingTestName = name; }; +(function() { + +function runTests() +{ + uiTests._populatedInterface = true; + var name = uiTests._pendingTestName; + delete uiTests._pendingTestName; + if (name) + new TestSuite().runTest(name); +} + +var oldShowElementsPanel = WebInspector.showElementsPanel; +WebInspector.showElementsPanel = function() +{ + oldShowElementsPanel.call(this); + runTests(); +} + +var oldShowPanel = WebInspector.showPanel; +WebInspector.showPanel = function(name) +{ + oldShowPanel.call(this, name); + runTests(); +} + +})(); } diff --git a/WebKit/chromium/src/js/devTools.css b/WebKit/chromium/src/js/devTools.css index 1fa935f..dfcaadf 100755 --- a/WebKit/chromium/src/js/devTools.css +++ b/WebKit/chromium/src/js/devTools.css @@ -1,7 +1,3 @@ -#scripts-files option.injected { - color: rgb(70, 134, 240); -} - .data-grid table { line-height: 120%; } @@ -13,16 +9,33 @@ body.attached #toolbar { padding-left: 0; } - /* Chrome theme overrides */ -body.platform-windows #toolbar { - background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(242, 247, 253)), to(rgb(223, 234, 248))); + +body.platform-windows #toolbar, body.platform-windows.inactive #toolbar { + background-image: none; +} + +body.detached.platform-mac-leopard #toolbar { + background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(175, 175, 175)), to(rgb(151, 151, 151))) !important; } -body.platform-windows.inactive #toolbar { - background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(248, 248, 248)), to(rgb(237, 237, 237))); +body.detached.platform-mac-leopard.inactive #toolbar { + background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(221, 221, 221)), to(rgb(207, 207, 207))) !important; } +body.detached.platform-mac-snowleopard #toolbar { + background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(189, 189, 189)), to(rgb(151, 151, 151))) !important; +} + +body.detached.platform-mac-snowleopard.inactive #toolbar { + background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(215, 215, 215)), to(rgb(207, 207, 207))) !important; +} + +body.platform-linux #scripts-files { + font-size: 11px; + font-weight: normal; + line-height: 12px; +} /* Heap Profiler Styles */ @@ -136,77 +149,75 @@ body.platform-windows.inactive #toolbar { left: 25%; } -body.platform-windows .section > .header { +.section > .header { border: 1px solid rgb(92, 116, 157); background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(105, 133, 180)), to(rgb(92, 116, 157))); } -body.platform-windows .console-group-messages .section > .header { +.console-group-messages .section > .header { padding: 0 8px 0 0; background-image: none; border: none; min-height: 0; } -body.platform-windows #resources-filter { +#resources-filter { background: -webkit-gradient(linear, left top, left bottom, from(rgb(233, 233, 233)), to(rgb(233, 233, 233))); } -body.platform-windows .crumbs .crumb { +.crumbs .crumb { -webkit-border-image: url(Images/segmentChromium.png) 0 12 0 2; + margin-right: -3px; + padding-left: 6px; } -body.platform-windows .crumbs .crumb.end { - -webkit-border-image: url(Images/segmentEndChromium.png) 0 2 0 2; -} - -body.platform-windows .crumbs .crumb.selected { +.crumbs .crumb.selected { -webkit-border-image: url(Images/segmentSelectedChromium.png) 0 12 0 2; color: white; text-shadow: rgba(255, 255, 255, 0.5) 0 0px 0; } -body.platform-windows .crumbs .crumb.selected:hover { +.crumbs .crumb.selected:hover { -webkit-border-image: url(Images/segmentSelectedChromium.png) 0 12 0 2; } -body.platform-windows .crumbs .crumb.selected.end, .crumbs .crumb.selected.end:hover { +.crumbs .crumb.selected.end, .crumbs .crumb.selected.end:hover { -webkit-border-image: url(Images/segmentSelectedEndChromium.png) 0 2 0 2; } -body.platform-windows .crumbs .crumb:hover { +.crumbs .crumb:hover { -webkit-border-image: url(Images/segmentHoverChromium.png) 0 12 0 2; } -body.platform-windows .crumbs .crumb.dimmed:hover { +.crumbs .crumb.dimmed:hover { -webkit-border-image: url(Images/segmentHoverChromium.png) 0 12 0 2; } -body.platform-windows .crumbs .crumb.end:hover { +.crumbs .crumb.end:hover { -webkit-border-image: url(Images/segmentHoverEndChromium.png) 0 2 0 2; } -body.platform-windows body.drawer-visible #main-status-bar { +body.drawer-visible #main-status-bar { background-image: url(Images/statusbarResizerVertical.png), url(Images/statusbarBackgroundChromium.png); } -body.platform-windows .status-bar { +.status-bar { background-image: url(Images/statusbarBackgroundChromium.png); } -body.platform-windows button.status-bar-item { +button.status-bar-item { background-image: url(Images/statusbarButtonsChromium.png); } -body.platform-windows select.status-bar-item:active { +select.status-bar-item:active { -webkit-border-image: url(Images/statusbarMenuButtonSelectedChromium.png) 0 17 0 2; } -body.platform-windows #drawer { +#drawer { background-image: url(Images/statusbarBottomBackgroundChromium.png); } -body.platform-windows select.status-bar-item { +select.status-bar-item { -webkit-border-image: url(Images/statusbarMenuButtonChromium.png) 0 17 0 2; } @@ -218,6 +229,6 @@ body.platform-windows select.status-bar-item { -webkit-box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.0); } -.timeline-category-tree-item input { +.timeline-category-statusbar-item input { vertical-align: middle; } diff --git a/WebKit/chromium/src/linux/WebFontRenderStyle.cpp b/WebKit/chromium/src/linux/WebFontRenderStyle.cpp new file mode 100644 index 0000000..0b864d1 --- /dev/null +++ b/WebKit/chromium/src/linux/WebFontRenderStyle.cpp @@ -0,0 +1,60 @@ +/* + * 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 "WebFontRenderStyle.h" + +#include "FontRenderStyle.h" + +using WebCore::FontRenderStyle; + +namespace WebKit { + +void WebFontRenderStyle::toFontRenderStyle(FontRenderStyle* out) +{ + out->useBitmaps = useBitmaps; + out->useAutoHint = useAutoHint; + out->useHinting = useHinting; + out->hintStyle = hintStyle; + out->useAntiAlias = useAntiAlias; + out->useSubpixel = useSubpixel; +} + +void WebFontRenderStyle::setDefaults() +{ + useBitmaps = 2; + useAutoHint = 2; + useHinting = 2; + hintStyle = 0; + useAntiAlias = 2; + useSubpixel = 2; +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/mac/WebInputEventFactory.mm b/WebKit/chromium/src/mac/WebInputEventFactory.mm index 46b0afe..694155f 100644 --- a/WebKit/chromium/src/mac/WebInputEventFactory.mm +++ b/WebKit/chromium/src/mac/WebInputEventFactory.mm @@ -861,6 +861,29 @@ static inline int modifiersFromEvent(NSEvent* event) { return modifiers; } +static inline void setWebEventLocationFromEventInView(WebMouseEvent* result, + NSEvent* event, + NSView* view) { + NSPoint windowLocal = [event locationInWindow]; + + NSPoint screenLocal = [[view window] convertBaseToScreen:windowLocal]; + result->globalX = screenLocal.x; + // Flip y. + NSScreen* primaryScreen = ([[NSScreen screens] count] > 0) ? + [[NSScreen screens] objectAtIndex:0] : nil; + if (primaryScreen) + result->globalY = [primaryScreen frame].size.height - screenLocal.y; + else + result->globalY = screenLocal.y; + + NSPoint contentLocal = [view convertPoint:windowLocal fromView:nil]; + result->x = contentLocal.x; + result->y = [view frame].size.height - contentLocal.y; // Flip y. + + result->windowX = result->x; + result->windowY = result->y; +} + WebKeyboardEvent WebInputEventFactory::keyboardEvent(NSEvent* event) { WebKeyboardEvent result; @@ -1021,16 +1044,7 @@ WebMouseEvent WebInputEventFactory::mouseEvent(NSEvent* event, NSView* view) ASSERT_NOT_REACHED(); } - NSPoint location = [NSEvent mouseLocation]; // global coordinates - result.globalX = location.x; - result.globalY = [[[view window] screen] frame].size.height - location.y; - - NSPoint windowLocal = [event locationInWindow]; - location = [view convertPoint:windowLocal fromView:nil]; - result.y = [view frame].size.height - location.y; // flip y - result.x = location.x; - result.windowX = result.x; - result.windowY = result.y; + setWebEventLocationFromEventInView(&result, event, view); result.modifiers = modifiersFromEvent(event); @@ -1050,16 +1064,7 @@ WebMouseWheelEvent WebInputEventFactory::mouseWheelEvent(NSEvent* event, NSView* result.modifiers = modifiersFromEvent(event); - // Set coordinates by translating event coordinates from screen to client. - NSPoint location = [NSEvent mouseLocation]; // global coordinates - result.globalX = location.x; - result.globalY = location.y; - NSPoint windowLocal = [event locationInWindow]; - location = [view convertPoint:windowLocal fromView:nil]; - result.x = location.x; - result.y = [view frame].size.height - location.y; // flip y - result.windowX = result.x; - result.windowY = result.y; + setWebEventLocationFromEventInView(&result, event, view); // Of Mice and Men // --------------- diff --git a/WebKit/chromium/tests/DragImageTest.cpp b/WebKit/chromium/tests/DragImageTest.cpp new file mode 100644 index 0000000..8ce6fe2 --- /dev/null +++ b/WebKit/chromium/tests/DragImageTest.cpp @@ -0,0 +1,151 @@ +/* + * 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 <gtest/gtest.h> + +#include "DragImage.h" +#include "Image.h" +#include "NativeImageSkia.h" + +using namespace WebCore; + +namespace { + +class TestImage : public Image { +public: + + static PassRefPtr<TestImage> create(const IntSize& size) + { + return adoptRef(new TestImage(size)); + } + + explicit TestImage(const IntSize& size) + : Image(0) + , m_size(size) + { + m_nativeImage = new NativeImageSkia(); + m_nativeImage->setConfig(SkBitmap::kARGB_8888_Config, + size.width(), size.height(), 0); + m_nativeImage->allocPixels(); + } + + virtual ~TestImage() + { + delete m_nativeImage; + } + + virtual IntSize size() const + { + return m_size; + } + + virtual NativeImagePtr nativeImageForCurrentFrame() + { + if (m_size.isZero()) + return 0; + + return m_nativeImage; + } + + // Stub implementations of pure virtual Image functions. + virtual void destroyDecodedData(bool) + { + } + + virtual unsigned int decodedSize() const + { + return 0u; + } + + virtual void draw(WebCore::GraphicsContext*, const WebCore::FloatRect&, + const WebCore::FloatRect&, WebCore::ColorSpace, + WebCore::CompositeOperator) + { + } + +private: + + IntSize m_size; + + NativeImagePtr m_nativeImage; +}; + +TEST(DragImageTest, NullHandling) +{ + EXPECT_FALSE(createDragImageFromImage(0)); + + deleteDragImage(0); + EXPECT_TRUE(dragImageSize(0).isZero()); + EXPECT_FALSE(scaleDragImage(0, FloatSize(0.5, 0.5))); + EXPECT_FALSE(dissolveDragImageToFraction(0, 0.5)); + EXPECT_FALSE(createDragImageFromImage(0)); + EXPECT_FALSE(createDragImageIconForCachedImage(0)); +} + +TEST(DragImageTest, NonNullHandling) +{ + RefPtr<TestImage> testImage(TestImage::create(IntSize(2, 2))); + DragImageRef dragImage = createDragImageFromImage(testImage.get()); + ASSERT_TRUE(dragImage); + + dragImage = scaleDragImage(dragImage, FloatSize(0.5, 0.5)); + ASSERT_TRUE(dragImage); + IntSize size = dragImageSize(dragImage); + EXPECT_EQ(1, size.width()); + EXPECT_EQ(1, size.height()); + + dragImage = dissolveDragImageToFraction(dragImage, 0.5); + ASSERT_TRUE(dragImage); + + deleteDragImage(dragImage); +} + +TEST(DragImageTest, CreateDragImage) +{ + { + // Tests that the DrageImage implementation doesn't choke on null values + // of nativeImageForCurrentFrame(). + RefPtr<TestImage> testImage(TestImage::create(IntSize())); + EXPECT_FALSE(createDragImageFromImage(testImage.get())); + } + + { + // Tests that the drag image is a deep copy. + RefPtr<TestImage> testImage(TestImage::create(IntSize(1, 1))); + DragImageRef dragImage = createDragImageFromImage(testImage.get()); + ASSERT_TRUE(dragImage); + SkAutoLockPixels lock1(*dragImage), lock2(*(testImage->nativeImageForCurrentFrame())); + EXPECT_NE(dragImage->getPixels(), testImage->nativeImageForCurrentFrame()->getPixels()); + } +} + +} // anonymous namespace 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/KURLTest.cpp b/WebKit/chromium/tests/KURLTest.cpp index b316683..c46da2a 100644 --- a/WebKit/chromium/tests/KURLTest.cpp +++ b/WebKit/chromium/tests/KURLTest.cpp @@ -40,7 +40,7 @@ namespace { // Output stream operator so gTest's macros work with WebCore strings. -std::ostream& operator<<(std::ostream& out, const WebCore::String& str) +std::ostream& operator<<(std::ostream& out, const WTF::String& str) { return str.isEmpty() ? out : out << str.utf8().data(); } @@ -95,7 +95,7 @@ TEST(KURLTest, SameGetters) EXPECT_EQ(cases[i].hasRef, kurl.hasFragmentIdentifier()); // UTF-16 - WebCore::String utf16(cases[i].url); + WTF::String utf16(cases[i].url); kurl = WebCore::KURL(WebCore::ParsedURLString, utf16); EXPECT_EQ(cases[i].protocol, kurl.protocol()); @@ -144,7 +144,7 @@ TEST(KURLTest, DifferentGetters) EXPECT_EQ(cases[i].query, kurl.query()); // Want to compare UCS-16 refs (or to null). if (cases[i].ref) - EXPECT_EQ(WebCore::String::fromUTF8(cases[i].ref), kurl.fragmentIdentifier()); + EXPECT_EQ(WTF::String::fromUTF8(cases[i].ref), kurl.fragmentIdentifier()); else EXPECT_TRUE(kurl.fragmentIdentifier().isNull()); } @@ -156,23 +156,23 @@ TEST(KURLTest, UTF8) { const char asciiURL[] = "http://foo/bar#baz"; WebCore::KURL asciiKURL(WebCore::ParsedURLString, asciiURL); - EXPECT_TRUE(asciiKURL.string() == WebCore::String(asciiURL)); + EXPECT_TRUE(asciiKURL.string() == WTF::String(asciiURL)); // When the result is ASCII, we should get an ASCII String. Some // code depends on being able to compare the result of the .string() // getter with another String, and the isASCIIness of the two // strings must match for these functions (like equalIgnoringCase). - EXPECT_TRUE(WebCore::equalIgnoringCase(asciiKURL, WebCore::String(asciiURL))); + EXPECT_TRUE(WTF::equalIgnoringCase(asciiKURL, WTF::String(asciiURL))); // Reproduce code path in FrameLoader.cpp -- equalIgnoringCase implicitly // expects gkurl.protocol() to have been created as ascii. WebCore::KURL mailto(WebCore::ParsedURLString, "mailto:foo@foo.com"); - EXPECT_TRUE(WebCore::equalIgnoringCase(mailto.protocol(), "mailto")); + EXPECT_TRUE(WTF::equalIgnoringCase(mailto.protocol(), "mailto")); const char utf8URL[] = "http://foo/bar#\xe4\xbd\xa0\xe5\xa5\xbd"; WebCore::KURL utf8KURL(WebCore::ParsedURLString, utf8URL); - EXPECT_TRUE(utf8KURL.string() == WebCore::String::fromUTF8(utf8URL)); + EXPECT_TRUE(utf8KURL.string() == WTF::String::fromUTF8(utf8URL)); } TEST(KURLTest, Setters) @@ -281,20 +281,20 @@ TEST(KURLTest, Decode) }; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(decodeCases); i++) { - WebCore::String input(decodeCases[i].input); - WebCore::String str = WebCore::decodeURLEscapeSequences(input); + WTF::String input(decodeCases[i].input); + WTF::String str = WebCore::decodeURLEscapeSequences(input); EXPECT_STREQ(decodeCases[i].output, str.utf8().data()); } // Our decode should decode %00 - WebCore::String zero = WebCore::decodeURLEscapeSequences("%00"); + WTF::String zero = WebCore::decodeURLEscapeSequences("%00"); EXPECT_STRNE("%00", zero.utf8().data()); // Test the error behavior for invalid UTF-8 (we differ from WebKit here). - WebCore::String invalid = WebCore::decodeURLEscapeSequences( + WTF::String invalid = WebCore::decodeURLEscapeSequences( "%e4%a0%e5%a5%bd"); char16 invalidExpectedHelper[4] = { 0x00e4, 0x00a0, 0x597d, 0 }; - WebCore::String invalidExpected( + WTF::String invalidExpected( reinterpret_cast<const ::UChar*>(invalidExpectedHelper), 3); EXPECT_EQ(invalidExpected, invalid); @@ -305,20 +305,20 @@ TEST(KURLTest, Encode) { // Also test that it gets converted to UTF-8 properly. char16 wideInputHelper[3] = { 0x4f60, 0x597d, 0 }; - WebCore::String wideInput( + WTF::String wideInput( reinterpret_cast<const ::UChar*>(wideInputHelper), 2); - WebCore::String wideReference("\xe4\xbd\xa0\xe5\xa5\xbd", 6); - WebCore::String wideOutput = + WTF::String wideReference("\xe4\xbd\xa0\xe5\xa5\xbd", 6); + WTF::String wideOutput = WebCore::encodeWithURLEscapeSequences(wideInput); EXPECT_EQ(wideReference, wideOutput); // Our encode only escapes NULLs for safety (see the implementation for // more), so we only bother to test a few cases. - WebCore::String input( + WTF::String input( "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", 16); - WebCore::String reference( + WTF::String reference( "%00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", 18); - WebCore::String output = WebCore::encodeWithURLEscapeSequences(input); + WTF::String output = WebCore::encodeWithURLEscapeSequences(input); EXPECT_EQ(reference, output); } @@ -381,10 +381,11 @@ TEST(KURLTest, ReplaceInvalid) EXPECT_FALSE(kurl.isEmpty()); EXPECT_STREQ("http://www.google.com:8000/favicon.ico", kurl.string().utf8().data()); - // Now let's test that giving an invalid replacement still fails. + // Now let's test that giving an invalid replacement fails. Invalid + // protocols fail without modifying the URL, which should remain valid. #if USE(GOOGLEURL) - kurl.setProtocol("f/sj#@"); - EXPECT_FALSE(kurl.isValid()); + EXPECT_FALSE(kurl.setProtocol("f/sj#@")); + EXPECT_TRUE(kurl.isValid()); #endif } @@ -394,7 +395,7 @@ TEST(KURLTest, Path) WebCore::KURL kurl(WebCore::ParsedURLString, initial); // Clear by setting a null string. - WebCore::String nullString; + WTF::String nullString; EXPECT_TRUE(nullString.isNull()); kurl.setPath(nullString); EXPECT_STREQ("http://www.google.com/", kurl.string().utf8().data()); @@ -408,14 +409,14 @@ TEST(KURLTest, Query) WebCore::KURL kurl(WebCore::ParsedURLString, initial); // Clear by setting a null string. - WebCore::String nullString; + WTF::String nullString; EXPECT_TRUE(nullString.isNull()); kurl.setQuery(nullString); EXPECT_STREQ("http://www.google.com/search", kurl.string().utf8().data()); // Clear by setting an empty string. kurl = WebCore::KURL(WebCore::ParsedURLString, initial); - WebCore::String emptyString(""); + WTF::String emptyString(""); EXPECT_FALSE(emptyString.isNull()); kurl.setQuery(emptyString); EXPECT_STREQ("http://www.google.com/search?", kurl.string().utf8().data()); @@ -455,10 +456,10 @@ TEST(KURLTest, Ref) // Setting the ref to the null string will clear it altogether. cur = WebCore::KURL(WebCore::ParsedURLString, "http://foo/bar"); - cur.setFragmentIdentifier(WebCore::String()); + cur.setFragmentIdentifier(WTF::String()); EXPECT_STREQ("http://foo/bar", cur.string().utf8().data()); cur = kurl; - cur.setFragmentIdentifier(WebCore::String()); + cur.setFragmentIdentifier(WTF::String()); EXPECT_STREQ("http://foo/bar", cur.string().utf8().data()); } @@ -484,7 +485,7 @@ TEST(KURLTest, Empty) EXPECT_TRUE(kurl2.string().isEmpty()); // Resolve the null URL on a null string. - WebCore::KURL kurl22(kurl, WebCore::String()); + WebCore::KURL kurl22(kurl, WTF::String()); EXPECT_FALSE(kurl22.isNull()); EXPECT_TRUE(kurl22.isEmpty()); EXPECT_FALSE(kurl22.isValid()); diff --git a/WebKit/chromium/tests/PopupMenuTest.cpp b/WebKit/chromium/tests/PopupMenuTest.cpp new file mode 100644 index 0000000..50319af --- /dev/null +++ b/WebKit/chromium/tests/PopupMenuTest.cpp @@ -0,0 +1,375 @@ +/* + * 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 <gtest/gtest.h> + +#include "Color.h" +#include "KeyboardCodes.h" +#include "PopupMenu.h" +#include "PopupMenuClient.h" +#include "PopupMenuChromium.h" +#include "WebFrameClient.h" +#include "WebFrameImpl.h" +#include "WebInputEvent.h" +#include "WebPopupMenuImpl.h" +#include "WebScreenInfo.h" +#include "WebViewClient.h" +#include "WebViewImpl.h" + +using namespace WebCore; +using namespace WebKit; + +namespace { + +class TestPopupMenuClient : public PopupMenuClient { +public: + // Item at index 0 is selected by default. + TestPopupMenuClient() : m_selectIndex(0) { } + virtual ~TestPopupMenuClient() {} + virtual void valueChanged(unsigned listIndex, bool fireEvents = true) + { + m_selectIndex = listIndex; + } + virtual void selectionChanged(unsigned, bool) {} + virtual void selectionCleared() {} + + virtual String itemText(unsigned listIndex) const + { + String str("Item "); + str.append(String::number(listIndex)); + return str; + } + virtual String itemLabel(unsigned) const { return String(); } + virtual String itemIcon(unsigned) const { return String(); } + virtual String itemToolTip(unsigned listIndex) const { return itemText(listIndex); } + virtual String itemAccessibilityText(unsigned listIndex) const { return itemText(listIndex); } + virtual bool itemIsEnabled(unsigned listIndex) const { return true; } + virtual PopupMenuStyle itemStyle(unsigned listIndex) const + { + Font font(FontPlatformData(12.0, false, false), false); + return PopupMenuStyle(Color::black, Color::white, font, true, Length(), TextDirection()); + } + virtual PopupMenuStyle menuStyle() const { return itemStyle(0); } + virtual int clientInsetLeft() const { return 0; } + virtual int clientInsetRight() const { return 0; } + virtual int clientPaddingLeft() const { return 0; } + virtual int clientPaddingRight() const { return 0; } + virtual int listSize() const { return 10; } + virtual int selectedIndex() const { return m_selectIndex; } + virtual void popupDidHide() { } + virtual bool itemIsSeparator(unsigned listIndex) const { return false; } + virtual bool itemIsLabel(unsigned listIndex) const { return false; } + virtual bool itemIsSelected(unsigned listIndex) const { return listIndex == m_selectIndex; } + virtual bool shouldPopOver() const { return false; } + virtual bool valueShouldChangeOnHotTrack() const { return false; } + virtual void setTextFromItem(unsigned listIndex) { } + + virtual FontSelector* fontSelector() const { return 0; } + virtual HostWindow* hostWindow() const { return 0; } + + virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize) { return 0; } + +private: + unsigned m_selectIndex; +}; + +class TestWebWidgetClient : public WebWidgetClient { +public: + ~TestWebWidgetClient() { } +}; + +class TestWebPopupMenuImpl : public WebPopupMenuImpl { +public: + static PassRefPtr<TestWebPopupMenuImpl> create(WebWidgetClient* client) + { + return adoptRef(new TestWebPopupMenuImpl(client)); + } + + ~TestWebPopupMenuImpl() { } + +private: + TestWebPopupMenuImpl(WebWidgetClient* client) : WebPopupMenuImpl(client) { } +}; + +class TestWebWidget : public WebWidget { +public: + virtual ~TestWebWidget() { } + virtual void close() { } + virtual WebSize size() { return WebSize(100, 100); } + virtual void resize(const WebSize&) { } + virtual void layout() { } + virtual void paint(WebCanvas*, const WebRect&) { } + virtual bool handleInputEvent(const WebInputEvent&) { return true; } + virtual void mouseCaptureLost() { } + virtual void setFocus(bool) { } + virtual bool setComposition( + const WebString& text, + const WebVector<WebCompositionUnderline>& underlines, + int selectionStart, + int selectionEnd) { return true; } + virtual bool confirmComposition() { return true; } + virtual WebTextInputType textInputType() { return WebKit::WebTextInputTypeNone; } + virtual WebRect caretOrSelectionBounds() { return WebRect(); } + virtual void setTextDirection(WebTextDirection) { } +}; + +class TestWebViewClient : public WebViewClient { +public: + TestWebViewClient() : m_webPopupMenu(TestWebPopupMenuImpl::create(&m_webWidgetClient)) { } + ~TestWebViewClient() { } + + virtual WebWidget* createPopupMenu(WebPopupType) { return m_webPopupMenu.get(); } + + // We need to override this so that the popup menu size is not 0 + // (the layout code checks to see if the popup fits on the screen). + virtual WebScreenInfo screenInfo() + { + WebScreenInfo screenInfo; + screenInfo.availableRect.height = 2000; + screenInfo.availableRect.width = 2000; + return screenInfo; + } + +private: + TestWebWidgetClient m_webWidgetClient; + RefPtr<TestWebPopupMenuImpl> m_webPopupMenu; +}; + +class TestWebFrameClient : public WebFrameClient { +public: + ~TestWebFrameClient() { } +}; + +class SelectPopupMenuTest : public testing::Test { +public: + SelectPopupMenuTest() + { + } + +protected: + virtual void SetUp() + { + m_webView = static_cast<WebViewImpl*>(WebView::create(&m_webviewClient, 0)); + m_webView->initializeMainFrame(&m_webFrameClient); + m_popupMenu = adoptRef(new PopupMenuChromium(&m_popupMenuClient)); + } + + virtual void TearDown() + { + m_popupMenu = 0; + m_webView->close(); + } + + // Returns true if there currently is a select popup in the WebView. + bool popupOpen() const { return m_webView->selectPopup(); } + + int selectedIndex() const { return m_popupMenuClient.selectedIndex(); } + + void showPopup() + { + m_popupMenu->show(IntRect(0, 0, 100, 100), + static_cast<WebFrameImpl*>(m_webView->mainFrame())->frameView(), 0); + ASSERT_TRUE(popupOpen()); + EXPECT_TRUE(m_webView->selectPopup()->popupType() == PopupContainer::Select); + } + + void hidePopup() + { + m_popupMenu->hide(); + EXPECT_FALSE(popupOpen()); + } + + void simulateKeyDownEvent(int keyCode) + { + simulateKeyEvent(WebInputEvent::RawKeyDown, keyCode); + } + + void simulateKeyUpEvent(int keyCode) + { + simulateKeyEvent(WebInputEvent::KeyUp, keyCode); + } + + // Simulates a key event on the WebView. + // The WebView forwards the event to the select popup if one is open. + void simulateKeyEvent(WebInputEvent::Type eventType, int keyCode) + { + WebKeyboardEvent keyEvent; + keyEvent.windowsKeyCode = keyCode; + keyEvent.type = eventType; + m_webView->handleInputEvent(keyEvent); + } + + // Simulates a mouse event on the select popup. + void simulateLeftMouseDownEvent(const IntPoint& point) + { + PlatformMouseEvent mouseEvent(point, point, LeftButton, MouseEventPressed, + 1, false, false, false, false, 0); + m_webView->selectPopup()->handleMouseDownEvent(mouseEvent); + } + void simulateLeftMouseUpEvent(const IntPoint& point) + { + PlatformMouseEvent mouseEvent(point, point, LeftButton, MouseEventReleased, + 1, false, false, false, false, 0); + m_webView->selectPopup()->handleMouseReleaseEvent(mouseEvent); + } + +protected: + TestWebViewClient m_webviewClient; + WebViewImpl* m_webView; + TestWebFrameClient m_webFrameClient; + TestPopupMenuClient m_popupMenuClient; + RefPtr<PopupMenu> m_popupMenu; +}; + +// Tests that show/hide and repeats. Select popups are reused in web pages when +// they are reopened, that what this is testing. +TEST_F(SelectPopupMenuTest, ShowThenHide) +{ + for (int i = 0; i < 3; i++) { + showPopup(); + hidePopup(); + } +} + +// Tests that showing a select popup and deleting it does not cause problem. +// This happens in real-life if a page navigates while a select popup is showing. +TEST_F(SelectPopupMenuTest, ShowThenDelete) +{ + showPopup(); + // Nothing else to do, TearDown() deletes the popup. +} + +// Tests that losing focus closes the select popup. +TEST_F(SelectPopupMenuTest, ShowThenLoseFocus) +{ + showPopup(); + // Simulate losing focus. + m_webView->setFocus(false); + + // Popup should have closed. + EXPECT_FALSE(popupOpen()); +} + +// Tests that pressing ESC closes the popup. +TEST_F(SelectPopupMenuTest, ShowThenPressESC) +{ + showPopup(); + simulateKeyDownEvent(VKEY_ESCAPE); + // Popup should have closed. + EXPECT_FALSE(popupOpen()); +} + +// Tests selecting an item with the arrows and enter/esc/tab. +TEST_F(SelectPopupMenuTest, SelectWithKeys) +{ + showPopup(); + // Simulate selecting the 2nd item by pressing Down, Down, enter. + simulateKeyDownEvent(VKEY_DOWN); + simulateKeyDownEvent(VKEY_DOWN); + simulateKeyDownEvent(VKEY_RETURN); + + // Popup should have closed. + EXPECT_TRUE(!popupOpen()); + EXPECT_EQ(2, selectedIndex()); + + // It should work as well with ESC. + showPopup(); + simulateKeyDownEvent(VKEY_DOWN); + simulateKeyDownEvent(VKEY_ESCAPE); + EXPECT_FALSE(popupOpen()); + EXPECT_EQ(3, selectedIndex()); + + // It should work as well with TAB. + showPopup(); + simulateKeyDownEvent(VKEY_DOWN); + simulateKeyDownEvent(VKEY_TAB); + EXPECT_FALSE(popupOpen()); + EXPECT_EQ(4, selectedIndex()); +} + +// Tests that selecting an item with the mouse does select the item and close +// the popup. +TEST_F(SelectPopupMenuTest, ClickItem) +{ + showPopup(); + + // Y of 18 to be on the item at index 1 (12 font plus border and more to be safe). + IntPoint row1Point(2, 18); + // Simulate a click down/up on the first item. + simulateLeftMouseDownEvent(row1Point); + simulateLeftMouseUpEvent(row1Point); + + // Popup should have closed and the item at index 1 selected. + EXPECT_FALSE(popupOpen()); + EXPECT_EQ(1, selectedIndex()); +} + +// Tests that moving the mouse over an item and then clicking outside the select popup +// leaves the seleted item unchanged. +TEST_F(SelectPopupMenuTest, MouseOverItemClickOutside) +{ + showPopup(); + + // Y of 18 to be on the item at index 1 (12 font plus border and more to be safe). + IntPoint row1Point(2, 18); + // Simulate the mouse moving over the first item. + PlatformMouseEvent mouseEvent(row1Point, row1Point, NoButton, MouseEventMoved, + 1, false, false, false, false, 0); + m_webView->selectPopup()->handleMouseMoveEvent(mouseEvent); + + // Click outside the popup. + simulateLeftMouseDownEvent(IntPoint(1000, 1000)); + + // Popup should have closed and item 0 should still be selected. + EXPECT_FALSE(popupOpen()); + EXPECT_EQ(0, selectedIndex()); +} + +// Tests that selecting an item with the keyboard and then clicking outside the select +// popup does select that item. +TEST_F(SelectPopupMenuTest, SelectItemWithKeyboardItemClickOutside) +{ + showPopup(); + + // Simulate selecting the 2nd item by pressing Down, Down. + simulateKeyDownEvent(VKEY_DOWN); + simulateKeyDownEvent(VKEY_DOWN); + + // Click outside the popup. + simulateLeftMouseDownEvent(IntPoint(1000, 1000)); + + // Popup should have closed and the item should have been selected. + EXPECT_FALSE(popupOpen()); + EXPECT_EQ(2, selectedIndex()); +} + +} // namespace diff --git a/WebKit/chromium/tests/RunAllTests.cpp b/WebKit/chromium/tests/RunAllTests.cpp index 0f3f82f..cfcfbee 100644 --- a/WebKit/chromium/tests/RunAllTests.cpp +++ b/WebKit/chromium/tests/RunAllTests.cpp @@ -33,18 +33,15 @@ #include "WebKit.h" #include "WebKitClient.h" - -// WebKitClient has a protected destructor, so we need to subclass. -class DummyWebKitClient : public WebKit::WebKitClient { -}; +#include <webkit/support/webkit_support.h> int main(int argc, char** argv) { - DummyWebKitClient dummyClient; - WebKit::initialize(&dummyClient); - - int result = TestSuite(argc, argv).Run(); - - WebKit::shutdown(); + TestSuite testSuite(argc, argv); + // TestSuite must be created before SetUpTestEnvironment so it performs + // initializations needed by WebKit support. + webkit_support::SetUpTestEnvironmentForUnitTests(); + int result = testSuite.Run(); + webkit_support::TearDownTestEnvironment(); return result; } diff --git a/WebKit/chromium/tests/TilingDataTest.cpp b/WebKit/chromium/tests/TilingDataTest.cpp new file mode 100755 index 0000000..ec18f01 --- /dev/null +++ b/WebKit/chromium/tests/TilingDataTest.cpp @@ -0,0 +1,334 @@ +/* + * 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 "TilingData.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)); +} + +TEST(TilingDataTest, tileSizeX_and_tilePositionX) +{ + // Single tile cases: + EXPECT_EQ(1, TilingData(3, 1, 1, false).tileSizeX(0)); + EXPECT_EQ(0, TilingData(3, 1, 1, false).tilePositionX(0)); + EXPECT_EQ(1, TilingData(3, 1, 100, false).tileSizeX(0)); + EXPECT_EQ(0, TilingData(3, 1, 100, false).tilePositionX(0)); + EXPECT_EQ(3, TilingData(3, 3, 1, false).tileSizeX(0)); + EXPECT_EQ(0, TilingData(3, 3, 1, false).tilePositionX(0)); + EXPECT_EQ(3, TilingData(3, 3, 100, false).tileSizeX(0)); + EXPECT_EQ(0, TilingData(3, 3, 100, false).tilePositionX(0)); + EXPECT_EQ(1, TilingData(3, 1, 1, true).tileSizeX(0)); + EXPECT_EQ(0, TilingData(3, 1, 1, true).tilePositionX(0)); + EXPECT_EQ(1, TilingData(3, 1, 100, true).tileSizeX(0)); + EXPECT_EQ(0, TilingData(3, 1, 100, true).tilePositionX(0)); + EXPECT_EQ(3, TilingData(3, 3, 1, true).tileSizeX(0)); + EXPECT_EQ(0, TilingData(3, 3, 1, true).tilePositionX(0)); + EXPECT_EQ(3, TilingData(3, 3, 100, true).tileSizeX(0)); + EXPECT_EQ(0, TilingData(3, 3, 100, true).tilePositionX(0)); + + // Multiple tiles: + // no border + // positions 0, 3 + EXPECT_EQ(2, TilingData(3, 6, 1, false).numTiles()); + EXPECT_EQ(3, TilingData(3, 6, 1, false).tileSizeX(0)); + EXPECT_EQ(3, TilingData(3, 6, 1, false).tileSizeX(1)); + EXPECT_EQ(0, TilingData(3, 6, 1, false).tilePositionX(0)); + EXPECT_EQ(3, TilingData(3, 6, 1, false).tilePositionX(1)); + EXPECT_EQ(3, TilingData(3, 6, 100, false).tileSizeX(0)); + EXPECT_EQ(3, TilingData(3, 6, 100, false).tileSizeX(1)); + EXPECT_EQ(0, TilingData(3, 6, 100, false).tilePositionX(0)); + EXPECT_EQ(3, TilingData(3, 6, 100, false).tilePositionX(1)); + + // Multiple tiles: + // with border + // positions 0, 2, 3, 4 + EXPECT_EQ(4, TilingData(3, 6, 1, true).numTiles()); + EXPECT_EQ(2, TilingData(3, 6, 1, true).tileSizeX(0)); + EXPECT_EQ(1, TilingData(3, 6, 1, true).tileSizeX(1)); + EXPECT_EQ(1, TilingData(3, 6, 1, true).tileSizeX(2)); + EXPECT_EQ(2, TilingData(3, 6, 1, true).tileSizeX(3)); + EXPECT_EQ(0, TilingData(3, 6, 1, true).tilePositionX(0)); + EXPECT_EQ(2, TilingData(3, 6, 1, true).tilePositionX(1)); + EXPECT_EQ(3, TilingData(3, 6, 1, true).tilePositionX(2)); + EXPECT_EQ(4, TilingData(3, 6, 1, true).tilePositionX(3)); + EXPECT_EQ(2, TilingData(3, 6, 100, true).tileSizeX(0)); + EXPECT_EQ(1, TilingData(3, 6, 100, true).tileSizeX(1)); + EXPECT_EQ(1, TilingData(3, 6, 100, true).tileSizeX(2)); + EXPECT_EQ(2, TilingData(3, 6, 100, true).tileSizeX(3)); + EXPECT_EQ(0, TilingData(3, 6, 100, true).tilePositionX(0)); + EXPECT_EQ(2, TilingData(3, 6, 100, true).tilePositionX(1)); + EXPECT_EQ(3, TilingData(3, 6, 100, true).tilePositionX(2)); + EXPECT_EQ(4, TilingData(3, 6, 100, true).tilePositionX(3)); +} + +TEST(TilingDataTest, tileSizeY_and_tilePositionY) +{ + // Single tile cases: + EXPECT_EQ(1, TilingData(3, 1, 1, false).tileSizeY(0)); + EXPECT_EQ(0, TilingData(3, 1, 1, false).tilePositionY(0)); + EXPECT_EQ(1, TilingData(3, 100, 1, false).tileSizeY(0)); + EXPECT_EQ(0, TilingData(3, 100, 1, false).tilePositionY(0)); + EXPECT_EQ(3, TilingData(3, 1, 3, false).tileSizeY(0)); + EXPECT_EQ(0, TilingData(3, 1, 3, false).tilePositionY(0)); + EXPECT_EQ(3, TilingData(3, 100, 3, false).tileSizeY(0)); + EXPECT_EQ(0, TilingData(3, 100, 3, false).tilePositionY(0)); + EXPECT_EQ(1, TilingData(3, 1, 1, true).tileSizeY(0)); + EXPECT_EQ(0, TilingData(3, 1, 1, true).tilePositionY(0)); + EXPECT_EQ(1, TilingData(3, 100, 1, true).tileSizeY(0)); + EXPECT_EQ(0, TilingData(3, 100, 1, true).tilePositionY(0)); + EXPECT_EQ(3, TilingData(3, 1, 3, true).tileSizeY(0)); + EXPECT_EQ(0, TilingData(3, 1, 3, true).tilePositionY(0)); + EXPECT_EQ(3, TilingData(3, 100, 3, true).tileSizeY(0)); + EXPECT_EQ(0, TilingData(3, 100, 3, true).tilePositionY(0)); + + // Multiple tiles: + // no border + // positions 0, 3 + EXPECT_EQ(2, TilingData(3, 1, 6, false).numTiles()); + EXPECT_EQ(3, TilingData(3, 1, 6, false).tileSizeY(0)); + EXPECT_EQ(3, TilingData(3, 1, 6, false).tileSizeY(1)); + EXPECT_EQ(0, TilingData(3, 1, 6, false).tilePositionY(0)); + EXPECT_EQ(3, TilingData(3, 1, 6, false).tilePositionY(1)); + EXPECT_EQ(3, TilingData(3, 100, 6, false).tileSizeY(0)); + EXPECT_EQ(3, TilingData(3, 100, 6, false).tileSizeY(1)); + EXPECT_EQ(0, TilingData(3, 100, 6, false).tilePositionY(0)); + EXPECT_EQ(3, TilingData(3, 100, 6, false).tilePositionY(1)); + + // Multiple tiles: + // with border + // positions 0, 2, 3, 4 + EXPECT_EQ(4, TilingData(3, 1, 6, true).numTiles()); + EXPECT_EQ(2, TilingData(3, 1, 6, true).tileSizeY(0)); + EXPECT_EQ(1, TilingData(3, 1, 6, true).tileSizeY(1)); + EXPECT_EQ(1, TilingData(3, 1, 6, true).tileSizeY(2)); + EXPECT_EQ(2, TilingData(3, 1, 6, true).tileSizeY(3)); + EXPECT_EQ(0, TilingData(3, 1, 6, true).tilePositionY(0)); + EXPECT_EQ(2, TilingData(3, 1, 6, true).tilePositionY(1)); + EXPECT_EQ(3, TilingData(3, 1, 6, true).tilePositionY(2)); + EXPECT_EQ(4, TilingData(3, 1, 6, true).tilePositionY(3)); + EXPECT_EQ(2, TilingData(3, 100, 6, true).tileSizeY(0)); + EXPECT_EQ(1, TilingData(3, 100, 6, true).tileSizeY(1)); + EXPECT_EQ(1, TilingData(3, 100, 6, true).tileSizeY(2)); + EXPECT_EQ(2, TilingData(3, 100, 6, true).tileSizeY(3)); + EXPECT_EQ(0, TilingData(3, 100, 6, true).tilePositionY(0)); + EXPECT_EQ(2, TilingData(3, 100, 6, true).tilePositionY(1)); + EXPECT_EQ(3, TilingData(3, 100, 6, true).tilePositionY(2)); + EXPECT_EQ(4, TilingData(3, 100, 6, true).tilePositionY(3)); +} + +} // namespace diff --git a/WebKit/chromium/tests/WebFrameTest.cpp b/WebKit/chromium/tests/WebFrameTest.cpp new file mode 100644 index 0000000..cf91cb4 --- /dev/null +++ b/WebKit/chromium/tests/WebFrameTest.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 <googleurl/src/gurl.h> +#include <gtest/gtest.h> +#include <webkit/support/webkit_support.h> +#include "WebFrame.h" +#include "WebFrameClient.h" +#include "WebString.h" +#include "WebURL.h" +#include "WebURLRequest.h" +#include "WebURLResponse.h" +#include "WebView.h" + +using namespace WebKit; + +namespace { + +class WebFrameTest : public testing::Test { +public: + WebFrameTest() {} + + virtual void TearDown() + { + webkit_support::UnregisterAllMockedURLs(); + } + + void registerMockedURLLoad(const WebURL& url, const WebURLResponse& response, const WebString& fileName) + { + std::string filePath = webkit_support::GetWebKitRootDir().utf8(); + filePath.append("/WebKit/chromium/tests/data/"); + filePath.append(fileName.utf8()); + webkit_support::RegisterMockedURL(url, response, WebString::fromUTF8(filePath)); + } + + void serveRequests() + { + webkit_support::ServeAsynchronousMockedRequests(); + } +}; + +class TestWebFrameClient : public WebFrameClient { +}; + +TEST_F(WebFrameTest, ContentText) +{ + // Register our resources. + WebURLResponse response; + response.initialize(); + response.setMIMEType("text/html"); + std::string rootURL = "http://www.test.com/"; + const char* files[] = { "iframes_test.html", "visible_iframe.html", + "invisible_iframe.html", "zero_sized_iframe.html" }; + for (int i = 0; i < (sizeof(files) / sizeof(char*)); ++i) { + WebURL webURL = GURL(rootURL + files[i]); + registerMockedURLLoad(webURL, response, WebString::fromUTF8(files[i])); + } + + // Create and initialize the WebView. + TestWebFrameClient webFrameClient; + WebView* webView = WebView::create(0, 0); + webView->initializeMainFrame(&webFrameClient); + + // Load the main frame URL. + WebURL testURL(GURL(rootURL + files[0])); + WebURLRequest urlRequest; + urlRequest.initialize(); + urlRequest.setURL(testURL); + webView->mainFrame()->loadRequest(urlRequest); + + // Load all pending asynchronous requests. + serveRequests(); + + // Now retrieve the frames text and test it only includes visible elements. + std::string content = webView->mainFrame()->contentAsText(1024).utf8(); + EXPECT_NE(std::string::npos, content.find(" visible paragraph")); + EXPECT_NE(std::string::npos, content.find(" visible iframe")); + EXPECT_EQ(std::string::npos, content.find(" invisible pararaph")); + EXPECT_EQ(std::string::npos, content.find(" invisible iframe")); + EXPECT_EQ(std::string::npos, content.find("iframe with zero size")); + + webView->close(); +} + +} 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 diff --git a/WebKit/chromium/tests/data/iframes_test.html b/WebKit/chromium/tests/data/iframes_test.html new file mode 100644 index 0000000..425709b --- /dev/null +++ b/WebKit/chromium/tests/data/iframes_test.html @@ -0,0 +1,9 @@ +<html> + <body> + <iframe src="visible_iframe.html"></iframe> + <iframe width=0 height=0 src="zero_sized_iframe.html"></iframe> + <iframe style="visibility:hidden;" src="invisible_iframe.html"></iframe> + <p>This is a visible paragraph.</p> + <p style="visibility:hidden;">This is an invisible paragraph.</p> + </body> +</html> diff --git a/WebKit/chromium/tests/data/invisible_iframe.html b/WebKit/chromium/tests/data/invisible_iframe.html new file mode 100644 index 0000000..e5686c7 --- /dev/null +++ b/WebKit/chromium/tests/data/invisible_iframe.html @@ -0,0 +1,5 @@ +<html> + <body> + This is an invisible frame. + </body> +</html> diff --git a/WebKit/chromium/tests/data/visible_iframe.html b/WebKit/chromium/tests/data/visible_iframe.html new file mode 100644 index 0000000..291af3d --- /dev/null +++ b/WebKit/chromium/tests/data/visible_iframe.html @@ -0,0 +1,5 @@ +<html> + <body> + This is a visible iframe. + </body> +</html> diff --git a/WebKit/chromium/tests/data/zero_sized_iframe.html b/WebKit/chromium/tests/data/zero_sized_iframe.html new file mode 100644 index 0000000..6728cab --- /dev/null +++ b/WebKit/chromium/tests/data/zero_sized_iframe.html @@ -0,0 +1,5 @@ +<html> + <body> + This is an iframe with zero size. + </body> +</html> |
