зеркало из https://github.com/mozilla/gecko-dev.git
More stuff for RDF properties as well as fixing color parsing.
This commit is contained in:
Родитель
77fa8d6e70
Коммит
10d856c257
|
@ -189,11 +189,11 @@ URDFUtilities :: GetColor ( HT_Resource inNode, void* inHTToken, RGBColor* outCo
|
|||
|
||||
if ( inNode && inHTToken ) {
|
||||
char* color = NULL;
|
||||
PRBool success = HT_GetNodeData ( inNode, inHTToken, HT_COLUMN_STRING, &color );
|
||||
PRBool success = HT_GetTemplateData ( inNode, inHTToken, HT_COLUMN_STRING, &color );
|
||||
if ( success && color ) {
|
||||
uint8 red, green, blue;
|
||||
if ( XP_ColorNameToRGB(color, &red, &green, &blue) == 0 ) {
|
||||
*outColor = UGraphics::MakeRGBColor(red, green, blue);\
|
||||
if ( LO_ParseRGB(color, &red, &green, &blue) ) {
|
||||
*outColor = UGraphics::MakeRGBColor(red, green, blue);
|
||||
usingHTColor = true;
|
||||
}
|
||||
}
|
||||
|
@ -208,21 +208,34 @@ URDFUtilities :: GetColor ( HT_Resource inNode, void* inHTToken, RGBColor* outCo
|
|||
// PropertyValueBool
|
||||
//
|
||||
// Gets the value of the given token and determines if it is "[Y|y]es" or "[N|n]o" based
|
||||
// on the first character. Returns the appropriate boolean value (yes = true).
|
||||
// on the first character. Returns the appropriate boolean value (yes = true). If the
|
||||
// property is not specified (or not specified correctly) return the default value.
|
||||
//
|
||||
bool
|
||||
URDFUtilities :: PropertyValueBool ( HT_Resource inNode, void* inHTToken )
|
||||
URDFUtilities :: PropertyValueBool ( HT_Resource inNode, void* inHTToken, bool inDefaultValue )
|
||||
{
|
||||
char* value = NULL;
|
||||
bool retVal = inDefaultValue;
|
||||
|
||||
PRBool success = HT_GetNodeData ( inNode, inHTToken, HT_COLUMN_STRING, &value );
|
||||
if ( success && value )
|
||||
return (*value == 'y' || *value == 'Y') ? true : false;
|
||||
|
||||
return false;
|
||||
if ( inNode && inHTToken ) {
|
||||
char* value = NULL;
|
||||
|
||||
PRBool success = HT_GetTemplateData ( inNode, inHTToken, HT_COLUMN_STRING, &value );
|
||||
if ( success && value ) {
|
||||
switch ( *value ) {
|
||||
case 'Y': case 'y':
|
||||
retVal = true;
|
||||
break;
|
||||
case 'N': case 'n':
|
||||
retVal = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return retVal;
|
||||
|
||||
} // PropertyValueBool
|
||||
|
||||
|
||||
//
|
||||
// LaunchNode
|
||||
// LaunchURL
|
||||
|
|
|
@ -51,8 +51,9 @@ class URDFUtilities
|
|||
static bool SetupForegroundTextColor ( HT_Resource inNode, void* inHTToken, ThemeTextColor inBrush ) ;
|
||||
static bool GetColor ( HT_Resource inNode, void* inHTToken, RGBColor * outColor ) ;
|
||||
|
||||
// true if property is "yes", false if value is "no"
|
||||
static bool PropertyValueBool ( HT_Resource inNode, void* inHTToken );
|
||||
// true if property is "yes", false if value is "no", and the default if the property is
|
||||
// not (or incorrectly) specified
|
||||
static bool PropertyValueBool ( HT_Resource inNode, void* inHTToken, bool inDefaultValue );
|
||||
|
||||
// call these before starting to load any URLs. HT may know how to handle them mo-better.
|
||||
static bool LaunchNode ( HT_Resource inNode ) ;
|
||||
|
|
Загрузка…
Ссылка в новой задаче