diff options
author | Ben Murdoch <benm@google.com> | 2009-08-18 11:35:14 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2009-08-18 11:35:14 +0100 |
commit | e0330ac957b8434cd2c9c7b5447aaa0faabe77ec (patch) | |
tree | 395ba85351595e79b5e357e46af5c28a0dcb5211 /WebKit/android/WebCoreSupport | |
parent | b32f88b61a9162a5194ab02c12fc3aff6140e30e (diff) | |
parent | 8ca4160fde81af362cf2ea375997797b1df8243d (diff) | |
download | external_webkit-e0330ac957b8434cd2c9c7b5447aaa0faabe77ec.zip external_webkit-e0330ac957b8434cd2c9c7b5447aaa0faabe77ec.tar.gz external_webkit-e0330ac957b8434cd2c9c7b5447aaa0faabe77ec.tar.bz2 |
Merge commit 'goog/master' into merge
Conflicts:
WebCore/bindings/v8/ScriptController.cpp
WebCore/page/Geolocation.cpp
WebCore/platform/android/GeolocationServiceAndroid.cpp
Diffstat (limited to 'WebKit/android/WebCoreSupport')
3 files changed, 48 insertions, 8 deletions
diff --git a/WebKit/android/WebCoreSupport/EditorClientAndroid.cpp b/WebKit/android/WebCoreSupport/EditorClientAndroid.cpp index 4918ee9..d2e45ff 100644 --- a/WebKit/android/WebCoreSupport/EditorClientAndroid.cpp +++ b/WebKit/android/WebCoreSupport/EditorClientAndroid.cpp @@ -36,6 +36,7 @@ #include "NotImplemented.h" #include "PlatformKeyboardEvent.h" #include "PlatformString.h" +#include "WebViewCore.h" namespace android { @@ -225,8 +226,23 @@ void EditorClientAndroid::textDidChangeInTextArea(Element*) {} void EditorClientAndroid::textDidChangeInTextField(Element*) {} void EditorClientAndroid::textFieldDidBeginEditing(Element*) {} void EditorClientAndroid::ignoreWordInSpellDocument(String const&) {} -void EditorClientAndroid::respondToChangedSelection() {} -bool EditorClientAndroid::shouldChangeSelectedRange(Range*, Range*, EAffinity, bool) { return m_notFromClick; } + +// We need to pass the selection up to the WebTextView +void EditorClientAndroid::respondToChangedSelection() { + if (m_uiGeneratedSelectionChange) + return; + Frame* frame = m_page->focusController()->focusedOrMainFrame(); + if (!frame || !frame->view()) + return; + WebViewCore* webViewCore = WebViewCore::getWebViewCore(frame->view()); + webViewCore->updateTextSelection(); +} + +bool EditorClientAndroid::shouldChangeSelectedRange(Range*, Range*, EAffinity, + bool) { + return m_shouldChangeSelectedRange; +} + bool EditorClientAndroid::doTextFieldCommandFromEvent(Element*, KeyboardEvent*) { return false; } void EditorClientAndroid::textWillBeDeletedInTextField(Element*) {} void EditorClientAndroid::updateSpellingUIWithGrammarString(String const&, GrammarDetail const&) {} diff --git a/WebKit/android/WebCoreSupport/EditorClientAndroid.h b/WebKit/android/WebCoreSupport/EditorClientAndroid.h index 9697d66..3569f10 100644 --- a/WebKit/android/WebCoreSupport/EditorClientAndroid.h +++ b/WebKit/android/WebCoreSupport/EditorClientAndroid.h @@ -35,7 +35,10 @@ namespace android { class EditorClientAndroid : public EditorClient { public: - EditorClientAndroid() { m_notFromClick = true; } + EditorClientAndroid() { + m_shouldChangeSelectedRange = true; + m_uiGeneratedSelectionChange = false; + } virtual void pageDestroyed(); virtual bool shouldDeleteRange(Range*); @@ -105,10 +108,12 @@ public: // Android specific: void setPage(Page* page) { m_page = page; } - void setFromClick(bool fromClick) { m_notFromClick = !fromClick; } + void setShouldChangeSelectedRange(bool shouldChangeSelectedRange) { m_shouldChangeSelectedRange = shouldChangeSelectedRange; } + void setUiGeneratedSelectionChange(bool uiGenerated) { m_uiGeneratedSelectionChange = uiGenerated; } private: Page* m_page; - bool m_notFromClick; + bool m_shouldChangeSelectedRange; + bool m_uiGeneratedSelectionChange; }; } diff --git a/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp b/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp index 14e34fd..103dc4b 100644 --- a/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp +++ b/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp @@ -426,9 +426,15 @@ static bool TreatAsAttachment(const String& content_disposition) { } void FrameLoaderClientAndroid::dispatchDecidePolicyForMIMEType(FramePolicyFunction func, - const String& MIMEType, const ResourceRequest&) { + const String& MIMEType, const ResourceRequest& request) { ASSERT(m_frame); ASSERT(func); + if (!func) + return; + if (request.isNull()) { + (m_frame->loader()->*func)(PolicyIgnore); + return; + } // Default to Use (display internally). PolicyAction action = PolicyUse; // Check if we should Download instead. @@ -461,13 +467,20 @@ void FrameLoaderClientAndroid::dispatchDecidePolicyForMIMEType(FramePolicyFuncti } void FrameLoaderClientAndroid::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction func, - const NavigationAction&, const ResourceRequest& req, + const NavigationAction&, const ResourceRequest& request, PassRefPtr<FormState> formState, const String& frameName) { ASSERT(m_frame); + ASSERT(func); + if (!func) + return; + if (request.isNull()) { + (m_frame->loader()->*func)(PolicyIgnore); + return; + } // If we get to this point it means that a link has a target that was not // found by the frame tree. Instead of creating a new frame, return the // current frame in dispatchCreatePage. - if (canHandleRequest(req)) + if (canHandleRequest(request)) (m_frame->loader()->*func)(PolicyUse); else (m_frame->loader()->*func)(PolicyIgnore); @@ -486,6 +499,12 @@ void FrameLoaderClientAndroid::dispatchDecidePolicyForNavigationAction(FramePoli PassRefPtr<FormState> formState) { ASSERT(m_frame); ASSERT(func); + if (!func) + return; + if (request.isNull()) { + (m_frame->loader()->*func)(PolicyIgnore); + return; + } if (action.type() == NavigationTypeFormResubmitted) { m_webFrame->decidePolicyForFormResubmission(func); return; |