Mac Developer Library

Developer

WebKit Framework Reference WebDocumentView Protocol Reference

Options
Deployment Target:

On This Page
Language:

WebDocumentView

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.

  • Sets whether or not the receiver should change its layout.

    Declaration

    Swift

    func setNeedsLayout(_ flag: Bool)

    Objective-C

    - (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 YEStrue, 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.

  • Invoked when the receiver should change its layout immediately.

    Declaration

    Swift

    func layout()

    Objective-C

    - (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.