зеркало из https://github.com/mozilla/pjs.git
Fix for focus & tabbing problems in the ActiveX control. b=88081 r=saari@netscape.com sr=rpotts@netscape.com
This commit is contained in:
Родитель
9dcce23fd4
Коммит
14ce20258b
|
@ -61,6 +61,7 @@
|
|||
#include "nsIPrintOptions.h"
|
||||
#include "nsIWebBrowserPrint.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsIWebBrowserFocus.h"
|
||||
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsIDOMHTMLAnchorElement.h"
|
||||
|
@ -369,6 +370,32 @@ HRESULT CMozillaBrowser::SetErrorInfo(LPCTSTR lpszDesc, HRESULT hr)
|
|||
}
|
||||
|
||||
|
||||
//
|
||||
// Tells the container to change focus to the next control in the dialog.
|
||||
//
|
||||
void CMozillaBrowser::NextDlgControl()
|
||||
{
|
||||
HWND hwndParent = GetParent();
|
||||
if (::IsWindow(hwndParent))
|
||||
{
|
||||
::PostMessage(hwndParent, WM_NEXTDLGCTL, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Tells the container to change focus to the previous control in the dialog.
|
||||
//
|
||||
void CMozillaBrowser::PrevDlgControl()
|
||||
{
|
||||
HWND hwndParent = GetParent();
|
||||
if (::IsWindow(hwndParent))
|
||||
{
|
||||
::PostMessage(hwndParent, WM_NEXTDLGCTL, 1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Message handlers
|
||||
|
||||
|
@ -378,12 +405,6 @@ LRESULT CMozillaBrowser::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL&
|
|||
{
|
||||
NG_TRACE_METHOD(CMozillaBrowser::OnCreate);
|
||||
|
||||
// Clip the child windows out of paint operations
|
||||
SetWindowLong(GWL_STYLE, GetWindowLong(GWL_STYLE) | WS_CLIPCHILDREN);
|
||||
|
||||
// Turn on the 3d border
|
||||
// SetWindowLong(GWL_EXSTYLE, GetWindowLong(GWL_EXSTYLE) | WS_EX_CLIENTEDGE);
|
||||
|
||||
// Create the NGLayout WebShell
|
||||
CreateBrowser();
|
||||
|
||||
|
@ -407,6 +428,9 @@ LRESULT CMozillaBrowser::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL&
|
|||
}
|
||||
}
|
||||
|
||||
// Clip the child windows out of paint operations
|
||||
SetWindowLong(GWL_STYLE, GetWindowLong(GWL_STYLE) | WS_CLIPCHILDREN | WS_TABSTOP);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -453,6 +477,51 @@ LRESULT CMozillaBrowser::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& b
|
|||
return 0;
|
||||
}
|
||||
|
||||
// Handle WM_SETFOCUS
|
||||
LRESULT CMozillaBrowser::OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
ATLTRACE(_T("CMozillaBrowser::OnSetFocus()\n"));
|
||||
nsCOMPtr<nsIWebBrowserFocus> browserAsFocus = do_QueryInterface(mWebBrowser);
|
||||
if (browserAsFocus)
|
||||
{
|
||||
browserAsFocus->Activate();
|
||||
}
|
||||
CComQIPtr<IOleControlSite> controlSite = m_spClientSite;
|
||||
if (controlSite)
|
||||
{
|
||||
controlSite->OnFocus(TRUE);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Handle WM_KILLFOCUS
|
||||
LRESULT CMozillaBrowser::OnKillFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
ATLTRACE(_T("CMozillaBrowser::OnKillFocus()\n"));
|
||||
nsCOMPtr<nsIWebBrowserFocus> browserAsFocus = do_QueryInterface(mWebBrowser);
|
||||
if (browserAsFocus)
|
||||
{
|
||||
browserAsFocus->Deactivate();
|
||||
}
|
||||
CComQIPtr<IOleControlSite> controlSite = m_spClientSite;
|
||||
if (controlSite)
|
||||
{
|
||||
controlSite->OnFocus(FALSE);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Handle WM_MOUSEACTIVATE messages
|
||||
LRESULT CMozillaBrowser::OnMouseActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
return MA_ACTIVATE;
|
||||
}
|
||||
|
||||
// Handle WM_GETDLGCODE to receive keyboard presses
|
||||
LRESULT CMozillaBrowser::OnGetDlgCode(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
return DLGC_WANTALLKEYS;
|
||||
}
|
||||
|
||||
// Handle WM_PAINT windows message (and IViewObject::Draw)
|
||||
HRESULT CMozillaBrowser::OnDraw(ATL_DRAWINFO& di)
|
||||
|
@ -1058,6 +1127,10 @@ HRESULT CMozillaBrowser::CreateBrowser()
|
|||
// Visible
|
||||
mWebBrowserAsWin->SetVisibility(PR_TRUE);
|
||||
|
||||
// Activated
|
||||
nsCOMPtr<nsIWebBrowserFocus> browserAsFocus = do_QueryInterface(mWebBrowser);
|
||||
browserAsFocus->Activate();
|
||||
|
||||
// Append browser to browser list
|
||||
sBrowserList.AppendElement(this);
|
||||
|
||||
|
|
|
@ -170,6 +170,8 @@ BEGIN_MSG_MAP(CMozillaBrowser)
|
|||
MESSAGE_HANDLER(WM_PAINT, OnPaint)
|
||||
MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus)
|
||||
MESSAGE_HANDLER(WM_KILLFOCUS, OnKillFocus)
|
||||
MESSAGE_HANDLER(WM_GETDLGCODE, OnGetDlgCode)
|
||||
MESSAGE_HANDLER(WM_MOUSEACTIVATE, OnMouseActivate)
|
||||
COMMAND_ID_HANDLER(ID_PRINT, OnPrint)
|
||||
COMMAND_ID_HANDLER(ID_PAGESETUP, OnPageSetup)
|
||||
COMMAND_ID_HANDLER(ID_SAVEAS, OnSaveAs)
|
||||
|
@ -315,6 +317,11 @@ END_OLECOMMAND_TABLE()
|
|||
LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnKillFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnGetDlgCode(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnMouseActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
|
||||
LRESULT OnPrint(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
|
||||
LRESULT OnPageSetup(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
|
||||
LRESULT OnViewSource(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
|
||||
|
@ -409,6 +416,8 @@ protected:
|
|||
virtual int MessageBox(LPCTSTR lpszText, LPCTSTR lpszCaption = _T(""), UINT nType = MB_OK);
|
||||
virtual void ShowContextMenu(PRUint32 aContextFlags, nsIDOMEvent *aEvent, nsIDOMNode *aNode);
|
||||
virtual void ShowURIPropertyDlg(const nsString &aURI);
|
||||
virtual void NextDlgControl();
|
||||
virtual void PrevDlgControl();
|
||||
|
||||
public:
|
||||
// IOleObjectImpl overrides
|
||||
|
|
|
@ -76,6 +76,7 @@ NS_INTERFACE_MAP_BEGIN(CWebBrowserContainer)
|
|||
NS_INTERFACE_MAP_ENTRY(nsIRequestObserver)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIContextMenuListener)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChromeFocus)
|
||||
// NS_INTERFACE_MAP_ENTRY(nsICommandHandler)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
@ -527,6 +528,26 @@ CWebBrowserContainer::SetVisibility(PRBool aVisibility)
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsIWebBrowserChromeFocus implementation
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebBrowserContainer::FocusNextElement()
|
||||
{
|
||||
ATLTRACE(_T("CWebBrowserContainer::FocusNextElement()\n"));
|
||||
m_pOwner->NextDlgControl();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebBrowserContainer::FocusPrevElement()
|
||||
{
|
||||
ATLTRACE(_T("CWebBrowserContainer::FocusPrevElement()\n"));
|
||||
m_pOwner->PrevDlgControl();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsIWebBrowserChrome implementation
|
||||
|
||||
|
|
|
@ -40,9 +40,11 @@
|
|||
#define WEBBROWSERCONTAINER_H
|
||||
|
||||
#include "nsIContextMenuListener.h"
|
||||
#include "nsITooltipListener.h"
|
||||
#include "nsICommandHandler.h"
|
||||
#include "nsIEmbeddingSiteWindow.h"
|
||||
#include "nsIURIContentListener.h"
|
||||
#include "nsIWebBrowserChromeFocus.h"
|
||||
#include "nsWeakReference.h"
|
||||
|
||||
|
||||
|
@ -58,6 +60,7 @@ class CWebBrowserContainer :
|
|||
public nsIInterfaceRequestor,
|
||||
public nsIContextMenuListener,
|
||||
public nsICommandHandler,
|
||||
public nsIWebBrowserChromeFocus,
|
||||
public nsSupportsWeakReference
|
||||
{
|
||||
public:
|
||||
|
@ -76,7 +79,6 @@ protected:
|
|||
CDWebBrowserEvents1 *m_pEvents1;
|
||||
CDWebBrowserEvents2 *m_pEvents2;
|
||||
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIEMBEDDINGSITEWINDOW
|
||||
|
@ -86,6 +88,7 @@ public:
|
|||
NS_DECL_NSIINTERFACEREQUESTOR
|
||||
NS_DECL_NSIWEBPROGRESSLISTENER
|
||||
NS_DECL_NSICONTEXTMENULISTENER
|
||||
NS_DECL_NSIWEBBROWSERCHROMEFOCUS
|
||||
NS_DECL_NSICOMMANDHANDLER
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче