Fix assertions when getting computed -moz-outline-width and

-moz-marker-offset and enable these in Inspector.  Bug 114086, r=fabian,
sr=attinasi
This commit is contained in:
bzbarsky%mit.edu 2002-01-10 02:20:17 +00:00
Родитель be2717b24a
Коммит a37cc134f1
3 изменённых файлов: 104 добавлений и 20 удалений

Просмотреть файл

@ -1285,7 +1285,25 @@ nsComputedDOMStyle::GetMarkerOffset(nsIFrame *aFrame,
const nsStyleContent* content=nsnull; const nsStyleContent* content=nsnull;
GetStyleData(eStyleStruct_Content, (const nsStyleStruct*&)content, aFrame); GetStyleData(eStyleStruct_Content, (const nsStyleStruct*&)content, aFrame);
val->SetTwips(content? content->mMarkerOffset.GetCoordValue():0); if (content) {
switch (content->mMarkerOffset.GetUnit()) {
case eStyleUnit_Coord:
val->SetTwips(content->mMarkerOffset.GetCoordValue());
break;
case eStyleUnit_Auto:
val->SetString(NS_LITERAL_STRING("auto"));
break;
case eStyleUnit_Null:
val->SetString(NS_LITERAL_STRING("none"));
break;
default:
NS_WARNING("Double check the unit");
val->SetTwips(0);
break;
}
} else {
val->SetTwips(0);
}
return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue), return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue),
(void **)&aValue); (void **)&aValue);
@ -1309,7 +1327,30 @@ nsComputedDOMStyle::GetOutlineWidth(nsIFrame *aFrame,
const nsStyleOutline* outline=nsnull; const nsStyleOutline* outline=nsnull;
GetStyleData(eStyleStruct_Outline, (const nsStyleStruct*&)outline, aFrame); GetStyleData(eStyleStruct_Outline, (const nsStyleStruct*&)outline, aFrame);
val->SetTwips(outline? outline->mOutlineWidth.GetCoordValue():0); if (outline) {
switch (outline->mOutlineWidth.GetUnit()) {
case eStyleUnit_Coord:
val->SetTwips(outline->mOutlineWidth.GetCoordValue());
break;
case eStyleUnit_Integer:
case eStyleUnit_Proportional:
case eStyleUnit_Enumerated:
case eStyleUnit_Chars:
{
const nsAFlatCString& width =
nsCSSProps::LookupPropertyValue(eCSSProperty_outline_width,
outline->mOutlineWidth.GetIntValue());
val->SetString(width.get());
break;
}
default:
NS_WARNING("Double check the unit");
val->SetTwips(0);
break;
}
} else {
val->SetTwips(0);
}
return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue), return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue),
(void **)&aValue); (void **)&aValue);
@ -1326,10 +1367,15 @@ nsComputedDOMStyle::GetOutlineStyle(nsIFrame *aFrame,
GetStyleData(eStyleStruct_Outline, (const nsStyleStruct*&)outline, aFrame); GetStyleData(eStyleStruct_Outline, (const nsStyleStruct*&)outline, aFrame);
if(outline) { if(outline) {
const nsAFlatCString& style= PRUint8 outlineStyle = outline->GetOutlineStyle();
nsCSSProps::SearchKeywordTable(outline->GetOutlineStyle(), if (outlineStyle == NS_STYLE_BORDER_STYLE_NONE) {
nsCSSProps::kBorderStyleKTable); val->SetString(NS_LITERAL_STRING("none"));
val->SetString(style.get()); } else {
const nsAFlatCString& style=
nsCSSProps::SearchKeywordTable(outline->GetOutlineStyle(),
nsCSSProps::kBorderStyleKTable);
val->SetString(style.get());
}
} }
else { else {
val->SetString(""); val->SetString("");

Просмотреть файл

@ -150,14 +150,6 @@ function(aRow, aColId)
return this.mStyleList.item(aRow); return this.mStyleList.item(aRow);
} else if (aColId == "olcStyleValue") { } else if (aColId == "olcStyleValue") {
var prop = this.mStyleList.item(aRow); var prop = this.mStyleList.item(aRow);
// The computed style getters for these properties are not yet
// implemented properly, and trying to fetch them results in
// a hailstorm of assertions.
switch (prop) {
case "-moz-outline-width":
case "marker-offset":
return "";
}
return this.mStyleList.getPropertyValue(prop); return this.mStyleList.getPropertyValue(prop);
} }

Просмотреть файл

@ -1285,7 +1285,25 @@ nsComputedDOMStyle::GetMarkerOffset(nsIFrame *aFrame,
const nsStyleContent* content=nsnull; const nsStyleContent* content=nsnull;
GetStyleData(eStyleStruct_Content, (const nsStyleStruct*&)content, aFrame); GetStyleData(eStyleStruct_Content, (const nsStyleStruct*&)content, aFrame);
val->SetTwips(content? content->mMarkerOffset.GetCoordValue():0); if (content) {
switch (content->mMarkerOffset.GetUnit()) {
case eStyleUnit_Coord:
val->SetTwips(content->mMarkerOffset.GetCoordValue());
break;
case eStyleUnit_Auto:
val->SetString(NS_LITERAL_STRING("auto"));
break;
case eStyleUnit_Null:
val->SetString(NS_LITERAL_STRING("none"));
break;
default:
NS_WARNING("Double check the unit");
val->SetTwips(0);
break;
}
} else {
val->SetTwips(0);
}
return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue), return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue),
(void **)&aValue); (void **)&aValue);
@ -1309,7 +1327,30 @@ nsComputedDOMStyle::GetOutlineWidth(nsIFrame *aFrame,
const nsStyleOutline* outline=nsnull; const nsStyleOutline* outline=nsnull;
GetStyleData(eStyleStruct_Outline, (const nsStyleStruct*&)outline, aFrame); GetStyleData(eStyleStruct_Outline, (const nsStyleStruct*&)outline, aFrame);
val->SetTwips(outline? outline->mOutlineWidth.GetCoordValue():0); if (outline) {
switch (outline->mOutlineWidth.GetUnit()) {
case eStyleUnit_Coord:
val->SetTwips(outline->mOutlineWidth.GetCoordValue());
break;
case eStyleUnit_Integer:
case eStyleUnit_Proportional:
case eStyleUnit_Enumerated:
case eStyleUnit_Chars:
{
const nsAFlatCString& width =
nsCSSProps::LookupPropertyValue(eCSSProperty_outline_width,
outline->mOutlineWidth.GetIntValue());
val->SetString(width.get());
break;
}
default:
NS_WARNING("Double check the unit");
val->SetTwips(0);
break;
}
} else {
val->SetTwips(0);
}
return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue), return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue),
(void **)&aValue); (void **)&aValue);
@ -1326,10 +1367,15 @@ nsComputedDOMStyle::GetOutlineStyle(nsIFrame *aFrame,
GetStyleData(eStyleStruct_Outline, (const nsStyleStruct*&)outline, aFrame); GetStyleData(eStyleStruct_Outline, (const nsStyleStruct*&)outline, aFrame);
if(outline) { if(outline) {
const nsAFlatCString& style= PRUint8 outlineStyle = outline->GetOutlineStyle();
nsCSSProps::SearchKeywordTable(outline->GetOutlineStyle(), if (outlineStyle == NS_STYLE_BORDER_STYLE_NONE) {
nsCSSProps::kBorderStyleKTable); val->SetString(NS_LITERAL_STRING("none"));
val->SetString(style.get()); } else {
const nsAFlatCString& style=
nsCSSProps::SearchKeywordTable(outline->GetOutlineStyle(),
nsCSSProps::kBorderStyleKTable);
val->SetString(style.get());
}
} }
else { else {
val->SetString(""); val->SetString("");