WebDocumentView Protocol Reference

Conforms to
Framework
/System/Library/Frameworks/WebKit.framework
Availability
Available in OS X v10.2 with Safari 1.0 and later.
Available in OS X v10.2.7 and later.
Companion guide
Declared in
WebDocument.h

Overview

This protocol is adopted by the document view of a WebFrameView. You can extend WebKit to support additional MIME types by implementing your own document view and document representation classes to render data for specific MIME types. You register those classes using the WebFrame registerViewClass:representationClass:forMIMEType: method. Classes that adopt this protocol are expected to be subclasses of NSView.

Tasks

Setting the Data Source

Controlling the Layout

Attaching to a Window

Instance Methods

dataSourceUpdated:

Invoked when additional data has been received.

- (void)dataSourceUpdated:(WebDataSource *)dataSource
Parameters
dataSource

The source of the new data.

Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebDocument.h

layout

Invoked when the receiver should change its layout immediately.

- (void)layout
Discussion

This message is sent to the view as a hint to perform any calculations and update rendering information. For example, at a minimum, the receiver might set the frame rectangle. This method should not perform any drawing operations.

Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebDocument.h

setDataSource:

Invoked when the data source for this document has been changed.

- (void)setDataSource:(WebDataSource *)dataSource
Parameters
dataSource

The new data source for the document.

Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebDocument.h

setNeedsLayout:

Sets whether or not the receiver should change its layout.

- (void)setNeedsLayout:(BOOL)flag
Parameters
flag

Sets whether the receiver needs to update its layout in the next call to its drawRect: method.

Discussion

A view conforming to this protocol should store the most recent value of this flag in an internal variable. Then, in its drawRect method, if the most recent value of this flag was YES, it should invoke layout and reset the internal variable before updating the contents of the view.

Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebDocument.h

viewDidMoveToHostWindow

Invoked when a web view's host window is set.

- (void)viewDidMoveToHostWindow
Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebDocument.h

viewWillMoveToHostWindow:

Invoked when a web view’s host window is about to change.

- (void)viewWillMoveToHostWindow:(NSWindow *)hostWindow
Parameters
hostWindow

The new host window for the view.

Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebDocument.h