diff options
Diffstat (limited to 'WebKit/wx')
-rw-r--r-- | WebKit/wx/ChangeLog | 265 | ||||
-rw-r--r-- | WebKit/wx/WebFrame.cpp | 69 | ||||
-rw-r--r-- | WebKit/wx/WebFrame.h | 49 | ||||
-rw-r--r-- | WebKit/wx/WebFramePrivate.h | 52 | ||||
-rw-r--r-- | WebKit/wx/WebKitSupport/ChromeClientWx.cpp | 7 | ||||
-rw-r--r-- | WebKit/wx/WebKitSupport/ChromeClientWx.h | 3 | ||||
-rw-r--r-- | WebKit/wx/WebKitSupport/ContextMenuClientWx.cpp | 8 | ||||
-rw-r--r-- | WebKit/wx/WebKitSupport/EditCommandWx.h | 54 | ||||
-rw-r--r-- | WebKit/wx/WebKitSupport/EditorClientWx.cpp | 70 | ||||
-rw-r--r-- | WebKit/wx/WebKitSupport/EditorClientWx.h | 7 | ||||
-rw-r--r-- | WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp | 23 | ||||
-rw-r--r-- | WebKit/wx/WebKitSupport/FrameLoaderClientWx.h | 10 | ||||
-rw-r--r-- | WebKit/wx/WebView.cpp | 123 | ||||
-rw-r--r-- | WebKit/wx/WebView.h | 44 | ||||
-rw-r--r-- | WebKit/wx/WebViewPrivate.h | 7 | ||||
-rw-r--r-- | WebKit/wx/presets/wxwebkit.bkl | 10 |
16 files changed, 717 insertions, 84 deletions
diff --git a/WebKit/wx/ChangeLog b/WebKit/wx/ChangeLog index beb9f8a..a7212f0 100644 --- a/WebKit/wx/ChangeLog +++ b/WebKit/wx/ChangeLog @@ -1,3 +1,268 @@ +2009-01-27 Brady Eidson <beidson@apple.com> + + Reviewed by Dan Bernstein + + Rework FrameLoaderClient to work on a CachedFrame basis instead of CachedPage + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::savePlatformDataToCachedFrame): + (WebCore::FrameLoaderClientWx::transitionToCommittedFromCachedFrame): + * WebKitSupport/FrameLoaderClientWx.h: + +2009-01-23 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix, add missing include dir. + + * presets/wxwebkit.bkl: + +2009-01-19 Sam Weinig <sam@webkit.org> + + Rubber-stamped by Gavin Barraclough. + + Remove temporary operator-> from JSValuePtr. + + * WebFrame.cpp: + (wxWebFrame::RunScript): + +2009-01-14 miggilin <mr.diggilin@gmail.com> + + Reviewed by Kevin Ollivier. + + Fixing wx compilation for wx 2.9/trunk. + + * WebFrame.cpp: + (wxWebFrame::SetPageSource): + * WebView.cpp: + +2009-01-12 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix. JSValue* -> JSValuePtr. + + * WebFrame.cpp: + (wxWebFrame::RunScript): + +2009-01-05 Adam Treat <adam.treat@torchmobile.com> + + Reviewed by George Staikos. + + Build fix for contentsSizeChanged + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::contentsSizeChanged): + * WebKitSupport/ChromeClientWx.h: + +2008-12-19 miggilin <mr.diggilin@gmail.com> + + Reviewed by Kevin Ollivier. + + Add Context Menu support to wx bindings. + + https://bugs.webkit.org/show_bug.cgi?id=22675 + + * WebKitSupport/ContextMenuClientWx.cpp: + (WebCore::ContextMenuClientWx::contextMenuDestroyed): + (WebCore::ContextMenuClientWx::getCustomMenuFromDefaultItems): + * WebView.cpp: + (wxWebView::OnMouseEvents): + (wxWebView::OnContextMenuEvents): + (wxWebView::OnMenuSelectEvents): + * WebView.h: + + +2008-12-19 Kevin Ollivier <kevino@theolliviers.com> + + wx build fixes after recent changes. + + * presets/wxwebkit.bkl: + +2008-12-18 Dan Bernstein <mitz@apple.com> + + Reviewed by Sam Weinig. + + - stub out FrameLoaderClient::shouldUseCredentialStorage(). + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::shouldUseCredentialStorage): + * WebKitSupport/FrameLoaderClientWx.h: + +2008-12-18 Sam Weinig <sam@webkit.org> + + Reviewed by John Sullivan. + + Stub out FrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout() + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::dispatchDidFirstVisuallyNonEmptyLayout): + * WebKitSupport/FrameLoaderClientWx.h: + +2008-12-13 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Expose findString in wxWebView as FindString. + + https://bugs.webkit.org/show_bug.cgi?id=22458 + + * WebView.cpp: + (wxWebView::FindString): + * WebView.h: + +2008-12-09 Brett Wilson <brettw@chromium.org> + + Reviewed by Dave Hyatt. + + https://bugs.webkit.org/show_bug.cgi?id=22177 + + Add a callback on ChromeClient that the state of form elements on + the page has changed. This is to allow clients implementing session + saving to know when the current state is dirty. + + * WebKitSupport/ChromeClientWx.h: + (WebCore::ChromeClientWx::formStateDidChange): + +2008-12-02 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Add HitTest to wxWebView (and wxWebFrame). + + https://bugs.webkit.org/show_bug.cgi?id=22459 + + * WebFrame.cpp: + (wxWebFrame::HitTest): + * WebFrame.h: + * WebView.cpp: + (wxWebView::HitTest): + * WebView.h: + +2008-11-24 Darin Fisher <darin@chromium.org> + + Fix bustage. + + http://bugs.webkit.org/show_bug.cgi?id=15643 + + * WebKitSupport/EditorClientWx.cpp: + (WebCore::EditorClientWx::isSelectTrailingWhitespaceEnabled): + * WebKitSupport/EditorClientWx.h: + +2008-11-24 Darin Adler <darin@apple.com> + + Reviewed by Dan Bernstein. + + - https://bugs.webkit.org/show_bug.cgi?id=22470 + remove unneeded URL argument from FrameLoaderClient::updateGlobalHistory + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::updateGlobalHistory): Remove argument. + * WebKitSupport/FrameLoaderClientWx.h: Ditto. + +2008-11-21 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Maintain an EditCommand stack in WebFramePrivate, and expose Undo and + Redo in wxWebView. + + https://bugs.webkit.org/show_bug.cgi?id=22403 + + * WebFrame.cpp: + (wxWebFrame::wxWebFrame): + (wxWebFrame::Undo): + (wxWebFrame::Redo): + (wxWebFrame::CanUndo): + (wxWebFrame::CanRedo): + * WebFrame.h: + * WebFramePrivate.h: Added. + (WebFramePrivate::WebFramePrivate): + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::createWindow): + * WebKitSupport/EditCommandWx.h: Added. + (EditCommandWx::EditCommandWx): + (EditCommandWx::~EditCommandWx): + (EditCommandWx::editCommand): + * WebKitSupport/EditorClientWx.cpp: + (WebCore::EditorClientWx::registerCommandForUndo): + (WebCore::EditorClientWx::registerCommandForRedo): + (WebCore::EditorClientWx::canUndo): + (WebCore::EditorClientWx::canRedo): + (WebCore::EditorClientWx::undo): + (WebCore::EditorClientWx::redo): + * WebKitSupport/EditorClientWx.h: + * WebView.cpp: + (wxWebView::OnMouseEvents): + (wxWebView::OnKeyEvents): + * WebViewPrivate.h: + +2008-11-19 Darin Fisher <darin@chromium.org> + + Reviewed by Geoff Garen. + + https://bugs.webkit.org/show_bug.cgi?id=22345 + Define ScriptValue as a thin container for a JSC::Value*. + + * WebFrame.cpp: + (wxWebFrame::RunScript): + +2008-11-17 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Sam Weinig. + + Updated for JavaScriptCore renames. + + * presets/wxwebkit.bkl: + +2008-11-17 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Sam Weinig. + + Updated for JavaScriptCore renames. + + * presets/wxwebkit.bkl: + +2008-11-17 Geoffrey Garen <ggaren@apple.com> + + Not reviewed. + + Try to fix wx build. + + * presets/wxwebkit.bkl: + +2008-11-15 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Add API for setting transparent webview background. + + https://bugs.webkit.org/show_bug.cgi?id=22281 + + * WebView.cpp: + (wxWebView::SetTransparent): + (wxWebView::IsTransparent): + * WebView.h: + +2008-11-11 Cameron Zwarich <zwarich@apple.com> + + Reviewed by Geoff Garen. + + Remove pointless dependencies on the deleted kjs directory. + + * presets/wxwebkit.bkl: + +2008-11-08 Kevin Ollivier <kevino@theolliviers.com> + + wx build fixes after addition of JSCore parser and bycompiler dirs. + + * presets/wxwebkit.bkl: + +2008-11-05 Cameron Zwarich <zwarich@apple.com> + + Rubber-stamped by Sam Weinig. + + Move more files to the runtime subdirectory of JavaScriptCore. + + * WebFrame.cpp: + * WebView.cpp: + 2008-10-31 Kevin Ollivier <kevino@theolliviers.com> wxMSW build fix. Missing header. diff --git a/WebKit/wx/WebFrame.cpp b/WebKit/wx/WebFrame.cpp index b1f03e0..7bfcc5d 100644 --- a/WebKit/wx/WebFrame.cpp +++ b/WebKit/wx/WebFrame.cpp @@ -28,9 +28,11 @@ #include "Document.h" #include "Editor.h" #include "Element.h" +#include "EventHandler.h" #include "Frame.h" #include "FrameLoader.h" #include "FrameView.h" +#include "HitTestResult.h" #include "HTMLFrameOwnerElement.h" #include "markup.h" #include "Page.h" @@ -42,9 +44,10 @@ #include "FrameLoaderClientWx.h" #include "ScriptController.h" +#include "ScriptValue.h" #include "JSDOMBinding.h" #include <runtime/JSValue.h> -#include <kjs/ustring.h> +#include <runtime/UString.h> #include "wx/wxprec.h" #ifndef WX_PRECOMP @@ -53,6 +56,7 @@ #include "WebFrame.h" #include "WebView.h" +#include "WebFramePrivate.h" #include "WebViewPrivate.h" #include <wx/defs.h> @@ -71,7 +75,7 @@ wxWebFrame::wxWebFrame(wxWebView* container, wxWebFrame* parent, WebViewFrameDat m_title(wxEmptyString) { - m_impl = new WebViewPrivate(); + m_impl = new WebFramePrivate(); WebCore::HTMLFrameOwnerElement* parentFrame = 0; @@ -138,7 +142,7 @@ void wxWebFrame::SetPageSource(const wxString& source, const wxString& baseUrl) if (m_impl->frame && m_impl->frame->loader()) { WebCore::FrameLoader* loader = m_impl->frame->loader(); loader->begin(WebCore::KURL(static_cast<const char*>(baseUrl.mb_str(wxConvUTF8)))); - loader->write(source); + loader->write(static_cast<const WebCore::String>(source)); loader->end(); } } @@ -172,13 +176,21 @@ wxString wxWebFrame::RunScript(const wxString& javascript) { wxString returnValue = wxEmptyString; if (m_impl->frame) { - JSC::JSValue* result = m_impl->frame->loader()->executeScript(javascript, true); + JSC::JSValuePtr result = m_impl->frame->loader()->executeScript(javascript, true).jsValue(); if (result) - returnValue = wxString(result->toString(m_impl->frame->script()->globalObject()->globalExec()).UTF8String().c_str(), wxConvUTF8); + returnValue = wxString(result.toString(m_impl->frame->script()->globalObject()->globalExec()).UTF8String().c_str(), wxConvUTF8); } return returnValue; } +bool wxWebFrame::FindString(const wxString& string, bool forward, bool caseSensitive, bool wrapSelection, bool startInSelection) +{ + if (m_impl->frame) + return m_impl->frame->findString(string, forward, caseSensitive, wrapSelection, startInSelection); + + return false; +} + void wxWebFrame::LoadURL(const wxString& url) { if (m_impl->frame && m_impl->frame->loader()) { @@ -232,6 +244,35 @@ bool wxWebFrame::CanGoForward() return false; } + +void wxWebFrame::Undo() +{ + if (m_impl->frame && m_impl->frame->editor() && CanUndo()) + return m_impl->frame->editor()->undo(); +} + +void wxWebFrame::Redo() +{ + if (m_impl->frame && m_impl->frame->editor() && CanRedo()) + return m_impl->frame->editor()->redo(); +} + +bool wxWebFrame::CanUndo() +{ + if (m_impl->frame && m_impl->frame->editor()) + return m_impl->frame->editor()->canUndo(); + + return false; +} + +bool wxWebFrame::CanRedo() +{ + if (m_impl->frame && m_impl->frame->editor()) + return m_impl->frame->editor()->canRedo(); + + return false; +} + bool wxWebFrame::CanIncreaseTextSize() const { if (m_impl->frame) { @@ -315,3 +356,21 @@ void wxWebFrame::Paste() m_impl->frame->editor()->paste(); } + +wxWebViewDOMElementInfo wxWebFrame::HitTest(const wxPoint& pos) const +{ + wxWebViewDOMElementInfo domInfo; + + if (m_impl->frame->view()) { + WebCore::HitTestResult result = m_impl->frame->eventHandler()->hitTestResultAtPoint(m_impl->frame->view()->windowToContents(pos), false); + if (result.innerNode()) { + domInfo.SetLink(result.absoluteLinkURL().string()); + domInfo.SetText(result.textContent()); + domInfo.SetImageSrc(result.absoluteImageURL().string()); + domInfo.SetSelected(result.isSelected()); + } + } + + return domInfo; +} + diff --git a/WebKit/wx/WebFrame.h b/WebKit/wx/WebFrame.h index a6961eb..5c697d6 100644 --- a/WebKit/wx/WebFrame.h +++ b/WebKit/wx/WebFrame.h @@ -33,13 +33,14 @@ #include "wx/wx.h" #endif -class WebViewPrivate; +class WebFramePrivate; class WebViewFrameData; class wxWebView; namespace WebCore { class ChromeClientWx; class FrameLoaderClientWx; + class EditorClientWx; class Frame; } @@ -57,12 +58,44 @@ namespace WebCore { #define WXDLLIMPEXP_WEBKIT #endif // SWIG +class WXDLLIMPEXP_WEBKIT wxWebViewDOMElementInfo +{ +public: + wxWebViewDOMElementInfo(); + + ~wxWebViewDOMElementInfo() { } + + wxString GetTagName() const { return m_tagName; } + void SetTagName(const wxString& name) { m_tagName = name; } + + bool IsSelected() const { return m_isSelected; } + void SetSelected(bool sel) { m_isSelected = sel; } + + wxString GetText() const { return m_text; } + void SetText(const wxString& text) { m_text = text; } + + wxString GetImageSrc() const { return m_imageSrc; } + void SetImageSrc(const wxString& src) { m_imageSrc = src; } + + wxString GetLink() const { return m_link; } + void SetLink(const wxString& link) { m_link = link; } + +private: + void* m_domElement; + bool m_isSelected; + wxString m_tagName; + wxString m_text; + wxString m_imageSrc; + wxString m_link; +}; + class WXDLLIMPEXP_WEBKIT wxWebFrame { // ChromeClientWx needs to get the Page* stored by the wxWebView // for the createWindow function. friend class WebCore::ChromeClientWx; friend class WebCore::FrameLoaderClientWx; + friend class WebCore::EditorClientWx; friend class wxWebView; wxWebFrame(wxWebView* container, wxWebFrame* parent = NULL, WebViewFrameData* data = NULL); @@ -86,6 +119,12 @@ class WXDLLIMPEXP_WEBKIT wxWebFrame void Copy(); void Paste(); + bool CanUndo(); + bool CanRedo(); + + void Undo(); + void Redo(); + wxString GetPageSource(); void SetPageSource(const wxString& source, const wxString& baseUrl = wxEmptyString); @@ -95,6 +134,10 @@ class WXDLLIMPEXP_WEBKIT wxWebFrame wxString RunScript(const wxString& javascript); + bool FindString(const wxString& string, bool forward = true, + bool caseSensitive = false, bool wrapSelection = true, + bool startInSelection = true); + bool CanIncreaseTextSize() const; void IncreaseTextSize(); bool CanDecreaseTextSize() const; @@ -106,13 +149,15 @@ class WXDLLIMPEXP_WEBKIT wxWebFrame void SetPageTitle(const wxString& title) { m_title = title; } WebCore::Frame* GetFrame(); + + wxWebViewDOMElementInfo HitTest(const wxPoint& post) const; private: float m_textMagnifier; bool m_isEditable; bool m_isInitialized; bool m_beingDestroyed; - WebViewPrivate* m_impl; + WebFramePrivate* m_impl; wxString m_title; }; diff --git a/WebKit/wx/WebFramePrivate.h b/WebKit/wx/WebFramePrivate.h new file mode 100644 index 0000000..7af70a8 --- /dev/null +++ b/WebKit/wx/WebFramePrivate.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2008 Kevin Ollivier. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WXWEBFRAMEPRIVATE_H +#define WXWEBFRAMEPRIVATE_H + +#include "config.h" +#include "EditCommand.h" +#include "EditCommandWx.h" +#include "Frame.h" +#include "wtf/RefPtr.h" +#include "wtf/Vector.h" + +class WebFramePrivate { + +public: + WebFramePrivate() : + frame(0) + {} + + WTF::Vector<EditCommandWx> undoStack; + WTF::Vector<EditCommandWx> redoStack; + + WTF::RefPtr<WebCore::Frame> frame; +}; + +#endif diff --git a/WebKit/wx/WebKitSupport/ChromeClientWx.cpp b/WebKit/wx/WebKitSupport/ChromeClientWx.cpp index 3d119a5..29fef0e 100644 --- a/WebKit/wx/WebKitSupport/ChromeClientWx.cpp +++ b/WebKit/wx/WebKitSupport/ChromeClientWx.cpp @@ -122,7 +122,7 @@ Page* ChromeClientWx::createWindow(Frame*, const FrameLoadRequest& request, cons WebViewPrivate* impl = newFrame->webview->m_impl; if (impl) - myPage = impl->frame->page(); + myPage = impl->page; } return myPage; @@ -314,6 +314,11 @@ PlatformWidget ChromeClientWx::platformWindow() const return 0; } +void ChromeClientWx::contentsSizeChanged(Frame*, const IntSize&) const +{ + notImplemented(); +} + void ChromeClientWx::scrollBackingStore(int dx, int dy, const IntRect& scrollViewRect, const IntRect& clipRect) diff --git a/WebKit/wx/WebKitSupport/ChromeClientWx.h b/WebKit/wx/WebKitSupport/ChromeClientWx.h index d90788f..74e0023 100644 --- a/WebKit/wx/WebKitSupport/ChromeClientWx.h +++ b/WebKit/wx/WebKitSupport/ChromeClientWx.h @@ -102,6 +102,7 @@ public: virtual IntPoint screenToWindow(const IntPoint&) const; virtual IntRect windowToScreen(const IntRect&) const; virtual PlatformWidget platformWindow() const; + virtual void contentsSizeChanged(Frame*, const IntSize&) const; virtual void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags); @@ -113,6 +114,8 @@ public: virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>); + virtual void formStateDidChange(const Node*) { } + private: wxWebView* m_webView; }; diff --git a/WebKit/wx/WebKitSupport/ContextMenuClientWx.cpp b/WebKit/wx/WebKitSupport/ContextMenuClientWx.cpp index 8f88f1a..e3d8e5a 100644 --- a/WebKit/wx/WebKitSupport/ContextMenuClientWx.cpp +++ b/WebKit/wx/WebKitSupport/ContextMenuClientWx.cpp @@ -28,6 +28,7 @@ #include "config.h" #include "ContextMenuClientWx.h" #include "NotImplemented.h" +#include "ContextMenu.h" #include <stdio.h> namespace WebCore { @@ -38,13 +39,12 @@ ContextMenuClientWx::~ContextMenuClientWx() void ContextMenuClientWx::contextMenuDestroyed() { - notImplemented(); + delete this; } -PlatformMenuDescription ContextMenuClientWx::getCustomMenuFromDefaultItems(ContextMenu*) +PlatformMenuDescription ContextMenuClientWx::getCustomMenuFromDefaultItems(ContextMenu* menu) { - notImplemented(); - return 0; + return menu->releasePlatformDescription(); } void ContextMenuClientWx::contextMenuItemSelected(ContextMenuItem*, diff --git a/WebKit/wx/WebKitSupport/EditCommandWx.h b/WebKit/wx/WebKitSupport/EditCommandWx.h new file mode 100644 index 0000000..e5deedd --- /dev/null +++ b/WebKit/wx/WebKitSupport/EditCommandWx.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2008 Kevin Ollivier. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WXEDITCOMMAND_H +#define WXEDITCOMMAND_H + +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebCore { + class EditCommand; +} + +class EditCommandWx +{ +public: + EditCommandWx(WTF::PassRefPtr<WebCore::EditCommand> command) + { + m_editCommand = command; + } + + ~EditCommandWx() {} + WTF::PassRefPtr<WebCore::EditCommand> editCommand() { return m_editCommand; } + +private: + WTF::RefPtr<WebCore::EditCommand> m_editCommand; +}; + +#endif diff --git a/WebKit/wx/WebKitSupport/EditorClientWx.cpp b/WebKit/wx/WebKitSupport/EditorClientWx.cpp index ade0f41..6c443ed 100644 --- a/WebKit/wx/WebKitSupport/EditorClientWx.cpp +++ b/WebKit/wx/WebKitSupport/EditorClientWx.cpp @@ -39,7 +39,11 @@ #include "PlatformKeyboardEvent.h" #include "PlatformString.h" #include "SelectionController.h" + +#include "WebFrame.h" +#include "WebFramePrivate.h" #include "WebView.h" +#include "WebViewPrivate.h" #include <stdio.h> @@ -78,6 +82,12 @@ bool EditorClientWx::smartInsertDeleteEnabled() return false; } +bool EditorClientWx::isSelectTrailingWhitespaceEnabled() +{ + notImplemented(); + return false; +} + bool EditorClientWx::isContinuousSpellCheckingEnabled() { notImplemented(); @@ -195,14 +205,28 @@ void EditorClientWx::didSetSelectionTypesForPasteboard() notImplemented(); } -void EditorClientWx::registerCommandForUndo(PassRefPtr<EditCommand>) +void EditorClientWx::registerCommandForUndo(PassRefPtr<EditCommand> command) { - notImplemented(); + Frame* frame = m_page->focusController()->focusedOrMainFrame(); + + if (frame) { + wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->platformWidget()); + if (webKitWin) { + webKitWin->GetMainFrame()->m_impl->undoStack.append(EditCommandWx(command)); + } + } } -void EditorClientWx::registerCommandForRedo(PassRefPtr<EditCommand>) +void EditorClientWx::registerCommandForRedo(PassRefPtr<EditCommand> command) { - notImplemented(); + Frame* frame = m_page->focusController()->focusedOrMainFrame(); + + if (frame) { + wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->platformWidget()); + if (webKitWin) { + webKitWin->GetMainFrame()->m_impl->redoStack.insert(0, EditCommandWx(command)); + } + } } void EditorClientWx::clearUndoRedoOperations() @@ -212,24 +236,54 @@ void EditorClientWx::clearUndoRedoOperations() bool EditorClientWx::canUndo() const { - notImplemented(); + Frame* frame = m_page->focusController()->focusedOrMainFrame(); + + if (frame) { + wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->platformWidget()); + if (webKitWin && webKitWin->GetMainFrame()) { + return webKitWin->GetMainFrame()->m_impl->undoStack.size() != 0; + } + } return false; } bool EditorClientWx::canRedo() const { - notImplemented(); + Frame* frame = m_page->focusController()->focusedOrMainFrame(); + + if (frame) { + wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->platformWidget()); + if (webKitWin && webKitWin->GetMainFrame()) { + return webKitWin->GetMainFrame()->m_impl->redoStack.size() != 0; + } + } return false; } void EditorClientWx::undo() { - notImplemented(); + Frame* frame = m_page->focusController()->focusedOrMainFrame(); + + if (frame) { + wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->platformWidget()); + if (webKitWin && webKitWin->GetMainFrame()) { + webKitWin->GetMainFrame()->m_impl->undoStack.last().editCommand()->unapply(); + webKitWin->GetMainFrame()->m_impl->undoStack.removeLast(); + } + } } void EditorClientWx::redo() { - notImplemented(); + Frame* frame = m_page->focusController()->focusedOrMainFrame(); + + if (frame) { + wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->platformWidget()); + if (webKitWin && webKitWin->GetMainFrame()) { + webKitWin->GetMainFrame()->m_impl->redoStack.first().editCommand()->reapply(); + webKitWin->GetMainFrame()->m_impl->redoStack.remove(0); + } + } } void EditorClientWx::handleInputMethodKeydown(KeyboardEvent* event) diff --git a/WebKit/wx/WebKitSupport/EditorClientWx.h b/WebKit/wx/WebKitSupport/EditorClientWx.h index 51b820c..0f98167 100644 --- a/WebKit/wx/WebKitSupport/EditorClientWx.h +++ b/WebKit/wx/WebKitSupport/EditorClientWx.h @@ -31,9 +31,15 @@ #include "EditorClient.h" #include "Page.h" +#include "WebView.h" +#include "WebFrame.h" + namespace WebCore { class EditorClientWx : public EditorClient { +friend class ::wxWebView; +friend class ::wxWebFrame; + public: virtual ~EditorClientWx(); void setPage(Page*); @@ -42,6 +48,7 @@ public: virtual bool shouldDeleteRange(Range*); virtual bool shouldShowDeleteInterface(HTMLElement*); virtual bool smartInsertDeleteEnabled(); + virtual bool isSelectTrailingWhitespaceEnabled(); virtual bool isContinuousSpellCheckingEnabled(); virtual void toggleContinuousSpellChecking(); virtual bool isGrammarCheckingEnabled(); diff --git a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp index 685da65..a34576d 100644 --- a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp +++ b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp @@ -227,13 +227,6 @@ void FrameLoaderClientWx::detachedFromParent3() notImplemented(); } - -void FrameLoaderClientWx::loadedFromCachedPage() -{ - notImplemented(); -} - - void FrameLoaderClientWx::dispatchDidHandleOnloadEvents() { if (m_webView) { @@ -330,6 +323,10 @@ void FrameLoaderClientWx::dispatchDidFirstLayout() notImplemented(); } +void FrameLoaderClientWx::dispatchDidFirstVisuallyNonEmptyLayout() +{ + notImplemented(); +} void FrameLoaderClientWx::dispatchShow() { @@ -529,7 +526,7 @@ void FrameLoaderClientWx::partClearedInBegin() notImplemented(); } -void FrameLoaderClientWx::updateGlobalHistory(const WebCore::KURL&) +void FrameLoaderClientWx::updateGlobalHistory() { notImplemented(); } @@ -626,6 +623,12 @@ void FrameLoaderClientWx::dispatchWillSendRequest(DocumentLoader*, unsigned long notImplemented(); } +bool FrameLoaderClientWx::shouldUseCredentialStorage(DocumentLoader*, unsigned long) +{ + notImplemented(); + return false; +} + void FrameLoaderClientWx::dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, unsigned long, const AuthenticationChallenge&) { notImplemented(); @@ -834,12 +837,12 @@ void FrameLoaderClientWx::registerForIconNotification(bool listen) notImplemented(); } -void FrameLoaderClientWx::savePlatformDataToCachedPage(CachedPage*) +void FrameLoaderClientWx::savePlatformDataToCachedFrame(CachedFrame*) { notImplemented(); } -void FrameLoaderClientWx::transitionToCommittedFromCachedPage(CachedPage*) +void FrameLoaderClientWx::transitionToCommittedFromCachedFrame(CachedFrame*) { notImplemented(); } diff --git a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h index 3b525b1..9ad4ddc 100644 --- a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h +++ b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h @@ -90,8 +90,6 @@ namespace WebCore { virtual void detachedFromParent2(); virtual void detachedFromParent3(); - virtual void loadedFromCachedPage(); - virtual void frameLoaderDestroyed(); virtual bool canHandleRequest(const ResourceRequest&) const; @@ -108,6 +106,7 @@ namespace WebCore { virtual void dispatchDidFinishDocumentLoad(); virtual void dispatchDidFinishLoad(); virtual void dispatchDidFirstLayout(); + virtual void dispatchDidFirstVisuallyNonEmptyLayout(); virtual void dispatchShow(); virtual void cancelPolicyCheck(); @@ -145,11 +144,11 @@ namespace WebCore { virtual String userAgent(const KURL&); - virtual void savePlatformDataToCachedPage(WebCore::CachedPage*); - virtual void transitionToCommittedFromCachedPage(WebCore::CachedPage*); + virtual void savePlatformDataToCachedFrame(WebCore::CachedFrame*); + virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*); virtual void transitionToCommittedForNewPage(); - virtual void updateGlobalHistory(const KURL&); + virtual void updateGlobalHistory(); virtual bool shouldGoToHistoryItem(HistoryItem*) const; virtual void saveScrollPositionAndViewStateToItem(HistoryItem*); virtual bool canCachePage() const; @@ -169,6 +168,7 @@ namespace WebCore { virtual void assignIdentifierToInitialRequest(unsigned long identifier, DocumentLoader*, const ResourceRequest&); virtual void dispatchWillSendRequest(DocumentLoader*, unsigned long, ResourceRequest&, const ResourceResponse&); + virtual bool shouldUseCredentialStorage(DocumentLoader*, unsigned long identifier); virtual void dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, unsigned long identifier, const AuthenticationChallenge&); virtual void dispatchDidCancelAuthenticationChallenge(DocumentLoader*, unsigned long identifier, const AuthenticationChallenge&); virtual void dispatchDidReceiveResponse(DocumentLoader*, unsigned long, const ResourceResponse&); diff --git a/WebKit/wx/WebView.cpp b/WebKit/wx/WebView.cpp index fb2164f..6ed8aef 100644 --- a/WebKit/wx/WebView.cpp +++ b/WebKit/wx/WebView.cpp @@ -37,6 +37,9 @@ #include "Logging.h" #include "markup.h" #include "Page.h" +#include "ContextMenu.h" +#include "ContextMenuItem.h" +#include "ContextMenuController.h" #include "PlatformKeyboardEvent.h" #include "PlatformMouseEvent.h" #include "PlatformString.h" @@ -57,7 +60,7 @@ #include "ScriptController.h" #include "JSDOMBinding.h" #include <runtime/JSValue.h> -#include <kjs/ustring.h> +#include <runtime/UString.h> #include "wx/wxprec.h" #ifndef WX_PRECOMP @@ -70,6 +73,7 @@ #include <wx/defs.h> #include <wx/dcbuffer.h> +#include <wx/dcgraph.h> #if defined(_MSC_VER) int rint(double val) @@ -172,6 +176,8 @@ BEGIN_EVENT_TABLE(wxWebView, wxWindow) EVT_PAINT(wxWebView::OnPaint) EVT_SIZE(wxWebView::OnSize) EVT_MOUSE_EVENTS(wxWebView::OnMouseEvents) + EVT_CONTEXT_MENU(wxWebView::OnContextMenuEvents) + EVT_MENU(wxID_ANY, wxWebView::OnMenuSelectEvents) EVT_KEY_DOWN(wxWebView::OnKeyEvents) EVT_KEY_UP(wxWebView::OnKeyEvents) EVT_CHAR(wxWebView::OnKeyEvents) @@ -312,6 +318,30 @@ wxString wxWebView::GetExternalRepresentation() return wxEmptyString; } +void wxWebView::SetTransparent(bool transparent) +{ + WebCore::Frame* frame = 0; + if (m_mainFrame) + frame = m_mainFrame->GetFrame(); + + if (!frame || !frame->view()) + return; + + frame->view()->setTransparent(transparent); +} + +bool wxWebView::IsTransparent() const +{ + WebCore::Frame* frame = 0; + if (m_mainFrame) + frame = m_mainFrame->GetFrame(); + + if (!frame || !frame->view()) + return false; + + return frame->view()->isTransparent(); +} + wxString wxWebView::RunScript(const wxString& javascript) { if (m_mainFrame) @@ -439,6 +469,14 @@ void wxWebView::OnPaint(wxPaintEvent& event) } } +bool wxWebView::FindString(const wxString& string, bool forward, bool caseSensitive, bool wrapSelection, bool startInSelection) +{ + if (m_mainFrame) + return m_mainFrame->FindString(string, forward, caseSensitive, wrapSelection, startInSelection); + + return false; +} + void wxWebView::OnSize(wxSizeEvent& event) { if (m_isInitialized && m_mainFrame) { @@ -474,17 +512,60 @@ void wxWebView::OnMouseEvents(wxMouseEvent& event) WebCore::PlatformMouseEvent wkEvent(event, globalPoint); - if (type == wxEVT_LEFT_DOWN || type == wxEVT_MIDDLE_DOWN || type == wxEVT_RIGHT_DOWN) + if (type == wxEVT_LEFT_DOWN || type == wxEVT_MIDDLE_DOWN || type == wxEVT_RIGHT_DOWN || + type == wxEVT_LEFT_DCLICK || type == wxEVT_MIDDLE_DCLICK || type == wxEVT_RIGHT_DCLICK) frame->eventHandler()->handleMousePressEvent(wkEvent); - else if (type == wxEVT_LEFT_UP || type == wxEVT_MIDDLE_UP || type == wxEVT_RIGHT_UP || - type == wxEVT_LEFT_DCLICK || type == wxEVT_MIDDLE_DCLICK || type == wxEVT_RIGHT_DCLICK) + else if (type == wxEVT_LEFT_UP || type == wxEVT_MIDDLE_UP || type == wxEVT_RIGHT_UP) frame->eventHandler()->handleMouseReleaseEvent(wkEvent); else if (type == wxEVT_MOTION) frame->eventHandler()->mouseMoved(wkEvent); } +void wxWebView::OnContextMenuEvents(wxContextMenuEvent& event) +{ + m_impl->page->contextMenuController()->clearContextMenu(); + wxPoint localEventPoint = ScreenToClient(event.GetPosition()); + + if (!m_mainFrame) + return; + + WebCore::Frame* focusedFrame = m_mainFrame->GetFrame(); + if (!focusedFrame->view()) + return; + + //Create WebCore mouse event from the wxContextMenuEvent + wxMouseEvent mouseEvent(wxEVT_RIGHT_DOWN); + mouseEvent.m_x = localEventPoint.x; + mouseEvent.m_y = localEventPoint.y; + WebCore::PlatformMouseEvent wkEvent(mouseEvent, event.GetPosition()); + + bool handledEvent = focusedFrame->eventHandler()->sendContextMenuEvent(wkEvent); + if (!handledEvent) + return; + + WebCore::ContextMenu* coreMenu = m_impl->page->contextMenuController()->contextMenu(); + if (!coreMenu) + return; + + WebCore::PlatformMenuDescription menuWx = coreMenu->platformDescription(); + if (!menuWx) + return; + + PopupMenu(menuWx, localEventPoint); +} + +void wxWebView::OnMenuSelectEvents(wxCommandEvent& event) +{ + WebCore::ContextMenuItem* item = WebCore::ContextMenu::itemWithId (event.GetId()); + if (!item) + return; + + m_impl->page->contextMenuController()->contextMenuItemSelected(item); + delete item; +} + bool wxWebView::CanCopy() { if (m_mainFrame) @@ -538,13 +619,24 @@ void wxWebView::OnKeyEvents(wxKeyEvent& event) // WebCore doesn't handle these events itself, so we need to do // it and not send the event down or else CTRL+C will erase the text // and replace it with c. - if (event.CmdDown() && event.GetKeyCode() == static_cast<int>('C')) - Copy(); - else if (event.CmdDown() && event.GetKeyCode() == static_cast<int>('X')) - Cut(); - else if (event.CmdDown() && event.GetKeyCode() == static_cast<int>('V')) - Paste(); - else { + if (event.CmdDown() && event.GetEventType() == wxEVT_KEY_UP) { + if (event.GetKeyCode() == static_cast<int>('C')) + Copy(); + else if (event.GetKeyCode() == static_cast<int>('X')) + Cut(); + else if (event.GetKeyCode() == static_cast<int>('V')) + Paste(); + else if (event.GetKeyCode() == static_cast<int>('Z')) { + if (event.ShiftDown()) { + if (m_mainFrame->CanRedo()) + m_mainFrame->Redo(); + } + else { + if (m_mainFrame->CanUndo()) + m_mainFrame->Undo(); + } + } + } else { WebCore::PlatformKeyboardEvent wkEvent(event); if (wkEvent.type() == WebCore::PlatformKeyboardEvent::Char && wkEvent.altKey()) frame->eventHandler()->handleAccessKey(wkEvent); @@ -592,3 +684,12 @@ void wxWebView::OnActivate(wxActivateEvent& event) event.Skip(); } + +wxWebViewDOMElementInfo wxWebView::HitTest(const wxPoint& pos) const +{ + if (m_mainFrame) + return m_mainFrame->HitTest(pos); + + return wxWebViewDOMElementInfo(); +} + diff --git a/WebKit/wx/WebView.h b/WebKit/wx/WebView.h index b8fce63..387d193 100644 --- a/WebKit/wx/WebView.h +++ b/WebKit/wx/WebView.h @@ -33,6 +33,8 @@ #include "wx/wx.h" #endif +#include "WebFrame.h" + class WebViewPrivate; class WebViewFrameData; class wxWebFrame; @@ -118,7 +120,14 @@ public: wxString GetAsMarkup(); wxString GetExternalRepresentation(); + void SetTransparent(bool transparent); + bool IsTransparent() const; + wxString RunScript(const wxString& javascript); + + bool FindString(const wxString& string, bool forward = true, + bool caseSensitive = false, bool wrapSelection = true, + bool startInSelection = true); bool CanIncreaseTextSize() const; void IncreaseTextSize(); @@ -132,12 +141,16 @@ public: wxWebFrame* GetMainFrame() { return m_mainFrame; } + wxWebViewDOMElementInfo HitTest(const wxPoint& post) const; + protected: // event handlers (these functions should _not_ be virtual) void OnPaint(wxPaintEvent& event); void OnSize(wxSizeEvent& event); void OnMouseEvents(wxMouseEvent& event); + void OnContextMenuEvents(wxContextMenuEvent& event); + void OnMenuSelectEvents(wxCommandEvent& event); void OnKeyEvents(wxKeyEvent& event); void OnSetFocus(wxFocusEvent& event); void OnKillFocus(wxFocusEvent& event); @@ -185,37 +198,6 @@ enum { wxWEBVIEW_NAV_OTHER = 32 }; -class WXDLLIMPEXP_WEBKIT wxWebViewDOMElementInfo -{ -public: - wxWebViewDOMElementInfo(); - - ~wxWebViewDOMElementInfo() { } - - wxString GetTagName() const { return m_tagName; } - void SetTagName(const wxString& name) { m_tagName = name; } - - bool IsSelected() const { return m_isSelected; } - void SetSelected(bool sel) { m_isSelected = sel; } - - wxString GetText() const { return m_text; } - void SetText(const wxString& text) { m_text = text; } - - wxString GetImageSrc() const { return m_imageSrc; } - void SetImageSrc(const wxString& src) { m_imageSrc = src; } - - wxString GetLink() const { return m_link; } - void SetLink(const wxString& link) { m_link = link; } - -private: - void* m_domElement; - bool m_isSelected; - wxString m_tagName; - wxString m_text; - wxString m_imageSrc; - wxString m_link; -}; - class WXDLLIMPEXP_WEBKIT wxWebViewBeforeLoadEvent : public wxCommandEvent { #ifndef SWIG diff --git a/WebKit/wx/WebViewPrivate.h b/WebKit/wx/WebViewPrivate.h index 2eef499..9ad8a3e 100644 --- a/WebKit/wx/WebViewPrivate.h +++ b/WebKit/wx/WebViewPrivate.h @@ -29,10 +29,9 @@ #ifndef WXWEBVIEWPRIVATE_H #define WXWEBVIEWPRIVATE_H - #include "config.h" -#include "Frame.h" -#include "FrameView.h" +#include "HTMLFrameOwnerElement.h" +#include "Page.h" #include "wtf/RefPtr.h" #include "KURL.h" @@ -40,11 +39,9 @@ class WebViewPrivate { public: WebViewPrivate() : - frame(0), page(0) {} - WTF::RefPtr<WebCore::Frame> frame; WebCore::Page* page; }; diff --git a/WebKit/wx/presets/wxwebkit.bkl b/WebKit/wx/presets/wxwebkit.bkl index 80ffd2f..df21c67 100644 --- a/WebKit/wx/presets/wxwebkit.bkl +++ b/WebKit/wx/presets/wxwebkit.bkl @@ -116,8 +116,11 @@ and WebCore. Include this file to use these settings. <include>$(WK_ROOT)/WebCore/loader</include> <include>$(WK_ROOT)/WebCore/loader/icon</include> <include>$(WK_ROOT)/WebCore/page</include> + <include>$(WK_ROOT)/WebCore/page/animation</include> <include>$(WK_ROOT)/WebCore/platform</include> + <include>$(WK_ROOT)/WebCore/platform/animation</include> <include>$(WK_ROOT)/WebCore/platform/graphics</include> + <include>$(WK_ROOT)/WebCore/platform/graphics/transforms</include> <include>$(WK_ROOT)/WebCore/platform/image-decoders</include> <include>$(WK_ROOT)/WebCore/platform/image-decoders/gif</include> <include>$(WK_ROOT)/WebCore/platform/image-decoders/jpeg</include> @@ -133,11 +136,14 @@ and WebCore. Include this file to use these settings. <include>$(WK_ROOT)/WebCore/xml</include> <include>$(WK_ROOT)/JavaScriptCore</include> - <include>$(WK_ROOT)/JavaScriptCore/kjs</include> + <include>$(WK_ROOT)/JavaScriptCore/bytecode</include> + <include>$(WK_ROOT)/JavaScriptCore/bytecompiler</include> + <include>$(WK_ROOT)/JavaScriptCore/jit</include> + <include>$(WK_ROOT)/JavaScriptCore/parser</include> <include>$(WK_ROOT)/JavaScriptCore/pcre</include> <include>$(WK_ROOT)/JavaScriptCore/profiler</include> <include>$(WK_ROOT)/JavaScriptCore/runtime</include> - <include>$(WK_ROOT)/JavaScriptCore/VM</include> + <include>$(WK_ROOT)/JavaScriptCore/interpreter</include> <include>$(WK_ROOT)/JavaScriptCore/wtf</include> </template> |