Remember the currently focused view within a tab in the user data that can be

associated with a BWebView and restore the focus when the tab changes. This fixes
a number of annoying issues.

git-svn-id: http://svn.haiku-os.org/webpositive/webkit/trunk@391 94f232f2-1747-11df-bad5-a5bfde151594
This commit is contained in:
stippi
2012-07-03 15:39:45 +02:00
committed by Alexandre Deckner
parent 65e61cdca4
commit 0145cf4349
+28
View File
@@ -236,6 +236,24 @@ public:
};
class PageUserData : public BWebView::UserData {
public:
PageUserData(BView* focusedView)
:
fFocusedView(focusedView)
{
}
BView* FocusedView() const
{
return fFocusedView;
}
private:
BView* fFocusedView;
};
// #pragma mark - BrowserWindow
@@ -1173,7 +1191,17 @@ BrowserWindow::_TabChanged(int32 index)
BWebView* webView = dynamic_cast<BWebView*>(fTabManager->ViewForTab(index));
if (webView == CurrentWebView())
return;
CurrentWebView()->SetUserData(new PageUserData(CurrentFocus()));
SetCurrentWebView(webView);
PageUserData* userData = static_cast<PageUserData*>(webView->GetUserData());
if (userData)
userData->FocusedView()->MakeFocus(true);
else
webView->MakeFocus(true);
if (webView)
_UpdateTitle(webView->MainFrameTitle());
else