diff --git a/layout/xul/base/public/nsIBoxObject.idl b/layout/xul/base/public/nsIBoxObject.idl index fae1d2311bab..524b940e4d46 100644 --- a/layout/xul/base/public/nsIBoxObject.idl +++ b/layout/xul/base/public/nsIBoxObject.idl @@ -42,6 +42,8 @@ interface nsIBoxObject : nsISupports wstring getProperty(in wstring propertyName); void setProperty(in wstring propertyName, in wstring propertyValue); void removeProperty(in wstring propertyName); + + wstring getLookAndFeelMetric(in wstring propertyName); }; %{C++ diff --git a/layout/xul/base/src/nsBoxObject.cpp b/layout/xul/base/src/nsBoxObject.cpp index d81f52ac68d1..814fcd13b81b 100644 --- a/layout/xul/base/src/nsBoxObject.cpp +++ b/layout/xul/base/src/nsBoxObject.cpp @@ -33,9 +33,13 @@ #include "nsIStyleContext.h" #include "nsIFrame.h" #include "nsXPIDLString.h" +#include "nsILookAndFeel.h" +#include "nsWidgetsCID.h" +#include "nsIServiceManager.h" + // Static IIDs/CIDs. Try to minimize these. -// None so far. +static NS_DEFINE_CID(kLookAndFeelCID, NS_LOOKANDFEEL_CID); // Implementation ///////////////////////////////////////////////////////////////// @@ -265,6 +269,44 @@ nsBoxObject::GetHeight(PRInt32* aResult) return NS_OK; } +NS_IMETHODIMP +nsBoxObject::GetLookAndFeelMetric(const PRUnichar* aPropertyName, + PRUnichar** aResult) +{ + nsCOMPtr lookAndFeel(do_GetService(kLookAndFeelCID)); + if (!lookAndFeel) + return NS_ERROR_FAILURE; + + nsAutoString property(aPropertyName); + if (property.EqualsIgnoreCase("scrollbarStyle")) { + PRInt32 metricResult; + lookAndFeel->GetMetric(nsILookAndFeel::eMetric_ScrollArrowStyle, metricResult); + switch (metricResult) { + case nsILookAndFeel::eMetric_ScrollArrowStyleBothAtBottom: + *aResult = nsXPIDLString::Copy(NS_LITERAL_STRING("doublebottom")); + break; + case nsILookAndFeel::eMetric_ScrollArrowStyleBothAtEachEnd: + *aResult = nsXPIDLString::Copy(NS_LITERAL_STRING("double")); + break; + case nsILookAndFeel::eMetric_ScrollArrowStyleBothAtTop: + *aResult = nsXPIDLString::Copy(NS_LITERAL_STRING("doubletop")); + break; + default: + *aResult = nsXPIDLString::Copy(NS_LITERAL_STRING("single")); + break; + } + } + else if (property.EqualsIgnoreCase("thumbStyle")) { + PRInt32 metricResult; + lookAndFeel->GetMetric(nsILookAndFeel::eMetric_ScrollSliderStyle, metricResult); + if ( metricResult == nsILookAndFeel::eMetric_ScrollThumbStyleNormal ) + *aResult = nsXPIDLString::Copy(NS_LITERAL_STRING("fixed")); + else + *aResult = nsXPIDLString::Copy(NS_LITERAL_STRING("proportional")); + } + return NS_OK; +} + NS_IMETHODIMP nsBoxObject::GetPropertyAsSupports(const PRUnichar* aPropertyName, nsISupports** aResult) { diff --git a/themes/classic/global/mac/classicBindings.xml b/themes/classic/global/mac/classicBindings.xml index 2579024aaf4a..71f0479aef5a 100644 --- a/themes/classic/global/mac/classicBindings.xml +++ b/themes/classic/global/mac/classicBindings.xml @@ -78,17 +78,23 @@ - + - - - + + + + + + - + - - - + + + + + + diff --git a/themes/modern/global/globalBindings.xml b/themes/modern/global/globalBindings.xml index 28660f191c9c..f08463ad8261 100644 --- a/themes/modern/global/globalBindings.xml +++ b/themes/modern/global/globalBindings.xml @@ -173,17 +173,23 @@ - + - - - + + + + + + - + - - - + + + + + + diff --git a/xpfe/global/resources/content/scrollbarBindings.xml b/xpfe/global/resources/content/scrollbarBindings.xml index 7a16aceb837a..690e9d3cc2da 100644 --- a/xpfe/global/resources/content/scrollbarBindings.xml +++ b/xpfe/global/resources/content/scrollbarBindings.xml @@ -5,26 +5,67 @@ xmlns:html="http://www.w3.org/1999/xhtml" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + +