* JSB Rewrite - Add CefSharp.RegisterBoundObject javascript method
To get around the problem of IPC timing, I've reversed the communication, now it's the render process requesting
the bound objects, the implementation is incomplete at this stage, more just a basic proof of concept
Rewrite BindingTest.html using QUnit
One of the tests doesn't map correctly as it requires def user interaction
TODO:
- Get objects by name
- Rename Messages.h values that relate to this change so they are more descriptive
- Better error handling
- Caching of objects within a render process
- Investigate global context options, don't think it's possible to call an async method directly in the global context
# Conflicts:
# CefSharp.Example/Resources/BindingTest.html
* JSB Improve Request/Response message names
* BindingTest.html - Output stress test results
* Remove JavascriptRootObject was leftover from time we used WCF to transmit objects
* JavascriptObjectRepository - Objects are now sent in the same list with an IsAsync flag
Separation when sending over IPC with two unique lists isn't necessary
* JavascriptObjectRepository - Return objects by name or return all by default
Untabify CefAppUnmanagedWrapper.cpp
Add minor comment to CefBrowserWrapper for a reminder that we use Frame Identifier as dictionary key
* Add //TODO: JSB comments for work that's left to be done
Ideally within a render process we cache bound objects once they've been communicated,
It would also be nice to make multiple binding requests so objects can later be added dynamically
* JSB Allow multiple calls to CefSharp.RegisterBoundObject
Update BindingTest.html to name two distinct calls to different bound objects
* JSB - Add some notes about caching, no working implementation yet
* JSB - Dynamically Register object on Request
* JSB Add ability to unbind an object and rename RegisterBoundObject to BindObjectAsync
# Conflicts:
# CefSharp.Example/Resources/BindingTest.html
* JSB BindObjectAsync - if objects already bound then return false
* JSB - Ignore Indexer properties
Were previously throwing an exception
* JSB - Add LegacyJavascriptBindingEnabled option so preserve existing behaviour
This is only useful for SPA application and those that only navigate to pages
hosting within a single domain. Any sort of cross-site navigation and a new
render process will be spawned and objects won't be bound automatically
(You can use the new methods to request they're bound yourself, at least in theory,
more testing required on this)
* Add LegacyBindingTest.html
Current disabled by default. To enable uncomment CefSharpSettings.LegacyJavascriptBindingEnabled = true;
in CefExample.cs
* RegisterJsObject and RegisterAsyncJsObject can now only be used when CefSharpSettings.LegacyJavascriptBindingEnabled = true
See https://github.com/cefsharp/CefSharp/issues/2246 for details
OffScreen
- Now maintains a raw Byte[] buffer that is used to create the GDI bitmaps
can be overridden and raw buffer access granted (eliminates the forced memory copy to the memory mapped view)
WPF
- MemoryMappedFile.CreateNew is now used to create the in memory view and copy the buffer
- InteropBitmapFactory only create new MemoryMappedFile selectively. If the MemoryMappedFile is larger than we require then just reuse it rather than
releasing then allocating a smaller section of memory that's used for double buffering with InteropBitmap and WritableBitmap
- Removed CefDirtyRect and used existing Rect class
- Rename rendering event to Paint, still preferable to implement IBitmapFactory or subclass ChromiumWebBrowser
- Update ChromiumWebBrowserWithScreenshotSupport to support new rendering method - not very well tested.
Resolves#2237
Note that there is one breaking change as offscreen windows are now automatically transparent due to this cef change: https://bitbucket.org/chromiumembedded/cef/commits/3f71138d64586d774f645a6db5283b5205ea9df4
To make a offscreen window non-transparent you need to set the background colour as shown below were it is set to white:
browserSettings.BackgroundColor = 0255255255;
* Add basic ModelBinding which was imported from NancyFx framework - more can be stripped out that's unused
* Add IBinder as a param when registering an object for binding
Binding is disabled by default
* Add license and remove unused using statements
* Make bind method virtual to allow for overriding
Make methods protected
* Add very basic collection support - only primitive types supported for now.
Remove unused exceptions
* Support binding a list of sub objects
* Add null check for null params
* Add BindingOptions class - remove binder and CamelCaseJavascriptNames properties - allow for additional options in the future
Breaking change.
* Add support for List<object> binding type
Pass the IBrowser instance into IWebBrowserInternal.OnAfterBrowserCreated
Keep a reference to IBrowser in the ChromiumWebBrowser instances (reduces the number of GetBrowser calls and also makes it clearer internally when the browser variable is set)
Exposed the necessary functions for start drag to work:
* StartDragging (RenderClientAdapter)
* OnDragSourceEndedAt (ManagedCefBrowserAdapter)
* OnDragSourceSystemDragEnded (ManagedCefBrowserAdapter)
Implemented IRenderWebBrowser.StartDragging for the WPF
ChromiumWebBrowser.
TODO: Would like to add an adorner layer for the dragged text (using the
supplied fragment html), but feels like a project for later.