12e183f63b5de6029cf54fcd8383c007272ed242
[WebKit-https.git] / WebCore / kwq / WebCoreBridge.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 KWQKHTMLPart;
35 class KHTMLView;
36 class RenderArena;
37
38 namespace khtml {
39     class RenderPart;
40     class RenderObject;
41 }
42
43 typedef khtml::RenderPart KHTMLRenderPart;
44
45 #else
46
47 @class KWQKHTMLPart;
48 @class KHTMLView;
49 @class KHTMLRenderPart;
50 @class RenderArena;
51
52 #endif
53
54 @class DOMCSSStyleDeclaration;
55 @class DOMDocument;
56 @class DOMDocumentFragment;
57 @class DOMElement;
58 @class DOMHTMLElement;
59 @class DOMNode;
60 @class DOMRange;
61 @class WebCoreSettings;
62 @class WebScriptObject;
63
64 @protocol WebCoreDOMTreeCopier;
65 @protocol WebCoreRenderTreeCopier;
66 @protocol WebCoreResourceHandle;
67 @protocol WebCoreResourceLoader;
68 @protocol WebCoreFileButton;
69 @protocol WebCoreFileButtonDelegate;
70
71 extern NSString *WebCoreElementDOMNodeKey;
72 extern NSString *WebCoreElementFrameKey;
73 extern NSString *WebCoreElementImageAltStringKey;
74 extern NSString *WebCoreElementImageKey;
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     WebSelectForward,
104     WebSelectBackward,
105     WebSelectRight,
106     WebSelectLeft
107 } WebSelectionDirection;
108
109 typedef enum {
110     WebSelectByCharacter,
111     WebSelectByWord,
112     WebSelectByLine,
113     WebSelectByParagraph,
114     WebSelectToLineBoundary,
115     WebSelectToParagraphBoundary,
116     WebSelectToDocumentBoundary
117 } WebSelectionGranularity;
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 // WebCoreBridge 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 WebCoreBridge creates and holds a reference to a KHTMLPart.
181
182 // The WebCoreBridge interface contains methods for use by the non-WebCore side of the bridge.
183
184 @interface WebCoreBridge : NSObject
185 {
186     KWQKHTMLPart *_part;
187     KHTMLRenderPart *_renderPart;
188     RenderArena *_renderPartArena;
189     BOOL _shouldCreateRenderers;
190 }
191
192 + (WebCoreBridge *)bridgeForDOMDocument:(DOMDocument *)document;
193
194 - (void)initializeSettings:(WebCoreSettings *)settings;
195
196 - (void)setRenderPart:(KHTMLRenderPart *)renderPart;
197 - (KHTMLRenderPart *)renderPart;
198
199 - (void)setName:(NSString *)name;
200 - (NSString *)name;
201
202 - (KWQKHTMLPart *)part;
203
204 - (void)setParent:(WebCoreBridge *)parent;
205
206 - (void)provisionalLoadStarted;
207
208 - (void)openURL:(NSURL *)URL reload:(BOOL)reload
209     contentType:(NSString *)contentType refresh:(NSString *)refresh lastModified:(NSDate *)lastModified
210     pageCache:(NSDictionary *)pageCache;
211 - (void)setEncoding:(NSString *)encoding userChosen:(BOOL)userChosen;
212 - (void)addData:(NSData *)data;
213 - (void)closeURL;
214 - (void)stopLoading;
215
216 - (void)didNotOpenURL:(NSURL *)URL pageCache:(NSDictionary *)pageCache;
217
218 - (BOOL)canLoadURL:(NSURL *)URL fromReferrer:(NSString *)referrer hideReferrer:(BOOL *)hideReferrer;
219
220 - (void)saveDocumentState;
221 - (void)restoreDocumentState;
222
223 - (BOOL)canCachePage;
224 - (BOOL)saveDocumentToPageCache;
225
226 - (void)end;
227 - (void)stop;
228
229 - (void)mainResourceError;
230
231 - (NSURL *)URL;
232 - (NSURL *)baseURL;
233 - (NSString *)referrer;
234 - (NSString *)domain;
235 - (WebCoreBridge *)opener;
236 - (void)setOpener:(WebCoreBridge *)bridge;
237
238 - (void)installInFrame:(NSView *)view;
239 - (void)removeFromFrame;
240
241 - (void)scrollToAnchor:(NSString *)anchor;
242 - (void)scrollToAnchorWithURL:(NSURL *)URL;
243
244 - (BOOL)scrollOverflowInDirection:(WebScrollDirection)direction granularity:(WebScrollGranularity)granularity;
245
246 - (void)createKHTMLViewWithNSView:(NSView *)view marginWidth:(int)mw marginHeight:(int)mh;
247
248 - (BOOL)isFrameSet;
249
250 - (void)reapplyStylesForDeviceType:(WebCoreDeviceType)deviceType;
251 - (void)forceLayoutAdjustingViewSize:(BOOL)adjustSizeFlag;
252 - (void)forceLayoutWithMinimumPageWidth:(float)minPageWidth maximumPageWidth:(float)maxPageWidth adjustingViewSize:(BOOL)adjustSizeFlag;
253 - (void)sendResizeEvent;
254 - (void)sendScrollEvent;
255 - (BOOL)needsLayout;
256 - (void)setNeedsLayout;
257 - (void)drawRect:(NSRect)rect;
258 - (void)adjustPageHeightNew:(float *)newBottom top:(float)oldTop bottom:(float)oldBottom limit:(float)bottomLimit;
259 - (NSArray*)computePageRectsWithPrintWidthScaleFactor:(float)printWidthScaleFactor printHeight:(float)printHeight;
260
261 - (void)setActivationEventNumber:(int)num;
262 - (void)mouseDown:(NSEvent *)event;
263 - (void)mouseUp:(NSEvent *)event;
264 - (void)mouseMoved:(NSEvent *)event;
265 - (void)mouseDragged:(NSEvent *)event;
266
267 // these return YES if event is eaten by WebCore
268 - (BOOL)sendScrollWheelEvent:(NSEvent *)event;
269 - (BOOL)sendContextMenuEvent:(NSEvent *)event;
270
271 - (NSView *)nextKeyView;
272 - (NSView *)previousKeyView;
273
274 - (NSView *)nextKeyViewInsideWebFrameViews;
275 - (NSView *)previousKeyViewInsideWebFrameViews;
276
277 - (NSObject *)copyDOMTree:(id <WebCoreDOMTreeCopier>)copier;
278 - (NSObject *)copyRenderTree:(id <WebCoreRenderTreeCopier>)copier;
279 - (NSString *)renderTreeAsExternalRepresentation;
280
281 - (NSDictionary *)elementAtPoint:(NSPoint)point;
282 - (NSURL *)URLWithAttributeString:(NSString *)string;
283
284 - (DOMElement *)elementWithName:(NSString *)name inForm:(DOMElement *)form;
285 - (DOMElement *)elementForView:(NSView *)view;
286 - (BOOL)elementDoesAutoComplete:(DOMElement *)element;
287 - (BOOL)elementIsPassword:(DOMElement *)element;
288 - (DOMElement *)formForElement:(DOMElement *)element;
289 - (DOMElement *)currentForm;
290 - (NSArray *)controlsInForm:(DOMElement *)form;
291 - (NSString *)searchForLabels:(NSArray *)labels beforeElement:(DOMElement *)element;
292 - (NSString *)matchLabels:(NSArray *)labels againstElement:(DOMElement *)element;
293
294 - (BOOL)searchFor:(NSString *)string direction:(BOOL)forward caseSensitive:(BOOL)caseFlag wrap:(BOOL)wrapFlag;
295 - (void)jumpToSelection;
296
297 - (NSString *)advanceToNextMisspelling;
298 - (NSString *)advanceToNextMisspellingStartingJustBeforeSelection;
299 - (void)unmarkAllMisspellings;
300
301 - (void)setTextSizeMultiplier:(float)multiplier;
302
303 - (CFStringEncoding)textEncoding;
304
305 - (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)string;
306 - (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)string forceUserGesture:(BOOL)forceUserGesture;
307
308 - (DOMDocument *)DOMDocument;
309 - (DOMHTMLElement *)frameElement;
310
311 - (BOOL)isSelectionEditable;
312 - (WebSelectionState)selectionState;
313
314 - (NSAttributedString *)selectedAttributedString;
315 - (NSString *)selectedString;
316
317 - (void)setSelectionFromNone;
318 - (void)setDisplaysWithFocusAttributes:(BOOL)flag;
319
320 - (void)setWindowHasFocus:(BOOL)flag;
321
322 - (NSString *)stringForRange:(DOMRange *)range;
323
324 - (NSString *)markupStringFromNode:(DOMNode *)node nodes:(NSArray **)nodes;
325 - (NSString *)markupStringFromRange:(DOMRange *)range nodes:(NSArray **)nodes;
326
327 - (void)selectAll;
328 - (void)deselectAll;
329 - (void)deselectText;
330
331 - (NSRect)selectionRect;
332 - (NSRect)visibleSelectionRect;
333 - (void)centerSelectionInVisibleArea;
334 - (NSImage *)selectionImage;
335 - (NSRect)caretRectAtNode:(DOMNode *)node offset:(int)offset affinity:(NSSelectionAffinity)affinity;
336 - (NSRect)firstRectForDOMRange:(DOMRange *)range;
337
338 - (void)setSelectedDOMRange:(DOMRange *)range affinity:(NSSelectionAffinity)selectionAffinity closeTyping:(BOOL)closeTyping;
339 - (DOMRange *)selectedDOMRange;
340 - (NSSelectionAffinity)selectionAffinity;
341
342 // Emacs-style-editing "mark"
343 - (void)setMarkDOMRange:(DOMRange *)range;
344 - (DOMRange *)markDOMRange;
345
346 // international text input "marked text"
347 - (void)setMarkedTextDOMRange:(DOMRange *)range customAttributes:(NSArray *)attributes ranges:(NSArray *)ranges;
348 - (DOMRange *)markedTextDOMRange;
349 - (void)replaceMarkedTextWithText:(NSString *)text;
350
351 - (NSAttributedString *)attributedStringFrom:(DOMNode *)startNode startOffset:(int)startOffset to:(DOMNode *)endNode endOffset:(int)endOffset;
352
353 - (NSFont *)fontForSelection:(BOOL *)hasMultipleFonts;
354 - (NSDictionary *)fontAttributesForSelectionStart;
355 - (NSWritingDirection)baseWritingDirectionForSelectionStart;
356
357 + (NSString *)stringWithData:(NSData *)data textEncoding:(CFStringEncoding)textEncoding;
358 + (NSString *)stringWithData:(NSData *)data textEncodingName:(NSString *)textEncodingName;
359
360 - (BOOL)interceptKeyEvent:(NSEvent *)event toView:(NSView *)view;
361
362 - (void)setShouldCreateRenderers:(BOOL)f;
363 - (BOOL)shouldCreateRenderers;
364
365 - (int)numPendingOrLoadingRequests;
366 - (BOOL)doneProcessingData;
367
368 - (void)setDrawsBackground:(BOOL)drawsBackround;
369
370 - (NSColor *)bodyBackgroundColor;
371 - (NSColor *)selectionColor;
372
373 - (void)adjustViewSize;
374
375 - (id)accessibilityTree;
376
377 - (void)undoEditing:(id)arg;
378 - (void)redoEditing:(id)arg;
379
380 - (DOMRange *)rangeByExpandingSelectionWithGranularity:(WebSelectionGranularity)granularity;
381 - (DOMRange *)rangeOfCharactersAroundCaret;
382 - (DOMRange *)rangeByAlteringCurrentSelection:(WebSelectionAlteration)alteration direction:(WebSelectionDirection)direction granularity:(WebSelectionGranularity)granularity;
383 - (void)alterCurrentSelection:(WebSelectionAlteration)alteration direction:(WebSelectionDirection)direction granularity:(WebSelectionGranularity)granularity;
384 - (DOMRange *)rangeByAlteringCurrentSelection:(WebSelectionAlteration)alteration verticalDistance:(float)distance;
385 - (void)alterCurrentSelection:(WebSelectionAlteration)alteration verticalDistance:(float)distance;
386 - (WebSelectionGranularity)selectionGranularity;
387 - (DOMRange *)smartDeleteRangeForProposedRange:(DOMRange *)proposedCharRange;
388 - (void)smartInsertForString:(NSString *)pasteString replacingRange:(DOMRange *)charRangeToReplace beforeString:(NSString **)beforeString afterString:(NSString **)afterString;
389 - (BOOL)canDeleteRange:(DOMRange *)range;
390 - (void)selectNSRange:(NSRange)range;
391 - (NSRange)selectedNSRange;
392 - (NSRange)markedTextNSRange;
393 - (DOMRange *)convertToObjCDOMRange:(NSRange)range;
394
395 - (DOMDocumentFragment *)documentFragmentWithMarkupString:(NSString *)markupString baseURLString:(NSString *)baseURLString;
396 - (DOMDocumentFragment *)documentFragmentWithText:(NSString *)text;
397
398 - (void)replaceSelectionWithFragment:(DOMDocumentFragment *)fragment selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace matchStyle:(BOOL)matchStyle;
399 - (void)replaceSelectionWithNode:(DOMNode *)node selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace;
400 - (void)replaceSelectionWithMarkupString:(NSString *)markupString baseURLString:(NSString *)baseURLString selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace;
401 - (void)replaceSelectionWithText:(NSString *)text selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace;
402
403 - (void)insertLineBreak;
404 - (void)insertParagraphSeparator;
405 - (void)insertParagraphSeparatorInQuotedContent;
406 - (void)insertText:(NSString *)text selectInsertedText:(BOOL)selectInsertedText;
407
408 - (void)setSelectionToDragCaret;
409 - (void)moveSelectionToDragCaret:(DOMDocumentFragment *)selectionFragment smartMove:(BOOL)smartMove;
410 - (void)moveDragCaretToPoint:(NSPoint)point;
411 - (void)removeDragCaret;
412 - (DOMRange *)dragCaretDOMRange;
413 - (DOMRange *)editableDOMRangeForPoint:(NSPoint)point;
414
415 - (void)deleteSelectionWithSmartDelete:(BOOL)smartDelete;
416 - (void)deleteKeyPressedWithSmartDelete:(BOOL)smartDelete;
417 - (void)forwardDeleteKeyPressedWithSmartDelete:(BOOL)smartDelete;
418
419 - (DOMCSSStyleDeclaration *)typingStyle;
420 - (void)setTypingStyle:(DOMCSSStyleDeclaration *)style withUndoAction:(WebUndoAction)undoAction;
421 - (void)applyStyle:(DOMCSSStyleDeclaration *)style withUndoAction:(WebUndoAction)undoAction;
422 - (void)applyParagraphStyle:(DOMCSSStyleDeclaration *)style withUndoAction:(WebUndoAction)undoAction;
423 - (BOOL)selectionStartHasStyle:(DOMCSSStyleDeclaration *)style;
424 - (NSCellStateValue)selectionHasStyle:(DOMCSSStyleDeclaration *)style;
425 - (void)applyEditingStyleToBodyElement;
426 - (void)removeEditingStyleFromBodyElement;
427 - (void)applyEditingStyleToElement:(DOMElement *)element;
428 - (void)removeEditingStyleFromElement:(DOMElement *)element;
429
430 - (void)ensureSelectionVisible;
431
432 - (WebScriptObject *)windowScriptObject;
433 - (NPObject *)windowScriptNPObject;
434
435 - (BOOL)eventMayStartDrag:(NSEvent *)event;
436 - (NSDragOperation)dragOperationForDraggingInfo:(id <NSDraggingInfo>)info;
437 - (void)dragExitedWithDraggingInfo:(id <NSDraggingInfo>)info;
438 - (BOOL)concludeDragForDraggingInfo:(id <NSDraggingInfo>)info;
439 - (void)dragSourceMovedTo:(NSPoint)windowLoc;
440 - (void)dragSourceEndedAt:(NSPoint)windowLoc operation:(NSDragOperation)operation;
441
442 - (BOOL)mayDHTMLCut;
443 - (BOOL)mayDHTMLCopy;
444 - (BOOL)mayDHTMLPaste;
445 - (BOOL)tryDHTMLCut;
446 - (BOOL)tryDHTMLCopy;
447 - (BOOL)tryDHTMLPaste;
448
449 - (NSMutableDictionary *)dashboardRegions;
450
451 - (void)clear;
452
453 @end
454
455 // The WebCoreBridge protocol contains methods for use by the WebCore side of the bridge.
456
457 // In NSArray objects for post data, NSData objects represent literal data, and NSString objects represent encoded files.
458 // The encoding is the standard form encoding for uploading files.
459
460 @protocol WebCoreBridge
461
462 - (NSArray *)childFrames; // WebCoreBridge objects
463 - (WebCoreBridge *)mainFrame;
464 - (WebCoreBridge *)findFrameNamed:(NSString *)name;
465 /* Creates a name for an frame unnamed in the HTML.  It should produce repeatable results for loads of the same frameset. */
466 - (NSString *)generateFrameName;
467 - (void)frameDetached;
468 - (NSView *)documentView;
469
470 - (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;
471 - (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;
472
473 - (WebCoreBridge *)createWindowWithURL:(NSURL *)URL frameName:(NSString *)name;
474 - (void)showWindow;
475
476 - (BOOL)canRunModal;
477 - (BOOL)canRunModalNow;
478 - (WebCoreBridge *)createModalDialogWithURL:(NSURL *)URL;
479 - (void)runModal;
480
481 - (NSString *)userAgentForURL:(NSURL *)URL;
482
483 - (void)setTitle:(NSString *)title;
484 - (void)setStatusText:(NSString *)status;
485
486 - (void)setIconURL:(NSURL *)URL;
487 - (void)setIconURL:(NSURL *)URL withType:(NSString *)string;
488
489 - (WebCoreBridge *)createChildFrameNamed:(NSString *)frameName withURL:(NSURL *)URL
490     referrer:(NSString *)referrer
491     renderPart:(KHTMLRenderPart *)renderPart
492     allowsScrolling:(BOOL)allowsScrolling marginWidth:(int)width marginHeight:(int)height;
493
494 - (BOOL)areToolbarsVisible;
495 - (void)setToolbarsVisible:(BOOL)visible;
496 - (BOOL)isStatusBarVisible;
497 - (void)setStatusBarVisible:(BOOL)visible;
498 - (BOOL)areScrollbarsVisible;
499 - (void)setScrollbarsVisible:(BOOL)visible;
500 - (NSWindow *)window;
501 - (void)setWindowFrame:(NSRect)frame;
502 - (NSRect)windowFrame;
503 - (void)setWindowContentRect:(NSRect)frame;
504 - (NSRect)windowContentRect;
505
506 - (void)setWindowIsResizable:(BOOL)resizable;
507 - (BOOL)windowIsResizable;
508
509 - (NSResponder *)firstResponder;
510 - (void)makeFirstResponder:(NSResponder *)responder;
511
512 - (BOOL)wasFirstResponderAtMouseDownTime:(NSResponder *)responder;
513
514 - (void)closeWindowSoon;
515
516 - (void)runJavaScriptAlertPanelWithMessage:(NSString *)message;
517 - (BOOL)runJavaScriptConfirmPanelWithMessage:(NSString *)message;
518 - (BOOL)runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(NSString *)defaultText returningText:(NSString **)result;
519 - (void)addMessageToConsole:(NSDictionary *)message;
520
521 - (id <WebCoreResourceHandle>)startLoadingResource:(id <WebCoreResourceLoader>)loader withURL:(NSURL *)URL customHeaders:(NSDictionary *)customHeaders;
522 - (id <WebCoreResourceHandle>)startLoadingResource:(id <WebCoreResourceLoader>)loader withURL:(NSURL *)URL customHeaders:(NSDictionary *)customHeaders postData:(NSArray *)data;
523 - (void)objectLoadedFromCacheWithURL:(NSURL *)URL response:(NSURLResponse *)response data:(NSData *)data;
524
525 - (NSData *)syncLoadResourceWithURL:(NSURL *)URL customHeaders:(NSDictionary *)requestHeaders postData:(NSArray *)postData finalURL:(NSURL **)finalNSURL responseHeaders:(NSDictionary **)responseHeaderDict statusCode:(int *)statusCode;
526
527 - (BOOL)isReloading;
528 - (time_t)expiresTimeForResponse:(NSURLResponse *)response;
529
530 - (void)reportClientRedirectToURL:(NSURL *)URL delay:(NSTimeInterval)seconds fireDate:(NSDate *)date lockHistory:(BOOL)lockHistory isJavaScriptFormAction:(BOOL)isJavaScriptFormAction;
531 - (void)reportClientRedirectCancelled:(BOOL)cancelWithLoadInProgress;
532
533 - (void)focusWindow;
534 - (void)unfocusWindow;
535
536 - (void)formControlIsResigningFirstResponder:(NSView *)formControl;
537
538 - (NSView *)nextKeyViewOutsideWebFrameViews;
539 - (NSView *)nextValidKeyViewOutsideWebFrameViews;
540 - (NSView *)previousKeyViewOutsideWebFrameViews;
541
542 - (BOOL)defersLoading;
543 - (void)setDefersLoading:(BOOL)loading;
544 - (void)saveDocumentState:(NSArray *)documentState;
545 - (NSArray *)documentState;
546
547 - (void)setNeedsReapplyStyles;
548
549 - (void)tokenizerProcessedData;
550
551 // OK to be an NSString rather than an NSURL.
552 // This URL is only used for coloring visited links.
553 - (NSString *)requestedURLString;
554 - (NSString *)incomingReferrer;
555
556 - (NSView *)viewForPluginWithURL:(NSURL *)URL
557                   attributeNames:(NSArray *)attributeNames
558                  attributeValues:(NSArray *)attributeValues
559                         MIMEType:(NSString *)MIMEType;
560 - (NSView *)viewForJavaAppletWithFrame:(NSRect)frame
561                         attributeNames:(NSArray *)attributeNames
562                        attributeValues:(NSArray *)attributeValues
563                                baseURL:(NSURL *)baseURL;
564
565 - (BOOL)saveDocumentToPageCache:(id)documentInfo;
566
567 - (int)getObjectCacheSize;
568
569 - (ObjectElementType)determineObjectFromMIMEType:(NSString*)MIMEType URL:(NSURL*)URL;
570
571 - (void)loadEmptyDocumentSynchronously;
572
573 - (NSString *)MIMETypeForPath:(NSString *)path;
574
575 - (void)allowDHTMLDrag:(BOOL *)flagDHTML UADrag:(BOOL *)flagUA;
576 - (BOOL)startDraggingImage:(NSImage *)dragImage at:(NSPoint)dragLoc operation:(NSDragOperation)op event:(NSEvent *)event sourceIsDHTML:(BOOL)flag DHTMLWroteData:(BOOL)dhtmlWroteData;
577 - (void)handleAutoscrollForMouseDragged:(NSEvent *)event;
578 - (BOOL)mayStartDragAtEventLocation:(NSPoint)location;
579
580 - (BOOL)selectWordBeforeMenuEvent;
581
582 - (int)historyLength;
583 - (void)goBackOrForward:(int)distance;
584 - (BOOL)canGoBackOrForward:(int)distance;
585
586 - (void)controlTextDidBeginEditing:(NSNotification *)obj;
587 - (void)controlTextDidEndEditing:(NSNotification *)obj;
588 - (void)controlTextDidChange:(NSNotification *)obj;
589 - (void)textDidChange:(NSNotification *)obj;
590
591 - (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)fieldEditor;
592 - (BOOL)control:(NSControl *)control textShouldEndEditing:(NSText *)fieldEditor;
593 - (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)commandSelector;
594 - (BOOL)control:(NSControl *)control textView:(NSTextView *)textView shouldHandleEvent:(NSEvent *)event;
595
596 - (NSView <WebCoreFileButton> *)fileButtonWithDelegate:(id <WebCoreFileButtonDelegate>)delegate;
597
598 - (void)setHasBorder:(BOOL)hasBorder;
599
600 - (WebCoreKeyboardUIMode)keyboardUIMode;
601
602 - (void)didSetName:(NSString *)name;
603
604 - (NSFileWrapper *)fileWrapperForURL:(NSURL *)URL;
605
606 - (void)print;
607
608 - (jobject)getAppletInView:(NSView *)view;
609
610 // Deprecated, use getAppletInView: instead.
611 - (jobject)pollForAppletInView:(NSView *)view;
612
613 - (NSUndoManager *)undoManager;
614 - (NSString *)nameForUndoAction:(WebUndoAction)undoAction;
615 - (void)issueCutCommand;
616 - (void)issueCopyCommand;
617 - (void)issuePasteCommand;
618 - (void)issuePasteAndMatchStyleCommand;
619 - (void)issueTransposeCommand;
620 - (void)respondToChangedSelection;
621 - (void)respondToChangedContents;
622 - (void)setIsSelected:(BOOL)isSelected forView:(NSView *)view;
623 - (BOOL)isEditable;
624 - (BOOL)shouldBeginEditing:(DOMRange *)range;
625 - (BOOL)shouldEndEditing:(DOMRange *)range;
626 - (BOOL)canPaste;
627
628 - (NSString *)overrideMediaType;
629
630 - (void)windowObjectCleared;
631
632 - (int)spellCheckerDocumentTag;
633 - (BOOL)isContinuousSpellCheckingEnabled;
634
635 - (void)didFirstLayout;
636
637 - (void)dashboardRegionsChanged:(NSMutableDictionary *)regions;
638
639 - (BOOL)isCharacterSmartReplaceExempt:(unichar)c isPreviousCharacter:(BOOL)isPreviousCharacter;
640
641 @end
642
643 // This interface definition allows those who hold a WebCoreBridge * to call all the methods
644 // in the WebCoreBridge protocol without requiring the base implementation to supply the methods.
645 // This idiom is appropriate because WebCoreBridge is an abstract class.
646
647 @interface WebCoreBridge (SubclassResponsibility) <WebCoreBridge>
648 @end
649
650 @protocol WebCoreDOMTreeCopier <NSObject>
651 - (NSObject *)nodeWithName:(NSString *)name value:(NSString *)value source:(NSString *)source children:(NSArray *)children;
652 @end
653
654 @protocol WebCoreRenderTreeCopier <NSObject>
655 - (NSObject *)nodeWithName:(NSString *)name position:(NSPoint)p rect:(NSRect)rect view:(NSView *)view children:(NSArray *)children;
656 @end
657
658 @protocol WebCoreFileButton <NSObject>
659 - (void)setFilename:(NSString *)filename;
660 - (void)performClick;
661 - (NSString *)filename;
662 - (float)baseline;
663 - (void)setVisualFrame:(NSRect)rect;
664 - (NSRect)visualFrame;
665 - (NSSize)bestVisualFrameSizeForCharacterCount:(int)count;
666 @end
667
668 @protocol WebCoreFileButtonDelegate <NSObject>
669 - (void)filenameChanged:(NSString *)filename;
670 - (void)focusChanged:(BOOL)nowHasFocus;
671 - (void)clicked;
672 @end