Added case mangling for properties also, so we are internally consistent.

This commit is contained in:
Per Lundberg
2013-06-05 14:28:19 +03:00
parent cbb44b99b4
commit 733f81bb39
3 changed files with 28 additions and 1 deletions
@@ -317,9 +317,14 @@ namespace CefSharp
void BindingHandler::CreateJavascriptProperties(CefV8Handler* handler, CefRefPtr<CefV8Value> javascriptObject, Dictionary<String^, PropertyInfo^>^ properties)
{
auto unmanagedWrapper = static_cast<UnmanagedWrapper*>(javascriptObject->GetUserData().get());
for each(String^ propertyName in properties->Keys)
{
auto nameStr = toNative(propertyName);
auto jsPropertyName = LowercaseFirst(propertyName);
unmanagedWrapper->AddPropertyMapping(propertyName, jsPropertyName);
auto nameStr = toNative(jsPropertyName);
cef_v8_propertyattribute_t propertyAttribute = V8_PROPERTY_ATTRIBUTE_NONE;
@@ -22,6 +22,7 @@ namespace CefSharp
{
auto unmanagedWrapper = static_cast<UnmanagedWrapper*>(object->GetUserData().get());
auto clrName = toClr(name);
clrName = unmanagedWrapper->GetPropertyMapping(clrName);
PropertyInfo^ property;
if (unmanagedWrapper->Properties->TryGetValue(clrName, property))
@@ -18,6 +18,7 @@ namespace CefSharp
protected:
gcroot<Object^> _obj;
gcroot<Dictionary<String^, String^>^> _methodMap;
gcroot<Dictionary<String^, String^>^> _propertyMap;
public:
gcroot<Dictionary<String^, PropertyInfo^>^> Properties;
@@ -26,6 +27,7 @@ namespace CefSharp
{
_obj = obj;
_methodMap = gcnew Dictionary<String^, String^>();
_propertyMap = gcnew Dictionary<String^, String^>();
}
/// <summary>
@@ -56,6 +58,25 @@ namespace CefSharp
}
}
void AddPropertyMapping(String^ from, String^ to)
{
_propertyMap->Add(to, from);
}
String^ GetPropertyMapping(String^ from)
{
String^ value;
if (_propertyMap->TryGetValue(from, value))
{
return value;
}
else
{
return nullptr;
}
}
IMPLEMENT_REFCOUNTING(UnmanagedWrapper);
};
}