зеркало из https://github.com/mozilla/pjs.git
Bug 431078: Render editable menulists in Aero in a style consistent with the native UI (like a textfield). r=jmathies+dao
This commit is contained in:
Родитель
10c6b66a2f
Коммит
13595c6958
|
@ -943,12 +943,13 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
|||
case NS_THEME_DROPDOWN: {
|
||||
nsIContent* content = aFrame->GetContent();
|
||||
PRBool isHTML = content && content->IsHTML();
|
||||
PRBool useDropBorder = isHTML || IsMenuListEditable(aFrame);
|
||||
nsEventStates eventState = GetContentState(aFrame, aWidgetType);
|
||||
|
||||
/* On vista, in HTML, we use CBP_DROPBORDER instead of DROPFRAME for HTML content;
|
||||
* this gives us the thin outline in HTML content, instead of the gradient-filled
|
||||
* background */
|
||||
if (isHTML)
|
||||
/* On Vista/Win7, we use CBP_DROPBORDER instead of DROPFRAME for HTML
|
||||
* content or for editable menulists; this gives us the thin outline,
|
||||
* instead of the gradient-filled background */
|
||||
if (useDropBorder)
|
||||
aPart = CBP_DROPBORDER;
|
||||
else
|
||||
aPart = CBP_DROPFRAME;
|
||||
|
@ -960,7 +961,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
|||
} else if (IsOpenButton(aFrame)) {
|
||||
aState = TS_ACTIVE;
|
||||
} else {
|
||||
if (isHTML && eventState.HasState(NS_EVENT_STATE_FOCUS))
|
||||
if (useDropBorder && (eventState.HasState(NS_EVENT_STATE_FOCUS) || IsFocused(aFrame)))
|
||||
aState = TS_ACTIVE;
|
||||
else if (eventState.HasAllStates(NS_EVENT_STATE_HOVER | NS_EVENT_STATE_ACTIVE))
|
||||
aState = TS_ACTIVE;
|
||||
|
@ -1004,7 +1005,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
|||
isOpen = IsOpenButton(aFrame);
|
||||
|
||||
if (nsUXThemeData::sIsVistaOrLater) {
|
||||
if (isHTML) {
|
||||
if (isHTML || IsMenuListEditable(aFrame)) {
|
||||
if (isOpen) {
|
||||
/* Hover is propagated, but we need to know whether we're
|
||||
* hovering just the combobox frame, not the dropdown frame.
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include "nsString.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsIDOMXULMenuListElement.h"
|
||||
#include "nsILookAndFeel.h"
|
||||
#include "nsThemeConstants.h"
|
||||
#include "nsIComponentManager.h"
|
||||
|
@ -518,6 +519,16 @@ nsNativeTheme::IsRegularMenuItem(nsIFrame *aFrame)
|
|||
menuFrame->GetParentMenuListType() != eNotMenuList));
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsNativeTheme::IsMenuListEditable(nsIFrame *aFrame)
|
||||
{
|
||||
PRBool isEditable = PR_FALSE;
|
||||
nsCOMPtr<nsIDOMXULMenuListElement> menulist = do_QueryInterface(aFrame->GetContent());
|
||||
if (menulist)
|
||||
menulist->GetEditable(&isEditable);
|
||||
return isEditable;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsNativeTheme::QueueAnimatedContentForRefresh(nsIContent* aContent,
|
||||
PRUint32 aMinimumFrameRate)
|
||||
|
|
|
@ -175,6 +175,8 @@ class nsNativeTheme : public nsITimerCallback
|
|||
// True if it's not a menubar item or menulist item
|
||||
PRBool IsRegularMenuItem(nsIFrame *aFrame);
|
||||
|
||||
PRBool IsMenuListEditable(nsIFrame *aFrame);
|
||||
|
||||
nsIPresShell *GetPresShell(nsIFrame* aFrame);
|
||||
PRInt32 CheckIntAttr(nsIFrame* aFrame, nsIAtom* aAtom, PRInt32 defaultValue);
|
||||
PRBool CheckBooleanAttr(nsIFrame* aFrame, nsIAtom* aAtom);
|
||||
|
|
Загрузка…
Ссылка в новой задаче