diff options
Diffstat (limited to 'WebKit/chromium/src')
39 files changed, 1000 insertions, 280 deletions
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(); |