From ffe7bd207276e12fd27768250feee1a2b9378f7e Mon Sep 17 00:00:00 2001 From: "cbiesinger%web.de" Date: Sat, 16 Feb 2002 13:16:10 +0000 Subject: [PATCH] bug 125716 r=bzbarsky sr=attinasi patch by caillon@returnzero.com Implement getComputedStyle() for 'overflow' property git-svn-id: svn://10.0.0.236/trunk@114691 18797224-902f-48f8-a5cc-f745e15eee43 --- .../html/style/src/nsComputedDOMStyle.cpp | 28 +++++++++++++++++++ mozilla/layout/style/nsComputedDOMStyle.cpp | 28 +++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/mozilla/content/html/style/src/nsComputedDOMStyle.cpp b/mozilla/content/html/style/src/nsComputedDOMStyle.cpp index 8a95f8bf777..635411d0154 100644 --- a/mozilla/content/html/style/src/nsComputedDOMStyle.cpp +++ b/mozilla/content/html/style/src/nsComputedDOMStyle.cpp @@ -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) diff --git a/mozilla/layout/style/nsComputedDOMStyle.cpp b/mozilla/layout/style/nsComputedDOMStyle.cpp index 8a95f8bf777..635411d0154 100644 --- a/mozilla/layout/style/nsComputedDOMStyle.cpp +++ b/mozilla/layout/style/nsComputedDOMStyle.cpp @@ -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)