Commit Graph

4985 Commits

Author SHA1 Message Date
Daniel Bretzigheimer f98fb858c7 tooltip updates it position when the tooltip text is changed (#2232)
* tooltip updates it position when the tooltip text is changed

* encoding fixed
2018-01-22 11:04:59 +10:00
amaitland efc77d4fcc Fix typo 2018-01-22 11:03:49 +10:00
amaitland 679cdb5b11 JSB ResolveObject WcfEnabled = false throw exception if attempt to register sync object
Update the examples to use newer Register method as Legacy options is disabled by default
2018-01-22 11:02:23 +10:00
Alex Maitland 9b01b69d2f Implement Javascript Binding v2 (#2247)
* 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
2018-01-22 10:24:25 +10:00
amaitland a2451960d3 WPF IWpfKeyboardHandler Changes
- Make public so users can implement their own handler (the OSR IME patch can be rewritten as a IWpfKeyboardHandler)
- Formatting for consistency
- Make methods virtual

Follow up to #2056
2018-01-18 16:28:53 +10:00
João Neves a845e75432 Prevent accelerator keys to work when typing text (#2056)
* Call correct base method and handle text input in case event wasn't handled
* Removed SourceHook method
* Added previous keyboard handling logic and ability to use it through a property
2018-01-18 16:25:24 +10:00
amaitland 7128ef11aa WPF Example - windowInfo.SetAsWindowless no only takes a single param (remove transparency param as that's now set via backgroundcolor) 2018-01-18 15:06:01 +10:00
amaitland 199aee55a2 WPF Incorrect Type Checking for InteropBitmapFactory
Followup to #2237
2018-01-18 14:13:07 +10:00
amaitland c18c6e7b1f WPF Popup bind layout transform to parent
Popup needs to allow transparency or only ScaleTrasnform will work (comment in reference source see https://referencesource.microsoft.com/#PresentationFramework/src/Framework/System/Windows/Controls/Primitives/Popup.cs,1713)
Bind the parent LayoutTransformProperty to the popup LayoutTransformProperty

Resolves #2151
2018-01-18 13:36:01 +10:00
amaitland c021be6c8d WPF - ChromiumWebBrowser inherits from Control rather than UserControl
Based on #1499

Popup is created in xaml
Canvas used to absolute position the two images, one on top of the other
No Mouse.Capture required
2018-01-18 13:24:29 +10:00
amaitland 67b8b038af Untabify
Follow up to #2218
2018-01-18 11:51:09 +10:00
João Neves b1b8f43859 Dont discard null Values from arrays (#2218)
* Don't discard arrays that contain null values
* Revert unintended change in this branch
* Added qunit test
* Code review and added new tests
2018-01-18 11:46:58 +10:00
amaitland 127c00554f Rewrite WPF/OffScreen OnPaint
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
2018-01-18 11:29:12 +10:00
amaitland 564dd4da73 CefDirectRect was removed, replace with Rect 2018-01-18 10:25:54 +10:00
amaitland 41b3da004f Cleanup CefTime handling - make consistent across all projects
# Conflicts:
#	CefSharp.Core/ResourceHandlerWrapper.cpp
2018-01-18 10:25:54 +10:00
amaitland 8e5ae7b5da Add sendkeyevent example to CefSharp.OffScreen.Example/Program.cs 2018-01-18 10:25:53 +10:00
amaitland 9f874807d5 WebBrowserExtensions.GetHost renamed to GetBrowserHost
Add missing this keyboard to make it an extensions method
2018-01-18 10:25:53 +10:00
amaitland c9000dc0de Add Cef.ShutdownWithoutChecks method - basically allows you to call the underlying CefShutdown method with minimal checks (just IsInitialized and a simple lock) 2018-01-18 10:25:52 +10:00
amaitland e27c9c3c21 Add ExperimentalStreamResponseFilter - buffers all data before performing text processing 2018-01-18 10:25:52 +10:00
amaitland 4e0fb684fe OffScreen - code cleanup and expose more of the underlying methods, allow for overriding of IRenderWebBrowser method when inheriting from ChromiumWebBrowser
Mark ScreenshotOrNull as obsolete - use OnPaint instead
Mark NewScreenshot event as obsolete - use ScreenshotAsync instead
2018-01-18 10:25:51 +10:00
amaitland 85e32974ae WinForms - If the ChromiumWebBrowser has it's handle recreated then in OnHandleCreated we will now attempt to reparent a existing instance rather than creating a new browser
# Conflicts:
#	CefSharp.WinForms/ChromiumWebBrowser.cs
2018-01-18 10:25:51 +10:00
amaitland 0032ae463f WPF Example - update MenuHandler to implement custom menu, execute command based on CefMenuCommand enum rather than trying to use IRunContextMenuCallback which isn't working (upstream issue)
This is a workaround for #1767
You can use the default CEF menu it does however require you to integrate CEF into your main message loop see #1795
2018-01-18 10:25:50 +10:00
amaitland 86774ef0bf WPF - Layout rounding has been changed to UseLayoutRounding so values for ActualWidth and ActualHeight are scaled by the framework
This reverts the change from #1962 where we manually rounded up - it's still possible to do this by inheriting from ChromiumWebBrowser and overriding GetViewRect should you choose to

Easy way to test the rounding changes is to add Margin="0.5,0.5,0,0" to a ChromiumWebBrowser instance in xaml
You can manually disable layout rounding of course UseLayoutRounding="False" in xaml on the control
2018-01-18 10:25:50 +10:00
amaitland 55fb0350a6 WPF Example - Add ChromiumWebBrowserWithScreenshotSupport example - adapted from https://github.com/cefsharp/CefSharp/pull/462/
When screenshot is requested then rendering to the screen is temp disabled, browser is resized and frames are used to take the screenshot
2018-01-18 10:25:49 +10:00
amaitland 8e34166d47 Add Debugger Display attribute to cookie - excluded the cookie value as they can be rather large, show basically the rest of the cookie in the debugger
Add example of VisitAllCookiesAsync
2018-01-18 10:25:49 +10:00
amaitland 5dfd24bddb Upgrade to CEF 3.3239.1723.g071d1c1 / Chromium 63.0.3239.132 2018-01-12 15:45:50 +10:00
mattkol e8b6c0bf9f Request to add a github link to the "Link" list. (#2225)
* Update README.md
2018-01-09 09:00:17 +10:00
amaitland c303e1ca0f JSB - Add support for async methods to return classes
Structs and classes can now be returned from an async method
Properties and fields are supported now. The returned class/struct is readonly effectively, no updates will be sent to the bound object.

Just to clarify this is only for objects bound using RegisterAsyncJsObject
2018-01-08 15:12:52 +10:00
amaitland 751b8366c5 BindingTest.html - Rewrite using QUnit
Rewrite the tests using the QUnit framework, makes for much nicer presentation and should be easier to maintain them, also verifies tests completed successfully.
Tests are wrapped in an anon closure, will be used later for some JSB changes.
2018-01-08 14:45:37 +10:00
João Neves 206e419786 Fix enums, integer and doubles binding behavior (#2219)
* Fix enums binding behavior

* Whitespace cleanups
2018-01-08 14:33:02 +10:00
Alex Maitland 19d0193b27 Update CONTRIBUTING.md
Tweak to wording so matches description of `Sample Application` from http://opensource.spotify.com/cefbuilds/index.html
2018-01-03 14:26:44 +10:00
amaitland a6132ad5cb README.md - Add cefsharp/63 branch details
(branch to follow)
v63.0.0-pre01
2017-12-29 22:19:04 +10:00
amaitland ea4cafed18 Upgrade to CEF 3.3239.1716.g735b746 / Chromium 63.0.3239.109 2017-12-29 22:10:13 +10:00
amaitland edbbd755b6 NuGet.config - Add appveyor cef-binary project feed
cef-binary tagged releases are now pushed to this feed
(Myget still needs to be updated to pull packages from this feed)
2017-12-29 19:48:01 +10:00
amaitland 1ae29bdb78 Upgrade to CEF 3.3239.1709.g093cae4 / Chromium 63.0.3239.109 2017-12-26 09:17:52 +10:00
Alex Maitland d8f86c6a2b FileResourceHandler - Throw exception if file not found
CEF expects files to exist
2017-12-22 14:33:35 +10:00
amaitland 7a0b06ad0b JSB Add support for dynamic keyword (using ExpandoObject)
As ExpandoObject implements IDictionary we can use it interchangeable with only minor breaking changes.
Those expecting Dictionary<string, object> should change to IDictionary<string, object> or ExpandoObject for their param types
This will also impact anyone who has implemented their own custom IBinder
I'd suggest changing the type checking from explicitly checking Dictionary<string, object> to use Type.IsAssignableFrom or another method of comparison
DefaultBinder binder has been updated to accommodate ExpandoObject (now being returned by ObjectsSerialization.cpp)
Add new async binding for testing new assignment method
Rewrite some of the async bound object tests to use await and let - modernize them
2017-12-21 13:00:36 +10:00
amaitland a6f20e82bc Upgrade to CEF 3.3239.1705.gf6d6dfc / Chromium 63.0.3239.109 2017-12-21 11:13:02 +10:00
amaitland cc5a92f307 WPF - Add protected virtual void OnImeCompositionRangeChanged
Was previously unimplemented, and user was unable to implement, so added protected virtual method
2017-12-21 08:58:20 +10:00
amaitland 7b48980611 Remove CefDirtyRect
Replace with Rect as the structs were identical
2017-12-21 08:56:02 +10:00
amaitland 921ea55fff Add IDisplayHandler.OnAutoResize, IBrowserHost.SetAccessibilityState, IBrowserHost.SetAutoResizeEnabled
Wrappers for new methods/callback added
2017-12-21 08:53:56 +10:00
amaitland 4f48dbd49a WPF Add event handled checks in mouse overrides
Allow user to override and then specify their own behaviour
Call base methods in overrides - reference source shows the protected methods are empty,
we're just doing this for correctness (compiler should optimise the calls away)
2017-12-20 12:26:50 +10:00
amaitland 93a329bc7a WinForms/WPF Fix incorrect type check when setting RequestContext 2017-12-20 12:26:50 +10:00
amaitland e4447147dd IBrowserHost - Fix typo in xml comments preventing sandcastle from generating doc correctly 2017-12-20 12:26:50 +10:00
amaitland d585348887 Add RequestContext getter property to IWebBrowser
WPF - Add checks so if RequestContext is set after browser created an exception is thrown
WinForms - Add checks so if RequestContext is set after browser created an exception is thrown
2017-12-20 12:26:49 +10:00
amaitland e4dbc51635 WPF - rename updateBrowserScreenLocation to UpdateBrowserScreenLocation (inconsistent naming)
Remove call to PresentationSource.FromVisual(this) as it's very expensive, walks up the tree, it's also unnecessary as we keep a reference to the visual HwndSource
2017-12-20 12:26:49 +10:00
amaitland 5b636898a3 IMethodInterceptor.Intercept - escape generic param example in xml doc 2017-12-20 10:55:06 +10:00
amaitland 6f3016d1a7 Remove additionallibsdirectory references to CefSharp.Core\bin - probably a leftover from years ago before the structure was cleaned up 2017-12-20 10:54:41 +10:00
amaitland 05f0fa025a VS2017 Build with PlatformToolset v141
VC++2017(v141) is compatible with VC++2015(v140), which enables us to use the v141 toolset to compile against the
v140 libcef_dll_wrapper.lib - not necessary to install the VC++2015 compiler as part of a clean VS2017 install

Follow up to #2179
2017-12-20 10:21:08 +10:00
amaitland 464dd14b6f Update Example RequestHandler to inherit from DefaultRequestHandler
A new default implementation was added in #2157
BrowserTabView - cleanup usings and remove unused code
2017-12-20 10:01:34 +10:00