From 7b4facebc53b7f2a0b9bd5cdd5e6fd53fe9acbc1 Mon Sep 17 00:00:00 2001 From: "aaronleventhal%moonset.net" Date: Fri, 18 Feb 2005 14:24:43 +0000 Subject: [PATCH] Bug 282588. MozillaContentWindowClass on frames and iframes confuses screen readers. r=ere, sr=neil --- layout/generic/nsFrameFrame.cpp | 13 +++++++++++-- widget/public/nsIWidget.h | 5 +++-- widget/src/windows/nsWindow.cpp | 13 +++++++++++++ widget/src/windows/nsWindow.h | 20 +++++++++++--------- 4 files changed, 38 insertions(+), 13 deletions(-) diff --git a/layout/generic/nsFrameFrame.cpp b/layout/generic/nsFrameFrame.cpp index 8f14d2d520d..eb753d9e46c 100644 --- a/layout/generic/nsFrameFrame.cpp +++ b/layout/generic/nsFrameFrame.cpp @@ -675,8 +675,17 @@ nsSubDocumentFrame::ShowDocShell() if (treeItem) { treeItem->GetItemType(&itemType); } - rv = CreateViewAndWidget(itemType == nsIDocShellTreeItem::typeChrome ? - eContentTypeUI : eContentTypeContent); + + nsContentType contentType; + if (itemType == nsIDocShellTreeItem::typeChrome) { + contentType = eContentTypeUI; + } + else { + nsCOMPtr sameTypeParent; + treeItem->GetSameTypeParent(getter_AddRefs(sameTypeParent)); + contentType = sameTypeParent ? eContentTypeContentFrame : eContentTypeContent; + } + rv = CreateViewAndWidget(contentType); if (NS_FAILED(rv)) { return rv; } diff --git a/widget/public/nsIWidget.h b/widget/public/nsIWidget.h index 216042f5643..f909aed47c1 100644 --- a/widget/public/nsIWidget.h +++ b/widget/public/nsIWidget.h @@ -209,8 +209,9 @@ enum nsCursor { ///(normal cursor, usually rendered as an arrow) enum nsContentType { eContentTypeInherit = -1, - eContentTypeUI = 0, // eContentTypeUI must equal 0 - eContentTypeContent = 1 // eContentTypeContent must equal 1 + eContentTypeUI = 0, + eContentTypeContent = 1, + eContentTypeContentFrame = 2 }; enum nsTopLevelWidgetZPlacement { // for PlaceBehind() diff --git a/widget/src/windows/nsWindow.cpp b/widget/src/windows/nsWindow.cpp index 72e506546d0..8aa4e9925e6 100644 --- a/widget/src/windows/nsWindow.cpp +++ b/widget/src/windows/nsWindow.cpp @@ -4281,6 +4281,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT nsToolkit::mGetClassName((HWND)wParam, className, kMaxClassNameLength); if (wcscmp(className, kWClassNameUI) && wcscmp(className, kWClassNameContent) && + wcscmp(className, kWClassNameContentFrame) && wcscmp(className, kWClassNameGeneral)) { isMozWindowTakingFocus = PR_FALSE; } @@ -4398,6 +4399,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT nsToolkit::mGetClassName((HWND)wParam, className, kMaxClassNameLength); if (wcscmp(className, kWClassNameUI) && wcscmp(className, kWClassNameContent) && + wcscmp(className, kWClassNameContentFrame) && wcscmp(className, kWClassNameGeneral)) { isMozWindowTakingFocus = PR_FALSE; } @@ -4791,6 +4793,11 @@ LPCWSTR nsWindow::WindowClassW() BOOL succeeded = nsToolkit::mRegisterClass(&wc) != 0; nsWindow::sIsRegistered = succeeded; + wc.lpszClassName = kWClassNameContentFrame; + if (!nsToolkit::mRegisterClass(&wc)) { + nsWindow::sIsRegistered = FALSE; + } + wc.lpszClassName = kWClassNameContent; if (!nsToolkit::mRegisterClass(&wc)) { nsWindow::sIsRegistered = FALSE; @@ -4817,6 +4824,9 @@ LPCWSTR nsWindow::WindowClassW() if (mContentType == eContentTypeContent) { return kWClassNameContent; } + if (mContentType == eContentTypeContentFrame) { + return kWClassNameContentFrame; + } if (mContentType == eContentTypeUI) { return kWClassNameUI; } @@ -4870,6 +4880,9 @@ LPCTSTR nsWindow::WindowClass() if (classNameW == kWClassNameContent) { return kClassNameContent; } + if (classNameW == kWClassNameContentFrame) { + return kClassNameContentFrame; + } return kClassNameGeneral; } diff --git a/widget/src/windows/nsWindow.h b/widget/src/windows/nsWindow.h index 16e4ba753ec..a1493739917 100644 --- a/widget/src/windows/nsWindow.h +++ b/widget/src/windows/nsWindow.h @@ -83,15 +83,17 @@ class nsIFile; * For example, changing the window classes * could break touchpad scrolling or screen readers. */ -const PRUint32 kMaxClassNameLength = 40; -const LPCWSTR kWClassNameHidden = L"MozillaHiddenWindowClass"; -const LPCWSTR kWClassNameUI = L"MozillaUIWindowClass"; -const LPCWSTR kWClassNameContent = L"MozillaContentWindowClass"; -const LPCWSTR kWClassNameGeneral = L"MozillaWindowClass"; -const LPCSTR kClassNameHidden = "MozillaHiddenWindowClass"; -const LPCSTR kClassNameUI = "MozillaUIWindowClass"; -const LPCSTR kClassNameContent = "MozillaContentWindowClass"; -const LPCSTR kClassNameGeneral = "MozillaWindowClass"; +const PRUint32 kMaxClassNameLength = 40; +const LPCWSTR kWClassNameHidden = L"MozillaHiddenWindowClass"; +const LPCWSTR kWClassNameUI = L"MozillaUIWindowClass"; +const LPCWSTR kWClassNameContent = L"MozillaContentWindowClass"; +const LPCWSTR kWClassNameContentFrame = L"MozillaContentFrameWindowClass"; +const LPCWSTR kWClassNameGeneral = L"MozillaWindowClass"; +const LPCSTR kClassNameHidden = "MozillaHiddenWindowClass"; +const LPCSTR kClassNameUI = "MozillaUIWindowClass"; +const LPCSTR kClassNameContent = "MozillaContentWindowClass"; +const LPCSTR kClassNameContentFrame = "MozillaContentFrameWindowClass"; +const LPCSTR kClassNameGeneral = "MozillaWindowClass"; /** * Native IMM wrapper