зеркало из https://github.com/mozilla/pjs.git
Implement remaining properties in computed style (with some hacks for counter() values for content), and fix some page-break-* bugs exposed by the added test coverage. b=316981 r+sr=bzbarsky
This commit is contained in:
Родитель
0fdd41c6b0
Коммит
d6624afd98
|
@ -117,6 +117,7 @@ const nsAFlatCString&
|
|||
nsCSSKeywords::GetStringValue(nsCSSKeyword aKeyword)
|
||||
{
|
||||
NS_ASSERTION(gKeywordTable, "no lookup table, needs addref");
|
||||
NS_ASSERTION(0 <= aKeyword && aKeyword < eCSSKeyword_COUNT, "out of range");
|
||||
if (gKeywordTable) {
|
||||
return gKeywordTable->GetStringValue(PRInt32(aKeyword));
|
||||
} else {
|
||||
|
|
|
@ -597,6 +597,119 @@ nsComputedDOMStyle::GetColumnGap(nsIDOMCSSValue** aValue)
|
|||
return CallQueryInterface(val, aValue);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComputedDOMStyle::GetContent(nsIDOMCSSValue** aValue)
|
||||
{
|
||||
const nsStyleContent *content = GetStyleContent();
|
||||
|
||||
if (content->ContentCount() == 0) {
|
||||
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
||||
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
||||
val->SetIdent(nsGkAtoms::none);
|
||||
return CallQueryInterface(val, aValue);
|
||||
}
|
||||
|
||||
if (content->ContentCount() == 1 &&
|
||||
content->ContentAt(0).mType == eStyleContentType_AltContent) {
|
||||
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
||||
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
||||
val->SetIdent(eCSSKeyword__moz_alt_content);
|
||||
return CallQueryInterface(val, aValue);
|
||||
}
|
||||
|
||||
nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE);
|
||||
NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
for (PRUint32 i = 0, i_end = content->ContentCount(); i < i_end; ++i) {
|
||||
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
||||
if (!val || !valueList->AppendCSSValue(val)) {
|
||||
delete valueList;
|
||||
delete val;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
const nsStyleContentData &data = content->ContentAt(i);
|
||||
switch (data.mType) {
|
||||
case eStyleContentType_String:
|
||||
{
|
||||
nsString str;
|
||||
nsStyleUtil::EscapeCSSString(nsDependentString(data.mContent.mString),
|
||||
str);
|
||||
str.Insert(PRUnichar('"'), 0);
|
||||
str.Append(PRUnichar('"'));
|
||||
val->SetString(str);
|
||||
}
|
||||
break;
|
||||
case eStyleContentType_Image:
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
if (data.mContent.mImage) {
|
||||
data.mContent.mImage->GetURI(getter_AddRefs(uri));
|
||||
}
|
||||
val->SetURI(uri);
|
||||
}
|
||||
break;
|
||||
case eStyleContentType_Attr:
|
||||
val->SetString(nsDependentString(data.mContent.mString),
|
||||
nsIDOMCSSPrimitiveValue::CSS_ATTR);
|
||||
break;
|
||||
case eStyleContentType_Counter:
|
||||
case eStyleContentType_Counters:
|
||||
{
|
||||
/* FIXME: counters should really use an object */
|
||||
nsAutoString str;
|
||||
if (data.mType == eStyleContentType_Counter) {
|
||||
str.AppendLiteral("counter(");
|
||||
}
|
||||
else {
|
||||
str.AppendLiteral("counters(");
|
||||
}
|
||||
// WRITE ME
|
||||
nsCSSValue::Array *a = data.mContent.mCounters;
|
||||
|
||||
str.Append(a->Item(0).GetStringBufferValue());
|
||||
PRInt32 typeItem = 1;
|
||||
if (data.mType == eStyleContentType_Counters) {
|
||||
typeItem = 2;
|
||||
str.AppendLiteral(", \"");
|
||||
nsString itemstr;
|
||||
nsStyleUtil::EscapeCSSString(
|
||||
nsDependentString(a->Item(1).GetStringBufferValue()), itemstr);
|
||||
str.Append(itemstr);
|
||||
str.Append(PRUnichar('"'));
|
||||
}
|
||||
PRInt32 type = a->Item(typeItem).GetIntValue();
|
||||
if (type != NS_STYLE_LIST_STYLE_DECIMAL) {
|
||||
str.AppendLiteral(", ");
|
||||
str.AppendInt(type);
|
||||
}
|
||||
|
||||
str.Append(PRUnichar(')'));
|
||||
val->SetString(str, nsIDOMCSSPrimitiveValue::CSS_COUNTER);
|
||||
}
|
||||
break;
|
||||
case eStyleContentType_OpenQuote:
|
||||
val->SetIdent(eCSSKeyword_open_quote);
|
||||
break;
|
||||
case eStyleContentType_CloseQuote:
|
||||
val->SetIdent(eCSSKeyword_close_quote);
|
||||
break;
|
||||
case eStyleContentType_NoOpenQuote:
|
||||
val->SetIdent(eCSSKeyword_no_open_quote);
|
||||
break;
|
||||
case eStyleContentType_NoCloseQuote:
|
||||
val->SetIdent(eCSSKeyword_no_close_quote);
|
||||
break;
|
||||
case eStyleContentType_AltContent:
|
||||
default:
|
||||
NS_NOTREACHED("unexpected type");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return CallQueryInterface(valueList, aValue);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComputedDOMStyle::GetCounterIncrement(nsIDOMCSSValue** aValue)
|
||||
{
|
||||
|
@ -614,22 +727,14 @@ nsComputedDOMStyle::GetCounterIncrement(nsIDOMCSSValue** aValue)
|
|||
|
||||
for (PRUint32 i = 0, i_end = content->CounterIncrementCount(); i < i_end; ++i) {
|
||||
nsROCSSPrimitiveValue* name = GetROCSSPrimitiveValue();
|
||||
if (!name) {
|
||||
delete valueList;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
if (!valueList->AppendCSSValue(name)) {
|
||||
if (!name || !valueList->AppendCSSValue(name)) {
|
||||
delete valueList;
|
||||
delete name;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsROCSSPrimitiveValue* value = GetROCSSPrimitiveValue();
|
||||
if (!value) {
|
||||
delete valueList;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
if (!valueList->AppendCSSValue(value)) {
|
||||
if (!value || !valueList->AppendCSSValue(value)) {
|
||||
delete valueList;
|
||||
delete value;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -660,22 +765,14 @@ nsComputedDOMStyle::GetCounterReset(nsIDOMCSSValue** aValue)
|
|||
|
||||
for (PRUint32 i = 0, i_end = content->CounterResetCount(); i < i_end; ++i) {
|
||||
nsROCSSPrimitiveValue* name = GetROCSSPrimitiveValue();
|
||||
if (!name) {
|
||||
delete valueList;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
if (!valueList->AppendCSSValue(name)) {
|
||||
if (!name || !valueList->AppendCSSValue(name)) {
|
||||
delete valueList;
|
||||
delete name;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsROCSSPrimitiveValue* value = GetROCSSPrimitiveValue();
|
||||
if (!value) {
|
||||
delete valueList;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
if (!valueList->AppendCSSValue(value)) {
|
||||
if (!value || !valueList->AppendCSSValue(value)) {
|
||||
delete valueList;
|
||||
delete value;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -689,6 +786,50 @@ nsComputedDOMStyle::GetCounterReset(nsIDOMCSSValue** aValue)
|
|||
return CallQueryInterface(valueList, aValue);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComputedDOMStyle::GetQuotes(nsIDOMCSSValue** aValue)
|
||||
{
|
||||
const nsStyleQuotes *quotes = GetStyleQuotes();
|
||||
|
||||
if (quotes->QuotesCount() == 0) {
|
||||
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
||||
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
||||
val->SetIdent(nsGkAtoms::none);
|
||||
return CallQueryInterface(val, aValue);
|
||||
}
|
||||
|
||||
nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE);
|
||||
NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
for (PRUint32 i = 0, i_end = quotes->QuotesCount(); i < i_end; ++i) {
|
||||
nsROCSSPrimitiveValue* openVal = GetROCSSPrimitiveValue();
|
||||
if (!openVal || !valueList->AppendCSSValue(openVal)) {
|
||||
delete valueList;
|
||||
delete openVal;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsROCSSPrimitiveValue* closeVal = GetROCSSPrimitiveValue();
|
||||
if (!closeVal || !valueList->AppendCSSValue(closeVal)) {
|
||||
delete valueList;
|
||||
delete closeVal;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsString s;
|
||||
nsStyleUtil::EscapeCSSString(*quotes->OpenQuoteAt(i), s);
|
||||
s.Insert(PRUnichar('"'), 0);
|
||||
s.Append(PRUnichar('"'));
|
||||
openVal->SetString(s);
|
||||
nsStyleUtil::EscapeCSSString(*quotes->CloseQuoteAt(i), s);
|
||||
s.Insert(PRUnichar('"'), 0);
|
||||
s.Append(PRUnichar('"'));
|
||||
closeVal->SetString(s);
|
||||
}
|
||||
|
||||
return CallQueryInterface(valueList, aValue);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComputedDOMStyle::GetFontFamily(nsIDOMCSSValue** aValue)
|
||||
{
|
||||
|
@ -919,6 +1060,51 @@ nsComputedDOMStyle::GetBackgroundOrigin(nsIDOMCSSValue** aValue)
|
|||
return CallQueryInterface(val, aValue);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComputedDOMStyle::GetBackgroundPosition(nsIDOMCSSValue** aValue)
|
||||
{
|
||||
nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE);
|
||||
NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsROCSSPrimitiveValue *valX = GetROCSSPrimitiveValue();
|
||||
if (!valX || !valueList->AppendCSSValue(valX)) {
|
||||
delete valueList;
|
||||
delete valX;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsROCSSPrimitiveValue *valY = GetROCSSPrimitiveValue();
|
||||
if (!valY || !valueList->AppendCSSValue(valY)) {
|
||||
delete valueList;
|
||||
delete valY;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
const nsStyleBackground *bg = GetStyleBackground();
|
||||
|
||||
if (NS_STYLE_BG_X_POSITION_LENGTH & bg->mBackgroundFlags) {
|
||||
valX->SetAppUnits(bg->mBackgroundXPosition.mCoord);
|
||||
}
|
||||
else if (NS_STYLE_BG_X_POSITION_PERCENT & bg->mBackgroundFlags) {
|
||||
valX->SetPercent(bg->mBackgroundXPosition.mFloat);
|
||||
}
|
||||
else {
|
||||
valX->SetPercent(0.0f);
|
||||
}
|
||||
|
||||
if (NS_STYLE_BG_Y_POSITION_LENGTH & bg->mBackgroundFlags) {
|
||||
valY->SetAppUnits(bg->mBackgroundYPosition.mCoord);
|
||||
}
|
||||
else if (NS_STYLE_BG_Y_POSITION_PERCENT & bg->mBackgroundFlags) {
|
||||
valY->SetPercent(bg->mBackgroundYPosition.mFloat);
|
||||
}
|
||||
else {
|
||||
valY->SetPercent(0.0f);
|
||||
}
|
||||
|
||||
return CallQueryInterface(valueList, aValue);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComputedDOMStyle::GetBackgroundRepeat(nsIDOMCSSValue** aValue)
|
||||
{
|
||||
|
@ -1895,6 +2081,17 @@ nsComputedDOMStyle::GetFloatEdge(nsIDOMCSSValue** aValue)
|
|||
return CallQueryInterface(val, aValue);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComputedDOMStyle::GetForceBrokenImageIcon(nsIDOMCSSValue** aValue)
|
||||
{
|
||||
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
||||
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
val->SetNumber(GetStyleUIReset()->mForceBrokenImageIcon);
|
||||
|
||||
return CallQueryInterface(val, aValue);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComputedDOMStyle::GetIMEMode(nsIDOMCSSValue** aValue)
|
||||
{
|
||||
|
@ -2191,6 +2388,40 @@ nsComputedDOMStyle::GetOverflowY(nsIDOMCSSValue** aValue)
|
|||
return CallQueryInterface(val, aValue);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComputedDOMStyle::GetPageBreakAfter(nsIDOMCSSValue** aValue)
|
||||
{
|
||||
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
||||
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
const nsStyleDisplay *display = GetStyleDisplay();
|
||||
|
||||
if (display->mBreakAfter) {
|
||||
val->SetIdent(nsGkAtoms::always);
|
||||
} else {
|
||||
val->SetIdent(nsGkAtoms::_auto);
|
||||
}
|
||||
|
||||
return CallQueryInterface(val, aValue);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComputedDOMStyle::GetPageBreakBefore(nsIDOMCSSValue** aValue)
|
||||
{
|
||||
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
||||
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
const nsStyleDisplay *display = GetStyleDisplay();
|
||||
|
||||
if (display->mBreakBefore) {
|
||||
val->SetIdent(nsGkAtoms::always);
|
||||
} else {
|
||||
val->SetIdent(nsGkAtoms::_auto);
|
||||
}
|
||||
|
||||
return CallQueryInterface(val, aValue);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComputedDOMStyle::GetHeight(nsIDOMCSSValue** aValue)
|
||||
{
|
||||
|
@ -3402,7 +3633,7 @@ nsComputedDOMStyle::GetQueryablePropertyMap(PRUint32* aLength)
|
|||
COMPUTED_STYLE_MAP_ENTRY(background_attachment, BackgroundAttachment),
|
||||
COMPUTED_STYLE_MAP_ENTRY(background_color, BackgroundColor),
|
||||
COMPUTED_STYLE_MAP_ENTRY(background_image, BackgroundImage),
|
||||
//// COMPUTED_STYLE_MAP_ENTRY(background_position, BackgroundPosition),
|
||||
COMPUTED_STYLE_MAP_ENTRY(background_position, BackgroundPosition),
|
||||
COMPUTED_STYLE_MAP_ENTRY(background_repeat, BackgroundRepeat),
|
||||
//// COMPUTED_STYLE_MAP_ENTRY(border, Border),
|
||||
//// COMPUTED_STYLE_MAP_ENTRY(border_bottom, BorderBottom),
|
||||
|
@ -3431,7 +3662,7 @@ nsComputedDOMStyle::GetQueryablePropertyMap(PRUint32* aLength)
|
|||
COMPUTED_STYLE_MAP_ENTRY(clear, Clear),
|
||||
COMPUTED_STYLE_MAP_ENTRY(clip, Clip),
|
||||
COMPUTED_STYLE_MAP_ENTRY(color, Color),
|
||||
// COMPUTED_STYLE_MAP_ENTRY(content, Content),
|
||||
COMPUTED_STYLE_MAP_ENTRY(content, Content),
|
||||
COMPUTED_STYLE_MAP_ENTRY(counter_increment, CounterIncrement),
|
||||
COMPUTED_STYLE_MAP_ENTRY(counter_reset, CounterReset),
|
||||
//// COMPUTED_STYLE_MAP_ENTRY(cue, Cue),
|
||||
|
@ -3487,8 +3718,8 @@ nsComputedDOMStyle::GetQueryablePropertyMap(PRUint32* aLength)
|
|||
COMPUTED_STYLE_MAP_ENTRY(padding_right, PaddingRight),
|
||||
COMPUTED_STYLE_MAP_ENTRY(padding_top, PaddingTop),
|
||||
// COMPUTED_STYLE_MAP_ENTRY(page, Page),
|
||||
// COMPUTED_STYLE_MAP_ENTRY(page_break_after, PageBreakAfter),
|
||||
// COMPUTED_STYLE_MAP_ENTRY(page_break_before, PageBreakBefore),
|
||||
COMPUTED_STYLE_MAP_ENTRY(page_break_after, PageBreakAfter),
|
||||
COMPUTED_STYLE_MAP_ENTRY(page_break_before, PageBreakBefore),
|
||||
// COMPUTED_STYLE_MAP_ENTRY(page_break_inside, PageBreakInside),
|
||||
//// COMPUTED_STYLE_MAP_ENTRY(pause, Pause),
|
||||
// COMPUTED_STYLE_MAP_ENTRY(pause_after, PauseAfter),
|
||||
|
@ -3496,7 +3727,7 @@ nsComputedDOMStyle::GetQueryablePropertyMap(PRUint32* aLength)
|
|||
// COMPUTED_STYLE_MAP_ENTRY(pitch, Pitch),
|
||||
// COMPUTED_STYLE_MAP_ENTRY(pitch_range, PitchRange),
|
||||
COMPUTED_STYLE_MAP_ENTRY(position, Position),
|
||||
// COMPUTED_STYLE_MAP_ENTRY(quotes, Quotes),
|
||||
COMPUTED_STYLE_MAP_ENTRY(quotes, Quotes),
|
||||
// COMPUTED_STYLE_MAP_ENTRY(richness, Richness),
|
||||
COMPUTED_STYLE_MAP_ENTRY(right, Right),
|
||||
//// COMPUTED_STYLE_MAP_ENTRY(size, Size),
|
||||
|
@ -3552,6 +3783,7 @@ nsComputedDOMStyle::GetQueryablePropertyMap(PRUint32* aLength)
|
|||
COMPUTED_STYLE_MAP_ENTRY(_moz_column_width, ColumnWidth),
|
||||
COMPUTED_STYLE_MAP_ENTRY(_moz_column_gap, ColumnGap),
|
||||
COMPUTED_STYLE_MAP_ENTRY(float_edge, FloatEdge),
|
||||
COMPUTED_STYLE_MAP_ENTRY(force_broken_image_icon, ForceBrokenImageIcon),
|
||||
COMPUTED_STYLE_MAP_ENTRY(image_region, ImageRegion),
|
||||
COMPUTED_STYLE_MAP_ENTRY(_moz_outline_radius_bottomLeft, OutlineRadiusBottomLeft),
|
||||
COMPUTED_STYLE_MAP_ENTRY(_moz_outline_radius_bottomRight,OutlineRadiusBottomRight),
|
||||
|
|
|
@ -147,6 +147,7 @@ private:
|
|||
nsresult GetBackgroundAttachment(nsIDOMCSSValue** aValue);
|
||||
nsresult GetBackgroundColor(nsIDOMCSSValue** aValue);
|
||||
nsresult GetBackgroundImage(nsIDOMCSSValue** aValue);
|
||||
nsresult GetBackgroundPosition(nsIDOMCSSValue** aValue);
|
||||
nsresult GetBackgroundRepeat(nsIDOMCSSValue** aValue);
|
||||
nsresult GetBackgroundClip(nsIDOMCSSValue** aValue);
|
||||
nsresult GetBackgroundInlinePolicy(nsIDOMCSSValue** aValue);
|
||||
|
@ -211,10 +212,14 @@ private:
|
|||
nsresult GetOutlineRadiusTopRight(nsIDOMCSSValue** aValue);
|
||||
|
||||
/* Content Properties */
|
||||
nsresult GetContent(nsIDOMCSSValue** aValue);
|
||||
nsresult GetCounterIncrement(nsIDOMCSSValue** aValue);
|
||||
nsresult GetCounterReset(nsIDOMCSSValue** aValue);
|
||||
nsresult GetMarkerOffset(nsIDOMCSSValue** aValue);
|
||||
|
||||
/* Quotes Properties */
|
||||
nsresult GetQuotes(nsIDOMCSSValue** aValue);
|
||||
|
||||
/* z-index */
|
||||
nsresult GetZIndex(nsIDOMCSSValue** aValue);
|
||||
|
||||
|
@ -252,9 +257,12 @@ private:
|
|||
nsresult GetOverflow(nsIDOMCSSValue** aValue);
|
||||
nsresult GetOverflowX(nsIDOMCSSValue** aValue);
|
||||
nsresult GetOverflowY(nsIDOMCSSValue** aValue);
|
||||
nsresult GetPageBreakAfter(nsIDOMCSSValue** aValue);
|
||||
nsresult GetPageBreakBefore(nsIDOMCSSValue** aValue);
|
||||
|
||||
/* User interface properties */
|
||||
nsresult GetCursor(nsIDOMCSSValue** aValue);
|
||||
nsresult GetForceBrokenImageIcon(nsIDOMCSSValue** aValue);
|
||||
nsresult GetIMEMode(nsIDOMCSSValue** aValue);
|
||||
nsresult GetUserFocus(nsIDOMCSSValue** aValue);
|
||||
nsresult GetUserInput(nsIDOMCSSValue** aValue);
|
||||
|
|
|
@ -136,6 +136,7 @@ nsROCSSPrimitiveValue::GetCssText(nsAString& aCssText)
|
|||
break;
|
||||
}
|
||||
case CSS_STRING :
|
||||
case CSS_COUNTER : /* FIXME: COUNTER should use an object */
|
||||
{
|
||||
tmpStr.Append(mValue.mString);
|
||||
break;
|
||||
|
@ -155,6 +156,13 @@ nsROCSSPrimitiveValue::GetCssText(nsAString& aCssText)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case CSS_ATTR :
|
||||
{
|
||||
tmpStr.AppendLiteral("attr(");
|
||||
tmpStr.Append(mValue.mString);
|
||||
tmpStr.Append(PRUnichar(')'));
|
||||
break;
|
||||
}
|
||||
case CSS_PERCENTAGE :
|
||||
{
|
||||
tmpStr.AppendFloat(mValue.mFloat * 100);
|
||||
|
@ -276,8 +284,6 @@ nsROCSSPrimitiveValue::GetCssText(nsAString& aCssText)
|
|||
case CSS_HZ :
|
||||
case CSS_KHZ :
|
||||
case CSS_DIMENSION :
|
||||
case CSS_ATTR :
|
||||
case CSS_COUNTER :
|
||||
NS_ERROR("We have a bogus value set. This should not happen");
|
||||
return NS_ERROR_DOM_INVALID_ACCESS_ERR;
|
||||
}
|
||||
|
@ -413,6 +419,7 @@ nsROCSSPrimitiveValue::GetStringValue(nsAString& aReturn)
|
|||
mValue.mAtom->ToString(aReturn);
|
||||
break;
|
||||
case CSS_STRING:
|
||||
case CSS_ATTR:
|
||||
aReturn.Assign(mValue.mString);
|
||||
break;
|
||||
case CSS_URI: {
|
||||
|
@ -421,7 +428,6 @@ nsROCSSPrimitiveValue::GetStringValue(nsAString& aReturn)
|
|||
mValue.mURI->GetSpec(spec);
|
||||
CopyUTF8toUTF16(spec, aReturn);
|
||||
} break;
|
||||
case CSS_ATTR:
|
||||
default:
|
||||
aReturn.Truncate();
|
||||
return NS_ERROR_DOM_INVALID_ACCESS_ERR;
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include "nsReadableUtils.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsCSSKeywords.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDOMError.h"
|
||||
|
@ -68,6 +69,8 @@ public:
|
|||
nsROCSSPrimitiveValue(PRInt32 aAppUnitsPerInch);
|
||||
virtual ~nsROCSSPrimitiveValue();
|
||||
|
||||
// FIXME Many of these methods should be out-of-line.
|
||||
|
||||
void SetNumber(float aValue)
|
||||
{
|
||||
Reset();
|
||||
|
@ -116,6 +119,12 @@ public:
|
|||
mType = CSS_IDENT;
|
||||
}
|
||||
|
||||
// FIXME More callers should use this variant.
|
||||
void SetIdent(nsCSSKeyword aKeyword)
|
||||
{
|
||||
SetIdent(nsCSSKeywords::GetStringValue(aKeyword));
|
||||
}
|
||||
|
||||
void SetIdent(const nsACString& aString)
|
||||
{
|
||||
Reset();
|
||||
|
@ -128,24 +137,26 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void SetString(const nsACString& aString)
|
||||
// FIXME: CSS_STRING should imply a string with "" and a need for escaping.
|
||||
void SetString(const nsACString& aString, PRUint16 aType = CSS_STRING)
|
||||
{
|
||||
Reset();
|
||||
mValue.mString = ToNewUnicode(aString);
|
||||
if (mValue.mString) {
|
||||
mType = CSS_STRING;
|
||||
mType = aType;
|
||||
} else {
|
||||
// XXXcaa We should probably let the caller know we are out of memory
|
||||
mType = CSS_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
void SetString(const nsAString& aString)
|
||||
// FIXME: CSS_STRING should imply a string with "" and a need for escaping.
|
||||
void SetString(const nsAString& aString, PRUint16 aType = CSS_STRING)
|
||||
{
|
||||
Reset();
|
||||
mValue.mString = ToNewUnicode(aString);
|
||||
if (mValue.mString) {
|
||||
mType = CSS_STRING;
|
||||
mType = aType;
|
||||
} else {
|
||||
// XXXcaa We should probably let the caller know we are out of memory
|
||||
mType = CSS_UNKNOWN;
|
||||
|
@ -196,6 +207,8 @@ public:
|
|||
NS_RELEASE(mValue.mAtom);
|
||||
break;
|
||||
case CSS_STRING:
|
||||
case CSS_ATTR:
|
||||
case CSS_COUNTER: // FIXME: Counter should use an object
|
||||
NS_ASSERTION(mValue.mString, "Null string should never happen");
|
||||
nsMemory::Free(mValue.mString);
|
||||
mValue.mString = nsnull;
|
||||
|
@ -226,7 +239,7 @@ private:
|
|||
nsIDOMRect* mRect;
|
||||
PRUnichar* mString;
|
||||
nsIURI* mURI;
|
||||
nsIAtom* mAtom;
|
||||
nsIAtom* mAtom; // FIXME use nsCSSKeyword instead
|
||||
} mValue;
|
||||
|
||||
PRInt32 mAppUnitsPerInch;
|
||||
|
|
|
@ -2771,11 +2771,32 @@ nsRuleNode::ComputeDisplayData(nsStyleStruct* aStartStruct,
|
|||
}
|
||||
|
||||
// temp fix for bug 24000
|
||||
// Map 'auto' and 'avoid' to PR_FALSE, and 'always', 'left', and
|
||||
// 'right' to PR_TRUE.
|
||||
// "A conforming user agent may interpret the values 'left' and
|
||||
// 'right' as 'always'." - CSS2.1, section 13.3.1
|
||||
if (eCSSUnit_Enumerated == displayData.mBreakBefore.GetUnit()) {
|
||||
display->mBreakBefore = (NS_STYLE_PAGE_BREAK_ALWAYS == displayData.mBreakBefore.GetIntValue());
|
||||
display->mBreakBefore = (NS_STYLE_PAGE_BREAK_AVOID != displayData.mBreakBefore.GetIntValue());
|
||||
}
|
||||
else if (eCSSUnit_Auto == displayData.mBreakBefore.GetUnit() ||
|
||||
eCSSUnit_Initial == displayData.mBreakBefore.GetUnit()) {
|
||||
display->mBreakBefore = PR_FALSE;
|
||||
}
|
||||
else if (eCSSUnit_Inherit == displayData.mBreakBefore.GetUnit()) {
|
||||
inherited = PR_TRUE;
|
||||
display->mBreakBefore = parentDisplay->mBreakBefore;
|
||||
}
|
||||
|
||||
if (eCSSUnit_Enumerated == displayData.mBreakAfter.GetUnit()) {
|
||||
display->mBreakAfter = (NS_STYLE_PAGE_BREAK_ALWAYS == displayData.mBreakAfter.GetIntValue());
|
||||
display->mBreakAfter = (NS_STYLE_PAGE_BREAK_AVOID != displayData.mBreakAfter.GetIntValue());
|
||||
}
|
||||
else if (eCSSUnit_Auto == displayData.mBreakAfter.GetUnit() ||
|
||||
eCSSUnit_Initial == displayData.mBreakAfter.GetUnit()) {
|
||||
display->mBreakAfter = PR_FALSE;
|
||||
}
|
||||
else if (eCSSUnit_Inherit == displayData.mBreakAfter.GetUnit()) {
|
||||
inherited = PR_TRUE;
|
||||
display->mBreakAfter = parentDisplay->mBreakAfter;
|
||||
}
|
||||
// end temp fix
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
<script class="testbody" type="text/javascript">
|
||||
|
||||
var gNoComputedStyle = {
|
||||
"-moz-force-broken-image-icon": true,
|
||||
"-moz-border-end": true, // NB: shorthand
|
||||
"-moz-border-end-color": true,
|
||||
"-moz-border-end-style": true,
|
||||
|
@ -34,11 +33,6 @@ var gNoComputedStyle = {
|
|||
"-moz-margin-start": true,
|
||||
"-moz-padding-end": true,
|
||||
"-moz-padding-start": true,
|
||||
"background-position": true,
|
||||
"content": true,
|
||||
"page-break-after": true,
|
||||
"page-break-before": true,
|
||||
"quotes": true,
|
||||
};
|
||||
|
||||
var gXFailComputed = {
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
/** Test for computation of CSS 'inherit' **/
|
||||
|
||||
var gNoComputedStyle = {
|
||||
"-moz-force-broken-image-icon": true,
|
||||
"-moz-border-end": true, // NB: shorthand
|
||||
"-moz-border-end-color": true,
|
||||
"-moz-border-end-style": true,
|
||||
|
@ -36,11 +35,6 @@ var gNoComputedStyle = {
|
|||
"-moz-margin-start": true,
|
||||
"-moz-padding-end": true,
|
||||
"-moz-padding-start": true,
|
||||
"background-position": true,
|
||||
"content": true,
|
||||
"page-break-after": true,
|
||||
"page-break-before": true,
|
||||
"quotes": true,
|
||||
};
|
||||
|
||||
function xfail_diffcomputed(property) {
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
/** Test for computation of CSS '-moz-initial' **/
|
||||
|
||||
var gNoComputedStyle = {
|
||||
"-moz-force-broken-image-icon": true,
|
||||
"-moz-border-end": true, // NB: shorthand
|
||||
"-moz-border-end-color": true,
|
||||
"-moz-border-end-style": true,
|
||||
|
@ -49,11 +48,6 @@ var gNoComputedStyle = {
|
|||
"-moz-margin-start": true,
|
||||
"-moz-padding-end": true,
|
||||
"-moz-padding-start": true,
|
||||
"background-position": true,
|
||||
"content": true,
|
||||
"page-break-after": true,
|
||||
"page-break-before": true,
|
||||
"quotes": true,
|
||||
};
|
||||
|
||||
function xfail_diffcomputed(property) {
|
||||
|
@ -131,6 +125,7 @@ var gBrokenInitial = {
|
|||
"padding-right": true,
|
||||
"padding-top": true,
|
||||
"position": true,
|
||||
"quotes": true,
|
||||
"right": true,
|
||||
"table-layout": true,
|
||||
"text-decoration": true,
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
/** Test for computation of values in property database **/
|
||||
|
||||
var gNoComputedStyle = {
|
||||
"-moz-force-broken-image-icon": true,
|
||||
"-moz-border-end": true, // NB: shorthand
|
||||
"-moz-border-end-color": true,
|
||||
"-moz-border-end-style": true,
|
||||
|
@ -49,11 +48,6 @@ var gNoComputedStyle = {
|
|||
"-moz-margin-start": true,
|
||||
"-moz-padding-end": true,
|
||||
"-moz-padding-start": true,
|
||||
"background-position": true,
|
||||
"content": true,
|
||||
"page-break-after": true,
|
||||
"page-break-before": true,
|
||||
"quotes": true,
|
||||
};
|
||||
|
||||
function xfail_diffcomputed(property) {
|
||||
|
@ -67,17 +61,6 @@ var gNotAccepted = {
|
|||
"list-style": [ "none disc outside" ],
|
||||
};
|
||||
|
||||
var gBackgroundValuesWithOnlyPosition = {
|
||||
"top": true,
|
||||
"left": true,
|
||||
"50% 50%": true,
|
||||
"center": true,
|
||||
"bottom right scroll none transparent repeat": true,
|
||||
"50% transparent": true,
|
||||
"transparent 50%": true,
|
||||
"50%": true,
|
||||
};
|
||||
|
||||
var gBadComputed = {
|
||||
// NS_STYLE_COLUMN_COUNT_AUTO is 0
|
||||
"-moz-column-count": [ "0" ],
|
||||
|
@ -94,6 +77,10 @@ var gBadComputed = {
|
|||
// 'normal' should compute to 0
|
||||
"word-spacing": [ "0", "0px", "-0em" ],
|
||||
|
||||
// These values are treated as auto.
|
||||
"page-break-after": [ "avoid" ],
|
||||
"page-break-before": [ "avoid" ],
|
||||
|
||||
// These are probably bogus tests...
|
||||
"-moz-outline-radius": [ "0%" ],
|
||||
"-moz-outline-radius-bottomleft": [ "0%" ],
|
||||
|
@ -132,10 +119,6 @@ function xfail_value(property, value, is_initial, has_frame) {
|
|||
gBadComputedNoFrame[property].indexOf(value) != -1)
|
||||
return true;
|
||||
|
||||
// One subproperty of 'background' is in gNoComputedStyle
|
||||
if (property == "background" && value in gBackgroundValuesWithOnlyPosition)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,8 +58,6 @@ var gShorthandsWithoutCondensingSerialize = {
|
|||
};
|
||||
|
||||
var gNoComputedValue = {
|
||||
"background-position": true,
|
||||
"content": true,
|
||||
};
|
||||
|
||||
var gNotAccepted = {
|
||||
|
|
Загрузка…
Ссылка в новой задаче