Bug 634088 - Use native rendering for indeterminate progress bar for Cocoa. r=mstange,roc

This commit is contained in:
Mounir Lamouri 2011-03-01 03:06:22 +01:00
Родитель c3a93d449e
Коммит c958825625
4 изменённых файлов: 10 добавлений и 4 удалений

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

@ -1759,13 +1759,13 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext* aContext,
if (!QueueAnimatedContentForRefresh(aFrame->GetContent(), 30)) { if (!QueueAnimatedContentForRefresh(aFrame->GetContent(), 30)) {
NS_WARNING("Unable to animate progressbar!"); NS_WARNING("Unable to animate progressbar!");
} }
DrawProgress(cgContext, macRect, IsIndeterminateProgress(aFrame), DrawProgress(cgContext, macRect, IsIndeterminateProgress(aFrame, eventState),
PR_TRUE, GetProgressValue(aFrame), PR_TRUE, GetProgressValue(aFrame),
GetProgressMaxValue(aFrame), aFrame); GetProgressMaxValue(aFrame), aFrame);
break; break;
case NS_THEME_PROGRESSBAR_VERTICAL: case NS_THEME_PROGRESSBAR_VERTICAL:
DrawProgress(cgContext, macRect, IsIndeterminateProgress(aFrame), DrawProgress(cgContext, macRect, IsIndeterminateProgress(aFrame, eventState),
PR_FALSE, GetProgressValue(aFrame), PR_FALSE, GetProgressValue(aFrame),
GetProgressMaxValue(aFrame), aFrame); GetProgressMaxValue(aFrame), aFrame);
break; break;

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

@ -457,11 +457,16 @@ nsNativeTheme::IsNextToSelectedTab(nsIFrame* aFrame, PRInt32 aOffset)
// progressbar: // progressbar:
PRBool PRBool
nsNativeTheme::IsIndeterminateProgress(nsIFrame* aFrame) nsNativeTheme::IsIndeterminateProgress(nsIFrame* aFrame,
nsEventStates aEventStates)
{ {
if (!aFrame) if (!aFrame)
return PR_FALSE; return PR_FALSE;
if (aFrame->GetContent()->IsHTML(nsWidgetAtoms::progress)) {
return aEventStates.HasState(NS_EVENT_STATE_INDETERMINATE);
}
return aFrame->GetContent()->AttrValueIs(kNameSpaceID_None, nsWidgetAtoms::mode, return aFrame->GetContent()->AttrValueIs(kNameSpaceID_None, nsWidgetAtoms::mode,
NS_LITERAL_STRING("undetermined"), NS_LITERAL_STRING("undetermined"),
eCaseMatters); eCaseMatters);

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

@ -160,7 +160,7 @@ class nsNativeTheme : public nsITimerCallback
PRBool IsHorizontal(nsIFrame* aFrame); PRBool IsHorizontal(nsIFrame* aFrame);
// progressbar: // progressbar:
PRBool IsIndeterminateProgress(nsIFrame* aFrame); PRBool IsIndeterminateProgress(nsIFrame* aFrame, nsEventStates aEventStates);
PRInt32 GetProgressValue(nsIFrame* aFrame) { PRInt32 GetProgressValue(nsIFrame* aFrame) {
return CheckIntAttr(aFrame, nsWidgetAtoms::value, 0); return CheckIntAttr(aFrame, nsWidgetAtoms::value, 0);

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

@ -104,6 +104,7 @@ WIDGET_ATOM(open, "open") // Whether or not a menu, tree, etc. is open
WIDGET_ATOM(orient, "orient") WIDGET_ATOM(orient, "orient")
WIDGET_ATOM(pageincrement, "pageincrement") WIDGET_ATOM(pageincrement, "pageincrement")
WIDGET_ATOM(parentfocused, "parentfocused") WIDGET_ATOM(parentfocused, "parentfocused")
WIDGET_ATOM(progress, "progress")
WIDGET_ATOM(radio, "radio") WIDGET_ATOM(radio, "radio")
WIDGET_ATOM(readonly, "readonly") WIDGET_ATOM(readonly, "readonly")
WIDGET_ATOM(Reload, "Reload") WIDGET_ATOM(Reload, "Reload")