Fix for 169373, make HTML form controls fully support native look on Windows XP. r/sr=hewitt/blake

This commit is contained in:
hyatt%netscape.com 2002-09-21 01:03:38 +00:00
Родитель 26ada1884d
Коммит 369f0ad4fd
34 изменённых файлов: 332 добавлений и 48 удалений

Просмотреть файл

@ -210,6 +210,7 @@ HTML_ATOM(media, "media")
HTML_ATOM(menu, "menu")
HTML_ATOM(meta, "meta")
HTML_ATOM(method, "method")
HTML_ATOM(msthemecompatible, "msthemecompatible")
HTML_ATOM(multicol, "multicol")
HTML_ATOM(multiple, "multiple")
HTML_ATOM(name, "name")

Просмотреть файл

@ -5217,7 +5217,18 @@ HTMLContentSink::ProcessHeaderData(nsIAtom* aHeader, const nsAString& aValue,
}
} else if (aHeader == nsHTMLAtoms::link) {
rv = ProcessLinkHeader(aContent, aValue);
} else if (mParser) {
}
else if (aHeader == nsHTMLAtoms::msthemecompatible) {
// Disable theming for the presshell if the value is no.
nsAutoString value(aValue);
if (value.EqualsIgnoreCase("no")) {
nsCOMPtr<nsIPresShell> shell;
mDocument->GetShellAt(0, getter_AddRefs(shell));
if (shell)
shell->DisableThemeSupport();
}
}
else if (mParser) {
// we also need to report back HTTP-EQUIV headers to the channel
// so that it can process things like pragma: no-cache or other
// cache-control headers. Ideally this should also be the way for

Просмотреть файл

@ -210,6 +210,7 @@ HTML_ATOM(media, "media")
HTML_ATOM(menu, "menu")
HTML_ATOM(meta, "meta")
HTML_ATOM(method, "method")
HTML_ATOM(msthemecompatible, "msthemecompatible")
HTML_ATOM(multicol, "multicol")
HTML_ATOM(multiple, "multiple")
HTML_ATOM(name, "name")

Просмотреть файл

@ -1124,6 +1124,16 @@ nsXMLContentSink::ProcessHeaderData(nsIAtom* aHeader,const nsAString& aValue,nsI
else if (aHeader == nsHTMLAtoms::link) {
rv = ProcessLink(aContent, aValue);
}
else if (aHeader == nsHTMLAtoms::msthemecompatible) {
// Disable theming for the presshell if the value is no.
nsAutoString value(aValue);
if (value.EqualsIgnoreCase("no")) {
nsCOMPtr<nsIPresShell> shell;
mDocument->GetShellAt(0, getter_AddRefs(shell));
if (shell)
shell->DisableThemeSupport();
}
}
else if (mParser) {
// we also need to report back HTTP-EQUIV headers to the channel
// so that it can process things like pragma: no-cache or other

Просмотреть файл

@ -34,6 +34,7 @@ class nsIPresContext;
class nsIRenderingContext;
class nsIDeviceContext;
class nsIFrame;
class nsIContent;
class nsIAtom;
// IID for the nsITheme interface
@ -71,6 +72,7 @@ public:
NS_IMETHOD ThemeChanged()=0;
virtual PRBool ThemeSupportsWidget(nsIPresContext* aPresContext,
nsIFrame* aFrame,
PRUint8 aWidgetType)=0;
virtual PRBool WidgetIsContainer(PRUint8 aWidgetType)=0;

Просмотреть файл

@ -577,8 +577,18 @@ nsNativeThemeGTK::ThemeChanged()
NS_IMETHODIMP_(PRBool)
nsNativeThemeGTK::ThemeSupportsWidget(nsIPresContext* aPresContext,
nsIFrame* aFrame,
PRUint8 aWidgetType)
{
// Check for specific widgets to see if HTML has overridden the style.
if (aFrame) {
// For now don't support HTML.
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
if (content->IsContentOfType(nsIContent::eHTML))
return PR_FALSE;
}
switch (aWidgetType) {
case NS_THEME_BUTTON:
case NS_THEME_RADIO:

Просмотреть файл

@ -69,7 +69,7 @@ public:
NS_IMETHOD ThemeChanged();
NS_IMETHOD_(PRBool) ThemeSupportsWidget(nsIPresContext* aPresContext,
NS_IMETHOD_(PRBool) ThemeSupportsWidget(nsIPresContext* aPresContext, nsIFrame* aFrame,
PRUint8 aWidgetType);
NS_IMETHOD_(PRBool) WidgetIsContainer(PRUint8 aWidgetType);

Просмотреть файл

@ -1088,9 +1088,18 @@ nsNativeThemeMac::ThemeChanged()
PRBool
nsNativeThemeMac::ThemeSupportsWidget(nsIPresContext* aPresContext,
nsNativeThemeMac::ThemeSupportsWidget(nsIPresContext* aPresContext, nsIFrame* aFrame,
PRUint8 aWidgetType)
{
// Check for specific widgets to see if HTML has overridden the style.
if (aFrame) {
// For now don't support HTML.
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
if (content->IsContentOfType(nsIContent::eHTML))
return PR_FALSE;
}
// XXX We can go even further and call the API to ask if support exists.
PRBool retVal = PR_FALSE;

Просмотреть файл

@ -70,7 +70,7 @@ public:
NS_IMETHOD WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType,
nsIAtom* aAttribute, PRBool* aShouldRepaint);
NS_IMETHOD ThemeChanged();
PRBool ThemeSupportsWidget(nsIPresContext* aPresContext, PRUint8 aWidgetType);
PRBool ThemeSupportsWidget(nsIPresContext* aPresContext, nsIFrame* aFrame, PRUint8 aWidgetType);
PRBool WidgetIsContainer(PRUint8 aWidgetType);
protected:

Просмотреть файл

@ -44,6 +44,7 @@ REQUIRES = xpcom \
necko \
content \
layout \
dom \
debug \
imglib2 \
$(NULL)

Просмотреть файл

@ -54,6 +54,9 @@
#include "nsINameSpaceManager.h"
#include "nsIPresContext.h"
#include "nsILookAndFeel.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIComponentManager.h"
#include "nsWidgetsCID.h"
#include "nsIMenuFrame.h"
#include "nsUnicharUtils.h"
#include <malloc.h>
@ -77,6 +80,9 @@
#define TFP_TEXTFIELD 1
#define TFS_READONLY 6
// Treeview/listbox constants
#define TREEVIEW_BODY 1
// Scrollbar constants
#define SP_BUTTON 1
#define SP_THUMBHOR 2
@ -106,6 +112,8 @@
// Dropdown constants
#define CBP_DROPMARKER 1
static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
NS_IMPL_ISUPPORTS1(nsNativeThemeWin, nsITheme)
typedef HANDLE (WINAPI*OpenThemeDataPtr)(HWND hwnd, LPCWSTR pszClassList);
@ -276,6 +284,17 @@ nsNativeThemeWin::GetTheme(PRUint8 aWidgetType)
mComboBoxTheme = openTheme(NULL, L"Combobox");
return mComboBoxTheme;
}
case NS_THEME_LISTBOX:
case NS_THEME_LISTBOX_LISTITEM:
case NS_THEME_TREEVIEW:
case NS_THEME_TREEVIEW_HEADER:
case NS_THEME_TREEVIEW_HEADER_SORTARROW:
case NS_THEME_TREEVIEW_TWISTY_OPEN:
case NS_THEME_TREEVIEW_TREEITEM: {
if (!mTreeViewTheme)
mTreeViewTheme = openTheme(NULL, L"Listview");
return mTreeViewTheme;
}
}
return NULL;
}
@ -403,6 +422,9 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
// IsContentOfType test for HTML vs. XUL here.
nsIAtom* atom = (aWidgetType == NS_THEME_CHECKBOX) ? mCheckedAtom : mSelectedAtom;
PRBool isHTML = PR_FALSE;
PRBool isHTMLChecked = PR_FALSE;
if (!aFrame)
aState = TS_NORMAL;
else {
@ -413,15 +435,14 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
if (content->IsContentOfType(nsIContent::eXUL))
aFrame->GetParent(&aFrame);
else {
nsCOMPtr<nsIAtom> tag;
content->GetTag(*getter_AddRefs(tag));
if (tag == mInputAtom)
atom = mInputCheckedAtom;
// Attempt a QI.
nsCOMPtr<nsIDOMHTMLInputElement> inputElt(do_QueryInterface(content));
if (inputElt) {
inputElt->GetChecked(&isHTMLChecked);
isHTML = PR_TRUE;
}
}
}
if (aFrame) {
if (IsDisabled(aFrame))
aState = TS_DISABLED;
else {
@ -435,7 +456,11 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
}
}
if (CheckBooleanAttr(aFrame, atom))
if (isHTML) {
if (isHTMLChecked)
aState += 4;
}
else if (CheckBooleanAttr(aFrame, atom))
aState += 4; // 4 unchecked states, 4 checked states.
return NS_OK;
}
@ -600,6 +625,12 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
aState = TS_NORMAL;
return NS_OK;
}
case NS_THEME_TREEVIEW:
case NS_THEME_LISTBOX: {
aPart = TREEVIEW_BODY;
aState = TS_NORMAL;
return NS_OK;
}
case NS_THEME_TAB_PANELS: {
aPart = TABP_PANELS;
aState = TS_NORMAL;
@ -933,10 +964,17 @@ nsNativeThemeWin::ThemeChanged()
PRBool
nsNativeThemeWin::ThemeSupportsWidget(nsIPresContext* aPresContext,
nsIFrame* aFrame,
PRUint8 aWidgetType)
{
// XXXdwh We can go even further and call the API to ask if support exists for
// specific widgets.
if (!aPresContext)
return PR_TRUE;
nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell));
if (!shell->IsThemeSupportEnabled())
return PR_FALSE;
HANDLE theme = NULL;
if (aWidgetType == NS_THEME_CHECKBOX_CONTAINER)
theme = GetTheme(NS_THEME_CHECKBOX);
@ -944,7 +982,51 @@ nsNativeThemeWin::ThemeSupportsWidget(nsIPresContext* aPresContext,
theme = GetTheme(NS_THEME_RADIO);
else
theme = GetTheme(aWidgetType);
return theme != NULL;
if (!theme)
return PR_FALSE;
// Check for specific widgets to see if HTML has overridden the style.
if (aFrame && aWidgetType == NS_THEME_BUTTON || aWidgetType == NS_THEME_TEXTFIELD) {
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
if (content->IsContentOfType(nsIContent::eHTML)) {
nscolor bgColor;
nscolor disabledBG;
nsCOMPtr<nsILookAndFeel> lookAndFeel(do_CreateInstance(kLookAndFeelCID));
lookAndFeel->GetColor(nsILookAndFeel::eColor_threedface, disabledBG);
switch (aWidgetType) {
case NS_THEME_BUTTON:
lookAndFeel->GetColor(nsILookAndFeel::eColor_buttonface, bgColor);
break;
case NS_THEME_TEXTFIELD:
lookAndFeel->GetColor(nsILookAndFeel::eColor__moz_field, bgColor);
break;
default:
return PR_TRUE;
}
nsCOMPtr<nsIStyleContext> styleContext;
aFrame->GetStyleContext(getter_AddRefs(styleContext));
const nsStyleBackground* ourBG = (const nsStyleBackground*)styleContext->GetStyleData(eStyleStruct_Background);
if (ourBG->mBackgroundColor != bgColor && ourBG->mBackgroundColor != disabledBG)
return PR_FALSE;
const nsStyleBorder* ourBorder = (const nsStyleBorder*)styleContext->GetStyleData(eStyleStruct_Border);
//see if any sides are dotted, dashed or solid
for (PRInt32 cnt = 0; cnt < 4; cnt++) {
if ((ourBorder->GetBorderStyle(cnt) == NS_STYLE_BORDER_STYLE_DOTTED) ||
(ourBorder->GetBorderStyle(cnt) == NS_STYLE_BORDER_STYLE_DASHED) ||
(ourBorder->GetBorderStyle(cnt) == NS_STYLE_BORDER_STYLE_SOLID))
return PR_FALSE;
}
}
}
return PR_TRUE;
}
PRBool

Просмотреть файл

@ -53,7 +53,8 @@ public:
NS_IMETHOD ThemeChanged();
PRBool ThemeSupportsWidget(nsIPresContext* aPresContext,
PRBool ThemeSupportsWidget(nsIPresContext* aPresContext,
nsIFrame* aFrame,
PRUint8 aWidgetType);
PRBool WidgetIsContainer(PRUint8 aWidgetType);

Просмотреть файл

@ -10687,7 +10687,7 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext,
if (disp && disp->mAppearance) {
nsCOMPtr<nsITheme> theme;
aPresContext->GetTheme(getter_AddRefs(theme));
if (theme && theme->ThemeSupportsWidget(aPresContext, disp->mAppearance)) {
if (theme && theme->ThemeSupportsWidget(aPresContext, primaryFrame, disp->mAppearance)) {
PRBool repaint = PR_FALSE;
theme->WidgetStateChanged(primaryFrame, disp->mAppearance, aAttribute, &repaint);
if (repaint)

Просмотреть файл

@ -1569,13 +1569,13 @@ void nsCSSRendering::PaintBorder(nsIPresContext* aPresContext,
aPresContext->GetCompatibilityMode(&compatMode);
// Check to see if we have an appearance defined. If so, we let the theme
// renderer draw the border.
const nsStyleDisplay* displayData;
aForFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct*&)displayData));
// renderer draw the border. DO not get the data from aForFrame, since the passed in style context
// may be different! Always use |aStyleContext|!
const nsStyleDisplay* displayData = (const nsStyleDisplay*)aStyleContext->GetStyleData(eStyleStruct_Display);
if (displayData->mAppearance) {
nsCOMPtr<nsITheme> theme;
aPresContext->GetTheme(getter_AddRefs(theme));
if (theme && theme->ThemeSupportsWidget(aPresContext, displayData->mAppearance))
if (theme && theme->ThemeSupportsWidget(aPresContext, aForFrame, displayData->mAppearance))
return; // Let the theme handle it.
}
// Get our style context's color struct.
@ -2699,7 +2699,7 @@ nsCSSRendering::PaintBackgroundWithSC(nsIPresContext* aPresContext,
if (displayData->mAppearance) {
nsCOMPtr<nsITheme> theme;
aPresContext->GetTheme(getter_AddRefs(theme));
if (theme && theme->ThemeSupportsWidget(aPresContext, displayData->mAppearance)) {
if (theme && theme->ThemeSupportsWidget(aPresContext, aForFrame, displayData->mAppearance)) {
theme->DrawWidgetBackground(&aRenderingContext, aForFrame,
displayData->mAppearance, aBorderArea, aDirtyRect);
return;

Просмотреть файл

@ -536,6 +536,16 @@ public:
*/
NS_IMETHOD UnsuppressPainting() = 0;
/**
* Called to disable nsITheme support in a specific presshell.
*/
NS_IMETHOD DisableThemeSupport() = 0;
/**
* Indicates whether theme support is enabled.
*/
virtual PRBool IsThemeSupportEnabled() = 0;
/**
* See if reflow verification is enabled. To enable reflow verification add
* "verifyreflow:1" to your NSPR_LOG_MODULES environment variable

Просмотреть файл

@ -1132,6 +1132,9 @@ public:
NS_IMETHOD IsPaintingSuppressed(PRBool* aResult);
NS_IMETHOD UnsuppressPainting();
NS_IMETHOD DisableThemeSupport();
virtual PRBool IsThemeSupportEnabled();
NS_IMETHOD HandleEventWithTarget(nsEvent* aEvent, nsIFrame* aFrame, nsIContent* aContent, PRUint32 aFlags, nsEventStatus* aStatus);
NS_IMETHOD GetEventTargetFrame(nsIFrame** aFrame);
@ -1379,6 +1382,8 @@ protected:
nsCallbackEventRequest* mFirstCallbackEventRequest;
nsCallbackEventRequest* mLastCallbackEventRequest;
PRPackedBool mIsThemeSupportDisabled; // Whether or not form controls should use nsITheme in this shell.
PRPackedBool mIsDocumentGone; // We've been disconnected from the document.
PRPackedBool mPaintingSuppressed; // For all documents we initially lock down painting.
// We will refuse to paint the document until either
@ -1567,6 +1572,7 @@ PresShell::PresShell():
gLog = PR_NewLogModule("PresShell");
#endif
mSelectionFlags = nsISelectionDisplay::DISPLAY_TEXT | nsISelectionDisplay::DISPLAY_IMAGES;
mIsThemeSupportDisabled = PR_FALSE;
}
NS_IMPL_ADDREF(PresShell)
@ -4915,6 +4921,20 @@ PresShell::UnsuppressPainting()
return NS_OK;
}
NS_IMETHODIMP
PresShell::DisableThemeSupport()
{
// Doesn't have to be dynamic. Just set the bool.
mIsThemeSupportDisabled = PR_TRUE;
return NS_OK;
}
PRBool
PresShell::IsThemeSupportEnabled()
{
return !mIsThemeSupportDisabled;
}
// Post a request to handle an arbitrary callback after reflow has finished.
NS_IMETHODIMP
PresShell::PostReflowCallback(nsIReflowCallback* aCallback)

Просмотреть файл

@ -536,6 +536,16 @@ public:
*/
NS_IMETHOD UnsuppressPainting() = 0;
/**
* Called to disable nsITheme support in a specific presshell.
*/
NS_IMETHOD DisableThemeSupport() = 0;
/**
* Indicates whether theme support is enabled.
*/
virtual PRBool IsThemeSupportEnabled() = 0;
/**
* See if reflow verification is enabled. To enable reflow verification add
* "verifyreflow:1" to your NSPR_LOG_MODULES environment variable

Просмотреть файл

@ -54,6 +54,7 @@
#include "nsIServiceManager.h"
#include "nsIDOMNode.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsITheme.h"
//------------------------------------------------------------
@ -187,6 +188,14 @@ nsGfxCheckboxControlFrame::PaintCheckBox(nsIPresContext* aPresContext,
const nsRect& aDirtyRect,
nsFramePaintLayer aWhichLayer)
{
const nsStyleDisplay* disp = (const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display);
if (disp->mAppearance) {
nsCOMPtr<nsITheme> theme;
aPresContext->GetTheme(getter_AddRefs(theme));
if (theme && theme->ThemeSupportsWidget(aPresContext, this, disp->mAppearance))
return; // No need to paint the checkbox. The theme will do it.
}
aRenderingContext.PushState();
float p2t;

Просмотреть файл

@ -53,7 +53,7 @@
#endif
#include "nsIServiceManager.h"
#include "nsIDOMNode.h"
#include "nsITheme.h"
nsresult
NS_NewGfxRadioControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
@ -180,7 +180,14 @@ nsGfxRadioControlFrame::PaintRadioButton(nsIPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect)
{
const nsStyleDisplay* disp = (const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display);
if (disp->mAppearance) {
nsCOMPtr<nsITheme> theme;
aPresContext->GetTheme(getter_AddRefs(theme));
if (theme && theme->ThemeSupportsWidget(aPresContext, this, disp->mAppearance))
return; // No need to paint the radio button. The theme will do it.
}
PRBool checked = PR_TRUE;
GetCurrentCheckState(&checked); // Get check state from the content model
if (checked) {

Просмотреть файл

@ -86,6 +86,7 @@
#include "nsCSSRendering.h"
#include "nsILookAndFeel.h"
#include "nsReflowPath.h"
#include "nsITheme.h"
// Timer Includes
#include "nsITimer.h"
@ -522,6 +523,19 @@ nsListControlFrame::Paint(nsIPresContext* aPresContext,
}
if (isVisible) {
if (aWhichLayer == NS_FRAME_PAINT_LAYER_BACKGROUND) {
const nsStyleDisplay* displayData;
GetStyleData(eStyleStruct_Display, ((const nsStyleStruct*&)displayData));
if (displayData->mAppearance) {
nsCOMPtr<nsITheme> theme;
aPresContext->GetTheme(getter_AddRefs(theme));
nsRect rect(0, 0, mRect.width, mRect.height);
if (theme && theme->ThemeSupportsWidget(aPresContext, this, displayData->mAppearance))
theme->DrawWidgetBackground(&aRenderingContext, this,
displayData->mAppearance, rect, aDirtyRect);
}
}
return nsScrollFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
}

Просмотреть файл

@ -1132,6 +1132,9 @@ public:
NS_IMETHOD IsPaintingSuppressed(PRBool* aResult);
NS_IMETHOD UnsuppressPainting();
NS_IMETHOD DisableThemeSupport();
virtual PRBool IsThemeSupportEnabled();
NS_IMETHOD HandleEventWithTarget(nsEvent* aEvent, nsIFrame* aFrame, nsIContent* aContent, PRUint32 aFlags, nsEventStatus* aStatus);
NS_IMETHOD GetEventTargetFrame(nsIFrame** aFrame);
@ -1379,6 +1382,8 @@ protected:
nsCallbackEventRequest* mFirstCallbackEventRequest;
nsCallbackEventRequest* mLastCallbackEventRequest;
PRPackedBool mIsThemeSupportDisabled; // Whether or not form controls should use nsITheme in this shell.
PRPackedBool mIsDocumentGone; // We've been disconnected from the document.
PRPackedBool mPaintingSuppressed; // For all documents we initially lock down painting.
// We will refuse to paint the document until either
@ -1567,6 +1572,7 @@ PresShell::PresShell():
gLog = PR_NewLogModule("PresShell");
#endif
mSelectionFlags = nsISelectionDisplay::DISPLAY_TEXT | nsISelectionDisplay::DISPLAY_IMAGES;
mIsThemeSupportDisabled = PR_FALSE;
}
NS_IMPL_ADDREF(PresShell)
@ -4915,6 +4921,20 @@ PresShell::UnsuppressPainting()
return NS_OK;
}
NS_IMETHODIMP
PresShell::DisableThemeSupport()
{
// Doesn't have to be dynamic. Just set the bool.
mIsThemeSupportDisabled = PR_TRUE;
return NS_OK;
}
PRBool
PresShell::IsThemeSupportEnabled()
{
return !mIsThemeSupportDisabled;
}
// Post a request to handle an arbitrary callback after reflow has finished.
NS_IMETHODIMP
PresShell::PostReflowCallback(nsIReflowCallback* aCallback)

Просмотреть файл

@ -73,6 +73,7 @@ label {
/* default inputs, text inputs, and selects */
input {
-moz-appearance: textfield;
padding: 1px 0 1px 0;
border: 2px inset ThreeDFace;
background-color: -moz-Field;
@ -100,6 +101,7 @@ textarea {
-moz-box-sizing: border-box;
-moz-user-focus: normal;
-moz-binding: url("resource:///res/builtin/platformHTMLBindings.xml#textAreas");
-moz-appearance: textfield;
}
textarea > scrollbar {
@ -126,7 +128,7 @@ select {
-moz-box-sizing: border-box;
-moz-user-select: none;
-moz-user-focus: normal;
-moz-appearance: menulist;
border-width: 2px !important;
border-style: inset !important;
-moz-border-radius: 0 !important;
@ -135,8 +137,10 @@ select {
select[size] {
padding: 1px 0 1px 0;
}
select[size="1"] {
padding: 0;
-moz-appearance: menulist;
}
select > input[type="button"] {
@ -149,6 +153,7 @@ select > input[type="button"] {
background-image: url("arrow.gif") !important;
background-repeat: no-repeat !important;
background-position: center !important;
-moz-appearance: menulist-button;
}
select > input[type="button"]:active {
@ -157,6 +162,7 @@ select > input[type="button"]:active {
select[size], :-moz-select-scrolled-content {
overflow: -moz-scrollbars-vertical;
-moz-appearance: listbox;
}
select:-moz-dummy-option {
@ -231,7 +237,7 @@ select[disabled]:-moz-display-comboboxcontrol-frame {
option[disabled],
optgroup[disabled] {
background-color: -moz-field;
background-color: transparent;
}
/* hidden inputs */
@ -267,6 +273,7 @@ input[type="image"]:focus {
/* file selector */
input[type="file"] {
-moz-appearance: none;
white-space: nowrap;
cursor: default;
-moz-binding: none;
@ -294,8 +301,9 @@ input[type="file"] > input[type="button"]:-moz-focus-inner
/* radio buttons */
input[type="radio"] {
width: 12px;
height: 12px;
-moz-appearance: radio;
width: 13px;
height: 13px;
margin: 3px 3px 0px 5px;
padding: 0;
vertical-align: baseline;
@ -307,6 +315,7 @@ input[type="radio"] {
/* check boxes */
input[type="checkbox"] {
-moz-appearance: checkbox;
width: 13px;
height: 13px;
margin: 3px 3px 3px 4px;
@ -366,6 +375,7 @@ button,
input[type="reset"],
input[type="button"],
input[type="submit"] {
-moz-appearance: button;
padding: 2px 0 2px 0;
border: 2px outset ButtonFace;
background-color: ButtonFace;

Просмотреть файл

@ -54,6 +54,7 @@
#include "nsIServiceManager.h"
#include "nsIDOMNode.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsITheme.h"
//------------------------------------------------------------
@ -187,6 +188,14 @@ nsGfxCheckboxControlFrame::PaintCheckBox(nsIPresContext* aPresContext,
const nsRect& aDirtyRect,
nsFramePaintLayer aWhichLayer)
{
const nsStyleDisplay* disp = (const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display);
if (disp->mAppearance) {
nsCOMPtr<nsITheme> theme;
aPresContext->GetTheme(getter_AddRefs(theme));
if (theme && theme->ThemeSupportsWidget(aPresContext, this, disp->mAppearance))
return; // No need to paint the checkbox. The theme will do it.
}
aRenderingContext.PushState();
float p2t;

Просмотреть файл

@ -53,7 +53,7 @@
#endif
#include "nsIServiceManager.h"
#include "nsIDOMNode.h"
#include "nsITheme.h"
nsresult
NS_NewGfxRadioControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
@ -180,7 +180,14 @@ nsGfxRadioControlFrame::PaintRadioButton(nsIPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect)
{
const nsStyleDisplay* disp = (const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display);
if (disp->mAppearance) {
nsCOMPtr<nsITheme> theme;
aPresContext->GetTheme(getter_AddRefs(theme));
if (theme && theme->ThemeSupportsWidget(aPresContext, this, disp->mAppearance))
return; // No need to paint the radio button. The theme will do it.
}
PRBool checked = PR_TRUE;
GetCurrentCheckState(&checked); // Get check state from the content model
if (checked) {

Просмотреть файл

@ -86,6 +86,7 @@
#include "nsCSSRendering.h"
#include "nsILookAndFeel.h"
#include "nsReflowPath.h"
#include "nsITheme.h"
// Timer Includes
#include "nsITimer.h"
@ -522,6 +523,19 @@ nsListControlFrame::Paint(nsIPresContext* aPresContext,
}
if (isVisible) {
if (aWhichLayer == NS_FRAME_PAINT_LAYER_BACKGROUND) {
const nsStyleDisplay* displayData;
GetStyleData(eStyleStruct_Display, ((const nsStyleStruct*&)displayData));
if (displayData->mAppearance) {
nsCOMPtr<nsITheme> theme;
aPresContext->GetTheme(getter_AddRefs(theme));
nsRect rect(0, 0, mRect.width, mRect.height);
if (theme && theme->ThemeSupportsWidget(aPresContext, this, displayData->mAppearance))
theme->DrawWidgetBackground(&aRenderingContext, this,
displayData->mAppearance, rect, aDirtyRect);
}
}
return nsScrollFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
}

Просмотреть файл

@ -10687,7 +10687,7 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext,
if (disp && disp->mAppearance) {
nsCOMPtr<nsITheme> theme;
aPresContext->GetTheme(getter_AddRefs(theme));
if (theme && theme->ThemeSupportsWidget(aPresContext, disp->mAppearance)) {
if (theme && theme->ThemeSupportsWidget(aPresContext, primaryFrame, disp->mAppearance)) {
PRBool repaint = PR_FALSE;
theme->WidgetStateChanged(primaryFrame, disp->mAppearance, aAttribute, &repaint);
if (repaint)

Просмотреть файл

@ -1569,13 +1569,13 @@ void nsCSSRendering::PaintBorder(nsIPresContext* aPresContext,
aPresContext->GetCompatibilityMode(&compatMode);
// Check to see if we have an appearance defined. If so, we let the theme
// renderer draw the border.
const nsStyleDisplay* displayData;
aForFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct*&)displayData));
// renderer draw the border. DO not get the data from aForFrame, since the passed in style context
// may be different! Always use |aStyleContext|!
const nsStyleDisplay* displayData = (const nsStyleDisplay*)aStyleContext->GetStyleData(eStyleStruct_Display);
if (displayData->mAppearance) {
nsCOMPtr<nsITheme> theme;
aPresContext->GetTheme(getter_AddRefs(theme));
if (theme && theme->ThemeSupportsWidget(aPresContext, displayData->mAppearance))
if (theme && theme->ThemeSupportsWidget(aPresContext, aForFrame, displayData->mAppearance))
return; // Let the theme handle it.
}
// Get our style context's color struct.
@ -2699,7 +2699,7 @@ nsCSSRendering::PaintBackgroundWithSC(nsIPresContext* aPresContext,
if (displayData->mAppearance) {
nsCOMPtr<nsITheme> theme;
aPresContext->GetTheme(getter_AddRefs(theme));
if (theme && theme->ThemeSupportsWidget(aPresContext, displayData->mAppearance)) {
if (theme && theme->ThemeSupportsWidget(aPresContext, aForFrame, displayData->mAppearance)) {
theme->DrawWidgetBackground(&aRenderingContext, aForFrame,
displayData->mAppearance, aBorderArea, aDirtyRect);
return;

Просмотреть файл

@ -73,6 +73,7 @@ label {
/* default inputs, text inputs, and selects */
input {
-moz-appearance: textfield;
padding: 1px 0 1px 0;
border: 2px inset ThreeDFace;
background-color: -moz-Field;
@ -100,6 +101,7 @@ textarea {
-moz-box-sizing: border-box;
-moz-user-focus: normal;
-moz-binding: url("resource:///res/builtin/platformHTMLBindings.xml#textAreas");
-moz-appearance: textfield;
}
textarea > scrollbar {
@ -126,7 +128,7 @@ select {
-moz-box-sizing: border-box;
-moz-user-select: none;
-moz-user-focus: normal;
-moz-appearance: menulist;
border-width: 2px !important;
border-style: inset !important;
-moz-border-radius: 0 !important;
@ -135,8 +137,10 @@ select {
select[size] {
padding: 1px 0 1px 0;
}
select[size="1"] {
padding: 0;
-moz-appearance: menulist;
}
select > input[type="button"] {
@ -149,6 +153,7 @@ select > input[type="button"] {
background-image: url("arrow.gif") !important;
background-repeat: no-repeat !important;
background-position: center !important;
-moz-appearance: menulist-button;
}
select > input[type="button"]:active {
@ -157,6 +162,7 @@ select > input[type="button"]:active {
select[size], :-moz-select-scrolled-content {
overflow: -moz-scrollbars-vertical;
-moz-appearance: listbox;
}
select:-moz-dummy-option {
@ -231,7 +237,7 @@ select[disabled]:-moz-display-comboboxcontrol-frame {
option[disabled],
optgroup[disabled] {
background-color: -moz-field;
background-color: transparent;
}
/* hidden inputs */
@ -267,6 +273,7 @@ input[type="image"]:focus {
/* file selector */
input[type="file"] {
-moz-appearance: none;
white-space: nowrap;
cursor: default;
-moz-binding: none;
@ -294,8 +301,9 @@ input[type="file"] > input[type="button"]:-moz-focus-inner
/* radio buttons */
input[type="radio"] {
width: 12px;
height: 12px;
-moz-appearance: radio;
width: 13px;
height: 13px;
margin: 3px 3px 0px 5px;
padding: 0;
vertical-align: baseline;
@ -307,6 +315,7 @@ input[type="radio"] {
/* check boxes */
input[type="checkbox"] {
-moz-appearance: checkbox;
width: 13px;
height: 13px;
margin: 3px 3px 3px 4px;
@ -366,6 +375,7 @@ button,
input[type="reset"],
input[type="button"],
input[type="submit"] {
-moz-appearance: button;
padding: 2px 0 2px 0;
border: 2px outset ButtonFace;
background-color: ButtonFace;

Просмотреть файл

@ -675,7 +675,7 @@ nsBox::GetBorder(nsMargin& aMargin)
doc->GetShellAt(0, getter_AddRefs(shell));
nsCOMPtr<nsIPresContext> context;
shell->GetPresContext(getter_AddRefs(context));
if (gTheme->ThemeSupportsWidget(context, disp->mAppearance)) {
if (gTheme->ThemeSupportsWidget(context, frame, disp->mAppearance)) {
nsCOMPtr<nsIDeviceContext> dc;
context->GetDeviceContext(getter_AddRefs(dc));
nsMargin margin(0,0,0,0);
@ -1301,7 +1301,7 @@ nsIBox::AddCSSMinSize(nsBoxLayoutState& aState, nsIBox* aBox, nsSize& aSize)
if (display->mAppearance) {
nsCOMPtr<nsITheme> theme;
aState.GetPresContext()->GetTheme(getter_AddRefs(theme));
if (theme && theme->ThemeSupportsWidget(aState.GetPresContext(), display->mAppearance)) {
if (theme && theme->ThemeSupportsWidget(aState.GetPresContext(), frame, display->mAppearance)) {
nsSize size;
const nsHTMLReflowState* reflowState = aState.GetReflowState();
if (reflowState) {

Просмотреть файл

@ -1651,7 +1651,7 @@ nsBoxFrame::Paint(nsIPresContext* aPresContext,
const nsStyleDisplay* display =
(const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display);
if (!(display->mAppearance && nsBox::gTheme &&
gTheme->ThemeSupportsWidget(aPresContext, display->mAppearance) &&
gTheme->ThemeSupportsWidget(aPresContext, this, display->mAppearance) &&
!gTheme->WidgetIsContainer(display->mAppearance)))
PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);

Просмотреть файл

@ -365,7 +365,7 @@ nsImageBoxFrame::GetImageSource()
const nsStyleDisplay* disp =
(const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display);
if (disp->mAppearance && nsBox::gTheme &&
nsBox::gTheme->ThemeSupportsWidget(nsnull, disp->mAppearance))
nsBox::gTheme->ThemeSupportsWidget(nsnull, this, disp->mAppearance))
return;
// get the list-style-image
@ -572,7 +572,7 @@ nsImageBoxFrame::DidSetStyleContext( nsIPresContext* aPresContext )
const nsStyleDisplay* disp =
(const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display);
if (disp->mAppearance && nsBox::gTheme &&
nsBox::gTheme->ThemeSupportsWidget(nsnull, disp->mAppearance))
nsBox::gTheme->ThemeSupportsWidget(nsnull, this, disp->mAppearance))
return NS_OK;
// If list-style-image changes, we have a new image.

Просмотреть файл

@ -2233,7 +2233,7 @@ NS_IMETHODIMP nsTreeBodyFrame::PaintRow(PRInt32 aRowIndex,
const nsStyleDisplay* displayData = (const nsStyleDisplay*)rowContext->GetStyleData(eStyleStruct_Display);
if ( displayData->mAppearance ) {
aPresContext->GetTheme(getter_AddRefs(theme));
if (theme && theme->ThemeSupportsWidget(aPresContext, displayData->mAppearance))
if (theme && theme->ThemeSupportsWidget(aPresContext, nsnull, displayData->mAppearance))
useTheme = PR_TRUE;
}
PRBool isSelected = PR_FALSE;
@ -2264,7 +2264,7 @@ NS_IMETHODIMP nsTreeBodyFrame::PaintRow(PRInt32 aRowIndex,
const nsStyleDisplay* displayData = (const nsStyleDisplay*)separatorContext->GetStyleData(eStyleStruct_Display);
if ( displayData->mAppearance ) {
aPresContext->GetTheme(getter_AddRefs(theme));
if (theme && theme->ThemeSupportsWidget(aPresContext, displayData->mAppearance))
if (theme && theme->ThemeSupportsWidget(aPresContext, nsnull, displayData->mAppearance))
useTheme = PR_TRUE;
}
@ -2534,7 +2534,7 @@ nsTreeBodyFrame::PaintTwisty(PRInt32 aRowIndex,
const nsStyleDisplay* twistyDisplayData = (const nsStyleDisplay*)twistyContext->GetStyleData(eStyleStruct_Display);
if ( twistyDisplayData->mAppearance ) {
aPresContext->GetTheme(getter_AddRefs(theme));
if (theme && theme->ThemeSupportsWidget(aPresContext, twistyDisplayData->mAppearance))
if (theme && theme->ThemeSupportsWidget(aPresContext, nsnull, twistyDisplayData->mAppearance))
useTheme = PR_TRUE;
}

Просмотреть файл

@ -605,6 +605,14 @@ textbox[multiline="true"] {
-moz-binding: url("chrome://global/content/widgets/textbox.xml#textarea");
}
html|*.textbox-input {
-moz-appearance: none !important;
}
html|*.textbox-textarea {
-moz-appearance: none !important;
}
.textbox-input-box {
-moz-binding: url("chrome://global/content/widgets/textbox.xml#input-box");
}

Просмотреть файл

@ -604,6 +604,14 @@ textbox[multiline="true"] {
-moz-binding: url("chrome://global/content/bindings/textbox.xml#textarea");
}
html|*.textbox-input {
-moz-appearance: none !important;
}
html|*.textbox-textarea {
-moz-appearance: none !important;
}
.textbox-input-box {
-moz-binding: url("chrome://global/content/bindings/textbox.xml#input-box");
}