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