зеркало из https://github.com/mozilla/pjs.git
Bug 304147 - progressmeter in undetermined mode does not work in Mac OS X. patch by Markus Stange <mstange@themasta.com>, r=enn, sr=roc, a=beltzner.
This commit is contained in:
Родитель
fd64880492
Коммит
6e22b39903
|
@ -111,4 +111,26 @@
|
|||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="progressmeter-periodic-redraw"
|
||||
extends="chrome://global/content/bindings/progressmeter.xml#progressmeter">
|
||||
<implementation>
|
||||
<method name="_init">
|
||||
<body><![CDATA[
|
||||
var step = 0;
|
||||
var self = this;
|
||||
var interval = setInterval(function nextStep() {
|
||||
try {
|
||||
// Trigger redraw by changing the step attribute
|
||||
step = (step + 1) % 2;
|
||||
self.setAttribute('step', step);
|
||||
} catch (e) {
|
||||
clearInterval(interval);
|
||||
}
|
||||
}, 1000/30);
|
||||
]]></body>
|
||||
</method>
|
||||
<constructor>this._init();</constructor>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
||||
|
|
|
@ -92,6 +92,10 @@ menulist > menupopup,
|
|||
-moz-binding: url("chrome://global/content/bindings/menulist.xml#menulist-compact");
|
||||
}
|
||||
|
||||
progressmeter[mode="undetermined"] {
|
||||
-moz-binding: url("chrome://global/content/bindings/progressmeter.xml#progressmeter-periodic-redraw");
|
||||
}
|
||||
|
||||
/* ::::: root elements ::::: */
|
||||
|
||||
window,
|
||||
|
|
|
@ -678,7 +678,9 @@ nsNativeThemeCocoa::DrawProgress(CGContextRef cgContext,
|
|||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
HIThemeTrackDrawInfo tdi;
|
||||
static SInt32 sPhase = 0;
|
||||
|
||||
PRInt32 stepsPerSecond = inIsIndeterminate ? 60 : 30;
|
||||
PRInt32 milliSecondsPerStep = 1000 / stepsPerSecond;
|
||||
|
||||
tdi.version = 0;
|
||||
tdi.kind = inIsIndeterminate ? kThemeMediumIndeterminateBar: kThemeMediumProgressBar;
|
||||
|
@ -688,7 +690,8 @@ nsNativeThemeCocoa::DrawProgress(CGContextRef cgContext,
|
|||
tdi.value = inValue;
|
||||
tdi.attributes = inIsHorizontal ? kThemeTrackHorizontal : 0;
|
||||
tdi.enableState = kThemeTrackActive;
|
||||
tdi.trackInfo.progress.phase = sPhase++; // animate for the next time we're called
|
||||
tdi.trackInfo.progress.phase = PR_IntervalToMilliseconds(PR_IntervalNow()) /
|
||||
milliSecondsPerStep % 16;
|
||||
|
||||
HIThemeDrawTrack(&tdi, NULL, cgContext, HITHEME_ORIENTATION);
|
||||
|
||||
|
@ -1751,10 +1754,6 @@ nsNativeThemeCocoa::WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType,
|
|||
case NS_THEME_STATUSBAR:
|
||||
case NS_THEME_STATUSBAR_PANEL:
|
||||
case NS_THEME_STATUSBAR_RESIZER_PANEL:
|
||||
case NS_THEME_PROGRESSBAR_CHUNK:
|
||||
case NS_THEME_PROGRESSBAR_CHUNK_VERTICAL:
|
||||
case NS_THEME_PROGRESSBAR:
|
||||
case NS_THEME_PROGRESSBAR_VERTICAL:
|
||||
case NS_THEME_TOOLTIP:
|
||||
case NS_THEME_TAB_PANELS:
|
||||
case NS_THEME_TAB_PANEL:
|
||||
|
@ -1763,6 +1762,12 @@ nsNativeThemeCocoa::WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType,
|
|||
case NS_THEME_GROUPBOX:
|
||||
*aShouldRepaint = PR_FALSE;
|
||||
return NS_OK;
|
||||
case NS_THEME_PROGRESSBAR_CHUNK:
|
||||
case NS_THEME_PROGRESSBAR_CHUNK_VERTICAL:
|
||||
case NS_THEME_PROGRESSBAR:
|
||||
case NS_THEME_PROGRESSBAR_VERTICAL:
|
||||
*aShouldRepaint = (aAttribute == nsWidgetAtoms::step);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// XXXdwh Not sure what can really be done here. Can at least guess for
|
||||
|
|
|
@ -114,6 +114,7 @@ WIDGET_ATOM(Search, "Search")
|
|||
WIDGET_ATOM(selected, "selected")
|
||||
WIDGET_ATOM(sortdirection, "sortDirection")
|
||||
WIDGET_ATOM(state, "state")
|
||||
WIDGET_ATOM(step, "step")
|
||||
WIDGET_ATOM(Stop, "Stop")
|
||||
WIDGET_ATOM(_true, "true")
|
||||
WIDGET_ATOM(type, "type")
|
||||
|
|
Загрузка…
Ссылка в новой задаче