1/*
2 * Copyright (C) 2003, 2004, 2005, 2006 Apple Inc.  All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1.  Redistributions of source code must retain the above copyright
9 *     notice, this list of conditions and the following disclaimer.
10 * 2.  Redistributions in binary form must reproduce the above copyright
11 *     notice, this list of conditions and the following disclaimer in the
12 *     documentation and/or other materials provided with the distribution.
13 * 3.  Neither the name of Apple Inc. ("Apple") nor the names of
14 *     its contributors may be used to endorse or promote products derived
15 *     from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#import <Foundation/Foundation.h>
30#import <Foundation/NSURLRequest.h>
31#import <WebKitLegacy/WebKitAvailability.h>
32
33#if !TARGET_OS_IPHONE
34#import <AppKit/AppKit.h>
35#else
36#import <WebKitLegacy/WAKAppKitStubs.h>
37#import <WebKitLegacy/WAKView.h>
38#endif
39
40/*!
41    @enum WebMenuItemTag
42    @discussion Each menu item in the default menu items array passed in
43    contextMenuItemsForElement:defaultMenuItems: has its tag set to one of the WebMenuItemTags.
44    When iterating through the default menu items array, use the tag to differentiate between them.
45*/
46
47enum {
48    WebMenuItemTagOpenLinkInNewWindow=1,
49    WebMenuItemTagDownloadLinkToDisk,
50    WebMenuItemTagCopyLinkToClipboard,
51    WebMenuItemTagOpenImageInNewWindow,
52    WebMenuItemTagDownloadImageToDisk,
53    WebMenuItemTagCopyImageToClipboard,
54    WebMenuItemTagOpenFrameInNewWindow,
55    WebMenuItemTagCopy,
56    WebMenuItemTagGoBack,
57    WebMenuItemTagGoForward,
58    WebMenuItemTagStop,
59    WebMenuItemTagReload,
60    WebMenuItemTagCut,
61    WebMenuItemTagPaste,
62    WebMenuItemTagSpellingGuess,
63    WebMenuItemTagNoGuessesFound,
64    WebMenuItemTagIgnoreSpelling,
65    WebMenuItemTagLearnSpelling,
66    WebMenuItemTagOther,
67    WebMenuItemTagSearchInSpotlight,
68    WebMenuItemTagSearchWeb,
69    WebMenuItemTagLookUpInDictionary,
70    WebMenuItemTagOpenWithDefaultApplication,
71    WebMenuItemPDFActualSize,
72    WebMenuItemPDFZoomIn,
73    WebMenuItemPDFZoomOut,
74    WebMenuItemPDFAutoSize,
75    WebMenuItemPDFSinglePage,
76    WebMenuItemPDFFacingPages,
77    WebMenuItemPDFContinuous,
78    WebMenuItemPDFNextPage,
79    WebMenuItemPDFPreviousPage,
80};
81
82/*!
83    @enum WebDragDestinationAction
84    @abstract Actions that the destination of a drag can perform.
85    @constant WebDragDestinationActionNone No action
86    @constant WebDragDestinationActionDHTML Allows DHTML (such as JavaScript) to handle the drag
87    @constant WebDragDestinationActionEdit Allows editable documents to be edited from the drag
88    @constant WebDragDestinationActionLoad Allows a location change from the drag
89    @constant WebDragDestinationActionAny Allows any of the above to occur
90*/
91typedef NS_OPTIONS(NSUInteger, WebDragDestinationAction) {
92    WebDragDestinationActionNone    = 0,
93    WebDragDestinationActionDHTML   = 1,
94    WebDragDestinationActionEdit    = 2,
95    WebDragDestinationActionLoad    = 4,
96    WebDragDestinationActionAny     = UINT_MAX
97};
98
99/*!
100    @enum WebDragSourceAction
101    @abstract Actions that the source of a drag can perform.
102    @constant WebDragSourceActionNone No action
103    @constant WebDragSourceActionDHTML Allows DHTML (such as JavaScript) to start a drag
104    @constant WebDragSourceActionImage Allows an image drag to occur
105    @constant WebDragSourceActionLink Allows a link drag to occur
106    @constant WebDragSourceActionSelection Allows a selection drag to occur
107    @constant WebDragSourceActionAny Allows any of the above to occur
108*/
109typedef NS_OPTIONS(NSUInteger, WebDragSourceAction) {
110    WebDragSourceActionNone         = 0,
111    WebDragSourceActionDHTML        = 1,
112    WebDragSourceActionImage        = 2,
113    WebDragSourceActionLink         = 4,
114    WebDragSourceActionSelection    = 8,
115    WebDragSourceActionAny          = UINT_MAX
116};
117
118/*!
119    @protocol WebOpenPanelResultListener
120    @discussion This protocol is used to call back with the results of
121    the file open panel requested by runOpenPanelForFileButtonWithResultListener:
122*/
123@protocol WebOpenPanelResultListener <NSObject>
124
125/*!
126    @method chooseFilename:
127    @abstract Call this method to return a filename from the file open panel.
128    @param fileName
129*/
130- (void)chooseFilename:(NSString *)fileName;
131
132/*!
133    @method chooseFilenames:
134    @abstract Call this method to return an array of filenames from the file open panel.
135    @param fileNames
136*/
137- (void)chooseFilenames:(NSArray *)fileNames WEBKIT_AVAILABLE_MAC(10_6);
138
139/*!
140    @method cancel
141    @abstract Call this method to indicate that the file open panel was cancelled.
142*/
143- (void)cancel;
144
145#if TARGET_OS_IPHONE
146- (void)chooseFilename:(NSString *)filename displayString:(NSString *)displayString iconImage:(CGImageRef)imageRef;
147- (void)chooseFilenames:(NSArray *)filenames displayString:(NSString *)displayString iconImage:(CGImageRef)imageRef;
148#endif
149
150@end
151
152@class WebFrame;
153@class WebFrameView;
154@class WebView;
155
156/*!
157    @category WebUIDelegate
158    @discussion A class that implements WebUIDelegate provides
159    window-related methods that may be used by Javascript, plugins and
160    other aspects of web pages. These methods are used to open new
161    windows and control aspects of existing windows.
162*/
163@interface NSObject (WebUIDelegate)
164
165/*!
166    @method webView:createWebViewWithRequest:
167    @abstract Create a new window and begin to load the specified request.
168    @discussion The newly created window is hidden, and the window operations delegate on the
169    new WebViews will get a webViewShow: call.
170    @param sender The WebView sending the delegate method.
171    @param request The request to load.
172    @result The WebView for the new window.
173*/
174- (WebView *)webView:(WebView *)sender createWebViewWithRequest:(NSURLRequest *)request;
175
176/*!
177    @method webViewShow:
178    @param sender The WebView sending the delegate method.
179    @abstract Show the window that contains the top level view of the WebView,
180    ordering it frontmost.
181    @discussion This will only be called just after createWindowWithRequest:
182    is used to create a new window.
183*/
184- (void)webViewShow:(WebView *)sender;
185
186/*!
187    @method webView:createWebViewModalDialogWithRequest:
188    @abstract Create a new window and begin to load the specified request.
189    @discussion The newly created window is hidden, and the window operations delegate on the
190    new WebViews will get a webViewShow: call.
191    @param sender The WebView sending the delegate method.
192    @param request The request to load.
193    @result The WebView for the new window.
194*/
195- (WebView *)webView:(WebView *)sender createWebViewModalDialogWithRequest:(NSURLRequest *)request;
196
197/*!
198    @method webViewRunModal:
199    @param sender The WebView sending the delegate method.
200    @abstract Show the window that contains the top level view of the WebView,
201    ordering it frontmost. The window should be run modal in the application.
202    @discussion This will only be called just after createWebViewModalDialogWithRequest:
203    is used to create a new window.
204*/
205- (void)webViewRunModal:(WebView *)sender;
206
207/*!
208    @method webViewClose:
209    @abstract Close the current window.
210    @param sender The WebView sending the delegate method.
211    @discussion Clients showing multiple views in one window may
212    choose to close only the one corresponding to this
213    WebView. Other clients may choose to ignore this method
214    entirely.
215*/
216- (void)webViewClose:(WebView *)sender;
217
218/*!
219    @method webViewFocus:
220    @abstract Focus the current window (i.e. makeKeyAndOrderFront:).
221    @param The WebView sending the delegate method.
222    @discussion Clients showing multiple views in one window may want to
223    also do something to focus the one corresponding to this WebView.
224*/
225- (void)webViewFocus:(WebView *)sender;
226
227/*!
228    @method webViewUnfocus:
229    @abstract Unfocus the current window.
230    @param sender The WebView sending the delegate method.
231    @discussion Clients showing multiple views in one window may want to
232    also do something to unfocus the one corresponding to this WebView.
233*/
234- (void)webViewUnfocus:(WebView *)sender;
235
236/*!
237    @method webViewFirstResponder:
238    @abstract Get the first responder for this window.
239    @param sender The WebView sending the delegate method.
240    @discussion This method should return the focused control in the
241    WebView's view, if any. If the view is out of the window
242    hierarchy, this might return something than calling firstResponder
243    on the real NSWindow would. It's OK to return either nil or the
244    real first responder if some control not in the window has focus.
245*/
246- (NSResponder *)webViewFirstResponder:(WebView *)sender;
247
248/*!
249    @method webView:makeFirstResponder:
250    @abstract Set the first responder for this window.
251    @param sender The WebView sending the delegate method.
252    @param responder The responder to make first (will always be a view)
253    @discussion responder will always be a view that is in the view
254    subhierarchy of the top-level web view for this WebView. If the
255    WebView's top level view is currently out of the view
256    hierarchy, it may be desirable to save the first responder
257    elsewhere, or possibly ignore this call.
258*/
259- (void)webView:(WebView *)sender makeFirstResponder:(NSResponder *)responder;
260
261/*!
262    @method webView:setStatusText:
263    @abstract Set the window's status display, if any, to the specified string.
264    @param sender The WebView sending the delegate method.
265    @param text The status text to set
266*/
267- (void)webView:(WebView *)sender setStatusText:(NSString *)text;
268
269/*!
270    @method webViewStatusText:
271    @abstract Get the currently displayed status text.
272    @param sender The WebView sending the delegate method.
273    @result The status text
274*/
275- (NSString *)webViewStatusText:(WebView *)sender;
276
277/*!
278    @method webViewAreToolbarsVisible:
279    @abstract Determine whether the window's toolbars are currently visible
280    @param sender The WebView sending the delegate method.
281    @discussion This method should return YES if the window has any
282    toolbars that are currently on, besides the status bar. If the app
283    has more than one toolbar per window, for example a regular
284    command toolbar and a favorites bar, it should return YES from
285    this method if at least one is on.
286    @result YES if at least one toolbar is visible, otherwise NO.
287*/
288- (BOOL)webViewAreToolbarsVisible:(WebView *)sender;
289
290/*!
291    @method webView:setToolbarsVisible:
292    @param sender The WebView sending the delegate method.
293    @abstract Set whether the window's toolbars are currently visible.
294    @param visible New value for toolbar visibility
295    @discussion Setting this to YES should turn on all toolbars
296    (except for a possible status bar). Setting it to NO should turn
297    off all toolbars (with the same exception).
298*/
299- (void)webView:(WebView *)sender setToolbarsVisible:(BOOL)visible;
300
301/*!
302    @method webViewIsStatusBarVisible:
303    @abstract Determine whether the status bar is visible.
304    @param sender The WebView sending the delegate method.
305    @result YES if the status bar is visible, otherwise NO.
306*/
307- (BOOL)webViewIsStatusBarVisible:(WebView *)sender;
308
309/*!
310    @method webView:setStatusBarVisible:
311    @abstract Set whether the status bar is currently visible.
312    @param visible The new visibility value
313    @discussion Setting this to YES should show the status bar,
314    setting it to NO should hide it.
315*/
316- (void)webView:(WebView *)sender setStatusBarVisible:(BOOL)visible;
317
318/*!
319    @method webViewIsResizable:
320    @abstract Determine whether the window is resizable or not.
321    @param sender The WebView sending the delegate method.
322    @result YES if resizable, NO if not.
323    @discussion If there are multiple views in the same window, they
324    have have their own separate resize controls and this may need to
325    be handled specially.
326*/
327- (BOOL)webViewIsResizable:(WebView *)sender;
328
329/*!
330    @method webView:setResizable:
331    @abstract Set the window to resizable or not
332    @param sender The WebView sending the delegate method.
333    @param resizable YES if the window should be made resizable, NO if not.
334    @discussion If there are multiple views in the same window, they
335    have have their own separate resize controls and this may need to
336    be handled specially.
337*/
338- (void)webView:(WebView *)sender setResizable:(BOOL)resizable;
339
340/*!
341    @method webView:setFrame:
342    @abstract Set the window's frame rect
343    @param sender The WebView sending the delegate method.
344    @param frame The new window frame size
345    @discussion Even though a caller could set the frame directly using the NSWindow,
346    this method is provided so implementors of this protocol can do special
347    things on programmatic move/resize, like avoiding autosaving of the size.
348*/
349- (void)webView:(WebView *)sender setFrame:(NSRect)frame;
350
351/*!
352    @method webViewFrame:
353    @param sender The WebView sending the delegate method.
354    @abstract REturn the window's frame rect
355    @discussion
356*/
357- (NSRect)webViewFrame:(WebView *)sender;
358
359/*!
360    @method webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:
361    @abstract Display a JavaScript alert panel.
362    @param sender The WebView sending the delegate method.
363    @param message The message to display.
364    @param frame The WebFrame whose JavaScript initiated this call.
365    @discussion Clients should visually indicate that this panel comes
366    from JavaScript initiated by the specified frame. The panel should have
367    a single OK button.
368*/
369- (void)webView:(WebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame;
370
371/*!
372    @method webView:runJavaScriptConfirmPanelWithMessage:initiatedByFrame:
373    @abstract Display a JavaScript confirm panel.
374    @param sender The WebView sending the delegate method.
375    @param message The message to display.
376    @param frame The WebFrame whose JavaScript initiated this call.
377    @result YES if the user hit OK, NO if the user chose Cancel.
378    @discussion Clients should visually indicate that this panel comes
379    from JavaScript initiated by the specified frame. The panel should have
380    two buttons, e.g. "OK" and "Cancel".
381*/
382- (BOOL)webView:(WebView *)sender runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame;
383
384/*!
385    @method webView:runJavaScriptTextInputPanelWithPrompt:defaultText:initiatedByFrame:
386    @abstract Display a JavaScript text input panel.
387    @param sender The WebView sending the delegate method.
388    @param message The message to display.
389    @param defaultText The initial text for the text entry area.
390    @param frame The WebFrame whose JavaScript initiated this call.
391    @result The typed text if the user hit OK, otherwise nil.
392    @discussion Clients should visually indicate that this panel comes
393    from JavaScript initiated by the specified frame. The panel should have
394    two buttons, e.g. "OK" and "Cancel", and an area to type text.
395*/
396- (NSString *)webView:(WebView *)sender runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(NSString *)defaultText initiatedByFrame:(WebFrame *)frame;
397
398/*!
399    @method webView:runBeforeUnloadConfirmPanelWithMessage:initiatedByFrame:
400    @abstract Display a confirm panel by an "before unload" event handler.
401    @param sender The WebView sending the delegate method.
402    @param message The message to display.
403    @param frame The WebFrame whose JavaScript initiated this call.
404    @result YES if the user hit OK, NO if the user chose Cancel.
405    @discussion Clients should include a message in addition to the one
406    supplied by the web page that indicates. The panel should have
407    two buttons, e.g. "OK" and "Cancel".
408*/
409- (BOOL)webView:(WebView *)sender runBeforeUnloadConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame;
410
411/*!
412    @method webView:runOpenPanelForFileButtonWithResultListener:
413    @abstract Display a file open panel for a file input control.
414    @param sender The WebView sending the delegate method.
415    @param resultListener The object to call back with the results.
416    @discussion This method is passed a callback object instead of giving a return
417    value so that it can be handled with a sheet.
418*/
419- (void)webView:(WebView *)sender runOpenPanelForFileButtonWithResultListener:(id<WebOpenPanelResultListener>)resultListener;
420
421/*!
422    @method webView:runOpenPanelForFileButtonWithResultListener:allowMultipleFiles
423    @abstract Display a file open panel for a file input control that may allow multiple files to be selected.
424    @param sender The WebView sending the delegate method.
425    @param resultListener The object to call back with the results.
426    @param allowMultipleFiles YES if the open panel should allow myltiple files to be selected, NO if not.
427    @discussion This method is passed a callback object instead of giving a return
428    value so that it can be handled with a sheet.
429*/
430- (void)webView:(WebView *)sender runOpenPanelForFileButtonWithResultListener:(id<WebOpenPanelResultListener>)resultListener allowMultipleFiles:(BOOL)allowMultipleFiles WEBKIT_AVAILABLE_MAC(10_6);
431
432/*!
433    @method webView:mouseDidMoveOverElement:modifierFlags:
434    @abstract Update the window's feedback for mousing over links to reflect a new item the mouse is over
435    or new modifier flags.
436    @param sender The WebView sending the delegate method.
437    @param elementInformation Dictionary that describes the element that the mouse is over, or nil.
438    @param modifierFlags The modifier flags as in NSEvent.
439*/
440- (void)webView:(WebView *)sender mouseDidMoveOverElement:(NSDictionary *)elementInformation modifierFlags:(NSUInteger)modifierFlags;
441
442/*!
443    @method webView:contextMenuItemsForElement:defaultMenuItems:
444    @abstract Returns the menu items to display in an element's contextual menu.
445    @param sender The WebView sending the delegate method.
446    @param element A dictionary representation of the clicked element.
447    @param defaultMenuItems An array of default NSMenuItems to include in all contextual menus.
448    @result An array of NSMenuItems to include in the contextual menu.
449*/
450- (NSArray *)webView:(WebView *)sender contextMenuItemsForElement:(NSDictionary *)element defaultMenuItems:(NSArray *)defaultMenuItems;
451
452#if !TARGET_OS_IPHONE
453/*!
454    @method webView:validateUserInterfaceItem:defaultValidation:
455    @abstract Controls UI validation
456    @param webView The WebView sending the delegate method
457    @param item The user interface item being validated
458    @pararm defaultValidation Whether or not the WebView thinks the item is valid
459    @discussion This method allows the UI delegate to control WebView's validation of user interface items.
460    See WebView.h to see the methods to that WebView can currently validate. See NSUserInterfaceValidations and
461    NSValidatedUserInterfaceItem for information about UI validation.
462*/
463- (BOOL)webView:(WebView *)webView validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item defaultValidation:(BOOL)defaultValidation;
464#endif
465
466/*!
467    @method webView:shouldPerformAction:fromSender:
468    @abstract Controls actions
469    @param webView The WebView sending the delegate method
470    @param action The action being sent
471    @param sender The sender of the action
472    @discussion This method allows the UI delegate to control WebView's behavior when an action is being sent.
473    For example, if the action is copy:, the delegate can return YES to allow WebView to perform its default
474    copy behavior or return NO and perform copy: in some other way. See WebView.h to see the actions that
475    WebView can perform.
476*/
477- (BOOL)webView:(WebView *)webView shouldPerformAction:(SEL)action fromSender:(id)sender;
478
479#if !TARGET_OS_IPHONE
480/*!
481    @method webView:dragDestinationActionMaskForDraggingInfo:
482    @abstract Controls behavior when dragging to a WebView
483    @param webView The WebView sending the delegate method
484    @param draggingInfo The dragging info of the drag
485    @discussion This method is called periodically as something is dragged over a WebView. The UI delegate can return a mask
486    indicating which drag destination actions can occur, WebDragDestinationActionAny to allow any kind of action or
487    WebDragDestinationActionNone to not accept the drag.
488*/
489- (NSUInteger)webView:(WebView *)webView dragDestinationActionMaskForDraggingInfo:(id <NSDraggingInfo>)draggingInfo;
490
491/*!
492    @method webView:willPerformDragDestinationAction:forDraggingInfo:
493    @abstract Informs that WebView will perform a drag destination action
494    @param webView The WebView sending the delegate method
495    @param action The drag destination action
496    @param draggingInfo The dragging info of the drag
497    @discussion This method is called after the last call to webView:dragDestinationActionMaskForDraggingInfo: after something is dropped on a WebView.
498    This method informs the UI delegate of the drag destination action that WebView will perform.
499*/
500- (void)webView:(WebView *)webView willPerformDragDestinationAction:(WebDragDestinationAction)action forDraggingInfo:(id <NSDraggingInfo>)draggingInfo;
501
502/*!
503    @method webView:dragSourceActionMaskForPoint:
504    @abstract Controls behavior when dragging from a WebView
505    @param webView The WebView sending the delegate method
506    @param point The point where the drag started in the coordinates of the WebView
507    @discussion This method is called after the user has begun a drag from a WebView. The UI delegate can return a mask indicating
508    which drag source actions can occur, WebDragSourceActionAny to allow any kind of action or WebDragSourceActionNone to not begin a drag.
509*/
510- (NSUInteger)webView:(WebView *)webView dragSourceActionMaskForPoint:(NSPoint)point;
511
512/*!
513    @method webView:willPerformDragSourceAction:fromPoint:withPasteboard:
514    @abstract Informs that a drag a has begun from a WebView
515    @param webView The WebView sending the delegate method
516    @param action The drag source action
517    @param point The point where the drag started in the coordinates of the WebView
518    @param pasteboard The drag pasteboard
519    @discussion This method is called after webView:dragSourceActionMaskForPoint: is called after the user has begun a drag from a WebView.
520    This method informs the UI delegate of the drag source action that will be performed and gives the delegate an opportunity to modify
521    the contents of the dragging pasteboard.
522*/
523- (void)webView:(WebView *)webView willPerformDragSourceAction:(WebDragSourceAction)action fromPoint:(NSPoint)point withPasteboard:(NSPasteboard *)pasteboard;
524#endif /* !TARGET_OS_IPHONE */
525
526/*!
527    @method webView:printFrameView:
528    @abstract Informs that a WebFrameView needs to be printed
529    @param webView The WebView sending the delegate method
530    @param frameView The WebFrameView needing to be printed
531    @discussion This method is called when a script or user requests the page to be printed.
532    In this method the delegate can prepare the WebFrameView to be printed. Some content that WebKit
533    displays can be printed directly by the WebFrameView, other content will need to be handled by
534    the delegate. To determine if the WebFrameView can handle printing the delegate should check
535    WebFrameView's documentViewShouldHandlePrint, if YES then the delegate can call printDocumentView
536    on the WebFrameView. Otherwise the delegate will need to request a NSPrintOperation from
537    the WebFrameView's printOperationWithPrintInfo to handle the printing.
538*/
539- (void)webView:(WebView *)sender printFrameView:(WebFrameView *)frameView;
540
541/*!
542    @method webViewHeaderHeight:
543    @param webView The WebView sending the delegate method
544    @abstract Reserve a height for the printed page header.
545    @result The height to reserve for the printed page header, return 0.0 to not reserve any space for a header.
546    @discussion The height returned will be used to calculate the rect passed to webView:drawHeaderInRect:.
547*/
548- (float)webViewHeaderHeight:(WebView *)sender;
549
550/*!
551    @method webViewFooterHeight:
552    @param webView The WebView sending the delegate method
553    @abstract Reserve a height for the printed page footer.
554    @result The height to reserve for the printed page footer, return 0.0 to not reserve any space for a footer.
555    @discussion The height returned will be used to calculate the rect passed to webView:drawFooterInRect:.
556*/
557- (float)webViewFooterHeight:(WebView *)sender;
558
559/*!
560    @method webView:drawHeaderInRect:
561    @param webView The WebView sending the delegate method
562    @param rect The NSRect reserved for the header of the page
563    @abstract The delegate should draw a header for the sender in the supplied rect.
564*/
565- (void)webView:(WebView *)sender drawHeaderInRect:(NSRect)rect;
566
567/*!
568    @method webView:drawFooterInRect:
569    @param webView The WebView sending the delegate method
570    @param rect The NSRect reserved for the footer of the page
571    @abstract The delegate should draw a footer for the sender in the supplied rect.
572*/
573- (void)webView:(WebView *)sender drawFooterInRect:(NSRect)rect;
574
575// The following delegate methods are deprecated in favor of the ones above that specify
576// the WebFrame whose JavaScript initiated this call.
577- (void)webView:(WebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message WEBKIT_DEPRECATED_MAC(10_3, 10_5);
578- (BOOL)webView:(WebView *)sender runJavaScriptConfirmPanelWithMessage:(NSString *)message WEBKIT_DEPRECATED_MAC(10_3, 10_5);
579- (NSString *)webView:(WebView *)sender runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(NSString *)defaultText WEBKIT_DEPRECATED_MAC(10_3, 10_5);
580
581// The following delegate methods are deprecated. Content rect calculations are now done automatically.
582- (void)webView:(WebView *)sender setContentRect:(NSRect)frame WEBKIT_DEPRECATED_MAC(10_3, 10_5);
583- (NSRect)webViewContentRect:(WebView *)sender WEBKIT_DEPRECATED_MAC(10_3, 10_5);
584
585@end
586