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:
committed by
Alexandre Deckner
parent
65e61cdca4
commit
0145cf4349
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user