WebCore:
[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     ObjectElementNone,
169     ObjectElementImage,
170     ObjectElementFrame,
171     ObjectElementPlugin,
172 } ObjectElementType;
173
174 // WebCoreFrameBridge objects are used by WebCore to abstract away operations that need
175 // to be implemented by library clients, for example WebKit. The objects are also
176 // used in the opposite direction, for simple access to WebCore functions without dealing
177 // directly with the KHTML C++ classes.
178
179 // A WebCoreFrameBridge creates and holds a reference to a Frame.
180
181 // The WebCoreFrameBridge interface contains methods for use by the non-WebCore side of the bridge.
182
183 @interface WebCoreFrameBridge : NSObject
184 {
185     WebCoreMacFrame *m_frame;
186     BOOL _shouldCreateRenderers;
187
188     NSString *_frameNamespace;
189 }
190
191 + (WebCoreFrameBridge *)bridgeForDOMDocument:(DOMDocument *)document;
192
193 - (id)initMainFrameWithPage:(WebCorePageBridge *)page;
194 - (id)initSubframeWithRenderer:(WebCoreRenderPart *)renderer;
195
196 + (NSArray *)supportedMIMETypes;
197
198 - (void)initializeSettings:(WebCoreSettings *)settings;
199
200 - (void)setName:(NSString *)name;
201 - (NSString *)name;
202 /* Creates a name for an frame unnamed in the HTML.  It should produce repeatable results for loads of the same frameset. */
203 - (NSString *)generateFrameName;
204
205 - (WebCorePageBridge *)page;
206
207 - (WebCoreFrameBridge *)parent;
208
209 - (WebCoreFrameBridge *)firstChild;
210 - (WebCoreFrameBridge *)lastChild;
211 - (WebCoreFrameBridge *)previousSibling;
212 - (WebCoreFrameBridge *)nextSibling;
213
214 - (void)appendChild:(WebCoreFrameBridge *)child;
215 - (void)removeChild:(WebCoreFrameBridge *)child;
216
217 - (unsigned)childCount;
218 - (BOOL)isDescendantOfFrame:(WebCoreFrameBridge *)ancestor;
219 - (WebCoreFrameBridge *)traverseNextFrameStayWithin:(WebCoreFrameBridge *)stayWithin;
220
221 - (WebCoreFrameBridge *)nextFrameWithWrap:(BOOL)wrap;
222 - (WebCoreFrameBridge *)previousFrameWithWrap:(BOOL)wrap;
223
224 - (WebCoreFrameBridge *)childFrameNamed:(NSString *)name;
225 - (WebCoreFrameBridge *)findFrameNamed:(NSString *)name;
226
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 - (void)frameDetached;
493 - (NSView *)documentView;
494
495 - (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;
496 - (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;
497
498 - (WebCorePageBridge *)createWindowWithURL:(NSURL *)URL;
499 - (void)showWindow;
500
501 - (BOOL)canRunModal;
502 - (BOOL)canRunModalNow;
503 - (WebCorePageBridge *)createModalDialogWithURL:(NSURL *)URL;
504 - (void)runModal;
505
506 - (NSString *)userAgentForURL:(NSURL *)URL;
507
508 - (void)setTitle:(NSString *)title;
509 - (void)setStatusText:(NSString *)status;
510
511 - (void)setIconURL:(NSURL *)URL;
512 - (void)setIconURL:(NSURL *)URL withType:(NSString *)string;
513
514 - (WebCoreFrameBridge *)createChildFrameNamed:(NSString *)frameName withURL:(NSURL *)URL
515     referrer:(NSString *)referrer
516     renderPart:(WebCoreRenderPart *)renderPart
517     allowsScrolling:(BOOL)allowsScrolling marginWidth:(int)width marginHeight:(int)height;
518
519 - (BOOL)areToolbarsVisible;
520 - (void)setToolbarsVisible:(BOOL)visible;
521 - (BOOL)isStatusbarVisible;
522 - (void)setStatusbarVisible:(BOOL)visible;
523 - (BOOL)areScrollbarsVisible;
524 - (void)setScrollbarsVisible:(BOOL)visible;
525 - (NSWindow *)window;
526 - (void)setWindowFrame:(NSRect)frame;
527 - (NSRect)windowFrame;
528 - (void)setWindowContentRect:(NSRect)frame;
529 - (NSRect)windowContentRect;
530
531 - (void)setWindowIsResizable:(BOOL)resizable;
532 - (BOOL)windowIsResizable;
533
534 - (NSResponder *)firstResponder;
535 - (void)makeFirstResponder:(NSResponder *)responder;
536
537 - (BOOL)wasFirstResponderAtMouseDownTime:(NSResponder *)responder;
538
539 - (void)closeWindowSoon;
540
541 - (void)runJavaScriptAlertPanelWithMessage:(NSString *)message;
542 - (BOOL)runJavaScriptConfirmPanelWithMessage:(NSString *)message;
543 - (BOOL)runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(NSString *)defaultText returningText:(NSString **)result;
544 - (BOOL)canRunBeforeUnloadConfirmPanel;
545 - (BOOL)runBeforeUnloadConfirmPanelWithMessage:(NSString *)message;
546 - (void)addMessageToConsole:(NSDictionary *)message;
547
548 - (id <WebCoreResourceHandle>)startLoadingResource:(id <WebCoreResourceLoader>)loader withURL:(NSURL *)URL customHeaders:(NSDictionary *)customHeaders;
549 - (id <WebCoreResourceHandle>)startLoadingResource:(id <WebCoreResourceLoader>)loader withURL:(NSURL *)URL customHeaders:(NSDictionary *)customHeaders postData:(NSArray *)data;
550 - (void)objectLoadedFromCacheWithURL:(NSURL *)URL response:(NSURLResponse *)response data:(NSData *)data;
551
552 - (NSData *)syncLoadResourceWithURL:(NSURL *)URL customHeaders:(NSDictionary *)requestHeaders postData:(NSArray *)postData finalURL:(NSURL **)finalNSURL responseHeaders:(NSDictionary **)responseHeaderDict statusCode:(int *)statusCode;
553
554 - (BOOL)isReloading;
555 - (time_t)expiresTimeForResponse:(NSURLResponse *)response;
556
557 - (void)reportClientRedirectToURL:(NSURL *)URL delay:(NSTimeInterval)seconds fireDate:(NSDate *)date lockHistory:(BOOL)lockHistory isJavaScriptFormAction:(BOOL)isJavaScriptFormAction;
558 - (void)reportClientRedirectCancelled:(BOOL)cancelWithLoadInProgress;
559
560 - (void)focusWindow;
561 - (void)unfocusWindow;
562
563 - (void)formControlIsResigningFirstResponder:(NSView *)formControl;
564
565 - (NSView *)nextKeyViewOutsideWebFrameViews;
566 - (NSView *)nextValidKeyViewOutsideWebFrameViews;
567 - (NSView *)previousKeyViewOutsideWebFrameViews;
568
569 - (BOOL)defersLoading;
570 - (void)setDefersLoading:(BOOL)loading;
571 - (void)saveDocumentState:(NSArray *)documentState;
572 - (NSArray *)documentState;
573
574 - (void)setNeedsReapplyStyles;
575
576 - (void)tokenizerProcessedData;
577
578 // OK to be an NSString rather than an NSURL.
579 // This URL is only used for coloring visited links.
580 - (NSString *)requestedURLString;
581 - (NSString *)incomingReferrer;
582
583 - (NSView *)viewForPluginWithURL:(NSURL *)URL
584                   attributeNames:(NSArray *)attributeNames
585                  attributeValues:(NSArray *)attributeValues
586                         MIMEType:(NSString *)MIMEType;
587 - (NSView *)viewForJavaAppletWithFrame:(NSRect)frame
588                         attributeNames:(NSArray *)attributeNames
589                        attributeValues:(NSArray *)attributeValues
590                                baseURL:(NSURL *)baseURL;
591
592 - (BOOL)saveDocumentToPageCache:(id)documentInfo;
593
594 - (int)getObjectCacheSize;
595
596 - (ObjectElementType)determineObjectFromMIMEType:(NSString*)MIMEType URL:(NSURL*)URL;
597
598 - (void)loadEmptyDocumentSynchronously;
599
600 - (NSString *)MIMETypeForPath:(NSString *)path;
601
602 - (void)allowDHTMLDrag:(BOOL *)flagDHTML UADrag:(BOOL *)flagUA;
603 - (BOOL)startDraggingImage:(NSImage *)dragImage at:(NSPoint)dragLoc operation:(NSDragOperation)op event:(NSEvent *)event sourceIsDHTML:(BOOL)flag DHTMLWroteData:(BOOL)dhtmlWroteData;
604 - (void)handleAutoscrollForMouseDragged:(NSEvent *)event;
605 - (BOOL)mayStartDragAtEventLocation:(NSPoint)location;
606
607 - (BOOL)selectWordBeforeMenuEvent;
608
609 - (int)historyLength;
610 - (void)goBackOrForward:(int)distance;
611 - (BOOL)canGoBackOrForward:(int)distance;
612
613 - (void)textFieldDidBeginEditing:(DOMHTMLInputElement *)element;
614 - (void)textFieldDidEndEditing:(DOMHTMLInputElement *)element;
615 - (void)textDidChangeInTextField:(DOMHTMLInputElement *)element;
616 - (void)textDidChangeInTextArea:(DOMHTMLTextAreaElement *)element;
617
618 - (BOOL)textField:(DOMHTMLInputElement *)element doCommandBySelector:(SEL)commandSelector;
619 - (BOOL)textField:(DOMHTMLInputElement *)element shouldHandleEvent:(NSEvent *)event;
620
621 - (NSView <WebCoreFileButton> *)fileButtonWithDelegate:(id <WebCoreFileButtonDelegate>)delegate;
622
623 - (void)setHasBorder:(BOOL)hasBorder;
624
625 - (WebCoreKeyboardUIMode)keyboardUIMode;
626
627 - (NSFileWrapper *)fileWrapperForURL:(NSURL *)URL;
628
629 - (void)print;
630
631 - (jobject)getAppletInView:(NSView *)view;
632
633 // Deprecated, use getAppletInView: instead.
634 - (jobject)pollForAppletInView:(NSView *)view;
635
636 - (NSUndoManager *)undoManager;
637 - (NSString *)nameForUndoAction:(WebUndoAction)undoAction;
638 - (void)issueCutCommand;
639 - (void)issueCopyCommand;
640 - (void)issuePasteCommand;
641 - (void)issuePasteAndMatchStyleCommand;
642 - (void)issueTransposeCommand;
643 - (void)respondToChangedSelection;
644 - (void)respondToChangedContents;
645 - (void)setIsSelected:(BOOL)isSelected forView:(NSView *)view;
646 - (BOOL)isEditable;
647 - (BOOL)shouldChangeSelectedDOMRange:(DOMRange *)currentRange toDOMRange:(DOMRange *)proposedRange affinity:(NSSelectionAffinity)selectionAffinity stillSelecting:(BOOL)flag;
648 - (BOOL)shouldBeginEditing:(DOMRange *)range;
649 - (BOOL)shouldEndEditing:(DOMRange *)range;
650 - (void)didBeginEditing;
651 - (void)didEndEditing;
652 - (BOOL)canPaste;
653
654 - (NSString *)overrideMediaType;
655
656 - (void)windowObjectCleared;
657
658 - (int)spellCheckerDocumentTag;
659 - (BOOL)isContinuousSpellCheckingEnabled;
660
661 - (void)didFirstLayout;
662
663 - (void)dashboardRegionsChanged:(NSMutableDictionary *)regions;
664
665 - (BOOL)isCharacterSmartReplaceExempt:(unichar)c isPreviousCharacter:(BOOL)isPreviousCharacter;
666
667 - (void)handledOnloadEvents;
668
669 @end
670
671 // This interface definition allows those who hold a WebCoreFrameBridge * to call all the methods
672 // in the WebCoreFrameBridge protocol without requiring the base implementation to supply the methods.
673 // This idiom is appropriate because WebCoreFrameBridge is an abstract class.
674
675 @interface WebCoreFrameBridge (SubclassResponsibility) <WebCoreFrameBridge>
676 @end
677
678 // One method for internal use within WebCore itself.
679 // Could move this to another header, but would be a pity to create an entire header just for that.
680
681 @interface WebCoreFrameBridge (WebCoreInternalUse)
682 - (WebCoreMacFrame*)impl;
683 @end
684
685 // Protocols that make up part of the interaces above.
686
687 @protocol WebCoreRenderTreeCopier <NSObject>
688 - (NSObject *)nodeWithName:(NSString *)name position:(NSPoint)p rect:(NSRect)rect view:(NSView *)view children:(NSArray *)children;
689 @end
690
691 @protocol WebCoreFileButton <NSObject>
692 - (void)setFilename:(NSString *)filename;
693 - (void)performClick;
694 - (NSString *)filename;
695 - (float)baseline;
696 - (void)setVisualFrame:(NSRect)rect;
697 - (NSRect)visualFrame;
698 - (NSSize)bestVisualFrameSizeForCharacterCount:(int)count;
699 @end
700
701 @protocol WebCoreFileButtonDelegate <NSObject>
702 - (void)filenameChanged:(NSString *)filename;
703 - (void)focusChanged:(BOOL)nowHasFocus;
704 - (void)clicked;
705 @end