docs

Porting from 1.3 to 1.4

On this page

Summary of changes needed when updating code to v1.4

Critical Changes:

- Renderer::RefreshDisplay() must now be called from your render loop.

When managing rendering yourself via Renderer::Create(), you must now call Renderer::RefreshDisplay(0) before calling Renderer::Render().

C++
void MyApplication::Render() {
    // **NEW**:
    // Notify the renderer that the default display has physically refreshed
    // so that the engine has a chance to update animations.
    renderer.RefreshDisplay(0);
  
    // Render all Views to their respective surfaces / render-targets.
    renderer.Render();
  
    // Handle any updated surfaces / textures here.
}

Discussion

Previous to 1.4, calling Renderer::Render() would update animations (eg, CSS animations, JavaScript requestAnimationFrame(), scroll animations, etc.) each time it was called.

This didn't quite match the spec since animations are supposed to be updated in lock-step with the physical refresh rate of the display which may or may not have matched the rate at which Renderer::Render() was called.

To fix this, we've introduced a new API method, Renderer::RefreshDisplay(display_id), that should be called whenever the display refreshes.

Single Monitor Setup

If you're using a single display, simply call Renderer::RefreshDisplay(0) whenever the display updates (all Views have a default display_id of 0).

Multi-Monitor Setup

If you're using multiple displays and want to independently control their refresh rate, you should:

  1. Associate a View with a display by updating ViewConfig::display_id with a unique integer identifying the display.
  2. Call Renderer::RefreshDisplay(display_id) whenever the display physically refreshes.

- ViewListener::OnAddConsoleMessage() now has different parameters.

You will need to update your ViewListener::OnAddConsoleMessage() implementation to use the new ConsoleMessage class instead of individual parameters.

C++
virtual void OnAddConsoleMessage(ultralight::View* caller,
                                 const ultralight::ConsoleMessage& message) { }

Other Changes

- New ImageSource API

- New Listener APIs

- New String API Improvements

- New MessageSource enum values

The values for theMessageSource enum have changed.

- Defines Updated

You can use these defines to verify that you're working with the correct API version.