mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 658829 part 3 - move GetProgress*Value to nsNativeTheme r=jimm
--HG-- extra : rebase_source : 562107a9a653f352900073b096bce0b85aa423f4
This commit is contained in:
parent
ab07dc4549
commit
9980a170e6
@ -68,10 +68,6 @@ protected:
|
||||
CGRect SeparatorAdjustedRect(CGRect aRect, nsIFrame* aLeft,
|
||||
nsIFrame* aCurrent, nsIFrame* aRight);
|
||||
|
||||
// Helpers for progressbar.
|
||||
double GetProgressValue(nsIFrame* aFrame);
|
||||
double GetProgressMaxValue(nsIFrame* aFrame);
|
||||
|
||||
// HITheme drawing routines
|
||||
void DrawFrame(CGContextRef context, HIThemeFrameKind inKind,
|
||||
const HIRect& inBoxRect, bool inReadOnly,
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "nsCocoaWindow.h"
|
||||
#include "nsNativeThemeColors.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include "nsIDOMHTMLProgressElement.h"
|
||||
#include "nsIDOMHTMLMeterElement.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
|
||||
@ -2994,39 +2993,3 @@ nsNativeThemeCocoa::GetWidgetTransparency(nsIFrame* aFrame, uint8_t aWidgetType)
|
||||
return eUnknownTransparency;
|
||||
}
|
||||
}
|
||||
|
||||
double
|
||||
nsNativeThemeCocoa::GetProgressValue(nsIFrame* aFrame)
|
||||
{
|
||||
// When we are using the HTML progress element,
|
||||
// we can get the value from the IDL property.
|
||||
if (aFrame) {
|
||||
nsCOMPtr<nsIDOMHTMLProgressElement> progress =
|
||||
do_QueryInterface(aFrame->GetContent());
|
||||
if (progress) {
|
||||
double value;
|
||||
progress->GetValue(&value);
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
return (double)CheckIntAttr(aFrame, nsGkAtoms::value, 0);
|
||||
}
|
||||
|
||||
double
|
||||
nsNativeThemeCocoa::GetProgressMaxValue(nsIFrame* aFrame)
|
||||
{
|
||||
// When we are using the HTML progress element,
|
||||
// we can get the max from the IDL property.
|
||||
if (aFrame) {
|
||||
nsCOMPtr<nsIDOMHTMLProgressElement> progress =
|
||||
do_QueryInterface(aFrame->GetContent());
|
||||
if (progress) {
|
||||
double max;
|
||||
progress->GetMax(&max);
|
||||
return max;
|
||||
}
|
||||
}
|
||||
|
||||
return (double)std::max(CheckIntAttr(aFrame, nsGkAtoms::max, 100), 1);
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "nsString.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsIDOMHTMLProgressElement.h"
|
||||
#include "nsIDOMXULMenuListElement.h"
|
||||
#include "nsThemeConstants.h"
|
||||
#include "nsIComponentManager.h"
|
||||
@ -101,6 +102,7 @@ nsNativeTheme::GetContentState(nsIFrame* aFrame, uint8_t aWidgetType)
|
||||
return flags;
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool
|
||||
nsNativeTheme::CheckBooleanAttr(nsIFrame* aFrame, nsIAtom* aAtom)
|
||||
{
|
||||
@ -121,6 +123,7 @@ nsNativeTheme::CheckBooleanAttr(nsIFrame* aFrame, nsIAtom* aAtom)
|
||||
NS_LITERAL_STRING("true"), eCaseMatters);
|
||||
}
|
||||
|
||||
/* static */
|
||||
int32_t
|
||||
nsNativeTheme::CheckIntAttr(nsIFrame* aFrame, nsIAtom* aAtom, int32_t defaultValue)
|
||||
{
|
||||
@ -137,6 +140,44 @@ nsNativeTheme::CheckIntAttr(nsIFrame* aFrame, nsIAtom* aAtom, int32_t defaultVal
|
||||
return value;
|
||||
}
|
||||
|
||||
/* static */
|
||||
double
|
||||
nsNativeTheme::GetProgressValue(nsIFrame* aFrame)
|
||||
{
|
||||
// When we are using the HTML progress element,
|
||||
// we can get the value from the IDL property.
|
||||
if (aFrame) {
|
||||
nsCOMPtr<nsIDOMHTMLProgressElement> progress =
|
||||
do_QueryInterface(aFrame->GetContent());
|
||||
if (progress) {
|
||||
double value;
|
||||
progress->GetValue(&value);
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
return (double)nsNativeTheme::CheckIntAttr(aFrame, nsGkAtoms::value, 0);
|
||||
}
|
||||
|
||||
/* static */
|
||||
double
|
||||
nsNativeTheme::GetProgressMaxValue(nsIFrame* aFrame)
|
||||
{
|
||||
// When we are using the HTML progress element,
|
||||
// we can get the max from the IDL property.
|
||||
if (aFrame) {
|
||||
nsCOMPtr<nsIDOMHTMLProgressElement> progress =
|
||||
do_QueryInterface(aFrame->GetContent());
|
||||
if (progress) {
|
||||
double max;
|
||||
progress->GetMax(&max);
|
||||
return max;
|
||||
}
|
||||
}
|
||||
|
||||
return (double)std::max(nsNativeTheme::CheckIntAttr(aFrame, nsGkAtoms::max, 100), 1);
|
||||
}
|
||||
|
||||
bool
|
||||
nsNativeTheme::GetCheckedOrSelected(nsIFrame* aFrame, bool aCheckSelected)
|
||||
{
|
||||
|
@ -155,8 +155,12 @@ class nsNativeTheme : public nsITimerCallback
|
||||
bool IsMenuListEditable(nsIFrame *aFrame);
|
||||
|
||||
nsIPresShell *GetPresShell(nsIFrame* aFrame);
|
||||
int32_t CheckIntAttr(nsIFrame* aFrame, nsIAtom* aAtom, int32_t defaultValue);
|
||||
bool CheckBooleanAttr(nsIFrame* aFrame, nsIAtom* aAtom);
|
||||
static bool CheckBooleanAttr(nsIFrame* aFrame, nsIAtom* aAtom);
|
||||
static int32_t CheckIntAttr(nsIFrame* aFrame, nsIAtom* aAtom, int32_t defaultValue);
|
||||
|
||||
// Helpers for progressbar.
|
||||
static double GetProgressValue(nsIFrame* aFrame);
|
||||
static double GetProgressMaxValue(nsIFrame* aFrame);
|
||||
|
||||
bool GetCheckedOrSelected(nsIFrame* aFrame, bool aCheckSelected);
|
||||
bool GetIndeterminate(nsIFrame* aFrame);
|
||||
|
Loading…
Reference in New Issue
Block a user