HTML Renderer 1.4.0.0

I'm very happy to release another update for the project, I believe I'm getting very close to remove the 'Beta' tag from it.
This update has many fixes for complex layout and tables to handle much more complex htmls, better support for style sheet loading (see below), context menu, embedded videos and finally fixing the support for preformatted text!
I have dropped support for 'Bridge' object (see below) which can be a breaking change if used, it quite easy to replace it's use with events as can be seen in the demo application. Hopefully this will be the last version that has breaking changes.
For next version (v1.5) I'm planning to rewrite the object model (CssBox monster) and core parsing engine to significantly improve performance, especially the memory allocations that can pretty bad now for large htmls. Of course I will continue to fix bugs and add support for features as requested by the community.
 

Style sheet load

Enhanced the style sheet loading mechanism 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 providing the style sheet code or changing to source to different location that can be either file path or web URI. Unlike image loading though the style sheet loading doesn't provide async support as it has different corner cases and I didn't feel it was worth the effort. This means that if the style sheet source is URI it will download it on the main thread 'freezing' the application until it completes. Of course the current code allows for it to be added in the future, if required, without breaking the code.
 

Bridge object removed

Because the 'StylesheetLoad' and 'ImageLoad' events allows to provide style sheet and images directly thru code, same as was originally possible only by the 'Bridge' object, I have removed 'Bridge' object altogether. Decided to go with the events API because it is more natural and much more powerful as you can pass argument object have async support.
 

.NET 2.0 targeting

TheRhinoDude made a good and passionate point that there is no reason for the Html Renderer not to target .NET 2.0, so I made a few adjustments to code to remove all 3.0 and 3.5 dependencies. Now it is targeting .NET 2.0 where I make sure you can retarget it to any framework, including client profiles.
 

Embedded video

That’s right! Video iframes show the video that is embedded in the html!
Obviously the Html Renderer doesn't support iframes so don't expect to see ActiveX in the control that will stream the video, but the video thumbnail image, caption string and play visualization is shown where clicking on it will open the video page on its site.
So how does it works:
The id of the video is extracted from the 'src' URL and using the server API gets the video data is extracted: thumbnail image url, caption string and link url. Then, on the video frame location, the thumbnail image is shown with the caption on top and a nice play button in the middle. When the user clicks on the video frame a link click events occures that opens the actual video page, instead of video source.
 

Context menu

No web browser replacement control is complete without a context menu. It has the "Copy" and "Select All" options for regular text but it also context sensitive on images, links and embedded videos. And as a bonus, because my project requires it, the context menu is localized to 12 languages (English, French, German, Italian, Spanish, Russian, Swedish, Hungarian, Czech, Danish, Dutch, Finnish) and may have more in the future.
 

Complete list of changes:

Features

  • Target .NET 2.0
  • Stylesheet load
    • Load stylesheet from web
    • StylesheetLoad event that allows overwrite the loaded style sheet
  • Iframes and embedded video
    • Show error border for iframes
    • Support YouTube and Vimeo embedded videos by download thumbnail, title and full video link.
  • Context-menu
    • Copy / select all on text
    • Copy link address / open link for links
    • Copy image URL / copy image / save image as for images
    • Open video / copy video url for embedded videos
    • IsContextMenuEnabled allows to disable the context menu
    • Multi-language (English, French, German, Italian, Spanish, Russian, Swedish, Hungarian, Czech, Danish, Dutch, Finnish)
  • IsSelectionEnabled allows to disable the html content selection
  • Add support for 'overflow' style (only hidden and visible values), default-visible
  • 'tr' and 'th' elements have overflow: hidden by default
  • Add support for rgba color (style="color: rgba(0,255,90,120)")
  • Add visibility style support
  • Add white smoke image border while loading the image
  • Basic handling absolute position style
  • Documentation (work in progress)
     

Performance

  • Release used memory when setting html to null
  • Border style parsing improvement
  • Border paint improvements
  • Html parsing – remove regex usage
  • Html parsing – reduce objects creation
  • About 5%-8% improvement for small-medium htmls and up to 30% for large htmls.
     

Fixes

  • Max width layout
    • Elements that exceed the max width will not effect other elements.
    • Images will respect max width when it's own width is not set.
    • Images will respect max-width style
    • Tables will respect max-width style
  • HtmlContainer.GetHtml always returns inline styles (ISSUE 8518, thx JohnCJ)
  • Whitespaces between words handling (use StringFormat.GenericTypographic)
  • Preformatted text style.
  • Globalization issues.
  • Ignore '!important' in CSS style.
  • Ignore invalid colors in CSS style.
  • Ignore invalid length values in CSS style.
  • Better "hr" element handling (height, background color, borders, IE computability)
  • Table border default style matching IE.
  • Table layout with invalid rowspan/colspan.
  • Table cellpadding/border handle on table with theader and tbody elements.
  • Table without cells breaking layout.
  • Table 'auto' layout exceeding max width of the containing block.
  • Table cells width calculating not including word spacing.
  • 'Fixed' table layout where table width is larger than total columns widths.
  • Html characters decode ( entities1 , entities2 )
  • Line wrap not respecting left margin\padding for wrapped inline element.
  • Whitespaces ignored if in separate element.
  • Image icon staying loading on failure when no image size is given.
  • Treat inline-block as regular block.
  • Copy plain text handle spaces between words correctly.
  • Block box inside inline box in table breaks table layout.
  • Html element parsing (no white space after element name created parsing errors)
  • Don't allow changing display style to table elements.
  • Style classes are case sensitive.
  • Not providing max width to HtmlContainer for html to fit any size.
  • AutoSize handling in HtmlLabel.
  • display: none element breaking layout.
  • '-' char can break word to new-line.
  • Element padding on line wrap.
  • Margin with percentage value.
  • Demo project improvements.

9 comments on “HTML Renderer 1.4.0.0

  1. Pavel says:

    Hi Arthur,
    thank you very much for this project. I find it very useful and I am more than happy you still work on the development.
    One thing, which I think is very important, is the support of image alignment. I find this to be an only drawback of this project. Do you plan to address this?

    Thank you again for your effort.
    Pavel

  2. Stephane says:

    This is great!
    I have an issue though: When you write something like this:
    HTML Renderer Project Release 1.4.12.0

    There is a big difference in the way it is displayed when compared to IE, eg it writes the small text vertically aligned at the top of the previous text. This is very different from what IE does, as it is aligned t the bottom of the previous text.

    Do you think it is complicated to adjust this? I’d be happy to help but I would need some guidance first.

  3. Stephane says:

    Well the html did not go through: Just remove the between HTML Renderer Project and Release to see the issue.

    • Arthur says:

      This blog is the wrong platform for discussions on HTML Renderer issues, please use https://htmlrenderer.codeplex.com/discussions in the future (won’t have a problem with disappearing html). thx.

      I’m aware of the baseline issue, HTML Renderer is far from complete, I am working now on v1.5 and I will address it there or in the following minor releases (1.5.xx).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s