Change -moz-opacity to opacity. Create a mechanism for creating a second name for a CSS property and continue to support -moz-opacity. b=93156 r=bzbarsky sr=roc
git-svn-id: svn://10.0.0.236/trunk@153148 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
6defbd8545
commit
dafe525b26
@ -345,6 +345,10 @@ CSS2PropertiesTearoff::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
#define CSS_PROP_SHORTHAND(name_, id_, method_) \
|
||||
CSS_PROP(name_, id_, method_, , , , ,)
|
||||
#include "nsCSSPropList.h"
|
||||
|
||||
// Aliases
|
||||
CSS_PROP(opacity, X, MozOpacity, X, X, X, X, X)
|
||||
|
||||
#undef CSS_PROP_SHORTHAND
|
||||
#undef CSS_PROP_NOTIMPLEMENTED
|
||||
#undef CSS_PROP_LIST_EXCLUDE_INTERNAL
|
||||
|
||||
@ -389,7 +389,7 @@ CSS_PROP_POSITION(max-height, max_height, MaxHeight, Position, mMaxHeight, eCSST
|
||||
CSS_PROP_POSITION(max-width, max_width, MaxWidth, Position, mMaxWidth, eCSSType_Value, PR_TRUE, nsnull)
|
||||
CSS_PROP_POSITION(min-height, min_height, MinHeight, Position, mMinHeight, eCSSType_Value, PR_TRUE, nsnull)
|
||||
CSS_PROP_POSITION(min-width, min_width, MinWidth, Position, mMinWidth, eCSSType_Value, PR_TRUE, nsnull)
|
||||
CSS_PROP_DISPLAY(-moz-opacity, opacity, MozOpacity, Display, mOpacity, eCSSType_Value, PR_FALSE, nsnull) // XXX bug 3935
|
||||
CSS_PROP_DISPLAY(opacity, opacity, Opacity, Display, mOpacity, eCSSType_Value, PR_FALSE, nsnull) // XXX bug 3935
|
||||
CSS_PROP_BACKENDONLY(orphans, orphans, Orphans, Breaks, mOrphans, eCSSType_Value, PR_FALSE, nsnull)
|
||||
CSS_PROP_NOTIMPLEMENTED(outline, outline, Outline)
|
||||
CSS_PROP_NOTIMPLEMENTED(outline-color, outline_color, OutlineColor)
|
||||
|
||||
@ -99,14 +99,32 @@ nsCSSProps::ReleaseTable(void)
|
||||
}
|
||||
}
|
||||
|
||||
struct CSSPropertyAlias {
|
||||
const char name[13];
|
||||
nsCSSProperty id;
|
||||
};
|
||||
|
||||
static const CSSPropertyAlias gAliases[] = {
|
||||
{ "-moz-opacity", eCSSProperty_opacity }
|
||||
};
|
||||
|
||||
nsCSSProperty
|
||||
nsCSSProps::LookupProperty(const nsACString& aProperty)
|
||||
{
|
||||
NS_ASSERTION(gPropertyTable, "no lookup table, needs addref");
|
||||
if (gPropertyTable) {
|
||||
return nsCSSProperty(gPropertyTable->Lookup(aProperty));
|
||||
}
|
||||
return eCSSProperty_UNKNOWN;
|
||||
|
||||
nsCSSProperty res = nsCSSProperty(gPropertyTable->Lookup(aProperty));
|
||||
if (res == eCSSProperty_UNKNOWN) {
|
||||
const nsCString& prop = PromiseFlatCString(aProperty);
|
||||
for (const CSSPropertyAlias *alias = gAliases,
|
||||
*alias_end = gAliases + NS_ARRAY_LENGTH(gAliases);
|
||||
alias < alias_end; ++alias)
|
||||
if (nsCRT::strcasecmp(prop.get(), alias->name) == 0) {
|
||||
res = alias->id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
nsCSSProperty
|
||||
@ -115,10 +133,18 @@ nsCSSProps::LookupProperty(const nsAString& aProperty) {
|
||||
// LookupProperty(nsACString&). The table will do its own
|
||||
// converting and avoid a PromiseFlatCString() call.
|
||||
NS_ASSERTION(gPropertyTable, "no lookup table, needs addref");
|
||||
if (gPropertyTable) {
|
||||
return nsCSSProperty(gPropertyTable->Lookup(aProperty));
|
||||
}
|
||||
return eCSSProperty_UNKNOWN;
|
||||
nsCSSProperty res = nsCSSProperty(gPropertyTable->Lookup(aProperty));
|
||||
if (res == eCSSProperty_UNKNOWN) {
|
||||
NS_ConvertUTF16toUTF8 prop(aProperty);
|
||||
for (const CSSPropertyAlias *alias = gAliases,
|
||||
*alias_end = gAliases + NS_ARRAY_LENGTH(gAliases);
|
||||
alias < alias_end; ++alias)
|
||||
if (nsCRT::strcasecmp(prop.get(), alias->name) == 0) {
|
||||
res = alias->id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
const nsAFlatCString&
|
||||
|
||||
@ -414,6 +414,8 @@ interface nsIDOMCSS2Properties : nsISupports
|
||||
interface nsIDOMNSCSS2Properties : nsIDOMCSS2Properties
|
||||
{
|
||||
/* Non-DOM 2 extensions */
|
||||
|
||||
/* Mozilla extension CSS properties */
|
||||
attribute DOMString MozAppearance;
|
||||
// raises(DOMException) on setting
|
||||
|
||||
@ -551,4 +553,9 @@ interface nsIDOMNSCSS2Properties : nsIDOMCSS2Properties
|
||||
|
||||
attribute DOMString MozUserSelect;
|
||||
// raises(DOMException) on setting
|
||||
|
||||
/* CSS3 properties */
|
||||
attribute DOMString Opacity;
|
||||
// raises(DOMException) on setting
|
||||
|
||||
};
|
||||
|
||||
@ -389,7 +389,7 @@ CSS_PROP_POSITION(max-height, max_height, MaxHeight, Position, mMaxHeight, eCSST
|
||||
CSS_PROP_POSITION(max-width, max_width, MaxWidth, Position, mMaxWidth, eCSSType_Value, PR_TRUE, nsnull)
|
||||
CSS_PROP_POSITION(min-height, min_height, MinHeight, Position, mMinHeight, eCSSType_Value, PR_TRUE, nsnull)
|
||||
CSS_PROP_POSITION(min-width, min_width, MinWidth, Position, mMinWidth, eCSSType_Value, PR_TRUE, nsnull)
|
||||
CSS_PROP_DISPLAY(-moz-opacity, opacity, MozOpacity, Display, mOpacity, eCSSType_Value, PR_FALSE, nsnull) // XXX bug 3935
|
||||
CSS_PROP_DISPLAY(opacity, opacity, Opacity, Display, mOpacity, eCSSType_Value, PR_FALSE, nsnull) // XXX bug 3935
|
||||
CSS_PROP_BACKENDONLY(orphans, orphans, Orphans, Breaks, mOrphans, eCSSType_Value, PR_FALSE, nsnull)
|
||||
CSS_PROP_NOTIMPLEMENTED(outline, outline, Outline)
|
||||
CSS_PROP_NOTIMPLEMENTED(outline-color, outline_color, OutlineColor)
|
||||
|
||||
@ -99,14 +99,32 @@ nsCSSProps::ReleaseTable(void)
|
||||
}
|
||||
}
|
||||
|
||||
struct CSSPropertyAlias {
|
||||
const char name[13];
|
||||
nsCSSProperty id;
|
||||
};
|
||||
|
||||
static const CSSPropertyAlias gAliases[] = {
|
||||
{ "-moz-opacity", eCSSProperty_opacity }
|
||||
};
|
||||
|
||||
nsCSSProperty
|
||||
nsCSSProps::LookupProperty(const nsACString& aProperty)
|
||||
{
|
||||
NS_ASSERTION(gPropertyTable, "no lookup table, needs addref");
|
||||
if (gPropertyTable) {
|
||||
return nsCSSProperty(gPropertyTable->Lookup(aProperty));
|
||||
}
|
||||
return eCSSProperty_UNKNOWN;
|
||||
|
||||
nsCSSProperty res = nsCSSProperty(gPropertyTable->Lookup(aProperty));
|
||||
if (res == eCSSProperty_UNKNOWN) {
|
||||
const nsCString& prop = PromiseFlatCString(aProperty);
|
||||
for (const CSSPropertyAlias *alias = gAliases,
|
||||
*alias_end = gAliases + NS_ARRAY_LENGTH(gAliases);
|
||||
alias < alias_end; ++alias)
|
||||
if (nsCRT::strcasecmp(prop.get(), alias->name) == 0) {
|
||||
res = alias->id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
nsCSSProperty
|
||||
@ -115,10 +133,18 @@ nsCSSProps::LookupProperty(const nsAString& aProperty) {
|
||||
// LookupProperty(nsACString&). The table will do its own
|
||||
// converting and avoid a PromiseFlatCString() call.
|
||||
NS_ASSERTION(gPropertyTable, "no lookup table, needs addref");
|
||||
if (gPropertyTable) {
|
||||
return nsCSSProperty(gPropertyTable->Lookup(aProperty));
|
||||
}
|
||||
return eCSSProperty_UNKNOWN;
|
||||
nsCSSProperty res = nsCSSProperty(gPropertyTable->Lookup(aProperty));
|
||||
if (res == eCSSProperty_UNKNOWN) {
|
||||
NS_ConvertUTF16toUTF8 prop(aProperty);
|
||||
for (const CSSPropertyAlias *alias = gAliases,
|
||||
*alias_end = gAliases + NS_ARRAY_LENGTH(gAliases);
|
||||
alias < alias_end; ++alias)
|
||||
if (nsCRT::strcasecmp(prop.get(), alias->name) == 0) {
|
||||
res = alias->id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
const nsAFlatCString&
|
||||
|
||||
@ -345,6 +345,10 @@ CSS2PropertiesTearoff::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
#define CSS_PROP_SHORTHAND(name_, id_, method_) \
|
||||
CSS_PROP(name_, id_, method_, , , , ,)
|
||||
#include "nsCSSPropList.h"
|
||||
|
||||
// Aliases
|
||||
CSS_PROP(opacity, X, MozOpacity, X, X, X, X, X)
|
||||
|
||||
#undef CSS_PROP_SHORTHAND
|
||||
#undef CSS_PROP_NOTIMPLEMENTED
|
||||
#undef CSS_PROP_LIST_EXCLUDE_INTERNAL
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user