Sorry for taking so long for this version I have been busy with work.
This version is focused around image and error handling (see below) with more fixes as usual.
The next version, 5-6 weeks, will have many html layout improvements so stay tuned.
Image handling
The image handling until v1.3 was very limited allowing only two ways to load images:
- Providing image object in code using the bridge instance.
- Loading image from file on disk by path.
This is an obvious limitation as even the simple loading from URI is missing but adding a simple image download was not enough, I wanted a comprehensive solution.
- I have added "ImageLoad" events that allows the user of the renderer to supply the image to render by all 3 options (image object, file path, uri). The event passes the current value of the "src" attribute and dictionary of all attributes on the "img" element allowing for dynamic image rendering.
- I have enhanced the renderer to support async image loading so if an image needs to be downloaded by URI or fetched from DB by renderer user code it won't effect render performance and hang the UI. The "ImageLoad" event supports it by providing callback so the subscriber can hold reference to it until the image is available and then call it with the required data, that can be either object, file path or URI to be handled by the renderer.
- Because I'm such performance fan I have added support for image source rectangle allowing to have single gallery image and supplying the rectangle of the single image to render from the big image.
Error handling
The renderers complex html, styles and images handling has many places that can fail either because of renderer bug or invalid html/css input. Throwing exception on each such bug resulting in not rendering the html is out of the question, ignoring all the error without any indication is not a good solution either as it will be very hard to find sporadic bugs.
My solution is to catch all error and raise an error event with all possible data. This way the renderer can at least partially render the html (in most cases it will be enough) and using the event the renderer user can log the error with all the data to identify the bug or invalid html.
Features list
- Added link html element attributes to LinkClicked event (issue – 2526).
- Added support for .NET color names (thx to Quadko, issue – 8454)
- Image handling
- Show error image with borders if failed to load image
- Load image from file async
- Download image from web async
- Caching of downloaded image
- Load image event that allows overwrite image from outside, with async support (issue – 8457)
- Dispose of images as soon as the HtmlContent is not in use
- Error handling
- Event raised when error occurred in Html Renderer
- Error event allows to continue render in spite error
- Error in loading image
- Error in mouse/keyboard handling
- Error in paint in single box level
- Error in layout in single box level
Added support
- Multiple classes in single attribute separated by whitespace
- Background-image (very basic support)
Fixes
- Image size when failed to get image
- More block inside inline element issues (thx to Quadko, issue – 8455, 8456)
[…] to support loading style sheet from file, web URI or code via load event. It is designed similar to image loading mechanism: the ‘StylesheetLoad’ event allows to overwrite the loading process either by […]
[…] to support loading style sheet from file, web URI or code via load event. It is designed similar to image loading mechanism: the 'StylesheetLoad' event allows to overwrite the loading process either by […]