bug 125716 r=bzbarsky sr=attinasi patch by caillon@returnzero.com

Implement getComputedStyle() for 'overflow' property
This commit is contained in:
cbiesinger%web.de 2002-02-16 13:16:10 +00:00
parent 59ccece79f
commit f9fef74165
2 changed files with 56 additions and 0 deletions

View File

@ -216,6 +216,7 @@ private:
nsresult GetDisplay(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
nsresult GetPosition(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
nsresult GetClip(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
nsresult GetOverflow(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
nsROCSSPrimitiveValue* GetROCSSPrimitiveValue();
@ -237,6 +238,7 @@ static const nsCSSProperty queryableProperties[] = {
eCSSProperty_right,
eCSSProperty_bottom,
eCSSProperty_clip,
eCSSProperty_overflow,
eCSSProperty_color,
eCSSProperty_font_family,
@ -249,6 +251,7 @@ static const nsCSSProperty queryableProperties[] = {
eCSSProperty_background_image,
eCSSProperty_display,
eCSSProperty_visibility,
eCSSProperty_position,
eCSSProperty_binding,
eCSSProperty_float,
@ -576,6 +579,8 @@ nsComputedDOMStyle::GetPropertyCSSValue(const nsAReadableString& aPropertyName,
// Clip
case eCSSProperty_clip:
rv = GetClip(frame, *getter_AddRefs(val)); break;
case eCSSProperty_overflow:
rv = GetOverflow(frame, *getter_AddRefs(val)); break;
default :
break;
}
@ -1872,6 +1877,29 @@ nsComputedDOMStyle::GetClip(nsIFrame *aFrame,
return CallQueryInterface(val, &aValue);
}
nsresult
nsComputedDOMStyle::GetOverflow(nsIFrame *aFrame,
nsIDOMCSSPrimitiveValue*& aValue)
{
nsROCSSPrimitiveValue* val=GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
const nsStyleDisplay* display=nsnull;
GetStyleData(eStyleStruct_Display,(const nsStyleStruct*&)display,aFrame);
if (display && display->mOverflow != NS_STYLE_OVERFLOW_AUTO) {
const nsAFlatCString& overflow =
nsCSSProps::SearchKeywordTable(display->mOverflow,
nsCSSProps::kOverflowKTable);
val->SetString(overflow);
}
else {
val->SetString(NS_LITERAL_STRING("auto"));
}
return CallQueryInterface(val, &aValue);
}
#if 0
NS_IMETHODIMP
nsComputedDOMStyle::GetElevation(nsAWritableString& aElevation)

View File

@ -216,6 +216,7 @@ private:
nsresult GetDisplay(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
nsresult GetPosition(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
nsresult GetClip(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
nsresult GetOverflow(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
nsROCSSPrimitiveValue* GetROCSSPrimitiveValue();
@ -237,6 +238,7 @@ static const nsCSSProperty queryableProperties[] = {
eCSSProperty_right,
eCSSProperty_bottom,
eCSSProperty_clip,
eCSSProperty_overflow,
eCSSProperty_color,
eCSSProperty_font_family,
@ -249,6 +251,7 @@ static const nsCSSProperty queryableProperties[] = {
eCSSProperty_background_image,
eCSSProperty_display,
eCSSProperty_visibility,
eCSSProperty_position,
eCSSProperty_binding,
eCSSProperty_float,
@ -576,6 +579,8 @@ nsComputedDOMStyle::GetPropertyCSSValue(const nsAReadableString& aPropertyName,
// Clip
case eCSSProperty_clip:
rv = GetClip(frame, *getter_AddRefs(val)); break;
case eCSSProperty_overflow:
rv = GetOverflow(frame, *getter_AddRefs(val)); break;
default :
break;
}
@ -1872,6 +1877,29 @@ nsComputedDOMStyle::GetClip(nsIFrame *aFrame,
return CallQueryInterface(val, &aValue);
}
nsresult
nsComputedDOMStyle::GetOverflow(nsIFrame *aFrame,
nsIDOMCSSPrimitiveValue*& aValue)
{
nsROCSSPrimitiveValue* val=GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
const nsStyleDisplay* display=nsnull;
GetStyleData(eStyleStruct_Display,(const nsStyleStruct*&)display,aFrame);
if (display && display->mOverflow != NS_STYLE_OVERFLOW_AUTO) {
const nsAFlatCString& overflow =
nsCSSProps::SearchKeywordTable(display->mOverflow,
nsCSSProps::kOverflowKTable);
val->SetString(overflow);
}
else {
val->SetString(NS_LITERAL_STRING("auto"));
}
return CallQueryInterface(val, &aValue);
}
#if 0
NS_IMETHODIMP
nsComputedDOMStyle::GetElevation(nsAWritableString& aElevation)