diff options
Diffstat (limited to 'WebKit')
130 files changed, 4913 insertions, 1204 deletions
diff --git a/WebKit/CMakeLists.txt b/WebKit/CMakeLists.txt index 6e0996c..3ed3e9c 100644 --- a/WebKit/CMakeLists.txt +++ b/WebKit/CMakeLists.txt @@ -21,7 +21,6 @@ SET(WebKit_INCLUDE_DIRECTORIES "${WEBCORE_DIR}/platform/graphics/cairo" "${WEBCORE_DIR}/platform/graphics/transforms" "${WEBCORE_DIR}/platform/network" - "${WEBCORE_DIR}/platform/network/soup" "${WEBCORE_DIR}/platform/sql" "${WEBCORE_DIR}/platform/text" "${WEBCORE_DIR}/plugins" @@ -47,12 +46,21 @@ SET(WebKit_INCLUDE_DIRECTORIES "${CMAKE_BINARY_DIR}" ) +IF (WTF_USE_SOUP) + LIST(APPEND WebKit_INCLUDE_DIRECTORIES "${WEBCORE_DIR}/platform/network/soup") +ENDIF () + +IF (WTF_USE_CURL) + LIST(APPEND WebKit_INCLUDE_DIRECTORIES "${WEBCORE_DIR}/platform/network/curl") +ENDIF () + SET(WebKit_LIBRARIES ${JavaScriptCore_LIBRARY_NAME} ${WebCore_LIBRARY_NAME} ) -INCLUDE_IF_EXISTS(${WEBKIT_DIR}/CMakeLists${PORT}.txt) +STRING(TOLOWER ${PORT} WEBKIT_PORT_DIR) +INCLUDE_IF_EXISTS(${WEBKIT_DIR}/${WEBKIT_PORT_DIR}/CMakeLists${PORT}.txt) ADD_DEFINITIONS(-DBUILDING_WebKit) INCLUDE_DIRECTORIES(${WebKit_INCLUDE_DIRECTORIES}) diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog index d4d2431..76b6fb4 100644 --- a/WebKit/ChangeLog +++ b/WebKit/ChangeLog @@ -1,3 +1,68 @@ +2010-07-26 Rafael Antognolli <antognolli@profusion.mobi> + + Reviewed by Antonio Gomes. + + [EFL] Move CMakeListsEfl.txt to WebKit/efl/ + https://bugs.webkit.org/show_bug.cgi?id=43002 + + This should reduce the noise in WebKit/ChangeLog that comes from EFL + port. Most of the changes on EFL port should be logged in + WebKit/efl/ChangeLog. + + * CMakeLists.txt: Just change the path from where to include the file. + +2010-07-23 Rafael Antognolli <antognolli@profusion.mobi> + + Reviewed by Antonio Gomes. + + [EFL] Cleanup glib support (make it optional) + https://bugs.webkit.org/show_bug.cgi?id=42480 + + Just add glib flags and directories if necessary. + + * CMakeListsEfl.txt: + +2010-07-23 Rafael Antognolli <antognolli@profusion.mobi> + + Reviewed by Antonio Gomes. + + [EFL] Add support for using libcurl network backend. + https://bugs.webkit.org/show_bug.cgi?id=42286 + + Just add soup/curl directories and flags for the specific + backend being used. + + * CMakeLists.txt: + * CMakeListsEfl.txt: + +2010-07-22 Lucas De Marchi <lucas.demarchi@profusion.mobi> + + Reviewed by Antonio Gomes. + + [EFL] Implement input method notification + https://bugs.webkit.org/show_bug.cgi?id=42640 + + Notify browser when keyboard should be shown/hidden. Input method + hints are updated before sending the signal. Client should be able to + determine the input type by calling ewk_view_imh_get(). + + * efl/EWebLauncher/main.c: + (on_inputmethod_changed): example implementation that just prints to + stdout if keyboard should be shown or hidden and the imh flags. + (browserCreate): listen to signal about input method changing its + state. + * efl/WebCoreSupport/EditorClientEfl.cpp: + (WebCore::EditorClientEfl::setInputMethodState): call new function + responsible for implementing this notification. + * efl/ewk/ewk_private.h: ewk_view_input_method_state_set() is called + only from inside WebKit. + * efl/ewk/ewk_view.cpp: implement setters and getters + (ewk_view_imh_get): + (ewk_view_input_method_state_set): + * efl/ewk/ewk_view.h: introduce Ewk_Imh enum which contains the + possible input types. + (_Ewk_View_Smart_Class::): + 2010-07-20 Lucas De Marchi <lucas.demarchi@profusion.mobi> Reviewed by Kenneth Rohde Christiansen. diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog index 009dc60..2c720e1 100644 --- a/WebKit/chromium/ChangeLog +++ b/WebKit/chromium/ChangeLog @@ -1,3 +1,561 @@ +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. diff --git a/WebKit/chromium/DEPS b/WebKit/chromium/DEPS index 24bf389..7c7d7e7 100644 --- a/WebKit/chromium/DEPS +++ b/WebKit/chromium/DEPS @@ -32,7 +32,7 @@ vars = { 'chromium_svn': 'http://src.chromium.org/svn/trunk/src', - 'chromium_rev': '52869', + 'chromium_rev': '53434', } deps = { diff --git a/WebKit/chromium/WebKit.gyp b/WebKit/chromium/WebKit.gyp index 8abc159..97efddc 100644 --- a/WebKit/chromium/WebKit.gyp +++ b/WebKit/chromium/WebKit.gyp @@ -116,6 +116,7 @@ 'public/WebAnimationController.h', 'public/WebApplicationCacheHost.h', 'public/WebApplicationCacheHostClient.h', + 'public/WebAttribute.h', 'public/WebBindings.h', 'public/WebCache.h', 'public/WebCanvas.h', @@ -144,6 +145,7 @@ 'public/WebDevToolsMessageData.h', 'public/WebDevToolsMessageTransport.h', 'public/WebDocument.h', + 'public/WebDocumentType.h', 'public/WebDragData.h', 'public/WebEditingAction.h', 'public/WebElement.h', @@ -154,6 +156,10 @@ 'public/WebFileInfo.h', 'public/WebFileSystem.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', @@ -191,6 +197,7 @@ 'public/WebMessagePortChannelClient.h', 'public/WebMimeRegistry.h', 'public/WebMutationEvent.h', + 'public/WebNamedNodeMap.h', 'public/WebNavigationType.h', 'public/WebNode.h', 'public/WebNodeCollection.h', @@ -234,6 +241,8 @@ 'public/WebSocketStreamError.h', 'public/WebSocketStreamHandle.h', 'public/WebSocketStreamHandleClient.h', + 'public/WebSpeechInputController.h', + 'public/WebSpeechInputListener.h', 'public/WebStorageArea.h', 'public/WebStorageEventDispatcher.h', 'public/WebStorageNamespace.h', @@ -242,6 +251,7 @@ 'public/WebTextCaseSensitivity.h', 'public/WebTextDirection.h', 'public/WebTextInputType.h', + 'public/WebTextRun.h', 'public/WebThemeEngine.h', 'public/WebURL.h', 'public/WebURLError.h', @@ -339,6 +349,8 @@ 'src/ResourceHandle.cpp', 'src/SharedWorkerRepository.cpp', 'src/SocketStreamHandle.cpp', + 'src/SpeechInputClientImpl.cpp', + 'src/SpeechInputClientImpl.h', 'src/StorageAreaProxy.cpp', 'src/StorageAreaProxy.h', 'src/StorageEventDispatcherChromium.cpp', @@ -354,6 +366,7 @@ 'src/WebAccessibilityObject.cpp', 'src/WebAnimationControllerImpl.cpp', 'src/WebAnimationControllerImpl.h', + 'src/WebAttribute.cpp', 'src/WebBindings.cpp', 'src/WebCache.cpp', 'src/WebColor.cpp', @@ -371,6 +384,7 @@ 'src/WebDevToolsFrontendImpl.cpp', 'src/WebDevToolsFrontendImpl.h', 'src/WebDocument.cpp', + 'src/WebDocumentType.cpp', 'src/WebDragData.cpp', 'src/WebElement.cpp', 'src/WebEntities.cpp', @@ -382,6 +396,9 @@ 'src/WebFileChooserCompletionImpl.cpp', 'src/WebFileChooserCompletionImpl.h', 'src/WebFontCache.cpp', + 'src/WebFontDescription.cpp', + 'src/WebFontImpl.cpp', + 'src/WebFontImpl.h', 'src/WebFormControlElement.cpp', 'src/WebFormElement.cpp', 'src/WebFrameImpl.cpp', @@ -420,6 +437,7 @@ 'src/WebMediaPlayerClientImpl.cpp', 'src/WebMediaPlayerClientImpl.h', 'src/WebMutationEvent.cpp', + 'src/WebNamedNodeMap.cpp', 'src/WebNode.cpp', 'src/WebNodeCollection.cpp', 'src/WebNodeList.cpp', @@ -462,6 +480,7 @@ 'src/WebStorageNamespaceImpl.cpp', 'src/WebStorageNamespaceImpl.h', 'src/WebString.cpp', + 'src/WebTextRun.cpp', 'src/WebURL.cpp', 'src/WebURLLoadTiming.cpp', 'src/WebURLRequest.cpp', @@ -823,6 +842,11 @@ '../../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 diff --git a/WebKit/chromium/WebKit.gypi b/WebKit/chromium/WebKit.gypi index 7d7b19c..b45e3e7 100644 --- a/WebKit/chromium/WebKit.gypi +++ b/WebKit/chromium/WebKit.gypi @@ -33,7 +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/ProfilerAgent.js', 'src/js/ProfilerProcessor.js', 'src/js/HeapProfilerPanel.js', diff --git a/WebKit/chromium/features.gypi b/WebKit/chromium/features.gypi index eadce7e..559ebd8 100644 --- a/WebKit/chromium/features.gypi +++ b/WebKit/chromium/features.gypi @@ -45,11 +45,13 @@ 'ENABLE_DASHBOARD_SUPPORT=0', 'ENABLE_DATABASE=1', 'ENABLE_DATAGRID=0', + 'ENABLE_DEVICE_ORIENTATION=1', 'ENABLE_DIRECTORY_UPLOAD=1', 'ENABLE_DOM_STORAGE=1', 'ENABLE_EVENTSOURCE=1', 'ENABLE_FILE_READER=1', 'ENABLE_FILE_WRITER=1', + 'ENABLE_FILE_SYSTEM=1', 'ENABLE_FILTERS=1', 'ENABLE_GEOLOCATION=1', 'ENABLE_ICONDATABASE=0', diff --git a/WebKit/chromium/public/WebAccessibilityObject.h b/WebKit/chromium/public/WebAccessibilityObject.h index f1b2474..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; @@ -103,6 +105,11 @@ public: 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>&); WebAccessibilityObject& operator=(const WTF::PassRefPtr<WebCore::AccessibilityObject>&); 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/WebDOMStringList.h b/WebKit/chromium/public/WebDOMStringList.h index b3fb533..d88fcee 100644 --- a/WebKit/chromium/public/WebDOMStringList.h +++ b/WebKit/chromium/public/WebDOMStringList.h @@ -46,7 +46,7 @@ class WebDOMStringList { public: ~WebDOMStringList() { reset(); } - WebDOMStringList() { } + WebDOMStringList(); WebDOMStringList(const WebDOMStringList& l) { assign(l); } WebDOMStringList& operator=(const WebDOMStringList& l) { diff --git a/WebKit/chromium/public/WebDocument.h b/WebKit/chromium/public/WebDocument.h index c093c58..d9f7386 100644 --- a/WebKit/chromium/public/WebDocument.h +++ b/WebKit/chromium/public/WebDocument.h @@ -34,11 +34,15 @@ #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; @@ -74,6 +78,7 @@ public: WEBKIT_API WebURL completeURL(const WebString&) 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/WebElement.h b/WebKit/chromium/public/WebElement.h index 1be40bc..16a82d8 100644 --- a/WebKit/chromium/public/WebElement.h +++ b/WebKit/chromium/public/WebElement.h @@ -38,6 +38,8 @@ namespace WebCore { class Element; } #endif namespace WebKit { +class WebNamedNodeMap; + // Provides access to some properties of a DOM element node. class WebElement : public WebNode { public: @@ -53,6 +55,7 @@ namespace WebKit { 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/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/WebInputEvent.h b/WebKit/chromium/public/WebInputEvent.h index 2ac7475..f8b057b 100644 --- a/WebKit/chromium/public/WebInputEvent.h +++ b/WebKit/chromium/public/WebInputEvent.h @@ -89,6 +89,7 @@ public: MouseMove, MouseEnter, MouseLeave, + ContextMenu, // WebMouseWheelEvent MouseWheel, @@ -135,7 +136,8 @@ public: || type == MouseUp || type == MouseMove || type == MouseEnter - || type == MouseLeave; + || type == MouseLeave + || type == ContextMenu; } // Returns true if the WebInputEvent |type| is a keyboard event. 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/WebSettings.h b/WebKit/chromium/public/WebSettings.h index 32cefa1..90b8553 100644 --- a/WebKit/chromium/public/WebSettings.h +++ b/WebKit/chromium/public/WebSettings.h @@ -91,6 +91,7 @@ public: virtual void setShowDebugBorders(bool) = 0; virtual void setEditingBehavior(EditingBehavior) = 0; virtual void setAcceleratedCompositingEnabled(bool) = 0; + virtual void setAccelerated2dCanvasEnabled(bool) = 0; virtual void setHTML5ParserEnabled(bool) = 0; virtual void setMemoryInfoEnabled(bool) = 0; diff --git a/WebKit/chromium/public/WebSpeechInputController.h b/WebKit/chromium/public/WebSpeechInputController.h new file mode 100644 index 0000000..3dba5fb --- /dev/null +++ b/WebKit/chromium/public/WebSpeechInputController.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 WebSpeechInputController_h +#define WebSpeechInputController_h + +#include "WebCommon.h" + +namespace WebKit { + +// 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() + { + 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() { 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() { WEBKIT_ASSERT_NOT_REACHED(); } + +protected: + virtual ~WebSpeechInputController() { } +}; + +} // namespace WebKit + +#endif // WebSpeechInputController_h diff --git a/WebKit/chromium/public/WebSpeechInputListener.h b/WebKit/chromium/public/WebSpeechInputListener.h new file mode 100644 index 0000000..f1756af --- /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() = 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(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() = 0; + +protected: + ~WebSpeechInputListener() { } +}; + +} // namespace WebKit + +#endif // WebSpeechInputListener_h 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/WebView.h b/WebKit/chromium/public/WebView.h index 26d7269..1b94da2 100644 --- a/WebKit/chromium/public/WebView.h +++ b/WebKit/chromium/public/WebView.h @@ -253,6 +253,7 @@ public: const WebNode&, 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. @@ -262,6 +263,7 @@ public: const WebNode&, const WebVector<WebString>& names, const WebVector<WebString>& labels, + const WebVector<WebString>& icons, const WebVector<int>& uniqueIDs, int separatorIndex) = 0; diff --git a/WebKit/chromium/public/WebViewClient.h b/WebKit/chromium/public/WebViewClient.h index 11fb233..4628c2f 100644 --- a/WebKit/chromium/public/WebViewClient.h +++ b/WebKit/chromium/public/WebViewClient.h @@ -55,6 +55,8 @@ class WebKeyboardEvent; class WebNode; class WebNotificationPresenter; class WebRange; +class WebSpeechInputController; +class WebSpeechInputListener; class WebStorageNamespace; class WebURL; class WebView; @@ -331,7 +333,13 @@ public: // Geolocation --------------------------------------------------------- // Access the embedder API for geolocation services. - virtual WebKit::WebGeolocationService* geolocationService() { return 0; } + virtual WebGeolocationService* geolocationService() { return 0; } + + // Speech -------------------------------------------------------------- + + // Access the embedder API for speech input services. + virtual WebSpeechInputController* speechInputController( + WebSpeechInputListener*) { return 0; } protected: ~WebViewClient() { } diff --git a/WebKit/chromium/src/ApplicationCacheHost.cpp b/WebKit/chromium/src/ApplicationCacheHost.cpp index b90126f..dfd4754 100644 --- a/WebKit/chromium/src/ApplicationCacheHost.cpp +++ b/WebKit/chromium/src/ApplicationCacheHost.cpp @@ -37,11 +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" @@ -206,6 +210,32 @@ void ApplicationCacheHost::notifyDOMApplicationCache(EventID id, int total, int 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()); diff --git a/WebKit/chromium/src/AssertMatchingEnums.cpp b/WebKit/chromium/src/AssertMatchingEnums.cpp index 1f946f3..093ac11 100644 --- a/WebKit/chromium/src/AssertMatchingEnums.cpp +++ b/WebKit/chromium/src/AssertMatchingEnums.cpp @@ -36,6 +36,8 @@ #include "AccessibilityObject.h" #include "ApplicationCacheHost.h" #include "EditorInsertAction.h" +#include "FontDescription.h" +#include "FontSmoothingMode.h" #include "HTMLInputElement.h" #include "IDBKey.h" #include "MediaPlayer.h" @@ -52,6 +54,7 @@ #include "WebClipboard.h" #include "WebCursorInfo.h" #include "WebEditingAction.h" +#include "WebFontDescription.h" #include "WebIDBKey.h" #include "WebInputElement.h" #include "WebMediaPlayer.h" @@ -235,6 +238,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); @@ -326,3 +354,5 @@ COMPILE_ASSERT_MATCHING_ENUM(WebView::UserContentInjectInTopFrameOnly, InjectInT 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 6b74f60..b14840c 100644 --- a/WebKit/chromium/src/AutoFillPopupMenuClient.cpp +++ b/WebKit/chromium/src/AutoFillPopupMenuClient.cpp @@ -84,6 +84,16 @@ WebString AutoFillPopupMenuClient::getLabel(unsigned listIndex) const 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) { if (!canRemoveSuggestionAtIndex(listIndex)) @@ -95,6 +105,8 @@ void AutoFillPopupMenuClient::removeSuggestionAtIndex(unsigned listIndex) 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) @@ -177,6 +189,11 @@ 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; @@ -249,10 +266,12 @@ void AutoFillPopupMenuClient::initialize( HTMLInputElement* textField, const WebVector<WebString>& names, 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())); @@ -261,7 +280,7 @@ void AutoFillPopupMenuClient::initialize( // The suggestions must be set before initializing the // AutoFillPopupMenuClient. - setSuggestions(names, labels, uniqueIDs, separatorIndex); + setSuggestions(names, labels, icons, uniqueIDs, separatorIndex); FontDescription fontDescription; RenderTheme::defaultTheme()->systemFont(CSSValueWebkitControl, @@ -280,19 +299,23 @@ void AutoFillPopupMenuClient::initialize( void AutoFillPopupMenuClient::setSuggestions(const WebVector<WebString>& names, 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]); } diff --git a/WebKit/chromium/src/AutoFillPopupMenuClient.h b/WebKit/chromium/src/AutoFillPopupMenuClient.h index 289c8d0..223cf16 100644 --- a/WebKit/chromium/src/AutoFillPopupMenuClient.h +++ b/WebKit/chromium/src/AutoFillPopupMenuClient.h @@ -60,6 +60,9 @@ public: // 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); @@ -72,6 +75,7 @@ public: virtual void selectionCleared(); virtual WebCore::String itemText(unsigned listIndex) const; virtual WebCore::String itemLabel(unsigned listIndex) const; + virtual WebCore::String itemIcon(unsigned listIndex) const; virtual WebCore::String itemToolTip(unsigned lastIndex) const { return WebCore::String(); } virtual WebCore::String itemAccessibilityText(unsigned lastIndex) const { return WebCore::String(); } virtual bool itemIsEnabled(unsigned listIndex) const { return true; } @@ -100,11 +104,13 @@ public: void initialize(WebCore::HTMLInputElement*, const WebVector<WebString>& names, const WebVector<WebString>& labels, + const WebVector<WebString>& icons, const WebVector<int>& uniqueIDs, int separatorIndex); void setSuggestions(const WebVector<WebString>& names, const WebVector<WebString>& labels, + const WebVector<WebString>& icons, const WebVector<int>& uniqueIDs, int separatorIndex); @@ -124,9 +130,10 @@ private: int getSelectedIndex() const { return m_selectedIndex; } void setSelectedIndex(int index) { m_selectedIndex = index; } - // The names and labels that make up the text of the menu items. + // The names, labels and icons that make up the contents of the menu items. Vector<WebCore::String> m_names; Vector<WebCore::String> m_labels; + Vector<WebCore::String> m_icons; Vector<int> m_uniqueIDs; // The index of the separator. -1 if there is no separator. diff --git a/WebKit/chromium/src/ChromiumBridge.cpp b/WebKit/chromium/src/ChromiumBridge.cpp index 333020f..78e0693 100644 --- a/WebKit/chromium/src/ChromiumBridge.cpp +++ b/WebKit/chromium/src/ChromiumBridge.cpp @@ -469,9 +469,8 @@ GeolocationServiceBridge* ChromiumBridge::createGeolocationServiceBridge(Geoloca return createGeolocationServiceBridgeImpl(geolocationServiceChromium); } -// HTML5 DB ------------------------------------------------------------------- +// Databases ------------------------------------------------------------------ -#if ENABLE(DATABASE) PlatformFileHandle ChromiumBridge::databaseOpenFile(const String& vfsFileName, int desiredFlags) { return webKitClient()->databaseOpenFile(WebString(vfsFileName), desiredFlags); @@ -491,7 +490,6 @@ long long ChromiumBridge::databaseGetFileSize(const String& vfsFileName) { return webKitClient()->databaseGetFileSize(WebString(vfsFileName)); } -#endif // Indexed Database ----------------------------------------------------------- diff --git a/WebKit/chromium/src/ContextMenuClientImpl.cpp b/WebKit/chromium/src/ContextMenuClientImpl.cpp index d0d09bf..1dc2ee7 100644 --- a/WebKit/chromium/src/ContextMenuClientImpl.cpp +++ b/WebKit/chromium/src/ContextMenuClientImpl.cpp @@ -277,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/DatabaseObserver.cpp b/WebKit/chromium/src/DatabaseObserver.cpp index e1b7cbe..f43c9bd 100644 --- a/WebKit/chromium/src/DatabaseObserver.cpp +++ b/WebKit/chromium/src/DatabaseObserver.cpp @@ -31,6 +31,8 @@ #include "config.h" #include "DatabaseObserver.h" +#if ENABLE(DATABASE) + #include "AbstractDatabase.h" #include "Document.h" #include "ScriptExecutionContext.h" @@ -84,3 +86,5 @@ void DatabaseObserver::databaseClosed(AbstractDatabase* database) } } // namespace WebCore + +#endif // ENABLE(DATABASE) diff --git a/WebKit/chromium/src/InspectorFrontendClientImpl.cpp b/WebKit/chromium/src/InspectorFrontendClientImpl.cpp index 73cedfa..870bdee 100644 --- a/WebKit/chromium/src/InspectorFrontendClientImpl.cpp +++ b/WebKit/chromium/src/InspectorFrontendClientImpl.cpp @@ -124,4 +124,15 @@ void InspectorFrontendClientImpl::inspectedURLChanged(const String& url) m_frontendPage->mainFrame()->document()->setTitle("Developer Tools - " + url); } +void InspectorFrontendClientImpl::sendMessageToBackend(const String& message) +{ + WebDevToolsMessageData messageData; + messageData.className = "ToolsAgent"; + messageData.methodName = "dispatchOnInspectorController"; + WebVector<WebString> args(static_cast<size_t>(1)); + args[0] = message; + messageData.arguments.swap(args); + m_client->sendMessageToAgent(messageData); +} + } // namespace WebKit diff --git a/WebKit/chromium/src/InspectorFrontendClientImpl.h b/WebKit/chromium/src/InspectorFrontendClientImpl.h index f869ac3..f7174ce 100644 --- a/WebKit/chromium/src/InspectorFrontendClientImpl.h +++ b/WebKit/chromium/src/InspectorFrontendClientImpl.h @@ -68,6 +68,7 @@ public: virtual void inspectedURLChanged(const WebCore::String&); + virtual void sendMessageToBackend(const WebCore::String&); private: WebCore::Page* m_frontendPage; WebDevToolsFrontendClient* m_client; diff --git a/WebKit/chromium/src/SpeechInputClientImpl.cpp b/WebKit/chromium/src/SpeechInputClientImpl.cpp new file mode 100644 index 0000000..8bccacf --- /dev/null +++ b/WebKit/chromium/src/SpeechInputClientImpl.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 "SpeechInputClientImpl.h" + +#include "PlatformString.h" +#include "WebSpeechInputController.h" +#include "WebString.h" +#include "WebViewClient.h" +#include "page/SpeechInputListener.h" + +#if ENABLE(INPUT_SPEECH) + +namespace WebKit { + +SpeechInputClientImpl::SpeechInputClientImpl(WebViewClient* web_view_client) + : m_controller(web_view_client->speechInputController(this)) + , m_listener(0) +{ + ASSERT(m_controller); +} + +SpeechInputClientImpl::~SpeechInputClientImpl() +{ +} + +bool SpeechInputClientImpl::startRecognition(WebCore::SpeechInputListener* listener) +{ + m_listener = listener; + return m_controller->startRecognition(); +} + +void SpeechInputClientImpl::stopRecording() +{ + ASSERT(m_listener); + m_controller->stopRecording(); +} + +void SpeechInputClientImpl::cancelRecognition() +{ + ASSERT(m_listener); + m_controller->cancelRecognition(); +} + +void SpeechInputClientImpl::didCompleteRecording() +{ + ASSERT(m_listener); + m_listener->didCompleteRecording(); +} + +void SpeechInputClientImpl::didCompleteRecognition() +{ + ASSERT(m_listener); + m_listener->didCompleteRecognition(); + m_listener = 0; +} + +void SpeechInputClientImpl::setRecognitionResult(const WebString& result) +{ + ASSERT(m_listener); + m_listener->setRecognitionResult(result); +} + +} // namespace WebKit + +#endif // ENABLE(INPUT_SPEECH) diff --git a/WebKit/chromium/src/SpeechInputClientImpl.h b/WebKit/chromium/src/SpeechInputClientImpl.h new file mode 100644 index 0000000..5762da8 --- /dev/null +++ b/WebKit/chromium/src/SpeechInputClientImpl.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 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. + bool startRecognition(WebCore::SpeechInputListener*); + void stopRecording(); + void cancelRecognition(); + + // WebSpeechInputListener methods. + void didCompleteRecording(); + void setRecognitionResult(const WebString&); + void didCompleteRecognition(); + +private: + WebSpeechInputController* m_controller; // To call into the embedder. + WebCore::SpeechInputListener* m_listener; // Valid when recognition is in progress. +}; + +} // namespace WebKit + +#endif // ENABLE(INPUT_SPEECH) + +#endif // SpeechInputClientImpl_h diff --git a/WebKit/chromium/src/ToolsAgent.h b/WebKit/chromium/src/ToolsAgent.h index c748c8a..937fcf0 100644 --- a/WebKit/chromium/src/ToolsAgent.h +++ b/WebKit/chromium/src/ToolsAgent.h @@ -39,13 +39,7 @@ namespace WebKit { // 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 */) + METHOD1(dispatchOnInspectorController, String /* message */) \ DEFINE_RPC_CLASS(ToolsAgent, TOOLS_AGENT_STRUCT) diff --git a/WebKit/chromium/src/WebAccessibilityObject.cpp b/WebKit/chromium/src/WebAccessibilityObject.cpp index e59a1a2..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" @@ -401,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/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/WebDOMStringList.cpp b/WebKit/chromium/src/WebDOMStringList.cpp index cd145bf..4be7fab 100644 --- a/WebKit/chromium/src/WebDOMStringList.cpp +++ b/WebKit/chromium/src/WebDOMStringList.cpp @@ -38,6 +38,11 @@ using namespace WebCore; namespace WebKit { +WebDOMStringList::WebDOMStringList() +{ + m_private = WebCore::DOMStringList::create(); +} + void WebDOMStringList::reset() { m_private.reset(); diff --git a/WebKit/chromium/src/WebDatabase.cpp b/WebKit/chromium/src/WebDatabase.cpp index 89522f1..561d7c4 100644 --- a/WebKit/chromium/src/WebDatabase.cpp +++ b/WebKit/chromium/src/WebDatabase.cpp @@ -40,6 +40,18 @@ #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 { @@ -84,17 +96,21 @@ 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) { +#if ENABLE(DATABASE) HashSet<RefPtr<AbstractDatabase> > databaseHandles; RefPtr<SecurityOrigin> origin = SecurityOrigin::createFromDatabaseIdentifier(originIdentifier); DatabaseTracker::tracker().getOpenDatabases(origin.get(), databaseName, &databaseHandles); for (HashSet<RefPtr<AbstractDatabase> >::iterator it = databaseHandles.begin(); it != databaseHandles.end(); ++it) it->get()->closeImmediately(); +#endif // ENABLE(DATABASE) } WebDatabase::WebDatabase(const AbstractDatabase* database) diff --git a/WebKit/chromium/src/WebDevToolsAgentImpl.cpp b/WebKit/chromium/src/WebDevToolsAgentImpl.cpp index 0d8cbad..1a65bfe 100644 --- a/WebKit/chromium/src/WebDevToolsAgentImpl.cpp +++ b/WebKit/chromium/src/WebDevToolsAgentImpl.cpp @@ -38,6 +38,7 @@ #include "EventListener.h" #include "InjectedScriptHost.h" #include "InspectorBackend.h" +#include "InspectorBackendDispatcher.h" #include "InspectorController.h" #include "InspectorFrontend.h" #include "InspectorResource.h" @@ -54,7 +55,6 @@ #include "ScriptState.h" #include "ScriptValue.h" #include "V8Binding.h" -#include "V8InspectorBackend.h" #include "V8Proxy.h" #include "V8Utilities.h" #include "WebDataSource.h" @@ -92,7 +92,6 @@ using WebCore::ScriptState; using WebCore::ScriptValue; using WebCore::String; using WebCore::V8DOMWrapper; -using WebCore::V8InspectorBackend; using WebCore::V8Proxy; namespace WebKit { @@ -308,23 +307,9 @@ void WebDevToolsAgentImpl::forceRepaint() m_client->forceRepaint(); } -void WebDevToolsAgentImpl::dispatchOnInspectorController(int callId, const String& functionName, const String& jsonArgs) +void WebDevToolsAgentImpl::dispatchOnInspectorController(const String& 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); + inspectorController()->inspectorBackendDispatcher()->dispatch(message); } void WebDevToolsAgentImpl::dispatchMessageFromFrontend(const WebDevToolsMessageData& data) @@ -386,38 +371,6 @@ void WebDevToolsAgentImpl::initDevToolsAgentHost() "dispatch", WebDevToolsAgentImpl::jsDispatchOnClient); 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() -{ - 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, &V8InspectorBackend::info, 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::createInspectorFrontendProxy() diff --git a/WebKit/chromium/src/WebDevToolsAgentImpl.h b/WebKit/chromium/src/WebDevToolsAgentImpl.h index 12f51f9..c8e22b0 100644 --- a/WebKit/chromium/src/WebDevToolsAgentImpl.h +++ b/WebKit/chromium/src/WebDevToolsAgentImpl.h @@ -72,8 +72,7 @@ public: 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); + virtual void dispatchOnInspectorController(const WebCore::String& message); // WebDevToolsAgentPrivate implementation. virtual void didClearWindowObject(WebFrameImpl* frame); @@ -128,12 +127,6 @@ private: 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; diff --git a/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp b/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp index 3e83f18..592a532 100644 --- a/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp +++ b/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp @@ -150,10 +150,6 @@ void WebDevToolsFrontendImpl::frontendLoaded() { m_loaded = true; - // Grant the devtools page the ability to have source view iframes. - SecurityOrigin* origin = m_webViewImpl->page()->mainFrame()->domWindow()->securityOrigin(); - origin->grantUniversalAccess(); - for (Vector<Vector<String> >::iterator it = m_pendingIncomingMessages.begin(); it != m_pendingIncomingMessages.end(); ++it) { diff --git a/WebKit/chromium/src/WebDocument.cpp b/WebKit/chromium/src/WebDocument.cpp index 017716d..a983bf7 100644 --- a/WebKit/chromium/src/WebDocument.cpp +++ b/WebKit/chromium/src/WebDocument.cpp @@ -32,6 +32,7 @@ #include "WebDocument.h" #include "Document.h" +#include "DocumentType.h" #include "Element.h" #include "HTMLAllCollection.h" #include "HTMLBodyElement.h" @@ -40,6 +41,7 @@ #include "HTMLHeadElement.h" #include "NodeList.h" +#include "WebDocumentType.h" #include "WebElement.h" #include "WebFrameImpl.h" #include "WebNodeCollection.h" @@ -122,6 +124,11 @@ WebNode WebDocument::focusedNode() const return WebNode(constUnwrap<Document>()->focusedNode()); } +WebDocumentType WebDocument::doctype() const +{ + return WebDocumentType(constUnwrap<Document>()->doctype()); +} + WebDocument::WebDocument(const PassRefPtr<Document>& elem) : WebNode(elem) { 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/WebElement.cpp b/WebKit/chromium/src/WebElement.cpp index 25a396e..f45cba9 100644 --- a/WebKit/chromium/src/WebElement.cpp +++ b/WebKit/chromium/src/WebElement.cpp @@ -36,6 +36,8 @@ #include "RenderObject.h" #include <wtf/PassRefPtr.h> +#include "WebNamedNodeMap.h" + using namespace WebCore; namespace WebKit { @@ -73,6 +75,11 @@ 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(); 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/WebInputEventConversion.cpp b/WebKit/chromium/src/WebInputEventConversion.cpp index f68e3ab..1c6d59c 100644 --- a/WebKit/chromium/src/WebInputEventConversion.cpp +++ b/WebKit/chromium/src/WebInputEventConversion.cpp @@ -241,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; @@ -253,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; @@ -281,30 +283,34 @@ 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 ScrollView* view, const WheelEvent& event) +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); - 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(); deltaX = static_cast<float>(event.rawDeltaX()); deltaY = static_cast<float>(event.rawDeltaY()); // The 120 is from WheelEvent::initWheelEvent(). diff --git a/WebKit/chromium/src/WebInputEventConversion.h b/WebKit/chromium/src/WebInputEventConversion.h index dc5db35..63991a9 100644 --- a/WebKit/chromium/src/WebInputEventConversion.h +++ b/WebKit/chromium/src/WebInputEventConversion.h @@ -91,14 +91,14 @@ public: // 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::ScrollView*, const WebCore::WheelEvent&); + WebMouseWheelEventBuilder(const WebCore::Widget*, const WebCore::WheelEvent&); }; // Converts a WebCore::KeyboardEvent to a corresponding WebKeyboardEvent. 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/WebPluginContainerImpl.cpp b/WebKit/chromium/src/WebPluginContainerImpl.cpp index e24e372..7f74db2 100644 --- a/WebKit/chromium/src/WebPluginContainerImpl.cpp +++ b/WebKit/chromium/src/WebPluginContainerImpl.cpp @@ -403,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; @@ -433,8 +433,7 @@ void WebPluginContainerImpl::handleMouseEvent(MouseEvent* event) void WebPluginContainerImpl::handleWheelEvent(WheelEvent* event) { - FrameView* parentView = static_cast<FrameView*>(parent()); - WebMouseWheelEventBuilder webEvent(parentView, *event); + WebMouseWheelEventBuilder webEvent(this, *event); if (webEvent.type == WebInputEvent::Undefined) return; diff --git a/WebKit/chromium/src/WebSecurityPolicy.cpp b/WebKit/chromium/src/WebSecurityPolicy.cpp index 4b2b557..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,17 +44,17 @@ 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::registerURLSchemeAsSecure(const WebString& scheme) { - SecurityOrigin::registerURLSchemeAsSecure(scheme); + SchemeRegistry::registerURLSchemeAsSecure(scheme); } void WebSecurityPolicy::addOriginAccessWhitelistEntry( diff --git a/WebKit/chromium/src/WebSettingsImpl.cpp b/WebKit/chromium/src/WebSettingsImpl.cpp index 6a02ed6..6569e2e 100644 --- a/WebKit/chromium/src/WebSettingsImpl.cpp +++ b/WebKit/chromium/src/WebSettingsImpl.cpp @@ -279,6 +279,11 @@ void WebSettingsImpl::setAcceleratedCompositingEnabled(bool enabled) m_settings->setAcceleratedCompositingEnabled(enabled); } +void WebSettingsImpl::setAccelerated2dCanvasEnabled(bool enabled) +{ + m_settings->setAccelerated2dCanvasEnabled(enabled); +} + void WebSettingsImpl::setHTML5ParserEnabled(bool enabled) { m_settings->setHTML5ParserEnabled(enabled); diff --git a/WebKit/chromium/src/WebSettingsImpl.h b/WebKit/chromium/src/WebSettingsImpl.h index fe5db51..9eedba8 100644 --- a/WebKit/chromium/src/WebSettingsImpl.h +++ b/WebKit/chromium/src/WebSettingsImpl.h @@ -87,6 +87,7 @@ public: virtual void setShowDebugBorders(bool); virtual void setEditingBehavior(EditingBehavior); virtual void setAcceleratedCompositingEnabled(bool); + virtual void setAccelerated2dCanvasEnabled(bool); virtual void setHTML5ParserEnabled(bool); virtual void setMemoryInfoEnabled(bool); diff --git a/WebKit/chromium/src/WebTextRun.cpp b/WebKit/chromium/src/WebTextRun.cpp new file mode 100644 index 0000000..58d9fac --- /dev/null +++ b/WebKit/chromium/src/WebTextRun.cpp @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebTextRun.h" + +#include "TextRun.h" + +using namespace WebCore; + +namespace WebKit { + +WebTextRun::operator WebCore::TextRun() const +{ + return TextRun(text, false, 0, 0, rtl, directionalOverride); +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/WebViewImpl.cpp b/WebKit/chromium/src/WebViewImpl.cpp index 83c8822..bb6d07c 100644 --- a/WebKit/chromium/src/WebViewImpl.cpp +++ b/WebKit/chromium/src/WebViewImpl.cpp @@ -258,6 +258,9 @@ WebViewImpl::WebViewImpl(WebViewClient* client, WebDevToolsAgentClient* devTools , m_layerRenderer(0) , m_isAcceleratedCompositingActive(false) #endif +#if ENABLE(INPUT_SPEECH) + , m_speechInputClient(client) +#endif , m_gles2Context(0) { // WebKit/win/WebView.cpp does the same thing, except they call the @@ -272,7 +275,16 @@ WebViewImpl::WebViewImpl(WebViewClient* client, WebDevToolsAgentClient* devTools if (devToolsClient) m_devToolsAgent = new WebDevToolsAgentImpl(this, devToolsClient); - m_page.set(new Page(&m_chromeClientImpl, &m_contextMenuClientImpl, &m_editorClientImpl, &m_dragClientImpl, &m_inspectorClientImpl, 0, 0, 0, 0)); + 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 + m_page.set(new Page(pageClients)); // the page will take ownership of the various clients @@ -489,10 +501,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) @@ -1018,7 +1030,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: @@ -1731,16 +1743,18 @@ void WebViewImpl::applyAutoFillSuggestions( const WebNode& node, const WebVector<WebString>& names, const WebVector<WebString>& labels, + const WebVector<int>& uniqueIDs, int separatorIndex) { - WebVector<int> uniqueIDs(names.size()); - applyAutoFillSuggestions(node, names, labels, uniqueIDs, separatorIndex); + 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, + const WebVector<WebString>& icons, const WebVector<int>& uniqueIDs, int separatorIndex) { @@ -1771,7 +1785,7 @@ void WebViewImpl::applyAutoFillSuggestions( m_autoFillPopupClient.set(new AutoFillPopupMenuClient); m_autoFillPopupClient->initialize( - inputElem, names, labels, uniqueIDs, separatorIndex); + inputElem, names, labels, icons, uniqueIDs, separatorIndex); if (!m_autoFillPopup.get()) { m_autoFillPopup = PopupContainer::create(m_autoFillPopupClient.get(), @@ -1781,7 +1795,7 @@ void WebViewImpl::applyAutoFillSuggestions( if (m_autoFillPopupShowing) { m_autoFillPopupClient->setSuggestions( - names, labels, uniqueIDs, separatorIndex); + names, labels, icons, uniqueIDs, separatorIndex); refreshAutoFillPopup(); } else { m_autoFillPopup->show(focusedNode->getRect(), @@ -1803,12 +1817,13 @@ void WebViewImpl::applyAutocompleteSuggestions( { WebVector<WebString> names(suggestions.size()); WebVector<WebString> labels(suggestions.size()); + WebVector<WebString> icons(suggestions.size()); WebVector<int> uniqueIDs(suggestions.size()); for (size_t i = 0; i < suggestions.size(); ++i) names[i] = suggestions[i]; - applyAutoFillSuggestions(node, names, labels, uniqueIDs, -1); + applyAutoFillSuggestions(node, names, labels, icons, uniqueIDs, -1); if (m_autoFillPopupClient) m_autoFillPopupClient->setAutocompleteMode(true); } diff --git a/WebKit/chromium/src/WebViewImpl.h b/WebKit/chromium/src/WebViewImpl.h index 312f20f..530fbf5 100644 --- a/WebKit/chromium/src/WebViewImpl.h +++ b/WebKit/chromium/src/WebViewImpl.h @@ -47,6 +47,7 @@ #include "InspectorClientImpl.h" #include "LayerRendererChromium.h" #include "NotificationPresenterImpl.h" +#include "SpeechInputClientImpl.h" #include <wtf/OwnPtr.h> #include <wtf/RefCounted.h> @@ -170,11 +171,13 @@ public: const WebNode&, 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, + const WebVector<WebString>& icons, const WebVector<int>& uniqueIDs, int separatorIndex); // DEPRECATED: replacing with applyAutoFillSuggestions. @@ -239,7 +242,7 @@ 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&); @@ -511,6 +514,10 @@ private: #endif static const WebInputEvent* m_currentInputEvent; +#if ENABLE(INPUT_SPEECH) + SpeechInputClientImpl m_speechInputClient; +#endif + OwnPtr<WebGLES2Context> m_gles2Context; }; diff --git a/WebKit/chromium/src/js/DebuggerScript.js b/WebKit/chromium/src/js/DebuggerScript.js index 7181d74..51787f6 100644 --- a/WebKit/chromium/src/js/DebuggerScript.js +++ b/WebKit/chromium/src/js/DebuggerScript.js @@ -32,6 +32,7 @@ var DebuggerScript = {}; DebuggerScript._breakpoints = {}; +DebuggerScript._breakpointsActivated = true; DebuggerScript.PauseOnExceptionsState = { DontPauseOnExceptions : 0, @@ -82,7 +83,7 @@ DebuggerScript._formatScript = function(script) scriptWorldType = DebuggerScript.ScriptWorldType.ExtensionsWorld; return { id: script.id, - name: script.name, + name: script.nameOrSourceURL(), source: script.source, lineOffset: DebuggerScript._v8ToWebkitLineNumber(script.line_offset), lineCount: script.lineCount(), @@ -94,7 +95,7 @@ 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) + if (!args.enabled || !DebuggerScript._breakpointsActivated) Debug.disableScriptBreakPoint(breakId); var locations = Debug.findBreakPointActualLocations(breakId); @@ -204,6 +205,7 @@ DebuggerScript.setBreakpointsActivated = function(execState, args) else Debug.disableScriptBreakPoint(breakId); } + DebuggerScript._breakpointsActivated = args.enabled; } DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror, callerFrame) diff --git a/WebKit/chromium/src/js/DevTools.js b/WebKit/chromium/src/js/DevTools.js index 35cca2f..640474b 100644 --- a/WebKit/chromium/src/js/DevTools.js +++ b/WebKit/chromium/src/js/DevTools.js @@ -93,7 +93,7 @@ devtools.ToolsAgent.prototype.getProfilerAgent = function() */ devtools.ToolsAgent.prototype.dispatchOnClient_ = function(message) { - var args = JSON.parse(message); + var args = typeof message === "string" ? JSON.parse(message) : message; var methodName = args[0]; var parameters = args.slice(1); WebInspector[methodName].apply(WebInspector, parameters); @@ -129,6 +129,28 @@ devtools.tools = null; var context = {}; // Used by WebCore's inspector routines. +(function() { + WebInspector._paramsObject = {}; + + var queryParams = window.location.search; + if (queryParams) { + var params = queryParams.substring(1).split("&"); + for (var i = 0; i < params.length; ++i) { + var pair = params[i].split("="); + WebInspector._paramsObject[pair[0]] = pair[1]; + } + } + if ("page" in WebInspector._paramsObject) { + WebInspector.socket = new WebSocket("ws://" + window.location.host + "/devtools/page/" + WebInspector._paramsObject.page); + WebInspector.socket.onmessage = function(message) { eval(message.data); } + WebInspector.socket.onerror = function(error) { console.err(error); } + WebInspector.socket.onopen = function() { + WebInspector.socketOpened = true; + if (WebInspector.loadedDone) + WebInspector.doLoadedDone(); + }; + } +})(); /////////////////////////////////////////////////////////////////////////////// // Here and below are overrides to existing WebInspector methods only. // TODO(pfeldman): Patch WebCore and upstream changes. @@ -145,25 +167,25 @@ WebInspector.loaded = function() Preferences.canEditScriptSource = true; Preferences.appCacheEnabled = false; - oldLoaded.call(this); + if ("page" in WebInspector._paramsObject) { + WebInspector.loadedDone = true; + if (WebInspector.socketOpened) + WebInspector.doLoadedDone(); + return; + } + WebInspector.doLoadedDone(); +} +WebInspector.doLoadedDone = function() { + oldLoaded.call(this); InspectorFrontendHost.loaded(); -}; +} devtools.domContentLoaded = function() { - var queryParams = window.location.search; - if (queryParams) { - var params = queryParams.substring(1).split("&"); - var paramsObject = {}; - for (var i = 0; i < params.length; ++i) { - var pair = params[i].split("="); - paramsObject[pair[0]] = pair[1]; - } - WebInspector.setAttachedWindow(paramsObject.docked === "true"); - if (paramsObject.toolbar_color && paramsObject.text_color) - WebInspector.setToolbarColors(paramsObject.toolbar_color, paramsObject.text_color); - } + WebInspector.setAttachedWindow(WebInspector._paramsObject.docked === "true"); + if (WebInspector._paramsObject.toolbar_color && WebInspector._paramsObject.text_color) + WebInspector.setToolbarColors(WebInspector._paramsObject.toolbar_color, WebInspector._paramsObject.text_color); } document.addEventListener("DOMContentLoaded", devtools.domContentLoaded, false); @@ -275,3 +297,10 @@ WebInspector.resetToolbarColors = function() if (window.RemoteDebuggerAgent) { RemoteDebuggerAgent.setContextId = function() {}; } + + +// Support for pause while renderer is busy (is dispatched on IO thread). +InspectorBackend.pause = function() +{ + RemoteDebuggerCommandExecutor.DebuggerPauseScript(); +}; diff --git a/WebKit/chromium/src/js/DevToolsHostStub.js b/WebKit/chromium/src/js/DevToolsHostStub.js index a2f356f..52b28bb 100644 --- a/WebKit/chromium/src/js/DevToolsHostStub.js +++ b/WebKit/chromium/src/js/DevToolsHostStub.js @@ -37,7 +37,6 @@ if (!window["RemoteDebuggerCommandExecutor"]) { window["RemoteDebuggerCommandExecutor"] = {}; window["RemoteProfilerAgent"] = {}; window["RemoteToolsAgent"] = { - dispatchOnInjectedScript: function() {}, dispatchOnInspectorController: function() {} }; } diff --git a/WebKit/chromium/src/js/InspectorControllerImpl.js b/WebKit/chromium/src/js/InspectorControllerImpl.js deleted file mode 100644 index 5ed506a..0000000 --- a/WebKit/chromium/src/js/InspectorControllerImpl.js +++ /dev/null @@ -1,161 +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_("addInspectedNode"); - this.installInspectorControllerDelegate_("addScriptToEvaluateOnLoad"); - this.installInspectorControllerDelegate_("changeTagName"); - this.installInspectorControllerDelegate_("clearConsoleMessages"); - this.installInspectorControllerDelegate_("copyNode"); - this.installInspectorControllerDelegate_("deleteCookie"); - this.installInspectorControllerDelegate_("didEvaluateForTestInFrontend"); - this.installInspectorControllerDelegate_("disableMonitoringXHR"); - this.installInspectorControllerDelegate_("disableResourceTracking"); - this.installInspectorControllerDelegate_("disableSearchingForNode"); - this.installInspectorControllerDelegate_("disableTimeline"); - this.installInspectorControllerDelegate_("enableMonitoringXHR"); - this.installInspectorControllerDelegate_("enableResourceTracking"); - this.installInspectorControllerDelegate_("enableSearchingForNode"); - this.installInspectorControllerDelegate_("enableTimeline"); - this.installInspectorControllerDelegate_("getChildNodes"); - this.installInspectorControllerDelegate_("getCookies"); - this.installInspectorControllerDelegate_("getDatabaseTableNames"); - this.installInspectorControllerDelegate_("getDOMStorageEntries"); - this.installInspectorControllerDelegate_("getEventListenersForNode"); - this.installInspectorControllerDelegate_("getOuterHTML"); - this.installInspectorControllerDelegate_("getProfile"); - this.installInspectorControllerDelegate_("getProfileHeaders"); - this.installInspectorControllerDelegate_("removeProfile"); - this.installInspectorControllerDelegate_("clearProfiles"); - this.installInspectorControllerDelegate_("getResourceContent"); - this.installInspectorControllerDelegate_("highlightDOMNode"); - this.installInspectorControllerDelegate_("hideDOMNodeHighlight"); - this.installInspectorControllerDelegate_("performSearch"); - this.installInspectorControllerDelegate_("pushNodeByPathToFrontend"); - this.installInspectorControllerDelegate_("releaseWrapperObjectGroup"); - this.installInspectorControllerDelegate_("removeAllScriptsToEvaluateOnLoad"); - this.installInspectorControllerDelegate_("reloadPage"); - this.installInspectorControllerDelegate_("removeAttribute"); - this.installInspectorControllerDelegate_("removeDOMStorageItem"); - this.installInspectorControllerDelegate_("removeNode"); - this.installInspectorControllerDelegate_("saveApplicationSettings"); - this.installInspectorControllerDelegate_("saveSessionSettings"); - this.installInspectorControllerDelegate_("searchCanceled"); - this.installInspectorControllerDelegate_("setAttribute"); - this.installInspectorControllerDelegate_("setDOMStorageItem"); - this.installInspectorControllerDelegate_("setInjectedScriptSource"); - this.installInspectorControllerDelegate_("setOuterHTML"); - this.installInspectorControllerDelegate_("setTextNodeValue"); - this.installInspectorControllerDelegate_("startProfiling"); - this.installInspectorControllerDelegate_("startTimelineProfiler"); - this.installInspectorControllerDelegate_("stopProfiling"); - this.installInspectorControllerDelegate_("stopTimelineProfiler"); - this.installInspectorControllerDelegate_("storeLastActivePanel"); - this.installInspectorControllerDelegate_("takeHeapSnapshot"); - - this.installInspectorControllerDelegate_("getAllStyles"); - this.installInspectorControllerDelegate_("getStyles"); - this.installInspectorControllerDelegate_("getComputedStyle"); - this.installInspectorControllerDelegate_("getInlineStyle"); - this.installInspectorControllerDelegate_("getStyleSheet"); - this.installInspectorControllerDelegate_("getRuleRangesForStyleSheetId"); - this.installInspectorControllerDelegate_("applyStyleText"); - this.installInspectorControllerDelegate_("setStyleText"); - this.installInspectorControllerDelegate_("setStyleProperty"); - this.installInspectorControllerDelegate_("toggleStyleEnabled"); - this.installInspectorControllerDelegate_("setRuleSelector"); - this.installInspectorControllerDelegate_("addRule"); - - this.installInspectorControllerDelegate_("disableDebugger"); - this.installInspectorControllerDelegate_("editScriptSource"); - this.installInspectorControllerDelegate_("getScriptSource"); - this.installInspectorControllerDelegate_("enableDebugger"); - this.installInspectorControllerDelegate_("setBreakpoint"); - this.installInspectorControllerDelegate_("removeBreakpoint"); - this.installInspectorControllerDelegate_("activateBreakpoints"); - this.installInspectorControllerDelegate_("deactivateBreakpoints"); - this.installInspectorControllerDelegate_("resume"); - this.installInspectorControllerDelegate_("stepIntoStatement"); - this.installInspectorControllerDelegate_("stepOutOfFunction"); - this.installInspectorControllerDelegate_("stepOverStatement"); - this.installInspectorControllerDelegate_("setPauseOnExceptionsState"); -}; -devtools.InspectorBackendImpl.prototype.__proto__ = WebInspector.InspectorBackendStub.prototype; - - -devtools.InspectorBackendImpl.prototype.pause = function() -{ - RemoteDebuggerCommandExecutor.DebuggerPauseScript(); -}; - - -/** - * @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/tests/PopupMenuTest.cpp b/WebKit/chromium/tests/PopupMenuTest.cpp index 9aad6bb..44b262d 100644 --- a/WebKit/chromium/tests/PopupMenuTest.cpp +++ b/WebKit/chromium/tests/PopupMenuTest.cpp @@ -69,6 +69,7 @@ public: 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; } diff --git a/WebKit/CMakeListsEfl.txt b/WebKit/efl/CMakeListsEfl.txt index ee67d71..0701d22 100644 --- a/WebKit/CMakeListsEfl.txt +++ b/WebKit/efl/CMakeListsEfl.txt @@ -15,9 +15,6 @@ LIST(APPEND WebKit_INCLUDE_DIRECTORIES ${EDJE_INCLUDE_DIRS} ${EFLDEPS_INCLUDE_DIRS} ${EVAS_INCLUDE_DIRS} - ${Gdk_INCLUDE_DIRS} - ${Glib_INCLUDE_DIRS} - ${LIBSOUP24_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIRS} ${LIBXSLT_INCLUDE_DIRS} ${SQLITE_INCLUDE_DIRS} @@ -48,15 +45,32 @@ LIST(APPEND WebKit_LIBRARIES ${ECORE_X_LIBRARIES} ${EFLDEPS_LIBRARIES} ${Freetype_LIBRARIES} - ${Gdk_LIBRARIES} - ${Glib_LIBRARIES} - ${Gtk_LIBRARIES} - ${LIBSOUP24_LIBRARIES} ${LIBXML2_LIBRARIES} ${Pango_LIBRARIES} ${SQLITE_LIBRARIES} ) +IF (ENABLE_GLIB_SUPPORT) + LIST(APPEND WebKit_INCLUDE_DIRECTORIES + ${Gdk_INCLUDE_DIRS} + ${Glib_INCLUDE_DIRS} + ) + LIST(APPEND WebKit_LIBRARIES + ${Glib_LIBRARIES} + ${Gdk_LIBRARIES} + ) +ENDIF () + +IF (WTF_USE_SOUP) + LIST(APPEND WebKit_INCLUDE_DIRECTORIES ${LIBSOUP24_INCLUDE_DIRS}) + LIST(APPEND WebKit_LIBRARIES ${LIBSOUP24_LIBRARIES}) +ENDIF () + +IF (WTF_USE_CURL) + LIST(APPEND WebKit_INCLUDE_DIRECTORIES ${CURL_INCLUDE_DIRS}) + LIST(APPEND WebKit_LIBRARIES ${CURL_LIBRARIES}) +ENDIF () + FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/WebKit/efl/DefaultTheme) GENERATE_EDJ( ${WEBKIT_DIR}/efl/DefaultTheme/default.edc @@ -78,9 +92,6 @@ SET(EWebLauncher_LIBRARIES ${EDJE_LIBRARIES} ${EFLDEPS_LIBRARIES} ${EVAS_LIBRARIES} - ${Gdk_LIBRARIES} - ${Glib_LIBRARIES} - ${LIBSOUP24_LIBRARIES} ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${SQLITE_LIBRARIES} @@ -91,9 +102,26 @@ SET(EWebLauncher_LINK_FLAGS ${EDJE_LDFLAGS} ${EFLDEPS_LDFLAGS} ${EVAS_LDFLAGS} - ${LIBSOUP24_LDFLAGS} ) +IF (ENABLE_GLIB_SUPPORT) + LIST(APPEND EWebLauncher_LIBRARIES + ${Gdk_LIBRARIES} + ${Glib_LIBRARIES} + ${GTHREAD_LIBRARIES} + ) +ENDIF () + +IF (WTF_USE_SOUP) + LIST(APPEND EWebLauncher_LIBRARIES ${LIBSOUP24_LIBRARIES}) + LIST(APPEND EWebLauncher_LINK_FLAGS ${LIBSOUP24_LDFLAGS}) +ENDIF () + +IF (WTF_USE_CURL) + LIST(APPEND EWebLauncher_LIBRARIES ${CURL_LIBRARIES}) + LIST(APPEND EWebLauncher_LINK_FLAGS ${CURL_LDFLAGS}) +ENDIF () + ADD_EXECUTABLE(../Programs/EWebLauncher ${EWebLauncher_SOURCES}) TARGET_LINK_LIBRARIES(../Programs/EWebLauncher ${EWebLauncher_LIBRARIES}) ADD_TARGET_PROPERTIES(../Programs/EWebLauncher LINK_FLAGS "${EWebLauncher_LINK_FLAGS}") diff --git a/WebKit/efl/ChangeLog b/WebKit/efl/ChangeLog index b5ad1d7..ad44392 100644 --- a/WebKit/efl/ChangeLog +++ b/WebKit/efl/ChangeLog @@ -1,3 +1,95 @@ +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 + + * ewk/ewk_view.cpp: + (_ewk_view_priv_new): + +2010-07-26 Rafael Antognolli <antognolli@profusion.mobi> + + Reviewed by Antonio Gomes. + + [EFL] Move CMakeListsEfl.txt to WebKit/efl/ + https://bugs.webkit.org/show_bug.cgi?id=43002 + + This should reduce the noise in WebKit/ChangeLog that comes from EFL + port. Most of the changes on EFL port should be logged in + WebKit/efl/ChangeLog. + + * CMakeListsEfl.txt: Renamed from WebKit/CMakeListsEfl.txt. + +2010-07-23 Rafael Antognolli <antognolli@profusion.mobi> + + Reviewed by Antonio Gomes. + + [EFL] Cleanup glib support (make it optional) + https://bugs.webkit.org/show_bug.cgi?id=42480 + + Put some ifdefs on glib calls. + + * ewk/ewk_main.cpp: + (ewk_init): + +2010-07-23 Rafael Antognolli <antognolli@profusion.mobi> + + Reviewed by Antonio Gomes. + + [EFL] Add support for using libcurl network backend. + https://bugs.webkit.org/show_bug.cgi?id=42286 + + Put some ifdefs around soup calls. + + * ewk/ewk_cookies.cpp: + (ewk_cookies_file_set): + (ewk_cookies_clear): + (ewk_cookies_get_all): + (ewk_cookies_cookie_del): + (ewk_cookies_cookie_free): + (ewk_cookies_policy_set): + (ewk_cookies_policy_get): + * ewk/ewk_main.cpp: + (ewk_init): + +2010-07-23 Lucas De Marchi <lucas.demarchi@profusion.mobi> + + Reviewed by Kenneth Rohde Christiansen. + + Notify browser when window shall be closed. + + This is used for window.close() events Javascript, though it would be + triggered for any event on WebCore that might ask for the window to be + closed. + + https://bugs.webkit.org/show_bug.cgi?id=42890 + + * WebCoreSupport/ChromeClientEfl.cpp: + (WebCore::ChromeClientEfl::closeWindowSoon): call new function and moves its + previous functionality there. + * ewk/ewk_private.h: + * ewk/ewk_view.cpp: + (ewk_view_window_close): stop all loaders as was being done previously and + notify browser afterwards. + * ewk/ewk_view.h: declare new virtual method. + +2010-07-23 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + Reviewed by Kenneth Rohde Christiansen. + + [EFL] Set proxy address for Soup + https://bugs.webkit.org/show_bug.cgi?id=42721 + + Sets the given proxy URI for libsoup network backend. This method will + support libcurl network backend later. + + * EWebLauncher/main.c: + (main): Invoke proxy set method + * ewk/ewk_settings.cpp: + (ewk_settings_proxy_uri_set): Sets proxy URI. + * ewk/ewk_settings.h: + 2010-07-16 Leandro Pereira <leandro@profusion.mobi> Reviewed by Gustavo Noronha Silva. diff --git a/WebKit/efl/EWebLauncher/main.c b/WebKit/efl/EWebLauncher/main.c index 6980a58..c1956a2 100644 --- a/WebKit/efl/EWebLauncher/main.c +++ b/WebKit/efl/EWebLauncher/main.c @@ -373,6 +373,21 @@ on_tooltip_text_set(void* user_data, Evas_Object* webview, void* event_info) info("%s\n", text); } +static void +on_inputmethod_changed(void* user_data, Evas_Object* webview, void* event_info) +{ + Eina_Bool active = (Eina_Bool)(long)event_info; + unsigned int imh; + info("Keyboard changed: %d\n", active); + + if (!active) + return; + + imh = ewk_view_imh_get(webview); + info(" Keyboard flags: %#.2x\n", imh); + +} + /** * "viewport,changed" signal will be always emitted regardless of the viewport existence. * @@ -661,6 +676,7 @@ browserCreate(const char *url, const char *theme, const char *userAgent, Eina_Re evas_object_smart_callback_add(app->browser, "menubar,visible,set", on_menubar_visible_set, app); evas_object_smart_callback_add(app->browser, "menubar,visible,get", on_menubar_visible_get, app); evas_object_smart_callback_add(app->browser, "tooltip,text,set", on_tooltip_text_set, app); + evas_object_smart_callback_add(app->browser, "inputmethod,changed", on_inputmethod_changed, app); /* ewk_callback_resize_requested_add(app->browser, on_resize_requested, app->ee); */ @@ -756,6 +772,7 @@ main(int argc, char *argv[]) char *url = NULL; char *userAgent = NULL; const char *tmp; + const char *proxyUri; char path[PATH_MAX]; char *engine = NULL; @@ -818,6 +835,10 @@ main(int argc, char *argv[]) ewk_settings_icon_database_path_set(path); ewk_settings_web_database_path_set(path); + proxyUri = getenv("http_proxy"); + if (proxyUri) + ewk_settings_proxy_uri_set(proxyUri); + browserCreate(url, theme, userAgent, geometry, engine, isFullscreen); ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, main_signal_exit, &windows); diff --git a/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp b/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp index 4b01b75..ffbd642 100644 --- a/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp +++ b/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp @@ -231,7 +231,7 @@ void ChromeClientEfl::setResizable(bool) void ChromeClientEfl::closeWindowSoon() { - ewk_view_stop(m_view); + ewk_view_window_close(m_view); } bool ChromeClientEfl::canTakeFocus(FocusDirection) diff --git a/WebKit/efl/WebCoreSupport/EditorClientEfl.cpp b/WebKit/efl/WebCoreSupport/EditorClientEfl.cpp index cf672eb..a63b712 100644 --- a/WebKit/efl/WebCoreSupport/EditorClientEfl.cpp +++ b/WebKit/efl/WebCoreSupport/EditorClientEfl.cpp @@ -47,7 +47,7 @@ void EditorClientEfl::willSetInputMethodState() void EditorClientEfl::setInputMethodState(bool active) { - notImplemented(); + ewk_view_input_method_state_set(m_view, active); } bool EditorClientEfl::shouldDeleteRange(Range*) diff --git a/WebKit/efl/ewk/ewk_cookies.cpp b/WebKit/efl/ewk/ewk_cookies.cpp index 3b4949e..421f8dc 100644 --- a/WebKit/efl/ewk/ewk_cookies.cpp +++ b/WebKit/efl/ewk/ewk_cookies.cpp @@ -21,14 +21,18 @@ #include "config.h" #include "ewk_cookies.h" +#ifdef WTF_USE_SOUP #include "CookieJarSoup.h" +#endif #include "EWebKit.h" #include "ResourceHandle.h" #include <Eina.h> #include <eina_safety_checks.h> +#ifdef WTF_USE_SOUP #include <glib.h> #include <libsoup/soup.h> +#endif #include <wtf/text/CString.h> @@ -43,6 +47,7 @@ */ EAPI Eina_Bool ewk_cookies_file_set(const char *filename) { +#ifdef WTF_USE_SOUP SoupCookieJar* cookieJar = 0; if (filename) cookieJar = soup_cookie_jar_text_new(filename, FALSE); @@ -65,6 +70,9 @@ EAPI Eina_Bool ewk_cookies_file_set(const char *filename) soup_session_add_feature(session, SOUP_SESSION_FEATURE(cookieJar)); return EINA_TRUE; +#else + return EINA_FALSE; +#endif } /** @@ -72,6 +80,7 @@ EAPI Eina_Bool ewk_cookies_file_set(const char *filename) */ EAPI void ewk_cookies_clear() { +#ifdef WTF_USE_SOUP GSList* l; GSList* p; SoupCookieJar* cookieJar = WebCore::defaultCookieJar(); @@ -81,6 +90,7 @@ EAPI void ewk_cookies_clear() soup_cookie_jar_delete_cookie(cookieJar, (SoupCookie*)p->data); soup_cookies_free(l); +#endif } /** @@ -90,9 +100,10 @@ EAPI void ewk_cookies_clear() */ EAPI Eina_List* ewk_cookies_get_all(void) { + Eina_List* el = 0; +#ifdef WTF_USE_SOUP GSList* l; GSList* p; - Eina_List* el = 0; SoupCookieJar* cookieJar = WebCore::defaultCookieJar(); l = soup_cookie_jar_all_cookies(cookieJar); @@ -110,6 +121,7 @@ EAPI Eina_List* ewk_cookies_get_all(void) } soup_cookies_free(l); +#endif return el; } @@ -123,6 +135,7 @@ EAPI Eina_List* ewk_cookies_get_all(void) */ EAPI void ewk_cookies_cookie_del(Ewk_Cookie *cookie) { +#ifdef WTF_USE_SOUP EINA_SAFETY_ON_NULL_RETURN(cookie); GSList* l; GSList* p; @@ -141,6 +154,7 @@ EAPI void ewk_cookies_cookie_del(Ewk_Cookie *cookie) soup_cookie_free(c1); soup_cookies_free(l); +#endif } /* @@ -150,12 +164,14 @@ EAPI void ewk_cookies_cookie_del(Ewk_Cookie *cookie) */ EAPI void ewk_cookies_cookie_free(Ewk_Cookie *cookie) { +#ifdef WTF_USE_SOUP EINA_SAFETY_ON_NULL_RETURN(cookie); free(cookie->name); free(cookie->value); free(cookie->domain); free(cookie->path); free(cookie); +#endif } /* @@ -170,6 +186,7 @@ EAPI void ewk_cookies_cookie_free(Ewk_Cookie *cookie) */ EAPI void ewk_cookies_policy_set(Ewk_Cookie_Policy p) { +#ifdef WTF_USE_SOUP #ifdef HAVE_LIBSOUP_2_29_90 SoupCookieJar* cookieJar = WebCore::defaultCookieJar(); SoupCookieJarAcceptPolicy policy; @@ -189,6 +206,7 @@ EAPI void ewk_cookies_policy_set(Ewk_Cookie_Policy p) soup_cookie_jar_set_accept_policy(cookieJar, policy); #endif +#endif } /* @@ -199,6 +217,7 @@ EAPI void ewk_cookies_policy_set(Ewk_Cookie_Policy p) EAPI Ewk_Cookie_Policy ewk_cookies_policy_get() { Ewk_Cookie_Policy ewk_policy = EWK_COOKIE_JAR_ACCEPT_ALWAYS; +#ifdef WTF_USE_SOUP #ifdef HAVE_LIBSOUP_2_29_90 SoupCookieJar* cookieJar = WebCore::defaultCookieJar(); SoupCookieJarAcceptPolicy policy; @@ -216,6 +235,7 @@ EAPI Ewk_Cookie_Policy ewk_cookies_policy_get() break; } #endif +#endif return ewk_policy; } diff --git a/WebKit/efl/ewk/ewk_main.cpp b/WebKit/efl/ewk/ewk_main.cpp index 92346e7..5742766 100644 --- a/WebKit/efl/ewk/ewk_main.cpp +++ b/WebKit/efl/ewk/ewk_main.cpp @@ -37,7 +37,7 @@ #include <Evas.h> #include <stdlib.h> -#ifdef ENABLE_GLIB_SUPPORT +#if ENABLE(GLIB_SUPPORT) #include <glib-object.h> #include <glib.h> @@ -47,9 +47,11 @@ #endif +#ifdef WTF_USE_SOUP // REMOVE-ME: see todo below #include "ResourceHandle.h" #include <libsoup/soup.h> +#endif static int _ewk_init_count = 0; int _ewk_log_dom = -1; @@ -88,7 +90,7 @@ int ewk_init(void) goto error_edje; } -#ifdef ENABLE_GLIB_SUPPORT +#if ENABLE(GLIB_SUPPORT) g_type_init(); if (!g_thread_supported()) @@ -119,10 +121,12 @@ int ewk_init(void) ewk_settings_web_database_path_set(getenv("HOME")); // TODO: this should move to WebCore, already reported to webkit-gtk folks: +#ifdef WTF_USE_SOUP if (1) { SoupSession* session = WebCore::ResourceHandle::defaultSession(); soup_session_add_feature_by_type(session, SOUP_TYPE_CONTENT_SNIFFER); } +#endif return ++_ewk_init_count; diff --git a/WebKit/efl/ewk/ewk_private.h b/WebKit/efl/ewk/ewk_private.h index c549ad7..2096e76 100644 --- a/WebKit/efl/ewk/ewk_private.h +++ b/WebKit/efl/ewk/ewk_private.h @@ -49,6 +49,7 @@ struct ContextMenuItem; } void ewk_view_ready(Evas_Object *o); +void ewk_view_input_method_state_set(Evas_Object* o, Eina_Bool active); void ewk_view_title_set(Evas_Object *o, const char *title); void ewk_view_uri_changed(Evas_Object *o); void ewk_view_load_started(Evas_Object *o); @@ -62,6 +63,7 @@ void ewk_view_load_progress_changed(Evas_Object *o); void ewk_view_load_show(Evas_Object* o); void ewk_view_restore_state(Evas_Object *o, Evas_Object *frame); Evas_Object *ewk_view_window_create(Evas_Object *o, Eina_Bool javascript, const WebCore::WindowFeatures* coreFeatures); +void ewk_view_window_close(Evas_Object *o); void ewk_view_mouse_link_hover_in(Evas_Object *o, void *data); void ewk_view_mouse_link_hover_out(Evas_Object *o); diff --git a/WebKit/efl/ewk/ewk_settings.cpp b/WebKit/efl/ewk/ewk_settings.cpp index b50cd75..e775ac9 100644 --- a/WebKit/efl/ewk/ewk_settings.cpp +++ b/WebKit/efl/ewk/ewk_settings.cpp @@ -39,6 +39,11 @@ #include <sys/types.h> #include <unistd.h> +#if USE(SOUP) +#include "ResourceHandle.h" +#include <libsoup/soup.h> +#endif + static uint64_t _ewk_default_web_database_quota = 1 * 1024 * 1024; /** @@ -223,3 +228,22 @@ Evas_Object* ewk_settings_icon_database_icon_object_add(const char* url, Evas* c surface = icon->nativeImageForCurrentFrame(); return ewk_util_image_from_cairo_surface_add(canvas, surface); } + +/** + * Sets the given proxy URI to network backend. + * + * @param proxy URI. + */ +void ewk_settings_proxy_uri_set(const char* proxy) +{ +#if USE(SOUP) + SoupURI* uri = soup_uri_new(proxy); + EINA_SAFETY_ON_NULL_RETURN(uri); + + SoupSession* session = WebCore::ResourceHandle::defaultSession(); + g_object_set(session, SOUP_SESSION_PROXY_URI, uri, NULL); + soup_uri_free(uri); +#elif USE(CURL) + EINA_SAFETY_ON_TRUE_RETURN(1); +#endif +} diff --git a/WebKit/efl/ewk/ewk_settings.h b/WebKit/efl/ewk/ewk_settings.h index 87d015c..f2d77f7 100644 --- a/WebKit/efl/ewk/ewk_settings.h +++ b/WebKit/efl/ewk/ewk_settings.h @@ -48,6 +48,7 @@ EAPI Eina_Bool ewk_settings_icon_database_clear(void); EAPI cairo_surface_t *ewk_settings_icon_database_icon_surface_get(const char *url); EAPI Evas_Object *ewk_settings_icon_database_icon_object_add(const char *url, Evas *canvas); +EAPI void ewk_settings_proxy_uri_set(const char* proxy); #ifdef __cplusplus } diff --git a/WebKit/efl/ewk/ewk_view.cpp b/WebKit/efl/ewk/ewk_view.cpp index 1707a7d..ed6fb4d 100644 --- a/WebKit/efl/ewk/ewk_view.cpp +++ b/WebKit/efl/ewk/ewk_view.cpp @@ -34,6 +34,9 @@ #include "FrameLoaderClientEfl.h" #include "FrameView.h" #include "GraphicsContext.h" +#include "HTMLElement.h" +#include "HTMLInputElement.h" +#include "HTMLNames.h" #include "InspectorClientEfl.h" #include "PlatformMouseEvent.h" #include "PopupMenuClient.h" @@ -79,6 +82,7 @@ struct _Ewk_View_Private_Data { size_t count; size_t allocated; } scrolls; + unsigned int imh; /**< input method hints */ struct { const char* user_agent; const char* user_stylesheet; @@ -525,16 +529,14 @@ static Ewk_View_Private_Data* _ewk_view_priv_new(Ewk_View_Smart_Data* sd) CRITICAL("could not allocate Ewk_View_Private_Data"); return 0; } - priv->page = new WebCore::Page( - static_cast<WebCore::ChromeClient*>(new WebCore::ChromeClientEfl(sd->self)), - static_cast<WebCore::ContextMenuClient*>(new WebCore::ContextMenuClientEfl(sd->self)), - static_cast<WebCore::EditorClient*>(new WebCore::EditorClientEfl(sd->self)), - static_cast<WebCore::DragClient*>(new WebCore::DragClientEfl), - static_cast<WebCore::InspectorClient*>(new WebCore::InspectorClientEfl), - 0, - 0, - 0, - 0); + + WebCore::Page::PageClients pageClients; + pageClients.chromeClient = static_cast<WebCore::ChromeClient*>(new WebCore::ChromeClientEfl(sd->self)); + pageClients.contextMenuClient = static_cast<WebCore::ContextMenuClient*>(new WebCore::ContextMenuClientEfl(sd->self)); + pageClients.editorClient = static_cast<WebCore::EditorClient*>(new WebCore::EditorClientEfl(sd->self)); + pageClients.dragClient = static_cast<WebCore::DragClient*>(new WebCore::DragClientEfl); + pageClients.inspectorClient = static_cast<WebCore::InspectorClient*>(new WebCore::InspectorClientEfl); + priv->page = new WebCore::Page(pageClients); if (!priv->page) { CRITICAL("Could not create WebKit Page"); goto error_page; @@ -2150,6 +2152,20 @@ Eina_Bool ewk_view_pre_render_region(Evas_Object* o, Evas_Coord x, Evas_Coord y, } /** + * Get input method hints + * + * @param o View. + * + * @return input method hints + */ +unsigned int ewk_view_imh_get(Evas_Object *o) +{ + EWK_VIEW_SD_GET_OR_RETURN(o, sd, 0); + EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv, 0); + return priv->imh; +} + +/** * Cancel (clear) previous pre-render requests. * * @param o view to clear pre-render requests. @@ -3026,6 +3042,46 @@ void ewk_view_ready(Evas_Object* o) /** * @internal + * Reports the state of input method changed. This is triggered, for example + * when a input field received/lost focus + * + * Emits signal: "inputmethod,changed" with a boolean indicating whether it's + * enabled or not. + */ +void ewk_view_input_method_state_set(Evas_Object* o, Eina_Bool active) +{ + EWK_VIEW_SD_GET_OR_RETURN(o, sd); + EWK_VIEW_PRIV_GET(sd, priv); + WebCore::Frame* focusedFrame = priv->page->focusController()->focusedOrMainFrame(); + + if (focusedFrame + && focusedFrame->document() + && focusedFrame->document()->focusedNode() + && focusedFrame->document()->focusedNode()->hasTagName(WebCore::HTMLNames::inputTag)) { + WebCore::HTMLInputElement* inputElement; + + inputElement = static_cast<WebCore::HTMLInputElement*>(focusedFrame->document()->focusedNode()); + if (inputElement) { + priv->imh = 0; + // for password fields, active == false + if (!active) { + active = inputElement->isPasswordField(); + priv->imh = inputElement->isPasswordField() * EWK_IMH_PASSWORD; + } else { + // Set input method hints for "number", "tel", "email", and "url" input elements. + priv->imh |= inputElement->isTelephoneField() * EWK_IMH_TELEPHONE; + priv->imh |= inputElement->isNumberField() * EWK_IMH_NUMBER; + priv->imh |= inputElement->isEmailField() * EWK_IMH_EMAIL; + priv->imh |= inputElement->isUrlField() * EWK_IMH_URL; + } + } + } + + evas_object_smart_callback_call(o, "inputmethod,changed", (void*)active); +} + +/** + * @internal * The view title was changed by the frame loader. * * Emits signal: "title,changed" with pointer to new title string. @@ -3234,6 +3290,27 @@ Evas_Object* ewk_view_window_create(Evas_Object* o, Eina_Bool javascript, const /** * @internal + * Reports a window should be closed. It's client responsibility to decide if + * the window should in fact be closed. So, if only windows created by javascript + * are allowed to be closed by this call, browser needs to save the javascript + * flag when the window is created. Since a window can close itself (for example + * with a 'self.close()' in Javascript) browser must postpone the deletion to an + * idler. + * + * @param o View to be closed. + */ +void ewk_view_window_close(Evas_Object* o) +{ + EWK_VIEW_SD_GET_OR_RETURN(o, sd); + + ewk_view_stop(o); + if (!sd->api->window_close) + return; + sd->api->window_close(sd); +} + +/** + * @internal * Reports mouse has moved over a link. * * Emits signal: "link,hover,in" diff --git a/WebKit/efl/ewk/ewk_view.h b/WebKit/efl/ewk/ewk_view.h index 209beff..19a3588 100644 --- a/WebKit/efl/ewk/ewk_view.h +++ b/WebKit/efl/ewk/ewk_view.h @@ -86,6 +86,7 @@ extern "C" { * and as arguments gives its details. * - "icon,received", void: main frame received an icon. * - "viewport,changed", void: Report that viewport has changed. + * - "inputmethods,changed" with a boolean indicating whether it's enabled or not. */ typedef struct _Ewk_View_Smart_Data Ewk_View_Smart_Data; @@ -99,6 +100,7 @@ struct _Ewk_View_Smart_Class { unsigned long version; Evas_Object *(*window_create)(Ewk_View_Smart_Data *sd, Eina_Bool javascript, const Ewk_Window_Features *window_features); /**< creates a new window, requested by webkit */ + void (*window_close)(Ewk_View_Smart_Data *sd); /**< creates a new window, requested by webkit */ // hooks to allow different backing stores Evas_Object *(*backing_store_add)(Ewk_View_Smart_Data *sd); /**< must be defined */ Eina_Bool (*scrolls_process)(Ewk_View_Smart_Data *sd); /**< must be defined */ @@ -145,7 +147,7 @@ struct _Ewk_View_Smart_Class { * @see EWK_VIEW_SMART_CLASS_INIT_VERSION * @see EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION */ -#define EWK_VIEW_SMART_CLASS_INIT(smart_class_init) {smart_class_init, EWK_VIEW_SMART_CLASS_VERSION, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +#define EWK_VIEW_SMART_CLASS_INIT(smart_class_init) {smart_class_init, EWK_VIEW_SMART_CLASS_VERSION, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} /** * Initializer to zero a whole Ewk_View_Smart_Class structure. @@ -186,6 +188,15 @@ struct _Ewk_View_Smart_Class { */ #define EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION(name) EWK_VIEW_SMART_CLASS_INIT(EVAS_SMART_CLASS_INIT_NAME_VERSION(name)) +enum _Ewk_Imh { + EWK_IMH_TELEPHONE = (1 << 0), + EWK_IMH_NUMBER = (1 << 1), + EWK_IMH_EMAIL = (1 << 2), + EWK_IMH_URL = (1 << 3), + EWK_IMH_PASSWORD = (1 << 4) +}; +typedef enum _Ewk_Imh Ewk_Imh; + /** * @internal * @@ -357,6 +368,8 @@ EAPI Eina_Bool ewk_view_zoom_text_only_set(Evas_Object *o, Eina_Bool setting) EAPI Eina_Bool ewk_view_pre_render_region(Evas_Object *o, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h, float zoom); EAPI void ewk_view_pre_render_cancel(Evas_Object *o); +EAPI unsigned int ewk_view_imh_get(Evas_Object *o); + /* settings */ EAPI const char *ewk_view_setting_user_agent_get(const Evas_Object *o); EAPI Eina_Bool ewk_view_setting_user_agent_set(Evas_Object *o, const char *user_agent); diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog index 803bf12..bf1777d 100644 --- a/WebKit/gtk/ChangeLog +++ b/WebKit/gtk/ChangeLog @@ -1,3 +1,13 @@ +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 + + * webkit/webkitwebview.cpp: + (webkit_web_view_init): + 2010-07-16 Zhe Su <suzhe@chromium.org> Reviewed by Darin Adler. diff --git a/WebKit/gtk/webkit/webkitwebview.cpp b/WebKit/gtk/webkit/webkitwebview.cpp index 0010a77..cde9148 100644 --- a/WebKit/gtk/webkit/webkitwebview.cpp +++ b/WebKit/gtk/webkit/webkitwebview.cpp @@ -3041,8 +3041,13 @@ static void webkit_web_view_init(WebKitWebView* webView) priv->imContext = gtk_im_multicontext_new(); - WebKit::InspectorClient* inspectorClient = new WebKit::InspectorClient(webView); - priv->corePage = new Page(new WebKit::ChromeClient(webView), new WebKit::ContextMenuClient(webView), new WebKit::EditorClient(webView), new WebKit::DragClient(webView), inspectorClient, 0, 0, 0, 0); + Page::PageClients pageClients; + pageClients.chromeClient = new WebKit::ChromeClient(webView); + pageClients.contextMenuClient = new WebKit::ContextMenuClient(webView); + pageClients.editorClient = new WebKit::EditorClient(webView); + pageClients.dragClient = new WebKit::DragClient(webView); + pageClients.inspectorClient = new WebKit::InspectorClient(webView); + priv->corePage = new Page(pageClients); // We also add a simple wrapper class to provide the public // interface for the Web Inspector. diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog index 95c460b..013780d 100644 --- a/WebKit/mac/ChangeLog +++ b/WebKit/mac/ChangeLog @@ -1,3 +1,76 @@ +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 + + * WebView/WebView.mm: + (-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]): + +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 + + * Configurations/FeatureDefines.xcconfig: + +2010-07-27 Steve Block <steveblock@google.com> + + Reviewed by Jeremy Orlow. + + Client-based Geolocation does not pass enableHighAccuracy option to controller and client + https://bugs.webkit.org/show_bug.cgi?id=40374 + + Stub out setEnableHighAccuracy method for the Mac port. + + * WebCoreSupport/WebGeolocationControllerClient.h: + (WebGeolocationControllerClient::setEnableHighAccuracy): + +2010-07-22 Sam Weinig <sam@webkit.org> + + Reviewed by Maciej Stachowiak. + + Fix for <rdar://problem/8222626> + Send textDidChangeInTextField delegate callback only in response to typing or other forms of user text input. + + The function name no longer perfectly matches the behavior, but I didn't want to break any existing clients. Maybe we + should migrate to a new function name eventually + + * WebCoreSupport/WebEditorClient.mm: + (WebEditorClient::textDidChangeInTextField): + +2010-07-22 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=42836 + Add localized strings stubs for WebKit2. + + - Convert WebKit (mac) to use a LocalizationStrategy rather than the WebCoreViewFactory + for localized strings. + + Gets us below 200 tests failing in WebKitTestRunner. + + * WebCoreSupport/WebContextMenuClient.mm: + (fixMenusReceivedFromOldClients): Use LocalizedStrings rather than the factory. + * WebCoreSupport/WebPlatformStrategies.h: + * WebCoreSupport/WebPlatformStrategies.mm: + * WebCoreSupport/WebViewFactory.mm: + +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 + + * WebView/WebView.mm: + (+[WebView _registerURLSchemeAsSecure:]): + (+[WebView registerURLSchemeAsLocal:]): + 2010-07-21 Simon Fraser <simon.fraser@apple.com> Reviewed by Anders Carlsson. diff --git a/WebKit/mac/Configurations/FeatureDefines.xcconfig b/WebKit/mac/Configurations/FeatureDefines.xcconfig index 4b363aa..8e33a91 100644 --- a/WebKit/mac/Configurations/FeatureDefines.xcconfig +++ b/WebKit/mac/Configurations/FeatureDefines.xcconfig @@ -55,6 +55,7 @@ ENABLE_EVENTSOURCE = ENABLE_EVENTSOURCE; ENABLE_FILTERS = ENABLE_FILTERS; ENABLE_FILE_READER = ENABLE_FILE_READER; ENABLE_FILE_WRITER = ; +ENABLE_FILE_SYSTEM = ; ENABLE_GEOLOCATION = ENABLE_GEOLOCATION; ENABLE_ICONDATABASE = ENABLE_ICONDATABASE; ENABLE_IMAGE_RESIZER = ; @@ -85,4 +86,4 @@ ENABLE_XHTMLMP = ; ENABLE_XPATH = ENABLE_XPATH; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_LINK_PREFETCH) $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB_SLICE) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_READER) $(ENABLE_FILE_WRITER) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_IMAGE_RESIZER) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_METER_TAG) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_LINK_PREFETCH) $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB_SLICE) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_READER) $(ENABLE_FILE_WRITER) $(ENABLE_FILE_SYSTEM) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_IMAGE_RESIZER) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_METER_TAG) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT); diff --git a/WebKit/mac/Configurations/Version.xcconfig b/WebKit/mac/Configurations/Version.xcconfig index 2749545..c1b6b32 100644 --- a/WebKit/mac/Configurations/Version.xcconfig +++ b/WebKit/mac/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 534; -MINOR_VERSION = 3; +MINOR_VERSION = 4; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm b/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm index e4e069a..f3a85f0 100644 --- a/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm +++ b/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm @@ -43,6 +43,7 @@ #import "WebViewInternal.h" #import <WebCore/ContextMenu.h> #import <WebCore/KURL.h> +#import <WebCore/LocalizedStrings.h> #import <WebCore/RuntimeApplicationChecks.h> #import <WebKit/DOMPrivate.h> @@ -168,77 +169,77 @@ static void fixMenusReceivedFromOldClients(NSMutableArray *newMenuItems, NSMutab if (tag == WebMenuItemTagOther) { // Restore the specific tag for items on which we temporarily set WebMenuItemTagOther to match old behavior. NSString *title = [item title]; - if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagOpenLink]]) + if ([title isEqualToString:contextMenuItemTagOpenLink()]) modernTag = WebMenuItemTagOpenLink; - else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagIgnoreGrammar]]) + else if ([title isEqualToString:contextMenuItemTagIgnoreGrammar()]) modernTag = WebMenuItemTagIgnoreGrammar; - else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagSpellingMenu]]) + else if ([title isEqualToString:contextMenuItemTagSpellingMenu()]) modernTag = WebMenuItemTagSpellingMenu; - else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagShowSpellingPanel:true]] - || [title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagShowSpellingPanel:false]]) + else if ([title isEqualToString:contextMenuItemTagShowSpellingPanel(true)] + || [title isEqualToString:contextMenuItemTagShowSpellingPanel(false)]) modernTag = WebMenuItemTagShowSpellingPanel; - else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagCheckSpelling]]) + else if ([title isEqualToString:contextMenuItemTagCheckSpelling()]) modernTag = WebMenuItemTagCheckSpelling; - else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagCheckSpellingWhileTyping]]) + else if ([title isEqualToString:contextMenuItemTagCheckSpellingWhileTyping()]) modernTag = WebMenuItemTagCheckSpellingWhileTyping; - else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagCheckGrammarWithSpelling]]) + else if ([title isEqualToString:contextMenuItemTagCheckGrammarWithSpelling()]) modernTag = WebMenuItemTagCheckGrammarWithSpelling; - else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagFontMenu]]) + else if ([title isEqualToString:contextMenuItemTagFontMenu()]) modernTag = WebMenuItemTagFontMenu; - else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagShowFonts]]) + else if ([title isEqualToString:contextMenuItemTagShowFonts()]) modernTag = WebMenuItemTagShowFonts; - else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagBold]]) + else if ([title isEqualToString:contextMenuItemTagBold()]) modernTag = WebMenuItemTagBold; - else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagItalic]]) + else if ([title isEqualToString:contextMenuItemTagItalic()]) modernTag = WebMenuItemTagItalic; - else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagUnderline]]) + else if ([title isEqualToString:contextMenuItemTagUnderline()]) modernTag = WebMenuItemTagUnderline; - else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagOutline]]) + else if ([title isEqualToString:contextMenuItemTagOutline()]) modernTag = WebMenuItemTagOutline; - else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagStyles]]) + else if ([title isEqualToString:contextMenuItemTagStyles()]) modernTag = WebMenuItemTagStyles; - else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagShowColors]]) + else if ([title isEqualToString:contextMenuItemTagShowColors()]) modernTag = WebMenuItemTagShowColors; - else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagSpeechMenu]]) + else if ([title isEqualToString:contextMenuItemTagSpeechMenu()]) modernTag = WebMenuItemTagSpeechMenu; - else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagStartSpeaking]]) + else if ([title isEqualToString:contextMenuItemTagStartSpeaking()]) modernTag = WebMenuItemTagStartSpeaking; - else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagStopSpeaking]]) + else if ([title isEqualToString:contextMenuItemTagStopSpeaking()]) modernTag = WebMenuItemTagStopSpeaking; - else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagWritingDirectionMenu]]) + else if ([title isEqualToString:contextMenuItemTagWritingDirectionMenu()]) modernTag = WebMenuItemTagWritingDirectionMenu; - else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagDefaultDirection]]) + else if ([title isEqualToString:contextMenuItemTagDefaultDirection()]) modernTag = WebMenuItemTagDefaultDirection; - else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagLeftToRight]]) + else if ([title isEqualToString:contextMenuItemTagLeftToRight()]) modernTag = WebMenuItemTagLeftToRight; - else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagRightToLeft]]) + else if ([title isEqualToString:contextMenuItemTagRightToLeft()]) modernTag = WebMenuItemTagRightToLeft; - else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagInspectElement]]) + else if ([title isEqualToString:contextMenuItemTagInspectElement()]) modernTag = WebMenuItemTagInspectElement; - else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagCorrectSpellingAutomatically]]) + else if ([title isEqualToString:contextMenuItemTagCorrectSpellingAutomatically()]) modernTag = WebMenuItemTagCorrectSpellingAutomatically; - else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagSubstitutionsMenu]]) + else if ([title isEqualToString:contextMenuItemTagSubstitutionsMenu()]) modernTag = WebMenuItemTagSubstitutionsMenu; - else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagShowSubstitutions:true]] - || [title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagShowSubstitutions:false]]) + else if ([title isEqualToString:contextMenuItemTagShowSubstitutions(true)] + || [title isEqualToString:contextMenuItemTagShowSubstitutions(false)]) modernTag = WebMenuItemTagShowSubstitutions; - else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagSmartCopyPaste]]) + else if ([title isEqualToString:contextMenuItemTagSmartCopyPaste()]) modernTag = WebMenuItemTagSmartCopyPaste; - else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagSmartQuotes]]) + else if ([title isEqualToString:contextMenuItemTagSmartQuotes()]) modernTag = WebMenuItemTagSmartQuotes; - else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagSmartDashes]]) + else if ([title isEqualToString:contextMenuItemTagSmartDashes()]) modernTag = WebMenuItemTagSmartDashes; - else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagSmartLinks]]) + else if ([title isEqualToString:contextMenuItemTagSmartLinks()]) modernTag = WebMenuItemTagSmartLinks; - else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagTextReplacement]]) + else if ([title isEqualToString:contextMenuItemTagTextReplacement()]) modernTag = WebMenuItemTagTextReplacement; - else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagTransformationsMenu]]) + else if ([title isEqualToString:contextMenuItemTagTransformationsMenu()]) modernTag = WebMenuItemTagTransformationsMenu; - else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagMakeUpperCase]]) + else if ([title isEqualToString:contextMenuItemTagMakeUpperCase()]) modernTag = WebMenuItemTagMakeUpperCase; - else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagMakeLowerCase]]) + else if ([title isEqualToString:contextMenuItemTagMakeLowerCase()]) modernTag = WebMenuItemTagMakeLowerCase; - else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagCapitalize]]) + else if ([title isEqualToString:contextMenuItemTagCapitalize()]) modernTag = WebMenuItemTagCapitalize; else { // We don't expect WebMenuItemTagOther for any items other than the ones we explicitly handle. diff --git a/WebKit/mac/WebCoreSupport/WebEditorClient.mm b/WebKit/mac/WebCoreSupport/WebEditorClient.mm index d2f2706..2c89919 100644 --- a/WebKit/mac/WebCoreSupport/WebEditorClient.mm +++ b/WebKit/mac/WebCoreSupport/WebEditorClient.mm @@ -59,6 +59,7 @@ #import <WebCore/LegacyWebArchive.h> #import <WebCore/PlatformKeyboardEvent.h> #import <WebCore/PlatformString.h> +#import <WebCore/UserTypingGestureIndicator.h> #import <WebCore/WebCoreObjCExtras.h> #import <runtime/InitializeThreading.h> #import <wtf/PassRefPtr.h> @@ -557,12 +558,15 @@ void WebEditorClient::textFieldDidEndEditing(Element* element) FormDelegateLog(inputElement); CallFormDelegate(m_webView, @selector(textFieldDidEndEditing:inFrame:), inputElement, kit(element->document()->frame())); } - + void WebEditorClient::textDidChangeInTextField(Element* element) { if (!element->hasTagName(inputTag)) return; + if (!UserTypingGestureIndicator::processingUserTypingGesture() || UserTypingGestureIndicator::focusedElementAtGestureStart() != element) + return; + DOMHTMLInputElement* inputElement = kit(static_cast<HTMLInputElement*>(element)); FormDelegateLog(inputElement); CallFormDelegate(m_webView, @selector(textDidChangeInTextField:inFrame:), inputElement, kit(element->document()->frame())); diff --git a/WebKit/mac/WebCoreSupport/WebGeolocationControllerClient.h b/WebKit/mac/WebCoreSupport/WebGeolocationControllerClient.h index 3965210..34d6a29 100644 --- a/WebKit/mac/WebCoreSupport/WebGeolocationControllerClient.h +++ b/WebKit/mac/WebCoreSupport/WebGeolocationControllerClient.h @@ -39,6 +39,7 @@ public: void geolocationDestroyed(); void startUpdating(); void stopUpdating(); + void setEnableHighAccuracy(bool) { } WebCore::GeolocationPosition* lastPosition(); diff --git a/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h b/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h index ce8bf9d..0ac4f16 100644 --- a/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h +++ b/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h @@ -28,8 +28,9 @@ #include <WebCore/PlatformStrategies.h> #include <WebCore/PluginStrategy.h> +#include <WebCore/LocalizationStrategy.h> -class WebPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::PluginStrategy { +class WebPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::PluginStrategy, private WebCore::LocalizationStrategy { public: static void initialize(); @@ -38,10 +39,115 @@ private: // WebCore::PlatformStrategies virtual WebCore::PluginStrategy* createPluginStrategy(); + virtual WebCore::LocalizationStrategy* createLocalizationStrategy(); // WebCore::PluginStrategy virtual void refreshPlugins(); virtual void getPluginInfo(Vector<WebCore::PluginInfo>&); + + // WebCore::LocalizationStrategy + virtual WebCore::String inputElementAltText(); + virtual WebCore::String resetButtonDefaultLabel(); + virtual WebCore::String searchableIndexIntroduction(); + virtual WebCore::String submitButtonDefaultLabel(); + virtual WebCore::String fileButtonChooseFileLabel(); + virtual WebCore::String fileButtonNoFileSelectedLabel(); + virtual WebCore::String copyImageUnknownFileLabel(); +#if ENABLE(CONTEXT_MENUS) + virtual WebCore::String contextMenuItemTagOpenLinkInNewWindow(); + virtual WebCore::String contextMenuItemTagDownloadLinkToDisk(); + virtual WebCore::String contextMenuItemTagCopyLinkToClipboard(); + virtual WebCore::String contextMenuItemTagOpenImageInNewWindow(); + virtual WebCore::String contextMenuItemTagDownloadImageToDisk(); + virtual WebCore::String contextMenuItemTagCopyImageToClipboard(); + virtual WebCore::String contextMenuItemTagOpenFrameInNewWindow(); + virtual WebCore::String contextMenuItemTagCopy(); + virtual WebCore::String contextMenuItemTagGoBack(); + virtual WebCore::String contextMenuItemTagGoForward(); + virtual WebCore::String contextMenuItemTagStop(); + virtual WebCore::String contextMenuItemTagReload(); + virtual WebCore::String contextMenuItemTagCut(); + virtual WebCore::String contextMenuItemTagPaste(); + virtual WebCore::String contextMenuItemTagNoGuessesFound(); + virtual WebCore::String contextMenuItemTagIgnoreSpelling(); + virtual WebCore::String contextMenuItemTagLearnSpelling(); + virtual WebCore::String contextMenuItemTagSearchWeb(); + virtual WebCore::String contextMenuItemTagLookUpInDictionary(); + virtual WebCore::String contextMenuItemTagOpenLink(); + virtual WebCore::String contextMenuItemTagIgnoreGrammar(); + virtual WebCore::String contextMenuItemTagSpellingMenu(); + virtual WebCore::String contextMenuItemTagShowSpellingPanel(bool show); + virtual WebCore::String contextMenuItemTagCheckSpelling(); + virtual WebCore::String contextMenuItemTagCheckSpellingWhileTyping(); + virtual WebCore::String contextMenuItemTagCheckGrammarWithSpelling(); + virtual WebCore::String contextMenuItemTagFontMenu(); + virtual WebCore::String contextMenuItemTagBold(); + virtual WebCore::String contextMenuItemTagItalic(); + virtual WebCore::String contextMenuItemTagUnderline(); + virtual WebCore::String contextMenuItemTagOutline(); + virtual WebCore::String contextMenuItemTagWritingDirectionMenu(); + virtual WebCore::String contextMenuItemTagTextDirectionMenu(); + virtual WebCore::String contextMenuItemTagDefaultDirection(); + virtual WebCore::String contextMenuItemTagLeftToRight(); + virtual WebCore::String contextMenuItemTagRightToLeft(); + virtual WebCore::String contextMenuItemTagSearchInSpotlight(); + virtual WebCore::String contextMenuItemTagShowFonts(); + virtual WebCore::String contextMenuItemTagStyles(); + virtual WebCore::String contextMenuItemTagShowColors(); + virtual WebCore::String contextMenuItemTagSpeechMenu(); + virtual WebCore::String contextMenuItemTagStartSpeaking(); + virtual WebCore::String contextMenuItemTagStopSpeaking(); + virtual WebCore::String contextMenuItemTagCorrectSpellingAutomatically(); + virtual WebCore::String contextMenuItemTagSubstitutionsMenu(); + virtual WebCore::String contextMenuItemTagShowSubstitutions(bool show); + virtual WebCore::String contextMenuItemTagSmartCopyPaste(); + virtual WebCore::String contextMenuItemTagSmartQuotes(); + virtual WebCore::String contextMenuItemTagSmartDashes(); + virtual WebCore::String contextMenuItemTagSmartLinks(); + virtual WebCore::String contextMenuItemTagTextReplacement(); + virtual WebCore::String contextMenuItemTagTransformationsMenu(); + virtual WebCore::String contextMenuItemTagMakeUpperCase(); + virtual WebCore::String contextMenuItemTagMakeLowerCase(); + virtual WebCore::String contextMenuItemTagCapitalize(); + virtual WebCore::String contextMenuItemTagChangeBack(const WebCore::String& replacedString); + virtual WebCore::String contextMenuItemTagInspectElement(); +#endif // ENABLE(CONTEXT_MENUS) + virtual WebCore::String searchMenuNoRecentSearchesText(); + virtual WebCore::String searchMenuRecentSearchesText(); + virtual WebCore::String searchMenuClearRecentSearchesText(); + virtual WebCore::String AXWebAreaText(); + virtual WebCore::String AXLinkText(); + virtual WebCore::String AXListMarkerText(); + virtual WebCore::String AXImageMapText(); + virtual WebCore::String AXHeadingText(); + virtual WebCore::String AXDefinitionListTermText(); + virtual WebCore::String AXDefinitionListDefinitionText(); + virtual WebCore::String AXARIAContentGroupText(const WebCore::String& ariaType); + virtual WebCore::String AXButtonActionVerb(); + virtual WebCore::String AXRadioButtonActionVerb(); + virtual WebCore::String AXTextFieldActionVerb(); + virtual WebCore::String AXCheckedCheckBoxActionVerb(); + virtual WebCore::String AXUncheckedCheckBoxActionVerb(); + virtual WebCore::String AXMenuListActionVerb(); + virtual WebCore::String AXMenuListPopupActionVerb(); + virtual WebCore::String AXLinkActionVerb(); + virtual WebCore::String missingPluginText(); + virtual WebCore::String crashedPluginText(); + virtual WebCore::String multipleFileUploadText(unsigned numberOfFiles); + virtual WebCore::String unknownFileSizeText(); + virtual WebCore::String imageTitle(const WebCore::String& filename, const WebCore::IntSize& size); + virtual WebCore::String mediaElementLoadingStateText(); + virtual WebCore::String mediaElementLiveBroadcastStateText(); + virtual WebCore::String localizedMediaControlElementString(const WebCore::String&); + virtual WebCore::String localizedMediaControlElementHelpText(const WebCore::String&); + virtual WebCore::String localizedMediaTimeDescription(float); + virtual WebCore::String validationMessageValueMissingText(); + virtual WebCore::String validationMessageTypeMismatchText(); + virtual WebCore::String validationMessagePatternMismatchText(); + virtual WebCore::String validationMessageTooLongText(); + virtual WebCore::String validationMessageRangeUnderflowText(); + virtual WebCore::String validationMessageRangeOverflowText(); + virtual WebCore::String validationMessageStepMismatchText(); }; #endif // WebPlatformStrategies_h diff --git a/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm b/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm index d4bb684..6805f5e 100644 --- a/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm +++ b/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm @@ -25,9 +25,11 @@ #import "WebPlatformStrategies.h" +#import "WebLocalizableStrings.h" #import "WebPluginDatabase.h" #import "WebPluginPackage.h" #import <WebCore/BlockExceptions.h> +#import <WebCore/IntSize.h> #import <wtf/StdLibExtras.h> #ifdef BUILDING_ON_TIGER @@ -53,6 +55,11 @@ PluginStrategy* WebPlatformStrategies::createPluginStrategy() return this; } +LocalizationStrategy* WebPlatformStrategies::createLocalizationStrategy() +{ + return this; +} + void WebPlatformStrategies::refreshPlugins() { [[WebPluginDatabase sharedDatabase] refresh]; @@ -72,4 +79,686 @@ void WebPlatformStrategies::getPluginInfo(Vector<WebCore::PluginInfo>& plugins) END_BLOCK_OBJC_EXCEPTIONS; } +// LocalizationStrategy + +String WebPlatformStrategies::inputElementAltText() +{ + return UI_STRING_KEY("Submit", "Submit (input element)", "alt text for <input> elements with no alt, title, or value"); +} + +String WebPlatformStrategies::resetButtonDefaultLabel() +{ + return UI_STRING("Reset", "default label for Reset buttons in forms on web pages"); +} + +String WebPlatformStrategies::searchableIndexIntroduction() +{ + return UI_STRING("This is a searchable index. Enter search keywords: ", + "text that appears at the start of nearly-obsolete web pages in the form of a 'searchable index'"); +} + +String WebPlatformStrategies::submitButtonDefaultLabel() +{ + return UI_STRING("Submit", "default label for Submit buttons in forms on web pages"); +} + +String WebPlatformStrategies::fileButtonChooseFileLabel() +{ + return UI_STRING("Choose File", "title for file button used in HTML forms"); +} + +String WebPlatformStrategies::fileButtonNoFileSelectedLabel() +{ + return UI_STRING("no file selected", "text to display in file button used in HTML forms when no file is selected"); +} + +String WebPlatformStrategies::copyImageUnknownFileLabel() +{ + return UI_STRING("unknown", "Unknown filename"); +} + +#if ENABLE(CONTEXT_MENUS) + +String WebPlatformStrategies::contextMenuItemTagOpenLinkInNewWindow() +{ + return UI_STRING("Open Link in New Window", "Open in New Window context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagDownloadLinkToDisk() +{ + return UI_STRING("Download Linked File", "Download Linked File context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagCopyLinkToClipboard() +{ + return UI_STRING("Copy Link", "Copy Link context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagOpenImageInNewWindow() +{ + return UI_STRING("Open Image in New Window", "Open Image in New Window context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagDownloadImageToDisk() +{ + return UI_STRING("Download Image", "Download Image context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagCopyImageToClipboard() +{ + return UI_STRING("Copy Image", "Copy Image context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagOpenFrameInNewWindow() +{ + return UI_STRING("Open Frame in New Window", "Open Frame in New Window context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagCopy() +{ + return UI_STRING("Copy", "Copy context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagGoBack() +{ + return UI_STRING("Back", "Back context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagGoForward() +{ + return UI_STRING("Forward", "Forward context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagStop() +{ + return UI_STRING("Stop", "Stop context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagReload() +{ + return UI_STRING("Reload", "Reload context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagCut() +{ + return UI_STRING("Cut", "Cut context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagPaste() +{ + return UI_STRING("Paste", "Paste context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagNoGuessesFound() +{ + return UI_STRING("No Guesses Found", "No Guesses Found context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagIgnoreSpelling() +{ + return UI_STRING("Ignore Spelling", "Ignore Spelling context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagLearnSpelling() +{ + return UI_STRING("Learn Spelling", "Learn Spelling context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagSearchWeb() +{ + return UI_STRING("Search in Google", "Search in Google context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagLookUpInDictionary() +{ + return UI_STRING("Look Up in Dictionary", "Look Up in Dictionary context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagOpenLink() +{ + return UI_STRING("Open Link", "Open Link context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagIgnoreGrammar() +{ + return UI_STRING("Ignore Grammar", "Ignore Grammar context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagSpellingMenu() +{ +#ifndef BUILDING_ON_TIGER + return UI_STRING("Spelling and Grammar", "Spelling and Grammar context sub-menu item"); +#else + return UI_STRING("Spelling", "Spelling context sub-menu item"); +#endif +} + +String WebPlatformStrategies::contextMenuItemTagShowSpellingPanel(bool show) +{ +#ifndef BUILDING_ON_TIGER + if (show) + return UI_STRING("Show Spelling and Grammar", "menu item title"); + return UI_STRING("Hide Spelling and Grammar", "menu item title"); +#else + return UI_STRING("Spelling...", "menu item title"); +#endif +} + +String WebPlatformStrategies::contextMenuItemTagCheckSpelling() +{ +#ifndef BUILDING_ON_TIGER + return UI_STRING("Check Document Now", "Check spelling context menu item"); +#else + return UI_STRING("Check Spelling", "Check spelling context menu item"); +#endif +} + +String WebPlatformStrategies::contextMenuItemTagCheckSpellingWhileTyping() +{ +#ifndef BUILDING_ON_TIGER + return UI_STRING("Check Spelling While Typing", "Check spelling while typing context menu item"); +#else + return UI_STRING("Check Spelling as You Type", "Check spelling while typing context menu item"); +#endif +} + +String WebPlatformStrategies::contextMenuItemTagCheckGrammarWithSpelling() +{ + return UI_STRING("Check Grammar With Spelling", "Check grammar with spelling context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagFontMenu() +{ + return UI_STRING("Font", "Font context sub-menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagBold() +{ + return UI_STRING("Bold", "Bold context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagItalic() +{ + return UI_STRING("Italic", "Italic context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagUnderline() +{ + return UI_STRING("Underline", "Underline context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagOutline() +{ + return UI_STRING("Outline", "Outline context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagWritingDirectionMenu() +{ +#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) + return UI_STRING("Paragraph Direction", "Paragraph direction context sub-menu item"); +#else + return UI_STRING("Writing Direction", "Writing direction context sub-menu item"); +#endif +} + +String WebPlatformStrategies::contextMenuItemTagTextDirectionMenu() +{ + return UI_STRING("Selection Direction", "Selection direction context sub-menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagDefaultDirection() +{ + return UI_STRING("Default", "Default writing direction context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagLeftToRight() +{ + return UI_STRING("Left to Right", "Left to Right context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagRightToLeft() +{ + return UI_STRING("Right to Left", "Right to Left context menu item"); +} + +#if PLATFORM(MAC) + +String WebPlatformStrategies::contextMenuItemTagSearchInSpotlight() +{ + return UI_STRING("Search in Spotlight", "Search in Spotlight context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagShowFonts() +{ + return UI_STRING("Show Fonts", "Show fonts context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagStyles() +{ + return UI_STRING("Styles...", "Styles context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagShowColors() +{ + return UI_STRING("Show Colors", "Show colors context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagSpeechMenu() +{ + return UI_STRING("Speech", "Speech context sub-menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagStartSpeaking() +{ + return UI_STRING("Start Speaking", "Start speaking context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagStopSpeaking() +{ + return UI_STRING("Stop Speaking", "Stop speaking context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagCorrectSpellingAutomatically() +{ + return UI_STRING("Correct Spelling Automatically", "Correct Spelling Automatically context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagSubstitutionsMenu() +{ + return UI_STRING("Substitutions", "Substitutions context sub-menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagShowSubstitutions(bool show) +{ + if (show) + return UI_STRING("Show Substitutions", "menu item title"); + return UI_STRING("Hide Substitutions", "menu item title"); +} + +String WebPlatformStrategies::contextMenuItemTagSmartCopyPaste() +{ + return UI_STRING("Smart Copy/Paste", "Smart Copy/Paste context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagSmartQuotes() +{ + return UI_STRING("Smart Quotes", "Smart Quotes context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagSmartDashes() +{ + return UI_STRING("Smart Dashes", "Smart Dashes context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagSmartLinks() +{ + return UI_STRING("Smart Links", "Smart Links context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagTextReplacement() +{ + return UI_STRING("Text Replacement", "Text Replacement context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagTransformationsMenu() +{ + return UI_STRING("Transformations", "Transformations context sub-menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagMakeUpperCase() +{ + return UI_STRING("Make Upper Case", "Make Upper Case context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagMakeLowerCase() +{ + return UI_STRING("Make Lower Case", "Make Lower Case context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagCapitalize() +{ + return UI_STRING("Capitalize", "Capitalize context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagChangeBack(const String& replacedString) +{ + static NSString *formatString = nil; +#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) + static bool lookedUpString = false; + if (!lookedUpString) { + formatString = [[[NSBundle bundleForClass:[NSSpellChecker class]] localizedStringForKey:@"Change Back to \\U201C%@\\U201D" value:nil table:@"MenuCommands"] retain]; + lookedUpString = true; + } +#endif + if (!formatString) + return replacedString; + return [NSString stringWithFormat:formatString, (NSString *)replacedString]; +} + +#endif + +String WebPlatformStrategies::contextMenuItemTagInspectElement() +{ + return UI_STRING("Inspect Element", "Inspect Element context menu item"); +} + +#endif // ENABLE(CONTEXT_MENUS) + +String WebPlatformStrategies::searchMenuNoRecentSearchesText() +{ + return UI_STRING("No recent searches", "Label for only item in menu that appears when clicking on the search field image, when no searches have been performed"); +} + +String WebPlatformStrategies::searchMenuRecentSearchesText() +{ + return UI_STRING("Recent Searches", "label for first item in the menu that appears when clicking on the search field image, used as embedded menu title"); +} + +String WebPlatformStrategies::searchMenuClearRecentSearchesText() +{ + return UI_STRING("Clear Recent Searches", "menu item in Recent Searches menu that empties menu's contents"); +} + +String WebPlatformStrategies::AXWebAreaText() +{ + return UI_STRING("HTML content", "accessibility role description for web area"); +} + +String WebPlatformStrategies::AXLinkText() +{ + return UI_STRING("link", "accessibility role description for link"); +} + +String WebPlatformStrategies::AXListMarkerText() +{ + return UI_STRING("list marker", "accessibility role description for list marker"); +} + +String WebPlatformStrategies::AXImageMapText() +{ + return UI_STRING("image map", "accessibility role description for image map"); +} + +String WebPlatformStrategies::AXHeadingText() +{ + return UI_STRING("heading", "accessibility role description for headings"); +} + +String WebPlatformStrategies::AXDefinitionListTermText() +{ + return UI_STRING("term", "term word of a definition"); +} + +String WebPlatformStrategies::AXDefinitionListDefinitionText() +{ + return UI_STRING("definition", "definition phrase"); +} + +String WebPlatformStrategies::AXARIAContentGroupText(const String& ariaType) +{ + if (ariaType == "ARIAApplicationAlert") + return UI_STRING("alert", "An ARIA accessibility group that acts as an alert."); + if (ariaType == "ARIAApplicationAlertDialog") + return UI_STRING("alert dialog", "An ARIA accessibility group that acts as an alert dialog."); + if (ariaType == "ARIAApplicationDialog") + return UI_STRING("dialog", "An ARIA accessibility group that acts as an dialog."); + if (ariaType == "ARIAApplicationLog") + return UI_STRING("log", "An ARIA accessibility group that acts as a console log."); + if (ariaType == "ARIAApplicationMarquee") + return UI_STRING("marquee", "An ARIA accessibility group that acts as a marquee."); + if (ariaType == "ARIAApplicationStatus") + return UI_STRING("application status", "An ARIA accessibility group that acts as a status update."); + if (ariaType == "ARIAApplicationTimer") + return UI_STRING("timer", "An ARIA accessibility group that acts as an updating timer."); + if (ariaType == "ARIADocument") + return UI_STRING("document", "An ARIA accessibility group that acts as a document."); + if (ariaType == "ARIADocumentArticle") + return UI_STRING("article", "An ARIA accessibility group that acts as an article."); + if (ariaType == "ARIADocumentNote") + return UI_STRING("note", "An ARIA accessibility group that acts as a note in a document."); + if (ariaType == "ARIADocumentRegion") + return UI_STRING("region", "An ARIA accessibility group that acts as a distinct region in a document."); + if (ariaType == "ARIALandmarkApplication") + return UI_STRING("application", "An ARIA accessibility group that acts as an application."); + if (ariaType == "ARIALandmarkBanner") + return UI_STRING("banner", "An ARIA accessibility group that acts as a banner."); + if (ariaType == "ARIALandmarkComplementary") + return UI_STRING("complementary", "An ARIA accessibility group that acts as a region of complementary information."); + if (ariaType == "ARIALandmarkContentInfo") + return UI_STRING("content", "An ARIA accessibility group that contains content."); + if (ariaType == "ARIALandmarkMain") + return UI_STRING("main", "An ARIA accessibility group that is the main portion of the website."); + if (ariaType == "ARIALandmarkNavigation") + return UI_STRING("navigation", "An ARIA accessibility group that contains the main navigation elements of a website."); + if (ariaType == "ARIALandmarkSearch") + return UI_STRING("search", "An ARIA accessibility group that contains a search feature of a website."); + if (ariaType == "ARIAUserInterfaceTooltip") + return UI_STRING("tooltip", "An ARIA accessibility group that acts as a tooltip."); + if (ariaType == "ARIATabPanel") + return UI_STRING("tab panel", "An ARIA accessibility group that contains the content of a tab."); + if (ariaType == "ARIADocumentMath") + return UI_STRING("math", "An ARIA accessibility group that contains mathematical symbols."); + return String(); +} + +String WebPlatformStrategies::AXButtonActionVerb() +{ + return UI_STRING("press", "Verb stating the action that will occur when a button is pressed, as used by accessibility"); +} + +String WebPlatformStrategies::AXRadioButtonActionVerb() +{ + return UI_STRING("select", "Verb stating the action that will occur when a radio button is clicked, as used by accessibility"); +} + +String WebPlatformStrategies::AXTextFieldActionVerb() +{ + return UI_STRING("activate", "Verb stating the action that will occur when a text field is selected, as used by accessibility"); +} + +String WebPlatformStrategies::AXCheckedCheckBoxActionVerb() +{ + return UI_STRING("uncheck", "Verb stating the action that will occur when a checked checkbox is clicked, as used by accessibility"); +} + +String WebPlatformStrategies::AXUncheckedCheckBoxActionVerb() +{ + return UI_STRING("check", "Verb stating the action that will occur when an unchecked checkbox is clicked, as used by accessibility"); +} + +String WebPlatformStrategies::AXMenuListActionVerb() +{ + return String(); +} + +String WebPlatformStrategies::AXMenuListPopupActionVerb() +{ + return String(); +} + +String WebPlatformStrategies::AXLinkActionVerb() +{ + return UI_STRING("jump", "Verb stating the action that will occur when a link is clicked, as used by accessibility"); +} + +String WebPlatformStrategies::missingPluginText() +{ + return UI_STRING("Missing Plug-in", "Label text to be used when a plugin is missing"); +} + +String WebPlatformStrategies::crashedPluginText() +{ + return UI_STRING("Plug-in Failure", "Label text to be used if plugin host process has crashed"); +} + +String WebPlatformStrategies::multipleFileUploadText(unsigned numberOfFiles) +{ + return [NSString stringWithFormat:UI_STRING("%d files", "Label to describe the number of files selected in a file upload control that allows multiple files"), numberOfFiles]; +} + +String WebPlatformStrategies::unknownFileSizeText() +{ + return UI_STRING("Unknown", "Unknown filesize FTP directory listing item"); +} + +String WebPlatformStrategies::imageTitle(const String& filename, const IntSize& size) +{ + return [NSString stringWithFormat:UI_STRING("%@ %d×%d pixels", "window title for a standalone image (uses multiplication symbol, not x)"), (NSString *)filename, size.width(), size.height()]; +} + +String WebPlatformStrategies::mediaElementLoadingStateText() +{ + return UI_STRING("Loading...", "Media controller status message when the media is loading"); +} + +String WebPlatformStrategies::mediaElementLiveBroadcastStateText() +{ + return UI_STRING("Live Broadcast", "Media controller status message when watching a live broadcast"); +} + +String WebPlatformStrategies::localizedMediaControlElementString(const String& name) +{ + if (name == "AudioElement") + return UI_STRING("audio element controller", "accessibility role description for audio element controller"); + if (name == "VideoElement") + return UI_STRING("video element controller", "accessibility role description for video element controller"); + if (name == "MuteButton") + return UI_STRING("mute", "accessibility role description for mute button"); + if (name == "UnMuteButton") + return UI_STRING("unmute", "accessibility role description for turn mute off button"); + if (name == "PlayButton") + return UI_STRING("play", "accessibility role description for play button"); + if (name == "PauseButton") + return UI_STRING("pause", "accessibility role description for pause button"); + if (name == "Slider") + return UI_STRING("movie time", "accessibility role description for timeline slider"); + if (name == "SliderThumb") + return UI_STRING("timeline slider thumb", "accessibility role description for timeline thumb"); + if (name == "RewindButton") + return UI_STRING("back 30 seconds", "accessibility role description for seek back 30 seconds button"); + if (name == "ReturnToRealtimeButton") + return UI_STRING("return to realtime", "accessibility role description for return to real time button"); + if (name == "CurrentTimeDisplay") + return UI_STRING("elapsed time", "accessibility role description for elapsed time display"); + if (name == "TimeRemainingDisplay") + return UI_STRING("remaining time", "accessibility role description for time remaining display"); + if (name == "StatusDisplay") + return UI_STRING("status", "accessibility role description for movie status"); + if (name == "FullscreenButton") + return UI_STRING("fullscreen", "accessibility role description for enter fullscreen button"); + if (name == "SeekForwardButton") + return UI_STRING("fast forward", "accessibility role description for fast forward button"); + if (name == "SeekBackButton") + return UI_STRING("fast reverse", "accessibility role description for fast reverse button"); + if (name == "ShowClosedCaptionsButton") + return UI_STRING("show closed captions", "accessibility role description for show closed captions button"); + if (name == "HideClosedCaptionsButton") + return UI_STRING("hide closed captions", "accessibility role description for hide closed captions button"); + + // FIXME: the ControlsPanel container should never be visible in the accessibility hierarchy. + if (name == "ControlsPanel") + return String(); + + ASSERT_NOT_REACHED(); + return String(); +} + +String WebPlatformStrategies::localizedMediaControlElementHelpText(const String& name) +{ + if (name == "AudioElement") + return UI_STRING("audio element playback controls and status display", "accessibility role description for audio element controller"); + if (name == "VideoElement") + return UI_STRING("video element playback controls and status display", "accessibility role description for video element controller"); + if (name == "MuteButton") + return UI_STRING("mute audio tracks", "accessibility help text for mute button"); + if (name == "UnMuteButton") + return UI_STRING("unmute audio tracks", "accessibility help text for un mute button"); + if (name == "PlayButton") + return UI_STRING("begin playback", "accessibility help text for play button"); + if (name == "PauseButton") + return UI_STRING("pause playback", "accessibility help text for pause button"); + if (name == "Slider") + return UI_STRING("movie time scrubber", "accessibility help text for timeline slider"); + if (name == "SliderThumb") + return UI_STRING("movie time scrubber thumb", "accessibility help text for timeline slider thumb"); + if (name == "RewindButton") + return UI_STRING("seek movie back 30 seconds", "accessibility help text for jump back 30 seconds button"); + if (name == "ReturnToRealtimeButton") + return UI_STRING("return streaming movie to real time", "accessibility help text for return streaming movie to real time button"); + if (name == "CurrentTimeDisplay") + return UI_STRING("current movie time in seconds", "accessibility help text for elapsed time display"); + if (name == "TimeRemainingDisplay") + return UI_STRING("number of seconds of movie remaining", "accessibility help text for remaining time display"); + if (name == "StatusDisplay") + return UI_STRING("current movie status", "accessibility help text for movie status display"); + if (name == "SeekBackButton") + return UI_STRING("seek quickly back", "accessibility help text for fast rewind button"); + if (name == "SeekForwardButton") + return UI_STRING("seek quickly forward", "accessibility help text for fast forward button"); + if (name == "FullscreenButton") + return UI_STRING("Play movie in fullscreen mode", "accessibility help text for enter fullscreen button"); + if (name == "ShowClosedCaptionsButton") + return UI_STRING("start displaying closed captions", "accessibility help text for show closed captions button"); + if (name == "HideClosedCaptionsButton") + return UI_STRING("stop displaying closed captions", "accessibility help text for hide closed captions button"); + + ASSERT_NOT_REACHED(); + return String(); +} + +String WebPlatformStrategies::localizedMediaTimeDescription(float time) +{ + if (!isfinite(time)) + return UI_STRING("indefinite time", "accessibility help text for an indefinite media controller time value"); + + int seconds = (int)fabsf(time); + int days = seconds / (60 * 60 * 24); + int hours = seconds / (60 * 60); + int minutes = (seconds / 60) % 60; + seconds %= 60; + + if (days) + return [NSString stringWithFormat:UI_STRING("%1$d days %2$d hours %3$d minutes %4$d seconds", "accessibility help text for media controller time value >= 1 day"), days, hours, minutes, seconds]; + else if (hours) + return [NSString stringWithFormat:UI_STRING("%1$d hours %2$d minutes %3$d seconds", "accessibility help text for media controller time value >= 60 minutes"), hours, minutes, seconds]; + else if (minutes) + return [NSString stringWithFormat:UI_STRING("%1$d minutes %2$d seconds", "accessibility help text for media controller time value >= 60 seconds"), minutes, seconds]; + + return [NSString stringWithFormat:UI_STRING("%1$d seconds", "accessibility help text for media controller time value < 60 seconds"), seconds]; +} + +String WebPlatformStrategies::validationMessageValueMissingText() +{ + return UI_STRING("value missing", "Validation message for required form control elements that have no value"); +} + +String WebPlatformStrategies::validationMessageTypeMismatchText() +{ + return UI_STRING("type mismatch", "Validation message for input form controls with a value not matching type"); +} + +String WebPlatformStrategies::validationMessagePatternMismatchText() +{ + return UI_STRING("pattern mismatch", "Validation message for input form controls requiring a constrained value according to pattern"); +} + +String WebPlatformStrategies::validationMessageTooLongText() +{ + return UI_STRING("too long", "Validation message for form control elements with a value longer than maximum allowed length"); +} + +String WebPlatformStrategies::validationMessageRangeUnderflowText() +{ + return UI_STRING("range underflow", "Validation message for input form controls with value lower than allowed minimum"); +} + +String WebPlatformStrategies::validationMessageRangeOverflowText() +{ + return UI_STRING("range overflow", "Validation message for input form controls with value higher than allowed maximum"); +} + +String WebPlatformStrategies::validationMessageStepMismatchText() +{ + return UI_STRING("step mismatch", "Validation message for input form controls with value not respecting the step attribute"); +} diff --git a/WebKit/mac/WebCoreSupport/WebViewFactory.mm b/WebKit/mac/WebCoreSupport/WebViewFactory.mm index a97d5a5..6c7347f 100644 --- a/WebKit/mac/WebCoreSupport/WebViewFactory.mm +++ b/WebKit/mac/WebCoreSupport/WebViewFactory.mm @@ -31,7 +31,6 @@ #import <WebKit/WebFrameInternal.h> #import <WebKit/WebViewInternal.h> #import <WebKit/WebHTMLViewInternal.h> -#import <WebKit/WebLocalizableStrings.h> #import <WebKit/WebNSUserDefaultsExtras.h> #import <WebKit/WebNSObjectExtras.h> #import <WebKit/WebNSViewExtras.h> @@ -64,379 +63,11 @@ ASSERT([[self sharedFactory] isKindOfClass:self]); } -- (NSString *)inputElementAltText -{ - return UI_STRING_KEY("Submit", "Submit (input element)", "alt text for <input> elements with no alt, title, or value"); -} - -- (NSString *)resetButtonDefaultLabel -{ - return UI_STRING("Reset", "default label for Reset buttons in forms on web pages"); -} - -- (NSString *)searchableIndexIntroduction -{ - return UI_STRING("This is a searchable index. Enter search keywords: ", - "text that appears at the start of nearly-obsolete web pages in the form of a 'searchable index'"); -} - -- (NSString *)submitButtonDefaultLabel -{ - return UI_STRING("Submit", "default label for Submit buttons in forms on web pages"); -} - -- (NSString *)fileButtonChooseFileLabel -{ - return UI_STRING("Choose File", "title for file button used in HTML forms"); -} - -- (NSString *)fileButtonNoFileSelectedLabel -{ - return UI_STRING("no file selected", "text to display in file button used in HTML forms when no file is selected"); -} - -- (NSString *)copyImageUnknownFileLabel -{ - return UI_STRING("unknown", "Unknown filename"); -} - -- (NSString *)searchMenuNoRecentSearchesText -{ - return UI_STRING("No recent searches", "Label for only item in menu that appears when clicking on the search field image, when no searches have been performed"); -} - -- (NSString *)searchMenuRecentSearchesText -{ - return UI_STRING("Recent Searches", "label for first item in the menu that appears when clicking on the search field image, used as embedded menu title"); -} - -- (NSString *)searchMenuClearRecentSearchesText -{ - return UI_STRING("Clear Recent Searches", "menu item in Recent Searches menu that empties menu's contents"); -} - - (NSString *)defaultLanguageCode { return [NSUserDefaults _webkit_preferredLanguageCode]; } -- (NSString *)contextMenuItemTagOpenLinkInNewWindow -{ - return UI_STRING("Open Link in New Window", "Open in New Window context menu item"); -} - -- (NSString *)contextMenuItemTagDownloadLinkToDisk -{ - return UI_STRING("Download Linked File", "Download Linked File context menu item"); -} - -- (NSString *)contextMenuItemTagCopyLinkToClipboard -{ - return UI_STRING("Copy Link", "Copy Link context menu item"); -} - -- (NSString *)contextMenuItemTagOpenImageInNewWindow -{ - return UI_STRING("Open Image in New Window", "Open Image in New Window context menu item"); -} - -- (NSString *)contextMenuItemTagDownloadImageToDisk -{ - return UI_STRING("Download Image", "Download Image context menu item"); -} - -- (NSString *)contextMenuItemTagCopyImageToClipboard -{ - return UI_STRING("Copy Image", "Copy Image context menu item"); -} - -- (NSString *)contextMenuItemTagOpenFrameInNewWindow -{ - return UI_STRING("Open Frame in New Window", "Open Frame in New Window context menu item"); -} - -- (NSString *)contextMenuItemTagCopy -{ - return UI_STRING("Copy", "Copy context menu item"); -} - -- (NSString *)contextMenuItemTagGoBack -{ - return UI_STRING("Back", "Back context menu item"); -} - -- (NSString *)contextMenuItemTagGoForward -{ - return UI_STRING("Forward", "Forward context menu item"); -} - -- (NSString *)contextMenuItemTagStop -{ - return UI_STRING("Stop", "Stop context menu item"); -} - -- (NSString *)contextMenuItemTagReload -{ - return UI_STRING("Reload", "Reload context menu item"); -} - -- (NSString *)contextMenuItemTagCut -{ - return UI_STRING("Cut", "Cut context menu item"); -} - -- (NSString *)contextMenuItemTagPaste -{ - return UI_STRING("Paste", "Paste context menu item"); -} - -- (NSString *)contextMenuItemTagNoGuessesFound -{ - return UI_STRING("No Guesses Found", "No Guesses Found context menu item"); -} - -- (NSString *)contextMenuItemTagIgnoreSpelling -{ - return UI_STRING("Ignore Spelling", "Ignore Spelling context menu item"); -} - -- (NSString *)contextMenuItemTagLearnSpelling -{ - return UI_STRING("Learn Spelling", "Learn Spelling context menu item"); -} - -- (NSString *)contextMenuItemTagSearchInSpotlight -{ - return UI_STRING("Search in Spotlight", "Search in Spotlight context menu item"); -} - -- (NSString *)contextMenuItemTagSearchWeb -{ - return UI_STRING("Search in Google", "Search in Google context menu item"); -} - -- (NSString *)contextMenuItemTagLookUpInDictionary -{ - return UI_STRING("Look Up in Dictionary", "Look Up in Dictionary context menu item"); -} - -- (NSString *)contextMenuItemTagOpenLink -{ - return UI_STRING("Open Link", "Open Link context menu item"); -} - -- (NSString *)contextMenuItemTagIgnoreGrammar -{ - return UI_STRING("Ignore Grammar", "Ignore Grammar context menu item"); -} - -- (NSString *)contextMenuItemTagSpellingMenu -{ -#ifndef BUILDING_ON_TIGER - return UI_STRING("Spelling and Grammar", "Spelling and Grammar context sub-menu item"); -#else - return UI_STRING("Spelling", "Spelling context sub-menu item"); -#endif -} - -- (NSString *)contextMenuItemTagShowSpellingPanel:(bool)show -{ -#ifndef BUILDING_ON_TIGER - if (show) - return UI_STRING("Show Spelling and Grammar", "menu item title"); - return UI_STRING("Hide Spelling and Grammar", "menu item title"); -#else - return UI_STRING("Spelling...", "menu item title"); -#endif -} - -- (NSString *)contextMenuItemTagCheckSpelling -{ -#ifndef BUILDING_ON_TIGER - return UI_STRING("Check Document Now", "Check spelling context menu item"); -#else - return UI_STRING("Check Spelling", "Check spelling context menu item"); -#endif -} - -- (NSString *)contextMenuItemTagCheckSpellingWhileTyping -{ -#ifndef BUILDING_ON_TIGER - return UI_STRING("Check Spelling While Typing", "Check spelling while typing context menu item"); -#else - return UI_STRING("Check Spelling as You Type", "Check spelling while typing context menu item"); -#endif -} - -- (NSString *)contextMenuItemTagCheckGrammarWithSpelling -{ - return UI_STRING("Check Grammar With Spelling", "Check grammar with spelling context menu item"); -} - -- (NSString *)contextMenuItemTagFontMenu -{ - return UI_STRING("Font", "Font context sub-menu item"); -} - -- (NSString *)contextMenuItemTagShowFonts -{ - return UI_STRING("Show Fonts", "Show fonts context menu item"); -} - -- (NSString *)contextMenuItemTagBold -{ - return UI_STRING("Bold", "Bold context menu item"); -} - -- (NSString *)contextMenuItemTagItalic -{ - return UI_STRING("Italic", "Italic context menu item"); -} - -- (NSString *)contextMenuItemTagUnderline -{ - return UI_STRING("Underline", "Underline context menu item"); -} - -- (NSString *)contextMenuItemTagOutline -{ - return UI_STRING("Outline", "Outline context menu item"); -} - -- (NSString *)contextMenuItemTagStyles -{ - return UI_STRING("Styles...", "Styles context menu item"); -} - -- (NSString *)contextMenuItemTagShowColors -{ - return UI_STRING("Show Colors", "Show colors context menu item"); -} - -- (NSString *)contextMenuItemTagSpeechMenu -{ - return UI_STRING("Speech", "Speech context sub-menu item"); -} - -- (NSString *)contextMenuItemTagStartSpeaking -{ - return UI_STRING("Start Speaking", "Start speaking context menu item"); -} - -- (NSString *)contextMenuItemTagStopSpeaking -{ - return UI_STRING("Stop Speaking", "Stop speaking context menu item"); -} - -- (NSString *)contextMenuItemTagWritingDirectionMenu -{ -#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) - return UI_STRING("Paragraph Direction", "Paragraph direction context sub-menu item"); -#else - return UI_STRING("Writing Direction", "Writing direction context sub-menu item"); -#endif -} - -- (NSString *)contextMenuItemTagTextDirectionMenu -{ - return UI_STRING("Selection Direction", "Selection direction context sub-menu item"); -} - -- (NSString *)contextMenuItemTagDefaultDirection -{ - return UI_STRING("Default", "Default writing direction context menu item"); -} - -- (NSString *)contextMenuItemTagLeftToRight -{ - return UI_STRING("Left to Right", "Left to Right context menu item"); -} - -- (NSString *)contextMenuItemTagRightToLeft -{ - return UI_STRING("Right to Left", "Right to Left context menu item"); -} - -- (NSString *)contextMenuItemTagCorrectSpellingAutomatically -{ - return UI_STRING("Correct Spelling Automatically", "Correct Spelling Automatically context menu item"); -} - -- (NSString *)contextMenuItemTagSubstitutionsMenu -{ - return UI_STRING("Substitutions", "Substitutions context sub-menu item"); -} - -- (NSString *)contextMenuItemTagShowSubstitutions:(bool)show -{ - if (show) - return UI_STRING("Show Substitutions", "menu item title"); - return UI_STRING("Hide Substitutions", "menu item title"); -} - -- (NSString *)contextMenuItemTagSmartCopyPaste -{ - return UI_STRING("Smart Copy/Paste", "Smart Copy/Paste context menu item"); -} - -- (NSString *)contextMenuItemTagSmartQuotes -{ - return UI_STRING("Smart Quotes", "Smart Quotes context menu item"); -} - -- (NSString *)contextMenuItemTagSmartDashes -{ - return UI_STRING("Smart Dashes", "Smart Dashes context menu item"); -} - -- (NSString *)contextMenuItemTagSmartLinks -{ - return UI_STRING("Smart Links", "Smart Links context menu item"); -} - -- (NSString *)contextMenuItemTagTextReplacement -{ - return UI_STRING("Text Replacement", "Text Replacement context menu item"); -} - -- (NSString *)contextMenuItemTagTransformationsMenu -{ - return UI_STRING("Transformations", "Transformations context sub-menu item"); -} - -- (NSString *)contextMenuItemTagMakeUpperCase -{ - return UI_STRING("Make Upper Case", "Make Upper Case context menu item"); -} - -- (NSString *)contextMenuItemTagMakeLowerCase -{ - return UI_STRING("Make Lower Case", "Make Lower Case context menu item"); -} - -- (NSString *)contextMenuItemTagCapitalize -{ - return UI_STRING("Capitalize", "Capitalize context menu item"); -} - -- (NSString *)contextMenuItemTagChangeBack:(NSString *)replacedString -{ - static NSString *formatString = nil; -#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) - static bool lookedUpString = false; - if (!lookedUpString) { - formatString = [[[NSBundle bundleForClass:[NSSpellChecker class]] localizedStringForKey:@"Change Back to \\U201C%@\\U201D" value:nil table:@"MenuCommands"] retain]; - lookedUpString = true; - } -#endif - return formatString ? [NSString stringWithFormat:formatString, replacedString] : replacedString; -} - -- (NSString *)contextMenuItemTagInspectElement -{ - return UI_STRING("Inspect Element", "Inspect Element context menu item"); -} - - (BOOL)objectIsTextMarker:(id)object { return object != nil && CFGetTypeID(object) == WKGetAXTextMarkerTypeID(); @@ -507,308 +138,4 @@ WKUnregisterUniqueIdForElement(element); } -- (NSString *)AXWebAreaText -{ - return UI_STRING("HTML content", "accessibility role description for web area"); -} - -- (NSString *)AXLinkText -{ - return UI_STRING("link", "accessibility role description for link"); -} - -- (NSString *)AXListMarkerText -{ - return UI_STRING("list marker", "accessibility role description for list marker"); -} - -- (NSString *)AXImageMapText -{ - return UI_STRING("image map", "accessibility role description for image map"); -} - -- (NSString *)AXHeadingText -{ - return UI_STRING("heading", "accessibility role description for headings"); -} - -- (NSString *)AXDefinitionListTermText -{ - return UI_STRING("term", "term word of a definition"); -} - -- (NSString *)AXDefinitionListDefinitionText -{ - return UI_STRING("definition", "definition phrase"); -} - -- (NSString *)AXARIAContentGroupText:(NSString *)ariaType -{ - if ([ariaType isEqualToString:@"ARIAApplicationAlert"]) - return UI_STRING("alert", "An ARIA accessibility group that acts as an alert."); - if ([ariaType isEqualToString:@"ARIAApplicationAlertDialog"]) - return UI_STRING("alert dialog", "An ARIA accessibility group that acts as an alert dialog."); - if ([ariaType isEqualToString:@"ARIAApplicationDialog"]) - return UI_STRING("dialog", "An ARIA accessibility group that acts as an dialog."); - if ([ariaType isEqualToString:@"ARIAApplicationLog"]) - return UI_STRING("log", "An ARIA accessibility group that acts as a console log."); - if ([ariaType isEqualToString:@"ARIAApplicationMarquee"]) - return UI_STRING("marquee", "An ARIA accessibility group that acts as a marquee."); - if ([ariaType isEqualToString:@"ARIAApplicationStatus"]) - return UI_STRING("application status", "An ARIA accessibility group that acts as a status update."); - if ([ariaType isEqualToString:@"ARIAApplicationTimer"]) - return UI_STRING("timer", "An ARIA accessibility group that acts as an updating timer."); - if ([ariaType isEqualToString:@"ARIADocument"]) - return UI_STRING("document", "An ARIA accessibility group that acts as a document."); - if ([ariaType isEqualToString:@"ARIADocumentArticle"]) - return UI_STRING("article", "An ARIA accessibility group that acts as an article."); - if ([ariaType isEqualToString:@"ARIADocumentNote"]) - return UI_STRING("note", "An ARIA accessibility group that acts as a note in a document."); - if ([ariaType isEqualToString:@"ARIADocumentRegion"]) - return UI_STRING("region", "An ARIA accessibility group that acts as a distinct region in a document."); - if ([ariaType isEqualToString:@"ARIALandmarkApplication"]) - return UI_STRING("application", "An ARIA accessibility group that acts as an application."); - if ([ariaType isEqualToString:@"ARIALandmarkBanner"]) - return UI_STRING("banner", "An ARIA accessibility group that acts as a banner."); - if ([ariaType isEqualToString:@"ARIALandmarkComplementary"]) - return UI_STRING("complementary", "An ARIA accessibility group that acts as a region of complementary information."); - if ([ariaType isEqualToString:@"ARIALandmarkContentInfo"]) - return UI_STRING("content", "An ARIA accessibility group that contains content."); - if ([ariaType isEqualToString:@"ARIALandmarkMain"]) - return UI_STRING("main", "An ARIA accessibility group that is the main portion of the website."); - if ([ariaType isEqualToString:@"ARIALandmarkNavigation"]) - return UI_STRING("navigation", "An ARIA accessibility group that contains the main navigation elements of a website."); - if ([ariaType isEqualToString:@"ARIALandmarkSearch"]) - return UI_STRING("search", "An ARIA accessibility group that contains a search feature of a website."); - if ([ariaType isEqualToString:@"ARIAUserInterfaceTooltip"]) - return UI_STRING("tooltip", "An ARIA accessibility group that acts as a tooltip."); - if ([ariaType isEqualToString:@"ARIATabPanel"]) - return UI_STRING("tab panel", "An ARIA accessibility group that contains the content of a tab."); - if ([ariaType isEqualToString:@"ARIADocumentMath"]) - return UI_STRING("math", "An ARIA accessibility group that contains mathematical symbols."); - return nil; -} - -- (NSString *)AXButtonActionVerb -{ - return UI_STRING("press", "Verb stating the action that will occur when a button is pressed, as used by accessibility"); -} - -- (NSString *)AXRadioButtonActionVerb -{ - return UI_STRING("select", "Verb stating the action that will occur when a radio button is clicked, as used by accessibility"); -} - -- (NSString *)AXTextFieldActionVerb -{ - return UI_STRING("activate", "Verb stating the action that will occur when a text field is selected, as used by accessibility"); -} - -- (NSString *)AXCheckedCheckBoxActionVerb -{ - return UI_STRING("uncheck", "Verb stating the action that will occur when a checked checkbox is clicked, as used by accessibility"); -} - -- (NSString *)AXUncheckedCheckBoxActionVerb -{ - return UI_STRING("check", "Verb stating the action that will occur when an unchecked checkbox is clicked, as used by accessibility"); -} - -- (NSString *)AXLinkActionVerb -{ - return UI_STRING("jump", "Verb stating the action that will occur when a link is clicked, as used by accessibility"); -} - -- (NSString *)AXMenuListPopupActionVerb -{ - return nil; -} - -- (NSString *)AXMenuListActionVerb -{ - return nil; -} - -- (NSString *)missingPluginText -{ - return UI_STRING("Missing Plug-in", "Label text to be used when a plugin is missing"); -} - -- (NSString *)crashedPluginText -{ - return UI_STRING("Plug-in Failure", "Label text to be used if plugin host process has crashed"); -} - -- (NSString *)multipleFileUploadTextForNumberOfFiles:(unsigned)numberOfFiles -{ - return [NSString stringWithFormat:UI_STRING("%d files", "Label to describe the number of files selected in a file upload control that allows multiple files"), numberOfFiles]; -} - -- (NSString *)unknownFileSizeText -{ - return UI_STRING("Unknown", "Unknown filesize FTP directory listing item"); -} - -- (NSString*)imageTitleForFilename:(NSString*)filename width:(int)width height:(int)height -{ - return [NSString stringWithFormat:UI_STRING("%@ %d×%d pixels", "window title for a standalone image (uses multiplication symbol, not x)"), filename, width, height]; -} - -- (NSString*)mediaElementLoadingStateText -{ - return UI_STRING("Loading...", "Media controller status message when the media is loading"); -} - -- (NSString*)mediaElementLiveBroadcastStateText -{ - return UI_STRING("Live Broadcast", "Media controller status message when watching a live broadcast"); -} - -- (NSString*)localizedMediaControlElementString:(NSString*)name -{ - if ([name isEqualToString:@"AudioElement"]) - return UI_STRING("audio element controller", "accessibility role description for audio element controller"); - if ([name isEqualToString:@"VideoElement"]) - return UI_STRING("video element controller", "accessibility role description for video element controller"); - - // FIXME: the ControlsPanel container should never be visible in the accessibility hierarchy. - if ([name isEqualToString:@"ControlsPanel"]) - return @""; - - if ([name isEqualToString:@"MuteButton"]) - return UI_STRING("mute", "accessibility role description for mute button"); - if ([name isEqualToString:@"UnMuteButton"]) - return UI_STRING("unmute", "accessibility role description for turn mute off button"); - if ([name isEqualToString:@"PlayButton"]) - return UI_STRING("play", "accessibility role description for play button"); - if ([name isEqualToString:@"PauseButton"]) - return UI_STRING("pause", "accessibility role description for pause button"); - if ([name isEqualToString:@"Slider"]) - return UI_STRING("movie time", "accessibility role description for timeline slider"); - if ([name isEqualToString:@"SliderThumb"]) - return UI_STRING("timeline slider thumb", "accessibility role description for timeline thumb"); - if ([name isEqualToString:@"RewindButton"]) - return UI_STRING("back 30 seconds", "accessibility role description for seek back 30 seconds button"); - if ([name isEqualToString:@"ReturnToRealtimeButton"]) - return UI_STRING("return to realtime", "accessibility role description for return to real time button"); - if ([name isEqualToString:@"CurrentTimeDisplay"]) - return UI_STRING("elapsed time", "accessibility role description for elapsed time display"); - if ([name isEqualToString:@"TimeRemainingDisplay"]) - return UI_STRING("remaining time", "accessibility role description for time remaining display"); - if ([name isEqualToString:@"StatusDisplay"]) - return UI_STRING("status", "accessibility role description for movie status"); - if ([name isEqualToString:@"FullscreenButton"]) - return UI_STRING("fullscreen", "accessibility role description for enter fullscreen button"); - if ([name isEqualToString:@"SeekForwardButton"]) - return UI_STRING("fast forward", "accessibility role description for fast forward button"); - if ([name isEqualToString:@"SeekBackButton"]) - return UI_STRING("fast reverse", "accessibility role description for fast reverse button"); - if ([name isEqualToString:@"ShowClosedCaptionsButton"]) - return UI_STRING("show closed captions", "accessibility role description for show closed captions button"); - if ([name isEqualToString:@"HideClosedCaptionsButton"]) - return UI_STRING("hide closed captions", "accessibility role description for hide closed captions button"); - - ASSERT_NOT_REACHED(); - return @""; -} - -- (NSString*)localizedMediaControlElementHelpText:(NSString*)name -{ - if ([name isEqualToString:@"AudioElement"]) - return UI_STRING("audio element playback controls and status display", "accessibility role description for audio element controller"); - if ([name isEqualToString:@"VideoElement"]) - return UI_STRING("video element playback controls and status display", "accessibility role description for video element controller"); - - if ([name isEqualToString:@"MuteButton"]) - return UI_STRING("mute audio tracks", "accessibility help text for mute button"); - if ([name isEqualToString:@"UnMuteButton"]) - return UI_STRING("unmute audio tracks", "accessibility help text for un mute button"); - if ([name isEqualToString:@"PlayButton"]) - return UI_STRING("begin playback", "accessibility help text for play button"); - if ([name isEqualToString:@"PauseButton"]) - return UI_STRING("pause playback", "accessibility help text for pause button"); - if ([name isEqualToString:@"Slider"]) - return UI_STRING("movie time scrubber", "accessibility help text for timeline slider"); - if ([name isEqualToString:@"SliderThumb"]) - return UI_STRING("movie time scrubber thumb", "accessibility help text for timeline slider thumb"); - if ([name isEqualToString:@"RewindButton"]) - return UI_STRING("seek movie back 30 seconds", "accessibility help text for jump back 30 seconds button"); - if ([name isEqualToString:@"ReturnToRealtimeButton"]) - return UI_STRING("return streaming movie to real time", "accessibility help text for return streaming movie to real time button"); - if ([name isEqualToString:@"CurrentTimeDisplay"]) - return UI_STRING("current movie time in seconds", "accessibility help text for elapsed time display"); - if ([name isEqualToString:@"TimeRemainingDisplay"]) - return UI_STRING("number of seconds of movie remaining", "accessibility help text for remaining time display"); - if ([name isEqualToString:@"StatusDisplay"]) - return UI_STRING("current movie status", "accessibility help text for movie status display"); - if ([name isEqualToString:@"SeekBackButton"]) - return UI_STRING("seek quickly back", "accessibility help text for fast rewind button"); - if ([name isEqualToString:@"SeekForwardButton"]) - return UI_STRING("seek quickly forward", "accessibility help text for fast forward button"); - if ([name isEqualToString:@"FullscreenButton"]) - return UI_STRING("Play movie in fullscreen mode", "accessibility help text for enter fullscreen button"); - if ([name isEqualToString:@"ShowClosedCaptionsButton"]) - return UI_STRING("start displaying closed captions", "accessibility help text for show closed captions button"); - if ([name isEqualToString:@"HideClosedCaptionsButton"]) - return UI_STRING("stop displaying closed captions", "accessibility help text for hide closed captions button"); - ASSERT_NOT_REACHED(); - return @""; -} - -- (NSString*)localizedMediaTimeDescription:(float)time -{ - if (!isfinite(time)) - return UI_STRING("indefinite time", "accessibility help text for an indefinite media controller time value"); - - int seconds = (int)fabsf(time); - int days = seconds / (60 * 60 * 24); - int hours = seconds / (60 * 60); - int minutes = (seconds / 60) % 60; - seconds %= 60; - - if (days) - return [NSString stringWithFormat:UI_STRING("%1$d days %2$d hours %3$d minutes %4$d seconds", "accessibility help text for media controller time value >= 1 day"), days, hours, minutes, seconds]; - else if (hours) - return [NSString stringWithFormat:UI_STRING("%1$d hours %2$d minutes %3$d seconds", "accessibility help text for media controller time value >= 60 minutes"), hours, minutes, seconds]; - else if (minutes) - return [NSString stringWithFormat:UI_STRING("%1$d minutes %2$d seconds", "accessibility help text for media controller time value >= 60 seconds"), minutes, seconds]; - - return [NSString stringWithFormat:UI_STRING("%1$d seconds", "accessibility help text for media controller time value < 60 seconds"), seconds]; -} - -- (NSString *)validationMessageValueMissingText -{ - return UI_STRING("value missing", "Validation message for required form control elements that have no value"); -} - -- (NSString *)validationMessageTypeMismatchText -{ - return UI_STRING("type mismatch", "Validation message for input form controls with a value not matching type"); -} - -- (NSString *)validationMessagePatternMismatchText -{ - return UI_STRING("pattern mismatch", "Validation message for input form controls requiring a constrained value according to pattern"); -} - -- (NSString *)validationMessageTooLongText -{ - return UI_STRING("too long", "Validation message for form control elements with a value longer than maximum allowed length"); -} - -- (NSString *)validationMessageRangeUnderflowText -{ - return UI_STRING("range underflow", "Validation message for input form controls with value lower than allowed minimum"); -} - -- (NSString *)validationMessageRangeOverflowText -{ - return UI_STRING("range overflow", "Validation message for input form controls with value higher than allowed maximum"); -} - -- (NSString *)validationMessageStepMismatchText -{ - return UI_STRING("step mismatch", "Validation message for input form controls with value not respecting the step attribute"); -} - @end diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm index f7b83ea..3d878bc 100644 --- a/WebKit/mac/WebView/WebView.mm +++ b/WebKit/mac/WebView/WebView.mm @@ -141,6 +141,7 @@ #import <WebCore/RenderWidget.h> #import <WebCore/ResourceHandle.h> #import <WebCore/RuntimeApplicationChecks.h> +#import <WebCore/SchemeRegistry.h> #import <WebCore/ScriptController.h> #import <WebCore/ScriptValue.h> #import <WebCore/SecurityOrigin.h> @@ -671,12 +672,17 @@ static bool shouldEnableLoadDeferring() didOneTimeInitialization = true; } + Page::PageClients pageClients; + pageClients.chromeClient = new WebChromeClient(self); + pageClients.contextMenuClient = new WebContextMenuClient(self); + pageClients.editorClient = new WebEditorClient(self); + pageClients.dragClient = new WebDragClient(self); + pageClients.inspectorClient = new WebInspectorClient(self); + pageClients.pluginHalterClient = new WebPluginHalterClient(self); #if ENABLE(CLIENT_BASED_GEOLOCATION) - WebGeolocationControllerClient* geolocationControllerClient = new WebGeolocationControllerClient(self); -#else - WebGeolocationControllerClient* geolocationControllerClient = 0; + pageClients.geolocationControllerClient = new WebGeolocationControllerClient(self); #endif - _private->page = new Page(new WebChromeClient(self), new WebContextMenuClient(self), new WebEditorClient(self), new WebDragClient(self), new WebInspectorClient(self), new WebPluginHalterClient(self), geolocationControllerClient, 0, 0); + _private->page = new Page(pageClients); _private->page->setCanStartMedia([self window]); _private->page->settings()->setLocalStorageDatabasePath([[self preferences] _localStorageDatabasePath]); @@ -2500,7 +2506,7 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns) + (void)_registerURLSchemeAsSecure:(NSString *)scheme { - SecurityOrigin::registerURLSchemeAsSecure(scheme); + SchemeRegistry::registerURLSchemeAsSecure(scheme); } @end @@ -2734,7 +2740,7 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns) + (void)registerURLSchemeAsLocal:(NSString *)protocol { - SecurityOrigin::registerURLSchemeAsLocal(protocol); + SchemeRegistry::registerURLSchemeAsLocal(protocol); } - (id)_initWithArguments:(NSDictionary *) arguments diff --git a/WebKit/qt/Api/qgraphicswebview.cpp b/WebKit/qt/Api/qgraphicswebview.cpp index 8fbb8e2..8a94c9b 100644 --- a/WebKit/qt/Api/qgraphicswebview.cpp +++ b/WebKit/qt/Api/qgraphicswebview.cpp @@ -319,8 +319,9 @@ bool QGraphicsWebView::sceneEvent(QEvent* event) || event->type() == QEvent::TouchEnd || event->type() == QEvent::TouchUpdate)) { d->page->event(event); - if (event->isAccepted()) - return true; + + // Always return true so that we'll receive also TouchUpdate and TouchEnd events + return true; } #endif diff --git a/WebKit/qt/Api/qwebframe.cpp b/WebKit/qt/Api/qwebframe.cpp index d1741ca..f10d5b4 100644 --- a/WebKit/qt/Api/qwebframe.cpp +++ b/WebKit/qt/Api/qwebframe.cpp @@ -784,6 +784,10 @@ void QWebFrame::load(const QNetworkRequest &req, The \a html is loaded immediately; external objects are loaded asynchronously. + If a script in the \a html runs longer than the default script timeout (currently 10 seconds), + for example due to being blocked by a modal JavaScript alert dialog, this method will return + as soon as possible after the timeout and any subsequent \a html will be loaded asynchronously. + When using this method WebKit assumes that external resources such as JavaScript programs or style sheets are encoded in UTF-8 unless otherwise specified. For example, the encoding of an external script can be specified through the charset attribute of the HTML script tag. It is also possible diff --git a/WebKit/qt/Api/qwebkitglobal.h b/WebKit/qt/Api/qwebkitglobal.h index d83d569..a6be571 100644 --- a/WebKit/qt/Api/qwebkitglobal.h +++ b/WebKit/qt/Api/qwebkitglobal.h @@ -22,9 +22,9 @@ #include <QtCore/qglobal.h> -#define QTWEBKIT_VERSION_STR "2.1.0" +#define QTWEBKIT_VERSION_STR "2.2.0" // QTWEBKIT_VERSION is (major << 16) + (minor << 8) + patch. Similar to Qt. -#define QTWEBKIT_VERSION 0x020100 +#define QTWEBKIT_VERSION 0x020200 // Use: #if (QTWEBKIT_VERSION >= QTWEBKIT_VERSION_CHECK(2, 0, 0)). Similar to Qt. #define QTWEBKIT_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch)) diff --git a/WebKit/qt/Api/qwebpage.cpp b/WebKit/qt/Api/qwebpage.cpp index 35219a9..fa49293 100644 --- a/WebKit/qt/Api/qwebpage.cpp +++ b/WebKit/qt/Api/qwebpage.cpp @@ -49,6 +49,7 @@ #include "DragController.h" #include "DragData.h" #include "EditorClientQt.h" +#include "SchemeRegistry.h" #include "SecurityOrigin.h" #include "Settings.h" #include "Page.h" @@ -268,11 +269,13 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq) WebCore::Font::setCodePath(WebCore::Font::Complex); #endif - chromeClient = new ChromeClientQt(q); - contextMenuClient = new ContextMenuClientQt(); - editorClient = new EditorClientQt(q); - page = new Page(chromeClient, contextMenuClient, editorClient, - new DragClientQt(q), new InspectorClientQt(q), 0, 0, 0, 0); + Page::PageClients pageClients; + pageClients.chromeClient = new ChromeClientQt(q); + pageClients.contextMenuClient = new ContextMenuClientQt(); + pageClients.editorClient = new EditorClientQt(q); + pageClients.dragClient = new DragClientQt(q); + pageClients.inspectorClient = new InspectorClientQt(q); + page = new Page(pageClients); settings = new QWebSettings(page->settings()); @@ -1390,14 +1393,17 @@ bool QWebPagePrivate::handleScrolling(QKeyEvent *ev, Frame *frame) } #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) -void QWebPagePrivate::touchEvent(QTouchEvent* event) +bool QWebPagePrivate::touchEvent(QTouchEvent* event) { WebCore::Frame* frame = QWebFramePrivate::core(mainFrame); if (!frame->view()) - return; + return false; - bool accepted = frame->eventHandler()->handleTouchEvent(PlatformTouchEvent(event)); - event->setAccepted(accepted); + // Always accept the QTouchEvent so that we'll receive also TouchUpdate and TouchEnd events + event->setAccepted(true); + + // Return whether the default action was cancelled in the JS event handler + return frame->eventHandler()->handleTouchEvent(PlatformTouchEvent(event)); } #endif @@ -2107,6 +2113,20 @@ bool QWebPage::allowGeolocationRequest(QWebFrame *frame) #endif } +void QWebPage::setUserPermission(QWebFrame* frame, PermissionDomain domain, PermissionPolicy policy) +{ + switch (domain) { + case NotificationsPermissionDomain: +#if ENABLE(NOTIFICATIONS) + if (policy == PermissionGranted) + NotificationPresenterClientQt::notificationPresenter()->allowNotificationForFrame(frame); +#endif + break; + default: + break; + } +} + /*! This function is called whenever WebKit wants to create a new window of the given \a type, for example when a JavaScript program requests to open a document in a new window. @@ -2393,7 +2413,7 @@ bool QWebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest & return true; case DelegateExternalLinks: - if (WebCore::SecurityOrigin::shouldTreatURLSchemeAsLocal(request.url().scheme())) + if (WebCore::SchemeRegistry::shouldTreatURLSchemeAsLocal(request.url().scheme())) return true; emit linkClicked(request.url()); return false; @@ -2827,8 +2847,8 @@ bool QWebPage::event(QEvent *ev) case QEvent::TouchBegin: case QEvent::TouchUpdate: case QEvent::TouchEnd: - d->touchEvent(static_cast<QTouchEvent*>(ev)); - break; + // Return whether the default action was cancelled in the JS event handler + return d->touchEvent(static_cast<QTouchEvent*>(ev)); #endif #ifndef QT_NO_PROPERTIES case QEvent::DynamicPropertyChange: diff --git a/WebKit/qt/Api/qwebpage.h b/WebKit/qt/Api/qwebpage.h index fcaa302..f0d2438 100644 --- a/WebKit/qt/Api/qwebpage.h +++ b/WebKit/qt/Api/qwebpage.h @@ -195,6 +195,16 @@ public: WebModalDialog }; + enum PermissionPolicy { + PermissionGranted, + PermissionUnknown, + PermissionDenied + }; + + enum PermissionDomain { + NotificationsPermissionDomain + }; + class ViewportHints { public: ViewportHints(); @@ -290,6 +300,8 @@ public: QMenu *createStandardContextMenu(); + void setUserPermission(QWebFrame* frame, PermissionDomain domain, PermissionPolicy policy); + enum Extension { ChooseMultipleFilesExtension, ErrorPageExtension @@ -371,6 +383,10 @@ Q_SIGNALS: void viewportChangeRequested(const QWebPage::ViewportHints& hints); + void requestPermissionFromUser(QWebFrame* frame, QWebPage::PermissionDomain domain); + void checkPermissionFromUser(QWebFrame* frame, QWebPage::PermissionDomain domain, QWebPage::PermissionPolicy& policy); + void cancelRequestsForPermission(QWebFrame* frame, QWebPage::PermissionDomain domain); + protected: virtual QWebPage *createWindow(WebWindowType type); virtual QObject *createPlugin(const QString &classid, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues); diff --git a/WebKit/qt/Api/qwebpage_p.h b/WebKit/qt/Api/qwebpage_p.h index 54a1523..44ceb87 100644 --- a/WebKit/qt/Api/qwebpage_p.h +++ b/WebKit/qt/Api/qwebpage_p.h @@ -132,7 +132,8 @@ public: bool handleScrolling(QKeyEvent*, WebCore::Frame*); #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) - void touchEvent(QTouchEvent*); + // Returns whether the default action was cancelled in the JS event handler + bool touchEvent(QTouchEvent*); #endif void setInspector(QWebInspector*); diff --git a/WebKit/qt/Api/qwebsecurityorigin.cpp b/WebKit/qt/Api/qwebsecurityorigin.cpp index fe25d2d..e8c8f33 100644 --- a/WebKit/qt/Api/qwebsecurityorigin.cpp +++ b/WebKit/qt/Api/qwebsecurityorigin.cpp @@ -25,6 +25,7 @@ #include "DatabaseTracker.h" #include "KURL.h" +#include "SchemeRegistry.h" #include "SecurityOrigin.h" #include <QStringList> @@ -222,7 +223,7 @@ QList<QWebDatabase> QWebSecurityOrigin::databases() const */ void QWebSecurityOrigin::addLocalScheme(const QString& scheme) { - SecurityOrigin::registerURLSchemeAsLocal(scheme); + SchemeRegistry::registerURLSchemeAsLocal(scheme); } /*! @@ -237,7 +238,7 @@ void QWebSecurityOrigin::addLocalScheme(const QString& scheme) */ void QWebSecurityOrigin::removeLocalScheme(const QString& scheme) { - SecurityOrigin::removeURLSchemeRegisteredAsLocal(scheme); + SchemeRegistry::removeURLSchemeRegisteredAsLocal(scheme); } /*! @@ -251,7 +252,7 @@ void QWebSecurityOrigin::removeLocalScheme(const QString& scheme) QStringList QWebSecurityOrigin::localSchemes() { QStringList list; - const URLSchemesMap& map = SecurityOrigin::localURLSchemes(); + const URLSchemesMap& map = SchemeRegistry::localURLSchemes(); URLSchemesMap::const_iterator end = map.end(); for (URLSchemesMap::const_iterator i = map.begin(); i != end; ++i) { const QString scheme = *i; diff --git a/WebKit/qt/Api/qwebsettings.cpp b/WebKit/qt/Api/qwebsettings.cpp index 4ba6943..edd07da 100644 --- a/WebKit/qt/Api/qwebsettings.cpp +++ b/WebKit/qt/Api/qwebsettings.cpp @@ -457,12 +457,32 @@ QWebSettings::QWebSettings() d->fontSizes.insert(QWebSettings::MinimumLogicalFontSize, 0); d->fontSizes.insert(QWebSettings::DefaultFontSize, 16); d->fontSizes.insert(QWebSettings::DefaultFixedFontSize, 13); - d->fontFamilies.insert(QWebSettings::StandardFont, QLatin1String("Arial")); - d->fontFamilies.insert(QWebSettings::FixedFont, QLatin1String("Courier New")); - d->fontFamilies.insert(QWebSettings::SerifFont, QLatin1String("Times New Roman")); - d->fontFamilies.insert(QWebSettings::SansSerifFont, QLatin1String("Arial")); - d->fontFamilies.insert(QWebSettings::CursiveFont, QLatin1String("Arial")); - d->fontFamilies.insert(QWebSettings::FantasyFont, QLatin1String("Arial")); + + QFont defaultFont; + defaultFont.setStyleHint(QFont::Serif); + d->fontFamilies.insert(QWebSettings::StandardFont, defaultFont.defaultFamily()); + d->fontFamilies.insert(QWebSettings::SerifFont, defaultFont.defaultFamily()); + +#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) + defaultFont.setStyleHint(QFont::Fantasy); + d->fontFamilies.insert(QWebSettings::FantasyFont, defaultFont.defaultFamily()); + + defaultFont.setStyleHint(QFont::Cursive); + d->fontFamilies.insert(QWebSettings::CursiveFont, defaultFont.defaultFamily()); +#else + d->fontFamilies.insert(QWebSettings::FantasyFont, defaultFont.defaultFamily()); + d->fontFamilies.insert(QWebSettings::CursiveFont, defaultFont.defaultFamily()); +#endif + + defaultFont.setStyleHint(QFont::SansSerif); + d->fontFamilies.insert(QWebSettings::SansSerifFont, defaultFont.defaultFamily()); + +#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) + defaultFont.setStyleHint(QFont::Monospace); +#else + defaultFont.setStyleHint(QFont::TypeWriter); +#endif + d->fontFamilies.insert(QWebSettings::FixedFont, defaultFont.defaultFamily()); d->attributes.insert(QWebSettings::AutoLoadImages, true); d->attributes.insert(QWebSettings::DnsPrefetchEnabled, false); diff --git a/WebKit/qt/Api/qwebview.cpp b/WebKit/qt/Api/qwebview.cpp index 2defdbb..3daa045 100644 --- a/WebKit/qt/Api/qwebview.cpp +++ b/WebKit/qt/Api/qwebview.cpp @@ -826,8 +826,9 @@ bool QWebView::event(QEvent *e) || e->type() == QEvent::TouchEnd || e->type() == QEvent::TouchUpdate) { d->page->event(e); - if (e->isAccepted()) - return true; + + // Always return true so that we'll receive also TouchUpdate and TouchEnd events + return true; #endif } else if (e->type() == QEvent::Leave) d->page->event(e); diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog index edc8f52..455fd89 100644 --- a/WebKit/qt/ChangeLog +++ b/WebKit/qt/ChangeLog @@ -1,3 +1,188 @@ +2010-07-28 Kim Grönholm <kim.1.gronholm@nokia.com> + + Reviewed by Antonio Gomes. + + [Qt] Decouple QTouchEvent's accepted flag from JS prevent default + https://bugs.webkit.org/show_bug.cgi?id=42892 + + Added comments to the touch event handling code. + + * Api/qgraphicswebview.cpp: + (QGraphicsWebView::sceneEvent): + * Api/qwebpage.cpp: + (QWebPagePrivate::touchEvent): + (QWebPage::event): + * Api/qwebpage_p.h: + * Api/qwebview.cpp: + (QWebView::event): + +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 + + * Api/qwebpage.cpp: + (QWebPagePrivate::QWebPagePrivate): + +2010-07-27 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Tor Arne Vestbø. + + [Qt] Incorrect input method hints + https://bugs.webkit.org/show_bug.cgi?id=43037 + + Properly set or reset all input method hints when + activating input fields. + + * WebCoreSupport/EditorClientQt.cpp: + (WebCore::EditorClientQt::setInputMethodState): + * tests/qwebview/tst_qwebview.cpp: + (tst_QWebView::focusInputTypes): Extended unit test to verify that we + reset hints. + +2010-07-27 Kim Grönholm <kim.1.gronholm@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Decouple QTouchEvent's accepted flag from JS prevent default + https://bugs.webkit.org/show_bug.cgi?id=42892 + + We need to always accept the QTouchEvents in order to get TouchUpdate and + TouchEnd events. QWebPage::event() return value is used to indicate + whether the default action was prevented for the touch events. + + * Api/qgraphicswebview.cpp: + (QGraphicsWebView::sceneEvent): + * Api/qwebpage.cpp: + (QWebPagePrivate::touchEvent): + (QWebPage::event): + * Api/qwebpage_p.h: + * Api/qwebview.cpp: + (QWebView::event): + +2010-07-26 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Change default font from sans-serif to serif + + This matches what other ports and browser engines do. + + We now also use QFont's defaultFontFamily() to resolve the + correct fonts for each platform. For Qt >= 4.7 we can take + advantage of the new enums for generic font families. + + * Api/qwebsettings.cpp: + +2009-10-30 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Use the default timeout interval for JS as the HTML tokenizer delay for setHtml() + + This ensures that long-running JavaScript (for example due to a modal alert() dialog), + will not trigger a deferred load after only 500ms (the default tokenizer delay) while + still giving a reasonable timeout (10 seconds) to prevent deadlock. + + https://bugs.webkit.org/show_bug.cgi?id=29381 + + * Api/qwebframe.cpp: Document the behaviour + * WebCoreSupport/FrameLoaderClientQt.cpp: set the custom tokenizer delay for substitute loads + * tests/qwebframe/tst_qwebframe.cpp: Add test + +2010-07-23 David Boddie <dboddie@trolltech.com> + + Reviewed by Simon Hausmann. + + Doc: Fixed incorrect QML property type. + + * declarative/qdeclarativewebview.cpp: + +2010-07-23 Simon Hausmann <simon.hausmann@nokia.com> + + [Qt] Build fix for Qt apps + + Add webkit to QT_CONFIG. qconfig.pri will read qt_webkit_version.pri and + that's how it will pick up webkit in QT_CONFIG. + + * qt_webkit_version.pri: + +2010-07-22 Yael Aharon <yael.aharon@nokia.com> + + Reviewed by Laszlo Gombos. + + [Qt] QtWebKit needs public API for Notifications. + https://bugs.webkit.org/show_bug.cgi?id=41413 + + Remove DumpRenderTree private API and introduce new API. + Also add support for informing the UI when a notification request is cancelled. + + * Api/qwebpage.cpp: + (QWebPage::setUserPermission): + * Api/qwebpage.h: + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + * WebCoreSupport/DumpRenderTreeSupportQt.h: + * WebCoreSupport/NotificationPresenterClientQt.cpp: + (WebCore::NotificationPresenterClientQt::requestPermission): + (WebCore::NotificationPresenterClientQt::checkPermission): + (WebCore::NotificationPresenterClientQt::cancelRequestsForPermission): + (WebCore::NotificationPresenterClientQt::allowNotificationForFrame): + (WebCore::NotificationPresenterClientQt::toPage): + (WebCore::NotificationPresenterClientQt::toFrame): + * WebCoreSupport/NotificationPresenterClientQt.h: + +2010-07-22 Jamey Hicks <jamey.hicks@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Enable binding of QObjects to JavaScript environment for inspector frontend + + This patch enables QObjects to be bound to global variables in the + javascript environment of the inspector frontend. This is useful + for writing alternate inspector frontends in javascript which need + additional native functionality. It's a lighter-weight alternative + than using an NPAPI plugin. + + The code which instantiates QWebInspector uses this by setting the + dynamic property "q_inspectorJavaScriptWindowObjects" on the + QWebInspector. The value of this property should be a + QMap<QString,QVariant> mapping global variable name to QObject. + + I have used this to add support for eclipse/chrome remote + debugging in QtTestBrowser. + + https://bugs.webkit.org/show_bug.cgi?id=41995 + + * WebCoreSupport/InspectorClientQt.cpp: + (WebCore::InspectorClientWebPage::InspectorClientWebPage): + (WebCore::InspectorClientWebPage::javaScriptWindowObjectCleared): + (WebCore::InspectorClientQt::openInspectorFrontend): + +2010-07-22 Simon Hausmann <simon.hausmann@nokia.com> + + [Qt] Library versioning. + + 2.1 is branched, trunk will become 2.2. + + * Api/qwebkitglobal.h: + * qt_webkit_version.pri: + +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 + + * Api/qwebpage.cpp: + (QWebPage::acceptNavigationRequest): + * Api/qwebsecurityorigin.cpp: + (QWebSecurityOrigin::addLocalScheme): + (QWebSecurityOrigin::removeLocalScheme): + (QWebSecurityOrigin::localSchemes): + 2010-07-20 Kenneth Rohde Christiansen <kenneth.christiansen@openbossa.org> [Qt] Add API to define device-width and height for use with the viewport meta tag diff --git a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp index a83e1a5..ddc9d7a 100644 --- a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp +++ b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp @@ -70,8 +70,6 @@ using namespace WebCore; -CheckPermissionFunctionType* checkPermissionFunction = 0; -RequestPermissionFunctionType* requestPermissionFunction = 0; QMap<int, QWebScriptWorld*> m_worldMap; DumpRenderTreeSupportQt::DumpRenderTreeSupportQt() @@ -575,20 +573,6 @@ void DumpRenderTreeSupportQt::dumpNotification(bool b) #endif } -void DumpRenderTreeSupportQt::setNotificationsReceiver(QObject* receiver) -{ -#if ENABLE(NOTIFICATIONS) - NotificationPresenterClientQt::notificationPresenter()->setReceiver(receiver); -#endif -} - -void DumpRenderTreeSupportQt::allowNotificationForOrigin(const QString& origin) -{ -#if ENABLE(NOTIFICATIONS) - NotificationPresenterClientQt::notificationPresenter()->allowNotificationForOrigin(origin); -#endif -} - void DumpRenderTreeSupportQt::setMockGeolocationPosition(double latitude, double longitude, double accuracy) { #if ENABLE(GEOLOCATION) @@ -605,16 +589,6 @@ void DumpRenderTreeSupportQt::setMockGeolocationError(int errorCode, const QStri #endif } -void DumpRenderTreeSupportQt::setCheckPermissionFunction(CheckPermissionFunctionType* f) -{ - checkPermissionFunction = f; -} - -void DumpRenderTreeSupportQt::setRequestPermissionFunction(RequestPermissionFunctionType* f) -{ - requestPermissionFunction = f; -} - bool DumpRenderTreeSupportQt::isTargetItem(const QWebHistoryItem& historyItem) { QWebHistoryItem it = historyItem; diff --git a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h index 188c405..3a92158 100644 --- a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h +++ b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h @@ -32,17 +32,6 @@ class QWebPage; class QWebHistoryItem; class QWebScriptWorld; -enum NotificationPermission { - NotificationAllowed, - NotificationNotAllowed, - NotificationDenied -}; - -typedef void (CheckPermissionFunctionType) (QObject* receiver, const QUrl&, NotificationPermission&); -typedef void (RequestPermissionFunctionType) (QObject* receiver, const QString&); - -extern CheckPermissionFunctionType* checkPermissionFunction; -extern RequestPermissionFunctionType* requestPermissionFunction; extern QMap<int, QWebScriptWorld*> m_worldMap; class QWEBKIT_EXPORT DumpRenderTreeSupportQt { @@ -123,13 +112,6 @@ public: static void dumpNotification(bool b); - // These functions should eventually turn into public API - // and the "receiver" concept would go away - static void setNotificationsReceiver(QObject* receiver); - static void allowNotificationForOrigin(const QString& origin); - static void setCheckPermissionFunction(CheckPermissionFunctionType*); - static void setRequestPermissionFunction(RequestPermissionFunctionType*); - static QMap<QString, QWebHistoryItem> getChildHistoryItems(const QWebHistoryItem& historyItem); static bool isTargetItem(const QWebHistoryItem& historyItem); static QString historyItemTarget(const QWebHistoryItem& historyItem); diff --git a/WebKit/qt/WebCoreSupport/EditorClientQt.cpp b/WebKit/qt/WebCoreSupport/EditorClientQt.cpp index 74c8438..54993b1 100644 --- a/WebKit/qt/WebCoreSupport/EditorClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/EditorClientQt.cpp @@ -603,20 +603,18 @@ void EditorClientQt::setInputMethodState(bool active) inputElement = static_cast<HTMLInputElement*>(frame->document()->focusedNode()); if (inputElement) { - if (!active) { - // Setting the Qt::WA_InputMethodEnabled attribute true and Qt::ImhHiddenText flag - // for password fields. The Qt platform is responsible for determining which widget - // will receive input method events for password fields. - active = inputElement->isPasswordField(); - webPageClient->setInputMethodHint(Qt::ImhHiddenText, active); - } else { - // Set input method hints for "number", "tel", "email", and "url" input elements. - webPageClient->setInputMethodHint(Qt::ImhDialableCharactersOnly, inputElement->isTelephoneField()); - webPageClient->setInputMethodHint(Qt::ImhDigitsOnly, inputElement->isNumberField()); - webPageClient->setInputMethodHint(Qt::ImhEmailCharactersOnly, inputElement->isEmailField()); - webPageClient->setInputMethodHint(Qt::ImhUrlCharactersOnly, inputElement->isUrlField()); - webPageClient->setInputMethodHint(Qt::ImhHiddenText, inputElement->isPasswordField()); - } + // Set input method hints for "number", "tel", "email", "url" and "password" input elements. + webPageClient->setInputMethodHint(Qt::ImhDialableCharactersOnly, inputElement->isTelephoneField()); + webPageClient->setInputMethodHint(Qt::ImhDigitsOnly, inputElement->isNumberField()); + webPageClient->setInputMethodHint(Qt::ImhEmailCharactersOnly, inputElement->isEmailField()); + webPageClient->setInputMethodHint(Qt::ImhUrlCharactersOnly, inputElement->isUrlField()); + // Setting the Qt::WA_InputMethodEnabled attribute true and Qt::ImhHiddenText flag + // for password fields. The Qt platform is responsible for determining which widget + // will receive input method events for password fields. + bool isPasswordField = inputElement->isPasswordField(); + webPageClient->setInputMethodHint(Qt::ImhHiddenText, isPasswordField); + if (isPasswordField) + active = true; } #if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) || defined(Q_OS_SYMBIAN) diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index fc0f6c3..9fe66d9 100644 --- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -39,6 +39,7 @@ #include "FrameView.h" #include "DocumentLoader.h" #include "HitTestResult.h" +#include "JSDOMWindowBase.h" #include "MIMETypeRegistry.h" #include "MouseEvent.h" #include "ResourceResponse.h" @@ -879,8 +880,15 @@ bool FrameLoaderClientQt::shouldFallBack(const WebCore::ResourceError&) WTF::PassRefPtr<WebCore::DocumentLoader> FrameLoaderClientQt::createDocumentLoader(const WebCore::ResourceRequest& request, const SubstituteData& substituteData) { RefPtr<DocumentLoader> loader = DocumentLoader::create(request, substituteData); - if (!deferMainResourceDataLoad || substituteData.isValid()) + if (!deferMainResourceDataLoad || substituteData.isValid()) { loader->setDeferMainResourceDataLoad(false); + // Use the default timeout interval for JS as the HTML tokenizer delay. This ensures + // that long-running JavaScript will still allow setHtml() to be synchronous, while + // still giving a reasonable timeout to prevent deadlock. + double delay = JSDOMWindowBase::commonJSGlobalData()->timeoutChecker.timeoutInterval() / 1000.0f; + m_frame->page()->setCustomHTMLTokenizerTimeDelay(delay); + } else + m_frame->page()->setCustomHTMLTokenizerTimeDelay(-1); return loader.release(); } diff --git a/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp b/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp index 2cc7e50..e13f6c3 100644 --- a/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp @@ -44,6 +44,7 @@ #include "qwebview.h" #include <QtCore/QCoreApplication> #include <QtCore/QSettings> +#include <QtCore/QVariant> namespace WebCore { @@ -60,6 +61,7 @@ public: InspectorClientWebPage(QObject* parent = 0) : QWebPage(parent) { + connect(mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), SLOT(javaScriptWindowObjectCleared())); } QWebPage* createWindow(QWebPage::WebWindowType) @@ -70,6 +72,25 @@ public: view->setAttribute(Qt::WA_DeleteOnClose); return page; } + +public slots: + void javaScriptWindowObjectCleared() + { +#ifndef QT_NO_PROPERTIES + QVariant inspectorJavaScriptWindowObjects = property("_q_inspectorJavaScriptWindowObjects"); + if (!inspectorJavaScriptWindowObjects.isValid()) + return; + QMap<QString, QVariant> javaScriptNameObjectMap = inspectorJavaScriptWindowObjects.toMap(); + QWebFrame* frame = mainFrame(); + QMap<QString, QVariant>::const_iterator it = javaScriptNameObjectMap.constBegin(); + for ( ; it != javaScriptNameObjectMap.constEnd(); ++it) { + QString name = it.key(); + QVariant value = it.value(); + QObject* obj = value.value<QObject*>(); + frame->addToJavaScriptWindowObject(name, obj); + } +#endif + } }; InspectorClientQt::InspectorClientQt(QWebPage* page) @@ -100,6 +121,12 @@ void InspectorClientQt::openInspectorFrontend(WebCore::InspectorController*) #endif if (!inspectorUrl.isValid()) inspectorUrl = QUrl("qrc:/webkit/inspector/inspector.html"); + +#ifndef QT_NO_PROPERTIES + QVariant inspectorJavaScriptWindowObjects = inspector->property("_q_inspectorJavaScriptWindowObjects"); + if (inspectorJavaScriptWindowObjects.isValid()) + inspectorPage->setProperty("_q_inspectorJavaScriptWindowObjects", inspectorJavaScriptWindowObjects); +#endif inspectorView->page()->mainFrame()->load(inspectorUrl); m_inspectedWebPage->d->inspectorFrontend = inspectorView; inspector->d->setFrontend(inspectorView); diff --git a/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp b/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp index ee69103..477e205 100644 --- a/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp @@ -36,11 +36,14 @@ #include "DumpRenderTreeSupportQt.h" #include "EventNames.h" #include "KURL.h" +#include "Page.h" #include "QtPlatformPlugin.h" #include "ScriptExecutionContext.h" #include "SecurityOrigin.h" +#include "qwebframe_p.h" #include "qwebkitglobal.h" +#include "qwebpage.h" #include <QtGui> namespace WebCore { @@ -259,53 +262,77 @@ void NotificationPresenterClientQt::requestPermission(ScriptExecutionContext* co if (dumpNotification) printf("DESKTOP NOTIFICATION PERMISSION REQUESTED: %s\n", QString(context->securityOrigin()->toString()).toUtf8().constData()); - QString originString = context->securityOrigin()->toString(); - QHash<QString, QList<RefPtr<VoidCallback> > >::iterator iter = m_pendingPermissionRequests.find(originString); + QHash<ScriptExecutionContext*, CallbacksInfo >::iterator iter = m_pendingPermissionRequests.find(context); if (iter != m_pendingPermissionRequests.end()) - iter.value().append(callback); + iter.value().m_callbacks.append(callback); else { - QList<RefPtr<VoidCallback> > callbacks; RefPtr<VoidCallback> cb = callback; - callbacks.append(cb); - m_pendingPermissionRequests.insert(originString, callbacks); - if (requestPermissionFunction) - requestPermissionFunction(m_receiver, originString); + CallbacksInfo info; + info.m_frame = toFrame(context); + info.m_callbacks.append(cb); + m_pendingPermissionRequests.insert(context, info); + + if (toPage(context) && toFrame(context)) { + m_pendingPermissionRequests.insert(context, info); + emit toPage(context)->requestPermissionFromUser(toFrame(context), QWebPage::NotificationsPermissionDomain); + } } } NotificationPresenter::Permission NotificationPresenterClientQt::checkPermission(ScriptExecutionContext* context) { - NotificationPermission permission = NotificationNotAllowed; - QString origin = context->url().string(); - if (checkPermissionFunction) - checkPermissionFunction(m_receiver, origin, permission); - switch (permission) { - case NotificationAllowed: + QWebPage::PermissionPolicy policy = QWebPage::PermissionUnknown; + if (toPage(context) && toFrame(context)) + emit toPage(context)->checkPermissionFromUser(toFrame(context), QWebPage::NotificationsPermissionDomain, policy); + + switch (policy) { + case QWebPage::PermissionGranted: return NotificationPresenter::PermissionAllowed; - case NotificationNotAllowed: + case QWebPage::PermissionUnknown: return NotificationPresenter::PermissionNotAllowed; - case NotificationDenied: + case QWebPage::PermissionDenied: return NotificationPresenter::PermissionDenied; } ASSERT_NOT_REACHED(); return NotificationPresenter::PermissionNotAllowed; } -void NotificationPresenterClientQt::cancelRequestsForPermission(ScriptExecutionContext*) +void NotificationPresenterClientQt::cancelRequestsForPermission(ScriptExecutionContext* context) { - // FIXME: This will be implemented for https://bugs.webkit.org/show_bug.cgi?id=41413 - // to avoid adding and removing new private API + QHash<ScriptExecutionContext*, CallbacksInfo >::iterator iter = m_pendingPermissionRequests.find(context); + if (iter == m_pendingPermissionRequests.end()) + return; + + QWebFrame* frame = iter.value().m_frame; + if (!frame) + return; + QWebPage* page = frame->page(); + m_pendingPermissionRequests.erase(iter); + + if (!page) + return; + + if (dumpNotification) + printf("DESKTOP NOTIFICATION PERMISSION REQUEST CANCELLED: %s\n", QString(context->securityOrigin()->toString()).toUtf8().constData()); + + emit page->cancelRequestsForPermission(frame, QWebPage::NotificationsPermissionDomain); } -void NotificationPresenterClientQt::allowNotificationForOrigin(const QString& origin) +void NotificationPresenterClientQt::allowNotificationForFrame(QWebFrame* frame) { - QHash<QString, QList<RefPtr<VoidCallback> > >::iterator iter = m_pendingPermissionRequests.find(origin); - if (iter != m_pendingPermissionRequests.end()) { - QList<RefPtr<VoidCallback> >& callbacks = iter.value(); - for (int i = 0; i < callbacks.size(); i++) - callbacks.at(i)->handleEvent(); - m_pendingPermissionRequests.remove(origin); + QHash<ScriptExecutionContext*, CallbacksInfo>::iterator iter = m_pendingPermissionRequests.begin(); + while (iter != m_pendingPermissionRequests.end()) { + if (toFrame(iter.key()) == frame) + break; } + + if (iter == m_pendingPermissionRequests.end()) + return; + + QList<RefPtr<VoidCallback> >& callbacks = iter.value().m_callbacks; + for (int i = 0; i < callbacks.size(); i++) + callbacks.at(i)->handleEvent(); + m_pendingPermissionRequests.remove(iter.key()); } void NotificationPresenterClientQt::sendEvent(Notification* notification, const AtomicString& eventName) @@ -362,6 +389,34 @@ void NotificationPresenterClientQt::dumpShowText(Notification* notification) } } +QWebPage* NotificationPresenterClientQt::toPage(ScriptExecutionContext* context) +{ + if (!context || context->isWorkerContext()) + return 0; + + Document* document = static_cast<Document*>(context); + if (!document) + return 0; + + Page* page = document->page(); + if (!page || !page->mainFrame()) + return 0; + + return QWebFramePrivate::kit(page->mainFrame())->page(); +} + +QWebFrame* NotificationPresenterClientQt::toFrame(ScriptExecutionContext* context) +{ + if (!context || context->isWorkerContext()) + return 0; + + Document* document = static_cast<Document*>(context); + if (!document || !document->frame()) + return 0; + + return QWebFramePrivate::kit(document->frame()); +} + #endif // ENABLE(NOTIFICATIONS) } diff --git a/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h b/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h index b99393b..e8481d4 100644 --- a/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h +++ b/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h @@ -42,6 +42,9 @@ #include <QMultiHash> #include <QSystemTrayIcon> +class QWebFrame; +class QWebPage; + namespace WebCore { class Document; @@ -90,12 +93,10 @@ public: void cancel(NotificationWrapper*); - void allowNotificationForOrigin(const QString& origin); + void allowNotificationForFrame(QWebFrame*); static bool dumpNotification; - void setReceiver(QObject* receiver) { m_receiver = receiver; } - void addClient() { m_clientCount++; } void removeClient(); static NotificationPresenterClientQt* notificationPresenter(); @@ -109,11 +110,17 @@ private: void detachNotification(Notification*); void dumpReplacedIdText(Notification*); void dumpShowText(Notification*); + QWebPage* toPage(ScriptExecutionContext*); + QWebFrame* toFrame(ScriptExecutionContext*); int m_clientCount; - QHash<QString, QList<RefPtr<VoidCallback> > > m_pendingPermissionRequests; + struct CallbacksInfo { + QWebFrame* m_frame; + QList<RefPtr<VoidCallback> > m_callbacks; + }; + QHash<ScriptExecutionContext*, CallbacksInfo > m_pendingPermissionRequests; + NotificationsQueue m_notifications; - QObject* m_receiver; QtPlatformPlugin m_platformPlugin; }; diff --git a/WebKit/qt/declarative/qdeclarativewebview.cpp b/WebKit/qt/declarative/qdeclarativewebview.cpp index 0342c9f..9dcba60 100644 --- a/WebKit/qt/declarative/qdeclarativewebview.cpp +++ b/WebKit/qt/declarative/qdeclarativewebview.cpp @@ -612,7 +612,7 @@ QAction* QDeclarativeWebView::stopAction() const #endif // QT_NO_ACTION /*! - \qmlproperty real WebView::title + \qmlproperty string WebView::title This property holds the title of the web page currently viewed By default, this property contains an empty string. diff --git a/WebKit/qt/qt_webkit_version.pri b/WebKit/qt/qt_webkit_version.pri index 1656f2d..ca6299a 100644 --- a/WebKit/qt/qt_webkit_version.pri +++ b/WebKit/qt/qt_webkit_version.pri @@ -1,4 +1,5 @@ -QT_WEBKIT_VERSION = 4.8.0 +QT_WEBKIT_VERSION = 4.9.0 QT_WEBKIT_MAJOR_VERSION = 4 -QT_WEBKIT_MINOR_VERSION = 8 +QT_WEBKIT_MINOR_VERSION = 9 QT_WEBKIT_PATCH_VERSION = 0 +QT_CONFIG *= webkit diff --git a/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp index 3d03157..b208447 100644 --- a/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -601,6 +601,7 @@ private slots: void setHtml(); void setHtmlWithResource(); void setHtmlWithBaseURL(); + void setHtmlWithJSAlert(); void ipv6HostEncoding(); void metaData(); #if !defined(Q_WS_MAEMO_5) @@ -2555,6 +2556,33 @@ void tst_QWebFrame::setHtmlWithBaseURL() QCOMPARE(m_view->page()->history()->count(), 0); } +class MyPage : public QWebPage +{ +public: + MyPage() : QWebPage(), alerts(0) {} + int alerts; + +protected: + virtual void javaScriptAlert(QWebFrame*, const QString& msg) + { + alerts++; + QCOMPARE(msg, QString("foo")); + // Should not be enough to trigger deferred loading, since we've upped the HTML + // tokenizer delay in the Qt frameloader. See HTMLTokenizer::continueProcessing() + QTest::qWait(1000); + } +}; + +void tst_QWebFrame::setHtmlWithJSAlert() +{ + QString html("<html><head></head><body><script>alert('foo');</script><p>hello world</p></body></html>"); + MyPage page; + m_view->setPage(&page); + page.mainFrame()->setHtml(html); + QCOMPARE(page.alerts, 1); + QCOMPARE(m_view->page()->mainFrame()->toHtml(), html); +} + class TestNetworkManager : public QNetworkAccessManager { public: diff --git a/WebKit/qt/tests/qwebview/tst_qwebview.cpp b/WebKit/qt/tests/qwebview/tst_qwebview.cpp index 835ad82..5dc5e41 100644 --- a/WebKit/qt/tests/qwebview/tst_qwebview.cpp +++ b/WebKit/qt/tests/qwebview/tst_qwebview.cpp @@ -267,23 +267,36 @@ void tst_QWebView::focusInputTypes() // 'password' field webView->fireMouseClick(QPoint(20, 60)); - QVERIFY(webView->inputMethodHints() & Qt::ImhHiddenText); + QVERIFY(webView->inputMethodHints() == Qt::ImhHiddenText); // 'tel' field webView->fireMouseClick(QPoint(20, 110)); - QVERIFY(webView->inputMethodHints() & Qt::ImhDialableCharactersOnly); + QVERIFY(webView->inputMethodHints() == Qt::ImhDialableCharactersOnly); // 'number' field webView->fireMouseClick(QPoint(20, 160)); - QVERIFY(webView->inputMethodHints() & Qt::ImhDigitsOnly); + QVERIFY(webView->inputMethodHints() == Qt::ImhDigitsOnly); // 'email' field webView->fireMouseClick(QPoint(20, 210)); - QVERIFY(webView->inputMethodHints() & Qt::ImhEmailCharactersOnly); + QVERIFY(webView->inputMethodHints() == Qt::ImhEmailCharactersOnly); // 'url' field webView->fireMouseClick(QPoint(20, 260)); - QVERIFY(webView->inputMethodHints() & Qt::ImhUrlCharactersOnly); + QVERIFY(webView->inputMethodHints() == Qt::ImhUrlCharactersOnly); + + // 'password' field + webView->fireMouseClick(QPoint(20, 60)); + QVERIFY(webView->inputMethodHints() == Qt::ImhHiddenText); + + // 'text' type + webView->fireMouseClick(QPoint(20, 10)); +#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) || defined(Q_OS_SYMBIAN) + QVERIFY(webView->inputMethodHints() & Qt::ImhNoAutoUppercase); + QVERIFY(webView->inputMethodHints() & Qt::ImhNoPredictiveText); +#else + QVERIFY(webView->inputMethodHints() == Qt::ImhNone); +#endif delete webView; diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog index 44869dc..6b81bcc 100644 --- a/WebKit/win/ChangeLog +++ b/WebKit/win/ChangeLog @@ -1,3 +1,49 @@ +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 + + * WebView.cpp: + (WebView::initWithFrame): + +2010-07-27 Steve Block <steveblock@google.com> + + Reviewed by Alexey Proskuryakov. + + Client-based Geolocation does not pass enableHighAccuracy option to controller and client + https://bugs.webkit.org/show_bug.cgi?id=40374 + + Stub out setEnableHighAccuracy method for the Win port. + + * WebCoreSupport/WebGeolocationControllerClient.h: + (WebGeolocationControllerClient::setEnableHighAccuracy): + +2010-07-22 Sam Weinig <sam@webkit.org> + + Reviewed by Maciej Stachowiak. + + Fix for <rdar://problem/8222626> + Send textDidChangeInTextField delegate callback only in response to typing or other forms of user text input. + + The function name no longer perfectly matches the behavior, but I didn't want to break any existing clients. Maybe we + should migrate to a new function name eventually + + * WebCoreSupport/WebEditorClient.cpp: + (WebEditorClient::textDidChangeInTextField): + +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 + + * WebView.cpp: + (WebView::registerURLSchemeAsLocal): + (WebView::registerURLSchemeAsSecure): + 2010-07-20 Steve Falkenburg <sfalken@apple.com> Reviewed by Adam Roben. diff --git a/WebKit/win/WebCoreSupport/WebEditorClient.cpp b/WebKit/win/WebCoreSupport/WebEditorClient.cpp index e05951c..f03ffd6 100644 --- a/WebKit/win/WebCoreSupport/WebEditorClient.cpp +++ b/WebKit/win/WebCoreSupport/WebEditorClient.cpp @@ -41,9 +41,10 @@ #include <WebCore/HTMLInputElement.h> #include <WebCore/HTMLNames.h> #include <WebCore/KeyboardEvent.h> -#include <WebCore/PlatformKeyboardEvent.h> #include <WebCore/NotImplemented.h> +#include <WebCore/PlatformKeyboardEvent.h> #include <WebCore/Range.h> +#include <WebCore/UserTypingGestureIndicator.h> #pragma warning(pop) using namespace WebCore; @@ -347,6 +348,9 @@ void WebEditorClient::textFieldDidEndEditing(Element* e) void WebEditorClient::textDidChangeInTextField(Element* e) { + if (!UserTypingGestureIndicator::processingUserTypingGesture() || UserTypingGestureIndicator::focusedElementAtGestureStart() != e) + return; + IWebFormDelegate* formDelegate; if (SUCCEEDED(m_webView->formDelegate(&formDelegate)) && formDelegate) { IDOMElement* domElement = DOMElement::createInstance(e); diff --git a/WebKit/win/WebCoreSupport/WebGeolocationControllerClient.h b/WebKit/win/WebCoreSupport/WebGeolocationControllerClient.h index ec0bef7..ed73454 100644 --- a/WebKit/win/WebCoreSupport/WebGeolocationControllerClient.h +++ b/WebKit/win/WebCoreSupport/WebGeolocationControllerClient.h @@ -42,6 +42,7 @@ public: virtual void geolocationDestroyed(); virtual void startUpdating(); virtual void stopUpdating(); + virtual void setEnableHighAccuracy(bool) { } virtual WebCore::GeolocationPosition* lastPosition(); private: diff --git a/WebKit/win/WebView.cpp b/WebKit/win/WebView.cpp index fb0aad5..41ae079 100644 --- a/WebKit/win/WebView.cpp +++ b/WebKit/win/WebView.cpp @@ -118,6 +118,7 @@ #include <WebCore/RenderWidget.h> #include <WebCore/ResourceHandle.h> #include <WebCore/ResourceHandleClient.h> +#include <WebCore/SchemeRegistry.h> #include <WebCore/ScriptValue.h> #include <WebCore/Scrollbar.h> #include <WebCore/ScrollbarTheme.h> @@ -2562,17 +2563,21 @@ HRESULT STDMETHODCALLTYPE WebView::initWithFrame( Settings::setShouldPaintNativeControls(shouldPaintNativeControls); #endif -#if ENABLE(CLIENT_BASED_GEOLOCATION) - WebGeolocationControllerClient* geolocationControllerClient = new WebGeolocationControllerClient(this); -#else - WebGeolocationControllerClient* geolocationControllerClient = 0; -#endif - BOOL useHighResolutionTimer; if (SUCCEEDED(m_preferences->shouldUseHighResolutionTimers(&useHighResolutionTimer))) Settings::setShouldUseHighResolutionTimers(useHighResolutionTimer); - m_page = new Page(new WebChromeClient(this), new WebContextMenuClient(this), new WebEditorClient(this), new WebDragClient(this), new WebInspectorClient(this), new WebPluginHalterClient(this), geolocationControllerClient, 0, 0); + Page::PageClients pageClients; + pageClients.chromeClient = new WebChromeClient(this); + pageClients.contextMenuClient = new WebContextMenuClient(this); + pageClients.editorClient = new WebEditorClient(this); + pageClients.dragClient = new WebDragClient(this); + pageClients.inspectorClient = new WebInspectorClient(this); + pageClients.pluginHalterClient = new WebPluginHalterClient(this); +#if ENABLE(CLIENT_BASED_GEOLOCATION) + pageClients.geolocationControllerClient = new WebGeolocationControllerClient(this); +#endif + m_page = new Page(pageClients); BSTR localStoragePath; if (SUCCEEDED(m_preferences->localStorageDatabasePath(&localStoragePath))) { @@ -3652,7 +3657,7 @@ HRESULT STDMETHODCALLTYPE WebView::registerURLSchemeAsLocal( if (!scheme) return E_POINTER; - SecurityOrigin::registerURLSchemeAsLocal(String(scheme, ::SysStringLen(scheme))); + SchemeRegistry::registerURLSchemeAsLocal(String(scheme, ::SysStringLen(scheme))); return S_OK; } @@ -6412,7 +6417,7 @@ HRESULT WebView::setDomainRelaxationForbiddenForURLScheme(BOOL forbidden, BSTR s HRESULT WebView::registerURLSchemeAsSecure(BSTR scheme) { - SecurityOrigin::registerURLSchemeAsSecure(toString(scheme)); + SchemeRegistry::registerURLSchemeAsSecure(toString(scheme)); return S_OK; } diff --git a/WebKit/wx/ChangeLog b/WebKit/wx/ChangeLog index 32ff6fe..2195112 100644 --- a/WebKit/wx/ChangeLog +++ b/WebKit/wx/ChangeLog @@ -1,3 +1,76 @@ +2010-07-28 Kevin Ollivier <kevino@theolliviers.com> + + [wx] wxPython build fix that was missed in last commit. + + * bindings/python/webview.i: + +2010-07-28 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Build fix after recent changes. + + * WebEdit.h: Added. + * bindings/python/webview.i: + +2010-07-28 Robin Dunn <robin@alldunn.com> + + Reviewed by Kevin Ollivier. + + Add DOM bindings support for wx port. + + * WebBrowserShell.cpp: + (wxWebBrowserShell::wxWebBrowserShell): + (wxWebBrowserShell::OnEditCommand): + (wxWebBrowserShell::OnGetEditCommandState): + * WebBrowserShell.h: + * WebDOMSelection.cpp: Added. + (wxWebKitSelection::wxWebKitSelection): + (wxWebKitSelection::GetRootEditableElement): + (wxWebKitSelection::GetAsRange): + * WebDOMSelection.h: Added. + * WebFrame.cpp: + (wxWebFrame::GetSelectionAsHTML): + (wxWebFrame::GetSelectionAsText): + (wxWebFrame::GetSelection): + (wxWebFrame::ExecuteEditCommand): + (wxWebFrame::GetEditCommandState): + (wxWebFrame::GetEditCommandValue): + (wxWebFrame::HitTest): + * WebFrame.h: + * WebKitDefines.h: + * WebKitSupport/EditorClientWx.cpp: + (WebCore::): + (WebCore::EditorClientWx::redo): + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::finishedLoading): + (WebCore::FrameLoaderClientWx::setMainDocumentError): + (WebCore::FrameLoaderClientWx::dispatchDidFailLoading): + * WebView.cpp: + (wxWebViewDOMElementInfo::wxWebViewDOMElementInfo): + (wxWebViewDOMElementInfo::~wxWebViewDOMElementInfo): + (wxWebView::Create): + (wxWebView::GetSelection): + (wxWebView::GetSelectionAsHTML): + (wxWebView::GetSelectionAsText): + (wxWebView::ExecuteEditCommand): + (wxWebView::GetEditCommandState): + (wxWebView::GetEditCommandValue): + (wxWebView::MakeEditable): + (wxWebView::IsEditable): + * WebView.h: + * bindings/python/webview.i: + * bindings/python/wscript: + * wscript: + +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 + + * WebView.cpp: + (wxWebView::Create): + 2010-07-16 Zhe Su <suzhe@chromium.org> Reviewed by Darin Adler. diff --git a/WebKit/wx/WebBrowserShell.cpp b/WebKit/wx/WebBrowserShell.cpp index 8853051..b1ff578 100644 --- a/WebKit/wx/WebBrowserShell.cpp +++ b/WebKit/wx/WebBrowserShell.cpp @@ -35,8 +35,9 @@ #include "wx/artprov.h" -#include "WebView.h" #include "WebBrowserShell.h" +#include "WebFrame.h" +#include "WebView.h" #include "WebViewPrivate.h" wxPageSourceViewFrame::wxPageSourceViewFrame(const wxString& source) @@ -63,7 +64,9 @@ enum { ID_BROWSE = wxID_HIGHEST + 15, ID_EDIT = wxID_HIGHEST + 16, ID_RUN_SCRIPT = wxID_HIGHEST + 17, - ID_WEBVIEW = wxID_HIGHEST + 18 + ID_WEBVIEW = wxID_HIGHEST + 18, + ID_EDIT_COMMAND = wxID_HIGHEST + 19, + ID_GET_EDIT_COMMAND_STATE = wxID_HIGHEST + 20 }; BEGIN_EVENT_TABLE(wxWebBrowserShell, wxFrame) @@ -88,6 +91,8 @@ BEGIN_EVENT_TABLE(wxWebBrowserShell, wxFrame) EVT_MENU(ID_BROWSE, wxWebBrowserShell::OnBrowse) EVT_MENU(ID_EDIT, wxWebBrowserShell::OnEdit) EVT_MENU(ID_RUN_SCRIPT, wxWebBrowserShell::OnRunScript) + EVT_MENU(ID_EDIT_COMMAND, wxWebBrowserShell::OnEditCommand) + EVT_MENU(ID_GET_EDIT_COMMAND_STATE, wxWebBrowserShell::OnGetEditCommandState) END_EVENT_TABLE() @@ -123,6 +128,8 @@ wxWebBrowserShell::wxWebBrowserShell(const wxString& title) : m_debugMenu = new wxMenu; m_debugMenu->Append(ID_SET_SOURCE, _("Test SetPageSource")); m_debugMenu->Append(ID_RUN_SCRIPT, _("Test RunScript")); + m_debugMenu->Append(ID_EDIT_COMMAND, _("Test EditCommand::Execute")); + m_debugMenu->Append(ID_GET_EDIT_COMMAND_STATE, _("Test EditCommand::GetState")); // the "About" item should be in the help menu wxMenu *helpMenu = new wxMenu; @@ -339,7 +346,8 @@ void wxWebBrowserShell::OnEdit(wxCommandEvent& event) webview->MakeEditable(event.IsChecked()); } -void wxWebBrowserShell::OnRunScript(wxCommandEvent& myEvent){ +void wxWebBrowserShell::OnRunScript(wxCommandEvent& myEvent) +{ if (webview) { wxTextEntryDialog* dialog = new wxTextEntryDialog(this, _("Type in a JavaScript to exectute.")); if (dialog->ShowModal() == wxID_OK) @@ -348,3 +356,43 @@ void wxWebBrowserShell::OnRunScript(wxCommandEvent& myEvent){ dialog->Destroy(); } } + +void wxWebBrowserShell::OnEditCommand(wxCommandEvent& myEvent) +{ + if (webview) { + if (!webview->IsEditable()) { + wxMessageBox(wxT("Please enable editing before running editing commands.")); + return; + } + + wxTextEntryDialog* dialog = new wxTextEntryDialog(this, _("Type in a editing command to exectute.")); + if (dialog->ShowModal() == wxID_OK) { + bool result = webview->ExecuteEditCommand(dialog->GetValue()); + if (!result) + wxMessageBox(wxT("Editing command failed.")); + } + dialog->Destroy(); + } +} + +void wxWebBrowserShell::OnGetEditCommandState(wxCommandEvent& myEvent) +{ + if (webview) { + if (!webview->IsEditable()) { + wxMessageBox(wxT("Please enable editing before running editing commands.")); + return; + } + + wxTextEntryDialog* dialog = new wxTextEntryDialog(this, _("Type in a editing command whose state you want to get.")); + if (dialog->ShowModal() == wxID_OK) { + EditState result = webview->GetEditCommandState(dialog->GetValue()); + if (result == EditStateTrue) + wxMessageBox(wxT("State is true.")); + else if (result == EditStateFalse) + wxMessageBox(wxT("State is false.")); + else if (result == EditStateMixed) + wxMessageBox(wxT("State is mixed.")); + } + dialog->Destroy(); + } +} diff --git a/WebKit/wx/WebBrowserShell.h b/WebKit/wx/WebBrowserShell.h index 2f43ffb..4fe9c03 100644 --- a/WebKit/wx/WebBrowserShell.h +++ b/WebKit/wx/WebBrowserShell.h @@ -80,6 +80,8 @@ protected: // debug menu items void OnSetSource(wxCommandEvent& event); void OnRunScript(wxCommandEvent& myEvent); + void OnEditCommand(wxCommandEvent& myEvent); + void OnGetEditCommandState(wxCommandEvent& myEvent); private: wxTextCtrl* addressBar; diff --git a/WebKit/wx/WebDOMSelection.cpp b/WebKit/wx/WebDOMSelection.cpp new file mode 100644 index 0000000..ce35ea4 --- /dev/null +++ b/WebKit/wx/WebDOMSelection.cpp @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2008 Kevin Ollivier <kevino@theolliviers.com> + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebDOMSelection.h" + +#include "Element.h" +#include "SelectionController.h" +#include "WebDOMElement.h" +#include "WebDOMRange.h" + +#include <wtf/RefPtr.h> + +#include "wx/wxprec.h" +#ifndef WX_PRECOMP + #include "wx/wx.h" +#endif + +IMPLEMENT_DYNAMIC_CLASS(wxWebKitSelection, wxObject) + +wxWebKitSelection::wxWebKitSelection(const wxWebKitSelection& other) +{ + m_selection = other.m_selection; +} + +WebDOMElement* wxWebKitSelection::GetRootEditableElement() const +{ + if (m_selection) + return new WebDOMElement(m_selection->rootEditableElement()); + + return 0; +} + +WebDOMRange* wxWebKitSelection::GetAsRange() +{ + if (m_selection) { + WTF::RefPtr<WebCore::Range> range = m_selection->toNormalizedRange(); + // keep it alive until it reaches wxWebKitDOMRange, which takes ownership + + if (range) { + range->ref(); + return new WebDOMRange(range.get()); + } + } + + return 0; +} diff --git a/WebKit/wx/WebDOMSelection.h b/WebKit/wx/WebDOMSelection.h new file mode 100644 index 0000000..f9a2aa5 --- /dev/null +++ b/WebKit/wx/WebDOMSelection.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2008 Kevin Ollivier <kevino@theolliviers.com> + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebDOMSelection_h +#define WebDOMSelection_h + +#include "wx/wxprec.h" +#ifndef WX_PRECOMP + #include "wx/wx.h" +#endif + +#include "WebKitDefines.h" + +class WebDOMElement; +class WebDOMRange; + +namespace WebCore { + +class SelectionController; + +} + +class WXDLLIMPEXP_WEBKIT wxWebKitSelection : public wxObject { +#ifndef SWIG +DECLARE_DYNAMIC_CLASS(wxWebKitDOMSelection) +#endif + +public: + wxWebKitSelection() {} + wxWebKitSelection(WebCore::SelectionController* selection) + : m_selection(selection) + { } + + wxWebKitSelection(const wxWebKitSelection&); + ~wxWebKitSelection() { m_selection = 0; } + + WebDOMElement* GetRootEditableElement() const; + WebDOMRange* GetAsRange(); + +private: + WebCore::SelectionController* m_selection; + +}; + +#endif diff --git a/WebKit/wx/WebEdit.h b/WebKit/wx/WebEdit.h new file mode 100644 index 0000000..7099088 --- /dev/null +++ b/WebKit/wx/WebEdit.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2009 Kevin Ollivier <kevino@theolliviers.com> + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WXWEBEDIT_H +#define WXWEBEDIT_H + +#include "wx/wxprec.h" +#ifndef WX_PRECOMP + #include "wx/wx.h" +#endif + +#include "WebKitDefines.h" + +namespace WebCore { + class CompositeEditCommand; + class WebCoreEditCommand; +} + +class WebDOMElement; +class wxWebFrame; + +class WXDLLIMPEXP_WEBKIT wxWebEditCommand +{ + friend class WebCore::CompositeEditCommand; + friend class WebCore::WebCoreEditCommand; + +public: + wxWebEditCommand(wxWebFrame*); + ~wxWebEditCommand(); + + void SetNodeAttribute(WebDOMElement*, const wxString&, const wxString&); + void Apply(); + +private: + WebCore::WebCoreEditCommand* m_impl; +}; + +#endif diff --git a/WebKit/wx/WebFrame.cpp b/WebKit/wx/WebFrame.cpp index e1f7ecc..b8d2ac2 100644 --- a/WebKit/wx/WebFrame.cpp +++ b/WebKit/wx/WebFrame.cpp @@ -59,6 +59,9 @@ #include "wx/wx.h" #endif +#include "WebDOMNode.h" + +#include "WebDOMSelection.h" #include "WebFrame.h" #include "WebView.h" #include "WebFramePrivate.h" @@ -193,6 +196,30 @@ wxString wxWebFrame::GetExternalRepresentation() return externalRepresentation(m_impl->frame); } +wxString wxWebFrame::GetSelectionAsHTML() +{ + if (m_impl->frame) + return m_impl->frame->selection()->toNormalizedRange()->toHTML(); + + return wxEmptyString; +} + +wxString wxWebFrame::GetSelectionAsText() +{ + if (m_impl->frame) + return m_impl->frame->selection()->toNormalizedRange()->text(); + + return wxEmptyString; +} + +wxWebKitSelection wxWebFrame::GetSelection() +{ + if (m_impl->frame) + return wxWebKitSelection(m_impl->frame->selection()); + + return 0; +} + wxString wxWebFrame::RunScript(const wxString& javascript) { wxString returnValue = wxEmptyString; @@ -213,6 +240,36 @@ wxString wxWebFrame::RunScript(const wxString& javascript) return returnValue; } +bool wxWebFrame::ExecuteEditCommand(const wxString& command, const wxString& parameter) +{ + if (m_impl->frame && IsEditable()) + return m_impl->frame->editor()->command(command).execute(parameter); +} + +EditState wxWebFrame::GetEditCommandState(const wxString& command) const +{ + if (m_impl->frame && IsEditable()) { + WebCore::TriState state = m_impl->frame->editor()->command(command).state(); + if (state == WebCore::TrueTriState) + return EditStateTrue; + if (state == WebCore::FalseTriState) + return EditStateFalse; + + return EditStateMixed; + } + + return EditStateFalse; +} + +wxString wxWebFrame::GetEditCommandValue(const wxString& command) const +{ + if (m_impl->frame && IsEditable()) + return m_impl->frame->editor()->command(command).value(); + + return wxEmptyString; +} + + bool wxWebFrame::FindString(const wxString& string, bool forward, bool caseSensitive, bool wrapSelection, bool startInSelection) { if (m_impl->frame) @@ -401,6 +458,7 @@ wxWebViewDOMElementInfo wxWebFrame::HitTest(const wxPoint& pos) const if (m_impl->frame->view()) { WebCore::HitTestResult result = m_impl->frame->eventHandler()->hitTestResultAtPoint(m_impl->frame->view()->windowToContents(pos), false); if (result.innerNode()) { + domInfo.SetInnerNode(new WebDOMNode(result.innerNode())); domInfo.SetLink(result.absoluteLinkURL().string()); domInfo.SetText(result.textContent()); domInfo.SetImageSrc(result.absoluteImageURL().string()); diff --git a/WebKit/wx/WebFrame.h b/WebKit/wx/WebFrame.h index fec6257..f09c884 100644 --- a/WebKit/wx/WebFrame.h +++ b/WebKit/wx/WebFrame.h @@ -35,23 +35,31 @@ #include "WebKitDefines.h" +class WebDOMElement; +class WebDOMNode; + +#include "WebDOMSelection.h" + +class Element; + class WebFramePrivate; class WebViewFrameData; class wxWebView; namespace WebCore { class ChromeClientWx; - class FrameLoaderClientWx; class EditorClientWx; - class Frame; + class FrameLoaderClientWx; + class Frame; } class WXDLLIMPEXP_WEBKIT wxWebViewDOMElementInfo { public: wxWebViewDOMElementInfo(); + wxWebViewDOMElementInfo(const wxWebViewDOMElementInfo& other); - ~wxWebViewDOMElementInfo() { } + ~wxWebViewDOMElementInfo(); wxString GetTagName() const { return m_tagName; } void SetTagName(const wxString& name) { m_tagName = name; } @@ -67,9 +75,16 @@ public: wxString GetLink() const { return m_link; } void SetLink(const wxString& link) { m_link = link; } + + WebDOMNode* GetInnerNode() { return m_innerNode; } + void SetInnerNode(WebDOMNode* node) { m_innerNode = node; } + + WebDOMElement* GetURLElement() { return m_urlElement; } + void SetURLElement(WebDOMElement* url) { m_urlElement = url; } private: - void* m_domElement; + WebDOMNode* m_innerNode; + WebDOMElement* m_urlElement; bool m_isSelected; wxString m_tagName; wxString m_text; @@ -82,6 +97,7 @@ enum wxWebKitParseMode { Compat, AlmostStrict, Strict, NoDocument }; class WXDLLIMPEXP_WEBKIT wxWebFrame { +public: // ChromeClientWx needs to get the Page* stored by the wxWebView // for the createWindow function. friend class WebCore::ChromeClientWx; @@ -124,7 +140,14 @@ public: wxString GetAsMarkup(); wxString GetExternalRepresentation(); + wxWebKitSelection GetSelection(); + wxString GetSelectionAsHTML(); + wxString GetSelectionAsText(); + wxString RunScript(const wxString& javascript); + bool ExecuteEditCommand(const wxString& command, const wxString& parameter = wxEmptyString); + EditState GetEditCommandState(const wxString& command) const; + wxString GetEditCommandValue(const wxString& command) const; bool FindString(const wxString& string, bool forward = true, bool caseSensitive = false, bool wrapSelection = true, diff --git a/WebKit/wx/WebKitDefines.h b/WebKit/wx/WebKitDefines.h index d973063..67ad868 100644 --- a/WebKit/wx/WebKitDefines.h +++ b/WebKit/wx/WebKitDefines.h @@ -42,4 +42,7 @@ #define WXDLLIMPEXP_WEBKIT #endif // SWIG +// enums +enum EditState { EditStateTrue, EditStateFalse, EditStateMixed }; + #endif // WebKitDefines_h diff --git a/WebKit/wx/WebKitSupport/EditorClientWx.cpp b/WebKit/wx/WebKitSupport/EditorClientWx.cpp index 2355141..64bfd06 100644 --- a/WebKit/wx/WebKitSupport/EditorClientWx.cpp +++ b/WebKit/wx/WebKitSupport/EditorClientWx.cpp @@ -109,7 +109,7 @@ static const KeyDownEntry keyDownEntries[] = { { VK_RETURN, 0, "InsertNewline" }, { VK_RETURN, CtrlKey, "InsertNewline" }, { VK_RETURN, AltKey, "InsertNewline" }, - { VK_RETURN, AltKey | ShiftKey, "InsertNewline" }, + { VK_RETURN, ShiftKey, "InsertLineBreak" }, { 'A', CtrlKey, "SelectAll" }, { 'Z', CtrlKey, "Undo" }, { 'Z', CtrlKey | ShiftKey, "Redo" }, @@ -363,8 +363,8 @@ void EditorClientWx::redo() if (frame) { wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformPageClient()); if (webKitWin) { - webKitWin->m_impl->redoStack.first().editCommand()->reapply(); - webKitWin->m_impl->redoStack.remove(0); + webKitWin->m_impl->redoStack.last().editCommand()->reapply(); + webKitWin->m_impl->redoStack.removeLast(); } } } diff --git a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp index a163727..5b708c2 100644 --- a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp +++ b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp @@ -430,9 +430,15 @@ void FrameLoaderClientWx::didChangeTitle(DocumentLoader *l) } -void FrameLoaderClientWx::finishedLoading(DocumentLoader*) +void FrameLoaderClientWx::finishedLoading(DocumentLoader* loader) { - if (m_pluginView) { + if (!m_pluginView) { + if (m_firstData) { + FrameLoader* fl = loader->frameLoader(); + fl->writer()->setEncoding(m_response.textEncodingName(), false); + m_firstData = false; + } + } else { m_pluginView->didFinishLoading(); m_pluginView = 0; m_hasSentResponseToPlugin = false; @@ -598,9 +604,12 @@ bool FrameLoaderClientWx::canCachePage() const return false; } -void FrameLoaderClientWx::setMainDocumentError(WebCore::DocumentLoader*, const WebCore::ResourceError&) +void FrameLoaderClientWx::setMainDocumentError(WebCore::DocumentLoader* loader, const WebCore::ResourceError&) { - notImplemented(); + if (m_firstData) { + loader->frameLoader()->writer()->setEncoding(m_response.textEncodingName(), false); + m_firstData = false; + } } void FrameLoaderClientWx::committedLoad(WebCore::DocumentLoader* loader, const char* data, int length) @@ -722,8 +731,13 @@ void FrameLoaderClientWx::dispatchDidFinishLoading(DocumentLoader*, unsigned lon notImplemented(); } -void FrameLoaderClientWx::dispatchDidFailLoading(DocumentLoader*, unsigned long, const ResourceError&) +void FrameLoaderClientWx::dispatchDidFailLoading(DocumentLoader* loader, unsigned long, const ResourceError&) { + if (m_firstData) { + FrameLoader* fl = loader->frameLoader(); + fl->writer()->setEncoding(m_response.textEncodingName(), false); + m_firstData = false; + } if (m_webView) { wxWebViewLoadEvent wkEvent(m_webView); wkEvent.SetState(wxWEBVIEW_LOAD_FAILED); diff --git a/WebKit/wx/WebView.cpp b/WebKit/wx/WebView.cpp index 59fba2f..88d0ad9 100644 --- a/WebKit/wx/WebView.cpp +++ b/WebKit/wx/WebView.cpp @@ -83,6 +83,9 @@ #include "wx/wx.h" #endif +#include "WebDOMElement.h" +#include "WebDOMNode.h" + #include "WebFrame.h" #include "WebView.h" #include "WebViewPrivate.h" @@ -229,7 +232,6 @@ wxWebViewWindowObjectClearedEvent::wxWebViewWindowObjectClearedEvent(wxWindow* w //--------------------------------------------------------- wxWebViewDOMElementInfo::wxWebViewDOMElementInfo() : - m_domElement(NULL), m_isSelected(false), m_text(wxEmptyString), m_imageSrc(wxEmptyString), @@ -257,6 +259,25 @@ wxWebViewCachePolicy wxWebView::GetCachePolicy() return gs_cachePolicy; } +wxWebViewDOMElementInfo::wxWebViewDOMElementInfo(const wxWebViewDOMElementInfo& other) +{ + m_isSelected = other.m_isSelected; + m_text = other.m_text; + m_imageSrc = other.m_imageSrc; + m_link = other.m_link; + m_innerNode = other.m_innerNode; + m_urlElement = other.m_urlElement; +} + +wxWebViewDOMElementInfo::~wxWebViewDOMElementInfo() +{ + if (m_innerNode) + delete m_innerNode; + + if (m_urlElement) + delete m_urlElement; +} + #if OS(DARWIN) // prototype - function is in WebSystemInterface.mm void InitWebCoreSystemInterface(void); @@ -332,11 +353,14 @@ bool wxWebView::Create(wxWindow* parent, int id, const wxPoint& position, WebCore::HTMLFrameOwnerElement* parentFrame = 0; WebCore::EditorClientWx* editorClient = new WebCore::EditorClientWx(); - m_impl->page = new WebCore::Page(new WebCore::ChromeClientWx(this), - new WebCore::ContextMenuClientWx(), - editorClient, - new WebCore::DragClientWx(), - new WebCore::InspectorClientWx(), 0, 0, 0, 0); + + WebCore::Page::PageClients pageClients; + pageClients.chromeClient = new WebCore::ChromeClientWx(this); + pageClients.contextMenuClient = new WebCore::ContextMenuClientWx(); + pageClients.editorClient = editorClient; + pageClients.dragClient = new WebCore::DragClientWx(); + pageClients.inspectorClient = new WebCore::InspectorClientWx(); + m_impl->page = new WebCore::Page(pageClients); editorClient->setPage(m_impl->page); m_mainFrame = new wxWebFrame(this); @@ -361,9 +385,6 @@ bool wxWebView::Create(wxWindow* parent, int id, const wxPoint& position, // initialized so that the activate handler is run properly. LoadURL(wxT("about:blank")); - wxWindow* tlw = wxGetTopLevelParent(this); - tlw->Connect(-1, wxEVT_ACTIVATE, wxActivateEventHandler(wxWebView::OnTLWActivated)); - m_isInitialized = true; return true; @@ -383,6 +404,9 @@ wxWebView::~wxWebView() m_impl->page = 0; } +// NOTE: binding to this event in the wxWebView constructor is too early in +// some cases, but leave the event handler here so that users can bind to it +// at a later time if they have activation state problems. void wxWebView::OnTLWActivated(wxActivateEvent& event) { if (m_impl && m_impl->page && m_impl->page->focusController()) @@ -442,6 +466,30 @@ wxString wxWebView::GetExternalRepresentation() return wxEmptyString; } +wxWebKitSelection wxWebView::GetSelection() +{ + if (m_mainFrame) + return m_mainFrame->GetSelection(); + + return 0; +} + +wxString wxWebView::GetSelectionAsHTML() +{ + if (m_mainFrame) + return m_mainFrame->GetSelectionAsHTML(); + + return wxEmptyString; +} + +wxString wxWebView::GetSelectionAsText() +{ + if (m_mainFrame) + return m_mainFrame->GetSelectionAsText(); + + return wxEmptyString; +} + void wxWebView::SetTransparent(bool transparent) { WebCore::Frame* frame = 0; @@ -474,6 +522,26 @@ wxString wxWebView::RunScript(const wxString& javascript) return wxEmptyString; } +bool wxWebView::ExecuteEditCommand(const wxString& command, const wxString& parameter) +{ + if (m_mainFrame) + return m_mainFrame->ExecuteEditCommand(command, parameter); +} + +EditState wxWebView::GetEditCommandState(const wxString& command) const +{ + if (m_mainFrame) + return m_mainFrame->GetEditCommandState(command); +} + +wxString wxWebView::GetEditCommandValue(const wxString& command) const +{ + if (m_mainFrame) + return m_mainFrame->GetEditCommandValue(command); + + return wxEmptyString; +} + void wxWebView::LoadURL(const wxString& url) { if (m_mainFrame) @@ -548,10 +616,20 @@ void wxWebView::ResetTextSize() void wxWebView::MakeEditable(bool enable) { - m_isEditable = enable; + if (m_mainFrame) + m_mainFrame->MakeEditable(enable); +} + +bool wxWebView::IsEditable() const +{ + if (m_mainFrame) + return m_mainFrame->IsEditable(); + + return false; } + /* * Event forwarding functions to send events down to WebCore. */ diff --git a/WebKit/wx/WebView.h b/WebKit/wx/WebView.h index 075deaf..d7f23b6 100644 --- a/WebKit/wx/WebView.h +++ b/WebKit/wx/WebView.h @@ -33,8 +33,9 @@ #include "wx/wx.h" #endif -#include "WebFrame.h" #include "WebKitDefines.h" +#include "WebDOMSelection.h" +#include "WebFrame.h" #include "WebSettings.h" class WebViewPrivate; @@ -161,10 +162,17 @@ public: wxString GetAsMarkup(); wxString GetExternalRepresentation(); + wxWebKitSelection GetSelection(); + wxString GetSelectionAsHTML(); + wxString GetSelectionAsText(); + void SetTransparent(bool transparent); bool IsTransparent() const; wxString RunScript(const wxString& javascript); + bool ExecuteEditCommand(const wxString& command, const wxString& parameter = wxEmptyString); + EditState GetEditCommandState(const wxString& command) const; + wxString GetEditCommandValue(const wxString& command) const; bool FindString(const wxString& string, bool forward = true, bool caseSensitive = false, bool wrapSelection = true, @@ -176,7 +184,7 @@ public: void DecreaseTextSize(); void ResetTextSize(); void MakeEditable(bool enable); - bool IsEditable() const { return m_isEditable; } + bool IsEditable() const; wxString GetPageTitle() const { return m_title; } void SetPageTitle(const wxString& title) { m_title = title; } diff --git a/WebKit/wx/bindings/python/webview.i b/WebKit/wx/bindings/python/webview.i index bdc5561..15b1d93 100644 --- a/WebKit/wx/bindings/python/webview.i +++ b/WebKit/wx/bindings/python/webview.i @@ -22,24 +22,78 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + %module webview %{ #include "wx/wxPython/wxPython.h" #include "wx/wxPython/pyclasses.h" - #include "WebBrowserShell.h" +#include "WebDOMSelection.h" +#include "WebEdit.h" #include "WebFrame.h" -#include "WebKitDefines.h" #include "WebSettings.h" #include "WebView.h" + +#include "WebDOMAttr.h" +#include "WebDOMCSSStyleDeclaration.h" +#include "WebDOMDocument.h" +#include "WebDOMDocumentFragment.h" +#include "WebDOMDOMSelection.h" +#include "WebDOMElement.h" +#include "WebDOMEventListener.h" +#include "WebDOMNamedNodeMap.h" +#include "WebDOMNode.h" +#include "WebDOMNodeList.h" +#include "WebDOMObject.h" +#include "WebDOMRange.h" + +PyObject* createDOMNodeSubtype(WebDOMNode* ptr, bool setThisOwn) +{ + //static wxPyTypeInfoHashMap* typeInfoCache = NULL; + + //if (typeInfoCache == NULL) + // typeInfoCache = new wxPyTypeInfoHashMap; + + swig_type_info* swigType = 0; //(*typeInfoCache)[name]; + char* name = 0; + if (ptr) { + // it wasn't in the cache, so look it up from SWIG + switch (ptr->nodeType()) { + case WebDOMNode::WEBDOM_ELEMENT_NODE: + name = "WebDOMElement*"; + break; + case WebDOMNode::WEBDOM_ATTRIBUTE_NODE: + name = "WebDOMAttr*"; + break; + default: + name = "WebDOMNode*"; + } + swigType = SWIG_TypeQuery(name); + if (swigType) + return SWIG_Python_NewPointerObj(ptr, swigType, setThisOwn); + + // if it still wasn't found, try looking for a mapped name + //if (swigType) { + // and add it to the map if found + // (*typeInfoCache)[className] = swigType; + //} + } + + Py_INCREF(Py_None); + + return Py_None; +} + %} //--------------------------------------------------------------------------- %import core.i %import windows.i +%typemap(out) WebDOMNode* { $result = createDOMNodeSubtype($1, (bool)$owner); } +%typemap(out) WebDOMElement* { $result = createDOMNodeSubtype($1, (bool)$owner); } + MAKE_CONST_WXSTRING(WebViewNameStr); MustHaveApp(wxWebBrowserShell); @@ -48,7 +102,18 @@ MustHaveApp(wxWebView); %include WebKitDefines.h +%include WebDOMObject.h +%include WebDOMNode.h + +%include WebDOMAttr.h +%include WebDOMDOMSelection.h +%include WebDOMElement.h +%include WebDOMNodeList.h +%include WebDOMRange.h + %include WebBrowserShell.h +%include WebDOMSelection.h +%include WebEdit.h %include WebFrame.h %include WebSettings.h %include WebView.h diff --git a/WebKit/wx/bindings/python/wscript b/WebKit/wx/bindings/python/wscript index 41e5d41..617a839 100644 --- a/WebKit/wx/bindings/python/wscript +++ b/WebKit/wx/bindings/python/wscript @@ -30,6 +30,9 @@ import Logs import Options include_paths = [ + os.path.join(wk_root, 'JavaScriptCore'), + os.path.join(wk_root, 'WebCore', 'bindings', 'cpp'), + os.path.join(wk_root, 'WebCore', 'DerivedSources'), os.path.join(wk_root, 'WebKit', 'wx'), os.path.join(wx_root, 'wxPython', 'include'), os.path.join(wx_root, '..', 'wxPython', 'include'), @@ -95,4 +98,5 @@ def build(bld): libpath = [output_dir], uselib_local = '', - install_path = output_dir) + install_path = output_dir + ) diff --git a/WebKit/wx/wscript b/WebKit/wx/wscript index d0594b3..fa3e06f 100644 --- a/WebKit/wx/wscript +++ b/WebKit/wx/wscript @@ -32,6 +32,8 @@ include_paths = webkit_dirs + common_includes + ['.', '..', wk_root, os.path.join(wk_root, 'JavaScriptCore'), os.path.join(wk_root, 'WebCore'), + os.path.join(wk_root, 'WebCore', 'bindings', 'wx'), + os.path.join(wk_root, 'WebCore', 'DerivedSources'), os.path.join(output_dir), os.path.join(wk_root, 'WebCore', 'page', 'wx'), os.path.join(wk_root, 'WebCore', 'platform', 'network', 'curl'), |