From 4978460d4c30ef99888faa5b5ccff23aae316d4d Mon Sep 17 00:00:00 2001 From: stippi Date: Thu, 25 Feb 2010 18:50:51 +0000 Subject: [PATCH] Implement creating new pages properly. This fixes content submission on haiku-os.org and probably a few other things. Basically, we were creating the new pages ourselves in dispatchDecidePolicyForNewWindowAction(), but we were meant to implement dispatchCreatePage() instead. Now, what we do is similar for the Qt port, only better (found a bug in Arora): When the user clicked with the tertiary mouse button, we create the window ourselves, as before, and otherwise always have WebCore create the page instead. git-svn-id: http://svn.haiku-os.org/webpositive/webkit/trunk@218 94f232f2-1747-11df-bad5-a5bfde151594 --- src/apps/webpositive/LauncherWindow.cpp | 10 ++++++++-- src/apps/webpositive/LauncherWindow.h | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/apps/webpositive/LauncherWindow.cpp b/src/apps/webpositive/LauncherWindow.cpp index 7752ac0eb3..4f0dcc143a 100644 --- a/src/apps/webpositive/LauncherWindow.cpp +++ b/src/apps/webpositive/LauncherWindow.cpp @@ -416,10 +416,11 @@ void LauncherWindow::MenusBeginning() history->Unlock(); } -void LauncherWindow::newTab(const BString& url, bool select) +void LauncherWindow::newTab(const BString& url, bool select, BWebView* webView) { // Executed in app thread (new BWebPage needs to be created in app thread). - BWebView* webView = new BWebView("web_view"); + if (!webView) + webView = new BWebView("web view"); webView->WebPage()->SetDownloadListener(m_downloadListener); m_tabView->AddTab(webView); @@ -459,6 +460,11 @@ void LauncherWindow::NewWindowRequested(const BString& url, bool primaryAction) be_app->PostMessage(&message); } +void LauncherWindow::NewPageCreated(BWebView* view) +{ + newTab(BString(), true, view); +} + void LauncherWindow::LoadNegotiating(const BString& url, BWebView* view) { BString status("Requesting: "); diff --git a/src/apps/webpositive/LauncherWindow.h b/src/apps/webpositive/LauncherWindow.h index ba7b611bc2..97b28f1123 100644 --- a/src/apps/webpositive/LauncherWindow.h +++ b/src/apps/webpositive/LauncherWindow.h @@ -68,12 +68,13 @@ public: virtual bool QuitRequested(); virtual void MenusBeginning(); - void newTab(const BString& url, bool select); + void newTab(const BString& url, bool select, BWebView* webView = 0); private: // WebPage notification API implementations virtual void NavigationRequested(const BString& url, BWebView* view); virtual void NewWindowRequested(const BString& url, bool primaryAction); + virtual void NewPageCreated(BWebView* view); virtual void LoadNegotiating(const BString& url, BWebView* view); virtual void LoadCommitted(const BString& url, BWebView* view); virtual void LoadProgress(float progress, BWebView* view);