CopperSpice API  1.9.1
WebKit Overview

CsWebKit is a web content rendering engine based on the open source WebKit project, featuring broad support for standard web technologies. CsWebKit is developed as a part of the WebKit community, which enables every new release of CsWebKit to include the latest developments from the WebKit project.

Introduction

CsWebKit provides a Web browser engine that makes it easy to embed content from the World Wide Web into your CopperSpice application. At the same time Web content can be enhanced with native controls. It also has facilities for rendering of HyperText Markup Language (HTML), Extensible HyperText Markup Language (XHTML) and Scalable Vector Graphics (SVG) documents, styled using Cascading Style Sheets (CSS) and scripted with JavaScript.

A bridge between the JavaScript execution environment and the CopperSpice object model makes it possible for custom QObjects to be scripted. For detailed documentation refer to CsWebKit Bridge. Integration with the networking library enables Web pages to be transparently loaded from Web servers, the local file system, or the CopperSpice resource system. In addition to providing pure rendering features, HTML documents can be made fully editable to the user through the use of the contenteditable attribute on HTML elements.

CsWebKit is based on the Open Source WebKit engine. More information about WebKit itself can be found on the "WebKit Open Source Project" web site.

Architecture

The easiest way to render content is through the QWebView class. As a widget it can be embedded into your forms or a graphics view, and it provides convenience functions for downloading and rendering web sites.

QWebView *view = new QWebView(parent);
view->load(QUrl("https://www.copperspice.com"));
view->show();

QWebView is used to view Web pages. An instance of QWebView has one QWebPage. QWebPage provides access to the document structure in a page, describing features such as frames, the navigation history, and the undo/redo stack for editable content.

HTML documents can be nested using frames in a frameset. An individual frame in HTML is represented using the QWebFrame class. This class includes the bridge to the JavaScript window object and can be painted using QPainter. Each QWebPage has one QWebFrame object as its main frame, and the main frame may contain many child frames. Individual elements of an HTML document can be accessed via DOM JavaScript interfaces from within a web page. The equivalent of this API in CsWebKit is represented by QWebElement. QWebElement objects are obtained using QWebFrame's findAllElements() and findFirstElement() functions with CSS selector queries.

Common web browser features, defaults and other settings can be configured through the QWebSettings class. It is possible to provide defaults for all QWebPage instances through the default settings. Individual attributes can be overridden by the page specific settings object.

Notes

Building the CsWebKit library with debugging symbols can be problematic on some platforms due to the size of the WebKit engine. It is recommended to build this library only in release mode and only on 64-bit computers. Our release binary of the CsWebKit library for Windows 32-bit systems was successfully built on a 64-bit computer.

Web site icons, also known as "FavIcons", are currently not supported on Windows.

WebKit 2.2.3 for Web Developer

The highlights of the WebKit 2.2.3 release for web developers are listed below. Some of the HTML5 and CSS3 features are based on draft specifications which are subject to change.

  • HTML5 media
  • HTML5 file API
  • HTML5 progress and meter elements
  • HTML5 viewport meta tag
  • HTML5 canvas element
  • Web SQL Database
  • Web Storage
  • CSS Animations
  • CSS Transitions
  • CSS 2D Transforms
  • CSS Text
  • CSS Masks
  • CSS Scrollbar Styles
  • Native JSON parser