diff options
author | Steve Block <steveblock@google.com> | 2010-07-08 12:51:48 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-07-09 15:33:40 +0100 |
commit | ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24 (patch) | |
tree | bb45155550ec013adc0ad10f4d7d354c6469b022 /WebKit/chromium/src | |
parent | d4b24d9a829ed7de70381c8b99fb75a07ab40466 (diff) | |
download | external_webkit-ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24.zip external_webkit-ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24.tar.gz external_webkit-ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24.tar.bz2 |
Merge WebKit at r62496: Initial merge by git
Change-Id: Ie3da0770eca22a70a632e3571f31cfabc80facb2
Diffstat (limited to 'WebKit/chromium/src')
30 files changed, 593 insertions, 920 deletions
diff --git a/WebKit/chromium/src/AssertMatchingEnums.cpp b/WebKit/chromium/src/AssertMatchingEnums.cpp index 819339d..5736ca0 100644 --- a/WebKit/chromium/src/AssertMatchingEnums.cpp +++ b/WebKit/chromium/src/AssertMatchingEnums.cpp @@ -181,6 +181,7 @@ COMPILE_ASSERT_MATCHING_ENUM(WebClipboard::FormatSmartPaste, PasteboardPrivate:: COMPILE_ASSERT_MATCHING_ENUM(WebClipboard::BufferStandard, PasteboardPrivate::StandardBuffer); COMPILE_ASSERT_MATCHING_ENUM(WebClipboard::BufferSelection, PasteboardPrivate::SelectionBuffer); +COMPILE_ASSERT_MATCHING_ENUM(WebClipboard::BufferDrag, PasteboardPrivate::DragBuffer); COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypePointer, PlatformCursor::TypePointer); COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeCross, PlatformCursor::TypeCross); diff --git a/WebKit/chromium/src/AutoFillPopupMenuClient.cpp b/WebKit/chromium/src/AutoFillPopupMenuClient.cpp index 04c02f2..1294561 100644 --- a/WebKit/chromium/src/AutoFillPopupMenuClient.cpp +++ b/WebKit/chromium/src/AutoFillPopupMenuClient.cpp @@ -31,7 +31,12 @@ #include "config.h" #include "AutoFillPopupMenuClient.h" +#include "CSSStyleSelector.h" +#include "CSSValueKeywords.h" +#include "Chrome.h" +#include "FrameView.h" #include "HTMLInputElement.h" +#include "RenderTheme.h" #include "WebNode.h" #include "WebString.h" #include "WebVector.h" @@ -42,6 +47,18 @@ using namespace WebCore; namespace WebKit { +AutoFillPopupMenuClient::AutoFillPopupMenuClient() + : m_separatorIndex(-1) + , m_selectedIndex(-1) + , m_textField(0) + , m_AutocompleteModeEnabled(false) +{ +} + +AutoFillPopupMenuClient::~AutoFillPopupMenuClient() +{ +} + unsigned AutoFillPopupMenuClient::getSuggestionsCount() const { return m_names.size() + ((m_separatorIndex == -1) ? 0 : 1); @@ -75,19 +92,35 @@ void AutoFillPopupMenuClient::removeSuggestionAtIndex(unsigned listIndex) void AutoFillPopupMenuClient::valueChanged(unsigned listIndex, bool fireEvents) { - WebViewImpl* webView = getWebView(); - if (!webView) - return; - - if (m_separatorIndex != -1 && listIndex > static_cast<unsigned>(m_separatorIndex)) - --listIndex; - - ASSERT(listIndex < m_names.size()); - - webView->client()->didAcceptAutoFillSuggestion(WebNode(getTextField()), - m_names[listIndex], - m_labels[listIndex], - listIndex); + // DEPRECATED: Will be removed once AutoFill and Autocomplete merge is + // completed. + if (m_AutocompleteModeEnabled) { + m_textField->setValue(getSuggestion(listIndex)); + + WebViewImpl* webView = getWebView(); + if (!webView) + return; + + EditorClientImpl* editor = + static_cast<EditorClientImpl*>(webView->page()->editorClient()); + ASSERT(editor); + editor->onAutocompleteSuggestionAccepted( + static_cast<HTMLInputElement*>(m_textField.get())); + } else { + WebViewImpl* webView = getWebView(); + if (!webView) + return; + + if (m_separatorIndex != -1 && listIndex > static_cast<unsigned>(m_separatorIndex)) + --listIndex; + + ASSERT(listIndex < m_names.size()); + + webView->client()->didAcceptAutoFillSuggestion(WebNode(getTextField()), + m_names[listIndex], + m_labels[listIndex], + listIndex); + } } void AutoFillPopupMenuClient::selectionChanged(unsigned listIndex, bool fireEvents) @@ -108,22 +141,52 @@ void AutoFillPopupMenuClient::selectionChanged(unsigned listIndex, bool fireEven void AutoFillPopupMenuClient::selectionCleared() { - WebViewImpl* webView = getWebView(); - if (!webView) - return; + // Same effect desired as popupDidHide, so call through. + popupDidHide(); +} - webView->suggestionsPopupDidHide(); - webView->client()->didClearAutoFillSelection(WebNode(getTextField())); +String AutoFillPopupMenuClient::itemText(unsigned listIndex) const +{ + return getSuggestion(listIndex); +} + +PopupMenuStyle AutoFillPopupMenuClient::itemStyle(unsigned listIndex) const +{ + return *m_style; +} + +PopupMenuStyle AutoFillPopupMenuClient::menuStyle() const +{ + return *m_style; +} + +int AutoFillPopupMenuClient::clientPaddingLeft() const +{ + // Bug http://crbug.com/7708 seems to indicate the style can be 0. + RenderStyle* style = textFieldStyle(); + if (!style) + return 0; + + return RenderTheme::defaultTheme()->popupInternalPaddingLeft(style); +} + +int AutoFillPopupMenuClient::clientPaddingRight() const +{ + // Bug http://crbug.com/7708 seems to indicate the style can be 0. + RenderStyle* style = textFieldStyle(); + if (!style) + return 0; + + return RenderTheme::defaultTheme()->popupInternalPaddingRight(style); } void AutoFillPopupMenuClient::popupDidHide() { - // FIXME: Refactor this method, as selectionCleared() and popupDidHide() - // share the exact same functionality. WebViewImpl* webView = getWebView(); if (!webView) return; + webView->autoFillPopupDidHide(); webView->client()->didClearAutoFillSelection(WebNode(getTextField())); } @@ -132,6 +195,29 @@ bool AutoFillPopupMenuClient::itemIsSeparator(unsigned listIndex) const return (m_separatorIndex != -1 && static_cast<unsigned>(m_separatorIndex) == listIndex); } +void AutoFillPopupMenuClient::setTextFromItem(unsigned listIndex) +{ + m_textField->setValue(getSuggestion(listIndex)); +} + +FontSelector* AutoFillPopupMenuClient::fontSelector() const +{ + return m_textField->document()->styleSelector()->fontSelector(); +} + +HostWindow* AutoFillPopupMenuClient::hostWindow() const +{ + return m_textField->document()->view()->hostWindow(); +} + +PassRefPtr<Scrollbar> AutoFillPopupMenuClient::createScrollbar( + ScrollbarClient* client, + ScrollbarOrientation orientation, + ScrollbarControlSize size) +{ + return Scrollbar::createNativeScrollbar(client, orientation, size); +} + void AutoFillPopupMenuClient::initialize( HTMLInputElement* textField, const WebVector<WebString>& names, @@ -141,11 +227,26 @@ void AutoFillPopupMenuClient::initialize( ASSERT(names.size() == labels.size()); ASSERT(separatorIndex < static_cast<int>(names.size())); + m_selectedIndex = -1; + m_textField = textField; + // The suggestions must be set before initializing the - // SuggestionsPopupMenuClient. + // AutoFillPopupMenuClient. setSuggestions(names, labels, separatorIndex); - SuggestionsPopupMenuClient::initialize(textField, -1); + FontDescription fontDescription; + RenderTheme::defaultTheme()->systemFont(CSSValueWebkitControl, + fontDescription); + RenderStyle* style = m_textField->computedStyle(); + fontDescription.setComputedSize(style->fontDescription().computedSize()); + + Font font(fontDescription, 0, 0); + font.update(textField->document()->styleSelector()->fontSelector()); + // The direction of text in popup menu is set the same as the direction of + // the input element: textField. + m_style.set(new PopupMenuStyle(Color::black, Color::white, font, true, + Length(WebCore::Fixed), + textField->renderer()->style()->direction())); } void AutoFillPopupMenuClient::setSuggestions(const WebVector<WebString>& names, @@ -169,4 +270,30 @@ void AutoFillPopupMenuClient::setSuggestions(const WebVector<WebString>& names, setSelectedIndex(-1); } +WebViewImpl* AutoFillPopupMenuClient::getWebView() const +{ + Frame* frame = m_textField->document()->frame(); + if (!frame) + return 0; + + Page* page = frame->page(); + if (!page) + return 0; + + return static_cast<ChromeClientImpl*>(page->chrome()->client())->webView(); +} + +RenderStyle* AutoFillPopupMenuClient::textFieldStyle() const +{ + RenderStyle* style = m_textField->computedStyle(); + if (!style) { + // It seems we can only have a 0 style in a TextField if the + // node is detached, in which case we the popup shoud not be + // showing. Please report this in http://crbug.com/7708 and + // include the page you were visiting. + ASSERT_NOT_REACHED(); + } + return style; +} + } // namespace WebKit diff --git a/WebKit/chromium/src/AutoFillPopupMenuClient.h b/WebKit/chromium/src/AutoFillPopupMenuClient.h index 488bdb1..a7d6693 100644 --- a/WebKit/chromium/src/AutoFillPopupMenuClient.h +++ b/WebKit/chromium/src/AutoFillPopupMenuClient.h @@ -31,31 +31,64 @@ #ifndef AutoFillPopupMenuClient_h #define AutoFillPopupMenuClient_h -#include "SuggestionsPopupMenuClient.h" +#include "PopupMenuClient.h" namespace WebCore { class HTMLInputElement; +class PopupMenuStyle; +class RenderStyle; } namespace WebKit { class WebString; +class WebViewImpl; template <typename T> class WebVector; // The AutoFill suggestions popup menu client, used to display name suggestions // with right-justified labels. -class AutoFillPopupMenuClient : public SuggestionsPopupMenuClient { +class AutoFillPopupMenuClient : public WebCore::PopupMenuClient { public: - // SuggestionsPopupMenuClient implementation: + AutoFillPopupMenuClient(); + virtual ~AutoFillPopupMenuClient(); + + // Returns the number of suggestions available. virtual unsigned getSuggestionsCount() const; + + // Returns the suggestion at |listIndex|. virtual WebString getSuggestion(unsigned listIndex) const; + + // Removes the suggestion at |listIndex| from the list of suggestions. virtual void removeSuggestionAtIndex(unsigned listIndex); - // WebCore::PopupMenuClient implementation: + // WebCore::PopupMenuClient methods: virtual void valueChanged(unsigned listIndex, bool fireEvents = true); - virtual void selectionChanged(unsigned listIndex, bool fireEvents = true); + virtual void selectionChanged(unsigned, bool); virtual void selectionCleared(); + virtual WebCore::String itemText(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; } + virtual WebCore::PopupMenuStyle itemStyle(unsigned listIndex) const; + virtual WebCore::PopupMenuStyle menuStyle() const; + virtual int clientInsetLeft() const { return 0; } + virtual int clientInsetRight() const { return 0; } + virtual int clientPaddingLeft() const; + virtual int clientPaddingRight() const; + virtual int listSize() const { return getSuggestionsCount(); } + virtual int selectedIndex() const { return m_selectedIndex; } virtual void popupDidHide(); virtual bool itemIsSeparator(unsigned listIndex) const; + virtual bool itemIsLabel(unsigned listIndex) const { return false; } + virtual bool itemIsSelected(unsigned listIndex) const { return false; } + virtual bool shouldPopOver() const { return false; } + virtual bool valueShouldChangeOnHotTrack() const { return false; } + virtual void setTextFromItem(unsigned listIndex); + virtual WebCore::FontSelector* fontSelector() const; + virtual WebCore::HostWindow* hostWindow() const; + virtual PassRefPtr<WebCore::Scrollbar> createScrollbar( + WebCore::ScrollbarClient* client, + WebCore::ScrollbarOrientation orientation, + WebCore::ScrollbarControlSize size); void initialize(WebCore::HTMLInputElement*, const WebVector<WebString>& names, @@ -66,12 +99,34 @@ public: const WebVector<WebString>& labels, int separatorIndex); + // DEPRECATED: Will be removed once Autocomplete and AutoFill merge is + // complete. + void setAutocompleteMode(bool enabled) { m_AutocompleteModeEnabled = enabled; } + private: + WebViewImpl* getWebView() const; + WebCore::HTMLInputElement* getTextField() const { return m_textField.get(); } + WebCore::RenderStyle* textFieldStyle() const; + + int getSelectedIndex() const { return m_selectedIndex; } + void setSelectedIndex(int index) { m_selectedIndex = index; } + + // The names and labels that make up the text of the menu items. Vector<WebCore::String> m_names; Vector<WebCore::String> m_labels; // The index of the separator. -1 if there is no separator. int m_separatorIndex; + + // The index of the selected item. -1 if there is no selected item. + int m_selectedIndex; + + RefPtr<WebCore::HTMLInputElement> m_textField; + OwnPtr<WebCore::PopupMenuStyle> m_style; + + // DEPRECATED: Will be removed once Autocomplete and AutoFill merge is + // complete. + bool m_AutocompleteModeEnabled; }; } // namespace WebKit diff --git a/WebKit/chromium/src/AutocompletePopupMenuClient.cpp b/WebKit/chromium/src/AutocompletePopupMenuClient.cpp deleted file mode 100644 index ed4f670..0000000 --- a/WebKit/chromium/src/AutocompletePopupMenuClient.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "AutocompletePopupMenuClient.h" - -#include "HTMLInputElement.h" -#include "WebString.h" -#include "WebVector.h" - -using namespace WebCore; - -namespace WebKit { - -unsigned AutocompletePopupMenuClient::getSuggestionsCount() const -{ - return m_suggestions.size(); -} - -WebString AutocompletePopupMenuClient::getSuggestion(unsigned listIndex) const -{ - ASSERT(listIndex < m_suggestions.size()); - return m_suggestions[listIndex]; -} - -void AutocompletePopupMenuClient::removeSuggestionAtIndex(unsigned listIndex) -{ - ASSERT(listIndex < m_suggestions.size()); - m_suggestions.remove(listIndex); -} - -void AutocompletePopupMenuClient::initialize( - HTMLInputElement* textField, - const WebVector<WebString>& suggestions, - int defaultSuggestionIndex) -{ - ASSERT(defaultSuggestionIndex < static_cast<int>(suggestions.size())); - - // The suggestions must be set before initializing the - // SuggestionsPopupMenuClient. - setSuggestions(suggestions); - - SuggestionsPopupMenuClient::initialize(textField, defaultSuggestionIndex); -} - -void AutocompletePopupMenuClient::setSuggestions(const WebVector<WebString>& suggestions) -{ - m_suggestions.clear(); - for (size_t i = 0; i < suggestions.size(); ++i) - m_suggestions.append(suggestions[i]); - - // Try to preserve selection if possible. - if (getSelectedIndex() >= static_cast<int>(suggestions.size())) - setSelectedIndex(-1); -} - -} // namespace WebKit diff --git a/WebKit/chromium/src/AutocompletePopupMenuClient.h b/WebKit/chromium/src/AutocompletePopupMenuClient.h deleted file mode 100644 index 16a3771..0000000 --- a/WebKit/chromium/src/AutocompletePopupMenuClient.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef AutocompletePopupMenuClient_h -#define AutocompletePopupMenuClient_h - -#include "SuggestionsPopupMenuClient.h" - -namespace WebCore { -class HTMLInputElement; -} - -namespace WebKit { -class WebString; -template <typename T> class WebVector; - -// The Autocomplete suggestions popup menu client, used to display a list of -// autocomplete suggestions. -class AutocompletePopupMenuClient : public SuggestionsPopupMenuClient { -public: - // SuggestionsPopupMenuClient implementation: - virtual unsigned getSuggestionsCount() const; - virtual WebString getSuggestion(unsigned listIndex) const; - virtual void removeSuggestionAtIndex(unsigned listIndex); - - void initialize(WebCore::HTMLInputElement*, - const WebVector<WebString>& suggestions, - int defaultSuggestionIndex); - - void setSuggestions(const WebVector<WebString>&); - -private: - Vector<WebCore::String> m_suggestions; -}; - -} // namespace WebKit - -#endif diff --git a/WebKit/chromium/src/ChromiumBridge.cpp b/WebKit/chromium/src/ChromiumBridge.cpp index 4963f78..5124a7f 100644 --- a/WebKit/chromium/src/ChromiumBridge.cpp +++ b/WebKit/chromium/src/ChromiumBridge.cpp @@ -40,6 +40,7 @@ #include "WebCookieJar.h" #include "WebCursorInfo.h" #include "WebData.h" +#include "WebDragData.h" #include "WebFileSystem.h" #include "WebFrameClient.h" #include "WebFrameImpl.h" @@ -197,6 +198,48 @@ void ChromiumBridge::clipboardWriteImage(NativeImagePtr image, webKitClient()->clipboard()->writeImage(webImage, sourceURL, title); } +void ChromiumBridge::clipboardWriteData(ClipboardData* data) +{ + notImplemented(); + WebDragData dragData; // FIXME: Define the conversion from ClipboardData to WebDragData. + webKitClient()->clipboard()->writeData(dragData); +} + +HashSet<String> ChromiumBridge::clipboardReadAvailableTypes( + PasteboardPrivate::ClipboardBuffer buffer, bool* containsFilenames) +{ + WebVector<WebString> result = webKitClient()->clipboard()->readAvailableTypes( + static_cast<WebClipboard::Buffer>(buffer), containsFilenames); + HashSet<String> types; + for (size_t i = 0; i < result.size(); ++i) + types.add(result[i]); + return types; +} + +bool ChromiumBridge::clipboardReadData(PasteboardPrivate::ClipboardBuffer buffer, + const String& type, String& data, String& metadata) +{ + WebString resultData; + WebString resultMetadata; + bool succeeded = webKitClient()->clipboard()->readData( + static_cast<WebClipboard::Buffer>(buffer), type, &resultData, &resultMetadata); + if (succeeded) { + data = resultData; + metadata = resultMetadata; + } + return succeeded; +} + +Vector<String> ChromiumBridge::clipboardReadFilenames(PasteboardPrivate::ClipboardBuffer buffer) +{ + WebVector<WebString> result = webKitClient()->clipboard()->readFilenames( + static_cast<WebClipboard::Buffer>(buffer)); + Vector<String> convertedResult; + for (size_t i = 0; i < result.size(); ++i) + convertedResult.append(result[i]); + return convertedResult; +} + // Cookies -------------------------------------------------------------------- void ChromiumBridge::setCookies(const Document* document, const KURL& url, diff --git a/WebKit/chromium/src/ContextMenuClientImpl.cpp b/WebKit/chromium/src/ContextMenuClientImpl.cpp index 8dd3393..f757d9c 100644 --- a/WebKit/chromium/src/ContextMenuClientImpl.cpp +++ b/WebKit/chromium/src/ContextMenuClientImpl.cpp @@ -46,6 +46,7 @@ #include "KURL.h" #include "MediaError.h" #include "PlatformString.h" +#include "RenderWidget.h" #include "TextBreakIterator.h" #include "Widget.h" @@ -53,6 +54,7 @@ #include "WebDataSourceImpl.h" #include "WebFrameImpl.h" #include "WebMenuItemInfo.h" +#include "WebPluginContainerImpl.h" #include "WebPoint.h" #include "WebString.h" #include "WebURL.h" @@ -147,6 +149,24 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems( WebContextMenuData data; data.mousePosition = selectedFrame->view()->contentsToWindow(r.point()); + // Compute edit flags. + data.editFlags = WebContextMenuData::CanDoNone; + if (m_webView->focusedWebCoreFrame()->editor()->canUndo()) + data.editFlags |= WebContextMenuData::CanUndo; + if (m_webView->focusedWebCoreFrame()->editor()->canRedo()) + data.editFlags |= WebContextMenuData::CanRedo; + if (m_webView->focusedWebCoreFrame()->editor()->canCut()) + data.editFlags |= WebContextMenuData::CanCut; + if (m_webView->focusedWebCoreFrame()->editor()->canCopy()) + data.editFlags |= WebContextMenuData::CanCopy; + if (m_webView->focusedWebCoreFrame()->editor()->canPaste()) + data.editFlags |= WebContextMenuData::CanPaste; + if (m_webView->focusedWebCoreFrame()->editor()->canDelete()) + data.editFlags |= WebContextMenuData::CanDelete; + // We can always select all... + data.editFlags |= WebContextMenuData::CanSelectAll; + data.editFlags |= WebContextMenuData::CanTranslate; + // Links, Images, Media tags, and Image/Media-Links take preference over // all else. data.linkURL = r.absoluteLinkURL(); @@ -182,6 +202,21 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems( data.mediaFlags |= WebContextMenuData::MediaHasVideo; if (mediaElement->controls()) data.mediaFlags |= WebContextMenuData::MediaControls; + } else if (r.innerNonSharedNode()->hasTagName(HTMLNames::objectTag) + || r.innerNonSharedNode()->hasTagName(HTMLNames::embedTag)) { + RenderObject* object = r.innerNonSharedNode()->renderer(); + if (object && object->isWidget()) { + Widget* widget = toRenderWidget(object)->widget(); + if (widget) { + WebPluginContainerImpl* plugin = static_cast<WebPluginContainerImpl*>(widget); + WebString text = plugin->selectedText(); + if (!text.isEmpty()) { + data.selectedText = text; + data.editFlags |= WebContextMenuData::CanCopy; + } + data.editFlags &= ~WebContextMenuData::CanTranslate; + } + } } data.isImageBlocked = @@ -226,23 +261,6 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems( if (ds) data.securityInfo = ds->response().securityInfo(); - // Compute edit flags. - data.editFlags = WebContextMenuData::CanDoNone; - if (m_webView->focusedWebCoreFrame()->editor()->canUndo()) - data.editFlags |= WebContextMenuData::CanUndo; - if (m_webView->focusedWebCoreFrame()->editor()->canRedo()) - data.editFlags |= WebContextMenuData::CanRedo; - if (m_webView->focusedWebCoreFrame()->editor()->canCut()) - data.editFlags |= WebContextMenuData::CanCut; - if (m_webView->focusedWebCoreFrame()->editor()->canCopy()) - data.editFlags |= WebContextMenuData::CanCopy; - if (m_webView->focusedWebCoreFrame()->editor()->canPaste()) - data.editFlags |= WebContextMenuData::CanPaste; - if (m_webView->focusedWebCoreFrame()->editor()->canDelete()) - data.editFlags |= WebContextMenuData::CanDelete; - // We can always select all... - data.editFlags |= WebContextMenuData::CanSelectAll; - // Filter out custom menu elements and add them into the data. populateCustomMenuItems(defaultMenu, &data); diff --git a/WebKit/chromium/src/EditorClientImpl.cpp b/WebKit/chromium/src/EditorClientImpl.cpp index 2a40d78..864988a 100644 --- a/WebKit/chromium/src/EditorClientImpl.cpp +++ b/WebKit/chromium/src/EditorClientImpl.cpp @@ -658,7 +658,7 @@ void EditorClientImpl::textFieldDidEndEditing(Element* element) m_autofillTimer.stop(); // Hide any showing popup. - m_webView->hideSuggestionsPopup(); + m_webView->hideAutoFillPopup(); if (!m_webView->client()) return; // The page is getting closed, don't fill the password. @@ -754,7 +754,7 @@ void EditorClientImpl::doAutofill(Timer<EditorClientImpl>* timer) && inputElement->selectionEnd() == static_cast<int>(value.length()); if ((!args->autofillOnEmptyValue && value.isEmpty()) || !isCaretAtEnd) { - m_webView->hideSuggestionsPopup(); + m_webView->hideAutoFillPopup(); return; } @@ -796,11 +796,7 @@ void EditorClientImpl::onAutocompleteSuggestionAccepted(HTMLInputElement* textFi if (!webframe) return; - WebPasswordAutocompleteListener* listener = webframe->getPasswordListener(textField); - // Password listeners need to autocomplete other fields that depend on the - // input element with autofill suggestions. - if (listener) - listener->performInlineAutocomplete(textField->value(), false, false); + webframe->notifiyPasswordListenerOfAutocomplete(WebInputElement(textField)); } bool EditorClientImpl::doTextFieldCommandFromEvent(Element* element, @@ -921,13 +917,8 @@ void EditorClientImpl::getGuessesForWord(const String&, void EditorClientImpl::setInputMethodState(bool enabled) { - if (m_webView->client()) { + if (m_webView->client()) m_webView->client()->resetInputMethod(); - - // Remove this line when WebViewClient::setInputMethodEnabled() gets - // removed. - m_webView->client()->setInputMethodEnabled(enabled); - } } } // namesace WebKit diff --git a/WebKit/chromium/src/GraphicsContext3D.cpp b/WebKit/chromium/src/GraphicsContext3D.cpp index 0681675..7ba0bce 100644 --- a/WebKit/chromium/src/GraphicsContext3D.cpp +++ b/WebKit/chromium/src/GraphicsContext3D.cpp @@ -35,6 +35,8 @@ #include "GraphicsContext3D.h" #include "CachedImage.h" +#include "Chrome.h" +#include "ChromeClientImpl.h" #include "HTMLCanvasElement.h" #include "HTMLImageElement.h" #include "ImageBuffer.h" @@ -50,10 +52,12 @@ #include "WebGLShader.h" #include "WebGLTexture.h" #include "Uint8Array.h" +#include "WebGLLayerChromium.h" #include "WebGraphicsContext3D.h" #include "WebGraphicsContext3DDefaultImpl.h" #include "WebKit.h" #include "WebKitClient.h" +#include "WebViewImpl.h" #include <stdio.h> #include <wtf/FastMalloc.h> @@ -97,7 +101,7 @@ public: GraphicsContext3DInternal(); ~GraphicsContext3DInternal(); - bool initialize(GraphicsContext3D::Attributes attrs); + bool initialize(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow); PlatformGraphicsContext3D platformGraphicsContext3D() const; Platform3DObject platformTexture() const; @@ -111,6 +115,11 @@ public: void beginPaint(WebGLRenderingContext* context); void endPaint(); + void prepareTexture(); + +#if USE(ACCELERATED_COMPOSITING) + WebGLLayerChromium* platformLayer() const; +#endif bool isGLES2Compliant() const; //---------------------------------------------------------------------- @@ -165,6 +174,8 @@ public: bool getActiveAttrib(WebGLProgram* program, unsigned long index, ActiveInfo&); bool getActiveUniform(WebGLProgram* program, unsigned long index, ActiveInfo&); + void getAttachedShaders(WebGLProgram* program, int maxCount, int* count, unsigned int* shaders); + int getAttribLocation(WebGLProgram*, const String& name); void getBooleanv(unsigned long pname, unsigned char* value); @@ -297,6 +308,9 @@ public: private: OwnPtr<WebKit::WebGraphicsContext3D> m_impl; +#if USE(ACCELERATED_COMPOSITING) + RefPtr<WebGLLayerChromium> m_compositingLayer; +#endif #if PLATFORM(SKIA) // If the width and height of the Canvas's backing store don't // match those that we were given in the most recent call to @@ -329,7 +343,8 @@ GraphicsContext3DInternal::~GraphicsContext3DInternal() #endif } -bool GraphicsContext3DInternal::initialize(GraphicsContext3D::Attributes attrs) +bool GraphicsContext3DInternal::initialize(GraphicsContext3D::Attributes attrs, + HostWindow* hostWindow) { WebKit::WebGraphicsContext3D::Attributes webAttributes; webAttributes.alpha = attrs.alpha; @@ -340,23 +355,47 @@ bool GraphicsContext3DInternal::initialize(GraphicsContext3D::Attributes attrs) WebKit::WebGraphicsContext3D* webContext = WebKit::webKitClient()->createGraphicsContext3D(); if (!webContext) return false; - if (!webContext->initialize(webAttributes)) { + + Chrome* chrome = static_cast<Chrome*>(hostWindow); + WebKit::ChromeClientImpl* chromeClientImpl = static_cast<WebKit::ChromeClientImpl*>(chrome->client()); + + WebKit::WebViewImpl* webView = chromeClientImpl->webView(); + + if (!webView) + return false; + if (!webContext->initialize(webAttributes, webView)) { delete webContext; return false; } m_impl.set(webContext); + +#if USE(ACCELERATED_COMPOSITING) + m_compositingLayer = WebGLLayerChromium::create(0); +#endif return true; } PlatformGraphicsContext3D GraphicsContext3DInternal::platformGraphicsContext3D() const { - return 0; + return m_impl.get(); } Platform3DObject GraphicsContext3DInternal::platformTexture() const { - return 0; + return m_impl->getPlatformTextureId(); +} + +void GraphicsContext3DInternal::prepareTexture() +{ + m_impl->prepareTexture(); +} + +#if USE(ACCELERATED_COMPOSITING) +WebGLLayerChromium* GraphicsContext3DInternal::platformLayer() const +{ + return m_compositingLayer.get(); } +#endif void GraphicsContext3DInternal::beginPaint(WebGLRenderingContext* context) { @@ -556,6 +595,12 @@ void GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3, t4 a4) \ m_impl->name(a1, a2, a3, a4); \ } +#define DELEGATE_TO_IMPL_4_X1(name, t1, t2, t3, t4) \ +void GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3, t4 a4) \ +{ \ + m_impl->name(EXTRACT(a1), a2, a3, a4); \ +} + #define DELEGATE_TO_IMPL_4_X4(name, t1, t2, t3, t4) \ void GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3, t4 a4) \ { \ @@ -734,6 +779,8 @@ bool GraphicsContext3DInternal::getActiveUniform(WebGLProgram* program, unsigned return true; } +DELEGATE_TO_IMPL_4_X1(getAttachedShaders, WebGLProgram*, int, int*, unsigned int*) + int GraphicsContext3DInternal::getAttribLocation(WebGLProgram* program, const String& name) { return m_impl->getAttribLocation(EXTRACT(program), name.utf8().data()); @@ -1066,7 +1113,7 @@ GraphicsContext3D::~GraphicsContext3D() PassOwnPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow) { GraphicsContext3DInternal* internal = new GraphicsContext3DInternal(); - if (!internal->initialize(attrs)) { + if (!internal->initialize(attrs, hostWindow)) { delete internal; return 0; } @@ -1085,6 +1132,20 @@ Platform3DObject GraphicsContext3D::platformTexture() const return m_internal->platformTexture(); } +void GraphicsContext3D::prepareTexture() +{ + return m_internal->prepareTexture(); +} + +#if USE(ACCELERATED_COMPOSITING) +PlatformLayer* GraphicsContext3D::platformLayer() const +{ + WebGLLayerChromium* webGLLayer = m_internal->platformLayer(); + webGLLayer->setContext(this); + return webGLLayer; +} +#endif + DELEGATE_TO_INTERNAL(makeContextCurrent) DELEGATE_TO_INTERNAL_1R(sizeInBytes, int, int) DELEGATE_TO_INTERNAL_2(reshape, int, int) @@ -1139,6 +1200,8 @@ DELEGATE_TO_INTERNAL_1(generateMipmap, unsigned long) DELEGATE_TO_INTERNAL_3R(getActiveAttrib, WebGLProgram*, unsigned long, ActiveInfo&, bool) DELEGATE_TO_INTERNAL_3R(getActiveUniform, WebGLProgram*, unsigned long, ActiveInfo&, bool) +DELEGATE_TO_INTERNAL_4(getAttachedShaders, WebGLProgram*, int, int*, unsigned int*) + DELEGATE_TO_INTERNAL_2R(getAttribLocation, WebGLProgram*, const String&, int) DELEGATE_TO_INTERNAL_2(getBooleanv, unsigned long, unsigned char*) diff --git a/WebKit/chromium/src/IDBCallbacksProxy.cpp b/WebKit/chromium/src/IDBCallbacksProxy.cpp index 42be08d..7a6571a 100644 --- a/WebKit/chromium/src/IDBCallbacksProxy.cpp +++ b/WebKit/chromium/src/IDBCallbacksProxy.cpp @@ -80,6 +80,11 @@ void IDBCallbacksProxy::onSuccess(PassRefPtr<IDBIndex> idbIndex) m_callbacks.clear(); } +void IDBCallbacksProxy::onSuccess(PassRefPtr<IDBKey> idbKey) +{ + ASSERT_NOT_REACHED(); +} + void IDBCallbacksProxy::onSuccess(PassRefPtr<IDBObjectStore> idbObjectStore) { m_callbacks->onSuccess(new WebKit::WebIDBObjectStoreImpl(idbObjectStore)); diff --git a/WebKit/chromium/src/IDBCallbacksProxy.h b/WebKit/chromium/src/IDBCallbacksProxy.h index 8f2da28..fc424f8 100644 --- a/WebKit/chromium/src/IDBCallbacksProxy.h +++ b/WebKit/chromium/src/IDBCallbacksProxy.h @@ -56,6 +56,7 @@ public: virtual void onSuccess(); // For "null". virtual void onSuccess(PassRefPtr<IDBDatabase>); virtual void onSuccess(PassRefPtr<IDBIndex>); + virtual void onSuccess(PassRefPtr<IDBKey>); virtual void onSuccess(PassRefPtr<IDBObjectStore>); virtual void onSuccess(PassRefPtr<SerializedScriptValue>); diff --git a/WebKit/chromium/src/SuggestionsPopupMenuClient.cpp b/WebKit/chromium/src/SuggestionsPopupMenuClient.cpp deleted file mode 100644 index dd7d9b8..0000000 --- a/WebKit/chromium/src/SuggestionsPopupMenuClient.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "SuggestionsPopupMenuClient.h" - -#include "CSSStyleSelector.h" -#include "CSSValueKeywords.h" -#include "Chrome.h" -#include "FrameView.h" -#include "HTMLInputElement.h" -#include "RenderTheme.h" -#include "WebViewImpl.h" - -using namespace WebCore; - -namespace WebKit { - -SuggestionsPopupMenuClient::SuggestionsPopupMenuClient() - : m_textField(0) - , m_selectedIndex(0) -{ -} - -SuggestionsPopupMenuClient::~SuggestionsPopupMenuClient() -{ -} - -// FIXME: Implement this per-derived class? -void SuggestionsPopupMenuClient::valueChanged(unsigned listIndex, bool fireEvents) -{ - m_textField->setValue(getSuggestion(listIndex)); - - WebViewImpl* webView = getWebView(); - if (!webView) - return; - - EditorClientImpl* editor = - static_cast<EditorClientImpl*>(webView->page()->editorClient()); - ASSERT(editor); - editor->onAutocompleteSuggestionAccepted( - static_cast<HTMLInputElement*>(m_textField.get())); -} - -String SuggestionsPopupMenuClient::itemText(unsigned listIndex) const -{ - return getSuggestion(listIndex); -} - -PopupMenuStyle SuggestionsPopupMenuClient::itemStyle(unsigned listIndex) const -{ - return *m_style; -} - -PopupMenuStyle SuggestionsPopupMenuClient::menuStyle() const -{ - return *m_style; -} - -int SuggestionsPopupMenuClient::clientPaddingLeft() const -{ - // Bug http://crbug.com/7708 seems to indicate the style can be 0. - RenderStyle* style = textFieldStyle(); - if (!style) - return 0; - - return RenderTheme::defaultTheme()->popupInternalPaddingLeft(style); -} - -int SuggestionsPopupMenuClient::clientPaddingRight() const -{ - // Bug http://crbug.com/7708 seems to indicate the style can be 0. - RenderStyle* style = textFieldStyle(); - if (!style) - return 0; - - return RenderTheme::defaultTheme()->popupInternalPaddingRight(style); -} - -void SuggestionsPopupMenuClient::popupDidHide() -{ - WebViewImpl* webView = getWebView(); - if (webView) - webView->suggestionsPopupDidHide(); -} - -void SuggestionsPopupMenuClient::setTextFromItem(unsigned listIndex) -{ - m_textField->setValue(getSuggestion(listIndex)); -} - -FontSelector* SuggestionsPopupMenuClient::fontSelector() const -{ - return m_textField->document()->styleSelector()->fontSelector(); -} - -HostWindow* SuggestionsPopupMenuClient::hostWindow() const -{ - return m_textField->document()->view()->hostWindow(); -} - -PassRefPtr<Scrollbar> SuggestionsPopupMenuClient::createScrollbar( - ScrollbarClient* client, - ScrollbarOrientation orientation, - ScrollbarControlSize size) -{ - return Scrollbar::createNativeScrollbar(client, orientation, size); -} - -RenderStyle* SuggestionsPopupMenuClient::textFieldStyle() const -{ - RenderStyle* style = m_textField->computedStyle(); - if (!style) { - // It seems we can only have a 0 style in a TextField if the - // node is detached, in which case we the popup shoud not be - // showing. Please report this in http://crbug.com/7708 and - // include the page you were visiting. - ASSERT_NOT_REACHED(); - } - return style; -} - -void SuggestionsPopupMenuClient::initialize(HTMLInputElement* textField, - int defaultSuggestionIndex) -{ - m_textField = textField; - m_selectedIndex = defaultSuggestionIndex; - - FontDescription fontDescription; - RenderTheme::defaultTheme()->systemFont(CSSValueWebkitControl, - fontDescription); - RenderStyle* style = m_textField->computedStyle(); - fontDescription.setComputedSize(style->fontDescription().computedSize()); - - Font font(fontDescription, 0, 0); - font.update(textField->document()->styleSelector()->fontSelector()); - // The direction of text in popup menu is set the same as the direction of - // the input element: textField. - m_style.set(new PopupMenuStyle(Color::black, Color::white, font, true, - Length(WebCore::Fixed), - textField->renderer()->style()->direction())); -} - -WebViewImpl* SuggestionsPopupMenuClient::getWebView() const -{ - Frame* frame = m_textField->document()->frame(); - if (!frame) - return 0; - - Page* page = frame->page(); - if (!page) - return 0; - - return static_cast<ChromeClientImpl*>(page->chrome()->client())->webView(); -} - -} // namespace WebKit diff --git a/WebKit/chromium/src/SuggestionsPopupMenuClient.h b/WebKit/chromium/src/SuggestionsPopupMenuClient.h deleted file mode 100644 index 7717593..0000000 --- a/WebKit/chromium/src/SuggestionsPopupMenuClient.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "PopupMenuClient.h" - -#ifndef SuggestionsPopupMenuClient_h -#define SuggestionsPopupMenuClient_h - -namespace WebCore { -class HTMLInputElement; -class PopupMenuStyle; -class RenderStyle; -} - -namespace WebKit { -class WebString; -class WebViewImpl; -template <typename T> class WebVector; - -// The Suggestions popup menu client, used to display a list of suggestions. -class SuggestionsPopupMenuClient : public WebCore::PopupMenuClient { -public: - SuggestionsPopupMenuClient(); - virtual ~SuggestionsPopupMenuClient(); - - // Returns the number of suggestions available. - virtual unsigned getSuggestionsCount() const = 0; - - // Returns the suggestion at |listIndex|. - virtual WebString getSuggestion(unsigned listIndex) const = 0; - - // Removes the suggestion at |listIndex| from the list of suggestions. - virtual void removeSuggestionAtIndex(unsigned listIndex) = 0; - - // WebCore::PopupMenuClient methods: - virtual void valueChanged(unsigned listIndex, bool fireEvents = true); - virtual void selectionChanged(unsigned, bool) {} - virtual void selectionCleared() {} - virtual WebCore::String itemText(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; } - virtual WebCore::PopupMenuStyle itemStyle(unsigned listIndex) const; - virtual WebCore::PopupMenuStyle menuStyle() const; - virtual int clientInsetLeft() const { return 0; } - virtual int clientInsetRight() const { return 0; } - virtual int clientPaddingLeft() const; - virtual int clientPaddingRight() const; - virtual int listSize() const { return getSuggestionsCount(); } - virtual int selectedIndex() const { return m_selectedIndex; } - virtual void popupDidHide(); - virtual bool itemIsSeparator(unsigned listIndex) const { return false; } - virtual bool itemIsLabel(unsigned listIndex) const { return false; } - virtual bool itemIsSelected(unsigned listIndex) const { return false; } - virtual bool shouldPopOver() const { return false; } - virtual bool valueShouldChangeOnHotTrack() const { return false; } - virtual void setTextFromItem(unsigned listIndex); - virtual WebCore::FontSelector* fontSelector() const; - virtual WebCore::HostWindow* hostWindow() const; - virtual PassRefPtr<WebCore::Scrollbar> createScrollbar( - WebCore::ScrollbarClient* client, - WebCore::ScrollbarOrientation orientation, - WebCore::ScrollbarControlSize size); - -protected: - void initialize(WebCore::HTMLInputElement* textField, - int defaultSuggestionIndex); - - int getSelectedIndex() const { return m_selectedIndex; } - void setSelectedIndex(int index) { m_selectedIndex = index; } - - WebViewImpl* getWebView() const; - WebCore::HTMLInputElement* getTextField() const { return m_textField.get(); } - -private: - WebCore::RenderStyle* textFieldStyle() const; - - RefPtr<WebCore::HTMLInputElement> m_textField; - int m_selectedIndex; - OwnPtr<WebCore::PopupMenuStyle> m_style; -}; - -} // namespace WebKit - -#endif diff --git a/WebKit/chromium/src/WebBindings.cpp b/WebKit/chromium/src/WebBindings.cpp index 2b20c0a..3aaebfd 100644 --- a/WebKit/chromium/src/WebBindings.cpp +++ b/WebKit/chromium/src/WebBindings.cpp @@ -45,6 +45,7 @@ #include "V8DOMWrapper.h" #include "V8Event.h" #include "V8Helpers.h" +#include "V8HiddenPropertyName.h" #include "V8NPUtils.h" #include "V8Proxy.h" #include "V8Range.h" @@ -208,8 +209,7 @@ void WebBindings::extractIdentifierData(const NPIdentifier& identifier, const NP static v8::Local<v8::Value> getEvent(const v8::Handle<v8::Context>& context) { - static v8::Persistent<v8::String> eventSymbol(v8::Persistent<v8::String>::New(v8::String::NewSymbol("event"))); - return context->Global()->GetHiddenValue(eventSymbol); + return context->Global()->GetHiddenValue(V8HiddenPropertyName::event()); } static bool getDragDataImpl(NPObject* npobj, int* eventId, WebDragData* data) diff --git a/WebKit/chromium/src/WebDatabase.cpp b/WebKit/chromium/src/WebDatabase.cpp index 376509d..89522f1 100644 --- a/WebKit/chromium/src/WebDatabase.cpp +++ b/WebKit/chromium/src/WebDatabase.cpp @@ -32,11 +32,7 @@ #include "WebDatabase.h" #include "AbstractDatabase.h" -#include "DatabaseTask.h" -#include "DatabaseThread.h" #include "DatabaseTracker.h" -#include "Document.h" -#include "KURL.h" #include "QuotaTracker.h" #include "SecurityOrigin.h" #include "WebDatabaseObserver.h" @@ -50,44 +46,28 @@ namespace WebKit { static WebDatabaseObserver* databaseObserver = 0; -class WebDatabasePrivate : public AbstractDatabase { -}; - -void WebDatabase::reset() -{ - assign(0); -} - -void WebDatabase::assign(const WebDatabase& other) -{ - WebDatabasePrivate* d = const_cast<WebDatabasePrivate*>(other.m_private); - if (d) - d->ref(); - assign(d); -} - WebString WebDatabase::name() const { - ASSERT(m_private); - return m_private->stringIdentifier(); + ASSERT(m_database); + return m_database->stringIdentifier(); } WebString WebDatabase::displayName() const { - ASSERT(m_private); - return m_private->displayName(); + ASSERT(m_database); + return m_database->displayName(); } unsigned long WebDatabase::estimatedSize() const { - ASSERT(m_private); - return m_private->estimatedSize(); + ASSERT(m_database); + return m_database->estimatedSize(); } WebSecurityOrigin WebDatabase::securityOrigin() const { - ASSERT(m_private); - return WebSecurityOrigin(m_private->securityOrigin()); + ASSERT(m_database); + return WebSecurityOrigin(m_database->securityOrigin()); } void WebDatabase::setObserver(WebDatabaseObserver* observer) @@ -117,28 +97,9 @@ void WebDatabase::closeDatabaseImmediately(const WebString& originIdentifier, co it->get()->closeImmediately(); } -WebDatabase::WebDatabase(const WTF::PassRefPtr<AbstractDatabase>& database) - : m_private(static_cast<WebDatabasePrivate*>(database.releaseRef())) -{ -} - -WebDatabase& WebDatabase::operator=(const WTF::PassRefPtr<AbstractDatabase>& database) -{ - assign(static_cast<WebDatabasePrivate*>(database.releaseRef())); - return *this; -} - -WebDatabase::operator WTF::PassRefPtr<AbstractDatabase>() const -{ - return PassRefPtr<AbstractDatabase>(const_cast<WebDatabasePrivate*>(m_private)); -} - -void WebDatabase::assign(WebDatabasePrivate* d) +WebDatabase::WebDatabase(const AbstractDatabase* database) + : m_database(database) { - // d is already ref'd for us by the caller - if (m_private) - m_private->deref(); - m_private = d; } } // namespace WebKit diff --git a/WebKit/chromium/src/WebDevToolsAgentImpl.cpp b/WebKit/chromium/src/WebDevToolsAgentImpl.cpp index c0e9b44..20ab1d3 100644 --- a/WebKit/chromium/src/WebDevToolsAgentImpl.cpp +++ b/WebKit/chromium/src/WebDevToolsAgentImpl.cpp @@ -643,11 +643,6 @@ void WebDevToolsAgentImpl::setTimelineProfilingEnabled(bool enabled) ic->stopTimelineProfiler(); } -WebDevToolsAgent* WebDevToolsAgent::create(WebView* webview, WebDevToolsAgentClient* client) -{ - return new WebDevToolsAgentImpl(static_cast<WebViewImpl*>(webview), client); -} - void WebDevToolsAgent::executeDebuggerCommand(const WebString& command, int callerId) { DebuggerAgentManager::executeDebuggerCommand(command, callerId); diff --git a/WebKit/chromium/src/WebFrameImpl.cpp b/WebKit/chromium/src/WebFrameImpl.cpp index c5fa1fe..ff4883e 100644 --- a/WebKit/chromium/src/WebFrameImpl.cpp +++ b/WebKit/chromium/src/WebFrameImpl.cpp @@ -962,7 +962,7 @@ WebHistoryItem WebFrameImpl::previousHistoryItem() const WebHistoryItem WebFrameImpl::currentHistoryItem() const { // If we are still loading, then we don't want to clobber the current - // history item as this could cause us to lose the scroll position and + // history item as this could cause us to lose the scroll position and // document state. However, it is OK for new navigations. if (m_frame->loader()->loadType() == FrameLoadTypeStandard || !m_frame->loader()->activeDocumentLoader()->isLoadingInAPISense()) @@ -1284,14 +1284,21 @@ bool WebFrameImpl::isPageBoxVisible(int pageIndex) return frame()->document()->isPageBoxVisible(pageIndex); } -WebRect WebFrameImpl::pageAreaRectInPixels(int pageIndex) +void WebFrameImpl::pageSizeAndMarginsInPixels(int pageIndex, + WebSize& pageSize, + int& marginTop, + int& marginRight, + int& marginBottom, + int& marginLeft) { - return frame()->document()->pageAreaRectInPixels(pageIndex); -} - -WebSize WebFrameImpl::preferredPageSizeInPixels(int pageIndex) -{ - return frame()->document()->preferredPageSizeInPixels(pageIndex); + IntSize size(pageSize.width, pageSize.height); + frame()->document()->pageSizeAndMarginsInPixels(pageIndex, + size, + marginTop, + marginRight, + marginBottom, + marginLeft); + pageSize = size; } bool WebFrameImpl::find(int identifier, @@ -1961,6 +1968,17 @@ bool WebFrameImpl::registerPasswordListener( return true; } +void WebFrameImpl::notifiyPasswordListenerOfAutocomplete( + const WebInputElement& inputElement) +{ + RefPtr<HTMLInputElement> element = inputElement.operator PassRefPtr<HTMLInputElement>(); + WebPasswordAutocompleteListener* listener = getPasswordListener(element.get()); + // Password listeners need to autocomplete other fields that depend on the + // input element with autofill suggestions. + if (listener) + listener->performInlineAutocomplete(element->value(), false, false); +} + WebPasswordAutocompleteListener* WebFrameImpl::getPasswordListener( HTMLInputElement* inputElement) { diff --git a/WebKit/chromium/src/WebFrameImpl.h b/WebKit/chromium/src/WebFrameImpl.h index c14ad9b..aa1edd6 100644 --- a/WebKit/chromium/src/WebFrameImpl.h +++ b/WebKit/chromium/src/WebFrameImpl.h @@ -150,8 +150,12 @@ public: virtual float getPrintPageShrink(int page); virtual void printEnd(); virtual bool isPageBoxVisible(int pageIndex); - virtual WebRect pageAreaRectInPixels(int pageIndex); - virtual WebSize preferredPageSizeInPixels(int pageIndex); + virtual void pageSizeAndMarginsInPixels(int pageIndex, + WebSize& pageSize, + int& marginTop, + int& marginRight, + int& marginBottom, + int& marginLeft); virtual bool find( int identifier, const WebString& searchText, const WebFindOptions&, bool wrapWithinFrame, WebRect* selectionRect); @@ -164,6 +168,8 @@ public: virtual void resetMatchCount(); virtual bool registerPasswordListener( WebInputElement, WebPasswordAutocompleteListener*); + virtual void notifiyPasswordListenerOfAutocomplete( + const WebInputElement&); virtual WebString contentAsText(size_t maxChars) const; virtual WebString contentAsMarkup() const; diff --git a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp index b23dc35..0863ec8 100644 --- a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp +++ b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp @@ -173,8 +173,8 @@ WebGraphicsContext3DDefaultImpl::~WebGraphicsContext3DDefaultImpl() glDeleteFramebuffersEXT(1, &m_fbo); #endif // !RENDER_TO_DEBUGGING_WINDOW #if OS(WINDOWS) - wglMakeCurrent(0, 0); - wglDeleteContext(m_contextObj); + wglewMakeCurrent(0, 0); + wglewDeleteContext(m_contextObj); ReleaseDC(m_canvasWindow, m_canvasDC); DestroyWindow(m_canvasWindow); #elif PLATFORM(CG) @@ -194,9 +194,17 @@ WebGraphicsContext3DDefaultImpl::~WebGraphicsContext3DDefaultImpl() } } -bool WebGraphicsContext3DDefaultImpl::initialize(WebGraphicsContext3D::Attributes attributes) +bool WebGraphicsContext3DDefaultImpl::initialize(WebGraphicsContext3D::Attributes attributes, WebView* webView) { #if OS(WINDOWS) + if (!s_initializedGLEW) { + // Do this only the first time through. + if (!wglewInit()) { + printf("WebGraphicsContext3DDefaultImpl: wglewInit failed\n"); + return false; + } + } + WNDCLASS wc; if (!GetClassInfo(GetModuleHandle(0), L"CANVASGL", &wc)) { ZeroMemory(&wc, sizeof(WNDCLASS)); @@ -246,13 +254,13 @@ bool WebGraphicsContext3DDefaultImpl::initialize(WebGraphicsContext3D::Attribute } // create rendering context - m_contextObj = wglCreateContext(m_canvasDC); + m_contextObj = wglewCreateContext(m_canvasDC); if (!m_contextObj) { printf("WebGraphicsContext3DDefaultImpl: wglCreateContext failed\n"); return false; } - if (!wglMakeCurrent(m_canvasDC, m_contextObj)) { + if (!wglewMakeCurrent(m_canvasDC, m_contextObj)) { printf("WebGraphicsContext3DDefaultImpl: wglMakeCurrent failed\n"); return false; } @@ -260,7 +268,7 @@ bool WebGraphicsContext3DDefaultImpl::initialize(WebGraphicsContext3D::Attribute #ifdef RENDER_TO_DEBUGGING_WINDOW typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval); PFNWGLSWAPINTERVALEXTPROC setSwapInterval = 0; - setSwapInterval = (PFNWGLSWAPINTERVALEXTPROC) wglGetProcAddress("wglSwapIntervalEXT"); + setSwapInterval = (PFNWGLSWAPINTERVALEXTPROC) wglewGetProcAddress("wglSwapIntervalEXT"); if (setSwapInterval) setSwapInterval(1); #endif // RENDER_TO_DEBUGGING_WINDOW @@ -416,8 +424,8 @@ void WebGraphicsContext3DDefaultImpl::validateAttributes() bool WebGraphicsContext3DDefaultImpl::makeContextCurrent() { #if OS(WINDOWS) - if (wglGetCurrentContext() != m_contextObj) - if (wglMakeCurrent(m_canvasDC, m_contextObj)) + if (wglewGetCurrentContext() != m_contextObj) + if (wglewMakeCurrent(m_canvasDC, m_contextObj)) return true; #elif PLATFORM(CG) if (CGLGetCurrentContext() != m_contextObj) @@ -469,6 +477,17 @@ bool WebGraphicsContext3DDefaultImpl::isGLES2Compliant() return false; } +unsigned int WebGraphicsContext3DDefaultImpl::getPlatformTextureId() +{ + ASSERT_NOT_REACHED(); + return 0; +} + +void WebGraphicsContext3DDefaultImpl::prepareTexture() +{ + ASSERT_NOT_REACHED(); +} + static int createTextureObject(GLenum target) { GLuint texture = 0; @@ -1059,6 +1078,8 @@ bool WebGraphicsContext3DDefaultImpl::getActiveUniform(WebGLId program, unsigned return true; } +DELEGATE_TO_GL_4(getAttachedShaders, GetAttachedShaders, WebGLId, int, int*, unsigned int*) + DELEGATE_TO_GL_2R(getAttribLocation, GetAttribLocation, WebGLId, const char*, int) DELEGATE_TO_GL_2(getBooleanv, GetBooleanv, unsigned long, unsigned char*) diff --git a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h index 2518a37..e409bf5 100644 --- a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h +++ b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h @@ -42,6 +42,9 @@ #endif #include "GL/glew.h" +#if OS(WINDOWS) +#include "GL/wglew.h" +#endif #if PLATFORM(CG) #include <OpenGL/OpenGL.h> @@ -67,7 +70,7 @@ public: //---------------------------------------------------------------------- // WebGraphicsContext3D methods - virtual bool initialize(WebGraphicsContext3D::Attributes attributes); + virtual bool initialize(WebGraphicsContext3D::Attributes attributes, WebView*); virtual bool makeContextCurrent(); virtual int width(); @@ -81,6 +84,9 @@ public: virtual bool readBackFramebuffer(unsigned char* pixels, size_t bufferSize); + virtual unsigned int getPlatformTextureId(); + virtual void prepareTexture(); + virtual void synthesizeGLError(unsigned long error); virtual void activeTexture(unsigned long texture); @@ -131,6 +137,8 @@ public: virtual bool getActiveAttrib(WebGLId program, unsigned long index, ActiveInfo&); virtual bool getActiveUniform(WebGLId program, unsigned long index, ActiveInfo&); + virtual void getAttachedShaders(WebGLId program, int maxCount, int* count, unsigned int* shaders); + virtual int getAttribLocation(WebGLId program, const char* name); virtual void getBooleanv(unsigned long pname, unsigned char* value); diff --git a/WebKit/chromium/src/WebPluginContainerImpl.cpp b/WebKit/chromium/src/WebPluginContainerImpl.cpp index d099048..41758d2 100644 --- a/WebKit/chromium/src/WebPluginContainerImpl.cpp +++ b/WebKit/chromium/src/WebPluginContainerImpl.cpp @@ -167,6 +167,11 @@ void WebPluginContainerImpl::handleEvent(Event* event) handleWheelEvent(static_cast<WheelEvent*>(event)); else if (event->isKeyboardEvent()) handleKeyboardEvent(static_cast<KeyboardEvent*>(event)); + + // FIXME: it would be cleaner if Widget::handleEvent returned true/false and + // HTMLPluginElement called setDefaultHandled or defaultEventHandler. + if (!event->defaultHandled()) + m_element->Node::defaultEventHandler(event); } void WebPluginContainerImpl::frameRectsChanged() @@ -241,6 +246,11 @@ void WebPluginContainerImpl::printEnd() return m_webPlugin->printEnd(); } +WebString WebPluginContainerImpl::selectedText() +{ + return m_webPlugin->selectedText(); +} + WebElement WebPluginContainerImpl::element() { return WebElement(m_element); diff --git a/WebKit/chromium/src/WebPluginContainerImpl.h b/WebKit/chromium/src/WebPluginContainerImpl.h index ad2fa95..dd0871a 100644 --- a/WebKit/chromium/src/WebPluginContainerImpl.h +++ b/WebKit/chromium/src/WebPluginContainerImpl.h @@ -84,6 +84,10 @@ public: virtual WebString executeScriptURL(const WebURL&, bool popupsAllowed); virtual void loadFrameRequest(const WebURLRequest&, const WebString& target, bool notifyNeeded, void* notifyData); + // This cannot be null. + WebPlugin* plugin() { return m_webPlugin; } + void setPlugin(WebPlugin* plugin) { m_webPlugin = plugin; } + // Printing interface. The plugin can support custom printing // (which means it controls the layout, number of pages etc). // Whether the plugin supports its own paginated print. The other print @@ -98,6 +102,8 @@ public: // Ends the print operation. void printEnd(); + WebString selectedText(); + // Resource load events for the plugin's source data: void didReceiveResponse(const WebCore::ResourceResponse&); void didReceiveData(const char *data, int dataLength); @@ -106,9 +112,6 @@ public: NPObject* scriptableObject(); - // This cannot be null. - WebPlugin* plugin() { return m_webPlugin; } - void willDestroyPluginLoadObserver(WebPluginLoadObserver*); private: diff --git a/WebKit/chromium/src/WebPopupMenuImpl.cpp b/WebKit/chromium/src/WebPopupMenuImpl.cpp index 9ac4d34..dbf9183 100644 --- a/WebKit/chromium/src/WebPopupMenuImpl.cpp +++ b/WebKit/chromium/src/WebPopupMenuImpl.cpp @@ -230,14 +230,6 @@ void WebPopupMenuImpl::setFocus(bool enable) { } -// DEPRECATED, will be removed later. -bool WebPopupMenuImpl::handleCompositionEvent( - WebCompositionCommand command, int cursorPosition, int targetStart, - int targetEnd, const WebString& imeString) -{ - return false; -} - bool WebPopupMenuImpl::setComposition( const WebString& text, const WebVector<WebCompositionUnderline>& underlines, int selectionStart, int selectionEnd) @@ -250,12 +242,6 @@ bool WebPopupMenuImpl::confirmComposition() return false; } -// DEPRECATED, will be removed later. -bool WebPopupMenuImpl::queryCompositionStatus(bool* enabled, WebRect* caretRect) -{ - return false; -} - WebTextInputType WebPopupMenuImpl::textInputType() { return WebTextInputTypeNone; diff --git a/WebKit/chromium/src/WebPopupMenuImpl.h b/WebKit/chromium/src/WebPopupMenuImpl.h index 95f776e..4f5c2de 100644 --- a/WebKit/chromium/src/WebPopupMenuImpl.h +++ b/WebKit/chromium/src/WebPopupMenuImpl.h @@ -66,19 +66,11 @@ public: virtual bool handleInputEvent(const WebInputEvent&); virtual void mouseCaptureLost(); virtual void setFocus(bool enable); - - // DEPRECATED, will be removed later. - virtual bool handleCompositionEvent( - WebCompositionCommand command, int cursorPosition, - int targetStart, int targetEnd, const WebString& text); virtual bool setComposition( const WebString& text, const WebVector<WebCompositionUnderline>& underlines, int selectionStart, int selectionEnd); virtual bool confirmComposition(); - - // DEPRECATED, will be removed later. - virtual bool queryCompositionStatus(bool* enabled, WebRect* caretRect); virtual WebTextInputType textInputType(); virtual WebRect caretOrSelectionBounds(); virtual void setTextDirection(WebTextDirection direction); diff --git a/WebKit/chromium/src/WebViewImpl.cpp b/WebKit/chromium/src/WebViewImpl.cpp index 257d646..45b9117 100644 --- a/WebKit/chromium/src/WebViewImpl.cpp +++ b/WebKit/chromium/src/WebViewImpl.cpp @@ -32,7 +32,6 @@ #include "WebViewImpl.h" #include "AutoFillPopupMenuClient.h" -#include "AutocompletePopupMenuClient.h" #include "AXObjectCache.h" #include "Chrome.h" #include "CompositionUnderlineVectorBuilder.h" @@ -104,6 +103,7 @@ #include "WebString.h" #include "WebVector.h" #include "WebViewClient.h" +#include "wtf/OwnPtr.h" #if OS(WINDOWS) #include "RenderThemeChromiumWin.h" @@ -153,7 +153,7 @@ COMPILE_ASSERT_MATCHING_ENUM(DragOperationMove); COMPILE_ASSERT_MATCHING_ENUM(DragOperationDelete); COMPILE_ASSERT_MATCHING_ENUM(DragOperationEvery); -static const PopupContainerSettings suggestionsPopupSettings = { +static const PopupContainerSettings autoFillPopupSettings = { false, // setTextOnIndexChange false, // acceptOnAbandon true, // loopSelectionNavigation @@ -239,9 +239,9 @@ WebViewImpl::WebViewImpl(WebViewClient* client, WebDevToolsAgentClient* devTools , m_dropEffect(DropEffectDefault) , m_operationsAllowed(WebDragOperationNone) , m_dragOperation(WebDragOperationNone) - , m_suggestionsPopupShowing(false) - , m_suggestionsPopupClient(0) - , m_suggestionsPopup(0) + , m_autoFillPopupShowing(false) + , m_autoFillPopupClient(0) + , m_autoFillPopup(0) , m_isTransparent(false) , m_tabsToLinks(false) , m_dragScrollTimer(new DragScrollTimer()) @@ -261,7 +261,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client, WebDevToolsAgentClient* devTools m_lastMousePosition = WebPoint(-1, -1); if (devToolsClient) - m_devToolsAgent = static_cast<WebDevToolsAgentImpl*>(WebDevToolsAgent::create(this, 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)); @@ -356,7 +356,7 @@ void WebViewImpl::mouseDown(const WebMouseEvent& event) m_mouseCaptureNode = hitNode; // If a text field that has focus is clicked again, we should display the - // suggestions popup. + // AutoFill popup. RefPtr<Node> focusedNode = focusedWebCoreNode(); if (focusedNode.get() && toHTMLInputElement(focusedNode.get())) { if (hitNode == focusedNode) { @@ -374,7 +374,7 @@ void WebViewImpl::mouseDown(const WebMouseEvent& event) PlatformMouseEventBuilder(mainFrameImpl()->frameView(), event)); if (clickedNode.get() && clickedNode == focusedWebCoreNode()) { - // Focus has not changed, show the suggestions popup. + // Focus has not changed, show the AutoFill popup. static_cast<EditorClientImpl*>(m_page->editorClient())-> showFormAutofillForNode(clickedNode.get()); } @@ -456,7 +456,7 @@ void WebViewImpl::mouseUp(const WebMouseEvent& event) IntPoint contentPoint = view->windowToContents(clickPoint); HitTestResult hitTestResult = focused->eventHandler()->hitTestResultAtPoint(contentPoint, false, false, ShouldHitTestScrollbars); // We don't want to send a paste when middle clicking a scroll bar or a - // link (which will navigate later in the code). The main scrollbars + // link (which will navigate later in the code). The main scrollbars // have to be handled separately. if (!hitTestResult.scrollbar() && !hitTestResult.isLiveLink() && focused && !view->scrollbarAtPoint(clickPoint)) { Editor* editor = focused->editor(); @@ -557,13 +557,13 @@ bool WebViewImpl::selectPopupHandleKeyEvent(const WebKeyboardEvent& event) { if (!m_selectPopup) return false; - + return m_selectPopup->handleKeyEvent(PlatformKeyboardEventBuilder(event)); } bool WebViewImpl::autocompleteHandleKeyEvent(const WebKeyboardEvent& event) { - if (!m_suggestionsPopupShowing + if (!m_autoFillPopupShowing // Home and End should be left to the text field to process. || event.windowsKeyCode == VKEY_HOME || event.windowsKeyCode == VKEY_END) @@ -571,7 +571,7 @@ bool WebViewImpl::autocompleteHandleKeyEvent(const WebKeyboardEvent& event) // Pressing delete triggers the removal of the selected suggestion from the DB. if (event.windowsKeyCode == VKEY_DELETE - && m_suggestionsPopup->selectedIndex() != -1) { + && m_autoFillPopup->selectedIndex() != -1) { Node* node = focusedWebCoreNode(); if (!node || (node->nodeType() != Node::ELEMENT_NODE)) { ASSERT_NOT_REACHED(); @@ -583,22 +583,22 @@ bool WebViewImpl::autocompleteHandleKeyEvent(const WebKeyboardEvent& event) return false; } - int selectedIndex = m_suggestionsPopup->selectedIndex(); + int selectedIndex = m_autoFillPopup->selectedIndex(); HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(element); WebString name = inputElement->name(); - WebString value = m_suggestionsPopupClient->itemText(selectedIndex); + WebString value = m_autoFillPopupClient->itemText(selectedIndex); m_client->removeAutofillSuggestions(name, value); // Update the entries in the currently showing popup to reflect the // deletion. - m_suggestionsPopupClient->removeSuggestionAtIndex(selectedIndex); - refreshSuggestionsPopup(); + m_autoFillPopupClient->removeSuggestionAtIndex(selectedIndex); + refreshAutoFillPopup(); return false; } - if (!m_suggestionsPopup->isInterestedInEventForKey(event.windowsKeyCode)) + if (!m_autoFillPopup->isInterestedInEventForKey(event.windowsKeyCode)) return false; - if (m_suggestionsPopup->handleKeyEvent(PlatformKeyboardEventBuilder(event))) { + if (m_autoFillPopup->handleKeyEvent(PlatformKeyboardEventBuilder(event))) { // We need to ignore the next Char event after this otherwise pressing // enter when selecting an item in the menu will go to the page. if (WebInputEvent::RawKeyDown == event.type) @@ -661,62 +661,10 @@ bool WebViewImpl::touchEvent(const WebTouchEvent& event) } #endif -// The WebViewImpl::SendContextMenuEvent function is based on the Webkit -// function -// bool WebView::handleContextMenuEvent(WPARAM wParam, LPARAM lParam) in -// webkit\webkit\win\WebView.cpp. The only significant change in this -// function is the code to convert from a Keyboard event to the Right -// Mouse button up event. -// -// This function is an ugly copy/paste and should be cleaned up when the -// WebKitWin version is cleaned: https://bugs.webkit.org/show_bug.cgi?id=20438 #if OS(WINDOWS) || OS(LINUX) -// FIXME: implement on Mac +// Mac has no way to open a context menu based on a keyboard event. bool WebViewImpl::sendContextMenuEvent(const WebKeyboardEvent& event) { - static const int kContextMenuMargin = 1; - Frame* mainFrameImpl = page()->mainFrame(); - FrameView* view = mainFrameImpl->view(); - if (!view) - return false; - - IntPoint coords(-1, -1); -#if OS(WINDOWS) - int rightAligned = ::GetSystemMetrics(SM_MENUDROPALIGNMENT); -#else - int rightAligned = 0; -#endif - IntPoint location; - - - Frame* focusedFrame = page()->focusController()->focusedOrMainFrame(); - Node* focusedNode = focusedFrame->document()->focusedNode(); - Position start = mainFrameImpl->selection()->selection().start(); - - if (start.node()) { - RenderObject* renderer = start.node()->renderer(); - if (!renderer) - return false; - - RefPtr<Range> selection = mainFrameImpl->selection()->toNormalizedRange(); - IntRect firstRect = mainFrameImpl->firstRectForRange(selection.get()); - - int x = rightAligned ? firstRect.right() : firstRect.x(); - location = IntPoint(x, firstRect.bottom()); - } else if (focusedNode) - location = focusedNode->getRect().bottomLeft(); - else { - location = IntPoint( - rightAligned ? view->contentsWidth() - kContextMenuMargin : kContextMenuMargin, - kContextMenuMargin); - } - - location = view->contentsToWindow(location); - // FIXME: The IntSize(0, -1) is a hack to get the hit-testing to result in - // the selected element. Ideally we'd have the position of a context menu - // event be separate from its target node. - coords = location + IntSize(0, -1); - // The contextMenuController() holds onto the last context menu that was // popped up on the page until a new one is created. We need to clear // this menu before propagating the event through the DOM so that we can @@ -725,17 +673,9 @@ bool WebViewImpl::sendContextMenuEvent(const WebKeyboardEvent& event) // not run. page()->contextMenuController()->clearContextMenu(); - focusedFrame->view()->setCursor(pointerCursor()); - WebMouseEvent mouseEvent; - mouseEvent.button = WebMouseEvent::ButtonRight; - mouseEvent.x = coords.x(); - mouseEvent.y = coords.y(); - mouseEvent.type = WebInputEvent::MouseUp; - - PlatformMouseEventBuilder platformEvent(view, mouseEvent); - m_contextMenuAllowed = true; - bool handled = focusedFrame->eventHandler()->sendContextMenuEvent(platformEvent); + Frame* focusedFrame = page()->focusController()->focusedOrMainFrame(); + bool handled = focusedFrame->eventHandler()->sendContextMenuEventForKey(); m_contextMenuAllowed = false; return handled; } @@ -880,11 +820,11 @@ void WebViewImpl::popupClosed(WebCore::PopupContainer* popupContainer) } } -void WebViewImpl::hideSuggestionsPopup() +void WebViewImpl::hideAutoFillPopup() { - if (m_suggestionsPopupShowing) { - m_suggestionsPopup->hidePopup(); - m_suggestionsPopupShowing = false; + if (m_autoFillPopupShowing) { + m_autoFillPopup->hidePopup(); + m_autoFillPopupShowing = false; } } @@ -1142,7 +1082,7 @@ void WebViewImpl::setFocus(bool enable) } m_imeAcceptEvents = true; } else { - hideSuggestionsPopup(); + hideAutoFillPopup(); hideSelectPopup(); // Clear focus on the currently focused frame if any. @@ -1164,48 +1104,6 @@ void WebViewImpl::setFocus(bool enable) } } -// DEPRECATED, will be removed later. -bool WebViewImpl::handleCompositionEvent(WebCompositionCommand command, - int cursorPosition, - int targetStart, - int targetEnd, - const WebString& imeString) -{ - if (command == WebKit::WebCompositionCommandSet) { - if (targetStart < 0) - targetStart = 0; - if (targetEnd < 0) - targetEnd = static_cast<int>(imeString.length()); - - // Create custom underlines. - // To emphasize the selection, the selected region uses a solid black - // for its underline while other regions uses a pale gray for theirs. - WebVector<WebCompositionUnderline> underlines(static_cast<size_t>(3)); - underlines[0].startOffset = 0; - underlines[0].endOffset = targetStart; - underlines[0].thick = true; - underlines[0].color = 0xffd3d3d3; - underlines[1].startOffset = targetStart; - underlines[1].endOffset = targetEnd; - underlines[1].thick = true; - underlines[1].color = 0xff000000; - underlines[2].startOffset = targetEnd; - underlines[2].endOffset = static_cast<unsigned>(imeString.length()); - underlines[2].thick = true; - underlines[2].color = 0xffd3d3d3; - return setComposition(imeString, underlines, cursorPosition, cursorPosition); - } - - if (command == WebKit::WebCompositionCommandDiscard) - setComposition(WebString(), WebVector<WebCompositionUnderline>(), 0, 0); - else if (command == WebKit::WebCompositionCommandConfirm) { - setComposition(imeString, WebVector<WebCompositionUnderline>(), 0, 0); - confirmComposition(); - } - - return true; -} - bool WebViewImpl::setComposition( const WebString& text, const WebVector<WebCompositionUnderline>& underlines, @@ -1284,41 +1182,6 @@ bool WebViewImpl::confirmComposition() return true; } -// DEPRECATED, will be removed later. -bool WebViewImpl::queryCompositionStatus(bool* enableIME, WebRect* caretRect) -{ - // Store whether the selected node needs IME and the caret rectangle. - // This process consists of the following four steps: - // 1. Retrieve the selection controller of the focused frame; - // 2. Retrieve the caret rectangle from the controller; - // 3. Convert the rectangle, which is relative to the parent view, to the - // one relative to the client window, and; - // 4. Store the converted rectangle. - const Frame* focused = focusedWebCoreFrame(); - if (!focused) - return false; - - const Editor* editor = focused->editor(); - if (!editor || !editor->canEdit()) - return false; - - SelectionController* controller = focused->selection(); - if (!controller) - return false; - - const Node* node = controller->start().node(); - if (!node) - return false; - - *enableIME = node->shouldUseInputMethod() && !controller->isInPasswordField(); - const FrameView* view = node->document()->view(); - if (!view) - return false; - - *caretRect = view->contentsToWindow(controller->absoluteCaretBounds()); - return true; -} - WebTextInputType WebViewImpl::textInputType() { WebTextInputType type = WebTextInputTypeNone; @@ -1363,6 +1226,10 @@ WebRect WebViewImpl::caretOrSelectionBounds() if (!view) return rect; + const Node* node = controller->start().node(); + if (!node || !node->renderer()) + return rect; + if (controller->isCaret()) rect = view->contentsToWindow(controller->absoluteCaretBounds()); else if (controller->isRange()) { @@ -1832,12 +1699,6 @@ WebDevToolsAgent* WebViewImpl::devToolsAgent() return m_devToolsAgent.get(); } -void WebViewImpl::setDevToolsAgent(WebDevToolsAgent* devToolsAgent) -{ - ASSERT(!m_devToolsAgent.get()); // May only set once! - m_devToolsAgent.set(static_cast<WebDevToolsAgentPrivate*>(devToolsAgent)); -} - WebAccessibilityObject WebViewImpl::accessibilityObject() { if (!mainFrameImpl()) @@ -1858,7 +1719,7 @@ void WebViewImpl::applyAutoFillSuggestions( ASSERT(separatorIndex < static_cast<int>(names.size())); if (names.isEmpty()) { - hideSuggestionsPopup(); + hideAutoFillPopup(); return; } @@ -1867,7 +1728,7 @@ void WebViewImpl::applyAutoFillSuggestions( // focused node, then we have nothing to do. FIXME: also check the // caret is at the end and that the text has not changed. if (!focusedNode || focusedNode != PassRefPtr<Node>(node)) { - hideSuggestionsPopup(); + hideAutoFillPopup(); return; } @@ -1879,93 +1740,52 @@ void WebViewImpl::applyAutoFillSuggestions( if (!m_autoFillPopupClient.get()) m_autoFillPopupClient.set(new AutoFillPopupMenuClient); - m_autoFillPopupClient->initialize(inputElem, names, labels, - separatorIndex); - - if (m_suggestionsPopupClient != m_autoFillPopupClient.get()) { - hideSuggestionsPopup(); - m_suggestionsPopupClient = m_autoFillPopupClient.get(); - } + m_autoFillPopupClient->initialize(inputElem, names, labels, separatorIndex); if (!m_autoFillPopup.get()) { - m_autoFillPopup = PopupContainer::create(m_suggestionsPopupClient, + m_autoFillPopup = PopupContainer::create(m_autoFillPopupClient.get(), PopupContainer::Suggestion, - suggestionsPopupSettings); + autoFillPopupSettings); } - if (m_suggestionsPopup != m_autoFillPopup.get()) - m_suggestionsPopup = m_autoFillPopup.get(); - - if (m_suggestionsPopupShowing) { + if (m_autoFillPopupShowing) { m_autoFillPopupClient->setSuggestions(names, labels, separatorIndex); - refreshSuggestionsPopup(); + refreshAutoFillPopup(); } else { - m_suggestionsPopup->show(focusedNode->getRect(), + m_autoFillPopup->show(focusedNode->getRect(), focusedNode->ownerDocument()->view(), 0); - m_suggestionsPopupShowing = true; + m_autoFillPopupShowing = true; } + + // DEPRECATED: This special mode will go away once AutoFill and Autocomplete + // merge is complete. + if (m_autoFillPopupClient) + m_autoFillPopupClient->setAutocompleteMode(false); } +// DEPRECATED: replacing with applyAutoFillSuggestions. void WebViewImpl::applyAutocompleteSuggestions( const WebNode& node, const WebVector<WebString>& suggestions, int defaultSuggestionIndex) { - ASSERT(defaultSuggestionIndex < static_cast<int>(suggestions.size())); - - if (!m_page.get() || suggestions.isEmpty()) { - hideSuggestionsPopup(); - return; - } + WebVector<WebString> names(suggestions.size()); + WebVector<WebString> labels(suggestions.size()); - RefPtr<Node> focusedNode = focusedWebCoreNode(); - // If the node for which we queried the Autocomplete suggestions is not the - // focused node, then we have nothing to do. FIXME: also check the - // caret is at the end and that the text has not changed. - if (!focusedNode || focusedNode != PassRefPtr<Node>(node)) { - hideSuggestionsPopup(); - return; + for (size_t i = 0; i < suggestions.size(); ++i) { + names[i] = suggestions[i]; + labels[i] = WebString(); } - HTMLInputElement* inputElem = - static_cast<HTMLInputElement*>(focusedNode.get()); - - // The first time the Autocomplete is shown we'll create the client and the - // popup. - if (!m_autocompletePopupClient.get()) - m_autocompletePopupClient.set(new AutocompletePopupMenuClient); - - m_autocompletePopupClient->initialize(inputElem, suggestions, - defaultSuggestionIndex); - - if (m_suggestionsPopupClient != m_autocompletePopupClient.get()) { - hideSuggestionsPopup(); - m_suggestionsPopupClient = m_autocompletePopupClient.get(); - } - - if (!m_autocompletePopup.get()) { - m_autocompletePopup = PopupContainer::create(m_suggestionsPopupClient, - PopupContainer::Suggestion, - suggestionsPopupSettings); - } - - if (m_suggestionsPopup != m_autocompletePopup.get()) - m_suggestionsPopup = m_autocompletePopup.get(); - - if (m_suggestionsPopupShowing) { - m_autocompletePopupClient->setSuggestions(suggestions); - refreshSuggestionsPopup(); - } else { - m_suggestionsPopup->show(focusedNode->getRect(), - focusedNode->ownerDocument()->view(), 0); - m_suggestionsPopupShowing = true; - } + applyAutoFillSuggestions(node, names, labels, -1); + if (m_autoFillPopupClient) + m_autoFillPopupClient->setAutocompleteMode(true); } void WebViewImpl::hidePopups() { hideSelectPopup(); - hideSuggestionsPopup(); + hideAutoFillPopup(); } void WebViewImpl::performCustomContextMenuAction(unsigned action) @@ -2044,22 +1864,30 @@ void WebViewImpl::setSelectionColors(unsigned activeBackgroundColor, #endif } -void WebViewImpl::addUserScript(const WebString& sourceCode, bool runAtStart) +void WebView::addUserScript(const WebString& sourceCode, const WebVector<WebString>& patternsIn, bool runAtStart) { + OwnPtr<Vector<String> > patterns(new Vector<String>); + for (size_t i = 0; i < patternsIn.size(); ++i) + patterns->append(patternsIn[i]); + PageGroup* pageGroup = PageGroup::pageGroup(pageGroupName); RefPtr<DOMWrapperWorld> world(DOMWrapperWorld::create()); - pageGroup->addUserScriptToWorld(world.get(), sourceCode, WebURL(), 0, 0, + pageGroup->addUserScriptToWorld(world.get(), sourceCode, WebURL(), patterns.release(), 0, runAtStart ? InjectAtDocumentStart : InjectAtDocumentEnd); } -void WebViewImpl::addUserStyleSheet(const WebString& sourceCode) +void WebView::addUserStyleSheet(const WebString& sourceCode, const WebVector<WebString>& patternsIn) { + OwnPtr<Vector<String> > patterns(new Vector<String>); + for (size_t i = 0; i < patternsIn.size(); ++i) + patterns->append(patternsIn[i]); + PageGroup* pageGroup = PageGroup::pageGroup(pageGroupName); RefPtr<DOMWrapperWorld> world(DOMWrapperWorld::create()); - pageGroup->addUserStyleSheetToWorld(world.get(), sourceCode, WebURL(), 0, 0); + pageGroup->addUserStyleSheetToWorld(world.get(), sourceCode, WebURL(), patterns.release(), 0); } -void WebViewImpl::removeAllUserContent() +void WebView::removeAllUserContent() { PageGroup* pageGroup = PageGroup::pageGroup(pageGroupName); pageGroup->removeAllUserContent(); @@ -2151,24 +1979,25 @@ NotificationPresenterImpl* WebViewImpl::notificationPresenterImpl() } #endif -void WebViewImpl::refreshSuggestionsPopup() +void WebViewImpl::refreshAutoFillPopup() { - ASSERT(m_suggestionsPopupShowing); + ASSERT(m_autoFillPopupShowing); // Hide the popup if it has become empty. - if (!m_suggestionsPopupClient->listSize()) { - hideSuggestionsPopup(); + if (!m_autoFillPopupClient->listSize()) { + hideAutoFillPopup(); return; } - IntRect oldBounds = m_suggestionsPopup->boundsRect(); - m_suggestionsPopup->refresh(); - IntRect newBounds = m_suggestionsPopup->boundsRect(); + IntRect oldBounds = m_autoFillPopup->boundsRect(); + m_autoFillPopup->refresh(); + IntRect newBounds = m_autoFillPopup->boundsRect(); // Let's resize the backing window if necessary. if (oldBounds != newBounds) { WebPopupMenuImpl* popupMenu = - static_cast<WebPopupMenuImpl*>(m_suggestionsPopup->client()); - popupMenu->client()->setWindowRect(newBounds); + static_cast<WebPopupMenuImpl*>(m_autoFillPopup->client()); + if (popupMenu) + popupMenu->client()->setWindowRect(newBounds); } } diff --git a/WebKit/chromium/src/WebViewImpl.h b/WebKit/chromium/src/WebViewImpl.h index a6fa131..db2a1d2 100644 --- a/WebKit/chromium/src/WebViewImpl.h +++ b/WebKit/chromium/src/WebViewImpl.h @@ -70,7 +70,6 @@ class AutocompletePopupMenuClient; class AutoFillPopupMenuClient; class ContextMenuClientImpl; class DragScrollTimer; -class SuggestionsPopupMenuClient; class WebAccessibilityObject; class WebDevToolsAgentClient; class WebDevToolsAgentPrivate; @@ -93,22 +92,12 @@ public: virtual bool handleInputEvent(const WebInputEvent&); virtual void mouseCaptureLost(); virtual void setFocus(bool enable); - - // DEPRECATED, will be removed later. - virtual bool handleCompositionEvent(WebCompositionCommand command, - int cursorPosition, - int targetStart, - int targetEnd, - const WebString& text); virtual bool setComposition( const WebString& text, const WebVector<WebCompositionUnderline>& underlines, int selectionStart, int selectionEnd); virtual bool confirmComposition(); - - // DEPRECATED, will be removed later. - virtual bool queryCompositionStatus(bool* enabled, WebRect* caretRect); virtual WebTextInputType textInputType(); virtual WebRect caretOrSelectionBounds(); virtual void setTextDirection(WebTextDirection direction); @@ -147,8 +136,8 @@ public: const WebPoint& screenPoint, WebDragOperation operation); virtual void dragSourceMovedTo( - const WebPoint& clientPoint, - const WebPoint& screenPoint, + const WebPoint& clientPoint, + const WebPoint& screenPoint, WebDragOperation operation); virtual void dragSourceSystemDragEnded(); virtual WebDragOperation dragTargetDragEnter( @@ -174,13 +163,13 @@ public: virtual void setInspectorSetting(const WebString& key, const WebString& value); virtual WebDevToolsAgent* devToolsAgent(); - virtual void setDevToolsAgent(WebDevToolsAgent*); virtual WebAccessibilityObject accessibilityObject(); virtual void applyAutoFillSuggestions( const WebNode&, const WebVector<WebString>& names, const WebVector<WebString>& labels, int separatorIndex); + // DEPRECATED: replacing with applyAutoFillSuggestions. virtual void applyAutocompleteSuggestions( const WebNode&, const WebVector<WebString>& suggestions, @@ -194,10 +183,7 @@ public: unsigned inactiveBackgroundColor, unsigned inactiveForegroundColor); virtual void performCustomContextMenuAction(unsigned action); - virtual void addUserScript(const WebString& sourceCode, - bool runAtStart); - virtual void addUserStyleSheet(const WebString& sourceCode); - virtual void removeAllUserContent(); + virtual WebGLES2Context* gles2Context(); // WebViewImpl @@ -296,9 +282,9 @@ public: const WebImage& dragImage, const WebPoint& dragImageOffset); - void suggestionsPopupDidHide() + void autoFillPopupDidHide() { - m_suggestionsPopupShowing = false; + m_autoFillPopupShowing = false; } #if ENABLE(NOTIFICATIONS) @@ -314,7 +300,7 @@ public: void popupOpened(WebCore::PopupContainer* popupContainer); void popupClosed(WebCore::PopupContainer* popupContainer); - void hideSuggestionsPopup(); + void hideAutoFillPopup(); // HACK: currentInputEvent() is for ChromeClientImpl::show(), until we can // fix WebKit to pass enough information up into ChromeClient::show() so we @@ -336,10 +322,6 @@ public: WebCore::ScrollDirection* scrollDirection, WebCore::ScrollGranularity* scrollGranularity); - // Returns the GLES2Context associated with this WebView. One will be created - // if it doesn't already exist. - WebGLES2Context* gles2Context(); - private: friend class WebView; // So WebView::Create can call our constructor friend class WTF::RefCounted<WebViewImpl>; @@ -361,10 +343,10 @@ private: // Returns true if the autocomple has consumed the event. bool autocompleteHandleKeyEvent(const WebKeyboardEvent&); - // Repaints the suggestions popup. Should be called when the suggestions - // have changed. Note that this should only be called when the suggestions + // Repaints the AutoFill popup. Should be called when the suggestions + // have changed. Note that this should only be called when the AutoFill // popup is showing. - void refreshSuggestionsPopup(); + void refreshAutoFillPopup(); // Returns true if the view was scrolled. bool scrollViewWithKeyboard(int keyCode, int modifiers); @@ -473,32 +455,18 @@ private: // current drop target in this WebView (the drop target can accept the drop). WebDragOperation m_dragOperation; - // Whether a suggestions popup is currently showing. - bool m_suggestionsPopupShowing; - - // A pointer to the current suggestions popup menu client. This can be - // either an AutoFillPopupMenuClient or an AutocompletePopupMenuClient. We - // do not own this pointer. - SuggestionsPopupMenuClient* m_suggestionsPopupClient; + // Whether an AutoFill popup is currently showing. + bool m_autoFillPopupShowing; // The AutoFill popup client. OwnPtr<AutoFillPopupMenuClient> m_autoFillPopupClient; - // The Autocomplete popup client. - OwnPtr<AutocompletePopupMenuClient> m_autocompletePopupClient; - - // A pointer to the current suggestions popup. We do not own this pointer. - WebCore::PopupContainer* m_suggestionsPopup; + // The AutoFill popup. + RefPtr<WebCore::PopupContainer> m_autoFillPopup; // The popup associated with a select element. RefPtr<WebCore::PopupContainer> m_selectPopup; - // The AutoFill suggestions popup. - RefPtr<WebCore::PopupContainer> m_autoFillPopup; - - // The AutoComplete suggestions popup. - RefPtr<WebCore::PopupContainer> m_autocompletePopup; - OwnPtr<WebDevToolsAgentPrivate> m_devToolsAgent; // Whether the webview is rendering transparently. diff --git a/WebKit/chromium/src/WebWorkerBase.cpp b/WebKit/chromium/src/WebWorkerBase.cpp index 244cceb..0ad0ccd 100644 --- a/WebKit/chromium/src/WebWorkerBase.cpp +++ b/WebKit/chromium/src/WebWorkerBase.cpp @@ -165,7 +165,7 @@ void WebWorkerBase::initializeLoader(const WebURL& url) // loading requests from the worker context to the rest of WebKit and Chromium // infrastructure. ASSERT(!m_webView); - m_webView = WebView::create(0); + m_webView = WebView::create(0, 0); m_webView->settings()->setOfflineWebApplicationCacheEnabled(WebRuntimeFeatures::isApplicationCacheEnabled()); m_webView->initializeMainFrame(this); diff --git a/WebKit/chromium/src/js/DebuggerScript.js b/WebKit/chromium/src/js/DebuggerScript.js index baddb7d..25d1903 100644 --- a/WebKit/chromium/src/js/DebuggerScript.js +++ b/WebKit/chromium/src/js/DebuggerScript.js @@ -93,22 +93,19 @@ DebuggerScript._formatScript = function(script) DebuggerScript.setBreakpoint = function(execState, args) { args.lineNumber = DebuggerScript._webkitToV8LineNumber(args.lineNumber); - var key = args.scriptId + ":" + args.lineNumber; - var breakId = DebuggerScript._breakpoints[key]; - if (breakId) { - if (args.enabled) - Debug.enableScriptBreakPoint(breakId); - else - Debug.disableScriptBreakPoint(breakId); - Debug.changeScriptBreakPointCondition(breakId, args.condition); - return breakId; - } - - breakId = Debug.setScriptBreakPointById(args.scriptId, args.lineNumber, 0 /* column */, args.condition); - DebuggerScript._breakpoints[key] = breakId; + var breakId = Debug.setScriptBreakPointById(args.scriptId, args.lineNumber, 0 /* column */, args.condition); if (!args.enabled) Debug.disableScriptBreakPoint(breakId); - return breakId; + + var actualLineNumber = args.lineNumber; // TODO: replace with real stuff after v8 roll. + + var key = args.scriptId + ":" + actualLineNumber; + if (key in DebuggerScript._breakpoints) { + // Remove old breakpoint. + Debug.findBreakPoint(DebuggerScript._breakpoints[key], true); + } + DebuggerScript._breakpoints[key] = breakId; + return DebuggerScript._v8ToWebkitLineNumber(actualLineNumber); } DebuggerScript.removeBreakpoint = function(execState, args) @@ -240,6 +237,9 @@ DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror, callerFrame) var scopeObject = {}; for (var j = 0; j < properties.length; j++) scopeObject[properties[j].name()] = properties[j].value_; + // Reset scope object prototype to null so that the proto properties + // don't appear in th local scope section. + scopeObject.__proto__ = null; scopeType.push(scopeMirror.scopeType()); scopeChain.push(scopeObject); } diff --git a/WebKit/chromium/src/js/DevToolsHostStub.js b/WebKit/chromium/src/js/DevToolsHostStub.js index 806bf6a..bab73a9 100644 --- a/WebKit/chromium/src/js/DevToolsHostStub.js +++ b/WebKit/chromium/src/js/DevToolsHostStub.js @@ -37,5 +37,8 @@ if (!window["RemoteDebuggerAgent"]) { window["RemoteDebuggerAgent"] = { setDebuggerScriptSource: function() {} }; window["RemoteDebuggerCommandExecutor"] = {}; window["RemoteProfilerAgent"] = {}; - window["RemoteToolsAgent"] = { dispatchOnInjectedScript: function() {} }; + window["RemoteToolsAgent"] = { + dispatchOnInjectedScript: function() {}, + dispatchOnInspectorController: function() {} + }; } diff --git a/WebKit/chromium/src/js/Tests.js b/WebKit/chromium/src/js/Tests.js index 893bc56..cd4d9fb 100644 --- a/WebKit/chromium/src/js/Tests.js +++ b/WebKit/chromium/src/js/Tests.js @@ -1610,7 +1610,21 @@ TestSuite.prototype.testDebugIntrinsicProperties = function() if (window.v8ScriptDebugServerEnabled) { var scopeExpectations = [ "a", "Child", [ - "constructor", "function Child(n) {", null, + "__proto__", "Child", [ + "__proto__", "Parent", [ + "__proto__", "Object", null, + "constructor", "function Parent(n) {", [ + "name", '"Parent"', null, + "prototype", 'Parent', [ + "parentProtoField", "11", null, + ] + ], + "parentProtoField", "11", null, + ], + "constructor", "function Child(n) {", null, + "childProtoField", "21", null, + ], + "parentField", "10", null, "childField", "20", null, ] @@ -1655,7 +1669,7 @@ TestSuite.prototype.testDebugIntrinsicProperties = function() var propQueue = []; var index = 0; - var expectedFinalIndex = (window.v8ScriptDebugServerEnabled ? 1 : 8); + var expectedFinalIndex = (window.v8ScriptDebugServerEnabled ? 5 : 8); function expandAndCheckNextProperty() { if (index === propQueue.length) { |