зеркало из https://github.com/mozilla/gecko-dev.git
Bug 160188. Accessibility: In Windows, use Control ID for a window to indicate whether the window is content or UI. r=saari,blythe, sr=hewitt
This commit is contained in:
Родитель
fbb97a63e6
Коммит
0f4ba024e4
|
@ -51,10 +51,10 @@ interface nsIDocShellTreeItem : nsISupports
|
|||
/*
|
||||
Definitions for the item types.
|
||||
*/
|
||||
const long typeChrome=0;
|
||||
const long typeContent=1;
|
||||
const long typeContentWrapper=2;
|
||||
const long typeChromeWrapper=3;
|
||||
const long typeChrome=0; // typeChrome must equal 0
|
||||
const long typeContent=1; // typeContent must equal 1
|
||||
const long typeContentWrapper=2; // typeContentWrapper must equal 2
|
||||
const long typeChromeWrapper=3; // typeChromeWrapper must equal 3
|
||||
|
||||
const long typeAll=0x7FFFFFFF;
|
||||
|
||||
|
|
|
@ -1035,6 +1035,7 @@ NS_IMETHODIMP nsWebBrowser::Create()
|
|||
nsWidgetInitData widgetInit;
|
||||
|
||||
widgetInit.clipChildren = PR_TRUE;
|
||||
widgetInit.mContentType = mContentType;
|
||||
widgetInit.mWindowType = eWindowType_child;
|
||||
nsRect bounds(mInitInfo->x, mInitInfo->y, mInitInfo->cx, mInitInfo->cy);
|
||||
|
||||
|
|
|
@ -69,6 +69,7 @@
|
|||
#include "nsIFrameManager.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsIRootBox.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#ifdef XP_WIN
|
||||
#include "nsISound.h"
|
||||
#endif
|
||||
|
@ -218,6 +219,7 @@ nsMenuPopupFrame::Init(nsIPresContext* aPresContext,
|
|||
// Create a widget for ourselves.
|
||||
nsWidgetInitData widgetData;
|
||||
widgetData.mWindowType = eWindowType_popup;
|
||||
widgetData.mContentType = nsIDocShellTreeItem::typeChrome;
|
||||
widgetData.mBorderStyle = eBorderStyle_default;
|
||||
widgetData.clipSiblings = PR_TRUE;
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ typedef void* nsNativeWidget;
|
|||
* Border styles
|
||||
*/
|
||||
|
||||
enum nsWindowType {
|
||||
enum nsWindowType { // Don't alter previously encoded enum values - 3rd party apps may look at these
|
||||
// default top level window
|
||||
eWindowType_toplevel,
|
||||
// top level window but usually handled differently by the OS
|
||||
|
@ -119,10 +119,9 @@ enum nsWindowType {
|
|||
// plugin window
|
||||
eWindowType_plugin,
|
||||
// java plugin window
|
||||
eWindowType_java
|
||||
eWindowType_java,
|
||||
};
|
||||
|
||||
|
||||
enum nsBorderStyle
|
||||
{
|
||||
// no border, titlebar, etc.. opposite of all
|
||||
|
@ -218,7 +217,8 @@ struct nsWidgetInitData {
|
|||
mDropShadow(PR_FALSE),
|
||||
mListenForResizes(PR_FALSE),
|
||||
mWindowType(eWindowType_child),
|
||||
mBorderStyle(eBorderStyle_default)
|
||||
mBorderStyle(eBorderStyle_default),
|
||||
mContentType(1) // nsIDocShellTreeItem::typeContent
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -227,6 +227,7 @@ struct nsWidgetInitData {
|
|||
PRPackedBool mListenForResizes;
|
||||
nsWindowType mWindowType;
|
||||
nsBorderStyle mBorderStyle;
|
||||
PRUint32 mContentType; // from nsIDocShellTreeItem.idl content types - typeChrome, typeContent, etc.
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -1506,6 +1506,16 @@ nsresult nsWindow::StandardWindowCreate(nsIWidget *aParent,
|
|||
}
|
||||
}*/
|
||||
|
||||
// Show nsIDocShellTreeItem::contentType in GWL_ID
|
||||
// This way 3rd part apps can check if a window is chrome (0) or content (1)
|
||||
LONG contentType = aInitData? aInitData->mContentType: (parent? ::GetWindowLong(parent, GWL_ID): -1);
|
||||
LONG isContent = (contentType == 1 || contentType == 2);
|
||||
#ifdef MOZ_UNICODE
|
||||
::SetWindowLongW(mWnd, GWL_ID, contentType);
|
||||
#else
|
||||
::SetWindowLong(mWnd, GWL_ID, contentType);
|
||||
#endif
|
||||
|
||||
// call the event callback to notify about creation
|
||||
|
||||
DispatchStandardEvent(NS_CREATE);
|
||||
|
@ -2921,31 +2931,41 @@ BOOL nsWindow::OnKeyDown( UINT aVirtualKeyCode, UINT aScanCode, LPARAM aKeyData)
|
|||
else if (mIsControlDown && aVirtualKeyCode == VK_BACK) {
|
||||
DispatchKeyEvent(NS_KEY_PRESS, 0, VK_BACK, aKeyData);
|
||||
}
|
||||
else if (mIsControlDown && !mIsShiftDown && aVirtualKeyCode == NS_VK_SUBTRACT) {
|
||||
DispatchKeyEvent(NS_KEY_PRESS, '-', 0, aKeyData);
|
||||
}
|
||||
else if (mIsControlDown && !mIsShiftDown && aVirtualKeyCode == NS_VK_ADD) {
|
||||
DispatchKeyEvent(NS_KEY_PRESS, '+', 0, aKeyData);
|
||||
}
|
||||
else if ((mIsControlDown && !mIsShiftDown) &&
|
||||
((( NS_VK_0 <= aVirtualKeyCode) && (aVirtualKeyCode <= NS_VK_9)) ||
|
||||
(aVirtualKeyCode == NS_VK_ADD) ||
|
||||
(aVirtualKeyCode == NS_VK_SUBTRACT) ||
|
||||
(aVirtualKeyCode == NS_VK_SEMICOLON) ||
|
||||
(aVirtualKeyCode == NS_VK_EQUALS) ||
|
||||
(aVirtualKeyCode == NS_VK_COMMA) ||
|
||||
(aVirtualKeyCode == NS_VK_PERIOD) ||
|
||||
(aVirtualKeyCode == NS_VK_QUOTE) ||
|
||||
(aVirtualKeyCode == NS_VK_BACK_QUOTE) ||
|
||||
(aVirtualKeyCode == NS_VK_SLASH)
|
||||
)
|
||||
)
|
||||
{
|
||||
// put the 0 - 9 in charcode instead of keycode.
|
||||
DispatchKeyEvent(NS_KEY_PRESS, aVirtualKeyCode, 0, aKeyData);
|
||||
switch (aVirtualKeyCode) {
|
||||
case NS_VK_ADD : asciiKey = '+'; break;
|
||||
case NS_VK_SUBTRACT : asciiKey = '-'; break;
|
||||
case NS_VK_SEMICOLON : asciiKey = ';'; break;
|
||||
case NS_VK_EQUALS : asciiKey = '='; break;
|
||||
case NS_VK_COMMA : asciiKey = ','; break;
|
||||
case NS_VK_PERIOD : asciiKey = '.'; break;
|
||||
case NS_VK_QUOTE : asciiKey = '\''; break;
|
||||
case NS_VK_BACK_QUOTE: asciiKey = '`'; break;
|
||||
case NS_VK_SLASH : asciiKey = '/'; break;
|
||||
// NS_VK_0 - NS_VK9 line up exactly with ascii '0' - '9'
|
||||
default : asciiKey = aVirtualKeyCode; break;
|
||||
}
|
||||
// put the ascii character in charcode instead of using keycode.
|
||||
DispatchKeyEvent(NS_KEY_PRESS, asciiKey, 0, aKeyData);
|
||||
}
|
||||
else if (NO_WM_CHAR_LATER(aVirtualKeyCode) &&
|
||||
(aVirtualKeyCode != NS_VK_SEMICOLON) &&
|
||||
(aVirtualKeyCode != NS_VK_EQUALS) &&
|
||||
(aVirtualKeyCode != NS_VK_COMMA) &&
|
||||
(aVirtualKeyCode != NS_VK_PERIOD) &&
|
||||
(aVirtualKeyCode != NS_VK_SLASH))
|
||||
(aVirtualKeyCode != NS_VK_PERIOD))
|
||||
{
|
||||
DispatchKeyEvent(NS_KEY_PRESS, 0, aVirtualKeyCode, aKeyData);
|
||||
}
|
||||
|
|
|
@ -632,6 +632,7 @@ nsAppShellService::JustCreateTopWindow(nsIXULWindow *aParent,
|
|||
if (aChromeMask & nsIWebBrowserChrome::CHROME_WINDOW_POPUP)
|
||||
widgetInitData.mWindowType = eWindowType_popup;
|
||||
|
||||
widgetInitData.mContentType = nsIDocShellTreeItem::typeChrome;
|
||||
|
||||
// note default chrome overrides other OS chrome settings, but
|
||||
// not internal chrome
|
||||
|
|
|
@ -439,6 +439,7 @@ XRemoteService::CreateProxyWindow(void)
|
|||
|
||||
nsWidgetInitData initData;
|
||||
initData.mWindowType = eWindowType_toplevel;
|
||||
initData.mContentType = nsIDocShellTreeItem::typeChrome;
|
||||
|
||||
// create the window as a new toplevel
|
||||
nsRect rect(0,0,100,100);
|
||||
|
|
Загрузка…
Ссылка в новой задаче