зеркало из https://github.com/mozilla/pjs.git
Bug 242799. Fix touchpad scrolling but keep support for screen reader behavior based on class names. r=ere, sr=roc
This commit is contained in:
Родитель
1c42a452c3
Коммит
273397a135
|
@ -1912,26 +1912,12 @@ DocumentViewerImpl::MakeWindow(nsIWidget* aParentWidget,
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem(do_QueryInterface(mContainer));
|
||||
NS_ENSURE_TRUE(treeItem, NS_ERROR_FAILURE);
|
||||
PRInt32 itemType;
|
||||
nsContentType contentType = eContentTypeUI;
|
||||
treeItem->GetItemType(&itemType);
|
||||
if (itemType == nsIDocShellTreeItem::typeContent ||
|
||||
itemType == nsIDocShellTreeItem::typeContentWrapper) {
|
||||
#ifdef MOZ_XUL
|
||||
nsCOMPtr<nsIXULDocument> xulDoc(do_QueryInterface(mDocument));
|
||||
if (!xulDoc)
|
||||
#endif
|
||||
contentType = eContentTypeContent;
|
||||
}
|
||||
|
||||
// pass in a native widget to be the parent widget ONLY if the view hierarchy will stand alone.
|
||||
// otherwise the view will find its own parent widget and "do the right thing" to
|
||||
// establish a parent/child widget relationship
|
||||
rv = view->CreateWidget(kWidgetCID, nsnull,
|
||||
containerView != nsnull ? nsnull : aParentWidget->GetNativeData(NS_NATIVE_WIDGET),
|
||||
PR_TRUE, PR_FALSE, contentType);
|
||||
PR_TRUE, PR_FALSE);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
|
|
@ -1912,26 +1912,12 @@ DocumentViewerImpl::MakeWindow(nsIWidget* aParentWidget,
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem(do_QueryInterface(mContainer));
|
||||
NS_ENSURE_TRUE(treeItem, NS_ERROR_FAILURE);
|
||||
PRInt32 itemType;
|
||||
nsContentType contentType = eContentTypeUI;
|
||||
treeItem->GetItemType(&itemType);
|
||||
if (itemType == nsIDocShellTreeItem::typeContent ||
|
||||
itemType == nsIDocShellTreeItem::typeContentWrapper) {
|
||||
#ifdef MOZ_XUL
|
||||
nsCOMPtr<nsIXULDocument> xulDoc(do_QueryInterface(mDocument));
|
||||
if (!xulDoc)
|
||||
#endif
|
||||
contentType = eContentTypeContent;
|
||||
}
|
||||
|
||||
// pass in a native widget to be the parent widget ONLY if the view hierarchy will stand alone.
|
||||
// otherwise the view will find its own parent widget and "do the right thing" to
|
||||
// establish a parent/child widget relationship
|
||||
rv = view->CreateWidget(kWidgetCID, nsnull,
|
||||
containerView != nsnull ? nsnull : aParentWidget->GetNativeData(NS_NATIVE_WIDGET),
|
||||
PR_TRUE, PR_FALSE, contentType);
|
||||
PR_TRUE, PR_FALSE);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ protected:
|
|||
PRBool IsInline() { return mIsInline; }
|
||||
nsresult ReloadURL();
|
||||
nsresult ShowDocShell();
|
||||
nsresult CreateViewAndWidget();
|
||||
nsresult CreateViewAndWidget(nsContentType aContentType);
|
||||
|
||||
virtual void GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
|
@ -275,7 +275,7 @@ nsSubDocumentFrame::Init(nsIPresContext* aPresContext,
|
|||
do_QueryInterface(aPresContext);
|
||||
|
||||
if (thePrintPreviewContext) {
|
||||
rv = CreateViewAndWidget();
|
||||
rv = CreateViewAndWidget(eContentTypeContent);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
// we are in PrintPreview
|
||||
|
@ -682,7 +682,13 @@ nsSubDocumentFrame::ShowDocShell()
|
|||
scrollY);
|
||||
}
|
||||
|
||||
rv = CreateViewAndWidget();
|
||||
PRInt32 itemType = nsIDocShellTreeItem::typeContent;
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem(do_QueryInterface(docShell));
|
||||
if (treeItem) {
|
||||
treeItem->GetItemType(&itemType);
|
||||
}
|
||||
rv = CreateViewAndWidget(itemType == nsIDocShellTreeItem::typeChrome ?
|
||||
eContentTypeUI : eContentTypeContent);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -705,7 +711,7 @@ nsSubDocumentFrame::ShowDocShell()
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsSubDocumentFrame::CreateViewAndWidget()
|
||||
nsSubDocumentFrame::CreateViewAndWidget(nsContentType aContentType)
|
||||
{
|
||||
// create, init, set the parent of the view
|
||||
nsIView* innerView;
|
||||
|
@ -730,7 +736,8 @@ nsSubDocumentFrame::CreateViewAndWidget()
|
|||
initData.clipChildren = PR_TRUE;
|
||||
initData.clipSiblings = PR_TRUE;
|
||||
|
||||
return innerView->CreateWidget(kCChildCID, nsnull, nsnull, PR_TRUE, PR_TRUE);
|
||||
return innerView->CreateWidget(kCChildCID, nsnull, nsnull, PR_TRUE, PR_TRUE,
|
||||
aContentType);
|
||||
}
|
||||
|
||||
// load a new url
|
||||
|
|
|
@ -154,7 +154,7 @@ protected:
|
|||
PRBool IsInline() { return mIsInline; }
|
||||
nsresult ReloadURL();
|
||||
nsresult ShowDocShell();
|
||||
nsresult CreateViewAndWidget();
|
||||
nsresult CreateViewAndWidget(nsContentType aContentType);
|
||||
|
||||
virtual void GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
|
@ -275,7 +275,7 @@ nsSubDocumentFrame::Init(nsIPresContext* aPresContext,
|
|||
do_QueryInterface(aPresContext);
|
||||
|
||||
if (thePrintPreviewContext) {
|
||||
rv = CreateViewAndWidget();
|
||||
rv = CreateViewAndWidget(eContentTypeContent);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
// we are in PrintPreview
|
||||
|
@ -682,7 +682,13 @@ nsSubDocumentFrame::ShowDocShell()
|
|||
scrollY);
|
||||
}
|
||||
|
||||
rv = CreateViewAndWidget();
|
||||
PRInt32 itemType = nsIDocShellTreeItem::typeContent;
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem(do_QueryInterface(docShell));
|
||||
if (treeItem) {
|
||||
treeItem->GetItemType(&itemType);
|
||||
}
|
||||
rv = CreateViewAndWidget(itemType == nsIDocShellTreeItem::typeChrome ?
|
||||
eContentTypeUI : eContentTypeContent);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -705,7 +711,7 @@ nsSubDocumentFrame::ShowDocShell()
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsSubDocumentFrame::CreateViewAndWidget()
|
||||
nsSubDocumentFrame::CreateViewAndWidget(nsContentType aContentType)
|
||||
{
|
||||
// create, init, set the parent of the view
|
||||
nsIView* innerView;
|
||||
|
@ -730,7 +736,8 @@ nsSubDocumentFrame::CreateViewAndWidget()
|
|||
initData.clipChildren = PR_TRUE;
|
||||
initData.clipSiblings = PR_TRUE;
|
||||
|
||||
return innerView->CreateWidget(kCChildCID, nsnull, nsnull, PR_TRUE, PR_TRUE);
|
||||
return innerView->CreateWidget(kCChildCID, nsnull, nsnull, PR_TRUE, PR_TRUE,
|
||||
aContentType);
|
||||
}
|
||||
|
||||
// load a new url
|
||||
|
|
|
@ -228,8 +228,7 @@ nsMenuPopupFrame::Init(nsIPresContext* aPresContext,
|
|||
eContentTypeUI);
|
||||
#else
|
||||
static NS_DEFINE_IID(kCChildCID, NS_CHILD_CID);
|
||||
ourView->CreateWidget(kCChildCID, &widgetData, nsnull, PR_TRUE, PR_TRUE,
|
||||
eContentTypeUI);
|
||||
ourView->CreateWidget(kCChildCID, &widgetData, nsnull, PR_TRUE, PR_TRUE);
|
||||
#endif
|
||||
|
||||
MoveToAttributePosition();
|
||||
|
|
|
@ -4115,10 +4115,13 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT
|
|||
break;
|
||||
|
||||
case WM_KILLFOCUS:
|
||||
WCHAR className[19];
|
||||
nsToolkit::mGetClassName((HWND)wParam, className, 19);
|
||||
if(wcscmp(className, WindowClassW()))
|
||||
WCHAR className[kMaxClassNameLength];
|
||||
nsToolkit::mGetClassName((HWND)wParam, className, kMaxClassNameLength);
|
||||
if(wcscmp(className, kWClassNameUI) &&
|
||||
wcscmp(className, kWClassNameContent) &&
|
||||
wcscmp(className, kWClassNameGeneral)) {
|
||||
isMozWindowTakingFocus = PR_FALSE;
|
||||
}
|
||||
if(gJustGotDeactivate) {
|
||||
gJustGotDeactivate = PR_FALSE;
|
||||
result = DispatchFocus(NS_DEACTIVATE, isMozWindowTakingFocus);
|
||||
|
@ -4218,10 +4221,13 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT
|
|||
|
||||
if (pl.showCmd == SW_SHOWMINIMIZED) {
|
||||
// Deactivate
|
||||
WCHAR className[19];
|
||||
nsToolkit::mGetClassName((HWND)wParam, className, 19);
|
||||
if(wcscmp(className, WindowClassW()))
|
||||
isMozWindowTakingFocus = PR_FALSE;
|
||||
WCHAR className[kMaxClassNameLength];
|
||||
nsToolkit::mGetClassName((HWND)wParam, className, kMaxClassNameLength);
|
||||
if (wcscmp(className, kWClassNameUI) &&
|
||||
wcscmp(className, kWClassNameContent) &&
|
||||
wcscmp(className, kWClassNameGeneral)) {
|
||||
isMozWindowTakingFocus = PR_FALSE;
|
||||
}
|
||||
gJustGotDeactivate = PR_FALSE;
|
||||
result = DispatchFocus(NS_DEACTIVATE, isMozWindowTakingFocus);
|
||||
} else if (pl.showCmd == SW_SHOWNORMAL){
|
||||
|
|
|
@ -74,11 +74,17 @@ class nsIMenuBar;
|
|||
#define COLOREF_2_NSRGB(color) \
|
||||
NS_RGB(GetRValue(color), GetGValue(color), GetBValue(color))
|
||||
|
||||
/*
|
||||
* ::: IMPORTANT :::
|
||||
* External apps and drivers depend on window class names.
|
||||
* 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";
|
||||
|
|
|
@ -833,6 +833,7 @@ nsAppShellService::JustCreateTopWindow(nsIXULWindow *aParent,
|
|||
if (aChromeMask & nsIWebBrowserChrome::CHROME_WINDOW_POPUP)
|
||||
widgetInitData.mWindowType = eWindowType_popup;
|
||||
|
||||
widgetInitData.mContentType = eContentTypeUI;
|
||||
// note default chrome overrides other OS chrome settings, but
|
||||
// not internal chrome
|
||||
if (aChromeMask & nsIWebBrowserChrome::CHROME_DEFAULT)
|
||||
|
|
Загрузка…
Ссылка в новой задаче