330 likes | 719 Views
Introduction to WebKit. Girish Ramakrishnan. History. 1999. 2001-3. 2005. What is WebKit. WebKit is a rendering engine for web content WebKit is not a browser, a science project, or the solution to every problem. HTML. Rendering of a web page. WebKit. JavaScript. CSS.
E N D
Introduction to WebKit Girish Ramakrishnan
History 1999 2001-3 2005
What is WebKit WebKit is a rendering engine for web content WebKit is not a browser, a science project, or the solution to every problem HTML Rendering of a web page WebKit JavaScript CSS Image stolen from Adam Barth’s Presentation
WebKit ports WebKit is designed to be highly portable
Components WebKit and WebKit2 (Embedding API) Bindings (JavaScript API, Objective-C API) JavaScriptCore (JavaScript Virtual Machine) WebCore (HTML, CSS, DOM, etc, etc) Platform (Network, Storage, Graphics) WTF (Data structures, Threading primitives) Image stolen from Adam Barth’s Presentation
WTF!? • The STL of WebKit project • Data structures • String • URL parser • Compiled as static lib • Minimal porting required (ifdef’s) • Source/WTF
JavaScriptCore (AKA SFX and Nitro) • Primarily developed by Apple • Byte Level Interpreter (Llint) • Optional DFG JIT • Non-trivial to use a stand alone • Compiled as static lib • Source/JavaScriptCore
WebCore • HTML, CSS, XML, SVG ….
WebCore • Asks WebKit layer to load resource • Resource loading and frame loading are totally separate Network Loader Image stolen from Adam Barth’s Presentation
WebCore • Fires off pre-load requests on the fly • XSS Auditor Network Loader HTML Parser
WebCore • Parser generates DOM tree Network Loader HTML Parser CSS DOM Script
WebCore • Create RenderObjects using “Attachment” Network Loader HTML Parser CSS DOM Script Render Tree
WebCore • CSS Style Computation Network Loader HTML Parser CSS DOM Script RenderStyles Render Tree Image stolen from Adam Barth’s Presentation
WebCore • CSS Style Computation Network Loader HTML Parser CSS DOM Script RenderStyles Render Tree Image stolen from Adam Barth’s Presentation
WebCore Network Loader HTML Parser CSS DOM Script RenderStyles Render Tree Layout (RenderLayer, LineBoxes)
WebCore graphics • Accelerated Compositing Image stolen from AriyaHidayat’sblogpost
WebCore Graphics • Tiled rendering Image stolen from AriyaHidayat’sblogpost
WebCore Directory structure is insightful • bindings (and idl files) • bridge • css • Dom • editing • history • html • icu • Inspector • loader • Platforms (graphics, network) • plugins • rendering • storage • svg • xml
WebCore Porting • Platforms/ implements port abstraction • Networking & Graphics • Time, DnD, Themes, Clipboard, UA • Many features like plugins require port specific enhancements • Sprinkle ifdefs as necessary • Add dir/<port>/<file><port>.cpp • E.g history/qt/HistoryItemQt.cpp
WebCore Porting (2) • Client interfaces • Abstract interfaces implemented by the port • Used in place of ifdef’s when it’s useful for many ports class GeolocationClient { virtual boolrequestAccess() = 0; } void Page::setClient(GeolocationClient *c) { client = c; } bool Page::requestLocationAccess() { return client->requestAccess(); } // Qt class GeolocationClientQt : public GeolocationClient { … } … page->setClient(new GeolocationClientQt);
WebCore • Modules (battery, gelocation, indexeddb..) • Layout tests • Unit tests
WebKit • Platform specific code • APIs • WebCoreSupport
WebKit2 • New async API that uses split process model • Developed by Apple
WebKit2 Image taken from WebKit Wiki
WebKit2 vs Chrome Image taken from WebKit Wiki
Trying out WebKit • WebKit has no releases • Each port is compiled differently git.webkit.org
Thank you • Questions?