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