b16e17ce372e6f16de4d4a3c70c1b95b63ab8e7b
[WebKit-https.git] / WebCore / bridge / mac / WebCoreFrameBridge.h
1 /*
2  * Copyright (C) 2004 Apple Computer, 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  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
24  */
25
26 #import <Cocoa/Cocoa.h>
27
28 #import <JavaScriptCore/npruntime.h>
29 #import <JavaVM/jni.h>
30 #import <WebCore/WebCoreKeyboardAccess.h>
31
32 #ifdef __cplusplus
33
34 class RenderArena;
35
36 namespace WebCore {
37     class MacFrame;
38     class RenderPart;
39 }
40
41 typedef WebCore::MacFrame WebCoreMacFrame;
42 typedef WebCore::RenderPart WebCoreRenderPart;
43
44 #else
45
46 @class WebCoreMacFrame;
47 @class WebCoreRenderPart;
48 @class RenderArena;
49
50 #endif
51
52 @class DOMCSSStyleDeclaration;
53 @class DOMDocument;
54 @class DOMDocumentFragment;
55 @class DOMElement;
56 @class DOMHTMLElement;
57 @class DOMHTMLInputElement;
58 @class DOMHTMLTextAreaElement;
59 @class DOMNode;
60 @class DOMRange;
61 @class WebCorePageBridge;
62 @class WebCoreSettings;
63 @class WebScriptObject;
64 @class WebView;
65
66 @protocol WebCoreRenderTreeCopier;
67 @protocol WebCoreResourceHandle;
68 @protocol WebCoreResourceLoader;
69 @protocol WebCoreFileButton;
70 @protocol WebCoreFileButtonDelegate;
71
72 extern NSString *WebCoreElementDOMNodeKey;
73 extern NSString *WebCoreElementFrameKey;
74 extern NSString *WebCoreElementImageAltStringKey;
75 extern NSString *WebCoreElementImageRectKey;
76 extern NSString *WebCoreElementImageURLKey;
77 extern NSString *WebCoreElementIsSelectedKey;
78 extern NSString *WebCoreElementLinkURLKey;
79 extern NSString *WebCoreElementLinkTargetFrameKey;
80 extern NSString *WebCoreElementLinkLabelKey;
81 extern NSString *WebCoreElementLinkTitleKey;
82 extern NSString *WebCoreElementTitleKey;
83
84 extern NSString *WebCorePageCacheStateKey;
85
86 typedef enum {
87     WebCoreDeviceScreen,
88     WebCoreDevicePrinter
89 } WebCoreDeviceType;
90
91 typedef enum {
92     WebSelectionStateNone,
93     WebSelectionStateCaret,
94     WebSelectionStateRange,
95 } WebSelectionState;
96
97 typedef enum {
98     WebSelectByMoving,
99     WebSelectByExtending
100 } WebSelectionAlteration;
101
102 typedef enum {
103     WebBridgeSelectForward,
104     WebBridgeSelectBackward,
105     WebBridgeSelectRight,
106     WebBridgeSelectLeft
107 } WebBridgeSelectionDirection;
108
109 typedef enum {
110     WebBridgeSelectByCharacter,
111     WebBridgeSelectByWord,
112     WebBridgeSelectByLine,
113     WebBridgeSelectByParagraph,
114     WebBridgeSelectToLineBoundary,
115     WebBridgeSelectToParagraphBoundary,
116     WebBridgeSelectToDocumentBoundary
117 } WebBridgeSelectionGranularity;
118
119 typedef enum {
120     WebScrollUp,
121     WebScrollDown,
122     WebScrollLeft,
123     WebScrollRight
124 } WebScrollDirection;
125
126 typedef enum {
127     WebScrollLine,
128     WebScrollPage,
129     WebScrollDocument,
130     WebScrollWheel
131 } WebScrollGranularity;
132
133 typedef enum {
134     WebUndoActionUnspecified,
135     WebUndoActionSetColor,
136     WebUndoActionSetBackgroundColor,
137     WebUndoActionTurnOffKerning,
138     WebUndoActionTightenKerning,
139     WebUndoActionLoosenKerning,
140     WebUndoActionUseStandardKerning,
141     WebUndoActionTurnOffLigatures,
142     WebUndoActionUseStandardLigatures,
143     WebUndoActionUseAllLigatures,
144     WebUndoActionRaiseBaseline,
145     WebUndoActionLowerBaseline,
146     WebUndoActionSetTraditionalCharacterShape,
147     WebUndoActionSetFont,
148     WebUndoActionChangeAttributes,
149     WebUndoActionAlignLeft,
150     WebUndoActionAlignRight,
151     WebUndoActionCenter,
152     WebUndoActionJustify,
153     WebUndoActionSetWritingDirection,
154     WebUndoActionSubscript,
155     WebUndoActionSuperscript,
156     WebUndoActionUnderline,
157     WebUndoActionOutline,
158     WebUndoActionUnscript,
159     WebUndoActionDrag,
160     WebUndoActionCut,
161     WebUndoActionPaste,
162     WebUndoActionPasteFont,
163     WebUndoActionPasteRuler,
164     WebUndoActionTyping,
165 } WebUndoAction;
166
167 typedef enum
168 {
169     ObjectElementNone,
170     ObjectElementImage,
171     ObjectElementFrame,
172     ObjectElementPlugin,
173 } ObjectElementType;
174
175 // WebCoreFrameBridge objects are used by WebCore to abstract away operations that need
176 // to be implemented by library clients, for example WebKit. The objects are also
177 // used in the opposite direction, for simple access to WebCore functions without dealing
178 // directly with the KHTML C++ classes.
179
180 // A WebCoreFrameBridge creates and holds a reference to a Frame.
181
182 // The WebCoreFrameBridge interface contains methods for use by the non-WebCore side of the bridge.
183
184 @interface WebCoreFrameBridge : NSObject
185 {
186     WebCoreMacFrame *m_frame;
187     BOOL _shouldCreateRenderers;
188
189     NSString *_frameNamespace;
190 }
191
192 + (WebCoreFrameBridge *)bridgeForDOMDocument:(DOMDocument *)document;
193
194 - (id)initMainFrameWithPage:(WebCorePageBridge *)page;
195 - (id)initSubframeWithRenderer:(WebCoreRenderPart *)renderer;
196
197 + (NSArray *)supportedMIMETypes;
198
199 - (void)initializeSettings:(WebCoreSettings *)settings;
200
201 - (void)setName:(NSString *)name;
202 - (NSString *)name;
203 /* Creates a name for an frame unnamed in the HTML.  It should produce repeatable results for loads of the same frameset. */
204 - (NSString *)generateFrameName;
205
206 - (WebCorePageBridge *)page;
207
208 - (WebCoreFrameBridge *)parent;
209
210 - (WebCoreFrameBridge *)firstChild;
211 - (WebCoreFrameBridge *)lastChild;
212 - (WebCoreFrameBridge *)previousSibling;
213 - (WebCoreFrameBridge *)nextSibling;
214
215 - (void)appendChild:(WebCoreFrameBridge *)child;
216 - (void)removeChild:(WebCoreFrameBridge *)child;
217
218 - (unsigned)childCount;
219 - (BOOL)isDescendantOfFrame:(WebCoreFrameBridge *)ancestor;
220 - (WebCoreFrameBridge *)traverseNextFrameStayWithin:(WebCoreFrameBridge *)stayWithin;
221
222 - (WebCoreFrameBridge *)nextFrameWithWrap:(BOOL)wrap;
223 - (WebCoreFrameBridge *)previousFrameWithWrap:(BOOL)wrap;
224
225 - (WebCoreFrameBridge *)childFrameNamed:(NSString *)name;
226 - (WebCoreFrameBridge *)findFrameNamed:(NSString *)name;
227 - (void)setFrameNamespace:(NSString *)ns;
228 - (NSString *)frameNamespace;
229
230 - (void)provisionalLoadStarted;
231
232 - (void)openURL:(NSURL *)URL reload:(BOOL)reload
233     contentType:(NSString *)contentType refresh:(NSString *)refresh lastModified:(NSDate *)lastModified
234     pageCache:(NSDictionary *)pageCache;
235 - (void)setEncoding:(NSString *)encoding userChosen:(BOOL)userChosen;
236 - (void)addData:(NSData *)data;
237 - (void)closeURL;
238 - (void)stopLoading;
239
240 - (void)didNotOpenURL:(NSURL *)URL pageCache:(NSDictionary *)pageCache;
241
242 - (BOOL)canLoadURL:(NSURL *)URL fromReferrer:(NSString *)referrer hideReferrer:(BOOL *)hideReferrer;
243
244 - (void)saveDocumentState;
245 - (void)restoreDocumentState;
246
247 - (BOOL)canCachePage;
248 - (BOOL)saveDocumentToPageCache;
249
250 - (void)end;
251 - (void)stop;
252
253 - (void)clearFrame;
254 - (void)handleFallbackContent;
255
256 - (NSURL *)URL;
257 - (NSURL *)baseURL;
258 - (NSString *)referrer;
259 - (NSString *)domain;
260 - (WebCoreFrameBridge *)opener;
261 - (void)setOpener:(WebCoreFrameBridge *)bridge;
262
263 - (void)installInFrame:(NSView *)view;
264 - (void)removeFromFrame;
265
266 - (void)scrollToAnchor:(NSString *)anchor;
267 - (void)scrollToAnchorWithURL:(NSURL *)URL;
268
269 - (BOOL)scrollOverflowInDirection:(WebScrollDirection)direction granularity:(WebScrollGranularity)granularity;
270
271 - (void)createFrameViewWithNSView:(NSView *)view marginWidth:(int)mw marginHeight:(int)mh;
272
273 - (BOOL)isFrameSet;
274
275 - (void)reapplyStylesForDeviceType:(WebCoreDeviceType)deviceType;
276 - (void)forceLayoutAdjustingViewSize:(BOOL)adjustSizeFlag;
277 - (void)forceLayoutWithMinimumPageWidth:(float)minPageWidth maximumPageWidth:(float)maxPageWidth adjustingViewSize:(BOOL)adjustSizeFlag;
278 - (void)sendResizeEvent;
279 - (void)sendScrollEvent;
280 - (BOOL)needsLayout;
281 - (void)setNeedsLayout;
282 - (void)drawRect:(NSRect)rect;
283 - (void)adjustPageHeightNew:(float *)newBottom top:(float)oldTop bottom:(float)oldBottom limit:(float)bottomLimit;
284 - (NSArray*)computePageRectsWithPrintWidthScaleFactor:(float)printWidthScaleFactor printHeight:(float)printHeight;
285
286 - (void)setActivationEventNumber:(int)num;
287 - (void)mouseDown:(NSEvent *)event;
288 - (void)mouseUp:(NSEvent *)event;
289 - (void)mouseMoved:(NSEvent *)event;
290 - (void)mouseDragged:(NSEvent *)event;
291
292 // these return YES if event is eaten by WebCore
293 - (BOOL)sendScrollWheelEvent:(NSEvent *)event;
294 - (BOOL)sendContextMenuEvent:(NSEvent *)event;
295
296 - (NSView *)nextKeyView;
297 - (NSView *)previousKeyView;
298
299 - (NSView *)nextKeyViewInsideWebFrameViews;
300 - (NSView *)previousKeyViewInsideWebFrameViews;
301
302 - (NSObject *)copyRenderTree:(id <WebCoreRenderTreeCopier>)copier;
303 - (NSString *)renderTreeAsExternalRepresentation;
304
305 - (NSDictionary *)elementAtPoint:(NSPoint)point;
306 - (NSURL *)URLWithAttributeString:(NSString *)string;
307
308 - (DOMElement *)elementWithName:(NSString *)name inForm:(DOMElement *)form;
309 - (DOMElement *)elementForView:(NSView *)view;
310 - (BOOL)elementDoesAutoComplete:(DOMElement *)element;
311 - (BOOL)elementIsPassword:(DOMElement *)element;
312 - (DOMElement *)formForElement:(DOMElement *)element;
313 - (DOMElement *)currentForm;
314 - (NSArray *)controlsInForm:(DOMElement *)form;
315 - (NSString *)searchForLabels:(NSArray *)labels beforeElement:(DOMElement *)element;
316 - (NSString *)matchLabels:(NSArray *)labels againstElement:(DOMElement *)element;
317
318 - (BOOL)searchFor:(NSString *)string direction:(BOOL)forward caseSensitive:(BOOL)caseFlag wrap:(BOOL)wrapFlag;
319 - (unsigned)highlightAllMatchesForString:(NSString *)string caseSensitive:(BOOL)caseFlag;
320 - (void)clearHighlightedMatches;
321
322 - (NSString *)advanceToNextMisspelling;
323 - (NSString *)advanceToNextMisspellingStartingJustBeforeSelection;
324 - (void)unmarkAllMisspellings;
325
326 - (void)setTextSizeMultiplier:(float)multiplier;
327
328 - (CFStringEncoding)textEncoding;
329
330 - (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)string;
331 - (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)string forceUserGesture:(BOOL)forceUserGesture;
332 - (NSAppleEventDescriptor *)aeDescByEvaluatingJavaScriptFromString:(NSString *)string;
333
334 - (DOMDocument *)DOMDocument;
335 - (DOMHTMLElement *)frameElement;
336
337 - (BOOL)isSelectionEditable;
338 - (WebSelectionState)selectionState;
339
340 - (NSAttributedString *)selectedAttributedString;
341 - (NSString *)selectedString;
342
343 - (void)setSelectionFromNone;
344 - (void)setDisplaysWithFocusAttributes:(BOOL)flag;
345
346 - (void)setWindowHasFocus:(BOOL)flag;
347
348 - (NSString *)stringForRange:(DOMRange *)range;
349
350 - (NSString *)markupStringFromNode:(DOMNode *)node nodes:(NSArray **)nodes;
351 - (NSString *)markupStringFromRange:(DOMRange *)range nodes:(NSArray **)nodes;
352
353 - (void)selectAll;
354 - (void)deselectAll;
355 - (void)deselectText;
356
357 - (NSRect)selectionRect;
358 - (NSRect)visibleSelectionRect;
359 - (void)centerSelectionInVisibleArea;
360 - (NSImage *)selectionImage;
361 - (NSRect)caretRectAtNode:(DOMNode *)node offset:(int)offset affinity:(NSSelectionAffinity)affinity;
362 - (NSRect)firstRectForDOMRange:(DOMRange *)range;
363
364 - (void)setSelectedDOMRange:(DOMRange *)range affinity:(NSSelectionAffinity)selectionAffinity closeTyping:(BOOL)closeTyping;
365 - (DOMRange *)selectedDOMRange;
366 - (NSSelectionAffinity)selectionAffinity;
367
368 // Emacs-style-editing "mark"
369 - (void)setMarkDOMRange:(DOMRange *)range;
370 - (DOMRange *)markDOMRange;
371
372 // international text input "marked text"
373 - (void)setMarkedTextDOMRange:(DOMRange *)range customAttributes:(NSArray *)attributes ranges:(NSArray *)ranges;
374 - (DOMRange *)markedTextDOMRange;
375 - (void)replaceMarkedTextWithText:(NSString *)text;
376
377 - (NSAttributedString *)attributedStringFrom:(DOMNode *)startNode startOffset:(int)startOffset to:(DOMNode *)endNode endOffset:(int)endOffset;
378
379 - (NSFont *)fontForSelection:(BOOL *)hasMultipleFonts;
380 - (NSDictionary *)fontAttributesForSelectionStart;
381 - (NSWritingDirection)baseWritingDirectionForSelectionStart;
382
383 + (NSString *)stringWithData:(NSData *)data textEncoding:(CFStringEncoding)textEncoding;
384 + (NSString *)stringWithData:(NSData *)data textEncodingName:(NSString *)textEncodingName;
385
386 - (BOOL)interceptKeyEvent:(NSEvent *)event toView:(NSView *)view;
387
388 - (void)setShouldCreateRenderers:(BOOL)f;
389 - (BOOL)shouldCreateRenderers;
390
391 - (int)numPendingOrLoadingRequests;
392 - (BOOL)doneProcessingData;
393 - (BOOL)shouldClose;
394
395 - (void)setDrawsBackground:(BOOL)drawsBackround;
396
397 - (NSColor *)bodyBackgroundColor;
398 - (NSColor *)selectionColor;
399
400 - (void)adjustViewSize;
401
402 - (id)accessibilityTree;
403
404 - (void)undoEditing:(id)arg;
405 - (void)redoEditing:(id)arg;
406
407 - (DOMRange *)rangeByExpandingSelectionWithGranularity:(WebBridgeSelectionGranularity)granularity;
408 - (DOMRange *)rangeOfCharactersAroundCaret;
409 - (DOMRange *)rangeByAlteringCurrentSelection:(WebSelectionAlteration)alteration direction:(WebBridgeSelectionDirection)direction granularity:(WebBridgeSelectionGranularity)granularity;
410 - (void)alterCurrentSelection:(WebSelectionAlteration)alteration direction:(WebBridgeSelectionDirection)direction granularity:(WebBridgeSelectionGranularity)granularity;
411 - (DOMRange *)rangeByAlteringCurrentSelection:(WebSelectionAlteration)alteration verticalDistance:(float)distance;
412 - (void)alterCurrentSelection:(WebSelectionAlteration)alteration verticalDistance:(float)distance;
413 - (WebBridgeSelectionGranularity)selectionGranularity;
414 - (DOMRange *)smartDeleteRangeForProposedRange:(DOMRange *)proposedCharRange;
415 - (void)smartInsertForString:(NSString *)pasteString replacingRange:(DOMRange *)charRangeToReplace beforeString:(NSString **)beforeString afterString:(NSString **)afterString;
416 - (BOOL)canDeleteRange:(DOMRange *)range;
417 - (void)selectNSRange:(NSRange)range;
418 - (NSRange)selectedNSRange;
419 - (NSRange)markedTextNSRange;
420 - (DOMRange *)convertNSRangeToDOMRange:(NSRange)range;
421 - (NSRange)convertDOMRangeToNSRange:(DOMRange *)range;
422
423 - (DOMDocumentFragment *)documentFragmentWithMarkupString:(NSString *)markupString baseURLString:(NSString *)baseURLString;
424 - (DOMDocumentFragment *)documentFragmentWithText:(NSString *)text;
425 - (DOMDocumentFragment *)documentFragmentWithNodesAsParagraphs:(NSArray *)nodes;
426
427 - (void)replaceSelectionWithFragment:(DOMDocumentFragment *)fragment selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace matchStyle:(BOOL)matchStyle;
428 - (void)replaceSelectionWithNode:(DOMNode *)node selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace;
429 - (void)replaceSelectionWithMarkupString:(NSString *)markupString baseURLString:(NSString *)baseURLString selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace;
430 - (void)replaceSelectionWithText:(NSString *)text selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace;
431
432 - (void)insertLineBreak;
433 - (void)insertParagraphSeparator;
434 - (void)insertParagraphSeparatorInQuotedContent;
435 - (void)insertText:(NSString *)text selectInsertedText:(BOOL)selectInsertedText;
436
437 - (void)setSelectionToDragCaret;
438 - (void)moveSelectionToDragCaret:(DOMDocumentFragment *)selectionFragment smartMove:(BOOL)smartMove;
439 - (void)moveDragCaretToPoint:(NSPoint)point;
440 - (void)removeDragCaret;
441 - (DOMRange *)dragCaretDOMRange;
442 - (DOMRange *)editableDOMRangeForPoint:(NSPoint)point;
443 - (DOMRange *)characterRangeAtPoint:(NSPoint)point;
444
445 - (void)deleteSelectionWithSmartDelete:(BOOL)smartDelete;
446 - (void)deleteKeyPressedWithSmartDelete:(BOOL)smartDelete;
447 - (void)forwardDeleteKeyPressedWithSmartDelete:(BOOL)smartDelete;
448
449 - (DOMCSSStyleDeclaration *)typingStyle;
450 - (void)setTypingStyle:(DOMCSSStyleDeclaration *)style withUndoAction:(WebUndoAction)undoAction;
451 - (void)applyStyle:(DOMCSSStyleDeclaration *)style withUndoAction:(WebUndoAction)undoAction;
452 - (void)applyParagraphStyle:(DOMCSSStyleDeclaration *)style withUndoAction:(WebUndoAction)undoAction;
453 - (BOOL)selectionStartHasStyle:(DOMCSSStyleDeclaration *)style;
454 - (NSCellStateValue)selectionHasStyle:(DOMCSSStyleDeclaration *)style;
455 - (void)applyEditingStyleToBodyElement;
456 - (void)removeEditingStyleFromBodyElement;
457 - (void)applyEditingStyleToElement:(DOMElement *)element;
458 - (void)removeEditingStyleFromElement:(DOMElement *)element;
459
460 - (void)ensureSelectionVisible;
461
462 - (WebScriptObject *)windowScriptObject;
463 - (NPObject *)windowScriptNPObject;
464
465 - (BOOL)eventMayStartDrag:(NSEvent *)event;
466 - (NSDragOperation)dragOperationForDraggingInfo:(id <NSDraggingInfo>)info;
467 - (void)dragExitedWithDraggingInfo:(id <NSDraggingInfo>)info;
468 - (BOOL)concludeDragForDraggingInfo:(id <NSDraggingInfo>)info;
469 - (void)dragSourceMovedTo:(NSPoint)windowLoc;
470 - (void)dragSourceEndedAt:(NSPoint)windowLoc operation:(NSDragOperation)operation;
471
472 - (BOOL)mayDHTMLCut;
473 - (BOOL)mayDHTMLCopy;
474 - (BOOL)mayDHTMLPaste;
475 - (BOOL)tryDHTMLCut;
476 - (BOOL)tryDHTMLCopy;
477 - (BOOL)tryDHTMLPaste;
478
479 - (NSMutableDictionary *)dashboardRegions;
480
481 - (void)clear;
482
483 @end
484
485 // The WebCoreFrameBridge protocol contains methods for use by the WebCore side of the bridge.
486
487 // In NSArray objects for post data, NSData objects represent literal data, and NSString objects represent encoded files.
488 // The encoding is the standard form encoding for uploading files.
489
490 @protocol WebCoreFrameBridge
491
492 - (WebCoreFrameBridge *)mainFrame;
493 - (void)frameDetached;
494 - (NSView *)documentView;
495 - (WebView *)webView;
496
497 - (void)loadURL:(NSURL *)URL referrer:(NSString *)referrer reload:(BOOL)reload userGesture:(BOOL)forUser target:(NSString *)target triggeringEvent:(NSEvent *)event form:(DOMElement *)form formValues:(NSDictionary *)values;
498 - (void)postWithURL:(NSURL *)URL referrer:(NSString *)referrer target:(NSString *)target data:(NSArray *)data contentType:(NSString *)contentType triggeringEvent:(NSEvent *)event form:(DOMElement *)form formValues:(NSDictionary *)values;
499
500 - (WebCoreFrameBridge *)createWindowWithURL:(NSURL *)URL frameName:(NSString *)name;
501 - (void)showWindow;
502
503 - (BOOL)canRunModal;
504 - (BOOL)canRunModalNow;
505 - (WebCoreFrameBridge *)createModalDialogWithURL:(NSURL *)URL;
506 - (void)runModal;
507
508 - (NSString *)userAgentForURL:(NSURL *)URL;
509
510 - (void)setTitle:(NSString *)title;
511 - (void)setStatusText:(NSString *)status;
512
513 - (void)setIconURL:(NSURL *)URL;
514 - (void)setIconURL:(NSURL *)URL withType:(NSString *)string;
515
516 - (WebCoreFrameBridge *)createChildFrameNamed:(NSString *)frameName withURL:(NSURL *)URL
517     referrer:(NSString *)referrer
518     renderPart:(WebCoreRenderPart *)renderPart
519     allowsScrolling:(BOOL)allowsScrolling marginWidth:(int)width marginHeight:(int)height;
520
521 - (BOOL)areToolbarsVisible;
522 - (void)setToolbarsVisible:(BOOL)visible;
523 - (BOOL)isStatusbarVisible;
524 - (void)setStatusbarVisible:(BOOL)visible;
525 - (BOOL)areScrollbarsVisible;
526 - (void)setScrollbarsVisible:(BOOL)visible;
527 - (NSWindow *)window;
528 - (void)setWindowFrame:(NSRect)frame;
529 - (NSRect)windowFrame;
530 - (void)setWindowContentRect:(NSRect)frame;
531 - (NSRect)windowContentRect;
532
533 - (void)setWindowIsResizable:(BOOL)resizable;
534 - (BOOL)windowIsResizable;
535
536 - (NSResponder *)firstResponder;
537 - (void)makeFirstResponder:(NSResponder *)responder;
538
539 - (BOOL)wasFirstResponderAtMouseDownTime:(NSResponder *)responder;
540
541 - (void)closeWindowSoon;
542
543 - (void)runJavaScriptAlertPanelWithMessage:(NSString *)message;
544 - (BOOL)runJavaScriptConfirmPanelWithMessage:(NSString *)message;
545 - (BOOL)runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(NSString *)defaultText returningText:(NSString **)result;
546 - (BOOL)canRunBeforeUnloadConfirmPanel;
547 - (BOOL)runBeforeUnloadConfirmPanelWithMessage:(NSString *)message;
548 - (void)addMessageToConsole:(NSDictionary *)message;
549
550 - (id <WebCoreResourceHandle>)startLoadingResource:(id <WebCoreResourceLoader>)loader withURL:(NSURL *)URL customHeaders:(NSDictionary *)customHeaders;
551 - (id <WebCoreResourceHandle>)startLoadingResource:(id <WebCoreResourceLoader>)loader withURL:(NSURL *)URL customHeaders:(NSDictionary *)customHeaders postData:(NSArray *)data;
552 - (void)objectLoadedFromCacheWithURL:(NSURL *)URL response:(NSURLResponse *)response data:(NSData *)data;
553
554 - (NSData *)syncLoadResourceWithURL:(NSURL *)URL customHeaders:(NSDictionary *)requestHeaders postData:(NSArray *)postData finalURL:(NSURL **)finalNSURL responseHeaders:(NSDictionary **)responseHeaderDict statusCode:(int *)statusCode;
555
556 - (BOOL)isReloading;
557 - (time_t)expiresTimeForResponse:(NSURLResponse *)response;
558
559 - (void)reportClientRedirectToURL:(NSURL *)URL delay:(NSTimeInterval)seconds fireDate:(NSDate *)date lockHistory:(BOOL)lockHistory isJavaScriptFormAction:(BOOL)isJavaScriptFormAction;
560 - (void)reportClientRedirectCancelled:(BOOL)cancelWithLoadInProgress;
561
562 - (void)focusWindow;
563 - (void)unfocusWindow;
564
565 - (void)formControlIsResigningFirstResponder:(NSView *)formControl;
566
567 - (NSView *)nextKeyViewOutsideWebFrameViews;
568 - (NSView *)nextValidKeyViewOutsideWebFrameViews;
569 - (NSView *)previousKeyViewOutsideWebFrameViews;
570
571 - (BOOL)defersLoading;
572 - (void)setDefersLoading:(BOOL)loading;
573 - (void)saveDocumentState:(NSArray *)documentState;
574 - (NSArray *)documentState;
575
576 - (void)setNeedsReapplyStyles;
577
578 - (void)tokenizerProcessedData;
579
580 // OK to be an NSString rather than an NSURL.
581 // This URL is only used for coloring visited links.
582 - (NSString *)requestedURLString;
583 - (NSString *)incomingReferrer;
584
585 - (NSView *)viewForPluginWithURL:(NSURL *)URL
586                   attributeNames:(NSArray *)attributeNames
587                  attributeValues:(NSArray *)attributeValues
588                         MIMEType:(NSString *)MIMEType;
589 - (NSView *)viewForJavaAppletWithFrame:(NSRect)frame
590                         attributeNames:(NSArray *)attributeNames
591                        attributeValues:(NSArray *)attributeValues
592                                baseURL:(NSURL *)baseURL;
593
594 - (BOOL)saveDocumentToPageCache:(id)documentInfo;
595
596 - (int)getObjectCacheSize;
597
598 - (ObjectElementType)determineObjectFromMIMEType:(NSString*)MIMEType URL:(NSURL*)URL;
599
600 - (void)loadEmptyDocumentSynchronously;
601
602 - (NSString *)MIMETypeForPath:(NSString *)path;
603
604 - (void)allowDHTMLDrag:(BOOL *)flagDHTML UADrag:(BOOL *)flagUA;
605 - (BOOL)startDraggingImage:(NSImage *)dragImage at:(NSPoint)dragLoc operation:(NSDragOperation)op event:(NSEvent *)event sourceIsDHTML:(BOOL)flag DHTMLWroteData:(BOOL)dhtmlWroteData;
606 - (void)handleAutoscrollForMouseDragged:(NSEvent *)event;
607 - (BOOL)mayStartDragAtEventLocation:(NSPoint)location;
608
609 - (BOOL)selectWordBeforeMenuEvent;
610
611 - (int)historyLength;
612 - (void)goBackOrForward:(int)distance;
613 - (BOOL)canGoBackOrForward:(int)distance;
614
615 - (void)textFieldDidBeginEditing:(DOMHTMLInputElement *)element;
616 - (void)textFieldDidEndEditing:(DOMHTMLInputElement *)element;
617 - (void)textDidChangeInTextField:(DOMHTMLInputElement *)element;
618 - (void)textDidChangeInTextArea:(DOMHTMLTextAreaElement *)element;
619
620 - (BOOL)textField:(DOMHTMLInputElement *)element doCommandBySelector:(SEL)commandSelector;
621 - (BOOL)textField:(DOMHTMLInputElement *)element shouldHandleEvent:(NSEvent *)event;
622
623 - (NSView <WebCoreFileButton> *)fileButtonWithDelegate:(id <WebCoreFileButtonDelegate>)delegate;
624
625 - (void)setHasBorder:(BOOL)hasBorder;
626
627 - (WebCoreKeyboardUIMode)keyboardUIMode;
628
629 - (NSFileWrapper *)fileWrapperForURL:(NSURL *)URL;
630
631 - (void)print;
632
633 - (jobject)getAppletInView:(NSView *)view;
634
635 // Deprecated, use getAppletInView: instead.
636 - (jobject)pollForAppletInView:(NSView *)view;
637
638 - (NSUndoManager *)undoManager;
639 - (NSString *)nameForUndoAction:(WebUndoAction)undoAction;
640 - (void)issueCutCommand;
641 - (void)issueCopyCommand;
642 - (void)issuePasteCommand;
643 - (void)issuePasteAndMatchStyleCommand;
644 - (void)issueTransposeCommand;
645 - (void)respondToChangedSelection;
646 - (void)respondToChangedContents;
647 - (void)setIsSelected:(BOOL)isSelected forView:(NSView *)view;
648 - (BOOL)isEditable;
649 - (BOOL)shouldChangeSelectedDOMRange:(DOMRange *)currentRange toDOMRange:(DOMRange *)proposedRange affinity:(NSSelectionAffinity)selectionAffinity stillSelecting:(BOOL)flag;
650 - (BOOL)shouldBeginEditing:(DOMRange *)range;
651 - (BOOL)shouldEndEditing:(DOMRange *)range;
652 - (void)didBeginEditing;
653 - (void)didEndEditing;
654 - (BOOL)canPaste;
655
656 - (NSString *)overrideMediaType;
657
658 - (void)windowObjectCleared;
659
660 - (int)spellCheckerDocumentTag;
661 - (BOOL)isContinuousSpellCheckingEnabled;
662
663 - (void)didFirstLayout;
664
665 - (void)dashboardRegionsChanged:(NSMutableDictionary *)regions;
666
667 - (BOOL)isCharacterSmartReplaceExempt:(unichar)c isPreviousCharacter:(BOOL)isPreviousCharacter;
668
669 - (void)handledOnloadEvents;
670
671 @end
672
673 // This interface definition allows those who hold a WebCoreFrameBridge * to call all the methods
674 // in the WebCoreFrameBridge protocol without requiring the base implementation to supply the methods.
675 // This idiom is appropriate because WebCoreFrameBridge is an abstract class.
676
677 @interface WebCoreFrameBridge (SubclassResponsibility) <WebCoreFrameBridge>
678 @end
679
680 // One method for internal use within WebCore itself.
681 // Could move this to another header, but would be a pity to create an entire header just for that.
682
683 @interface WebCoreFrameBridge (WebCoreInternalUse)
684 - (WebCoreMacFrame*)impl;
685 @end
686
687 // Protocols that make up part of the interaces above.
688
689 @protocol WebCoreRenderTreeCopier <NSObject>
690 - (NSObject *)nodeWithName:(NSString *)name position:(NSPoint)p rect:(NSRect)rect view:(NSView *)view children:(NSArray *)children;
691 @end
692
693 @protocol WebCoreFileButton <NSObject>
694 - (void)setFilename:(NSString *)filename;
695 - (void)performClick;
696 - (NSString *)filename;
697 - (float)baseline;
698 - (void)setVisualFrame:(NSRect)rect;
699 - (NSRect)visualFrame;
700 - (NSSize)bestVisualFrameSizeForCharacterCount:(int)count;
701 @end
702
703 @protocol WebCoreFileButtonDelegate <NSObject>
704 - (void)filenameChanged:(NSString *)filename;
705 - (void)focusChanged:(BOOL)nowHasFocus;
706 - (void)clicked;
707 @end