diff options
Diffstat (limited to 'WebKit/wx')
| -rw-r--r-- | WebKit/wx/ChangeLog | 66 | ||||
| -rw-r--r-- | WebKit/wx/WebFrame.cpp | 6 | ||||
| -rw-r--r-- | WebKit/wx/WebFrame.h | 2 | ||||
| -rw-r--r-- | WebKit/wx/WebKitSupport/FrameLoaderClientWx.h | 1 | ||||
| -rw-r--r-- | WebKit/wx/WebView.cpp | 89 | ||||
| -rw-r--r-- | WebKit/wx/WebView.h | 7 | ||||
| -rw-r--r-- | WebKit/wx/wscript | 12 |
7 files changed, 162 insertions, 21 deletions
diff --git a/WebKit/wx/ChangeLog b/WebKit/wx/ChangeLog index 6e04904..4f09956 100644 --- a/WebKit/wx/ChangeLog +++ b/WebKit/wx/ChangeLog @@ -1,3 +1,69 @@ +2010-05-03 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Build and use Mac's ComplexTextController to support complex text in wx. + https://bugs.webkit.org/show_bug.cgi?id=38482 + + * WebView.cpp: + (wxWebView::Create): + * wscript: + +2010-05-03 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Provide access to GrantUniversalAccess to allow enabling of XSS support. + https://bugs.webkit.org/show_bug.cgi?id=38481 + + * WebFrame.cpp: + (wxWebFrame::GrantUniversalAccess): + * WebFrame.h: + * WebView.cpp: + (wxWebView::GetParseMode): + (wxWebView::GrantUniversalAccess): + * WebView.h: + +2010-05-03 Jens Alfke <snej@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Add "willSendSubmitEvent" hook to WebFrameClient and FrameLoaderClient + https://bugs.webkit.org/show_bug.cgi?id=38397 + + No tests (functionality is exposed only through native WebKit API.) + + * WebKitSupport/FrameLoaderClientWx.h: + (WebCore::FrameLoaderClientWx::dispatchWillSendSubmitEvent): + +2010-04-25 Sam Weinig <sam@webkit.org> + + Reviewed by Maciej Stachowiak. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=38097 + Disentangle initializing the main thread from initializing threading + + * WebView.cpp: + (wxWebView::Create): Add call to initializeMainThread. + +2010-04-25 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Update focus handling code to match current approaches used by other platforms, + and fix focus handling for corner cases such as when a mouse down pops up a dialog. + + https://bugs.webkit.org/show_bug.cgi?id=38086 + + * WebView.cpp: + (wxWebView::Create): + (wxWebView::OnTLWActivated): + (wxWebView::OnPaint): + (wxWebView::OnMouseEvents): + (wxWebView::OnSetFocus): + (wxWebView::OnKillFocus): + * WebView.h: + 2010-04-20 Adam Barth <abarth@webkit.org> Reviewed by Eric Seidel. diff --git a/WebKit/wx/WebFrame.cpp b/WebKit/wx/WebFrame.cpp index 78427e4..2515de4 100644 --- a/WebKit/wx/WebFrame.cpp +++ b/WebKit/wx/WebFrame.cpp @@ -426,3 +426,9 @@ wxWebKitParseMode wxWebFrame::GetParseMode() const return NoDocument; } + +void wxWebFrame::GrantUniversalAccess() +{ + if (m_impl->frame && m_impl->frame->document()) + m_impl->frame->document()->securityOrigin()->grantUniversalAccess(); +} diff --git a/WebKit/wx/WebFrame.h b/WebKit/wx/WebFrame.h index 95a0691..fec6257 100644 --- a/WebKit/wx/WebFrame.h +++ b/WebKit/wx/WebFrame.h @@ -146,6 +146,8 @@ public: wxWebKitParseMode GetParseMode() const; + void GrantUniversalAccess(); + private: float m_textMagnifier; bool m_isEditable; diff --git a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h index e9f566b..95ef2e6 100644 --- a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h +++ b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h @@ -113,6 +113,7 @@ namespace WebCore { virtual void dispatchShow(); virtual void cancelPolicyCheck(); + virtual void dispatchWillSendSubmitEvent(HTMLFormElement*) { } virtual void dispatchWillSubmitForm(FramePolicyFunction, PassRefPtr<FormState>); virtual void dispatchDidLoadMainResource(DocumentLoader*); diff --git a/WebKit/wx/WebView.cpp b/WebKit/wx/WebView.cpp index 95730b9..cfa402f 100644 --- a/WebKit/wx/WebView.cpp +++ b/WebKit/wx/WebView.cpp @@ -254,6 +254,13 @@ wxWebViewCachePolicy wxWebView::GetCachePolicy() return gs_cachePolicy; } +#if OS(DARWIN) +// prototype - function is in WebKitSystemInterface.mm +extern "C" { +void InitWebCoreSystemInterface(void); +} +#endif + BEGIN_EVENT_TABLE(wxWebView, wxWindow) EVT_PAINT(wxWebView::OnPaint) EVT_SIZE(wxWebView::OnSize) @@ -295,6 +302,10 @@ wxWebView::wxWebView(wxWindow* parent, int id, const wxPoint& position, bool wxWebView::Create(wxWindow* parent, int id, const wxPoint& position, const wxSize& size, long style, const wxString& name) { +#if OS(DARWIN) + InitWebCoreSystemInterface(); +#endif + if ( (style & wxBORDER_MASK) == 0) style |= wxBORDER_NONE; @@ -302,6 +313,7 @@ bool wxWebView::Create(wxWindow* parent, int id, const wxPoint& position, return false; WTF::initializeThreading(); + WTF::initializeMainThread(); // This is necessary because we are using SharedTimerWin.cpp on Windows, // due to a problem with exceptions getting eaten when using the callback @@ -340,6 +352,9 @@ bool wxWebView::Create(wxWindow* parent, int id, const wxPoint& position, SetDatabasesEnabled(true); #endif + wxWindow* tlw = wxGetTopLevelParent(this); + tlw->Connect(-1, wxEVT_ACTIVATE, wxActivateEventHandler(wxWebView::OnTLWActivated)); + m_isInitialized = true; return true; @@ -359,6 +374,15 @@ wxWebView::~wxWebView() m_impl->page = 0; } +void wxWebView::OnTLWActivated(wxActivateEvent& event) +{ + if (m_impl && m_impl->page && m_impl->page->focusController()) + m_impl->page->focusController()->setActive(event.GetActive()); + + event.Skip(); + +} + void wxWebView::Stop() { if (m_mainFrame) @@ -528,13 +552,6 @@ void wxWebView::OnPaint(wxPaintEvent& event) if (m_beingDestroyed || !m_mainFrame) return; - // WebView active state is based on TLW active state. - wxTopLevelWindow* tlw = dynamic_cast<wxTopLevelWindow*>(wxGetTopLevelParent(this)); - if (tlw && tlw->IsActive()) - m_impl->page->focusController()->setActive(true); - else { - m_impl->page->focusController()->setActive(false); - } WebCore::Frame* frame = m_mainFrame->GetFrame(); if (!frame || !frame->view()) return; @@ -620,6 +637,21 @@ void wxWebView::OnMouseEvents(wxMouseEvent& event) return; } + // If an event, such as a right-click event, leads to a focus change (e.g. it + // raises a dialog), WebKit never gets the mouse up event and never relinquishes + // mouse capture. This leads to WebKit handling mouse events, such as modifying + // the selection, while other controls or top level windows have the focus. + // I'm not sure if this is the right place to handle this, but I can't seem to + // find a precedent on how to handle this in other ports. + if (wxWindow::FindFocus() != this) { + while (HasCapture()) + ReleaseMouse(); + + frame->eventHandler()->setMousePressed(false); + + return; + } + int clickCount = event.ButtonDClick() ? 2 : 1; if (clickCount == 1 && m_impl->tripleClickTimer.IsRunning()) { @@ -882,26 +914,35 @@ void wxWebView::OnKeyEvents(wxKeyEvent& event) void wxWebView::OnSetFocus(wxFocusEvent& event) { - WebCore::Frame* frame = 0; - if (m_mainFrame) - frame = m_mainFrame->GetFrame(); - - if (frame) { - frame->selection()->setFocused(true); - } + if (m_impl && m_impl->page && m_impl->page->focusController()) { + m_impl->page->focusController()->setFocused(true); + m_impl->page->focusController()->setActive(true); + if (!m_impl->page->focusController()->focusedFrame() && m_mainFrame) + m_impl->page->focusController()->setFocusedFrame(m_mainFrame->GetFrame()); + } + event.Skip(); } void wxWebView::OnKillFocus(wxFocusEvent& event) { - WebCore::Frame* frame = 0; - if (m_mainFrame) - frame = m_mainFrame->GetFrame(); - - if (frame) { - frame->selection()->setFocused(false); + if (m_impl && m_impl->page && m_impl->page->focusController()) { + m_impl->page->focusController()->setFocused(false); + + // We also handle active state in OnTLWActivated, but if a user does not + // call event.Skip() in their own EVT_ACTIVATE handler, we won't get those + // callbacks. So we handle active state here as well as a fallback. + wxTopLevelWindow* tlw = dynamic_cast<wxTopLevelWindow*>(wxGetTopLevelParent(this)); + if (tlw && tlw->IsActive()) + m_impl->page->focusController()->setActive(true); + else + m_impl->page->focusController()->setActive(false); } + + while (HasCapture()) + ReleaseMouse(); + event.Skip(); } @@ -997,4 +1038,10 @@ wxWebKitParseMode wxWebView::GetParseMode() const return m_mainFrame->GetParseMode(); return NoDocument; -}
\ No newline at end of file +} + +void wxWebView::GrantUniversalAccess() +{ + if (m_mainFrame) + m_mainFrame->GrantUniversalAccess(); +} diff --git a/WebKit/wx/WebView.h b/WebKit/wx/WebView.h index f7b41dc..075deaf 100644 --- a/WebKit/wx/WebView.h +++ b/WebKit/wx/WebView.h @@ -214,6 +214,12 @@ public: wxWebSettings GetWebSettings(); wxWebKitParseMode GetParseMode() const; + + /* + This method allows cross site-scripting (XSS) in the WebView. + Use with caution! + */ + void GrantUniversalAccess(); protected: @@ -226,6 +232,7 @@ protected: void OnKeyEvents(wxKeyEvent& event); void OnSetFocus(wxFocusEvent& event); void OnKillFocus(wxFocusEvent& event); + void OnTLWActivated(wxActivateEvent& event); private: // any class wishing to process wxWindows events must use this macro diff --git a/WebKit/wx/wscript b/WebKit/wx/wscript index b5ba580..61fa903 100644 --- a/WebKit/wx/wscript +++ b/WebKit/wx/wscript @@ -81,6 +81,13 @@ def pre_build(bld): bld.env.CXXDEPS_WEBCORE = Utils.h_file(libwebcore) def build(bld): + + import TaskGen + + if sys.platform.startswith('darwin'): + TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cxx'] + TaskGen.task_gen.mappings['.m'] = TaskGen.task_gen.mappings['.cxx'] + bld.add_pre_fun(pre_build) bld.env.LIBDIR = output_dir @@ -95,6 +102,11 @@ def build(bld): uselib_local = '', install_path = output_dir) + exts = ['.c', '.cpp'] + if sys.platform.startswith('darwin'): + exts.append('.mm') + obj.includes += '../mac/WebCoreSupport ../../WebCore/platform/mac' + obj.source = "../mac/WebCoreSupport/WebSystemInterface.m" obj.find_sources_in_dirs(webkit_dirs) if building_on_win32: |
